var He=Object.defineProperty;var ie=t=>{throw TypeError(t)};var Me=(t,e,i)=>e in t?He(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var oe=(t,e,i)=>Me(t,typeof e!="symbol"?e+"":e,i),A=(t,e,i)=>e.has(t)||ie("Cannot "+i);var c=(t,e,i)=>(A(t,e,"read from private field"),i?i.call(t):e.get(t)),P=(t,e,i)=>e.has(t)?ie("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),D=(t,e,i,r)=>(A(t,e,"write to private field"),r?r.call(t,i):e.set(t,i),i),se=(t,e,i)=>(A(t,e,"access private method"),i);import{t as ce,c as J,a as k}from"./Bd4FQpE7.js";import{o as Le,i as Pe,p as ke,q as b,e as ne,k as o,m as B,v as g,c as re,s as ae,f as N,r as Q,x as Be,t as Ge,a as Ke}from"./Bj8SChEI.js";import{p as T,a as F,i as le,b as ze,r as Fe}from"./ZhKyHBKW.js";import{e as Oe,s as O,a as qe,S as Ce,b as Ee}from"./BAITReer.js";var x,H,G,q,fe;const C=class C{constructor(e){P(this,q);P(this,x,new WeakMap);P(this,H);P(this,G);D(this,G,e)}observe(e,i){var r=c(this,x).get(e)||new Set;return r.add(i),c(this,x).set(e,r),se(this,q,fe).call(this).observe(e,c(this,G)),()=>{var a=c(this,x).get(e);a.delete(i),a.size===0&&(c(this,x).delete(e),c(this,H).unobserve(e))}}};x=new WeakMap,H=new WeakMap,G=new WeakMap,q=new WeakSet,fe=function(){return c(this,H)??D(this,H,new ResizeObserver(e=>{for(var i of e){C.entries.set(i.target,i);for(var r of c(this,x).get(i.target)||[])r(i)}}))},oe(C,"entries",new WeakMap);let U=C;var Ye=new U({box:"border-box"});function R(t,e,i){var r=Ye.observe(t,()=>i(t[e]));Le(()=>(Pe(()=>i(t[e])),r))}function je(t=100){let e;return i=>{clearTimeout(e),e=setTimeout(i,t)}}function Ae(t=200){let e,i;return(r,a)=>l=>{e&&(Math.abs(l-e)>r?(a.fast(),i!==void 0&&(clearTimeout(i),i=void 0),i=setTimeout(()=>{a.slow(),i=void 0},t)):i===void 0&&a.slow()),e=l}}const V={ceil:(t,e)=>Math.ceil(t/e)*e,floor:(t,e)=>~~(t/e)*e},De=(t,e,i,r,a,l)=>{const S=[],d=V.floor(l/e*r,r),K=d>a?d-a:0,E=d>0&&K>=0?K:d,W=Math.min(t,V.ceil((l+i)/e*r,r))+a,M=W<t?W:t;for(let h=E;h<M;h++)S.push(h);return S},de=(t,e)=>~~(t/e),Je=je(),Ne=Ae();var Qe=ce("<div><!></div>"),Re=ce("<div><!> <div></div> <!></div>");function $e(t,e){ke(e,!0);let i=T(e,"width",3,"100%"),r=T(e,"overScan",3,1),a=T(e,"marginLeft",3,0),l=T(e,"marginTop",3,0),S=T(e,"scrollPosition",15,0),d=T(e,"scrollBehavior",3,"auto"),K=T(e,"getKey",3,s=>s),E=Fe(e,["$$slots","$$events","$$legacy","itemCount","itemHeight","itemWidth","height","width","overScan","marginLeft","marginTop","scrollPosition","scrollBehavior","getKey","columnCount","onscroll","header","item","placeholder","footer"]),f=b(void 0),W=b(F(S())),M=b(0),h=b(0),X=b(0),Z=b(F([])),y=!1,Y=!1,j=b(!1);function he(s,n=d()){p(de(s,o(u))*e.itemHeight+l()+o(M),n)}function ue(s,n=d()){p(s,n)}const p=(s,n=d())=>{o(f)&&(y=!0,o(f).scrollTo({top:s,behavior:n}),y=!1)},ve=s=>{o(f)&&!y&&!Y&&(y=!0,o(f).scrollTo({top:s,behavior:d()}),y=!1)},me=s=>{const n=de(s,o(u)),w=s%o(u);return{rowIndex:n,columnIndex:w,style:`position: absolute; transform: translate3d(${w*e.itemWidth+a()}px, ${n*e.itemHeight+l()}px, 0px); height: ${e.itemHeight}px; width: ${e.itemWidth}px; will-change: transform;`}},ge=s=>{Y=!0,y||(g(W,F(Math.max(0,s.currentTarget.scrollTop-o(M)))),S(s.currentTarget.scrollTop),o(we)(o(W))),Je(()=>{Y=!1})};let u=B(()=>e.columnCount?e.columnCount:Math.max(~~((o(h)-a()-(o(h)-o(X)))/e.itemWidth),1)),xe=B(()=>V.ceil(e.itemCount,o(u))*e.itemHeight/o(u)),_e=B(()=>o(u)*r());ne(()=>{(o(h)||o(u))&&g(Z,F(De(e.itemCount,e.itemHeight,e.height,o(u),o(_e),o(W))))}),ne(()=>{o(f)&&ve(S())});let we=B(()=>Ne(e.height,{fast:()=>{g(j,!0)},slow:()=>{g(j,!1)}}));var _=Re(),Ie=s=>{var n;ge(s),(n=e.onscroll)==null||n.call(e,s)};let $;var ee=re(_);{var be=s=>{var n=Qe(),w=re(n);O(w,()=>e.header),Q(n),R(n,"offsetHeight",v=>g(M,v)),k(s,n)};le(ee,s=>{e.header&&s(be)})}var z=ae(ee,2);let te;Oe(z,21,()=>o(Z),s=>K()(s),(s,n)=>{var w=J();const v=B(()=>{const{rowIndex:m,columnIndex:I,style:L}=me(o(n));return{rowIndex:m,columnIndex:I,style:L}});var Se=N(w);{var We=m=>{var I=J(),L=N(I);O(L,()=>e.item,()=>({index:o(n),rowIndex:o(v).rowIndex,columnIndex:o(v).columnIndex,style:o(v).style})),k(m,I)},ye=m=>{var I=J(),L=N(I);O(L,()=>e.placeholder,()=>({index:o(n),rowIndex:o(v).rowIndex,columnIndex:o(v).columnIndex,style:o(v).style})),k(m,I)};le(Se,m=>{!o(j)||!e.placeholder?m(We):m(ye,!1)})}k(s,w)}),Q(z);var Te=ae(z,2);return O(Te,()=>e.footer??Be),Q(_),ze(_,s=>g(f,s),()=>o(f)),Ge(()=>{$=qe(_,$,{onscroll:Ie,...E,[Ce]:{position:"relative",overflow:"auto",height:`${e.height??""}px`,width:i()}}),te=Ee(z,"",te,{height:`${o(xe)??""}px`,width:"100%"})}),R(_,"offsetWidth",s=>g(h,s)),R(_,"clientWidth",s=>g(X,s)),k(t,_),Ke({scrollToIndex:he,scrollToPosition:ue})}export{$e as G};
