react-virtuoso 2.9.2 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.m.js.map +1 -1
- package/package.json +7 -6
package/dist/index.m.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{systemToComponent as t}from"@virtuoso.dev/react-urx";import*as e from"@virtuoso.dev/urx";import{getValue as n,tup as o,system as r,stream as i,streamFromEmitter as a,pipe as l,map as s,connect as u,prop as c,combineLatest as m,filter as d,distinctUntilChanged as f,statefulStream as p,noop as h,subscribe as g,publish as v,statefulStreamFromEmitter as S,withLatestFrom as I,compose as C}from"@virtuoso.dev/urx";import*as T from"react";import{useLayoutEffect as x,useEffect as w,useRef as y,useCallback as b,createElement as E}from"react";function H(){return H=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},H.apply(this,arguments)}function R(t,e){if(null==t)return{};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)e.indexOf(n=i[o])>=0||(r[n]=t[n]);return r}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function z(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return L(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var k,B,F="undefined"!=typeof document?x:w;!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR"}(B||(B={}));var P=((k={})[B.DEBUG]="debug",k[B.INFO]="log",k[B.WARN]="warn",k[B.ERROR]="error",k),O=e.system(function(){var t=e.statefulStream(B.ERROR);return{log:e.statefulStream(function(n,o,r){var i;void 0===r&&(r=B.INFO),r>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:e.getValue(t))&&console[P[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function M(t,e){void 0===e&&(e=!0);var n=y(null),o=function(t){};if("undefined"!=typeof ResizeObserver){var r=new ResizeObserver(function(e){var n=e[0].target;null!==n.offsetParent&&t(n)});o=function(t){t&&e?(r.observe(t),n.current=t):(n.current&&r.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:o}}function V(t,e){return void 0===e&&(e=!0),M(t,e).callbackRef}function U(t,e,n,o,r,i){return V(function(n){for(var a=function(t,e,n,o){var r=t.length;if(0===r)return null;for(var i=[],a=0;a<r;a++){var l=t.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=e(l,"offsetHeight");if(0===c&&o("Zero-sized element, this should not happen",{child:l},B.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,e,0,r),l=n.parentElement;!l.dataset.virtuosoScroller;)l=l.parentElement;var s=i?i.scrollTop:"window"===l.firstElementChild.dataset.viewportType?window.pageYOffset||document.documentElement.scrollTop:l.scrollTop;o(i?[Math.max(s,0),i.scrollHeight]:[Math.max(s,0),l.scrollHeight]),null!==a&&t(a)},n)}function A(t,e){return Math.round(t.getBoundingClientRect()[e])}function W(t,n,o,r,i){void 0===r&&(r=e.noop);var a=y(null),l=y(null),s=y(null),u=b(function(e){var o=e.target,r=o===window||o===document?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop,i=o===window?document.documentElement.scrollHeight:o.scrollHeight;t([Math.max(r,0),i]),null!==l.current&&(r===l.current||r<=0||r===o.scrollHeight-A(o,"height"))&&(l.current=null,n(!0),s.current&&(clearTimeout(s.current),s.current=null))},[t,n]);return w(function(){var t=i||a.current;return r(i||a.current),u({target:t}),t.addEventListener("scroll",u,{passive:!0}),function(){r(null),t.removeEventListener("scroll",u)}},[a,u,o,r,i]),{scrollerRef:a,scrollByCallback:function(t){null===l.current&&a.current.scrollBy(t)},scrollToCallback:function(e){var o=a.current;if(o&&(!("offsetHeight"in o)||0!==o.offsetHeight)){var r,i,u,c="smooth"===e.behavior;if(o===window?(i=Math.max(A(document.documentElement,"height"),document.documentElement.scrollHeight),r=window.innerHeight,u=document.documentElement.scrollTop):(i=o.scrollHeight,r=A(o,"height"),u=o.scrollTop),e.top=Math.ceil(Math.max(Math.min(i-r,e.top),0)),Math.abs(r-i)<1.01||e.top===u)return t([u,i]),void(c&&n(!0));c?(l.current=e.top,s.current&&clearTimeout(s.current),s.current=setTimeout(function(){s.current=null,l.current=null,n(!0)},1e3)):l.current=null,o.scrollTo(e)}}}}var N=e.system(function(){var t=e.stream(),n=e.stream(),o=e.statefulStream(0),r=e.stream(),i=e.statefulStream(0),a=e.stream(),l=e.stream(),s=e.statefulStream(0),u=e.statefulStream(0),c=e.stream(),m=e.stream(),d=e.statefulStream(!1);return e.connect(e.pipe(t,e.map(function(t){return t[0]})),n),e.connect(e.pipe(t,e.map(function(t){return t[1]})),l),e.connect(n,i),{scrollContainerState:t,scrollTop:n,viewportHeight:a,headerHeight:s,footerHeight:u,scrollHeight:l,smoothScrollTargetReached:r,scrollTo:c,scrollBy:m,statefulScrollTop:i,deviation:o,scrollingInProgress:d}},[],{singleton:!0}),D={lvl:0};function G(t,e,n,o,r){return void 0===o&&(o=D),void 0===r&&(r=D),{k:t,v:e,lvl:n,l:o,r:r}}function _(t){return t===D}function j(){return D}function K(t,e){if(_(t))return D;var n=t.k,o=t.l,r=t.r;if(e===n){if(_(o))return r;if(_(r))return o;var i=$(o);return et(X(t,{k:i[0],v:i[1],l:Q(o)}))}return et(X(t,e<n?{l:K(o,e)}:{r:K(r,e)}))}function Y(t,e,n){if(void 0===n&&(n="k"),_(t))return[-Infinity,void 0];if(t[n]===e)return[t.k,t.v];if(t[n]<e){var o=Y(t.r,e,n);return-Infinity===o[0]?[t.k,t.v]:o}return Y(t.l,e,n)}function Z(t,e,n){return _(t)?G(e,n,1):e===t.k?X(t,{k:e,v:n}):function(t){return rt(it(t))}(X(t,e<t.k?{l:Z(t.l,e,n)}:{r:Z(t.r,e,n)}))}function q(t,e,n){if(_(t))return[];var o=t.k,r=t.v,i=t.r,a=[];return o>e&&(a=a.concat(q(t.l,e,n))),o>=e&&o<=n&&a.push({k:o,v:r}),o<=n&&(a=a.concat(q(i,e,n))),a}function J(t){return _(t)?[]:[].concat(J(t.l),[{k:t.k,v:t.v}],J(t.r))}function $(t){return _(t.r)?[t.k,t.v]:$(t.r)}function Q(t){return _(t.r)?t.l:et(X(t,{r:Q(t.r)}))}function X(t,e){return G(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function tt(t){return _(t)||t.lvl>t.r.lvl}function et(t){var e=t.l,n=t.r,o=t.lvl;if(n.lvl>=o-1&&e.lvl>=o-1)return t;if(o>n.lvl+1){if(tt(e))return it(X(t,{lvl:o-1}));if(_(e)||_(e.r))throw new Error("Unexpected empty nodes");return X(e.r,{l:X(e,{r:e.r.l}),r:X(t,{l:e.r.r,lvl:o-1}),lvl:o})}if(tt(t))return rt(X(t,{lvl:o-1}));if(_(n)||_(n.l))throw new Error("Unexpected empty nodes");var r=n.l,i=tt(r)?n.lvl-1:n.lvl;return X(r,{l:X(t,{r:r.l,lvl:o-1}),r:rt(X(n,{l:r.r,lvl:i})),lvl:r.lvl+1})}function nt(t,e,n){return _(t)?[]:ot(q(t,Y(t,e)[0],n),function(t){return{index:t.k,value:t.v}})}function ot(t,e){var n=t.length;if(0===n)return[];for(var o=e(t[0]),r=o.index,i=o.value,a=[],l=1;l<n;l++){var s=e(t[l]),u=s.index,c=s.value;a.push({start:r,end:u-1,value:i}),r=u,i=c}return a.push({start:r,end:Infinity,value:i}),a}function rt(t){var e=t.r,n=t.lvl;return _(e)||_(e.r)||e.lvl!==n||e.r.lvl!==n?t:X(e,{l:X(t,{r:e.l}),lvl:n+1})}function it(t){var e=t.l;return _(e)||e.lvl!==t.lvl?t:X(e,{r:X(t,{l:e.r})})}function at(t,e,n,o){void 0===o&&(o=0);for(var r=t.length-1;o<=r;){var i=Math.floor((o+r)/2),a=n(t[i],e);if(0===a)return i;if(-1===a){if(r-o<2)return i-1;r=i-1}else{if(r===o)return i;o=i+1}}throw new Error("Failed binary finding record in array - "+t.join(",")+", searched for "+e)}function lt(t,e,n){return t[at(t,e,n)]}function st(t){var e=t.size,n=t.startIndex,o=t.endIndex;return function(t){return t.start===n&&(t.end===o||Infinity===t.end)&&t.value===e}}function ut(t,e){var n=t.index;return e===n?0:e<n?-1:1}function ct(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function mt(t){return{index:t.index,value:t}}function dt(t,e,n){var o=t,r=0,i=0,a=0,l=0;if(0!==e){a=o[l=at(o,e-1,ut)].offset;var s=Y(n,e-1);r=s[0],i=s[1],o.length&&o[l].size===Y(n,e)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(var u,c=z(nt(n,e,Infinity));!(u=c()).done;){var m=u.value,d=m.start,f=m.value,p=(d-r)*i+a;o.push({offset:p,size:f,index:d}),r=d,a=p,i=f}return{offsetTree:o,lastIndex:r,lastOffset:a,lastSize:i}}function ft(t,e){var n=e[0],o=e[1];n.length>0&&(0,e[2])("received item sizes",n,B.DEBUG);var r=t.sizeTree,i=r,a=0;if(o.length>0&&_(r)&&2===n.length){var l=n[0].size,s=n[1].size;i=o.reduce(function(t,e){return Z(Z(t,e,l),e+1,s)},i)}else{var u=function(t,e){for(var n,o=_(t)?0:Infinity,r=z(e);!(n=r()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(o=Math.min(o,l),_(t))t=Z(t,0,a);else{var u=nt(t,l-1,s+1);if(!u.some(st(i))){for(var c,m=!1,d=!1,f=z(u);!(c=f()).done;){var p=c.value,h=p.start,g=p.end,v=p.value;m?(s>=h||a===v)&&(t=K(t,h)):(d=v!==a,m=!0),g>s&&s>=h&&v!==a&&(t=Z(t,s+1,v))}d&&(t=Z(t,l,a))}}}return[t,o]}(i,n);i=u[0],a=u[1]}if(i===r)return t;var c=dt(t.offsetTree,a,i),m=c.offsetTree;return{sizeTree:i,offsetTree:m,lastIndex:c.lastIndex,lastOffset:c.lastOffset,lastSize:c.lastSize,groupOffsetTree:o.reduce(function(t,e){return Z(t,e,pt(e,m))},j()),groupIndices:o}}function pt(t,e){if(0===e.length)return 0;var n=lt(e,t,ut);return n.size*(t-n.index)+n.offset}function ht(t,e){if(!gt(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function gt(t){return!_(t.groupOffsetTree)}var vt={offsetHeight:"height",offsetWidth:"width"},St=e.system(function(t){var n=t[0].log,o=e.stream(),r=e.stream(),i=e.statefulStreamFromEmitter(r,0),a=e.stream(),l=e.stream(),s=e.statefulStream(0),u=e.statefulStream([]),c=e.statefulStream(void 0),m=e.statefulStream(void 0),d=e.statefulStream(function(t,e){return A(t,vt[e])}),f=e.statefulStream(void 0),p={offsetTree:[],sizeTree:j(),groupOffsetTree:j(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},h=e.statefulStreamFromEmitter(e.pipe(o,e.withLatestFrom(u,n),e.scan(ft,p),e.distinctUntilChanged()),p);e.connect(e.pipe(u,e.filter(function(t){return t.length>0}),e.withLatestFrom(h),e.map(function(t){var e=t[0],n=t[1],o=e.reduce(function(t,e,o){return Z(t,e,pt(e,n.offsetTree)||o)},j());return H({},n,{groupIndices:e,groupOffsetTree:o})})),h),e.connect(e.pipe(r,e.withLatestFrom(h),e.filter(function(t){return t[0]<t[1].lastIndex}),e.map(function(t){var e=t[1];return[{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),o),e.connect(c,m);var g=e.statefulStreamFromEmitter(e.pipe(c,e.map(function(t){return void 0===t})),!0);e.connect(e.pipe(m,e.filter(function(t){return void 0!==t&&_(e.getValue(h).sizeTree)}),e.map(function(t){return[{startIndex:0,endIndex:0,size:t}]})),o);var v=e.streamFromEmitter(e.pipe(o,e.withLatestFrom(h),e.scan(function(t,e){var n=e[1];return{changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:p}),e.map(function(t){return t.changed})));e.subscribe(e.pipe(s,e.scan(function(t,e){return{diff:t.prev-e,prev:e}},{diff:0,prev:0}),e.map(function(t){return t.diff})),function(t){t>0?e.publish(a,t):t<0&&e.publish(l,t)}),e.subscribe(e.pipe(s,e.withLatestFrom(n)),function(t){t[0]<0&&(0,t[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},B.ERROR)});var S=e.streamFromEmitter(a);e.connect(e.pipe(a,e.withLatestFrom(h),e.map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return J(n.sizeTree).reduce(function(t,n){var o=n.k,r=n.v;return{ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}]),prevIndex:o+e,prevSize:r}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),o);var I=e.streamFromEmitter(e.pipe(l,e.withLatestFrom(h),e.map(function(t){return pt(-t[0],t[1].offsetTree)})));return e.connect(e.pipe(l,e.withLatestFrom(h),e.map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var o=J(n.sizeTree).reduce(function(t,n){var o=n.v;return Z(t,Math.max(0,n.k+e),o)},j());return H({},n,{sizeTree:o},dt(n.offsetTree,0,o))})),h),{data:f,totalCount:r,sizeRanges:o,groupIndices:u,defaultItemSize:m,fixedItemSize:c,unshiftWith:a,shiftWith:l,shiftWithOffset:I,beforeUnshiftWith:S,firstItemIndex:s,sizes:h,listRefresh:v,statefulTotalCount:i,trackItemSizes:g,itemSize:d}},e.tup(O),{singleton:!0}),It="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function Ct(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&It||(e.behavior="auto"),e.offset||(e.offset=0),e}var Tt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=n.listRefresh,a=t[1],l=a.scrollingInProgress,s=a.viewportHeight,u=a.scrollTo,c=a.smoothScrollTargetReached,m=a.headerHeight,d=a.footerHeight,f=t[2].log,p=e.stream(),h=e.statefulStream(0),g=null,v=null,S=null;function I(){g&&(g(),g=null),S&&(S(),S=null),v&&(clearTimeout(v),v=null),e.publish(l,!1)}return e.connect(e.pipe(p,e.withLatestFrom(o,s,r,h,m,d,f),e.map(function(t){var n=t[0],o=t[1],r=t[2],a=t[3],s=t[4],u=t[5],m=t[6],d=t[7],f=Ct(n),h=f.align,C=f.behavior,T=f.offset,x=a-1,w=f.index;"LAST"===w&&(w=x),w=ht(w,o);var y=pt(w=Math.max(0,w,Math.min(x,w)),o.offsetTree)+u;"end"===h?(y=y-r+Y(o.sizeTree,w)[1],w===x&&(y+=m)):"center"===h?y=y-r/2+Y(o.sizeTree,w)[1]/2:y-=s,T&&(y+=T);var b=function(t){I(),t?(d("retrying to scroll to",{location:n},B.DEBUG),e.publish(p,n)):d("list did not change, scroll successful",{},B.DEBUG)};if(I(),"smooth"===C){var E=!1;S=e.subscribe(i,function(t){E=E||t}),g=e.handleNext(c,function(){b(E)})}else g=e.handleNext(e.pipe(i,function(t){var e=setTimeout(function(){t(!1)},50);return function(n){n&&(t(!0),clearTimeout(e))}}),b);return v=setTimeout(function(){I()},1200),e.publish(l,!0),d("scrolling from index to",{index:w,top:y,behavior:C},B.DEBUG),{top:y,behavior:C}})),u),{scrollToIndex:p,topListHeight:h}},e.tup(St,N,O),{singleton:!0}),xt="up",wt={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},yt=e.system(function(t){var n=t[0],o=n.scrollContainerState,r=n.scrollTop,i=n.viewportHeight,a=n.headerHeight,l=n.footerHeight,s=n.scrollBy,u=e.statefulStream(!1),c=e.statefulStream(!0),m=e.stream(),d=e.stream(),f=e.statefulStream(4),p=e.streamFromEmitter(e.pipe(e.merge(e.pipe(e.duc(r),e.skip(1),e.mapTo(!0)),e.pipe(e.duc(r),e.skip(1),e.mapTo(!1),e.debounceTime(100))),e.distinctUntilChanged())),h=e.statefulStreamFromEmitter(e.pipe(e.merge(e.pipe(s,e.mapTo(!0)),e.pipe(s,e.mapTo(!1),e.debounceTime(200))),e.distinctUntilChanged()),!1);e.connect(e.pipe(e.duc(r),e.map(function(t){return 0===t}),e.distinctUntilChanged()),c),e.connect(c,d);var g=e.streamFromEmitter(e.pipe(e.combineLatest(o,e.duc(i),e.duc(a),e.duc(l),e.duc(f)),e.scan(function(t,e){var n,o,r=e[0],i=r[0],a=r[1],l=e[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-e[4]?(i>t.state.scrollTop?(n="SCROLLED_DOWN",o=t.state.scrollTop-i):(n="SIZE_DECREASED",o=t.state.scrollTop-i||t.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:o}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>t.state.scrollHeight?"SIZE_INCREASED":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},wt),e.distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom}))),v=e.statefulStreamFromEmitter(e.pipe(o,e.scan(function(t,e){var n=e[0],o=e[1];return t.scrollHeight!==o?t.scrollTop!==n?{scrollHeight:o,scrollTop:n,jump:t.scrollTop-n,changed:!0}:{scrollHeight:o,scrollTop:n,jump:0,changed:!0}:{scrollTop:n,scrollHeight:o,jump:0,changed:!1}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),e.filter(function(t){return t.changed}),e.map(function(t){return t.jump})),0);e.connect(e.pipe(g,e.map(function(t){return t.atBottom})),u),e.connect(e.pipe(u,e.throttleTime(50)),m);var S=e.statefulStream("down");e.connect(e.pipe(o,e.map(function(t){return t[0]}),e.distinctUntilChanged(),e.scan(function(t,n){return e.getValue(h)?{direction:t.direction,prevScrollTop:n}:{direction:n<t.prevScrollTop?xt:"down",prevScrollTop:n}},{direction:"down",prevScrollTop:0}),e.map(function(t){return t.direction})),S),e.connect(e.pipe(o,e.throttleTime(50),e.mapTo("none")),S);var I=e.statefulStream(0);return e.connect(e.pipe(p,e.filter(function(t){return!t}),e.mapTo(0)),I),e.connect(e.pipe(r,e.throttleTime(100),e.withLatestFrom(p),e.filter(function(t){return!!t[1]}),e.scan(function(t,e){return[t[1],e[0]]},[0,0]),e.map(function(t){return t[1]-t[0]})),I),{isScrolling:p,isAtTop:c,isAtBottom:u,atBottomState:g,atTopStateChange:d,atBottomStateChange:m,scrollDirection:S,atBottomThreshold:f,scrollVelocity:I,lastJumpDueToItemResize:v}},e.tup(N)),bt=e.system(function(t){var o=t[0].log,r=e.statefulStream(!1),i=e.streamFromEmitter(e.pipe(r,e.filter(function(t){return t}),e.distinctUntilChanged()));return e.subscribe(r,function(t){t&&n(o)("props updated",{},B.DEBUG)}),{propsReady:r,didMount:i}},o(O),{singleton:!0}),Et=e.system(function(t){var n=t[0],o=n.sizes,r=n.listRefresh,i=n.defaultItemSize,a=t[1].scrollTop,l=t[2].scrollToIndex,s=t[3].didMount,u=e.statefulStream(!0),c=e.statefulStream(0);return e.connect(e.pipe(s,e.withLatestFrom(c),e.filter(function(t){return!!t[1]}),e.mapTo(!1)),u),e.subscribe(e.pipe(e.combineLatest(r,s),e.withLatestFrom(u,o,i),e.filter(function(t){var e=t[1],n=t[3];return t[0][1]&&(!_(t[2].sizeTree)||void 0!==n)&&!e}),e.withLatestFrom(c)),function(t){var n=t[1];setTimeout(function(){e.handleNext(a,function(){e.publish(u,!0)}),e.publish(l,n)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},e.tup(St,N,Tt,bt),{singleton:!0});function Ht(t){return!!t&&("smooth"===t?"smooth":"auto")}var Rt=e.system(function(t){var n=t[0],o=n.totalCount,r=n.listRefresh,i=t[1],a=i.isAtBottom,l=i.atBottomState,s=t[2].scrollToIndex,u=t[3].scrolledToInitialItem,c=t[4],m=c.propsReady,d=c.didMount,f=t[5].log,p=t[6].scrollingInProgress,h=e.statefulStream(!1),g=null;function v(t){e.publish(s,{index:"LAST",align:"end",behavior:t})}return e.subscribe(e.pipe(e.combineLatest(e.pipe(e.duc(o),e.skip(1)),d),e.withLatestFrom(e.duc(h),a,u,p),e.map(function(t){var e=t[0],n=e[0],o=e[1]&&t[3],r="auto";return o&&(r=function(t,e){return"function"==typeof t?Ht(t(e)):e&&Ht(t)}(t[1],t[2]||t[4]),o=o&&!!r),{totalCount:n,shouldFollow:o,followOutputBehavior:r}}),e.filter(function(t){return t.shouldFollow})),function(t){var n=t.totalCount,o=t.followOutputBehavior;g&&(g(),g=null),g=e.handleNext(r,function(){e.getValue(f)("following output to ",{totalCount:n},B.DEBUG),v(o),g=null})}),e.subscribe(e.pipe(e.combineLatest(e.duc(h),o,m),e.filter(function(t){return t[0]&&t[2]}),e.scan(function(t,e){var n=e[1];return{refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),e.filter(function(t){return t.refreshed}),e.withLatestFrom(h,o)),function(t){var n=t[1],o=e.handleNext(l,function(t){!n||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||g||(e.getValue(f)("scrolling to bottom due to increased size",{},B.DEBUG),v("auto"))});setTimeout(o,100)}),e.subscribe(e.combineLatest(e.duc(h),l),function(t){var e=t[1];t[0]&&!e.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===e.notAtBottomBecause&&v("auto")}),{followOutput:h}},e.tup(St,yt,Tt,Et,bt,O,N));function Lt(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var zt=r(function(t){var e=t[0],n=e.totalCount,o=e.groupIndices,r=e.sizes,p=t[1],h=p.scrollTop,g=p.headerHeight,v=i(),S=i(),I=a(l(v,s(Lt)));return u(l(I,s(c("totalCount"))),n),u(l(I,s(c("groupIndices"))),o),u(l(m(h,r,g),d(function(t){return gt(t[1])}),s(function(t){return Y(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),f(),s(function(t){return[t]})),S),{groupCounts:v,topItemsIndexes:S}},o(St,N));function kt(t,e){return!(!t||t[0]!==e[0]||t[1]!==e[1])}function Bt(t,e){return!(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}function Ft(t,e,n){return"number"==typeof t?n===xt&&"top"===e||"down"===n&&"bottom"===e?t:0:n===xt?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse}function Pt(t,e){return"number"==typeof t?t:t[e]||0}var Ot=e.system(function(t){var n=t[0],o=n.scrollTop,r=n.viewportHeight,i=n.deviation,a=n.headerHeight,l=e.stream(),s=e.statefulStream(0),u=e.statefulStream(0),c=e.statefulStream(0),m=e.statefulStream(0),d=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(e.duc(o),e.duc(r),e.duc(a),e.duc(l,kt),e.duc(m),e.duc(s),e.duc(u),e.duc(i),e.duc(c)),e.map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=r[0],a=r[1],l=t[4],s=t[6],u=t[7],c=t[8],m=e-u,d=t[5]+s,f=Math.max(o-m,0),p="none",h=Pt(c,"top"),g=Pt(c,"bottom");return i-=u,a+=o+s,(i+=o+s)>e+d-h&&(p=xt),(a-=u)<e-f+n+g&&(p="down"),"none"!==p?[Math.max(m-o-Ft(l,"top",p)-h,0),m-f-s+n+Ft(l,"bottom",p)+g]:null}),e.filter(function(t){return null!=t}),e.distinctUntilChanged(kt)),[0,0]);return{listBoundary:l,overscan:m,topListHeight:s,fixedHeaderHeight:u,increaseViewportBy:c,visibleRange:d}},e.tup(N),{singleton:!0}),Mt={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0};function Vt(t,e,n){if(0===t.length)return[];if(!gt(e))return t.map(function(t){return H({},t,{index:t.index+n,originalIndex:t.index})});for(var o,r=[],i=nt(e.groupOffsetTree,t[0].index,t[t.length-1].index),a=void 0,l=0,s=z(t);!(o=s()).done;){var u=o.value;(!a||a.end<u.index)&&(a=i.shift(),l=e.groupIndices.indexOf(a.start)),r.push(H({},u.index===a.start?{type:"group",index:l}:{index:u.index-(l+1)+n,groupIndex:l},{size:u.size,offset:u.offset,originalIndex:u.index,data:u.data}))}return r}function Ut(t,e,n,o,r){var i=0,a=0;if(t.length>0){i=t[0].offset;var l=t[t.length-1];a=l.offset+l.size}var s=i,u=o.lastOffset+(n-o.lastIndex)*o.lastSize-a;return{items:Vt(t,o,r),topItems:Vt(e,o,r),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:i,offsetBottom:u,top:s,bottom:a,totalCount:n}}var At,Wt,Nt,Dt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=n.data,a=n.firstItemIndex,l=t[1],s=t[2],u=s.visibleRange,c=s.listBoundary,m=s.topListHeight,d=t[3],f=d.scrolledToInitialItem,p=d.initialTopMostItemIndex,h=t[4].topListHeight,g=t[5],v=t[6].didMount,S=e.statefulStream([]),I=e.stream();e.connect(l.topItemsIndexes,S);var C=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(v,e.duc(u),e.duc(r),e.duc(o),e.duc(p),f,e.duc(S),e.duc(a),i),e.filter(function(t){return t[0]}),e.map(function(t){var n=t[1],o=n[0],r=n[1],i=t[2],a=t[4],l=t[5],s=t[6],u=t[7],c=t[8],m=t[3],d=m.sizeTree,f=m.offsetTree;if(0===i||0===o&&0===r)return Mt;if(_(d))return Ut(function(t,e,n){if(gt(e)){var o=ht(t,e);return[{index:Y(e.groupOffsetTree,o)[0],size:0,offset:0},{index:o,size:0,offset:0,data:n&&n[0]}]}return[{index:t,size:0,offset:0,data:n&&n[0]}]}(function(t,e){return"number"==typeof t?t:"LAST"===t.index?e-1:t.index}(a,i),m,c),[],i,m,u);var p=[];if(s.length>0)for(var h,g=s[0],v=s[s.length-1],S=0,I=z(nt(d,g,v));!(h=I()).done;)for(var C=h.value,T=C.value,x=Math.max(C.start,g),w=Math.min(C.end,v),y=x;y<=w;y++)p.push({index:y,size:T,offset:S,data:c&&c[y]}),S+=T;if(!l)return Ut([],p,i,m,u);var b=s.length>0?s[s.length-1]+1:0,E=function(t,e,n,o){return void 0===o&&(o=0),o>0&&(e=Math.max(e,lt(t,o,ut).offset)),ot((i=n,l=at(r=t,e,a=ct),s=at(r,i,a,l),r.slice(l,s+1)),mt);var r,i,a,l,s}(f,o,r,b);if(0===E.length)return null;var H=i-1;return Ut(e.tap([],function(t){for(var e,n=z(E);!(e=n()).done;){var i=e.value,a=i.value,l=a.offset,s=i.start,u=a.size;a.offset<o&&(l+=((s+=Math.floor((o-a.offset)/u))-i.start)*u),s<b&&(l+=(b-s)*u,s=b);for(var m=Math.min(i.end,H),d=s;d<=m&&!(l>=r);d++)t.push({index:d,size:u,offset:l,data:c&&c[d]}),l+=u}}),p,i,m,u)}),e.filter(function(t){return null!==t}),e.distinctUntilChanged()),Mt);return e.connect(e.pipe(i,e.filter(function(t){return void 0!==t}),e.map(function(t){return t.length})),r),e.connect(e.pipe(C,e.map(e.prop("topListHeight"))),h),e.connect(h,m),e.connect(e.pipe(C,e.map(function(t){return[t.top,t.bottom]})),c),e.connect(e.pipe(C,e.map(function(t){return t.items})),I),H({listState:C,topItemsIndexes:S,endReached:e.streamFromEmitter(e.pipe(C,e.filter(function(t){return t.items.length>0}),e.withLatestFrom(r,i),e.filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),e.map(function(t){return[t[1]-1,t[2]]}),e.distinctUntilChanged(kt),e.map(function(t){return t[0]}))),startReached:e.streamFromEmitter(e.pipe(C,e.throttleTime(200),e.filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),e.map(function(t){return t.items[0].index}),e.distinctUntilChanged())),rangeChanged:e.streamFromEmitter(e.pipe(C,e.filter(function(t){return t.items.length>0}),e.map(function(t){var e=t.items;return{startIndex:e[0].index,endIndex:e[e.length-1].index}}),e.distinctUntilChanged(Bt))),itemsRendered:I},g)},e.tup(St,zt,Ot,Et,Tt,yt,bt),{singleton:!0}),Gt=e.system(function(t){var n=t[0],o=n.sizes,r=n.firstItemIndex,i=n.data,a=t[1].listState,l=t[2].didMount,s=e.statefulStream(0);return e.connect(e.pipe(l,e.withLatestFrom(s),e.filter(function(t){return 0!==t[1]}),e.withLatestFrom(o,r,i),e.map(function(t){var e=t[0][1],n=t[1],o=t[2],r=t[3],i=void 0===r?[]:r,a=0;if(n.groupIndices.length>0)for(var l,s=z(n.groupIndices);!((l=s()).done||l.value-a>=e);)a++;var u=e+a;return Ut(Array.from({length:u}).map(function(t,e){return{index:e,size:0,offset:0,data:i[e]}}),[],u,n,o)})),a),{initialItemCount:s}},e.tup(St,Dt,bt),{singleton:!0}),_t=e.system(function(t){var n=t[0].scrollVelocity,o=e.statefulStream(!1),r=e.stream(),i=e.statefulStream(!1);return e.connect(e.pipe(n,e.withLatestFrom(i,o,r),e.filter(function(t){return!!t[1]}),e.map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=n.enter;if(o){if((0,n.exit)(e,r))return!1}else if(i(e,r))return!0;return o}),e.distinctUntilChanged()),o),e.subscribe(e.pipe(e.combineLatest(o,n,r),e.withLatestFrom(i)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:o,scrollSeekConfiguration:i,scrollVelocity:n,scrollSeekRangeChanged:r}},e.tup(yt),{singleton:!0}),jt=r(function(t){var e=t[0].topItemsIndexes,n=p(0);return u(l(n,d(function(t){return t>0}),s(function(t){return Array.from({length:t}).map(function(t,e){return e})})),e),{topItemCount:n}},o(Dt)),Kt=e.system(function(t){var n=t[0],o=n.footerHeight,r=n.headerHeight,i=t[1].listState,a=e.stream(),l=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(o,r,i),e.map(function(t){var e=t[2];return t[0]+t[1]+e.offsetBottom+e.bottom})),0);return e.connect(e.duc(l),a),{totalListHeight:l,totalListHeightChanged:a}},e.tup(N,Dt),{singleton:!0}),Yt=e.system(function(t){var n=t[0],o=n.scrollBy,r=n.scrollTop,i=n.deviation,a=n.scrollingInProgress,l=t[1],s=l.isScrolling,u=l.isAtBottom,c=l.atBottomState,m=l.scrollDirection,d=t[3],f=d.beforeUnshiftWith,p=d.shiftWithOffset,h=d.sizes,g=t[4].log,v=e.streamFromEmitter(e.pipe(t[2].listState,e.withLatestFrom(l.lastJumpDueToItemResize),e.scan(function(t,e){var n=t[1],o=e[0],r=o.items,i=o.totalCount,a=o.bottom+o.offsetBottom,l=0;return t[2]===i&&n.length>0&&r.length>0&&(0===r[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-t[3])&&(l+=e[1])),[l,r,i,a]},[0,[],0,0]),e.filter(function(t){return 0!==t[0]}),e.withLatestFrom(r,m,a,g,u,c),e.filter(function(t){return!t[3]&&0!==t[1]&&t[2]===xt}),e.map(function(t){var e=t[0][0];return(0,t[4])("Upward scrolling compensation",{amount:e},B.DEBUG),e})));return e.connect(e.pipe(v,e.withLatestFrom(i),e.map(function(t){return t[1]-t[0]})),i),e.subscribe(e.pipe(e.combineLatest(e.statefulStreamFromEmitter(s,!1),i),e.filter(function(t){return!t[0]&&0!==t[1]}),e.map(function(t){return t[1]}),e.throttleTime(1)),function(t){t>0?(e.publish(o,{top:-t,behavior:"auto"}),e.publish(i,0)):(e.publish(i,0),e.publish(o,{top:-t,behavior:"auto"}))}),e.connect(e.pipe(p,e.map(function(t){return{top:-t}})),o),e.connect(e.pipe(f,e.withLatestFrom(h),e.map(function(t){return t[0]*t[1].lastSize})),v),{deviation:i}},e.tup(N,yt,Dt,St,O)),Zt=e.system(function(t){var n=t[0].totalListHeight,o=t[1].didMount,r=t[2].scrollTo,i=e.statefulStream(0);return e.subscribe(e.pipe(o,e.withLatestFrom(i),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{top:t[1]}})),function(t){e.handleNext(e.pipe(n,e.filter(function(t){return 0!==t})),function(){setTimeout(function(){e.publish(r,t)})})}),{initialScrollTop:i}},e.tup(Kt,bt,N),{singleton:!0}),qt=e.system(function(t){var n=t[0].viewportHeight,o=t[1].totalListHeight,r=e.statefulStream(!1);return{alignToBottom:r,paddingTopAddition:e.statefulStreamFromEmitter(e.pipe(e.combineLatest(r,n,o),e.filter(function(t){return t[0]}),e.map(function(t){return Math.max(0,t[1]-t[2])}),e.distinctUntilChanged()),0)}},e.tup(N,Kt),{singleton:!0}),Jt=e.system(function(t){var n=t[0],o=n.scrollTo,r=n.scrollContainerState,i=e.stream(),a=e.stream(),l=e.stream(),s=e.statefulStream(!1),u=e.statefulStream(void 0);return e.connect(e.pipe(e.combineLatest(i,a),e.map(function(t){var e=t[0],n=e[1];return[Math.max(0,e[0]-t[1].offsetTop),n]})),r),e.connect(e.pipe(o,e.withLatestFrom(a),e.map(function(t){var e=t[0];return H({},e,{top:e.top+t[1].offsetTop})})),l),{useWindowScroll:s,customScrollParent:u,windowScrollContainerState:i,windowViewportRect:a,windowScrollTo:l}},e.tup(N)),$t=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=t[1],a=i.scrollTop,l=i.viewportHeight,s=i.headerHeight,u=i.scrollingInProgress,c=t[2].scrollToIndex,m=e.stream();return e.connect(e.pipe(m,e.withLatestFrom(o,l,r,s,a),e.map(function(t){var n=t[0],o=n.index,r=n.behavior,i=void 0===r?"auto":r,a=n.done,l=t[1],s=t[2],c=t[4],m=t[5],d=t[3]-1,f=null;o=ht(o,l);var p=pt(o=Math.max(0,o,Math.min(d,o)),l.offsetTree)+c;return p<m?f={index:o,behavior:i,align:"start"}:p+Y(l.sizeTree,o)[1]>m+s&&(f={index:o,behavior:i,align:"end"}),f?a&&e.handleNext(e.pipe(u,e.skip(1),e.filter(function(t){return!1===t})),a):a&&a(),f}),e.filter(function(t){return null!==t})),c),{scrollIntoView:m}},e.tup(St,N,Tt,Dt,O),{singleton:!0}),Qt=["listState","topItemsIndexes"],Xt=e.system(function(t){return H({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},e.tup(Ot,Gt,bt,_t,Kt,Zt,qt,Jt,$t)),te=e.system(function(t){var n=t[0],o=n.totalCount,r=n.sizeRanges,i=n.fixedItemSize,a=n.defaultItemSize,l=n.trackItemSizes,s=n.itemSize,u=n.data,c=n.firstItemIndex,m=n.groupIndices,d=n.statefulTotalCount,f=t[1],p=f.initialTopMostItemIndex,h=f.scrolledToInitialItem,g=t[2],v=t[3],S=t[4],I=S.listState,C=S.topItemsIndexes,T=R(S,Qt),x=t[5].scrollToIndex,w=t[7].topItemCount,y=t[8].groupCounts,b=t[9],E=t[10];return e.connect(T.rangeChanged,b.scrollSeekRangeChanged),e.connect(e.pipe(b.windowViewportRect,e.map(e.prop("visibleHeight"))),g.viewportHeight),H({totalCount:o,data:u,firstItemIndex:c,sizeRanges:r,initialTopMostItemIndex:p,scrolledToInitialItem:h,topItemsIndexes:C,topItemCount:w,groupCounts:y,fixedItemHeight:i,defaultItemHeight:a},v,{statefulTotalCount:d,listState:I,scrollToIndex:x,trackItemSizes:l,itemSize:s,groupIndices:m},T,b,g,E)},e.tup(St,Et,N,Rt,Dt,Tt,Yt,jt,zt,Xt,O)),ee=(At=function(){if("undefined"==typeof document)return"sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"},Nt=!1,function(){return Nt||(Nt=!0,Wt=At()),Wt});function ne(t,e){var n=y(null),o=b(function(o){if(null!==o){var r,i,a=o.getBoundingClientRect(),l=a.width;if(e){var s=e.getBoundingClientRect(),u=a.top-s.top;r=s.height-Math.max(0,u),i=u+e.scrollTop}else r=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;n.current={offsetTop:i,visibleHeight:r,visibleWidth:l},t(n.current)}},[t,e]),r=M(o),i=r.callbackRef,a=r.ref,l=b(function(){o(a.current)},[o,a]);return w(function(){if(e){e.addEventListener("scroll",l);var t=new ResizeObserver(l);return t.observe(e),function(){e.removeEventListener("scroll",l),t.unobserve(e)}}return window.addEventListener("scroll",l),window.addEventListener("resize",l),function(){window.removeEventListener("scroll",l),window.removeEventListener("resize",l)}},[l,e]),i}var oe=["placeholder"],re=["style","children"],ie=["style","children"];function ae(t){return t}var le=r(function(){var t=p(function(t){return"Item "+t}),e=p(null),n=p(function(t){return"Group "+t}),o=p({}),r=p(ae),i=p("div"),a=p(h),u=function(t,e){return void 0===e&&(e=null),S(l(o,s(function(e){return e[t]}),f()),e)};return{context:e,itemContent:t,groupContent:n,components:o,computeItemKey:r,headerFooterTag:i,scrollerRef:a,FooterComponent:u("Footer"),HeaderComponent:u("Header"),TopItemListComponent:u("TopItemList"),ListComponent:u("List","div"),ItemComponent:u("Item","div"),GroupComponent:u("Group","div"),ScrollerComponent:u("Scroller","div"),EmptyPlaceholder:u("EmptyPlaceholder"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder")}});function se(t,e){var n=i();return g(n,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+e,"color: red;","color: inherit;","color: blue;")}),u(n,t),n}var ue=r(function(t){var e=t[0],o=t[1],r={item:se(o.itemContent,"Rename the %citem%c prop to %citemContent."),group:se(o.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:se(e.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:se(e.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:se(e.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:i(),maxHeightCacheSize:i(),footer:i(),header:i(),HeaderContainer:i(),FooterContainer:i(),ItemContainer:i(),ScrollContainer:i(),GroupContainer:i(),ListContainer:i(),emptyComponent:i(),scrollSeek:i()};function a(t,e,n){u(l(t,I(o.components),s(function(t){var o,r=t[0],i=t[1];return console.warn("react-virtuoso: "+n+" property is deprecated. Pass components."+e+" instead."),H({},i,((o={})[e]=r,o))})),o.components)}return g(r.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;")}),g(r.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),g(r.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),g(r.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),g(r.scrollSeek,function(t){var r=t.placeholder,i=R(t,oe);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),v(o.components,H({},n(o.components),{ScrollSeekPlaceholder:r})),v(e.scrollSeekConfiguration,i)}),a(r.footer,"Footer","footer"),a(r.header,"Header","header"),a(r.ItemContainer,"Item","ItemContainer"),a(r.ListContainer,"List","ListContainer"),a(r.ScrollContainer,"Scroller","ScrollContainer"),a(r.emptyComponent,"EmptyPlaceholder","emptyComponent"),a(r.GroupContainer,"Group","GroupContainer"),H({},e,o,r)},o(te,le)),ce=function(t){return T.createElement("div",{style:{height:t.height}})},me={position:ee(),zIndex:1,overflowAnchor:"none"},de={overflowAnchor:"none"},fe=T.memo(function(t){var e=t.showTopList,n=void 0!==e&&e,o=Re("listState"),r=Re("deviation"),i=He("sizeRanges"),a=Re("useWindowScroll"),l=Re("customScrollParent"),s=He("windowScrollContainerState"),u=He("scrollContainerState"),c=l||a?s:u,m=Re("itemContent"),d=Re("context"),f=Re("groupContent"),p=Re("trackItemSizes"),g=Re("itemSize"),v=Re("log"),S=U(i,g,p,n?h:c,v,l),I=Re("EmptyPlaceholder"),C=Re("ScrollSeekPlaceholder")||ce,T=Re("ListComponent"),x=Re("ItemComponent"),w=Re("GroupComponent"),y=Re("computeItemKey"),b=Re("isSeeking"),R=Re("groupIndices").length>0,L=Re("paddingTopAddition"),z=Re("firstItemIndex"),k=Re("statefulTotalCount"),B=n?{}:{boxSizing:"border-box",paddingTop:o.offsetTop+L,paddingBottom:o.offsetBottom,marginTop:r};return!n&&0===k&&I?E(I,ve(I,d)):E(T,H({},ve(T,d),{ref:S,style:B,"data-test-id":n?"virtuoso-top-item-list":"virtuoso-item-list"}),(n?o.topItems:o.items).map(function(t){var e=t.originalIndex,n=y(e+z,t.data,d);return b?E(C,H({},ve(C,d),{key:n,index:t.index,height:t.size,type:t.type||"item"},"group"===t.type?{}:{groupIndex:t.groupIndex})):"group"===t.type?E(w,H({},ve(w,d),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:me}),f(t.index)):E(x,H({},ve(x,d),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,style:de}),R?m(t.index,t.groupIndex,t.data,d):m(t.index,t.data,d))}))}),pe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},he={width:"100%",height:"100%",position:"absolute",top:0},ge={width:"100%",position:ee(),top:0};function ve(t,e){if("string"!=typeof t)return{context:e}}var Se=T.memo(function(){var t=Re("HeaderComponent"),e=He("headerHeight"),n=Re("headerFooterTag"),o=V(function(t){return e(A(t,"height"))}),r=Re("context");return t?E(n,{ref:o},E(t,ve(t,r))):null}),Ie=T.memo(function(){var t=Re("FooterComponent"),e=He("footerHeight"),n=Re("headerFooterTag"),o=V(function(t){return e(A(t,"height"))}),r=Re("context");return t?E(n,{ref:o},E(t,ve(t,r))):null});function Ce(t){var e=t.usePublisher,n=t.useEmitter,o=t.useEmitterValue;return T.memo(function(t){var r=t.style,i=t.children,a=R(t,re),l=e("scrollContainerState"),s=o("ScrollerComponent"),u=e("smoothScrollTargetReached"),c=o("scrollerRef"),m=o("context"),d=W(l,u,s,c),f=d.scrollerRef,p=d.scrollByCallback;return n("scrollTo",d.scrollToCallback),n("scrollBy",p),E(s,H({ref:f,style:H({},pe,r),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},a,ve(s,m)),i)})}function Te(t){var e=t.usePublisher,n=t.useEmitter,o=t.useEmitterValue;return T.memo(function(t){var r=t.style,i=t.children,a=R(t,ie),l=e("windowScrollContainerState"),s=o("ScrollerComponent"),u=e("smoothScrollTargetReached"),c=o("totalListHeight"),m=o("deviation"),d=o("customScrollParent"),f=o("context"),p=W(l,u,s,h,d),g=p.scrollerRef,v=p.scrollByCallback,S=p.scrollToCallback;return F(function(){return g.current=d||window,function(){g.current=null}},[g,d]),n("windowScrollTo",S),n("scrollBy",v),E(s,H({style:H({position:"relative"},r,0!==c?{height:c+m}:{}),"data-virtuoso-scroller":!0},a,ve(s,f)),i)})}var xe=function(t){var e=t.children,n=He("viewportHeight"),o=V(C(n,function(t){return A(t,"height")}));return T.createElement("div",{style:he,ref:o,"data-viewport-type":"element"},e)},we=function(t){var e=t.children,n=ne(He("windowViewportRect"),Re("customScrollParent"));return T.createElement("div",{ref:n,style:he,"data-viewport-type":"window"},e)},ye=function(t){var e=t.children,n=Re("TopItemListComponent"),o=Re("headerHeight"),r=H({},ge,{marginTop:o+"px"}),i=Re("context");return E(n||"div",{style:r,context:i},e)},be=t(ue,{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",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",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},T.memo(function(t){var e=Re("useWindowScroll"),n=Re("topItemsIndexes").length>0,o=Re("customScrollParent"),r=o||e?we:xe;return T.createElement(o||e?ke:ze,H({},t),T.createElement(r,null,T.createElement(Se,null),T.createElement(fe,null),T.createElement(Ie,null)),n&&T.createElement(ye,null,T.createElement(fe,{showTopList:!0})))})),Ee=be.Component,He=be.usePublisher,Re=be.useEmitterValue,Le=be.useEmitter,ze=Ce({usePublisher:He,useEmitterValue:Re,useEmitter:Le}),ke=Te({usePublisher:He,useEmitterValue:Re,useEmitter:Le}),Be={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Fe={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Pe=Math.round,Oe=Math.ceil,Me=Math.floor,Ve=Math.min,Ue=Math.max;function Ae(t,e){return Array.from({length:e-t+1}).map(function(e,n){return{index:n+t}})}var We=e.system(function(t){var n=t[0],o=n.overscan,r=n.visibleRange,i=n.listBoundary,a=t[1],l=a.scrollTop,s=a.viewportHeight,u=a.scrollBy,c=a.scrollTo,m=a.smoothScrollTargetReached,d=a.scrollContainerState,f=t[2],p=t[3],h=t[4],g=h.propsReady,v=h.didMount,S=t[5],I=S.windowViewportRect,C=S.windowScrollTo,T=S.useWindowScroll,x=S.customScrollParent,w=S.windowScrollContainerState,y=e.statefulStream(0),b=e.statefulStream(0),E=e.statefulStream(Be),R=e.statefulStream({height:0,width:0}),L=e.statefulStream({height:0,width:0}),z=e.stream(),k=e.stream(),B=e.statefulStream(0);e.connect(e.pipe(v,e.withLatestFrom(b),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{items:Ae(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),E),e.connect(e.pipe(e.combineLatest(e.duc(y),r,e.duc(L,function(t,e){return t&&t.width===e.width&&t.height===e.height})),e.withLatestFrom(R),e.map(function(t){var e=t[0],n=e[0],o=e[1],r=o[0],i=o[1],a=e[2],l=t[1],s=a.height,u=a.width,c=l.width;if(0===n||0===c)return Be;if(0===u)return Fe;var m=Ge(c,u),d=m*Me(r/s),f=m*Oe(i/s)-1;f=Ve(n-1,f);var p=Ae(d=Ve(f,Ue(0,d)),f),h=Ne(l,a,p),g=h.top,v=h.bottom;return{items:p,offsetTop:g,offsetBottom:Oe(n/m)*s-v,top:g,bottom:v,itemHeight:s,itemWidth:u}})),E),e.connect(e.pipe(R,e.map(function(t){return t.height})),s),e.connect(e.pipe(e.combineLatest(R,L,E),e.map(function(t){var e=Ne(t[0],t[1],t[2].items);return[e.top,e.bottom]}),e.distinctUntilChanged(kt)),i);var F=e.streamFromEmitter(e.pipe(e.duc(E),e.filter(function(t){return t.items.length>0}),e.withLatestFrom(y),e.filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),e.map(function(t){return t[1]-1}),e.distinctUntilChanged())),P=e.streamFromEmitter(e.pipe(e.duc(E),e.filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),e.mapTo(0),e.distinctUntilChanged())),O=e.streamFromEmitter(e.pipe(e.duc(E),e.filter(function(t){return t.items.length>0}),e.map(function(t){var e=t.items;return{startIndex:e[0].index,endIndex:e[e.length-1].index}}),e.distinctUntilChanged(Bt)));e.connect(O,p.scrollSeekRangeChanged),e.connect(e.pipe(z,e.withLatestFrom(R,L,y),e.map(function(t){var e=t[1],n=t[2],o=t[3],r=Ct(t[0]),i=r.align,a=r.behavior,l=r.offset,s=r.index;"LAST"===s&&(s=o-1);var u=De(e,n,s=Ue(0,s,Ve(o-1,s)));return"end"===i?u=Pe(u-e.height+n.height):"center"===i&&(u=Pe(u-e.height/2+n.height/2)),l&&(u+=l),{top:u,behavior:a}})),c);var M=e.statefulStreamFromEmitter(e.pipe(E,e.map(function(t){return t.offsetBottom+t.bottom})),0);return e.connect(e.pipe(I,e.map(function(t){return{width:t.visibleWidth,height:t.visibleHeight}})),R),H({totalCount:y,viewportDimensions:R,itemDimensions:L,scrollTop:l,scrollHeight:k,overscan:o,scrollBy:u,scrollTo:c,scrollToIndex:z,smoothScrollTargetReached:m,windowViewportRect:I,windowScrollTo:C,useWindowScroll:T,customScrollParent:x,windowScrollContainerState:w,deviation:B,scrollContainerState:d,initialItemCount:b},p,{gridState:E,totalListHeight:M},f,{startReached:P,endReached:F,rangeChanged:O,propsReady:g})},e.tup(Ot,N,yt,_t,bt,Jt));function Ne(t,e,n){var o=e.height;return void 0===o||0===n.length?{top:0,bottom:0}:{top:De(t,e,n[0].index),bottom:De(t,e,n[n.length-1].index)+o}}function De(t,e,n){var o=Ge(t.width,e.width);return Me(n/o)*e.height}function Ge(t,e){return Ue(1,Me(t/e))}var _e=["placeholder"],je=e.system(function(){var t=e.statefulStream(function(t){return"Item "+t}),n=e.statefulStream({}),o=e.statefulStream(null),r=e.statefulStream("virtuoso-grid-item"),i=e.statefulStream("virtuoso-grid-list"),a=e.statefulStream(ae),l=e.statefulStream(e.noop),s=function(t,o){return void 0===o&&(o=null),e.statefulStreamFromEmitter(e.pipe(n,e.map(function(e){return e[t]}),e.distinctUntilChanged()),o)};return{context:o,itemContent:t,components:n,computeItemKey:a,itemClassName:r,listClassName:i,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Ke=e.system(function(t){var n=t[0],o=t[1],r={item:se(o.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:e.stream(),ScrollContainer:e.stream(),ListContainer:e.stream(),emptyComponent:e.stream(),scrollSeek:e.stream()};function i(t,n,r){e.connect(e.pipe(t,e.withLatestFrom(o.components),e.map(function(t){var e,o=t[0],i=t[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+n+" instead."),H({},i,((e={})[n]=o,e))})),o.components)}return e.subscribe(r.scrollSeek,function(t){var r=t.placeholder,i=R(t,_e);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),e.publish(o.components,H({},e.getValue(o.components),{ScrollSeekPlaceholder:r})),e.publish(n.scrollSeekConfiguration,i)}),i(r.ItemContainer,"Item","ItemContainer"),i(r.ListContainer,"List","ListContainer"),i(r.ScrollContainer,"Scroller","ScrollContainer"),H({},n,o,r)},e.tup(We,je)),Ye=T.memo(function(){var t=Xe("gridState"),e=Xe("listClassName"),n=Xe("itemClassName"),o=Xe("itemContent"),r=Xe("computeItemKey"),i=Xe("isSeeking"),a=Qe("scrollHeight"),l=Xe("ItemComponent"),s=Xe("ListComponent"),u=Xe("ScrollSeekPlaceholder"),c=Xe("context"),m=Qe("itemDimensions"),d=V(function(t){a(t.parentElement.parentElement.scrollHeight);var e=t.firstChild;e&&m(e.getBoundingClientRect())});return E(s,H({ref:d,className:e},ve(s,c),{style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}}),t.items.map(function(e){var a=r(e.index);return i?E(u,H({key:a},ve(u,c),{index:e.index,height:t.itemHeight,width:t.itemWidth})):E(l,H({},ve(l,c),{className:n,"data-index":e.index,key:a}),o(e.index,c))}))}),Ze=function(t){var e=t.children,n=Qe("viewportDimensions"),o=V(function(t){n(t.getBoundingClientRect())});return T.createElement("div",{style:he,ref:o},e)},qe=function(t){var e=t.children,n=ne(Qe("windowViewportRect"),Xe("customScrollParent"));return T.createElement("div",{ref:n,style:he},e)},Je=t(Ke,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},T.memo(function(t){var e=H({},t),n=Xe("useWindowScroll"),o=Xe("customScrollParent"),r=o||n?qe:Ze;return T.createElement(o||n?nn:en,H({},e),T.createElement(r,null,T.createElement(Ye,null)))})),$e=Je.Component,Qe=Je.usePublisher,Xe=Je.useEmitterValue,tn=Je.useEmitter,en=Ce({usePublisher:Qe,useEmitterValue:Xe,useEmitter:tn}),nn=Te({usePublisher:Qe,useEmitterValue:Xe,useEmitter:tn}),on=r(function(){var t=p(function(t){return T.createElement("td",null,"Item $",t)}),e=p(null),n=p(null),o=p({}),r=p(ae),i=p(h),a=function(t,e){return void 0===e&&(e=null),S(l(o,s(function(e){return e[t]}),f()),e)};return{context:e,itemContent:t,fixedHeaderContent:n,components:o,computeItemKey:r,scrollerRef:i,TableComponent:a("Table","table"),TableHeadComponent:a("TableHead","thead"),TableBodyComponent:a("TableBody","tbody"),TableRowComponent:a("TableRow","tr"),ScrollerComponent:a("Scroller","div"),EmptyPlaceholder:a("EmptyPlaceholder"),ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),FillerRow:a("FillerRow")}}),rn=r(function(t){return H({},t[0],t[1])},o(te,on)),an=function(t){return T.createElement("tr",null,T.createElement("td",{style:{height:t.height}}))},ln=function(t){return T.createElement("tr",null,T.createElement("td",{style:{height:t.height,padding:0,border:0}}))},sn=T.memo(function(){var t=pn("listState"),e=pn("deviation"),n=fn("sizeRanges"),o=pn("useWindowScroll"),r=pn("customScrollParent"),i=fn("windowScrollContainerState"),a=fn("scrollContainerState"),l=r||o?i:a,s=pn("itemContent"),u=pn("trackItemSizes"),c=U(n,pn("itemSize"),u,l,pn("log"),r),m=pn("EmptyPlaceholder"),d=pn("ScrollSeekPlaceholder")||an,f=pn("FillerRow")||ln,p=pn("TableBodyComponent"),h=pn("TableRowComponent"),g=pn("computeItemKey"),v=pn("isSeeking"),S=pn("paddingTopAddition"),I=pn("firstItemIndex"),C=pn("statefulTotalCount"),x=pn("context");if(0===C&&m)return E(m,ve(m,x));var w=t.offsetTop+S+e,y=t.offsetBottom,b=w>0?T.createElement(f,{height:w,key:"padding-top"}):null,R=y>0?T.createElement(f,{height:y,key:"padding-bottom"}):null,L=t.items.map(function(t){var e=t.originalIndex,n=g(e+I,t.data,x);return v?E(d,H({},ve(d,x),{key:n,index:t.index,height:t.size,type:t.type||"item"})):E(h,H({},ve(h,x),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:{overflowAnchor:"none"}}),s(t.index,t.data,x))});return E(p,H({ref:c,"data-test-id":"virtuoso-item-list"},ve(p,x)),[b].concat(L,[R]))}),un=function(t){var e=t.children,n=fn("viewportHeight"),o=V(C(n,function(t){return A(t,"height")}));return T.createElement("div",{style:he,ref:o,"data-viewport-type":"element"},e)},cn=function(t){var e=t.children,n=ne(fn("windowViewportRect"),pn("customScrollParent"));return T.createElement("div",{ref:n,style:he,"data-viewport-type":"window"},e)},mn=t(rn,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",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"}},T.memo(function(t){var e=pn("useWindowScroll"),n=pn("customScrollParent"),o=fn("fixedHeaderHeight"),r=pn("fixedHeaderContent"),i=pn("context"),a=V(C(o,function(t){return A(t,"height")})),l=n||e?vn:gn,s=n||e?cn:un,u=pn("TableComponent"),c=pn("TableHeadComponent"),m=r?T.createElement(c,H({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:a},ve(c,i)),r()):null;return T.createElement(l,H({},t),T.createElement(s,null,T.createElement(u,H({style:{borderSpacing:0}},ve(u,i)),[m,T.createElement(sn,{key:"TableBody"})])))})),dn=mn.Component,fn=mn.usePublisher,pn=mn.useEmitterValue,hn=mn.useEmitter,gn=Ce({usePublisher:fn,useEmitterValue:pn,useEmitter:hn}),vn=Te({usePublisher:fn,useEmitterValue:pn,useEmitter:hn}),Sn=Ee,In=Ee,Cn=dn,Tn=$e;export{In as GroupedVirtuoso,B as LogLevel,Cn as TableVirtuoso,Sn as Virtuoso,Tn as VirtuosoGrid};
|
|
1
|
+
import{systemToComponent as t}from"@virtuoso.dev/react-urx";import*as e from"@virtuoso.dev/urx";import{getValue as n,tup as o,system as r,stream as i,streamFromEmitter as a,pipe as l,map as s,connect as u,prop as c,combineLatest as m,filter as d,distinctUntilChanged as f,statefulStream as p,noop as h,subscribe as g,publish as v,statefulStreamFromEmitter as S,withLatestFrom as C,compose as I}from"@virtuoso.dev/urx";import*as T from"react";import{useLayoutEffect as w,useEffect as x,useRef as y,useCallback as b,createElement as E}from"react";import{flushSync as H}from"react-dom";function R(){return R=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},R.apply(this,arguments)}function L(t,e){if(null==t)return{};var n,o,r={},i=Object.keys(t);for(o=0;o<i.length;o++)e.indexOf(n=i[o])>=0||(r[n]=t[n]);return r}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function k(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return z(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?z(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var B,F,P="undefined"!=typeof document?w:x;!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR"}(F||(F={}));var O=((B={})[F.DEBUG]="debug",B[F.INFO]="log",B[F.WARN]="warn",B[F.ERROR]="error",B),M=e.system(function(){var t=e.statefulStream(F.ERROR);return{log:e.statefulStream(function(n,o,r){var i;void 0===r&&(r=F.INFO),r>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:e.getValue(t))&&console[O[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function V(t,e){void 0===e&&(e=!0);var n=y(null),o=function(t){};if("undefined"!=typeof ResizeObserver){var r=new ResizeObserver(function(e){var n=e[0].target;null!==n.offsetParent&&t(n)});o=function(t){t&&e?(r.observe(t),n.current=t):(n.current&&r.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:o}}function U(t,e){return void 0===e&&(e=!0),V(t,e).callbackRef}function A(t,e,n,o,r,i){return U(function(n){for(var a=function(t,e,n,o){var r=t.length;if(0===r)return null;for(var i=[],a=0;a<r;a++){var l=t.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=e(l,"offsetHeight");if(0===c&&o("Zero-sized element, this should not happen",{child:l},F.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,e,0,r),l=n.parentElement;!l.dataset.virtuosoScroller;)l=l.parentElement;var s=i?i.scrollTop:"window"===l.firstElementChild.dataset.viewportType?window.pageYOffset||document.documentElement.scrollTop:l.scrollTop;o({scrollTop:Math.max(s,0),scrollHeight:(null!=i?i:l).scrollHeight,viewportHeight:(null!=i?i:l).offsetHeight}),null!==a&&t(a)},n)}function W(t,e){return Math.round(t.getBoundingClientRect()[e])}function N(t,n,o,r,i){void 0===r&&(r=e.noop);var a=y(null),l=y(null),s=y(null),u=b(function(e){var o=e.target,r=o===window||o===document?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop,i=o===window?document.documentElement.scrollHeight:o.scrollHeight,a=o===window?window.innerHeight:o.offsetHeight;t({scrollTop:Math.max(r,0),scrollHeight:i,viewportHeight:a}),null!==l.current&&(r===l.current||r<=0||r===o.scrollHeight-W(o,"height"))&&(l.current=null,n(!0),s.current&&(clearTimeout(s.current),s.current=null))},[t,n]);return x(function(){var t=i||a.current;return r(i||a.current),u({target:t}),t.addEventListener("scroll",u,{passive:!0}),function(){r(null),t.removeEventListener("scroll",u)}},[a,u,o,r,i]),{scrollerRef:a,scrollByCallback:function(t){a.current.scrollBy(t)},scrollToCallback:function(e){var o=a.current;if(o&&(!("offsetHeight"in o)||0!==o.offsetHeight)){var r,i,u,c="smooth"===e.behavior;if(o===window?(i=Math.max(W(document.documentElement,"height"),document.documentElement.scrollHeight),r=window.innerHeight,u=document.documentElement.scrollTop):(i=o.scrollHeight,r=W(o,"height"),u=o.scrollTop),e.top=Math.ceil(Math.max(Math.min(i-r,e.top),0)),Math.abs(r-i)<1.01||e.top===u)return t({scrollTop:u,scrollHeight:i,viewportHeight:r}),void(c&&n(!0));c?(l.current=e.top,s.current&&clearTimeout(s.current),s.current=setTimeout(function(){s.current=null,l.current=null,n(!0)},1e3)):l.current=null,o.scrollTo(e)}}}}var D=e.system(function(){var t=e.stream(),n=e.stream(),o=e.statefulStream(0),r=e.stream(),i=e.statefulStream(0),a=e.stream(),l=e.stream(),s=e.statefulStream(0),u=e.statefulStream(0),c=e.stream(),m=e.stream(),d=e.statefulStream(!1),f=e.statefulStream(!1);return e.connect(e.pipe(t,e.map(function(t){return t.scrollTop})),n),e.connect(e.pipe(t,e.map(function(t){return t.scrollHeight})),l),e.connect(n,i),{scrollContainerState:t,scrollTop:n,viewportHeight:a,headerHeight:s,footerHeight:u,scrollHeight:l,smoothScrollTargetReached:r,react18ConcurrentRendering:f,scrollTo:c,scrollBy:m,statefulScrollTop:i,deviation:o,scrollingInProgress:d}},[],{singleton:!0}),G={lvl:0};function _(t,e,n,o,r){return void 0===o&&(o=G),void 0===r&&(r=G),{k:t,v:e,lvl:n,l:o,r:r}}function j(t){return t===G}function K(){return G}function Y(t,e){if(j(t))return G;var n=t.k,o=t.l,r=t.r;if(e===n){if(j(o))return r;if(j(r))return o;var i=Q(o);return nt(tt(t,{k:i[0],v:i[1],l:X(o)}))}return nt(tt(t,e<n?{l:Y(o,e)}:{r:Y(r,e)}))}function Z(t,e,n){if(void 0===n&&(n="k"),j(t))return[-Infinity,void 0];if(t[n]===e)return[t.k,t.v];if(t[n]<e){var o=Z(t.r,e,n);return-Infinity===o[0]?[t.k,t.v]:o}return Z(t.l,e,n)}function q(t,e,n){return j(t)?_(e,n,1):e===t.k?tt(t,{k:e,v:n}):function(t){return it(at(t))}(tt(t,e<t.k?{l:q(t.l,e,n)}:{r:q(t.r,e,n)}))}function J(t,e,n){if(j(t))return[];var o=t.k,r=t.v,i=t.r,a=[];return o>e&&(a=a.concat(J(t.l,e,n))),o>=e&&o<=n&&a.push({k:o,v:r}),o<=n&&(a=a.concat(J(i,e,n))),a}function $(t){return j(t)?[]:[].concat($(t.l),[{k:t.k,v:t.v}],$(t.r))}function Q(t){return j(t.r)?[t.k,t.v]:Q(t.r)}function X(t){return j(t.r)?t.l:nt(tt(t,{r:X(t.r)}))}function tt(t,e){return _(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function et(t){return j(t)||t.lvl>t.r.lvl}function nt(t){var e=t.l,n=t.r,o=t.lvl;if(n.lvl>=o-1&&e.lvl>=o-1)return t;if(o>n.lvl+1){if(et(e))return at(tt(t,{lvl:o-1}));if(j(e)||j(e.r))throw new Error("Unexpected empty nodes");return tt(e.r,{l:tt(e,{r:e.r.l}),r:tt(t,{l:e.r.r,lvl:o-1}),lvl:o})}if(et(t))return it(tt(t,{lvl:o-1}));if(j(n)||j(n.l))throw new Error("Unexpected empty nodes");var r=n.l,i=et(r)?n.lvl-1:n.lvl;return tt(r,{l:tt(t,{r:r.l,lvl:o-1}),r:it(tt(n,{l:r.r,lvl:i})),lvl:r.lvl+1})}function ot(t,e,n){return j(t)?[]:rt(J(t,Z(t,e)[0],n),function(t){return{index:t.k,value:t.v}})}function rt(t,e){var n=t.length;if(0===n)return[];for(var o=e(t[0]),r=o.index,i=o.value,a=[],l=1;l<n;l++){var s=e(t[l]),u=s.index,c=s.value;a.push({start:r,end:u-1,value:i}),r=u,i=c}return a.push({start:r,end:Infinity,value:i}),a}function it(t){var e=t.r,n=t.lvl;return j(e)||j(e.r)||e.lvl!==n||e.r.lvl!==n?t:tt(e,{l:tt(t,{r:e.l}),lvl:n+1})}function at(t){var e=t.l;return j(e)||e.lvl!==t.lvl?t:tt(e,{r:tt(t,{l:e.r})})}function lt(t,e,n,o){void 0===o&&(o=0);for(var r=t.length-1;o<=r;){var i=Math.floor((o+r)/2),a=n(t[i],e);if(0===a)return i;if(-1===a){if(r-o<2)return i-1;r=i-1}else{if(r===o)return i;o=i+1}}throw new Error("Failed binary finding record in array - "+t.join(",")+", searched for "+e)}function st(t,e,n){return t[lt(t,e,n)]}function ut(t){var e=t.size,n=t.startIndex,o=t.endIndex;return function(t){return t.start===n&&(t.end===o||Infinity===t.end)&&t.value===e}}function ct(t,e){var n=t.index;return e===n?0:e<n?-1:1}function mt(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function dt(t){return{index:t.index,value:t}}function ft(t,e,n){var o=t,r=0,i=0,a=0,l=0;if(0!==e){a=o[l=lt(o,e-1,ct)].offset;var s=Z(n,e-1);r=s[0],i=s[1],o.length&&o[l].size===Z(n,e)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(var u,c=k(ot(n,e,Infinity));!(u=c()).done;){var m=u.value,d=m.start,f=m.value,p=(d-r)*i+a;o.push({offset:p,size:f,index:d}),r=d,a=p,i=f}return{offsetTree:o,lastIndex:r,lastOffset:a,lastSize:i}}function pt(t,e){var n=e[0],o=e[1];n.length>0&&(0,e[2])("received item sizes",n,F.DEBUG);var r=t.sizeTree,i=r,a=0;if(o.length>0&&j(r)&&2===n.length){var l=n[0].size,s=n[1].size;i=o.reduce(function(t,e){return q(q(t,e,l),e+1,s)},i)}else{var u=function(t,e){for(var n,o=j(t)?0:Infinity,r=k(e);!(n=r()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(o=Math.min(o,l),j(t))t=q(t,0,a);else{var u=ot(t,l-1,s+1);if(!u.some(ut(i))){for(var c,m=!1,d=!1,f=k(u);!(c=f()).done;){var p=c.value,h=p.start,g=p.end,v=p.value;m?(s>=h||a===v)&&(t=Y(t,h)):(d=v!==a,m=!0),g>s&&s>=h&&v!==a&&(t=q(t,s+1,v))}d&&(t=q(t,l,a))}}}return[t,o]}(i,n);i=u[0],a=u[1]}if(i===r)return t;var c=ft(t.offsetTree,a,i),m=c.offsetTree;return{sizeTree:i,offsetTree:m,lastIndex:c.lastIndex,lastOffset:c.lastOffset,lastSize:c.lastSize,groupOffsetTree:o.reduce(function(t,e){return q(t,e,ht(e,m))},K()),groupIndices:o}}function ht(t,e){if(0===e.length)return 0;var n=st(e,t,ct);return n.size*(t-n.index)+n.offset}function gt(t,e){if(!vt(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function vt(t){return!j(t.groupOffsetTree)}var St={offsetHeight:"height",offsetWidth:"width"},Ct=e.system(function(t){var n=t[0].log,o=e.stream(),r=e.stream(),i=e.statefulStreamFromEmitter(r,0),a=e.stream(),l=e.stream(),s=e.statefulStream(0),u=e.statefulStream([]),c=e.statefulStream(void 0),m=e.statefulStream(void 0),d=e.statefulStream(function(t,e){return W(t,St[e])}),f=e.statefulStream(void 0),p={offsetTree:[],sizeTree:K(),groupOffsetTree:K(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},h=e.statefulStreamFromEmitter(e.pipe(o,e.withLatestFrom(u,n),e.scan(pt,p),e.distinctUntilChanged()),p);e.connect(e.pipe(u,e.filter(function(t){return t.length>0}),e.withLatestFrom(h),e.map(function(t){var e=t[0],n=t[1],o=e.reduce(function(t,e,o){return q(t,e,ht(e,n.offsetTree)||o)},K());return R({},n,{groupIndices:e,groupOffsetTree:o})})),h),e.connect(e.pipe(r,e.withLatestFrom(h),e.filter(function(t){return t[0]<t[1].lastIndex}),e.map(function(t){var e=t[1];return[{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),o),e.connect(c,m);var g=e.statefulStreamFromEmitter(e.pipe(c,e.map(function(t){return void 0===t})),!0);e.connect(e.pipe(m,e.filter(function(t){return void 0!==t&&j(e.getValue(h).sizeTree)}),e.map(function(t){return[{startIndex:0,endIndex:0,size:t}]})),o);var v=e.streamFromEmitter(e.pipe(o,e.withLatestFrom(h),e.scan(function(t,e){var n=e[1];return{changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:p}),e.map(function(t){return t.changed})));e.subscribe(e.pipe(s,e.scan(function(t,e){return{diff:t.prev-e,prev:e}},{diff:0,prev:0}),e.map(function(t){return t.diff})),function(t){t>0?e.publish(a,t):t<0&&e.publish(l,t)}),e.subscribe(e.pipe(s,e.withLatestFrom(n)),function(t){t[0]<0&&(0,t[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},F.ERROR)});var S=e.streamFromEmitter(a);e.connect(e.pipe(a,e.withLatestFrom(h),e.map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return $(n.sizeTree).reduce(function(t,n){var o=n.k,r=n.v;return{ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:o+e-1,size:t.prevSize}]),prevIndex:o+e,prevSize:r}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),o);var C=e.streamFromEmitter(e.pipe(l,e.withLatestFrom(h),e.map(function(t){return ht(-t[0],t[1].offsetTree)})));return e.connect(e.pipe(l,e.withLatestFrom(h),e.map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var o=$(n.sizeTree).reduce(function(t,n){var o=n.v;return q(t,Math.max(0,n.k+e),o)},K());return R({},n,{sizeTree:o},ft(n.offsetTree,0,o))})),h),{data:f,totalCount:r,sizeRanges:o,groupIndices:u,defaultItemSize:m,fixedItemSize:c,unshiftWith:a,shiftWith:l,shiftWithOffset:C,beforeUnshiftWith:S,firstItemIndex:s,sizes:h,listRefresh:v,statefulTotalCount:i,trackItemSizes:g,itemSize:d}},e.tup(M),{singleton:!0}),It="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function Tt(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&It||(e.behavior="auto"),e.offset||(e.offset=0),e}var wt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=n.listRefresh,a=t[1],l=a.scrollingInProgress,s=a.viewportHeight,u=a.scrollTo,c=a.smoothScrollTargetReached,m=a.headerHeight,d=a.footerHeight,f=t[2].log,p=e.stream(),h=e.statefulStream(0),g=null,v=null,S=null;function C(){g&&(g(),g=null),S&&(S(),S=null),v&&(clearTimeout(v),v=null),e.publish(l,!1)}return e.connect(e.pipe(p,e.withLatestFrom(o,s,r,h,m,d,f),e.map(function(t){var n=t[0],o=t[1],r=t[2],a=t[3],s=t[4],u=t[5],m=t[6],d=t[7],f=Tt(n),h=f.align,I=f.behavior,T=f.offset,w=a-1,x=f.index;"LAST"===x&&(x=w),x=gt(x,o);var y=ht(x=Math.max(0,x,Math.min(w,x)),o.offsetTree)+u;"end"===h?(y=y-r+Z(o.sizeTree,x)[1],x===w&&(y+=m)):"center"===h?y=y-r/2+Z(o.sizeTree,x)[1]/2:y-=s,T&&(y+=T);var b=function(t){C(),t?(d("retrying to scroll to",{location:n},F.DEBUG),e.publish(p,n)):d("list did not change, scroll successful",{},F.DEBUG)};if(C(),"smooth"===I){var E=!1;S=e.subscribe(i,function(t){E=E||t}),g=e.handleNext(c,function(){b(E)})}else g=e.handleNext(e.pipe(i,function(t){var e=setTimeout(function(){t(!1)},50);return function(n){n&&(t(!0),clearTimeout(e))}}),b);return v=setTimeout(function(){C()},1200),e.publish(l,!0),d("scrolling from index to",{index:x,top:y,behavior:I},F.DEBUG),{top:y,behavior:I}})),u),{scrollToIndex:p,topListHeight:h}},e.tup(Ct,D,M),{singleton:!0}),xt="up",yt={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},bt=e.system(function(t){var n=t[0],o=n.scrollContainerState,r=n.scrollTop,i=n.viewportHeight,a=n.headerHeight,l=n.footerHeight,s=n.scrollBy,u=e.statefulStream(!1),c=e.statefulStream(!0),m=e.stream(),d=e.stream(),f=e.statefulStream(4),p=e.streamFromEmitter(e.pipe(e.merge(e.pipe(e.duc(r),e.skip(1),e.mapTo(!0)),e.pipe(e.duc(r),e.skip(1),e.mapTo(!1),e.debounceTime(100))),e.distinctUntilChanged())),h=e.statefulStreamFromEmitter(e.pipe(e.merge(e.pipe(s,e.mapTo(!0)),e.pipe(s,e.mapTo(!1),e.debounceTime(200))),e.distinctUntilChanged()),!1);e.connect(e.pipe(e.duc(r),e.map(function(t){return 0===t}),e.distinctUntilChanged()),c),e.connect(c,d);var g=e.streamFromEmitter(e.pipe(e.combineLatest(o,e.duc(i),e.duc(a),e.duc(l),e.duc(f)),e.scan(function(t,e){var n,o,r=e[0],i=r.scrollTop,a=r.scrollHeight,l=e[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-e[4]?(i>t.state.scrollTop?(n="SCROLLED_DOWN",o=t.state.scrollTop-i):(n="SIZE_DECREASED",o=t.state.scrollTop-i||t.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:o}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>t.state.scrollHeight?"SIZE_INCREASED":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},yt),e.distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom}))),v=e.statefulStreamFromEmitter(e.pipe(o,e.scan(function(t,e){var n=e.scrollTop,o=e.scrollHeight;return t.scrollHeight!==o?t.scrollTop!==n&&n===o-e.viewportHeight?{scrollHeight:o,scrollTop:n,jump:t.scrollTop-n,changed:!0}:{scrollHeight:o,scrollTop:n,jump:0,changed:!0}:{scrollTop:n,scrollHeight:o,jump:0,changed:!1}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),e.filter(function(t){return t.changed}),e.map(function(t){return t.jump})),0);e.connect(e.pipe(g,e.map(function(t){return t.atBottom})),u),e.connect(e.pipe(u,e.throttleTime(50)),m);var S=e.statefulStream("down");e.connect(e.pipe(o,e.map(function(t){return t.scrollTop}),e.distinctUntilChanged(),e.scan(function(t,n){return e.getValue(h)?{direction:t.direction,prevScrollTop:n}:{direction:n<t.prevScrollTop?xt:"down",prevScrollTop:n}},{direction:"down",prevScrollTop:0}),e.map(function(t){return t.direction})),S),e.connect(e.pipe(o,e.throttleTime(50),e.mapTo("none")),S);var C=e.statefulStream(0);return e.connect(e.pipe(p,e.filter(function(t){return!t}),e.mapTo(0)),C),e.connect(e.pipe(r,e.throttleTime(100),e.withLatestFrom(p),e.filter(function(t){return!!t[1]}),e.scan(function(t,e){return[t[1],e[0]]},[0,0]),e.map(function(t){return t[1]-t[0]})),C),{isScrolling:p,isAtTop:c,isAtBottom:u,atBottomState:g,atTopStateChange:d,atBottomStateChange:m,scrollDirection:S,atBottomThreshold:f,scrollVelocity:C,lastJumpDueToItemResize:v}},e.tup(D)),Et=e.system(function(t){var o=t[0].log,r=e.statefulStream(!1),i=e.streamFromEmitter(e.pipe(r,e.filter(function(t){return t}),e.distinctUntilChanged()));return e.subscribe(r,function(t){t&&n(o)("props updated",{},F.DEBUG)}),{propsReady:r,didMount:i}},o(M),{singleton:!0}),Ht=e.system(function(t){var n=t[0],o=n.sizes,r=n.listRefresh,i=n.defaultItemSize,a=t[1].scrollTop,l=t[2].scrollToIndex,s=t[3].didMount,u=e.statefulStream(!0),c=e.statefulStream(0);return e.connect(e.pipe(s,e.withLatestFrom(c),e.filter(function(t){return!!t[1]}),e.mapTo(!1)),u),e.subscribe(e.pipe(e.combineLatest(r,s),e.withLatestFrom(u,o,i),e.filter(function(t){var e=t[1],n=t[3];return t[0][1]&&(!j(t[2].sizeTree)||void 0!==n)&&!e}),e.withLatestFrom(c)),function(t){var n=t[1];setTimeout(function(){e.handleNext(a,function(){e.publish(u,!0)}),e.publish(l,n)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},e.tup(Ct,D,wt,Et),{singleton:!0});function Rt(t){return!!t&&("smooth"===t?"smooth":"auto")}var Lt=e.system(function(t){var n=t[0],o=n.totalCount,r=n.listRefresh,i=t[1],a=i.isAtBottom,l=i.atBottomState,s=t[2].scrollToIndex,u=t[3].scrolledToInitialItem,c=t[4],m=c.propsReady,d=c.didMount,f=t[5].log,p=t[6].scrollingInProgress,h=e.statefulStream(!1),g=null;function v(t){e.publish(s,{index:"LAST",align:"end",behavior:t})}return e.subscribe(e.pipe(e.combineLatest(e.pipe(e.duc(o),e.skip(1)),d),e.withLatestFrom(e.duc(h),a,u,p),e.map(function(t){var e=t[0],n=e[0],o=e[1]&&t[3],r="auto";return o&&(r=function(t,e){return"function"==typeof t?Rt(t(e)):e&&Rt(t)}(t[1],t[2]||t[4]),o=o&&!!r),{totalCount:n,shouldFollow:o,followOutputBehavior:r}}),e.filter(function(t){return t.shouldFollow})),function(t){var n=t.totalCount,o=t.followOutputBehavior;g&&(g(),g=null),g=e.handleNext(r,function(){e.getValue(f)("following output to ",{totalCount:n},F.DEBUG),v(o),g=null})}),e.subscribe(e.pipe(e.combineLatest(e.duc(h),o,m),e.filter(function(t){return t[0]&&t[2]}),e.scan(function(t,e){var n=e[1];return{refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),e.filter(function(t){return t.refreshed}),e.withLatestFrom(h,o)),function(t){var n=t[1],o=e.handleNext(l,function(t){!n||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||g||(e.getValue(f)("scrolling to bottom due to increased size",{},F.DEBUG),v("auto"))});setTimeout(o,100)}),e.subscribe(e.combineLatest(e.duc(h),l),function(t){var e=t[1];t[0]&&!e.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===e.notAtBottomBecause&&v("auto")}),{followOutput:h}},e.tup(Ct,bt,wt,Ht,Et,M,D));function zt(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var kt=r(function(t){var e=t[0],n=e.totalCount,o=e.groupIndices,r=e.sizes,p=t[1],h=p.scrollTop,g=p.headerHeight,v=i(),S=i(),C=a(l(v,s(zt)));return u(l(C,s(c("totalCount"))),n),u(l(C,s(c("groupIndices"))),o),u(l(m(h,r,g),d(function(t){return vt(t[1])}),s(function(t){return Z(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),f(),s(function(t){return[t]})),S),{groupCounts:v,topItemsIndexes:S}},o(Ct,D));function Bt(t,e){return!(!t||t[0]!==e[0]||t[1]!==e[1])}function Ft(t,e){return!(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}function Pt(t,e,n){return"number"==typeof t?n===xt&&"top"===e||"down"===n&&"bottom"===e?t:0:n===xt?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse}function Ot(t,e){return"number"==typeof t?t:t[e]||0}var Mt=e.system(function(t){var n=t[0],o=n.scrollTop,r=n.viewportHeight,i=n.deviation,a=n.headerHeight,l=e.stream(),s=e.statefulStream(0),u=e.statefulStream(0),c=e.statefulStream(0),m=e.statefulStream(0),d=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(e.duc(o),e.duc(r),e.duc(a),e.duc(l,Bt),e.duc(m),e.duc(s),e.duc(u),e.duc(i),e.duc(c)),e.map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=r[0],a=r[1],l=t[4],s=t[6],u=t[7],c=t[8],m=e-u,d=t[5]+s,f=Math.max(o-m,0),p="none",h=Ot(c,"top"),g=Ot(c,"bottom");return i-=u,a+=o+s,(i+=o+s)>e+d-h&&(p=xt),(a-=u)<e-f+n+g&&(p="down"),"none"!==p?[Math.max(m-o-Pt(l,"top",p)-h,0),m-f-s+n+Pt(l,"bottom",p)+g]:null}),e.filter(function(t){return null!=t}),e.distinctUntilChanged(Bt)),[0,0]);return{listBoundary:l,overscan:m,topListHeight:s,fixedHeaderHeight:u,increaseViewportBy:c,visibleRange:d}},e.tup(D),{singleton:!0}),Vt={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0};function Ut(t,e,n){if(0===t.length)return[];if(!vt(e))return t.map(function(t){return R({},t,{index:t.index+n,originalIndex:t.index})});for(var o,r=[],i=ot(e.groupOffsetTree,t[0].index,t[t.length-1].index),a=void 0,l=0,s=k(t);!(o=s()).done;){var u=o.value;(!a||a.end<u.index)&&(a=i.shift(),l=e.groupIndices.indexOf(a.start)),r.push(R({},u.index===a.start?{type:"group",index:l}:{index:u.index-(l+1)+n,groupIndex:l},{size:u.size,offset:u.offset,originalIndex:u.index,data:u.data}))}return r}function At(t,e,n,o,r){var i=0,a=0;if(t.length>0){i=t[0].offset;var l=t[t.length-1];a=l.offset+l.size}var s=i,u=o.lastOffset+(n-o.lastIndex)*o.lastSize-a;return{items:Ut(t,o,r),topItems:Ut(e,o,r),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:i,offsetBottom:u,top:s,bottom:a,totalCount:n}}var Wt,Nt,Dt,Gt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=n.data,a=n.firstItemIndex,l=t[1],s=t[2],u=s.visibleRange,c=s.listBoundary,m=s.topListHeight,d=t[3],f=d.scrolledToInitialItem,p=d.initialTopMostItemIndex,h=t[4].topListHeight,g=t[5],v=t[6].didMount,S=e.statefulStream([]),C=e.stream();e.connect(l.topItemsIndexes,S);var I=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(v,e.duc(u),e.duc(r),e.duc(o),e.duc(p),f,e.duc(S),e.duc(a),i),e.filter(function(t){return t[0]}),e.map(function(t){var n=t[1],o=n[0],r=n[1],i=t[2],a=t[4],l=t[5],s=t[6],u=t[7],c=t[8],m=t[3],d=m.sizeTree,f=m.offsetTree;if(0===i||0===o&&0===r)return Vt;if(j(d))return At(function(t,e,n){if(vt(e)){var o=gt(t,e);return[{index:Z(e.groupOffsetTree,o)[0],size:0,offset:0},{index:o,size:0,offset:0,data:n&&n[0]}]}return[{index:t,size:0,offset:0,data:n&&n[0]}]}(function(t,e){return"number"==typeof t?t:"LAST"===t.index?e-1:t.index}(a,i),m,c),[],i,m,u);var p=[];if(s.length>0)for(var h,g=s[0],v=s[s.length-1],S=0,C=k(ot(d,g,v));!(h=C()).done;)for(var I=h.value,T=I.value,w=Math.max(I.start,g),x=Math.min(I.end,v),y=w;y<=x;y++)p.push({index:y,size:T,offset:S,data:c&&c[y]}),S+=T;if(!l)return At([],p,i,m,u);var b=s.length>0?s[s.length-1]+1:0,E=function(t,e,n,o){return void 0===o&&(o=0),o>0&&(e=Math.max(e,st(t,o,ct).offset)),rt((i=n,l=lt(r=t,e,a=mt),s=lt(r,i,a,l),r.slice(l,s+1)),dt);var r,i,a,l,s}(f,o,r,b);if(0===E.length)return null;var H=i-1;return At(e.tap([],function(t){for(var e,n=k(E);!(e=n()).done;){var i=e.value,a=i.value,l=a.offset,s=i.start,u=a.size;a.offset<o&&(l+=((s+=Math.floor((o-a.offset)/u))-i.start)*u),s<b&&(l+=(b-s)*u,s=b);for(var m=Math.min(i.end,H),d=s;d<=m&&!(l>=r);d++)t.push({index:d,size:u,offset:l,data:c&&c[d]}),l+=u}}),p,i,m,u)}),e.filter(function(t){return null!==t}),e.distinctUntilChanged()),Vt);return e.connect(e.pipe(i,e.filter(function(t){return void 0!==t}),e.map(function(t){return t.length})),r),e.connect(e.pipe(I,e.map(e.prop("topListHeight"))),h),e.connect(h,m),e.connect(e.pipe(I,e.map(function(t){return[t.top,t.bottom]})),c),e.connect(e.pipe(I,e.map(function(t){return t.items})),C),R({listState:I,topItemsIndexes:S,endReached:e.streamFromEmitter(e.pipe(I,e.filter(function(t){return t.items.length>0}),e.withLatestFrom(r,i),e.filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),e.map(function(t){return[t[1]-1,t[2]]}),e.distinctUntilChanged(Bt),e.map(function(t){return t[0]}))),startReached:e.streamFromEmitter(e.pipe(I,e.throttleTime(200),e.filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),e.map(function(t){return t.items[0].index}),e.distinctUntilChanged())),rangeChanged:e.streamFromEmitter(e.pipe(I,e.filter(function(t){return t.items.length>0}),e.map(function(t){var e=t.items;return{startIndex:e[0].index,endIndex:e[e.length-1].index}}),e.distinctUntilChanged(Ft))),itemsRendered:C},g)},e.tup(Ct,kt,Mt,Ht,wt,bt,Et),{singleton:!0}),_t=e.system(function(t){var n=t[0],o=n.sizes,r=n.firstItemIndex,i=n.data,a=t[1].listState,l=t[2].didMount,s=e.statefulStream(0);return e.connect(e.pipe(l,e.withLatestFrom(s),e.filter(function(t){return 0!==t[1]}),e.withLatestFrom(o,r,i),e.map(function(t){var e=t[0][1],n=t[1],o=t[2],r=t[3],i=void 0===r?[]:r,a=0;if(n.groupIndices.length>0)for(var l,s=k(n.groupIndices);!((l=s()).done||l.value-a>=e);)a++;var u=e+a;return At(Array.from({length:u}).map(function(t,e){return{index:e,size:0,offset:0,data:i[e]}}),[],u,n,o)})),a),{initialItemCount:s}},e.tup(Ct,Gt,Et),{singleton:!0}),jt=e.system(function(t){var n=t[0].scrollVelocity,o=e.statefulStream(!1),r=e.stream(),i=e.statefulStream(!1);return e.connect(e.pipe(n,e.withLatestFrom(i,o,r),e.filter(function(t){return!!t[1]}),e.map(function(t){var e=t[0],n=t[1],o=t[2],r=t[3],i=n.enter;if(o){if((0,n.exit)(e,r))return!1}else if(i(e,r))return!0;return o}),e.distinctUntilChanged()),o),e.subscribe(e.pipe(e.combineLatest(o,n,r),e.withLatestFrom(i)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:o,scrollSeekConfiguration:i,scrollVelocity:n,scrollSeekRangeChanged:r}},e.tup(bt),{singleton:!0}),Kt=r(function(t){var e=t[0].topItemsIndexes,n=p(0);return u(l(n,d(function(t){return t>0}),s(function(t){return Array.from({length:t}).map(function(t,e){return e})})),e),{topItemCount:n}},o(Gt)),Yt=e.system(function(t){var n=t[0],o=n.footerHeight,r=n.headerHeight,i=t[1].listState,a=e.stream(),l=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(o,r,i),e.map(function(t){var e=t[2];return t[0]+t[1]+e.offsetBottom+e.bottom})),0);return e.connect(e.duc(l),a),{totalListHeight:l,totalListHeightChanged:a}},e.tup(D,Gt),{singleton:!0}),Zt=e.system(function(t){var n=t[0],o=n.scrollBy,r=n.scrollTop,i=n.deviation,a=n.scrollingInProgress,l=t[1],s=l.isScrolling,u=l.isAtBottom,c=l.atBottomState,m=l.scrollDirection,d=t[3],f=d.beforeUnshiftWith,p=d.shiftWithOffset,h=d.sizes,g=t[4].log,v=e.streamFromEmitter(e.pipe(t[2].listState,e.withLatestFrom(l.lastJumpDueToItemResize),e.scan(function(t,e){var n=t[1],o=e[0],r=o.items,i=o.totalCount,a=o.bottom+o.offsetBottom,l=0;return t[2]===i&&n.length>0&&r.length>0&&(0===r[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-t[3])&&(l+=e[1])),[l,r,i,a]},[0,[],0,0]),e.filter(function(t){return 0!==t[0]}),e.withLatestFrom(r,m,a,g,u,c),e.filter(function(t){return!t[3]&&0!==t[1]&&t[2]===xt}),e.map(function(t){var e=t[0][0];return(0,t[4])("Upward scrolling compensation",{amount:e},F.DEBUG),e})));return e.connect(e.pipe(v,e.withLatestFrom(i),e.map(function(t){return t[1]-t[0]})),i),e.subscribe(e.pipe(e.combineLatest(e.statefulStreamFromEmitter(s,!1),i),e.filter(function(t){return!t[0]&&0!==t[1]}),e.map(function(t){return t[1]}),e.throttleTime(1)),function(t){t>0?(e.publish(o,{top:-t,behavior:"auto"}),e.publish(i,0)):(e.publish(i,0),e.publish(o,{top:-t,behavior:"auto"}))}),e.connect(e.pipe(p,e.map(function(t){return{top:-t}})),o),e.connect(e.pipe(f,e.withLatestFrom(h),e.map(function(t){return t[0]*t[1].lastSize})),v),{deviation:i}},e.tup(D,bt,Gt,Ct,M)),qt=e.system(function(t){var n=t[0].totalListHeight,o=t[1].didMount,r=t[2].scrollTo,i=e.statefulStream(0);return e.subscribe(e.pipe(o,e.withLatestFrom(i),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{top:t[1]}})),function(t){e.handleNext(e.pipe(n,e.filter(function(t){return 0!==t})),function(){setTimeout(function(){e.publish(r,t)})})}),{initialScrollTop:i}},e.tup(Yt,Et,D),{singleton:!0}),Jt=e.system(function(t){var n=t[0].viewportHeight,o=t[1].totalListHeight,r=e.statefulStream(!1);return{alignToBottom:r,paddingTopAddition:e.statefulStreamFromEmitter(e.pipe(e.combineLatest(r,n,o),e.filter(function(t){return t[0]}),e.map(function(t){return Math.max(0,t[1]-t[2])}),e.distinctUntilChanged()),0)}},e.tup(D,Yt),{singleton:!0}),$t=e.system(function(t){var n=t[0],o=n.scrollTo,r=n.scrollContainerState,i=e.stream(),a=e.stream(),l=e.stream(),s=e.statefulStream(!1),u=e.statefulStream(void 0);return e.connect(e.pipe(e.combineLatest(i,a),e.map(function(t){var e=t[0],n=e.viewportHeight,o=e.scrollHeight;return{scrollTop:Math.max(0,e.scrollTop-t[1].offsetTop),scrollHeight:o,viewportHeight:n}})),r),e.connect(e.pipe(o,e.withLatestFrom(a),e.map(function(t){var e=t[0];return R({},e,{top:e.top+t[1].offsetTop})})),l),{useWindowScroll:s,customScrollParent:u,windowScrollContainerState:i,windowViewportRect:a,windowScrollTo:l}},e.tup(D)),Qt=e.system(function(t){var n=t[0],o=n.sizes,r=n.totalCount,i=t[1],a=i.scrollTop,l=i.viewportHeight,s=i.headerHeight,u=i.scrollingInProgress,c=t[2].scrollToIndex,m=e.stream();return e.connect(e.pipe(m,e.withLatestFrom(o,l,r,s,a),e.map(function(t){var n=t[0],o=n.index,r=n.behavior,i=void 0===r?"auto":r,a=n.done,l=t[1],s=t[2],c=t[4],m=t[5],d=t[3]-1,f=null;o=gt(o,l);var p=ht(o=Math.max(0,o,Math.min(d,o)),l.offsetTree)+c;return p<m?f={index:o,behavior:i,align:"start"}:p+Z(l.sizeTree,o)[1]>m+s&&(f={index:o,behavior:i,align:"end"}),f?a&&e.handleNext(e.pipe(u,e.skip(1),e.filter(function(t){return!1===t})),a):a&&a(),f}),e.filter(function(t){return null!==t})),c),{scrollIntoView:m}},e.tup(Ct,D,wt,Gt,M),{singleton:!0}),Xt=["listState","topItemsIndexes"],te=e.system(function(t){return R({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},e.tup(Mt,_t,Et,jt,Yt,qt,Jt,$t,Qt)),ee=e.system(function(t){var n=t[0],o=n.totalCount,r=n.sizeRanges,i=n.fixedItemSize,a=n.defaultItemSize,l=n.trackItemSizes,s=n.itemSize,u=n.data,c=n.firstItemIndex,m=n.groupIndices,d=n.statefulTotalCount,f=t[1],p=f.initialTopMostItemIndex,h=f.scrolledToInitialItem,g=t[2],v=t[3],S=t[4],C=S.listState,I=S.topItemsIndexes,T=L(S,Xt),w=t[5].scrollToIndex,x=t[7].topItemCount,y=t[8].groupCounts,b=t[9],E=t[10];return e.connect(T.rangeChanged,b.scrollSeekRangeChanged),e.connect(e.pipe(b.windowViewportRect,e.map(e.prop("visibleHeight"))),g.viewportHeight),R({totalCount:o,data:u,firstItemIndex:c,sizeRanges:r,initialTopMostItemIndex:p,scrolledToInitialItem:h,topItemsIndexes:I,topItemCount:x,groupCounts:y,fixedItemHeight:i,defaultItemHeight:a},v,{statefulTotalCount:d,listState:C,scrollToIndex:w,trackItemSizes:l,itemSize:s,groupIndices:m},T,b,g,E)},e.tup(Ct,Ht,D,Lt,Gt,wt,Zt,Kt,kt,te,M)),ne=(Wt=function(){if("undefined"==typeof document)return"sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"},Dt=!1,function(){return Dt||(Dt=!0,Nt=Wt()),Nt});function oe(t,e){var n=y(null),o=b(function(o){if(null!==o){var r,i,a=o.getBoundingClientRect(),l=a.width;if(e){var s=e.getBoundingClientRect(),u=a.top-s.top;r=s.height-Math.max(0,u),i=u+e.scrollTop}else r=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;n.current={offsetTop:i,visibleHeight:r,visibleWidth:l},t(n.current)}},[t,e]),r=V(o),i=r.callbackRef,a=r.ref,l=b(function(){o(a.current)},[o,a]);return x(function(){if(e){e.addEventListener("scroll",l);var t=new ResizeObserver(l);return t.observe(e),function(){e.removeEventListener("scroll",l),t.unobserve(e)}}return window.addEventListener("scroll",l),window.addEventListener("resize",l),function(){window.removeEventListener("scroll",l),window.removeEventListener("resize",l)}},[l,e]),i}function re(t){return t?H:function(t){return t()}}var ie=["placeholder"],ae=["style","children"],le=["style","children"];function se(t){return t}var ue=r(function(){var t=p(function(t){return"Item "+t}),e=p(null),n=p(function(t){return"Group "+t}),o=p({}),r=p(se),i=p("div"),a=p(h),u=function(t,e){return void 0===e&&(e=null),S(l(o,s(function(e){return e[t]}),f()),e)};return{context:e,itemContent:t,groupContent:n,components:o,computeItemKey:r,headerFooterTag:i,scrollerRef:a,FooterComponent:u("Footer"),HeaderComponent:u("Header"),TopItemListComponent:u("TopItemList"),ListComponent:u("List","div"),ItemComponent:u("Item","div"),GroupComponent:u("Group","div"),ScrollerComponent:u("Scroller","div"),EmptyPlaceholder:u("EmptyPlaceholder"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder")}});function ce(t,e){var n=i();return g(n,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+e,"color: red;","color: inherit;","color: blue;")}),u(n,t),n}var me=r(function(t){var e=t[0],o=t[1],r={item:ce(o.itemContent,"Rename the %citem%c prop to %citemContent."),group:ce(o.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:ce(e.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:ce(e.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:ce(e.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:i(),maxHeightCacheSize:i(),footer:i(),header:i(),HeaderContainer:i(),FooterContainer:i(),ItemContainer:i(),ScrollContainer:i(),GroupContainer:i(),ListContainer:i(),emptyComponent:i(),scrollSeek:i()};function a(t,e,n){u(l(t,C(o.components),s(function(t){var o,r=t[0],i=t[1];return console.warn("react-virtuoso: "+n+" property is deprecated. Pass components."+e+" instead."),R({},i,((o={})[e]=r,o))})),o.components)}return g(r.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;")}),g(r.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),g(r.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),g(r.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),g(r.scrollSeek,function(t){var r=t.placeholder,i=L(t,ie);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),v(o.components,R({},n(o.components),{ScrollSeekPlaceholder:r})),v(e.scrollSeekConfiguration,i)}),a(r.footer,"Footer","footer"),a(r.header,"Header","header"),a(r.ItemContainer,"Item","ItemContainer"),a(r.ListContainer,"List","ListContainer"),a(r.ScrollContainer,"Scroller","ScrollContainer"),a(r.emptyComponent,"EmptyPlaceholder","emptyComponent"),a(r.GroupContainer,"Group","GroupContainer"),R({},e,o,r)},o(ee,ue)),de=function(t){return T.createElement("div",{style:{height:t.height}})},fe={position:ne(),zIndex:1,overflowAnchor:"none"},pe={overflowAnchor:"none"},he=T.memo(function(t){var e=t.showTopList,n=void 0!==e&&e,o=ze("listState"),r=T.useState(0),i=r[0],a=r[1],l=ze("react18ConcurrentRendering");ke("deviation",function(t){i!==t&&re(l)(function(){return a(t)})});var s=Le("sizeRanges"),u=ze("useWindowScroll"),c=ze("customScrollParent"),m=Le("windowScrollContainerState"),d=Le("scrollContainerState"),f=c||u?m:d,p=ze("itemContent"),g=ze("context"),v=ze("groupContent"),S=ze("trackItemSizes"),C=ze("itemSize"),I=ze("log"),w=A(s,C,S,n?h:f,I,c),x=ze("EmptyPlaceholder"),y=ze("ScrollSeekPlaceholder")||de,b=ze("ListComponent"),H=ze("ItemComponent"),L=ze("GroupComponent"),z=ze("computeItemKey"),k=ze("isSeeking"),B=ze("groupIndices").length>0,F=ze("paddingTopAddition"),P=ze("firstItemIndex"),O=ze("statefulTotalCount"),M=n?{}:{boxSizing:"border-box",paddingTop:o.offsetTop+F,paddingBottom:o.offsetBottom,marginTop:i};return!n&&0===O&&x?E(x,Ce(x,g)):E(b,R({},Ce(b,g),{ref:w,style:M,"data-test-id":n?"virtuoso-top-item-list":"virtuoso-item-list"}),(n?o.topItems:o.items).map(function(t){var e=t.originalIndex,n=z(e+P,t.data,g);return k?E(y,R({},Ce(y,g),{key:n,index:t.index,height:t.size,type:t.type||"item"},"group"===t.type?{}:{groupIndex:t.groupIndex})):"group"===t.type?E(L,R({},Ce(L,g),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:fe}),v(t.index)):E(H,R({},Ce(H,g),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,style:pe}),B?p(t.index,t.groupIndex,t.data,g):p(t.index,t.data,g))}))}),ge={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},ve={width:"100%",height:"100%",position:"absolute",top:0},Se={width:"100%",position:ne(),top:0};function Ce(t,e){if("string"!=typeof t)return{context:e}}var Ie=T.memo(function(){var t=ze("HeaderComponent"),e=Le("headerHeight"),n=ze("headerFooterTag"),o=U(function(t){return e(W(t,"height"))}),r=ze("context");return t?E(n,{ref:o},E(t,Ce(t,r))):null}),Te=T.memo(function(){var t=ze("FooterComponent"),e=Le("footerHeight"),n=ze("headerFooterTag"),o=U(function(t){return e(W(t,"height"))}),r=ze("context");return t?E(n,{ref:o},E(t,Ce(t,r))):null});function we(t){var e=t.usePublisher,n=t.useEmitter,o=t.useEmitterValue;return T.memo(function(t){var r=t.style,i=t.children,a=L(t,ae),l=e("scrollContainerState"),s=o("ScrollerComponent"),u=e("smoothScrollTargetReached"),c=o("scrollerRef"),m=o("context"),d=N(l,u,s,c),f=d.scrollerRef,p=d.scrollByCallback;return n("scrollTo",d.scrollToCallback),n("scrollBy",p),E(s,R({ref:f,style:R({},ge,r),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},a,Ce(s,m)),i)})}function xe(t){var e=t.usePublisher,n=t.useEmitter,o=t.useEmitterValue;return T.memo(function(t){var r=t.style,i=t.children,a=L(t,le),l=e("windowScrollContainerState"),s=o("ScrollerComponent"),u=e("smoothScrollTargetReached"),c=o("totalListHeight"),m=o("deviation"),d=o("customScrollParent"),f=o("context"),p=N(l,u,s,h,d),g=p.scrollerRef,v=p.scrollByCallback,S=p.scrollToCallback;return P(function(){return g.current=d||window,function(){g.current=null}},[g,d]),n("windowScrollTo",S),n("scrollBy",v),E(s,R({style:R({position:"relative"},r,0!==c?{height:c+m}:{}),"data-virtuoso-scroller":!0},a,Ce(s,f)),i)})}var ye=function(t){var e=t.children,n=Le("viewportHeight"),o=U(I(n,function(t){return W(t,"height")}));return T.createElement("div",{style:ve,ref:o,"data-viewport-type":"element"},e)},be=function(t){var e=t.children,n=oe(Le("windowViewportRect"),ze("customScrollParent"));return T.createElement("div",{ref:n,style:ve,"data-viewport-type":"window"},e)},Ee=function(t){var e=t.children,n=ze("TopItemListComponent"),o=ze("headerHeight"),r=R({},Se,{marginTop:o+"px"}),i=ze("context");return E(n||"div",{style:r,context:i},e)},He=t(me,{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",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},T.memo(function(t){var e=ze("useWindowScroll"),n=ze("topItemsIndexes").length>0,o=ze("customScrollParent"),r=o||e?be:ye;return T.createElement(o||e?Fe:Be,R({},t),T.createElement(r,null,T.createElement(Ie,null),T.createElement(he,null),T.createElement(Te,null)),n&&T.createElement(Ee,null,T.createElement(he,{showTopList:!0})))})),Re=He.Component,Le=He.usePublisher,ze=He.useEmitterValue,ke=He.useEmitter,Be=we({usePublisher:Le,useEmitterValue:ze,useEmitter:ke}),Fe=xe({usePublisher:Le,useEmitterValue:ze,useEmitter:ke}),Pe={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Oe={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Me=Math.round,Ve=Math.ceil,Ue=Math.floor,Ae=Math.min,We=Math.max;function Ne(t,e){return Array.from({length:e-t+1}).map(function(e,n){return{index:n+t}})}var De=e.system(function(t){var n=t[0],o=n.overscan,r=n.visibleRange,i=n.listBoundary,a=t[1],l=a.scrollTop,s=a.viewportHeight,u=a.scrollBy,c=a.scrollTo,m=a.smoothScrollTargetReached,d=a.scrollContainerState,f=t[2],p=t[3],h=t[4],g=h.propsReady,v=h.didMount,S=t[5],C=S.windowViewportRect,I=S.windowScrollTo,T=S.useWindowScroll,w=S.customScrollParent,x=S.windowScrollContainerState,y=e.statefulStream(0),b=e.statefulStream(0),E=e.statefulStream(Pe),H=e.statefulStream({height:0,width:0}),L=e.statefulStream({height:0,width:0}),z=e.stream(),k=e.stream(),B=e.statefulStream(0);e.connect(e.pipe(v,e.withLatestFrom(b),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{items:Ne(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),E),e.connect(e.pipe(e.combineLatest(e.duc(y),r,e.duc(L,function(t,e){return t&&t.width===e.width&&t.height===e.height})),e.withLatestFrom(H),e.map(function(t){var e=t[0],n=e[0],o=e[1],r=o[0],i=o[1],a=e[2],l=t[1],s=a.height,u=a.width,c=l.width;if(0===n||0===c)return Pe;if(0===u)return Oe;var m=je(c,u),d=m*Ue(r/s),f=m*Ve(i/s)-1;f=Ae(n-1,f);var p=Ne(d=Ae(f,We(0,d)),f),h=Ge(l,a,p),g=h.top,v=h.bottom;return{items:p,offsetTop:g,offsetBottom:Ve(n/m)*s-v,top:g,bottom:v,itemHeight:s,itemWidth:u}})),E),e.connect(e.pipe(H,e.map(function(t){return t.height})),s),e.connect(e.pipe(e.combineLatest(H,L,E),e.map(function(t){var e=Ge(t[0],t[1],t[2].items);return[e.top,e.bottom]}),e.distinctUntilChanged(Bt)),i);var F=e.streamFromEmitter(e.pipe(e.duc(E),e.filter(function(t){return t.items.length>0}),e.withLatestFrom(y),e.filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),e.map(function(t){return t[1]-1}),e.distinctUntilChanged())),P=e.streamFromEmitter(e.pipe(e.duc(E),e.filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),e.mapTo(0),e.distinctUntilChanged())),O=e.streamFromEmitter(e.pipe(e.duc(E),e.filter(function(t){return t.items.length>0}),e.map(function(t){var e=t.items;return{startIndex:e[0].index,endIndex:e[e.length-1].index}}),e.distinctUntilChanged(Ft)));e.connect(O,p.scrollSeekRangeChanged),e.connect(e.pipe(z,e.withLatestFrom(H,L,y),e.map(function(t){var e=t[1],n=t[2],o=t[3],r=Tt(t[0]),i=r.align,a=r.behavior,l=r.offset,s=r.index;"LAST"===s&&(s=o-1);var u=_e(e,n,s=We(0,s,Ae(o-1,s)));return"end"===i?u=Me(u-e.height+n.height):"center"===i&&(u=Me(u-e.height/2+n.height/2)),l&&(u+=l),{top:u,behavior:a}})),c);var M=e.statefulStreamFromEmitter(e.pipe(E,e.map(function(t){return t.offsetBottom+t.bottom})),0);return e.connect(e.pipe(C,e.map(function(t){return{width:t.visibleWidth,height:t.visibleHeight}})),H),R({totalCount:y,viewportDimensions:H,itemDimensions:L,scrollTop:l,scrollHeight:k,overscan:o,scrollBy:u,scrollTo:c,scrollToIndex:z,smoothScrollTargetReached:m,windowViewportRect:C,windowScrollTo:I,useWindowScroll:T,customScrollParent:w,windowScrollContainerState:x,deviation:B,scrollContainerState:d,initialItemCount:b},p,{gridState:E,totalListHeight:M},f,{startReached:P,endReached:F,rangeChanged:O,propsReady:g})},e.tup(Mt,D,bt,jt,Et,$t));function Ge(t,e,n){var o=e.height;return void 0===o||0===n.length?{top:0,bottom:0}:{top:_e(t,e,n[0].index),bottom:_e(t,e,n[n.length-1].index)+o}}function _e(t,e,n){var o=je(t.width,e.width);return Ue(n/o)*e.height}function je(t,e){return We(1,Ue(t/e))}var Ke=["placeholder"],Ye=e.system(function(){var t=e.statefulStream(function(t){return"Item "+t}),n=e.statefulStream({}),o=e.statefulStream(null),r=e.statefulStream("virtuoso-grid-item"),i=e.statefulStream("virtuoso-grid-list"),a=e.statefulStream(se),l=e.statefulStream(e.noop),s=function(t,o){return void 0===o&&(o=null),e.statefulStreamFromEmitter(e.pipe(n,e.map(function(e){return e[t]}),e.distinctUntilChanged()),o)};return{context:o,itemContent:t,components:n,computeItemKey:a,itemClassName:r,listClassName:i,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Ze=e.system(function(t){var n=t[0],o=t[1],r={item:ce(o.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:e.stream(),ScrollContainer:e.stream(),ListContainer:e.stream(),emptyComponent:e.stream(),scrollSeek:e.stream()};function i(t,n,r){e.connect(e.pipe(t,e.withLatestFrom(o.components),e.map(function(t){var e,o=t[0],i=t[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+n+" instead."),R({},i,((e={})[n]=o,e))})),o.components)}return e.subscribe(r.scrollSeek,function(t){var r=t.placeholder,i=L(t,Ke);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),e.publish(o.components,R({},e.getValue(o.components),{ScrollSeekPlaceholder:r})),e.publish(n.scrollSeekConfiguration,i)}),i(r.ItemContainer,"Item","ItemContainer"),i(r.ListContainer,"List","ListContainer"),i(r.ScrollContainer,"Scroller","ScrollContainer"),R({},n,o,r)},e.tup(De,Ye)),qe=T.memo(function(){var t=en("gridState"),e=en("listClassName"),n=en("itemClassName"),o=en("itemContent"),r=en("computeItemKey"),i=en("isSeeking"),a=tn("scrollHeight"),l=en("ItemComponent"),s=en("ListComponent"),u=en("ScrollSeekPlaceholder"),c=en("context"),m=tn("itemDimensions"),d=U(function(t){a(t.parentElement.parentElement.scrollHeight);var e=t.firstChild;e&&m(e.getBoundingClientRect())});return E(s,R({ref:d,className:e},Ce(s,c),{style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}}),t.items.map(function(e){var a=r(e.index);return i?E(u,R({key:a},Ce(u,c),{index:e.index,height:t.itemHeight,width:t.itemWidth})):E(l,R({},Ce(l,c),{className:n,"data-index":e.index,key:a}),o(e.index,c))}))}),Je=function(t){var e=t.children,n=tn("viewportDimensions"),o=U(function(t){n(t.getBoundingClientRect())});return T.createElement("div",{style:ve,ref:o},e)},$e=function(t){var e=t.children,n=oe(tn("windowViewportRect"),en("customScrollParent"));return T.createElement("div",{ref:n,style:ve},e)},Qe=t(Ze,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},T.memo(function(t){var e=R({},t),n=en("useWindowScroll"),o=en("customScrollParent"),r=o||n?$e:Je;return T.createElement(o||n?rn:on,R({},e),T.createElement(r,null,T.createElement(qe,null)))})),Xe=Qe.Component,tn=Qe.usePublisher,en=Qe.useEmitterValue,nn=Qe.useEmitter,on=we({usePublisher:tn,useEmitterValue:en,useEmitter:nn}),rn=xe({usePublisher:tn,useEmitterValue:en,useEmitter:nn}),an=r(function(){var t=p(function(t){return T.createElement("td",null,"Item $",t)}),e=p(null),n=p(null),o=p({}),r=p(se),i=p(h),a=function(t,e){return void 0===e&&(e=null),S(l(o,s(function(e){return e[t]}),f()),e)};return{context:e,itemContent:t,fixedHeaderContent:n,components:o,computeItemKey:r,scrollerRef:i,TableComponent:a("Table","table"),TableHeadComponent:a("TableHead","thead"),TableBodyComponent:a("TableBody","tbody"),TableRowComponent:a("TableRow","tr"),ScrollerComponent:a("Scroller","div"),EmptyPlaceholder:a("EmptyPlaceholder"),ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),FillerRow:a("FillerRow")}}),ln=r(function(t){return R({},t[0],t[1])},o(ee,an)),sn=function(t){return T.createElement("tr",null,T.createElement("td",{style:{height:t.height}}))},un=function(t){return T.createElement("tr",null,T.createElement("td",{style:{height:t.height,padding:0,border:0}}))},cn=T.memo(function(){var t=gn("listState"),e=T.useState(0),n=e[0],o=e[1],r=gn("react18ConcurrentRendering");vn("deviation",function(t){n!==t&&re(r)(function(){return o(t)})});var i=hn("sizeRanges"),a=gn("useWindowScroll"),l=gn("customScrollParent"),s=hn("windowScrollContainerState"),u=hn("scrollContainerState"),c=l||a?s:u,m=gn("itemContent"),d=gn("trackItemSizes"),f=A(i,gn("itemSize"),d,c,gn("log"),l),p=gn("EmptyPlaceholder"),h=gn("ScrollSeekPlaceholder")||sn,g=gn("FillerRow")||un,v=gn("TableBodyComponent"),S=gn("TableRowComponent"),C=gn("computeItemKey"),I=gn("isSeeking"),w=gn("paddingTopAddition"),x=gn("firstItemIndex"),y=gn("statefulTotalCount"),b=gn("context");if(0===y&&p)return E(p,Ce(p,b));var H=t.offsetTop+w+n,L=t.offsetBottom,z=H>0?T.createElement(g,{height:H,key:"padding-top"}):null,k=L>0?T.createElement(g,{height:L,key:"padding-bottom"}):null,B=t.items.map(function(t){var e=t.originalIndex,n=C(e+x,t.data,b);return I?E(h,R({},Ce(h,b),{key:n,index:t.index,height:t.size,type:t.type||"item"})):E(S,R({},Ce(S,b),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:{overflowAnchor:"none"}}),m(t.index,t.data,b))});return E(v,R({ref:f,"data-test-id":"virtuoso-item-list"},Ce(v,b)),[z].concat(B,[k]))}),mn=function(t){var e=t.children,n=hn("viewportHeight"),o=U(I(n,function(t){return W(t,"height")}));return T.createElement("div",{style:ve,ref:o,"data-viewport-type":"element"},e)},dn=function(t){var e=t.children,n=oe(hn("windowViewportRect"),gn("customScrollParent"));return T.createElement("div",{ref:n,style:ve,"data-viewport-type":"window"},e)},fn=t(ln,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},T.memo(function(t){var e=gn("useWindowScroll"),n=gn("customScrollParent"),o=hn("fixedHeaderHeight"),r=gn("fixedHeaderContent"),i=gn("context"),a=U(I(o,function(t){return W(t,"height")})),l=n||e?Cn:Sn,s=n||e?dn:mn,u=gn("TableComponent"),c=gn("TableHeadComponent"),m=r?T.createElement(c,R({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:a},Ce(c,i)),r()):null;return T.createElement(l,R({},t),T.createElement(s,null,T.createElement(u,R({style:{borderSpacing:0}},Ce(u,i)),[m,T.createElement(cn,{key:"TableBody"})])))})),pn=fn.Component,hn=fn.usePublisher,gn=fn.useEmitterValue,vn=fn.useEmitter,Sn=we({usePublisher:hn,useEmitterValue:gn,useEmitter:vn}),Cn=xe({usePublisher:hn,useEmitterValue:gn,useEmitter:vn}),In=Re,Tn=Re,wn=pn,xn=Xe;export{Tn as GroupedVirtuoso,F as LogLevel,wn as TableVirtuoso,In as Virtuoso,xn as VirtuosoGrid};
|
|
2
2
|
//# sourceMappingURL=index.m.js.map
|