UNPKG

react-virtuoso

Version:

A virtual scroll React component for efficiently rendering large scrollable lists, grids, tables, and feeds

1 lines 60.9 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react/jsx-runtime"),b=require("react"),go=require("react-dom"),Ce=0,Gt=1,Yt=2,Vn=4;function dn(t){return()=>t}function xo(t){t()}function ne(t,e){return n=>t(e(n))}function fn(t,e){return()=>t(e)}function Io(t,e){return n=>t(e,n)}function Me(t){return t!==void 0}function So(...t){return()=>{t.map(xo)}}function Zt(){}function we(t,e){return e(t),t}function vo(t,e){return e(t)}function rt(...t){return t}function Y(t,e){return t(Gt,e)}function j(t,e){t(Ce,e)}function Ae(t){t(Yt)}function it(t){return t(Vn)}function O(t,e){return Y(t,Io(e,Ce))}function yt(t,e){const n=t(Gt,o=>{n(),e(o)});return n}function mn(t){let e,n;return o=>r=>{e=r,n&&clearTimeout(n),n=setTimeout(()=>{o(e)},t)}}function Wn(t,e){return t===e}function nt(t=Wn){let e;return n=>o=>{t(e,o)||(e=o,n(o))}}function P(t){return e=>n=>{t(n)&&e(n)}}function B(t){return e=>ne(e,t)}function Bt(t){return e=>()=>{e(t)}}function S(t,...e){const n=To(...e);return((o,r)=>{switch(o){case Yt:Ae(t);return;case Gt:return Y(t,n(r))}})}function Lt(t,e){return n=>o=>{n(e=t(e,o))}}function Nt(t){return e=>n=>{t>0?t--:e(n)}}function zt(t){let e=null,n;return o=>r=>{e=r,!n&&(n=setTimeout(()=>{n=void 0,o(e)},t))}}function D(...t){const e=new Array(t.length);let n=0,o=null;const r=2**t.length-1;return t.forEach((s,i)=>{const l=2**i;Y(s,c=>{const d=n;n|=l,e[i]=c,d!==r&&n===r&&o&&(o(),o=null)})}),s=>i=>{const l=()=>{s([i].concat(e))};n===r?l():o=l}}function To(...t){return e=>t.reduceRight(vo,e)}function Co(t){let e,n;const o=()=>e?.();return function(r,s){switch(r){case Gt:return s?n===s?void 0:(o(),n=s,e=Y(t,s),e):(o(),Zt);case Yt:o(),n=null;return}}}function T(t){let e=t;const n=$();return((o,r)=>{switch(o){case Ce:e=r;break;case Gt:{r(e);break}case Vn:return e}return n(o,r)})}function ht(t,e){return we(T(e),n=>O(t,n))}function $(){const t=[];return((e,n)=>{switch(e){case Ce:t.slice().forEach(o=>{o(n)});return;case Yt:t.splice(0,t.length);return;case Gt:return t.push(n),()=>{const o=t.indexOf(n);o>-1&&t.splice(o,1)}}})}function Tt(t){return we($(),e=>O(t,e))}function K(t,e=[],{singleton:n}={singleton:!0}){return{constructor:t,dependencies:e,id:wo(),singleton:n}}const wo=()=>Symbol();function yo(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 at(...t){const e=$(),n=new Array(t.length);let o=0;const r=2**t.length-1;return t.forEach((s,i)=>{const l=2**i;Y(s,c=>{n[i]=c,o|=l,o===r&&j(e,n)})}),function(s,i){switch(s){case Yt:{Ae(e);return}case Gt:return o===r&&i(n),Y(e,i)}}}function G(t,e=Wn){return S(t,nt(e))}function Oe(...t){return function(e,n){switch(e){case Yt:return;case Gt:return So(...t.map(o=>Y(o,n)))}}}const dt={DEBUG:0,INFO:1,WARN:2,ERROR:3},bo={[dt.DEBUG]:"debug",[dt.ERROR]:"error",[dt.INFO]:"log",[dt.WARN]:"warn"},Ro=()=>typeof globalThis>"u"?window:globalThis,Pt=K(()=>{const t=T(dt.ERROR);return{log:T((n,o,r=dt.INFO)=>{const s=Ro().VIRTUOSO_LOG_LEVEL??it(t);r>=s&&console[bo[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,o)}),logLevel:t}},[],{singleton:!0}),ze=new WeakMap;function Gn(t){return"self"in t?t.document.documentElement:t}function Eo(t){const e=Gn(t),n=ze.get(e);if(n!==void 0)return n;const o=e.ownerDocument.defaultView.getComputedStyle(e).direction==="rtl";return ze.set(e,o),o}function pn(t){ze.delete(Gn(t))}function Pn(t,e){return Eo(t)?-e:e}const jt=Pn;function hn(t,e){return Pn(t,e)}function kt(t,e,n){return je(t,e,n).callbackRef}function je(t,e,n){const o=b.useRef(null);let r=i=>{};const s=b.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?.observe(i),o.current=i):(o.current&&s?.unobserve(o.current),o.current=null)},{callbackRef:r,ref:o}}function Mn(t,e,n,o,r,s,i,l,c){const d=b.useCallback(m=>{const v=Ho(m.children,e,l?"offsetWidth":"offsetHeight",r);let p=m.parentElement;for(;p.dataset.virtuosoScroller===void 0;)p=p.parentElement;const x=p.lastElementChild.dataset.viewportType==="window";let w;x&&(w=p.ownerDocument.defaultView);const E=i?l?i.scrollWidth:i.scrollHeight:x?l?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight:l?p.scrollWidth:p.scrollHeight,h=i?l?i.offsetWidth:i.offsetHeight:x?l?w.innerWidth:w.innerHeight:l?p.offsetWidth:p.offsetHeight,f=i?l?jt(i,i.scrollLeft):i.scrollTop:x?l?jt(w,w.scrollX||w.document.documentElement.scrollLeft):w.scrollY||w.document.documentElement.scrollTop:l?jt(p,p.scrollLeft):p.scrollTop;o({scrollHeight:E,scrollTop:Math.max(f,0),viewportHeight:h}),s?.(l?gn("column-gap",getComputedStyle(m).columnGap,r):gn("row-gap",getComputedStyle(m).rowGap,r)),v!==null&&t(v)},[t,e,r,s,i,o,l]);return je(d,n,c)}function Ho(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),d=parseFloat(l.dataset.knownSize),m=e(l,n);if(m===0&&o("Zero-sized element, this should not happen",{child:l},dt.ERROR),m===d)continue;const v=s[s.length-1];s.length===0||v.size!==m||v.endIndex!==c-1?s.push({endIndex:c,size:m,startIndex:c}):s[s.length-1].endIndex++}return s}function gn(t,e,n){return e!=="normal"&&e?.endsWith("px")!==!0&&n(`${t} was not resolved to pixel value correctly`,e,dt.WARN),e==="normal"?0:parseInt(e??"0",10)}function _e(t,e,n){const o=b.useRef(null),r=b.useCallback(c=>{if(!c?.offsetParent)return;const d=c.getBoundingClientRect(),m=d.width;let v,p;if(e){const x=e.getBoundingClientRect(),w=d.top-x.top;p=x.height-Math.max(0,w),v=w+e.scrollTop}else{const x=i.current.ownerDocument.defaultView;p=x.innerHeight-Math.max(0,d.top),v=d.top+x.scrollY}o.current={listHeight:d.height,offsetTop:v,visibleHeight:p,visibleWidth:m},t(o.current)},[t,e]),{callbackRef:s,ref:i}=je(r,!0,n),l=b.useCallback(()=>{r(i.current)},[r,i]);return b.useEffect(()=>{if(e){e.addEventListener("scroll",l);const d=new ResizeObserver(()=>{requestAnimationFrame(l)});return d.observe(e),()=>{e.removeEventListener("scroll",l),d.unobserve(e)}}const c=i.current?.ownerDocument.defaultView;return c?.addEventListener("scroll",l),c?.addEventListener("resize",l),()=>{c?.removeEventListener("scroll",l),c?.removeEventListener("resize",l)}},[l,e,i]),s}const xt=K(()=>{const t=$(),e=$(),n=T(0),o=$(),r=T(0),s=$(),i=$(),l=T(0),c=T(0),d=T(0),m=T(0),v=$(),p=$(),x=T(!1),w=T(!1),E=T(!1);return O(S(t,B(({scrollTop:h})=>h)),e),O(S(t,B(({scrollHeight:h})=>h)),i),O(e,r),{deviation:n,fixedFooterHeight:d,fixedHeaderHeight:c,footerHeight:m,headerHeight:l,horizontalDirection:w,scrollBy:p,scrollContainerState:t,scrollHeight:i,scrollingInProgress:x,scrollTo:v,scrollTop:e,skipAnimationFrameInResizeObserver:E,smoothScrollTargetReached:o,statefulScrollTop:r,viewportHeight:s}},[],{singleton:!0}),oe={lvl:0};function An(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 J(t){return t===oe}function re(t,e){if(!J(t))return e===t.k?t.v:e<t.k?re(t.l,e):re(t.r,e)}function Rt(t,e,n="k"){if(J(t))return[-1/0,void 0];if(Number(t[n])===e)return[t.k,t.v];if(Number(t[n])<e){const o=Rt(t.r,e,n);return o[0]===-1/0?[t.k,t.v]:o}return Rt(t.l,e,n)}function vt(t,e,n){return J(t)?Nn(e,n,1):e===t.k?ft(t,{k:e,v:n}):e<t.k?xn(ft(t,{l:vt(t.l,e,n)})):xn(ft(t,{r:vt(t.r,e,n)}))}function Kt(){return oe}function qt(t,e,n){if(J(t))return[];const o=Rt(t,e)[0];return Bo(Ve(t,o,n))}function Fe(t,e){if(J(t))return oe;const{k:n,l:o,r}=t;if(e===n){if(J(o))return r;if(J(r))return o;const[s,i]=_n(o);return Ie(ft(t,{k:s,l:jn(o),v:i}))}return e<n?Ie(ft(t,{l:Fe(o,e)})):Ie(ft(t,{r:Fe(r,e)}))}function _t(t){return J(t)?[]:[..._t(t.l),{k:t.k,v:t.v},..._t(t.r)]}function Ve(t,e,n){if(J(t))return[];const{k:o,l:r,r:s,v:i}=t;let l=[];return o>e&&(l=l.concat(Ve(r,e,n))),o>=e&&o<=n&&l.push({k:o,v:i}),o<=n&&(l=l.concat(Ve(s,e,n))),l}function Ie(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(Ee(e))return Dn(ft(t,{lvl:n-1}));if(!J(e)&&!J(e.r))return ft(e.r,{l:ft(e,{r:e.r.l}),lvl:n,r:ft(t,{l:e.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}if(Ee(t))return We(ft(t,{lvl:n-1}));if(!J(o)&&!J(o.l)){const r=o.l,s=Ee(r)?o.lvl-1:o.lvl;return ft(r,{l:ft(t,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:We(ft(o,{l:r.r,lvl:s}))})}throw new Error("Unexpected empty nodes")}function ft(t,e){return Nn(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 jn(t){return J(t.r)?t.l:Ie(ft(t,{r:jn(t.r)}))}function Ee(t){return J(t)||t.lvl>t.r.lvl}function _n(t){return J(t.r)?[t.k,t.v]:_n(t.r)}function Nn(t,e,n,o=oe,r=oe){return{k:t,l:o,lvl:n,r,v:e}}function xn(t){return We(Dn(t))}function Dn(t){const{l:e}=t;return!J(e)&&e.lvl===t.lvl?ft(e,{r:ft(t,{l:e.r})}):t}function We(t){const{lvl:e,r:n}=t;return!J(n)&&!J(n.r)&&n.lvl===e&&n.r.lvl===e?ft(n,{l:ft(t,{r:n.l}),lvl:e+1}):t}function Bo(t){return An(t,({k:e,v:n})=>({index:e,value:n}))}function $n(t,e){return!!(t&&t.startIndex===e.startIndex&&t.endIndex===e.endIndex)}function se(t,e){return!!(t&&t[0]===e[0]&&t[1]===e[1])}const Ne=K(()=>({recalcInProgress:T(!1)}),[],{singleton:!0});function Un(t,e,n){return t[ve(t,e,n)]}function ve(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 Lo(t,e,n,o){const r=ve(t,e,o),s=ve(t,n,o,r);return t.slice(r,s+1)}function Et(t,e){return Math.round(t.getBoundingClientRect()[e])}function ye(t){return!J(t.groupOffsetTree)}function De({index:t},e){return e===t?0:e<t?-1:1}function ko(){return{groupIndices:[],groupOffsetTree:Kt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Kt()}}function Oo(t,e){let n=J(t)?0:1/0;for(const o of e){const{endIndex:r,size:s,startIndex:i}=o;if(n=Math.min(n,i),J(t)){t=vt(t,0,s);continue}const l=qt(t,i-1,r+1);if(l.some(Mo(o)))continue;let c=!1,d=!1;for(const{end:m,start:v,value:p}of l)c?(r>=v||s===p)&&(t=Fe(t,v)):(d=p!==s,c=!0),m>r&&r>=v&&p!==s&&(t=vt(t,r+1,p));d&&(t=vt(t,i,s))}return[t,n]}function zo(t){return typeof t.groupIndex<"u"}function Fo({offset:t},e){return e===t?0:e<t?-1:1}function ie(t,e,n){if(e.length===0)return 0;const{index:o,offset:r,size:s}=Un(e,t,De),i=t-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function Kn(t,e){if(!ye(e))return t;let n=0;for(;e.groupIndices[n]<=t+n;)n++;return t+n}function qn(t,e,n){if(zo(t))return e.groupIndices[t.groupIndex]+1;const o=t.index==="LAST"?n:t.index;let r=Kn(o,e);return r=Math.max(0,r,Math.min(n,r)),r}function Vo(t,e,n,o=0){return o>0&&(e=Math.max(e,Un(t,o,De).offset)),An(Lo(t,e,n,Fo),Po)}function Wo(t,[e,n,o,r]){e.length>0&&o("received item sizes",e,dt.DEBUG);const s=t.sizeTree;let i=s,l=0;if(n.length>0&&J(s)&&e.length===2){const p=e[0].size,x=e[1].size;i=n.reduce((w,E)=>vt(vt(w,E,p),E+1,x),i)}else[i,l]=Oo(i,e);if(i===s)return t;const{lastIndex:c,lastOffset:d,lastSize:m,offsetTree:v}=Ge(t.offsetTree,l,i,r);return{groupIndices:n,groupOffsetTree:n.reduce((p,x)=>vt(p,x,ie(x,v,r)),Kt()),lastIndex:c,lastOffset:d,lastSize:m,offsetTree:v,sizeTree:i}}function Go(t){return _t(t).map(({k:e,v:n},o,r)=>{const s=r[o+1];return{endIndex:s!==void 0?s.k-1:1/0,size:n,startIndex:e}})}function In(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 Ge(t,e,n,o){let r=t,s=0,i=0,l=0,c=0;if(e!==0){c=ve(r,e-1,De),l=r[c].offset;const m=Rt(n,e-1);s=m[0],i=m[1],r.length&&r[c].size===Rt(n,e)[1]&&(c-=1),r=r.slice(0,c+1)}else r=[];for(const{start:d,value:m}of qt(n,e,1/0)){const v=d-s,p=v*i+l+v*o;r.push({index:d,offset:p,size:m}),s=d,l=p,i=m}return{lastIndex:s,lastOffset:l,lastSize:i,offsetTree:r}}function Po(t){return{index:t.index,value:t}}function Mo(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 Ao={offsetHeight:"height",offsetWidth:"width"},Ot=K(([{log:t},{recalcInProgress:e}])=>{const n=$(),o=$(),r=ht(o,0),s=$(),i=$(),l=T(0),c=T([]),d=T(void 0),m=T(void 0),v=T(void 0),p=T(void 0),x=T((u,g)=>Et(u,Ao[g])),w=T(void 0),E=T(0),h=ko(),f=ht(S(n,D(c,t,E),Lt(Wo,h),nt()),h),a=ht(S(c,nt(),Lt((u,g)=>({current:g,prev:u.current}),{current:[],prev:[]}),B(({prev:u})=>u)),[]);O(S(c,P(u=>u.length>0),D(f,E),B(([u,g,C])=>{const z=u.reduce((L,W,_)=>vt(L,W,ie(W,g.offsetTree,C)||_),Kt());return{...g,groupIndices:u,groupOffsetTree:z}})),f),O(S(o,D(f),P(([u,{lastIndex:g}])=>u<g),B(([u,{lastIndex:g,lastSize:C}])=>[{endIndex:g,size:C,startIndex:u}])),n),O(d,m);const I=ht(S(d,B(u=>u===void 0)),!0);O(S(m,P(u=>u!==void 0&&J(it(f).sizeTree)),B(u=>{const g=it(v),C=it(c).length>0;return g!==void 0&&g!==0?C?[{endIndex:0,size:g,startIndex:0},{endIndex:1,size:u,startIndex:1}]:[]:[{endIndex:0,size:u,startIndex:0}]})),n),O(S(p,P(u=>u!==void 0&&u.length>0&&J(it(f).sizeTree)),B(u=>{const g=[];let C=u[0],z=0;for(let L=1;L<u.length;L++){const W=u[L];W!==C&&(g.push({endIndex:L-1,size:C,startIndex:z}),C=W,z=L)}return g.push({endIndex:u.length-1,size:C,startIndex:z}),g})),n),O(S(c,D(v,m),P(([,u,g])=>u!==void 0&&g!==void 0),B(([u,g,C])=>{const z=[];for(let L=0;L<u.length;L++){const W=u[L],_=u[L+1];z.push({startIndex:W,endIndex:W,size:g}),_!==void 0&&z.push({startIndex:W+1,endIndex:_-1,size:C})}return z})),n);const H=Tt(S(n,D(f),Lt(({sizes:u},[g,C])=>({changed:C!==u,sizes:C}),{changed:!1,sizes:h}),B(u=>u.changed)));Y(S(l,Lt((u,g)=>({diff:u.prev-g,prev:g}),{diff:0,prev:0}),B(u=>u.diff)),u=>{const{groupIndices:g}=it(f);if(u>0)j(e,!0),j(s,u+In(u,g));else if(u<0){const C=it(a);C.length>0&&(u-=In(-u,C)),j(i,u)}}),Y(S(l,D(t)),([u,g])=>{u<0&&g("`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},dt.ERROR)});const y=Tt(s);O(S(s,D(f),B(([u,g])=>{const C=g.groupIndices.length>0,z=[],L=g.lastSize;if(C){const W=re(g.sizeTree,0);let _=0,Z=0;for(;_<u;){const q=g.groupIndices[Z],Q=g.groupIndices.length===Z+1?1/0:g.groupIndices[Z+1]-q-1;z.push({endIndex:q,size:W,startIndex:q}),z.push({endIndex:q+1+Q-1,size:L,startIndex:q+1}),Z++,_+=Q+1}const F=_t(g.sizeTree);return _!==u&&F.shift(),F.reduce((q,{k:Q,v:gt})=>{let ut=q.ranges;return q.prevSize!==0&&(ut=[...q.ranges,{endIndex:Q+u-1,size:q.prevSize,startIndex:q.prevIndex}]),{prevIndex:Q+u,prevSize:gt,ranges:ut}},{prevIndex:u,prevSize:0,ranges:z}).ranges}return _t(g.sizeTree).reduce((W,{k:_,v:Z})=>({prevIndex:_+u,prevSize:Z,ranges:[...W.ranges,{endIndex:_+u-1,size:W.prevSize,startIndex:W.prevIndex}]}),{prevIndex:0,prevSize:L,ranges:[]}).ranges})),n);const k=Tt(S(i,D(f,E),B(([u,{offsetTree:g},C])=>{const z=-u;return ie(z,g,C)})));return O(S(i,D(f,E),B(([u,g,C])=>{if(g.groupIndices.length>0){if(J(g.sizeTree))return g;let W=Kt();const _=it(a);let Z=0,F=0,mt=0;for(;Z<-u;){mt=_[F];const Q=_[F+1]-mt-1;F++,Z+=Q+1}if(W=_t(g.sizeTree).reduce((Q,{k:gt,v:ut})=>vt(Q,Math.max(0,gt+u),ut),W),Z!==-u){const Q=re(g.sizeTree,mt);W=vt(W,0,Q);const gt=Rt(g.sizeTree,-u+1)[1];W=vt(W,1,gt)}return{...g,sizeTree:W,...Ge(g.offsetTree,0,W,C)}}const L=_t(g.sizeTree).reduce((W,{k:_,v:Z})=>vt(W,Math.max(0,_+u),Z),Kt());return{...g,sizeTree:L,...Ge(g.offsetTree,0,L,C)}})),f),{beforeUnshiftWith:y,data:w,defaultItemSize:m,firstItemIndex:l,fixedItemSize:d,fixedGroupSize:v,gap:E,groupIndices:c,heightEstimates:p,itemSize:x,listRefresh:H,shiftWith:i,shiftWithOffset:k,sizeRanges:n,sizes:f,statefulTotalCount:r,totalCount:o,trackItemSizes:I,unshiftWith:s}},rt(Pt,Ne),{singleton:!0});function jo(t){return t.reduce((e,n)=>(e.groupIndices.push(e.totalCount),e.totalCount+=n+1,e),{groupIndices:[],totalCount:0})}const Yn=K(([{groupIndices:t,sizes:e,totalCount:n},{headerHeight:o,scrollTop:r}])=>{const s=$(),i=$(),l=Tt(S(s,B(jo)));return O(S(l,B(c=>c.totalCount)),n),O(S(l,B(c=>c.groupIndices)),t),O(S(at(r,e,o),P(([c,d])=>ye(d)),B(([c,d,m])=>Rt(d.groupOffsetTree,Math.max(c-m,0),"v")[0]),nt(),B(c=>[c])),i),{groupCounts:s,topItemsIndexes:i}},rt(Ot,xt)),Mt=K(([{log:t}])=>{const e=T(!1),n=Tt(S(e,P(o=>o),nt()));return Y(e,o=>{o&&it(t)("props updated",{},dt.DEBUG)}),{didMount:n,propsReady:e}},rt(Pt),{singleton:!0}),_o=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Zn(t){const e=typeof t=="number"?{index:t}:t;return e.align||(e.align="start"),(!e.behavior||!_o)&&(e.behavior="auto"),e.offset===void 0&&(e.offset=0),e}const ae=K(([{gap:t,listRefresh:e,sizes:n,totalCount:o},{fixedFooterHeight:r,fixedHeaderHeight:s,footerHeight:i,headerHeight:l,scrollingInProgress:c,scrollTo:d,smoothScrollTargetReached:m,viewportHeight:v},{log:p}])=>{const x=$(),w=$(),E=T(0);let h=null,f=null,a=null;function I(){h!==null&&(h(),h=null),a!==null&&(a(),a=null),f&&(clearTimeout(f),f=null),j(c,!1)}return O(S(x,D(n,v,o,E,l,i,p),D(t,s,r),B(([[H,y,k,u,g,C,z,L],W,_,Z])=>{const F=Zn(H),{align:mt,behavior:q,offset:Q}=F,gt=u-1,ut=qn(F,y,gt);let It=ie(ut,y.offsetTree,W)+C;mt==="end"?(It+=_+Rt(y.sizeTree,ut)[1]-k+Z,ut===gt&&(It+=z)):mt==="center"?It+=(_+Rt(y.sizeTree,ut)[1]-k+Z)/2:It-=g,Q!==void 0&&Q!==0&&(It+=Q);const Ft=pt=>{I(),pt?(L("retrying to scroll to",{location:H},dt.DEBUG),j(x,H)):(j(w,!0),L("list did not change, scroll successful",{},dt.DEBUG))};if(I(),q==="smooth"){let pt=!1;a=Y(e,$t=>{pt=pt||$t}),h=yt(m,()=>{Ft(pt)})}else h=yt(S(e,No(150)),Ft);return f=setTimeout(()=>{I()},1200),j(c,!0),L("scrolling from index to",{behavior:q,index:ut,top:It},dt.DEBUG),{behavior:q,top:It}})),d),{scrollTargetReached:w,scrollToIndex:x,topListHeight:E}},rt(Ot,xt,Pt),{singleton:!0});function No(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 Ue(t,e){const n=e-1;return typeof t=="number"?t:t.index==="LAST"?n:t.index}const de=K(([{defaultItemSize:t,listRefresh:e,sizes:n},{scrollTop:o},{scrollTargetReached:r,scrollToIndex:s},{didMount:i}])=>{const l=T(!0),c=T(0),d=T(!0);return O(S(i,D(c),P(([m,v])=>v!==0),Bt(!1)),l),O(S(i,D(c),P(([m,v])=>v!==0),Bt(!1)),d),Y(S(at(e,i),D(l,n,t,d),P(([[,m],v,{sizeTree:p},x,w])=>m&&(!J(p)||Me(x))&&!v&&!w),D(c)),([,m])=>{yt(r,()=>{j(d,!0)}),$e(4,()=>{yt(o,()=>{j(l,!0)}),j(s,m)})}),{initialItemFinalLocationReached:d,initialTopMostItemIndex:c,scrolledToInitialItem:l}},rt(Ot,xt,ae,Mt),{singleton:!0});function Xn(t,e){return Math.abs(t-e)<1.01}const le="up",te="down",Do="none",$o={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Uo=0,fe=K(([{footerHeight:t,headerHeight:e,scrollBy:n,scrollContainerState:o,scrollTop:r,viewportHeight:s}])=>{const i=T(!1),l=T(!0),c=$(),d=$(),m=T(4),v=T(Uo),p=ht(S(Oe(S(G(r),Nt(1),Bt(!0)),S(G(r),Nt(1),Bt(!1),mn(100))),nt()),!1),x=ht(S(Oe(S(n,Bt(!0)),S(n,Bt(!1),mn(200))),nt()),!1);O(S(at(G(r),G(v)),B(([a,I])=>a<=I),nt()),l),O(S(l,zt(50)),d);const w=Tt(S(at(o,G(s),G(e),G(t),G(m)),Lt((a,[{scrollHeight:I,scrollTop:H},y,k,u,g])=>{const C=H+y-I>-g,z={scrollHeight:I,scrollTop:H,viewportHeight:y};if(C){let W,_;return H>a.state.scrollTop?(W="SCROLLED_DOWN",_=a.state.scrollTop-H):(W="SIZE_DECREASED",_=a.state.scrollTop-H||a.scrollTopDelta),{atBottom:!0,atBottomBecause:W,scrollTopDelta:_,state:z}}let L;return z.scrollHeight>a.state.scrollHeight?L="SIZE_INCREASED":y<a.state.viewportHeight?L="VIEWPORT_HEIGHT_DECREASING":H<a.state.scrollTop?L="SCROLLING_UPWARDS":L="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:L,state:z}},$o),nt((a,I)=>a!==void 0&&a.atBottom===I.atBottom))),E=ht(S(o,Lt((a,{scrollHeight:I,scrollTop:H,viewportHeight:y})=>{if(!Xn(a.scrollHeight,I)){const k=I-(H+y)<1;return a.scrollTop!==H&&k?{changed:!0,jump:a.scrollTop-H,scrollHeight:I,scrollTop:H}:{changed:!0,jump:0,scrollHeight:I,scrollTop:H}}return{changed:!1,jump:0,scrollHeight:I,scrollTop:H}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),P(a=>a.changed),B(a=>a.jump)),0);O(S(w,B(a=>a.atBottom)),i),O(S(i,zt(50)),c);const h=T(te);O(S(o,B(({scrollTop:a})=>a),nt(),Lt((a,I)=>it(x)?{direction:a.direction,prevScrollTop:I}:{direction:I<a.prevScrollTop?le:te,prevScrollTop:I},{direction:te,prevScrollTop:0}),B(a=>a.direction)),h),O(S(o,zt(50),Bt(Do)),h);const f=T(0);return O(S(p,P(a=>!a),Bt(0)),f),O(S(r,zt(100),D(p),P(([a,I])=>I),Lt(([a,I],[H])=>[I,H],[0,0]),B(([a,I])=>I-a)),f),{atBottomState:w,atBottomStateChange:c,atBottomThreshold:m,atTopStateChange:d,atTopThreshold:v,isAtBottom:i,isAtTop:l,isScrolling:p,lastJumpDueToItemResize:E,scrollDirection:h,scrollVelocity:f}},rt(xt)),ce="top",ue="bottom",Sn="none";function vn(t,e,n){return typeof t=="number"?n===le&&e===ce||n===te&&e===ue?t:0:n===le?e===ce?t.main:t.reverse:e===ue?t.main:t.reverse}function Tn(t,e){return typeof t=="number"?t:t[e]??0}const Ke=K(([{deviation:t,fixedHeaderHeight:e,headerHeight:n,scrollTop:o,viewportHeight:r}])=>{const s=$(),i=T(0),l=T(0),c=T(0),d=ht(S(at(G(o),G(r),G(n),G(s,se),G(c),G(i),G(e),G(t),G(l)),B(([m,v,p,[x,w],E,h,f,a,I])=>{const H=m-a,y=h+f,k=Math.max(p-H,0);let u=Sn;const g=Tn(I,ce),C=Tn(I,ue);return x-=a,x+=p+f,w+=p+f,w-=a,x>m+y-g&&(u=le),w<m-k+v+C&&(u=te),u!==Sn?[Math.max(H-p-vn(E,ce,u)-g,0),H-k-f+v+vn(E,ue,u)+C]:null}),P(m=>m!==null),nt(se)),[0,0]);return{increaseViewportBy:l,listBoundary:s,overscan:c,topListHeight:i,visibleRange:d}},rt(xt),{singleton:!0});function Ko(t,e,n){if(ye(e)){const o=Kn(t,e);return[{index:Rt(e.groupOffsetTree,o)[0],offset:0,size:0},{data:n?.[0],index:o,offset:0,size:0}]}return[{data: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 Se(t,e,n,o,r,s){const{lastIndex:i,lastOffset:l,lastSize:c}=r;let d=0,m=0;if(t.length>0){d=t[0].offset;const E=t[t.length-1];m=E.offset+E.size}const v=n-i,p=l+v*c+(v-1)*o,x=d,w=p-m;return{bottom:m,firstItemIndex:s,items:Cn(t,r,s),offsetBottom:w,offsetTop:d,top:x,topItems:Cn(e,r,s),topListHeight:e.reduce((E,h)=>h.size+E,0),totalCount:n}}function Jn(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=Ue(e,l),d=Array.from({length:l}).map((m,v)=>({data:s[v+c],index:v+c,offset:0,size:0}));return Se(d,[],l,r,n,o)}function Cn(t,e,n){if(t.length===0)return[];if(!ye(e))return t.map(d=>({...d,index:d.index+n,originalIndex:d.index}));const o=t[0].index,r=t[t.length-1].index,s=[],i=qt(e.groupOffsetTree,o,r);let l,c=0;for(const d of t){(!l||l.end<d.index)&&(l=i.shift(),c=e.groupIndices.indexOf(l.start));let m;d.index===l.start?m={index:c,type:"group"}:m={groupIndex:c,index:d.index-(c+1)+n},s.push({...m,data:d.data,offset:d.offset,originalIndex:d.index,size:d.size})}return s}function wn(t,e){return t===void 0?0:typeof t=="number"?t:t[e]??0}const Dt=K(([{data:t,firstItemIndex:e,gap:n,sizes:o,totalCount:r},s,{listBoundary:i,topListHeight:l,visibleRange:c},{initialTopMostItemIndex:d,scrolledToInitialItem:m},{topListHeight:v},p,{didMount:x},{recalcInProgress:w}])=>{const E=T([]),h=T(0),f=$(),a=T(0);O(s.topItemsIndexes,E);const I=ht(S(at(x,w,G(c,se),G(r),G(o),G(d),m,G(E),G(e),G(n),G(a),t),P(([u,g,,C,,,,,,,,z])=>{const L=z!==void 0&&z.length!==C;return u&&!g&&!L}),B(([,,[u,g],C,z,L,W,_,Z,F,mt,q])=>{const Q=z,{offsetTree:gt,sizeTree:ut}=Q,It=it(h);if(C===0)return{...He,totalCount:C};if(u===0&&g===0)return It===0?{...He,totalCount:C}:Jn(It,L,z,Z,F,q||[]);if(J(ut))return It>0?null:Se(Ko(Ue(L,C),Q,q),[],C,F,Q,Z);const Ft=[];if(_.length>0){const N=_[0],U=_[_.length-1];let st=0;for(const tt of qt(ut,N,U)){const X=tt.value,lt=Math.max(tt.start,N),St=Math.min(tt.end,U);for(let ct=lt;ct<=St;ct++)Ft.push({data:q?.[ct],index:ct,offset:st,size:X}),st+=X}}if(!W)return Se([],Ft,C,F,Q,Z);const pt=_.length>0?_[_.length-1]+1:0,$t=Vo(gt,u,g,pt);if($t.length===0)return null;const Xt=C-1,Ht=we([],N=>{for(const U of $t){const st=U.value;let tt=st.offset,X=U.start;const lt=st.size;if(st.offset<u){X+=Math.floor((u-st.offset+F)/(lt+F));const ct=X-U.start;tt+=ct*lt+ct*F}X<pt&&(tt+=(pt-X)*lt,X=pt);const St=Math.min(U.end,Xt);for(let ct=X;ct<=St&&!(tt>=g);ct++)N.push({data:q?.[ct],index:ct,offset:tt,size:lt}),tt+=lt+F}}),Jt=wn(mt,ce),R=wn(mt,ue);if(Ht.length>0&&(Jt>0||R>0)){const N=Ht[0],U=Ht[Ht.length-1];if(Jt>0&&N.index>pt){const st=Math.min(Jt,N.index-pt),tt=[];let X=N.offset;for(let lt=N.index-1;lt>=N.index-st;lt--){const ct=qt(ut,lt,lt)[0]?.value??N.size;X-=ct+F,tt.unshift({data:q?.[lt],index:lt,offset:X,size:ct})}Ht.unshift(...tt)}if(R>0&&U.index<Xt){const st=Math.min(R,Xt-U.index);let tt=U.offset+U.size+F;for(let X=U.index+1;X<=U.index+st;X++){const St=qt(ut,X,X)[0]?.value??U.size;Ht.push({data:q?.[X],index:X,offset:tt,size:St}),tt+=St+F}}}return Se(Ht,Ft,C,F,Q,Z)}),P(u=>u!==null),nt()),He);O(S(t,P(Me),B(u=>u?.length)),r),O(S(I,B(u=>u.topListHeight)),v),O(v,l),O(S(I,B(u=>[u.top,u.bottom])),i),O(S(I,B(u=>u.items)),f);const H=Tt(S(I,P(({items:u})=>u.length>0),D(r,t),P(([{items:u},g])=>u[u.length-1].originalIndex===g-1),B(([,u,g])=>[u-1,g]),nt(se),B(([u])=>u))),y=Tt(S(I,zt(200),P(({items:u,topItems:g})=>u.length>0&&u[0].originalIndex===g.length),B(({items:u})=>u[0].index),nt())),k=Tt(S(I,P(({items:u})=>u.length>0),B(({items:u})=>{let g=0,C=u.length-1;for(;u[g].type==="group"&&g<C;)g++;for(;u[C].type==="group"&&C>g;)C--;return{endIndex:u[C].index,startIndex:u[g].index}}),nt($n)));return{endReached:H,initialItemCount:h,itemsRendered:f,listState:I,minOverscanItemCount:a,rangeChanged:k,startReached:y,topItemsIndexes:E,...p}},rt(Ot,Yn,Ke,de,ae,fe,Mt,Ne),{singleton:!0}),Qn=K(([{fixedFooterHeight:t,fixedHeaderHeight:e,footerHeight:n,headerHeight:o},{listState:r}])=>{const s=$(),i=ht(S(at(n,t,o,e,r),B(([l,c,d,m,v])=>l+c+d+m+v.offsetBottom+v.bottom)),0);return O(G(i),s),{totalListHeight:i,totalListHeightChanged:s}},rt(xt,Dt),{singleton:!0}),qo=K(([{viewportHeight:t},{totalListHeight:e}])=>{const n=T(!1),o=ht(S(at(n,t,e),P(([r])=>r),B(([,r,s])=>Math.max(0,r-s)),zt(0),nt()),0);return{alignToBottom:n,paddingTopAddition:o}},rt(xt,Qn),{singleton:!0}),to=K(()=>({context:T(null)})),Yo=({itemBottom:t,itemTop:e,locationParams:{align:n,behavior:o,...r},viewportBottom:s,viewportTop:i})=>e<i?{...r,align:n??"start",...o!==void 0?{behavior:o}:{}}:t>s?{...r,align:n??"end",...o!==void 0?{behavior:o}:{}}:null,eo=K(([{gap:t,sizes:e,totalCount:n},{fixedFooterHeight:o,fixedHeaderHeight:r,headerHeight:s,scrollingInProgress:i,scrollTop:l,viewportHeight:c},{scrollToIndex:d}])=>{const m=$();return O(S(m,D(e,c,n,s,r,o,l),D(t),B(([[v,p,x,w,E,h,f,a],I])=>{const{calculateViewLocation:H=Yo,done:y,...k}=v,u=qn(v,p,w-1),g=ie(u,p.offsetTree,I)+E+h,C=g+Rt(p.sizeTree,u)[1],z=a+h,L=a+x-f,W=H({itemBottom:C,itemTop:g,locationParams:k,viewportBottom:L,viewportTop:z});return W!==null?y&&yt(S(i,P(_=>!_),Nt(it(i)?1:2)),y):y?.(),W}),P(v=>v!==null)),d),{scrollIntoView:m}},rt(Ot,xt,ae,Dt,Pt),{singleton:!0});function yn(t){return t===!1?!1:t==="smooth"?"smooth":"auto"}const Zo=(t,e)=>typeof t=="function"?yn(t(e)):e&&yn(t),Xo=K(([{listRefresh:t,totalCount:e,fixedItemSize:n,data:o},{atBottomState:r,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:l},{didMount:c,propsReady:d},{log:m},{scrollingInProgress:v},{context:p},{scrollIntoView:x}])=>{const w=T(!1),E=$();let h=null;function f(y){j(i,{align:"end",behavior:y,index:"LAST"})}Y(S(at(S(G(e),Nt(1)),c),D(G(w),s,l,v),B(([[y,k],u,g,C,z])=>{let L=k&&C,W="auto";return L&&(W=Zo(u,g||z),L=L&&W!==!1),{followOutputBehavior:W,shouldFollow:L,totalCount:y}}),P(({shouldFollow:y})=>y)),({followOutputBehavior:y,totalCount:k})=>{h!==null&&(h(),h=null),it(n)!==void 0?requestAnimationFrame(()=>{it(m)("following output to ",{totalCount:k},dt.DEBUG),f(y)}):h=yt(t,()=>{it(m)("following output to ",{totalCount:k},dt.DEBUG),f(y),h=null})});function a(y){const k=yt(r,u=>{y&&!u.atBottom&&u.notAtBottomBecause==="SIZE_INCREASED"&&h===null&&(it(m)("scrolling to bottom due to increased size",{},dt.DEBUG),f("auto"))});setTimeout(k,100)}Y(S(at(G(w),e,d),P(([y,,k])=>y!==!1&&k),Lt(({value:y},[,k])=>({refreshed:y===k,value:k}),{refreshed:!1,value:0}),P(({refreshed:y})=>y),D(w,e)),([,y])=>{it(l)&&a(y!==!1)}),Y(E,()=>{a(it(w)!==!1)}),Y(at(G(w),r),([y,k])=>{y!==!1&&!k.atBottom&&k.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&f("auto")});const I=T(null),H=$();return O(Oe(S(G(o),B(y=>y?.length??0)),S(G(e))),H),Y(S(at(S(H,Nt(1)),c),D(G(I),l,v,p),B(([[y,k],u,g,C,z])=>k&&g&&u?.({context:z,totalCount:y,scrollingInProgress:C})),P(y=>!!y),zt(0)),y=>{h!==null&&(h(),h=null),it(n)!==void 0?requestAnimationFrame(()=>{it(m)("scrolling into view",{}),j(x,y)}):h=yt(t,()=>{it(m)("scrolling into view",{}),j(x,y),h=null})}),{autoscrollToBottom:E,followOutput:w,scrollIntoViewOnChange:I}},rt(Ot,fe,ae,de,Mt,Pt,xt,to,eo)),Jo=K(([{data:t,firstItemIndex:e,gap:n,sizes:o},{initialTopMostItemIndex:r},{initialItemCount:s,listState:i},{didMount:l}])=>(O(S(l,D(s),P(([,c])=>c!==0),D(r,o,e,n,t),B(([[,c],d,m,v,p,x=[]])=>Jn(c,d,m,v,p,x))),i),{}),rt(Ot,de,Dt,Mt),{singleton:!0}),Qo=K(([{didMount:t},{scrollTo:e},{listState:n}])=>{const o=T(0);return Y(S(t,D(o),P(([,r])=>r!==0),B(([,r])=>({top:r}))),r=>{yt(S(n,Nt(1),P(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{j(e,r)})})}),{initialScrollTop:o}},rt(Mt,xt,Dt),{singleton:!0}),no=K(([{scrollVelocity:t}])=>{const e=T(!1),n=$(),o=T(!1);return O(S(t,D(o,e,n),P(([r,s])=>s!==!1&&s!==void 0),B(([r,s,i,l])=>{const{enter:c,exit:d}=s;if(i){if(d(r,l))return!1}else if(c(r,l))return!0;return i}),nt()),e),Y(S(at(e,t,n),D(o)),([[r,s,i],l])=>{r&&l!==!1&&l!==void 0&&l.change&&l.change(s,i)}),{isSeeking:e,scrollSeekConfiguration:o,scrollSeekRangeChanged:n,scrollVelocity:t}},rt(fe),{singleton:!0}),qe=K(([{scrollContainerState:t,scrollTo:e}])=>{const n=$(),o=$(),r=$(),s=T(!1),i=T(void 0);return O(S(at(n,o),B(([{scrollTop:l,viewportHeight:c},{offsetTop:d,listHeight:m}])=>({scrollHeight:m,scrollTop:Math.max(0,l-d),viewportHeight:c}))),t),O(S(e,D(o),B(([l,{offsetTop:c}])=>({...l,top:l.top+c}))),r),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:r,windowViewportRect:o}},rt(xt)),tr=K(([{sizeRanges:t,sizes:e},{headerHeight:n,scrollTop:o},{initialTopMostItemIndex:r},{didMount:s},{useWindowScroll:i,windowScrollContainerState:l,windowViewportRect:c}])=>{const d=$(),m=T(void 0),v=T(null),p=T(null);return O(l,v),O(c,p),Y(S(d,D(e,o,i,v,p,n)),([x,w,E,h,f,a,I])=>{const H=Go(w.sizeTree);h&&f!==null&&a!==null&&(E=f.scrollTop-a.offsetTop),E-=I,x({ranges:H,scrollTop:E})}),O(S(m,P(Me),B(er)),r),O(S(s,D(m),P(([,x])=>x!==void 0),nt(),B(([,x])=>x.ranges)),t),{getState:d,restoreStateFrom:m}},rt(Ot,xt,de,Mt,qe));function er(t){return{align:"start",index:0,offset:t.scrollTop}}const nr=K(([{topItemsIndexes:t}])=>{const e=T(0);return O(S(e,P(n=>n>=0),B(n=>Array.from({length:n}).map((o,r)=>r))),t),{topItemCount:e}},rt(Dt));function oo(t){let e=!1,n;return(()=>(e||(e=!0,n=t()),n))}const or=oo(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),rr=K(([{deviation:t,scrollBy:e,scrollingInProgress:n,scrollTop:o},{isAtBottom:r,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:l},{listState:c},{beforeUnshiftWith:d,gap:m,shiftWithOffset:v,sizes:p},{log:x},{recalcInProgress:w}])=>{const E=Tt(S(c,D(i),Lt(([,f,a,I],[{bottom:H,items:y,offsetBottom:k,totalCount:u},g])=>{const C=H+k;let z=0;return a===u&&f.length>0&&y.length>0&&(y[0].originalIndex===0&&f[0].originalIndex===0||(z=C-I,z!==0&&(z+=g))),[z,y,u,C]},[0,[],0,0]),P(([f])=>f!==0),D(o,l,n,r,x,w),P(([,f,a,I,,,H])=>!H&&!I&&f!==0&&a===le),B(([[f],,,,,a])=>(a("Upward scrolling compensation",{amount:f},dt.DEBUG),f))));function h(f){f>0?(j(e,{behavior:"auto",top:-f}),j(t,0)):(j(t,0),j(e,{behavior:"auto",top:-f}))}return Y(S(E,D(t,s)),([f,a,I])=>{I&&or()?j(t,a-f):h(-f)}),Y(S(at(ht(s,!1),t,w),P(([f,a,I])=>!f&&!I&&a!==0),B(([f,a])=>a),zt(1)),h),O(S(v,B(f=>({top:-f}))),e),Y(S(d,D(p,m),B(([f,{groupIndices:a,lastSize:I,sizeTree:H},y])=>{function k(L){return L*(I+y)}if(a.length===0)return k(f);let u=0;const g=re(H,0);let C=0,z=0;for(;C<f;){C++,u+=g;let L=a.length===z+1?1/0:a[z+1]-a[z]-1;C+L>f&&(u-=g,L=f-C+1),C+=L,u+=k(L),z++}return u})),f=>{j(t,f),requestAnimationFrame(()=>{j(e,{top:f}),requestAnimationFrame(()=>{j(t,0),j(w,!1)})})}),{deviation:t}},rt(xt,fe,Dt,Ot,Pt,Ne)),sr=K(([t,e,n,o,r,s,i,l,c,d,m])=>({...t,...e,...n,...o,...r,...s,...i,...l,...c,...d,...m}),rt(Ke,Jo,Mt,no,Qn,Qo,qo,qe,eo,Pt,to)),ro=K(([{data:t,defaultItemSize:e,firstItemIndex:n,fixedItemSize:o,fixedGroupSize:r,gap:s,groupIndices:i,heightEstimates:l,itemSize:c,sizeRanges:d,sizes:m,statefulTotalCount:v,totalCount:p,trackItemSizes:x},{initialItemFinalLocationReached:w,initialTopMostItemIndex:E,scrolledToInitialItem:h},f,a,I,H,{scrollToIndex:y},k,{topItemCount:u},{groupCounts:g},C])=>{const{listState:z,minOverscanItemCount:L,topItemsIndexes:W,rangeChanged:_,...Z}=H;return O(_,C.scrollSeekRangeChanged),O(S(C.windowViewportRect,B(F=>F.visibleHeight)),f.viewportHeight),{data:t,defaultItemHeight:e,firstItemIndex:n,fixedItemHeight:o,fixedGroupHeight:r,gap:s,groupCounts:g,heightEstimates:l,initialItemFinalLocationReached:w,initialTopMostItemIndex:E,scrolledToInitialItem:h,sizeRanges:d,topItemCount:u,topItemsIndexes:W,totalCount:p,...I,groupIndices:i,itemSize:c,listState:z,minOverscanItemCount:L,scrollToIndex:y,statefulTotalCount:v,trackItemSizes:x,rangeChanged:_,...Z,...C,...f,sizes:m,...a}},rt(Ot,de,xt,tr,Xo,Dt,ae,rr,nr,Yn,sr));function ir(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 ge=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Ye(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=b.createContext({});function c(f,a){f.propsReady!==void 0&&j(f.propsReady,!1);for(const I of o){const H=f[e.required[I]];j(H,a[I])}for(const I of r)if(I in a){const H=f[e.optional[I]];j(H,a[I])}f.propsReady!==void 0&&j(f.propsReady,!0)}function d(f){return s.reduce((a,I)=>(a[I]=H=>{const y=f[e.methods[I]];j(y,H)},a),{})}function m(f){return i.reduce((a,I)=>(a[I]=Co(f[e.events[I]]),a),{})}const v=b.forwardRef(function(a,I){const{children:H,...y}=a,[k]=b.useState(()=>we(yo(t),C=>{c(C,y)})),[u]=b.useState(fn(m,k));ge(()=>{for(const C of i)C in y&&Y(u[C],y[C]);return()=>{Object.values(u).map(Ae)}},[y,u,k]),ge(()=>{c(k,y)}),b.useImperativeHandle(I,dn(d(k)));const g=n;return V.jsx(l.Provider,{value:k,children:n!==void 0?V.jsx(g,{...ir([...o,...r,...i],y),children:H}):H})}),p=f=>{const a=b.useContext(l);return b.useCallback(I=>{j(a[f],I)},[a,f])},x=f=>{const I=b.useContext(l)[f],H=b.useCallback(y=>Y(I,y),[I]);return b.useSyncExternalStore(H,()=>it(I),()=>it(I))},w=f=>{const I=b.useContext(l)[f],[H,y]=b.useState(fn(it,I));return ge(()=>Y(I,k=>{k!==H&&y(dn(k))}),[I,H]),H},E=parseInt(b.version)>=18?x:w;return{Component:v,useEmitter:(f,a)=>{const H=b.useContext(l)[f];ge(()=>Y(H,a),[a,H])},useEmitterValue:E,usePublisher:p}}const me=b.createContext(void 0),Ze=b.createContext(void 0),Be="-webkit-sticky",bn="sticky",Xe=oo(()=>{if(typeof document>"u")return bn;const t=document.createElement("div");return t.style.position=Be,t.style.position===Be?Be:bn}),so=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Le(t){return"self"in t}function lr(t){return"body"in t}function io(t,e,n,o=Zt,r,s){const i=b.useRef(null),l=b.useRef(null),c=b.useRef(null),d=b.useCallback(p=>{let x,w,E;const h=p.target;if(lr(h)||Le(h)){const a=Le(h)?h:h.defaultView;E=s===!0?jt(a,a.scrollX):a.scrollY,x=s===!0?a.document.documentElement.scrollWidth:a.document.documentElement.scrollHeight,w=s===!0?a.innerWidth:a.innerHeight}else E=s===!0?jt(h,h.scrollLeft):h.scrollTop,x=s===!0?h.scrollWidth:h.scrollHeight,w=s===!0?h.offsetWidth:h.offsetHeight;const f=()=>{t({scrollHeight:x,scrollTop:Math.max(E,0),viewportHeight:w})};p.suppressFlushSync===!0?f():go.flushSync(f),l.current!==null&&(E===l.current||E<=0||E===x-w)&&(l.current=null,e(!0),c.current&&(clearTimeout(c.current),c.current=null))},[t,e,s]);b.useEffect(()=>{const p=r||i.current;return pn(p),o(r||i.current),d({suppressFlushSync:!0,target:p}),p.addEventListener("scroll",d,{passive:!0}),()=>{pn(p),o(null),p.removeEventListener("scroll",d)}},[i,d,n,o,r]);function m(p){const x=i.current;if(!x||(s===!0?"offsetWidth"in x&&x.offsetWidth===0:"offsetHeight"in x&&x.offsetHeight===0))return;const w=p.behavior==="smooth";let E,h,f;Le(x)?(h=Math.max(Et(x.document.documentElement,s===!0?"width":"height"),s===!0?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight),E=s===!0?x.innerWidth:x.innerHeight,f=s===!0?jt(x,x.scrollX):x.scrollY):(h=x[s===!0?"scrollWidth":"scrollHeight"],E=Et(x,s===!0?"width":"height"),f=s===!0?jt(x,x.scrollLeft):x.scrollTop);const a=h-E;if(p.top===void 0){x.scrollTo(p);return}const I=Math.ceil(Math.max(Math.min(a,p.top),0));if(p.top=I,Xn(E,h)||I===f){t({scrollHeight:h,scrollTop:f,viewportHeight:E}),w&&e(!0);return}w?(l.current=I,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,l.current=null,e(!0)},1e3)):l.current=null,s===!0&&(p={...p.behavior!==void 0?{behavior:p.behavior}:{},left:hn(x,I)}),x.scrollTo(p)}function v(p){s===!0&&(p={...p.behavior!==void 0?{behavior:p.behavior}:{},...p.top!==void 0?{left:hn(i.current,p.top)}:{}}),i.current.scrollBy(p)}return{scrollByCallback:v,scrollerRef:i,scrollToCallback:m}}function Je(t){return t}const cr=K(()=>{const t=T(l=>`Item ${l}`),e=T(l=>`Group ${l}`),n=T({}),o=T(Je),r=T("div"),s=T(Zt),i=(l,c=null)=>ht(S(n,B(d=>d[l]),nt()),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")}}),ur=K(([t,e])=>({...t,...e}),rt(ro,cr)),ar=({height:t})=>V.jsx("div",{style:{height:t}}),dr={overflowAnchor:"none",position:Xe(),zIndex:1},lo={overflowAnchor:"none"},fr={...lo,display:"inline-block",height:"100%"},Rn=b.memo(function({showTopList:e=!1}){const n=M("listState"),o=Ct("sizeRanges"),r=M("useWindowScroll"),s=M("customScrollParent"),i=Ct("windowScrollContainerState"),l=Ct("scrollContainerState"),c=s||r?i:l,d=M("itemContent"),m=M("context"),v=M("groupContent"),p=M("trackItemSizes"),x=M("itemSize"),w=M("log"),E=Ct("gap"),h=M("horizontalDirection"),{callbackRef:f}=Mn(o,x,p,e?Zt:c,w,E,s,h,M("skipAnimationFrameInResizeObserver")),[a,I]=b.useState(0);nn("deviation",F=>{a!==F&&I(F)});const H=M("EmptyPlaceholder"),y=M("ScrollSeekPlaceholder")??ar,k=M("ListComponent"),u=M("ItemComponent"),g=M("GroupComponent"),C=M("computeItemKey"),z=M("isSeeking"),L=M("groupIndices").length>0,W=M("alignToBottom"),_=M("initialItemFinalLocationReached"),Z=e?{}:{boxSizing:"border-box",...h?{display:"inline-block",height:"100%",marginInlineStart:a!==0?a:W?"auto":0,paddingInlineEnd:n.offsetBottom,paddingInlineStart:n.offsetTop,whiteSpace:"nowrap"}:{marginTop:a!==0?a:W?"auto":0,paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},..._?{}:{visibility:"hidden"}};return!e&&n.totalCount===0&&H!==null&&H!==void 0?V.jsx(H,{...ot(H,m)}):V.jsx(k,{...ot(k,m),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:f,style:Z,children:(e?n.topItems:n.items).map(F=>{const mt=F.originalIndex,q=C(mt+n.firstItemIndex,F.data,m);return z?b.createElement(y,{...ot(y,m),height:F.size,index:F.index,key:q,type:F.type||"item",...F.type==="group"?{}:{groupIndex:F.groupIndex}}):F.type==="group"?b.createElement(g,{...ot(g,m),"data-index":mt,"data-item-index":F.index,"data-known-size":F.size,key:q,style:dr},v(F.index,m)):b.createElement(u,{...ot(u,m),...co(u,F.data),"data-index":mt,"data-item-group-index":F.groupIndex,"data-item-index":F.index,"data-known-size":F.size,key:q,style:h?fr:lo},L?d(F.index,F.groupIndex,F.data,m):d(F.index,F.data,m))})})}),mr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},pr={outline:"none",overflowX:"auto",position:"relative"},be=t=>({height:"100%",position:"absolute",top:0,width:"100%",...t?{display:"flex",flexDirection:"column"}:void 0}),Qe=(t,e,n=0)=>({...be(t),position:e?"relative":"absolute",top:e?-n:0}),hr={position:Xe(),top:0,width:"100%",zIndex:1};function ot(t,e){if(typeof t!="string")return{context:e}}function co(t,e){return{item:typeof t=="string"?void 0:e}}const gr=b.memo(function(){const e=M("HeaderComponent"),n=Ct("headerHeight"),o=M("HeaderFooterTag"),r=kt(b.useMemo(()=>i=>{n(Et(i,"height"))},[n]),!0,M("skipAnimationFrameInResizeObserver")),s=M("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...ot(e,s)})}):null}),xr=b.memo(function(){const e=M("FooterComponent"),n=Ct("footerHeight"),o=M("HeaderFooterTag"),r=kt(b.useMemo(()=>i=>{n(Et(i,"height"))},[n]),!0,M("skipAnimationFrameInResizeObserver")),s=M("context");return e!=null?V.jsx(o,{ref:r,children:V.jsx(e,{...ot(e,s)})}):null});function tn({useEmitter:t,useEmitterValue:e,usePublisher:n}){return b.memo(function({children:s,style:i,context:l,...c}){const d=n("scrollContainerState"),m=e("ScrollerComponent"),v=n("smoothScrollTargetReached"),p=e("scrollerRef"),x=e("horizontalDirection")||!1,{scrollByCallback:w,scrollerRef:E,scrollToCallback:h}=io(d,v,m,p,void 0,x);t("scrollTo",h),t("scrollBy",w);const f=x?pr:mr;return V.jsx(m,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:E,style:{...f,...i},tabIndex:0,...c,...ot(m,l),children:s})})}function en({useEmitter:t,useEmitterValue:e,usePublisher:n}){return b.memo(function({children:s,style:i,context:l,...c}){const d=n("windowScrollContainerState"),m=e("ScrollerComponent"),v=n("smoothScrollTargetReached"),p=e("totalListHeight"),x=e("deviation"),w=e("customScrollParent"),E=b.useRef(null),h=e("scrollerRef"),{scrollByCallback:f,scrollerRef:a,scrollToCallback:I}=io(d,v,m,h,w);return so(()=>(a.current=w||E.current?.ownerDocument.defaultView,()=>{a.current=null}),[a,w]),t("windowScrollTo",I),t("scrollBy",f),V.jsx(m,{ref:E,"data-virtuoso-scroller":!0,style:{position:"relative",...i,...p!==0?{height:p+x}:void 0},...c,...ot(m,l),children:s})})}const Ir=({children:t})=>{const e=b.useContext(me),n=Ct("viewportHeight"),o=Ct("fixedItemHeight"),r=M("alignToBottom"),s=M("horizontalDirection"),i=b.useMemo(()=>ne(n,c=>Et(c,s?"width":"height")),[n,s]),l=kt(i,!0,M("skipAnimationFrameInResizeObserver"));return b.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),V.jsx("div",{"data-viewport-type":"element",ref:l,style:be(r),children:t})},Sr=({children:t})=>{const e=b.useContext(me),n=Ct("windowViewportRect"),o=Ct("fixedItemHeight"),r=M("customScrollParent"),s=M("useWindowScroll"),i=M("topListHeight"),l=_e(n,r,M("skipAnimationFrameInResizeObserver")),c=M("alignToBottom");return b.useEffect(()=>{e&&(o(e.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),V.jsx("div",{"data-viewport-type":"window",ref:l,style:Qe(c,s,i),children:t})},vr=({children:t})=>{const e=M("TopItemListComponent")??"div",n=M("headerHeight"),o={...hr,marginTop:`${n}px`},r=M("context");return V.jsx(e,{style:o,...ot(e,r),children:t})},Tr=b.memo(function(e){const n=M("useWindowScroll"),o=M("topItemsIndexes").length>0,r=M("customScrollParent"),s=M("context"),i=r||n?wr:Cr,l=r||n?Sr:Ir;return V.jsxs(i,{...e,context:s,children:[o&&V.jsx(vr,{children:V.jsx(Rn,{showTopList:!0})}),V.jsxs(l,{children:[V.jsx(gr,{}),V.jsx(Rn,{}),V.jsx(xr,{})]})]})}),{Component:uo,useEmitter:nn,useEmitterValue:M,usePublisher:Ct}=Ye(ur,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",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"}},Tr),Cr=tn({useEmitter:nn,useEmitterValue:M,usePublisher:Ct}),wr=en({useEmitter:nn,useEmitterValue:M,usePublisher:Ct}),yr=uo,br=uo,Rr=K(()=>{const t=T(d=>V.jsxs("td",{children:["Item $",d]})),e=T(null),n=T(d=>V.jsxs("td",{colSpan:1e3,children:["Group ",d]})),o=T(null),r=T(null),s=T({}),i=T(Je),l=T(Zt),c=(d,m=null)=>ht(S(s,B(v=>v[d]),nt()),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")}}),Er=K(([t,e])=>({...t,...e}),rt(ro,Rr)),Hr=({height:t})=>V.jsx("tr",{children:V.jsx("td",{style:{height:t}})}),Br=({height:t})=>V.jsx("tr",{children:V.jsx("td",{style:{border:0,height:t,padding:0}})}),Lr={overflowAnchor:"none"},En={position:Xe(),zIndex:2,overflowAnchor:"none"},Hn=b.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,d=A("itemContent"),m=A("groupContent"),v=A("ScrollSeekPlaceholder")??Hr,p=A("GroupComponent"),x=A("TableRowComponent"),w=(e?n.topItems:[]).reduce((h,f,a)=>(a===0?h.push(f.size):h.push(h[a-1]+f.size),h),[]);return(e?n.topItems:n.items).map(h=>{const f=h.originalIndex,a=o(f+r,h.data,s),I=e?f===0?0:w[f-1]:0;return i?b.createElement(v,{...ot(v,s),height:h.size,index:h.index,key:a,type:h.type||"item"}):h.type==="group"?b.createElement(p,{...ot(p,s),"data-index":f,"data-item-index":h.index,"data-known-size":h.size,key:a,style:{...En,top:l}},m(h.index,s)):b.createElement(x,{...ot(x,s),...co(x,h.data),"data-index":f,"data-item-index":h.index,"data-known-size":h.size,"data-item-group-index":h.groupIndex,key:a,style:e?{...En,top:l+I}:Lr},c?d(h.index,h.groupIndex,h.data,s):d(h.index,h.data,s))})}),kr=b.memo(function(){const e=A("listState"),n=A("topItemsIndexes").length>0,o=bt("sizeRanges"),r=A("useWindowScroll"),s=A("customScrollParent"),i=bt("windowScrollContainerState"),l=bt("scrollContainerState"),c=s||r?i:l,d=A("trackItemSizes"),m=A("itemSize"),v=A("log"),{callbackRef:p,ref:x}=Mn(o,m,d,c,v,void 0,s,!1,A("skipAnimationFrameInResizeObserver")),[w,E]=b.useState(0);on("deviation",L=>{w!==L&&(x.current.style.marginTop=`${L}px`,E(L))});const h=A("EmptyPlaceholder"),f=A("FillerRow")??Br,a=A("TableBodyComponent"),I=A("paddingTopAddition"),H=A("statefulTotalCount"),y=A("context");if(H===0&&h!==null&&h!==void 0)return V.jsx(h,{...ot(h,y)});const k=(n?e.topItems:[]).reduce((L,W)=>L+W.size,0),u=e.offsetTop+I+w-k,g=e.offsetBottom,C=u>0?V.jsx(f,{context:y,height:u},"padding-top"):null,z=g>0?V.jsx(f,{context:y,height:g},"padding-bottom"):null;return V.jsxs(a,{"data-testid":"virtuoso-item-list",ref:p,...ot(a,y),children:[C,n&&V.jsx(Hn,{showTopList:!0}),V.jsx(Hn,{}),z]})}),Or=({children:t})=>{const e=b.useContext(me),n=bt("viewportHeight"),o=bt("fixedItemHeight"),r=kt(b.useMemo(()=>ne(n,s=>Et(s,"height")),[n]),!0,A("skipAnimationFrameInResizeObserver"));return b.useEffect(()=>{e&&(n(e.viewportHeight),o(e.itemHeight))},[e,n,o]),V.jsx("div",{"data-viewport-type":"element",ref:r,style:be(!1),children:t})},zr=({children:t})=>{const e=b.useContext(me),n=bt("windowViewportRect"),o=bt("fixedItemHeight"),r=A("customScrollParent"),s=A("useWindowScroll"),i=_e(n,r,A("skipAnimationFrameInResizeObserver"));return b.useEffect(()=>{e&&(o(e.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:e.viewportHeight,visibleWidth:100}))},[e,n,o]),V.jsx("div",{"data-viewport-type":"window",ref:i,style:Qe(!1,s),children:t})},Fr=b.memo(function(e){const n=A("useWindowScroll"),o=A("customScrollParent"),r=bt("fixedHeaderHeight"),s=bt("fixedFooterHeight"),i=A("fixedHeaderContent"),l=A("fixedFooterContent"),c=A("context"),d=kt(b.useMemo(()=>ne(r,a=>Et(a,"height")),[r]),!0,A("skipAnimationFrameInResizeObserver")),m=kt(b.useMemo(()=>ne(s,a=>Et(a,"height")),[s]),!0,A("skipAnimationFrameInResizeObserver")),v=o||n?Wr:Vr,p=o||n?zr:Or,x=A("TableComponent"),w=A("TableHeadComponent"),E=A("TableFooterComponent"),h=i?V.jsx(w,{ref:d,style:{position:"sticky",top:0,zIndex:2},...ot(w,c),children:i()},"TableHead"):null,f=l?V.jsx(E,{ref:m,style:{bottom:0,position:"sticky",zIndex:1},...ot(E,c),children:l()},"TableFoot"):null;return V.jsx(v,{...e,...ot(v,c),child