@arenarium/maps 1.2.2 → 1.2.3

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/dist/main.es.js DELETED
@@ -1,3323 +0,0 @@
1
- var Er = Array.isArray, bn = Array.prototype.indexOf, Mn = Array.from, xt = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, xn = Object.prototype, Pn = Array.prototype, Sn = Object.getPrototypeOf, sr = Object.isExtensible;
2
- function An(t) {
3
- for (var e = 0; e < t.length; e++)
4
- t[e]();
5
- }
6
- function Cn() {
7
- var t, e, r = new Promise((n, i) => {
8
- t = n, e = i;
9
- });
10
- return { promise: r, resolve: t, reject: e };
11
- }
12
- const R = 2, Ot = 4, kr = 8, Ie = 16, fe = 32, ge = 64, Ft = 128, q = 256, ot = 512, I = 1024, re = 2048, ce = 4096, Ae = 8192, De = 16384, Rt = 32768, br = 65536, or = 1 << 17, Tn = 1 << 18, Oe = 1 << 19, Ln = 1 << 20, Pt = 1 << 21, Nt = 1 << 22, ve = 1 << 23, nt = Symbol("$state"), jt = new class extends Error {
13
- name = "StaleReactionError";
14
- message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
15
- }();
16
- function In() {
17
- throw new Error("https://svelte.dev/e/async_derived_orphan");
18
- }
19
- function Dn(t) {
20
- throw new Error("https://svelte.dev/e/effect_in_teardown");
21
- }
22
- function On() {
23
- throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
24
- }
25
- function Fn(t) {
26
- throw new Error("https://svelte.dev/e/effect_orphan");
27
- }
28
- function Rn() {
29
- throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
30
- }
31
- function Nn() {
32
- throw new Error("https://svelte.dev/e/state_descriptors_fixed");
33
- }
34
- function jn() {
35
- throw new Error("https://svelte.dev/e/state_prototype_fixed");
36
- }
37
- function zn() {
38
- throw new Error("https://svelte.dev/e/state_unsafe_mutation");
39
- }
40
- function Bn() {
41
- throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
42
- }
43
- const Un = 2, x = Symbol();
44
- function Zn() {
45
- console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
46
- }
47
- function Mr(t) {
48
- return t === this.v;
49
- }
50
- let Y = null;
51
- function Ce(t) {
52
- Y = t;
53
- }
54
- function zt(t, e = !1, r) {
55
- Y = {
56
- p: Y,
57
- c: null,
58
- e: null,
59
- s: t,
60
- x: null,
61
- l: null
62
- };
63
- }
64
- function Bt(t) {
65
- var e = (
66
- /** @type {ComponentContext} */
67
- Y
68
- ), r = e.e;
69
- if (r !== null) {
70
- e.e = null;
71
- for (var n of r)
72
- Nr(n);
73
- }
74
- return t !== void 0 && (e.x = t), Y = e.p, t ?? /** @type {T} */
75
- {};
76
- }
77
- function xr() {
78
- return !0;
79
- }
80
- let Me = [];
81
- function qn() {
82
- var t = Me;
83
- Me = [], An(t);
84
- }
85
- function ft(t) {
86
- if (Me.length === 0) {
87
- var e = Me;
88
- queueMicrotask(() => {
89
- e === Me && qn();
90
- });
91
- }
92
- Me.push(t);
93
- }
94
- const Hn = /* @__PURE__ */ new WeakMap();
95
- function Pr(t) {
96
- var e = m;
97
- if (e === null)
98
- return v.f |= ve, t;
99
- if ((e.f & Rt) === 0) {
100
- if ((e.f & Ft) === 0)
101
- throw !e.parent && t instanceof Error && Sr(t), t;
102
- e.b.error(t);
103
- } else
104
- Te(t, e);
105
- }
106
- function Te(t, e) {
107
- for (; e !== null; ) {
108
- if ((e.f & Ft) !== 0)
109
- try {
110
- e.b.error(t);
111
- return;
112
- } catch (r) {
113
- t = r;
114
- }
115
- e = e.parent;
116
- }
117
- throw t instanceof Error && Sr(t), t;
118
- }
119
- function Sr(t) {
120
- const e = Hn.get(t);
121
- e && (xt(t, "message", {
122
- value: e.message
123
- }), xt(t, "stack", {
124
- value: e.stack
125
- }));
126
- }
127
- const Et = /* @__PURE__ */ new Set();
128
- let A = null, St = /* @__PURE__ */ new Set(), Xe = [], Ut = null, At = !1;
129
- class ie {
130
- /**
131
- * The current values of any sources that are updated in this batch
132
- * They keys of this map are identical to `this.#previous`
133
- * @type {Map<Source, any>}
134
- */
135
- current = /* @__PURE__ */ new Map();
136
- /**
137
- * The values of any sources that are updated in this batch _before_ those updates took place.
138
- * They keys of this map are identical to `this.#current`
139
- * @type {Map<Source, any>}
140
- */
141
- #e = /* @__PURE__ */ new Map();
142
- /**
143
- * When the batch is committed (and the DOM is updated), we need to remove old branches
144
- * and append new ones by calling the functions added inside (if/each/key/etc) blocks
145
- * @type {Set<() => void>}
146
- */
147
- #t = /* @__PURE__ */ new Set();
148
- /**
149
- * The number of async effects that are currently in flight
150
- */
151
- #a = 0;
152
- /**
153
- * A deferred that resolves when the batch is committed, used with `settled()`
154
- * TODO replace with Promise.withResolvers once supported widely enough
155
- * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
156
- */
157
- #n = null;
158
- /**
159
- * True if an async effect inside this batch resolved and
160
- * its parent branch was already deleted
161
- */
162
- #c = !1;
163
- /**
164
- * Async effects (created inside `async_derived`) encountered during processing.
165
- * These run after the rest of the batch has updated, since they should
166
- * always have the latest values
167
- * @type {Effect[]}
168
- */
169
- #o = [];
170
- /**
171
- * The same as `#async_effects`, but for effects inside a newly-created
172
- * `<svelte:boundary>` — these do not prevent the batch from committing
173
- * @type {Effect[]}
174
- */
175
- #i = [];
176
- /**
177
- * Template effects and `$effect.pre` effects, which run when
178
- * a batch is committed
179
- * @type {Effect[]}
180
- */
181
- #r = [];
182
- /**
183
- * The same as `#render_effects`, but for `$effect` (which runs after)
184
- * @type {Effect[]}
185
- */
186
- #s = [];
187
- /**
188
- * Block effects, which may need to re-run on subsequent flushes
189
- * in order to update internal sources (e.g. each block items)
190
- * @type {Effect[]}
191
- */
192
- #l = [];
193
- /**
194
- * Deferred effects (which run after async work has completed) that are DIRTY
195
- * @type {Effect[]}
196
- */
197
- #p = [];
198
- /**
199
- * Deferred effects that are MAYBE_DIRTY
200
- * @type {Effect[]}
201
- */
202
- #f = [];
203
- /**
204
- * A set of branches that still exist, but will be destroyed when this batch
205
- * is committed — we skip over these during `process`
206
- * @type {Set<Effect>}
207
- */
208
- skipped_effects = /* @__PURE__ */ new Set();
209
- /**
210
- *
211
- * @param {Effect[]} root_effects
212
- */
213
- process(e) {
214
- Xe = [];
215
- for (const i of e)
216
- this.#h(i);
217
- if (this.#o.length === 0 && this.#a === 0) {
218
- this.#d();
219
- var r = this.#r, n = this.#s;
220
- this.#r = [], this.#s = [], this.#l = [], A = null, ar(r), ar(n), A === null ? A = this : Et.delete(this), this.#n?.resolve();
221
- } else
222
- this.#u(this.#r), this.#u(this.#s), this.#u(this.#l);
223
- for (const i of this.#o)
224
- Se(i);
225
- for (const i of this.#i)
226
- Se(i);
227
- this.#o = [], this.#i = [];
228
- }
229
- /**
230
- * Traverse the effect tree, executing effects or stashing
231
- * them for later execution as appropriate
232
- * @param {Effect} root
233
- */
234
- #h(e) {
235
- e.f ^= I;
236
- for (var r = e.first; r !== null; ) {
237
- var n = r.f, i = (n & (fe | ge)) !== 0, s = i && (n & I) !== 0, o = s || (n & Ae) !== 0 || this.skipped_effects.has(r);
238
- if (!o && r.fn !== null) {
239
- if (i)
240
- r.f ^= I;
241
- else if ((n & Ot) !== 0)
242
- this.#s.push(r);
243
- else if ((n & I) === 0)
244
- if ((n & Nt) !== 0) {
245
- var l = r.b?.is_pending() ? this.#i : this.#o;
246
- l.push(r);
247
- } else pt(r) && ((r.f & Ie) !== 0 && this.#l.push(r), Se(r));
248
- var a = r.first;
249
- if (a !== null) {
250
- r = a;
251
- continue;
252
- }
253
- }
254
- var u = r.parent;
255
- for (r = r.next; r === null && u !== null; )
256
- r = u.next, u = u.parent;
257
- }
258
- }
259
- /**
260
- * @param {Effect[]} effects
261
- */
262
- #u(e) {
263
- for (const r of e)
264
- ((r.f & re) !== 0 ? this.#p : this.#f).push(r), H(r, I);
265
- e.length = 0;
266
- }
267
- /**
268
- * Associate a change to a given source with the current
269
- * batch, noting its previous and current values
270
- * @param {Source} source
271
- * @param {any} value
272
- */
273
- capture(e, r) {
274
- this.#e.has(e) || this.#e.set(e, r), this.current.set(e, e.v);
275
- }
276
- activate() {
277
- A = this;
278
- }
279
- deactivate() {
280
- A = null;
281
- for (const e of St)
282
- if (St.delete(e), e(), A !== null)
283
- break;
284
- }
285
- neuter() {
286
- this.#c = !0;
287
- }
288
- flush() {
289
- Xe.length > 0 ? Yn() : this.#d(), A === this && (this.#a === 0 && Et.delete(this), this.deactivate());
290
- }
291
- /**
292
- * Append and remove branches to/from the DOM
293
- */
294
- #d() {
295
- if (!this.#c)
296
- for (const e of this.#t)
297
- e();
298
- this.#t.clear();
299
- }
300
- increment() {
301
- this.#a += 1;
302
- }
303
- decrement() {
304
- if (this.#a -= 1, this.#a === 0) {
305
- for (const e of this.#p)
306
- H(e, re), We(e);
307
- for (const e of this.#f)
308
- H(e, ce), We(e);
309
- this.#r = [], this.#s = [], this.flush();
310
- } else
311
- this.deactivate();
312
- }
313
- /** @param {() => void} fn */
314
- add_callback(e) {
315
- this.#t.add(e);
316
- }
317
- settled() {
318
- return (this.#n ??= Cn()).promise;
319
- }
320
- static ensure() {
321
- if (A === null) {
322
- const e = A = new ie();
323
- Et.add(A), ie.enqueue(() => {
324
- A === e && e.flush();
325
- });
326
- }
327
- return A;
328
- }
329
- /** @param {() => void} task */
330
- static enqueue(e) {
331
- ft(e);
332
- }
333
- }
334
- function Yn() {
335
- var t = Pe;
336
- At = !0;
337
- try {
338
- var e = 0;
339
- for (fr(!0); Xe.length > 0; ) {
340
- var r = ie.ensure();
341
- if (e++ > 1e3) {
342
- var n, i;
343
- Vn();
344
- }
345
- r.process(Xe), ue.clear();
346
- }
347
- } finally {
348
- At = !1, fr(t), Ut = null;
349
- }
350
- }
351
- function Vn() {
352
- try {
353
- Rn();
354
- } catch (t) {
355
- Te(t, Ut);
356
- }
357
- }
358
- let de = null;
359
- function ar(t) {
360
- var e = t.length;
361
- if (e !== 0) {
362
- for (var r = 0; r < e; ) {
363
- var n = t[r++];
364
- if ((n.f & (De | Ae)) === 0 && pt(n) && (de = [], Se(n), n.deps === null && n.first === null && n.nodes_start === null && (n.teardown === null && n.ac === null ? Ur(n) : n.fn = null), de?.length > 0)) {
365
- ue.clear();
366
- for (const i of de)
367
- Se(i);
368
- de = [];
369
- }
370
- }
371
- de = null;
372
- }
373
- }
374
- function We(t) {
375
- for (var e = Ut = t; e.parent !== null; ) {
376
- e = e.parent;
377
- var r = e.f;
378
- if (At && e === m && (r & Ie) !== 0)
379
- return;
380
- if ((r & (ge | fe)) !== 0) {
381
- if ((r & I) === 0) return;
382
- e.f ^= I;
383
- }
384
- }
385
- Xe.push(e);
386
- }
387
- function Xn(t) {
388
- let e = 0, r = ct(0), n;
389
- return () => {
390
- li() && (g(r), Ht(() => (e === 0 && (n = Wr(() => t(() => Ze(r)))), e += 1, () => {
391
- ft(() => {
392
- e -= 1, e === 0 && (n?.(), n = void 0, Ze(r));
393
- });
394
- })));
395
- };
396
- }
397
- var Wn = br | Oe | Ft;
398
- function Gn(t, e, r) {
399
- new Kn(t, e, r);
400
- }
401
- class Kn {
402
- /** @type {Boundary | null} */
403
- parent;
404
- #e = !1;
405
- /** @type {TemplateNode} */
406
- #t;
407
- /** @type {TemplateNode | null} */
408
- #a = null;
409
- /** @type {BoundaryProps} */
410
- #n;
411
- /** @type {((anchor: Node) => void)} */
412
- #c;
413
- /** @type {Effect} */
414
- #o;
415
- /** @type {Effect | null} */
416
- #i = null;
417
- /** @type {Effect | null} */
418
- #r = null;
419
- /** @type {Effect | null} */
420
- #s = null;
421
- /** @type {DocumentFragment | null} */
422
- #l = null;
423
- #p = 0;
424
- #f = 0;
425
- #h = !1;
426
- /**
427
- * A source containing the number of pending async deriveds/expressions.
428
- * Only created if `$effect.pending()` is used inside the boundary,
429
- * otherwise updating the source results in needless `Batch.ensure()`
430
- * calls followed by no-op flushes
431
- * @type {Source<number> | null}
432
- */
433
- #u = null;
434
- #d = () => {
435
- this.#u && at(this.#u, this.#p);
436
- };
437
- #g = Xn(() => (this.#u = ct(this.#p), () => {
438
- this.#u = null;
439
- }));
440
- /**
441
- * @param {TemplateNode} node
442
- * @param {BoundaryProps} props
443
- * @param {((anchor: Node) => void)} children
444
- */
445
- constructor(e, r, n) {
446
- this.#t = e, this.#n = r, this.#c = n, this.parent = /** @type {Effect} */
447
- m.b, this.#e = !!this.#n.pending, this.#o = pi(() => {
448
- m.b = this;
449
- {
450
- try {
451
- this.#i = he(() => n(this.#t));
452
- } catch (i) {
453
- this.error(i);
454
- }
455
- this.#f > 0 ? this.#m() : this.#e = !1;
456
- }
457
- }, Wn);
458
- }
459
- #_() {
460
- try {
461
- this.#i = he(() => this.#c(this.#t));
462
- } catch (e) {
463
- this.error(e);
464
- }
465
- this.#e = !1;
466
- }
467
- #w() {
468
- const e = this.#n.pending;
469
- e && (this.#r = he(() => e(this.#t)), ie.enqueue(() => {
470
- this.#i = this.#v(() => (ie.ensure(), he(() => this.#c(this.#t)))), this.#f > 0 ? this.#m() : (it(
471
- /** @type {Effect} */
472
- this.#r,
473
- () => {
474
- this.#r = null;
475
- }
476
- ), this.#e = !1);
477
- }));
478
- }
479
- /**
480
- * Returns `true` if the effect exists inside a boundary whose pending snippet is shown
481
- * @returns {boolean}
482
- */
483
- is_pending() {
484
- return this.#e || !!this.parent && this.parent.is_pending();
485
- }
486
- has_pending_snippet() {
487
- return !!this.#n.pending;
488
- }
489
- /**
490
- * @param {() => Effect | null} fn
491
- */
492
- #v(e) {
493
- var r = m, n = v, i = Y;
494
- ne(this.#o), D(this.#o), Ce(this.#o.ctx);
495
- try {
496
- return e();
497
- } catch (s) {
498
- return Pr(s), null;
499
- } finally {
500
- ne(r), D(n), Ce(i);
501
- }
502
- }
503
- #m() {
504
- const e = (
505
- /** @type {(anchor: Node) => void} */
506
- this.#n.pending
507
- );
508
- this.#i !== null && (this.#l = document.createDocumentFragment(), Jn(this.#i, this.#l)), this.#r === null && (this.#r = he(() => e(this.#t)));
509
- }
510
- /**
511
- * Updates the pending count associated with the currently visible pending snippet,
512
- * if any, such that we can replace the snippet with content once work is done
513
- * @param {1 | -1} d
514
- */
515
- #y(e) {
516
- if (!this.has_pending_snippet()) {
517
- this.parent && this.parent.#y(e);
518
- return;
519
- }
520
- this.#f += e, this.#f === 0 && (this.#e = !1, this.#r && it(this.#r, () => {
521
- this.#r = null;
522
- }), this.#l && (this.#t.before(this.#l), this.#l = null));
523
- }
524
- /**
525
- * Update the source that powers `$effect.pending()` inside this boundary,
526
- * and controls when the current `pending` snippet (if any) is removed.
527
- * Do not call from inside the class
528
- * @param {1 | -1} d
529
- */
530
- update_pending_count(e) {
531
- this.#y(e), this.#p += e, St.add(this.#d);
532
- }
533
- get_effect_pending() {
534
- return this.#g(), g(
535
- /** @type {Source<number>} */
536
- this.#u
537
- );
538
- }
539
- /** @param {unknown} error */
540
- error(e) {
541
- var r = this.#n.onerror;
542
- let n = this.#n.failed;
543
- if (this.#h || !r && !n)
544
- throw e;
545
- this.#i && (ee(this.#i), this.#i = null), this.#r && (ee(this.#r), this.#r = null), this.#s && (ee(this.#s), this.#s = null);
546
- var i = !1, s = !1;
547
- const o = () => {
548
- if (i) {
549
- Zn();
550
- return;
551
- }
552
- i = !0, s && Bn(), ie.ensure(), this.#p = 0, this.#s !== null && it(this.#s, () => {
553
- this.#s = null;
554
- }), this.#e = this.has_pending_snippet(), this.#i = this.#v(() => (this.#h = !1, he(() => this.#c(this.#t)))), this.#f > 0 ? this.#m() : this.#e = !1;
555
- };
556
- var l = v;
557
- try {
558
- D(null), s = !0, r?.(e, o), s = !1;
559
- } catch (a) {
560
- Te(a, this.#o && this.#o.parent);
561
- } finally {
562
- D(l);
563
- }
564
- n && ft(() => {
565
- this.#s = this.#v(() => {
566
- this.#h = !0;
567
- try {
568
- return he(() => {
569
- n(
570
- this.#t,
571
- () => e,
572
- () => o
573
- );
574
- });
575
- } catch (a) {
576
- return Te(
577
- a,
578
- /** @type {Effect} */
579
- this.#o.parent
580
- ), null;
581
- } finally {
582
- this.#h = !1;
583
- }
584
- });
585
- });
586
- }
587
- }
588
- function Jn(t, e) {
589
- for (var r = t.nodes_start, n = t.nodes_end; r !== null; ) {
590
- var i = r === n ? null : (
591
- /** @type {TemplateNode} */
592
- /* @__PURE__ */ qt(r)
593
- );
594
- e.append(r), r = i;
595
- }
596
- }
597
- function Qn(t, e, r) {
598
- const n = ei;
599
- if (e.length === 0) {
600
- r(t.map(n));
601
- return;
602
- }
603
- var i = A, s = (
604
- /** @type {Effect} */
605
- m
606
- ), o = $n();
607
- Promise.all(e.map((l) => /* @__PURE__ */ ti(l))).then((l) => {
608
- i?.activate(), o();
609
- try {
610
- r([...t.map(n), ...l]);
611
- } catch (a) {
612
- (s.f & De) === 0 && Te(a, s);
613
- }
614
- i?.deactivate(), Ar();
615
- }).catch((l) => {
616
- Te(l, s);
617
- });
618
- }
619
- function $n() {
620
- var t = m, e = v, r = Y, n = A;
621
- return function() {
622
- ne(t), D(e), Ce(r), n?.activate();
623
- };
624
- }
625
- function Ar() {
626
- ne(null), D(null), Ce(null);
627
- }
628
- // @__NO_SIDE_EFFECTS__
629
- function ei(t) {
630
- var e = R | re, r = v !== null && (v.f & R) !== 0 ? (
631
- /** @type {Derived} */
632
- v
633
- ) : null;
634
- return m === null || r !== null && (r.f & q) !== 0 ? e |= q : m.f |= Oe, {
635
- ctx: Y,
636
- deps: null,
637
- effects: null,
638
- equals: Mr,
639
- f: e,
640
- fn: t,
641
- reactions: null,
642
- rv: 0,
643
- v: (
644
- /** @type {V} */
645
- x
646
- ),
647
- wv: 0,
648
- parent: r ?? m,
649
- ac: null
650
- };
651
- }
652
- // @__NO_SIDE_EFFECTS__
653
- function ti(t, e) {
654
- let r = (
655
- /** @type {Effect | null} */
656
- m
657
- );
658
- r === null && In();
659
- var n = (
660
- /** @type {Boundary} */
661
- r.b
662
- ), i = (
663
- /** @type {Promise<V>} */
664
- /** @type {unknown} */
665
- void 0
666
- ), s = ct(
667
- /** @type {V} */
668
- x
669
- ), o = null, l = !v;
670
- return ci(() => {
671
- try {
672
- var a = t();
673
- o && Promise.resolve(a).catch(() => {
674
- });
675
- } catch (c) {
676
- a = Promise.reject(c);
677
- }
678
- var u = () => a;
679
- i = o?.then(u, u) ?? Promise.resolve(a), o = i;
680
- var f = (
681
- /** @type {Batch} */
682
- A
683
- ), h = n.is_pending();
684
- l && (n.update_pending_count(1), h || f.increment());
685
- const p = (c, d = void 0) => {
686
- o = null, h || f.activate(), d ? d !== jt && (s.f |= ve, at(s, d)) : ((s.f & ve) !== 0 && (s.f ^= ve), at(s, c)), l && (n.update_pending_count(-1), h || f.decrement()), Ar();
687
- };
688
- if (i.then(p, (c) => p(null, c || "unknown")), f)
689
- return () => {
690
- queueMicrotask(() => f.neuter());
691
- };
692
- }), new Promise((a) => {
693
- function u(f) {
694
- function h() {
695
- f === i ? a(s) : u(i);
696
- }
697
- f.then(h, h);
698
- }
699
- u(i);
700
- });
701
- }
702
- function Cr(t) {
703
- var e = t.effects;
704
- if (e !== null) {
705
- t.effects = null;
706
- for (var r = 0; r < e.length; r += 1)
707
- ee(
708
- /** @type {Effect} */
709
- e[r]
710
- );
711
- }
712
- }
713
- function ri(t) {
714
- for (var e = t.parent; e !== null; ) {
715
- if ((e.f & R) === 0)
716
- return (
717
- /** @type {Effect} */
718
- e
719
- );
720
- e = e.parent;
721
- }
722
- return null;
723
- }
724
- function Zt(t) {
725
- var e, r = m;
726
- ne(ri(t));
727
- try {
728
- Cr(t), e = Vr(t);
729
- } finally {
730
- ne(r);
731
- }
732
- return e;
733
- }
734
- function Tr(t) {
735
- var e = Zt(t);
736
- if (t.equals(e) || (t.v = e, t.wv = Hr()), !Fe) {
737
- var r = (le || (t.f & q) !== 0) && t.deps !== null ? ce : I;
738
- H(t, r);
739
- }
740
- }
741
- const ue = /* @__PURE__ */ new Map();
742
- function ct(t, e) {
743
- var r = {
744
- f: 0,
745
- // TODO ideally we could skip this altogether, but it causes type errors
746
- v: t,
747
- reactions: null,
748
- equals: Mr,
749
- rv: 0,
750
- wv: 0
751
- };
752
- return r;
753
- }
754
- // @__NO_SIDE_EFFECTS__
755
- function C(t, e) {
756
- const r = ct(t);
757
- return mi(r), r;
758
- }
759
- function P(t, e, r = !1) {
760
- v !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
761
- // to ensure we error if state is set inside an inspect effect
762
- (!G || (v.f & or) !== 0) && xr() && (v.f & (R | Ie | Nt | or)) !== 0 && !se?.includes(t) && zn();
763
- let n = r ? je(e) : e;
764
- return at(t, n);
765
- }
766
- function at(t, e) {
767
- if (!t.equals(e)) {
768
- var r = t.v;
769
- Fe ? ue.set(t, e) : ue.set(t, r), t.v = e;
770
- var n = ie.ensure();
771
- n.capture(t, r), (t.f & R) !== 0 && ((t.f & re) !== 0 && Zt(
772
- /** @type {Derived} */
773
- t
774
- ), H(t, (t.f & q) === 0 ? I : ce)), t.wv = Hr(), Lr(t, re), m !== null && (m.f & I) !== 0 && (m.f & (fe | ge)) === 0 && (j === null ? yi([t]) : j.push(t));
775
- }
776
- return e;
777
- }
778
- function Ze(t) {
779
- P(t, t.v + 1);
780
- }
781
- function Lr(t, e) {
782
- var r = t.reactions;
783
- if (r !== null)
784
- for (var n = r.length, i = 0; i < n; i++) {
785
- var s = r[i], o = s.f, l = (o & re) === 0;
786
- l && H(s, e), (o & R) !== 0 ? Lr(
787
- /** @type {Derived} */
788
- s,
789
- ce
790
- ) : l && ((o & Ie) !== 0 && de !== null && de.push(
791
- /** @type {Effect} */
792
- s
793
- ), We(
794
- /** @type {Effect} */
795
- s
796
- ));
797
- }
798
- }
799
- function je(t) {
800
- if (typeof t != "object" || t === null || nt in t)
801
- return t;
802
- const e = Sn(t);
803
- if (e !== xn && e !== Pn)
804
- return t;
805
- var r = /* @__PURE__ */ new Map(), n = Er(t), i = /* @__PURE__ */ C(0), s = me, o = (l) => {
806
- if (me === s)
807
- return l();
808
- var a = v, u = me;
809
- D(null), pr(s);
810
- var f = l();
811
- return D(a), pr(u), f;
812
- };
813
- return n && r.set("length", /* @__PURE__ */ C(
814
- /** @type {any[]} */
815
- t.length
816
- )), new Proxy(
817
- /** @type {any} */
818
- t,
819
- {
820
- defineProperty(l, a, u) {
821
- (!("value" in u) || u.configurable === !1 || u.enumerable === !1 || u.writable === !1) && Nn();
822
- var f = r.get(a);
823
- return f === void 0 ? f = o(() => {
824
- var h = /* @__PURE__ */ C(u.value);
825
- return r.set(a, h), h;
826
- }) : P(f, u.value, !0), !0;
827
- },
828
- deleteProperty(l, a) {
829
- var u = r.get(a);
830
- if (u === void 0) {
831
- if (a in l) {
832
- const f = o(() => /* @__PURE__ */ C(x));
833
- r.set(a, f), Ze(i);
834
- }
835
- } else
836
- P(u, x), Ze(i);
837
- return !0;
838
- },
839
- get(l, a, u) {
840
- if (a === nt)
841
- return t;
842
- var f = r.get(a), h = a in l;
843
- if (f === void 0 && (!h || Ue(l, a)?.writable) && (f = o(() => {
844
- var c = je(h ? l[a] : x), d = /* @__PURE__ */ C(c);
845
- return d;
846
- }), r.set(a, f)), f !== void 0) {
847
- var p = g(f);
848
- return p === x ? void 0 : p;
849
- }
850
- return Reflect.get(l, a, u);
851
- },
852
- getOwnPropertyDescriptor(l, a) {
853
- var u = Reflect.getOwnPropertyDescriptor(l, a);
854
- if (u && "value" in u) {
855
- var f = r.get(a);
856
- f && (u.value = g(f));
857
- } else if (u === void 0) {
858
- var h = r.get(a), p = h?.v;
859
- if (h !== void 0 && p !== x)
860
- return {
861
- enumerable: !0,
862
- configurable: !0,
863
- value: p,
864
- writable: !0
865
- };
866
- }
867
- return u;
868
- },
869
- has(l, a) {
870
- if (a === nt)
871
- return !0;
872
- var u = r.get(a), f = u !== void 0 && u.v !== x || Reflect.has(l, a);
873
- if (u !== void 0 || m !== null && (!f || Ue(l, a)?.writable)) {
874
- u === void 0 && (u = o(() => {
875
- var p = f ? je(l[a]) : x, c = /* @__PURE__ */ C(p);
876
- return c;
877
- }), r.set(a, u));
878
- var h = g(u);
879
- if (h === x)
880
- return !1;
881
- }
882
- return f;
883
- },
884
- set(l, a, u, f) {
885
- var h = r.get(a), p = a in l;
886
- if (n && a === "length")
887
- for (var c = u; c < /** @type {Source<number>} */
888
- h.v; c += 1) {
889
- var d = r.get(c + "");
890
- d !== void 0 ? P(d, x) : c in l && (d = o(() => /* @__PURE__ */ C(x)), r.set(c + "", d));
891
- }
892
- if (h === void 0)
893
- (!p || Ue(l, a)?.writable) && (h = o(() => /* @__PURE__ */ C(void 0)), P(h, je(u)), r.set(a, h));
894
- else {
895
- p = h.v !== x;
896
- var w = o(() => je(u));
897
- P(h, w);
898
- }
899
- var O = Reflect.getOwnPropertyDescriptor(l, a);
900
- if (O?.set && O.set.call(f, u), !p) {
901
- if (n && typeof a == "string") {
902
- var K = (
903
- /** @type {Source<number>} */
904
- r.get("length")
905
- ), b = Number(a);
906
- Number.isInteger(b) && b >= K.v && P(K, b + 1);
907
- }
908
- Ze(i);
909
- }
910
- return !0;
911
- },
912
- ownKeys(l) {
913
- g(i);
914
- var a = Reflect.ownKeys(l).filter((h) => {
915
- var p = r.get(h);
916
- return p === void 0 || p.v !== x;
917
- });
918
- for (var [u, f] of r)
919
- f.v !== x && !(u in l) && a.push(u);
920
- return a;
921
- },
922
- setPrototypeOf() {
923
- jn();
924
- }
925
- }
926
- );
927
- }
928
- var lr, Ir, Dr, Or;
929
- function ni() {
930
- if (lr === void 0) {
931
- lr = window, Ir = /Firefox/.test(navigator.userAgent);
932
- var t = Element.prototype, e = Node.prototype, r = Text.prototype;
933
- Dr = Ue(e, "firstChild").get, Or = Ue(e, "nextSibling").get, sr(t) && (t.__click = void 0, t.__className = void 0, t.__attributes = null, t.__style = void 0, t.__e = void 0), sr(r) && (r.__t = void 0);
934
- }
935
- }
936
- function ii(t = "") {
937
- return document.createTextNode(t);
938
- }
939
- // @__NO_SIDE_EFFECTS__
940
- function Fr(t) {
941
- return Dr.call(t);
942
- }
943
- // @__NO_SIDE_EFFECTS__
944
- function qt(t) {
945
- return Or.call(t);
946
- }
947
- function ur(t, e) {
948
- return /* @__PURE__ */ Fr(t);
949
- }
950
- function si(t, e = 1, r = !1) {
951
- let n = t;
952
- for (; e--; )
953
- n = /** @type {TemplateNode} */
954
- /* @__PURE__ */ qt(n);
955
- return n;
956
- }
957
- function Rr(t) {
958
- var e = v, r = m;
959
- D(null), ne(null);
960
- try {
961
- return t();
962
- } finally {
963
- D(e), ne(r);
964
- }
965
- }
966
- function oi(t) {
967
- m === null && v === null && Fn(), v !== null && (v.f & q) !== 0 && m === null && On(), Fe && Dn();
968
- }
969
- function ai(t, e) {
970
- var r = e.last;
971
- r === null ? e.last = e.first = t : (r.next = t, t.prev = r, e.last = t);
972
- }
973
- function pe(t, e, r, n = !0) {
974
- var i = m;
975
- i !== null && (i.f & Ae) !== 0 && (t |= Ae);
976
- var s = {
977
- ctx: Y,
978
- deps: null,
979
- nodes_start: null,
980
- nodes_end: null,
981
- f: t | re,
982
- first: null,
983
- fn: e,
984
- last: null,
985
- next: null,
986
- parent: i,
987
- b: i && i.b,
988
- prev: null,
989
- teardown: null,
990
- transitions: null,
991
- wv: 0,
992
- ac: null
993
- };
994
- if (r)
995
- try {
996
- Se(s), s.f |= Rt;
997
- } catch (a) {
998
- throw ee(s), a;
999
- }
1000
- else e !== null && We(s);
1001
- if (n) {
1002
- var o = s;
1003
- if (r && o.deps === null && o.teardown === null && o.nodes_start === null && o.first === o.last && // either `null`, or a singular child
1004
- (o.f & Oe) === 0 && (o = o.first), o !== null && (o.parent = i, i !== null && ai(o, i), v !== null && (v.f & R) !== 0 && (t & ge) === 0)) {
1005
- var l = (
1006
- /** @type {Derived} */
1007
- v
1008
- );
1009
- (l.effects ??= []).push(o);
1010
- }
1011
- }
1012
- return s;
1013
- }
1014
- function li() {
1015
- return v !== null && !G;
1016
- }
1017
- function J(t) {
1018
- oi();
1019
- var e = (
1020
- /** @type {Effect} */
1021
- m.f
1022
- ), r = !v && (e & fe) !== 0 && (e & Rt) === 0;
1023
- if (r) {
1024
- var n = (
1025
- /** @type {ComponentContext} */
1026
- Y
1027
- );
1028
- (n.e ??= []).push(t);
1029
- } else
1030
- return Nr(t);
1031
- }
1032
- function Nr(t) {
1033
- return pe(Ot | Ln, t, !1);
1034
- }
1035
- function ui(t) {
1036
- ie.ensure();
1037
- const e = pe(ge | Oe, t, !0);
1038
- return (r = {}) => new Promise((n) => {
1039
- r.outro ? it(e, () => {
1040
- ee(e), n(void 0);
1041
- }) : (ee(e), n(void 0));
1042
- });
1043
- }
1044
- function fi(t) {
1045
- return pe(Ot, t, !1);
1046
- }
1047
- function ci(t) {
1048
- return pe(Nt | Oe, t, !0);
1049
- }
1050
- function Ht(t, e = 0) {
1051
- return pe(kr | e, t, !0);
1052
- }
1053
- function jr(t, e = [], r = []) {
1054
- Qn(e, r, (n) => {
1055
- pe(kr, () => t(...n.map(g)), !0);
1056
- });
1057
- }
1058
- function pi(t, e = 0) {
1059
- var r = pe(Ie | e, t, !0);
1060
- return r;
1061
- }
1062
- function he(t, e = !0) {
1063
- return pe(fe | Oe, t, !0, e);
1064
- }
1065
- function zr(t) {
1066
- var e = t.teardown;
1067
- if (e !== null) {
1068
- const r = Fe, n = v;
1069
- cr(!0), D(null);
1070
- try {
1071
- e.call(null);
1072
- } finally {
1073
- cr(r), D(n);
1074
- }
1075
- }
1076
- }
1077
- function Br(t, e = !1) {
1078
- var r = t.first;
1079
- for (t.first = t.last = null; r !== null; ) {
1080
- const i = r.ac;
1081
- i !== null && Rr(() => {
1082
- i.abort(jt);
1083
- });
1084
- var n = r.next;
1085
- (r.f & ge) !== 0 ? r.parent = null : ee(r, e), r = n;
1086
- }
1087
- }
1088
- function hi(t) {
1089
- for (var e = t.first; e !== null; ) {
1090
- var r = e.next;
1091
- (e.f & fe) === 0 && ee(e), e = r;
1092
- }
1093
- }
1094
- function ee(t, e = !0) {
1095
- var r = !1;
1096
- (e || (t.f & Tn) !== 0) && t.nodes_start !== null && t.nodes_end !== null && (di(
1097
- t.nodes_start,
1098
- /** @type {TemplateNode} */
1099
- t.nodes_end
1100
- ), r = !0), Br(t, e && !r), lt(t, 0), H(t, De);
1101
- var n = t.transitions;
1102
- if (n !== null)
1103
- for (const s of n)
1104
- s.stop();
1105
- zr(t);
1106
- var i = t.parent;
1107
- i !== null && i.first !== null && Ur(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes_start = t.nodes_end = t.ac = null;
1108
- }
1109
- function di(t, e) {
1110
- for (; t !== null; ) {
1111
- var r = t === e ? null : (
1112
- /** @type {TemplateNode} */
1113
- /* @__PURE__ */ qt(t)
1114
- );
1115
- t.remove(), t = r;
1116
- }
1117
- }
1118
- function Ur(t) {
1119
- var e = t.parent, r = t.prev, n = t.next;
1120
- r !== null && (r.next = n), n !== null && (n.prev = r), e !== null && (e.first === t && (e.first = n), e.last === t && (e.last = r));
1121
- }
1122
- function it(t, e) {
1123
- var r = [];
1124
- Zr(t, r, !0), vi(r, () => {
1125
- ee(t), e && e();
1126
- });
1127
- }
1128
- function vi(t, e) {
1129
- var r = t.length;
1130
- if (r > 0) {
1131
- var n = () => --r || e();
1132
- for (var i of t)
1133
- i.out(n);
1134
- } else
1135
- e();
1136
- }
1137
- function Zr(t, e, r) {
1138
- if ((t.f & Ae) === 0) {
1139
- if (t.f ^= Ae, t.transitions !== null)
1140
- for (const o of t.transitions)
1141
- (o.is_global || r) && e.push(o);
1142
- for (var n = t.first; n !== null; ) {
1143
- var i = n.next, s = (n.f & br) !== 0 || (n.f & fe) !== 0;
1144
- Zr(n, e, s ? r : !1), n = i;
1145
- }
1146
- }
1147
- }
1148
- let Pe = !1;
1149
- function fr(t) {
1150
- Pe = t;
1151
- }
1152
- let Fe = !1;
1153
- function cr(t) {
1154
- Fe = t;
1155
- }
1156
- let v = null, G = !1;
1157
- function D(t) {
1158
- v = t;
1159
- }
1160
- let m = null;
1161
- function ne(t) {
1162
- m = t;
1163
- }
1164
- let se = null;
1165
- function mi(t) {
1166
- v !== null && (se === null ? se = [t] : se.push(t));
1167
- }
1168
- let T = null, F = 0, j = null;
1169
- function yi(t) {
1170
- j = t;
1171
- }
1172
- let qr = 1, Ge = 0, me = Ge;
1173
- function pr(t) {
1174
- me = t;
1175
- }
1176
- let le = !1;
1177
- function Hr() {
1178
- return ++qr;
1179
- }
1180
- function pt(t) {
1181
- var e = t.f;
1182
- if ((e & re) !== 0)
1183
- return !0;
1184
- if ((e & ce) !== 0) {
1185
- var r = t.deps, n = (e & q) !== 0;
1186
- if (r !== null) {
1187
- var i, s, o = (e & ot) !== 0, l = n && m !== null && !le, a = r.length;
1188
- if ((o || l) && (m === null || (m.f & De) === 0)) {
1189
- var u = (
1190
- /** @type {Derived} */
1191
- t
1192
- ), f = u.parent;
1193
- for (i = 0; i < a; i++)
1194
- s = r[i], (o || !s?.reactions?.includes(u)) && (s.reactions ??= []).push(u);
1195
- o && (u.f ^= ot), l && f !== null && (f.f & q) === 0 && (u.f ^= q);
1196
- }
1197
- for (i = 0; i < a; i++)
1198
- if (s = r[i], pt(
1199
- /** @type {Derived} */
1200
- s
1201
- ) && Tr(
1202
- /** @type {Derived} */
1203
- s
1204
- ), s.wv > t.wv)
1205
- return !0;
1206
- }
1207
- (!n || m !== null && !le) && H(t, I);
1208
- }
1209
- return !1;
1210
- }
1211
- function Yr(t, e, r = !0) {
1212
- var n = t.reactions;
1213
- if (n !== null && !se?.includes(t))
1214
- for (var i = 0; i < n.length; i++) {
1215
- var s = n[i];
1216
- (s.f & R) !== 0 ? Yr(
1217
- /** @type {Derived} */
1218
- s,
1219
- e,
1220
- !1
1221
- ) : e === s && (r ? H(s, re) : (s.f & I) !== 0 && H(s, ce), We(
1222
- /** @type {Effect} */
1223
- s
1224
- ));
1225
- }
1226
- }
1227
- function Vr(t) {
1228
- var e = T, r = F, n = j, i = v, s = le, o = se, l = Y, a = G, u = me, f = t.f;
1229
- T = /** @type {null | Value[]} */
1230
- null, F = 0, j = null, le = (f & q) !== 0 && (G || !Pe || v === null), v = (f & (fe | ge)) === 0 ? t : null, se = null, Ce(t.ctx), G = !1, me = ++Ge, t.ac !== null && (Rr(() => {
1231
- t.ac.abort(jt);
1232
- }), t.ac = null);
1233
- try {
1234
- t.f |= Pt;
1235
- var h = (
1236
- /** @type {Function} */
1237
- t.fn
1238
- ), p = h(), c = t.deps;
1239
- if (T !== null) {
1240
- var d;
1241
- if (lt(t, F), c !== null && F > 0)
1242
- for (c.length = F + T.length, d = 0; d < T.length; d++)
1243
- c[F + d] = T[d];
1244
- else
1245
- t.deps = c = T;
1246
- if (!le || // Deriveds that already have reactions can cleanup, so we still add them as reactions
1247
- (f & R) !== 0 && /** @type {import('#client').Derived} */
1248
- t.reactions !== null)
1249
- for (d = F; d < c.length; d++)
1250
- (c[d].reactions ??= []).push(t);
1251
- } else c !== null && F < c.length && (lt(t, F), c.length = F);
1252
- if (xr() && j !== null && !G && c !== null && (t.f & (R | ce | re)) === 0)
1253
- for (d = 0; d < /** @type {Source[]} */
1254
- j.length; d++)
1255
- Yr(
1256
- j[d],
1257
- /** @type {Effect} */
1258
- t
1259
- );
1260
- return i !== null && i !== t && (Ge++, j !== null && (n === null ? n = j : n.push(.../** @type {Source[]} */
1261
- j))), (t.f & ve) !== 0 && (t.f ^= ve), p;
1262
- } catch (w) {
1263
- return Pr(w);
1264
- } finally {
1265
- t.f ^= Pt, T = e, F = r, j = n, v = i, le = s, se = o, Ce(l), G = a, me = u;
1266
- }
1267
- }
1268
- function gi(t, e) {
1269
- let r = e.reactions;
1270
- if (r !== null) {
1271
- var n = bn.call(r, t);
1272
- if (n !== -1) {
1273
- var i = r.length - 1;
1274
- i === 0 ? r = e.reactions = null : (r[n] = r[i], r.pop());
1275
- }
1276
- }
1277
- r === null && (e.f & R) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1278
- // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1279
- // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1280
- (T === null || !T.includes(e)) && (H(e, ce), (e.f & (q | ot)) === 0 && (e.f ^= ot), Cr(
1281
- /** @type {Derived} **/
1282
- e
1283
- ), lt(
1284
- /** @type {Derived} **/
1285
- e,
1286
- 0
1287
- ));
1288
- }
1289
- function lt(t, e) {
1290
- var r = t.deps;
1291
- if (r !== null)
1292
- for (var n = e; n < r.length; n++)
1293
- gi(t, r[n]);
1294
- }
1295
- function Se(t) {
1296
- var e = t.f;
1297
- if ((e & De) === 0) {
1298
- H(t, I);
1299
- var r = m, n = Pe;
1300
- m = t, Pe = !0;
1301
- try {
1302
- (e & Ie) !== 0 ? hi(t) : Br(t), zr(t);
1303
- var i = Vr(t);
1304
- t.teardown = typeof i == "function" ? i : null, t.wv = qr;
1305
- var s;
1306
- } finally {
1307
- Pe = n, m = r;
1308
- }
1309
- }
1310
- }
1311
- function g(t) {
1312
- var e = t.f, r = (e & R) !== 0;
1313
- if (v !== null && !G) {
1314
- var n = m !== null && (m.f & De) !== 0;
1315
- if (!n && !se?.includes(t)) {
1316
- var i = v.deps;
1317
- if ((v.f & Pt) !== 0)
1318
- t.rv < Ge && (t.rv = Ge, T === null && i !== null && i[F] === t ? F++ : T === null ? T = [t] : (!le || !T.includes(t)) && T.push(t));
1319
- else {
1320
- (v.deps ??= []).push(t);
1321
- var s = t.reactions;
1322
- s === null ? t.reactions = [v] : s.includes(v) || s.push(v);
1323
- }
1324
- }
1325
- } else if (r && /** @type {Derived} */
1326
- t.deps === null && /** @type {Derived} */
1327
- t.effects === null) {
1328
- var o = (
1329
- /** @type {Derived} */
1330
- t
1331
- ), l = o.parent;
1332
- l !== null && (l.f & q) === 0 && (o.f ^= q);
1333
- }
1334
- if (Fe) {
1335
- if (ue.has(t))
1336
- return ue.get(t);
1337
- if (r) {
1338
- o = /** @type {Derived} */
1339
- t;
1340
- var a = o.v;
1341
- return ((o.f & I) === 0 && o.reactions !== null || Xr(o)) && (a = Zt(o)), ue.set(o, a), a;
1342
- }
1343
- } else r && (o = /** @type {Derived} */
1344
- t, pt(o) && Tr(o));
1345
- if ((t.f & ve) !== 0)
1346
- throw t.v;
1347
- return t.v;
1348
- }
1349
- function Xr(t) {
1350
- if (t.v === x) return !0;
1351
- if (t.deps === null) return !1;
1352
- for (const e of t.deps)
1353
- if (ue.has(e) || (e.f & R) !== 0 && Xr(
1354
- /** @type {Derived} */
1355
- e
1356
- ))
1357
- return !0;
1358
- return !1;
1359
- }
1360
- function Wr(t) {
1361
- var e = G;
1362
- try {
1363
- return G = !0, t();
1364
- } finally {
1365
- G = e;
1366
- }
1367
- }
1368
- const _i = -7169;
1369
- function H(t, e) {
1370
- t.f = t.f & _i | e;
1371
- }
1372
- const wi = ["touchstart", "touchmove"];
1373
- function Ei(t) {
1374
- return wi.includes(t);
1375
- }
1376
- const ki = /* @__PURE__ */ new Set(), hr = /* @__PURE__ */ new Set();
1377
- let dr = null;
1378
- function tt(t) {
1379
- var e = this, r = (
1380
- /** @type {Node} */
1381
- e.ownerDocument
1382
- ), n = t.type, i = t.composedPath?.() || [], s = (
1383
- /** @type {null | Element} */
1384
- i[0] || t.target
1385
- );
1386
- dr = t;
1387
- var o = 0, l = dr === t && t.__root;
1388
- if (l) {
1389
- var a = i.indexOf(l);
1390
- if (a !== -1 && (e === document || e === /** @type {any} */
1391
- window)) {
1392
- t.__root = e;
1393
- return;
1394
- }
1395
- var u = i.indexOf(e);
1396
- if (u === -1)
1397
- return;
1398
- a <= u && (o = a);
1399
- }
1400
- if (s = /** @type {Element} */
1401
- i[o] || t.target, s !== e) {
1402
- xt(t, "currentTarget", {
1403
- configurable: !0,
1404
- get() {
1405
- return s || r;
1406
- }
1407
- });
1408
- var f = v, h = m;
1409
- D(null), ne(null);
1410
- try {
1411
- for (var p, c = []; s !== null; ) {
1412
- var d = s.assignedSlot || s.parentNode || /** @type {any} */
1413
- s.host || null;
1414
- try {
1415
- var w = s["__" + n];
1416
- if (w != null && (!/** @type {any} */
1417
- s.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1418
- // -> the target could not have been disabled because it emits the event in the first place
1419
- t.target === s))
1420
- if (Er(w)) {
1421
- var [O, ...K] = w;
1422
- O.apply(s, [t, ...K]);
1423
- } else
1424
- w.call(s, t);
1425
- } catch (b) {
1426
- p ? c.push(b) : p = b;
1427
- }
1428
- if (t.cancelBubble || d === e || d === null)
1429
- break;
1430
- s = d;
1431
- }
1432
- if (p) {
1433
- for (let b of c)
1434
- queueMicrotask(() => {
1435
- throw b;
1436
- });
1437
- throw p;
1438
- }
1439
- } finally {
1440
- t.__root = e, delete t.currentTarget, D(f), ne(h);
1441
- }
1442
- }
1443
- }
1444
- function bi(t) {
1445
- var e = document.createElement("template");
1446
- return e.innerHTML = t.replaceAll("<!>", "<!---->"), e.content;
1447
- }
1448
- function Mi(t, e) {
1449
- var r = (
1450
- /** @type {Effect} */
1451
- m
1452
- );
1453
- r.nodes_start === null && (r.nodes_start = t, r.nodes_end = e);
1454
- }
1455
- // @__NO_SIDE_EFFECTS__
1456
- function Gr(t, e) {
1457
- var r = (e & Un) !== 0, n, i = !t.startsWith("<!>");
1458
- return () => {
1459
- n === void 0 && (n = bi(i ? t : "<!>" + t), n = /** @type {Node} */
1460
- /* @__PURE__ */ Fr(n));
1461
- var s = (
1462
- /** @type {TemplateNode} */
1463
- r || Ir ? document.importNode(n, !0) : n.cloneNode(!0)
1464
- );
1465
- return Mi(s, s), s;
1466
- };
1467
- }
1468
- function Kr(t, e) {
1469
- t !== null && t.before(
1470
- /** @type {Node} */
1471
- e
1472
- );
1473
- }
1474
- function Yt(t, e) {
1475
- return xi(t, e);
1476
- }
1477
- const be = /* @__PURE__ */ new Map();
1478
- function xi(t, { target: e, anchor: r, props: n = {}, events: i, context: s, intro: o = !0 }) {
1479
- ni();
1480
- var l = /* @__PURE__ */ new Set(), a = (h) => {
1481
- for (var p = 0; p < h.length; p++) {
1482
- var c = h[p];
1483
- if (!l.has(c)) {
1484
- l.add(c);
1485
- var d = Ei(c);
1486
- e.addEventListener(c, tt, { passive: d });
1487
- var w = be.get(c);
1488
- w === void 0 ? (document.addEventListener(c, tt, { passive: d }), be.set(c, 1)) : be.set(c, w + 1);
1489
- }
1490
- }
1491
- };
1492
- a(Mn(ki)), hr.add(a);
1493
- var u = void 0, f = ui(() => {
1494
- var h = r ?? e.appendChild(ii());
1495
- return Gn(
1496
- /** @type {TemplateNode} */
1497
- h,
1498
- {
1499
- pending: () => {
1500
- }
1501
- },
1502
- (p) => {
1503
- if (s) {
1504
- zt({});
1505
- var c = (
1506
- /** @type {ComponentContext} */
1507
- Y
1508
- );
1509
- c.c = s;
1510
- }
1511
- i && (n.$$events = i), u = t(p, n) || {}, s && Bt();
1512
- }
1513
- ), () => {
1514
- for (var p of l) {
1515
- e.removeEventListener(p, tt);
1516
- var c = (
1517
- /** @type {number} */
1518
- be.get(p)
1519
- );
1520
- --c === 0 ? (document.removeEventListener(p, tt), be.delete(p)) : be.set(p, c);
1521
- }
1522
- hr.delete(a), h !== r && h.parentNode?.removeChild(h);
1523
- };
1524
- });
1525
- return Pi.set(u, f), u;
1526
- }
1527
- let Pi = /* @__PURE__ */ new WeakMap();
1528
- function Jr(t) {
1529
- var e, r, n = "";
1530
- if (typeof t == "string" || typeof t == "number") n += t;
1531
- else if (typeof t == "object") if (Array.isArray(t)) {
1532
- var i = t.length;
1533
- for (e = 0; e < i; e++) t[e] && (r = Jr(t[e])) && (n && (n += " "), n += r);
1534
- } else for (r in t) t[r] && (n && (n += " "), n += r);
1535
- return n;
1536
- }
1537
- function Si() {
1538
- for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = Jr(t)) && (n && (n += " "), n += e);
1539
- return n;
1540
- }
1541
- function Qr(t) {
1542
- return typeof t == "object" ? Si(t) : t ?? "";
1543
- }
1544
- function Ai(t, e, r) {
1545
- var n = t == null ? "" : "" + t;
1546
- return e && (n = n ? n + " " + e : e), n === "" ? null : n;
1547
- }
1548
- function vr(t, e = !1) {
1549
- var r = e ? " !important;" : ";", n = "";
1550
- for (var i in t) {
1551
- var s = t[i];
1552
- s != null && s !== "" && (n += " " + i + ": " + s + r);
1553
- }
1554
- return n;
1555
- }
1556
- function Ci(t, e) {
1557
- if (e) {
1558
- var r = "", n, i;
1559
- return Array.isArray(e) ? (n = e[0], i = e[1]) : n = e, n && (r += vr(n)), i && (r += vr(i, !0)), r = r.trim(), r === "" ? null : r;
1560
- }
1561
- return String(t);
1562
- }
1563
- function $r(t, e, r, n, i, s) {
1564
- var o = t.__className;
1565
- if (o !== r || o === void 0) {
1566
- var l = Ai(r, n);
1567
- l == null ? t.removeAttribute("class") : t.className = l, t.__className = r;
1568
- }
1569
- return s;
1570
- }
1571
- function kt(t, e = {}, r, n) {
1572
- for (var i in r) {
1573
- var s = r[i];
1574
- e[i] !== s && (r[i] == null ? t.style.removeProperty(i) : t.style.setProperty(i, s, n));
1575
- }
1576
- }
1577
- function ze(t, e, r, n) {
1578
- var i = t.__style;
1579
- if (i !== e) {
1580
- var s = Ci(e, n);
1581
- s == null ? t.removeAttribute("style") : t.style.cssText = s, t.__style = e;
1582
- } else n && (Array.isArray(n) ? (kt(t, r?.[0], n[0]), kt(t, r?.[1], n[1], "important")) : kt(t, r, n));
1583
- return n;
1584
- }
1585
- const Ti = () => performance.now(), Q = {
1586
- // don't access requestAnimationFrame eagerly outside method
1587
- // this allows basic testing of user code without JSDOM
1588
- // bunder will eval and remove ternary when the user's app is built
1589
- tick: (
1590
- /** @param {any} _ */
1591
- (t) => requestAnimationFrame(t)
1592
- ),
1593
- now: () => Ti(),
1594
- tasks: /* @__PURE__ */ new Set()
1595
- };
1596
- function en() {
1597
- const t = Q.now();
1598
- Q.tasks.forEach((e) => {
1599
- e.c(t) || (Q.tasks.delete(e), e.f());
1600
- }), Q.tasks.size !== 0 && Q.tick(en);
1601
- }
1602
- function Li(t) {
1603
- let e;
1604
- return Q.tasks.size === 0 && Q.tick(en), {
1605
- promise: new Promise((r) => {
1606
- Q.tasks.add(e = { c: t, f: r });
1607
- }),
1608
- abort() {
1609
- Q.tasks.delete(e);
1610
- }
1611
- };
1612
- }
1613
- function mr(t, e) {
1614
- return t === e || t?.[nt] === e;
1615
- }
1616
- function Be(t = {}, e, r, n) {
1617
- return fi(() => {
1618
- var i, s;
1619
- return Ht(() => {
1620
- i = s, s = [], Wr(() => {
1621
- t !== r(...s) && (e(t, ...s), i && mr(r(...i), t) && e(null, ...i));
1622
- });
1623
- }), () => {
1624
- ft(() => {
1625
- s && mr(r(...s), t) && e(null, ...s);
1626
- });
1627
- };
1628
- }), t;
1629
- }
1630
- const Ii = "5";
1631
- typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(Ii);
1632
- function Di(t) {
1633
- return t;
1634
- }
1635
- function Ct(t) {
1636
- return -0.5 * (Math.cos(Math.PI * t) - 1);
1637
- }
1638
- function Oi(t) {
1639
- const e = Math.cos(t * Math.PI * 0.5);
1640
- return Math.abs(e) < 1e-14 ? 1 : 1 - e;
1641
- }
1642
- function Fi(t) {
1643
- return Math.sin(t * Math.PI / 2);
1644
- }
1645
- const Ri = 128, Ni = 0, ji = 1, zi = 2;
1646
- class Bi {
1647
- animationsStarted = !1;
1648
- animationsCount = 0;
1649
- animationsLimit = Ri;
1650
- layers = new Array();
1651
- start() {
1652
- window.requestAnimationFrame(this.tick.bind(this));
1653
- }
1654
- tick() {
1655
- try {
1656
- this.animationsCount = 0;
1657
- for (let e = 0; e < this.layers.length; e++) {
1658
- const r = this.layers[e];
1659
- if (r == null) continue;
1660
- const n = r.animations;
1661
- if (n != null)
1662
- for (let i = 0; i < n.length; i++) {
1663
- const s = n[i];
1664
- if (s != null) {
1665
- for (const o of s.values())
1666
- if (!o.executed && (o.executed = !0, o.function(), this.animationsCount++, this.animationsCount == this.animationsLimit))
1667
- return;
1668
- }
1669
- }
1670
- }
1671
- } catch {
1672
- } finally {
1673
- window.requestAnimationFrame(this.tick.bind(this));
1674
- }
1675
- }
1676
- equeue(e, r, n, i) {
1677
- let s = this.layers[e];
1678
- s == null && (s = this.layers[e] = { animations: new Array() });
1679
- let o = s.animations[r];
1680
- o == null && (o = s.animations[r] = /* @__PURE__ */ new Map());
1681
- let l = { id: n, priority: r, executed: !1, function: i };
1682
- o.set(n, l), this.animationsStarted == !1 && (this.animationsStarted = !0, this.start());
1683
- }
1684
- clear(e, r) {
1685
- for (let n = 0; n < this.layers.length; n++) {
1686
- let i = this.layers[n];
1687
- if (i == null) continue;
1688
- let s = i.animations[e];
1689
- if (s == null) return;
1690
- let o = s.get(r);
1691
- if (o == null || o.executed == !1) return;
1692
- s.delete(r);
1693
- }
1694
- }
1695
- speed() {
1696
- return Math.pow(2, 2 * this.animationsCount / this.animationsLimit);
1697
- }
1698
- stacked() {
1699
- return this.animationsCount == this.animationsLimit;
1700
- }
1701
- setLimit(e) {
1702
- this.animationsLimit = e;
1703
- }
1704
- }
1705
- const ae = new Bi();
1706
- function yr(t) {
1707
- return Object.prototype.toString.call(t) === "[object Date]";
1708
- }
1709
- function Tt(t, e) {
1710
- if (t === e || t !== t) return () => t;
1711
- const r = typeof t;
1712
- if (r !== typeof e || Array.isArray(t) !== Array.isArray(e))
1713
- throw new Error("Cannot interpolate values of different type");
1714
- if (Array.isArray(t)) {
1715
- const n = (
1716
- /** @type {Array<any>} */
1717
- e.map((i, s) => Tt(
1718
- /** @type {Array<any>} */
1719
- t[s],
1720
- i
1721
- ))
1722
- );
1723
- return (i) => n.map((s) => s(i));
1724
- }
1725
- if (r === "object") {
1726
- if (!t || !e)
1727
- throw new Error("Object cannot be null");
1728
- if (yr(t) && yr(e)) {
1729
- const s = t.getTime(), l = e.getTime() - s;
1730
- return (a) => new Date(s + a * l);
1731
- }
1732
- const n = Object.keys(e), i = {};
1733
- return n.forEach((s) => {
1734
- i[s] = Tt(t[s], e[s]);
1735
- }), (s) => {
1736
- const o = {};
1737
- return n.forEach((l) => {
1738
- o[l] = i[l](s);
1739
- }), o;
1740
- };
1741
- }
1742
- if (r === "number") {
1743
- const n = (
1744
- /** @type {number} */
1745
- e - /** @type {number} */
1746
- t
1747
- );
1748
- return (i) => t + i * n;
1749
- }
1750
- return () => e;
1751
- }
1752
- class Vt {
1753
- #e;
1754
- #t;
1755
- /** @type {TweenedOptions<T>} */
1756
- #a;
1757
- /** @type {import('../internal/client/types').Task | null} */
1758
- #n = null;
1759
- /**
1760
- * @param {T} value
1761
- * @param {TweenedOptions<T>} options
1762
- */
1763
- constructor(e, r = {}) {
1764
- this.#e = /* @__PURE__ */ C(e), this.#t = /* @__PURE__ */ C(e), this.#a = r;
1765
- }
1766
- /**
1767
- * Create a tween whose value is bound to the return value of `fn`. This must be called
1768
- * inside an effect root (for example, during component initialisation).
1769
- *
1770
- * ```svelte
1771
- * <script>
1772
- * import { Tween } from 'svelte/motion';
1773
- *
1774
- * let { number } = $props();
1775
- *
1776
- * const tween = Tween.of(() => number);
1777
- * <\/script>
1778
- * ```
1779
- * @template U
1780
- * @param {() => U} fn
1781
- * @param {TweenedOptions<U>} [options]
1782
- */
1783
- static of(e, r) {
1784
- const n = new Vt(e(), r);
1785
- return Ht(() => {
1786
- n.set(e());
1787
- }), n;
1788
- }
1789
- /**
1790
- * Sets `tween.target` to `value` and returns a `Promise` that resolves if and when `tween.current` catches up to it.
1791
- *
1792
- * If `options` are provided, they will override the tween's defaults.
1793
- * @param {T} value
1794
- * @param {TweenedOptions<T>} [options]
1795
- * @returns
1796
- */
1797
- set(e, r) {
1798
- P(this.#t, e);
1799
- let {
1800
- delay: n = 0,
1801
- duration: i = 400,
1802
- easing: s = Di,
1803
- interpolate: o = Tt
1804
- } = { ...this.#a, ...r };
1805
- if (i === 0)
1806
- return this.#n?.abort(), P(this.#e, e), Promise.resolve();
1807
- const l = Q.now() + n;
1808
- let a, u = !1, f = this.#n;
1809
- return this.#n = Li((h) => {
1810
- if (h < l)
1811
- return !0;
1812
- if (!u) {
1813
- u = !0;
1814
- const c = this.#e.v;
1815
- a = o(c, e), typeof i == "function" && (i = i(c, e)), f?.abort();
1816
- }
1817
- const p = h - l;
1818
- return p > /** @type {number} */
1819
- i ? (P(this.#e, e), !1) : (P(this.#e, a(s(p / /** @type {number} */
1820
- i))), !0);
1821
- }), this.#n.promise;
1822
- }
1823
- get current() {
1824
- return g(this.#e);
1825
- }
1826
- get target() {
1827
- return g(this.#t);
1828
- }
1829
- set target(e) {
1830
- this.set(e);
1831
- }
1832
- }
1833
- class st {
1834
- value;
1835
- motion;
1836
- constructor(e, r) {
1837
- this.value = e, this.motion = new Vt(e, r);
1838
- }
1839
- set(e, r) {
1840
- this.value = e, this.motion.set(e, r);
1841
- }
1842
- update(e) {
1843
- this.motion.set(this.value, e);
1844
- }
1845
- snap() {
1846
- this.motion.set(this.value, { duration: 0 });
1847
- }
1848
- }
1849
- var Ui = /* @__PURE__ */ Gr("<div></div>");
1850
- function Zi(t, e) {
1851
- zt(e, !0);
1852
- let r = e.style.width, n = e.style.height, i = e.style.radius, s = e.colors?.background ?? "darkgreen", o = e.colors?.border ?? "white", l = e.colors?.shadow ?? "0px 2px 2px rgba(0, 0, 0, 0.5)", a;
1853
- function u() {
1854
- return a;
1855
- }
1856
- let f = /* @__PURE__ */ C(!1);
1857
- function h(E) {
1858
- P(f, E, !0);
1859
- }
1860
- function p() {
1861
- return g(f);
1862
- }
1863
- let c = /* @__PURE__ */ C(!0), d = 0, w = 150;
1864
- function O(E) {
1865
- E != g(c) && (P(c, E, !0), d = performance.now());
1866
- }
1867
- function K() {
1868
- return performance.now() - d < w ? V.motion.current == 0 : V.value == 0;
1869
- }
1870
- let b = 0, V = new st(0, { easing: Ct });
1871
- J(() => {
1872
- g(f) == !1 && (V.snap(), ae.clear(e.priority, e.id));
1873
- }), J(() => {
1874
- V.set(g(c) ? 0 : b, { duration: 75 });
1875
- }), J(() => {
1876
- Qe(V.motion.current);
1877
- });
1878
- function Qe(E) {
1879
- a && ae.equeue(e.layer, e.priority, e.id, () => {
1880
- a.style.scale = E.toString(), a.style.filter = `brightness(${0.25 + 0.75 * E})`;
1881
- });
1882
- }
1883
- function dt(E) {
1884
- E != b && (b = E, V.set(E, { duration: 75 }));
1885
- }
1886
- function vt() {
1887
- return V.value;
1888
- }
1889
- var mt = {
1890
- getBody: u,
1891
- setDisplayed: h,
1892
- getDisplayed: p,
1893
- setCollapsed: O,
1894
- getCollapsed: K,
1895
- setScale: dt,
1896
- getScale: vt
1897
- }, M = Ui();
1898
- let $e;
1899
- return Be(
1900
- M,
1901
- (E) => (
1902
- //#endregion
1903
- a = E
1904
- ),
1905
- () => a
1906
- ), jr(
1907
- (E) => {
1908
- $r(M, 1, Qr(["pin", g(f) && "displayed"]), "svelte-zz3jrb"), $e = ze(M, "", $e, E);
1909
- },
1910
- [
1911
- () => ({
1912
- width: `${r}px`,
1913
- height: `${n}px`,
1914
- "border-radius": `${i}px`,
1915
- "border-color": o,
1916
- "background-color": s,
1917
- "box-shadow": l
1918
- })
1919
- ]
1920
- ), Kr(t, M), Bt(mt);
1921
- }
1922
- class Je {
1923
- provider;
1924
- providerMarker;
1925
- id;
1926
- lat;
1927
- lng;
1928
- shown;
1929
- element;
1930
- component;
1931
- constructor(e, r) {
1932
- if (new.target === Je)
1933
- throw new Error("Cannot instantiate an abstract class directly.");
1934
- this.provider = e, this.id = r.id, this.lat = r.lat, this.lng = r.lng, this.shown = !0;
1935
- }
1936
- create() {
1937
- this.createElement(), this.createMarker(), this.setZIndex();
1938
- }
1939
- remove() {
1940
- this.removeMarker();
1941
- }
1942
- createElement() {
1943
- throw new Error("Create element not implemented");
1944
- }
1945
- createMarker() {
1946
- const e = this.element;
1947
- if (!e) throw new Error("Failed to create provider marker");
1948
- this.providerMarker = this.provider.createMarker(e, this.lat, this.lng, this.getZindex());
1949
- }
1950
- updateMarker(e) {
1951
- if (this.providerMarker == null) throw new Error("Failed to update provider marker map");
1952
- e ? this.providerMarker.inserted() == !1 && this.providerMarker.insert() : this.providerMarker.inserted() == !0 && this.providerMarker.remove();
1953
- }
1954
- removeMarker() {
1955
- this.providerMarker?.remove();
1956
- }
1957
- setZIndex() {
1958
- if (this.providerMarker == null) throw new Error("Failed to update provider marker z-index");
1959
- this.providerMarker.update(this.getZindex());
1960
- }
1961
- getZindex() {
1962
- throw new Error("Get z-index not implemented");
1963
- }
1964
- }
1965
- var bt;
1966
- // @__NO_SIDE_EFFECTS__
1967
- function tn(t) {
1968
- return {
1969
- lang: t?.lang ?? bt?.lang,
1970
- message: t?.message,
1971
- abortEarly: t?.abortEarly ?? bt?.abortEarly,
1972
- abortPipeEarly: t?.abortPipeEarly ?? bt?.abortPipeEarly
1973
- };
1974
- }
1975
- var qi;
1976
- // @__NO_SIDE_EFFECTS__
1977
- function Hi(t) {
1978
- return qi?.get(t);
1979
- }
1980
- var Yi;
1981
- // @__NO_SIDE_EFFECTS__
1982
- function Vi(t) {
1983
- return Yi?.get(t);
1984
- }
1985
- var Xi;
1986
- // @__NO_SIDE_EFFECTS__
1987
- function Wi(t, e) {
1988
- return Xi?.get(t)?.get(e);
1989
- }
1990
- // @__NO_SIDE_EFFECTS__
1991
- function Ke(t) {
1992
- const e = typeof t;
1993
- return e === "string" ? `"${t}"` : e === "number" || e === "bigint" || e === "boolean" ? `${t}` : e === "object" || e === "function" ? (t && Object.getPrototypeOf(t)?.constructor?.name) ?? "null" : e;
1994
- }
1995
- function S(t, e, r, n, i) {
1996
- const s = i && "input" in i ? i.input : r.value, o = i?.expected ?? t.expects ?? null, l = i?.received ?? /* @__PURE__ */ Ke(s), a = {
1997
- kind: t.kind,
1998
- type: t.type,
1999
- input: s,
2000
- expected: o,
2001
- received: l,
2002
- message: `Invalid ${e}: ${o ? `Expected ${o} but r` : "R"}eceived ${l}`,
2003
- requirement: t.requirement,
2004
- path: i?.path,
2005
- issues: i?.issues,
2006
- lang: n.lang,
2007
- abortEarly: n.abortEarly,
2008
- abortPipeEarly: n.abortPipeEarly
2009
- }, u = t.kind === "schema", f = i?.message ?? t.message ?? /* @__PURE__ */ Wi(t.reference, a.lang) ?? (u ? /* @__PURE__ */ Vi(a.lang) : null) ?? n.message ?? /* @__PURE__ */ Hi(a.lang);
2010
- f !== void 0 && (a.message = typeof f == "function" ? (
2011
- // @ts-expect-error
2012
- f(a)
2013
- ) : f), u && (r.typed = !1), r.issues ? r.issues.push(a) : r.issues = [a];
2014
- }
2015
- // @__NO_SIDE_EFFECTS__
2016
- function N(t) {
2017
- return {
2018
- version: 1,
2019
- vendor: "valibot",
2020
- validate(e) {
2021
- return t["~run"]({ value: e }, /* @__PURE__ */ tn());
2022
- }
2023
- };
2024
- }
2025
- var ht = class extends Error {
2026
- /**
2027
- * Creates a Valibot error with useful information.
2028
- *
2029
- * @param issues The error issues.
2030
- */
2031
- constructor(t) {
2032
- super(t[0].message), this.name = "ValiError", this.issues = t;
2033
- }
2034
- };
2035
- // @__NO_SIDE_EFFECTS__
2036
- function z(t) {
2037
- return {
2038
- kind: "transformation",
2039
- type: "args",
2040
- reference: z,
2041
- async: !1,
2042
- schema: t,
2043
- "~run"(e, r) {
2044
- const n = e.value;
2045
- return e.value = (...i) => {
2046
- const s = this.schema["~run"]({ value: i }, r);
2047
- if (s.issues)
2048
- throw new ht(s.issues);
2049
- return n(...s.value);
2050
- }, e;
2051
- }
2052
- };
2053
- }
2054
- // @__NO_SIDE_EFFECTS__
2055
- function rn() {
2056
- return {
2057
- kind: "transformation",
2058
- type: "await",
2059
- reference: rn,
2060
- async: !0,
2061
- async "~run"(t) {
2062
- return t.value = await t.value, t;
2063
- }
2064
- };
2065
- }
2066
- // @__NO_SIDE_EFFECTS__
2067
- function nn(t, e) {
2068
- return {
2069
- kind: "validation",
2070
- type: "check",
2071
- reference: nn,
2072
- async: !1,
2073
- expects: null,
2074
- requirement: t,
2075
- message: e,
2076
- "~run"(r, n) {
2077
- return r.typed && !this.requirement(r.value) && S(this, "input", r, n), r;
2078
- }
2079
- };
2080
- }
2081
- // @__NO_SIDE_EFFECTS__
2082
- function sn(t, e) {
2083
- return {
2084
- kind: "validation",
2085
- type: "length",
2086
- reference: sn,
2087
- async: !1,
2088
- expects: `${t}`,
2089
- requirement: t,
2090
- message: e,
2091
- "~run"(r, n) {
2092
- return r.typed && r.value.length !== this.requirement && S(this, "length", r, n, {
2093
- received: `${r.value.length}`
2094
- }), r;
2095
- }
2096
- };
2097
- }
2098
- // @__NO_SIDE_EFFECTS__
2099
- function Le(t, e) {
2100
- return {
2101
- kind: "validation",
2102
- type: "max_value",
2103
- reference: Le,
2104
- async: !1,
2105
- expects: `<=${t instanceof Date ? t.toJSON() : /* @__PURE__ */ Ke(t)}`,
2106
- requirement: t,
2107
- message: e,
2108
- "~run"(r, n) {
2109
- return r.typed && !(r.value <= this.requirement) && S(this, "value", r, n, {
2110
- received: r.value instanceof Date ? r.value.toJSON() : /* @__PURE__ */ Ke(r.value)
2111
- }), r;
2112
- }
2113
- };
2114
- }
2115
- // @__NO_SIDE_EFFECTS__
2116
- function Xt(t, e) {
2117
- return {
2118
- kind: "validation",
2119
- type: "min_length",
2120
- reference: Xt,
2121
- async: !1,
2122
- expects: `>=${t}`,
2123
- requirement: t,
2124
- message: e,
2125
- "~run"(r, n) {
2126
- return r.typed && r.value.length < this.requirement && S(this, "length", r, n, {
2127
- received: `${r.value.length}`
2128
- }), r;
2129
- }
2130
- };
2131
- }
2132
- // @__NO_SIDE_EFFECTS__
2133
- function $(t, e) {
2134
- return {
2135
- kind: "validation",
2136
- type: "min_value",
2137
- reference: $,
2138
- async: !1,
2139
- expects: `>=${t instanceof Date ? t.toJSON() : /* @__PURE__ */ Ke(t)}`,
2140
- requirement: t,
2141
- message: e,
2142
- "~run"(r, n) {
2143
- return r.typed && !(r.value >= this.requirement) && S(this, "value", r, n, {
2144
- received: r.value instanceof Date ? r.value.toJSON() : /* @__PURE__ */ Ke(r.value)
2145
- }), r;
2146
- }
2147
- };
2148
- }
2149
- // @__NO_SIDE_EFFECTS__
2150
- function W(t) {
2151
- return {
2152
- kind: "transformation",
2153
- type: "returns",
2154
- reference: W,
2155
- async: !1,
2156
- schema: t,
2157
- "~run"(e, r) {
2158
- const n = e.value;
2159
- return e.value = (...i) => {
2160
- const s = this.schema["~run"](
2161
- { value: n(...i) },
2162
- r
2163
- );
2164
- if (s.issues)
2165
- throw new ht(s.issues);
2166
- return s.value;
2167
- }, e;
2168
- }
2169
- };
2170
- }
2171
- // @__NO_SIDE_EFFECTS__
2172
- function on(t) {
2173
- return {
2174
- kind: "transformation",
2175
- type: "returns",
2176
- reference: on,
2177
- async: !1,
2178
- schema: t,
2179
- "~run"(e, r) {
2180
- const n = e.value;
2181
- return e.value = async (...i) => {
2182
- const s = await this.schema["~run"](
2183
- { value: await n(...i) },
2184
- r
2185
- );
2186
- if (s.issues)
2187
- throw new ht(s.issues);
2188
- return s.value;
2189
- }, e;
2190
- }
2191
- };
2192
- }
2193
- // @__NO_SIDE_EFFECTS__
2194
- function Gi(t, e, r) {
2195
- return typeof t.fallback == "function" ? (
2196
- // @ts-expect-error
2197
- t.fallback(e, r)
2198
- ) : (
2199
- // @ts-expect-error
2200
- t.fallback
2201
- );
2202
- }
2203
- // @__NO_SIDE_EFFECTS__
2204
- function an(t, e, r) {
2205
- return typeof t.default == "function" ? (
2206
- // @ts-expect-error
2207
- t.default(e, r)
2208
- ) : (
2209
- // @ts-expect-error
2210
- t.default
2211
- );
2212
- }
2213
- // @__NO_SIDE_EFFECTS__
2214
- function ln(t, e) {
2215
- return {
2216
- kind: "schema",
2217
- type: "array",
2218
- reference: ln,
2219
- expects: "Array",
2220
- async: !1,
2221
- item: t,
2222
- message: e,
2223
- get "~standard"() {
2224
- return /* @__PURE__ */ N(this);
2225
- },
2226
- "~run"(r, n) {
2227
- const i = r.value;
2228
- if (Array.isArray(i)) {
2229
- r.typed = !0, r.value = [];
2230
- for (let s = 0; s < i.length; s++) {
2231
- const o = i[s], l = this.item["~run"]({ value: o }, n);
2232
- if (l.issues) {
2233
- const a = {
2234
- type: "array",
2235
- origin: "value",
2236
- input: i,
2237
- key: s,
2238
- value: o
2239
- };
2240
- for (const u of l.issues)
2241
- u.path ? u.path.unshift(a) : u.path = [a], r.issues?.push(u);
2242
- if (r.issues || (r.issues = l.issues), n.abortEarly) {
2243
- r.typed = !1;
2244
- break;
2245
- }
2246
- }
2247
- l.typed || (r.typed = !1), r.value.push(l.value);
2248
- }
2249
- } else
2250
- S(this, "type", r, n);
2251
- return r;
2252
- }
2253
- };
2254
- }
2255
- // @__NO_SIDE_EFFECTS__
2256
- function un(t) {
2257
- return {
2258
- kind: "schema",
2259
- type: "boolean",
2260
- reference: un,
2261
- expects: "boolean",
2262
- async: !1,
2263
- message: t,
2264
- get "~standard"() {
2265
- return /* @__PURE__ */ N(this);
2266
- },
2267
- "~run"(e, r) {
2268
- return typeof e.value == "boolean" ? e.typed = !0 : S(this, "type", e, r), e;
2269
- }
2270
- };
2271
- }
2272
- // @__NO_SIDE_EFFECTS__
2273
- function fn(t, e) {
2274
- return {
2275
- kind: "schema",
2276
- type: "custom",
2277
- reference: fn,
2278
- expects: "unknown",
2279
- async: !1,
2280
- check: t,
2281
- message: e,
2282
- get "~standard"() {
2283
- return /* @__PURE__ */ N(this);
2284
- },
2285
- "~run"(r, n) {
2286
- return this.check(r.value) ? r.typed = !0 : S(this, "type", r, n), r;
2287
- }
2288
- };
2289
- }
2290
- // @__NO_SIDE_EFFECTS__
2291
- function B(t) {
2292
- return {
2293
- kind: "schema",
2294
- type: "function",
2295
- reference: B,
2296
- expects: "Function",
2297
- async: !1,
2298
- message: t,
2299
- get "~standard"() {
2300
- return /* @__PURE__ */ N(this);
2301
- },
2302
- "~run"(e, r) {
2303
- return typeof e.value == "function" ? e.typed = !0 : S(this, "type", e, r), e;
2304
- }
2305
- };
2306
- }
2307
- // @__NO_SIDE_EFFECTS__
2308
- function k(t) {
2309
- return {
2310
- kind: "schema",
2311
- type: "number",
2312
- reference: k,
2313
- expects: "number",
2314
- async: !1,
2315
- message: t,
2316
- get "~standard"() {
2317
- return /* @__PURE__ */ N(this);
2318
- },
2319
- "~run"(e, r) {
2320
- return typeof e.value == "number" && !isNaN(e.value) ? e.typed = !0 : S(this, "type", e, r), e;
2321
- }
2322
- };
2323
- }
2324
- // @__NO_SIDE_EFFECTS__
2325
- function L(t, e) {
2326
- return {
2327
- kind: "schema",
2328
- type: "object",
2329
- reference: L,
2330
- expects: "Object",
2331
- async: !1,
2332
- entries: t,
2333
- message: e,
2334
- get "~standard"() {
2335
- return /* @__PURE__ */ N(this);
2336
- },
2337
- "~run"(r, n) {
2338
- const i = r.value;
2339
- if (i && typeof i == "object") {
2340
- r.typed = !0, r.value = {};
2341
- for (const s in this.entries) {
2342
- const o = this.entries[s];
2343
- if (s in i || (o.type === "exact_optional" || o.type === "optional" || o.type === "nullish") && // @ts-expect-error
2344
- o.default !== void 0) {
2345
- const l = s in i ? (
2346
- // @ts-expect-error
2347
- i[s]
2348
- ) : /* @__PURE__ */ an(o), a = o["~run"]({ value: l }, n);
2349
- if (a.issues) {
2350
- const u = {
2351
- type: "object",
2352
- origin: "value",
2353
- input: i,
2354
- key: s,
2355
- value: l
2356
- };
2357
- for (const f of a.issues)
2358
- f.path ? f.path.unshift(u) : f.path = [u], r.issues?.push(f);
2359
- if (r.issues || (r.issues = a.issues), n.abortEarly) {
2360
- r.typed = !1;
2361
- break;
2362
- }
2363
- }
2364
- a.typed || (r.typed = !1), r.value[s] = a.value;
2365
- } else if (o.fallback !== void 0)
2366
- r.value[s] = /* @__PURE__ */ Gi(o);
2367
- else if (o.type !== "exact_optional" && o.type !== "optional" && o.type !== "nullish" && (S(this, "key", r, n, {
2368
- input: void 0,
2369
- expected: `"${s}"`,
2370
- path: [
2371
- {
2372
- type: "object",
2373
- origin: "key",
2374
- input: i,
2375
- key: s,
2376
- // @ts-expect-error
2377
- value: i[s]
2378
- }
2379
- ]
2380
- }), n.abortEarly))
2381
- break;
2382
- }
2383
- } else
2384
- S(this, "type", r, n);
2385
- return r;
2386
- }
2387
- };
2388
- }
2389
- // @__NO_SIDE_EFFECTS__
2390
- function U(t, e) {
2391
- return {
2392
- kind: "schema",
2393
- type: "optional",
2394
- reference: U,
2395
- expects: `(${t.expects} | undefined)`,
2396
- async: !1,
2397
- wrapped: t,
2398
- default: e,
2399
- get "~standard"() {
2400
- return /* @__PURE__ */ N(this);
2401
- },
2402
- "~run"(r, n) {
2403
- return r.value === void 0 && (this.default !== void 0 && (r.value = /* @__PURE__ */ an(this, r, n)), r.value === void 0) ? (r.typed = !0, r) : this.wrapped["~run"](r, n);
2404
- }
2405
- };
2406
- }
2407
- // @__NO_SIDE_EFFECTS__
2408
- function cn(t) {
2409
- return {
2410
- kind: "schema",
2411
- type: "promise",
2412
- reference: cn,
2413
- expects: "Promise",
2414
- async: !1,
2415
- message: t,
2416
- get "~standard"() {
2417
- return /* @__PURE__ */ N(this);
2418
- },
2419
- "~run"(e, r) {
2420
- return e.value instanceof Promise ? e.typed = !0 : S(this, "type", e, r), e;
2421
- }
2422
- };
2423
- }
2424
- // @__NO_SIDE_EFFECTS__
2425
- function te(t) {
2426
- return {
2427
- kind: "schema",
2428
- type: "string",
2429
- reference: te,
2430
- expects: "string",
2431
- async: !1,
2432
- message: t,
2433
- get "~standard"() {
2434
- return /* @__PURE__ */ N(this);
2435
- },
2436
- "~run"(e, r) {
2437
- return typeof e.value == "string" ? e.typed = !0 : S(this, "type", e, r), e;
2438
- }
2439
- };
2440
- }
2441
- // @__NO_SIDE_EFFECTS__
2442
- function Z(t, e) {
2443
- return {
2444
- kind: "schema",
2445
- type: "tuple",
2446
- reference: Z,
2447
- expects: "Array",
2448
- async: !1,
2449
- items: t,
2450
- message: e,
2451
- get "~standard"() {
2452
- return /* @__PURE__ */ N(this);
2453
- },
2454
- "~run"(r, n) {
2455
- const i = r.value;
2456
- if (Array.isArray(i)) {
2457
- r.typed = !0, r.value = [];
2458
- for (let s = 0; s < this.items.length; s++) {
2459
- const o = i[s], l = this.items[s]["~run"]({ value: o }, n);
2460
- if (l.issues) {
2461
- const a = {
2462
- type: "array",
2463
- origin: "value",
2464
- input: i,
2465
- key: s,
2466
- value: o
2467
- };
2468
- for (const u of l.issues)
2469
- u.path ? u.path.unshift(a) : u.path = [a], r.issues?.push(u);
2470
- if (r.issues || (r.issues = l.issues), n.abortEarly) {
2471
- r.typed = !1;
2472
- break;
2473
- }
2474
- }
2475
- l.typed || (r.typed = !1), r.value.push(l.value);
2476
- }
2477
- } else
2478
- S(this, "type", r, n);
2479
- return r;
2480
- }
2481
- };
2482
- }
2483
- // @__NO_SIDE_EFFECTS__
2484
- function qe(t) {
2485
- return {
2486
- kind: "schema",
2487
- type: "void",
2488
- reference: qe,
2489
- expects: "void",
2490
- async: !1,
2491
- message: t,
2492
- get "~standard"() {
2493
- return /* @__PURE__ */ N(this);
2494
- },
2495
- "~run"(e, r) {
2496
- return e.value === void 0 ? e.typed = !0 : S(this, "type", e, r), e;
2497
- }
2498
- };
2499
- }
2500
- function rt(t, e, r) {
2501
- const n = t["~run"]({ value: e }, /* @__PURE__ */ tn(r));
2502
- if (n.issues)
2503
- throw new ht(n.issues);
2504
- return n.value;
2505
- }
2506
- // @__NO_SIDE_EFFECTS__
2507
- function _(...t) {
2508
- return {
2509
- ...t[0],
2510
- pipe: t,
2511
- get "~standard"() {
2512
- return /* @__PURE__ */ N(this);
2513
- },
2514
- "~run"(e, r) {
2515
- for (const n of t)
2516
- if (n.kind !== "metadata") {
2517
- if (e.issues && (n.kind === "schema" || n.kind === "transformation")) {
2518
- e.typed = !1;
2519
- break;
2520
- }
2521
- (!e.issues || !r.abortEarly && !r.abortPipeEarly) && (e = n["~run"](e, r));
2522
- }
2523
- return e;
2524
- }
2525
- };
2526
- }
2527
- // @__NO_SIDE_EFFECTS__
2528
- function Ki(...t) {
2529
- return {
2530
- ...t[0],
2531
- pipe: t,
2532
- async: !0,
2533
- get "~standard"() {
2534
- return /* @__PURE__ */ N(this);
2535
- },
2536
- async "~run"(e, r) {
2537
- for (const n of t)
2538
- if (n.kind !== "metadata") {
2539
- if (e.issues && (n.kind === "schema" || n.kind === "transformation")) {
2540
- e.typed = !1;
2541
- break;
2542
- }
2543
- (!e.issues || !r.abortEarly && !r.abortPipeEarly) && (e = await n["~run"](e, r));
2544
- }
2545
- return e;
2546
- }
2547
- };
2548
- }
2549
- const Lt = /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(-90), /* @__PURE__ */ Le(90)), It = /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(-180), /* @__PURE__ */ Le(180)), Ji = /* @__PURE__ */ L({
2550
- sw: /* @__PURE__ */ L({ lat: Lt, lng: It }),
2551
- ne: /* @__PURE__ */ L({ lat: Lt, lng: It })
2552
- }), Dt = /* @__PURE__ */ fn((t) => t instanceof HTMLElement, "Must be an HTMLElement"), Qi = /* @__PURE__ */ L({
2553
- mapSize: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(1)),
2554
- zoomMin: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(0)),
2555
- zoomMax: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(0)),
2556
- zoomScale: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(1), /* @__PURE__ */ Le(10))
2557
- }), $i = /* @__PURE__ */ L({
2558
- inserted: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ un())),
2559
- insert: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ qe())),
2560
- remove: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ qe())),
2561
- update: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([/* @__PURE__ */ k()])), /* @__PURE__ */ W(/* @__PURE__ */ qe()))
2562
- }), es = /* @__PURE__ */ L({
2563
- getParameters: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(Qi)),
2564
- getContainer: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(Dt)),
2565
- getZoom: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(/* @__PURE__ */ k())),
2566
- getBounds: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([])), /* @__PURE__ */ W(Ji)),
2567
- panBy: /* @__PURE__ */ _(/* @__PURE__ */ B(), /* @__PURE__ */ z(/* @__PURE__ */ Z([/* @__PURE__ */ k(), /* @__PURE__ */ k()])), /* @__PURE__ */ W(/* @__PURE__ */ qe())),
2568
- createMarker: /* @__PURE__ */ _(
2569
- /* @__PURE__ */ B(),
2570
- /* @__PURE__ */ z(/* @__PURE__ */ Z([Dt, Lt, It, /* @__PURE__ */ k()])),
2571
- /* @__PURE__ */ W($i)
2572
- )
2573
- }), Mt = /* @__PURE__ */ _(
2574
- /* @__PURE__ */ B(),
2575
- /* @__PURE__ */ z(/* @__PURE__ */ Z([/* @__PURE__ */ te()])),
2576
- /* @__PURE__ */ on(/* @__PURE__ */ Ki(/* @__PURE__ */ cn(), /* @__PURE__ */ rn(), Dt))
2577
- ), ts = /* @__PURE__ */ L({
2578
- background: /* @__PURE__ */ U(/* @__PURE__ */ te()),
2579
- border: /* @__PURE__ */ U(/* @__PURE__ */ te()),
2580
- shadow: /* @__PURE__ */ U(/* @__PURE__ */ te())
2581
- }), rs = /* @__PURE__ */ L({
2582
- width: /* @__PURE__ */ k(),
2583
- height: /* @__PURE__ */ k(),
2584
- radius: /* @__PURE__ */ k()
2585
- }), gr = /* @__PURE__ */ L({
2586
- background: /* @__PURE__ */ U(/* @__PURE__ */ te()),
2587
- shadow: /* @__PURE__ */ U(/* @__PURE__ */ te())
2588
- }), _r = /* @__PURE__ */ _(
2589
- /* @__PURE__ */ L({
2590
- width: /* @__PURE__ */ k(),
2591
- height: /* @__PURE__ */ k(),
2592
- margin: /* @__PURE__ */ k(),
2593
- radius: /* @__PURE__ */ k()
2594
- }),
2595
- /* @__PURE__ */ nn(
2596
- (t) => Math.min(t.width, t.height) / t.margin >= 6,
2597
- "Minimum of width or height must be greater than or equal to 6 * margin"
2598
- )
2599
- ), ns = /* @__PURE__ */ L({
2600
- id: /* @__PURE__ */ _(/* @__PURE__ */ te(), /* @__PURE__ */ Xt(1)),
2601
- rank: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(0)),
2602
- lat: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(-90), /* @__PURE__ */ Le(90)),
2603
- lng: /* @__PURE__ */ _(/* @__PURE__ */ k(), /* @__PURE__ */ $(-180), /* @__PURE__ */ Le(180)),
2604
- tooltip: /* @__PURE__ */ L({
2605
- body: Mt,
2606
- style: _r,
2607
- colors: /* @__PURE__ */ U(gr)
2608
- }),
2609
- pin: /* @__PURE__ */ U(
2610
- /* @__PURE__ */ L({
2611
- body: Mt,
2612
- style: /* @__PURE__ */ U(rs),
2613
- colors: /* @__PURE__ */ U(ts)
2614
- })
2615
- ),
2616
- popup: /* @__PURE__ */ U(
2617
- /* @__PURE__ */ L({
2618
- body: Mt,
2619
- style: _r,
2620
- colors: /* @__PURE__ */ U(gr)
2621
- })
2622
- )
2623
- }), is = /* @__PURE__ */ ln(ns);
2624
- class He extends Je {
2625
- static DEFAULT_SIZE = 16;
2626
- style;
2627
- colors;
2628
- zoom;
2629
- bodyLoading = !1;
2630
- bodyLoaded = !1;
2631
- bodyCallback;
2632
- constructor(e, r, n) {
2633
- super(e, r), this.style = r.pin?.style ?? { width: He.DEFAULT_SIZE, height: He.DEFAULT_SIZE, radius: He.DEFAULT_SIZE }, this.colors = r.pin?.colors, this.zoom = n, this.bodyCallback = r.pin?.body;
2634
- }
2635
- createElement() {
2636
- this.element = document.createElement("div"), this.element.classList.add("pin"), this.component = Yt(Zi, {
2637
- target: this.element,
2638
- props: {
2639
- id: this.id + "_pin",
2640
- layer: zi,
2641
- priority: this.zoom * this.provider.getParameters().zoomScale,
2642
- style: this.style,
2643
- colors: this.colors
2644
- }
2645
- });
2646
- }
2647
- update(e) {
2648
- this.zoom = e[0], this.setZIndex();
2649
- }
2650
- updateMarker(e) {
2651
- super.updateMarker(e), this.component?.setDisplayed(e);
2652
- }
2653
- updateBody() {
2654
- if (this.bodyCallback == null || this.bodyLoaded || this.bodyLoading) return;
2655
- const e = this.component?.getBody();
2656
- e != null && (this.bodyLoading = !0, this.bodyCallback(this.id).then((r) => {
2657
- r instanceof HTMLElement ? e.appendChild(r) : console.error("Failed to load pin body");
2658
- }).catch((r) => console.error(r)).finally(() => {
2659
- this.bodyLoaded = !0, this.bodyLoading = !1;
2660
- }));
2661
- }
2662
- setCollapsed(e) {
2663
- if (this.component == null) throw new Error("Failed to set pin collapsed");
2664
- this.component.setCollapsed(e);
2665
- }
2666
- setScale(e) {
2667
- if (this.component == null) throw new Error("Failed to set pin scale");
2668
- this.component.setScale(e);
2669
- }
2670
- getScaleFromZoomDistance(e) {
2671
- return this.zoom < e ? 1 : Math.max(0, 1 - (this.zoom - e) * 0.125);
2672
- }
2673
- getZindex() {
2674
- const e = this.provider.getParameters();
2675
- return Math.round((e.zoomMax - this.zoom) * e.zoomScale);
2676
- }
2677
- isCollapsed() {
2678
- return this.component == null ? !1 : this.component.getCollapsed();
2679
- }
2680
- isBodyLoaded() {
2681
- return this.bodyCallback == null || this.bodyLoaded;
2682
- }
2683
- }
2684
- var Ye;
2685
- ((t) => {
2686
- function e(r, n, i) {
2687
- const s = r / 2, o = n / 2, l = Math.sqrt(s * s + o * o), a = Math.atan(o / s) * (180 / Math.PI), u = i * (Math.PI / 180);
2688
- return i < 180 ? i < 90 ? i < a ? {
2689
- x: 0,
2690
- y: l * Math.sin(u) - o
2691
- } : {
2692
- x: l * Math.cos(u) - s,
2693
- y: 0
2694
- } : i < 180 - a ? {
2695
- x: l * Math.cos(u) - s,
2696
- y: 0
2697
- } : {
2698
- x: -r,
2699
- y: l * Math.sin(u) - o
2700
- } : i < 270 ? i < 180 + a ? {
2701
- x: -r,
2702
- y: l * Math.sin(u) - o
2703
- } : {
2704
- x: l * Math.cos(u) - s,
2705
- y: -n
2706
- } : i < 360 - a ? {
2707
- x: l * Math.cos(u) - s,
2708
- y: -n
2709
- } : {
2710
- x: 0,
2711
- y: l * Math.sin(u) - o
2712
- };
2713
- }
2714
- t.getOffsets = e;
2715
- })(Ye || (Ye = {}));
2716
- var ss = /* @__PURE__ */ Gr('<div><div class="pointer svelte-11extwn"></div> <div class="bubble svelte-11extwn"><div class="body svelte-11extwn"></div></div></div>');
2717
- function pn(t, e) {
2718
- zt(e, !0);
2719
- let r = e.style.width, n = e.style.height, i = e.style.margin, s = e.style.radius, o = e.colors?.background ?? "white", l = e.colors?.shadow ?? "0px 2px 2px rgba(0, 0, 0, 0.5)", a, u, f, h;
2720
- const p = r + 2 * i, c = n + 2 * i, d = () => h;
2721
- J(() => {
2722
- f.style.width = `${i * 4}px`, f.style.height = `${i * 4}px`;
2723
- });
2724
- let w = /* @__PURE__ */ C(!0);
2725
- function O(y) {
2726
- P(w, y, !0);
2727
- }
2728
- function K() {
2729
- return g(w);
2730
- }
2731
- let b = /* @__PURE__ */ C(!0), V = 0, Qe = 300;
2732
- function dt(y) {
2733
- y != g(b) && (P(b, y, !0), V = performance.now());
2734
- }
2735
- function vt() {
2736
- return performance.now() - V < Qe ? M.motion.current == 0 : M.value == 0;
2737
- }
2738
- function mt() {
2739
- return performance.now() - V < Qe ? M.motion.current == 1 : M.value == 1;
2740
- }
2741
- let M = new st(0);
2742
- J(() => {
2743
- g(w) == !1 && (M.snap(), ae.clear(e.priority, e.id + "_scale"));
2744
- }), J(() => {
2745
- g(b) == !0 && M.value != 0 && (ae.stacked() ? M.set(0, { duration: 0 }) : M.set(0, { duration: 150, easing: Oi })), g(b) == !1 && M.value != 1 && M.set(1, { duration: 150, easing: Fi });
2746
- }), J(() => {
2747
- $e(M.motion.current);
2748
- });
2749
- function $e(y) {
2750
- !a || !u || !f || ae.equeue(g(b) ? 0 : e.layer, e.priority, e.id + "_scale", () => {
2751
- a.style.opacity = `${y}`, u.style.scale = `${y}`, f.style.scale = `${y}`;
2752
- });
2753
- }
2754
- let E = NaN, yt = /* @__PURE__ */ C(!1), oe = new st(-p / 2, { easing: Ct }), et = new st(-c / 2, { easing: Ct });
2755
- J(() => {
2756
- g(w) == !1 && (oe.snap(), oe.snap(), ae.clear(e.priority, e.id + "_angle"));
2757
- }), J(() => {
2758
- g(b) == !0 && g(yt) && (oe.update({ duration: 75 }), oe.update({ duration: 75 }));
2759
- }), J(() => {
2760
- Jt(oe.motion.current, et.motion.current);
2761
- });
2762
- function Jt(y, _e) {
2763
- if (!a || !u || !f) return;
2764
- const X = y + p / 2, we = _e + c / 2, Ee = c < p ? X * c / p : X, ke = c > p ? we * p / c : we, gn = Math.atan2(ke, Ee) / Math.PI * 180 - 45, nr = 0, _n = 30, wt = Math.sqrt(Ee * Ee + ke * ke), Ne = Math.min(p, c) / 2, wn = Ne * Math.SQRT2, En = (wt - Ne) / (wn - Ne), ir = nr + En * (_n - nr), kn = wt < Ne ? wt / Ne : 1;
2765
- ae.equeue(e.layer, e.priority, e.id + "_angle", () => {
2766
- u.style.transform = `translate(${Math.round(y)}px, ${Math.round(_e)}px)`, f.style.transform = `scale(${kn}) rotate(${gn}deg) skew(${ir}deg, ${ir}deg)`;
2767
- });
2768
- }
2769
- function vn(y, _e) {
2770
- if (g(yt) == !1 || _e == !0) {
2771
- let X = Ye.getOffsets(p, c, y);
2772
- oe.set(Math.round(X.x), { duration: 0 }), et.set(Math.round(X.y), { duration: 0 }), Jt(oe.value, et.value), E = y, P(yt, !0);
2773
- } else if (y != E) {
2774
- let X = Math.abs(y - E), we = X < 180 ? X : 360 - X, Ee = Math.log(we) * 75, ke = Ye.getOffsets(p, c, y);
2775
- oe.set(Math.round(ke.x), { duration: Ee }), et.set(Math.round(ke.y), { duration: Ee }), E = y;
2776
- }
2777
- }
2778
- function mn() {
2779
- return Ye.getOffsets(p, c, E);
2780
- }
2781
- var yn = {
2782
- getBody: d,
2783
- setDisplayed: O,
2784
- getDisplayed: K,
2785
- setCollapsed: dt,
2786
- getCollapsed: vt,
2787
- getExpanded: mt,
2788
- setAngle: vn,
2789
- getOffsets: mn
2790
- }, Re = ss();
2791
- let Qt;
2792
- var gt = ur(Re);
2793
- let $t;
2794
- Be(
2795
- gt,
2796
- (y) => (
2797
- //#endregion
2798
- f = y
2799
- ),
2800
- () => f
2801
- );
2802
- var _t = si(gt, 2);
2803
- let er;
2804
- var tr = ur(_t);
2805
- let rr;
2806
- return Be(tr, (y) => h = y, () => h), Be(_t, (y) => u = y, () => u), Be(Re, (y) => a = y, () => a), jr(
2807
- (y, _e, X, we) => {
2808
- $r(Re, 1, Qr(["anchor", g(w) && "displayed"]), "svelte-11extwn"), Qt = ze(Re, "", Qt, y), $t = ze(gt, "", $t, _e), er = ze(_t, "", er, X), rr = ze(tr, "", rr, we);
2809
- },
2810
- [
2811
- () => ({ filter: `drop-shadow(${l})` }),
2812
- () => ({ "background-color": o }),
2813
- () => ({ margin: `${i}px;` }),
2814
- () => ({
2815
- width: `${r}px`,
2816
- height: `${n}px`,
2817
- "border-radius": `${s}px;`,
2818
- "background-color": o
2819
- })
2820
- ]
2821
- ), Kr(t, Re), Bt(yn);
2822
- }
2823
- class Wt extends Je {
2824
- static Z_INDEX_OFFSET = 2e6;
2825
- style;
2826
- colors;
2827
- bodyLoading = !1;
2828
- bodyLoaded = !1;
2829
- bodyCallback;
2830
- constructor(e, r) {
2831
- if (r.popup == null) throw new Error("Failed to create popup");
2832
- super(e, r), this.shown = !1, this.style = r.popup.style, this.colors = r.popup.colors, this.bodyCallback = r.popup.body;
2833
- }
2834
- createElement() {
2835
- this.element = document.createElement("div"), this.element.classList.add("popup"), this.component = Yt(pn, {
2836
- target: this.element,
2837
- props: {
2838
- id: this.id + "_popup",
2839
- layer: Ni,
2840
- priority: 0,
2841
- style: this.style,
2842
- colors: this.colors
2843
- }
2844
- });
2845
- }
2846
- updateMarker(e) {
2847
- super.updateMarker(e), this.component?.setDisplayed(e);
2848
- }
2849
- updateBody() {
2850
- if (this.bodyLoaded || this.bodyLoading) return;
2851
- const e = this.component?.getBody();
2852
- e != null && (this.bodyLoading = !0, this.bodyCallback(this.id).then((r) => {
2853
- r instanceof HTMLElement ? e.appendChild(r) : console.error("Failed to load popup body");
2854
- }).catch((r) => console.error(r)).finally(() => {
2855
- this.bodyLoaded = !0, this.bodyLoading = !1;
2856
- }));
2857
- }
2858
- getZindex() {
2859
- return Wt.Z_INDEX_OFFSET;
2860
- }
2861
- setCollapsed(e) {
2862
- if (this.component == null) throw new Error("Failed to set popup collapsed");
2863
- this.component.setCollapsed(e);
2864
- }
2865
- setAngle(e) {
2866
- if (this.component == null) throw new Error("Failed to set popup angle");
2867
- this.component.setAngle(e, !0);
2868
- }
2869
- isExpanded() {
2870
- return this.component == null ? !1 : this.component.getExpanded();
2871
- }
2872
- isCollapsed() {
2873
- return this.component == null ? !1 : this.component.getCollapsed();
2874
- }
2875
- isBodyLoaded() {
2876
- return this.bodyLoaded;
2877
- }
2878
- }
2879
- var ye;
2880
- ((t) => {
2881
- t.COUNT = 12, t.DEGREES = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330], t.DEGREES_DEFAULT = 270;
2882
- })(ye || (ye = {}));
2883
- class Gt extends Je {
2884
- static Z_INDEX_OFFSET = 1e6;
2885
- style;
2886
- colors;
2887
- zoom;
2888
- angle;
2889
- states;
2890
- bodyLoading = !1;
2891
- bodyLoaded = !1;
2892
- bodyCallback;
2893
- constructor(e, r, n) {
2894
- super(e, r), this.style = r.tooltip.style, this.colors = r.tooltip.colors, this.zoom = n[0], this.angle = ye.DEGREES_DEFAULT, this.states = n[1].map((i) => [i[0], ye.DEGREES[i[1]]]), this.bodyCallback = r.tooltip.body;
2895
- }
2896
- createElement() {
2897
- this.element = document.createElement("div"), this.element.classList.add("tooltip"), this.component = Yt(pn, {
2898
- target: this.element,
2899
- props: {
2900
- id: this.id + "_tooltip",
2901
- layer: ji,
2902
- priority: this.zoom * this.provider.getParameters().zoomScale,
2903
- style: this.style,
2904
- colors: this.colors
2905
- }
2906
- });
2907
- }
2908
- update(e) {
2909
- this.zoom = e[0], this.states = e[1].map((r) => [r[0], ye.DEGREES[r[1]]]), this.setZIndex();
2910
- }
2911
- updateMarker(e) {
2912
- super.updateMarker(e), this.component?.setDisplayed(e);
2913
- }
2914
- updateState(e) {
2915
- if (this.component == null) throw new Error("Failed to update tooltip state");
2916
- this.angle = this.getAngle(e), this.component.setAngle(this.angle);
2917
- }
2918
- updateBody() {
2919
- if (this.bodyLoaded || this.bodyLoading) return;
2920
- const e = this.component?.getBody();
2921
- e != null && (this.bodyLoading = !0, this.bodyCallback(this.id).then((r) => {
2922
- r instanceof HTMLElement ? e.appendChild(r) : console.error("Failed to load tooltip body");
2923
- }).catch((r) => console.error(r)).finally(() => {
2924
- this.bodyLoaded = !0, this.bodyLoading = !1;
2925
- }));
2926
- }
2927
- getAngle(e) {
2928
- const r = this.states.findLast((n) => n[0] <= e);
2929
- if (!r) throw new Error("Angle not found");
2930
- return r[1];
2931
- }
2932
- getZindex() {
2933
- const e = this.provider.getParameters();
2934
- return Math.round((e.zoomMax - this.zoom) * e.zoomScale) + Gt.Z_INDEX_OFFSET;
2935
- }
2936
- setCollapsed(e) {
2937
- if (this.component == null) throw new Error("Failed to set tooltip collapsed");
2938
- this.component.setCollapsed(e);
2939
- }
2940
- isExpanded() {
2941
- return this.component == null ? !1 : this.component.getExpanded();
2942
- }
2943
- isCollapsed() {
2944
- return this.component == null ? !1 : this.component.getCollapsed();
2945
- }
2946
- isBodyLoaded() {
2947
- return this.bodyLoaded;
2948
- }
2949
- }
2950
- class os {
2951
- marker;
2952
- zoom;
2953
- pin;
2954
- tooltip;
2955
- popup;
2956
- constructor(e, r, n) {
2957
- this.marker = r, this.zoom = n[0], this.pin = new He(e, r, n[0]), this.tooltip = new Gt(e, r, n), this.popup = r.popup ? new Wt(e, r) : void 0;
2958
- }
2959
- create() {
2960
- this.pin.create(), this.tooltip.create(), this.popup?.create();
2961
- }
2962
- update(e) {
2963
- this.pin.update(e), this.tooltip.update(e);
2964
- }
2965
- remove() {
2966
- this.pin.remove(), this.tooltip.remove(), this.popup?.remove();
2967
- }
2968
- }
2969
- var xe;
2970
- ((t) => {
2971
- function e(l, a, u) {
2972
- return {
2973
- x: n(a) * u,
2974
- y: i(l) * u
2975
- };
2976
- }
2977
- t.project = e;
2978
- function r(l, a, u) {
2979
- return {
2980
- lat: o(a / u),
2981
- lng: s(l / u)
2982
- };
2983
- }
2984
- t.unproject = r;
2985
- function n(l) {
2986
- return (180 + l) / 360;
2987
- }
2988
- function i(l) {
2989
- return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + l * Math.PI / 360))) / 360;
2990
- }
2991
- function s(l) {
2992
- return l * 360 - 180;
2993
- }
2994
- function o(l) {
2995
- return 360 / Math.PI * Math.atan(Math.exp((180 - l * 360) * Math.PI / 180)) - 90;
2996
- }
2997
- })(xe || (xe = {}));
2998
- class hn {
2999
- swLat;
3000
- swLng;
3001
- neLat;
3002
- neLng;
3003
- /**
3004
- * @param mapBounds - The bounds of the map.
3005
- * @param mapZoom - The zoom level of the map.
3006
- * @param mapSize - The size of the map in pixels at zoom level 0.
3007
- * @param offsetX - The x offset of the map in pixels at zoom level n.
3008
- * @param offsetY - The y offset of the map in pixels at zoom level n.
3009
- */
3010
- constructor(e, r, n, i, s) {
3011
- const o = n * Math.pow(2, r), l = xe.project(e.sw.lat, e.sw.lng, o), a = xe.project(e.ne.lat, e.ne.lng, o), u = l.x - i, f = l.y + s, h = a.x + i, p = a.y - s, c = xe.unproject(u, f, o), d = xe.unproject(h, p, o);
3012
- this.swLat = c.lat, this.swLng = c.lng, this.neLat = d.lat, this.neLng = d.lng;
3013
- }
3014
- contains(e, r) {
3015
- return this.swLat <= e && e <= this.neLat ? this.swLng < this.neLng ? this.swLng <= r && r <= this.neLng : r <= this.neLng || this.swLng <= r : !1;
3016
- }
3017
- }
3018
- class ut {
3019
- static MAP_PINS_MAX_ZOOM = 2;
3020
- static MAP_PINS_MAX_COUNT = 128;
3021
- provider;
3022
- // Data
3023
- pinElements = new Array();
3024
- // Configuration
3025
- pinMaxWidth = 0;
3026
- pinMaxHeight = 0;
3027
- pinFade = !1;
3028
- pinMaxCount = 0;
3029
- pinMaxZoomDelta = 0;
3030
- constructor(e) {
3031
- this.provider = e;
3032
- }
3033
- setConfiguration(e) {
3034
- this.pinFade = e?.pin?.fade ?? !0, this.pinMaxCount = e?.pin?.maxCount ?? Math.max(ut.MAP_PINS_MAX_COUNT, 8 * navigator.hardwareConcurrency), this.pinMaxZoomDelta = e?.pin?.maxZoom ?? ut.MAP_PINS_MAX_ZOOM;
3035
- }
3036
- updateElements(e) {
3037
- this.pinElements = e, this.pinMaxWidth = e.reduce((r, n) => Math.max(r, n.style.width), 0), this.pinMaxHeight = e.reduce((r, n) => Math.max(r, n.style.height), 0);
3038
- }
3039
- removeElements() {
3040
- this.pinElements.forEach((e) => e.removeMarker()), this.pinElements.length = 0;
3041
- }
3042
- process(e, r) {
3043
- const n = this.provider.getParameters().mapSize, i = new hn(e, r, n, this.pinMaxWidth * 2, this.pinMaxHeight * 2);
3044
- let s = 0;
3045
- for (const o of this.pinElements)
3046
- i.contains(o.lat, o.lng) ? o.shown && r < o.zoom && o.zoom < r + this.pinMaxZoomDelta ? (s < this.pinMaxCount && (o.setCollapsed(!1), o.setScale(this.pinFade ? o.getScaleFromZoomDistance(r) : 1), o.updateMarker(!0), o.isBodyLoaded() == !1 && o.updateBody()), s++) : (o.setCollapsed(!0), o.isCollapsed() && o.updateMarker(!1)) : o.updateMarker(!1);
3047
- }
3048
- }
3049
- class as {
3050
- provider;
3051
- // Data
3052
- tooltipElements = new Array();
3053
- // Configuration
3054
- tooltipMaxWidth = 0;
3055
- tooltipMaxHeight = 0;
3056
- constructor(e) {
3057
- this.provider = e;
3058
- }
3059
- updateElements(e) {
3060
- this.tooltipElements = e, this.tooltipMaxWidth = this.tooltipElements.reduce((r, n) => Math.max(r, n.style.width), 0), this.tooltipMaxHeight = this.tooltipElements.reduce((r, n) => Math.max(r, n.style.height), 0);
3061
- }
3062
- removeElements() {
3063
- this.tooltipElements.forEach((e) => e.removeMarker()), this.tooltipElements.length = 0;
3064
- }
3065
- process(e, r) {
3066
- const n = this.provider.getParameters().mapSize, i = new hn(e, r, n, this.tooltipMaxWidth * 2, this.tooltipMaxHeight * 2);
3067
- for (const s of this.tooltipElements)
3068
- i.contains(s.lat, s.lng) ? s.shown && s.zoom <= r ? (s.updateState(r), s.setCollapsed(!1), s.updateMarker(!0), s.isCollapsed() == !1 && s.isBodyLoaded() == !1 && s.updateBody()) : (s.setCollapsed(!0), s.isCollapsed() && s.updateMarker(!1)) : s.updateMarker(!1);
3069
- }
3070
- }
3071
- class ls {
3072
- provider;
3073
- // Data
3074
- popupElements = new Array();
3075
- popupPositioned = /* @__PURE__ */ new Map();
3076
- constructor(e) {
3077
- this.provider = e;
3078
- }
3079
- show(e) {
3080
- e.popup && (e.pin.shown = !1, e.tooltip.shown = !1, this.popupPositioned.set(e.marker.id, !1), e.popup.setAngle(e.tooltip.angle), e.popup.shown = !0);
3081
- }
3082
- hide(e) {
3083
- e.popup && (e.pin.shown = !0, e.tooltip.shown = !0, e.popup.shown = !1);
3084
- }
3085
- updateElements(e) {
3086
- this.popupElements = e, this.popupPositioned = new Map(e.map((r) => [r.id, !1]));
3087
- }
3088
- removeElements() {
3089
- this.popupElements.forEach((e) => e.removeMarker()), this.popupElements.length = 0, this.popupPositioned.clear();
3090
- }
3091
- process() {
3092
- for (const e of this.popupElements)
3093
- if (e.shown) {
3094
- if (e.setCollapsed(!1), e.updateMarker(!0), e.isExpanded() && e.isBodyLoaded() == !1 && e.updateBody(), e.isCollapsed() == !1 && this.popupPositioned.get(e.id) == !1) {
3095
- const r = e.component?.getBody();
3096
- if (r == null) continue;
3097
- const n = e.component?.getOffsets();
3098
- if (n == null) continue;
3099
- const i = r.getBoundingClientRect();
3100
- if (i.x == 0 && i.y == 0 && i.width == 0 && i.height == 0) continue;
3101
- const s = i.x + i.width / 2, o = i.y + i.height / 2, l = s + n.x, a = o + n.y, u = l + e.style.width, f = a + e.style.height, h = this.provider.getContainer().getBoundingClientRect(), p = l - h.left, c = h.right - u, d = a - h.top, w = h.bottom - f, O = Math.min(e.style.width, e.style.height) / 4, K = p < 0 ? p - O : c < 0 ? -c + O : 0, b = d < 0 ? d - O : w < 0 ? -w + O : 0;
3102
- this.provider.panBy(K, b), this.popupPositioned.set(e.id, !0);
3103
- }
3104
- } else
3105
- e.setCollapsed(!0), e.isCollapsed() && e.updateMarker(!1);
3106
- }
3107
- }
3108
- class us {
3109
- markerPinProcessor;
3110
- markerTooltipProcessor;
3111
- markerPopupProcessor;
3112
- constructor(e) {
3113
- this.markerPinProcessor = new ut(e), this.markerTooltipProcessor = new as(e), this.markerPopupProcessor = new ls(e);
3114
- }
3115
- setConfiguration(e) {
3116
- this.markerPinProcessor.setConfiguration(e);
3117
- }
3118
- updateElements(e) {
3119
- this.markerPinProcessor.updateElements(e.map((r) => r.pin)), this.markerTooltipProcessor.updateElements(e.map((r) => r.tooltip)), this.markerPopupProcessor.updateElements(e.map((r) => r.popup).filter((r) => r != null));
3120
- }
3121
- removeElements() {
3122
- this.markerPinProcessor.removeElements(), this.markerTooltipProcessor.removeElements(), this.markerPopupProcessor.removeElements();
3123
- }
3124
- processElements(e, r) {
3125
- this.markerPinProcessor.process(e, r), this.markerTooltipProcessor.process(e, r), this.markerPopupProcessor.process();
3126
- }
3127
- showPopup(e) {
3128
- this.markerPopupProcessor.show(e);
3129
- }
3130
- hidePopup(e) {
3131
- this.markerPopupProcessor.hide(e);
3132
- }
3133
- }
3134
- var Ve;
3135
- ((t) => {
3136
- async function e(n, i) {
3137
- const s = await fetch(n, i);
3138
- if (!s.ok) throw new Error(s.statusText);
3139
- return s.json();
3140
- }
3141
- t.get = e;
3142
- async function r(n, i, s) {
3143
- const o = await fetch(n, {
3144
- method: "POST",
3145
- body: JSON.stringify(i),
3146
- headers: {
3147
- "Content-Type": "application/json",
3148
- ...s?.headers
3149
- },
3150
- ...s
3151
- });
3152
- if (!o.ok) throw new Error(o.statusText);
3153
- return o.json();
3154
- }
3155
- t.post = r;
3156
- })(Ve || (Ve = {}));
3157
- const fs = /* @__PURE__ */ _(/* @__PURE__ */ te(), /* @__PURE__ */ sn(32)), cs = /* @__PURE__ */ _(/* @__PURE__ */ te(), /* @__PURE__ */ Xt(1)), wr = "1.2.1", Kt = "https://maps.api.arenarium.dev", ps = `${Kt}/auth`, hs = `${Kt}/states`, ds = `${Kt}/log`;
3158
- class dn {
3159
- apiKey;
3160
- apiToken;
3161
- apiDevEnvironment;
3162
- mapProvider;
3163
- mapMarkerProcessor;
3164
- mapMarkerElementArray = new Array();
3165
- mapMarkerElementMap = /* @__PURE__ */ new Map();
3166
- mapMarkerElementsUpdating = !1;
3167
- constructor(e, r, n, i) {
3168
- rt(fs, e), rt(cs, r), rt(es, n), this.apiKey = e, this.apiToken = r, this.apiDevEnvironment = window?.location.host.startsWith("localhost") || window?.location.host.startsWith("127.0.0.1"), this.mapProvider = n, this.mapMarkerProcessor = new us(n), this.setConfiguration(i);
3169
- }
3170
- static async create(e, r, n) {
3171
- const i = { key: e, version: wr };
3172
- let o = (await Ve.post(ps, i)).token;
3173
- if (!o) throw new Error("Failed to get api token");
3174
- return new dn(e, o, r, n);
3175
- }
3176
- setConfiguration(e) {
3177
- ae.setLimit(e?.animation?.queue?.limit ?? 8 * navigator.hardwareConcurrency), this.mapMarkerProcessor.setConfiguration(e);
3178
- }
3179
- async updateMarkers(e) {
3180
- rt(is, e);
3181
- try {
3182
- await this.updateMarkerElements(e), this.processMarkerElementsCallback();
3183
- } catch (r) {
3184
- throw this.removeMarkerElements(), this.log("error", "Failed to update markers", r), r;
3185
- }
3186
- }
3187
- removeMarkers() {
3188
- try {
3189
- this.removeMarkerElements();
3190
- } catch (e) {
3191
- throw this.log("error", "Failed to remove markers", e), e;
3192
- }
3193
- }
3194
- showPopup(e) {
3195
- try {
3196
- for (const r of this.mapMarkerElementArray)
3197
- r.marker.id == e ? this.mapMarkerProcessor.showPopup(r) : this.mapMarkerProcessor.hidePopup(r);
3198
- } catch (r) {
3199
- for (const n of this.mapMarkerElementArray)
3200
- this.mapMarkerProcessor.hidePopup(n);
3201
- throw this.log("error", "Failed to show popup", r), r;
3202
- }
3203
- }
3204
- hidePopup(e) {
3205
- try {
3206
- if (e) {
3207
- const r = this.mapMarkerElementMap.get(e);
3208
- if (r == null) return;
3209
- this.mapMarkerProcessor.hidePopup(r);
3210
- } else
3211
- for (const r of this.mapMarkerElementArray)
3212
- this.mapMarkerProcessor.hidePopup(r);
3213
- } catch (r) {
3214
- for (const n of this.mapMarkerElementArray)
3215
- this.mapMarkerProcessor.hidePopup(n);
3216
- throw this.log("error", "Failed to hide popup", r), r;
3217
- }
3218
- }
3219
- async updateMarkerElements(e) {
3220
- try {
3221
- let r = this.mapMarkerElementArray.map((i) => i.marker);
3222
- for (let i = 0; i < e.length; i++) {
3223
- const s = e[i];
3224
- this.mapMarkerElementMap.get(s.id) || r.push(s);
3225
- }
3226
- const n = await this.getMarkerStates(r);
3227
- try {
3228
- this.mapMarkerElementsUpdating = !0;
3229
- for (let i = 0; i < r.length; i++) {
3230
- const s = r[i], o = n[i], l = this.mapMarkerElementMap.get(s.id);
3231
- if (l)
3232
- l.update(o);
3233
- else {
3234
- const a = new os(this.mapProvider, s, o);
3235
- a.create(), this.mapMarkerElementMap.set(s.id, a), this.mapMarkerElementArray.push(a);
3236
- }
3237
- }
3238
- this.mapMarkerElementArray.sort((i, s) => i.zoom - s.zoom), this.mapMarkerProcessor.updateElements(this.mapMarkerElementArray);
3239
- } finally {
3240
- this.mapMarkerElementsUpdating = !1;
3241
- }
3242
- } catch (r) {
3243
- throw this.mapMarkerProcessor.removeElements(), this.mapMarkerElementArray.length = 0, this.mapMarkerElementMap.clear(), r;
3244
- } finally {
3245
- this.mapMarkerElementsUpdating = !1;
3246
- }
3247
- }
3248
- removeMarkerElements() {
3249
- try {
3250
- this.mapMarkerElementsUpdating = !0, this.mapMarkerProcessor.removeElements(), this.mapMarkerElementArray.length = 0, this.mapMarkerElementMap.clear();
3251
- } finally {
3252
- this.mapMarkerElementsUpdating = !1;
3253
- }
3254
- }
3255
- async getMarkerStates(e) {
3256
- if (e.length == 0) return [];
3257
- if (e.length == 1) return [[0, [[0, ye.DEGREES.indexOf(ye.DEGREES_DEFAULT)]]]];
3258
- const r = e.map((s) => ({
3259
- id: s.id,
3260
- rank: s.rank,
3261
- lat: s.lat,
3262
- lng: s.lng,
3263
- width: s.tooltip.style.width,
3264
- height: s.tooltip.style.height,
3265
- margin: s.tooltip.style.margin
3266
- })), n = {
3267
- key: this.apiKey,
3268
- token: this.apiToken,
3269
- parameters: this.mapProvider.getParameters(),
3270
- input: r
3271
- }, i = await Ve.post(hs, n, {
3272
- headers: { "Cache-Control": this.apiDevEnvironment ? "no-cache" : "" }
3273
- });
3274
- return i.token && (this.apiToken = i.token), i.states;
3275
- }
3276
- processMarkerElementsCallback() {
3277
- if (this.mapProvider.getContainer().parentElement != null && this.mapMarkerElementArray.length != 0)
3278
- try {
3279
- this.processMarkerElements(), window.setTimeout(this.processMarkerElementsCallback.bind(this), 25);
3280
- } catch (e) {
3281
- this.log("error", "Failed to process marker elements", e);
3282
- }
3283
- }
3284
- processMarkerElements() {
3285
- if (this.mapMarkerElementsUpdating) return;
3286
- const e = this.mapProvider.getBounds(), r = this.mapProvider.getZoom();
3287
- this.mapMarkerProcessor.processElements(e, r);
3288
- }
3289
- async log(e, r, n) {
3290
- switch (e) {
3291
- case "info":
3292
- console.info(n);
3293
- break;
3294
- case "warn":
3295
- console.warn(n);
3296
- break;
3297
- case "error":
3298
- console.error(n);
3299
- break;
3300
- }
3301
- if (n instanceof Error && !this.apiDevEnvironment)
3302
- try {
3303
- const i = {
3304
- key: this.apiKey,
3305
- title: r,
3306
- level: e,
3307
- content: {
3308
- version: wr,
3309
- ...n
3310
- }
3311
- };
3312
- await Ve.post(ds, i);
3313
- } catch (i) {
3314
- console.error(i);
3315
- }
3316
- }
3317
- }
3318
- const vs = () => '<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />', gs = () => `<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${vs()}<span>&nbsp;@arenarium/maps</span></a>`;
3319
- export {
3320
- dn as MapManager,
3321
- gs as getAttributionHtml,
3322
- vs as getImageHtml
3323
- };