@reearth/ezu 0.12.0 → 0.13.1

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/web/ezu.js CHANGED
@@ -1,11 +1,131 @@
1
1
  /* @ts-self-types="./ezu.d.ts" */
2
2
 
3
+ /**
4
+ * What `renderFrame` hands each tile's `sources`: `bindSource` into the
5
+ * renderer the frame has taken for itself, for what that tile's set needs
6
+ * bound there.
7
+ */
8
+ export class FrameBinder {
9
+ static __wrap(ptr) {
10
+ const obj = Object.create(FrameBinder.prototype);
11
+ obj.__wbg_ptr = ptr;
12
+ FrameBinderFinalization.register(obj, obj.__wbg_ptr, obj);
13
+ return obj;
14
+ }
15
+ __destroy_into_raw() {
16
+ const ptr = this.__wbg_ptr;
17
+ this.__wbg_ptr = 0;
18
+ FrameBinderFinalization.unregister(this);
19
+ return ptr;
20
+ }
21
+ free() {
22
+ const ptr = this.__destroy_into_raw();
23
+ wasm.__wbg_framebinder_free(ptr, 0);
24
+ }
25
+ /**
26
+ * `Renderer.bindSource`, for the sources bound into the renderer
27
+ * itself: the glyphs a tile turns out to need, or a font, sprite,
28
+ * brush or image. Throws `UnknownSource` for a tile-scoped source,
29
+ * which the frame renders from the returned set and would never read
30
+ * here, and `StaleBinder` once this tile's `sources` has returned (or
31
+ * its promise settled).
32
+ * @param {string} name
33
+ * @param {Uint8Array} bytes
34
+ * @param {object | null} [opts]
35
+ */
36
+ bindSource(name, bytes, opts) {
37
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
38
+ const len0 = WASM_VECTOR_LEN;
39
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc_command_export);
40
+ const len1 = WASM_VECTOR_LEN;
41
+ const ret = wasm.framebinder_bindSource(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
42
+ if (ret[1]) {
43
+ throw takeFromExternrefTable0(ret[0]);
44
+ }
45
+ }
46
+ }
47
+ if (Symbol.dispose) FrameBinder.prototype[Symbol.dispose] = FrameBinder.prototype.free;
48
+
49
+ /**
50
+ * What `frameFeatures` returns: features nodes' values gathered over the
51
+ * tiles of a frame a host renders itself, assembled into the pages
52
+ * `renderFrameWithFeatures` hands back.
53
+ *
54
+ * The Rust renderer's collector is handed each tile's values after the
55
+ * render; here the tile renders through the collector, so the values stay
56
+ * in the module rather than crossing to JS and back. It keeps the
57
+ * renderer that made it alive until it is finished or freed.
58
+ */
59
+ export class FrameFeatureCollector {
60
+ static __wrap(ptr) {
61
+ const obj = Object.create(FrameFeatureCollector.prototype);
62
+ obj.__wbg_ptr = ptr;
63
+ FrameFeatureCollectorFinalization.register(obj, obj.__wbg_ptr, obj);
64
+ return obj;
65
+ }
66
+ __destroy_into_raw() {
67
+ const ptr = this.__wbg_ptr;
68
+ this.__wbg_ptr = 0;
69
+ FrameFeatureCollectorFinalization.unregister(this);
70
+ return ptr;
71
+ }
72
+ free() {
73
+ const ptr = this.__destroy_into_raw();
74
+ wasm.__wbg_framefeaturecollector_free(ptr, 0);
75
+ }
76
+ /**
77
+ * The pages: one `{ node, geojson }` per entry of the request's
78
+ * `nodes`, in that order, as `renderFrameWithFeatures` hands them
79
+ * back. Tiles are read rows top to bottom, then left to right,
80
+ * whatever order they rendered in. The collector is used up.
81
+ * @returns {PageFeatures[]}
82
+ */
83
+ finish() {
84
+ const ptr = this.__destroy_into_raw();
85
+ const ret = wasm.framefeaturecollector_finish(ptr);
86
+ if (ret[2]) {
87
+ throw takeFromExternrefTable0(ret[1]);
88
+ }
89
+ return takeFromExternrefTable0(ret[0]);
90
+ }
91
+ /**
92
+ * `renderTileWith` for one of the frame's tiles, also keeping what the
93
+ * collector's nodes held. Pass `tileSize: frame.tileSize` in `opts` to
94
+ * draw the tile `renderFrame` draws. Like `renderTileWith` it works
95
+ * while a `renderFrame` holds the renderer, and leaves the glyph
96
+ * budget to `trimGlyphs()`.
97
+ * @param {number} z
98
+ * @param {number} x
99
+ * @param {number} y
100
+ * @param {SourceSet} set
101
+ * @param {object | null} [opts]
102
+ * @returns {Uint8Array}
103
+ */
104
+ renderTile(z, x, y, set, opts) {
105
+ _assertClass(set, SourceSet);
106
+ const ret = wasm.framefeaturecollector_renderTile(this.__wbg_ptr, z, x, y, set.__wbg_ptr, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
107
+ if (ret[3]) {
108
+ throw takeFromExternrefTable0(ret[2]);
109
+ }
110
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
111
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
112
+ return v1;
113
+ }
114
+ }
115
+ if (Symbol.dispose) FrameFeatureCollector.prototype[Symbol.dispose] = FrameFeatureCollector.prototype.free;
116
+
3
117
  /**
4
118
  * Buffered log sink that captures `tracing` events from the renderer.
5
119
  *
6
120
  * Construct once near the top of your bootstrap, then either set a
7
121
  * callback for live forwarding (`onEvent(e => console.log(e))`) or
8
122
  * `drainLines()` periodically to flush into a UI panel.
123
+ *
124
+ * It is the Go package's `InitLog` and `DrainLogs` (the pull side) and
125
+ * `WithLogger` (the push side) in one object. A class rather than two
126
+ * free functions, because a browser host also wants the structured
127
+ * records and the callback, which a wasip1 module's line buffer has no
128
+ * room for; a Rust host installs its own `tracing` subscriber instead.
9
129
  */
10
130
  export class LogSink {
11
131
  __destroy_into_raw() {
@@ -102,6 +222,14 @@ if (Symbol.dispose) LogSink.prototype[Symbol.dispose] = LogSink.prototype.free;
102
222
 
103
223
  /**
104
224
  * Stateful WASM renderer.
225
+ *
226
+ * Every method takes `&self` and borrows the renderer inside, rather than
227
+ * letting wasm-bindgen hold a borrow for the length of the call:
228
+ * `renderFrame` awaits JS between its tiles, and the loads and read-only
229
+ * queries a tile's `sources` makes (`loadSource`, `sourceTile`, …) have to
230
+ * reach the same
231
+ * renderer while the frame is still rendering. The `Rc` is what the
232
+ * frame's promise keeps alive between tiles.
105
233
  */
106
234
  export class Renderer {
107
235
  __destroy_into_raw() {
@@ -136,7 +264,7 @@ export class Renderer {
136
264
  * - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
137
265
  * offset (centre `coord: [0, 0]`, the default). Layers are bound as
138
266
  * `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
139
- * (neighbours) when [`render_tile`] runs. Binding only the centre
267
+ * (neighbours) when [`render_tile`](Self::render_tile) runs. Binding only the centre
140
268
  * degrades cross-tile label collision to centre-only at borders.
141
269
  * - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
142
270
  * offset. The centre tile is `coord: [0, 0]` (default). Decoding
@@ -193,11 +321,105 @@ export class Renderer {
193
321
  wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
194
322
  return v1;
195
323
  }
324
+ /**
325
+ * Go back to the render cache's default size. Throws
326
+ * `FrameInProgress` while a `renderFrame` holds the renderer.
327
+ */
328
+ clearCacheBudget() {
329
+ const ret = wasm.renderer_clearCacheBudget(this.__wbg_ptr);
330
+ if (ret[1]) {
331
+ throw takeFromExternrefTable0(ret[0]);
332
+ }
333
+ }
334
+ /**
335
+ * Lift the cap `setGlyphBudget` put on the glyph bank, back to where a
336
+ * fresh renderer starts. It frees nothing: what is resident stays
337
+ * resident, and stops being trimmed. Throws `FrameInProgress` while a
338
+ * `renderFrame` holds the renderer.
339
+ */
340
+ clearGlyphBudget() {
341
+ const ret = wasm.renderer_clearGlyphBudget(this.__wbg_ptr);
342
+ if (ret[1]) {
343
+ throw takeFromExternrefTable0(ret[0]);
344
+ }
345
+ }
196
346
  /**
197
347
  * Drop every pending source binding. Call between tile renders.
198
348
  */
199
349
  clearSources() {
200
- wasm.renderer_clearSources(this.__wbg_ptr);
350
+ const ret = wasm.renderer_clearSources(this.__wbg_ptr);
351
+ if (ret[1]) {
352
+ throw takeFromExternrefTable0(ret[0]);
353
+ }
354
+ }
355
+ /**
356
+ * Go back to rendering at the style's own `tile-size`, undoing
357
+ * `setTileSize`.
358
+ */
359
+ clearTileSize() {
360
+ const ret = wasm.renderer_clearTileSize(this.__wbg_ptr);
361
+ if (ret[1]) {
362
+ throw takeFromExternrefTable0(ret[0]);
363
+ }
364
+ }
365
+ /**
366
+ * Where a print frame sits on the tile grid: the zoom and tile size
367
+ * that meet `req`'s scale, and the tiles that cover it — the
368
+ * arithmetic `ezu frame` does before it renders anything, done by the
369
+ * same code, so a frame computed here is the one the CLI would render.
370
+ *
371
+ * `req` is `{ centerLon, centerLat, scale, dpi, width, height, zoom?,
372
+ * styleTileSize? }`: `scale` is the denominator (1000 for 1:1000),
373
+ * `width` and `height` the output size in pixels. `zoom` fixes the
374
+ * zoom, as the CLI's `--zoom` does; left out, the zoom chosen keeps
375
+ * the tile size nearest `styleTileSize`, which defaults to this
376
+ * renderer's style.
377
+ *
378
+ * The answer is `{ zoom, tileSize, scale, width, height, left, top,
379
+ * shift: [x, y], tilesX: [start, end], tilesY: [start, end] }`. Hand
380
+ * it to `renderFrame`, or render tiles `tilesX × tilesY` (end
381
+ * exclusive) at `zoom` and `tileSize` yourself: tile `(x, y)` lands
382
+ * with its top-left at `(x · tileSize − left, y · tileSize − top)`,
383
+ * cropped to `width × height`. `scale` is the denominator actually
384
+ * met, and `shift` how far rounding the frame onto whole pixels moved
385
+ * it.
386
+ *
387
+ * It changes nothing on the renderer. A request out of its domain (a
388
+ * non-positive scale, a latitude past the Mercator edge, a zero-sized
389
+ * output), a frame across the antimeridian, and a scale that needs a
390
+ * tile size outside 16..8192 px all throw `InvalidStyle`.
391
+ * @param {FrameRequest} req
392
+ * @returns {Frame}
393
+ */
394
+ computeFrame(req) {
395
+ const ret = wasm.renderer_computeFrame(this.__wbg_ptr, req);
396
+ if (ret[2]) {
397
+ throw takeFromExternrefTable0(ret[1]);
398
+ }
399
+ return takeFromExternrefTable0(ret[0]);
400
+ }
401
+ /**
402
+ * Start gathering what features nodes hold over `frame`'s page, for a
403
+ * host that renders the frame's tiles itself — with `tileSize` set to
404
+ * the frame's, say — rather than through `renderFrameWithFeatures`,
405
+ * which makes and drives one of its own. `request` is
406
+ * `renderFrameWithFeatures`'s `{ nodes: [{ node, key? }], coords? }`.
407
+ * Render each of the frame's tiles with the collector's `renderTile`,
408
+ * in any order, then `finish()`.
409
+ *
410
+ * It changes nothing about what the renderer draws, so it works while
411
+ * a `renderFrame` holds the renderer. Throws `InvalidStyle` for what
412
+ * `renderFrameWithFeatures` refuses, here, before anything renders.
413
+ * @param {Frame} frame
414
+ * @param {FrameFeatures} request
415
+ * @returns {FrameFeatureCollector}
416
+ */
417
+ frameFeatures(frame, request) {
418
+ const ret = wasm.renderer_frameFeatures(this.__wbg_ptr, frame, request);
419
+ if (ret[2]) {
420
+ throw takeFromExternrefTable0(ret[1]);
421
+ }
422
+ return FrameFeatureCollector.__wrap(ret[0]);
201
423
  }
202
424
  /**
203
425
  * The style's declared `legend`, or `undefined` when it declares
@@ -217,6 +439,39 @@ export class Renderer {
217
439
  }
218
440
  return takeFromExternrefTable0(ret[0]);
219
441
  }
442
+ /**
443
+ * Decode a tile-scoped source's bytes — `mvt`, `pmtiles`, `dem`,
444
+ * `raster`, or a remote `geojson` document — once, into a
445
+ * `SourceData` that any number of `SourceSet`s can hold without
446
+ * decoding it again.
447
+ *
448
+ * A host rendering a block of tiles loads each tile it fetched once
449
+ * and binds it into the set of every tile it borders, rather than
450
+ * decoding it as the centre of one tile and again as a neighbour of
451
+ * each of the others. Nothing about what the renderer draws changes,
452
+ * so this works while a `renderFrame` holds the renderer, which is
453
+ * where a frame's callback loads its tiles.
454
+ *
455
+ * Throws `UnknownSource` if `name` is not declared, or is a kind bound
456
+ * into the renderer itself with `bindSource` (brush, image, sprite,
457
+ * font, glyphs), and the matching decode kind if the bytes do not
458
+ * parse. Unlike `bindSource`, a DEM or imagery tile is decoded here,
459
+ * so its decode error is thrown here and not from the render.
460
+ * @param {string} name
461
+ * @param {Uint8Array} bytes
462
+ * @returns {SourceData}
463
+ */
464
+ loadSource(name, bytes) {
465
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
466
+ const len0 = WASM_VECTOR_LEN;
467
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc_command_export);
468
+ const len1 = WASM_VECTOR_LEN;
469
+ const ret = wasm.renderer_loadSource(this.__wbg_ptr, ptr0, len0, ptr1, len1);
470
+ if (ret[2]) {
471
+ throw takeFromExternrefTable0(ret[1]);
472
+ }
473
+ return SourceData.__wrap(ret[0]);
474
+ }
220
475
  /**
221
476
  * What this renderer is holding, in bytes, so a host can shed load
222
477
  * *before* an allocation fails rather than after.
@@ -282,6 +537,21 @@ export class Renderer {
282
537
  }
283
538
  return takeFromExternrefTable0(ret[0]);
284
539
  }
540
+ /**
541
+ * `neededCodepoints` for the features in `set` rather than the ones
542
+ * bound to the renderer: what to bind into the glyphs sources before
543
+ * rendering from it.
544
+ * @param {SourceSet} set
545
+ * @returns {object}
546
+ */
547
+ neededCodepointsIn(set) {
548
+ _assertClass(set, SourceSet);
549
+ const ret = wasm.renderer_neededCodepointsIn(this.__wbg_ptr, set.__wbg_ptr);
550
+ if (ret[2]) {
551
+ throw takeFromExternrefTable0(ret[1]);
552
+ }
553
+ return takeFromExternrefTable0(ret[0]);
554
+ }
285
555
  /**
286
556
  * Glyph ranges the currently bound features can require, as
287
557
  * `{ [glyphsSourceName]: number[] }` where each number is a range
@@ -321,6 +591,20 @@ export class Renderer {
321
591
  }
322
592
  return takeFromExternrefTable0(ret[0]);
323
593
  }
594
+ /**
595
+ * `neededGlyphRanges` for the features in `set` rather than the ones
596
+ * bound to the renderer.
597
+ * @param {SourceSet} set
598
+ * @returns {object}
599
+ */
600
+ neededGlyphRangesIn(set) {
601
+ _assertClass(set, SourceSet);
602
+ const ret = wasm.renderer_neededGlyphRangesIn(this.__wbg_ptr, set.__wbg_ptr);
603
+ if (ret[2]) {
604
+ throw takeFromExternrefTable0(ret[1]);
605
+ }
606
+ return takeFromExternrefTable0(ret[0]);
607
+ }
324
608
  /**
325
609
  * Build a renderer from a style JSON document.
326
610
  * @param {string} style_json
@@ -352,13 +636,110 @@ export class Renderer {
352
636
  }
353
637
  return takeFromExternrefTable0(ret[0]);
354
638
  }
639
+ /**
640
+ * Render every tile `frame` covers and copy each one's share into one
641
+ * frame-sized buffer, which is what `ezu frame` does: the same tiles,
642
+ * at the same tile size, cropped the same way. Resolves to straight
643
+ * (un-premultiplied) RGBA, `width × height × 4` bytes, as
644
+ * `format: "rgba"` is.
645
+ *
646
+ * The tile data stays yours to fetch, tile by tile, but it is handed
647
+ * over as a value rather than bound: before each tile
648
+ * `sources({ z, x, y }, binder)` is called with the tile about to
649
+ * render, and the tile renders from the `SourceSet` it returns, as
650
+ * `renderTileWith` does — the tile itself, the neighbours
651
+ * `requestedNeighborOffsets` names, the ancestor `sourceTile` answers
652
+ * past a source's max-zoom. A frame's tiles border each other, so keep
653
+ * the `SourceData` `loadSource` gives you and put each one into the set
654
+ * of every tile that reads it: each fetched tile is then decoded once,
655
+ * not once per tile around it. The frame reads the set and leaves it
656
+ * yours; returning one set for several tiles is fine.
657
+ *
658
+ * `sources` may return a promise, which is awaited, so it can fetch.
659
+ * One that throws or rejects stops the frame with that error. It may
660
+ * be `null` for a style that needs no tile data. The binder binds into
661
+ * the renderer what a set turns out to need — the glyphs
662
+ * `neededCodepointsIn` lists for it — with `binder.bindSource`, which
663
+ * takes what `bindSource` does but refuses a tile-scoped source with
664
+ * `UnknownSource`, since the frame never reads bound tile data.
665
+ * Persistent sources (fonts, sprites, brushes, images) can equally be
666
+ * bound once, before the call. After each tile the glyph banks are
667
+ * trimmed to `setGlyphBudget`'s budget, as `renderTile` does.
668
+ *
669
+ * Until the promise settles the renderer is the frame's: everything
670
+ * that would change what it draws — `bindSource`, `clearSources`,
671
+ * `renderTile`, `trimGlyphs`, another `renderFrame` or
672
+ * `renderFrameWithFeatures`, `setStyle`, `setTileSize`,
673
+ * `clearTileSize`, `setGlyphBudget`, `clearGlyphBudget`,
674
+ * `setCacheBudget`, `clearCacheBudget` — throws `FrameInProgress`, so a request running while `sources` awaits
675
+ * cannot change the frame's tiles under it. `loadSource`,
676
+ * `renderTileWith` and the queries that only read (`sourceTile`,
677
+ * `requestedNeighborOffsets`, `neededCodepointsIn`, `boundSources`, …)
678
+ * still work. A binder binds only for its own tile and only while that
679
+ * tile's `sources` runs; kept and used later, it throws `StaleBinder`.
680
+ * The renderer is given back however the frame ends, and the frame
681
+ * binds no tile data, so it leaves none bound.
682
+ *
683
+ * The tiles render at `frame.tileSize` per render, so the renderer's
684
+ * own tile size is left as it was. `opts` takes `renderTile`'s
685
+ * `pad` and `params`; its `format` and `tileSize` must be left out
686
+ * (or match), since the frame fixes both.
687
+ *
688
+ * Tiles render one after another, row by row from the top.
689
+ * @param {Frame} frame
690
+ * @param {((tile: { z: number; x: number; y: number }, binder: FrameBinder) => SourceSet | Promise<SourceSet>) | null | undefined} sources
691
+ * @param {object | null} [opts]
692
+ * @returns {Promise<Uint8Array>}
693
+ */
694
+ renderFrame(frame, sources, opts) {
695
+ const ret = wasm.renderer_renderFrame(this.__wbg_ptr, frame, isLikeNone(sources) ? 0 : addToExternrefTable0(sources), isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
696
+ return ret;
697
+ }
698
+ /**
699
+ * `renderFrame`, also handing back what features nodes held over the
700
+ * whole page: resolves to `{ image, features }`, where `image` is the
701
+ * buffer `renderFrame` resolves to and `features` holds one
702
+ * `{ node, geojson }` per entry of `request.nodes`, in that order.
703
+ * `geojson` is a FeatureCollection as text, byte for byte the file
704
+ * `ezu frame --features` writes for the same style, data and frame.
705
+ *
706
+ * `request` is `{ nodes: [{ node, key? }], coords? }`. `key` names the
707
+ * properties that identify a feature across tiles — `["label-id",
708
+ * "part"]` for `label-boxes`: features whose key properties are all
709
+ * equal are written once, the first in reading order (rows top to
710
+ * bottom, then left to right), and the page is sorted by the key.
711
+ * Without one, every tile's features are written, so a feature several
712
+ * tiles see appears once per tile. `coords` is `"lonlat"` (the
713
+ * default), WGS84 to seven decimal places, or `"px"`, page pixels to
714
+ * two. Features wholly off the page are left out; one that reaches
715
+ * into it is written whole.
716
+ *
717
+ * The values are the ones each tile's render computed on its way to
718
+ * the pixels, so this costs no second evaluation. A name that is not
719
+ * a node of the style, or names one that produces something other
720
+ * than features, and a key that names no property, reject with
721
+ * `InvalidStyle` before anything renders.
722
+ * @param {Frame} frame
723
+ * @param {((tile: { z: number; x: number; y: number }, binder: FrameBinder) => SourceSet | Promise<SourceSet>) | null | undefined} sources
724
+ * @param {FrameFeatures} request
725
+ * @param {object | null} [opts]
726
+ * @returns {Promise<FrameWithFeatures>}
727
+ */
728
+ renderFrameWithFeatures(frame, sources, request, opts) {
729
+ const ret = wasm.renderer_renderFrameWithFeatures(this.__wbg_ptr, frame, isLikeNone(sources) ? 0 : addToExternrefTable0(sources), request, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
730
+ return ret;
731
+ }
355
732
  /**
356
733
  * Render a single tile using whatever sources are currently bound.
357
734
  *
358
735
  * `opts` (JS object, all fields optional):
359
736
  * - `format`: `"png"` (default) / `"webp"` / `"rgba"`
360
737
  * - `tileSize`, `pad`: override the style's canvas size for this
361
- * call (hi-DPI / preview)
738
+ * call, in style pixels (a larger tile draws finer)
739
+ * - `pixelRatio`: device pixels per style pixel, 1 to 4 (default 1).
740
+ * `2` renders a retina tile: twice the size, with every width, text
741
+ * size and blur doubled, the way `window.devicePixelRatio` scales
742
+ * a MapLibre map
362
743
  * - `params`: `{ name: number | boolean | string }` — render-time
363
744
  * overrides for the style's declared `params`, validated the same
364
745
  * way the CLI's `--param` is. Omitted names keep their declared
@@ -379,6 +760,86 @@ export class Renderer {
379
760
  wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
380
761
  return v1;
381
762
  }
763
+ /**
764
+ * The tile size renders use: the one `setTileSize` set, or else the
765
+ * style's `tile-size`. A `tileSize` in one render's options still wins
766
+ * over it.
767
+ * @returns {number}
768
+ */
769
+ get renderTileSize() {
770
+ const ret = wasm.renderer_renderTileSize(this.__wbg_ptr);
771
+ return ret >>> 0;
772
+ }
773
+ /**
774
+ * Render a single tile from the tile data in `set`, as `renderTile`
775
+ * does from what is bound. Nothing tile-scoped that `bindSource` bound
776
+ * is read; the fonts, sprites, brushes, images and glyphs bound into
777
+ * the renderer are. `opts` is `renderTile`'s.
778
+ *
779
+ * It changes nothing a later render depends on, so it needs no
780
+ * `clearSources` and works while a `renderFrame` holds the renderer.
781
+ * It does not bring the glyph banks back under a budget set with
782
+ * `setGlyphBudget`, as `renderTile` does after each render; call
783
+ * `trimGlyphs()` when a batch of renders is done.
784
+ * @param {number} z
785
+ * @param {number} x
786
+ * @param {number} y
787
+ * @param {SourceSet} set
788
+ * @param {object | null} [opts]
789
+ * @returns {Uint8Array}
790
+ */
791
+ renderTileWith(z, x, y, set, opts) {
792
+ _assertClass(set, SourceSet);
793
+ const ret = wasm.renderer_renderTileWith(this.__wbg_ptr, z, x, y, set.__wbg_ptr, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
794
+ if (ret[3]) {
795
+ throw takeFromExternrefTable0(ret[2]);
796
+ }
797
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
798
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
799
+ return v1;
800
+ }
801
+ /**
802
+ * `renderTileWith`, also handing back what each of `nodes` — ids of
803
+ * nodes that produce features — held when the render finished, in the
804
+ * order given: `{ image, features }`, where `image` is the bytes
805
+ * `renderTileWith` returns and `features` holds one
806
+ * `{ node, extent, geojson }` per name, `geojson` being a GeoJSON
807
+ * FeatureCollection as text — the shape `renderFrameWithFeatures` and
808
+ * the Go package hand back too.
809
+ *
810
+ * Each entry carries the node's id as `node` and the tile's size
811
+ * in geometry units as `extent`: coordinates run `0..extent` across
812
+ * the tile, `x` right and `y` down from its top-left corner. A node the
813
+ * render never reached — a branch a `switch` did not take — has no
814
+ * `extent` and no features. The values are the ones the render
815
+ * computed on its way to the pixels, so this costs no second
816
+ * evaluation.
817
+ *
818
+ * `nodes` is an array of ids, or `{ nodes, coords }` to write the
819
+ * geometry in other coordinates: `coords` is `"tile"` (the default,
820
+ * tile units as above), `"lonlat"` (WGS84, seven decimals) or `"px"`
821
+ * (the rendered tile's pixels from its top-left corner, two decimals,
822
+ * at the tile size the render drew at).
823
+ *
824
+ * Throws `InvalidStyle` before anything renders when a name is not a
825
+ * node of the style, or names one that produces something other than
826
+ * features, and for a `coords` it does not know.
827
+ * @param {number} z
828
+ * @param {number} x
829
+ * @param {number} y
830
+ * @param {SourceSet} set
831
+ * @param {string[] | TileFeatures} nodes
832
+ * @param {object | null} [opts]
833
+ * @returns {TileWithFeatures}
834
+ */
835
+ renderTileWithFeatures(z, x, y, set, nodes, opts) {
836
+ _assertClass(set, SourceSet);
837
+ const ret = wasm.renderer_renderTileWithFeatures(this.__wbg_ptr, z, x, y, set.__wbg_ptr, nodes, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
838
+ if (ret[2]) {
839
+ throw takeFromExternrefTable0(ret[1]);
840
+ }
841
+ return takeFromExternrefTable0(ret[0]);
842
+ }
382
843
  /**
383
844
  * Neighbour tile offsets the active style actually asks for from
384
845
  * `source`, as an array of `[dx, dy]` pairs (never including the
@@ -417,6 +878,26 @@ export class Renderer {
417
878
  }
418
879
  return takeFromExternrefTable0(ret[0]);
419
880
  }
881
+ /**
882
+ * Let the render cache hold up to `bytes` of pixels instead of its
883
+ * default (8 MiB). The cache keeps intermediate results a later render
884
+ * can reuse — most of all what a world-anchored node computes, which
885
+ * every tile around it reads too — so a host rendering many
886
+ * neighbouring tiles with memory to spare renders them faster with
887
+ * more, and one in a memory-capped isolate can hold it to less.
888
+ * `memoryUsage().cacheBudget` reports it back.
889
+ *
890
+ * The cache starts empty at the new size, and keeps the size through
891
+ * `setStyle` and `setTileSize`. Throws `FrameInProgress` while a
892
+ * `renderFrame` holds the renderer.
893
+ * @param {number} bytes
894
+ */
895
+ setCacheBudget(bytes) {
896
+ const ret = wasm.renderer_setCacheBudget(this.__wbg_ptr, bytes);
897
+ if (ret[1]) {
898
+ throw takeFromExternrefTable0(ret[0]);
899
+ }
900
+ }
420
901
  /**
421
902
  * Cap the glyph bytes each bound fontstack keeps resident, in
422
903
  * bytes. Unset, a fontstack keeps every range ever bound to it for
@@ -441,19 +922,24 @@ export class Renderer {
441
922
  * names exactly what to bind, and a host that re-binds every tile
442
923
  * (rather than tracking what it sent) needs no other change.
443
924
  *
444
- * A budget of `0xFFFFFFFF` — the largest value this host can express,
445
- * since an address here is 32 bits — lifts the cap again, and is what
925
+ * `clearGlyphBudget()` lifts the cap again. So does a budget of
926
+ * `0xFFFFFFFF` — the largest value this host can express, since an
927
+ * address here is 32 bits — which is what
446
928
  * `memoryUsage().glyphBudget` reports as `Infinity`. A number that
447
929
  * big cannot be a real ceiling: it is every byte the module could
448
930
  * ever address.
449
931
  * @param {number} bytes
450
932
  */
451
933
  setGlyphBudget(bytes) {
452
- wasm.renderer_setGlyphBudget(this.__wbg_ptr, bytes);
934
+ const ret = wasm.renderer_setGlyphBudget(this.__wbg_ptr, bytes);
935
+ if (ret[1]) {
936
+ throw takeFromExternrefTable0(ret[0]);
937
+ }
453
938
  }
454
939
  /**
455
940
  * Replace the active style. Returns the new node count. Invalidates
456
- * the intermediate cache and drops any pending source bindings.
941
+ * the intermediate cache, drops any pending source bindings, and
942
+ * goes back to the new style's own tile size.
457
943
  * @param {string} style_json
458
944
  * @returns {number}
459
945
  */
@@ -466,6 +952,30 @@ export class Renderer {
466
952
  }
467
953
  return ret[0] >>> 0;
468
954
  }
955
+ /**
956
+ * Render every tile at `size` px instead of the style's `tile-size`,
957
+ * without editing the style. `clearTileSize()` goes back to the
958
+ * style's, and so does `setStyle`.
959
+ *
960
+ * A print frame needs it: `computeFrame` meets the scale by choosing
961
+ * the tile size, and the frame's tiles must be drawn at exactly that
962
+ * size. It renders what the style with its `tile-size` edited would.
963
+ * Nothing you bind depends on it — `requestedNeighborOffsets` and
964
+ * `sourceTile` answer as before — and the intermediate cache, which is
965
+ * sized by the tile, is dropped when the size changes. `tileSize`
966
+ * keeps reporting the style's own, and a `tileSize` in one
967
+ * `renderTile`'s options still wins over this.
968
+ *
969
+ * Throws `InvalidStyle` for a size below 1 px: `0` is not "the
970
+ * style's", that is `clearTileSize`.
971
+ * @param {number} size
972
+ */
973
+ setTileSize(size) {
974
+ const ret = wasm.renderer_setTileSize(this.__wbg_ptr, size);
975
+ if (ret[1]) {
976
+ throw takeFromExternrefTable0(ret[0]);
977
+ }
978
+ }
469
979
  /**
470
980
  * The tile a host should actually fetch from `name` in order to draw
471
981
  * `z/x/y`, as `{ z, x, y }`.
@@ -536,22 +1046,192 @@ export class Renderer {
536
1046
  return takeFromExternrefTable0(ret[0]);
537
1047
  }
538
1048
  /**
539
- * `tile-size` declared by the current style.
1049
+ * `tile-size` declared by the current style, whatever `setTileSize`
1050
+ * renders at.
540
1051
  * @returns {number}
541
1052
  */
542
1053
  get tileSize() {
543
1054
  const ret = wasm.renderer_tileSize(this.__wbg_ptr);
544
1055
  return ret >>> 0;
545
1056
  }
1057
+ /**
1058
+ * Bring every bound fontstack back under the budget `setGlyphBudget`
1059
+ * set; a no-op without one. `renderTile` does this after each render;
1060
+ * after `renderTileWith`, call it yourself once a batch is done.
1061
+ * Trimming can drop glyphs a frame bound for its next tile, so it
1062
+ * throws `FrameInProgress` while a `renderFrame` holds the renderer,
1063
+ * which trims after each of its tiles itself.
1064
+ */
1065
+ trimGlyphs() {
1066
+ const ret = wasm.renderer_trimGlyphs(this.__wbg_ptr);
1067
+ if (ret[1]) {
1068
+ throw takeFromExternrefTable0(ret[0]);
1069
+ }
1070
+ }
1071
+ /**
1072
+ * What building the current style's graph warned about: each names a
1073
+ * node that works but relies on something the style does not say out
1074
+ * loud. They are also logged when the style is built; this is for
1075
+ * reporting or checking them on your own terms. Follows `setStyle`.
1076
+ * @returns {string[]}
1077
+ */
1078
+ get warnings() {
1079
+ const ret = wasm.renderer_warnings(this.__wbg_ptr);
1080
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1081
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
1082
+ return v1;
1083
+ }
546
1084
  }
547
1085
  if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
548
1086
 
1087
+ /**
1088
+ * One tile-scoped payload — a vector tile, a DEM or imagery tile, a
1089
+ * GeoJSON document — decoded once by `Renderer.loadSource` and ready to
1090
+ * sit in any number of `SourceSet`s.
1091
+ *
1092
+ * A set keeps what it holds alive, so `free()` once the sets that need it
1093
+ * have it, or leave it to the garbage collector. It is not tied to the
1094
+ * renderer that loaded it: renderers in one module share a heap, and a
1095
+ * render checks that its style declares the source the way the data was
1096
+ * loaded for.
1097
+ */
1098
+ export class SourceData {
1099
+ static __wrap(ptr) {
1100
+ const obj = Object.create(SourceData.prototype);
1101
+ obj.__wbg_ptr = ptr;
1102
+ SourceDataFinalization.register(obj, obj.__wbg_ptr, obj);
1103
+ return obj;
1104
+ }
1105
+ __destroy_into_raw() {
1106
+ const ptr = this.__wbg_ptr;
1107
+ this.__wbg_ptr = 0;
1108
+ SourceDataFinalization.unregister(this);
1109
+ return ptr;
1110
+ }
1111
+ free() {
1112
+ const ptr = this.__destroy_into_raw();
1113
+ wasm.__wbg_sourcedata_free(ptr, 0);
1114
+ }
1115
+ /**
1116
+ * The `sources.<name>` entry the data was loaded for.
1117
+ * @returns {string}
1118
+ */
1119
+ get source() {
1120
+ let deferred1_0;
1121
+ let deferred1_1;
1122
+ try {
1123
+ const ret = wasm.sourcedata_source(this.__wbg_ptr);
1124
+ deferred1_0 = ret[0];
1125
+ deferred1_1 = ret[1];
1126
+ return getStringFromWasm0(ret[0], ret[1]);
1127
+ } finally {
1128
+ wasm.__wbindgen_free_command_export(deferred1_0, deferred1_1, 1);
1129
+ }
1130
+ }
1131
+ }
1132
+ if (Symbol.dispose) SourceData.prototype[Symbol.dispose] = SourceData.prototype.free;
1133
+
1134
+ /**
1135
+ * Every tile-scoped payload one render reads, each at its place in the
1136
+ * 3×3 neighbourhood: the binding table `bindSource` fills, as a value you
1137
+ * build per tile and hand to `renderTileWith`.
1138
+ *
1139
+ * A set says nothing about the tile it is for — offsets are relative — so
1140
+ * pairing each tile with its neighbourhood is yours to do. Fonts, sprites,
1141
+ * brushes, images and glyphs are not here: they belong to the renderer,
1142
+ * bound once with `bindSource` and read by every render.
1143
+ */
1144
+ export class SourceSet {
1145
+ static __wrap(ptr) {
1146
+ const obj = Object.create(SourceSet.prototype);
1147
+ obj.__wbg_ptr = ptr;
1148
+ SourceSetFinalization.register(obj, obj.__wbg_ptr, obj);
1149
+ return obj;
1150
+ }
1151
+ static __unwrap(jsValue) {
1152
+ if (!(jsValue instanceof SourceSet)) {
1153
+ return 0;
1154
+ }
1155
+ return jsValue.__destroy_into_raw();
1156
+ }
1157
+ __destroy_into_raw() {
1158
+ const ptr = this.__wbg_ptr;
1159
+ this.__wbg_ptr = 0;
1160
+ SourceSetFinalization.unregister(this);
1161
+ return ptr;
1162
+ }
1163
+ free() {
1164
+ const ptr = this.__destroy_into_raw();
1165
+ wasm.__wbg_sourceset_free(ptr, 0);
1166
+ }
1167
+ /**
1168
+ * Put `data` at `opts.coord` for its source, replacing what was
1169
+ * there. `opts` is `bindSource`'s `{ coord?: [dx, dy], sourceZoom? }`:
1170
+ * `sourceZoom` says the data is an ancestor's, to be resampled or
1171
+ * reprojected into the tile. The set shares the data rather than
1172
+ * copying it.
1173
+ *
1174
+ * Throws `UnknownSource` when the source already holds data of
1175
+ * another kind, and for the `coord` and `sourceZoom` `bindSource`
1176
+ * refuses.
1177
+ * @param {SourceData} data
1178
+ * @param {object | null} [opts]
1179
+ */
1180
+ bind(data, opts) {
1181
+ _assertClass(data, SourceData);
1182
+ const ret = wasm.sourceset_bind(this.__wbg_ptr, data.__wbg_ptr, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
1183
+ if (ret[1]) {
1184
+ throw takeFromExternrefTable0(ret[0]);
1185
+ }
1186
+ }
1187
+ /**
1188
+ * A copy of the set. It holds the same data, which is shared rather
1189
+ * than copied, so this costs a few references per entry.
1190
+ * @returns {SourceSet}
1191
+ */
1192
+ clone() {
1193
+ const ret = wasm.sourceset_clone(this.__wbg_ptr);
1194
+ return SourceSet.__wrap(ret);
1195
+ }
1196
+ /**
1197
+ * Whether anything is bound for `source`.
1198
+ * @param {string} source
1199
+ * @returns {boolean}
1200
+ */
1201
+ contains(source) {
1202
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
1203
+ const len0 = WASM_VECTOR_LEN;
1204
+ const ret = wasm.sourceset_contains(this.__wbg_ptr, ptr0, len0);
1205
+ return ret !== 0;
1206
+ }
1207
+ /**
1208
+ * Whether nothing is bound at all.
1209
+ * @returns {boolean}
1210
+ */
1211
+ isEmpty() {
1212
+ const ret = wasm.sourceset_isEmpty(this.__wbg_ptr);
1213
+ return ret !== 0;
1214
+ }
1215
+ /**
1216
+ * An empty set: a render from it draws what the style draws with no
1217
+ * tile data at all.
1218
+ */
1219
+ constructor() {
1220
+ const ret = wasm.sourceset_new();
1221
+ this.__wbg_ptr = ret;
1222
+ SourceSetFinalization.register(this, this.__wbg_ptr, this);
1223
+ return this;
1224
+ }
1225
+ }
1226
+ if (Symbol.dispose) SourceSet.prototype[Symbol.dispose] = SourceSet.prototype.free;
1227
+
549
1228
  /**
550
1229
  * Wasm linear memory currently committed to this module, in bytes.
551
1230
  *
552
1231
  * This is the figure an isolate's memory cap applies to, and the one
553
1232
  * to watch to shed load before an allocation fails — a refused
554
- * `memory.grow` throws [`OutOfMemory`](oom) and ends the instance.
1233
+ * `memory.grow` throws `OutOfMemory` (see the `oom` module) and ends the
1234
+ * instance.
555
1235
  * It never falls: freed Rust values return to the allocator for reuse,
556
1236
  * but wasm cannot hand pages back to the host. So a drop in demand
557
1237
  * leaves the number where its peak left it, and only a fresh instance
@@ -566,6 +1246,31 @@ export function heapBytes() {
566
1246
  return ret >>> 0;
567
1247
  }
568
1248
 
1249
+ /**
1250
+ * The number of node ops registered in this module. It is the smoke test
1251
+ * for the module's life-before-main constructors: zero means they never
1252
+ * ran, and every style is about to fail with "unknown op". The Go
1253
+ * package's `OpCount`; a Rust host reads the registry itself, through
1254
+ * `ezu::paint::nodes::default_registry()`.
1255
+ * @returns {number}
1256
+ */
1257
+ export function opCount() {
1258
+ const ret = wasm.opCount();
1259
+ return ret >>> 0;
1260
+ }
1261
+
1262
+ /**
1263
+ * Every registered node op, by name: which ops this build has, not just
1264
+ * how many. The Go package's `OpNames`.
1265
+ * @returns {string[]}
1266
+ */
1267
+ export function opNames() {
1268
+ const ret = wasm.opNames();
1269
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1270
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
1271
+ return v1;
1272
+ }
1273
+
569
1274
  /**
570
1275
  * Whether the wasm binary was compiled with `+simd128`. Lets the demo
571
1276
  * page label the renderer build accurately.
@@ -595,10 +1300,19 @@ function __wbg_get_imports() {
595
1300
  const ret = typeof(v) === 'boolean' ? v : undefined;
596
1301
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
597
1302
  },
1303
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
1304
+ const ret = typeof(arg0) === 'function';
1305
+ return ret;
1306
+ },
598
1307
  __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
599
1308
  const ret = arg0 === null;
600
1309
  return ret;
601
1310
  },
1311
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
1312
+ const val = arg0;
1313
+ const ret = typeof(val) === 'object' && val !== null;
1314
+ return ret;
1315
+ },
602
1316
  __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
603
1317
  const ret = arg0 === undefined;
604
1318
  return ret;
@@ -623,10 +1337,21 @@ function __wbg_get_imports() {
623
1337
  __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
624
1338
  throw new Error(getStringFromWasm0(arg0, arg1));
625
1339
  },
1340
+ __wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
1341
+ arg0._wbg_cb_unref();
1342
+ },
1343
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
1344
+ const ret = arg0.call(arg1);
1345
+ return ret;
1346
+ }, arguments); },
626
1347
  __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
627
1348
  const ret = arg0.call(arg1, arg2);
628
1349
  return ret;
629
1350
  }, arguments); },
1351
+ __wbg_call_e3b662382210db98: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1352
+ const ret = arg0.call(arg1, arg2, arg3);
1353
+ return ret;
1354
+ }, arguments); },
630
1355
  __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
631
1356
  let deferred0_0;
632
1357
  let deferred0_1;
@@ -638,6 +1363,10 @@ function __wbg_get_imports() {
638
1363
  wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
639
1364
  }
640
1365
  },
1366
+ __wbg_framebinder_new: function(arg0) {
1367
+ const ret = FrameBinder.__wrap(arg0);
1368
+ return ret;
1369
+ },
641
1370
  __wbg_get_507a50627bffa49b: function(arg0, arg1) {
642
1371
  const ret = arg0[arg1 >>> 0];
643
1372
  return ret;
@@ -668,6 +1397,10 @@ function __wbg_get_imports() {
668
1397
  const ret = Object.keys(arg0);
669
1398
  return ret;
670
1399
  },
1400
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
1401
+ const ret = arg0.length;
1402
+ return ret;
1403
+ },
671
1404
  __wbg_length_370319915dc99107: function(arg0) {
672
1405
  const ret = arg0.length;
673
1406
  return ret;
@@ -680,6 +1413,10 @@ function __wbg_get_imports() {
680
1413
  const ret = new Array();
681
1414
  return ret;
682
1415
  },
1416
+ __wbg_new_5e245ef5857d7f33: function(arg0, arg1) {
1417
+ const ret = new TypeError(getStringFromWasm0(arg0, arg1));
1418
+ return ret;
1419
+ },
683
1420
  __wbg_new_b667d279fd5aa943: function(arg0, arg1) {
684
1421
  const ret = new Error(getStringFromWasm0(arg0, arg1));
685
1422
  return ret;
@@ -688,6 +1425,32 @@ function __wbg_get_imports() {
688
1425
  const ret = new Object();
689
1426
  return ret;
690
1427
  },
1428
+ __wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
1429
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1430
+ return ret;
1431
+ },
1432
+ __wbg_new_typed_1824d93f294193e5: function(arg0, arg1) {
1433
+ try {
1434
+ var state0 = {a: arg0, b: arg1};
1435
+ var cb0 = (arg0, arg1) => {
1436
+ const a = state0.a;
1437
+ state0.a = 0;
1438
+ try {
1439
+ return wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined_______true_(a, state0.b, arg0, arg1);
1440
+ } finally {
1441
+ state0.a = a;
1442
+ }
1443
+ };
1444
+ const ret = new Promise(cb0);
1445
+ return ret;
1446
+ } finally {
1447
+ state0.a = 0;
1448
+ }
1449
+ },
1450
+ __wbg_new_with_length_e6785c33c8e4cce8: function(arg0) {
1451
+ const ret = new Uint8Array(arg0 >>> 0);
1452
+ return ret;
1453
+ },
691
1454
  __wbg_now_86c0d4ba3fa605b8: function() {
692
1455
  const ret = Date.now();
693
1456
  return ret;
@@ -700,6 +1463,24 @@ function __wbg_get_imports() {
700
1463
  const ret = arg0.push(arg1);
701
1464
  return ret;
702
1465
  },
1466
+ __wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
1467
+ const ret = arg0.queueMicrotask;
1468
+ return ret;
1469
+ },
1470
+ __wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
1471
+ queueMicrotask(arg0);
1472
+ },
1473
+ __wbg_reject_90df95b492dd8563: function(arg0) {
1474
+ const ret = Promise.reject(arg0);
1475
+ return ret;
1476
+ },
1477
+ __wbg_resolve_2191a4dfe481c25b: function(arg0) {
1478
+ const ret = Promise.resolve(arg0);
1479
+ return ret;
1480
+ },
1481
+ __wbg_set_4d7dd76f3dae2926: function(arg0, arg1, arg2) {
1482
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
1483
+ },
703
1484
  __wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
704
1485
  const ret = Reflect.set(arg0, arg1, arg2);
705
1486
  return ret;
@@ -707,6 +1488,10 @@ function __wbg_get_imports() {
707
1488
  __wbg_set_name_3bbc583faefa4193: function(arg0, arg1, arg2) {
708
1489
  arg0.name = getStringFromWasm0(arg1, arg2);
709
1490
  },
1491
+ __wbg_sourceset_unwrap: function(arg0) {
1492
+ const ret = SourceSet.__unwrap(arg0);
1493
+ return ret;
1494
+ },
710
1495
  __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
711
1496
  const ret = arg1.stack;
712
1497
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
@@ -714,12 +1499,45 @@ function __wbg_get_imports() {
714
1499
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
715
1500
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
716
1501
  },
717
- __wbindgen_cast_0000000000000001: function(arg0) {
1502
+ __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
1503
+ const ret = typeof global === 'undefined' ? null : global;
1504
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1505
+ },
1506
+ __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
1507
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1508
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1509
+ },
1510
+ __wbg_static_accessor_SELF_146583524fe1469b: function() {
1511
+ const ret = typeof self === 'undefined' ? null : self;
1512
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1513
+ },
1514
+ __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
1515
+ const ret = typeof window === 'undefined' ? null : window;
1516
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1517
+ },
1518
+ __wbg_subarray_3ed232c8a6baee09: function(arg0, arg1, arg2) {
1519
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1520
+ return ret;
1521
+ },
1522
+ __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
1523
+ const ret = arg0.then(arg1, arg2);
1524
+ return ret;
1525
+ },
1526
+ __wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
1527
+ const ret = arg0.then(arg1);
1528
+ return ret;
1529
+ },
1530
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1531
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 72, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1532
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___wasm_bindgen_40e41bdbc20eab45___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_40e41bdbc20eab45___JsError___true_);
1533
+ return ret;
1534
+ },
1535
+ __wbindgen_cast_0000000000000002: function(arg0) {
718
1536
  // Cast intrinsic for `F64 -> Externref`.
719
1537
  const ret = arg0;
720
1538
  return ret;
721
1539
  },
722
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1540
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
723
1541
  // Cast intrinsic for `Ref(String) -> Externref`.
724
1542
  const ret = getStringFromWasm0(arg0, arg1);
725
1543
  return ret;
@@ -740,12 +1558,35 @@ function __wbg_get_imports() {
740
1558
  };
741
1559
  }
742
1560
 
1561
+ function wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___wasm_bindgen_40e41bdbc20eab45___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_40e41bdbc20eab45___JsError___true_(arg0, arg1, arg2) {
1562
+ const ret = wasm.wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___wasm_bindgen_40e41bdbc20eab45___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_40e41bdbc20eab45___JsError___true_(arg0, arg1, arg2);
1563
+ if (ret[1]) {
1564
+ throw takeFromExternrefTable0(ret[0]);
1565
+ }
1566
+ }
1567
+
1568
+ function wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
1569
+ wasm.wasm_bindgen_40e41bdbc20eab45___convert__closures_____invoke___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined___js_sys_d7d35d7b07b5c2c7___Function_fn_wasm_bindgen_40e41bdbc20eab45___JsValue_____wasm_bindgen_40e41bdbc20eab45___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
1570
+ }
1571
+
1572
+ const FrameBinderFinalization = (typeof FinalizationRegistry === 'undefined')
1573
+ ? { register: () => {}, unregister: () => {} }
1574
+ : new FinalizationRegistry(ptr => wasm.__wbg_framebinder_free(ptr, 1));
1575
+ const FrameFeatureCollectorFinalization = (typeof FinalizationRegistry === 'undefined')
1576
+ ? { register: () => {}, unregister: () => {} }
1577
+ : new FinalizationRegistry(ptr => wasm.__wbg_framefeaturecollector_free(ptr, 1));
743
1578
  const LogSinkFinalization = (typeof FinalizationRegistry === 'undefined')
744
1579
  ? { register: () => {}, unregister: () => {} }
745
1580
  : new FinalizationRegistry(ptr => wasm.__wbg_logsink_free(ptr, 1));
746
1581
  const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
747
1582
  ? { register: () => {}, unregister: () => {} }
748
1583
  : new FinalizationRegistry(ptr => wasm.__wbg_renderer_free(ptr, 1));
1584
+ const SourceDataFinalization = (typeof FinalizationRegistry === 'undefined')
1585
+ ? { register: () => {}, unregister: () => {} }
1586
+ : new FinalizationRegistry(ptr => wasm.__wbg_sourcedata_free(ptr, 1));
1587
+ const SourceSetFinalization = (typeof FinalizationRegistry === 'undefined')
1588
+ ? { register: () => {}, unregister: () => {} }
1589
+ : new FinalizationRegistry(ptr => wasm.__wbg_sourceset_free(ptr, 1));
749
1590
 
750
1591
  function addToExternrefTable0(obj) {
751
1592
  const idx = wasm.__externref_table_alloc_command_export();
@@ -753,6 +1594,16 @@ function addToExternrefTable0(obj) {
753
1594
  return idx;
754
1595
  }
755
1596
 
1597
+ function _assertClass(instance, klass) {
1598
+ if (!(instance instanceof klass)) {
1599
+ throw new Error(`expected instance of ${klass.name}`);
1600
+ }
1601
+ }
1602
+
1603
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1604
+ ? { register: () => {}, unregister: () => {} }
1605
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure_command_export(state.a, state.b));
1606
+
756
1607
  function getArrayJsValueFromWasm0(ptr, len) {
757
1608
  ptr = ptr >>> 0;
758
1609
  const mem = getDataViewMemory0();
@@ -802,6 +1653,34 @@ function isLikeNone(x) {
802
1653
  return x === undefined || x === null;
803
1654
  }
804
1655
 
1656
+ function makeMutClosure(arg0, arg1, f) {
1657
+ const state = { a: arg0, b: arg1, cnt: 1 };
1658
+ const real = (...args) => {
1659
+
1660
+ // First up with a closure we increment the internal reference
1661
+ // count. This ensures that the Rust closure environment won't
1662
+ // be deallocated while we're invoking it.
1663
+ state.cnt++;
1664
+ const a = state.a;
1665
+ state.a = 0;
1666
+ try {
1667
+ return f(a, state.b, ...args);
1668
+ } finally {
1669
+ state.a = a;
1670
+ real._wbg_cb_unref();
1671
+ }
1672
+ };
1673
+ real._wbg_cb_unref = () => {
1674
+ if (--state.cnt === 0) {
1675
+ wasm.__wbindgen_destroy_closure_command_export(state.a, state.b);
1676
+ state.a = 0;
1677
+ CLOSURE_DTORS.unregister(state);
1678
+ }
1679
+ };
1680
+ CLOSURE_DTORS.register(real, state, state);
1681
+ return real;
1682
+ }
1683
+
805
1684
  function passArray8ToWasm0(arg, malloc) {
806
1685
  const ptr = malloc(arg.length * 1, 1) >>> 0;
807
1686
  getUint8ArrayMemory0().set(arg, ptr / 1);