@noir-lang/acvm_js 0.55.0 → 1.0.0-9c1fafc.nightly

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/web/acvm_js.js CHANGED
@@ -1,129 +1,616 @@
1
- let wasm;
1
+ /* @ts-self-types="./acvm_js.d.ts" */
2
2
 
3
- const heap = new Array(128).fill(undefined);
4
-
5
- heap.push(undefined, null, true, false);
6
-
7
- function getObject(idx) { return heap[idx]; }
8
-
9
- let heap_next = heap.length;
3
+ /**
4
+ * Performs a bitwise AND operation between `lhs` and `rhs`
5
+ * @param {string} lhs
6
+ * @param {string} rhs
7
+ * @returns {string}
8
+ */
9
+ export function and(lhs, rhs) {
10
+ const ret = wasm.and(lhs, rhs);
11
+ return ret;
12
+ }
10
13
 
11
- function dropObject(idx) {
12
- if (idx < 132) return;
13
- heap[idx] = heap_next;
14
- heap_next = idx;
14
+ /**
15
+ * Calculates the Blake2s256 hash of the input bytes
16
+ * @param {Uint8Array} inputs
17
+ * @returns {Uint8Array}
18
+ */
19
+ export function blake2s256(inputs) {
20
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
21
+ const len0 = WASM_VECTOR_LEN;
22
+ const ret = wasm.blake2s256(ptr0, len0);
23
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
24
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
25
+ return v2;
15
26
  }
16
27
 
17
- function takeObject(idx) {
18
- const ret = getObject(idx);
19
- dropObject(idx);
28
+ /**
29
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
30
+ * @returns {`BuildInfo`} - Information on how the installed package was built.
31
+ */
32
+ export function buildInfo() {
33
+ const ret = wasm.buildInfo();
20
34
  return ret;
21
35
  }
22
36
 
23
- function isLikeNone(x) {
24
- return x === undefined || x === null;
37
+ /**
38
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
39
+ *
40
+ * @param {`WitnessMap`} `witness_map` - A witness map.
41
+ * @returns {`Uint8Array`} A compressed witness map
42
+ */
43
+ export function compressWitness(witness_map) {
44
+ const ret = wasm.compressWitness(witness_map);
45
+ if (ret[3]) {
46
+ throw takeFromExternrefTable0(ret[2]);
47
+ }
48
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
49
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
50
+ return v1;
25
51
  }
26
52
 
27
- let cachedFloat64Memory0 = null;
28
-
29
- function getFloat64Memory0() {
30
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
31
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
53
+ /**
54
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
55
+ *
56
+ * @param {`WitnessStack`} `witness_stack` - A witness stack.
57
+ * @returns {`Uint8Array`} A compressed witness stack
58
+ */
59
+ export function compressWitnessStack(witness_stack) {
60
+ const ret = wasm.compressWitnessStack(witness_stack);
61
+ if (ret[3]) {
62
+ throw takeFromExternrefTable0(ret[2]);
32
63
  }
33
- return cachedFloat64Memory0;
64
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
65
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
66
+ return v1;
34
67
  }
35
68
 
36
- let cachedInt32Memory0 = null;
69
+ /**
70
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
71
+ * This should be used to only fetch the witness map for the main function.
72
+ *
73
+ * @param {`Uint8Array`} `compressed_witness` - A compressed witness.
74
+ * @returns {`WitnessMap`} The decompressed witness map.
75
+ */
76
+ export function decompressWitness(compressed_witness) {
77
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
78
+ const len0 = WASM_VECTOR_LEN;
79
+ const ret = wasm.decompressWitness(ptr0, len0);
80
+ if (ret[2]) {
81
+ throw takeFromExternrefTable0(ret[1]);
82
+ }
83
+ return takeFromExternrefTable0(ret[0]);
84
+ }
37
85
 
38
- function getInt32Memory0() {
39
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
40
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
86
+ /**
87
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
88
+ *
89
+ * @param {`Uint8Array`} `compressed_witness` - A compressed witness.
90
+ * @returns {`WitnessStack`} The decompressed witness stack.
91
+ */
92
+ export function decompressWitnessStack(compressed_witness) {
93
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
94
+ const len0 = WASM_VECTOR_LEN;
95
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
96
+ if (ret[2]) {
97
+ throw takeFromExternrefTable0(ret[1]);
41
98
  }
42
- return cachedInt32Memory0;
99
+ return takeFromExternrefTable0(ret[0]);
43
100
  }
44
101
 
45
- function addHeapObject(obj) {
46
- if (heap_next === heap.length) heap.push(heap.length + 1);
47
- const idx = heap_next;
48
- heap_next = heap[idx];
102
+ /**
103
+ * Verifies a ECDSA signature over the secp256k1 curve.
104
+ * @param {Uint8Array} hashed_msg
105
+ * @param {Uint8Array} public_key_x_bytes
106
+ * @param {Uint8Array} public_key_y_bytes
107
+ * @param {Uint8Array} signature
108
+ * @returns {boolean}
109
+ */
110
+ export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
111
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
112
+ const len0 = WASM_VECTOR_LEN;
113
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
114
+ const len1 = WASM_VECTOR_LEN;
115
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
116
+ const len2 = WASM_VECTOR_LEN;
117
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
118
+ const len3 = WASM_VECTOR_LEN;
119
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
120
+ return ret !== 0;
121
+ }
49
122
 
50
- heap[idx] = obj;
51
- return idx;
123
+ /**
124
+ * Verifies a ECDSA signature over the secp256r1 curve.
125
+ * @param {Uint8Array} hashed_msg
126
+ * @param {Uint8Array} public_key_x_bytes
127
+ * @param {Uint8Array} public_key_y_bytes
128
+ * @param {Uint8Array} signature
129
+ * @returns {boolean}
130
+ */
131
+ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
132
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
133
+ const len0 = WASM_VECTOR_LEN;
134
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
135
+ const len1 = WASM_VECTOR_LEN;
136
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
137
+ const len2 = WASM_VECTOR_LEN;
138
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
139
+ const len3 = WASM_VECTOR_LEN;
140
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
141
+ return ret !== 0;
52
142
  }
53
143
 
54
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
144
+ /**
145
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
146
+ *
147
+ * @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
148
+ * @param {`WitnessMap`} `initial_witness` - The initial witness map defining all of the inputs to `circuit`..
149
+ * @param {`ForeignCallHandler`} `foreign_call_handler` - A callback to process any foreign calls from the circuit.
150
+ * @returns {`WitnessMap`} The solved witness calculated by executing the circuit on the provided inputs.
151
+ */
152
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
153
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
154
+ const len0 = WASM_VECTOR_LEN;
155
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
156
+ return ret;
157
+ }
55
158
 
56
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
159
+ /**
160
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
161
+ * This method also extracts the public return values from the solved witness into its own return witness.
162
+ *
163
+ * @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
164
+ * @param {`WitnessMap`} `initial_witness` - The initial witness map defining all of the inputs to `circuit`..
165
+ * @param {`ForeignCallHandler`} `foreign_call_handler` - A callback to process any foreign calls from the circuit.
166
+ * @returns {`SolvedAndReturnWitness`} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
167
+ */
168
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
169
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
170
+ const len0 = WASM_VECTOR_LEN;
171
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
172
+ return ret;
173
+ }
57
174
 
58
- let cachedUint8Memory0 = null;
175
+ /**
176
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
177
+ *
178
+ * @param {`Uint8Array`} program - A serialized representation of an ACIR program
179
+ * @param {`WitnessMap`} `initial_witness` - The initial witness map defining all of the inputs to `program`.
180
+ * @param {`ForeignCallHandler`} `foreign_call_handler` - A callback to process any foreign calls from the program.
181
+ * @returns {`WitnessStack`} The solved witness calculated by executing the program on the provided inputs.
182
+ */
183
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
184
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
185
+ const len0 = WASM_VECTOR_LEN;
186
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
187
+ return ret;
188
+ }
59
189
 
60
- function getUint8Memory0() {
61
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
62
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
190
+ /**
191
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
192
+ *
193
+ * @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
194
+ * @param {`WitnessMap`} `witness_map` - The completed witness map after executing the circuit.
195
+ * @returns {`WitnessMap`} A witness map containing the circuit's public parameters.
196
+ * @param {Uint8Array} program
197
+ * @param {WitnessMap} solved_witness
198
+ * @returns {WitnessMap}
199
+ */
200
+ export function getPublicParametersWitness(program, solved_witness) {
201
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
202
+ const len0 = WASM_VECTOR_LEN;
203
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
204
+ if (ret[2]) {
205
+ throw takeFromExternrefTable0(ret[1]);
63
206
  }
64
- return cachedUint8Memory0;
207
+ return takeFromExternrefTable0(ret[0]);
65
208
  }
66
209
 
67
- function getStringFromWasm0(ptr, len) {
68
- ptr = ptr >>> 0;
69
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
210
+ /**
211
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
212
+ *
213
+ * @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
214
+ * @param {`WitnessMap`} `witness_map` - The completed witness map after executing the circuit.
215
+ * @returns {`WitnessMap`} A witness map containing the circuit's public inputs.
216
+ * @param {Uint8Array} program
217
+ * @param {WitnessMap} solved_witness
218
+ * @returns {WitnessMap}
219
+ */
220
+ export function getPublicWitness(program, solved_witness) {
221
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
222
+ const len0 = WASM_VECTOR_LEN;
223
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
224
+ if (ret[2]) {
225
+ throw takeFromExternrefTable0(ret[1]);
226
+ }
227
+ return takeFromExternrefTable0(ret[0]);
70
228
  }
71
229
 
72
- let WASM_VECTOR_LEN = 0;
73
-
74
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
75
-
76
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
77
- ? function (arg, view) {
78
- return cachedTextEncoder.encodeInto(arg, view);
230
+ /**
231
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
232
+ *
233
+ * @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
234
+ * @param {`WitnessMap`} `witness_map` - The completed witness map after executing the circuit.
235
+ * @returns {`WitnessMap`} A witness map containing the circuit's return values.
236
+ * @param {Uint8Array} program
237
+ * @param {WitnessMap} witness_map
238
+ * @returns {WitnessMap}
239
+ */
240
+ export function getReturnWitness(program, witness_map) {
241
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
242
+ const len0 = WASM_VECTOR_LEN;
243
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
244
+ if (ret[2]) {
245
+ throw takeFromExternrefTable0(ret[1]);
246
+ }
247
+ return takeFromExternrefTable0(ret[0]);
79
248
  }
80
- : function (arg, view) {
81
- const buf = cachedTextEncoder.encode(arg);
82
- view.set(buf);
83
- return {
84
- read: arg.length,
85
- written: buf.length
86
- };
87
- });
88
-
89
- function passStringToWasm0(arg, malloc, realloc) {
90
249
 
91
- if (realloc === undefined) {
92
- const buf = cachedTextEncoder.encode(arg);
93
- const ptr = malloc(buf.length) >>> 0;
94
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
95
- WASM_VECTOR_LEN = buf.length;
96
- return ptr;
250
+ /**
251
+ * Sets the package's logging level.
252
+ *
253
+ * @param {`LogLevel`} level - The maximum level of logging to be emitted.
254
+ */
255
+ export function initLogLevel(filter) {
256
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
257
+ const len0 = WASM_VECTOR_LEN;
258
+ const ret = wasm.initLogLevel(ptr0, len0);
259
+ if (ret[1]) {
260
+ throw takeFromExternrefTable0(ret[0]);
97
261
  }
262
+ }
98
263
 
99
- let len = arg.length;
100
- let ptr = malloc(len) >>> 0;
264
+ /**
265
+ * Sha256 compression function
266
+ * @param {Uint32Array} inputs
267
+ * @param {Uint32Array} state
268
+ * @returns {Uint32Array}
269
+ */
270
+ export function sha256_compression(inputs, state) {
271
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
272
+ const len0 = WASM_VECTOR_LEN;
273
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
274
+ const len1 = WASM_VECTOR_LEN;
275
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
276
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
277
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
278
+ return v3;
279
+ }
101
280
 
102
- const mem = getUint8Memory0();
281
+ /**
282
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
283
+ * @param {string} lhs
284
+ * @param {string} rhs
285
+ * @returns {string}
286
+ */
287
+ export function xor(lhs, rhs) {
288
+ const ret = wasm.xor(lhs, rhs);
289
+ return ret;
290
+ }
103
291
 
104
- let offset = 0;
292
+ function __wbg_get_imports() {
293
+ const import0 = {
294
+ __proto__: null,
295
+ __wbg___wbindgen_debug_string_ddde1867f49c2442: function(arg0, arg1) {
296
+ const ret = debugString(arg1);
297
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
298
+ const len1 = WASM_VECTOR_LEN;
299
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
300
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
301
+ },
302
+ __wbg___wbindgen_is_function_d633e708baf0d146: function(arg0) {
303
+ const ret = typeof(arg0) === 'function';
304
+ return ret;
305
+ },
306
+ __wbg___wbindgen_is_string_7debe47dc1e045c2: function(arg0) {
307
+ const ret = typeof(arg0) === 'string';
308
+ return ret;
309
+ },
310
+ __wbg___wbindgen_is_undefined_c18285b9fc34cb7d: function(arg0) {
311
+ const ret = arg0 === undefined;
312
+ return ret;
313
+ },
314
+ __wbg___wbindgen_number_get_5854912275df1894: function(arg0, arg1) {
315
+ const obj = arg1;
316
+ const ret = typeof(obj) === 'number' ? obj : undefined;
317
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
318
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
319
+ },
320
+ __wbg___wbindgen_string_get_3e5751597f39a112: function(arg0, arg1) {
321
+ const obj = arg1;
322
+ const ret = typeof(obj) === 'string' ? obj : undefined;
323
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
324
+ var len1 = WASM_VECTOR_LEN;
325
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
326
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
327
+ },
328
+ __wbg___wbindgen_throw_39bc967c0e5a9b58: function(arg0, arg1) {
329
+ throw new Error(getStringFromWasm0(arg0, arg1));
330
+ },
331
+ __wbg__wbg_cb_unref_b6d832240a919168: function(arg0) {
332
+ arg0._wbg_cb_unref();
333
+ },
334
+ __wbg_call_08ad0d89caa7cb79: function() { return handleError(function (arg0, arg1, arg2) {
335
+ const ret = arg0.call(arg1, arg2);
336
+ return ret;
337
+ }, arguments); },
338
+ __wbg_call_c974f0bf2231552e: function() { return handleError(function (arg0, arg1, arg2, arg3) {
339
+ const ret = arg0.call(arg1, arg2, arg3);
340
+ return ret;
341
+ }, arguments); },
342
+ __wbg_constructor_8ecaa06e31f2da98: function(arg0) {
343
+ const ret = new Error(arg0);
344
+ return ret;
345
+ },
346
+ __wbg_constructor_bcbf1d677593ace5: function(arg0) {
347
+ const ret = new Error(arg0);
348
+ return ret;
349
+ },
350
+ __wbg_debug_8804c16f548276da: function(arg0, arg1, arg2, arg3) {
351
+ console.debug(arg0, arg1, arg2, arg3);
352
+ },
353
+ __wbg_debug_e69ad32e6af73f94: function(arg0) {
354
+ console.debug(arg0);
355
+ },
356
+ __wbg_error_91d10625a3b36a08: function(arg0, arg1, arg2, arg3) {
357
+ console.error(arg0, arg1, arg2, arg3);
358
+ },
359
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
360
+ let deferred0_0;
361
+ let deferred0_1;
362
+ try {
363
+ deferred0_0 = arg0;
364
+ deferred0_1 = arg1;
365
+ console.error(getStringFromWasm0(arg0, arg1));
366
+ } finally {
367
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
368
+ }
369
+ },
370
+ __wbg_error_ad28debb48b5c6bb: function(arg0) {
371
+ console.error(arg0);
372
+ },
373
+ __wbg_forEach_9694464cb60ea370: function(arg0, arg1, arg2) {
374
+ try {
375
+ var state0 = {a: arg1, b: arg2};
376
+ var cb0 = (arg0, arg1) => {
377
+ const a = state0.a;
378
+ state0.a = 0;
379
+ try {
380
+ return wasm_bindgen__convert__closures_____invoke__h75e989036704f034(a, state0.b, arg0, arg1);
381
+ } finally {
382
+ state0.a = a;
383
+ }
384
+ };
385
+ arg0.forEach(cb0);
386
+ } finally {
387
+ state0.a = state0.b = 0;
388
+ }
389
+ },
390
+ __wbg_forEach_f33e388a24ae7d4f: function(arg0, arg1, arg2) {
391
+ try {
392
+ var state0 = {a: arg1, b: arg2};
393
+ var cb0 = (arg0, arg1, arg2) => {
394
+ const a = state0.a;
395
+ state0.a = 0;
396
+ try {
397
+ return wasm_bindgen__convert__closures_____invoke__h19cd9ea1cbe9b0b3(a, state0.b, arg0, arg1, arg2);
398
+ } finally {
399
+ state0.a = a;
400
+ }
401
+ };
402
+ arg0.forEach(cb0);
403
+ } finally {
404
+ state0.a = state0.b = 0;
405
+ }
406
+ },
407
+ __wbg_fromEntries_2f51c4024e2a7aa3: function() { return handleError(function (arg0) {
408
+ const ret = Object.fromEntries(arg0);
409
+ return ret;
410
+ }, arguments); },
411
+ __wbg_from_d7e888a2e9063b32: function(arg0) {
412
+ const ret = Array.from(arg0);
413
+ return ret;
414
+ },
415
+ __wbg_get_f09c3a16f8848381: function(arg0, arg1) {
416
+ const ret = arg0[arg1 >>> 0];
417
+ return ret;
418
+ },
419
+ __wbg_get_unchecked_3d0f4b91c8eca4f0: function(arg0, arg1) {
420
+ const ret = arg0[arg1 >>> 0];
421
+ return ret;
422
+ },
423
+ __wbg_info_28d530adaabdab8c: function(arg0, arg1, arg2, arg3) {
424
+ console.info(arg0, arg1, arg2, arg3);
425
+ },
426
+ __wbg_info_72e7e65fa3fc8b25: function(arg0) {
427
+ console.info(arg0);
428
+ },
429
+ __wbg_isArray_581b02d0060c9728: function(arg0) {
430
+ const ret = Array.isArray(arg0);
431
+ return ret;
432
+ },
433
+ __wbg_length_a31e05262e09b7f8: function(arg0) {
434
+ const ret = arg0.length;
435
+ return ret;
436
+ },
437
+ __wbg_new_1213b57bccbdbb66: function(arg0, arg1) {
438
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
439
+ return ret;
440
+ },
441
+ __wbg_new_227d7c05414eb861: function() {
442
+ const ret = new Error();
443
+ return ret;
444
+ },
445
+ __wbg_new_30bb59575bdc96f7: function() {
446
+ const ret = new Array();
447
+ return ret;
448
+ },
449
+ __wbg_new_6f45ce010e10900b: function() {
450
+ const ret = new Map();
451
+ return ret;
452
+ },
453
+ __wbg_new_92df58a8ec3bfb6b: function() {
454
+ const ret = new Map();
455
+ return ret;
456
+ },
457
+ __wbg_new_cbee8c0d5c479eac: function() {
458
+ const ret = new Array();
459
+ return ret;
460
+ },
461
+ __wbg_new_typed_8258a0d8488ef2a2: function(arg0, arg1) {
462
+ try {
463
+ var state0 = {a: arg0, b: arg1};
464
+ var cb0 = (arg0, arg1) => {
465
+ const a = state0.a;
466
+ state0.a = 0;
467
+ try {
468
+ return wasm_bindgen__convert__closures_____invoke__h75e989036704f034_21(a, state0.b, arg0, arg1);
469
+ } finally {
470
+ state0.a = a;
471
+ }
472
+ };
473
+ const ret = new Promise(cb0);
474
+ return ret;
475
+ } finally {
476
+ state0.a = state0.b = 0;
477
+ }
478
+ },
479
+ __wbg_parse_6dfe891b5bafb5cd: function() { return handleError(function (arg0, arg1) {
480
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
481
+ return ret;
482
+ }, arguments); },
483
+ __wbg_push_a6f9488ffd3fae3b: function(arg0, arg1) {
484
+ const ret = arg0.push(arg1);
485
+ return ret;
486
+ },
487
+ __wbg_queueMicrotask_2c8dfd1056f24fdc: function(arg0) {
488
+ const ret = arg0.queueMicrotask;
489
+ return ret;
490
+ },
491
+ __wbg_queueMicrotask_8985ad63815852e7: function(arg0) {
492
+ queueMicrotask(arg0);
493
+ },
494
+ __wbg_resolve_5d61e0d10c14730a: function(arg0) {
495
+ const ret = Promise.resolve(arg0);
496
+ return ret;
497
+ },
498
+ __wbg_reverse_fcf59127ee940f96: function(arg0) {
499
+ const ret = arg0.reverse();
500
+ return ret;
501
+ },
502
+ __wbg_set_bad5c505cc70b5f8: function() { return handleError(function (arg0, arg1, arg2) {
503
+ const ret = Reflect.set(arg0, arg1, arg2);
504
+ return ret;
505
+ }, arguments); },
506
+ __wbg_set_cause_7f44b7881bde2bb6: function(arg0, arg1) {
507
+ arg0.cause = arg1;
508
+ },
509
+ __wbg_set_cfc6de03f990decf: function(arg0, arg1, arg2) {
510
+ const ret = arg0.set(arg1, arg2);
511
+ return ret;
512
+ },
513
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
514
+ const ret = arg1.stack;
515
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
516
+ const len1 = WASM_VECTOR_LEN;
517
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
518
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
519
+ },
520
+ __wbg_static_accessor_GLOBAL_THIS_14325d8cca34bb77: function() {
521
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
522
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
523
+ },
524
+ __wbg_static_accessor_GLOBAL_f3a1e69f9c5a7e8e: function() {
525
+ const ret = typeof global === 'undefined' ? null : global;
526
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
527
+ },
528
+ __wbg_static_accessor_SELF_50cdb5b517789aca: function() {
529
+ const ret = typeof self === 'undefined' ? null : self;
530
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
531
+ },
532
+ __wbg_static_accessor_WINDOW_d6c4126e4c244380: function() {
533
+ const ret = typeof window === 'undefined' ? null : window;
534
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
535
+ },
536
+ __wbg_then_d4163530723f56f4: function(arg0, arg1, arg2) {
537
+ const ret = arg0.then(arg1, arg2);
538
+ return ret;
539
+ },
540
+ __wbg_then_f1c954fe00733701: function(arg0, arg1) {
541
+ const ret = arg0.then(arg1);
542
+ return ret;
543
+ },
544
+ __wbg_values_623449cff68c6e40: function(arg0) {
545
+ const ret = Object.values(arg0);
546
+ return ret;
547
+ },
548
+ __wbg_warn_2540fe736f19ad5c: function(arg0, arg1, arg2, arg3) {
549
+ console.warn(arg0, arg1, arg2, arg3);
550
+ },
551
+ __wbg_warn_3310c7343993c074: function(arg0) {
552
+ console.warn(arg0);
553
+ },
554
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
555
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 477, function: Function { arguments: [Externref], shim_idx: 478, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
556
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h2cbd9f7ce6b3c35b, wasm_bindgen__convert__closures_____invoke__h00439a7bc380f87a);
557
+ return ret;
558
+ },
559
+ __wbindgen_cast_0000000000000002: function(arg0) {
560
+ // Cast intrinsic for `F64 -> Externref`.
561
+ const ret = arg0;
562
+ return ret;
563
+ },
564
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
565
+ // Cast intrinsic for `Ref(String) -> Externref`.
566
+ const ret = getStringFromWasm0(arg0, arg1);
567
+ return ret;
568
+ },
569
+ __wbindgen_init_externref_table: function() {
570
+ const table = wasm.__wbindgen_externrefs;
571
+ const offset = table.grow(4);
572
+ table.set(0, undefined);
573
+ table.set(offset + 0, undefined);
574
+ table.set(offset + 1, null);
575
+ table.set(offset + 2, true);
576
+ table.set(offset + 3, false);
577
+ },
578
+ };
579
+ return {
580
+ __proto__: null,
581
+ "./acvm_js_bg.js": import0,
582
+ };
583
+ }
105
584
 
106
- for (; offset < len; offset++) {
107
- const code = arg.charCodeAt(offset);
108
- if (code > 0x7F) break;
109
- mem[ptr + offset] = code;
585
+ function wasm_bindgen__convert__closures_____invoke__h00439a7bc380f87a(arg0, arg1, arg2) {
586
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h00439a7bc380f87a(arg0, arg1, arg2);
587
+ if (ret[1]) {
588
+ throw takeFromExternrefTable0(ret[0]);
110
589
  }
590
+ }
111
591
 
112
- if (offset !== len) {
113
- if (offset !== 0) {
114
- arg = arg.slice(offset);
115
- }
116
- ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
117
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
118
- const ret = encodeString(arg, view);
592
+ function wasm_bindgen__convert__closures_____invoke__h75e989036704f034(arg0, arg1, arg2, arg3) {
593
+ wasm.wasm_bindgen__convert__closures_____invoke__h75e989036704f034(arg0, arg1, arg2, arg3);
594
+ }
119
595
 
120
- offset += ret.written;
121
- }
596
+ function wasm_bindgen__convert__closures_____invoke__h75e989036704f034_21(arg0, arg1, arg2, arg3) {
597
+ wasm.wasm_bindgen__convert__closures_____invoke__h75e989036704f034_21(arg0, arg1, arg2, arg3);
598
+ }
122
599
 
123
- WASM_VECTOR_LEN = offset;
124
- return ptr;
600
+ function wasm_bindgen__convert__closures_____invoke__h19cd9ea1cbe9b0b3(arg0, arg1, arg2, arg3, arg4) {
601
+ wasm.wasm_bindgen__convert__closures_____invoke__h19cd9ea1cbe9b0b3(arg0, arg1, arg2, arg3, arg4);
602
+ }
603
+
604
+ function addToExternrefTable0(obj) {
605
+ const idx = wasm.__externref_table_alloc();
606
+ wasm.__wbindgen_externrefs.set(idx, obj);
607
+ return idx;
125
608
  }
126
609
 
610
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
611
+ ? { register: () => {}, unregister: () => {} }
612
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
613
+
127
614
  function debugString(val) {
128
615
  // primitive types
129
616
  const type = typeof val;
@@ -165,7 +652,7 @@ function debugString(val) {
165
652
  // Test for built-in
166
653
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
167
654
  let className;
168
- if (builtInMatches.length > 1) {
655
+ if (builtInMatches && builtInMatches.length > 1) {
169
656
  className = builtInMatches[1];
170
657
  } else {
171
658
  // Failed to match the standard '[object ClassName]'
@@ -189,445 +676,181 @@ function debugString(val) {
189
676
  return className;
190
677
  }
191
678
 
192
- function makeMutClosure(arg0, arg1, dtor, f) {
193
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
194
- const real = (...args) => {
195
- // First up with a closure we increment the internal reference
196
- // count. This ensures that the Rust closure environment won't
197
- // be deallocated while we're invoking it.
198
- state.cnt++;
199
- const a = state.a;
200
- state.a = 0;
201
- try {
202
- return f(a, state.b, ...args);
203
- } finally {
204
- if (--state.cnt === 0) {
205
- wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
206
-
207
- } else {
208
- state.a = a;
209
- }
210
- }
211
- };
212
- real.original = state;
213
-
214
- return real;
215
- }
216
- function __wbg_adapter_22(arg0, arg1, arg2) {
217
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h624a3dfbf78ca22a(arg0, arg1, addHeapObject(arg2));
679
+ function getArrayU32FromWasm0(ptr, len) {
680
+ ptr = ptr >>> 0;
681
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
218
682
  }
219
683
 
220
684
  function getArrayU8FromWasm0(ptr, len) {
221
685
  ptr = ptr >>> 0;
222
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
686
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
223
687
  }
224
- /**
225
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
226
- *
227
- * @param {WitnessMap} witness_map - A witness map.
228
- * @returns {Uint8Array} A compressed witness map
229
- */
230
- export function compressWitness(witness_map) {
231
- try {
232
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
233
- wasm.compressWitness(retptr, addHeapObject(witness_map));
234
- var r0 = getInt32Memory0()[retptr / 4 + 0];
235
- var r1 = getInt32Memory0()[retptr / 4 + 1];
236
- var r2 = getInt32Memory0()[retptr / 4 + 2];
237
- var r3 = getInt32Memory0()[retptr / 4 + 3];
238
- if (r3) {
239
- throw takeObject(r2);
240
- }
241
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
242
- wasm.__wbindgen_free(r0, r1 * 1);
243
- return v1;
244
- } finally {
245
- wasm.__wbindgen_add_to_stack_pointer(16);
688
+
689
+ let cachedDataViewMemory0 = null;
690
+ function getDataViewMemory0() {
691
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
692
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
246
693
  }
694
+ return cachedDataViewMemory0;
247
695
  }
248
696
 
249
- function passArray8ToWasm0(arg, malloc) {
250
- const ptr = malloc(arg.length * 1) >>> 0;
251
- getUint8Memory0().set(arg, ptr / 1);
252
- WASM_VECTOR_LEN = arg.length;
253
- return ptr;
697
+ function getStringFromWasm0(ptr, len) {
698
+ ptr = ptr >>> 0;
699
+ return decodeText(ptr, len);
254
700
  }
255
- /**
256
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
257
- * This should be used to only fetch the witness map for the main function.
258
- *
259
- * @param {Uint8Array} compressed_witness - A compressed witness.
260
- * @returns {WitnessMap} The decompressed witness map.
261
- */
262
- export function decompressWitness(compressed_witness) {
263
- try {
264
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
265
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
266
- const len0 = WASM_VECTOR_LEN;
267
- wasm.decompressWitness(retptr, ptr0, len0);
268
- var r0 = getInt32Memory0()[retptr / 4 + 0];
269
- var r1 = getInt32Memory0()[retptr / 4 + 1];
270
- var r2 = getInt32Memory0()[retptr / 4 + 2];
271
- if (r2) {
272
- throw takeObject(r1);
273
- }
274
- return takeObject(r0);
275
- } finally {
276
- wasm.__wbindgen_add_to_stack_pointer(16);
701
+
702
+ let cachedUint32ArrayMemory0 = null;
703
+ function getUint32ArrayMemory0() {
704
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
705
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
277
706
  }
707
+ return cachedUint32ArrayMemory0;
278
708
  }
279
709
 
280
- /**
281
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
282
- *
283
- * @param {WitnessStack} witness_stack - A witness stack.
284
- * @returns {Uint8Array} A compressed witness stack
285
- */
286
- export function compressWitnessStack(witness_stack) {
287
- try {
288
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
289
- wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
290
- var r0 = getInt32Memory0()[retptr / 4 + 0];
291
- var r1 = getInt32Memory0()[retptr / 4 + 1];
292
- var r2 = getInt32Memory0()[retptr / 4 + 2];
293
- var r3 = getInt32Memory0()[retptr / 4 + 3];
294
- if (r3) {
295
- throw takeObject(r2);
296
- }
297
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
298
- wasm.__wbindgen_free(r0, r1 * 1);
299
- return v1;
300
- } finally {
301
- wasm.__wbindgen_add_to_stack_pointer(16);
710
+ let cachedUint8ArrayMemory0 = null;
711
+ function getUint8ArrayMemory0() {
712
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
713
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
302
714
  }
715
+ return cachedUint8ArrayMemory0;
303
716
  }
304
717
 
305
- /**
306
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
307
- *
308
- * @param {Uint8Array} compressed_witness - A compressed witness.
309
- * @returns {WitnessStack} The decompressed witness stack.
310
- */
311
- export function decompressWitnessStack(compressed_witness) {
718
+ function handleError(f, args) {
312
719
  try {
313
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
314
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
315
- const len0 = WASM_VECTOR_LEN;
316
- wasm.decompressWitnessStack(retptr, ptr0, len0);
317
- var r0 = getInt32Memory0()[retptr / 4 + 0];
318
- var r1 = getInt32Memory0()[retptr / 4 + 1];
319
- var r2 = getInt32Memory0()[retptr / 4 + 2];
320
- if (r2) {
321
- throw takeObject(r1);
322
- }
323
- return takeObject(r0);
324
- } finally {
325
- wasm.__wbindgen_add_to_stack_pointer(16);
720
+ return f.apply(this, args);
721
+ } catch (e) {
722
+ const idx = addToExternrefTable0(e);
723
+ wasm.__wbindgen_exn_store(idx);
326
724
  }
327
725
  }
328
726
 
329
- /**
330
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
331
- *
332
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
333
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
334
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
335
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
336
- */
337
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
338
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
339
- const len0 = WASM_VECTOR_LEN;
340
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
341
- return takeObject(ret);
342
- }
343
-
344
- /**
345
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
346
- * This method also extracts the public return values from the solved witness into its own return witness.
347
- *
348
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
349
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
350
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
351
- * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
352
- */
353
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
354
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
355
- const len0 = WASM_VECTOR_LEN;
356
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
357
- return takeObject(ret);
358
- }
359
-
360
- /**
361
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
362
- *
363
- * @param {Uint8Array} program - A serialized representation of an ACIR program
364
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
365
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
366
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
367
- */
368
- export function executeProgram(program, initial_witness, foreign_call_handler) {
369
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
370
- const len0 = WASM_VECTOR_LEN;
371
- const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
372
- return takeObject(ret);
373
- }
374
-
375
- /**
376
- * Performs a bitwise AND operation between `lhs` and `rhs`
377
- * @param {string} lhs
378
- * @param {string} rhs
379
- * @returns {string}
380
- */
381
- export function and(lhs, rhs) {
382
- const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
383
- return takeObject(ret);
384
- }
385
-
386
- /**
387
- * Performs a bitwise XOR operation between `lhs` and `rhs`
388
- * @param {string} lhs
389
- * @param {string} rhs
390
- * @returns {string}
391
- */
392
- export function xor(lhs, rhs) {
393
- const ret = wasm.xor(addHeapObject(lhs), addHeapObject(rhs));
394
- return takeObject(ret);
727
+ function isLikeNone(x) {
728
+ return x === undefined || x === null;
395
729
  }
396
730
 
397
- let cachedUint32Memory0 = null;
731
+ function makeMutClosure(arg0, arg1, dtor, f) {
732
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
733
+ const real = (...args) => {
398
734
 
399
- function getUint32Memory0() {
400
- if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
401
- cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
402
- }
403
- return cachedUint32Memory0;
735
+ // First up with a closure we increment the internal reference
736
+ // count. This ensures that the Rust closure environment won't
737
+ // be deallocated while we're invoking it.
738
+ state.cnt++;
739
+ const a = state.a;
740
+ state.a = 0;
741
+ try {
742
+ return f(a, state.b, ...args);
743
+ } finally {
744
+ state.a = a;
745
+ real._wbg_cb_unref();
746
+ }
747
+ };
748
+ real._wbg_cb_unref = () => {
749
+ if (--state.cnt === 0) {
750
+ state.dtor(state.a, state.b);
751
+ state.a = 0;
752
+ CLOSURE_DTORS.unregister(state);
753
+ }
754
+ };
755
+ CLOSURE_DTORS.register(real, state, state);
756
+ return real;
404
757
  }
405
758
 
406
759
  function passArray32ToWasm0(arg, malloc) {
407
- const ptr = malloc(arg.length * 4) >>> 0;
408
- getUint32Memory0().set(arg, ptr / 4);
760
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
761
+ getUint32ArrayMemory0().set(arg, ptr / 4);
409
762
  WASM_VECTOR_LEN = arg.length;
410
763
  return ptr;
411
764
  }
412
765
 
413
- function getArrayU32FromWasm0(ptr, len) {
414
- ptr = ptr >>> 0;
415
- return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
416
- }
417
- /**
418
- * Sha256 compression function
419
- * @param {Uint32Array} inputs
420
- * @param {Uint32Array} state
421
- * @returns {Uint32Array}
422
- */
423
- export function sha256_compression(inputs, state) {
424
- try {
425
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
426
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
427
- const len0 = WASM_VECTOR_LEN;
428
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
429
- const len1 = WASM_VECTOR_LEN;
430
- wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
431
- var r0 = getInt32Memory0()[retptr / 4 + 0];
432
- var r1 = getInt32Memory0()[retptr / 4 + 1];
433
- var v3 = getArrayU32FromWasm0(r0, r1).slice();
434
- wasm.__wbindgen_free(r0, r1 * 4);
435
- return v3;
436
- } finally {
437
- wasm.__wbindgen_add_to_stack_pointer(16);
438
- }
766
+ function passArray8ToWasm0(arg, malloc) {
767
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
768
+ getUint8ArrayMemory0().set(arg, ptr / 1);
769
+ WASM_VECTOR_LEN = arg.length;
770
+ return ptr;
439
771
  }
440
772
 
441
- /**
442
- * Calculates the Blake2s256 hash of the input bytes
443
- * @param {Uint8Array} inputs
444
- * @returns {Uint8Array}
445
- */
446
- export function blake2s256(inputs) {
447
- try {
448
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
449
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
450
- const len0 = WASM_VECTOR_LEN;
451
- wasm.blake2s256(retptr, ptr0, len0);
452
- var r0 = getInt32Memory0()[retptr / 4 + 0];
453
- var r1 = getInt32Memory0()[retptr / 4 + 1];
454
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
455
- wasm.__wbindgen_free(r0, r1 * 1);
456
- return v2;
457
- } finally {
458
- wasm.__wbindgen_add_to_stack_pointer(16);
773
+ function passStringToWasm0(arg, malloc, realloc) {
774
+ if (realloc === undefined) {
775
+ const buf = cachedTextEncoder.encode(arg);
776
+ const ptr = malloc(buf.length, 1) >>> 0;
777
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
778
+ WASM_VECTOR_LEN = buf.length;
779
+ return ptr;
459
780
  }
460
- }
461
781
 
462
- /**
463
- * Verifies a ECDSA signature over the secp256k1 curve.
464
- * @param {Uint8Array} hashed_msg
465
- * @param {Uint8Array} public_key_x_bytes
466
- * @param {Uint8Array} public_key_y_bytes
467
- * @param {Uint8Array} signature
468
- * @returns {boolean}
469
- */
470
- export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
471
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
472
- const len0 = WASM_VECTOR_LEN;
473
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
474
- const len1 = WASM_VECTOR_LEN;
475
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
476
- const len2 = WASM_VECTOR_LEN;
477
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
478
- const len3 = WASM_VECTOR_LEN;
479
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
480
- return ret !== 0;
481
- }
782
+ let len = arg.length;
783
+ let ptr = malloc(len, 1) >>> 0;
482
784
 
483
- /**
484
- * Verifies a ECDSA signature over the secp256r1 curve.
485
- * @param {Uint8Array} hashed_msg
486
- * @param {Uint8Array} public_key_x_bytes
487
- * @param {Uint8Array} public_key_y_bytes
488
- * @param {Uint8Array} signature
489
- * @returns {boolean}
490
- */
491
- export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
492
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
493
- const len0 = WASM_VECTOR_LEN;
494
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
495
- const len1 = WASM_VECTOR_LEN;
496
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
497
- const len2 = WASM_VECTOR_LEN;
498
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
499
- const len3 = WASM_VECTOR_LEN;
500
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
501
- return ret !== 0;
502
- }
785
+ const mem = getUint8ArrayMemory0();
503
786
 
504
- /**
505
- * Returns the `BuildInfo` object containing information about how the installed package was built.
506
- * @returns {BuildInfo} - Information on how the installed package was built.
507
- */
508
- export function buildInfo() {
509
- const ret = wasm.buildInfo();
510
- return takeObject(ret);
511
- }
787
+ let offset = 0;
512
788
 
513
- /**
514
- * Sets the package's logging level.
515
- *
516
- * @param {LogLevel} level - The maximum level of logging to be emitted.
517
- */
518
- export function initLogLevel(filter) {
519
- try {
520
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
521
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
522
- const len0 = WASM_VECTOR_LEN;
523
- wasm.initLogLevel(retptr, ptr0, len0);
524
- var r0 = getInt32Memory0()[retptr / 4 + 0];
525
- var r1 = getInt32Memory0()[retptr / 4 + 1];
526
- if (r1) {
527
- throw takeObject(r0);
528
- }
529
- } finally {
530
- wasm.__wbindgen_add_to_stack_pointer(16);
789
+ for (; offset < len; offset++) {
790
+ const code = arg.charCodeAt(offset);
791
+ if (code > 0x7F) break;
792
+ mem[ptr + offset] = code;
531
793
  }
532
- }
533
-
534
- /**
535
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
536
- *
537
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
538
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
539
- * @returns {WitnessMap} A witness map containing the circuit's return values.
540
- * @param {Uint8Array} program
541
- * @param {WitnessMap} witness_map
542
- * @returns {WitnessMap}
543
- */
544
- export function getReturnWitness(program, witness_map) {
545
- try {
546
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
547
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
548
- const len0 = WASM_VECTOR_LEN;
549
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
550
- var r0 = getInt32Memory0()[retptr / 4 + 0];
551
- var r1 = getInt32Memory0()[retptr / 4 + 1];
552
- var r2 = getInt32Memory0()[retptr / 4 + 2];
553
- if (r2) {
554
- throw takeObject(r1);
794
+ if (offset !== len) {
795
+ if (offset !== 0) {
796
+ arg = arg.slice(offset);
555
797
  }
556
- return takeObject(r0);
557
- } finally {
558
- wasm.__wbindgen_add_to_stack_pointer(16);
798
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
799
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
800
+ const ret = cachedTextEncoder.encodeInto(arg, view);
801
+
802
+ offset += ret.written;
803
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
559
804
  }
805
+
806
+ WASM_VECTOR_LEN = offset;
807
+ return ptr;
560
808
  }
561
809
 
562
- /**
563
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
564
- *
565
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
566
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
567
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
568
- * @param {Uint8Array} program
569
- * @param {WitnessMap} solved_witness
570
- * @returns {WitnessMap}
571
- */
572
- export function getPublicParametersWitness(program, solved_witness) {
573
- try {
574
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
575
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
576
- const len0 = WASM_VECTOR_LEN;
577
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
578
- var r0 = getInt32Memory0()[retptr / 4 + 0];
579
- var r1 = getInt32Memory0()[retptr / 4 + 1];
580
- var r2 = getInt32Memory0()[retptr / 4 + 2];
581
- if (r2) {
582
- throw takeObject(r1);
583
- }
584
- return takeObject(r0);
585
- } finally {
586
- wasm.__wbindgen_add_to_stack_pointer(16);
587
- }
810
+ function takeFromExternrefTable0(idx) {
811
+ const value = wasm.__wbindgen_externrefs.get(idx);
812
+ wasm.__externref_table_dealloc(idx);
813
+ return value;
588
814
  }
589
815
 
590
- /**
591
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
592
- *
593
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
594
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
595
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
596
- * @param {Uint8Array} program
597
- * @param {WitnessMap} solved_witness
598
- * @returns {WitnessMap}
599
- */
600
- export function getPublicWitness(program, solved_witness) {
601
- try {
602
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
603
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
604
- const len0 = WASM_VECTOR_LEN;
605
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
606
- var r0 = getInt32Memory0()[retptr / 4 + 0];
607
- var r1 = getInt32Memory0()[retptr / 4 + 1];
608
- var r2 = getInt32Memory0()[retptr / 4 + 2];
609
- if (r2) {
610
- throw takeObject(r1);
611
- }
612
- return takeObject(r0);
613
- } finally {
614
- wasm.__wbindgen_add_to_stack_pointer(16);
816
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
817
+ cachedTextDecoder.decode();
818
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
819
+ let numBytesDecoded = 0;
820
+ function decodeText(ptr, len) {
821
+ numBytesDecoded += len;
822
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
823
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
824
+ cachedTextDecoder.decode();
825
+ numBytesDecoded = len;
615
826
  }
827
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
616
828
  }
617
829
 
618
- function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
619
- wasm.wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
620
- }
830
+ const cachedTextEncoder = new TextEncoder();
621
831
 
622
- function handleError(f, args) {
623
- try {
624
- return f.apply(this, args);
625
- } catch (e) {
626
- wasm.__wbindgen_exn_store(addHeapObject(e));
627
- }
832
+ if (!('encodeInto' in cachedTextEncoder)) {
833
+ cachedTextEncoder.encodeInto = function (arg, view) {
834
+ const buf = cachedTextEncoder.encode(arg);
835
+ view.set(buf);
836
+ return {
837
+ read: arg.length,
838
+ written: buf.length
839
+ };
840
+ };
628
841
  }
629
- function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
630
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h3f07259b3eb55784(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
842
+
843
+ let WASM_VECTOR_LEN = 0;
844
+
845
+ let wasmModule, wasm;
846
+ function __wbg_finalize_init(instance, module) {
847
+ wasm = instance.exports;
848
+ wasmModule = module;
849
+ cachedDataViewMemory0 = null;
850
+ cachedUint32ArrayMemory0 = null;
851
+ cachedUint8ArrayMemory0 = null;
852
+ wasm.__wbindgen_start();
853
+ return wasm;
631
854
  }
632
855
 
633
856
  async function __wbg_load(module, imports) {
@@ -635,330 +858,80 @@ async function __wbg_load(module, imports) {
635
858
  if (typeof WebAssembly.instantiateStreaming === 'function') {
636
859
  try {
637
860
  return await WebAssembly.instantiateStreaming(module, imports);
638
-
639
861
  } catch (e) {
640
- if (module.headers.get('Content-Type') != 'application/wasm') {
641
- 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);
862
+ const validResponse = module.ok && expectedResponseType(module.type);
642
863
 
643
- } else {
644
- throw e;
645
- }
864
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
865
+ 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);
866
+
867
+ } else { throw e; }
646
868
  }
647
869
  }
648
870
 
649
871
  const bytes = await module.arrayBuffer();
650
872
  return await WebAssembly.instantiate(bytes, imports);
651
-
652
873
  } else {
653
874
  const instance = await WebAssembly.instantiate(module, imports);
654
875
 
655
876
  if (instance instanceof WebAssembly.Instance) {
656
877
  return { instance, module };
657
-
658
878
  } else {
659
879
  return instance;
660
880
  }
661
881
  }
662
- }
663
882
 
664
- function __wbg_get_imports() {
665
- const imports = {};
666
- imports.wbg = {};
667
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
668
- takeObject(arg0);
669
- };
670
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
671
- const obj = takeObject(arg0).original;
672
- if (obj.cnt-- == 1) {
673
- obj.a = 0;
674
- return true;
675
- }
676
- const ret = false;
677
- return ret;
678
- };
679
- imports.wbg.__wbindgen_is_array = function(arg0) {
680
- const ret = Array.isArray(getObject(arg0));
681
- return ret;
682
- };
683
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
684
- const obj = getObject(arg1);
685
- const ret = typeof(obj) === 'number' ? obj : undefined;
686
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
687
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
688
- };
689
- imports.wbg.__wbg_new_f4a2f4980eb0a66e = function() {
690
- const ret = new Array();
691
- return addHeapObject(ret);
692
- };
693
- imports.wbg.__wbindgen_number_new = function(arg0) {
694
- const ret = arg0;
695
- return addHeapObject(ret);
696
- };
697
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
698
- const ret = getStringFromWasm0(arg0, arg1);
699
- return addHeapObject(ret);
700
- };
701
- imports.wbg.__wbg_constructor_bb18ee055059e54b = function(arg0) {
702
- const ret = new Error(takeObject(arg0));
703
- return addHeapObject(ret);
704
- };
705
- imports.wbg.__wbindgen_is_string = function(arg0) {
706
- const ret = typeof(getObject(arg0)) === 'string';
707
- return ret;
708
- };
709
- imports.wbg.__wbg_new_e0a89522928fc0a3 = function() {
710
- const ret = new Map();
711
- return addHeapObject(ret);
712
- };
713
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
714
- const obj = getObject(arg1);
715
- const ret = typeof(obj) === 'string' ? obj : undefined;
716
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
717
- var len1 = WASM_VECTOR_LEN;
718
- getInt32Memory0()[arg0 / 4 + 1] = len1;
719
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
720
- };
721
- imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
722
- const ret = new Error();
723
- return addHeapObject(ret);
724
- };
725
- imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
726
- const ret = getObject(arg1).stack;
727
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
728
- const len1 = WASM_VECTOR_LEN;
729
- getInt32Memory0()[arg0 / 4 + 1] = len1;
730
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
731
- };
732
- imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
733
- let deferred0_0;
734
- let deferred0_1;
735
- try {
736
- deferred0_0 = arg0;
737
- deferred0_1 = arg1;
738
- console.error(getStringFromWasm0(arg0, arg1));
739
- } finally {
740
- wasm.__wbindgen_free(deferred0_0, deferred0_1);
741
- }
742
- };
743
- imports.wbg.__wbg_debug_e3f6a1578e6d45ca = function(arg0) {
744
- console.debug(getObject(arg0));
745
- };
746
- imports.wbg.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
747
- console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
748
- };
749
- imports.wbg.__wbg_error_a7e23606158b68b9 = function(arg0) {
750
- console.error(getObject(arg0));
751
- };
752
- imports.wbg.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
753
- console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
754
- };
755
- imports.wbg.__wbg_info_05db236d79f1b785 = function(arg0) {
756
- console.info(getObject(arg0));
757
- };
758
- imports.wbg.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
759
- console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
760
- };
761
- imports.wbg.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) {
762
- console.warn(getObject(arg0));
763
- };
764
- imports.wbg.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
765
- console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
766
- };
767
- imports.wbg.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
768
- const ret = getObject(arg0)[arg1 >>> 0];
769
- return addHeapObject(ret);
770
- };
771
- imports.wbg.__wbg_length_820c786973abdd8a = function(arg0) {
772
- const ret = getObject(arg0).length;
773
- return ret;
774
- };
775
- imports.wbg.__wbg_new_0394642eae39db16 = function() {
776
- const ret = new Array();
777
- return addHeapObject(ret);
778
- };
779
- imports.wbg.__wbg_new_0f2b71ca2f2a6029 = function() {
780
- const ret = new Map();
781
- return addHeapObject(ret);
782
- };
783
- imports.wbg.__wbg_from_6bc98a09a0b58bb1 = function(arg0) {
784
- const ret = Array.from(getObject(arg0));
785
- return addHeapObject(ret);
786
- };
787
- imports.wbg.__wbg_forEach_5ae261259d7517c8 = function(arg0, arg1, arg2) {
788
- try {
789
- var state0 = {a: arg1, b: arg2};
790
- var cb0 = (arg0, arg1, arg2) => {
791
- const a = state0.a;
792
- state0.a = 0;
793
- try {
794
- return __wbg_adapter_75(a, state0.b, arg0, arg1, arg2);
795
- } finally {
796
- state0.a = a;
797
- }
798
- };
799
- getObject(arg0).forEach(cb0);
800
- } finally {
801
- state0.a = state0.b = 0;
802
- }
803
- };
804
- imports.wbg.__wbg_push_109cfc26d02582dd = function(arg0, arg1) {
805
- const ret = getObject(arg0).push(getObject(arg1));
806
- return ret;
807
- };
808
- imports.wbg.__wbg_reverse_a322332d916e2705 = function(arg0) {
809
- const ret = getObject(arg0).reverse();
810
- return addHeapObject(ret);
811
- };
812
- imports.wbg.__wbg_new_87297f22973157c8 = function(arg0, arg1) {
813
- const ret = new Error(getStringFromWasm0(arg0, arg1));
814
- return addHeapObject(ret);
815
- };
816
- imports.wbg.__wbg_setcause_394738aae0ce9341 = function(arg0, arg1) {
817
- getObject(arg0).cause = getObject(arg1);
818
- };
819
- imports.wbg.__wbg_call_587b30eea3e09332 = function() { return handleError(function (arg0, arg1, arg2) {
820
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
821
- return addHeapObject(ret);
822
- }, arguments) };
823
- imports.wbg.__wbg_call_4c73e4aecced6a7d = function() { return handleError(function (arg0, arg1, arg2, arg3) {
824
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
825
- return addHeapObject(ret);
826
- }, arguments) };
827
- imports.wbg.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
828
- try {
829
- var state0 = {a: arg1, b: arg2};
830
- var cb0 = (arg0, arg1) => {
831
- const a = state0.a;
832
- state0.a = 0;
833
- try {
834
- return __wbg_adapter_92(a, state0.b, arg0, arg1);
835
- } finally {
836
- state0.a = a;
837
- }
838
- };
839
- getObject(arg0).forEach(cb0);
840
- } finally {
841
- state0.a = state0.b = 0;
842
- }
843
- };
844
- imports.wbg.__wbg_set_da7be7bf0e037b14 = function(arg0, arg1, arg2) {
845
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
846
- return addHeapObject(ret);
847
- };
848
- imports.wbg.__wbg_fromEntries_d1b310956d20d858 = function() { return handleError(function (arg0) {
849
- const ret = Object.fromEntries(getObject(arg0));
850
- return addHeapObject(ret);
851
- }, arguments) };
852
- imports.wbg.__wbg_values_099fd000c271c313 = function(arg0) {
853
- const ret = Object.values(getObject(arg0));
854
- return addHeapObject(ret);
855
- };
856
- imports.wbg.__wbg_new_2b55e405e4af4986 = function(arg0, arg1) {
857
- try {
858
- var state0 = {a: arg0, b: arg1};
859
- var cb0 = (arg0, arg1) => {
860
- const a = state0.a;
861
- state0.a = 0;
862
- try {
863
- return __wbg_adapter_92(a, state0.b, arg0, arg1);
864
- } finally {
865
- state0.a = a;
866
- }
867
- };
868
- const ret = new Promise(cb0);
869
- return addHeapObject(ret);
870
- } finally {
871
- state0.a = state0.b = 0;
883
+ function expectedResponseType(type) {
884
+ switch (type) {
885
+ case 'basic': case 'cors': case 'default': return true;
872
886
  }
873
- };
874
- imports.wbg.__wbg_resolve_ae38ad63c43ff98b = function(arg0) {
875
- const ret = Promise.resolve(getObject(arg0));
876
- return addHeapObject(ret);
877
- };
878
- imports.wbg.__wbg_then_8df675b8bb5d5e3c = function(arg0, arg1) {
879
- const ret = getObject(arg0).then(getObject(arg1));
880
- return addHeapObject(ret);
881
- };
882
- imports.wbg.__wbg_then_835b073a479138e5 = function(arg0, arg1, arg2) {
883
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
884
- return addHeapObject(ret);
885
- };
886
- imports.wbg.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
887
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
888
- return addHeapObject(ret);
889
- }, arguments) };
890
- imports.wbg.__wbg_set_07da13cc24b69217 = function() { return handleError(function (arg0, arg1, arg2) {
891
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
892
- return ret;
893
- }, arguments) };
894
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
895
- const ret = debugString(getObject(arg1));
896
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
897
- const len1 = WASM_VECTOR_LEN;
898
- getInt32Memory0()[arg0 / 4 + 1] = len1;
899
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
900
- };
901
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
902
- throw new Error(getStringFromWasm0(arg0, arg1));
903
- };
904
- imports.wbg.__wbindgen_closure_wrapper726 = function(arg0, arg1, arg2) {
905
- const ret = makeMutClosure(arg0, arg1, 265, __wbg_adapter_22);
906
- return addHeapObject(ret);
907
- };
908
-
909
- return imports;
910
- }
911
-
912
- function __wbg_init_memory(imports, maybe_memory) {
913
-
914
- }
915
-
916
- function __wbg_finalize_init(instance, module) {
917
- wasm = instance.exports;
918
- __wbg_init.__wbindgen_wasm_module = module;
919
- cachedFloat64Memory0 = null;
920
- cachedInt32Memory0 = null;
921
- cachedUint32Memory0 = null;
922
- cachedUint8Memory0 = null;
923
-
924
-
925
- return wasm;
887
+ return false;
888
+ }
926
889
  }
927
890
 
928
891
  function initSync(module) {
929
892
  if (wasm !== undefined) return wasm;
930
893
 
931
- const imports = __wbg_get_imports();
932
894
 
933
- __wbg_init_memory(imports);
895
+ if (module !== undefined) {
896
+ if (Object.getPrototypeOf(module) === Object.prototype) {
897
+ ({module} = module)
898
+ } else {
899
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
900
+ }
901
+ }
934
902
 
903
+ const imports = __wbg_get_imports();
935
904
  if (!(module instanceof WebAssembly.Module)) {
936
905
  module = new WebAssembly.Module(module);
937
906
  }
938
-
939
907
  const instance = new WebAssembly.Instance(module, imports);
940
-
941
908
  return __wbg_finalize_init(instance, module);
942
909
  }
943
910
 
944
- async function __wbg_init(input) {
911
+ async function __wbg_init(module_or_path) {
945
912
  if (wasm !== undefined) return wasm;
946
913
 
947
- if (typeof input === 'undefined') {
948
- input = new URL('acvm_js_bg.wasm', import.meta.url);
914
+
915
+ if (module_or_path !== undefined) {
916
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
917
+ ({module_or_path} = module_or_path)
918
+ } else {
919
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
920
+ }
949
921
  }
950
- const imports = __wbg_get_imports();
951
922
 
952
- if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
953
- input = fetch(input);
923
+ if (module_or_path === undefined) {
924
+ module_or_path = new URL('acvm_js_bg.wasm', import.meta.url);
954
925
  }
926
+ const imports = __wbg_get_imports();
955
927
 
956
- __wbg_init_memory(imports);
928
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
929
+ module_or_path = fetch(module_or_path);
930
+ }
957
931
 
958
- const { instance, module } = await __wbg_load(await input, imports);
932
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
959
933
 
960
934
  return __wbg_finalize_init(instance, module);
961
935
  }
962
936
 
963
- export { initSync }
964
- export default __wbg_init;
937
+ export { initSync, __wbg_init as default };