@pie-project/server-web 0.5.2
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/README.md +91 -0
- package/dist/pie.mjs +3357 -0
- package/dist/pie_browser_bg.wasm +0 -0
- package/dist/worker.mjs +1531 -0
- package/index.d.ts +65 -0
- package/package.json +38 -0
- package/src/languages.d.ts +5 -0
- package/src/languages.mjs +27 -0
- package/src/pie.mjs +211 -0
- package/src/platform.mjs +60 -0
- package/src/transport.mjs +74 -0
- package/src/worker.mjs +234 -0
package/dist/worker.mjs
ADDED
|
@@ -0,0 +1,1531 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// pkg/platform.mjs
|
|
8
|
+
var platform_exports = {};
|
|
9
|
+
__export(platform_exports, {
|
|
10
|
+
attach: () => attach,
|
|
11
|
+
pie_fiber_init: () => pie_fiber_init,
|
|
12
|
+
pie_fiber_switch: () => pie_fiber_switch,
|
|
13
|
+
pie_now: () => pie_now,
|
|
14
|
+
pie_wake: () => pie_wake
|
|
15
|
+
});
|
|
16
|
+
var wasm = null;
|
|
17
|
+
var fiberEntry = null;
|
|
18
|
+
var slots = /* @__PURE__ */ new Map();
|
|
19
|
+
var onWake = () => {
|
|
20
|
+
};
|
|
21
|
+
function attach(exports, wakeHook) {
|
|
22
|
+
wasm = exports;
|
|
23
|
+
fiberEntry = WebAssembly.promising(exports.pie_fiber_entry);
|
|
24
|
+
onWake = wakeHook;
|
|
25
|
+
}
|
|
26
|
+
function finishFiber(top) {
|
|
27
|
+
const parked = slots.get(top);
|
|
28
|
+
slots.delete(top);
|
|
29
|
+
if (!parked || parked.init) {
|
|
30
|
+
console.error(`[fiber] ${top} finished with no parked resumer`, parked);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
wasm.__stack_pointer.value = parked.sp;
|
|
34
|
+
parked.resolve();
|
|
35
|
+
}
|
|
36
|
+
function pie_fiber_init(top, entry, arg0) {
|
|
37
|
+
slots.set(top >>> 0, { init: { entry, arg0 } });
|
|
38
|
+
}
|
|
39
|
+
var pie_fiber_switch = new WebAssembly.Suspending((top) => {
|
|
40
|
+
top = top >>> 0;
|
|
41
|
+
const parked = slots.get(top);
|
|
42
|
+
if (!parked) throw new Error(`fiber switch to unknown stack ${top}`);
|
|
43
|
+
const me = { sp: wasm.__stack_pointer.value, resolve: null };
|
|
44
|
+
const resumed = new Promise((r) => me.resolve = r);
|
|
45
|
+
slots.set(top, me);
|
|
46
|
+
if (parked.init) {
|
|
47
|
+
const { entry, arg0 } = parked.init;
|
|
48
|
+
queueMicrotask(() => {
|
|
49
|
+
wasm.__stack_pointer.value = top - 16 >>> 0;
|
|
50
|
+
fiberEntry(entry, arg0, top).then((ret) => finishFiber(ret >>> 0));
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
queueMicrotask(() => {
|
|
54
|
+
wasm.__stack_pointer.value = parked.sp;
|
|
55
|
+
parked.resolve();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return resumed;
|
|
59
|
+
});
|
|
60
|
+
function pie_now() {
|
|
61
|
+
return performance.now();
|
|
62
|
+
}
|
|
63
|
+
function pie_wake() {
|
|
64
|
+
onWake();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// pkg/pie_browser.js
|
|
68
|
+
function pie_boot_lazy(config_toml, model_name, len) {
|
|
69
|
+
const ptr0 = passStringToWasm0(config_toml, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
70
|
+
const len0 = WASM_VECTOR_LEN;
|
|
71
|
+
const ptr1 = passStringToWasm0(model_name, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
72
|
+
const len1 = WASM_VECTOR_LEN;
|
|
73
|
+
const ret = wasm2.pie_boot_lazy(ptr0, len0, ptr1, len1, len);
|
|
74
|
+
return takeObject(ret);
|
|
75
|
+
}
|
|
76
|
+
function pie_close_session(session) {
|
|
77
|
+
wasm2.pie_close_session(session);
|
|
78
|
+
}
|
|
79
|
+
function pie_init(log_filter) {
|
|
80
|
+
var ptr0 = isLikeNone(log_filter) ? 0 : passStringToWasm0(log_filter, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
81
|
+
var len0 = WASM_VECTOR_LEN;
|
|
82
|
+
wasm2.pie_init(ptr0, len0);
|
|
83
|
+
}
|
|
84
|
+
function pie_install_language(language, component) {
|
|
85
|
+
const ptr0 = passStringToWasm0(language, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
86
|
+
const len0 = WASM_VECTOR_LEN;
|
|
87
|
+
const ptr1 = passArray8ToWasm0(component, wasm2.__wbindgen_export);
|
|
88
|
+
const len1 = WASM_VECTOR_LEN;
|
|
89
|
+
const ret = wasm2.pie_install_language(ptr0, len0, ptr1, len1);
|
|
90
|
+
return takeObject(ret);
|
|
91
|
+
}
|
|
92
|
+
function pie_install_program(component, manifest_toml) {
|
|
93
|
+
const ptr0 = passArray8ToWasm0(component, wasm2.__wbindgen_export);
|
|
94
|
+
const len0 = WASM_VECTOR_LEN;
|
|
95
|
+
const ptr1 = passStringToWasm0(manifest_toml, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
96
|
+
const len1 = WASM_VECTOR_LEN;
|
|
97
|
+
const ret = wasm2.pie_install_program(ptr0, len0, ptr1, len1);
|
|
98
|
+
return takeObject(ret);
|
|
99
|
+
}
|
|
100
|
+
function pie_open_session() {
|
|
101
|
+
try {
|
|
102
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
103
|
+
wasm2.pie_open_session(retptr);
|
|
104
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
105
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
106
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
107
|
+
if (r2) {
|
|
108
|
+
throw takeObject(r1);
|
|
109
|
+
}
|
|
110
|
+
return r0 >>> 0;
|
|
111
|
+
} finally {
|
|
112
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function pie_range_failed(request, error) {
|
|
116
|
+
const ptr0 = passStringToWasm0(error, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
117
|
+
const len0 = WASM_VECTOR_LEN;
|
|
118
|
+
wasm2.pie_range_failed(request, ptr0, len0);
|
|
119
|
+
}
|
|
120
|
+
function pie_range_ready(request, bytes) {
|
|
121
|
+
wasm2.pie_range_ready(request, addHeapObject(bytes));
|
|
122
|
+
}
|
|
123
|
+
function pie_recv_frames(session, max_wait_ms, max) {
|
|
124
|
+
const ret = wasm2.pie_recv_frames(session, max_wait_ms, max);
|
|
125
|
+
return takeObject(ret);
|
|
126
|
+
}
|
|
127
|
+
function pie_send_frame(session, frame) {
|
|
128
|
+
try {
|
|
129
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
130
|
+
wasm2.pie_send_frame(retptr, session, addHeapObject(frame));
|
|
131
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
132
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
133
|
+
if (r1) {
|
|
134
|
+
throw takeObject(r0);
|
|
135
|
+
}
|
|
136
|
+
} finally {
|
|
137
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function __wbg_get_imports() {
|
|
141
|
+
const import0 = {
|
|
142
|
+
__proto__: null,
|
|
143
|
+
__wbg_Error_67e7344beaa85059: function(arg0, arg1) {
|
|
144
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
145
|
+
return addHeapObject(ret);
|
|
146
|
+
},
|
|
147
|
+
__wbg_Window_a2a6c4d665047b14: function(arg0) {
|
|
148
|
+
const ret = getObject(arg0).Window;
|
|
149
|
+
return addHeapObject(ret);
|
|
150
|
+
},
|
|
151
|
+
__wbg_WorkerGlobalScope_2664448a7c667d67: function(arg0) {
|
|
152
|
+
const ret = getObject(arg0).WorkerGlobalScope;
|
|
153
|
+
return addHeapObject(ret);
|
|
154
|
+
},
|
|
155
|
+
__wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
|
|
156
|
+
const ret = debugString(getObject(arg1));
|
|
157
|
+
const ptr1 = passStringToWasm0(ret, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
158
|
+
const len1 = WASM_VECTOR_LEN;
|
|
159
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
160
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
161
|
+
},
|
|
162
|
+
__wbg___wbindgen_is_function_fcda5e3902d732fe: function(arg0) {
|
|
163
|
+
const ret = typeof getObject(arg0) === "function";
|
|
164
|
+
return ret;
|
|
165
|
+
},
|
|
166
|
+
__wbg___wbindgen_is_null_5160b3e381865372: function(arg0) {
|
|
167
|
+
const ret = getObject(arg0) === null;
|
|
168
|
+
return ret;
|
|
169
|
+
},
|
|
170
|
+
__wbg___wbindgen_is_string_c4f7cb494a2a21f1: function(arg0) {
|
|
171
|
+
const ret = typeof getObject(arg0) === "string";
|
|
172
|
+
return ret;
|
|
173
|
+
},
|
|
174
|
+
__wbg___wbindgen_is_undefined_8c687d0b90d5b524: function(arg0) {
|
|
175
|
+
const ret = getObject(arg0) === void 0;
|
|
176
|
+
return ret;
|
|
177
|
+
},
|
|
178
|
+
__wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
|
|
179
|
+
const obj = getObject(arg1);
|
|
180
|
+
const ret = typeof obj === "string" ? obj : void 0;
|
|
181
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
182
|
+
var len1 = WASM_VECTOR_LEN;
|
|
183
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
184
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
185
|
+
},
|
|
186
|
+
__wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
|
|
187
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
188
|
+
},
|
|
189
|
+
__wbg__wbg_cb_unref_997e73d32238e655: function(arg0) {
|
|
190
|
+
getObject(arg0)._wbg_cb_unref();
|
|
191
|
+
},
|
|
192
|
+
__wbg_beginComputePass_b9a325184985e6ff: function(arg0, arg1) {
|
|
193
|
+
const ret = getObject(arg0).beginComputePass(getObject(arg1));
|
|
194
|
+
return addHeapObject(ret);
|
|
195
|
+
},
|
|
196
|
+
__wbg_call_6bcf8d3e20937e46: function() {
|
|
197
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
198
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
199
|
+
return addHeapObject(ret);
|
|
200
|
+
}, arguments);
|
|
201
|
+
},
|
|
202
|
+
__wbg_clearBuffer_3d5a3057c3c8a9bf: function(arg0, arg1, arg2, arg3) {
|
|
203
|
+
getObject(arg0).clearBuffer(getObject(arg1), arg2, arg3);
|
|
204
|
+
},
|
|
205
|
+
__wbg_clearBuffer_82ba999c294f42fb: function(arg0, arg1, arg2) {
|
|
206
|
+
getObject(arg0).clearBuffer(getObject(arg1), arg2);
|
|
207
|
+
},
|
|
208
|
+
__wbg_configure_1e2c1c9edad07d26: function() {
|
|
209
|
+
return handleError(function(arg0, arg1) {
|
|
210
|
+
getObject(arg0).configure(getObject(arg1));
|
|
211
|
+
}, arguments);
|
|
212
|
+
},
|
|
213
|
+
__wbg_copyBufferToBuffer_01766818654a9868: function() {
|
|
214
|
+
return handleError(function(arg0, arg1, arg2, arg3, arg4) {
|
|
215
|
+
getObject(arg0).copyBufferToBuffer(getObject(arg1), arg2, getObject(arg3), arg4);
|
|
216
|
+
}, arguments);
|
|
217
|
+
},
|
|
218
|
+
__wbg_copyBufferToBuffer_9c174b96fb08d551: function() {
|
|
219
|
+
return handleError(function(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
220
|
+
getObject(arg0).copyBufferToBuffer(getObject(arg1), arg2, getObject(arg3), arg4, arg5);
|
|
221
|
+
}, arguments);
|
|
222
|
+
},
|
|
223
|
+
__wbg_createBindGroupLayout_b1bd63b4e88459d8: function() {
|
|
224
|
+
return handleError(function(arg0, arg1) {
|
|
225
|
+
const ret = getObject(arg0).createBindGroupLayout(getObject(arg1));
|
|
226
|
+
return addHeapObject(ret);
|
|
227
|
+
}, arguments);
|
|
228
|
+
},
|
|
229
|
+
__wbg_createBindGroup_f539b26ca341308f: function(arg0, arg1) {
|
|
230
|
+
const ret = getObject(arg0).createBindGroup(getObject(arg1));
|
|
231
|
+
return addHeapObject(ret);
|
|
232
|
+
},
|
|
233
|
+
__wbg_createBuffer_d800e9b1d41b2ee5: function() {
|
|
234
|
+
return handleError(function(arg0, arg1) {
|
|
235
|
+
const ret = getObject(arg0).createBuffer(getObject(arg1));
|
|
236
|
+
return addHeapObject(ret);
|
|
237
|
+
}, arguments);
|
|
238
|
+
},
|
|
239
|
+
__wbg_createCommandEncoder_3352d1ffc36c6fc0: function(arg0, arg1) {
|
|
240
|
+
const ret = getObject(arg0).createCommandEncoder(getObject(arg1));
|
|
241
|
+
return addHeapObject(ret);
|
|
242
|
+
},
|
|
243
|
+
__wbg_createComputePipeline_224fa2618d9948a0: function(arg0, arg1) {
|
|
244
|
+
const ret = getObject(arg0).createComputePipeline(getObject(arg1));
|
|
245
|
+
return addHeapObject(ret);
|
|
246
|
+
},
|
|
247
|
+
__wbg_createPipelineLayout_6eab52c327118937: function(arg0, arg1) {
|
|
248
|
+
const ret = getObject(arg0).createPipelineLayout(getObject(arg1));
|
|
249
|
+
return addHeapObject(ret);
|
|
250
|
+
},
|
|
251
|
+
__wbg_createQuerySet_2dc8cde53df9849d: function() {
|
|
252
|
+
return handleError(function(arg0, arg1) {
|
|
253
|
+
const ret = getObject(arg0).createQuerySet(getObject(arg1));
|
|
254
|
+
return addHeapObject(ret);
|
|
255
|
+
}, arguments);
|
|
256
|
+
},
|
|
257
|
+
__wbg_createShaderModule_cefa51336cb288ae: function(arg0, arg1) {
|
|
258
|
+
const ret = getObject(arg0).createShaderModule(getObject(arg1));
|
|
259
|
+
return addHeapObject(ret);
|
|
260
|
+
},
|
|
261
|
+
__wbg_description_83b8a393160021b9: function(arg0, arg1) {
|
|
262
|
+
const ret = getObject(arg1).description;
|
|
263
|
+
const ptr1 = passStringToWasm0(ret, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
264
|
+
const len1 = WASM_VECTOR_LEN;
|
|
265
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
266
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
267
|
+
},
|
|
268
|
+
__wbg_destroy_637537007d9eaa44: function(arg0) {
|
|
269
|
+
getObject(arg0).destroy();
|
|
270
|
+
},
|
|
271
|
+
__wbg_dispatchWorkgroups_56b943172790add0: function(arg0, arg1, arg2, arg3) {
|
|
272
|
+
getObject(arg0).dispatchWorkgroups(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0);
|
|
273
|
+
},
|
|
274
|
+
__wbg_end_82fd0c12ba185009: function(arg0) {
|
|
275
|
+
getObject(arg0).end();
|
|
276
|
+
},
|
|
277
|
+
__wbg_error_757e9472f8410341: function(arg0, arg1) {
|
|
278
|
+
let deferred0_0;
|
|
279
|
+
let deferred0_1;
|
|
280
|
+
try {
|
|
281
|
+
deferred0_0 = arg0;
|
|
282
|
+
deferred0_1 = arg1;
|
|
283
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
284
|
+
} finally {
|
|
285
|
+
wasm2.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
__wbg_error_8c8dff942c7c4f11: function(arg0) {
|
|
289
|
+
const ret = getObject(arg0).error;
|
|
290
|
+
return addHeapObject(ret);
|
|
291
|
+
},
|
|
292
|
+
__wbg_features_5cac120c28ba0475: function(arg0) {
|
|
293
|
+
const ret = getObject(arg0).features;
|
|
294
|
+
return addHeapObject(ret);
|
|
295
|
+
},
|
|
296
|
+
__wbg_features_dec7bd2fd3d91bd6: function(arg0) {
|
|
297
|
+
const ret = getObject(arg0).features;
|
|
298
|
+
return addHeapObject(ret);
|
|
299
|
+
},
|
|
300
|
+
__wbg_fetchRange_59f4c213313c928d: function(arg0, arg1, arg2) {
|
|
301
|
+
__pieHost.fetchRange(arg0, arg1, arg2 >>> 0);
|
|
302
|
+
},
|
|
303
|
+
__wbg_finish_09ec094c10f41e7b: function(arg0) {
|
|
304
|
+
const ret = getObject(arg0).finish();
|
|
305
|
+
return addHeapObject(ret);
|
|
306
|
+
},
|
|
307
|
+
__wbg_finish_ec1c191f66a895b1: function(arg0, arg1) {
|
|
308
|
+
const ret = getObject(arg0).finish(getObject(arg1));
|
|
309
|
+
return addHeapObject(ret);
|
|
310
|
+
},
|
|
311
|
+
__wbg_getBindGroupLayout_349f9101ad6d4d76: function(arg0, arg1) {
|
|
312
|
+
const ret = getObject(arg0).getBindGroupLayout(arg1 >>> 0);
|
|
313
|
+
return addHeapObject(ret);
|
|
314
|
+
},
|
|
315
|
+
__wbg_getContext_5ff6bd600503b094: function() {
|
|
316
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
317
|
+
const ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));
|
|
318
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
319
|
+
}, arguments);
|
|
320
|
+
},
|
|
321
|
+
__wbg_getMappedRange_fb54c6327b2d8d20: function() {
|
|
322
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
323
|
+
const ret = getObject(arg0).getMappedRange(arg1, arg2);
|
|
324
|
+
return addHeapObject(ret);
|
|
325
|
+
}, arguments);
|
|
326
|
+
},
|
|
327
|
+
__wbg_getRandomValues_436a51d0629d84e1: function() {
|
|
328
|
+
return handleError(function(arg0, arg1) {
|
|
329
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
330
|
+
}, arguments);
|
|
331
|
+
},
|
|
332
|
+
__wbg_getRandomValues_a608c4436c19407a: function() {
|
|
333
|
+
return handleError(function(arg0, arg1) {
|
|
334
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
335
|
+
}, arguments);
|
|
336
|
+
},
|
|
337
|
+
__wbg_getRandomValues_a678b7300e8ed57f: function() {
|
|
338
|
+
return handleError(function(arg0, arg1) {
|
|
339
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
340
|
+
}, arguments);
|
|
341
|
+
},
|
|
342
|
+
__wbg_gpu_afdd4387c7afe5f9: function(arg0) {
|
|
343
|
+
const ret = getObject(arg0).gpu;
|
|
344
|
+
return addHeapObject(ret);
|
|
345
|
+
},
|
|
346
|
+
__wbg_has_eafa12e457ea88fb: function(arg0, arg1, arg2) {
|
|
347
|
+
const ret = getObject(arg0).has(getStringFromWasm0(arg1, arg2));
|
|
348
|
+
return ret;
|
|
349
|
+
},
|
|
350
|
+
__wbg_info_971d8b9db3dae69f: function(arg0) {
|
|
351
|
+
const ret = getObject(arg0).info;
|
|
352
|
+
return addHeapObject(ret);
|
|
353
|
+
},
|
|
354
|
+
__wbg_instanceof_GpuOutOfMemoryError_5c3b8a2499f59adb: function(arg0) {
|
|
355
|
+
let result;
|
|
356
|
+
try {
|
|
357
|
+
result = getObject(arg0) instanceof GPUOutOfMemoryError;
|
|
358
|
+
} catch (_) {
|
|
359
|
+
result = false;
|
|
360
|
+
}
|
|
361
|
+
const ret = result;
|
|
362
|
+
return ret;
|
|
363
|
+
},
|
|
364
|
+
__wbg_instanceof_GpuValidationError_7659e07b12d4e184: function(arg0) {
|
|
365
|
+
let result;
|
|
366
|
+
try {
|
|
367
|
+
result = getObject(arg0) instanceof GPUValidationError;
|
|
368
|
+
} catch (_) {
|
|
369
|
+
result = false;
|
|
370
|
+
}
|
|
371
|
+
const ret = result;
|
|
372
|
+
return ret;
|
|
373
|
+
},
|
|
374
|
+
__wbg_isFallbackAdapter_4c8cc3b18677460a: function(arg0) {
|
|
375
|
+
const ret = getObject(arg0).isFallbackAdapter;
|
|
376
|
+
return ret;
|
|
377
|
+
},
|
|
378
|
+
__wbg_label_7add8cb37a6ef98f: function(arg0, arg1) {
|
|
379
|
+
const ret = getObject(arg1).label;
|
|
380
|
+
const ptr1 = passStringToWasm0(ret, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
381
|
+
const len1 = WASM_VECTOR_LEN;
|
|
382
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
383
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
384
|
+
},
|
|
385
|
+
__wbg_length_31bdaf014f5fbde2: function(arg0) {
|
|
386
|
+
const ret = getObject(arg0).length;
|
|
387
|
+
return ret;
|
|
388
|
+
},
|
|
389
|
+
__wbg_limits_06bcb36c8409843b: function(arg0) {
|
|
390
|
+
const ret = getObject(arg0).limits;
|
|
391
|
+
return addHeapObject(ret);
|
|
392
|
+
},
|
|
393
|
+
__wbg_limits_601ad2e086ef8141: function(arg0) {
|
|
394
|
+
const ret = getObject(arg0).limits;
|
|
395
|
+
return addHeapObject(ret);
|
|
396
|
+
},
|
|
397
|
+
__wbg_log_363d83b9114c8831: function(arg0) {
|
|
398
|
+
console.log(getObject(arg0));
|
|
399
|
+
},
|
|
400
|
+
__wbg_mapAsync_b0597127f5037286: function(arg0, arg1, arg2, arg3) {
|
|
401
|
+
const ret = getObject(arg0).mapAsync(arg1 >>> 0, arg2, arg3);
|
|
402
|
+
return addHeapObject(ret);
|
|
403
|
+
},
|
|
404
|
+
__wbg_maxBindGroupsPlusVertexBuffers_52369f089736ef9d: function(arg0) {
|
|
405
|
+
const ret = getObject(arg0).maxBindGroupsPlusVertexBuffers;
|
|
406
|
+
return ret;
|
|
407
|
+
},
|
|
408
|
+
__wbg_maxBindGroups_4e424afe6ce86ca2: function(arg0) {
|
|
409
|
+
const ret = getObject(arg0).maxBindGroups;
|
|
410
|
+
return ret;
|
|
411
|
+
},
|
|
412
|
+
__wbg_maxBindingsPerBindGroup_7d035da36821c44f: function(arg0) {
|
|
413
|
+
const ret = getObject(arg0).maxBindingsPerBindGroup;
|
|
414
|
+
return ret;
|
|
415
|
+
},
|
|
416
|
+
__wbg_maxBufferSize_423f4a084e32a195: function(arg0) {
|
|
417
|
+
const ret = getObject(arg0).maxBufferSize;
|
|
418
|
+
return ret;
|
|
419
|
+
},
|
|
420
|
+
__wbg_maxColorAttachmentBytesPerSample_c4cd9126f6d287c6: function(arg0) {
|
|
421
|
+
const ret = getObject(arg0).maxColorAttachmentBytesPerSample;
|
|
422
|
+
return ret;
|
|
423
|
+
},
|
|
424
|
+
__wbg_maxColorAttachments_d924670762b9e250: function(arg0) {
|
|
425
|
+
const ret = getObject(arg0).maxColorAttachments;
|
|
426
|
+
return ret;
|
|
427
|
+
},
|
|
428
|
+
__wbg_maxComputeInvocationsPerWorkgroup_707a3868f7cebb59: function(arg0) {
|
|
429
|
+
const ret = getObject(arg0).maxComputeInvocationsPerWorkgroup;
|
|
430
|
+
return ret;
|
|
431
|
+
},
|
|
432
|
+
__wbg_maxComputeWorkgroupSizeX_0a4d99463cbd6e5e: function(arg0) {
|
|
433
|
+
const ret = getObject(arg0).maxComputeWorkgroupSizeX;
|
|
434
|
+
return ret;
|
|
435
|
+
},
|
|
436
|
+
__wbg_maxComputeWorkgroupSizeY_85123ea0587f7558: function(arg0) {
|
|
437
|
+
const ret = getObject(arg0).maxComputeWorkgroupSizeY;
|
|
438
|
+
return ret;
|
|
439
|
+
},
|
|
440
|
+
__wbg_maxComputeWorkgroupSizeZ_a3186b4c5267d44f: function(arg0) {
|
|
441
|
+
const ret = getObject(arg0).maxComputeWorkgroupSizeZ;
|
|
442
|
+
return ret;
|
|
443
|
+
},
|
|
444
|
+
__wbg_maxComputeWorkgroupStorageSize_57b297355cfb6204: function(arg0) {
|
|
445
|
+
const ret = getObject(arg0).maxComputeWorkgroupStorageSize;
|
|
446
|
+
return ret;
|
|
447
|
+
},
|
|
448
|
+
__wbg_maxComputeWorkgroupsPerDimension_4158f95e673d54c4: function(arg0) {
|
|
449
|
+
const ret = getObject(arg0).maxComputeWorkgroupsPerDimension;
|
|
450
|
+
return ret;
|
|
451
|
+
},
|
|
452
|
+
__wbg_maxDynamicStorageBuffersPerPipelineLayout_226b0b70910aa16c: function(arg0) {
|
|
453
|
+
const ret = getObject(arg0).maxDynamicStorageBuffersPerPipelineLayout;
|
|
454
|
+
return ret;
|
|
455
|
+
},
|
|
456
|
+
__wbg_maxDynamicUniformBuffersPerPipelineLayout_0e835fda711fc7e6: function(arg0) {
|
|
457
|
+
const ret = getObject(arg0).maxDynamicUniformBuffersPerPipelineLayout;
|
|
458
|
+
return ret;
|
|
459
|
+
},
|
|
460
|
+
__wbg_maxInterStageShaderVariables_8c4a1d727e2aa35a: function(arg0) {
|
|
461
|
+
const ret = getObject(arg0).maxInterStageShaderVariables;
|
|
462
|
+
return ret;
|
|
463
|
+
},
|
|
464
|
+
__wbg_maxSampledTexturesPerShaderStage_6675f5e91d9a728a: function(arg0) {
|
|
465
|
+
const ret = getObject(arg0).maxSampledTexturesPerShaderStage;
|
|
466
|
+
return ret;
|
|
467
|
+
},
|
|
468
|
+
__wbg_maxSamplersPerShaderStage_1910fa38a6ed1e1f: function(arg0) {
|
|
469
|
+
const ret = getObject(arg0).maxSamplersPerShaderStage;
|
|
470
|
+
return ret;
|
|
471
|
+
},
|
|
472
|
+
__wbg_maxStorageBufferBindingSize_2e244bded070b18d: function(arg0) {
|
|
473
|
+
const ret = getObject(arg0).maxStorageBufferBindingSize;
|
|
474
|
+
return ret;
|
|
475
|
+
},
|
|
476
|
+
__wbg_maxStorageBuffersPerShaderStage_a285f3ebca51ca0d: function(arg0) {
|
|
477
|
+
const ret = getObject(arg0).maxStorageBuffersPerShaderStage;
|
|
478
|
+
return ret;
|
|
479
|
+
},
|
|
480
|
+
__wbg_maxStorageTexturesPerShaderStage_7aa946f0fc322a2b: function(arg0) {
|
|
481
|
+
const ret = getObject(arg0).maxStorageTexturesPerShaderStage;
|
|
482
|
+
return ret;
|
|
483
|
+
},
|
|
484
|
+
__wbg_maxTextureArrayLayers_0e699147ad00502d: function(arg0) {
|
|
485
|
+
const ret = getObject(arg0).maxTextureArrayLayers;
|
|
486
|
+
return ret;
|
|
487
|
+
},
|
|
488
|
+
__wbg_maxTextureDimension1D_aabf6add54decfe2: function(arg0) {
|
|
489
|
+
const ret = getObject(arg0).maxTextureDimension1D;
|
|
490
|
+
return ret;
|
|
491
|
+
},
|
|
492
|
+
__wbg_maxTextureDimension2D_dd598b27e9c0c1c4: function(arg0) {
|
|
493
|
+
const ret = getObject(arg0).maxTextureDimension2D;
|
|
494
|
+
return ret;
|
|
495
|
+
},
|
|
496
|
+
__wbg_maxTextureDimension3D_f944266c65dfd1a9: function(arg0) {
|
|
497
|
+
const ret = getObject(arg0).maxTextureDimension3D;
|
|
498
|
+
return ret;
|
|
499
|
+
},
|
|
500
|
+
__wbg_maxUniformBufferBindingSize_59fa6be7cfbeeb53: function(arg0) {
|
|
501
|
+
const ret = getObject(arg0).maxUniformBufferBindingSize;
|
|
502
|
+
return ret;
|
|
503
|
+
},
|
|
504
|
+
__wbg_maxUniformBuffersPerShaderStage_bee5f00a4d706c7f: function(arg0) {
|
|
505
|
+
const ret = getObject(arg0).maxUniformBuffersPerShaderStage;
|
|
506
|
+
return ret;
|
|
507
|
+
},
|
|
508
|
+
__wbg_maxVertexAttributes_5cf6392c4e9033fe: function(arg0) {
|
|
509
|
+
const ret = getObject(arg0).maxVertexAttributes;
|
|
510
|
+
return ret;
|
|
511
|
+
},
|
|
512
|
+
__wbg_maxVertexBufferArrayStride_548baa887375d865: function(arg0) {
|
|
513
|
+
const ret = getObject(arg0).maxVertexBufferArrayStride;
|
|
514
|
+
return ret;
|
|
515
|
+
},
|
|
516
|
+
__wbg_maxVertexBuffers_75d881156591f5da: function(arg0) {
|
|
517
|
+
const ret = getObject(arg0).maxVertexBuffers;
|
|
518
|
+
return ret;
|
|
519
|
+
},
|
|
520
|
+
__wbg_message_2aad50368e15e8f1: function(arg0, arg1) {
|
|
521
|
+
const ret = getObject(arg1).message;
|
|
522
|
+
const ptr1 = passStringToWasm0(ret, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
523
|
+
const len1 = WASM_VECTOR_LEN;
|
|
524
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
525
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
526
|
+
},
|
|
527
|
+
__wbg_minStorageBufferOffsetAlignment_5ba9b77792bdadb3: function(arg0) {
|
|
528
|
+
const ret = getObject(arg0).minStorageBufferOffsetAlignment;
|
|
529
|
+
return ret;
|
|
530
|
+
},
|
|
531
|
+
__wbg_minUniformBufferOffsetAlignment_ab7d52a5293b22bd: function(arg0) {
|
|
532
|
+
const ret = getObject(arg0).minUniformBufferOffsetAlignment;
|
|
533
|
+
return ret;
|
|
534
|
+
},
|
|
535
|
+
__wbg_navigator_d217ca64c4bbff48: function(arg0) {
|
|
536
|
+
const ret = getObject(arg0).navigator;
|
|
537
|
+
return addHeapObject(ret);
|
|
538
|
+
},
|
|
539
|
+
__wbg_navigator_d25c0f071226f233: function(arg0) {
|
|
540
|
+
const ret = getObject(arg0).navigator;
|
|
541
|
+
return addHeapObject(ret);
|
|
542
|
+
},
|
|
543
|
+
__wbg_new_12e5d807044fbfe3: function() {
|
|
544
|
+
return handleError(function(arg0, arg1) {
|
|
545
|
+
const ret = new OffscreenCanvas(arg0 >>> 0, arg1 >>> 0);
|
|
546
|
+
return addHeapObject(ret);
|
|
547
|
+
}, arguments);
|
|
548
|
+
},
|
|
549
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
550
|
+
const ret = new Error();
|
|
551
|
+
return addHeapObject(ret);
|
|
552
|
+
},
|
|
553
|
+
__wbg_new_8f72ed7c652bf5a2: function(arg0, arg1) {
|
|
554
|
+
try {
|
|
555
|
+
var state0 = { a: arg0, b: arg1 };
|
|
556
|
+
var cb0 = (arg02, arg12) => {
|
|
557
|
+
const a = state0.a;
|
|
558
|
+
state0.a = 0;
|
|
559
|
+
try {
|
|
560
|
+
return __wasm_bindgen_func_elem_12287(a, state0.b, arg02, arg12);
|
|
561
|
+
} finally {
|
|
562
|
+
state0.a = a;
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
const ret = new Promise(cb0);
|
|
566
|
+
return addHeapObject(ret);
|
|
567
|
+
} finally {
|
|
568
|
+
state0.a = 0;
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
__wbg_new_bebc3f4757acf305: function() {
|
|
572
|
+
const ret = new Object();
|
|
573
|
+
return addHeapObject(ret);
|
|
574
|
+
},
|
|
575
|
+
__wbg_new_ffa92086ea89f79c: function() {
|
|
576
|
+
const ret = new Array();
|
|
577
|
+
return addHeapObject(ret);
|
|
578
|
+
},
|
|
579
|
+
__wbg_new_from_slice_4ee02165f9de919e: function(arg0, arg1) {
|
|
580
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
581
|
+
return addHeapObject(ret);
|
|
582
|
+
},
|
|
583
|
+
__wbg_new_typed_7d4574ab4b8446c8: function() {
|
|
584
|
+
const ret = new Object();
|
|
585
|
+
return addHeapObject(ret);
|
|
586
|
+
},
|
|
587
|
+
__wbg_new_with_byte_offset_and_length_492c969e8b5da8a4: function(arg0, arg1, arg2) {
|
|
588
|
+
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
589
|
+
return addHeapObject(ret);
|
|
590
|
+
},
|
|
591
|
+
__wbg_onSubmittedWorkDone_1190213cee1ecf7e: function(arg0) {
|
|
592
|
+
const ret = getObject(arg0).onSubmittedWorkDone();
|
|
593
|
+
return addHeapObject(ret);
|
|
594
|
+
},
|
|
595
|
+
__wbg_popErrorScope_182b8e03671d81ef: function(arg0) {
|
|
596
|
+
const ret = getObject(arg0).popErrorScope();
|
|
597
|
+
return addHeapObject(ret);
|
|
598
|
+
},
|
|
599
|
+
__wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
|
|
600
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
601
|
+
},
|
|
602
|
+
__wbg_pushErrorScope_fa7df784c43bdb51: function(arg0, arg1) {
|
|
603
|
+
getObject(arg0).pushErrorScope(__wbindgen_enum_GpuErrorFilter[arg1]);
|
|
604
|
+
},
|
|
605
|
+
__wbg_push_bfdf956ba476f65b: function(arg0, arg1) {
|
|
606
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
607
|
+
return ret;
|
|
608
|
+
},
|
|
609
|
+
__wbg_queueMicrotask_85c90f6987555d65: function(arg0) {
|
|
610
|
+
const ret = getObject(arg0).queueMicrotask;
|
|
611
|
+
return addHeapObject(ret);
|
|
612
|
+
},
|
|
613
|
+
__wbg_queueMicrotask_f6a1fa10b81d1fc0: function(arg0) {
|
|
614
|
+
queueMicrotask(getObject(arg0));
|
|
615
|
+
},
|
|
616
|
+
__wbg_queue_7b62c28143d44293: function(arg0) {
|
|
617
|
+
const ret = getObject(arg0).queue;
|
|
618
|
+
return addHeapObject(ret);
|
|
619
|
+
},
|
|
620
|
+
__wbg_requestAdapter_a539af006419f2e9: function(arg0, arg1) {
|
|
621
|
+
const ret = getObject(arg0).requestAdapter(getObject(arg1));
|
|
622
|
+
return addHeapObject(ret);
|
|
623
|
+
},
|
|
624
|
+
__wbg_requestDevice_5cb8a582e55d08cb: function(arg0, arg1) {
|
|
625
|
+
const ret = getObject(arg0).requestDevice(getObject(arg1));
|
|
626
|
+
return addHeapObject(ret);
|
|
627
|
+
},
|
|
628
|
+
__wbg_resolveQuerySet_770f23fabac49845: function(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
629
|
+
getObject(arg0).resolveQuerySet(getObject(arg1), arg2 >>> 0, arg3 >>> 0, getObject(arg4), arg5 >>> 0);
|
|
630
|
+
},
|
|
631
|
+
__wbg_resolve_35ec7e0c6af4c82c: function(arg0) {
|
|
632
|
+
const ret = Promise.resolve(getObject(arg0));
|
|
633
|
+
return addHeapObject(ret);
|
|
634
|
+
},
|
|
635
|
+
__wbg_setBindGroup_0b7c2a055ef1f314: function() {
|
|
636
|
+
return handleError(function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
|
637
|
+
getObject(arg0).setBindGroup(arg1 >>> 0, getObject(arg2), getArrayU32FromWasm0(arg3, arg4), arg5, arg6 >>> 0);
|
|
638
|
+
}, arguments);
|
|
639
|
+
},
|
|
640
|
+
__wbg_setBindGroup_c83391351ce68826: function(arg0, arg1, arg2) {
|
|
641
|
+
getObject(arg0).setBindGroup(arg1 >>> 0, getObject(arg2));
|
|
642
|
+
},
|
|
643
|
+
__wbg_setPipeline_5146f7b8d2b4af5c: function(arg0, arg1) {
|
|
644
|
+
getObject(arg0).setPipeline(getObject(arg1));
|
|
645
|
+
},
|
|
646
|
+
__wbg_set_9cfc0f17d60ff0af: function(arg0, arg1, arg2) {
|
|
647
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
648
|
+
},
|
|
649
|
+
__wbg_set_a377297433dfea63: function() {
|
|
650
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
651
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
652
|
+
return ret;
|
|
653
|
+
}, arguments);
|
|
654
|
+
},
|
|
655
|
+
__wbg_set_access_a099cfbbeec9b96f: function(arg0, arg1) {
|
|
656
|
+
getObject(arg0).access = __wbindgen_enum_GpuStorageTextureAccess[arg1];
|
|
657
|
+
},
|
|
658
|
+
__wbg_set_beginning_of_pass_write_index_fa9ae10d5d2804ce: function(arg0, arg1) {
|
|
659
|
+
getObject(arg0).beginningOfPassWriteIndex = arg1 >>> 0;
|
|
660
|
+
},
|
|
661
|
+
__wbg_set_bind_group_layouts_458c44ba55100b82: function(arg0, arg1, arg2) {
|
|
662
|
+
getObject(arg0).bindGroupLayouts = getArrayJsValueViewFromWasm0(arg1, arg2);
|
|
663
|
+
},
|
|
664
|
+
__wbg_set_binding_81b3fac7f7acaf8d: function(arg0, arg1) {
|
|
665
|
+
getObject(arg0).binding = arg1 >>> 0;
|
|
666
|
+
},
|
|
667
|
+
__wbg_set_binding_b6cee57f35ac5190: function(arg0, arg1) {
|
|
668
|
+
getObject(arg0).binding = arg1 >>> 0;
|
|
669
|
+
},
|
|
670
|
+
__wbg_set_buffer_1548ae88a9188037: function(arg0, arg1) {
|
|
671
|
+
getObject(arg0).buffer = getObject(arg1);
|
|
672
|
+
},
|
|
673
|
+
__wbg_set_buffer_8d0ac64ad20dfc84: function(arg0, arg1) {
|
|
674
|
+
getObject(arg0).buffer = getObject(arg1);
|
|
675
|
+
},
|
|
676
|
+
__wbg_set_code_5d5b0b9e2fd0dca7: function(arg0, arg1, arg2) {
|
|
677
|
+
getObject(arg0).code = getStringFromWasm0(arg1, arg2);
|
|
678
|
+
},
|
|
679
|
+
__wbg_set_compute_bc754d9e37f6e4c9: function(arg0, arg1) {
|
|
680
|
+
getObject(arg0).compute = getObject(arg1);
|
|
681
|
+
},
|
|
682
|
+
__wbg_set_count_d9dc88156fd05bc7: function(arg0, arg1) {
|
|
683
|
+
getObject(arg0).count = arg1 >>> 0;
|
|
684
|
+
},
|
|
685
|
+
__wbg_set_device_210484a77b675c9c: function(arg0, arg1) {
|
|
686
|
+
getObject(arg0).device = getObject(arg1);
|
|
687
|
+
},
|
|
688
|
+
__wbg_set_end_of_pass_write_index_b54a8e3802b9ae0d: function(arg0, arg1) {
|
|
689
|
+
getObject(arg0).endOfPassWriteIndex = arg1 >>> 0;
|
|
690
|
+
},
|
|
691
|
+
__wbg_set_entries_6f866302103b81e9: function(arg0, arg1, arg2) {
|
|
692
|
+
getObject(arg0).entries = getArrayJsValueViewFromWasm0(arg1, arg2);
|
|
693
|
+
},
|
|
694
|
+
__wbg_set_entries_f26b77ab9548e906: function(arg0, arg1, arg2) {
|
|
695
|
+
getObject(arg0).entries = getArrayJsValueViewFromWasm0(arg1, arg2);
|
|
696
|
+
},
|
|
697
|
+
__wbg_set_entry_point_ac8db535971761fe: function(arg0, arg1, arg2) {
|
|
698
|
+
getObject(arg0).entryPoint = getStringFromWasm0(arg1, arg2);
|
|
699
|
+
},
|
|
700
|
+
__wbg_set_external_texture_7f966c604c4f8098: function(arg0, arg1) {
|
|
701
|
+
getObject(arg0).externalTexture = getObject(arg1);
|
|
702
|
+
},
|
|
703
|
+
__wbg_set_format_92732ea75d3b79f5: function(arg0, arg1) {
|
|
704
|
+
getObject(arg0).format = __wbindgen_enum_GpuTextureFormat[arg1];
|
|
705
|
+
},
|
|
706
|
+
__wbg_set_format_f009e603f7d4c28e: function(arg0, arg1) {
|
|
707
|
+
getObject(arg0).format = __wbindgen_enum_GpuTextureFormat[arg1];
|
|
708
|
+
},
|
|
709
|
+
__wbg_set_has_dynamic_offset_0c72ffa900c5a269: function(arg0, arg1) {
|
|
710
|
+
getObject(arg0).hasDynamicOffset = arg1 !== 0;
|
|
711
|
+
},
|
|
712
|
+
__wbg_set_label_09e2da5f8522dbe8: function(arg0, arg1, arg2) {
|
|
713
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
714
|
+
},
|
|
715
|
+
__wbg_set_label_17202740051e9722: function(arg0, arg1, arg2) {
|
|
716
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
717
|
+
},
|
|
718
|
+
__wbg_set_label_17b4858e1eef23dd: function(arg0, arg1, arg2) {
|
|
719
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
720
|
+
},
|
|
721
|
+
__wbg_set_label_2fefb39c0e0dbbe8: function(arg0, arg1, arg2) {
|
|
722
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
723
|
+
},
|
|
724
|
+
__wbg_set_label_612add98a4398f92: function(arg0, arg1, arg2) {
|
|
725
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
726
|
+
},
|
|
727
|
+
__wbg_set_label_6f69e25822616a1b: function(arg0, arg1, arg2) {
|
|
728
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
729
|
+
},
|
|
730
|
+
__wbg_set_label_70a09ee68d6b1b26: function(arg0, arg1, arg2) {
|
|
731
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
732
|
+
},
|
|
733
|
+
__wbg_set_label_92cd3811e96b487c: function(arg0, arg1, arg2) {
|
|
734
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
735
|
+
},
|
|
736
|
+
__wbg_set_label_c7987704d29f284b: function(arg0, arg1, arg2) {
|
|
737
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
738
|
+
},
|
|
739
|
+
__wbg_set_label_cfe64bca8945ee30: function(arg0, arg1, arg2) {
|
|
740
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
741
|
+
},
|
|
742
|
+
__wbg_set_label_ee172cd5f6a96961: function(arg0, arg1, arg2) {
|
|
743
|
+
getObject(arg0).label = getStringFromWasm0(arg1, arg2);
|
|
744
|
+
},
|
|
745
|
+
__wbg_set_layout_454e3a091b390cd4: function(arg0, arg1) {
|
|
746
|
+
getObject(arg0).layout = getObject(arg1);
|
|
747
|
+
},
|
|
748
|
+
__wbg_set_layout_4b5d5b12fbb72a76: function(arg0, arg1) {
|
|
749
|
+
getObject(arg0).layout = getObject(arg1);
|
|
750
|
+
},
|
|
751
|
+
__wbg_set_layout_gpu_auto_layout_mode_ee432e515c357fa8: function(arg0, arg1) {
|
|
752
|
+
getObject(arg0).layout = __wbindgen_enum_GpuAutoLayoutMode[arg1];
|
|
753
|
+
},
|
|
754
|
+
__wbg_set_mapped_at_creation_3f320fef6761b02c: function(arg0, arg1) {
|
|
755
|
+
getObject(arg0).mappedAtCreation = arg1 !== 0;
|
|
756
|
+
},
|
|
757
|
+
__wbg_set_min_binding_size_f64_897e3cd4496ddec9: function(arg0, arg1) {
|
|
758
|
+
getObject(arg0).minBindingSize = arg1;
|
|
759
|
+
},
|
|
760
|
+
__wbg_set_module_c9946af218d23b53: function(arg0, arg1) {
|
|
761
|
+
getObject(arg0).module = getObject(arg1);
|
|
762
|
+
},
|
|
763
|
+
__wbg_set_multisampled_039f032dc4b67367: function(arg0, arg1) {
|
|
764
|
+
getObject(arg0).multisampled = arg1 !== 0;
|
|
765
|
+
},
|
|
766
|
+
__wbg_set_offset_f64_127e8a0aa5c5485a: function(arg0, arg1) {
|
|
767
|
+
getObject(arg0).offset = arg1;
|
|
768
|
+
},
|
|
769
|
+
__wbg_set_onuncapturederror_bb813f1102da2296: function(arg0, arg1) {
|
|
770
|
+
getObject(arg0).onuncapturederror = getObject(arg1);
|
|
771
|
+
},
|
|
772
|
+
__wbg_set_power_preference_b42d00a8facfbade: function(arg0, arg1) {
|
|
773
|
+
getObject(arg0).powerPreference = __wbindgen_enum_GpuPowerPreference[arg1];
|
|
774
|
+
},
|
|
775
|
+
__wbg_set_query_set_f9a94586851fdba2: function(arg0, arg1) {
|
|
776
|
+
getObject(arg0).querySet = getObject(arg1);
|
|
777
|
+
},
|
|
778
|
+
__wbg_set_required_features_bbab71414c45e621: function(arg0, arg1, arg2) {
|
|
779
|
+
getObject(arg0).requiredFeatures = getArrayJsValueViewFromWasm0(arg1, arg2);
|
|
780
|
+
},
|
|
781
|
+
__wbg_set_required_limits_837f62d865e7cfac: function(arg0, arg1) {
|
|
782
|
+
getObject(arg0).requiredLimits = getObject(arg1);
|
|
783
|
+
},
|
|
784
|
+
__wbg_set_resource_8fd8658b30d86ecf: function(arg0, arg1) {
|
|
785
|
+
getObject(arg0).resource = getObject(arg1);
|
|
786
|
+
},
|
|
787
|
+
__wbg_set_resource_gpu_buffer_binding_33099b25da65b610: function(arg0, arg1) {
|
|
788
|
+
getObject(arg0).resource = getObject(arg1);
|
|
789
|
+
},
|
|
790
|
+
__wbg_set_resource_gpu_texture_view_4cffe7bc7c8e5cbe: function(arg0, arg1) {
|
|
791
|
+
getObject(arg0).resource = getObject(arg1);
|
|
792
|
+
},
|
|
793
|
+
__wbg_set_sample_type_ebc5fcd029513bda: function(arg0, arg1) {
|
|
794
|
+
getObject(arg0).sampleType = __wbindgen_enum_GpuTextureSampleType[arg1];
|
|
795
|
+
},
|
|
796
|
+
__wbg_set_sampler_89cb4a7efcfc6005: function(arg0, arg1) {
|
|
797
|
+
getObject(arg0).sampler = getObject(arg1);
|
|
798
|
+
},
|
|
799
|
+
__wbg_set_size_f64_2f591b0654540477: function(arg0, arg1) {
|
|
800
|
+
getObject(arg0).size = arg1;
|
|
801
|
+
},
|
|
802
|
+
__wbg_set_size_f64_e844c985b8f95261: function(arg0, arg1) {
|
|
803
|
+
getObject(arg0).size = arg1;
|
|
804
|
+
},
|
|
805
|
+
__wbg_set_storage_texture_786aea7c5773b6c1: function(arg0, arg1) {
|
|
806
|
+
getObject(arg0).storageTexture = getObject(arg1);
|
|
807
|
+
},
|
|
808
|
+
__wbg_set_texture_a33be3fe02ac6264: function(arg0, arg1) {
|
|
809
|
+
getObject(arg0).texture = getObject(arg1);
|
|
810
|
+
},
|
|
811
|
+
__wbg_set_timestamp_writes_5f240bbaad97fcaf: function(arg0, arg1) {
|
|
812
|
+
getObject(arg0).timestampWrites = getObject(arg1);
|
|
813
|
+
},
|
|
814
|
+
__wbg_set_type_43e0092f16775979: function(arg0, arg1) {
|
|
815
|
+
getObject(arg0).type = __wbindgen_enum_GpuSamplerBindingType[arg1];
|
|
816
|
+
},
|
|
817
|
+
__wbg_set_type_79cec55caf4cdb6d: function(arg0, arg1) {
|
|
818
|
+
getObject(arg0).type = __wbindgen_enum_GpuBufferBindingType[arg1];
|
|
819
|
+
},
|
|
820
|
+
__wbg_set_type_7f7e54057b801caa: function(arg0, arg1) {
|
|
821
|
+
getObject(arg0).type = __wbindgen_enum_GpuQueryType[arg1];
|
|
822
|
+
},
|
|
823
|
+
__wbg_set_usage_f3e34822998d2147: function(arg0, arg1) {
|
|
824
|
+
getObject(arg0).usage = arg1 >>> 0;
|
|
825
|
+
},
|
|
826
|
+
__wbg_set_view_dimension_893e2d16561e56e8: function(arg0, arg1) {
|
|
827
|
+
getObject(arg0).viewDimension = __wbindgen_enum_GpuTextureViewDimension[arg1];
|
|
828
|
+
},
|
|
829
|
+
__wbg_set_view_dimension_f2c5fe4bf927c3fe: function(arg0, arg1) {
|
|
830
|
+
getObject(arg0).viewDimension = __wbindgen_enum_GpuTextureViewDimension[arg1];
|
|
831
|
+
},
|
|
832
|
+
__wbg_set_visibility_d8a6821789538c25: function(arg0, arg1) {
|
|
833
|
+
getObject(arg0).visibility = arg1 >>> 0;
|
|
834
|
+
},
|
|
835
|
+
__wbg_size_00652f74c831ee7c: function(arg0) {
|
|
836
|
+
const ret = getObject(arg0).size;
|
|
837
|
+
return ret;
|
|
838
|
+
},
|
|
839
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
840
|
+
const ret = getObject(arg1).stack;
|
|
841
|
+
const ptr1 = passStringToWasm0(ret, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
|
|
842
|
+
const len1 = WASM_VECTOR_LEN;
|
|
843
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
844
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
845
|
+
},
|
|
846
|
+
__wbg_static_accessor_GLOBAL_8eb4cd83130a11a0: function() {
|
|
847
|
+
const ret = typeof global === "undefined" ? null : global;
|
|
848
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
849
|
+
},
|
|
850
|
+
__wbg_static_accessor_GLOBAL_THIS_1e7044f654e934db: function() {
|
|
851
|
+
const ret = typeof globalThis === "undefined" ? null : globalThis;
|
|
852
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
853
|
+
},
|
|
854
|
+
__wbg_static_accessor_SELF_d8b50611246a6d92: function() {
|
|
855
|
+
const ret = typeof self === "undefined" ? null : self;
|
|
856
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
857
|
+
},
|
|
858
|
+
__wbg_static_accessor_WINDOW_fd0bc376bf0f8b42: function() {
|
|
859
|
+
const ret = typeof window === "undefined" ? null : window;
|
|
860
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
861
|
+
},
|
|
862
|
+
__wbg_subgroupMaxSize_b43be0aa16182403: function(arg0) {
|
|
863
|
+
const ret = getObject(arg0).subgroupMaxSize;
|
|
864
|
+
return ret;
|
|
865
|
+
},
|
|
866
|
+
__wbg_subgroupMinSize_03feb6ee0cda6775: function(arg0) {
|
|
867
|
+
const ret = getObject(arg0).subgroupMinSize;
|
|
868
|
+
return ret;
|
|
869
|
+
},
|
|
870
|
+
__wbg_submit_077c85cc28e36892: function(arg0, arg1, arg2) {
|
|
871
|
+
getObject(arg0).submit(getArrayJsValueViewFromWasm0(arg1, arg2));
|
|
872
|
+
},
|
|
873
|
+
__wbg_then_7a850dae4493f353: function(arg0, arg1, arg2) {
|
|
874
|
+
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
|
|
875
|
+
return addHeapObject(ret);
|
|
876
|
+
},
|
|
877
|
+
__wbg_then_b830475380919203: function(arg0, arg1) {
|
|
878
|
+
const ret = getObject(arg0).then(getObject(arg1));
|
|
879
|
+
return addHeapObject(ret);
|
|
880
|
+
},
|
|
881
|
+
__wbg_unconfigure_835307f58dc68d80: function(arg0) {
|
|
882
|
+
getObject(arg0).unconfigure();
|
|
883
|
+
},
|
|
884
|
+
__wbg_unmap_6a96b14c9ef5f7f5: function(arg0) {
|
|
885
|
+
getObject(arg0).unmap();
|
|
886
|
+
},
|
|
887
|
+
__wbg_usage_eb336a28af1c9fcf: function(arg0) {
|
|
888
|
+
const ret = getObject(arg0).usage;
|
|
889
|
+
return ret;
|
|
890
|
+
},
|
|
891
|
+
__wbg_valueOf_24fc886d85bf55b5: function(arg0) {
|
|
892
|
+
const ret = getObject(arg0).valueOf();
|
|
893
|
+
return addHeapObject(ret);
|
|
894
|
+
},
|
|
895
|
+
__wbg_writeBuffer_f4bb3f54adfe1330: function() {
|
|
896
|
+
return handleError(function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
|
897
|
+
getObject(arg0).writeBuffer(getObject(arg1), arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
|
|
898
|
+
}, arguments);
|
|
899
|
+
},
|
|
900
|
+
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
901
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12285);
|
|
902
|
+
return addHeapObject(ret);
|
|
903
|
+
},
|
|
904
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
905
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_10965);
|
|
906
|
+
return addHeapObject(ret);
|
|
907
|
+
},
|
|
908
|
+
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
909
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_10966);
|
|
910
|
+
return addHeapObject(ret);
|
|
911
|
+
},
|
|
912
|
+
__wbindgen_generic_0000000000000004: function(arg0, arg1) {
|
|
913
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_10965_14);
|
|
914
|
+
return addHeapObject(ret);
|
|
915
|
+
},
|
|
916
|
+
__wbindgen_generic_0000000000000005: function(arg0, arg1) {
|
|
917
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_10965_15);
|
|
918
|
+
return addHeapObject(ret);
|
|
919
|
+
},
|
|
920
|
+
__wbindgen_generic_0000000000000006: function(arg0) {
|
|
921
|
+
const ret = arg0;
|
|
922
|
+
return addHeapObject(ret);
|
|
923
|
+
},
|
|
924
|
+
__wbindgen_generic_0000000000000007: function(arg0, arg1) {
|
|
925
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
926
|
+
return addHeapObject(ret);
|
|
927
|
+
},
|
|
928
|
+
__wbindgen_generic_0000000000000008: function(arg0, arg1) {
|
|
929
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
930
|
+
return addHeapObject(ret);
|
|
931
|
+
},
|
|
932
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
933
|
+
const ret = getObject(arg0);
|
|
934
|
+
return addHeapObject(ret);
|
|
935
|
+
},
|
|
936
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
937
|
+
takeObject(arg0);
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
return {
|
|
941
|
+
__proto__: null,
|
|
942
|
+
"./pie_browser_bg.js": import0,
|
|
943
|
+
"./platform.mjs": platform_exports,
|
|
944
|
+
"./platform.mjs": platform_exports,
|
|
945
|
+
"./platform.mjs": platform_exports,
|
|
946
|
+
"./platform.mjs": platform_exports
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
function __wasm_bindgen_func_elem_10966(arg0, arg1, arg2) {
|
|
950
|
+
wasm2.__wasm_bindgen_func_elem_10966(arg0, arg1, addHeapObject(arg2));
|
|
951
|
+
}
|
|
952
|
+
function __wasm_bindgen_func_elem_12287(arg0, arg1, arg2, arg3) {
|
|
953
|
+
wasm2.__wasm_bindgen_func_elem_12287(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
954
|
+
}
|
|
955
|
+
function __wasm_bindgen_func_elem_12285(arg0, arg1, arg2) {
|
|
956
|
+
try {
|
|
957
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
958
|
+
wasm2.__wasm_bindgen_func_elem_12285(retptr, arg0, arg1, addHeapObject(arg2));
|
|
959
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
960
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
961
|
+
if (r1) {
|
|
962
|
+
throw takeObject(r0);
|
|
963
|
+
}
|
|
964
|
+
} finally {
|
|
965
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
function __wasm_bindgen_func_elem_10965(arg0, arg1, arg2) {
|
|
969
|
+
try {
|
|
970
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
971
|
+
wasm2.__wasm_bindgen_func_elem_10965(retptr, arg0, arg1, addHeapObject(arg2));
|
|
972
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
973
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
974
|
+
if (r1) {
|
|
975
|
+
throw takeObject(r0);
|
|
976
|
+
}
|
|
977
|
+
} finally {
|
|
978
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
function __wasm_bindgen_func_elem_10965_14(arg0, arg1, arg2) {
|
|
982
|
+
try {
|
|
983
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
984
|
+
wasm2.__wasm_bindgen_func_elem_10965_14(retptr, arg0, arg1, addHeapObject(arg2));
|
|
985
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
986
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
987
|
+
if (r1) {
|
|
988
|
+
throw takeObject(r0);
|
|
989
|
+
}
|
|
990
|
+
} finally {
|
|
991
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
function __wasm_bindgen_func_elem_10965_15(arg0, arg1, arg2) {
|
|
995
|
+
try {
|
|
996
|
+
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
997
|
+
wasm2.__wasm_bindgen_func_elem_10965_15(retptr, arg0, arg1, addHeapObject(arg2));
|
|
998
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
999
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1000
|
+
if (r1) {
|
|
1001
|
+
throw takeObject(r0);
|
|
1002
|
+
}
|
|
1003
|
+
} finally {
|
|
1004
|
+
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
var __wbindgen_enum_GpuAutoLayoutMode = ["auto"];
|
|
1008
|
+
var __wbindgen_enum_GpuBufferBindingType = ["uniform", "storage", "read-only-storage"];
|
|
1009
|
+
var __wbindgen_enum_GpuErrorFilter = ["validation", "out-of-memory", "internal"];
|
|
1010
|
+
var __wbindgen_enum_GpuPowerPreference = ["low-power", "high-performance"];
|
|
1011
|
+
var __wbindgen_enum_GpuQueryType = ["occlusion", "timestamp"];
|
|
1012
|
+
var __wbindgen_enum_GpuSamplerBindingType = ["filtering", "non-filtering", "comparison"];
|
|
1013
|
+
var __wbindgen_enum_GpuStorageTextureAccess = ["write-only", "read-only", "read-write"];
|
|
1014
|
+
var __wbindgen_enum_GpuTextureFormat = ["r8unorm", "r8snorm", "r8uint", "r8sint", "r16unorm", "r16snorm", "r16uint", "r16sint", "r16float", "rg8unorm", "rg8snorm", "rg8uint", "rg8sint", "r32uint", "r32sint", "r32float", "rg16unorm", "rg16snorm", "rg16uint", "rg16sint", "rg16float", "rgba8unorm", "rgba8unorm-srgb", "rgba8snorm", "rgba8uint", "rgba8sint", "bgra8unorm", "bgra8unorm-srgb", "rgb9e5ufloat", "rgb10a2uint", "rgb10a2unorm", "rg11b10ufloat", "rg32uint", "rg32sint", "rg32float", "rgba16unorm", "rgba16snorm", "rgba16uint", "rgba16sint", "rgba16float", "rgba32uint", "rgba32sint", "rgba32float", "stencil8", "depth16unorm", "depth24plus", "depth24plus-stencil8", "depth32float", "depth32float-stencil8", "bc1-rgba-unorm", "bc1-rgba-unorm-srgb", "bc2-rgba-unorm", "bc2-rgba-unorm-srgb", "bc3-rgba-unorm", "bc3-rgba-unorm-srgb", "bc4-r-unorm", "bc4-r-snorm", "bc5-rg-unorm", "bc5-rg-snorm", "bc6h-rgb-ufloat", "bc6h-rgb-float", "bc7-rgba-unorm", "bc7-rgba-unorm-srgb", "etc2-rgb8unorm", "etc2-rgb8unorm-srgb", "etc2-rgb8a1unorm", "etc2-rgb8a1unorm-srgb", "etc2-rgba8unorm", "etc2-rgba8unorm-srgb", "eac-r11unorm", "eac-r11snorm", "eac-rg11unorm", "eac-rg11snorm", "astc-4x4-unorm", "astc-4x4-unorm-srgb", "astc-5x4-unorm", "astc-5x4-unorm-srgb", "astc-5x5-unorm", "astc-5x5-unorm-srgb", "astc-6x5-unorm", "astc-6x5-unorm-srgb", "astc-6x6-unorm", "astc-6x6-unorm-srgb", "astc-8x5-unorm", "astc-8x5-unorm-srgb", "astc-8x6-unorm", "astc-8x6-unorm-srgb", "astc-8x8-unorm", "astc-8x8-unorm-srgb", "astc-10x5-unorm", "astc-10x5-unorm-srgb", "astc-10x6-unorm", "astc-10x6-unorm-srgb", "astc-10x8-unorm", "astc-10x8-unorm-srgb", "astc-10x10-unorm", "astc-10x10-unorm-srgb", "astc-12x10-unorm", "astc-12x10-unorm-srgb", "astc-12x12-unorm", "astc-12x12-unorm-srgb"];
|
|
1015
|
+
var __wbindgen_enum_GpuTextureSampleType = ["float", "unfilterable-float", "depth", "sint", "uint"];
|
|
1016
|
+
var __wbindgen_enum_GpuTextureViewDimension = ["1d", "2d", "2d-array", "cube", "cube-array", "3d"];
|
|
1017
|
+
function addHeapObject(obj) {
|
|
1018
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
1019
|
+
const idx = heap_next;
|
|
1020
|
+
heap_next = heap[idx];
|
|
1021
|
+
heap[idx] = obj;
|
|
1022
|
+
return idx;
|
|
1023
|
+
}
|
|
1024
|
+
var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
1025
|
+
}, unregister: () => {
|
|
1026
|
+
} } : new FinalizationRegistry((state) => wasm2.__wbindgen_export5(state.a, state.b));
|
|
1027
|
+
function debugString(val) {
|
|
1028
|
+
const type = typeof val;
|
|
1029
|
+
if (type == "number" || type == "boolean" || val == null) {
|
|
1030
|
+
return `${val}`;
|
|
1031
|
+
}
|
|
1032
|
+
if (type == "string") {
|
|
1033
|
+
return `"${val}"`;
|
|
1034
|
+
}
|
|
1035
|
+
if (type == "symbol") {
|
|
1036
|
+
const description = val.description;
|
|
1037
|
+
if (description == null) {
|
|
1038
|
+
return "Symbol";
|
|
1039
|
+
} else {
|
|
1040
|
+
return `Symbol(${description})`;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
if (type == "function") {
|
|
1044
|
+
const name = val.name;
|
|
1045
|
+
if (typeof name == "string" && name.length > 0) {
|
|
1046
|
+
return `Function(${name})`;
|
|
1047
|
+
} else {
|
|
1048
|
+
return "Function";
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
if (Array.isArray(val)) {
|
|
1052
|
+
const length = val.length;
|
|
1053
|
+
let debug = "[";
|
|
1054
|
+
if (length > 0) {
|
|
1055
|
+
debug += debugString(val[0]);
|
|
1056
|
+
}
|
|
1057
|
+
for (let i = 1; i < length; i++) {
|
|
1058
|
+
debug += ", " + debugString(val[i]);
|
|
1059
|
+
}
|
|
1060
|
+
debug += "]";
|
|
1061
|
+
return debug;
|
|
1062
|
+
}
|
|
1063
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
1064
|
+
let className;
|
|
1065
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
1066
|
+
className = builtInMatches[1];
|
|
1067
|
+
} else {
|
|
1068
|
+
return toString.call(val);
|
|
1069
|
+
}
|
|
1070
|
+
if (className == "Object") {
|
|
1071
|
+
try {
|
|
1072
|
+
return "Object(" + JSON.stringify(val) + ")";
|
|
1073
|
+
} catch (_) {
|
|
1074
|
+
return "Object";
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
if (val instanceof Error) {
|
|
1078
|
+
return `${val.name}: ${val.message}
|
|
1079
|
+
${val.stack}`;
|
|
1080
|
+
}
|
|
1081
|
+
return className;
|
|
1082
|
+
}
|
|
1083
|
+
function dropObject(idx) {
|
|
1084
|
+
if (idx < 1028) return;
|
|
1085
|
+
heap[idx] = heap_next;
|
|
1086
|
+
heap_next = idx;
|
|
1087
|
+
}
|
|
1088
|
+
function getArrayJsValueViewFromWasm0(ptr, len) {
|
|
1089
|
+
ptr = ptr >>> 0;
|
|
1090
|
+
const mem = getDataViewMemory0();
|
|
1091
|
+
const result = [];
|
|
1092
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
1093
|
+
result.push(getObject(mem.getUint32(i, true)));
|
|
1094
|
+
}
|
|
1095
|
+
return result;
|
|
1096
|
+
}
|
|
1097
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
1098
|
+
ptr = ptr >>> 0;
|
|
1099
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
1100
|
+
}
|
|
1101
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1102
|
+
ptr = ptr >>> 0;
|
|
1103
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1104
|
+
}
|
|
1105
|
+
var cachedDataViewMemory0 = null;
|
|
1106
|
+
function getDataViewMemory0() {
|
|
1107
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm2.memory.buffer) {
|
|
1108
|
+
cachedDataViewMemory0 = new DataView(wasm2.memory.buffer);
|
|
1109
|
+
}
|
|
1110
|
+
return cachedDataViewMemory0;
|
|
1111
|
+
}
|
|
1112
|
+
function getStringFromWasm0(ptr, len) {
|
|
1113
|
+
return decodeText(ptr >>> 0, len);
|
|
1114
|
+
}
|
|
1115
|
+
var cachedUint32ArrayMemory0 = null;
|
|
1116
|
+
function getUint32ArrayMemory0() {
|
|
1117
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
1118
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm2.memory.buffer);
|
|
1119
|
+
}
|
|
1120
|
+
return cachedUint32ArrayMemory0;
|
|
1121
|
+
}
|
|
1122
|
+
var cachedUint8ArrayMemory0 = null;
|
|
1123
|
+
function getUint8ArrayMemory0() {
|
|
1124
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1125
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm2.memory.buffer);
|
|
1126
|
+
}
|
|
1127
|
+
return cachedUint8ArrayMemory0;
|
|
1128
|
+
}
|
|
1129
|
+
function getObject(idx) {
|
|
1130
|
+
return heap[idx];
|
|
1131
|
+
}
|
|
1132
|
+
function handleError(f, args) {
|
|
1133
|
+
try {
|
|
1134
|
+
return f.apply(this, args);
|
|
1135
|
+
} catch (e) {
|
|
1136
|
+
wasm2.__wbindgen_export3(addHeapObject(e));
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
var heap = new Array(1024).fill(void 0);
|
|
1140
|
+
heap.push(void 0, null, true, false);
|
|
1141
|
+
var heap_next = heap.length;
|
|
1142
|
+
function isLikeNone(x) {
|
|
1143
|
+
return x === void 0 || x === null;
|
|
1144
|
+
}
|
|
1145
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
1146
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
1147
|
+
const real = (...args) => {
|
|
1148
|
+
state.cnt++;
|
|
1149
|
+
const a = state.a;
|
|
1150
|
+
state.a = 0;
|
|
1151
|
+
try {
|
|
1152
|
+
return f(a, state.b, ...args);
|
|
1153
|
+
} finally {
|
|
1154
|
+
state.a = a;
|
|
1155
|
+
real._wbg_cb_unref();
|
|
1156
|
+
}
|
|
1157
|
+
};
|
|
1158
|
+
real._wbg_cb_unref = () => {
|
|
1159
|
+
if (--state.cnt === 0) {
|
|
1160
|
+
wasm2.__wbindgen_export5(state.a, state.b);
|
|
1161
|
+
state.a = 0;
|
|
1162
|
+
CLOSURE_DTORS.unregister(state);
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
1166
|
+
return real;
|
|
1167
|
+
}
|
|
1168
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1169
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1170
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1171
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1172
|
+
return ptr;
|
|
1173
|
+
}
|
|
1174
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1175
|
+
if (realloc === void 0) {
|
|
1176
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1177
|
+
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
1178
|
+
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
1179
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1180
|
+
return ptr2;
|
|
1181
|
+
}
|
|
1182
|
+
let len = arg.length;
|
|
1183
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1184
|
+
const mem = getUint8ArrayMemory0();
|
|
1185
|
+
let offset = 0;
|
|
1186
|
+
for (; offset < len; offset++) {
|
|
1187
|
+
const code = arg.charCodeAt(offset);
|
|
1188
|
+
if (code > 127) break;
|
|
1189
|
+
mem[ptr + offset] = code;
|
|
1190
|
+
}
|
|
1191
|
+
if (offset !== len) {
|
|
1192
|
+
if (offset !== 0) {
|
|
1193
|
+
arg = arg.slice(offset);
|
|
1194
|
+
}
|
|
1195
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1196
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1197
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1198
|
+
offset += ret.written;
|
|
1199
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1200
|
+
}
|
|
1201
|
+
WASM_VECTOR_LEN = offset;
|
|
1202
|
+
return ptr;
|
|
1203
|
+
}
|
|
1204
|
+
function takeObject(idx) {
|
|
1205
|
+
const ret = getObject(idx);
|
|
1206
|
+
dropObject(idx);
|
|
1207
|
+
return ret;
|
|
1208
|
+
}
|
|
1209
|
+
var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
1210
|
+
cachedTextDecoder.decode();
|
|
1211
|
+
var MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
1212
|
+
var numBytesDecoded = 0;
|
|
1213
|
+
function decodeText(ptr, len) {
|
|
1214
|
+
numBytesDecoded += len;
|
|
1215
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
1216
|
+
cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
1217
|
+
cachedTextDecoder.decode();
|
|
1218
|
+
numBytesDecoded = len;
|
|
1219
|
+
}
|
|
1220
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1221
|
+
}
|
|
1222
|
+
var cachedTextEncoder = new TextEncoder();
|
|
1223
|
+
if (!("encodeInto" in cachedTextEncoder)) {
|
|
1224
|
+
cachedTextEncoder.encodeInto = function(arg, view) {
|
|
1225
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1226
|
+
view.set(buf);
|
|
1227
|
+
return {
|
|
1228
|
+
read: arg.length,
|
|
1229
|
+
written: buf.length
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
var WASM_VECTOR_LEN = 0;
|
|
1234
|
+
var wasmModule;
|
|
1235
|
+
var wasmInstance;
|
|
1236
|
+
var wasm2;
|
|
1237
|
+
function __wbg_finalize_init(instance, module) {
|
|
1238
|
+
wasmInstance = instance;
|
|
1239
|
+
wasm2 = instance.exports;
|
|
1240
|
+
wasmModule = module;
|
|
1241
|
+
cachedDataViewMemory0 = null;
|
|
1242
|
+
cachedUint32ArrayMemory0 = null;
|
|
1243
|
+
cachedUint8ArrayMemory0 = null;
|
|
1244
|
+
return wasm2;
|
|
1245
|
+
}
|
|
1246
|
+
async function __wbg_load(module, imports) {
|
|
1247
|
+
if (typeof Response === "function" && module instanceof Response) {
|
|
1248
|
+
if (!module.ok) {
|
|
1249
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
1250
|
+
}
|
|
1251
|
+
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
1252
|
+
try {
|
|
1253
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1254
|
+
} catch (e) {
|
|
1255
|
+
const validResponse = expectedResponseType(module.type);
|
|
1256
|
+
if (validResponse && module.headers.get("Content-Type") !== "application/wasm") {
|
|
1257
|
+
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);
|
|
1258
|
+
} else {
|
|
1259
|
+
throw e;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
const bytes = await module.arrayBuffer();
|
|
1264
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1265
|
+
} else {
|
|
1266
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1267
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1268
|
+
return { instance, module };
|
|
1269
|
+
} else {
|
|
1270
|
+
return instance;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
function expectedResponseType(type) {
|
|
1274
|
+
switch (type) {
|
|
1275
|
+
case "basic":
|
|
1276
|
+
case "cors":
|
|
1277
|
+
case "default":
|
|
1278
|
+
return true;
|
|
1279
|
+
}
|
|
1280
|
+
return false;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
async function __wbg_init(module_or_path) {
|
|
1284
|
+
if (wasm2 !== void 0) return wasm2;
|
|
1285
|
+
if (module_or_path !== void 0) {
|
|
1286
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1287
|
+
({ module_or_path } = module_or_path);
|
|
1288
|
+
} else {
|
|
1289
|
+
console.warn("using deprecated parameters for the initialization function; pass a single object instead");
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
if (module_or_path === void 0) {
|
|
1293
|
+
module_or_path = new URL("pie_browser_bg.wasm", import.meta.url);
|
|
1294
|
+
}
|
|
1295
|
+
const imports = __wbg_get_imports();
|
|
1296
|
+
if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {
|
|
1297
|
+
module_or_path = fetch(module_or_path);
|
|
1298
|
+
}
|
|
1299
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1300
|
+
return __wbg_finalize_init(instance, module);
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
// src/worker.mjs
|
|
1304
|
+
globalThis.__pieHost = {
|
|
1305
|
+
fetchRange(offset, len, request) {
|
|
1306
|
+
queueMicrotask(() => pie_range_failed(request, "no artifact is being served lazily"));
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
var wasm3 = null;
|
|
1310
|
+
var tick = null;
|
|
1311
|
+
var cacheFill = null;
|
|
1312
|
+
var CACHE_FILE_LIMIT = 1900 * 1048576;
|
|
1313
|
+
async function fillCache(href, dir, key, size) {
|
|
1314
|
+
const res = await fetch(href);
|
|
1315
|
+
if (!res.ok) throw new Error(`${href}: ${res.status}`);
|
|
1316
|
+
const handle = await dir.getFileHandle(key, { create: true });
|
|
1317
|
+
const writable = await handle.createWritable();
|
|
1318
|
+
const reader = res.body.getReader();
|
|
1319
|
+
let got = 0;
|
|
1320
|
+
try {
|
|
1321
|
+
for (; ; ) {
|
|
1322
|
+
const { done, value } = await reader.read();
|
|
1323
|
+
if (done) break;
|
|
1324
|
+
await writable.write(value);
|
|
1325
|
+
got += value.length;
|
|
1326
|
+
}
|
|
1327
|
+
if (got !== size) throw new Error(`cache fill got ${got} of ${size} bytes`);
|
|
1328
|
+
await writable.close();
|
|
1329
|
+
console.log(`pie: artifact cached for the next visit (${(size / 1048576).toFixed(0)} MiB)`);
|
|
1330
|
+
} catch (e) {
|
|
1331
|
+
try {
|
|
1332
|
+
await writable.abort();
|
|
1333
|
+
} catch {
|
|
1334
|
+
}
|
|
1335
|
+
try {
|
|
1336
|
+
await dir.removeEntry(key);
|
|
1337
|
+
} catch {
|
|
1338
|
+
}
|
|
1339
|
+
throw e;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
var tickScheduled = false;
|
|
1343
|
+
var tickRunning = false;
|
|
1344
|
+
var timer = null;
|
|
1345
|
+
function scheduleTick(delayMs = 0) {
|
|
1346
|
+
if (tickScheduled && (timer === null || delayMs > 0)) return;
|
|
1347
|
+
tickScheduled = true;
|
|
1348
|
+
if (timer) {
|
|
1349
|
+
clearTimeout(timer);
|
|
1350
|
+
timer = null;
|
|
1351
|
+
}
|
|
1352
|
+
const run = async () => {
|
|
1353
|
+
tickScheduled = false;
|
|
1354
|
+
if (tickRunning) {
|
|
1355
|
+
tickScheduled = true;
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
tickRunning = true;
|
|
1359
|
+
let next;
|
|
1360
|
+
try {
|
|
1361
|
+
next = await tick();
|
|
1362
|
+
} finally {
|
|
1363
|
+
tickRunning = false;
|
|
1364
|
+
}
|
|
1365
|
+
if (tickScheduled) {
|
|
1366
|
+
tickScheduled = false;
|
|
1367
|
+
scheduleTick(0);
|
|
1368
|
+
} else if (next >= 0) {
|
|
1369
|
+
scheduleTick(next);
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
if (delayMs <= 0) queueMicrotask(run);
|
|
1373
|
+
else timer = setTimeout(() => {
|
|
1374
|
+
timer = null;
|
|
1375
|
+
run();
|
|
1376
|
+
}, delayMs);
|
|
1377
|
+
}
|
|
1378
|
+
var afterMessages = null;
|
|
1379
|
+
function scheduleTickAfterMessages() {
|
|
1380
|
+
if (afterMessages === null) {
|
|
1381
|
+
const channel = new MessageChannel();
|
|
1382
|
+
channel.port1.onmessage = () => {
|
|
1383
|
+
afterMessages.armed = false;
|
|
1384
|
+
scheduleTick(0);
|
|
1385
|
+
};
|
|
1386
|
+
afterMessages = { port: channel.port2, armed: false };
|
|
1387
|
+
}
|
|
1388
|
+
if (afterMessages.armed) return;
|
|
1389
|
+
afterMessages.armed = true;
|
|
1390
|
+
afterMessages.port.postMessage(null);
|
|
1391
|
+
}
|
|
1392
|
+
async function driven(promise) {
|
|
1393
|
+
scheduleTick(0);
|
|
1394
|
+
return await promise;
|
|
1395
|
+
}
|
|
1396
|
+
async function describe(url) {
|
|
1397
|
+
const head = await fetch(url, { method: "HEAD" }).catch(() => null);
|
|
1398
|
+
const size = Number(head?.headers.get("content-length") ?? 0);
|
|
1399
|
+
const etag = head?.headers.get("etag") ?? "";
|
|
1400
|
+
return { size, etag };
|
|
1401
|
+
}
|
|
1402
|
+
function cacheKey(name, size, etag) {
|
|
1403
|
+
return `${name}|${size}|${etag}`.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
1404
|
+
}
|
|
1405
|
+
async function cacheDir() {
|
|
1406
|
+
try {
|
|
1407
|
+
return await navigator.storage?.getDirectory?.() ?? null;
|
|
1408
|
+
} catch {
|
|
1409
|
+
return null;
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
var host = {
|
|
1413
|
+
async load(wasmUrl, logFilter) {
|
|
1414
|
+
if (wasm3) throw new Error("pie: the wasm is already loaded");
|
|
1415
|
+
wasm3 = await __wbg_init({ module_or_path: wasmUrl });
|
|
1416
|
+
attach(wasm3, () => scheduleTick(0));
|
|
1417
|
+
tick = WebAssembly.promising(wasm3.pie_tick);
|
|
1418
|
+
pie_init(logFilter);
|
|
1419
|
+
return { worker: typeof WorkerGlobalScope !== "undefined" };
|
|
1420
|
+
},
|
|
1421
|
+
async bootLazy(url, config, base, onProgress) {
|
|
1422
|
+
cacheFill = null;
|
|
1423
|
+
const href = new URL(url, base ?? location.href).href;
|
|
1424
|
+
const { size, etag } = await describe(href);
|
|
1425
|
+
if (!size) throw new Error(`${url}: the server sent no content-length; a lazy boot needs the size up front`);
|
|
1426
|
+
let file = null;
|
|
1427
|
+
const dir = await cacheDir();
|
|
1428
|
+
if (dir) {
|
|
1429
|
+
try {
|
|
1430
|
+
const cached = await (await dir.getFileHandle(cacheKey(url, size, etag))).getFile();
|
|
1431
|
+
if (cached.size === size) file = cached;
|
|
1432
|
+
} catch {
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
const from = file ? "cache" : "network";
|
|
1436
|
+
let served = 0;
|
|
1437
|
+
let requests = 0;
|
|
1438
|
+
const range = async (offset, len) => {
|
|
1439
|
+
requests += 1;
|
|
1440
|
+
let bytes;
|
|
1441
|
+
if (file) {
|
|
1442
|
+
bytes = new Uint8Array(await file.slice(offset, offset + len).arrayBuffer());
|
|
1443
|
+
} else {
|
|
1444
|
+
const res = await fetch(href, { headers: { range: `bytes=${offset}-${offset + len - 1}` } });
|
|
1445
|
+
if (res.status !== 206) {
|
|
1446
|
+
throw new Error(`${url}: the server answered ${res.status} to a range request; a lazy boot needs ranges (206)`);
|
|
1447
|
+
}
|
|
1448
|
+
bytes = new Uint8Array(await res.arrayBuffer());
|
|
1449
|
+
}
|
|
1450
|
+
if (bytes.length !== len) throw new Error(`${url}: range ${offset}+${len} came back as ${bytes.length} bytes`);
|
|
1451
|
+
served += len;
|
|
1452
|
+
onProgress?.(served, size, from);
|
|
1453
|
+
return bytes;
|
|
1454
|
+
};
|
|
1455
|
+
const refuse = globalThis.__pieHost.fetchRange;
|
|
1456
|
+
globalThis.__pieHost.fetchRange = (offset, len, request) => {
|
|
1457
|
+
range(offset, len).then(
|
|
1458
|
+
(bytes) => pie_range_ready(request, bytes),
|
|
1459
|
+
(e) => pie_range_failed(request, String(e?.message ?? e))
|
|
1460
|
+
);
|
|
1461
|
+
};
|
|
1462
|
+
const t0 = performance.now();
|
|
1463
|
+
let summary;
|
|
1464
|
+
try {
|
|
1465
|
+
summary = JSON.parse(await driven(pie_boot_lazy(config, url.split("/").pop(), size)));
|
|
1466
|
+
} finally {
|
|
1467
|
+
globalThis.__pieHost.fetchRange = refuse;
|
|
1468
|
+
console.log(`pie: lazy boot served ${requests} range request(s), ${(served / 1048576).toFixed(0)} MiB from ${from}, in ${(performance.now() - t0).toFixed(0)} ms`);
|
|
1469
|
+
}
|
|
1470
|
+
if (!file && dir && size <= CACHE_FILE_LIMIT) {
|
|
1471
|
+
cacheFill = fillCache(href, dir, cacheKey(url, size, etag), size).catch((e) => {
|
|
1472
|
+
console.warn("pie: background artifact cache fill failed:", e);
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
return summary;
|
|
1476
|
+
},
|
|
1477
|
+
async awaitCache() {
|
|
1478
|
+
await cacheFill;
|
|
1479
|
+
},
|
|
1480
|
+
async installLanguage(language, wasmBytes) {
|
|
1481
|
+
return await driven(pie_install_language(language, wasmBytes));
|
|
1482
|
+
},
|
|
1483
|
+
async install(wasmBytes, manifestToml) {
|
|
1484
|
+
return await driven(pie_install_program(wasmBytes, manifestToml));
|
|
1485
|
+
},
|
|
1486
|
+
async memoryBytes() {
|
|
1487
|
+
return wasm3.memory.buffer.byteLength;
|
|
1488
|
+
},
|
|
1489
|
+
async openSession() {
|
|
1490
|
+
return pie_open_session();
|
|
1491
|
+
},
|
|
1492
|
+
async closeSession(id) {
|
|
1493
|
+
pie_close_session(id);
|
|
1494
|
+
},
|
|
1495
|
+
async sendFrame(id, frame) {
|
|
1496
|
+
pie_send_frame(id, frame);
|
|
1497
|
+
scheduleTickAfterMessages();
|
|
1498
|
+
},
|
|
1499
|
+
async recvFrames(id, maxWaitMs, max) {
|
|
1500
|
+
return await driven(pie_recv_frames(id, maxWaitMs, max));
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
function transferables(value) {
|
|
1504
|
+
if (value instanceof Uint8Array) return [value.buffer];
|
|
1505
|
+
if (Array.isArray(value)) return value.filter((v) => v instanceof Uint8Array).map((v) => v.buffer);
|
|
1506
|
+
return [];
|
|
1507
|
+
}
|
|
1508
|
+
if (typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope) {
|
|
1509
|
+
self.onmessage = async ({ data }) => {
|
|
1510
|
+
const { id, op, args = [] } = data;
|
|
1511
|
+
let lastProgress = 0;
|
|
1512
|
+
const progress = (got, total, from) => {
|
|
1513
|
+
const now = performance.now();
|
|
1514
|
+
if (got < total && now - lastProgress < 50) return;
|
|
1515
|
+
lastProgress = now;
|
|
1516
|
+
self.postMessage({ id, progress: [got, total, from] });
|
|
1517
|
+
};
|
|
1518
|
+
try {
|
|
1519
|
+
const fn = host[op];
|
|
1520
|
+
if (typeof fn !== "function") throw new Error(`pie: unknown op ${op}`);
|
|
1521
|
+
const value = await fn.call(host, ...args, progress);
|
|
1522
|
+
self.postMessage({ id, ok: true, value }, transferables(value));
|
|
1523
|
+
} catch (e) {
|
|
1524
|
+
self.postMessage({ id, ok: false, error: String(e?.message ?? e) });
|
|
1525
|
+
}
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
export {
|
|
1529
|
+
host,
|
|
1530
|
+
transferables
|
|
1531
|
+
};
|