@kuncat/avoidant 0.1.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,1851 @@
1
+ /* @ts-self-types="./avoidant_wasm.d.ts" */
2
+ import * as import1 from "svelte/store"
3
+ import * as import2 from "svelte/store"
4
+
5
+
6
+ export class Channel {
7
+ static __wrap(ptr) {
8
+ const obj = Object.create(Channel.prototype);
9
+ obj.__wbg_ptr = ptr;
10
+ ChannelFinalization.register(obj, obj.__wbg_ptr, obj);
11
+ return obj;
12
+ }
13
+ __destroy_into_raw() {
14
+ const ptr = this.__wbg_ptr;
15
+ this.__wbg_ptr = 0;
16
+ ChannelFinalization.unregister(this);
17
+ return ptr;
18
+ }
19
+ free() {
20
+ const ptr = this.__destroy_into_raw();
21
+ wasm.__wbg_channel_free(ptr, 0);
22
+ }
23
+ /**
24
+ * @returns {string}
25
+ */
26
+ id() {
27
+ let deferred1_0;
28
+ let deferred1_1;
29
+ try {
30
+ const ret = wasm.channel_id(this.__wbg_ptr);
31
+ deferred1_0 = ret[0];
32
+ deferred1_1 = ret[1];
33
+ return getStringFromWasm0(ret[0], ret[1]);
34
+ } finally {
35
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
36
+ }
37
+ }
38
+ /**
39
+ * @returns {string[]}
40
+ */
41
+ neighbors() {
42
+ const ret = wasm.channel_neighbors(this.__wbg_ptr);
43
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
44
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
45
+ return v1;
46
+ }
47
+ /**
48
+ * @returns {ReadableStream}
49
+ */
50
+ get receiver() {
51
+ const ret = wasm.channel_receiver(this.__wbg_ptr);
52
+ return ret;
53
+ }
54
+ /**
55
+ * @returns {ChannelSender}
56
+ */
57
+ get sender() {
58
+ const ret = wasm.channel_sender(this.__wbg_ptr);
59
+ return ChannelSender.__wrap(ret);
60
+ }
61
+ /**
62
+ * @param {any} opts
63
+ * @returns {string}
64
+ */
65
+ ticket(opts) {
66
+ let deferred2_0;
67
+ let deferred2_1;
68
+ try {
69
+ const ret = wasm.channel_ticket(this.__wbg_ptr, opts);
70
+ var ptr1 = ret[0];
71
+ var len1 = ret[1];
72
+ if (ret[3]) {
73
+ ptr1 = 0; len1 = 0;
74
+ throw takeFromExternrefTable0(ret[2]);
75
+ }
76
+ deferred2_0 = ptr1;
77
+ deferred2_1 = len1;
78
+ return getStringFromWasm0(ptr1, len1);
79
+ } finally {
80
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
81
+ }
82
+ }
83
+ }
84
+ if (Symbol.dispose) Channel.prototype[Symbol.dispose] = Channel.prototype.free;
85
+
86
+ export class ChannelSender {
87
+ static __wrap(ptr) {
88
+ const obj = Object.create(ChannelSender.prototype);
89
+ obj.__wbg_ptr = ptr;
90
+ ChannelSenderFinalization.register(obj, obj.__wbg_ptr, obj);
91
+ return obj;
92
+ }
93
+ __destroy_into_raw() {
94
+ const ptr = this.__wbg_ptr;
95
+ this.__wbg_ptr = 0;
96
+ ChannelSenderFinalization.unregister(this);
97
+ return ptr;
98
+ }
99
+ free() {
100
+ const ptr = this.__destroy_into_raw();
101
+ wasm.__wbg_channelsender_free(ptr, 0);
102
+ }
103
+ /**
104
+ * @param {string} text
105
+ * @returns {Promise<void>}
106
+ */
107
+ broadcast(text) {
108
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
109
+ const len0 = WASM_VECTOR_LEN;
110
+ const ret = wasm.channelsender_broadcast(this.__wbg_ptr, ptr0, len0);
111
+ return ret;
112
+ }
113
+ /**
114
+ * @param {string} nickname
115
+ */
116
+ set_nickame(nickname) {
117
+ const ptr0 = passStringToWasm0(nickname, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
118
+ const len0 = WASM_VECTOR_LEN;
119
+ wasm.channelsender_set_nickame(this.__wbg_ptr, ptr0, len0);
120
+ }
121
+ }
122
+ if (Symbol.dispose) ChannelSender.prototype[Symbol.dispose] = ChannelSender.prototype.free;
123
+
124
+ export class GameState {
125
+ __destroy_into_raw() {
126
+ const ptr = this.__wbg_ptr;
127
+ this.__wbg_ptr = 0;
128
+ GameStateFinalization.unregister(this);
129
+ return ptr;
130
+ }
131
+ free() {
132
+ const ptr = this.__destroy_into_raw();
133
+ wasm.__wbg_gamestate_free(ptr, 0);
134
+ }
135
+ /**
136
+ * Apply cells produced off-thread (typically by the mapgen Web Worker).
137
+ *
138
+ * `cells` must be a JS array of objects matching the `MapCell` shape (i.e. `{ vertices: [[x, y, z], ...] }`).
139
+ * @param {MapCell[]} cells
140
+ * @returns {MapCell[]}
141
+ */
142
+ applyMapCells(cells) {
143
+ const ret = wasm.gamestate_applyMapCells(this.__wbg_ptr, cells);
144
+ if (ret[2]) {
145
+ throw takeFromExternrefTable0(ret[1]);
146
+ }
147
+ return takeFromExternrefTable0(ret[0]);
148
+ }
149
+ /**
150
+ * @returns {Readable<Array<CellMetadataEntry>>}
151
+ */
152
+ get cellMetadata() {
153
+ const ret = wasm.gamestate_cellMetadata(this.__wbg_ptr);
154
+ return ret;
155
+ }
156
+ /**
157
+ * @returns {Readable<Array<MapCell>>}
158
+ */
159
+ get cells() {
160
+ const ret = wasm.gamestate_cells(this.__wbg_ptr);
161
+ return ret;
162
+ }
163
+ /**
164
+ * @returns {number}
165
+ */
166
+ get elevationMax() {
167
+ const ret = wasm.gamestate_elevationMax(this.__wbg_ptr);
168
+ return ret;
169
+ }
170
+ /**
171
+ * @returns {number}
172
+ */
173
+ get elevationMin() {
174
+ const ret = wasm.gamestate_elevationMin(this.__wbg_ptr);
175
+ return ret;
176
+ }
177
+ /**
178
+ * @returns {string | undefined}
179
+ */
180
+ get endpointId() {
181
+ const ret = wasm.gamestate_endpointId(this.__wbg_ptr);
182
+ let v1;
183
+ if (ret[0] !== 0) {
184
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
185
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
186
+ }
187
+ return v1;
188
+ }
189
+ /**
190
+ * @param {number} index
191
+ * @param {number} x
192
+ * @param {number} y
193
+ * @param {number} z
194
+ */
195
+ exploreCell(index, x, y, z) {
196
+ const ret = wasm.gamestate_exploreCell(this.__wbg_ptr, index, x, y, z);
197
+ if (ret[1]) {
198
+ throw takeFromExternrefTable0(ret[0]);
199
+ }
200
+ }
201
+ /**
202
+ * @returns {boolean}
203
+ */
204
+ get hasNetworkNode() {
205
+ const ret = wasm.gamestate_hasNetworkNode(this.__wbg_ptr);
206
+ return ret !== 0;
207
+ }
208
+ /**
209
+ * @param {string} nickname
210
+ * @returns {Promise<string>}
211
+ */
212
+ invite(nickname) {
213
+ const ptr0 = passStringToWasm0(nickname, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
214
+ const len0 = WASM_VECTOR_LEN;
215
+ const ret = wasm.gamestate_invite(this.__wbg_ptr, ptr0, len0);
216
+ return ret;
217
+ }
218
+ /**
219
+ * Spawn a network node and join the gossip topic described by `ticket`.
220
+ *
221
+ * The caller is responsible for having populated the map cells (typically
222
+ * via [`GameState::apply_map_cells`]) before invoking this; the function
223
+ * only concerns itself with bringing the network layer online.
224
+ * @param {string} ticket
225
+ * @param {string} nickname
226
+ * @returns {Promise<void>}
227
+ */
228
+ joinAsPeer(ticket, nickname) {
229
+ const ptr0 = passStringToWasm0(ticket, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
230
+ const len0 = WASM_VECTOR_LEN;
231
+ const ptr1 = passStringToWasm0(nickname, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
232
+ const len1 = WASM_VECTOR_LEN;
233
+ const ret = wasm.gamestate_joinAsPeer(this.__wbg_ptr, ptr0, len0, ptr1, len1);
234
+ return ret;
235
+ }
236
+ /**
237
+ * @returns {number | undefined}
238
+ */
239
+ get lastInboundMutationMs() {
240
+ const ret = wasm.gamestate_lastInboundMutationMs(this.__wbg_ptr);
241
+ return ret[0] === 0 ? undefined : ret[1];
242
+ }
243
+ /**
244
+ * @returns {number | undefined}
245
+ */
246
+ get lastOutboundMutationMs() {
247
+ const ret = wasm.gamestate_lastOutboundMutationMs(this.__wbg_ptr);
248
+ return ret[0] === 0 ? undefined : ret[1];
249
+ }
250
+ /**
251
+ * @returns {boolean}
252
+ */
253
+ get networkListenerStarted() {
254
+ const ret = wasm.gamestate_networkListenerStarted(this.__wbg_ptr);
255
+ return ret !== 0;
256
+ }
257
+ /**
258
+ * @returns {NetworkPeerStatus[]}
259
+ */
260
+ get networkPeers() {
261
+ const ret = wasm.gamestate_networkPeers(this.__wbg_ptr);
262
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
263
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
264
+ return v1;
265
+ }
266
+ /**
267
+ * @returns {Readable<NetworkSnapshot>}
268
+ */
269
+ get networkSnapshot() {
270
+ const ret = wasm.gamestate_networkSnapshot(this.__wbg_ptr);
271
+ return ret;
272
+ }
273
+ /**
274
+ * @param {GameOptions} options
275
+ */
276
+ constructor(options) {
277
+ const ret = wasm.gamestate_new(options);
278
+ if (ret[2]) {
279
+ throw takeFromExternrefTable0(ret[1]);
280
+ }
281
+ this.__wbg_ptr = ret[0];
282
+ GameStateFinalization.register(this, this.__wbg_ptr, this);
283
+ return this;
284
+ }
285
+ /**
286
+ * @param {string} ticket
287
+ * @returns {GameOptions}
288
+ */
289
+ static optionsFromTicket(ticket) {
290
+ const ptr0 = passStringToWasm0(ticket, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
291
+ const len0 = WASM_VECTOR_LEN;
292
+ const ret = wasm.gamestate_optionsFromTicket(ptr0, len0);
293
+ if (ret[2]) {
294
+ throw takeFromExternrefTable0(ret[1]);
295
+ }
296
+ return takeFromExternrefTable0(ret[0]);
297
+ }
298
+ /**
299
+ * @param {number} index
300
+ * @param {number} x
301
+ * @param {number} y
302
+ * @param {number} z
303
+ */
304
+ queueExplorePulse(index, x, y, z) {
305
+ const ret = wasm.gamestate_queueExplorePulse(this.__wbg_ptr, index, x, y, z);
306
+ if (ret[1]) {
307
+ throw takeFromExternrefTable0(ret[0]);
308
+ }
309
+ }
310
+ /**
311
+ * TODO(peer-join-sync): when peer-join state sync is implemented, the inviter should snapshot this store and send it alongside `cell_metadata` so a joining peer starts with the correct score, streak, and counters.
312
+ * @returns {Readable<ScoreState>}
313
+ */
314
+ get score() {
315
+ const ret = wasm.gamestate_score(this.__wbg_ptr);
316
+ return ret;
317
+ }
318
+ /**
319
+ * @returns {string | undefined}
320
+ */
321
+ get topicId() {
322
+ const ret = wasm.gamestate_topicId(this.__wbg_ptr);
323
+ let v1;
324
+ if (ret[0] !== 0) {
325
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
326
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
327
+ }
328
+ return v1;
329
+ }
330
+ /**
331
+ * @returns {UiState}
332
+ */
333
+ get uiState() {
334
+ const ret = wasm.gamestate_uiState(this.__wbg_ptr);
335
+ return UiState.__wrap(ret);
336
+ }
337
+ }
338
+ if (Symbol.dispose) GameState.prototype[Symbol.dispose] = GameState.prototype.free;
339
+
340
+ export class IntoUnderlyingByteSource {
341
+ __destroy_into_raw() {
342
+ const ptr = this.__wbg_ptr;
343
+ this.__wbg_ptr = 0;
344
+ IntoUnderlyingByteSourceFinalization.unregister(this);
345
+ return ptr;
346
+ }
347
+ free() {
348
+ const ptr = this.__destroy_into_raw();
349
+ wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
350
+ }
351
+ /**
352
+ * @returns {number}
353
+ */
354
+ get autoAllocateChunkSize() {
355
+ const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
356
+ return ret >>> 0;
357
+ }
358
+ cancel() {
359
+ const ptr = this.__destroy_into_raw();
360
+ wasm.intounderlyingbytesource_cancel(ptr);
361
+ }
362
+ /**
363
+ * @param {ReadableByteStreamController} controller
364
+ * @returns {Promise<any>}
365
+ */
366
+ pull(controller) {
367
+ const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
368
+ return ret;
369
+ }
370
+ /**
371
+ * @param {ReadableByteStreamController} controller
372
+ */
373
+ start(controller) {
374
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
375
+ }
376
+ /**
377
+ * @returns {ReadableStreamType}
378
+ */
379
+ get type() {
380
+ const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
381
+ return __wbindgen_enum_ReadableStreamType[ret];
382
+ }
383
+ }
384
+ if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
385
+
386
+ export class IntoUnderlyingSink {
387
+ __destroy_into_raw() {
388
+ const ptr = this.__wbg_ptr;
389
+ this.__wbg_ptr = 0;
390
+ IntoUnderlyingSinkFinalization.unregister(this);
391
+ return ptr;
392
+ }
393
+ free() {
394
+ const ptr = this.__destroy_into_raw();
395
+ wasm.__wbg_intounderlyingsink_free(ptr, 0);
396
+ }
397
+ /**
398
+ * @param {any} reason
399
+ * @returns {Promise<any>}
400
+ */
401
+ abort(reason) {
402
+ const ptr = this.__destroy_into_raw();
403
+ const ret = wasm.intounderlyingsink_abort(ptr, reason);
404
+ return ret;
405
+ }
406
+ /**
407
+ * @returns {Promise<any>}
408
+ */
409
+ close() {
410
+ const ptr = this.__destroy_into_raw();
411
+ const ret = wasm.intounderlyingsink_close(ptr);
412
+ return ret;
413
+ }
414
+ /**
415
+ * @param {any} chunk
416
+ * @returns {Promise<any>}
417
+ */
418
+ write(chunk) {
419
+ const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
420
+ return ret;
421
+ }
422
+ }
423
+ if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
424
+
425
+ export class IntoUnderlyingSource {
426
+ static __wrap(ptr) {
427
+ const obj = Object.create(IntoUnderlyingSource.prototype);
428
+ obj.__wbg_ptr = ptr;
429
+ IntoUnderlyingSourceFinalization.register(obj, obj.__wbg_ptr, obj);
430
+ return obj;
431
+ }
432
+ __destroy_into_raw() {
433
+ const ptr = this.__wbg_ptr;
434
+ this.__wbg_ptr = 0;
435
+ IntoUnderlyingSourceFinalization.unregister(this);
436
+ return ptr;
437
+ }
438
+ free() {
439
+ const ptr = this.__destroy_into_raw();
440
+ wasm.__wbg_intounderlyingsource_free(ptr, 0);
441
+ }
442
+ cancel() {
443
+ const ptr = this.__destroy_into_raw();
444
+ wasm.intounderlyingsource_cancel(ptr);
445
+ }
446
+ /**
447
+ * @param {ReadableStreamDefaultController} controller
448
+ * @returns {Promise<any>}
449
+ */
450
+ pull(controller) {
451
+ const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
452
+ return ret;
453
+ }
454
+ }
455
+ if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
456
+
457
+ export class NetworkNode {
458
+ static __wrap(ptr) {
459
+ const obj = Object.create(NetworkNode.prototype);
460
+ obj.__wbg_ptr = ptr;
461
+ NetworkNodeFinalization.register(obj, obj.__wbg_ptr, obj);
462
+ return obj;
463
+ }
464
+ __destroy_into_raw() {
465
+ const ptr = this.__wbg_ptr;
466
+ this.__wbg_ptr = 0;
467
+ NetworkNodeFinalization.unregister(this);
468
+ return ptr;
469
+ }
470
+ free() {
471
+ const ptr = this.__destroy_into_raw();
472
+ wasm.__wbg_networknode_free(ptr, 0);
473
+ }
474
+ /**
475
+ * @param {string} nickname
476
+ * @returns {Promise<Channel>}
477
+ */
478
+ create(nickname) {
479
+ const ptr0 = passStringToWasm0(nickname, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
480
+ const len0 = WASM_VECTOR_LEN;
481
+ const ret = wasm.networknode_create(this.__wbg_ptr, ptr0, len0);
482
+ return ret;
483
+ }
484
+ /**
485
+ * Returns the endpoint id of this node.
486
+ * @returns {string}
487
+ */
488
+ endpointId() {
489
+ let deferred1_0;
490
+ let deferred1_1;
491
+ try {
492
+ const ret = wasm.networknode_endpointId(this.__wbg_ptr);
493
+ deferred1_0 = ret[0];
494
+ deferred1_1 = ret[1];
495
+ return getStringFromWasm0(ret[0], ret[1]);
496
+ } finally {
497
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
498
+ }
499
+ }
500
+ /**
501
+ * @param {string} ticket
502
+ * @param {string} nickname
503
+ * @returns {Promise<Channel>}
504
+ */
505
+ join(ticket, nickname) {
506
+ const ptr0 = passStringToWasm0(ticket, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
507
+ const len0 = WASM_VECTOR_LEN;
508
+ const ptr1 = passStringToWasm0(nickname, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
509
+ const len1 = WASM_VECTOR_LEN;
510
+ const ret = wasm.networknode_join(this.__wbg_ptr, ptr0, len0, ptr1, len1);
511
+ return ret;
512
+ }
513
+ /**
514
+ * Spawns a gossip node.
515
+ * @returns {Promise<NetworkNode>}
516
+ */
517
+ static spawn() {
518
+ const ret = wasm.networknode_spawn();
519
+ return ret;
520
+ }
521
+ }
522
+ if (Symbol.dispose) NetworkNode.prototype[Symbol.dispose] = NetworkNode.prototype.free;
523
+
524
+ export class Pulse {
525
+ static __wrap(ptr) {
526
+ const obj = Object.create(Pulse.prototype);
527
+ obj.__wbg_ptr = ptr;
528
+ PulseFinalization.register(obj, obj.__wbg_ptr, obj);
529
+ return obj;
530
+ }
531
+ __destroy_into_raw() {
532
+ const ptr = this.__wbg_ptr;
533
+ this.__wbg_ptr = 0;
534
+ PulseFinalization.unregister(this);
535
+ return ptr;
536
+ }
537
+ free() {
538
+ const ptr = this.__destroy_into_raw();
539
+ wasm.__wbg_pulse_free(ptr, 0);
540
+ }
541
+ /**
542
+ * @returns {number}
543
+ */
544
+ get createdAtMs() {
545
+ const ret = wasm.pulse_createdAtMs(this.__wbg_ptr);
546
+ return ret;
547
+ }
548
+ /**
549
+ * @returns {number}
550
+ */
551
+ get durationMs() {
552
+ const ret = wasm.pulse_durationMs(this.__wbg_ptr);
553
+ return ret >>> 0;
554
+ }
555
+ /**
556
+ * @returns {number}
557
+ */
558
+ get id() {
559
+ const ret = wasm.pulse_id(this.__wbg_ptr);
560
+ return ret >>> 0;
561
+ }
562
+ /**
563
+ * @returns {boolean}
564
+ */
565
+ get isRemote() {
566
+ const ret = wasm.pulse_isRemote(this.__wbg_ptr);
567
+ return ret !== 0;
568
+ }
569
+ /**
570
+ * @returns {number}
571
+ */
572
+ get maxRadius() {
573
+ const ret = wasm.pulse_maxRadius(this.__wbg_ptr);
574
+ return ret;
575
+ }
576
+ /**
577
+ * @returns {Pulse}
578
+ */
579
+ static nullPulse() {
580
+ const ret = wasm.pulse_nullPulse();
581
+ return Pulse.__wrap(ret);
582
+ }
583
+ /**
584
+ * @returns {number}
585
+ */
586
+ get originCell() {
587
+ const ret = wasm.pulse_originCell(this.__wbg_ptr);
588
+ return ret >>> 0;
589
+ }
590
+ /**
591
+ * @returns {Float64Array}
592
+ */
593
+ get position() {
594
+ const ret = wasm.pulse_position(this.__wbg_ptr);
595
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
596
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
597
+ return v1;
598
+ }
599
+ }
600
+ if (Symbol.dispose) Pulse.prototype[Symbol.dispose] = Pulse.prototype.free;
601
+
602
+ export class UiState {
603
+ static __wrap(ptr) {
604
+ const obj = Object.create(UiState.prototype);
605
+ obj.__wbg_ptr = ptr;
606
+ UiStateFinalization.register(obj, obj.__wbg_ptr, obj);
607
+ return obj;
608
+ }
609
+ __destroy_into_raw() {
610
+ const ptr = this.__wbg_ptr;
611
+ this.__wbg_ptr = 0;
612
+ UiStateFinalization.unregister(this);
613
+ return ptr;
614
+ }
615
+ free() {
616
+ const ptr = this.__destroy_into_raw();
617
+ wasm.__wbg_uistate_free(ptr, 0);
618
+ }
619
+ /**
620
+ * @returns {Readable<Array<Pulse>>}
621
+ */
622
+ get pulses() {
623
+ const ret = wasm.uistate_pulses(this.__wbg_ptr);
624
+ return ret;
625
+ }
626
+ }
627
+ if (Symbol.dispose) UiState.prototype[Symbol.dispose] = UiState.prototype.free;
628
+
629
+ /**
630
+ * Build map cells and a subdivided terrain triangle mesh.
631
+ * @param {GameOptions} options
632
+ * @returns {MapData}
633
+ */
634
+ export function generateMapData(options) {
635
+ const ret = wasm.generateMapData(options);
636
+ if (ret[2]) {
637
+ throw takeFromExternrefTable0(ret[1]);
638
+ }
639
+ return takeFromExternrefTable0(ret[0]);
640
+ }
641
+
642
+ export function start() {
643
+ wasm.start();
644
+ }
645
+ function __wbg_get_imports() {
646
+ const import0 = {
647
+ __proto__: null,
648
+ __wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
649
+ const ret = Error(getStringFromWasm0(arg0, arg1));
650
+ return ret;
651
+ },
652
+ __wbg_Number_6b506e6536831eaa: function(arg0) {
653
+ const ret = Number(arg0);
654
+ return ret;
655
+ },
656
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
657
+ const ret = String(arg1);
658
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
659
+ const len1 = WASM_VECTOR_LEN;
660
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
661
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
662
+ },
663
+ __wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d: function(arg0, arg1) {
664
+ const v = arg1;
665
+ const ret = typeof(v) === 'bigint' ? v : undefined;
666
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
667
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
668
+ },
669
+ __wbg___wbindgen_boolean_get_1a45e2c38d4d41b9: function(arg0) {
670
+ const v = arg0;
671
+ const ret = typeof(v) === 'boolean' ? v : undefined;
672
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
673
+ },
674
+ __wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
675
+ const ret = debugString(arg1);
676
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
677
+ const len1 = WASM_VECTOR_LEN;
678
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
679
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
680
+ },
681
+ __wbg___wbindgen_in_70a403a56e771704: function(arg0, arg1) {
682
+ const ret = arg0 in arg1;
683
+ return ret;
684
+ },
685
+ __wbg___wbindgen_is_bigint_6ffd6468a9bc44b9: function(arg0) {
686
+ const ret = typeof(arg0) === 'bigint';
687
+ return ret;
688
+ },
689
+ __wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
690
+ const ret = typeof(arg0) === 'function';
691
+ return ret;
692
+ },
693
+ __wbg___wbindgen_is_null_87c3bfe968c6a5ad: function(arg0) {
694
+ const ret = arg0 === null;
695
+ return ret;
696
+ },
697
+ __wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
698
+ const val = arg0;
699
+ const ret = typeof(val) === 'object' && val !== null;
700
+ return ret;
701
+ },
702
+ __wbg___wbindgen_is_string_c236cabd84a4d769: function(arg0) {
703
+ const ret = typeof(arg0) === 'string';
704
+ return ret;
705
+ },
706
+ __wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
707
+ const ret = arg0 === undefined;
708
+ return ret;
709
+ },
710
+ __wbg___wbindgen_jsval_eq_1068e624fa87f6ab: function(arg0, arg1) {
711
+ const ret = arg0 === arg1;
712
+ return ret;
713
+ },
714
+ __wbg___wbindgen_jsval_loose_eq_2c56564c75129511: function(arg0, arg1) {
715
+ const ret = arg0 == arg1;
716
+ return ret;
717
+ },
718
+ __wbg___wbindgen_number_get_9bb1761122181af2: function(arg0, arg1) {
719
+ const obj = arg1;
720
+ const ret = typeof(obj) === 'number' ? obj : undefined;
721
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
722
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
723
+ },
724
+ __wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
725
+ const obj = arg1;
726
+ const ret = typeof(obj) === 'string' ? obj : undefined;
727
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
728
+ var len1 = WASM_VECTOR_LEN;
729
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
730
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
731
+ },
732
+ __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
733
+ throw new Error(getStringFromWasm0(arg0, arg1));
734
+ },
735
+ __wbg__wbg_cb_unref_61db23ac97f16c31: function(arg0) {
736
+ arg0._wbg_cb_unref();
737
+ },
738
+ __wbg_abort_2ec46222bf378517: function(arg0) {
739
+ arg0.abort();
740
+ },
741
+ __wbg_abort_b29d719932441c95: function(arg0, arg1) {
742
+ arg0.abort(arg1);
743
+ },
744
+ __wbg_addEventListener_b8b20954e04ea19f: function() { return handleError(function (arg0, arg1, arg2, arg3) {
745
+ arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3);
746
+ }, arguments); },
747
+ __wbg_append_e1746995edcb0170: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
748
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
749
+ }, arguments); },
750
+ __wbg_arrayBuffer_05927079aabe6d46: function() { return handleError(function (arg0) {
751
+ const ret = arg0.arrayBuffer();
752
+ return ret;
753
+ }, arguments); },
754
+ __wbg_body_61a0827da5b6d2bc: function(arg0) {
755
+ const ret = arg0.body;
756
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
757
+ },
758
+ __wbg_buffer_d370c8cae5692933: function(arg0) {
759
+ const ret = arg0.buffer;
760
+ return ret;
761
+ },
762
+ __wbg_byobRequest_2c89fb4ab478fa09: function(arg0) {
763
+ const ret = arg0.byobRequest;
764
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
765
+ },
766
+ __wbg_byteLength_2c6dc3b4b85d3547: function(arg0) {
767
+ const ret = arg0.byteLength;
768
+ return ret;
769
+ },
770
+ __wbg_byteOffset_349aa9bf0a183eca: function(arg0) {
771
+ const ret = arg0.byteOffset;
772
+ return ret;
773
+ },
774
+ __wbg_call_8a89609d89f6608a: function() { return handleError(function (arg0, arg1) {
775
+ const ret = arg0.call(arg1);
776
+ return ret;
777
+ }, arguments); },
778
+ __wbg_call_9c758de292015997: function() { return handleError(function (arg0, arg1, arg2) {
779
+ const ret = arg0.call(arg1, arg2);
780
+ return ret;
781
+ }, arguments); },
782
+ __wbg_cancel_3dedc1c2245a59d4: function(arg0) {
783
+ const ret = arg0.cancel();
784
+ return ret;
785
+ },
786
+ __wbg_catch_17ae9c6dfb88ad8a: function(arg0, arg1) {
787
+ const ret = arg0.catch(arg1);
788
+ return ret;
789
+ },
790
+ __wbg_channel_new: function(arg0) {
791
+ const ret = Channel.__wrap(arg0);
792
+ return ret;
793
+ },
794
+ __wbg_clearTimeout_333bba87532ab9d3: function(arg0) {
795
+ const ret = clearTimeout(arg0);
796
+ return ret;
797
+ },
798
+ __wbg_clearTimeout_47a40e3be01ed7a3: function() { return handleError(function (arg0, arg1) {
799
+ arg0.clearTimeout(arg1);
800
+ }, arguments); },
801
+ __wbg_close_4859304bbf0f8208: function() { return handleError(function (arg0) {
802
+ arg0.close();
803
+ }, arguments); },
804
+ __wbg_close_6f12196fe155e8d2: function() { return handleError(function (arg0) {
805
+ arg0.close();
806
+ }, arguments); },
807
+ __wbg_close_9acc00cbca310439: function() { return handleError(function (arg0) {
808
+ arg0.close();
809
+ }, arguments); },
810
+ __wbg_code_27a1f220ebdc7c36: function(arg0) {
811
+ const ret = arg0.code;
812
+ return ret;
813
+ },
814
+ __wbg_code_dcc2ccc631d1fc5c: function(arg0) {
815
+ const ret = arg0.code;
816
+ return ret;
817
+ },
818
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
819
+ const ret = arg0.crypto;
820
+ return ret;
821
+ },
822
+ __wbg_data_bd354b70c783c66e: function(arg0) {
823
+ const ret = arg0.data;
824
+ return ret;
825
+ },
826
+ __wbg_debug_eaef3b49d572d680: function(arg0, arg1) {
827
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
828
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
829
+ console.debug(...v0);
830
+ },
831
+ __wbg_done_60cf307fcc680536: function(arg0) {
832
+ const ret = arg0.done;
833
+ return ret;
834
+ },
835
+ __wbg_enqueue_09035479e2081625: function() { return handleError(function (arg0, arg1) {
836
+ arg0.enqueue(arg1);
837
+ }, arguments); },
838
+ __wbg_entries_04b37a02507f1713: function(arg0) {
839
+ const ret = Object.entries(arg0);
840
+ return ret;
841
+ },
842
+ __wbg_entries_18ec04521d5991e6: function(arg0) {
843
+ const ret = arg0.entries();
844
+ return ret;
845
+ },
846
+ __wbg_error_71b0e71161a5f3a0: function(arg0, arg1) {
847
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
848
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
849
+ console.error(...v0);
850
+ },
851
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
852
+ let deferred0_0;
853
+ let deferred0_1;
854
+ try {
855
+ deferred0_0 = arg0;
856
+ deferred0_1 = arg1;
857
+ console.error(getStringFromWasm0(arg0, arg1));
858
+ } finally {
859
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
860
+ }
861
+ },
862
+ __wbg_fetch_074561c3e313c86f: function(arg0) {
863
+ const ret = fetch(arg0);
864
+ return ret;
865
+ },
866
+ __wbg_fetch_344c8d3849002659: function(arg0, arg1) {
867
+ const ret = arg0.fetch(arg1);
868
+ return ret;
869
+ },
870
+ __wbg_getRandomValues_76dfc69825c9c552: function() { return handleError(function (arg0, arg1) {
871
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
872
+ }, arguments); },
873
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
874
+ arg0.getRandomValues(arg1);
875
+ }, arguments); },
876
+ __wbg_getReader_9facd4f899beac89: function() { return handleError(function (arg0) {
877
+ const ret = arg0.getReader();
878
+ return ret;
879
+ }, arguments); },
880
+ __wbg_get_1f8f054ddbaa7db2: function() { return handleError(function (arg0, arg1) {
881
+ const ret = Reflect.get(arg0, arg1);
882
+ return ret;
883
+ }, arguments); },
884
+ __wbg_get_2b48c7d0d006a781: function(arg0, arg1) {
885
+ const ret = arg0[arg1 >>> 0];
886
+ return ret;
887
+ },
888
+ __wbg_get_de6a0f7d4d18a304: function() { return handleError(function (arg0, arg1) {
889
+ const ret = Reflect.get(arg0, arg1);
890
+ return ret;
891
+ }, arguments); },
892
+ __wbg_get_done_ea9eb315d4ec1e81: function(arg0) {
893
+ const ret = arg0.done;
894
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
895
+ },
896
+ __wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
897
+ const ret = arg0[arg1 >>> 0];
898
+ return ret;
899
+ },
900
+ __wbg_get_value_c68fe2e1a76c69ca: function(arg0) {
901
+ const ret = arg0.value;
902
+ return ret;
903
+ },
904
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
905
+ const ret = arg0[arg1];
906
+ return ret;
907
+ },
908
+ __wbg_has_73740b27f436fed3: function() { return handleError(function (arg0, arg1) {
909
+ const ret = Reflect.has(arg0, arg1);
910
+ return ret;
911
+ }, arguments); },
912
+ __wbg_headers_0feb63d2d374b44a: function(arg0) {
913
+ const ret = arg0.headers;
914
+ return ret;
915
+ },
916
+ __wbg_instanceof_ArrayBuffer_8f49811467741499: function(arg0) {
917
+ let result;
918
+ try {
919
+ result = arg0 instanceof ArrayBuffer;
920
+ } catch (_) {
921
+ result = false;
922
+ }
923
+ const ret = result;
924
+ return ret;
925
+ },
926
+ __wbg_instanceof_Blob_f6321ce92d2740fd: function(arg0) {
927
+ let result;
928
+ try {
929
+ result = arg0 instanceof Blob;
930
+ } catch (_) {
931
+ result = false;
932
+ }
933
+ const ret = result;
934
+ return ret;
935
+ },
936
+ __wbg_instanceof_Map_9fc06d9a951bcee6: function(arg0) {
937
+ let result;
938
+ try {
939
+ result = arg0 instanceof Map;
940
+ } catch (_) {
941
+ result = false;
942
+ }
943
+ const ret = result;
944
+ return ret;
945
+ },
946
+ __wbg_instanceof_Response_cb984bd66d7bd408: function(arg0) {
947
+ let result;
948
+ try {
949
+ result = arg0 instanceof Response;
950
+ } catch (_) {
951
+ result = false;
952
+ }
953
+ const ret = result;
954
+ return ret;
955
+ },
956
+ __wbg_instanceof_Uint8Array_86f30649f63ef9c2: function(arg0) {
957
+ let result;
958
+ try {
959
+ result = arg0 instanceof Uint8Array;
960
+ } catch (_) {
961
+ result = false;
962
+ }
963
+ const ret = result;
964
+ return ret;
965
+ },
966
+ __wbg_isArray_67c2c9c4313f4448: function(arg0) {
967
+ const ret = Array.isArray(arg0);
968
+ return ret;
969
+ },
970
+ __wbg_isSafeInteger_66acec27e09e99a7: function(arg0) {
971
+ const ret = Number.isSafeInteger(arg0);
972
+ return ret;
973
+ },
974
+ __wbg_iterator_8732428d309e270e: function() {
975
+ const ret = Symbol.iterator;
976
+ return ret;
977
+ },
978
+ __wbg_length_4a591ecaa01354d9: function(arg0) {
979
+ const ret = arg0.length;
980
+ return ret;
981
+ },
982
+ __wbg_length_66f1a4b2e9026940: function(arg0) {
983
+ const ret = arg0.length;
984
+ return ret;
985
+ },
986
+ __wbg_log_7a0760e115750083: function(arg0, arg1) {
987
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
988
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
989
+ console.log(...v0);
990
+ },
991
+ __wbg_message_60b50f96f056eb26: function(arg0, arg1) {
992
+ const ret = arg1.message;
993
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
994
+ const len1 = WASM_VECTOR_LEN;
995
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
996
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
997
+ },
998
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
999
+ const ret = arg0.msCrypto;
1000
+ return ret;
1001
+ },
1002
+ __wbg_networknode_new: function(arg0) {
1003
+ const ret = NetworkNode.__wrap(arg0);
1004
+ return ret;
1005
+ },
1006
+ __wbg_new_0d09705104e164af: function() { return handleError(function () {
1007
+ const ret = new AbortController();
1008
+ return ret;
1009
+ }, arguments); },
1010
+ __wbg_new_227d7c05414eb861: function() {
1011
+ const ret = new Error();
1012
+ return ret;
1013
+ },
1014
+ __wbg_new_50bb5ebeecef71a8: function(arg0, arg1) {
1015
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1016
+ return ret;
1017
+ },
1018
+ __wbg_new_578aeef4b6b94378: function(arg0) {
1019
+ const ret = new Uint8Array(arg0);
1020
+ return ret;
1021
+ },
1022
+ __wbg_new_ce1ab61c1c2b300d: function() {
1023
+ const ret = new Object();
1024
+ return ret;
1025
+ },
1026
+ __wbg_new_d7e476b433a26bea: function() { return handleError(function (arg0, arg1) {
1027
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
1028
+ return ret;
1029
+ }, arguments); },
1030
+ __wbg_new_d90091b82fdf5b91: function() {
1031
+ const ret = new Array();
1032
+ return ret;
1033
+ },
1034
+ __wbg_new_e436d06bc8e77460: function() { return handleError(function () {
1035
+ const ret = new Headers();
1036
+ return ret;
1037
+ }, arguments); },
1038
+ __wbg_new_from_slice_18fa1f71286d66b8: function(arg0, arg1) {
1039
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1040
+ return ret;
1041
+ },
1042
+ __wbg_new_typed_bf31d18f92484486: function(arg0, arg1) {
1043
+ try {
1044
+ var state0 = {a: arg0, b: arg1};
1045
+ var cb0 = (arg0, arg1) => {
1046
+ const a = state0.a;
1047
+ state0.a = 0;
1048
+ try {
1049
+ return wasm_bindgen__convert__closures_____invoke__h299fd98c162ada8d(a, state0.b, arg0, arg1);
1050
+ } finally {
1051
+ state0.a = a;
1052
+ }
1053
+ };
1054
+ const ret = new Promise(cb0);
1055
+ return ret;
1056
+ } finally {
1057
+ state0.a = 0;
1058
+ }
1059
+ },
1060
+ __wbg_new_with_byte_offset_and_length_d836f26d916dd9ad: function(arg0, arg1, arg2) {
1061
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1062
+ return ret;
1063
+ },
1064
+ __wbg_new_with_into_underlying_source_fd904252f385f59c: function(arg0, arg1) {
1065
+ const ret = new ReadableStream(IntoUnderlyingSource.__wrap(arg0), arg1);
1066
+ return ret;
1067
+ },
1068
+ __wbg_new_with_length_36a4998e27b014c5: function(arg0) {
1069
+ const ret = new Uint8Array(arg0 >>> 0);
1070
+ return ret;
1071
+ },
1072
+ __wbg_new_with_str_and_init_bcd02b79a793d27f: function() { return handleError(function (arg0, arg1, arg2) {
1073
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
1074
+ return ret;
1075
+ }, arguments); },
1076
+ __wbg_new_with_str_sequence_9ed2327430efed8d: function() { return handleError(function (arg0, arg1, arg2) {
1077
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1), arg2);
1078
+ return ret;
1079
+ }, arguments); },
1080
+ __wbg_next_9e03acdf51c4960d: function(arg0) {
1081
+ const ret = arg0.next;
1082
+ return ret;
1083
+ },
1084
+ __wbg_next_eb8ca7351fa27906: function() { return handleError(function (arg0) {
1085
+ const ret = arg0.next();
1086
+ return ret;
1087
+ }, arguments); },
1088
+ __wbg_node_84ea875411254db1: function(arg0) {
1089
+ const ret = arg0.node;
1090
+ return ret;
1091
+ },
1092
+ __wbg_now_190933fa139cc119: function() {
1093
+ const ret = Date.now();
1094
+ return ret;
1095
+ },
1096
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
1097
+ const ret = arg0.now();
1098
+ return ret;
1099
+ },
1100
+ __wbg_parse_03863847d06c4e89: function() { return handleError(function (arg0, arg1) {
1101
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
1102
+ return ret;
1103
+ }, arguments); },
1104
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
1105
+ const ret = arg0.performance;
1106
+ return ret;
1107
+ },
1108
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
1109
+ const ret = arg0.process;
1110
+ return ret;
1111
+ },
1112
+ __wbg_protocol_563b94a4dcfb4d0d: function(arg0, arg1) {
1113
+ const ret = arg1.protocol;
1114
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1115
+ const len1 = WASM_VECTOR_LEN;
1116
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1117
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1118
+ },
1119
+ __wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
1120
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1121
+ },
1122
+ __wbg_pulse_new: function(arg0) {
1123
+ const ret = Pulse.__wrap(arg0);
1124
+ return ret;
1125
+ },
1126
+ __wbg_push_a6822215aa43e71c: function(arg0, arg1) {
1127
+ const ret = arg0.push(arg1);
1128
+ return ret;
1129
+ },
1130
+ __wbg_queueMicrotask_35c611f4a14830b2: function(arg0) {
1131
+ queueMicrotask(arg0);
1132
+ },
1133
+ __wbg_queueMicrotask_404ed0a58e0b63cc: function(arg0) {
1134
+ const ret = arg0.queueMicrotask;
1135
+ return ret;
1136
+ },
1137
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
1138
+ arg0.randomFillSync(arg1);
1139
+ }, arguments); },
1140
+ __wbg_read_282e152a24fd0856: function(arg0) {
1141
+ const ret = arg0.read();
1142
+ return ret;
1143
+ },
1144
+ __wbg_readyState_490503c1fa8f8dd6: function(arg0) {
1145
+ const ret = arg0.readyState;
1146
+ return ret;
1147
+ },
1148
+ __wbg_reason_4624d424a130e5b2: function(arg0, arg1) {
1149
+ const ret = arg1.reason;
1150
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1151
+ const len1 = WASM_VECTOR_LEN;
1152
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1153
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1154
+ },
1155
+ __wbg_releaseLock_cd76770b7f82a961: function(arg0) {
1156
+ arg0.releaseLock();
1157
+ },
1158
+ __wbg_removeEventListener_2da8e9960f90ab27: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1159
+ arg0.removeEventListener(getStringFromWasm0(arg1, arg2), arg3);
1160
+ }, arguments); },
1161
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
1162
+ const ret = module.require;
1163
+ return ret;
1164
+ }, arguments); },
1165
+ __wbg_resolve_25a7e548d5881dca: function(arg0) {
1166
+ const ret = Promise.resolve(arg0);
1167
+ return ret;
1168
+ },
1169
+ __wbg_respond_33b6f330b6d299fd: function() { return handleError(function (arg0, arg1) {
1170
+ arg0.respond(arg1 >>> 0);
1171
+ }, arguments); },
1172
+ __wbg_send_35647f35f8bdac5d: function() { return handleError(function (arg0, arg1, arg2) {
1173
+ arg0.send(getStringFromWasm0(arg1, arg2));
1174
+ }, arguments); },
1175
+ __wbg_send_4a773f523104d75e: function() { return handleError(function (arg0, arg1, arg2) {
1176
+ arg0.send(getArrayU8FromWasm0(arg1, arg2));
1177
+ }, arguments); },
1178
+ __wbg_setTimeout_3a808dd861dd3c12: function(arg0, arg1) {
1179
+ const ret = setTimeout(arg0, arg1);
1180
+ return ret;
1181
+ },
1182
+ __wbg_setTimeout_6613a51400c1bf9f: function() { return handleError(function (arg0, arg1, arg2) {
1183
+ const ret = arg0.setTimeout(arg1, arg2);
1184
+ return ret;
1185
+ }, arguments); },
1186
+ __wbg_set_29c99a8aac1c01e5: function(arg0, arg1, arg2) {
1187
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
1188
+ },
1189
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1190
+ arg0[arg1] = arg2;
1191
+ },
1192
+ __wbg_set_binaryType_41994c453b95bdd2: function(arg0, arg1) {
1193
+ arg0.binaryType = __wbindgen_enum_BinaryType[arg1];
1194
+ },
1195
+ __wbg_set_body_36614c7e61546809: function(arg0, arg1) {
1196
+ arg0.body = arg1;
1197
+ },
1198
+ __wbg_set_cache_488ea16c11cbf20d: function(arg0, arg1) {
1199
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
1200
+ },
1201
+ __wbg_set_credentials_fa9c491a27c4bdf0: function(arg0, arg1) {
1202
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
1203
+ },
1204
+ __wbg_set_dca99999bba88a9a: function(arg0, arg1, arg2) {
1205
+ arg0[arg1 >>> 0] = arg2;
1206
+ },
1207
+ __wbg_set_eca238efa99478e2: function(arg0, arg1) {
1208
+ arg0.set(arg1);
1209
+ },
1210
+ __wbg_set_handle_event_ae2ef577ff53b168: function(arg0, arg1) {
1211
+ arg0.handleEvent = arg1;
1212
+ },
1213
+ __wbg_set_headers_7c1e39ece7826bec: function(arg0, arg1) {
1214
+ arg0.headers = arg1;
1215
+ },
1216
+ __wbg_set_high_water_mark_cf5739ae16ac842f: function(arg0, arg1) {
1217
+ arg0.highWaterMark = arg1;
1218
+ },
1219
+ __wbg_set_method_7a6811dec7a4feff: function(arg0, arg1, arg2) {
1220
+ arg0.method = getStringFromWasm0(arg1, arg2);
1221
+ },
1222
+ __wbg_set_mode_c90e3667002857d4: function(arg0, arg1) {
1223
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
1224
+ },
1225
+ __wbg_set_onclose_13787fb31ae8aefd: function(arg0, arg1) {
1226
+ arg0.onclose = arg1;
1227
+ },
1228
+ __wbg_set_onerror_5a45265839edf1b1: function(arg0, arg1) {
1229
+ arg0.onerror = arg1;
1230
+ },
1231
+ __wbg_set_onmessage_9c6b4cb14e244b7f: function(arg0, arg1) {
1232
+ arg0.onmessage = arg1;
1233
+ },
1234
+ __wbg_set_onopen_db452f4233e99d7d: function(arg0, arg1) {
1235
+ arg0.onopen = arg1;
1236
+ },
1237
+ __wbg_set_signal_d9da62b3f215c821: function(arg0, arg1) {
1238
+ arg0.signal = arg1;
1239
+ },
1240
+ __wbg_signal_e03304a84df9ed09: function(arg0) {
1241
+ const ret = arg0.signal;
1242
+ return ret;
1243
+ },
1244
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
1245
+ const ret = arg1.stack;
1246
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1247
+ const len1 = WASM_VECTOR_LEN;
1248
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1249
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1250
+ },
1251
+ __wbg_static_accessor_GLOBAL_9d53f2689e622ca1: function() {
1252
+ const ret = typeof global === 'undefined' ? null : global;
1253
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1254
+ },
1255
+ __wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a: function() {
1256
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1257
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1258
+ },
1259
+ __wbg_static_accessor_SELF_4c59f6c7ea29a144: function() {
1260
+ const ret = typeof self === 'undefined' ? null : self;
1261
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1262
+ },
1263
+ __wbg_static_accessor_WINDOW_e70ae9f2eb052253: function() {
1264
+ const ret = typeof window === 'undefined' ? null : window;
1265
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1266
+ },
1267
+ __wbg_status_00549d55b78d949e: function(arg0) {
1268
+ const ret = arg0.status;
1269
+ return ret;
1270
+ },
1271
+ __wbg_stringify_8286df6dcc591521: function() { return handleError(function (arg0) {
1272
+ const ret = JSON.stringify(arg0);
1273
+ return ret;
1274
+ }, arguments); },
1275
+ __wbg_subarray_4aa221f6a4f5ab22: function(arg0, arg1, arg2) {
1276
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1277
+ return ret;
1278
+ },
1279
+ __wbg_then_18f476d590e58992: function(arg0, arg1, arg2) {
1280
+ const ret = arg0.then(arg1, arg2);
1281
+ return ret;
1282
+ },
1283
+ __wbg_then_ac7b025999b52837: function(arg0, arg1) {
1284
+ const ret = arg0.then(arg1);
1285
+ return ret;
1286
+ },
1287
+ __wbg_url_6808f1c468f2d0cd: function(arg0, arg1) {
1288
+ const ret = arg1.url;
1289
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1290
+ const len1 = WASM_VECTOR_LEN;
1291
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1292
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1293
+ },
1294
+ __wbg_url_8b9d120d9dc02d8f: function(arg0, arg1) {
1295
+ const ret = arg1.url;
1296
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1297
+ const len1 = WASM_VECTOR_LEN;
1298
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1299
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1300
+ },
1301
+ __wbg_value_f3625092ee4b37f4: function(arg0) {
1302
+ const ret = arg0.value;
1303
+ return ret;
1304
+ },
1305
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
1306
+ const ret = arg0.versions;
1307
+ return ret;
1308
+ },
1309
+ __wbg_view_d523e3b92648b62c: function(arg0) {
1310
+ const ret = arg0.view;
1311
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1312
+ },
1313
+ __wbg_warn_3a37cdd7216f1479: function(arg0, arg1) {
1314
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
1315
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
1316
+ console.warn(...v0);
1317
+ },
1318
+ __wbg_wasClean_9636ab9b65f5dbb9: function(arg0) {
1319
+ const ret = arg0.wasClean;
1320
+ return ret;
1321
+ },
1322
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1323
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2263, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1324
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h364282c46f736e9f);
1325
+ return ret;
1326
+ },
1327
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1328
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3861, ret: Externref, inner_ret: Some(Externref) }, mutable: true }) -> Externref`.
1329
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h1d3d8bbcf4bb9647);
1330
+ return ret;
1331
+ },
1332
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1333
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3862, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1334
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h00c6858f5875acdf);
1335
+ return ret;
1336
+ },
1337
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
1338
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1062, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1339
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h104a0d4c5facca10);
1340
+ return ret;
1341
+ },
1342
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
1343
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2654, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1344
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3ed8ec9c74648bb3);
1345
+ return ret;
1346
+ },
1347
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
1348
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2223, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1349
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hac60de05c959eab5);
1350
+ return ret;
1351
+ },
1352
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
1353
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2404, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1354
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h863ae91844dca7d2);
1355
+ return ret;
1356
+ },
1357
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
1358
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2406, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
1359
+ const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h9480bdc51ff47b2e);
1360
+ return ret;
1361
+ },
1362
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
1363
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 3736, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1364
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha30834eb04ba8562);
1365
+ return ret;
1366
+ },
1367
+ __wbindgen_cast_000000000000000a: function(arg0) {
1368
+ // Cast intrinsic for `F64 -> Externref`.
1369
+ const ret = arg0;
1370
+ return ret;
1371
+ },
1372
+ __wbindgen_cast_000000000000000b: function(arg0) {
1373
+ // Cast intrinsic for `I64 -> Externref`.
1374
+ const ret = arg0;
1375
+ return ret;
1376
+ },
1377
+ __wbindgen_cast_000000000000000c: function(arg0, arg1) {
1378
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1379
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1380
+ return ret;
1381
+ },
1382
+ __wbindgen_cast_000000000000000d: function(arg0, arg1) {
1383
+ // Cast intrinsic for `Ref(String) -> Externref`.
1384
+ const ret = getStringFromWasm0(arg0, arg1);
1385
+ return ret;
1386
+ },
1387
+ __wbindgen_cast_000000000000000e: function(arg0) {
1388
+ // Cast intrinsic for `U64 -> Externref`.
1389
+ const ret = BigInt.asUintN(64, arg0);
1390
+ return ret;
1391
+ },
1392
+ __wbindgen_init_externref_table: function() {
1393
+ const table = wasm.__wbindgen_externrefs;
1394
+ const offset = table.grow(4);
1395
+ table.set(0, undefined);
1396
+ table.set(offset + 0, undefined);
1397
+ table.set(offset + 1, null);
1398
+ table.set(offset + 2, true);
1399
+ table.set(offset + 3, false);
1400
+ },
1401
+ };
1402
+ return {
1403
+ __proto__: null,
1404
+ "./avoidant_wasm_bg.js": import0,
1405
+ "svelte/store": import1,
1406
+ "svelte/store": import2,
1407
+ };
1408
+ }
1409
+
1410
+ function wasm_bindgen__convert__closures_____invoke__hac60de05c959eab5(arg0, arg1) {
1411
+ wasm.wasm_bindgen__convert__closures_____invoke__hac60de05c959eab5(arg0, arg1);
1412
+ }
1413
+
1414
+ function wasm_bindgen__convert__closures_____invoke__h863ae91844dca7d2(arg0, arg1) {
1415
+ wasm.wasm_bindgen__convert__closures_____invoke__h863ae91844dca7d2(arg0, arg1);
1416
+ }
1417
+
1418
+ function wasm_bindgen__convert__closures_____invoke__h9480bdc51ff47b2e(arg0, arg1) {
1419
+ wasm.wasm_bindgen__convert__closures_____invoke__h9480bdc51ff47b2e(arg0, arg1);
1420
+ }
1421
+
1422
+ function wasm_bindgen__convert__closures_____invoke__ha30834eb04ba8562(arg0, arg1) {
1423
+ wasm.wasm_bindgen__convert__closures_____invoke__ha30834eb04ba8562(arg0, arg1);
1424
+ }
1425
+
1426
+ function wasm_bindgen__convert__closures_____invoke__h364282c46f736e9f(arg0, arg1, arg2) {
1427
+ wasm.wasm_bindgen__convert__closures_____invoke__h364282c46f736e9f(arg0, arg1, arg2);
1428
+ }
1429
+
1430
+ function wasm_bindgen__convert__closures_____invoke__h104a0d4c5facca10(arg0, arg1, arg2) {
1431
+ wasm.wasm_bindgen__convert__closures_____invoke__h104a0d4c5facca10(arg0, arg1, arg2);
1432
+ }
1433
+
1434
+ function wasm_bindgen__convert__closures_____invoke__h3ed8ec9c74648bb3(arg0, arg1, arg2) {
1435
+ wasm.wasm_bindgen__convert__closures_____invoke__h3ed8ec9c74648bb3(arg0, arg1, arg2);
1436
+ }
1437
+
1438
+ function wasm_bindgen__convert__closures_____invoke__h1d3d8bbcf4bb9647(arg0, arg1, arg2) {
1439
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h1d3d8bbcf4bb9647(arg0, arg1, arg2);
1440
+ return ret;
1441
+ }
1442
+
1443
+ function wasm_bindgen__convert__closures_____invoke__h00c6858f5875acdf(arg0, arg1, arg2) {
1444
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h00c6858f5875acdf(arg0, arg1, arg2);
1445
+ if (ret[1]) {
1446
+ throw takeFromExternrefTable0(ret[0]);
1447
+ }
1448
+ }
1449
+
1450
+ function wasm_bindgen__convert__closures_____invoke__h299fd98c162ada8d(arg0, arg1, arg2, arg3) {
1451
+ wasm.wasm_bindgen__convert__closures_____invoke__h299fd98c162ada8d(arg0, arg1, arg2, arg3);
1452
+ }
1453
+
1454
+
1455
+ const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
1456
+
1457
+
1458
+ const __wbindgen_enum_ReadableStreamType = ["bytes"];
1459
+
1460
+
1461
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
1462
+
1463
+
1464
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
1465
+
1466
+
1467
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
1468
+ const ChannelFinalization = (typeof FinalizationRegistry === 'undefined')
1469
+ ? { register: () => {}, unregister: () => {} }
1470
+ : new FinalizationRegistry(ptr => wasm.__wbg_channel_free(ptr, 1));
1471
+ const ChannelSenderFinalization = (typeof FinalizationRegistry === 'undefined')
1472
+ ? { register: () => {}, unregister: () => {} }
1473
+ : new FinalizationRegistry(ptr => wasm.__wbg_channelsender_free(ptr, 1));
1474
+ const GameStateFinalization = (typeof FinalizationRegistry === 'undefined')
1475
+ ? { register: () => {}, unregister: () => {} }
1476
+ : new FinalizationRegistry(ptr => wasm.__wbg_gamestate_free(ptr, 1));
1477
+ const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
1478
+ ? { register: () => {}, unregister: () => {} }
1479
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr, 1));
1480
+ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
1481
+ ? { register: () => {}, unregister: () => {} }
1482
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr, 1));
1483
+ const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
1484
+ ? { register: () => {}, unregister: () => {} }
1485
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr, 1));
1486
+ const NetworkNodeFinalization = (typeof FinalizationRegistry === 'undefined')
1487
+ ? { register: () => {}, unregister: () => {} }
1488
+ : new FinalizationRegistry(ptr => wasm.__wbg_networknode_free(ptr, 1));
1489
+ const PulseFinalization = (typeof FinalizationRegistry === 'undefined')
1490
+ ? { register: () => {}, unregister: () => {} }
1491
+ : new FinalizationRegistry(ptr => wasm.__wbg_pulse_free(ptr, 1));
1492
+ const UiStateFinalization = (typeof FinalizationRegistry === 'undefined')
1493
+ ? { register: () => {}, unregister: () => {} }
1494
+ : new FinalizationRegistry(ptr => wasm.__wbg_uistate_free(ptr, 1));
1495
+
1496
+ function addToExternrefTable0(obj) {
1497
+ const idx = wasm.__externref_table_alloc();
1498
+ wasm.__wbindgen_externrefs.set(idx, obj);
1499
+ return idx;
1500
+ }
1501
+
1502
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1503
+ ? { register: () => {}, unregister: () => {} }
1504
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
1505
+
1506
+ function debugString(val) {
1507
+ // primitive types
1508
+ const type = typeof val;
1509
+ if (type == 'number' || type == 'boolean' || val == null) {
1510
+ return `${val}`;
1511
+ }
1512
+ if (type == 'string') {
1513
+ return `"${val}"`;
1514
+ }
1515
+ if (type == 'symbol') {
1516
+ const description = val.description;
1517
+ if (description == null) {
1518
+ return 'Symbol';
1519
+ } else {
1520
+ return `Symbol(${description})`;
1521
+ }
1522
+ }
1523
+ if (type == 'function') {
1524
+ const name = val.name;
1525
+ if (typeof name == 'string' && name.length > 0) {
1526
+ return `Function(${name})`;
1527
+ } else {
1528
+ return 'Function';
1529
+ }
1530
+ }
1531
+ // objects
1532
+ if (Array.isArray(val)) {
1533
+ const length = val.length;
1534
+ let debug = '[';
1535
+ if (length > 0) {
1536
+ debug += debugString(val[0]);
1537
+ }
1538
+ for(let i = 1; i < length; i++) {
1539
+ debug += ', ' + debugString(val[i]);
1540
+ }
1541
+ debug += ']';
1542
+ return debug;
1543
+ }
1544
+ // Test for built-in
1545
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1546
+ let className;
1547
+ if (builtInMatches && builtInMatches.length > 1) {
1548
+ className = builtInMatches[1];
1549
+ } else {
1550
+ // Failed to match the standard '[object ClassName]'
1551
+ return toString.call(val);
1552
+ }
1553
+ if (className == 'Object') {
1554
+ // we're a user defined class or Object
1555
+ // JSON.stringify avoids problems with cycles, and is generally much
1556
+ // easier than looping through ownProperties of `val`.
1557
+ try {
1558
+ return 'Object(' + JSON.stringify(val) + ')';
1559
+ } catch (_) {
1560
+ return 'Object';
1561
+ }
1562
+ }
1563
+ // errors
1564
+ if (val instanceof Error) {
1565
+ return `${val.name}: ${val.message}\n${val.stack}`;
1566
+ }
1567
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1568
+ return className;
1569
+ }
1570
+
1571
+ function getArrayF64FromWasm0(ptr, len) {
1572
+ ptr = ptr >>> 0;
1573
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
1574
+ }
1575
+
1576
+ function getArrayJsValueFromWasm0(ptr, len) {
1577
+ ptr = ptr >>> 0;
1578
+ const mem = getDataViewMemory0();
1579
+ const result = [];
1580
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
1581
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1582
+ }
1583
+ wasm.__externref_drop_slice(ptr, len);
1584
+ return result;
1585
+ }
1586
+
1587
+ function getArrayU8FromWasm0(ptr, len) {
1588
+ ptr = ptr >>> 0;
1589
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1590
+ }
1591
+
1592
+ let cachedDataViewMemory0 = null;
1593
+ function getDataViewMemory0() {
1594
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1595
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1596
+ }
1597
+ return cachedDataViewMemory0;
1598
+ }
1599
+
1600
+ let cachedFloat64ArrayMemory0 = null;
1601
+ function getFloat64ArrayMemory0() {
1602
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
1603
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
1604
+ }
1605
+ return cachedFloat64ArrayMemory0;
1606
+ }
1607
+
1608
+ function getStringFromWasm0(ptr, len) {
1609
+ return decodeText(ptr >>> 0, len);
1610
+ }
1611
+
1612
+ let cachedUint8ArrayMemory0 = null;
1613
+ function getUint8ArrayMemory0() {
1614
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1615
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1616
+ }
1617
+ return cachedUint8ArrayMemory0;
1618
+ }
1619
+
1620
+ function handleError(f, args) {
1621
+ try {
1622
+ return f.apply(this, args);
1623
+ } catch (e) {
1624
+ const idx = addToExternrefTable0(e);
1625
+ wasm.__wbindgen_exn_store(idx);
1626
+ }
1627
+ }
1628
+
1629
+ function isLikeNone(x) {
1630
+ return x === undefined || x === null;
1631
+ }
1632
+
1633
+ function makeClosure(arg0, arg1, f) {
1634
+ const state = { a: arg0, b: arg1, cnt: 1 };
1635
+ const real = (...args) => {
1636
+
1637
+ // First up with a closure we increment the internal reference
1638
+ // count. This ensures that the Rust closure environment won't
1639
+ // be deallocated while we're invoking it.
1640
+ state.cnt++;
1641
+ try {
1642
+ return f(state.a, state.b, ...args);
1643
+ } finally {
1644
+ real._wbg_cb_unref();
1645
+ }
1646
+ };
1647
+ real._wbg_cb_unref = () => {
1648
+ if (--state.cnt === 0) {
1649
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
1650
+ state.a = 0;
1651
+ CLOSURE_DTORS.unregister(state);
1652
+ }
1653
+ };
1654
+ CLOSURE_DTORS.register(real, state, state);
1655
+ return real;
1656
+ }
1657
+
1658
+ function makeMutClosure(arg0, arg1, f) {
1659
+ const state = { a: arg0, b: arg1, cnt: 1 };
1660
+ const real = (...args) => {
1661
+
1662
+ // First up with a closure we increment the internal reference
1663
+ // count. This ensures that the Rust closure environment won't
1664
+ // be deallocated while we're invoking it.
1665
+ state.cnt++;
1666
+ const a = state.a;
1667
+ state.a = 0;
1668
+ try {
1669
+ return f(a, state.b, ...args);
1670
+ } finally {
1671
+ state.a = a;
1672
+ real._wbg_cb_unref();
1673
+ }
1674
+ };
1675
+ real._wbg_cb_unref = () => {
1676
+ if (--state.cnt === 0) {
1677
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
1678
+ state.a = 0;
1679
+ CLOSURE_DTORS.unregister(state);
1680
+ }
1681
+ };
1682
+ CLOSURE_DTORS.register(real, state, state);
1683
+ return real;
1684
+ }
1685
+
1686
+ function passStringToWasm0(arg, malloc, realloc) {
1687
+ if (realloc === undefined) {
1688
+ const buf = cachedTextEncoder.encode(arg);
1689
+ const ptr = malloc(buf.length, 1) >>> 0;
1690
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1691
+ WASM_VECTOR_LEN = buf.length;
1692
+ return ptr;
1693
+ }
1694
+
1695
+ let len = arg.length;
1696
+ let ptr = malloc(len, 1) >>> 0;
1697
+
1698
+ const mem = getUint8ArrayMemory0();
1699
+
1700
+ let offset = 0;
1701
+
1702
+ for (; offset < len; offset++) {
1703
+ const code = arg.charCodeAt(offset);
1704
+ if (code > 0x7F) break;
1705
+ mem[ptr + offset] = code;
1706
+ }
1707
+ if (offset !== len) {
1708
+ if (offset !== 0) {
1709
+ arg = arg.slice(offset);
1710
+ }
1711
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1712
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1713
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1714
+
1715
+ offset += ret.written;
1716
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1717
+ }
1718
+
1719
+ WASM_VECTOR_LEN = offset;
1720
+ return ptr;
1721
+ }
1722
+
1723
+ function takeFromExternrefTable0(idx) {
1724
+ const value = wasm.__wbindgen_externrefs.get(idx);
1725
+ wasm.__externref_table_dealloc(idx);
1726
+ return value;
1727
+ }
1728
+
1729
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1730
+ cachedTextDecoder.decode();
1731
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1732
+ let numBytesDecoded = 0;
1733
+ function decodeText(ptr, len) {
1734
+ numBytesDecoded += len;
1735
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1736
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1737
+ cachedTextDecoder.decode();
1738
+ numBytesDecoded = len;
1739
+ }
1740
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1741
+ }
1742
+
1743
+ const cachedTextEncoder = new TextEncoder();
1744
+
1745
+ if (!('encodeInto' in cachedTextEncoder)) {
1746
+ cachedTextEncoder.encodeInto = function (arg, view) {
1747
+ const buf = cachedTextEncoder.encode(arg);
1748
+ view.set(buf);
1749
+ return {
1750
+ read: arg.length,
1751
+ written: buf.length
1752
+ };
1753
+ };
1754
+ }
1755
+
1756
+ let WASM_VECTOR_LEN = 0;
1757
+
1758
+ let wasmModule, wasmInstance, wasm;
1759
+ function __wbg_finalize_init(instance, module) {
1760
+ wasmInstance = instance;
1761
+ wasm = instance.exports;
1762
+ wasmModule = module;
1763
+ cachedDataViewMemory0 = null;
1764
+ cachedFloat64ArrayMemory0 = null;
1765
+ cachedUint8ArrayMemory0 = null;
1766
+ wasm.__wbindgen_start();
1767
+ return wasm;
1768
+ }
1769
+
1770
+ async function __wbg_load(module, imports) {
1771
+ if (typeof Response === 'function' && module instanceof Response) {
1772
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1773
+ try {
1774
+ return await WebAssembly.instantiateStreaming(module, imports);
1775
+ } catch (e) {
1776
+ const validResponse = module.ok && expectedResponseType(module.type);
1777
+
1778
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1779
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1780
+
1781
+ } else { throw e; }
1782
+ }
1783
+ }
1784
+
1785
+ const bytes = await module.arrayBuffer();
1786
+ return await WebAssembly.instantiate(bytes, imports);
1787
+ } else {
1788
+ const instance = await WebAssembly.instantiate(module, imports);
1789
+
1790
+ if (instance instanceof WebAssembly.Instance) {
1791
+ return { instance, module };
1792
+ } else {
1793
+ return instance;
1794
+ }
1795
+ }
1796
+
1797
+ function expectedResponseType(type) {
1798
+ switch (type) {
1799
+ case 'basic': case 'cors': case 'default': return true;
1800
+ }
1801
+ return false;
1802
+ }
1803
+ }
1804
+
1805
+ function initSync(module) {
1806
+ if (wasm !== undefined) return wasm;
1807
+
1808
+
1809
+ if (module !== undefined) {
1810
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1811
+ ({module} = module)
1812
+ } else {
1813
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1814
+ }
1815
+ }
1816
+
1817
+ const imports = __wbg_get_imports();
1818
+ if (!(module instanceof WebAssembly.Module)) {
1819
+ module = new WebAssembly.Module(module);
1820
+ }
1821
+ const instance = new WebAssembly.Instance(module, imports);
1822
+ return __wbg_finalize_init(instance, module);
1823
+ }
1824
+
1825
+ async function __wbg_init(module_or_path) {
1826
+ if (wasm !== undefined) return wasm;
1827
+
1828
+
1829
+ if (module_or_path !== undefined) {
1830
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1831
+ ({module_or_path} = module_or_path)
1832
+ } else {
1833
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1834
+ }
1835
+ }
1836
+
1837
+ if (module_or_path === undefined) {
1838
+ module_or_path = new URL('avoidant_wasm_bg.wasm', import.meta.url);
1839
+ }
1840
+ const imports = __wbg_get_imports();
1841
+
1842
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1843
+ module_or_path = fetch(module_or_path);
1844
+ }
1845
+
1846
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1847
+
1848
+ return __wbg_finalize_init(instance, module);
1849
+ }
1850
+
1851
+ export { initSync, __wbg_init as default };