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