UNPKG

@qwik.dev/core

Version:

An open source framework for building instant loading web apps at any scale, without the extra effort.

2,215 lines (1,980 loc) 278 kB
/** * @license * @qwik.dev/core 2.0.0-beta.36-dev+3268fab * Copyright QwikDev. All Rights Reserved. * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE */ import { isServer as $e, isBrowser as ye } from "@qwik.dev/core/build"; export { isBrowser, isServer } from "@qwik.dev/core/build"; import { p as pe } from "@qwik.dev/core/preloader"; const me = !1; const be = (t, n, ...e) => { const s = n instanceof Error ? n : Error(n); console.error("%cQWIK ERROR", "", s.message, ...e, s.stack); t && setTimeout(() => { throw s; }, 0); return s; }; /*@__INLINE__*/ const ve = (t, n, e) => { let s = e >> 1; let o = t.length - 2 >> 1; for (;s <= o; ) { const e = s + (o - s >> 1); const r = t[e << 1]; if (r === n) { return e << 1; } r < n ? s = e + 1 : o = e - 1; } return ~(s << 1); }; const _e = (t, n, e, s, o = !1) => { const r = ve(t, n, s); r >= 0 ? e != null || o ? t[r + 1] = e : t.splice(r, 2) : (e != null || o) && t.splice(r ^ -1, 0, n, e); }; const ge = (t, n, e) => { const s = ve(t, n, e); return s >= 0 ? t[s + 1] : null; }; const Ee = (t, n, e) => ve(t, n, e) >= 0; const Se = t => { const n = Object.getPrototypeOf(t); return n === Object.prototype || n === Array.prototype || n === null; }; const ke = t => typeof t === "object" && t !== null; const Re = t => Array.isArray(t); const Pe = t => typeof t === "string"; const Te = t => typeof t === "function"; const qe = (t, n = []) => { const e = (t => `Code(Q${t}) https://qwikdev-build-v2.qwik-8nx.pages.dev/docs/errors/#q${t}`)(t, ...n); return ((t, ...n) => { const e = be(false, t, ...n); debugger; return e; })(e, ...n); }; const Me = "<sync>"; const Ae = t => typeof t === "function" && typeof t.getSymbol === "function"; const Sh = t => { const n = t.lastIndexOf("_") + 1; return t.slice(n); }; const xe = "q:type"; const Ie = { ["V"]: "Virtual", ["F"]: "Fragment", ["S"]: "Signal", ["A"]: "Awaited", ["C"]: "Component", ["I"]: "InlineComponent", ["P"]: "Projection" }; const Oe = 124; const je = (t, n) => { const e = parseInt(t, 10) - 1; const s = e + n; return -(s * (s + 1) / 2 + n + 1); }; function t(t) { let n = ""; for (let e = 0; e < t.length; e++) { if (t.charAt(e) === "\\" && e + 1 < t.length) { n += t.charAt(e + 1); e++; } else { n += t.charAt(e); } } return n; } const Le = "q:renderFn"; const Fe = "q:targetEl"; const Xe = "⚡️"; const De = "q:slot"; const We = "q:s"; const Ve = "[q\\:patch]"; const kh = "q:r"; const Rh = "q:rp"; const Ue = "q:style"; const ze = "style[q\\:style]"; const Be = ze + ",style[q\\:sstyle]"; const He = "q:sstyle"; const Je = "q:ctx"; const Qe = "q:brefs"; const Ye = (t, n) => t["qFuncs_" + n] || []; const Ge = "q:base"; const Ke = "q:container-island"; const Ze = "/" + Ke; const ts = "q:ignore"; const ns = "/" + ts; const es = "q:container"; const ss = "/" + es; const rs = "q:cursorBoundary"; const is = "q:template"; const os = "[q\\:container]:not([q\\:container=html]):not([q\\:container=text])"; const ls = "http://www.w3.org/1999/xhtml"; const us = "http://www.w3.org/2000/svg"; const cs = "http://www.w3.org/1998/Math/MathML"; const fs = "qRender"; const as = "q:id"; const hs = "q:key"; const ds = "q:props"; const ps = "q:seq"; const $s = "q:seqIdx"; const ys = "q:p"; const ms = "q:ps"; const bs = ":on"; const vs = ":onIdx"; const _s = ":onFlags"; const gs = ":nearestCursorBoundary"; const Es = ":"; const Ss = "dangerouslySetInnerHTML"; const Rs = 100; const Ps = t => !!t && typeof t == "object" && typeof t.then === "function"; const Ts = (t, n, e) => { try { const s = t(); return Ps(s) ? s.then(n, e) : n(s); } catch (t) { return e(t); } }; const qs = (t, n) => Ps(t) ? t.then(n) : n(t); const Ms = t => { throw t; }; function n(t, n = Ms) { let e = !1; let s; try { s = t(); e = !0; } catch (t) { s = t; } if (!Ps(s)) { if (e) { return s; } return n(s); } let o = Rs; const r = async e => { for (;Ps(e); ) { try { await e; return await t(); } catch (t) { if (!Ps(t)) { e = t; break; } if (! --o) { e = Error("Exceeded max retry count in retryOnPromise"); break; } e = t; } } return n(e); }; return e ? s.catch(r) : r(s); } const As = t => Xe + t; const xs = t => { if (t) { let n = 0; do { t = t.substring(0, n) + As(t.substring(n)); } while ((n = t.indexOf(" ", n) + 1) !== 0); } return t || null; }; const Is = t => t.charCodeAt(0) === 113 && t.charCodeAt(1) === 45 && (t.charCodeAt(3) === 58 || t.charCodeAt(3) === 112 && t.charCodeAt(4) === 58); function e(t, n = !1) { if (t.endsWith("$")) { const [e, s] = function o(t, n = !1) { let e; let s = -1; if (t.startsWith("on")) { e = n ? "q-ep:" : "q-e:"; s = 2; } else if (t.startsWith("window:on")) { e = n ? "q-wp:" : "q-w:"; s = 9; } else if (t.startsWith("document:on")) { e = n ? "q-dp:" : "q-d:"; s = 11; } return [ e, s ]; }(t, n); if (s !== -1) { return e + Ns(t.slice(s, -1)); } } return null; } const Ns = t => t === "DOMContentLoaded" ? "-d-o-m-content-loaded" : function n(t, e = "") { const s = Cs(t); return e + s; }(t.charAt(0) === "-" ? t.slice(1) : t.toLowerCase()); const Cs = t => t.replace(/([A-Z-])/g, t => "-" + t.toLowerCase()); const Os = t => { const n = t.indexOf(":"); return [ t.slice(2, n), t.slice(n + 1) ]; }; const js = new Set([ "animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexShrink", "gridArea", "gridRow", "gridRowEnd", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "MozAnimationIterationCount", "MozBoxFlex", "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp" ]); const Ls = (t, n = 0) => { for (let e = 0; e < t.length; e++) { const s = t.charCodeAt(e); n = (n << 5) - n + s; n |= 0; } return (+Math.abs(n)).toString(36); }; const Fs = t => { if (!t) { return ""; } if (Pe(t)) { return t.trim(); } const n = []; if (Re(t)) { for (let e = 0; e < t.length; e++) { const s = t[e]; const o = Fs(s); o && n.push(o); } } else { for (const [e, s] of Object.entries(t)) { s && n.push(e.trim()); } } return n.join(" "); }; const Xs = t => t.replace(/([A-Z])/g, "-$1").toLowerCase(); function s(t, n, e) { if (function s(t) { return t === "class"; }(t)) { const t = Fs(n); n = e ? e + (t.length ? " " + t : t) : t; } else { t === "style" ? n = (t => { if (t == null) { return ""; } if (typeof t == "object") { if (Re(t)) { throw qe(0, [ t, "style" ]); } { const n = []; for (const e in t) { if (Object.prototype.hasOwnProperty.call(t, e)) { const s = t[e]; s != null && typeof s !== "function" && (e.startsWith("--") ? n.push(e + ":" + s) : n.push(Xs(e) + ":" + Ds(e, s))); } } return n.join(";"); } } return t + ""; })(n) : function o(t) { return function n(t) { return t.startsWith("aria-"); }(t) || [ "spellcheck", "draggable", "contenteditable" ].includes(t); }(t) || typeof n === "number" ? n = (t => t != null ? t + "" : null)(n) : n === !1 || n == null ? n = null : n === !0 && function r(t) { return t.startsWith("preventdefault:"); }(t) && (n = ""); } return n; } const Ds = (t, n) => { if (typeof n === "number" && n !== 0 && !(t => js.has(t))(t)) { return n + "px"; } return n; }; const Ws = t => { let n; if (typeof MessageChannel !== "undefined") { const e = new MessageChannel; e.port1.onmessage = () => t(); n = () => e.port2.postMessage(null); } else { n = () => setTimeout(t); } return n; }; const Vs = () => ({ isServer: $e, importSymbol(t, n, e) { if ($e) { const t = Sh(e); const n = globalThis.__qwik_reg_symbols?.get(t); if (n) { return n; } throw qe(6, [ e ]); } if (!n) { throw qe(14, [ e ]); } if (!t) { throw qe(13, [ n, e ]); } const s = Us(t.ownerDocument, t, n).toString(); const o = new URL(s); o.hash = ""; const r = o.href; return import(r).then(t => t[e]); }, raf: t => new Promise(n => { requestAnimationFrame(() => { n(t()); }); }), chunkForSymbol(t, n) { return [ t, n ?? "_" ]; } }); const Us = (t, n, e) => { const s = t.baseURI; const o = new URL(n.getAttribute(Ge) ?? s, s); return new URL(e, o); }; let zs = /*#__PURE__ */ Vs(); const Bs = t => zs = t; const Hs = () => zs; const Ph = () => zs.isServer; const Th = typeof document !== "undefined"; const Js = !$e && Th; const Qs = Js ? document : void 0; const Ys = Js && Qs.createElement("link").relList?.supports?.("modulepreload") ? "modulePreload" : "preload"; const Gs = /\.[mc]?js$/; const Ks = 1e3 / 60; const Zs = t => { let n = tr.get(t); if (!n) { let e; n = ((t, n) => ({ Wt: t, Ot: Gs.test(t) ? 0 : 3, Vt: n, Ut: 1, zt: performance.now(), Bt: 0, Ht: 0 }))(t, e); tr.set(t, n); } return n; }; const tr = new Map; let nr = 0; const er = []; const sr = Ws(function qh() { ir = !1; if (!er.length) { return; } const t = performance.now() + Ks; let n = !1; for (;er.length; ) { const e = er[0]; const s = e.Ut; const o = 1 - s; if (!(o >= .99 || nr < 25)) { break; } er.shift(); fr(e); if (performance.now() >= t) { n = !0; break; } } if (n && er.length && !ir) { ir = !0; sr(); } }); const rr = Ws(r); let ir = !1; let or = !1; let lr = !1; const ur = []; const cr = () => { const t = ur[ur.length - 1]; const n = t.Jt; if (t.Vt) { const e = t.Qt; if (e >= t.Vt.length) { ur.pop(); return !1; } const s = t.Vt[e]; t.Qt = e + 1; const o = Zs(s.Wt); if (o.Ut === 0) { return !0; } const r = 1 - n.Ut; let i; if (r === 1 || r >= .99) { i = Math.min(.01, 1 - s.Yt); } else { const t = 1 - s.Yt * r; const n = s.Gt; const e = t / n; i = Math.max(.02, o.Ut * e); s.Gt = e; } ur.push({ Jt: o, Ut: i, Kt: t.Kt }); return !0; } if (t.Kt?.has(n)) { ur.pop(); return !1; } const e = n.Ut; n.Ut = t.Ut; if (e - n.Ut < .01) { ur.pop(); return !1; } if (n.Vt?.length) { const e = t.Kt || new Set; e.add(n); t.Kt = e; t.Vt = n.Vt; t.Qt = 0; return !1; } ur.pop(); return !1; }; function r() { if (lr || !ur.length) { return; } or = !1; lr = !0; const t = Js ? performance.now() + Ks : 0; let n = !1; for (;ur.length; ) { n = !0; const e = cr(); if (Js && e && performance.now() >= t) { if (!or) { or = !0; rr(); } break; } } lr = !1; n && Js && sr(); } const fr = t => { if (t.Ot >= 2) { return; } nr++; const n = performance.now(); t.Bt = n - t.zt; t.Ot = 2; const e = Qs.createElement("link"); e.href = new URL("undefined" + t.Wt, Qs.baseURI).toString(); e.rel = Ys; e.as = "script"; e.onload = e.onerror = () => { nr--; const s = performance.now(); t.Ht = s - n; t.Ot = 4; e.remove(); sr(); }; Qs.head.appendChild(e); }; const ar = (t, n) => { const e = Zs(t); e && ((t, n) => { ur.unshift({ Jt: t, Ut: n, Kt: void 0 }); })(e, n); }; Js && document.addEventListener("qsymbol", t => { const {symbol: n, href: e} = t.detail; if (e) { const t = n.slice(n.lastIndexOf("_") + 1); (t => { if (!t?.length) { return; } if (Array.isArray(t)) { for (let n = t.length - 1; n >= 0; n--) { const e = t[n]; ar(e, 0); } } else { ar(t, 0); } Js ? rr() : r(); })(t); } }); const hr = t => { for (const n in t) { if (Object.prototype.hasOwnProperty.call(t, n)) { return !1; } } return !0; }; const dr = t => ({ write: t, writeRootRef(t) { return ((t, n) => t.write(n + ""))(this, t); }, writeRootRefPath(t) { return ((t, n) => t.write((t => { let n = t[0] + ""; for (let e = 1; e < t.length; e++) { n += " " + t[e]; } return n; })(n)))(this, t); } }); const pr = '"'; const $r = "["; const yr = "]"; const mr = ","; const wr = "2.0.0-beta.36-dev+3268fab"; const br = t => t.nodeType === 1; const Mh = t => t.Cn; const vr = Symbol(); class _r { [vr]=void 0; } const gr = t => t === "foreignObject"; const Er = t => t === "svg" || gr(t); const Sr = t => t === "math"; function i(t, n, e, s = !1) { const o = t.ownerDocument.createElementNS(e, n); for (let n = 0; n < t.attributes.length; n++) { const e = t.attributes[n]; e.name !== Es && o.setAttribute(e.name, e.value); } if (s) { for (let n = 0; n < t.childNodes.length; n++) { const r = t.childNodes[n]; const c = r.nodeType; c === 3 ? o.appendChild(r.cloneNode()) : c === 1 && o.appendChild(i(r, r.localName, e, s)); } } return o; } const kr = { elementNamespace: ls, elementNamespaceFlag: 0 }; function o(t, n) { const e = !t || !!El(t) && (t => { const n = t.flags; return (n & 1536) === 0; })(t); const s = !e && gr(El(t)); let o = ls; let r = 0; const i = typeof n === "string" || zo(n); if (i && function c(t) { if (typeof t === "string") { return Er(t); } if (zo(t)) { return Er(El(t)) || (t.flags & 512) !== 0; } return !1; }(n)) { o = us; r = 512; } else if (i && function l(t) { if (typeof t === "string") { return Sr(t); } if (zo(t)) { return Sr(El(t)) || (t.flags & 1024) !== 0; } return !1; }(n)) { o = cs; r = 1024; } else if (t && !s && !e) { const n = (t.flags & 512) !== 0; const e = (t.flags & 1024) !== 0; o = n ? us : e ? cs : ls; r = t.flags & 1536; } kr.elementNamespace = o; kr.elementNamespaceFlag = r; return kr; } class Rr { flags; parent; previousSibling; nextSibling; props; [vr]=void 0; slotParent=null; dirty=0; dirtyChildren=null; nextDirtyChildIndex=0; constructor(t, n, e, s, o) { this.flags = t; this.parent = n; this.previousSibling = e; this.nextSibling = s; this.props = o; } toString() { return Object.prototype.toString.call(this); } } class Pr extends Rr { key; firstChild; lastChild; constructor(t, n, e, s, o, r, i, c) { super(n, e, s, o, r); this.key = t; this.firstChild = i; this.lastChild = c; } } class Tr extends Pr { node; elementName; constructor(t, n, e, s, o, r, i, c, l, u) { super(t, n, e, s, o, r, i, c); this.node = l; this.elementName = u; } } class qr extends Rr { node; text; constructor(t, n, e, s, o, r, i) { super(t, n, e, s, o); this.node = r; this.text = i; } } const Mr = []; const Ar = []; function l(t, n) { const e = y(n).priority; let s = Mr.length; for (let t = 0; t < Mr.length; t++) { const n = y(Mr[t]).priority; if (e < n) { s = t; break; } } Mr.splice(s, 0, n); t.o++; t.l ||= new Promise(n => t.u = n); } function u() { for (let t = 0; t < Mr.length; t++) { const n = Mr[t]; let e = !1; for (let t = 0; t < Ar.length; t++) { const s = Ar[t]; if (zl(n, s)) { e = !0; break; } } if (!e) { return n; } } return null; } function c(t, n) { Ar.push(t); h(t, n, !0); n.o++; } function f(t, n) { d(t, n); if (!(t.flags & 256)) { return; } l(n, t); } function a(t, n, e) { const s = y(e); if (!s || s === n) { return; } h(e, t, !1); d(e, t); $(n, s); s.afterFlushTasks = null; s.extraPromises = null; s.journal = null; s.boundaries = null; s.position = null; s.promise = null; } function h(t, n, e) { e || (t.flags &= -257); const s = Mr.indexOf(t); if (s !== -1) { Mr.splice(s, 1); n.o--; return !0; } return !1; } function d(t, n) { const e = Ar.indexOf(t); if (e === -1) { return !1; } const s = Ar.length - 1; e !== s && (Ar[e] = Ar[s]); Ar.pop(); n.o--; return !0; } const xr = new WeakMap; const Ir = ":nodeProps"; const Nr = ":nodeDiff"; const Cr = ":errorData"; const Or = ":signal"; const jr = ":inlineComponentData"; function p(t, n, e) { n.position = e; e && cn(e) && function s(t, n, e) { h(e, t); const s = y(e); (function o(t, n) { if (n === t) { return; } const e = n.afterFlushTasks; if (e && e.length > 0) { const n = t.afterFlushTasks; n ? n.push(...e) : t.afterFlushTasks = e; } const s = n.extraPromises; if (s && s.length > 0) { const n = t.extraPromises; n ? n.push(...s) : t.extraPromises = s; } $(t, n); })(n, s); }(t, n, e); } function $(t, n) { if (n === t) { return; } const e = n.journal; if (e && e.length > 0) { const n = t.journal; n ? n.push(...e) : t.journal = e; } const s = n.boundaries; if (__EXPERIMENTAL__.suspense && s && s.length > 0) { const n = t.boundaries ||= []; for (let t = 0; t < s.length; t++) { const e = s[t]; n.includes(e) || n.push(e); } } } function y(t) { return xr.get(t) ?? null; } const Lr = Symbol(); class Fr { consumer; property; backRef; data; constructor(t, n, e = null, s = null) { this.consumer = t; this.property = n; this.backRef = e; this.data = s; } } const Xr = Symbol(); const Dr = Symbol(); const Wr = Symbol(); function m(t, n, e) { t[vr] || ($e && function s(t) { return "__brand__" in t && t.__brand__ === "SsrNode"; }(t) ? t.setProp(Qe, new Map) : t[vr] = new Map); const o = t[vr]; let r = o.get(n); if (!r) { r = new Fr(t, n); o.set(n, r); } e && (r.data = e); return r; } const Vr = (t, n) => (e, s) => { const o = he(); o.Ft = m(t, ":"); o.$ = n || void 0; return ce(o, () => { if (Te(e)) { return e(); } if (s) { return e[s]; } if (iu(e)) { return e.value; } if (ke(e) && vu(e)) { qn(yu(e), Wr, $u(e), o.Ft); return e; } throw qe(2); }); }; class Ur { Zt; ct=void 0; $=null; tn=null; constructor(t, n) { this.$ = t || ef()?.$ || null; this.Zt = n; } trigger() { fu(this.$, this, this.ct); } force() { fu(this.$, this, this.ct); } get untrackedValue() { return this.Zt; } set untrackedValue(t) { this.Zt = t; } get value() { const t = this.untrackedValue; const n = ef(); if (!n) { return t; } this.$ === null && (this.$ = n.$); const e = n.Ft; if (e) { const t = $e; const s = this.ct ||= new Set; const o = __EXPERIMENTAL__.suspense && t; ou(s, e); lu(e, this); if (t) { const t = cu(n.$, this.$); o && t?.nn?.(this, e, null); uu(e, t); } } return t; } set value(t) { if (t !== this.Zt) { this.Zt = t; fu(this.$, this, this.ct); } } valueOf() {} toString() { return this.constructor.name; } toJSON() { return { value: this.Zt }; } } class zr extends Ur { en; h; [vr]=void 0; constructor(t, n, e = 17) { super(t || ef()?.$, Lr); this.en = n; this.h = e; } invalidate() { this.h |= 1; const t = he(); t.$ = this.$ || void 0; const e = n(fe.bind(this, t, this.p)); e && e.catch(t => { this.$ ? this.$.handleError(t, null) : console.error("Error during computation", t); }); } get untrackedValue() { this.p(); return this.Zt; } set untrackedValue(t) { this.Zt = t; } p() { if (!(this.h & 1)) { return; } const t = this.en; ru(t); const n = ef(); const e = n?.Ft; if (n) { const t = m(this, "."); gn(this.$, t); n.Ft = t; } try { const e = t.getFn(n)(); if (Ps(e)) { throw qe(29, [ t.dev ? t.dev.file : "", t.it ]); } this.h &= -2; super.value = e; } finally { n && (n.Ft = e); } } } class Br { sn; rn=null; ln=!1; un=!0; constructor(t, n, e) { this.sn = t; if (n !== void 0) { this.info = n; this.cn = e; } } get track() { return this.fn ||= Vr(this.sn, this.sn.$); } get abortSignal() { return (this.an ||= new AbortController).signal; } cache() {} get previous() { const t = this.sn.Zt; if (t !== Lr) { return t; } } cleanup(t) { typeof t === "function" && (this.hn ||= []).push(t); } } class Hr extends zr { dn=!1; pn=void 0; $n=null; [vr]=void 0; constructor(t, n, e = 17, s) { super(t, n, e); if (!s) { return; } const o = s.initial; if (o !== void 0) { const t = typeof o === "function" ? o() : o; this.Zt = t; } const r = s.concurrency; if (r !== void 0 && r >= 0 && r !== 1) { this.yn = r; this.mn = []; } const i = s.timeout; i && (this.wn = i); s.eagerCleanup && (this.h |= 32); s.clientOnly && (this.h |= 64); s.allowStale === !1 && (this.h |= 128); const c = s.expires ?? (s.interval ? Math.abs(s.interval) : void 0); c && (this.expires = c); (s.poll === !1 || s.interval !== void 0 && s.interval < 0) && (this.h |= 256); } get untrackedValue() { this.p(); if (this.$n?.rn) { if (this.Zt === Lr || $e) { throw this.$n?.rn; } return this.Zt; } if (this.pn) { throw this.pn; } if ($e && this.h & 64 && this.Zt === Lr) { throw qe(35); } return this.Zt; } set untrackedValue(t) { this.Zt = t; } get value() { return super.value; } set value(t) { this.h &= -2; this.untrackedLoading = !1; this.untrackedError = void 0; this.bn = void 0; if (this.mn) { for (let t = 0; t < this.mn.length; t++) { this.mn[t].un = !1; } } else { this.$n && (this.$n.un = !1); } this.vn(); super.value = t; this._n(); } get loading() { const t = this.untrackedLoading; const n = ef(); if (n && (this.$ ||= n.$ || null)) { const t = n.Ft; if (t) { ou(this.$t ||= new Set, t); lu(t, this); uu(t, this.$); } } return t; } set untrackedLoading(t) { if (t !== this.dn) { this.dn = t; fu(this.$, this, this.$t); } } get untrackedLoading() { this.p(); if ($e && this.$n?.rn) { throw this.$n?.rn; } return this.dn; } get error() { const t = this.untrackedError; const n = ef(); if (n && (this.$ ||= n.$ || null)) { const t = n.Ft; if (t) { ou(this.yt ||= new Set, t); lu(t, this); uu(t, this.$); } } return t; } set untrackedError(t) { if (t !== this.pn) { this.pn = t; fu(this.$, this, this.yt); } } get untrackedError() { return this.pn; } get expires() { return this.Pt || 0; } set expires(t) { this.vn(); this.Pt = t; this.Pt && this.gn() && this._n(); } get poll() { return !(this.h & 256); } set poll(t) { t ? this.h &= -257 : this.h |= 256; if (this.Pt && this.gn()) { this.vn(); this._n(); } } get interval() { const t = this.Pt || 0; return this.h & 256 ? -t : t; } set interval(t) { t < 0 ? this.h |= 256 : this.h &= -257; this.expires = Math.abs(t); } async invalidate(t) { if (arguments.length > 0) { this.bn = t; this.cn = this.cn === void 0 ? 1 : this.cn + 1; } this.En(!0, this.h & 128); } En(t, n) { this.h |= 1; this.vn(); n && (this.Zt = Lr); t && (this.ct?.size || this.$t?.size || this.yt?.size) && Promise.resolve().then(() => this.p()); } abort(t) { this.$n && this.Sn(this.$n, t); } wt() { if (!(this.h & 32) || this.gn()) { return; } if (!ye) { return; } setTimeout(() => { this.gn() || this.abort(); }); } async promise() { this.p(); for (;this.$n?.rn; ) { await (this.$n?.rn); } } p() { if (!(this.h & 1)) { return; } if ($e && this.h & 64) { this.dn = !0; this.$?.serializationCtx.Tt.add(this); return; } this.vn(); this.h &= -2; const t = this.$n; t && this.Sn(t); const n = this.yn === 0 ? Infinity : this.yn ?? 1; if (this.mn ? this.mn.length >= n : t?.rn) { this.h |= 1; return; } const e = this.cn; const s = new Br(this, this.bn, e); this.$n = s; this.mn && this.mn.push(s); s.rn = this.kn(s); } async kn(t) { let e = this.en.resolved; if (!e) { this.untrackedLoading = !0; e = await this.en.resolve(); if (t.an?.signal.aborted) { t.rn = null; return; } } try { this.wn && (this.Rn = setTimeout(() => { const n = Error(`timeout ${this.wn}ms`); this.Pn(t, n); t.an?.abort(n); }, this.wn)); const s = n(e.bind(null, t)); let o; if (Ps(s)) { this.untrackedLoading = !0; o = await s; } else { o = s; } t.rn = null; if (t.un) { const n = this.mn; if (n) { let e = !1; for (let s = n.length - 1; s >= 0; s--) { n[s] === t ? e = !0 : e && (n[s].un = !1); } } this.untrackedError = void 0; super.value = o; } } catch (n) { t.rn = null; this.Pn(t, n); } if ((() => t === this.$n)()) { clearTimeout(this.Rn); t.cn === this.cn && (this.bn = void 0); if (this.h & 1) { this.p(); } else { this.untrackedLoading = !1; this._n(); } } } Pn(t, n) { if (t !== this.$n || !t.un) { return; } t.un = !1; if (n instanceof Error && n.name === "AbortError") { return; } this.untrackedError = n; this.untrackedValue = Lr; } async Tn() { this.vn(); clearTimeout(this.Rn); const t = this.$n; t && this.Sn(t); this.mn ? await Promise.all(this.mn.map(t => t.rn)) : await (t?.rn); } vn() { if (this.qn !== void 0) { clearTimeout(this.qn); this.qn = void 0; } } _n() { if ($e || !this.Pt) { return; } this.vn(); const t = !(this.h & 256); const n = this.h & 128 && !t; this.qn = setTimeout(() => this.En(t, n), this.Pt); this.qn?.unref?.(); } gn() { return !!(this.ct?.size || this.$t?.size || this.yt?.size); } Sn(t, n) { if (t.ln) { return; } t.ln = !0; t.an?.abort(n); t.rn = qs(t.rn, () => this.Mn(t)); } Mn(t) { const n = t.hn; const e = t => { const n = this.$?.handleError; n ? n(t, null) : console.error("Error in async signal cleanup", t); }; const s = () => { t.rn = null; n && (n.length = 0); const e = this.mn; if (e) { const n = e.indexOf(t); n !== -1 && e.splice(n, 1); } this.p(); }; let o; if (n) { for (let t = 0; t < n.length; t++) { try { const s = n[t](); Ps(s) && (o = (o ? o.then(() => s) : s).catch(e)); } catch (t) { e(t); } } } if (o) { return o.then(s); } s(); } } const Jr = Symbol(); const Qr = Symbol(); const Yr = Symbol(); const Gr = Symbol(); const Kr = Symbol(); const Zr = Symbol(); const ti = []; const ni = {}; Object.freeze(ti); Object.freeze(ni); function w(t) { return new Proxy({}, new ei(t)); } class ei { owner; ct=void 0; $=null; constructor(t) { this.owner = t; } get(t, n) { if (n === Jr) { return this.owner.constProps; } if (n === Qr) { return this.owner.varProps; } if (n === Yr) { return this.owner; } if (n === Gr) { return this; } let s; if (n === "children") { s = this.owner.children; } else { if (typeof n === "string" && typeof this.owner.type === "string") { const t = e(n); t && (n = t); } s = ii(this.owner, n); n in this.owner.varProps && si(this, n); } return s instanceof ki && s.h & 4 ? s.value : s; } set(t, n, s) { if (n === Yr) { this.owner = s; } else if (n === "children") { this.owner.children = s; } else if (n === Jr) { this.owner.constProps = s; } else if (n === Qr) { this.owner.varProps = s; } else { if (typeof n === "string" && typeof this.owner.type === "string") { const t = e(n); t && (n = t); } this.owner.constProps && n in this.owner.constProps && delete this.owner.constProps[n]; this.owner.varProps === ni ? this.owner.varProps = {} : n in this.owner.varProps || (this.owner.toSort = !0); if (this.owner.varProps[n] !== s) { this.owner.varProps[n] = s; ri(this, n); } } return !0; } deleteProperty(t, n) { let e = delete this.owner.varProps[n]; e && ri(this, n); this.owner.constProps && (e = delete this.owner.constProps[n] || e); if (this.owner.children != null && n === "children") { this.owner.children = null; e = !0; } return e; } has(t, n) { if (n === "children") { return this.owner.children != null; } if (n === Jr || n === Qr) { return !0; } const s = n in this.owner.varProps; if (typeof n === "string") { s && si(this, n); if (typeof this.owner.type === "string") { const t = e(n); t && (n = t); } } return s || !!this.owner.constProps && n in this.owner.constProps; } getOwnPropertyDescriptor(t, n) { const e = n === "children" ? this.owner.children : this.owner.constProps && n in this.owner.constProps ? this.owner.constProps[n] : this.owner.varProps[n]; return { configurable: !0, enumerable: !0, value: e }; } ownKeys() { const t = Object.keys(this.owner.varProps); this.owner.children != null && t.push("children"); if (this.owner.constProps) { for (const n in this.owner.constProps) { t.indexOf(n) === -1 && t.push(n); } } return t; } } const si = (t, n) => { const e = ef(); e && t.$ === null && e.$ && (t.$ = e.$); const s = e?.Ft; s && qn(t.owner._proxy, n, t, s); }; const ri = (t, n) => { const e = function s(t, n) { return t?.get(n); }(t.ct, n); e && fu(t.$, t, e); return !!e; }; const ii = (t, n) => t.constProps && n in t.constProps ? t.constProps[n] : t.varProps[n]; const oi = (t, n) => li(t)?.[n] || ui(t)?.[n] || null; const li = t => { if (!t) { return null; } return Qr in t ? "children" in t ? { ...t[Qr], children: t.children } : t[Qr] : t; }; const ui = t => { if (!t) { return null; } return Jr in t ? t[Jr] : null; }; const ci = t => t && Qr in t; const fi = t => (n, ...e) => t.call(null, Lf(n), ...e); class ai extends zr { constructor(t, n) { super(t, n, 17); } An=!1; p() { if (!(this.h & 1)) { return; } ru(this.en); const t = lf(this.en.resolved); const {deserialize: n, initial: e} = t; const s = t.update; const o = this.Zt === Lr ? e : this.Zt; const r = cf(() => this.An ? s?.(o) || o : n(o), this, ".", this.$); this.An = !0; this.h &= -2; const i = this.An && r !== "undefined" || r !== this.Zt; if (i) { this.Zt = r; fu(this.$, this, this.ct); } } } const hi = (t, n) => new zr(n?.container || null, t, hu(n?.serializationStrategy || "always")); const di = (t, n) => new Hr(n?.container || null, t, hu(n?.serializationStrategy || "always"), n); const pi = t => new ai(null, t); const $i = t => new Ur(null, t); const yi = /*#__PURE__*/ fi(hi); const mi = /*#__PURE__*/ fi(di); const wi = fi(pi); const bi = t => t.value; const vi = (t, n) => t[n]; const _i = t => { if (t.length === 1) { if (iu(t[0])) { return t[0].tn ||= new ki(null, bi, t, null); } if (vu(t[0])) { return new ki(null, bi, t, null); } return t[0].value; } return new ki(null, vi, t, null); }; const gi = (...t) => { const n = t[0]; const e = t.length < 2 ? "value" : t[1]; if (!ke(n)) { return n[e]; } if (iu(n)) { if (n instanceof ki && n.h & 4) { return n; } return _i(t); } if (ci(n)) { const s = n[Jr]; const o = n[Qr]; if (s && Object.prototype.hasOwnProperty.call(s, e)) { return s[e]; } if (Object.prototype.hasOwnProperty.call(o, e)) { const n = o[e]; return Ei(n, t); } } else { const s = yu(n); if (s) { const n = s[e]; return Ei(n, t); } } return n[e]; }; const Ei = (t, n) => iu(t) ? t : _i(n); const Si = (t, n) => { const e = gi(t, n); if (e === Kr) { return t[n]; } return e; }; class ki extends Ur { lt; ot; kt; h; m=void 0; [vr]=void 0; constructor(t, n, e, s, o = 5) { super(t, Lr); this.lt = e; this.ot = n; this.kt = s; this.h = o; } invalidate() { this.h |= 1; try { this.p(); } catch (t) { if (this.$ && this.m) { this.$.setHostProp(this.m, Or, this); hn(this.$, this.m, 32); } } if (this.h & 2) { this.h &= -3; fu(this.$, this, this.ct); } } get untrackedValue() { this.p(); return this.Zt; } p() { if (!(this.h & 1)) { return; } const t = cf(() => this.ot(...this.lt), this, ".", this.$); this.h &= -3; const n = t !== this.Zt; if (n) { this.h |= 2; this.Zt = t; } } rt() { return this.ot === bi && iu(this.lt[0]) ? this.lt[0] : this; } set value(t) { throw qe(31); } get value() { return super.value; } } class Ri { data; constructor(t) { this.data = t; } } Object.prototype.hasOwnProperty; class Pi { type; children; flags; toSort; key; varProps; constProps; dev; _proxy=null; constructor(t, n, e, s, o, r, i, c) { this.type = t; this.children = s; this.flags = o; this.toSort = !!i; this.key = r === null || r === void 0 ? null : typeof r === "string" ? r : "" + r; this.varProps = !n || hr(n) ? ni : n; this.constProps = !e || hr(e) ? null : e; } get props() { return this._proxy ||= w(this); } } const Ti = (t, n, e) => { let s = t[n]; if (!s) { t[n] = e; return !0; } Array.isArray(s) ? s.push(e) : s = t[n] = [ s, e ]; }; const qi = t => t instanceof Pi; const Mi = (t, n) => { if (typeof t === "string") { const e = se(n); kf(Rf(e, t)); } return null; }; function b(t, n) { Mi(this, n); const e = Sf[0]; e.value = n.type === "number" ? n.valueAsNumber : n.value; } function v(t, n) { Mi(this, n); const e = Sf[0]; e.value = n.checked; } function _(t, n) { Mi(this, n); if (Sf) { for (let t = 0; t < Sf.length; t++) { const n = Sf[t]; n instanceof Hr && n.h & 64 && n.p(); } } } const Ai = "bind:value"; const xi = "bind:checked"; const Ii = "passive:"; const Ni = "preventdefault:"; const Ci = Object.prototype.hasOwnProperty; const Oi = (t, n, e, s, o = !1) => { let r = t; let i = o; if (n.length > 0) { if (!i) { r = { ...r }; i = !0; } for (let t = 0; t < n.length; t++) { const e = n[t]; delete r[e]; } } if (e.length > 0) { for (let t = 0; t < e.length; t++) { const n = e[t]; if (s.has(Ns(n.slice(15)))) { if (!i) { r = { ...r }; i = !0; } delete r[n]; } } } return r; }; const ji = t => { if (t.startsWith("on") && t.endsWith("$")) { return Ns(t.slice(2, -1)); } if (t.startsWith("window:on") && t.endsWith("$")) { return Ns(t.slice(9, -1)); } if (t.startsWith("document:on") && t.endsWith("$")) { return Ns(t.slice(11, -1)); } return null; }; const Li = (t, n, s, o, r = !1) => { let i = t; let c = r; for (let t = 0; t < n.length; t++) { const r = n[t]; const l = ji(r); const u = e(r, o.has(l)); if (u) { if (!c) { i = { ...i }; c = !0; } const t = s.get(u); (t === void 0 || t < s.get(r)) && (i[u] = i[r]); delete i[r]; } } return i; }; const Fi = (t, n, e, s, o, r, i) => new Pi(t, n, e, s, o, r, !1, i); const Xi = (t, n, e, s, o, r, i) => { let c = !1; let l = !1; let u = !1; let f = null; let a = null; if (typeof t === "string") { const t = new Set; const s = []; const o = []; const r = []; const i = []; const h = []; const d = []; const p = new Map; const $ = new Map; if (e) { let n = 0; for (const o in e) { p.set(o, n++); if (o.startsWith(Ii)) { r.push(o); t.add(Ns(o.slice(8))); } else { o.startsWith(Ni) ? h.push(o) : ji(o) !== null ? s.push(o) : o === xi ? a = e[o] : o === Ai && (f = e[o]); } } } if (n) { let e = 0; for (const s in n) { $.set(s, e++); if (s.startsWith(Ii)) { i.push(s); t.add(Ns(s.slice(8))); } else { s.startsWith(Ni) ? d.push(s) : ji(s) !== null ? o.push(s) : s === xi ? a = n[s] : s === Ai && (f = n[s]); } } } if (e) { const n = e; e = Oi(e, r, h, t, l); l = l || e !== n; e = Li(e, s, p, t, l); l = l || e !== n; } if (n) { const e = n; n = Oi(n, i, d, t, u); u = u || n !== e; n = Li(n, o, $, t, u); u = u || n !== e; c = c || o.length > 0; } if (a || f) { if (!u) { n = { ...n }; u = !0; } n ||= {}; if (a) { n && Ci.call(n, xi) && delete n[xi]; if (e && Ci.call(e, xi)) { if (!l) { e = { ...e }; l = !0; } delete e[xi]; } n.checked = a; const t = Mf(null, "_chk", v, null, [ a ]); if (e && Ci.call(e, "q-e:input")) { if (!l) { e = { ...e }; l = !0; } const t = e["q-e:input"]; delete e["q-e:input"]; c = Ti(n, "q-e:input", t) || c; } c = Ti(n, "q-e:input", t) || c; } else if (f) { n && Ci.call(n, Ai) && delete n[Ai]; if (e && Ci.call(e, Ai)) { if (!l) { e = { ...e }; l = !0; } delete e[Ai]; } n.value = f; const t = Mf(null, "_val", b, null, [ f ]); if (e && Ci.call(e, "q-e:input")) { if (!l) { e = { ...e }; l = !0; } const t = e["q-e:input"]; delete e["q-e:input"]; c = Ti(n, "q-e:input", t) || c; } c = Ti(n, "q-e:input", t) || c; } } if (n && Ci.call(n, "className")) { if (!u) { n = { ...n }; u = !0; } n.class = n.className; n.className = void 0; c = !0; } if (e && Ci.call(e, "className")) { if (!l) { e = { ...e }; l = !0; } e.class = e.className; e.className = void 0; } } if (n) { for (const t in n) { if (t === "children") { if (!u) { n = { ...n }; u = !0; } s ||= n.children; delete n.children; } else if (t === "key") { if (!u) { n = { ...n }; u = !0; } r ||= n.key; delete n.key; } else if (e && t in e) { if (!u) { n = { ...n }; u = !0; } delete n[t]; } else if (n[t] === null) { if (!u) { n = { ...n }; u = !0; } delete n[t]; } } } return new Pi(t, n, e, s, o, r, c || !0, i); }; const Di = (t, n, e, s) => zi(t, n, s); const Wi = (t, n, e, s, o) => zi(t, { ...e, ...n }, o); const Vi = (t, n, e, s, o, r) => zi(t, { ...e, ...n, children: s }, r); const Ui = t => t.children; const zi = (t, n, e, s, o) => Xi(t, n, null, null, 0, e, o); const Bi = zi; const Hi = zi; function g(t, n, ...e) { const s = { children: arguments.length > 2 ? e.flat(100) : null }; let o = null; for (const t in n) { t == "key" ? o = n[t] : s[t] = n[t]; } return Xi(t, n, null, s.children, 0, o); } const Ji = t => t.children; const Qi = (t, n) => new Pi(Ui, null, null, t.children, 0, n); const Yi = t => Fi(Ui, null, { [We]: "" }, t.children, 0, t.name ?? ""); const Gi = Symbol(); const Ki = () => null; const Zi = () => null; const to = t => t.children; const no = (t, n) => zi(Qi, { children: zi(eo, t) }, n); const eo = () => null; let so = null; let ro = null; function E(t, n, e, s) { if (e != null) { if (s) { const s = function o(t) { switch (t) { case "xlink:href": case "xlink:actuate": case "xlink:arcrole": case "xlink:role": case "xlink