const e=require("../../_util/raf.js");function t(t,n,r,i,a,o,s,c){let l;return u=>{if(u==null){c();return}e.default.cancel(l);let d=n.value,f=i.itemHeight;if(typeof u==`number`)s(u);else if(u&&typeof u==`object`){let n,{align:i}=u;`index`in u?{index:n}=u:n=d.findIndex(e=>a(e)===u.key);let{offset:c=0}=u,p=(u,m)=>{if(u<0||!t.value)return;let h=t.value.clientHeight,g=!1,_=m;if(h){let e=m||i,o=0,l=0,u=0,p=Math.min(d.length,n);for(let e=0;e<=p;e+=1){let t=a(d[e]);l=o;let i=r.get(t);u=l+(i===void 0?f:i),o=u,e===n&&i===void 0&&(g=!0)}let v=t.value.scrollTop,y=null;switch(e){case`top`:y=l-c;break;case`bottom`:y=u-h+c;break;default:{let e=v+h;l<v?_=`top`:u>e&&(_=`bottom`)}}y!==null&&y!==v&&s(y)}l=e.default(()=>{g&&o(),p(u-1,_)},2)};p(5)}}}exports.default=t;