@virtuoso.dev/message-list
Version:
Virtualized React component for rendering human/AI chatbot conversations.
1,900 lines • 68.8 kB
JavaScript
import { Cell as c, Signal as E, map as d, filter as v, withLatestFrom as k, scan as se, debounceTime as Ee, mapTo as P, throttleTime as nn, delayWithMicrotask as Xe, onNext as xn, Action as on, useCellValue as C, useRealm as Re, Realm as Mo, RealmContext as Ao, useCellValues as Do, usePublisher as Vo } from "@virtuoso.dev/gurx";
import f, { useEffect as Tn, useLayoutEffect as Oo } from "react";
import { jsx as y, jsxs as En } from "react/jsx-runtime";
function Ce(e, t) {
const n = c(e, (o) => {
o.link(t(o), n);
});
return n;
}
const Fe = { lvl: 0 };
function yn(e, t, n, o = Fe, i = Fe) {
return { k: e, l: o, lvl: n, r: i, v: t };
}
function T(e) {
return e === Fe;
}
function Me() {
return Fe;
}
function zt(e, t) {
if (T(e)) return Fe;
const { k: n, l: o, r: i } = e;
if (t === n) {
if (T(o))
return i;
if (T(i))
return o;
const [s, l] = $n(o);
return bt(A(e, { k: s, l: wn(o), v: l }));
}
return t < n ? bt(A(e, { l: zt(o, t) })) : bt(A(e, { r: zt(i, t) }));
}
function fe(e, t, n = "k") {
if (T(e))
return [Number.NEGATIVE_INFINITY, void 0];
if (e[n] === t)
return [e.k, e.v];
if (e[n] < t) {
const o = fe(e.r, t, n);
return o[0] === Number.NEGATIVE_INFINITY ? [e.k, e.v] : o;
}
return fe(e.l, t, n);
}
function _(e, t, n) {
return T(e) ? yn(t, n, 1) : t === e.k ? A(e, { k: t, v: n }) : t < e.k ? bn(A(e, { l: _(e.l, t, n) })) : bn(A(e, { r: _(e.r, t, n) }));
}
function Yt(e, t, n) {
if (T(e))
return [];
const { k: o, v: i, l: s, r: l } = e;
let r = [];
return o > t && (r = r.concat(Yt(s, t, n))), o >= t && o <= n && r.push({ k: o, v: i }), o <= n && (r = r.concat(Yt(l, t, n))), r;
}
function No(e, t, n, o) {
if (T(e))
return Fe;
let i = Me();
for (const { k: s, v: l } of he(e))
s > t && s <= n ? i = _(i, ...o(s, l)) : i = _(i, s, l);
return i;
}
function Bo(e, t, n) {
let o = Me(), i = -1;
for (const { start: s, end: l, value: r } of Fo(e))
s < t ? (o = _(o, s, r), i = r) : s > t + n ? o = _(o, s - n, r) : l >= t + n && i !== r && (o = _(o, t, r));
return o;
}
function he(e) {
return T(e) ? [] : [...he(e.l), { k: e.k, v: e.v }, ...he(e.r)];
}
function $n(e) {
return T(e.r) ? [e.k, e.v] : $n(e.r);
}
function wn(e) {
return T(e.r) ? e.l : bt(A(e, { r: wn(e.r) }));
}
function A(e, t) {
return yn(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r);
}
function _t(e) {
return T(e) || e.lvl > e.r.lvl;
}
function bn(e) {
return jt(Mn(e));
}
function bt(e) {
const { l: t, r: n, lvl: o } = e;
if (n.lvl >= o - 1 && t.lvl >= o - 1)
return e;
if (o > n.lvl + 1) {
if (_t(t))
return Mn(A(e, { lvl: o - 1 }));
if (!T(t) && !T(t.r))
return A(t.r, {
l: A(t, { r: t.r.l }),
lvl: o,
r: A(e, {
l: t.r.r,
lvl: o - 1
})
});
throw new Error("Unexpected empty nodes");
}
if (_t(e))
return jt(A(e, { lvl: o - 1 }));
if (!T(n) && !T(n.l)) {
const i = n.l, s = _t(i) ? n.lvl - 1 : n.lvl;
return A(i, {
l: A(e, {
lvl: o - 1,
r: i.l
}),
lvl: i.lvl + 1,
r: jt(A(n, { l: i.r, lvl: s }))
});
}
throw new Error("Unexpected empty nodes");
}
function Fo(e) {
return Cn(he(e));
}
function Ln(e, t, n) {
if (T(e))
return [];
const o = fe(e, t)[0];
return Cn(Yt(e, o, n));
}
function Rn(e, t) {
const n = e.length;
if (n === 0)
return [];
let { index: o, value: i } = t(e[0]);
const s = [];
for (let l = 1; l < n; l++) {
const { index: r, value: a } = t(e[l]);
s.push({ end: r - 1, start: o, value: i }), o = r, i = a;
}
return s.push({ end: Number.POSITIVE_INFINITY, start: o, value: i }), s;
}
function Cn(e) {
return Rn(e, ({ k: t, v: n }) => ({ index: t, value: n }));
}
function jt(e) {
const { r: t, lvl: n } = e;
return !T(t) && !T(t.r) && t.lvl === n && t.r.lvl === n ? A(t, { l: A(e, { r: t.l }), lvl: n + 1 }) : e;
}
function Mn(e) {
const { l: t } = e;
return !T(t) && t.lvl === e.lvl ? A(t, { r: A(e, { l: t.r }) }) : e;
}
function $t(e, t, n, o = 0) {
let i = e.length - 1;
for (; o <= i; ) {
const s = Math.floor((o + i) / 2), l = e[s], r = n(l, t);
if (r === 0)
return s;
if (r === -1) {
if (i - o < 2)
return s - 1;
i = s - 1;
} else {
if (i === o)
return s;
o = s + 1;
}
}
throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`);
}
function An(e, t, n) {
return e[$t(e, t, n)];
}
function Ho(e, t, n, o) {
const i = $t(e, t, o), s = $t(e, n, o, i);
return e.slice(i, s + 1);
}
function sn({ index: e }, t) {
return t === e ? 0 : t < e ? -1 : 1;
}
function _o({ offset: e }, t) {
return t === e ? 0 : t < e ? -1 : 1;
}
function Po(e) {
return { index: e.index, value: e };
}
function Wo(e, t, n, o = 0) {
return o > 0 && (t = Math.max(t, An(e, o, sn).offset)), t = Math.max(0, t), Rn(Ho(e, t, n, _o), Po);
}
const He = [[], 0, 0, 0];
function zo(e, [t, n]) {
let o = 0, i = 0, s = 0, l = 0;
if (n !== 0) {
l = $t(e, n - 1, sn), s = e[l].offset;
const a = fe(t, n - 1);
o = a[0], i = a[1], e.length && e[l].height === fe(t, n)[1] && (l -= 1), e = e.slice(0, l + 1);
} else
e = [];
for (const { start: r, value: a } of Ln(t, n, Number.POSITIVE_INFINITY)) {
const u = (r - o) * i + s;
e.push({ height: a, index: r, offset: u }), o = r, s = u, i = a;
}
return [e, i, s, o];
}
function Yo(e) {
const { size: t, startIndex: n, endIndex: o } = e;
return (i) => i.start === n && (i.end === o || i.end === Number.POSITIVE_INFINITY) && i.value === t;
}
function jo(e, t) {
let n = T(e) ? 0 : Number.POSITIVE_INFINITY;
for (const o of t) {
const { size: i, startIndex: s, endIndex: l } = o;
if (n = Math.min(n, s), T(e)) {
e = _(e, 0, i);
continue;
}
const r = Ln(e, s - 1, l + 1);
if (r.some(Yo(o)))
continue;
let a = !1, u = !1;
for (const { start: p, end: g, value: I } of r)
a ? (l >= p || i === I) && (e = zt(e, p)) : (u = I !== i, a = !0), g > l && l >= p && I !== i && (e = _(e, l + 1, I));
u && (e = _(e, s, i));
}
return [e, n];
}
const ot = [Me(), 0];
function Ko(e, [t, n]) {
if (n.length > 0 && T(e) && t.length === 2) {
const o = t[0].size, i = t[1].size;
return [
n.reduce((s, l) => _(_(s, l, o), l + 1, i), Me()),
0
];
}
return jo(e, t);
}
const pe = E();
c([]);
c([]);
c(0);
c(null);
c(Number.NaN);
const ye = c(!1), X = c(ot, (e) => {
e.link(
e.pipe(
pe,
v((t) => t.length > 0),
k(ee),
d(([t, n]) => Ko(n, [t, []]))
),
X
);
}), ee = c(ot[0], (e) => {
e.link(
e.pipe(
X,
d(([t]) => t)
),
ee
);
}), Dn = c(ot[1], (e) => {
e.link(
e.pipe(
X,
d(([, t]) => t)
),
Dn
);
}), $e = c(He[1]), ge = c(He[0]), Ge = c(He, (e) => {
e.link(
e.pipe(
ee,
k(Dn),
se(([t], [n, o]) => zo(t, [n, o]), He)
),
Ge
), e.link(
e.pipe(
Ge,
d(([, t]) => t)
),
$e
), e.link(
e.pipe(
Ge,
d(([t]) => t)
),
ge
);
}), Vn = c(He[2], (e) => {
e.link(
e.pipe(
Ge,
d(([, , t]) => t)
),
Vn
);
}), On = c(He[3], (e) => {
e.link(
e.pipe(
Ge,
d(([, , , t]) => t)
),
On
);
}), ze = c(0, (e) => {
e.link(
e.pipe(
e.combine(Ae, On, Vn, $e),
d(([t, n, o, i]) => o + (t - n) * i)
),
ze
);
});
function Nn(e, t) {
if (t.length === 0)
return [0, 0];
const { offset: n, index: o, height: i } = An(t, e, sn);
return [i * (e - o) + n, i];
}
function Qe(e, t) {
return Nn(e, t)[0];
}
function Bn(e, t) {
return Math.abs(e - t) < 1.01;
}
function Fn() {
return typeof navigator > "u" ? !1 : /Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints && navigator.maxTouchPoints > 1 || /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent);
}
function qo(e) {
return !e;
}
function Uo(e) {
return e === 1 ? 1 : 1 - 2 ** (-10 * e);
}
function Mt(e = 1) {
return (t, n) => {
const o = n.signalInstance();
return n.sub(t, (i) => {
let s = e;
function l() {
s > 0 ? (s--, requestAnimationFrame(l)) : n.pub(o, i);
}
l();
}), o;
};
}
const Kt = "up", Pt = "down", Go = "none", Zo = {
atBottom: !1,
notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",
state: {
offsetBottom: 0,
scrollTop: 0,
viewportHeight: 0,
viewportWidth: 0,
scrollHeight: 0
}
}, Jo = 0, Xo = 4;
function In(e) {
return (t, n) => {
const o = n.signalInstance();
return n.sub(t, (i) => {
e > 0 ? e-- : n.pub(o, i);
}), o;
};
}
c(!1);
const Hn = c(!0);
E();
const xe = c(!1), Qo = E((e) => {
e.link(e.pipe(Hn, nn(50)), Qo);
}), _n = c(Xo), ei = c(Jo, (e) => {
e.link(
e.pipe(
e.combine(w, ei),
d(([t, n]) => t <= n)
),
Hn
);
}), et = c(!1, (e) => {
e.link(e.pipe(w, In(1), P(!0)), et), e.link(e.pipe(w, In(1), P(!1), Ee(100)), et);
}), qt = c(!1, (e) => {
e.link(e.pipe(Q, P(!0)), qt), e.link(e.pipe(Q, P(!1), Ee(200)), qt);
}), ln = c(!1), It = c(
null,
(e) => {
e.link(
e.pipe(
e.combine(
V,
w,
q,
Tt,
_n,
Ct,
Dt,
ee
),
v(([, , , , , , , t]) => !T(t)),
se((t, [n, o, i, s, l, r]) => {
const u = o + i - n + r > -l, p = {
viewportWidth: s,
viewportHeight: i,
scrollTop: o,
scrollHeight: n,
listMarginTop: r
};
if (u) {
let I, b;
return o > t.state.scrollTop ? (I = "SCROLLED_DOWN", b = t.state.scrollTop - o) : (I = n === i ? "LIST_TOO_SHORT" : "SIZE_DECREASED", b = t.state.scrollTop - o || t.scrollTopDelta), {
atBottom: !0,
state: p,
atBottomBecause: I,
scrollTopDelta: b
};
}
let g;
return i < t.state.viewportHeight ? g = "VIEWPORT_HEIGHT_DECREASING" : s < t.state.viewportWidth ? g = "VIEWPORT_WIDTH_DECREASING" : o < t.state.scrollTop ? g = "SCROLLING_UPWARDS" : p.scrollHeight > t.state.scrollHeight || p.listMarginTop < t.state.listMarginTop ? t.atBottom ? g = "SIZE_INCREASED" : g = t.notAtBottomBecause : t.atBottom ? g = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM" : g = t.notAtBottomBecause, {
atBottom: !1,
notAtBottomBecause: g,
state: p
};
}, Zo)
),
It
), e.link(
e.pipe(
It,
se(
({ prev: t }, n) => {
const o = !!(t && n && t.atBottom && !n.atBottom && n.notAtBottomBecause === "SIZE_INCREASED");
return {
prev: n,
shouldScroll: o
};
},
{ prev: null, shouldScroll: !1 }
),
d(({ shouldScroll: t }) => t)
),
ln
), e.sub(
e.pipe(
q,
k(It, fn, tt),
v(([, , t, n]) => !t && !n),
se(
(t, [n, o]) => {
let i = 0;
return t.viewportHeight > n && o && !o.atBottom && o.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && (i = t.viewportHeight - n), { viewportHeight: n, delta: i };
},
{ viewportHeight: 0, delta: 0 }
)
),
(t) => {
t.delta && e.pub(Q, t.delta);
}
);
},
(e, t) => !e || e.atBottom !== (t == null ? void 0 : t.atBottom) ? !1 : !e.atBottom && !t.atBottom ? e.notAtBottomBecause === t.notAtBottomBecause : !0
), Pn = c(0, (e) => {
e.link(
e.pipe(
e.combine(w, V, q),
se(
(t, [n, o, i]) => {
if (!Bn(t.scrollHeight, o)) {
const s = o - (n + i) < 1;
return t.scrollTop !== n && s ? {
scrollHeight: o,
scrollTop: n,
jump: t.scrollTop - n,
changed: !0
} : {
scrollHeight: o,
scrollTop: n,
jump: 0,
changed: !0
};
}
return {
scrollTop: n,
scrollHeight: o,
jump: 0,
changed: !1
};
},
{ scrollHeight: 0, jump: 0, scrollTop: 0, changed: !1 }
),
v((t) => t.changed),
d((t) => t.jump)
),
Pn
);
}), wt = c(Pt, (e) => {
e.link(
e.pipe(
w,
se(
(t, n) => {
if (n < 0)
return { direction: Kt, prevScrollTop: 0 };
if (e.getValue(qt))
return { direction: t.direction, prevScrollTop: n };
const i = n === t.prevScrollTop && n === 0;
return {
direction: n < t.prevScrollTop || i ? Kt : Pt,
prevScrollTop: n
};
},
{ direction: Pt, prevScrollTop: 0 }
),
d((t) => t.direction)
),
wt
), e.link(e.pipe(w, Ee(100), P(Go)), wt);
}), vn = c(0, (e) => {
e.link(e.pipe(et, v(qo), P(0)), vn), e.link(
e.pipe(
w,
nn(100),
k(et),
v(([, t]) => !!t),
se(([, t], [n]) => [t, n], [0, 0]),
d(([t, n]) => n - t)
),
vn
);
});
function rn(e, t) {
if (typeof e == "number")
return {
index: e,
offset: 0,
behavior: "auto",
align: "start-no-overflow"
};
const n = {
index: Number.NaN,
align: e.align ?? "start-no-overflow",
behavior: e.behavior ?? "auto",
offset: e.offset ?? 0
};
return e.index === "LAST" ? n.index = t : e.index < 0 ? n.index = t + e.index : n.index = e.index, n;
}
function Wn({
location: e,
sizeTree: t,
offsetTree: n,
totalHeight: o,
totalCount: i,
viewportHeight: s,
headerHeight: l,
stickyHeaderHeight: r,
stickyFooterHeight: a
}) {
const { align: u, behavior: p, offset: g, index: I } = rn(e, i - 1);
function b() {
const L = fe(t, I)[1];
if (L === void 0)
throw new Error(`Item at index ${I} not found`);
return L;
}
s -= r + a;
let h = Qe(I, n) + l - r;
u === "end" ? h = h - s + b() : u === "center" && (h = h - s / 2 + b() / 2), g && (h += g);
let m = 0;
return u === "start" && (m = Math.max(0, Math.min(h - (o - s)))), h = Math.max(0, h), { top: h, behavior: p, align: u, forceBottomSpace: m };
}
const Ue = c(null), ti = c(!1), Ze = c(!0), Ut = E((e) => {
e.link(
e.pipe(
Ut,
d(() => !0)
),
Ze
), e.link(
e.pipe(
Ut,
d(() => null)
),
Ue
);
}), zn = E((e) => {
e.link(
e.pipe(
zn,
k(Ae, ge, ct),
d(([t, n, o, i]) => {
let { align: s, behavior: l, offset: r, index: a } = rn(t, n - 1);
const u = typeof t != "number" ? t.done : void 0, [p, g] = Nn(a, o);
return p < -i.listOffset ? ((typeof t == "number" || t.align === void 0) && (s = "start-no-overflow"), { index: a, align: s, behavior: l, offset: r, done: u }) : p + g > -i.listOffset + i.visibleListHeight ? ((typeof t == "number" || t.align === void 0) && (s = "end"), { index: a, align: s, behavior: l, offset: r, done: u }) : null;
}),
v((t) => t !== null)
),
// @ts-expect-error contra variance
J
);
}), J = E((e) => {
const t = e.pipe(
J,
k(
ee,
ge,
Ae,
q,
ut,
Ye,
rt,
ze
),
d(
([n, o, i, s, l, r, a, u, p]) => {
try {
return Wn({
location: n,
totalHeight: p,
sizeTree: o,
offsetTree: i,
totalCount: s,
viewportHeight: l,
headerHeight: r,
stickyHeaderHeight: a,
stickyFooterHeight: u
});
} catch {
return null;
}
}
),
v((n) => n !== null)
);
e.link(J, Ue), e.link(t, Le), e.link(
e.pipe(
J,
v((n) => typeof n != "number" && n.index === "LAST"),
P(!0)
),
xe
), e.link(e.pipe(t, P(!1)), Ze), e.link(e.pipe(t, P(!1)), ti), e.link(
e.pipe(
ee,
// wait for the list to render with the specified sizeTree, so that enough space is available to scroll by
Ee(0),
k(Ze, Ue),
v(([, n, o]) => !n && o !== null),
d(([, , n]) => n)
),
J
), e.sub(e.pipe(st, Ee(10)), () => {
const n = e.getValue(Ue);
n !== null && typeof n != "number" && n.done !== void 0 && n.done(), e.pubIn({
[Ue]: null,
[Ze]: !0
});
}), e.link(
e.pipe(
Et,
// wait for the list to render with the specified scrollOffset, so that enough space is available to scroll by
Xe(),
v((n) => n !== 0)
),
Q
), e.link(
e.pipe(
Et,
xn(w),
d(() => 0)
),
Et
);
}), Te = c(null), _e = c(
null,
(e) => {
e.link(
e.pipe(
_e,
v((n) => n !== null)
),
Te
);
const t = e.pipe(
e.combine(_e, ee),
k(Te),
v(([[n, o], i]) => n !== null && !T(o) && i !== null),
d(([[n]]) => n)
);
e.link(e.pipe(t, Xe()), J), e.link(
e.pipe(
t,
xn(
e.pipe(
Ze,
v((n) => n)
)
),
P(null)
// unset the location after the scroll completes
),
Te
);
},
!1
);
function ni(e, t) {
var l, r;
const n = t.slice();
let o = 0;
const i = [];
for (const { k: a, v: u } of he(e)) {
for (; n.length && n[0] < a; )
n.shift(), o++;
const p = Math.max(0, a - o), g = ((l = i.at(-1)) == null ? void 0 : l.k) ?? -1;
p === g ? (((r = i.at(-2)) == null ? void 0 : r.v) ?? -1) === u ? i.pop() : i[i.length - 1].v = u : i.push({ k: p, v: u });
}
let s = Me();
for (const { k: a, v: u } of i)
s = _(s, a, u);
return s;
}
const Ae = c(0), Pe = c(null), S = c(null, (e) => {
e.link(
e.pipe(
S,
v((t) => t !== null),
d((t) => t.length)
),
Ae
);
}), qe = c(null), ie = E((e) => {
e.link(
e.pipe(
ie,
k($e),
d(([n, o]) => -(o * n.length))
),
Y
), e.link(e.pipe(ie, P(!0)), Je), e.link(e.pipe(ie, Xe()), qe);
function t(n, o) {
e.pubIn({
[kt]: !0,
[Q]: n,
[yt]: n
}), o ? requestAnimationFrame(() => {
e.pubIn({
[Y]: 0,
[yt]: 0,
[qe]: null,
[Je]: !1,
[kt]: !1
});
}) : e.pubIn({
[Y]: 0,
[yt]: 0,
[qe]: null,
[Je]: !1,
[kt]: !1
});
}
e.sub(
e.pipe(
ge,
k(qe),
v(([, n]) => n !== null),
d(([n, o]) => {
if (o === null)
throw new Error("Unexpected null items");
return Qe(o.length, n);
})
),
(n) => {
t(n, !1);
}
), e.sub(
e.pipe(
ie,
Mt(2),
k(ge, qe),
v(([, , n]) => n !== null),
d(([n, o]) => Qe(n.length, o))
),
(n) => {
t(n, !0);
}
), e.changeWith(S, ie, (n, o) => n ? [...o, ...n] : o.slice()), e.link(
e.pipe(
ie,
k(ee, $e),
d(([n, o, i]) => {
const s = n.length, l = i;
return he(o).reduce(
(a, { k: u, v: p }) => ({
ranges: [...a.ranges, { startIndex: a.prevIndex, endIndex: u + s - 1, size: a.prevSize }],
prevIndex: u + s,
prevSize: p
}),
{
ranges: [],
prevIndex: 0,
prevSize: l
}
).ranges;
})
),
pe
);
}), it = E((e) => {
const t = e.pipe(
it,
k(ct, un, Pe, ee),
v(([, , , , o]) => !T(o)),
d(([{ data: o, scrollToBottom: i }, s, l, r]) => {
if (i === !1 || i === void 0)
return null;
let a = "auto";
const u = s.isAtBottom;
if (typeof i == "function") {
const p = i({ data: o, scrollLocation: s, scrollInProgress: l, context: r, atBottom: u });
if (!p)
return null;
if (typeof p == "object")
return p;
if (typeof p == "number")
return { index: p, align: "end", behavior: "auto" };
a = p;
} else {
if (!u)
return null;
a = i;
}
return a === !0 && (a = "auto"), { index: "LAST", align: "end", behavior: a };
})
);
e.link(
e.pipe(
t,
v((o) => o !== null),
d(() => !0)
),
xe
), e.link(
e.pipe(
st,
k(xe),
v(([o, i]) => i),
d(() => !1)
),
xe
);
const n = e.pipe(
pn,
k(xe),
v(([o, i]) => o === "up" && i)
);
e.link(
e.pipe(
n,
d(() => !1)
),
xe
), e.link(e.pipe(n, P(!0)), Ut), e.link(
e.pipe(
t,
v((o) => o !== null),
Ee(20)
),
J
);
}), Lt = E((e) => {
e.changeWith(S, Lt, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(Lt, it);
}), vt = E((e) => {
e.changeWith(S, vt, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(X, vt, ([t], n) => {
const i = fe(t, n.offset, "k")[0], s = n.data.length;
return [No(t, i, Number.POSITIVE_INFINITY, (r, a) => [r + s, a]), i];
}), e.link(vt, it);
}), Gt = E((e) => {
e.changeWith(S, Gt, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(X, Gt, ([t], { offset: n, count: o }) => [Bo(t, n, o), n]);
}), Wt = c(null), Be = E((e) => {
e.sub(
e.pipe(
Be,
k(S),
v(([{ purgeItemSizes: t }, n]) => !!t || n === null || n.length === 0)
),
([t, n]) => {
n === null || n.length === 0 ? e.pubIn({
...t.initialLocation ? { [_e]: t.initialLocation } : {},
[S]: t.data.slice()
}) : e.pubIn({
...t.initialLocation ? { [_e]: t.initialLocation } : {},
[X]: ot,
[De]: Ne,
[Wt]: t.data.slice()
});
}
), e.sub(
e.pipe(
Qn,
k(Wt),
Mt(),
v(([, t]) => t !== null)
),
([, t]) => {
e.pubIn({
[S]: t,
[Wt]: null
});
}
), e.link(
e.pipe(
Be,
v(({ purgeItemSizes: t }) => !t),
k($e),
v(([, t]) => t > 0),
d(([{ data: t }, n]) => [
{
size: n,
startIndex: t.length,
endIndex: Number.POSITIVE_INFINITY
}
])
),
pe
), e.sub(
e.pipe(
Be,
v(({ purgeItemSizes: t }) => !t)
),
({ data: t, initialLocation: n, suppressItemMeasure: o }) => {
requestAnimationFrame(() => {
o || e.pub(Xn), requestAnimationFrame(() => {
n && e.pubIn({
[J]: n
});
});
}), e.pubIn({
[S]: t.slice()
});
}
);
}), St = E((e) => {
e.link(
e.pipe(
St,
k(ge),
d(([t, n]) => -Qe(t, n))
),
Q
), e.changeWith(S, e.pipe(St, Xe()), (t, n) => t ? t.slice(n) : []), e.changeWith(X, e.pipe(St, Xe()), ([t], n) => [he(t).reduce((i, { k: s, v: l }) => _(i, Math.max(0, s - n), l), Me()), 0]);
}), Sn = E((e) => {
e.changeWith(S, Sn, (t, n) => t ? t.slice(0, t.length - n) : []), e.link(
e.pipe(
Sn,
k(Ae, $e),
d(([, t, n]) => [
{
size: n,
startIndex: t,
endIndex: Number.POSITIVE_INFINITY
}
])
),
pe
);
}), Yn = E((e) => {
const t = e.pipe(
Yn,
k(S),
d(([n, o]) => {
if (!o) return [];
const i = [];
return o.forEach((s, l) => {
n(s, l) && i.push(l);
}), i;
})
);
e.changeWith(S, t, (n, o) => n ? n.filter((i, s) => !o.includes(s)) : []), e.changeWith(X, t, ([n], o) => [ni(n, o), 0]);
}), Zt = E((e) => {
e.changeWith(S, Zt, (t, { mapper: n }) => t ? t.map(n) : []), e.link(
e.pipe(
Zt,
Mt(3),
k(ln),
v(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t),
d(([{ autoscrollToBottomBehavior: t }]) => typeof t == "object" ? t.location() : { index: "LAST", align: "end", behavior: t }),
v((t) => !!t)
),
J
);
}), Jt = E((e) => {
e.changeWith(S, Jt, (t, { newData: n }) => n), e.link(
e.pipe(
Jt,
Mt(3),
k(ln),
v(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t),
d(([{ autoscrollToBottomBehavior: t }]) => typeof t == "object" ? t.location() : { index: "LAST", align: "end", behavior: t }),
v((t) => !!t)
),
J
);
});
function oi(e, t) {
return [
{
data: t == null ? void 0 : t[e],
prevData: (t == null ? void 0 : t[e - 1]) ?? null,
nextData: (t == null ? void 0 : t[e + 1]) ?? null,
height: 0,
index: e,
offset: 0,
type: "flat"
}
];
}
const ii = [], Ne = {
items: ii,
listBottom: 0,
listTop: 0,
offsetTree: [],
paddingBottom: 0,
paddingTop: 0,
totalCount: 0,
totalHeight: 0,
deviationDelta: 0,
visibleListHeight: 0,
data: null
}, kt = c(!1), De = c(Ne, (e) => {
e.link(
e.pipe(
e.combine(
si,
Gn,
ee,
ge,
Ae,
ze,
S,
Et,
_e,
Te,
lt,
Ye,
rt,
Y,
kt,
ye,
Z
),
v((t) => {
const n = t.at(-1), o = t.at(-2), i = t.at(-3);
return !o && !n && !i;
}),
se(
(t, [
n,
o,
i,
s,
l,
r,
a,
u,
p,
g,
I,
b,
h,
m
]) => {
var Ie;
if ((a == null ? void 0 : a.length) === 0)
return Ne;
if (T(i)) {
let ne = 0;
return p !== null && (ne = rn(p, l - 1).index), { ...Ne, items: oi(ne, a), offsetTree: s, totalCount: l, data: a };
}
let L = 0;
g !== null && n === 0 && (L = Wn({
totalHeight: r,
location: g,
sizeTree: i,
offsetTree: s,
totalCount: l,
viewportHeight: e.getValue(q),
headerHeight: e.getValue(ut),
stickyHeaderHeight: b,
stickyFooterHeight: h
}).top ?? 0);
let U = 0;
e.getValue(w) !== 0 && !e.getValue(At) && e.getValue(wt) === Kt && t.totalCount === l && t.items.length > 0 && (U = r - t.totalHeight, U !== 0 && (U += e.getValue(Pn)));
const G = e.getValue(Kn), j = Math.min(
Math.max(
n + L + u - m - I + U - G,
0
),
r - o
), me = j + o + G * 2;
if (t.offsetTree === s && t.totalCount === l && t.data === a && j >= t.listTop && me <= t.listBottom)
return t;
const te = [], je = l - 1, be = 0, W = Wo(s, j, me, be);
let H = 0, M = 0, K = !1;
for (const ne of W) {
const {
value: { offset: ve, height: Se }
} = ne;
let oe = ne.start;
H = ve, ve < j && (oe += Math.floor((j - ve) / Se), H += (oe - ne.start) * Se), oe < be && (H += (be - oe) * Se, oe = be);
const Nt = Math.min(ne.end, je);
for (let re = oe; re <= Nt && !(H >= me); re++) {
const at = {
data: a == null ? void 0 : a[re],
prevData: (a == null ? void 0 : a[re - 1]) ?? null,
nextData: (a == null ? void 0 : a[re + 1]) ?? null,
height: Se,
index: re,
offset: H,
type: "flat"
};
K || (K = !0, M = H), te.push(at), H += Se;
}
}
te.length === 0 && (M = H = 0);
const R = r - H, le = ((Ie = te[0]) == null ? void 0 : Ie.offset) || 0;
return {
items: te,
listBottom: H,
listTop: M,
offsetTree: s,
paddingBottom: R,
paddingTop: le,
totalCount: l,
totalHeight: r,
data: a,
deviationDelta: U,
visibleListHeight: o
};
},
Ne
)
),
De
);
}), Rt = Ce([], (e) => e.pipe(
e.combine(De, w),
d(([t, n]) => {
const o = t.items.slice();
for (; o.length > 0 && o[0].offset + o[0].height < n; )
o.shift();
return o.map((i) => i.data);
})
)), Z = c(!1), Je = c(!1), xt = E((e) => {
e.link(
e.pipe(
De,
d((t) => t.deviationDelta),
v((t) => t !== 0)
),
xt
), Fn() ? (e.sub(e.pipe(xt, k(Y, w)), ([t, n]) => {
e.pub(Y, n - t);
}), e.sub(
e.pipe(e.combine(w, Y, ye, Je)),
([t, n, o, i]) => {
o || i || (n > 0 && t < n ? (e.pub(Z, !0), e.pub(Le, { top: 0, behavior: "instant" }), setTimeout(() => {
e.pubIn({
[Z]: !1,
[Y]: 0
});
})) : n < 0 && t <= 0 && (e.pubIn({
[Z]: !0,
[Y]: 0
}), setTimeout(() => {
e.pub(Le, { top: 0, behavior: "instant" }), e.pub(Z, !1);
})));
}
), e.sub(
e.pipe(
e.combine(et, Y, Z, ye, Je),
v(
([t, n, o, i, s]) => !t && n !== 0 && !o && !i && !s
),
nn(100)
),
([, t]) => {
e.pub(Z, !0), t < 0 ? requestAnimationFrame(() => {
e.pub(Q, -t), e.pub(Y, 0), requestAnimationFrame(() => {
e.pub(Z, !1);
});
}) : requestAnimationFrame(() => {
e.pub(Q, -t), e.pub(Y, 0), requestAnimationFrame(() => {
e.pub(Z, !1);
});
});
}
)) : e.link(xt, Q);
}), At = E(), un = c(!1), st = E((e) => {
e.link(e.pipe(st, P(!1)), At);
}, !1), w = c(0), q = c(0), Tt = c(0), V = c(0), si = w, Et = c(0), Ye = c(0), lt = c(0), rt = c(0), cn = c(0), we = c(null), jn = on(), Kn = c(0), qn = c(!1), li = Uo, ri = 50, ut = Ce(0, (e) => e.pipe(
e.combine(Ye, lt),
d(([t, n]) => t + n)
)), Un = Ce(0, (e) => e.pipe(
e.combine(rt, cn),
d(([t, n]) => t + n)
)), ui = Ce(0, (e) => e.pipe(
e.combine(Ye, lt, w),
d(([t, n, o]) => t + Math.max(n - o, 0))
)), ci = Ce(0, (e) => e.pipe(
e.combine(rt, cn, w, q, V),
d(([t, n, o, i, s]) => {
o = Math.min(o, s - i);
const l = Math.max(n - (s - (o + i)), 0);
return t + l;
})
)), Gn = Ce(0, (e) => e.pipe(
e.combine(q, ui, ci),
d(([t, n, o]) => Math.max(0, t - n - o))
)), Dt = c(0), Zn = c(0, (e) => {
e.link(
e.pipe(
e.combine(Zn, ze, q, ut, Ye),
d(([t, n, o, i, s]) => t === 0 ? 0 : Math.max(0, Math.min(t - (n + i + s - o))))
),
Dt
);
}), Le = E((e) => {
e.link(
e.pipe(
Le,
d((t) => t.align === "start" ? t.top ?? 0 : 0)
),
Zn
), e.link(
e.pipe(
Le,
k(w),
v(([t, n]) => t.top !== n),
P(!0)
),
At
);
}), an = E((e) => {
e.link(
e.pipe(
Le,
k(nt),
d(([t, n]) => ("top" in t && typeof t.top < "u" && (t = { ...t, top: t.top + n }), t))
),
an
);
}), ct = Ce(
{
listOffset: 0,
visibleListHeight: 0,
scrollHeight: 0,
bottomOffset: 0,
isAtBottom: !1
},
(e) => e.pipe(
e.combine(
w,
ut,
Un,
lt,
Gn,
V,
Dt,
ye,
Te,
Z,
xe
),
v(([, , , , , , , t, n, o]) => !t && n === null && !o),
d(
([
t,
n,
o,
i,
s,
l,
r,
a,
u,
p,
g
]) => {
const I = e.getValue(_n), b = l - n - o, h = -t + i, m = b + Math.min(0, h) - s - r;
return {
scrollHeight: b,
listOffset: h,
visibleListHeight: s,
bottomOffset: m,
isAtBottom: g || m <= I
};
}
)
)
), Xt = E((e) => {
e.link(
e.pipe(
w,
Ee(0),
k(ct, Te, ye),
v(([, t, n, o]) => t.scrollHeight > 0 && n == null && !o),
d(([, t]) => t)
),
Xt
);
}), Q = E(), Y = c(0), yt = c(0), Ct = c(0), Jn = c(""), pn = E(), Xn = on(), Qn = on(), fn = c(!1), tt = c(null);
c(0);
const nt = c(0, (e) => {
e.link(
e.pipe(
e.combine(We, de, nt),
d(([t, n, o]) => t - Math.max(0, o - n))
),
q
);
}), de = c(0, (e) => {
e.link(
e.pipe(
e.combine(de, nt),
d(([t, n]) => Math.max(0, t - n))
),
w
);
}), We = c(0);
function eo(e) {
return {
data: {
prepend: (t) => {
e.pub(ie, t);
},
append: (t, n) => {
e.pub(Lt, {
data: t,
scrollToBottom: n
});
},
replace: (t, n) => {
e.pub(Be, {
...n,
data: t
});
},
map: (t, n) => {
e.pub(Zt, {
mapper: t,
autoscrollToBottomBehavior: n
});
},
findAndDelete: (t) => {
e.pub(Yn, t);
},
findIndex: (t) => e.getValue(S).findIndex(t),
find: (t) => e.getValue(S).find(t),
insert: (t, n, o) => {
e.pub(vt, {
data: t,
offset: n,
scrollToBottom: o
});
},
deleteRange: (t, n) => {
e.pub(Gt, {
offset: t,
count: n
});
},
batch: (t, n) => {
e.pub(ye, !0), t(), e.pub(ye, !1), e.pub(it, { data: [], scrollToBottom: n });
},
get: () => e.getValue(S).slice(),
getCurrentlyRendered: () => e.getValue(Rt),
removeFromStart: (t) => {
e.pub(St, t);
}
},
scrollToItem: (t) => {
e.pub(J, t);
},
scrollIntoView: (t) => {
e.pub(zn, t);
},
scrollerElement: () => e.getValue(we),
getScrollLocation() {
return e.getValue(ct);
},
cancelSmoothScroll() {
e.pub(jn);
},
height: (t) => {
var i;
const n = ((i = e.getValue(S)) == null ? void 0 : i.indexOf(t)) ?? -1;
if (n === -1)
return 0;
const o = e.getValue(ee);
return fe(o, n)[1] ?? 0;
}
};
}
function zi() {
return C(ct);
}
function Yi() {
return C(Rt);
}
function ji() {
const e = Re();
return f.useMemo(() => eo(e), [e]);
}
const Ki = {
prepend: "prepend",
removeFromStart: "remove-from-start",
removeFromEnd: "remove-from-end"
}, to = c(null), no = c(null), oo = c(null), io = c(null), so = c(null), lo = c("div"), ai = {
position: "sticky",
top: 0,
zIndex: 1
}, dt = {
overflowAnchor: "none"
}, pi = {
position: "sticky",
bottom: 0
}, ro = f.forwardRef((e, t) => /* @__PURE__ */ y("div", { style: { zIndex: 1 }, ...e, ref: t })), uo = f.forwardRef((e, t) => /* @__PURE__ */ y("div", { ...e, ref: t })), co = f.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...ai, ...e }, ref: n })
), ao = f.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...pi, ...e }, ref: n })
), po = c(ro), fo = c(co), ho = c(uo), go = c(ao), mo = ({ index: e }) => /* @__PURE__ */ En("div", { children: [
"Item ",
e
] }), bo = ({ index: e }) => e, Qt = c(mo), Io = c(bo), en = (e) => e, vo = c(en), So = c(
null,
(e) => {
e.sub(
e.pipe(So, k(S, vo, ge, X)),
([t, n, o, i, s]) => {
if (t === void 0)
return;
if (!t || !t.data || !t.data.length) {
e.pubIn({
[S]: [],
[X]: ot,
[De]: Ne
});
return;
}
const l = t.data, r = t.scrollModifier;
if (r === "prepend") {
if (n === null || !n.length) {
e.pub(S, l);
return;
}
const a = n[0], u = l.findIndex((I) => o(I) === o(a)), p = u === -1 ? l : l.slice(0, u), g = u === -1 ? [] : l.slice(u);
e.pubIn({
[S]: g
}), e.pubIn({
[ie]: p
});
return;
}
if (r === "remove-from-start") {
const a = l[0], u = (n == null ? void 0 : n.findIndex((g) => o(g) === o(a))) ?? -1;
if (u === -1) {
e.pub(S, l);
return;
}
const p = Qe(u, i);
e.pub(Q, -p), queueMicrotask(() => {
e.pub(S, l);
const g = he(s[0]).reduce((I, { k: b, v: h }) => _(I, Math.max(0, b - u), h), Me());
e.pub(X, [g, 0]);
});
return;
}
if (r === "remove-from-end") {
e.pub(S, l), e.pub(pe, [
{
size: e.getValue($e),
startIndex: l.length,
endIndex: Number.POSITIVE_INFINITY
}
]);
return;
}
if ((r == null ? void 0 : r.type) === "item-location") {
l !== n && e.pubIn({
[Be]: {
data: l,
initialLocation: r.location,
purgeItemSizes: r.purgeItemSizes
}
});
return;
}
if ((r == null ? void 0 : r.type) === "auto-scroll-to-bottom") {
e.pubIn({
[S]: l,
[it]: {
data: l,
scrollToBottom: r.autoScroll
}
});
return;
}
if ((r == null ? void 0 : r.type) === "items-change") {
e.pub(Jt, {
newData: l,
autoscrollToBottomBehavior: r.behavior
});
return;
}
e.pub(S, l);
}
);
},
(e, t) => e ? e.data === (t == null ? void 0 : t.data) : !1
), fi = ({ item: e, ItemContent: t, mount: n, unmount: o }) => {
const i = C(Pe), s = f.useRef(null), l = f.useCallback(
(r) => {
r ? (s.current = r, n(r)) : s.current && (o(s.current), s.current = null);
},
[n, o]
);
return /* @__PURE__ */ y(
"div",
{
ref: l,
"data-index": e.index,
"data-known-size": e.height,
style: {
overflowAnchor: "none",
position: "absolute",
width: "100%",
top: e.offset
},
children: /* @__PURE__ */ y(t, { index: e.index, prevData: e.prevData, nextData: e.nextData, data: e.data, context: i })
}
);
}, hi = f.memo(fi, (e, t) => {
const n = e.item, o = t.item;
return n.index === o.index && n.height === o.height && n.offset === o.offset && n.data === o.data && n.prevData === o.prevData && n.nextData === o.nextData && e.ItemContent === t.ItemContent;
}), tn = c("top", (e) => {
e.link(
e.pipe(
e.combine(tn, ze, q, ut, Un),
v(([t]) => t === "bottom" || t === "bottom-smooth"),
d(([, t, n, o, i]) => Math.max(0, n - t - o - i))
),
Ct
), e.link(
e.pipe(
e.combine(Ct, tn),
v(([, t]) => t === "bottom-smooth"),
se(
(t, [n]) => [t[1], n],
[0, 0]
),
d(([t, n]) => t > 0 && n > 0 ? "margin-top 0.2s ease-out" : "")
),
Jn
);
});
function mt(e) {
const t = f.useRef(null);
return [f.useCallback(
(o) => {
o ? (t.current = o, e == null || e.observe(o, { box: "border-box" })) : t.current && (e == null || e.unobserve(t.current), t.current = null);
},
[e]
), t];
}
function gi(e, t) {
return Math.abs(e - t) < 0.5;
}
function di(e, t, n) {
const o = Re(), i = f.useRef(null), s = f.useRef(null), l = f.useCallback(() => {
i.current && (cancelAnimationFrame(i.current), i.current = null, s.current = null);
}, []);
f.useEffect(() => o.sub(pn, (u) => {
u !== s.current && l();
}), [o, l]), f.useEffect(() => o.sub(jn, l), [o, l]);
const r = f.useCallback(
(u, p, g) => {
var L;
i.current && l();
const I = ((L = e.current) == null ? void 0 : L.scrollTop) ?? 0;
s.current = I < u ? "down" : "up";
let b = 0, h = 0;
function m() {
var G, j;
const U = I + (u - I) * p(b);
(G = e.current) == null || G.scrollTo({ top: U, behavior: "instant" }), b += 1 / g, h += 1, h < g ? i.current = requestAnimationFrame(m) : ((j = e.current) == null || j.scrollTo({ top: u, behavior: "instant" }), i.current = null, s.current = null);
}
m();
},
[e, l]
);
return f.useCallback(
(u) => {
var g, I;
const p = e.current;
if (!(!p || u.top === void 0)) {
if (gi(u.top, p.scrollTop) || p.scrollHeight <= p.clientHeight) {
requestAnimationFrame(() => {
var b;
o.pub(st, (b = e.current) == null ? void 0 : b.scrollTop);
});
return;
}
if (n.current = u.top, o.pub(un, !0), u.forceBottomSpace !== void 0 && t.current && (t.current.style.paddingBottom = `${u.forceBottomSpace}px`), u.behavior === "smooth")
r(u.top ?? 0, li, ri);
else if (u.behavior === "auto" || u.behavior === "instant" || u.behavior === void 0)
l(), (g = e.current) == null || g.scrollTo(u);
else {
const { easing: b, animationFrameCount: h } = u.behavior(((I = e.current) == null ? void 0 : I.scrollTop) ?? 0, u.top ?? 0);
r(u.top ?? 0, b, h);
}
}
},
[o, r, t, e, n, l]
);
}
function mi(e) {
return bi(vi(Si(Ii(e), 8 * e.length))).toLowerCase();
}
function bi(e) {
for (var t, n = "0123456789ABCDEF", o = "", i = 0; i < e.length; i++)
t = e.charCodeAt(i), o += n.charAt(t >>> 4 & 15) + n.charAt(15 & t);
return o;
}
function Ii(e) {
for (var t = Array(e.length >> 2), n = 0; n < t.length; n++) t[n] = 0;
for (n = 0; n < 8 * e.length; n += 8) t[n >> 5] |= (255 & e.charCodeAt(n / 8)) << n % 32;
return t;
}
function vi(e) {
for (var t = "", n = 0; n < 32 * e.length; n += 8) t += String.fromCharCode(e[n >> 5] >>> n % 32 & 255);
return t;
}
function Si(e, t) {
e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t;
for (var n = 1732584193, o = -271733879, i = -1732584194, s = 271733878, l = 0; l < e.length; l += 16) {
const r = n, a = o, u = i, p = s;
o = F(
o = F(
o = F(
o = F(
o = B(
o = B(
o = B(
o = B(
o = N(
o = N(
o = N(
o = N(
o = O(
o = O(
o = O(
o = O(
o,
i = O(
i,
s = O(s, n = O(n, o, i, s, e[l + 0], 7, -680876936), o, i, e[l + 1], 12, -389564586),
n,
o,
e[l + 2],
17,
606105819
),
s,
n,
e[l + 3],
22,
-1044525330
),
i = O(
i,
s = O(s, n = O(n, o, i, s, e[l + 4], 7, -176418897), o, i, e[l + 5], 12, 1200080426),
n,
o,
e[l + 6],
17,
-1473231341
),
s,
n,
e[l + 7],
22,
-45705983
),
i = O(
i,
s = O(s, n = O(n, o, i, s, e[l + 8], 7, 1770035416), o, i, e[l + 9], 12, -1958414417),
n,
o,
e[l + 10],
17,
-42063
),
s,
n,
e[l + 11],
22,
-1990404162
),
i = O(
i,
s = O(s, n = O(n, o, i, s, e[l + 12], 7, 1804603682), o, i, e[l + 13], 12, -40341101),
n,
o,
e[l + 14],
17,
-1502002290
),
s,
n,
e[l + 15],
22,
1236535329
),
i = N(
i,
s = N(s, n = N(n, o, i, s, e[l + 1], 5, -165796510), o, i, e[l + 6], 9, -1069501632),
n,
o,
e[l + 11],
14,
643717713
),
s,
n,
e[l + 0],
20,
-373897302
),
i = N(
i,
s = N(s, n = N(n, o, i, s, e[l + 5], 5, -701558691), o, i, e[l + 10], 9, 38016083),
n,
o,
e[l + 15],
14,
-660478335
),
s,
n,
e[l + 4],
20,
-405537848
),
i = N(
i,
s = N(s, n = N(n, o, i, s, e[l + 9], 5, 568446438), o, i, e[l + 14], 9, -1019803690),
n,
o,
e[l + 3],
14,
-187363961
),
s,
n,
e[l + 8],
20,
1163531501
),
i = N(
i,
s = N(s, n = N(n, o, i, s, e[l + 13], 5, -1444681467), o, i, e[l + 2], 9, -51403784),
n,
o,
e[l + 7],
14,
1735328473
),
s,
n,
e[l + 12],
20,
-1926607734
),
i = B(
i,
s = B(s, n = B(n, o, i, s, e[l + 5], 4, -378558), o, i, e[l + 8], 11, -2022574463),
n,
o,
e[l + 11],
16,
1839030562
),
s,
n,
e[l + 14],
23,
-35309556
),
i = B(
i,
s = B(s, n = B(n, o, i, s, e[l + 1], 4, -1530992060), o, i, e[l + 4], 11, 1272893353),
n,
o,
e[l + 7],
16,
-155497632
),
s,
n,
e[l + 10],
23,
-1094730640
),
i = B(
i,
s = B(s, n = B(n, o, i, s, e[l + 13], 4, 681279174), o, i, e[l + 0], 11, -358537222),
n,
o,
e[l + 3],
16,
-722521979
),
s,
n,
e[l + 6],
23,
76029189
),
i = B(
i,
s = B(s, n = B(n, o, i, s, e[l + 9], 4, -640364487), o, i, e[l + 12], 11, -421815835),
n,
o,
e[l + 15],
16,
530742520
),
s,
n,
e[l + 2],
23,
-995338651
),
i = F(
i,
s = F(s, n = F(n, o, i, s, e[l + 0], 6, -198630844), o, i, e[l + 7], 10, 1126891415),
n,
o,
e[l + 14],
15,
-1416354905
),
s,
n,
e[l + 5],
21,
-57434055
),
i = F(
i,
s = F(s, n = F(n, o, i, s, e[l + 12], 6, 1700485571), o, i, e[l + 3], 10, -1894986606),
n,
o,
e[l + 10],
15,
-1051523
),
s,
n,
e[l + 1],
21,
-2054922799
),
i = F(
i,
s = F(s, n = F(n, o, i, s, e[l + 8], 6, 1873313359), o, i, e[l + 15], 10, -30611744),
n,
o,
e[l + 6],
15,
-1560198380
),
s,
n,
e[l + 13],
21,
1309151649
),
i = F(
i,
s = F(s, n = F(n, o, i, s, e[l + 4], 6, -145523070), o, i, e[l + 11], 10, -1120210379),
n,
o,
e[l + 2],
15,
718787259
),
s,
n,
e[l + 9],
21,
-343