import v from"../../_util/raf.mjs";function q(s,w,y,B,a,g,h,j){let r;return e=>{if(e==null){j();return}v.cancel(r);const f=w.value,A=B.itemHeight;if(typeof e=="number")h(e);else if(e&&typeof e=="object"){let o;const{align:C}=e;"index"in e?{index:o}=e:o=f.findIndex(n=>a(n)===e.key);const{offset:b=0}=e,T=(n,k)=>{if(n<0||!s.value)return;const u=s.value.clientHeight;let x=!1,d=k;if(u){const I=k||C;let H=0,i=0,c=0;const L=Math.min(f.length,o);for(let t=0;t<=L;t+=1){const M=a(f[t]);i=H;const p=y.get(M);c=i+(p===void 0?A:p),H=c,t===o&&p===void 0&&(x=!0)}const m=s.value.scrollTop;let l=null;switch(I){case"top":l=i-b;break;case"bottom":l=c-u+b;break;default:{const t=m+u;i<m?d="top":c>t&&(d="bottom")}}l!==null&&l!==m&&h(l)}r=v(()=>{x&&g(),T(n-1,d)},2)};T(5)}}}export{q as default};
