@reearth/ezu 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,597 @@
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
+ * Glyph ranges the currently bound features can require, as
183
+ * `{ [glyphsSourceName]: number[] }` where each number is a range
184
+ * start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
185
+ * `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
186
+ *
187
+ * This host cannot fetch glyph ranges lazily, so every range a
188
+ * tile's labels touch must be bound before `renderTile`. Rather than
189
+ * scraping every string in the MVT, call this after binding the
190
+ * vector sources and bind exactly the listed ranges.
191
+ *
192
+ * It is an over-approximation, deliberately: a range is listed if
193
+ * *any* feature in a text layer carries the codepoint in a property
194
+ * the layer's `text` expression reads, without evaluating filters,
195
+ * zoom ranges, or the expression itself, and it is listed for every
196
+ * fontstack in that layer's fallback chain. So it never omits a
197
+ * range a label needs, and it may name a few that go unused. Text
198
+ * layers that build their string from something other than a `get`
199
+ * of a feature property (a literal, a `concat` of formatted values)
200
+ * contribute their literal text where it is a plain string.
201
+ * @returns {object}
202
+ */
203
+ neededGlyphRanges() {
204
+ const ret = wasm.renderer_neededGlyphRanges(this.__wbg_ptr);
205
+ if (ret[2]) {
206
+ throw takeFromExternrefTable0(ret[1]);
207
+ }
208
+ return takeFromExternrefTable0(ret[0]);
209
+ }
210
+ /**
211
+ * Build a renderer from a style JSON document.
212
+ * @param {string} style_json
213
+ */
214
+ constructor(style_json) {
215
+ const ptr0 = passStringToWasm0(style_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
216
+ const len0 = WASM_VECTOR_LEN;
217
+ const ret = wasm.renderer_new(ptr0, len0);
218
+ if (ret[2]) {
219
+ throw takeFromExternrefTable0(ret[1]);
220
+ }
221
+ this.__wbg_ptr = ret[0];
222
+ RendererFinalization.register(this, this.__wbg_ptr, this);
223
+ return this;
224
+ }
225
+ /**
226
+ * Render a single tile using whatever sources are currently bound.
227
+ *
228
+ * `opts` (JS object, all fields optional):
229
+ * - `format`: `"png"` (default) / `"webp"` / `"rgba"`
230
+ * - `tileSize`, `pad`: override the style's canvas size for this
231
+ * call (hi-DPI / preview)
232
+ * - `png`: `{ compression?: "fast" | "default" | "best" }`
233
+ * @param {number} z
234
+ * @param {number} x
235
+ * @param {number} y
236
+ * @param {object | null} [opts]
237
+ * @returns {Uint8Array}
238
+ */
239
+ renderTile(z, x, y, opts) {
240
+ const ret = wasm.renderer_renderTile(this.__wbg_ptr, z, x, y, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
241
+ if (ret[3]) {
242
+ throw takeFromExternrefTable0(ret[2]);
243
+ }
244
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
245
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
246
+ return v1;
247
+ }
248
+ /**
249
+ * Neighbour tile offsets the active style actually asks for from
250
+ * `source`, as an array of `[dx, dy]` pairs (never including the
251
+ * centre `[0, 0]`).
252
+ *
253
+ * Cross-tile label collision and edge-continuous DEM shading are the
254
+ * only things that read neighbours, and only for the sources they
255
+ * name. A host that fetches the full 3×3 window unconditionally
256
+ * therefore pays for up to eight tiles it will not look at; passing
257
+ * each offset from this list to `bindSource(name, bytes, { coord })`
258
+ * fetches exactly what the recipe needs. An empty array means the
259
+ * centre tile is enough.
260
+ *
261
+ * Throws `UnknownSource` if `name` is not declared in the style.
262
+ * @param {string} name
263
+ * @returns {Array<any>}
264
+ */
265
+ requestedNeighborOffsets(name) {
266
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
267
+ const len0 = WASM_VECTOR_LEN;
268
+ const ret = wasm.renderer_requestedNeighborOffsets(this.__wbg_ptr, ptr0, len0);
269
+ if (ret[2]) {
270
+ throw takeFromExternrefTable0(ret[1]);
271
+ }
272
+ return takeFromExternrefTable0(ret[0]);
273
+ }
274
+ /**
275
+ * Replace the active style. Returns the new node count. Invalidates
276
+ * the intermediate cache and drops any pending source bindings.
277
+ * @param {string} style_json
278
+ * @returns {number}
279
+ */
280
+ setStyle(style_json) {
281
+ const ptr0 = passStringToWasm0(style_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
282
+ const len0 = WASM_VECTOR_LEN;
283
+ const ret = wasm.renderer_setStyle(this.__wbg_ptr, ptr0, len0);
284
+ if (ret[2]) {
285
+ throw takeFromExternrefTable0(ret[1]);
286
+ }
287
+ return ret[0] >>> 0;
288
+ }
289
+ /**
290
+ * `tile-size` declared by the current style.
291
+ * @returns {number}
292
+ */
293
+ get tileSize() {
294
+ const ret = wasm.renderer_tileSize(this.__wbg_ptr);
295
+ return ret >>> 0;
296
+ }
297
+ }
298
+ if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
299
+
300
+ /**
301
+ * Whether the wasm binary was compiled with `+simd128`. Lets the demo
302
+ * page label the renderer build accurately.
303
+ * @returns {boolean}
304
+ */
305
+ export function simdEnabled() {
306
+ const ret = wasm.simdEnabled();
307
+ return ret !== 0;
308
+ }
309
+
310
+ /**
311
+ * Whether this build supports multithreaded rendering (compiled with
312
+ * the `threads` feature). When `false`, `initThreadPool` is absent and
313
+ * `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
314
+ * the host can label the build.
315
+ * @returns {boolean}
316
+ */
317
+ export function threadsEnabled() {
318
+ const ret = wasm.threadsEnabled();
319
+ return ret !== 0;
320
+ }
321
+ export function __wbg___wbindgen_boolean_get_2304fb8c853028c8(arg0) {
322
+ const v = arg0;
323
+ const ret = typeof(v) === 'boolean' ? v : undefined;
324
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
325
+ }
326
+ export function __wbg___wbindgen_is_null_2042690d351e14f0(arg0) {
327
+ const ret = arg0 === null;
328
+ return ret;
329
+ }
330
+ export function __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5(arg0) {
331
+ const ret = arg0 === undefined;
332
+ return ret;
333
+ }
334
+ export function __wbg___wbindgen_number_get_f73a1244370fcc2c(arg0, arg1) {
335
+ const obj = arg1;
336
+ const ret = typeof(obj) === 'number' ? obj : undefined;
337
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
338
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
339
+ }
340
+ export function __wbg___wbindgen_rethrow_2b7cc655458909c2(arg0) {
341
+ throw arg0;
342
+ }
343
+ export function __wbg___wbindgen_string_get_d109740c0d18f4d7(arg0, arg1) {
344
+ const obj = arg1;
345
+ const ret = typeof(obj) === 'string' ? obj : undefined;
346
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
347
+ var len1 = WASM_VECTOR_LEN;
348
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
349
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
350
+ }
351
+ export function __wbg___wbindgen_throw_9c31b086c2b26051(arg0, arg1) {
352
+ throw new Error(getStringFromWasm0(arg0, arg1));
353
+ }
354
+ export function __wbg_call_dfde26266607c996() { return handleError(function (arg0, arg1, arg2) {
355
+ const ret = arg0.call(arg1, arg2);
356
+ return ret;
357
+ }, arguments); }
358
+ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
359
+ let deferred0_0;
360
+ let deferred0_1;
361
+ try {
362
+ deferred0_0 = arg0;
363
+ deferred0_1 = arg1;
364
+ console.error(getStringFromWasm0(arg0, arg1));
365
+ } finally {
366
+ wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
367
+ }
368
+ }
369
+ export function __wbg_get_98fdf51d029a75eb(arg0, arg1) {
370
+ const ret = arg0[arg1 >>> 0];
371
+ return ret;
372
+ }
373
+ export function __wbg_get_dcf82ab8aad1a593() { return handleError(function (arg0, arg1) {
374
+ const ret = Reflect.get(arg0, arg1);
375
+ return ret;
376
+ }, arguments); }
377
+ export function __wbg_instanceof_Object_03924e0dbda74bd8(arg0) {
378
+ let result;
379
+ try {
380
+ result = arg0 instanceof Object;
381
+ } catch (_) {
382
+ result = false;
383
+ }
384
+ const ret = result;
385
+ return ret;
386
+ }
387
+ export function __wbg_isArray_94898ed3aad6947b(arg0) {
388
+ const ret = Array.isArray(arg0);
389
+ return ret;
390
+ }
391
+ export function __wbg_length_2591a0f4f659a55c(arg0) {
392
+ const ret = arg0.length;
393
+ return ret;
394
+ }
395
+ export function __wbg_new_02d162bc6cf02f60() {
396
+ const ret = new Object();
397
+ return ret;
398
+ }
399
+ export function __wbg_new_1f236d63ba0c4784(arg0, arg1) {
400
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
401
+ return ret;
402
+ }
403
+ export function __wbg_new_227d7c05414eb861() {
404
+ const ret = new Error();
405
+ return ret;
406
+ }
407
+ export function __wbg_new_310879b66b6e95e1() {
408
+ const ret = new Array();
409
+ return ret;
410
+ }
411
+ export function __wbg_now_81363d44c96dd239() {
412
+ const ret = Date.now();
413
+ return ret;
414
+ }
415
+ export function __wbg_push_b77c476b01548d0a(arg0, arg1) {
416
+ const ret = arg0.push(arg1);
417
+ return ret;
418
+ }
419
+ export function __wbg_set_a0e911be3da02782() { return handleError(function (arg0, arg1, arg2) {
420
+ const ret = Reflect.set(arg0, arg1, arg2);
421
+ return ret;
422
+ }, arguments); }
423
+ export function __wbg_set_name_e500733c75ec36b0(arg0, arg1, arg2) {
424
+ arg0.name = getStringFromWasm0(arg1, arg2);
425
+ }
426
+ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
427
+ const ret = arg1.stack;
428
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
429
+ const len1 = WASM_VECTOR_LEN;
430
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
431
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
432
+ }
433
+ export function __wbindgen_cast_0000000000000001(arg0) {
434
+ // Cast intrinsic for `F64 -> Externref`.
435
+ const ret = arg0;
436
+ return ret;
437
+ }
438
+ export function __wbindgen_cast_0000000000000002(arg0, arg1) {
439
+ // Cast intrinsic for `Ref(String) -> Externref`.
440
+ const ret = getStringFromWasm0(arg0, arg1);
441
+ return ret;
442
+ }
443
+ export function __wbindgen_init_externref_table() {
444
+ const table = wasm.__wbindgen_externrefs;
445
+ const offset = table.grow(4);
446
+ table.set(0, undefined);
447
+ table.set(offset + 0, undefined);
448
+ table.set(offset + 1, null);
449
+ table.set(offset + 2, true);
450
+ table.set(offset + 3, false);
451
+ }
452
+ const LogSinkFinalization = (typeof FinalizationRegistry === 'undefined')
453
+ ? { register: () => {}, unregister: () => {} }
454
+ : new FinalizationRegistry(ptr => wasm.__wbg_logsink_free(ptr, 1));
455
+ const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
456
+ ? { register: () => {}, unregister: () => {} }
457
+ : new FinalizationRegistry(ptr => wasm.__wbg_renderer_free(ptr, 1));
458
+
459
+ function addToExternrefTable0(obj) {
460
+ const idx = wasm.__externref_table_alloc_command_export();
461
+ wasm.__wbindgen_externrefs.set(idx, obj);
462
+ return idx;
463
+ }
464
+
465
+ function getArrayJsValueFromWasm0(ptr, len) {
466
+ ptr = ptr >>> 0;
467
+ const mem = getDataViewMemory0();
468
+ const result = [];
469
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
470
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
471
+ }
472
+ wasm.__externref_drop_slice_command_export(ptr, len);
473
+ return result;
474
+ }
475
+
476
+ function getArrayU8FromWasm0(ptr, len) {
477
+ ptr = ptr >>> 0;
478
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
479
+ }
480
+
481
+ let cachedDataViewMemory0 = null;
482
+ function getDataViewMemory0() {
483
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
484
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
485
+ }
486
+ return cachedDataViewMemory0;
487
+ }
488
+
489
+ function getStringFromWasm0(ptr, len) {
490
+ return decodeText(ptr >>> 0, len);
491
+ }
492
+
493
+ let cachedUint8ArrayMemory0 = null;
494
+ function getUint8ArrayMemory0() {
495
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
496
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
497
+ }
498
+ return cachedUint8ArrayMemory0;
499
+ }
500
+
501
+ function handleError(f, args) {
502
+ try {
503
+ return f.apply(this, args);
504
+ } catch (e) {
505
+ const idx = addToExternrefTable0(e);
506
+ wasm.__wbindgen_exn_store_command_export(idx);
507
+ }
508
+ }
509
+
510
+ function isLikeNone(x) {
511
+ return x === undefined || x === null;
512
+ }
513
+
514
+ function passArray8ToWasm0(arg, malloc) {
515
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
516
+ getUint8ArrayMemory0().set(arg, ptr / 1);
517
+ WASM_VECTOR_LEN = arg.length;
518
+ return ptr;
519
+ }
520
+
521
+ function passStringToWasm0(arg, malloc, realloc) {
522
+ if (realloc === undefined) {
523
+ const buf = cachedTextEncoder.encode(arg);
524
+ const ptr = malloc(buf.length, 1) >>> 0;
525
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
526
+ WASM_VECTOR_LEN = buf.length;
527
+ return ptr;
528
+ }
529
+
530
+ let len = arg.length;
531
+ let ptr = malloc(len, 1) >>> 0;
532
+
533
+ const mem = getUint8ArrayMemory0();
534
+
535
+ let offset = 0;
536
+
537
+ for (; offset < len; offset++) {
538
+ const code = arg.charCodeAt(offset);
539
+ if (code > 0x7F) break;
540
+ mem[ptr + offset] = code;
541
+ }
542
+ if (offset !== len) {
543
+ if (offset !== 0) {
544
+ arg = arg.slice(offset);
545
+ }
546
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
547
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
548
+ const ret = cachedTextEncoder.encodeInto(arg, view);
549
+
550
+ offset += ret.written;
551
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
552
+ }
553
+
554
+ WASM_VECTOR_LEN = offset;
555
+ return ptr;
556
+ }
557
+
558
+ function takeFromExternrefTable0(idx) {
559
+ const value = wasm.__wbindgen_externrefs.get(idx);
560
+ wasm.__externref_table_dealloc_command_export(idx);
561
+ return value;
562
+ }
563
+
564
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
565
+ cachedTextDecoder.decode();
566
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
567
+ let numBytesDecoded = 0;
568
+ function decodeText(ptr, len) {
569
+ numBytesDecoded += len;
570
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
571
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
572
+ cachedTextDecoder.decode();
573
+ numBytesDecoded = len;
574
+ }
575
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
576
+ }
577
+
578
+ const cachedTextEncoder = new TextEncoder();
579
+
580
+ if (!('encodeInto' in cachedTextEncoder)) {
581
+ cachedTextEncoder.encodeInto = function (arg, view) {
582
+ const buf = cachedTextEncoder.encode(arg);
583
+ view.set(buf);
584
+ return {
585
+ read: arg.length,
586
+ written: buf.length
587
+ };
588
+ };
589
+ }
590
+
591
+ let WASM_VECTOR_LEN = 0;
592
+
593
+
594
+ let wasm;
595
+ export function __wbg_set_wasm(val) {
596
+ wasm = val;
597
+ }
Binary file
@@ -0,0 +1,34 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const __wbg_logsink_free: (a: number, b: number) => void;
5
+ export const __wbg_renderer_free: (a: number, b: number) => void;
6
+ export const logsink_clear: (a: number) => void;
7
+ export const logsink_drain: (a: number) => any;
8
+ export const logsink_drainLines: (a: number) => [number, number];
9
+ export const logsink_isEmpty: (a: number) => number;
10
+ export const logsink_len: (a: number) => number;
11
+ export const logsink_new: (a: number, b: number) => [number, number, number];
12
+ export const logsink_onEvent: (a: number, b: number) => void;
13
+ export const logsink_setCapacity: (a: number, b: number) => void;
14
+ export const renderer_attribution: (a: number) => [number, number];
15
+ export const renderer_bindSource: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
16
+ export const renderer_boundSources: (a: number) => [number, number];
17
+ export const renderer_clearSources: (a: number) => void;
18
+ export const renderer_neededGlyphRanges: (a: number) => [number, number, number];
19
+ export const renderer_new: (a: number, b: number) => [number, number, number];
20
+ export const renderer_renderTile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
21
+ export const renderer_requestedNeighborOffsets: (a: number, b: number, c: number) => [number, number, number];
22
+ export const renderer_setStyle: (a: number, b: number, c: number) => [number, number, number];
23
+ export const renderer_tileSize: (a: number) => number;
24
+ export const simdEnabled: () => number;
25
+ export const threadsEnabled: () => number;
26
+ export const __wbindgen_malloc_command_export: (a: number, b: number) => number;
27
+ export const __wbindgen_realloc_command_export: (a: number, b: number, c: number, d: number) => number;
28
+ export const __wbindgen_exn_store_command_export: (a: number) => void;
29
+ export const __externref_table_alloc_command_export: () => number;
30
+ export const __wbindgen_externrefs: WebAssembly.Table;
31
+ export const __wbindgen_free_command_export: (a: number, b: number, c: number) => void;
32
+ export const __externref_drop_slice_command_export: (a: number, b: number) => void;
33
+ export const __externref_table_dealloc_command_export: (a: number) => void;
34
+ export const __wbindgen_start: () => void;