@reearth/ezu 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,715 @@
1
+ /**
2
+ * Buffered log sink that captures `tracing` events from the renderer.
3
+ *
4
+ * Construct once near the top of your bootstrap, then either set a
5
+ * callback for live forwarding (`onEvent(e => console.log(e))`) or
6
+ * `drainLines()` periodically to flush into a UI panel.
7
+ */
8
+ export class LogSink {
9
+ __destroy_into_raw() {
10
+ const ptr = this.__wbg_ptr;
11
+ this.__wbg_ptr = 0;
12
+ LogSinkFinalization.unregister(this);
13
+ return ptr;
14
+ }
15
+ free() {
16
+ const ptr = this.__destroy_into_raw();
17
+ wasm.__wbg_logsink_free(ptr, 0);
18
+ }
19
+ /**
20
+ * Drop all buffered records without returning them.
21
+ */
22
+ clear() {
23
+ wasm.logsink_clear(this.__wbg_ptr);
24
+ }
25
+ /**
26
+ * Drain every buffered record. Returns a JS array of structured
27
+ * objects `{ level, target, message, fields, timestampMs }`.
28
+ * @returns {Array<any>}
29
+ */
30
+ drain() {
31
+ const ret = wasm.logsink_drain(this.__wbg_ptr);
32
+ return ret;
33
+ }
34
+ /**
35
+ * Drain buffered records and return pre-formatted strings — the
36
+ * same shape the CLI prints. Convenient for `console.log(lines.join('\n'))`.
37
+ * @returns {string[]}
38
+ */
39
+ drainLines() {
40
+ const ret = wasm.logsink_drainLines(this.__wbg_ptr);
41
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
42
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
43
+ return v1;
44
+ }
45
+ /**
46
+ * `true` if no records are buffered.
47
+ * @returns {boolean}
48
+ */
49
+ isEmpty() {
50
+ const ret = wasm.logsink_isEmpty(this.__wbg_ptr);
51
+ return ret !== 0;
52
+ }
53
+ /**
54
+ * Number of records currently buffered.
55
+ * @returns {number}
56
+ */
57
+ get len() {
58
+ const ret = wasm.logsink_len(this.__wbg_ptr);
59
+ return ret >>> 0;
60
+ }
61
+ /**
62
+ * Install (idempotently) the global tracing subscriber. `level` is
63
+ * an `EnvFilter` string — e.g. `"info"`, `"debug"`,
64
+ * `"info,ezu_graph::eval=debug"`. Honoured on first call only.
65
+ * @param {string} level
66
+ */
67
+ constructor(level) {
68
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
69
+ const len0 = WASM_VECTOR_LEN;
70
+ const ret = wasm.logsink_new(ptr0, len0);
71
+ if (ret[2]) {
72
+ throw takeFromExternrefTable0(ret[1]);
73
+ }
74
+ this.__wbg_ptr = ret[0];
75
+ LogSinkFinalization.register(this, this.__wbg_ptr, this);
76
+ return this;
77
+ }
78
+ /**
79
+ * Set (or clear with `null` / `undefined`) the per-event JS
80
+ * callback. The callback receives a structured record object.
81
+ *
82
+ * No-op in multithreaded (`threads`) builds — events can originate
83
+ * on rayon worker threads, so live forwarding to a main-thread JS
84
+ * callback isn't available. Use `drain` / `drainLines` instead.
85
+ * @param {Function | null} [callback]
86
+ */
87
+ onEvent(callback) {
88
+ wasm.logsink_onEvent(this.__wbg_ptr, isLikeNone(callback) ? 0 : addToExternrefTable0(callback));
89
+ }
90
+ /**
91
+ * Resize the ring-buffer cap. Older entries are evicted FIFO once
92
+ * the buffer reaches the new cap. Default is 4096.
93
+ * @param {number} cap
94
+ */
95
+ setCapacity(cap) {
96
+ wasm.logsink_setCapacity(this.__wbg_ptr, cap);
97
+ }
98
+ }
99
+ if (Symbol.dispose) LogSink.prototype[Symbol.dispose] = LogSink.prototype.free;
100
+
101
+ /**
102
+ * Stateful WASM renderer.
103
+ */
104
+ export class Renderer {
105
+ __destroy_into_raw() {
106
+ const ptr = this.__wbg_ptr;
107
+ this.__wbg_ptr = 0;
108
+ RendererFinalization.unregister(this);
109
+ return ptr;
110
+ }
111
+ free() {
112
+ const ptr = this.__destroy_into_raw();
113
+ wasm.__wbg_renderer_free(ptr, 0);
114
+ }
115
+ /**
116
+ * Effective attribution declared by the style (document +
117
+ * sources), joined with ` | `. Upstream TileJSON / PMTiles
118
+ * metadata is the JS host's concern — merge it on that side.
119
+ * @returns {string | undefined}
120
+ */
121
+ get attribution() {
122
+ const ret = wasm.renderer_attribution(this.__wbg_ptr);
123
+ let v1;
124
+ if (ret[0] !== 0) {
125
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
126
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
127
+ }
128
+ return v1;
129
+ }
130
+ /**
131
+ * Bind raw tile bytes under a `sources.<name>` entry from the style.
132
+ * The renderer dispatches on the source's declared `type`:
133
+ *
134
+ * - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
135
+ * offset (centre `coord: [0, 0]`, the default). Layers are bound as
136
+ * `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
137
+ * (neighbours) when [`render_tile`] runs. Binding only the centre
138
+ * degrades cross-tile label collision to centre-only at borders.
139
+ * - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
140
+ * offset. The centre tile is `coord: [0, 0]` (default). Decoding
141
+ * and 3×3 stitching happen at render time once the tile id is known.
142
+ * - `geojson` (remote) → store raw bytes per `(dx, dy)` offset;
143
+ * projected per tile (and neighbour) at render time.
144
+ *
145
+ * `opts` is a JS object: `{ coord?: [dx, dy] }`. Throws
146
+ * `UnknownSource` if `name` doesn't match any entry in the style's
147
+ * `sources` block, `MvtDecode` if MVT bytes don't parse, and
148
+ * `DemDecode` for non-image DEM bytes (the decode itself runs at
149
+ * render time, but obvious cases are caught here).
150
+ * @param {string} name
151
+ * @param {Uint8Array} bytes
152
+ * @param {object | null} [opts]
153
+ */
154
+ bindSource(name, bytes, opts) {
155
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
156
+ const len0 = WASM_VECTOR_LEN;
157
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc_command_export);
158
+ const len1 = WASM_VECTOR_LEN;
159
+ const ret = wasm.renderer_bindSource(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
160
+ if (ret[1]) {
161
+ throw takeFromExternrefTable0(ret[0]);
162
+ }
163
+ }
164
+ /**
165
+ * Names of every source with at least one pending binding.
166
+ * Order matches the style's `sources` declaration order.
167
+ * @returns {string[]}
168
+ */
169
+ boundSources() {
170
+ const ret = wasm.renderer_boundSources(this.__wbg_ptr);
171
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
172
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
173
+ return v1;
174
+ }
175
+ /**
176
+ * Drop every pending source binding. Call between tile renders.
177
+ */
178
+ clearSources() {
179
+ wasm.renderer_clearSources(this.__wbg_ptr);
180
+ }
181
+ /**
182
+ * What this renderer is holding, in bytes, so a host can shed load
183
+ * *before* an allocation fails rather than after.
184
+ *
185
+ * Returns a JS object:
186
+ * - `heapBytes` — wasm linear memory committed to the **module**,
187
+ * shared by every `Renderer` in this instance. This is the number
188
+ * that meets an isolate's memory cap. It is a high-water mark:
189
+ * freeing Rust values returns them to the allocator, never to the
190
+ * host, so it only ever grows.
191
+ * - `glyphBytes` / `glyphRanges` — SDF bitmaps resident in the
192
+ * glyph bank, and how many 256-codepoint blocks they span. Glyphs
193
+ * accumulate for the life of the renderer and survive
194
+ * `clearSources`, so on a long-lived instance this is usually
195
+ * what grew. `glyphBudget` is the per-fontstack ceiling
196
+ * `setGlyphBudget` put on them, or `Infinity` if none — note
197
+ * `glyphBytes` totals *every* fontstack, so it can exceed the
198
+ * budget legitimately.
199
+ * - `fontBytes` — outline font files held in the font bank.
200
+ * - `imageBytes` — decoded pixels of bound images and sprite
201
+ * atlases.
202
+ * - `cacheBytes` / `cacheBudget` — the render cache's pixel
203
+ * payload against its own eviction budget; it bounds itself, so
204
+ * `cacheBytes` near `cacheBudget` is steady state, not a leak.
205
+ *
206
+ * These are payload sizes, not an accounting of the heap: they omit
207
+ * allocator overhead, decoded features, per-font glyph-path caches,
208
+ * and the buffers a render is using right now. Expect the parts to
209
+ * sum to less than `heapBytes`.
210
+ * @returns {object}
211
+ */
212
+ memoryUsage() {
213
+ const ret = wasm.renderer_memoryUsage(this.__wbg_ptr);
214
+ if (ret[2]) {
215
+ throw takeFromExternrefTable0(ret[1]);
216
+ }
217
+ return takeFromExternrefTable0(ret[0]);
218
+ }
219
+ /**
220
+ * Codepoints the currently bound features can require, as
221
+ * `{ [glyphsSourceName]: number[] }` sorted ascending.
222
+ *
223
+ * This is the precise form of
224
+ * [`neededGlyphRanges`](Self::needed_glyph_ranges): a host that
225
+ * can build its own glyph PBF — one message holding just these
226
+ * codepoints — transfers only the glyphs the tile draws instead
227
+ * of the whole 256-codepoint block around each of them. On CJK
228
+ * labels that is the difference between a few thousand glyphs and
229
+ * a few tens of megabytes. `bindSource` files each glyph by its
230
+ * own id, so such a subset may span any number of blocks and
231
+ * needs no particular `range` string.
232
+ *
233
+ * Hosts that can only fetch whole `{range}.pbf` files off a
234
+ * MapLibre glyphs endpoint want `neededGlyphRanges` instead. Both
235
+ * calls see the same set of codepoints and carry the same
236
+ * over-approximation caveat.
237
+ * @returns {object}
238
+ */
239
+ neededCodepoints() {
240
+ const ret = wasm.renderer_neededCodepoints(this.__wbg_ptr);
241
+ if (ret[2]) {
242
+ throw takeFromExternrefTable0(ret[1]);
243
+ }
244
+ return takeFromExternrefTable0(ret[0]);
245
+ }
246
+ /**
247
+ * Glyph ranges the currently bound features can require, as
248
+ * `{ [glyphsSourceName]: number[] }` where each number is a range
249
+ * start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
250
+ * `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
251
+ *
252
+ * This host cannot fetch glyph ranges lazily, so every range a
253
+ * tile's labels touch must be bound before `renderTile`. Rather than
254
+ * scraping every string in the MVT, call this after binding the
255
+ * vector sources and bind exactly the listed ranges.
256
+ *
257
+ * A range holds 256 codepoints and a tile typically draws a
258
+ * handful of them, so this is a coarse unit to fetch in. Hosts
259
+ * that can assemble their own subset PBF should call
260
+ * [`neededCodepoints`](Self::needed_codepoints) instead.
261
+ *
262
+ * It is an over-approximation, deliberately: a range is listed if
263
+ * *any* feature in a text layer carries the codepoint in a property
264
+ * the layer's `text` expression reads, without evaluating filters,
265
+ * zoom ranges, or the expression itself, and it is listed for every
266
+ * fontstack in that layer's fallback chain. So it never omits a
267
+ * range a label needs, and it may name a few that go unused. Text
268
+ * layers that build their string from something other than a `get`
269
+ * of a feature property (a literal, a `concat` of formatted values)
270
+ * contribute their literal text where it is a plain string.
271
+ * @returns {object}
272
+ */
273
+ neededGlyphRanges() {
274
+ const ret = wasm.renderer_neededGlyphRanges(this.__wbg_ptr);
275
+ if (ret[2]) {
276
+ throw takeFromExternrefTable0(ret[1]);
277
+ }
278
+ return takeFromExternrefTable0(ret[0]);
279
+ }
280
+ /**
281
+ * Build a renderer from a style JSON document.
282
+ * @param {string} style_json
283
+ */
284
+ constructor(style_json) {
285
+ const ptr0 = passStringToWasm0(style_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
286
+ const len0 = WASM_VECTOR_LEN;
287
+ const ret = wasm.renderer_new(ptr0, len0);
288
+ if (ret[2]) {
289
+ throw takeFromExternrefTable0(ret[1]);
290
+ }
291
+ this.__wbg_ptr = ret[0];
292
+ RendererFinalization.register(this, this.__wbg_ptr, this);
293
+ return this;
294
+ }
295
+ /**
296
+ * Render a single tile using whatever sources are currently bound.
297
+ *
298
+ * `opts` (JS object, all fields optional):
299
+ * - `format`: `"png"` (default) / `"webp"` / `"rgba"`
300
+ * - `tileSize`, `pad`: override the style's canvas size for this
301
+ * call (hi-DPI / preview)
302
+ * - `png`: `{ compression?: "fast" | "default" | "best" }`
303
+ * @param {number} z
304
+ * @param {number} x
305
+ * @param {number} y
306
+ * @param {object | null} [opts]
307
+ * @returns {Uint8Array}
308
+ */
309
+ renderTile(z, x, y, opts) {
310
+ const ret = wasm.renderer_renderTile(this.__wbg_ptr, z, x, y, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
311
+ if (ret[3]) {
312
+ throw takeFromExternrefTable0(ret[2]);
313
+ }
314
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
315
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
316
+ return v1;
317
+ }
318
+ /**
319
+ * Neighbour tile offsets the active style actually asks for from
320
+ * `source`, as an array of `[dx, dy]` pairs (never including the
321
+ * centre `[0, 0]`).
322
+ *
323
+ * Cross-tile label collision and edge-continuous DEM shading are the
324
+ * only things that read neighbours, and only for the sources they
325
+ * name. A host that fetches the full 3×3 window unconditionally
326
+ * therefore pays for up to eight tiles it will not look at; passing
327
+ * each offset from this list to `bindSource(name, bytes, { coord })`
328
+ * fetches exactly what the recipe needs. An empty array means the
329
+ * centre tile is enough.
330
+ *
331
+ * Throws `UnknownSource` if `name` is not declared in the style.
332
+ * @param {string} name
333
+ * @returns {Array<any>}
334
+ */
335
+ requestedNeighborOffsets(name) {
336
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
337
+ const len0 = WASM_VECTOR_LEN;
338
+ const ret = wasm.renderer_requestedNeighborOffsets(this.__wbg_ptr, ptr0, len0);
339
+ if (ret[2]) {
340
+ throw takeFromExternrefTable0(ret[1]);
341
+ }
342
+ return takeFromExternrefTable0(ret[0]);
343
+ }
344
+ /**
345
+ * Cap the glyph bytes each bound fontstack keeps resident, in
346
+ * bytes. Unset, a fontstack keeps every range ever bound to it for
347
+ * the life of the renderer — `clearSources` does not touch glyphs,
348
+ * and on a long-lived instance rendering across a basemap that is
349
+ * usually what grew.
350
+ *
351
+ * Trimming happens **after** each `renderTile`, not while binding,
352
+ * so a render never loses glyphs that were bound for it. The tile
353
+ * that just drew is therefore the most recently used, and a budget
354
+ * large enough for one tile's glyphs always keeps that tile's; what
355
+ * goes is what earlier tiles needed and this one did not. Set it
356
+ * below one tile's worth and the ceiling still holds — the stack
357
+ * empties after every render and nothing carries over, which
358
+ * renders correctly but buys no reuse.
359
+ *
360
+ * It is a per-fontstack ceiling: a style with a regular, a medium
361
+ * and an italic stack can hold three times what is set here.
362
+ *
363
+ * This host cannot refetch, so anything trimmed must be bound again
364
+ * before the next tile that needs it. `neededCodepoints()` already
365
+ * names exactly what to bind, and a host that re-binds every tile
366
+ * (rather than tracking what it sent) needs no other change.
367
+ * @param {number} bytes
368
+ */
369
+ setGlyphBudget(bytes) {
370
+ wasm.renderer_setGlyphBudget(this.__wbg_ptr, bytes);
371
+ }
372
+ /**
373
+ * Replace the active style. Returns the new node count. Invalidates
374
+ * the intermediate cache and drops any pending source bindings.
375
+ * @param {string} style_json
376
+ * @returns {number}
377
+ */
378
+ setStyle(style_json) {
379
+ const ptr0 = passStringToWasm0(style_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
380
+ const len0 = WASM_VECTOR_LEN;
381
+ const ret = wasm.renderer_setStyle(this.__wbg_ptr, ptr0, len0);
382
+ if (ret[2]) {
383
+ throw takeFromExternrefTable0(ret[1]);
384
+ }
385
+ return ret[0] >>> 0;
386
+ }
387
+ /**
388
+ * `tile-size` declared by the current style.
389
+ * @returns {number}
390
+ */
391
+ get tileSize() {
392
+ const ret = wasm.renderer_tileSize(this.__wbg_ptr);
393
+ return ret >>> 0;
394
+ }
395
+ }
396
+ if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
397
+
398
+ /**
399
+ * Wasm linear memory currently committed to this module, in bytes.
400
+ *
401
+ * This is the figure an isolate's memory cap applies to, and the one
402
+ * to watch to shed load before an allocation fails — a refused
403
+ * `memory.grow` throws [`OutOfMemory`](oom) and ends the instance.
404
+ * It never falls: freed Rust values return to the allocator for reuse,
405
+ * but wasm cannot hand pages back to the host. So a drop in demand
406
+ * leaves the number where its peak left it, and only a fresh instance
407
+ * resets it.
408
+ *
409
+ * Module-wide, not per-`Renderer`. For what a given renderer is
410
+ * holding, and which bank to evict, call `memoryUsage()`.
411
+ * @returns {number}
412
+ */
413
+ export function heapBytes() {
414
+ const ret = wasm.heapBytes();
415
+ return ret >>> 0;
416
+ }
417
+
418
+ /**
419
+ * Whether the wasm binary was compiled with `+simd128`. Lets the demo
420
+ * page label the renderer build accurately.
421
+ * @returns {boolean}
422
+ */
423
+ export function simdEnabled() {
424
+ const ret = wasm.simdEnabled();
425
+ return ret !== 0;
426
+ }
427
+
428
+ /**
429
+ * Whether this build supports multithreaded rendering (compiled with
430
+ * the `threads` feature). When `false`, `initThreadPool` is absent and
431
+ * `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
432
+ * the host can label the build.
433
+ * @returns {boolean}
434
+ */
435
+ export function threadsEnabled() {
436
+ const ret = wasm.threadsEnabled();
437
+ return ret !== 0;
438
+ }
439
+ export function __wbg___wbindgen_boolean_get_fa956cfa2d1bd751(arg0) {
440
+ const v = arg0;
441
+ const ret = typeof(v) === 'boolean' ? v : undefined;
442
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
443
+ }
444
+ export function __wbg___wbindgen_is_null_ea9085d691f535d3(arg0) {
445
+ const ret = arg0 === null;
446
+ return ret;
447
+ }
448
+ export function __wbg___wbindgen_is_undefined_c05833b95a3cf397(arg0) {
449
+ const ret = arg0 === undefined;
450
+ return ret;
451
+ }
452
+ export function __wbg___wbindgen_number_get_394265ed1e1b84ee(arg0, arg1) {
453
+ const obj = arg1;
454
+ const ret = typeof(obj) === 'number' ? obj : undefined;
455
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
456
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
457
+ }
458
+ export function __wbg___wbindgen_rethrow_4915403b40f010b4(arg0) {
459
+ throw arg0;
460
+ }
461
+ export function __wbg___wbindgen_string_get_b0ca35b86a603356(arg0, arg1) {
462
+ const obj = arg1;
463
+ const ret = typeof(obj) === 'string' ? obj : undefined;
464
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
465
+ var len1 = WASM_VECTOR_LEN;
466
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
467
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
468
+ }
469
+ export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
470
+ throw new Error(getStringFromWasm0(arg0, arg1));
471
+ }
472
+ export function __wbg_call_a6e5c5dce5018821() { return handleError(function (arg0, arg1, arg2) {
473
+ const ret = arg0.call(arg1, arg2);
474
+ return ret;
475
+ }, arguments); }
476
+ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
477
+ let deferred0_0;
478
+ let deferred0_1;
479
+ try {
480
+ deferred0_0 = arg0;
481
+ deferred0_1 = arg1;
482
+ console.error(getStringFromWasm0(arg0, arg1));
483
+ } finally {
484
+ wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
485
+ }
486
+ }
487
+ export function __wbg_get_507a50627bffa49b(arg0, arg1) {
488
+ const ret = arg0[arg1 >>> 0];
489
+ return ret;
490
+ }
491
+ export function __wbg_get_78f252d074a84d0b() { return handleError(function (arg0, arg1) {
492
+ const ret = Reflect.get(arg0, arg1);
493
+ return ret;
494
+ }, arguments); }
495
+ export function __wbg_instanceof_Object_33f20e6f12439f3e(arg0) {
496
+ let result;
497
+ try {
498
+ result = arg0 instanceof Object;
499
+ } catch (_) {
500
+ result = false;
501
+ }
502
+ const ret = result;
503
+ return ret;
504
+ }
505
+ export function __wbg_isArray_0677c962b281d01a(arg0) {
506
+ const ret = Array.isArray(arg0);
507
+ return ret;
508
+ }
509
+ export function __wbg_length_370319915dc99107(arg0) {
510
+ const ret = arg0.length;
511
+ return ret;
512
+ }
513
+ export function __wbg_new_227d7c05414eb861() {
514
+ const ret = new Error();
515
+ return ret;
516
+ }
517
+ export function __wbg_new_32b398fb48b6d94a() {
518
+ const ret = new Array();
519
+ return ret;
520
+ }
521
+ export function __wbg_new_b667d279fd5aa943(arg0, arg1) {
522
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
523
+ return ret;
524
+ }
525
+ export function __wbg_new_da52cf8fe3429cb2() {
526
+ const ret = new Object();
527
+ return ret;
528
+ }
529
+ export function __wbg_now_86c0d4ba3fa605b8() {
530
+ const ret = Date.now();
531
+ return ret;
532
+ }
533
+ export function __wbg_push_d2ae3af0c1217ae6(arg0, arg1) {
534
+ const ret = arg0.push(arg1);
535
+ return ret;
536
+ }
537
+ export function __wbg_set_8535240470bf2500() { return handleError(function (arg0, arg1, arg2) {
538
+ const ret = Reflect.set(arg0, arg1, arg2);
539
+ return ret;
540
+ }, arguments); }
541
+ export function __wbg_set_name_3bbc583faefa4193(arg0, arg1, arg2) {
542
+ arg0.name = getStringFromWasm0(arg1, arg2);
543
+ }
544
+ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
545
+ const ret = arg1.stack;
546
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
547
+ const len1 = WASM_VECTOR_LEN;
548
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
549
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
550
+ }
551
+ export function __wbindgen_cast_0000000000000001(arg0) {
552
+ // Cast intrinsic for `F64 -> Externref`.
553
+ const ret = arg0;
554
+ return ret;
555
+ }
556
+ export function __wbindgen_cast_0000000000000002(arg0, arg1) {
557
+ // Cast intrinsic for `Ref(String) -> Externref`.
558
+ const ret = getStringFromWasm0(arg0, arg1);
559
+ return ret;
560
+ }
561
+ export function __wbindgen_init_externref_table() {
562
+ const table = wasm.__wbindgen_externrefs;
563
+ const offset = table.grow(4);
564
+ table.set(0, undefined);
565
+ table.set(offset + 0, undefined);
566
+ table.set(offset + 1, null);
567
+ table.set(offset + 2, true);
568
+ table.set(offset + 3, false);
569
+ }
570
+ const LogSinkFinalization = (typeof FinalizationRegistry === 'undefined')
571
+ ? { register: () => {}, unregister: () => {} }
572
+ : new FinalizationRegistry(ptr => wasm.__wbg_logsink_free(ptr, 1));
573
+ const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
574
+ ? { register: () => {}, unregister: () => {} }
575
+ : new FinalizationRegistry(ptr => wasm.__wbg_renderer_free(ptr, 1));
576
+
577
+ function addToExternrefTable0(obj) {
578
+ const idx = wasm.__externref_table_alloc_command_export();
579
+ wasm.__wbindgen_externrefs.set(idx, obj);
580
+ return idx;
581
+ }
582
+
583
+ function getArrayJsValueFromWasm0(ptr, len) {
584
+ ptr = ptr >>> 0;
585
+ const mem = getDataViewMemory0();
586
+ const result = [];
587
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
588
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
589
+ }
590
+ wasm.__externref_drop_slice_command_export(ptr, len);
591
+ return result;
592
+ }
593
+
594
+ function getArrayU8FromWasm0(ptr, len) {
595
+ ptr = ptr >>> 0;
596
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
597
+ }
598
+
599
+ let cachedDataViewMemory0 = null;
600
+ function getDataViewMemory0() {
601
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
602
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
603
+ }
604
+ return cachedDataViewMemory0;
605
+ }
606
+
607
+ function getStringFromWasm0(ptr, len) {
608
+ return decodeText(ptr >>> 0, len);
609
+ }
610
+
611
+ let cachedUint8ArrayMemory0 = null;
612
+ function getUint8ArrayMemory0() {
613
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
614
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
615
+ }
616
+ return cachedUint8ArrayMemory0;
617
+ }
618
+
619
+ function handleError(f, args) {
620
+ try {
621
+ return f.apply(this, args);
622
+ } catch (e) {
623
+ const idx = addToExternrefTable0(e);
624
+ wasm.__wbindgen_exn_store_command_export(idx);
625
+ }
626
+ }
627
+
628
+ function isLikeNone(x) {
629
+ return x === undefined || x === null;
630
+ }
631
+
632
+ function passArray8ToWasm0(arg, malloc) {
633
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
634
+ getUint8ArrayMemory0().set(arg, ptr / 1);
635
+ WASM_VECTOR_LEN = arg.length;
636
+ return ptr;
637
+ }
638
+
639
+ function passStringToWasm0(arg, malloc, realloc) {
640
+ if (realloc === undefined) {
641
+ const buf = cachedTextEncoder.encode(arg);
642
+ const ptr = malloc(buf.length, 1) >>> 0;
643
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
644
+ WASM_VECTOR_LEN = buf.length;
645
+ return ptr;
646
+ }
647
+
648
+ let len = arg.length;
649
+ let ptr = malloc(len, 1) >>> 0;
650
+
651
+ const mem = getUint8ArrayMemory0();
652
+
653
+ let offset = 0;
654
+
655
+ for (; offset < len; offset++) {
656
+ const code = arg.charCodeAt(offset);
657
+ if (code > 0x7F) break;
658
+ mem[ptr + offset] = code;
659
+ }
660
+ if (offset !== len) {
661
+ if (offset !== 0) {
662
+ arg = arg.slice(offset);
663
+ }
664
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
665
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
666
+ const ret = cachedTextEncoder.encodeInto(arg, view);
667
+
668
+ offset += ret.written;
669
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
670
+ }
671
+
672
+ WASM_VECTOR_LEN = offset;
673
+ return ptr;
674
+ }
675
+
676
+ function takeFromExternrefTable0(idx) {
677
+ const value = wasm.__wbindgen_externrefs.get(idx);
678
+ wasm.__externref_table_dealloc_command_export(idx);
679
+ return value;
680
+ }
681
+
682
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
683
+ cachedTextDecoder.decode();
684
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
685
+ let numBytesDecoded = 0;
686
+ function decodeText(ptr, len) {
687
+ numBytesDecoded += len;
688
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
689
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
690
+ cachedTextDecoder.decode();
691
+ numBytesDecoded = len;
692
+ }
693
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
694
+ }
695
+
696
+ const cachedTextEncoder = new TextEncoder();
697
+
698
+ if (!('encodeInto' in cachedTextEncoder)) {
699
+ cachedTextEncoder.encodeInto = function (arg, view) {
700
+ const buf = cachedTextEncoder.encode(arg);
701
+ view.set(buf);
702
+ return {
703
+ read: arg.length,
704
+ written: buf.length
705
+ };
706
+ };
707
+ }
708
+
709
+ let WASM_VECTOR_LEN = 0;
710
+
711
+
712
+ let wasm;
713
+ export function __wbg_set_wasm(val) {
714
+ wasm = val;
715
+ }