react-virtuoso 4.13.0 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +1116 -1070
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),H=require("react"),so=require("react-dom"),Ce=0,zt=1,Ut=2,kn=4;function ln(t){return()=>t}function io(t){t()}function te(t,e){return n=>t(e(n))}function cn(t,e){return()=>t(e)}function lo(t,e){return n=>t(e,n)}function Pe(t){return t!==void 0}function co(...t){return()=>{t.map(io)}}function Kt(){}function we(t,e){return e(t),t}function uo(t,e){return e(t)}function X(...t){return t}function U(t,e){return t(zt,e)}function G(t,e){t(Ce,e)}function Me(t){t(Ut)}function st(t){return t(kn)}function F(t,e){return U(t,lo(e,Ce))}function Rt(t,e){const n=t(zt,o=>{n(),e(o)});return n}function un(t){let e,n;return o=>r=>{e=r,n&&clearTimeout(n),n=setTimeout(()=>{o(e)},t)}}function Bn(t,e){return t===e}function Z(t=Bn){let e;return n=>o=>{t(e,o)||(e=o,n(o))}}function P(t){return e=>n=>{t(n)&&e(n)}}function E(t){return e=>te(e,t)}function yt(t){return e=>()=>{e(t)}}function S(t,...e){const n=ao(...e);return(o,r)=>{switch(o){case Ut:Me(t);return;case zt:return U(t,n(r))}}}function bt(t,e){return n=>o=>{n(e=t(e,o))}}function $t(t){return e=>n=>{t>0?t--:e(n)}}function Lt(t){let e=null,n;return o=>r=>{e=r,!n&&(n=setTimeout(()=>{n=void 0,o(e)},t))}}function W(...t){const e=new Array(t.length);let n=0,o=null;const r=Math.pow(2,t.length)-1;return t.forEach((s,i)=>{const l=Math.pow(2,i);U(s,c=>{const a=n;n=n|l,e[i]=c,a!==r&&n===r&&o&&(o(),o=null)})}),s=>i=>{const l=()=>{s([i].concat(e))};n===r?l():o=l}}function ao(...t){return e=>t.reduceRight(uo,e)}function fo(t){let e,n;const o=()=>e==null?void 0:e();return function(r,s){switch(r){case zt:return s?n===s?void 0:(o(),n=s,e=U(t,s),e):(o(),Kt);case Ut:o(),n=null;return}}}function C(t){let e=t;const n=D();return(o,r)=>{switch(o){case Ce:e=r;break;case zt:{r(e);break}case kn:return e}return n(o,r)}}function ct(t,e){return we(C(e),n=>F(t,n))}function D(){const t=[];return(e,n)=>{switch(e){case Ce:t.slice().forEach(o=>{o(n)});return;case Ut:t.splice(0,t.length);return;case zt:return t.push(n),()=>{const o=t.indexOf(n);o>-1&&t.splice(o,1)}}}}function ht(t){return we(D(),e=>F(t,e))}function $(t,e=[],{singleton:n}={singleton:!0}){return{constructor:t,dependencies:e,id:mo(),singleton:n}}const mo=()=>Symbol();function po(t){const e=new Map,n=({constructor:o,dependencies:r,id:s,singleton:i})=>{if(i&&e.has(s))return e.get(s);const l=o(r.map(c=>n(c)));return i&&e.set(s,l),l};return n(t)}function rt(...t){const e=D(),n=new Array(t.length);let o=0;const r=Math.pow(2,t.length)-1;return t.forEach((s,i)=>{const l=Math.pow(2,i);U(s,c=>{n[i]=c,o=o|l,o===r&&G(e,n)})}),function(s,i){switch(s){case Ut:{Me(e);return}case zt:return o===r&&i(n),U(e,i)}}}function M(t,e=Bn){return S(t,Z(e))}function an(...t){return function(e,n){switch(e){case Ut:return;case zt:return co(...t.map(o=>U(o,n)))}}}var at=(t=>(t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR",t))(at||{});const ho={0:"debug",3:"error",1:"log",2:"warn"},go=()=>typeof globalThis>"u"?window:globalThis,Vt=$(()=>{const t=C(3);return{log:C((n,o,r=1)=>{var i;const s=(i=go().VIRTUOSO_LOG_LEVEL)!=null?i:st(t);r>=s&&console[ho[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function Ht(t,e,n){return je(t,e,n).callbackRef}function je(t,e,n){const o=H.useRef(null);let r=i=>{};const s=H.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const l=()=>{const c=i[0].target;c.offsetParent!==null&&t(c)};n?l():requestAnimationFrame(l)}):null,[t,n]);return r=i=>{i&&e?(s==null||s.observe(i),o.current=i):(o.current&&(s==null||s.unobserve(o.current)),o.current=null)},{callbackRef:r,ref:o}}function On(t,e,n,o,r,s,i,l,c){const a=H.useCallback(p=>{const I=xo(p.children,e,l?"offsetWidth":"offsetHeight",r);let g=p.parentElement;for(;!g.dataset.virtuosoScroller;)g=g.parentElement;const h=g.lastElementChild.dataset.viewportType==="window";let w;h&&(w=g.ownerDocument.defaultView);const v=i?l?i.scrollLeft:i.scrollTop:h?l?w.scrollX||w.document.documentElement.scrollLeft:w.scrollY||w.document.documentElement.scrollTop:l?g.scrollLeft:g.scrollTop,m=i?l?i.scrollWidth:i.scrollHeight:h?l?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight:l?g.scrollWidth:g.scrollHeight,d=i?l?i.offsetWidth:i.offsetHeight:h?l?w.innerWidth:w.innerHeight:l?g.offsetWidth:g.offsetHeight;o({scrollHeight:m,scrollTop:Math.max(v,0),viewportHeight:d}),s==null||s(l?dn("column-gap",getComputedStyle(p).columnGap,r):dn("row-gap",getComputedStyle(p).rowGap,r)),I!==null&&t(I)},[t,e,r,s,i,o,l]);return je(a,n,c)}function xo(t,e,n,o){const r=t.length;if(r===0)return null;const s=[];for(let i=0;i<r;i++){const l=t.item(i);if(l.dataset.index===void 0)continue;const c=parseInt(l.dataset.index),a=parseFloat(l.dataset.knownSize),p=e(l,n);if(p===0&&o("Zero-sized element, this should not happen",{child:l},at.ERROR),p===a)continue;const I=s[s.length-1];s.length===0||I.size!==p||I.endIndex!==c-1?s.push({endIndex:c,size:p,startIndex:c}):s[s.length-1].endIndex++}return s}function dn(t,e,n){return e!=="normal"&&!(e!=null&&e.endsWith("px"))&&n(`${t} was not resolved to pixel value correctly`,e,at.WARN),e==="normal"?0:parseInt(e!=null?e:"0",10)}function Ae(t,e,n){const o=H.useRef(null),r=H.useCallback(c=>{if(!(c!=null&&c.offsetParent))return;const a=c.getBoundingClientRect(),p=a.width;let I,g;if(e){const h=e.getBoundingClientRect(),w=a.top-h.top;g=h.height-Math.max(0,w),I=w+e.scrollTop}else{const h=i.current.ownerDocument.defaultView;g=h.innerHeight-Math.max(0,a.top),I=a.top+h.scrollY}o.current={offsetTop:I,visibleHeight:g,visibleWidth:p},t(o.current)},[t,e]),{callbackRef:s,ref:i}=je(r,!0,n),l=H.useCallback(()=>{r(i.current)},[r,i]);return H.useEffect(()=>{var c;if(e){e.addEventListener("scroll",l);const a=new ResizeObserver(()=>{requestAnimationFrame(l)});return a.observe(e),()=>{e.removeEventListener("scroll",l),a.unobserve(e)}}else{const a=(c=i.current)==null?void 0:c.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",l),a==null||a.addEventListener("resize",l),()=>{a==null||a.removeEventListener("scroll",l),a==null||a.removeEventListener("resize",l)}}},[l,e,i]),s}const dt=$(()=>{const t=D(),e=D(),n=C(0),o=D(),r=C(0),s=D(),i=D(),l=C(0),c=C(0),a=C(0),p=C(0),I=D(),g=D(),h=C(!1),w=C(!1),v=C(!1);return F(S(t,E(({scrollTop:m})=>m)),e),F(S(t,E(({scrollHeight:m})=>m)),i),F(e,r),{deviation:n,fixedFooterHeight:a,fixedHeaderHeight:c,footerHeight:p,headerHeight:l,horizontalDirection:w,scrollBy:g,scrollContainerState:t,scrollHeight:i,scrollingInProgress:h,scrollTo:I,scrollTop:e,skipAnimationFrameInResizeObserver:v,smoothScrollTargetReached:o,statefulScrollTop:r,viewportHeight:s}},[],{singleton:!0}),ee={lvl:0};function Fn(t,e){const n=t.length;if(n===0)return[];let{index:o,value:r}=e(t[0]);const s=[];for(let i=1;i<n;i++){const{index:l,value:c}=e(t[i]);s.push({end:l-1,start:o,value:r}),o=l,r=c}return s.push({end:1/0,start:o,value:r}),s}function K(t){return t===ee}function ne(t,e){if(!K(t))return e===t.k?t.v:e<t.k?ne(t.l,e):ne(t.r,e)}function Ct(t,e,n="k"){if(K(t))return[-1/0,void 0];if(Number(t[n])===e)return[t.k,t.v];if(Number(t[n])<e){const o=Ct(t.r,e,n);return o[0]===-1/0?[t.k,t.v]:o}return Ct(t.l,e,n)}function pt(t,e,n){return K(t)?Vn(e,n,1):e===t.k?ot(t,{k:e,v:n}):e<t.k?fn(ot(t,{l:pt(t.l,e,n)})):fn(ot(t,{r:pt(t.r,e,n)}))}function Dt(){return ee}function ve(t,e,n){if(K(t))return[];const o=Ct(t,e)[0];return Io(Fe(t,o,n))}function Oe(t,e){if(K(t))return ee;const{k:n,l:o,r}=t;if(e===n){if(K(o))return r;if(K(r))return o;{const[s,i]=zn(o);return he(ot(t,{k:s,l:Ln(o),v:i}))}}else return e<n?he(ot(t,{l:Oe(o,e)})):he(ot(t,{r:Oe(r,e)}))}function Gt(t){return K(t)?[]:[...Gt(t.l),{k:t.k,v:t.v},...Gt(t.r)]}function Fe(t,e,n){if(K(t))return[];const{k:o,l:r,r:s,v:i}=t;let l=[];return o>e&&(l=l.concat(Fe(r,e,n))),o>=e&&o<=n&&l.push({k:o,v:i}),o<=n&&(l=l.concat(Fe(s,e,n))),l}function he(t){const{l:e,lvl:n,r:o}=t;if(o.lvl>=n-1&&e.lvl>=n-1)return t;if(n>o.lvl+1){if(Re(e))return Pn(ot(t,{lvl:n-1}));if(!K(e)&&!K(e.r))return ot(e.r,{l:ot(e,{r:e.r.l}),lvl:n,r:ot(t,{l:e.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(Re(t))return Le(ot(t,{lvl:n-1}));if(!K(o)&&!K(o.l)){const r=o.l,s=Re(r)?o.lvl-1:o.lvl;return ot(r,{l:ot(t,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Le(ot(o,{l:r.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function ot(t,e){return Vn(e.k!==void 0?e.k:t.k,e.v!==void 0?e.v:t.v,e.lvl!==void 0?e.lvl:t.lvl,e.l!==void 0?e.l:t.l,e.r!==void 0?e.r:t.r)}function Ln(t){return K(t.r)?t.l:he(ot(t,{r:Ln(t.r)}))}function Re(t){return K(t)||t.lvl>t.r.lvl}function zn(t){return K(t.r)?[t.k,t.v]:zn(t.r)}function Vn(t,e,n,o=ee,r=ee){return{k:t,l:o,lvl:n,r,v:e}}function fn(t){return Le(Pn(t))}function Pn(t){const{l:e}=t;return!K(e)&&e.lvl===t.lvl?ot(e,{r:ot(t,{l:e.r})}):t}function Le(t){const{lvl:e,r:n}=t;return!K(n)&&!K(n.r)&&n.lvl===e&&n.r.lvl===e?ot(n,{l:ot(t,{r:n.l}),lvl:e+1}):t}function Io(t){return Fn(t,({k:e,v:n})=>({index:e,value:n}))}function Mn(t,e){return!!(t&&t.startIndex===e.startIndex&&t.endIndex===e.endIndex)}function oe(t,e){return!!(t&&t[0]===e[0]&&t[1]===e[1])}const Ge=$(()=>({recalcInProgress:C(!1)}),[],{singleton:!0});function jn(t,e,n){return t[xe(t,e,n)]}function xe(t,e,n,o=0){let r=t.length-1;for(;o<=r;){const s=Math.floor((o+r)/2),i=t[s],l=n(i,e);if(l===0)return s;if(l===-1){if(r-o<2)return s-1;r=s-1}else{if(r===o)return s;o=s+1}}throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${e}`)}function So(t,e,n,o){const r=xe(t,e,o),s=xe(t,n,o,r);return t.slice(r,s+1)}function wt(t,e){return Math.round(t.getBoundingClientRect()[e])}function ye(t){return!K(t.groupOffsetTree)}function We({index:t},e){return e===t?0:e<t?-1:1}function To(){return{groupIndices:[],groupOffsetTree:Dt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Dt()}}function Co(t,e){let n=K(t)?0:1/0;for(const o of e){const{endIndex:r,size:s,startIndex:i}=o;if(n=Math.min(n,i),K(t)){t=pt(t,0,s);continue}const l=ve(t,i-1,r+1);if(l.some(Eo(o)))continue;let c=!1,a=!1;for(const{end:p,start:I,value:g}of l)c?(r>=I||s===g)&&(t=Oe(t,I)):(a=g!==s,c=!0),p>r&&r>=I&&g!==s&&(t=pt(t,r+1,g));a&&(t=pt(t,i,s))}return[t,n]}function wo(t){return typeof t.groupIndex<"u"}function vo({offset:t},e){return e===t?0:e<t?-1:1}function re(t,e,n){if(e.length===0)return 0;const{index:o,offset:r,size:s}=jn(e,t,We),i=t-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function An(t,e){if(!ye(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function Gn(t,e,n){if(wo(t))return e.groupIndices[t.groupIndex]+1;{const o=t.index==="LAST"?n:t.index;let r=An(o,e);return r=Math.max(0,r,Math.min(n,r)),r}}function yo(t,e,n,o=0){return o>0&&(e=Math.max(e,jn(t,o,We).offset)),Fn(So(t,e,n,vo),Ho)}function bo(t,[e,n,o,r]){e.length>0&&o("received item sizes",e,at.DEBUG);const s=t.sizeTree;let i=s,l=0;if(n.length>0&&K(s)&&e.length===2){const g=e[0].size,h=e[1].size;i=n.reduce((w,v)=>pt(pt(w,v,g),v+1,h),i)}else[i,l]=Co(i,e);if(i===s)return t;const{lastIndex:c,lastOffset:a,lastSize:p,offsetTree:I}=ze(t.offsetTree,l,i,r);return{groupIndices:n,groupOffsetTree:n.reduce((g,h)=>pt(g,h,re(h,I,r)),Dt()),lastIndex:c,lastOffset:a,lastSize:p,offsetTree:I,sizeTree:i}}function Ro(t){return Gt(t).map(({k:e,v:n},o,r)=>{const s=r[o+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:e}})}function mn(t,e){let n=0,o=0;for(;n<t;)n+=e[o+1]-e[o]-1,o++;return o-(n===t?0:1)}function ze(t,e,n,o){let r=t,s=0,i=0,l=0,c=0;if(e!==0){c=xe(r,e-1,We),l=r[c].offset;const p=Ct(n,e-1);s=p[0],i=p[1],r.length&&r[c].size===Ct(n,e)[1]&&(c-=1),r=r.slice(0,c+1)}else r=[];for(const{start:a,value:p}of ve(n,e,1/0)){const I=a-s,g=I*i+l+I*o;r.push({index:a,offset:g,size:p}),s=a,l=g,i=p}return{lastIndex:s,lastOffset:l,lastSize:i,offsetTree:r}}function Ho(t){return{index:t.index,value:t}}function Eo(t){const{endIndex:e,size:n,startIndex:o}=t;return r=>r.start===o&&(r.end===e||r.end===1/0)&&r.value===n}const ko={offsetHeight:"height",offsetWidth:"width"},Et=$(([{log:t},{recalcInProgress:e}])=>{const n=D(),o=D(),r=ct(o,0),s=D(),i=D(),l=C(0),c=C([]),a=C(void 0),p=C(void 0),I=C((x,f)=>wt(x,ko[f])),g=C(void 0),h=C(0),w=To(),v=ct(S(n,W(c,t,h),bt(bo,w),Z()),w),m=ct(S(c,Z(),bt((x,f)=>({current:f,prev:x.current}),{current:[],prev:[]}),E(({prev:x})=>x)),[]);F(S(c,P(x=>x.length>0),W(v,h),E(([x,f,R])=>{const B=x.reduce((O,z,V)=>pt(O,z,re(z,f.offsetTree,R)||V),Dt());return{...f,groupIndices:x,groupOffsetTree:B}})),v),F(S(o,W(v),P(([x,{lastIndex:f}])=>x<f),E(([x,{lastIndex:f,lastSize:R}])=>[{endIndex:f,size:R,startIndex:x}])),n),F(a,p);const d=ct(S(a,E(x=>x===void 0)),!0);F(S(p,P(x=>x!==void 0&&K(st(v).sizeTree)),E(x=>[{endIndex:0,size:x,startIndex:0}])),n);const u=ht(S(n,W(v),bt(({sizes:x},[f,R])=>({changed:R!==x,sizes:R}),{changed:!1,sizes:w}),E(x=>x.changed)));U(S(l,bt((x,f)=>({diff:x.prev-f,prev:f}),{diff:0,prev:0}),E(x=>x.diff)),x=>{const{groupIndices:f}=st(v);if(x>0)G(e,!0),G(s,x+mn(x,f));else if(x<0){const R=st(m);R.length>0&&(x-=mn(-x,R)),G(i,x)}}),U(S(l,W(t)),([x,f])=>{x<0&&f("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},at.ERROR)});const T=ht(s);F(S(s,W(v),E(([x,f])=>{const R=f.groupIndices.length>0,B=[],O=f.lastSize;if(R){const z=ne(f.sizeTree,0);let V=0,N=0;for(;V<x;){const k=f.groupIndices[N],Y=f.groupIndices.length===N+1?1/0:f.groupIndices[N+1]-k-1;B.push({endIndex:k,size:z,startIndex:k}),B.push({endIndex:k+1+Y-1,size:O,startIndex:k+1}),N++,V+=Y+1}const J=Gt(f.sizeTree);return V!==x&&J.shift(),J.reduce((k,{k:Y,v:it})=>{let ft=k.ranges;return k.prevSize!==0&&(ft=[...k.ranges,{endIndex:Y+x-1,size:k.prevSize,startIndex:k.prevIndex}]),{prevIndex:Y+x,prevSize:it,ranges:ft}},{prevIndex:x,prevSize:0,ranges:B}).ranges}return Gt(f.sizeTree).reduce((z,{k:V,v:N})=>({prevIndex:V+x,prevSize:N,ranges:[...z.ranges,{endIndex:V+x-1,size:z.prevSize,startIndex:z.prevIndex}]}),{prevIndex:0,prevSize:O,ranges:[]}).ranges})),n);const b=ht(S(i,W(v,h),E(([x,{offsetTree:f},R])=>{const B=-x;return re(B,f,R)})));return F(S(i,W(v,h),E(([x,f,R])=>{if(f.groupIndices.length>0){if(K(f.sizeTree))return f;let O=Dt();const z=st(m);let V=0,N=0,J=0;for(;V<-x;){J=z[N];const k=z[N+1]-J-1;N++,V+=k+1}if(O=Gt(f.sizeTree).reduce((k,{k:Y,v:it})=>pt(k,Math.max(0,Y+x),it),O),V!==-x){const k=ne(f.sizeTree,J);O=pt(O,0,k);const Y=Ct(f.sizeTree,-x+1)[1];O=pt(O,1,Y)}return{...f,sizeTree:O,...ze(f.offsetTree,0,O,R)}}else{const O=Gt(f.sizeTree).reduce((z,{k:V,v:N})=>pt(z,Math.max(0,V+x),N),Dt());return{...f,sizeTree:O,...ze(f.offsetTree,0,O,R)}}})),v),{beforeUnshiftWith:T,data:g,defaultItemSize:p,firstItemIndex:l,fixedItemSize:a,gap:h,groupIndices:c,itemSize:I,listRefresh:u,shiftWith:i,shiftWithOffset:b,sizeRanges:n,sizes:v,statefulTotalCount:r,totalCount:o,trackItemSizes:d,unshiftWith:s}},X(Vt,Ge),{singleton:!0});function Bo(t){return t.reduce((e,n)=>(e.groupIndices.push(e.totalCount),e.totalCount+=n+1,e),{groupIndices:[],totalCount:0})}const Wn=$(([{groupIndices:t,sizes:e,totalCount:n},{headerHeight:o,scrollTop:r}])=>{const s=D(),i=D(),l=ht(S(s,E(Bo)));return F(S(l,E(c=>c.totalCount)),n),F(S(l,E(c=>c.groupIndices)),t),F(S(rt(r,e,o),P(([c,a])=>ye(a)),E(([c,a,p])=>Ct(a.groupOffsetTree,Math.max(c-p,0),"v")[0]),Z(),E(c=>[c])),i),{groupCounts:s,topItemsIndexes:i}},X(Et,dt)),Pt=$(([{log:t}])=>{const e=C(!1),n=ht(S(e,P(o=>o),Z()));return U(e,o=>{o&&st(t)("props updated",{},at.DEBUG)}),{didMount:n,propsReady:e}},X(Vt),{singleton:!0}),Oo=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function _n(t){const e=typeof t=="number"?{index:t}:t;return e.align||(e.align="start"),(!e.behavior||!Oo)&&(e.behavior="auto"),e.offset||(e.offset=0),e}const ie=$(([{gap:t,listRefresh:e,sizes:n,totalCount:o},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:i,headerHeight:l,scrollingInProgress:c,scrollTo:a,smoothScrollTargetReached:p,viewportHeight:I},{log:g}])=>{const h=D(),w=D(),v=C(0);let m=null,d=null,u=null;function T(){m&&(m(),m=null),u&&(u(),u=null),d&&(clearTimeout(d),d=null),G(c,!1)}return F(S(h,W(n,I,o,v,l,i,g),W(t,s,r),E(([[b,x,f,R,B,O,z,V],N,J,nt])=>{const k=_n(b),{align:Y,behavior:it,offset:ft}=k,It=R-1,mt=Gn(k,x,It);let ut=re(mt,x.offsetTree,N)+O;Y==="end"?(ut+=J+Ct(x.sizeTree,mt)[1]-f+nt,mt===It&&(ut+=z)):Y==="center"?ut+=(J+Ct(x.sizeTree,mt)[1]-f+nt)/2:ut-=B,ft&&(ut+=ft);const Mt=St=>{T(),St?(V("retrying to scroll to",{location:b},at.DEBUG),G(h,b)):(G(w,!0),V("list did not change, scroll successful",{},at.DEBUG))};if(T(),it==="smooth"){let St=!1;u=U(e,Yt=>{St=St||Yt}),m=Rt(p,()=>{Mt(St)})}else m=Rt(S(e,Fo(150)),Mt);return d=setTimeout(()=>{T()},1200),G(c,!0),V("scrolling from index to",{behavior:it,index:mt,top:ut},at.DEBUG),{behavior:it,top:ut}})),a),{scrollTargetReached:w,scrollToIndex:h,topListHeight:v}},X(Et,dt,Vt),{singleton:!0});function Fo(t){return e=>{const n=setTimeout(()=>{e(!1)},t);return o=>{o&&(e(!0),clearTimeout(n))}}}function _e(t,e){t==0?e():requestAnimationFrame(()=>{_e(t-1,e)})}function Ne(t,e){const n=e-1;return typeof t=="number"?t:t.index==="LAST"?n:t.index}const le=$(([{defaultItemSize:t,listRefresh:e,sizes:n},{scrollTop:o},{scrollTargetReached:r,scrollToIndex:s},{didMount:i}])=>{const l=C(!0),c=C(0),a=C(!0);return F(S(i,W(c),P(([p,I])=>!!I),yt(!1)),l),F(S(i,W(c),P(([p,I])=>!!I),yt(!1)),a),U(S(rt(e,i),W(l,n,t,a),P(([[,p],I,{sizeTree:g},h,w])=>p&&(!K(g)||Pe(h))&&!I&&!w),W(c)),([,p])=>{Rt(r,()=>{G(a,!0)}),_e(4,()=>{Rt(o,()=>{G(l,!0)}),G(s,p)})}),{initialItemFinalLocationReached:a,initialTopMostItemIndex:c,scrolledToInitialItem:l}},X(Et,dt,ie,Pt),{singleton:!0});function Nn(t,e){return Math.abs(t-e)<1.01}const se="up",Jt="down",Lo="none",zo={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Vo=0,ce=$(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:s}])=>{const i=C(!1),l=C(!0),c=D(),a=D(),p=C(4),I=C(Vo),g=ct(S(an(S(M(r),$t(1),yt(!0)),S(M(r),$t(1),yt(!1),un(100))),Z()),!1),h=ct(S(an(S(n,yt(!0)),S(n,yt(!1),un(200))),Z()),!1);F(S(rt(M(r),M(I)),E(([u,T])=>u<=T),Z()),l),F(S(l,Lt(50)),a);const w=ht(S(rt(o,M(s),M(e),M(t),M(p)),bt((u,[{scrollHeight:T,scrollTop:b},x,f,R,B])=>{const O=b+x-T>-B,z={scrollHeight:T,scrollTop:b,viewportHeight:x};if(O){let N,J;return b>u.state.scrollTop?(N="SCROLLED_DOWN",J=u.state.scrollTop-b):(N="SIZE_DECREASED",J=u.state.scrollTop-b||u.scrollTopDelta),{atBottom:!0,atBottomBecause:N,scrollTopDelta:J,state:z}}let V;return z.scrollHeight>u.state.scrollHeight?V="SIZE_INCREASED":x<u.state.viewportHeight?V="VIEWPORT_HEIGHT_DECREASING":b<u.state.scrollTop?V="SCROLLING_UPWARDS":V="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:V,state:z}},zo),Z((u,T)=>u&&u.atBottom===T.atBottom))),v=ct(S(o,bt((u,{scrollHeight:T,scrollTop:b,viewportHeight:x})=>{if(Nn(u.scrollHeight,T))return{changed:!1,jump:0,scrollHeight:T,scrollTop:b};{const f=T-(b+x)<1;return u.scrollTop!==b&&f?{changed:!0,jump:u.scrollTop-b,scrollHeight:T,scrollTop:b}:{changed:!0,jump:0,scrollHeight:T,scrollTop:b}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),P(u=>u.changed),E(u=>u.jump)),0);F(S(w,E(u=>u.atBottom)),i),F(S(i,Lt(50)),c);const m=C(Jt);F(S(o,E(({scrollTop:u})=>u),Z(),bt((u,T)=>st(h)?{direction:u.direction,prevScrollTop:T}:{direction:T<u.prevScrollTop?se:Jt,prevScrollTop:T},{direction:Jt,prevScrollTop:0}),E(u=>u.direction)),m),F(S(o,Lt(50),yt(Lo)),m);const d=C(0);return F(S(g,P(u=>!u),yt(0)),d),F(S(r,Lt(100),W(g),P(([u,T])=>!!T),bt(([u,T],[b])=>[T,b],[0,0]),E(([u,T])=>T-u)),d),{atBottomState:w,atBottomStateChange:c,atBottomThreshold:p,atTopStateChange:a,atTopThreshold:I,isAtBottom:i,isAtTop:l,isScrolling:g,lastJumpDueToItemResize:v,scrollDirection:m,scrollVelocity:d}},X(dt)),Ie="top",Se="bottom",pn="none";function hn(t,e,n){return typeof t=="number"?n===se&&e===Ie||n===Jt&&e===Se?t:0:n===se?e===Ie?t.main:t.reverse:e===Se?t.main:t.reverse}function gn(t,e){var n;return typeof t=="number"?t:(n=t[e])!=null?n:0}const De=$(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const s=D(),i=C(0),l=C(0),c=C(0),a=ct(S(rt(M(o),M(r),M(n),M(s,oe),M(c),M(i),M(e),M(t),M(l)),E(([p,I,g,[h,w],v,m,d,u,T])=>{const b=p-u,x=m+d,f=Math.max(g-b,0);let R=pn;const B=gn(T,Ie),O=gn(T,Se);return h-=u,h+=g+d,w+=g+d,w-=u,h>p+x-B&&(R=se),w<p-f+I+O&&(R=Jt),R!==pn?[Math.max(b-g-hn(v,Ie,R)-B,0),b-f-d+I+hn(v,Se,R)+O]:null}),P(p=>p!=null),Z(oe)),[0,0]);return{increaseViewportBy:l,listBoundary:s,overscan:c,topListHeight:i,visibleRange:a}},X(dt),{singleton:!0});function Po(t,e,n){if(ye(e)){const o=An(t,e);return[{index:Ct(e.groupOffsetTree,o)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:o,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:t,offset:0,size:0}]}const He={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ge(t,e,n,o,r,s){const{lastIndex:i,lastOffset:l,lastSize:c}=r;let a=0,p=0;if(t.length>0){a=t[0].offset;const v=t[t.length-1];p=v.offset+v.size}const I=n-i,g=l+I*c+(I-1)*o,h=a,w=g-p;return{bottom:p,firstItemIndex:s,items:xn(t,r,s),offsetBottom:w,offsetTop:a,top:h,topItems:xn(e,r,s),topListHeight:e.reduce((v,m)=>m.size+v,0),totalCount:n}}function Dn(t,e,n,o,r,s){let i=0;if(n.groupIndices.length>0)for(const p of n.groupIndices){if(p-i>=t)break;i++}const l=t+i,c=Ne(e,l),a=Array.from({length:l}).map((p,I)=>({data:s[I+c],index:I+c,offset:0,size:0}));return ge(a,[],l,r,n,o)}function xn(t,e,n){if(t.length===0)return[];if(!ye(e))return t.map(a=>({...a,index:a.index+n,originalIndex:a.index}));const o=t[0].index,r=t[t.length-1].index,s=[],i=ve(e.groupOffsetTree,o,r);let l,c=0;for(const a of t){(!l||l.end<a.index)&&(l=i.shift(),c=e.groupIndices.indexOf(l.start));let p;a.index===l.start?p={index:c,type:"group"}:p={groupIndex:c,index:a.index-(c+1)+n},s.push({...p,data:a.data,offset:a.offset,originalIndex:a.index,size:a.size})}return s}const Wt=$(([{data:t,firstItemIndex:e,gap:n,sizes:o,totalCount:r},s,{listBoundary:i,topListHeight:l,visibleRange:c},{initialTopMostItemIndex:a,scrolledToInitialItem:p},{topListHeight:I},g,{didMount:h},{recalcInProgress:w}])=>{const v=C([]),m=C(0),d=D();F(s.topItemsIndexes,v);const u=ct(S(rt(h,w,M(c,oe),M(r),M(o),M(a),p,M(v),M(e),M(n),t),P(([f,R,,B,,,,,,,O])=>{const z=O&&O.length!==B;return f&&!R&&!z}),E(([,,[f,R],B,O,z,V,N,J,nt,k])=>{const Y=O,{offsetTree:it,sizeTree:ft}=Y,It=st(m);if(B===0)return{...He,totalCount:B};if(f===0&&R===0)return It===0?{...He,totalCount:B}:Dn(It,z,O,J,nt,k||[]);if(K(ft))return It>0?null:ge(Po(Ne(z,B),Y,k),[],B,nt,Y,J);const mt=[];if(N.length>0){const jt=N[0],vt=N[N.length-1];let kt=0;for(const y of ve(ft,jt,vt)){const _=y.value,Q=Math.max(y.start,jt),lt=Math.min(y.end,vt);for(let tt=Q;tt<=lt;tt++)mt.push({data:k==null?void 0:k[tt],index:tt,offset:kt,size:_}),kt+=_}}if(!V)return ge([],mt,B,nt,Y,J);const ut=N.length>0?N[N.length-1]+1:0,Mt=yo(it,f,R,ut);if(Mt.length===0)return null;const St=B-1,Yt=we([],jt=>{for(const vt of Mt){const kt=vt.value;let y=kt.offset,_=vt.start;const Q=kt.size;if(kt.offset<f){_+=Math.floor((f-kt.offset+nt)/(Q+nt));const tt=_-vt.start;y+=tt*Q+tt*nt}_<ut&&(y+=(ut-_)*Q,_=ut);const lt=Math.min(vt.end,St);for(let tt=_;tt<=lt&&!(y>=R);tt++)jt.push({data:k==null?void 0:k[tt],index:tt,offset:y,size:Q}),y+=Q+nt}});return ge(Yt,mt,B,nt,Y,J)}),P(f=>f!==null),Z()),He);F(S(t,P(Pe),E(f=>f==null?void 0:f.length)),r),F(S(u,E(f=>f.topListHeight)),I),F(I,l),F(S(u,E(f=>[f.top,f.bottom])),i),F(S(u,E(f=>f.items)),d);const T=ht(S(u,P(({items:f})=>f.length>0),W(r,t),P(([{items:f},R])=>f[f.length-1].originalIndex===R-1),E(([,f,R])=>[f-1,R]),Z(oe),E(([f])=>f))),b=ht(S(u,Lt(200),P(({items:f,topItems:R})=>f.length>0&&f[0].originalIndex===R.length),E(({items:f})=>f[0].index),Z())),x=ht(S(u,P(({items:f})=>f.length>0),E(({items:f})=>{let R=0,B=f.length-1;for(;f[R].type==="group"&&R<B;)R++;for(;f[B].type==="group"&&B>R;)B--;return{endIndex:f[B].index,startIndex:f[R].index}}),Z(Mn)));return{endReached:T,initialItemCount:m,itemsRendered:d,listState:u,rangeChanged:x,startReached:b,topItemsIndexes:v,...g}},X(Et,Wn,De,le,ie,ce,Pt,Ge),{singleton:!0}),$n=$(([{fixedFooterHeight:t,fixedHeaderHeight:e,footerHeight:n,headerHeight:o},{listState:r}])=>{const s=D(),i=ct(S(rt(n,t,o,e,r),E(([l,c,a,p,I])=>l+c+a+p+I.offsetBottom+I.bottom)),0);return F(M(i),s),{totalListHeight:i,totalListHeightChanged:s}},X(dt,Wt),{singleton:!0}),Mo=$(([{viewportHeight:t},{totalListHeight:e}])=>{const n=C(!1),o=ct(S(rt(n,t,e),P(([r])=>r),E(([,r,s])=>Math.max(0,r-s)),Lt(0),Z()),0);return{alignToBottom:n,paddingTopAddition:o}},X(dt,$n),{singleton:!0});function In(t){return t?t==="smooth"?"smooth":"auto":!1}const jo=(t,e)=>typeof t=="function"?In(t(e)):e&&In(t),Ao=$(([{listRefresh:t,totalCount:e,fixedItemSize:n},{atBottomState:o,isAtBottom:r},{scrollToIndex:s},{scrolledToInitialItem:i},{didMount:l,propsReady:c},{log:a},{scrollingInProgress:p}])=>{const I=C(!1),g=D();let h=null;function w(m){G(s,{align:"end",behavior:m,index:"LAST"})}U(S(rt(S(M(e),$t(1)),l),W(M(I),r,i,p),E(([[m,d],u,T,b,x])=>{let f=d&&b,R="auto";return f&&(R=jo(u,T||x),f=f&&!!R),{followOutputBehavior:R,shouldFollow:f,totalCount:m}}),P(({shouldFollow:m})=>m)),({followOutputBehavior:m,totalCount:d})=>{h&&(h(),h=null),st(n)?requestAnimationFrame(()=>{st(a)("following output to ",{totalCount:d},at.DEBUG),w(m)}):h=Rt(t,()=>{st(a)("following output to ",{totalCount:d},at.DEBUG),w(m),h=null})});function v(m){const d=Rt(o,u=>{m&&!u.atBottom&&u.notAtBottomBecause==="SIZE_INCREASED"&&!h&&(st(a)("scrolling to bottom due to increased size",{},at.DEBUG),w("auto"))});setTimeout(d,100)}return U(S(rt(M(I),e,c),P(([m,,d])=>m&&d),bt(({value:m},[,d])=>({refreshed:m===d,value:d}),{refreshed:!1,value:0}),P(({refreshed:m})=>m),W(I,e)),([,m])=>{st(i)&&v(m!==!1)}),U(g,()=>{v(st(I)!==!1)}),U(rt(M(I),o),([m,d])=>{m&&!d.atBottom&&d.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&w("auto")}),{autoscrollToBottom:g,followOutput:I}},X(Et,ce,ie,le,Pt,Vt,dt)),Go=$(([{data:t,firstItemIndex:e,gap:n,sizes:o},{initialTopMostItemIndex:r},{initialItemCount:s,listState:i},{didMount:l}])=>(F(S(l,W(s),P(([,c])=>c!==0),W(r,o,e,n,t),E(([[,c],a,p,I,g,h=[]])=>Dn(c,a,p,I,g,h))),i),{}),X(Et,le,Wt,Pt),{singleton:!0}),Wo=$(([{didMount:t},{scrollTo:e},{listState:n}])=>{const o=C(0);return U(S(t,W(o),P(([,r])=>r!==0),E(([,r])=>({top:r}))),r=>{Rt(S(n,$t(1),P(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{G(e,r)})})}),{initialScrollTop:o}},X(Pt,dt,Wt),{singleton:!0}),_o=({itemBottom:t,itemTop:e,locationParams:{align:n,behavior:o,...r},viewportBottom:s,viewportTop:i})=>e<i?{...r,align:n!=null?n:"start",behavior:o}:t>s?{...r,align:n!=null?n:"end",behavior:o}:null,No=$(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:l,viewportHeight:c},{scrollToIndex:a}])=>{const p=D();return F(S(p,W(e,c,n,s,r,o,l),W(t),E(([[I,g,h,w,v,m,d,u],T])=>{const{align:b,behavior:x,calculateViewLocation:f=_o,done:R,...B}=I,O=Gn(I,g,w-1),z=re(O,g.offsetTree,T)+v+m,V=z+Ct(g.sizeTree,O)[1],N=u+m,J=u+h-d,nt=f({itemBottom:V,itemTop:z,locationParams:{align:b,behavior:x,...B},viewportBottom:J,viewportTop:N});return nt?R&&Rt(S(i,P(k=>!k),$t(st(i)?1:2)),R):R&&R(),nt}),P(I=>I!==null)),a),{scrollIntoView:p}},X(Et,dt,ie,Wt,Vt),{singleton:!0}),Un=$(([{scrollVelocity:t}])=>{const e=C(!1),n=D(),o=C(!1);return F(S(t,W(o,e,n),P(([r,s])=>!!s),E(([r,s,i,l])=>{const{enter:c,exit:a}=s;if(i){if(a(r,l))return!1}else if(c(r,l))return!0;return i}),Z()),e),U(S(rt(e,t,n),W(o)),([[r,s,i],l])=>{r&&l&&l.change&&l.change(s,i)}),{isSeeking:e,scrollSeekConfiguration:o,scrollSeekRangeChanged:n,scrollVelocity:t}},X(ce),{singleton:!0}),$e=$(([{scrollContainerState:t,scrollTo:e}])=>{const n=D(),o=D(),r=D(),s=C(!1),i=C(void 0);return F(S(rt(n,o),E(([{scrollHeight:l,scrollTop:c,viewportHeight:a},{offsetTop:p}])=>({scrollHeight:l,scrollTop:Math.max(0,c-p),viewportHeight:a}))),t),F(S(e,W(o),E(([l,{offsetTop:c}])=>({...l,top:l.top+c}))),r),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:o}},X(dt)),Do=$(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:l,windowViewportRect:c}])=>{const a=D(),p=C(void 0),I=C(null),g=C(null);return F(l,I),F(c,g),U(S(a,W(e,o,i,I,g,n)),([h,w,v,m,d,u,T])=>{const b=Ro(w.sizeTree);m&&d!==null&&u!==null&&(v=d.scrollTop-u.offsetTop),v-=T,h({ranges:b,scrollTop:v})}),F(S(p,P(Pe),E($o)),r),F(S(s,W(p),P(([,h])=>h!==void 0),Z(),E(([,h])=>h.ranges)),t),{getState:a,restoreStateFrom:p}},X(Et,dt,le,Pt,$e));function $o(t){return{align:"start",index:0,offset:t.scrollTop}}const Uo=$(([{topItemsIndexes:t}])=>{const e=C(0);return F(S(e,P(n=>n>=0),E(n=>Array.from({length:n}).map((o,r)=>r))),t),{topItemCount:e}},X(Wt));function Kn(t){let e=!1,n;return()=>(e||(e=!0,n=t()),n)}const Ko=Kn(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),qo=$(([{deviation:t,scrollBy:e,scrollingInProgress:n,scrollTop:o},{isAtBottom:r,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:l},{listState:c},{beforeUnshiftWith:a,gap:p,shiftWithOffset:I,sizes:g},{log:h},{recalcInProgress:w}])=>{const v=ht(S(c,W(i),bt(([,d,u,T],[{bottom:b,items:x,offsetBottom:f,totalCount:R},B])=>{const O=b+f;let z=0;return u===R&&d.length>0&&x.length>0&&(x[0].originalIndex===0&&d[0].originalIndex===0||(z=O-T,z!==0&&(z+=B))),[z,x,R,O]},[0,[],0,0]),P(([d])=>d!==0),W(o,l,n,r,h,w),P(([,d,u,T,,,b])=>!b&&!T&&d!==0&&u===se),E(([[d],,,,,u])=>(u("Upward scrolling compensation",{amount:d},at.DEBUG),d))));function m(d){d>0?(G(e,{behavior:"auto",top:-d}),G(t,0)):(G(t,0),G(e,{behavior:"auto",top:-d}))}return U(S(v,W(t,s)),([d,u,T])=>{T&&Ko()?G(t,u-d):m(-d)}),U(S(rt(ct(s,!1),t,w),P(([d,u,T])=>!d&&!T&&u!==0),E(([d,u])=>u),Lt(1)),m),F(S(I,E(d=>({top:-d}))),e),U(S(a,W(g,p),E(([d,{groupIndices:u,lastSize:T,sizeTree:b},x])=>{function f(R){return R*(T+x)}if(u.length===0)return f(d);{let R=0;const B=ne(b,0);let O=0,z=0;for(;O<d;){O++,R+=B;let V=u.length===z+1?1/0:u[z+1]-u[z]-1;O+V>d&&(R-=B,V=d-O+1),O+=V,R+=f(V),z++}return R}})),d=>{G(t,d),requestAnimationFrame(()=>{G(e,{top:d}),requestAnimationFrame(()=>{G(t,0),G(w,!1)})})}),{deviation:t}},X(dt,ce,Wt,Et,Vt,Ge)),Yo=$(([t,e,n,o,r,s,i,l,c,a])=>({...t,...e,...n,...o,...r,...s,...i,...l,...c,...a}),X(De,Go,Pt,Un,$n,Wo,Mo,$e,No,Vt)),qn=$(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:o,gap:r,groupIndices:s,itemSize:i,sizeRanges:l,sizes:c,statefulTotalCount:a,totalCount:p,trackItemSizes:I},{initialItemFinalLocationReached:g,initialTopMostItemIndex:h,scrolledToInitialItem:w},v,m,d,{listState:u,topItemsIndexes:T,...b},{scrollToIndex:x},f,{topItemCount:R},{groupCounts:B},O])=>(F(b.rangeChanged,O.scrollSeekRangeChanged),F(S(O.windowViewportRect,E(z=>z.visibleHeight)),v.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:o,gap:r,groupCounts:B,initialItemFinalLocationReached:g,initialTopMostItemIndex:h,scrolledToInitialItem:w,sizeRanges:l,topItemCount:R,topItemsIndexes:T,totalCount:p,...d,groupIndices:s,itemSize:i,listState:u,scrollToIndex:x,statefulTotalCount:a,trackItemSizes:I,...b,...O,...v,sizes:c,...m}),X(Et,le,dt,Do,Ao,Wt,ie,qo,Uo,Wn,Yo));function Zo(t,e){const n={},o={};let r=0;const s=t.length;for(;r<s;)o[t[r]]=1,r+=1;for(const i in e)Object.hasOwn(o,i)||(n[i]=e[i]);return n}const me=typeof document<"u"?H.useLayoutEffect:H.useEffect;function Ue(t,e,n){const o=Object.keys(e.required||{}),r=Object.keys(e.optional||{}),s=Object.keys(e.methods||{}),i=Object.keys(e.events||{}),l=H.createContext({});function c(d,u){d.propsReady&&G(d.propsReady,!1);for(const T of o){const b=d[e.required[T]];G(b,u[T])}for(const T of r)if(T in u){const b=d[e.optional[T]];G(b,u[T])}d.propsReady&&G(d.propsReady,!0)}function a(d){return s.reduce((u,T)=>(u[T]=b=>{const x=d[e.methods[T]];G(x,b)},u),{})}function p(d){return i.reduce((u,T)=>(u[T]=fo(d[e.events[T]]),u),{})}const I=H.forwardRef((d,u)=>{const{children:T,...b}=d,[x]=H.useState(()=>we(po(t),B=>{c(B,b)})),[f]=H.useState(cn(p,x));me(()=>{for(const B of i)B in b&&U(f[B],b[B]);return()=>{Object.values(f).map(Me)}},[b,f,x]),me(()=>{c(x,b)}),H.useImperativeHandle(u,ln(a(x)));const R=n;return L.jsx(l.Provider,{value:x,children:n?L.jsx(R,{...Zo([...o,...r,...i],b),children:T}):T})}),g=d=>{const u=H.useContext(l);return H.useCallback(T=>{G(u[d],T)},[u,d])},h=d=>{const T=H.useContext(l)[d],b=H.useCallback(x=>U(T,x),[T]);return H.useSyncExternalStore(b,()=>st(T),()=>st(T))},w=d=>{const T=H.useContext(l)[d],[b,x]=H.useState(cn(st,T));return me(()=>U(T,f=>{f!==b&&x(ln(f))}),[T,b]),b},v=H.version.startsWith("18")?h:w;return{Component:I,useEmitter:(d,u)=>{const b=H.useContext(l)[d];me(()=>U(b,u),[u,b])},useEmitterValue:v,usePublisher:g}}const ue=H.createContext(void 0),Ke=H.createContext(void 0),Yn=typeof document<"u"?H.useLayoutEffect:H.useEffect;function Ee(t){return"self"in t}function Xo(t){return"body"in t}function Zn(t,e,n,o=Kt,r,s){const i=H.useRef(null),l=H.useRef(null),c=H.useRef(null),a=H.useCallback(g=>{let h,w,v;const m=g.target;if(Xo(m)||Ee(m)){const u=Ee(m)?m:m.defaultView;v=s?u.scrollX:u.scrollY,h=s?u.document.documentElement.scrollWidth:u.document.documentElement.scrollHeight,w=s?u.innerWidth:u.innerHeight}else v=s?m.scrollLeft:m.scrollTop,h=s?m.scrollWidth:m.scrollHeight,w=s?m.offsetWidth:m.offsetHeight;const d=()=>{t({scrollHeight:h,scrollTop:Math.max(v,0),viewportHeight:w})};g.suppressFlushSync?d():so.flushSync(d),l.current!==null&&(v===l.current||v<=0||v===h-w)&&(l.current=null,e(!0),c.current&&(clearTimeout(c.current),c.current=null))},[t,e,s]);H.useEffect(()=>{const g=r||i.current;return o(r||i.current),a({suppressFlushSync:!0,target:g}),g.addEventListener("scroll",a,{passive:!0}),()=>{o(null),g.removeEventListener("scroll",a)}},[i,a,n,o,r]);function p(g){const h=i.current;if(!h||(s?"offsetWidth"in h&&h.offsetWidth===0:"offsetHeight"in h&&h.offsetHeight===0))return;const w=g.behavior==="smooth";let v,m,d;Ee(h)?(m=Math.max(wt(h.document.documentElement,s?"width":"height"),s?h.document.documentElement.scrollWidth:h.document.documentElement.scrollHeight),v=s?h.innerWidth:h.innerHeight,d=s?window.scrollX:window.scrollY):(m=h[s?"scrollWidth":"scrollHeight"],v=wt(h,s?"width":"height"),d=h[s?"scrollLeft":"scrollTop"]);const u=m-v;if(g.top=Math.ceil(Math.max(Math.min(u,g.top),0)),Nn(v,m)||g.top===d){t({scrollHeight:m,scrollTop:d,viewportHeight:v}),w&&e(!0);return}w?(l.current=g.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,l.current=null,e(!0)},1e3)):l.current=null,s&&(g={behavior:g.behavior,left:g.top}),h.scrollTo(g)}function I(g){s&&(g={behavior:g.behavior,left:g.top}),i.current.scrollBy(g)}return{scrollByCallback:I,scrollerRef:i,scrollToCallback:p}}const ke="-webkit-sticky",Sn="sticky",qe=Kn(()=>{if(typeof document>"u")return Sn;const t=document.createElement("div");return t.style.position=ke,t.style.position===ke?ke:Sn});function Ye(t){return t}const Jo=$(()=>{const t=C(c=>`Item ${c}`),e=C(null),n=C(c=>`Group ${c}`),o=C({}),r=C(Ye),s=C("div"),i=C(Kt),l=(c,a=null)=>ct(S(o,E(p=>p[c]),Z()),a);return{components:o,computeItemKey:r,context:e,EmptyPlaceholder:l("EmptyPlaceholder"),FooterComponent:l("Footer"),GroupComponent:l("Group","div"),groupContent:n,HeaderComponent:l("Header"),HeaderFooterTag:s,ItemComponent:l("Item","div"),itemContent:t,ListComponent:l("List","div"),ScrollerComponent:l("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TopItemListComponent:l("TopItemList")}}),Qo=$(([t,e])=>({...t,...e}),X(qn,Jo)),tr=({height:t})=>L.jsx("div",{style:{height:t}}),er={overflowAnchor:"none",position:qe(),zIndex:1},Xn={overflowAnchor:"none"},nr={...Xn,display:"inline-block",height:"100%"},Tn=H.memo(function({showTopList:e=!1}){const n=j("listState"),o=gt("sizeRanges"),r=j("useWindowScroll"),s=j("customScrollParent"),i=gt("windowScrollContainerState"),l=gt("scrollContainerState"),c=s||r?i:l,a=j("itemContent"),p=j("context"),I=j("groupContent"),g=j("trackItemSizes"),h=j("itemSize"),w=j("log"),v=gt("gap"),m=j("horizontalDirection"),{callbackRef:d}=On(o,h,g,e?Kt:c,w,v,s,m,j("skipAnimationFrameInResizeObserver")),[u,T]=H.useState(0);Je("deviation",k=>{u!==k&&T(k)});const b=j("EmptyPlaceholder"),x=j("ScrollSeekPlaceholder")||tr,f=j("ListComponent"),R=j("ItemComponent"),B=j("GroupComponent"),O=j("computeItemKey"),z=j("isSeeking"),V=j("groupIndices").length>0,N=j("alignToBottom"),J=j("initialItemFinalLocationReached"),nt=e?{}:{boxSizing:"border-box",...m?{display:"inline-block",height:"100%",marginLeft:u!==0?u:N?"auto":0,paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,whiteSpace:"nowrap"}:{marginTop:u!==0?u:N?"auto":0,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...J?{}:{visibility:"hidden"}};return!e&&n.totalCount===0&&b?L.jsx(b,{...q(b,p)}):L.jsx(f,{...q(f,p),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:d,style:nt,children:(e?n.topItems:n.items).map(k=>{const Y=k.originalIndex,it=O(Y+n.firstItemIndex,k.data,p);return z?H.createElement(x,{...q(x,p),height:k.size,index:k.index,key:it,type:k.type||"item",...k.type==="group"?{}:{groupIndex:k.groupIndex}}):k.type==="group"?H.createElement(B,{...q(B,p),"data-index":Y,"data-item-index":k.index,"data-known-size":k.size,key:it,style:er},I(k.index,p)):H.createElement(R,{...q(R,p),...Jn(R,k.data),"data-index":Y,"data-item-group-index":k.groupIndex,"data-item-index":k.index,"data-known-size":k.size,key:it,style:m?nr:Xn},V?a(k.index,k.groupIndex,k.data,p):a(k.index,k.data,p))})})}),or={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},rr={outline:"none",overflowX:"auto",position:"relative"},qt=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:{}}),sr={position:qe(),top:0,width:"100%",zIndex:1};function q(t,e){if(typeof t!="string")return{context:e}}function Jn(t,e){return{item:typeof t=="string"?void 0:e}}const ir=H.memo(function(){const e=j("HeaderComponent"),n=gt("headerHeight"),o=j("HeaderFooterTag"),r=Ht(H.useMemo(()=>i=>{n(wt(i,"height"))},[n]),!0,j("skipAnimationFrameInResizeObserver")),s=j("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...q(e,s)})}):null}),lr=H.memo(function(){const e=j("FooterComponent"),n=gt("footerHeight"),o=j("HeaderFooterTag"),r=Ht(H.useMemo(()=>i=>{n(wt(i,"height"))},[n]),!0,j("skipAnimationFrameInResizeObserver")),s=j("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...q(e,s)})}):null});function Ze({useEmitter:t,useEmitterValue:e,usePublisher:n}){return H.memo(function({children:s,style:i,...l}){const c=n("scrollContainerState"),a=e("ScrollerComponent"),p=n("smoothScrollTargetReached"),I=e("scrollerRef"),g=e("context"),h=e("horizontalDirection")||!1,{scrollByCallback:w,scrollerRef:v,scrollToCallback:m}=Zn(c,p,a,I,void 0,h);t("scrollTo",m),t("scrollBy",w);const d=h?rr:or;return L.jsx(a,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:v,style:{...d,...i},tabIndex:0,...l,...q(a,g),children:s})})}function Xe({useEmitter:t,useEmitterValue:e,usePublisher:n}){return H.memo(function({children:s,style:i,...l}){const c=n("windowScrollContainerState"),a=e("ScrollerComponent"),p=n("smoothScrollTargetReached"),I=e("totalListHeight"),g=e("deviation"),h=e("customScrollParent"),w=e("context"),v=H.useRef(null),m=e("scrollerRef"),{scrollByCallback:d,scrollerRef:u,scrollToCallback:T}=Zn(c,p,a,m,h);return Yn(()=>{var b;return u.current=h||((b=v.current)==null?void 0:b.ownerDocument.defaultView),()=>{u.current=null}},[u,h]),t("windowScrollTo",T),t("scrollBy",d),L.jsx(a,{ref:v,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...I!==0?{height:I+g}:{}},...l,...q(a,w),children:s})})}const cr=({children:t})=>{const e=H.useContext(ue),n=gt("viewportHeight"),o=gt("fixedItemHeight"),r=j("alignToBottom"),s=j("horizontalDirection"),i=H.useMemo(()=>te(n,c=>wt(c,s?"width":"height")),[n,s]),l=Ht(i,!0,j("skipAnimationFrameInResizeObserver"));return H.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),L.jsx("div",{"data-viewport-type":"element",ref:l,style:qt(r),children:t})},ur=({children:t})=>{const e=H.useContext(ue),n=gt("windowViewportRect"),o=gt("fixedItemHeight"),r=j("customScrollParent"),s=Ae(n,r,j("skipAnimationFrameInResizeObserver")),i=j("alignToBottom");return H.useEffect(()=>{e&&(o(e.itemHeight),n({offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),L.jsx("div",{"data-viewport-type":"window",ref:s,style:qt(i),children:t})},ar=({children:t})=>{const e=j("TopItemListComponent")||"div",n=j("headerHeight"),o={...sr,marginTop:`${n}px`},r=j("context");return L.jsx(e,{style:o,...q(e,r),children:t})},dr=H.memo(function(e){const n=j("useWindowScroll"),o=j("topItemsIndexes").length>0,r=j("customScrollParent"),s=j("context"),i=r||n?mr:fr,l=r||n?ur:cr;return L.jsxs(i,{...e,...q(i,s),children:[o&&L.jsx(ar,{children:L.jsx(Tn,{showTopList:!0})}),L.jsxs(l,{children:[L.jsx(ir,{}),L.jsx(Tn,{}),L.jsx(lr,{})]})]})}),{Component:Qn,useEmitter:Je,useEmitterValue:j,usePublisher:gt}=Ue(Qo,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",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",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},dr),fr=Ze({useEmitter:Je,useEmitterValue:j,usePublisher:gt}),mr=Xe({useEmitter:Je,useEmitterValue:j,usePublisher:gt}),pr=Qn,hr=Qn,gr=$(()=>{const t=C(a=>L.jsxs("td",{children:["Item $",a]})),e=C(null),n=C(a=>L.jsxs("td",{colSpan:1e3,children:["Group ",a]})),o=C(null),r=C(null),s=C({}),i=C(Ye),l=C(Kt),c=(a,p=null)=>ct(S(s,E(I=>I[a]),Z()),p);return{components:s,computeItemKey:i,context:e,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:r,fixedHeaderContent:o,itemContent:t,groupContent:n,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}}),xr=$(([t,e])=>({...t,...e}),X(qn,gr)),Ir=({height:t})=>L.jsx("tr",{children:L.jsx("td",{style:{height:t}})}),Sr=({height:t})=>L.jsx("tr",{children:L.jsx("td",{style:{border:0,height:t,padding:0}})}),Tr={overflowAnchor:"none"},Cn={position:qe(),zIndex:2,overflowAnchor:"none"},wn=H.memo(function({showTopList:e=!1}){const n=A("listState"),o=A("computeItemKey"),r=A("firstItemIndex"),s=A("context"),i=A("isSeeking"),l=A("fixedHeaderHeight"),c=A("groupIndices").length>0,a=A("itemContent"),p=A("groupContent"),I=A("ScrollSeekPlaceholder")||Ir,g=A("GroupComponent"),h=A("TableRowComponent"),w=(e?n.topItems:[]).reduce((m,d,u)=>(u===0?m.push(d.size):m.push(m[u-1]+d.size),m),[]),v=(e?n.topItems:n.items).map(m=>{const d=m.originalIndex,u=o(d+r,m.data,s),T=e?d===0?0:w[d-1]:0;return i?H.createElement(I,{...q(I,s),height:m.size,index:m.index,key:u,type:m.type||"item"}):m.type==="group"?H.createElement(g,{...q(g,s),"data-index":d,"data-item-index":m.index,"data-known-size":m.size,key:u,style:{...Cn,top:l}},p(m.index,s)):H.createElement(h,{...q(h,s),...Jn(h,m.data),"data-index":d,"data-item-index":m.index,"data-known-size":m.size,"data-item-group-index":m.groupIndex,key:u,style:e?{...Cn,top:l+T}:Tr},c?a(m.index,m.groupIndex,m.data,s):a(m.index,m.data,s))});return L.jsx(L.Fragment,{children:v})}),Cr=H.memo(function(){const e=A("listState"),n=A("topItemsIndexes").length>0,o=Tt("sizeRanges"),r=A("useWindowScroll"),s=A("customScrollParent"),i=Tt("windowScrollContainerState"),l=Tt("scrollContainerState"),c=s||r?i:l,a=A("trackItemSizes"),p=A("itemSize"),I=A("log"),{callbackRef:g,ref:h}=On(o,p,a,c,I,void 0,s,!1,A("skipAnimationFrameInResizeObserver")),[w,v]=H.useState(0);Qe("deviation",V=>{w!==V&&(h.current.style.marginTop=`${V}px`,v(V))});const m=A("EmptyPlaceholder"),d=A("FillerRow")||Sr,u=A("TableBodyComponent"),T=A("paddingTopAddition"),b=A("statefulTotalCount"),x=A("context");if(b===0&&m)return L.jsx(m,{...q(m,x)});const f=(n?e.topItems:[]).reduce((V,N)=>V+N.size,0),R=e.offsetTop+T+w-f,B=e.offsetBottom,O=R>0?L.jsx(d,{context:x,height:R},"padding-top"):null,z=B>0?L.jsx(d,{context:x,height:B},"padding-bottom"):null;return L.jsxs(u,{"data-testid":"virtuoso-item-list",ref:g,...q(u,x),children:[O,n&&L.jsx(wn,{showTopList:!0}),L.jsx(wn,{}),z]})}),wr=({children:t})=>{const e=H.useContext(ue),n=Tt("viewportHeight"),o=Tt("fixedItemHeight"),r=Ht(H.useMemo(()=>te(n,s=>wt(s,"height")),[n]),!0,A("skipAnimationFrameInResizeObserver"));return H.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),L.jsx("div",{"data-viewport-type":"element",ref:r,style:qt(!1),children:t})},vr=({children:t})=>{const e=H.useContext(ue),n=Tt("windowViewportRect"),o=Tt("fixedItemHeight"),r=A("customScrollParent"),s=Ae(n,r,A("skipAnimationFrameInResizeObserver"));return H.useEffect(()=>{e&&(o(e.itemHeight),n({offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),L.jsx("div",{"data-viewport-type":"window",ref:s,style:qt(!1),children:t})},yr=H.memo(function(e){const n=A("useWindowScroll"),o=A("customScrollParent"),r=Tt("fixedHeaderHeight"),s=Tt("fixedFooterHeight"),i=A("fixedHeaderContent"),l=A("fixedFooterContent"),c=A("context"),a=Ht(H.useMemo(()=>te(r,u=>wt(u,"height")),[r]),!0,A("skipAnimationFrameInResizeObserver")),p=Ht(H.useMemo(()=>te(s,u=>wt(u,"height")),[s]),!0,A("skipAnimationFrameInResizeObserver")),I=o||n?Rr:br,g=o||n?vr:wr,h=A("TableComponent"),w=A("TableHeadComponent"),v=A("TableFooterComponent"),m=i?L.jsx(w,{ref:a,style:{position:"sticky",top:0,zIndex:2},...q(w,c),children:i()},"TableHead"):null,d=l?L.jsx(v,{ref:p,style:{bottom:0,position:"sticky",zIndex:1},...q(v,c),children:l()},"TableFoot"):null;return L.jsx(I,{...e,...q(I,c),children:L.jsx(g,{children:L.jsxs(h,{style:{borderSpacing:0,overflowAnchor:"none"},...q(h,c),children:[m,L.jsx(Cr,{},"TableBody"),d]})})})}),{Component:to,useEmitter:Qe,useEmitterValue:A,usePublisher:Tt}=Ue(xr,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},yr),br=Ze({useEmitter:Qe,useEmitterValue:A,usePublisher:Tt}),Rr=Xe({useEmitter:Qe,useEmitterValue:A,usePublisher:Tt}),Hr=to,Er=to,vn={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},kr={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:yn,floor:Te,max:Qt,min:Be,round:bn}=Math;function Rn(t,e,n){return Array.from({length:e-t+1}).map((o,r)=>({data:n===null?null:n[r+t],index:r+t}))}function Br(t){return{...kr,items:t}}function pe(t,e){return t&&t.width===e.width&&t.height===e.height}function Or(t,e){return t&&t.column===e.column&&t.row===e.row}const Fr=$(([{increaseViewportBy:t,listBoundary:e,overscan:n,visibleRange:o},{footerHeight:r,headerHeight:s,scrollBy:i,scrollContainerState:l,scrollTo:c,scrollTop:a,smoothScrollTargetReached:p,viewportHeight:I},g,h,{didMount:w,propsReady:v},{customScrollParent:m,useWindowScroll:d,windowScrollContainerState:u,windowScrollTo:T,windowViewportRect:b},x])=>{const f=C(0),R=C(0),B=C(vn),O=C({height:0,width:0}),z=C({height:0,width:0}),V=D(),N=D(),J=C(0),nt=C(null),k=C({column:0,row:0}),Y=D(),it=D(),ft=C(!1),It=C(0),mt=C(!0),ut=C(!1),Mt=C(!1);U(S(w,W(It),P(([y,_])=>!!_)),()=>{G(mt,!1)}),U(S(rt(w,mt,z,O,It,ut),P(([y,_,Q,lt,,tt])=>y&&!_&&Q.height!==0&<.height!==0&&!tt)),([,,,,y])=>{G(ut,!0),_e(1,()=>{G(V,y)}),Rt(S(a),()=>{G(e,[0,0]),G(mt,!0)})}),F(S(it,P(y=>y!=null&&y.scrollTop>0),yt(0)),R),U(S(w,W(it),P(([,y])=>y!=null)),([,y])=>{y&&(G(O,y.viewport),G(z,y.item),G(k,y.gap),y.scrollTop>0&&(G(ft,!0),Rt(S(a,$t(1)),_=>{G(ft,!1)}),G(c,{top:y.scrollTop})))}),F(S(O,E(({height:y})=>y)),I),F(S(rt(M(O,pe),M(z,pe),M(k,(y,_)=>y&&y.column===_.column&&y.row===_.row),M(a)),E(([y,_,Q,lt])=>({gap:Q,item:_,scrollTop:lt,viewport:y}))),Y),F(S(rt(M(f),o,M(k,Or),M(z,pe),M(O,pe),M(nt),M(R),M(ft),M(mt),M(It)),P(([,,,,,,,y])=>!y),E(([y,[_,Q],lt,tt,Bt,Zt,_t,,ae,Ot])=>{const{column:Ft,row:Xt}=lt,{height:de,width:be}=tt,{width:tn}=Bt;if(_t===0&&(y===0||tn===0))return vn;if(be===0){const sn=Ne(Ot,y),ro=sn+Math.max(_t-1,0);return Br(Rn(sn,ro,Zt))}const fe=eo(tn,be,Ft);let Nt,At;ae?_===0&&Q===0&&_t>0?(Nt=0,At=_t-1):(Nt=fe*Te((_+Xt)/(de+Xt)),At=fe*yn((Q+Xt)/(de+Xt))-1,At=Be(y-1,Qt(At,fe-1)),Nt=Be(At,Qt(0,Nt))):(Nt=0,At=-1);const en=Rn(Nt,At,Zt),{bottom:nn,top:on}=Hn(Bt,lt,tt,en),rn=yn(y/fe),oo=rn*de+(rn-1)*Xt-nn;return{bottom:nn,itemHeight:de,items:en,itemWidth:be,offsetBottom:oo,offsetTop:on,top:on}})),B),F(S(nt,P(y=>y!==null),E(y=>y.length)),f),F(S(rt(O,z,B,k),P(([y,_,{items:Q}])=>Q.length>0&&_.height!==0&&y.height!==0),E(([y,_,{items:Q},lt])=>{const{bottom:tt,top:Bt}=Hn(y,lt,_,Q);return[Bt,tt]}),Z(oe)),e);const St=C(!1);F(S(a,W(St),E(([y,_])=>_||y!==0)),St);const Yt=ht(S(rt(B,f),P(([{items:y}])=>y.length>0),W(St),P(([[y,_],Q])=>{const tt=y.items[y.items.length-1].index===_-1;return(Q||y.bottom>0&&y.itemHeight>0&&y.offsetBottom===0&&y.items.length===_)&&tt}),E(([[,y]])=>y-1),Z())),jt=ht(S(M(B),P(({items:y})=>y.length>0&&y[0].index===0),yt(0),Z())),vt=ht(S(M(B),W(ft),P(([{items:y},_])=>y.length>0&&!_),E(([{items:y}])=>({endIndex:y[y.length-1].index,startIndex:y[0].index})),Z(Mn),Lt(0)));F(vt,h.scrollSeekRangeChanged),F(S(V,W(O,z,f,k),E(([y,_,Q,lt,tt])=>{const Bt=_n(y),{align:Zt,behavior:_t,offset:ae}=Bt;let Ot=Bt.index;Ot==="LAST"&&(Ot=lt-1),Ot=Qt(0,Ot,Be(lt-1,Ot));let Ft=Ve(_,tt,Q,Ot);return Zt==="end"?Ft=bn(Ft-_.height+Q.height):Zt==="center"&&(Ft=bn(Ft-_.height/2+Q.height/2)),ae&&(Ft+=ae),{behavior:_t,top:Ft}})),c);const kt=ct(S(B,E(y=>y.offsetBottom+y.bottom)),0);return F(S(b,E(y=>({height:y.visibleHeight,width:y.visibleWidth}))),O),{customScrollParent:m,data:nt,deviation:J,footerHeight:r,gap:k,headerHeight:s,increaseViewportBy:t,initialItemCount:R,itemDimensions:z,overscan:n,restoreStateFrom:it,scrollBy:i,scrollContainerState:l,scrollHeight:N,scrollTo:c,scrollToIndex:V,scrollTop:a,smoothScrollTargetReached:p,totalCount:f,useWindowScroll:d,viewportDimensions:O,windowScrollContainerState:u,windowScrollTo:T,windowViewportRect:b,...h,gridState:B,horizontalDirection:Mt,initialTopMostItemIndex:It,totalListHeight:kt,...g,endReached:Yt,propsReady:v,rangeChanged:vt,startReached:jt,stateChanged:Y,stateRestoreInProgress:ft,...x}},X(De,dt,ce,Un,Pt,$e,Vt));function eo(t,e,n){return Qt(1,Te((t+n)/(Te(e)+n)))}function Hn(t,e,n,o){const{height:r}=n;if(r===void 0||o.length===0)return{bottom:0,top:0};const s=Ve(t,e,n,o[0].index);return{bottom:Ve(t,e,n,o[o.length-1].index)+r,top:s}}function Ve(t,e,n,o){const r=eo(t.width,n.width,e.column),s=Te(o/r),i=s*n.height+Qt(0,s-1)*e.row;return i>0?i+e.row:i}const Lr=$(()=>{const t=C(I=>`Item ${I}`),e=C({}),n=C(null),o=C("virtuoso-grid-item"),r=C("virtuoso-grid-list"),s=C(Ye),i=C("div"),l=C(Kt),c=(I,g=null)=>ct(S(e,E(h=>h[I]),Z()),g),a=C(!1),p=C(!1);return F(M(p),a),{components:e,computeItemKey:s,context:n,FooterComponent:c("Footer"),HeaderComponent:c("Header"),headerFooterTag:i,itemClassName:o,ItemComponent:c("Item","div"),itemContent:t,listClassName:r,ListComponent:c("List","div"),readyStateChanged:a,reportReadyState:p,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}),zr=$(([t,e])=>({...t,...e}),X(Fr,Lr)),Vr=H.memo(function(){const e=et("gridState"),n=et("listClassName"),o=et("itemClassName"),r=et("itemContent"),s=et("computeItemKey"),i=et("isSeeking"),l=xt("scrollHeight"),c=et("ItemComponent"),a=et("ListComponent"),p=et("ScrollSeekPlaceholder"),I=et("context"),g=xt("itemDimensions"),h=xt("gap"),w=et("log"),v=et("stateRestoreInProgress"),m=xt("reportReadyState"),d=Ht(H.useMemo(()=>u=>{const T=u.parentElement.parentElement.scrollHeight;l(T);const b=u.firstChild;if(b){const{height:x,width:f}=b.getBoundingClientRect();g({height:x,width:f})}h({column:En("column-gap",getComputedStyle(u).columnGap,w),row:En("row-gap",getComputedStyle(u).rowGap,w)})},[l,g,h,w]),!0,!1);return Yn(()=>{e.itemHeight>0&&e.itemWidth>0&&m(!0)},[e]),v?null:L.jsx(a,{className:n,ref:d,...q(a,I),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(u=>{const T=s(u.index,u.data,I);return i?L.jsx(p,{...q(p,I),height:e.itemHeight,index:u.index,width:e.itemWidth},T):H.createElement(c,{...q(c,I),className:o,"data-index":u.index,key:T},r(u.index,u.data,I))})})}),Pr=H.memo(function(){const e=et("HeaderComponent"),n=xt("headerHeight"),o=et("headerFooterTag"),r=Ht(H.useMemo(()=>i=>{n(wt(i,"height"))},[n]),!0,!1),s=et("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...q(e,s)})}):null}),Mr=H.memo(function(){const e=et("FooterComponent"),n=xt("footerHeight"),o=et("headerFooterTag"),r=Ht(H.useMemo(()=>i=>{n(wt(i,"height"))},[n]),!0,!1),s=et("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...q(e,s)})}):null}),jr=({children:t})=>{const e=H.useContext(Ke),n=xt("itemDimensions"),o=xt("viewportDimensions"),r=Ht(H.useMemo(()=>s=>{o(s.getBoundingClientRect())},[o]),!0,!1);return H.useEffect(()=>{e&&(o({height:e.viewportHeight,width:e.viewportWidth}),n({height:e.itemHeight,width:e.itemWidth}))},[e,o,n]),L.jsx("div",{ref:r,style:qt(!1),children:t})},Ar=({children:t})=>{const e=H.useContext(Ke),n=xt("windowViewportRect"),o=xt("itemDimensions"),r=et("customScrollParent"),s=Ae(n,r,!1);return H.useEffect(()=>{e&&(o({height:e.itemHeight,width:e.itemWidth}),n({offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:e.viewportWidth}))},[e,n,o]),L.jsx("div",{ref:s,style:qt(!1),children:t})},Gr=H.memo(function({...e}){const n=et("useWindowScroll"),o=et("customScrollParent"),r=o||n?Nr:_r,s=o||n?Ar:jr,i=et("context");return L.jsx(r,{...e,...q(r,i),children:L.jsxs(s,{children:[L.jsx(Pr,{}),L.jsx(Vr,{}),L.jsx(Mr,{})]})})}),{Component:Wr,useEmitter:no,useEmitterValue:et,usePublisher:xt}=Ue(zr,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Gr),_r=Ze({useEmitter:no,useEmitterValue:et,usePublisher:xt}),Nr=Xe({useEmitter:no,useEmitterValue:et,usePublisher:xt});function En(t,e,n){return e!=="normal"&&!(e!=null&&e.endsWith("px"))&&n(`${t} was not resolved to pixel value correctly`,e,at.WARN),e==="normal"?0:parseInt(e!=null?e:"0",10)}const Dr=Wr;exports.GroupedTableVirtuoso=Er;exports.GroupedVirtuoso=hr;exports.LogLevel=at;exports.TableVirtuoso=Hr;exports.Virtuoso=pr;exports.VirtuosoGrid=Dr;exports.VirtuosoGridMockContext=Ke;exports.VirtuosoMockContext=ue;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),H=require("react"),lo=require("react-dom"),Ce=0,zt=1,Ut=2,kn=4;function cn(t){return()=>t}function co(t){t()}function te(t,e){return n=>t(e(n))}function un(t,e){return()=>t(e)}function uo(t,e){return n=>t(e,n)}function Me(t){return t!==void 0}function ao(...t){return()=>{t.map(co)}}function Kt(){}function we(t,e){return e(t),t}function fo(t,e){return e(t)}function X(...t){return t}function U(t,e){return t(zt,e)}function G(t,e){t(Ce,e)}function je(t){t(Ut)}function ot(t){return t(kn)}function O(t,e){return U(t,uo(e,Ce))}function Tt(t,e){const n=t(zt,o=>{n(),e(o)});return n}function an(t){let e,n;return o=>r=>{e=r,n&&clearTimeout(n),n=setTimeout(()=>{o(e)},t)}}function Bn(t,e){return t===e}function Z(t=Bn){let e;return n=>o=>{t(e,o)||(e=o,n(o))}}function M(t){return e=>n=>{t(n)&&e(n)}}function E(t){return e=>te(e,t)}function bt(t){return e=>()=>{e(t)}}function S(t,...e){const n=mo(...e);return(o,r)=>{switch(o){case Ut:je(t);return;case zt:return U(t,n(r))}}}function Rt(t,e){return n=>o=>{n(e=t(e,o))}}function Wt(t){return e=>n=>{t>0?t--:e(n)}}function Bt(t){let e=null,n;return o=>r=>{e=r,!n&&(n=setTimeout(()=>{n=void 0,o(e)},t))}}function _(...t){const e=new Array(t.length);let n=0,o=null;const r=Math.pow(2,t.length)-1;return t.forEach((s,i)=>{const l=Math.pow(2,i);U(s,c=>{const a=n;n=n|l,e[i]=c,a!==r&&n===r&&o&&(o(),o=null)})}),s=>i=>{const l=()=>{s([i].concat(e))};n===r?l():o=l}}function mo(...t){return e=>t.reduceRight(fo,e)}function po(t){let e,n;const o=()=>e==null?void 0:e();return function(r,s){switch(r){case zt:return s?n===s?void 0:(o(),n=s,e=U(t,s),e):(o(),Kt);case Ut:o(),n=null;return}}}function C(t){let e=t;const n=D();return(o,r)=>{switch(o){case Ce:e=r;break;case zt:{r(e);break}case kn:return e}return n(o,r)}}function ct(t,e){return we(C(e),n=>O(t,n))}function D(){const t=[];return(e,n)=>{switch(e){case Ce:t.slice().forEach(o=>{o(n)});return;case Ut:t.splice(0,t.length);return;case zt:return t.push(n),()=>{const o=t.indexOf(n);o>-1&&t.splice(o,1)}}}}function ht(t){return we(D(),e=>O(t,e))}function $(t,e=[],{singleton:n}={singleton:!0}){return{constructor:t,dependencies:e,id:ho(),singleton:n}}const ho=()=>Symbol();function go(t){const e=new Map,n=({constructor:o,dependencies:r,id:s,singleton:i})=>{if(i&&e.has(s))return e.get(s);const l=o(r.map(c=>n(c)));return i&&e.set(s,l),l};return n(t)}function rt(...t){const e=D(),n=new Array(t.length);let o=0;const r=Math.pow(2,t.length)-1;return t.forEach((s,i)=>{const l=Math.pow(2,i);U(s,c=>{n[i]=c,o=o|l,o===r&&G(e,n)})}),function(s,i){switch(s){case Ut:{je(e);return}case zt:return o===r&&i(n),U(e,i)}}}function P(t,e=Bn){return S(t,Z(e))}function Fe(...t){return function(e,n){switch(e){case Ut:return;case zt:return ao(...t.map(o=>U(o,n)))}}}var at=(t=>(t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR",t))(at||{});const xo={0:"debug",3:"error",1:"log",2:"warn"},Io=()=>typeof globalThis>"u"?window:globalThis,Vt=$(()=>{const t=C(3);return{log:C((n,o,r=1)=>{var i;const s=(i=Io().VIRTUOSO_LOG_LEVEL)!=null?i:ot(t);r>=s&&console[xo[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0});function Ht(t,e,n){return Ae(t,e,n).callbackRef}function Ae(t,e,n){const o=H.useRef(null);let r=i=>{};const s=H.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const l=()=>{const c=i[0].target;c.offsetParent!==null&&t(c)};n?l():requestAnimationFrame(l)}):null,[t,n]);return r=i=>{i&&e?(s==null||s.observe(i),o.current=i):(o.current&&(s==null||s.unobserve(o.current)),o.current=null)},{callbackRef:r,ref:o}}function Fn(t,e,n,o,r,s,i,l,c){const a=H.useCallback(m=>{const I=So(m.children,e,l?"offsetWidth":"offsetHeight",r);let g=m.parentElement;for(;!g.dataset.virtuosoScroller;)g=g.parentElement;const x=g.lastElementChild.dataset.viewportType==="window";let w;x&&(w=g.ownerDocument.defaultView);const v=i?l?i.scrollLeft:i.scrollTop:x?l?w.scrollX||w.document.documentElement.scrollLeft:w.scrollY||w.document.documentElement.scrollTop:l?g.scrollLeft:g.scrollTop,h=i?l?i.scrollWidth:i.scrollHeight:x?l?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight:l?g.scrollWidth:g.scrollHeight,p=i?l?i.offsetWidth:i.offsetHeight:x?l?w.innerWidth:w.innerHeight:l?g.offsetWidth:g.offsetHeight;o({scrollHeight:h,scrollTop:Math.max(v,0),viewportHeight:p}),s==null||s(l?dn("column-gap",getComputedStyle(m).columnGap,r):dn("row-gap",getComputedStyle(m).rowGap,r)),I!==null&&t(I)},[t,e,r,s,i,o,l]);return Ae(a,n,c)}function So(t,e,n,o){const r=t.length;if(r===0)return null;const s=[];for(let i=0;i<r;i++){const l=t.item(i);if(l.dataset.index===void 0)continue;const c=parseInt(l.dataset.index),a=parseFloat(l.dataset.knownSize),m=e(l,n);if(m===0&&o("Zero-sized element, this should not happen",{child:l},at.ERROR),m===a)continue;const I=s[s.length-1];s.length===0||I.size!==m||I.endIndex!==c-1?s.push({endIndex:c,size:m,startIndex:c}):s[s.length-1].endIndex++}return s}function dn(t,e,n){return e!=="normal"&&!(e!=null&&e.endsWith("px"))&&n(`${t} was not resolved to pixel value correctly`,e,at.WARN),e==="normal"?0:parseInt(e!=null?e:"0",10)}function Ge(t,e,n){const o=H.useRef(null),r=H.useCallback(c=>{if(!(c!=null&&c.offsetParent))return;const a=c.getBoundingClientRect(),m=a.width;let I,g;if(e){const x=e.getBoundingClientRect(),w=a.top-x.top;g=x.height-Math.max(0,w),I=w+e.scrollTop}else{const x=i.current.ownerDocument.defaultView;g=x.innerHeight-Math.max(0,a.top),I=a.top+x.scrollY}o.current={offsetTop:I,visibleHeight:g,visibleWidth:m},t(o.current)},[t,e]),{callbackRef:s,ref:i}=Ae(r,!0,n),l=H.useCallback(()=>{r(i.current)},[r,i]);return H.useEffect(()=>{var c;if(e){e.addEventListener("scroll",l);const a=new ResizeObserver(()=>{requestAnimationFrame(l)});return a.observe(e),()=>{e.removeEventListener("scroll",l),a.unobserve(e)}}else{const a=(c=i.current)==null?void 0:c.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",l),a==null||a.addEventListener("resize",l),()=>{a==null||a.removeEventListener("scroll",l),a==null||a.removeEventListener("resize",l)}}},[l,e,i]),s}const dt=$(()=>{const t=D(),e=D(),n=C(0),o=D(),r=C(0),s=D(),i=D(),l=C(0),c=C(0),a=C(0),m=C(0),I=D(),g=D(),x=C(!1),w=C(!1),v=C(!1);return O(S(t,E(({scrollTop:h})=>h)),e),O(S(t,E(({scrollHeight:h})=>h)),i),O(e,r),{deviation:n,fixedFooterHeight:a,fixedHeaderHeight:c,footerHeight:m,headerHeight:l,horizontalDirection:w,scrollBy:g,scrollContainerState:t,scrollHeight:i,scrollingInProgress:x,scrollTo:I,scrollTop:e,skipAnimationFrameInResizeObserver:v,smoothScrollTargetReached:o,statefulScrollTop:r,viewportHeight:s}},[],{singleton:!0}),ee={lvl:0};function On(t,e){const n=t.length;if(n===0)return[];let{index:o,value:r}=e(t[0]);const s=[];for(let i=1;i<n;i++){const{index:l,value:c}=e(t[i]);s.push({end:l-1,start:o,value:r}),o=l,r=c}return s.push({end:1/0,start:o,value:r}),s}function K(t){return t===ee}function ne(t,e){if(!K(t))return e===t.k?t.v:e<t.k?ne(t.l,e):ne(t.r,e)}function wt(t,e,n="k"){if(K(t))return[-1/0,void 0];if(Number(t[n])===e)return[t.k,t.v];if(Number(t[n])<e){const o=wt(t.r,e,n);return o[0]===-1/0?[t.k,t.v]:o}return wt(t.l,e,n)}function pt(t,e,n){return K(t)?Vn(e,n,1):e===t.k?st(t,{k:e,v:n}):e<t.k?fn(st(t,{l:pt(t.l,e,n)})):fn(st(t,{r:pt(t.r,e,n)}))}function $t(){return ee}function ve(t,e,n){if(K(t))return[];const o=wt(t,e)[0];return To(Le(t,o,n))}function Oe(t,e){if(K(t))return ee;const{k:n,l:o,r}=t;if(e===n){if(K(o))return r;if(K(r))return o;{const[s,i]=zn(o);return he(st(t,{k:s,l:Ln(o),v:i}))}}else return e<n?he(st(t,{l:Oe(o,e)})):he(st(t,{r:Oe(r,e)}))}function Gt(t){return K(t)?[]:[...Gt(t.l),{k:t.k,v:t.v},...Gt(t.r)]}function Le(t,e,n){if(K(t))return[];const{k:o,l:r,r:s,v:i}=t;let l=[];return o>e&&(l=l.concat(Le(r,e,n))),o>=e&&o<=n&&l.push({k:o,v:i}),o<=n&&(l=l.concat(Le(s,e,n))),l}function he(t){const{l:e,lvl:n,r:o}=t;if(o.lvl>=n-1&&e.lvl>=n-1)return t;if(n>o.lvl+1){if(Re(e))return Pn(st(t,{lvl:n-1}));if(!K(e)&&!K(e.r))return st(e.r,{l:st(e,{r:e.r.l}),lvl:n,r:st(t,{l:e.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(Re(t))return ze(st(t,{lvl:n-1}));if(!K(o)&&!K(o.l)){const r=o.l,s=Re(r)?o.lvl-1:o.lvl;return st(r,{l:st(t,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:ze(st(o,{l:r.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function st(t,e){return Vn(e.k!==void 0?e.k:t.k,e.v!==void 0?e.v:t.v,e.lvl!==void 0?e.lvl:t.lvl,e.l!==void 0?e.l:t.l,e.r!==void 0?e.r:t.r)}function Ln(t){return K(t.r)?t.l:he(st(t,{r:Ln(t.r)}))}function Re(t){return K(t)||t.lvl>t.r.lvl}function zn(t){return K(t.r)?[t.k,t.v]:zn(t.r)}function Vn(t,e,n,o=ee,r=ee){return{k:t,l:o,lvl:n,r,v:e}}function fn(t){return ze(Pn(t))}function Pn(t){const{l:e}=t;return!K(e)&&e.lvl===t.lvl?st(e,{r:st(t,{l:e.r})}):t}function ze(t){const{lvl:e,r:n}=t;return!K(n)&&!K(n.r)&&n.lvl===e&&n.r.lvl===e?st(n,{l:st(t,{r:n.l}),lvl:e+1}):t}function To(t){return On(t,({k:e,v:n})=>({index:e,value:n}))}function Mn(t,e){return!!(t&&t.startIndex===e.startIndex&&t.endIndex===e.endIndex)}function oe(t,e){return!!(t&&t[0]===e[0]&&t[1]===e[1])}const We=$(()=>({recalcInProgress:C(!1)}),[],{singleton:!0});function jn(t,e,n){return t[xe(t,e,n)]}function xe(t,e,n,o=0){let r=t.length-1;for(;o<=r;){const s=Math.floor((o+r)/2),i=t[s],l=n(i,e);if(l===0)return s;if(l===-1){if(r-o<2)return s-1;r=s-1}else{if(r===o)return s;o=s+1}}throw new Error(`Failed binary finding record in array - ${t.join(",")}, searched for ${e}`)}function Co(t,e,n,o){const r=xe(t,e,o),s=xe(t,n,o,r);return t.slice(r,s+1)}function vt(t,e){return Math.round(t.getBoundingClientRect()[e])}function ye(t){return!K(t.groupOffsetTree)}function _e({index:t},e){return e===t?0:e<t?-1:1}function wo(){return{groupIndices:[],groupOffsetTree:$t(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:$t()}}function vo(t,e){let n=K(t)?0:1/0;for(const o of e){const{endIndex:r,size:s,startIndex:i}=o;if(n=Math.min(n,i),K(t)){t=pt(t,0,s);continue}const l=ve(t,i-1,r+1);if(l.some(Bo(o)))continue;let c=!1,a=!1;for(const{end:m,start:I,value:g}of l)c?(r>=I||s===g)&&(t=Oe(t,I)):(a=g!==s,c=!0),m>r&&r>=I&&g!==s&&(t=pt(t,r+1,g));a&&(t=pt(t,i,s))}return[t,n]}function yo(t){return typeof t.groupIndex<"u"}function bo({offset:t},e){return e===t?0:e<t?-1:1}function re(t,e,n){if(e.length===0)return 0;const{index:o,offset:r,size:s}=jn(e,t,_e),i=t-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function An(t,e){if(!ye(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function Gn(t,e,n){if(yo(t))return e.groupIndices[t.groupIndex]+1;{const o=t.index==="LAST"?n:t.index;let r=An(o,e);return r=Math.max(0,r,Math.min(n,r)),r}}function Ro(t,e,n,o=0){return o>0&&(e=Math.max(e,jn(t,o,_e).offset)),On(Co(t,e,n,bo),ko)}function Ho(t,[e,n,o,r]){e.length>0&&o("received item sizes",e,at.DEBUG);const s=t.sizeTree;let i=s,l=0;if(n.length>0&&K(s)&&e.length===2){const g=e[0].size,x=e[1].size;i=n.reduce((w,v)=>pt(pt(w,v,g),v+1,x),i)}else[i,l]=vo(i,e);if(i===s)return t;const{lastIndex:c,lastOffset:a,lastSize:m,offsetTree:I}=Ve(t.offsetTree,l,i,r);return{groupIndices:n,groupOffsetTree:n.reduce((g,x)=>pt(g,x,re(x,I,r)),$t()),lastIndex:c,lastOffset:a,lastSize:m,offsetTree:I,sizeTree:i}}function Eo(t){return Gt(t).map(({k:e,v:n},o,r)=>{const s=r[o+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:e}})}function mn(t,e){let n=0,o=0;for(;n<t;)n+=e[o+1]-e[o]-1,o++;return o-(n===t?0:1)}function Ve(t,e,n,o){let r=t,s=0,i=0,l=0,c=0;if(e!==0){c=xe(r,e-1,_e),l=r[c].offset;const m=wt(n,e-1);s=m[0],i=m[1],r.length&&r[c].size===wt(n,e)[1]&&(c-=1),r=r.slice(0,c+1)}else r=[];for(const{start:a,value:m}of ve(n,e,1/0)){const I=a-s,g=I*i+l+I*o;r.push({index:a,offset:g,size:m}),s=a,l=g,i=m}return{lastIndex:s,lastOffset:l,lastSize:i,offsetTree:r}}function ko(t){return{index:t.index,value:t}}function Bo(t){const{endIndex:e,size:n,startIndex:o}=t;return r=>r.start===o&&(r.end===e||r.end===1/0)&&r.value===n}const Fo={offsetHeight:"height",offsetWidth:"width"},Et=$(([{log:t},{recalcInProgress:e}])=>{const n=D(),o=D(),r=ct(o,0),s=D(),i=D(),l=C(0),c=C([]),a=C(void 0),m=C(void 0),I=C((f,d)=>vt(f,Fo[d])),g=C(void 0),x=C(0),w=wo(),v=ct(S(n,_(c,t,x),Rt(Ho,w),Z()),w),h=ct(S(c,Z(),Rt((f,d)=>({current:d,prev:f.current}),{current:[],prev:[]}),E(({prev:f})=>f)),[]);O(S(c,M(f=>f.length>0),_(v,x),E(([f,d,y])=>{const k=f.reduce((B,z,V)=>pt(B,z,re(z,d.offsetTree,y)||V),$t());return{...d,groupIndices:f,groupOffsetTree:k}})),v),O(S(o,_(v),M(([f,{lastIndex:d}])=>f<d),E(([f,{lastIndex:d,lastSize:y}])=>[{endIndex:d,size:y,startIndex:f}])),n),O(a,m);const p=ct(S(a,E(f=>f===void 0)),!0);O(S(m,M(f=>f!==void 0&&K(ot(v).sizeTree)),E(f=>[{endIndex:0,size:f,startIndex:0}])),n);const u=ht(S(n,_(v),Rt(({sizes:f},[d,y])=>({changed:y!==f,sizes:y}),{changed:!1,sizes:w}),E(f=>f.changed)));U(S(l,Rt((f,d)=>({diff:f.prev-d,prev:d}),{diff:0,prev:0}),E(f=>f.diff)),f=>{const{groupIndices:d}=ot(v);if(f>0)G(e,!0),G(s,f+mn(f,d));else if(f<0){const y=ot(h);y.length>0&&(f-=mn(-f,y)),G(i,f)}}),U(S(l,_(t)),([f,d])=>{f<0&&d("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},at.ERROR)});const T=ht(s);O(S(s,_(v),E(([f,d])=>{const y=d.groupIndices.length>0,k=[],B=d.lastSize;if(y){const z=ne(d.sizeTree,0);let V=0,W=0;for(;V<f;){const F=d.groupIndices[W],Y=d.groupIndices.length===W+1?1/0:d.groupIndices[W+1]-F-1;k.push({endIndex:F,size:z,startIndex:F}),k.push({endIndex:F+1+Y-1,size:B,startIndex:F+1}),W++,V+=Y+1}const J=Gt(d.sizeTree);return V!==f&&J.shift(),J.reduce((F,{k:Y,v:it})=>{let ft=F.ranges;return F.prevSize!==0&&(ft=[...F.ranges,{endIndex:Y+f-1,size:F.prevSize,startIndex:F.prevIndex}]),{prevIndex:Y+f,prevSize:it,ranges:ft}},{prevIndex:f,prevSize:0,ranges:k}).ranges}return Gt(d.sizeTree).reduce((z,{k:V,v:W})=>({prevIndex:V+f,prevSize:W,ranges:[...z.ranges,{endIndex:V+f-1,size:z.prevSize,startIndex:z.prevIndex}]}),{prevIndex:0,prevSize:B,ranges:[]}).ranges})),n);const R=ht(S(i,_(v,x),E(([f,{offsetTree:d},y])=>{const k=-f;return re(k,d,y)})));return O(S(i,_(v,x),E(([f,d,y])=>{if(d.groupIndices.length>0){if(K(d.sizeTree))return d;let B=$t();const z=ot(h);let V=0,W=0,J=0;for(;V<-f;){J=z[W];const F=z[W+1]-J-1;W++,V+=F+1}if(B=Gt(d.sizeTree).reduce((F,{k:Y,v:it})=>pt(F,Math.max(0,Y+f),it),B),V!==-f){const F=ne(d.sizeTree,J);B=pt(B,0,F);const Y=wt(d.sizeTree,-f+1)[1];B=pt(B,1,Y)}return{...d,sizeTree:B,...Ve(d.offsetTree,0,B,y)}}else{const B=Gt(d.sizeTree).reduce((z,{k:V,v:W})=>pt(z,Math.max(0,V+f),W),$t());return{...d,sizeTree:B,...Ve(d.offsetTree,0,B,y)}}})),v),{beforeUnshiftWith:T,data:g,defaultItemSize:m,firstItemIndex:l,fixedItemSize:a,gap:x,groupIndices:c,itemSize:I,listRefresh:u,shiftWith:i,shiftWithOffset:R,sizeRanges:n,sizes:v,statefulTotalCount:r,totalCount:o,trackItemSizes:p,unshiftWith:s}},X(Vt,We),{singleton:!0});function Oo(t){return t.reduce((e,n)=>(e.groupIndices.push(e.totalCount),e.totalCount+=n+1,e),{groupIndices:[],totalCount:0})}const Wn=$(([{groupIndices:t,sizes:e,totalCount:n},{headerHeight:o,scrollTop:r}])=>{const s=D(),i=D(),l=ht(S(s,E(Oo)));return O(S(l,E(c=>c.totalCount)),n),O(S(l,E(c=>c.groupIndices)),t),O(S(rt(r,e,o),M(([c,a])=>ye(a)),E(([c,a,m])=>wt(a.groupOffsetTree,Math.max(c-m,0),"v")[0]),Z(),E(c=>[c])),i),{groupCounts:s,topItemsIndexes:i}},X(Et,dt)),Pt=$(([{log:t}])=>{const e=C(!1),n=ht(S(e,M(o=>o),Z()));return U(e,o=>{o&&ot(t)("props updated",{},at.DEBUG)}),{didMount:n,propsReady:e}},X(Vt),{singleton:!0}),Lo=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function _n(t){const e=typeof t=="number"?{index:t}:t;return e.align||(e.align="start"),(!e.behavior||!Lo)&&(e.behavior="auto"),e.offset||(e.offset=0),e}const ie=$(([{gap:t,listRefresh:e,sizes:n,totalCount:o},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:i,headerHeight:l,scrollingInProgress:c,scrollTo:a,smoothScrollTargetReached:m,viewportHeight:I},{log:g}])=>{const x=D(),w=D(),v=C(0);let h=null,p=null,u=null;function T(){h&&(h(),h=null),u&&(u(),u=null),p&&(clearTimeout(p),p=null),G(c,!1)}return O(S(x,_(n,I,o,v,l,i,g),_(t,s,r),E(([[R,f,d,y,k,B,z,V],W,J,nt])=>{const F=_n(R),{align:Y,behavior:it,offset:ft}=F,It=y-1,mt=Gn(F,f,It);let ut=re(mt,f.offsetTree,W)+B;Y==="end"?(ut+=J+wt(f.sizeTree,mt)[1]-d+nt,mt===It&&(ut+=z)):Y==="center"?ut+=(J+wt(f.sizeTree,mt)[1]-d+nt)/2:ut-=k,ft&&(ut+=ft);const Mt=St=>{T(),St?(V("retrying to scroll to",{location:R},at.DEBUG),G(x,R)):(G(w,!0),V("list did not change, scroll successful",{},at.DEBUG))};if(T(),it==="smooth"){let St=!1;u=U(e,Yt=>{St=St||Yt}),h=Tt(m,()=>{Mt(St)})}else h=Tt(S(e,zo(150)),Mt);return p=setTimeout(()=>{T()},1200),G(c,!0),V("scrolling from index to",{behavior:it,index:mt,top:ut},at.DEBUG),{behavior:it,top:ut}})),a),{scrollTargetReached:w,scrollToIndex:x,topListHeight:v}},X(Et,dt,Vt),{singleton:!0});function zo(t){return e=>{const n=setTimeout(()=>{e(!1)},t);return o=>{o&&(e(!0),clearTimeout(n))}}}function Ne(t,e){t==0?e():requestAnimationFrame(()=>{Ne(t-1,e)})}function De(t,e){const n=e-1;return typeof t=="number"?t:t.index==="LAST"?n:t.index}const le=$(([{defaultItemSize:t,listRefresh:e,sizes:n},{scrollTop:o},{scrollTargetReached:r,scrollToIndex:s},{didMount:i}])=>{const l=C(!0),c=C(0),a=C(!0);return O(S(i,_(c),M(([m,I])=>!!I),bt(!1)),l),O(S(i,_(c),M(([m,I])=>!!I),bt(!1)),a),U(S(rt(e,i),_(l,n,t,a),M(([[,m],I,{sizeTree:g},x,w])=>m&&(!K(g)||Me(x))&&!I&&!w),_(c)),([,m])=>{Tt(r,()=>{G(a,!0)}),Ne(4,()=>{Tt(o,()=>{G(l,!0)}),G(s,m)})}),{initialItemFinalLocationReached:a,initialTopMostItemIndex:c,scrolledToInitialItem:l}},X(Et,dt,ie,Pt),{singleton:!0});function Nn(t,e){return Math.abs(t-e)<1.01}const se="up",Jt="down",Vo="none",Po={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Mo=0,ce=$(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:s}])=>{const i=C(!1),l=C(!0),c=D(),a=D(),m=C(4),I=C(Mo),g=ct(S(Fe(S(P(r),Wt(1),bt(!0)),S(P(r),Wt(1),bt(!1),an(100))),Z()),!1),x=ct(S(Fe(S(n,bt(!0)),S(n,bt(!1),an(200))),Z()),!1);O(S(rt(P(r),P(I)),E(([u,T])=>u<=T),Z()),l),O(S(l,Bt(50)),a);const w=ht(S(rt(o,P(s),P(e),P(t),P(m)),Rt((u,[{scrollHeight:T,scrollTop:R},f,d,y,k])=>{const B=R+f-T>-k,z={scrollHeight:T,scrollTop:R,viewportHeight:f};if(B){let W,J;return R>u.state.scrollTop?(W="SCROLLED_DOWN",J=u.state.scrollTop-R):(W="SIZE_DECREASED",J=u.state.scrollTop-R||u.scrollTopDelta),{atBottom:!0,atBottomBecause:W,scrollTopDelta:J,state:z}}let V;return z.scrollHeight>u.state.scrollHeight?V="SIZE_INCREASED":f<u.state.viewportHeight?V="VIEWPORT_HEIGHT_DECREASING":R<u.state.scrollTop?V="SCROLLING_UPWARDS":V="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:V,state:z}},Po),Z((u,T)=>u&&u.atBottom===T.atBottom))),v=ct(S(o,Rt((u,{scrollHeight:T,scrollTop:R,viewportHeight:f})=>{if(Nn(u.scrollHeight,T))return{changed:!1,jump:0,scrollHeight:T,scrollTop:R};{const d=T-(R+f)<1;return u.scrollTop!==R&&d?{changed:!0,jump:u.scrollTop-R,scrollHeight:T,scrollTop:R}:{changed:!0,jump:0,scrollHeight:T,scrollTop:R}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),M(u=>u.changed),E(u=>u.jump)),0);O(S(w,E(u=>u.atBottom)),i),O(S(i,Bt(50)),c);const h=C(Jt);O(S(o,E(({scrollTop:u})=>u),Z(),Rt((u,T)=>ot(x)?{direction:u.direction,prevScrollTop:T}:{direction:T<u.prevScrollTop?se:Jt,prevScrollTop:T},{direction:Jt,prevScrollTop:0}),E(u=>u.direction)),h),O(S(o,Bt(50),bt(Vo)),h);const p=C(0);return O(S(g,M(u=>!u),bt(0)),p),O(S(r,Bt(100),_(g),M(([u,T])=>!!T),Rt(([u,T],[R])=>[T,R],[0,0]),E(([u,T])=>T-u)),p),{atBottomState:w,atBottomStateChange:c,atBottomThreshold:m,atTopStateChange:a,atTopThreshold:I,isAtBottom:i,isAtTop:l,isScrolling:g,lastJumpDueToItemResize:v,scrollDirection:h,scrollVelocity:p}},X(dt)),Ie="top",Se="bottom",pn="none";function hn(t,e,n){return typeof t=="number"?n===se&&e===Ie||n===Jt&&e===Se?t:0:n===se?e===Ie?t.main:t.reverse:e===Se?t.main:t.reverse}function gn(t,e){var n;return typeof t=="number"?t:(n=t[e])!=null?n:0}const $e=$(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const s=D(),i=C(0),l=C(0),c=C(0),a=ct(S(rt(P(o),P(r),P(n),P(s,oe),P(c),P(i),P(e),P(t),P(l)),E(([m,I,g,[x,w],v,h,p,u,T])=>{const R=m-u,f=h+p,d=Math.max(g-R,0);let y=pn;const k=gn(T,Ie),B=gn(T,Se);return x-=u,x+=g+p,w+=g+p,w-=u,x>m+f-k&&(y=se),w<m-d+I+B&&(y=Jt),y!==pn?[Math.max(R-g-hn(v,Ie,y)-k,0),R-d-p+I+hn(v,Se,y)+B]:null}),M(m=>m!=null),Z(oe)),[0,0]);return{increaseViewportBy:l,listBoundary:s,overscan:c,topListHeight:i,visibleRange:a}},X(dt),{singleton:!0});function jo(t,e,n){if(ye(e)){const o=An(t,e);return[{index:wt(e.groupOffsetTree,o)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:o,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:t,offset:0,size:0}]}const He={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ge(t,e,n,o,r,s){const{lastIndex:i,lastOffset:l,lastSize:c}=r;let a=0,m=0;if(t.length>0){a=t[0].offset;const v=t[t.length-1];m=v.offset+v.size}const I=n-i,g=l+I*c+(I-1)*o,x=a,w=g-m;return{bottom:m,firstItemIndex:s,items:xn(t,r,s),offsetBottom:w,offsetTop:a,top:x,topItems:xn(e,r,s),topListHeight:e.reduce((v,h)=>h.size+v,0),totalCount:n}}function Dn(t,e,n,o,r,s){let i=0;if(n.groupIndices.length>0)for(const m of n.groupIndices){if(m-i>=t)break;i++}const l=t+i,c=De(e,l),a=Array.from({length:l}).map((m,I)=>({data:s[I+c],index:I+c,offset:0,size:0}));return ge(a,[],l,r,n,o)}function xn(t,e,n){if(t.length===0)return[];if(!ye(e))return t.map(a=>({...a,index:a.index+n,originalIndex:a.index}));const o=t[0].index,r=t[t.length-1].index,s=[],i=ve(e.groupOffsetTree,o,r);let l,c=0;for(const a of t){(!l||l.end<a.index)&&(l=i.shift(),c=e.groupIndices.indexOf(l.start));let m;a.index===l.start?m={index:c,type:"group"}:m={groupIndex:c,index:a.index-(c+1)+n},s.push({...m,data:a.data,offset:a.offset,originalIndex:a.index,size:a.size})}return s}const _t=$(([{data:t,firstItemIndex:e,gap:n,sizes:o,totalCount:r},s,{listBoundary:i,topListHeight:l,visibleRange:c},{initialTopMostItemIndex:a,scrolledToInitialItem:m},{topListHeight:I},g,{didMount:x},{recalcInProgress:w}])=>{const v=C([]),h=C(0),p=D();O(s.topItemsIndexes,v);const u=ct(S(rt(x,w,P(c,oe),P(r),P(o),P(a),m,P(v),P(e),P(n),t),M(([d,y,,k,,,,,,,B])=>{const z=B&&B.length!==k;return d&&!y&&!z}),E(([,,[d,y],k,B,z,V,W,J,nt,F])=>{const Y=B,{offsetTree:it,sizeTree:ft}=Y,It=ot(h);if(k===0)return{...He,totalCount:k};if(d===0&&y===0)return It===0?{...He,totalCount:k}:Dn(It,z,B,J,nt,F||[]);if(K(ft))return It>0?null:ge(jo(De(z,k),Y,F),[],k,nt,Y,J);const mt=[];if(W.length>0){const jt=W[0],yt=W[W.length-1];let kt=0;for(const b of ve(ft,jt,yt)){const N=b.value,Q=Math.max(b.start,jt),lt=Math.min(b.end,yt);for(let tt=Q;tt<=lt;tt++)mt.push({data:F==null?void 0:F[tt],index:tt,offset:kt,size:N}),kt+=N}}if(!V)return ge([],mt,k,nt,Y,J);const ut=W.length>0?W[W.length-1]+1:0,Mt=Ro(it,d,y,ut);if(Mt.length===0)return null;const St=k-1,Yt=we([],jt=>{for(const yt of Mt){const kt=yt.value;let b=kt.offset,N=yt.start;const Q=kt.size;if(kt.offset<d){N+=Math.floor((d-kt.offset+nt)/(Q+nt));const tt=N-yt.start;b+=tt*Q+tt*nt}N<ut&&(b+=(ut-N)*Q,N=ut);const lt=Math.min(yt.end,St);for(let tt=N;tt<=lt&&!(b>=y);tt++)jt.push({data:F==null?void 0:F[tt],index:tt,offset:b,size:Q}),b+=Q+nt}});return ge(Yt,mt,k,nt,Y,J)}),M(d=>d!==null),Z()),He);O(S(t,M(Me),E(d=>d==null?void 0:d.length)),r),O(S(u,E(d=>d.topListHeight)),I),O(I,l),O(S(u,E(d=>[d.top,d.bottom])),i),O(S(u,E(d=>d.items)),p);const T=ht(S(u,M(({items:d})=>d.length>0),_(r,t),M(([{items:d},y])=>d[d.length-1].originalIndex===y-1),E(([,d,y])=>[d-1,y]),Z(oe),E(([d])=>d))),R=ht(S(u,Bt(200),M(({items:d,topItems:y})=>d.length>0&&d[0].originalIndex===y.length),E(({items:d})=>d[0].index),Z())),f=ht(S(u,M(({items:d})=>d.length>0),E(({items:d})=>{let y=0,k=d.length-1;for(;d[y].type==="group"&&y<k;)y++;for(;d[k].type==="group"&&k>y;)k--;return{endIndex:d[k].index,startIndex:d[y].index}}),Z(Mn)));return{endReached:T,initialItemCount:h,itemsRendered:p,listState:u,rangeChanged:f,startReached:R,topItemsIndexes:v,...g}},X(Et,Wn,$e,le,ie,ce,Pt,We),{singleton:!0}),$n=$(([{fixedFooterHeight:t,fixedHeaderHeight:e,footerHeight:n,headerHeight:o},{listState:r}])=>{const s=D(),i=ct(S(rt(n,t,o,e,r),E(([l,c,a,m,I])=>l+c+a+m+I.offsetBottom+I.bottom)),0);return O(P(i),s),{totalListHeight:i,totalListHeightChanged:s}},X(dt,_t),{singleton:!0}),Ao=$(([{viewportHeight:t},{totalListHeight:e}])=>{const n=C(!1),o=ct(S(rt(n,t,e),M(([r])=>r),E(([,r,s])=>Math.max(0,r-s)),Bt(0),Z()),0);return{alignToBottom:n,paddingTopAddition:o}},X(dt,$n),{singleton:!0}),Un=$(()=>({context:C(null)})),Go=({itemBottom:t,itemTop:e,locationParams:{align:n,behavior:o,...r},viewportBottom:s,viewportTop:i})=>e<i?{...r,align:n!=null?n:"start",behavior:o}:t>s?{...r,align:n!=null?n:"end",behavior:o}:null,Kn=$(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:l,viewportHeight:c},{scrollToIndex:a}])=>{const m=D();return O(S(m,_(e,c,n,s,r,o,l),_(t),E(([[I,g,x,w,v,h,p,u],T])=>{const{align:R,behavior:f,calculateViewLocation:d=Go,done:y,...k}=I,B=Gn(I,g,w-1),z=re(B,g.offsetTree,T)+v+h,V=z+wt(g.sizeTree,B)[1],W=u+h,J=u+x-p,nt=d({itemBottom:V,itemTop:z,locationParams:{align:R,behavior:f,...k},viewportBottom:J,viewportTop:W});return nt?y&&Tt(S(i,M(F=>!F),Wt(ot(i)?1:2)),y):y&&y(),nt}),M(I=>I!==null)),a),{scrollIntoView:m}},X(Et,dt,ie,_t,Vt),{singleton:!0});function In(t){return t?t==="smooth"?"smooth":"auto":!1}const Wo=(t,e)=>typeof t=="function"?In(t(e)):e&&In(t),_o=$(([{listRefresh:t,totalCount:e,fixedItemSize:n,data:o},{atBottomState:r,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:l},{didMount:c,propsReady:a},{log:m},{scrollingInProgress:I},{context:g},{scrollIntoView:x}])=>{const w=C(!1),v=D();let h=null;function p(f){G(i,{align:"end",behavior:f,index:"LAST"})}U(S(rt(S(P(e),Wt(1)),c),_(P(w),s,l,I),E(([[f,d],y,k,B,z])=>{let V=d&&B,W="auto";return V&&(W=Wo(y,k||z),V=V&&!!W),{followOutputBehavior:W,shouldFollow:V,totalCount:f}}),M(({shouldFollow:f})=>f)),({followOutputBehavior:f,totalCount:d})=>{h&&(h(),h=null),ot(n)?requestAnimationFrame(()=>{ot(m)("following output to ",{totalCount:d},at.DEBUG),p(f)}):h=Tt(t,()=>{ot(m)("following output to ",{totalCount:d},at.DEBUG),p(f),h=null})});function u(f){const d=Tt(r,y=>{f&&!y.atBottom&&y.notAtBottomBecause==="SIZE_INCREASED"&&!h&&(ot(m)("scrolling to bottom due to increased size",{},at.DEBUG),p("auto"))});setTimeout(d,100)}U(S(rt(P(w),e,a),M(([f,,d])=>f&&d),Rt(({value:f},[,d])=>({refreshed:f===d,value:d}),{refreshed:!1,value:0}),M(({refreshed:f})=>f),_(w,e)),([,f])=>{ot(l)&&u(f!==!1)}),U(v,()=>{u(ot(w)!==!1)}),U(rt(P(w),r),([f,d])=>{f&&!d.atBottom&&d.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&p("auto")});const T=C(null),R=D();return O(Fe(S(P(o),E(f=>{var d;return(d=f==null?void 0:f.length)!=null?d:0})),S(P(e))),R),U(S(rt(S(R,Wt(1)),c),_(P(T),l,I,g),E(([[f,d],y,k,B,z])=>d&&k&&(y==null?void 0:y({context:z,totalCount:f,scrollingInProgress:B}))),M(f=>!!f),Bt(0)),f=>{h&&(h(),h=null),ot(n)?requestAnimationFrame(()=>{ot(m)("scrolling into view",{}),G(x,f)}):h=Tt(t,()=>{ot(m)("scrolling into view",{}),G(x,f),h=null})}),{autoscrollToBottom:v,followOutput:w,scrollIntoViewOnChange:T}},X(Et,ce,ie,le,Pt,Vt,dt,Un,Kn)),No=$(([{data:t,firstItemIndex:e,gap:n,sizes:o},{initialTopMostItemIndex:r},{initialItemCount:s,listState:i},{didMount:l}])=>(O(S(l,_(s),M(([,c])=>c!==0),_(r,o,e,n,t),E(([[,c],a,m,I,g,x=[]])=>Dn(c,a,m,I,g,x))),i),{}),X(Et,le,_t,Pt),{singleton:!0}),Do=$(([{didMount:t},{scrollTo:e},{listState:n}])=>{const o=C(0);return U(S(t,_(o),M(([,r])=>r!==0),E(([,r])=>({top:r}))),r=>{Tt(S(n,Wt(1),M(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{G(e,r)})})}),{initialScrollTop:o}},X(Pt,dt,_t),{singleton:!0}),qn=$(([{scrollVelocity:t}])=>{const e=C(!1),n=D(),o=C(!1);return O(S(t,_(o,e,n),M(([r,s])=>!!s),E(([r,s,i,l])=>{const{enter:c,exit:a}=s;if(i){if(a(r,l))return!1}else if(c(r,l))return!0;return i}),Z()),e),U(S(rt(e,t,n),_(o)),([[r,s,i],l])=>{r&&l&&l.change&&l.change(s,i)}),{isSeeking:e,scrollSeekConfiguration:o,scrollSeekRangeChanged:n,scrollVelocity:t}},X(ce),{singleton:!0}),Ue=$(([{scrollContainerState:t,scrollTo:e}])=>{const n=D(),o=D(),r=D(),s=C(!1),i=C(void 0);return O(S(rt(n,o),E(([{scrollHeight:l,scrollTop:c,viewportHeight:a},{offsetTop:m}])=>({scrollHeight:l,scrollTop:Math.max(0,c-m),viewportHeight:a}))),t),O(S(e,_(o),E(([l,{offsetTop:c}])=>({...l,top:l.top+c}))),r),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:o}},X(dt)),$o=$(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:l,windowViewportRect:c}])=>{const a=D(),m=C(void 0),I=C(null),g=C(null);return O(l,I),O(c,g),U(S(a,_(e,o,i,I,g,n)),([x,w,v,h,p,u,T])=>{const R=Eo(w.sizeTree);h&&p!==null&&u!==null&&(v=p.scrollTop-u.offsetTop),v-=T,x({ranges:R,scrollTop:v})}),O(S(m,M(Me),E(Uo)),r),O(S(s,_(m),M(([,x])=>x!==void 0),Z(),E(([,x])=>x.ranges)),t),{getState:a,restoreStateFrom:m}},X(Et,dt,le,Pt,Ue));function Uo(t){return{align:"start",index:0,offset:t.scrollTop}}const Ko=$(([{topItemsIndexes:t}])=>{const e=C(0);return O(S(e,M(n=>n>=0),E(n=>Array.from({length:n}).map((o,r)=>r))),t),{topItemCount:e}},X(_t));function Yn(t){let e=!1,n;return()=>(e||(e=!0,n=t()),n)}const qo=Yn(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Yo=$(([{deviation:t,scrollBy:e,scrollingInProgress:n,scrollTop:o},{isAtBottom:r,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:l},{listState:c},{beforeUnshiftWith:a,gap:m,shiftWithOffset:I,sizes:g},{log:x},{recalcInProgress:w}])=>{const v=ht(S(c,_(i),Rt(([,p,u,T],[{bottom:R,items:f,offsetBottom:d,totalCount:y},k])=>{const B=R+d;let z=0;return u===y&&p.length>0&&f.length>0&&(f[0].originalIndex===0&&p[0].originalIndex===0||(z=B-T,z!==0&&(z+=k))),[z,f,y,B]},[0,[],0,0]),M(([p])=>p!==0),_(o,l,n,r,x,w),M(([,p,u,T,,,R])=>!R&&!T&&p!==0&&u===se),E(([[p],,,,,u])=>(u("Upward scrolling compensation",{amount:p},at.DEBUG),p))));function h(p){p>0?(G(e,{behavior:"auto",top:-p}),G(t,0)):(G(t,0),G(e,{behavior:"auto",top:-p}))}return U(S(v,_(t,s)),([p,u,T])=>{T&&qo()?G(t,u-p):h(-p)}),U(S(rt(ct(s,!1),t,w),M(([p,u,T])=>!p&&!T&&u!==0),E(([p,u])=>u),Bt(1)),h),O(S(I,E(p=>({top:-p}))),e),U(S(a,_(g,m),E(([p,{groupIndices:u,lastSize:T,sizeTree:R},f])=>{function d(y){return y*(T+f)}if(u.length===0)return d(p);{let y=0;const k=ne(R,0);let B=0,z=0;for(;B<p;){B++,y+=k;let V=u.length===z+1?1/0:u[z+1]-u[z]-1;B+V>p&&(y-=k,V=p-B+1),B+=V,y+=d(V),z++}return y}})),p=>{G(t,p),requestAnimationFrame(()=>{G(e,{top:p}),requestAnimationFrame(()=>{G(t,0),G(w,!1)})})}),{deviation:t}},X(dt,ce,_t,Et,Vt,We)),Zo=$(([t,e,n,o,r,s,i,l,c,a,m])=>({...t,...e,...n,...o,...r,...s,...i,...l,...c,...a,...m}),X($e,No,Pt,qn,$n,Do,Ao,Ue,Kn,Vt,Un)),Zn=$(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:o,gap:r,groupIndices:s,itemSize:i,sizeRanges:l,sizes:c,statefulTotalCount:a,totalCount:m,trackItemSizes:I},{initialItemFinalLocationReached:g,initialTopMostItemIndex:x,scrolledToInitialItem:w},v,h,p,{listState:u,topItemsIndexes:T,...R},{scrollToIndex:f},d,{topItemCount:y},{groupCounts:k},B])=>(O(R.rangeChanged,B.scrollSeekRangeChanged),O(S(B.windowViewportRect,E(z=>z.visibleHeight)),v.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:o,gap:r,groupCounts:k,initialItemFinalLocationReached:g,initialTopMostItemIndex:x,scrolledToInitialItem:w,sizeRanges:l,topItemCount:y,topItemsIndexes:T,totalCount:m,...p,groupIndices:s,itemSize:i,listState:u,scrollToIndex:f,statefulTotalCount:a,trackItemSizes:I,...R,...B,...v,sizes:c,...h}),X(Et,le,dt,$o,_o,_t,ie,Yo,Ko,Wn,Zo));function Xo(t,e){const n={},o={};let r=0;const s=t.length;for(;r<s;)o[t[r]]=1,r+=1;for(const i in e)Object.hasOwn(o,i)||(n[i]=e[i]);return n}const me=typeof document<"u"?H.useLayoutEffect:H.useEffect;function Ke(t,e,n){const o=Object.keys(e.required||{}),r=Object.keys(e.optional||{}),s=Object.keys(e.methods||{}),i=Object.keys(e.events||{}),l=H.createContext({});function c(p,u){p.propsReady&&G(p.propsReady,!1);for(const T of o){const R=p[e.required[T]];G(R,u[T])}for(const T of r)if(T in u){const R=p[e.optional[T]];G(R,u[T])}p.propsReady&&G(p.propsReady,!0)}function a(p){return s.reduce((u,T)=>(u[T]=R=>{const f=p[e.methods[T]];G(f,R)},u),{})}function m(p){return i.reduce((u,T)=>(u[T]=po(p[e.events[T]]),u),{})}const I=H.forwardRef((p,u)=>{const{children:T,...R}=p,[f]=H.useState(()=>we(go(t),k=>{c(k,R)})),[d]=H.useState(un(m,f));me(()=>{for(const k of i)k in R&&U(d[k],R[k]);return()=>{Object.values(d).map(je)}},[R,d,f]),me(()=>{c(f,R)}),H.useImperativeHandle(u,cn(a(f)));const y=n;return L.jsx(l.Provider,{value:f,children:n?L.jsx(y,{...Xo([...o,...r,...i],R),children:T}):T})}),g=p=>{const u=H.useContext(l);return H.useCallback(T=>{G(u[p],T)},[u,p])},x=p=>{const T=H.useContext(l)[p],R=H.useCallback(f=>U(T,f),[T]);return H.useSyncExternalStore(R,()=>ot(T),()=>ot(T))},w=p=>{const T=H.useContext(l)[p],[R,f]=H.useState(un(ot,T));return me(()=>U(T,d=>{d!==R&&f(cn(d))}),[T,R]),R},v=H.version.startsWith("18")?x:w;return{Component:I,useEmitter:(p,u)=>{const R=H.useContext(l)[p];me(()=>U(R,u),[u,R])},useEmitterValue:v,usePublisher:g}}const ue=H.createContext(void 0),qe=H.createContext(void 0),Xn=typeof document<"u"?H.useLayoutEffect:H.useEffect;function Ee(t){return"self"in t}function Jo(t){return"body"in t}function Jn(t,e,n,o=Kt,r,s){const i=H.useRef(null),l=H.useRef(null),c=H.useRef(null),a=H.useCallback(g=>{let x,w,v;const h=g.target;if(Jo(h)||Ee(h)){const u=Ee(h)?h:h.defaultView;v=s?u.scrollX:u.scrollY,x=s?u.document.documentElement.scrollWidth:u.document.documentElement.scrollHeight,w=s?u.innerWidth:u.innerHeight}else v=s?h.scrollLeft:h.scrollTop,x=s?h.scrollWidth:h.scrollHeight,w=s?h.offsetWidth:h.offsetHeight;const p=()=>{t({scrollHeight:x,scrollTop:Math.max(v,0),viewportHeight:w})};g.suppressFlushSync?p():lo.flushSync(p),l.current!==null&&(v===l.current||v<=0||v===x-w)&&(l.current=null,e(!0),c.current&&(clearTimeout(c.current),c.current=null))},[t,e,s]);H.useEffect(()=>{const g=r||i.current;return o(r||i.current),a({suppressFlushSync:!0,target:g}),g.addEventListener("scroll",a,{passive:!0}),()=>{o(null),g.removeEventListener("scroll",a)}},[i,a,n,o,r]);function m(g){const x=i.current;if(!x||(s?"offsetWidth"in x&&x.offsetWidth===0:"offsetHeight"in x&&x.offsetHeight===0))return;const w=g.behavior==="smooth";let v,h,p;Ee(x)?(h=Math.max(vt(x.document.documentElement,s?"width":"height"),s?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight),v=s?x.innerWidth:x.innerHeight,p=s?window.scrollX:window.scrollY):(h=x[s?"scrollWidth":"scrollHeight"],v=vt(x,s?"width":"height"),p=x[s?"scrollLeft":"scrollTop"]);const u=h-v;if(g.top=Math.ceil(Math.max(Math.min(u,g.top),0)),Nn(v,h)||g.top===p){t({scrollHeight:h,scrollTop:p,viewportHeight:v}),w&&e(!0);return}w?(l.current=g.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,l.current=null,e(!0)},1e3)):l.current=null,s&&(g={behavior:g.behavior,left:g.top}),x.scrollTo(g)}function I(g){s&&(g={behavior:g.behavior,left:g.top}),i.current.scrollBy(g)}return{scrollByCallback:I,scrollerRef:i,scrollToCallback:m}}const ke="-webkit-sticky",Sn="sticky",Ye=Yn(()=>{if(typeof document>"u")return Sn;const t=document.createElement("div");return t.style.position=ke,t.style.position===ke?ke:Sn});function Ze(t){return t}const Qo=$(()=>{const t=C(l=>`Item ${l}`),e=C(l=>`Group ${l}`),n=C({}),o=C(Ze),r=C("div"),s=C(Kt),i=(l,c=null)=>ct(S(n,E(a=>a[l]),Z()),c);return{components:n,computeItemKey:o,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:e,HeaderComponent:i("Header"),HeaderFooterTag:r,ItemComponent:i("Item","div"),itemContent:t,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),tr=$(([t,e])=>({...t,...e}),X(Zn,Qo)),er=({height:t})=>L.jsx("div",{style:{height:t}}),nr={overflowAnchor:"none",position:Ye(),zIndex:1},Qn={overflowAnchor:"none"},or={...Qn,display:"inline-block",height:"100%"},Tn=H.memo(function({showTopList:e=!1}){const n=j("listState"),o=gt("sizeRanges"),r=j("useWindowScroll"),s=j("customScrollParent"),i=gt("windowScrollContainerState"),l=gt("scrollContainerState"),c=s||r?i:l,a=j("itemContent"),m=j("context"),I=j("groupContent"),g=j("trackItemSizes"),x=j("itemSize"),w=j("log"),v=gt("gap"),h=j("horizontalDirection"),{callbackRef:p}=Fn(o,x,g,e?Kt:c,w,v,s,h,j("skipAnimationFrameInResizeObserver")),[u,T]=H.useState(0);Qe("deviation",F=>{u!==F&&T(F)});const R=j("EmptyPlaceholder"),f=j("ScrollSeekPlaceholder")||er,d=j("ListComponent"),y=j("ItemComponent"),k=j("GroupComponent"),B=j("computeItemKey"),z=j("isSeeking"),V=j("groupIndices").length>0,W=j("alignToBottom"),J=j("initialItemFinalLocationReached"),nt=e?{}:{boxSizing:"border-box",...h?{display:"inline-block",height:"100%",marginLeft:u!==0?u:W?"auto":0,paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,whiteSpace:"nowrap"}:{marginTop:u!==0?u:W?"auto":0,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},...J?{}:{visibility:"hidden"}};return!e&&n.totalCount===0&&R?L.jsx(R,{...q(R,m)}):L.jsx(d,{...q(d,m),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:p,style:nt,children:(e?n.topItems:n.items).map(F=>{const Y=F.originalIndex,it=B(Y+n.firstItemIndex,F.data,m);return z?H.createElement(f,{...q(f,m),height:F.size,index:F.index,key:it,type:F.type||"item",...F.type==="group"?{}:{groupIndex:F.groupIndex}}):F.type==="group"?H.createElement(k,{...q(k,m),"data-index":Y,"data-item-index":F.index,"data-known-size":F.size,key:it,style:nr},I(F.index,m)):H.createElement(y,{...q(y,m),...to(y,F.data),"data-index":Y,"data-item-group-index":F.groupIndex,"data-item-index":F.index,"data-known-size":F.size,key:it,style:h?or:Qn},V?a(F.index,F.groupIndex,F.data,m):a(F.index,F.data,m))})})}),rr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},sr={outline:"none",overflowX:"auto",position:"relative"},qt=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:{}}),ir={position:Ye(),top:0,width:"100%",zIndex:1};function q(t,e){if(typeof t!="string")return{context:e}}function to(t,e){return{item:typeof t=="string"?void 0:e}}const lr=H.memo(function(){const e=j("HeaderComponent"),n=gt("headerHeight"),o=j("HeaderFooterTag"),r=Ht(H.useMemo(()=>i=>{n(vt(i,"height"))},[n]),!0,j("skipAnimationFrameInResizeObserver")),s=j("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...q(e,s)})}):null}),cr=H.memo(function(){const e=j("FooterComponent"),n=gt("footerHeight"),o=j("HeaderFooterTag"),r=Ht(H.useMemo(()=>i=>{n(vt(i,"height"))},[n]),!0,j("skipAnimationFrameInResizeObserver")),s=j("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...q(e,s)})}):null});function Xe({useEmitter:t,useEmitterValue:e,usePublisher:n}){return H.memo(function({children:s,style:i,...l}){const c=n("scrollContainerState"),a=e("ScrollerComponent"),m=n("smoothScrollTargetReached"),I=e("scrollerRef"),g=e("context"),x=e("horizontalDirection")||!1,{scrollByCallback:w,scrollerRef:v,scrollToCallback:h}=Jn(c,m,a,I,void 0,x);t("scrollTo",h),t("scrollBy",w);const p=x?sr:rr;return L.jsx(a,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:v,style:{...p,...i},tabIndex:0,...l,...q(a,g),children:s})})}function Je({useEmitter:t,useEmitterValue:e,usePublisher:n}){return H.memo(function({children:s,style:i,...l}){const c=n("windowScrollContainerState"),a=e("ScrollerComponent"),m=n("smoothScrollTargetReached"),I=e("totalListHeight"),g=e("deviation"),x=e("customScrollParent"),w=e("context"),v=H.useRef(null),h=e("scrollerRef"),{scrollByCallback:p,scrollerRef:u,scrollToCallback:T}=Jn(c,m,a,h,x);return Xn(()=>{var R;return u.current=x||((R=v.current)==null?void 0:R.ownerDocument.defaultView),()=>{u.current=null}},[u,x]),t("windowScrollTo",T),t("scrollBy",p),L.jsx(a,{ref:v,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...I!==0?{height:I+g}:{}},...l,...q(a,w),children:s})})}const ur=({children:t})=>{const e=H.useContext(ue),n=gt("viewportHeight"),o=gt("fixedItemHeight"),r=j("alignToBottom"),s=j("horizontalDirection"),i=H.useMemo(()=>te(n,c=>vt(c,s?"width":"height")),[n,s]),l=Ht(i,!0,j("skipAnimationFrameInResizeObserver"));return H.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),L.jsx("div",{"data-viewport-type":"element",ref:l,style:qt(r),children:t})},ar=({children:t})=>{const e=H.useContext(ue),n=gt("windowViewportRect"),o=gt("fixedItemHeight"),r=j("customScrollParent"),s=Ge(n,r,j("skipAnimationFrameInResizeObserver")),i=j("alignToBottom");return H.useEffect(()=>{e&&(o(e.itemHeight),n({offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),L.jsx("div",{"data-viewport-type":"window",ref:s,style:qt(i),children:t})},dr=({children:t})=>{const e=j("TopItemListComponent")||"div",n=j("headerHeight"),o={...ir,marginTop:`${n}px`},r=j("context");return L.jsx(e,{style:o,...q(e,r),children:t})},fr=H.memo(function(e){const n=j("useWindowScroll"),o=j("topItemsIndexes").length>0,r=j("customScrollParent"),s=j("context"),i=r||n?pr:mr,l=r||n?ar:ur;return L.jsxs(i,{...e,...q(i,s),children:[o&&L.jsx(dr,{children:L.jsx(Tn,{showTopList:!0})}),L.jsxs(l,{children:[L.jsx(lr,{}),L.jsx(Tn,{}),L.jsx(cr,{})]})]})}),{Component:eo,useEmitter:Qe,useEmitterValue:j,usePublisher:gt}=Ke(tr,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",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",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},fr),mr=Xe({useEmitter:Qe,useEmitterValue:j,usePublisher:gt}),pr=Je({useEmitter:Qe,useEmitterValue:j,usePublisher:gt}),hr=eo,gr=eo,xr=$(()=>{const t=C(a=>L.jsxs("td",{children:["Item $",a]})),e=C(null),n=C(a=>L.jsxs("td",{colSpan:1e3,children:["Group ",a]})),o=C(null),r=C(null),s=C({}),i=C(Ze),l=C(Kt),c=(a,m=null)=>ct(S(s,E(I=>I[a]),Z()),m);return{components:s,computeItemKey:i,context:e,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:r,fixedHeaderContent:o,itemContent:t,groupContent:n,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}}),Ir=$(([t,e])=>({...t,...e}),X(Zn,xr)),Sr=({height:t})=>L.jsx("tr",{children:L.jsx("td",{style:{height:t}})}),Tr=({height:t})=>L.jsx("tr",{children:L.jsx("td",{style:{border:0,height:t,padding:0}})}),Cr={overflowAnchor:"none"},Cn={position:Ye(),zIndex:2,overflowAnchor:"none"},wn=H.memo(function({showTopList:e=!1}){const n=A("listState"),o=A("computeItemKey"),r=A("firstItemIndex"),s=A("context"),i=A("isSeeking"),l=A("fixedHeaderHeight"),c=A("groupIndices").length>0,a=A("itemContent"),m=A("groupContent"),I=A("ScrollSeekPlaceholder")||Sr,g=A("GroupComponent"),x=A("TableRowComponent"),w=(e?n.topItems:[]).reduce((h,p,u)=>(u===0?h.push(p.size):h.push(h[u-1]+p.size),h),[]),v=(e?n.topItems:n.items).map(h=>{const p=h.originalIndex,u=o(p+r,h.data,s),T=e?p===0?0:w[p-1]:0;return i?H.createElement(I,{...q(I,s),height:h.size,index:h.index,key:u,type:h.type||"item"}):h.type==="group"?H.createElement(g,{...q(g,s),"data-index":p,"data-item-index":h.index,"data-known-size":h.size,key:u,style:{...Cn,top:l}},m(h.index,s)):H.createElement(x,{...q(x,s),...to(x,h.data),"data-index":p,"data-item-index":h.index,"data-known-size":h.size,"data-item-group-index":h.groupIndex,key:u,style:e?{...Cn,top:l+T}:Cr},c?a(h.index,h.groupIndex,h.data,s):a(h.index,h.data,s))});return L.jsx(L.Fragment,{children:v})}),wr=H.memo(function(){const e=A("listState"),n=A("topItemsIndexes").length>0,o=Ct("sizeRanges"),r=A("useWindowScroll"),s=A("customScrollParent"),i=Ct("windowScrollContainerState"),l=Ct("scrollContainerState"),c=s||r?i:l,a=A("trackItemSizes"),m=A("itemSize"),I=A("log"),{callbackRef:g,ref:x}=Fn(o,m,a,c,I,void 0,s,!1,A("skipAnimationFrameInResizeObserver")),[w,v]=H.useState(0);tn("deviation",V=>{w!==V&&(x.current.style.marginTop=`${V}px`,v(V))});const h=A("EmptyPlaceholder"),p=A("FillerRow")||Tr,u=A("TableBodyComponent"),T=A("paddingTopAddition"),R=A("statefulTotalCount"),f=A("context");if(R===0&&h)return L.jsx(h,{...q(h,f)});const d=(n?e.topItems:[]).reduce((V,W)=>V+W.size,0),y=e.offsetTop+T+w-d,k=e.offsetBottom,B=y>0?L.jsx(p,{context:f,height:y},"padding-top"):null,z=k>0?L.jsx(p,{context:f,height:k},"padding-bottom"):null;return L.jsxs(u,{"data-testid":"virtuoso-item-list",ref:g,...q(u,f),children:[B,n&&L.jsx(wn,{showTopList:!0}),L.jsx(wn,{}),z]})}),vr=({children:t})=>{const e=H.useContext(ue),n=Ct("viewportHeight"),o=Ct("fixedItemHeight"),r=Ht(H.useMemo(()=>te(n,s=>vt(s,"height")),[n]),!0,A("skipAnimationFrameInResizeObserver"));return H.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),L.jsx("div",{"data-viewport-type":"element",ref:r,style:qt(!1),children:t})},yr=({children:t})=>{const e=H.useContext(ue),n=Ct("windowViewportRect"),o=Ct("fixedItemHeight"),r=A("customScrollParent"),s=Ge(n,r,A("skipAnimationFrameInResizeObserver"));return H.useEffect(()=>{e&&(o(e.itemHeight),n({offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),L.jsx("div",{"data-viewport-type":"window",ref:s,style:qt(!1),children:t})},br=H.memo(function(e){const n=A("useWindowScroll"),o=A("customScrollParent"),r=Ct("fixedHeaderHeight"),s=Ct("fixedFooterHeight"),i=A("fixedHeaderContent"),l=A("fixedFooterContent"),c=A("context"),a=Ht(H.useMemo(()=>te(r,u=>vt(u,"height")),[r]),!0,A("skipAnimationFrameInResizeObserver")),m=Ht(H.useMemo(()=>te(s,u=>vt(u,"height")),[s]),!0,A("skipAnimationFrameInResizeObserver")),I=o||n?Hr:Rr,g=o||n?yr:vr,x=A("TableComponent"),w=A("TableHeadComponent"),v=A("TableFooterComponent"),h=i?L.jsx(w,{ref:a,style:{position:"sticky",top:0,zIndex:2},...q(w,c),children:i()},"TableHead"):null,p=l?L.jsx(v,{ref:m,style:{bottom:0,position:"sticky",zIndex:1},...q(v,c),children:l()},"TableFoot"):null;return L.jsx(I,{...e,...q(I,c),children:L.jsx(g,{children:L.jsxs(x,{style:{borderSpacing:0,overflowAnchor:"none"},...q(x,c),children:[h,L.jsx(wr,{},"TableBody"),p]})})})}),{Component:no,useEmitter:tn,useEmitterValue:A,usePublisher:Ct}=Ke(Ir,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",firstItemIndex:"firstItemIndex",itemContent:"itemContent",groupContent:"groupContent",fixedHeaderContent:"fixedHeaderContent",fixedFooterContent:"fixedFooterContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",topItemCount:"topItemCount",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",groupCounts:"groupCounts",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},br),Rr=Xe({useEmitter:tn,useEmitterValue:A,usePublisher:Ct}),Hr=Je({useEmitter:tn,useEmitterValue:A,usePublisher:Ct}),Er=no,kr=no,vn={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Br={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:yn,floor:Te,max:Qt,min:Be,round:bn}=Math;function Rn(t,e,n){return Array.from({length:e-t+1}).map((o,r)=>({data:n===null?null:n[r+t],index:r+t}))}function Fr(t){return{...Br,items:t}}function pe(t,e){return t&&t.width===e.width&&t.height===e.height}function Or(t,e){return t&&t.column===e.column&&t.row===e.row}const Lr=$(([{increaseViewportBy:t,listBoundary:e,overscan:n,visibleRange:o},{footerHeight:r,headerHeight:s,scrollBy:i,scrollContainerState:l,scrollTo:c,scrollTop:a,smoothScrollTargetReached:m,viewportHeight:I},g,x,{didMount:w,propsReady:v},{customScrollParent:h,useWindowScroll:p,windowScrollContainerState:u,windowScrollTo:T,windowViewportRect:R},f])=>{const d=C(0),y=C(0),k=C(vn),B=C({height:0,width:0}),z=C({height:0,width:0}),V=D(),W=D(),J=C(0),nt=C(null),F=C({column:0,row:0}),Y=D(),it=D(),ft=C(!1),It=C(0),mt=C(!0),ut=C(!1),Mt=C(!1);U(S(w,_(It),M(([b,N])=>!!N)),()=>{G(mt,!1)}),U(S(rt(w,mt,z,B,It,ut),M(([b,N,Q,lt,,tt])=>b&&!N&&Q.height!==0&<.height!==0&&!tt)),([,,,,b])=>{G(ut,!0),Ne(1,()=>{G(V,b)}),Tt(S(a),()=>{G(e,[0,0]),G(mt,!0)})}),O(S(it,M(b=>b!=null&&b.scrollTop>0),bt(0)),y),U(S(w,_(it),M(([,b])=>b!=null)),([,b])=>{b&&(G(B,b.viewport),G(z,b.item),G(F,b.gap),b.scrollTop>0&&(G(ft,!0),Tt(S(a,Wt(1)),N=>{G(ft,!1)}),G(c,{top:b.scrollTop})))}),O(S(B,E(({height:b})=>b)),I),O(S(rt(P(B,pe),P(z,pe),P(F,(b,N)=>b&&b.column===N.column&&b.row===N.row),P(a)),E(([b,N,Q,lt])=>({gap:Q,item:N,scrollTop:lt,viewport:b}))),Y),O(S(rt(P(d),o,P(F,Or),P(z,pe),P(B,pe),P(nt),P(y),P(ft),P(mt),P(It)),M(([,,,,,,,b])=>!b),E(([b,[N,Q],lt,tt,Ft,Zt,Nt,,ae,Ot])=>{const{column:Lt,row:Xt}=lt,{height:de,width:be}=tt,{width:en}=Ft;if(Nt===0&&(b===0||en===0))return vn;if(be===0){const ln=De(Ot,b),io=ln+Math.max(Nt-1,0);return Fr(Rn(ln,io,Zt))}const fe=oo(en,be,Lt);let Dt,At;ae?N===0&&Q===0&&Nt>0?(Dt=0,At=Nt-1):(Dt=fe*Te((N+Xt)/(de+Xt)),At=fe*yn((Q+Xt)/(de+Xt))-1,At=Be(b-1,Qt(At,fe-1)),Dt=Be(At,Qt(0,Dt))):(Dt=0,At=-1);const nn=Rn(Dt,At,Zt),{bottom:on,top:rn}=Hn(Ft,lt,tt,nn),sn=yn(b/fe),so=sn*de+(sn-1)*Xt-on;return{bottom:on,itemHeight:de,items:nn,itemWidth:be,offsetBottom:so,offsetTop:rn,top:rn}})),k),O(S(nt,M(b=>b!==null),E(b=>b.length)),d),O(S(rt(B,z,k,F),M(([b,N,{items:Q}])=>Q.length>0&&N.height!==0&&b.height!==0),E(([b,N,{items:Q},lt])=>{const{bottom:tt,top:Ft}=Hn(b,lt,N,Q);return[Ft,tt]}),Z(oe)),e);const St=C(!1);O(S(a,_(St),E(([b,N])=>N||b!==0)),St);const Yt=ht(S(rt(k,d),M(([{items:b}])=>b.length>0),_(St),M(([[b,N],Q])=>{const tt=b.items[b.items.length-1].index===N-1;return(Q||b.bottom>0&&b.itemHeight>0&&b.offsetBottom===0&&b.items.length===N)&&tt}),E(([[,b]])=>b-1),Z())),jt=ht(S(P(k),M(({items:b})=>b.length>0&&b[0].index===0),bt(0),Z())),yt=ht(S(P(k),_(ft),M(([{items:b},N])=>b.length>0&&!N),E(([{items:b}])=>({endIndex:b[b.length-1].index,startIndex:b[0].index})),Z(Mn),Bt(0)));O(yt,x.scrollSeekRangeChanged),O(S(V,_(B,z,d,F),E(([b,N,Q,lt,tt])=>{const Ft=_n(b),{align:Zt,behavior:Nt,offset:ae}=Ft;let Ot=Ft.index;Ot==="LAST"&&(Ot=lt-1),Ot=Qt(0,Ot,Be(lt-1,Ot));let Lt=Pe(N,tt,Q,Ot);return Zt==="end"?Lt=bn(Lt-N.height+Q.height):Zt==="center"&&(Lt=bn(Lt-N.height/2+Q.height/2)),ae&&(Lt+=ae),{behavior:Nt,top:Lt}})),c);const kt=ct(S(k,E(b=>b.offsetBottom+b.bottom)),0);return O(S(R,E(b=>({height:b.visibleHeight,width:b.visibleWidth}))),B),{customScrollParent:h,data:nt,deviation:J,footerHeight:r,gap:F,headerHeight:s,increaseViewportBy:t,initialItemCount:y,itemDimensions:z,overscan:n,restoreStateFrom:it,scrollBy:i,scrollContainerState:l,scrollHeight:W,scrollTo:c,scrollToIndex:V,scrollTop:a,smoothScrollTargetReached:m,totalCount:d,useWindowScroll:p,viewportDimensions:B,windowScrollContainerState:u,windowScrollTo:T,windowViewportRect:R,...x,gridState:k,horizontalDirection:Mt,initialTopMostItemIndex:It,totalListHeight:kt,...g,endReached:Yt,propsReady:v,rangeChanged:yt,startReached:jt,stateChanged:Y,stateRestoreInProgress:ft,...f}},X($e,dt,ce,qn,Pt,Ue,Vt));function oo(t,e,n){return Qt(1,Te((t+n)/(Te(e)+n)))}function Hn(t,e,n,o){const{height:r}=n;if(r===void 0||o.length===0)return{bottom:0,top:0};const s=Pe(t,e,n,o[0].index);return{bottom:Pe(t,e,n,o[o.length-1].index)+r,top:s}}function Pe(t,e,n,o){const r=oo(t.width,n.width,e.column),s=Te(o/r),i=s*n.height+Qt(0,s-1)*e.row;return i>0?i+e.row:i}const zr=$(()=>{const t=C(I=>`Item ${I}`),e=C({}),n=C(null),o=C("virtuoso-grid-item"),r=C("virtuoso-grid-list"),s=C(Ze),i=C("div"),l=C(Kt),c=(I,g=null)=>ct(S(e,E(x=>x[I]),Z()),g),a=C(!1),m=C(!1);return O(P(m),a),{components:e,computeItemKey:s,context:n,FooterComponent:c("Footer"),HeaderComponent:c("Header"),headerFooterTag:i,itemClassName:o,ItemComponent:c("Item","div"),itemContent:t,listClassName:r,ListComponent:c("List","div"),readyStateChanged:a,reportReadyState:m,ScrollerComponent:c("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}),Vr=$(([t,e])=>({...t,...e}),X(Lr,zr)),Pr=H.memo(function(){const e=et("gridState"),n=et("listClassName"),o=et("itemClassName"),r=et("itemContent"),s=et("computeItemKey"),i=et("isSeeking"),l=xt("scrollHeight"),c=et("ItemComponent"),a=et("ListComponent"),m=et("ScrollSeekPlaceholder"),I=et("context"),g=xt("itemDimensions"),x=xt("gap"),w=et("log"),v=et("stateRestoreInProgress"),h=xt("reportReadyState"),p=Ht(H.useMemo(()=>u=>{const T=u.parentElement.parentElement.scrollHeight;l(T);const R=u.firstChild;if(R){const{height:f,width:d}=R.getBoundingClientRect();g({height:f,width:d})}x({column:En("column-gap",getComputedStyle(u).columnGap,w),row:En("row-gap",getComputedStyle(u).rowGap,w)})},[l,g,x,w]),!0,!1);return Xn(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),v?null:L.jsx(a,{className:n,ref:p,...q(a,I),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(u=>{const T=s(u.index,u.data,I);return i?L.jsx(m,{...q(m,I),height:e.itemHeight,index:u.index,width:e.itemWidth},T):H.createElement(c,{...q(c,I),className:o,"data-index":u.index,key:T},r(u.index,u.data,I))})})}),Mr=H.memo(function(){const e=et("HeaderComponent"),n=xt("headerHeight"),o=et("headerFooterTag"),r=Ht(H.useMemo(()=>i=>{n(vt(i,"height"))},[n]),!0,!1),s=et("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...q(e,s)})}):null}),jr=H.memo(function(){const e=et("FooterComponent"),n=xt("footerHeight"),o=et("headerFooterTag"),r=Ht(H.useMemo(()=>i=>{n(vt(i,"height"))},[n]),!0,!1),s=et("context");return e?L.jsx(o,{ref:r,children:L.jsx(e,{...q(e,s)})}):null}),Ar=({children:t})=>{const e=H.useContext(qe),n=xt("itemDimensions"),o=xt("viewportDimensions"),r=Ht(H.useMemo(()=>s=>{o(s.getBoundingClientRect())},[o]),!0,!1);return H.useEffect(()=>{e&&(o({height:e.viewportHeight,width:e.viewportWidth}),n({height:e.itemHeight,width:e.itemWidth}))},[e,o,n]),L.jsx("div",{ref:r,style:qt(!1),children:t})},Gr=({children:t})=>{const e=H.useContext(qe),n=xt("windowViewportRect"),o=xt("itemDimensions"),r=et("customScrollParent"),s=Ge(n,r,!1);return H.useEffect(()=>{e&&(o({height:e.itemHeight,width:e.itemWidth}),n({offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:e.viewportWidth}))},[e,n,o]),L.jsx("div",{ref:s,style:qt(!1),children:t})},Wr=H.memo(function({...e}){const n=et("useWindowScroll"),o=et("customScrollParent"),r=o||n?Dr:Nr,s=o||n?Gr:Ar,i=et("context");return L.jsx(r,{...e,...q(r,i),children:L.jsxs(s,{children:[L.jsx(Mr,{}),L.jsx(Pr,{}),L.jsx(jr,{})]})})}),{Component:_r,useEmitter:ro,useEmitterValue:et,usePublisher:xt}=Ke(Vr,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Wr),Nr=Xe({useEmitter:ro,useEmitterValue:et,usePublisher:xt}),Dr=Je({useEmitter:ro,useEmitterValue:et,usePublisher:xt});function En(t,e,n){return e!=="normal"&&!(e!=null&&e.endsWith("px"))&&n(`${t} was not resolved to pixel value correctly`,e,at.WARN),e==="normal"?0:parseInt(e!=null?e:"0",10)}const $r=_r;exports.GroupedTableVirtuoso=kr;exports.GroupedVirtuoso=gr;exports.LogLevel=at;exports.TableVirtuoso=Er;exports.Virtuoso=hr;exports.VirtuosoGrid=$r;exports.VirtuosoGridMockContext=qe;exports.VirtuosoMockContext=ue;
|
package/dist/index.d.ts
CHANGED
|
@@ -989,6 +989,16 @@ export declare interface VirtuosoProps<D, C> extends ListRootProps {
|
|
|
989
989
|
* ```
|
|
990
990
|
*/
|
|
991
991
|
followOutput?: FollowOutput;
|
|
992
|
+
/**
|
|
993
|
+
* Implement this callback if you want to adjust the list position when the list total count changes.
|
|
994
|
+
* Return a `ScrollIntoViewLocation` object to scroll to a specific item, or falsey value to avoid scrolling.
|
|
995
|
+
* Use the context contents if you need to implement custom logic based on the current state of the list.
|
|
996
|
+
*/
|
|
997
|
+
scrollIntoViewOnChange?: (params: {
|
|
998
|
+
context: C;
|
|
999
|
+
totalCount: number;
|
|
1000
|
+
scrollingInProgress: boolean;
|
|
1001
|
+
}) => ScrollIntoViewLocation | null | undefined | false | void;
|
|
992
1002
|
/**
|
|
993
1003
|
* Set to customize the wrapper tag for the header and footer components (default is `div`).
|
|
994
1004
|
*/
|