@open-artifact/wasm-canvas 0.0.0-stage → 0.2.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.
@@ -0,0 +1,910 @@
1
+ // Generated by scripts/build-wasm.mjs from crates/open-artifact-canvas. Do not edit.
2
+ export class CanvasCore {
3
+ __destroy_into_raw() {
4
+ const ptr = this.__wbg_ptr;
5
+ this.__wbg_ptr = 0;
6
+ CanvasCoreFinalization.unregister(this);
7
+ return ptr;
8
+ }
9
+ free() {
10
+ const ptr = this.__destroy_into_raw();
11
+ wasm.__wbg_canvascore_free(ptr, 0);
12
+ }
13
+ /**
14
+ * Applies a patch: REC f64s per record plus the path command stream.
15
+ * @param {Float64Array} ops
16
+ * @param {Float32Array} paths
17
+ */
18
+ apply(ops, paths) {
19
+ const ptr0 = passArrayF64ToWasm0(ops, wasm.__wbindgen_malloc);
20
+ const len0 = WASM_VECTOR_LEN;
21
+ const ptr1 = passArrayF32ToWasm0(paths, wasm.__wbindgen_malloc);
22
+ const len1 = WASM_VECTOR_LEN;
23
+ wasm.canvascore_apply(this.__wbg_ptr, ptr0, len0, ptr1, len1);
24
+ }
25
+ /**
26
+ * [x, y, zoom, width, height, dpr, minZoom, maxZoom, moving]
27
+ * @returns {Float64Array}
28
+ */
29
+ camera() {
30
+ const ret = wasm.canvascore_camera(this.__wbg_ptr);
31
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
32
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
33
+ return v1;
34
+ }
35
+ cancel_gesture() {
36
+ wasm.canvascore_cancel_gesture(this.__wbg_ptr);
37
+ }
38
+ context_lost() {
39
+ wasm.canvascore_context_lost(this.__wbg_ptr);
40
+ }
41
+ /**
42
+ * @param {WebGL2RenderingContext} gl
43
+ */
44
+ context_restored(gl) {
45
+ const ret = wasm.canvascore_context_restored(this.__wbg_ptr, gl);
46
+ if (ret[1]) {
47
+ throw takeFromExternrefTable0(ret[0]);
48
+ }
49
+ }
50
+ /**
51
+ * @returns {number}
52
+ */
53
+ cursor() {
54
+ const ret = wasm.canvascore_cursor(this.__wbg_ptr);
55
+ return ret >>> 0;
56
+ }
57
+ /**
58
+ * Advances and draws one frame. Returns FRAME_* bits (1 drew, 2 wants another, 4 holes changed).
59
+ * @param {number} now
60
+ * @returns {number}
61
+ */
62
+ frame(now) {
63
+ const ret = wasm.canvascore_frame(this.__wbg_ptr, now);
64
+ return ret >>> 0;
65
+ }
66
+ /**
67
+ * @param {number} x
68
+ * @param {number} y
69
+ * @param {number} w
70
+ * @param {number} h
71
+ * @param {number} duration
72
+ * @param {number} padding
73
+ * @param {number} max_zoom
74
+ */
75
+ glide_to(x, y, w, h, duration, padding, max_zoom) {
76
+ wasm.canvascore_glide_to(this.__wbg_ptr, x, y, w, h, duration, padding, max_zoom);
77
+ }
78
+ /**
79
+ * @returns {boolean}
80
+ */
81
+ has_events() {
82
+ const ret = wasm.canvascore_has_events(this.__wbg_ptr);
83
+ return ret !== 0;
84
+ }
85
+ /**
86
+ * The resize handle at a screen point: [item, handle edges (1 left, 2 right, 4 top, 8 bottom)], or empty.
87
+ * @param {number} x
88
+ * @param {number} y
89
+ * @returns {Uint32Array}
90
+ */
91
+ hit_handle(x, y) {
92
+ const ret = wasm.canvascore_hit_handle(this.__wbg_ptr, x, y);
93
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
94
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
95
+ return v1;
96
+ }
97
+ /**
98
+ * Topmost hittable item at a screen point, or -1.
99
+ * @param {number} x
100
+ * @param {number} y
101
+ * @returns {number}
102
+ */
103
+ hit_test(x, y) {
104
+ const ret = wasm.canvascore_hit_test(this.__wbg_ptr, x, y);
105
+ return ret;
106
+ }
107
+ /**
108
+ * Visible holes: [handle, x, y, w, h, rotation, zoom] each, in CSS pixels.
109
+ * @returns {Float32Array}
110
+ */
111
+ holes() {
112
+ const ret = wasm.canvascore_holes(this.__wbg_ptr);
113
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
114
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
115
+ return v1;
116
+ }
117
+ /**
118
+ * [x, y, w, h, rotation] of an item as the engine has it now, or empty.
119
+ * @param {number} id
120
+ * @returns {Float64Array}
121
+ */
122
+ item_rect(id) {
123
+ const ret = wasm.canvascore_item_rect(this.__wbg_ptr, id);
124
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
125
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
126
+ return v1;
127
+ }
128
+ /**
129
+ * @param {number} code
130
+ * @param {boolean} down
131
+ * @param {number} mods
132
+ * @returns {boolean}
133
+ */
134
+ key(code, down, mods) {
135
+ const ret = wasm.canvascore_key(this.__wbg_ptr, code, down, mods);
136
+ return ret !== 0;
137
+ }
138
+ /**
139
+ * Largest texture side the atlas accepts (sources above it must be scaled down).
140
+ * @returns {number}
141
+ */
142
+ max_texture_side() {
143
+ const ret = wasm.canvascore_max_texture_side(this.__wbg_ptr);
144
+ return ret >>> 0;
145
+ }
146
+ /**
147
+ * `gl` None runs headless: everything but drawing (for tests and tools).
148
+ * @param {WebGL2RenderingContext | null | undefined} gl
149
+ * @param {number} width
150
+ * @param {number} height
151
+ * @param {number} dpr
152
+ */
153
+ constructor(gl, width, height, dpr) {
154
+ const ret = wasm.canvascore_new(isLikeNone(gl) ? 0 : addToExternrefTable0(gl), width, height, dpr);
155
+ if (ret[2]) {
156
+ throw takeFromExternrefTable0(ret[1]);
157
+ }
158
+ this.__wbg_ptr = ret[0] >>> 0;
159
+ CanvasCoreFinalization.register(this, this.__wbg_ptr, this);
160
+ return this;
161
+ }
162
+ /**
163
+ * @param {number} dx
164
+ * @param {number} dy
165
+ */
166
+ pan_by(dx, dy) {
167
+ wasm.canvascore_pan_by(this.__wbg_ptr, dx, dy);
168
+ }
169
+ /**
170
+ * @param {number} pid
171
+ */
172
+ pointer_cancel(pid) {
173
+ wasm.canvascore_pointer_cancel(this.__wbg_ptr, pid);
174
+ }
175
+ /**
176
+ * @param {number} pid
177
+ * @param {number} x
178
+ * @param {number} y
179
+ * @param {number} button
180
+ * @param {number} mods
181
+ * @param {number} ptype
182
+ * @returns {boolean}
183
+ */
184
+ pointer_down(pid, x, y, button, mods, ptype) {
185
+ const ret = wasm.canvascore_pointer_down(this.__wbg_ptr, pid, x, y, button, mods, ptype);
186
+ return ret !== 0;
187
+ }
188
+ /**
189
+ * A double click (`kind` 0) or context menu (1) at a screen point: reported as an event with the item under it.
190
+ * @param {number} kind
191
+ * @param {number} x
192
+ * @param {number} y
193
+ * @param {number} mods
194
+ */
195
+ pointer_event(kind, x, y, mods) {
196
+ wasm.canvascore_pointer_event(this.__wbg_ptr, kind, x, y, mods);
197
+ }
198
+ pointer_leave() {
199
+ wasm.canvascore_pointer_leave(this.__wbg_ptr);
200
+ }
201
+ /**
202
+ * @param {number} pid
203
+ * @param {number} x
204
+ * @param {number} y
205
+ * @param {number} buttons
206
+ * @param {number} mods
207
+ * @returns {boolean}
208
+ */
209
+ pointer_move(pid, x, y, buttons, mods) {
210
+ const ret = wasm.canvascore_pointer_move(this.__wbg_ptr, pid, x, y, buttons, mods);
211
+ return ret !== 0;
212
+ }
213
+ /**
214
+ * @param {number} pid
215
+ * @param {number} x
216
+ * @param {number} y
217
+ * @param {number} button
218
+ * @param {number} mods
219
+ * @returns {boolean}
220
+ */
221
+ pointer_up(pid, x, y, button, mods) {
222
+ const ret = wasm.canvascore_pointer_up(this.__wbg_ptr, pid, x, y, button, mods);
223
+ return ret !== 0;
224
+ }
225
+ /**
226
+ * Items whose bounds meet a world rect.
227
+ * @param {number} x
228
+ * @param {number} y
229
+ * @param {number} w
230
+ * @param {number} h
231
+ * @returns {Uint32Array}
232
+ */
233
+ query_rect(x, y, w, h) {
234
+ const ret = wasm.canvascore_query_rect(this.__wbg_ptr, x, y, w, h);
235
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
236
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
237
+ return v1;
238
+ }
239
+ /**
240
+ * @param {number} key
241
+ */
242
+ remove_texture(key) {
243
+ wasm.canvascore_remove_texture(this.__wbg_ptr, key);
244
+ }
245
+ /**
246
+ * @param {number} width
247
+ * @param {number} height
248
+ * @param {number} dpr
249
+ */
250
+ resize(width, height, dpr) {
251
+ wasm.canvascore_resize(this.__wbg_ptr, width, height, dpr);
252
+ }
253
+ /**
254
+ * @returns {Uint32Array}
255
+ */
256
+ selection() {
257
+ const ret = wasm.canvascore_selection(this.__wbg_ptr);
258
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
259
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
260
+ return v1;
261
+ }
262
+ /**
263
+ * @param {number} x
264
+ * @param {number} y
265
+ * @param {number} zoom
266
+ */
267
+ set_camera(x, y, zoom) {
268
+ wasm.canvascore_set_camera(this.__wbg_ptr, x, y, zoom);
269
+ }
270
+ /**
271
+ * @param {number} key
272
+ * @param {number} value
273
+ */
274
+ set_option(key, value) {
275
+ wasm.canvascore_set_option(this.__wbg_ptr, key, value);
276
+ }
277
+ /**
278
+ * Peers: [color, hasCursor, x, y, n, ...n ids] per peer.
279
+ * @param {Float64Array} data
280
+ */
281
+ set_peers(data) {
282
+ const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
283
+ const len0 = WASM_VECTOR_LEN;
284
+ wasm.canvascore_set_peers(this.__wbg_ptr, ptr0, len0);
285
+ }
286
+ /**
287
+ * @param {Uint32Array} ids
288
+ */
289
+ set_selection(ids) {
290
+ const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_malloc);
291
+ const len0 = WASM_VECTOR_LEN;
292
+ wasm.canvascore_set_selection(this.__wbg_ptr, ptr0, len0);
293
+ }
294
+ /**
295
+ * Stores texture `key`: one source per (w, h) pair in `sizes`. Returns a bit per
296
+ * resolution that found room in the atlas.
297
+ * @param {number} key
298
+ * @param {Array<any>} sources
299
+ * @param {Uint32Array} sizes
300
+ * @returns {number}
301
+ */
302
+ set_texture(key, sources, sizes) {
303
+ const ptr0 = passArray32ToWasm0(sizes, wasm.__wbindgen_malloc);
304
+ const len0 = WASM_VECTOR_LEN;
305
+ const ret = wasm.canvascore_set_texture(this.__wbg_ptr, key, sources, ptr0, len0);
306
+ if (ret[2]) {
307
+ throw takeFromExternrefTable0(ret[1]);
308
+ }
309
+ return ret[0] >>> 0;
310
+ }
311
+ /**
312
+ * @param {number} tool
313
+ */
314
+ set_tool(tool) {
315
+ wasm.canvascore_set_tool(this.__wbg_ptr, tool);
316
+ }
317
+ /**
318
+ * Starts moving item `id` from a press the host received; pointer `pid` drives it from here.
319
+ * @param {number} pid
320
+ * @param {number} x
321
+ * @param {number} y
322
+ * @param {number} id
323
+ * @param {number} mods
324
+ * @returns {boolean}
325
+ */
326
+ start_move(pid, x, y, id, mods) {
327
+ const ret = wasm.canvascore_start_move(this.__wbg_ptr, pid, x, y, id, mods);
328
+ return ret !== 0;
329
+ }
330
+ /**
331
+ * [items, visible, drawCalls, textures, textureBytes, atlasLayers, quads, pathVertices, pathIndices, batches, holesVisible, maxAtlasLayers]
332
+ * @returns {Float64Array}
333
+ */
334
+ stats() {
335
+ const ret = wasm.canvascore_stats(this.__wbg_ptr);
336
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
337
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
338
+ return v1;
339
+ }
340
+ /**
341
+ * Pending events as a JSON array (then cleared).
342
+ * @returns {string}
343
+ */
344
+ take_events() {
345
+ let deferred1_0;
346
+ let deferred1_1;
347
+ try {
348
+ const ret = wasm.canvascore_take_events(this.__wbg_ptr);
349
+ deferred1_0 = ret[0];
350
+ deferred1_1 = ret[1];
351
+ return getStringFromWasm0(ret[0], ret[1]);
352
+ } finally {
353
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
354
+ }
355
+ }
356
+ /**
357
+ * @returns {number}
358
+ */
359
+ tool() {
360
+ const ret = wasm.canvascore_tool(this.__wbg_ptr);
361
+ return ret >>> 0;
362
+ }
363
+ /**
364
+ * @param {number} x
365
+ * @param {number} y
366
+ * @param {number} dx
367
+ * @param {number} dy
368
+ * @param {number} mods
369
+ * @returns {boolean}
370
+ */
371
+ wheel(x, y, dx, dy, mods) {
372
+ const ret = wasm.canvascore_wheel(this.__wbg_ptr, x, y, dx, dy, mods);
373
+ return ret !== 0;
374
+ }
375
+ /**
376
+ * @param {number} factor
377
+ * @param {number} x
378
+ * @param {number} y
379
+ */
380
+ zoom_at(factor, x, y) {
381
+ wasm.canvascore_zoom_at(this.__wbg_ptr, factor, x, y);
382
+ }
383
+ }
384
+ if (Symbol.dispose) CanvasCore.prototype[Symbol.dispose] = CanvasCore.prototype.free;
385
+
386
+ function __wbg_get_imports() {
387
+ const import0 = {
388
+ __proto__: null,
389
+ __wbg___wbindgen_boolean_get_a86c216575a75c30: function(arg0) {
390
+ const v = arg0;
391
+ const ret = typeof(v) === 'boolean' ? v : undefined;
392
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
393
+ },
394
+ __wbg___wbindgen_number_get_7579aab02a8a620c: function(arg0, arg1) {
395
+ const obj = arg1;
396
+ const ret = typeof(obj) === 'number' ? obj : undefined;
397
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
398
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
399
+ },
400
+ __wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
401
+ throw new Error(getStringFromWasm0(arg0, arg1));
402
+ },
403
+ __wbg_activeTexture_55755e76627be758: function(arg0, arg1) {
404
+ arg0.activeTexture(arg1 >>> 0);
405
+ },
406
+ __wbg_attachShader_91626cdf6ee920b8: function(arg0, arg1, arg2) {
407
+ arg0.attachShader(arg1, arg2);
408
+ },
409
+ __wbg_bindBuffer_ec76634c95f563c2: function(arg0, arg1, arg2) {
410
+ arg0.bindBuffer(arg1 >>> 0, arg2);
411
+ },
412
+ __wbg_bindFramebuffer_c0a4ba2bb49f7c82: function(arg0, arg1, arg2) {
413
+ arg0.bindFramebuffer(arg1 >>> 0, arg2);
414
+ },
415
+ __wbg_bindTexture_3f1c468809dfc331: function(arg0, arg1, arg2) {
416
+ arg0.bindTexture(arg1 >>> 0, arg2);
417
+ },
418
+ __wbg_bindVertexArray_ef65b171588388e0: function(arg0, arg1) {
419
+ arg0.bindVertexArray(arg1);
420
+ },
421
+ __wbg_blendFuncSeparate_fb17a9951727aac3: function(arg0, arg1, arg2, arg3, arg4) {
422
+ arg0.blendFuncSeparate(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0, arg4 >>> 0);
423
+ },
424
+ __wbg_blendFunc_9ec46725800dafb1: function(arg0, arg1, arg2) {
425
+ arg0.blendFunc(arg1 >>> 0, arg2 >>> 0);
426
+ },
427
+ __wbg_blitFramebuffer_8a5340cdf51be775: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {
428
+ arg0.blitFramebuffer(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0);
429
+ },
430
+ __wbg_bufferData_1db58b556ccdf08f: function(arg0, arg1, arg2, arg3) {
431
+ arg0.bufferData(arg1 >>> 0, arg2, arg3 >>> 0);
432
+ },
433
+ __wbg_bufferSubData_b787d077f9ced5f8: function(arg0, arg1, arg2, arg3, arg4) {
434
+ arg0.bufferSubData(arg1 >>> 0, arg2, getArrayU8FromWasm0(arg3, arg4));
435
+ },
436
+ __wbg_clearColor_4c23ac0feeb06fb4: function(arg0, arg1, arg2, arg3, arg4) {
437
+ arg0.clearColor(arg1, arg2, arg3, arg4);
438
+ },
439
+ __wbg_clearDepth_c61614548cd3b4e0: function(arg0, arg1) {
440
+ arg0.clearDepth(arg1);
441
+ },
442
+ __wbg_clear_98a9ca84e00ae8e2: function(arg0, arg1) {
443
+ arg0.clear(arg1 >>> 0);
444
+ },
445
+ __wbg_colorMask_134144611b082d70: function(arg0, arg1, arg2, arg3, arg4) {
446
+ arg0.colorMask(arg1 !== 0, arg2 !== 0, arg3 !== 0, arg4 !== 0);
447
+ },
448
+ __wbg_compileShader_30b1185156c62e3a: function(arg0, arg1) {
449
+ arg0.compileShader(arg1);
450
+ },
451
+ __wbg_copyTexSubImage3D_ef5526f572f36d56: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
452
+ arg0.copyTexSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
453
+ },
454
+ __wbg_createBuffer_bdda716ebf68ba59: function(arg0) {
455
+ const ret = arg0.createBuffer();
456
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
457
+ },
458
+ __wbg_createFramebuffer_b2cc13b01b560d6f: function(arg0) {
459
+ const ret = arg0.createFramebuffer();
460
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
461
+ },
462
+ __wbg_createProgram_ba013605ddf3824a: function(arg0) {
463
+ const ret = arg0.createProgram();
464
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
465
+ },
466
+ __wbg_createShader_b2c5333fcc05114e: function(arg0, arg1) {
467
+ const ret = arg0.createShader(arg1 >>> 0);
468
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
469
+ },
470
+ __wbg_createTexture_ab0a6dde87005cb1: function(arg0) {
471
+ const ret = arg0.createTexture();
472
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
473
+ },
474
+ __wbg_createVertexArray_be0c22725872a475: function(arg0) {
475
+ const ret = arg0.createVertexArray();
476
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
477
+ },
478
+ __wbg_deleteShader_0784961238f3ba6f: function(arg0, arg1) {
479
+ arg0.deleteShader(arg1);
480
+ },
481
+ __wbg_deleteTexture_57bf3a76dc0a7bf9: function(arg0, arg1) {
482
+ arg0.deleteTexture(arg1);
483
+ },
484
+ __wbg_depthFunc_4025ae02b54073f8: function(arg0, arg1) {
485
+ arg0.depthFunc(arg1 >>> 0);
486
+ },
487
+ __wbg_depthMask_2e4372fcba47dc49: function(arg0, arg1) {
488
+ arg0.depthMask(arg1 !== 0);
489
+ },
490
+ __wbg_disable_5c6898ffc41889ea: function(arg0, arg1) {
491
+ arg0.disable(arg1 >>> 0);
492
+ },
493
+ __wbg_drawArraysInstanced_f8a4998461298b8d: function(arg0, arg1, arg2, arg3, arg4) {
494
+ arg0.drawArraysInstanced(arg1 >>> 0, arg2, arg3, arg4);
495
+ },
496
+ __wbg_drawArrays_079aad920afe1404: function(arg0, arg1, arg2, arg3) {
497
+ arg0.drawArrays(arg1 >>> 0, arg2, arg3);
498
+ },
499
+ __wbg_drawElements_f0da90b9c827e09d: function(arg0, arg1, arg2, arg3, arg4) {
500
+ arg0.drawElements(arg1 >>> 0, arg2, arg3 >>> 0, arg4);
501
+ },
502
+ __wbg_drawingBufferHeight_38f104517915b82d: function(arg0) {
503
+ const ret = arg0.drawingBufferHeight;
504
+ return ret;
505
+ },
506
+ __wbg_drawingBufferWidth_9c7859d79f93fa7b: function(arg0) {
507
+ const ret = arg0.drawingBufferWidth;
508
+ return ret;
509
+ },
510
+ __wbg_enableVertexAttribArray_b4abeab358174fdb: function(arg0, arg1) {
511
+ arg0.enableVertexAttribArray(arg1 >>> 0);
512
+ },
513
+ __wbg_enable_9328f475236428ef: function(arg0, arg1) {
514
+ arg0.enable(arg1 >>> 0);
515
+ },
516
+ __wbg_framebufferTextureLayer_e5625e06e97b63de: function(arg0, arg1, arg2, arg3, arg4, arg5) {
517
+ arg0.framebufferTextureLayer(arg1 >>> 0, arg2 >>> 0, arg3, arg4, arg5);
518
+ },
519
+ __wbg_getParameter_037149e897c929ad: function() { return handleError(function (arg0, arg1) {
520
+ const ret = arg0.getParameter(arg1 >>> 0);
521
+ return ret;
522
+ }, arguments); },
523
+ __wbg_getProgramInfoLog_b2d112da8cb8c5c5: function(arg0, arg1, arg2) {
524
+ const ret = arg1.getProgramInfoLog(arg2);
525
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
526
+ var len1 = WASM_VECTOR_LEN;
527
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
528
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
529
+ },
530
+ __wbg_getProgramParameter_2b7693f9edfde93d: function(arg0, arg1, arg2) {
531
+ const ret = arg0.getProgramParameter(arg1, arg2 >>> 0);
532
+ return ret;
533
+ },
534
+ __wbg_getShaderInfoLog_57aaac3110ec22f3: function(arg0, arg1, arg2) {
535
+ const ret = arg1.getShaderInfoLog(arg2);
536
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
537
+ var len1 = WASM_VECTOR_LEN;
538
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
539
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
540
+ },
541
+ __wbg_getShaderParameter_2b6f35d96d51cc82: function(arg0, arg1, arg2) {
542
+ const ret = arg0.getShaderParameter(arg1, arg2 >>> 0);
543
+ return ret;
544
+ },
545
+ __wbg_getUniformLocation_8d93a5f3de4232bf: function(arg0, arg1, arg2, arg3) {
546
+ const ret = arg0.getUniformLocation(arg1, getStringFromWasm0(arg2, arg3));
547
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
548
+ },
549
+ __wbg_get_4848e350b40afc16: function(arg0, arg1) {
550
+ const ret = arg0[arg1 >>> 0];
551
+ return ret;
552
+ },
553
+ __wbg_isContextLost_e9db4df1d5f69322: function(arg0) {
554
+ const ret = arg0.isContextLost();
555
+ return ret;
556
+ },
557
+ __wbg_linkProgram_d86c69f8f86f3031: function(arg0, arg1) {
558
+ arg0.linkProgram(arg1);
559
+ },
560
+ __wbg_pixelStorei_3dd51cd2a28442f6: function(arg0, arg1, arg2) {
561
+ arg0.pixelStorei(arg1 >>> 0, arg2);
562
+ },
563
+ __wbg_shaderSource_cae157a332281ae7: function(arg0, arg1, arg2, arg3) {
564
+ arg0.shaderSource(arg1, getStringFromWasm0(arg2, arg3));
565
+ },
566
+ __wbg_texImage2D_29ce63ed3c9e7fd2: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
567
+ arg0.texImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
568
+ }, arguments); },
569
+ __wbg_texParameteri_51f89620521fe4f5: function(arg0, arg1, arg2, arg3) {
570
+ arg0.texParameteri(arg1 >>> 0, arg2 >>> 0, arg3);
571
+ },
572
+ __wbg_texStorage3D_3b9a3f42a3546d1c: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
573
+ arg0.texStorage3D(arg1 >>> 0, arg2, arg3 >>> 0, arg4, arg5, arg6);
574
+ },
575
+ __wbg_texSubImage2D_efd0d5d4f44425c3: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
576
+ arg0.texSubImage2D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7 >>> 0, arg8 >>> 0, arg9);
577
+ }, arguments); },
578
+ __wbg_texSubImage3D_562eea462947b80c: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) {
579
+ arg0.texSubImage3D(arg1 >>> 0, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 >>> 0, arg10 >>> 0, arg11);
580
+ }, arguments); },
581
+ __wbg_uniform1f_fc8bddcb58797aec: function(arg0, arg1, arg2) {
582
+ arg0.uniform1f(arg1, arg2);
583
+ },
584
+ __wbg_uniform1i_acce06d190ce18d5: function(arg0, arg1, arg2) {
585
+ arg0.uniform1i(arg1, arg2);
586
+ },
587
+ __wbg_uniform2f_186549d813184ee8: function(arg0, arg1, arg2, arg3) {
588
+ arg0.uniform2f(arg1, arg2, arg3);
589
+ },
590
+ __wbg_uniform3f_51c0e038d1d16f4c: function(arg0, arg1, arg2, arg3, arg4) {
591
+ arg0.uniform3f(arg1, arg2, arg3, arg4);
592
+ },
593
+ __wbg_uniform4f_50286376821185ad: function(arg0, arg1, arg2, arg3, arg4, arg5) {
594
+ arg0.uniform4f(arg1, arg2, arg3, arg4, arg5);
595
+ },
596
+ __wbg_useProgram_f79c775d2e8824a9: function(arg0, arg1) {
597
+ arg0.useProgram(arg1);
598
+ },
599
+ __wbg_vertexAttribDivisor_01d7e6446210d446: function(arg0, arg1, arg2) {
600
+ arg0.vertexAttribDivisor(arg1 >>> 0, arg2 >>> 0);
601
+ },
602
+ __wbg_vertexAttribIPointer_9ea5ec1a58b61fcf: function(arg0, arg1, arg2, arg3, arg4, arg5) {
603
+ arg0.vertexAttribIPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4, arg5);
604
+ },
605
+ __wbg_vertexAttribPointer_7db76295987fda72: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
606
+ arg0.vertexAttribPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4 !== 0, arg5, arg6);
607
+ },
608
+ __wbg_viewport_de5bbf3f5c97bfcf: function(arg0, arg1, arg2, arg3, arg4) {
609
+ arg0.viewport(arg1, arg2, arg3, arg4);
610
+ },
611
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
612
+ // Cast intrinsic for `Ref(Slice(F32)) -> NamedExternref("Float32Array")`.
613
+ const ret = getArrayF32FromWasm0(arg0, arg1);
614
+ return ret;
615
+ },
616
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
617
+ // Cast intrinsic for `Ref(String) -> Externref`.
618
+ const ret = getStringFromWasm0(arg0, arg1);
619
+ return ret;
620
+ },
621
+ __wbindgen_init_externref_table: function() {
622
+ const table = wasm.__wbindgen_externrefs;
623
+ const offset = table.grow(4);
624
+ table.set(0, undefined);
625
+ table.set(offset + 0, undefined);
626
+ table.set(offset + 1, null);
627
+ table.set(offset + 2, true);
628
+ table.set(offset + 3, false);
629
+ },
630
+ };
631
+ return {
632
+ __proto__: null,
633
+ "./open_artifact_canvas_bg.js": import0,
634
+ };
635
+ }
636
+
637
+ const CanvasCoreFinalization = (typeof FinalizationRegistry === 'undefined')
638
+ ? { register: () => {}, unregister: () => {} }
639
+ : new FinalizationRegistry(ptr => wasm.__wbg_canvascore_free(ptr >>> 0, 1));
640
+
641
+ function addToExternrefTable0(obj) {
642
+ const idx = wasm.__externref_table_alloc();
643
+ wasm.__wbindgen_externrefs.set(idx, obj);
644
+ return idx;
645
+ }
646
+
647
+ function getArrayF32FromWasm0(ptr, len) {
648
+ ptr = ptr >>> 0;
649
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
650
+ }
651
+
652
+ function getArrayF64FromWasm0(ptr, len) {
653
+ ptr = ptr >>> 0;
654
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
655
+ }
656
+
657
+ function getArrayU32FromWasm0(ptr, len) {
658
+ ptr = ptr >>> 0;
659
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
660
+ }
661
+
662
+ function getArrayU8FromWasm0(ptr, len) {
663
+ ptr = ptr >>> 0;
664
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
665
+ }
666
+
667
+ let cachedDataViewMemory0 = null;
668
+ function getDataViewMemory0() {
669
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
670
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
671
+ }
672
+ return cachedDataViewMemory0;
673
+ }
674
+
675
+ let cachedFloat32ArrayMemory0 = null;
676
+ function getFloat32ArrayMemory0() {
677
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
678
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
679
+ }
680
+ return cachedFloat32ArrayMemory0;
681
+ }
682
+
683
+ let cachedFloat64ArrayMemory0 = null;
684
+ function getFloat64ArrayMemory0() {
685
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
686
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
687
+ }
688
+ return cachedFloat64ArrayMemory0;
689
+ }
690
+
691
+ function getStringFromWasm0(ptr, len) {
692
+ ptr = ptr >>> 0;
693
+ return decodeText(ptr, len);
694
+ }
695
+
696
+ let cachedUint32ArrayMemory0 = null;
697
+ function getUint32ArrayMemory0() {
698
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
699
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
700
+ }
701
+ return cachedUint32ArrayMemory0;
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
+ }
711
+
712
+ function handleError(f, args) {
713
+ try {
714
+ return f.apply(this, args);
715
+ } catch (e) {
716
+ const idx = addToExternrefTable0(e);
717
+ wasm.__wbindgen_exn_store(idx);
718
+ }
719
+ }
720
+
721
+ function isLikeNone(x) {
722
+ return x === undefined || x === null;
723
+ }
724
+
725
+ function passArray32ToWasm0(arg, malloc) {
726
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
727
+ getUint32ArrayMemory0().set(arg, ptr / 4);
728
+ WASM_VECTOR_LEN = arg.length;
729
+ return ptr;
730
+ }
731
+
732
+ function passArrayF32ToWasm0(arg, malloc) {
733
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
734
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
735
+ WASM_VECTOR_LEN = arg.length;
736
+ return ptr;
737
+ }
738
+
739
+ function passArrayF64ToWasm0(arg, malloc) {
740
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
741
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
742
+ WASM_VECTOR_LEN = arg.length;
743
+ return ptr;
744
+ }
745
+
746
+ function passStringToWasm0(arg, malloc, realloc) {
747
+ if (realloc === undefined) {
748
+ const buf = cachedTextEncoder.encode(arg);
749
+ const ptr = malloc(buf.length, 1) >>> 0;
750
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
751
+ WASM_VECTOR_LEN = buf.length;
752
+ return ptr;
753
+ }
754
+
755
+ let len = arg.length;
756
+ let ptr = malloc(len, 1) >>> 0;
757
+
758
+ const mem = getUint8ArrayMemory0();
759
+
760
+ let offset = 0;
761
+
762
+ for (; offset < len; offset++) {
763
+ const code = arg.charCodeAt(offset);
764
+ if (code > 0x7F) break;
765
+ mem[ptr + offset] = code;
766
+ }
767
+ if (offset !== len) {
768
+ if (offset !== 0) {
769
+ arg = arg.slice(offset);
770
+ }
771
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
772
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
773
+ const ret = cachedTextEncoder.encodeInto(arg, view);
774
+
775
+ offset += ret.written;
776
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
777
+ }
778
+
779
+ WASM_VECTOR_LEN = offset;
780
+ return ptr;
781
+ }
782
+
783
+ function takeFromExternrefTable0(idx) {
784
+ const value = wasm.__wbindgen_externrefs.get(idx);
785
+ wasm.__externref_table_dealloc(idx);
786
+ return value;
787
+ }
788
+
789
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
790
+ cachedTextDecoder.decode();
791
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
792
+ let numBytesDecoded = 0;
793
+ function decodeText(ptr, len) {
794
+ numBytesDecoded += len;
795
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
796
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
797
+ cachedTextDecoder.decode();
798
+ numBytesDecoded = len;
799
+ }
800
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
801
+ }
802
+
803
+ const cachedTextEncoder = new TextEncoder();
804
+
805
+ if (!('encodeInto' in cachedTextEncoder)) {
806
+ cachedTextEncoder.encodeInto = function (arg, view) {
807
+ const buf = cachedTextEncoder.encode(arg);
808
+ view.set(buf);
809
+ return {
810
+ read: arg.length,
811
+ written: buf.length
812
+ };
813
+ };
814
+ }
815
+
816
+ let WASM_VECTOR_LEN = 0;
817
+
818
+ let wasmModule, wasm;
819
+ function __wbg_finalize_init(instance, module) {
820
+ wasm = instance.exports;
821
+ wasmModule = module;
822
+ cachedDataViewMemory0 = null;
823
+ cachedFloat32ArrayMemory0 = null;
824
+ cachedFloat64ArrayMemory0 = null;
825
+ cachedUint32ArrayMemory0 = null;
826
+ cachedUint8ArrayMemory0 = null;
827
+ wasm.__wbindgen_start();
828
+ return wasm;
829
+ }
830
+
831
+ async function __wbg_load(module, imports) {
832
+ if (typeof Response === 'function' && module instanceof Response) {
833
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
834
+ try {
835
+ return await WebAssembly.instantiateStreaming(module, imports);
836
+ } catch (e) {
837
+ const validResponse = module.ok && expectedResponseType(module.type);
838
+
839
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
840
+ 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);
841
+
842
+ } else { throw e; }
843
+ }
844
+ }
845
+
846
+ const bytes = await module.arrayBuffer();
847
+ return await WebAssembly.instantiate(bytes, imports);
848
+ } else {
849
+ const instance = await WebAssembly.instantiate(module, imports);
850
+
851
+ if (instance instanceof WebAssembly.Instance) {
852
+ return { instance, module };
853
+ } else {
854
+ return instance;
855
+ }
856
+ }
857
+
858
+ function expectedResponseType(type) {
859
+ switch (type) {
860
+ case 'basic': case 'cors': case 'default': return true;
861
+ }
862
+ return false;
863
+ }
864
+ }
865
+
866
+ function initSync(module) {
867
+ if (wasm !== undefined) return wasm;
868
+
869
+
870
+ if (module !== undefined) {
871
+ if (Object.getPrototypeOf(module) === Object.prototype) {
872
+ ({module} = module)
873
+ } else {
874
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
875
+ }
876
+ }
877
+
878
+ const imports = __wbg_get_imports();
879
+ if (!(module instanceof WebAssembly.Module)) {
880
+ module = new WebAssembly.Module(module);
881
+ }
882
+ const instance = new WebAssembly.Instance(module, imports);
883
+ return __wbg_finalize_init(instance, module);
884
+ }
885
+
886
+ async function __wbg_init(module_or_path) {
887
+ if (wasm !== undefined) return wasm;
888
+
889
+
890
+ if (module_or_path !== undefined) {
891
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
892
+ ({module_or_path} = module_or_path)
893
+ } else {
894
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
895
+ }
896
+ }
897
+
898
+
899
+ const imports = __wbg_get_imports();
900
+
901
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
902
+ module_or_path = fetch(module_or_path);
903
+ }
904
+
905
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
906
+
907
+ return __wbg_finalize_init(instance, module);
908
+ }
909
+
910
+ export { initSync, __wbg_init as default };