Quantumbraid's picture
download
raw
95.1 kB
import { jsx as G, jsxs as $t } from "react/jsx-runtime"; import E, { createElement as Dt } from "react"; import So from "react-dom"; const we = 0, Pt = 1, Xt = 2, Wn = 4; function fn(t) { return () => t; } function xo(t) { t(); } function re(t, e) { return (n) => t(e(n)); } function mn(t, e) { return () => t(e); } function vo(t, e) { return (n) => t(e, n); } function _e(t) { return t !== void 0; } function To(...t) { return () => { t.map(xo); }; } function Jt() { } function ye(t, e) { return e(t), t; } function Co(t, e) { return e(t); } function rt(...t) { return t; } function Y(t, e) { return t(Pt, e); } function _(t, e) { t(we, e); } function Ne(t) { t(Xt); } function it(t) { return t(Wn); } function k(t, e) { return Y(t, vo(e, we)); } function yt(t, e) { const n = t(Pt, (o) => { n(), e(o); }); return n; } function pn(t) { let e, n; return (o) => (r) => { e = r, n && clearTimeout(n), n = setTimeout(() => { o(e); }, t); }; } function Pn(t, e) { return t === e; } function nt(t = Pn) { let e; return (n) => (o) => { t(e, o) || (e = o, n(o)); }; } function P(t) { return (e) => (n) => { t(n) && e(n); }; } function B(t) { return (e) => re(e, t); } function Bt(t) { return (e) => () => { e(t); }; } function x(t, ...e) { const n = wo(...e); return ((o, r) => { switch (o) { case Xt: Ne(t); return; case Pt: return Y(t, n(r)); } }); } function Lt(t, e) { return (n) => (o) => { n(e = t(e, o)); }; } function Ut(t) { return (e) => (n) => { t > 0 ? t-- : e(n); }; } function zt(t) { let e = null, n; return (o) => (r) => { e = r, !n && (n = setTimeout(() => { n = void 0, o(e); }, t)); }; } function $(...t) { const e = new Array(t.length); let n = 0, o = null; const r = 2 ** t.length - 1; return t.forEach((s, i) => { const l = 2 ** i; Y(s, (c) => { const d = n; n |= l, e[i] = c, d !== r && n === r && o && (o(), o = null); }); }), (s) => (i) => { const l = () => { s([i].concat(e)); }; n === r ? l() : o = l; }; } function wo(...t) { return (e) => t.reduceRight(Co, e); } function yo(t) { let e, n; const o = () => e?.(); return function(r, s) { switch (r) { case Pt: return s ? n === s ? void 0 : (o(), n = s, e = Y(t, s), e) : (o(), Jt); case Xt: o(), n = null; return; } }; } function T(t) { let e = t; const n = U(); return ((o, r) => { switch (o) { case we: e = r; break; case Pt: { r(e); break; } case Wn: return e; } return n(o, r); }); } function ht(t, e) { return ye(T(e), (n) => k(t, n)); } function U() { const t = []; return ((e, n) => { switch (e) { case we: t.slice().forEach((o) => { o(n); }); return; case Xt: t.splice(0, t.length); return; case Pt: return t.push(n), () => { const o = t.indexOf(n); o > -1 && t.splice(o, 1); }; } }); } function Tt(t) { return ye(U(), (e) => k(t, e)); } function j(t, e = [], { singleton: n } = { singleton: !0 }) { return { constructor: t, dependencies: e, id: bo(), singleton: n }; } const bo = () => Symbol(); function Ro(t) { const e = /* @__PURE__ */ new Map(), n = ({ constructor: o, dependencies: r, id: s, singleton: i }) => { if (i && e.has(s)) return e.get(s); const l = o(r.map((c) => n(c))); return i && e.set(s, l), l; }; return n(t); } function at(...t) { const e = U(), n = new Array(t.length); let o = 0; const r = 2 ** t.length - 1; return t.forEach((s, i) => { const l = 2 ** i; Y(s, (c) => { n[i] = c, o |= l, o === r && _(e, n); }); }), function(s, i) { switch (s) { case Xt: { Ne(e); return; } case Pt: return o === r && i(n), Y(e, i); } }; } function W(t, e = Pn) { return x(t, nt(e)); } function Fe(...t) { return function(e, n) { switch (e) { case Xt: return; case Pt: return To(...t.map((o) => Y(o, n))); } }; } const ft = { /** Detailed debugging information including item measurements */ DEBUG: 0, /** General informational messages */ INFO: 1, /** Warning messages for potential issues */ WARN: 2, /** Error messages for failures (default level) */ ERROR: 3 }, Ho = { [ft.DEBUG]: "debug", [ft.ERROR]: "error", [ft.INFO]: "log", [ft.WARN]: "warn" }, Eo = () => typeof globalThis > "u" ? window : globalThis, Gt = j( () => { const t = T(ft.ERROR); return { log: T((n, o, r = ft.INFO) => { const s = Eo().VIRTUOSO_LOG_LEVEL ?? it(t); r >= s && console[Ho[r]]( "%creact-virtuoso: %c%s %o", "color: #0253b3; font-weight: bold", "color: initial", n, o ); }), logLevel: t }; }, [], { singleton: !0 } ), Ve = /* @__PURE__ */ new WeakMap(); function Gn(t) { return "self" in t ? t.document.documentElement : t; } function Bo(t) { const e = Gn(t), n = Ve.get(e); if (n !== void 0) return n; const o = e.ownerDocument.defaultView.getComputedStyle(e).direction === "rtl"; return Ve.set(e, o), o; } function hn(t) { Ve.delete(Gn(t)); } function An(t, e) { return Bo(t) ? -e : e; } const _t = An; function gn(t, e) { return An(t, e); } function Ot(t, e, n) { return De(t, e, n).callbackRef; } function De(t, e, n) { const o = E.useRef(null); let r = (i) => { }; const s = E.useMemo(() => typeof ResizeObserver < "u" ? new ResizeObserver((i) => { const l = () => { const c = i[0].target; c.offsetParent !== null && t(c); }; n ? l() : requestAnimationFrame(l); }) : null, [t, n]); return r = (i) => { i && e ? (s?.observe(i), o.current = i) : (o.current && s?.unobserve(o.current), o.current = null); }, { callbackRef: r, ref: o }; } function Mn(t, e, n, o, r, s, i, l, c) { const d = E.useCallback( (m) => { const v = Lo(m.children, e, l ? "offsetWidth" : "offsetHeight", r); let p = m.parentElement; for (; p.dataset.virtuosoScroller === void 0; ) p = p.parentElement; const I = p.lastElementChild.dataset.viewportType === "window"; let w; I && (w = p.ownerDocument.defaultView); const R = i ? l ? i.scrollWidth : i.scrollHeight : I ? l ? w.document.documentElement.scrollWidth : w.document.documentElement.scrollHeight : l ? p.scrollWidth : p.scrollHeight, h = i ? l ? i.offsetWidth : i.offsetHeight : I ? l ? w.innerWidth : w.innerHeight : l ? p.offsetWidth : p.offsetHeight, f = i ? l ? _t(i, i.scrollLeft) : i.scrollTop : I ? l ? _t(w, w.scrollX || w.document.documentElement.scrollLeft) : w.scrollY || w.document.documentElement.scrollTop : l ? _t(p, p.scrollLeft) : p.scrollTop; o({ scrollHeight: R, scrollTop: Math.max(f, 0), viewportHeight: h }), s?.( l ? In("column-gap", getComputedStyle(m).columnGap, r) : In("row-gap", getComputedStyle(m).rowGap, r) ), v !== null && t(v); }, [t, e, r, s, i, o, l] ); return De(d, n, c); } function Lo(t, e, n, o) { const r = t.length; if (r === 0) return null; const s = []; for (let i = 0; i < r; i++) { const l = t.item(i); if (l.dataset.index === void 0) continue; const c = parseInt(l.dataset.index), d = parseFloat(l.dataset.knownSize), m = e(l, n); if (m === 0 && o("Zero-sized element, this should not happen", { child: l }, ft.ERROR), m === d) continue; const v = s[s.length - 1]; s.length === 0 || v.size !== m || v.endIndex !== c - 1 ? s.push({ endIndex: c, size: m, startIndex: c }) : s[s.length - 1].endIndex++; } return s; } function In(t, e, n) { return e !== "normal" && e?.endsWith("px") !== !0 && n(`${t} was not resolved to pixel value correctly`, e, ft.WARN), e === "normal" ? 0 : parseInt(e ?? "0", 10); } function $e(t, e, n) { const o = E.useRef(null), r = E.useCallback( (c) => { if (!c?.offsetParent) return; const d = c.getBoundingClientRect(), m = d.width; let v, p; if (e) { const I = e.getBoundingClientRect(), w = d.top - I.top; p = I.height - Math.max(0, w), v = w + e.scrollTop; } else { const I = i.current.ownerDocument.defaultView; p = I.innerHeight - Math.max(0, d.top), v = d.top + I.scrollY; } o.current = { listHeight: d.height, offsetTop: v, visibleHeight: p, visibleWidth: m }, t(o.current); }, // oxlint-disable-next-line exhaustive-deps [t, e] ), { callbackRef: s, ref: i } = De(r, !0, n), l = E.useCallback(() => { r(i.current); }, [r, i]); return E.useEffect(() => { if (e) { e.addEventListener("scroll", l); const d = new ResizeObserver(() => { requestAnimationFrame(l); }); return d.observe(e), () => { e.removeEventListener("scroll", l), d.unobserve(e); }; } const c = i.current?.ownerDocument.defaultView; return c?.addEventListener("scroll", l), c?.addEventListener("resize", l), () => { c?.removeEventListener("scroll", l), c?.removeEventListener("resize", l); }; }, [l, e, i]), s; } const It = j( () => { const t = U(), e = U(), n = T(0), o = U(), r = T(0), s = U(), i = U(), l = T(0), c = T(0), d = T(0), m = T(0), v = U(), p = U(), I = T(!1), w = T(!1), R = T(!1); return k( x( t, B(({ scrollTop: h }) => h) ), e ), k( x( t, B(({ scrollHeight: h }) => h) ), i ), k(e, r), { deviation: n, fixedFooterHeight: d, fixedHeaderHeight: c, footerHeight: m, headerHeight: l, horizontalDirection: w, scrollBy: p, // input scrollContainerState: t, scrollHeight: i, scrollingInProgress: I, // signals scrollTo: v, scrollTop: e, skipAnimationFrameInResizeObserver: R, smoothScrollTargetReached: o, // state statefulScrollTop: r, viewportHeight: s }; }, [], { singleton: !0 } ), se = { lvl: 0 }; function _n(t, e) { const n = t.length; if (n === 0) return []; let { index: o, value: r } = e(t[0]); const s = []; for (let i = 1; i < n; i++) { const { index: l, value: c } = e(t[i]); s.push({ end: l - 1, start: o, value: r }), o = l, r = c; } return s.push({ end: 1 / 0, start: o, value: r }), s; } function J(t) { return t === se; } function ie(t, e) { if (!J(t)) return e === t.k ? t.v : e < t.k ? ie(t.l, e) : ie(t.r, e); } function Rt(t, e, n = "k") { if (J(t)) return [-1 / 0, void 0]; if (Number(t[n]) === e) return [t.k, t.v]; if (Number(t[n]) < e) { const o = Rt(t.r, e, n); return o[0] === -1 / 0 ? [t.k, t.v] : o; } return Rt(t.l, e, n); } function vt(t, e, n) { return J(t) ? $n(e, n, 1) : e === t.k ? dt(t, { k: e, v: n }) : e < t.k ? Sn(dt(t, { l: vt(t.l, e, n) })) : Sn(dt(t, { r: vt(t.r, e, n) })); } function Yt() { return se; } function Zt(t, e, n) { if (J(t)) return []; const o = Rt(t, e)[0]; return Oo(Pe(t, o, n)); } function We(t, e) { if (J(t)) return se; const { k: n, l: o, r } = t; if (e === n) { if (J(o)) return r; if (J(r)) return o; const [s, i] = Dn(o); return xe(dt(t, { k: s, l: Nn(o), v: i })); } return e < n ? xe(dt(t, { l: We(o, e) })) : xe(dt(t, { r: We(r, e) })); } function Nt(t) { return J(t) ? [] : [...Nt(t.l), { k: t.k, v: t.v }, ...Nt(t.r)]; } function Pe(t, e, n) { if (J(t)) return []; const { k: o, l: r, r: s, v: i } = t; let l = []; return o > e && (l = l.concat(Pe(r, e, n))), o >= e && o <= n && l.push({ k: o, v: i }), o <= n && (l = l.concat(Pe(s, e, n))), l; } function xe(t) { const { l: e, lvl: n, r: o } = t; if (o.lvl >= n - 1 && e.lvl >= n - 1) return t; if (n > o.lvl + 1) { if (Be(e)) return Un(dt(t, { lvl: n - 1 })); if (!J(e) && !J(e.r)) return dt(e.r, { l: dt(e, { r: e.r.l }), lvl: n, r: dt(t, { l: e.r.r, lvl: n - 1 }) }); throw new Error("Unexpected empty nodes"); } if (Be(t)) return Ge(dt(t, { lvl: n - 1 })); if (!J(o) && !J(o.l)) { const r = o.l, s = Be(r) ? o.lvl - 1 : o.lvl; return dt(r, { l: dt(t, { lvl: n - 1, r: r.l }), lvl: r.lvl + 1, r: Ge(dt(o, { l: r.r, lvl: s })) }); } throw new Error("Unexpected empty nodes"); } function dt(t, e) { return $n( e.k !== void 0 ? e.k : t.k, e.v !== void 0 ? e.v : t.v, e.lvl !== void 0 ? e.lvl : t.lvl, e.l !== void 0 ? e.l : t.l, e.r !== void 0 ? e.r : t.r ); } function Nn(t) { return J(t.r) ? t.l : xe(dt(t, { r: Nn(t.r) })); } function Be(t) { return J(t) || t.lvl > t.r.lvl; } function Dn(t) { return J(t.r) ? [t.k, t.v] : Dn(t.r); } function $n(t, e, n, o = se, r = se) { return { k: t, l: o, lvl: n, r, v: e }; } function Sn(t) { return Ge(Un(t)); } function Un(t) { const { l: e } = t; return !J(e) && e.lvl === t.lvl ? dt(e, { r: dt(t, { l: e.r }) }) : t; } function Ge(t) { const { lvl: e, r: n } = t; return !J(n) && !J(n.r) && n.lvl === e && n.r.lvl === e ? dt(n, { l: dt(t, { r: n.l }), lvl: e + 1 }) : t; } function Oo(t) { return _n(t, ({ k: e, v: n }) => ({ index: e, value: n })); } function Kn(t, e) { return !!(t && t.startIndex === e.startIndex && t.endIndex === e.endIndex); } function le(t, e) { return !!(t && t[0] === e[0] && t[1] === e[1]); } const Ue = j( () => ({ recalcInProgress: T(!1) }), [], { singleton: !0 } ); function jn(t, e, n) { return t[Te(t, e, n)]; } function Te(t, e, n, o = 0) { let r = t.length - 1; for (; o <= r; ) { const s = Math.floor((o + r) / 2), i = t[s], l = n(i, e); if (l === 0) return s; if (l === -1) { if (r - o < 2) return s - 1; r = s - 1; } else { if (r === o) return s; o = s + 1; } } throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${e}`); } function ko(t, e, n, o) { const r = Te(t, e, o), s = Te(t, n, o, r); return t.slice(r, s + 1); } function Ht(t, e) { return Math.round(t.getBoundingClientRect()[e]); } function be(t) { return !J(t.groupOffsetTree); } function Ke({ index: t }, e) { return e === t ? 0 : e < t ? -1 : 1; } function zo() { return { groupIndices: [], groupOffsetTree: Yt(), lastIndex: 0, lastOffset: 0, lastSize: 0, offsetTree: [], sizeTree: Yt() }; } function Fo(t, e) { let n = J(t) ? 0 : 1 / 0; for (const o of e) { const { endIndex: r, size: s, startIndex: i } = o; if (n = Math.min(n, i), J(t)) { t = vt(t, 0, s); continue; } const l = Zt(t, i - 1, r + 1); if (l.some(_o(o))) continue; let c = !1, d = !1; for (const { end: m, start: v, value: p } of l) c ? (r >= v || s === p) && (t = We(t, v)) : (d = p !== s, c = !0), m > r && r >= v && p !== s && (t = vt(t, r + 1, p)); d && (t = vt(t, i, s)); } return [t, n]; } function Vo(t) { return typeof t.groupIndex < "u"; } function Wo({ offset: t }, e) { return e === t ? 0 : e < t ? -1 : 1; } function ce(t, e, n) { if (e.length === 0) return 0; const { index: o, offset: r, size: s } = jn(e, t, Ke), i = t - o, l = s * i + (i - 1) * n + r; return l > 0 ? l + n : l; } function qn(t, e) { if (!be(e)) return t; let n = 0; for (; e.groupIndices[n] <= t + n; ) n++; return t + n; } function Yn(t, e, n) { if (Vo(t)) return e.groupIndices[t.groupIndex] + 1; const o = t.index === "LAST" ? n : t.index; let r = qn(o, e); return r = Math.max(0, r, Math.min(n, r)), r; } function Po(t, e, n, o = 0) { return o > 0 && (e = Math.max(e, jn(t, o, Ke).offset)), _n(ko(t, e, n, Wo), Mo); } function Go(t, [e, n, o, r]) { e.length > 0 && o("received item sizes", e, ft.DEBUG); const s = t.sizeTree; let i = s, l = 0; if (n.length > 0 && J(s) && e.length === 2) { const p = e[0].size, I = e[1].size; i = n.reduce((w, R) => vt(vt(w, R, p), R + 1, I), i); } else [i, l] = Fo(i, e); if (i === s) return t; const { lastIndex: c, lastOffset: d, lastSize: m, offsetTree: v } = Ae(t.offsetTree, l, i, r); return { groupIndices: n, groupOffsetTree: n.reduce((p, I) => vt(p, I, ce(I, v, r)), Yt()), lastIndex: c, lastOffset: d, lastSize: m, offsetTree: v, sizeTree: i }; } function Ao(t) { return Nt(t).map(({ k: e, v: n }, o, r) => { const s = r[o + 1]; return { endIndex: s !== void 0 ? s.k - 1 : 1 / 0, size: n, startIndex: e }; }); } function xn(t, e) { let n = 0, o = 0; for (; n < t; ) n += e[o + 1] - e[o] - 1, o++; return o - (n === t ? 0 : 1); } function Ae(t, e, n, o) { let r = t, s = 0, i = 0, l = 0, c = 0; if (e !== 0) { c = Te(r, e - 1, Ke), l = r[c].offset; const m = Rt(n, e - 1); s = m[0], i = m[1], r.length && r[c].size === Rt(n, e)[1] && (c -= 1), r = r.slice(0, c + 1); } else r = []; for (const { start: d, value: m } of Zt(n, e, 1 / 0)) { const v = d - s, p = v * i + l + v * o; r.push({ index: d, offset: p, size: m }), s = d, l = p, i = m; } return { lastIndex: s, lastOffset: l, lastSize: i, offsetTree: r }; } function Mo(t) { return { index: t.index, value: t }; } function _o(t) { const { endIndex: e, size: n, startIndex: o } = t; return (r) => r.start === o && (r.end === e || r.end === 1 / 0) && r.value === n; } const No = { offsetHeight: "height", offsetWidth: "width" }, kt = j( ([{ log: t }, { recalcInProgress: e }]) => { const n = U(), o = U(), r = ht(o, 0), s = U(), i = U(), l = T(0), c = T([]), d = T(void 0), m = T(void 0), v = T(void 0), p = T(void 0), I = T((u, g) => Ht(u, No[g])), w = T(void 0), R = T(0), h = zo(), f = ht( x(n, $(c, t, R), Lt(Go, h), nt()), h ), a = ht( x( c, nt(), Lt((u, g) => ({ current: g, prev: u.current }), { current: [], prev: [] }), B(({ prev: u }) => u) ), [] ); k( x( c, P((u) => u.length > 0), $(f, R), B(([u, g, C]) => { const z = u.reduce((L, V, N) => vt(L, V, ce(V, g.offsetTree, C) || N), Yt()); return { ...g, groupIndices: u, groupOffsetTree: z }; }) ), f ), k( x( o, $(f), P(([u, { lastIndex: g }]) => u < g), B(([u, { lastIndex: g, lastSize: C }]) => [ { endIndex: g, size: C, startIndex: u } ]) ), n ), k(d, m); const S = ht( x( d, B((u) => u === void 0) ), !0 ); k( x( m, P((u) => u !== void 0 && J(it(f).sizeTree)), B((u) => { const g = it(v), C = it(c).length > 0; return g !== void 0 && g !== 0 ? C ? [ { endIndex: 0, size: g, startIndex: 0 }, { endIndex: 1, size: u, startIndex: 1 } ] : [] : [{ endIndex: 0, size: u, startIndex: 0 }]; }) ), n ), k( x( p, P((u) => u !== void 0 && u.length > 0 && J(it(f).sizeTree)), B((u) => { const g = []; let C = u[0], z = 0; for (let L = 1; L < u.length; L++) { const V = u[L]; V !== C && (g.push({ endIndex: L - 1, size: C, startIndex: z }), C = V, z = L); } return g.push({ endIndex: u.length - 1, size: C, startIndex: z }), g; }) ), n ), k( x( c, $(v, m), P(([, u, g]) => u !== void 0 && g !== void 0), B(([u, g, C]) => { const z = []; for (let L = 0; L < u.length; L++) { const V = u[L], N = u[L + 1]; z.push({ startIndex: V, endIndex: V, size: g }), N !== void 0 && z.push({ startIndex: V + 1, endIndex: N - 1, size: C }); } return z; }) ), n ); const H = Tt( x( n, $(f), Lt( ({ sizes: u }, [g, C]) => ({ changed: C !== u, sizes: C }), { changed: !1, sizes: h } ), B((u) => u.changed) ) ); Y( x( l, Lt( (u, g) => ({ diff: u.prev - g, prev: g }), { diff: 0, prev: 0 } ), B((u) => u.diff) ), (u) => { const { groupIndices: g } = it(f); if (u > 0) _(e, !0), _(s, u + xn(u, g)); else if (u < 0) { const C = it(a); C.length > 0 && (u -= xn(-u, C)), _(i, u); } } ), Y(x(l, $(t)), ([u, g]) => { u < 0 && g( "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value", { firstItemIndex: l }, ft.ERROR ); }); const y = Tt(s); k( x( s, $(f), B(([u, g]) => { const C = g.groupIndices.length > 0, z = [], L = g.lastSize; if (C) { const V = ie(g.sizeTree, 0); let N = 0, Z = 0; for (; N < u; ) { const q = g.groupIndices[Z], Q = g.groupIndices.length === Z + 1 ? 1 / 0 : g.groupIndices[Z + 1] - q - 1; z.push({ endIndex: q, size: V, startIndex: q }), z.push({ endIndex: q + 1 + Q - 1, size: L, startIndex: q + 1 }), Z++, N += Q + 1; } const F = Nt(g.sizeTree); return N !== u && F.shift(), F.reduce( (q, { k: Q, v: gt }) => { let ut = q.ranges; return q.prevSize !== 0 && (ut = [ ...q.ranges, { endIndex: Q + u - 1, size: q.prevSize, startIndex: q.prevIndex } ]), { prevIndex: Q + u, prevSize: gt, ranges: ut }; }, { prevIndex: u, prevSize: 0, ranges: z } ).ranges; } return Nt(g.sizeTree).reduce( (V, { k: N, v: Z }) => ({ prevIndex: N + u, prevSize: Z, ranges: [...V.ranges, { endIndex: N + u - 1, size: V.prevSize, startIndex: V.prevIndex }] }), { prevIndex: 0, prevSize: L, ranges: [] } ).ranges; }) ), n ); const O = Tt( x( i, $(f, R), B(([u, { offsetTree: g }, C]) => { const z = -u; return ce(z, g, C); }) ) ); return k( x( i, $(f, R), B(([u, g, C]) => { if (g.groupIndices.length > 0) { if (J(g.sizeTree)) return g; let V = Yt(); const N = it(a); let Z = 0, F = 0, mt = 0; for (; Z < -u; ) { mt = N[F]; const Q = N[F + 1] - mt - 1; F++, Z += Q + 1; } if (V = Nt(g.sizeTree).reduce((Q, { k: gt, v: ut }) => vt(Q, Math.max(0, gt + u), ut), V), Z !== -u) { const Q = ie(g.sizeTree, mt); V = vt(V, 0, Q); const gt = Rt(g.sizeTree, -u + 1)[1]; V = vt(V, 1, gt); } return { ...g, sizeTree: V, ...Ae(g.offsetTree, 0, V, C) }; } const L = Nt(g.sizeTree).reduce((V, { k: N, v: Z }) => vt(V, Math.max(0, N + u), Z), Yt()); return { ...g, sizeTree: L, ...Ae(g.offsetTree, 0, L, C) }; }) ), f ), { beforeUnshiftWith: y, // input data: w, defaultItemSize: m, firstItemIndex: l, fixedItemSize: d, fixedGroupSize: v, gap: R, groupIndices: c, heightEstimates: p, itemSize: I, listRefresh: H, shiftWith: i, shiftWithOffset: O, sizeRanges: n, // output sizes: f, statefulTotalCount: r, totalCount: o, trackItemSizes: S, unshiftWith: s }; }, rt(Gt, Ue), { singleton: !0 } ); function Do(t) { return t.reduce( (e, n) => (e.groupIndices.push(e.totalCount), e.totalCount += n + 1, e), { groupIndices: [], totalCount: 0 } ); } const Zn = j( ([{ groupIndices: t, sizes: e, totalCount: n }, { headerHeight: o, scrollTop: r }]) => { const s = U(), i = U(), l = Tt(x(s, B(Do))); return k( x( l, B((c) => c.totalCount) ), n ), k( x( l, B((c) => c.groupIndices) ), t ), k( x( at(r, e, o), P(([c, d]) => be(d)), B(([c, d, m]) => Rt(d.groupOffsetTree, Math.max(c - m, 0), "v")[0]), nt(), B((c) => [c]) ), i ), { groupCounts: s, topItemsIndexes: i }; }, rt(kt, It) ), At = j( ([{ log: t }]) => { const e = T(!1), n = Tt( x( e, P((o) => o), nt() ) ); return Y(e, (o) => { o && it(t)("props updated", {}, ft.DEBUG); }), { didMount: n, propsReady: e }; }, rt(Gt), { singleton: !0 } ), $o = typeof document < "u" && "scrollBehavior" in document.documentElement.style; function Xn(t) { const e = typeof t == "number" ? { index: t } : t; return e.align || (e.align = "start"), (!e.behavior || !$o) && (e.behavior = "auto"), e.offset === void 0 && (e.offset = 0), e; } const fe = j( ([ { gap: t, listRefresh: e, sizes: n, totalCount: o }, { fixedFooterHeight: r, fixedHeaderHeight: s, footerHeight: i, headerHeight: l, scrollingInProgress: c, scrollTo: d, smoothScrollTargetReached: m, viewportHeight: v }, { log: p } ]) => { const I = U(), w = U(), R = T(0); let h = null, f = null, a = null; function S() { h !== null && (h(), h = null), a !== null && (a(), a = null), f && (clearTimeout(f), f = null), _(c, !1); } return k( x( I, $(n, v, o, R, l, i, p), $(t, s, r), B( ([ [H, y, O, u, g, C, z, L], V, N, Z ]) => { const F = Xn(H), { align: mt, behavior: q, offset: Q } = F, gt = u - 1, ut = Yn(F, y, gt); let St = ce(ut, y.offsetTree, V) + C; mt === "end" ? (St += N + Rt(y.sizeTree, ut)[1] - O + Z, ut === gt && (St += z)) : mt === "center" ? St += (N + Rt(y.sizeTree, ut)[1] - O + Z) / 2 : St -= g, Q !== void 0 && Q !== 0 && (St += Q); const Ft = (pt) => { S(), pt ? (L("retrying to scroll to", { location: H }, ft.DEBUG), _(I, H)) : (_(w, !0), L("list did not change, scroll successful", {}, ft.DEBUG)); }; if (S(), q === "smooth") { let pt = !1; a = Y(e, (jt) => { pt = pt || jt; }), h = yt(m, () => { Ft(pt); }); } else h = yt(x(e, Uo(150)), Ft); return f = setTimeout(() => { S(); }, 1200), _(c, !0), L("scrolling from index to", { behavior: q, index: ut, top: St }, ft.DEBUG), { behavior: q, top: St }; } ) ), d ), { scrollTargetReached: w, scrollToIndex: I, topListHeight: R }; }, rt(kt, It, Gt), { singleton: !0 } ); function Uo(t) { return (e) => { const n = setTimeout(() => { e(!1); }, t); return (o) => { o && (e(!0), clearTimeout(n)); }; }; } function je(t, e) { t === 0 ? e() : requestAnimationFrame(() => { je(t - 1, e); }); } function qe(t, e) { const n = e - 1; return typeof t == "number" ? t : t.index === "LAST" ? n : t.index; } const me = j( ([{ defaultItemSize: t, listRefresh: e, sizes: n }, { scrollTop: o }, { scrollTargetReached: r, scrollToIndex: s }, { didMount: i }]) => { const l = T(!0), c = T(0), d = T(!0); return k( x( i, $(c), P(([m, v]) => v !== 0), Bt(!1) ), l ), k( x( i, $(c), P(([m, v]) => v !== 0), Bt(!1) ), d ), Y( x( at(e, i), $(l, n, t, d), P(([[, m], v, { sizeTree: p }, I, w]) => m && (!J(p) || _e(I)) && !v && !w), $(c) ), ([, m]) => { yt(r, () => { _(d, !0); }), je(4, () => { yt(o, () => { _(l, !0); }), _(s, m); }); } ), { initialItemFinalLocationReached: d, initialTopMostItemIndex: c, scrolledToInitialItem: l }; }, rt(kt, It, fe, At), { singleton: !0 } ); function Jn(t, e) { return Math.abs(t - e) < 1.01; } const ue = "up", ne = "down", Ko = "none", jo = { atBottom: !1, notAtBottomBecause: "NOT_SHOWING_LAST_ITEM", state: { offsetBottom: 0, scrollHeight: 0, scrollTop: 0, viewportHeight: 0 } }, qo = 0, pe = j(([{ footerHeight: t, headerHeight: e, scrollBy: n, scrollContainerState: o, scrollTop: r, viewportHeight: s }]) => { const i = T(!1), l = T(!0), c = U(), d = U(), m = T(4), v = T(qo), p = ht( x( Fe(x(W(r), Ut(1), Bt(!0)), x(W(r), Ut(1), Bt(!1), pn(100))), nt() ), !1 ), I = ht( x(Fe(x(n, Bt(!0)), x(n, Bt(!1), pn(200))), nt()), !1 ); k( x( at(W(r), W(v)), B(([a, S]) => a <= S), nt() ), l ), k(x(l, zt(50)), d); const w = Tt( x( at(o, W(s), W(e), W(t), W(m)), Lt((a, [{ scrollHeight: S, scrollTop: H }, y, O, u, g]) => { const C = H + y - S > -g, z = { scrollHeight: S, scrollTop: H, viewportHeight: y }; if (C) { let V, N; return H > a.state.scrollTop ? (V = "SCROLLED_DOWN", N = a.state.scrollTop - H) : (V = "SIZE_DECREASED", N = a.state.scrollTop - H || a.scrollTopDelta), { atBottom: !0, atBottomBecause: V, scrollTopDelta: N, state: z }; } let L; return z.scrollHeight > a.state.scrollHeight ? L = "SIZE_INCREASED" : y < a.state.viewportHeight ? L = "VIEWPORT_HEIGHT_DECREASING" : H < a.state.scrollTop ? L = "SCROLLING_UPWARDS" : L = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", { atBottom: !1, notAtBottomBecause: L, state: z }; }, jo), nt((a, S) => a !== void 0 && a.atBottom === S.atBottom) ) ), R = ht( x( o, Lt( (a, { scrollHeight: S, scrollTop: H, viewportHeight: y }) => { if (!Jn(a.scrollHeight, S)) { const O = S - (H + y) < 1; return a.scrollTop !== H && O ? { changed: !0, jump: a.scrollTop - H, scrollHeight: S, scrollTop: H } : { changed: !0, jump: 0, scrollHeight: S, scrollTop: H }; } return { changed: !1, jump: 0, scrollHeight: S, scrollTop: H }; }, { changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 } ), P((a) => a.changed), B((a) => a.jump) ), 0 ); k( x( w, B((a) => a.atBottom) ), i ), k(x(i, zt(50)), c); const h = T(ne); k( x( o, B(({ scrollTop: a }) => a), nt(), Lt( (a, S) => it(I) ? { direction: a.direction, prevScrollTop: S } : { direction: S < a.prevScrollTop ? ue : ne, prevScrollTop: S }, { direction: ne, prevScrollTop: 0 } ), B((a) => a.direction) ), h ), k(x(o, zt(50), Bt(Ko)), h); const f = T(0); return k( x( p, P((a) => !a), Bt(0) ), f ), k( x( r, zt(100), $(p), P(([a, S]) => S), Lt(([a, S], [H]) => [S, H], [0, 0]), B(([a, S]) => S - a) ), f ), { atBottomState: w, atBottomStateChange: c, atBottomThreshold: m, atTopStateChange: d, atTopThreshold: v, isAtBottom: i, isAtTop: l, isScrolling: p, lastJumpDueToItemResize: R, scrollDirection: h, scrollVelocity: f }; }, rt(It)), ae = "top", de = "bottom", vn = "none"; function Tn(t, e, n) { return typeof t == "number" ? n === ue && e === ae || n === ne && e === de ? t : 0 : n === ue ? e === ae ? t.main : t.reverse : e === de ? t.main : t.reverse; } function Cn(t, e) { return typeof t == "number" ? t : t[e] ?? 0; } const Ye = j( ([{ deviation: t, fixedHeaderHeight: e, headerHeight: n, scrollTop: o, viewportHeight: r }]) => { const s = U(), i = T(0), l = T(0), c = T(0), d = ht( x( at( W(o), W(r), W(n), W(s, le), W(c), W(i), W(e), W(t), W(l) ), B( ([ m, v, p, [I, w], R, h, f, a, S ]) => { const H = m - a, y = h + f, O = Math.max(p - H, 0); let u = vn; const g = Cn(S, ae), C = Cn(S, de); return I -= a, I += p + f, w += p + f, w -= a, I > m + y - g && (u = ue), w < m - O + v + C && (u = ne), u !== vn ? [ Math.max(H - p - Tn(R, ae, u) - g, 0), H - O - f + v + Tn(R, de, u) + C ] : null; } ), P((m) => m !== null), nt(le) ), [0, 0] ); return { increaseViewportBy: l, // input listBoundary: s, overscan: c, topListHeight: i, // output visibleRange: d }; }, rt(It), { singleton: !0 } ); function Yo(t, e, n) { if (be(e)) { const o = qn(t, e); return [ { index: Rt(e.groupOffsetTree, o)[0], offset: 0, size: 0 }, { data: n?.[0], index: o, offset: 0, size: 0 } ]; } return [{ data: n?.[0], index: t, offset: 0, size: 0 }]; } const Le = { bottom: 0, firstItemIndex: 0, items: [], offsetBottom: 0, offsetTop: 0, top: 0, topItems: [], topListHeight: 0, totalCount: 0 }; function ve(t, e, n, o, r, s) { const { lastIndex: i, lastOffset: l, lastSize: c } = r; let d = 0, m = 0; if (t.length > 0) { d = t[0].offset; const R = t[t.length - 1]; m = R.offset + R.size; } const v = n - i, p = l + v * c + (v - 1) * o, I = d, w = p - m; return { bottom: m, firstItemIndex: s, items: wn(t, r, s), offsetBottom: w, offsetTop: d, top: I, topItems: wn(e, r, s), topListHeight: e.reduce((R, h) => h.size + R, 0), totalCount: n }; } function Qn(t, e, n, o, r, s) { let i = 0; if (n.groupIndices.length > 0) for (const m of n.groupIndices) { if (m - i >= t) break; i++; } const l = t + i, c = qe(e, l), d = Array.from({ length: l }).map((m, v) => ({ data: s[v + c], index: v + c, offset: 0, size: 0 })); return ve(d, [], l, r, n, o); } function wn(t, e, n) { if (t.length === 0) return []; if (!be(e)) return t.map((d) => ({ ...d, index: d.index + n, originalIndex: d.index })); const o = t[0].index, r = t[t.length - 1].index, s = [], i = Zt(e.groupOffsetTree, o, r); let l, c = 0; for (const d of t) { (!l || l.end < d.index) && (l = i.shift(), c = e.groupIndices.indexOf(l.start)); let m; d.index === l.start ? m = { index: c, type: "group" } : m = { groupIndex: c, index: d.index - (c + 1) + n }, s.push({ ...m, data: d.data, offset: d.offset, originalIndex: d.index, size: d.size }); } return s; } function yn(t, e) { return t === void 0 ? 0 : typeof t == "number" ? t : t[e] ?? 0; } const Kt = j( ([ { data: t, firstItemIndex: e, gap: n, sizes: o, totalCount: r }, s, { listBoundary: i, topListHeight: l, visibleRange: c }, { initialTopMostItemIndex: d, scrolledToInitialItem: m }, { topListHeight: v }, p, { didMount: I }, { recalcInProgress: w } ]) => { const R = T([]), h = T(0), f = U(), a = T(0); k(s.topItemsIndexes, R); const S = ht( x( at( I, w, W(c, le), W(r), W(o), W(d), m, W(R), W(e), W(n), W(a), t ), P(([u, g, , C, , , , , , , , z]) => { const L = z !== void 0 && z.length !== C; return u && !g && !L; }), B( ([ , , [u, g], C, z, L, V, N, Z, F, mt, q ]) => { const Q = z, { offsetTree: gt, sizeTree: ut } = Q, St = it(h); if (C === 0) return { ...Le, totalCount: C }; if (u === 0 && g === 0) return St === 0 ? { ...Le, totalCount: C } : Qn(St, L, z, Z, F, q || []); if (J(ut)) return St > 0 ? null : ve( Yo(qe(L, C), Q, q), [], C, F, Q, Z ); const Ft = []; if (N.length > 0) { const D = N[0], K = N[N.length - 1]; let st = 0; for (const tt of Zt(ut, D, K)) { const X = tt.value, lt = Math.max(tt.start, D), xt = Math.min(tt.end, K); for (let ct = lt; ct <= xt; ct++) Ft.push({ data: q?.[ct], index: ct, offset: st, size: X }), st += X; } } if (!V) return ve([], Ft, C, F, Q, Z); const pt = N.length > 0 ? N[N.length - 1] + 1 : 0, jt = Po(gt, u, g, pt); if (jt.length === 0) return null; const Qt = C - 1, Et = ye([], (D) => { for (const K of jt) { const st = K.value; let tt = st.offset, X = K.start; const lt = st.size; if (st.offset < u) { X += Math.floor((u - st.offset + F) / (lt + F)); const ct = X - K.start; tt += ct * lt + ct * F; } X < pt && (tt += (pt - X) * lt, X = pt); const xt = Math.min(K.end, Qt); for (let ct = X; ct <= xt && !(tt >= g); ct++) D.push({ data: q?.[ct], index: ct, offset: tt, size: lt }), tt += lt + F; } }), te = yn(mt, ae), b = yn(mt, de); if (Et.length > 0 && (te > 0 || b > 0)) { const D = Et[0], K = Et[Et.length - 1]; if (te > 0 && D.index > pt) { const st = Math.min(te, D.index - pt), tt = []; let X = D.offset; for (let lt = D.index - 1; lt >= D.index - st; lt--) { const ct = Zt(ut, lt, lt)[0]?.value ?? D.size; X -= ct + F, tt.unshift({ data: q?.[lt], index: lt, offset: X, size: ct }); } Et.unshift(...tt); } if (b > 0 && K.index < Qt) { const st = Math.min(b, Qt - K.index); let tt = K.offset + K.size + F; for (let X = K.index + 1; X <= K.index + st; X++) { const xt = Zt(ut, X, X)[0]?.value ?? K.size; Et.push({ data: q?.[X], index: X, offset: tt, size: xt }), tt += xt + F; } } } return ve(Et, Ft, C, F, Q, Z); } ), //@ts-expect-error filter needs to be fixed P((u) => u !== null), nt() ), Le ); k( x( t, P(_e), B((u) => u?.length) ), r ), k( x( S, B((u) => u.topListHeight) ), v ), k(v, l), k( x( S, B((u) => [u.top, u.bottom]) ), i ), k( x( S, B((u) => u.items) ), f ); const H = Tt( x( S, P(({ items: u }) => u.length > 0), $(r, t), P(([{ items: u }, g]) => u[u.length - 1].originalIndex === g - 1), B(([, u, g]) => [u - 1, g]), nt(le), B(([u]) => u) ) ), y = Tt( x( S, zt(200), P(({ items: u, topItems: g }) => u.length > 0 && u[0].originalIndex === g.length), B(({ items: u }) => u[0].index), nt() ) ), O = Tt( x( S, P(({ items: u }) => u.length > 0), B(({ items: u }) => { let g = 0, C = u.length - 1; for (; u[g].type === "group" && g < C; ) g++; for (; u[C].type === "group" && C > g; ) C--; return { endIndex: u[C].index, startIndex: u[g].index }; }), nt(Kn) ) ); return { endReached: H, initialItemCount: h, itemsRendered: f, listState: S, minOverscanItemCount: a, rangeChanged: O, startReached: y, topItemsIndexes: R, ...p }; }, rt( kt, Zn, Ye, me, fe, pe, At, Ue ), { singleton: !0 } ), to = j( ([{ fixedFooterHeight: t, fixedHeaderHeight: e, footerHeight: n, headerHeight: o }, { listState: r }]) => { const s = U(), i = ht( x( at(n, t, o, e, r), B(([l, c, d, m, v]) => l + c + d + m + v.offsetBottom + v.bottom) ), 0 ); return k(W(i), s), { totalListHeight: i, totalListHeightChanged: s }; }, rt(It, Kt), { singleton: !0 } ), Zo = j( ([{ viewportHeight: t }, { totalListHeight: e }]) => { const n = T(!1), o = ht( x( at(n, t, e), P(([r]) => r), B(([, r, s]) => Math.max(0, r - s)), zt(0), nt() ), 0 ); return { alignToBottom: n, paddingTopAddition: o }; }, rt(It, to), { singleton: !0 } ), eo = j(() => ({ context: T(null) })), Xo = ({ itemBottom: t, itemTop: e, locationParams: { align: n, behavior: o, ...r }, viewportBottom: s, viewportTop: i }) => e < i ? { ...r, align: n ?? "start", ...o !== void 0 ? { behavior: o } : {} } : t > s ? { ...r, align: n ?? "end", ...o !== void 0 ? { behavior: o } : {} } : null, no = j( ([ { gap: t, sizes: e, totalCount: n }, { fixedFooterHeight: o, fixedHeaderHeight: r, headerHeight: s, scrollingInProgress: i, scrollTop: l, viewportHeight: c }, { scrollToIndex: d } ]) => { const m = U(); return k( x( m, $(e, c, n, s, r, o, l), $(t), B(([[v, p, I, w, R, h, f, a], S]) => { const { calculateViewLocation: H = Xo, done: y, ...O } = v, u = Yn(v, p, w - 1), g = ce(u, p.offsetTree, S) + R + h, C = g + Rt(p.sizeTree, u)[1], z = a + h, L = a + I - f, V = H({ itemBottom: C, itemTop: g, locationParams: O, viewportBottom: L, viewportTop: z }); return V !== null ? y && yt( x( i, P((N) => !N), // skips the initial publish of false, and the cleanup call. // but if scrollingInProgress is true, we skip the initial publish. Ut(it(i) ? 1 : 2) ), y ) : y?.(), V; }), P((v) => v !== null) ), d ), { scrollIntoView: m }; }, rt(kt, It, fe, Kt, Gt), { singleton: !0 } ); function bn(t) { return t === !1 ? !1 : t === "smooth" ? "smooth" : "auto"; } const Jo = (t, e) => typeof t == "function" ? bn(t(e)) : e && bn(t), Qo = j( ([ { listRefresh: t, totalCount: e, fixedItemSize: n, data: o }, { atBottomState: r, isAtBottom: s }, { scrollToIndex: i }, { scrolledToInitialItem: l }, { didMount: c, propsReady: d }, { log: m }, { scrollingInProgress: v }, { context: p }, { scrollIntoView: I } ]) => { const w = T(!1), R = U(); let h = null; function f(y) { _(i, { align: "end", behavior: y, index: "LAST" }); } Y( x( at(x(W(e), Ut(1)), c), $(W(w), s, l, v), B(([[y, O], u, g, C, z]) => { let L = O && C, V = "auto"; return L && (V = Jo(u, g || z), L = L && V !== !1), { followOutputBehavior: V, shouldFollow: L, totalCount: y }; }), P(({ shouldFollow: y }) => y) ), ({ followOutputBehavior: y, totalCount: O }) => { h !== null && (h(), h = null), it(n) !== void 0 ? requestAnimationFrame(() => { it(m)("following output to ", { totalCount: O }, ft.DEBUG), f(y); }) : h = yt(t, () => { it(m)("following output to ", { totalCount: O }, ft.DEBUG), f(y), h = null; }); } ); function a(y) { const O = yt(r, (u) => { y && !u.atBottom && u.notAtBottomBecause === "SIZE_INCREASED" && h === null && (it(m)("scrolling to bottom due to increased size", {}, ft.DEBUG), f("auto")); }); setTimeout(O, 100); } Y( x( at(W(w), e, d), P(([y, , O]) => y !== !1 && O), Lt( ({ value: y }, [, O]) => ({ refreshed: y === O, value: O }), { refreshed: !1, value: 0 } ), P(({ refreshed: y }) => y), $(w, e) ), ([, y]) => { it(l) && a(y !== !1); } ), Y(R, () => { a(it(w) !== !1); }), Y(at(W(w), r), ([y, O]) => { y !== !1 && !O.atBottom && O.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && f("auto"); }); const S = T(null), H = U(); return k( Fe( x( W(o), B((y) => y?.length ?? 0) ), x(W(e)) ), H ), Y( x( at(x(H, Ut(1)), c), $(W(S), l, v, p), B(([[y, O], u, g, C, z]) => O && g && u?.({ context: z, totalCount: y, scrollingInProgress: C })), P((y) => !!y), zt(0) ), (y) => { h !== null && (h(), h = null), it(n) !== void 0 ? requestAnimationFrame(() => { it(m)("scrolling into view", {}), _(I, y); }) : h = yt(t, () => { it(m)("scrolling into view", {}), _(I, y), h = null; }); } ), { autoscrollToBottom: R, followOutput: w, scrollIntoViewOnChange: S }; }, rt( kt, pe, fe, me, At, Gt, It, eo, no ) ), tr = j( ([{ data: t, firstItemIndex: e, gap: n, sizes: o }, { initialTopMostItemIndex: r }, { initialItemCount: s, listState: i }, { didMount: l }]) => (k( x( l, $(s), P(([, c]) => c !== 0), $(r, o, e, n, t), B(([[, c], d, m, v, p, I = []]) => Qn(c, d, m, v, p, I)) ), i ), {}), rt(kt, me, Kt, At), { singleton: !0 } ), er = j( ([{ didMount: t }, { scrollTo: e }, { listState: n }]) => { const o = T(0); return Y( x( t, $(o), P(([, r]) => r !== 0), B(([, r]) => ({ top: r })) ), (r) => { yt( x( n, Ut(1), P((s) => s.items.length > 1) ), () => { requestAnimationFrame(() => { _(e, r); }); } ); } ), { initialScrollTop: o }; }, rt(At, It, Kt), { singleton: !0 } ), oo = j( ([{ scrollVelocity: t }]) => { const e = T(!1), n = U(), o = T(!1); return k( x( t, $(o, e, n), P(([r, s]) => s !== !1 && s !== void 0), B(([r, s, i, l]) => { const { enter: c, exit: d } = s; if (i) { if (d(r, l)) return !1; } else if (c(r, l)) return !0; return i; }), nt() ), e ), Y( x(at(e, t, n), $(o)), ([[r, s, i], l]) => { r && l !== !1 && l !== void 0 && l.change && l.change(s, i); } ), { isSeeking: e, scrollSeekConfiguration: o, scrollSeekRangeChanged: n, scrollVelocity: t }; }, rt(pe), { singleton: !0 } ), Ze = j(([{ scrollContainerState: t, scrollTo: e }]) => { const n = U(), o = U(), r = U(), s = T(!1), i = T(void 0); return k( x( at(n, o), B(([{ scrollTop: l, viewportHeight: c }, { offsetTop: d, listHeight: m }]) => ({ scrollHeight: m, scrollTop: Math.max(0, l - d), viewportHeight: c })) ), t ), k( x( e, $(o), B(([l, { offsetTop: c }]) => ({ ...l, top: l.top + c })) ), r ), { customScrollParent: i, // config useWindowScroll: s, // input windowScrollContainerState: n, // signals windowScrollTo: r, windowViewportRect: o }; }, rt(It)), nr = j( ([ { sizeRanges: t, sizes: e }, { headerHeight: n, scrollTop: o }, { initialTopMostItemIndex: r }, { didMount: s }, { useWindowScroll: i, windowScrollContainerState: l, windowViewportRect: c } ]) => { const d = U(), m = T(void 0), v = T(null), p = T(null); return k(l, v), k(c, p), Y( x( d, $(e, o, i, v, p, n) ), ([I, w, R, h, f, a, S]) => { const H = Ao(w.sizeTree); h && f !== null && a !== null && (R = f.scrollTop - a.offsetTop), R -= S, I({ ranges: H, scrollTop: R }); } ), k(x(m, P(_e), B(or)), r), k( x( s, $(m), P(([, I]) => I !== void 0), nt(), B(([, I]) => I.ranges) ), t ), { getState: d, restoreStateFrom: m }; }, rt(kt, It, me, At, Ze) ); function or(t) { return { align: "start", index: 0, offset: t.scrollTop }; } const rr = j(([{ topItemsIndexes: t }]) => { const e = T(0); return k( x( e, P((n) => n >= 0), B((n) => Array.from({ length: n }).map((o, r) => r)) ), t ), { topItemCount: e }; }, rt(Kt)); function ro(t) { let e = !1, n; return (() => (e || (e = !0, n = t()), n)); } const sr = ro(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), ir = j( ([ { deviation: t, scrollBy: e, scrollingInProgress: n, scrollTop: o }, { isAtBottom: r, isScrolling: s, lastJumpDueToItemResize: i, scrollDirection: l }, { listState: c }, { beforeUnshiftWith: d, gap: m, shiftWithOffset: v, sizes: p }, { log: I }, { recalcInProgress: w } ]) => { const R = Tt( x( c, $(i), Lt( ([, f, a, S], [{ bottom: H, items: y, offsetBottom: O, totalCount: u }, g]) => { const C = H + O; let z = 0; return a === u && f.length > 0 && y.length > 0 && (y[0].originalIndex === 0 && f[0].originalIndex === 0 || (z = C - S, z !== 0 && (z += g))), [z, y, u, C]; }, [0, [], 0, 0] ), P(([f]) => f !== 0), $(o, l, n, r, I, w), P(([, f, a, S, , , H]) => !H && !S && f !== 0 && a === ue), B(([[f], , , , , a]) => (a("Upward scrolling compensation", { amount: f }, ft.DEBUG), f)) ) ); function h(f) { f > 0 ? (_(e, { behavior: "auto", top: -f }), _(t, 0)) : (_(t, 0), _(e, { behavior: "auto", top: -f })); } return Y(x(R, $(t, s)), ([f, a, S]) => { S && sr() ? _(t, a - f) : h(-f); }), Y( x( at(ht(s, !1), t, w), P(([f, a, S]) => !f && !S && a !== 0), B(([f, a]) => a), zt(1) ), h ), k( x( v, B((f) => ({ top: -f })) ), e ), Y( x( d, $(p, m), B(([f, { groupIndices: a, lastSize: S, sizeTree: H }, y]) => { function O(L) { return L * (S + y); } if (a.length === 0) return O(f); let u = 0; const g = ie(H, 0); let C = 0, z = 0; for (; C < f; ) { C++, u += g; let L = a.length === z + 1 ? 1 / 0 : a[z + 1] - a[z] - 1; C + L > f && (u -= g, L = f - C + 1), C += L, u += O(L), z++; } return u; }) ), (f) => { _(t, f), requestAnimationFrame(() => { _(e, { top: f }), requestAnimationFrame(() => { _(t, 0), _(w, !1); }); }); } ), { deviation: t }; }, rt(It, pe, Kt, kt, Gt, Ue) ), lr = j( ([ t, e, n, o, r, s, i, l, c, d, m ]) => ({ ...t, ...e, ...n, ...o, ...r, ...s, ...i, ...l, ...c, ...d, ...m }), rt( Ye, tr, At, oo, to, er, Zo, Ze, no, Gt, eo ) ), so = j( ([ { data: t, defaultItemSize: e, firstItemIndex: n, fixedItemSize: o, fixedGroupSize: r, gap: s, groupIndices: i, heightEstimates: l, itemSize: c, sizeRanges: d, sizes: m, statefulTotalCount: v, totalCount: p, trackItemSizes: I }, { initialItemFinalLocationReached: w, initialTopMostItemIndex: R, scrolledToInitialItem: h }, f, a, S, H, { scrollToIndex: y }, O, { topItemCount: u }, { groupCounts: g }, C ]) => { const { listState: z, minOverscanItemCount: L, topItemsIndexes: V, rangeChanged: N, ...Z } = H; return k(N, C.scrollSeekRangeChanged), k( x( C.windowViewportRect, B((F) => F.visibleHeight) ), f.viewportHeight ), { data: t, defaultItemHeight: e, firstItemIndex: n, fixedItemHeight: o, fixedGroupHeight: r, gap: s, groupCounts: g, heightEstimates: l, initialItemFinalLocationReached: w, initialTopMostItemIndex: R, scrolledToInitialItem: h, sizeRanges: d, topItemCount: u, topItemsIndexes: V, // input totalCount: p, ...S, groupIndices: i, itemSize: c, listState: z, minOverscanItemCount: L, scrollToIndex: y, // output statefulTotalCount: v, trackItemSizes: I, // exported from stateFlagsSystem rangeChanged: N, ...Z, // the bag of IO from featureGroup1System ...C, ...f, sizes: m, ...a }; }, rt( kt, me, It, nr, Qo, Kt, fe, ir, rr, Zn, lr ) ); function cr(t, e) { const n = {}, o = {}; let r = 0; const s = t.length; for (; r < s; ) o[t[r]] = 1, r += 1; for (const i in e) Object.hasOwn(o, i) || (n[i] = e[i]); return n; } const Ie = typeof document < "u" ? E.useLayoutEffect : E.useEffect; function Xe(t, e, n) { const o = Object.keys(e.required || {}), r = Object.keys(e.optional || {}), s = Object.keys(e.methods || {}), i = Object.keys(e.events || {}), l = E.createContext({}); function c(f, a) { f.propsReady !== void 0 && _(f.propsReady, !1); for (const S of o) { const H = f[e.required[S]]; _(H, a[S]); } for (const S of r) if (S in a) { const H = f[e.optional[S]]; _(H, a[S]); } f.propsReady !== void 0 && _(f.propsReady, !0); } function d(f) { return s.reduce((a, S) => (a[S] = (H) => { const y = f[e.methods[S]]; _(y, H); }, a), {}); } function m(f) { return i.reduce((a, S) => (a[S] = yo(f[e.events[S]]), a), {}); } const v = E.forwardRef(function(a, S) { const { children: H, ...y } = a, [O] = E.useState(() => ye(Ro(t), (C) => { c(C, y); })), [u] = E.useState(mn(m, O)); Ie(() => { for (const C of i) C in y && Y(u[C], y[C]); return () => { Object.values(u).map(Ne); }; }, [y, u, O]), Ie(() => { c(O, y); }), E.useImperativeHandle(S, fn(d(O))); const g = n; return /* @__PURE__ */ G(l.Provider, { value: O, children: n !== void 0 ? /* @__PURE__ */ G(g, { ...cr([...o, ...r, ...i], y), children: H }) : H }); }), p = (f) => { const a = E.useContext(l); return E.useCallback( (S) => { _(a[f], S); }, [a, f] ); }, I = (f) => { const S = E.useContext(l)[f], H = E.useCallback( (y) => Y(S, y), [S] ); return E.useSyncExternalStore( H, () => it(S), () => it(S) ); }, w = (f) => { const S = E.useContext(l)[f], [H, y] = E.useState(mn(it, S)); return Ie( () => Y(S, (O) => { O !== H && y(fn(O)); }), [S, H] ), H; }, R = parseInt(E.version) >= 18 ? I : w; return { Component: v, useEmitter: (f, a) => { const H = E.useContext(l)[f]; Ie(() => Y(H, a), [a, H]); }, useEmitterValue: R, usePublisher: p }; } const Re = E.createContext(void 0), io = E.createContext(void 0), Oe = "-webkit-sticky", Rn = "sticky", Je = ro(() => { if (typeof document > "u") return Rn; const t = document.createElement("div"); return t.style.position = Oe, t.style.position === Oe ? Oe : Rn; }), lo = typeof document < "u" ? E.useLayoutEffect : E.useEffect; function ke(t) { return "self" in t; } function ur(t) { return "body" in t; } function co(t, e, n, o = Jt, r, s) { const i = E.useRef(null), l = E.useRef(null), c = E.useRef(null), d = E.useCallback( (p) => { let I, w, R; const h = p.target; if (ur(h) || ke(h)) { const a = ke(h) ? h : h.defaultView; R = s === !0 ? _t(a, a.scrollX) : a.scrollY, I = s === !0 ? a.document.documentElement.scrollWidth : a.document.documentElement.scrollHeight, w = s === !0 ? a.innerWidth : a.innerHeight; } else R = s === !0 ? _t(h, h.scrollLeft) : h.scrollTop, I = s === !0 ? h.scrollWidth : h.scrollHeight, w = s === !0 ? h.offsetWidth : h.offsetHeight; const f = () => { t({ scrollHeight: I, scrollTop: Math.max(R, 0), viewportHeight: w }); }; p.suppressFlushSync === !0 ? f() : So.flushSync(f), l.current !== null && (R === l.current || R <= 0 || R === I - w) && (l.current = null, e(!0), c.current && (clearTimeout(c.current), c.current = null)); }, [t, e, s] ); E.useEffect(() => { const p = r || i.current; return hn(p), o(r || i.current), d({ suppressFlushSync: !0, target: p }), p.addEventListener("scroll", d, { passive: !0 }), () => { hn(p), o(null), p.removeEventListener("scroll", d); }; }, [i, d, n, o, r]); function m(p) { const I = i.current; if (!I || (s === !0 ? "offsetWidth" in I && I.offsetWidth === 0 : "offsetHeight" in I && I.offsetHeight === 0)) return; const w = p.behavior === "smooth"; let R, h, f; ke(I) ? (h = Math.max( Ht(I.document.documentElement, s === !0 ? "width" : "height"), s === !0 ? I.document.documentElement.scrollWidth : I.document.documentElement.scrollHeight ), R = s === !0 ? I.innerWidth : I.innerHeight, f = s === !0 ? _t(I, I.scrollX) : I.scrollY) : (h = I[s === !0 ? "scrollWidth" : "scrollHeight"], R = Ht(I, s === !0 ? "width" : "height"), f = s === !0 ? _t(I, I.scrollLeft) : I.scrollTop); const a = h - R; if (p.top === void 0) { I.scrollTo(p); return; } const S = Math.ceil(Math.max(Math.min(a, p.top), 0)); if (p.top = S, Jn(R, h) || S === f) { t({ scrollHeight: h, scrollTop: f, viewportHeight: R }), w && e(!0); return; } w ? (l.current = S, c.current && clearTimeout(c.current), c.current = setTimeout(() => { c.current = null, l.current = null, e(!0); }, 1e3)) : l.current = null, s === !0 && (p = { ...p.behavior !== void 0 ? { behavior: p.behavior } : {}, left: gn(I, S) }), I.scrollTo(p); } function v(p) { s === !0 && (p = { ...p.behavior !== void 0 ? { behavior: p.behavior } : {}, ...p.top !== void 0 ? { left: gn(i.current, p.top) } : {} }), i.current.scrollBy(p); } return { scrollByCallback: v, scrollerRef: i, scrollToCallback: m }; } function Qe(t) { return t; } const ar = /* @__PURE__ */ j(() => { const t = T((l) => `Item ${l}`), e = T((l) => `Group ${l}`), n = T({}), o = T(Qe), r = T("div"), s = T(Jt), i = (l, c = null) => ht( x( n, B((d) => d[l]), nt() ), c ); return { components: n, computeItemKey: o, EmptyPlaceholder: i("EmptyPlaceholder"), FooterComponent: i("Footer"), GroupComponent: i("Group", "div"), groupContent: e, HeaderComponent: i("Header"), HeaderFooterTag: r, ItemComponent: i("Item", "div"), itemContent: t, ListComponent: i("List", "div"), ScrollerComponent: i("Scroller", "div"), scrollerRef: s, ScrollSeekPlaceholder: i("ScrollSeekPlaceholder"), TopItemListComponent: i("TopItemList") }; }), dr = /* @__PURE__ */ j( ([t, e]) => ({ ...t, ...e }), rt(so, ar) ), fr = ({ height: t }) => /* @__PURE__ */ G("div", { style: { height: t } }), mr = { overflowAnchor: "none", position: Je(), zIndex: 1 }, uo = { overflowAnchor: "none" }, pr = { ...uo, display: "inline-block", height: "100%" }, Hn = /* @__PURE__ */ E.memo(function({ showTopList: e = !1 }) { const n = A("listState"), o = Ct("sizeRanges"), r = A("useWindowScroll"), s = A("customScrollParent"), i = Ct("windowScrollContainerState"), l = Ct("scrollContainerState"), c = s || r ? i : l, d = A("itemContent"), m = A("context"), v = A("groupContent"), p = A("trackItemSizes"), I = A("itemSize"), w = A("log"), R = Ct("gap"), h = A("horizontalDirection"), { callbackRef: f } = Mn( o, I, p, e ? Jt : c, w, R, s, h, A("skipAnimationFrameInResizeObserver") ), [a, S] = E.useState(0); on("deviation", (F) => { a !== F && S(F); }); const H = A("EmptyPlaceholder"), y = A("ScrollSeekPlaceholder") ?? fr, O = A("ListComponent"), u = A("ItemComponent"), g = A("GroupComponent"), C = A("computeItemKey"), z = A("isSeeking"), L = A("groupIndices").length > 0, V = A("alignToBottom"), N = A("initialItemFinalLocationReached"), Z = e ? {} : { boxSizing: "border-box", ...h ? { display: "inline-block", height: "100%", marginInlineStart: a !== 0 ? a : V ? "auto" : 0, paddingInlineEnd: n.offsetBottom, paddingInlineStart: n.offsetTop, whiteSpace: "nowrap" } : { marginTop: a !== 0 ? a : V ? "auto" : 0, paddingBottom: n.offsetBottom, paddingTop: n.offsetTop }, ...N ? {} : { visibility: "hidden" } }; return !e && n.totalCount === 0 && H !== null && H !== void 0 ? /* @__PURE__ */ G(H, { ...ot(H, m) }) : /* @__PURE__ */ G( O, { ...ot(O, m), "data-testid": e ? "virtuoso-top-item-list" : "virtuoso-item-list", ref: f, style: Z, children: (e ? n.topItems : n.items).map((F) => { const mt = F.originalIndex, q = C(mt + n.firstItemIndex, F.data, m); return z ? /* @__PURE__ */ Dt( y, { ...ot(y, m), height: F.size, index: F.index, key: q, type: F.type || "item", ...F.type === "group" ? {} : { groupIndex: F.groupIndex } } ) : F.type === "group" ? /* @__PURE__ */ Dt( g, { ...ot(g, m), "data-index": mt, "data-item-index": F.index, "data-known-size": F.size, key: q, style: mr }, v(F.index, m) ) : /* @__PURE__ */ Dt( u, { ...ot(u, m), ...ao(u, F.data), "data-index": mt, "data-item-group-index": F.groupIndex, "data-item-index": F.index, "data-known-size": F.size, key: q, style: h ? pr : uo }, L ? d(F.index, F.groupIndex, F.data, m) : d(F.index, F.data, m) ); }) } ); }), hr = { height: "100%", outline: "none", overflowY: "auto", position: "relative", WebkitOverflowScrolling: "touch" }, gr = { outline: "none", overflowX: "auto", position: "relative" }, He = (t) => ({ height: "100%", position: "absolute", top: 0, width: "100%", ...t ? { display: "flex", flexDirection: "column" } : void 0 }), tn = (t, e, n = 0) => ({ ...He(t), position: e ? "relative" : "absolute", top: e ? -n : 0 }), Ir = { position: Je(), top: 0, width: "100%", zIndex: 1 }; function ot(t, e) { if (typeof t != "string") return { context: e }; } function ao(t, e) { return { item: typeof t == "string" ? void 0 : e }; } const Sr = /* @__PURE__ */ E.memo(function() { const e = A("HeaderComponent"), n = Ct("headerHeight"), o = A("HeaderFooterTag"), r = Ot( E.useMemo( () => (i) => { n(Ht(i, "height")); }, [n] ), !0, A("skipAnimationFrameInResizeObserver") ), s = A("context"); return e != null ? /* @__PURE__ */ G(o, { ref: r, children: /* @__PURE__ */ G(e, { ...ot(e, s) }) }) : null; }), xr = /* @__PURE__ */ E.memo(function() { const e = A("FooterComponent"), n = Ct("footerHeight"), o = A("HeaderFooterTag"), r = Ot( E.useMemo( () => (i) => { n(Ht(i, "height")); }, [n] ), !0, A("skipAnimationFrameInResizeObserver") ), s = A("context"); return e != null ? /* @__PURE__ */ G(o, { ref: r, children: /* @__PURE__ */ G(e, { ...ot(e, s) }) }) : null; }); function en({ useEmitter: t, useEmitterValue: e, usePublisher: n }) { return E.memo(function({ children: s, style: i, context: l, ...c }) { const d = n("scrollContainerState"), m = e("ScrollerComponent"), v = n("smoothScrollTargetReached"), p = e("scrollerRef"), I = e("horizontalDirection") || !1, { scrollByCallback: w, scrollerRef: R, scrollToCallback: h } = co( d, v, m, p, void 0, I ); return t("scrollTo", h), t("scrollBy", w), /* @__PURE__ */ G( m, { "data-testid": "virtuoso-scroller", "data-virtuoso-scroller": !0, ref: R, style: { ...I ? gr : hr, ...i }, tabIndex: 0, ...c, ...ot(m, l), children: s } ); }); } function nn({ useEmitter: t, useEmitterValue: e, usePublisher: n }) { return E.memo(function({ children: s, style: i, context: l, ...c }) { const d = n("windowScrollContainerState"), m = e("ScrollerComponent"), v = n("smoothScrollTargetReached"), p = e("totalListHeight"), I = e("deviation"), w = e("customScrollParent"), R = E.useRef(null), h = e("scrollerRef"), { scrollByCallback: f, scrollerRef: a, scrollToCallback: S } = co( d, v, m, h, w ); return lo(() => (a.current = w || R.current?.ownerDocument.defaultView, () => { a.current = null; }), [a, w]), t("windowScrollTo", S), t("scrollBy", f), /* @__PURE__ */ G( m, { ref: R, "data-virtuoso-scroller": !0, style: { position: "relative", ...i, ...p !== 0 ? { height: p + I } : void 0 }, ...c, ...ot(m, l), children: s } ); }); } const vr = ({ children: t }) => { const e = E.useContext(Re), n = Ct("viewportHeight"), o = Ct("fixedItemHeight"), r = A("alignToBottom"), s = A("horizontalDirection"), i = E.useMemo( () => re(n, (c) => Ht(c, s ? "width" : "height")), [n, s] ), l = Ot(i, !0, A("skipAnimationFrameInResizeObserver")); return E.useEffect(() => { e && (n(e.viewportHeight), o(e.itemHeight)); }, [e, n, o]), /* @__PURE__ */ G("div", { "data-viewport-type": "element", ref: l, style: He(r), children: t }); }, Tr = ({ children: t }) => { const e = E.useContext(Re), n = Ct("windowViewportRect"), o = Ct("fixedItemHeight"), r = A("customScrollParent"), s = A("useWindowScroll"), i = A("topListHeight"), l = $e( n, r, A("skipAnimationFrameInResizeObserver") ), c = A("alignToBottom"); return E.useEffect(() => { e && (o(e.itemHeight), n({ listHeight: 0, offsetTop: 0, visibleHeight: e.viewportHeight, visibleWidth: 100 })); }, [e, n, o]), /* @__PURE__ */ G("div", { "data-viewport-type": "window", ref: l, style: tn(c, s, i), children: t }); }, Cr = ({ children: t }) => { const e = A("TopItemListComponent") ?? "div", n = A("headerHeight"), o = { ...Ir, marginTop: `${n}px` }, r = A("context"); return /* @__PURE__ */ G(e, { style: o, ...ot(e, r), children: t }); }, wr = /* @__PURE__ */ E.memo(function(e) { const n = A("useWindowScroll"), o = A("topItemsIndexes").length > 0, r = A("customScrollParent"), s = A("context"); return /* @__PURE__ */ $t(r || n ? br : yr, { ...e, context: s, children: [ o && /* @__PURE__ */ G(Cr, { children: /* @__PURE__ */ G(Hn, { showTopList: !0 }) }), /* @__PURE__ */ $t(r || n ? Tr : vr, { children: [ /* @__PURE__ */ G(Sr, {}), /* @__PURE__ */ G(Hn, {}), /* @__PURE__ */ G(xr, {}) ] }) ] }); }), { Component: fo, useEmitter: on, useEmitterValue: A, usePublisher: Ct } = /* @__PURE__ */ Xe( dr, { optional: { restoreStateFrom: "restoreStateFrom", context: "context", followOutput: "followOutput", scrollIntoViewOnChange: "scrollIntoViewOnChange", itemContent: "itemContent", groupContent: "groupContent", overscan: "overscan", increaseViewportBy: "increaseViewportBy", minOverscanItemCount: "minOverscanItemCount", totalCount: "totalCount", groupCounts: "groupCounts", topItemCount: "topItemCount", firstItemIndex: "firstItemIndex", initialTopMostItemIndex: "initialTopMostItemIndex", components: "components", atBottomThreshold: "atBottomThreshold", atTopThreshold: "atTopThreshold", computeItemKey: "computeItemKey", defaultItemHeight: "defaultItemHeight", fixedGroupHeight: "fixedGroupHeight", // Must be set above 'fixedItemHeight' fixedItemHeight: "fixedItemHeight", heightEstimates: "heightEstimates", itemSize: "itemSize", scrollSeekConfiguration: "scrollSeekConfiguration", headerFooterTag: "HeaderFooterTag", data: "data", initialItemCount: "initialItemCount", initialScrollTop: "initialScrollTop", alignToBottom: "alignToBottom", useWindowScroll: "useWindowScroll", customScrollParent: "customScrollParent", scrollerRef: "scrollerRef", logLevel: "logLevel", horizontalDirection: "horizontalDirection", skipAnimationFrameInResizeObserver: "skipAnimationFrameInResizeObserver" }, methods: { scrollToIndex: "scrollToIndex", scrollIntoView: "scrollIntoView", scrollTo: "scrollTo", scrollBy: "scrollBy", autoscrollToBottom: "autoscrollToBottom", getState: "getState" }, events: { isScrolling: "isScrolling", endReached: "endReached", startReached: "startReached", rangeChanged: "rangeChanged", atBottomStateChange: "atBottomStateChange", atTopStateChange: "atTopStateChange", totalListHeightChanged: "totalListHeightChanged", itemsRendered: "itemsRendered", groupIndices: "groupIndices" } }, wr ), yr = /* @__PURE__ */ en({ useEmitter: on, useEmitterValue: A, usePublisher: Ct }), br = /* @__PURE__ */ nn({ useEmitter: on, useEmitterValue: A, usePublisher: Ct }), ns = fo, os = fo, Rr = /* @__PURE__ */ j(() => { const t = T((d) => /* @__PURE__ */ $t("td", { children: [ "Item $", d ] })), e = T(null), n = T((d) => /* @__PURE__ */ $t("td", { colSpan: 1e3, children: [ "Group ", d ] })), o = T(null), r = T(null), s = T({}), i = T(Qe), l = T(Jt), c = (d, m = null) => ht( x( s, B((v) => v[d]), nt() ), m ); return { components: s, computeItemKey: i, context: e, EmptyPlaceholder: c("EmptyPlaceholder"), FillerRow: c("FillerRow"), fixedFooterContent: r, fixedHeaderContent: o, itemContent: t, groupContent: n, ScrollerComponent: c("Scroller", "div"), scrollerRef: l, ScrollSeekPlaceholder: c("ScrollSeekPlaceholder"), TableBodyComponent: c("TableBody", "tbody"), TableComponent: c("Table", "table"), TableFooterComponent: c("TableFoot", "tfoot"), TableHeadComponent: c("TableHead", "thead"), TableRowComponent: c("TableRow", "tr"), GroupComponent: c("Group", "tr") }; }), Hr = /* @__PURE__ */ j( ([t, e]) => ({ ...t, ...e }), rt(so, Rr) ), Er = ({ height: t }) => /* @__PURE__ */ G("tr", { children: /* @__PURE__ */ G("td", { style: { height: t } }) }), Br = ({ height: t }) => /* @__PURE__ */ G("tr", { children: /* @__PURE__ */ G("td", { style: { border: 0, height: t, padding: 0 } }) }), Lr = { overflowAnchor: "none" }, En = { position: Je(), zIndex: 2, overflowAnchor: "none" }, Bn = /* @__PURE__ */ E.memo(function({ showTopList: e = !1 }) { const n = M("listState"), o = M("computeItemKey"), r = M("firstItemIndex"), s = M("context"), i = M("isSeeking"), l = M("fixedHeaderHeight"), c = M("groupIndices").length > 0, d = M("itemContent"), m = M("groupContent"), v = M("ScrollSeekPlaceholder") ?? Er, p = M("GroupComponent"), I = M("TableRowComponent"), w = (e ? n.topItems : []).reduce((h, f, a) => (a === 0 ? h.push(f.size) : h.push(h[a - 1] + f.size), h), []); return (e ? n.topItems : n.items).map((h) => { const f = h.originalIndex, a = o(f + r, h.data, s), S = e ? f === 0 ? 0 : w[f - 1] : 0; return i ? /* @__PURE__ */ Dt( v, { ...ot(v, s), height: h.size, index: h.index, key: a, type: h.type || "item" } ) : h.type === "group" ? /* @__PURE__ */ Dt( p, { ...ot(p, s), "data-index": f, "data-item-index": h.index, "data-known-size": h.size, key: a, style: { ...En, top: l } }, m(h.index, s) ) : /* @__PURE__ */ Dt( I, { ...ot(I, s), ...ao(I, h.data), "data-index": f, "data-item-index": h.index, "data-known-size": h.size, "data-item-group-index": h.groupIndex, key: a, style: e ? { ...En, top: l + S } : Lr }, c ? d(h.index, h.groupIndex, h.data, s) : d(h.index, h.data, s) ); }); }), Or = /* @__PURE__ */ E.memo(function() { const e = M("listState"), n = M("topItemsIndexes").length > 0, o = bt("sizeRanges"), r = M("useWindowScroll"), s = M("customScrollParent"), i = bt("windowScrollContainerState"), l = bt("scrollContainerState"), c = s || r ? i : l, d = M("trackItemSizes"), m = M("itemSize"), v = M("log"), { callbackRef: p, ref: I } = Mn( o, m, d, c, v, void 0, s, !1, M("skipAnimationFrameInResizeObserver") ), [w, R] = E.useState(0); rn("deviation", (L) => { w !== L && (I.current.style.marginTop = `${L}px`, R(L)); }); const h = M("EmptyPlaceholder"), f = M("FillerRow") ?? Br, a = M("TableBodyComponent"), S = M("paddingTopAddition"), H = M("statefulTotalCount"), y = M("context"); if (H === 0 && h !== null && h !== void 0) return /* @__PURE__ */ G(h, { ...ot(h, y) }); const O = (n ? e.topItems : []).reduce((L, V) => L + V.size, 0), u = e.offsetTop + S + w - O, g = e.offsetBottom, C = u > 0 ? /* @__PURE__ */ G(f, { context: y, height: u }, "padding-top") : null, z = g > 0 ? /* @__PURE__ */ G(f, { context: y, height: g }, "padding-bottom") : null; return /* @__PURE__ */ $t(a, { "data-testid": "virtuoso-item-list", ref: p, ...ot(a, y), children: [ C, n && /* @__PURE__ */ G(Bn, { showTopList: !0 }), /* @__PURE__ */ G(Bn, {}), z ] }); }), kr = ({ children: t }) => { const e = E.useContext(Re), n = bt("viewportHeight"), o = bt("fixedItemHeight"), r = Ot( E.useMemo(() => re(n, (s) => Ht(s, "height")), [n]), !0, M("skipAnimationFrameInResizeObserver") ); return E.useEffect(() => { e && (n(e.viewportHeight), o(e.itemHeight)); }, [e, n, o]), /* @__PURE__ */ G("div", { "data-viewport-type": "element", ref: r, style: He(!1), children: t }); }, zr = ({ children: t }) => { const e = E.useContext(Re), n = bt("windowViewportRect"), o = bt("fixedItemHeight"), r = M("customScrollParent"), s = M("useWindowScroll"), i = $e( n, r, M("skipAnimationFrameInResizeObserver") ); return E.useEffect(() => { e && (o(e.itemHeight), n({ listHeight: 0, offsetTop: 0, visibleHeight: e.viewportHeight, visibleWidth: 100 })); }, [e, n, o]), /* @__PURE__ */ G("div", { "data-viewport-type": "window", ref: i, style: tn(!1, s), children: t }); }, Fr = /* @__PURE__ */ E.memo(function(e) { const n = M("useWindowScroll"), o = M("customScrollParent"), r = bt("fixedHeaderHeight"), s = bt("fixedFooterHeight"), i = M("fixedHeaderContent"), l = M("fixedFooterContent"), c = M("context"), d = Ot( E.useMemo(() => re(r, (a) => Ht(a, "height")), [r]), !0, M("skipAnimationFrameInResizeObserver") ), m = Ot( E.useMemo(() => re(s, (a) => Ht(a, "height")), [s]), !0, M("skipAnimationFrameInResizeObserver") ), v = o || n ? Wr : Vr, p = o || n ? zr : kr, I = M("TableComponent"), w = M("TableHeadComponent"), R = M("TableFooterComponent"), h = i ? /* @__PURE__ */ G( w, { ref: d, style: { position: "sticky", top: 0, zIndex: 2 }, ...ot(w, c), children: i() }, "TableHead" ) : null, f = l ? /* @__PURE__ */ G( R, { ref: m, style: { bottom: 0, position: "sticky", zIndex: 1 }, ...ot(R, c), children: l() }, "TableFoot" ) : null; return /* @__PURE__ */ G(v, { ...e, ...ot(v, c), children: /* @__PURE__ */ G(p, { children: /* @__PURE__ */ $t(I, { style: { borderSpacing: 0, overflowAnchor: "none" }, ...ot(I, c), children: [ h, /* @__PURE__ */ G(Or, {}, "TableBody"), f ] }) }) }); }), { Component: mo, useEmitter: rn, useEmitterValue: M, usePublisher: bt } = /* @__PURE__ */ Xe( Hr, { optional: { restoreStateFrom: "restoreStateFrom", context: "context", followOutput: "followOutput", firstItemIndex: "firstItemIndex", itemContent: "itemContent", groupContent: "groupContent", fixedHeaderContent: "fixedHeaderContent", fixedFooterContent: "fixedFooterContent", overscan: "overscan", increaseViewportBy: "increaseViewportBy", minOverscanItemCount: "minOverscanItemCount", totalCount: "totalCount", topItemCount: "topItemCount", initialTopMostItemIndex: "initialTopMostItemIndex", components: "components", groupCounts: "groupCounts", atBottomThreshold: "atBottomThreshold", atTopThreshold: "atTopThreshold", computeItemKey: "computeItemKey", defaultItemHeight: "defaultItemHeight", fixedGroupHeight: "fixedGroupHeight", // Must be set above 'fixedItemHeight' fixedItemHeight: "fixedItemHeight", itemSize: "itemSize", scrollSeekConfiguration: "scrollSeekConfiguration", data: "data", initialItemCount: "initialItemCount", initialScrollTop: "initialScrollTop", alignToBottom: "alignToBottom", useWindowScroll: "useWindowScroll", customScrollParent: "customScrollParent", scrollerRef: "scrollerRef", logLevel: "logLevel" }, methods: { scrollToIndex: "scrollToIndex", scrollIntoView: "scrollIntoView", scrollTo: "scrollTo", scrollBy: "scrollBy", getState: "getState" }, events: { isScrolling: "isScrolling", endReached: "endReached", startReached: "startReached", rangeChanged: "rangeChanged", atBottomStateChange: "atBottomStateChange", atTopStateChange: "atTopStateChange", totalListHeightChanged: "totalListHeightChanged", itemsRendered: "itemsRendered", groupIndices: "groupIndices" } }, Fr ), Vr = /* @__PURE__ */ en({ useEmitter: rn, useEmitterValue: M, usePublisher: bt }), Wr = /* @__PURE__ */ nn({ useEmitter: rn, useEmitterValue: M, usePublisher: bt }), rs = mo, ss = mo, Ln = { bottom: 0, itemHeight: 0, items: [], itemWidth: 0, offsetBottom: 0, offsetTop: 0, top: 0 }, Pr = { bottom: 0, itemHeight: 0, items: [{ index: 0 }], itemWidth: 0, offsetBottom: 0, offsetTop: 0, top: 0 }, { ceil: On, floor: Ce, max: oe, min: ze, round: kn } = Math; function zn(t, e, n) { return Array.from({ length: e - t + 1 }).map((o, r) => ({ data: n === null ? null : n[r + t], index: r + t })); } function Gr(t) { return { ...Pr, items: t }; } function Se(t, e) { return t !== void 0 && t.width === e.width && t.height === e.height; } function Ar(t, e) { return t !== void 0 && t.column === e.column && t.row === e.row; } const Mr = /* @__PURE__ */ j( ([ { increaseViewportBy: t, listBoundary: e, overscan: n, visibleRange: o }, { footerHeight: r, headerHeight: s, scrollBy: i, scrollContainerState: l, scrollTo: c, scrollTop: d, smoothScrollTargetReached: m, viewportHeight: v }, p, I, { didMount: w, propsReady: R }, { customScrollParent: h, useWindowScroll: f, windowScrollContainerState: a, windowScrollTo: S, windowViewportRect: H }, y ]) => { const O = T(0), u = T(0), g = T(Ln), C = T({ height: 0, width: 0 }), z = T({ height: 0, width: 0 }), L = U(), V = U(), N = T(0), Z = T(null), F = T({ column: 0, row: 0 }), mt = U(), q = U(), Q = T(!1), gt = T(0), ut = T(!0), St = T(!1), Ft = T(!1); Y( x( w, $(gt), P(([b, D]) => D !== 0) ), () => { _(ut, !1); } ), Y( x( at(w, ut, z, C, gt, St), P(([b, D, K, st, , tt]) => b && !D && K.height !== 0 && st.height !== 0 && !tt) ), ([, , , , b]) => { _(St, !0), je(1, () => { _(L, b); }), yt(x(d), () => { _(e, [0, 0]), _(ut, !0); }); } ), k( x( q, P((b) => b != null && b.scrollTop > 0), Bt(0) ), u ), Y( x( w, $(q), P(([, b]) => b != null) ), ([, b]) => { b && (_(C, b.viewport), _(z, b.item), _(F, b.gap), b.scrollTop > 0 && (_(Q, !0), yt(x(d, Ut(1)), (D) => { _(Q, !1); }), _(c, { top: b.scrollTop }))); } ), k( x( C, B(({ height: b }) => b) ), v ), k( x( at( W(C, Se), W(z, Se), W(F, (b, D) => b !== void 0 && b.column === D.column && b.row === D.row), W(d) ), B(([b, D, K, st]) => ({ gap: K, item: D, scrollTop: st, viewport: b })) ), mt ), k( x( at( W(O), o, W(F, Ar), W(z, Se), W(C, Se), W(Z), W(u), W(Q), W(ut), W(gt) ), P(([, , , , , , , b]) => !b), B( ([ b, [D, K], st, tt, X, lt, xt, , ct, Vt ]) => { const { column: Wt, row: ee } = st, { height: he, width: Ee } = tt, { width: sn } = X; if (xt === 0 && (b === 0 || sn === 0)) return Ln; if (Ee === 0) { const dn = qe(Vt, b), Io = dn + Math.max(xt - 1, 0); return Gr(zn(dn, Io, lt)); } const ge = po(sn, Ee, Wt); let qt, Mt; ct ? D === 0 && K === 0 && xt > 0 ? (qt = 0, Mt = xt - 1) : (qt = ge * Ce((D + ee) / (he + ee)), Mt = ge * On((K + ee) / (he + ee)) - 1, Mt = ze(b - 1, oe(Mt, ge - 1)), qt = ze(Mt, oe(0, qt))) : (qt = 0, Mt = -1); const ln = zn(qt, Mt, lt), { bottom: cn, top: un } = Fn(X, st, tt, ln), an = On(b / ge), go = an * he + (an - 1) * ee - cn; return { bottom: cn, itemHeight: he, items: ln, itemWidth: Ee, offsetBottom: go, offsetTop: un, top: un }; } ) ), g ), k( x( Z, P((b) => b !== null), B((b) => b.length) ), O ), k( x( at(C, z, g, F), P(([b, D, { items: K }]) => K.length > 0 && D.height !== 0 && b.height !== 0), B(([b, D, { items: K }, st]) => { const { bottom: tt, top: X } = Fn(b, st, D, K); return [X, tt]; }), nt(le) ), e ); const pt = T(!1); k( x( d, $(pt), B(([b, D]) => D || b !== 0) ), pt ); const jt = Tt( x( at(g, O), P(([{ items: b }]) => b.length > 0), $(pt), P(([[b, D], K]) => { const tt = b.items[b.items.length - 1].index === D - 1; return (K || b.bottom > 0 && b.itemHeight > 0 && b.offsetBottom === 0 && b.items.length === D) && tt; }), B(([[, b]]) => b - 1), nt() ) ), Qt = Tt( x( W(g), P(({ items: b }) => b.length > 0 && b[0].index === 0), Bt(0), nt() ) ), Et = Tt( x( W(g), $(Q), P(([{ items: b }, D]) => b.length > 0 && !D), B(([{ items: b }]) => ({ endIndex: b[b.length - 1].index, startIndex: b[0].index })), nt(Kn), zt(0) ) ); k(Et, I.scrollSeekRangeChanged), k( x( L, $(C, z, O, F), B(([b, D, K, st, tt]) => { const X = Xn(b), { align: lt, behavior: xt, offset: ct } = X; let Vt = X.index; Vt === "LAST" && (Vt = st - 1), Vt = oe(0, Vt, ze(st - 1, Vt)); let Wt = Me(D, tt, K, Vt); return lt === "end" ? Wt = kn(Wt - D.height + K.height) : lt === "center" && (Wt = kn(Wt - D.height / 2 + K.height / 2)), ct !== void 0 && ct !== 0 && (Wt += ct), { behavior: xt, top: Wt }; }) ), c ); const te = ht( x( g, B((b) => b.offsetBottom + b.bottom) ), 0 ); return k( x( H, B((b) => ({ height: b.visibleHeight, width: b.visibleWidth })) ), C ), { customScrollParent: h, // input data: Z, deviation: N, footerHeight: r, gap: F, headerHeight: s, increaseViewportBy: t, initialItemCount: u, itemDimensions: z, overscan: n, restoreStateFrom: q, scrollBy: i, scrollContainerState: l, scrollHeight: V, scrollTo: c, scrollToIndex: L, scrollTop: d, smoothScrollTargetReached: m, totalCount: O, useWindowScroll: f, viewportDimensions: C, windowScrollContainerState: a, windowScrollTo: S, windowViewportRect: H, ...I, // output gridState: g, horizontalDirection: Ft, initialTopMostItemIndex: gt, totalListHeight: te, ...p, endReached: jt, propsReady: R, rangeChanged: Et, startReached: Qt, stateChanged: mt, stateRestoreInProgress: Q, ...y }; }, rt(Ye, It, pe, oo, At, Ze, Gt) ); function po(t, e, n) { return oe(1, Ce((t + n) / (Ce(e) + n))); } function Fn(t, e, n, o) { const { height: r } = n; if (r === void 0 || o.length === 0) return { bottom: 0, top: 0 }; const s = Me(t, e, n, o[0].index); return { bottom: Me(t, e, n, o[o.length - 1].index) + r, top: s }; } function Me(t, e, n, o) { const r = po(t.width, n.width, e.column), s = Ce(o / r), i = s * n.height + oe(0, s - 1) * e.row; return i > 0 ? i + e.row : i; } const _r = /* @__PURE__ */ j(() => { const t = T((v) => `Item ${v}`), e = T({}), n = T(null), o = T("virtuoso-grid-item"), r = T("virtuoso-grid-list"), s = T(Qe), i = T("div"), l = T(Jt), c = (v, p = null) => ht( x( e, B((I) => I[v]), nt() ), p ), d = T(!1), m = T(!1); return k(W(m), d), { components: e, computeItemKey: s, context: n, FooterComponent: c("Footer"), HeaderComponent: c("Header"), headerFooterTag: i, itemClassName: o, ItemComponent: c("Item", "div"), itemContent: t, listClassName: r, ListComponent: c("List", "div"), readyStateChanged: d, reportReadyState: m, ScrollerComponent: c("Scroller", "div"), scrollerRef: l, ScrollSeekPlaceholder: c("ScrollSeekPlaceholder", "div") }; }), Nr = /* @__PURE__ */ j( ([t, e]) => ({ ...t, ...e }), rt(Mr, _r) ), Dr = /* @__PURE__ */ E.memo(function() { const e = et("gridState"), n = et("listClassName"), o = et("itemClassName"), r = et("itemContent"), s = et("computeItemKey"), i = et("isSeeking"), l = wt("scrollHeight"), c = et("ItemComponent"), d = et("ListComponent"), m = et("ScrollSeekPlaceholder"), v = et("context"), p = wt("itemDimensions"), I = wt("gap"), w = et("log"), R = et("stateRestoreInProgress"), h = wt("reportReadyState"), f = Ot( E.useMemo( () => (a) => { const S = a.parentElement.parentElement.scrollHeight; l(S); const H = a.firstChild; if (H !== null) { const { height: y, width: O } = H.getBoundingClientRect(); p({ height: y, width: O }); } I({ column: Vn("column-gap", getComputedStyle(a).columnGap, w), row: Vn("row-gap", getComputedStyle(a).rowGap, w) }); }, [l, p, I, w] ), !0, !1 ); return lo(() => { e.itemHeight > 0 && e.itemWidth > 0 && h(!0); }, [e]), R ? null : /* @__PURE__ */ G( d, { className: n, ref: f, ...ot(d, v), "data-testid": "virtuoso-item-list", style: { paddingBottom: e.offsetBottom, paddingTop: e.offsetTop }, children: e.items.map((a) => { const S = s(a.index, a.data, v); return i ? /* @__PURE__ */ G( m, { ...ot(m, v), height: e.itemHeight, index: a.index, width: e.itemWidth }, S ) : /* @__PURE__ */ Dt( c, { ...ot(c, v), className: o, "data-index": a.index, key: S }, r(a.index, a.data, v) ); }) } ); }), $r = E.memo(function() { const e = et("HeaderComponent"), n = wt("headerHeight"), o = et("headerFooterTag"), r = Ot( E.useMemo( () => (i) => { n(Ht(i, "height")); }, [n] ), !0, !1 ), s = et("context"); return e != null ? /* @__PURE__ */ G(o, { ref: r, children: /* @__PURE__ */ G(e, { ...ot(e, s) }) }) : null; }), Ur = E.memo(function() { const e = et("FooterComponent"), n = wt("footerHeight"), o = et("headerFooterTag"), r = Ot( E.useMemo( () => (i) => { n(Ht(i, "height")); }, [n] ), !0, !1 ), s = et("context"); return e != null ? /* @__PURE__ */ G(o, { ref: r, children: /* @__PURE__ */ G(e, { ...ot(e, s) }) }) : null; }), Kr = ({ children: t }) => { const e = E.useContext(io), n = wt("itemDimensions"), o = wt("viewportDimensions"), r = Ot( E.useMemo( () => (s) => { o(s.getBoundingClientRect()); }, [o] ), !0, !1 ); return E.useEffect(() => { e && (o({ height: e.viewportHeight, width: e.viewportWidth }), n({ height: e.itemHeight, width: e.itemWidth })); }, [e, o, n]), /* @__PURE__ */ G("div", { ref: r, style: He(!1), children: t }); }, jr = ({ children: t }) => { const e = E.useContext(io), n = wt("windowViewportRect"), o = wt("itemDimensions"), r = et("customScrollParent"), s = et("useWindowScroll"), i = $e(n, r, !1); return E.useEffect(() => { e && (o({ height: e.itemHeight, width: e.itemWidth }), n({ listHeight: 0, offsetTop: 0, visibleHeight: e.viewportHeight, visibleWidth: e.viewportWidth })); }, [e, n, o]), /* @__PURE__ */ G("div", { ref: i, style: tn(!1, s), children: t }); }, qr = /* @__PURE__ */ E.memo(function({ ...e }) { const n = et("useWindowScroll"), o = et("customScrollParent"), r = o || n ? Xr : Zr, s = o || n ? jr : Kr, i = et("context"); return /* @__PURE__ */ G(r, { ...e, ...ot(r, i), children: /* @__PURE__ */ $t(s, { children: [ /* @__PURE__ */ G($r, {}), /* @__PURE__ */ G(Dr, {}), /* @__PURE__ */ G(Ur, {}) ] }) }); }), { Component: Yr, useEmitter: ho, useEmitterValue: et, usePublisher: wt } = /* @__PURE__ */ Xe( Nr, { optional: { context: "context", totalCount: "totalCount", overscan: "overscan", itemContent: "itemContent", components: "components", computeItemKey: "computeItemKey", data: "data", initialItemCount: "initialItemCount", scrollSeekConfiguration: "scrollSeekConfiguration", headerFooterTag: "headerFooterTag", listClassName: "listClassName", itemClassName: "itemClassName", useWindowScroll: "useWindowScroll", customScrollParent: "customScrollParent", scrollerRef: "scrollerRef", logLevel: "logLevel", restoreStateFrom: "restoreStateFrom", initialTopMostItemIndex: "initialTopMostItemIndex", increaseViewportBy: "increaseViewportBy" }, methods: { scrollTo: "scrollTo", scrollBy: "scrollBy", scrollToIndex: "scrollToIndex" }, events: { isScrolling: "isScrolling", endReached: "endReached", startReached: "startReached", rangeChanged: "rangeChanged", atBottomStateChange: "atBottomStateChange", atTopStateChange: "atTopStateChange", stateChanged: "stateChanged", readyStateChanged: "readyStateChanged" } }, qr ), Zr = /* @__PURE__ */ en({ useEmitter: ho, useEmitterValue: et, usePublisher: wt }), Xr = /* @__PURE__ */ nn({ useEmitter: ho, useEmitterValue: et, usePublisher: wt }); function Vn(t, e, n) { return e !== "normal" && e?.endsWith("px") !== !0 && n(`${t} was not resolved to pixel value correctly`, e, ft.WARN), e === "normal" ? 0 : parseInt(e ?? "0", 10); } const is = Yr; export { ss as GroupedTableVirtuoso, os as GroupedVirtuoso, ft as LogLevel, rs as TableVirtuoso, ns as Virtuoso, is as VirtuosoGrid, io as VirtuosoGridMockContext, Re as VirtuosoMockContext };
import { jsx as G, jsxs as $t } from "react/jsx-runtime";
import E, { createElement as Dt } from "react";
import So from "react-dom";
const we = 0, Pt = 1, Xt = 2, Wn = 4;
function fn(t) {
return () => t;
}
function xo(t) {
t();
}
function re(t, e) {
return (n) => t(e(n));
}
function mn(t, e) {
return () => t(e);
}
function vo(t, e) {
return (n) => t(e, n);
}
function _e(t) {
return t !== void 0;
}
function To(...t) {
return () => {
t.map(xo);
};
}
function Jt() {
}
function ye(t, e) {
return e(t), t;
}
function Co(t, e) {
return e(t);
}
function rt(...t) {
return t;
}
function Y(t, e) {
return t(Pt, e);
}
function _(t, e) {
t(we, e);
}
function Ne(t) {
t(Xt);
}
function it(t) {
return t(Wn);
}
function k(t, e) {
return Y(t, vo(e, we));
}
function yt(t, e) {
const n = t(Pt, (o) => {
n(), e(o);
});
return n;
}
function pn(t) {
let e, n;
return (o) => (r) => {
e = r, n && clearTimeout(n), n = setTimeout(() => {
o(e);
}, t);
};
}
function Pn(t, e) {
return t === e;
}
function nt(t = Pn) {
let e;
return (n) => (o) => {
t(e, o) || (e = o, n(o));
};
}
function P(t) {
return (e) => (n) => {
t(n) && e(n);
};
}
function B(t) {
return (e) => re(e, t);
}
function Bt(t) {
return (e) => () => {
e(t);
};
}
function x(t, ...e) {
const n = wo(...e);
return ((o, r) => {
switch (o) {
case Xt:
Ne(t);
return;
case Pt:
return Y(t, n(r));
}
});

Xet Storage Details

Size:
95.1 kB
·
Xet hash:
e39f17c9fcab83caae119a14b7ffc9b7b55a58edd9718596d63fae7836f07b0c

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.