@pie-players/pie-tool-calculator-desmos 0.3.17 → 0.3.20

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