@microsoft/webui 0.0.22 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,928 @@
1
+ /* @ts-self-types="./webui_wasm_all.d.ts" */
2
+
3
+ /**
4
+ * A decoded protocol with reusable indices for repeated WASM renders.
5
+ */
6
+ export class Protocol {
7
+ __destroy_into_raw() {
8
+ const ptr = this.__wbg_ptr;
9
+ this.__wbg_ptr = 0;
10
+ ProtocolFinalization.unregister(this);
11
+ return ptr;
12
+ }
13
+ free() {
14
+ const ptr = this.__destroy_into_raw();
15
+ wasm.__wbg_protocol_free(ptr, 0);
16
+ }
17
+ /**
18
+ * Decode protobuf bytes once for repeated rendering.
19
+ * @param {Uint8Array} protocol_bytes
20
+ * @param {string | null} [plugin]
21
+ */
22
+ constructor(protocol_bytes, plugin) {
23
+ try {
24
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
25
+ const ptr0 = passArray8ToWasm0(protocol_bytes, wasm.__wbindgen_export);
26
+ const len0 = WASM_VECTOR_LEN;
27
+ var ptr1 = isLikeNone(plugin) ? 0 : passStringToWasm0(plugin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
28
+ var len1 = WASM_VECTOR_LEN;
29
+ wasm.protocol_new(retptr, ptr0, len0, ptr1, len1);
30
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
31
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
32
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
33
+ if (r2) {
34
+ throw takeObject(r1);
35
+ }
36
+ this.__wbg_ptr = r0;
37
+ ProtocolFinalization.register(this, this.__wbg_ptr, this);
38
+ return this;
39
+ } finally {
40
+ wasm.__wbindgen_add_to_stack_pointer(16);
41
+ }
42
+ }
43
+ /**
44
+ * Render from an existing JSON string.
45
+ * @param {string} state_json
46
+ * @param {object | null} [options]
47
+ * @returns {string}
48
+ */
49
+ render(state_json, options) {
50
+ let deferred3_0;
51
+ let deferred3_1;
52
+ try {
53
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
54
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
55
+ const len0 = WASM_VECTOR_LEN;
56
+ wasm.protocol_render(retptr, this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
57
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
58
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
59
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
60
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
61
+ var ptr2 = r0;
62
+ var len2 = r1;
63
+ if (r3) {
64
+ ptr2 = 0; len2 = 0;
65
+ throw takeObject(r2);
66
+ }
67
+ deferred3_0 = ptr2;
68
+ deferred3_1 = len2;
69
+ return getStringFromWasm0(ptr2, len2);
70
+ } finally {
71
+ wasm.__wbindgen_add_to_stack_pointer(16);
72
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
73
+ }
74
+ }
75
+ /**
76
+ * Return component template payloads for requested component tags.
77
+ * @param {any} component_tags
78
+ * @param {string} inventory_hex
79
+ * @returns {string}
80
+ */
81
+ renderComponentTemplates(component_tags, inventory_hex) {
82
+ let deferred3_0;
83
+ let deferred3_1;
84
+ try {
85
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
86
+ const ptr0 = passStringToWasm0(inventory_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
87
+ const len0 = WASM_VECTOR_LEN;
88
+ wasm.protocol_renderComponentTemplates(retptr, this.__wbg_ptr, addHeapObject(component_tags), ptr0, len0);
89
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
90
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
91
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
92
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
93
+ var ptr2 = r0;
94
+ var len2 = r1;
95
+ if (r3) {
96
+ ptr2 = 0; len2 = 0;
97
+ throw takeObject(r2);
98
+ }
99
+ deferred3_0 = ptr2;
100
+ deferred3_1 = len2;
101
+ return getStringFromWasm0(ptr2, len2);
102
+ } finally {
103
+ wasm.__wbindgen_add_to_stack_pointer(16);
104
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
105
+ }
106
+ }
107
+ /**
108
+ * Produce a complete partial-navigation response.
109
+ * @param {string} state_json
110
+ * @param {string} entry_id
111
+ * @param {string} request_path
112
+ * @param {string} inventory_hex
113
+ * @returns {string}
114
+ */
115
+ renderPartial(state_json, entry_id, request_path, inventory_hex) {
116
+ let deferred6_0;
117
+ let deferred6_1;
118
+ try {
119
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
120
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
121
+ const len0 = WASM_VECTOR_LEN;
122
+ const ptr1 = passStringToWasm0(entry_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
123
+ const len1 = WASM_VECTOR_LEN;
124
+ const ptr2 = passStringToWasm0(request_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
125
+ const len2 = WASM_VECTOR_LEN;
126
+ const ptr3 = passStringToWasm0(inventory_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
127
+ const len3 = WASM_VECTOR_LEN;
128
+ wasm.protocol_renderPartial(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
129
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
130
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
131
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
132
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
133
+ var ptr5 = r0;
134
+ var len5 = r1;
135
+ if (r3) {
136
+ ptr5 = 0; len5 = 0;
137
+ throw takeObject(r2);
138
+ }
139
+ deferred6_0 = ptr5;
140
+ deferred6_1 = len5;
141
+ return getStringFromWasm0(ptr5, len5);
142
+ } finally {
143
+ wasm.__wbindgen_add_to_stack_pointer(16);
144
+ wasm.__wbindgen_export4(deferred6_0, deferred6_1, 1);
145
+ }
146
+ }
147
+ /**
148
+ * Stream from an existing JSON string in bounded chunks.
149
+ * @param {string} state_json
150
+ * @param {Function} on_chunk
151
+ * @param {object | null} [options]
152
+ */
153
+ renderStream(state_json, on_chunk, options) {
154
+ try {
155
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
156
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
157
+ const len0 = WASM_VECTOR_LEN;
158
+ wasm.protocol_renderStream(retptr, this.__wbg_ptr, ptr0, len0, addBorrowedObject(on_chunk), isLikeNone(options) ? 0 : addHeapObject(options));
159
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
160
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
161
+ if (r1) {
162
+ throw takeObject(r0);
163
+ }
164
+ } finally {
165
+ wasm.__wbindgen_add_to_stack_pointer(16);
166
+ heap[stack_pointer++] = undefined;
167
+ }
168
+ }
169
+ /**
170
+ * Open a host-driven progressive response for a streaming entry.
171
+ *
172
+ * Unlike `renderStream`, which pushes every chunk through one callback
173
+ * during a single synchronous call, the returned session hands each chunk
174
+ * back so the host owns the socket, the write order, and backpressure.
175
+ * @param {string} entry
176
+ * @param {string} request_path
177
+ * @param {object | null} [options]
178
+ * @returns {StreamingSession}
179
+ */
180
+ streamResponse(entry, request_path, options) {
181
+ try {
182
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
183
+ const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_export, wasm.__wbindgen_export2);
184
+ const len0 = WASM_VECTOR_LEN;
185
+ const ptr1 = passStringToWasm0(request_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
186
+ const len1 = WASM_VECTOR_LEN;
187
+ wasm.protocol_streamResponse(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(options) ? 0 : addHeapObject(options));
188
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
189
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
190
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
191
+ if (r2) {
192
+ throw takeObject(r1);
193
+ }
194
+ return StreamingSession.__wrap(r0);
195
+ } finally {
196
+ wasm.__wbindgen_add_to_stack_pointer(16);
197
+ }
198
+ }
199
+ /**
200
+ * Return CSS token names in build order.
201
+ * @returns {any}
202
+ */
203
+ tokens() {
204
+ try {
205
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
206
+ wasm.protocol_tokens(retptr, this.__wbg_ptr);
207
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
208
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
209
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
210
+ if (r2) {
211
+ throw takeObject(r1);
212
+ }
213
+ return takeObject(r0);
214
+ } finally {
215
+ wasm.__wbindgen_add_to_stack_pointer(16);
216
+ }
217
+ }
218
+ }
219
+ if (Symbol.dispose) Protocol.prototype[Symbol.dispose] = Protocol.prototype.free;
220
+
221
+ /**
222
+ * A progressive HTML response driven one chunk at a time from JavaScript.
223
+ *
224
+ * Every method returns the UTF-8 bytes it produced. Write them to the
225
+ * response and apply the host's own backpressure; the session holds no
226
+ * transport and never blocks on one.
227
+ *
228
+ * ```js
229
+ * const session = protocol.streamResponse('index.html', '/');
230
+ * const weather = session.boundary('weather-shell');
231
+ * controller.enqueue(session.writeShell(shellState));
232
+ * controller.enqueue(session.writeBoundary(weather, weatherState, 'updatable'));
233
+ * controller.enqueue(session.update(weather, forecast));
234
+ * controller.enqueue(session.finish(tailState));
235
+ * ```
236
+ */
237
+ export class StreamingSession {
238
+ static __wrap(ptr) {
239
+ const obj = Object.create(StreamingSession.prototype);
240
+ obj.__wbg_ptr = ptr;
241
+ StreamingSessionFinalization.register(obj, obj.__wbg_ptr, obj);
242
+ return obj;
243
+ }
244
+ __destroy_into_raw() {
245
+ const ptr = this.__wbg_ptr;
246
+ this.__wbg_ptr = 0;
247
+ StreamingSessionFinalization.unregister(this);
248
+ return ptr;
249
+ }
250
+ free() {
251
+ const ptr = this.__destroy_into_raw();
252
+ wasm.__wbg_streamingsession_free(ptr, 0);
253
+ }
254
+ /**
255
+ * Resolve an authored boundary name to a stable integer handle.
256
+ *
257
+ * Resolve once outside the write loop; the handle costs nothing to reuse.
258
+ * @param {string} name
259
+ * @returns {number}
260
+ */
261
+ boundary(name) {
262
+ try {
263
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
264
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
265
+ const len0 = WASM_VECTOR_LEN;
266
+ wasm.streamingsession_boundary(retptr, this.__wbg_ptr, ptr0, len0);
267
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
268
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
269
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
270
+ if (r2) {
271
+ throw takeObject(r1);
272
+ }
273
+ return r0 >>> 0;
274
+ } finally {
275
+ wasm.__wbindgen_add_to_stack_pointer(16);
276
+ }
277
+ }
278
+ /**
279
+ * Number of compile-time boundaries declared by this entry.
280
+ * @returns {number}
281
+ */
282
+ get boundaryCount() {
283
+ const ret = wasm.streamingsession_boundaryCount(this.__wbg_ptr);
284
+ return ret >>> 0;
285
+ }
286
+ /**
287
+ * Render the document tail and emit the terminal record.
288
+ * @param {string} state_json
289
+ * @returns {Uint8Array}
290
+ */
291
+ finish(state_json) {
292
+ try {
293
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
294
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
295
+ const len0 = WASM_VECTOR_LEN;
296
+ wasm.streamingsession_finish(retptr, this.__wbg_ptr, ptr0, len0);
297
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
298
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
299
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
300
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
301
+ if (r3) {
302
+ throw takeObject(r2);
303
+ }
304
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
305
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
306
+ return v2;
307
+ } finally {
308
+ wasm.__wbindgen_add_to_stack_pointer(16);
309
+ }
310
+ }
311
+ /**
312
+ * Whether the terminal record has been written.
313
+ * @returns {boolean}
314
+ */
315
+ get finished() {
316
+ const ret = wasm.streamingsession_finished(this.__wbg_ptr);
317
+ return ret !== 0;
318
+ }
319
+ /**
320
+ * Push a projected state patch to a committed updatable boundary.
321
+ * @param {number} boundary
322
+ * @param {string} state_json
323
+ * @returns {Uint8Array}
324
+ */
325
+ update(boundary, state_json) {
326
+ try {
327
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
328
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
329
+ const len0 = WASM_VECTOR_LEN;
330
+ wasm.streamingsession_update(retptr, this.__wbg_ptr, boundary, ptr0, len0);
331
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
332
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
333
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
334
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
335
+ if (r3) {
336
+ throw takeObject(r2);
337
+ }
338
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
339
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
340
+ return v2;
341
+ } finally {
342
+ wasm.__wbindgen_add_to_stack_pointer(16);
343
+ }
344
+ }
345
+ /**
346
+ * Render and commit the next boundary in declaration order.
347
+ *
348
+ * `mode` is `"final"` (default) or `"updatable"`. Only updatable
349
+ * boundaries accept later `update()` calls.
350
+ * @param {number} boundary
351
+ * @param {string} state_json
352
+ * @param {string | null} [mode]
353
+ * @returns {Uint8Array}
354
+ */
355
+ writeBoundary(boundary, state_json, mode) {
356
+ try {
357
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
358
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
359
+ const len0 = WASM_VECTOR_LEN;
360
+ var ptr1 = isLikeNone(mode) ? 0 : passStringToWasm0(mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
361
+ var len1 = WASM_VECTOR_LEN;
362
+ wasm.streamingsession_writeBoundary(retptr, this.__wbg_ptr, boundary, ptr0, len0, ptr1, len1);
363
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
364
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
365
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
366
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
367
+ if (r3) {
368
+ throw takeObject(r2);
369
+ }
370
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
371
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
372
+ return v3;
373
+ } finally {
374
+ wasm.__wbindgen_add_to_stack_pointer(16);
375
+ }
376
+ }
377
+ /**
378
+ * Render everything before the first boundary.
379
+ * @param {string} state_json
380
+ * @returns {Uint8Array}
381
+ */
382
+ writeShell(state_json) {
383
+ try {
384
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
385
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
386
+ const len0 = WASM_VECTOR_LEN;
387
+ wasm.streamingsession_writeShell(retptr, this.__wbg_ptr, ptr0, len0);
388
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
389
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
390
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
391
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
392
+ if (r3) {
393
+ throw takeObject(r2);
394
+ }
395
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
396
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
397
+ return v2;
398
+ } finally {
399
+ wasm.__wbindgen_add_to_stack_pointer(16);
400
+ }
401
+ }
402
+ }
403
+ if (Symbol.dispose) StreamingSession.prototype[Symbol.dispose] = StreamingSession.prototype.free;
404
+
405
+ /**
406
+ * Build protocol protobuf bytes from virtual files without rendering.
407
+ *
408
+ * Returns the serialized `WebUIProtocol` as protobuf bytes.
409
+ * @param {any} files
410
+ * @param {string} entry
411
+ * @param {any | null} [projection_manifests]
412
+ * @returns {Uint8Array}
413
+ */
414
+ export function build_protocol(files, entry, projection_manifests) {
415
+ try {
416
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
417
+ const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_export, wasm.__wbindgen_export2);
418
+ const len0 = WASM_VECTOR_LEN;
419
+ wasm.build_protocol(retptr, addHeapObject(files), ptr0, len0, isLikeNone(projection_manifests) ? 0 : addHeapObject(projection_manifests));
420
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
421
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
422
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
423
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
424
+ if (r3) {
425
+ throw takeObject(r2);
426
+ }
427
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
428
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
429
+ return v2;
430
+ } finally {
431
+ wasm.__wbindgen_add_to_stack_pointer(16);
432
+ }
433
+ }
434
+ function __wbg_get_imports() {
435
+ const import0 = {
436
+ __proto__: null,
437
+ __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
438
+ const ret = Error(getStringFromWasm0(arg0, arg1));
439
+ return addHeapObject(ret);
440
+ },
441
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
442
+ const ret = String(getObject(arg1));
443
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
444
+ const len1 = WASM_VECTOR_LEN;
445
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
446
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
447
+ },
448
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
449
+ const v = getObject(arg0);
450
+ const ret = typeof(v) === 'boolean' ? v : undefined;
451
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
452
+ },
453
+ __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
454
+ const ret = debugString(getObject(arg1));
455
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
456
+ const len1 = WASM_VECTOR_LEN;
457
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
458
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
459
+ },
460
+ __wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
461
+ const ret = getObject(arg0) in getObject(arg1);
462
+ return ret;
463
+ },
464
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
465
+ const ret = typeof(getObject(arg0)) === 'function';
466
+ return ret;
467
+ },
468
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
469
+ const ret = getObject(arg0) === null;
470
+ return ret;
471
+ },
472
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
473
+ const val = getObject(arg0);
474
+ const ret = typeof(val) === 'object' && val !== null;
475
+ return ret;
476
+ },
477
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
478
+ const ret = getObject(arg0) === undefined;
479
+ return ret;
480
+ },
481
+ __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
482
+ const ret = getObject(arg0) == getObject(arg1);
483
+ return ret;
484
+ },
485
+ __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
486
+ const obj = getObject(arg1);
487
+ const ret = typeof(obj) === 'number' ? obj : undefined;
488
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
489
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
490
+ },
491
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
492
+ const obj = getObject(arg1);
493
+ const ret = typeof(obj) === 'string' ? obj : undefined;
494
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
495
+ var len1 = WASM_VECTOR_LEN;
496
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
497
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
498
+ },
499
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
500
+ throw new Error(getStringFromWasm0(arg0, arg1));
501
+ },
502
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
503
+ const ret = getObject(arg0).call(getObject(arg1));
504
+ return addHeapObject(ret);
505
+ }, arguments); },
506
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
507
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
508
+ return addHeapObject(ret);
509
+ }, arguments); },
510
+ __wbg_done_89b2b13e91a60321: function(arg0) {
511
+ const ret = getObject(arg0).done;
512
+ return ret;
513
+ },
514
+ __wbg_entries_015dc610cd81ede0: function(arg0) {
515
+ const ret = Object.entries(getObject(arg0));
516
+ return addHeapObject(ret);
517
+ },
518
+ __wbg_get_507a50627bffa49b: function(arg0, arg1) {
519
+ const ret = getObject(arg0)[arg1 >>> 0];
520
+ return addHeapObject(ret);
521
+ },
522
+ __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
523
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
524
+ return addHeapObject(ret);
525
+ }, arguments); },
526
+ __wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
527
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
528
+ return addHeapObject(ret);
529
+ }, arguments); },
530
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
531
+ const ret = getObject(arg0)[arg1 >>> 0];
532
+ return addHeapObject(ret);
533
+ },
534
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
535
+ const ret = getObject(arg0)[getObject(arg1)];
536
+ return addHeapObject(ret);
537
+ },
538
+ __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
539
+ let result;
540
+ try {
541
+ result = getObject(arg0) instanceof ArrayBuffer;
542
+ } catch (_) {
543
+ result = false;
544
+ }
545
+ const ret = result;
546
+ return ret;
547
+ },
548
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
549
+ let result;
550
+ try {
551
+ result = getObject(arg0) instanceof Uint8Array;
552
+ } catch (_) {
553
+ result = false;
554
+ }
555
+ const ret = result;
556
+ return ret;
557
+ },
558
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
559
+ const ret = Array.isArray(getObject(arg0));
560
+ return ret;
561
+ },
562
+ __wbg_iterator_6f722e4a93058b71: function() {
563
+ const ret = Symbol.iterator;
564
+ return addHeapObject(ret);
565
+ },
566
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
567
+ const ret = getObject(arg0).length;
568
+ return ret;
569
+ },
570
+ __wbg_length_370319915dc99107: function(arg0) {
571
+ const ret = getObject(arg0).length;
572
+ return ret;
573
+ },
574
+ __wbg_new_32b398fb48b6d94a: function() {
575
+ const ret = new Array();
576
+ return addHeapObject(ret);
577
+ },
578
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
579
+ const ret = new Uint8Array(getObject(arg0));
580
+ return addHeapObject(ret);
581
+ },
582
+ __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
583
+ const ret = getObject(arg0).next;
584
+ return addHeapObject(ret);
585
+ },
586
+ __wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
587
+ const ret = getObject(arg0).next();
588
+ return addHeapObject(ret);
589
+ }, arguments); },
590
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
591
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
592
+ },
593
+ __wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
594
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
595
+ },
596
+ __wbg_value_a5d5488a9589444a: function(arg0) {
597
+ const ret = getObject(arg0).value;
598
+ return addHeapObject(ret);
599
+ },
600
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
601
+ // Cast intrinsic for `Ref(String) -> Externref`.
602
+ const ret = getStringFromWasm0(arg0, arg1);
603
+ return addHeapObject(ret);
604
+ },
605
+ __wbindgen_object_clone_ref: function(arg0) {
606
+ const ret = getObject(arg0);
607
+ return addHeapObject(ret);
608
+ },
609
+ __wbindgen_object_drop_ref: function(arg0) {
610
+ takeObject(arg0);
611
+ },
612
+ };
613
+ return {
614
+ __proto__: null,
615
+ "./webui_wasm_all_bg.js": import0,
616
+ };
617
+ }
618
+
619
+ const ProtocolFinalization = (typeof FinalizationRegistry === 'undefined')
620
+ ? { register: () => {}, unregister: () => {} }
621
+ : new FinalizationRegistry(ptr => wasm.__wbg_protocol_free(ptr, 1));
622
+ const StreamingSessionFinalization = (typeof FinalizationRegistry === 'undefined')
623
+ ? { register: () => {}, unregister: () => {} }
624
+ : new FinalizationRegistry(ptr => wasm.__wbg_streamingsession_free(ptr, 1));
625
+
626
+ function addHeapObject(obj) {
627
+ if (heap_next === heap.length) heap.push(heap.length + 1);
628
+ const idx = heap_next;
629
+ heap_next = heap[idx];
630
+
631
+ heap[idx] = obj;
632
+ return idx;
633
+ }
634
+
635
+ function addBorrowedObject(obj) {
636
+ if (stack_pointer == 1) throw new Error('out of js stack');
637
+ heap[--stack_pointer] = obj;
638
+ return stack_pointer;
639
+ }
640
+
641
+ function debugString(val) {
642
+ // primitive types
643
+ const type = typeof val;
644
+ if (type == 'number' || type == 'boolean' || val == null) {
645
+ return `${val}`;
646
+ }
647
+ if (type == 'string') {
648
+ return `"${val}"`;
649
+ }
650
+ if (type == 'symbol') {
651
+ const description = val.description;
652
+ if (description == null) {
653
+ return 'Symbol';
654
+ } else {
655
+ return `Symbol(${description})`;
656
+ }
657
+ }
658
+ if (type == 'function') {
659
+ const name = val.name;
660
+ if (typeof name == 'string' && name.length > 0) {
661
+ return `Function(${name})`;
662
+ } else {
663
+ return 'Function';
664
+ }
665
+ }
666
+ // objects
667
+ if (Array.isArray(val)) {
668
+ const length = val.length;
669
+ let debug = '[';
670
+ if (length > 0) {
671
+ debug += debugString(val[0]);
672
+ }
673
+ for(let i = 1; i < length; i++) {
674
+ debug += ', ' + debugString(val[i]);
675
+ }
676
+ debug += ']';
677
+ return debug;
678
+ }
679
+ // Test for built-in
680
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
681
+ let className;
682
+ if (builtInMatches && builtInMatches.length > 1) {
683
+ className = builtInMatches[1];
684
+ } else {
685
+ // Failed to match the standard '[object ClassName]'
686
+ return toString.call(val);
687
+ }
688
+ if (className == 'Object') {
689
+ // we're a user defined class or Object
690
+ // JSON.stringify avoids problems with cycles, and is generally much
691
+ // easier than looping through ownProperties of `val`.
692
+ try {
693
+ return 'Object(' + JSON.stringify(val) + ')';
694
+ } catch (_) {
695
+ return 'Object';
696
+ }
697
+ }
698
+ // errors
699
+ if (val instanceof Error) {
700
+ return `${val.name}: ${val.message}\n${val.stack}`;
701
+ }
702
+ // TODO we could test for more things here, like `Set`s and `Map`s.
703
+ return className;
704
+ }
705
+
706
+ function dropObject(idx) {
707
+ if (idx < 1028) return;
708
+ heap[idx] = heap_next;
709
+ heap_next = idx;
710
+ }
711
+
712
+ function getArrayU8FromWasm0(ptr, len) {
713
+ ptr = ptr >>> 0;
714
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
715
+ }
716
+
717
+ let cachedDataViewMemory0 = null;
718
+ function getDataViewMemory0() {
719
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
720
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
721
+ }
722
+ return cachedDataViewMemory0;
723
+ }
724
+
725
+ function getStringFromWasm0(ptr, len) {
726
+ return decodeText(ptr >>> 0, len);
727
+ }
728
+
729
+ let cachedUint8ArrayMemory0 = null;
730
+ function getUint8ArrayMemory0() {
731
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
732
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
733
+ }
734
+ return cachedUint8ArrayMemory0;
735
+ }
736
+
737
+ function getObject(idx) { return heap[idx]; }
738
+
739
+ function handleError(f, args) {
740
+ try {
741
+ return f.apply(this, args);
742
+ } catch (e) {
743
+ wasm.__wbindgen_export3(addHeapObject(e));
744
+ }
745
+ }
746
+
747
+ let heap = new Array(1024).fill(undefined);
748
+ heap.push(undefined, null, true, false);
749
+
750
+ let heap_next = heap.length;
751
+
752
+ function isLikeNone(x) {
753
+ return x === undefined || x === null;
754
+ }
755
+
756
+ function passArray8ToWasm0(arg, malloc) {
757
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
758
+ getUint8ArrayMemory0().set(arg, ptr / 1);
759
+ WASM_VECTOR_LEN = arg.length;
760
+ return ptr;
761
+ }
762
+
763
+ function passStringToWasm0(arg, malloc, realloc) {
764
+ if (realloc === undefined) {
765
+ const buf = cachedTextEncoder.encode(arg);
766
+ const ptr = malloc(buf.length, 1) >>> 0;
767
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
768
+ WASM_VECTOR_LEN = buf.length;
769
+ return ptr;
770
+ }
771
+
772
+ let len = arg.length;
773
+ let ptr = malloc(len, 1) >>> 0;
774
+
775
+ const mem = getUint8ArrayMemory0();
776
+
777
+ let offset = 0;
778
+
779
+ for (; offset < len; offset++) {
780
+ const code = arg.charCodeAt(offset);
781
+ if (code > 0x7F) break;
782
+ mem[ptr + offset] = code;
783
+ }
784
+ if (offset !== len) {
785
+ if (offset !== 0) {
786
+ arg = arg.slice(offset);
787
+ }
788
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
789
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
790
+ const ret = cachedTextEncoder.encodeInto(arg, view);
791
+
792
+ offset += ret.written;
793
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
794
+ }
795
+
796
+ WASM_VECTOR_LEN = offset;
797
+ return ptr;
798
+ }
799
+
800
+ let stack_pointer = 1024;
801
+
802
+ function takeObject(idx) {
803
+ const ret = getObject(idx);
804
+ dropObject(idx);
805
+ return ret;
806
+ }
807
+
808
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
809
+ cachedTextDecoder.decode();
810
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
811
+ let numBytesDecoded = 0;
812
+ function decodeText(ptr, len) {
813
+ numBytesDecoded += len;
814
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
815
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
816
+ cachedTextDecoder.decode();
817
+ numBytesDecoded = len;
818
+ }
819
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
820
+ }
821
+
822
+ const cachedTextEncoder = new TextEncoder();
823
+
824
+ if (!('encodeInto' in cachedTextEncoder)) {
825
+ cachedTextEncoder.encodeInto = function (arg, view) {
826
+ const buf = cachedTextEncoder.encode(arg);
827
+ view.set(buf);
828
+ return {
829
+ read: arg.length,
830
+ written: buf.length
831
+ };
832
+ };
833
+ }
834
+
835
+ let WASM_VECTOR_LEN = 0;
836
+
837
+ let wasmModule, wasmInstance, wasm;
838
+ function __wbg_finalize_init(instance, module) {
839
+ wasmInstance = instance;
840
+ wasm = instance.exports;
841
+ wasmModule = module;
842
+ cachedDataViewMemory0 = null;
843
+ cachedUint8ArrayMemory0 = null;
844
+ return wasm;
845
+ }
846
+
847
+ async function __wbg_load(module, imports) {
848
+ if (typeof Response === 'function' && module instanceof Response) {
849
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
850
+ try {
851
+ return await WebAssembly.instantiateStreaming(module, imports);
852
+ } catch (e) {
853
+ const validResponse = module.ok && expectedResponseType(module.type);
854
+
855
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
856
+ 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);
857
+
858
+ } else { throw e; }
859
+ }
860
+ }
861
+
862
+ const bytes = await module.arrayBuffer();
863
+ return await WebAssembly.instantiate(bytes, imports);
864
+ } else {
865
+ const instance = await WebAssembly.instantiate(module, imports);
866
+
867
+ if (instance instanceof WebAssembly.Instance) {
868
+ return { instance, module };
869
+ } else {
870
+ return instance;
871
+ }
872
+ }
873
+
874
+ function expectedResponseType(type) {
875
+ switch (type) {
876
+ case 'basic': case 'cors': case 'default': return true;
877
+ }
878
+ return false;
879
+ }
880
+ }
881
+
882
+ function initSync(module) {
883
+ if (wasm !== undefined) return wasm;
884
+
885
+
886
+ if (module !== undefined) {
887
+ if (Object.getPrototypeOf(module) === Object.prototype) {
888
+ ({module} = module)
889
+ } else {
890
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
891
+ }
892
+ }
893
+
894
+ const imports = __wbg_get_imports();
895
+ if (!(module instanceof WebAssembly.Module)) {
896
+ module = new WebAssembly.Module(module);
897
+ }
898
+ const instance = new WebAssembly.Instance(module, imports);
899
+ return __wbg_finalize_init(instance, module);
900
+ }
901
+
902
+ async function __wbg_init(module_or_path) {
903
+ if (wasm !== undefined) return wasm;
904
+
905
+
906
+ if (module_or_path !== undefined) {
907
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
908
+ ({module_or_path} = module_or_path)
909
+ } else {
910
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
911
+ }
912
+ }
913
+
914
+ if (module_or_path === undefined) {
915
+ module_or_path = new URL('webui_wasm_all_bg.wasm', import.meta.url);
916
+ }
917
+ const imports = __wbg_get_imports();
918
+
919
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
920
+ module_or_path = fetch(module_or_path);
921
+ }
922
+
923
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
924
+
925
+ return __wbg_finalize_init(instance, module);
926
+ }
927
+
928
+ export { initSync, __wbg_init as default };