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