woxi-wasm 0.3.0 → 0.4.0

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/pkg/woxi.js CHANGED
@@ -1,272 +1,86 @@
1
+ /* @ts-self-types="./woxi.d.ts" */
1
2
 
2
- let imports = {};
3
- imports['__wbindgen_placeholder__'] = module.exports;
4
-
5
- function debugString(val) {
6
- // primitive types
7
- const type = typeof val;
8
- if (type == 'number' || type == 'boolean' || val == null) {
9
- return `${val}`;
10
- }
11
- if (type == 'string') {
12
- return `"${val}"`;
13
- }
14
- if (type == 'symbol') {
15
- const description = val.description;
16
- if (description == null) {
17
- return 'Symbol';
18
- } else {
19
- return `Symbol(${description})`;
20
- }
21
- }
22
- if (type == 'function') {
23
- const name = val.name;
24
- if (typeof name == 'string' && name.length > 0) {
25
- return `Function(${name})`;
26
- } else {
27
- return 'Function';
28
- }
29
- }
30
- // objects
31
- if (Array.isArray(val)) {
32
- const length = val.length;
33
- let debug = '[';
34
- if (length > 0) {
35
- debug += debugString(val[0]);
36
- }
37
- for(let i = 1; i < length; i++) {
38
- debug += ', ' + debugString(val[i]);
39
- }
40
- debug += ']';
41
- return debug;
42
- }
43
- // Test for built-in
44
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
45
- let className;
46
- if (builtInMatches && builtInMatches.length > 1) {
47
- className = builtInMatches[1];
48
- } else {
49
- // Failed to match the standard '[object ClassName]'
50
- return toString.call(val);
51
- }
52
- if (className == 'Object') {
53
- // we're a user defined class or Object
54
- // JSON.stringify avoids problems with cycles, and is generally much
55
- // easier than looping through ownProperties of `val`.
56
- try {
57
- return 'Object(' + JSON.stringify(val) + ')';
58
- } catch (_) {
59
- return 'Object';
60
- }
61
- }
62
- // errors
63
- if (val instanceof Error) {
64
- return `${val.name}: ${val.message}\n${val.stack}`;
65
- }
66
- // TODO we could test for more things here, like `Set`s and `Map`s.
67
- return className;
68
- }
69
-
70
- let WASM_VECTOR_LEN = 0;
71
-
72
- let cachedUint8ArrayMemory0 = null;
73
-
74
- function getUint8ArrayMemory0() {
75
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
76
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
77
- }
78
- return cachedUint8ArrayMemory0;
79
- }
80
-
81
- const cachedTextEncoder = new TextEncoder();
82
-
83
- if (!('encodeInto' in cachedTextEncoder)) {
84
- cachedTextEncoder.encodeInto = function (arg, view) {
85
- const buf = cachedTextEncoder.encode(arg);
86
- view.set(buf);
87
- return {
88
- read: arg.length,
89
- written: buf.length
90
- };
91
- }
92
- }
93
-
94
- function passStringToWasm0(arg, malloc, realloc) {
95
-
96
- if (realloc === undefined) {
97
- const buf = cachedTextEncoder.encode(arg);
98
- const ptr = malloc(buf.length, 1) >>> 0;
99
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
100
- WASM_VECTOR_LEN = buf.length;
101
- return ptr;
102
- }
103
-
104
- let len = arg.length;
105
- let ptr = malloc(len, 1) >>> 0;
106
-
107
- const mem = getUint8ArrayMemory0();
108
-
109
- let offset = 0;
110
-
111
- for (; offset < len; offset++) {
112
- const code = arg.charCodeAt(offset);
113
- if (code > 0x7F) break;
114
- mem[ptr + offset] = code;
115
- }
116
-
117
- if (offset !== len) {
118
- if (offset !== 0) {
119
- arg = arg.slice(offset);
120
- }
121
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
122
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
123
- const ret = cachedTextEncoder.encodeInto(arg, view);
124
-
125
- offset += ret.written;
126
- ptr = realloc(ptr, len, offset, 1) >>> 0;
127
- }
128
-
129
- WASM_VECTOR_LEN = offset;
130
- return ptr;
131
- }
132
-
133
- let cachedDataViewMemory0 = null;
134
-
135
- function getDataViewMemory0() {
136
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
137
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
138
- }
139
- return cachedDataViewMemory0;
140
- }
141
-
142
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
143
-
144
- cachedTextDecoder.decode();
145
-
146
- function decodeText(ptr, len) {
147
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
148
- }
149
-
150
- function getStringFromWasm0(ptr, len) {
151
- ptr = ptr >>> 0;
152
- return decodeText(ptr, len);
153
- }
154
-
155
- function addToExternrefTable0(obj) {
156
- const idx = wasm.__externref_table_alloc();
157
- wasm.__wbindgen_externrefs.set(idx, obj);
158
- return idx;
159
- }
160
-
161
- function handleError(f, args) {
162
- try {
163
- return f.apply(this, args);
164
- } catch (e) {
165
- const idx = addToExternrefTable0(e);
166
- wasm.__wbindgen_exn_store(idx);
167
- }
168
- }
169
-
170
- function isLikeNone(x) {
171
- return x === undefined || x === null;
172
- }
173
-
174
- function getArrayU8FromWasm0(ptr, len) {
175
- ptr = ptr >>> 0;
176
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
177
- }
178
-
179
- function passArray8ToWasm0(arg, malloc) {
180
- const ptr = malloc(arg.length * 1, 1) >>> 0;
181
- getUint8ArrayMemory0().set(arg, ptr / 1);
182
- WASM_VECTOR_LEN = arg.length;
183
- return ptr;
184
- }
185
3
  /**
186
- * Register (or replace) an in-memory file so `Import["name"]` can read it
187
- * in the browser.
188
- * @param {string} name
189
- * @param {Uint8Array} data
4
+ * Clear all interpreter state (variables and function definitions).
190
5
  */
191
- exports.set_virtual_file = function(name, data) {
192
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
193
- const len0 = WASM_VECTOR_LEN;
194
- const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
195
- const len1 = WASM_VECTOR_LEN;
196
- wasm.set_virtual_file(ptr0, len0, ptr1, len1);
197
- };
6
+ function clear() {
7
+ wasm.clear();
8
+ }
9
+ exports.clear = clear;
198
10
 
199
11
  /**
200
12
  * Remove all host-registered in-memory files.
201
13
  */
202
- exports.clear_virtual_files = function() {
14
+ function clear_virtual_files() {
203
15
  wasm.clear_virtual_files();
204
- };
16
+ }
17
+ exports.clear_virtual_files = clear_virtual_files;
205
18
 
206
19
  /**
207
- * Return every file produced by `Export` since the last call as a JSON array
208
- * of `{"name":…, "data":<base64>[, "rasterize":"png"]}`, then clear the store.
209
- * The host decodes each base64 payload into a Blob and renders a download
210
- * link; entries carrying `rasterize` hold SVG the host converts to that raster
211
- * format first. Draining on read keeps each evaluation's exports separate.
20
+ * Evaluate a Wolfram Language expression and return the result.
21
+ * If the expression produces Print output, it is prepended to the result.
22
+ * @param {string} input
212
23
  * @returns {string}
213
24
  */
214
- exports.take_exported_files = function() {
215
- let deferred1_0;
216
- let deferred1_1;
25
+ function evaluate(input) {
26
+ let deferred2_0;
27
+ let deferred2_1;
217
28
  try {
218
- const ret = wasm.take_exported_files();
219
- deferred1_0 = ret[0];
220
- deferred1_1 = ret[1];
29
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30
+ const len0 = WASM_VECTOR_LEN;
31
+ const ret = wasm.evaluate(ptr0, len0);
32
+ deferred2_0 = ret[0];
33
+ deferred2_1 = ret[1];
221
34
  return getStringFromWasm0(ret[0], ret[1]);
222
35
  } finally {
223
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
36
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
224
37
  }
225
- };
38
+ }
39
+ exports.evaluate = evaluate;
226
40
 
227
41
  /**
228
- * Split `input` into top-level statements and return a JSON array of strings.
229
- * Lets the front-end loop one statement at a time so output (and side
230
- * effects like `Pause[n]`) appear progressively rather than batched.
42
+ * Evaluate all top-level statements and return a JSON array of output items.
43
+ * Each item has a "type" field ("text", "graphics", "print", "warning", "error",
44
+ * "manipulate") and corresponding content fields.
231
45
  * @param {string} input
232
46
  * @returns {string}
233
47
  */
234
- exports.split_statements = function(input) {
48
+ function evaluate_all(input) {
235
49
  let deferred2_0;
236
50
  let deferred2_1;
237
51
  try {
238
52
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
239
53
  const len0 = WASM_VECTOR_LEN;
240
- const ret = wasm.split_statements(ptr0, len0);
54
+ const ret = wasm.evaluate_all(ptr0, len0);
241
55
  deferred2_0 = ret[0];
242
56
  deferred2_1 = ret[1];
243
57
  return getStringFromWasm0(ret[0], ret[1]);
244
58
  } finally {
245
59
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
246
60
  }
247
- };
61
+ }
62
+ exports.evaluate_all = evaluate_all;
248
63
 
249
64
  /**
250
- * Evaluate a single statement and return a JSON array of output items
251
- * (same shape as `evaluate_all`'s elements). Use together with
252
- * `split_statements` for progressive output.
253
- * @param {string} stmt
65
+ * Evaluate, returning only the final expression result (no Print output).
66
+ * @param {string} input
254
67
  * @returns {string}
255
68
  */
256
- exports.evaluate_statement = function(stmt) {
69
+ function evaluate_expr(input) {
257
70
  let deferred2_0;
258
71
  let deferred2_1;
259
72
  try {
260
- const ptr0 = passStringToWasm0(stmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
73
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
261
74
  const len0 = WASM_VECTOR_LEN;
262
- const ret = wasm.evaluate_statement(ptr0, len0);
75
+ const ret = wasm.evaluate_expr(ptr0, len0);
263
76
  deferred2_0 = ret[0];
264
77
  deferred2_1 = ret[1];
265
78
  return getStringFromWasm0(ret[0], ret[1]);
266
79
  } finally {
267
80
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
268
81
  }
269
- };
82
+ }
83
+ exports.evaluate_expr = evaluate_expr;
270
84
 
271
85
  /**
272
86
  * Evaluate a Manipulate body with a specific set of variable bindings
@@ -283,7 +97,7 @@ exports.evaluate_statement = function(stmt) {
283
97
  * @param {string} bindings_json
284
98
  * @returns {string}
285
99
  */
286
- exports.evaluate_manipulate = function(body, bindings_json) {
100
+ function evaluate_manipulate(body, bindings_json) {
287
101
  let deferred3_0;
288
102
  let deferred3_1;
289
103
  try {
@@ -298,7 +112,8 @@ exports.evaluate_manipulate = function(body, bindings_json) {
298
112
  } finally {
299
113
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
300
114
  }
301
- };
115
+ }
116
+ exports.evaluate_manipulate = evaluate_manipulate;
302
117
 
303
118
  /**
304
119
  * Evaluate each Manipulate control's `Enabled` condition against a binding
@@ -307,13 +122,13 @@ exports.evaluate_manipulate = function(body, bindings_json) {
307
122
  * `conditions_json` is a JSON string array aligned with the control list;
308
123
  * an empty string marks a control with no condition (always enabled).
309
124
  * `bindings_json` is the same JSON object of variable bindings used by
310
- * `evaluate_manipulate`. Used by the Playground to grey out controls that a
125
+ * `evaluate_manipulate`. Used by the Playground to gray out controls that a
311
126
  * `Enabled -> Dynamic[…]` option has switched off for the current state.
312
127
  * @param {string} conditions_json
313
128
  * @param {string} bindings_json
314
129
  * @returns {string}
315
130
  */
316
- exports.evaluate_manipulate_enabled = function(conditions_json, bindings_json) {
131
+ function evaluate_manipulate_enabled(conditions_json, bindings_json) {
317
132
  let deferred3_0;
318
133
  let deferred3_1;
319
134
  try {
@@ -328,7 +143,8 @@ exports.evaluate_manipulate_enabled = function(conditions_json, bindings_json) {
328
143
  } finally {
329
144
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
330
145
  }
331
- };
146
+ }
147
+ exports.evaluate_manipulate_enabled = evaluate_manipulate_enabled;
332
148
 
333
149
  /**
334
150
  * Render a Manipulate body, its extra display elements, and any pending
@@ -349,7 +165,7 @@ exports.evaluate_manipulate_enabled = function(conditions_json, bindings_json) {
349
165
  * @param {string} mutations_json
350
166
  * @returns {string}
351
167
  */
352
- exports.evaluate_manipulate_full = function(body, displays_json, bindings_json, mutations_json) {
168
+ function evaluate_manipulate_full(body, displays_json, bindings_json, mutations_json) {
353
169
  let deferred5_0;
354
170
  let deferred5_1;
355
171
  try {
@@ -368,59 +184,38 @@ exports.evaluate_manipulate_full = function(body, displays_json, bindings_json,
368
184
  } finally {
369
185
  wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
370
186
  }
371
- };
372
-
373
- /**
374
- * Evaluate, returning only the final expression result (no Print output).
375
- * @param {string} input
376
- * @returns {string}
377
- */
378
- exports.evaluate_expr = function(input) {
379
- let deferred2_0;
380
- let deferred2_1;
381
- try {
382
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
383
- const len0 = WASM_VECTOR_LEN;
384
- const ret = wasm.evaluate_expr(ptr0, len0);
385
- deferred2_0 = ret[0];
386
- deferred2_1 = ret[1];
387
- return getStringFromWasm0(ret[0], ret[1]);
388
- } finally {
389
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
390
- }
391
- };
392
-
393
- exports.init = function() {
394
- wasm.init();
395
- };
187
+ }
188
+ exports.evaluate_manipulate_full = evaluate_manipulate_full;
396
189
 
397
190
  /**
398
- * Evaluate a Wolfram Language expression and return the result.
399
- * If the expression produces Print output, it is prepended to the result.
400
- * @param {string} input
191
+ * Evaluate a single statement and return a JSON array of output items
192
+ * (same shape as `evaluate_all`'s elements). Use together with
193
+ * `split_statements` for progressive output.
194
+ * @param {string} stmt
401
195
  * @returns {string}
402
196
  */
403
- exports.evaluate = function(input) {
197
+ function evaluate_statement(stmt) {
404
198
  let deferred2_0;
405
199
  let deferred2_1;
406
200
  try {
407
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
201
+ const ptr0 = passStringToWasm0(stmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
408
202
  const len0 = WASM_VECTOR_LEN;
409
- const ret = wasm.evaluate(ptr0, len0);
203
+ const ret = wasm.evaluate_statement(ptr0, len0);
410
204
  deferred2_0 = ret[0];
411
205
  deferred2_1 = ret[1];
412
206
  return getStringFromWasm0(ret[0], ret[1]);
413
207
  } finally {
414
208
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
415
209
  }
416
- };
210
+ }
211
+ exports.evaluate_statement = evaluate_statement;
417
212
 
418
213
  /**
419
214
  * Return the captured SVG graphics from the last `evaluate()` call, if any.
420
215
  * Returns an empty string when there is no graphics output.
421
216
  * @returns {string}
422
217
  */
423
- exports.get_graphics = function() {
218
+ function get_graphics() {
424
219
  let deferred1_0;
425
220
  let deferred1_1;
426
221
  try {
@@ -431,14 +226,15 @@ exports.get_graphics = function() {
431
226
  } finally {
432
227
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
433
228
  }
434
- };
229
+ }
230
+ exports.get_graphics = get_graphics;
435
231
 
436
232
  /**
437
233
  * Return the playable audio (base64-encoded) from the last `evaluate()`
438
234
  * call, if any. Returns an empty string when there is no sound.
439
235
  * @returns {string}
440
236
  */
441
- exports.get_sound = function() {
237
+ function get_sound() {
442
238
  let deferred1_0;
443
239
  let deferred1_1;
444
240
  try {
@@ -449,14 +245,15 @@ exports.get_sound = function() {
449
245
  } finally {
450
246
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
451
247
  }
452
- };
248
+ }
249
+ exports.get_sound = get_sound;
453
250
 
454
251
  /**
455
252
  * Return warnings from the last `evaluate()` call as newline-separated text.
456
253
  * Returns an empty string when there are no warnings.
457
254
  * @returns {string}
458
255
  */
459
- exports.get_warnings = function() {
256
+ function get_warnings() {
460
257
  let deferred1_0;
461
258
  let deferred1_1;
462
259
  try {
@@ -467,378 +264,532 @@ exports.get_warnings = function() {
467
264
  } finally {
468
265
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
469
266
  }
470
- };
267
+ }
268
+ exports.get_warnings = get_warnings;
471
269
 
472
- /**
473
- * Clear all interpreter state (variables and function definitions).
474
- */
475
- exports.clear = function() {
476
- wasm.clear();
477
- };
270
+ function init() {
271
+ wasm.init();
272
+ }
273
+ exports.init = init;
478
274
 
479
275
  /**
480
276
  * Enable or disable dark mode for SVG output colors.
481
277
  * @param {boolean} enabled
482
278
  */
483
- exports.set_dark_mode = function(enabled) {
279
+ function set_dark_mode(enabled) {
484
280
  wasm.set_dark_mode(enabled);
485
- };
281
+ }
282
+ exports.set_dark_mode = set_dark_mode;
486
283
 
487
284
  /**
488
- * Evaluate all top-level statements and return a JSON array of output items.
489
- * Each item has a "type" field ("text", "graphics", "print", "warning", "error",
490
- * "manipulate") and corresponding content fields.
285
+ * Register (or replace) an in-memory file so `Import["name"]` can read it
286
+ * in the browser.
287
+ * @param {string} name
288
+ * @param {Uint8Array} data
289
+ */
290
+ function set_virtual_file(name, data) {
291
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
292
+ const len0 = WASM_VECTOR_LEN;
293
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
294
+ const len1 = WASM_VECTOR_LEN;
295
+ wasm.set_virtual_file(ptr0, len0, ptr1, len1);
296
+ }
297
+ exports.set_virtual_file = set_virtual_file;
298
+
299
+ /**
300
+ * Split `input` into top-level statements and return a JSON array of strings.
301
+ * Lets the front-end loop one statement at a time so output (and side
302
+ * effects like `Pause[n]`) appear progressively rather than batched.
491
303
  * @param {string} input
492
304
  * @returns {string}
493
305
  */
494
- exports.evaluate_all = function(input) {
306
+ function split_statements(input) {
495
307
  let deferred2_0;
496
308
  let deferred2_1;
497
309
  try {
498
310
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
499
311
  const len0 = WASM_VECTOR_LEN;
500
- const ret = wasm.evaluate_all(ptr0, len0);
312
+ const ret = wasm.split_statements(ptr0, len0);
501
313
  deferred2_0 = ret[0];
502
314
  deferred2_1 = ret[1];
503
315
  return getStringFromWasm0(ret[0], ret[1]);
504
316
  } finally {
505
317
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
506
318
  }
507
- };
319
+ }
320
+ exports.split_statements = split_statements;
508
321
 
509
- exports.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
510
- const ret = debugString(arg1);
511
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
512
- const len1 = WASM_VECTOR_LEN;
513
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
514
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
515
- };
516
-
517
- exports.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
518
- const ret = typeof(arg0) === 'function';
519
- return ret;
520
- };
521
-
522
- exports.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
523
- const val = arg0;
524
- const ret = typeof(val) === 'object' && val !== null;
525
- return ret;
526
- };
527
-
528
- exports.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
529
- const ret = typeof(arg0) === 'string';
530
- return ret;
531
- };
532
-
533
- exports.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
534
- const ret = arg0 === undefined;
535
- return ret;
536
- };
537
-
538
- exports.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
539
- throw new Error(getStringFromWasm0(arg0, arg1));
540
- };
541
-
542
- exports.__wbg___woxi_fetch_url_1a2edada61209f50 = function() { return handleError(function (arg0, arg1, arg2) {
543
- const ret = __woxi_fetch_url(getStringFromWasm0(arg1, arg2));
544
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
545
- const len1 = WASM_VECTOR_LEN;
546
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
547
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
548
- }, arguments) };
549
-
550
- exports.__wbg___woxi_report_panic_295788df1c67306c = function() { return handleError(function (arg0, arg1) {
551
- __woxi_report_panic(getStringFromWasm0(arg0, arg1));
552
- }, arguments) };
553
-
554
- exports.__wbg_append_ed363d026656dfbd = function() { return handleError(function (arg0, arg1) {
555
- arg0.append(arg1);
556
- }, arguments) };
557
-
558
- exports.__wbg_body_8c26b54829a0c4cb = function(arg0) {
559
- const ret = arg0.body;
560
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
561
- };
562
-
563
- exports.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
564
- const ret = arg0.call(arg1, arg2);
565
- return ret;
566
- }, arguments) };
567
-
568
- exports.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
569
- const ret = arg0.call(arg1);
570
- return ret;
571
- }, arguments) };
572
-
573
- exports.__wbg_createElement_964ab674a0176cd8 = function() { return handleError(function (arg0, arg1, arg2) {
574
- const ret = arg0.createElement(getStringFromWasm0(arg1, arg2));
575
- return ret;
576
- }, arguments) };
577
-
578
- exports.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
579
- const ret = arg0.crypto;
580
- return ret;
581
- };
582
-
583
- exports.__wbg_document_725ae06eb442a6db = function(arg0) {
584
- const ret = arg0.document;
585
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
586
- };
587
-
588
- exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
589
- let deferred0_0;
590
- let deferred0_1;
322
+ /**
323
+ * Return every file produced by `Export` since the last call as a JSON array
324
+ * of `{"name":…, "data":<base64>[, "rasterize":"png"]}`, then clear the store.
325
+ * The host decodes each base64 payload into a Blob and renders a download
326
+ * link; entries carrying `rasterize` hold SVG the host converts to that raster
327
+ * format first. Draining on read keeps each evaluation's exports separate.
328
+ * @returns {string}
329
+ */
330
+ function take_exported_files() {
331
+ let deferred1_0;
332
+ let deferred1_1;
591
333
  try {
592
- deferred0_0 = arg0;
593
- deferred0_1 = arg1;
594
- console.error(getStringFromWasm0(arg0, arg1));
334
+ const ret = wasm.take_exported_files();
335
+ deferred1_0 = ret[0];
336
+ deferred1_1 = ret[1];
337
+ return getStringFromWasm0(ret[0], ret[1]);
595
338
  } finally {
596
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
339
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
597
340
  }
598
- };
599
-
600
- exports.__wbg_getDate_5a70d2f6a482d99f = function(arg0) {
601
- const ret = arg0.getDate();
602
- return ret;
603
- };
604
-
605
- exports.__wbg_getFullYear_8240d5a15191feae = function(arg0) {
606
- const ret = arg0.getFullYear();
607
- return ret;
608
- };
609
-
610
- exports.__wbg_getHours_5e476e0b9ebc42d1 = function(arg0) {
611
- const ret = arg0.getHours();
612
- return ret;
613
- };
614
-
615
- exports.__wbg_getMilliseconds_9fc7184d90e04a16 = function(arg0) {
616
- const ret = arg0.getMilliseconds();
617
- return ret;
618
- };
619
-
620
- exports.__wbg_getMinutes_c95dfb65f1ea8f02 = function(arg0) {
621
- const ret = arg0.getMinutes();
622
- return ret;
623
- };
624
-
625
- exports.__wbg_getMonth_25c1c5a601d72773 = function(arg0) {
626
- const ret = arg0.getMonth();
627
- return ret;
628
- };
629
-
630
- exports.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
631
- arg0.getRandomValues(arg1);
632
- }, arguments) };
633
-
634
- exports.__wbg_getSeconds_8113bf8709718eb2 = function(arg0) {
635
- const ret = arg0.getSeconds();
636
- return ret;
637
- };
638
-
639
- exports.__wbg_getTime_14776bfb48a1bff9 = function(arg0) {
640
- const ret = arg0.getTime();
641
- return ret;
642
- };
643
-
644
- exports.__wbg_getTimezoneOffset_d391cb11d54969f8 = function(arg0) {
645
- const ret = arg0.getTimezoneOffset();
646
- return ret;
647
- };
648
-
649
- exports.__wbg_instanceof_HtmlElement_e20a729df22f9e1c = function(arg0) {
650
- let result;
651
- try {
652
- result = arg0 instanceof HTMLElement;
653
- } catch (_) {
654
- result = false;
341
+ }
342
+ exports.take_exported_files = take_exported_files;
343
+ function __wbg_get_imports() {
344
+ const import0 = {
345
+ __proto__: null,
346
+ __wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
347
+ const ret = debugString(arg1);
348
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
349
+ const len1 = WASM_VECTOR_LEN;
350
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
351
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
352
+ },
353
+ __wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
354
+ const ret = typeof(arg0) === 'function';
355
+ return ret;
356
+ },
357
+ __wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
358
+ const val = arg0;
359
+ const ret = typeof(val) === 'object' && val !== null;
360
+ return ret;
361
+ },
362
+ __wbg___wbindgen_is_string_90b56bc79aad6f6c: function(arg0) {
363
+ const ret = typeof(arg0) === 'string';
364
+ return ret;
365
+ },
366
+ __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
367
+ const ret = arg0 === undefined;
368
+ return ret;
369
+ },
370
+ __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
371
+ throw new Error(getStringFromWasm0(arg0, arg1));
372
+ },
373
+ __wbg___woxi_fetch_url_168031ca5a4c2c20: function() { return handleError(function (arg0, arg1, arg2) {
374
+ const ret = __woxi_fetch_url(getStringFromWasm0(arg1, arg2));
375
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
376
+ const len1 = WASM_VECTOR_LEN;
377
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
378
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
379
+ }, arguments); },
380
+ __wbg___woxi_report_panic_0d15031b779e8727: function() { return handleError(function (arg0, arg1) {
381
+ __woxi_report_panic(getStringFromWasm0(arg0, arg1));
382
+ }, arguments); },
383
+ __wbg_append_c2f0f7a240a1df4f: function() { return handleError(function (arg0, arg1) {
384
+ arg0.append(arg1);
385
+ }, arguments); },
386
+ __wbg_body_e549239eaff082e1: function(arg0) {
387
+ const ret = arg0.body;
388
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
389
+ },
390
+ __wbg_call_187d372bd5fdd4aa: function() { return handleError(function (arg0, arg1, arg2) {
391
+ const ret = arg0.call(arg1, arg2);
392
+ return ret;
393
+ }, arguments); },
394
+ __wbg_createElement_74049073a11f9c31: function() { return handleError(function (arg0, arg1, arg2) {
395
+ const ret = arg0.createElement(getStringFromWasm0(arg1, arg2));
396
+ return ret;
397
+ }, arguments); },
398
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
399
+ const ret = arg0.crypto;
400
+ return ret;
401
+ },
402
+ __wbg_document_9854e03c05fc8834: function(arg0) {
403
+ const ret = arg0.document;
404
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
405
+ },
406
+ __wbg_error_757e9472f8410341: function(arg0, arg1) {
407
+ let deferred0_0;
408
+ let deferred0_1;
409
+ try {
410
+ deferred0_0 = arg0;
411
+ deferred0_1 = arg1;
412
+ console.error(getStringFromWasm0(arg0, arg1));
413
+ } finally {
414
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
415
+ }
416
+ },
417
+ __wbg_getDate_1181c785ea4fdd21: function(arg0) {
418
+ const ret = arg0.getDate();
419
+ return ret;
420
+ },
421
+ __wbg_getFullYear_32050b2c56c56cd8: function(arg0) {
422
+ const ret = arg0.getFullYear();
423
+ return ret;
424
+ },
425
+ __wbg_getHours_f57dcda3efee150c: function(arg0) {
426
+ const ret = arg0.getHours();
427
+ return ret;
428
+ },
429
+ __wbg_getMilliseconds_041f71bbf3fde00e: function(arg0) {
430
+ const ret = arg0.getMilliseconds();
431
+ return ret;
432
+ },
433
+ __wbg_getMinutes_951e7f98fc4fdb30: function(arg0) {
434
+ const ret = arg0.getMinutes();
435
+ return ret;
436
+ },
437
+ __wbg_getMonth_aae5f530fd173536: function(arg0) {
438
+ const ret = arg0.getMonth();
439
+ return ret;
440
+ },
441
+ __wbg_getRandomValues_436a51d0629d84e1: function() { return handleError(function (arg0, arg1) {
442
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
443
+ }, arguments); },
444
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
445
+ arg0.getRandomValues(arg1);
446
+ }, arguments); },
447
+ __wbg_getSeconds_8ffcca0e220547af: function(arg0) {
448
+ const ret = arg0.getSeconds();
449
+ return ret;
450
+ },
451
+ __wbg_getTime_f5a55efff2585d5d: function(arg0) {
452
+ const ret = arg0.getTime();
453
+ return ret;
454
+ },
455
+ __wbg_getTimezoneOffset_2e851fdaecc2dc92: function(arg0) {
456
+ const ret = arg0.getTimezoneOffset();
457
+ return ret;
458
+ },
459
+ __wbg_instanceof_HtmlElement_32fb153a5a0e2349: function(arg0) {
460
+ let result;
461
+ try {
462
+ result = arg0 instanceof HTMLElement;
463
+ } catch (_) {
464
+ result = false;
465
+ }
466
+ const ret = result;
467
+ return ret;
468
+ },
469
+ __wbg_instanceof_Window_82d71df4eddf88bc: function(arg0) {
470
+ let result;
471
+ try {
472
+ result = arg0 instanceof Window;
473
+ } catch (_) {
474
+ result = false;
475
+ }
476
+ const ret = result;
477
+ return ret;
478
+ },
479
+ __wbg_length_7f3c00c40364105e: function(arg0) {
480
+ const ret = arg0.length;
481
+ return ret;
482
+ },
483
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
484
+ const ret = arg0.msCrypto;
485
+ return ret;
486
+ },
487
+ __wbg_new_0_72d020f0c63443d4: function() {
488
+ const ret = new Date();
489
+ return ret;
490
+ },
491
+ __wbg_new_227d7c05414eb861: function() {
492
+ const ret = new Error();
493
+ return ret;
494
+ },
495
+ __wbg_new_34e56228080aa9f8: function(arg0) {
496
+ const ret = new Date(arg0);
497
+ return ret;
498
+ },
499
+ __wbg_new_with_length_3da0ad195f6f63ba: function(arg0) {
500
+ const ret = new Uint8Array(arg0 >>> 0);
501
+ return ret;
502
+ },
503
+ __wbg_new_with_year_month_day_0d952a48f939d06b: function(arg0, arg1, arg2) {
504
+ const ret = new Date(arg0 >>> 0, arg1, arg2);
505
+ return ret;
506
+ },
507
+ __wbg_node_84ea875411254db1: function(arg0) {
508
+ const ret = arg0.node;
509
+ return ret;
510
+ },
511
+ __wbg_now_aa4ccb83129e9e55: function() {
512
+ const ret = Date.now();
513
+ return ret;
514
+ },
515
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
516
+ const ret = arg0.now();
517
+ return ret;
518
+ },
519
+ __wbg_offsetHeight_427aaf53442f1586: function(arg0) {
520
+ const ret = arg0.offsetHeight;
521
+ return ret;
522
+ },
523
+ __wbg_offsetWidth_1d736667aa04ab3a: function(arg0) {
524
+ const ret = arg0.offsetWidth;
525
+ return ret;
526
+ },
527
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
528
+ const ret = arg0.performance;
529
+ return ret;
530
+ },
531
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
532
+ const ret = arg0.process;
533
+ return ret;
534
+ },
535
+ __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
536
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
537
+ },
538
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
539
+ arg0.randomFillSync(arg1);
540
+ }, arguments); },
541
+ __wbg_remove_9a5288388316028c: function(arg0) {
542
+ arg0.remove();
543
+ },
544
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
545
+ const ret = module.require;
546
+ return ret;
547
+ }, arguments); },
548
+ __wbg_setAttribute_9e7d603908f63705: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
549
+ arg0.setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
550
+ }, arguments); },
551
+ __wbg_set_textContent_6d6fc559f198055f: function(arg0, arg1, arg2) {
552
+ arg0.textContent = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2);
553
+ },
554
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
555
+ const ret = arg1.stack;
556
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
557
+ const len1 = WASM_VECTOR_LEN;
558
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
559
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
560
+ },
561
+ __wbg_static_accessor_GLOBAL_266715b9d96ba635: function() {
562
+ const ret = typeof global === 'undefined' ? null : global;
563
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
564
+ },
565
+ __wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() {
566
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
567
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
568
+ },
569
+ __wbg_static_accessor_SELF_0b583911f537483a: function() {
570
+ const ret = typeof self === 'undefined' ? null : self;
571
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
572
+ },
573
+ __wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() {
574
+ const ret = typeof window === 'undefined' ? null : window;
575
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
576
+ },
577
+ __wbg_subarray_002b94d5e13d1411: function(arg0, arg1, arg2) {
578
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
579
+ return ret;
580
+ },
581
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
582
+ const ret = arg0.versions;
583
+ return ret;
584
+ },
585
+ __wbindgen_generic_0000000000000001: function(arg0) {
586
+ // Cast intrinsic for `F64 -> Externref`.
587
+ const ret = arg0;
588
+ return ret;
589
+ },
590
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
591
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
592
+ const ret = getArrayU8FromWasm0(arg0, arg1);
593
+ return ret;
594
+ },
595
+ __wbindgen_generic_0000000000000003: function(arg0, arg1) {
596
+ // Cast intrinsic for `Ref(String) -> Externref`.
597
+ const ret = getStringFromWasm0(arg0, arg1);
598
+ return ret;
599
+ },
600
+ __wbindgen_init_externref_table: function() {
601
+ const table = wasm.__wbindgen_externrefs;
602
+ const offset = table.grow(4);
603
+ table.set(0, undefined);
604
+ table.set(offset + 0, undefined);
605
+ table.set(offset + 1, null);
606
+ table.set(offset + 2, true);
607
+ table.set(offset + 3, false);
608
+ },
609
+ };
610
+ return {
611
+ __proto__: null,
612
+ "./woxi_bg.js": import0,
613
+ };
614
+ }
615
+
616
+ function addToExternrefTable0(obj) {
617
+ const idx = wasm.__externref_table_alloc();
618
+ wasm.__wbindgen_externrefs.set(idx, obj);
619
+ return idx;
620
+ }
621
+
622
+ function debugString(val) {
623
+ // primitive types
624
+ const type = typeof val;
625
+ if (type == 'number' || type == 'boolean' || val == null) {
626
+ return `${val}`;
627
+ }
628
+ if (type == 'string') {
629
+ return `"${val}"`;
630
+ }
631
+ if (type == 'symbol') {
632
+ const description = val.description;
633
+ if (description == null) {
634
+ return 'Symbol';
635
+ } else {
636
+ return `Symbol(${description})`;
637
+ }
638
+ }
639
+ if (type == 'function') {
640
+ const name = val.name;
641
+ if (typeof name == 'string' && name.length > 0) {
642
+ return `Function(${name})`;
643
+ } else {
644
+ return 'Function';
645
+ }
655
646
  }
656
- const ret = result;
657
- return ret;
658
- };
647
+ // objects
648
+ if (Array.isArray(val)) {
649
+ const length = val.length;
650
+ let debug = '[';
651
+ if (length > 0) {
652
+ debug += debugString(val[0]);
653
+ }
654
+ for(let i = 1; i < length; i++) {
655
+ debug += ', ' + debugString(val[i]);
656
+ }
657
+ debug += ']';
658
+ return debug;
659
+ }
660
+ // Test for built-in
661
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
662
+ let className;
663
+ if (builtInMatches && builtInMatches.length > 1) {
664
+ className = builtInMatches[1];
665
+ } else {
666
+ // Failed to match the standard '[object ClassName]'
667
+ return toString.call(val);
668
+ }
669
+ if (className == 'Object') {
670
+ // we're a user defined class or Object
671
+ // JSON.stringify avoids problems with cycles, and is generally much
672
+ // easier than looping through ownProperties of `val`.
673
+ try {
674
+ return 'Object(' + JSON.stringify(val) + ')';
675
+ } catch (_) {
676
+ return 'Object';
677
+ }
678
+ }
679
+ // errors
680
+ if (val instanceof Error) {
681
+ return `${val.name}: ${val.message}\n${val.stack}`;
682
+ }
683
+ // TODO we could test for more things here, like `Set`s and `Map`s.
684
+ return className;
685
+ }
686
+
687
+ function getArrayU8FromWasm0(ptr, len) {
688
+ ptr = ptr >>> 0;
689
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
690
+ }
691
+
692
+ let cachedDataViewMemory0 = null;
693
+ function getDataViewMemory0() {
694
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
695
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
696
+ }
697
+ return cachedDataViewMemory0;
698
+ }
699
+
700
+ function getStringFromWasm0(ptr, len) {
701
+ return decodeText(ptr >>> 0, len);
702
+ }
703
+
704
+ let cachedUint8ArrayMemory0 = null;
705
+ function getUint8ArrayMemory0() {
706
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
707
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
708
+ }
709
+ return cachedUint8ArrayMemory0;
710
+ }
659
711
 
660
- exports.__wbg_instanceof_Window_4846dbb3de56c84c = function(arg0) {
661
- let result;
712
+ function handleError(f, args) {
662
713
  try {
663
- result = arg0 instanceof Window;
664
- } catch (_) {
665
- result = false;
714
+ return f.apply(this, args);
715
+ } catch (e) {
716
+ const idx = addToExternrefTable0(e);
717
+ wasm.__wbindgen_exn_store(idx);
666
718
  }
667
- const ret = result;
668
- return ret;
669
- };
670
-
671
- exports.__wbg_length_69bca3cb64fc8748 = function(arg0) {
672
- const ret = arg0.length;
673
- return ret;
674
- };
675
-
676
- exports.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
677
- const ret = arg0.msCrypto;
678
- return ret;
679
- };
680
-
681
- exports.__wbg_new_0_f9740686d739025c = function() {
682
- const ret = new Date();
683
- return ret;
684
- };
685
-
686
- exports.__wbg_new_8a6f238a6ece86ea = function() {
687
- const ret = new Error();
688
- return ret;
689
- };
690
-
691
- exports.__wbg_new_93d9417ed3fb115d = function(arg0) {
692
- const ret = new Date(arg0);
693
- return ret;
694
- };
695
-
696
- exports.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
697
- const ret = new Function(getStringFromWasm0(arg0, arg1));
698
- return ret;
699
- };
700
-
701
- exports.__wbg_new_with_length_01aa0dc35aa13543 = function(arg0) {
702
- const ret = new Uint8Array(arg0 >>> 0);
703
- return ret;
704
- };
705
-
706
- exports.__wbg_new_with_year_month_day_6236812cf591750d = function(arg0, arg1, arg2) {
707
- const ret = new Date(arg0 >>> 0, arg1, arg2);
708
- return ret;
709
- };
710
-
711
- exports.__wbg_node_905d3e251edff8a2 = function(arg0) {
712
- const ret = arg0.node;
713
- return ret;
714
- };
715
-
716
- exports.__wbg_now_2c95c9de01293173 = function(arg0) {
717
- const ret = arg0.now();
718
- return ret;
719
- };
720
-
721
- exports.__wbg_now_793306c526e2e3b6 = function() {
722
- const ret = Date.now();
723
- return ret;
724
- };
725
-
726
- exports.__wbg_offsetHeight_9cb4257b24361e2a = function(arg0) {
727
- const ret = arg0.offsetHeight;
728
- return ret;
729
- };
730
-
731
- exports.__wbg_offsetWidth_16b33c540f3e9ddb = function(arg0) {
732
- const ret = arg0.offsetWidth;
733
- return ret;
734
- };
735
-
736
- exports.__wbg_performance_7a3ffd0b17f663ad = function(arg0) {
737
- const ret = arg0.performance;
738
- return ret;
739
- };
740
-
741
- exports.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
742
- const ret = arg0.process;
743
- return ret;
744
- };
745
-
746
- exports.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
747
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
748
- };
749
-
750
- exports.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
751
- arg0.randomFillSync(arg1);
752
- }, arguments) };
753
-
754
- exports.__wbg_remove_4ba46706a8e17d9d = function(arg0) {
755
- arg0.remove();
756
- };
757
-
758
- exports.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
759
- const ret = module.require;
760
- return ret;
761
- }, arguments) };
762
-
763
- exports.__wbg_setAttribute_9bad76f39609daac = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
764
- arg0.setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
765
- }, arguments) };
766
-
767
- exports.__wbg_set_textContent_12af0b0f84feb710 = function(arg0, arg1, arg2) {
768
- arg0.textContent = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2);
769
- };
770
-
771
- exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
772
- const ret = arg1.stack;
773
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
774
- const len1 = WASM_VECTOR_LEN;
775
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
776
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
777
- };
778
-
779
- exports.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
780
- const ret = typeof global === 'undefined' ? null : global;
781
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
782
- };
783
-
784
- exports.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
785
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
786
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
787
- };
788
-
789
- exports.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
790
- const ret = typeof self === 'undefined' ? null : self;
791
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
792
- };
793
-
794
- exports.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
795
- const ret = typeof window === 'undefined' ? null : window;
796
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
797
- };
798
-
799
- exports.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
800
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
801
- return ret;
802
- };
803
-
804
- exports.__wbg_versions_c01dfd4722a88165 = function(arg0) {
805
- const ret = arg0.versions;
806
- return ret;
807
- };
808
-
809
- exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
810
- // Cast intrinsic for `Ref(String) -> Externref`.
811
- const ret = getStringFromWasm0(arg0, arg1);
812
- return ret;
813
- };
814
-
815
- exports.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
816
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
817
- const ret = getArrayU8FromWasm0(arg0, arg1);
818
- return ret;
819
- };
820
-
821
- exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
822
- // Cast intrinsic for `F64 -> Externref`.
823
- const ret = arg0;
824
- return ret;
825
- };
826
-
827
- exports.__wbindgen_init_externref_table = function() {
828
- const table = wasm.__wbindgen_externrefs;
829
- const offset = table.grow(4);
830
- table.set(0, undefined);
831
- table.set(offset + 0, undefined);
832
- table.set(offset + 1, null);
833
- table.set(offset + 2, true);
834
- table.set(offset + 3, false);
835
- ;
836
- };
719
+ }
720
+
721
+ function isLikeNone(x) {
722
+ return x === undefined || x === null;
723
+ }
724
+
725
+ function passArray8ToWasm0(arg, malloc) {
726
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
727
+ getUint8ArrayMemory0().set(arg, ptr / 1);
728
+ WASM_VECTOR_LEN = arg.length;
729
+ return ptr;
730
+ }
731
+
732
+ function passStringToWasm0(arg, malloc, realloc) {
733
+ if (realloc === undefined) {
734
+ const buf = cachedTextEncoder.encode(arg);
735
+ const ptr = malloc(buf.length, 1) >>> 0;
736
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
737
+ WASM_VECTOR_LEN = buf.length;
738
+ return ptr;
739
+ }
740
+
741
+ let len = arg.length;
742
+ let ptr = malloc(len, 1) >>> 0;
743
+
744
+ const mem = getUint8ArrayMemory0();
745
+
746
+ let offset = 0;
747
+
748
+ for (; offset < len; offset++) {
749
+ const code = arg.charCodeAt(offset);
750
+ if (code > 0x7F) break;
751
+ mem[ptr + offset] = code;
752
+ }
753
+ if (offset !== len) {
754
+ if (offset !== 0) {
755
+ arg = arg.slice(offset);
756
+ }
757
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
758
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
759
+ const ret = cachedTextEncoder.encodeInto(arg, view);
760
+
761
+ offset += ret.written;
762
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
763
+ }
764
+
765
+ WASM_VECTOR_LEN = offset;
766
+ return ptr;
767
+ }
768
+
769
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
770
+ cachedTextDecoder.decode();
771
+ function decodeText(ptr, len) {
772
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
773
+ }
774
+
775
+ const cachedTextEncoder = new TextEncoder();
776
+
777
+ if (!('encodeInto' in cachedTextEncoder)) {
778
+ cachedTextEncoder.encodeInto = function (arg, view) {
779
+ const buf = cachedTextEncoder.encode(arg);
780
+ view.set(buf);
781
+ return {
782
+ read: arg.length,
783
+ written: buf.length
784
+ };
785
+ };
786
+ }
787
+
788
+ let WASM_VECTOR_LEN = 0;
837
789
 
838
790
  const wasmPath = `${__dirname}/woxi_bg.wasm`;
839
791
  const wasmBytes = require('fs').readFileSync(wasmPath);
840
792
  const wasmModule = new WebAssembly.Module(wasmBytes);
841
- const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
842
-
793
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
794
+ let wasm = wasmInstance.exports;
843
795
  wasm.__wbindgen_start();
844
-