quizdown-extended
Version:
A fork from [bonartm/quizdown-js](https://github.com/bonartm/quizdown-js) with more features. > The Katex-extension is currently not supported
2,009 lines • 1.24 MB
JavaScript
var II = Array.isArray, Uw = Array.prototype.indexOf, sI = Array.from, kE = Object.keys, Ne = Object.defineProperty, $Q = Object.getOwnPropertyDescriptor, mw = Object.getOwnPropertyDescriptors, Pw = Object.prototype, Kw = Array.prototype, $n = Object.getPrototypeOf, hs = Object.isExtensible;
function Yw(B) {
return typeof B == "function";
}
const lA = () => {
};
function us(B) {
return typeof B?.then == "function";
}
function Ai(B) {
for (var A = 0; A < B.length; A++)
B[A]();
}
function Bi() {
var B, A, Q = new Promise((g, e) => {
B = g, A = e;
});
return { promise: Q, resolve: B, reject: A };
}
const jA = 2, nI = 4, et = 8, iQ = 16, kQ = 32, bQ = 64, Et = 128, _A = 1024, DB = 2048, oQ = 4096, FB = 8192, fQ = 16384, tt = 32768, GQ = 65536, fs = 1 << 17, Sw = 1 << 18, Cg = 1 << 19, Qi = 1 << 20, KB = 256, HE = 512, RE = 32768, lC = 1 << 21, iI = 1 << 22, Ag = 1 << 23, Bg = Symbol("$state"), gi = Symbol("legacy props"), Jw = Symbol(""), Mg = new class extends Error {
name = "StaleReactionError";
message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
}(), Ct = 3, Ig = 8;
function ei(B) {
throw new Error("https://svelte.dev/e/lifecycle_outside_component");
}
function bw() {
throw new Error("https://svelte.dev/e/async_derived_orphan");
}
function xw(B) {
throw new Error("https://svelte.dev/e/effect_in_teardown");
}
function Ow() {
throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
}
function vw(B) {
throw new Error("https://svelte.dev/e/effect_orphan");
}
function qw() {
throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
}
function Tw() {
throw new Error("https://svelte.dev/e/hydration_failed");
}
function Ww(B) {
throw new Error("https://svelte.dev/e/props_invalid_value");
}
function Xw() {
throw new Error("https://svelte.dev/e/state_descriptors_fixed");
}
function Zw() {
throw new Error("https://svelte.dev/e/state_prototype_fixed");
}
function _w() {
throw new Error("https://svelte.dev/e/state_unsafe_mutation");
}
function zw() {
throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
}
const It = 1, st = 2, Ei = 4, jw = 8, Vw = 16, $w = 1, AD = 4, BD = 8, QD = 16, gD = 4, eD = 1, ED = 2, ti = "[", Se = "[!", oI = "]", gg = {}, xA = Symbol(), tD = "http://www.w3.org/1999/xhtml";
function Je(B) {
console.warn("https://svelte.dev/e/hydration_mismatch");
}
function CD(B) {
console.warn("https://svelte.dev/e/legacy_recursive_reactive_block");
}
function ID() {
console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
}
let Y = !1;
function mB(B) {
Y = B;
}
let _;
function OA(B) {
if (B === null)
throw Je(), gg;
return _ = B;
}
function yQ() {
return OA(
/** @type {TemplateNode} */
/* @__PURE__ */ zB(_)
);
}
function L(B) {
if (Y) {
if (/* @__PURE__ */ zB(_) !== null)
throw Je(), gg;
_ = B;
}
}
function he(B = 1) {
if (Y) {
for (var A = B, Q = _; A--; )
Q = /** @type {TemplateNode} */
/* @__PURE__ */ zB(Q);
_ = Q;
}
}
function Fe(B = !0) {
for (var A = 0, Q = _; ; ) {
if (Q.nodeType === Ig) {
var g = (
/** @type {Comment} */
Q.data
);
if (g === oI) {
if (A === 0) return Q;
A -= 1;
} else (g === ti || g === Se) && (A += 1);
}
var e = (
/** @type {TemplateNode} */
/* @__PURE__ */ zB(Q)
);
B && Q.remove(), Q = e;
}
}
function Ci(B) {
if (!B || B.nodeType !== Ig)
throw Je(), gg;
return (
/** @type {Comment} */
B.data
);
}
function Ii(B) {
return B === this.v;
}
function si(B, A) {
return B != B ? A == A : B !== A || B !== null && typeof B == "object" || typeof B == "function";
}
function ni(B) {
return !si(B, this.v);
}
let aB = null;
function mg(B) {
aB = B;
}
function VA(B, A = !1, Q) {
aB = {
p: aB,
i: !1,
c: null,
e: null,
s: B,
x: null,
l: null
};
}
function $A(B) {
var A = (
/** @type {ComponentContext} */
aB
), Q = A.e;
if (Q !== null) {
A.e = null;
for (var g of Q)
ki(g);
}
return B !== void 0 && (A.x = B), A.i = !0, aB = A.p, B ?? /** @type {T} */
{};
}
function ii() {
return !0;
}
let ZQ = [];
function oi() {
var B = ZQ;
ZQ = [], Ai(B);
}
function _B(B) {
if (ZQ.length === 0 && !Gg) {
var A = ZQ;
queueMicrotask(() => {
A === ZQ && oi();
});
}
ZQ.push(B);
}
function sD() {
for (; ZQ.length > 0; )
oi();
}
function ri(B) {
var A = O;
if (A === null)
return T.f |= Ag, B;
if ((A.f & tt) === 0) {
if ((A.f & Et) === 0)
throw B;
A.b.error(B);
} else
Pg(B, A);
}
function Pg(B, A) {
for (; A !== null; ) {
if ((A.f & Et) !== 0)
try {
A.b.error(B);
return;
} catch (Q) {
B = Q;
}
A = A.parent;
}
throw B;
}
const EE = /* @__PURE__ */ new Set();
let GA = null, WB = null, eQ = [], nt = null, hC = !1, Gg = !1;
class PB {
committed = !1;
/**
* The current values of any sources that are updated in this batch
* They keys of this map are identical to `this.#previous`
* @type {Map<Source, any>}
*/
current = /* @__PURE__ */ new Map();
/**
* The values of any sources that are updated in this batch _before_ those updates took place.
* They keys of this map are identical to `this.#current`
* @type {Map<Source, any>}
*/
previous = /* @__PURE__ */ new Map();
/**
* When the batch is committed (and the DOM is updated), we need to remove old branches
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
* @type {Set<() => void>}
*/
#B = /* @__PURE__ */ new Set();
/**
* If a fork is discarded, we need to destroy any effects that are no longer needed
* @type {Set<(batch: Batch) => void>}
*/
#A = /* @__PURE__ */ new Set();
/**
* The number of async effects that are currently in flight
*/
#Q = 0;
/**
* The number of async effects that are currently in flight, _not_ inside a pending boundary
*/
#g = 0;
/**
* A deferred that resolves when the batch is committed, used with `settled()`
* TODO replace with Promise.withResolvers once supported widely enough
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
*/
#I = null;
/**
* Deferred effects (which run after async work has completed) that are DIRTY
* @type {Effect[]}
*/
#t = [];
/**
* Deferred effects that are MAYBE_DIRTY
* @type {Effect[]}
*/
#C = [];
/**
* A set of branches that still exist, but will be destroyed when this batch
* is committed — we skip over these during `process`
* @type {Set<Effect>}
*/
skipped_effects = /* @__PURE__ */ new Set();
is_fork = !1;
/**
*
* @param {Effect[]} root_effects
*/
process(A) {
eQ = [], this.apply();
var Q = {
parent: null,
effect: null,
effects: [],
render_effects: [],
block_effects: []
};
for (const g of A)
this.#e(g, Q);
this.is_fork || this.#s(), this.#g > 0 || this.is_fork ? (this.#E(Q.effects), this.#E(Q.render_effects), this.#E(Q.block_effects)) : (GA = null, Ms(Q.render_effects), Ms(Q.effects), this.#I?.resolve()), WB = null;
}
/**
* Traverse the effect tree, executing effects or stashing
* them for later execution as appropriate
* @param {Effect} root
* @param {EffectTarget} target
*/
#e(A, Q) {
A.f ^= _A;
for (var g = A.first; g !== null; ) {
var e = g.f, E = (e & (kQ | bQ)) !== 0, t = E && (e & _A) !== 0, C = t || (e & FB) !== 0 || this.skipped_effects.has(g);
if ((g.f & Et) !== 0 && g.b?.is_pending() && (Q = {
parent: Q,
effect: g,
effects: [],
render_effects: [],
block_effects: []
}), !C && g.fn !== null) {
E ? g.f ^= _A : (e & nI) !== 0 ? Q.effects.push(g) : xe(g) && ((g.f & iQ) !== 0 && Q.block_effects.push(g), Le(g));
var I = g.first;
if (I !== null) {
g = I;
continue;
}
}
var s = g.parent;
for (g = g.next; g === null && s !== null; )
s === Q.effect && (this.#E(Q.effects), this.#E(Q.render_effects), this.#E(Q.block_effects), Q = /** @type {EffectTarget} */
Q.parent), g = s.next, s = s.parent;
}
}
/**
* @param {Effect[]} effects
*/
#E(A) {
for (const Q of A)
((Q.f & DB) !== 0 ? this.#t : this.#C).push(Q), vA(Q, _A);
}
/**
* Associate a change to a given source with the current
* batch, noting its previous and current values
* @param {Source} source
* @param {any} value
*/
capture(A, Q) {
this.previous.has(A) || this.previous.set(A, Q), this.current.set(A, A.v), WB?.set(A, A.v);
}
activate() {
GA = this;
}
deactivate() {
GA = null, WB = null;
}
flush() {
if (this.activate(), eQ.length > 0) {
if (wi(), GA !== null && GA !== this)
return;
} else this.#Q === 0 && this.process([]);
this.deactivate();
}
discard() {
for (const A of this.#A) A(this);
this.#A.clear();
}
#s() {
if (this.#g === 0) {
for (const A of this.#B) A();
this.#B.clear();
}
this.#Q === 0 && this.#n();
}
#n() {
if (EE.size > 1) {
this.previous.clear();
var A = WB, Q = !0, g = {
parent: null,
effect: null,
effects: [],
render_effects: [],
block_effects: []
};
for (const e of EE) {
if (e === this) {
Q = !1;
continue;
}
const E = [];
for (const [C, I] of this.current) {
if (e.current.has(C))
if (Q && I !== e.current.get(C))
e.current.set(C, I);
else
continue;
E.push(C);
}
if (E.length === 0)
continue;
const t = [...e.current.keys()].filter((C) => !this.current.has(C));
if (t.length > 0) {
const C = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Map();
for (const s of E)
Di(s, t, C, I);
if (eQ.length > 0) {
GA = e, e.apply();
for (const s of eQ)
e.#e(s, g);
eQ = [], e.deactivate();
}
}
}
GA = null, WB = A;
}
this.committed = !0, EE.delete(this);
}
/**
*
* @param {boolean} blocking
*/
increment(A) {
this.#Q += 1, A && (this.#g += 1);
}
/**
*
* @param {boolean} blocking
*/
decrement(A) {
this.#Q -= 1, A && (this.#g -= 1), this.revive();
}
revive() {
for (const A of this.#t)
vA(A, DB), eg(A);
for (const A of this.#C)
vA(A, oQ), eg(A);
this.#t = [], this.#C = [], this.flush();
}
/** @param {() => void} fn */
oncommit(A) {
this.#B.add(A);
}
/** @param {(batch: Batch) => void} fn */
ondiscard(A) {
this.#A.add(A);
}
settled() {
return (this.#I ??= Bi()).promise;
}
static ensure() {
if (GA === null) {
const A = GA = new PB();
EE.add(GA), Gg || PB.enqueue(() => {
GA === A && A.flush();
});
}
return GA;
}
/** @param {() => void} task */
static enqueue(A) {
_B(A);
}
apply() {
}
}
function V(B) {
var A = Gg;
Gg = !0;
try {
for (var Q; ; ) {
if (sD(), eQ.length === 0 && (GA?.flush(), eQ.length === 0))
return nt = null, /** @type {T} */
Q;
wi();
}
} finally {
Gg = A;
}
}
function wi() {
var B = Lg;
hC = !0;
try {
var A = 0;
for (Fs(!0); eQ.length > 0; ) {
var Q = PB.ensure();
if (A++ > 1e3) {
var g, e;
nD();
}
Q.process(eQ), YQ.clear();
}
} finally {
hC = !1, Fs(B), nt = null;
}
}
function nD() {
try {
qw();
} catch (B) {
Pg(B, nt);
}
}
let cQ = null;
function Ms(B) {
var A = B.length;
if (A !== 0) {
for (var Q = 0; Q < A; ) {
var g = B[Q++];
if ((g.f & (fQ | FB)) === 0 && xe(g) && (cQ = /* @__PURE__ */ new Set(), Le(g), g.deps === null && g.first === null && g.nodes_start === null && (g.teardown === null && g.ac === null ? mi(g) : g.fn = null), cQ?.size > 0)) {
YQ.clear();
for (const e of cQ) {
if ((e.f & (fQ | FB)) !== 0) continue;
const E = [e];
let t = e.parent;
for (; t !== null; )
cQ.has(t) && (cQ.delete(t), E.push(t)), t = t.parent;
for (let C = E.length - 1; C >= 0; C--) {
const I = E[C];
(I.f & (fQ | FB)) === 0 && Le(I);
}
}
cQ.clear();
}
}
cQ = null;
}
}
function Di(B, A, Q, g) {
if (!Q.has(B) && (Q.add(B), B.reactions !== null))
for (const e of B.reactions) {
const E = e.f;
(E & jA) !== 0 ? Di(
/** @type {Derived} */
e,
A,
Q,
g
) : (E & (iI | iQ)) !== 0 && (E & DB) === 0 && // we may have scheduled this one already
ai(e, A, g) && (vA(e, DB), eg(
/** @type {Effect} */
e
));
}
}
function ai(B, A, Q) {
const g = Q.get(B);
if (g !== void 0) return g;
if (B.deps !== null)
for (const e of B.deps) {
if (A.includes(e))
return !0;
if ((e.f & jA) !== 0 && ai(
/** @type {Derived} */
e,
A,
Q
))
return Q.set(
/** @type {Derived} */
e,
!0
), !0;
}
return Q.set(B, !1), !1;
}
function eg(B) {
for (var A = nt = B; A.parent !== null; ) {
A = A.parent;
var Q = A.f;
if (hC && A === O && (Q & iQ) !== 0)
return;
if ((Q & (bQ | kQ)) !== 0) {
if ((Q & _A) === 0) return;
A.f ^= _A;
}
}
eQ.push(A);
}
function iD(B) {
let A = 0, Q = LQ(0), g;
return () => {
MD() && (p(Q), rt(() => (A === 0 && (g = xQ(() => B(() => ue(Q)))), A += 1, () => {
_B(() => {
A -= 1, A === 0 && (g?.(), g = void 0, ue(Q));
});
})));
};
}
var oD = GQ | Cg | Et;
function rD(B, A, Q) {
new wD(B, A, Q);
}
class wD {
/** @type {Boundary | null} */
parent;
#B = !1;
/** @type {TemplateNode} */
#A;
/** @type {TemplateNode | null} */
#Q = Y ? _ : null;
/** @type {BoundaryProps} */
#g;
/** @type {((anchor: Node) => void)} */
#I;
/** @type {Effect} */
#t;
/** @type {Effect | null} */
#C = null;
/** @type {Effect | null} */
#e = null;
/** @type {Effect | null} */
#E = null;
/** @type {DocumentFragment | null} */
#s = null;
/** @type {TemplateNode | null} */
#n = null;
#r = 0;
#i = 0;
#w = !1;
/**
* A source containing the number of pending async deriveds/expressions.
* Only created if `$effect.pending()` is used inside the boundary,
* otherwise updating the source results in needless `Batch.ensure()`
* calls followed by no-op flushes
* @type {Source<number> | null}
*/
#o = null;
#h = iD(() => (this.#o = LQ(this.#r), () => {
this.#o = null;
}));
/**
* @param {TemplateNode} node
* @param {BoundaryProps} props
* @param {((anchor: Node) => void)} children
*/
constructor(A, Q, g) {
this.#A = A, this.#g = Q, this.#I = g, this.parent = /** @type {Effect} */
O.b, this.#B = !!this.#g.pending, this.#t = sg(() => {
if (O.b = this, Y) {
const E = this.#Q;
yQ(), /** @type {Comment} */
E.nodeType === Ig && /** @type {Comment} */
E.data === Se ? this.#f() : this.#u();
} else {
var e = this.#c();
try {
this.#C = RB(() => g(e));
} catch (E) {
this.error(E);
}
this.#i > 0 ? this.#a() : this.#B = !1;
}
return () => {
this.#n?.remove();
};
}, oD), Y && (this.#A = _);
}
#u() {
try {
this.#C = RB(() => this.#I(this.#A));
} catch (A) {
this.error(A);
}
this.#B = !1;
}
#f() {
const A = this.#g.pending;
A && (this.#e = RB(() => A(this.#A)), PB.enqueue(() => {
var Q = this.#c();
this.#C = this.#D(() => (PB.ensure(), RB(() => this.#I(Q)))), this.#i > 0 ? this.#a() : (yg(
/** @type {Effect} */
this.#e,
() => {
this.#e = null;
}
), this.#B = !1);
}));
}
#c() {
var A = this.#A;
return this.#B && (this.#n = GB(), this.#A.before(this.#n), A = this.#n), A;
}
/**
* Returns `true` if the effect exists inside a boundary whose pending snippet is shown
* @returns {boolean}
*/
is_pending() {
return this.#B || !!this.parent && this.parent.is_pending();
}
has_pending_snippet() {
return !!this.#g.pending;
}
/**
* @param {() => Effect | null} fn
*/
#D(A) {
var Q = O, g = T, e = aB;
sQ(this.#t), wB(this.#t), mg(this.#t.ctx);
try {
return A();
} catch (E) {
return ri(E), null;
} finally {
sQ(Q), wB(g), mg(e);
}
}
#a() {
const A = (
/** @type {(anchor: Node) => void} */
this.#g.pending
);
this.#C !== null && (this.#s = document.createDocumentFragment(), this.#s.append(
/** @type {TemplateNode} */
this.#n
), Yi(this.#C, this.#s)), this.#e === null && (this.#e = RB(() => A(this.#A)));
}
/**
* Updates the pending count associated with the currently visible pending snippet,
* if any, such that we can replace the snippet with content once work is done
* @param {1 | -1} d
*/
#l(A) {
if (!this.has_pending_snippet()) {
this.parent && this.parent.#l(A);
return;
}
this.#i += A, this.#i === 0 && (this.#B = !1, this.#e && yg(this.#e, () => {
this.#e = null;
}), this.#s && (this.#A.before(this.#s), this.#s = null));
}
/**
* Update the source that powers `$effect.pending()` inside this boundary,
* and controls when the current `pending` snippet (if any) is removed.
* Do not call from inside the class
* @param {1 | -1} d
*/
update_pending_count(A) {
this.#l(A), this.#r += A, this.#o && MQ(this.#o, this.#r);
}
get_effect_pending() {
return this.#h(), p(
/** @type {Source<number>} */
this.#o
);
}
/** @param {unknown} error */
error(A) {
var Q = this.#g.onerror;
let g = this.#g.failed;
if (this.#w || !Q && !g)
throw A;
this.#C && (zA(this.#C), this.#C = null), this.#e && (zA(this.#e), this.#e = null), this.#E && (zA(this.#E), this.#E = null), Y && (OA(
/** @type {TemplateNode} */
this.#Q
), he(), OA(Fe()));
var e = !1, E = !1;
const t = () => {
if (e) {
ID();
return;
}
e = !0, E && zw(), PB.ensure(), this.#r = 0, this.#E !== null && yg(this.#E, () => {
this.#E = null;
}), this.#B = this.has_pending_snippet(), this.#C = this.#D(() => (this.#w = !1, RB(() => this.#I(this.#A)))), this.#i > 0 ? this.#a() : this.#B = !1;
};
var C = T;
try {
wB(null), E = !0, Q?.(A, t), E = !1;
} catch (I) {
Pg(I, this.#t && this.#t.parent);
} finally {
wB(C);
}
g && _B(() => {
this.#E = this.#D(() => {
PB.ensure(), this.#w = !0;
try {
return RB(() => {
g(
this.#A,
() => A,
() => t
);
});
} catch (I) {
return Pg(
I,
/** @type {Effect} */
this.#t.parent
), null;
} finally {
this.#w = !1;
}
});
});
}
}
function DD(B, A, Q, g) {
const e = it;
if (Q.length === 0 && B.length === 0) {
g(A.map(e));
return;
}
var E = GA, t = (
/** @type {Effect} */
O
), C = ci();
function I() {
Promise.all(Q.map((s) => /* @__PURE__ */ aD(s))).then((s) => {
C();
try {
g([...A.map(e), ...s]);
} catch (n) {
(t.f & fQ) === 0 && Pg(n, t);
}
E?.deactivate(), Ge();
}).catch((s) => {
Pg(s, t);
});
}
B.length > 0 ? Promise.all(B).then(() => {
C();
try {
return I();
} finally {
E?.deactivate(), Ge();
}
}) : I();
}
function ci() {
var B = O, A = T, Q = aB, g = GA;
return function(E = !0) {
sQ(B), wB(A), mg(Q), E && g?.activate();
};
}
function Ge() {
sQ(null), wB(null), mg(null);
}
// @__NO_SIDE_EFFECTS__
function it(B) {
var A = jA | DB, Q = T !== null && (T.f & jA) !== 0 ? (
/** @type {Derived} */
T
) : null;
return O === null || Q !== null && (Q.f & KB) !== 0 ? A |= KB : O.f |= Cg, {
ctx: aB,
deps: null,
effects: null,
equals: Ii,
f: A,
fn: B,
reactions: null,
rv: 0,
v: (
/** @type {V} */
xA
),
wv: 0,
parent: Q ?? O,
ac: null
};
}
// @__NO_SIDE_EFFECTS__
function aD(B, A) {
let Q = (
/** @type {Effect | null} */
O
);
Q === null && bw();
var g = (
/** @type {Boundary} */
Q.b
), e = (
/** @type {Promise<V>} */
/** @type {unknown} */
void 0
), E = LQ(
/** @type {V} */
xA
), t = !T, C = /* @__PURE__ */ new Map();
return FD(() => {
var I = Bi();
e = I.promise;
try {
Promise.resolve(B()).then(I.resolve, I.reject).then(() => {
s === GA && s.committed && s.deactivate(), Ge();
});
} catch (o) {
I.reject(o), Ge();
}
var s = (
/** @type {Batch} */
GA
);
if (t) {
var n = !g.is_pending();
g.update_pending_count(1), s.increment(n), C.get(s)?.reject(Mg), C.delete(s), C.set(s, I);
}
const i = (o, r = void 0) => {
if (s.activate(), r)
r !== Mg && (E.f |= Ag, MQ(E, r));
else {
(E.f & Ag) !== 0 && (E.f ^= Ag), MQ(E, o);
for (const [w, D] of C) {
if (C.delete(w), w === s) break;
D.reject(Mg);
}
}
t && (g.update_pending_count(-1), s.decrement(n));
};
I.promise.then(i, (o) => i(null, o || "unknown"));
}), ot(() => {
for (const I of C.values())
I.reject(Mg);
}), new Promise((I) => {
function s(n) {
function i() {
n === e ? I(E) : s(e);
}
n.then(i, i);
}
s(e);
});
}
// @__NO_SIDE_EFFECTS__
function fB(B) {
const A = /* @__PURE__ */ it(B);
return Si(A), A;
}
// @__NO_SIDE_EFFECTS__
function li(B) {
const A = /* @__PURE__ */ it(B);
return A.equals = ni, A;
}
function hi(B) {
var A = B.effects;
if (A !== null) {
B.effects = null;
for (var Q = 0; Q < A.length; Q += 1)
zA(
/** @type {Effect} */
A[Q]
);
}
}
function cD(B) {
for (var A = B.parent; A !== null; ) {
if ((A.f & jA) === 0)
return (
/** @type {Effect} */
A
);
A = A.parent;
}
return null;
}
function rI(B) {
var A, Q = O;
sQ(cD(B));
try {
B.f &= ~RE, hi(B), A = Oi(B);
} finally {
sQ(Q);
}
return A;
}
function ui(B) {
var A = rI(B);
if (B.equals(A) || (B.v = A, B.wv = bi()), !ng)
if (WB !== null)
WB.set(B, B.v);
else {
var Q = (PQ || (B.f & KB) !== 0) && B.deps !== null ? oQ : _A;
vA(B, Q);
}
}
let uC = /* @__PURE__ */ new Set();
const YQ = /* @__PURE__ */ new Map();
let fi = !1;
function LQ(B, A) {
var Q = {
f: 0,
// TODO ideally we could skip this altogether, but it causes type errors
v: B,
reactions: null,
equals: Ii,
rv: 0,
wv: 0
};
return Q;
}
// @__NO_SIDE_EFFECTS__
function AA(B, A) {
const Q = LQ(B);
return Si(Q), Q;
}
// @__NO_SIDE_EFFECTS__
function wI(B, A = !1, Q = !0) {
const g = LQ(B);
return A || (g.equals = ni), g;
}
function x(B, A, Q = !1) {
T !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
// to ensure we error if state is set inside an inspect effect
(!XB || (T.f & fs) !== 0) && ii() && (T.f & (jA | iQ | iI | fs)) !== 0 && !dQ?.includes(B) && _w();
let g = Q ? hQ(A) : A;
return MQ(B, g);
}
function MQ(B, A) {
if (!B.equals(A)) {
var Q = B.v;
ng ? YQ.set(B, A) : YQ.set(B, Q), B.v = A;
var g = PB.ensure();
g.capture(B, Q), (B.f & jA) !== 0 && ((B.f & DB) !== 0 && rI(
/** @type {Derived} */
B
), vA(B, (B.f & KB) === 0 ? _A : oQ)), B.wv = bi(), Mi(B, DB), O !== null && (O.f & _A) !== 0 && (O.f & (kQ | bQ)) === 0 && (kB === null ? yD([B]) : kB.push(B)), !g.is_fork && uC.size > 0 && !fi && lD();
}
return A;
}
function lD() {
fi = !1;
const B = Array.from(uC);
for (const A of B)
(A.f & _A) !== 0 && vA(A, oQ), xe(A) && Le(A);
uC.clear();
}
function ue(B) {
x(B, B.v + 1);
}
function Mi(B, A) {
var Q = B.reactions;
if (Q !== null)
for (var g = Q.length, e = 0; e < g; e++) {
var E = Q[e], t = E.f, C = (t & DB) === 0;
C && vA(E, A), (t & jA) !== 0 ? (t & RE) === 0 && (E.f |= RE, Mi(
/** @type {Derived} */
E,
oQ
)) : C && ((t & iQ) !== 0 && cQ !== null && cQ.add(
/** @type {Effect} */
E
), eg(
/** @type {Effect} */
E
));
}
}
function hQ(B) {
if (typeof B != "object" || B === null || Bg in B)
return B;
const A = $n(B);
if (A !== Pw && A !== Kw)
return B;
var Q = /* @__PURE__ */ new Map(), g = II(B), e = /* @__PURE__ */ AA(0), E = Qg, t = (C) => {
if (Qg === E)
return C();
var I = T, s = Qg;
wB(null), ys(E);
var n = C();
return wB(I), ys(s), n;
};
return g && Q.set("length", /* @__PURE__ */ AA(
/** @type {any[]} */
B.length
)), new Proxy(
/** @type {any} */
B,
{
defineProperty(C, I, s) {
(!("value" in s) || s.configurable === !1 || s.enumerable === !1 || s.writable === !1) && Xw();
var n = Q.get(I);
return n === void 0 ? n = t(() => {
var i = /* @__PURE__ */ AA(s.value);
return Q.set(I, i), i;
}) : x(n, s.value, !0), !0;
},
deleteProperty(C, I) {
var s = Q.get(I);
if (s === void 0) {
if (I in C) {
const n = t(() => /* @__PURE__ */ AA(xA));
Q.set(I, n), ue(e);
}
} else
x(s, xA), ue(e);
return !0;
},
get(C, I, s) {
if (I === Bg)
return B;
var n = Q.get(I), i = I in C;
if (n === void 0 && (!i || $Q(C, I)?.writable) && (n = t(() => {
var r = hQ(i ? C[I] : xA), w = /* @__PURE__ */ AA(r);
return w;
}), Q.set(I, n)), n !== void 0) {
var o = p(n);
return o === xA ? void 0 : o;
}
return Reflect.get(C, I, s);
},
getOwnPropertyDescriptor(C, I) {
var s = Reflect.getOwnPropertyDescriptor(C, I);
if (s && "value" in s) {
var n = Q.get(I);
n && (s.value = p(n));
} else if (s === void 0) {
var i = Q.get(I), o = i?.v;
if (i !== void 0 && o !== xA)
return {
enumerable: !0,
configurable: !0,
value: o,
writable: !0
};
}
return s;
},
has(C, I) {
if (I === Bg)
return !0;
var s = Q.get(I), n = s !== void 0 && s.v !== xA || Reflect.has(C, I);
if (s !== void 0 || O !== null && (!n || $Q(C, I)?.writable)) {
s === void 0 && (s = t(() => {
var o = n ? hQ(C[I]) : xA, r = /* @__PURE__ */ AA(o);
return r;
}), Q.set(I, s));
var i = p(s);
if (i === xA)
return !1;
}
return n;
},
set(C, I, s, n) {
var i = Q.get(I), o = I in C;
if (g && I === "length")
for (var r = s; r < /** @type {Source<number>} */
i.v; r += 1) {
var w = Q.get(r + "");
w !== void 0 ? x(w, xA) : r in C && (w = t(() => /* @__PURE__ */ AA(xA)), Q.set(r + "", w));
}
if (i === void 0)
(!o || $Q(C, I)?.writable) && (i = t(() => /* @__PURE__ */ AA(void 0)), x(i, hQ(s)), Q.set(I, i));
else {
o = i.v !== xA;
var D = t(() => hQ(s));
x(i, D);
}
var a = Reflect.getOwnPropertyDescriptor(C, I);
if (a?.set && a.set.call(n, s), !o) {
if (g && typeof I == "string") {
var l = (
/** @type {Source<number>} */
Q.get("length")
), c = Number(I);
Number.isInteger(c) && c >= l.v && x(l, c + 1);
}
ue(e);
}
return !0;
},
ownKeys(C) {
p(e);
var I = Reflect.ownKeys(C).filter((i) => {
var o = Q.get(i);
return o === void 0 || o.v !== xA;
});
for (var [s, n] of Q)
n.v !== xA && !(s in C) && I.push(s);
return I;
},
setPrototypeOf() {
Zw();
}
}
);
}
function ps(B) {
try {
if (B !== null && typeof B == "object" && Bg in B)
return B[Bg];
} catch {
}
return B;
}
function hD(B, A) {
return Object.is(ps(B), ps(A));
}
var ds, pi, di, Ni;
function fC() {
if (ds === void 0) {
ds = window, pi = /Firefox/.test(navigator.userAgent);
var B = Element.prototype, A = Node.prototype, Q = Text.prototype;
di = $Q(A, "firstChild").get, Ni = $Q(A, "nextSibling").get, hs(B) && (B.__click = void 0, B.__className = void 0, B.__attributes = null, B.__style = void 0, B.__e = void 0), hs(Q) && (Q.__t = void 0);
}
}
function GB(B = "") {
return document.createTextNode(B);
}
// @__NO_SIDE_EFFECTS__
function ZB(B) {
return di.call(B);
}
// @__NO_SIDE_EFFECTS__
function zB(B) {
return Ni.call(B);
}
function k(B, A) {
if (!Y)
return /* @__PURE__ */ ZB(B);
var Q = (
/** @type {TemplateNode} */
/* @__PURE__ */ ZB(_)
);
if (Q === null)
Q = _.appendChild(GB());
else if (A && Q.nodeType !== Ct) {
var g = GB();
return Q?.before(g), OA(g), g;
}
return OA(Q), Q;
}
function LA(B, A = !1) {
if (!Y) {
var Q = (
/** @type {DocumentFragment} */
/* @__PURE__ */ ZB(
/** @type {Node} */
B
)
);
return Q instanceof Comment && Q.data === "" ? /* @__PURE__ */ zB(Q) : Q;
}
if (A && _?.nodeType !== Ct) {
var g = GB();
return _?.before(g), OA(g), g;
}
return _;
}
function QA(B, A = 1, Q = !1) {
let g = Y ? _ : B;
for (var e; A--; )
e = g, g = /** @type {TemplateNode} */
/* @__PURE__ */ zB(g);
if (!Y)
return g;
if (Q && g?.nodeType !== Ct) {
var E = GB();
return g === null ? e?.after(E) : g.before(E), OA(E), E;
}
return OA(g), /** @type {TemplateNode} */
g;
}
function Fi(B) {
B.textContent = "";
}
function Gi() {
return !1;
}
let Ns = !1;
function yi() {
Ns || (Ns = !0, document.addEventListener(
"reset",
(B) => {
Promise.resolve().then(() => {
if (!B.defaultPrevented)
for (
const A of
/**@type {HTMLFormElement} */
B.target.elements
)
A.__on_r?.();
});
},
// In the capture phase to guarantee we get noticed of it (no possiblity of stopPropagation)
{ capture: !0 }
));
}
function vg(B) {
var A = T, Q = O;
wB(null), sQ(null);
try {
return B();
} finally {
wB(A), sQ(Q);
}
}
function uD(B, A, Q, g = Q) {
B.addEventListener(A, () => vg(Q));
const e = B.__on_r;
e ? B.__on_r = () => {
e(), g(!0);
} : B.__on_r = () => g(!0), yi();
}
function Li(B) {
O === null && T === null && vw(), T !== null && (T.f & KB) !== 0 && O === null && Ow(), ng && xw();
}
function fD(B, A) {
var Q = A.last;
Q === null ? A.last = A.first = B : (Q.next = B, B.prev = Q, A.last = B);
}
function jB(B, A, Q, g = !0) {
var e = O;
e !== null && (e.f & FB) !== 0 && (B |= FB);
var E = {
ctx: aB,
deps: null,
nodes_start: null,
nodes_end: null,
f: B | DB,
first: null,
fn: A,
last: null,
next: null,
parent: e,
b: e && e.b,
prev: null,
teardown: null,
transitions: null,
wv: 0,
ac: null
};
if (Q)
try {
Le(E), E.f |= tt;
} catch (I) {
throw zA(E), I;
}
else A !== null && eg(E);
if (g) {
var t = E;
if (Q && t.deps === null && t.teardown === null && t.nodes_start === null && t.first === t.last && // either `null`, or a singular child
(t.f & Cg) === 0 && (t = t.first, (B & iQ) !== 0 && (B & GQ) !== 0 && t !== null && (t.f |= GQ)), t !== null && (t.parent = e, e !== null && fD(t, e), T !== null && (T.f & jA) !== 0 && (B & bQ) === 0)) {
var C = (
/** @type {Derived} */
T
);
(C.effects ??= []).push(t);
}
}
return E;
}
function MD() {
return T !== null && !XB;
}
function ot(B) {
const A = jB(et, null, !1);
return vA(A, _A), A.teardown = B, A;
}
function pQ(B) {
Li();
var A = (
/** @type {Effect} */
O.f
), Q = !T && (A & kQ) !== 0 && (A & tt) === 0;
if (Q) {
var g = (
/** @type {ComponentContext} */
aB
);
(g.e ??= []).push(B);
} else
return ki(B);
}
function ki(B) {
return jB(nI | Qi, B, !1);
}
function pD(B) {
return Li(), jB(et | Qi, B, !0);
}
function dD(B) {
PB.ensure();
const A = jB(bQ | Cg, B, !0);
return () => {
zA(A);
};
}
function ND(B) {
PB.ensure();
const A = jB(bQ | Cg, B, !0);
return (Q = {}) => new Promise((g) => {
Q.outro ? yg(A, () => {
zA(A), g(void 0);
}) : (zA(A), g(void 0));
});
}
function be(B) {
return jB(nI, B, !1);
}
function FD(B) {
return jB(iI | Cg, B, !0);
}
function rt(B, A = 0) {
return jB(et | A, B, !0);
}
function NB(B, A = [], Q = [], g = []) {
DD(g, A, Q, (e) => {
jB(et, () => B(...e.map(p)), !0);
});
}
function sg(B, A = 0) {
var Q = jB(iQ | A, B, !0);
return Q;
}
function RB(B, A = !0) {
return jB(kQ | Cg, B, !0, A);
}
function Hi(B) {
var A = B.teardown;
if (A !== null) {
const Q = ng, g = T;
Gs(!0), wB(null);
try {
A.call(null);
} finally {
Gs(Q), wB(g);
}
}
}
function Ri(B, A = !1) {
var Q = B.first;
for (B.first = B.last = null; Q !== null; ) {
const e = Q.ac;
e !== null && vg(() => {
e.abort(Mg);
});
var g = Q.next;
(Q.f & bQ) !== 0 ? Q.parent = null : zA(Q, A), Q = g;
}
}
function GD(B) {
for (var A = B.first; A !== null; ) {
var Q = A.next;
(A.f & kQ) === 0 && zA(A), A = Q;
}
}
function zA(B, A = !0) {
var Q = !1;
(A || (B.f & Sw) !== 0) && B.nodes_start !== null && B.nodes_end !== null && (Ui(
B.nodes_start,
/** @type {TemplateNode} */
B.nodes_end
), Q = !0), Ri(B, A && !Q), UE(B, 0), vA(B, fQ);
var g = B.transitions;
if (g !== null)
for (const E of g)
E.stop();
Hi(B);
var e = B.parent;
e !== null && e.first !== null && mi(B), B.next = B.prev = B.teardown = B.ctx = B.deps = B.fn = B.nodes_start = B.nodes_end = B.ac = null;
}
function Ui(B, A) {
for (; B !== null; ) {
var Q = B === A ? null : (
/** @type {TemplateNode} */
/* @__PURE__ */ zB(B)
);
B.remove(), B = Q;
}
}
function mi(B) {
var A = B.parent, Q = B.prev, g = B.next;
Q !== null && (Q.next = g), g !== null && (g.prev = Q), A !== null && (A.first === B && (A.first = g), A.last === B && (A.last = Q));
}
function yg(B, A, Q = !0) {
var g = [];
DI(B, g, !0), Pi(g, () => {
Q && zA(B), A && A();
});
}
function Pi(B, A) {
var Q = B.length;
if (Q > 0) {
var g = () => --Q || A();
for (var e of B)
e.out(g);
} else
A();
}
function DI(B, A, Q) {
if ((B.f & FB) === 0) {
if (B.f ^= FB, B.transitions !== null)
for (const t of B.transitions)
(t.is_global || Q) && A.push(t);
for (var g = B.first; g !== null; ) {
var e = g.next, E = (g.f & GQ) !== 0 || // If this is a branch effect without a block effect parent,
// it means the parent block effect was pruned. In that case,
// transparency information was transferred to the branch effect.
(g.f & kQ) !== 0 && (B.f & iQ) !== 0;
DI(g, A, E ? Q : !1), g = e;
}
}
}
function aI(B) {
Ki(B, !0);
}
function Ki(B, A) {
if ((B.f & FB) !== 0) {
B.f ^= FB, (B.f & _A) === 0 && (vA(B, DB), eg(B));
for (var Q = B.first; Q !== null; ) {
var g = Q.next, e = (Q.f & GQ) !== 0 || (Q.f & kQ) !== 0;
Ki(Q, e ? A : !1), Q = g;
}
if (B.transitions !== null)
for (const E of B.transitions)
(E.is_global || A) && E.in();
}
}
function Yi(B, A) {
for (var Q = B.nodes_start, g = B.nodes_end; Q !== null; ) {
var e = Q === g ? null : (
/** @type {TemplateNode} */
/* @__PURE__ */ zB(Q)
);
A.append(Q), Q = e;
}
}
let Lg = !1;
function Fs(B) {
Lg = B;
}
let ng = !1;
function Gs(B) {
ng = B;
}
let T = null, XB = !1;
function wB(B) {
T = B;
}
let O = null;
function sQ(B) {
O = B;
}
let dQ = null;
function Si(B) {
T !== null && (dQ === null ? dQ = [B] : dQ.push(B));
}
let eB = null, MB = 0, kB = null;
function yD(B) {
kB = B;
}
let Ji = 1, ye = 0, Qg = ye;
function ys(B) {
Qg = B;
}
let PQ = !1;
function bi() {
return ++Ji;
}
function xe(B) {
var A = B.f;
if ((A & DB) !== 0)
return !0;
if ((A & oQ) !== 0) {
var Q = B.deps, g = (A & KB) !== 0;
if (A & jA && (B.f &= ~RE), Q !== null) {
var e, E, t = (A & HE) !== 0, C = g && O !== null && !PQ, I = Q.length;
if ((t || C) && (O === null || (O.f & fQ) === 0)) {
var s = (
/** @type {Derived} */
B
), n = s.parent;
for (e = 0; e < I; e++)
E = Q[e], (t || !E?.reactions?.includes(s)) && (E.reactions ??= []).push(s);
t && (s.f ^= HE), C && n !== null && (n.f & KB) === 0 && (s.f ^= KB);
}
for (e = 0; e < I; e++)
if (E = Q[e], xe(
/** @type {Derived} */
E
) && ui(
/** @type {Derived} */
E
), E.wv > B.wv)
return !0;
}
(!g || O !== null && !PQ) && vA(B, _A);
}
return !1;
}
function xi(B, A, Q = !0) {
var g = B.reactions;
if (g !== null && !dQ?.includes(B))
for (var e = 0; e < g.length; e++) {
var E = g[e];
(E.f & jA) !== 0 ? xi(
/** @type {Derived} */
E,
A,
!1
) : A === E && (Q ? vA(E, DB) : (E.f & _A) !== 0 && vA(E, oQ), eg(
/** @type {Effect} */
E
));
}
}
function Oi(B) {
var A = eB, Q = MB, g = kB, e = T, E = PQ, t = dQ, C = aB, I = XB, s = Qg, n = B.f;
eB = /** @type {null | Value[]} */
null, MB = 0, kB = null, PQ = (n & KB) !== 0 && (XB || !Lg || T === null), T = (n & (kQ | bQ)) === 0 ? B : null, dQ = null, mg(B.ctx), XB = !1, Qg = ++ye, B.ac !== null && (vg(() => {
B.ac.abort(Mg);
}), B.ac = null);
try {
B.f |= lC;
var i = (
/** @type {Function} */
B.fn
), o = i(), r = B.deps;
if (eB !== null) {
var w;
if (UE(B, MB), r !== null && MB > 0)
for (r.length = MB + eB.length, w = 0; w < eB.length; w++)
r[MB + w] = eB[w];
else
B.deps = r = eB;
if (!PQ || // Deriveds that already have reactions can cleanup, so we still add them as reactions
(n & jA) !== 0 && /** @type {import('#client').Derived} */
B.reactions !== null)
for (w = MB; w < r.length; w++)
(r[w].reactions ??= []).push(B);
} else r !== null && MB < r.length && (UE(B, MB), r.length = MB);
if (ii() && kB !== null && !XB && r !== null && (B.f & (jA | oQ | DB)) === 0)
for (w = 0; w < /** @type {Source[]} */
kB.length; w++)
xi(
kB[w],
/** @type {Effect} */
B
);
return e !== null && e !== B && (ye++, kB !== null && (g === null ? g = kB : g.push(.../** @type {Source[]} */
kB))), (B.f & Ag) !== 0 && (B.f ^= Ag), o;
} catch (D) {
return ri(D);
} finally {
B.f ^= lC, eB = A, MB = Q, kB = g, T = e, PQ = E, dQ = t, mg(C), XB = I, Qg = s;
}
}
function LD(B, A) {
let Q = A.reactions;
if (Q !== null) {
var g = Uw.call(Q, B);
if (g !== -1) {
var e = Q.length - 1;
e === 0 ? Q = A.reactions = null : (Q[g] = Q[e], Q.pop());
}
}
Q === null && (A.f & jA) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
// allows us to skip the expensive work of disconnecting and immediately reconnecting it
(eB === null || !eB.includes(A)) && (vA(A, oQ), (A.f & (KB | HE)) === 0 && (A.f ^= HE), hi(
/** @type {Derived} **/
A
), UE(
/** @type {Derived} **/
A,
0
));
}
function UE(B, A) {
var Q = B.deps;
if (Q !== null)
for (var g = A; g < Q.length; g++)
LD(B, Q[g]);
}
function Le(B) {
var A = B.f;
if ((A & fQ) === 0) {
vA(B, _A);
var Q = O, g = Lg;
O = B, Lg = !0;
try {
(A & iQ) !== 0 ? GD(B) : Ri(B), Hi(B);
var e = Oi(B);
B.teardown = typeof e == "function" ? e : null, B.wv = Ji;
var E;
} finally {
Lg = g, O = Q;
}
}
}
async function mE() {
await Promise.resolve(), V();
}
function p(B) {
var A = B.f, Q = (A & jA) !== 0;
if (T !== null && !XB) {
var g = O !== null && (O.f & fQ) !== 0;
if (!g && !dQ?.includes(B)) {
var e = T.deps;
if ((T.f & lC) !== 0)
B.rv < ye && (B.rv = ye, eB === null && e !== null && e[MB] === B ? MB++ : eB === null ? eB = [B] : (!PQ || !eB.includes(B)) && eB.push(B));
else {
(T.deps ??= []).push(B);
var E = B.reactions;
E === null ? B.reactions = [T] : E.includes(T) || E.push(T);
}
}
} else if (Q && /** @type {Derived} */
B.deps === null && /** @type {Derived} */
B.effects === null) {
var t = (
/** @type {Derived} */
B
), C = t.parent;
C !== null && (C.f & KB) === 0 && (t.f ^= KB);
}
if (ng) {
if (YQ.has(B))
return YQ.get(B);
if (Q) {
t = /** @type {Derived} */
B;
var I = t.v;
return ((t.f & _A) === 0 && t.reactions !== null || vi(t)) && (I = rI(t)), YQ.set(t, I), I;
}
} else if (Q) {
if (t = /** @type {Derived} */
B, WB?.has(t))
return WB.get(t);
xe(t) && ui(t);
}
if (WB?.has(B))
return WB.get(B);
if ((B.f & Ag) !== 0)
throw B.v;
return B.v;
}
function vi(B) {
if (B.v === xA) return !0;
if (B.deps === null) return !1;
for (const A of B.deps)
if (YQ.has(A) || (A.f & jA) !== 0 && vi(
/** @type {Derived} */
A
))
return !0;
return !1;
}
function xQ(B) {
var A = XB;
try {
return XB = !0, B();
} finally {
XB = A;
}
}
const kD = -7169;
function vA(B, A) {
B.f = B.f & kD | A;
}
const HD = ["touchstart", "touchmove"];
function RD(B) {
return HD.includes(B);
}
const qi = /* @__PURE__ */ new Set(), MC = /* @__PURE__ */ new Set();
function UD(B, A, Q, g = {}) {
function e(E) {
if (g.capture || re.call(A, E), !E.cancelBubble)
return vg(() => Q?.call(this, E));
}
return B.startsWith("pointer") || B.startsWith("touch") || B === "wheel" ? _B(() => {
A.addEventListener(B, e, g);
}) : A.addEventListener(B, e, g), e;
}
function _Q(B, A, Q, g, e) {
var E = { capture: g, passive: e }, t = UD(B, A, Q, E);
(A === document.body || // @ts-ignore
A === window || // @ts-ignore
A === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
A instanceof HTMLMediaElement) && ot(() => {
A.removeEventListener(B, t, E);
});
}
function mD(B) {
for (var A = 0; A < B.length; A++)
qi.add(B[A]);
for (var Q of MC)
Q(B);
}
let Ls = null;
function re(B) {
var A = this, Q = (
/** @type {Node} */
A.ownerDocument
), g = B.type, e = B.composedPath?.() || [], E = (
/** @type {null | Element} */
e[0] || B.target
);
Ls = B;
var t = 0, C = Ls === B && B.__root;
if (C) {
var I = e.indexOf(C);
if (I !== -1 && (A === document || A === /** @type {any} */
window)) {
B.__root = A;
return;
}
var s = e.indexOf(A);
if (s === -1)
return;
I <= s && (t = I);
}
if (E = /** @type {Element} */
e[t] || B.target, E !== A) {
Ne(B, "currentTarget", {
configurable: !0,
get() {
return E || Q;
}
});
var n = T, i = O;
wB(null), sQ(null);
try {
for (var o, r = []; E !== null; ) {
var w = E.assignedSlot || E.parentNode || /** @type {any} */
E.host || null;
try {
var D = E["__" + g];
D != null && (!/** @type {any} */
E.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
// -> the target could not have been disabled because it emits the event in the first place
B.target === E) && D.call(E, B);
} catch (a) {
o ? r.push(a) : o = a;
}
if (B.cancelBubble || w === A || w === null)
break;
E = w;
}
if (o) {
for (let a of r)
queueMicrotask(() => {
throw a;
});
throw o;
}
} finally {
B.__root = A, delete B.currentTarget, wB(n), sQ(i);
}
}
}
function Ti(B) {
var A = document.createElement("template");
return A.innerHTML = B.replaceAll("<!>", "<!---->"), A.content;
}
function IQ(B, A) {
var Q = (
/** @type {Effect} */
O
);
Q.nodes_start === null && (Q.nodes_start = B, Q.nodes_end = A);
}
// @__NO_SIDE_EFFECTS__
function v(B, A) {
var Q = (A & eD) !== 0, g = (A & ED) !== 0, e, E = !B.startsWith("<!>");
return () => {
if (Y)
return IQ(_, null), _;
e === void 0 && (e = Ti(E ? B : "<!>" + B), Q || (e = /** @type {Node} */
/* @__PURE__ */ ZB(e)));
var t = (
/** @type {TemplateNode} */
g || pi ? document.importNode(e, !0) : e.cloneNode(!0)
);
if (Q) {
var C = (
/** @type {TemplateNode} */
/* @__PURE__ */ ZB(t)
), I = (
/** @type {TemplateNode} */
t.lastChild
);
IQ(C, I);
} else
IQ(t, t);
return t;
};
}
function ks(B = "") {
if (!Y) {
var A = GB(B + "");
return IQ(A, A), A;
}
var Q = _;
return Q.nodeType !== Ct && (Q.before(Q = GB()), OA(Q)), IQ(Q, Q), Q;
}
function YB() {
if (Y)
return IQ(_, null), _;
var B = document.createDocumentFragment(), A = document.createComment(""), Q = GB();
return B.append(A, Q), IQ(A, Q), B;
}
function U(B, A) {
if (Y) {
O.nodes_end = _, yQ();
return;
}
B !== null && B.before(
/** @type {Node} */
A
);
}
let pC = !0;
function lQ(B, A) {
var Q = A == null ? "" : typeof A == "object" ? A + "" : A;
Q !== (B.__t ??= B.nodeValue) && (B.__t = Q, B.nodeValue = Q + "");
}
function cI(B, A) {
return Wi(B, A);
}
function PD(B, A) {
fC(), A.intro = A.intro ?? !1;
const Q = A.target, g = Y, e = _;
try {
for (var E = (
/** @type {TemplateNode} */
/* @__PURE__ */ ZB(Q)
); E && (E.nodeType !== Ig || /** @type {Comment} */
E.data !== ti); )
E = /** @type {TemplateNode} */
/* @__PURE__ */ zB(E);
if (!E)
throw gg;
mB(!0), OA(
/** @type {Comment} */
E
);
const t = Wi(B, { ...A, anchor: E });
return mB(!1), /** @type {Exports} */
t;
} catch (t) {
if (t instanceof Error && t.message.split(`
`).some((C) => C.startsWith("https://svelte.dev/e/")))
throw t;
return t !== gg && console.warn("Failed to hydrate: ", t), A.recover === !1 && Tw(), fC(), Fi(Q), mB(!1), cI(B, A);
} finally {
mB(g), OA(e);
}
}
const lg = /* @__PURE__ */ new Map();
function Wi(B, { target: A, anchor: Q, props: g = {}, events: e, context: E, intro: t = !0 }) {
fC();
var C = /* @__PURE__ */ new Set(), I = (i) => {
for (var o = 0; o < i.length; o++) {
var r = i[o];
if (!C.has(r)) {
C.add(r);
var w = RD(r);
A.addEventListener(r, re, { passive: w });
var D = lg.get(r);
D === void 0 ? (document.addEventListener(r, re, { passive: w }), lg.set(r, 1)) : lg.set(r, D + 1);
}
}
};
I(sI(qi)), MC.add(I);
var s = void 0, n = ND(() => {
var i = Q ?? A.appendChild(GB());
return rD(
/** @type {TemplateNode} */
i,
{
pending: () => {
}
},
(o) => {
if (E) {
VA({});
var r = (
/** @type {ComponentContext} */
aB
);
r.c = E;
}
if (e && (g.$$events = e), Y && IQ(
/** @type {TemplateNode} */
o,
null
), pC = t, s = B(o, g) || {}, pC = !0, Y && (O.nodes_end = _, _ === null || _.nodeType !== Ig || /** @type {Comment} */
_.data !== oI))
throw Je(), gg;
E && $A();
}
), () => {
for (var o of C) {
A.removeEventListener(o, re);
var r = (
/** @type {number} */
lg.get(o)
);
--r === 0 ? (document.removeEventListener(o, re), lg.delete(o)) : lg.set(o, r);
}
MC.delete(I), i !== Q && i.parentNode?.removeChild(i);
};
});
return dC.set(s, n), s;
}
let dC = /* @__PURE__ */ new WeakMap();
function KD(B, A) {
const Q = dC.get(B);
return Q ? (dC.delete(B), Q(A)) : Promise.resolve();
}
class Oe {
/** @type {TemplateNode} */
anchor;
/** @type {Map<Batch, Key>} */
#B = /* @__PURE__ */ new Map();
/** @type {Map<Key, Effect>} */
#A = /* @__PURE__ */ new Map();
/** @type {Map<Key, Branch>} */
#Q = /* @__PURE__ */ new Map();
/**
* Whether to pause (i.e. outro) on change, or destroy immediately.
* This is necessary for `<svelte:element>`
*/
#g = !0;
/**
* @param {TemplateNode} anchor
* @param {boolean} transition
*/
constructor(A, Q = !0) {
this.anchor = A, this.#g = Q;
}
#I = () => {
var A = (
/** @type {Batch} */
GA
);
i