OXYGENHUB
# b951c58734e8 oxygenhub / assets / backdrop / backdrop.js
26.5 KiB · JavaScript · last changed Live arrivals on the sky 22 days ago source blame history raw
17ca6cdd Andy McCall ↶ 1
/**
da8f7826 Andy McCall ↶ 2
 * New activity, as the page polled it (§5, "Live"): `{events: [[repo
3
 * name, kind, at_ms, n]]}`. Each joins its cluster with an arrival ring;
4
 * a scene other than the sky ignores it.
5
 * @param {any} data
6
 */
7
export function arrive(data) {
8
    wasm.arrive(data);
9
}
10
11
/**
6246d1e5 Andy McCall ↶ 12
 * Start a backdrop on `canvas` with the page's `data`: the scene it names
13
 * (docs/backgrounds.md §2), the dashboard's sky by default. `still`
17ca6cdd Andy McCall ↶ 14
 * is the viewer's choice of a still backdrop; reduced motion asks for
15
 * one too. Without WebGL2 there is no backdrop, and nothing breaks.
16
 * @param {HTMLCanvasElement} canvas
17
 * @param {any} data
18
 * @param {boolean} still
19
 */
20
export function start(canvas, data, still) {
21
    const ret = wasm.start(canvas, data, still);
22
    if (ret[1]) {
23
        throw takeFromExternrefTable0(ret[0]);
24
    }
25
}
26
function __wbg_get_imports() {
27
    const import0 = {
28
        __proto__: null,
29
        __wbg___wbindgen_boolean_get_5b446f51afd21013: function(arg0) {
30
            const v = arg0;
31
            const ret = typeof(v) === 'boolean' ? v : undefined;
32
            return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
33
        },
34
        __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
35
            const ret = arg0 === undefined;
36
            return ret;
37
        },
38
        __wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
39
            const obj = arg1;
40
            const ret = typeof(obj) === 'number' ? obj : undefined;
41
            getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
42
            getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
43
        },
44
        __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
45
            const obj = arg1;
46
            const ret = typeof(obj) === 'string' ? obj : undefined;
47
            var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
48
            var len1 = WASM_VECTOR_LEN;
49
            getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
50
            getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
51
        },
52
        __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
53
            throw new Error(getStringFromWasm0(arg0, arg1));
54
        },
55
        __wbg__wbg_cb_unref_dcc1a90847f04c41: function(arg0) {
56
            arg0._wbg_cb_unref();
57
        },
58
        __wbg_addEventListener_4d0db17c671ea324: function() { return handleError(function (arg0, arg1, arg2, arg3) {
59
            arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3);
60
        }, arguments); },
61
        __wbg_appendChild_fb8c52e7dd8484ea: function() { return handleError(function (arg0, arg1) {
62
            const ret = arg0.appendChild(arg1);
63
            return ret;
64
        }, arguments); },
65
        __wbg_attachShader_9567ae57af6746d5: function(arg0, arg1, arg2) {
66
            arg0.attachShader(arg1, arg2);
67
        },
68
        __wbg_bindBuffer_0324f62b876c4403: function(arg0, arg1, arg2) {
69
            arg0.bindBuffer(arg1 >>> 0, arg2);
70
        },
71
        __wbg_bindVertexArray_f58af0a346185ec5: function(arg0, arg1) {
72
            arg0.bindVertexArray(arg1);
73
        },
74
        __wbg_blendFunc_589e4252bb396484: function(arg0, arg1, arg2) {
75
            arg0.blendFunc(arg1 >>> 0, arg2 >>> 0);
76
        },
77
        __wbg_body_e549239eaff082e1: function(arg0) {
78
            const ret = arg0.body;
79
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
80
        },
81
        __wbg_bufferData_5fa44d94fe7a3878: function(arg0, arg1, arg2, arg3) {
82
            arg0.bufferData(arg1 >>> 0, arg2, arg3 >>> 0);
83
        },
84
        __wbg_clearColor_796427e8ac60fe14: function(arg0, arg1, arg2, arg3, arg4) {
85
            arg0.clearColor(arg1, arg2, arg3, arg4);
86
        },
87
        __wbg_clear_cb96796cc568b7c8: function(arg0, arg1) {
88
            arg0.clear(arg1 >>> 0);
89
        },
90
        __wbg_clientX_5075231ed45e8ef5: function(arg0) {
91
            const ret = arg0.clientX;
92
            return ret;
93
        },
94
        __wbg_clientY_846c39814ce02ab2: function(arg0) {
95
            const ret = arg0.clientY;
96
            return ret;
97
        },
98
        __wbg_compileShader_c2b53ff3a8851f60: function(arg0, arg1) {
99
            arg0.compileShader(arg1);
100
        },
101
        __wbg_createBuffer_ffe613371d42cfd3: function(arg0) {
102
            const ret = arg0.createBuffer();
103
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
104
        },
105
        __wbg_createElement_74049073a11f9c31: function() { return handleError(function (arg0, arg1, arg2) {
106
            const ret = arg0.createElement(getStringFromWasm0(arg1, arg2));
107
            return ret;
108
        }, arguments); },
109
        __wbg_createProgram_cbf448e6f18a9402: function(arg0) {
110
            const ret = arg0.createProgram();
111
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
112
        },
113
        __wbg_createShader_6c1a2295587878a5: function(arg0, arg1) {
114
            const ret = arg0.createShader(arg1 >>> 0);
115
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
116
        },
117
        __wbg_createVertexArray_b223ea69dd08fcab: function(arg0) {
118
            const ret = arg0.createVertexArray();
119
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
120
        },
121
        __wbg_devicePixelRatio_7d39e9af5448d3d4: function(arg0) {
122
            const ret = arg0.devicePixelRatio;
123
            return ret;
124
        },
125
        __wbg_document_9854e03c05fc8834: function(arg0) {
126
            const ret = arg0.document;
127
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
128
        },
129
        __wbg_drawArraysInstanced_9b44aa78a087154d: function(arg0, arg1, arg2, arg3, arg4) {
130
            arg0.drawArraysInstanced(arg1 >>> 0, arg2, arg3, arg4);
131
        },
132
        __wbg_drawArrays_08872e02fb57b847: function(arg0, arg1, arg2, arg3) {
133
            arg0.drawArrays(arg1 >>> 0, arg2, arg3);
134
        },
135
        __wbg_enableVertexAttribArray_d52693866bc8b8dd: function(arg0, arg1) {
136
            arg0.enableVertexAttribArray(arg1 >>> 0);
137
        },
138
        __wbg_enable_cb4fc19b51148c37: function(arg0, arg1) {
139
            arg0.enable(arg1 >>> 0);
140
        },
141
        __wbg_from_296ca31f8d0f1c52: function(arg0) {
142
            const ret = Array.from(arg0);
143
            return ret;
144
        },
6907a989 Andy McCall ↶ 145
        __wbg_getBoundingClientRect_57152b1a20f3de34: function(arg0) {
146
            const ret = arg0.getBoundingClientRect();
147
            return ret;
148
        },
17ca6cdd Andy McCall ↶ 149
        __wbg_getComputedStyle_dd0f456804795fd6: function() { return handleError(function (arg0, arg1) {
150
            const ret = arg0.getComputedStyle(arg1);
151
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
152
        }, arguments); },
153
        __wbg_getContext_051324720aa5b7e8: function() { return handleError(function (arg0, arg1, arg2, arg3) {
154
            const ret = arg0.getContext(getStringFromWasm0(arg1, arg2), arg3);
155
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
156
        }, arguments); },
157
        __wbg_getProgramInfoLog_3276b294d6d42fe2: function(arg0, arg1, arg2) {
158
            const ret = arg1.getProgramInfoLog(arg2);
159
            var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160
            var len1 = WASM_VECTOR_LEN;
161
            getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
162
            getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
163
        },
164
        __wbg_getProgramParameter_fc7124bb9fb7c675: function(arg0, arg1, arg2) {
165
            const ret = arg0.getProgramParameter(arg1, arg2 >>> 0);
166
            return ret;
167
        },
168
        __wbg_getPropertyValue_e90a3628c2de4fb6: function() { return handleError(function (arg0, arg1, arg2, arg3) {
169
            const ret = arg1.getPropertyValue(getStringFromWasm0(arg2, arg3));
170
            const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
171
            const len1 = WASM_VECTOR_LEN;
172
            getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
173
            getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
174
        }, arguments); },
175
        __wbg_getShaderInfoLog_7e0cbba353ca95da: function(arg0, arg1, arg2) {
176
            const ret = arg1.getShaderInfoLog(arg2);
177
            var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
178
            var len1 = WASM_VECTOR_LEN;
179
            getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
180
            getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
181
        },
182
        __wbg_getShaderParameter_745acf10b8e45e31: function(arg0, arg1, arg2) {
183
            const ret = arg0.getShaderParameter(arg1, arg2 >>> 0);
184
            return ret;
185
        },
186
        __wbg_getUniformLocation_50ba45dade572703: function(arg0, arg1, arg2, arg3) {
187
            const ret = arg0.getUniformLocation(arg1, getStringFromWasm0(arg2, arg3));
188
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
189
        },
190
        __wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
191
            const ret = Reflect.get(arg0, arg1);
192
            return ret;
193
        }, arguments); },
194
        __wbg_get_6c896e0571ddae51: function(arg0, arg1) {
195
            const ret = arg0[arg1 >>> 0];
196
            return ret;
197
        },
198
        __wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
199
            const ret = arg0[arg1 >>> 0];
200
            return ret;
201
        },
202
        __wbg_hidden_2ba371ecafe013fa: function(arg0) {
203
            const ret = arg0.hidden;
204
            return ret;
205
        },
206
        __wbg_innerHeight_7f20e0f1a7c5a573: function() { return handleError(function (arg0) {
207
            const ret = arg0.innerHeight;
208
            return ret;
209
        }, arguments); },
210
        __wbg_innerWidth_1bc526614080537c: function() { return handleError(function (arg0) {
211
            const ret = arg0.innerWidth;
212
            return ret;
213
        }, arguments); },
214
        __wbg_instanceof_HtmlElement_32fb153a5a0e2349: function(arg0) {
215
            let result;
216
            try {
217
                result = arg0 instanceof HTMLElement;
218
            } catch (_) {
219
                result = false;
220
            }
221
            const ret = result;
222
            return ret;
223
        },
224
        __wbg_instanceof_WebGl2RenderingContext_64c994c14c0790fb: function(arg0) {
225
            let result;
226
            try {
227
                result = arg0 instanceof WebGL2RenderingContext;
228
            } catch (_) {
229
                result = false;
230
            }
231
            const ret = result;
232
            return ret;
233
        },
234
        __wbg_instanceof_Window_82d71df4eddf88bc: function(arg0) {
235
            let result;
236
            try {
237
                result = arg0 instanceof Window;
238
            } catch (_) {
239
                result = false;
240
            }
241
            const ret = result;
6907a989 Andy McCall ↶ 242
            return ret;
243
        },
244
        __wbg_left_e0a244490fe2f293: function(arg0) {
245
            const ret = arg0.left;
17ca6cdd Andy McCall ↶ 246
            return ret;
247
        },
248
        __wbg_length_d4bdea10311bd9cf: function(arg0) {
249
            const ret = arg0.length;
250
            return ret;
251
        },
252
        __wbg_linkProgram_acdc299c43d734a0: function(arg0, arg1) {
253
            arg0.linkProgram(arg1);
254
        },
255
        __wbg_matchMedia_8a4857f947f11f82: function() { return handleError(function (arg0, arg1, arg2) {
256
            const ret = arg0.matchMedia(getStringFromWasm0(arg1, arg2));
257
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
258
        }, arguments); },
259
        __wbg_matches_778d0873b064b1bf: function(arg0) {
260
            const ret = arg0.matches;
261
            return ret;
262
        },
263
        __wbg_new_617a8cdb8bb1130e: function() {
264
            const ret = new Object();
265
            return ret;
266
        },
267
        __wbg_now_d0b7f4bea9f38490: function(arg0) {
268
            const ret = arg0.now();
269
            return ret;
270
        },
271
        __wbg_performance_d0d7b03fc649b694: function(arg0) {
272
            const ret = arg0.performance;
273
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
274
        },
6907a989 Andy McCall ↶ 275
        __wbg_querySelector_ecbc2550705b235f: function() { return handleError(function (arg0, arg1, arg2) {
276
            const ret = arg0.querySelector(getStringFromWasm0(arg1, arg2));
277
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
278
        }, arguments); },
17ca6cdd Andy McCall ↶ 279
        __wbg_relatedTarget_520fe88b1de28b43: function(arg0) {
280
            const ret = arg0.relatedTarget;
281
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
282
        },
283
        __wbg_requestAnimationFrame_7b526ab7aa550c74: function() { return handleError(function (arg0, arg1) {
284
            const ret = arg0.requestAnimationFrame(arg1);
285
            return ret;
286
        }, arguments); },
6907a989 Andy McCall ↶ 287
        __wbg_right_1dca6be6342de981: function(arg0) {
288
            const ret = arg0.right;
289
            return ret;
290
        },
17ca6cdd Andy McCall ↶ 291
        __wbg_setAttribute_9e7d603908f63705: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
292
            arg0.setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
293
        }, arguments); },
294
        __wbg_setProperty_097bc3d55ce44513: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
295
            arg0.setProperty(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
296
        }, arguments); },
297
        __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
298
            const ret = Reflect.set(arg0, arg1, arg2);
299
            return ret;
300
        }, arguments); },
301
        __wbg_set_className_541fce5cd31918aa: function(arg0, arg1, arg2) {
302
            arg0.className = getStringFromWasm0(arg1, arg2);
303
        },
304
        __wbg_set_height_c9789c1c77eaedff: function(arg0, arg1) {
305
            arg0.height = arg1 >>> 0;
306
        },
307
        __wbg_set_textContent_6d6fc559f198055f: function(arg0, arg1, arg2) {
308
            arg0.textContent = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2);
309
        },
310
        __wbg_set_width_b0e1267db4b196b5: function(arg0, arg1) {
311
            arg0.width = arg1 >>> 0;
312
        },
313
        __wbg_shaderSource_c8812639b47d87b9: function(arg0, arg1, arg2, arg3) {
314
            arg0.shaderSource(arg1, getStringFromWasm0(arg2, arg3));
315
        },
316
        __wbg_static_accessor_GLOBAL_266715b9d96ba635: function() {
317
            const ret = typeof global === 'undefined' ? null : global;
318
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
319
        },
320
        __wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() {
321
            const ret = typeof globalThis === 'undefined' ? null : globalThis;
322
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
323
        },
324
        __wbg_static_accessor_SELF_0b583911f537483a: function() {
325
            const ret = typeof self === 'undefined' ? null : self;
326
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
327
        },
328
        __wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() {
329
            const ret = typeof window === 'undefined' ? null : window;
330
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
331
        },
332
        __wbg_style_4bce24230e493a7c: function(arg0) {
333
            const ret = arg0.style;
334
            return ret;
335
        },
336
        __wbg_uniform2f_a92b5bb95dc5b4d9: function(arg0, arg1, arg2, arg3) {
337
            arg0.uniform2f(arg1, arg2, arg3);
338
        },
339
        __wbg_useProgram_e075c2902e420761: function(arg0, arg1) {
340
            arg0.useProgram(arg1);
341
        },
342
        __wbg_vertexAttribDivisor_7575d382215322f7: function(arg0, arg1, arg2) {
343
            arg0.vertexAttribDivisor(arg1 >>> 0, arg2 >>> 0);
344
        },
345
        __wbg_vertexAttribPointer_24b495e18df325dc: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
346
            arg0.vertexAttribPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4 !== 0, arg5, arg6);
347
        },
348
        __wbg_viewport_16936692526e2ce6: function(arg0, arg1, arg2, arg3, arg4) {
349
            arg0.viewport(arg1, arg2, arg3, arg4);
350
        },
351
        __wbindgen_generic_0000000000000001: function(arg0, arg1) {
f993f792 Andy McCall ↶ 352
            // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [F64], shim_idx: 8, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
17ca6cdd Andy McCall ↶ 353
            const ret = makeMutClosure(arg0, arg1, wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___f64______true_);
354
            return ret;
355
        },
356
        __wbindgen_generic_0000000000000002: function(arg0, arg1) {
f993f792 Andy McCall ↶ 357
            // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MouseEvent")], shim_idx: 7, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
17ca6cdd Andy McCall ↶ 358
            const ret = makeMutClosure(arg0, arg1, wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___web_sys_793942649ef82f98___features__gen_MouseEvent__MouseEvent______true_);
359
            return ret;
360
        },
361
        __wbindgen_generic_0000000000000003: function(arg0, arg1) {
f993f792 Andy McCall ↶ 362
            // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
17ca6cdd Andy McCall ↶ 363
            const ret = makeMutClosure(arg0, arg1, wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke_______true_);
364
            return ret;
365
        },
366
        __wbindgen_generic_0000000000000004: function(arg0, arg1) {
367
            // Cast intrinsic for `Ref(Slice(F32)) -> NamedExternref("Float32Array")`.
368
            const ret = getArrayF32FromWasm0(arg0, arg1);
369
            return ret;
370
        },
371
        __wbindgen_generic_0000000000000005: function(arg0, arg1) {
372
            // Cast intrinsic for `Ref(String) -> Externref`.
373
            const ret = getStringFromWasm0(arg0, arg1);
374
            return ret;
375
        },
376
        __wbindgen_init_externref_table: function() {
377
            const table = wasm.__wbindgen_externrefs;
378
            const offset = table.grow(4);
379
            table.set(0, undefined);
380
            table.set(offset + 0, undefined);
381
            table.set(offset + 1, null);
382
            table.set(offset + 2, true);
383
            table.set(offset + 3, false);
384
        },
385
    };
386
    return {
387
        __proto__: null,
388
        "./backdrop_bg.js": import0,
389
    };
390
}
391
392
function wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke_______true_(arg0, arg1) {
393
    wasm.wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke_______true_(arg0, arg1);
394
}
395
396
function wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___web_sys_793942649ef82f98___features__gen_MouseEvent__MouseEvent______true_(arg0, arg1, arg2) {
397
    wasm.wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___web_sys_793942649ef82f98___features__gen_MouseEvent__MouseEvent______true_(arg0, arg1, arg2);
398
}
399
400
function wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___f64______true_(arg0, arg1, arg2) {
401
    wasm.wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___f64______true_(arg0, arg1, arg2);
402
}
403
404
function addToExternrefTable0(obj) {
405
    const idx = wasm.__externref_table_alloc();
406
    wasm.__wbindgen_externrefs.set(idx, obj);
407
    return idx;
408
}
409
410
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
411
    ? { register: () => {}, unregister: () => {} }
412
    : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
413
414
function getArrayF32FromWasm0(ptr, len) {
415
    ptr = ptr >>> 0;
416
    return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
417
}
418
419
let cachedDataViewMemory0 = null;
420
function getDataViewMemory0() {
421
    if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
422
        cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
423
    }
424
    return cachedDataViewMemory0;
425
}
426
427
let cachedFloat32ArrayMemory0 = null;
428
function getFloat32ArrayMemory0() {
429
    if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
430
        cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
431
    }
432
    return cachedFloat32ArrayMemory0;
433
}
434
435
function getStringFromWasm0(ptr, len) {
436
    return decodeText(ptr >>> 0, len);
437
}
438
439
let cachedUint8ArrayMemory0 = null;
440
function getUint8ArrayMemory0() {
441
    if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
442
        cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
443
    }
444
    return cachedUint8ArrayMemory0;
445
}
446
447
function handleError(f, args) {
448
    try {
449
        return f.apply(this, args);
450
    } catch (e) {
451
        const idx = addToExternrefTable0(e);
452
        wasm.__wbindgen_exn_store(idx);
453
    }
454
}
455
456
function isLikeNone(x) {
457
    return x === undefined || x === null;
458
}
459
460
function makeMutClosure(arg0, arg1, f) {
461
    const state = { a: arg0, b: arg1, cnt: 1 };
462
    const real = (...args) => {
463
464
        // First up with a closure we increment the internal reference
465
        // count. This ensures that the Rust closure environment won't
466
        // be deallocated while we're invoking it.
467
        state.cnt++;
468
        const a = state.a;
469
        state.a = 0;
470
        try {
471
            return f(a, state.b, ...args);
472
        } finally {
473
            state.a = a;
474
            real._wbg_cb_unref();
475
        }
476
    };
477
    real._wbg_cb_unref = () => {
478
        if (--state.cnt === 0) {
479
            wasm.__wbindgen_destroy_closure(state.a, state.b);
480
            state.a = 0;
481
            CLOSURE_DTORS.unregister(state);
482
        }
483
    };
484
    CLOSURE_DTORS.register(real, state, state);
485
    return real;
486
}
487
488
function passStringToWasm0(arg, malloc, realloc) {
489
    if (realloc === undefined) {
490
        const buf = cachedTextEncoder.encode(arg);
491
        const ptr = malloc(buf.length, 1) >>> 0;
492
        getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
493
        WASM_VECTOR_LEN = buf.length;
494
        return ptr;
495
    }
496
497
    let len = arg.length;
498
    let ptr = malloc(len, 1) >>> 0;
499
500
    const mem = getUint8ArrayMemory0();
501
502
    let offset = 0;
503
504
    for (; offset < len; offset++) {
505
        const code = arg.charCodeAt(offset);
506
        if (code > 0x7F) break;
507
        mem[ptr + offset] = code;
508
    }
509
    if (offset !== len) {
510
        if (offset !== 0) {
511
            arg = arg.slice(offset);
512
        }
513
        ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
514
        const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
515
        const ret = cachedTextEncoder.encodeInto(arg, view);
516
517
        offset += ret.written;
518
        ptr = realloc(ptr, len, offset, 1) >>> 0;
519
    }
520
521
    WASM_VECTOR_LEN = offset;
522
    return ptr;
523
}
524
525
function takeFromExternrefTable0(idx) {
526
    const value = wasm.__wbindgen_externrefs.get(idx);
527
    wasm.__externref_table_dealloc(idx);
528
    return value;
529
}
530
531
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
532
cachedTextDecoder.decode();
533
const MAX_SAFARI_DECODE_BYTES = 2146435072;
534
let numBytesDecoded = 0;
535
function decodeText(ptr, len) {
536
    numBytesDecoded += len;
537
    if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
538
        cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
539
        cachedTextDecoder.decode();
540
        numBytesDecoded = len;
541
    }
542
    return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
543
}
544
545
const cachedTextEncoder = new TextEncoder();
546
547
if (!('encodeInto' in cachedTextEncoder)) {
548
    cachedTextEncoder.encodeInto = function (arg, view) {
549
        const buf = cachedTextEncoder.encode(arg);
550
        view.set(buf);
551
        return {
552
            read: arg.length,
553
            written: buf.length
554
        };
555
    };
556
}
557
558
let WASM_VECTOR_LEN = 0;
559
560
let wasmModule, wasmInstance, wasm;
561
function __wbg_finalize_init(instance, module) {
562
    wasmInstance = instance;
563
    wasm = instance.exports;
564
    wasmModule = module;
565
    cachedDataViewMemory0 = null;
566
    cachedFloat32ArrayMemory0 = null;
567
    cachedUint8ArrayMemory0 = null;
568
    wasm.__wbindgen_start();
569
    return wasm;
570
}
571
572
async function __wbg_load(module, imports) {
573
    if (typeof Response === 'function' && module instanceof Response) {
574
        if (!module.ok) {
575
            throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
576
        }
577
578
        if (typeof WebAssembly.instantiateStreaming === 'function') {
579
            try {
580
                return await WebAssembly.instantiateStreaming(module, imports);
581
            } catch (e) {
582
                const validResponse = expectedResponseType(module.type);
583
584
                if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
585
                    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);
586
587
                } else { throw e; }
588
            }
589
        }
590
591
        const bytes = await module.arrayBuffer();
592
        return await WebAssembly.instantiate(bytes, imports);
593
    } else {
594
        const instance = await WebAssembly.instantiate(module, imports);
595
596
        if (instance instanceof WebAssembly.Instance) {
597
            return { instance, module };
598
        } else {
599
            return instance;
600
        }
601
    }
602
603
    function expectedResponseType(type) {
604
        switch (type) {
605
            case 'basic': case 'cors': case 'default': return true;
606
        }
607
        return false;
608
    }
609
}
610
611
function initSync(module) {
612
    if (wasm !== undefined) return wasm;
613
614
615
    if (module !== undefined) {
616
        if (Object.getPrototypeOf(module) === Object.prototype) {
617
            ({module} = module)
618
        } else {
619
            console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
620
        }
621
    }
622
623
    const imports = __wbg_get_imports();
624
    if (!(module instanceof WebAssembly.Module)) {
625
        module = new WebAssembly.Module(module);
626
    }
627
    const instance = new WebAssembly.Instance(module, imports);
628
    return __wbg_finalize_init(instance, module);
629
}
630
631
async function __wbg_init(module_or_path) {
632
    if (wasm !== undefined) return wasm;
633
634
635
    if (module_or_path !== undefined) {
636
        if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
637
            ({module_or_path} = module_or_path)
638
        } else {
639
            console.warn('using deprecated parameters for the initialization function; pass a single object instead')
640
        }
641
    }
642
643
    if (module_or_path === undefined) {
644
        module_or_path = new URL('backdrop_bg.wasm', import.meta.url);
645
    }
646
    const imports = __wbg_get_imports();
647
648
    if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
649
        module_or_path = fetch(module_or_path);
650
    }
651
652
    const { instance, module } = await __wbg_load(await module_or_path, imports);
653
654
    return __wbg_finalize_init(instance, module);
655
}
656
657
export { initSync, __wbg_init as default };