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