@pie-players/pie-tool-text-to-speech 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2991 @@
1
+ var Ys = Object.defineProperty;
2
+ var en = (e) => {
3
+ throw TypeError(e);
4
+ };
5
+ var qs = (e, t, r) => t in e ? Ys(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
6
+ var k = (e, t, r) => qs(e, typeof t != "symbol" ? t + "" : t, r), wr = (e, t, r) => t.has(e) || en("Cannot " + r);
7
+ var a = (e, t, r) => (wr(e, t, "read from private field"), r ? r.call(e) : t.get(e)), b = (e, t, r) => t.has(e) ? en("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), g = (e, t, r, s) => (wr(e, t, "write to private field"), s ? s.call(e, r) : t.set(e, r), r), R = (e, t, r) => (wr(e, t, "access private method"), r);
8
+ var gn;
9
+ typeof window < "u" && ((gn = window.__svelte ?? (window.__svelte = {})).v ?? (gn.v = /* @__PURE__ */ new Set())).add("5");
10
+ const Gs = 1, Us = 2, wn = "[", Ir = "[!", bn = "]", _t = {}, M = /* @__PURE__ */ Symbol(), Hs = "http://www.w3.org/1999/xhtml", mr = !1;
11
+ var Ws = Array.isArray, Ks = Array.prototype.indexOf, gt = Array.prototype.includes, Xs = Array.from, Qt = Object.keys, Zt = Object.defineProperty, at = Object.getOwnPropertyDescriptor, Js = Object.getOwnPropertyDescriptors, Qs = Object.prototype, Zs = Array.prototype, mn = Object.getPrototypeOf, tn = Object.isExtensible;
12
+ function ei(e) {
13
+ for (var t = 0; t < e.length; t++)
14
+ e[t]();
15
+ }
16
+ function xn() {
17
+ var e, t, r = new Promise((s, n) => {
18
+ e = s, t = n;
19
+ });
20
+ return { promise: r, resolve: e, reject: t };
21
+ }
22
+ const I = 2, er = 4, ir = 8, yn = 1 << 24, Te = 16, _e = 32, De = 64, Lr = 128, ee = 512, C = 1024, F = 2048, Pe = 4096, he = 8192, Ee = 16384, or = 32768, wt = 65536, rn = 1 << 17, kn = 1 << 18, Qe = 1 << 19, ti = 1 << 20, Je = 32768, xr = 1 << 21, Dr = 1 << 22, Ce = 1 << 23, Ht = /* @__PURE__ */ Symbol("$state"), ri = /* @__PURE__ */ Symbol("legacy props"), ni = /* @__PURE__ */ Symbol(""), ot = new class extends Error {
23
+ constructor() {
24
+ super(...arguments);
25
+ k(this, "name", "StaleReactionError");
26
+ k(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
27
+ }
28
+ }(), Mt = 3, It = 8;
29
+ function si(e) {
30
+ throw new Error("https://svelte.dev/e/lifecycle_outside_component");
31
+ }
32
+ function ii() {
33
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
34
+ }
35
+ function oi(e) {
36
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
37
+ }
38
+ function li() {
39
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
40
+ }
41
+ function ai(e) {
42
+ throw new Error("https://svelte.dev/e/effect_orphan");
43
+ }
44
+ function fi() {
45
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
46
+ }
47
+ function ui() {
48
+ throw new Error("https://svelte.dev/e/hydration_failed");
49
+ }
50
+ function ci() {
51
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
52
+ }
53
+ function di() {
54
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
55
+ }
56
+ function hi() {
57
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
58
+ }
59
+ function vi() {
60
+ throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
61
+ }
62
+ function lr(e) {
63
+ console.warn("https://svelte.dev/e/hydration_mismatch");
64
+ }
65
+ function pi() {
66
+ console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
67
+ }
68
+ let E = !1;
69
+ function lt(e) {
70
+ E = e;
71
+ }
72
+ let $;
73
+ function re(e) {
74
+ if (e === null)
75
+ throw lr(), _t;
76
+ return $ = e;
77
+ }
78
+ function Fr() {
79
+ return re(/* @__PURE__ */ Ae($));
80
+ }
81
+ function L(e) {
82
+ if (E) {
83
+ if (/* @__PURE__ */ Ae($) !== null)
84
+ throw lr(), _t;
85
+ $ = e;
86
+ }
87
+ }
88
+ function yr(e = 1) {
89
+ if (E) {
90
+ for (var t = e, r = $; t--; )
91
+ r = /** @type {TemplateNode} */
92
+ /* @__PURE__ */ Ae(r);
93
+ $ = r;
94
+ }
95
+ }
96
+ function $n(e = !0) {
97
+ for (var t = 0, r = $; ; ) {
98
+ if (r.nodeType === It) {
99
+ var s = (
100
+ /** @type {Comment} */
101
+ r.data
102
+ );
103
+ if (s === bn) {
104
+ if (t === 0) return r;
105
+ t -= 1;
106
+ } else (s === wn || s === Ir) && (t += 1);
107
+ }
108
+ var n = (
109
+ /** @type {TemplateNode} */
110
+ /* @__PURE__ */ Ae(r)
111
+ );
112
+ e && r.remove(), r = n;
113
+ }
114
+ }
115
+ function _i(e) {
116
+ if (!e || e.nodeType !== It)
117
+ throw lr(), _t;
118
+ return (
119
+ /** @type {Comment} */
120
+ e.data
121
+ );
122
+ }
123
+ function En(e) {
124
+ return e === this.v;
125
+ }
126
+ function gi(e, t) {
127
+ return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
128
+ }
129
+ function wi(e) {
130
+ return !gi(e, this.v);
131
+ }
132
+ let bi = !1, K = null;
133
+ function bt(e) {
134
+ K = e;
135
+ }
136
+ function zn(e, t = !1, r) {
137
+ K = {
138
+ p: K,
139
+ i: !1,
140
+ c: null,
141
+ e: null,
142
+ s: e,
143
+ x: null,
144
+ l: null
145
+ };
146
+ }
147
+ function Sn(e) {
148
+ var t = (
149
+ /** @type {ComponentContext} */
150
+ K
151
+ ), r = t.e;
152
+ if (r !== null) {
153
+ t.e = null;
154
+ for (var s of r)
155
+ Wn(s);
156
+ }
157
+ return e !== void 0 && (t.x = e), t.i = !0, K = t.p, e ?? /** @type {T} */
158
+ {};
159
+ }
160
+ function Tn() {
161
+ return !0;
162
+ }
163
+ let je = [];
164
+ function Pn() {
165
+ var e = je;
166
+ je = [], ei(e);
167
+ }
168
+ function Ne(e) {
169
+ if (je.length === 0 && !zt) {
170
+ var t = je;
171
+ queueMicrotask(() => {
172
+ t === je && Pn();
173
+ });
174
+ }
175
+ je.push(e);
176
+ }
177
+ function mi() {
178
+ for (; je.length > 0; )
179
+ Pn();
180
+ }
181
+ function An(e) {
182
+ var t = y;
183
+ if (t === null)
184
+ return m.f |= Ce, e;
185
+ if ((t.f & or) === 0) {
186
+ if ((t.f & Lr) === 0)
187
+ throw e;
188
+ t.b.error(e);
189
+ } else
190
+ mt(e, t);
191
+ }
192
+ function mt(e, t) {
193
+ for (; t !== null; ) {
194
+ if ((t.f & Lr) !== 0)
195
+ try {
196
+ t.b.error(e);
197
+ return;
198
+ } catch (r) {
199
+ e = r;
200
+ }
201
+ t = t.parent;
202
+ }
203
+ throw e;
204
+ }
205
+ const xi = -7169;
206
+ function O(e, t) {
207
+ e.f = e.f & xi | t;
208
+ }
209
+ function Br(e) {
210
+ (e.f & ee) !== 0 || e.deps === null ? O(e, C) : O(e, Pe);
211
+ }
212
+ function On(e) {
213
+ if (e !== null)
214
+ for (const t of e)
215
+ (t.f & I) === 0 || (t.f & Je) === 0 || (t.f ^= Je, On(
216
+ /** @type {Derived} */
217
+ t.deps
218
+ ));
219
+ }
220
+ function Rn(e, t, r) {
221
+ (e.f & F) !== 0 ? t.add(e) : (e.f & Pe) !== 0 && r.add(e), On(e.deps), O(e, C);
222
+ }
223
+ const Yt = /* @__PURE__ */ new Set();
224
+ let T = null, ie = null, W = [], ar = null, kr = !1, zt = !1;
225
+ var ft, ut, qe, ct, At, Ot, Ge, dt, pe, $r, Er, Cn;
226
+ const Ur = class Ur {
227
+ constructor() {
228
+ b(this, pe);
229
+ k(this, "committed", !1);
230
+ /**
231
+ * The current values of any sources that are updated in this batch
232
+ * They keys of this map are identical to `this.#previous`
233
+ * @type {Map<Source, any>}
234
+ */
235
+ k(this, "current", /* @__PURE__ */ new Map());
236
+ /**
237
+ * The values of any sources that are updated in this batch _before_ those updates took place.
238
+ * They keys of this map are identical to `this.#current`
239
+ * @type {Map<Source, any>}
240
+ */
241
+ k(this, "previous", /* @__PURE__ */ new Map());
242
+ /**
243
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
244
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
245
+ * @type {Set<() => void>}
246
+ */
247
+ b(this, ft, /* @__PURE__ */ new Set());
248
+ /**
249
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
250
+ * @type {Set<(batch: Batch) => void>}
251
+ */
252
+ b(this, ut, /* @__PURE__ */ new Set());
253
+ /**
254
+ * The number of async effects that are currently in flight
255
+ */
256
+ b(this, qe, 0);
257
+ /**
258
+ * The number of async effects that are currently in flight, _not_ inside a pending boundary
259
+ */
260
+ b(this, ct, 0);
261
+ /**
262
+ * A deferred that resolves when the batch is committed, used with `settled()`
263
+ * TODO replace with Promise.withResolvers once supported widely enough
264
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
265
+ */
266
+ b(this, At, null);
267
+ /**
268
+ * Deferred effects (which run after async work has completed) that are DIRTY
269
+ * @type {Set<Effect>}
270
+ */
271
+ b(this, Ot, /* @__PURE__ */ new Set());
272
+ /**
273
+ * Deferred effects that are MAYBE_DIRTY
274
+ * @type {Set<Effect>}
275
+ */
276
+ b(this, Ge, /* @__PURE__ */ new Set());
277
+ /**
278
+ * A set of branches that still exist, but will be destroyed when this batch
279
+ * is committed — we skip over these during `process`
280
+ * @type {Set<Effect>}
281
+ */
282
+ k(this, "skipped_effects", /* @__PURE__ */ new Set());
283
+ k(this, "is_fork", !1);
284
+ b(this, dt, !1);
285
+ }
286
+ is_deferred() {
287
+ return this.is_fork || a(this, ct) > 0;
288
+ }
289
+ /**
290
+ *
291
+ * @param {Effect[]} root_effects
292
+ */
293
+ process(t) {
294
+ W = [], this.apply();
295
+ var r = [], s = [];
296
+ for (const n of t)
297
+ R(this, pe, $r).call(this, n, r, s);
298
+ if (this.is_deferred()) {
299
+ R(this, pe, Er).call(this, s), R(this, pe, Er).call(this, r);
300
+ for (const n of this.skipped_effects)
301
+ Ln(n);
302
+ } else {
303
+ for (const n of a(this, ft)) n();
304
+ a(this, ft).clear(), a(this, qe) === 0 && R(this, pe, Cn).call(this), T = null, nn(s), nn(r), a(this, At)?.resolve();
305
+ }
306
+ ie = null;
307
+ }
308
+ /**
309
+ * Associate a change to a given source with the current
310
+ * batch, noting its previous and current values
311
+ * @param {Source} source
312
+ * @param {any} value
313
+ */
314
+ capture(t, r) {
315
+ r !== M && !this.previous.has(t) && this.previous.set(t, r), (t.f & Ce) === 0 && (this.current.set(t, t.v), ie?.set(t, t.v));
316
+ }
317
+ activate() {
318
+ T = this, this.apply();
319
+ }
320
+ deactivate() {
321
+ T === this && (T = null, ie = null);
322
+ }
323
+ flush() {
324
+ if (this.activate(), W.length > 0) {
325
+ if (Nn(), T !== null && T !== this)
326
+ return;
327
+ } else a(this, qe) === 0 && this.process([]);
328
+ this.deactivate();
329
+ }
330
+ discard() {
331
+ for (const t of a(this, ut)) t(this);
332
+ a(this, ut).clear();
333
+ }
334
+ /**
335
+ *
336
+ * @param {boolean} blocking
337
+ */
338
+ increment(t) {
339
+ g(this, qe, a(this, qe) + 1), t && g(this, ct, a(this, ct) + 1);
340
+ }
341
+ /**
342
+ *
343
+ * @param {boolean} blocking
344
+ */
345
+ decrement(t) {
346
+ g(this, qe, a(this, qe) - 1), t && g(this, ct, a(this, ct) - 1), !a(this, dt) && (g(this, dt, !0), Ne(() => {
347
+ g(this, dt, !1), this.is_deferred() ? W.length > 0 && this.flush() : this.revive();
348
+ }));
349
+ }
350
+ revive() {
351
+ for (const t of a(this, Ot))
352
+ a(this, Ge).delete(t), O(t, F), Se(t);
353
+ for (const t of a(this, Ge))
354
+ O(t, Pe), Se(t);
355
+ this.flush();
356
+ }
357
+ /** @param {() => void} fn */
358
+ oncommit(t) {
359
+ a(this, ft).add(t);
360
+ }
361
+ /** @param {(batch: Batch) => void} fn */
362
+ ondiscard(t) {
363
+ a(this, ut).add(t);
364
+ }
365
+ settled() {
366
+ return (a(this, At) ?? g(this, At, xn())).promise;
367
+ }
368
+ static ensure() {
369
+ if (T === null) {
370
+ const t = T = new Ur();
371
+ Yt.add(T), zt || Ne(() => {
372
+ T === t && t.flush();
373
+ });
374
+ }
375
+ return T;
376
+ }
377
+ apply() {
378
+ }
379
+ };
380
+ ft = new WeakMap(), ut = new WeakMap(), qe = new WeakMap(), ct = new WeakMap(), At = new WeakMap(), Ot = new WeakMap(), Ge = new WeakMap(), dt = new WeakMap(), pe = new WeakSet(), /**
381
+ * Traverse the effect tree, executing effects or stashing
382
+ * them for later execution as appropriate
383
+ * @param {Effect} root
384
+ * @param {Effect[]} effects
385
+ * @param {Effect[]} render_effects
386
+ */
387
+ $r = function(t, r, s) {
388
+ t.f ^= C;
389
+ for (var n = t.first, i = null; n !== null; ) {
390
+ var o = n.f, l = (o & (_e | De)) !== 0, f = l && (o & C) !== 0, u = f || (o & he) !== 0 || this.skipped_effects.has(n);
391
+ if (!u && n.fn !== null) {
392
+ l ? n.f ^= C : i !== null && (o & (er | ir | yn)) !== 0 ? i.b.defer_effect(n) : (o & er) !== 0 ? r.push(n) : Dt(n) && ((o & Te) !== 0 && a(this, Ge).add(n), Pt(n));
393
+ var d = n.first;
394
+ if (d !== null) {
395
+ n = d;
396
+ continue;
397
+ }
398
+ }
399
+ var v = n.parent;
400
+ for (n = n.next; n === null && v !== null; )
401
+ v === i && (i = null), n = v.next, v = v.parent;
402
+ }
403
+ }, /**
404
+ * @param {Effect[]} effects
405
+ */
406
+ Er = function(t) {
407
+ for (var r = 0; r < t.length; r += 1)
408
+ Rn(t[r], a(this, Ot), a(this, Ge));
409
+ }, Cn = function() {
410
+ var n;
411
+ if (Yt.size > 1) {
412
+ this.previous.clear();
413
+ var t = ie, r = !0;
414
+ for (const i of Yt) {
415
+ if (i === this) {
416
+ r = !1;
417
+ continue;
418
+ }
419
+ const o = [];
420
+ for (const [f, u] of this.current) {
421
+ if (i.current.has(f))
422
+ if (r && u !== i.current.get(f))
423
+ i.current.set(f, u);
424
+ else
425
+ continue;
426
+ o.push(f);
427
+ }
428
+ if (o.length === 0)
429
+ continue;
430
+ const l = [...i.current.keys()].filter((f) => !this.current.has(f));
431
+ if (l.length > 0) {
432
+ var s = W;
433
+ W = [];
434
+ const f = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
435
+ for (const d of o)
436
+ Mn(d, l, f, u);
437
+ if (W.length > 0) {
438
+ T = i, i.apply();
439
+ for (const d of W)
440
+ R(n = i, pe, $r).call(n, d, [], []);
441
+ i.deactivate();
442
+ }
443
+ W = s;
444
+ }
445
+ }
446
+ T = null, ie = t;
447
+ }
448
+ this.committed = !0, Yt.delete(this);
449
+ };
450
+ let ze = Ur;
451
+ function Et(e) {
452
+ var t = zt;
453
+ zt = !0;
454
+ try {
455
+ for (var r; ; ) {
456
+ if (mi(), W.length === 0 && (T?.flush(), W.length === 0))
457
+ return ar = null, /** @type {T} */
458
+ r;
459
+ Nn();
460
+ }
461
+ } finally {
462
+ zt = t;
463
+ }
464
+ }
465
+ function Nn() {
466
+ kr = !0;
467
+ var e = null;
468
+ try {
469
+ for (var t = 0; W.length > 0; ) {
470
+ var r = ze.ensure();
471
+ if (t++ > 1e3) {
472
+ var s, n;
473
+ yi();
474
+ }
475
+ r.process(W), Me.clear();
476
+ }
477
+ } finally {
478
+ kr = !1, ar = null;
479
+ }
480
+ }
481
+ function yi() {
482
+ try {
483
+ fi();
484
+ } catch (e) {
485
+ mt(e, ar);
486
+ }
487
+ }
488
+ let be = null;
489
+ function nn(e) {
490
+ var t = e.length;
491
+ if (t !== 0) {
492
+ for (var r = 0; r < t; ) {
493
+ var s = e[r++];
494
+ if ((s.f & (Ee | he)) === 0 && Dt(s) && (be = /* @__PURE__ */ new Set(), Pt(s), s.deps === null && s.first === null && s.nodes === null && (s.teardown === null && s.ac === null ? Zn(s) : s.fn = null), be?.size > 0)) {
495
+ Me.clear();
496
+ for (const n of be) {
497
+ if ((n.f & (Ee | he)) !== 0) continue;
498
+ const i = [n];
499
+ let o = n.parent;
500
+ for (; o !== null; )
501
+ be.has(o) && (be.delete(o), i.push(o)), o = o.parent;
502
+ for (let l = i.length - 1; l >= 0; l--) {
503
+ const f = i[l];
504
+ (f.f & (Ee | he)) === 0 && Pt(f);
505
+ }
506
+ }
507
+ be.clear();
508
+ }
509
+ }
510
+ be = null;
511
+ }
512
+ }
513
+ function Mn(e, t, r, s) {
514
+ if (!r.has(e) && (r.add(e), e.reactions !== null))
515
+ for (const n of e.reactions) {
516
+ const i = n.f;
517
+ (i & I) !== 0 ? Mn(
518
+ /** @type {Derived} */
519
+ n,
520
+ t,
521
+ r,
522
+ s
523
+ ) : (i & (Dr | Te)) !== 0 && (i & F) === 0 && In(n, t, s) && (O(n, F), Se(
524
+ /** @type {Effect} */
525
+ n
526
+ ));
527
+ }
528
+ }
529
+ function In(e, t, r) {
530
+ const s = r.get(e);
531
+ if (s !== void 0) return s;
532
+ if (e.deps !== null)
533
+ for (const n of e.deps) {
534
+ if (gt.call(t, n))
535
+ return !0;
536
+ if ((n.f & I) !== 0 && In(
537
+ /** @type {Derived} */
538
+ n,
539
+ t,
540
+ r
541
+ ))
542
+ return r.set(
543
+ /** @type {Derived} */
544
+ n,
545
+ !0
546
+ ), !0;
547
+ }
548
+ return r.set(e, !1), !1;
549
+ }
550
+ function Se(e) {
551
+ for (var t = ar = e; t.parent !== null; ) {
552
+ t = t.parent;
553
+ var r = t.f;
554
+ if (kr && t === y && (r & Te) !== 0 && (r & kn) === 0)
555
+ return;
556
+ if ((r & (De | _e)) !== 0) {
557
+ if ((r & C) === 0) return;
558
+ t.f ^= C;
559
+ }
560
+ }
561
+ W.push(t);
562
+ }
563
+ function Ln(e) {
564
+ if (!((e.f & _e) !== 0 && (e.f & C) !== 0)) {
565
+ O(e, C);
566
+ for (var t = e.first; t !== null; )
567
+ Ln(t), t = t.next;
568
+ }
569
+ }
570
+ function ki(e) {
571
+ let t = 0, r = Lt(0), s;
572
+ return () => {
573
+ Yr() && (h(r), qr(() => (t === 0 && (s = Gr(() => e(() => St(r)))), t += 1, () => {
574
+ Ne(() => {
575
+ t -= 1, t === 0 && (s?.(), s = void 0, St(r));
576
+ });
577
+ })));
578
+ };
579
+ }
580
+ var $i = wt | Qe | Lr;
581
+ function Ei(e, t, r) {
582
+ new zi(e, t, r);
583
+ }
584
+ var U, Rt, fe, Ue, ue, Q, V, ce, xe, Re, He, ye, ht, We, vt, pt, ke, nr, A, Dn, Fn, zr, Wt, Kt, Sr;
585
+ class zi {
586
+ /**
587
+ * @param {TemplateNode} node
588
+ * @param {BoundaryProps} props
589
+ * @param {((anchor: Node) => void)} children
590
+ */
591
+ constructor(t, r, s) {
592
+ b(this, A);
593
+ /** @type {Boundary | null} */
594
+ k(this, "parent");
595
+ k(this, "is_pending", !1);
596
+ /** @type {TemplateNode} */
597
+ b(this, U);
598
+ /** @type {TemplateNode | null} */
599
+ b(this, Rt, E ? $ : null);
600
+ /** @type {BoundaryProps} */
601
+ b(this, fe);
602
+ /** @type {((anchor: Node) => void)} */
603
+ b(this, Ue);
604
+ /** @type {Effect} */
605
+ b(this, ue);
606
+ /** @type {Effect | null} */
607
+ b(this, Q, null);
608
+ /** @type {Effect | null} */
609
+ b(this, V, null);
610
+ /** @type {Effect | null} */
611
+ b(this, ce, null);
612
+ /** @type {DocumentFragment | null} */
613
+ b(this, xe, null);
614
+ /** @type {TemplateNode | null} */
615
+ b(this, Re, null);
616
+ b(this, He, 0);
617
+ b(this, ye, 0);
618
+ b(this, ht, !1);
619
+ b(this, We, !1);
620
+ /** @type {Set<Effect>} */
621
+ b(this, vt, /* @__PURE__ */ new Set());
622
+ /** @type {Set<Effect>} */
623
+ b(this, pt, /* @__PURE__ */ new Set());
624
+ /**
625
+ * A source containing the number of pending async deriveds/expressions.
626
+ * Only created if `$effect.pending()` is used inside the boundary,
627
+ * otherwise updating the source results in needless `Batch.ensure()`
628
+ * calls followed by no-op flushes
629
+ * @type {Source<number> | null}
630
+ */
631
+ b(this, ke, null);
632
+ b(this, nr, ki(() => (g(this, ke, Lt(a(this, He))), () => {
633
+ g(this, ke, null);
634
+ })));
635
+ g(this, U, t), g(this, fe, r), g(this, Ue, s), this.parent = /** @type {Effect} */
636
+ y.b, this.is_pending = !!a(this, fe).pending, g(this, ue, Xn(() => {
637
+ if (y.b = this, E) {
638
+ const i = a(this, Rt);
639
+ Fr(), /** @type {Comment} */
640
+ i.nodeType === It && /** @type {Comment} */
641
+ i.data === Ir ? R(this, A, Fn).call(this) : (R(this, A, Dn).call(this), a(this, ye) === 0 && (this.is_pending = !1));
642
+ } else {
643
+ var n = R(this, A, zr).call(this);
644
+ try {
645
+ g(this, Q, me(() => s(n)));
646
+ } catch (i) {
647
+ this.error(i);
648
+ }
649
+ a(this, ye) > 0 ? R(this, A, Kt).call(this) : this.is_pending = !1;
650
+ }
651
+ return () => {
652
+ a(this, Re)?.remove();
653
+ };
654
+ }, $i)), E && g(this, U, $);
655
+ }
656
+ /**
657
+ * Defer an effect inside a pending boundary until the boundary resolves
658
+ * @param {Effect} effect
659
+ */
660
+ defer_effect(t) {
661
+ Rn(t, a(this, vt), a(this, pt));
662
+ }
663
+ /**
664
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
665
+ * @returns {boolean}
666
+ */
667
+ is_rendered() {
668
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
669
+ }
670
+ has_pending_snippet() {
671
+ return !!a(this, fe).pending;
672
+ }
673
+ /**
674
+ * Update the source that powers `$effect.pending()` inside this boundary,
675
+ * and controls when the current `pending` snippet (if any) is removed.
676
+ * Do not call from inside the class
677
+ * @param {1 | -1} d
678
+ */
679
+ update_pending_count(t) {
680
+ R(this, A, Sr).call(this, t), g(this, He, a(this, He) + t), !(!a(this, ke) || a(this, ht)) && (g(this, ht, !0), Ne(() => {
681
+ g(this, ht, !1), a(this, ke) && tr(a(this, ke), a(this, He));
682
+ }));
683
+ }
684
+ get_effect_pending() {
685
+ return a(this, nr).call(this), h(
686
+ /** @type {Source<number>} */
687
+ a(this, ke)
688
+ );
689
+ }
690
+ /** @param {unknown} error */
691
+ error(t) {
692
+ var r = a(this, fe).onerror;
693
+ let s = a(this, fe).failed;
694
+ if (a(this, We) || !r && !s)
695
+ throw t;
696
+ a(this, Q) && (q(a(this, Q)), g(this, Q, null)), a(this, V) && (q(a(this, V)), g(this, V, null)), a(this, ce) && (q(a(this, ce)), g(this, ce, null)), E && (re(
697
+ /** @type {TemplateNode} */
698
+ a(this, Rt)
699
+ ), yr(), re($n()));
700
+ var n = !1, i = !1;
701
+ const o = () => {
702
+ if (n) {
703
+ pi();
704
+ return;
705
+ }
706
+ n = !0, i && vi(), ze.ensure(), g(this, He, 0), a(this, ce) !== null && Tt(a(this, ce), () => {
707
+ g(this, ce, null);
708
+ }), this.is_pending = this.has_pending_snippet(), g(this, Q, R(this, A, Wt).call(this, () => (g(this, We, !1), me(() => a(this, Ue).call(this, a(this, U)))))), a(this, ye) > 0 ? R(this, A, Kt).call(this) : this.is_pending = !1;
709
+ };
710
+ Ne(() => {
711
+ try {
712
+ i = !0, r?.(t, o), i = !1;
713
+ } catch (l) {
714
+ mt(l, a(this, ue) && a(this, ue).parent);
715
+ }
716
+ s && g(this, ce, R(this, A, Wt).call(this, () => {
717
+ ze.ensure(), g(this, We, !0);
718
+ try {
719
+ return me(() => {
720
+ s(
721
+ a(this, U),
722
+ () => t,
723
+ () => o
724
+ );
725
+ });
726
+ } catch (l) {
727
+ return mt(
728
+ l,
729
+ /** @type {Effect} */
730
+ a(this, ue).parent
731
+ ), null;
732
+ } finally {
733
+ g(this, We, !1);
734
+ }
735
+ }));
736
+ });
737
+ }
738
+ }
739
+ U = new WeakMap(), Rt = new WeakMap(), fe = new WeakMap(), Ue = new WeakMap(), ue = new WeakMap(), Q = new WeakMap(), V = new WeakMap(), ce = new WeakMap(), xe = new WeakMap(), Re = new WeakMap(), He = new WeakMap(), ye = new WeakMap(), ht = new WeakMap(), We = new WeakMap(), vt = new WeakMap(), pt = new WeakMap(), ke = new WeakMap(), nr = new WeakMap(), A = new WeakSet(), Dn = function() {
740
+ try {
741
+ g(this, Q, me(() => a(this, Ue).call(this, a(this, U))));
742
+ } catch (t) {
743
+ this.error(t);
744
+ }
745
+ }, Fn = function() {
746
+ const t = a(this, fe).pending;
747
+ t && (g(this, V, me(() => t(a(this, U)))), Ne(() => {
748
+ var r = R(this, A, zr).call(this);
749
+ g(this, Q, R(this, A, Wt).call(this, () => (ze.ensure(), me(() => a(this, Ue).call(this, r))))), a(this, ye) > 0 ? R(this, A, Kt).call(this) : (Tt(
750
+ /** @type {Effect} */
751
+ a(this, V),
752
+ () => {
753
+ g(this, V, null);
754
+ }
755
+ ), this.is_pending = !1);
756
+ }));
757
+ }, zr = function() {
758
+ var t = a(this, U);
759
+ return this.is_pending && (g(this, Re, le()), a(this, U).before(a(this, Re)), t = a(this, Re)), t;
760
+ }, /**
761
+ * @param {() => Effect | null} fn
762
+ */
763
+ Wt = function(t) {
764
+ var r = y, s = m, n = K;
765
+ ve(a(this, ue)), ne(a(this, ue)), bt(a(this, ue).ctx);
766
+ try {
767
+ return t();
768
+ } catch (i) {
769
+ return An(i), null;
770
+ } finally {
771
+ ve(r), ne(s), bt(n);
772
+ }
773
+ }, Kt = function() {
774
+ const t = (
775
+ /** @type {(anchor: Node) => void} */
776
+ a(this, fe).pending
777
+ );
778
+ a(this, Q) !== null && (g(this, xe, document.createDocumentFragment()), a(this, xe).append(
779
+ /** @type {TemplateNode} */
780
+ a(this, Re)
781
+ ), rs(a(this, Q), a(this, xe))), a(this, V) === null && g(this, V, me(() => t(a(this, U))));
782
+ }, /**
783
+ * Updates the pending count associated with the currently visible pending snippet,
784
+ * if any, such that we can replace the snippet with content once work is done
785
+ * @param {1 | -1} d
786
+ */
787
+ Sr = function(t) {
788
+ var r;
789
+ if (!this.has_pending_snippet()) {
790
+ this.parent && R(r = this.parent, A, Sr).call(r, t);
791
+ return;
792
+ }
793
+ if (g(this, ye, a(this, ye) + t), a(this, ye) === 0) {
794
+ this.is_pending = !1;
795
+ for (const s of a(this, vt))
796
+ O(s, F), Se(s);
797
+ for (const s of a(this, pt))
798
+ O(s, Pe), Se(s);
799
+ a(this, vt).clear(), a(this, pt).clear(), a(this, V) && Tt(a(this, V), () => {
800
+ g(this, V, null);
801
+ }), a(this, xe) && (a(this, U).before(a(this, xe)), g(this, xe, null));
802
+ }
803
+ };
804
+ function Si(e, t, r, s) {
805
+ const n = jr;
806
+ var i = e.filter((c) => !c.settled);
807
+ if (r.length === 0 && i.length === 0) {
808
+ s(t.map(n));
809
+ return;
810
+ }
811
+ var o = T, l = (
812
+ /** @type {Effect} */
813
+ y
814
+ ), f = Ti(), u = i.length === 1 ? i[0].promise : i.length > 1 ? Promise.all(i.map((c) => c.promise)) : null;
815
+ function d(c) {
816
+ f();
817
+ try {
818
+ s(c);
819
+ } catch (p) {
820
+ (l.f & Ee) === 0 && mt(p, l);
821
+ }
822
+ o?.deactivate(), Tr();
823
+ }
824
+ if (r.length === 0) {
825
+ u.then(() => d(t.map(n)));
826
+ return;
827
+ }
828
+ function v() {
829
+ f(), Promise.all(r.map((c) => /* @__PURE__ */ Pi(c))).then((c) => d([...t.map(n), ...c])).catch((c) => mt(c, l));
830
+ }
831
+ u ? u.then(v) : v();
832
+ }
833
+ function Ti() {
834
+ var e = y, t = m, r = K, s = T;
835
+ return function(i = !0) {
836
+ ve(e), ne(t), bt(r), i && s?.activate();
837
+ };
838
+ }
839
+ function Tr() {
840
+ ve(null), ne(null), bt(null);
841
+ }
842
+ // @__NO_SIDE_EFFECTS__
843
+ function jr(e) {
844
+ var t = I | F, r = m !== null && (m.f & I) !== 0 ? (
845
+ /** @type {Derived} */
846
+ m
847
+ ) : null;
848
+ return y !== null && (y.f |= Qe), {
849
+ ctx: K,
850
+ deps: null,
851
+ effects: null,
852
+ equals: En,
853
+ f: t,
854
+ fn: e,
855
+ reactions: null,
856
+ rv: 0,
857
+ v: (
858
+ /** @type {V} */
859
+ M
860
+ ),
861
+ wv: 0,
862
+ parent: r ?? y,
863
+ ac: null
864
+ };
865
+ }
866
+ // @__NO_SIDE_EFFECTS__
867
+ function Pi(e, t, r) {
868
+ let s = (
869
+ /** @type {Effect | null} */
870
+ y
871
+ );
872
+ s === null && ii();
873
+ var n = (
874
+ /** @type {Boundary} */
875
+ s.b
876
+ ), i = (
877
+ /** @type {Promise<V>} */
878
+ /** @type {unknown} */
879
+ void 0
880
+ ), o = Lt(
881
+ /** @type {V} */
882
+ M
883
+ ), l = !m, f = /* @__PURE__ */ new Map();
884
+ return Vi(() => {
885
+ var u = xn();
886
+ i = u.promise;
887
+ try {
888
+ Promise.resolve(e()).then(u.resolve, u.reject).then(() => {
889
+ d === T && d.committed && d.deactivate(), Tr();
890
+ });
891
+ } catch (p) {
892
+ u.reject(p), Tr();
893
+ }
894
+ var d = (
895
+ /** @type {Batch} */
896
+ T
897
+ );
898
+ if (l) {
899
+ var v = n.is_rendered();
900
+ n.update_pending_count(1), d.increment(v), f.get(d)?.reject(ot), f.delete(d), f.set(d, u);
901
+ }
902
+ const c = (p, w = void 0) => {
903
+ if (d.activate(), w)
904
+ w !== ot && (o.f |= Ce, tr(o, w));
905
+ else {
906
+ (o.f & Ce) !== 0 && (o.f ^= Ce), tr(o, p);
907
+ for (const [z, S] of f) {
908
+ if (f.delete(z), z === d) break;
909
+ S.reject(ot);
910
+ }
911
+ }
912
+ l && (n.update_pending_count(-1), d.decrement(v));
913
+ };
914
+ u.promise.then(c, (p) => c(null, p || "unknown"));
915
+ }), Fi(() => {
916
+ for (const u of f.values())
917
+ u.reject(ot);
918
+ }), new Promise((u) => {
919
+ function d(v) {
920
+ function c() {
921
+ v === i ? u(o) : d(i);
922
+ }
923
+ v.then(c, c);
924
+ }
925
+ d(i);
926
+ });
927
+ }
928
+ // @__NO_SIDE_EFFECTS__
929
+ function Ai(e) {
930
+ const t = /* @__PURE__ */ jr(e);
931
+ return ns(t), t;
932
+ }
933
+ function Bn(e) {
934
+ var t = e.effects;
935
+ if (t !== null) {
936
+ e.effects = null;
937
+ for (var r = 0; r < t.length; r += 1)
938
+ q(
939
+ /** @type {Effect} */
940
+ t[r]
941
+ );
942
+ }
943
+ }
944
+ function Oi(e) {
945
+ for (var t = e.parent; t !== null; ) {
946
+ if ((t.f & I) === 0)
947
+ return (t.f & Ee) === 0 ? (
948
+ /** @type {Effect} */
949
+ t
950
+ ) : null;
951
+ t = t.parent;
952
+ }
953
+ return null;
954
+ }
955
+ function Vr(e) {
956
+ var t, r = y;
957
+ ve(Oi(e));
958
+ try {
959
+ e.f &= ~Je, Bn(e), t = ls(e);
960
+ } finally {
961
+ ve(r);
962
+ }
963
+ return t;
964
+ }
965
+ function jn(e) {
966
+ var t = Vr(e);
967
+ if (!e.equals(t) && (e.wv = is(), (!T?.is_fork || e.deps === null) && (e.v = t, e.deps === null))) {
968
+ O(e, C);
969
+ return;
970
+ }
971
+ Le || (ie !== null ? (Yr() || T?.is_fork) && ie.set(e, t) : Br(e));
972
+ }
973
+ let Pr = /* @__PURE__ */ new Set();
974
+ const Me = /* @__PURE__ */ new Map();
975
+ let Vn = !1;
976
+ function Lt(e, t) {
977
+ var r = {
978
+ f: 0,
979
+ // TODO ideally we could skip this altogether, but it causes type errors
980
+ v: e,
981
+ reactions: null,
982
+ equals: En,
983
+ rv: 0,
984
+ wv: 0
985
+ };
986
+ return r;
987
+ }
988
+ // @__NO_SIDE_EFFECTS__
989
+ function P(e, t) {
990
+ const r = Lt(e);
991
+ return ns(r), r;
992
+ }
993
+ // @__NO_SIDE_EFFECTS__
994
+ function Ri(e, t = !1, r = !0) {
995
+ const s = Lt(e);
996
+ return t || (s.equals = wi), s;
997
+ }
998
+ function x(e, t, r = !1) {
999
+ m !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
1000
+ // to ensure we error if state is set inside an inspect effect
1001
+ (!oe || (m.f & rn) !== 0) && Tn() && (m.f & (I | Te | Dr | rn)) !== 0 && (te === null || !gt.call(te, e)) && hi();
1002
+ let s = r ? Ve(t) : t;
1003
+ return tr(e, s);
1004
+ }
1005
+ function tr(e, t) {
1006
+ if (!e.equals(t)) {
1007
+ var r = e.v;
1008
+ Le ? Me.set(e, t) : Me.set(e, r), e.v = t;
1009
+ var s = ze.ensure();
1010
+ if (s.capture(e, r), (e.f & I) !== 0) {
1011
+ const n = (
1012
+ /** @type {Derived} */
1013
+ e
1014
+ );
1015
+ (e.f & F) !== 0 && Vr(n), Br(n);
1016
+ }
1017
+ e.wv = is(), Yn(e, F), y !== null && (y.f & C) !== 0 && (y.f & (_e | De)) === 0 && (J === null ? Ui([e]) : J.push(e)), !s.is_fork && Pr.size > 0 && !Vn && Ci();
1018
+ }
1019
+ return t;
1020
+ }
1021
+ function Ci() {
1022
+ Vn = !1;
1023
+ for (const e of Pr)
1024
+ (e.f & C) !== 0 && O(e, Pe), Dt(e) && Pt(e);
1025
+ Pr.clear();
1026
+ }
1027
+ function St(e) {
1028
+ x(e, e.v + 1);
1029
+ }
1030
+ function Yn(e, t) {
1031
+ var r = e.reactions;
1032
+ if (r !== null)
1033
+ for (var s = r.length, n = 0; n < s; n++) {
1034
+ var i = r[n], o = i.f, l = (o & F) === 0;
1035
+ if (l && O(i, t), (o & I) !== 0) {
1036
+ var f = (
1037
+ /** @type {Derived} */
1038
+ i
1039
+ );
1040
+ ie?.delete(f), (o & Je) === 0 && (o & ee && (i.f |= Je), Yn(f, Pe));
1041
+ } else l && ((o & Te) !== 0 && be !== null && be.add(
1042
+ /** @type {Effect} */
1043
+ i
1044
+ ), Se(
1045
+ /** @type {Effect} */
1046
+ i
1047
+ ));
1048
+ }
1049
+ }
1050
+ function Ve(e) {
1051
+ if (typeof e != "object" || e === null || Ht in e)
1052
+ return e;
1053
+ const t = mn(e);
1054
+ if (t !== Qs && t !== Zs)
1055
+ return e;
1056
+ var r = /* @__PURE__ */ new Map(), s = Ws(e), n = /* @__PURE__ */ P(0), i = Xe, o = (l) => {
1057
+ if (Xe === i)
1058
+ return l();
1059
+ var f = m, u = Xe;
1060
+ ne(null), an(i);
1061
+ var d = l();
1062
+ return ne(f), an(u), d;
1063
+ };
1064
+ return s && r.set("length", /* @__PURE__ */ P(
1065
+ /** @type {any[]} */
1066
+ e.length
1067
+ )), new Proxy(
1068
+ /** @type {any} */
1069
+ e,
1070
+ {
1071
+ defineProperty(l, f, u) {
1072
+ (!("value" in u) || u.configurable === !1 || u.enumerable === !1 || u.writable === !1) && ci();
1073
+ var d = r.get(f);
1074
+ return d === void 0 ? d = o(() => {
1075
+ var v = /* @__PURE__ */ P(u.value);
1076
+ return r.set(f, v), v;
1077
+ }) : x(d, u.value, !0), !0;
1078
+ },
1079
+ deleteProperty(l, f) {
1080
+ var u = r.get(f);
1081
+ if (u === void 0) {
1082
+ if (f in l) {
1083
+ const d = o(() => /* @__PURE__ */ P(M));
1084
+ r.set(f, d), St(n);
1085
+ }
1086
+ } else
1087
+ x(u, M), St(n);
1088
+ return !0;
1089
+ },
1090
+ get(l, f, u) {
1091
+ if (f === Ht)
1092
+ return e;
1093
+ var d = r.get(f), v = f in l;
1094
+ if (d === void 0 && (!v || at(l, f)?.writable) && (d = o(() => {
1095
+ var p = Ve(v ? l[f] : M), w = /* @__PURE__ */ P(p);
1096
+ return w;
1097
+ }), r.set(f, d)), d !== void 0) {
1098
+ var c = h(d);
1099
+ return c === M ? void 0 : c;
1100
+ }
1101
+ return Reflect.get(l, f, u);
1102
+ },
1103
+ getOwnPropertyDescriptor(l, f) {
1104
+ var u = Reflect.getOwnPropertyDescriptor(l, f);
1105
+ if (u && "value" in u) {
1106
+ var d = r.get(f);
1107
+ d && (u.value = h(d));
1108
+ } else if (u === void 0) {
1109
+ var v = r.get(f), c = v?.v;
1110
+ if (v !== void 0 && c !== M)
1111
+ return {
1112
+ enumerable: !0,
1113
+ configurable: !0,
1114
+ value: c,
1115
+ writable: !0
1116
+ };
1117
+ }
1118
+ return u;
1119
+ },
1120
+ has(l, f) {
1121
+ if (f === Ht)
1122
+ return !0;
1123
+ var u = r.get(f), d = u !== void 0 && u.v !== M || Reflect.has(l, f);
1124
+ if (u !== void 0 || y !== null && (!d || at(l, f)?.writable)) {
1125
+ u === void 0 && (u = o(() => {
1126
+ var c = d ? Ve(l[f]) : M, p = /* @__PURE__ */ P(c);
1127
+ return p;
1128
+ }), r.set(f, u));
1129
+ var v = h(u);
1130
+ if (v === M)
1131
+ return !1;
1132
+ }
1133
+ return d;
1134
+ },
1135
+ set(l, f, u, d) {
1136
+ var v = r.get(f), c = f in l;
1137
+ if (s && f === "length")
1138
+ for (var p = u; p < /** @type {Source<number>} */
1139
+ v.v; p += 1) {
1140
+ var w = r.get(p + "");
1141
+ w !== void 0 ? x(w, M) : p in l && (w = o(() => /* @__PURE__ */ P(M)), r.set(p + "", w));
1142
+ }
1143
+ if (v === void 0)
1144
+ (!c || at(l, f)?.writable) && (v = o(() => /* @__PURE__ */ P(void 0)), x(v, Ve(u)), r.set(f, v));
1145
+ else {
1146
+ c = v.v !== M;
1147
+ var z = o(() => Ve(u));
1148
+ x(v, z);
1149
+ }
1150
+ var S = Reflect.getOwnPropertyDescriptor(l, f);
1151
+ if (S?.set && S.set.call(d, u), !c) {
1152
+ if (s && typeof f == "string") {
1153
+ var Ze = (
1154
+ /** @type {Source<number>} */
1155
+ r.get("length")
1156
+ ), et = Number(f);
1157
+ Number.isInteger(et) && et >= Ze.v && x(Ze, et + 1);
1158
+ }
1159
+ St(n);
1160
+ }
1161
+ return !0;
1162
+ },
1163
+ ownKeys(l) {
1164
+ h(n);
1165
+ var f = Reflect.ownKeys(l).filter((v) => {
1166
+ var c = r.get(v);
1167
+ return c === void 0 || c.v !== M;
1168
+ });
1169
+ for (var [u, d] of r)
1170
+ d.v !== M && !(u in l) && f.push(u);
1171
+ return f;
1172
+ },
1173
+ setPrototypeOf() {
1174
+ di();
1175
+ }
1176
+ }
1177
+ );
1178
+ }
1179
+ var sn, qn, Gn, Un;
1180
+ function Ar() {
1181
+ if (sn === void 0) {
1182
+ sn = window, qn = /Firefox/.test(navigator.userAgent);
1183
+ var e = Element.prototype, t = Node.prototype, r = Text.prototype;
1184
+ Gn = at(t, "firstChild").get, Un = at(t, "nextSibling").get, tn(e) && (e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0), tn(r) && (r.__t = void 0);
1185
+ }
1186
+ }
1187
+ function le(e = "") {
1188
+ return document.createTextNode(e);
1189
+ }
1190
+ // @__NO_SIDE_EFFECTS__
1191
+ function xt(e) {
1192
+ return (
1193
+ /** @type {TemplateNode | null} */
1194
+ Gn.call(e)
1195
+ );
1196
+ }
1197
+ // @__NO_SIDE_EFFECTS__
1198
+ function Ae(e) {
1199
+ return (
1200
+ /** @type {TemplateNode | null} */
1201
+ Un.call(e)
1202
+ );
1203
+ }
1204
+ function D(e, t) {
1205
+ if (!E)
1206
+ return /* @__PURE__ */ xt(e);
1207
+ var r = /* @__PURE__ */ xt($);
1208
+ if (r === null)
1209
+ r = $.appendChild(le());
1210
+ else if (t && r.nodeType !== Mt) {
1211
+ var s = le();
1212
+ return r?.before(s), re(s), s;
1213
+ }
1214
+ return t && fr(
1215
+ /** @type {Text} */
1216
+ r
1217
+ ), re(r), r;
1218
+ }
1219
+ function br(e, t = !1) {
1220
+ if (!E) {
1221
+ var r = /* @__PURE__ */ xt(e);
1222
+ return r instanceof Comment && r.data === "" ? /* @__PURE__ */ Ae(r) : r;
1223
+ }
1224
+ if (t) {
1225
+ if ($?.nodeType !== Mt) {
1226
+ var s = le();
1227
+ return $?.before(s), re(s), s;
1228
+ }
1229
+ fr(
1230
+ /** @type {Text} */
1231
+ $
1232
+ );
1233
+ }
1234
+ return $;
1235
+ }
1236
+ function X(e, t = 1, r = !1) {
1237
+ let s = E ? $ : e;
1238
+ for (var n; t--; )
1239
+ n = s, s = /** @type {TemplateNode} */
1240
+ /* @__PURE__ */ Ae(s);
1241
+ if (!E)
1242
+ return s;
1243
+ if (r) {
1244
+ if (s?.nodeType !== Mt) {
1245
+ var i = le();
1246
+ return s === null ? n?.after(i) : s.before(i), re(i), i;
1247
+ }
1248
+ fr(
1249
+ /** @type {Text} */
1250
+ s
1251
+ );
1252
+ }
1253
+ return re(s), s;
1254
+ }
1255
+ function Ni(e) {
1256
+ e.textContent = "";
1257
+ }
1258
+ function Mi() {
1259
+ return !1;
1260
+ }
1261
+ function fr(e) {
1262
+ if (
1263
+ /** @type {string} */
1264
+ e.nodeValue.length < 65536
1265
+ )
1266
+ return;
1267
+ let t = e.nextSibling;
1268
+ for (; t !== null && t.nodeType === Mt; )
1269
+ t.remove(), e.nodeValue += /** @type {string} */
1270
+ t.nodeValue, t = e.nextSibling;
1271
+ }
1272
+ let on = !1;
1273
+ function Ii() {
1274
+ on || (on = !0, document.addEventListener(
1275
+ "reset",
1276
+ (e) => {
1277
+ Promise.resolve().then(() => {
1278
+ if (!e.defaultPrevented)
1279
+ for (
1280
+ const t of
1281
+ /**@type {HTMLFormElement} */
1282
+ e.target.elements
1283
+ )
1284
+ t.__on_r?.();
1285
+ });
1286
+ },
1287
+ // In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
1288
+ { capture: !0 }
1289
+ ));
1290
+ }
1291
+ function Hn(e) {
1292
+ var t = m, r = y;
1293
+ ne(null), ve(null);
1294
+ try {
1295
+ return e();
1296
+ } finally {
1297
+ ne(t), ve(r);
1298
+ }
1299
+ }
1300
+ function Li(e) {
1301
+ y === null && (m === null && ai(), li()), Le && oi();
1302
+ }
1303
+ function Di(e, t) {
1304
+ var r = t.last;
1305
+ r === null ? t.last = t.first = e : (r.next = e, e.prev = r, t.last = e);
1306
+ }
1307
+ function ge(e, t, r) {
1308
+ var s = y;
1309
+ s !== null && (s.f & he) !== 0 && (e |= he);
1310
+ var n = {
1311
+ ctx: K,
1312
+ deps: null,
1313
+ nodes: null,
1314
+ f: e | F | ee,
1315
+ first: null,
1316
+ fn: t,
1317
+ last: null,
1318
+ next: null,
1319
+ parent: s,
1320
+ b: s && s.b,
1321
+ prev: null,
1322
+ teardown: null,
1323
+ wv: 0,
1324
+ ac: null
1325
+ };
1326
+ if (r)
1327
+ try {
1328
+ Pt(n), n.f |= or;
1329
+ } catch (l) {
1330
+ throw q(n), l;
1331
+ }
1332
+ else t !== null && Se(n);
1333
+ var i = n;
1334
+ if (r && i.deps === null && i.teardown === null && i.nodes === null && i.first === i.last && // either `null`, or a singular child
1335
+ (i.f & Qe) === 0 && (i = i.first, (e & Te) !== 0 && (e & wt) !== 0 && i !== null && (i.f |= wt)), i !== null && (i.parent = s, s !== null && Di(i, s), m !== null && (m.f & I) !== 0 && (e & De) === 0)) {
1336
+ var o = (
1337
+ /** @type {Derived} */
1338
+ m
1339
+ );
1340
+ (o.effects ?? (o.effects = [])).push(i);
1341
+ }
1342
+ return n;
1343
+ }
1344
+ function Yr() {
1345
+ return m !== null && !oe;
1346
+ }
1347
+ function Fi(e) {
1348
+ const t = ge(ir, null, !1);
1349
+ return O(t, C), t.teardown = e, t;
1350
+ }
1351
+ function Or(e) {
1352
+ Li();
1353
+ var t = (
1354
+ /** @type {Effect} */
1355
+ y.f
1356
+ ), r = !m && (t & _e) !== 0 && (t & or) === 0;
1357
+ if (r) {
1358
+ var s = (
1359
+ /** @type {ComponentContext} */
1360
+ K
1361
+ );
1362
+ (s.e ?? (s.e = [])).push(e);
1363
+ } else
1364
+ return Wn(e);
1365
+ }
1366
+ function Wn(e) {
1367
+ return ge(er | ti, e, !1);
1368
+ }
1369
+ function Bi(e) {
1370
+ ze.ensure();
1371
+ const t = ge(De | Qe, e, !0);
1372
+ return () => {
1373
+ q(t);
1374
+ };
1375
+ }
1376
+ function ji(e) {
1377
+ ze.ensure();
1378
+ const t = ge(De | Qe, e, !0);
1379
+ return (r = {}) => new Promise((s) => {
1380
+ r.outro ? Tt(t, () => {
1381
+ q(t), s(void 0);
1382
+ }) : (q(t), s(void 0));
1383
+ });
1384
+ }
1385
+ function Kn(e) {
1386
+ return ge(er, e, !1);
1387
+ }
1388
+ function Vi(e) {
1389
+ return ge(Dr | Qe, e, !0);
1390
+ }
1391
+ function qr(e, t = 0) {
1392
+ return ge(ir | t, e, !0);
1393
+ }
1394
+ function $t(e, t = [], r = [], s = []) {
1395
+ Si(s, t, r, (n) => {
1396
+ ge(ir, () => e(...n.map(h)), !0);
1397
+ });
1398
+ }
1399
+ function Xn(e, t = 0) {
1400
+ var r = ge(Te | t, e, !0);
1401
+ return r;
1402
+ }
1403
+ function me(e) {
1404
+ return ge(_e | Qe, e, !0);
1405
+ }
1406
+ function Jn(e) {
1407
+ var t = e.teardown;
1408
+ if (t !== null) {
1409
+ const r = Le, s = m;
1410
+ ln(!0), ne(null);
1411
+ try {
1412
+ t.call(null);
1413
+ } finally {
1414
+ ln(r), ne(s);
1415
+ }
1416
+ }
1417
+ }
1418
+ function Qn(e, t = !1) {
1419
+ var r = e.first;
1420
+ for (e.first = e.last = null; r !== null; ) {
1421
+ const n = r.ac;
1422
+ n !== null && Hn(() => {
1423
+ n.abort(ot);
1424
+ });
1425
+ var s = r.next;
1426
+ (r.f & De) !== 0 ? r.parent = null : q(r, t), r = s;
1427
+ }
1428
+ }
1429
+ function Yi(e) {
1430
+ for (var t = e.first; t !== null; ) {
1431
+ var r = t.next;
1432
+ (t.f & _e) === 0 && q(t), t = r;
1433
+ }
1434
+ }
1435
+ function q(e, t = !0) {
1436
+ var r = !1;
1437
+ (t || (e.f & kn) !== 0) && e.nodes !== null && e.nodes.end !== null && (qi(
1438
+ e.nodes.start,
1439
+ /** @type {TemplateNode} */
1440
+ e.nodes.end
1441
+ ), r = !0), Qn(e, t && !r), rr(e, 0), O(e, Ee);
1442
+ var s = e.nodes && e.nodes.t;
1443
+ if (s !== null)
1444
+ for (const i of s)
1445
+ i.stop();
1446
+ Jn(e);
1447
+ var n = e.parent;
1448
+ n !== null && n.first !== null && Zn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
1449
+ }
1450
+ function qi(e, t) {
1451
+ for (; e !== null; ) {
1452
+ var r = e === t ? null : /* @__PURE__ */ Ae(e);
1453
+ e.remove(), e = r;
1454
+ }
1455
+ }
1456
+ function Zn(e) {
1457
+ var t = e.parent, r = e.prev, s = e.next;
1458
+ r !== null && (r.next = s), s !== null && (s.prev = r), t !== null && (t.first === e && (t.first = s), t.last === e && (t.last = r));
1459
+ }
1460
+ function Tt(e, t, r = !0) {
1461
+ var s = [];
1462
+ es(e, s, !0);
1463
+ var n = () => {
1464
+ r && q(e), t && t();
1465
+ }, i = s.length;
1466
+ if (i > 0) {
1467
+ var o = () => --i || n();
1468
+ for (var l of s)
1469
+ l.out(o);
1470
+ } else
1471
+ n();
1472
+ }
1473
+ function es(e, t, r) {
1474
+ if ((e.f & he) === 0) {
1475
+ e.f ^= he;
1476
+ var s = e.nodes && e.nodes.t;
1477
+ if (s !== null)
1478
+ for (const l of s)
1479
+ (l.is_global || r) && t.push(l);
1480
+ for (var n = e.first; n !== null; ) {
1481
+ var i = n.next, o = (n.f & wt) !== 0 || // If this is a branch effect without a block effect parent,
1482
+ // it means the parent block effect was pruned. In that case,
1483
+ // transparency information was transferred to the branch effect.
1484
+ (n.f & _e) !== 0 && (e.f & Te) !== 0;
1485
+ es(n, t, o ? r : !1), n = i;
1486
+ }
1487
+ }
1488
+ }
1489
+ function Gi(e) {
1490
+ ts(e, !0);
1491
+ }
1492
+ function ts(e, t) {
1493
+ if ((e.f & he) !== 0) {
1494
+ e.f ^= he, (e.f & C) === 0 && (O(e, F), Se(e));
1495
+ for (var r = e.first; r !== null; ) {
1496
+ var s = r.next, n = (r.f & wt) !== 0 || (r.f & _e) !== 0;
1497
+ ts(r, n ? t : !1), r = s;
1498
+ }
1499
+ var i = e.nodes && e.nodes.t;
1500
+ if (i !== null)
1501
+ for (const o of i)
1502
+ (o.is_global || t) && o.in();
1503
+ }
1504
+ }
1505
+ function rs(e, t) {
1506
+ if (e.nodes)
1507
+ for (var r = e.nodes.start, s = e.nodes.end; r !== null; ) {
1508
+ var n = r === s ? null : /* @__PURE__ */ Ae(r);
1509
+ t.append(r), r = n;
1510
+ }
1511
+ }
1512
+ let Xt = !1, Le = !1;
1513
+ function ln(e) {
1514
+ Le = e;
1515
+ }
1516
+ let m = null, oe = !1;
1517
+ function ne(e) {
1518
+ m = e;
1519
+ }
1520
+ let y = null;
1521
+ function ve(e) {
1522
+ y = e;
1523
+ }
1524
+ let te = null;
1525
+ function ns(e) {
1526
+ m !== null && (te === null ? te = [e] : te.push(e));
1527
+ }
1528
+ let Y = null, G = 0, J = null;
1529
+ function Ui(e) {
1530
+ J = e;
1531
+ }
1532
+ let ss = 1, Ye = 0, Xe = Ye;
1533
+ function an(e) {
1534
+ Xe = e;
1535
+ }
1536
+ function is() {
1537
+ return ++ss;
1538
+ }
1539
+ function Dt(e) {
1540
+ var t = e.f;
1541
+ if ((t & F) !== 0)
1542
+ return !0;
1543
+ if (t & I && (e.f &= ~Je), (t & Pe) !== 0) {
1544
+ for (var r = (
1545
+ /** @type {Value[]} */
1546
+ e.deps
1547
+ ), s = r.length, n = 0; n < s; n++) {
1548
+ var i = r[n];
1549
+ if (Dt(
1550
+ /** @type {Derived} */
1551
+ i
1552
+ ) && jn(
1553
+ /** @type {Derived} */
1554
+ i
1555
+ ), i.wv > e.wv)
1556
+ return !0;
1557
+ }
1558
+ (t & ee) !== 0 && // During time traveling we don't want to reset the status so that
1559
+ // traversal of the graph in the other batches still happens
1560
+ ie === null && O(e, C);
1561
+ }
1562
+ return !1;
1563
+ }
1564
+ function os(e, t, r = !0) {
1565
+ var s = e.reactions;
1566
+ if (s !== null && !(te !== null && gt.call(te, e)))
1567
+ for (var n = 0; n < s.length; n++) {
1568
+ var i = s[n];
1569
+ (i.f & I) !== 0 ? os(
1570
+ /** @type {Derived} */
1571
+ i,
1572
+ t,
1573
+ !1
1574
+ ) : t === i && (r ? O(i, F) : (i.f & C) !== 0 && O(i, Pe), Se(
1575
+ /** @type {Effect} */
1576
+ i
1577
+ ));
1578
+ }
1579
+ }
1580
+ function ls(e) {
1581
+ var z;
1582
+ var t = Y, r = G, s = J, n = m, i = te, o = K, l = oe, f = Xe, u = e.f;
1583
+ Y = /** @type {null | Value[]} */
1584
+ null, G = 0, J = null, m = (u & (_e | De)) === 0 ? e : null, te = null, bt(e.ctx), oe = !1, Xe = ++Ye, e.ac !== null && (Hn(() => {
1585
+ e.ac.abort(ot);
1586
+ }), e.ac = null);
1587
+ try {
1588
+ e.f |= xr;
1589
+ var d = (
1590
+ /** @type {Function} */
1591
+ e.fn
1592
+ ), v = d(), c = e.deps, p = T?.is_fork;
1593
+ if (Y !== null) {
1594
+ var w;
1595
+ if (p || rr(e, G), c !== null && G > 0)
1596
+ for (c.length = G + Y.length, w = 0; w < Y.length; w++)
1597
+ c[G + w] = Y[w];
1598
+ else
1599
+ e.deps = c = Y;
1600
+ if (Yr() && (e.f & ee) !== 0)
1601
+ for (w = G; w < c.length; w++)
1602
+ ((z = c[w]).reactions ?? (z.reactions = [])).push(e);
1603
+ } else !p && c !== null && G < c.length && (rr(e, G), c.length = G);
1604
+ if (Tn() && J !== null && !oe && c !== null && (e.f & (I | Pe | F)) === 0)
1605
+ for (w = 0; w < /** @type {Source[]} */
1606
+ J.length; w++)
1607
+ os(
1608
+ J[w],
1609
+ /** @type {Effect} */
1610
+ e
1611
+ );
1612
+ if (n !== null && n !== e) {
1613
+ if (Ye++, n.deps !== null)
1614
+ for (let S = 0; S < r; S += 1)
1615
+ n.deps[S].rv = Ye;
1616
+ if (t !== null)
1617
+ for (const S of t)
1618
+ S.rv = Ye;
1619
+ J !== null && (s === null ? s = J : s.push(.../** @type {Source[]} */
1620
+ J));
1621
+ }
1622
+ return (e.f & Ce) !== 0 && (e.f ^= Ce), v;
1623
+ } catch (S) {
1624
+ return An(S);
1625
+ } finally {
1626
+ e.f ^= xr, Y = t, G = r, J = s, m = n, te = i, bt(o), oe = l, Xe = f;
1627
+ }
1628
+ }
1629
+ function Hi(e, t) {
1630
+ let r = t.reactions;
1631
+ if (r !== null) {
1632
+ var s = Ks.call(r, e);
1633
+ if (s !== -1) {
1634
+ var n = r.length - 1;
1635
+ n === 0 ? r = t.reactions = null : (r[s] = r[n], r.pop());
1636
+ }
1637
+ }
1638
+ if (r === null && (t.f & I) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1639
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1640
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1641
+ (Y === null || !gt.call(Y, t))) {
1642
+ var i = (
1643
+ /** @type {Derived} */
1644
+ t
1645
+ );
1646
+ (i.f & ee) !== 0 && (i.f ^= ee, i.f &= ~Je), Br(i), Bn(i), rr(i, 0);
1647
+ }
1648
+ }
1649
+ function rr(e, t) {
1650
+ var r = e.deps;
1651
+ if (r !== null)
1652
+ for (var s = t; s < r.length; s++)
1653
+ Hi(e, r[s]);
1654
+ }
1655
+ function Pt(e) {
1656
+ var t = e.f;
1657
+ if ((t & Ee) === 0) {
1658
+ O(e, C);
1659
+ var r = y, s = Xt;
1660
+ y = e, Xt = !0;
1661
+ try {
1662
+ (t & (Te | yn)) !== 0 ? Yi(e) : Qn(e), Jn(e);
1663
+ var n = ls(e);
1664
+ e.teardown = typeof n == "function" ? n : null, e.wv = ss;
1665
+ var i;
1666
+ mr && bi && (e.f & F) !== 0 && e.deps;
1667
+ } finally {
1668
+ Xt = s, y = r;
1669
+ }
1670
+ }
1671
+ }
1672
+ function h(e) {
1673
+ var t = e.f, r = (t & I) !== 0;
1674
+ if (m !== null && !oe) {
1675
+ var s = y !== null && (y.f & Ee) !== 0;
1676
+ if (!s && (te === null || !gt.call(te, e))) {
1677
+ var n = m.deps;
1678
+ if ((m.f & xr) !== 0)
1679
+ e.rv < Ye && (e.rv = Ye, Y === null && n !== null && n[G] === e ? G++ : Y === null ? Y = [e] : Y.push(e));
1680
+ else {
1681
+ (m.deps ?? (m.deps = [])).push(e);
1682
+ var i = e.reactions;
1683
+ i === null ? e.reactions = [m] : gt.call(i, m) || i.push(m);
1684
+ }
1685
+ }
1686
+ }
1687
+ if (Le && Me.has(e))
1688
+ return Me.get(e);
1689
+ if (r) {
1690
+ var o = (
1691
+ /** @type {Derived} */
1692
+ e
1693
+ );
1694
+ if (Le) {
1695
+ var l = o.v;
1696
+ return ((o.f & C) === 0 && o.reactions !== null || fs(o)) && (l = Vr(o)), Me.set(o, l), l;
1697
+ }
1698
+ var f = (o.f & ee) === 0 && !oe && m !== null && (Xt || (m.f & ee) !== 0), u = o.deps === null;
1699
+ Dt(o) && (f && (o.f |= ee), jn(o)), f && !u && as(o);
1700
+ }
1701
+ if (ie?.has(e))
1702
+ return ie.get(e);
1703
+ if ((e.f & Ce) !== 0)
1704
+ throw e.v;
1705
+ return e.v;
1706
+ }
1707
+ function as(e) {
1708
+ if (e.deps !== null) {
1709
+ e.f |= ee;
1710
+ for (const t of e.deps)
1711
+ (t.reactions ?? (t.reactions = [])).push(e), (t.f & I) !== 0 && (t.f & ee) === 0 && as(
1712
+ /** @type {Derived} */
1713
+ t
1714
+ );
1715
+ }
1716
+ }
1717
+ function fs(e) {
1718
+ if (e.v === M) return !0;
1719
+ if (e.deps === null) return !1;
1720
+ for (const t of e.deps)
1721
+ if (Me.has(t) || (t.f & I) !== 0 && fs(
1722
+ /** @type {Derived} */
1723
+ t
1724
+ ))
1725
+ return !0;
1726
+ return !1;
1727
+ }
1728
+ function Gr(e) {
1729
+ var t = oe;
1730
+ try {
1731
+ return oe = !0, e();
1732
+ } finally {
1733
+ oe = t;
1734
+ }
1735
+ }
1736
+ const us = /* @__PURE__ */ new Set(), Rr = /* @__PURE__ */ new Set();
1737
+ function Wi(e) {
1738
+ for (var t = 0; t < e.length; t++)
1739
+ us.add(e[t]);
1740
+ for (var r of Rr)
1741
+ r(e);
1742
+ }
1743
+ let fn = null;
1744
+ function qt(e) {
1745
+ var t = this, r = (
1746
+ /** @type {Node} */
1747
+ t.ownerDocument
1748
+ ), s = e.type, n = e.composedPath?.() || [], i = (
1749
+ /** @type {null | Element} */
1750
+ n[0] || e.target
1751
+ );
1752
+ fn = e;
1753
+ var o = 0, l = fn === e && e.__root;
1754
+ if (l) {
1755
+ var f = n.indexOf(l);
1756
+ if (f !== -1 && (t === document || t === /** @type {any} */
1757
+ window)) {
1758
+ e.__root = t;
1759
+ return;
1760
+ }
1761
+ var u = n.indexOf(t);
1762
+ if (u === -1)
1763
+ return;
1764
+ f <= u && (o = f);
1765
+ }
1766
+ if (i = /** @type {Element} */
1767
+ n[o] || e.target, i !== t) {
1768
+ Zt(e, "currentTarget", {
1769
+ configurable: !0,
1770
+ get() {
1771
+ return i || r;
1772
+ }
1773
+ });
1774
+ var d = m, v = y;
1775
+ ne(null), ve(null);
1776
+ try {
1777
+ for (var c, p = []; i !== null; ) {
1778
+ var w = i.assignedSlot || i.parentNode || /** @type {any} */
1779
+ i.host || null;
1780
+ try {
1781
+ var z = i["__" + s];
1782
+ z != null && (!/** @type {any} */
1783
+ i.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1784
+ // -> the target could not have been disabled because it emits the event in the first place
1785
+ e.target === i) && z.call(i, e);
1786
+ } catch (S) {
1787
+ c ? p.push(S) : c = S;
1788
+ }
1789
+ if (e.cancelBubble || w === t || w === null)
1790
+ break;
1791
+ i = w;
1792
+ }
1793
+ if (c) {
1794
+ for (let S of p)
1795
+ queueMicrotask(() => {
1796
+ throw S;
1797
+ });
1798
+ throw c;
1799
+ }
1800
+ } finally {
1801
+ e.__root = t, delete e.currentTarget, ne(d), ve(v);
1802
+ }
1803
+ }
1804
+ }
1805
+ function Ki(e) {
1806
+ var t = document.createElement("template");
1807
+ return t.innerHTML = e.replaceAll("<!>", "<!---->"), t.content;
1808
+ }
1809
+ function Ie(e, t) {
1810
+ var r = (
1811
+ /** @type {Effect} */
1812
+ y
1813
+ );
1814
+ r.nodes === null && (r.nodes = { start: e, end: t, a: null, t: null });
1815
+ }
1816
+ // @__NO_SIDE_EFFECTS__
1817
+ function we(e, t) {
1818
+ var r = (t & Gs) !== 0, s = (t & Us) !== 0, n, i = !e.startsWith("<!>");
1819
+ return () => {
1820
+ if (E)
1821
+ return Ie($, null), $;
1822
+ n === void 0 && (n = Ki(i ? e : "<!>" + e), r || (n = /** @type {TemplateNode} */
1823
+ /* @__PURE__ */ xt(n)));
1824
+ var o = (
1825
+ /** @type {TemplateNode} */
1826
+ s || qn ? document.importNode(n, !0) : n.cloneNode(!0)
1827
+ );
1828
+ if (r) {
1829
+ var l = (
1830
+ /** @type {TemplateNode} */
1831
+ /* @__PURE__ */ xt(o)
1832
+ ), f = (
1833
+ /** @type {TemplateNode} */
1834
+ o.lastChild
1835
+ );
1836
+ Ie(l, f);
1837
+ } else
1838
+ Ie(o, o);
1839
+ return o;
1840
+ };
1841
+ }
1842
+ function Xi(e = "") {
1843
+ if (!E) {
1844
+ var t = le(e + "");
1845
+ return Ie(t, t), t;
1846
+ }
1847
+ var r = $;
1848
+ return r.nodeType !== Mt ? (r.before(r = le()), re(r)) : fr(
1849
+ /** @type {Text} */
1850
+ r
1851
+ ), Ie(r, r), r;
1852
+ }
1853
+ function un() {
1854
+ if (E)
1855
+ return Ie($, null), $;
1856
+ var e = document.createDocumentFragment(), t = document.createComment(""), r = le();
1857
+ return e.append(t, r), Ie(t, r), e;
1858
+ }
1859
+ function j(e, t) {
1860
+ if (E) {
1861
+ var r = (
1862
+ /** @type {Effect & { nodes: EffectNodes }} */
1863
+ y
1864
+ );
1865
+ ((r.f & or) === 0 || r.nodes.end === null) && (r.nodes.end = $), Fr();
1866
+ return;
1867
+ }
1868
+ e !== null && e.before(
1869
+ /** @type {Node} */
1870
+ t
1871
+ );
1872
+ }
1873
+ const Ji = ["touchstart", "touchmove"];
1874
+ function Qi(e) {
1875
+ return Ji.includes(e);
1876
+ }
1877
+ function Gt(e, t) {
1878
+ var r = t == null ? "" : typeof t == "object" ? t + "" : t;
1879
+ r !== (e.__t ?? (e.__t = e.nodeValue)) && (e.__t = r, e.nodeValue = r + "");
1880
+ }
1881
+ function cs(e, t) {
1882
+ return ds(e, t);
1883
+ }
1884
+ function Zi(e, t) {
1885
+ Ar(), t.intro = t.intro ?? !1;
1886
+ const r = t.target, s = E, n = $;
1887
+ try {
1888
+ for (var i = /* @__PURE__ */ xt(r); i && (i.nodeType !== It || /** @type {Comment} */
1889
+ i.data !== wn); )
1890
+ i = /* @__PURE__ */ Ae(i);
1891
+ if (!i)
1892
+ throw _t;
1893
+ lt(!0), re(
1894
+ /** @type {Comment} */
1895
+ i
1896
+ );
1897
+ const o = ds(e, { ...t, anchor: i });
1898
+ return lt(!1), /** @type {Exports} */
1899
+ o;
1900
+ } catch (o) {
1901
+ if (o instanceof Error && o.message.split(`
1902
+ `).some((l) => l.startsWith("https://svelte.dev/e/")))
1903
+ throw o;
1904
+ return o !== _t && console.warn("Failed to hydrate: ", o), t.recover === !1 && ui(), Ar(), Ni(r), lt(!1), cs(e, t);
1905
+ } finally {
1906
+ lt(s), re(n);
1907
+ }
1908
+ }
1909
+ const it = /* @__PURE__ */ new Map();
1910
+ function ds(e, { target: t, anchor: r, props: s = {}, events: n, context: i, intro: o = !0 }) {
1911
+ Ar();
1912
+ var l = /* @__PURE__ */ new Set(), f = (v) => {
1913
+ for (var c = 0; c < v.length; c++) {
1914
+ var p = v[c];
1915
+ if (!l.has(p)) {
1916
+ l.add(p);
1917
+ var w = Qi(p);
1918
+ t.addEventListener(p, qt, { passive: w });
1919
+ var z = it.get(p);
1920
+ z === void 0 ? (document.addEventListener(p, qt, { passive: w }), it.set(p, 1)) : it.set(p, z + 1);
1921
+ }
1922
+ }
1923
+ };
1924
+ f(Xs(us)), Rr.add(f);
1925
+ var u = void 0, d = ji(() => {
1926
+ var v = r ?? t.appendChild(le());
1927
+ return Ei(
1928
+ /** @type {TemplateNode} */
1929
+ v,
1930
+ {
1931
+ pending: () => {
1932
+ }
1933
+ },
1934
+ (c) => {
1935
+ if (i) {
1936
+ zn({});
1937
+ var p = (
1938
+ /** @type {ComponentContext} */
1939
+ K
1940
+ );
1941
+ p.c = i;
1942
+ }
1943
+ if (n && (s.$$events = n), E && Ie(
1944
+ /** @type {TemplateNode} */
1945
+ c,
1946
+ null
1947
+ ), u = e(c, s) || {}, E && (y.nodes.end = $, $ === null || $.nodeType !== It || /** @type {Comment} */
1948
+ $.data !== bn))
1949
+ throw lr(), _t;
1950
+ i && Sn();
1951
+ }
1952
+ ), () => {
1953
+ for (var c of l) {
1954
+ t.removeEventListener(c, qt);
1955
+ var p = (
1956
+ /** @type {number} */
1957
+ it.get(c)
1958
+ );
1959
+ --p === 0 ? (document.removeEventListener(c, qt), it.delete(c)) : it.set(c, p);
1960
+ }
1961
+ Rr.delete(f), v !== r && v.parentNode?.removeChild(v);
1962
+ };
1963
+ });
1964
+ return Cr.set(u, d), u;
1965
+ }
1966
+ let Cr = /* @__PURE__ */ new WeakMap();
1967
+ function eo(e, t) {
1968
+ const r = Cr.get(e);
1969
+ return r ? (Cr.delete(e), r(t)) : Promise.resolve();
1970
+ }
1971
+ var se, de, H, Ke, Ct, Nt, sr;
1972
+ class to {
1973
+ /**
1974
+ * @param {TemplateNode} anchor
1975
+ * @param {boolean} transition
1976
+ */
1977
+ constructor(t, r = !0) {
1978
+ /** @type {TemplateNode} */
1979
+ k(this, "anchor");
1980
+ /** @type {Map<Batch, Key>} */
1981
+ b(this, se, /* @__PURE__ */ new Map());
1982
+ /**
1983
+ * Map of keys to effects that are currently rendered in the DOM.
1984
+ * These effects are visible and actively part of the document tree.
1985
+ * Example:
1986
+ * ```
1987
+ * {#if condition}
1988
+ * foo
1989
+ * {:else}
1990
+ * bar
1991
+ * {/if}
1992
+ * ```
1993
+ * Can result in the entries `true->Effect` and `false->Effect`
1994
+ * @type {Map<Key, Effect>}
1995
+ */
1996
+ b(this, de, /* @__PURE__ */ new Map());
1997
+ /**
1998
+ * Similar to #onscreen with respect to the keys, but contains branches that are not yet
1999
+ * in the DOM, because their insertion is deferred.
2000
+ * @type {Map<Key, Branch>}
2001
+ */
2002
+ b(this, H, /* @__PURE__ */ new Map());
2003
+ /**
2004
+ * Keys of effects that are currently outroing
2005
+ * @type {Set<Key>}
2006
+ */
2007
+ b(this, Ke, /* @__PURE__ */ new Set());
2008
+ /**
2009
+ * Whether to pause (i.e. outro) on change, or destroy immediately.
2010
+ * This is necessary for `<svelte:element>`
2011
+ */
2012
+ b(this, Ct, !0);
2013
+ b(this, Nt, () => {
2014
+ var t = (
2015
+ /** @type {Batch} */
2016
+ T
2017
+ );
2018
+ if (a(this, se).has(t)) {
2019
+ var r = (
2020
+ /** @type {Key} */
2021
+ a(this, se).get(t)
2022
+ ), s = a(this, de).get(r);
2023
+ if (s)
2024
+ Gi(s), a(this, Ke).delete(r);
2025
+ else {
2026
+ var n = a(this, H).get(r);
2027
+ n && (a(this, de).set(r, n.effect), a(this, H).delete(r), n.fragment.lastChild.remove(), this.anchor.before(n.fragment), s = n.effect);
2028
+ }
2029
+ for (const [i, o] of a(this, se)) {
2030
+ if (a(this, se).delete(i), i === t)
2031
+ break;
2032
+ const l = a(this, H).get(o);
2033
+ l && (q(l.effect), a(this, H).delete(o));
2034
+ }
2035
+ for (const [i, o] of a(this, de)) {
2036
+ if (i === r || a(this, Ke).has(i)) continue;
2037
+ const l = () => {
2038
+ if (Array.from(a(this, se).values()).includes(i)) {
2039
+ var u = document.createDocumentFragment();
2040
+ rs(o, u), u.append(le()), a(this, H).set(i, { effect: o, fragment: u });
2041
+ } else
2042
+ q(o);
2043
+ a(this, Ke).delete(i), a(this, de).delete(i);
2044
+ };
2045
+ a(this, Ct) || !s ? (a(this, Ke).add(i), Tt(o, l, !1)) : l();
2046
+ }
2047
+ }
2048
+ });
2049
+ /**
2050
+ * @param {Batch} batch
2051
+ */
2052
+ b(this, sr, (t) => {
2053
+ a(this, se).delete(t);
2054
+ const r = Array.from(a(this, se).values());
2055
+ for (const [s, n] of a(this, H))
2056
+ r.includes(s) || (q(n.effect), a(this, H).delete(s));
2057
+ });
2058
+ this.anchor = t, g(this, Ct, r);
2059
+ }
2060
+ /**
2061
+ *
2062
+ * @param {any} key
2063
+ * @param {null | ((target: TemplateNode) => void)} fn
2064
+ */
2065
+ ensure(t, r) {
2066
+ var s = (
2067
+ /** @type {Batch} */
2068
+ T
2069
+ ), n = Mi();
2070
+ if (r && !a(this, de).has(t) && !a(this, H).has(t))
2071
+ if (n) {
2072
+ var i = document.createDocumentFragment(), o = le();
2073
+ i.append(o), a(this, H).set(t, {
2074
+ effect: me(() => r(o)),
2075
+ fragment: i
2076
+ });
2077
+ } else
2078
+ a(this, de).set(
2079
+ t,
2080
+ me(() => r(this.anchor))
2081
+ );
2082
+ if (a(this, se).set(s, t), n) {
2083
+ for (const [l, f] of a(this, de))
2084
+ l === t ? s.skipped_effects.delete(f) : s.skipped_effects.add(f);
2085
+ for (const [l, f] of a(this, H))
2086
+ l === t ? s.skipped_effects.delete(f.effect) : s.skipped_effects.add(f.effect);
2087
+ s.oncommit(a(this, Nt)), s.ondiscard(a(this, sr));
2088
+ } else
2089
+ E && (this.anchor = $), a(this, Nt).call(this);
2090
+ }
2091
+ }
2092
+ se = new WeakMap(), de = new WeakMap(), H = new WeakMap(), Ke = new WeakMap(), Ct = new WeakMap(), Nt = new WeakMap(), sr = new WeakMap();
2093
+ function ro(e) {
2094
+ K === null && si(), Or(() => {
2095
+ const t = Gr(e);
2096
+ if (typeof t == "function") return (
2097
+ /** @type {() => void} */
2098
+ t
2099
+ );
2100
+ });
2101
+ }
2102
+ function Be(e, t, r = !1) {
2103
+ E && Fr();
2104
+ var s = new to(e), n = r ? wt : 0;
2105
+ function i(o, l) {
2106
+ if (E) {
2107
+ const u = _i(e) === Ir;
2108
+ if (o === u) {
2109
+ var f = $n();
2110
+ re(f), s.anchor = f, lt(!1), s.ensure(o, l), lt(!0);
2111
+ return;
2112
+ }
2113
+ }
2114
+ s.ensure(o, l);
2115
+ }
2116
+ Xn(() => {
2117
+ var o = !1;
2118
+ t((l, f = !0) => {
2119
+ o = !0, i(f, l);
2120
+ }), o || i(!1, null);
2121
+ }, n);
2122
+ }
2123
+ function no(e, t) {
2124
+ Kn(() => {
2125
+ var r = e.getRootNode(), s = (
2126
+ /** @type {ShadowRoot} */
2127
+ r.host ? (
2128
+ /** @type {ShadowRoot} */
2129
+ r
2130
+ ) : (
2131
+ /** @type {Document} */
2132
+ r.head ?? /** @type {Document} */
2133
+ r.ownerDocument.head
2134
+ )
2135
+ );
2136
+ if (!s.querySelector("#" + t.hash)) {
2137
+ const n = document.createElement("style");
2138
+ n.id = t.hash, n.textContent = t.code, s.appendChild(n);
2139
+ }
2140
+ });
2141
+ }
2142
+ const cn = [...`
2143
+ \r\f \v\uFEFF`];
2144
+ function so(e, t, r) {
2145
+ var s = "" + e;
2146
+ if (r) {
2147
+ for (var n in r)
2148
+ if (r[n])
2149
+ s = s ? s + " " + n : n;
2150
+ else if (s.length)
2151
+ for (var i = n.length, o = 0; (o = s.indexOf(n, o)) >= 0; ) {
2152
+ var l = o + i;
2153
+ (o === 0 || cn.includes(s[o - 1])) && (l === s.length || cn.includes(s[l])) ? s = (o === 0 ? "" : s.substring(0, o)) + s.substring(l + 1) : o = l;
2154
+ }
2155
+ }
2156
+ return s === "" ? null : s;
2157
+ }
2158
+ function io(e, t) {
2159
+ return e == null ? null : String(e);
2160
+ }
2161
+ function oo(e, t, r, s, n, i) {
2162
+ var o = e.__className;
2163
+ if (E || o !== r || o === void 0) {
2164
+ var l = so(r, s, i);
2165
+ (!E || l !== e.getAttribute("class")) && (l == null ? e.removeAttribute("class") : e.className = l), e.__className = r;
2166
+ } else if (i && n !== i)
2167
+ for (var f in i) {
2168
+ var u = !!i[f];
2169
+ (n == null || u !== !!n[f]) && e.classList.toggle(f, u);
2170
+ }
2171
+ return i;
2172
+ }
2173
+ function lo(e, t, r, s) {
2174
+ var n = e.__style;
2175
+ if (E || n !== t) {
2176
+ var i = io(t);
2177
+ (!E || i !== e.getAttribute("style")) && (i == null ? e.removeAttribute("style") : e.style.cssText = i), e.__style = t;
2178
+ }
2179
+ return s;
2180
+ }
2181
+ const ao = /* @__PURE__ */ Symbol("is custom element"), fo = /* @__PURE__ */ Symbol("is html");
2182
+ function uo(e) {
2183
+ if (E) {
2184
+ var t = !1, r = () => {
2185
+ if (!t) {
2186
+ if (t = !0, e.hasAttribute("value")) {
2187
+ var s = e.value;
2188
+ Nr(e, "value", null), e.value = s;
2189
+ }
2190
+ if (e.hasAttribute("checked")) {
2191
+ var n = e.checked;
2192
+ Nr(e, "checked", null), e.checked = n;
2193
+ }
2194
+ }
2195
+ };
2196
+ e.__on_r = r, Ne(r), Ii();
2197
+ }
2198
+ }
2199
+ function co(e, t) {
2200
+ var r = hs(e);
2201
+ r.value === (r.value = // treat null and undefined the same for the initial value
2202
+ t ?? void 0) || // @ts-expect-error
2203
+ // `progress` elements always need their value set when it's `0`
2204
+ e.value === t && (t !== 0 || e.nodeName !== "PROGRESS") || (e.value = t ?? "");
2205
+ }
2206
+ function Nr(e, t, r, s) {
2207
+ var n = hs(e);
2208
+ E && (n[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === "LINK") || n[t] !== (n[t] = r) && (t === "loading" && (e[ni] = r), r == null ? e.removeAttribute(t) : typeof r != "string" && ho(e).includes(t) ? e[t] = r : e.setAttribute(t, r));
2209
+ }
2210
+ function hs(e) {
2211
+ return (
2212
+ /** @type {Record<string | symbol, unknown>} **/
2213
+ // @ts-expect-error
2214
+ e.__attributes ?? (e.__attributes = {
2215
+ [ao]: e.nodeName.includes("-"),
2216
+ [fo]: e.namespaceURI === Hs
2217
+ })
2218
+ );
2219
+ }
2220
+ var dn = /* @__PURE__ */ new Map();
2221
+ function ho(e) {
2222
+ var t = e.getAttribute("is") || e.nodeName, r = dn.get(t);
2223
+ if (r) return r;
2224
+ dn.set(t, r = []);
2225
+ for (var s, n = e, i = Element.prototype; i !== n; ) {
2226
+ s = Js(n);
2227
+ for (var o in s)
2228
+ s[o].set && r.push(o);
2229
+ n = mn(n);
2230
+ }
2231
+ return r;
2232
+ }
2233
+ function hn(e, t) {
2234
+ return e === t || e?.[Ht] === t;
2235
+ }
2236
+ function vo(e = {}, t, r, s) {
2237
+ return Kn(() => {
2238
+ var n, i;
2239
+ return qr(() => {
2240
+ n = i, i = [], Gr(() => {
2241
+ e !== r(...i) && (t(e, ...i), n && hn(r(...n), e) && t(null, ...n));
2242
+ });
2243
+ }), () => {
2244
+ Ne(() => {
2245
+ i && hn(r(...i), e) && t(null, ...i);
2246
+ });
2247
+ };
2248
+ }), e;
2249
+ }
2250
+ function Ut(e, t, r, s) {
2251
+ var n = (
2252
+ /** @type {V} */
2253
+ s
2254
+ ), i = !0, o = () => (i && (i = !1, n = /** @type {V} */
2255
+ s), n), l;
2256
+ l = /** @type {V} */
2257
+ e[t], l === void 0 && s !== void 0 && (l = o());
2258
+ var f;
2259
+ f = () => {
2260
+ var c = (
2261
+ /** @type {V} */
2262
+ e[t]
2263
+ );
2264
+ return c === void 0 ? o() : (i = !0, c);
2265
+ };
2266
+ var u = !1, d = /* @__PURE__ */ jr(() => (u = !1, f())), v = (
2267
+ /** @type {Effect} */
2268
+ y
2269
+ );
2270
+ return (
2271
+ /** @type {() => V} */
2272
+ (function(c, p) {
2273
+ if (arguments.length > 0) {
2274
+ const w = p ? h(d) : c;
2275
+ return x(d, w), u = !0, n !== void 0 && (n = w), c;
2276
+ }
2277
+ return Le && u || (v.f & Ee) !== 0 ? d.v : h(d);
2278
+ })
2279
+ );
2280
+ }
2281
+ function po(e) {
2282
+ return new _o(e);
2283
+ }
2284
+ var $e, Z;
2285
+ class _o {
2286
+ /**
2287
+ * @param {ComponentConstructorOptions & {
2288
+ * component: any;
2289
+ * }} options
2290
+ */
2291
+ constructor(t) {
2292
+ /** @type {any} */
2293
+ b(this, $e);
2294
+ /** @type {Record<string, any>} */
2295
+ b(this, Z);
2296
+ var r = /* @__PURE__ */ new Map(), s = (i, o) => {
2297
+ var l = /* @__PURE__ */ Ri(o, !1, !1);
2298
+ return r.set(i, l), l;
2299
+ };
2300
+ const n = new Proxy(
2301
+ { ...t.props || {}, $$events: {} },
2302
+ {
2303
+ get(i, o) {
2304
+ return h(r.get(o) ?? s(o, Reflect.get(i, o)));
2305
+ },
2306
+ has(i, o) {
2307
+ return o === ri ? !0 : (h(r.get(o) ?? s(o, Reflect.get(i, o))), Reflect.has(i, o));
2308
+ },
2309
+ set(i, o, l) {
2310
+ return x(r.get(o) ?? s(o, l), l), Reflect.set(i, o, l);
2311
+ }
2312
+ }
2313
+ );
2314
+ g(this, Z, (t.hydrate ? Zi : cs)(t.component, {
2315
+ target: t.target,
2316
+ anchor: t.anchor,
2317
+ props: n,
2318
+ context: t.context,
2319
+ intro: t.intro ?? !1,
2320
+ recover: t.recover
2321
+ })), (!t?.props?.$$host || t.sync === !1) && Et(), g(this, $e, n.$$events);
2322
+ for (const i of Object.keys(a(this, Z)))
2323
+ i === "$set" || i === "$destroy" || i === "$on" || Zt(this, i, {
2324
+ get() {
2325
+ return a(this, Z)[i];
2326
+ },
2327
+ /** @param {any} value */
2328
+ set(o) {
2329
+ a(this, Z)[i] = o;
2330
+ },
2331
+ enumerable: !0
2332
+ });
2333
+ a(this, Z).$set = /** @param {Record<string, any>} next */
2334
+ (i) => {
2335
+ Object.assign(n, i);
2336
+ }, a(this, Z).$destroy = () => {
2337
+ eo(a(this, Z));
2338
+ };
2339
+ }
2340
+ /** @param {Record<string, any>} props */
2341
+ $set(t) {
2342
+ a(this, Z).$set(t);
2343
+ }
2344
+ /**
2345
+ * @param {string} event
2346
+ * @param {(...args: any[]) => any} callback
2347
+ * @returns {any}
2348
+ */
2349
+ $on(t, r) {
2350
+ a(this, $e)[t] = a(this, $e)[t] || [];
2351
+ const s = (...n) => r.call(this, ...n);
2352
+ return a(this, $e)[t].push(s), () => {
2353
+ a(this, $e)[t] = a(this, $e)[t].filter(
2354
+ /** @param {any} fn */
2355
+ (n) => n !== s
2356
+ );
2357
+ };
2358
+ }
2359
+ $destroy() {
2360
+ a(this, Z).$destroy();
2361
+ }
2362
+ }
2363
+ $e = new WeakMap(), Z = new WeakMap();
2364
+ let vs;
2365
+ typeof HTMLElement == "function" && (vs = class extends HTMLElement {
2366
+ /**
2367
+ * @param {*} $$componentCtor
2368
+ * @param {*} $$slots
2369
+ * @param {ShadowRootInit | undefined} shadow_root_init
2370
+ */
2371
+ constructor(t, r, s) {
2372
+ super();
2373
+ /** The Svelte component constructor */
2374
+ k(this, "$$ctor");
2375
+ /** Slots */
2376
+ k(this, "$$s");
2377
+ /** @type {any} The Svelte component instance */
2378
+ k(this, "$$c");
2379
+ /** Whether or not the custom element is connected */
2380
+ k(this, "$$cn", !1);
2381
+ /** @type {Record<string, any>} Component props data */
2382
+ k(this, "$$d", {});
2383
+ /** `true` if currently in the process of reflecting component props back to attributes */
2384
+ k(this, "$$r", !1);
2385
+ /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
2386
+ k(this, "$$p_d", {});
2387
+ /** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
2388
+ k(this, "$$l", {});
2389
+ /** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
2390
+ k(this, "$$l_u", /* @__PURE__ */ new Map());
2391
+ /** @type {any} The managed render effect for reflecting attributes */
2392
+ k(this, "$$me");
2393
+ /** @type {ShadowRoot | null} The ShadowRoot of the custom element */
2394
+ k(this, "$$shadowRoot", null);
2395
+ this.$$ctor = t, this.$$s = r, s && (this.$$shadowRoot = this.attachShadow(s));
2396
+ }
2397
+ /**
2398
+ * @param {string} type
2399
+ * @param {EventListenerOrEventListenerObject} listener
2400
+ * @param {boolean | AddEventListenerOptions} [options]
2401
+ */
2402
+ addEventListener(t, r, s) {
2403
+ if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(r), this.$$c) {
2404
+ const n = this.$$c.$on(t, r);
2405
+ this.$$l_u.set(r, n);
2406
+ }
2407
+ super.addEventListener(t, r, s);
2408
+ }
2409
+ /**
2410
+ * @param {string} type
2411
+ * @param {EventListenerOrEventListenerObject} listener
2412
+ * @param {boolean | AddEventListenerOptions} [options]
2413
+ */
2414
+ removeEventListener(t, r, s) {
2415
+ if (super.removeEventListener(t, r, s), this.$$c) {
2416
+ const n = this.$$l_u.get(r);
2417
+ n && (n(), this.$$l_u.delete(r));
2418
+ }
2419
+ }
2420
+ async connectedCallback() {
2421
+ if (this.$$cn = !0, !this.$$c) {
2422
+ let t = function(n) {
2423
+ return (i) => {
2424
+ const o = document.createElement("slot");
2425
+ n !== "default" && (o.name = n), j(i, o);
2426
+ };
2427
+ };
2428
+ if (await Promise.resolve(), !this.$$cn || this.$$c)
2429
+ return;
2430
+ const r = {}, s = go(this);
2431
+ for (const n of this.$$s)
2432
+ n in s && (n === "default" && !this.$$d.children ? (this.$$d.children = t(n), r.default = !0) : r[n] = t(n));
2433
+ for (const n of this.attributes) {
2434
+ const i = this.$$g_p(n.name);
2435
+ i in this.$$d || (this.$$d[i] = Jt(i, n.value, this.$$p_d, "toProp"));
2436
+ }
2437
+ for (const n in this.$$p_d)
2438
+ !(n in this.$$d) && this[n] !== void 0 && (this.$$d[n] = this[n], delete this[n]);
2439
+ this.$$c = po({
2440
+ component: this.$$ctor,
2441
+ target: this.$$shadowRoot || this,
2442
+ props: {
2443
+ ...this.$$d,
2444
+ $$slots: r,
2445
+ $$host: this
2446
+ }
2447
+ }), this.$$me = Bi(() => {
2448
+ qr(() => {
2449
+ this.$$r = !0;
2450
+ for (const n of Qt(this.$$c)) {
2451
+ if (!this.$$p_d[n]?.reflect) continue;
2452
+ this.$$d[n] = this.$$c[n];
2453
+ const i = Jt(
2454
+ n,
2455
+ this.$$d[n],
2456
+ this.$$p_d,
2457
+ "toAttribute"
2458
+ );
2459
+ i == null ? this.removeAttribute(this.$$p_d[n].attribute || n) : this.setAttribute(this.$$p_d[n].attribute || n, i);
2460
+ }
2461
+ this.$$r = !1;
2462
+ });
2463
+ });
2464
+ for (const n in this.$$l)
2465
+ for (const i of this.$$l[n]) {
2466
+ const o = this.$$c.$on(n, i);
2467
+ this.$$l_u.set(i, o);
2468
+ }
2469
+ this.$$l = {};
2470
+ }
2471
+ }
2472
+ // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
2473
+ // and setting attributes through setAttribute etc, this is helpful
2474
+ /**
2475
+ * @param {string} attr
2476
+ * @param {string} _oldValue
2477
+ * @param {string} newValue
2478
+ */
2479
+ attributeChangedCallback(t, r, s) {
2480
+ this.$$r || (t = this.$$g_p(t), this.$$d[t] = Jt(t, s, this.$$p_d, "toProp"), this.$$c?.$set({ [t]: this.$$d[t] }));
2481
+ }
2482
+ disconnectedCallback() {
2483
+ this.$$cn = !1, Promise.resolve().then(() => {
2484
+ !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
2485
+ });
2486
+ }
2487
+ /**
2488
+ * @param {string} attribute_name
2489
+ */
2490
+ $$g_p(t) {
2491
+ return Qt(this.$$p_d).find(
2492
+ (r) => this.$$p_d[r].attribute === t || !this.$$p_d[r].attribute && r.toLowerCase() === t
2493
+ ) || t;
2494
+ }
2495
+ });
2496
+ function Jt(e, t, r, s) {
2497
+ const n = r[e]?.type;
2498
+ if (t = n === "Boolean" && typeof t != "boolean" ? t != null : t, !s || !r[e])
2499
+ return t;
2500
+ if (s === "toAttribute")
2501
+ switch (n) {
2502
+ case "Object":
2503
+ case "Array":
2504
+ return t == null ? null : JSON.stringify(t);
2505
+ case "Boolean":
2506
+ return t ? "" : null;
2507
+ case "Number":
2508
+ return t ?? null;
2509
+ default:
2510
+ return t;
2511
+ }
2512
+ else
2513
+ switch (n) {
2514
+ case "Object":
2515
+ case "Array":
2516
+ return t && JSON.parse(t);
2517
+ case "Boolean":
2518
+ return t;
2519
+ // conversion already handled above
2520
+ case "Number":
2521
+ return t != null ? +t : t;
2522
+ default:
2523
+ return t;
2524
+ }
2525
+ }
2526
+ function go(e) {
2527
+ const t = {};
2528
+ return e.childNodes.forEach((r) => {
2529
+ t[
2530
+ /** @type {Element} node */
2531
+ r.slot || "default"
2532
+ ] = !0;
2533
+ }), t;
2534
+ }
2535
+ function wo(e, t, r, s, n, i) {
2536
+ let o = class extends vs {
2537
+ constructor() {
2538
+ super(e, r, n), this.$$p_d = t;
2539
+ }
2540
+ static get observedAttributes() {
2541
+ return Qt(t).map(
2542
+ (l) => (t[l].attribute || l).toLowerCase()
2543
+ );
2544
+ }
2545
+ };
2546
+ return Qt(t).forEach((l) => {
2547
+ Zt(o.prototype, l, {
2548
+ get() {
2549
+ return this.$$c && l in this.$$c ? this.$$c[l] : this.$$d[l];
2550
+ },
2551
+ set(f) {
2552
+ f = Jt(l, f, t), this.$$d[l] = f;
2553
+ var u = this.$$c;
2554
+ if (u) {
2555
+ var d = at(u, l)?.get;
2556
+ d ? u[l] = f : u.$set({ [l]: f });
2557
+ }
2558
+ }
2559
+ });
2560
+ }), s.forEach((l) => {
2561
+ Zt(o.prototype, l, {
2562
+ get() {
2563
+ return this.$$c?.[l];
2564
+ }
2565
+ });
2566
+ }), e.element = /** @type {any} */
2567
+ o, o;
2568
+ }
2569
+ var vn;
2570
+ (function(e) {
2571
+ e.TTS_WORD = "tts-word", e.TTS_SENTENCE = "tts-sentence", e.ANNOTATION = "annotation";
2572
+ })(vn || (vn = {}));
2573
+ var pn;
2574
+ (function(e) {
2575
+ e.YELLOW = "yellow", e.GREEN = "green", e.BLUE = "blue", e.PINK = "pink", e.ORANGE = "orange";
2576
+ })(pn || (pn = {}));
2577
+ const bo = {
2578
+ // Standard QTI 3.0 PNP supports
2579
+ textToSpeech: "pie-tool-text-to-speech",
2580
+ calculator: "pie-tool-calculator",
2581
+ ruler: "pie-tool-ruler",
2582
+ protractor: "pie-tool-protractor",
2583
+ highlighter: "pie-tool-annotation-toolbar",
2584
+ lineReader: "pie-tool-line-reader",
2585
+ magnifier: "pie-tool-magnifier",
2586
+ colorContrast: "pie-theme-contrast",
2587
+ answerMasking: "pie-tool-answer-eliminator",
2588
+ dictionaryLookup: "pie-tool-dictionary",
2589
+ // Common extensions (not in QTI standard but widely used)
2590
+ graphingCalculator: "pie-tool-calculator",
2591
+ scientificCalculator: "pie-tool-calculator",
2592
+ basicCalculator: "pie-tool-calculator"
2593
+ };
2594
+ Object.fromEntries(Object.entries(bo).map(([e, t]) => [t, e]));
2595
+ var Mr;
2596
+ (function(e) {
2597
+ e[e.BASE = 0] = "BASE", e[e.TOOL = 1e3] = "TOOL", e[e.MODAL = 2e3] = "MODAL", e[e.CONTROL = 3e3] = "CONTROL", e[e.HIGHLIGHT = 4e3] = "HIGHLIGHT";
2598
+ })(Mr || (Mr = {}));
2599
+ var _n;
2600
+ (function(e) {
2601
+ e.IDLE = "idle", e.LOADING = "loading", e.PLAYING = "playing", e.PAUSED = "paused", e.ERROR = "error";
2602
+ })(_n || (_n = {}));
2603
+ class mo {
2604
+ constructor() {
2605
+ k(this, "providerId", "browser");
2606
+ k(this, "providerName", "Browser Speech Synthesis");
2607
+ k(this, "version", "1.0.0");
2608
+ }
2609
+ async initialize(t) {
2610
+ if (typeof window > "u")
2611
+ throw new Error("BrowserTTSProvider requires browser environment");
2612
+ if (!("speechSynthesis" in window))
2613
+ throw new Error("Browser does not support Speech Synthesis API");
2614
+ return new xo(t);
2615
+ }
2616
+ supportsFeature(t) {
2617
+ return !0;
2618
+ }
2619
+ getCapabilities() {
2620
+ return {
2621
+ supportsPause: !0,
2622
+ supportsResume: !0,
2623
+ supportsWordBoundary: !0,
2624
+ supportsVoiceSelection: !0,
2625
+ supportsRateControl: !0,
2626
+ supportsPitchControl: !0
2627
+ };
2628
+ }
2629
+ destroy() {
2630
+ }
2631
+ }
2632
+ class xo {
2633
+ constructor(t) {
2634
+ k(this, "utterance", null);
2635
+ k(this, "config", null);
2636
+ k(this, "_isPlaying", !1);
2637
+ k(this, "_isPaused", !1);
2638
+ k(this, "onWordBoundary");
2639
+ this.config = t;
2640
+ }
2641
+ async speak(t) {
2642
+ return new Promise((r, s) => {
2643
+ if (!this.config) {
2644
+ s(new Error("TTS not initialized"));
2645
+ return;
2646
+ }
2647
+ this.stop(), this.utterance = new SpeechSynthesisUtterance(t);
2648
+ let n = -1, i = 0;
2649
+ if (this.config.voice) {
2650
+ const l = speechSynthesis.getVoices().find((f) => f.name === this.config.voice);
2651
+ l && (this.utterance.voice = l);
2652
+ }
2653
+ this.config.rate && (this.utterance.rate = this.config.rate), this.config.pitch && (this.utterance.pitch = this.config.pitch), this.utterance.onstart = () => {
2654
+ this._isPlaying = !0, this._isPaused = !1;
2655
+ }, this.utterance.onend = () => {
2656
+ this._isPlaying = !1, this._isPaused = !1, r();
2657
+ }, this.utterance.onerror = (o) => {
2658
+ if (this._isPlaying = !1, this._isPaused = !1, o.error === "interrupted" || o.error === "canceled") {
2659
+ r();
2660
+ return;
2661
+ }
2662
+ s(new Error(`Speech synthesis error: ${o.error}`));
2663
+ }, this.utterance.onpause = () => {
2664
+ this._isPaused = !0;
2665
+ }, this.utterance.onresume = () => {
2666
+ this._isPaused = !1;
2667
+ }, this.utterance.onboundary = (o) => {
2668
+ if (console.log("[BrowserProvider] Boundary event:", o.name, "charIndex:", o.charIndex, "charLength:", o.charLength), o.name === "word" && this.onWordBoundary) {
2669
+ if (i++, o.charIndex === n && i > 2) {
2670
+ console.warn("[BrowserProvider] Browser word boundaries broken - disabling word highlighting"), this.utterance && (this.utterance.onboundary = null);
2671
+ return;
2672
+ }
2673
+ n = o.charIndex;
2674
+ const l = t.substring(o.charIndex, o.charIndex + (o.charLength || 0));
2675
+ console.log("[BrowserProvider] Calling onWordBoundary with word:", l, "at position:", o.charIndex), this.onWordBoundary(l, o.charIndex);
2676
+ }
2677
+ }, speechSynthesis.speak(this.utterance);
2678
+ });
2679
+ }
2680
+ pause() {
2681
+ this._isPlaying && !this._isPaused && speechSynthesis.pause();
2682
+ }
2683
+ resume() {
2684
+ this._isPlaying && this._isPaused && speechSynthesis.resume();
2685
+ }
2686
+ stop() {
2687
+ this._isPlaying && (speechSynthesis.cancel(), this._isPlaying = !1, this._isPaused = !1);
2688
+ }
2689
+ isPlaying() {
2690
+ return this._isPlaying && !this._isPaused;
2691
+ }
2692
+ isPaused() {
2693
+ return this._isPaused;
2694
+ }
2695
+ /**
2696
+ * Update settings dynamically (rate, pitch, voice)
2697
+ * Changes take effect on the next speak() call
2698
+ */
2699
+ updateSettings(t) {
2700
+ this.config || (this.config = {}), t.rate !== void 0 && (this.config.rate = t.rate), t.pitch !== void 0 && (this.config.pitch = t.pitch), t.voice !== void 0 && (this.config.voice = t.voice);
2701
+ }
2702
+ }
2703
+ var yo = /* @__PURE__ */ we('<div class="error-message svelte-xk676z"><svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 svelte-xk676z" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" class="svelte-xk676z"></path></svg> <span class="svelte-xk676z"> </span></div>'), ko = /* @__PURE__ */ we('<div class="loading-message svelte-xk676z"><span class="svelte-xk676z">Initializing...</span></div>'), $o = /* @__PURE__ */ we('<div class="selection-info svelte-xk676z"><svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 svelte-xk676z" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" class="svelte-xk676z"></path></svg> <span class="svelte-xk676z"> </span></div>'), Eo = /* @__PURE__ */ we('<p class="svelte-xk676z">Select text on the page to read it aloud.</p>'), zo = /* @__PURE__ */ we('<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 svelte-xk676z" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z" clip-rule="evenodd" class="svelte-xk676z"></path></svg> <span class="svelte-xk676z">Resume</span>', 1), So = /* @__PURE__ */ we('<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 svelte-xk676z" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd" class="svelte-xk676z"></path></svg> <span class="svelte-xk676z">Pause</span>', 1), To = /* @__PURE__ */ we('<span class="pulse svelte-xk676z"></span>'), Po = /* @__PURE__ */ we('<div><div class="status-icon svelte-xk676z"><!></div> <span class="svelte-xk676z"> </span></div>'), Ao = /* @__PURE__ */ we('<div class="instructions svelte-xk676z"><!></div> <div class="control-group svelte-xk676z"><label for="tts-speed" class="svelte-xk676z"><span class="svelte-xk676z">Speed:</span> <strong class="svelte-xk676z"> </strong></label> <input id="tts-speed" type="range" min="0.5" max="2.0" step="0.25" class="svelte-xk676z"/></div> <div class="playback-controls svelte-xk676z"><button class="btn-primary svelte-xk676z" aria-label="Play" type="button"><svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 svelte-xk676z" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z" clip-rule="evenodd" class="svelte-xk676z"></path></svg> <span class="svelte-xk676z">Play</span></button> <button class="btn-secondary svelte-xk676z" type="button"><!></button> <button class="btn-secondary svelte-xk676z" aria-label="Stop" type="button"><svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 svelte-xk676z" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z" clip-rule="evenodd" class="svelte-xk676z"></path></svg> <span class="svelte-xk676z">Stop</span></button></div> <!>', 1), Oo = /* @__PURE__ */ we('<div class="tool-tts svelte-xk676z" role="dialog" aria-label="Text-to-Speech Tool"><div class="tool-header svelte-xk676z"><div class="tool-header-left svelte-xk676z"><svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 svelte-xk676z" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.858 18.142a3 3 0 104.243-4.242L12 12.142 7.757 7.899a3 3 0 000 4.242z" class="svelte-xk676z"></path></svg> <span class="tool-title svelte-xk676z">Text-to-Speech</span></div> <button class="close-button svelte-xk676z" aria-label="Close" type="button">×</button></div> <div class="tool-content svelte-xk676z"><!></div></div>');
2704
+ const Ro = {
2705
+ hash: "svelte-xk676z",
2706
+ code: `.tool-tts.svelte-xk676z {position:fixed;width:300px;background:white;border:1px solid #cbd5e0;border-radius:8px;box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);cursor:move;user-select:none;font-family:system-ui, -apple-system, sans-serif;}.tool-header.svelte-xk676z {display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:linear-gradient(135deg, #667eea 0%, #764ba2 100%);color:white;border-radius:8px 8px 0 0;cursor:move;}.tool-header-left.svelte-xk676z {display:flex;align-items:center;gap:8px;}.tool-title.svelte-xk676z {font-weight:600;font-size:14px;}.close-button.svelte-xk676z {background:rgba(255, 255, 255, 0.2);border:none;color:white;width:24px;height:24px;border-radius:4px;cursor:pointer;font-size:20px;line-height:1;display:flex;align-items:center;justify-content:center;transition:background-color 0.2s;}.close-button.svelte-xk676z:hover {background:rgba(255, 255, 255, 0.3);}.tool-content.svelte-xk676z {padding:16px;}.error-message.svelte-xk676z,
2707
+ .loading-message.svelte-xk676z {display:flex;align-items:center;gap:8px;padding:12px;border-radius:6px;font-size:13px;}.error-message.svelte-xk676z {background:#fee;color:#c33;border:1px solid #fcc;}.loading-message.svelte-xk676z {background:#f0f4f8;color:#4a5568;justify-content:center;}.instructions.svelte-xk676z {margin-bottom:16px;font-size:13px;color:#4a5568;}.instructions.svelte-xk676z p:where(.svelte-xk676z) {margin:0;line-height:1.5;}.selection-info.svelte-xk676z {display:flex;align-items:center;gap:6px;padding:8px 12px;background:#e6fffa;border:1px solid #81e6d9;border-radius:6px;color:#234e52;font-size:12px;}.selection-info.svelte-xk676z svg:where(.svelte-xk676z) {flex-shrink:0;}.control-group.svelte-xk676z {margin-bottom:16px;}.control-group.svelte-xk676z label:where(.svelte-xk676z) {display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-size:13px;color:#4a5568;}.control-group.svelte-xk676z label:where(.svelte-xk676z) strong:where(.svelte-xk676z) {color:#667eea;font-weight:600;}.control-group.svelte-xk676z input[type="range"]:where(.svelte-xk676z) {width:100%;height:6px;border-radius:3px;background:#e2e8f0;outline:none;-webkit-appearance:none;}.control-group.svelte-xk676z input[type="range"]:where(.svelte-xk676z)::-webkit-slider-thumb {-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:#667eea;cursor:pointer;transition:all 0.2s;}.control-group.svelte-xk676z input[type="range"]:where(.svelte-xk676z)::-webkit-slider-thumb:hover {background:#764ba2;transform:scale(1.1);}.control-group.svelte-xk676z input[type="range"]:where(.svelte-xk676z):disabled {opacity:0.5;cursor:not-allowed;}.playback-controls.svelte-xk676z {display:flex;gap:8px;margin-bottom:12px;}.playback-controls.svelte-xk676z button:where(.svelte-xk676z) {flex:1;display:flex;align-items:center;justify-content:center;gap:6px;padding:10px 12px;border:none;border-radius:6px;font-size:13px;font-weight:500;cursor:pointer;transition:all 0.2s;}.playback-controls.svelte-xk676z button:where(.svelte-xk676z) svg:where(.svelte-xk676z) {flex-shrink:0;}.btn-primary.svelte-xk676z {background:linear-gradient(135deg, #667eea 0%, #764ba2 100%);color:white;}.btn-primary.svelte-xk676z:hover:not(:disabled) {transform:translateY(-1px);box-shadow:0 4px 6px rgba(102, 126, 234, 0.3);}.btn-secondary.svelte-xk676z {background:#f7fafc;color:#4a5568;border:1px solid #e2e8f0;}.btn-secondary.svelte-xk676z:hover:not(:disabled) {background:#edf2f7;}.playback-controls.svelte-xk676z button:where(.svelte-xk676z):disabled {opacity:0.5;cursor:not-allowed;transform:none !important;}.status-indicator.svelte-xk676z {display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f0fdf4;border:1px solid #86efac;border-radius:6px;font-size:12px;color:#166534;
2708
+ animation: svelte-xk676z-fadeIn 0.3s;}.status-indicator.paused.svelte-xk676z {background:#fef3c7;border-color:#fcd34d;color:#92400e;}.status-icon.svelte-xk676z {display:flex;align-items:center;justify-content:center;}.pulse.svelte-xk676z {width:8px;height:8px;background:#10b981;border-radius:50%;
2709
+ animation: svelte-xk676z-pulse 1.5s ease-in-out infinite;}
2710
+
2711
+ @keyframes svelte-xk676z-pulse {
2712
+ 0%, 100% {
2713
+ opacity: 1;
2714
+ transform: scale(1);
2715
+ }
2716
+ 50% {
2717
+ opacity: 0.5;
2718
+ transform: scale(1.2);
2719
+ }
2720
+ }
2721
+
2722
+ @keyframes svelte-xk676z-fadeIn {
2723
+ from {
2724
+ opacity: 0;
2725
+ transform: translateY(-4px);
2726
+ }
2727
+ to {
2728
+ opacity: 1;
2729
+ transform: translateY(0);
2730
+ }
2731
+ }
2732
+
2733
+ /* Accessibility */
2734
+ @media (prefers-reduced-motion: reduce) {.pulse.svelte-xk676z,
2735
+ .status-indicator.svelte-xk676z,
2736
+ .playback-controls.svelte-xk676z button:where(.svelte-xk676z),
2737
+ .control-group.svelte-xk676z input[type="range"]:where(.svelte-xk676z)::-webkit-slider-thumb {
2738
+ animation: none !important;transition:none !important;}
2739
+ }`
2740
+ };
2741
+ function Co(e, t) {
2742
+ zn(t, !0), no(e, Ro);
2743
+ let r = Ut(t, "visible", 7, !1), s = Ut(t, "toolId", 7, "textToSpeech"), n = Ut(t, "coordinator"), i = Ut(t, "ttsService");
2744
+ const o = typeof window < "u";
2745
+ let l = /* @__PURE__ */ P(void 0), f = /* @__PURE__ */ P(!1), u = /* @__PURE__ */ P(Ve({
2746
+ x: o ? window.innerWidth - 320 : 400,
2747
+ y: 100
2748
+ })), d = /* @__PURE__ */ P(Ve({ x: 0, y: 0 })), v = /* @__PURE__ */ P(!1), c = /* @__PURE__ */ P(!1), p = /* @__PURE__ */ P(!1), w = /* @__PURE__ */ P(""), z = /* @__PURE__ */ P(1), S = /* @__PURE__ */ P(!1), Ze = /* @__PURE__ */ P(null), et = /* @__PURE__ */ P(!1);
2749
+ Or(() => {
2750
+ n() && s() && !h(et) && (n().registerTool(s(), "Text-to-Speech", void 0, Mr.MODAL), x(et, !0));
2751
+ }), ro(async () => {
2752
+ if (o) {
2753
+ try {
2754
+ const _ = new mo();
2755
+ await i().initialize(_), x(v, !0);
2756
+ } catch (_) {
2757
+ console.error("[TTSTool] Failed to initialize TTS:", _), x(Ze, _ instanceof Error ? _.message : "Failed to initialize TTS", !0);
2758
+ }
2759
+ return document.addEventListener("selectionchange", Hr), () => {
2760
+ o && (document.removeEventListener("selectionchange", Hr), i().stop()), n() && s() && n().unregisterTool(s());
2761
+ };
2762
+ }
2763
+ }), Or(() => {
2764
+ n() && h(l) && s() && n().updateToolElement(s(), h(l));
2765
+ });
2766
+ function Hr() {
2767
+ const _ = window.getSelection();
2768
+ _ && _.toString().trim().length > 0 ? (x(w, _.toString().trim(), !0), x(S, !0)) : x(S, !1);
2769
+ }
2770
+ async function ps() {
2771
+ if (!(!h(v) || !h(S) || !h(w)))
2772
+ try {
2773
+ const _ = window.getSelection();
2774
+ if (!_ || _.rangeCount === 0) return;
2775
+ const Fe = _.getRangeAt(0).commonAncestorContainer.parentElement;
2776
+ if (!Fe) return;
2777
+ x(c, !0), x(p, !1), i().setRootElement(Fe);
2778
+ const ur = Fe.closest("[data-catalog-id]")?.getAttribute("data-catalog-id") || void 0;
2779
+ await i().speak(
2780
+ h(w),
2781
+ {
2782
+ catalogId: ur,
2783
+ // Pass catalog ID for SSML resolution
2784
+ rate: h(z),
2785
+ highlightWords: !0
2786
+ },
2787
+ {
2788
+ onEnd: () => {
2789
+ x(c, !1), x(p, !1);
2790
+ },
2791
+ onError: (Ft) => {
2792
+ console.error("[TTSTool] TTS error:", Ft), x(c, !1), x(p, !1);
2793
+ }
2794
+ }
2795
+ );
2796
+ } catch (_) {
2797
+ console.error("[TTSTool] Failed to speak:", _), x(c, !1), x(p, !1);
2798
+ }
2799
+ }
2800
+ function _s() {
2801
+ h(c) && (h(p) ? (i().resume(), x(p, !1)) : (i().pause(), x(p, !0)));
2802
+ }
2803
+ function gs() {
2804
+ i().stop(), x(c, !1), x(p, !1);
2805
+ }
2806
+ function ws(_) {
2807
+ const ae = _.target;
2808
+ x(z, parseFloat(ae.value), !0);
2809
+ }
2810
+ function bs(_) {
2811
+ _.target.closest("button, input, select") || ms(_);
2812
+ }
2813
+ function ms(_) {
2814
+ h(l) && (h(l).setPointerCapture(_.pointerId), x(f, !0), x(
2815
+ d,
2816
+ {
2817
+ x: _.clientX - h(u).x,
2818
+ y: _.clientY - h(u).y
2819
+ },
2820
+ !0
2821
+ ), n()?.bringToFront(h(l)), h(l).addEventListener("pointermove", Wr), h(l).addEventListener("pointerup", Kr), _.preventDefault());
2822
+ }
2823
+ function Wr(_) {
2824
+ h(f) && (x(
2825
+ u,
2826
+ {
2827
+ x: _.clientX - h(d).x,
2828
+ y: _.clientY - h(d).y
2829
+ },
2830
+ !0
2831
+ ), _.preventDefault());
2832
+ }
2833
+ function Kr(_) {
2834
+ h(f) && h(l) && (h(l).releasePointerCapture(_.pointerId), x(f, !1), h(l).removeEventListener("pointermove", Wr), h(l).removeEventListener("pointerup", Kr));
2835
+ }
2836
+ function xs() {
2837
+ n()?.hideTool(s());
2838
+ }
2839
+ const ys = /* @__PURE__ */ Ai(() => h(z) === 0.5 ? "Slow" : h(z) === 0.75 ? "Slower" : h(z) === 1 ? "Normal" : h(z) === 1.25 ? "Faster" : h(z) === 1.5 ? "Fast" : h(z) === 2 ? "Very Fast" : `${h(z)}x`);
2840
+ var ks = {
2841
+ get visible() {
2842
+ return r();
2843
+ },
2844
+ set visible(_ = !1) {
2845
+ r(_), Et();
2846
+ },
2847
+ get toolId() {
2848
+ return s();
2849
+ },
2850
+ set toolId(_ = "textToSpeech") {
2851
+ s(_), Et();
2852
+ },
2853
+ get coordinator() {
2854
+ return n();
2855
+ },
2856
+ set coordinator(_) {
2857
+ n(_), Et();
2858
+ },
2859
+ get ttsService() {
2860
+ return i();
2861
+ },
2862
+ set ttsService(_) {
2863
+ i(_), Et();
2864
+ }
2865
+ }, Xr = un(), $s = br(Xr);
2866
+ {
2867
+ var Es = (_) => {
2868
+ var ae = Oo();
2869
+ ae.__pointerdown = bs;
2870
+ var Fe = D(ae), ur = X(D(Fe), 2);
2871
+ ur.__click = xs, L(Fe);
2872
+ var Ft = X(Fe, 2), zs = D(Ft);
2873
+ {
2874
+ var Ss = (Oe) => {
2875
+ var tt = yo(), Bt = X(D(tt), 2), cr = D(Bt, !0);
2876
+ L(Bt), L(tt), $t(() => Gt(cr, h(Ze))), j(Oe, tt);
2877
+ }, Ts = (Oe) => {
2878
+ var tt = un(), Bt = br(tt);
2879
+ {
2880
+ var cr = (rt) => {
2881
+ var jt = ko();
2882
+ j(rt, jt);
2883
+ }, Ps = (rt) => {
2884
+ var jt = Ao(), dr = br(jt), As = D(dr);
2885
+ {
2886
+ var Os = (N) => {
2887
+ var B = $o(), yt = X(D(B), 2), kt = D(yt);
2888
+ L(yt), L(B), $t(() => Gt(kt, `${h(w).length ?? ""} characters selected`)), j(N, B);
2889
+ }, Rs = (N) => {
2890
+ var B = Eo();
2891
+ j(N, B);
2892
+ };
2893
+ Be(As, (N) => {
2894
+ h(S) ? N(Os) : N(Rs, !1);
2895
+ });
2896
+ }
2897
+ L(dr);
2898
+ var hr = X(dr, 2), vr = D(hr), Jr = X(D(vr), 2), Cs = D(Jr, !0);
2899
+ L(Jr), L(vr);
2900
+ var Vt = X(vr, 2);
2901
+ uo(Vt), Vt.__input = ws, L(hr);
2902
+ var pr = X(hr, 2), _r = D(pr);
2903
+ _r.__click = ps;
2904
+ var nt = X(_r, 2);
2905
+ nt.__click = _s;
2906
+ var Ns = D(nt);
2907
+ {
2908
+ var Ms = (N) => {
2909
+ var B = zo();
2910
+ yr(2), j(N, B);
2911
+ }, Is = (N) => {
2912
+ var B = So();
2913
+ yr(2), j(N, B);
2914
+ };
2915
+ Be(Ns, (N) => {
2916
+ h(p) ? N(Ms) : N(Is, !1);
2917
+ });
2918
+ }
2919
+ L(nt);
2920
+ var Qr = X(nt, 2);
2921
+ Qr.__click = gs, L(pr);
2922
+ var Ls = X(pr, 2);
2923
+ {
2924
+ var Ds = (N) => {
2925
+ var B = Po();
2926
+ let yt;
2927
+ var kt = D(B), Fs = D(kt);
2928
+ {
2929
+ var Bs = (st) => {
2930
+ var gr = Xi("⏸");
2931
+ j(st, gr);
2932
+ }, js = (st) => {
2933
+ var gr = To();
2934
+ j(st, gr);
2935
+ };
2936
+ Be(Fs, (st) => {
2937
+ h(p) ? st(Bs) : st(js, !1);
2938
+ });
2939
+ }
2940
+ L(kt);
2941
+ var Zr = X(kt, 2), Vs = D(Zr, !0);
2942
+ L(Zr), L(B), $t(() => {
2943
+ yt = oo(B, 1, "status-indicator svelte-xk676z", null, yt, { paused: h(p) }), Gt(Vs, h(p) ? "Paused" : "Speaking...");
2944
+ }), j(N, B);
2945
+ };
2946
+ Be(Ls, (N) => {
2947
+ h(c) && N(Ds);
2948
+ });
2949
+ }
2950
+ $t(() => {
2951
+ Gt(Cs, h(ys)), co(Vt, h(z)), Vt.disabled = h(c), _r.disabled = !h(S) || h(c), nt.disabled = !h(c), Nr(nt, "aria-label", h(p) ? "Resume" : "Pause"), Qr.disabled = !h(c);
2952
+ }), j(rt, jt);
2953
+ };
2954
+ Be(
2955
+ Bt,
2956
+ (rt) => {
2957
+ h(v) ? rt(Ps, !1) : rt(cr);
2958
+ },
2959
+ !0
2960
+ );
2961
+ }
2962
+ j(Oe, tt);
2963
+ };
2964
+ Be(zs, (Oe) => {
2965
+ h(Ze) ? Oe(Ss) : Oe(Ts, !1);
2966
+ });
2967
+ }
2968
+ L(Ft), L(ae), vo(ae, (Oe) => x(l, Oe), () => h(l)), $t(() => lo(ae, `left: ${h(u).x ?? ""}px; top: ${h(u).y ?? ""}px;`)), j(_, ae);
2969
+ };
2970
+ Be($s, (_) => {
2971
+ r() && o && _(Es);
2972
+ });
2973
+ }
2974
+ return j(e, Xr), Sn(ks);
2975
+ }
2976
+ Wi(["pointerdown", "click", "input"]);
2977
+ customElements.define("pie-tool-text-to-speech", wo(
2978
+ Co,
2979
+ {
2980
+ visible: { attribute: "visible", type: "Boolean" },
2981
+ toolId: { attribute: "tool-id", type: "String" },
2982
+ coordinator: { type: "Object" },
2983
+ ttsService: {}
2984
+ },
2985
+ [],
2986
+ []
2987
+ ));
2988
+ export {
2989
+ Co as default
2990
+ };
2991
+ //# sourceMappingURL=tool-text-to-speech.js.map