@zonks/wasm 0.0.0-stage → 0.1.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.
Files changed (38) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +205 -2
  3. package/THIRD_PARTY_NOTICES.md +156 -0
  4. package/fonts/GPL-2 +339 -0
  5. package/fonts/LICENSE +102 -0
  6. package/fonts/LiberationMono-Bold.ttf +0 -0
  7. package/fonts/LiberationMono-BoldItalic.ttf +0 -0
  8. package/fonts/LiberationMono-Italic.ttf +0 -0
  9. package/fonts/LiberationMono.ttf +0 -0
  10. package/fonts/LiberationSans-Bold.ttf +0 -0
  11. package/fonts/LiberationSans-BoldItalic.ttf +0 -0
  12. package/fonts/LiberationSans-Italic.ttf +0 -0
  13. package/fonts/LiberationSans.ttf +0 -0
  14. package/fonts/LiberationSerif-Bold.ttf +0 -0
  15. package/fonts/LiberationSerif-BoldItalic.ttf +0 -0
  16. package/fonts/LiberationSerif-Italic.ttf +0 -0
  17. package/fonts/LiberationSerif-Regular.COPYRIGHT +73 -0
  18. package/fonts/LiberationSerif.ttf +0 -0
  19. package/fonts/NotoEmoji-Regular.ttf +0 -0
  20. package/fonts/NotoSans-Regular.ttf +0 -0
  21. package/fonts/NotoSansCJKsc-Regular.otf +0 -0
  22. package/fonts/NotoSansMath-Regular.ttf +0 -0
  23. package/fonts/NotoSansSymbols-Regular.ttf +0 -0
  24. package/fonts/NotoSansSymbols2-Regular.ttf +0 -0
  25. package/fonts/OFL-NotoEmoji.txt +93 -0
  26. package/fonts/OFL-NotoSans.txt +93 -0
  27. package/fonts/OFL-NotoSansCJK.txt +94 -0
  28. package/fonts/OFL-NotoSansMath.txt +93 -0
  29. package/fonts/OFL-NotoSansSymbols.txt +93 -0
  30. package/fonts/OFL-NotoSansSymbols2.txt +93 -0
  31. package/fonts/fonts.json +128 -0
  32. package/node.d.ts +24 -0
  33. package/node.js +38 -0
  34. package/package.json +19 -4
  35. package/zonks_wasm.d.ts +163 -0
  36. package/zonks_wasm.js +660 -0
  37. package/zonks_wasm_bg.wasm +0 -0
  38. package/zonks_wasm_bg.wasm.d.ts +29 -0
package/zonks_wasm.js ADDED
@@ -0,0 +1,660 @@
1
+ /* @ts-self-types="./zonks_wasm.d.ts" */
2
+
3
+ /**
4
+ * One long-lived engine session: fonts and icon packs are set once, and
5
+ * its caches make repeated renders (an editor's keystrokes) faster. Every
6
+ * render equals the free [`render`] in a fresh session with the same
7
+ * fonts, packs and options. `free()` releases it. Called from inside one
8
+ * of the renderer's own calls (a host getter), `free()` throws
9
+ * wasm-bindgen's "attempted to take ownership of Rust value while it was
10
+ * borrowed" but still releases it when that call returns; later calls
11
+ * throw "null pointer passed to rust", as for any freed object (the
12
+ * instance stays usable).
13
+ */
14
+ export class Renderer {
15
+ __destroy_into_raw() {
16
+ const ptr = this.__wbg_ptr;
17
+ this.__wbg_ptr = 0;
18
+ RendererFinalization.unregister(this);
19
+ return ptr;
20
+ }
21
+ free() {
22
+ const ptr = this.__destroy_into_raw();
23
+ wasm.__wbg_renderer_free(ptr, 0);
24
+ }
25
+ /**
26
+ * The estimated bytes the caches hold.
27
+ * @returns {number}
28
+ */
29
+ cacheBytes() {
30
+ const ret = wasm.renderer_cacheBytes(this.__wbg_ptr);
31
+ return ret;
32
+ }
33
+ /**
34
+ * Empties the caches.
35
+ */
36
+ clearCaches() {
37
+ wasm.renderer_clearCaches(this.__wbg_ptr);
38
+ }
39
+ /**
40
+ * Unregisters every icon pack.
41
+ */
42
+ clearIconPacks() {
43
+ wasm.renderer_clearIconPacks(this.__wbg_ptr);
44
+ }
45
+ /**
46
+ * The work units the last render spent (to size `workBudget`).
47
+ * @returns {number}
48
+ */
49
+ lastRenderWork() {
50
+ const ret = wasm.renderer_lastRenderWork(this.__wbg_ptr);
51
+ return ret;
52
+ }
53
+ /**
54
+ * A renderer with the build's default fonts (the bundled Liberation
55
+ * set, or none without `bundled-fonts`: call `setFonts`) and no icon
56
+ * packs.
57
+ */
58
+ constructor() {
59
+ const ret = wasm.renderer_new();
60
+ this.__wbg_ptr = ret;
61
+ RendererFinalization.register(this, this.__wbg_ptr, this);
62
+ return this;
63
+ }
64
+ /**
65
+ * Registers a resolved pack (`{name, data}`, as `iconPackFromIconify`
66
+ * returns it, as a JSON string), replacing one of that name; returns
67
+ * its number of icons. An invalid pack throws and changes nothing.
68
+ * @param {string} pack
69
+ * @returns {number}
70
+ */
71
+ registerIconPack(pack) {
72
+ const ret = wasm.renderer_registerIconPack(this.__wbg_ptr, pack);
73
+ if (ret[2]) {
74
+ throw takeFromExternrefTable0(ret[1]);
75
+ }
76
+ return ret[0] >>> 0;
77
+ }
78
+ /**
79
+ * Registers an Iconify JSON icon set (text) under `name` without the
80
+ * resolved pack crossing to JavaScript; returns its number of icons.
81
+ * @param {string} name
82
+ * @param {string} iconify_json
83
+ * @returns {number}
84
+ */
85
+ registerIconifyPack(name, iconify_json) {
86
+ const ret = wasm.renderer_registerIconifyPack(this.__wbg_ptr, name, iconify_json);
87
+ if (ret[2]) {
88
+ throw takeFromExternrefTable0(ret[1]);
89
+ }
90
+ return ret[0] >>> 0;
91
+ }
92
+ /**
93
+ * Unregisters the pack named `name`; whether there was one.
94
+ * @param {string} name
95
+ * @returns {boolean}
96
+ */
97
+ removeIconPack(name) {
98
+ const ret = wasm.renderer_removeIconPack(this.__wbg_ptr, name);
99
+ if (ret[2]) {
100
+ throw takeFromExternrefTable0(ret[1]);
101
+ }
102
+ return ret[0] !== 0;
103
+ }
104
+ /**
105
+ * Renders Mermaid `source` to SVG: `options` as for the free `render`,
106
+ * without `iconPacks` (they throw: register packs once instead).
107
+ * @param {string} source
108
+ * @param {string} [options]
109
+ * @returns {string}
110
+ */
111
+ render(source, options) {
112
+ let deferred2_0;
113
+ let deferred2_1;
114
+ try {
115
+ const ret = wasm.renderer_render(this.__wbg_ptr, source, options);
116
+ var ptr1 = ret[0];
117
+ var len1 = ret[1];
118
+ if (ret[3]) {
119
+ ptr1 = 0; len1 = 0;
120
+ throw takeFromExternrefTable0(ret[2]);
121
+ }
122
+ deferred2_0 = ptr1;
123
+ deferred2_1 = len1;
124
+ return getStringFromWasm0(ptr1, len1);
125
+ } finally {
126
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
127
+ }
128
+ }
129
+ /**
130
+ * Sets the caches' byte budget (a whole number; 0 keeps nothing;
131
+ * 16 MiB by default) and empties them; anything else throws.
132
+ * @param {number} bytes
133
+ */
134
+ setCacheBudget(bytes) {
135
+ const ret = wasm.renderer_setCacheBudget(this.__wbg_ptr, bytes);
136
+ if (ret[1]) {
137
+ throw takeFromExternrefTable0(ret[0]);
138
+ }
139
+ }
140
+ /**
141
+ * Replaces the renderer's fonts (as the free `setFonts`); returns the
142
+ * number of faces. Empties the caches and keeps the icon packs.
143
+ * Invalid data throws and keeps the previous set.
144
+ * @param {Uint8Array[]} files
145
+ * @returns {number}
146
+ */
147
+ setFonts(files) {
148
+ const ret = wasm.renderer_setFonts(this.__wbg_ptr, files);
149
+ if (ret[2]) {
150
+ throw takeFromExternrefTable0(ret[1]);
151
+ }
152
+ return ret[0] >>> 0;
153
+ }
154
+ }
155
+ if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
156
+
157
+ /**
158
+ * The diagram type (`{keyword, family}`) or `null`; a source that is not a
159
+ * string (or longer than [`api::MAX_TEXT_BYTES`]) throws.
160
+ * @param {string} source
161
+ * @returns {any}
162
+ */
163
+ export function detect(source) {
164
+ const ret = wasm.detect(source);
165
+ if (ret[2]) {
166
+ throw takeFromExternrefTable0(ret[1]);
167
+ }
168
+ return takeFromExternrefTable0(ret[0]);
169
+ }
170
+
171
+ /**
172
+ * An Iconify JSON icon set (text) as a resolved pack for `iconPacks` (or
173
+ * `Renderer.registerIconPack`, stringified).
174
+ * @param {string} name
175
+ * @param {string} iconify_json
176
+ * @returns {any}
177
+ */
178
+ export function iconPackFromIconify(name, iconify_json) {
179
+ const ret = wasm.iconPackFromIconify(name, iconify_json);
180
+ if (ret[2]) {
181
+ throw takeFromExternrefTable0(ret[1]);
182
+ }
183
+ return takeFromExternrefTable0(ret[0]);
184
+ }
185
+
186
+ /**
187
+ * Renders Mermaid `source` to SVG in a fresh engine session with the
188
+ * instance's fonts. `options` is a JSON object (`id`, `config`,
189
+ * `background`, `width`, `nowUnixMs`, `embedFonts`, `iconPacks`) as a
190
+ * string, empty or absent; without `nowUnixMs` the host clock
191
+ * (`Date.now()`) is used.
192
+ * @param {string} source
193
+ * @param {string} [options]
194
+ * @returns {string}
195
+ */
196
+ export function render(source, options) {
197
+ let deferred2_0;
198
+ let deferred2_1;
199
+ try {
200
+ const ret = wasm.render(source, options);
201
+ var ptr1 = ret[0];
202
+ var len1 = ret[1];
203
+ if (ret[3]) {
204
+ ptr1 = 0; len1 = 0;
205
+ throw takeFromExternrefTable0(ret[2]);
206
+ }
207
+ deferred2_0 = ptr1;
208
+ deferred2_1 = len1;
209
+ return getStringFromWasm0(ptr1, len1);
210
+ } finally {
211
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
212
+ }
213
+ }
214
+
215
+ /**
216
+ * Replaces the instance's fonts for the free [`render`] with these font
217
+ * files (TrueType/OpenType bytes, in fallback order); returns the number of
218
+ * faces. Invalid data throws and keeps the previous set.
219
+ * @param {Uint8Array[]} files
220
+ * @returns {number}
221
+ */
222
+ export function setFonts(files) {
223
+ const ret = wasm.setFonts(files);
224
+ if (ret[2]) {
225
+ throw takeFromExternrefTable0(ret[1]);
226
+ }
227
+ return ret[0] >>> 0;
228
+ }
229
+
230
+ /**
231
+ * Runs when the module is instantiated.
232
+ */
233
+ export function start() {
234
+ wasm.start();
235
+ }
236
+
237
+ /**
238
+ * `{zonks, mermaidSyntax, bundledFonts, noto}`.
239
+ * @returns {any}
240
+ */
241
+ export function version() {
242
+ const ret = wasm.version();
243
+ return ret;
244
+ }
245
+ function __wbg_get_imports() {
246
+ const import0 = {
247
+ __proto__: null,
248
+ __wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
249
+ const ret = debugString(arg1);
250
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
251
+ const len1 = WASM_VECTOR_LEN;
252
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
253
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
254
+ },
255
+ __wbg___wbindgen_is_function_741ff2bb612836f5: function(arg0) {
256
+ const ret = typeof(arg0) === 'function';
257
+ return ret;
258
+ },
259
+ __wbg___wbindgen_is_string_fc456fee5d3317de: function(arg0) {
260
+ const ret = typeof(arg0) === 'string';
261
+ return ret;
262
+ },
263
+ __wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
264
+ const ret = arg0 === undefined;
265
+ return ret;
266
+ },
267
+ __wbg___wbindgen_number_get_934b640d0889af78: function(arg0, arg1) {
268
+ const obj = arg1;
269
+ const ret = typeof(obj) === 'number' ? obj : undefined;
270
+ getDataViewMemory0().setFloat64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
271
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
272
+ },
273
+ __wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
274
+ const obj = arg1;
275
+ const ret = typeof(obj) === 'string' ? obj : undefined;
276
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
277
+ var len1 = WASM_VECTOR_LEN;
278
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
279
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
280
+ },
281
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
282
+ throw new Error(getStringFromWasm0(arg0, arg1));
283
+ },
284
+ __wbg_apply_e2c1e00e05fc7519: function() { return handleError(function (arg0, arg1, arg2) {
285
+ const ret = Reflect.apply(arg0, arg1, arg2);
286
+ return ret;
287
+ }, arguments); },
288
+ __wbg_error_472ac873c3bc282c: function(arg0, arg1) {
289
+ console.error(getStringFromWasm0(arg0, arg1));
290
+ },
291
+ __wbg_getOwnPropertyDescriptor_bde8c48ab22edbff: function() { return handleError(function (arg0, arg1) {
292
+ const ret = Reflect.getOwnPropertyDescriptor(arg0, arg1);
293
+ return ret;
294
+ }, arguments); },
295
+ __wbg_getPrototypeOf_8fbf04523e13de29: function() { return handleError(function (arg0) {
296
+ const ret = Reflect.getPrototypeOf(arg0);
297
+ return ret;
298
+ }, arguments); },
299
+ __wbg_get_2080c49015e35254: function() { return handleError(function (arg0, arg1) {
300
+ const ret = Reflect.get(arg0, arg1);
301
+ return ret;
302
+ }, arguments); },
303
+ __wbg_get_bb8b6b35041e00c9: function() { return handleError(function (arg0, arg1) {
304
+ const ret = Reflect.get(arg0, arg1 >>> 0);
305
+ return ret;
306
+ }, arguments); },
307
+ __wbg_isArray_efe739964826b496: function() { return handleError(function (arg0) {
308
+ const ret = Array.isArray(arg0);
309
+ return ret;
310
+ }, arguments); },
311
+ __wbg_length_186163212ffe79c3: function(arg0) {
312
+ const ret = arg0.length;
313
+ return ret;
314
+ },
315
+ __wbg_length_e83e819f48c774e4: function(arg0) {
316
+ const ret = arg0.length;
317
+ return ret;
318
+ },
319
+ __wbg_new_37eb45aaf5eeb820: function() {
320
+ const ret = new Array();
321
+ return ret;
322
+ },
323
+ __wbg_new_4783550ccb846e03: function() { return handleError(function (arg0) {
324
+ const ret = new Uint8Array(arg0);
325
+ return ret;
326
+ }, arguments); },
327
+ __wbg_new_787b9fb330d55d78: function(arg0, arg1) {
328
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
329
+ return ret;
330
+ },
331
+ __wbg_new_with_length_01b143a7e5dd5a3e: function(arg0) {
332
+ const ret = new Uint8Array(arg0 >>> 0);
333
+ return ret;
334
+ },
335
+ __wbg_now_463ac581d2fc7ea3: function() {
336
+ const ret = Date.now();
337
+ return ret;
338
+ },
339
+ __wbg_parse_c3f72b5a24f83c01: function() { return handleError(function (arg0, arg1) {
340
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
341
+ return ret;
342
+ }, arguments); },
343
+ __wbg_prototypesetcall_13162965d1fe7aa3: function(arg0, arg1, arg2) {
344
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
345
+ },
346
+ __wbg_set_2793479888329cb6: function() { return handleError(function (arg0, arg1, arg2) {
347
+ const ret = Reflect.set(arg0, arg1, arg2);
348
+ return ret;
349
+ }, arguments); },
350
+ __wbg_set_name_822e3903f3184979: function(arg0, arg1, arg2) {
351
+ arg0.name = getStringFromWasm0(arg1, arg2);
352
+ },
353
+ __wbg_toStringTag_1bdd39ac5d866229: function() {
354
+ const ret = Symbol.toStringTag;
355
+ return ret;
356
+ },
357
+ __wbindgen_generic_0000000000000001: function(arg0, arg1) {
358
+ // Cast intrinsic for `Ref(String) -> Externref`.
359
+ const ret = getStringFromWasm0(arg0, arg1);
360
+ return ret;
361
+ },
362
+ __wbindgen_init_externref_table: function() {
363
+ const table = wasm.__wbindgen_externrefs;
364
+ table.set(0, undefined);
365
+ table.set(1024, undefined);
366
+ table.set(1025, null);
367
+ table.set(1026, true);
368
+ table.set(1027, false);
369
+ },
370
+ };
371
+ return {
372
+ __proto__: null,
373
+ "./zonks_wasm_bg.js": import0,
374
+ };
375
+ }
376
+
377
+ const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
378
+ ? { register: () => {}, unregister: () => {} }
379
+ : new FinalizationRegistry(ptr => wasm.__wbg_renderer_free(ptr, 1));
380
+
381
+ function addToExternrefTable0(obj) {
382
+ const idx = wasm.__externref_table_alloc();
383
+ wasm.__wbindgen_externrefs.set(idx, obj);
384
+ return idx;
385
+ }
386
+
387
+ function debugString(val) {
388
+ switch (typeof val) {
389
+ // primitive types
390
+ case 'number':
391
+ case 'boolean':
392
+ case 'undefined':
393
+ return `${val}`;
394
+ case 'string':
395
+ return JSON.stringify(val);
396
+ case 'bigint':
397
+ return `${val}n`;
398
+ case 'symbol':
399
+ return val.description !== undefined
400
+ ? `Symbol(${val.description})`
401
+ : 'Symbol';
402
+ case 'function':
403
+ return typeof val.name === 'string' && val.name !== ''
404
+ ? `Function(${val.name})`
405
+ : 'Function';
406
+ case 'object': {
407
+ if (val === null) {
408
+ return 'null';
409
+ }
410
+ // objects
411
+ if (Array.isArray(val)) {
412
+ return '[' + Array.from(val, debugString).join(', ') + ']';
413
+ }
414
+ // errors
415
+ if (val instanceof Error) {
416
+ return `${val.name}: ${val.message}\n${val.stack}`;
417
+ }
418
+
419
+ const toStringOutput = toString.call(val);
420
+ // Test for built-in
421
+ const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
422
+
423
+ // Failed to match the standard '[object ClassName]'
424
+ if (className === undefined) {
425
+ return toStringOutput;
426
+ }
427
+ if (className === 'Object') {
428
+ // we're a user defined class or Object
429
+ // JSON.stringify avoids problems with cycles, and is generally much
430
+ // easier than looping through ownProperties of `val`.
431
+ try {
432
+ return 'Object(' + JSON.stringify(val) + ')';
433
+ } catch (_) {
434
+ return 'Object';
435
+ }
436
+ }
437
+ // TODO we could test for more things here, like `Set`s and `Map`s.
438
+ return className;
439
+ }
440
+ // Per MDN: 'This list of values is exhaustive.'
441
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
442
+ }
443
+ }
444
+
445
+ function getArrayU8FromWasm0(ptr, len) {
446
+ ptr = ptr >>> 0;
447
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
448
+ }
449
+
450
+ let cachedDataViewMemory0 = null;
451
+ function getDataViewMemory0() {
452
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
453
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
454
+ }
455
+ return cachedDataViewMemory0;
456
+ }
457
+
458
+ function getStringFromWasm0(ptr, len) {
459
+ ptr = ptr >>> 0;
460
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
461
+ }
462
+
463
+ let cachedUint8ArrayMemory0 = null;
464
+ function getUint8ArrayMemory0() {
465
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
466
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
467
+ }
468
+ return cachedUint8ArrayMemory0;
469
+ }
470
+
471
+ function handleError(f, args) {
472
+ try {
473
+ return f.apply(this, args);
474
+ } catch (e) {
475
+ const idx = addToExternrefTable0(e);
476
+ wasm.__wbindgen_exn_store(idx);
477
+ }
478
+ }
479
+
480
+ function isLikeNone(x) {
481
+ return x === undefined || x === null;
482
+ }
483
+
484
+ function passStringToWasm0(arg, malloc, realloc) {
485
+ if (realloc === undefined) {
486
+ const buf = cachedTextEncoder.encode(arg);
487
+ const ptr = malloc(buf.length, 1) >>> 0;
488
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
489
+ WASM_VECTOR_LEN = buf.length;
490
+ return ptr;
491
+ }
492
+
493
+ let len = arg.length;
494
+ let ptr = malloc(len, 1) >>> 0;
495
+
496
+ const mem = getUint8ArrayMemory0();
497
+
498
+ let offset = 0;
499
+
500
+ for (; offset < len; offset++) {
501
+ const code = arg.charCodeAt(offset);
502
+ if (code > 0x7F) break;
503
+ mem[ptr + offset] = code;
504
+ }
505
+ if (offset !== len) {
506
+ if (offset !== 0) {
507
+ arg = arg.slice(offset);
508
+ }
509
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
510
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
511
+ const ret = cachedTextEncoder.encodeInto(arg, view);
512
+
513
+ offset += ret.written;
514
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
515
+ }
516
+
517
+ WASM_VECTOR_LEN = offset;
518
+ return ptr;
519
+ }
520
+
521
+ function takeFromExternrefTable0(idx) {
522
+ const value = wasm.__wbindgen_externrefs.get(idx);
523
+ wasm.__externref_table_dealloc(idx);
524
+ return value;
525
+ }
526
+
527
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
528
+ cachedTextDecoder.decode();
529
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
530
+ let numBytesDecoded = 0;
531
+ function decodeText(bytes) {
532
+ numBytesDecoded += bytes.length;
533
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
534
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
535
+ cachedTextDecoder.decode();
536
+ numBytesDecoded = bytes.length;
537
+ }
538
+ return cachedTextDecoder.decode(bytes);
539
+ }
540
+
541
+ const cachedTextEncoder = new TextEncoder();
542
+
543
+ if (!('encodeInto' in cachedTextEncoder)) {
544
+ cachedTextEncoder.encodeInto = function (arg, view) {
545
+ const buf = cachedTextEncoder.encode(arg);
546
+ view.set(buf);
547
+ return {
548
+ read: arg.length,
549
+ written: buf.length
550
+ };
551
+ };
552
+ }
553
+
554
+ let WASM_VECTOR_LEN = 0;
555
+
556
+ let wasmModule, wasmInstance, wasm;
557
+ function __wbg_finalize_init(instance, module) {
558
+ wasmInstance = instance;
559
+ wasm = instance.exports;
560
+ wasmModule = module;
561
+ cachedDataViewMemory0 = null;
562
+ cachedUint8ArrayMemory0 = null;
563
+ wasm.__wbindgen_start();
564
+ return wasm;
565
+ }
566
+
567
+ async function __wbg_load(module, imports) {
568
+ if (typeof Response === 'function' && module instanceof Response) {
569
+ if (!module.ok) {
570
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
571
+ }
572
+
573
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
574
+ try {
575
+ return await WebAssembly.instantiateStreaming(module, imports);
576
+ } catch (e) {
577
+ const validResponse = expectedResponseType(module.type);
578
+
579
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
580
+ 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);
581
+
582
+ } else { throw e; }
583
+ }
584
+ }
585
+
586
+ const bytes = await module.arrayBuffer();
587
+ return await WebAssembly.instantiate(bytes, imports);
588
+ } else {
589
+ const instance = await WebAssembly.instantiate(module, imports);
590
+
591
+ if (instance instanceof WebAssembly.Instance) {
592
+ return { instance, module };
593
+ } else {
594
+ return instance;
595
+ }
596
+ }
597
+
598
+ function expectedResponseType(type) {
599
+ switch (type) {
600
+ case 'basic': case 'cors': case 'default': return true;
601
+ }
602
+ return false;
603
+ }
604
+ }
605
+
606
+ function initSync(module) {
607
+ if (wasm !== undefined) return wasm;
608
+
609
+
610
+ if (module !== undefined) {
611
+ if (Object.getPrototypeOf(module) === Object.prototype) {
612
+ ({module} = module)
613
+ } else {
614
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
615
+ }
616
+ }
617
+
618
+ const imports = __wbg_get_imports();
619
+ if (!(module instanceof WebAssembly.Module)) {
620
+ module = new WebAssembly.Module(module);
621
+ }
622
+ const instance = new WebAssembly.Instance(module, imports);
623
+ return __wbg_finalize_init(instance, module);
624
+ }
625
+
626
+ let __wbg_init_promise;
627
+ async function __wbg_init(module_or_path) {
628
+ if (wasm !== undefined) return wasm;
629
+ if (__wbg_init_promise === undefined) {
630
+ __wbg_init_promise = __wbg_init_once(module_or_path);
631
+ __wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
632
+ }
633
+ return __wbg_init_promise;
634
+ }
635
+
636
+ async function __wbg_init_once(module_or_path) {
637
+
638
+ if (module_or_path !== undefined) {
639
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
640
+ ({module_or_path} = module_or_path)
641
+ } else {
642
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
643
+ }
644
+ }
645
+
646
+ if (module_or_path === undefined) {
647
+ module_or_path = new URL('zonks_wasm_bg.wasm', import.meta.url);
648
+ }
649
+ const imports = __wbg_get_imports();
650
+
651
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
652
+ module_or_path = fetch(module_or_path);
653
+ }
654
+
655
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
656
+
657
+ return __wbg_finalize_init(instance, module);
658
+ }
659
+
660
+ export { initSync, __wbg_init as default };
Binary file
@@ -0,0 +1,29 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const __wbg_renderer_free: (a: number, b: number) => void;
5
+ export const detect: (a: any) => [number, number, number];
6
+ export const iconPackFromIconify: (a: any, b: any) => [number, number, number];
7
+ export const render: (a: any, b: any) => [number, number, number, number];
8
+ export const renderer_cacheBytes: (a: number) => number;
9
+ export const renderer_clearCaches: (a: number) => void;
10
+ export const renderer_clearIconPacks: (a: number) => void;
11
+ export const renderer_lastRenderWork: (a: number) => number;
12
+ export const renderer_new: () => number;
13
+ export const renderer_registerIconPack: (a: number, b: any) => [number, number, number];
14
+ export const renderer_registerIconifyPack: (a: number, b: any, c: any) => [number, number, number];
15
+ export const renderer_removeIconPack: (a: number, b: any) => [number, number, number];
16
+ export const renderer_render: (a: number, b: any, c: any) => [number, number, number, number];
17
+ export const renderer_setCacheBudget: (a: number, b: any) => [number, number];
18
+ export const renderer_setFonts: (a: number, b: any) => [number, number, number];
19
+ export const setFonts: (a: any) => [number, number, number];
20
+ export const start: () => void;
21
+ export const version: () => any;
22
+ export const __wbindgen_malloc: (a: number, b: number) => number;
23
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
24
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
25
+ export const __wbindgen_exn_store: (a: number) => void;
26
+ export const __externref_table_alloc: () => number;
27
+ export const __wbindgen_externrefs: WebAssembly.Table;
28
+ export const __externref_table_dealloc: (a: number) => void;
29
+ export const __wbindgen_start: () => void;