react-virtuoso 2.11.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +46 -24
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.m.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -82,6 +82,17 @@ export declare interface FillerRowProps {
|
|
|
82
82
|
|
|
83
83
|
export declare type FixedHeaderContent = (() => React.ReactNode) | null;
|
|
84
84
|
|
|
85
|
+
export declare interface FlatIndexLocationWithAlign extends LocationOptions {
|
|
86
|
+
/**
|
|
87
|
+
* The index of the item to scroll to.
|
|
88
|
+
*/
|
|
89
|
+
index: number | 'LAST';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare interface FlatScrollIntoViewLocation extends ScrollIntoViewLocationOptions {
|
|
93
|
+
index: number;
|
|
94
|
+
}
|
|
95
|
+
|
|
85
96
|
export declare type FollowOutput = FollowOutputCallback | FollowOutputScalarType;
|
|
86
97
|
|
|
87
98
|
export declare type FollowOutputCallback = (isAtBottom: boolean) => FollowOutputScalarType;
|
|
@@ -150,12 +161,17 @@ export declare interface GroupContent {
|
|
|
150
161
|
(index: number): ReactNode;
|
|
151
162
|
}
|
|
152
163
|
|
|
164
|
+
export declare interface GroupedScrollIntoViewLocation extends ScrollIntoViewLocationOptions {
|
|
165
|
+
groupIndex: number;
|
|
166
|
+
}
|
|
167
|
+
|
|
153
168
|
export declare const GroupedVirtuoso: <ItemData extends unknown = any, Context extends unknown = any>(props: GroupedVirtuosoProps<ItemData, Context> & {
|
|
154
169
|
ref?: Ref<GroupedVirtuosoHandle> | undefined;
|
|
155
170
|
}) => ReactElement;
|
|
156
171
|
|
|
157
172
|
export declare interface GroupedVirtuosoHandle {
|
|
158
173
|
scrollToIndex(location: number | IndexLocationWithAlign): void;
|
|
174
|
+
scrollIntoView(location: number | ScrollIntoViewLocation): void;
|
|
159
175
|
scrollTo(location: ScrollToOptions): void;
|
|
160
176
|
scrollBy(location: ScrollToOptions): void;
|
|
161
177
|
}
|
|
@@ -176,6 +192,13 @@ export declare interface GroupedVirtuosoProps<D, C> extends Omit<VirtuosoProps<D
|
|
|
176
192
|
itemContent?: GroupItemContent<D, C>;
|
|
177
193
|
}
|
|
178
194
|
|
|
195
|
+
export declare interface GroupIndexLocationWithAlign extends LocationOptions {
|
|
196
|
+
/**
|
|
197
|
+
* The group index of the item to scroll to.
|
|
198
|
+
*/
|
|
199
|
+
groupIndex: number;
|
|
200
|
+
}
|
|
201
|
+
|
|
179
202
|
export declare interface GroupItem<D> extends Item<D> {
|
|
180
203
|
type: 'group';
|
|
181
204
|
originalIndex?: number;
|
|
@@ -191,24 +214,7 @@ export declare type GroupProps = Pick<ComponentPropsWithRef<'div'>, 'style' | 'c
|
|
|
191
214
|
'data-known-size': number;
|
|
192
215
|
};
|
|
193
216
|
|
|
194
|
-
export declare
|
|
195
|
-
/**
|
|
196
|
-
* The index of the item to scroll to.
|
|
197
|
-
*/
|
|
198
|
-
index: number | 'LAST';
|
|
199
|
-
/**
|
|
200
|
-
* How to position the item in the viewport.
|
|
201
|
-
*/
|
|
202
|
-
align?: 'start' | 'center' | 'end';
|
|
203
|
-
/**
|
|
204
|
-
* Set 'smooth' to have an animated transition to the specified location.
|
|
205
|
-
*/
|
|
206
|
-
behavior?: 'smooth' | 'auto';
|
|
207
|
-
/**
|
|
208
|
-
* The offset to scroll.
|
|
209
|
-
*/
|
|
210
|
-
offset?: number;
|
|
211
|
-
}
|
|
217
|
+
export declare type IndexLocationWithAlign = FlatIndexLocationWithAlign | GroupIndexLocationWithAlign;
|
|
212
218
|
|
|
213
219
|
export declare interface Item<D> {
|
|
214
220
|
index: number;
|
|
@@ -244,6 +250,21 @@ export declare interface ListRange {
|
|
|
244
250
|
|
|
245
251
|
export declare type ListRootProps = Omit<React.HTMLProps<'div'>, 'ref' | 'data'>;
|
|
246
252
|
|
|
253
|
+
export declare interface LocationOptions {
|
|
254
|
+
/**
|
|
255
|
+
* How to position the item in the viewport.
|
|
256
|
+
*/
|
|
257
|
+
align?: 'start' | 'center' | 'end';
|
|
258
|
+
/**
|
|
259
|
+
* Set 'smooth' to have an animated transition to the specified location.
|
|
260
|
+
*/
|
|
261
|
+
behavior?: 'smooth' | 'auto';
|
|
262
|
+
/**
|
|
263
|
+
* The offset to scroll.
|
|
264
|
+
*/
|
|
265
|
+
offset?: number;
|
|
266
|
+
}
|
|
267
|
+
|
|
247
268
|
export declare enum LogLevel {
|
|
248
269
|
DEBUG = 0,
|
|
249
270
|
INFO = 1,
|
|
@@ -272,8 +293,9 @@ export declare type ScrollerProps = Pick<ComponentPropsWithRef<'div'>, 'style' |
|
|
|
272
293
|
'data-virtuoso-scroller'?: boolean;
|
|
273
294
|
};
|
|
274
295
|
|
|
275
|
-
export declare
|
|
276
|
-
|
|
296
|
+
export declare type ScrollIntoViewLocation = FlatScrollIntoViewLocation | GroupedScrollIntoViewLocation;
|
|
297
|
+
|
|
298
|
+
export declare interface ScrollIntoViewLocationOptions {
|
|
277
299
|
behavior?: 'auto' | 'smooth';
|
|
278
300
|
done?: () => void;
|
|
279
301
|
}
|
|
@@ -380,8 +402,8 @@ export declare const TableVirtuoso: <ItemData extends unknown = any, Context ext
|
|
|
380
402
|
}) => ReactElement;
|
|
381
403
|
|
|
382
404
|
export declare interface TableVirtuosoHandle {
|
|
383
|
-
scrollIntoView(location:
|
|
384
|
-
scrollToIndex(location: number |
|
|
405
|
+
scrollIntoView(location: number | FlatScrollIntoViewLocation): void;
|
|
406
|
+
scrollToIndex(location: number | FlatIndexLocationWithAlign): void;
|
|
385
407
|
scrollTo(location: ScrollToOptions): void;
|
|
386
408
|
scrollBy(location: ScrollToOptions): void;
|
|
387
409
|
}
|
|
@@ -663,11 +685,11 @@ export declare interface VirtuosoHandle {
|
|
|
663
685
|
/**
|
|
664
686
|
* Scrolls the component to the specified item index. See {@link IndexLocationWithAlign} for more options.
|
|
665
687
|
*/
|
|
666
|
-
scrollToIndex(location: number |
|
|
688
|
+
scrollToIndex(location: number | FlatIndexLocationWithAlign): void;
|
|
667
689
|
/**
|
|
668
690
|
* Scrolls the item into view if necessary. See [the website example](http://virtuoso.dev/keyboard-navigation/) for an implementation.
|
|
669
691
|
*/
|
|
670
|
-
scrollIntoView(location:
|
|
692
|
+
scrollIntoView(location: FlatScrollIntoViewLocation): void;
|
|
671
693
|
/**
|
|
672
694
|
* Scrolls the component to the specified location. See [ScrollToOptions (MDN)](https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions)
|
|
673
695
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@virtuoso.dev/react-urx"),t=require("@virtuoso.dev/urx"),n=require("react");function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var o=r(t),i=r(n);function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a.apply(this,arguments)}function l(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,m,d="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;exports.LogLevel=void 0,(m=exports.LogLevel||(exports.LogLevel={}))[m.DEBUG=0]="DEBUG",m[m.INFO=1]="INFO",m[m.WARN=2]="WARN",m[m.ERROR=3]="ERROR";var p=((c={})[exports.LogLevel.DEBUG]="debug",c[exports.LogLevel.INFO]="log",c[exports.LogLevel.WARN]="warn",c[exports.LogLevel.ERROR]="error",c),f=o.system(function(){var e=o.statefulStream(exports.LogLevel.ERROR);return{log:o.statefulStream(function(t,n,r){var i;void 0===r&&(r=exports.LogLevel.INFO),r>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:o.getValue(e))&&console[p[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function h(e,t){void 0===t&&(t=!0);var r=n.useRef(null),o=function(e){};if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t[0].target;null!==n.offsetParent&&e(n)});o=function(e){e&&t?(i.observe(e),r.current=e):(r.current&&i.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:o}}function g(e,t){return void 0===t&&(t=!0),h(e,t).callbackRef}function v(e,t,n,r,o,i){return h(function(n){for(var a=function(e,t,n,r){var o=e.length;if(0===o)return null;for(var i=[],a=0;a<o;a++){var l=e.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=t(l,"offsetHeight");if(0===c&&r("Zero-sized element, this should not happen",{child:l},exports.LogLevel.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,t,0,o),l=n.parentElement;!l.dataset.virtuosoScroller;)l=l.parentElement;var s=i?i.scrollTop:"window"===l.firstElementChild.dataset.viewportType?window.pageYOffset||document.documentElement.scrollTop:l.scrollTop;r({scrollTop:Math.max(s,0),scrollHeight:(null!=i?i:l).scrollHeight,viewportHeight:(null!=i?i:l).offsetHeight}),null!==a&&e(a)},n)}function S(e,t){return Math.round(e.getBoundingClientRect()[t])}function C(e,t,r,i,a){void 0===i&&(i=o.noop);var l=n.useRef(null),s=n.useRef(null),u=n.useRef(null),c=n.useCallback(function(n){var r=n.target,o=r===window||r===document?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,i=r===window?document.documentElement.scrollHeight:r.scrollHeight,a=r===window?window.innerHeight:r.offsetHeight;e({scrollTop:Math.max(o,0),scrollHeight:i,viewportHeight:a}),null!==s.current&&(o===s.current||o<=0||o===r.scrollHeight-S(r,"height"))&&(s.current=null,t(!0),u.current&&(clearTimeout(u.current),u.current=null))},[e,t]);return n.useEffect(function(){var e=a||l.current;return i(a||l.current),c({target:e}),e.addEventListener("scroll",c,{passive:!0}),function(){i(null),e.removeEventListener("scroll",c)}},[l,c,r,i,a]),{scrollerRef:l,scrollByCallback:function(e){l.current.scrollBy(e)},scrollToCallback:function(n){var r=l.current;if(r&&(!("offsetHeight"in r)||0!==r.offsetHeight)){var o,i,a,c="smooth"===n.behavior;if(r===window?(i=Math.max(S(document.documentElement,"height"),document.documentElement.scrollHeight),o=window.innerHeight,a=document.documentElement.scrollTop):(i=r.scrollHeight,o=S(r,"height"),a=r.scrollTop),n.top=Math.ceil(Math.max(Math.min(i-o,n.top),0)),Math.abs(o-i)<1.01||n.top===a)return e({scrollTop:a,scrollHeight:i,viewportHeight:o}),void(c&&t(!0));c?(s.current=n.top,u.current&&clearTimeout(u.current),u.current=setTimeout(function(){u.current=null,s.current=null,t(!0)},1e3)):s.current=null,r.scrollTo(n)}}}}var I=o.system(function(){var e=o.stream(),t=o.stream(),n=o.statefulStream(0),r=o.stream(),i=o.statefulStream(0),a=o.stream(),l=o.stream(),s=o.statefulStream(0),u=o.statefulStream(0),c=o.stream(),m=o.stream(),d=o.statefulStream(!1),p=o.statefulStream(!1);return o.connect(o.pipe(e,o.map(function(e){return e.scrollTop})),t),o.connect(o.pipe(e,o.map(function(e){return e.scrollHeight})),l),o.connect(t,i),{scrollContainerState:e,scrollTop:t,viewportHeight:a,headerHeight:s,footerHeight:u,scrollHeight:l,smoothScrollTargetReached:r,react18ConcurrentRendering:p,scrollTo:c,scrollBy:m,statefulScrollTop:i,deviation:n,scrollingInProgress:d}},[],{singleton:!0}),T={lvl:0};function x(e,t,n,r,o){return void 0===r&&(r=T),void 0===o&&(o=T),{k:e,v:t,lvl:n,l:r,r:o}}function w(e){return e===T}function y(){return T}function b(e,t){if(w(e))return T;var n=e.k,r=e.l,o=e.r;if(t===n){if(w(r))return o;if(w(o))return r;var i=k(r);return P(B(e,{k:i[0],v:i[1],l:z(r)}))}return P(B(e,t<n?{l:b(r,t)}:{r:b(o,t)}))}function E(e,t,n){if(void 0===n&&(n="k"),w(e))return[-Infinity,void 0];if(e[n]===t)return[e.k,e.v];if(e[n]<t){var r=E(e.r,t,n);return-Infinity===r[0]?[e.k,e.v]:r}return E(e.l,t,n)}function L(e,t,n){return w(e)?x(t,n,1):t===e.k?B(e,{k:t,v:n}):function(e){return V(U(e))}(B(e,t<e.k?{l:L(e.l,t,n)}:{r:L(e.r,t,n)}))}function H(e,t,n){if(w(e))return[];var r=e.k,o=e.v,i=e.r,a=[];return r>t&&(a=a.concat(H(e.l,t,n))),r>=t&&r<=n&&a.push({k:r,v:o}),r<=n&&(a=a.concat(H(i,t,n))),a}function R(e){return w(e)?[]:[].concat(R(e.l),[{k:e.k,v:e.v}],R(e.r))}function k(e){return w(e.r)?[e.k,e.v]:k(e.r)}function z(e){return w(e.r)?e.l:P(B(e,{r:z(e.r)}))}function B(e,t){return x(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function F(e){return w(e)||e.lvl>e.r.lvl}function P(e){var t=e.l,n=e.r,r=e.lvl;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(F(t))return U(B(e,{lvl:r-1}));if(w(t)||w(t.r))throw new Error("Unexpected empty nodes");return B(t.r,{l:B(t,{r:t.r.l}),r:B(e,{l:t.r.r,lvl:r-1}),lvl:r})}if(F(e))return V(B(e,{lvl:r-1}));if(w(n)||w(n.l))throw new Error("Unexpected empty nodes");var o=n.l,i=F(o)?n.lvl-1:n.lvl;return B(o,{l:B(e,{r:o.l,lvl:r-1}),r:V(B(n,{l:o.r,lvl:i})),lvl:o.lvl+1})}function O(e,t,n){return w(e)?[]:M(H(e,E(e,t)[0],n),function(e){return{index:e.k,value:e.v}})}function M(e,t){var n=e.length;if(0===n)return[];for(var r=t(e[0]),o=r.index,i=r.value,a=[],l=1;l<n;l++){var s=t(e[l]),u=s.index,c=s.value;a.push({start:o,end:u-1,value:i}),o=u,i=c}return a.push({start:o,end:Infinity,value:i}),a}function V(e){var t=e.r,n=e.lvl;return w(t)||w(t.r)||t.lvl!==n||t.r.lvl!==n?e:B(t,{l:B(e,{r:t.l}),lvl:n+1})}function U(e){var t=e.l;return w(t)||t.lvl!==e.lvl?e:B(t,{r:B(e,{l:t.r})})}function A(e,t,n,r){void 0===r&&(r=0);for(var o=e.length-1;r<=o;){var i=Math.floor((r+o)/2),a=n(e[i],t);if(0===a)return i;if(-1===a){if(o-r<2)return i-1;o=i-1}else{if(o===r)return i;r=i+1}}throw new Error("Failed binary finding record in array - "+e.join(",")+", searched for "+t)}function W(e,t,n){return e[A(e,t,n)]}function N(e){var t=e.size,n=e.startIndex,r=e.endIndex;return function(e){return e.start===n&&(e.end===r||Infinity===e.end)&&e.value===t}}function D(e,t){var n=e.index;return t===n?0:t<n?-1:1}function G(e,t){var n=e.offset;return t===n?0:t<n?-1:1}function j(e){return{index:e.index,value:e}}function _(e,t,n){var r=e,o=0,i=0,a=0,l=0;if(0!==t){a=r[l=A(r,t-1,D)].offset;var s=E(n,t-1);o=s[0],i=s[1],r.length&&r[l].size===E(n,t)[1]&&(l-=1),r=r.slice(0,l+1)}else r=[];for(var c,m=u(O(n,t,Infinity));!(c=m()).done;){var d=c.value,p=d.start,f=d.value,h=(p-o)*i+a;r.push({offset:h,size:f,index:p}),o=p,a=h,i=f}return{offsetTree:r,lastIndex:o,lastOffset:a,lastSize:i}}function K(e,t){var n=t[0],r=t[1];n.length>0&&(0,t[2])("received item sizes",n,exports.LogLevel.DEBUG);var o=e.sizeTree,i=o,a=0;if(r.length>0&&w(o)&&2===n.length){var l=n[0].size,s=n[1].size;i=r.reduce(function(e,t){return L(L(e,t,l),t+1,s)},i)}else{var c=function(e,t){for(var n,r=w(e)?0:Infinity,o=u(t);!(n=o()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(r=Math.min(r,l),w(e))e=L(e,0,a);else{var c=O(e,l-1,s+1);if(!c.some(N(i))){for(var m,d=!1,p=!1,f=u(c);!(m=f()).done;){var h=m.value,g=h.start,v=h.end,S=h.value;d?(s>=g||a===S)&&(e=b(e,g)):(p=S!==a,d=!0),v>s&&s>=g&&S!==a&&(e=L(e,s+1,S))}p&&(e=L(e,l,a))}}}return[e,r]}(i,n);i=c[0],a=c[1]}if(i===o)return e;var m=_(e.offsetTree,a,i),d=m.offsetTree;return{sizeTree:i,offsetTree:d,lastIndex:m.lastIndex,lastOffset:m.lastOffset,lastSize:m.lastSize,groupOffsetTree:r.reduce(function(e,t){return L(e,t,Y(t,d))},y()),groupIndices:r}}function Y(e,t){if(0===t.length)return 0;var n=W(t,e,D);return n.size*(e-n.index)+n.offset}function q(e,t){if(!Z(t))return e;for(var n=0;t.groupIndices[n]<=e+n;)n++;return e+n}function Z(e){return!w(e.groupOffsetTree)}var J={offsetHeight:"height",offsetWidth:"width"},$=o.system(function(e){var t=e[0].log,n=o.stream(),r=o.stream(),i=o.statefulStreamFromEmitter(r,0),l=o.stream(),s=o.stream(),u=o.statefulStream(0),c=o.statefulStream([]),m=o.statefulStream(void 0),d=o.statefulStream(void 0),p=o.statefulStream(function(e,t){return S(e,J[t])}),f=o.statefulStream(void 0),h={offsetTree:[],sizeTree:y(),groupOffsetTree:y(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},g=o.statefulStreamFromEmitter(o.pipe(n,o.withLatestFrom(c,t),o.scan(K,h),o.distinctUntilChanged()),h);o.connect(o.pipe(c,o.filter(function(e){return e.length>0}),o.withLatestFrom(g),o.map(function(e){var t=e[0],n=e[1],r=t.reduce(function(e,t,r){return L(e,t,Y(t,n.offsetTree)||r)},y());return a({},n,{groupIndices:t,groupOffsetTree:r})})),g),o.connect(o.pipe(r,o.withLatestFrom(g),o.filter(function(e){return e[0]<e[1].lastIndex}),o.map(function(e){var t=e[1];return[{startIndex:e[0],endIndex:t.lastIndex,size:t.lastSize}]})),n),o.connect(m,d);var v=o.statefulStreamFromEmitter(o.pipe(m,o.map(function(e){return void 0===e})),!0);o.connect(o.pipe(d,o.filter(function(e){return void 0!==e&&w(o.getValue(g).sizeTree)}),o.map(function(e){return[{startIndex:0,endIndex:0,size:e}]})),n);var C=o.streamFromEmitter(o.pipe(n,o.withLatestFrom(g),o.scan(function(e,t){var n=t[1];return{changed:n!==e.sizes,sizes:n}},{changed:!1,sizes:h}),o.map(function(e){return e.changed})));o.subscribe(o.pipe(u,o.scan(function(e,t){return{diff:e.prev-t,prev:t}},{diff:0,prev:0}),o.map(function(e){return e.diff})),function(e){e>0?o.publish(l,e):e<0&&o.publish(s,e)}),o.subscribe(o.pipe(u,o.withLatestFrom(t)),function(e){e[0]<0&&(0,e[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:u},exports.LogLevel.ERROR)});var I=o.streamFromEmitter(l);o.connect(o.pipe(l,o.withLatestFrom(g),o.map(function(e){var t=e[0],n=e[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return R(n.sizeTree).reduce(function(e,n){var r=n.k,o=n.v;return{ranges:[].concat(e.ranges,[{startIndex:e.prevIndex,endIndex:r+t-1,size:e.prevSize}]),prevIndex:r+t,prevSize:o}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),n);var T=o.streamFromEmitter(o.pipe(s,o.withLatestFrom(g),o.map(function(e){return Y(-e[0],e[1].offsetTree)})));return o.connect(o.pipe(s,o.withLatestFrom(g),o.map(function(e){var t=e[0],n=e[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var r=R(n.sizeTree).reduce(function(e,n){var r=n.v;return L(e,Math.max(0,n.k+t),r)},y());return a({},n,{sizeTree:r},_(n.offsetTree,0,r))})),g),{data:f,totalCount:r,sizeRanges:n,groupIndices:c,defaultItemSize:d,fixedItemSize:m,unshiftWith:l,shiftWith:s,shiftWithOffset:T,beforeUnshiftWith:I,firstItemIndex:u,sizes:g,listRefresh:C,statefulTotalCount:i,trackItemSizes:v,itemSize:p}},o.tup(f),{singleton:!0}),Q="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function X(e){var t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&Q||(t.behavior="auto"),t.offset||(t.offset=0),t}var ee=o.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,i=t.listRefresh,a=e[1],l=a.scrollingInProgress,s=a.viewportHeight,u=a.scrollTo,c=a.smoothScrollTargetReached,m=a.headerHeight,d=a.footerHeight,p=e[2].log,f=o.stream(),h=o.statefulStream(0),g=null,v=null,S=null;function C(){g&&(g(),g=null),S&&(S(),S=null),v&&(clearTimeout(v),v=null),o.publish(l,!1)}return o.connect(o.pipe(f,o.withLatestFrom(n,s,r,h,m,d,p),o.map(function(e){var t=e[0],n=e[1],r=e[2],a=e[3],s=e[4],u=e[5],m=e[6],d=e[7],p=X(t),h=p.align,I=p.behavior,T=p.offset,x=a-1,w=p.index;"LAST"===w&&(w=x),w=q(w,n);var y=Y(w=Math.max(0,w,Math.min(x,w)),n.offsetTree)+u;"end"===h?(y=y-r+E(n.sizeTree,w)[1],w===x&&(y+=m)):"center"===h?y=y-r/2+E(n.sizeTree,w)[1]/2:y-=s,T&&(y+=T);var b=function(e){C(),e?(d("retrying to scroll to",{location:t},exports.LogLevel.DEBUG),o.publish(f,t)):d("list did not change, scroll successful",{},exports.LogLevel.DEBUG)};if(C(),"smooth"===I){var L=!1;S=o.subscribe(i,function(e){L=L||e}),g=o.handleNext(c,function(){b(L)})}else g=o.handleNext(o.pipe(i,function(e){var t=setTimeout(function(){e(!1)},50);return function(n){n&&(e(!0),clearTimeout(t))}}),b);return v=setTimeout(function(){C()},1200),o.publish(l,!0),d("scrolling from index to",{index:w,top:y,behavior:I},exports.LogLevel.DEBUG),{top:y,behavior:I}})),u),{scrollToIndex:f,topListHeight:h}},o.tup($,I,f),{singleton:!0}),te="up",ne={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},re=o.system(function(e){var t=e[0],n=t.scrollContainerState,r=t.scrollTop,i=t.viewportHeight,a=t.headerHeight,l=t.footerHeight,s=t.scrollBy,u=o.statefulStream(!1),c=o.statefulStream(!0),m=o.stream(),d=o.stream(),p=o.statefulStream(4),f=o.statefulStream(0),h=o.streamFromEmitter(o.pipe(o.merge(o.pipe(o.duc(r),o.skip(1),o.mapTo(!0)),o.pipe(o.duc(r),o.skip(1),o.mapTo(!1),o.debounceTime(100))),o.distinctUntilChanged())),g=o.statefulStreamFromEmitter(o.pipe(o.merge(o.pipe(s,o.mapTo(!0)),o.pipe(s,o.mapTo(!1),o.debounceTime(200))),o.distinctUntilChanged()),!1);o.connect(o.pipe(o.combineLatest(o.duc(r),o.duc(f)),o.map(function(e){return e[0]<=e[1]}),o.distinctUntilChanged()),c),o.connect(o.pipe(c,o.throttleTime(50)),d);var v=o.streamFromEmitter(o.pipe(o.combineLatest(n,o.duc(i),o.duc(a),o.duc(l),o.duc(p)),o.scan(function(e,t){var n,r,o=t[0],i=o.scrollTop,a=o.scrollHeight,l=t[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-t[4]?(i>e.state.scrollTop?(n="SCROLLED_DOWN",r=e.state.scrollTop-i):(n="SIZE_DECREASED",r=e.state.scrollTop-i||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:r}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":l<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},ne),o.distinctUntilChanged(function(e,t){return e&&e.atBottom===t.atBottom}))),S=o.statefulStreamFromEmitter(o.pipe(n,o.scan(function(e,t){var n=t.scrollTop,r=t.scrollHeight;return e.scrollHeight!==r?e.scrollTop!==n&&n===r-t.viewportHeight?{scrollHeight:r,scrollTop:n,jump:e.scrollTop-n,changed:!0}:{scrollHeight:r,scrollTop:n,jump:0,changed:!0}:{scrollTop:n,scrollHeight:r,jump:0,changed:!1}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),o.filter(function(e){return e.changed}),o.map(function(e){return e.jump})),0);o.connect(o.pipe(v,o.map(function(e){return e.atBottom})),u),o.connect(o.pipe(u,o.throttleTime(50)),m);var C=o.statefulStream("down");o.connect(o.pipe(n,o.map(function(e){return e.scrollTop}),o.distinctUntilChanged(),o.scan(function(e,t){return o.getValue(g)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?te:"down",prevScrollTop:t}},{direction:"down",prevScrollTop:0}),o.map(function(e){return e.direction})),C),o.connect(o.pipe(n,o.throttleTime(50),o.mapTo("none")),C);var I=o.statefulStream(0);return o.connect(o.pipe(h,o.filter(function(e){return!e}),o.mapTo(0)),I),o.connect(o.pipe(r,o.throttleTime(100),o.withLatestFrom(h),o.filter(function(e){return!!e[1]}),o.scan(function(e,t){return[e[1],t[0]]},[0,0]),o.map(function(e){return e[1]-e[0]})),I),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:d,atBottomStateChange:m,scrollDirection:C,atBottomThreshold:p,atTopThreshold:f,scrollVelocity:I,lastJumpDueToItemResize:S}},o.tup(I)),oe=o.system(function(e){var n=e[0].log,r=o.statefulStream(!1),i=o.streamFromEmitter(o.pipe(r,o.filter(function(e){return e}),o.distinctUntilChanged()));return o.subscribe(r,function(e){e&&t.getValue(n)("props updated",{},exports.LogLevel.DEBUG)}),{propsReady:r,didMount:i}},t.tup(f),{singleton:!0}),ie=o.system(function(e){var t=e[0],n=t.sizes,r=t.listRefresh,i=t.defaultItemSize,a=e[1].scrollTop,l=e[2].scrollToIndex,s=e[3].didMount,u=o.statefulStream(!0),c=o.statefulStream(0);return o.connect(o.pipe(s,o.withLatestFrom(c),o.filter(function(e){return!!e[1]}),o.mapTo(!1)),u),o.subscribe(o.pipe(o.combineLatest(r,s),o.withLatestFrom(u,n,i),o.filter(function(e){var t=e[1],n=e[3];return e[0][1]&&(!w(e[2].sizeTree)||void 0!==n)&&!t}),o.withLatestFrom(c)),function(e){var t=e[1];setTimeout(function(){o.handleNext(a,function(){o.publish(u,!0)}),o.publish(l,t)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},o.tup($,I,ee,oe),{singleton:!0});function ae(e){return!!e&&("smooth"===e?"smooth":"auto")}var le=o.system(function(e){var t=e[0],n=t.totalCount,r=t.listRefresh,i=e[1],a=i.isAtBottom,l=i.atBottomState,s=e[2].scrollToIndex,u=e[3].scrolledToInitialItem,c=e[4],m=c.propsReady,d=c.didMount,p=e[5].log,f=e[6].scrollingInProgress,h=o.statefulStream(!1),g=null;function v(e){o.publish(s,{index:"LAST",align:"end",behavior:e})}return o.subscribe(o.pipe(o.combineLatest(o.pipe(o.duc(n),o.skip(1)),d),o.withLatestFrom(o.duc(h),a,u,f),o.map(function(e){var t=e[0],n=t[0],r=t[1]&&e[3],o="auto";return r&&(o=function(e,t){return"function"==typeof e?ae(e(t)):t&&ae(e)}(e[1],e[2]||e[4]),r=r&&!!o),{totalCount:n,shouldFollow:r,followOutputBehavior:o}}),o.filter(function(e){return e.shouldFollow})),function(e){var t=e.totalCount,n=e.followOutputBehavior;g&&(g(),g=null),g=o.handleNext(r,function(){o.getValue(p)("following output to ",{totalCount:t},exports.LogLevel.DEBUG),v(n),g=null})}),o.subscribe(o.pipe(o.combineLatest(o.duc(h),n,m),o.filter(function(e){return e[0]&&e[2]}),o.scan(function(e,t){var n=t[1];return{refreshed:e.value===n,value:n}},{refreshed:!1,value:0}),o.filter(function(e){return e.refreshed}),o.withLatestFrom(h,n)),function(e){var t=e[1],n=o.handleNext(l,function(e){!t||e.atBottom||"SIZE_INCREASED"!==e.notAtBottomBecause||g||(o.getValue(p)("scrolling to bottom due to increased size",{},exports.LogLevel.DEBUG),v("auto"))});setTimeout(n,100)}),o.subscribe(o.combineLatest(o.duc(h),l),function(e){var t=e[1];e[0]&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&v("auto")}),{followOutput:h}},o.tup($,re,ee,ie,oe,f,I));function se(e){return e.reduce(function(e,t){return e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e},{totalCount:0,groupIndices:[]})}var ue=t.system(function(e){var n=e[0],r=n.totalCount,o=n.groupIndices,i=n.sizes,a=e[1],l=a.scrollTop,s=a.headerHeight,u=t.stream(),c=t.stream(),m=t.streamFromEmitter(t.pipe(u,t.map(se)));return t.connect(t.pipe(m,t.map(t.prop("totalCount"))),r),t.connect(t.pipe(m,t.map(t.prop("groupIndices"))),o),t.connect(t.pipe(t.combineLatest(l,i,s),t.filter(function(e){return Z(e[1])}),t.map(function(e){return E(e[1].groupOffsetTree,Math.max(e[0]-e[2],0),"v")[0]}),t.distinctUntilChanged(),t.map(function(e){return[e]})),c),{groupCounts:u,topItemsIndexes:c}},t.tup($,I));function ce(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function me(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function de(e,t,n){return"number"==typeof e?n===te&&"top"===t||"down"===n&&"bottom"===t?e:0:n===te?"top"===t?e.main:e.reverse:"bottom"===t?e.main:e.reverse}function pe(e,t){return"number"==typeof e?e:e[t]||0}var fe=o.system(function(e){var t=e[0],n=t.scrollTop,r=t.viewportHeight,i=t.deviation,a=t.headerHeight,l=o.stream(),s=o.statefulStream(0),u=o.statefulStream(0),c=o.statefulStream(0),m=o.statefulStream(0),d=o.statefulStreamFromEmitter(o.pipe(o.combineLatest(o.duc(n),o.duc(r),o.duc(a),o.duc(l,ce),o.duc(m),o.duc(s),o.duc(u),o.duc(i),o.duc(c)),o.map(function(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=o[0],a=o[1],l=e[4],s=e[6],u=e[7],c=e[8],m=t-u,d=e[5]+s,p=Math.max(r-m,0),f="none",h=pe(c,"top"),g=pe(c,"bottom");return i-=u,a+=r+s,(i+=r+s)>t+d-h&&(f=te),(a-=u)<t-p+n+g&&(f="down"),"none"!==f?[Math.max(m-r-de(l,"top",f)-h,0),m-p-s+n+de(l,"bottom",f)+g]:null}),o.filter(function(e){return null!=e}),o.distinctUntilChanged(ce)),[0,0]);return{listBoundary:l,overscan:m,topListHeight:s,fixedHeaderHeight:u,increaseViewportBy:c,visibleRange:d}},o.tup(I),{singleton:!0}),he={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0};function ge(e,t,n){if(0===e.length)return[];if(!Z(t))return e.map(function(e){return a({},e,{index:e.index+n,originalIndex:e.index})});for(var r,o=[],i=O(t.groupOffsetTree,e[0].index,e[e.length-1].index),l=void 0,s=0,c=u(e);!(r=c()).done;){var m=r.value;(!l||l.end<m.index)&&(l=i.shift(),s=t.groupIndices.indexOf(l.start)),o.push(a({},m.index===l.start?{type:"group",index:s}:{index:m.index-(s+1)+n,groupIndex:s},{size:m.size,offset:m.offset,originalIndex:m.index,data:m.data}))}return o}function ve(e,t,n,r,o){var i=0,a=0;if(e.length>0){i=e[0].offset;var l=e[e.length-1];a=l.offset+l.size}var s=i,u=r.lastOffset+(n-r.lastIndex)*r.lastSize-a;return{items:ge(e,r,o),topItems:ge(t,r,o),topListHeight:t.reduce(function(e,t){return t.size+e},0),offsetTop:i,offsetBottom:u,top:s,bottom:a,totalCount:n}}var Se,Ce,Ie,Te=o.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,i=t.data,l=t.firstItemIndex,s=e[1],c=e[2],m=c.visibleRange,d=c.listBoundary,p=c.topListHeight,f=e[3],h=f.scrolledToInitialItem,g=f.initialTopMostItemIndex,v=e[4].topListHeight,S=e[5],C=e[6].didMount,I=o.statefulStream([]),T=o.stream();o.connect(s.topItemsIndexes,I);var x=o.statefulStreamFromEmitter(o.pipe(o.combineLatest(C,o.duc(m),o.duc(r),o.duc(n),o.duc(g),h,o.duc(I),o.duc(l),i),o.filter(function(e){return e[0]}),o.map(function(e){var t=e[1],n=t[0],r=t[1],i=e[2],a=e[4],l=e[5],s=e[6],c=e[7],m=e[8],d=e[3],p=d.sizeTree,f=d.offsetTree;if(0===i||0===n&&0===r)return he;if(w(p))return ve(function(e,t,n){if(Z(t)){var r=q(e,t);return[{index:E(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}(function(e,t){return"number"==typeof e?e:"LAST"===e.index?t-1:e.index}(a,i),d,m),[],i,d,c);var h=[];if(s.length>0)for(var g,v=s[0],S=s[s.length-1],C=0,I=u(O(p,v,S));!(g=I()).done;)for(var T=g.value,x=T.value,y=Math.max(T.start,v),b=Math.min(T.end,S),L=y;L<=b;L++)h.push({index:L,size:x,offset:C,data:m&&m[L]}),C+=x;if(!l)return ve([],h,i,d,c);var H=s.length>0?s[s.length-1]+1:0,R=function(e,t,n,r){return void 0===r&&(r=0),r>0&&(t=Math.max(t,W(e,r,D).offset)),M((i=n,l=A(o=e,t,a=G),s=A(o,i,a,l),o.slice(l,s+1)),j);var o,i,a,l,s}(f,n,r,H);if(0===R.length)return null;var k=i-1;return ve(o.tap([],function(e){for(var t,o=u(R);!(t=o()).done;){var i=t.value,a=i.value,l=a.offset,s=i.start,c=a.size;a.offset<n&&(l+=((s+=Math.floor((n-a.offset)/c))-i.start)*c),s<H&&(l+=(H-s)*c,s=H);for(var d=Math.min(i.end,k),p=s;p<=d&&!(l>=r);p++)e.push({index:p,size:c,offset:l,data:m&&m[p]}),l+=c}}),h,i,d,c)}),o.filter(function(e){return null!==e}),o.distinctUntilChanged()),he);return o.connect(o.pipe(i,o.filter(function(e){return void 0!==e}),o.map(function(e){return e.length})),r),o.connect(o.pipe(x,o.map(o.prop("topListHeight"))),v),o.connect(v,p),o.connect(o.pipe(x,o.map(function(e){return[e.top,e.bottom]})),d),o.connect(o.pipe(x,o.map(function(e){return e.items})),T),a({listState:x,topItemsIndexes:I,endReached:o.streamFromEmitter(o.pipe(x,o.filter(function(e){return e.items.length>0}),o.withLatestFrom(r,i),o.filter(function(e){var t=e[0].items;return t[t.length-1].originalIndex===e[1]-1}),o.map(function(e){return[e[1]-1,e[2]]}),o.distinctUntilChanged(ce),o.map(function(e){return e[0]}))),startReached:o.streamFromEmitter(o.pipe(x,o.throttleTime(200),o.filter(function(e){var t=e.items;return t.length>0&&t[0].originalIndex===e.topItems.length}),o.map(function(e){return e.items[0].index}),o.distinctUntilChanged())),rangeChanged:o.streamFromEmitter(o.pipe(x,o.filter(function(e){return e.items.length>0}),o.map(function(e){var t=e.items;return{startIndex:t[0].index,endIndex:t[t.length-1].index}}),o.distinctUntilChanged(me))),itemsRendered:T},S)},o.tup($,ue,fe,ie,ee,re,oe),{singleton:!0}),xe=o.system(function(e){var t=e[0],n=t.sizes,r=t.firstItemIndex,i=t.data,a=e[1].listState,l=e[2].didMount,s=o.statefulStream(0);return o.connect(o.pipe(l,o.withLatestFrom(s),o.filter(function(e){return 0!==e[1]}),o.withLatestFrom(n,r,i),o.map(function(e){var t=e[0][1],n=e[1],r=e[2],o=e[3],i=void 0===o?[]:o,a=0;if(n.groupIndices.length>0)for(var l,s=u(n.groupIndices);!((l=s()).done||l.value-a>=t);)a++;var c=t+a;return ve(Array.from({length:c}).map(function(e,t){return{index:t,size:0,offset:0,data:i[t]}}),[],c,n,r)})),a),{initialItemCount:s}},o.tup($,Te,oe),{singleton:!0}),we=o.system(function(e){var t=e[0].scrollVelocity,n=o.statefulStream(!1),r=o.stream(),i=o.statefulStream(!1);return o.connect(o.pipe(t,o.withLatestFrom(i,n,r),o.filter(function(e){return!!e[1]}),o.map(function(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=n.enter;if(r){if((0,n.exit)(t,o))return!1}else if(i(t,o))return!0;return r}),o.distinctUntilChanged()),n),o.subscribe(o.pipe(o.combineLatest(n,t,r),o.withLatestFrom(i)),function(e){var t=e[0],n=e[1];return t[0]&&n&&n.change&&n.change(t[1],t[2])}),{isSeeking:n,scrollSeekConfiguration:i,scrollVelocity:t,scrollSeekRangeChanged:r}},o.tup(re),{singleton:!0}),ye=t.system(function(e){var n=e[0].topItemsIndexes,r=t.statefulStream(0);return t.connect(t.pipe(r,t.filter(function(e){return e>0}),t.map(function(e){return Array.from({length:e}).map(function(e,t){return t})})),n),{topItemCount:r}},t.tup(Te)),be=o.system(function(e){var t=e[0],n=t.footerHeight,r=t.headerHeight,i=e[1].listState,a=o.stream(),l=o.statefulStreamFromEmitter(o.pipe(o.combineLatest(n,r,i),o.map(function(e){var t=e[2];return e[0]+e[1]+t.offsetBottom+t.bottom})),0);return o.connect(o.duc(l),a),{totalListHeight:l,totalListHeightChanged:a}},o.tup(I,Te),{singleton:!0}),Ee=o.system(function(e){var t=e[0],n=t.scrollBy,r=t.scrollTop,i=t.deviation,a=t.scrollingInProgress,l=e[1],s=l.isScrolling,u=l.isAtBottom,c=l.atBottomState,m=l.scrollDirection,d=e[3],p=d.beforeUnshiftWith,f=d.shiftWithOffset,h=d.sizes,g=e[4].log,v=o.streamFromEmitter(o.pipe(e[2].listState,o.withLatestFrom(l.lastJumpDueToItemResize),o.scan(function(e,t){var n=e[1],r=t[0],o=r.items,i=r.totalCount,a=r.bottom+r.offsetBottom,l=0;return e[2]===i&&n.length>0&&o.length>0&&(0===o[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-e[3])&&(l+=t[1])),[l,o,i,a]},[0,[],0,0]),o.filter(function(e){return 0!==e[0]}),o.withLatestFrom(r,m,a,g,u,c),o.filter(function(e){return!e[3]&&0!==e[1]&&e[2]===te}),o.map(function(e){var t=e[0][0];return(0,e[4])("Upward scrolling compensation",{amount:t},exports.LogLevel.DEBUG),t})));return o.connect(o.pipe(v,o.withLatestFrom(i),o.map(function(e){return e[1]-e[0]})),i),o.subscribe(o.pipe(o.combineLatest(o.statefulStreamFromEmitter(s,!1),i),o.filter(function(e){return!e[0]&&0!==e[1]}),o.map(function(e){return e[1]}),o.throttleTime(1)),function(e){e>0?(o.publish(n,{top:-e,behavior:"auto"}),o.publish(i,0)):(o.publish(i,0),o.publish(n,{top:-e,behavior:"auto"}))}),o.connect(o.pipe(f,o.map(function(e){return{top:-e}})),n),o.connect(o.pipe(p,o.withLatestFrom(h),o.map(function(e){return e[0]*e[1].lastSize})),v),{deviation:i}},o.tup(I,re,Te,$,f)),Le=o.system(function(e){var t=e[0].totalListHeight,n=e[1].didMount,r=e[2].scrollTo,i=o.statefulStream(0);return o.subscribe(o.pipe(n,o.withLatestFrom(i),o.filter(function(e){return 0!==e[1]}),o.map(function(e){return{top:e[1]}})),function(e){o.handleNext(o.pipe(t,o.filter(function(e){return 0!==e})),function(){setTimeout(function(){o.publish(r,e)})})}),{initialScrollTop:i}},o.tup(be,oe,I),{singleton:!0}),He=o.system(function(e){var t=e[0].viewportHeight,n=e[1].totalListHeight,r=o.statefulStream(!1);return{alignToBottom:r,paddingTopAddition:o.statefulStreamFromEmitter(o.pipe(o.combineLatest(r,t,n),o.filter(function(e){return e[0]}),o.map(function(e){return Math.max(0,e[1]-e[2])}),o.distinctUntilChanged()),0)}},o.tup(I,be),{singleton:!0}),Re=o.system(function(e){var t=e[0],n=t.scrollTo,r=t.scrollContainerState,i=o.stream(),l=o.stream(),s=o.stream(),u=o.statefulStream(!1),c=o.statefulStream(void 0);return o.connect(o.pipe(o.combineLatest(i,l),o.map(function(e){var t=e[0],n=t.viewportHeight,r=t.scrollHeight;return{scrollTop:Math.max(0,t.scrollTop-e[1].offsetTop),scrollHeight:r,viewportHeight:n}})),r),o.connect(o.pipe(n,o.withLatestFrom(l),o.map(function(e){var t=e[0];return a({},t,{top:t.top+e[1].offsetTop})})),s),{useWindowScroll:u,customScrollParent:c,windowScrollContainerState:i,windowViewportRect:l,windowScrollTo:s}},o.tup(I)),ke=o.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,i=e[1],a=i.scrollTop,l=i.viewportHeight,s=i.headerHeight,u=i.scrollingInProgress,c=e[2].scrollToIndex,m=o.stream();return o.connect(o.pipe(m,o.withLatestFrom(n,l,r,s,a),o.map(function(e){var t=e[0],n=t.index,r=t.behavior,i=void 0===r?"auto":r,a=t.done,l=e[1],s=e[2],c=e[4],m=e[5],d=e[3]-1,p=null;n=q(n,l);var f=Y(n=Math.max(0,n,Math.min(d,n)),l.offsetTree)+c;return f<m?p={index:n,behavior:i,align:"start"}:f+E(l.sizeTree,n)[1]>m+s&&(p={index:n,behavior:i,align:"end"}),p?a&&o.handleNext(o.pipe(u,o.skip(1),o.filter(function(e){return!1===e})),a):a&&a(),p}),o.filter(function(e){return null!==e})),c),{scrollIntoView:m}},o.tup($,I,ee,Te,f),{singleton:!0}),ze=["listState","topItemsIndexes"],Be=o.system(function(e){return a({},e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},o.tup(fe,xe,oe,we,be,Le,He,Re,ke)),Fe=o.system(function(e){var t=e[0],n=t.totalCount,r=t.sizeRanges,i=t.fixedItemSize,s=t.defaultItemSize,u=t.trackItemSizes,c=t.itemSize,m=t.data,d=t.firstItemIndex,p=t.groupIndices,f=t.statefulTotalCount,h=e[1],g=h.initialTopMostItemIndex,v=h.scrolledToInitialItem,S=e[2],C=e[3],I=e[4],T=I.listState,x=I.topItemsIndexes,w=l(I,ze),y=e[5].scrollToIndex,b=e[7].topItemCount,E=e[8].groupCounts,L=e[9],H=e[10];return o.connect(w.rangeChanged,L.scrollSeekRangeChanged),o.connect(o.pipe(L.windowViewportRect,o.map(o.prop("visibleHeight"))),S.viewportHeight),a({totalCount:n,data:m,firstItemIndex:d,sizeRanges:r,initialTopMostItemIndex:g,scrolledToInitialItem:v,topItemsIndexes:x,topItemCount:b,groupCounts:E,fixedItemHeight:i,defaultItemHeight:s},C,{statefulTotalCount:f,listState:T,scrollToIndex:y,trackItemSizes:u,itemSize:c,groupIndices:p},w,L,S,H)},o.tup($,ie,I,le,Te,ee,Ee,ye,ue,Be,f)),Pe=(Se=function(){if("undefined"==typeof document)return"sticky";var e=document.createElement("div");return e.style.position="-webkit-sticky","-webkit-sticky"===e.style.position?"-webkit-sticky":"sticky"},Ie=!1,function(){return Ie||(Ie=!0,Ce=Se()),Ce});function Oe(e,t){var r=n.useRef(null),o=n.useCallback(function(n){if(null!==n){var o,i,a=n.getBoundingClientRect(),l=a.width;if(t){var s=t.getBoundingClientRect(),u=a.top-s.top;o=s.height-Math.max(0,u),i=u+t.scrollTop}else o=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;r.current={offsetTop:i,visibleHeight:o,visibleWidth:l},e(r.current)}},[e,t]),i=h(o),a=i.callbackRef,l=i.ref,s=n.useCallback(function(){o(l.current)},[o,l]);return n.useEffect(function(){if(t){t.addEventListener("scroll",s);var e=new ResizeObserver(s);return e.observe(t),function(){t.removeEventListener("scroll",s),e.unobserve(t)}}return window.addEventListener("scroll",s),window.addEventListener("resize",s),function(){window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}},[s,t]),a}var Me=["placeholder"],Ve=["style","children"],Ue=["style","children"];function Ae(e){return e}var We=t.system(function(){var e=t.statefulStream(function(e){return"Item "+e}),n=t.statefulStream(null),r=t.statefulStream(function(e){return"Group "+e}),o=t.statefulStream({}),i=t.statefulStream(Ae),a=t.statefulStream("div"),l=t.statefulStream(t.noop),s=function(e,n){return void 0===n&&(n=null),t.statefulStreamFromEmitter(t.pipe(o,t.map(function(t){return t[e]}),t.distinctUntilChanged()),n)};return{context:n,itemContent:e,groupContent:r,components:o,computeItemKey:i,headerFooterTag:a,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function Ne(e,n){var r=t.stream();return t.subscribe(r,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+n,"color: red;","color: inherit;","color: blue;")}),t.connect(r,e),r}var De=t.system(function(e){var n=e[0],r=e[1],o={item:Ne(r.itemContent,"Rename the %citem%c prop to %citemContent."),group:Ne(r.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Ne(n.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Ne(n.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Ne(n.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:t.stream(),maxHeightCacheSize:t.stream(),footer:t.stream(),header:t.stream(),HeaderContainer:t.stream(),FooterContainer:t.stream(),ItemContainer:t.stream(),ScrollContainer:t.stream(),GroupContainer:t.stream(),ListContainer:t.stream(),emptyComponent:t.stream(),scrollSeek:t.stream()};function i(e,n,o){t.connect(t.pipe(e,t.withLatestFrom(r.components),t.map(function(e){var t,r=e[0],i=e[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),a({},i,((t={})[n]=r,t))})),r.components)}return t.subscribe(o.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;")}),t.subscribe(o.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),t.subscribe(o.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),t.subscribe(o.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),t.subscribe(o.scrollSeek,function(e){var o=e.placeholder,i=l(e,Me);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),t.publish(r.components,a({},t.getValue(r.components),{ScrollSeekPlaceholder:o})),t.publish(n.scrollSeekConfiguration,i)}),i(o.footer,"Footer","footer"),i(o.header,"Header","header"),i(o.ItemContainer,"Item","ItemContainer"),i(o.ListContainer,"List","ListContainer"),i(o.ScrollContainer,"Scroller","ScrollContainer"),i(o.emptyComponent,"EmptyPlaceholder","emptyComponent"),i(o.GroupContainer,"Group","GroupContainer"),a({},n,r,o)},t.tup(Fe,We)),Ge=function(e){return i.createElement("div",{style:{height:e.height}})},je={position:Pe(),zIndex:1,overflowAnchor:"none"},_e={overflowAnchor:"none"},Ke=i.memo(function(e){var r=e.showTopList,o=void 0!==r&&r,l=st("listState"),s=lt("sizeRanges"),u=st("useWindowScroll"),c=st("customScrollParent"),m=lt("windowScrollContainerState"),d=lt("scrollContainerState"),p=c||u?m:d,f=st("itemContent"),h=st("context"),g=st("groupContent"),S=st("trackItemSizes"),C=st("itemSize"),I=st("log"),T=v(s,C,S,o?t.noop:p,I,c),x=T.callbackRef,w=T.ref,y=i.useState(0),b=y[0],E=y[1];ut("deviation",function(e){b!==e&&(w.current.style.marginTop=e+"px",E(e))});var L=st("EmptyPlaceholder"),H=st("ScrollSeekPlaceholder")||Ge,R=st("ListComponent"),k=st("ItemComponent"),z=st("GroupComponent"),B=st("computeItemKey"),F=st("isSeeking"),P=st("groupIndices").length>0,O=st("paddingTopAddition"),M=st("firstItemIndex"),V=st("statefulTotalCount"),U=o?{}:{boxSizing:"border-box",paddingTop:l.offsetTop+O,paddingBottom:l.offsetBottom,marginTop:b};return!o&&0===V&&L?n.createElement(L,Je(L,h)):n.createElement(R,a({},Je(R,h),{ref:x,style:U,"data-test-id":o?"virtuoso-top-item-list":"virtuoso-item-list"}),(o?l.topItems:l.items).map(function(e){var t=e.originalIndex,r=B(t+M,e.data,h);return F?n.createElement(H,a({},Je(H,h),{key:r,index:e.index,height:e.size,type:e.type||"item"},"group"===e.type?{}:{groupIndex:e.groupIndex})):"group"===e.type?n.createElement(z,a({},Je(z,h),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:je}),g(e.index)):n.createElement(k,a({},Je(k,h),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex,style:_e}),P?f(e.index,e.groupIndex,e.data,h):f(e.index,e.data,h))}))}),Ye={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},qe={width:"100%",height:"100%",position:"absolute",top:0},Ze={width:"100%",position:Pe(),top:0};function Je(e,t){if("string"!=typeof e)return{context:t}}var $e=i.memo(function(){var e=st("HeaderComponent"),t=lt("headerHeight"),r=st("headerFooterTag"),o=g(function(e){return t(S(e,"height"))}),i=st("context");return e?n.createElement(r,{ref:o},n.createElement(e,Je(e,i))):null}),Qe=i.memo(function(){var e=st("FooterComponent"),t=lt("footerHeight"),r=st("headerFooterTag"),o=g(function(e){return t(S(e,"height"))}),i=st("context");return e?n.createElement(r,{ref:o},n.createElement(e,Je(e,i))):null});function Xe(e){var t=e.usePublisher,r=e.useEmitter,o=e.useEmitterValue;return i.memo(function(e){var i=e.style,s=e.children,u=l(e,Ve),c=t("scrollContainerState"),m=o("ScrollerComponent"),d=t("smoothScrollTargetReached"),p=o("scrollerRef"),f=o("context"),h=C(c,d,m,p),g=h.scrollerRef,v=h.scrollByCallback;return r("scrollTo",h.scrollToCallback),r("scrollBy",v),n.createElement(m,a({ref:g,style:a({},Ye,i),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},u,Je(m,f)),s)})}function et(e){var r=e.usePublisher,o=e.useEmitter,s=e.useEmitterValue;return i.memo(function(e){var i=e.style,u=e.children,c=l(e,Ue),m=r("windowScrollContainerState"),p=s("ScrollerComponent"),f=r("smoothScrollTargetReached"),h=s("totalListHeight"),g=s("deviation"),v=s("customScrollParent"),S=s("context"),I=C(m,f,p,t.noop,v),T=I.scrollerRef,x=I.scrollByCallback,w=I.scrollToCallback;return d(function(){return T.current=v||window,function(){T.current=null}},[T,v]),o("windowScrollTo",w),o("scrollBy",x),n.createElement(p,a({style:a({position:"relative"},i,0!==h?{height:h+g}:{}),"data-virtuoso-scroller":!0},c,Je(p,S)),u)})}var tt=function(e){var n=e.children,r=lt("viewportHeight"),o=g(t.compose(r,function(e){return S(e,"height")}));return i.createElement("div",{style:qe,ref:o,"data-viewport-type":"element"},n)},nt=function(e){var t=e.children,n=Oe(lt("windowViewportRect"),st("customScrollParent"));return i.createElement("div",{ref:n,style:qe,"data-viewport-type":"window"},t)},rt=function(e){var t=e.children,r=st("TopItemListComponent"),o=st("headerHeight"),i=a({},Ze,{marginTop:o+"px"}),l=st("context");return n.createElement(r||"div",{style:i,context:l},t)},ot=i.memo(function(e){var t=st("useWindowScroll"),n=st("topItemsIndexes").length>0,r=st("customScrollParent"),o=r||t?nt:tt;return i.createElement(r||t?mt:ct,a({},e),i.createElement(o,null,i.createElement($e,null),i.createElement(Ke,null),i.createElement(Qe,null)),n&&i.createElement(rt,null,i.createElement(Ke,{showTopList:!0})))}),it=e.systemToComponent(De,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},ot),at=it.Component,lt=it.usePublisher,st=it.useEmitterValue,ut=it.useEmitter,ct=Xe({usePublisher:lt,useEmitterValue:st,useEmitter:ut}),mt=et({usePublisher:lt,useEmitterValue:st,useEmitter:ut}),dt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},pt={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},ft=Math.round,ht=Math.ceil,gt=Math.floor,vt=Math.min,St=Math.max;function Ct(e,t){return Array.from({length:t-e+1}).map(function(t,n){return{index:n+e}})}var It=o.system(function(e){var t=e[0],n=t.overscan,r=t.visibleRange,i=t.listBoundary,l=e[1],s=l.scrollTop,u=l.viewportHeight,c=l.scrollBy,m=l.scrollTo,d=l.smoothScrollTargetReached,p=l.scrollContainerState,f=e[2],h=e[3],g=e[4],v=g.propsReady,S=g.didMount,C=e[5],I=C.windowViewportRect,T=C.windowScrollTo,x=C.useWindowScroll,w=C.customScrollParent,y=C.windowScrollContainerState,b=o.statefulStream(0),E=o.statefulStream(0),L=o.statefulStream(dt),H=o.statefulStream({height:0,width:0}),R=o.statefulStream({height:0,width:0}),k=o.stream(),z=o.stream(),B=o.statefulStream(0);o.connect(o.pipe(S,o.withLatestFrom(E),o.filter(function(e){return 0!==e[1]}),o.map(function(e){return{items:Ct(0,e[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),L),o.connect(o.pipe(o.combineLatest(o.duc(b),r,o.duc(R,function(e,t){return e&&e.width===t.width&&e.height===t.height})),o.withLatestFrom(H),o.map(function(e){var t=e[0],n=t[0],r=t[1],o=r[0],i=r[1],a=t[2],l=e[1],s=a.height,u=a.width,c=l.width;if(0===n||0===c)return dt;if(0===u)return pt;var m=wt(c,u),d=m*gt(o/s),p=m*ht(i/s)-1;p=vt(n-1,p);var f=Ct(d=vt(p,St(0,d)),p),h=Tt(l,a,f),g=h.top,v=h.bottom;return{items:f,offsetTop:g,offsetBottom:ht(n/m)*s-v,top:g,bottom:v,itemHeight:s,itemWidth:u}})),L),o.connect(o.pipe(H,o.map(function(e){return e.height})),u),o.connect(o.pipe(o.combineLatest(H,R,L),o.map(function(e){var t=Tt(e[0],e[1],e[2].items);return[t.top,t.bottom]}),o.distinctUntilChanged(ce)),i);var F=o.streamFromEmitter(o.pipe(o.duc(L),o.filter(function(e){return e.items.length>0}),o.withLatestFrom(b),o.filter(function(e){var t=e[0].items;return t[t.length-1].index===e[1]-1}),o.map(function(e){return e[1]-1}),o.distinctUntilChanged())),P=o.streamFromEmitter(o.pipe(o.duc(L),o.filter(function(e){var t=e.items;return t.length>0&&0===t[0].index}),o.mapTo(0),o.distinctUntilChanged())),O=o.streamFromEmitter(o.pipe(o.duc(L),o.filter(function(e){return e.items.length>0}),o.map(function(e){var t=e.items;return{startIndex:t[0].index,endIndex:t[t.length-1].index}}),o.distinctUntilChanged(me)));o.connect(O,h.scrollSeekRangeChanged),o.connect(o.pipe(k,o.withLatestFrom(H,R,b),o.map(function(e){var t=e[1],n=e[2],r=e[3],o=X(e[0]),i=o.align,a=o.behavior,l=o.offset,s=o.index;"LAST"===s&&(s=r-1);var u=xt(t,n,s=St(0,s,vt(r-1,s)));return"end"===i?u=ft(u-t.height+n.height):"center"===i&&(u=ft(u-t.height/2+n.height/2)),l&&(u+=l),{top:u,behavior:a}})),m);var M=o.statefulStreamFromEmitter(o.pipe(L,o.map(function(e){return e.offsetBottom+e.bottom})),0);return o.connect(o.pipe(I,o.map(function(e){return{width:e.visibleWidth,height:e.visibleHeight}})),H),a({totalCount:b,viewportDimensions:H,itemDimensions:R,scrollTop:s,scrollHeight:z,overscan:n,scrollBy:c,scrollTo:m,scrollToIndex:k,smoothScrollTargetReached:d,windowViewportRect:I,windowScrollTo:T,useWindowScroll:x,customScrollParent:w,windowScrollContainerState:y,deviation:B,scrollContainerState:p,initialItemCount:E},h,{gridState:L,totalListHeight:M},f,{startReached:P,endReached:F,rangeChanged:O,propsReady:v})},o.tup(fe,I,re,we,oe,Re));function Tt(e,t,n){var r=t.height;return void 0===r||0===n.length?{top:0,bottom:0}:{top:xt(e,t,n[0].index),bottom:xt(e,t,n[n.length-1].index)+r}}function xt(e,t,n){var r=wt(e.width,t.width);return gt(n/r)*t.height}function wt(e,t){return St(1,gt(e/t))}var yt=["placeholder"],bt=o.system(function(){var e=o.statefulStream(function(e){return"Item "+e}),t=o.statefulStream({}),n=o.statefulStream(null),r=o.statefulStream("virtuoso-grid-item"),i=o.statefulStream("virtuoso-grid-list"),a=o.statefulStream(Ae),l=o.statefulStream(o.noop),s=function(e,n){return void 0===n&&(n=null),o.statefulStreamFromEmitter(o.pipe(t,o.map(function(t){return t[e]}),o.distinctUntilChanged()),n)};return{context:n,itemContent:e,components:t,computeItemKey:a,itemClassName:r,listClassName:i,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Et=o.system(function(e){var t=e[0],n=e[1],r={item:Ne(n.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:o.stream(),ScrollContainer:o.stream(),ListContainer:o.stream(),emptyComponent:o.stream(),scrollSeek:o.stream()};function i(e,t,r){o.connect(o.pipe(e,o.withLatestFrom(n.components),o.map(function(e){var n,o=e[0],i=e[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+t+" instead."),a({},i,((n={})[t]=o,n))})),n.components)}return o.subscribe(r.scrollSeek,function(e){var r=e.placeholder,i=l(e,yt);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),o.publish(n.components,a({},o.getValue(n.components),{ScrollSeekPlaceholder:r})),o.publish(t.scrollSeekConfiguration,i)}),i(r.ItemContainer,"Item","ItemContainer"),i(r.ListContainer,"List","ListContainer"),i(r.ScrollContainer,"Scroller","ScrollContainer"),a({},t,n,r)},o.tup(It,bt)),Lt=i.memo(function(){var e=Pt("gridState"),t=Pt("listClassName"),r=Pt("itemClassName"),o=Pt("itemContent"),i=Pt("computeItemKey"),l=Pt("isSeeking"),s=Ft("scrollHeight"),u=Pt("ItemComponent"),c=Pt("ListComponent"),m=Pt("ScrollSeekPlaceholder"),d=Pt("context"),p=Ft("itemDimensions"),f=g(function(e){s(e.parentElement.parentElement.scrollHeight);var t=e.firstChild;t&&p(t.getBoundingClientRect())});return n.createElement(c,a({ref:f,className:t},Je(c,d),{style:{paddingTop:e.offsetTop,paddingBottom:e.offsetBottom}}),e.items.map(function(t){var s=i(t.index);return l?n.createElement(m,a({key:s},Je(m,d),{index:t.index,height:e.itemHeight,width:e.itemWidth})):n.createElement(u,a({},Je(u,d),{className:r,"data-index":t.index,key:s}),o(t.index,d))}))}),Ht=function(e){var t=e.children,n=Ft("viewportDimensions"),r=g(function(e){n(e.getBoundingClientRect())});return i.createElement("div",{style:qe,ref:r},t)},Rt=function(e){var t=e.children,n=Oe(Ft("windowViewportRect"),Pt("customScrollParent"));return i.createElement("div",{ref:n,style:qe},t)},kt=i.memo(function(e){var t=a({},e),n=Pt("useWindowScroll"),r=Pt("customScrollParent"),o=r||n?Rt:Ht;return i.createElement(r||n?Vt:Mt,a({},t),i.createElement(o,null,i.createElement(Lt,null)))}),zt=e.systemToComponent(Et,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},kt),Bt=zt.Component,Ft=zt.usePublisher,Pt=zt.useEmitterValue,Ot=zt.useEmitter,Mt=Xe({usePublisher:Ft,useEmitterValue:Pt,useEmitter:Ot}),Vt=et({usePublisher:Ft,useEmitterValue:Pt,useEmitter:Ot}),Ut=t.system(function(){var e=t.statefulStream(function(e){return i.createElement("td",null,"Item $",e)}),n=t.statefulStream(null),r=t.statefulStream(null),o=t.statefulStream({}),a=t.statefulStream(Ae),l=t.statefulStream(t.noop),s=function(e,n){return void 0===n&&(n=null),t.statefulStreamFromEmitter(t.pipe(o,t.map(function(t){return t[e]}),t.distinctUntilChanged()),n)};return{context:n,itemContent:e,fixedHeaderContent:r,components:o,computeItemKey:a,scrollerRef:l,TableComponent:s("Table","table"),TableHeadComponent:s("TableHead","thead"),TableBodyComponent:s("TableBody","tbody"),TableRowComponent:s("TableRow","tr"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),FillerRow:s("FillerRow")}}),At=t.system(function(e){return a({},e[0],e[1])},t.tup(Fe,Ut)),Wt=function(e){return i.createElement("tr",null,i.createElement("td",{style:{height:e.height}}))},Nt=function(e){return i.createElement("tr",null,i.createElement("td",{style:{height:e.height,padding:0,border:0}}))},Dt=i.memo(function(){var e=Zt("listState"),t=qt("sizeRanges"),r=Zt("useWindowScroll"),o=Zt("customScrollParent"),l=qt("windowScrollContainerState"),s=qt("scrollContainerState"),u=o||r?l:s,c=Zt("itemContent"),m=Zt("trackItemSizes"),d=v(t,Zt("itemSize"),m,u,Zt("log"),o),p=d.callbackRef,f=d.ref,h=i.useState(0),g=h[0],S=h[1];Jt("deviation",function(e){g!==e&&(f.current.style.marginTop=e+"px",S(e))});var C=Zt("EmptyPlaceholder"),I=Zt("ScrollSeekPlaceholder")||Wt,T=Zt("FillerRow")||Nt,x=Zt("TableBodyComponent"),w=Zt("TableRowComponent"),y=Zt("computeItemKey"),b=Zt("isSeeking"),E=Zt("paddingTopAddition"),L=Zt("firstItemIndex"),H=Zt("statefulTotalCount"),R=Zt("context");if(0===H&&C)return n.createElement(C,Je(C,R));var k=e.offsetTop+E+g,z=e.offsetBottom,B=k>0?i.createElement(T,{height:k,key:"padding-top"}):null,F=z>0?i.createElement(T,{height:z,key:"padding-bottom"}):null,P=e.items.map(function(e){var t=e.originalIndex,r=y(t+L,e.data,R);return b?n.createElement(I,a({},Je(I,R),{key:r,index:e.index,height:e.size,type:e.type||"item"})):n.createElement(w,a({},Je(w,R),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:{overflowAnchor:"none"}}),c(e.index,e.data,R))});return n.createElement(x,a({ref:p,"data-test-id":"virtuoso-item-list"},Je(x,R)),[B].concat(P,[F]))}),Gt=function(e){var n=e.children,r=qt("viewportHeight"),o=g(t.compose(r,function(e){return S(e,"height")}));return i.createElement("div",{style:qe,ref:o,"data-viewport-type":"element"},n)},jt=function(e){var t=e.children,n=Oe(qt("windowViewportRect"),Zt("customScrollParent"));return i.createElement("div",{ref:n,style:qe,"data-viewport-type":"window"},t)},_t=i.memo(function(e){var n=Zt("useWindowScroll"),r=Zt("customScrollParent"),o=qt("fixedHeaderHeight"),l=Zt("fixedHeaderContent"),s=Zt("context"),u=g(t.compose(o,function(e){return S(e,"height")})),c=r||n?Qt:$t,m=r||n?jt:Gt,d=Zt("TableComponent"),p=Zt("TableHeadComponent"),f=l?i.createElement(p,a({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:u},Je(p,s)),l()):null;return i.createElement(c,a({},e),i.createElement(m,null,i.createElement(d,a({style:{borderSpacing:0}},Je(d,s)),[f,i.createElement(Dt,{key:"TableBody"})])))}),Kt=e.systemToComponent(At,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},_t),Yt=Kt.Component,qt=Kt.usePublisher,Zt=Kt.useEmitterValue,Jt=Kt.useEmitter,$t=Xe({usePublisher:qt,useEmitterValue:Zt,useEmitter:Jt}),Qt=et({usePublisher:qt,useEmitterValue:Zt,useEmitter:Jt}),Xt=at,en=Yt,tn=Bt;exports.GroupedVirtuoso=at,exports.TableVirtuoso=en,exports.Virtuoso=Xt,exports.VirtuosoGrid=tn;
|
|
1
|
+
"use strict";var e=require("@virtuoso.dev/react-urx"),t=require("@virtuoso.dev/urx"),n=require("react");function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var o=r(t),i=r(n);function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a.apply(this,arguments)}function l(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,m,d="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;exports.LogLevel=void 0,(m=exports.LogLevel||(exports.LogLevel={}))[m.DEBUG=0]="DEBUG",m[m.INFO=1]="INFO",m[m.WARN=2]="WARN",m[m.ERROR=3]="ERROR";var p=((c={})[exports.LogLevel.DEBUG]="debug",c[exports.LogLevel.INFO]="log",c[exports.LogLevel.WARN]="warn",c[exports.LogLevel.ERROR]="error",c),f=o.system(function(){var e=o.statefulStream(exports.LogLevel.ERROR);return{log:o.statefulStream(function(t,n,r){var i;void 0===r&&(r=exports.LogLevel.INFO),r>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:o.getValue(e))&&console[p[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function h(e,t){void 0===t&&(t=!0);var r=n.useRef(null),o=function(e){};if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t[0].target;null!==n.offsetParent&&e(n)});o=function(e){e&&t?(i.observe(e),r.current=e):(r.current&&i.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:o}}function g(e,t){return void 0===t&&(t=!0),h(e,t).callbackRef}function v(e,t,n,r,o,i){return h(function(n){for(var a=function(e,t,n,r){var o=e.length;if(0===o)return null;for(var i=[],a=0;a<o;a++){var l=e.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=t(l,"offsetHeight");if(0===c&&r("Zero-sized element, this should not happen",{child:l},exports.LogLevel.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,t,0,o),l=n.parentElement;!l.dataset.virtuosoScroller;)l=l.parentElement;var s=i?i.scrollTop:"window"===l.firstElementChild.dataset.viewportType?window.pageYOffset||document.documentElement.scrollTop:l.scrollTop;r({scrollTop:Math.max(s,0),scrollHeight:(null!=i?i:l).scrollHeight,viewportHeight:(null!=i?i:l).offsetHeight}),null!==a&&e(a)},n)}function S(e,t){return Math.round(e.getBoundingClientRect()[t])}function C(e,t,r,i,a){void 0===i&&(i=o.noop);var l=n.useRef(null),s=n.useRef(null),u=n.useRef(null),c=n.useCallback(function(n){var r=n.target,o=r===window||r===document?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,i=r===window?document.documentElement.scrollHeight:r.scrollHeight,a=r===window?window.innerHeight:r.offsetHeight;e({scrollTop:Math.max(o,0),scrollHeight:i,viewportHeight:a}),null!==s.current&&(o===s.current||o<=0||o===r.scrollHeight-S(r,"height"))&&(s.current=null,t(!0),u.current&&(clearTimeout(u.current),u.current=null))},[e,t]);return n.useEffect(function(){var e=a||l.current;return i(a||l.current),c({target:e}),e.addEventListener("scroll",c,{passive:!0}),function(){i(null),e.removeEventListener("scroll",c)}},[l,c,r,i,a]),{scrollerRef:l,scrollByCallback:function(e){l.current.scrollBy(e)},scrollToCallback:function(n){var r=l.current;if(r&&(!("offsetHeight"in r)||0!==r.offsetHeight)){var o,i,a,c="smooth"===n.behavior;if(r===window?(i=Math.max(S(document.documentElement,"height"),document.documentElement.scrollHeight),o=window.innerHeight,a=document.documentElement.scrollTop):(i=r.scrollHeight,o=S(r,"height"),a=r.scrollTop),n.top=Math.ceil(Math.max(Math.min(i-o,n.top),0)),Math.abs(o-i)<1.01||n.top===a)return e({scrollTop:a,scrollHeight:i,viewportHeight:o}),void(c&&t(!0));c?(s.current=n.top,u.current&&clearTimeout(u.current),u.current=setTimeout(function(){u.current=null,s.current=null,t(!0)},1e3)):s.current=null,r.scrollTo(n)}}}}var I=o.system(function(){var e=o.stream(),t=o.stream(),n=o.statefulStream(0),r=o.stream(),i=o.statefulStream(0),a=o.stream(),l=o.stream(),s=o.statefulStream(0),u=o.statefulStream(0),c=o.statefulStream(0),m=o.stream(),d=o.stream(),p=o.statefulStream(!1),f=o.statefulStream(!1);return o.connect(o.pipe(e,o.map(function(e){return e.scrollTop})),t),o.connect(o.pipe(e,o.map(function(e){return e.scrollHeight})),l),o.connect(t,i),{scrollContainerState:e,scrollTop:t,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,footerHeight:c,scrollHeight:l,smoothScrollTargetReached:r,react18ConcurrentRendering:f,scrollTo:m,scrollBy:d,statefulScrollTop:i,deviation:n,scrollingInProgress:p}},[],{singleton:!0}),T={lvl:0};function x(e,t,n,r,o){return void 0===r&&(r=T),void 0===o&&(o=T),{k:e,v:t,lvl:n,l:r,r:o}}function w(e){return e===T}function y(){return T}function b(e,t){if(w(e))return T;var n=e.k,r=e.l,o=e.r;if(t===n){if(w(r))return o;if(w(o))return r;var i=k(r);return P(B(e,{k:i[0],v:i[1],l:z(r)}))}return P(B(e,t<n?{l:b(r,t)}:{r:b(o,t)}))}function E(e,t,n){if(void 0===n&&(n="k"),w(e))return[-Infinity,void 0];if(e[n]===t)return[e.k,e.v];if(e[n]<t){var r=E(e.r,t,n);return-Infinity===r[0]?[e.k,e.v]:r}return E(e.l,t,n)}function L(e,t,n){return w(e)?x(t,n,1):t===e.k?B(e,{k:t,v:n}):function(e){return V(U(e))}(B(e,t<e.k?{l:L(e.l,t,n)}:{r:L(e.r,t,n)}))}function H(e,t,n){if(w(e))return[];var r=e.k,o=e.v,i=e.r,a=[];return r>t&&(a=a.concat(H(e.l,t,n))),r>=t&&r<=n&&a.push({k:r,v:o}),r<=n&&(a=a.concat(H(i,t,n))),a}function R(e){return w(e)?[]:[].concat(R(e.l),[{k:e.k,v:e.v}],R(e.r))}function k(e){return w(e.r)?[e.k,e.v]:k(e.r)}function z(e){return w(e.r)?e.l:P(B(e,{r:z(e.r)}))}function B(e,t){return x(void 0!==t.k?t.k:e.k,void 0!==t.v?t.v:e.v,void 0!==t.lvl?t.lvl:e.lvl,void 0!==t.l?t.l:e.l,void 0!==t.r?t.r:e.r)}function F(e){return w(e)||e.lvl>e.r.lvl}function P(e){var t=e.l,n=e.r,r=e.lvl;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(F(t))return U(B(e,{lvl:r-1}));if(w(t)||w(t.r))throw new Error("Unexpected empty nodes");return B(t.r,{l:B(t,{r:t.r.l}),r:B(e,{l:t.r.r,lvl:r-1}),lvl:r})}if(F(e))return V(B(e,{lvl:r-1}));if(w(n)||w(n.l))throw new Error("Unexpected empty nodes");var o=n.l,i=F(o)?n.lvl-1:n.lvl;return B(o,{l:B(e,{r:o.l,lvl:r-1}),r:V(B(n,{l:o.r,lvl:i})),lvl:o.lvl+1})}function O(e,t,n){return w(e)?[]:M(H(e,E(e,t)[0],n),function(e){return{index:e.k,value:e.v}})}function M(e,t){var n=e.length;if(0===n)return[];for(var r=t(e[0]),o=r.index,i=r.value,a=[],l=1;l<n;l++){var s=t(e[l]),u=s.index,c=s.value;a.push({start:o,end:u-1,value:i}),o=u,i=c}return a.push({start:o,end:Infinity,value:i}),a}function V(e){var t=e.r,n=e.lvl;return w(t)||w(t.r)||t.lvl!==n||t.r.lvl!==n?e:B(t,{l:B(e,{r:t.l}),lvl:n+1})}function U(e){var t=e.l;return w(t)||t.lvl!==e.lvl?e:B(t,{r:B(e,{l:t.r})})}function A(e,t,n,r){void 0===r&&(r=0);for(var o=e.length-1;r<=o;){var i=Math.floor((r+o)/2),a=n(e[i],t);if(0===a)return i;if(-1===a){if(o-r<2)return i-1;o=i-1}else{if(o===r)return i;r=i+1}}throw new Error("Failed binary finding record in array - "+e.join(",")+", searched for "+t)}function W(e,t,n){return e[A(e,t,n)]}function N(e){var t=e.size,n=e.startIndex,r=e.endIndex;return function(e){return e.start===n&&(e.end===r||Infinity===e.end)&&e.value===t}}function D(e,t){var n=e.index;return t===n?0:t<n?-1:1}function G(e,t){var n=e.offset;return t===n?0:t<n?-1:1}function j(e){return{index:e.index,value:e}}function _(e,t,n){var r=e,o=0,i=0,a=0,l=0;if(0!==t){a=r[l=A(r,t-1,D)].offset;var s=E(n,t-1);o=s[0],i=s[1],r.length&&r[l].size===E(n,t)[1]&&(l-=1),r=r.slice(0,l+1)}else r=[];for(var c,m=u(O(n,t,Infinity));!(c=m()).done;){var d=c.value,p=d.start,f=d.value,h=(p-o)*i+a;r.push({offset:h,size:f,index:p}),o=p,a=h,i=f}return{offsetTree:r,lastIndex:o,lastOffset:a,lastSize:i}}function K(e,t){var n=t[0],r=t[1];n.length>0&&(0,t[2])("received item sizes",n,exports.LogLevel.DEBUG);var o=e.sizeTree,i=o,a=0;if(r.length>0&&w(o)&&2===n.length){var l=n[0].size,s=n[1].size;i=r.reduce(function(e,t){return L(L(e,t,l),t+1,s)},i)}else{var c=function(e,t){for(var n,r=w(e)?0:Infinity,o=u(t);!(n=o()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(r=Math.min(r,l),w(e))e=L(e,0,a);else{var c=O(e,l-1,s+1);if(!c.some(N(i))){for(var m,d=!1,p=!1,f=u(c);!(m=f()).done;){var h=m.value,g=h.start,v=h.end,S=h.value;d?(s>=g||a===S)&&(e=b(e,g)):(p=S!==a,d=!0),v>s&&s>=g&&S!==a&&(e=L(e,s+1,S))}p&&(e=L(e,l,a))}}}return[e,r]}(i,n);i=c[0],a=c[1]}if(i===o)return e;var m=_(e.offsetTree,a,i),d=m.offsetTree;return{sizeTree:i,offsetTree:d,lastIndex:m.lastIndex,lastOffset:m.lastOffset,lastSize:m.lastSize,groupOffsetTree:r.reduce(function(e,t){return L(e,t,Y(t,d))},y()),groupIndices:r}}function Y(e,t){if(0===t.length)return 0;var n=W(t,e,D);return n.size*(e-n.index)+n.offset}function q(e,t,n){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;var r=Z("LAST"===e.index?n-1:e.index,t);return Math.max(0,r,Math.min(n,r))}function Z(e,t){if(!J(t))return e;for(var n=0;t.groupIndices[n]<=e+n;)n++;return e+n}function J(e){return!w(e.groupOffsetTree)}var $={offsetHeight:"height",offsetWidth:"width"},Q=o.system(function(e){var t=e[0].log,n=o.stream(),r=o.stream(),i=o.statefulStreamFromEmitter(r,0),l=o.stream(),s=o.stream(),u=o.statefulStream(0),c=o.statefulStream([]),m=o.statefulStream(void 0),d=o.statefulStream(void 0),p=o.statefulStream(function(e,t){return S(e,$[t])}),f=o.statefulStream(void 0),h={offsetTree:[],sizeTree:y(),groupOffsetTree:y(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},g=o.statefulStreamFromEmitter(o.pipe(n,o.withLatestFrom(c,t),o.scan(K,h),o.distinctUntilChanged()),h);o.connect(o.pipe(c,o.filter(function(e){return e.length>0}),o.withLatestFrom(g),o.map(function(e){var t=e[0],n=e[1],r=t.reduce(function(e,t,r){return L(e,t,Y(t,n.offsetTree)||r)},y());return a({},n,{groupIndices:t,groupOffsetTree:r})})),g),o.connect(o.pipe(r,o.withLatestFrom(g),o.filter(function(e){return e[0]<e[1].lastIndex}),o.map(function(e){var t=e[1];return[{startIndex:e[0],endIndex:t.lastIndex,size:t.lastSize}]})),n),o.connect(m,d);var v=o.statefulStreamFromEmitter(o.pipe(m,o.map(function(e){return void 0===e})),!0);o.connect(o.pipe(d,o.filter(function(e){return void 0!==e&&w(o.getValue(g).sizeTree)}),o.map(function(e){return[{startIndex:0,endIndex:0,size:e}]})),n);var C=o.streamFromEmitter(o.pipe(n,o.withLatestFrom(g),o.scan(function(e,t){var n=t[1];return{changed:n!==e.sizes,sizes:n}},{changed:!1,sizes:h}),o.map(function(e){return e.changed})));o.subscribe(o.pipe(u,o.scan(function(e,t){return{diff:e.prev-t,prev:t}},{diff:0,prev:0}),o.map(function(e){return e.diff})),function(e){e>0?o.publish(l,e):e<0&&o.publish(s,e)}),o.subscribe(o.pipe(u,o.withLatestFrom(t)),function(e){e[0]<0&&(0,e[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:u},exports.LogLevel.ERROR)});var I=o.streamFromEmitter(l);o.connect(o.pipe(l,o.withLatestFrom(g),o.map(function(e){var t=e[0],n=e[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return R(n.sizeTree).reduce(function(e,n){var r=n.k,o=n.v;return{ranges:[].concat(e.ranges,[{startIndex:e.prevIndex,endIndex:r+t-1,size:e.prevSize}]),prevIndex:r+t,prevSize:o}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),n);var T=o.streamFromEmitter(o.pipe(s,o.withLatestFrom(g),o.map(function(e){return Y(-e[0],e[1].offsetTree)})));return o.connect(o.pipe(s,o.withLatestFrom(g),o.map(function(e){var t=e[0],n=e[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var r=R(n.sizeTree).reduce(function(e,n){var r=n.v;return L(e,Math.max(0,n.k+t),r)},y());return a({},n,{sizeTree:r},_(n.offsetTree,0,r))})),g),{data:f,totalCount:r,sizeRanges:n,groupIndices:c,defaultItemSize:d,fixedItemSize:m,unshiftWith:l,shiftWith:s,shiftWithOffset:T,beforeUnshiftWith:I,firstItemIndex:u,sizes:g,listRefresh:C,statefulTotalCount:i,trackItemSizes:v,itemSize:p}},o.tup(f),{singleton:!0}),X="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function ee(e){var t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&X||(t.behavior="auto"),t.offset||(t.offset=0),t}var te=o.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,i=t.listRefresh,a=e[1],l=a.scrollingInProgress,s=a.viewportHeight,u=a.scrollTo,c=a.smoothScrollTargetReached,m=a.headerHeight,d=a.footerHeight,p=e[2].log,f=o.stream(),h=o.statefulStream(0),g=null,v=null,S=null;function C(){g&&(g(),g=null),S&&(S(),S=null),v&&(clearTimeout(v),v=null),o.publish(l,!1)}return o.connect(o.pipe(f,o.withLatestFrom(n,s,r,h,m,d,p),o.map(function(e){var t=e[0],n=e[1],r=e[2],a=e[3],s=e[4],u=e[5],m=e[6],d=e[7],p=ee(t),h=p.align,I=p.behavior,T=p.offset,x=a-1,w=q(p,n,x),y=Y(w,n.offsetTree)+u;"end"===h?(y=y-r+E(n.sizeTree,w)[1],w===x&&(y+=m)):"center"===h?y=y-r/2+E(n.sizeTree,w)[1]/2:y-=s,T&&(y+=T);var b=function(e){C(),e?(d("retrying to scroll to",{location:t},exports.LogLevel.DEBUG),o.publish(f,t)):d("list did not change, scroll successful",{},exports.LogLevel.DEBUG)};if(C(),"smooth"===I){var L=!1;S=o.subscribe(i,function(e){L=L||e}),g=o.handleNext(c,function(){b(L)})}else g=o.handleNext(o.pipe(i,function(e){var t=setTimeout(function(){e(!1)},50);return function(n){n&&(e(!0),clearTimeout(t))}}),b);return v=setTimeout(function(){C()},1200),o.publish(l,!0),d("scrolling from index to",{index:w,top:y,behavior:I},exports.LogLevel.DEBUG),{top:y,behavior:I}})),u),{scrollToIndex:f,topListHeight:h}},o.tup(Q,I,f),{singleton:!0}),ne="up",re={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},oe=o.system(function(e){var t=e[0],n=t.scrollContainerState,r=t.scrollTop,i=t.viewportHeight,a=t.headerHeight,l=t.footerHeight,s=t.scrollBy,u=o.statefulStream(!1),c=o.statefulStream(!0),m=o.stream(),d=o.stream(),p=o.statefulStream(4),f=o.statefulStream(0),h=o.streamFromEmitter(o.pipe(o.merge(o.pipe(o.duc(r),o.skip(1),o.mapTo(!0)),o.pipe(o.duc(r),o.skip(1),o.mapTo(!1),o.debounceTime(100))),o.distinctUntilChanged())),g=o.statefulStreamFromEmitter(o.pipe(o.merge(o.pipe(s,o.mapTo(!0)),o.pipe(s,o.mapTo(!1),o.debounceTime(200))),o.distinctUntilChanged()),!1);o.connect(o.pipe(o.combineLatest(o.duc(r),o.duc(f)),o.map(function(e){return e[0]<=e[1]}),o.distinctUntilChanged()),c),o.connect(o.pipe(c,o.throttleTime(50)),d);var v=o.streamFromEmitter(o.pipe(o.combineLatest(n,o.duc(i),o.duc(a),o.duc(l),o.duc(p)),o.scan(function(e,t){var n,r,o=t[0],i=o.scrollTop,a=o.scrollHeight,l=t[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-t[4]?(i>e.state.scrollTop?(n="SCROLLED_DOWN",r=e.state.scrollTop-i):(n="SIZE_DECREASED",r=e.state.scrollTop-i||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:r}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":l<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},re),o.distinctUntilChanged(function(e,t){return e&&e.atBottom===t.atBottom}))),S=o.statefulStreamFromEmitter(o.pipe(n,o.scan(function(e,t){var n=t.scrollTop,r=t.scrollHeight;return e.scrollHeight!==r?e.scrollTop!==n&&n===r-t.viewportHeight?{scrollHeight:r,scrollTop:n,jump:e.scrollTop-n,changed:!0}:{scrollHeight:r,scrollTop:n,jump:0,changed:!0}:{scrollTop:n,scrollHeight:r,jump:0,changed:!1}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),o.filter(function(e){return e.changed}),o.map(function(e){return e.jump})),0);o.connect(o.pipe(v,o.map(function(e){return e.atBottom})),u),o.connect(o.pipe(u,o.throttleTime(50)),m);var C=o.statefulStream("down");o.connect(o.pipe(n,o.map(function(e){return e.scrollTop}),o.distinctUntilChanged(),o.scan(function(e,t){return o.getValue(g)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?ne:"down",prevScrollTop:t}},{direction:"down",prevScrollTop:0}),o.map(function(e){return e.direction})),C),o.connect(o.pipe(n,o.throttleTime(50),o.mapTo("none")),C);var I=o.statefulStream(0);return o.connect(o.pipe(h,o.filter(function(e){return!e}),o.mapTo(0)),I),o.connect(o.pipe(r,o.throttleTime(100),o.withLatestFrom(h),o.filter(function(e){return!!e[1]}),o.scan(function(e,t){return[e[1],t[0]]},[0,0]),o.map(function(e){return e[1]-e[0]})),I),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:d,atBottomStateChange:m,scrollDirection:C,atBottomThreshold:p,atTopThreshold:f,scrollVelocity:I,lastJumpDueToItemResize:S}},o.tup(I)),ie=o.system(function(e){var n=e[0].log,r=o.statefulStream(!1),i=o.streamFromEmitter(o.pipe(r,o.filter(function(e){return e}),o.distinctUntilChanged()));return o.subscribe(r,function(e){e&&t.getValue(n)("props updated",{},exports.LogLevel.DEBUG)}),{propsReady:r,didMount:i}},t.tup(f),{singleton:!0}),ae=o.system(function(e){var t=e[0],n=t.sizes,r=t.listRefresh,i=t.defaultItemSize,a=e[1].scrollTop,l=e[2].scrollToIndex,s=e[3].didMount,u=o.statefulStream(!0),c=o.statefulStream(0);return o.connect(o.pipe(s,o.withLatestFrom(c),o.filter(function(e){return!!e[1]}),o.mapTo(!1)),u),o.subscribe(o.pipe(o.combineLatest(r,s),o.withLatestFrom(u,n,i),o.filter(function(e){var t=e[1],n=e[3];return e[0][1]&&(!w(e[2].sizeTree)||void 0!==n)&&!t}),o.withLatestFrom(c)),function(e){var t=e[1];setTimeout(function(){o.handleNext(a,function(){o.publish(u,!0)}),o.publish(l,t)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},o.tup(Q,I,te,ie),{singleton:!0});function le(e){return!!e&&("smooth"===e?"smooth":"auto")}var se=o.system(function(e){var t=e[0],n=t.totalCount,r=t.listRefresh,i=e[1],a=i.isAtBottom,l=i.atBottomState,s=e[2].scrollToIndex,u=e[3].scrolledToInitialItem,c=e[4],m=c.propsReady,d=c.didMount,p=e[5].log,f=e[6].scrollingInProgress,h=o.statefulStream(!1),g=null;function v(e){o.publish(s,{index:"LAST",align:"end",behavior:e})}return o.subscribe(o.pipe(o.combineLatest(o.pipe(o.duc(n),o.skip(1)),d),o.withLatestFrom(o.duc(h),a,u,f),o.map(function(e){var t=e[0],n=t[0],r=t[1]&&e[3],o="auto";return r&&(o=function(e,t){return"function"==typeof e?le(e(t)):t&&le(e)}(e[1],e[2]||e[4]),r=r&&!!o),{totalCount:n,shouldFollow:r,followOutputBehavior:o}}),o.filter(function(e){return e.shouldFollow})),function(e){var t=e.totalCount,n=e.followOutputBehavior;g&&(g(),g=null),g=o.handleNext(r,function(){o.getValue(p)("following output to ",{totalCount:t},exports.LogLevel.DEBUG),v(n),g=null})}),o.subscribe(o.pipe(o.combineLatest(o.duc(h),n,m),o.filter(function(e){return e[0]&&e[2]}),o.scan(function(e,t){var n=t[1];return{refreshed:e.value===n,value:n}},{refreshed:!1,value:0}),o.filter(function(e){return e.refreshed}),o.withLatestFrom(h,n)),function(e){var t=e[1],n=o.handleNext(l,function(e){!t||e.atBottom||"SIZE_INCREASED"!==e.notAtBottomBecause||g||(o.getValue(p)("scrolling to bottom due to increased size",{},exports.LogLevel.DEBUG),v("auto"))});setTimeout(n,100)}),o.subscribe(o.combineLatest(o.duc(h),l),function(e){var t=e[1];e[0]&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&v("auto")}),{followOutput:h}},o.tup(Q,oe,te,ae,ie,f,I));function ue(e){return e.reduce(function(e,t){return e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e},{totalCount:0,groupIndices:[]})}var ce=t.system(function(e){var n=e[0],r=n.totalCount,o=n.groupIndices,i=n.sizes,a=e[1],l=a.scrollTop,s=a.headerHeight,u=t.stream(),c=t.stream(),m=t.streamFromEmitter(t.pipe(u,t.map(ue)));return t.connect(t.pipe(m,t.map(t.prop("totalCount"))),r),t.connect(t.pipe(m,t.map(t.prop("groupIndices"))),o),t.connect(t.pipe(t.combineLatest(l,i,s),t.filter(function(e){return J(e[1])}),t.map(function(e){return E(e[1].groupOffsetTree,Math.max(e[0]-e[2],0),"v")[0]}),t.distinctUntilChanged(),t.map(function(e){return[e]})),c),{groupCounts:u,topItemsIndexes:c}},t.tup(Q,I));function me(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function de(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function pe(e,t,n){return"number"==typeof e?n===ne&&"top"===t||"down"===n&&"bottom"===t?e:0:n===ne?"top"===t?e.main:e.reverse:"bottom"===t?e.main:e.reverse}function fe(e,t){return"number"==typeof e?e:e[t]||0}var he=o.system(function(e){var t=e[0],n=t.scrollTop,r=t.viewportHeight,i=t.deviation,a=t.headerHeight,l=t.fixedHeaderHeight,s=o.stream(),u=o.statefulStream(0),c=o.statefulStream(0),m=o.statefulStream(0),d=o.statefulStreamFromEmitter(o.pipe(o.combineLatest(o.duc(n),o.duc(r),o.duc(a),o.duc(s,me),o.duc(m),o.duc(u),o.duc(l),o.duc(i),o.duc(c)),o.map(function(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=o[0],a=o[1],l=e[4],s=e[6],u=e[7],c=e[8],m=t-u,d=e[5]+s,p=Math.max(r-m,0),f="none",h=fe(c,"top"),g=fe(c,"bottom");return i-=u,a+=r+s,(i+=r+s)>t+d-h&&(f=ne),(a-=u)<t-p+n+g&&(f="down"),"none"!==f?[Math.max(m-r-pe(l,"top",f)-h,0),m-p-s+n+pe(l,"bottom",f)+g]:null}),o.filter(function(e){return null!=e}),o.distinctUntilChanged(me)),[0,0]);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:d}},o.tup(I),{singleton:!0}),ge={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0};function ve(e,t,n){if(0===e.length)return[];if(!J(t))return e.map(function(e){return a({},e,{index:e.index+n,originalIndex:e.index})});for(var r,o=[],i=O(t.groupOffsetTree,e[0].index,e[e.length-1].index),l=void 0,s=0,c=u(e);!(r=c()).done;){var m=r.value;(!l||l.end<m.index)&&(l=i.shift(),s=t.groupIndices.indexOf(l.start)),o.push(a({},m.index===l.start?{type:"group",index:s}:{index:m.index-(s+1)+n,groupIndex:s},{size:m.size,offset:m.offset,originalIndex:m.index,data:m.data}))}return o}function Se(e,t,n,r,o){var i=0,a=0;if(e.length>0){i=e[0].offset;var l=e[e.length-1];a=l.offset+l.size}var s=i,u=r.lastOffset+(n-r.lastIndex)*r.lastSize-a;return{items:ve(e,r,o),topItems:ve(t,r,o),topListHeight:t.reduce(function(e,t){return t.size+e},0),offsetTop:i,offsetBottom:u,top:s,bottom:a,totalCount:n}}var Ce,Ie,Te,xe=o.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,i=t.data,l=t.firstItemIndex,s=e[1],c=e[2],m=c.visibleRange,d=c.listBoundary,p=c.topListHeight,f=e[3],h=f.scrolledToInitialItem,g=f.initialTopMostItemIndex,v=e[4].topListHeight,S=e[5],C=e[6].didMount,I=o.statefulStream([]),T=o.stream();o.connect(s.topItemsIndexes,I);var x=o.statefulStreamFromEmitter(o.pipe(o.combineLatest(C,o.duc(m),o.duc(r),o.duc(n),o.duc(g),h,o.duc(I),o.duc(l),i),o.filter(function(e){return e[0]}),o.map(function(e){var t=e[1],n=t[0],r=t[1],i=e[2],a=e[4],l=e[5],s=e[6],c=e[7],m=e[8],d=e[3],p=d.sizeTree,f=d.offsetTree;if(0===i||0===n&&0===r)return ge;if(w(p))return Se(function(e,t,n){if(J(t)){var r=Z(e,t);return[{index:E(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}(function(e,t){return"number"==typeof e?e:"LAST"===e.index?t-1:e.index}(a,i),d,m),[],i,d,c);var h=[];if(s.length>0)for(var g,v=s[0],S=s[s.length-1],C=0,I=u(O(p,v,S));!(g=I()).done;)for(var T=g.value,x=T.value,y=Math.max(T.start,v),b=Math.min(T.end,S),L=y;L<=b;L++)h.push({index:L,size:x,offset:C,data:m&&m[L]}),C+=x;if(!l)return Se([],h,i,d,c);var H=s.length>0?s[s.length-1]+1:0,R=function(e,t,n,r){return void 0===r&&(r=0),r>0&&(t=Math.max(t,W(e,r,D).offset)),M((i=n,l=A(o=e,t,a=G),s=A(o,i,a,l),o.slice(l,s+1)),j);var o,i,a,l,s}(f,n,r,H);if(0===R.length)return null;var k=i-1;return Se(o.tap([],function(e){for(var t,o=u(R);!(t=o()).done;){var i=t.value,a=i.value,l=a.offset,s=i.start,c=a.size;a.offset<n&&(l+=((s+=Math.floor((n-a.offset)/c))-i.start)*c),s<H&&(l+=(H-s)*c,s=H);for(var d=Math.min(i.end,k),p=s;p<=d&&!(l>=r);p++)e.push({index:p,size:c,offset:l,data:m&&m[p]}),l+=c}}),h,i,d,c)}),o.filter(function(e){return null!==e}),o.distinctUntilChanged()),ge);return o.connect(o.pipe(i,o.filter(function(e){return void 0!==e}),o.map(function(e){return e.length})),r),o.connect(o.pipe(x,o.map(o.prop("topListHeight"))),v),o.connect(v,p),o.connect(o.pipe(x,o.map(function(e){return[e.top,e.bottom]})),d),o.connect(o.pipe(x,o.map(function(e){return e.items})),T),a({listState:x,topItemsIndexes:I,endReached:o.streamFromEmitter(o.pipe(x,o.filter(function(e){return e.items.length>0}),o.withLatestFrom(r,i),o.filter(function(e){var t=e[0].items;return t[t.length-1].originalIndex===e[1]-1}),o.map(function(e){return[e[1]-1,e[2]]}),o.distinctUntilChanged(me),o.map(function(e){return e[0]}))),startReached:o.streamFromEmitter(o.pipe(x,o.throttleTime(200),o.filter(function(e){var t=e.items;return t.length>0&&t[0].originalIndex===e.topItems.length}),o.map(function(e){return e.items[0].index}),o.distinctUntilChanged())),rangeChanged:o.streamFromEmitter(o.pipe(x,o.filter(function(e){return e.items.length>0}),o.map(function(e){var t=e.items;return{startIndex:t[0].index,endIndex:t[t.length-1].index}}),o.distinctUntilChanged(de))),itemsRendered:T},S)},o.tup(Q,ce,he,ae,te,oe,ie),{singleton:!0}),we=o.system(function(e){var t=e[0],n=t.sizes,r=t.firstItemIndex,i=t.data,a=e[1].listState,l=e[2].didMount,s=o.statefulStream(0);return o.connect(o.pipe(l,o.withLatestFrom(s),o.filter(function(e){return 0!==e[1]}),o.withLatestFrom(n,r,i),o.map(function(e){var t=e[0][1],n=e[1],r=e[2],o=e[3],i=void 0===o?[]:o,a=0;if(n.groupIndices.length>0)for(var l,s=u(n.groupIndices);!((l=s()).done||l.value-a>=t);)a++;var c=t+a;return Se(Array.from({length:c}).map(function(e,t){return{index:t,size:0,offset:0,data:i[t]}}),[],c,n,r)})),a),{initialItemCount:s}},o.tup(Q,xe,ie),{singleton:!0}),ye=o.system(function(e){var t=e[0].scrollVelocity,n=o.statefulStream(!1),r=o.stream(),i=o.statefulStream(!1);return o.connect(o.pipe(t,o.withLatestFrom(i,n,r),o.filter(function(e){return!!e[1]}),o.map(function(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=n.enter;if(r){if((0,n.exit)(t,o))return!1}else if(i(t,o))return!0;return r}),o.distinctUntilChanged()),n),o.subscribe(o.pipe(o.combineLatest(n,t,r),o.withLatestFrom(i)),function(e){var t=e[0],n=e[1];return t[0]&&n&&n.change&&n.change(t[1],t[2])}),{isSeeking:n,scrollSeekConfiguration:i,scrollVelocity:t,scrollSeekRangeChanged:r}},o.tup(oe),{singleton:!0}),be=t.system(function(e){var n=e[0].topItemsIndexes,r=t.statefulStream(0);return t.connect(t.pipe(r,t.filter(function(e){return e>0}),t.map(function(e){return Array.from({length:e}).map(function(e,t){return t})})),n),{topItemCount:r}},t.tup(xe)),Ee=o.system(function(e){var t=e[0],n=t.footerHeight,r=t.headerHeight,i=t.fixedHeaderHeight,a=e[1].listState,l=o.stream(),s=o.statefulStreamFromEmitter(o.pipe(o.combineLatest(n,r,i,a),o.map(function(e){var t=e[3];return e[0]+e[1]+e[2]+t.offsetBottom+t.bottom})),0);return o.connect(o.duc(s),l),{totalListHeight:s,totalListHeightChanged:l}},o.tup(I,xe),{singleton:!0}),Le=o.system(function(e){var t=e[0],n=t.scrollBy,r=t.scrollTop,i=t.deviation,a=t.scrollingInProgress,l=e[1],s=l.isScrolling,u=l.isAtBottom,c=l.atBottomState,m=l.scrollDirection,d=e[3],p=d.beforeUnshiftWith,f=d.shiftWithOffset,h=d.sizes,g=e[4].log,v=o.streamFromEmitter(o.pipe(e[2].listState,o.withLatestFrom(l.lastJumpDueToItemResize),o.scan(function(e,t){var n=e[1],r=t[0],o=r.items,i=r.totalCount,a=r.bottom+r.offsetBottom,l=0;return e[2]===i&&n.length>0&&o.length>0&&(0===o[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-e[3])&&(l+=t[1])),[l,o,i,a]},[0,[],0,0]),o.filter(function(e){return 0!==e[0]}),o.withLatestFrom(r,m,a,g,u,c),o.filter(function(e){return!e[3]&&0!==e[1]&&e[2]===ne}),o.map(function(e){var t=e[0][0];return(0,e[4])("Upward scrolling compensation",{amount:t},exports.LogLevel.DEBUG),t})));return o.connect(o.pipe(v,o.withLatestFrom(i),o.map(function(e){return e[1]-e[0]})),i),o.subscribe(o.pipe(o.combineLatest(o.statefulStreamFromEmitter(s,!1),i),o.filter(function(e){return!e[0]&&0!==e[1]}),o.map(function(e){return e[1]}),o.throttleTime(1)),function(e){e>0?(o.publish(n,{top:-e,behavior:"auto"}),o.publish(i,0)):(o.publish(i,0),o.publish(n,{top:-e,behavior:"auto"}))}),o.connect(o.pipe(f,o.map(function(e){return{top:-e}})),n),o.connect(o.pipe(p,o.withLatestFrom(h),o.map(function(e){return e[0]*e[1].lastSize})),v),{deviation:i}},o.tup(I,oe,xe,Q,f)),He=o.system(function(e){var t=e[0].totalListHeight,n=e[1].didMount,r=e[2].scrollTo,i=o.statefulStream(0);return o.subscribe(o.pipe(n,o.withLatestFrom(i),o.filter(function(e){return 0!==e[1]}),o.map(function(e){return{top:e[1]}})),function(e){o.handleNext(o.pipe(t,o.filter(function(e){return 0!==e})),function(){setTimeout(function(){o.publish(r,e)})})}),{initialScrollTop:i}},o.tup(Ee,ie,I),{singleton:!0}),Re=o.system(function(e){var t=e[0].viewportHeight,n=e[1].totalListHeight,r=o.statefulStream(!1);return{alignToBottom:r,paddingTopAddition:o.statefulStreamFromEmitter(o.pipe(o.combineLatest(r,t,n),o.filter(function(e){return e[0]}),o.map(function(e){return Math.max(0,e[1]-e[2])}),o.distinctUntilChanged()),0)}},o.tup(I,Ee),{singleton:!0}),ke=o.system(function(e){var t=e[0],n=t.scrollTo,r=t.scrollContainerState,i=o.stream(),l=o.stream(),s=o.stream(),u=o.statefulStream(!1),c=o.statefulStream(void 0);return o.connect(o.pipe(o.combineLatest(i,l),o.map(function(e){var t=e[0],n=t.viewportHeight,r=t.scrollHeight;return{scrollTop:Math.max(0,t.scrollTop-e[1].offsetTop),scrollHeight:r,viewportHeight:n}})),r),o.connect(o.pipe(n,o.withLatestFrom(l),o.map(function(e){var t=e[0];return a({},t,{top:t.top+e[1].offsetTop})})),s),{useWindowScroll:u,customScrollParent:c,windowScrollContainerState:i,windowViewportRect:l,windowScrollTo:s}},o.tup(I)),ze=["done","behavior"],Be=o.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,i=e[1],s=i.scrollTop,u=i.viewportHeight,c=i.headerHeight,m=i.scrollingInProgress,d=e[2].scrollToIndex,p=o.stream();return o.connect(o.pipe(p,o.withLatestFrom(n,u,r,c,s),o.map(function(e){var t=e[0],n=e[1],r=e[2],i=e[3],s=e[4],u=e[5],c=t.done,d=t.behavior,p=l(t,ze),f=null,h=q(t,n,i-1),g=Y(h,n.offsetTree)+s;return g<u?f=a({},p,{behavior:d,align:"start"}):g+E(n.sizeTree,h)[1]>u+r&&(f=a({},p,{behavior:d,align:"end"})),f?c&&o.handleNext(o.pipe(m,o.skip(1),o.filter(function(e){return!1===e})),c):c&&c(),f}),o.filter(function(e){return null!==e})),d),{scrollIntoView:p}},o.tup(Q,I,te,xe,f),{singleton:!0}),Fe=["listState","topItemsIndexes"],Pe=o.system(function(e){return a({},e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},o.tup(he,we,ie,ye,Ee,He,Re,ke,Be)),Oe=o.system(function(e){var t=e[0],n=t.totalCount,r=t.sizeRanges,i=t.fixedItemSize,s=t.defaultItemSize,u=t.trackItemSizes,c=t.itemSize,m=t.data,d=t.firstItemIndex,p=t.groupIndices,f=t.statefulTotalCount,h=e[1],g=h.initialTopMostItemIndex,v=h.scrolledToInitialItem,S=e[2],C=e[3],I=e[4],T=I.listState,x=I.topItemsIndexes,w=l(I,Fe),y=e[5].scrollToIndex,b=e[7].topItemCount,E=e[8].groupCounts,L=e[9],H=e[10];return o.connect(w.rangeChanged,L.scrollSeekRangeChanged),o.connect(o.pipe(L.windowViewportRect,o.map(o.prop("visibleHeight"))),S.viewportHeight),a({totalCount:n,data:m,firstItemIndex:d,sizeRanges:r,initialTopMostItemIndex:g,scrolledToInitialItem:v,topItemsIndexes:x,topItemCount:b,groupCounts:E,fixedItemHeight:i,defaultItemHeight:s},C,{statefulTotalCount:f,listState:T,scrollToIndex:y,trackItemSizes:u,itemSize:c,groupIndices:p},w,L,S,H)},o.tup(Q,ae,I,se,xe,te,Le,be,ce,Pe,f)),Me=(Ce=function(){if("undefined"==typeof document)return"sticky";var e=document.createElement("div");return e.style.position="-webkit-sticky","-webkit-sticky"===e.style.position?"-webkit-sticky":"sticky"},Te=!1,function(){return Te||(Te=!0,Ie=Ce()),Ie});function Ve(e,t){var r=n.useRef(null),o=n.useCallback(function(n){if(null!==n){var o,i,a=n.getBoundingClientRect(),l=a.width;if(t){var s=t.getBoundingClientRect(),u=a.top-s.top;o=s.height-Math.max(0,u),i=u+t.scrollTop}else o=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;r.current={offsetTop:i,visibleHeight:o,visibleWidth:l},e(r.current)}},[e,t]),i=h(o),a=i.callbackRef,l=i.ref,s=n.useCallback(function(){o(l.current)},[o,l]);return n.useEffect(function(){if(t){t.addEventListener("scroll",s);var e=new ResizeObserver(s);return e.observe(t),function(){t.removeEventListener("scroll",s),e.unobserve(t)}}return window.addEventListener("scroll",s),window.addEventListener("resize",s),function(){window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}},[s,t]),a}var Ue=["placeholder"],Ae=["style","children"],We=["style","children"];function Ne(e){return e}var De=t.system(function(){var e=t.statefulStream(function(e){return"Item "+e}),n=t.statefulStream(null),r=t.statefulStream(function(e){return"Group "+e}),o=t.statefulStream({}),i=t.statefulStream(Ne),a=t.statefulStream("div"),l=t.statefulStream(t.noop),s=function(e,n){return void 0===n&&(n=null),t.statefulStreamFromEmitter(t.pipe(o,t.map(function(t){return t[e]}),t.distinctUntilChanged()),n)};return{context:n,itemContent:e,groupContent:r,components:o,computeItemKey:i,headerFooterTag:a,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function Ge(e,n){var r=t.stream();return t.subscribe(r,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+n,"color: red;","color: inherit;","color: blue;")}),t.connect(r,e),r}var je=t.system(function(e){var n=e[0],r=e[1],o={item:Ge(r.itemContent,"Rename the %citem%c prop to %citemContent."),group:Ge(r.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Ge(n.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Ge(n.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Ge(n.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:t.stream(),maxHeightCacheSize:t.stream(),footer:t.stream(),header:t.stream(),HeaderContainer:t.stream(),FooterContainer:t.stream(),ItemContainer:t.stream(),ScrollContainer:t.stream(),GroupContainer:t.stream(),ListContainer:t.stream(),emptyComponent:t.stream(),scrollSeek:t.stream()};function i(e,n,o){t.connect(t.pipe(e,t.withLatestFrom(r.components),t.map(function(e){var t,r=e[0],i=e[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),a({},i,((t={})[n]=r,t))})),r.components)}return t.subscribe(o.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;")}),t.subscribe(o.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),t.subscribe(o.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),t.subscribe(o.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),t.subscribe(o.scrollSeek,function(e){var o=e.placeholder,i=l(e,Ue);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),t.publish(r.components,a({},t.getValue(r.components),{ScrollSeekPlaceholder:o})),t.publish(n.scrollSeekConfiguration,i)}),i(o.footer,"Footer","footer"),i(o.header,"Header","header"),i(o.ItemContainer,"Item","ItemContainer"),i(o.ListContainer,"List","ListContainer"),i(o.ScrollContainer,"Scroller","ScrollContainer"),i(o.emptyComponent,"EmptyPlaceholder","emptyComponent"),i(o.GroupContainer,"Group","GroupContainer"),a({},n,r,o)},t.tup(Oe,De)),_e=function(e){return i.createElement("div",{style:{height:e.height}})},Ke={position:Me(),zIndex:1,overflowAnchor:"none"},Ye={overflowAnchor:"none"},qe=i.memo(function(e){var r=e.showTopList,o=void 0!==r&&r,l=ct("listState"),s=ut("sizeRanges"),u=ct("useWindowScroll"),c=ct("customScrollParent"),m=ut("windowScrollContainerState"),d=ut("scrollContainerState"),p=c||u?m:d,f=ct("itemContent"),h=ct("context"),g=ct("groupContent"),S=ct("trackItemSizes"),C=ct("itemSize"),I=ct("log"),T=v(s,C,S,o?t.noop:p,I,c),x=T.callbackRef,w=T.ref,y=i.useState(0),b=y[0],E=y[1];mt("deviation",function(e){b!==e&&(w.current.style.marginTop=e+"px",E(e))});var L=ct("EmptyPlaceholder"),H=ct("ScrollSeekPlaceholder")||_e,R=ct("ListComponent"),k=ct("ItemComponent"),z=ct("GroupComponent"),B=ct("computeItemKey"),F=ct("isSeeking"),P=ct("groupIndices").length>0,O=ct("paddingTopAddition"),M=ct("firstItemIndex"),V=ct("statefulTotalCount"),U=o?{}:{boxSizing:"border-box",paddingTop:l.offsetTop+O,paddingBottom:l.offsetBottom,marginTop:b};return!o&&0===V&&L?n.createElement(L,Qe(L,h)):n.createElement(R,a({},Qe(R,h),{ref:x,style:U,"data-test-id":o?"virtuoso-top-item-list":"virtuoso-item-list"}),(o?l.topItems:l.items).map(function(e){var t=e.originalIndex,r=B(t+M,e.data,h);return F?n.createElement(H,a({},Qe(H,h),{key:r,index:e.index,height:e.size,type:e.type||"item"},"group"===e.type?{}:{groupIndex:e.groupIndex})):"group"===e.type?n.createElement(z,a({},Qe(z,h),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:Ke}),g(e.index)):n.createElement(k,a({},Qe(k,h),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex,style:Ye}),P?f(e.index,e.groupIndex,e.data,h):f(e.index,e.data,h))}))}),Ze={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Je={width:"100%",height:"100%",position:"absolute",top:0},$e={width:"100%",position:Me(),top:0};function Qe(e,t){if("string"!=typeof e)return{context:t}}var Xe=i.memo(function(){var e=ct("HeaderComponent"),t=ut("headerHeight"),r=ct("headerFooterTag"),o=g(function(e){return t(S(e,"height"))}),i=ct("context");return e?n.createElement(r,{ref:o},n.createElement(e,Qe(e,i))):null}),et=i.memo(function(){var e=ct("FooterComponent"),t=ut("footerHeight"),r=ct("headerFooterTag"),o=g(function(e){return t(S(e,"height"))}),i=ct("context");return e?n.createElement(r,{ref:o},n.createElement(e,Qe(e,i))):null});function tt(e){var t=e.usePublisher,r=e.useEmitter,o=e.useEmitterValue;return i.memo(function(e){var i=e.style,s=e.children,u=l(e,Ae),c=t("scrollContainerState"),m=o("ScrollerComponent"),d=t("smoothScrollTargetReached"),p=o("scrollerRef"),f=o("context"),h=C(c,d,m,p),g=h.scrollerRef,v=h.scrollByCallback;return r("scrollTo",h.scrollToCallback),r("scrollBy",v),n.createElement(m,a({ref:g,style:a({},Ze,i),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},u,Qe(m,f)),s)})}function nt(e){var r=e.usePublisher,o=e.useEmitter,s=e.useEmitterValue;return i.memo(function(e){var i=e.style,u=e.children,c=l(e,We),m=r("windowScrollContainerState"),p=s("ScrollerComponent"),f=r("smoothScrollTargetReached"),h=s("totalListHeight"),g=s("deviation"),v=s("customScrollParent"),S=s("context"),I=C(m,f,p,t.noop,v),T=I.scrollerRef,x=I.scrollByCallback,w=I.scrollToCallback;return d(function(){return T.current=v||window,function(){T.current=null}},[T,v]),o("windowScrollTo",w),o("scrollBy",x),n.createElement(p,a({style:a({position:"relative"},i,0!==h?{height:h+g}:{}),"data-virtuoso-scroller":!0},c,Qe(p,S)),u)})}var rt=function(e){var n=e.children,r=ut("viewportHeight"),o=g(t.compose(r,function(e){return S(e,"height")}));return i.createElement("div",{style:Je,ref:o,"data-viewport-type":"element"},n)},ot=function(e){var t=e.children,n=Ve(ut("windowViewportRect"),ct("customScrollParent"));return i.createElement("div",{ref:n,style:Je,"data-viewport-type":"window"},t)},it=function(e){var t=e.children,r=ct("TopItemListComponent"),o=ct("headerHeight"),i=a({},$e,{marginTop:o+"px"}),l=ct("context");return n.createElement(r||"div",{style:i,context:l},t)},at=i.memo(function(e){var t=ct("useWindowScroll"),n=ct("topItemsIndexes").length>0,r=ct("customScrollParent"),o=r||t?ot:rt;return i.createElement(r||t?pt:dt,a({},e),i.createElement(o,null,i.createElement(Xe,null),i.createElement(qe,null),i.createElement(et,null)),n&&i.createElement(it,null,i.createElement(qe,{showTopList:!0})))}),lt=e.systemToComponent(je,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},at),st=lt.Component,ut=lt.usePublisher,ct=lt.useEmitterValue,mt=lt.useEmitter,dt=tt({usePublisher:ut,useEmitterValue:ct,useEmitter:mt}),pt=nt({usePublisher:ut,useEmitterValue:ct,useEmitter:mt}),ft={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},ht={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},gt=Math.round,vt=Math.ceil,St=Math.floor,Ct=Math.min,It=Math.max;function Tt(e,t){return Array.from({length:t-e+1}).map(function(t,n){return{index:n+e}})}var xt=o.system(function(e){var t=e[0],n=t.overscan,r=t.visibleRange,i=t.listBoundary,l=e[1],s=l.scrollTop,u=l.viewportHeight,c=l.scrollBy,m=l.scrollTo,d=l.smoothScrollTargetReached,p=l.scrollContainerState,f=e[2],h=e[3],g=e[4],v=g.propsReady,S=g.didMount,C=e[5],I=C.windowViewportRect,T=C.windowScrollTo,x=C.useWindowScroll,w=C.customScrollParent,y=C.windowScrollContainerState,b=o.statefulStream(0),E=o.statefulStream(0),L=o.statefulStream(ft),H=o.statefulStream({height:0,width:0}),R=o.statefulStream({height:0,width:0}),k=o.stream(),z=o.stream(),B=o.statefulStream(0);o.connect(o.pipe(S,o.withLatestFrom(E),o.filter(function(e){return 0!==e[1]}),o.map(function(e){return{items:Tt(0,e[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),L),o.connect(o.pipe(o.combineLatest(o.duc(b),r,o.duc(R,function(e,t){return e&&e.width===t.width&&e.height===t.height})),o.withLatestFrom(H),o.map(function(e){var t=e[0],n=t[0],r=t[1],o=r[0],i=r[1],a=t[2],l=e[1],s=a.height,u=a.width,c=l.width;if(0===n||0===c)return ft;if(0===u)return ht;var m=bt(c,u),d=m*St(o/s),p=m*vt(i/s)-1;p=It(0,Ct(n-1,p));var f=Tt(d=Ct(p,It(0,d)),p),h=wt(l,a,f),g=h.top,v=h.bottom;return{items:f,offsetTop:g,offsetBottom:vt(n/m)*s-v,top:g,bottom:v,itemHeight:s,itemWidth:u}})),L),o.connect(o.pipe(H,o.map(function(e){return e.height})),u),o.connect(o.pipe(o.combineLatest(H,R,L),o.map(function(e){var t=wt(e[0],e[1],e[2].items);return[t.top,t.bottom]}),o.distinctUntilChanged(me)),i);var F=o.streamFromEmitter(o.pipe(o.duc(L),o.filter(function(e){return e.items.length>0}),o.withLatestFrom(b),o.filter(function(e){var t=e[0].items;return t[t.length-1].index===e[1]-1}),o.map(function(e){return e[1]-1}),o.distinctUntilChanged())),P=o.streamFromEmitter(o.pipe(o.duc(L),o.filter(function(e){var t=e.items;return t.length>0&&0===t[0].index}),o.mapTo(0),o.distinctUntilChanged())),O=o.streamFromEmitter(o.pipe(o.duc(L),o.filter(function(e){return e.items.length>0}),o.map(function(e){var t=e.items;return{startIndex:t[0].index,endIndex:t[t.length-1].index}}),o.distinctUntilChanged(de)));o.connect(O,h.scrollSeekRangeChanged),o.connect(o.pipe(k,o.withLatestFrom(H,R,b),o.map(function(e){var t=e[1],n=e[2],r=e[3],o=ee(e[0]),i=o.align,a=o.behavior,l=o.offset,s=o.index;"LAST"===s&&(s=r-1);var u=yt(t,n,s=It(0,s,Ct(r-1,s)));return"end"===i?u=gt(u-t.height+n.height):"center"===i&&(u=gt(u-t.height/2+n.height/2)),l&&(u+=l),{top:u,behavior:a}})),m);var M=o.statefulStreamFromEmitter(o.pipe(L,o.map(function(e){return e.offsetBottom+e.bottom})),0);return o.connect(o.pipe(I,o.map(function(e){return{width:e.visibleWidth,height:e.visibleHeight}})),H),a({totalCount:b,viewportDimensions:H,itemDimensions:R,scrollTop:s,scrollHeight:z,overscan:n,scrollBy:c,scrollTo:m,scrollToIndex:k,smoothScrollTargetReached:d,windowViewportRect:I,windowScrollTo:T,useWindowScroll:x,customScrollParent:w,windowScrollContainerState:y,deviation:B,scrollContainerState:p,initialItemCount:E},h,{gridState:L,totalListHeight:M},f,{startReached:P,endReached:F,rangeChanged:O,propsReady:v})},o.tup(he,I,oe,ye,ie,ke));function wt(e,t,n){var r=t.height;return void 0===r||0===n.length?{top:0,bottom:0}:{top:yt(e,t,n[0].index),bottom:yt(e,t,n[n.length-1].index)+r}}function yt(e,t,n){var r=bt(e.width,t.width);return St(n/r)*t.height}function bt(e,t){return It(1,St(e/t))}var Et=["placeholder"],Lt=o.system(function(){var e=o.statefulStream(function(e){return"Item "+e}),t=o.statefulStream({}),n=o.statefulStream(null),r=o.statefulStream("virtuoso-grid-item"),i=o.statefulStream("virtuoso-grid-list"),a=o.statefulStream(Ne),l=o.statefulStream(o.noop),s=function(e,n){return void 0===n&&(n=null),o.statefulStreamFromEmitter(o.pipe(t,o.map(function(t){return t[e]}),o.distinctUntilChanged()),n)};return{context:n,itemContent:e,components:t,computeItemKey:a,itemClassName:r,listClassName:i,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Ht=o.system(function(e){var t=e[0],n=e[1],r={item:Ge(n.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:o.stream(),ScrollContainer:o.stream(),ListContainer:o.stream(),emptyComponent:o.stream(),scrollSeek:o.stream()};function i(e,t,r){o.connect(o.pipe(e,o.withLatestFrom(n.components),o.map(function(e){var n,o=e[0],i=e[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+t+" instead."),a({},i,((n={})[t]=o,n))})),n.components)}return o.subscribe(r.scrollSeek,function(e){var r=e.placeholder,i=l(e,Et);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),o.publish(n.components,a({},o.getValue(n.components),{ScrollSeekPlaceholder:r})),o.publish(t.scrollSeekConfiguration,i)}),i(r.ItemContainer,"Item","ItemContainer"),i(r.ListContainer,"List","ListContainer"),i(r.ScrollContainer,"Scroller","ScrollContainer"),a({},t,n,r)},o.tup(xt,Lt)),Rt=i.memo(function(){var e=Mt("gridState"),t=Mt("listClassName"),r=Mt("itemClassName"),o=Mt("itemContent"),i=Mt("computeItemKey"),l=Mt("isSeeking"),s=Ot("scrollHeight"),u=Mt("ItemComponent"),c=Mt("ListComponent"),m=Mt("ScrollSeekPlaceholder"),d=Mt("context"),p=Ot("itemDimensions"),f=g(function(e){s(e.parentElement.parentElement.scrollHeight);var t=e.firstChild;t&&p(t.getBoundingClientRect())});return n.createElement(c,a({ref:f,className:t},Qe(c,d),{style:{paddingTop:e.offsetTop,paddingBottom:e.offsetBottom}}),e.items.map(function(t){var s=i(t.index);return l?n.createElement(m,a({key:s},Qe(m,d),{index:t.index,height:e.itemHeight,width:e.itemWidth})):n.createElement(u,a({},Qe(u,d),{className:r,"data-index":t.index,key:s}),o(t.index,d))}))}),kt=function(e){var t=e.children,n=Ot("viewportDimensions"),r=g(function(e){n(e.getBoundingClientRect())});return i.createElement("div",{style:Je,ref:r},t)},zt=function(e){var t=e.children,n=Ve(Ot("windowViewportRect"),Mt("customScrollParent"));return i.createElement("div",{ref:n,style:Je},t)},Bt=i.memo(function(e){var t=a({},e),n=Mt("useWindowScroll"),r=Mt("customScrollParent"),o=r||n?zt:kt;return i.createElement(r||n?At:Ut,a({},t),i.createElement(o,null,i.createElement(Rt,null)))}),Ft=e.systemToComponent(Ht,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},Bt),Pt=Ft.Component,Ot=Ft.usePublisher,Mt=Ft.useEmitterValue,Vt=Ft.useEmitter,Ut=tt({usePublisher:Ot,useEmitterValue:Mt,useEmitter:Vt}),At=nt({usePublisher:Ot,useEmitterValue:Mt,useEmitter:Vt}),Wt=t.system(function(){var e=t.statefulStream(function(e){return i.createElement("td",null,"Item $",e)}),n=t.statefulStream(null),r=t.statefulStream(null),o=t.statefulStream({}),a=t.statefulStream(Ne),l=t.statefulStream(t.noop),s=function(e,n){return void 0===n&&(n=null),t.statefulStreamFromEmitter(t.pipe(o,t.map(function(t){return t[e]}),t.distinctUntilChanged()),n)};return{context:n,itemContent:e,fixedHeaderContent:r,components:o,computeItemKey:a,scrollerRef:l,TableComponent:s("Table","table"),TableHeadComponent:s("TableHead","thead"),TableBodyComponent:s("TableBody","tbody"),TableRowComponent:s("TableRow","tr"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),FillerRow:s("FillerRow")}}),Nt=t.system(function(e){return a({},e[0],e[1])},t.tup(Oe,Wt)),Dt=function(e){return i.createElement("tr",null,i.createElement("td",{style:{height:e.height}}))},Gt=function(e){return i.createElement("tr",null,i.createElement("td",{style:{height:e.height,padding:0,border:0}}))},jt=i.memo(function(){var e=$t("listState"),t=Jt("sizeRanges"),r=$t("useWindowScroll"),o=$t("customScrollParent"),l=Jt("windowScrollContainerState"),s=Jt("scrollContainerState"),u=o||r?l:s,c=$t("itemContent"),m=$t("trackItemSizes"),d=v(t,$t("itemSize"),m,u,$t("log"),o),p=d.callbackRef,f=d.ref,h=i.useState(0),g=h[0],S=h[1];Qt("deviation",function(e){g!==e&&(f.current.style.marginTop=e+"px",S(e))});var C=$t("EmptyPlaceholder"),I=$t("ScrollSeekPlaceholder")||Dt,T=$t("FillerRow")||Gt,x=$t("TableBodyComponent"),w=$t("TableRowComponent"),y=$t("computeItemKey"),b=$t("isSeeking"),E=$t("paddingTopAddition"),L=$t("firstItemIndex"),H=$t("statefulTotalCount"),R=$t("context");if(0===H&&C)return n.createElement(C,Qe(C,R));var k=e.offsetTop+E+g,z=e.offsetBottom,B=k>0?i.createElement(T,{height:k,key:"padding-top"}):null,F=z>0?i.createElement(T,{height:z,key:"padding-bottom"}):null,P=e.items.map(function(e){var t=e.originalIndex,r=y(t+L,e.data,R);return b?n.createElement(I,a({},Qe(I,R),{key:r,index:e.index,height:e.size,type:e.type||"item"})):n.createElement(w,a({},Qe(w,R),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:{overflowAnchor:"none"}}),c(e.index,e.data,R))});return n.createElement(x,a({ref:p,"data-test-id":"virtuoso-item-list"},Qe(x,R)),[B].concat(P,[F]))}),_t=function(e){var n=e.children,r=Jt("viewportHeight"),o=g(t.compose(r,function(e){return S(e,"height")}));return i.createElement("div",{style:Je,ref:o,"data-viewport-type":"element"},n)},Kt=function(e){var t=e.children,n=Ve(Jt("windowViewportRect"),$t("customScrollParent"));return i.createElement("div",{ref:n,style:Je,"data-viewport-type":"window"},t)},Yt=i.memo(function(e){var n=$t("useWindowScroll"),r=$t("customScrollParent"),o=Jt("fixedHeaderHeight"),l=$t("fixedHeaderContent"),s=$t("context"),u=g(t.compose(o,function(e){return S(e,"height")})),c=r||n?en:Xt,m=r||n?Kt:_t,d=$t("TableComponent"),p=$t("TableHeadComponent"),f=l?i.createElement(p,a({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:u},Qe(p,s)),l()):null;return i.createElement(c,a({},e),i.createElement(m,null,i.createElement(d,a({style:{borderSpacing:0}},Qe(d,s)),[f,i.createElement(jt,{key:"TableBody"})])))}),qt=e.systemToComponent(Nt,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Yt),Zt=qt.Component,Jt=qt.usePublisher,$t=qt.useEmitterValue,Qt=qt.useEmitter,Xt=tt({usePublisher:Jt,useEmitterValue:$t,useEmitter:Qt}),en=nt({usePublisher:Jt,useEmitterValue:$t,useEmitter:Qt}),tn=st,nn=Zt,rn=Pt;exports.GroupedVirtuoso=st,exports.TableVirtuoso=nn,exports.Virtuoso=tn,exports.VirtuosoGrid=rn;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|