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
0
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.23 to 1.8.0

41

CHANGELOG.md

@@ -0,1 +1,42 @@

# [1.8.0](https://github.com/virtuoso-dev/message-list/compare/v1.7.1...v1.8.0) (2024-07-07)
### Bug Fixes
* another take on animation ([318dfdc](https://github.com/virtuoso-dev/message-list/commit/318dfdc91ee3eedba98491e61f1fe0be95b861ba))
* avoid extra cancellation of scroll ([bcd478b](https://github.com/virtuoso-dev/message-list/commit/bcd478b4f34e5c672b6061a7c0e27598afa2eecf))
* console ([9294649](https://github.com/virtuoso-dev/message-list/commit/92946490c4bcdaa603a1e199d83b2154cd40c7c2))
* don't remount on data replace ([82e8c84](https://github.com/virtuoso-dev/message-list/commit/82e8c848be81d00b59529380e4ec69050adeb050))
* don't remount on data replace ([2af4e19](https://github.com/virtuoso-dev/message-list/commit/2af4e19c64c663db072a322753b29df65534ee1a))
* don't test for none ([e1a8a48](https://github.com/virtuoso-dev/message-list/commit/e1a8a486a927524eda0dccbf6249a6876c5ef3bc))
* extend timeout for livescroll ([ed13009](https://github.com/virtuoso-dev/message-list/commit/ed1300973625dd44c733fdcf0ac2381e551784f0))
* fix edge case of data replace ([2909623](https://github.com/virtuoso-dev/message-list/commit/2909623b0a1373b533f6b537d7f27f51e5af2435))
* improve catchup ([bfd1675](https://github.com/virtuoso-dev/message-list/commit/bfd1675be3aa72f4f6ceede7fd0ea959510deed6))
* improved atBottom flag logic ([9a36cd2](https://github.com/virtuoso-dev/message-list/commit/9a36cd29db1f33f8dfeda007039364646c29e670))
* increase debounce time ([07a52a6](https://github.com/virtuoso-dev/message-list/commit/07a52a6876062e3f94e763d78e749a57d2b9c410))
* instant scroll cancels smooth scroll ([2d55f43](https://github.com/virtuoso-dev/message-list/commit/2d55f438cb046645b79898d7dc391586ce971ad8))
* lint ([ecb15e6](https://github.com/virtuoso-dev/message-list/commit/ecb15e66089e0cbcb01e6c79dfcccd9759360946))
* more reliable autoscroll ([950dcc8](https://github.com/virtuoso-dev/message-list/commit/950dcc8a19bc610679a4ff9bc703aa4a8d474307))
* prepending works with uneven items, works on iPad ([2be5a70](https://github.com/virtuoso-dev/message-list/commit/2be5a709b1f331eb213c24bc84e5ad1bfcf9676b))
* relax react ([c492898](https://github.com/virtuoso-dev/message-list/commit/c49289800758475c2c196aaff44ac70192573b37))
* stabilize batch autoscroll ([5e82418](https://github.com/virtuoso-dev/message-list/commit/5e82418a8934126cd844f1e60b61c1145b000c11))
* strict mode ([521c9ba](https://github.com/virtuoso-dev/message-list/commit/521c9baef8b7d1d92953f6952d5e212eddad4696))
* switch to peer deps for react ([f992b02](https://github.com/virtuoso-dev/message-list/commit/f992b024368980e3db3fb3b6974e7e2e8a9e8c74))
* switch to peer deps for react ([4fcb5f3](https://github.com/virtuoso-dev/message-list/commit/4fcb5f3ed5205fff6d4e35cac89bf0d22cbbe8bb))
* testing something ([2f62e4f](https://github.com/virtuoso-dev/message-list/commit/2f62e4f1bba26f9bdfd5194819e5a10e4cc15e97))
* update dimensions when toggling footers ([1ce326c](https://github.com/virtuoso-dev/message-list/commit/1ce326c13dcc82bcdea852e0cc6c561ec923f725))
* use mousewheel for cancellation ([3f6fb62](https://github.com/virtuoso-dev/message-list/commit/3f6fb629155053cad649332acfd45bfac7342806))
### Features
* additional data manipulation methods ([88ebe5a](https://github.com/virtuoso-dev/message-list/commit/88ebe5a38507ef5b7ba6ee274b9685cee88fe257))
* control the smooth scroll ([74e6a9d](https://github.com/virtuoso-dev/message-list/commit/74e6a9d8c3c867cae5439731ead8b09dc774c53a))
* improve data.replace, optional purge parameter ([f73e083](https://github.com/virtuoso-dev/message-list/commit/f73e083cf61ac585bf207003e0bfd621fdcd7231))
* perf optimizations, custom scroll ([bc506cb](https://github.com/virtuoso-dev/message-list/commit/bc506cbd9678d6a378e916ab0fd612a84ffa0d5c))
* scroll into view ([4a52d62](https://github.com/virtuoso-dev/message-list/commit/4a52d62b075ad2cb3e41cdbd4f9354f016aebba3))
* support align start-no-overflow ([6d29d9b](https://github.com/virtuoso-dev/message-list/commit/6d29d9bbfaf3d82adb786d8446772f499d7af466))
* testing context, smooth scroll function, additional get methods ([d753986](https://github.com/virtuoso-dev/message-list/commit/d753986f6772bb2e35ae59f25234a00628afe12a))
* tree filtering ([b4efd6e](https://github.com/virtuoso-dev/message-list/commit/b4efd6e192d2b95735b527ebdfd5f63524d7135a))
# [1.8.0-alpha.23](https://github.com/virtuoso-dev/message-list/compare/v1.8.0-alpha.22...v1.8.0-alpha.23) (2024-06-19)

@@ -2,0 +43,0 @@

159

dist/index.d.ts

@@ -30,4 +30,10 @@ /// <reference types="react" />

context: Context;
}) => ScrollBehavior_2 | boolean | ItemLocation) | ScrollBehavior_2 | boolean;
}) => ScrollBehavior_2 | boolean | ItemLocation) | NonNullable<ScrollToOptions['behavior']> | boolean;
/**
* A function that describes the easing curve for the scroll animation.
* See {@link https://easings.net/ | easings.net} for examples of easing functions.
*/
export declare type BezierFunction = (x: number) => number;
/* Excluded from this release type: ComputeItemKey */

@@ -53,2 +59,70 @@

export declare interface DataMethods<Data = any, Context = any> {
/**
* Prepends additional items to the existing data in the list, while preserving the scroll position.
* @param data - The data to prepend.
*/
prepend: (data: Data[]) => void;
/**
* Appends additional items to the existing data in the list, while optionally updating the scroll position. See the {@link AutoscrollToBottom} type for more information.
* @param data - The data to append.
* @param scrollToBottom - Specifies the behavior when the list is scrolled to the bottom. You can pass a boolean, a `ScrollBehavior`, or a function that returns a `ScrollBehavior`.
*/
append: (data: Data[], scrollToBottom?: AutoscrollToBottom<Data, Context>) => void;
/**
* Updates the data in the list by applying a mapping function to each item. Optionally, you can specify a scroll behavior if the state change displaces the list (for example, if the item size increases).
* @param callbackfn - A function that maps the data items.
* @param autoscrollToBottomBehavior - Specifies the behavior to use to scroll to the bottom if necessary.
*/
map: (callbackfn: (data: Data, index: number) => Data, autoscrollToBottomBehavior?: 'smooth' | 'auto') => void;
/**
* Deletes items from the list data that match the predicate.
*/
findAndDelete: (predicate: (item: Data, index: number) => boolean) => void;
/**
* Finds the index of the first item that matches the predicate. If no elements satisfy the testing function, -1 is returned.
*/
findIndex: (predicate: (item: Data, index: number, data: Data[]) => boolean) => number;
/**
* Finds the first item that matches the predicate. If no elements satisfy the testing function, `undefined` is returned.
*/
find: (predicate: (item: Data, index: number, data: Data[]) => boolean) => Data | undefined;
/**
* Completely replaces the data in the list with the new data. Optionally, you can specify an initial scroll location after the data has been replaced. See the {@link ItemLocation} type for more information.
* @param data - The data to replace.
* @param options - the location to scroll to after the data has been replaced and whether to purge the item sizes.
*/
replace: (data: Data[], options?: {
initialLocation?: ItemLocation;
purgeItemSizes?: boolean;
}) => void;
/**
* Inserts the provided data at the specified offset, optionally updating the scroll position.
* @param data - The data to append.
* @param offset - The index that the first item in the data will be inserted at. e.g. [1,2,3] with offset 10 will insert the data at index 10, 11, and 12 and shift the rest of the existing data.
* @param scrollToBottom - Specifies the behavior when the list is scrolled to the bottom. You can pass a boolean, a `ScrollBehavior`, or a function that returns a `ScrollBehavior`.
*/
insert: (data: Data[], offset: number, scrollToBottom?: AutoscrollToBottom<Data, Context>) => void;
/**
* Deletes a range of items from the list data.
* @param offset - The index of the first item to delete.
* @param count - The number of items to delete.
*/
deleteRange: (offset: number, count: number) => void;
/**
* Batches the data operations in the provided callback in a single render cycle.
* @param callback - The callback that performs the data operations.
* @param scrollToBottom - Specifies the behavior when the list is scrolled to the bottom. You can pass a boolean, a `ScrollBehavior`, or a function that returns a `ScrollBehavior`.
*/
batch: (callback: () => void, scrollToBottom?: AutoscrollToBottom<Data, Context>) => void;
/**
* Gets a shallow copy of the current data in the list.
*/
get: () => Data[];
/**
* Gets the currently rendered data items.
*/
getCurrentlyRendered: () => Data[];
}
/* Excluded from this release type: DataRemoveRangeParams */

@@ -164,5 +238,9 @@

/**
* The DOM scroll behavior to use when scrolling to a location. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo}.
* The scroll behavior to use when scrolling to a location.
* You can also pass a custom scroll behavior function that returns an object with the number of animation frames and the easing function based on the current scroll top and the targetTop.
*/
declare type ScrollBehavior_2 = NonNullable<ScrollToOptions['behavior']>;
declare type ScrollBehavior_2 = 'smooth' | 'auto' | 'instant' | ((currentTop: number, targetTop: number) => {
animationFrameCount: number;
easing: BezierFunction;
});
export { ScrollBehavior_2 as ScrollBehavior }

@@ -222,3 +300,3 @@

*/
export declare function useVirtuosoMethods<Data = any, Context = any>(): VirtuosoMessageListMethods<Data, Context>;
export declare function useVirtuosoMethods<Data = unknown, Context = unknown>(): VirtuosoMessageListMethods<Data, Context>;

@@ -260,58 +338,3 @@ /**

*/
data: {
/**
* Prepends additional items to the existing data in the list, while preserving the scroll position.
* @param data - The data to prepend.
*/
prepend: (data: Data[]) => void;
/**
* Appends additional items to the existing data in the list, while optionally updating the scroll position. See the {@link AutoscrollToBottom} type for more information.
* @param data - The data to append.
* @param scrollToBottom - Specifies the behavior when the list is scrolled to the bottom. You can pass a boolean, a `ScrollBehavior`, or a function that returns a `ScrollBehavior`.
*/
append: (data: Data[], scrollToBottom?: AutoscrollToBottom<Data, Context>) => void;
/**
* Updates the data in the list by applying a mapping function to each item. Optionally, you can specify a scroll behavior if the state change displaces the list (for example, if the item size increases).
* @param callbackfn - A function that maps the data items.
* @param autoscrollToBottomBehavior - Specifies the behavior to use to scroll to the bottom if necessary.
*/
map: (callbackfn: (data: Data, index: number) => Data, autoscrollToBottomBehavior?: 'smooth' | 'auto') => void;
/**
* Deletes items from the list data that match the predicate.
*/
findAndDelete: (predicate: (item: Data, index: number) => boolean) => void;
/**
* Finds the index of the first item that matches the predicate. If no elements satisfy the testing function, -1 is returned.
*/
findIndex: (predicate: (item: Data, index: number, data: Data[]) => boolean) => number;
/**
* Finds the first item that matches the predicate. If no elements satisfy the testing function, `undefined` is returned.
*/
find: (predicate: (item: Data, index: number, data: Data[]) => boolean) => Data | undefined;
/**
* Completely replaces the data in the list with the new data. Optionally, you can specify an initial scroll location after the data has been replaced. See the {@link ItemLocation} type for more information.
* @param data - The data to append.
* @param initialLocation - the location to scroll to after the data has been replaced.
*/
replace: (data: Data[], initialLocation?: ItemLocation) => void;
/**
* Inserts the provided data at the specified offset, optionally updating the scroll position.
* @param data - The data to append.
* @param offset - The index that the first item in the data will be inserted at. e.g. [1,2,3] with offset 10 will insert the data at index 10, 11, and 12 and shift the rest of the existing data.
* @param scrollToBottom - Specifies the behavior when the list is scrolled to the bottom. You can pass a boolean, a `ScrollBehavior`, or a function that returns a `ScrollBehavior`.
*/
insert: (data: Data[], offset: number, scrollToBottom?: AutoscrollToBottom<Data, Context>) => void;
/**
* Deletes a range of items from the list data.
* @param offset - The index of the first item to delete.
* @param count - The number of items to delete.
*/
deleteRange: (offset: number, count: number) => void;
/**
* Batches the data operations in the provided callback in a single render cycle.
* @param callback - The callback that performs the data operations.
* @param scrollToBottom - Specifies the behavior when the list is scrolled to the bottom. You can pass a boolean, a `ScrollBehavior`, or a function that returns a `ScrollBehavior`.
*/
batch: (callback: () => void, scrollToBottom?: AutoscrollToBottom<Data, Context>) => void;
};
data: DataMethods<Data, Context>;
/**

@@ -429,13 +452,11 @@ * Scrolls the list to the specified item. See {@link ItemLocation} for possible location details. Passing a number scrolls to the item at the specified index aligned to the top.

shortSizeAlign?: ShortSizeAlign;
/**
* The function to use for smooth scrolling. The default value is `easeOutExpo`.
* Take a look at the {@link https://easings.net/ | easings.net} for more options, the functions there can be used directly.
*/
smoothScrollBezierFunction?: (x: number) => number;
/**
* The animation frames it will take for the smooth scroll to reach its final position. The default value is 50.
*/
smoothScrollAnimationFrameCount?: number;
}
export declare const VirtuosoMessageListTestingContext: default_2.Context<VirtuosoMessageListTestingContextValue | undefined>;
declare interface VirtuosoMessageListTestingContextValue {
viewportHeight: number;
itemHeight: number;
}
export { }

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

import { jsxs as Ut, jsx as I, Fragment as so } from "react/jsx-runtime";
import d from "react";
import { Cell as c, Signal as S, throttleTime as Ee, map as a, mapTo as H, debounceTime as le, filter as b, scan as G, withLatestFrom as y, delayWithMicrotask as Rt, onNext as qt, Action as io, useCellValue as O, useRealm as Mt, Realm as ro, RealmContext as lo, useCellValues as co } from "@mdxeditor/gurx";
import { jsxs as Jt, jsx as y, Fragment as io } from "react/jsx-runtime";
import h from "react";
import { Cell as c, Signal as x, throttleTime as ve, map as f, mapTo as W, debounceTime as re, filter as d, scan as J, withLatestFrom as S, delayWithMicrotask as Ct, onNext as Xt, Action as ro, useRealm as Ot, useCellValue as V, Realm as lo, RealmContext as co, useCellValues as uo } from "@mdxeditor/gurx";
function be(e, t) {

@@ -10,15 +10,15 @@ const n = c(e, (o) => {

}
const xe = { lvl: 0 };
function Gt(e, t, n, o = xe, s = xe) {
const Se = { lvl: 0 };
function Qt(e, t, n, o = Se, s = Se) {
return { k: e, l: o, lvl: n, r: s, v: t };
}
function k(e) {
return e === xe;
return e === Se;
}
function me() {
return xe;
function $e() {
return Se;
}
function dt(e, t) {
function kt(e, t) {
if (k(e))
return xe;
return Se;
const { k: n, l: o, r: s } = e;

@@ -31,9 +31,9 @@ if (t === n) {

{
const [i, r] = Zt(o);
return Ke(E(e, { k: i, l: Jt(o), v: r }));
const [i, r] = en(o);
return Xe(w(e, { k: i, l: tn(o), v: r }));
}
} else
return t < n ? Ke(E(e, { l: dt(o, t) })) : Ke(E(e, { r: dt(s, t) }));
return t < n ? Xe(w(e, { l: kt(o, t) })) : Xe(w(e, { r: kt(s, t) }));
}
function ce(e, t, n = "k") {
function ge(e, t, n = "k") {
if (k(e))

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

if (e[n] < t) {
const o = ce(e.r, t, n);
const o = ge(e.r, t, n);
return o[0] === -1 / 0 ? [e.k, e.v] : o;
}
return ce(e.l, t, n);
return ge(e.l, t, n);
}
function _(e, t, n) {
return k(e) ? Gt(t, n, 1) : t === e.k ? E(e, { k: t, v: n }) : t < e.k ? Pt(E(e, { l: _(e.l, t, n) })) : Pt(E(e, { r: _(e.r, t, n) }));
return k(e) ? Qt(t, n, 1) : t === e.k ? w(e, { k: t, v: n }) : t < e.k ? Kt(w(e, { l: _(e.l, t, n) })) : Kt(w(e, { r: _(e.r, t, n) }));
}
function vt(e, t, n) {
function It(e, t, n) {
if (k(e))

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

let l = [];
return o > t && (l = l.concat(vt(i, t, n))), o >= t && o <= n && l.push({ k: o, v: s }), o <= n && (l = l.concat(vt(r, t, n))), l;
return o > t && (l = l.concat(It(i, t, n))), o >= t && o <= n && l.push({ k: o, v: s }), o <= n && (l = l.concat(It(r, t, n))), l;
}
function uo(e, t, n, o) {
function ao(e, t, n, o) {
if (k(e))
return xe;
let s = me();
for (const { k: i, v: r } of ve(e))
return Se;
let s = $e();
for (const { k: i, v: r } of de(e))
i > t && i <= n ? s = _(s, ...o(i, r)) : s = _(s, i, r);
return s;
}
function ao(e, t, n) {
let o = me(), s = -1;
for (const { start: i, end: r, value: l } of po(e))
function po(e, t, n) {
let o = $e(), s = -1;
for (const { start: i, end: r, value: l } of fo(e))
i < t ? (o = _(o, i, l), s = l) : i > t + n ? o = _(o, i - n, l) : r >= t + n && s !== l && (o = _(o, t, l));
return o;
}
function ve(e) {
return k(e) ? [] : [...ve(e.l), { k: e.k, v: e.v }, ...ve(e.r)];
function de(e) {
return k(e) ? [] : [...de(e.l), { k: e.k, v: e.v }, ...de(e.r)];
}
function Zt(e) {
return k(e.r) ? [e.k, e.v] : Zt(e.r);
function en(e) {
return k(e.r) ? [e.k, e.v] : en(e.r);
}
function Jt(e) {
return k(e.r) ? e.l : Ke(E(e, { r: Jt(e.r) }));
function tn(e) {
return k(e.r) ? e.l : Xe(w(e, { r: tn(e.r) }));
}
function E(e, t) {
return Gt(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r);
function w(e, t) {
return Qt(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r);
}
function ht(e) {
function bt(e) {
return k(e) || e.lvl > e.r.lvl;
}
function Pt(e) {
return bt(tn(e));
function Kt(e) {
return St(rn(e));
}
function Ke(e) {
function Xe(e) {
const { l: t, r: n, lvl: o } = e;

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

if (o > n.lvl + 1) {
if (ht(t))
return tn(E(e, { lvl: o - 1 }));
if (bt(t))
return rn(w(e, { lvl: o - 1 }));
if (!k(t) && !k(t.r))
return E(t.r, {
l: E(t, { r: t.r.l }),
return w(t.r, {
l: w(t, { r: t.r.l }),
lvl: o,
r: E(e, {
r: w(e, {
l: t.r.r,

@@ -112,8 +112,8 @@ lvl: o - 1

} else {
if (ht(e))
return bt(E(e, { lvl: o - 1 }));
if (bt(e))
return St(w(e, { lvl: o - 1 }));
if (!k(n) && !k(n.l)) {
const s = n.l, i = ht(s) ? n.lvl - 1 : n.lvl;
return E(s, {
l: E(e, {
const s = n.l, i = bt(s) ? n.lvl - 1 : n.lvl;
return w(s, {
l: w(e, {
lvl: o - 1,

@@ -123,3 +123,3 @@ r: s.l

lvl: s.lvl + 1,
r: bt(E(n, { l: s.r, lvl: i }))
r: St(w(n, { l: s.r, lvl: i }))
});

@@ -130,12 +130,12 @@ } else

}
function po(e) {
return en(ve(e));
function fo(e) {
return sn(de(e));
}
function Xt(e, t, n) {
function nn(e, t, n) {
if (k(e))
return [];
const o = ce(e, t)[0];
return en(vt(e, o, n));
const o = ge(e, t)[0];
return sn(It(e, o, n));
}
function Qt(e, t) {
function on(e, t) {
const n = e.length;

@@ -152,18 +152,18 @@ if (n === 0)

}
function en(e) {
return Qt(e, ({ k: t, v: n }) => ({ index: t, value: n }));
function sn(e) {
return on(e, ({ k: t, v: n }) => ({ index: t, value: n }));
}
function bt(e) {
function St(e) {
const { r: t, lvl: n } = e;
return !k(t) && !k(t.r) && t.lvl === n && t.r.lvl === n ? E(t, { l: E(e, { r: t.l }), lvl: n + 1 }) : e;
return !k(t) && !k(t.r) && t.lvl === n && t.r.lvl === n ? w(t, { l: w(e, { r: t.l }), lvl: n + 1 }) : e;
}
function tn(e) {
function rn(e) {
const { l: t } = e;
return !k(t) && t.lvl === e.lvl ? E(t, { r: E(e, { l: t.r }) }) : e;
return !k(t) && t.lvl === e.lvl ? w(t, { r: w(e, { l: t.r }) }) : e;
}
function fo(e) {
function ho(e) {
const { size: t, startIndex: n, endIndex: o } = e;
return (s) => s.start === n && (s.end === o || s.end === 1 / 0) && s.value === t;
}
function ho(e, t) {
function go(e, t) {
let n = k(e) ? 0 : 1 / 0;

@@ -176,24 +176,24 @@ for (const o of t) {

}
const l = Xt(e, i - 1, r + 1);
if (l.some(fo(o)))
const l = nn(e, i - 1, r + 1);
if (l.some(ho(o)))
continue;
let u = !1, f = !1;
for (const { start: p, end: h, value: m } of l)
u ? (r >= p || s === m) && (e = dt(e, p)) : (f = m !== s, u = !0), h > r && r >= p && m !== s && (e = _(e, r + 1, m));
f && (e = _(e, i, s));
let u = !1, a = !1;
for (const { start: p, end: b, value: m } of l)
u ? (r >= p || s === m) && (e = kt(e, p)) : (a = m !== s, u = !0), b > r && r >= p && m !== s && (e = _(e, r + 1, m));
a && (e = _(e, i, s));
}
return [e, n];
}
const et = [me(), 0];
function go(e, [t, n]) {
const ct = [$e(), 0];
function vo(e, [t, n]) {
if (n.length > 0 && k(e) && t.length === 2) {
const o = t[0].size, s = t[1].size;
return [
n.reduce((i, r) => _(_(i, r, o), r + 1, s), me()),
n.reduce((i, r) => _(_(i, r, o), r + 1, s), $e()),
0
];
} else
return ho(e, t);
return go(e, t);
}
function Je(e, t, n, o = 0) {
function it(e, t, n, o = 0) {
let s = e.length - 1;

@@ -216,52 +216,52 @@ for (; o <= s; ) {

}
function nn(e, t, n) {
return e[Je(e, t, n)];
function ln(e, t, n) {
return e[it(e, t, n)];
}
function vo(e, t, n, o) {
const s = Je(e, t, o), i = Je(e, n, o, s);
function bo(e, t, n, o) {
const s = it(e, t, o), i = it(e, n, o, s);
return e.slice(s, i + 1);
}
function At({ index: e }, t) {
function Ht({ index: e }, t) {
return t === e ? 0 : t < e ? -1 : 1;
}
function bo({ offset: e }, t) {
function mo({ offset: e }, t) {
return t === e ? 0 : t < e ? -1 : 1;
}
function mo(e) {
function ko(e) {
return { index: e.index, value: e };
}
function ko(e, t, n, o = 0) {
return o > 0 && (t = Math.max(t, nn(e, o, At).offset)), t = Math.max(0, t), Qt(vo(e, t, n, bo), mo);
function Io(e, t, n, o = 0) {
return o > 0 && (t = Math.max(t, ln(e, o, Ht).offset)), t = Math.max(0, t), on(bo(e, t, n, mo), ko);
}
const Te = [[], 0, 0, 0];
const xe = [[], 0, 0, 0];
function So(e, [t, n]) {
let o = 0, s = 0, i = 0, r = 0;
if (n !== 0) {
r = Je(e, n - 1, At), i = e[r].offset;
const u = ce(t, n - 1);
o = u[0], s = u[1], e.length && e[r].height === ce(t, n)[1] && (r -= 1), e = e.slice(0, r + 1);
r = it(e, n - 1, Ht), i = e[r].offset;
const u = ge(t, n - 1);
o = u[0], s = u[1], e.length && e[r].height === ge(t, n)[1] && (r -= 1), e = e.slice(0, r + 1);
} else
e = [];
for (const { start: l, value: u } of Xt(t, n, 1 / 0)) {
const f = (l - o) * s + i;
e.push({ height: u, index: l, offset: f }), o = l, i = f, s = u;
for (const { start: l, value: u } of nn(t, n, 1 / 0)) {
const a = (l - o) * s + i;
e.push({ height: u, index: l, offset: a }), o = l, i = a, s = u;
}
return [e, s, i, o];
}
function on(e, t) {
function cn(e, t) {
if (t.length === 0)
return [0, 0];
const { offset: n, index: o, height: s } = nn(t, e, At);
const { offset: n, index: o, height: s } = ln(t, e, Ht);
return [s * (e - o) + n, s];
}
function Io(e, t) {
return on(e, t)[0];
function xt(e, t) {
return cn(e, t)[0];
}
function sn(e, t) {
function un(e, t) {
return Math.abs(e - t) < 1.01;
}
function rn() {
return typeof navigator > "u" ? !1 : /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent);
function xo() {
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 ln(e) {
function an(e) {
return !e;

@@ -272,3 +272,3 @@ }

}
const cn = "up", gt = "down", xo = "none", To = {
const pn = "up", mt = "down", To = "none", $o = {
atBottom: !1,

@@ -283,4 +283,4 @@ notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",

}
}, $o = 0, Eo = 4;
function Nt(e) {
}, Eo = 0, wo = 4;
function jt(e) {
return (t, n) => {

@@ -294,19 +294,19 @@ const o = n.signalInstance();

c(!1);
const un = c(!0);
S();
const de = c(!1), wo = S((e) => {
e.link(e.pipe(un, Ee(50)), wo);
}), an = c(Eo), Lo = c($o, (e) => {
const fn = c(!0);
x();
const fe = c(!1), Lo = x((e) => {
e.link(e.pipe(fn, ve(50)), Lo);
}), hn = c(wo), Ro = c(Eo, (e) => {
e.link(
e.pipe(
e.combine(x, Lo),
a(([t, n]) => t <= n)
e.combine(T, Ro),
f(([t, n]) => t <= n)
),
un
fn
);
}), De = c(!1, (e) => {
e.link(e.pipe(x, Nt(1), H(!0)), De), e.link(e.pipe(x, Nt(1), H(!1), le(100)), De);
}), mt = c(!1, (e) => {
e.link(e.pipe(ee, H(!0)), mt), e.link(e.pipe(ee, H(!1), le(200)), mt);
}), pn = c(!1), je = c(
}), Ve = c(!1, (e) => {
e.link(e.pipe(T, jt(1), W(!0)), Ve), e.link(e.pipe(T, jt(1), W(!1), re(100)), Ve);
}), yt = c(!1, (e) => {
e.link(e.pipe(Q, W(!0)), yt), e.link(e.pipe(Q, W(!1), re(200)), yt);
}), gn = c(!1), Qe = c(
null,

@@ -316,6 +316,6 @@ (e) => {

e.pipe(
e.combine(U, x, X, kn, an, it, J),
b(([, , , , , , t]) => !k(t)),
G((t, [n, o, s, i, r]) => {
const u = o + s - n > -r, f = {
e.combine(j, T, U, xn, hn, pt, X),
d(([, , , , , , t]) => !k(t)),
J((t, [n, o, s, i, r]) => {
const u = o + s - n > -r, a = {
viewportWidth: i,

@@ -327,7 +327,7 @@ viewportHeight: s,

if (u) {
let h, m;
return o > t.state.scrollTop ? (h = "SCROLLED_DOWN", m = t.state.scrollTop - o) : (h = n === s ? "LIST_TOO_SHORT" : "SIZE_DECREASED", m = t.state.scrollTop - o || t.scrollTopDelta), {
let b, m;
return o > t.state.scrollTop ? (b = "SCROLLED_DOWN", m = t.state.scrollTop - o) : (b = n === s ? "LIST_TOO_SHORT" : "SIZE_DECREASED", m = t.state.scrollTop - o || t.scrollTopDelta), {
atBottom: !0,
state: f,
atBottomBecause: h,
state: a,
atBottomBecause: b,
scrollTopDelta: m

@@ -337,17 +337,17 @@ };

let p;
return s < t.state.viewportHeight ? p = "VIEWPORT_HEIGHT_DECREASING" : i < t.state.viewportWidth ? p = "VIEWPORT_WIDTH_DECREASING" : f.scrollHeight > t.state.scrollHeight ? p = "SIZE_INCREASED" : o < t.state.scrollTop ? p = "SCROLLING_UPWARDS" : p = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
return s < t.state.viewportHeight ? p = "VIEWPORT_HEIGHT_DECREASING" : i < t.state.viewportWidth ? p = "VIEWPORT_WIDTH_DECREASING" : a.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: f
state: a
};
}, To)
}, $o)
),
je
Qe
), e.link(
e.pipe(
je,
Ee(10),
Qe,
ve(10),
// withLatestFrom(scrollToInProgress$),
// filter(([, inProgress]) => !inProgress),
G(
J(
({ prev: t }, n) => {

@@ -362,10 +362,10 @@ const o = !!(t && n && t.atBottom && !n.atBottom && n.notAtBottomBecause === "SIZE_INCREASED");

),
a(({ shouldScroll: t }) => t)
f(({ shouldScroll: t }) => t)
),
pn
gn
), e.sub(
e.pipe(
X,
y(je),
G(
U,
S(Qe),
J(
(t, [n, o]) => {

@@ -379,3 +379,3 @@ let s = 0;

(t) => {
t.delta && e.pub(ee, { top: t.delta });
t.delta && e.pub(Q, t.delta);
}

@@ -385,9 +385,9 @@ );

(e, t) => e ? e.atBottom === (t == null ? void 0 : t.atBottom) : !1
), fn = c(0, (e) => {
), dn = c(0, (e) => {
e.link(
e.pipe(
e.combine(x, U, X),
G(
e.combine(T, j, U),
J(
(t, [n, o, s]) => {
if (sn(t.scrollHeight, o))
if (un(t.scrollHeight, o))
return {

@@ -416,33 +416,33 @@ scrollTop: n,

),
b((t) => t.changed),
a((t) => t.jump)
d((t) => t.changed),
f((t) => t.jump)
),
fn
dn
);
}), kt = c(gt, (e) => {
}), Tt = c(mt, (e) => {
e.link(
e.pipe(
x,
G(
(t, n) => e.getValue(mt) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? cn : gt, prevScrollTop: n },
{ direction: gt, prevScrollTop: 0 }
T,
J(
(t, n) => e.getValue(yt) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? pn : mt, prevScrollTop: n },
{ direction: mt, prevScrollTop: 0 }
),
a((t) => t.direction)
f((t) => t.direction)
),
kt
), e.link(e.pipe(x, le(100), H(xo)), kt);
}), zt = c(0, (e) => {
e.link(e.pipe(De, b(ln), H(0)), zt), e.link(
Tt
), e.link(e.pipe(T, re(100), W(To)), Tt);
}), Ut = c(0, (e) => {
e.link(e.pipe(Ve, d(an), W(0)), Ut), e.link(
e.pipe(
x,
Ee(100),
y(De),
b(([, t]) => !!t),
G(([, t], [n]) => [t, n], [0, 0]),
a(([t, n]) => n - t)
T,
ve(100),
S(Ve),
d(([, t]) => !!t),
J(([, t], [n]) => [t, n], [0, 0]),
f(([t, n]) => n - t)
),
zt
Ut
);
});
function Ct(e, t) {
function Vt(e, t) {
if (typeof e == "number")

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

}
function hn({
function vn({
location: e,

@@ -475,61 +475,61 @@ sizeTree: t,

}) {
const { align: f, behavior: p, offset: h, index: m } = Ct(e, s - 1);
function T() {
const z = ce(t, m)[1];
if (z === void 0)
const { align: a, behavior: p, offset: b, index: m } = Vt(e, s - 1);
function $() {
const Y = ge(t, m)[1];
if (Y === void 0)
throw new Error(`Item at index ${m} not found`);
return z;
return Y;
}
i -= l + u;
let g = Io(m, n) + r - l;
f === "end" ? g = g - i + T() : f === "center" && (g = g - i / 2 + T() / 2), h && (g += h);
let V = 0;
return f === "start" && (V = Math.max(0, Math.min(g - (o - i)))), g = Math.max(0, g), { top: g, behavior: p, align: f, forceBottomSpace: V };
let I = xt(m, n) + r - l;
a === "end" ? I = I - i + $() : a === "center" && (I = I - i / 2 + $() / 2), b && (I += b);
let v = 0;
return a === "start" && (v = Math.max(0, Math.min(I - (o - i)))), I = Math.max(0, I), { top: I, behavior: p, align: a, forceBottomSpace: v };
}
const Re = c(null), Ro = c(!1), Ue = c(!0), St = S((e) => {
const Me = c(null), Mo = c(!1), et = c(!0), $t = x((e) => {
e.link(
e.pipe(
St,
a(() => !0)
$t,
f(() => !0)
),
Ue
et
), e.link(
e.pipe(
St,
a(() => null)
$t,
f(() => null)
),
Re
Me
);
}), gn = S((e) => {
}), bn = x((e) => {
e.link(
e.pipe(
gn,
y(ke, ot, Pe),
a(([t, n, o, s]) => {
let { align: i, behavior: r, offset: l, index: u } = Ct(t, n - 1);
const f = typeof t != "number" ? t.done : void 0, [p, h] = on(u, o);
return p < -s.listOffset ? ((typeof t == "number" || t.align === void 0) && (i = "start-no-overflow"), { index: u, align: i, behavior: r, offset: l, done: f }) : p + h > -s.listOffset + s.visibleListHeight ? ((typeof t == "number" || t.align === void 0) && (i = "end"), { index: u, align: i, behavior: r, offset: l, done: f }) : null;
bn,
S(me, ye, je),
f(([t, n, o, s]) => {
let { align: i, behavior: r, offset: l, index: u } = Vt(t, n - 1);
const a = typeof t != "number" ? t.done : void 0, [p, b] = cn(u, o);
return p < -s.listOffset ? ((typeof t == "number" || t.align === void 0) && (i = "start-no-overflow"), { index: u, align: i, behavior: r, offset: l, done: a }) : p + b > -s.listOffset + s.visibleListHeight ? ((typeof t == "number" || t.align === void 0) && (i = "end"), { index: u, align: i, behavior: r, offset: l, done: a }) : null;
}),
b((t) => t !== null)
d((t) => t !== null)
),
// @ts-expect-error contra variance
q
Z
);
}), q = S((e) => {
}), Z = x((e) => {
const t = e.pipe(
q,
y(
J,
ot,
ke,
Z,
S(
X,
st,
Ve,
Fe,
ye,
me,
U,
at,
ze,
Ke,
we
),
a(
([n, o, s, i, r, l, u, f, p]) => {
f(
([n, o, s, i, r, l, u, a, p]) => {
try {
return hn({
return vn({
location: n,

@@ -543,3 +543,3 @@ totalHeight: p,

stickyHeaderHeight: u,
stickyFooterHeight: f
stickyFooterHeight: a
});

@@ -551,81 +551,80 @@ } catch {

),
b((n) => n !== null)
d((n) => n !== null)
);
e.link(q, Re), e.link(t, $e), e.link(
e.link(Z, Me), e.link(t, Te), e.link(
e.pipe(
q,
b((n) => typeof n != "number" && n.index === "LAST"),
H(!0)
Z,
d((n) => typeof n != "number" && n.index === "LAST"),
W(!0)
),
de
), e.link(e.pipe(t, H(!1)), Ue), e.link(e.pipe(t, H(!1)), Ro), e.link(
fe
), e.link(e.pipe(t, W(!1)), et), e.link(e.pipe(t, W(!1)), Mo), e.link(
e.pipe(
J,
le(0),
y(Ue, Re),
b(([, n, o]) => !n && o !== null),
a(([, , n]) => n)
X,
re(0),
S(et, Me),
d(([, n, o]) => !n && o !== null),
f(([, , n]) => n)
),
q
), e.sub(e.pipe(Be, Ee(20)), () => {
const n = e.getValue(Re);
Z
), e.sub(e.pipe(Ne, ve(20)), () => {
const n = e.getValue(Me);
n !== null && typeof n != "number" && n.done !== void 0 && n.done(), e.pubIn({
[Re]: null,
[Ue]: !0
[Me]: null,
[et]: !0
});
}), e.link(
e.pipe(
Ze,
ot,
// wait for the list to render with the specified scrollOffset, so that enough space is available to scroll by
Rt(),
b((n) => n !== 0),
a((n) => ({ top: n }))
Ct(),
d((n) => n !== 0)
),
ee
Q
), e.link(
e.pipe(
Ze,
qt(x),
a(() => 0)
ot,
Xt(T),
f(() => 0)
),
Ze
ot
);
}), Me = c(null), Xe = c(null, (e) => {
}), Ae = c(null), We = c(null, (e) => {
e.link(
e.pipe(
Xe,
b((n) => n !== null)
We,
d((n) => n !== null)
),
Me
Ae
);
const t = e.pipe(
e.combine(Xe, J),
y(Me),
b(([[n, o], s]) => n !== null && !k(o) && s !== null),
le(10),
a(([[n]]) => n)
e.combine(We, X),
S(Ae),
d(([[n, o], s]) => n !== null && !k(o) && s !== null),
re(10),
f(([[n]]) => n)
);
e.link(e.pipe(t, Rt()), q), e.link(
e.link(e.pipe(t, Ct()), Z), e.link(
e.pipe(
t,
qt(e.pipe(_e, b(ln))),
H(null),
Xt(e.pipe(Pe, d(an))),
W(null),
// unset the location after the scroll completes
le(10)
re(10)
),
Me
Ae
);
});
function Mo(e, t) {
function Do(e, t) {
const n = t.slice();
let o = 0;
const s = [];
ve(e).forEach(({ k: r, v: l }) => {
var p, h;
de(e).forEach(({ k: r, v: l }) => {
var p, b;
for (; n.length && n[0] < r; )
n.shift(), o++;
const u = Math.max(0, r - o), f = ((p = s.at(-1)) == null ? void 0 : p.k) ?? -1;
u === f ? (((h = s.at(-2)) == null ? void 0 : h.v) ?? -1) === l ? s.pop() : s[s.length - 1].v = l : s.push({ k: u, v: l });
const u = Math.max(0, r - o), a = ((p = s.at(-1)) == null ? void 0 : p.k) ?? -1;
u === a ? (((b = s.at(-2)) == null ? void 0 : b.v) ?? -1) === l ? s.pop() : s[s.length - 1].v = l : s.push({ k: u, v: l });
});
let i = me();
let i = $e();
return s.forEach(({ k: r, v: l }) => {

@@ -648,3 +647,3 @@ i = _(i, r, l);

}
const Co = [], Ne = {
const Co = [], De = {
items: Co,

@@ -658,28 +657,28 @@ listBottom: 0,

data: null
}, He = c(Ne, (e) => {
}, Ee = c(De, (e) => {
e.link(
e.pipe(
e.combine(
Do,
En,
J,
Ho,
$n,
X,
ye,
me,
we,
O,
ot,
ke,
we,
B,
Ze,
Xe,
Me,
We,
Ve,
Fe,
Ae,
Ye,
ze,
Ke,
F,
Z,
W
he,
K
),
b((t) => {
d((t) => {
const n = t[t.length - 2], o = t[t.length - 1];
return !n && !o;
}),
G(
J(
(t, [

@@ -693,68 +692,68 @@ n,

u,
f,
a,
p,
h,
b,
m,
T,
g,
V
$,
I,
v
]) => {
var fe;
var Ge;
if ((u == null ? void 0 : u.length) === 0)
return Ne;
return De;
if (k(s)) {
let K = 0;
return p !== null && (K = Ct(p, r - 1).index), { ...Ne, items: Ao(K, u), offsetTree: i, totalCount: r, data: u };
let N = 0;
return p !== null && (N = Vt(p, r - 1).index), { ...De, items: Ao(N, u), offsetTree: i, totalCount: r, data: u };
}
let z = 0;
h !== null && n === 0 && (z = hn({
let Y = 0;
b !== null && n === 0 && (Y = vn({
totalHeight: l,
location: h,
location: b,
sizeTree: s,
offsetTree: i,
totalCount: r,
viewportHeight: e.getValue(X),
headerHeight: e.getValue(st),
stickyHeaderHeight: T,
stickyFooterHeight: g
viewportHeight: e.getValue(U),
headerHeight: e.getValue(at),
stickyHeaderHeight: $,
stickyFooterHeight: I
}).top ?? 0);
const P = Math.max(
n + z + f - V - m,
0
), ae = P + o;
if (t.offsetTree === i && t.totalCount === r && t.data === u && P >= t.listTop && ae <= t.listBottom)
const B = Math.min(
Math.max(n + Y + a - v - m, 0),
l - o
), ce = B + o;
if (t.offsetTree === i && t.totalCount === r && t.data === u && B >= t.listTop && ce <= t.listBottom)
return t;
const pe = [], Le = r - 1, te = 0, Y = ko(i, P, ae, te);
let w = 0, L = 0, $ = !1;
for (const K of Y) {
const ue = [], q = r - 1, P = 0, L = Io(i, B, ce, P);
let R = 0, Ue = 0, qe = !1;
for (const N of L) {
const {
value: { offset: Se, height: Q }
} = K;
let j = K.start;
w = Se, Se < P && (j += Math.floor((P - Se) / Q), w += (j - K.start) * Q), j < te && (w += (te - j) * Q, j = te);
const ct = Math.min(K.end, Le);
for (let oe = j; oe <= ct && !(w >= ae); oe++) {
const ut = {
data: u == null ? void 0 : u[oe],
prevData: (u == null ? void 0 : u[oe - 1]) ?? null,
nextData: (u == null ? void 0 : u[oe + 1]) ?? null,
height: Q,
index: oe,
offset: w,
value: { offset: ke, height: te }
} = N;
let G = N.start;
R = ke, ke < B && (G += Math.floor((B - ke) / te), R += (G - N.start) * te), G < P && (R += (P - G) * te, G = P);
const Le = Math.min(N.end, q);
for (let ne = G; ne <= Le && !(R >= ce); ne++) {
const ht = {
data: u == null ? void 0 : u[ne],
prevData: (u == null ? void 0 : u[ne - 1]) ?? null,
nextData: (u == null ? void 0 : u[ne + 1]) ?? null,
height: te,
index: ne,
offset: R,
type: "flat"
};
$ || ($ = !0, L = w), pe.push(ut), w += Q;
qe || (qe = !0, Ue = R), ue.push(ht), R += te;
}
}
const ne = l - w, lt = ((fe = pe[0]) == null ? void 0 : fe.offset) || 0;
return { items: pe, listBottom: w, listTop: L, offsetTree: i, paddingBottom: ne, paddingTop: lt, totalCount: r, data: u };
const E = l - R, ee = ((Ge = ue[0]) == null ? void 0 : Ge.offset) || 0;
return { items: ue, listBottom: R, listTop: Ue, offsetTree: i, paddingBottom: E, paddingTop: ee, totalCount: r, data: u };
},
Ne
De
)
),
He
Ee
);
}), It = be([], (e) => e.pipe(
e.combine(He, x),
a(([t, n]) => {
}), rt = be([], (e) => e.pipe(
e.combine(Ee, T),
f(([t, n]) => {
const o = t.items.slice();

@@ -765,109 +764,131 @@ for (; o.length > 0 && o[0].offset + o[0].height < n; )

})
)), W = c(!1), qe = S((e) => {
)), K = c(!1), Ce = c(!1), tt = x((e) => {
e.link(
e.pipe(
He,
y(fn, Z),
b(([, , t]) => !t),
G(
Ee,
S(dn, he),
d(([, , t]) => !t),
J(
([, t, n, o], [{ items: s, totalCount: i, listBottom: r, paddingBottom: l }, u]) => {
const f = r + l;
const a = r + l;
let p = 0;
return n === i && t.length > 0 && s.length > 0 && (p = f - o, p !== 0 && (p += u)), [p, s, i, f];
return n === i && t.length > 0 && s.length > 0 && (p = a - o, p !== 0 && (p += u)), [p, s, i, a];
},
[0, [], 0, 0]
),
b(([t]) => t !== 0),
y(x, kt, _e),
b(([, t, n, o]) => !o && t !== 0 && n === cn),
a(([[t]]) => t)
d(([t]) => t !== 0),
S(T, Tt, Pe),
d(([, t, n, o]) => !o && t !== 0 && n === pn),
f(([[t]]) => t)
),
qe
), rn() ? (e.sub(e.pipe(qe, y(F, x)), ([t, n]) => {
tt
), xo() ? (e.sub(e.pipe(tt, S(F, T)), ([t, n]) => {
e.pub(F, n - t);
}), e.sub(e.pipe(e.combine(x, F, Z)), ([t, n, o]) => {
o || (n > 0 && t < n ? (e.pub(W, !0), e.pub($e, { top: 0, behavior: "instant" }), setTimeout(() => {
e.pubIn({
[W]: !1,
}), e.sub(
e.pipe(e.combine(T, F, he, Ce)),
([t, n, o, s]) => {
o || s || (n > 0 && t < n ? (e.pub(K, !0), e.pub(Te, { top: 0, behavior: "instant" }), setTimeout(() => {
e.pubIn({
[K]: !1,
[F]: 0
});
})) : n < 0 && t <= 0 && (e.pubIn({
[K]: !0,
[F]: 0
});
})) : n < 0 && t <= 0 && (e.pubIn({
[W]: !0,
[F]: 0
}), setTimeout(() => {
e.pub($e, { top: 0, behavior: "instant" }), e.pub(W, !1);
})));
}), e.sub(
}), setTimeout(() => {
e.pub(Te, { top: 0, behavior: "instant" }), e.pub(K, !1);
})));
}
), e.sub(
e.pipe(
e.combine(De, F, W, Z),
b(([t, n, o, s]) => !t && n !== 0 && !o && !s),
Ee(100)
e.combine(Ve, F, K, he, Ce),
d(
([t, n, o, s, i]) => !t && n !== 0 && !o && !s && !i
),
ve(100)
),
([, t]) => {
e.pub(W, !0), t < 0 ? requestAnimationFrame(() => {
e.pub(ee, { top: -t, behavior: "instant" }), e.pub(F, 0), requestAnimationFrame(() => {
e.pub(W, !1);
e.pub(K, !0), t < 0 ? requestAnimationFrame(() => {
e.pub(Q, -t), e.pub(F, 0), requestAnimationFrame(() => {
e.pub(K, !1);
});
}) : requestAnimationFrame(() => {
e.pub(ee, { top: -t, behavior: "instant" }), e.pub(F, 0), requestAnimationFrame(() => {
e.pub(W, !1);
e.pub(Q, -t), e.pub(F, 0), requestAnimationFrame(() => {
e.pub(K, !1);
});
});
}
)) : e.link(
e.pipe(
qe,
a((t) => ({ top: t, behavior: "auto" }))
),
ee
);
}), ke = c(0), Oe = c(null), B = c(null, (e) => {
)) : e.link(tt, Q);
}), me = c(0), _e = c(null), O = c(null, (e) => {
e.link(
e.pipe(
B,
b((t) => t !== null),
a((t) => t.length)
O,
d((t) => t !== null),
f((t) => t.length)
),
ke
me
);
}), ie = S((e) => {
e.link(e.pipe(ie, H(!0)), Z);
const t = rn();
}), Re = c(null), se = x((e) => {
e.link(
e.pipe(
ie,
y(ye),
a(([n, o]) => o * n.length)
se,
S(Be),
f(([n, o]) => -(o * n.length))
),
F
), e.link(e.pipe(ie, H(t)), W), e.sub(
), e.link(e.pipe(se, W(!0)), Ce), e.link(e.pipe(se, Ct()), Re);
function t(n, o) {
e.pubIn({
[Q]: n,
[st]: n
}), o ? requestAnimationFrame(() => {
e.pubIn({
[F]: 0,
[st]: 0,
[Re]: null,
[Ce]: !1
});
}) : e.pubIn({
[F]: 0,
[st]: 0,
[Re]: null,
[Ce]: !1
});
}
e.sub(
e.pipe(
ie,
y(ye),
a(([n, o]) => ({
top: o * n.length,
behavior: "instant"
})),
Rt()
ye,
S(Re),
d(([, n]) => n !== null),
f(([n, o]) => {
if (o === null)
throw new Error("Unexpected null items");
return xt(o.length, n);
})
),
(n) => {
e.pubIn({
[ee]: n
}), t ? setTimeout(() => {
e.pub(F, 0), e.pub(Z, !1), e.pub(W, !1);
}, 100) : requestAnimationFrame(() => {
e.pub(F, 0), e.pub(Z, !1);
});
t(n, !1);
}
), e.changeWith(B, ie, (n, o) => n ? [...o, ...n] : o.slice()), e.link(
), e.sub(
e.pipe(
ie,
y(J, ye),
a(([n, o, s]) => {
se,
Oo(2),
S(ye, Re),
d(([, , n]) => n !== null),
f(([n, o]) => xt(n.length, o))
),
(n) => {
t(n, !0);
}
), e.changeWith(O, se, (n, o) => n ? [...o, ...n] : o.slice()), e.link(
e.pipe(
se,
S(X, Be),
f(([n, o, s]) => {
const i = n.length, r = s;
return ve(o).reduce(
(l, { k: u, v: f }) => ({
ranges: [...l.ranges, { startIndex: l.prevIndex, endIndex: u + i - 1, size: l.prevSize }],
prevIndex: u + i,
prevSize: f
return de(o).reduce(
(u, { k: a, v: p }) => ({
ranges: [...u.ranges, { startIndex: u.prevIndex, endIndex: a + i - 1, size: u.prevSize }],
prevIndex: a + i,
prevSize: p
}),

@@ -882,16 +903,16 @@ {

),
nt
Fe
);
}), tt = S((e) => {
}), ut = x((e) => {
const t = e.pipe(
tt,
y(Pe, Dt, Oe, J),
b(([, , , , o]) => !k(o)),
a(([{ data: o, scrollToBottom: s }, i, r, l]) => {
ut,
S(je, Wt, _e, X),
d(([, , , , o]) => !k(o)),
f(([{ data: o, scrollToBottom: s }, i, r, l]) => {
if (s === !1 || s === void 0)
return null;
let u = "auto";
const f = i.isAtBottom;
const a = i.isAtBottom;
if (typeof s == "function") {
const p = s({ data: o, scrollLocation: i, scrollInProgress: r, context: l, atBottom: f });
const p = s({ data: o, scrollLocation: i, scrollInProgress: r, context: l, atBottom: a });
if (!p)

@@ -905,3 +926,3 @@ return null;

} else {
if (!f)
if (!a)
return null;

@@ -916,19 +937,19 @@ u = s;

t,
b((o) => o !== null),
a(() => !0)
d((o) => o !== null),
f(() => !0)
),
de
fe
), e.link(
e.pipe(
Be,
y(de),
b(([o, s]) => s),
a(() => !1)
Ne,
S(fe),
d(([o, s]) => s),
f(() => !1)
),
de
fe
);
const n = e.pipe(
Ht,
y(de),
b(([o, s]) => o === "up" && s)
Ft,
S(fe),
d(([o, s]) => o === "up" && s)
);

@@ -938,44 +959,44 @@ e.link(

n,
a(() => !1)
f(() => !1)
),
de
), e.link(e.pipe(n, H(!0)), St), e.link(
fe
), e.link(e.pipe(n, W(!0)), $t), e.link(
e.pipe(
t,
b((o) => o !== null),
le(20)
d((o) => o !== null),
re(20)
),
q
Z
);
}), Qe = S((e) => {
e.changeWith(B, Qe, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(Qe, tt);
}), Ge = S((e) => {
e.changeWith(B, Ge, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ue, Ge, ([t], n) => {
const s = ce(t, n.offset, "k")[0], i = n.data.length;
return [uo(t, s, 1 / 0, (l, u) => [l + i, u]), s];
}), e.link(Ge, tt);
}), yt = S((e) => {
e.changeWith(B, yt, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ue, yt, ([t], { offset: n, count: o }) => [ao(t, n, o), n]);
}), Ae = S((e) => {
e.changeWith(B, Ae, (t, n) => n.data.slice()), e.link(
}), lt = x((e) => {
e.changeWith(O, lt, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(lt, ut);
}), nt = x((e) => {
e.changeWith(O, nt, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(le, nt, ([t], n) => {
const s = ge(t, n.offset, "k")[0], i = n.data.length;
return [ao(t, s, 1 / 0, (l, u) => [l + i, u]), s];
}), e.link(nt, ut);
}), Et = x((e) => {
e.changeWith(O, Et, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(le, Et, ([t], { offset: n, count: o }) => [po(t, n, o), n]);
}), Oe = x((e) => {
e.link(
e.pipe(
Ae,
a(({ initialLocation: t }) => t)
Oe,
d(({ purgeItemSizes: t }) => !!t),
f(({ initialLocation: t }) => t)
),
q
), e.changeWith(ue, Ae, (t, n) => {
const o = ce(t[0], 1 / 0, "k")[1];
if (!o)
return et;
let s = me();
return s = _(s, 0, o), [s, 0];
We
), e.changeWith(Ee, Oe, (t, { purgeItemSizes: n }) => n ? De : t), e.sub(e.pipe(Oe, ve(0)), ({ data: t, purgeItemSizes: n, initialLocation: o }) => {
e.pubIn({
[O]: t.slice(),
...n ? { [le]: ct } : o ? { [Z]: o } : {}
});
});
}), Yt = S((e) => {
e.changeWith(B, Yt, (t, n) => t ? t.slice(n) : []), e.changeWith(ue, Yt, ([t], n) => [ve(t).reduce((s, { k: i, v: r }) => _(s, Math.max(0, i - n), r), me()), 0]);
}), Kt = S((e) => {
e.changeWith(B, Kt, (t, n) => t ? t.slice(0, t.length - n) : []), e.link(
}), qt = x((e) => {
e.changeWith(O, qt, (t, n) => t ? t.slice(n) : []), e.changeWith(le, qt, ([t], n) => [de(t).reduce((s, { k: i, v: r }) => _(s, Math.max(0, i - n), r), $e()), 0]);
}), Gt = x((e) => {
e.changeWith(O, Gt, (t, n) => t ? t.slice(0, t.length - n) : []), e.link(
e.pipe(
Kt,
y(ke, ye),
a(([, t, n]) => [
Gt,
S(me, Be),
f(([, t, n]) => [
{

@@ -988,9 +1009,9 @@ size: n,

),
nt
Fe
);
}), dn = S((e) => {
}), mn = x((e) => {
const t = e.pipe(
dn,
y(B),
a(([n, o]) => {
mn,
S(O),
f(([n, o]) => {
if (!o)

@@ -1004,15 +1025,28 @@ return [];

);
e.changeWith(B, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ue, t, ([n], o) => [Mo(n, o), 0]);
}), xt = S((e) => {
e.changeWith(B, xt, (t, { mapper: n }) => t ? t.map(n) : []), e.link(
e.changeWith(O, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(le, t, ([n], o) => [Do(n, o), 0]);
}), wt = x((e) => {
e.changeWith(O, wt, (t, { mapper: n }) => t ? t.map(n) : []), e.link(
e.pipe(
xt,
Ee(40),
y(pn),
b(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t),
a(([{ autoscrollToBottomBehavior: t }]) => ({ index: "LAST", align: "end", behavior: t }))
wt,
ve(40),
S(gn),
d(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t),
f(([{ autoscrollToBottomBehavior: t }]) => ({ index: "LAST", align: "end", behavior: t }))
),
q
Z
);
}), nt = S();
});
function Oo(e = 1) {
return (t, n) => {
const o = n.signalInstance();
return n.sub(t, (s) => {
let i = e;
function r() {
i > 0 ? (i--, requestAnimationFrame(r)) : n.pub(o, s);
}
r();
}), o;
};
}
const Fe = x();
c([]);

@@ -1023,64 +1057,64 @@ c([]);

c(NaN);
const Z = c(!1), ue = c(et, (e) => {
const he = c(!1), le = c(ct, (e) => {
e.link(
e.pipe(
nt,
b((t) => t.length > 0),
y(J),
a(([t, n]) => go(n, [t, []]))
Fe,
d((t) => t.length > 0),
S(X),
f(([t, n]) => vo(n, [t, []]))
),
ue
le
);
}), J = c(et[0], (e) => {
}), X = c(ct[0], (e) => {
e.link(
e.pipe(
ue,
a(([t]) => t)
le,
f(([t]) => t)
),
J
X
);
}), vn = c(et[1], (e) => {
}), kn = c(ct[1], (e) => {
e.link(
e.pipe(
ue,
a(([, t]) => t)
le,
f(([, t]) => t)
),
vn
kn
);
}), ye = c(Te[1]), ot = c(Te[0]), Ce = c(Te, (e) => {
}), Be = c(xe[1]), ye = c(xe[0]), He = c(xe, (e) => {
e.link(
e.pipe(
J,
y(vn),
G(([t], [n, o]) => So(t, [n, o]), Te)
X,
S(kn),
J(([t], [n, o]) => So(t, [n, o]), xe)
),
Ce
He
), e.link(
e.pipe(
Ce,
a(([, t]) => t)
He,
f(([, t]) => t)
),
ye
Be
), e.link(
e.pipe(
Ce,
a(([t]) => t)
He,
f(([t]) => t)
),
ot
ye
);
}), bn = c(Te[2], (e) => {
}), In = c(xe[2], (e) => {
e.link(
e.pipe(
Ce,
a(([, , t]) => t)
He,
f(([, , t]) => t)
),
bn
In
);
}), mn = c(Te[3], (e) => {
}), Sn = c(xe[3], (e) => {
e.link(
e.pipe(
Ce,
a(([, , , t]) => t)
He,
f(([, , , t]) => t)
),
mn
Sn
);

@@ -1090,52 +1124,52 @@ }), we = c(0, (e) => {

e.pipe(
e.combine(ke, mn, bn, ye),
a(([t, n, o, s]) => o + (t - n) * s)
e.combine(me, Sn, In, Be),
f(([t, n, o, s]) => o + (t - n) * s)
),
we
);
}), _e = S(), Dt = c(!1), Be = S((e) => {
e.link(e.pipe(Be, H(!1)), _e);
}, !1), x = c(0), X = c(0), kn = c(0), U = c(0), Do = x, Ze = c(0), Ve = c(0), We = c(0), Fe = c(0), Ot = c(0), Tt = c(null), Sn = io(), In = yo, yn = c(In), xn = 50, Tn = c(xn), st = be(0, (e) => e.pipe(
e.combine(Ve, We),
a(([t, n]) => t + n)
)), $n = be(0, (e) => e.pipe(
e.combine(Fe, Ot),
a(([t, n]) => t + n)
)), Oo = be(0, (e) => e.pipe(
e.combine(Ve, We, x),
a(([t, n, o]) => t + Math.max(n - o, 0))
)), Ho = be(0, (e) => e.pipe(
e.combine(Fe, Ot, x, X, U),
a(([t, n, o, s, i]) => {
}), Pe = x(), Wt = c(!1), Ne = x((e) => {
e.link(e.pipe(Ne, W(!1)), Pe);
}, !1), T = c(0), U = c(0), xn = c(0), j = c(0), Ho = T, ot = c(0), ze = c(0), Ye = c(0), Ke = c(0), _t = c(0), Lt = c(null), yn = ro(), Vo = yo, Wo = 50, at = be(0, (e) => e.pipe(
e.combine(ze, Ye),
f(([t, n]) => t + n)
)), Tn = be(0, (e) => e.pipe(
e.combine(Ke, _t),
f(([t, n]) => t + n)
)), _o = be(0, (e) => e.pipe(
e.combine(ze, Ye, T),
f(([t, n, o]) => t + Math.max(n - o, 0))
)), Fo = be(0, (e) => e.pipe(
e.combine(Ke, _t, T, U, j),
f(([t, n, o, s, i]) => {
const r = Math.max(n - (i - (o + s)), 0);
return t + r;
})
)), En = be(0, (e) => e.pipe(
e.combine(X, Oo, Ho),
a(([t, n, o]) => t - n - o)
)), it = c(0), wn = c(0, (e) => {
)), $n = be(0, (e) => e.pipe(
e.combine(U, _o, Fo),
f(([t, n, o]) => t - n - o)
)), pt = c(0), En = c(0, (e) => {
e.link(
e.pipe(
e.combine(wn, we, X),
a(([t, n, o]) => t === 0 ? 0 : Math.max(0, Math.min(t - (n - o))))
e.combine(En, we, U),
f(([t, n, o]) => t === 0 ? 0 : Math.max(0, Math.min(t - (n - o))))
),
it
pt
);
}), $e = S((e) => {
}), Te = x((e) => {
e.link(
e.pipe(
$e,
a((t) => t.align === "start" ? t.top ?? 0 : 0)
Te,
f((t) => t.align === "start" ? t.top ?? 0 : 0)
),
wn
En
), e.link(
e.pipe(
$e,
y(x),
b(([t, n]) => t.top !== n),
H(!0)
Te,
S(T),
d(([t, n]) => t.top !== n),
W(!0)
),
_e
Pe
);
}), Pe = be(
}), je = be(
{

@@ -1150,16 +1184,16 @@ listOffset: 0,

e.combine(
x,
st,
T,
at,
Tn,
Ye,
$n,
We,
En,
U,
it,
Z,
Me,
W,
de
j,
pt,
he,
Ae,
K,
fe
),
b(([, , , , , , , t, n, o]) => !t && n === null && !o),
a(
d(([, , , , , , , t, n, o]) => !t && n === null && !o),
f(
([

@@ -1174,13 +1208,13 @@ t,

u,
f,
a,
p,
h
b
]) => {
const m = e.getValue(an), T = r - n - o, g = -t + s, V = l === 0 ? T + Math.min(0, g) - i : -l;
const m = e.getValue(hn), $ = r - n - o, I = -t + s, v = l === 0 ? $ + Math.min(0, I) - i : -l;
return {
scrollHeight: T,
listOffset: g,
scrollHeight: $,
listOffset: I,
visibleListHeight: i,
bottomOffset: V,
isAtBottom: h || V <= m
bottomOffset: v,
isAtBottom: b || v <= m
};

@@ -1190,54 +1224,54 @@ }

)
), $t = S((e) => {
), Rt = x((e) => {
e.link(
e.pipe(
x,
le(0),
y(Pe),
b(([, t]) => t.scrollHeight > 0),
a(([, t]) => t)
T,
re(0),
S(je),
d(([, t]) => t.scrollHeight > 0),
f(([, t]) => t)
),
$t
Rt
);
}), ee = S(), F = c(0), Et = c(0), Ln = c(""), Ht = S(), Rn = ({ index: e }) => /* @__PURE__ */ Ut("div", { children: [
}), Q = x(), F = c(0), st = c(0), Mt = c(0), wn = c(""), Ft = x(), Ln = ({ index: e }) => /* @__PURE__ */ Jt("div", { children: [
"Item ",
e
] }), Mn = ({ index: e }) => e, wt = c(Rn), An = c(Mn), Cn = c(null), Dn = c(null), On = c(null), Hn = c(null), _n = c(null), Bn = c("div"), _o = {
] }), Rn = ({ index: e }) => e, Dt = c(Ln), Mn = c(Rn), Dn = c(null), An = c(null), Cn = c(null), On = c(null), Hn = c(null), Vn = c("div"), Bo = {
position: "sticky",
top: 0,
zIndex: 1
}, ze = {
}, Ze = {
overflowAnchor: "none"
}, Bo = {
}, Po = {
position: "sticky",
bottom: 0
}, Vn = d.forwardRef((e, t) => /* @__PURE__ */ I("div", { style: { zIndex: 1 }, ...e, ref: t })), Wn = d.forwardRef((e, t) => /* @__PURE__ */ I("div", { ...e, ref: t })), Fn = d.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ I("div", { ...t, style: { ..._o, ...e }, ref: n })
), Pn = d.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ I("div", { ...t, style: { ...Bo, ...e }, ref: n })
), Nn = c(Vn), zn = c(Fn), Yn = c(Wn), Kn = c(Pn), Lt = c("top", (e) => {
}, Wn = h.forwardRef((e, t) => /* @__PURE__ */ y("div", { style: { zIndex: 1 }, ...e, ref: t })), _n = h.forwardRef((e, t) => /* @__PURE__ */ y("div", { ...e, ref: t })), Fn = h.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...Bo, ...e }, ref: n })
), Bn = h.forwardRef(
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...Po, ...e }, ref: n })
), Pn = c(Wn), Nn = c(Fn), zn = c(_n), Yn = c(Bn), At = c("top", (e) => {
e.link(
e.pipe(
e.combine(Lt, we, X, st, $n),
b(([t]) => t === "bottom" || t === "bottom-smooth"),
a(([, t, n, o, s]) => Math.max(0, n - t - o - s))
e.combine(At, we, U, at, Tn),
d(([t]) => t === "bottom" || t === "bottom-smooth"),
f(([, t, n, o, s]) => Math.max(0, n - t - o - s))
),
Et
Mt
), e.link(
e.pipe(
e.combine(Et, Lt),
b(([, t]) => t === "bottom-smooth"),
G(
e.combine(Mt, At),
d(([, t]) => t === "bottom-smooth"),
J(
(t, [n]) => [t[1], n],
[0, 0]
),
a(([t, n]) => t > 0 && n > 0 ? "margin-top 0.2s ease-out" : "")
f(([t, n]) => t > 0 && n > 0 ? "margin-top 0.2s ease-out" : "")
),
Ln
wn
);
});
function Vo(e) {
return Wo(Po(No(Fo(e), 8 * e.length))).toLowerCase();
function No(e) {
return zo(Ko(jo(Yo(e), 8 * e.length))).toLowerCase();
}
function Wo(e) {
function zo(e) {
for (var t, n = "0123456789ABCDEF", o = "", s = 0; s < e.length; s++)

@@ -1247,3 +1281,3 @@ t = e.charCodeAt(s), o += n.charAt(t >>> 4 & 15) + n.charAt(15 & t);

}
function Fo(e) {
function Yo(e) {
for (var t = Array(e.length >> 2), n = 0; n < t.length; n++)

@@ -1255,3 +1289,3 @@ t[n] = 0;

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

@@ -1261,6 +1295,6 @@ t += String.fromCharCode(e[n >> 5] >>> n % 32 & 255);

}
function No(e, t) {
function jo(e, t) {
e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t;
for (var n = 1732584193, o = -271733879, s = -1732584194, i = 271733878, r = 0; r < e.length; r += 16) {
const l = n, u = o, f = s, p = i;
const l = n, u = o, a = s, p = i;
o = C(

@@ -1274,14 +1308,14 @@ o = C(

o = A(
o = M(
o = M(
o = M(
o = M(
o = R(
o = R(
o = R(
o = R(
o = D(
o = D(
o = D(
o = D(
o = M(
o = M(
o = M(
o = M(
o,
s = R(
s = M(
s,
i = R(i, n = R(n, o, s, i, e[r + 0], 7, -680876936), o, s, e[r + 1], 12, -389564586),
i = M(i, n = M(n, o, s, i, e[r + 0], 7, -680876936), o, s, e[r + 1], 12, -389564586),
n,

@@ -1299,5 +1333,5 @@ o,

),
s = R(
s = M(
s,
i = R(i, n = R(n, o, s, i, e[r + 4], 7, -176418897), o, s, e[r + 5], 12, 1200080426),
i = M(i, n = M(n, o, s, i, e[r + 4], 7, -176418897), o, s, e[r + 5], 12, 1200080426),
n,

@@ -1315,5 +1349,5 @@ o,

),
s = R(
s = M(
s,
i = R(i, n = R(n, o, s, i, e[r + 8], 7, 1770035416), o, s, e[r + 9], 12, -1958414417),
i = M(i, n = M(n, o, s, i, e[r + 8], 7, 1770035416), o, s, e[r + 9], 12, -1958414417),
n,

@@ -1331,5 +1365,5 @@ o,

),
s = R(
s = M(
s,
i = R(i, n = R(n, o, s, i, e[r + 12], 7, 1804603682), o, s, e[r + 13], 12, -40341101),
i = M(i, n = M(n, o, s, i, e[r + 12], 7, 1804603682), o, s, e[r + 13], 12, -40341101),
n,

@@ -1347,5 +1381,5 @@ o,

),
s = M(
s = D(
s,
i = M(i, n = M(n, o, s, i, e[r + 1], 5, -165796510), o, s, e[r + 6], 9, -1069501632),
i = D(i, n = D(n, o, s, i, e[r + 1], 5, -165796510), o, s, e[r + 6], 9, -1069501632),
n,

@@ -1363,5 +1397,5 @@ o,

),
s = M(
s = D(
s,
i = M(i, n = M(n, o, s, i, e[r + 5], 5, -701558691), o, s, e[r + 10], 9, 38016083),
i = D(i, n = D(n, o, s, i, e[r + 5], 5, -701558691), o, s, e[r + 10], 9, 38016083),
n,

@@ -1379,5 +1413,5 @@ o,

),
s = M(
s = D(
s,
i = M(i, n = M(n, o, s, i, e[r + 9], 5, 568446438), o, s, e[r + 14], 9, -1019803690),
i = D(i, n = D(n, o, s, i, e[r + 9], 5, 568446438), o, s, e[r + 14], 9, -1019803690),
n,

@@ -1395,5 +1429,5 @@ o,

),
s = M(
s = D(
s,
i = M(i, n = M(n, o, s, i, e[r + 13], 5, -1444681467), o, s, e[r + 2], 9, -51403784),
i = D(i, n = D(n, o, s, i, e[r + 13], 5, -1444681467), o, s, e[r + 2], 9, -51403784),
n,

@@ -1530,99 +1564,143 @@ o,

-343485551
), n = re(n, l), o = re(o, u), s = re(s, f), i = re(i, p);
), n = ie(n, l), o = ie(o, u), s = ie(s, a), i = ie(i, p);
}
return [n, o, s, i];
}
function rt(e, t, n, o, s, i) {
return re(zo(re(re(t, e), re(o, i)), s), n);
function ft(e, t, n, o, s, i) {
return ie(Uo(ie(ie(t, e), ie(o, i)), s), n);
}
function R(e, t, n, o, s, i, r) {
return rt(t & n | ~t & o, e, t, s, i, r);
}
function M(e, t, n, o, s, i, r) {
return rt(t & o | n & ~o, e, t, s, i, r);
return ft(t & n | ~t & o, e, t, s, i, r);
}
function D(e, t, n, o, s, i, r) {
return ft(t & o | n & ~o, e, t, s, i, r);
}
function A(e, t, n, o, s, i, r) {
return rt(t ^ n ^ o, e, t, s, i, r);
return ft(t ^ n ^ o, e, t, s, i, r);
}
function C(e, t, n, o, s, i, r) {
return rt(n ^ (t | ~o), e, t, s, i, r);
return ft(n ^ (t | ~o), e, t, s, i, r);
}
function re(e, t) {
function ie(e, t) {
const n = (65535 & e) + (65535 & t);
return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n;
}
function zo(e, t) {
function Uo(e, t) {
return e << t | e >>> 32 - t;
}
const jn = Symbol("INVALID_KEY");
function Yo(e) {
const Kn = Symbol("INVALID_KEY");
function qo(e) {
const t = e.slice(0, 32), n = e.slice(32), o = atob(n);
if (t !== Vo(n))
return jn;
if (t !== No(n))
return Kn;
const [s, i] = o.split(";"), r = s.slice(2), l = new Date(Number(i.slice(2)));
return { orderNumber: r, expiryDate: l };
}
const Ko = {
const Go = {
valid: !1,
consoleMessage: "The VirtuosoMessageList license wrapper component is missing. Enclose the VirtuosoMessageList with VirtuosoMessageListLicense and add your key at the lisenceKey property.",
watermarkMessage: "The VirtuosoMessageList license wrapper component is missing. Enclose the VirtuosoMessageList with VirtuosoMessageListLicense and add your key at the lisenceKey property."
}, jo = {
}, Zo = {
valid: !1,
consoleMessage: "Your VirtuosoMessageListLicense is missing a license key. Purchase one from https://virtuoso.dev/pricing/",
watermarkMessage: "Your VirtuosoMessageListLicense is missing a license key. Purchase one from https://virtuoso.dev/pricing/"
}, Uo = {
}, Jo = {
valid: !1,
consoleMessage: "Your VirtuosoMessageListLicense component is missing a license key - this component will not work if deployed in production. Purchase a key from https://virtuoso.dev/pricing/ before you deploy to production."
}, Un = {
}, jn = {
valid: !0
}, qo = {
}, Xo = {
valid: !1,
consoleMessage: "Your Virtuoso Message List license key is invalid. Ensure that you have copy-pasted the key from the purchase email correctly.",
watermarkMessage: "Your Virtuoso Message List license key is invalid"
}, Go = {
}, Qo = {
valid: !1,
consoleMessage: "Your annual license key to use Virtuoso Message List in non-production environments has expired. You can still use it in production. To keep using it in development, purchase a new key from https://virtuoso.dev/pricing/",
watermarkMessage: "Your annual license key to use Virtuoso Message List in non-production environments has expired. You can still use it in production. To keep using it in development, purchase a new key from https://virtuoso.dev/pricing/"
}, Zo = {
}, es = {
valid: !1,
consoleMessage: "You have installed a version of `@virtuoso.dev/message-list` that is newer than the period of your license key. Either downgrade to a supported version, or purchase a new license from https://virtuoso.dev/pricing/",
watermarkMessage: "You have installed a version of `@virtuoso.dev/message-list` that is newer than the period of your license key. Either downgrade to a supported version, or purchase a new license from https://virtuoso.dev/pricing/"
}, Jo = Un, Xo = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0)$/, Qo = ["virtuoso.dev", "csb.app", "codesandbox.io"];
function es({ licenseKey: e, now: t, hostname: n, packageTimestamp: o }) {
const s = n.match(Xo), i = Qo.some((r) => n.endsWith(r));
}, ts = jn, ns = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0)$/, os = ["virtuoso.dev", "csb.app", "codesandbox.io"];
function ss({ licenseKey: e, now: t, hostname: n, packageTimestamp: o }) {
const s = n.match(ns), i = os.some((r) => n.endsWith(r));
if (e) {
const r = Yo(e);
if (r === jn)
return qo;
const r = qo(e);
if (r === Kn)
return Xo;
if (r.expiryDate.getTime() < t.getTime()) {
if (s)
return Go;
return Qo;
if (r.expiryDate.getTime() < o)
return Zo;
return es;
}
} else
return i ? Jo : s ? Uo : jo;
return Un;
return i ? ts : s ? Jo : Zo;
return jn;
}
const qn = d.createContext(Ko), ts = ({
const Un = h.createContext(Go), is = ({
licenseKey: e,
children: t
}) => {
const n = es({
const n = ss({
licenseKey: e,
hostname: typeof window < "u" ? window.location.hostname : "localhost",
now: /* @__PURE__ */ new Date(),
packageTimestamp: 1718781223765
packageTimestamp: 1720342701746
});
return /* @__PURE__ */ I(qn.Provider, { value: n, children: t });
return /* @__PURE__ */ y(Un.Provider, { value: n, children: t });
};
ts.displayName = Math.random().toString(36).slice(2, 8);
function Gn(e) {
is.displayName = Math.random().toString(36).slice(2, 8);
const rs = h.createContext(void 0);
function ls(e, t, n) {
const o = Ot(), s = h.useRef(null), i = h.useRef(null);
function r() {
s.current && (cancelAnimationFrame(s.current), s.current = null, i.current = null);
}
h.useEffect(() => o.sub(Ft, (a) => {
a !== i.current && r();
}), [o]), h.useEffect(() => o.sub(yn, r), [o]);
const l = h.useCallback(
(a, p, b) => {
var v;
s.current && r();
const m = ((v = e.current) == null ? void 0 : v.scrollTop) ?? 0;
i.current = m < a ? "down" : "up";
let $ = 0;
function I() {
var B;
const Y = m + (a - m) * p($);
(B = e.current) == null || B.scrollTo({ top: Y, behavior: "instant" }), $ += 1 / b, $ < 1 ? s.current = requestAnimationFrame(I) : (s.current = null, i.current = null);
}
I();
},
[e]
);
return h.useCallback(
(a) => {
var p, b, m, $;
if (a.top === ((p = e.current) == null ? void 0 : p.scrollTop)) {
o.pub(Ne, (b = e.current) == null ? void 0 : b.scrollTop);
return;
}
if (a.top !== void 0 && (n.current = a.top, o.pub(Wt, !0)), a.forceBottomSpace !== void 0 && t.current && (t.current.style.paddingBottom = `${a.forceBottomSpace}px`), a.behavior === "smooth")
l(a.top ?? 0, Vo, Wo);
else if (a.behavior === "auto" || a.behavior === "instant" || a.behavior === void 0)
r(), (m = e.current) == null || m.scrollTo(a);
else {
const { easing: I, animationFrameCount: v } = a.behavior((($ = e.current) == null ? void 0 : $.scrollTop) ?? 0, a.top ?? 0);
l(a.top ?? 0, I, v);
}
},
[o, l, t, e, n]
);
}
function qn(e) {
return {
data: {
prepend: (t) => {
e.pub(ie, t);
e.pub(se, t);
},
append: (t, n) => {
e.pub(Qe, {
e.pub(lt, {
data: t,

@@ -1633,9 +1711,9 @@ scrollToBottom: n

replace: (t, n) => {
e.pub(Ae, {
data: t,
initialLocation: n
e.pub(Oe, {
...n,
data: t
});
},
map: (t, n) => {
e.pub(xt, {
e.pub(wt, {
mapper: t,

@@ -1646,8 +1724,8 @@ autoscrollToBottomBehavior: n

findAndDelete: (t) => {
e.pub(dn, t);
e.pub(mn, t);
},
findIndex: (t) => e.getValue(B).findIndex(t),
find: (t) => e.getValue(B).find(t),
findIndex: (t) => e.getValue(O).findIndex(t),
find: (t) => e.getValue(O).find(t),
insert: function(t, n, o) {
e.pub(Ge, {
e.pub(nt, {
data: t,

@@ -1659,3 +1737,3 @@ offset: n,

deleteRange: function(t, n) {
e.pub(yt, {
e.pub(Et, {
offset: t,

@@ -1666,35 +1744,59 @@ count: n

batch: (t, n) => {
e.pub(Z, !0), t(), e.pub(Z, !1), e.pub(tt, { data: [], scrollToBottom: n });
}
e.pub(he, !0), t(), e.pub(he, !1), e.pub(ut, { data: [], scrollToBottom: n });
},
get: () => e.getValue(O).slice(),
getCurrentlyRendered: () => e.getValue(rt)
},
scrollToItem: (t) => {
e.pub(q, t);
e.pub(Z, t);
},
scrollIntoView: (t) => {
e.pub(gn, t);
e.pub(bn, t);
},
scrollerElement: () => e.getValue(Tt),
scrollerElement: () => e.getValue(Lt),
getScrollLocation() {
return e.getValue(Pe);
return e.getValue(je);
},
cancelSmoothScroll() {
e.pub(Sn);
e.pub(yn);
}
};
}
function us() {
return O(Pe);
const cs = ({ item: e, ItemContent: t, mount: n, unmount: o }) => {
const s = V(_e), i = h.useRef(null), r = h.useCallback(
(l) => {
l ? (i.current = l, n(l)) : i.current && (o(i.current), i.current = null);
},
[n, o]
);
return /* @__PURE__ */ y(
"div",
{
ref: r,
"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: s })
}
);
};
function Je(e) {
const t = h.useRef(null);
return [h.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 as() {
return O(It);
}
function ps() {
const e = Mt();
return d.useMemo(() => Gn(e), [e]);
}
let jt = !1;
const ns = d.forwardRef(
let Zt = !1;
const us = h.forwardRef(
({
initialData: e = [],
computeItemKey: t = Mn,
computeItemKey: t = Rn,
context: n = null,

@@ -1705,50 +1807,53 @@ initialLocation: o = null,

onRenderedDataChange: r,
ItemContent: l = Rn,
ItemContent: l = Ln,
Header: u = null,
StickyHeader: f = null,
StickyHeader: a = null,
Footer: p = null,
StickyFooter: h = null,
StickyFooter: b = null,
EmptyPlaceholder: m = null,
HeaderWrapper: T = Vn,
StickyHeaderWrapper: g = Fn,
FooterWrapper: V = Wn,
StickyFooterWrapper: z = Pn,
ScrollElement: P = "div",
smoothScrollBezierFunction: ae = In,
smoothScrollAnimationFrameCount: pe = xn,
...Le
}, te) => {
const Y = d.useMemo(() => {
const L = new ro();
return L.register(He), L.register(_e), L.register(qe), L.register(je), L.register(Qe), L.register(ie), L.register(Ae), L.pubIn({
[B]: e.slice(),
[Oe]: n,
[An]: t,
[Xe]: o,
[wt]: l,
[Cn]: u,
[On]: p,
[Dn]: f,
[Hn]: h,
[_n]: m,
[Bn]: P,
[Kn]: z,
[zn]: g,
[Yn]: V,
[Nn]: T,
[Lt]: s,
[yn]: ae,
[Tn]: pe
}), L.singletonSub($t, i), L.singletonSub(It, r), L;
HeaderWrapper: $ = Wn,
StickyHeaderWrapper: I = Fn,
FooterWrapper: v = _n,
StickyFooterWrapper: Y = Bn,
ScrollElement: B = "div",
...ce
}, ue) => {
const q = h.useMemo(() => {
const L = new lo();
return L.register(Ee), L.register(Pe), L.register(tt), L.register(Qe), L.register(lt), L.register(se), L.register(Oe), L.pubIn({
[O]: e.slice(),
[_e]: n,
[Mn]: t,
[We]: o,
[Dt]: l,
[Dn]: u,
[Cn]: p,
[An]: a,
[On]: b,
[Hn]: m,
[Vn]: B,
[Yn]: Y,
[Nn]: I,
[zn]: v,
[Pn]: $,
[At]: s
}), L.singletonSub(Rt, i), L.singletonSub(rt, r), L;
}, []);
d.useImperativeHandle(te, () => Gn(Y), [Y]), d.useEffect(() => {
Y.pubIn({
[Oe]: n,
[wt]: l
}), Y.singletonSub($t, i), Y.singletonSub(It, r);
h.useImperativeHandle(ue, () => qn(q), [q]), h.useEffect(() => {
q.pubIn({
[_e]: n,
[Dt]: l
}), q.singletonSub(Rt, i), q.singletonSub(rt, r);
});
const w = d.useContext(qn);
return d.useEffect(() => {
w.consoleMessage && (jt || (jt = !0, console.error(w.consoleMessage)));
}, [w]), typeof window < "u" && w.watermarkMessage ? /* @__PURE__ */ I(
const P = h.useContext(Un);
return h.useEffect(() => {
P.consoleMessage && (Zt || (Zt = !0, console.error(P.consoleMessage)));
}, [P]), h.useEffect(() => {
const L = (R) => {
R.message.includes("ResizeObserver loop") && (R.preventDefault(), R.stopPropagation(), R.stopImmediatePropagation());
};
return window.addEventListener("error", L, { capture: !0 }), () => {
window.removeEventListener("error", L);
};
}, []), typeof window < "u" && P.watermarkMessage ? /* @__PURE__ */ y(
"div",

@@ -1760,11 +1865,10 @@ {

},
children: w.watermarkMessage
children: P.watermarkMessage
}
) : /* @__PURE__ */ I(lo.Provider, { value: Y, children: /* @__PURE__ */ I(os, { ...Le }) });
) : /* @__PURE__ */ y(co.Provider, { value: q, children: /* @__PURE__ */ y(as, { ...ce }) });
}
);
ns.displayName = "VirtuosoMessageList";
const os = ({ style: e, ...t }) => {
const n = Mt(), [
o,
us.displayName = "VirtuosoMessageList";
const as = ({ style: e, ...t }) => {
const n = Ot(), o = h.useContext(rs), [
s,

@@ -1775,246 +1879,204 @@ i,

u,
f,
a,
p,
h,
b,
m,
T
] = co(
Cn,
$,
I
] = uo(
Dn,
An,
Pn,
Nn,
Cn,
On,
zn,
On,
Yn,
Dt,
Hn,
Yn,
Kn,
wt,
_n,
Bn
), [g] = d.useState(() => {
Vn
), [v] = h.useState(() => {
if (typeof ResizeObserver > "u")
throw new Error("ResizeObserver not found. Please ensure that you have a polyfill installed.");
return new ResizeObserver((v) => {
var _t, Bt, Vt, Wt;
const Ie = v.length, se = [];
let D = {};
for (let at = 0; at < Ie; at++) {
const ge = v[at], N = ge.target;
if (N === Le.current) {
D = {
...D,
[We]: ge.contentRect.height,
[U]: (_t = $.current) == null ? void 0 : _t.scrollHeight
return new ResizeObserver((g) => {
var Bt, Pt, Nt, zt;
const Ie = g.length, oe = [];
let H = {};
for (let gt = 0; gt < Ie; gt++) {
const pe = g[gt], z = pe.target;
if (z === P.current) {
H = {
...H,
[Ye]: pe.contentRect.height,
[j]: (Bt = E.current) == null ? void 0 : Bt.scrollHeight
};
continue;
} else if (N === Y.current) {
D = {
...D,
[Ve]: ge.contentRect.height,
[U]: (Bt = $.current) == null ? void 0 : Bt.scrollHeight
} else if (z === R.current) {
H = {
...H,
[ze]: pe.contentRect.height,
[j]: (Pt = E.current) == null ? void 0 : Pt.scrollHeight
};
continue;
} else if (N === z.current) {
D = {
...D,
[Ot]: ge.contentRect.height,
[U]: (Vt = $.current) == null ? void 0 : Vt.scrollHeight
} else if (z === B.current) {
H = {
...H,
[_t]: pe.contentRect.height,
[j]: (Nt = E.current) == null ? void 0 : Nt.scrollHeight
};
continue;
} else if (N === ae.current) {
D = {
...D,
[Fe]: ge.contentRect.height,
[U]: (Wt = $.current) == null ? void 0 : Wt.scrollHeight
} else if (z === ue.current) {
H = {
...H,
[Ke]: pe.contentRect.height,
[j]: (zt = E.current) == null ? void 0 : zt.scrollHeight
};
continue;
} else if (N === $.current) {
D = {
...D,
[x]: N.scrollTop,
[U]: N.scrollHeight,
[X]: ge.contentRect.height,
[kn]: N.clientWidth
} else if (z === E.current) {
H = {
...H,
[T]: z.scrollTop,
[j]: z.scrollHeight,
[U]: pe.contentRect.height,
[xn]: z.clientWidth
};
continue;
} else if (N === ne.current) {
$.current && (D = {
...D,
[U]: $.current.scrollHeight
} else if (z === ee.current) {
E.current && (H = {
...H,
[j]: E.current.scrollHeight
});
continue;
}
if (N.dataset.index === void 0)
if (z.dataset.index === void 0)
continue;
const pt = parseInt(N.dataset.index), oo = parseFloat(N.dataset.knownSize ?? ""), ft = ge.contentRect.height;
if (ft === oo)
const dt = parseInt(z.dataset.index), so = parseFloat(z.dataset.knownSize ?? ""), vt = pe.contentRect.height;
if (vt === so)
continue;
const Ft = se[se.length - 1];
se.length === 0 || Ft.size !== ft || Ft.endIndex !== pt - 1 ? se.push({ endIndex: pt, size: ft, startIndex: pt }) : se[se.length - 1].endIndex++;
const Yt = oe[oe.length - 1];
oe.length === 0 || Yt.size !== vt || Yt.endIndex !== dt - 1 ? oe.push({ endIndex: dt, size: vt, startIndex: dt }) : oe[oe.length - 1].endIndex++;
}
se.length > 0 && (D = {
...D,
[nt]: se
}), n.pubIn(D);
oe.length > 0 && (H = {
...H,
[Fe]: oe
}), n.pubIn(H);
});
}), [V, z] = Ye(g), [P, ae] = Ye(g), [pe, Le] = Ye(g), [te, Y] = Ye(g), w = d.useCallback(
(v) => {
g.observe(v);
}), [Y, B] = Je(v), [ce, ue] = Je(v), [q, P] = Je(v), [L, R] = Je(v), Ue = h.useCallback(
(g) => {
if (o) {
const Ie = parseInt(g.dataset.index ?? "");
n.pub(Fe, [
{
startIndex: Ie,
endIndex: Ie,
size: o.itemHeight
}
]);
}
v.observe(g);
},
[g]
), L = d.useCallback(
(v) => {
g.unobserve(v);
[v, n, o]
), qe = h.useCallback(
(g) => {
v.unobserve(g);
},
[g]
), $ = d.useRef(null), ne = d.useRef(null), lt = d.useCallback(
(v) => {
v ? (ne.current = v, g.observe(v, { box: "border-box" })) : ne.current && (g.unobserve(ne.current), ne.current = null);
[v]
), E = h.useRef(null), ee = h.useRef(null), Ge = h.useCallback(
(g) => {
g ? (ee.current = g, v.observe(g, { box: "border-box" })) : ee.current && (v.unobserve(ee.current), ee.current = null);
},
[g]
), fe = d.useRef(null), K = is($, ne, fe), Se = d.useCallback((v) => {
var Ie;
(Ie = $.current) == null || Ie.scrollBy(v);
}, []), Q = d.useCallback(() => {
const v = $.current;
if (v !== null) {
if (fe.current !== null) {
const Ie = v.scrollHeight - v.clientHeight;
sn(v.scrollTop, Math.min(Ie, fe.current)) && (fe.current = null, n.pub(Dt, !1), n.pub(Be, v.scrollTop));
[v]
), N = h.useRef(null), ke = ls(E, ee, N), te = h.useCallback((g) => {
E.current && (E.current.scrollTop += g);
}, []), G = h.useCallback(() => {
const g = E.current;
if (g !== null) {
if (N.current !== null) {
const Ie = g.scrollHeight - g.clientHeight;
un(g.scrollTop, Math.min(Ie, N.current)) && (N.current = null, n.pub(Wt, !1), n.pub(Ne, g.scrollTop));
}
n.pub(x, v.scrollTop);
n.pub(T, g.scrollTop);
}
}, [n]), j = d.useCallback(
(v) => {
n.pub(Ht, v.deltaY > 0 ? "down" : "up");
}, [n]), Le = h.useCallback(
(g) => {
n.pub(Ft, g.deltaY > 0 ? "down" : "up");
},
[n]
), ct = d.useCallback(
(v) => {
v ? (n.pub(Tt, v), $.current = v, v.addEventListener("scroll", Q), v.addEventListener("wheel", j), g.observe(v, { box: "border-box" })) : $.current && ($.current.removeEventListener("scroll", Q), $.current.removeEventListener("wheel", j), n.pub(Tt, null), g.unobserve($.current), $.current = null);
), ne = h.useCallback(
(g) => {
g ? (n.pub(Lt, g), E.current = g, g.addEventListener("scroll", G), g.addEventListener("wheel", Le), o && n.pubIn({
[U]: o.viewportHeight,
[j]: o.viewportHeight,
[T]: 0
}), v.observe(g, { box: "border-box" })) : E.current && (E.current.removeEventListener("scroll", G), E.current.removeEventListener("wheel", Le), n.pub(Lt, null), v.unobserve(E.current), E.current = null);
},
[g, n, Q, j]
), { items: oe } = O(He);
d.useLayoutEffect(() => n.sub($e, K), [K, n]), d.useLayoutEffect(() => n.sub(ee, Se), [Se, n]);
const ut = O(F), Zn = O(W), Jn = O(Et), Xn = O(it), Qn = O(Ln), he = O(Oe), eo = O(An), to = O(ke), no = O(we);
return /* @__PURE__ */ I(so, { children: /* @__PURE__ */ Ut(
T,
[v, n, G, Le, o]
), { items: ht } = V(Ee);
h.useLayoutEffect(() => n.sub(Te, ke), [ke, n]), h.useLayoutEffect(() => n.sub(Q, te), [te, n]);
const Gn = V(F), Zn = V(st), Jn = V(K), Xn = V(Mt), Qn = V(pt), eo = V(wn), ae = V(_e), to = V(Mn), no = V(me), oo = V(we);
return /* @__PURE__ */ y(io, { children: /* @__PURE__ */ Jt(
I,
{
...t,
ref: ct,
ref: ne,
"data-testid": "virtuoso-scroller",
style: {
overflowY: Zn ? "hidden" : "scroll",
overflowY: Jn ? "hidden" : "scroll",
boxSizing: "border-box",
...e
},
...T === "div" ? { context: he } : {},
...I === "div" ? { context: ae } : {},
children: [
s && /* @__PURE__ */ I(r, { ref: te, style: ze, children: /* @__PURE__ */ I(s, { context: he }) }),
o && /* @__PURE__ */ I(i, { ref: pe, style: ze, children: /* @__PURE__ */ I(o, { context: he }) }),
to > 0 ? /* @__PURE__ */ I(
i && /* @__PURE__ */ y(l, { ref: L, style: Ze, children: /* @__PURE__ */ y(i, { context: ae }) }),
s && /* @__PURE__ */ y(r, { ref: q, style: Ze, children: /* @__PURE__ */ y(s, { context: ae }) }),
no > 0 ? /* @__PURE__ */ y(
"div",
{
ref: lt,
ref: Ge,
"data-testid": "virtuoso-list",
style: {
boxSizing: "content-box",
height: no,
paddingBottom: Xn,
height: oo,
paddingBottom: Qn,
overflowAnchor: "none",
marginTop: Jn,
transition: Qn,
marginTop: Xn,
transition: eo,
position: "relative",
transform: `translateY(${ut}px)`
transform: `translateY(${Gn + Zn}px)`
},
children: oe.map((v) => /* @__PURE__ */ I(
ss,
children: ht.map((g) => /* @__PURE__ */ y(
cs,
{
mount: w,
unmount: L,
item: v,
ItemContent: h
mount: Ue,
unmount: qe,
item: g,
ItemContent: m
},
eo({ index: v.index, data: v.data, context: he })
to({ index: g.index, data: g.data, context: ae })
))
}
) : m ? /* @__PURE__ */ I(m, { context: he }) : null,
l && /* @__PURE__ */ I(f, { ref: V, style: ze, children: /* @__PURE__ */ I(l, { context: he }) }),
u && /* @__PURE__ */ I(p, { ref: P, style: ze, children: /* @__PURE__ */ I(u, { context: he }) })
) : $ ? /* @__PURE__ */ y($, { context: ae }) : null,
u && /* @__PURE__ */ y(p, { ref: Y, style: Ze, children: /* @__PURE__ */ y(u, { context: ae }) }),
a && /* @__PURE__ */ y(b, { ref: ce, style: Ze, children: /* @__PURE__ */ y(a, { context: ae }) })
]
}
) });
}, ss = ({ item: e, ItemContent: t, mount: n, unmount: o }) => {
const s = O(Oe), i = d.useRef(null), r = d.useCallback(
(l) => {
l ? (i.current = l, n(l)) : i.current && (o(i.current), i.current = null);
},
[n, o]
);
return /* @__PURE__ */ I(
"div",
{
ref: r,
"data-index": e.index,
"data-known-size": e.height,
style: {
overflowAnchor: "none",
position: "absolute",
width: "100%",
top: e.offset
},
children: /* @__PURE__ */ I(t, { index: e.index, prevData: e.prevData, nextData: e.nextData, data: e.data, context: s })
}
);
};
function Ye(e) {
const t = d.useRef(null);
return [d.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 gs() {
return V(je);
}
function is(e, t, n) {
const o = Mt(), s = d.useRef(null), i = d.useRef(null), r = O(Tn), l = O(yn);
function u() {
s.current && (cancelAnimationFrame(s.current), s.current = null, i.current = null);
}
d.useEffect(() => o.sub(Ht, (h) => {
h !== i.current && u();
}), [o]), d.useEffect(() => o.sub(Sn, u), [o]);
const f = d.useCallback(
(h) => {
var V;
s.current && u();
const m = ((V = e.current) == null ? void 0 : V.scrollTop) ?? 0;
i.current = m < h ? "down" : "up";
let T = 0;
function g() {
var P;
const z = m + (h - m) * l(T);
(P = e.current) == null || P.scrollTo({ top: z, behavior: "auto" }), T += 1 / r, T < 1 ? s.current = requestAnimationFrame(g) : (s.current = null, i.current = null);
}
g();
},
[e, r, l]
);
return d.useCallback(
(h) => {
var m, T, g;
if (h.top === ((m = e.current) == null ? void 0 : m.scrollTop)) {
o.pub(Be, (T = e.current) == null ? void 0 : T.scrollTop);
return;
}
h.top !== void 0 && (n.current = h.top, o.pub(Dt, !0)), h.forceBottomSpace !== void 0 && t.current && (t.current.style.paddingBottom = `${h.forceBottomSpace}px`), h.behavior === "smooth" ? f(h.top ?? 0) : (u(), (g = e.current) == null || g.scrollTo(h));
},
[o, f, t, e, n]
);
function ds() {
return V(rt);
}
function vs() {
const e = Ot();
return h.useMemo(() => qn(e), [e]);
}
export {
ns as VirtuosoMessageList,
ts as VirtuosoMessageListLicense,
as as useCurrentlyRenderedData,
us as useVirtuosoLocation,
ps as useVirtuosoMethods
us as VirtuosoMessageList,
is as VirtuosoMessageListLicense,
rs as VirtuosoMessageListTestingContext,
ds as useCurrentlyRenderedData,
gs as useVirtuosoLocation,
vs as useVirtuosoMethods
};

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

},
"version": "1.8.0-alpha.23",
"version": "1.8.0",
"type": "module",

@@ -92,3 +92,3 @@ "module": "dist/index.js",

"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@testing-library/react": "^14.3.1",
"@types/node": "^20.11.25",

@@ -108,2 +108,3 @@ "@types/react": "^18.2.56",

"random-avatar-generator": "^2.0.0",
"resize-observer-polyfill": "^1.5.1",
"semantic-release": "^23.0.6",

@@ -110,0 +111,0 @@ "typedoc-plugin-no-inherit": "^1.4.0",

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