react-virtuoso 0.0.0-development → 0.0.0-prepend
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/README.md +18 -18
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +74 -4
- package/dist/index.mjs +238 -69
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
**React Virtuoso** is the most powerful React virtual list/table component, full stop. Here's why:
|
|
6
6
|
|
|
7
7
|
- Variable sized items out of the box; no manual measurements or hard-coding item heights is necessary;
|
|
8
|
-
- Support for [reverse (bottom up) scrolling and prepending items](
|
|
9
|
-
- [Grouped mode with sticky headers](
|
|
10
|
-
- [Responsive grid layout](
|
|
11
|
-
- [Table Support](
|
|
12
|
-
- [Automatic handling of content resize](
|
|
13
|
-
- [Custom Header, Footer, and empty list components](
|
|
14
|
-
- [Pinned top items](
|
|
15
|
-
- [Endless scrolling](
|
|
16
|
-
- [Initial top most item index](
|
|
17
|
-
- [Scroll to index method](
|
|
18
|
-
|
|
19
|
-
For live examples and documentation, check the [documentation website](
|
|
8
|
+
- Support for [reverse (bottom up) scrolling and prepending items](https://virtuoso.dev/prepend-items/) (chat, feeds, etc);
|
|
9
|
+
- [Grouped mode with sticky headers](https://virtuoso.dev/grouped-by-first-letter/);
|
|
10
|
+
- [Responsive grid layout](https://virtuoso.dev/grid-responsive-columns/);
|
|
11
|
+
- [Table Support](https://virtuoso.dev/hello-table/);
|
|
12
|
+
- [Automatic handling of content resize](https://virtuoso.dev/auto-resizing/);
|
|
13
|
+
- [Custom Header, Footer, and empty list components](https://virtuoso.dev/customize-structure/);
|
|
14
|
+
- [Pinned top items](https://virtuoso.dev/top-items/);
|
|
15
|
+
- [Endless scrolling](https://virtuoso.dev/endless-scrolling/), [press to load more](https://virtuoso.dev/press-to-load-more/);
|
|
16
|
+
- [Initial top most item index](https://virtuoso.dev/initial-index/);
|
|
17
|
+
- [Scroll to index method](https://virtuoso.dev/scroll-to-index/).
|
|
18
|
+
|
|
19
|
+
For live examples and documentation, check the [documentation website](https://virtuoso.dev).
|
|
20
20
|
|
|
21
21
|
## Sponsors
|
|
22
22
|
|
|
@@ -40,7 +40,7 @@ const App = () => {
|
|
|
40
40
|
ReactDOM.render(<App />, document.getElementById('root'))
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
## [Grouped Mode](
|
|
43
|
+
## [Grouped Mode](https://virtuoso.dev/grouped-by-first-letter/)
|
|
44
44
|
|
|
45
45
|
The `GroupedVirtuoso` component is a variant of the "flat" `Virtuoso`, with the following differences:
|
|
46
46
|
|
|
@@ -49,24 +49,24 @@ The `GroupedVirtuoso` component is a variant of the "flat" `Virtuoso`, with the
|
|
|
49
49
|
- In addition the `itemContent` property, the component requires an additional `groupContent` property,
|
|
50
50
|
which renders the **group header**. The `groupContent` callback receives the zero-based group index as a parameter.
|
|
51
51
|
|
|
52
|
-
## [Grid](
|
|
52
|
+
## [Grid](https://virtuoso.dev/grid-responsive-columns/)
|
|
53
53
|
|
|
54
54
|
The `VirtuosoGrid` component displays **same sized items** in multiple columns.
|
|
55
55
|
The layout and item sizing is controlled through CSS class properties, which allows you to use media queries, min-width, percentage, etc.
|
|
56
56
|
|
|
57
|
-
## [Table](
|
|
57
|
+
## [Table](https://virtuoso.dev/hello-table/)
|
|
58
58
|
|
|
59
59
|
The `TableVirtuoso` component works just like `Virtuoso`, but with HTML tables.
|
|
60
60
|
It supports window scrolling, sticky headers, sticky columns, and works with React Table and MUI Table.
|
|
61
61
|
|
|
62
62
|
## Works With Your UI Library of Choice
|
|
63
63
|
|
|
64
|
-
You can customize the markup up to your requirements - check [the Material UI list demo](
|
|
65
|
-
If you need to support reordering, [check the React Sortable HOC example](
|
|
64
|
+
You can customize the markup up to your requirements - check [the Material UI list demo](https://virtuoso.dev/material-ui-endless-scrolling/).
|
|
65
|
+
If you need to support reordering, [check the React Sortable HOC example](https://virtuoso.dev/react-sortable-hoc/).
|
|
66
66
|
|
|
67
67
|
## Documentation and Demos
|
|
68
68
|
|
|
69
|
-
For in-depth documentation and live examples of the supported features and live demos, check the [documentation website](
|
|
69
|
+
For in-depth documentation and live examples of the supported features and live demos, check the [documentation website](https://virtuoso.dev).
|
|
70
70
|
|
|
71
71
|
## Browser support
|
|
72
72
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("react-dom");function o(e,t){return o=>e(t(o))}function n(e,t){return t(e)}function r(e,t){return o=>e(t,o)}function i(e,t){return()=>e(t)}function l(e,t){return t(e),e}function s(...e){return e}function c(e){e()}function a(e){return()=>e}function u(){}function d(e,t){return e(1,t)}function f(e,t){e(0,t)}function m(e){e(2)}function h(e){return e(4)}function g(e,t){return d(e,r(t,0))}function p(e,t){const o=e(1,(e=>{o(),t(e)}));return o}function v(){const e=[];return(t,o)=>{switch(t){case 2:return void e.splice(0,e.length);case 1:return e.push(o),()=>{const t=e.indexOf(o);t>-1&&e.splice(t,1)};case 0:return void e.slice().forEach((e=>{e(o)}));default:throw new Error(`unrecognized action ${t}`)}}}function x(e){let t=e;const o=v();return(e,n)=>{switch(e){case 1:n(t);break;case 0:t=n;break;case 4:return t}return o(e,n)}}function I(e){return l(v(),(t=>g(e,t)))}function T(e,t){return l(x(t),(t=>g(e,t)))}function w(e,...t){const o=function(...e){return t=>e.reduceRight(n,t)}(...t);return(t,n)=>{switch(t){case 1:return d(e,o(n));case 2:return void m(e)}}}function C(e,t){return e===t}function S(e=C){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function E(e){return t=>o=>{e(o)&&t(o)}}function H(e){return t=>o(t,e)}function y(e){return t=>()=>t(e)}function b(e,t){return o=>n=>o(t=e(t,n))}function R(e){return t=>o=>{e>0?e--:t(o)}}function z(e){let t,o;return n=>r=>{t=r,o||(o=setTimeout((()=>{o=void 0,n(t)}),e))}}function B(e){let t,o;return n=>r=>{t=r,o&&clearTimeout(o),o=setTimeout((()=>{n(t)}),e)}}function k(...e){const t=new Array(e.length);let o=0,n=null;const r=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const l=Math.pow(2,i);d(e,(e=>{const s=o;o|=l,t[i]=e,s!==r&&o===r&&n&&(n(),n=null)}))})),e=>i=>{const l=()=>e([i].concat(t));o===r?l():n=l}}function P(...e){return function(t,o){switch(t){case 1:return function(...e){return()=>{e.map(c)}}(...e.map((e=>d(e,o))));case 2:return;default:throw new Error(`unrecognized action ${t}`)}}}function L(e,t=C){return w(e,S(t))}function O(...e){const t=v(),o=new Array(e.length);let n=0;const r=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const l=Math.pow(2,i);d(e,(e=>{o[i]=e,n|=l,n===r&&f(t,o)}))})),function(e,i){switch(e){case 1:return n===r&&i(o),d(t,i);case 2:return m(t);default:throw new Error(`unrecognized action ${e}`)}}}function M(e,t=[],{singleton:o}={singleton:!0}){return{id:W(),constructor:e,dependencies:t,singleton:o}}const W=()=>Symbol();const V="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;function F(t,o,n){const s=Object.keys(o.required||{}),c=Object.keys(o.optional||{}),g=Object.keys(o.methods||{}),p=Object.keys(o.events||{}),v=e.createContext({});function x(e,t){e.propsReady&&f(e.propsReady,!1);for(const n of s){f(e[o.required[n]],t[n])}for(const n of c)if(n in t){f(e[o.optional[n]],t[n])}e.propsReady&&f(e.propsReady,!0)}function I(e){return p.reduce(((t,n)=>(t[n]=function(e){let t,o;const n=()=>t&&t();return function(r,i){switch(r){case 1:if(i){if(o===i)return;return n(),o=i,t=d(e,i),t}return n(),u;case 2:return n(),void(o=null);default:throw new Error(`unrecognized action ${r}`)}}}(e[o.events[n]]),t)),{})}const T=e.forwardRef(((r,u)=>{const{children:h,...T}=r,[w]=e.useState((()=>l(function(e){const t=new Map,o=({id:e,constructor:n,dependencies:r,singleton:i})=>{if(i&&t.has(e))return t.get(e);const l=n(r.map((e=>o(e))));return i&&t.set(e,l),l};return o(e)}(t),(e=>x(e,T))))),[C]=e.useState(i(I,w));return V((()=>{for(const e of p)e in T&&d(C[e],T[e]);return()=>{Object.values(C).map(m)}}),[T,C,w]),V((()=>{x(w,T)})),e.useImperativeHandle(u,a(function(e){return g.reduce(((t,n)=>(t[n]=t=>{f(e[o.methods[n]],t)},t)),{})}(w))),e.createElement(v.Provider,{value:w},n?e.createElement(n,function(e,t){const o={},n={};let r=0;const i=e.length;for(;r<i;)n[e[r]]=1,r+=1;for(const l in t)n.hasOwnProperty(l)||(o[l]=t[l]);return o}([...s,...c,...p],T),h):h)}));return{Component:T,usePublisher:t=>e.useCallback(r(f,e.useContext(v)[t]),[t]),useEmitterValue:t=>{const o=e.useContext(v)[t],[n,r]=e.useState(i(h,o));return V((()=>d(o,(e=>{e!==n&&r(a(e))}))),[o,n]),n},useEmitter:(t,o)=>{const n=e.useContext(v)[t];V((()=>d(n,o)),[o,n])}}}const A="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;var D=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(D||{});const G={0:"debug",1:"log",2:"warn",3:"error"},N=M((()=>{const e=x(3);return{log:x(((t,o,n=1)=>{n>=(("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL??h(e))&&console[G[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)})),logLevel:e}}),[],{singleton:!0});function _(t,o=!0){const n=e.useRef(null);let r=e=>{};if("undefined"!=typeof ResizeObserver){const e=new ResizeObserver((e=>{const o=e[0].target;null!==o.offsetParent&&t(o)}));r=t=>{t&&o?(e.observe(t),n.current=t):(n.current&&e.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function U(e,t=!0){return _(e,t).callbackRef}function $(e,t,o,n,r,i,l){return _((o=>{const s=function(e,t,o,n){const r=e.length;if(0===r)return null;const i=[];for(let l=0;l<r;l++){const r=e.item(l);if(!r||void 0===r.dataset.index)continue;const s=parseInt(r.dataset.index),c=parseFloat(r.dataset.knownSize),a=t(r,o);if(0===a&&n("Zero-sized element, this should not happen",{child:r},D.ERROR),a===c)continue;const u=i[i.length-1];0===i.length||u.size!==a||u.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:a}):i[i.length-1].endIndex++}return i}(o.children,t,"offsetHeight",r);let c=o.parentElement;for(;!c.dataset.virtuosoScroller;)c=c.parentElement;const a="window"===c.lastElementChild.dataset.viewportType,u=l?l.scrollTop:a?window.pageYOffset||document.documentElement.scrollTop:c.scrollTop,d=l?l.scrollHeight:a?document.documentElement.scrollHeight:c.scrollHeight,f=l?l.offsetHeight:a?window.innerHeight:c.offsetHeight;n({scrollTop:Math.max(u,0),scrollHeight:d,viewportHeight:f}),null==i||i(function(e,t,o){"normal"===t||(null==t?void 0:t.endsWith("px"))||o(`${e} was not resolved to pixel value correctly`,t,D.WARN);if("normal"===t)return 0;return parseInt(t??"0",10)}("row-gap",getComputedStyle(o).rowGap,r)),null!==s&&e(s)}),o)}function j(e,t){return Math.round(e.getBoundingClientRect()[t])}function K(e,t){return Math.abs(e-t)<1.01}function q(o,n,r,i=u,l){const s=e.useRef(null),c=e.useRef(null),a=e.useRef(null),d=e.useCallback((e=>{const r=e.target,i=r===window||r===document,l=i?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,s=i?document.documentElement.scrollHeight:r.scrollHeight,u=i?window.innerHeight:r.offsetHeight,d=()=>{o({scrollTop:Math.max(l,0),scrollHeight:s,viewportHeight:u})};e.suppressFlushSync?d():t.flushSync(d),null!==c.current&&(l===c.current||l<=0||l===s-u)&&(c.current=null,n(!0),a.current&&(clearTimeout(a.current),a.current=null))}),[o,n]);return e.useEffect((()=>{const e=l||s.current;return i(l||s.current),d({target:e,suppressFlushSync:!0}),e.addEventListener("scroll",d,{passive:!0}),()=>{i(null),e.removeEventListener("scroll",d)}}),[s,d,r,i,l]),{scrollerRef:s,scrollByCallback:function(e){s.current.scrollBy(e)},scrollToCallback:function(e){const t=s.current;if(!t||"offsetHeight"in t&&0===t.offsetHeight)return;const r="smooth"===e.behavior;let i,l,u;t===window?(l=Math.max(j(document.documentElement,"height"),document.documentElement.scrollHeight),i=window.innerHeight,u=document.documentElement.scrollTop):(l=t.scrollHeight,i=j(t,"height"),u=t.scrollTop);const d=l-i;if(e.top=Math.ceil(Math.max(Math.min(d,e.top),0)),K(i,l)||e.top===u)return o({scrollTop:u,scrollHeight:l,viewportHeight:i}),void(r&&n(!0));r?(c.current=e.top,a.current&&clearTimeout(a.current),a.current=setTimeout((()=>{a.current=null,c.current=null,n(!0)}),1e3)):c.current=null,t.scrollTo(e)}}}const Y=M((()=>{const e=v(),t=v(),o=x(0),n=v(),r=x(0),i=v(),l=v(),s=x(0),c=x(0),a=x(0),u=x(0),d=v(),f=v(),m=x(!1);return g(w(e,H((({scrollTop:e})=>e))),t),g(w(e,H((({scrollHeight:e})=>e))),l),g(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:i,headerHeight:s,fixedHeaderHeight:c,fixedFooterHeight:a,footerHeight:u,scrollHeight:l,smoothScrollTargetReached:n,scrollTo:d,scrollBy:f,statefulScrollTop:r,deviation:o,scrollingInProgress:m}}),[],{singleton:!0}),Z={lvl:0};function J(e,t,o,n=Z,r=Z){return{k:e,v:t,lvl:o,l:n,r:r}}function Q(e){return e===Z}function X(){return Z}function ee(e,t){if(Q(e))return Z;const{k:o,l:n,r:r}=e;if(t===o){if(Q(n))return r;if(Q(r))return n;{const[t,o]=ie(n);return ue(se(e,{k:t,v:o,l:le(n)}))}}return ue(se(e,t<o?{l:ee(n,t)}:{r:ee(r,t)}))}function te(e,t,o="k"){if(Q(e))return[-1/0,void 0];if(e[o]===t)return[e.k,e.v];if(e[o]<t){const n=te(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return te(e.l,t,o)}function oe(e,t,o){return Q(e)?J(t,o,1):t===e.k?se(e,{k:t,v:o}):t<e.k?ae(se(e,{l:oe(e.l,t,o)})):ae(se(e,{r:oe(e.r,t,o)}))}function ne(e,t,o){if(Q(e))return[];const{k:n,v:r,l:i,r:l}=e;let s=[];return n>t&&(s=s.concat(ne(i,t,o))),n>=t&&n<=o&&s.push({k:n,v:r}),n<=o&&(s=s.concat(ne(l,t,o))),s}function re(e){return Q(e)?[]:[...re(e.l),{k:e.k,v:e.v},...re(e.r)]}function ie(e){return Q(e.r)?[e.k,e.v]:ie(e.r)}function le(e){return Q(e.r)?e.l:ue(se(e,{r:le(e.r)}))}function se(e,t){return J(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 ce(e){return Q(e)||e.lvl>e.r.lvl}function ae(e){return me(he(e))}function ue(e){const{l:t,r:o,lvl:n}=e;if(o.lvl>=n-1&&t.lvl>=n-1)return e;if(n>o.lvl+1){if(ce(t))return he(se(e,{lvl:n-1}));if(Q(t)||Q(t.r))throw new Error("Unexpected empty nodes");return se(t.r,{l:se(t,{r:t.r.l}),r:se(e,{l:t.r.r,lvl:n-1}),lvl:n})}if(ce(e))return me(se(e,{lvl:n-1}));if(Q(o)||Q(o.l))throw new Error("Unexpected empty nodes");{const t=o.l,r=ce(t)?o.lvl-1:o.lvl;return se(t,{l:se(e,{r:t.l,lvl:n-1}),r:me(se(o,{l:t.r,lvl:r})),lvl:t.lvl+1})}}function de(e,t,o){if(Q(e))return[];const n=te(e,t)[0];return fe(ne(e,n,o),(({k:e,v:t})=>({index:e,value:t})))}function fe(e,t){const o=e.length;if(0===o)return[];let{index:n,value:r}=t(e[0]);const i=[];for(let l=1;l<o;l++){const{index:o,value:s}=t(e[l]);i.push({start:n,end:o-1,value:r}),n=o,r=s}return i.push({start:n,end:1/0,value:r}),i}function me(e){const{r:t,lvl:o}=e;return Q(t)||Q(t.r)||t.lvl!==o||t.r.lvl!==o?e:se(t,{l:se(e,{r:t.l}),lvl:o+1})}function he(e){const{l:t}=e;return Q(t)||t.lvl!==e.lvl?e:se(t,{r:se(e,{l:t.r})})}function ge(e,t,o,n=0){let r=e.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),l=o(e[i],t);if(0===l)return i;if(-1===l){if(r-n<2)return i-1;r=i-1}else{if(r===n)return i;n=i+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function pe(e,t,o){return e[ge(e,t,o)]}const ve=M((()=>({recalcInProgress:x(!1)})),[],{singleton:!0});function xe(e){const{size:t,startIndex:o,endIndex:n}=e;return e=>e.start===o&&(e.end===n||e.end===1/0)&&e.value===t}function Ie({index:e},t){return t===e?0:t<e?-1:1}function Te({offset:e},t){return t===e?0:t<e?-1:1}function we(e){return{index:e.index,value:e}}function Ce(e,t,o,n=0){return n>0&&(t=Math.max(t,pe(e,n,Ie).offset)),fe(function(e,t,o,n){const r=ge(e,t,n),i=ge(e,o,n,r);return e.slice(r,i+1)}(e,t,o,Te),we)}function Se(e,t,o,n){let r=e,i=0,l=0,s=0,c=0;if(0!==t){c=ge(r,t-1,Ie);s=r[c].offset;const e=te(o,t-1);i=e[0],l=e[1],r.length&&r[c].size===te(o,t)[1]&&(c-=1),r=r.slice(0,c+1)}else r=[];for(const{start:a,value:u}of de(o,t,1/0)){const e=a-i,t=e*l+s+e*n;r.push({offset:t,size:u,index:a}),i=a,s=t,l=u}return{offsetTree:r,lastIndex:i,lastOffset:s,lastSize:l}}function Ee(e,[t,o,n,r]){t.length>0&&n("received item sizes",t,D.DEBUG);const i=e.sizeTree;let l=i,s=0;if(o.length>0&&Q(i)&&2===t.length){const e=t[0].size,n=t[1].size;l=o.reduce(((t,o)=>oe(oe(t,o,e),o+1,n)),l)}else[l,s]=function(e,t){let o=Q(e)?0:1/0;for(const n of t){const{size:t,startIndex:r,endIndex:i}=n;if(o=Math.min(o,r),Q(e)){e=oe(e,0,t);continue}const l=de(e,r-1,i+1);if(l.some(xe(n)))continue;let s=!1,c=!1;for(const{start:o,end:n,value:a}of l)s?(i>=o||t===a)&&(e=ee(e,o)):(c=a!==t,s=!0),n>i&&i>=o&&a!==t&&(e=oe(e,i+1,a));c&&(e=oe(e,r,t))}return[e,o]}(l,t);if(l===i)return e;const{offsetTree:c,lastIndex:a,lastSize:u,lastOffset:d}=Se(e.offsetTree,s,l,r);return{sizeTree:l,offsetTree:c,lastIndex:a,lastOffset:d,lastSize:u,groupOffsetTree:o.reduce(((e,t)=>oe(e,t,He(t,c,r))),X()),groupIndices:o}}function He(e,t,o){if(0===t.length)return 0;const{offset:n,index:r,size:i}=pe(t,e,Ie),l=e-r,s=i*l+(l-1)*o+n;return s>0?s+o:s}function ye(e,t,o){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;{let n=be("LAST"===e.index?o:e.index,t);return n=Math.max(0,n,Math.min(o,n)),n}}function be(e,t){if(!Re(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function Re(e){return!Q(e.groupOffsetTree)}const ze={offsetHeight:"height",offsetWidth:"width"},Be=M((([{log:e},{recalcInProgress:t}])=>{const o=v(),n=v(),r=T(n,0),i=v(),l=v(),s=x(0),c=x([]),a=x(void 0),u=x(void 0),m=x(((e,t)=>j(e,ze[t]))),p=x(void 0),C=x(0),y={offsetTree:[],sizeTree:X(),groupOffsetTree:X(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},R=T(w(o,k(c,e,C),b(Ee,y),S()),y);g(w(c,E((e=>e.length>0)),k(R,C),H((([e,t,o])=>{const n=e.reduce(((e,n,r)=>oe(e,n,He(n,t.offsetTree,o)||r)),X());return{...t,groupIndices:e,groupOffsetTree:n}}))),R),g(w(n,k(R),E((([e,{lastIndex:t}])=>e<t)),H((([e,{lastIndex:t,lastSize:o}])=>[{startIndex:e,endIndex:t,size:o}]))),o),g(a,u);const z=T(w(a,H((e=>void 0===e))),!0);g(w(u,E((e=>void 0!==e&&Q(h(R).sizeTree))),H((e=>[{startIndex:0,endIndex:0,size:e}]))),o);const B=I(w(o,k(R),b((({sizes:e},[t,o])=>({changed:o!==e,sizes:o})),{changed:!1,sizes:y}),H((e=>e.changed))));d(w(s,b(((e,t)=>({diff:e.prev-t,prev:t})),{diff:0,prev:0}),H((e=>e.diff))),(e=>{e>0?(f(t,!0),f(i,e)):e<0&&f(l,e)})),d(w(s,k(e)),(([e,t])=>{e<0&&t("`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:s},D.ERROR)}));const P=I(i);g(w(i,k(R),H((([e,t])=>{if(t.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return re(t.sizeTree).reduce(((t,{k:o,v:n})=>({ranges:[...t.ranges,{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}],prevIndex:o+e,prevSize:n})),{ranges:[],prevIndex:0,prevSize:t.lastSize}).ranges}))),o);const L=I(w(l,k(R,C),H((([e,{offsetTree:t},o])=>He(-e,t,o)))));return g(w(l,k(R,C),H((([e,t,o])=>{if(t.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");const n=re(t.sizeTree).reduce(((t,{k:o,v:n})=>oe(t,Math.max(0,o+e),n)),X());return{...t,sizeTree:n,...Se(t.offsetTree,0,n,o)}}))),R),{data:p,totalCount:n,sizeRanges:o,groupIndices:c,defaultItemSize:u,fixedItemSize:a,unshiftWith:i,shiftWith:l,shiftWithOffset:L,beforeUnshiftWith:P,firstItemIndex:s,gap:C,sizes:R,listRefresh:B,statefulTotalCount:r,trackItemSizes:z,itemSize:m}}),s(N,ve),{singleton:!0}),ke="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function Pe(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&ke||(t.behavior="auto"),t.offset||(t.offset=0),t}const Le=M((([{sizes:e,totalCount:t,listRefresh:o,gap:n},{scrollingInProgress:r,viewportHeight:i,scrollTo:l,smoothScrollTargetReached:s,headerHeight:c,footerHeight:a,fixedHeaderHeight:u,fixedFooterHeight:m},{log:h}])=>{const I=v(),T=x(0);let C=null,S=null,E=null;function y(){C&&(C(),C=null),E&&(E(),E=null),S&&(clearTimeout(S),S=null),f(r,!1)}return g(w(I,k(e,i,t,T,c,a,h),k(n,u,m),H((([[e,t,n,i,l,c,a,u],m,h,g])=>{const v=Pe(e),{align:x,behavior:T,offset:H}=v,b=i-1,R=ye(v,t,b);let z=He(R,t.offsetTree,m)+c;"end"===x?(z+=h+te(t.sizeTree,R)[1]-n+g,R===b&&(z+=a)):"center"===x?z+=(h+te(t.sizeTree,R)[1]-n+g)/2:z-=l,H&&(z+=H);const B=t=>{y(),t?(u("retrying to scroll to",{location:e},D.DEBUG),f(I,e)):u("list did not change, scroll successful",{},D.DEBUG)};if(y(),"smooth"===T){let e=!1;E=d(o,(t=>{e=e||t})),C=p(s,(()=>{B(e)}))}else C=p(w(o,(k=150,e=>{const t=setTimeout((()=>{e(!1)}),k);return o=>{o&&(e(!0),clearTimeout(t))}})),B);var k;return S=setTimeout((()=>{y()}),1200),f(r,!0),u("scrolling from index to",{index:R,top:z,behavior:T},D.DEBUG),{top:z,behavior:T}}))),l),{scrollToIndex:I,topListHeight:T}}),s(Be,Y,N),{singleton:!0});const Oe="up",Me="down",We={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Ve=M((([{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:n,footerHeight:r,scrollBy:i}])=>{const l=x(!1),s=x(!0),c=v(),a=v(),u=x(4),d=x(0),f=T(w(P(w(L(t),R(1),y(!0)),w(L(t),R(1),y(!1),B(100))),S()),!1),m=T(w(P(w(i,y(!0)),w(i,y(!1),B(200))),S()),!1);g(w(O(L(t),L(d)),H((([e,t])=>e<=t)),S()),s),g(w(s,z(50)),a);const p=I(w(O(e,L(o),L(n),L(r),L(u)),b(((e,[{scrollTop:t,scrollHeight:o},n,r,i,l])=>{const s={viewportHeight:n,scrollTop:t,scrollHeight:o};if(t+n-o>-l){let o,n;return t>e.state.scrollTop?(o="SCROLLED_DOWN",n=e.state.scrollTop-t):(o="SIZE_DECREASED",n=e.state.scrollTop-t||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:o,scrollTopDelta:n}}let c;return c=s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":n<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":t<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:c,state:s}}),We),S(((e,t)=>e&&e.atBottom===t.atBottom)))),C=T(w(e,b(((e,{scrollTop:t,scrollHeight:o,viewportHeight:n})=>{if(K(e.scrollHeight,o))return{scrollTop:t,scrollHeight:o,jump:0,changed:!1};{const r=o-(t+n)<1;return e.scrollTop!==t&&r?{scrollHeight:o,scrollTop:t,jump:e.scrollTop-t,changed:!0}:{scrollHeight:o,scrollTop:t,jump:0,changed:!0}}}),{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),E((e=>e.changed)),H((e=>e.jump))),0);g(w(p,H((e=>e.atBottom))),l),g(w(l,z(50)),c);const M=x(Me);g(w(e,H((({scrollTop:e})=>e)),S(),b(((e,t)=>h(m)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?Oe:Me,prevScrollTop:t}),{direction:Me,prevScrollTop:0}),H((e=>e.direction))),M),g(w(e,z(50),y("none")),M);const W=x(0);return g(w(f,E((e=>!e)),y(0)),W),g(w(t,z(100),k(f),E((([e,t])=>!!t)),b((([e,t],[o])=>[t,o]),[0,0]),H((([e,t])=>t-e))),W),{isScrolling:f,isAtTop:s,isAtBottom:l,atBottomState:p,atTopStateChange:a,atBottomStateChange:c,scrollDirection:M,atBottomThreshold:u,atTopThreshold:d,scrollVelocity:W,lastJumpDueToItemResize:C}}),s(Y)),Fe=M((([{log:e}])=>{const t=x(!1),o=I(w(t,E((e=>e)),S()));return d(t,(t=>{t&&h(e)("props updated",{},D.DEBUG)})),{propsReady:t,didMount:o}}),s(N),{singleton:!0});const Ae=M((([{sizes:e,listRefresh:t,defaultItemSize:o},{scrollTop:n},{scrollToIndex:r},{didMount:i}])=>{const l=x(!0),s=x(0);return g(w(i,k(s),E((([e,t])=>!!t)),y(!1)),l),d(w(O(t,i),k(l,e,o),E((([[,e],t,{sizeTree:o},n])=>e&&(!Q(o)||void 0!==n)&&!t)),k(s)),(([,e])=>{setTimeout((()=>{p(n,(()=>{f(l,!0)})),f(r,e)}))})),{scrolledToInitialItem:l,initialTopMostItemIndex:s}}),s(Be,Y,Le,Fe),{singleton:!0});function De(e){return!!e&&("smooth"===e?"smooth":"auto")}const Ge=M((([{totalCount:e,listRefresh:t},{isAtBottom:o,atBottomState:n},{scrollToIndex:r},{scrolledToInitialItem:i},{propsReady:l,didMount:s},{log:c},{scrollingInProgress:a}])=>{const u=x(!1),m=v();let g=null;function I(e){f(r,{index:"LAST",align:"end",behavior:e})}function T(e){const t=p(n,(t=>{!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||g||(h(c)("scrolling to bottom due to increased size",{},D.DEBUG),I("auto"))}));setTimeout(t,100)}return d(w(O(w(L(e),R(1)),s),k(L(u),o,i,a),H((([[e,t],o,n,r,i])=>{let l=t&&r,s="auto";return l&&(s=((e,t)=>"function"==typeof e?De(e(t)):t&&De(e))(o,n||i),l=l&&!!s),{totalCount:e,shouldFollow:l,followOutputBehavior:s}})),E((({shouldFollow:e})=>e))),(({totalCount:e,followOutputBehavior:o})=>{g&&(g(),g=null),g=p(t,(()=>{h(c)("following output to ",{totalCount:e},D.DEBUG),I(o),g=null}))})),d(w(O(L(u),e,l),E((([e,,t])=>e&&t)),b((({value:e},[,t])=>({refreshed:e===t,value:t})),{refreshed:!1,value:0}),E((({refreshed:e})=>e)),k(u,e)),(([,e])=>{T(!1!==e)})),d(m,(()=>{T(!1!==h(u))})),d(O(L(u),n),(([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&I("auto")})),{followOutput:u,autoscrollToBottom:m}}),s(Be,Ve,Le,Ae,Fe,N,Y));function Ne(e){return e.reduce(((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e)),{totalCount:0,groupIndices:[]})}const _e=M((([{totalCount:e,groupIndices:t,sizes:o},{scrollTop:n,headerHeight:r}])=>{const i=v(),l=v(),s=I(w(i,H(Ne)));return g(w(s,H((e=>e.totalCount))),e),g(w(s,H((e=>e.groupIndices))),t),g(w(O(n,o,r),E((([e,t])=>Re(t))),H((([e,t,o])=>te(t.groupOffsetTree,Math.max(e-o,0),"v")[0])),S(),H((e=>[e]))),l),{groupCounts:i,topItemsIndexes:l}}),s(Be,Y));function Ue(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function $e(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}const je="top",Ke="bottom",qe="none";function Ye(e,t,o){return"number"==typeof e?o===Oe&&t===je||o===Me&&t===Ke?e:0:o===Oe?t===je?e.main:e.reverse:t===Ke?e.main:e.reverse}function Ze(e,t){return"number"==typeof e?e:e[t]||0}const Je=M((([{scrollTop:e,viewportHeight:t,deviation:o,headerHeight:n,fixedHeaderHeight:r}])=>{const i=v(),l=x(0),s=x(0),c=x(0);return{listBoundary:i,overscan:c,topListHeight:l,increaseViewportBy:s,visibleRange:T(w(O(L(e),L(t),L(n),L(i,Ue),L(c),L(l),L(r),L(o),L(s)),H((([e,t,o,[n,r],i,l,s,c,a])=>{const u=e-c,d=l+s,f=Math.max(o-u,0);let m=qe;const h=Ze(a,je),g=Ze(a,Ke);return n-=c,r+=o+s,(n+=o+s)>e+d-h&&(m=Oe),(r-=c)<e-f+t+g&&(m=Me),m!==qe?[Math.max(u-o-Ye(i,je,m)-h,0),u-f-s+t+Ye(i,Ke,m)+g]:null})),E((e=>null!=e)),S(Ue)),[0,0])}}),s(Y),{singleton:!0});const Qe={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Xe(e,t,o){if(0===e.length)return[];if(!Re(t))return e.map((e=>({...e,index:e.index+o,originalIndex:e.index})));const n=e[0].index,r=e[e.length-1].index,i=[],l=de(t.groupOffsetTree,n,r);let s,c=0;for(const a of e){let e;(!s||s.end<a.index)&&(s=l.shift(),c=t.groupIndices.indexOf(s.start)),e=a.index===s.start?{type:"group",index:c}:{index:a.index-(c+1)+o,groupIndex:c},i.push({...e,size:a.size,offset:a.offset,originalIndex:a.index,data:a.data})}return i}function et(e,t,o,n,r,i){const{lastSize:l,lastOffset:s,lastIndex:c}=r;let a=0,u=0;if(e.length>0){a=e[0].offset;const t=e[e.length-1];u=t.offset+t.size}const d=o-c,f=a,m=s+d*l+(d-1)*n-u;return{items:Xe(e,r,i),topItems:Xe(t,r,i),topListHeight:t.reduce(((e,t)=>t.size+e),0),offsetTop:a,offsetBottom:m,top:f,bottom:u,totalCount:o,firstItemIndex:i}}const tt=M((([{sizes:e,totalCount:t,data:o,firstItemIndex:n,gap:r},i,{visibleRange:s,listBoundary:c,topListHeight:a},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:f},m,{didMount:h},{recalcInProgress:p}])=>{const C=x([]),y=v();g(i.topItemsIndexes,C);const b=T(w(O(h,p,L(s,Ue),L(t),L(e),L(d),u,L(C),L(n),L(r),o),E((([e,t])=>e&&!t)),H((([,,[e,t],o,n,r,i,s,c,a,u])=>{const d=n,{sizeTree:f,offsetTree:m}=d;if(0===o||0===e&&0===t)return{...Qe,totalCount:o};if(Q(f))return et(function(e,t,o){if(Re(t)){const n=be(e,t);return[{index:te(t.groupOffsetTree,n)[0],size:0,offset:0},{index:n,size:0,offset:0,data:o&&o[0]}]}return[{index:e,size:0,offset:0,data:o&&o[0]}]}(function(e,t){const o=t-1;return"number"==typeof e?e:"LAST"===e.index?o:e.index}(r,o),d,u),[],o,a,d,c);const h=[];if(s.length>0){const e=s[0],t=s[s.length-1];let o=0;for(const n of de(f,e,t)){const r=n.value,i=Math.max(n.start,e),l=Math.min(n.end,t);for(let e=i;e<=l;e++)h.push({index:e,size:r,offset:o,data:u&&u[e]}),o+=r}}if(!i)return et([],h,o,a,d,c);const g=s.length>0?s[s.length-1]+1:0,p=Ce(m,e,t,g);if(0===p.length)return null;const v=o-1;return et(l([],(o=>{for(const n of p){const r=n.value;let i=r.offset,l=n.start;const s=r.size;if(r.offset<e){l+=Math.floor((e-r.offset+a)/(s+a));const t=l-n.start;i+=t*s+t*a}l<g&&(i+=(g-l)*s,l=g);const c=Math.min(n.end,v);for(let e=l;e<=c&&!(i>=t);e++)o.push({index:e,size:s,offset:i,data:u&&u[e]}),i+=s+a}})),h,o,a,d,c)})),E((e=>null!==e)),S()),Qe);g(w(o,E((e=>void 0!==e)),H((e=>null==e?void 0:e.length))),t),g(w(b,H((e=>e.topListHeight))),f),g(f,a),g(w(b,H((e=>[e.top,e.bottom]))),c),g(w(b,H((e=>e.items))),y);return{listState:b,topItemsIndexes:C,endReached:I(w(b,E((({items:e})=>e.length>0)),k(t,o),E((([{items:e},t])=>e[e.length-1].originalIndex===t-1)),H((([,e,t])=>[e-1,t])),S(Ue),H((([e])=>e)))),startReached:I(w(b,z(200),E((({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length)),H((({items:e})=>e[0].index)),S())),rangeChanged:I(w(b,E((({items:e})=>e.length>0)),H((({items:e})=>{let t=0,o=e.length-1;for(;"group"===e[t].type&&t<o;)t++;for(;"group"===e[o].type&&o>t;)o--;return{startIndex:e[t].index,endIndex:e[o].index}})),S($e))),itemsRendered:y,...m}}),s(Be,_e,Je,Ae,Le,Ve,Fe,ve),{singleton:!0}),ot=M((([{sizes:e,firstItemIndex:t,data:o,gap:n},{listState:r},{didMount:i}])=>{const l=x(0);return g(w(i,k(l),E((([,e])=>0!==e)),k(e,t,n,o),H((([[,e],t,o,n,r=[]])=>{let i=0;if(t.groupIndices.length>0)for(const s of t.groupIndices){if(s-i>=e)break;i++}const l=e+i;return et(Array.from({length:l}).map(((e,t)=>({index:t,size:0,offset:0,data:r[t]}))),[],l,n,t,o)}))),r),{initialItemCount:l}}),s(Be,tt,Fe),{singleton:!0}),nt=M((([{scrollVelocity:e}])=>{const t=x(!1),o=v(),n=x(!1);return g(w(e,k(n,t,o),E((([e,t])=>!!t)),H((([e,t,o,n])=>{const{exit:r,enter:i}=t;if(o){if(r(e,n))return!1}else if(i(e,n))return!0;return o})),S()),t),d(w(O(t,e,o),k(n)),(([[e,t,o],n])=>e&&n&&n.change&&n.change(t,o))),{isSeeking:t,scrollSeekConfiguration:n,scrollVelocity:e,scrollSeekRangeChanged:o}}),s(Ve),{singleton:!0}),rt=M((([{topItemsIndexes:e}])=>{const t=x(0);return g(w(t,E((e=>e>0)),H((e=>Array.from({length:e}).map(((e,t)=>t))))),e),{topItemCount:t}}),s(tt)),it=M((([{footerHeight:e,headerHeight:t,fixedHeaderHeight:o,fixedFooterHeight:n},{listState:r}])=>{const i=v(),l=T(w(O(e,n,t,o,r),H((([e,t,o,n,r])=>e+t+o+n+r.offsetBottom+r.bottom))),0);return g(L(l),i),{totalListHeight:l,totalListHeightChanged:i}}),s(Y,tt),{singleton:!0});function lt(e){let t,o=!1;return()=>(o||(o=!0,t=e()),t)}const st=lt((()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent))),ct=M((([{scrollBy:e,scrollTop:t,deviation:o,scrollingInProgress:n},{isScrolling:r,isAtBottom:i,scrollDirection:l,lastJumpDueToItemResize:s},{listState:c},{beforeUnshiftWith:a,shiftWithOffset:u,sizes:m,gap:h},{log:p},{recalcInProgress:v}])=>{const x=I(w(c,k(s),b((([,e,t,o],[{items:n,totalCount:r,bottom:i,offsetBottom:l},s])=>{const c=i+l;let a=0;if(t===r&&e.length>0&&n.length>0){0===n[0].originalIndex&&0===e[0].originalIndex||(a=c-o,0!==a&&(a+=s))}return[a,n,r,c]}),[0,[],0,0]),E((([e])=>0!==e)),k(t,l,n,i,p),E((([,e,t,o])=>!o&&0!==e&&t===Oe)),H((([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},D.DEBUG),e)))));function C(t){t>0?(f(e,{top:-t,behavior:"auto"}),f(o,0)):(f(o,0),f(e,{top:-t,behavior:"auto"}))}return d(w(x,k(o,r)),(([e,t,n])=>{n&&st()?f(o,t-e):C(-e)})),d(w(O(T(r,!1),o,v),E((([e,t,o])=>!e&&!o&&0!==t)),H((([e,t])=>t)),z(1)),C),g(w(u,H((e=>({top:-e})))),e),d(w(a,k(m,h),H((([e,{lastSize:t},o])=>e*t+e*o))),(t=>{f(o,t),requestAnimationFrame((()=>{f(e,{top:t}),requestAnimationFrame((()=>{f(o,0),f(v,!1)}))}))})),{deviation:o}}),s(Y,Ve,tt,Be,N,ve)),at=M((([{totalListHeight:e},{didMount:t},{scrollTo:o}])=>{const n=x(0);return d(w(t,k(n),E((([,e])=>0!==e)),H((([,e])=>({top:e})))),(t=>{p(w(e,E((e=>0!==e))),(()=>{setTimeout((()=>{f(o,t)}))}))})),{initialScrollTop:n}}),s(it,Fe,Y),{singleton:!0}),ut=M((([{viewportHeight:e},{totalListHeight:t}])=>{const o=x(!1);return{alignToBottom:o,paddingTopAddition:T(w(O(o,e,t),E((([e])=>e)),H((([,e,t])=>Math.max(0,e-t))),S()),0)}}),s(Y,it),{singleton:!0}),dt=M((([{scrollTo:e,scrollContainerState:t}])=>{const o=v(),n=v(),r=v(),i=x(!1),l=x(void 0);return g(w(O(o,n),H((([{viewportHeight:e,scrollTop:t,scrollHeight:o},{offsetTop:n}])=>({scrollTop:Math.max(0,t-n),scrollHeight:o,viewportHeight:e})))),t),g(w(e,k(n),H((([e,{offsetTop:t}])=>({...e,top:e.top+t})))),r),{useWindowScroll:i,customScrollParent:l,windowScrollContainerState:o,windowViewportRect:n,windowScrollTo:r}}),s(Y)),ft=M((([{sizes:e,totalCount:t,gap:o},{scrollTop:n,viewportHeight:r,headerHeight:i,fixedHeaderHeight:l,fixedFooterHeight:s,scrollingInProgress:c},{scrollToIndex:a}])=>{const u=v();return g(w(u,k(e,r,t,i,l,s,n),k(o),H((([[e,t,o,n,r,i,l,s],a])=>{const{done:u,behavior:d,align:f,...m}=e;let h=null;const g=ye(e,t,n-1),v=He(g,t.offsetTree,a)+r+i;if(v<s+i)h={...m,behavior:d,align:f??"start"};else{v+te(t.sizeTree,g)[1]>s+o-l&&(h={...m,behavior:d,align:f??"end"})}return h?u&&p(w(c,R(1),E((e=>!1===e))),u):u&&u(),h})),E((e=>null!==e))),a),{scrollIntoView:u}}),s(Be,Y,Le,tt,N),{singleton:!0}),mt=M((([e,t,o,n,r,i,l,s,c])=>({...e,...t,...o,...n,...r,...i,...l,...s,...c})),s(Je,ot,Fe,nt,it,at,ut,dt,ft)),ht=M((([{totalCount:e,sizeRanges:t,fixedItemSize:o,defaultItemSize:n,trackItemSizes:r,itemSize:i,data:l,firstItemIndex:s,groupIndices:c,statefulTotalCount:a,gap:u},{initialTopMostItemIndex:d,scrolledToInitialItem:f},m,h,{listState:p,topItemsIndexes:v,...x},{scrollToIndex:I},T,{topItemCount:C},{groupCounts:S},E,y])=>(g(x.rangeChanged,E.scrollSeekRangeChanged),g(w(E.windowViewportRect,H((e=>e.visibleHeight))),m.viewportHeight),{totalCount:e,data:l,firstItemIndex:s,sizeRanges:t,initialTopMostItemIndex:d,scrolledToInitialItem:f,topItemsIndexes:v,topItemCount:C,groupCounts:S,fixedItemHeight:o,defaultItemHeight:n,gap:u,...h,statefulTotalCount:a,listState:p,scrollToIndex:I,trackItemSizes:r,itemSize:i,groupIndices:c,...x,...E,...m,...y})),s(Be,Ae,Y,Ge,tt,Le,ct,rt,_e,mt,N)),gt="-webkit-sticky",pt="sticky",vt=lt((()=>{if("undefined"==typeof document)return pt;const e=document.createElement("div");return e.style.position=gt,e.style.position===gt?gt:pt}));function xt(t,o){const n=e.useRef(null),r=e.useCallback((e=>{if(null===e||!e.offsetParent)return;const r=e.getBoundingClientRect(),i=r.width;let l,s;if(o){const e=o.getBoundingClientRect(),t=r.top-e.top;l=e.height-Math.max(0,t),s=t+o.scrollTop}else l=window.innerHeight-Math.max(0,r.top),s=r.top+window.pageYOffset;n.current={offsetTop:s,visibleHeight:l,visibleWidth:i},t(n.current)}),[t,o]),{callbackRef:i,ref:l}=_(r),s=e.useCallback((()=>{r(l.current)}),[r,l]);return e.useEffect((()=>{if(o){o.addEventListener("scroll",s);const e=new ResizeObserver(s);return e.observe(o),()=>{o.removeEventListener("scroll",s),e.unobserve(o)}}return window.addEventListener("scroll",s),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}}),[s,o]),i}const It=e.createContext(void 0),Tt=e.createContext(void 0);function wt(e){return e}const Ct=M((([e,t])=>({...e,...t})),s(ht,M((()=>{const e=x((e=>`Item ${e}`)),t=x(null),o=x((e=>`Group ${e}`)),n=x({}),r=x(wt),i=x("div"),l=x(u),s=(e,t=null)=>T(w(n,H((t=>t[e])),S()),t);return{context:t,itemContent:e,groupContent:o,components:n,computeItemKey:r,headerFooterTag:i,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")}})))),St=({height:t})=>e.createElement("div",{style:{height:t}}),Et={position:vt(),zIndex:1,overflowAnchor:"none"},Ht={overflowAnchor:"none"},yt=e.memo((function({showTopList:t=!1}){const o=Gt("listState"),n=Dt("sizeRanges"),r=Gt("useWindowScroll"),i=Gt("customScrollParent"),l=Dt("windowScrollContainerState"),s=Dt("scrollContainerState"),c=i||r?l:s,a=Gt("itemContent"),d=Gt("context"),f=Gt("groupContent"),m=Gt("trackItemSizes"),h=Gt("itemSize"),g=Gt("log"),p=Dt("gap"),{callbackRef:v}=$(n,h,m,t?u:c,g,p,i),[x,I]=e.useState(0);Nt("deviation",(e=>{x!==e&&I(e)}));const T=Gt("EmptyPlaceholder"),w=Gt("ScrollSeekPlaceholder")||St,C=Gt("ListComponent"),S=Gt("ItemComponent"),E=Gt("GroupComponent"),H=Gt("computeItemKey"),y=Gt("isSeeking"),b=Gt("groupIndices").length>0,R=Gt("paddingTopAddition"),z=t?{}:{boxSizing:"border-box",paddingTop:o.offsetTop+R,paddingBottom:o.offsetBottom,marginTop:x};return!t&&0===o.totalCount&&T?e.createElement(T,Bt(T,d)):e.createElement(C,{...Bt(C,d),ref:v,style:z,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?o.topItems:o.items).map((t=>{const n=t.originalIndex,r=H(n+o.firstItemIndex,t.data,d);return y?e.createElement(w,{...Bt(w,d),key:r,index:t.index,height:t.size,type:t.type||"item",..."group"===t.type?{}:{groupIndex:t.groupIndex}}):"group"===t.type?e.createElement(E,{...Bt(E,d),key:r,"data-index":n,"data-known-size":t.size,"data-item-index":t.index,style:Et},f(t.index)):e.createElement(S,{...Bt(S,d),key:r,"data-index":n,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,item:t.data,style:Ht},b?a(t.index,t.groupIndex,t.data,d):a(t.index,t.data,d))})))})),bt={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Rt={width:"100%",height:"100%",position:"absolute",top:0},zt={width:"100%",position:vt(),top:0,zIndex:1};function Bt(e,t){if("string"!=typeof e)return{context:t}}const kt=e.memo((function(){const t=Gt("HeaderComponent"),o=Dt("headerHeight"),n=Gt("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=Gt("context");return t?e.createElement(n,{ref:r},e.createElement(t,Bt(t,i))):null})),Pt=e.memo((function(){const t=Gt("FooterComponent"),o=Dt("footerHeight"),n=Gt("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=Gt("context");return t?e.createElement(n,{ref:r},e.createElement(t,Bt(t,i))):null}));function Lt({usePublisher:t,useEmitter:o,useEmitterValue:n}){return e.memo((function({style:r,children:i,...l}){const s=t("scrollContainerState"),c=n("ScrollerComponent"),a=t("smoothScrollTargetReached"),u=n("scrollerRef"),d=n("context"),{scrollerRef:f,scrollByCallback:m,scrollToCallback:h}=q(s,a,c,u);return o("scrollTo",h),o("scrollBy",m),e.createElement(c,{ref:f,style:{...bt,...r},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...Bt(c,d)},i)}))}function Ot({usePublisher:t,useEmitter:o,useEmitterValue:n}){return e.memo((function({style:r,children:i,...l}){const s=t("windowScrollContainerState"),c=n("ScrollerComponent"),a=t("smoothScrollTargetReached"),d=n("totalListHeight"),f=n("deviation"),m=n("customScrollParent"),h=n("context"),{scrollerRef:g,scrollByCallback:p,scrollToCallback:v}=q(s,a,c,u,m);return A((()=>(g.current=m||window,()=>{g.current=null})),[g,m]),o("windowScrollTo",v),o("scrollBy",p),e.createElement(c,{style:{position:"relative",...r,...0!==d?{height:d+f}:{}},"data-virtuoso-scroller":!0,...l,...Bt(c,h)},i)}))}const Mt=({children:t})=>{const n=e.useContext(It),r=Dt("viewportHeight"),i=Dt("fixedItemHeight"),l=U(o(r,(e=>j(e,"height"))));return e.useEffect((()=>{n&&(r(n.viewportHeight),i(n.itemHeight))}),[n,r,i]),e.createElement("div",{style:Rt,ref:l,"data-viewport-type":"element"},t)},Wt=({children:t})=>{const o=e.useContext(It),n=Dt("windowViewportRect"),r=Dt("fixedItemHeight"),i=Gt("customScrollParent"),l=xt(n,i);return e.useEffect((()=>{o&&(r(o.itemHeight),n({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))}),[o,n,r]),e.createElement("div",{ref:l,style:Rt,"data-viewport-type":"window"},t)},Vt=({children:t})=>{const o=Gt("TopItemListComponent"),n=Gt("headerHeight"),r={...zt,marginTop:`${n}px`},i=Gt("context");return e.createElement(o||"div",{style:r,context:i},t)},Ft=e.memo((function(t){const o=Gt("useWindowScroll"),n=Gt("topItemsIndexes").length>0,r=Gt("customScrollParent"),i=r||o?Ut:_t,l=r||o?Wt:Mt;return e.createElement(i,{...t},n&&e.createElement(Vt,null,e.createElement(yt,{showTopList:!0})),e.createElement(l,null,e.createElement(kt,null),e.createElement(yt,null),e.createElement(Pt,null)))})),{Component:At,usePublisher:Dt,useEmitterValue:Gt,useEmitter:Nt}=F(Ct,{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"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ft),_t=Lt({usePublisher:Dt,useEmitterValue:Gt,useEmitter:Nt}),Ut=Ot({usePublisher:Dt,useEmitterValue:Gt,useEmitter:Nt}),$t=At,jt=At,Kt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},qt={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Yt,ceil:Zt,floor:Jt,min:Qt,max:Xt}=Math;function eo(e,t,o){return Array.from({length:t-e+1}).map(((t,n)=>({index:n+e,data:null==o?void 0:o[n+e]})))}function to(e,t){return e&&e.column===t.column&&e.row===t.row}const oo=M((([{overscan:e,visibleRange:t,listBoundary:o},{scrollTop:n,viewportHeight:r,scrollBy:i,scrollTo:l,smoothScrollTargetReached:s,scrollContainerState:c,footerHeight:a,headerHeight:u},d,f,{propsReady:m,didMount:h},{windowViewportRect:p,windowScrollTo:C,useWindowScroll:b,customScrollParent:R,windowScrollContainerState:z},B])=>{const P=x(0),M=x(0),W=x(Kt),V=x({height:0,width:0}),F=x({height:0,width:0}),A=v(),D=v(),G=x(0),N=x(void 0),_=x({row:0,column:0});g(w(O(h,M,N),E((([,e])=>0!==e)),H((([,e,t])=>({items:eo(0,e-1,t),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0})))),W),g(w(O(L(P),t,L(_,to),L(F,((e,t)=>e&&e.width===t.width&&e.height===t.height)),N),k(V),H((([[e,[t,o],n,r,i],l])=>{const{row:s,column:c}=n,{height:a,width:u}=r,{width:d}=l;if(0===e||0===d)return Kt;if(0===u)return function(e){return{...qt,items:e}}(eo(0,0,i));const f=io(d,u,c);let m=f*Jt((t+s)/(a+s)),h=f*Zt((o+s)/(a+s))-1;h=Qt(e-1,Xt(h,f-1)),m=Qt(h,Xt(0,m));const g=eo(m,h,i),{top:p,bottom:v}=no(l,n,r,g),x=Zt(e/f);return{items:g,offsetTop:p,offsetBottom:x*a+(x-1)*s-v,top:p,bottom:v,itemHeight:a,itemWidth:u}}))),W),g(w(N,E((e=>void 0!==e)),H((e=>e.length))),P),g(w(V,H((({height:e})=>e))),r),g(w(O(V,F,W,_),H((([e,t,{items:o},n])=>{const{top:r,bottom:i}=no(e,n,t,o);return[r,i]})),S(Ue)),o);const U=I(w(L(W),E((({items:e})=>e.length>0)),k(P),E((([{items:e},t])=>e[e.length-1].index===t-1)),H((([,e])=>e-1)),S())),$=I(w(L(W),E((({items:e})=>e.length>0&&0===e[0].index)),y(0),S())),j=I(w(L(W),E((({items:e})=>e.length>0)),H((({items:e})=>({startIndex:e[0].index,endIndex:e[e.length-1].index}))),S($e)));g(j,f.scrollSeekRangeChanged),g(w(A,k(V,F,P,_),H((([e,t,o,n,r])=>{const i=Pe(e),{align:l,behavior:s,offset:c}=i;let a=i.index;"LAST"===a&&(a=n-1),a=Xt(0,a,Qt(n-1,a));let u=ro(t,r,o,a);return"end"===l?u=Yt(u-t.height+o.height):"center"===l&&(u=Yt(u-t.height/2+o.height/2)),c&&(u+=c),{top:u,behavior:s}}))),l);const K=T(w(W,H((e=>e.offsetBottom+e.bottom))),0);return g(w(p,H((e=>({width:e.visibleWidth,height:e.visibleHeight})))),V),{data:N,totalCount:P,viewportDimensions:V,itemDimensions:F,scrollTop:n,scrollHeight:D,overscan:e,scrollBy:i,scrollTo:l,scrollToIndex:A,smoothScrollTargetReached:s,windowViewportRect:p,windowScrollTo:C,useWindowScroll:b,customScrollParent:R,windowScrollContainerState:z,deviation:G,scrollContainerState:c,footerHeight:a,headerHeight:u,initialItemCount:M,gap:_,...f,gridState:W,totalListHeight:K,...d,startReached:$,endReached:U,rangeChanged:j,propsReady:m,...B}}),s(Je,Y,Ve,nt,Fe,dt,N));function no(e,t,o,n){const{height:r}=o;if(void 0===r||0===n.length)return{top:0,bottom:0};return{top:ro(e,t,o,n[0].index),bottom:ro(e,t,o,n[n.length-1].index)+r}}function ro(e,t,o,n){const r=io(e.width,o.width,t.column),i=Jt(n/r),l=i*o.height+Xt(0,i-1)*t.row;return l>0?l+t.row:l}function io(e,t,o){return Xt(1,Jt((e+o)/(t+o)))}const lo=M((([e,t])=>({...e,...t})),s(oo,M((()=>{const e=x((e=>`Item ${e}`)),t=x({}),o=x(null),n=x("virtuoso-grid-item"),r=x("virtuoso-grid-list"),i=x(wt),l=x("div"),s=x(u),c=(e,o=null)=>T(w(t,H((t=>t[e])),S()),o);return{context:o,itemContent:e,components:t,computeItemKey:i,itemClassName:n,listClassName:r,headerFooterTag:l,scrollerRef:s,FooterComponent:c("Footer"),HeaderComponent:c("Header"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),ScrollerComponent:c("Scroller","div"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}})))),so=e.memo((function(){const t=po("gridState"),o=po("listClassName"),n=po("itemClassName"),r=po("itemContent"),i=po("computeItemKey"),l=po("isSeeking"),s=go("scrollHeight"),c=po("ItemComponent"),a=po("ListComponent"),u=po("ScrollSeekPlaceholder"),d=po("context"),f=go("itemDimensions"),m=go("gap"),h=po("log"),g=U((e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const o=e.firstChild;o&&f(o.getBoundingClientRect()),m({row:To("row-gap",getComputedStyle(e).rowGap,h),column:To("column-gap",getComputedStyle(e).columnGap,h)})}));return e.createElement(a,{ref:g,className:o,...Bt(a,d),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map((o=>{const s=i(o.index,o.data,d);return l?e.createElement(u,{key:s,...Bt(u,d),index:o.index,height:t.itemHeight,width:t.itemWidth}):e.createElement(c,{...Bt(c,d),className:n,"data-index":o.index,key:s},r(o.index,o.data,d))})))})),co=e.memo((function(){const t=po("HeaderComponent"),o=go("headerHeight"),n=po("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=po("context");return t?e.createElement(n,{ref:r},e.createElement(t,Bt(t,i))):null})),ao=e.memo((function(){const t=po("FooterComponent"),o=go("footerHeight"),n=po("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=po("context");return t?e.createElement(n,{ref:r},e.createElement(t,Bt(t,i))):null})),uo=({children:t})=>{const o=e.useContext(Tt),n=go("itemDimensions"),r=go("viewportDimensions"),i=U((e=>{r(e.getBoundingClientRect())}));return e.useEffect((()=>{o&&(r({height:o.viewportHeight,width:o.viewportWidth}),n({height:o.itemHeight,width:o.itemWidth}))}),[o,r,n]),e.createElement("div",{style:Rt,ref:i},t)},fo=({children:t})=>{const o=e.useContext(Tt),n=go("windowViewportRect"),r=go("itemDimensions"),i=po("customScrollParent"),l=xt(n,i);return e.useEffect((()=>{o&&(r({height:o.itemHeight,width:o.itemWidth}),n({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:o.viewportWidth}))}),[o,n,r]),e.createElement("div",{ref:l,style:Rt},t)},mo=e.memo((function({...t}){const o=po("useWindowScroll"),n=po("customScrollParent"),r=n||o?Io:xo,i=n||o?fo:uo;return e.createElement(r,{...t},e.createElement(i,null,e.createElement(co,null),e.createElement(so,null),e.createElement(ao,null)))})),{Component:ho,usePublisher:go,useEmitterValue:po,useEmitter:vo}=F(lo,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},mo),xo=Lt({usePublisher:go,useEmitterValue:po,useEmitter:vo}),Io=Ot({usePublisher:go,useEmitterValue:po,useEmitter:vo});function To(e,t,o){return"normal"===t||(null==t?void 0:t.endsWith("px"))||o(`${e} was not resolved to pixel value correctly`,t,D.WARN),"normal"===t?0:parseInt(t??"0",10)}const wo=ho,Co=M((([e,t])=>({...e,...t})),s(ht,M((()=>{const t=x((t=>e.createElement("td",null,"Item $",t))),o=x(null),n=x(null),r=x(null),i=x({}),l=x(wt),s=x(u),c=(e,t=null)=>T(w(i,H((t=>t[e])),S()),t);return{context:o,itemContent:t,fixedHeaderContent:n,fixedFooterContent:r,components:i,computeItemKey:l,scrollerRef:s,TableComponent:c("Table","table"),TableHeadComponent:c("TableHead","thead"),TableFooterComponent:c("TableFoot","tfoot"),TableBodyComponent:c("TableBody","tbody"),TableRowComponent:c("TableRow","tr"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),FillerRow:c("FillerRow")}})))),So=({height:t})=>e.createElement("tr",null,e.createElement("td",{style:{height:t}})),Eo=({height:t})=>e.createElement("tr",null,e.createElement("td",{style:{height:t,padding:0,border:0}})),Ho=e.memo((function(){const t=ko("listState"),o=Bo("sizeRanges"),n=ko("useWindowScroll"),r=ko("customScrollParent"),i=Bo("windowScrollContainerState"),l=Bo("scrollContainerState"),s=r||n?i:l,c=ko("itemContent"),a=ko("trackItemSizes"),u=ko("itemSize"),d=ko("log"),{callbackRef:f,ref:m}=$(o,u,a,s,d,void 0,r),[h,g]=e.useState(0);Po("deviation",(e=>{h!==e&&(m.current.style.marginTop=`${e}px`,g(e))}));const p=ko("EmptyPlaceholder"),v=ko("ScrollSeekPlaceholder")||So,x=ko("FillerRow")||Eo,I=ko("TableBodyComponent"),T=ko("TableRowComponent"),w=ko("computeItemKey"),C=ko("isSeeking"),S=ko("paddingTopAddition"),E=ko("firstItemIndex"),H=ko("statefulTotalCount"),y=ko("context");if(0===H&&p)return e.createElement(p,Bt(p,y));const b=t.offsetTop+S+h,R=t.offsetBottom,z=b>0?e.createElement(x,{height:b,key:"padding-top",context:y}):null,B=R>0?e.createElement(x,{height:R,key:"padding-bottom",context:y}):null,k=t.items.map((t=>{const o=t.originalIndex,n=w(o+E,t.data,y);return C?e.createElement(v,{...Bt(v,y),key:n,index:t.index,height:t.size,type:t.type||"item"}):e.createElement(T,{...Bt(T,y),key:n,"data-index":o,"data-known-size":t.size,"data-item-index":t.index,item:t.data,style:{overflowAnchor:"none"}},c(t.index,t.data,y))}));return e.createElement(I,{ref:f,"data-test-id":"virtuoso-item-list",...Bt(I,y)},[z,...k,B])})),yo=({children:t})=>{const n=e.useContext(It),r=Bo("viewportHeight"),i=Bo("fixedItemHeight"),l=U(o(r,(e=>j(e,"height"))));return e.useEffect((()=>{n&&(r(n.viewportHeight),i(n.itemHeight))}),[n,r,i]),e.createElement("div",{style:Rt,ref:l,"data-viewport-type":"element"},t)},bo=({children:t})=>{const o=e.useContext(It),n=Bo("windowViewportRect"),r=Bo("fixedItemHeight"),i=ko("customScrollParent"),l=xt(n,i);return e.useEffect((()=>{o&&(r(o.itemHeight),n({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))}),[o,n,r]),e.createElement("div",{ref:l,style:Rt,"data-viewport-type":"window"},t)},Ro=e.memo((function(t){const n=ko("useWindowScroll"),r=ko("customScrollParent"),i=Bo("fixedHeaderHeight"),l=Bo("fixedFooterHeight"),s=ko("fixedHeaderContent"),c=ko("fixedFooterContent"),a=ko("context"),u=U(o(i,(e=>j(e,"height")))),d=U(o(l,(e=>j(e,"height")))),f=r||n?Oo:Lo,m=r||n?bo:yo,h=ko("TableComponent"),g=ko("TableHeadComponent"),p=ko("TableFooterComponent"),v=s?e.createElement(g,{key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:u,...Bt(g,a)},s()):null,x=c?e.createElement(p,{key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:d,...Bt(p,a)},c()):null;return e.createElement(f,{...t},e.createElement(m,null,e.createElement(h,{style:{borderSpacing:0},...Bt(h,a)},[v,e.createElement(Ho,{key:"TableBody"}),x])))})),{Component:zo,usePublisher:Bo,useEmitterValue:ko,useEmitter:Po}=F(Co,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",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"},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"}},Ro),Lo=Lt({usePublisher:Bo,useEmitterValue:ko,useEmitter:Po}),Oo=Ot({usePublisher:Bo,useEmitterValue:ko,useEmitter:Po}),Mo=zo;exports.GroupedVirtuoso=jt,exports.LogLevel=D,exports.TableVirtuoso=Mo,exports.Virtuoso=$t,exports.VirtuosoGrid=wo,exports.VirtuosoGridMockContext=Tt,exports.VirtuosoMockContext=It;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("react-dom");function o(e,t){return o=>e(t(o))}function n(e,t){return t(e)}function r(e,t){return o=>e(t,o)}function i(e,t){return()=>e(t)}function l(e,t){return t(e),e}function s(...e){return e}function c(e){e()}function a(e){return()=>e}function u(){}function d(e,t){return e(1,t)}function f(e,t){e(0,t)}function m(e){e(2)}function h(e){return e(4)}function g(e,t){return d(e,r(t,0))}function p(e,t){const o=e(1,(e=>{o(),t(e)}));return o}function v(){const e=[];return(t,o)=>{switch(t){case 2:return void e.splice(0,e.length);case 1:return e.push(o),()=>{const t=e.indexOf(o);t>-1&&e.splice(t,1)};case 0:return void e.slice().forEach((e=>{e(o)}));default:throw new Error(`unrecognized action ${t}`)}}}function x(e){let t=e;const o=v();return(e,n)=>{switch(e){case 1:n(t);break;case 0:t=n;break;case 4:return t}return o(e,n)}}function I(e){return l(v(),(t=>g(e,t)))}function T(e,t){return l(x(t),(t=>g(e,t)))}function w(e,...t){const o=function(...e){return t=>e.reduceRight(n,t)}(...t);return(t,n)=>{switch(t){case 1:return d(e,o(n));case 2:return void m(e)}}}function C(e,t){return e===t}function S(e=C){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function E(e){return t=>o=>{e(o)&&t(o)}}function H(e){return t=>o(t,e)}function y(e){return t=>()=>t(e)}function b(e,t){return o=>n=>o(t=e(t,n))}function z(e){return t=>o=>{e>0?e--:t(o)}}function R(e){let t,o;return n=>r=>{t=r,o||(o=setTimeout((()=>{o=void 0,n(t)}),e))}}function B(e){let t,o;return n=>r=>{t=r,o&&clearTimeout(o),o=setTimeout((()=>{n(t)}),e)}}function k(...e){const t=new Array(e.length);let o=0,n=null;const r=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const l=Math.pow(2,i);d(e,(e=>{const s=o;o|=l,t[i]=e,s!==r&&o===r&&n&&(n(),n=null)}))})),e=>i=>{const l=()=>e([i].concat(t));o===r?l():n=l}}function P(...e){return function(t,o){switch(t){case 1:return function(...e){return()=>{e.map(c)}}(...e.map((e=>d(e,o))));case 2:return;default:throw new Error(`unrecognized action ${t}`)}}}function L(e,t=C){return w(e,S(t))}function O(...e){const t=v(),o=new Array(e.length);let n=0;const r=Math.pow(2,e.length)-1;return e.forEach(((e,i)=>{const l=Math.pow(2,i);d(e,(e=>{o[i]=e,n|=l,n===r&&f(t,o)}))})),function(e,i){switch(e){case 1:return n===r&&i(o),d(t,i);case 2:return m(t);default:throw new Error(`unrecognized action ${e}`)}}}function M(e,t=[],{singleton:o}={singleton:!0}){return{id:W(),constructor:e,dependencies:t,singleton:o}}const W=()=>Symbol();const F="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;function V(t,o,n){const s=Object.keys(o.required||{}),c=Object.keys(o.optional||{}),g=Object.keys(o.methods||{}),p=Object.keys(o.events||{}),v=e.createContext({});function x(e,t){e.propsReady&&f(e.propsReady,!1);for(const n of s){f(e[o.required[n]],t[n])}for(const n of c)if(n in t){f(e[o.optional[n]],t[n])}e.propsReady&&f(e.propsReady,!0)}function I(e){return p.reduce(((t,n)=>(t[n]=function(e){let t,o;const n=()=>t&&t();return function(r,i){switch(r){case 1:if(i){if(o===i)return;return n(),o=i,t=d(e,i),t}return n(),u;case 2:return n(),void(o=null);default:throw new Error(`unrecognized action ${r}`)}}}(e[o.events[n]]),t)),{})}const T=e.forwardRef(((r,u)=>{const{children:h,...T}=r,[w]=e.useState((()=>l(function(e){const t=new Map,o=({id:e,constructor:n,dependencies:r,singleton:i})=>{if(i&&t.has(e))return t.get(e);const l=n(r.map((e=>o(e))));return i&&t.set(e,l),l};return o(e)}(t),(e=>x(e,T))))),[C]=e.useState(i(I,w));return F((()=>{for(const e of p)e in T&&d(C[e],T[e]);return()=>{Object.values(C).map(m)}}),[T,C,w]),F((()=>{x(w,T)})),e.useImperativeHandle(u,a(function(e){return g.reduce(((t,n)=>(t[n]=t=>{f(e[o.methods[n]],t)},t)),{})}(w))),e.createElement(v.Provider,{value:w},n?e.createElement(n,function(e,t){const o={},n={};let r=0;const i=e.length;for(;r<i;)n[e[r]]=1,r+=1;for(const l in t)n.hasOwnProperty(l)||(o[l]=t[l]);return o}([...s,...c,...p],T),h):h)}));return{Component:T,usePublisher:t=>e.useCallback(r(f,e.useContext(v)[t]),[t]),useEmitterValue:t=>{const o=e.useContext(v)[t],[n,r]=e.useState(i(h,o));return F((()=>d(o,(e=>{e!==n&&r(a(e))}))),[o,n]),n},useEmitter:(t,o)=>{const n=e.useContext(v)[t];F((()=>d(n,o)),[o,n])}}}const A="undefined"!=typeof document?e.useLayoutEffect:e.useEffect;var D=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(D||{});const G={0:"debug",1:"log",2:"warn",3:"error"},N=M((()=>{const e=x(3);return{log:x(((t,o,n=1)=>{n>=(("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL??h(e))&&console[G[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)})),logLevel:e}}),[],{singleton:!0});function _(t,o=!0){const n=e.useRef(null);let r=e=>{};if("undefined"!=typeof ResizeObserver){const i=e.useMemo((()=>new ResizeObserver((e=>{const o=e[0].target;null!==o.offsetParent&&t(o)}))),[t]);r=e=>{e&&o?(i.observe(e),n.current=e):(n.current&&i.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function U(e,t=!0){return _(e,t).callbackRef}function $(t,o,n,r,i,l,s){const c=e.useCallback((e=>{const n=function(e,t,o,n){const r=e.length;if(0===r)return null;const i=[];for(let l=0;l<r;l++){const r=e.item(l);if(!r||void 0===r.dataset.index)continue;const s=parseInt(r.dataset.index),c=parseFloat(r.dataset.knownSize),a=t(r,o);if(0===a&&n("Zero-sized element, this should not happen",{child:r},D.ERROR),a===c)continue;const u=i[i.length-1];0===i.length||u.size!==a||u.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:a}):i[i.length-1].endIndex++}return i}(e.children,o,"offsetHeight",i);let c=e.parentElement;for(;!c.dataset.virtuosoScroller;)c=c.parentElement;const a="window"===c.lastElementChild.dataset.viewportType,u=s?s.scrollTop:a?window.pageYOffset||document.documentElement.scrollTop:c.scrollTop,d=s?s.scrollHeight:a?document.documentElement.scrollHeight:c.scrollHeight,f=s?s.offsetHeight:a?window.innerHeight:c.offsetHeight;r({scrollTop:Math.max(u,0),scrollHeight:d,viewportHeight:f}),null==l||l(function(e,t,o){"normal"===t||(null==t?void 0:t.endsWith("px"))||o(`${e} was not resolved to pixel value correctly`,t,D.WARN);if("normal"===t)return 0;return parseInt(t??"0",10)}("row-gap",getComputedStyle(e).rowGap,i)),null!==n&&t(n)}),[t,o,i,l,s,r]);return _(c,n)}function j(e,t){return Math.round(e.getBoundingClientRect()[t])}function K(e,t){return Math.abs(e-t)<1.01}function q(o,n,r,i=u,l){const s=e.useRef(null),c=e.useRef(null),a=e.useRef(null),d=e.useCallback((e=>{const r=e.target,i=r===window||r===document,l=i?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,s=i?document.documentElement.scrollHeight:r.scrollHeight,u=i?window.innerHeight:r.offsetHeight,d=()=>{o({scrollTop:Math.max(l,0),scrollHeight:s,viewportHeight:u})};e.suppressFlushSync?d():t.flushSync(d),null!==c.current&&(l===c.current||l<=0||l===s-u)&&(c.current=null,n(!0),a.current&&(clearTimeout(a.current),a.current=null))}),[o,n]);return e.useEffect((()=>{const e=l||s.current;return i(l||s.current),d({target:e,suppressFlushSync:!0}),e.addEventListener("scroll",d,{passive:!0}),()=>{i(null),e.removeEventListener("scroll",d)}}),[s,d,r,i,l]),{scrollerRef:s,scrollByCallback:function(e){s.current.scrollBy(e)},scrollToCallback:function(e){const t=s.current;if(!t||"offsetHeight"in t&&0===t.offsetHeight)return;const r="smooth"===e.behavior;let i,l,u;t===window?(l=Math.max(j(document.documentElement,"height"),document.documentElement.scrollHeight),i=window.innerHeight,u=document.documentElement.scrollTop):(l=t.scrollHeight,i=j(t,"height"),u=t.scrollTop);const d=l-i;if(e.top=Math.ceil(Math.max(Math.min(d,e.top),0)),K(i,l)||e.top===u)return o({scrollTop:u,scrollHeight:l,viewportHeight:i}),void(r&&n(!0));r?(c.current=e.top,a.current&&clearTimeout(a.current),a.current=setTimeout((()=>{a.current=null,c.current=null,n(!0)}),1e3)):c.current=null,t.scrollTo(e)}}}const Y=M((()=>{const e=v(),t=v(),o=x(0),n=v(),r=x(0),i=v(),l=v(),s=x(0),c=x(0),a=x(0),u=x(0),d=v(),f=v(),m=x(!1);return g(w(e,H((({scrollTop:e})=>e))),t),g(w(e,H((({scrollHeight:e})=>e))),l),g(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:i,headerHeight:s,fixedHeaderHeight:c,fixedFooterHeight:a,footerHeight:u,scrollHeight:l,smoothScrollTargetReached:n,scrollTo:d,scrollBy:f,statefulScrollTop:r,deviation:o,scrollingInProgress:m}}),[],{singleton:!0}),Z={lvl:0};function J(e,t,o,n=Z,r=Z){return{k:e,v:t,lvl:o,l:n,r:r}}function Q(e){return e===Z}function X(){return Z}function ee(e,t){if(Q(e))return Z;const{k:o,l:n,r:r}=e;if(t===o){if(Q(n))return r;if(Q(r))return n;{const[t,o]=le(n);return de(ce(e,{k:t,v:o,l:se(n)}))}}return de(ce(e,t<o?{l:ee(n,t)}:{r:ee(r,t)}))}function te(e,t){if(!Q(e))return t===e.k?e.v:t<e.k?te(e.l,t):te(e.r,t)}function oe(e,t,o="k"){if(Q(e))return[-1/0,void 0];if(e[o]===t)return[e.k,e.v];if(e[o]<t){const n=oe(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return oe(e.l,t,o)}function ne(e,t,o){return Q(e)?J(t,o,1):t===e.k?ce(e,{k:t,v:o}):t<e.k?ue(ce(e,{l:ne(e.l,t,o)})):ue(ce(e,{r:ne(e.r,t,o)}))}function re(e,t,o){if(Q(e))return[];const{k:n,v:r,l:i,r:l}=e;let s=[];return n>t&&(s=s.concat(re(i,t,o))),n>=t&&n<=o&&s.push({k:n,v:r}),n<=o&&(s=s.concat(re(l,t,o))),s}function ie(e){return Q(e)?[]:[...ie(e.l),{k:e.k,v:e.v},...ie(e.r)]}function le(e){return Q(e.r)?[e.k,e.v]:le(e.r)}function se(e){return Q(e.r)?e.l:de(ce(e,{r:se(e.r)}))}function ce(e,t){return J(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 ae(e){return Q(e)||e.lvl>e.r.lvl}function ue(e){return he(ge(e))}function de(e){const{l:t,r:o,lvl:n}=e;if(o.lvl>=n-1&&t.lvl>=n-1)return e;if(n>o.lvl+1){if(ae(t))return ge(ce(e,{lvl:n-1}));if(Q(t)||Q(t.r))throw new Error("Unexpected empty nodes");return ce(t.r,{l:ce(t,{r:t.r.l}),r:ce(e,{l:t.r.r,lvl:n-1}),lvl:n})}if(ae(e))return he(ce(e,{lvl:n-1}));if(Q(o)||Q(o.l))throw new Error("Unexpected empty nodes");{const t=o.l,r=ae(t)?o.lvl-1:o.lvl;return ce(t,{l:ce(e,{r:t.l,lvl:n-1}),r:he(ce(o,{l:t.r,lvl:r})),lvl:t.lvl+1})}}function fe(e,t,o){if(Q(e))return[];const n=oe(e,t)[0];return me(re(e,n,o),(({k:e,v:t})=>({index:e,value:t})))}function me(e,t){const o=e.length;if(0===o)return[];let{index:n,value:r}=t(e[0]);const i=[];for(let l=1;l<o;l++){const{index:o,value:s}=t(e[l]);i.push({start:n,end:o-1,value:r}),n=o,r=s}return i.push({start:n,end:1/0,value:r}),i}function he(e){const{r:t,lvl:o}=e;return Q(t)||Q(t.r)||t.lvl!==o||t.r.lvl!==o?e:ce(t,{l:ce(e,{r:t.l}),lvl:o+1})}function ge(e){const{l:t}=e;return Q(t)||t.lvl!==e.lvl?e:ce(t,{r:ce(e,{l:t.r})})}function pe(e,t,o,n=0){let r=e.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),l=o(e[i],t);if(0===l)return i;if(-1===l){if(r-n<2)return i-1;r=i-1}else{if(r===n)return i;n=i+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function ve(e,t,o){return e[pe(e,t,o)]}const xe=M((()=>({recalcInProgress:x(!1)})),[],{singleton:!0});function Ie(e){const{size:t,startIndex:o,endIndex:n}=e;return e=>e.start===o&&(e.end===n||e.end===1/0)&&e.value===t}function Te(e,t){let o=0,n=0;for(;o<e;)o+=t[n+1]-t[n]-1,n++;return n-(o===e?0:1)}function we({index:e},t){return t===e?0:t<e?-1:1}function Ce({offset:e},t){return t===e?0:t<e?-1:1}function Se(e){return{index:e.index,value:e}}function Ee(e,t,o,n=0){return n>0&&(t=Math.max(t,ve(e,n,we).offset)),me(function(e,t,o,n){const r=pe(e,t,n),i=pe(e,o,n,r);return e.slice(r,i+1)}(e,t,o,Ce),Se)}function He(e,t,o,n){let r=e,i=0,l=0,s=0,c=0;if(0!==t){c=pe(r,t-1,we);s=r[c].offset;const e=oe(o,t-1);i=e[0],l=e[1],r.length&&r[c].size===oe(o,t)[1]&&(c-=1),r=r.slice(0,c+1)}else r=[];for(const{start:a,value:u}of fe(o,t,1/0)){const e=a-i,t=e*l+s+e*n;r.push({offset:t,size:u,index:a}),i=a,s=t,l=u}return{offsetTree:r,lastIndex:i,lastOffset:s,lastSize:l}}function ye(e,[t,o,n,r]){t.length>0&&n("received item sizes",t,D.DEBUG);const i=e.sizeTree;let l=i,s=0;if(o.length>0&&Q(i)&&2===t.length){const e=t[0].size,n=t[1].size;l=o.reduce(((t,o)=>ne(ne(t,o,e),o+1,n)),l)}else[l,s]=function(e,t){let o=Q(e)?0:1/0;for(const n of t){const{size:t,startIndex:r,endIndex:i}=n;if(o=Math.min(o,r),Q(e)){e=ne(e,0,t);continue}const l=fe(e,r-1,i+1);if(l.some(Ie(n)))continue;let s=!1,c=!1;for(const{start:o,end:n,value:a}of l)s?(i>=o||t===a)&&(e=ee(e,o)):(c=a!==t,s=!0),n>i&&i>=o&&a!==t&&(e=ne(e,i+1,a));c&&(e=ne(e,r,t))}return[e,o]}(l,t);if(l===i)return e;const{offsetTree:c,lastIndex:a,lastSize:u,lastOffset:d}=He(e.offsetTree,s,l,r);return{sizeTree:l,offsetTree:c,lastIndex:a,lastOffset:d,lastSize:u,groupOffsetTree:o.reduce(((e,t)=>ne(e,t,be(t,c,r))),X()),groupIndices:o}}function be(e,t,o){if(0===t.length)return 0;const{offset:n,index:r,size:i}=ve(t,e,we),l=e-r,s=i*l+(l-1)*o+n;return s>0?s+o:s}function ze(e,t,o){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;{let n=Re("LAST"===e.index?o:e.index,t);return n=Math.max(0,n,Math.min(o,n)),n}}function Re(e,t){if(!Be(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function Be(e){return!Q(e.groupOffsetTree)}const ke={offsetHeight:"height",offsetWidth:"width"},Pe=M((([{log:e},{recalcInProgress:t}])=>{const o=v(),n=v(),r=T(n,0),i=v(),l=v(),s=x(0),c=x([]),a=x(void 0),u=x(void 0),m=x(((e,t)=>j(e,ke[t]))),p=x(void 0),C=x(0),y={offsetTree:[],sizeTree:X(),groupOffsetTree:X(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},z=T(w(o,k(c,e,C),b(ye,y),S()),y),R=T(w(c,S(),b(((e,t)=>({prev:e.current,current:t})),{prev:[],current:[]}),H((({prev:e})=>e))),[]);g(w(c,E((e=>e.length>0)),k(z,C),H((([e,t,o])=>{const n=e.reduce(((e,n,r)=>ne(e,n,be(n,t.offsetTree,o)||r)),X());return{...t,groupIndices:e,groupOffsetTree:n}}))),z),g(w(n,k(z),E((([e,{lastIndex:t,groupIndices:o}])=>e<t&&0===o.length)),H((([e,{lastIndex:t,lastSize:o}])=>[{startIndex:e,endIndex:t,size:o}]))),o),g(a,u);const B=T(w(a,H((e=>void 0===e))),!0);g(w(u,E((e=>void 0!==e&&Q(h(z).sizeTree))),H((e=>[{startIndex:0,endIndex:0,size:e}]))),o);const P=I(w(o,k(z),b((({sizes:e},[t,o])=>({changed:o!==e,sizes:o})),{changed:!1,sizes:y}),H((e=>e.changed))));d(w(s,b(((e,t)=>({diff:e.prev-t,prev:t})),{diff:0,prev:0}),H((e=>e.diff))),(e=>{const{groupIndices:o}=h(z);if(e>0)f(t,!0),f(i,e+Te(e,o));else if(e<0){const t=h(R);t.length>0&&f(l,e-Te(-e,t))}})),d(w(s,k(e)),(([e,t])=>{e<0&&t("`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:s},D.ERROR)}));const L=I(i);g(w(i,k(z),H((([e,t])=>{const o=t.groupIndices.length>0,n=[],r=t.lastSize;if(o){const o=te(t.sizeTree,0);let i=0,l=0;for(;i<e;){const e=t.groupIndices[l],s=t.groupIndices[l+1]-e-1;n.push({startIndex:e,endIndex:e,size:o}),n.push({startIndex:e+1,endIndex:e+1+s-1,size:r}),l++,i+=s+1}const s=ie(t.sizeTree);return i!==e&&s.shift(),s.reduce(((t,{k:o,v:n})=>{let r=t.ranges;return 0!==t.prevSize&&(r=[...t.ranges,{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}]),{ranges:r,prevIndex:o+e,prevSize:n}}),{ranges:n,prevIndex:e,prevSize:0}).ranges}return ie(t.sizeTree).reduce(((t,{k:o,v:n})=>({ranges:[...t.ranges,{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}],prevIndex:o+e,prevSize:n})),{ranges:[],prevIndex:0,prevSize:r}).ranges}))),o);const O=I(w(l,k(z,C),H((([e,{offsetTree:t},o])=>be(-e,t,o)))));return g(w(l,k(z,C),H((([e,t,o])=>{if(t.groupIndices.length>0){let n=X();const r=h(R);let i=0,l=0,s=0;for(;i<-e;){s=r[l];const e=r[l+1]-s-1;l++,i+=e+1}n=ie(t.sizeTree).reduce(((t,{k:o,v:n})=>ne(t,Math.max(0,o+e),n)),n);if(i!==-e){n=ne(n,0,te(t.sizeTree,s));n=ne(n,1,oe(t.sizeTree,1-e)[1])}return{...t,sizeTree:n,...He(t.offsetTree,0,n,o)}}{const n=ie(t.sizeTree).reduce(((t,{k:o,v:n})=>ne(t,Math.max(0,o+e),n)),X());return{...t,sizeTree:n,...He(t.offsetTree,0,n,o)}}}))),z),{data:p,totalCount:n,sizeRanges:o,groupIndices:c,defaultItemSize:u,fixedItemSize:a,unshiftWith:i,shiftWith:l,shiftWithOffset:O,beforeUnshiftWith:L,firstItemIndex:s,gap:C,sizes:z,listRefresh:P,statefulTotalCount:r,trackItemSizes:B,itemSize:m}}),s(N,xe),{singleton:!0}),Le="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function Oe(e){const t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&Le||(t.behavior="auto"),t.offset||(t.offset=0),t}const Me=M((([{sizes:e,totalCount:t,listRefresh:o,gap:n},{scrollingInProgress:r,viewportHeight:i,scrollTo:l,smoothScrollTargetReached:s,headerHeight:c,footerHeight:a,fixedHeaderHeight:u,fixedFooterHeight:m},{log:h}])=>{const I=v(),T=x(0);let C=null,S=null,E=null;function y(){C&&(C(),C=null),E&&(E(),E=null),S&&(clearTimeout(S),S=null),f(r,!1)}return g(w(I,k(e,i,t,T,c,a,h),k(n,u,m),H((([[e,t,n,i,l,c,a,u],m,h,g])=>{const v=Oe(e),{align:x,behavior:T,offset:H}=v,b=i-1,z=ze(v,t,b);let R=be(z,t.offsetTree,m)+c;"end"===x?(R+=h+oe(t.sizeTree,z)[1]-n+g,z===b&&(R+=a)):"center"===x?R+=(h+oe(t.sizeTree,z)[1]-n+g)/2:R-=l,H&&(R+=H);const B=t=>{y(),t?(u("retrying to scroll to",{location:e},D.DEBUG),f(I,e)):u("list did not change, scroll successful",{},D.DEBUG)};if(y(),"smooth"===T){let e=!1;E=d(o,(t=>{e=e||t})),C=p(s,(()=>{B(e)}))}else C=p(w(o,(k=150,e=>{const t=setTimeout((()=>{e(!1)}),k);return o=>{o&&(e(!0),clearTimeout(t))}})),B);var k;return S=setTimeout((()=>{y()}),1200),f(r,!0),u("scrolling from index to",{index:z,top:R,behavior:T},D.DEBUG),{top:R,behavior:T}}))),l),{scrollToIndex:I,topListHeight:T}}),s(Pe,Y,N),{singleton:!0});const We="up",Fe="down",Ve={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Ae=M((([{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:n,footerHeight:r,scrollBy:i}])=>{const l=x(!1),s=x(!0),c=v(),a=v(),u=x(4),d=x(0),f=T(w(P(w(L(t),z(1),y(!0)),w(L(t),z(1),y(!1),B(100))),S()),!1),m=T(w(P(w(i,y(!0)),w(i,y(!1),B(200))),S()),!1);g(w(O(L(t),L(d)),H((([e,t])=>e<=t)),S()),s),g(w(s,R(50)),a);const p=I(w(O(e,L(o),L(n),L(r),L(u)),b(((e,[{scrollTop:t,scrollHeight:o},n,r,i,l])=>{const s={viewportHeight:n,scrollTop:t,scrollHeight:o};if(t+n-o>-l){let o,n;return t>e.state.scrollTop?(o="SCROLLED_DOWN",n=e.state.scrollTop-t):(o="SIZE_DECREASED",n=e.state.scrollTop-t||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:o,scrollTopDelta:n}}let c;return c=s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":n<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":t<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:c,state:s}}),Ve),S(((e,t)=>e&&e.atBottom===t.atBottom)))),C=T(w(e,b(((e,{scrollTop:t,scrollHeight:o,viewportHeight:n})=>{if(K(e.scrollHeight,o))return{scrollTop:t,scrollHeight:o,jump:0,changed:!1};{const r=o-(t+n)<1;return e.scrollTop!==t&&r?{scrollHeight:o,scrollTop:t,jump:e.scrollTop-t,changed:!0}:{scrollHeight:o,scrollTop:t,jump:0,changed:!0}}}),{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),E((e=>e.changed)),H((e=>e.jump))),0);g(w(p,H((e=>e.atBottom))),l),g(w(l,R(50)),c);const M=x(Fe);g(w(e,H((({scrollTop:e})=>e)),S(),b(((e,t)=>h(m)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?We:Fe,prevScrollTop:t}),{direction:Fe,prevScrollTop:0}),H((e=>e.direction))),M),g(w(e,R(50),y("none")),M);const W=x(0);return g(w(f,E((e=>!e)),y(0)),W),g(w(t,R(100),k(f),E((([e,t])=>!!t)),b((([e,t],[o])=>[t,o]),[0,0]),H((([e,t])=>t-e))),W),{isScrolling:f,isAtTop:s,isAtBottom:l,atBottomState:p,atTopStateChange:a,atBottomStateChange:c,scrollDirection:M,atBottomThreshold:u,atTopThreshold:d,scrollVelocity:W,lastJumpDueToItemResize:C}}),s(Y)),De=M((([{log:e}])=>{const t=x(!1),o=I(w(t,E((e=>e)),S()));return d(t,(t=>{t&&h(e)("props updated",{},D.DEBUG)})),{propsReady:t,didMount:o}}),s(N),{singleton:!0});const Ge=M((([{sizes:e,listRefresh:t,defaultItemSize:o},{scrollTop:n},{scrollToIndex:r},{didMount:i}])=>{const l=x(!0),s=x(0);return g(w(i,k(s),E((([e,t])=>!!t)),y(!1)),l),d(w(O(t,i),k(l,e,o),E((([[,e],t,{sizeTree:o},n])=>e&&(!Q(o)||void 0!==n)&&!t)),k(s)),(([,e])=>{setTimeout((()=>{p(n,(()=>{f(l,!0)})),f(r,e)}))})),{scrolledToInitialItem:l,initialTopMostItemIndex:s}}),s(Pe,Y,Me,De),{singleton:!0});function Ne(e){return!!e&&("smooth"===e?"smooth":"auto")}const _e=M((([{totalCount:e,listRefresh:t},{isAtBottom:o,atBottomState:n},{scrollToIndex:r},{scrolledToInitialItem:i},{propsReady:l,didMount:s},{log:c},{scrollingInProgress:a}])=>{const u=x(!1),m=v();let g=null;function I(e){f(r,{index:"LAST",align:"end",behavior:e})}function T(e){const t=p(n,(t=>{!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||g||(h(c)("scrolling to bottom due to increased size",{},D.DEBUG),I("auto"))}));setTimeout(t,100)}return d(w(O(w(L(e),z(1)),s),k(L(u),o,i,a),H((([[e,t],o,n,r,i])=>{let l=t&&r,s="auto";return l&&(s=((e,t)=>"function"==typeof e?Ne(e(t)):t&&Ne(e))(o,n||i),l=l&&!!s),{totalCount:e,shouldFollow:l,followOutputBehavior:s}})),E((({shouldFollow:e})=>e))),(({totalCount:e,followOutputBehavior:o})=>{g&&(g(),g=null),g=p(t,(()=>{h(c)("following output to ",{totalCount:e},D.DEBUG),I(o),g=null}))})),d(w(O(L(u),e,l),E((([e,,t])=>e&&t)),b((({value:e},[,t])=>({refreshed:e===t,value:t})),{refreshed:!1,value:0}),E((({refreshed:e})=>e)),k(u,e)),(([,e])=>{T(!1!==e)})),d(m,(()=>{T(!1!==h(u))})),d(O(L(u),n),(([e,t])=>{e&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&I("auto")})),{followOutput:u,autoscrollToBottom:m}}),s(Pe,Ae,Me,Ge,De,N,Y));function Ue(e){return e.reduce(((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e)),{totalCount:0,groupIndices:[]})}const $e=M((([{totalCount:e,groupIndices:t,sizes:o},{scrollTop:n,headerHeight:r}])=>{const i=v(),l=v(),s=I(w(i,H(Ue)));return g(w(s,H((e=>e.totalCount))),e),g(w(s,H((e=>e.groupIndices))),t),g(w(O(n,o,r),E((([e,t])=>Be(t))),H((([e,t,o])=>oe(t.groupOffsetTree,Math.max(e-o,0),"v")[0])),S(),H((e=>[e]))),l),{groupCounts:i,topItemsIndexes:l}}),s(Pe,Y));function je(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function Ke(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}const qe="top",Ye="bottom",Ze="none";function Je(e,t,o){return"number"==typeof e?o===We&&t===qe||o===Fe&&t===Ye?e:0:o===We?t===qe?e.main:e.reverse:t===Ye?e.main:e.reverse}function Qe(e,t){return"number"==typeof e?e:e[t]||0}const Xe=M((([{scrollTop:e,viewportHeight:t,deviation:o,headerHeight:n,fixedHeaderHeight:r}])=>{const i=v(),l=x(0),s=x(0),c=x(0);return{listBoundary:i,overscan:c,topListHeight:l,increaseViewportBy:s,visibleRange:T(w(O(L(e),L(t),L(n),L(i,je),L(c),L(l),L(r),L(o),L(s)),H((([e,t,o,[n,r],i,l,s,c,a])=>{const u=e-c,d=l+s,f=Math.max(o-u,0);let m=Ze;const h=Qe(a,qe),g=Qe(a,Ye);return n-=c,r+=o+s,(n+=o+s)>e+d-h&&(m=We),(r-=c)<e-f+t+g&&(m=Fe),m!==Ze?[Math.max(u-o-Je(i,qe,m)-h,0),u-f-s+t+Je(i,Ye,m)+g]:null})),E((e=>null!=e)),S(je)),[0,0])}}),s(Y),{singleton:!0});const et={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function tt(e,t,o){if(0===e.length)return[];if(!Be(t))return e.map((e=>({...e,index:e.index+o,originalIndex:e.index})));const n=e[0].index,r=e[e.length-1].index,i=[],l=fe(t.groupOffsetTree,n,r);let s,c=0;for(const a of e){let e;(!s||s.end<a.index)&&(s=l.shift(),c=t.groupIndices.indexOf(s.start)),e=a.index===s.start?{type:"group",index:c}:{index:a.index-(c+1)+o,groupIndex:c},i.push({...e,size:a.size,offset:a.offset,originalIndex:a.index,data:a.data})}return i}function ot(e,t,o,n,r,i){const{lastSize:l,lastOffset:s,lastIndex:c}=r;let a=0,u=0;if(e.length>0){a=e[0].offset;const t=e[e.length-1];u=t.offset+t.size}const d=o-c,f=a,m=s+d*l+(d-1)*n-u;return{items:tt(e,r,i),topItems:tt(t,r,i),topListHeight:t.reduce(((e,t)=>t.size+e),0),offsetTop:a,offsetBottom:m,top:f,bottom:u,totalCount:o,firstItemIndex:i}}const nt=M((([{sizes:e,totalCount:t,data:o,firstItemIndex:n,gap:r},i,{visibleRange:s,listBoundary:c,topListHeight:a},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:f},m,{didMount:h},{recalcInProgress:p}])=>{const C=x([]),y=v();g(i.topItemsIndexes,C);const b=T(w(O(h,p,L(s,je),L(t),L(e),L(d),u,L(C),L(n),L(r),o),E((([e,t,,o,,,,,,,n])=>{const r=n&&n.length!==o;return e&&!t&&!r})),H((([,,[e,t],o,n,r,i,s,c,a,u])=>{const d=n,{sizeTree:f,offsetTree:m}=d;if(0===o||0===e&&0===t)return{...et,totalCount:o};if(Q(f))return ot(function(e,t,o){if(Be(t)){const n=Re(e,t);return[{index:oe(t.groupOffsetTree,n)[0],size:0,offset:0},{index:n,size:0,offset:0,data:o&&o[0]}]}return[{index:e,size:0,offset:0,data:o&&o[0]}]}(function(e,t){const o=t-1;return"number"==typeof e?e:"LAST"===e.index?o:e.index}(r,o),d,u),[],o,a,d,c);const h=[];if(s.length>0){const e=s[0],t=s[s.length-1];let o=0;for(const n of fe(f,e,t)){const r=n.value,i=Math.max(n.start,e),l=Math.min(n.end,t);for(let e=i;e<=l;e++)h.push({index:e,size:r,offset:o,data:u&&u[e]}),o+=r}}if(!i)return ot([],h,o,a,d,c);const g=s.length>0?s[s.length-1]+1:0,p=Ee(m,e,t,g);if(0===p.length)return null;const v=o-1;return ot(l([],(o=>{for(const n of p){const r=n.value;let i=r.offset,l=n.start;const s=r.size;if(r.offset<e){l+=Math.floor((e-r.offset+a)/(s+a));const t=l-n.start;i+=t*s+t*a}l<g&&(i+=(g-l)*s,l=g);const c=Math.min(n.end,v);for(let e=l;e<=c&&!(i>=t);e++)o.push({index:e,size:s,offset:i,data:u&&u[e]}),i+=s+a}})),h,o,a,d,c)})),E((e=>null!==e)),S()),et);g(w(o,E((e=>void 0!==e)),H((e=>null==e?void 0:e.length))),t),g(w(b,H((e=>e.topListHeight))),f),g(f,a),g(w(b,H((e=>[e.top,e.bottom]))),c),g(w(b,H((e=>e.items))),y);return{listState:b,topItemsIndexes:C,endReached:I(w(b,E((({items:e})=>e.length>0)),k(t,o),E((([{items:e},t])=>e[e.length-1].originalIndex===t-1)),H((([,e,t])=>[e-1,t])),S(je),H((([e])=>e)))),startReached:I(w(b,R(200),E((({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length)),H((({items:e})=>e[0].index)),S())),rangeChanged:I(w(b,E((({items:e})=>e.length>0)),H((({items:e})=>{let t=0,o=e.length-1;for(;"group"===e[t].type&&t<o;)t++;for(;"group"===e[o].type&&o>t;)o--;return{startIndex:e[t].index,endIndex:e[o].index}})),S(Ke))),itemsRendered:y,...m}}),s(Pe,$e,Xe,Ge,Me,Ae,De,xe),{singleton:!0}),rt=M((([{sizes:e,firstItemIndex:t,data:o,gap:n},{listState:r},{didMount:i}])=>{const l=x(0);return g(w(i,k(l),E((([,e])=>0!==e)),k(e,t,n,o),H((([[,e],t,o,n,r=[]])=>{let i=0;if(t.groupIndices.length>0)for(const s of t.groupIndices){if(s-i>=e)break;i++}const l=e+i;return ot(Array.from({length:l}).map(((e,t)=>({index:t,size:0,offset:0,data:r[t]}))),[],l,n,t,o)}))),r),{initialItemCount:l}}),s(Pe,nt,De),{singleton:!0}),it=M((([{scrollVelocity:e}])=>{const t=x(!1),o=v(),n=x(!1);return g(w(e,k(n,t,o),E((([e,t])=>!!t)),H((([e,t,o,n])=>{const{exit:r,enter:i}=t;if(o){if(r(e,n))return!1}else if(i(e,n))return!0;return o})),S()),t),d(w(O(t,e,o),k(n)),(([[e,t,o],n])=>e&&n&&n.change&&n.change(t,o))),{isSeeking:t,scrollSeekConfiguration:n,scrollVelocity:e,scrollSeekRangeChanged:o}}),s(Ae),{singleton:!0}),lt=M((([{topItemsIndexes:e}])=>{const t=x(0);return g(w(t,E((e=>e>0)),H((e=>Array.from({length:e}).map(((e,t)=>t))))),e),{topItemCount:t}}),s(nt)),st=M((([{footerHeight:e,headerHeight:t,fixedHeaderHeight:o,fixedFooterHeight:n},{listState:r}])=>{const i=v(),l=T(w(O(e,n,t,o,r),H((([e,t,o,n,r])=>e+t+o+n+r.offsetBottom+r.bottom))),0);return g(L(l),i),{totalListHeight:l,totalListHeightChanged:i}}),s(Y,nt),{singleton:!0});function ct(e){let t,o=!1;return()=>(o||(o=!0,t=e()),t)}const at=ct((()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent))),ut=M((([{scrollBy:e,scrollTop:t,deviation:o,scrollingInProgress:n},{isScrolling:r,isAtBottom:i,scrollDirection:l,lastJumpDueToItemResize:s},{listState:c},{beforeUnshiftWith:a,shiftWithOffset:u,sizes:m,gap:h},{log:p},{recalcInProgress:v}])=>{const x=I(w(c,k(s),b((([,e,t,o],[{items:n,totalCount:r,bottom:i,offsetBottom:l},s])=>{const c=i+l;let a=0;if(t===r&&e.length>0&&n.length>0){0===n[0].originalIndex&&0===e[0].originalIndex||(a=c-o,0!==a&&(a+=s))}return[a,n,r,c]}),[0,[],0,0]),E((([e])=>0!==e)),k(t,l,n,i,p,v),E((([,e,t,o,,,n])=>!n&&!o&&0!==e&&t===We)),H((([[e],,,,,t])=>(t("Upward scrolling compensation",{amount:e},D.DEBUG),e)))));function C(t){t>0?(f(e,{top:-t,behavior:"auto"}),f(o,0)):(f(o,0),f(e,{top:-t,behavior:"auto"}))}return d(w(x,k(o,r)),(([e,t,n])=>{n&&at()?f(o,t-e):C(-e)})),d(w(O(T(r,!1),o,v),E((([e,t,o])=>!e&&!o&&0!==t)),H((([e,t])=>t)),R(1)),C),g(w(u,H((e=>({top:-e})))),e),d(w(a,k(m,h),H((([e,{lastSize:t,groupIndices:o,sizeTree:n},r])=>{function i(e){return e*(t+r)}if(0===o.length)return i(e);{let t=0;const r=te(n,0);let l=0,s=0;for(;l<e;){l++,t+=r;let n=o[s+1]-o[s]-1;l+n>e&&(t-=r,n=e-l+1),l+=n,t+=i(n),s++}return t}}))),(t=>{f(o,t),requestAnimationFrame((()=>{f(e,{top:t}),requestAnimationFrame((()=>{f(o,0),f(v,!1)}))}))})),{deviation:o}}),s(Y,Ae,nt,Pe,N,xe)),dt=M((([{totalListHeight:e},{didMount:t},{scrollTo:o}])=>{const n=x(0);return d(w(t,k(n),E((([,e])=>0!==e)),H((([,e])=>({top:e})))),(t=>{p(w(e,E((e=>0!==e))),(()=>{setTimeout((()=>{f(o,t)}))}))})),{initialScrollTop:n}}),s(st,De,Y),{singleton:!0}),ft=M((([{viewportHeight:e},{totalListHeight:t}])=>{const o=x(!1);return{alignToBottom:o,paddingTopAddition:T(w(O(o,e,t),E((([e])=>e)),H((([,e,t])=>Math.max(0,e-t))),S()),0)}}),s(Y,st),{singleton:!0}),mt=M((([{scrollTo:e,scrollContainerState:t}])=>{const o=v(),n=v(),r=v(),i=x(!1),l=x(void 0);return g(w(O(o,n),H((([{viewportHeight:e,scrollTop:t,scrollHeight:o},{offsetTop:n}])=>({scrollTop:Math.max(0,t-n),scrollHeight:o,viewportHeight:e})))),t),g(w(e,k(n),H((([e,{offsetTop:t}])=>({...e,top:e.top+t})))),r),{useWindowScroll:i,customScrollParent:l,windowScrollContainerState:o,windowViewportRect:n,windowScrollTo:r}}),s(Y)),ht=({itemTop:e,itemBottom:t,viewportTop:o,viewportBottom:n,locationParams:{behavior:r,align:i,...l}})=>e<o?{...l,behavior:r,align:i??"start"}:t>n?{...l,behavior:r,align:i??"end"}:null,gt=M((([{sizes:e,totalCount:t,gap:o},{scrollTop:n,viewportHeight:r,headerHeight:i,fixedHeaderHeight:l,fixedFooterHeight:s,scrollingInProgress:c},{scrollToIndex:a}])=>{const u=v();return g(w(u,k(e,r,t,i,l,s,n),k(o),H((([[e,t,o,n,r,i,l,s],a])=>{const{done:u,behavior:d,align:f,calculateViewLocation:m=ht,...g}=e,v=ze(e,t,n-1),x=be(v,t.offsetTree,a)+r+i,I=m({itemTop:x,itemBottom:x+oe(t.sizeTree,v)[1],viewportTop:s+i,viewportBottom:s+o-l,locationParams:{behavior:d,align:f,...g}});return I?u&&p(w(c,E((e=>!1===e)),z(h(c)?1:2)),u):u&&u(),I})),E((e=>null!==e))),a),{scrollIntoView:u}}),s(Pe,Y,Me,nt,N),{singleton:!0}),pt=M((([e,t,o,n,r,i,l,s,c])=>({...e,...t,...o,...n,...r,...i,...l,...s,...c})),s(Xe,rt,De,it,st,dt,ft,mt,gt)),vt=M((([{totalCount:e,sizeRanges:t,fixedItemSize:o,defaultItemSize:n,trackItemSizes:r,itemSize:i,data:l,firstItemIndex:s,groupIndices:c,statefulTotalCount:a,gap:u,sizes:d},{initialTopMostItemIndex:f,scrolledToInitialItem:m},h,p,{listState:v,topItemsIndexes:x,...I},{scrollToIndex:T},C,{topItemCount:S},{groupCounts:E},y,b])=>(g(I.rangeChanged,y.scrollSeekRangeChanged),g(w(y.windowViewportRect,H((e=>e.visibleHeight))),h.viewportHeight),{totalCount:e,data:l,firstItemIndex:s,sizeRanges:t,initialTopMostItemIndex:f,scrolledToInitialItem:m,topItemsIndexes:x,topItemCount:S,groupCounts:E,fixedItemHeight:o,defaultItemHeight:n,gap:u,...p,statefulTotalCount:a,listState:v,scrollToIndex:T,trackItemSizes:r,itemSize:i,groupIndices:c,...I,...y,...h,...b,sizes:d})),s(Pe,Ge,Y,_e,nt,Me,ut,lt,$e,pt,N)),xt="-webkit-sticky",It="sticky",Tt=ct((()=>{if("undefined"==typeof document)return It;const e=document.createElement("div");return e.style.position=xt,e.style.position===xt?xt:It}));function wt(t,o){const n=e.useRef(null),r=e.useCallback((e=>{if(null===e||!e.offsetParent)return;const r=e.getBoundingClientRect(),i=r.width;let l,s;if(o){const e=o.getBoundingClientRect(),t=r.top-e.top;l=e.height-Math.max(0,t),s=t+o.scrollTop}else l=window.innerHeight-Math.max(0,r.top),s=r.top+window.pageYOffset;n.current={offsetTop:s,visibleHeight:l,visibleWidth:i},t(n.current)}),[t,o]),{callbackRef:i,ref:l}=_(r),s=e.useCallback((()=>{r(l.current)}),[r,l]);return e.useEffect((()=>{if(o){o.addEventListener("scroll",s);const e=new ResizeObserver(s);return e.observe(o),()=>{o.removeEventListener("scroll",s),e.unobserve(o)}}return window.addEventListener("scroll",s),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}}),[s,o]),i}const Ct=e.createContext(void 0),St=e.createContext(void 0);function Et(e){return e}const Ht=M((([e,t])=>({...e,...t})),s(vt,M((()=>{const e=x((e=>`Item ${e}`)),t=x(null),o=x((e=>`Group ${e}`)),n=x({}),r=x(Et),i=x("div"),l=x(u),s=(e,t=null)=>T(w(n,H((t=>t[e])),S()),t);return{context:t,itemContent:e,groupContent:o,components:n,computeItemKey:r,headerFooterTag:i,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")}})))),yt=({height:t})=>e.createElement("div",{style:{height:t}}),bt={position:Tt(),zIndex:1,overflowAnchor:"none"},zt={overflowAnchor:"none"},Rt=e.memo((function({showTopList:t=!1}){const o=Ut("listState"),n=_t("sizeRanges"),r=Ut("useWindowScroll"),i=Ut("customScrollParent"),l=_t("windowScrollContainerState"),s=_t("scrollContainerState"),c=i||r?l:s,a=Ut("itemContent"),d=Ut("context"),f=Ut("groupContent"),m=Ut("trackItemSizes"),h=Ut("itemSize"),g=Ut("log"),p=_t("gap"),{callbackRef:v}=$(n,h,m,t?u:c,g,p,i),[x,I]=e.useState(0);$t("deviation",(e=>{x!==e&&I(e)}));const T=Ut("EmptyPlaceholder"),w=Ut("ScrollSeekPlaceholder")||yt,C=Ut("ListComponent"),S=Ut("ItemComponent"),E=Ut("GroupComponent"),H=Ut("computeItemKey"),y=Ut("isSeeking"),b=Ut("groupIndices").length>0,z=Ut("paddingTopAddition"),R=t?{}:{boxSizing:"border-box",paddingTop:o.offsetTop+z,paddingBottom:o.offsetBottom,marginTop:x};return!t&&0===o.totalCount&&T?e.createElement(T,Lt(T,d)):e.createElement(C,{...Lt(C,d),ref:v,style:R,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?o.topItems:o.items).map((t=>{const n=t.originalIndex,r=H(n+o.firstItemIndex,t.data,d);return y?e.createElement(w,{...Lt(w,d),key:r,index:t.index,height:t.size,type:t.type||"item",..."group"===t.type?{}:{groupIndex:t.groupIndex}}):"group"===t.type?e.createElement(E,{...Lt(E,d),key:r,"data-index":n,"data-known-size":t.size,"data-item-index":t.index,style:bt},f(t.index,d)):e.createElement(S,{...Lt(S,d),key:r,"data-index":n,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,item:t.data,style:zt},b?a(t.index,t.groupIndex,t.data,d):a(t.index,t.data,d))})))})),Bt={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},kt={width:"100%",height:"100%",position:"absolute",top:0},Pt={width:"100%",position:Tt(),top:0,zIndex:1};function Lt(e,t){if("string"!=typeof e)return{context:t}}const Ot=e.memo((function(){const t=Ut("HeaderComponent"),o=_t("headerHeight"),n=Ut("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=Ut("context");return t?e.createElement(n,{ref:r},e.createElement(t,Lt(t,i))):null})),Mt=e.memo((function(){const t=Ut("FooterComponent"),o=_t("footerHeight"),n=Ut("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=Ut("context");return t?e.createElement(n,{ref:r},e.createElement(t,Lt(t,i))):null}));function Wt({usePublisher:t,useEmitter:o,useEmitterValue:n}){return e.memo((function({style:r,children:i,...l}){const s=t("scrollContainerState"),c=n("ScrollerComponent"),a=t("smoothScrollTargetReached"),u=n("scrollerRef"),d=n("context"),{scrollerRef:f,scrollByCallback:m,scrollToCallback:h}=q(s,a,c,u);return o("scrollTo",h),o("scrollBy",m),e.createElement(c,{ref:f,style:{...Bt,...r},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...Lt(c,d)},i)}))}function Ft({usePublisher:t,useEmitter:o,useEmitterValue:n}){return e.memo((function({style:r,children:i,...l}){const s=t("windowScrollContainerState"),c=n("ScrollerComponent"),a=t("smoothScrollTargetReached"),d=n("totalListHeight"),f=n("deviation"),m=n("customScrollParent"),h=n("context"),{scrollerRef:g,scrollByCallback:p,scrollToCallback:v}=q(s,a,c,u,m);return A((()=>(g.current=m||window,()=>{g.current=null})),[g,m]),o("windowScrollTo",v),o("scrollBy",p),e.createElement(c,{style:{position:"relative",...r,...0!==d?{height:d+f}:{}},"data-virtuoso-scroller":!0,...l,...Lt(c,h)},i)}))}const Vt=({children:t})=>{const n=e.useContext(Ct),r=_t("viewportHeight"),i=_t("fixedItemHeight"),l=U(o(r,(e=>j(e,"height"))));return e.useEffect((()=>{n&&(r(n.viewportHeight),i(n.itemHeight))}),[n,r,i]),e.createElement("div",{style:kt,ref:l,"data-viewport-type":"element"},t)},At=({children:t})=>{const o=e.useContext(Ct),n=_t("windowViewportRect"),r=_t("fixedItemHeight"),i=Ut("customScrollParent"),l=wt(n,i);return e.useEffect((()=>{o&&(r(o.itemHeight),n({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))}),[o,n,r]),e.createElement("div",{ref:l,style:kt,"data-viewport-type":"window"},t)},Dt=({children:t})=>{const o=Ut("TopItemListComponent"),n=Ut("headerHeight"),r={...Pt,marginTop:`${n}px`},i=Ut("context");return e.createElement(o||"div",{style:r,context:i},t)},Gt=e.memo((function(t){const o=Ut("useWindowScroll"),n=Ut("topItemsIndexes").length>0,r=Ut("customScrollParent"),i=r||o?Kt:jt,l=r||o?At:Vt;return e.createElement(i,{...t},n&&e.createElement(Dt,null,e.createElement(Rt,{showTopList:!0})),e.createElement(l,null,e.createElement(Ot,null),e.createElement(Rt,null),e.createElement(Mt,null)))})),{Component:Nt,usePublisher:_t,useEmitterValue:Ut,useEmitter:$t}=V(Ht,{required:{},optional:{context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",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"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Gt),jt=Wt({usePublisher:_t,useEmitterValue:Ut,useEmitter:$t}),Kt=Ft({usePublisher:_t,useEmitterValue:Ut,useEmitter:$t}),qt=Nt,Yt=Nt,Zt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Jt={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Qt,ceil:Xt,floor:eo,min:to,max:oo}=Math;function no(e,t,o){return Array.from({length:t-e+1}).map(((t,n)=>({index:n+e,data:null==o?void 0:o[n+e]})))}function ro(e,t){return e&&e.column===t.column&&e.row===t.row}function io(e,t){return e&&e.width===t.width&&e.height===t.height}const lo=M((([{overscan:e,visibleRange:t,listBoundary:o},{scrollTop:n,viewportHeight:r,scrollBy:i,scrollTo:l,smoothScrollTargetReached:s,scrollContainerState:c,footerHeight:a,headerHeight:u},d,f,{propsReady:m,didMount:h},{windowViewportRect:p,windowScrollTo:C,useWindowScroll:b,customScrollParent:z,windowScrollContainerState:R},B])=>{const P=x(0),M=x(0),W=x(Zt),F=x({height:0,width:0}),V=x({height:0,width:0}),A=v(),D=v(),G=x(0),N=x(void 0),_=x({row:0,column:0});g(w(O(h,M,N),E((([,e])=>0!==e)),H((([,e,t])=>({items:no(0,e-1,t),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0})))),W),g(w(O(L(P),t,L(_,ro),L(V,io),L(F,io),N),H((([e,[t,o],n,r,i,l])=>{const{row:s,column:c}=n,{height:a,width:u}=r,{width:d}=i;if(0===e||0===d)return Zt;if(0===u)return function(e){return{...Jt,items:e}}(no(0,0,l));const f=ao(d,u,c);let m=f*eo((t+s)/(a+s)),h=f*Xt((o+s)/(a+s))-1;h=to(e-1,oo(h,f-1)),m=to(h,oo(0,m));const g=no(m,h,l),{top:p,bottom:v}=so(i,n,r,g),x=Xt(e/f);return{items:g,offsetTop:p,offsetBottom:x*a+(x-1)*s-v,top:p,bottom:v,itemHeight:a,itemWidth:u}}))),W),g(w(N,E((e=>void 0!==e)),H((e=>e.length))),P),g(w(F,H((({height:e})=>e))),r),g(w(O(F,V,W,_),H((([e,t,{items:o},n])=>{const{top:r,bottom:i}=so(e,n,t,o);return[r,i]})),S(je)),o);const U=I(w(L(W),E((({items:e})=>e.length>0)),k(P),E((([{items:e},t])=>e[e.length-1].index===t-1)),H((([,e])=>e-1)),S())),$=I(w(L(W),E((({items:e})=>e.length>0&&0===e[0].index)),y(0),S())),j=I(w(L(W),E((({items:e})=>e.length>0)),H((({items:e})=>({startIndex:e[0].index,endIndex:e[e.length-1].index}))),S(Ke)));g(j,f.scrollSeekRangeChanged),g(w(A,k(F,V,P,_),H((([e,t,o,n,r])=>{const i=Oe(e),{align:l,behavior:s,offset:c}=i;let a=i.index;"LAST"===a&&(a=n-1),a=oo(0,a,to(n-1,a));let u=co(t,r,o,a);return"end"===l?u=Qt(u-t.height+o.height):"center"===l&&(u=Qt(u-t.height/2+o.height/2)),c&&(u+=c),{top:u,behavior:s}}))),l);const K=T(w(W,H((e=>e.offsetBottom+e.bottom))),0);return g(w(p,H((e=>({width:e.visibleWidth,height:e.visibleHeight})))),F),{data:N,totalCount:P,viewportDimensions:F,itemDimensions:V,scrollTop:n,scrollHeight:D,overscan:e,scrollBy:i,scrollTo:l,scrollToIndex:A,smoothScrollTargetReached:s,windowViewportRect:p,windowScrollTo:C,useWindowScroll:b,customScrollParent:z,windowScrollContainerState:R,deviation:G,scrollContainerState:c,footerHeight:a,headerHeight:u,initialItemCount:M,gap:_,...f,gridState:W,totalListHeight:K,...d,startReached:$,endReached:U,rangeChanged:j,propsReady:m,...B}}),s(Xe,Y,Ae,it,De,mt,N));function so(e,t,o,n){const{height:r}=o;if(void 0===r||0===n.length)return{top:0,bottom:0};return{top:co(e,t,o,n[0].index),bottom:co(e,t,o,n[n.length-1].index)+r}}function co(e,t,o,n){const r=ao(e.width,o.width,t.column),i=eo(n/r),l=i*o.height+oo(0,i-1)*t.row;return l>0?l+t.row:l}function ao(e,t,o){return oo(1,eo((e+o)/(t+o)))}const uo=M((([e,t])=>({...e,...t})),s(lo,M((()=>{const e=x((e=>`Item ${e}`)),t=x({}),o=x(null),n=x("virtuoso-grid-item"),r=x("virtuoso-grid-list"),i=x(Et),l=x("div"),s=x(u),c=(e,o=null)=>T(w(t,H((t=>t[e])),S()),o);return{context:o,itemContent:e,components:t,computeItemKey:i,itemClassName:n,listClassName:r,headerFooterTag:l,scrollerRef:s,FooterComponent:c("Footer"),HeaderComponent:c("Header"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),ScrollerComponent:c("Scroller","div"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}})))),fo=e.memo((function(){const t=To("gridState"),o=To("listClassName"),n=To("itemClassName"),r=To("itemContent"),i=To("computeItemKey"),l=To("isSeeking"),s=Io("scrollHeight"),c=To("ItemComponent"),a=To("ListComponent"),u=To("ScrollSeekPlaceholder"),d=To("context"),f=Io("itemDimensions"),m=Io("gap"),h=To("log"),g=U((e=>{const t=e.parentElement.parentElement.scrollHeight;s(t);const o=e.firstChild;o&&f(o.getBoundingClientRect()),m({row:Eo("row-gap",getComputedStyle(e).rowGap,h),column:Eo("column-gap",getComputedStyle(e).columnGap,h)})}));return e.createElement(a,{ref:g,className:o,...Lt(a,d),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map((o=>{const s=i(o.index,o.data,d);return l?e.createElement(u,{key:s,...Lt(u,d),index:o.index,height:t.itemHeight,width:t.itemWidth}):e.createElement(c,{...Lt(c,d),className:n,"data-index":o.index,key:s},r(o.index,o.data,d))})))})),mo=e.memo((function(){const t=To("HeaderComponent"),o=Io("headerHeight"),n=To("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=To("context");return t?e.createElement(n,{ref:r},e.createElement(t,Lt(t,i))):null})),ho=e.memo((function(){const t=To("FooterComponent"),o=Io("footerHeight"),n=To("headerFooterTag"),r=U((e=>o(j(e,"height")))),i=To("context");return t?e.createElement(n,{ref:r},e.createElement(t,Lt(t,i))):null})),go=({children:t})=>{const o=e.useContext(St),n=Io("itemDimensions"),r=Io("viewportDimensions"),i=U((e=>{r(e.getBoundingClientRect())}));return e.useEffect((()=>{o&&(r({height:o.viewportHeight,width:o.viewportWidth}),n({height:o.itemHeight,width:o.itemWidth}))}),[o,r,n]),e.createElement("div",{style:kt,ref:i},t)},po=({children:t})=>{const o=e.useContext(St),n=Io("windowViewportRect"),r=Io("itemDimensions"),i=To("customScrollParent"),l=wt(n,i);return e.useEffect((()=>{o&&(r({height:o.itemHeight,width:o.itemWidth}),n({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:o.viewportWidth}))}),[o,n,r]),e.createElement("div",{ref:l,style:kt},t)},vo=e.memo((function({...t}){const o=To("useWindowScroll"),n=To("customScrollParent"),r=n||o?So:Co,i=n||o?po:go;return e.createElement(r,{...t},e.createElement(i,null,e.createElement(mo,null),e.createElement(fo,null),e.createElement(ho,null)))})),{Component:xo,usePublisher:Io,useEmitterValue:To,useEmitter:wo}=V(uo,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},vo),Co=Wt({usePublisher:Io,useEmitterValue:To,useEmitter:wo}),So=Ft({usePublisher:Io,useEmitterValue:To,useEmitter:wo});function Eo(e,t,o){return"normal"===t||(null==t?void 0:t.endsWith("px"))||o(`${e} was not resolved to pixel value correctly`,t,D.WARN),"normal"===t?0:parseInt(t??"0",10)}const Ho=xo,yo=M((([e,t])=>({...e,...t})),s(vt,M((()=>{const t=x((t=>e.createElement("td",null,"Item $",t))),o=x(null),n=x(null),r=x(null),i=x({}),l=x(Et),s=x(u),c=(e,t=null)=>T(w(i,H((t=>t[e])),S()),t);return{context:o,itemContent:t,fixedHeaderContent:n,fixedFooterContent:r,components:i,computeItemKey:l,scrollerRef:s,TableComponent:c("Table","table"),TableHeadComponent:c("TableHead","thead"),TableFooterComponent:c("TableFoot","tfoot"),TableBodyComponent:c("TableBody","tbody"),TableRowComponent:c("TableRow","tr"),ScrollerComponent:c("Scroller","div"),EmptyPlaceholder:c("EmptyPlaceholder"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),FillerRow:c("FillerRow")}})))),bo=({height:t})=>e.createElement("tr",null,e.createElement("td",{style:{height:t}})),zo=({height:t})=>e.createElement("tr",null,e.createElement("td",{style:{height:t,padding:0,border:0}})),Ro=e.memo((function(){const t=Mo("listState"),o=Oo("sizeRanges"),n=Mo("useWindowScroll"),r=Mo("customScrollParent"),i=Oo("windowScrollContainerState"),l=Oo("scrollContainerState"),s=r||n?i:l,c=Mo("itemContent"),a=Mo("trackItemSizes"),u=Mo("itemSize"),d=Mo("log"),{callbackRef:f,ref:m}=$(o,u,a,s,d,void 0,r),[h,g]=e.useState(0);Wo("deviation",(e=>{h!==e&&(m.current.style.marginTop=`${e}px`,g(e))}));const p=Mo("EmptyPlaceholder"),v=Mo("ScrollSeekPlaceholder")||bo,x=Mo("FillerRow")||zo,I=Mo("TableBodyComponent"),T=Mo("TableRowComponent"),w=Mo("computeItemKey"),C=Mo("isSeeking"),S=Mo("paddingTopAddition"),E=Mo("firstItemIndex"),H=Mo("statefulTotalCount"),y=Mo("context");if(0===H&&p)return e.createElement(p,Lt(p,y));const b=t.offsetTop+S+h,z=t.offsetBottom,R=b>0?e.createElement(x,{height:b,key:"padding-top",context:y}):null,B=z>0?e.createElement(x,{height:z,key:"padding-bottom",context:y}):null,k=t.items.map((t=>{const o=t.originalIndex,n=w(o+E,t.data,y);return C?e.createElement(v,{...Lt(v,y),key:n,index:t.index,height:t.size,type:t.type||"item"}):e.createElement(T,{...Lt(T,y),key:n,"data-index":o,"data-known-size":t.size,"data-item-index":t.index,item:t.data,style:{overflowAnchor:"none"}},c(t.index,t.data,y))}));return e.createElement(I,{ref:f,"data-test-id":"virtuoso-item-list",...Lt(I,y)},[R,...k,B])})),Bo=({children:t})=>{const n=e.useContext(Ct),r=Oo("viewportHeight"),i=Oo("fixedItemHeight"),l=U(o(r,(e=>j(e,"height"))));return e.useEffect((()=>{n&&(r(n.viewportHeight),i(n.itemHeight))}),[n,r,i]),e.createElement("div",{style:kt,ref:l,"data-viewport-type":"element"},t)},ko=({children:t})=>{const o=e.useContext(Ct),n=Oo("windowViewportRect"),r=Oo("fixedItemHeight"),i=Mo("customScrollParent"),l=wt(n,i);return e.useEffect((()=>{o&&(r(o.itemHeight),n({offsetTop:0,visibleHeight:o.viewportHeight,visibleWidth:100}))}),[o,n,r]),e.createElement("div",{ref:l,style:kt,"data-viewport-type":"window"},t)},Po=e.memo((function(t){const n=Mo("useWindowScroll"),r=Mo("customScrollParent"),i=Oo("fixedHeaderHeight"),l=Oo("fixedFooterHeight"),s=Mo("fixedHeaderContent"),c=Mo("fixedFooterContent"),a=Mo("context"),u=U(o(i,(e=>j(e,"height")))),d=U(o(l,(e=>j(e,"height")))),f=r||n?Vo:Fo,m=r||n?ko:Bo,h=Mo("TableComponent"),g=Mo("TableHeadComponent"),p=Mo("TableFooterComponent"),v=s?e.createElement(g,{key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:u,...Lt(g,a)},s()):null,x=c?e.createElement(p,{key:"TableFoot",style:{zIndex:1,position:"sticky",bottom:0},ref:d,...Lt(p,a)},c()):null;return e.createElement(f,{...t},e.createElement(m,null,e.createElement(h,{style:{borderSpacing:0},...Lt(h,a)},[v,e.createElement(Ro,{key:"TableBody"}),x])))})),{Component:Lo,usePublisher:Oo,useEmitterValue:Mo,useEmitter:Wo}=V(yo,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",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"},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"}},Po),Fo=Wt({usePublisher:Oo,useEmitterValue:Mo,useEmitter:Wo}),Vo=Ft({usePublisher:Oo,useEmitterValue:Mo,useEmitter:Wo}),Ao=Lo;exports.GroupedVirtuoso=Yt,exports.LogLevel=D,exports.TableVirtuoso=Ao,exports.Virtuoso=qt,exports.VirtuosoGrid=Ho,exports.VirtuosoGridMockContext=St,exports.VirtuosoMockContext=Ct;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { default as React_2 } from 'react';
|
|
2
2
|
|
|
3
|
+
export declare type CalculateViewLocation = (params: CalculateViewLocationParams) => IndexLocationWithAlign | number | null;
|
|
4
|
+
|
|
5
|
+
export declare interface CalculateViewLocationParams {
|
|
6
|
+
itemTop: number;
|
|
7
|
+
itemBottom: number;
|
|
8
|
+
viewportTop: number;
|
|
9
|
+
viewportBottom: number;
|
|
10
|
+
locationParams: {
|
|
11
|
+
align?: 'start' | 'center' | 'end';
|
|
12
|
+
behavior?: 'auto' | 'smooth';
|
|
13
|
+
} & ({
|
|
14
|
+
index: number;
|
|
15
|
+
} | {
|
|
16
|
+
groupIndex: number;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
3
20
|
/**
|
|
4
21
|
* Customize the Virtuoso rendering by passing a set of custom components.
|
|
5
22
|
*/
|
|
@@ -175,8 +192,8 @@ export declare interface GridScrollSeekPlaceholderProps {
|
|
|
175
192
|
width: number;
|
|
176
193
|
}
|
|
177
194
|
|
|
178
|
-
export declare interface GroupContent {
|
|
179
|
-
(index: number): React_2.ReactNode;
|
|
195
|
+
export declare interface GroupContent<C> {
|
|
196
|
+
(index: number, context: C): React_2.ReactNode;
|
|
180
197
|
}
|
|
181
198
|
|
|
182
199
|
export declare interface GroupedScrollIntoViewLocation extends ScrollIntoViewLocationOptions {
|
|
@@ -204,11 +221,25 @@ export declare interface GroupedVirtuosoProps<D, C> extends Omit<VirtuosoProps<D
|
|
|
204
221
|
/**
|
|
205
222
|
* Specifies how each each group header gets rendered. The callback receives the zero-based index of the group.
|
|
206
223
|
*/
|
|
207
|
-
groupContent?: GroupContent
|
|
224
|
+
groupContent?: GroupContent<C>;
|
|
208
225
|
/**
|
|
209
226
|
* Specifies how each each item gets rendered.
|
|
210
227
|
*/
|
|
211
228
|
itemContent?: GroupItemContent<D, C>;
|
|
229
|
+
/**
|
|
230
|
+
* Use when implementing inverse infinite scrolling, decrease the value this property
|
|
231
|
+
* in combination with a change in `groupCounts` to prepend groups items to the top of the list.
|
|
232
|
+
* Both new groups and extending the top group is supported.
|
|
233
|
+
*
|
|
234
|
+
* The delta of the firstItemIndex should equal the amount of new items introduced, without the group themselves.
|
|
235
|
+
* As an example, if you prepend 2 groups with 20 and 30 items each, the firstItemIndex should be decreased with 50.
|
|
236
|
+
*
|
|
237
|
+
* You can also prepend more items to the first group, for example:
|
|
238
|
+
* \{ groupCounts: [20, 30], firstItemIndex: 1000 \} can become \{ groupCounts: [10, 30, 30], firstItemIndex: 980 \}
|
|
239
|
+
*
|
|
240
|
+
* Warning: the firstItemIndex should **be a positive number**, based on the total amount of items to be displayed.
|
|
241
|
+
*/
|
|
242
|
+
firstItemIndex?: number;
|
|
212
243
|
}
|
|
213
244
|
|
|
214
245
|
export declare interface GroupIndexLocationWithAlign extends LocationOptions {
|
|
@@ -318,7 +349,34 @@ export declare type ScrollIntoViewLocation = FlatScrollIntoViewLocation | Groupe
|
|
|
318
349
|
export declare interface ScrollIntoViewLocationOptions {
|
|
319
350
|
align?: 'start' | 'center' | 'end';
|
|
320
351
|
behavior?: 'auto' | 'smooth';
|
|
352
|
+
/**
|
|
353
|
+
* Will be called when the scroll is done, or immediately if no scroll is needed.
|
|
354
|
+
*/
|
|
321
355
|
done?: () => void;
|
|
356
|
+
/**
|
|
357
|
+
* Use this function to fine-tune the scrollIntoView behavior.
|
|
358
|
+
* The function receives the item's top and bottom position in the viewport, and the viewport top/bottom.
|
|
359
|
+
* Return an location object to scroll, or null to prevent scrolling.
|
|
360
|
+
* Here's the default implementation:
|
|
361
|
+
* ```ts
|
|
362
|
+
const defaultCalculateViewLocation: CalculateViewLocation = ({
|
|
363
|
+
itemTop,
|
|
364
|
+
itemBottom,
|
|
365
|
+
viewportTop,
|
|
366
|
+
viewportBottom,
|
|
367
|
+
locationParams: { behavior, align, ...rest },
|
|
368
|
+
}) => {
|
|
369
|
+
if (itemTop < viewportTop) {
|
|
370
|
+
return { ...rest, behavior, align: align ?? 'start' }
|
|
371
|
+
}
|
|
372
|
+
if (itemBottom > viewportBottom) {
|
|
373
|
+
return { ...rest, behavior, align: align ?? 'end' }
|
|
374
|
+
}
|
|
375
|
+
return null
|
|
376
|
+
}
|
|
377
|
+
*```
|
|
378
|
+
*/
|
|
379
|
+
calculateViewLocation?: CalculateViewLocation;
|
|
322
380
|
}
|
|
323
381
|
|
|
324
382
|
export declare interface ScrollSeekConfiguration {
|
|
@@ -331,7 +389,7 @@ export declare interface ScrollSeekConfiguration {
|
|
|
331
389
|
*/
|
|
332
390
|
change?: (velocity: number, range: ListRange) => void;
|
|
333
391
|
/**
|
|
334
|
-
* Callback to determine if the list should
|
|
392
|
+
* Callback to determine if the list should exit "scroll seek" mode.
|
|
335
393
|
*/
|
|
336
394
|
exit: ScrollSeekToggle;
|
|
337
395
|
}
|
|
@@ -731,6 +789,12 @@ export declare interface VirtuosoGridProps<D, C = unknown> extends GridRootProps
|
|
|
731
789
|
* Pass a reference to a scrollable parent element, so that the grid won't wrap in its own.
|
|
732
790
|
*/
|
|
733
791
|
customScrollParent?: HTMLElement;
|
|
792
|
+
/**
|
|
793
|
+
* set to LogLevel.DEBUG to enable various diagnostics in the console, the most useful being the item measurement reports.
|
|
794
|
+
*
|
|
795
|
+
* Ensure that you have "all levels" enabled in the browser console too see the messages.
|
|
796
|
+
*/
|
|
797
|
+
logLevel?: LogLevel;
|
|
734
798
|
}
|
|
735
799
|
|
|
736
800
|
export declare interface VirtuosoHandle {
|
|
@@ -956,6 +1020,12 @@ export declare interface VirtuosoProps<D, C> extends ListRootProps {
|
|
|
956
1020
|
* By default `4`. Redefine to change how much away from the bottom the scroller can be before the list is not considered not at bottom.
|
|
957
1021
|
*/
|
|
958
1022
|
atBottomThreshold?: number;
|
|
1023
|
+
/**
|
|
1024
|
+
* set to LogLevel.DEBUG to enable various diagnostics in the console, the most useful being the item measurement reports.
|
|
1025
|
+
*
|
|
1026
|
+
* Ensure that you have "all levels" enabled in the browser console too see the messages.
|
|
1027
|
+
*/
|
|
1028
|
+
logLevel?: LogLevel;
|
|
959
1029
|
}
|
|
960
1030
|
|
|
961
1031
|
export declare interface WindowViewportInfo {
|
package/dist/index.mjs
CHANGED
|
@@ -462,12 +462,14 @@ function useSizeWithElRef(callback, enabled = true) {
|
|
|
462
462
|
let callbackRef = (_el) => {
|
|
463
463
|
};
|
|
464
464
|
if (typeof ResizeObserver !== "undefined") {
|
|
465
|
-
const observer =
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
465
|
+
const observer = React.useMemo(() => {
|
|
466
|
+
return new ResizeObserver((entries) => {
|
|
467
|
+
const element = entries[0].target;
|
|
468
|
+
if (element.offsetParent !== null) {
|
|
469
|
+
callback(element);
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
}, [callback]);
|
|
471
473
|
callbackRef = (elRef) => {
|
|
472
474
|
if (elRef && enabled) {
|
|
473
475
|
observer.observe(elRef);
|
|
@@ -486,26 +488,30 @@ function useSize(callback, enabled = true) {
|
|
|
486
488
|
return useSizeWithElRef(callback, enabled).callbackRef;
|
|
487
489
|
}
|
|
488
490
|
function useChangedListContentsSizes(callback, itemSize, enabled, scrollContainerStateCallback, log, gap, customScrollParent) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
491
|
+
const memoedCallback = React.useCallback(
|
|
492
|
+
(el) => {
|
|
493
|
+
const ranges = getChangedChildSizes(el.children, itemSize, "offsetHeight", log);
|
|
494
|
+
let scrollableElement = el.parentElement;
|
|
495
|
+
while (!scrollableElement.dataset["virtuosoScroller"]) {
|
|
496
|
+
scrollableElement = scrollableElement.parentElement;
|
|
497
|
+
}
|
|
498
|
+
const windowScrolling = scrollableElement.lastElementChild.dataset["viewportType"] === "window";
|
|
499
|
+
const scrollTop = customScrollParent ? customScrollParent.scrollTop : windowScrolling ? window.pageYOffset || document.documentElement.scrollTop : scrollableElement.scrollTop;
|
|
500
|
+
const scrollHeight = customScrollParent ? customScrollParent.scrollHeight : windowScrolling ? document.documentElement.scrollHeight : scrollableElement.scrollHeight;
|
|
501
|
+
const viewportHeight = customScrollParent ? customScrollParent.offsetHeight : windowScrolling ? window.innerHeight : scrollableElement.offsetHeight;
|
|
502
|
+
scrollContainerStateCallback({
|
|
503
|
+
scrollTop: Math.max(scrollTop, 0),
|
|
504
|
+
scrollHeight,
|
|
505
|
+
viewportHeight
|
|
506
|
+
});
|
|
507
|
+
gap == null ? void 0 : gap(resolveGapValue$1("row-gap", getComputedStyle(el).rowGap, log));
|
|
508
|
+
if (ranges !== null) {
|
|
509
|
+
callback(ranges);
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
[callback, itemSize, log, gap, customScrollParent, scrollContainerStateCallback]
|
|
513
|
+
);
|
|
514
|
+
return useSizeWithElRef(memoedCallback, enabled);
|
|
509
515
|
}
|
|
510
516
|
function getChangedChildSizes(children, itemSize, field, log) {
|
|
511
517
|
const length = children.length;
|
|
@@ -724,6 +730,18 @@ function remove(node, key) {
|
|
|
724
730
|
return adjust(clone(node, { r: remove(r, key) }));
|
|
725
731
|
}
|
|
726
732
|
}
|
|
733
|
+
function find(node, key) {
|
|
734
|
+
if (empty(node)) {
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
if (key === node.k) {
|
|
738
|
+
return node.v;
|
|
739
|
+
} else if (key < node.k) {
|
|
740
|
+
return find(node.l, key);
|
|
741
|
+
} else {
|
|
742
|
+
return find(node.r, key);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
727
745
|
function findMaxKeyValue(node, value, field = "k") {
|
|
728
746
|
if (empty(node)) {
|
|
729
747
|
return [-Infinity, void 0];
|
|
@@ -918,6 +936,16 @@ function rangeIncludes(refRange) {
|
|
|
918
936
|
return range.start === startIndex && (range.end === endIndex || range.end === Infinity) && range.value === size;
|
|
919
937
|
};
|
|
920
938
|
}
|
|
939
|
+
function affectedGroupCount(offset, groupIndices) {
|
|
940
|
+
let recognizedOffsetItems = 0;
|
|
941
|
+
let groupIndex = 0;
|
|
942
|
+
while (recognizedOffsetItems < offset) {
|
|
943
|
+
recognizedOffsetItems += groupIndices[groupIndex + 1] - groupIndices[groupIndex] - 1;
|
|
944
|
+
groupIndex++;
|
|
945
|
+
}
|
|
946
|
+
const offsetIsExact = recognizedOffsetItems === offset;
|
|
947
|
+
return groupIndex - (offsetIsExact ? 0 : 1);
|
|
948
|
+
}
|
|
921
949
|
function insertRanges(sizeTree, ranges) {
|
|
922
950
|
let syncStart = empty(sizeTree) ? 0 : Infinity;
|
|
923
951
|
for (const range of ranges) {
|
|
@@ -1109,6 +1137,18 @@ const sizeSystem = system(
|
|
|
1109
1137
|
pipe(sizeRanges, withLatestFrom(groupIndices, log, gap), scan(sizeStateReducer, initial), distinctUntilChanged()),
|
|
1110
1138
|
initial
|
|
1111
1139
|
);
|
|
1140
|
+
const prevGroupIndices = statefulStreamFromEmitter(
|
|
1141
|
+
pipe(
|
|
1142
|
+
groupIndices,
|
|
1143
|
+
distinctUntilChanged(),
|
|
1144
|
+
scan((prev, curr) => ({ prev: prev.current, current: curr }), {
|
|
1145
|
+
prev: [],
|
|
1146
|
+
current: []
|
|
1147
|
+
}),
|
|
1148
|
+
map(({ prev }) => prev)
|
|
1149
|
+
),
|
|
1150
|
+
[]
|
|
1151
|
+
);
|
|
1112
1152
|
connect(
|
|
1113
1153
|
pipe(
|
|
1114
1154
|
groupIndices,
|
|
@@ -1131,8 +1171,8 @@ const sizeSystem = system(
|
|
|
1131
1171
|
pipe(
|
|
1132
1172
|
totalCount,
|
|
1133
1173
|
withLatestFrom(sizes),
|
|
1134
|
-
filter(([totalCount2, { lastIndex }]) => {
|
|
1135
|
-
return totalCount2 < lastIndex;
|
|
1174
|
+
filter(([totalCount2, { lastIndex, groupIndices: groupIndices2 }]) => {
|
|
1175
|
+
return totalCount2 < lastIndex && groupIndices2.length === 0;
|
|
1136
1176
|
}),
|
|
1137
1177
|
map(([totalCount2, { lastIndex, lastSize }]) => {
|
|
1138
1178
|
return [
|
|
@@ -1192,11 +1232,15 @@ const sizeSystem = system(
|
|
|
1192
1232
|
map((val) => val.diff)
|
|
1193
1233
|
),
|
|
1194
1234
|
(offset) => {
|
|
1235
|
+
const { groupIndices: groupIndices2 } = getValue(sizes);
|
|
1195
1236
|
if (offset > 0) {
|
|
1196
1237
|
publish(recalcInProgress, true);
|
|
1197
|
-
publish(unshiftWith, offset);
|
|
1238
|
+
publish(unshiftWith, offset + affectedGroupCount(offset, groupIndices2));
|
|
1198
1239
|
} else if (offset < 0) {
|
|
1199
|
-
|
|
1240
|
+
const prevGroupIndicesValue = getValue(prevGroupIndices);
|
|
1241
|
+
if (prevGroupIndicesValue.length > 0) {
|
|
1242
|
+
publish(shiftWith, offset - affectedGroupCount(-offset, prevGroupIndicesValue));
|
|
1243
|
+
}
|
|
1200
1244
|
}
|
|
1201
1245
|
}
|
|
1202
1246
|
);
|
|
@@ -1215,8 +1259,59 @@ const sizeSystem = system(
|
|
|
1215
1259
|
unshiftWith,
|
|
1216
1260
|
withLatestFrom(sizes),
|
|
1217
1261
|
map(([unshiftWith2, sizes2]) => {
|
|
1218
|
-
|
|
1219
|
-
|
|
1262
|
+
const groupedMode = sizes2.groupIndices.length > 0;
|
|
1263
|
+
const initialRanges = [];
|
|
1264
|
+
const defaultSize = sizes2.lastSize;
|
|
1265
|
+
if (groupedMode) {
|
|
1266
|
+
const firstGroupSize = find(sizes2.sizeTree, 0);
|
|
1267
|
+
let prependedGroupItemsCount = 0;
|
|
1268
|
+
let groupIndex = 0;
|
|
1269
|
+
while (prependedGroupItemsCount < unshiftWith2) {
|
|
1270
|
+
const theGroupIndex = sizes2.groupIndices[groupIndex];
|
|
1271
|
+
const groupItemCount = sizes2.groupIndices[groupIndex + 1] - theGroupIndex - 1;
|
|
1272
|
+
initialRanges.push({
|
|
1273
|
+
startIndex: theGroupIndex,
|
|
1274
|
+
endIndex: theGroupIndex,
|
|
1275
|
+
size: firstGroupSize
|
|
1276
|
+
});
|
|
1277
|
+
initialRanges.push({
|
|
1278
|
+
startIndex: theGroupIndex + 1,
|
|
1279
|
+
endIndex: theGroupIndex + 1 + groupItemCount - 1,
|
|
1280
|
+
size: defaultSize
|
|
1281
|
+
});
|
|
1282
|
+
groupIndex++;
|
|
1283
|
+
prependedGroupItemsCount += groupItemCount + 1;
|
|
1284
|
+
}
|
|
1285
|
+
const sizeTreeKV = walk(sizes2.sizeTree);
|
|
1286
|
+
const firstGroupIsExpanded = prependedGroupItemsCount !== unshiftWith2;
|
|
1287
|
+
if (firstGroupIsExpanded) {
|
|
1288
|
+
sizeTreeKV.shift();
|
|
1289
|
+
}
|
|
1290
|
+
return sizeTreeKV.reduce(
|
|
1291
|
+
(acc, { k: index, v: size }) => {
|
|
1292
|
+
let ranges = acc.ranges;
|
|
1293
|
+
if (acc.prevSize !== 0) {
|
|
1294
|
+
ranges = [
|
|
1295
|
+
...acc.ranges,
|
|
1296
|
+
{
|
|
1297
|
+
startIndex: acc.prevIndex,
|
|
1298
|
+
endIndex: index + unshiftWith2 - 1,
|
|
1299
|
+
size: acc.prevSize
|
|
1300
|
+
}
|
|
1301
|
+
];
|
|
1302
|
+
}
|
|
1303
|
+
return {
|
|
1304
|
+
ranges,
|
|
1305
|
+
prevIndex: index + unshiftWith2,
|
|
1306
|
+
prevSize: size
|
|
1307
|
+
};
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
ranges: initialRanges,
|
|
1311
|
+
prevIndex: unshiftWith2,
|
|
1312
|
+
prevSize: 0
|
|
1313
|
+
}
|
|
1314
|
+
).ranges;
|
|
1220
1315
|
}
|
|
1221
1316
|
return walk(sizes2.sizeTree).reduce(
|
|
1222
1317
|
(acc, { k: index, v: size }) => {
|
|
@@ -1229,7 +1324,7 @@ const sizeSystem = system(
|
|
|
1229
1324
|
{
|
|
1230
1325
|
ranges: [],
|
|
1231
1326
|
prevIndex: 0,
|
|
1232
|
-
prevSize:
|
|
1327
|
+
prevSize: defaultSize
|
|
1233
1328
|
}
|
|
1234
1329
|
).ranges;
|
|
1235
1330
|
})
|
|
@@ -1251,17 +1346,44 @@ const sizeSystem = system(
|
|
|
1251
1346
|
shiftWith,
|
|
1252
1347
|
withLatestFrom(sizes, gap),
|
|
1253
1348
|
map(([shiftWith2, sizes2, gap2]) => {
|
|
1254
|
-
|
|
1255
|
-
|
|
1349
|
+
const groupedMode = sizes2.groupIndices.length > 0;
|
|
1350
|
+
if (groupedMode) {
|
|
1351
|
+
let newSizeTree = newTree();
|
|
1352
|
+
const prevGroupIndicesValue = getValue(prevGroupIndices);
|
|
1353
|
+
let removedItemsCount = 0;
|
|
1354
|
+
let groupIndex = 0;
|
|
1355
|
+
let groupOffset = 0;
|
|
1356
|
+
while (removedItemsCount < -shiftWith2) {
|
|
1357
|
+
groupOffset = prevGroupIndicesValue[groupIndex];
|
|
1358
|
+
const groupItemCount = prevGroupIndicesValue[groupIndex + 1] - groupOffset - 1;
|
|
1359
|
+
groupIndex++;
|
|
1360
|
+
removedItemsCount += groupItemCount + 1;
|
|
1361
|
+
}
|
|
1362
|
+
newSizeTree = walk(sizes2.sizeTree).reduce((acc, { k, v }) => {
|
|
1363
|
+
return insert(acc, Math.max(0, k + shiftWith2), v);
|
|
1364
|
+
}, newSizeTree);
|
|
1365
|
+
const aGroupIsShrunk = removedItemsCount !== -shiftWith2;
|
|
1366
|
+
if (aGroupIsShrunk) {
|
|
1367
|
+
const firstGroupSize = find(sizes2.sizeTree, groupOffset);
|
|
1368
|
+
newSizeTree = insert(newSizeTree, 0, firstGroupSize);
|
|
1369
|
+
const nextItemSize = findMaxKeyValue(sizes2.sizeTree, -shiftWith2 + 1)[1];
|
|
1370
|
+
newSizeTree = insert(newSizeTree, 1, nextItemSize);
|
|
1371
|
+
}
|
|
1372
|
+
return {
|
|
1373
|
+
...sizes2,
|
|
1374
|
+
sizeTree: newSizeTree,
|
|
1375
|
+
...createOffsetTree(sizes2.offsetTree, 0, newSizeTree, gap2)
|
|
1376
|
+
};
|
|
1377
|
+
} else {
|
|
1378
|
+
const newSizeTree = walk(sizes2.sizeTree).reduce((acc, { k, v }) => {
|
|
1379
|
+
return insert(acc, Math.max(0, k + shiftWith2), v);
|
|
1380
|
+
}, newTree());
|
|
1381
|
+
return {
|
|
1382
|
+
...sizes2,
|
|
1383
|
+
sizeTree: newSizeTree,
|
|
1384
|
+
...createOffsetTree(sizes2.offsetTree, 0, newSizeTree, gap2)
|
|
1385
|
+
};
|
|
1256
1386
|
}
|
|
1257
|
-
const newSizeTree = walk(sizes2.sizeTree).reduce((acc, { k, v }) => {
|
|
1258
|
-
return insert(acc, Math.max(0, k + shiftWith2), v);
|
|
1259
|
-
}, newTree());
|
|
1260
|
-
return {
|
|
1261
|
-
...sizes2,
|
|
1262
|
-
sizeTree: newSizeTree,
|
|
1263
|
-
...createOffsetTree(sizes2.offsetTree, 0, newSizeTree, gap2)
|
|
1264
|
-
};
|
|
1265
1387
|
})
|
|
1266
1388
|
),
|
|
1267
1389
|
sizes
|
|
@@ -2023,8 +2145,9 @@ const listStateSystem = system(
|
|
|
2023
2145
|
duc(gap),
|
|
2024
2146
|
data
|
|
2025
2147
|
),
|
|
2026
|
-
filter(([mount, recalcInProgress2]) => {
|
|
2027
|
-
|
|
2148
|
+
filter(([mount, recalcInProgress2, , totalCount2, , , , , , , data2]) => {
|
|
2149
|
+
const dataChangeInProgress = data2 && data2.length !== totalCount2;
|
|
2150
|
+
return mount && !recalcInProgress2 && !dataChangeInProgress;
|
|
2028
2151
|
}),
|
|
2029
2152
|
map(
|
|
2030
2153
|
([
|
|
@@ -2343,9 +2466,9 @@ const upwardScrollFixSystem = system(
|
|
|
2343
2466
|
[0, [], 0, 0]
|
|
2344
2467
|
),
|
|
2345
2468
|
filter(([amount]) => amount !== 0),
|
|
2346
|
-
withLatestFrom(scrollTop, scrollDirection, scrollingInProgress, isAtBottom, log),
|
|
2347
|
-
filter(([, scrollTop2, scrollDirection2, scrollingInProgress2]) => {
|
|
2348
|
-
return !scrollingInProgress2 && scrollTop2 !== 0 && scrollDirection2 === UP;
|
|
2469
|
+
withLatestFrom(scrollTop, scrollDirection, scrollingInProgress, isAtBottom, log, recalcInProgress),
|
|
2470
|
+
filter(([, scrollTop2, scrollDirection2, scrollingInProgress2, , , recalcInProgress2]) => {
|
|
2471
|
+
return !recalcInProgress2 && !scrollingInProgress2 && scrollTop2 !== 0 && scrollDirection2 === UP;
|
|
2349
2472
|
}),
|
|
2350
2473
|
map(([[amount], , , , , log2]) => {
|
|
2351
2474
|
log2("Upward scrolling compensation", { amount }, LogLevel.DEBUG);
|
|
@@ -2391,7 +2514,32 @@ const upwardScrollFixSystem = system(
|
|
|
2391
2514
|
pipe(
|
|
2392
2515
|
beforeUnshiftWith,
|
|
2393
2516
|
withLatestFrom(sizes, gap),
|
|
2394
|
-
map(([offset, { lastSize }, gap2]) =>
|
|
2517
|
+
map(([offset, { lastSize: defaultItemSize, groupIndices, sizeTree }, gap2]) => {
|
|
2518
|
+
function getItemOffset(itemCount) {
|
|
2519
|
+
return itemCount * (defaultItemSize + gap2);
|
|
2520
|
+
}
|
|
2521
|
+
if (groupIndices.length === 0) {
|
|
2522
|
+
return getItemOffset(offset);
|
|
2523
|
+
} else {
|
|
2524
|
+
let amount = 0;
|
|
2525
|
+
const defaultGroupSize = find(sizeTree, 0);
|
|
2526
|
+
let recognizedOffsetItems = 0;
|
|
2527
|
+
let groupIndex = 0;
|
|
2528
|
+
while (recognizedOffsetItems < offset) {
|
|
2529
|
+
recognizedOffsetItems++;
|
|
2530
|
+
amount += defaultGroupSize;
|
|
2531
|
+
let groupItemCount = groupIndices[groupIndex + 1] - groupIndices[groupIndex] - 1;
|
|
2532
|
+
if (recognizedOffsetItems + groupItemCount > offset) {
|
|
2533
|
+
amount -= defaultGroupSize;
|
|
2534
|
+
groupItemCount = offset - recognizedOffsetItems + 1;
|
|
2535
|
+
}
|
|
2536
|
+
recognizedOffsetItems += groupItemCount;
|
|
2537
|
+
amount += getItemOffset(groupItemCount);
|
|
2538
|
+
groupIndex++;
|
|
2539
|
+
}
|
|
2540
|
+
return amount;
|
|
2541
|
+
}
|
|
2542
|
+
})
|
|
2395
2543
|
),
|
|
2396
2544
|
(offset) => {
|
|
2397
2545
|
publish(deviation, offset);
|
|
@@ -2498,6 +2646,21 @@ const windowScrollerSystem = system(([{ scrollTo, scrollContainerState }]) => {
|
|
|
2498
2646
|
windowScrollTo
|
|
2499
2647
|
};
|
|
2500
2648
|
}, tup(domIOSystem));
|
|
2649
|
+
const defaultCalculateViewLocation = ({
|
|
2650
|
+
itemTop: itemTop2,
|
|
2651
|
+
itemBottom,
|
|
2652
|
+
viewportTop,
|
|
2653
|
+
viewportBottom,
|
|
2654
|
+
locationParams: { behavior, align, ...rest }
|
|
2655
|
+
}) => {
|
|
2656
|
+
if (itemTop2 < viewportTop) {
|
|
2657
|
+
return { ...rest, behavior, align: align ?? "start" };
|
|
2658
|
+
}
|
|
2659
|
+
if (itemBottom > viewportBottom) {
|
|
2660
|
+
return { ...rest, behavior, align: align ?? "end" };
|
|
2661
|
+
}
|
|
2662
|
+
return null;
|
|
2663
|
+
};
|
|
2501
2664
|
const scrollIntoViewSystem = system(
|
|
2502
2665
|
([
|
|
2503
2666
|
{ sizes, totalCount, gap },
|
|
@@ -2511,24 +2674,25 @@ const scrollIntoViewSystem = system(
|
|
|
2511
2674
|
withLatestFrom(sizes, viewportHeight, totalCount, headerHeight, fixedHeaderHeight, fixedFooterHeight, scrollTop),
|
|
2512
2675
|
withLatestFrom(gap),
|
|
2513
2676
|
map(([[viewLocation, sizes2, viewportHeight2, totalCount2, headerHeight2, fixedHeaderHeight2, fixedFooterHeight2, scrollTop2], gap2]) => {
|
|
2514
|
-
const { done, behavior, align, ...rest } = viewLocation;
|
|
2515
|
-
let location = null;
|
|
2677
|
+
const { done, behavior, align, calculateViewLocation = defaultCalculateViewLocation, ...rest } = viewLocation;
|
|
2516
2678
|
const actualIndex = originalIndexFromLocation(viewLocation, sizes2, totalCount2 - 1);
|
|
2517
2679
|
const itemTop2 = offsetOf(actualIndex, sizes2.offsetTree, gap2) + headerHeight2 + fixedHeaderHeight2;
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2680
|
+
const itemBottom = itemTop2 + findMaxKeyValue(sizes2.sizeTree, actualIndex)[1];
|
|
2681
|
+
const viewportTop = scrollTop2 + fixedHeaderHeight2;
|
|
2682
|
+
const viewportBottom = scrollTop2 + viewportHeight2 - fixedFooterHeight2;
|
|
2683
|
+
const location = calculateViewLocation({
|
|
2684
|
+
itemTop: itemTop2,
|
|
2685
|
+
itemBottom,
|
|
2686
|
+
viewportTop,
|
|
2687
|
+
viewportBottom,
|
|
2688
|
+
locationParams: { behavior, align, ...rest }
|
|
2689
|
+
});
|
|
2526
2690
|
if (location) {
|
|
2527
2691
|
done && handleNext(
|
|
2528
2692
|
pipe(
|
|
2529
2693
|
scrollingInProgress,
|
|
2530
|
-
|
|
2531
|
-
|
|
2694
|
+
filter((value) => value === false),
|
|
2695
|
+
skip(getValue(scrollingInProgress) ? 1 : 2)
|
|
2532
2696
|
),
|
|
2533
2697
|
done
|
|
2534
2698
|
);
|
|
@@ -2597,7 +2761,8 @@ const listSystem = system(
|
|
|
2597
2761
|
firstItemIndex,
|
|
2598
2762
|
groupIndices,
|
|
2599
2763
|
statefulTotalCount,
|
|
2600
|
-
gap
|
|
2764
|
+
gap,
|
|
2765
|
+
sizes
|
|
2601
2766
|
},
|
|
2602
2767
|
{ initialTopMostItemIndex, scrolledToInitialItem },
|
|
2603
2768
|
domIO,
|
|
@@ -2641,7 +2806,8 @@ const listSystem = system(
|
|
|
2641
2806
|
...flags,
|
|
2642
2807
|
...featureGroup1,
|
|
2643
2808
|
...domIO,
|
|
2644
|
-
...log
|
|
2809
|
+
...log,
|
|
2810
|
+
sizes
|
|
2645
2811
|
};
|
|
2646
2812
|
},
|
|
2647
2813
|
tup(
|
|
@@ -2848,7 +3014,7 @@ const Items$1 = /* @__PURE__ */ React.memo(function VirtuosoItems({ showTopList
|
|
|
2848
3014
|
"data-item-index": item.index,
|
|
2849
3015
|
style: GROUP_STYLE
|
|
2850
3016
|
},
|
|
2851
|
-
groupContent(item.index)
|
|
3017
|
+
groupContent(item.index, context)
|
|
2852
3018
|
);
|
|
2853
3019
|
} else {
|
|
2854
3020
|
return React.createElement(
|
|
@@ -3032,16 +3198,16 @@ const {
|
|
|
3032
3198
|
optional: {
|
|
3033
3199
|
context: "context",
|
|
3034
3200
|
followOutput: "followOutput",
|
|
3035
|
-
firstItemIndex: "firstItemIndex",
|
|
3036
3201
|
itemContent: "itemContent",
|
|
3037
3202
|
groupContent: "groupContent",
|
|
3038
3203
|
overscan: "overscan",
|
|
3039
3204
|
increaseViewportBy: "increaseViewportBy",
|
|
3040
3205
|
totalCount: "totalCount",
|
|
3206
|
+
groupCounts: "groupCounts",
|
|
3041
3207
|
topItemCount: "topItemCount",
|
|
3208
|
+
firstItemIndex: "firstItemIndex",
|
|
3042
3209
|
initialTopMostItemIndex: "initialTopMostItemIndex",
|
|
3043
3210
|
components: "components",
|
|
3044
|
-
groupCounts: "groupCounts",
|
|
3045
3211
|
atBottomThreshold: "atBottomThreshold",
|
|
3046
3212
|
atTopThreshold: "atTopThreshold",
|
|
3047
3213
|
computeItemKey: "computeItemKey",
|
|
@@ -3117,6 +3283,9 @@ function buildItems(startIndex, endIndex, data) {
|
|
|
3117
3283
|
function gapComparator(prev, next) {
|
|
3118
3284
|
return prev && prev.column === next.column && prev.row === next.row;
|
|
3119
3285
|
}
|
|
3286
|
+
function dimensionComparator(prev, next) {
|
|
3287
|
+
return prev && prev.width === next.width && prev.height === next.height;
|
|
3288
|
+
}
|
|
3120
3289
|
const gridSystem = /* @__PURE__ */ system(
|
|
3121
3290
|
([
|
|
3122
3291
|
{ overscan, visibleRange, listBoundary },
|
|
@@ -3161,11 +3330,11 @@ const gridSystem = /* @__PURE__ */ system(
|
|
|
3161
3330
|
duc(totalCount),
|
|
3162
3331
|
visibleRange,
|
|
3163
3332
|
duc(gap, gapComparator),
|
|
3164
|
-
duc(itemDimensions,
|
|
3333
|
+
duc(itemDimensions, dimensionComparator),
|
|
3334
|
+
duc(viewportDimensions, dimensionComparator),
|
|
3165
3335
|
data
|
|
3166
3336
|
),
|
|
3167
|
-
|
|
3168
|
-
map(([[totalCount2, [startOffset, endOffset], gap2, item, data2], viewport]) => {
|
|
3337
|
+
map(([totalCount2, [startOffset, endOffset], gap2, item, viewport, data2]) => {
|
|
3169
3338
|
const { row: rowGap, column: columnGap } = gap2;
|
|
3170
3339
|
const { height: itemHeight, width: itemWidth } = item;
|
|
3171
3340
|
const { width: viewportWidth } = viewport;
|