react-virtuoso
Advanced tools
Comparing version 2.17.0 to 2.17.1
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("@virtuoso.dev/react-urx"),t=require("@virtuoso.dev/urx"),n=require("react"),r=require("react-dom");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var i=o(t),a=o(n);function l(){return l=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},l.apply(this,arguments)}function s(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 u(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 c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(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)?u(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.")}var m,d,f="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;exports.LogLevel=void 0,(d=exports.LogLevel||(exports.LogLevel={}))[d.DEBUG=0]="DEBUG",d[d.INFO=1]="INFO",d[d.WARN=2]="WARN",d[d.ERROR=3]="ERROR";var p=((m={})[exports.LogLevel.DEBUG]="debug",m[exports.LogLevel.INFO]="log",m[exports.LogLevel.WARN]="warn",m[exports.LogLevel.ERROR]="error",m),h=i.system(function(){var e=i.statefulStream(exports.LogLevel.ERROR);return{log:i.statefulStream(function(t,n,r){var o;void 0===r&&(r=exports.LogLevel.INFO),r>=(null!=(o=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?o:i.getValue(e))&&console[p[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function g(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 v(e,t){return void 0===t&&(t=!0),g(e,t).callbackRef}function S(e,t,n,r,o,i,a){return g(function(n){for(var l=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),s=n.parentElement;!s.dataset.virtuosoScroller;)s=s.parentElement;var u="window"===s.firstElementChild.dataset.viewportType,c=a?a.scrollTop:u?window.pageYOffset||document.documentElement.scrollTop:s.scrollTop,m=a?a.scrollHeight:u?document.documentElement.scrollHeight:s.scrollHeight,d=a?a.offsetHeight:u?window.innerHeight:s.offsetHeight;r({scrollTop:Math.max(c,0),scrollHeight:m,viewportHeight:d}),null==i||i(function(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n("row-gap was not resolved to pixel value correctly",t,exports.LogLevel.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}(0,getComputedStyle(n).rowGap,o)),null!==l&&e(l)},n)}function I(e,t){return Math.round(e.getBoundingClientRect()[t])}function C(e,t){return Math.abs(e-t)<1.01}function x(e,t,o,a,l){void 0===a&&(a=i.noop);var s=n.useRef(null),u=n.useRef(null),c=n.useRef(null),m=n.useRef(!1),d=n.useCallback(function(n){var o=n.target,i=o===window||o===document,a=i?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop,l=i?document.documentElement.scrollHeight:o.scrollHeight,s=i?window.innerHeight:o.offsetHeight,d=function(){e({scrollTop:Math.max(a,0),scrollHeight:l,viewportHeight:s})};m.current?r.flushSync(d):d(),m.current=!1,null!==u.current&&(a===u.current||a<=0||a===l-s)&&(u.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);return n.useEffect(function(){var e=l||s.current;return a(l||s.current),d({target:e}),e.addEventListener("scroll",d,{passive:!0}),function(){a(null),e.removeEventListener("scroll",d)}},[s,d,o,a,l]),{scrollerRef:s,scrollByCallback:function(e){m.current=!0,s.current.scrollBy(e)},scrollToCallback:function(n){var r=s.current;if(r&&(!("offsetHeight"in r)||0!==r.offsetHeight)){var o,i,a,l="smooth"===n.behavior;if(r===window?(i=Math.max(I(document.documentElement,"height"),document.documentElement.scrollHeight),o=window.innerHeight,a=document.documentElement.scrollTop):(i=r.scrollHeight,o=I(r,"height"),a=r.scrollTop),n.top=Math.ceil(Math.max(Math.min(i-o,n.top),0)),C(o,i)||n.top===a)return e({scrollTop:a,scrollHeight:i,viewportHeight:o}),void(l&&t(!0));l?(u.current=n.top,c.current&&clearTimeout(c.current),c.current=setTimeout(function(){c.current=null,u.current=null,t(!0)},1e3)):u.current=null,r.scrollTo(n)}}}}var T=i.system(function(){var e=i.stream(),t=i.stream(),n=i.statefulStream(0),r=i.stream(),o=i.statefulStream(0),a=i.stream(),l=i.stream(),s=i.statefulStream(0),u=i.statefulStream(0),c=i.statefulStream(0),m=i.stream(),d=i.stream(),f=i.statefulStream(!1),p=i.statefulStream(!1);return i.connect(i.pipe(e,i.map(function(e){return e.scrollTop})),t),i.connect(i.pipe(e,i.map(function(e){return e.scrollHeight})),l),i.connect(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,footerHeight:c,scrollHeight:l,smoothScrollTargetReached:r,react18ConcurrentRendering:p,scrollTo:m,scrollBy:d,statefulScrollTop:o,deviation:n,scrollingInProgress:f}},[],{singleton:!0}),w={lvl:0};function b(e,t,n,r,o){return void 0===r&&(r=w),void 0===o&&(o=w),{k:e,v:t,lvl:n,l:r,r:o}}function y(e){return e===w}function E(){return w}function L(e,t){if(y(e))return w;var n=e.k,r=e.l,o=e.r;if(t===n){if(y(r))return o;if(y(o))return r;var i=B(r);return V(P(e,{k:i[0],v:i[1],l:F(r)}))}return V(P(e,t<n?{l:L(r,t)}:{r:L(o,t)}))}function H(e,t,n){if(void 0===n&&(n="k"),y(e))return[-Infinity,void 0];if(e[n]===t)return[e.k,e.v];if(e[n]<t){var r=H(e.r,t,n);return-Infinity===r[0]?[e.k,e.v]:r}return H(e.l,t,n)}function R(e,t,n){return y(e)?b(t,n,1):t===e.k?P(e,{k:t,v:n}):function(e){return A(W(e))}(P(e,t<e.k?{l:R(e.l,t,n)}:{r:R(e.r,t,n)}))}function k(e,t,n){if(y(e))return[];var r=e.k,o=e.v,i=e.r,a=[];return r>t&&(a=a.concat(k(e.l,t,n))),r>=t&&r<=n&&a.push({k:r,v:o}),r<=n&&(a=a.concat(k(i,t,n))),a}function z(e){return y(e)?[]:[].concat(z(e.l),[{k:e.k,v:e.v}],z(e.r))}function B(e){return y(e.r)?[e.k,e.v]:B(e.r)}function F(e){return y(e.r)?e.l:V(P(e,{r:F(e.r)}))}function P(e,t){return b(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 O(e){return y(e)||e.lvl>e.r.lvl}function V(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(O(t))return W(P(e,{lvl:r-1}));if(y(t)||y(t.r))throw new Error("Unexpected empty nodes");return P(t.r,{l:P(t,{r:t.r.l}),r:P(e,{l:t.r.r,lvl:r-1}),lvl:r})}if(O(e))return A(P(e,{lvl:r-1}));if(y(n)||y(n.l))throw new Error("Unexpected empty nodes");var o=n.l,i=O(o)?n.lvl-1:n.lvl;return P(o,{l:P(e,{r:o.l,lvl:r-1}),r:A(P(n,{l:o.r,lvl:i})),lvl:o.lvl+1})}function M(e,t,n){return y(e)?[]:U(k(e,H(e,t)[0],n),function(e){return{index:e.k,value:e.v}})}function U(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 A(e){var t=e.r,n=e.lvl;return y(t)||y(t.r)||t.lvl!==n||t.r.lvl!==n?e:P(t,{l:P(e,{r:t.l}),lvl:n+1})}function W(e){var t=e.l;return y(t)||t.lvl!==e.lvl?e:P(t,{r:P(e,{l:t.r})})}function N(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 G(e,t,n){return e[N(e,t,n)]}var D=i.system(function(){return{recalcInProgress:i.statefulStream(!1)}},[],{singleton:!0});function j(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 _(e,t){var n=e.index;return t===n?0:t<n?-1:1}function K(e,t){var n=e.offset;return t===n?0:t<n?-1:1}function q(e){return{index:e.index,value:e}}function Y(e,t,n,r){var o=e,i=0,a=0,l=0,s=0;if(0!==t){l=o[s=N(o,t-1,_)].offset;var u=H(n,t-1);i=u[0],a=u[1],o.length&&o[s].size===H(n,t)[1]&&(s-=1),o=o.slice(0,s+1)}else o=[];for(var m,d=c(M(n,t,Infinity));!(m=d()).done;){var f=m.value,p=f.start,h=f.value,g=p-i,v=g*a+l+g*r;o.push({offset:v,size:h,index:p}),i=p,l=v,a=h}return{offsetTree:o,lastIndex:i,lastOffset:l,lastSize:a}}function Z(e,t){var n=t[0],r=t[1],o=t[3];n.length>0&&(0,t[2])("received item sizes",n,exports.LogLevel.DEBUG);var i=e.sizeTree,a=i,l=0;if(r.length>0&&y(i)&&2===n.length){var s=n[0].size,u=n[1].size;a=r.reduce(function(e,t){return R(R(e,t,s),t+1,u)},a)}else{var m=function(e,t){for(var n,r=y(e)?0:Infinity,o=c(t);!(n=o()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(r=Math.min(r,l),y(e))e=R(e,0,a);else{var u=M(e,l-1,s+1);if(!u.some(j(i))){for(var m,d=!1,f=!1,p=c(u);!(m=p()).done;){var h=m.value,g=h.start,v=h.end,S=h.value;d?(s>=g||a===S)&&(e=L(e,g)):(f=S!==a,d=!0),v>s&&s>=g&&S!==a&&(e=R(e,s+1,S))}f&&(e=R(e,l,a))}}}return[e,r]}(a,n);a=m[0],l=m[1]}if(a===i)return e;var d=Y(e.offsetTree,l,a,o),f=d.offsetTree;return{sizeTree:a,offsetTree:f,lastIndex:d.lastIndex,lastOffset:d.lastOffset,lastSize:d.lastSize,groupOffsetTree:r.reduce(function(e,t){return R(e,t,J(t,f,o))},E()),groupIndices:r}}function J(e,t,n){if(0===t.length)return 0;var r=G(t,e,_),o=e-r.index,i=r.size*o+(o-1)*n+r.offset;return i>0?i+n:i}function $(e,t,n){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;var r=Q("LAST"===e.index?n:e.index,t);return Math.max(0,r,Math.min(n,r))}function Q(e,t){if(!X(t))return e;for(var n=0;t.groupIndices[n]<=e+n;)n++;return e+n}function X(e){return!y(e.groupOffsetTree)}var ee={offsetHeight:"height",offsetWidth:"width"},te=i.system(function(e){var t=e[0].log,n=e[1].recalcInProgress,r=i.stream(),o=i.stream(),a=i.statefulStreamFromEmitter(o,0),s=i.stream(),u=i.stream(),c=i.statefulStream(0),m=i.statefulStream([]),d=i.statefulStream(void 0),f=i.statefulStream(void 0),p=i.statefulStream(function(e,t){return I(e,ee[t])}),h=i.statefulStream(void 0),g=i.statefulStream(0),v={offsetTree:[],sizeTree:E(),groupOffsetTree:E(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},S=i.statefulStreamFromEmitter(i.pipe(r,i.withLatestFrom(m,t,g),i.scan(Z,v),i.distinctUntilChanged()),v);i.connect(i.pipe(m,i.filter(function(e){return e.length>0}),i.withLatestFrom(S,g),i.map(function(e){var t=e[0],n=e[1],r=e[2],o=t.reduce(function(e,t,o){return R(e,t,J(t,n.offsetTree,r)||o)},E());return l({},n,{groupIndices:t,groupOffsetTree:o})})),S),i.connect(i.pipe(o,i.withLatestFrom(S),i.filter(function(e){return e[0]<e[1].lastIndex}),i.map(function(e){var t=e[1];return[{startIndex:e[0],endIndex:t.lastIndex,size:t.lastSize}]})),r),i.connect(d,f);var C=i.statefulStreamFromEmitter(i.pipe(d,i.map(function(e){return void 0===e})),!0);i.connect(i.pipe(f,i.filter(function(e){return void 0!==e&&y(i.getValue(S).sizeTree)}),i.map(function(e){return[{startIndex:0,endIndex:0,size:e}]})),r);var x=i.streamFromEmitter(i.pipe(r,i.withLatestFrom(S),i.scan(function(e,t){var n=t[1];return{changed:n!==e.sizes,sizes:n}},{changed:!1,sizes:v}),i.map(function(e){return e.changed})));i.subscribe(i.pipe(c,i.scan(function(e,t){return{diff:e.prev-t,prev:t}},{diff:0,prev:0}),i.map(function(e){return e.diff})),function(e){e>0?(i.publish(n,!0),i.publish(s,e)):e<0&&i.publish(u,e)}),i.subscribe(i.pipe(c,i.withLatestFrom(t)),function(e){e[0]<0&&(0,e[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},exports.LogLevel.ERROR)});var T=i.streamFromEmitter(s);i.connect(i.pipe(s,i.withLatestFrom(S),i.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 z(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})),r);var w=i.streamFromEmitter(i.pipe(u,i.withLatestFrom(S,g),i.map(function(e){return J(-e[0],e[1].offsetTree,e[2])})));return i.connect(i.pipe(u,i.withLatestFrom(S,g),i.map(function(e){var t=e[0],n=e[1],r=e[2];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var o=z(n.sizeTree).reduce(function(e,n){var r=n.v;return R(e,Math.max(0,n.k+t),r)},E());return l({},n,{sizeTree:o},Y(n.offsetTree,0,o,r))})),S),{data:h,totalCount:o,sizeRanges:r,groupIndices:m,defaultItemSize:f,fixedItemSize:d,unshiftWith:s,shiftWith:u,shiftWithOffset:w,beforeUnshiftWith:T,firstItemIndex:c,gap:g,sizes:S,listRefresh:x,statefulTotalCount:a,trackItemSizes:C,itemSize:p}},i.tup(h,D),{singleton:!0}),ne="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function re(e){var t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&ne||(t.behavior="auto"),t.offset||(t.offset=0),t}var oe=i.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,o=t.listRefresh,a=t.gap,l=e[1],s=l.scrollingInProgress,u=l.viewportHeight,c=l.scrollTo,m=l.smoothScrollTargetReached,d=l.headerHeight,f=l.footerHeight,p=e[2].log,h=i.stream(),g=i.statefulStream(0),v=null,S=null,I=null;function C(){v&&(v(),v=null),I&&(I(),I=null),S&&(clearTimeout(S),S=null),i.publish(s,!1)}return i.connect(i.pipe(h,i.withLatestFrom(n,u,r,g,d,f,p),i.withLatestFrom(a),i.map(function(e){var t=e[0],n=t[0],r=t[1],a=t[2],l=t[3],u=t[4],c=t[5],d=t[6],f=t[7],p=e[1],g=re(n),x=g.align,T=g.behavior,w=g.offset,b=l-1,y=$(g,r,b),E=J(y,r.offsetTree,p)+c;"end"===x?(E=E-a+H(r.sizeTree,y)[1],y===b&&(E+=d)):"center"===x?E=E-a/2+H(r.sizeTree,y)[1]/2:E-=u,w&&(E+=w);var L=function(e){C(),e?(f("retrying to scroll to",{location:n},exports.LogLevel.DEBUG),i.publish(h,n)):f("list did not change, scroll successful",{},exports.LogLevel.DEBUG)};if(C(),"smooth"===T){var R=!1;I=i.subscribe(o,function(e){R=R||e}),v=i.handleNext(m,function(){L(R)})}else v=i.handleNext(i.pipe(o,function(e){var t=setTimeout(function(){e(!1)},150);return function(n){n&&(e(!0),clearTimeout(t))}}),L);return S=setTimeout(function(){C()},1200),i.publish(s,!0),f("scrolling from index to",{index:y,top:E,behavior:T},exports.LogLevel.DEBUG),{top:E,behavior:T}})),c),{scrollToIndex:h,topListHeight:g}},i.tup(te,T,h),{singleton:!0}),ie="up",ae={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},le=i.system(function(e){var t=e[0],n=t.scrollContainerState,r=t.scrollTop,o=t.viewportHeight,a=t.headerHeight,l=t.footerHeight,s=t.scrollBy,u=i.statefulStream(!1),c=i.statefulStream(!0),m=i.stream(),d=i.stream(),f=i.statefulStream(4),p=i.statefulStream(0),h=i.statefulStreamFromEmitter(i.pipe(i.merge(i.pipe(i.duc(r),i.skip(1),i.mapTo(!0)),i.pipe(i.duc(r),i.skip(1),i.mapTo(!1),i.debounceTime(100))),i.distinctUntilChanged()),!1),g=i.statefulStreamFromEmitter(i.pipe(i.merge(i.pipe(s,i.mapTo(!0)),i.pipe(s,i.mapTo(!1),i.debounceTime(200))),i.distinctUntilChanged()),!1);i.connect(i.pipe(i.combineLatest(i.duc(r),i.duc(p)),i.map(function(e){return e[0]<=e[1]}),i.distinctUntilChanged()),c),i.connect(i.pipe(c,i.throttleTime(50)),d);var v=i.streamFromEmitter(i.pipe(i.combineLatest(n,i.duc(o),i.duc(a),i.duc(l),i.duc(f)),i.scan(function(e,t){var n,r,o=t[0],i=o.scrollTop,a=o.scrollHeight,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}},ae),i.distinctUntilChanged(function(e,t){return e&&e.atBottom===t.atBottom}))),S=i.statefulStreamFromEmitter(i.pipe(n,i.scan(function(e,t){var n=t.scrollTop,r=t.scrollHeight,o=t.viewportHeight;return C(e.scrollHeight,r)?{scrollTop:n,scrollHeight:r,jump:0,changed:!1}:e.scrollTop!==n&&r-(n+o)<1?{scrollHeight:r,scrollTop:n,jump:e.scrollTop-n,changed:!0}:{scrollHeight:r,scrollTop:n,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),i.filter(function(e){return e.changed}),i.map(function(e){return e.jump})),0);i.connect(i.pipe(v,i.map(function(e){return e.atBottom})),u),i.connect(i.pipe(u,i.throttleTime(50)),m);var I=i.statefulStream("down");i.connect(i.pipe(n,i.map(function(e){return e.scrollTop}),i.distinctUntilChanged(),i.scan(function(e,t){return i.getValue(g)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?ie:"down",prevScrollTop:t}},{direction:"down",prevScrollTop:0}),i.map(function(e){return e.direction})),I),i.connect(i.pipe(n,i.throttleTime(50),i.mapTo("none")),I);var x=i.statefulStream(0);return i.connect(i.pipe(h,i.filter(function(e){return!e}),i.mapTo(0)),x),i.connect(i.pipe(r,i.throttleTime(100),i.withLatestFrom(h),i.filter(function(e){return!!e[1]}),i.scan(function(e,t){return[e[1],t[0]]},[0,0]),i.map(function(e){return e[1]-e[0]})),x),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:d,atBottomStateChange:m,scrollDirection:I,atBottomThreshold:f,atTopThreshold:p,scrollVelocity:x,lastJumpDueToItemResize:S}},i.tup(T)),se=i.system(function(e){var t=e[0].log,n=i.statefulStream(!1),r=i.streamFromEmitter(i.pipe(n,i.filter(function(e){return e}),i.distinctUntilChanged()));return i.subscribe(n,function(e){e&&i.getValue(t)("props updated",{},exports.LogLevel.DEBUG)}),{propsReady:n,didMount:r}},i.tup(h),{singleton:!0}),ue=i.system(function(e){var t=e[0],n=t.sizes,r=t.listRefresh,o=t.defaultItemSize,a=e[1].scrollTop,l=e[2].scrollToIndex,s=e[3].didMount,u=i.statefulStream(!0),c=i.statefulStream(0);return i.connect(i.pipe(s,i.withLatestFrom(c),i.filter(function(e){return!!e[1]}),i.mapTo(!1)),u),i.subscribe(i.pipe(i.combineLatest(r,s),i.withLatestFrom(u,n,o),i.filter(function(e){var t=e[1],n=e[3];return e[0][1]&&(!y(e[2].sizeTree)||void 0!==n)&&!t}),i.withLatestFrom(c)),function(e){var t=e[1];setTimeout(function(){i.handleNext(a,function(){i.publish(u,!0)}),i.publish(l,t)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},i.tup(te,T,oe,se),{singleton:!0});function ce(e){return!!e&&("smooth"===e?"smooth":"auto")}var me=i.system(function(e){var t=e[0],n=t.totalCount,r=t.listRefresh,o=e[1],a=o.isAtBottom,l=o.atBottomState,s=e[2].scrollToIndex,u=e[3].scrolledToInitialItem,c=e[4],m=c.propsReady,d=c.didMount,f=e[5].log,p=e[6].scrollingInProgress,h=i.statefulStream(!1),g=i.stream(),v=null;function S(e){i.publish(s,{index:"LAST",align:"end",behavior:e})}function I(e){var t=i.handleNext(l,function(t){!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||v||(i.getValue(f)("scrolling to bottom due to increased size",{},exports.LogLevel.DEBUG),S("auto"))});setTimeout(t,100)}return i.subscribe(i.pipe(i.combineLatest(i.pipe(i.duc(n),i.skip(1)),d),i.withLatestFrom(i.duc(h),a,u,p),i.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}}),i.filter(function(e){return e.shouldFollow})),function(e){var t=e.totalCount,n=e.followOutputBehavior;v&&(v(),v=null),v=i.handleNext(r,function(){i.getValue(f)("following output to ",{totalCount:t},exports.LogLevel.DEBUG),S(n),v=null})}),i.subscribe(i.pipe(i.combineLatest(i.duc(h),n,m),i.filter(function(e){return e[0]&&e[2]}),i.scan(function(e,t){var n=t[1];return{refreshed:e.value===n,value:n}},{refreshed:!1,value:0}),i.filter(function(e){return e.refreshed}),i.withLatestFrom(h,n)),function(e){I(!1!==e[1])}),i.subscribe(g,function(){I(!1!==i.getValue(h))}),i.subscribe(i.combineLatest(i.duc(h),l),function(e){var t=e[1];e[0]&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&S("auto")}),{followOutput:h,autoscrollToBottom:g}},i.tup(te,le,oe,ue,se,h,T));function de(e){return e.reduce(function(e,t){return e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e},{totalCount:0,groupIndices:[]})}var fe=i.system(function(e){var t=e[0],n=t.totalCount,r=t.groupIndices,o=t.sizes,a=e[1],l=a.scrollTop,s=a.headerHeight,u=i.stream(),c=i.stream(),m=i.streamFromEmitter(i.pipe(u,i.map(de)));return i.connect(i.pipe(m,i.map(function(e){return e.totalCount})),n),i.connect(i.pipe(m,i.map(function(e){return e.groupIndices})),r),i.connect(i.pipe(i.combineLatest(l,o,s),i.filter(function(e){return X(e[1])}),i.map(function(e){return H(e[1].groupOffsetTree,Math.max(e[0]-e[2],0),"v")[0]}),i.distinctUntilChanged(),i.map(function(e){return[e]})),c),{groupCounts:u,topItemsIndexes:c}},i.tup(te,T));function pe(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function he(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function ge(e,t,n){return"number"==typeof e?n===ie&&"top"===t||"down"===n&&"bottom"===t?e:0:n===ie?"top"===t?e.main:e.reverse:"bottom"===t?e.main:e.reverse}function ve(e,t){return"number"==typeof e?e:e[t]||0}var Se=i.system(function(e){var t=e[0],n=t.scrollTop,r=t.viewportHeight,o=t.deviation,a=t.headerHeight,l=t.fixedHeaderHeight,s=i.stream(),u=i.statefulStream(0),c=i.statefulStream(0),m=i.statefulStream(0),d=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(i.duc(n),i.duc(r),i.duc(a),i.duc(s,pe),i.duc(m),i.duc(u),i.duc(l),i.duc(o),i.duc(c)),i.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[6],u=e[7],c=e[8],m=t-u,d=e[5]+s,f=Math.max(r-m,0),p="none",h=ve(c,"top"),g=ve(c,"bottom");return i-=u,a+=r+s,(i+=r+s)>t+d-h&&(p=ie),(a-=u)<t-f+n+g&&(p="down"),"none"!==p?[Math.max(m-r-ge(l,"top",p)-h,0),m-f-s+n+ge(l,"bottom",p)+g]:null}),i.filter(function(e){return null!=e}),i.distinctUntilChanged(pe)),[0,0]);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:d}},i.tup(T),{singleton:!0}),Ie={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Ce(e,t,n){if(0===e.length)return[];if(!X(t))return e.map(function(e){return l({},e,{index:e.index+n,originalIndex:e.index})});for(var r,o=[],i=M(t.groupOffsetTree,e[0].index,e[e.length-1].index),a=void 0,s=0,u=c(e);!(r=u()).done;){var m=r.value;(!a||a.end<m.index)&&(a=i.shift(),s=t.groupIndices.indexOf(a.start)),o.push(l({},m.index===a.start?{type:"group",index:s}:{index:m.index-(s+1)+n,groupIndex:s},{size:m.size,offset:m.offset,originalIndex:m.index,data:m.data}))}return o}function xe(e,t,n,r,o,i){var a=0,l=0;if(e.length>0){a=e[0].offset;var s=e[e.length-1];l=s.offset+s.size}var u=n-o.lastIndex,c=a,m=o.lastOffset+u*o.lastSize+(u-1)*r-l;return{items:Ce(e,o,i),topItems:Ce(t,o,i),topListHeight:t.reduce(function(e,t){return t.size+e},0),offsetTop:a,offsetBottom:m,top:c,bottom:l,totalCount:n,firstItemIndex:i}}var Te=i.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,o=t.data,a=t.firstItemIndex,s=t.gap,u=e[1],m=e[2],d=m.visibleRange,f=m.listBoundary,p=m.topListHeight,h=e[3],g=h.scrolledToInitialItem,v=h.initialTopMostItemIndex,S=e[4].topListHeight,I=e[5],C=e[6].didMount,x=e[7].recalcInProgress,T=i.statefulStream([]),w=i.stream();i.connect(u.topItemsIndexes,T);var b=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(C,x,i.duc(d,pe),i.duc(r),i.duc(n),i.duc(v),g,i.duc(T),i.duc(a),i.duc(s),o),i.filter(function(e){return e[0]&&!e[1]}),i.map(function(e){var t=e[2],n=t[0],r=t[1],o=e[3],a=e[5],l=e[6],s=e[7],u=e[8],m=e[9],d=e[10],f=e[4],p=f.sizeTree,h=f.offsetTree;if(0===o||0===n&&0===r)return Ie;if(y(p))return xe(function(e,t,n){if(X(t)){var r=Q(e,t);return[{index:H(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]}]}(function(e,t){return"number"==typeof e?e:"LAST"===e.index?t-1:e.index}(a,o),f,d),[],o,m,f,u);var g=[];if(s.length>0)for(var v,S=s[0],I=s[s.length-1],C=0,x=c(M(p,S,I));!(v=x()).done;)for(var T=v.value,w=T.value,b=Math.max(T.start,S),E=Math.min(T.end,I),L=b;L<=E;L++)g.push({index:L,size:w,offset:C,data:d&&d[L]}),C+=w;if(!l)return xe([],g,o,m,f,u);var R=s.length>0?s[s.length-1]+1:0,k=function(e,t,n,r){return void 0===r&&(r=0),r>0&&(t=Math.max(t,G(e,r,_).offset)),U((i=n,l=N(o=e,t,a=K),s=N(o,i,a,l),o.slice(l,s+1)),q);var o,i,a,l,s}(h,n,r,R);if(0===k.length)return null;var z=o-1;return xe(i.tap([],function(e){for(var t,o=c(k);!(t=o()).done;){var i=t.value,a=i.value,l=a.offset,s=i.start,u=a.size;if(a.offset<n){var f=(s+=Math.floor((n-a.offset+m)/(u+m)))-i.start;l+=f*u+f*m}s<R&&(l+=(R-s)*u,s=R);for(var p=Math.min(i.end,z),h=s;h<=p&&!(l>=r);h++)e.push({index:h,size:u,offset:l,data:d&&d[h]}),l+=u+m}}),g,o,m,f,u)}),i.filter(function(e){return null!==e}),i.distinctUntilChanged()),Ie);return i.connect(i.pipe(o,i.filter(function(e){return void 0!==e}),i.map(function(e){return e.length})),r),i.connect(i.pipe(b,i.map(function(e){return e.topListHeight})),S),i.connect(S,p),i.connect(i.pipe(b,i.map(function(e){return[e.top,e.bottom]})),f),i.connect(i.pipe(b,i.map(function(e){return e.items})),w),l({listState:b,topItemsIndexes:T,endReached:i.streamFromEmitter(i.pipe(b,i.filter(function(e){return e.items.length>0}),i.withLatestFrom(r,o),i.filter(function(e){var t=e[0].items;return t[t.length-1].originalIndex===e[1]-1}),i.map(function(e){return[e[1]-1,e[2]]}),i.distinctUntilChanged(pe),i.map(function(e){return e[0]}))),startReached:i.streamFromEmitter(i.pipe(b,i.throttleTime(200),i.filter(function(e){var t=e.items;return t.length>0&&t[0].originalIndex===e.topItems.length}),i.map(function(e){return e.items[0].index}),i.distinctUntilChanged())),rangeChanged:i.streamFromEmitter(i.pipe(b,i.filter(function(e){return e.items.length>0}),i.map(function(e){for(var t=e.items,n=0,r=t.length-1;"group"===t[n].type&&n<r;)n++;for(;"group"===t[r].type&&r>n;)r--;return{startIndex:t[n].index,endIndex:t[r].index}}),i.distinctUntilChanged(he))),itemsRendered:w},I)},i.tup(te,fe,Se,ue,oe,le,se,D),{singleton:!0}),we=i.system(function(e){var t=e[0],n=t.sizes,r=t.firstItemIndex,o=t.data,a=t.gap,l=e[1].listState,s=e[2].didMount,u=i.statefulStream(0);return i.connect(i.pipe(s,i.withLatestFrom(u),i.filter(function(e){return 0!==e[1]}),i.withLatestFrom(n,r,a,o),i.map(function(e){var t=e[0][1],n=e[1],r=e[2],o=e[3],i=e[4],a=void 0===i?[]:i,l=0;if(n.groupIndices.length>0)for(var s,u=c(n.groupIndices);!((s=u()).done||s.value-l>=t);)l++;var m=t+l;return xe(Array.from({length:m}).map(function(e,t){return{index:t,size:0,offset:0,data:a[t]}}),[],m,o,n,r)})),l),{initialItemCount:u}},i.tup(te,Te,se),{singleton:!0}),be=i.system(function(e){var t=e[0].scrollVelocity,n=i.statefulStream(!1),r=i.stream(),o=i.statefulStream(!1);return i.connect(i.pipe(t,i.withLatestFrom(o,n,r),i.filter(function(e){return!!e[1]}),i.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}),i.distinctUntilChanged()),n),i.subscribe(i.pipe(i.combineLatest(n,t,r),i.withLatestFrom(o)),function(e){var t=e[0],n=e[1];return t[0]&&n&&n.change&&n.change(t[1],t[2])}),{isSeeking:n,scrollSeekConfiguration:o,scrollVelocity:t,scrollSeekRangeChanged:r}},i.tup(le),{singleton:!0}),ye=i.system(function(e){var t=e[0].topItemsIndexes,n=i.statefulStream(0);return i.connect(i.pipe(n,i.filter(function(e){return e>0}),i.map(function(e){return Array.from({length:e}).map(function(e,t){return t})})),t),{topItemCount:n}},i.tup(Te)),Ee=i.system(function(e){var t=e[0],n=t.footerHeight,r=t.headerHeight,o=t.fixedHeaderHeight,a=e[1].listState,l=i.stream(),s=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(n,r,o,a),i.map(function(e){var t=e[3];return e[0]+e[1]+e[2]+t.offsetBottom+t.bottom})),0);return i.connect(i.duc(s),l),{totalListHeight:s,totalListHeightChanged:l}},i.tup(T,Te),{singleton:!0});function Le(e){var t,n=!1;return function(){return n||(n=!0,t=e()),t}}var He=Le(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),Re=i.system(function(e){var t=e[0],n=t.scrollBy,r=t.scrollTop,o=t.deviation,a=t.scrollingInProgress,l=e[1],s=l.isScrolling,u=l.isAtBottom,c=l.scrollDirection,m=e[3],d=m.beforeUnshiftWith,f=m.shiftWithOffset,p=m.sizes,h=m.gap,g=e[4].log,v=e[5].recalcInProgress,S=i.streamFromEmitter(i.pipe(e[2].listState,i.withLatestFrom(l.lastJumpDueToItemResize),i.scan(function(e,t){var n=e[1],r=t[0],o=r.items,i=r.totalCount,a=r.bottom+r.offsetBottom,l=0;return e[2]===i&&n.length>0&&o.length>0&&(0===o[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-e[3])&&(l+=t[1])),[l,o,i,a]},[0,[],0,0]),i.filter(function(e){return 0!==e[0]}),i.withLatestFrom(r,c,a,u,g),i.filter(function(e){return!e[3]&&0!==e[1]&&e[2]===ie}),i.map(function(e){var t=e[0][0];return(0,e[5])("Upward scrolling compensation",{amount:t},exports.LogLevel.DEBUG),t})));function I(e){e>0?(i.publish(n,{top:-e,behavior:"auto"}),i.publish(o,0)):(i.publish(o,0),i.publish(n,{top:-e,behavior:"auto"}))}return i.subscribe(i.pipe(S,i.withLatestFrom(o,s)),function(e){var t=e[0],n=e[1];e[2]&&He()?i.publish(o,n-t):I(-t)}),i.subscribe(i.pipe(i.combineLatest(i.statefulStreamFromEmitter(s,!1),o,v),i.filter(function(e){return!e[0]&&!e[2]&&0!==e[1]}),i.map(function(e){return e[1]}),i.throttleTime(1)),I),i.connect(i.pipe(f,i.map(function(e){return{top:-e}})),n),i.subscribe(i.pipe(d,i.withLatestFrom(p,h),i.map(function(e){var t=e[0];return t*e[1].lastSize+t*e[2]})),function(e){i.publish(o,e),requestAnimationFrame(function(){i.publish(n,{top:e}),requestAnimationFrame(function(){i.publish(o,0),i.publish(v,!1)})})}),{deviation:o}},i.tup(T,le,Te,te,h,D)),ke=i.system(function(e){var t=e[0].totalListHeight,n=e[1].didMount,r=e[2].scrollTo,o=i.statefulStream(0);return i.subscribe(i.pipe(n,i.withLatestFrom(o),i.filter(function(e){return 0!==e[1]}),i.map(function(e){return{top:e[1]}})),function(e){i.handleNext(i.pipe(t,i.filter(function(e){return 0!==e})),function(){setTimeout(function(){i.publish(r,e)})})}),{initialScrollTop:o}},i.tup(Ee,se,T),{singleton:!0}),ze=i.system(function(e){var t=e[0].viewportHeight,n=e[1].totalListHeight,r=i.statefulStream(!1);return{alignToBottom:r,paddingTopAddition:i.statefulStreamFromEmitter(i.pipe(i.combineLatest(r,t,n),i.filter(function(e){return e[0]}),i.map(function(e){return Math.max(0,e[1]-e[2])}),i.distinctUntilChanged()),0)}},i.tup(T,Ee),{singleton:!0}),Be=i.system(function(e){var t=e[0],n=t.scrollTo,r=t.scrollContainerState,o=i.stream(),a=i.stream(),s=i.stream(),u=i.statefulStream(!1),c=i.statefulStream(void 0);return i.connect(i.pipe(i.combineLatest(o,a),i.map(function(e){var t=e[0],n=t.viewportHeight,r=t.scrollHeight;return{scrollTop:Math.max(0,t.scrollTop-e[1].offsetTop),scrollHeight:r,viewportHeight:n}})),r),i.connect(i.pipe(n,i.withLatestFrom(a),i.map(function(e){var t=e[0];return l({},t,{top:t.top+e[1].offsetTop})})),s),{useWindowScroll:u,customScrollParent:c,windowScrollContainerState:o,windowViewportRect:a,windowScrollTo:s}},i.tup(T)),Fe=["done","behavior","align"],Pe=i.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,o=t.gap,a=e[1],u=a.scrollTop,c=a.viewportHeight,m=a.headerHeight,d=a.scrollingInProgress,f=e[2].scrollToIndex,p=i.stream();return i.connect(i.pipe(p,i.withLatestFrom(n,c,r,m,u,o),i.map(function(e){var t=e[0],n=e[1],r=e[2],o=e[3],a=e[4],u=e[5],c=e[6],m=t.done,f=t.behavior,p=t.align,h=s(t,Fe),g=null,v=$(t,n,o-1),S=J(v,n.offsetTree,c)+a;return S<u?g=l({},h,{behavior:f,align:null!=p?p:"start"}):S+H(n.sizeTree,v)[1]>u+r&&(g=l({},h,{behavior:f,align:null!=p?p:"end"})),g?m&&i.handleNext(i.pipe(d,i.skip(1),i.filter(function(e){return!1===e})),m):m&&m(),g}),i.filter(function(e){return null!==e})),f),{scrollIntoView:p}},i.tup(te,T,oe,Te,h),{singleton:!0}),Oe=["listState","topItemsIndexes"],Ve=i.system(function(e){return l({},e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},i.tup(Se,we,se,be,Ee,ke,ze,Be,Pe)),Me=i.system(function(e){var t=e[0],n=t.totalCount,r=t.sizeRanges,o=t.fixedItemSize,a=t.defaultItemSize,u=t.trackItemSizes,c=t.itemSize,m=t.data,d=t.firstItemIndex,f=t.groupIndices,p=t.statefulTotalCount,h=t.gap,g=e[1],v=g.initialTopMostItemIndex,S=g.scrolledToInitialItem,I=e[2],C=e[3],x=e[4],T=x.listState,w=x.topItemsIndexes,b=s(x,Oe),y=e[5].scrollToIndex,E=e[7].topItemCount,L=e[8].groupCounts,H=e[9],R=e[10];return i.connect(b.rangeChanged,H.scrollSeekRangeChanged),i.connect(i.pipe(H.windowViewportRect,i.map(function(e){return e.visibleHeight})),I.viewportHeight),l({totalCount:n,data:m,firstItemIndex:d,sizeRanges:r,initialTopMostItemIndex:v,scrolledToInitialItem:S,topItemsIndexes:w,topItemCount:E,groupCounts:L,fixedItemHeight:o,defaultItemHeight:a,gap:h},C,{statefulTotalCount:p,listState:T,scrollToIndex:y,trackItemSizes:u,itemSize:c,groupIndices:f},b,H,I,R)},i.tup(te,ue,T,me,Te,oe,Re,ye,fe,Ve,h)),Ue=Le(function(){if("undefined"==typeof document)return"sticky";var e=document.createElement("div");return e.style.position="-webkit-sticky","-webkit-sticky"===e.style.position?"-webkit-sticky":"sticky"});function Ae(e,t){var r=n.useRef(null),o=n.useCallback(function(n){if(null!==n&&n.offsetParent){var o,i,a=n.getBoundingClientRect(),l=a.width;if(t){var s=t.getBoundingClientRect(),u=a.top-s.top;o=s.height-Math.max(0,u),i=u+t.scrollTop}else o=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;r.current={offsetTop:i,visibleHeight:o,visibleWidth:l},e(r.current)}},[e,t]),i=g(o),a=i.callbackRef,l=i.ref,s=n.useCallback(function(){o(l.current)},[o,l]);return n.useEffect(function(){if(t){t.addEventListener("scroll",s);var e=new ResizeObserver(s);return e.observe(t),function(){t.removeEventListener("scroll",s),e.unobserve(t)}}return window.addEventListener("scroll",s),window.addEventListener("resize",s),function(){window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}},[s,t]),a}var We=["placeholder"],Ne=["style","children"],Ge=["style","children"];function De(e){return e}var je=i.system(function(){var e=i.statefulStream(function(e){return"Item "+e}),t=i.statefulStream(null),n=i.statefulStream(function(e){return"Group "+e}),r=i.statefulStream({}),o=i.statefulStream(De),a=i.statefulStream("div"),l=i.statefulStream(i.noop),s=function(e,t){return void 0===t&&(t=null),i.statefulStreamFromEmitter(i.pipe(r,i.map(function(t){return t[e]}),i.distinctUntilChanged()),t)};return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:a,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function _e(e,t){var n=i.stream();return i.subscribe(n,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+t,"color: red;","color: inherit;","color: blue;")}),i.connect(n,e),n}var Ke=i.system(function(e){var t=e[0],n=e[1],r={item:_e(n.itemContent,"Rename the %citem%c prop to %citemContent."),group:_e(n.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:_e(t.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:_e(t.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:_e(t.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:i.stream(),maxHeightCacheSize:i.stream(),footer:i.stream(),header:i.stream(),HeaderContainer:i.stream(),FooterContainer:i.stream(),ItemContainer:i.stream(),ScrollContainer:i.stream(),GroupContainer:i.stream(),ListContainer:i.stream(),emptyComponent:i.stream(),scrollSeek:i.stream()};function o(e,t,r){i.connect(i.pipe(e,i.withLatestFrom(n.components),i.map(function(e){var n,o=e[0],i=e[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+t+" instead."),l({},i,((n={})[t]=o,n))})),n.components)}return i.subscribe(r.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;")}),i.subscribe(r.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),i.subscribe(r.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),i.subscribe(r.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),i.subscribe(r.scrollSeek,function(e){var r=e.placeholder,o=s(e,We);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),i.publish(n.components,l({},i.getValue(n.components),{ScrollSeekPlaceholder:r})),i.publish(t.scrollSeekConfiguration,o)}),o(r.footer,"Footer","footer"),o(r.header,"Header","header"),o(r.ItemContainer,"Item","ItemContainer"),o(r.ListContainer,"List","ListContainer"),o(r.ScrollContainer,"Scroller","ScrollContainer"),o(r.emptyComponent,"EmptyPlaceholder","emptyComponent"),o(r.GroupContainer,"Group","GroupContainer"),l({},t,n,r)},i.tup(Me,je)),qe=function(e){return a.createElement("div",{style:{height:e.height}})},Ye={position:Ue(),zIndex:1,overflowAnchor:"none"},Ze={overflowAnchor:"none"},Je=a.memo(function(e){var t=e.showTopList,r=void 0!==t&&t,o=dt("listState"),s=mt("sizeRanges"),u=dt("useWindowScroll"),c=dt("customScrollParent"),m=mt("windowScrollContainerState"),d=mt("scrollContainerState"),f=c||u?m:d,p=dt("itemContent"),h=dt("context"),g=dt("groupContent"),v=dt("trackItemSizes"),I=dt("itemSize"),C=dt("log"),x=mt("gap"),T=S(s,I,v,r?i.noop:f,C,x,c).callbackRef,w=a.useState(0),b=w[0],y=w[1];ft("deviation",function(e){b!==e&&y(e)});var E=dt("EmptyPlaceholder"),L=dt("ScrollSeekPlaceholder")||qe,H=dt("ListComponent"),R=dt("ItemComponent"),k=dt("GroupComponent"),z=dt("computeItemKey"),B=dt("isSeeking"),F=dt("groupIndices").length>0,P=dt("paddingTopAddition"),O=r?{}:{boxSizing:"border-box",paddingTop:o.offsetTop+P,paddingBottom:o.offsetBottom,marginTop:b};return!r&&0===o.totalCount&&E?n.createElement(E,et(E,h)):n.createElement(H,l({},et(H,h),{ref:T,style:O,"data-test-id":r?"virtuoso-top-item-list":"virtuoso-item-list"}),(r?o.topItems:o.items).map(function(e){var t=e.originalIndex,r=z(t+o.firstItemIndex,e.data,h);return B?n.createElement(L,l({},et(L,h),{key:r,index:e.index,height:e.size,type:e.type||"item"},"group"===e.type?{}:{groupIndex:e.groupIndex})):"group"===e.type?n.createElement(k,l({},et(k,h),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:Ye}),g(e.index)):n.createElement(R,l({},et(R,h),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex,style:Ze}),F?p(e.index,e.groupIndex,e.data,h):p(e.index,e.data,h))}))}),$e={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Qe={width:"100%",height:"100%",position:"absolute",top:0},Xe={width:"100%",position:Ue(),top:0};function et(e,t){if("string"!=typeof e)return{context:t}}var tt=a.memo(function(){var e=dt("HeaderComponent"),t=mt("headerHeight"),r=dt("headerFooterTag"),o=v(function(e){return t(I(e,"height"))}),i=dt("context");return e?n.createElement(r,{ref:o},n.createElement(e,et(e,i))):null}),nt=a.memo(function(){var e=dt("FooterComponent"),t=mt("footerHeight"),r=dt("headerFooterTag"),o=v(function(e){return t(I(e,"height"))}),i=dt("context");return e?n.createElement(r,{ref:o},n.createElement(e,et(e,i))):null});function rt(e){var t=e.usePublisher,r=e.useEmitter,o=e.useEmitterValue;return a.memo(function(e){var i=e.style,a=e.children,u=s(e,Ne),c=t("scrollContainerState"),m=o("ScrollerComponent"),d=t("smoothScrollTargetReached"),f=o("scrollerRef"),p=o("context"),h=x(c,d,m,f),g=h.scrollerRef,v=h.scrollByCallback;return r("scrollTo",h.scrollToCallback),r("scrollBy",v),n.createElement(m,l({ref:g,style:l({},$e,i),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},u,et(m,p)),a)})}function ot(e){var t=e.usePublisher,r=e.useEmitter,o=e.useEmitterValue;return a.memo(function(e){var a=e.style,u=e.children,c=s(e,Ge),m=t("windowScrollContainerState"),d=o("ScrollerComponent"),p=t("smoothScrollTargetReached"),h=o("totalListHeight"),g=o("deviation"),v=o("customScrollParent"),S=o("context"),I=x(m,p,d,i.noop,v),C=I.scrollerRef,T=I.scrollByCallback,w=I.scrollToCallback;return f(function(){return C.current=v||window,function(){C.current=null}},[C,v]),r("windowScrollTo",w),r("scrollBy",T),n.createElement(d,l({style:l({position:"relative"},a,0!==h?{height:h+g}:{}),"data-virtuoso-scroller":!0},c,et(d,S)),u)})}var it=function(e){var t=e.children,n=mt("viewportHeight"),r=v(i.compose(n,function(e){return I(e,"height")}));return a.createElement("div",{style:Qe,ref:r,"data-viewport-type":"element"},t)},at=function(e){var t=e.children,n=Ae(mt("windowViewportRect"),dt("customScrollParent"));return a.createElement("div",{ref:n,style:Qe,"data-viewport-type":"window"},t)},lt=function(e){var t=e.children,r=dt("TopItemListComponent"),o=dt("headerHeight"),i=l({},Xe,{marginTop:o+"px"}),a=dt("context");return n.createElement(r||"div",{style:i,context:a},t)},st=a.memo(function(e){var t=dt("useWindowScroll"),n=dt("topItemsIndexes").length>0,r=dt("customScrollParent"),o=r||t?at:it;return a.createElement(r||t?ht:pt,l({},e),a.createElement(o,null,a.createElement(tt,null),a.createElement(Je,null),a.createElement(nt,null)),n&&a.createElement(lt,null,a.createElement(Je,{showTopList:!0})))}),ut=e.systemToComponent(Ke,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},st),ct=ut.Component,mt=ut.usePublisher,dt=ut.useEmitterValue,ft=ut.useEmitter,pt=rt({usePublisher:mt,useEmitterValue:dt,useEmitter:ft}),ht=ot({usePublisher:mt,useEmitterValue:dt,useEmitter:ft}),gt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},vt={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},St=Math.round,It=Math.ceil,Ct=Math.floor,xt=Math.min,Tt=Math.max;function wt(e,t){return Array.from({length:t-e+1}).map(function(t,n){return{index:n+e}})}function bt(e,t){return e&&e.column===t.column&&e.row===t.row}var yt=i.system(function(e){var t=e[0],n=t.overscan,r=t.visibleRange,o=t.listBoundary,a=e[1],s=a.scrollTop,u=a.viewportHeight,c=a.scrollBy,m=a.scrollTo,d=a.smoothScrollTargetReached,f=a.scrollContainerState,p=e[2],h=e[3],g=e[4],v=g.propsReady,S=g.didMount,I=e[5],C=I.windowViewportRect,x=I.windowScrollTo,T=I.useWindowScroll,w=I.customScrollParent,b=I.windowScrollContainerState,y=e[6],E=i.statefulStream(0),L=i.statefulStream(0),H=i.statefulStream(gt),R=i.statefulStream({height:0,width:0}),k=i.statefulStream({height:0,width:0}),z=i.stream(),B=i.stream(),F=i.statefulStream(0),P=i.statefulStream({row:0,column:0});i.connect(i.pipe(S,i.withLatestFrom(L),i.filter(function(e){return 0!==e[1]}),i.map(function(e){return{items:wt(0,e[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),H),i.connect(i.pipe(i.combineLatest(i.duc(E),r,i.duc(P,bt),i.duc(k,function(e,t){return e&&e.width===t.width&&e.height===t.height})),i.withLatestFrom(R),i.map(function(e){var t=e[0],n=t[0],r=t[1],o=r[0],i=r[1],a=t[2],l=t[3],s=e[1],u=a.row,c=l.height,m=l.width,d=s.width;if(0===n||0===d)return gt;if(0===m)return vt;var f=Ht(d,m,a.column),p=f*Ct((o+u)/(c+u)),h=f*It((i+u)/(c+u))-1;h=Tt(0,xt(n-1,h));var g=wt(p=xt(h,Tt(0,p)),h),v=Et(s,a,l,g),S=v.top,I=v.bottom,C=It(n/f);return{items:g,offsetTop:S,offsetBottom:C*c+(C-1)*u-I,top:S,bottom:I,itemHeight:c,itemWidth:m}})),H),i.connect(i.pipe(R,i.map(function(e){return e.height})),u),i.connect(i.pipe(i.combineLatest(R,k,H,P),i.map(function(e){var t=Et(e[0],e[3],e[1],e[2].items);return[t.top,t.bottom]}),i.distinctUntilChanged(pe)),o);var O=i.streamFromEmitter(i.pipe(i.duc(H),i.filter(function(e){return e.items.length>0}),i.withLatestFrom(E),i.filter(function(e){var t=e[0].items;return t[t.length-1].index===e[1]-1}),i.map(function(e){return e[1]-1}),i.distinctUntilChanged())),V=i.streamFromEmitter(i.pipe(i.duc(H),i.filter(function(e){var t=e.items;return t.length>0&&0===t[0].index}),i.mapTo(0),i.distinctUntilChanged())),M=i.streamFromEmitter(i.pipe(i.duc(H),i.filter(function(e){return e.items.length>0}),i.map(function(e){var t=e.items;return{startIndex:t[0].index,endIndex:t[t.length-1].index}}),i.distinctUntilChanged(he)));i.connect(M,h.scrollSeekRangeChanged),i.connect(i.pipe(z,i.withLatestFrom(R,k,E,P),i.map(function(e){var t=e[1],n=e[2],r=e[3],o=e[4],i=re(e[0]),a=i.align,l=i.behavior,s=i.offset,u=i.index;"LAST"===u&&(u=r-1);var c=Lt(t,o,n,u=Tt(0,u,xt(r-1,u)));return"end"===a?c=St(c-t.height+n.height):"center"===a&&(c=St(c-t.height/2+n.height/2)),s&&(c+=s),{top:c,behavior:l}})),m);var U=i.statefulStreamFromEmitter(i.pipe(H,i.map(function(e){return e.offsetBottom+e.bottom})),0);return i.connect(i.pipe(C,i.map(function(e){return{width:e.visibleWidth,height:e.visibleHeight}})),R),l({totalCount:E,viewportDimensions:R,itemDimensions:k,scrollTop:s,scrollHeight:B,overscan:n,scrollBy:c,scrollTo:m,scrollToIndex:z,smoothScrollTargetReached:d,windowViewportRect:C,windowScrollTo:x,useWindowScroll:T,customScrollParent:w,windowScrollContainerState:b,deviation:F,scrollContainerState:f,initialItemCount:L,gap:P},h,{gridState:H,totalListHeight:U},p,{startReached:V,endReached:O,rangeChanged:M,propsReady:v},y)},i.tup(Se,T,le,be,se,Be,h));function Et(e,t,n,r){var o=n.height;return void 0===o||0===r.length?{top:0,bottom:0}:{top:Lt(e,t,n,r[0].index),bottom:Lt(e,t,n,r[r.length-1].index)+o}}function Lt(e,t,n,r){var o=Ht(e.width,n.width,t.column),i=Ct(r/o),a=i*n.height+Tt(0,i-1)*t.row;return a>0?a+t.row:a}function Ht(e,t,n){return Tt(1,Ct((e+n)/(t+n)))}var Rt=["placeholder"],kt=i.system(function(){var e=i.statefulStream(function(e){return"Item "+e}),t=i.statefulStream({}),n=i.statefulStream(null),r=i.statefulStream("virtuoso-grid-item"),o=i.statefulStream("virtuoso-grid-list"),a=i.statefulStream(De),l=i.statefulStream(i.noop),s=function(e,n){return void 0===n&&(n=null),i.statefulStreamFromEmitter(i.pipe(t,i.map(function(t){return t[e]}),i.distinctUntilChanged()),n)};return{context:n,itemContent:e,components:t,computeItemKey:a,itemClassName:r,listClassName:o,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),zt=i.system(function(e){var t=e[0],n=e[1],r={item:_e(n.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:i.stream(),ScrollContainer:i.stream(),ListContainer:i.stream(),emptyComponent:i.stream(),scrollSeek:i.stream()};function o(e,t,r){i.connect(i.pipe(e,i.withLatestFrom(n.components),i.map(function(e){var n,o=e[0],i=e[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+t+" instead."),l({},i,((n={})[t]=o,n))})),n.components)}return i.subscribe(r.scrollSeek,function(e){var r=e.placeholder,o=s(e,Rt);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),i.publish(n.components,l({},i.getValue(n.components),{ScrollSeekPlaceholder:r})),i.publish(t.scrollSeekConfiguration,o)}),o(r.ItemContainer,"Item","ItemContainer"),o(r.ListContainer,"List","ListContainer"),o(r.ScrollContainer,"Scroller","ScrollContainer"),l({},t,n,r)},i.tup(yt,kt)),Bt=a.memo(function(){var e=At("gridState"),t=At("listClassName"),r=At("itemClassName"),o=At("itemContent"),i=At("computeItemKey"),a=At("isSeeking"),s=Ut("scrollHeight"),u=At("ItemComponent"),c=At("ListComponent"),m=At("ScrollSeekPlaceholder"),d=At("context"),f=Ut("itemDimensions"),p=Ut("gap"),h=At("log"),g=v(function(e){s(e.parentElement.parentElement.scrollHeight);var t=e.firstChild;t&&f(t.getBoundingClientRect()),p({row:Dt("row-gap",getComputedStyle(e).rowGap,h),column:Dt("column-gap",getComputedStyle(e).columnGap,h)})});return n.createElement(c,l({ref:g,className:t},et(c,d),{style:{paddingTop:e.offsetTop,paddingBottom:e.offsetBottom}}),e.items.map(function(t){var s=i(t.index);return a?n.createElement(m,l({key:s},et(m,d),{index:t.index,height:e.itemHeight,width:e.itemWidth})):n.createElement(u,l({},et(u,d),{className:r,"data-index":t.index,key:s}),o(t.index,d))}))}),Ft=function(e){var t=e.children,n=Ut("viewportDimensions"),r=v(function(e){n(e.getBoundingClientRect())});return a.createElement("div",{style:Qe,ref:r},t)},Pt=function(e){var t=e.children,n=Ae(Ut("windowViewportRect"),At("customScrollParent"));return a.createElement("div",{ref:n,style:Qe},t)},Ot=a.memo(function(e){var t=l({},e),n=At("useWindowScroll"),r=At("customScrollParent"),o=r||n?Pt:Ft;return a.createElement(r||n?Gt:Nt,l({},t),a.createElement(o,null,a.createElement(Bt,null)))}),Vt=e.systemToComponent(zt,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},Ot),Mt=Vt.Component,Ut=Vt.usePublisher,At=Vt.useEmitterValue,Wt=Vt.useEmitter,Nt=rt({usePublisher:Ut,useEmitterValue:At,useEmitter:Wt}),Gt=ot({usePublisher:Ut,useEmitterValue:At,useEmitter:Wt});function Dt(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n(e+" was not resolved to pixel value correctly",t,exports.LogLevel.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}var jt=i.system(function(){var e=i.statefulStream(function(e){return a.createElement("td",null,"Item $",e)}),t=i.statefulStream(null),n=i.statefulStream(null),r=i.statefulStream({}),o=i.statefulStream(De),l=i.statefulStream(i.noop),s=function(e,t){return void 0===t&&(t=null),i.statefulStreamFromEmitter(i.pipe(r,i.map(function(t){return t[e]}),i.distinctUntilChanged()),t)};return{context:t,itemContent:e,fixedHeaderContent:n,components:r,computeItemKey:o,scrollerRef:l,TableComponent:s("Table","table"),TableHeadComponent:s("TableHead","thead"),TableBodyComponent:s("TableBody","tbody"),TableRowComponent:s("TableRow","tr"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),FillerRow:s("FillerRow")}}),_t=i.system(function(e){return l({},e[0],e[1])},i.tup(Me,jt)),Kt=function(e){return a.createElement("tr",null,a.createElement("td",{style:{height:e.height}}))},qt=function(e){return a.createElement("tr",null,a.createElement("td",{style:{height:e.height,padding:0,border:0}}))},Yt=a.memo(function(){var e=tn("listState"),t=en("sizeRanges"),r=tn("useWindowScroll"),o=tn("customScrollParent"),i=en("windowScrollContainerState"),s=en("scrollContainerState"),u=o||r?i:s,c=tn("itemContent"),m=tn("trackItemSizes"),d=S(t,tn("itemSize"),m,u,tn("log"),void 0,o),f=d.callbackRef,p=d.ref,h=a.useState(0),g=h[0],v=h[1];nn("deviation",function(e){g!==e&&(p.current.style.marginTop=e+"px",v(e))});var I=tn("EmptyPlaceholder"),C=tn("ScrollSeekPlaceholder")||Kt,x=tn("FillerRow")||qt,T=tn("TableBodyComponent"),w=tn("TableRowComponent"),b=tn("computeItemKey"),y=tn("isSeeking"),E=tn("paddingTopAddition"),L=tn("firstItemIndex"),H=tn("statefulTotalCount"),R=tn("context");if(0===H&&I)return n.createElement(I,et(I,R));var k=e.offsetTop+E+g,z=e.offsetBottom,B=k>0?a.createElement(x,{height:k,key:"padding-top"}):null,F=z>0?a.createElement(x,{height:z,key:"padding-bottom"}):null,P=e.items.map(function(e){var t=e.originalIndex,r=b(t+L,e.data,R);return y?n.createElement(C,l({},et(C,R),{key:r,index:e.index,height:e.size,type:e.type||"item"})):n.createElement(w,l({},et(w,R),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:{overflowAnchor:"none"}}),c(e.index,e.data,R))});return n.createElement(T,l({ref:f,"data-test-id":"virtuoso-item-list"},et(T,R)),[B].concat(P,[F]))}),Zt=function(e){var t=e.children,n=en("viewportHeight"),r=v(i.compose(n,function(e){return I(e,"height")}));return a.createElement("div",{style:Qe,ref:r,"data-viewport-type":"element"},t)},Jt=function(e){var t=e.children,n=Ae(en("windowViewportRect"),tn("customScrollParent"));return a.createElement("div",{ref:n,style:Qe,"data-viewport-type":"window"},t)},$t=a.memo(function(e){var t=tn("useWindowScroll"),n=tn("customScrollParent"),r=en("fixedHeaderHeight"),o=tn("fixedHeaderContent"),s=tn("context"),u=v(i.compose(r,function(e){return I(e,"height")})),c=n||t?on:rn,m=n||t?Jt:Zt,d=tn("TableComponent"),f=tn("TableHeadComponent"),p=o?a.createElement(f,l({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:u},et(f,s)),o()):null;return a.createElement(c,l({},e),a.createElement(m,null,a.createElement(d,l({style:{borderSpacing:0}},et(d,s)),[p,a.createElement(Yt,{key:"TableBody"})])))}),Qt=e.systemToComponent(_t,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},$t),Xt=Qt.Component,en=Qt.usePublisher,tn=Qt.useEmitterValue,nn=Qt.useEmitter,rn=rt({usePublisher:en,useEmitterValue:tn,useEmitter:nn}),on=ot({usePublisher:en,useEmitterValue:tn,useEmitter:nn}),an=ct,ln=Xt,sn=Mt;exports.GroupedVirtuoso=ct,exports.TableVirtuoso=ln,exports.Virtuoso=an,exports.VirtuosoGrid=sn; | ||
"use strict";var e=require("@virtuoso.dev/react-urx"),t=require("@virtuoso.dev/urx"),n=require("react"),r=require("react-dom");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var i=o(t),a=o(n);function l(){return l=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},l.apply(this,arguments)}function s(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 u(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 c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(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)?u(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.")}var m,d,f="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;exports.LogLevel=void 0,(d=exports.LogLevel||(exports.LogLevel={}))[d.DEBUG=0]="DEBUG",d[d.INFO=1]="INFO",d[d.WARN=2]="WARN",d[d.ERROR=3]="ERROR";var p=((m={})[exports.LogLevel.DEBUG]="debug",m[exports.LogLevel.INFO]="log",m[exports.LogLevel.WARN]="warn",m[exports.LogLevel.ERROR]="error",m),h=i.system(function(){var e=i.statefulStream(exports.LogLevel.ERROR);return{log:i.statefulStream(function(t,n,r){var o;void 0===r&&(r=exports.LogLevel.INFO),r>=(null!=(o=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?o:i.getValue(e))&&console[p[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function g(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 v(e,t){return void 0===t&&(t=!0),g(e,t).callbackRef}function S(e,t,n,r,o,i,a){return g(function(n){for(var l=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),s=n.parentElement;!s.dataset.virtuosoScroller;)s=s.parentElement;var u="window"===s.firstElementChild.dataset.viewportType,c=a?a.scrollTop:u?window.pageYOffset||document.documentElement.scrollTop:s.scrollTop,m=a?a.scrollHeight:u?document.documentElement.scrollHeight:s.scrollHeight,d=a?a.offsetHeight:u?window.innerHeight:s.offsetHeight;r({scrollTop:Math.max(c,0),scrollHeight:m,viewportHeight:d}),null==i||i(function(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n("row-gap was not resolved to pixel value correctly",t,exports.LogLevel.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}(0,getComputedStyle(n).rowGap,o)),null!==l&&e(l)},n)}function I(e,t){return Math.round(e.getBoundingClientRect()[t])}function C(e,t){return Math.abs(e-t)<1.01}function x(e,t,o,a,l){void 0===a&&(a=i.noop);var s=n.useRef(null),u=n.useRef(null),c=n.useRef(null),m=n.useRef(!1),d=n.useCallback(function(n){var o=n.target,i=o===window||o===document,a=i?window.pageYOffset||document.documentElement.scrollTop:o.scrollTop,l=i?document.documentElement.scrollHeight:o.scrollHeight,s=i?window.innerHeight:o.offsetHeight,d=function(){e({scrollTop:Math.max(a,0),scrollHeight:l,viewportHeight:s})};m.current?r.flushSync(d):d(),m.current=!1,null!==u.current&&(a===u.current||a<=0||a===l-s)&&(u.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);return n.useEffect(function(){var e=l||s.current;return a(l||s.current),d({target:e}),e.addEventListener("scroll",d,{passive:!0}),function(){a(null),e.removeEventListener("scroll",d)}},[s,d,o,a,l]),{scrollerRef:s,scrollByCallback:function(e){m.current=!0,s.current.scrollBy(e)},scrollToCallback:function(n){var r=s.current;if(r&&(!("offsetHeight"in r)||0!==r.offsetHeight)){var o,i,a,l="smooth"===n.behavior;if(r===window?(i=Math.max(I(document.documentElement,"height"),document.documentElement.scrollHeight),o=window.innerHeight,a=document.documentElement.scrollTop):(i=r.scrollHeight,o=I(r,"height"),a=r.scrollTop),n.top=Math.ceil(Math.max(Math.min(i-o,n.top),0)),C(o,i)||n.top===a)return e({scrollTop:a,scrollHeight:i,viewportHeight:o}),void(l&&t(!0));l?(u.current=n.top,c.current&&clearTimeout(c.current),c.current=setTimeout(function(){c.current=null,u.current=null,t(!0)},1e3)):u.current=null,r.scrollTo(n)}}}}var T=i.system(function(){var e=i.stream(),t=i.stream(),n=i.statefulStream(0),r=i.stream(),o=i.statefulStream(0),a=i.stream(),l=i.stream(),s=i.statefulStream(0),u=i.statefulStream(0),c=i.statefulStream(0),m=i.stream(),d=i.stream(),f=i.statefulStream(!1),p=i.statefulStream(!1);return i.connect(i.pipe(e,i.map(function(e){return e.scrollTop})),t),i.connect(i.pipe(e,i.map(function(e){return e.scrollHeight})),l),i.connect(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,footerHeight:c,scrollHeight:l,smoothScrollTargetReached:r,react18ConcurrentRendering:p,scrollTo:m,scrollBy:d,statefulScrollTop:o,deviation:n,scrollingInProgress:f}},[],{singleton:!0}),w={lvl:0};function b(e,t,n,r,o){return void 0===r&&(r=w),void 0===o&&(o=w),{k:e,v:t,lvl:n,l:r,r:o}}function y(e){return e===w}function E(){return w}function L(e,t){if(y(e))return w;var n=e.k,r=e.l,o=e.r;if(t===n){if(y(r))return o;if(y(o))return r;var i=B(r);return V(P(e,{k:i[0],v:i[1],l:F(r)}))}return V(P(e,t<n?{l:L(r,t)}:{r:L(o,t)}))}function H(e,t,n){if(void 0===n&&(n="k"),y(e))return[-Infinity,void 0];if(e[n]===t)return[e.k,e.v];if(e[n]<t){var r=H(e.r,t,n);return-Infinity===r[0]?[e.k,e.v]:r}return H(e.l,t,n)}function R(e,t,n){return y(e)?b(t,n,1):t===e.k?P(e,{k:t,v:n}):function(e){return A(W(e))}(P(e,t<e.k?{l:R(e.l,t,n)}:{r:R(e.r,t,n)}))}function k(e,t,n){if(y(e))return[];var r=e.k,o=e.v,i=e.r,a=[];return r>t&&(a=a.concat(k(e.l,t,n))),r>=t&&r<=n&&a.push({k:r,v:o}),r<=n&&(a=a.concat(k(i,t,n))),a}function z(e){return y(e)?[]:[].concat(z(e.l),[{k:e.k,v:e.v}],z(e.r))}function B(e){return y(e.r)?[e.k,e.v]:B(e.r)}function F(e){return y(e.r)?e.l:V(P(e,{r:F(e.r)}))}function P(e,t){return b(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 O(e){return y(e)||e.lvl>e.r.lvl}function V(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(O(t))return W(P(e,{lvl:r-1}));if(y(t)||y(t.r))throw new Error("Unexpected empty nodes");return P(t.r,{l:P(t,{r:t.r.l}),r:P(e,{l:t.r.r,lvl:r-1}),lvl:r})}if(O(e))return A(P(e,{lvl:r-1}));if(y(n)||y(n.l))throw new Error("Unexpected empty nodes");var o=n.l,i=O(o)?n.lvl-1:n.lvl;return P(o,{l:P(e,{r:o.l,lvl:r-1}),r:A(P(n,{l:o.r,lvl:i})),lvl:o.lvl+1})}function M(e,t,n){return y(e)?[]:U(k(e,H(e,t)[0],n),function(e){return{index:e.k,value:e.v}})}function U(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 A(e){var t=e.r,n=e.lvl;return y(t)||y(t.r)||t.lvl!==n||t.r.lvl!==n?e:P(t,{l:P(e,{r:t.l}),lvl:n+1})}function W(e){var t=e.l;return y(t)||t.lvl!==e.lvl?e:P(t,{r:P(e,{l:t.r})})}function N(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 G(e,t,n){return e[N(e,t,n)]}var D=i.system(function(){return{recalcInProgress:i.statefulStream(!1)}},[],{singleton:!0});function j(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 _(e,t){var n=e.index;return t===n?0:t<n?-1:1}function K(e,t){var n=e.offset;return t===n?0:t<n?-1:1}function q(e){return{index:e.index,value:e}}function Y(e,t,n,r){var o=e,i=0,a=0,l=0,s=0;if(0!==t){l=o[s=N(o,t-1,_)].offset;var u=H(n,t-1);i=u[0],a=u[1],o.length&&o[s].size===H(n,t)[1]&&(s-=1),o=o.slice(0,s+1)}else o=[];for(var m,d=c(M(n,t,Infinity));!(m=d()).done;){var f=m.value,p=f.start,h=f.value,g=p-i,v=g*a+l+g*r;o.push({offset:v,size:h,index:p}),i=p,l=v,a=h}return{offsetTree:o,lastIndex:i,lastOffset:l,lastSize:a}}function Z(e,t){var n=t[0],r=t[1],o=t[3];n.length>0&&(0,t[2])("received item sizes",n,exports.LogLevel.DEBUG);var i=e.sizeTree,a=i,l=0;if(r.length>0&&y(i)&&2===n.length){var s=n[0].size,u=n[1].size;a=r.reduce(function(e,t){return R(R(e,t,s),t+1,u)},a)}else{var m=function(e,t){for(var n,r=y(e)?0:Infinity,o=c(t);!(n=o()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(r=Math.min(r,l),y(e))e=R(e,0,a);else{var u=M(e,l-1,s+1);if(!u.some(j(i))){for(var m,d=!1,f=!1,p=c(u);!(m=p()).done;){var h=m.value,g=h.start,v=h.end,S=h.value;d?(s>=g||a===S)&&(e=L(e,g)):(f=S!==a,d=!0),v>s&&s>=g&&S!==a&&(e=R(e,s+1,S))}f&&(e=R(e,l,a))}}}return[e,r]}(a,n);a=m[0],l=m[1]}if(a===i)return e;var d=Y(e.offsetTree,l,a,o),f=d.offsetTree;return{sizeTree:a,offsetTree:f,lastIndex:d.lastIndex,lastOffset:d.lastOffset,lastSize:d.lastSize,groupOffsetTree:r.reduce(function(e,t){return R(e,t,J(t,f,o))},E()),groupIndices:r}}function J(e,t,n){if(0===t.length)return 0;var r=G(t,e,_),o=e-r.index,i=r.size*o+(o-1)*n+r.offset;return i>0?i+n:i}function $(e,t,n){if(function(e){return void 0!==e.groupIndex}(e))return t.groupIndices[e.groupIndex]+1;var r=Q("LAST"===e.index?n:e.index,t);return Math.max(0,r,Math.min(n,r))}function Q(e,t){if(!X(t))return e;for(var n=0;t.groupIndices[n]<=e+n;)n++;return e+n}function X(e){return!y(e.groupOffsetTree)}var ee={offsetHeight:"height",offsetWidth:"width"},te=i.system(function(e){var t=e[0].log,n=e[1].recalcInProgress,r=i.stream(),o=i.stream(),a=i.statefulStreamFromEmitter(o,0),s=i.stream(),u=i.stream(),c=i.statefulStream(0),m=i.statefulStream([]),d=i.statefulStream(void 0),f=i.statefulStream(void 0),p=i.statefulStream(function(e,t){return I(e,ee[t])}),h=i.statefulStream(void 0),g=i.statefulStream(0),v={offsetTree:[],sizeTree:E(),groupOffsetTree:E(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},S=i.statefulStreamFromEmitter(i.pipe(r,i.withLatestFrom(m,t,g),i.scan(Z,v),i.distinctUntilChanged()),v);i.connect(i.pipe(m,i.filter(function(e){return e.length>0}),i.withLatestFrom(S,g),i.map(function(e){var t=e[0],n=e[1],r=e[2],o=t.reduce(function(e,t,o){return R(e,t,J(t,n.offsetTree,r)||o)},E());return l({},n,{groupIndices:t,groupOffsetTree:o})})),S),i.connect(i.pipe(o,i.withLatestFrom(S),i.filter(function(e){return e[0]<e[1].lastIndex}),i.map(function(e){var t=e[1];return[{startIndex:e[0],endIndex:t.lastIndex,size:t.lastSize}]})),r),i.connect(d,f);var C=i.statefulStreamFromEmitter(i.pipe(d,i.map(function(e){return void 0===e})),!0);i.connect(i.pipe(f,i.filter(function(e){return void 0!==e&&y(i.getValue(S).sizeTree)}),i.map(function(e){return[{startIndex:0,endIndex:0,size:e}]})),r);var x=i.streamFromEmitter(i.pipe(r,i.withLatestFrom(S),i.scan(function(e,t){var n=t[1];return{changed:n!==e.sizes,sizes:n}},{changed:!1,sizes:v}),i.map(function(e){return e.changed})));i.subscribe(i.pipe(c,i.scan(function(e,t){return{diff:e.prev-t,prev:t}},{diff:0,prev:0}),i.map(function(e){return e.diff})),function(e){e>0?(i.publish(n,!0),i.publish(s,e)):e<0&&i.publish(u,e)}),i.subscribe(i.pipe(c,i.withLatestFrom(t)),function(e){e[0]<0&&(0,e[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},exports.LogLevel.ERROR)});var T=i.streamFromEmitter(s);i.connect(i.pipe(s,i.withLatestFrom(S),i.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 z(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})),r);var w=i.streamFromEmitter(i.pipe(u,i.withLatestFrom(S,g),i.map(function(e){return J(-e[0],e[1].offsetTree,e[2])})));return i.connect(i.pipe(u,i.withLatestFrom(S,g),i.map(function(e){var t=e[0],n=e[1],r=e[2];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var o=z(n.sizeTree).reduce(function(e,n){var r=n.v;return R(e,Math.max(0,n.k+t),r)},E());return l({},n,{sizeTree:o},Y(n.offsetTree,0,o,r))})),S),{data:h,totalCount:o,sizeRanges:r,groupIndices:m,defaultItemSize:f,fixedItemSize:d,unshiftWith:s,shiftWith:u,shiftWithOffset:w,beforeUnshiftWith:T,firstItemIndex:c,gap:g,sizes:S,listRefresh:x,statefulTotalCount:a,trackItemSizes:C,itemSize:p}},i.tup(h,D),{singleton:!0}),ne="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function re(e){var t="number"==typeof e?{index:e}:e;return t.align||(t.align="start"),t.behavior&&ne||(t.behavior="auto"),t.offset||(t.offset=0),t}var oe=i.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,o=t.listRefresh,a=t.gap,l=e[1],s=l.scrollingInProgress,u=l.viewportHeight,c=l.scrollTo,m=l.smoothScrollTargetReached,d=l.headerHeight,f=l.footerHeight,p=e[2].log,h=i.stream(),g=i.statefulStream(0),v=null,S=null,I=null;function C(){v&&(v(),v=null),I&&(I(),I=null),S&&(clearTimeout(S),S=null),i.publish(s,!1)}return i.connect(i.pipe(h,i.withLatestFrom(n,u,r,g,d,f,p),i.withLatestFrom(a),i.map(function(e){var t=e[0],n=t[0],r=t[1],a=t[2],l=t[3],u=t[4],c=t[5],d=t[6],f=t[7],p=e[1],g=re(n),x=g.align,T=g.behavior,w=g.offset,b=l-1,y=$(g,r,b),E=J(y,r.offsetTree,p)+c;"end"===x?(E=E-a+H(r.sizeTree,y)[1],y===b&&(E+=d)):"center"===x?E=E-a/2+H(r.sizeTree,y)[1]/2:E-=u,w&&(E+=w);var L=function(e){C(),e?(f("retrying to scroll to",{location:n},exports.LogLevel.DEBUG),i.publish(h,n)):f("list did not change, scroll successful",{},exports.LogLevel.DEBUG)};if(C(),"smooth"===T){var R=!1;I=i.subscribe(o,function(e){R=R||e}),v=i.handleNext(m,function(){L(R)})}else v=i.handleNext(i.pipe(o,function(e){var t=setTimeout(function(){e(!1)},150);return function(n){n&&(e(!0),clearTimeout(t))}}),L);return S=setTimeout(function(){C()},1200),i.publish(s,!0),f("scrolling from index to",{index:y,top:E,behavior:T},exports.LogLevel.DEBUG),{top:E,behavior:T}})),c),{scrollToIndex:h,topListHeight:g}},i.tup(te,T,h),{singleton:!0}),ie="up",ae={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},le=i.system(function(e){var t=e[0],n=t.scrollContainerState,r=t.scrollTop,o=t.viewportHeight,a=t.headerHeight,l=t.footerHeight,s=t.scrollBy,u=i.statefulStream(!1),c=i.statefulStream(!0),m=i.stream(),d=i.stream(),f=i.statefulStream(4),p=i.statefulStream(0),h=i.statefulStreamFromEmitter(i.pipe(i.merge(i.pipe(i.duc(r),i.skip(1),i.mapTo(!0)),i.pipe(i.duc(r),i.skip(1),i.mapTo(!1),i.debounceTime(100))),i.distinctUntilChanged()),!1),g=i.statefulStreamFromEmitter(i.pipe(i.merge(i.pipe(s,i.mapTo(!0)),i.pipe(s,i.mapTo(!1),i.debounceTime(200))),i.distinctUntilChanged()),!1);i.connect(i.pipe(i.combineLatest(i.duc(r),i.duc(p)),i.map(function(e){return e[0]<=e[1]}),i.distinctUntilChanged()),c),i.connect(i.pipe(c,i.throttleTime(50)),d);var v=i.streamFromEmitter(i.pipe(i.combineLatest(n,i.duc(o),i.duc(a),i.duc(l),i.duc(f)),i.scan(function(e,t){var n,r,o=t[0],i=o.scrollTop,a=o.scrollHeight,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}},ae),i.distinctUntilChanged(function(e,t){return e&&e.atBottom===t.atBottom}))),S=i.statefulStreamFromEmitter(i.pipe(n,i.scan(function(e,t){var n=t.scrollTop,r=t.scrollHeight,o=t.viewportHeight;return C(e.scrollHeight,r)?{scrollTop:n,scrollHeight:r,jump:0,changed:!1}:e.scrollTop!==n&&r-(n+o)<1?{scrollHeight:r,scrollTop:n,jump:e.scrollTop-n,changed:!0}:{scrollHeight:r,scrollTop:n,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),i.filter(function(e){return e.changed}),i.map(function(e){return e.jump})),0);i.connect(i.pipe(v,i.map(function(e){return e.atBottom})),u),i.connect(i.pipe(u,i.throttleTime(50)),m);var I=i.statefulStream("down");i.connect(i.pipe(n,i.map(function(e){return e.scrollTop}),i.distinctUntilChanged(),i.scan(function(e,t){return i.getValue(g)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?ie:"down",prevScrollTop:t}},{direction:"down",prevScrollTop:0}),i.map(function(e){return e.direction})),I),i.connect(i.pipe(n,i.throttleTime(50),i.mapTo("none")),I);var x=i.statefulStream(0);return i.connect(i.pipe(h,i.filter(function(e){return!e}),i.mapTo(0)),x),i.connect(i.pipe(r,i.throttleTime(100),i.withLatestFrom(h),i.filter(function(e){return!!e[1]}),i.scan(function(e,t){return[e[1],t[0]]},[0,0]),i.map(function(e){return e[1]-e[0]})),x),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:d,atBottomStateChange:m,scrollDirection:I,atBottomThreshold:f,atTopThreshold:p,scrollVelocity:x,lastJumpDueToItemResize:S}},i.tup(T)),se=i.system(function(e){var t=e[0].log,n=i.statefulStream(!1),r=i.streamFromEmitter(i.pipe(n,i.filter(function(e){return e}),i.distinctUntilChanged()));return i.subscribe(n,function(e){e&&i.getValue(t)("props updated",{},exports.LogLevel.DEBUG)}),{propsReady:n,didMount:r}},i.tup(h),{singleton:!0}),ue=i.system(function(e){var t=e[0],n=t.sizes,r=t.listRefresh,o=t.defaultItemSize,a=e[1].scrollTop,l=e[2].scrollToIndex,s=e[3].didMount,u=i.statefulStream(!0),c=i.statefulStream(0);return i.connect(i.pipe(s,i.withLatestFrom(c),i.filter(function(e){return!!e[1]}),i.mapTo(!1)),u),i.subscribe(i.pipe(i.combineLatest(r,s),i.withLatestFrom(u,n,o),i.filter(function(e){var t=e[1],n=e[3];return e[0][1]&&(!y(e[2].sizeTree)||void 0!==n)&&!t}),i.withLatestFrom(c)),function(e){var t=e[1];setTimeout(function(){i.handleNext(a,function(){i.publish(u,!0)}),i.publish(l,t)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},i.tup(te,T,oe,se),{singleton:!0});function ce(e){return!!e&&("smooth"===e?"smooth":"auto")}var me=i.system(function(e){var t=e[0],n=t.totalCount,r=t.listRefresh,o=e[1],a=o.isAtBottom,l=o.atBottomState,s=e[2].scrollToIndex,u=e[3].scrolledToInitialItem,c=e[4],m=c.propsReady,d=c.didMount,f=e[5].log,p=e[6].scrollingInProgress,h=i.statefulStream(!1),g=i.stream(),v=null;function S(e){i.publish(s,{index:"LAST",align:"end",behavior:e})}function I(e){var t=i.handleNext(l,function(t){!e||t.atBottom||"SIZE_INCREASED"!==t.notAtBottomBecause||v||(i.getValue(f)("scrolling to bottom due to increased size",{},exports.LogLevel.DEBUG),S("auto"))});setTimeout(t,100)}return i.subscribe(i.pipe(i.combineLatest(i.pipe(i.duc(n),i.skip(1)),d),i.withLatestFrom(i.duc(h),a,u,p),i.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}}),i.filter(function(e){return e.shouldFollow})),function(e){var t=e.totalCount,n=e.followOutputBehavior;v&&(v(),v=null),v=i.handleNext(r,function(){i.getValue(f)("following output to ",{totalCount:t},exports.LogLevel.DEBUG),S(n),v=null})}),i.subscribe(i.pipe(i.combineLatest(i.duc(h),n,m),i.filter(function(e){return e[0]&&e[2]}),i.scan(function(e,t){var n=t[1];return{refreshed:e.value===n,value:n}},{refreshed:!1,value:0}),i.filter(function(e){return e.refreshed}),i.withLatestFrom(h,n)),function(e){I(!1!==e[1])}),i.subscribe(g,function(){I(!1!==i.getValue(h))}),i.subscribe(i.combineLatest(i.duc(h),l),function(e){var t=e[1];e[0]&&!t.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===t.notAtBottomBecause&&S("auto")}),{followOutput:h,autoscrollToBottom:g}},i.tup(te,le,oe,ue,se,h,T));function de(e){return e.reduce(function(e,t){return e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e},{totalCount:0,groupIndices:[]})}var fe=i.system(function(e){var t=e[0],n=t.totalCount,r=t.groupIndices,o=t.sizes,a=e[1],l=a.scrollTop,s=a.headerHeight,u=i.stream(),c=i.stream(),m=i.streamFromEmitter(i.pipe(u,i.map(de)));return i.connect(i.pipe(m,i.map(function(e){return e.totalCount})),n),i.connect(i.pipe(m,i.map(function(e){return e.groupIndices})),r),i.connect(i.pipe(i.combineLatest(l,o,s),i.filter(function(e){return X(e[1])}),i.map(function(e){return H(e[1].groupOffsetTree,Math.max(e[0]-e[2],0),"v")[0]}),i.distinctUntilChanged(),i.map(function(e){return[e]})),c),{groupCounts:u,topItemsIndexes:c}},i.tup(te,T));function pe(e,t){return!(!e||e[0]!==t[0]||e[1]!==t[1])}function he(e,t){return!(!e||e.startIndex!==t.startIndex||e.endIndex!==t.endIndex)}function ge(e,t,n){return"number"==typeof e?n===ie&&"top"===t||"down"===n&&"bottom"===t?e:0:n===ie?"top"===t?e.main:e.reverse:"bottom"===t?e.main:e.reverse}function ve(e,t){return"number"==typeof e?e:e[t]||0}var Se=i.system(function(e){var t=e[0],n=t.scrollTop,r=t.viewportHeight,o=t.deviation,a=t.headerHeight,l=t.fixedHeaderHeight,s=i.stream(),u=i.statefulStream(0),c=i.statefulStream(0),m=i.statefulStream(0),d=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(i.duc(n),i.duc(r),i.duc(a),i.duc(s,pe),i.duc(m),i.duc(u),i.duc(l),i.duc(o),i.duc(c)),i.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[6],u=e[7],c=e[8],m=t-u,d=e[5]+s,f=Math.max(r-m,0),p="none",h=ve(c,"top"),g=ve(c,"bottom");return i-=u,a+=r+s,(i+=r+s)>t+d-h&&(p=ie),(a-=u)<t-f+n+g&&(p="down"),"none"!==p?[Math.max(m-r-ge(l,"top",p)-h,0),m-f-s+n+ge(l,"bottom",p)+g]:null}),i.filter(function(e){return null!=e}),i.distinctUntilChanged(pe)),[0,0]);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:d}},i.tup(T),{singleton:!0}),Ie={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function Ce(e,t,n){if(0===e.length)return[];if(!X(t))return e.map(function(e){return l({},e,{index:e.index+n,originalIndex:e.index})});for(var r,o=[],i=M(t.groupOffsetTree,e[0].index,e[e.length-1].index),a=void 0,s=0,u=c(e);!(r=u()).done;){var m=r.value;(!a||a.end<m.index)&&(a=i.shift(),s=t.groupIndices.indexOf(a.start)),o.push(l({},m.index===a.start?{type:"group",index:s}:{index:m.index-(s+1)+n,groupIndex:s},{size:m.size,offset:m.offset,originalIndex:m.index,data:m.data}))}return o}function xe(e,t,n,r,o,i){var a=0,l=0;if(e.length>0){a=e[0].offset;var s=e[e.length-1];l=s.offset+s.size}var u=n-o.lastIndex,c=a,m=o.lastOffset+u*o.lastSize+(u-1)*r-l;return{items:Ce(e,o,i),topItems:Ce(t,o,i),topListHeight:t.reduce(function(e,t){return t.size+e},0),offsetTop:a,offsetBottom:m,top:c,bottom:l,totalCount:n,firstItemIndex:i}}var Te=i.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,o=t.data,a=t.firstItemIndex,s=t.gap,u=e[1],m=e[2],d=m.visibleRange,f=m.listBoundary,p=m.topListHeight,h=e[3],g=h.scrolledToInitialItem,v=h.initialTopMostItemIndex,S=e[4].topListHeight,I=e[5],C=e[6].didMount,x=e[7].recalcInProgress,T=i.statefulStream([]),w=i.stream();i.connect(u.topItemsIndexes,T);var b=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(C,x,i.duc(d,pe),i.duc(r),i.duc(n),i.duc(v),g,i.duc(T),i.duc(a),i.duc(s),o),i.filter(function(e){return e[0]&&!e[1]}),i.map(function(e){var t=e[2],n=t[0],r=t[1],o=e[3],a=e[5],s=e[6],u=e[7],m=e[8],d=e[9],f=e[10],p=e[4],h=p.sizeTree,g=p.offsetTree;if(0===o||0===n&&0===r)return l({},Ie,{totalCount:o});if(y(h))return xe(function(e,t,n){if(X(t)){var r=Q(e,t);return[{index:H(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]}]}(function(e,t){return"number"==typeof e?e:"LAST"===e.index?t-1:e.index}(a,o),p,f),[],o,d,p,m);var v=[];if(u.length>0)for(var S,I=u[0],C=u[u.length-1],x=0,T=c(M(h,I,C));!(S=T()).done;)for(var w=S.value,b=w.value,E=Math.max(w.start,I),L=Math.min(w.end,C),R=E;R<=L;R++)v.push({index:R,size:b,offset:x,data:f&&f[R]}),x+=b;if(!s)return xe([],v,o,d,p,m);var k=u.length>0?u[u.length-1]+1:0,z=function(e,t,n,r){return void 0===r&&(r=0),r>0&&(t=Math.max(t,G(e,r,_).offset)),U((i=n,l=N(o=e,t,a=K),s=N(o,i,a,l),o.slice(l,s+1)),q);var o,i,a,l,s}(g,n,r,k);if(0===z.length)return null;var B=o-1;return xe(i.tap([],function(e){for(var t,o=c(z);!(t=o()).done;){var i=t.value,a=i.value,l=a.offset,s=i.start,u=a.size;if(a.offset<n){var m=(s+=Math.floor((n-a.offset+d)/(u+d)))-i.start;l+=m*u+m*d}s<k&&(l+=(k-s)*u,s=k);for(var p=Math.min(i.end,B),h=s;h<=p&&!(l>=r);h++)e.push({index:h,size:u,offset:l,data:f&&f[h]}),l+=u+d}}),v,o,d,p,m)}),i.filter(function(e){return null!==e}),i.distinctUntilChanged()),Ie);return i.connect(i.pipe(o,i.filter(function(e){return void 0!==e}),i.map(function(e){return e.length})),r),i.connect(i.pipe(b,i.map(function(e){return e.topListHeight})),S),i.connect(S,p),i.connect(i.pipe(b,i.map(function(e){return[e.top,e.bottom]})),f),i.connect(i.pipe(b,i.map(function(e){return e.items})),w),l({listState:b,topItemsIndexes:T,endReached:i.streamFromEmitter(i.pipe(b,i.filter(function(e){return e.items.length>0}),i.withLatestFrom(r,o),i.filter(function(e){var t=e[0].items;return t[t.length-1].originalIndex===e[1]-1}),i.map(function(e){return[e[1]-1,e[2]]}),i.distinctUntilChanged(pe),i.map(function(e){return e[0]}))),startReached:i.streamFromEmitter(i.pipe(b,i.throttleTime(200),i.filter(function(e){var t=e.items;return t.length>0&&t[0].originalIndex===e.topItems.length}),i.map(function(e){return e.items[0].index}),i.distinctUntilChanged())),rangeChanged:i.streamFromEmitter(i.pipe(b,i.filter(function(e){return e.items.length>0}),i.map(function(e){for(var t=e.items,n=0,r=t.length-1;"group"===t[n].type&&n<r;)n++;for(;"group"===t[r].type&&r>n;)r--;return{startIndex:t[n].index,endIndex:t[r].index}}),i.distinctUntilChanged(he))),itemsRendered:w},I)},i.tup(te,fe,Se,ue,oe,le,se,D),{singleton:!0}),we=i.system(function(e){var t=e[0],n=t.sizes,r=t.firstItemIndex,o=t.data,a=t.gap,l=e[1].listState,s=e[2].didMount,u=i.statefulStream(0);return i.connect(i.pipe(s,i.withLatestFrom(u),i.filter(function(e){return 0!==e[1]}),i.withLatestFrom(n,r,a,o),i.map(function(e){var t=e[0][1],n=e[1],r=e[2],o=e[3],i=e[4],a=void 0===i?[]:i,l=0;if(n.groupIndices.length>0)for(var s,u=c(n.groupIndices);!((s=u()).done||s.value-l>=t);)l++;var m=t+l;return xe(Array.from({length:m}).map(function(e,t){return{index:t,size:0,offset:0,data:a[t]}}),[],m,o,n,r)})),l),{initialItemCount:u}},i.tup(te,Te,se),{singleton:!0}),be=i.system(function(e){var t=e[0].scrollVelocity,n=i.statefulStream(!1),r=i.stream(),o=i.statefulStream(!1);return i.connect(i.pipe(t,i.withLatestFrom(o,n,r),i.filter(function(e){return!!e[1]}),i.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}),i.distinctUntilChanged()),n),i.subscribe(i.pipe(i.combineLatest(n,t,r),i.withLatestFrom(o)),function(e){var t=e[0],n=e[1];return t[0]&&n&&n.change&&n.change(t[1],t[2])}),{isSeeking:n,scrollSeekConfiguration:o,scrollVelocity:t,scrollSeekRangeChanged:r}},i.tup(le),{singleton:!0}),ye=i.system(function(e){var t=e[0].topItemsIndexes,n=i.statefulStream(0);return i.connect(i.pipe(n,i.filter(function(e){return e>0}),i.map(function(e){return Array.from({length:e}).map(function(e,t){return t})})),t),{topItemCount:n}},i.tup(Te)),Ee=i.system(function(e){var t=e[0],n=t.footerHeight,r=t.headerHeight,o=t.fixedHeaderHeight,a=e[1].listState,l=i.stream(),s=i.statefulStreamFromEmitter(i.pipe(i.combineLatest(n,r,o,a),i.map(function(e){var t=e[3];return e[0]+e[1]+e[2]+t.offsetBottom+t.bottom})),0);return i.connect(i.duc(s),l),{totalListHeight:s,totalListHeightChanged:l}},i.tup(T,Te),{singleton:!0});function Le(e){var t,n=!1;return function(){return n||(n=!0,t=e()),t}}var He=Le(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),Re=i.system(function(e){var t=e[0],n=t.scrollBy,r=t.scrollTop,o=t.deviation,a=t.scrollingInProgress,l=e[1],s=l.isScrolling,u=l.isAtBottom,c=l.scrollDirection,m=e[3],d=m.beforeUnshiftWith,f=m.shiftWithOffset,p=m.sizes,h=m.gap,g=e[4].log,v=e[5].recalcInProgress,S=i.streamFromEmitter(i.pipe(e[2].listState,i.withLatestFrom(l.lastJumpDueToItemResize),i.scan(function(e,t){var n=e[1],r=t[0],o=r.items,i=r.totalCount,a=r.bottom+r.offsetBottom,l=0;return e[2]===i&&n.length>0&&o.length>0&&(0===o[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-e[3])&&(l+=t[1])),[l,o,i,a]},[0,[],0,0]),i.filter(function(e){return 0!==e[0]}),i.withLatestFrom(r,c,a,u,g),i.filter(function(e){return!e[3]&&0!==e[1]&&e[2]===ie}),i.map(function(e){var t=e[0][0];return(0,e[5])("Upward scrolling compensation",{amount:t},exports.LogLevel.DEBUG),t})));function I(e){e>0?(i.publish(n,{top:-e,behavior:"auto"}),i.publish(o,0)):(i.publish(o,0),i.publish(n,{top:-e,behavior:"auto"}))}return i.subscribe(i.pipe(S,i.withLatestFrom(o,s)),function(e){var t=e[0],n=e[1];e[2]&&He()?i.publish(o,n-t):I(-t)}),i.subscribe(i.pipe(i.combineLatest(i.statefulStreamFromEmitter(s,!1),o,v),i.filter(function(e){return!e[0]&&!e[2]&&0!==e[1]}),i.map(function(e){return e[1]}),i.throttleTime(1)),I),i.connect(i.pipe(f,i.map(function(e){return{top:-e}})),n),i.subscribe(i.pipe(d,i.withLatestFrom(p,h),i.map(function(e){var t=e[0];return t*e[1].lastSize+t*e[2]})),function(e){i.publish(o,e),requestAnimationFrame(function(){i.publish(n,{top:e}),requestAnimationFrame(function(){i.publish(o,0),i.publish(v,!1)})})}),{deviation:o}},i.tup(T,le,Te,te,h,D)),ke=i.system(function(e){var t=e[0].totalListHeight,n=e[1].didMount,r=e[2].scrollTo,o=i.statefulStream(0);return i.subscribe(i.pipe(n,i.withLatestFrom(o),i.filter(function(e){return 0!==e[1]}),i.map(function(e){return{top:e[1]}})),function(e){i.handleNext(i.pipe(t,i.filter(function(e){return 0!==e})),function(){setTimeout(function(){i.publish(r,e)})})}),{initialScrollTop:o}},i.tup(Ee,se,T),{singleton:!0}),ze=i.system(function(e){var t=e[0].viewportHeight,n=e[1].totalListHeight,r=i.statefulStream(!1);return{alignToBottom:r,paddingTopAddition:i.statefulStreamFromEmitter(i.pipe(i.combineLatest(r,t,n),i.filter(function(e){return e[0]}),i.map(function(e){return Math.max(0,e[1]-e[2])}),i.distinctUntilChanged()),0)}},i.tup(T,Ee),{singleton:!0}),Be=i.system(function(e){var t=e[0],n=t.scrollTo,r=t.scrollContainerState,o=i.stream(),a=i.stream(),s=i.stream(),u=i.statefulStream(!1),c=i.statefulStream(void 0);return i.connect(i.pipe(i.combineLatest(o,a),i.map(function(e){var t=e[0],n=t.viewportHeight,r=t.scrollHeight;return{scrollTop:Math.max(0,t.scrollTop-e[1].offsetTop),scrollHeight:r,viewportHeight:n}})),r),i.connect(i.pipe(n,i.withLatestFrom(a),i.map(function(e){var t=e[0];return l({},t,{top:t.top+e[1].offsetTop})})),s),{useWindowScroll:u,customScrollParent:c,windowScrollContainerState:o,windowViewportRect:a,windowScrollTo:s}},i.tup(T)),Fe=["done","behavior","align"],Pe=i.system(function(e){var t=e[0],n=t.sizes,r=t.totalCount,o=t.gap,a=e[1],u=a.scrollTop,c=a.viewportHeight,m=a.headerHeight,d=a.scrollingInProgress,f=e[2].scrollToIndex,p=i.stream();return i.connect(i.pipe(p,i.withLatestFrom(n,c,r,m,u,o),i.map(function(e){var t=e[0],n=e[1],r=e[2],o=e[3],a=e[4],u=e[5],c=e[6],m=t.done,f=t.behavior,p=t.align,h=s(t,Fe),g=null,v=$(t,n,o-1),S=J(v,n.offsetTree,c)+a;return S<u?g=l({},h,{behavior:f,align:null!=p?p:"start"}):S+H(n.sizeTree,v)[1]>u+r&&(g=l({},h,{behavior:f,align:null!=p?p:"end"})),g?m&&i.handleNext(i.pipe(d,i.skip(1),i.filter(function(e){return!1===e})),m):m&&m(),g}),i.filter(function(e){return null!==e})),f),{scrollIntoView:p}},i.tup(te,T,oe,Te,h),{singleton:!0}),Oe=["listState","topItemsIndexes"],Ve=i.system(function(e){return l({},e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},i.tup(Se,we,se,be,Ee,ke,ze,Be,Pe)),Me=i.system(function(e){var t=e[0],n=t.totalCount,r=t.sizeRanges,o=t.fixedItemSize,a=t.defaultItemSize,u=t.trackItemSizes,c=t.itemSize,m=t.data,d=t.firstItemIndex,f=t.groupIndices,p=t.statefulTotalCount,h=t.gap,g=e[1],v=g.initialTopMostItemIndex,S=g.scrolledToInitialItem,I=e[2],C=e[3],x=e[4],T=x.listState,w=x.topItemsIndexes,b=s(x,Oe),y=e[5].scrollToIndex,E=e[7].topItemCount,L=e[8].groupCounts,H=e[9],R=e[10];return i.connect(b.rangeChanged,H.scrollSeekRangeChanged),i.connect(i.pipe(H.windowViewportRect,i.map(function(e){return e.visibleHeight})),I.viewportHeight),l({totalCount:n,data:m,firstItemIndex:d,sizeRanges:r,initialTopMostItemIndex:v,scrolledToInitialItem:S,topItemsIndexes:w,topItemCount:E,groupCounts:L,fixedItemHeight:o,defaultItemHeight:a,gap:h},C,{statefulTotalCount:p,listState:T,scrollToIndex:y,trackItemSizes:u,itemSize:c,groupIndices:f},b,H,I,R)},i.tup(te,ue,T,me,Te,oe,Re,ye,fe,Ve,h)),Ue=Le(function(){if("undefined"==typeof document)return"sticky";var e=document.createElement("div");return e.style.position="-webkit-sticky","-webkit-sticky"===e.style.position?"-webkit-sticky":"sticky"});function Ae(e,t){var r=n.useRef(null),o=n.useCallback(function(n){if(null!==n&&n.offsetParent){var o,i,a=n.getBoundingClientRect(),l=a.width;if(t){var s=t.getBoundingClientRect(),u=a.top-s.top;o=s.height-Math.max(0,u),i=u+t.scrollTop}else o=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;r.current={offsetTop:i,visibleHeight:o,visibleWidth:l},e(r.current)}},[e,t]),i=g(o),a=i.callbackRef,l=i.ref,s=n.useCallback(function(){o(l.current)},[o,l]);return n.useEffect(function(){if(t){t.addEventListener("scroll",s);var e=new ResizeObserver(s);return e.observe(t),function(){t.removeEventListener("scroll",s),e.unobserve(t)}}return window.addEventListener("scroll",s),window.addEventListener("resize",s),function(){window.removeEventListener("scroll",s),window.removeEventListener("resize",s)}},[s,t]),a}var We=["placeholder"],Ne=["style","children"],Ge=["style","children"];function De(e){return e}var je=i.system(function(){var e=i.statefulStream(function(e){return"Item "+e}),t=i.statefulStream(null),n=i.statefulStream(function(e){return"Group "+e}),r=i.statefulStream({}),o=i.statefulStream(De),a=i.statefulStream("div"),l=i.statefulStream(i.noop),s=function(e,t){return void 0===t&&(t=null),i.statefulStreamFromEmitter(i.pipe(r,i.map(function(t){return t[e]}),i.distinctUntilChanged()),t)};return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:a,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function _e(e,t){var n=i.stream();return i.subscribe(n,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+t,"color: red;","color: inherit;","color: blue;")}),i.connect(n,e),n}var Ke=i.system(function(e){var t=e[0],n=e[1],r={item:_e(n.itemContent,"Rename the %citem%c prop to %citemContent."),group:_e(n.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:_e(t.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:_e(t.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:_e(t.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:i.stream(),maxHeightCacheSize:i.stream(),footer:i.stream(),header:i.stream(),HeaderContainer:i.stream(),FooterContainer:i.stream(),ItemContainer:i.stream(),ScrollContainer:i.stream(),GroupContainer:i.stream(),ListContainer:i.stream(),emptyComponent:i.stream(),scrollSeek:i.stream()};function o(e,t,r){i.connect(i.pipe(e,i.withLatestFrom(n.components),i.map(function(e){var n,o=e[0],i=e[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+t+" instead."),l({},i,((n={})[t]=o,n))})),n.components)}return i.subscribe(r.adjustForPrependedItems,function(){console.warn("react-virtuoso: adjustForPrependedItems is no longer supported. Use the firstItemIndex property instead - https://virtuoso.dev/prepend-items.","color: red;","color: inherit;","color: blue;")}),i.subscribe(r.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),i.subscribe(r.HeaderContainer,function(){console.warn("react-virtuoso: HeaderContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the header component and pass components.Header to change its contents.")}),i.subscribe(r.FooterContainer,function(){console.warn("react-virtuoso: FooterContainer is deprecated. Use headerFooterTag if you want to change the wrapper of the footer component and pass components.Footer to change its contents.")}),i.subscribe(r.scrollSeek,function(e){var r=e.placeholder,o=s(e,We);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),i.publish(n.components,l({},i.getValue(n.components),{ScrollSeekPlaceholder:r})),i.publish(t.scrollSeekConfiguration,o)}),o(r.footer,"Footer","footer"),o(r.header,"Header","header"),o(r.ItemContainer,"Item","ItemContainer"),o(r.ListContainer,"List","ListContainer"),o(r.ScrollContainer,"Scroller","ScrollContainer"),o(r.emptyComponent,"EmptyPlaceholder","emptyComponent"),o(r.GroupContainer,"Group","GroupContainer"),l({},t,n,r)},i.tup(Me,je)),qe=function(e){return a.createElement("div",{style:{height:e.height}})},Ye={position:Ue(),zIndex:1,overflowAnchor:"none"},Ze={overflowAnchor:"none"},Je=a.memo(function(e){var t=e.showTopList,r=void 0!==t&&t,o=dt("listState"),s=mt("sizeRanges"),u=dt("useWindowScroll"),c=dt("customScrollParent"),m=mt("windowScrollContainerState"),d=mt("scrollContainerState"),f=c||u?m:d,p=dt("itemContent"),h=dt("context"),g=dt("groupContent"),v=dt("trackItemSizes"),I=dt("itemSize"),C=dt("log"),x=mt("gap"),T=S(s,I,v,r?i.noop:f,C,x,c).callbackRef,w=a.useState(0),b=w[0],y=w[1];ft("deviation",function(e){b!==e&&y(e)});var E=dt("EmptyPlaceholder"),L=dt("ScrollSeekPlaceholder")||qe,H=dt("ListComponent"),R=dt("ItemComponent"),k=dt("GroupComponent"),z=dt("computeItemKey"),B=dt("isSeeking"),F=dt("groupIndices").length>0,P=dt("paddingTopAddition"),O=r?{}:{boxSizing:"border-box",paddingTop:o.offsetTop+P,paddingBottom:o.offsetBottom,marginTop:b};return!r&&0===o.totalCount&&E?n.createElement(E,et(E,h)):n.createElement(H,l({},et(H,h),{ref:T,style:O,"data-test-id":r?"virtuoso-top-item-list":"virtuoso-item-list"}),(r?o.topItems:o.items).map(function(e){var t=e.originalIndex,r=z(t+o.firstItemIndex,e.data,h);return B?n.createElement(L,l({},et(L,h),{key:r,index:e.index,height:e.size,type:e.type||"item"},"group"===e.type?{}:{groupIndex:e.groupIndex})):"group"===e.type?n.createElement(k,l({},et(k,h),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:Ye}),g(e.index)):n.createElement(R,l({},et(R,h),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,"data-item-group-index":e.groupIndex,style:Ze}),F?p(e.index,e.groupIndex,e.data,h):p(e.index,e.data,h))}))}),$e={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Qe={width:"100%",height:"100%",position:"absolute",top:0},Xe={width:"100%",position:Ue(),top:0};function et(e,t){if("string"!=typeof e)return{context:t}}var tt=a.memo(function(){var e=dt("HeaderComponent"),t=mt("headerHeight"),r=dt("headerFooterTag"),o=v(function(e){return t(I(e,"height"))}),i=dt("context");return e?n.createElement(r,{ref:o},n.createElement(e,et(e,i))):null}),nt=a.memo(function(){var e=dt("FooterComponent"),t=mt("footerHeight"),r=dt("headerFooterTag"),o=v(function(e){return t(I(e,"height"))}),i=dt("context");return e?n.createElement(r,{ref:o},n.createElement(e,et(e,i))):null});function rt(e){var t=e.usePublisher,r=e.useEmitter,o=e.useEmitterValue;return a.memo(function(e){var i=e.style,a=e.children,u=s(e,Ne),c=t("scrollContainerState"),m=o("ScrollerComponent"),d=t("smoothScrollTargetReached"),f=o("scrollerRef"),p=o("context"),h=x(c,d,m,f),g=h.scrollerRef,v=h.scrollByCallback;return r("scrollTo",h.scrollToCallback),r("scrollBy",v),n.createElement(m,l({ref:g,style:l({},$e,i),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},u,et(m,p)),a)})}function ot(e){var t=e.usePublisher,r=e.useEmitter,o=e.useEmitterValue;return a.memo(function(e){var a=e.style,u=e.children,c=s(e,Ge),m=t("windowScrollContainerState"),d=o("ScrollerComponent"),p=t("smoothScrollTargetReached"),h=o("totalListHeight"),g=o("deviation"),v=o("customScrollParent"),S=o("context"),I=x(m,p,d,i.noop,v),C=I.scrollerRef,T=I.scrollByCallback,w=I.scrollToCallback;return f(function(){return C.current=v||window,function(){C.current=null}},[C,v]),r("windowScrollTo",w),r("scrollBy",T),n.createElement(d,l({style:l({position:"relative"},a,0!==h?{height:h+g}:{}),"data-virtuoso-scroller":!0},c,et(d,S)),u)})}var it=function(e){var t=e.children,n=mt("viewportHeight"),r=v(i.compose(n,function(e){return I(e,"height")}));return a.createElement("div",{style:Qe,ref:r,"data-viewport-type":"element"},t)},at=function(e){var t=e.children,n=Ae(mt("windowViewportRect"),dt("customScrollParent"));return a.createElement("div",{ref:n,style:Qe,"data-viewport-type":"window"},t)},lt=function(e){var t=e.children,r=dt("TopItemListComponent"),o=dt("headerHeight"),i=l({},Xe,{marginTop:o+"px"}),a=dt("context");return n.createElement(r||"div",{style:i,context:a},t)},st=a.memo(function(e){var t=dt("useWindowScroll"),n=dt("topItemsIndexes").length>0,r=dt("customScrollParent"),o=r||t?at:it;return a.createElement(r||t?ht:pt,l({},e),a.createElement(o,null,a.createElement(tt,null),a.createElement(Je,null),a.createElement(nt,null)),n&&a.createElement(lt,null,a.createElement(Je,{showTopList:!0})))}),ut=e.systemToComponent(Ke,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},st),ct=ut.Component,mt=ut.usePublisher,dt=ut.useEmitterValue,ft=ut.useEmitter,pt=rt({usePublisher:mt,useEmitterValue:dt,useEmitter:ft}),ht=ot({usePublisher:mt,useEmitterValue:dt,useEmitter:ft}),gt={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},vt={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},St=Math.round,It=Math.ceil,Ct=Math.floor,xt=Math.min,Tt=Math.max;function wt(e,t){return Array.from({length:t-e+1}).map(function(t,n){return{index:n+e}})}function bt(e,t){return e&&e.column===t.column&&e.row===t.row}var yt=i.system(function(e){var t=e[0],n=t.overscan,r=t.visibleRange,o=t.listBoundary,a=e[1],s=a.scrollTop,u=a.viewportHeight,c=a.scrollBy,m=a.scrollTo,d=a.smoothScrollTargetReached,f=a.scrollContainerState,p=e[2],h=e[3],g=e[4],v=g.propsReady,S=g.didMount,I=e[5],C=I.windowViewportRect,x=I.windowScrollTo,T=I.useWindowScroll,w=I.customScrollParent,b=I.windowScrollContainerState,y=e[6],E=i.statefulStream(0),L=i.statefulStream(0),H=i.statefulStream(gt),R=i.statefulStream({height:0,width:0}),k=i.statefulStream({height:0,width:0}),z=i.stream(),B=i.stream(),F=i.statefulStream(0),P=i.statefulStream({row:0,column:0});i.connect(i.pipe(S,i.withLatestFrom(L),i.filter(function(e){return 0!==e[1]}),i.map(function(e){return{items:wt(0,e[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),H),i.connect(i.pipe(i.combineLatest(i.duc(E),r,i.duc(P,bt),i.duc(k,function(e,t){return e&&e.width===t.width&&e.height===t.height})),i.withLatestFrom(R),i.map(function(e){var t=e[0],n=t[0],r=t[1],o=r[0],i=r[1],a=t[2],l=t[3],s=e[1],u=a.row,c=l.height,m=l.width,d=s.width;if(0===n||0===d)return gt;if(0===m)return vt;var f=Ht(d,m,a.column),p=f*Ct((o+u)/(c+u)),h=f*It((i+u)/(c+u))-1;h=Tt(0,xt(n-1,h));var g=wt(p=xt(h,Tt(0,p)),h),v=Et(s,a,l,g),S=v.top,I=v.bottom,C=It(n/f);return{items:g,offsetTop:S,offsetBottom:C*c+(C-1)*u-I,top:S,bottom:I,itemHeight:c,itemWidth:m}})),H),i.connect(i.pipe(R,i.map(function(e){return e.height})),u),i.connect(i.pipe(i.combineLatest(R,k,H,P),i.map(function(e){var t=Et(e[0],e[3],e[1],e[2].items);return[t.top,t.bottom]}),i.distinctUntilChanged(pe)),o);var O=i.streamFromEmitter(i.pipe(i.duc(H),i.filter(function(e){return e.items.length>0}),i.withLatestFrom(E),i.filter(function(e){var t=e[0].items;return t[t.length-1].index===e[1]-1}),i.map(function(e){return e[1]-1}),i.distinctUntilChanged())),V=i.streamFromEmitter(i.pipe(i.duc(H),i.filter(function(e){var t=e.items;return t.length>0&&0===t[0].index}),i.mapTo(0),i.distinctUntilChanged())),M=i.streamFromEmitter(i.pipe(i.duc(H),i.filter(function(e){return e.items.length>0}),i.map(function(e){var t=e.items;return{startIndex:t[0].index,endIndex:t[t.length-1].index}}),i.distinctUntilChanged(he)));i.connect(M,h.scrollSeekRangeChanged),i.connect(i.pipe(z,i.withLatestFrom(R,k,E,P),i.map(function(e){var t=e[1],n=e[2],r=e[3],o=e[4],i=re(e[0]),a=i.align,l=i.behavior,s=i.offset,u=i.index;"LAST"===u&&(u=r-1);var c=Lt(t,o,n,u=Tt(0,u,xt(r-1,u)));return"end"===a?c=St(c-t.height+n.height):"center"===a&&(c=St(c-t.height/2+n.height/2)),s&&(c+=s),{top:c,behavior:l}})),m);var U=i.statefulStreamFromEmitter(i.pipe(H,i.map(function(e){return e.offsetBottom+e.bottom})),0);return i.connect(i.pipe(C,i.map(function(e){return{width:e.visibleWidth,height:e.visibleHeight}})),R),l({totalCount:E,viewportDimensions:R,itemDimensions:k,scrollTop:s,scrollHeight:B,overscan:n,scrollBy:c,scrollTo:m,scrollToIndex:z,smoothScrollTargetReached:d,windowViewportRect:C,windowScrollTo:x,useWindowScroll:T,customScrollParent:w,windowScrollContainerState:b,deviation:F,scrollContainerState:f,initialItemCount:L,gap:P},h,{gridState:H,totalListHeight:U},p,{startReached:V,endReached:O,rangeChanged:M,propsReady:v},y)},i.tup(Se,T,le,be,se,Be,h));function Et(e,t,n,r){var o=n.height;return void 0===o||0===r.length?{top:0,bottom:0}:{top:Lt(e,t,n,r[0].index),bottom:Lt(e,t,n,r[r.length-1].index)+o}}function Lt(e,t,n,r){var o=Ht(e.width,n.width,t.column),i=Ct(r/o),a=i*n.height+Tt(0,i-1)*t.row;return a>0?a+t.row:a}function Ht(e,t,n){return Tt(1,Ct((e+n)/(t+n)))}var Rt=["placeholder"],kt=i.system(function(){var e=i.statefulStream(function(e){return"Item "+e}),t=i.statefulStream({}),n=i.statefulStream(null),r=i.statefulStream("virtuoso-grid-item"),o=i.statefulStream("virtuoso-grid-list"),a=i.statefulStream(De),l=i.statefulStream(i.noop),s=function(e,n){return void 0===n&&(n=null),i.statefulStreamFromEmitter(i.pipe(t,i.map(function(t){return t[e]}),i.distinctUntilChanged()),n)};return{context:n,itemContent:e,components:t,computeItemKey:a,itemClassName:r,listClassName:o,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),zt=i.system(function(e){var t=e[0],n=e[1],r={item:_e(n.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:i.stream(),ScrollContainer:i.stream(),ListContainer:i.stream(),emptyComponent:i.stream(),scrollSeek:i.stream()};function o(e,t,r){i.connect(i.pipe(e,i.withLatestFrom(n.components),i.map(function(e){var n,o=e[0],i=e[1];return console.warn("react-virtuoso: "+r+" property is deprecated. Pass components."+t+" instead."),l({},i,((n={})[t]=o,n))})),n.components)}return i.subscribe(r.scrollSeek,function(e){var r=e.placeholder,o=s(e,Rt);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),i.publish(n.components,l({},i.getValue(n.components),{ScrollSeekPlaceholder:r})),i.publish(t.scrollSeekConfiguration,o)}),o(r.ItemContainer,"Item","ItemContainer"),o(r.ListContainer,"List","ListContainer"),o(r.ScrollContainer,"Scroller","ScrollContainer"),l({},t,n,r)},i.tup(yt,kt)),Bt=a.memo(function(){var e=At("gridState"),t=At("listClassName"),r=At("itemClassName"),o=At("itemContent"),i=At("computeItemKey"),a=At("isSeeking"),s=Ut("scrollHeight"),u=At("ItemComponent"),c=At("ListComponent"),m=At("ScrollSeekPlaceholder"),d=At("context"),f=Ut("itemDimensions"),p=Ut("gap"),h=At("log"),g=v(function(e){s(e.parentElement.parentElement.scrollHeight);var t=e.firstChild;t&&f(t.getBoundingClientRect()),p({row:Dt("row-gap",getComputedStyle(e).rowGap,h),column:Dt("column-gap",getComputedStyle(e).columnGap,h)})});return n.createElement(c,l({ref:g,className:t},et(c,d),{style:{paddingTop:e.offsetTop,paddingBottom:e.offsetBottom}}),e.items.map(function(t){var s=i(t.index);return a?n.createElement(m,l({key:s},et(m,d),{index:t.index,height:e.itemHeight,width:e.itemWidth})):n.createElement(u,l({},et(u,d),{className:r,"data-index":t.index,key:s}),o(t.index,d))}))}),Ft=function(e){var t=e.children,n=Ut("viewportDimensions"),r=v(function(e){n(e.getBoundingClientRect())});return a.createElement("div",{style:Qe,ref:r},t)},Pt=function(e){var t=e.children,n=Ae(Ut("windowViewportRect"),At("customScrollParent"));return a.createElement("div",{ref:n,style:Qe},t)},Ot=a.memo(function(e){var t=l({},e),n=At("useWindowScroll"),r=At("customScrollParent"),o=r||n?Pt:Ft;return a.createElement(r||n?Gt:Nt,l({},t),a.createElement(o,null,a.createElement(Bt,null)))}),Vt=e.systemToComponent(zt,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},Ot),Mt=Vt.Component,Ut=Vt.usePublisher,At=Vt.useEmitterValue,Wt=Vt.useEmitter,Nt=rt({usePublisher:Ut,useEmitterValue:At,useEmitter:Wt}),Gt=ot({usePublisher:Ut,useEmitterValue:At,useEmitter:Wt});function Dt(e,t,n){return"normal"===t||null!=t&&t.endsWith("px")||n(e+" was not resolved to pixel value correctly",t,exports.LogLevel.WARN),"normal"===t?0:parseInt(null!=t?t:"0",10)}var jt=i.system(function(){var e=i.statefulStream(function(e){return a.createElement("td",null,"Item $",e)}),t=i.statefulStream(null),n=i.statefulStream(null),r=i.statefulStream({}),o=i.statefulStream(De),l=i.statefulStream(i.noop),s=function(e,t){return void 0===t&&(t=null),i.statefulStreamFromEmitter(i.pipe(r,i.map(function(t){return t[e]}),i.distinctUntilChanged()),t)};return{context:t,itemContent:e,fixedHeaderContent:n,components:r,computeItemKey:o,scrollerRef:l,TableComponent:s("Table","table"),TableHeadComponent:s("TableHead","thead"),TableBodyComponent:s("TableBody","tbody"),TableRowComponent:s("TableRow","tr"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),FillerRow:s("FillerRow")}}),_t=i.system(function(e){return l({},e[0],e[1])},i.tup(Me,jt)),Kt=function(e){return a.createElement("tr",null,a.createElement("td",{style:{height:e.height}}))},qt=function(e){return a.createElement("tr",null,a.createElement("td",{style:{height:e.height,padding:0,border:0}}))},Yt=a.memo(function(){var e=tn("listState"),t=en("sizeRanges"),r=tn("useWindowScroll"),o=tn("customScrollParent"),i=en("windowScrollContainerState"),s=en("scrollContainerState"),u=o||r?i:s,c=tn("itemContent"),m=tn("trackItemSizes"),d=S(t,tn("itemSize"),m,u,tn("log"),void 0,o),f=d.callbackRef,p=d.ref,h=a.useState(0),g=h[0],v=h[1];nn("deviation",function(e){g!==e&&(p.current.style.marginTop=e+"px",v(e))});var I=tn("EmptyPlaceholder"),C=tn("ScrollSeekPlaceholder")||Kt,x=tn("FillerRow")||qt,T=tn("TableBodyComponent"),w=tn("TableRowComponent"),b=tn("computeItemKey"),y=tn("isSeeking"),E=tn("paddingTopAddition"),L=tn("firstItemIndex"),H=tn("statefulTotalCount"),R=tn("context");if(0===H&&I)return n.createElement(I,et(I,R));var k=e.offsetTop+E+g,z=e.offsetBottom,B=k>0?a.createElement(x,{height:k,key:"padding-top"}):null,F=z>0?a.createElement(x,{height:z,key:"padding-bottom"}):null,P=e.items.map(function(e){var t=e.originalIndex,r=b(t+L,e.data,R);return y?n.createElement(C,l({},et(C,R),{key:r,index:e.index,height:e.size,type:e.type||"item"})):n.createElement(w,l({},et(w,R),{key:r,"data-index":t,"data-known-size":e.size,"data-item-index":e.index,style:{overflowAnchor:"none"}}),c(e.index,e.data,R))});return n.createElement(T,l({ref:f,"data-test-id":"virtuoso-item-list"},et(T,R)),[B].concat(P,[F]))}),Zt=function(e){var t=e.children,n=en("viewportHeight"),r=v(i.compose(n,function(e){return I(e,"height")}));return a.createElement("div",{style:Qe,ref:r,"data-viewport-type":"element"},t)},Jt=function(e){var t=e.children,n=Ae(en("windowViewportRect"),tn("customScrollParent"));return a.createElement("div",{ref:n,style:Qe,"data-viewport-type":"window"},t)},$t=a.memo(function(e){var t=tn("useWindowScroll"),n=tn("customScrollParent"),r=en("fixedHeaderHeight"),o=tn("fixedHeaderContent"),s=tn("context"),u=v(i.compose(r,function(e){return I(e,"height")})),c=n||t?on:rn,m=n||t?Jt:Zt,d=tn("TableComponent"),f=tn("TableHeadComponent"),p=o?a.createElement(f,l({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:u},et(f,s)),o()):null;return a.createElement(c,l({},e),a.createElement(m,null,a.createElement(d,l({style:{borderSpacing:0}},et(d,s)),[p,a.createElement(Yt,{key:"TableBody"})])))}),Qt=e.systemToComponent(_t,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},$t),Xt=Qt.Component,en=Qt.usePublisher,tn=Qt.useEmitterValue,nn=Qt.useEmitter,rn=rt({usePublisher:en,useEmitterValue:tn,useEmitter:nn}),on=ot({usePublisher:en,useEmitterValue:tn,useEmitter:nn}),an=ct,ln=Xt,sn=Mt;exports.GroupedVirtuoso=ct,exports.TableVirtuoso=ln,exports.Virtuoso=an,exports.VirtuosoGrid=sn; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{systemToComponent as t}from"@virtuoso.dev/react-urx";import*as e from"@virtuoso.dev/urx";import*as n from"react";import{useLayoutEffect as r,useEffect as o,useRef as i,useCallback as a,createElement as l}from"react";import{flushSync as s}from"react-dom";function u(){return u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u.apply(this,arguments)}function c(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)e.indexOf(n=i[r])>=0||(o[n]=t[n]);return o}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[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.")}var f,p,h="undefined"!=typeof document?r:o;!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR"}(p||(p={}));var g=((f={})[p.DEBUG]="debug",f[p.INFO]="log",f[p.WARN]="warn",f[p.ERROR]="error",f),v=e.system(function(){var t=e.statefulStream(p.ERROR);return{log:e.statefulStream(function(n,r,o){var i;void 0===o&&(o=p.INFO),o>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:e.getValue(t))&&console[g[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:t}},[],{singleton:!0});function S(t,e){void 0===e&&(e=!0);var n=i(null),r=function(t){};if("undefined"!=typeof ResizeObserver){var o=new ResizeObserver(function(e){var n=e[0].target;null!==n.offsetParent&&t(n)});r=function(t){t&&e?(o.observe(t),n.current=t):(n.current&&o.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function I(t,e){return void 0===e&&(e=!0),S(t,e).callbackRef}function C(t,e,n,r,o,i,a){return S(function(n){for(var l=function(t,e,n,r){var o=t.length;if(0===o)return null;for(var i=[],a=0;a<o;a++){var l=t.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=e(l,"offsetHeight");if(0===c&&r("Zero-sized element, this should not happen",{child:l},p.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,e,0,o),s=n.parentElement;!s.dataset.virtuosoScroller;)s=s.parentElement;var u="window"===s.firstElementChild.dataset.viewportType,c=a?a.scrollTop:u?window.pageYOffset||document.documentElement.scrollTop:s.scrollTop,m=a?a.scrollHeight:u?document.documentElement.scrollHeight:s.scrollHeight,d=a?a.offsetHeight:u?window.innerHeight:s.offsetHeight;r({scrollTop:Math.max(c,0),scrollHeight:m,viewportHeight:d}),null==i||i(function(t,e,n){return"normal"===e||null!=e&&e.endsWith("px")||n("row-gap was not resolved to pixel value correctly",e,p.WARN),"normal"===e?0:parseInt(null!=e?e:"0",10)}(0,getComputedStyle(n).rowGap,o)),null!==l&&t(l)},n)}function T(t,e){return Math.round(t.getBoundingClientRect()[e])}function w(t,e){return Math.abs(t-e)<1.01}function x(t,n,r,l,u){void 0===l&&(l=e.noop);var c=i(null),m=i(null),d=i(null),f=i(!1),p=a(function(e){var r=e.target,o=r===window||r===document,i=o?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,a=o?document.documentElement.scrollHeight:r.scrollHeight,l=o?window.innerHeight:r.offsetHeight,u=function(){t({scrollTop:Math.max(i,0),scrollHeight:a,viewportHeight:l})};f.current?s(u):u(),f.current=!1,null!==m.current&&(i===m.current||i<=0||i===a-l)&&(m.current=null,n(!0),d.current&&(clearTimeout(d.current),d.current=null))},[t,n]);return o(function(){var t=u||c.current;return l(u||c.current),p({target:t}),t.addEventListener("scroll",p,{passive:!0}),function(){l(null),t.removeEventListener("scroll",p)}},[c,p,r,l,u]),{scrollerRef:c,scrollByCallback:function(t){f.current=!0,c.current.scrollBy(t)},scrollToCallback:function(e){var r=c.current;if(r&&(!("offsetHeight"in r)||0!==r.offsetHeight)){var o,i,a,l="smooth"===e.behavior;if(r===window?(i=Math.max(T(document.documentElement,"height"),document.documentElement.scrollHeight),o=window.innerHeight,a=document.documentElement.scrollTop):(i=r.scrollHeight,o=T(r,"height"),a=r.scrollTop),e.top=Math.ceil(Math.max(Math.min(i-o,e.top),0)),w(o,i)||e.top===a)return t({scrollTop:a,scrollHeight:i,viewportHeight:o}),void(l&&n(!0));l?(m.current=e.top,d.current&&clearTimeout(d.current),d.current=setTimeout(function(){d.current=null,m.current=null,n(!0)},1e3)):m.current=null,r.scrollTo(e)}}}}var b=e.system(function(){var t=e.stream(),n=e.stream(),r=e.statefulStream(0),o=e.stream(),i=e.statefulStream(0),a=e.stream(),l=e.stream(),s=e.statefulStream(0),u=e.statefulStream(0),c=e.statefulStream(0),m=e.stream(),d=e.stream(),f=e.statefulStream(!1),p=e.statefulStream(!1);return e.connect(e.pipe(t,e.map(function(t){return t.scrollTop})),n),e.connect(e.pipe(t,e.map(function(t){return t.scrollHeight})),l),e.connect(n,i),{scrollContainerState:t,scrollTop:n,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,footerHeight:c,scrollHeight:l,smoothScrollTargetReached:o,react18ConcurrentRendering:p,scrollTo:m,scrollBy:d,statefulScrollTop:i,deviation:r,scrollingInProgress:f}},[],{singleton:!0}),y={lvl:0};function E(t,e,n,r,o){return void 0===r&&(r=y),void 0===o&&(o=y),{k:t,v:e,lvl:n,l:r,r:o}}function H(t){return t===y}function R(){return y}function L(t,e){if(H(t))return y;var n=t.k,r=t.l,o=t.r;if(e===n){if(H(r))return o;if(H(o))return r;var i=P(r);return U(M(t,{k:i[0],v:i[1],l:O(r)}))}return U(M(t,e<n?{l:L(r,e)}:{r:L(o,e)}))}function k(t,e,n){if(void 0===n&&(n="k"),H(t))return[-Infinity,void 0];if(t[n]===e)return[t.k,t.v];if(t[n]<e){var r=k(t.r,e,n);return-Infinity===r[0]?[t.k,t.v]:r}return k(t.l,e,n)}function z(t,e,n){return H(t)?E(e,n,1):e===t.k?M(t,{k:e,v:n}):function(t){return N(D(t))}(M(t,e<t.k?{l:z(t.l,e,n)}:{r:z(t.r,e,n)}))}function B(t,e,n){if(H(t))return[];var r=t.k,o=t.v,i=t.r,a=[];return r>e&&(a=a.concat(B(t.l,e,n))),r>=e&&r<=n&&a.push({k:r,v:o}),r<=n&&(a=a.concat(B(i,e,n))),a}function F(t){return H(t)?[]:[].concat(F(t.l),[{k:t.k,v:t.v}],F(t.r))}function P(t){return H(t.r)?[t.k,t.v]:P(t.r)}function O(t){return H(t.r)?t.l:U(M(t,{r:O(t.r)}))}function M(t,e){return E(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function V(t){return H(t)||t.lvl>t.r.lvl}function U(t){var e=t.l,n=t.r,r=t.lvl;if(n.lvl>=r-1&&e.lvl>=r-1)return t;if(r>n.lvl+1){if(V(e))return D(M(t,{lvl:r-1}));if(H(e)||H(e.r))throw new Error("Unexpected empty nodes");return M(e.r,{l:M(e,{r:e.r.l}),r:M(t,{l:e.r.r,lvl:r-1}),lvl:r})}if(V(t))return N(M(t,{lvl:r-1}));if(H(n)||H(n.l))throw new Error("Unexpected empty nodes");var o=n.l,i=V(o)?n.lvl-1:n.lvl;return M(o,{l:M(t,{r:o.l,lvl:r-1}),r:N(M(n,{l:o.r,lvl:i})),lvl:o.lvl+1})}function A(t,e,n){return H(t)?[]:W(B(t,k(t,e)[0],n),function(t){return{index:t.k,value:t.v}})}function W(t,e){var n=t.length;if(0===n)return[];for(var r=e(t[0]),o=r.index,i=r.value,a=[],l=1;l<n;l++){var s=e(t[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 N(t){var e=t.r,n=t.lvl;return H(e)||H(e.r)||e.lvl!==n||e.r.lvl!==n?t:M(e,{l:M(t,{r:e.l}),lvl:n+1})}function D(t){var e=t.l;return H(e)||e.lvl!==t.lvl?t:M(e,{r:M(t,{l:e.r})})}function G(t,e,n,r){void 0===r&&(r=0);for(var o=t.length-1;r<=o;){var i=Math.floor((r+o)/2),a=n(t[i],e);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 - "+t.join(",")+", searched for "+e)}function _(t,e,n){return t[G(t,e,n)]}var j=e.system(function(){return{recalcInProgress:e.statefulStream(!1)}},[],{singleton:!0});function K(t){var e=t.size,n=t.startIndex,r=t.endIndex;return function(t){return t.start===n&&(t.end===r||Infinity===t.end)&&t.value===e}}function Y(t,e){var n=t.index;return e===n?0:e<n?-1:1}function q(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function Z(t){return{index:t.index,value:t}}function J(t,e,n,r){var o=t,i=0,a=0,l=0,s=0;if(0!==e){l=o[s=G(o,e-1,Y)].offset;var u=k(n,e-1);i=u[0],a=u[1],o.length&&o[s].size===k(n,e)[1]&&(s-=1),o=o.slice(0,s+1)}else o=[];for(var c,m=d(A(n,e,Infinity));!(c=m()).done;){var f=c.value,p=f.start,h=f.value,g=p-i,v=g*a+l+g*r;o.push({offset:v,size:h,index:p}),i=p,l=v,a=h}return{offsetTree:o,lastIndex:i,lastOffset:l,lastSize:a}}function $(t,e){var n=e[0],r=e[1],o=e[3];n.length>0&&(0,e[2])("received item sizes",n,p.DEBUG);var i=t.sizeTree,a=i,l=0;if(r.length>0&&H(i)&&2===n.length){var s=n[0].size,u=n[1].size;a=r.reduce(function(t,e){return z(z(t,e,s),e+1,u)},a)}else{var c=function(t,e){for(var n,r=H(t)?0:Infinity,o=d(e);!(n=o()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(r=Math.min(r,l),H(t))t=z(t,0,a);else{var u=A(t,l-1,s+1);if(!u.some(K(i))){for(var c,m=!1,f=!1,p=d(u);!(c=p()).done;){var h=c.value,g=h.start,v=h.end,S=h.value;m?(s>=g||a===S)&&(t=L(t,g)):(f=S!==a,m=!0),v>s&&s>=g&&S!==a&&(t=z(t,s+1,S))}f&&(t=z(t,l,a))}}}return[t,r]}(a,n);a=c[0],l=c[1]}if(a===i)return t;var m=J(t.offsetTree,l,a,o),f=m.offsetTree;return{sizeTree:a,offsetTree:f,lastIndex:m.lastIndex,lastOffset:m.lastOffset,lastSize:m.lastSize,groupOffsetTree:r.reduce(function(t,e){return z(t,e,Q(e,f,o))},R()),groupIndices:r}}function Q(t,e,n){if(0===e.length)return 0;var r=_(e,t,Y),o=t-r.index,i=r.size*o+(o-1)*n+r.offset;return i>0?i+n:i}function X(t,e,n){if(function(t){return void 0!==t.groupIndex}(t))return e.groupIndices[t.groupIndex]+1;var r=tt("LAST"===t.index?n:t.index,e);return Math.max(0,r,Math.min(n,r))}function tt(t,e){if(!et(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function et(t){return!H(t.groupOffsetTree)}var nt={offsetHeight:"height",offsetWidth:"width"},rt=e.system(function(t){var n=t[0].log,r=t[1].recalcInProgress,o=e.stream(),i=e.stream(),a=e.statefulStreamFromEmitter(i,0),l=e.stream(),s=e.stream(),c=e.statefulStream(0),m=e.statefulStream([]),d=e.statefulStream(void 0),f=e.statefulStream(void 0),h=e.statefulStream(function(t,e){return T(t,nt[e])}),g=e.statefulStream(void 0),v=e.statefulStream(0),S={offsetTree:[],sizeTree:R(),groupOffsetTree:R(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},I=e.statefulStreamFromEmitter(e.pipe(o,e.withLatestFrom(m,n,v),e.scan($,S),e.distinctUntilChanged()),S);e.connect(e.pipe(m,e.filter(function(t){return t.length>0}),e.withLatestFrom(I,v),e.map(function(t){var e=t[0],n=t[1],r=t[2],o=e.reduce(function(t,e,o){return z(t,e,Q(e,n.offsetTree,r)||o)},R());return u({},n,{groupIndices:e,groupOffsetTree:o})})),I),e.connect(e.pipe(i,e.withLatestFrom(I),e.filter(function(t){return t[0]<t[1].lastIndex}),e.map(function(t){var e=t[1];return[{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),o),e.connect(d,f);var C=e.statefulStreamFromEmitter(e.pipe(d,e.map(function(t){return void 0===t})),!0);e.connect(e.pipe(f,e.filter(function(t){return void 0!==t&&H(e.getValue(I).sizeTree)}),e.map(function(t){return[{startIndex:0,endIndex:0,size:t}]})),o);var w=e.streamFromEmitter(e.pipe(o,e.withLatestFrom(I),e.scan(function(t,e){var n=e[1];return{changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:S}),e.map(function(t){return t.changed})));e.subscribe(e.pipe(c,e.scan(function(t,e){return{diff:t.prev-e,prev:e}},{diff:0,prev:0}),e.map(function(t){return t.diff})),function(t){t>0?(e.publish(r,!0),e.publish(l,t)):t<0&&e.publish(s,t)}),e.subscribe(e.pipe(c,e.withLatestFrom(n)),function(t){t[0]<0&&(0,t[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},p.ERROR)});var x=e.streamFromEmitter(l);e.connect(e.pipe(l,e.withLatestFrom(I),e.map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return F(n.sizeTree).reduce(function(t,n){var r=n.k,o=n.v;return{ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:r+e-1,size:t.prevSize}]),prevIndex:r+e,prevSize:o}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),o);var b=e.streamFromEmitter(e.pipe(s,e.withLatestFrom(I,v),e.map(function(t){return Q(-t[0],t[1].offsetTree,t[2])})));return e.connect(e.pipe(s,e.withLatestFrom(I,v),e.map(function(t){var e=t[0],n=t[1],r=t[2];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var o=F(n.sizeTree).reduce(function(t,n){var r=n.v;return z(t,Math.max(0,n.k+e),r)},R());return u({},n,{sizeTree:o},J(n.offsetTree,0,o,r))})),I),{data:g,totalCount:i,sizeRanges:o,groupIndices:m,defaultItemSize:f,fixedItemSize:d,unshiftWith:l,shiftWith:s,shiftWithOffset:b,beforeUnshiftWith:x,firstItemIndex:c,gap:v,sizes:I,listRefresh:w,statefulTotalCount:a,trackItemSizes:C,itemSize:h}},e.tup(v,j),{singleton:!0}),ot="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function it(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&ot||(e.behavior="auto"),e.offset||(e.offset=0),e}var at=e.system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.listRefresh,a=n.gap,l=t[1],s=l.scrollingInProgress,u=l.viewportHeight,c=l.scrollTo,m=l.smoothScrollTargetReached,d=l.headerHeight,f=l.footerHeight,h=t[2].log,g=e.stream(),v=e.statefulStream(0),S=null,I=null,C=null;function T(){S&&(S(),S=null),C&&(C(),C=null),I&&(clearTimeout(I),I=null),e.publish(s,!1)}return e.connect(e.pipe(g,e.withLatestFrom(r,u,o,v,d,f,h),e.withLatestFrom(a),e.map(function(t){var n=t[0],r=n[0],o=n[1],a=n[2],l=n[3],u=n[4],c=n[5],d=n[6],f=n[7],h=t[1],v=it(r),w=v.align,x=v.behavior,b=v.offset,y=l-1,E=X(v,o,y),H=Q(E,o.offsetTree,h)+c;"end"===w?(H=H-a+k(o.sizeTree,E)[1],E===y&&(H+=d)):"center"===w?H=H-a/2+k(o.sizeTree,E)[1]/2:H-=u,b&&(H+=b);var R=function(t){T(),t?(f("retrying to scroll to",{location:r},p.DEBUG),e.publish(g,r)):f("list did not change, scroll successful",{},p.DEBUG)};if(T(),"smooth"===x){var L=!1;C=e.subscribe(i,function(t){L=L||t}),S=e.handleNext(m,function(){R(L)})}else S=e.handleNext(e.pipe(i,function(t){var e=setTimeout(function(){t(!1)},150);return function(n){n&&(t(!0),clearTimeout(e))}}),R);return I=setTimeout(function(){T()},1200),e.publish(s,!0),f("scrolling from index to",{index:E,top:H,behavior:x},p.DEBUG),{top:H,behavior:x}})),c),{scrollToIndex:g,topListHeight:v}},e.tup(rt,b,v),{singleton:!0}),lt="up",st={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},ut=e.system(function(t){var n=t[0],r=n.scrollContainerState,o=n.scrollTop,i=n.viewportHeight,a=n.headerHeight,l=n.footerHeight,s=n.scrollBy,u=e.statefulStream(!1),c=e.statefulStream(!0),m=e.stream(),d=e.stream(),f=e.statefulStream(4),p=e.statefulStream(0),h=e.statefulStreamFromEmitter(e.pipe(e.merge(e.pipe(e.duc(o),e.skip(1),e.mapTo(!0)),e.pipe(e.duc(o),e.skip(1),e.mapTo(!1),e.debounceTime(100))),e.distinctUntilChanged()),!1),g=e.statefulStreamFromEmitter(e.pipe(e.merge(e.pipe(s,e.mapTo(!0)),e.pipe(s,e.mapTo(!1),e.debounceTime(200))),e.distinctUntilChanged()),!1);e.connect(e.pipe(e.combineLatest(e.duc(o),e.duc(p)),e.map(function(t){return t[0]<=t[1]}),e.distinctUntilChanged()),c),e.connect(e.pipe(c,e.throttleTime(50)),d);var v=e.streamFromEmitter(e.pipe(e.combineLatest(r,e.duc(i),e.duc(a),e.duc(l),e.duc(f)),e.scan(function(t,e){var n,r,o=e[0],i=o.scrollTop,a=o.scrollHeight,l=e[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-e[4]?(i>t.state.scrollTop?(n="SCROLLED_DOWN",r=t.state.scrollTop-i):(n="SIZE_DECREASED",r=t.state.scrollTop-i||t.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:r}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>t.state.scrollHeight?"SIZE_INCREASED":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},st),e.distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom}))),S=e.statefulStreamFromEmitter(e.pipe(r,e.scan(function(t,e){var n=e.scrollTop,r=e.scrollHeight,o=e.viewportHeight;return w(t.scrollHeight,r)?{scrollTop:n,scrollHeight:r,jump:0,changed:!1}:t.scrollTop!==n&&r-(n+o)<1?{scrollHeight:r,scrollTop:n,jump:t.scrollTop-n,changed:!0}:{scrollHeight:r,scrollTop:n,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),e.filter(function(t){return t.changed}),e.map(function(t){return t.jump})),0);e.connect(e.pipe(v,e.map(function(t){return t.atBottom})),u),e.connect(e.pipe(u,e.throttleTime(50)),m);var I=e.statefulStream("down");e.connect(e.pipe(r,e.map(function(t){return t.scrollTop}),e.distinctUntilChanged(),e.scan(function(t,n){return e.getValue(g)?{direction:t.direction,prevScrollTop:n}:{direction:n<t.prevScrollTop?lt:"down",prevScrollTop:n}},{direction:"down",prevScrollTop:0}),e.map(function(t){return t.direction})),I),e.connect(e.pipe(r,e.throttleTime(50),e.mapTo("none")),I);var C=e.statefulStream(0);return e.connect(e.pipe(h,e.filter(function(t){return!t}),e.mapTo(0)),C),e.connect(e.pipe(o,e.throttleTime(100),e.withLatestFrom(h),e.filter(function(t){return!!t[1]}),e.scan(function(t,e){return[t[1],e[0]]},[0,0]),e.map(function(t){return t[1]-t[0]})),C),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:d,atBottomStateChange:m,scrollDirection:I,atBottomThreshold:f,atTopThreshold:p,scrollVelocity:C,lastJumpDueToItemResize:S}},e.tup(b)),ct=e.system(function(t){var n=t[0].log,r=e.statefulStream(!1),o=e.streamFromEmitter(e.pipe(r,e.filter(function(t){return t}),e.distinctUntilChanged()));return e.subscribe(r,function(t){t&&e.getValue(n)("props updated",{},p.DEBUG)}),{propsReady:r,didMount:o}},e.tup(v),{singleton:!0}),mt=e.system(function(t){var n=t[0],r=n.sizes,o=n.listRefresh,i=n.defaultItemSize,a=t[1].scrollTop,l=t[2].scrollToIndex,s=t[3].didMount,u=e.statefulStream(!0),c=e.statefulStream(0);return e.connect(e.pipe(s,e.withLatestFrom(c),e.filter(function(t){return!!t[1]}),e.mapTo(!1)),u),e.subscribe(e.pipe(e.combineLatest(o,s),e.withLatestFrom(u,r,i),e.filter(function(t){var e=t[1],n=t[3];return t[0][1]&&(!H(t[2].sizeTree)||void 0!==n)&&!e}),e.withLatestFrom(c)),function(t){var n=t[1];setTimeout(function(){e.handleNext(a,function(){e.publish(u,!0)}),e.publish(l,n)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},e.tup(rt,b,at,ct),{singleton:!0});function dt(t){return!!t&&("smooth"===t?"smooth":"auto")}var ft=e.system(function(t){var n=t[0],r=n.totalCount,o=n.listRefresh,i=t[1],a=i.isAtBottom,l=i.atBottomState,s=t[2].scrollToIndex,u=t[3].scrolledToInitialItem,c=t[4],m=c.propsReady,d=c.didMount,f=t[5].log,h=t[6].scrollingInProgress,g=e.statefulStream(!1),v=e.stream(),S=null;function I(t){e.publish(s,{index:"LAST",align:"end",behavior:t})}function C(t){var n=e.handleNext(l,function(n){!t||n.atBottom||"SIZE_INCREASED"!==n.notAtBottomBecause||S||(e.getValue(f)("scrolling to bottom due to increased size",{},p.DEBUG),I("auto"))});setTimeout(n,100)}return e.subscribe(e.pipe(e.combineLatest(e.pipe(e.duc(r),e.skip(1)),d),e.withLatestFrom(e.duc(g),a,u,h),e.map(function(t){var e=t[0],n=e[0],r=e[1]&&t[3],o="auto";return r&&(o=function(t,e){return"function"==typeof t?dt(t(e)):e&&dt(t)}(t[1],t[2]||t[4]),r=r&&!!o),{totalCount:n,shouldFollow:r,followOutputBehavior:o}}),e.filter(function(t){return t.shouldFollow})),function(t){var n=t.totalCount,r=t.followOutputBehavior;S&&(S(),S=null),S=e.handleNext(o,function(){e.getValue(f)("following output to ",{totalCount:n},p.DEBUG),I(r),S=null})}),e.subscribe(e.pipe(e.combineLatest(e.duc(g),r,m),e.filter(function(t){return t[0]&&t[2]}),e.scan(function(t,e){var n=e[1];return{refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),e.filter(function(t){return t.refreshed}),e.withLatestFrom(g,r)),function(t){C(!1!==t[1])}),e.subscribe(v,function(){C(!1!==e.getValue(g))}),e.subscribe(e.combineLatest(e.duc(g),l),function(t){var e=t[1];t[0]&&!e.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===e.notAtBottomBecause&&I("auto")}),{followOutput:g,autoscrollToBottom:v}},e.tup(rt,ut,at,mt,ct,v,b));function pt(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var ht=e.system(function(t){var n=t[0],r=n.totalCount,o=n.groupIndices,i=n.sizes,a=t[1],l=a.scrollTop,s=a.headerHeight,u=e.stream(),c=e.stream(),m=e.streamFromEmitter(e.pipe(u,e.map(pt)));return e.connect(e.pipe(m,e.map(function(t){return t.totalCount})),r),e.connect(e.pipe(m,e.map(function(t){return t.groupIndices})),o),e.connect(e.pipe(e.combineLatest(l,i,s),e.filter(function(t){return et(t[1])}),e.map(function(t){return k(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),e.distinctUntilChanged(),e.map(function(t){return[t]})),c),{groupCounts:u,topItemsIndexes:c}},e.tup(rt,b));function gt(t,e){return!(!t||t[0]!==e[0]||t[1]!==e[1])}function vt(t,e){return!(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}function St(t,e,n){return"number"==typeof t?n===lt&&"top"===e||"down"===n&&"bottom"===e?t:0:n===lt?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse}function It(t,e){return"number"==typeof t?t:t[e]||0}var Ct=e.system(function(t){var n=t[0],r=n.scrollTop,o=n.viewportHeight,i=n.deviation,a=n.headerHeight,l=n.fixedHeaderHeight,s=e.stream(),u=e.statefulStream(0),c=e.statefulStream(0),m=e.statefulStream(0),d=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(e.duc(r),e.duc(o),e.duc(a),e.duc(s,gt),e.duc(m),e.duc(u),e.duc(l),e.duc(i),e.duc(c)),e.map(function(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=o[0],a=o[1],l=t[4],s=t[6],u=t[7],c=t[8],m=e-u,d=t[5]+s,f=Math.max(r-m,0),p="none",h=It(c,"top"),g=It(c,"bottom");return i-=u,a+=r+s,(i+=r+s)>e+d-h&&(p=lt),(a-=u)<e-f+n+g&&(p="down"),"none"!==p?[Math.max(m-r-St(l,"top",p)-h,0),m-f-s+n+St(l,"bottom",p)+g]:null}),e.filter(function(t){return null!=t}),e.distinctUntilChanged(gt)),[0,0]);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:d}},e.tup(b),{singleton:!0}),Tt={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function wt(t,e,n){if(0===t.length)return[];if(!et(e))return t.map(function(t){return u({},t,{index:t.index+n,originalIndex:t.index})});for(var r,o=[],i=A(e.groupOffsetTree,t[0].index,t[t.length-1].index),a=void 0,l=0,s=d(t);!(r=s()).done;){var c=r.value;(!a||a.end<c.index)&&(a=i.shift(),l=e.groupIndices.indexOf(a.start)),o.push(u({},c.index===a.start?{type:"group",index:l}:{index:c.index-(l+1)+n,groupIndex:l},{size:c.size,offset:c.offset,originalIndex:c.index,data:c.data}))}return o}function xt(t,e,n,r,o,i){var a=0,l=0;if(t.length>0){a=t[0].offset;var s=t[t.length-1];l=s.offset+s.size}var u=n-o.lastIndex,c=a,m=o.lastOffset+u*o.lastSize+(u-1)*r-l;return{items:wt(t,o,i),topItems:wt(e,o,i),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:a,offsetBottom:m,top:c,bottom:l,totalCount:n,firstItemIndex:i}}var bt=e.system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.data,a=n.firstItemIndex,l=n.gap,s=t[1],c=t[2],m=c.visibleRange,f=c.listBoundary,p=c.topListHeight,h=t[3],g=h.scrolledToInitialItem,v=h.initialTopMostItemIndex,S=t[4].topListHeight,I=t[5],C=t[6].didMount,T=t[7].recalcInProgress,w=e.statefulStream([]),x=e.stream();e.connect(s.topItemsIndexes,w);var b=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(C,T,e.duc(m,gt),e.duc(o),e.duc(r),e.duc(v),g,e.duc(w),e.duc(a),e.duc(l),i),e.filter(function(t){return t[0]&&!t[1]}),e.map(function(t){var n=t[2],r=n[0],o=n[1],i=t[3],a=t[5],l=t[6],s=t[7],u=t[8],c=t[9],m=t[10],f=t[4],p=f.sizeTree,h=f.offsetTree;if(0===i||0===r&&0===o)return Tt;if(H(p))return xt(function(t,e,n){if(et(e)){var r=tt(t,e);return[{index:k(e.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:t,size:0,offset:0,data:n&&n[0]}]}(function(t,e){return"number"==typeof t?t:"LAST"===t.index?e-1:t.index}(a,i),f,m),[],i,c,f,u);var g=[];if(s.length>0)for(var v,S=s[0],I=s[s.length-1],C=0,T=d(A(p,S,I));!(v=T()).done;)for(var w=v.value,x=w.value,b=Math.max(w.start,S),y=Math.min(w.end,I),E=b;E<=y;E++)g.push({index:E,size:x,offset:C,data:m&&m[E]}),C+=x;if(!l)return xt([],g,i,c,f,u);var R=s.length>0?s[s.length-1]+1:0,L=function(t,e,n,r){return void 0===r&&(r=0),r>0&&(e=Math.max(e,_(t,r,Y).offset)),W((i=n,l=G(o=t,e,a=q),s=G(o,i,a,l),o.slice(l,s+1)),Z);var o,i,a,l,s}(h,r,o,R);if(0===L.length)return null;var z=i-1;return xt(e.tap([],function(t){for(var e,n=d(L);!(e=n()).done;){var i=e.value,a=i.value,l=a.offset,s=i.start,u=a.size;if(a.offset<r){var f=(s+=Math.floor((r-a.offset+c)/(u+c)))-i.start;l+=f*u+f*c}s<R&&(l+=(R-s)*u,s=R);for(var p=Math.min(i.end,z),h=s;h<=p&&!(l>=o);h++)t.push({index:h,size:u,offset:l,data:m&&m[h]}),l+=u+c}}),g,i,c,f,u)}),e.filter(function(t){return null!==t}),e.distinctUntilChanged()),Tt);return e.connect(e.pipe(i,e.filter(function(t){return void 0!==t}),e.map(function(t){return t.length})),o),e.connect(e.pipe(b,e.map(function(t){return t.topListHeight})),S),e.connect(S,p),e.connect(e.pipe(b,e.map(function(t){return[t.top,t.bottom]})),f),e.connect(e.pipe(b,e.map(function(t){return t.items})),x),u({listState:b,topItemsIndexes:w,endReached:e.streamFromEmitter(e.pipe(b,e.filter(function(t){return t.items.length>0}),e.withLatestFrom(o,i),e.filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),e.map(function(t){return[t[1]-1,t[2]]}),e.distinctUntilChanged(gt),e.map(function(t){return t[0]}))),startReached:e.streamFromEmitter(e.pipe(b,e.throttleTime(200),e.filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),e.map(function(t){return t.items[0].index}),e.distinctUntilChanged())),rangeChanged:e.streamFromEmitter(e.pipe(b,e.filter(function(t){return t.items.length>0}),e.map(function(t){for(var e=t.items,n=0,r=e.length-1;"group"===e[n].type&&n<r;)n++;for(;"group"===e[r].type&&r>n;)r--;return{startIndex:e[n].index,endIndex:e[r].index}}),e.distinctUntilChanged(vt))),itemsRendered:x},I)},e.tup(rt,ht,Ct,mt,at,ut,ct,j),{singleton:!0}),yt=e.system(function(t){var n=t[0],r=n.sizes,o=n.firstItemIndex,i=n.data,a=n.gap,l=t[1].listState,s=t[2].didMount,u=e.statefulStream(0);return e.connect(e.pipe(s,e.withLatestFrom(u),e.filter(function(t){return 0!==t[1]}),e.withLatestFrom(r,o,a,i),e.map(function(t){var e=t[0][1],n=t[1],r=t[2],o=t[3],i=t[4],a=void 0===i?[]:i,l=0;if(n.groupIndices.length>0)for(var s,u=d(n.groupIndices);!((s=u()).done||s.value-l>=e);)l++;var c=e+l;return xt(Array.from({length:c}).map(function(t,e){return{index:e,size:0,offset:0,data:a[e]}}),[],c,o,n,r)})),l),{initialItemCount:u}},e.tup(rt,bt,ct),{singleton:!0}),Et=e.system(function(t){var n=t[0].scrollVelocity,r=e.statefulStream(!1),o=e.stream(),i=e.statefulStream(!1);return e.connect(e.pipe(n,e.withLatestFrom(i,r,o),e.filter(function(t){return!!t[1]}),e.map(function(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=n.enter;if(r){if((0,n.exit)(e,o))return!1}else if(i(e,o))return!0;return r}),e.distinctUntilChanged()),r),e.subscribe(e.pipe(e.combineLatest(r,n,o),e.withLatestFrom(i)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:r,scrollSeekConfiguration:i,scrollVelocity:n,scrollSeekRangeChanged:o}},e.tup(ut),{singleton:!0}),Ht=e.system(function(t){var n=t[0].topItemsIndexes,r=e.statefulStream(0);return e.connect(e.pipe(r,e.filter(function(t){return t>0}),e.map(function(t){return Array.from({length:t}).map(function(t,e){return e})})),n),{topItemCount:r}},e.tup(bt)),Rt=e.system(function(t){var n=t[0],r=n.footerHeight,o=n.headerHeight,i=n.fixedHeaderHeight,a=t[1].listState,l=e.stream(),s=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(r,o,i,a),e.map(function(t){var e=t[3];return t[0]+t[1]+t[2]+e.offsetBottom+e.bottom})),0);return e.connect(e.duc(s),l),{totalListHeight:s,totalListHeightChanged:l}},e.tup(b,bt),{singleton:!0});function Lt(t){var e,n=!1;return function(){return n||(n=!0,e=t()),e}}var kt=Lt(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),zt=e.system(function(t){var n=t[0],r=n.scrollBy,o=n.scrollTop,i=n.deviation,a=n.scrollingInProgress,l=t[1],s=l.isScrolling,u=l.isAtBottom,c=l.scrollDirection,m=t[3],d=m.beforeUnshiftWith,f=m.shiftWithOffset,h=m.sizes,g=m.gap,v=t[4].log,S=t[5].recalcInProgress,I=e.streamFromEmitter(e.pipe(t[2].listState,e.withLatestFrom(l.lastJumpDueToItemResize),e.scan(function(t,e){var n=t[1],r=e[0],o=r.items,i=r.totalCount,a=r.bottom+r.offsetBottom,l=0;return t[2]===i&&n.length>0&&o.length>0&&(0===o[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-t[3])&&(l+=e[1])),[l,o,i,a]},[0,[],0,0]),e.filter(function(t){return 0!==t[0]}),e.withLatestFrom(o,c,a,u,v),e.filter(function(t){return!t[3]&&0!==t[1]&&t[2]===lt}),e.map(function(t){var e=t[0][0];return(0,t[5])("Upward scrolling compensation",{amount:e},p.DEBUG),e})));function C(t){t>0?(e.publish(r,{top:-t,behavior:"auto"}),e.publish(i,0)):(e.publish(i,0),e.publish(r,{top:-t,behavior:"auto"}))}return e.subscribe(e.pipe(I,e.withLatestFrom(i,s)),function(t){var n=t[0],r=t[1];t[2]&&kt()?e.publish(i,r-n):C(-n)}),e.subscribe(e.pipe(e.combineLatest(e.statefulStreamFromEmitter(s,!1),i,S),e.filter(function(t){return!t[0]&&!t[2]&&0!==t[1]}),e.map(function(t){return t[1]}),e.throttleTime(1)),C),e.connect(e.pipe(f,e.map(function(t){return{top:-t}})),r),e.subscribe(e.pipe(d,e.withLatestFrom(h,g),e.map(function(t){var e=t[0];return e*t[1].lastSize+e*t[2]})),function(t){e.publish(i,t),requestAnimationFrame(function(){e.publish(r,{top:t}),requestAnimationFrame(function(){e.publish(i,0),e.publish(S,!1)})})}),{deviation:i}},e.tup(b,ut,bt,rt,v,j)),Bt=e.system(function(t){var n=t[0].totalListHeight,r=t[1].didMount,o=t[2].scrollTo,i=e.statefulStream(0);return e.subscribe(e.pipe(r,e.withLatestFrom(i),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{top:t[1]}})),function(t){e.handleNext(e.pipe(n,e.filter(function(t){return 0!==t})),function(){setTimeout(function(){e.publish(o,t)})})}),{initialScrollTop:i}},e.tup(Rt,ct,b),{singleton:!0}),Ft=e.system(function(t){var n=t[0].viewportHeight,r=t[1].totalListHeight,o=e.statefulStream(!1);return{alignToBottom:o,paddingTopAddition:e.statefulStreamFromEmitter(e.pipe(e.combineLatest(o,n,r),e.filter(function(t){return t[0]}),e.map(function(t){return Math.max(0,t[1]-t[2])}),e.distinctUntilChanged()),0)}},e.tup(b,Rt),{singleton:!0}),Pt=e.system(function(t){var n=t[0],r=n.scrollTo,o=n.scrollContainerState,i=e.stream(),a=e.stream(),l=e.stream(),s=e.statefulStream(!1),c=e.statefulStream(void 0);return e.connect(e.pipe(e.combineLatest(i,a),e.map(function(t){var e=t[0],n=e.viewportHeight,r=e.scrollHeight;return{scrollTop:Math.max(0,e.scrollTop-t[1].offsetTop),scrollHeight:r,viewportHeight:n}})),o),e.connect(e.pipe(r,e.withLatestFrom(a),e.map(function(t){var e=t[0];return u({},e,{top:e.top+t[1].offsetTop})})),l),{useWindowScroll:s,customScrollParent:c,windowScrollContainerState:i,windowViewportRect:a,windowScrollTo:l}},e.tup(b)),Ot=["done","behavior","align"],Mt=e.system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.gap,a=t[1],l=a.scrollTop,s=a.viewportHeight,m=a.headerHeight,d=a.scrollingInProgress,f=t[2].scrollToIndex,p=e.stream();return e.connect(e.pipe(p,e.withLatestFrom(r,s,o,m,l,i),e.map(function(t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],l=t[5],s=t[6],m=n.done,f=n.behavior,p=n.align,h=c(n,Ot),g=null,v=X(n,r,i-1),S=Q(v,r.offsetTree,s)+a;return S<l?g=u({},h,{behavior:f,align:null!=p?p:"start"}):S+k(r.sizeTree,v)[1]>l+o&&(g=u({},h,{behavior:f,align:null!=p?p:"end"})),g?m&&e.handleNext(e.pipe(d,e.skip(1),e.filter(function(t){return!1===t})),m):m&&m(),g}),e.filter(function(t){return null!==t})),f),{scrollIntoView:p}},e.tup(rt,b,at,bt,v),{singleton:!0}),Vt=["listState","topItemsIndexes"],Ut=e.system(function(t){return u({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},e.tup(Ct,yt,ct,Et,Rt,Bt,Ft,Pt,Mt)),At=e.system(function(t){var n=t[0],r=n.totalCount,o=n.sizeRanges,i=n.fixedItemSize,a=n.defaultItemSize,l=n.trackItemSizes,s=n.itemSize,m=n.data,d=n.firstItemIndex,f=n.groupIndices,p=n.statefulTotalCount,h=n.gap,g=t[1],v=g.initialTopMostItemIndex,S=g.scrolledToInitialItem,I=t[2],C=t[3],T=t[4],w=T.listState,x=T.topItemsIndexes,b=c(T,Vt),y=t[5].scrollToIndex,E=t[7].topItemCount,H=t[8].groupCounts,R=t[9],L=t[10];return e.connect(b.rangeChanged,R.scrollSeekRangeChanged),e.connect(e.pipe(R.windowViewportRect,e.map(function(t){return t.visibleHeight})),I.viewportHeight),u({totalCount:r,data:m,firstItemIndex:d,sizeRanges:o,initialTopMostItemIndex:v,scrolledToInitialItem:S,topItemsIndexes:x,topItemCount:E,groupCounts:H,fixedItemHeight:i,defaultItemHeight:a,gap:h},C,{statefulTotalCount:p,listState:w,scrollToIndex:y,trackItemSizes:l,itemSize:s,groupIndices:f},b,R,I,L)},e.tup(rt,mt,b,ft,bt,at,zt,Ht,ht,Ut,v)),Wt=Lt(function(){if("undefined"==typeof document)return"sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"});function Nt(t,e){var n=i(null),r=a(function(r){if(null!==r&&r.offsetParent){var o,i,a=r.getBoundingClientRect(),l=a.width;if(e){var s=e.getBoundingClientRect(),u=a.top-s.top;o=s.height-Math.max(0,u),i=u+e.scrollTop}else o=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;n.current={offsetTop:i,visibleHeight:o,visibleWidth:l},t(n.current)}},[t,e]),l=S(r),s=l.callbackRef,u=l.ref,c=a(function(){r(u.current)},[r,u]);return o(function(){if(e){e.addEventListener("scroll",c);var t=new ResizeObserver(c);return t.observe(e),function(){e.removeEventListener("scroll",c),t.unobserve(e)}}return window.addEventListener("scroll",c),window.addEventListener("resize",c),function(){window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[c,e]),s}var Dt=["placeholder"],Gt=["style","children"],_t=["style","children"];function jt(t){return t}var Kt=e.system(function(){var t=e.statefulStream(function(t){return"Item "+t}),n=e.statefulStream(null),r=e.statefulStream(function(t){return"Group "+t}),o=e.statefulStream({}),i=e.statefulStream(jt),a=e.statefulStream("div"),l=e.statefulStream(e.noop),s=function(t,n){return void 0===n&&(n=null),e.statefulStreamFromEmitter(e.pipe(o,e.map(function(e){return e[t]}),e.distinctUntilChanged()),n)};return{context:n,itemContent:t,groupContent:r,components:o,computeItemKey:i,headerFooterTag:a,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function Yt(t,n){var r=e.stream();return e.subscribe(r,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+n,"color: red;","color: inherit;","color: blue;")}),e.connect(r,t),r}var qt=e.system(function(t){var n=t[0],r=t[1],o={item:Yt(r.itemContent,"Rename the %citem%c prop to %citemContent."),group:Yt(r.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Yt(n.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Yt(n.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Yt(n.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:e.stream(),maxHeightCacheSize:e.stream(),footer:e.stream(),header:e.stream(),HeaderContainer:e.stream(),FooterContainer:e.stream(),ItemContainer:e.stream(),ScrollContainer:e.stream(),GroupContainer:e.stream(),ListContainer:e.stream(),emptyComponent:e.stream(),scrollSeek:e.stream()};function i(t,n,o){e.connect(e.pipe(t,e.withLatestFrom(r.components),e.map(function(t){var e,r=t[0],i=t[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),u({},i,((e={})[n]=r,e))})),r.components)}return e.subscribe(o.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;")}),e.subscribe(o.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),e.subscribe(o.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.")}),e.subscribe(o.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.")}),e.subscribe(o.scrollSeek,function(t){var o=t.placeholder,i=c(t,Dt);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),e.publish(r.components,u({},e.getValue(r.components),{ScrollSeekPlaceholder:o})),e.publish(n.scrollSeekConfiguration,i)}),i(o.footer,"Footer","footer"),i(o.header,"Header","header"),i(o.ItemContainer,"Item","ItemContainer"),i(o.ListContainer,"List","ListContainer"),i(o.ScrollContainer,"Scroller","ScrollContainer"),i(o.emptyComponent,"EmptyPlaceholder","emptyComponent"),i(o.GroupContainer,"Group","GroupContainer"),u({},n,r,o)},e.tup(At,Kt)),Zt=function(t){return n.createElement("div",{style:{height:t.height}})},Jt={position:Wt(),zIndex:1,overflowAnchor:"none"},$t={overflowAnchor:"none"},Qt=n.memo(function(t){var r=t.showTopList,o=void 0!==r&&r,i=fe("listState"),a=de("sizeRanges"),s=fe("useWindowScroll"),c=fe("customScrollParent"),m=de("windowScrollContainerState"),d=de("scrollContainerState"),f=c||s?m:d,p=fe("itemContent"),h=fe("context"),g=fe("groupContent"),v=fe("trackItemSizes"),S=fe("itemSize"),I=fe("log"),T=de("gap"),w=C(a,S,v,o?e.noop:f,I,T,c).callbackRef,x=n.useState(0),b=x[0],y=x[1];pe("deviation",function(t){b!==t&&y(t)});var E=fe("EmptyPlaceholder"),H=fe("ScrollSeekPlaceholder")||Zt,R=fe("ListComponent"),L=fe("ItemComponent"),k=fe("GroupComponent"),z=fe("computeItemKey"),B=fe("isSeeking"),F=fe("groupIndices").length>0,P=fe("paddingTopAddition"),O=o?{}:{boxSizing:"border-box",paddingTop:i.offsetTop+P,paddingBottom:i.offsetBottom,marginTop:b};return!o&&0===i.totalCount&&E?l(E,ne(E,h)):l(R,u({},ne(R,h),{ref:w,style:O,"data-test-id":o?"virtuoso-top-item-list":"virtuoso-item-list"}),(o?i.topItems:i.items).map(function(t){var e=t.originalIndex,n=z(e+i.firstItemIndex,t.data,h);return B?l(H,u({},ne(H,h),{key:n,index:t.index,height:t.size,type:t.type||"item"},"group"===t.type?{}:{groupIndex:t.groupIndex})):"group"===t.type?l(k,u({},ne(k,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:Jt}),g(t.index)):l(L,u({},ne(L,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,style:$t}),F?p(t.index,t.groupIndex,t.data,h):p(t.index,t.data,h))}))}),Xt={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},te={width:"100%",height:"100%",position:"absolute",top:0},ee={width:"100%",position:Wt(),top:0};function ne(t,e){if("string"!=typeof t)return{context:e}}var re=n.memo(function(){var t=fe("HeaderComponent"),e=de("headerHeight"),n=fe("headerFooterTag"),r=I(function(t){return e(T(t,"height"))}),o=fe("context");return t?l(n,{ref:r},l(t,ne(t,o))):null}),oe=n.memo(function(){var t=fe("FooterComponent"),e=de("footerHeight"),n=fe("headerFooterTag"),r=I(function(t){return e(T(t,"height"))}),o=fe("context");return t?l(n,{ref:r},l(t,ne(t,o))):null});function ie(t){var e=t.usePublisher,r=t.useEmitter,o=t.useEmitterValue;return n.memo(function(t){var n=t.style,i=t.children,a=c(t,Gt),s=e("scrollContainerState"),m=o("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=o("scrollerRef"),p=o("context"),h=x(s,d,m,f),g=h.scrollerRef,v=h.scrollByCallback;return r("scrollTo",h.scrollToCallback),r("scrollBy",v),l(m,u({ref:g,style:u({},Xt,n),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},a,ne(m,p)),i)})}function ae(t){var r=t.usePublisher,o=t.useEmitter,i=t.useEmitterValue;return n.memo(function(t){var n=t.style,a=t.children,s=c(t,_t),m=r("windowScrollContainerState"),d=i("ScrollerComponent"),f=r("smoothScrollTargetReached"),p=i("totalListHeight"),g=i("deviation"),v=i("customScrollParent"),S=i("context"),I=x(m,f,d,e.noop,v),C=I.scrollerRef,T=I.scrollByCallback,w=I.scrollToCallback;return h(function(){return C.current=v||window,function(){C.current=null}},[C,v]),o("windowScrollTo",w),o("scrollBy",T),l(d,u({style:u({position:"relative"},n,0!==p?{height:p+g}:{}),"data-virtuoso-scroller":!0},s,ne(d,S)),a)})}var le=function(t){var r=t.children,o=de("viewportHeight"),i=I(e.compose(o,function(t){return T(t,"height")}));return n.createElement("div",{style:te,ref:i,"data-viewport-type":"element"},r)},se=function(t){var e=t.children,r=Nt(de("windowViewportRect"),fe("customScrollParent"));return n.createElement("div",{ref:r,style:te,"data-viewport-type":"window"},e)},ue=function(t){var e=t.children,n=fe("TopItemListComponent"),r=fe("headerHeight"),o=u({},ee,{marginTop:r+"px"}),i=fe("context");return l(n||"div",{style:o,context:i},e)},ce=t(qt,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},n.memo(function(t){var e=fe("useWindowScroll"),r=fe("topItemsIndexes").length>0,o=fe("customScrollParent"),i=o||e?se:le;return n.createElement(o||e?ge:he,u({},t),n.createElement(i,null,n.createElement(re,null),n.createElement(Qt,null),n.createElement(oe,null)),r&&n.createElement(ue,null,n.createElement(Qt,{showTopList:!0})))})),me=ce.Component,de=ce.usePublisher,fe=ce.useEmitterValue,pe=ce.useEmitter,he=ie({usePublisher:de,useEmitterValue:fe,useEmitter:pe}),ge=ae({usePublisher:de,useEmitterValue:fe,useEmitter:pe}),ve={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Se={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Ie=Math.round,Ce=Math.ceil,Te=Math.floor,we=Math.min,xe=Math.max;function be(t,e){return Array.from({length:e-t+1}).map(function(e,n){return{index:n+t}})}function ye(t,e){return t&&t.column===e.column&&t.row===e.row}var Ee=e.system(function(t){var n=t[0],r=n.overscan,o=n.visibleRange,i=n.listBoundary,a=t[1],l=a.scrollTop,s=a.viewportHeight,c=a.scrollBy,m=a.scrollTo,d=a.smoothScrollTargetReached,f=a.scrollContainerState,p=t[2],h=t[3],g=t[4],v=g.propsReady,S=g.didMount,I=t[5],C=I.windowViewportRect,T=I.windowScrollTo,w=I.useWindowScroll,x=I.customScrollParent,b=I.windowScrollContainerState,y=t[6],E=e.statefulStream(0),H=e.statefulStream(0),R=e.statefulStream(ve),L=e.statefulStream({height:0,width:0}),k=e.statefulStream({height:0,width:0}),z=e.stream(),B=e.stream(),F=e.statefulStream(0),P=e.statefulStream({row:0,column:0});e.connect(e.pipe(S,e.withLatestFrom(H),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{items:be(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),R),e.connect(e.pipe(e.combineLatest(e.duc(E),o,e.duc(P,ye),e.duc(k,function(t,e){return t&&t.width===e.width&&t.height===e.height})),e.withLatestFrom(L),e.map(function(t){var e=t[0],n=e[0],r=e[1],o=r[0],i=r[1],a=e[2],l=e[3],s=t[1],u=a.row,c=l.height,m=l.width,d=s.width;if(0===n||0===d)return ve;if(0===m)return Se;var f=Le(d,m,a.column),p=f*Te((o+u)/(c+u)),h=f*Ce((i+u)/(c+u))-1;h=xe(0,we(n-1,h));var g=be(p=we(h,xe(0,p)),h),v=He(s,a,l,g),S=v.top,I=v.bottom,C=Ce(n/f);return{items:g,offsetTop:S,offsetBottom:C*c+(C-1)*u-I,top:S,bottom:I,itemHeight:c,itemWidth:m}})),R),e.connect(e.pipe(L,e.map(function(t){return t.height})),s),e.connect(e.pipe(e.combineLatest(L,k,R,P),e.map(function(t){var e=He(t[0],t[3],t[1],t[2].items);return[e.top,e.bottom]}),e.distinctUntilChanged(gt)),i);var O=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){return t.items.length>0}),e.withLatestFrom(E),e.filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),e.map(function(t){return t[1]-1}),e.distinctUntilChanged())),M=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),e.mapTo(0),e.distinctUntilChanged())),V=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){return t.items.length>0}),e.map(function(t){var e=t.items;return{startIndex:e[0].index,endIndex:e[e.length-1].index}}),e.distinctUntilChanged(vt)));e.connect(V,h.scrollSeekRangeChanged),e.connect(e.pipe(z,e.withLatestFrom(L,k,E,P),e.map(function(t){var e=t[1],n=t[2],r=t[3],o=t[4],i=it(t[0]),a=i.align,l=i.behavior,s=i.offset,u=i.index;"LAST"===u&&(u=r-1);var c=Re(e,o,n,u=xe(0,u,we(r-1,u)));return"end"===a?c=Ie(c-e.height+n.height):"center"===a&&(c=Ie(c-e.height/2+n.height/2)),s&&(c+=s),{top:c,behavior:l}})),m);var U=e.statefulStreamFromEmitter(e.pipe(R,e.map(function(t){return t.offsetBottom+t.bottom})),0);return e.connect(e.pipe(C,e.map(function(t){return{width:t.visibleWidth,height:t.visibleHeight}})),L),u({totalCount:E,viewportDimensions:L,itemDimensions:k,scrollTop:l,scrollHeight:B,overscan:r,scrollBy:c,scrollTo:m,scrollToIndex:z,smoothScrollTargetReached:d,windowViewportRect:C,windowScrollTo:T,useWindowScroll:w,customScrollParent:x,windowScrollContainerState:b,deviation:F,scrollContainerState:f,initialItemCount:H,gap:P},h,{gridState:R,totalListHeight:U},p,{startReached:M,endReached:O,rangeChanged:V,propsReady:v},y)},e.tup(Ct,b,ut,Et,ct,Pt,v));function He(t,e,n,r){var o=n.height;return void 0===o||0===r.length?{top:0,bottom:0}:{top:Re(t,e,n,r[0].index),bottom:Re(t,e,n,r[r.length-1].index)+o}}function Re(t,e,n,r){var o=Le(t.width,n.width,e.column),i=Te(r/o),a=i*n.height+xe(0,i-1)*e.row;return a>0?a+e.row:a}function Le(t,e,n){return xe(1,Te((t+n)/(e+n)))}var ke=["placeholder"],ze=e.system(function(){var t=e.statefulStream(function(t){return"Item "+t}),n=e.statefulStream({}),r=e.statefulStream(null),o=e.statefulStream("virtuoso-grid-item"),i=e.statefulStream("virtuoso-grid-list"),a=e.statefulStream(jt),l=e.statefulStream(e.noop),s=function(t,r){return void 0===r&&(r=null),e.statefulStreamFromEmitter(e.pipe(n,e.map(function(e){return e[t]}),e.distinctUntilChanged()),r)};return{context:r,itemContent:t,components:n,computeItemKey:a,itemClassName:o,listClassName:i,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Be=e.system(function(t){var n=t[0],r=t[1],o={item:Yt(r.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:e.stream(),ScrollContainer:e.stream(),ListContainer:e.stream(),emptyComponent:e.stream(),scrollSeek:e.stream()};function i(t,n,o){e.connect(e.pipe(t,e.withLatestFrom(r.components),e.map(function(t){var e,r=t[0],i=t[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),u({},i,((e={})[n]=r,e))})),r.components)}return e.subscribe(o.scrollSeek,function(t){var o=t.placeholder,i=c(t,ke);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),e.publish(r.components,u({},e.getValue(r.components),{ScrollSeekPlaceholder:o})),e.publish(n.scrollSeekConfiguration,i)}),i(o.ItemContainer,"Item","ItemContainer"),i(o.ListContainer,"List","ListContainer"),i(o.ScrollContainer,"Scroller","ScrollContainer"),u({},n,r,o)},e.tup(Ee,ze)),Fe=n.memo(function(){var t=Ae("gridState"),e=Ae("listClassName"),n=Ae("itemClassName"),r=Ae("itemContent"),o=Ae("computeItemKey"),i=Ae("isSeeking"),a=Ue("scrollHeight"),s=Ae("ItemComponent"),c=Ae("ListComponent"),m=Ae("ScrollSeekPlaceholder"),d=Ae("context"),f=Ue("itemDimensions"),p=Ue("gap"),h=Ae("log"),g=I(function(t){a(t.parentElement.parentElement.scrollHeight);var e=t.firstChild;e&&f(e.getBoundingClientRect()),p({row:Ge("row-gap",getComputedStyle(t).rowGap,h),column:Ge("column-gap",getComputedStyle(t).columnGap,h)})});return l(c,u({ref:g,className:e},ne(c,d),{style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}}),t.items.map(function(e){var a=o(e.index);return i?l(m,u({key:a},ne(m,d),{index:e.index,height:t.itemHeight,width:t.itemWidth})):l(s,u({},ne(s,d),{className:n,"data-index":e.index,key:a}),r(e.index,d))}))}),Pe=function(t){var e=t.children,r=Ue("viewportDimensions"),o=I(function(t){r(t.getBoundingClientRect())});return n.createElement("div",{style:te,ref:o},e)},Oe=function(t){var e=t.children,r=Nt(Ue("windowViewportRect"),Ae("customScrollParent"));return n.createElement("div",{ref:r,style:te},e)},Me=t(Be,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},n.memo(function(t){var e=u({},t),r=Ae("useWindowScroll"),o=Ae("customScrollParent"),i=o||r?Oe:Pe;return n.createElement(o||r?De:Ne,u({},e),n.createElement(i,null,n.createElement(Fe,null)))})),Ve=Me.Component,Ue=Me.usePublisher,Ae=Me.useEmitterValue,We=Me.useEmitter,Ne=ie({usePublisher:Ue,useEmitterValue:Ae,useEmitter:We}),De=ae({usePublisher:Ue,useEmitterValue:Ae,useEmitter:We});function Ge(t,e,n){return"normal"===e||null!=e&&e.endsWith("px")||n(t+" was not resolved to pixel value correctly",e,p.WARN),"normal"===e?0:parseInt(null!=e?e:"0",10)}var _e=e.system(function(){var t=e.statefulStream(function(t){return n.createElement("td",null,"Item $",t)}),r=e.statefulStream(null),o=e.statefulStream(null),i=e.statefulStream({}),a=e.statefulStream(jt),l=e.statefulStream(e.noop),s=function(t,n){return void 0===n&&(n=null),e.statefulStreamFromEmitter(e.pipe(i,e.map(function(e){return e[t]}),e.distinctUntilChanged()),n)};return{context:r,itemContent:t,fixedHeaderContent:o,components:i,computeItemKey:a,scrollerRef:l,TableComponent:s("Table","table"),TableHeadComponent:s("TableHead","thead"),TableBodyComponent:s("TableBody","tbody"),TableRowComponent:s("TableRow","tr"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),FillerRow:s("FillerRow")}}),je=e.system(function(t){return u({},t[0],t[1])},e.tup(At,_e)),Ke=function(t){return n.createElement("tr",null,n.createElement("td",{style:{height:t.height}}))},Ye=function(t){return n.createElement("tr",null,n.createElement("td",{style:{height:t.height,padding:0,border:0}}))},qe=n.memo(function(){var t=tn("listState"),e=Xe("sizeRanges"),r=tn("useWindowScroll"),o=tn("customScrollParent"),i=Xe("windowScrollContainerState"),a=Xe("scrollContainerState"),s=o||r?i:a,c=tn("itemContent"),m=tn("trackItemSizes"),d=C(e,tn("itemSize"),m,s,tn("log"),void 0,o),f=d.callbackRef,p=d.ref,h=n.useState(0),g=h[0],v=h[1];en("deviation",function(t){g!==t&&(p.current.style.marginTop=t+"px",v(t))});var S=tn("EmptyPlaceholder"),I=tn("ScrollSeekPlaceholder")||Ke,T=tn("FillerRow")||Ye,w=tn("TableBodyComponent"),x=tn("TableRowComponent"),b=tn("computeItemKey"),y=tn("isSeeking"),E=tn("paddingTopAddition"),H=tn("firstItemIndex"),R=tn("statefulTotalCount"),L=tn("context");if(0===R&&S)return l(S,ne(S,L));var k=t.offsetTop+E+g,z=t.offsetBottom,B=k>0?n.createElement(T,{height:k,key:"padding-top"}):null,F=z>0?n.createElement(T,{height:z,key:"padding-bottom"}):null,P=t.items.map(function(t){var e=t.originalIndex,n=b(e+H,t.data,L);return y?l(I,u({},ne(I,L),{key:n,index:t.index,height:t.size,type:t.type||"item"})):l(x,u({},ne(x,L),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:{overflowAnchor:"none"}}),c(t.index,t.data,L))});return l(w,u({ref:f,"data-test-id":"virtuoso-item-list"},ne(w,L)),[B].concat(P,[F]))}),Ze=function(t){var r=t.children,o=Xe("viewportHeight"),i=I(e.compose(o,function(t){return T(t,"height")}));return n.createElement("div",{style:te,ref:i,"data-viewport-type":"element"},r)},Je=function(t){var e=t.children,r=Nt(Xe("windowViewportRect"),tn("customScrollParent"));return n.createElement("div",{ref:r,style:te,"data-viewport-type":"window"},e)},$e=t(je,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},n.memo(function(t){var r=tn("useWindowScroll"),o=tn("customScrollParent"),i=Xe("fixedHeaderHeight"),a=tn("fixedHeaderContent"),l=tn("context"),s=I(e.compose(i,function(t){return T(t,"height")})),c=o||r?rn:nn,m=o||r?Je:Ze,d=tn("TableComponent"),f=tn("TableHeadComponent"),p=a?n.createElement(f,u({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:s},ne(f,l)),a()):null;return n.createElement(c,u({},t),n.createElement(m,null,n.createElement(d,u({style:{borderSpacing:0}},ne(d,l)),[p,n.createElement(qe,{key:"TableBody"})])))})),Qe=$e.Component,Xe=$e.usePublisher,tn=$e.useEmitterValue,en=$e.useEmitter,nn=ie({usePublisher:Xe,useEmitterValue:tn,useEmitter:en}),rn=ae({usePublisher:Xe,useEmitterValue:tn,useEmitter:en}),on=me,an=me,ln=Qe,sn=Ve;export{an as GroupedVirtuoso,p as LogLevel,ln as TableVirtuoso,on as Virtuoso,sn as VirtuosoGrid}; | ||
import{systemToComponent as t}from"@virtuoso.dev/react-urx";import*as e from"@virtuoso.dev/urx";import*as n from"react";import{useLayoutEffect as r,useEffect as o,useRef as i,useCallback as a,createElement as l}from"react";import{flushSync as s}from"react-dom";function u(){return u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u.apply(this,arguments)}function c(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)e.indexOf(n=i[r])>=0||(o[n]=t[n]);return o}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[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.")}var f,p,h="undefined"!=typeof document?r:o;!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR"}(p||(p={}));var g=((f={})[p.DEBUG]="debug",f[p.INFO]="log",f[p.WARN]="warn",f[p.ERROR]="error",f),v=e.system(function(){var t=e.statefulStream(p.ERROR);return{log:e.statefulStream(function(n,r,o){var i;void 0===o&&(o=p.INFO),o>=(null!=(i=("undefined"==typeof globalThis?window:globalThis).VIRTUOSO_LOG_LEVEL)?i:e.getValue(t))&&console[g[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:t}},[],{singleton:!0});function S(t,e){void 0===e&&(e=!0);var n=i(null),r=function(t){};if("undefined"!=typeof ResizeObserver){var o=new ResizeObserver(function(e){var n=e[0].target;null!==n.offsetParent&&t(n)});r=function(t){t&&e?(o.observe(t),n.current=t):(n.current&&o.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function I(t,e){return void 0===e&&(e=!0),S(t,e).callbackRef}function C(t,e,n,r,o,i,a){return S(function(n){for(var l=function(t,e,n,r){var o=t.length;if(0===o)return null;for(var i=[],a=0;a<o;a++){var l=t.item(a);if(l&&void 0!==l.dataset.index){var s=parseInt(l.dataset.index),u=parseFloat(l.dataset.knownSize),c=e(l,"offsetHeight");if(0===c&&r("Zero-sized element, this should not happen",{child:l},p.ERROR),c!==u){var m=i[i.length-1];0===i.length||m.size!==c||m.endIndex!==s-1?i.push({startIndex:s,endIndex:s,size:c}):i[i.length-1].endIndex++}}}return i}(n.children,e,0,o),s=n.parentElement;!s.dataset.virtuosoScroller;)s=s.parentElement;var u="window"===s.firstElementChild.dataset.viewportType,c=a?a.scrollTop:u?window.pageYOffset||document.documentElement.scrollTop:s.scrollTop,m=a?a.scrollHeight:u?document.documentElement.scrollHeight:s.scrollHeight,d=a?a.offsetHeight:u?window.innerHeight:s.offsetHeight;r({scrollTop:Math.max(c,0),scrollHeight:m,viewportHeight:d}),null==i||i(function(t,e,n){return"normal"===e||null!=e&&e.endsWith("px")||n("row-gap was not resolved to pixel value correctly",e,p.WARN),"normal"===e?0:parseInt(null!=e?e:"0",10)}(0,getComputedStyle(n).rowGap,o)),null!==l&&t(l)},n)}function T(t,e){return Math.round(t.getBoundingClientRect()[e])}function w(t,e){return Math.abs(t-e)<1.01}function x(t,n,r,l,u){void 0===l&&(l=e.noop);var c=i(null),m=i(null),d=i(null),f=i(!1),p=a(function(e){var r=e.target,o=r===window||r===document,i=o?window.pageYOffset||document.documentElement.scrollTop:r.scrollTop,a=o?document.documentElement.scrollHeight:r.scrollHeight,l=o?window.innerHeight:r.offsetHeight,u=function(){t({scrollTop:Math.max(i,0),scrollHeight:a,viewportHeight:l})};f.current?s(u):u(),f.current=!1,null!==m.current&&(i===m.current||i<=0||i===a-l)&&(m.current=null,n(!0),d.current&&(clearTimeout(d.current),d.current=null))},[t,n]);return o(function(){var t=u||c.current;return l(u||c.current),p({target:t}),t.addEventListener("scroll",p,{passive:!0}),function(){l(null),t.removeEventListener("scroll",p)}},[c,p,r,l,u]),{scrollerRef:c,scrollByCallback:function(t){f.current=!0,c.current.scrollBy(t)},scrollToCallback:function(e){var r=c.current;if(r&&(!("offsetHeight"in r)||0!==r.offsetHeight)){var o,i,a,l="smooth"===e.behavior;if(r===window?(i=Math.max(T(document.documentElement,"height"),document.documentElement.scrollHeight),o=window.innerHeight,a=document.documentElement.scrollTop):(i=r.scrollHeight,o=T(r,"height"),a=r.scrollTop),e.top=Math.ceil(Math.max(Math.min(i-o,e.top),0)),w(o,i)||e.top===a)return t({scrollTop:a,scrollHeight:i,viewportHeight:o}),void(l&&n(!0));l?(m.current=e.top,d.current&&clearTimeout(d.current),d.current=setTimeout(function(){d.current=null,m.current=null,n(!0)},1e3)):m.current=null,r.scrollTo(e)}}}}var b=e.system(function(){var t=e.stream(),n=e.stream(),r=e.statefulStream(0),o=e.stream(),i=e.statefulStream(0),a=e.stream(),l=e.stream(),s=e.statefulStream(0),u=e.statefulStream(0),c=e.statefulStream(0),m=e.stream(),d=e.stream(),f=e.statefulStream(!1),p=e.statefulStream(!1);return e.connect(e.pipe(t,e.map(function(t){return t.scrollTop})),n),e.connect(e.pipe(t,e.map(function(t){return t.scrollHeight})),l),e.connect(n,i),{scrollContainerState:t,scrollTop:n,viewportHeight:a,headerHeight:s,fixedHeaderHeight:u,footerHeight:c,scrollHeight:l,smoothScrollTargetReached:o,react18ConcurrentRendering:p,scrollTo:m,scrollBy:d,statefulScrollTop:i,deviation:r,scrollingInProgress:f}},[],{singleton:!0}),y={lvl:0};function E(t,e,n,r,o){return void 0===r&&(r=y),void 0===o&&(o=y),{k:t,v:e,lvl:n,l:r,r:o}}function H(t){return t===y}function R(){return y}function L(t,e){if(H(t))return y;var n=t.k,r=t.l,o=t.r;if(e===n){if(H(r))return o;if(H(o))return r;var i=P(r);return U(M(t,{k:i[0],v:i[1],l:O(r)}))}return U(M(t,e<n?{l:L(r,e)}:{r:L(o,e)}))}function k(t,e,n){if(void 0===n&&(n="k"),H(t))return[-Infinity,void 0];if(t[n]===e)return[t.k,t.v];if(t[n]<e){var r=k(t.r,e,n);return-Infinity===r[0]?[t.k,t.v]:r}return k(t.l,e,n)}function z(t,e,n){return H(t)?E(e,n,1):e===t.k?M(t,{k:e,v:n}):function(t){return N(D(t))}(M(t,e<t.k?{l:z(t.l,e,n)}:{r:z(t.r,e,n)}))}function B(t,e,n){if(H(t))return[];var r=t.k,o=t.v,i=t.r,a=[];return r>e&&(a=a.concat(B(t.l,e,n))),r>=e&&r<=n&&a.push({k:r,v:o}),r<=n&&(a=a.concat(B(i,e,n))),a}function F(t){return H(t)?[]:[].concat(F(t.l),[{k:t.k,v:t.v}],F(t.r))}function P(t){return H(t.r)?[t.k,t.v]:P(t.r)}function O(t){return H(t.r)?t.l:U(M(t,{r:O(t.r)}))}function M(t,e){return E(void 0!==e.k?e.k:t.k,void 0!==e.v?e.v:t.v,void 0!==e.lvl?e.lvl:t.lvl,void 0!==e.l?e.l:t.l,void 0!==e.r?e.r:t.r)}function V(t){return H(t)||t.lvl>t.r.lvl}function U(t){var e=t.l,n=t.r,r=t.lvl;if(n.lvl>=r-1&&e.lvl>=r-1)return t;if(r>n.lvl+1){if(V(e))return D(M(t,{lvl:r-1}));if(H(e)||H(e.r))throw new Error("Unexpected empty nodes");return M(e.r,{l:M(e,{r:e.r.l}),r:M(t,{l:e.r.r,lvl:r-1}),lvl:r})}if(V(t))return N(M(t,{lvl:r-1}));if(H(n)||H(n.l))throw new Error("Unexpected empty nodes");var o=n.l,i=V(o)?n.lvl-1:n.lvl;return M(o,{l:M(t,{r:o.l,lvl:r-1}),r:N(M(n,{l:o.r,lvl:i})),lvl:o.lvl+1})}function A(t,e,n){return H(t)?[]:W(B(t,k(t,e)[0],n),function(t){return{index:t.k,value:t.v}})}function W(t,e){var n=t.length;if(0===n)return[];for(var r=e(t[0]),o=r.index,i=r.value,a=[],l=1;l<n;l++){var s=e(t[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 N(t){var e=t.r,n=t.lvl;return H(e)||H(e.r)||e.lvl!==n||e.r.lvl!==n?t:M(e,{l:M(t,{r:e.l}),lvl:n+1})}function D(t){var e=t.l;return H(e)||e.lvl!==t.lvl?t:M(e,{r:M(t,{l:e.r})})}function G(t,e,n,r){void 0===r&&(r=0);for(var o=t.length-1;r<=o;){var i=Math.floor((r+o)/2),a=n(t[i],e);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 - "+t.join(",")+", searched for "+e)}function _(t,e,n){return t[G(t,e,n)]}var j=e.system(function(){return{recalcInProgress:e.statefulStream(!1)}},[],{singleton:!0});function K(t){var e=t.size,n=t.startIndex,r=t.endIndex;return function(t){return t.start===n&&(t.end===r||Infinity===t.end)&&t.value===e}}function Y(t,e){var n=t.index;return e===n?0:e<n?-1:1}function q(t,e){var n=t.offset;return e===n?0:e<n?-1:1}function Z(t){return{index:t.index,value:t}}function J(t,e,n,r){var o=t,i=0,a=0,l=0,s=0;if(0!==e){l=o[s=G(o,e-1,Y)].offset;var u=k(n,e-1);i=u[0],a=u[1],o.length&&o[s].size===k(n,e)[1]&&(s-=1),o=o.slice(0,s+1)}else o=[];for(var c,m=d(A(n,e,Infinity));!(c=m()).done;){var f=c.value,p=f.start,h=f.value,g=p-i,v=g*a+l+g*r;o.push({offset:v,size:h,index:p}),i=p,l=v,a=h}return{offsetTree:o,lastIndex:i,lastOffset:l,lastSize:a}}function $(t,e){var n=e[0],r=e[1],o=e[3];n.length>0&&(0,e[2])("received item sizes",n,p.DEBUG);var i=t.sizeTree,a=i,l=0;if(r.length>0&&H(i)&&2===n.length){var s=n[0].size,u=n[1].size;a=r.reduce(function(t,e){return z(z(t,e,s),e+1,u)},a)}else{var c=function(t,e){for(var n,r=H(t)?0:Infinity,o=d(e);!(n=o()).done;){var i=n.value,a=i.size,l=i.startIndex,s=i.endIndex;if(r=Math.min(r,l),H(t))t=z(t,0,a);else{var u=A(t,l-1,s+1);if(!u.some(K(i))){for(var c,m=!1,f=!1,p=d(u);!(c=p()).done;){var h=c.value,g=h.start,v=h.end,S=h.value;m?(s>=g||a===S)&&(t=L(t,g)):(f=S!==a,m=!0),v>s&&s>=g&&S!==a&&(t=z(t,s+1,S))}f&&(t=z(t,l,a))}}}return[t,r]}(a,n);a=c[0],l=c[1]}if(a===i)return t;var m=J(t.offsetTree,l,a,o),f=m.offsetTree;return{sizeTree:a,offsetTree:f,lastIndex:m.lastIndex,lastOffset:m.lastOffset,lastSize:m.lastSize,groupOffsetTree:r.reduce(function(t,e){return z(t,e,Q(e,f,o))},R()),groupIndices:r}}function Q(t,e,n){if(0===e.length)return 0;var r=_(e,t,Y),o=t-r.index,i=r.size*o+(o-1)*n+r.offset;return i>0?i+n:i}function X(t,e,n){if(function(t){return void 0!==t.groupIndex}(t))return e.groupIndices[t.groupIndex]+1;var r=tt("LAST"===t.index?n:t.index,e);return Math.max(0,r,Math.min(n,r))}function tt(t,e){if(!et(e))return t;for(var n=0;e.groupIndices[n]<=t+n;)n++;return t+n}function et(t){return!H(t.groupOffsetTree)}var nt={offsetHeight:"height",offsetWidth:"width"},rt=e.system(function(t){var n=t[0].log,r=t[1].recalcInProgress,o=e.stream(),i=e.stream(),a=e.statefulStreamFromEmitter(i,0),l=e.stream(),s=e.stream(),c=e.statefulStream(0),m=e.statefulStream([]),d=e.statefulStream(void 0),f=e.statefulStream(void 0),h=e.statefulStream(function(t,e){return T(t,nt[e])}),g=e.statefulStream(void 0),v=e.statefulStream(0),S={offsetTree:[],sizeTree:R(),groupOffsetTree:R(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]},I=e.statefulStreamFromEmitter(e.pipe(o,e.withLatestFrom(m,n,v),e.scan($,S),e.distinctUntilChanged()),S);e.connect(e.pipe(m,e.filter(function(t){return t.length>0}),e.withLatestFrom(I,v),e.map(function(t){var e=t[0],n=t[1],r=t[2],o=e.reduce(function(t,e,o){return z(t,e,Q(e,n.offsetTree,r)||o)},R());return u({},n,{groupIndices:e,groupOffsetTree:o})})),I),e.connect(e.pipe(i,e.withLatestFrom(I),e.filter(function(t){return t[0]<t[1].lastIndex}),e.map(function(t){var e=t[1];return[{startIndex:t[0],endIndex:e.lastIndex,size:e.lastSize}]})),o),e.connect(d,f);var C=e.statefulStreamFromEmitter(e.pipe(d,e.map(function(t){return void 0===t})),!0);e.connect(e.pipe(f,e.filter(function(t){return void 0!==t&&H(e.getValue(I).sizeTree)}),e.map(function(t){return[{startIndex:0,endIndex:0,size:t}]})),o);var w=e.streamFromEmitter(e.pipe(o,e.withLatestFrom(I),e.scan(function(t,e){var n=e[1];return{changed:n!==t.sizes,sizes:n}},{changed:!1,sizes:S}),e.map(function(t){return t.changed})));e.subscribe(e.pipe(c,e.scan(function(t,e){return{diff:t.prev-e,prev:e}},{diff:0,prev:0}),e.map(function(t){return t.diff})),function(t){t>0?(e.publish(r,!0),e.publish(l,t)):t<0&&e.publish(s,t)}),e.subscribe(e.pipe(c,e.withLatestFrom(n)),function(t){t[0]<0&&(0,t[1])("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},p.ERROR)});var x=e.streamFromEmitter(l);e.connect(e.pipe(l,e.withLatestFrom(I),e.map(function(t){var e=t[0],n=t[1];if(n.groupIndices.length>0)throw new Error("Virtuoso: prepending items does not work with groups");return F(n.sizeTree).reduce(function(t,n){var r=n.k,o=n.v;return{ranges:[].concat(t.ranges,[{startIndex:t.prevIndex,endIndex:r+e-1,size:t.prevSize}]),prevIndex:r+e,prevSize:o}},{ranges:[],prevIndex:0,prevSize:n.lastSize}).ranges})),o);var b=e.streamFromEmitter(e.pipe(s,e.withLatestFrom(I,v),e.map(function(t){return Q(-t[0],t[1].offsetTree,t[2])})));return e.connect(e.pipe(s,e.withLatestFrom(I,v),e.map(function(t){var e=t[0],n=t[1],r=t[2];if(n.groupIndices.length>0)throw new Error("Virtuoso: shifting items does not work with groups");var o=F(n.sizeTree).reduce(function(t,n){var r=n.v;return z(t,Math.max(0,n.k+e),r)},R());return u({},n,{sizeTree:o},J(n.offsetTree,0,o,r))})),I),{data:g,totalCount:i,sizeRanges:o,groupIndices:m,defaultItemSize:f,fixedItemSize:d,unshiftWith:l,shiftWith:s,shiftWithOffset:b,beforeUnshiftWith:x,firstItemIndex:c,gap:v,sizes:I,listRefresh:w,statefulTotalCount:a,trackItemSizes:C,itemSize:h}},e.tup(v,j),{singleton:!0}),ot="undefined"!=typeof document&&"scrollBehavior"in document.documentElement.style;function it(t){var e="number"==typeof t?{index:t}:t;return e.align||(e.align="start"),e.behavior&&ot||(e.behavior="auto"),e.offset||(e.offset=0),e}var at=e.system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.listRefresh,a=n.gap,l=t[1],s=l.scrollingInProgress,u=l.viewportHeight,c=l.scrollTo,m=l.smoothScrollTargetReached,d=l.headerHeight,f=l.footerHeight,h=t[2].log,g=e.stream(),v=e.statefulStream(0),S=null,I=null,C=null;function T(){S&&(S(),S=null),C&&(C(),C=null),I&&(clearTimeout(I),I=null),e.publish(s,!1)}return e.connect(e.pipe(g,e.withLatestFrom(r,u,o,v,d,f,h),e.withLatestFrom(a),e.map(function(t){var n=t[0],r=n[0],o=n[1],a=n[2],l=n[3],u=n[4],c=n[5],d=n[6],f=n[7],h=t[1],v=it(r),w=v.align,x=v.behavior,b=v.offset,y=l-1,E=X(v,o,y),H=Q(E,o.offsetTree,h)+c;"end"===w?(H=H-a+k(o.sizeTree,E)[1],E===y&&(H+=d)):"center"===w?H=H-a/2+k(o.sizeTree,E)[1]/2:H-=u,b&&(H+=b);var R=function(t){T(),t?(f("retrying to scroll to",{location:r},p.DEBUG),e.publish(g,r)):f("list did not change, scroll successful",{},p.DEBUG)};if(T(),"smooth"===x){var L=!1;C=e.subscribe(i,function(t){L=L||t}),S=e.handleNext(m,function(){R(L)})}else S=e.handleNext(e.pipe(i,function(t){var e=setTimeout(function(){t(!1)},150);return function(n){n&&(t(!0),clearTimeout(e))}}),R);return I=setTimeout(function(){T()},1200),e.publish(s,!0),f("scrolling from index to",{index:E,top:H,behavior:x},p.DEBUG),{top:H,behavior:x}})),c),{scrollToIndex:g,topListHeight:v}},e.tup(rt,b,v),{singleton:!0}),lt="up",st={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},ut=e.system(function(t){var n=t[0],r=n.scrollContainerState,o=n.scrollTop,i=n.viewportHeight,a=n.headerHeight,l=n.footerHeight,s=n.scrollBy,u=e.statefulStream(!1),c=e.statefulStream(!0),m=e.stream(),d=e.stream(),f=e.statefulStream(4),p=e.statefulStream(0),h=e.statefulStreamFromEmitter(e.pipe(e.merge(e.pipe(e.duc(o),e.skip(1),e.mapTo(!0)),e.pipe(e.duc(o),e.skip(1),e.mapTo(!1),e.debounceTime(100))),e.distinctUntilChanged()),!1),g=e.statefulStreamFromEmitter(e.pipe(e.merge(e.pipe(s,e.mapTo(!0)),e.pipe(s,e.mapTo(!1),e.debounceTime(200))),e.distinctUntilChanged()),!1);e.connect(e.pipe(e.combineLatest(e.duc(o),e.duc(p)),e.map(function(t){return t[0]<=t[1]}),e.distinctUntilChanged()),c),e.connect(e.pipe(c,e.throttleTime(50)),d);var v=e.streamFromEmitter(e.pipe(e.combineLatest(r,e.duc(i),e.duc(a),e.duc(l),e.duc(f)),e.scan(function(t,e){var n,r,o=e[0],i=o.scrollTop,a=o.scrollHeight,l=e[1],s={viewportHeight:l,scrollTop:i,scrollHeight:a};return i+l-a>-e[4]?(i>t.state.scrollTop?(n="SCROLLED_DOWN",r=t.state.scrollTop-i):(n="SIZE_DECREASED",r=t.state.scrollTop-i||t.scrollTopDelta),{atBottom:!0,state:s,atBottomBecause:n,scrollTopDelta:r}):{atBottom:!1,notAtBottomBecause:s.scrollHeight>t.state.scrollHeight?"SIZE_INCREASED":l<t.state.viewportHeight?"VIEWPORT_HEIGHT_DECREASING":i<t.state.scrollTop?"SCROLLING_UPWARDS":"NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",state:s}},st),e.distinctUntilChanged(function(t,e){return t&&t.atBottom===e.atBottom}))),S=e.statefulStreamFromEmitter(e.pipe(r,e.scan(function(t,e){var n=e.scrollTop,r=e.scrollHeight,o=e.viewportHeight;return w(t.scrollHeight,r)?{scrollTop:n,scrollHeight:r,jump:0,changed:!1}:t.scrollTop!==n&&r-(n+o)<1?{scrollHeight:r,scrollTop:n,jump:t.scrollTop-n,changed:!0}:{scrollHeight:r,scrollTop:n,jump:0,changed:!0}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),e.filter(function(t){return t.changed}),e.map(function(t){return t.jump})),0);e.connect(e.pipe(v,e.map(function(t){return t.atBottom})),u),e.connect(e.pipe(u,e.throttleTime(50)),m);var I=e.statefulStream("down");e.connect(e.pipe(r,e.map(function(t){return t.scrollTop}),e.distinctUntilChanged(),e.scan(function(t,n){return e.getValue(g)?{direction:t.direction,prevScrollTop:n}:{direction:n<t.prevScrollTop?lt:"down",prevScrollTop:n}},{direction:"down",prevScrollTop:0}),e.map(function(t){return t.direction})),I),e.connect(e.pipe(r,e.throttleTime(50),e.mapTo("none")),I);var C=e.statefulStream(0);return e.connect(e.pipe(h,e.filter(function(t){return!t}),e.mapTo(0)),C),e.connect(e.pipe(o,e.throttleTime(100),e.withLatestFrom(h),e.filter(function(t){return!!t[1]}),e.scan(function(t,e){return[t[1],e[0]]},[0,0]),e.map(function(t){return t[1]-t[0]})),C),{isScrolling:h,isAtTop:c,isAtBottom:u,atBottomState:v,atTopStateChange:d,atBottomStateChange:m,scrollDirection:I,atBottomThreshold:f,atTopThreshold:p,scrollVelocity:C,lastJumpDueToItemResize:S}},e.tup(b)),ct=e.system(function(t){var n=t[0].log,r=e.statefulStream(!1),o=e.streamFromEmitter(e.pipe(r,e.filter(function(t){return t}),e.distinctUntilChanged()));return e.subscribe(r,function(t){t&&e.getValue(n)("props updated",{},p.DEBUG)}),{propsReady:r,didMount:o}},e.tup(v),{singleton:!0}),mt=e.system(function(t){var n=t[0],r=n.sizes,o=n.listRefresh,i=n.defaultItemSize,a=t[1].scrollTop,l=t[2].scrollToIndex,s=t[3].didMount,u=e.statefulStream(!0),c=e.statefulStream(0);return e.connect(e.pipe(s,e.withLatestFrom(c),e.filter(function(t){return!!t[1]}),e.mapTo(!1)),u),e.subscribe(e.pipe(e.combineLatest(o,s),e.withLatestFrom(u,r,i),e.filter(function(t){var e=t[1],n=t[3];return t[0][1]&&(!H(t[2].sizeTree)||void 0!==n)&&!e}),e.withLatestFrom(c)),function(t){var n=t[1];setTimeout(function(){e.handleNext(a,function(){e.publish(u,!0)}),e.publish(l,n)})}),{scrolledToInitialItem:u,initialTopMostItemIndex:c}},e.tup(rt,b,at,ct),{singleton:!0});function dt(t){return!!t&&("smooth"===t?"smooth":"auto")}var ft=e.system(function(t){var n=t[0],r=n.totalCount,o=n.listRefresh,i=t[1],a=i.isAtBottom,l=i.atBottomState,s=t[2].scrollToIndex,u=t[3].scrolledToInitialItem,c=t[4],m=c.propsReady,d=c.didMount,f=t[5].log,h=t[6].scrollingInProgress,g=e.statefulStream(!1),v=e.stream(),S=null;function I(t){e.publish(s,{index:"LAST",align:"end",behavior:t})}function C(t){var n=e.handleNext(l,function(n){!t||n.atBottom||"SIZE_INCREASED"!==n.notAtBottomBecause||S||(e.getValue(f)("scrolling to bottom due to increased size",{},p.DEBUG),I("auto"))});setTimeout(n,100)}return e.subscribe(e.pipe(e.combineLatest(e.pipe(e.duc(r),e.skip(1)),d),e.withLatestFrom(e.duc(g),a,u,h),e.map(function(t){var e=t[0],n=e[0],r=e[1]&&t[3],o="auto";return r&&(o=function(t,e){return"function"==typeof t?dt(t(e)):e&&dt(t)}(t[1],t[2]||t[4]),r=r&&!!o),{totalCount:n,shouldFollow:r,followOutputBehavior:o}}),e.filter(function(t){return t.shouldFollow})),function(t){var n=t.totalCount,r=t.followOutputBehavior;S&&(S(),S=null),S=e.handleNext(o,function(){e.getValue(f)("following output to ",{totalCount:n},p.DEBUG),I(r),S=null})}),e.subscribe(e.pipe(e.combineLatest(e.duc(g),r,m),e.filter(function(t){return t[0]&&t[2]}),e.scan(function(t,e){var n=e[1];return{refreshed:t.value===n,value:n}},{refreshed:!1,value:0}),e.filter(function(t){return t.refreshed}),e.withLatestFrom(g,r)),function(t){C(!1!==t[1])}),e.subscribe(v,function(){C(!1!==e.getValue(g))}),e.subscribe(e.combineLatest(e.duc(g),l),function(t){var e=t[1];t[0]&&!e.atBottom&&"VIEWPORT_HEIGHT_DECREASING"===e.notAtBottomBecause&&I("auto")}),{followOutput:g,autoscrollToBottom:v}},e.tup(rt,ut,at,mt,ct,v,b));function pt(t){return t.reduce(function(t,e){return t.groupIndices.push(t.totalCount),t.totalCount+=e+1,t},{totalCount:0,groupIndices:[]})}var ht=e.system(function(t){var n=t[0],r=n.totalCount,o=n.groupIndices,i=n.sizes,a=t[1],l=a.scrollTop,s=a.headerHeight,u=e.stream(),c=e.stream(),m=e.streamFromEmitter(e.pipe(u,e.map(pt)));return e.connect(e.pipe(m,e.map(function(t){return t.totalCount})),r),e.connect(e.pipe(m,e.map(function(t){return t.groupIndices})),o),e.connect(e.pipe(e.combineLatest(l,i,s),e.filter(function(t){return et(t[1])}),e.map(function(t){return k(t[1].groupOffsetTree,Math.max(t[0]-t[2],0),"v")[0]}),e.distinctUntilChanged(),e.map(function(t){return[t]})),c),{groupCounts:u,topItemsIndexes:c}},e.tup(rt,b));function gt(t,e){return!(!t||t[0]!==e[0]||t[1]!==e[1])}function vt(t,e){return!(!t||t.startIndex!==e.startIndex||t.endIndex!==e.endIndex)}function St(t,e,n){return"number"==typeof t?n===lt&&"top"===e||"down"===n&&"bottom"===e?t:0:n===lt?"top"===e?t.main:t.reverse:"bottom"===e?t.main:t.reverse}function It(t,e){return"number"==typeof t?t:t[e]||0}var Ct=e.system(function(t){var n=t[0],r=n.scrollTop,o=n.viewportHeight,i=n.deviation,a=n.headerHeight,l=n.fixedHeaderHeight,s=e.stream(),u=e.statefulStream(0),c=e.statefulStream(0),m=e.statefulStream(0),d=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(e.duc(r),e.duc(o),e.duc(a),e.duc(s,gt),e.duc(m),e.duc(u),e.duc(l),e.duc(i),e.duc(c)),e.map(function(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=o[0],a=o[1],l=t[4],s=t[6],u=t[7],c=t[8],m=e-u,d=t[5]+s,f=Math.max(r-m,0),p="none",h=It(c,"top"),g=It(c,"bottom");return i-=u,a+=r+s,(i+=r+s)>e+d-h&&(p=lt),(a-=u)<e-f+n+g&&(p="down"),"none"!==p?[Math.max(m-r-St(l,"top",p)-h,0),m-f-s+n+St(l,"bottom",p)+g]:null}),e.filter(function(t){return null!=t}),e.distinctUntilChanged(gt)),[0,0]);return{listBoundary:s,overscan:m,topListHeight:u,increaseViewportBy:c,visibleRange:d}},e.tup(b),{singleton:!0}),Tt={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function wt(t,e,n){if(0===t.length)return[];if(!et(e))return t.map(function(t){return u({},t,{index:t.index+n,originalIndex:t.index})});for(var r,o=[],i=A(e.groupOffsetTree,t[0].index,t[t.length-1].index),a=void 0,l=0,s=d(t);!(r=s()).done;){var c=r.value;(!a||a.end<c.index)&&(a=i.shift(),l=e.groupIndices.indexOf(a.start)),o.push(u({},c.index===a.start?{type:"group",index:l}:{index:c.index-(l+1)+n,groupIndex:l},{size:c.size,offset:c.offset,originalIndex:c.index,data:c.data}))}return o}function xt(t,e,n,r,o,i){var a=0,l=0;if(t.length>0){a=t[0].offset;var s=t[t.length-1];l=s.offset+s.size}var u=n-o.lastIndex,c=a,m=o.lastOffset+u*o.lastSize+(u-1)*r-l;return{items:wt(t,o,i),topItems:wt(e,o,i),topListHeight:e.reduce(function(t,e){return e.size+t},0),offsetTop:a,offsetBottom:m,top:c,bottom:l,totalCount:n,firstItemIndex:i}}var bt=e.system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.data,a=n.firstItemIndex,l=n.gap,s=t[1],c=t[2],m=c.visibleRange,f=c.listBoundary,p=c.topListHeight,h=t[3],g=h.scrolledToInitialItem,v=h.initialTopMostItemIndex,S=t[4].topListHeight,I=t[5],C=t[6].didMount,T=t[7].recalcInProgress,w=e.statefulStream([]),x=e.stream();e.connect(s.topItemsIndexes,w);var b=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(C,T,e.duc(m,gt),e.duc(o),e.duc(r),e.duc(v),g,e.duc(w),e.duc(a),e.duc(l),i),e.filter(function(t){return t[0]&&!t[1]}),e.map(function(t){var n=t[2],r=n[0],o=n[1],i=t[3],a=t[5],l=t[6],s=t[7],c=t[8],m=t[9],f=t[10],p=t[4],h=p.sizeTree,g=p.offsetTree;if(0===i||0===r&&0===o)return u({},Tt,{totalCount:i});if(H(h))return xt(function(t,e,n){if(et(e)){var r=tt(t,e);return[{index:k(e.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:t,size:0,offset:0,data:n&&n[0]}]}(function(t,e){return"number"==typeof t?t:"LAST"===t.index?e-1:t.index}(a,i),p,f),[],i,m,p,c);var v=[];if(s.length>0)for(var S,I=s[0],C=s[s.length-1],T=0,w=d(A(h,I,C));!(S=w()).done;)for(var x=S.value,b=x.value,y=Math.max(x.start,I),E=Math.min(x.end,C),R=y;R<=E;R++)v.push({index:R,size:b,offset:T,data:f&&f[R]}),T+=b;if(!l)return xt([],v,i,m,p,c);var L=s.length>0?s[s.length-1]+1:0,z=function(t,e,n,r){return void 0===r&&(r=0),r>0&&(e=Math.max(e,_(t,r,Y).offset)),W((i=n,l=G(o=t,e,a=q),s=G(o,i,a,l),o.slice(l,s+1)),Z);var o,i,a,l,s}(g,r,o,L);if(0===z.length)return null;var B=i-1;return xt(e.tap([],function(t){for(var e,n=d(z);!(e=n()).done;){var i=e.value,a=i.value,l=a.offset,s=i.start,u=a.size;if(a.offset<r){var c=(s+=Math.floor((r-a.offset+m)/(u+m)))-i.start;l+=c*u+c*m}s<L&&(l+=(L-s)*u,s=L);for(var p=Math.min(i.end,B),h=s;h<=p&&!(l>=o);h++)t.push({index:h,size:u,offset:l,data:f&&f[h]}),l+=u+m}}),v,i,m,p,c)}),e.filter(function(t){return null!==t}),e.distinctUntilChanged()),Tt);return e.connect(e.pipe(i,e.filter(function(t){return void 0!==t}),e.map(function(t){return t.length})),o),e.connect(e.pipe(b,e.map(function(t){return t.topListHeight})),S),e.connect(S,p),e.connect(e.pipe(b,e.map(function(t){return[t.top,t.bottom]})),f),e.connect(e.pipe(b,e.map(function(t){return t.items})),x),u({listState:b,topItemsIndexes:w,endReached:e.streamFromEmitter(e.pipe(b,e.filter(function(t){return t.items.length>0}),e.withLatestFrom(o,i),e.filter(function(t){var e=t[0].items;return e[e.length-1].originalIndex===t[1]-1}),e.map(function(t){return[t[1]-1,t[2]]}),e.distinctUntilChanged(gt),e.map(function(t){return t[0]}))),startReached:e.streamFromEmitter(e.pipe(b,e.throttleTime(200),e.filter(function(t){var e=t.items;return e.length>0&&e[0].originalIndex===t.topItems.length}),e.map(function(t){return t.items[0].index}),e.distinctUntilChanged())),rangeChanged:e.streamFromEmitter(e.pipe(b,e.filter(function(t){return t.items.length>0}),e.map(function(t){for(var e=t.items,n=0,r=e.length-1;"group"===e[n].type&&n<r;)n++;for(;"group"===e[r].type&&r>n;)r--;return{startIndex:e[n].index,endIndex:e[r].index}}),e.distinctUntilChanged(vt))),itemsRendered:x},I)},e.tup(rt,ht,Ct,mt,at,ut,ct,j),{singleton:!0}),yt=e.system(function(t){var n=t[0],r=n.sizes,o=n.firstItemIndex,i=n.data,a=n.gap,l=t[1].listState,s=t[2].didMount,u=e.statefulStream(0);return e.connect(e.pipe(s,e.withLatestFrom(u),e.filter(function(t){return 0!==t[1]}),e.withLatestFrom(r,o,a,i),e.map(function(t){var e=t[0][1],n=t[1],r=t[2],o=t[3],i=t[4],a=void 0===i?[]:i,l=0;if(n.groupIndices.length>0)for(var s,u=d(n.groupIndices);!((s=u()).done||s.value-l>=e);)l++;var c=e+l;return xt(Array.from({length:c}).map(function(t,e){return{index:e,size:0,offset:0,data:a[e]}}),[],c,o,n,r)})),l),{initialItemCount:u}},e.tup(rt,bt,ct),{singleton:!0}),Et=e.system(function(t){var n=t[0].scrollVelocity,r=e.statefulStream(!1),o=e.stream(),i=e.statefulStream(!1);return e.connect(e.pipe(n,e.withLatestFrom(i,r,o),e.filter(function(t){return!!t[1]}),e.map(function(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=n.enter;if(r){if((0,n.exit)(e,o))return!1}else if(i(e,o))return!0;return r}),e.distinctUntilChanged()),r),e.subscribe(e.pipe(e.combineLatest(r,n,o),e.withLatestFrom(i)),function(t){var e=t[0],n=t[1];return e[0]&&n&&n.change&&n.change(e[1],e[2])}),{isSeeking:r,scrollSeekConfiguration:i,scrollVelocity:n,scrollSeekRangeChanged:o}},e.tup(ut),{singleton:!0}),Ht=e.system(function(t){var n=t[0].topItemsIndexes,r=e.statefulStream(0);return e.connect(e.pipe(r,e.filter(function(t){return t>0}),e.map(function(t){return Array.from({length:t}).map(function(t,e){return e})})),n),{topItemCount:r}},e.tup(bt)),Rt=e.system(function(t){var n=t[0],r=n.footerHeight,o=n.headerHeight,i=n.fixedHeaderHeight,a=t[1].listState,l=e.stream(),s=e.statefulStreamFromEmitter(e.pipe(e.combineLatest(r,o,i,a),e.map(function(t){var e=t[3];return t[0]+t[1]+t[2]+e.offsetBottom+e.bottom})),0);return e.connect(e.duc(s),l),{totalListHeight:s,totalListHeightChanged:l}},e.tup(b,bt),{singleton:!0});function Lt(t){var e,n=!1;return function(){return n||(n=!0,e=t()),e}}var kt=Lt(function(){return/iP(ad|hone|od).+Version\/[\d.]+.*Safari/i.test(navigator.userAgent)}),zt=e.system(function(t){var n=t[0],r=n.scrollBy,o=n.scrollTop,i=n.deviation,a=n.scrollingInProgress,l=t[1],s=l.isScrolling,u=l.isAtBottom,c=l.scrollDirection,m=t[3],d=m.beforeUnshiftWith,f=m.shiftWithOffset,h=m.sizes,g=m.gap,v=t[4].log,S=t[5].recalcInProgress,I=e.streamFromEmitter(e.pipe(t[2].listState,e.withLatestFrom(l.lastJumpDueToItemResize),e.scan(function(t,e){var n=t[1],r=e[0],o=r.items,i=r.totalCount,a=r.bottom+r.offsetBottom,l=0;return t[2]===i&&n.length>0&&o.length>0&&(0===o[0].originalIndex&&0===n[0].originalIndex||0!=(l=a-t[3])&&(l+=e[1])),[l,o,i,a]},[0,[],0,0]),e.filter(function(t){return 0!==t[0]}),e.withLatestFrom(o,c,a,u,v),e.filter(function(t){return!t[3]&&0!==t[1]&&t[2]===lt}),e.map(function(t){var e=t[0][0];return(0,t[5])("Upward scrolling compensation",{amount:e},p.DEBUG),e})));function C(t){t>0?(e.publish(r,{top:-t,behavior:"auto"}),e.publish(i,0)):(e.publish(i,0),e.publish(r,{top:-t,behavior:"auto"}))}return e.subscribe(e.pipe(I,e.withLatestFrom(i,s)),function(t){var n=t[0],r=t[1];t[2]&&kt()?e.publish(i,r-n):C(-n)}),e.subscribe(e.pipe(e.combineLatest(e.statefulStreamFromEmitter(s,!1),i,S),e.filter(function(t){return!t[0]&&!t[2]&&0!==t[1]}),e.map(function(t){return t[1]}),e.throttleTime(1)),C),e.connect(e.pipe(f,e.map(function(t){return{top:-t}})),r),e.subscribe(e.pipe(d,e.withLatestFrom(h,g),e.map(function(t){var e=t[0];return e*t[1].lastSize+e*t[2]})),function(t){e.publish(i,t),requestAnimationFrame(function(){e.publish(r,{top:t}),requestAnimationFrame(function(){e.publish(i,0),e.publish(S,!1)})})}),{deviation:i}},e.tup(b,ut,bt,rt,v,j)),Bt=e.system(function(t){var n=t[0].totalListHeight,r=t[1].didMount,o=t[2].scrollTo,i=e.statefulStream(0);return e.subscribe(e.pipe(r,e.withLatestFrom(i),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{top:t[1]}})),function(t){e.handleNext(e.pipe(n,e.filter(function(t){return 0!==t})),function(){setTimeout(function(){e.publish(o,t)})})}),{initialScrollTop:i}},e.tup(Rt,ct,b),{singleton:!0}),Ft=e.system(function(t){var n=t[0].viewportHeight,r=t[1].totalListHeight,o=e.statefulStream(!1);return{alignToBottom:o,paddingTopAddition:e.statefulStreamFromEmitter(e.pipe(e.combineLatest(o,n,r),e.filter(function(t){return t[0]}),e.map(function(t){return Math.max(0,t[1]-t[2])}),e.distinctUntilChanged()),0)}},e.tup(b,Rt),{singleton:!0}),Pt=e.system(function(t){var n=t[0],r=n.scrollTo,o=n.scrollContainerState,i=e.stream(),a=e.stream(),l=e.stream(),s=e.statefulStream(!1),c=e.statefulStream(void 0);return e.connect(e.pipe(e.combineLatest(i,a),e.map(function(t){var e=t[0],n=e.viewportHeight,r=e.scrollHeight;return{scrollTop:Math.max(0,e.scrollTop-t[1].offsetTop),scrollHeight:r,viewportHeight:n}})),o),e.connect(e.pipe(r,e.withLatestFrom(a),e.map(function(t){var e=t[0];return u({},e,{top:e.top+t[1].offsetTop})})),l),{useWindowScroll:s,customScrollParent:c,windowScrollContainerState:i,windowViewportRect:a,windowScrollTo:l}},e.tup(b)),Ot=["done","behavior","align"],Mt=e.system(function(t){var n=t[0],r=n.sizes,o=n.totalCount,i=n.gap,a=t[1],l=a.scrollTop,s=a.viewportHeight,m=a.headerHeight,d=a.scrollingInProgress,f=t[2].scrollToIndex,p=e.stream();return e.connect(e.pipe(p,e.withLatestFrom(r,s,o,m,l,i),e.map(function(t){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],l=t[5],s=t[6],m=n.done,f=n.behavior,p=n.align,h=c(n,Ot),g=null,v=X(n,r,i-1),S=Q(v,r.offsetTree,s)+a;return S<l?g=u({},h,{behavior:f,align:null!=p?p:"start"}):S+k(r.sizeTree,v)[1]>l+o&&(g=u({},h,{behavior:f,align:null!=p?p:"end"})),g?m&&e.handleNext(e.pipe(d,e.skip(1),e.filter(function(t){return!1===t})),m):m&&m(),g}),e.filter(function(t){return null!==t})),f),{scrollIntoView:p}},e.tup(rt,b,at,bt,v),{singleton:!0}),Vt=["listState","topItemsIndexes"],Ut=e.system(function(t){return u({},t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},e.tup(Ct,yt,ct,Et,Rt,Bt,Ft,Pt,Mt)),At=e.system(function(t){var n=t[0],r=n.totalCount,o=n.sizeRanges,i=n.fixedItemSize,a=n.defaultItemSize,l=n.trackItemSizes,s=n.itemSize,m=n.data,d=n.firstItemIndex,f=n.groupIndices,p=n.statefulTotalCount,h=n.gap,g=t[1],v=g.initialTopMostItemIndex,S=g.scrolledToInitialItem,I=t[2],C=t[3],T=t[4],w=T.listState,x=T.topItemsIndexes,b=c(T,Vt),y=t[5].scrollToIndex,E=t[7].topItemCount,H=t[8].groupCounts,R=t[9],L=t[10];return e.connect(b.rangeChanged,R.scrollSeekRangeChanged),e.connect(e.pipe(R.windowViewportRect,e.map(function(t){return t.visibleHeight})),I.viewportHeight),u({totalCount:r,data:m,firstItemIndex:d,sizeRanges:o,initialTopMostItemIndex:v,scrolledToInitialItem:S,topItemsIndexes:x,topItemCount:E,groupCounts:H,fixedItemHeight:i,defaultItemHeight:a,gap:h},C,{statefulTotalCount:p,listState:w,scrollToIndex:y,trackItemSizes:l,itemSize:s,groupIndices:f},b,R,I,L)},e.tup(rt,mt,b,ft,bt,at,zt,Ht,ht,Ut,v)),Wt=Lt(function(){if("undefined"==typeof document)return"sticky";var t=document.createElement("div");return t.style.position="-webkit-sticky","-webkit-sticky"===t.style.position?"-webkit-sticky":"sticky"});function Nt(t,e){var n=i(null),r=a(function(r){if(null!==r&&r.offsetParent){var o,i,a=r.getBoundingClientRect(),l=a.width;if(e){var s=e.getBoundingClientRect(),u=a.top-s.top;o=s.height-Math.max(0,u),i=u+e.scrollTop}else o=window.innerHeight-Math.max(0,a.top),i=a.top+window.pageYOffset;n.current={offsetTop:i,visibleHeight:o,visibleWidth:l},t(n.current)}},[t,e]),l=S(r),s=l.callbackRef,u=l.ref,c=a(function(){r(u.current)},[r,u]);return o(function(){if(e){e.addEventListener("scroll",c);var t=new ResizeObserver(c);return t.observe(e),function(){e.removeEventListener("scroll",c),t.unobserve(e)}}return window.addEventListener("scroll",c),window.addEventListener("resize",c),function(){window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[c,e]),s}var Dt=["placeholder"],Gt=["style","children"],_t=["style","children"];function jt(t){return t}var Kt=e.system(function(){var t=e.statefulStream(function(t){return"Item "+t}),n=e.statefulStream(null),r=e.statefulStream(function(t){return"Group "+t}),o=e.statefulStream({}),i=e.statefulStream(jt),a=e.statefulStream("div"),l=e.statefulStream(e.noop),s=function(t,n){return void 0===n&&(n=null),e.statefulStreamFromEmitter(e.pipe(o,e.map(function(e){return e[t]}),e.distinctUntilChanged()),n)};return{context:n,itemContent:t,groupContent:r,components:o,computeItemKey:i,headerFooterTag:a,scrollerRef:l,FooterComponent:s("Footer"),HeaderComponent:s("Header"),TopItemListComponent:s("TopItemList"),ListComponent:s("List","div"),ItemComponent:s("Item","div"),GroupComponent:s("Group","div"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder")}});function Yt(t,n){var r=e.stream();return e.subscribe(r,function(){return console.warn("react-virtuoso: You are using a deprecated property. "+n,"color: red;","color: inherit;","color: blue;")}),e.connect(r,t),r}var qt=e.system(function(t){var n=t[0],r=t[1],o={item:Yt(r.itemContent,"Rename the %citem%c prop to %citemContent."),group:Yt(r.groupContent,"Rename the %cgroup%c prop to %cgroupContent."),topItems:Yt(n.topItemCount,"Rename the %ctopItems%c prop to %ctopItemCount."),itemHeight:Yt(n.fixedItemHeight,"Rename the %citemHeight%c prop to %cfixedItemHeight."),scrollingStateChange:Yt(n.isScrolling,"Rename the %cscrollingStateChange%c prop to %cisScrolling."),adjustForPrependedItems:e.stream(),maxHeightCacheSize:e.stream(),footer:e.stream(),header:e.stream(),HeaderContainer:e.stream(),FooterContainer:e.stream(),ItemContainer:e.stream(),ScrollContainer:e.stream(),GroupContainer:e.stream(),ListContainer:e.stream(),emptyComponent:e.stream(),scrollSeek:e.stream()};function i(t,n,o){e.connect(e.pipe(t,e.withLatestFrom(r.components),e.map(function(t){var e,r=t[0],i=t[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),u({},i,((e={})[n]=r,e))})),r.components)}return e.subscribe(o.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;")}),e.subscribe(o.maxHeightCacheSize,function(){console.warn("react-virtuoso: maxHeightCacheSize is no longer necessary. Setting it has no effect - remove it from your code.")}),e.subscribe(o.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.")}),e.subscribe(o.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.")}),e.subscribe(o.scrollSeek,function(t){var o=t.placeholder,i=c(t,Dt);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),e.publish(r.components,u({},e.getValue(r.components),{ScrollSeekPlaceholder:o})),e.publish(n.scrollSeekConfiguration,i)}),i(o.footer,"Footer","footer"),i(o.header,"Header","header"),i(o.ItemContainer,"Item","ItemContainer"),i(o.ListContainer,"List","ListContainer"),i(o.ScrollContainer,"Scroller","ScrollContainer"),i(o.emptyComponent,"EmptyPlaceholder","emptyComponent"),i(o.GroupContainer,"Group","GroupContainer"),u({},n,r,o)},e.tup(At,Kt)),Zt=function(t){return n.createElement("div",{style:{height:t.height}})},Jt={position:Wt(),zIndex:1,overflowAnchor:"none"},$t={overflowAnchor:"none"},Qt=n.memo(function(t){var r=t.showTopList,o=void 0!==r&&r,i=fe("listState"),a=de("sizeRanges"),s=fe("useWindowScroll"),c=fe("customScrollParent"),m=de("windowScrollContainerState"),d=de("scrollContainerState"),f=c||s?m:d,p=fe("itemContent"),h=fe("context"),g=fe("groupContent"),v=fe("trackItemSizes"),S=fe("itemSize"),I=fe("log"),T=de("gap"),w=C(a,S,v,o?e.noop:f,I,T,c).callbackRef,x=n.useState(0),b=x[0],y=x[1];pe("deviation",function(t){b!==t&&y(t)});var E=fe("EmptyPlaceholder"),H=fe("ScrollSeekPlaceholder")||Zt,R=fe("ListComponent"),L=fe("ItemComponent"),k=fe("GroupComponent"),z=fe("computeItemKey"),B=fe("isSeeking"),F=fe("groupIndices").length>0,P=fe("paddingTopAddition"),O=o?{}:{boxSizing:"border-box",paddingTop:i.offsetTop+P,paddingBottom:i.offsetBottom,marginTop:b};return!o&&0===i.totalCount&&E?l(E,ne(E,h)):l(R,u({},ne(R,h),{ref:w,style:O,"data-test-id":o?"virtuoso-top-item-list":"virtuoso-item-list"}),(o?i.topItems:i.items).map(function(t){var e=t.originalIndex,n=z(e+i.firstItemIndex,t.data,h);return B?l(H,u({},ne(H,h),{key:n,index:t.index,height:t.size,type:t.type||"item"},"group"===t.type?{}:{groupIndex:t.groupIndex})):"group"===t.type?l(k,u({},ne(k,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:Jt}),g(t.index)):l(L,u({},ne(L,h),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,"data-item-group-index":t.groupIndex,style:$t}),F?p(t.index,t.groupIndex,t.data,h):p(t.index,t.data,h))}))}),Xt={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},te={width:"100%",height:"100%",position:"absolute",top:0},ee={width:"100%",position:Wt(),top:0};function ne(t,e){if("string"!=typeof t)return{context:e}}var re=n.memo(function(){var t=fe("HeaderComponent"),e=de("headerHeight"),n=fe("headerFooterTag"),r=I(function(t){return e(T(t,"height"))}),o=fe("context");return t?l(n,{ref:r},l(t,ne(t,o))):null}),oe=n.memo(function(){var t=fe("FooterComponent"),e=de("footerHeight"),n=fe("headerFooterTag"),r=I(function(t){return e(T(t,"height"))}),o=fe("context");return t?l(n,{ref:r},l(t,ne(t,o))):null});function ie(t){var e=t.usePublisher,r=t.useEmitter,o=t.useEmitterValue;return n.memo(function(t){var n=t.style,i=t.children,a=c(t,Gt),s=e("scrollContainerState"),m=o("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=o("scrollerRef"),p=o("context"),h=x(s,d,m,f),g=h.scrollerRef,v=h.scrollByCallback;return r("scrollTo",h.scrollToCallback),r("scrollBy",v),l(m,u({ref:g,style:u({},Xt,n),"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0},a,ne(m,p)),i)})}function ae(t){var r=t.usePublisher,o=t.useEmitter,i=t.useEmitterValue;return n.memo(function(t){var n=t.style,a=t.children,s=c(t,_t),m=r("windowScrollContainerState"),d=i("ScrollerComponent"),f=r("smoothScrollTargetReached"),p=i("totalListHeight"),g=i("deviation"),v=i("customScrollParent"),S=i("context"),I=x(m,f,d,e.noop,v),C=I.scrollerRef,T=I.scrollByCallback,w=I.scrollToCallback;return h(function(){return C.current=v||window,function(){C.current=null}},[C,v]),o("windowScrollTo",w),o("scrollBy",T),l(d,u({style:u({position:"relative"},n,0!==p?{height:p+g}:{}),"data-virtuoso-scroller":!0},s,ne(d,S)),a)})}var le=function(t){var r=t.children,o=de("viewportHeight"),i=I(e.compose(o,function(t){return T(t,"height")}));return n.createElement("div",{style:te,ref:i,"data-viewport-type":"element"},r)},se=function(t){var e=t.children,r=Nt(de("windowViewportRect"),fe("customScrollParent"));return n.createElement("div",{ref:r,style:te,"data-viewport-type":"window"},e)},ue=function(t){var e=t.children,n=fe("TopItemListComponent"),r=fe("headerHeight"),o=u({},ee,{marginTop:r+"px"}),i=fe("context");return l(n||"div",{style:o,context:i},e)},ce=t(qt,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering",item:"item",group:"group",topItems:"topItems",itemHeight:"itemHeight",scrollingStateChange:"scrollingStateChange",maxHeightCacheSize:"maxHeightCacheSize",footer:"footer",header:"header",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",GroupContainer:"GroupContainer",emptyComponent:"emptyComponent",HeaderContainer:"HeaderContainer",FooterContainer:"FooterContainer",scrollSeek:"scrollSeek"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",adjustForPrependedItems:"adjustForPrependedItems",autoscrollToBottom:"autoscrollToBottom"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},n.memo(function(t){var e=fe("useWindowScroll"),r=fe("topItemsIndexes").length>0,o=fe("customScrollParent"),i=o||e?se:le;return n.createElement(o||e?ge:he,u({},t),n.createElement(i,null,n.createElement(re,null),n.createElement(Qt,null),n.createElement(oe,null)),r&&n.createElement(ue,null,n.createElement(Qt,{showTopList:!0})))})),me=ce.Component,de=ce.usePublisher,fe=ce.useEmitterValue,pe=ce.useEmitter,he=ie({usePublisher:de,useEmitterValue:fe,useEmitter:pe}),ge=ae({usePublisher:de,useEmitterValue:fe,useEmitter:pe}),ve={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Se={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Ie=Math.round,Ce=Math.ceil,Te=Math.floor,we=Math.min,xe=Math.max;function be(t,e){return Array.from({length:e-t+1}).map(function(e,n){return{index:n+t}})}function ye(t,e){return t&&t.column===e.column&&t.row===e.row}var Ee=e.system(function(t){var n=t[0],r=n.overscan,o=n.visibleRange,i=n.listBoundary,a=t[1],l=a.scrollTop,s=a.viewportHeight,c=a.scrollBy,m=a.scrollTo,d=a.smoothScrollTargetReached,f=a.scrollContainerState,p=t[2],h=t[3],g=t[4],v=g.propsReady,S=g.didMount,I=t[5],C=I.windowViewportRect,T=I.windowScrollTo,w=I.useWindowScroll,x=I.customScrollParent,b=I.windowScrollContainerState,y=t[6],E=e.statefulStream(0),H=e.statefulStream(0),R=e.statefulStream(ve),L=e.statefulStream({height:0,width:0}),k=e.statefulStream({height:0,width:0}),z=e.stream(),B=e.stream(),F=e.statefulStream(0),P=e.statefulStream({row:0,column:0});e.connect(e.pipe(S,e.withLatestFrom(H),e.filter(function(t){return 0!==t[1]}),e.map(function(t){return{items:be(0,t[1]-1),top:0,bottom:0,offsetBottom:0,offsetTop:0,itemHeight:0,itemWidth:0}})),R),e.connect(e.pipe(e.combineLatest(e.duc(E),o,e.duc(P,ye),e.duc(k,function(t,e){return t&&t.width===e.width&&t.height===e.height})),e.withLatestFrom(L),e.map(function(t){var e=t[0],n=e[0],r=e[1],o=r[0],i=r[1],a=e[2],l=e[3],s=t[1],u=a.row,c=l.height,m=l.width,d=s.width;if(0===n||0===d)return ve;if(0===m)return Se;var f=Le(d,m,a.column),p=f*Te((o+u)/(c+u)),h=f*Ce((i+u)/(c+u))-1;h=xe(0,we(n-1,h));var g=be(p=we(h,xe(0,p)),h),v=He(s,a,l,g),S=v.top,I=v.bottom,C=Ce(n/f);return{items:g,offsetTop:S,offsetBottom:C*c+(C-1)*u-I,top:S,bottom:I,itemHeight:c,itemWidth:m}})),R),e.connect(e.pipe(L,e.map(function(t){return t.height})),s),e.connect(e.pipe(e.combineLatest(L,k,R,P),e.map(function(t){var e=He(t[0],t[3],t[1],t[2].items);return[e.top,e.bottom]}),e.distinctUntilChanged(gt)),i);var O=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){return t.items.length>0}),e.withLatestFrom(E),e.filter(function(t){var e=t[0].items;return e[e.length-1].index===t[1]-1}),e.map(function(t){return t[1]-1}),e.distinctUntilChanged())),M=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){var e=t.items;return e.length>0&&0===e[0].index}),e.mapTo(0),e.distinctUntilChanged())),V=e.streamFromEmitter(e.pipe(e.duc(R),e.filter(function(t){return t.items.length>0}),e.map(function(t){var e=t.items;return{startIndex:e[0].index,endIndex:e[e.length-1].index}}),e.distinctUntilChanged(vt)));e.connect(V,h.scrollSeekRangeChanged),e.connect(e.pipe(z,e.withLatestFrom(L,k,E,P),e.map(function(t){var e=t[1],n=t[2],r=t[3],o=t[4],i=it(t[0]),a=i.align,l=i.behavior,s=i.offset,u=i.index;"LAST"===u&&(u=r-1);var c=Re(e,o,n,u=xe(0,u,we(r-1,u)));return"end"===a?c=Ie(c-e.height+n.height):"center"===a&&(c=Ie(c-e.height/2+n.height/2)),s&&(c+=s),{top:c,behavior:l}})),m);var U=e.statefulStreamFromEmitter(e.pipe(R,e.map(function(t){return t.offsetBottom+t.bottom})),0);return e.connect(e.pipe(C,e.map(function(t){return{width:t.visibleWidth,height:t.visibleHeight}})),L),u({totalCount:E,viewportDimensions:L,itemDimensions:k,scrollTop:l,scrollHeight:B,overscan:r,scrollBy:c,scrollTo:m,scrollToIndex:z,smoothScrollTargetReached:d,windowViewportRect:C,windowScrollTo:T,useWindowScroll:w,customScrollParent:x,windowScrollContainerState:b,deviation:F,scrollContainerState:f,initialItemCount:H,gap:P},h,{gridState:R,totalListHeight:U},p,{startReached:M,endReached:O,rangeChanged:V,propsReady:v},y)},e.tup(Ct,b,ut,Et,ct,Pt,v));function He(t,e,n,r){var o=n.height;return void 0===o||0===r.length?{top:0,bottom:0}:{top:Re(t,e,n,r[0].index),bottom:Re(t,e,n,r[r.length-1].index)+o}}function Re(t,e,n,r){var o=Le(t.width,n.width,e.column),i=Te(r/o),a=i*n.height+xe(0,i-1)*e.row;return a>0?a+e.row:a}function Le(t,e,n){return xe(1,Te((t+n)/(e+n)))}var ke=["placeholder"],ze=e.system(function(){var t=e.statefulStream(function(t){return"Item "+t}),n=e.statefulStream({}),r=e.statefulStream(null),o=e.statefulStream("virtuoso-grid-item"),i=e.statefulStream("virtuoso-grid-list"),a=e.statefulStream(jt),l=e.statefulStream(e.noop),s=function(t,r){return void 0===r&&(r=null),e.statefulStreamFromEmitter(e.pipe(n,e.map(function(e){return e[t]}),e.distinctUntilChanged()),r)};return{context:r,itemContent:t,components:n,computeItemKey:a,itemClassName:o,listClassName:i,scrollerRef:l,ListComponent:s("List","div"),ItemComponent:s("Item","div"),ScrollerComponent:s("Scroller","div"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder","div")}}),Be=e.system(function(t){var n=t[0],r=t[1],o={item:Yt(r.itemContent,"Rename the %citem%c prop to %citemContent."),ItemContainer:e.stream(),ScrollContainer:e.stream(),ListContainer:e.stream(),emptyComponent:e.stream(),scrollSeek:e.stream()};function i(t,n,o){e.connect(e.pipe(t,e.withLatestFrom(r.components),e.map(function(t){var e,r=t[0],i=t[1];return console.warn("react-virtuoso: "+o+" property is deprecated. Pass components."+n+" instead."),u({},i,((e={})[n]=r,e))})),r.components)}return e.subscribe(o.scrollSeek,function(t){var o=t.placeholder,i=c(t,ke);console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead."),e.publish(r.components,u({},e.getValue(r.components),{ScrollSeekPlaceholder:o})),e.publish(n.scrollSeekConfiguration,i)}),i(o.ItemContainer,"Item","ItemContainer"),i(o.ListContainer,"List","ListContainer"),i(o.ScrollContainer,"Scroller","ScrollContainer"),u({},n,r,o)},e.tup(Ee,ze)),Fe=n.memo(function(){var t=Ae("gridState"),e=Ae("listClassName"),n=Ae("itemClassName"),r=Ae("itemContent"),o=Ae("computeItemKey"),i=Ae("isSeeking"),a=Ue("scrollHeight"),s=Ae("ItemComponent"),c=Ae("ListComponent"),m=Ae("ScrollSeekPlaceholder"),d=Ae("context"),f=Ue("itemDimensions"),p=Ue("gap"),h=Ae("log"),g=I(function(t){a(t.parentElement.parentElement.scrollHeight);var e=t.firstChild;e&&f(e.getBoundingClientRect()),p({row:Ge("row-gap",getComputedStyle(t).rowGap,h),column:Ge("column-gap",getComputedStyle(t).columnGap,h)})});return l(c,u({ref:g,className:e},ne(c,d),{style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom}}),t.items.map(function(e){var a=o(e.index);return i?l(m,u({key:a},ne(m,d),{index:e.index,height:t.itemHeight,width:t.itemWidth})):l(s,u({},ne(s,d),{className:n,"data-index":e.index,key:a}),r(e.index,d))}))}),Pe=function(t){var e=t.children,r=Ue("viewportDimensions"),o=I(function(t){r(t.getBoundingClientRect())});return n.createElement("div",{style:te,ref:o},e)},Oe=function(t){var e=t.children,r=Nt(Ue("windowViewportRect"),Ae("customScrollParent"));return n.createElement("div",{ref:r,style:te},e)},Me=t(Be,{optional:{totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",item:"item",ItemContainer:"ItemContainer",ScrollContainer:"ScrollContainer",ListContainer:"ListContainer",scrollSeek:"scrollSeek"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange"}},n.memo(function(t){var e=u({},t),r=Ae("useWindowScroll"),o=Ae("customScrollParent"),i=o||r?Oe:Pe;return n.createElement(o||r?De:Ne,u({},e),n.createElement(i,null,n.createElement(Fe,null)))})),Ve=Me.Component,Ue=Me.usePublisher,Ae=Me.useEmitterValue,We=Me.useEmitter,Ne=ie({usePublisher:Ue,useEmitterValue:Ae,useEmitter:We}),De=ae({usePublisher:Ue,useEmitterValue:Ae,useEmitter:We});function Ge(t,e,n){return"normal"===e||null!=e&&e.endsWith("px")||n(t+" was not resolved to pixel value correctly",e,p.WARN),"normal"===e?0:parseInt(null!=e?e:"0",10)}var _e=e.system(function(){var t=e.statefulStream(function(t){return n.createElement("td",null,"Item $",t)}),r=e.statefulStream(null),o=e.statefulStream(null),i=e.statefulStream({}),a=e.statefulStream(jt),l=e.statefulStream(e.noop),s=function(t,n){return void 0===n&&(n=null),e.statefulStreamFromEmitter(e.pipe(i,e.map(function(e){return e[t]}),e.distinctUntilChanged()),n)};return{context:r,itemContent:t,fixedHeaderContent:o,components:i,computeItemKey:a,scrollerRef:l,TableComponent:s("Table","table"),TableHeadComponent:s("TableHead","thead"),TableBodyComponent:s("TableBody","tbody"),TableRowComponent:s("TableRow","tr"),ScrollerComponent:s("Scroller","div"),EmptyPlaceholder:s("EmptyPlaceholder"),ScrollSeekPlaceholder:s("ScrollSeekPlaceholder"),FillerRow:s("FillerRow")}}),je=e.system(function(t){return u({},t[0],t[1])},e.tup(At,_e)),Ke=function(t){return n.createElement("tr",null,n.createElement("td",{style:{height:t.height}}))},Ye=function(t){return n.createElement("tr",null,n.createElement("td",{style:{height:t.height,padding:0,border:0}}))},qe=n.memo(function(){var t=tn("listState"),e=Xe("sizeRanges"),r=tn("useWindowScroll"),o=tn("customScrollParent"),i=Xe("windowScrollContainerState"),a=Xe("scrollContainerState"),s=o||r?i:a,c=tn("itemContent"),m=tn("trackItemSizes"),d=C(e,tn("itemSize"),m,s,tn("log"),void 0,o),f=d.callbackRef,p=d.ref,h=n.useState(0),g=h[0],v=h[1];en("deviation",function(t){g!==t&&(p.current.style.marginTop=t+"px",v(t))});var S=tn("EmptyPlaceholder"),I=tn("ScrollSeekPlaceholder")||Ke,T=tn("FillerRow")||Ye,w=tn("TableBodyComponent"),x=tn("TableRowComponent"),b=tn("computeItemKey"),y=tn("isSeeking"),E=tn("paddingTopAddition"),H=tn("firstItemIndex"),R=tn("statefulTotalCount"),L=tn("context");if(0===R&&S)return l(S,ne(S,L));var k=t.offsetTop+E+g,z=t.offsetBottom,B=k>0?n.createElement(T,{height:k,key:"padding-top"}):null,F=z>0?n.createElement(T,{height:z,key:"padding-bottom"}):null,P=t.items.map(function(t){var e=t.originalIndex,n=b(e+H,t.data,L);return y?l(I,u({},ne(I,L),{key:n,index:t.index,height:t.size,type:t.type||"item"})):l(x,u({},ne(x,L),{key:n,"data-index":e,"data-known-size":t.size,"data-item-index":t.index,style:{overflowAnchor:"none"}}),c(t.index,t.data,L))});return l(w,u({ref:f,"data-test-id":"virtuoso-item-list"},ne(w,L)),[B].concat(P,[F]))}),Ze=function(t){var r=t.children,o=Xe("viewportHeight"),i=I(e.compose(o,function(t){return T(t,"height")}));return n.createElement("div",{style:te,ref:i,"data-viewport-type":"element"},r)},Je=function(t){var e=t.children,r=Nt(Xe("windowViewportRect"),tn("customScrollParent"));return n.createElement("div",{ref:r,style:te,"data-viewport-type":"window"},e)},$e=t(je,{required:{},optional:{context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",fixedHeaderContent:"fixedHeaderContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",react18ConcurrentRendering:"react18ConcurrentRendering"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},n.memo(function(t){var r=tn("useWindowScroll"),o=tn("customScrollParent"),i=Xe("fixedHeaderHeight"),a=tn("fixedHeaderContent"),l=tn("context"),s=I(e.compose(i,function(t){return T(t,"height")})),c=o||r?rn:nn,m=o||r?Je:Ze,d=tn("TableComponent"),f=tn("TableHeadComponent"),p=a?n.createElement(f,u({key:"TableHead",style:{zIndex:1,position:"sticky",top:0},ref:s},ne(f,l)),a()):null;return n.createElement(c,u({},t),n.createElement(m,null,n.createElement(d,u({style:{borderSpacing:0}},ne(d,l)),[p,n.createElement(qe,{key:"TableBody"})])))})),Qe=$e.Component,Xe=$e.usePublisher,tn=$e.useEmitterValue,en=$e.useEmitter,nn=ie({usePublisher:Xe,useEmitterValue:tn,useEmitter:en}),rn=ae({usePublisher:Xe,useEmitterValue:tn,useEmitter:en}),on=me,an=me,ln=Qe,sn=Ve;export{an as GroupedVirtuoso,p as LogLevel,ln as TableVirtuoso,on as Virtuoso,sn as VirtuosoGrid}; | ||
//# sourceMappingURL=index.m.js.map |
@@ -5,3 +5,3 @@ { | ||
"sideEffects": false, | ||
"version": "2.17.0", | ||
"version": "2.17.1", | ||
"homepage": "https://virtuoso.dev/", | ||
@@ -8,0 +8,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
652805