react-virtuoso 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,9 +19,9 @@ For live examples and documentation, check the [documentation website](//virtuos
19
19
 
20
20
  ## Sponsors
21
21
 
22
- [![Stream](https://i.imgur.com/oU7XYkk.png)](https://getstream.io/chat/react-chat/tutorial/?utm_source=https://github.com/petyosi/react-virtuoso&utm_medium=github&utm_content=developer&utm_term=react)
22
+ [![Stream](https://i.imgur.com/oU7XYkk.png)](https://getstream.io/chat/react-chat/tutorial/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_ReactChat&utm_term=react-virtuoso)
23
23
 
24
- React Virtuoso is proudly sponsored by [Stream](https://getstream.io/?utm_source=github&utm_medium=react-virtuoso&utm_campaign=sponsorship), the leading provider in enterprise grade [Feed](https://getstream.io/activity-feeds/?utm_source=github&utm_medium=react-virtuoso&utm_campaign=sponsorship) & [Chat](https://getstream.io/chat/?utm_source=github&utm_medium=react-virtuoso&utm_campaign=sponsorship) APIs. To learn more about Stream, [click here](https://getstream.io/?utm_source=github&utm_medium=react-virtuoso&utm_campaign=sponsorship).
24
+ React Virtuoso is proudly sponsored by [Stream](https://getstream.io/chat/react-chat/tutorial/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_ReactChat&utm_term=react-virtuoso), the leading provider in enterprise grade [Feed](https://getstream.io/activity-feeds/?utm_source=github&utm_medium=react-virtuoso&utm_campaign=sponsorship) & [Chat](https://getstream.io/chat/?utm_source=github&utm_medium=react-virtuoso&utm_campaign=sponsorship) APIs. To learn more about Stream, [click here](https://getstream.io/chat/react-chat/tutorial/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_ReactChat&utm_term=react-virtuoso).
25
25
 
26
26
  If you are using Virtuoso for work, [sponsor it](https://www.patreon.com/react_virtuoso). Any donation helps a lot with the project development and maintenance.
27
27
 
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("@virtuoso.dev/react-urx"),t=require("@virtuoso.dev/urx"),n=require("react");function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(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 i(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)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function l(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function s(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}var u,c,m=t.system(function(){var e=t.stream(),n=t.stream(),r=t.statefulStream(0),o=t.stream(),i=t.statefulStream(0),a=t.stream(),l=t.stream(),s=t.statefulStream(0),u=t.statefulStream(0),c=t.stream(),m=t.stream(),f=t.statefulStream(!1);return t.connect(t.pipe(e,t.map(function(e){return e[0]})),n),t.connect(t.pipe(e,t.map(function(e){return e[1]})),l),t.connect(n,i),{scrollContainerState:e,scrollTop:n,viewportHeight:a,headerHeight:s,footerHeight:u,scrollHeight:l,smoothScrollTargetReached:o,scrollTo:c,scrollBy:m,statefulScrollTop:i,deviation:r,scrollingInProgress:f}},[],{singleton:!0});(c=exports.LogLevel||(exports.LogLevel={}))[c.DEBUG=0]="DEBUG",c[c.INFO=1]="INFO",c[c.WARN=2]="WARN",c[c.ERROR=3]="ERROR";var f=((u={})[exports.LogLevel.DEBUG]="debug",u[exports.LogLevel.INFO]="log",u[exports.LogLevel.WARN]="warn",u[exports.LogLevel.ERROR]="error",u),p=t.system(function(){var e=t.statefulStream(exports.LogLevel.ERROR);return{log:t.statefulStream(function(n,r,o){var i;void 0===o&&(o=exports.LogLevel.INFO),o>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:t.getValue(e))&&console[f[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0}),d=t.system(function(e){var n=e[0].log,r=t.statefulStream(!1),o=t.streamFromEmitter(t.pipe(r,t.filter(function(e){return e}),t.distinctUntilChanged()));return t.subscribe(r,function(e){e&&t.getValue(n)("props updated",{},exports.LogLevel.DEBUG)}),{propsReady:r,didMount:o}},t.tup(p),{singleton:!0}),h="up",g={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},v=t.system(function(e){var n=e[0],r=n.scrollContainerState,o=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(),f=t.stream(),p=t.statefulStream(4),d=t.streamFromEmitter(t.pipe(t.merge(t.pipe(t.duc(o),t.skip(1),t.mapTo(!0)),t.pipe(t.duc(o),t.skip(1),t.mapTo(!1),t.debounceTime(100))),t.distinctUntilChanged())),v=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.duc(o),t.map(function(e){return 0===e}),t.distinctUntilChanged()),c),t.connect(c,f);var S=t.streamFromEmitter(t.pipe(t.combineLatest(r,t.duc(i),t.duc(a),t.duc(l),t.duc(p)),t.scan(function(e,t){var n,r,o=t[0],i=o[0],a=o[1],l=t[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-t[4]?(i>e.state.scrollTop?(n="SCROLLED_DOWN",r=e.state.scrollTop-i):(n="SIZE_DECREASED",r=e.state.scrollTop-i||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:r}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":l<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},g),t.distinctUntilChanged(function(e,t){return e&&e.atBottom===t.atBottom}))),I=t.statefulStreamFromEmitter(t.pipe(r,t.scan(function(e,t){var n=t[0],r=t[1];return e.scrollHeight!==r?e.scrollTop!==n?{scrollHeight:r,scrollTop:n,jump:e.scrollTop-n,changed:!0}:{scrollHeight:r,scrollTop:n,jump:0,changed:!0}:{scrollTop:n,scrollHeight:r,jump:0,changed:!1}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),t.filter(function(e){return e.changed}),t.map(function(e){return e.jump})),0);t.connect(t.pipe(S,t.map(function(e){return e.atBottom})),u),t.subscribe(u,function(e){setTimeout(function(){return t.publish(m,e)})});var C=t.statefulStream("down");t.subscribe(u,function(e){setTimeout(function(){t.publish(m,e)})}),t.connect(t.pipe(r,t.map(function(e){return e[0]}),t.distinctUntilChanged(),t.scan(function(e,n){return t.getValue(v)?{direction:e.direction,prevScrollTop:n}:{direction:n<e.prevScrollTop?h:"down",prevScrollTop:n}},{direction:"down",prevScrollTop:0}),t.map(function(e){return e.direction})),C),t.connect(t.pipe(r,t.throttleTime(50),t.mapTo("none")),C),t.connect(u,m);var x=t.statefulStream(0);return t.connect(t.pipe(d,t.filter(function(e){return!e}),t.mapTo(0)),x),t.connect(t.pipe(o,t.throttleTime(100),t.withLatestFrom(d),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]})),x),{isScrolling:d,isAtTop:c,isAtBottom:u,atBottomState:S,atTopStateChange:f,atBottomStateChange:m,scrollDirection:C,atBottomThreshold:p,scrollVelocity:x,lastJumpDueToItemResize:I}},t.tup(m)),S=t.system(function(e){var n=e[0].scrollVelocity,r=t.statefulStream(!1),o=t.stream(),i=t.statefulStream(!1);return t.connect(t.pipe(n,t.withLatestFrom(i,r,o),t.filter(function(e){return!!e[1]}),t.map(function(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=n.enter;if(r){if((0,n.exit)(t,o))return!1}else if(i(t,o))return!0;return r}),t.distinctUntilChanged()),r),t.subscribe(t.pipe(t.combineLatest(r,n,o),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:r,scrollSeekConfiguration:i,scrollVelocity:n,scrollSeekRangeChanged:o}},t.tup(v),{singleton:!0}),I={lvl:0};function C(e,t,n,r,o){return void 0===r&&(r=I),void 0===o&&(o=I),{k:e,v:t,lvl:n,l:r,r:o}}function x(e){return e===I}function w(){return I}function T(e,t){if(x(e))return I;var n=e.k,r=e.l,o=e.r;if(t===n){if(x(r))return o;if(x(o))return r;var i=R(r);return B(k(e,{k:i[0],v:i[1],l:H(r)}))}return B(k(e,t<n?{l:T(r,t)}:{r:T(o,t)}))}function b(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 r=b(e.r,t,n);return-Infinity===r[0]?[e.k,e.v]:r}return b(e.l,t,n)}function y(e,t,n){return x(e)?C(t,n,1):t===e.k?k(e,{k:t,v:n}):function(e){return M(U(e))}(k(e,t<e.k?{l:y(e.l,t,n)}:{r:y(e.r,t,n)}))}function L(e,t,n){if(x(e))return[];var r=e.k,o=e.v,i=e.r,a=[];return r>t&&(a=a.concat(L(e.l,t,n))),r>=t&&r<=n&&a.push({k:r,v:o}),r<=n&&(a=a.concat(L(i,t,n))),a}function E(e){return x(e)?[]:[].concat(E(e.l),[{k:e.k,v:e.v}],E(e.r))}function R(e){return x(e.r)?[e.k,e.v]:R(e.r)}function H(e){return x(e.r)?e.l:B(k(e,{r:H(e.r)}))}function k(e,t){return C(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 z(e){return x(e)||e.lvl>e.r.lvl}function B(e){var t=e.l,n=e.r,r=e.lvl;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(z(t))return U(k(e,{lvl:r-1}));if(x(t)||x(t.r))throw new Error("Unexpected empty nodes");return k(t.r,{l:k(t,{r:t.r.l}),r:k(e,{l:t.r.r,lvl:r-1}),lvl:r})}if(z(e))return M(k(e,{lvl:r-1}));if(x(n)||x(n.l))throw new Error("Unexpected empty nodes");var o=n.l,i=z(o)?n.lvl-1:n.lvl;return k(o,{l:k(e,{r:o.l,lvl:r-1}),r:M(k(n,{l:o.r,lvl:i})),lvl:o.lvl+1})}function F(e,t,n){return x(e)?[]:O(L(e,b(e,t)[0],n),function(e){return{index:e.k,value:e.v}})}function O(e,t){var n=e.length;if(0===n)return[];for(var r=t(e[0]),o=r.index,i=r.value,a=[],l=1;l<n;l++){var s=t(e[l]),u=s.index,c=s.value;a.push({start:o,end:u-1,value:i}),o=u,i=c}return a.push({start:o,end:Infinity,value:i}),a}function M(e){var t=e.r,n=e.lvl;return x(t)||x(t.r)||t.lvl!==n||t.r.lvl!==n?e:k(t,{l:k(e,{r:t.l}),lvl:n+1})}function U(e){var t=e.l;return x(t)||t.lvl!==e.lvl?e:k(t,{r:k(e,{l:t.r})})}function P(e,t,n,r){void 0===r&&(r=0);for(var o=e.length-1;r<=o;){var i=Math.floor((r+o)/2),a=n(e[i],t);if(0===a)return i;if(-1===a){if(o-r<2)return i-1;o=i-1}else{if(o===r)return i;r=i+1}}throw new Error("Failed binary finding record in array - "+e.join(",")+", searched for "+t)}function V(e,t,n){return e[P(e,t,n)]}function A(e,t){return Math.round(e.getBoundingClientRect()[t])}function N(e){var t=e.size,n=e.startIndex,r=e.endIndex;return function(e){return e.start===n&&(e.end===r||Infinity===e.end)&&e.value===t}}function D(e,t){var n=e.index;return t===n?0:t<n?-1:1}function G(e,t){var n=e.offset;return t===n?0:t<n?-1:1}function W(e){return{index:e.index,value:e}}function _(e,t){var n=t[0],r=t[1];n.length>0&&(0,t[2])("received item sizes",n,exports.LogLevel.DEBUG);var o=e.sizeTree,i=e.offsetTree,l=o,s=0;if(r.length>0&&x(o)&&2===n.length){var u=n[0].size,c=n[1].size;l=r.reduce(function(e,t){return y(y(e,t,u),t+1,c)},l)}else{var m=function(e,t){for(var n,r=x(e)?0:Infinity,o=a(t);!(n=o()).done;){var i=n.value,l=i.size,s=i.startIndex,u=i.endIndex;if(r=Math.min(r,s),x(e))e=y(e,0,l);else{var c=F(e,s-1,u+1);if(!c.some(N(i))){for(var m,f=!1,p=!1,d=a(c);!(m=d()).done;){var h=m.value,g=h.start,v=h.end,S=h.value;f?(u>=g||l===S)&&(e=T(e,g)):(p=S!==l,f=!0),v>u&&u>=g&&S!==l&&(e=y(e,u+1,S))}p&&(e=y(e,s,l))}}}return[e,r]}(l,n);l=m[0],s=m[1]}if(l===o)return e;var f=0,p=0,d=0,h=0;if(0!==s){h=P(i,s-1,D),d=i[h].offset;var g=b(l,s-1);f=g[0],p=g[1],i.length&&i[h].size===b(l,s)[1]&&(h-=1),i=i.slice(0,h+1)}else i=[];for(var v,S=a(F(l,s,Infinity));!(v=S()).done;){var I=v.value,C=I.start,L=I.value,E=(C-f)*p+d;i.push({offset:E,size:L,index:C}),f=C,d=E,p=L}return{sizeTree:l,offsetTree:i,groupOffsetTree:r.reduce(function(e,t){return y(e,t,j(t,i))},w()),lastIndex:f,lastOffset:d,lastSize:p,groupIndices:r}}function j(e,t){if(0===t.length)return 0;var n=V(t,e,D);return n.size*(e-n.index)+n.offset}function K(e,t){if(!Y(t))return e;for(var n=0;t.groupIndices[n]<=e+n;)n++;return e+n}function Y(e){return!x(e.groupOffsetTree)}var q={offsetHeight:"height",offsetWidth:"width"},Z=t.system(function(e){var n=e[0].log,o=t.stream(),i=t.stream(),a=t.stream(),l=t.statefulStream(0),s=t.statefulStream([]),u=t.statefulStream(void 0),c=t.statefulStream(void 0),m=t.statefulStream(function(e,t){return A(e,q[t])}),f=t.statefulStream(void 0),p={offsetTree:[],sizeTree:w(),groupOffsetTree:w(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},d=t.statefulStreamFromEmitter(t.pipe(o,t.withLatestFrom(s,n),t.scan(_,p),t.distinctUntilChanged()),p);t.connect(t.pipe(s,t.filter(function(e){return e.length>0}),t.withLatestFrom(d),t.map(function(e){var t=e[0],n=e[1],o=t.reduce(function(e,t,r){return y(e,t,j(t,n.offsetTree)||r)},w());return r({},n,{groupIndices:t,groupOffsetTree:o})})),d),t.connect(t.pipe(i,t.withLatestFrom(d),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}]})),o),t.connect(u,c);var h=t.statefulStreamFromEmitter(t.pipe(u,t.map(function(e){return void 0===e})),!0);t.connect(t.pipe(c,t.filter(function(e){return void 0!==e&&x(t.getValue(d).sizeTree)}),t.map(function(e){return[{startIndex:0,endIndex:0,size:e}]})),o);var g=t.streamFromEmitter(t.pipe(o,t.withLatestFrom(d),t.scan(function(e,t){var n=t[1];return{changed:n!==e.sizes,sizes:n}},{changed:!1,sizes:p}),t.map(function(e){return e.changed})));t.connect(t.pipe(l,t.scan(function(e,t){return{diff:e.prev-t,prev:t}},{diff:0,prev:0}),t.map(function(e){return e.diff}),t.filter(function(e){return e>0})),a),t.subscribe(t.pipe(l,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:l},exports.LogLevel.ERROR)});var v=t.streamFromEmitter(a);return t.connect(t.pipe(a,t.withLatestFrom(d),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 E(n.sizeTree).reduce(function(e,n){var r=n.k,o=n.v;return{ranges:[].concat(e.ranges,[{startIndex:e.prevIndex,endIndex:r+t-1,size:e.prevSize}]),prevIndex:r+t,prevSize:o}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),o),{data:f,totalCount:i,sizeRanges:o,groupIndices:s,defaultItemSize:c,fixedItemSize:u,unshiftWith:a,beforeUnshiftWith:v,firstItemIndex:l,sizes:d,listRefresh:g,trackItemSizes:h,itemSize:m}},t.tup(p),{singleton:!0}),J="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function $(e){var t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&J||(t.behavior="auto"),t.offset||(t.offset=0),t}var Q=t.system(function(e){var n=e[0],r=n.sizes,o=n.totalCount,i=n.listRefresh,a=e[1],l=a.scrollingInProgress,s=a.viewportHeight,u=a.scrollTo,c=a.smoothScrollTargetReached,m=a.headerHeight,f=a.footerHeight,p=e[2].log,d=t.stream(),h=t.statefulStream(0),g=null,v=null,S=null;function I(){g&&(g(),g=null),S&&(S(),S=null),v&&(clearTimeout(v),v=null),t.publish(l,!1)}return t.connect(t.pipe(d,t.withLatestFrom(r,s,o,h,m,f,p),t.map(function(e){var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],u=e[5],m=e[6],f=e[7],p=$(n),h=p.align,C=p.behavior,x=p.offset,w=a-1,T=p.index;"LAST"===T&&(T=w),T=K(T,r);var y=j(T=Math.max(0,T,Math.min(w,T)),r.offsetTree)+u;"end"===h?(y=Math.round(y-o+b(r.sizeTree,T)[1]),T===w&&(y+=m)):"center"===h?y=Math.round(y-o/2+b(r.sizeTree,T)[1]/2):y-=s,x&&(y+=x);var L=function(e){I(),e?(f("retrying to scroll to",{location:n},exports.LogLevel.DEBUG),t.publish(d,n)):f("list did not change, scroll successful",{},exports.LogLevel.DEBUG)};if(I(),"smooth"===C){var E=!1;S=t.subscribe(i,function(e){E=E||e}),g=t.handleNext(c,function(){L(E)})}else g=t.handleNext(t.pipe(i,function(e){var t=setTimeout(function(){e(!1)},50);return function(n){n&&(e(!0),clearTimeout(t))}}),L);return v=setTimeout(function(){I()},1200),t.publish(l,!0),f("scrolling from index to",{index:T,top:y,behavior:C},exports.LogLevel.DEBUG),{top:y,behavior:C}})),u),{scrollToIndex:d,topListHeight:h}},t.tup(Z,m,p),{singleton:!0});function X(e,t,n){return"number"==typeof e?n===h&&"top"===t||"down"===n&&"bottom"===t?e:0:n===h?"top"===t?e.main:e.reverse:"bottom"===t?e.main:e.reverse}function ee(e,t){return"number"==typeof e?e:e[t]||0}var te=t.system(function(e){var n=e[0],r=n.scrollTop,o=n.viewportHeight,i=n.deviation,a=n.headerHeight,s=t.stream(),u=t.statefulStream(0),c=t.statefulStream(0),m=t.statefulStream(0);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:t.statefulStreamFromEmitter(t.pipe(t.combineLatest(t.duc(r),t.duc(o),t.duc(a),t.duc(s,l),t.duc(m),t.duc(u),t.duc(i),t.duc(c)),t.map(function(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=o[0],a=o[1],l=e[4],s=e[5],u=e[6],c=e[7],m=t-u,f=Math.max(r-m,0),p="none",d=ee(c,"top"),g=ee(c,"bottom");return i-=u,a+=r,(i+=r)>t+s-d&&(p=h),(a-=u)<t-f+n+g&&(p="down"),"none"!==p?[Math.max(m-r-X(l,"top",p)-d,0),m-f+n+X(l,"bottom",p)+g]:null}),t.filter(function(e){return null!=e}),t.distinctUntilChanged(l)),[0,0])}},t.tup(m),{singleton:!0}),ne=t.system(function(e){var n=e[0],o=n.scrollTo,i=n.scrollContainerState,a=t.stream(),l=t.stream(),s=t.stream(),u=t.statefulStream(!1);return t.connect(t.pipe(t.combineLatest(a,l),t.map(function(e){var t=e[0],n=t[1];return[Math.max(0,t[0]-e[1].offsetTop),n]})),i),t.connect(t.pipe(o,t.withLatestFrom(l),t.map(function(e){var t=e[0];return r({},t,{top:t.top+e[1].offsetTop})})),s),{useWindowScroll:u,windowScrollContainerState:a,windowViewportRect:l,windowScrollTo:s}},t.tup(m)),re={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},oe={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},ie=Math.ceil,ae=Math.floor,le=Math.min,se=Math.max;function ue(e){return ie(e)-e<.03?ie(e):ae(e)}function ce(e,t){return Array.from({length:t-e+1}).map(function(t,n){return{index:n+e}})}var me=t.system(function(e){var n=e[0],o=n.overscan,i=n.visibleRange,a=n.listBoundary,u=e[1],c=u.scrollTop,m=u.viewportHeight,f=u.scrollBy,p=u.scrollTo,d=u.smoothScrollTargetReached,h=u.scrollContainerState,g=e[2],v=e[3],S=e[4],I=S.propsReady,C=S.didMount,x=e[5],w=x.windowViewportRect,T=x.windowScrollTo,b=x.useWindowScroll,y=x.windowScrollContainerState,L=t.statefulStream(0),E=t.statefulStream(0),R=t.statefulStream(re),H=t.statefulStream({height:0,width:0}),k=t.statefulStream({height:0,width:0}),z=t.stream(),B=t.stream(),F=t.statefulStream(0);t.connect(t.pipe(C,t.withLatestFrom(E),t.filter(function(e){return 0!==e[1]}),t.map(function(e){return{items:ce(0,e[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),R),t.connect(t.pipe(t.combineLatest(t.duc(L),i,t.duc(k,function(e,t){return e&&e.width===t.width&&e.height===t.height})),t.withLatestFrom(H),t.map(function(e){var t=e[0],n=t[0],r=t[1],o=r[0],i=r[1],a=t[2],l=e[1],s=a.height,u=a.width,c=l.width;if(0===n||0===c)return re;if(0===u)return oe;var m=ue(c/u),f=m*ae(o/s),p=m*ie(i/s)-1;p=le(n-1,p);var d=ce(f=le(p,se(0,f)),p),h=fe(l,a,d),g=h.top,v=h.bottom;return{items:d,offsetTop:g,offsetBottom:ie(n/m)*s-v,top:g,bottom:v,itemHeight:s,itemWidth:u}})),R),t.connect(t.pipe(H,t.map(function(e){return e.height})),m),t.connect(t.pipe(t.combineLatest(H,k,R),t.map(function(e){var t=fe(e[0],e[1],e[2].items);return[t.top,t.bottom]}),t.distinctUntilChanged(l)),a);var O=t.streamFromEmitter(t.pipe(t.duc(R),t.filter(function(e){return e.items.length>0}),t.withLatestFrom(L),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())),M=t.streamFromEmitter(t.pipe(t.duc(R),t.filter(function(e){var t=e.items;return t.length>0&&0===t[0].index}),t.mapTo(0),t.distinctUntilChanged())),U=t.streamFromEmitter(t.pipe(t.duc(R),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(s)));t.connect(U,v.scrollSeekRangeChanged),t.connect(t.pipe(z,t.withLatestFrom(H,k,L),t.map(function(e){var t=e[1],n=e[2],r=e[3],o=$(e[0]),i=o.align,a=o.behavior,l=o.offset,s=o.index;"LAST"===s&&(s=r-1);var u=pe(t,n,s=Math.max(0,s,Math.min(r-1,s)));return"end"===i?u=Math.round(u-t.height+n.height):"center"===i&&(u=Math.round(u-t.height/2+n.height/2)),l&&(u+=l),{top:u,behavior:a}})),p);var P=t.statefulStreamFromEmitter(t.pipe(R,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}})),H),r({totalCount:L,viewportDimensions:H,itemDimensions:k,scrollTop:c,scrollHeight:B,overscan:o,scrollBy:f,scrollTo:p,scrollToIndex:z,smoothScrollTargetReached:d,windowViewportRect:w,windowScrollTo:T,useWindowScroll:b,windowScrollContainerState:y,deviation:F,scrollContainerState:h,initialItemCount:E},v,{gridState:R,totalListHeight:P},g,{startReached:M,endReached:O,rangeChanged:U,propsReady:I})},t.tup(te,m,v,S,d,ne));function fe(e,t,n){var r=t.height;return void 0===r||0===n.length?{top:0,bottom:0}:{top:pe(e,t,n[0].index),bottom:pe(e,t,n[n.length-1].index)+r}}function pe(e,t,n){var r=ue(e.width/t.width);return ae(n/r)*t.height}function de(e,t){void 0===t&&(t=!0);var r=n.useRef(null),o=function(e){};if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t[0].target;null!==n.offsetParent&&e(n)});o=function(e){e&&t?(i.observe(e),r.current=e):(r.current&&i.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:o}}function he(e,t){return void 0===t&&(t=!0),de(e,t).callbackRef}function ge(e){var t=n.useRef(null),r=n.useCallback(function(n){if(null!==n){var r=n.getBoundingClientRect(),o=window.innerHeight-Math.max(0,r.top),i=r.top+window.pageYOffset;t.current={offsetTop:i,visibleHeight:o,visibleWidth:r.width},e(t.current)}},[e]),o=de(r),i=o.callbackRef,a=o.ref,l=n.useCallback(function(){r(a.current)},[r,a]);return n.useEffect(function(){return window.addEventListener("scroll",l),window.addEventListener("resize",l),function(){window.removeEventListener("scroll",l),window.removeEventListener("resize",l)}},[l]),i}var ve="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;function Se(e,r,o,i){void 0===i&&(i=t.noop);var a=n.useRef(null),l=n.useRef(null),s=n.useRef(null),u=n.useCallback(function(t){var n=t.target,o=n===window||n===document?window.pageYOffset||document.documentElement.scrollTop:n.scrollTop,i=n===window?document.documentElement.scrollHeight:n.scrollHeight;e([Math.max(o,0),i]),null!==l.current&&(o===l.current||o<=0||o===n.scrollHeight-A(n,"height"))&&(l.current=null,r(!0),s.current&&(clearTimeout(s.current),s.current=null))},[e,r]);return n.useEffect(function(){var e=a.current;return i(a.current),u({target:e}),e.addEventListener("scroll",u,{passive:!0}),function(){i(null),e.removeEventListener("scroll",u)}},[a,u,o,i]),{scrollerRef:a,scrollByCallback:function(e){null===l.current&&a.current.scrollBy(e)},scrollToCallback:function(t){var n=a.current;if(n&&(!("offsetHeight"in n)||0!==n.offsetHeight)){var o,i,u,c="smooth"===t.behavior;if(n===window?(i=Math.max(A(document.documentElement,"height"),document.documentElement.scrollHeight),o=window.innerHeight,u=document.documentElement.scrollTop):(i=n.scrollHeight,o=A(n,"height"),u=n.scrollTop),t.top=Math.max(Math.min(i-o,t.top),0),Math.abs(o-i)<1.01||t.top===u)return e([u,i]),void(c&&r(!0));c?(l.current=t.top,s.current&&clearTimeout(s.current),s.current=setTimeout(function(){s.current=null,l.current=null,r(!0)},1e3)):l.current=null,n.scrollTo(t)}}}}var Ie=t.system(function(e){var n=e[0],r=n.sizes,o=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 0!==e[1]}),t.mapTo(!1)),u),t.subscribe(t.pipe(t.combineLatest(o,s),t.withLatestFrom(u,r,i),t.filter(function(e){var t=e[1],n=e[3];return e[0][1]&&(!x(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(Z,m,Q,d),{singleton:!0});function Ce(e){return!!e&&("smooth"===e?"smooth":"auto")}var xe=t.system(function(e){var n=e[0],r=n.totalCount,o=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,f=c.didMount,p=e[5].log,d=e[6].scrollingInProgress,h=t.statefulStream(!1),g=null;function v(e){t.publish(s,{index:"LAST",align:"end",behavior:e})}return t.subscribe(t.pipe(t.combineLatest(t.pipe(t.duc(r),t.skip(1)),f),t.withLatestFrom(t.duc(h),a,u,d),t.map(function(e){var t=e[0],n=t[0],r=t[1]&&e[3],o="auto";return r&&(o=function(e,t){return"function"==typeof e?Ce(e(t)):t&&Ce(e)}(e[1],e[2]||e[4]),r=r&&!!o),{totalCount:n,shouldFollow:r,followOutputBehavior:o}}),t.filter(function(e){return e.shouldFollow})),function(e){var n=e.totalCount,r=e.followOutputBehavior;g&&(g(),g=null),g=t.handleNext(o,function(){t.getValue(p)("following output to ",{totalCount:n},exports.LogLevel.DEBUG),v(r),g=null})}),t.subscribe(t.pipe(t.combineLatest(t.duc(h),r,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(h,r)),function(e){var n=e[1],r=t.handleNext(l,function(e){!n||e.atBottom||"SIZE_INCREASED"!==e.notAtBottomBecause||g||(t.getValue(p)("scrolling to bottom due to increased size",{},exports.LogLevel.DEBUG),v("auto"))});setTimeout(r,100)}),t.subscribe(t.combineLatest(t.duc(h),l),function(e){var t=e[1];e[0]&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&v("auto")}),{followOutput:h}},t.tup(Z,v,Q,Ie,d,p,m));function we(e){return e.reduce(function(e,t){return e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e},{totalCount:0,groupIndices:[]})}var Te=t.system(function(e){var n=e[0],r=n.totalCount,o=n.groupIndices,i=n.sizes,a=e[1],l=a.scrollTop,s=a.headerHeight,u=t.stream(),c=t.stream(),m=t.streamFromEmitter(t.pipe(u,t.map(we)));return t.connect(t.pipe(m,t.map(t.prop("totalCount"))),r),t.connect(t.pipe(m,t.map(t.prop("groupIndices"))),o),t.connect(t.pipe(t.combineLatest(l,i,s),t.filter(function(e){return Y(e[1])}),t.map(function(e){return b(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(Z,m)),be={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0};function ye(e,t,n){if(0===e.length)return[];if(!Y(t))return e.map(function(e){return r({},e,{index:e.index+n,originalIndex:e.index})});for(var o,i=[],l=F(t.groupOffsetTree,e[0].index,e[e.length-1].index),s=void 0,u=0,c=a(e);!(o=c()).done;){var m=o.value;(!s||s.end<m.index)&&(s=l.shift(),u=t.groupIndices.indexOf(s.start)),i.push(r({},m.index===s.start?{type:"group",index:u}:{index:m.index-(u+1)+n,groupIndex:u},{size:m.size,offset:m.offset,originalIndex:m.index,data:m.data}))}return i}function Le(e,t,n,r,o){var i=0,a=0;if(e.length>0){i=e[0].offset;var l=e[e.length-1];a=l.offset+l.size}var s=i,u=r.lastOffset+(n-r.lastIndex)*r.lastSize-a;return{items:ye(e,r,o),topItems:ye(t,r,o),topListHeight:t.reduce(function(e,t){return t.size+e},0),offsetTop:i,offsetBottom:u,top:s,bottom:a,totalCount:n}}var Ee,Re,He,ke=t.system(function(e){var n=e[0],o=n.sizes,i=n.totalCount,u=n.data,c=n.firstItemIndex,m=e[1],f=e[2],p=f.visibleRange,d=f.listBoundary,h=f.topListHeight,g=e[3],v=g.scrolledToInitialItem,S=g.initialTopMostItemIndex,I=e[4].topListHeight,C=e[5],w=e[6].didMount,T=t.statefulStream([]),y=t.stream();t.connect(m.topItemsIndexes,T);var L=t.statefulStreamFromEmitter(t.pipe(t.combineLatest(w,t.duc(p),t.duc(i),t.duc(o),t.duc(S),v,t.duc(T),t.duc(c),u),t.filter(function(e){return e[0]}),t.map(function(e){var n=e[1],r=n[0],o=n[1],i=e[2],l=e[4],s=e[5],u=e[6],c=e[7],m=e[8],f=e[3],p=f.sizeTree,d=f.offsetTree;if(0===i||0===r&&0===o)return be;if(x(p))return Le(function(e,t,n){if(Y(t)){var r=K(e,t);return[{index:b(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}(l,f,m),[],i,f,c);var h=[];if(u.length>0)for(var g,v=u[0],S=u[u.length-1],I=0,C=a(F(p,v,S));!(g=C()).done;)for(var w=g.value,T=w.value,y=Math.max(w.start,v),L=Math.min(w.end,S),E=y;E<=L;E++)h.push({index:E,size:T,offset:I,data:m&&m[E]}),I+=T;if(!s)return Le([],h,i,f,c);var R=u.length>0?u[u.length-1]+1:0,H=function(e,t,n,r){return void 0===r&&(r=0),r>0&&(t=Math.max(t,V(e,r,D).offset)),O((i=n,l=P(o=e,t,a=G),s=P(o,i,a,l),o.slice(l,s+1)),W);var o,i,a,l,s}(d,r,o,R);if(0===H.length)return null;var k=i-1;return Le(t.tap([],function(e){for(var t,n=a(H);!(t=n()).done;){var i=t.value,l=i.value,s=l.offset,u=i.start,c=l.size;l.offset<r&&(s+=((u+=Math.floor((r-l.offset)/c))-i.start)*c),u<R&&(s+=(R-u)*c,u=R);for(var f=Math.min(i.end,k),p=u;p<=f&&!(s>=o);p++)e.push({index:p,size:c,offset:s,data:m&&m[p]}),s+=c}}),h,i,f,c)}),t.filter(function(e){return null!==e}),t.distinctUntilChanged()),be);return t.connect(t.pipe(u,t.filter(function(e){return void 0!==e}),t.map(function(e){return e.length})),i),t.connect(t.pipe(L,t.map(t.prop("topListHeight"))),I),t.connect(I,h),t.connect(t.pipe(L,t.map(function(e){return[e.top,e.bottom]})),d),t.connect(t.pipe(L,t.map(function(e){return e.items})),y),r({listState:L,topItemsIndexes:T,endReached:t.streamFromEmitter(t.pipe(L,t.filter(function(e){return e.items.length>0}),t.withLatestFrom(i,u),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(l),t.map(function(e){return e[0]}))),startReached:t.streamFromEmitter(t.pipe(L,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(L,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(s))),itemsRendered:y},C)},t.tup(Z,Te,te,Ie,Q,v,d),{singleton:!0}),ze=t.system(function(e){var n=e[0],r=n.sizes,o=n.firstItemIndex,i=n.data,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(r,o,i),t.map(function(e){var t=e[0][1],n=e[1],r=e[2],o=e[3],i=void 0===o?[]:o,l=0;if(n.groupIndices.length>0)for(var s,u=a(n.groupIndices);!((s=u()).done||s.value-l>=t);)l++;var c=t+l;return Le(Array.from({length:c}).map(function(e,t){return{index:t,size:0,offset:0,data:i[t]}}),[],c,n,r)})),l),{initialItemCount:u}},t.tup(Z,ke,d),{singleton:!0}),Be=t.system(function(e){var n=e[0].topItemsIndexes,r=t.statefulStream(0);return t.connect(t.pipe(r,t.filter(function(e){return e>0}),t.map(function(e){return Array.from({length:e}).map(function(e,t){return t})})),n),{topItemCount:r}},t.tup(ke)),Fe=t.system(function(e){var n=e[0],r=n.footerHeight,o=n.headerHeight,i=e[1].listState,a=t.stream(),l=t.statefulStreamFromEmitter(t.pipe(t.combineLatest(r,o,i),t.map(function(e){var t=e[2];return e[0]+e[1]+t.offsetBottom+t.bottom})),0);return t.connect(t.duc(l),a),{totalListHeight:l,totalListHeightChanged:a}},t.tup(m,ke),{singleton:!0}),Oe=t.system(function(e){var n=e[0],r=n.scrollBy,o=n.scrollTop,i=n.deviation,a=n.scrollingInProgress,l=e[1],s=l.isScrolling,u=l.isAtBottom,c=l.atBottomState,m=l.scrollDirection,f=e[3],p=f.beforeUnshiftWith,d=f.sizes,g=e[4].log,v=t.streamFromEmitter(t.pipe(e[2].listState,t.withLatestFrom(l.lastJumpDueToItemResize),t.scan(function(e,t){var n=e[1],r=t[0],o=r.items,i=r.totalCount,a=t[1],l=0;if(e[2]===i){if(n.length>0&&o.length>0&&(0!==o[0].originalIndex||0!==n[0].originalIndex))for(var s=function(e){var t=o[e],r=n.find(function(e){return e.originalIndex===t.originalIndex});return r?t.offset!==r.offset?(l=t.offset-r.offset+t.size-r.size,"break"):void 0:"continue"},u=o.length-1;u>=0;u--){var c=s(u);if("continue"!==c&&"break"===c)break}0!==l&&(l+=a)}return[l,o,i]},[0,[],0]),t.filter(function(e){return 0!==e[0]}),t.withLatestFrom(o,m,a,g,u,c),t.filter(function(e){return!e[3]&&0!==e[1]&&e[2]===h}),t.map(function(e){var t=e[0][0];return(0,e[4])("Upward scrolling compensation",{amount:t},exports.LogLevel.DEBUG),t})));return t.connect(t.pipe(v,t.withLatestFrom(i),t.map(function(e){return e[1]-e[0]})),i),t.subscribe(t.pipe(t.combineLatest(t.statefulStreamFromEmitter(s,!1),i),t.filter(function(e){return!e[0]&&0!==e[1]}),t.map(function(e){return e[1]}),t.throttleTime(1)),function(e){e>0?(t.publish(r,{top:-e,behavior:"auto"}),t.publish(i,0)):(t.publish(i,0),t.publish(r,{top:-e,behavior:"auto"}))}),t.connect(t.pipe(p,t.withLatestFrom(d),t.map(function(e){return e[0]*e[1].lastSize})),v),{deviation:i}},t.tup(m,v,ke,Z,p)),Me=t.system(function(e){var n=e[0].totalListHeight,r=e[1].didMount,o=e[2].scrollTo,i=t.statefulStream(0);return t.subscribe(t.pipe(r,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(o,e)})})}),{initialScrollTop:i}},t.tup(Fe,d,m),{singleton:!0}),Ue=t.system(function(e){var n=e[0].viewportHeight,r=e[1].totalListHeight,o=t.statefulStream(!1);return{alignToBottom:o,paddingTopAddition:t.statefulStreamFromEmitter(t.pipe(t.combineLatest(o,n,r),t.filter(function(e){return e[0]}),t.map(function(e){return Math.max(0,e[1]-e[2])}),t.distinctUntilChanged()),0)}},t.tup(m,Fe),{singleton:!0}),Pe=t.system(function(e){var n=e[0],r=n.sizes,o=n.totalCount,i=e[1],a=i.scrollTop,l=i.viewportHeight,s=i.headerHeight,u=i.scrollingInProgress,c=e[2].scrollToIndex,m=t.stream();return t.connect(t.pipe(m,t.withLatestFrom(r,l,o,s,a),t.map(function(e){var n=e[0],r=n.index,o=n.behavior,i=void 0===o?"auto":o,a=n.done,l=e[1],s=e[2],c=e[4],m=e[5],f=e[3]-1,p=null;r=K(r,l);var d=j(r=Math.max(0,r,Math.min(f,r)),l.offsetTree)+c;return d<m?p={index:r,behavior:i,align:"start"}:d+b(l.sizeTree,r)[1]>m+s&&(p={index:r,behavior:i,align:"end"}),p?a&&t.handleNext(t.pipe(u,t.skip(1),t.filter(function(e){return!1===e})),a):a&&a(),p}),t.filter(function(e){return null!==e})),c),{scrollIntoView:m}},t.tup(Z,m,Q,ke,p),{singleton:!0}),Ve=t.system(function(e){return r({},e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},t.tup(te,ze,d,S,Fe,Me,Ue,ne,Pe)),Ae=t.system(function(e){var n=e[0],i=n.totalCount,a=n.sizeRanges,l=n.fixedItemSize,s=n.defaultItemSize,u=n.trackItemSizes,c=n.itemSize,m=n.data,f=n.firstItemIndex,p=n.groupIndices,d=e[1],h=d.initialTopMostItemIndex,g=d.scrolledToInitialItem,v=e[2],S=e[3],I=e[4],C=I.listState,x=I.topItemsIndexes,w=o(I,["listState","topItemsIndexes"]),T=e[5].scrollToIndex,b=e[7].topItemCount,y=e[8].groupCounts,L=e[9],E=e[10];return t.connect(w.rangeChanged,L.scrollSeekRangeChanged),t.connect(t.pipe(L.windowViewportRect,t.map(t.prop("visibleHeight"))),v.viewportHeight),r({totalCount:i,data:m,firstItemIndex:f,sizeRanges:a,initialTopMostItemIndex:h,scrolledToInitialItem:g,topItemsIndexes:x,topItemCount:b,groupCounts:y,fixedItemHeight:l,defaultItemHeight:s},S,{listState:C,scrollToIndex:T,trackItemSizes:u,itemSize:c,groupIndices:p},w,L,v,E)},t.tup(Z,Ie,m,xe,ke,Q,Oe,Be,Te,Ve,p)),Ne=(Ee=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"},He=!1,function(){return He||(He=!0,Re=Ee()),Re});function De(e){return e}var Ge=t.system(function(){var e=t.statefulStream(function(e){return"Item "+e}),n=t.statefulStream(function(e){return"Group "+e}),r=t.statefulStream({}),o=t.statefulStream(De),i=t.statefulStream("div"),a=t.statefulStream(t.noop),l=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{itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:i,scrollerRef:a,FooterComponent:l("Footer"),HeaderComponent:l("Header"),TopItemListComponent:l("TopItemList"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),GroupComponent:l("Group","div"),ScrollerComponent:l("Scroller","div"),EmptyPlaceholder:l("EmptyPlaceholder"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder")}});function We(e,n){var r=t.stream();return t.subscribe(r,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+n,"color: red;","color: inherit;","color: blue;")}),t.connect(r,e),r}var _e=t.system(function(e){var n=e[0],i=e[1],a={item:We(i.itemContent,"Rename the %citem%c prop to %citemContent."),group:We(i.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:We(n.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:We(n.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:We(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 l(e,n,o){t.connect(t.pipe(e,t.withLatestFrom(i.components),t.map(function(e){var t,i=e[0],a=e[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),r({},a,((t={})[n]=i,t))})),i.components)}return t.subscribe(a.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(a.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),t.subscribe(a.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(a.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(a.scrollSeek,function(e){var a=e.placeholder,l=o(e,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),t.publish(i.components,r({},t.getValue(i.components),{ScrollSeekPlaceholder:a})),t.publish(n.scrollSeekConfiguration,l)}),l(a.footer,"Footer","footer"),l(a.header,"Header","header"),l(a.ItemContainer,"Item","ItemContainer"),l(a.ListContainer,"List","ListContainer"),l(a.ScrollContainer,"Scroller","ScrollContainer"),l(a.emptyComponent,"EmptyPlaceholder","emptyComponent"),l(a.GroupContainer,"Group","GroupContainer"),r({},n,i,a)},t.tup(Ae,Ge)),je=function(e){return n.createElement("div",{style:{height:e.height}})},Ke={position:Ne(),zIndex:1,overflowAnchor:"none"},Ye=n.memo(function(e){var o=e.showTopList,i=void 0!==o&&o,a=st("listState"),l=st("deviation"),s=lt("sizeRanges"),u=st("useWindowScroll"),c=lt("windowScrollContainerState"),m=lt("scrollContainerState"),f=u?c:m,p=st("itemContent"),d=st("groupContent"),h=st("trackItemSizes"),g=st("itemSize"),v=st("log"),S=function(e,t,n,r,o){return he(function(n){var i=function(e,t,n,r){var o=e.length;if(0===o)return null;for(var i=[],a=0;a<o;a++){var l=e.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=t(l,"offsetHeight");if(0===c&&r("Zero-sized element, this should not happen",{child:l},exports.LogLevel.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,t,0,o),a=n.parentElement.parentElement,l="window"===n.parentElement.dataset.viewportType?window.pageYOffset||document.documentElement.scrollTop:a.scrollTop;r([Math.max(l,0),a.scrollHeight]),null!==i&&e(i)},n)}(s,g,h,i?t.noop:f,v),I=st("EmptyPlaceholder"),C=st("ScrollSeekPlaceholder")||je,x=st("ListComponent"),w=st("ItemComponent"),T=st("GroupComponent"),b=st("computeItemKey"),y=st("isSeeking"),L=st("groupIndices").length>0,E=st("paddingTopAddition"),R=st("scrolledToInitialItem"),H=st("firstItemIndex"),k=i?{}:{boxSizing:"border-box",paddingTop:a.offsetTop+E,paddingBottom:a.offsetBottom,marginTop:l};return!i&&0===a.items.length&&I&&R?n.createElement(I):n.createElement(x,{ref:S,style:k,"data-test-id":i?"virtuoso-top-item-list":"virtuoso-item-list"},(i?a.topItems:a.items).map(function(e){var t=e.originalIndex,o=b(t+H,e.data);return y?n.createElement(C,r({key:o,index:e.index,height:e.size,type:e.type||"item"},"group"===e.type?{}:{groupIndex:e.groupIndex})):"group"===e.type?n.createElement(T,{key:o,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:Ke},d(e.index)):n.createElement(w,{key:o,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex,style:{overflowAnchor:"none"}},L?p(e.index,e.groupIndex,e.data):p(e.index,e.data))}))}),qe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Ze={width:"100%",height:"100%",position:"absolute",top:0},Je={width:"100%",position:Ne(),top:0},$e=n.memo(function(){var e=st("HeaderComponent"),t=lt("headerHeight"),r=st("headerFooterTag"),o=he(function(e){return t(A(e,"height"))});return e?n.createElement(r,{ref:o},n.createElement(e)):null}),Qe=n.memo(function(){var e=st("FooterComponent"),t=lt("footerHeight"),r=st("headerFooterTag"),o=he(function(e){return t(A(e,"height"))});return e?n.createElement(r,{ref:o},n.createElement(e)):null});function Xe(e){var t=e.usePublisher,i=e.useEmitter,a=e.useEmitterValue;return n.memo(function(e){var l=e.style,s=e.children,u=o(e,["style","children"]),c=t("scrollContainerState"),m=a("ScrollerComponent"),f=Se(c,t("smoothScrollTargetReached"),m,a("scrollerRef")),p=f.scrollerRef,d=f.scrollByCallback;return i("scrollTo",f.scrollToCallback),i("scrollBy",d),n.createElement(m,r({ref:p,style:r({},qe,l),"data-test-id":"virtuoso-scroller",tabIndex:0},u),s)})}function et(e){var i=e.usePublisher,a=e.useEmitter,l=e.useEmitterValue;return n.memo(function(e){var s=e.style,u=e.children,c=o(e,["style","children"]),m=i("windowScrollContainerState"),f=l("ScrollerComponent"),p=i("smoothScrollTargetReached"),d=l("totalListHeight"),h=l("deviation"),g=Se(m,p,f,t.noop),v=g.scrollerRef,S=g.scrollByCallback,I=g.scrollToCallback;return ve(function(){return v.current=window,function(){v.current=null}},[v]),a("windowScrollTo",I),a("scrollBy",S),n.createElement(f,r({style:r({position:"relative"},s,0!==d?{height:d+h}:{})},c),u)})}var tt=function(e){var r=e.children,o=lt("viewportHeight"),i=he(t.compose(o,function(e){return A(e,"height")}));return n.createElement("div",{style:Ze,ref:i,"data-viewport-type":"element"},r)},nt=function(e){var t=e.children,r=ge(lt("windowViewportRect"));return n.createElement("div",{ref:r,style:Ze,"data-viewport-type":"window"},t)},rt=function(e){var t=e.children,o=st("TopItemListComponent"),i=st("headerHeight"),a=r({},Je,{marginTop:i+"px"});return n.createElement(o||"div",{style:a},t)},ot=n.memo(function(e){var t=st("useWindowScroll"),o=st("topItemsIndexes").length>0,i=t?nt:tt;return n.createElement(t?mt:ct,r({},e),n.createElement(i,null,n.createElement($e,null),n.createElement(Ye,null),n.createElement(Qe,null)),o&&n.createElement(rt,null,n.createElement(Ye,{showTopList:!0})))}),it=e.systemToComponent(_e,{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"}},ot),at=it.Component,lt=it.usePublisher,st=it.useEmitterValue,ut=it.useEmitter,ct=Xe({usePublisher:lt,useEmitterValue:st,useEmitter:ut}),mt=et({usePublisher:lt,useEmitterValue:st,useEmitter:ut}),ft=t.system(function(){var e=t.statefulStream(function(e){return"Item "+e}),n=t.statefulStream({}),r=t.statefulStream("virtuoso-grid-item"),o=t.statefulStream("virtuoso-grid-list"),i=t.statefulStream(De),a=t.statefulStream(t.noop),l=function(e,r){return void 0===r&&(r=null),t.statefulStreamFromEmitter(t.pipe(n,t.map(function(t){return t[e]}),t.distinctUntilChanged()),r)};return{itemContent:e,components:n,computeItemKey:i,itemClassName:r,listClassName:o,scrollerRef:a,ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),pt=t.system(function(e){var n=e[0],i=e[1],a={item:We(i.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:t.stream(),ScrollContainer:t.stream(),ListContainer:t.stream(),emptyComponent:t.stream(),scrollSeek:t.stream()};function l(e,n,o){t.connect(t.pipe(e,t.withLatestFrom(i.components),t.map(function(e){var t,i=e[0],a=e[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),r({},a,((t={})[n]=i,t))})),i.components)}return t.subscribe(a.scrollSeek,function(e){var a=e.placeholder,l=o(e,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),t.publish(i.components,r({},t.getValue(i.components),{ScrollSeekPlaceholder:a})),t.publish(n.scrollSeekConfiguration,l)}),l(a.ItemContainer,"Item","ItemContainer"),l(a.ListContainer,"List","ListContainer"),l(a.ScrollContainer,"Scroller","ScrollContainer"),r({},n,i,a)},t.tup(me,ft)),dt=n.memo(function(){var e=xt("gridState"),t=xt("listClassName"),r=xt("itemClassName"),o=xt("itemContent"),i=xt("computeItemKey"),a=xt("isSeeking"),l=Ct("scrollHeight"),s=xt("ItemComponent"),u=xt("ListComponent"),c=xt("ScrollSeekPlaceholder"),m=Ct("itemDimensions"),f=he(function(e){l(e.parentElement.parentElement.scrollHeight);var t=e.firstChild;t&&m(t.getBoundingClientRect())});return n.createElement(u,{ref:f,className:t,style:{paddingTop:e.offsetTop,paddingBottom:e.offsetBottom}},e.items.map(function(t){var l=i(t.index);return a?n.createElement(c,{key:l,index:t.index,height:e.itemHeight,width:e.itemWidth}):n.createElement(s,{className:r,"data-index":t.index,key:l},o(t.index))}))}),ht=function(e){var t=e.children,r=Ct("viewportDimensions"),o=he(function(e){r(e.getBoundingClientRect())});return n.createElement("div",{style:Ze,ref:o},t)},gt=function(e){var t=e.children,r=ge(Ct("windowViewportRect"));return n.createElement("div",{ref:r,style:Ze},t)},vt=n.memo(function(e){var t=r({},e),o=xt("useWindowScroll"),i=o?gt:ht;return n.createElement(o?bt:Tt,r({},t),n.createElement(i,null,n.createElement(dt,null)))}),St=e.systemToComponent(pt,{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"}},vt),It=St.Component,Ct=St.usePublisher,xt=St.useEmitterValue,wt=St.useEmitter,Tt=Xe({usePublisher:Ct,useEmitterValue:xt,useEmitter:wt}),bt=et({usePublisher:Ct,useEmitterValue:xt,useEmitter:wt}),yt=at,Lt=It;exports.GroupedVirtuoso=at,exports.Virtuoso=yt,exports.VirtuosoGrid=Lt;
1
+ "use strict";var e=require("@virtuoso.dev/react-urx"),t=require("@virtuoso.dev/urx"),n=require("react");function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(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 i(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)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function l(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function s(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}var u,c,m=t.system(function(){var e=t.stream(),n=t.stream(),r=t.statefulStream(0),o=t.stream(),i=t.statefulStream(0),a=t.stream(),l=t.stream(),s=t.statefulStream(0),u=t.statefulStream(0),c=t.stream(),m=t.stream(),f=t.statefulStream(!1);return t.connect(t.pipe(e,t.map(function(e){return e[0]})),n),t.connect(t.pipe(e,t.map(function(e){return e[1]})),l),t.connect(n,i),{scrollContainerState:e,scrollTop:n,viewportHeight:a,headerHeight:s,footerHeight:u,scrollHeight:l,smoothScrollTargetReached:o,scrollTo:c,scrollBy:m,statefulScrollTop:i,deviation:r,scrollingInProgress:f}},[],{singleton:!0});(c=exports.LogLevel||(exports.LogLevel={}))[c.DEBUG=0]="DEBUG",c[c.INFO=1]="INFO",c[c.WARN=2]="WARN",c[c.ERROR=3]="ERROR";var f=((u={})[exports.LogLevel.DEBUG]="debug",u[exports.LogLevel.INFO]="log",u[exports.LogLevel.WARN]="warn",u[exports.LogLevel.ERROR]="error",u),p=t.system(function(){var e=t.statefulStream(exports.LogLevel.ERROR);return{log:t.statefulStream(function(n,r,o){var i;void 0===o&&(o=exports.LogLevel.INFO),o>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:t.getValue(e))&&console[f[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0}),d=t.system(function(e){var n=e[0].log,r=t.statefulStream(!1),o=t.streamFromEmitter(t.pipe(r,t.filter(function(e){return e}),t.distinctUntilChanged()));return t.subscribe(r,function(e){e&&t.getValue(n)("props updated",{},exports.LogLevel.DEBUG)}),{propsReady:r,didMount:o}},t.tup(p),{singleton:!0}),h="up",g={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},v=t.system(function(e){var n=e[0],r=n.scrollContainerState,o=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(),f=t.stream(),p=t.statefulStream(4),d=t.streamFromEmitter(t.pipe(t.merge(t.pipe(t.duc(o),t.skip(1),t.mapTo(!0)),t.pipe(t.duc(o),t.skip(1),t.mapTo(!1),t.debounceTime(100))),t.distinctUntilChanged())),v=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.duc(o),t.map(function(e){return 0===e}),t.distinctUntilChanged()),c),t.connect(c,f);var S=t.streamFromEmitter(t.pipe(t.combineLatest(r,t.duc(i),t.duc(a),t.duc(l),t.duc(p)),t.scan(function(e,t){var n,r,o=t[0],i=o[0],a=o[1],l=t[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-t[4]?(i>e.state.scrollTop?(n="SCROLLED_DOWN",r=e.state.scrollTop-i):(n="SIZE_DECREASED",r=e.state.scrollTop-i||e.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:r}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>e.state.scrollHeight?"SIZE_INCREASED":l<e.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<e.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},g),t.distinctUntilChanged(function(e,t){return e&&e.atBottom===t.atBottom}))),I=t.statefulStreamFromEmitter(t.pipe(r,t.scan(function(e,t){var n=t[0],r=t[1];return e.scrollHeight!==r?e.scrollTop!==n?{scrollHeight:r,scrollTop:n,jump:e.scrollTop-n,changed:!0}:{scrollHeight:r,scrollTop:n,jump:0,changed:!0}:{scrollTop:n,scrollHeight:r,jump:0,changed:!1}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),t.filter(function(e){return e.changed}),t.map(function(e){return e.jump})),0);t.connect(t.pipe(S,t.map(function(e){return e.atBottom})),u),t.subscribe(u,function(e){setTimeout(function(){return t.publish(m,e)})});var C=t.statefulStream("down");t.subscribe(u,function(e){setTimeout(function(){t.publish(m,e)})}),t.connect(t.pipe(r,t.map(function(e){return e[0]}),t.distinctUntilChanged(),t.scan(function(e,n){return t.getValue(v)?{direction:e.direction,prevScrollTop:n}:{direction:n<e.prevScrollTop?h:"down",prevScrollTop:n}},{direction:"down",prevScrollTop:0}),t.map(function(e){return e.direction})),C),t.connect(t.pipe(r,t.throttleTime(50),t.mapTo("none")),C),t.connect(u,m);var x=t.statefulStream(0);return t.connect(t.pipe(d,t.filter(function(e){return!e}),t.mapTo(0)),x),t.connect(t.pipe(o,t.throttleTime(100),t.withLatestFrom(d),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]})),x),{isScrolling:d,isAtTop:c,isAtBottom:u,atBottomState:S,atTopStateChange:f,atBottomStateChange:m,scrollDirection:C,atBottomThreshold:p,scrollVelocity:x,lastJumpDueToItemResize:I}},t.tup(m)),S=t.system(function(e){var n=e[0].scrollVelocity,r=t.statefulStream(!1),o=t.stream(),i=t.statefulStream(!1);return t.connect(t.pipe(n,t.withLatestFrom(i,r,o),t.filter(function(e){return!!e[1]}),t.map(function(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=n.enter;if(r){if((0,n.exit)(t,o))return!1}else if(i(t,o))return!0;return r}),t.distinctUntilChanged()),r),t.subscribe(t.pipe(t.combineLatest(r,n,o),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:r,scrollSeekConfiguration:i,scrollVelocity:n,scrollSeekRangeChanged:o}},t.tup(v),{singleton:!0}),I={lvl:0};function C(e,t,n,r,o){return void 0===r&&(r=I),void 0===o&&(o=I),{k:e,v:t,lvl:n,l:r,r:o}}function x(e){return e===I}function w(){return I}function T(e,t){if(x(e))return I;var n=e.k,r=e.l,o=e.r;if(t===n){if(x(r))return o;if(x(o))return r;var i=R(r);return B(k(e,{k:i[0],v:i[1],l:H(r)}))}return B(k(e,t<n?{l:T(r,t)}:{r:T(o,t)}))}function b(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 r=b(e.r,t,n);return-Infinity===r[0]?[e.k,e.v]:r}return b(e.l,t,n)}function y(e,t,n){return x(e)?C(t,n,1):t===e.k?k(e,{k:t,v:n}):function(e){return M(U(e))}(k(e,t<e.k?{l:y(e.l,t,n)}:{r:y(e.r,t,n)}))}function L(e,t,n){if(x(e))return[];var r=e.k,o=e.v,i=e.r,a=[];return r>t&&(a=a.concat(L(e.l,t,n))),r>=t&&r<=n&&a.push({k:r,v:o}),r<=n&&(a=a.concat(L(i,t,n))),a}function E(e){return x(e)?[]:[].concat(E(e.l),[{k:e.k,v:e.v}],E(e.r))}function R(e){return x(e.r)?[e.k,e.v]:R(e.r)}function H(e){return x(e.r)?e.l:B(k(e,{r:H(e.r)}))}function k(e,t){return C(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 z(e){return x(e)||e.lvl>e.r.lvl}function B(e){var t=e.l,n=e.r,r=e.lvl;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(z(t))return U(k(e,{lvl:r-1}));if(x(t)||x(t.r))throw new Error("Unexpected empty nodes");return k(t.r,{l:k(t,{r:t.r.l}),r:k(e,{l:t.r.r,lvl:r-1}),lvl:r})}if(z(e))return M(k(e,{lvl:r-1}));if(x(n)||x(n.l))throw new Error("Unexpected empty nodes");var o=n.l,i=z(o)?n.lvl-1:n.lvl;return k(o,{l:k(e,{r:o.l,lvl:r-1}),r:M(k(n,{l:o.r,lvl:i})),lvl:o.lvl+1})}function F(e,t,n){return x(e)?[]:O(L(e,b(e,t)[0],n),function(e){return{index:e.k,value:e.v}})}function O(e,t){var n=e.length;if(0===n)return[];for(var r=t(e[0]),o=r.index,i=r.value,a=[],l=1;l<n;l++){var s=t(e[l]),u=s.index,c=s.value;a.push({start:o,end:u-1,value:i}),o=u,i=c}return a.push({start:o,end:Infinity,value:i}),a}function M(e){var t=e.r,n=e.lvl;return x(t)||x(t.r)||t.lvl!==n||t.r.lvl!==n?e:k(t,{l:k(e,{r:t.l}),lvl:n+1})}function U(e){var t=e.l;return x(t)||t.lvl!==e.lvl?e:k(t,{r:k(e,{l:t.r})})}function P(e,t,n,r){void 0===r&&(r=0);for(var o=e.length-1;r<=o;){var i=Math.floor((r+o)/2),a=n(e[i],t);if(0===a)return i;if(-1===a){if(o-r<2)return i-1;o=i-1}else{if(o===r)return i;r=i+1}}throw new Error("Failed binary finding record in array - "+e.join(",")+", searched for "+t)}function V(e,t,n){return e[P(e,t,n)]}function A(e,t){return Math.round(e.getBoundingClientRect()[t])}function N(e){var t=e.size,n=e.startIndex,r=e.endIndex;return function(e){return e.start===n&&(e.end===r||Infinity===e.end)&&e.value===t}}function D(e,t){var n=e.index;return t===n?0:t<n?-1:1}function G(e,t){var n=e.offset;return t===n?0:t<n?-1:1}function W(e){return{index:e.index,value:e}}function _(e,t){var n=t[0],r=t[1];n.length>0&&(0,t[2])("received item sizes",n,exports.LogLevel.DEBUG);var o=e.sizeTree,i=e.offsetTree,l=o,s=0;if(r.length>0&&x(o)&&2===n.length){var u=n[0].size,c=n[1].size;l=r.reduce(function(e,t){return y(y(e,t,u),t+1,c)},l)}else{var m=function(e,t){for(var n,r=x(e)?0:Infinity,o=a(t);!(n=o()).done;){var i=n.value,l=i.size,s=i.startIndex,u=i.endIndex;if(r=Math.min(r,s),x(e))e=y(e,0,l);else{var c=F(e,s-1,u+1);if(!c.some(N(i))){for(var m,f=!1,p=!1,d=a(c);!(m=d()).done;){var h=m.value,g=h.start,v=h.end,S=h.value;f?(u>=g||l===S)&&(e=T(e,g)):(p=S!==l,f=!0),v>u&&u>=g&&S!==l&&(e=y(e,u+1,S))}p&&(e=y(e,s,l))}}}return[e,r]}(l,n);l=m[0],s=m[1]}if(l===o)return e;var f=0,p=0,d=0,h=0;if(0!==s){h=P(i,s-1,D),d=i[h].offset;var g=b(l,s-1);f=g[0],p=g[1],i.length&&i[h].size===b(l,s)[1]&&(h-=1),i=i.slice(0,h+1)}else i=[];for(var v,S=a(F(l,s,Infinity));!(v=S()).done;){var I=v.value,C=I.start,L=I.value,E=(C-f)*p+d;i.push({offset:E,size:L,index:C}),f=C,d=E,p=L}return{sizeTree:l,offsetTree:i,groupOffsetTree:r.reduce(function(e,t){return y(e,t,j(t,i))},w()),lastIndex:f,lastOffset:d,lastSize:p,groupIndices:r}}function j(e,t){if(0===t.length)return 0;var n=V(t,e,D);return n.size*(e-n.index)+n.offset}function K(e,t){if(!Y(t))return e;for(var n=0;t.groupIndices[n]<=e+n;)n++;return e+n}function Y(e){return!x(e.groupOffsetTree)}var q={offsetHeight:"height",offsetWidth:"width"},Z=t.system(function(e){var n=e[0].log,o=t.stream(),i=t.stream(),a=t.stream(),l=t.statefulStream(0),s=t.statefulStream([]),u=t.statefulStream(void 0),c=t.statefulStream(void 0),m=t.statefulStream(function(e,t){return A(e,q[t])}),f=t.statefulStream(void 0),p={offsetTree:[],sizeTree:w(),groupOffsetTree:w(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},d=t.statefulStreamFromEmitter(t.pipe(o,t.withLatestFrom(s,n),t.scan(_,p),t.distinctUntilChanged()),p);t.connect(t.pipe(s,t.filter(function(e){return e.length>0}),t.withLatestFrom(d),t.map(function(e){var t=e[0],n=e[1],o=t.reduce(function(e,t,r){return y(e,t,j(t,n.offsetTree)||r)},w());return r({},n,{groupIndices:t,groupOffsetTree:o})})),d),t.connect(t.pipe(i,t.withLatestFrom(d),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}]})),o),t.connect(u,c);var h=t.statefulStreamFromEmitter(t.pipe(u,t.map(function(e){return void 0===e})),!0);t.connect(t.pipe(c,t.filter(function(e){return void 0!==e&&x(t.getValue(d).sizeTree)}),t.map(function(e){return[{startIndex:0,endIndex:0,size:e}]})),o);var g=t.streamFromEmitter(t.pipe(o,t.withLatestFrom(d),t.scan(function(e,t){var n=t[1];return{changed:n!==e.sizes,sizes:n}},{changed:!1,sizes:p}),t.map(function(e){return e.changed})));t.connect(t.pipe(l,t.scan(function(e,t){return{diff:e.prev-t,prev:t}},{diff:0,prev:0}),t.map(function(e){return e.diff}),t.filter(function(e){return e>0})),a),t.subscribe(t.pipe(l,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:l},exports.LogLevel.ERROR)});var v=t.streamFromEmitter(a);return t.connect(t.pipe(a,t.withLatestFrom(d),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 E(n.sizeTree).reduce(function(e,n){var r=n.k,o=n.v;return{ranges:[].concat(e.ranges,[{startIndex:e.prevIndex,endIndex:r+t-1,size:e.prevSize}]),prevIndex:r+t,prevSize:o}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),o),{data:f,totalCount:i,sizeRanges:o,groupIndices:s,defaultItemSize:c,fixedItemSize:u,unshiftWith:a,beforeUnshiftWith:v,firstItemIndex:l,sizes:d,listRefresh:g,trackItemSizes:h,itemSize:m}},t.tup(p),{singleton:!0}),J="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function $(e){var t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&J||(t.behavior="auto"),t.offset||(t.offset=0),t}var Q=t.system(function(e){var n=e[0],r=n.sizes,o=n.totalCount,i=n.listRefresh,a=e[1],l=a.scrollingInProgress,s=a.viewportHeight,u=a.scrollTo,c=a.smoothScrollTargetReached,m=a.headerHeight,f=a.footerHeight,p=e[2].log,d=t.stream(),h=t.statefulStream(0),g=null,v=null,S=null;function I(){g&&(g(),g=null),S&&(S(),S=null),v&&(clearTimeout(v),v=null),t.publish(l,!1)}return t.connect(t.pipe(d,t.withLatestFrom(r,s,o,h,m,f,p),t.map(function(e){var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],u=e[5],m=e[6],f=e[7],p=$(n),h=p.align,C=p.behavior,x=p.offset,w=a-1,T=p.index;"LAST"===T&&(T=w),T=K(T,r);var y=j(T=Math.max(0,T,Math.min(w,T)),r.offsetTree)+u;"end"===h?(y=Math.round(y-o+b(r.sizeTree,T)[1]),T===w&&(y+=m)):"center"===h?y=Math.round(y-o/2+b(r.sizeTree,T)[1]/2):y-=s,x&&(y+=x);var L=function(e){I(),e?(f("retrying to scroll to",{location:n},exports.LogLevel.DEBUG),t.publish(d,n)):f("list did not change, scroll successful",{},exports.LogLevel.DEBUG)};if(I(),"smooth"===C){var E=!1;S=t.subscribe(i,function(e){E=E||e}),g=t.handleNext(c,function(){L(E)})}else g=t.handleNext(t.pipe(i,function(e){var t=setTimeout(function(){e(!1)},50);return function(n){n&&(e(!0),clearTimeout(t))}}),L);return v=setTimeout(function(){I()},1200),t.publish(l,!0),f("scrolling from index to",{index:T,top:y,behavior:C},exports.LogLevel.DEBUG),{top:y,behavior:C}})),u),{scrollToIndex:d,topListHeight:h}},t.tup(Z,m,p),{singleton:!0});function X(e,t,n){return"number"==typeof e?n===h&&"top"===t||"down"===n&&"bottom"===t?e:0:n===h?"top"===t?e.main:e.reverse:"bottom"===t?e.main:e.reverse}function ee(e,t){return"number"==typeof e?e:e[t]||0}var te=t.system(function(e){var n=e[0],r=n.scrollTop,o=n.viewportHeight,i=n.deviation,a=n.headerHeight,s=t.stream(),u=t.statefulStream(0),c=t.statefulStream(0),m=t.statefulStream(0);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:t.statefulStreamFromEmitter(t.pipe(t.combineLatest(t.duc(r),t.duc(o),t.duc(a),t.duc(s,l),t.duc(m),t.duc(u),t.duc(i),t.duc(c)),t.map(function(e){var t=e[0],n=e[1],r=e[2],o=e[3],i=o[0],a=o[1],l=e[4],s=e[5],u=e[6],c=e[7],m=t-u,f=Math.max(r-m,0),p="none",d=ee(c,"top"),g=ee(c,"bottom");return i-=u,a+=r,(i+=r)>t+s-d&&(p=h),(a-=u)<t-f+n+g&&(p="down"),"none"!==p?[Math.max(m-r-X(l,"top",p)-d,0),m-f+n+X(l,"bottom",p)+g]:null}),t.filter(function(e){return null!=e}),t.distinctUntilChanged(l)),[0,0])}},t.tup(m),{singleton:!0}),ne=t.system(function(e){var n=e[0],o=n.scrollTo,i=n.scrollContainerState,a=t.stream(),l=t.stream(),s=t.stream(),u=t.statefulStream(!1);return t.connect(t.pipe(t.combineLatest(a,l),t.map(function(e){var t=e[0],n=t[1];return[Math.max(0,t[0]-e[1].offsetTop),n]})),i),t.connect(t.pipe(o,t.withLatestFrom(l),t.map(function(e){var t=e[0];return r({},t,{top:t.top+e[1].offsetTop})})),s),{useWindowScroll:u,windowScrollContainerState:a,windowViewportRect:l,windowScrollTo:s}},t.tup(m)),re={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},oe={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},ie=Math.ceil,ae=Math.floor,le=Math.min,se=Math.max;function ue(e){return ie(e)-e<.03?ie(e):ae(e)}function ce(e,t){return Array.from({length:t-e+1}).map(function(t,n){return{index:n+e}})}var me=t.system(function(e){var n=e[0],o=n.overscan,i=n.visibleRange,a=n.listBoundary,u=e[1],c=u.scrollTop,m=u.viewportHeight,f=u.scrollBy,p=u.scrollTo,d=u.smoothScrollTargetReached,h=u.scrollContainerState,g=e[2],v=e[3],S=e[4],I=S.propsReady,C=S.didMount,x=e[5],w=x.windowViewportRect,T=x.windowScrollTo,b=x.useWindowScroll,y=x.windowScrollContainerState,L=t.statefulStream(0),E=t.statefulStream(0),R=t.statefulStream(re),H=t.statefulStream({height:0,width:0}),k=t.statefulStream({height:0,width:0}),z=t.stream(),B=t.stream(),F=t.statefulStream(0);t.connect(t.pipe(C,t.withLatestFrom(E),t.filter(function(e){return 0!==e[1]}),t.map(function(e){return{items:ce(0,e[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),R),t.connect(t.pipe(t.combineLatest(t.duc(L),i,t.duc(k,function(e,t){return e&&e.width===t.width&&e.height===t.height})),t.withLatestFrom(H),t.map(function(e){var t=e[0],n=t[0],r=t[1],o=r[0],i=r[1],a=t[2],l=e[1],s=a.height,u=a.width,c=l.width;if(0===n||0===c)return re;if(0===u)return oe;var m=ue(c/u),f=m*ae(o/s),p=m*ie(i/s)-1;p=le(n-1,p);var d=ce(f=le(p,se(0,f)),p),h=fe(l,a,d),g=h.top,v=h.bottom;return{items:d,offsetTop:g,offsetBottom:ie(n/m)*s-v,top:g,bottom:v,itemHeight:s,itemWidth:u}})),R),t.connect(t.pipe(H,t.map(function(e){return e.height})),m),t.connect(t.pipe(t.combineLatest(H,k,R),t.map(function(e){var t=fe(e[0],e[1],e[2].items);return[t.top,t.bottom]}),t.distinctUntilChanged(l)),a);var O=t.streamFromEmitter(t.pipe(t.duc(R),t.filter(function(e){return e.items.length>0}),t.withLatestFrom(L),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())),M=t.streamFromEmitter(t.pipe(t.duc(R),t.filter(function(e){var t=e.items;return t.length>0&&0===t[0].index}),t.mapTo(0),t.distinctUntilChanged())),U=t.streamFromEmitter(t.pipe(t.duc(R),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(s)));t.connect(U,v.scrollSeekRangeChanged),t.connect(t.pipe(z,t.withLatestFrom(H,k,L),t.map(function(e){var t=e[1],n=e[2],r=e[3],o=$(e[0]),i=o.align,a=o.behavior,l=o.offset,s=o.index;"LAST"===s&&(s=r-1);var u=pe(t,n,s=Math.max(0,s,Math.min(r-1,s)));return"end"===i?u=Math.round(u-t.height+n.height):"center"===i&&(u=Math.round(u-t.height/2+n.height/2)),l&&(u+=l),{top:u,behavior:a}})),p);var P=t.statefulStreamFromEmitter(t.pipe(R,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}})),H),r({totalCount:L,viewportDimensions:H,itemDimensions:k,scrollTop:c,scrollHeight:B,overscan:o,scrollBy:f,scrollTo:p,scrollToIndex:z,smoothScrollTargetReached:d,windowViewportRect:w,windowScrollTo:T,useWindowScroll:b,windowScrollContainerState:y,deviation:F,scrollContainerState:h,initialItemCount:E},v,{gridState:R,totalListHeight:P},g,{startReached:M,endReached:O,rangeChanged:U,propsReady:I})},t.tup(te,m,v,S,d,ne));function fe(e,t,n){var r=t.height;return void 0===r||0===n.length?{top:0,bottom:0}:{top:pe(e,t,n[0].index),bottom:pe(e,t,n[n.length-1].index)+r}}function pe(e,t,n){var r=ue(e.width/t.width);return ae(n/r)*t.height}function de(e,t){void 0===t&&(t=!0);var r=n.useRef(null),o=function(e){};if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t[0].target;null!==n.offsetParent&&e(n)});o=function(e){e&&t?(i.observe(e),r.current=e):(r.current&&i.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:o}}function he(e,t){return void 0===t&&(t=!0),de(e,t).callbackRef}function ge(e){var t=n.useRef(null),r=n.useCallback(function(n){if(null!==n){var r=n.getBoundingClientRect(),o=window.innerHeight-Math.max(0,r.top),i=r.top+window.pageYOffset;t.current={offsetTop:i,visibleHeight:o,visibleWidth:r.width},e(t.current)}},[e]),o=de(r),i=o.callbackRef,a=o.ref,l=n.useCallback(function(){r(a.current)},[r,a]);return n.useEffect(function(){return window.addEventListener("scroll",l),window.addEventListener("resize",l),function(){window.removeEventListener("scroll",l),window.removeEventListener("resize",l)}},[l]),i}var ve="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;function Se(e,r,o,i){void 0===i&&(i=t.noop);var a=n.useRef(null),l=n.useRef(null),s=n.useRef(null),u=n.useCallback(function(t){var n=t.target,o=n===window||n===document?window.pageYOffset||document.documentElement.scrollTop:n.scrollTop,i=n===window?document.documentElement.scrollHeight:n.scrollHeight;e([Math.max(o,0),i]),null!==l.current&&(o===l.current||o<=0||o===n.scrollHeight-A(n,"height"))&&(l.current=null,r(!0),s.current&&(clearTimeout(s.current),s.current=null))},[e,r]);return n.useEffect(function(){var e=a.current;return i(a.current),u({target:e}),e.addEventListener("scroll",u,{passive:!0}),function(){i(null),e.removeEventListener("scroll",u)}},[a,u,o,i]),{scrollerRef:a,scrollByCallback:function(e){null===l.current&&a.current.scrollBy(e)},scrollToCallback:function(t){var n=a.current;if(n&&(!("offsetHeight"in n)||0!==n.offsetHeight)){var o,i,u,c="smooth"===t.behavior;if(n===window?(i=Math.max(A(document.documentElement,"height"),document.documentElement.scrollHeight),o=window.innerHeight,u=document.documentElement.scrollTop):(i=n.scrollHeight,o=A(n,"height"),u=n.scrollTop),t.top=Math.max(Math.min(i-o,t.top),0),Math.abs(o-i)<1.01||t.top===u)return e([u,i]),void(c&&r(!0));c?(l.current=t.top,s.current&&clearTimeout(s.current),s.current=setTimeout(function(){s.current=null,l.current=null,r(!0)},1e3)):l.current=null,n.scrollTo(t)}}}}var Ie=t.system(function(e){var n=e[0],r=n.sizes,o=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 0!==e[1]}),t.mapTo(!1)),u),t.subscribe(t.pipe(t.combineLatest(o,s),t.withLatestFrom(u,r,i),t.filter(function(e){var t=e[1],n=e[3];return e[0][1]&&(!x(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(Z,m,Q,d),{singleton:!0});function Ce(e){return!!e&&("smooth"===e?"smooth":"auto")}var xe=t.system(function(e){var n=e[0],r=n.totalCount,o=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,f=c.didMount,p=e[5].log,d=e[6].scrollingInProgress,h=t.statefulStream(!1),g=null;function v(e){t.publish(s,{index:"LAST",align:"end",behavior:e})}return t.subscribe(t.pipe(t.combineLatest(t.pipe(t.duc(r),t.skip(1)),f),t.withLatestFrom(t.duc(h),a,u,d),t.map(function(e){var t=e[0],n=t[0],r=t[1]&&e[3],o="auto";return r&&(o=function(e,t){return"function"==typeof e?Ce(e(t)):t&&Ce(e)}(e[1],e[2]||e[4]),r=r&&!!o),{totalCount:n,shouldFollow:r,followOutputBehavior:o}}),t.filter(function(e){return e.shouldFollow})),function(e){var n=e.totalCount,r=e.followOutputBehavior;g&&(g(),g=null),g=t.handleNext(o,function(){t.getValue(p)("following output to ",{totalCount:n},exports.LogLevel.DEBUG),v(r),g=null})}),t.subscribe(t.pipe(t.combineLatest(t.duc(h),r,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(h,r)),function(e){var n=e[1],r=t.handleNext(l,function(e){!n||e.atBottom||"SIZE_INCREASED"!==e.notAtBottomBecause||g||(t.getValue(p)("scrolling to bottom due to increased size",{},exports.LogLevel.DEBUG),v("auto"))});setTimeout(r,100)}),t.subscribe(t.combineLatest(t.duc(h),l),function(e){var t=e[1];e[0]&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&v("auto")}),{followOutput:h}},t.tup(Z,v,Q,Ie,d,p,m));function we(e){return e.reduce(function(e,t){return e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e},{totalCount:0,groupIndices:[]})}var Te=t.system(function(e){var n=e[0],r=n.totalCount,o=n.groupIndices,i=n.sizes,a=e[1],l=a.scrollTop,s=a.headerHeight,u=t.stream(),c=t.stream(),m=t.streamFromEmitter(t.pipe(u,t.map(we)));return t.connect(t.pipe(m,t.map(t.prop("totalCount"))),r),t.connect(t.pipe(m,t.map(t.prop("groupIndices"))),o),t.connect(t.pipe(t.combineLatest(l,i,s),t.filter(function(e){return Y(e[1])}),t.map(function(e){return b(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(Z,m)),be={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0};function ye(e,t,n){if(0===e.length)return[];if(!Y(t))return e.map(function(e){return r({},e,{index:e.index+n,originalIndex:e.index})});for(var o,i=[],l=F(t.groupOffsetTree,e[0].index,e[e.length-1].index),s=void 0,u=0,c=a(e);!(o=c()).done;){var m=o.value;(!s||s.end<m.index)&&(s=l.shift(),u=t.groupIndices.indexOf(s.start)),i.push(r({},m.index===s.start?{type:"group",index:u}:{index:m.index-(u+1)+n,groupIndex:u},{size:m.size,offset:m.offset,originalIndex:m.index,data:m.data}))}return i}function Le(e,t,n,r,o){var i=0,a=0;if(e.length>0){i=e[0].offset;var l=e[e.length-1];a=l.offset+l.size}var s=i,u=r.lastOffset+(n-r.lastIndex)*r.lastSize-a;return{items:ye(e,r,o),topItems:ye(t,r,o),topListHeight:t.reduce(function(e,t){return t.size+e},0),offsetTop:i,offsetBottom:u,top:s,bottom:a,totalCount:n}}var Ee,Re,He,ke=t.system(function(e){var n=e[0],o=n.sizes,i=n.totalCount,u=n.data,c=n.firstItemIndex,m=e[1],f=e[2],p=f.visibleRange,d=f.listBoundary,h=f.topListHeight,g=e[3],v=g.scrolledToInitialItem,S=g.initialTopMostItemIndex,I=e[4].topListHeight,C=e[5],w=e[6].didMount,T=t.statefulStream([]),y=t.stream();t.connect(m.topItemsIndexes,T);var L=t.statefulStreamFromEmitter(t.pipe(t.combineLatest(w,t.duc(p),t.duc(i),t.duc(o),t.duc(S),v,t.duc(T),t.duc(c),u),t.filter(function(e){return e[0]}),t.map(function(e){var n=e[1],r=n[0],o=n[1],i=e[2],l=e[4],s=e[5],u=e[6],c=e[7],m=e[8],f=e[3],p=f.sizeTree,d=f.offsetTree;if(0===i||0===r&&0===o)return be;if(x(p))return Le(function(e,t,n){if(Y(t)){var r=K(e,t);return[{index:b(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}(l,f,m),[],i,f,c);var h=[];if(u.length>0)for(var g,v=u[0],S=u[u.length-1],I=0,C=a(F(p,v,S));!(g=C()).done;)for(var w=g.value,T=w.value,y=Math.max(w.start,v),L=Math.min(w.end,S),E=y;E<=L;E++)h.push({index:E,size:T,offset:I,data:m&&m[E]}),I+=T;if(!s)return Le([],h,i,f,c);var R=u.length>0?u[u.length-1]+1:0,H=function(e,t,n,r){return void 0===r&&(r=0),r>0&&(t=Math.max(t,V(e,r,D).offset)),O((i=n,l=P(o=e,t,a=G),s=P(o,i,a,l),o.slice(l,s+1)),W);var o,i,a,l,s}(d,r,o,R);if(0===H.length)return null;var k=i-1;return Le(t.tap([],function(e){for(var t,n=a(H);!(t=n()).done;){var i=t.value,l=i.value,s=l.offset,u=i.start,c=l.size;l.offset<r&&(s+=((u+=Math.floor((r-l.offset)/c))-i.start)*c),u<R&&(s+=(R-u)*c,u=R);for(var f=Math.min(i.end,k),p=u;p<=f&&!(s>=o);p++)e.push({index:p,size:c,offset:s,data:m&&m[p]}),s+=c}}),h,i,f,c)}),t.filter(function(e){return null!==e}),t.distinctUntilChanged()),be);return t.connect(t.pipe(u,t.filter(function(e){return void 0!==e}),t.map(function(e){return e.length})),i),t.connect(t.pipe(L,t.map(t.prop("topListHeight"))),I),t.connect(I,h),t.connect(t.pipe(L,t.map(function(e){return[e.top,e.bottom]})),d),t.connect(t.pipe(L,t.map(function(e){return e.items})),y),r({listState:L,topItemsIndexes:T,endReached:t.streamFromEmitter(t.pipe(L,t.filter(function(e){return e.items.length>0}),t.withLatestFrom(i,u),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(l),t.map(function(e){return e[0]}))),startReached:t.streamFromEmitter(t.pipe(L,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(L,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(s))),itemsRendered:y},C)},t.tup(Z,Te,te,Ie,Q,v,d),{singleton:!0}),ze=t.system(function(e){var n=e[0],r=n.sizes,o=n.firstItemIndex,i=n.data,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(r,o,i),t.map(function(e){var t=e[0][1],n=e[1],r=e[2],o=e[3],i=void 0===o?[]:o,l=0;if(n.groupIndices.length>0)for(var s,u=a(n.groupIndices);!((s=u()).done||s.value-l>=t);)l++;var c=t+l;return Le(Array.from({length:c}).map(function(e,t){return{index:t,size:0,offset:0,data:i[t]}}),[],c,n,r)})),l),{initialItemCount:u}},t.tup(Z,ke,d),{singleton:!0}),Be=t.system(function(e){var n=e[0].topItemsIndexes,r=t.statefulStream(0);return t.connect(t.pipe(r,t.filter(function(e){return e>0}),t.map(function(e){return Array.from({length:e}).map(function(e,t){return t})})),n),{topItemCount:r}},t.tup(ke)),Fe=t.system(function(e){var n=e[0],r=n.footerHeight,o=n.headerHeight,i=e[1].listState,a=t.stream(),l=t.statefulStreamFromEmitter(t.pipe(t.combineLatest(r,o,i),t.map(function(e){var t=e[2];return e[0]+e[1]+t.offsetBottom+t.bottom})),0);return t.connect(t.duc(l),a),{totalListHeight:l,totalListHeightChanged:a}},t.tup(m,ke),{singleton:!0}),Oe=t.system(function(e){var n=e[0],r=n.scrollBy,o=n.scrollTop,i=n.deviation,a=n.scrollingInProgress,l=e[1],s=l.isScrolling,u=l.isAtBottom,c=l.atBottomState,m=l.scrollDirection,f=e[3],p=f.beforeUnshiftWith,d=f.sizes,g=e[4].log,v=t.streamFromEmitter(t.pipe(e[2].listState,t.withLatestFrom(l.lastJumpDueToItemResize),t.scan(function(e,t){var n=e[1],r=t[0],o=r.items,i=r.totalCount,a=t[1],l=0;if(e[2]===i){if(n.length>0&&o.length>0){var s=1===o.length;if(0!==o[0].originalIndex||0!==n[0].originalIndex)for(var u=function(e){var t=o[e],r=n.find(function(e){return e.originalIndex===t.originalIndex});return r?t.offset!==r.offset||s?(l=t.offset-r.offset+t.size-r.size,"break"):void 0:"continue"},c=o.length-1;c>=0;c--){var m=u(c);if("continue"!==m&&"break"===m)break}}0!==l&&(l+=a)}return[l,o,i]},[0,[],0]),t.filter(function(e){return 0!==e[0]}),t.withLatestFrom(o,m,a,g,u,c),t.filter(function(e){return!e[3]&&0!==e[1]&&e[2]===h}),t.map(function(e){var t=e[0][0];return(0,e[4])("Upward scrolling compensation",{amount:t},exports.LogLevel.DEBUG),t})));return t.connect(t.pipe(v,t.withLatestFrom(i),t.map(function(e){return e[1]-e[0]})),i),t.subscribe(t.pipe(t.combineLatest(t.statefulStreamFromEmitter(s,!1),i),t.filter(function(e){return!e[0]&&0!==e[1]}),t.map(function(e){return e[1]}),t.throttleTime(1)),function(e){e>0?(t.publish(r,{top:-e,behavior:"auto"}),t.publish(i,0)):(t.publish(i,0),t.publish(r,{top:-e,behavior:"auto"}))}),t.connect(t.pipe(p,t.withLatestFrom(d),t.map(function(e){return e[0]*e[1].lastSize})),v),{deviation:i}},t.tup(m,v,ke,Z,p)),Me=t.system(function(e){var n=e[0].totalListHeight,r=e[1].didMount,o=e[2].scrollTo,i=t.statefulStream(0);return t.subscribe(t.pipe(r,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(o,e)})})}),{initialScrollTop:i}},t.tup(Fe,d,m),{singleton:!0}),Ue=t.system(function(e){var n=e[0].viewportHeight,r=e[1].totalListHeight,o=t.statefulStream(!1);return{alignToBottom:o,paddingTopAddition:t.statefulStreamFromEmitter(t.pipe(t.combineLatest(o,n,r),t.filter(function(e){return e[0]}),t.map(function(e){return Math.max(0,e[1]-e[2])}),t.distinctUntilChanged()),0)}},t.tup(m,Fe),{singleton:!0}),Pe=t.system(function(e){var n=e[0],r=n.sizes,o=n.totalCount,i=e[1],a=i.scrollTop,l=i.viewportHeight,s=i.headerHeight,u=i.scrollingInProgress,c=e[2].scrollToIndex,m=t.stream();return t.connect(t.pipe(m,t.withLatestFrom(r,l,o,s,a),t.map(function(e){var n=e[0],r=n.index,o=n.behavior,i=void 0===o?"auto":o,a=n.done,l=e[1],s=e[2],c=e[4],m=e[5],f=e[3]-1,p=null;r=K(r,l);var d=j(r=Math.max(0,r,Math.min(f,r)),l.offsetTree)+c;return d<m?p={index:r,behavior:i,align:"start"}:d+b(l.sizeTree,r)[1]>m+s&&(p={index:r,behavior:i,align:"end"}),p?a&&t.handleNext(t.pipe(u,t.skip(1),t.filter(function(e){return!1===e})),a):a&&a(),p}),t.filter(function(e){return null!==e})),c),{scrollIntoView:m}},t.tup(Z,m,Q,ke,p),{singleton:!0}),Ve=t.system(function(e){return r({},e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},t.tup(te,ze,d,S,Fe,Me,Ue,ne,Pe)),Ae=t.system(function(e){var n=e[0],i=n.totalCount,a=n.sizeRanges,l=n.fixedItemSize,s=n.defaultItemSize,u=n.trackItemSizes,c=n.itemSize,m=n.data,f=n.firstItemIndex,p=n.groupIndices,d=e[1],h=d.initialTopMostItemIndex,g=d.scrolledToInitialItem,v=e[2],S=e[3],I=e[4],C=I.listState,x=I.topItemsIndexes,w=o(I,["listState","topItemsIndexes"]),T=e[5].scrollToIndex,b=e[7].topItemCount,y=e[8].groupCounts,L=e[9],E=e[10];return t.connect(w.rangeChanged,L.scrollSeekRangeChanged),t.connect(t.pipe(L.windowViewportRect,t.map(t.prop("visibleHeight"))),v.viewportHeight),r({totalCount:i,data:m,firstItemIndex:f,sizeRanges:a,initialTopMostItemIndex:h,scrolledToInitialItem:g,topItemsIndexes:x,topItemCount:b,groupCounts:y,fixedItemHeight:l,defaultItemHeight:s},S,{listState:C,scrollToIndex:T,trackItemSizes:u,itemSize:c,groupIndices:p},w,L,v,E)},t.tup(Z,Ie,m,xe,ke,Q,Oe,Be,Te,Ve,p)),Ne=(Ee=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"},He=!1,function(){return He||(He=!0,Re=Ee()),Re});function De(e){return e}var Ge=t.system(function(){var e=t.statefulStream(function(e){return"Item "+e}),n=t.statefulStream(function(e){return"Group "+e}),r=t.statefulStream({}),o=t.statefulStream(De),i=t.statefulStream("div"),a=t.statefulStream(t.noop),l=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{itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:i,scrollerRef:a,FooterComponent:l("Footer"),HeaderComponent:l("Header"),TopItemListComponent:l("TopItemList"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),GroupComponent:l("Group","div"),ScrollerComponent:l("Scroller","div"),EmptyPlaceholder:l("EmptyPlaceholder"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder")}});function We(e,n){var r=t.stream();return t.subscribe(r,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+n,"color: red;","color: inherit;","color: blue;")}),t.connect(r,e),r}var _e=t.system(function(e){var n=e[0],i=e[1],a={item:We(i.itemContent,"Rename the %citem%c prop to %citemContent."),group:We(i.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:We(n.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:We(n.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:We(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 l(e,n,o){t.connect(t.pipe(e,t.withLatestFrom(i.components),t.map(function(e){var t,i=e[0],a=e[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),r({},a,((t={})[n]=i,t))})),i.components)}return t.subscribe(a.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(a.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),t.subscribe(a.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(a.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(a.scrollSeek,function(e){var a=e.placeholder,l=o(e,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),t.publish(i.components,r({},t.getValue(i.components),{ScrollSeekPlaceholder:a})),t.publish(n.scrollSeekConfiguration,l)}),l(a.footer,"Footer","footer"),l(a.header,"Header","header"),l(a.ItemContainer,"Item","ItemContainer"),l(a.ListContainer,"List","ListContainer"),l(a.ScrollContainer,"Scroller","ScrollContainer"),l(a.emptyComponent,"EmptyPlaceholder","emptyComponent"),l(a.GroupContainer,"Group","GroupContainer"),r({},n,i,a)},t.tup(Ae,Ge)),je=function(e){return n.createElement("div",{style:{height:e.height}})},Ke={position:Ne(),zIndex:1,overflowAnchor:"none"},Ye=n.memo(function(e){var o=e.showTopList,i=void 0!==o&&o,a=st("listState"),l=st("deviation"),s=lt("sizeRanges"),u=st("useWindowScroll"),c=lt("windowScrollContainerState"),m=lt("scrollContainerState"),f=u?c:m,p=st("itemContent"),d=st("groupContent"),h=st("trackItemSizes"),g=st("itemSize"),v=st("log"),S=function(e,t,n,r,o){return he(function(n){var i=function(e,t,n,r){var o=e.length;if(0===o)return null;for(var i=[],a=0;a<o;a++){var l=e.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=t(l,"offsetHeight");if(0===c&&r("Zero-sized element, this should not happen",{child:l},exports.LogLevel.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,t,0,o),a=n.parentElement.parentElement,l="window"===n.parentElement.dataset.viewportType?window.pageYOffset||document.documentElement.scrollTop:a.scrollTop;r([Math.max(l,0),a.scrollHeight]),null!==i&&e(i)},n)}(s,g,h,i?t.noop:f,v),I=st("EmptyPlaceholder"),C=st("ScrollSeekPlaceholder")||je,x=st("ListComponent"),w=st("ItemComponent"),T=st("GroupComponent"),b=st("computeItemKey"),y=st("isSeeking"),L=st("groupIndices").length>0,E=st("paddingTopAddition"),R=st("scrolledToInitialItem"),H=st("firstItemIndex"),k=i?{}:{boxSizing:"border-box",paddingTop:a.offsetTop+E,paddingBottom:a.offsetBottom,marginTop:l};return!i&&0===a.items.length&&I&&R?n.createElement(I):n.createElement(x,{ref:S,style:k,"data-test-id":i?"virtuoso-top-item-list":"virtuoso-item-list"},(i?a.topItems:a.items).map(function(e){var t=e.originalIndex,o=b(t+H,e.data);return y?n.createElement(C,r({key:o,index:e.index,height:e.size,type:e.type||"item"},"group"===e.type?{}:{groupIndex:e.groupIndex})):"group"===e.type?n.createElement(T,{key:o,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:Ke},d(e.index)):n.createElement(w,{key:o,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex,style:{overflowAnchor:"none"}},L?p(e.index,e.groupIndex,e.data):p(e.index,e.data))}))}),qe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Ze={width:"100%",height:"100%",position:"absolute",top:0},Je={width:"100%",position:Ne(),top:0},$e=n.memo(function(){var e=st("HeaderComponent"),t=lt("headerHeight"),r=st("headerFooterTag"),o=he(function(e){return t(A(e,"height"))});return e?n.createElement(r,{ref:o},n.createElement(e)):null}),Qe=n.memo(function(){var e=st("FooterComponent"),t=lt("footerHeight"),r=st("headerFooterTag"),o=he(function(e){return t(A(e,"height"))});return e?n.createElement(r,{ref:o},n.createElement(e)):null});function Xe(e){var t=e.usePublisher,i=e.useEmitter,a=e.useEmitterValue;return n.memo(function(e){var l=e.style,s=e.children,u=o(e,["style","children"]),c=t("scrollContainerState"),m=a("ScrollerComponent"),f=Se(c,t("smoothScrollTargetReached"),m,a("scrollerRef")),p=f.scrollerRef,d=f.scrollByCallback;return i("scrollTo",f.scrollToCallback),i("scrollBy",d),n.createElement(m,r({ref:p,style:r({},qe,l),"data-test-id":"virtuoso-scroller",tabIndex:0},u),s)})}function et(e){var i=e.usePublisher,a=e.useEmitter,l=e.useEmitterValue;return n.memo(function(e){var s=e.style,u=e.children,c=o(e,["style","children"]),m=i("windowScrollContainerState"),f=l("ScrollerComponent"),p=i("smoothScrollTargetReached"),d=l("totalListHeight"),h=l("deviation"),g=Se(m,p,f,t.noop),v=g.scrollerRef,S=g.scrollByCallback,I=g.scrollToCallback;return ve(function(){return v.current=window,function(){v.current=null}},[v]),a("windowScrollTo",I),a("scrollBy",S),n.createElement(f,r({style:r({position:"relative"},s,0!==d?{height:d+h}:{})},c),u)})}var tt=function(e){var r=e.children,o=lt("viewportHeight"),i=he(t.compose(o,function(e){return A(e,"height")}));return n.createElement("div",{style:Ze,ref:i,"data-viewport-type":"element"},r)},nt=function(e){var t=e.children,r=ge(lt("windowViewportRect"));return n.createElement("div",{ref:r,style:Ze,"data-viewport-type":"window"},t)},rt=function(e){var t=e.children,o=st("TopItemListComponent"),i=st("headerHeight"),a=r({},Je,{marginTop:i+"px"});return n.createElement(o||"div",{style:a},t)},ot=n.memo(function(e){var t=st("useWindowScroll"),o=st("topItemsIndexes").length>0,i=t?nt:tt;return n.createElement(t?mt:ct,r({},e),n.createElement(i,null,n.createElement($e,null),n.createElement(Ye,null),n.createElement(Qe,null)),o&&n.createElement(rt,null,n.createElement(Ye,{showTopList:!0})))}),it=e.systemToComponent(_e,{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"}},ot),at=it.Component,lt=it.usePublisher,st=it.useEmitterValue,ut=it.useEmitter,ct=Xe({usePublisher:lt,useEmitterValue:st,useEmitter:ut}),mt=et({usePublisher:lt,useEmitterValue:st,useEmitter:ut}),ft=t.system(function(){var e=t.statefulStream(function(e){return"Item "+e}),n=t.statefulStream({}),r=t.statefulStream("virtuoso-grid-item"),o=t.statefulStream("virtuoso-grid-list"),i=t.statefulStream(De),a=t.statefulStream(t.noop),l=function(e,r){return void 0===r&&(r=null),t.statefulStreamFromEmitter(t.pipe(n,t.map(function(t){return t[e]}),t.distinctUntilChanged()),r)};return{itemContent:e,components:n,computeItemKey:i,itemClassName:r,listClassName:o,scrollerRef:a,ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),pt=t.system(function(e){var n=e[0],i=e[1],a={item:We(i.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:t.stream(),ScrollContainer:t.stream(),ListContainer:t.stream(),emptyComponent:t.stream(),scrollSeek:t.stream()};function l(e,n,o){t.connect(t.pipe(e,t.withLatestFrom(i.components),t.map(function(e){var t,i=e[0],a=e[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),r({},a,((t={})[n]=i,t))})),i.components)}return t.subscribe(a.scrollSeek,function(e){var a=e.placeholder,l=o(e,["placeholder"]);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),t.publish(i.components,r({},t.getValue(i.components),{ScrollSeekPlaceholder:a})),t.publish(n.scrollSeekConfiguration,l)}),l(a.ItemContainer,"Item","ItemContainer"),l(a.ListContainer,"List","ListContainer"),l(a.ScrollContainer,"Scroller","ScrollContainer"),r({},n,i,a)},t.tup(me,ft)),dt=n.memo(function(){var e=xt("gridState"),t=xt("listClassName"),r=xt("itemClassName"),o=xt("itemContent"),i=xt("computeItemKey"),a=xt("isSeeking"),l=Ct("scrollHeight"),s=xt("ItemComponent"),u=xt("ListComponent"),c=xt("ScrollSeekPlaceholder"),m=Ct("itemDimensions"),f=he(function(e){l(e.parentElement.parentElement.scrollHeight);var t=e.firstChild;t&&m(t.getBoundingClientRect())});return n.createElement(u,{ref:f,className:t,style:{paddingTop:e.offsetTop,paddingBottom:e.offsetBottom}},e.items.map(function(t){var l=i(t.index);return a?n.createElement(c,{key:l,index:t.index,height:e.itemHeight,width:e.itemWidth}):n.createElement(s,{className:r,"data-index":t.index,key:l},o(t.index))}))}),ht=function(e){var t=e.children,r=Ct("viewportDimensions"),o=he(function(e){r(e.getBoundingClientRect())});return n.createElement("div",{style:Ze,ref:o},t)},gt=function(e){var t=e.children,r=ge(Ct("windowViewportRect"));return n.createElement("div",{ref:r,style:Ze},t)},vt=n.memo(function(e){var t=r({},e),o=xt("useWindowScroll"),i=o?gt:ht;return n.createElement(o?bt:Tt,r({},t),n.createElement(i,null,n.createElement(dt,null)))}),St=e.systemToComponent(pt,{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"}},vt),It=St.Component,Ct=St.usePublisher,xt=St.useEmitterValue,wt=St.useEmitter,Tt=Xe({usePublisher:Ct,useEmitterValue:xt,useEmitter:wt}),bt=et({usePublisher:Ct,useEmitterValue:xt,useEmitter:wt}),yt=at,Lt=It;exports.GroupedVirtuoso=at,exports.Virtuoso=yt,exports.VirtuosoGrid=Lt;
2
2
  //# sourceMappingURL=index.js.map