New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@virtuoso.dev/message-list

Package Overview
Dependencies
Maintainers
2
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@virtuoso.dev/message-list - npm Package Compare versions

Comparing version 1.8.0-alpha.17 to 1.8.0-alpha.18

8

CHANGELOG.md

@@ -0,1 +1,9 @@

# [1.8.0-alpha.18](https://github.com/virtuoso-dev/message-list/compare/v1.8.0-alpha.17...v1.8.0-alpha.18) (2024-06-17)
### Bug Fixes
* avoid extra cancellation of scroll ([bcd478b](https://github.com/virtuoso-dev/message-list/commit/bcd478b4f34e5c672b6061a7c0e27598afa2eecf))
* improve catchup ([bfd1675](https://github.com/virtuoso-dev/message-list/commit/bfd1675be3aa72f4f6ceede7fd0ea959510deed6))
# [1.8.0-alpha.17](https://github.com/virtuoso-dev/message-list/compare/v1.8.0-alpha.16...v1.8.0-alpha.17) (2024-06-17)

@@ -2,0 +10,0 @@

1146

dist/index.js

@@ -1,4 +0,4 @@

import { jsxs as Nt, jsx as y, Fragment as Gn } from "react/jsx-runtime";
import { jsxs as Pt, jsx as y, Fragment as Gn } from "react/jsx-runtime";
import g from "react";
import { Cell as c, Signal as I, map as a, withLatestFrom as T, filter as v, mapTo as O, debounceTime as ge, throttleTime as ve, delayWithMicrotask as Dt, onNext as Qe, scan as U, useCellValue as V, useRealm as zt, Realm as Zn, RealmContext as Jn, useCellValues as Xn } from "@mdxeditor/gurx";
import { Cell as c, Signal as S, throttleTime as Re, map as a, mapTo as C, debounceTime as re, filter as v, scan as q, withLatestFrom as I, delayWithMicrotask as Mt, onNext as Nt, useCellValue as B, useRealm as zt, Realm as Zn, RealmContext as Jn, useCellValues as Xn } from "@mdxeditor/gurx";
function be(e, t) {

@@ -20,3 +20,3 @@ const n = c(e, (o) => {

}
function bt(e, t) {
function vt(e, t) {
if (b(e))

@@ -32,8 +32,8 @@ return xe;

const [i, l] = Kt(o);
return Ke($(e, { k: i, l: jt(o), v: l }));
return je($(e, { k: i, l: jt(o), v: l }));
}
} else
return t < n ? Ke($(e, { l: bt(o, t) })) : Ke($(e, { r: bt(s, t) }));
return t < n ? je($(e, { l: vt(o, t) })) : je($(e, { r: vt(s, t) }));
}
function re(e, t, n = "k") {
function ce(e, t, n = "k") {
if (b(e))

@@ -44,11 +44,11 @@ return [-1 / 0, void 0];

if (e[n] < t) {
const o = re(e.r, t, n);
const o = ce(e.r, t, n);
return o[0] === -1 / 0 ? [e.k, e.v] : o;
}
return re(e.l, t, n);
return ce(e.l, t, n);
}
function C(e, t, n) {
return b(e) ? Yt(t, n, 1) : t === e.k ? $(e, { k: t, v: n }) : t < e.k ? Vt($(e, { l: C(e.l, t, n) })) : Vt($(e, { r: C(e.r, t, n) }));
function O(e, t, n) {
return b(e) ? Yt(t, n, 1) : t === e.k ? $(e, { k: t, v: n }) : t < e.k ? Ht($(e, { l: O(e.l, t, n) })) : Ht($(e, { r: O(e.r, t, n) }));
}
function mt(e, t, n) {
function bt(e, t, n) {
if (b(e))

@@ -58,3 +58,3 @@ return [];

let r = [];
return o > t && (r = r.concat(mt(i, t, n))), o >= t && o <= n && r.push({ k: o, v: s }), o <= n && (r = r.concat(mt(l, t, n))), r;
return o > t && (r = r.concat(bt(i, t, n))), o >= t && o <= n && r.push({ k: o, v: s }), o <= n && (r = r.concat(bt(l, t, n))), r;
}

@@ -65,4 +65,4 @@ function Qn(e, t, n, o) {

let s = me();
for (const { k: i, v: l } of de(e))
i > t && i <= n ? s = C(s, ...o(i, l)) : s = C(s, i, l);
for (const { k: i, v: l } of ve(e))
i > t && i <= n ? s = O(s, ...o(i, l)) : s = O(s, i, l);
return s;

@@ -73,7 +73,7 @@ }

for (const { start: i, end: l, value: r } of to(e))
i < t ? (o = C(o, i, r), s = r) : i > t + n ? o = C(o, i - n, r) : l >= t + n && s !== r && (o = C(o, t, r));
i < t ? (o = O(o, i, r), s = r) : i > t + n ? o = O(o, i - n, r) : l >= t + n && s !== r && (o = O(o, t, r));
return o;
}
function de(e) {
return b(e) ? [] : [...de(e.l), { k: e.k, v: e.v }, ...de(e.r)];
function ve(e) {
return b(e) ? [] : [...ve(e.l), { k: e.k, v: e.v }, ...ve(e.r)];
}

@@ -84,3 +84,3 @@ function Kt(e) {

function jt(e) {
return b(e.r) ? e.l : Ke($(e, { r: jt(e.r) }));
return b(e.r) ? e.l : je($(e, { r: jt(e.r) }));
}

@@ -90,9 +90,9 @@ function $(e, t) {

}
function dt(e) {
function gt(e) {
return b(e) || e.lvl > e.r.lvl;
}
function Vt(e) {
return kt(Zt(e));
function Ht(e) {
return mt(Zt(e));
}
function Ke(e) {
function je(e) {
const { l: t, r: n, lvl: o } = e;

@@ -102,3 +102,3 @@ if (n.lvl >= o - 1 && t.lvl >= o - 1)

if (o > n.lvl + 1) {
if (dt(t))
if (gt(t))
return Zt($(e, { lvl: o - 1 }));

@@ -116,6 +116,6 @@ if (!b(t) && !b(t.r))

} else {
if (dt(e))
return kt($(e, { lvl: o - 1 }));
if (gt(e))
return mt($(e, { lvl: o - 1 }));
if (!b(n) && !b(n.l)) {
const s = n.l, i = dt(s) ? n.lvl - 1 : n.lvl;
const s = n.l, i = gt(s) ? n.lvl - 1 : n.lvl;
return $(s, {

@@ -127,3 +127,3 @@ l: $(e, {

lvl: s.lvl + 1,
r: kt($(n, { l: s.r, lvl: i }))
r: mt($(n, { l: s.r, lvl: i }))
});

@@ -135,3 +135,3 @@ } else

function to(e) {
return Gt(de(e));
return Gt(ve(e));
}

@@ -141,4 +141,4 @@ function Ut(e, t, n) {

return [];
const o = re(e, t)[0];
return Gt(mt(e, o, n));
const o = ce(e, t)[0];
return Gt(bt(e, o, n));
}

@@ -160,3 +160,3 @@ function qt(e, t) {

}
function kt(e) {
function mt(e) {
const { r: t, lvl: n } = e;

@@ -178,3 +178,3 @@ return !b(t) && !b(t.r) && t.lvl === n && t.r.lvl === n ? $(t, { l: $(e, { r: t.l }), lvl: n + 1 }) : e;

if (n = Math.min(n, i), b(e)) {
e = C(e, 0, s);
e = O(e, 0, s);
continue;

@@ -187,8 +187,8 @@ }

for (const { start: p, end: m, value: k } of r)
u ? (l >= p || s === k) && (e = bt(e, p)) : (h = k !== s, u = !0), m > l && l >= p && k !== s && (e = C(e, l + 1, k));
h && (e = C(e, i, s));
u ? (l >= p || s === k) && (e = vt(e, p)) : (h = k !== s, u = !0), m > l && l >= p && k !== s && (e = O(e, l + 1, k));
h && (e = O(e, i, s));
}
return [e, n];
}
const st = [me(), 0];
const ot = [me(), 0];
function so(e, [t, n]) {

@@ -198,3 +198,3 @@ if (n.length > 0 && b(e) && t.length === 2) {

return [
n.reduce((i, l) => C(C(i, l, o), l + 1, s), me()),
n.reduce((i, l) => O(O(i, l, o), l + 1, s), me()),
0

@@ -205,3 +205,3 @@ ];

}
function et(e, t, n, o = 0) {
function Qe(e, t, n, o = 0) {
let s = e.length - 1;

@@ -225,6 +225,6 @@ for (; o <= s; ) {

function Jt(e, t, n) {
return e[et(e, t, n)];
return e[Qe(e, t, n)];
}
function io(e, t, n, o) {
const s = et(e, t, o), i = et(e, n, o, s);
const s = Qe(e, t, o), i = Qe(e, n, o, s);
return e.slice(s, i + 1);

@@ -248,5 +248,5 @@ }

if (n !== 0) {
l = et(e, n - 1, At), i = e[l].offset;
const u = re(t, n - 1);
o = u[0], s = u[1], e.length && e[l].height === re(t, n)[1] && (l -= 1), e = e.slice(0, l + 1);
l = Qe(e, n - 1, At), i = e[l].offset;
const u = ce(t, n - 1);
o = u[0], s = u[1], e.length && e[l].height === ce(t, n)[1] && (l -= 1), e = e.slice(0, l + 1);
} else

@@ -281,3 +281,168 @@ e = [];

}
function Ct(e, t) {
const nn = "up", dt = "down", fo = "none", ho = {
atBottom: !1,
notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",
state: {
offsetBottom: 0,
scrollTop: 0,
viewportHeight: 0,
viewportWidth: 0,
scrollHeight: 0
}
}, go = 0, vo = 4;
function Vt(e) {
return (t, n) => {
const o = n.signalInstance();
return n.sub(t, (s) => {
e > 0 ? e-- : n.pub(o, s);
}), o;
};
}
c(!1);
const on = c(!0);
S();
const de = c(!1), bo = S((e) => {
e.link(e.pipe(on, Re(50)), bo);
}), sn = c(vo), mo = c(go, (e) => {
e.link(
e.pipe(
e.combine(T, mo),
a(([t, n]) => t <= n)
),
on
);
}), Ce = c(!1, (e) => {
e.link(e.pipe(T, Vt(1), C(!0)), Ce), e.link(e.pipe(T, Vt(1), C(!1), re(100)), Ce);
}), kt = c(!1, (e) => {
e.link(e.pipe(oe, C(!0)), kt), e.link(e.pipe(oe, C(!1), re(200)), kt);
}), ln = c(!1), Ue = c(
null,
(e) => {
e.link(
e.pipe(
e.combine($e, T, J, gn, sn, ct, Z),
v(([, , , , , , t]) => !b(t)),
q((t, [n, o, s, i, l]) => {
const u = o + s - n > -l, h = {
viewportWidth: i,
viewportHeight: s,
scrollTop: o,
scrollHeight: n
};
if (u) {
let m, k;
return o > t.state.scrollTop ? (m = "SCROLLED_DOWN", k = t.state.scrollTop - o) : (m = n === s ? "LIST_TOO_SHORT" : "SIZE_DECREASED", k = t.state.scrollTop - o || t.scrollTopDelta), {
atBottom: !0,
state: h,
atBottomBecause: m,
scrollTopDelta: k
};
}
let p;
return s < t.state.viewportHeight ? p = "VIEWPORT_HEIGHT_DECREASING" : i < t.state.viewportWidth ? p = "VIEWPORT_WIDTH_DECREASING" : h.scrollHeight > t.state.scrollHeight ? p = "SIZE_INCREASED" : o < t.state.scrollTop ? p = "SCROLLING_UPWARDS" : p = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
atBottom: !1,
notAtBottomBecause: p,
state: h
};
}, ho)
),
Ue
), e.link(
e.pipe(
Ue,
Re(10),
// withLatestFrom(scrollToInProgress$),
// filter(([, inProgress]) => !inProgress),
q(
({ prev: t }, n) => {
const o = !!(t && n && t.atBottom && !n.atBottom && n.notAtBottomBecause === "SIZE_INCREASED");
return {
prev: n,
shouldScroll: o
};
},
{ prev: null, shouldScroll: !1 }
),
a(({ shouldScroll: t }) => t)
),
ln
), e.sub(
e.pipe(
J,
I(Ue),
q(
(t, [n, o]) => {
let s = 0;
return t.viewportHeight > n && o && !o.atBottom && o.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && (s = t.viewportHeight - n), { viewportHeight: n, delta: s };
},
{ viewportHeight: 0, delta: 0 }
)
),
(t) => {
t.delta && e.pub(oe, { top: t.delta });
}
);
},
(e, t) => e ? e.atBottom === (t == null ? void 0 : t.atBottom) : !1
), rn = c(0, (e) => {
e.link(
e.pipe(
e.combine(T, $e, J),
q(
(t, [n, o, s]) => {
if (Qt(t.scrollHeight, o))
return {
scrollTop: n,
scrollHeight: o,
jump: 0,
changed: !1
};
{
const i = o - (n + s) < 1;
return t.scrollTop !== n && i ? {
scrollHeight: o,
scrollTop: n,
jump: t.scrollTop - n,
changed: !0
} : {
scrollHeight: o,
scrollTop: n,
jump: 0,
changed: !0
};
}
},
{ scrollHeight: 0, jump: 0, scrollTop: 0, changed: !1 }
),
v((t) => t.changed),
a((t) => t.jump)
),
rn
);
}), et = c(dt, (e) => {
e.link(
e.pipe(
T,
q(
(t, n) => e.getValue(kt) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? nn : dt, prevScrollTop: n },
{ direction: dt, prevScrollTop: 0 }
),
a((t) => t.direction)
),
et
), e.link(e.pipe(T, re(100), C(fo)), et);
}), Bt = c(0, (e) => {
e.link(e.pipe(Ce, v(tn), C(0)), Bt), e.link(
e.pipe(
T,
Re(100),
I(Ce),
v(([, t]) => !!t),
q(([, t], [n]) => [t, n], [0, 0]),
a(([t, n]) => n - t)
),
Bt
);
});
function Dt(e, t) {
if (typeof e == "number")

@@ -298,3 +463,3 @@ return {

}
function nn({
function cn({
location: e,

@@ -310,16 +475,16 @@ sizeTree: t,

}) {
const { align: h, behavior: p, offset: m, index: k } = Ct(e, s - 1);
function _() {
const J = re(t, k)[1];
if (J === void 0)
const { align: h, behavior: p, offset: m, index: k } = Dt(e, s - 1);
function F() {
const X = ce(t, k)[1];
if (X === void 0)
throw new Error(`Item at index ${k} not found`);
return J;
return X;
}
i -= r + u;
let d = ao(k, n) + l - r;
h === "end" ? d = d - i + _() : h === "center" && (d = d - i / 2 + _() / 2), m && (d += m);
h === "end" ? d = d - i + F() : h === "center" && (d = d - i / 2 + F() / 2), m && (d += m);
let Y = 0;
return h === "start" && (Y = Math.max(0, Math.min(d - (o - i)))), d = Math.max(0, d), { top: d, behavior: p, align: h, forceBottomSpace: Y };
}
const Le = c(null), fo = c(!1), je = c(!0), tt = I((e) => {
const Me = c(null), ko = c(!1), qe = c(!0), tt = S((e) => {
e.link(

@@ -330,3 +495,3 @@ e.pipe(

),
je
qe
), e.link(

@@ -337,11 +502,11 @@ e.pipe(

),
Le
Me
);
}), on = I((e) => {
}), un = S((e) => {
e.link(
e.pipe(
on,
T(ke, rt, Fe),
un,
I(ke, lt, Pe),
a(([t, n, o, s]) => {
let { align: i, behavior: l, offset: r, index: u } = Ct(t, n - 1);
let { align: i, behavior: l, offset: r, index: u } = Dt(t, n - 1);
const h = typeof t != "number" ? t.done : void 0, [p, m] = Xt(u, o);

@@ -353,16 +518,16 @@ return p < -s.listOffset ? ((typeof t == "number" || t.align === void 0) && (i = "start-no-overflow"), { index: u, align: i, behavior: l, offset: r, done: h }) : p + m > -s.listOffset + s.visibleListHeight ? ((typeof t == "number" || t.align === void 0) && (i = "end"), { index: u, align: i, behavior: l, offset: r, done: h }) : null;

// @ts-expect-error contra variance
ne
U
);
}), ne = I((e) => {
}), U = S((e) => {
const t = e.pipe(
ne,
T(
G,
U,
I(
Z,
lt,
ke,
J,
rt,
ke,
Z,
ct,
Be,
_e,
Re
We,
Fe,
we
),

@@ -372,3 +537,3 @@ a(

try {
return nn({
return cn({
location: n,

@@ -391,16 +556,23 @@ totalHeight: p,

);
e.link(ne, Le), e.link(t, Ee), e.link(e.pipe(t, O(!1)), je), e.link(e.pipe(t, O(!1)), fo), e.link(
e.link(U, Me), e.link(t, Ee), e.link(
e.pipe(
G,
ge(0),
T(je, Le),
U,
v((n) => typeof n != "number" && n.index === "LAST"),
C(!0)
),
de
), e.link(e.pipe(t, C(!1)), qe), e.link(e.pipe(t, C(!1)), ko), e.link(
e.pipe(
Z,
re(0),
I(qe, Me),
v(([, n, o]) => !n && o !== null),
a(([, , n]) => n)
),
ne
), e.sub(e.pipe(Oe, ve(20)), () => {
const n = e.getValue(Le);
U
), e.sub(e.pipe(He, Re(20)), () => {
const n = e.getValue(Me);
n !== null && typeof n != "number" && n.done !== void 0 && n.done(), e.pubIn({
[Le]: null,
[je]: !0
[Me]: null,
[qe]: !0
});

@@ -411,3 +583,3 @@ }), e.link(

// wait for the list to render with the specified scrollOffset, so that enough space is available to scroll by
Dt(),
Mt(),
v((n) => n !== 0),

@@ -420,3 +592,3 @@ a((n) => ({ top: n }))

Xe,
Qe(x),
Nt(T),
a(() => 0)

@@ -426,3 +598,3 @@ ),

);
}), Me = c(null), nt = c(null, (e) => {
}), Ae = c(null), nt = c(null, (e) => {
e.link(

@@ -433,27 +605,27 @@ e.pipe(

),
Me
Ae
);
const t = e.pipe(
e.combine(nt, G),
T(Me),
e.combine(nt, Z),
I(Ae),
v(([[n, o], s]) => n !== null && !b(o) && s !== null),
ge(10),
re(10),
a(([[n]]) => n)
);
e.link(e.pipe(t, Dt()), ne), e.link(
e.link(e.pipe(t, Mt()), U), e.link(
e.pipe(
t,
Qe(e.pipe(Ve, v(tn))),
O(null),
Nt(e.pipe(Be, v(tn))),
C(null),
// unset the location after the scroll completes
ge(10)
re(10)
),
Me
Ae
);
});
function ho(e, t) {
function yo(e, t) {
const n = t.slice();
let o = 0;
const s = [];
de(e).forEach(({ k: l, v: r }) => {
ve(e).forEach(({ k: l, v: r }) => {
var p, m;

@@ -467,6 +639,6 @@ for (; n.length && n[0] < l; )

return s.forEach(({ k: l, v: r }) => {
i = C(i, l, r);
i = O(i, l, r);
}), i;
}
function go(e, t) {
function Io(e, t) {
return [

@@ -484,4 +656,4 @@ {

}
const vo = [], Ne = {
items: vo,
const So = [], ze = {
items: So,
listBottom: 0,

@@ -494,3 +666,3 @@ listTop: 0,

data: null
}, He = c(Ne, (e) => {
}, Ve = c(ze, (e) => {
e.link(

@@ -501,16 +673,16 @@ e.pipe(

vn,
G,
rt,
Z,
lt,
ke,
Re,
we,
H,
Xe,
nt,
Me,
Ae,
_e,
We,
Be,
_e,
W,
q,
B
Fe,
_,
G,
W
),

@@ -521,3 +693,3 @@ v((t) => {

}),
U(
q(
(t, [

@@ -535,15 +707,15 @@ n,

k,
_,
F,
d,
Y
]) => {
var pe;
var fe;
if ((u == null ? void 0 : u.length) === 0)
return Ne;
return ze;
if (b(s)) {
let N = 0;
return p !== null && (N = Ct(p, l - 1).index), { ...Ne, items: go(N, u), offsetTree: i, totalCount: l, data: u };
let V = 0;
return p !== null && (V = Dt(p, l - 1).index), { ...ze, items: Io(V, u), offsetTree: i, totalCount: l, data: u };
}
let J = 0;
m !== null && n === 0 && (J = nn({
let X = 0;
m !== null && n === 0 && (X = cn({
totalHeight: r,

@@ -554,24 +726,24 @@ location: m,

totalCount: l,
viewportHeight: e.getValue(Z),
headerHeight: e.getValue(ct),
stickyHeaderHeight: _,
viewportHeight: e.getValue(J),
headerHeight: e.getValue(rt),
stickyHeaderHeight: F,
stickyFooterHeight: d
}).top ?? 0);
const X = Math.max(
n + J + h - Y - k,
const Q = Math.max(
n + X + h - Y - k,
0
), ue = X + o;
if (t.offsetTree === i && t.totalCount === l && t.data === u && X >= t.listTop && ue <= t.listBottom)
), ae = Q + o;
if (t.offsetTree === i && t.totalCount === l && t.data === u && Q >= t.listTop && ae <= t.listBottom)
return t;
const ae = [], j = l - 1, F = 0, P = co(i, X, ue, F);
let K = 0, Pe = 0, E = !1;
for (const N of P) {
const pe = [], j = l - 1, P = 0, N = co(i, Q, ae, P);
let K = 0, Ne = 0, E = !1;
for (const V of N) {
const {
value: { offset: ye, height: se }
} = N;
let ee = N.start;
K = ye, ye < X && (ee += Math.floor((X - ye) / se), K += (ee - N.start) * se), ee < F && (K += (F - ee) * se, ee = F);
const we = Math.min(N.end, j);
for (let ie = ee; ie <= we && !(K >= ue); ie++) {
const ft = {
} = V;
let te = V.start;
K = ye, ye < Q && (te += Math.floor((Q - ye) / se), K += (te - V.start) * se), te < P && (K += (P - te) * se, te = P);
const Le = Math.min(V.end, j);
for (let ie = te; ie <= Le && !(K >= ae); ie++) {
const pt = {
data: u == null ? void 0 : u[ie],

@@ -585,15 +757,15 @@ prevData: (u == null ? void 0 : u[ie - 1]) ?? null,

};
E || (E = !0, Pe = K), ae.push(ft), K += se;
E || (E = !0, Ne = K), pe.push(pt), K += se;
}
}
const Q = r - K, pt = ((pe = ae[0]) == null ? void 0 : pe.offset) || 0;
return { items: ae, listBottom: K, listTop: Pe, offsetTree: i, paddingBottom: Q, paddingTop: pt, totalCount: l, data: u };
const ee = r - K, at = ((fe = pe[0]) == null ? void 0 : fe.offset) || 0;
return { items: pe, listBottom: K, listTop: Ne, offsetTree: i, paddingBottom: ee, paddingTop: at, totalCount: l, data: u };
},
Ne
ze
)
),
He
Ve
);
}), yt = be([], (e) => e.pipe(
e.combine(He, x),
e.combine(Ve, T),
a(([t, n]) => {

@@ -605,173 +777,9 @@ const o = t.items.slice();

})
)), sn = "up", vt = "down", bo = "none", mo = {
atBottom: !1,
notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",
state: {
offsetBottom: 0,
scrollTop: 0,
viewportHeight: 0,
viewportWidth: 0,
scrollHeight: 0
}
}, ko = 0, yo = 4;
function Bt(e) {
return (t, n) => {
const o = n.signalInstance();
return n.sub(t, (s) => {
e > 0 ? e-- : n.pub(o, s);
}), o;
};
}
c(!1);
const ln = c(!0);
I();
const Ue = c(!1), Io = I((e) => {
e.link(e.pipe(ln, ve(50)), Io);
}), rn = c(yo), So = c(ko, (e) => {
)), W = c(!1), Ge = S((e) => {
e.link(
e.pipe(
e.combine(x, So),
a(([t, n]) => t <= n)
),
ln
);
}), Ae = c(!1, (e) => {
e.link(e.pipe(x, Bt(1), O(!0)), Ae), e.link(e.pipe(x, Bt(1), O(!1), ge(100)), Ae);
}), It = c(!1, (e) => {
e.link(e.pipe(oe, O(!0)), It), e.link(e.pipe(oe, O(!1), ge(200)), It);
}), cn = c(!1), qe = c(
null,
(e) => {
e.link(
e.pipe(
e.combine($e, x, Z, gn, rn, ut, G),
v(([, , , , , , t]) => !b(t)),
U((t, [n, o, s, i, l]) => {
const u = o + s - n > -l, h = {
viewportWidth: i,
viewportHeight: s,
scrollTop: o,
scrollHeight: n
};
if (u) {
let m, k;
return o > t.state.scrollTop ? (m = "SCROLLED_DOWN", k = t.state.scrollTop - o) : (m = n === s ? "LIST_TOO_SHORT" : "SIZE_DECREASED", k = t.state.scrollTop - o || t.scrollTopDelta), {
atBottom: !0,
state: h,
atBottomBecause: m,
scrollTopDelta: k
};
}
let p;
return s < t.state.viewportHeight ? p = "VIEWPORT_HEIGHT_DECREASING" : i < t.state.viewportWidth ? p = "VIEWPORT_WIDTH_DECREASING" : h.scrollHeight > t.state.scrollHeight ? p = "SIZE_INCREASED" : o < t.state.scrollTop ? p = "SCROLLING_UPWARDS" : p = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
atBottom: !1,
notAtBottomBecause: p,
state: h
};
}, mo)
),
qe
), e.link(
e.pipe(
qe,
ve(10),
// withLatestFrom(scrollToInProgress$),
// filter(([, inProgress]) => !inProgress),
U(
({ prev: t }, n) => {
const o = !!(t && n && t.atBottom && !n.atBottom && n.notAtBottomBecause === "SIZE_INCREASED");
return {
prev: n,
shouldScroll: o
};
},
{ prev: null, shouldScroll: !1 }
),
a(({ shouldScroll: t }) => t)
),
cn
), e.sub(
e.pipe(
Z,
T(qe),
U(
(t, [n, o]) => {
let s = 0;
return t.viewportHeight > n && o && !o.atBottom && o.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && (s = t.viewportHeight - n), { viewportHeight: n, delta: s };
},
{ viewportHeight: 0, delta: 0 }
)
),
(t) => {
t.delta && e.pub(oe, { top: t.delta });
}
);
},
(e, t) => e ? e.atBottom === (t == null ? void 0 : t.atBottom) : !1
), un = c(0, (e) => {
e.link(
e.pipe(
e.combine(x, $e, Z),
U(
(t, [n, o, s]) => {
if (Qt(t.scrollHeight, o))
return {
scrollTop: n,
scrollHeight: o,
jump: 0,
changed: !1
};
{
const i = o - (n + s) < 1;
return t.scrollTop !== n && i ? {
scrollHeight: o,
scrollTop: n,
jump: t.scrollTop - n,
changed: !0
} : {
scrollHeight: o,
scrollTop: n,
jump: 0,
changed: !0
};
}
},
{ scrollHeight: 0, jump: 0, scrollTop: 0, changed: !1 }
),
v((t) => t.changed),
a((t) => t.jump)
),
un
);
}), ot = c(vt, (e) => {
e.link(
e.pipe(
x,
U(
(t, n) => e.getValue(It) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? sn : vt, prevScrollTop: n },
{ direction: vt, prevScrollTop: 0 }
),
a((t) => t.direction)
),
ot
), e.link(e.pipe(x, ve(50), O(bo)), ot);
}), Wt = c(0, (e) => {
e.link(e.pipe(Ae, v(tn), O(0)), Wt), e.link(
e.pipe(
x,
ve(100),
T(Ae),
v(([, t]) => !!t),
U(([, t], [n]) => [t, n], [0, 0]),
a(([t, n]) => n - t)
),
Wt
);
}), B = c(!1), Ge = I((e) => {
e.link(
e.pipe(
He,
T(un, q),
Ve,
I(rn, G),
v(([, , t]) => !t),
U(
q(
([, t, n, o], [{ items: s, totalCount: i, listBottom: l, paddingBottom: r }, u]) => {

@@ -785,35 +793,35 @@ const h = l + r;

v(([t]) => t !== 0),
T(x, ot, Ve),
v(([, t, n, o]) => !o && t !== 0 && n === sn),
I(T, et, Be),
v(([, t, n, o]) => !o && t !== 0 && n === nn),
a(([[t]]) => t)
),
Ge
), en() ? (e.sub(e.pipe(Ge, T(W, x)), ([t, n]) => {
e.pub(W, n - t);
}), e.sub(e.pipe(e.combine(x, W, q)), ([t, n, o]) => {
o || (n > 0 && t < n ? (e.pub(B, !0), e.pub(Ee, { top: 0, behavior: "instant" }), setTimeout(() => {
), en() ? (e.sub(e.pipe(Ge, I(_, T)), ([t, n]) => {
e.pub(_, n - t);
}), e.sub(e.pipe(e.combine(T, _, G)), ([t, n, o]) => {
o || (n > 0 && t < n ? (e.pub(W, !0), e.pub(Ee, { top: 0, behavior: "instant" }), setTimeout(() => {
e.pubIn({
[B]: !1,
[W]: 0
[W]: !1,
[_]: 0
});
})) : n < 0 && t <= 0 && (e.pubIn({
[B]: !0,
[W]: 0
[W]: !0,
[_]: 0
}), setTimeout(() => {
e.pub(Ee, { top: 0, behavior: "instant" }), e.pub(B, !1);
e.pub(Ee, { top: 0, behavior: "instant" }), e.pub(W, !1);
})));
}), e.sub(
e.pipe(
e.combine(Ae, W, B, q),
e.combine(Ce, _, W, G),
v(([t, n, o, s]) => !t && n !== 0 && !o && !s),
ve(100)
Re(100)
),
([, t]) => {
e.pub(B, !0), t < 0 ? requestAnimationFrame(() => {
e.pub(oe, { top: -t, behavior: "instant" }), e.pub(W, 0), requestAnimationFrame(() => {
e.pub(B, !1);
e.pub(W, !0), t < 0 ? requestAnimationFrame(() => {
e.pub(oe, { top: -t, behavior: "instant" }), e.pub(_, 0), requestAnimationFrame(() => {
e.pub(W, !1);
});
}) : requestAnimationFrame(() => {
e.pub(oe, { top: -t, behavior: "instant" }), e.pub(W, 0), requestAnimationFrame(() => {
e.pub(B, !1);
e.pub(oe, { top: -t, behavior: "instant" }), e.pub(_, 0), requestAnimationFrame(() => {
e.pub(W, !1);
});

@@ -829,3 +837,3 @@ });

);
}), ke = c(0), Ce = c(null), H = c(null, (e) => {
}), ke = c(0), Oe = c(null), H = c(null, (e) => {
e.link(

@@ -839,16 +847,16 @@ e.pipe(

);
}), he = I((e) => {
e.link(e.pipe(he, O(!0)), q);
}), ge = S((e) => {
e.link(e.pipe(ge, C(!0)), G);
const t = en();
e.link(
e.pipe(
he,
T(Se),
ge,
I(Se),
a(([n, o]) => o * n.length)
),
W
), e.link(e.pipe(he, O(t)), B), e.sub(
_
), e.link(e.pipe(ge, C(t)), W), e.sub(
e.pipe(
he,
T(Se),
ge,
I(Se),
a(([n, o]) => ({

@@ -858,3 +866,3 @@ top: o * n.length,

})),
Dt()
Mt()
),

@@ -865,14 +873,14 @@ (n) => {

}), t ? setTimeout(() => {
e.pub(W, 0), e.pub(q, !1), e.pub(B, !1);
e.pub(_, 0), e.pub(G, !1), e.pub(W, !1);
}, 100) : requestAnimationFrame(() => {
e.pub(W, 0), e.pub(q, !1);
e.pub(_, 0), e.pub(G, !1);
});
}
), e.changeWith(H, he, (n, o) => n ? [...o, ...n] : o.slice()), e.link(
), e.changeWith(H, ge, (n, o) => n ? [...o, ...n] : o.slice()), e.link(
e.pipe(
he,
T(G, Se),
ge,
I(Z, Se),
a(([n, o, s]) => {
const i = n.length, l = s;
return de(o).reduce(
return ve(o).reduce(
(r, { k: u, v: h }) => ({

@@ -891,8 +899,8 @@ ranges: [...r.ranges, { startIndex: r.prevIndex, endIndex: u + i - 1, size: r.prevSize }],

),
lt
it
);
}), it = I((e) => {
}), st = S((e) => {
const t = e.pipe(
it,
T(Fe, $t, Ce, G),
st,
I(Pe, Tt, Oe, Z),
v(([, , , , o]) => !b(o)),

@@ -927,38 +935,41 @@ a(([{ data: o, scrollToBottom: s }, i, l, r]) => {

),
Ue
de
), e.link(
e.pipe(
t,
Qe(Oe),
He,
I(de),
v(([o, s]) => s),
a(() => !1)
),
Ue
de
);
const n = e.pipe(
t,
Qe(
e.pipe(
ot,
v((o) => o === "up")
)
)
et,
I(de),
v(([o, s]) => (o === "up" || o === "none") && s)
);
e.link(e.pipe(n, O(!1)), Ue), e.link(e.pipe(n, O(!0)), tt), e.link(
e.link(
e.pipe(
n,
a(() => !1)
),
de
), e.link(e.pipe(n, C(!0)), tt), e.link(
e.pipe(
t,
v((o) => o !== null),
ge(20)
re(20)
),
ne
U
);
}), St = I((e) => {
e.changeWith(H, St, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(St, it);
}), Ze = I((e) => {
e.changeWith(H, Ze, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ce, Ze, ([t], n) => {
const s = re(t, n.offset, "k")[0], i = n.data.length;
}), It = S((e) => {
e.changeWith(H, It, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(It, st);
}), Ze = S((e) => {
e.changeWith(H, Ze, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ue, Ze, ([t], n) => {
const s = ce(t, n.offset, "k")[0], i = n.data.length;
return [Qn(t, s, 1 / 0, (r, u) => [r + i, u]), s];
}), e.link(Ze, it);
}), xt = I((e) => {
e.changeWith(H, xt, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ce, xt, ([t], { offset: n, count: o }) => [eo(t, n, o), n]);
}), Je = I((e) => {
}), e.link(Ze, st);
}), St = S((e) => {
e.changeWith(H, St, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ue, St, ([t], { offset: n, count: o }) => [eo(t, n, o), n]);
}), Je = S((e) => {
e.changeWith(H, Je, (t, n) => n.data.slice()), e.link(

@@ -969,17 +980,17 @@ e.pipe(

),
ne
), e.changeWith(ce, Je, (t, n) => {
const o = re(t[0], 1 / 0, "k")[1];
U
), e.changeWith(ue, Je, (t, n) => {
const o = ce(t[0], 1 / 0, "k")[1];
if (!o)
return st;
return ot;
let s = me();
return s = C(s, 0, o), [s, 0];
return s = O(s, 0, o), [s, 0];
});
}), _t = I((e) => {
e.changeWith(H, _t, (t, n) => t ? t.slice(n) : []), e.changeWith(ce, _t, ([t], n) => [de(t).reduce((s, { k: i, v: l }) => C(s, Math.max(0, i - n), l), me()), 0]);
}), Ft = I((e) => {
e.changeWith(H, Ft, (t, n) => t ? t.slice(0, t.length - n) : []), e.link(
}), Wt = S((e) => {
e.changeWith(H, Wt, (t, n) => t ? t.slice(n) : []), e.changeWith(ue, Wt, ([t], n) => [ve(t).reduce((s, { k: i, v: l }) => O(s, Math.max(0, i - n), l), me()), 0]);
}), _t = S((e) => {
e.changeWith(H, _t, (t, n) => t ? t.slice(0, t.length - n) : []), e.link(
e.pipe(
Ft,
T(ke, Se),
_t,
I(ke, Se),
a(([, t, n]) => [

@@ -993,8 +1004,8 @@ {

),
lt
it
);
}), an = I((e) => {
}), an = S((e) => {
const t = e.pipe(
an,
T(H),
I(H),
a(([n, o]) => {

@@ -1009,15 +1020,15 @@ if (!o)

);
e.changeWith(H, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ce, t, ([n], o) => [ho(n, o), 0]);
}), Tt = I((e) => {
e.changeWith(H, Tt, (t, { mapper: n }) => t ? t.map(n) : []), e.link(
e.changeWith(H, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ue, t, ([n], o) => [yo(n, o), 0]);
}), xt = S((e) => {
e.changeWith(H, xt, (t, { mapper: n }) => t ? t.map(n) : []), e.link(
e.pipe(
Tt,
ve(40),
T(cn),
xt,
Re(40),
I(ln),
v(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t),
a(([{ autoscrollToBottomBehavior: t }]) => ({ index: "LAST", align: "end", behavior: t }))
),
ne
U
);
}), lt = I();
}), it = S();
c([]);

@@ -1028,24 +1039,24 @@ c([]);

c(NaN);
const q = c(!1), ce = c(st, (e) => {
const G = c(!1), ue = c(ot, (e) => {
e.link(
e.pipe(
lt,
it,
v((t) => t.length > 0),
T(G),
I(Z),
a(([t, n]) => so(n, [t, []]))
),
ce
ue
);
}), G = c(st[0], (e) => {
}), Z = c(ot[0], (e) => {
e.link(
e.pipe(
ce,
ue,
a(([t]) => t)
),
G
Z
);
}), pn = c(st[1], (e) => {
}), pn = c(ot[1], (e) => {
e.link(
e.pipe(
ce,
ue,
a(([, t]) => t)

@@ -1055,8 +1066,8 @@ ),

);
}), Se = c(Te[1]), rt = c(Te[0]), De = c(Te, (e) => {
}), Se = c(Te[1]), lt = c(Te[0]), De = c(Te, (e) => {
e.link(
e.pipe(
G,
T(pn),
U(([t], [n, o]) => uo(t, [n, o]), Te)
Z,
I(pn),
q(([t], [n, o]) => uo(t, [n, o]), Te)
),

@@ -1075,3 +1086,3 @@ De

),
rt
lt
);

@@ -1094,3 +1105,3 @@ }), fn = c(Te[2], (e) => {

);
}), Re = c(0, (e) => {
}), we = c(0, (e) => {
e.link(

@@ -1101,17 +1112,17 @@ e.pipe(

),
Re
we
);
}), Ve = I(), $t = c(!1), Oe = I((e) => {
e.link(e.pipe(Oe, O(!1)), Ve);
}), x = c(0), Z = c(0), gn = c(0), $e = c(0), xo = x, Xe = c(0), Be = c(0), We = c(0), _e = c(0), Ot = c(0), Et = c(null), ct = be(0, (e) => e.pipe(
e.combine(Be, We),
}), Be = S(), Tt = c(!1), He = S((e) => {
e.link(e.pipe(He, C(!1)), Be);
}), T = c(0), J = c(0), gn = c(0), $e = c(0), xo = T, Xe = c(0), We = c(0), _e = c(0), Fe = c(0), Ct = c(0), $t = c(null), rt = be(0, (e) => e.pipe(
e.combine(We, _e),
a(([t, n]) => t + n)
)), dn = be(0, (e) => e.pipe(
e.combine(_e, Ot),
e.combine(Fe, Ct),
a(([t, n]) => t + n)
)), To = be(0, (e) => e.pipe(
e.combine(Be, We, x),
e.combine(We, _e, T),
a(([t, n, o]) => t + Math.max(n - o, 0))
)), $o = be(0, (e) => e.pipe(
e.combine(_e, Ot, x, Z, $e),
e.combine(Fe, Ct, T, J, $e),
a(([t, n, o, s, i]) => {

@@ -1122,13 +1133,13 @@ const l = Math.max(n - (i - (o + s)), 0);

)), vn = be(0, (e) => e.pipe(
e.combine(Z, To, $o),
e.combine(J, To, $o),
a(([t, n, o]) => t - n - o)
)), ut = c(0), bn = c(0, (e) => {
)), ct = c(0), bn = c(0, (e) => {
e.link(
e.pipe(
e.combine(bn, Re, Z),
e.combine(bn, we, J),
a(([t, n, o]) => t === 0 ? 0 : Math.max(0, Math.min(t - (n - o))))
),
ut
ct
);
}), Ee = I((e) => {
}), Ee = S((e) => {
e.link(

@@ -1143,9 +1154,9 @@ e.pipe(

Ee,
T(x),
I(T),
v(([t, n]) => t.top !== n),
O(!0)
C(!0)
),
Ve
Be
);
}), Fe = be(
}), Pe = be(
{

@@ -1160,13 +1171,13 @@ listOffset: 0,

e.combine(
x,
ct,
T,
rt,
dn,
We,
_e,
vn,
$e,
ut,
q,
Me,
B,
Ue
ct,
G,
Ae,
W,
de
),

@@ -1188,5 +1199,5 @@ v(([, , , , , , , t, n, o]) => !t && n === null && !o),

]) => {
const k = e.getValue(rn), _ = l - n - o, d = -t + s, Y = r === 0 ? _ + Math.min(0, d) - i : -r;
const k = e.getValue(sn), F = l - n - o, d = -t + s, Y = r === 0 ? F + Math.min(0, d) - i : -r;
return {
scrollHeight: _,
scrollHeight: F,
listOffset: d,

@@ -1200,21 +1211,21 @@ visibleListHeight: i,

)
), Rt = I((e) => {
), Et = S((e) => {
e.link(
e.pipe(
x,
ge(0),
T(Fe),
T,
re(0),
I(Pe),
v(([, t]) => t.scrollHeight > 0),
a(([, t]) => t)
),
Rt
Et
);
}), oe = I(), W = c(0), wt = c(0), mn = c(""), kn = ({ index: e }) => /* @__PURE__ */ Nt("div", { children: [
}), oe = S(), _ = c(0), Rt = c(0), mn = c(""), kn = ({ index: e }) => /* @__PURE__ */ Pt("div", { children: [
"Item ",
e
] }), yn = ({ index: e }) => e, Lt = c(kn), In = c(yn), Sn = c(null), xn = c(null), Tn = c(null), $n = c(null), En = c(null), Rn = c("div"), Eo = {
] }), yn = ({ index: e }) => e, wt = c(kn), In = c(yn), Sn = c(null), xn = c(null), Tn = c(null), $n = c(null), En = c(null), Rn = c("div"), Eo = {
position: "sticky",
top: 0,
zIndex: 1
}, ze = {
}, Ye = {
overflowAnchor: "none"

@@ -1226,17 +1237,17 @@ }, Ro = {

({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...Eo, ...e }, ref: n })
), Dn = g.forwardRef(
), An = g.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...Ro, ...e }, ref: n })
), An = c(wn), Cn = c(Mn), On = c(Ln), Hn = c(Dn), Mt = c("top", (e) => {
), Dn = c(wn), Cn = c(Mn), On = c(Ln), Hn = c(An), Lt = c("top", (e) => {
e.link(
e.pipe(
e.combine(Mt, Re, Z, ct, dn),
e.combine(Lt, we, J, rt, dn),
v(([t]) => t === "bottom" || t === "bottom-smooth"),
a(([, t, n, o, s]) => Math.max(0, n - t - o - s))
),
wt
Rt
), e.link(
e.pipe(
e.combine(wt, Mt),
e.combine(Rt, Lt),
v(([, t]) => t === "bottom-smooth"),
U(
q(
(t, [n]) => [t[1], n],

@@ -1251,3 +1262,3 @@ [0, 0]

function wo(e) {
return Lo(Do(Ao(Mo(e), 8 * e.length))).toLowerCase();
return Lo(Ao(Do(Mo(e), 8 * e.length))).toLowerCase();
}

@@ -1266,3 +1277,3 @@ function Lo(e) {

}
function Do(e) {
function Ao(e) {
for (var t = "", n = 0; n < 32 * e.length; n += 8)

@@ -1272,3 +1283,3 @@ t += String.fromCharCode(e[n >> 5] >>> n % 32 & 255);

}
function Ao(e, t) {
function Do(e, t) {
e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t;

@@ -1537,16 +1548,16 @@ for (var n = 1732584193, o = -271733879, s = -1732584194, i = 271733878, l = 0; l < e.length; l += 16) {

}
function at(e, t, n, o, s, i) {
function ut(e, t, n, o, s, i) {
return le(Co(le(le(t, e), le(o, i)), s), n);
}
function R(e, t, n, o, s, i, l) {
return at(t & n | ~t & o, e, t, s, i, l);
return ut(t & n | ~t & o, e, t, s, i, l);
}
function w(e, t, n, o, s, i, l) {
return at(t & o | n & ~o, e, t, s, i, l);
return ut(t & o | n & ~o, e, t, s, i, l);
}
function L(e, t, n, o, s, i, l) {
return at(t ^ n ^ o, e, t, s, i, l);
return ut(t ^ n ^ o, e, t, s, i, l);
}
function M(e, t, n, o, s, i, l) {
return at(n ^ (t | ~o), e, t, s, i, l);
return ut(n ^ (t | ~o), e, t, s, i, l);
}

@@ -1618,3 +1629,3 @@ function le(e, t) {

now: /* @__PURE__ */ new Date(),
packageTimestamp: 1718636708266
packageTimestamp: 1718640676796
});

@@ -1628,6 +1639,6 @@ return /* @__PURE__ */ y(Wn.Provider, { value: n, children: t });

prepend: (t) => {
e.pub(he, t);
e.pub(ge, t);
},
append: (t, n) => {
e.pub(St, {
e.pub(It, {
data: t,

@@ -1644,3 +1655,3 @@ scrollToBottom: n

map: (t, n) => {
e.pub(Tt, {
e.pub(xt, {
mapper: t,

@@ -1663,3 +1674,3 @@ autoscrollToBottomBehavior: n

deleteRange: function(t, n) {
e.pub(xt, {
e.pub(St, {
offset: t,

@@ -1670,14 +1681,14 @@ count: n

batch: (t, n) => {
e.pub(q, !0), t(), e.pub(q, !1), e.pub(it, { data: [], scrollToBottom: n });
e.pub(G, !0), t(), e.pub(G, !1), e.pub(st, { data: [], scrollToBottom: n });
}
},
scrollToItem: (t) => {
e.pub(ne, t);
e.pub(U, t);
},
scrollIntoView: (t) => {
e.pub(on, t);
e.pub(un, t);
},
scrollerElement: () => e.getValue(Et),
scrollerElement: () => e.getValue($t),
getScrollLocation() {
return e.getValue(Fe);
return e.getValue(Pe);
}

@@ -1687,6 +1698,6 @@ };

function Xo() {
return V(Fe);
return B(Pe);
}
function Qo() {
return V(yt);
return B(yt);
}

@@ -1697,3 +1708,3 @@ function es() {

}
let Pt = !1;
let Ft = !1;
const jo = g.forwardRef(

@@ -1714,17 +1725,17 @@ ({

EmptyPlaceholder: k = null,
HeaderWrapper: _ = wn,
HeaderWrapper: F = wn,
StickyHeaderWrapper: d = Mn,
FooterWrapper: Y = Ln,
StickyFooterWrapper: J = Dn,
ScrollElement: X = "div",
...ue
}, ae) => {
StickyFooterWrapper: X = An,
ScrollElement: Q = "div",
...ae
}, pe) => {
const j = g.useMemo(() => {
const P = new Zn();
return P.register(He), P.register(Ve), P.register(Ge), P.register(qe), P.pubIn({
const N = new Zn();
return N.register(Ve), N.register(Be), N.register(Ge), N.register(Ue), N.pubIn({
[H]: e.slice(),
[Ce]: n,
[Oe]: n,
[In]: t,
[nt]: o,
[Lt]: r,
[wt]: r,
[Sn]: u,

@@ -1735,20 +1746,20 @@ [Tn]: p,

[En]: k,
[Rn]: X,
[Hn]: J,
[Rn]: Q,
[Hn]: X,
[Cn]: d,
[On]: Y,
[An]: _,
[Mt]: s
}), P.singletonSub(Rt, i), P.singletonSub(yt, l), P;
[Dn]: F,
[Lt]: s
}), N.singletonSub(Et, i), N.singletonSub(yt, l), N;
}, []);
g.useImperativeHandle(ae, () => _n(j), [j]), g.useEffect(() => {
g.useImperativeHandle(pe, () => _n(j), [j]), g.useEffect(() => {
j.pubIn({
[Ce]: n,
[Lt]: r
}), j.singletonSub(Rt, i), j.singletonSub(yt, l);
[Oe]: n,
[wt]: r
}), j.singletonSub(Et, i), j.singletonSub(yt, l);
});
const F = g.useContext(Wn);
const P = g.useContext(Wn);
return g.useEffect(() => {
F.consoleMessage && (Pt || (Pt = !0, console.error(F.consoleMessage)));
}, [F]), typeof window < "u" && F.watermarkMessage ? /* @__PURE__ */ y(
P.consoleMessage && (Ft || (Ft = !0, console.error(P.consoleMessage)));
}, [P]), typeof window < "u" && P.watermarkMessage ? /* @__PURE__ */ y(
"div",

@@ -1760,5 +1771,5 @@ {

},
children: F.watermarkMessage
children: P.watermarkMessage
}
) : /* @__PURE__ */ y(Jn.Provider, { value: j, children: /* @__PURE__ */ y(Uo, { ...ue }) });
) : /* @__PURE__ */ y(Jn.Provider, { value: j, children: /* @__PURE__ */ y(Uo, { ...ae }) });
}

@@ -1779,7 +1790,7 @@ );

k,
_
F
] = Xn(
Sn,
xn,
An,
Dn,
Cn,

@@ -1790,3 +1801,3 @@ Tn,

Hn,
Lt,
wt,
En,

@@ -1798,42 +1809,42 @@ Rn

return new ResizeObserver((f) => {
const z = f.length, D = [];
let S = {};
const z = f.length, A = [];
let x = {};
for (let Ie = 0; Ie < z; Ie++) {
const te = f[Ie], A = te.target;
if (A === j.current) {
S = {
...S,
[We]: te.contentRect.height
const ne = f[Ie], D = ne.target;
if (D === j.current) {
x = {
...x,
[_e]: ne.contentRect.height
};
continue;
} else if (A === P.current) {
S = {
...S,
[Be]: te.contentRect.height
} else if (D === N.current) {
x = {
...x,
[We]: ne.contentRect.height
};
continue;
} else if (A === J.current) {
S = {
...S,
[Ot]: te.contentRect.height
} else if (D === X.current) {
x = {
...x,
[Ct]: ne.contentRect.height
};
continue;
} else if (A === ue.current) {
S = {
...S,
[_e]: te.contentRect.height
} else if (D === ae.current) {
x = {
...x,
[Fe]: ne.contentRect.height
};
continue;
} else if (A === E.current) {
S = {
...S,
[x]: A.scrollTop,
[$e]: A.scrollHeight,
[Z]: te.contentRect.height,
[gn]: A.clientWidth
} else if (D === E.current) {
x = {
...x,
[T]: D.scrollTop,
[$e]: D.scrollHeight,
[J]: ne.contentRect.height,
[gn]: D.clientWidth
};
continue;
} else if (A === Q.current) {
E.current && (S = {
...S,
} else if (D === ee.current) {
E.current && (x = {
...x,
[$e]: E.current.scrollHeight

@@ -1843,16 +1854,16 @@ });

}
if (A.dataset.index === void 0)
if (D.dataset.index === void 0)
continue;
const ht = parseInt(A.dataset.index), qn = parseFloat(A.dataset.knownSize ?? ""), gt = te.contentRect.height;
if (gt === qn)
const ft = parseInt(D.dataset.index), qn = parseFloat(D.dataset.knownSize ?? ""), ht = ne.contentRect.height;
if (ht === qn)
continue;
const Ht = D[D.length - 1];
D.length === 0 || Ht.size !== gt || Ht.endIndex !== ht - 1 ? D.push({ endIndex: ht, size: gt, startIndex: ht }) : D[D.length - 1].endIndex++;
const Ot = A[A.length - 1];
A.length === 0 || Ot.size !== ht || Ot.endIndex !== ft - 1 ? A.push({ endIndex: ft, size: ht, startIndex: ft }) : A[A.length - 1].endIndex++;
}
D.length > 0 && (S = {
...S,
[lt]: D
}), n.pubIn(S);
A.length > 0 && (x = {
...x,
[it]: A
}), n.pubIn(x);
});
}), [Y, J] = Ye(d), [X, ue] = Ye(d), [ae, j] = Ye(d), [F, P] = Ye(d), K = g.useCallback(
}), [Y, X] = Ke(d), [Q, ae] = Ke(d), [pe, j] = Ke(d), [P, N] = Ke(d), K = g.useCallback(
(f) => {

@@ -1862,3 +1873,3 @@ d.observe(f);

[d]
), Pe = g.useCallback(
), Ne = g.useCallback(
(f) => {

@@ -1868,53 +1879,54 @@ d.unobserve(f);

[d]
), E = g.useRef(null), Q = g.useRef(null), pt = g.useCallback(
), E = g.useRef(null), ee = g.useRef(null), at = g.useCallback(
(f) => {
f ? (Q.current = f, d.observe(f, { box: "border-box" })) : Q.current && (d.unobserve(Q.current), Q.current = null);
f ? (ee.current = f, d.observe(f, { box: "border-box" })) : ee.current && (d.unobserve(ee.current), ee.current = null);
},
[d]
), pe = g.useRef(null), N = g.useRef(null);
), fe = g.useRef(null), V = g.useRef(null);
g.useEffect(() => n.sub(tt, () => {
V.current && cancelAnimationFrame(V.current);
}), [n]);
const ye = g.useCallback((f) => {
var Ie;
N.current && clearTimeout(N.current);
V.current && cancelAnimationFrame(V.current);
const z = ((Ie = E.current) == null ? void 0 : Ie.scrollTop) ?? 0;
let D = 0;
function S() {
var A;
const te = z + (f - z) * po(D);
(A = E.current) == null || A.scrollTo({ top: te, behavior: "auto" }), D += 0.02, D < 1 ? N.current = setTimeout(S, 16) : N.current = null;
let A = 0;
function x() {
var D;
const ne = z + (f - z) * po(A);
(D = E.current) == null || D.scrollTo({ top: ne, behavior: "auto" }), A += 0.02, A < 1 ? V.current = requestAnimationFrame(x) : V.current = null;
}
S();
x();
}, []), se = g.useCallback(
(f) => {
var z, D, S;
var z, A, x;
if (f.top === ((z = E.current) == null ? void 0 : z.scrollTop)) {
n.pub(Oe, (D = E.current) == null ? void 0 : D.scrollTop);
n.pub(He, (A = E.current) == null ? void 0 : A.scrollTop);
return;
}
f.top !== void 0 && (pe.current = f.top, n.pub($t, !0)), f.forceBottomSpace !== void 0 && Q.current && (Q.current.style.paddingBottom = `${f.forceBottomSpace}px`), f.behavior === "smooth" ? ye(f.top ?? 0) : (S = E.current) == null || S.scrollTo(f);
f.top !== void 0 && (fe.current = f.top, n.pub(Tt, !0)), f.forceBottomSpace !== void 0 && ee.current && (ee.current.style.paddingBottom = `${f.forceBottomSpace}px`), f.behavior === "smooth" ? ye(f.top ?? 0) : (x = E.current) == null || x.scrollTo(f);
},
[n, ye]
), ee = g.useCallback((f) => {
), te = g.useCallback((f) => {
var z;
(z = E.current) == null || z.scrollBy(f);
}, []), we = g.useCallback(() => {
}, []), Le = g.useCallback(() => {
const f = E.current;
if (f !== null) {
if (pe.current !== null) {
if (fe.current !== null) {
const z = f.scrollHeight - f.clientHeight;
Qt(f.scrollTop, Math.min(z, pe.current)) && (pe.current = null, n.pub($t, !1), n.pub(Oe, f.scrollTop));
Qt(f.scrollTop, Math.min(z, fe.current)) && (fe.current = null, n.pub(Tt, !1), n.pub(He, f.scrollTop));
}
n.pub(x, f.scrollTop);
n.pub(T, f.scrollTop);
}
}, [n]), ie = g.useCallback(
(f) => {
f ? (n.pub(Et, f), E.current = f, f.addEventListener("scroll", we), d.observe(f, { box: "border-box" })) : E.current && (E.current.removeEventListener("scroll", we), n.pub(Et, null), d.unobserve(E.current), E.current = null);
f ? (n.pub($t, f), E.current = f, f.addEventListener("scroll", Le), d.observe(f, { box: "border-box" })) : E.current && (E.current.removeEventListener("scroll", Le), n.pub($t, null), d.unobserve(E.current), E.current = null);
},
[d, n, we]
), { items: ft } = V(He);
g.useLayoutEffect(() => n.sub(Ee, se), [se, n]), g.useLayoutEffect(() => n.sub(oe, ee), [ee, n]);
const Fn = V(W), Pn = V(B), Nn = V(wt), zn = V(ut), Yn = V(mn), fe = V(Ce), Kn = V(In), jn = V(ke), Un = V(Re);
return /* @__PURE__ */ y(Gn, { children: /* @__PURE__ */ Nt(
_,
[d, n, Le]
), { items: pt } = B(Ve);
g.useLayoutEffect(() => n.sub(Ee, se), [se, n]), g.useLayoutEffect(() => n.sub(oe, te), [te, n]);
const Fn = B(_), Pn = B(W), Nn = B(Rt), zn = B(ct), Yn = B(mn), he = B(Oe), Kn = B(In), jn = B(ke), Un = B(we);
return /* @__PURE__ */ y(Gn, { children: /* @__PURE__ */ Pt(
F,
{

@@ -1929,10 +1941,10 @@ ...t,

},
..._ === "div" ? { context: fe } : {},
...F === "div" ? { context: he } : {},
children: [
s && /* @__PURE__ */ y(l, { ref: F, style: ze, children: /* @__PURE__ */ y(s, { context: fe }) }),
o && /* @__PURE__ */ y(i, { ref: ae, style: ze, children: /* @__PURE__ */ y(o, { context: fe }) }),
s && /* @__PURE__ */ y(l, { ref: P, style: Ye, children: /* @__PURE__ */ y(s, { context: he }) }),
o && /* @__PURE__ */ y(i, { ref: pe, style: Ye, children: /* @__PURE__ */ y(o, { context: he }) }),
jn > 0 ? /* @__PURE__ */ y(
"div",
{
ref: pt,
ref: at,
"data-testid": "virtuoso-list",

@@ -1949,16 +1961,16 @@ style: {

},
children: ft.map((f) => /* @__PURE__ */ y(
children: pt.map((f) => /* @__PURE__ */ y(
qo,
{
mount: K,
unmount: Pe,
unmount: Ne,
item: f,
ItemContent: m
},
Kn({ index: f.index, data: f.data, context: fe })
Kn({ index: f.index, data: f.data, context: he })
))
}
) : k ? /* @__PURE__ */ y(k, { context: fe }) : null,
r && /* @__PURE__ */ y(h, { ref: Y, style: ze, children: /* @__PURE__ */ y(r, { context: fe }) }),
u && /* @__PURE__ */ y(p, { ref: X, style: ze, children: /* @__PURE__ */ y(u, { context: fe }) })
) : k ? /* @__PURE__ */ y(k, { context: he }) : null,
r && /* @__PURE__ */ y(h, { ref: Y, style: Ye, children: /* @__PURE__ */ y(r, { context: he }) }),
u && /* @__PURE__ */ y(p, { ref: Q, style: Ye, children: /* @__PURE__ */ y(u, { context: he }) })
]

@@ -1968,3 +1980,3 @@ }

}, qo = ({ item: e, ItemContent: t, mount: n, unmount: o }) => {
const s = V(Ce), i = g.useRef(null), l = g.useCallback(
const s = B(Oe), i = g.useRef(null), l = g.useCallback(
(r) => {

@@ -1991,3 +2003,3 @@ r ? (i.current = r, n(r)) : i.current && (o(i.current), i.current = null);

};
function Ye(e) {
function Ke(e) {
const t = g.useRef(null);

@@ -1994,0 +2006,0 @@ return [g.useCallback(

@@ -23,3 +23,3 @@ {

},
"version": "1.8.0-alpha.17",
"version": "1.8.0-alpha.18",
"type": "module",

@@ -26,0 +26,0 @@ "module": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc