var e=280;function t({entries:t,gapPx:n,measuredHeightsByKey:r}){let i=[],a=[],o=[],s=0;for(let[c,l]of t.entries()){let u=l.turnKey,d=r[u]??l.estimatedHeightPx??e;o.push(u),a.push(s),i.push(d),s+=d,c<t.length-1&&(s+=n)}return{bottomOffsetsPx:a.map((e,t)=>s-e-(i[t]??0)),heightsPx:i,topOffsetsPx:a,totalHeightPx:s,turnKeys:o}}function n({distanceFromBottomPx:e,layout:t,overscanCount:n,viewportHeightPx:r}){if(t.turnKeys.length===0)return{startIndex:0,endIndex:0};let i=Math.min(Math.max(0,e),t.totalHeightPx),a=Math.min(i+Math.max(0,r),t.totalHeightPx),c=o(t.bottomOffsetsPx,a),l=s(t.bottomOffsetsPx,t.heightsPx,i);return{startIndex:Math.max(0,c-n),endIndex:Math.min(t.turnKeys.length,Math.max(l,c+1)+n)}}function r({layout:e,overscanCount:t,turnKey:n}){let r=e.turnKeys.lastIndexOf(n);return r<0?null:{startIndex:Math.max(0,r-t),endIndex:Math.min(e.turnKeys.length,r+t+1)}}function i({anchorKey:e,layout:t,previousRange:n}){let r=t.turnKeys.lastIndexOf(e);return r<0?null:{startIndex:r,endIndex:Math.min(t.turnKeys.length,r+n.endIndex-n.startIndex)}}function a({layout:e,turnKey:t,viewportHeightPx:n}){let r=e.turnKeys.lastIndexOf(t);return r<0?null:Math.max(0,(e.bottomOffsetsPx[r]??0)-n/2+(e.heightsPx[r]??0)/2)}function o(e,t){let n=0,r=e.length;for(;n<r;){let i=Math.floor((n+r)/2);(e[i]??0)<t?r=i:n=i+1}return n}function s(e,t,n){let r=0,i=e.length;for(;r<i;){let a=Math.floor((r+i)/2);(e[a]??0)+(t[a]??0)<=n?i=a:r=a+1}return r}export{i as a,r as i,a as n,n as r,t};
//# sourceMappingURL=thread-virtualizer-BBdHlCi2.js.map