@aiquants/virtualscroll 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1005 -972
- package/dist/src/ScrollBar.d.ts +7 -1
- package/dist/src/ScrollBar.d.ts.map +1 -1
- package/dist/src/ScrollPane.d.ts +4 -0
- package/dist/src/ScrollPane.d.ts.map +1 -1
- package/dist/src/TapScrollCircle.d.ts +3 -1
- package/dist/src/TapScrollCircle.d.ts.map +1 -1
- package/dist/src/VirtualScroll.d.ts +3 -1
- package/dist/src/VirtualScroll.d.ts.map +1 -1
- package/dist/src/useFenwickMapTree.d.ts.map +1 -1
- package/dist/styles/virtualscroll.css +1 -1
- package/dist/virtualscroll.css +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),n=require("react"),Ue=require("tailwind-merge"),ct={active:!1,offsetX:0,offsetY:0,distance:0,direction:0},ot=6,_t=8,Ft=({dragState:s,normalizedDistance:e})=>{const t=1+e*.18,r=.16+e*.24,o=.38+e*.28,l=s.active?"80ms ease-out":"220ms ease";return L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"absolute inset-0 rounded-full",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",boxShadow:`0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${r})`,transform:`scale(${t})`,transition:`${l}, ${s.active?"80ms":"260ms"} box-shadow ease`}}),L.jsx("div",{className:"aqvs:tap-scroll-circle-inner absolute rounded-full",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",boxShadow:"inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",opacity:o,transition:s.active?"120ms opacity ease-out":"220ms opacity ease"}})]})},gt=n.forwardRef(({onDragChange:s,className:e,maxVisualDistance:t=160,size:r=40,style:o,opacity:l=1,renderVisual:f},p)=>{const[c,u]=n.useState(ct),d=n.useRef(null),g=n.useRef({x:0,y:0}),C=n.useRef(null),T=n.useRef(0),F=n.useCallback(w=>{u(w),s(w)},[s]),V=n.useCallback((w,S,K=!1)=>{const{x:te,y:ve}=g.current,ne=w-te,U=S-ve,ae=Math.abs(U),ue=ae<ot?0:U<0?-1:1,y=T.current;let P=ue;const M=ot+_t;ue===0?y!==0&&ae<M?P=y:(P=0,K||(T.current=0)):ue!==y&&y!==0&&ae<M?P=y:T.current=ue,F({active:K||ae>=ot,offsetX:ne,offsetY:U,distance:ae,direction:P})},[F]),J=n.useCallback(w=>{if(w===null)return;const S=C.current;S?.hasPointerCapture(w)&&S.releasePointerCapture(w)},[]),O=n.useCallback((w=!1)=>{w&&J(d.current),d.current=null,T.current=0,F(ct)},[F,J]),ce=n.useCallback(w=>{w.preventDefault(),w.stopPropagation();const S=C.current??w.currentTarget,{left:K,top:te,width:ve,height:ne}=S.getBoundingClientRect();g.current={x:K+ve/2,y:te+ne/2},d.current=w.pointerId,S.setPointerCapture(w.pointerId),V(w.clientX,w.clientY,!0)},[V]),E=n.useCallback(w=>{d.current===w.pointerId&&(w.preventDefault(),V(w.clientX,w.clientY))},[V]),k=n.useCallback(w=>{d.current===w.pointerId&&(w.preventDefault(),w.stopPropagation(),O(!0))},[O]);n.useImperativeHandle(p,()=>({reset:()=>{O(!0)},getElement:()=>C.current}),[O]);const z=Math.min(Math.max(l,0),1),N=r/64,R=Math.min(c.distance,t)/t,H=c.direction*R*10*N,j=f??Ft,_={dragState:c,normalizedDistance:R,sizeScale:N,size:r,opacity:z},x={...o,width:r,height:r,transform:`translateY(${H}px)`};return x.opacity=z,L.jsx("div",{ref:C,"data-testid":"virtual-scroll-tap-circle",className:Ue.twMerge("relative flex touch-none select-none items-center justify-center","transition-transform duration-100 ease-out",e),style:x,tabIndex:-1,onPointerDown:ce,onPointerMove:E,onPointerUp:k,onPointerCancel:k,role:"presentation",children:j(_)})});gt.displayName="TapScrollCircle";const le=(s,e,t)=>Math.min(t,Math.max(e,s)),at="virtualscroll:tap-scroll-cancel",ut=20,Nt=250,Lt=60,Ot=20,Yt=20,zt=240,ft={active:!1,offsetX:0,offsetY:0,distance:0,direction:0},it=2.2,Ht=8,Xt=120,jt=1/60,Fe={enabled:!0,size:40,offsetX:-80,offsetY:0,className:void 0,maxVisualDistance:zt,minSpeedMultiplier:.2,opacity:.9,renderVisual:void 0,maxSpeedCurve:void 0},qt=s=>s?{mainSizeKey:"width",crossSizeKey:"height",positionKey:"left",selectDelta:(e,t)=>e,getPointerCoordinate:({clientX:e})=>e,arrowLabels:["Scroll left","Scroll right"],arrowIcons:["◀","▶"],directionClass:"flex flex-row items-stretch",orientation:"horizontal"}:{mainSizeKey:"height",crossSizeKey:"width",positionKey:"top",selectDelta:(e,t)=>t,getPointerCoordinate:({clientY:e})=>e,arrowLabels:["Scroll up","Scroll down"],arrowIcons:["▲","▼"],directionClass:"flex flex-col items-stretch",orientation:"vertical"},Ut=(s,e)=>{const t=s?.maxSpeedMultiplier,r=typeof t=="number"?t:Wt(e);return{enabled:s?.enabled??Fe.enabled,size:s?.size??Fe.size,offsetX:s?.offsetX??Fe.offsetX,offsetY:s?.offsetY??Fe.offsetY,className:s?.className??Fe.className,maxVisualDistance:s?.maxVisualDistance??Fe.maxVisualDistance,maxSpeedMultiplier:r,minSpeedMultiplier:Math.max(s?.minSpeedMultiplier??Fe.minSpeedMultiplier,0),opacity:le(s?.opacity??Fe.opacity,0,1),renderVisual:s?.renderVisual??Fe.renderVisual,maxSpeedCurve:s?.maxSpeedCurve??Fe.maxSpeedCurve}},Bt=({isDragging:s,isThumbHovered:e,enableThumbDrag:t})=>n.useMemo(()=>t?s?"dragging":e?"hover":"idle":"disabled",[t,s,e]),$t=({canUseArrowButtons:s,enableArrowButtons:e,resetTapScroll:t,scrollByStep:r})=>{const o=n.useRef(null),l=n.useRef(null),f=n.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),p=n.useCallback(()=>{f()},[f]),c=n.useCallback(d=>g=>{s&&(g.preventDefault(),g.stopPropagation(),t(),f(),r(d),l.current=window.setTimeout(()=>{o.current=window.setInterval(()=>{r(d)},Lt)},Nt))},[s,f,t,r]),u=n.useCallback(d=>g=>{e&&(g.key==="Enter"||g.key===" "||g.key==="Spacebar")&&(g.preventDefault(),r(d))},[e,r]);return n.useEffect(()=>()=>{f()},[f]),{handleArrowPointerDown:c,handleArrowPointerUp:p,handleArrowKeyDown:u}},Wt=s=>{if(!s||s<=0)return it;const e=Math.max(1,s),t=Math.log10(e),r=it+t*Ht;return le(r,it,Xt)},xt=({contentSize:s,viewportSize:e,scrollPosition:t,onScroll:r,enableThumbDrag:o=!0,enableTrackClick:l=!0,enableArrowButtons:f=!0,horizontal:p=!1,scrollBarWidth:c=12,className:u,ariaControls:d,tapScrollCircleOptions:g,itemCount:C,renderThumbOverlay:T})=>{const[F,V]=n.useState(!1),[J,O]=n.useState(!1),[ce,E]=n.useState(!1),k=n.useRef(null),z=n.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}),N=n.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}),R=n.useRef(t),H=n.useRef(ft),j=n.useRef(null),_=n.useRef(null),x=n.useRef(null),w=n.useMemo(()=>Ut(g,C),[C,g]),S=n.useMemo(()=>qt(p),[p]),{enabled:K,size:te,offsetX:ve,offsetY:ne,className:U,maxVisualDistance:ae,maxSpeedMultiplier:ue,minSpeedMultiplier:y,opacity:P,renderVisual:M,maxSpeedCurve:re}=w,B=n.useRef({viewportSize:e,maxScrollPosition:Math.max(s-e,0),scrollBarVisible:s>e,effectiveTapMaxDistance:Math.max(ae,1),tapCircleMaxSpeedMultiplier:ue,tapCircleMinSpeedMultiplier:y,tapCircleMaxSpeedCurve:re,tapScrollCircleOptions:g}),{mainSizeKey:G,crossSizeKey:fe,positionKey:Q,selectDelta:se,getPointerCoordinate:ee,arrowLabels:me,arrowIcons:de,directionClass:he,orientation:Te}=S,ye=Math.max(ae,1),Ee=e/s,m=c,h=Math.max(e-m*2,0),pe=Ee*h,Z=Math.min(Math.max(ut,pe||0),h||ut),Y=s-e,we=Math.max(h-Z,0),ge=Y<=0||we<=0?0:t/Y*we,Re=ge+Z/2,xe=s>e,Ae=xe&&f;B.current={viewportSize:e,maxScrollPosition:Y,scrollBarVisible:xe,effectiveTapMaxDistance:ye,tapCircleMaxSpeedMultiplier:ue,tapCircleMinSpeedMultiplier:y,tapCircleMaxSpeedCurve:re,tapScrollCircleOptions:g},n.useEffect(()=>{R.current=t},[t]),n.useEffect(()=>{o||O(!1)},[o]);const Ye=Bt({isDragging:F,isThumbHovered:J,enableThumbDrag:o}),Ce=n.useCallback((i,b)=>{const A=B.current,W=b??R.current;if(r){const De=r(i,W);if(typeof De=="number"&&Number.isFinite(De))return R.current=De,De}const be=typeof i=="function"?i(W):i,Ie=Math.max(A.maxScrollPosition,0),Ve=A.scrollBarVisible?le(be,0,Ie):0;return R.current=Ve,Ve},[r]),_e=n.useCallback(i=>{const b=B.current,A=R.current;if(!b.scrollBarVisible||b.maxScrollPosition<=0){const De=Ce(0,A),rt=De-A;return{nextPosition:De,actualDelta:rt,reachedBoundary:!0}}if(i===0)return{nextPosition:A,actualDelta:0,reachedBoundary:!1};const be=Ce(De=>le(De+i,0,b.maxScrollPosition),A),Ie=be-A,Ve=Ie===0||i<0&&be<=0||i>0&&be>=b.maxScrollPosition;return{nextPosition:be,actualDelta:Ie,reachedBoundary:Ve}},[Ce]),oe=n.useCallback(()=>{_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),x.current=null},[]),Se=n.useCallback(()=>{H.current={...ft},E(!1),j.current?.reset(),oe()},[oe]),He=n.useCallback(i=>{const b=H.current,A=B.current;if(!b.active||b.direction===0){oe();return}if(!A.scrollBarVisible||A.maxScrollPosition<=0){oe();return}const W=x.current??i,be=Math.max((i-W)/1e3,0),Ie=Math.min(be,jt);if(x.current=i,Ie<=0){_.current=window.requestAnimationFrame(He);return}const Ve=Math.min(b.distance,A.effectiveTapMaxDistance)/A.effectiveTapMaxDistance,De=Ve**1.1,rt=typeof A.tapScrollCircleOptions?.maxSpeedMultiplier=="number",Be=Math.max(A.viewportSize*A.tapCircleMinSpeedMultiplier,40),St=rt?Be:1200;let st=Math.max(A.viewportSize*A.tapCircleMaxSpeedMultiplier,St);const Ze=A.tapCircleMaxSpeedCurve;if(Ze){const Je=Math.max(Ze.exponentialSteepness,0),At=Math.max(Ze.exponentialScale??A.tapCircleMaxSpeedMultiplier,0),kt=Je===0?Ve:Math.expm1(Je*Ve),lt=Je===0?1:Math.expm1(Je)||1,Vt=lt===0?Ve:Math.min(Math.max(kt/lt,0),1),Dt=A.viewportSize*At*Vt;st=Math.min(st,Math.max(Dt,Be))}const Pt=Math.max(st,Be),Mt=Math.max(Ze?.easedOffset??0,0),vt=Math.min(1,De+Mt),wt=Be+(Pt-Be)*vt,Rt=b.direction*wt*Ie,{actualDelta:yt,reachedBoundary:Et}=_e(Rt);if(Et||yt===0){oe();return}_.current=window.requestAnimationFrame(He)},[_e,oe]),Ke=n.useCallback(()=>{_.current===null&&(x.current=null,_.current=window.requestAnimationFrame(He))},[He]);n.useEffect(()=>()=>{oe()},[oe]);const tt=n.useCallback(i=>{H.current=i,E(i.active),i.active&&i.direction!==0?Ke():oe()},[Ke,oe]);n.useEffect(()=>{K||Se()},[Se,K]),n.useEffect(()=>{const i=b=>{const W=b.detail?.paneId;W&&d&&W!==d||Se()};return window.addEventListener(at,i),()=>{window.removeEventListener(at,i)}},[d,Se]),n.useEffect(()=>{if(!K)return;const i=b=>{if(!H.current.active)return;const A=b.target;if(!(A instanceof Node)){Se();return}j.current?.getElement()?.contains(A)||Se()};return document.addEventListener("pointerdown",i,!0),()=>{document.removeEventListener("pointerdown",i,!0)}},[Se,K]);const a=i=>{if(!xe||we<=0||Y<=0)return 0;const b=le(i,0,we);return le(b/we*Y,0,Y)},I=i=>{const b=Math.max(Math.round(e/Yt),Ot);_e(i*b)},{handleArrowPointerDown:v,handleArrowPointerUp:D,handleArrowKeyDown:q}=$t({canUseArrowButtons:Ae,enableArrowButtons:f,resetTapScroll:Se,scrollByStep:I}),$=i=>{if(!xe)return;if(!o){i.preventDefault(),i.stopPropagation();return}if(i.pointerType==="mouse"&&i.button!==0||i.ctrlKey)return;Se();const b=i.currentTarget;b.setPointerCapture&&b.setPointerCapture(i.pointerId),z.current={pointerId:i.pointerId,startThumbPosition:ge,startClientX:i.clientX,startClientY:i.clientY},V(!0),O(!0),i.preventDefault(),i.stopPropagation()},Pe=i=>{const b=z.current;if(b.pointerId!==i.pointerId)return;const A=i.clientX-b.startClientX,W=i.clientY-b.startClientY,be=se(A,W),Ie=a(b.startThumbPosition+be);Ce(Ie),i.cancelable&&i.preventDefault()},Ne=i=>{if(z.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),z.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},V(!1),k.current&&!k.current.matches(":hover")&&O(!1),i.preventDefault(),i.stopPropagation()},ke=i=>{if(z.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),z.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},V(!1),k.current&&!k.current.matches(":hover")&&O(!1)},Le=i=>{if(!xe)return;if(!l){i.preventDefault(),i.stopPropagation();return}if(i.pointerType==="mouse"&&i.button!==0||i.ctrlKey)return;const b=i.currentTarget,A=b.getBoundingClientRect(),be=ee(i)-(p?A.left:A.top);Se();const Ie=be-Z/2,Ve=a(Ie);Ce(Ve),b.setPointerCapture&&b.setPointerCapture(i.pointerId),N.current={pointerId:i.pointerId,startThumbPosition:Ie,startClientX:i.clientX,startClientY:i.clientY},i.preventDefault(),i.stopPropagation()},Xe=i=>{const b=N.current;if(b.pointerId!==i.pointerId)return;const A=i.clientX-b.startClientX,W=i.clientY-b.startClientY,be=se(A,W),Ie=a(b.startThumbPosition+be);Ce(Ie),i.cancelable&&i.preventDefault()},Oe=i=>{if(N.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),N.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},i.preventDefault(),i.stopPropagation()},je=i=>{if(N.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),N.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}},X=n.useMemo(()=>le((ce?1:.8)*P,0,1),[ce,P]),qe=n.useMemo(()=>{const b=`calc(50% - ${te/2}px + ${ne}px)`;return{left:ve,top:b}},[ve,ne,te]),nt=(i,b,A)=>L.jsx("button",{type:"button",tabIndex:-1,className:"aqvs:scrollbar-arrow-button flex items-center justify-center text-xs transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",style:{[G]:m,[fe]:c},"aria-label":b,onMouseDown:v(i),onTouchStart:v(i),onMouseUp:D,onMouseLeave:D,onTouchEnd:D,onTouchCancel:D,onKeyDown:q(i),"aria-disabled":!f,disabled:!Ae,children:L.jsx("span",{"aria-hidden":"true",children:A})}),Ge=T&&xe?{orientation:Te,scrollPosition:t,maxScrollPosition:Y,contentSize:s,viewportSize:e,thumbSize:Z,thumbPosition:ge,thumbCenter:Re,trackSize:h,isDragging:F,isTapScrollActive:ce}:null;return L.jsxs("div",{className:Ue.twMerge("group relative cursor-default select-none",he,u),style:{[G]:e,[fe]:c,backgroundColor:"white",userSelect:"none",position:"relative",touchAction:"none"},role:"scrollbar",tabIndex:-1,"aria-controls":d,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":Y,"aria-orientation":p?"horizontal":"vertical",children:[!p&&xe&&K&&L.jsx(gt,{ref:j,className:Ue.twMerge("pointer-events-auto absolute transition-opacity duration-150",U),size:te,maxVisualDistance:ye,style:qe,opacity:X,renderVisual:M,onDragChange:tt}),nt(-1,me[0],de[0]),L.jsxs("div",{className:"aqvs:scrollbar-track relative flex-1",style:{borderRadius:c/2,touchAction:"none"},onPointerDown:Le,onPointerMove:Xe,onPointerUp:Oe,onPointerCancel:je,"aria-disabled":!l,children:[Ge&&L.jsx("div",{className:"pointer-events-none absolute inset-0","aria-hidden":!0,children:T?.(Ge)}),xe&&L.jsx("div",{className:"group absolute",style:{[G]:Z,[Q]:ge,...p?{top:0,bottom:0}:{left:0,right:0},touchAction:"none"},onPointerDown:$,onPointerMove:Pe,onPointerUp:Ne,onPointerCancel:ke,role:"slider","aria-orientation":p?"horizontal":"vertical","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":Y,"aria-disabled":!o,tabIndex:-1,children:L.jsx("div",{ref:k,className:Ue.twMerge("aqvs:scrollbar-thumb absolute",p?"aqvs:scrollbar-thumb-horizontal":"aqvs:scrollbar-thumb-vertical"),"data-thumb-state":Ye,style:{borderRadius:c-1,cursor:o?"pointer":"default"},onMouseEnter:()=>{o&&O(!0)},onMouseLeave:()=>{o&&O(!1)}})})]}),nt(1,me[1],de[1])]})},Me={debug(s,...e){typeof window<"u"&&window.localStorage?.getItem("debug")==="true"&&console.debug(`[VirtualScroll] ${s}`,...e)},warn(s,...e){console.warn(`[VirtualScroll] ${s}`,...e)},error(s,...e){console.error(`[VirtualScroll] ${s}`,...e)}},$e={maxVelocity:6,minVelocity:.02,deceleration:.0025,velocitySampleWindow:90,startVelocityThreshold:.04},Qe=(s,e,t)=>{for(const[r,o,l]of e)t==="add"?s.addEventListener(r,o,l):s.removeEventListener(r,o,l)},bt=n.forwardRef(({children:s,contentSize:e,viewportSize:t,scrollBarWidth:r=12,enableThumbDrag:o=!0,enableTrackClick:l=!0,enableArrowButtons:f=!0,enablePointerDrag:p=!0,onScroll:c,className:u,style:d,background:g,tapScrollCircleOptions:C,inertiaOptions:T,itemCount:F,renderThumbOverlay:V,wheelSpeedMultiplier:J=1,contentInsets:O},ce)=>{const E=n.useRef(0),k=n.useRef(null),z=n.useRef(null),N=n.useRef({frame:null,velocity:0,lastTimestamp:null}),R=n.useMemo(()=>({maxVelocity:T?.maxVelocity??$e.maxVelocity,minVelocity:T?.minVelocity??$e.minVelocity,deceleration:T?.deceleration??$e.deceleration,velocitySampleWindow:T?.velocitySampleWindow??$e.velocitySampleWindow,startVelocityThreshold:T?.startVelocityThreshold??$e.startVelocityThreshold}),[T]),H=n.useMemo(()=>({top:Math.max(0,O?.top??0),bottom:Math.max(0,O?.bottom??0)}),[O]);Me.debug("[ScrollPane] ScrollPane rendered",{contentSize:e,viewportSize:t,scrollBarWidth:r,className:u,style:d,tapScrollCircleOptions:C,inertiaOptions:T,enablePointerDrag:p,contentInsets:H});const j=n.useRef({contentSize:e,viewportSize:t}),_=n.useMemo(()=>e>t,[e,t]),x=n.useCallback(P=>{const{contentSize:M,viewportSize:re}=j.current,B=M>re,G=E.current;if(Me.debug("[ScrollPane] scrollTo called",{newPosition:P,contentSize:M,viewportSize:re,currentIsScrollable:B,prevPosition:G}),!B)return E.current!==0&&(E.current=0,c?.(0,G)),E.current;const fe=typeof P=="function"?P(E.current):P,Q=Math.max(M-re,0),se=le(fe,0,Q);return E.current!==se&&(E.current=se,c?.(se,G)),E.current},[c]),w=n.useCallback(()=>{const P=N.current;P.frame!==null&&cancelAnimationFrame(P.frame),P.frame=null,P.velocity=0,P.lastTimestamp=null},[]),S=n.useRef(w);n.useEffect(()=>{S.current=w},[w]);const K=n.useCallback(P=>{if(!_)return;const{maxVelocity:M,minVelocity:re,deceleration:B,startVelocityThreshold:G}=R,fe=le(P,-M,M);if(Math.abs(fe)<G)return;w(),N.current.velocity=fe,N.current.lastTimestamp=null;const Q=se=>{const ee=N.current;if(ee.lastTimestamp===null){ee.lastTimestamp=se,ee.frame=requestAnimationFrame(Q);return}const me=se-ee.lastTimestamp;if(ee.lastTimestamp=se,me<=0){ee.frame=requestAnimationFrame(Q);return}const de=ee.velocity;let he=de;const Te=B*me;de>0?he=Math.max(0,de-Te):de<0&&(he=Math.min(0,de+Te));const Ee=(de+he)/2*me,m=E.current;Ee!==0&&x(ge=>ge+Ee);const h=E.current,{contentSize:pe,viewportSize:Z}=j.current,Y=Math.max(pe-Z,0);ee.velocity=he;const we=h===m||h<=0&&he<=0||h>=Y&&he>=0;if(Math.abs(he)<re||we){w();return}ee.frame=requestAnimationFrame(Q)};N.current.frame=requestAnimationFrame(Q)},[_,R,x,w]),te=n.useRef(K);n.useEffect(()=>{te.current=K},[K]),n.useLayoutEffect(()=>{j.current={contentSize:e,viewportSize:t}},[e,t]),n.useLayoutEffect(()=>{if(_){Me.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change",{contentSize:e,viewportSize:t,scrollPosition:E.current});const P=le(e-t,0,e);E.current>P&&x(P)}else x(0)},[_,x,e,t]),n.useEffect(()=>{const P=re=>{if(!_)return;re.preventDefault(),w();let B=re.deltaY;re.deltaMode===1?B*=16:re.deltaMode===2&&(B*=t),J!==1&&(B*=J),Me.debug("[ScrollPane] wheel event",{deltaY:B,scrollPosition:E.current,wheelSpeedMultiplier:J}),x(G=>G+B)},M=k.current;return M&&M.addEventListener("wheel",P,{passive:!1}),()=>{M&&M.removeEventListener("wheel",P)}},[_,x,w,t,J]),n.useImperativeHandle(ce,()=>({scrollTo:x,getScrollPosition:()=>E.current,getContentSize:()=>e,getViewportSize:()=>t}),[x,e,t]);const ve=n.useRef(x);n.useEffect(()=>{ve.current=x},[x]);const ne=n.useId(),U=n.useRef({pointerId:null,startClientY:0,startScroll:0,isDragging:!1,shouldCancelNextClick:!1,clickResetTimer:null,velocitySamples:[]}),ae=n.useRef(p);n.useEffect(()=>{ae.current=p},[p]);const ue=n.useRef(_);n.useEffect(()=>{ue.current=_},[_]);const y=n.useRef(R);return n.useEffect(()=>{y.current=R},[R]),n.useEffect(()=>{if(p)return;const P=z.current,M=U.current;M.pointerId!==null&&P&&P.hasPointerCapture(M.pointerId)&&P.releasePointerCapture(M.pointerId),M.clickResetTimer!==null&&(window.clearTimeout(M.clickResetTimer),M.clickResetTimer=null),M.pointerId=null,M.startClientY=0,M.startScroll=0,M.isDragging=!1,M.shouldCancelNextClick=!1,M.velocitySamples=[]},[p]),n.useEffect(()=>{const P=z.current;if(!P)return;const M=6,re=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),B=()=>{const m=U.current;m.pointerId=null,m.startClientY=0,m.startScroll=0,m.isDragging=!1,m.velocitySamples=[]},G=()=>{const m=U.current;m.clickResetTimer!==null&&(window.clearTimeout(m.clickResetTimer),m.clickResetTimer=null)},fe=m=>{const h=U.current,pe=re();h.velocitySamples.push({clientY:m,time:pe});const Z=y.current.velocitySampleWindow;h.velocitySamples=h.velocitySamples.filter(Y=>pe-Y.time<=Z)},Q=m=>m instanceof HTMLElement&&m.closest("[data-scrollpane-ignore-drag='true']")!==null,se=m=>{const h=U.current;h.shouldCancelNextClick&&(m.preventDefault(),m.stopPropagation(),h.shouldCancelNextClick=!1)},ee=m=>{const h=U.current;h.isDragging||(h.isDragging=!0,h.shouldCancelNextClick=!0,P.hasPointerCapture(m.pointerId)||P.setPointerCapture(m.pointerId),fe(m.clientY))},me=m=>{const h=U.current;if(h.pointerId!==m.pointerId||!(ae.current&&ue.current)||!h.isDragging&&(Math.abs(m.clientY-h.startClientY)<M||(ee(m),!h.isDragging)))return;fe(m.clientY);const pe=m.clientY-h.startClientY,Z=h.startScroll-pe;ve.current(Z),m.cancelable&&m.preventDefault()},de=m=>{const h=U.current;if(h.pointerId!==m.pointerId)return;h.isDragging&&h.shouldCancelNextClick&&m.cancelable&&(m.preventDefault(),m.stopPropagation()),P.hasPointerCapture(m.pointerId)&&P.releasePointerCapture(m.pointerId);let pe=0;if(h.isDragging&&h.velocitySamples.length>=2){const Y=h.velocitySamples,we=y.current.velocitySampleWindow,ge=Y[Y.length-1],Re=Y.find(xe=>ge.time-xe.time<=we)??Y[0];if(ge&&Re&&ge.time!==Re.time){const xe=ge.clientY-Re.clientY,Ae=ge.time-Re.time;pe=-(xe/Ae)}}G(),h.shouldCancelNextClick&&(h.clickResetTimer=window.setTimeout(()=>{const Y=U.current;Y.shouldCancelNextClick=!1,Y.clickResetTimer=null},0));const Z=y.current.startVelocityThreshold;B(),Math.abs(pe)>=Z&&te.current?.(pe)},he=m=>{if(!(ae.current&&ue.current)||m.button!==0&&m.pointerType==="mouse"||m.ctrlKey||m.metaKey||m.altKey||Q(m.target))return;window.dispatchEvent(new CustomEvent(at,{detail:{paneId:ne}})),S.current?.();const h=U.current;G(),h.pointerId=m.pointerId,h.startClientY=m.clientY,h.startScroll=E.current,h.isDragging=!1,h.shouldCancelNextClick=!1,h.velocitySamples=[]},Te=m=>{const h=U.current;h.pointerId===m.pointerId&&(h.shouldCancelNextClick=!1,P.hasPointerCapture(m.pointerId)&&P.releasePointerCapture(m.pointerId),G(),B())},ye=[["click",se,!0],["pointerdown",he,{passive:!1}],["pointermove",me,{passive:!1}],["pointerup",de,void 0],["pointercancel",Te,void 0]],Ee=[["pointermove",me,{passive:!1}],["pointerup",de,void 0],["pointercancel",Te,void 0]];return Qe(P,ye,"add"),Qe(window,Ee,"add"),()=>{Qe(P,ye,"remove"),Qe(window,Ee,"remove");const m=U.current;m.pointerId!==null&&P.hasPointerCapture(m.pointerId)&&P.releasePointerCapture(m.pointerId),G(),B()}},[ne]),L.jsxs("div",{ref:k,className:Ue.twMerge("flex",u),style:d,children:[L.jsxs("div",{ref:z,className:Ue.twMerge("relative h-full flex-1 overflow-hidden"),style:{height:t,paddingTop:H.top,paddingBottom:H.bottom,...p?{touchAction:"none"}:{}},id:ne,children:[g,s(E.current)]}),_&&L.jsx(xt,{contentSize:e,viewportSize:t,scrollPosition:E.current,onScroll:x,enableThumbDrag:o,enableTrackClick:l,enableArrowButtons:f,scrollBarWidth:r,ariaControls:ne,tapScrollCircleOptions:C,itemCount:F,renderThumbOverlay:V})]})}),dt=(s,e,t)=>Math.min(Math.max(s,e),t),Kt=({dragState:s,normalizedDistance:e,sizeScale:t,size:r})=>{const o=Math.max(r/2,1),l=1+e*.65,f=Math.max(.65,1-e*.25),p=s.direction*e*26*t,c=.8+e*.18,u=3*t,d=6*t,g=22*t,C=Math.abs(p)+d,T=p>0?u:-Math.abs(p)-u,F=Math.max(2.5,3*t),V=dt(s.offsetX,-o,o),J=dt(s.offsetY,-o,o),O=o*.35,ce=V/o*O,E=J/o*O,k=ce*.45,z=E*.45,N=Math.max(g*.38,6),R=.65+e*.2,H=s.active;return L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"aqvs:tap-scroll-circle-gradient absolute inset-0 rounded-full border border-white/40 shadow-md",style:{transform:`scale(${f}, ${l})`,transition:H?"40ms transform ease-out":"200ms ease transform"}}),L.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full border border-white/50 bg-white/85",style:{width:g,height:g,transform:`translate(calc(-50% + ${ce}px), calc(-50% + ${E}px)) scale(${f}, ${c*l})`,transition:H?"70ms transform ease-out":"200ms ease transform"}}),L.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full bg-white/80",style:{width:N,height:N,transform:`translate(calc(-50% + ${k}px), calc(-50% + ${z}px)) scale(${f}, ${l})`,opacity:R,boxShadow:"0 0 8px rgba(255,255,255,0.45)",transition:H?"120ms opacity 150ms, 120ms transform ease-out ease-out":"220ms ease transform, 240ms opacity ease"}}),L.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full bg-white/50",style:{width:F,height:C,transform:`translate(-50%, ${T}px)`,opacity:e,transition:H?"40ms height, 60ms opacity ease-out ease-out":"200ms ease height, 120ms ease opacity"}})]})},Gt=s=>{if(!Number.isFinite(s))return 0n;const e=Math.trunc(s);return e<=0?0n:BigInt(e)},et=s=>{if(s<=0||!Number.isFinite(s))return 0;const e=Math.trunc(s),t=BigInt(e)&-BigInt(e);return Number(t)};class It{tree;deltas;size;baseValue;valueFn;total;constructor(e,t,r){this.reset(e,t,r)}reset(e,t,r){if(this.size=e,this.tree=new Map,this.deltas=new Map,this.total=void 0,typeof t=="function"){if(this.valueFn=t,this.size>0){const l=r?.sampleRange??{from:0,to:Math.min(99,this.size-1)},{mode:f,materializedValues:p}=this._calculateMode(l.from,l.to);if(this.baseValue=f,r?.materialize)for(let c=0;c<p.length;c++){const u=p[c],d=l.from+c;if(d>=this.size)break;const g=u-this.baseValue;this.deltas.set(d,g),this._updateTree(d,g)}}else this.baseValue=0;this.total=this.getTotal()}else this.valueFn=void 0,this.baseValue=t,this.total=this.baseValue*this.size}setValueFn(e){typeof e=="function"?this.valueFn=e:(this.valueFn=void 0,this.baseValue=e)}_calculateMode(e,t){if(!this.valueFn)return{mode:0,materializedValues:[]};const r=[];for(let u=e;u<=t&&!(u>=this.size);u++)r.push(this.valueFn(u));const o=[...r];if(r.length===0)return{mode:0,materializedValues:[]};r.sort((u,d)=>u-d);const l=Math.floor(r.length/2);let f;r.length%2===0?f=Math.floor((r[l-1]+r[l])/2):f=r[l];const p=new Map;let c=0;for(const u of r){const d=(p.get(u)??0)+1;p.set(u,d),d>c&&(c=d)}if(c>1){const u=[];for(const[g,C]of p.entries())C===c&&u.push(g);const d=u.reduce((g,C)=>g+C,0);f=Math.floor(d/u.length)}return{mode:f,materializedValues:o}}update(e,t){return this.updates([{index:e,value:t}])}updates(e){const t=this._buildDeltaUpdates(e);return t.length>0?this.updateDeltas(t):this.total}updateDelta(e,t){return this.updateDeltas([{index:e,change:t}])}updateDeltas(e){for(const{index:t,change:r}of e){if(t<0||t>=this.size)throw new Error(`Index ${t} out of bounds`);const o=this.deltas.get(t)??0;this.deltas.set(t,o+r),this._updateTree(t,r)}return this.total}_updateTree(e,t){if(t===0)return;let r=e+1;for(;r<=this.size;){this.tree.set(r,(this.tree.get(r)??0)+t);const o=et(r);if(o===0)break;r+=o}this.total!==void 0&&(this.total+=t)}_buildDeltaUpdates(e){const t=[];for(const{index:r,value:o}of e){if(r<0||r>=this.size)throw new Error(`Index ${r} out of bounds`);if(o<0)throw new Error("Value cannot be negative.");const l=this.deltas.has(r)?(this.deltas.get(r)??0)+this.baseValue:this.baseValue,f=o-l;f!==0&&t.push({index:r,change:f})}return t}_computeTreeTotal(){if(this.size<=0)return 0;let e=0,t=this.size;for(;t>0;){e+=this.tree.get(t)??0;const r=et(t);if(r===0)break;t-=r}return e+this.baseValue*this.size}_materialize(e,t=!0){if(this.valueFn){const r=this.deltas.get(e)??0,l=this.valueFn(e)-this.baseValue;if(l!==r&&(this.deltas.set(e,l),t)){const f=l-r;this._updateTree(e,f)}}}_materializeRanges(e,t,r=!1){if(!(e?.materialize&&this.valueFn))return;const o=e.ranges;if(o&&o.length>0){for(const p of o){const c=p.from,u=Math.min(p.to,this.size-1);for(let d=c;d<=u;d++)this._materialize(d)}if(t===void 0)return;if(r){this._materialize(t);return}const l=o[0].from,f=o[o.length-1].to;t>=l&&t<=f&&this._materialize(t);return}t!==void 0&&this._materialize(t)}_findIndex(e,t={},r){if(this.size>=Number.MAX_SAFE_INTEGER)return this._findIndexLarge(e,t,r);if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};let o=0,l=this.size-1,f=-1,p,c=this.total;for(;o<=l;){const u=Math.floor((o+l)/2);p=this.prefixSum(u,t),c=p.total,(r?p.cumulative>=e:p.cumulative<=e)?(f=u,r?l=u-1:o=u+1):r?o=u+1:l=u-1}return{index:f,total:c,cumulative:p?.cumulative,currentValue:p?.currentValue,safeIndex:p?.safeIndex}}_findIndexLarge(e,t,r){if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};const o=Gt(this.size);if(o===0n)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};let l=0n,f=o-1n,p,c,u,d=this.total;for(;l<=f;){const T=l+f>>1n,F=Number(T),V=this.prefixSum(F,t);if(u=V,d=V.total,r?V.cumulative>=e:V.cumulative<=e)if(p=T,c=V,r){if(T===0n)break;f=T-1n}else l=T+1n;else if(r)l=T+1n;else{if(T===0n)break;f=T-1n}}const g=c??u;return{index:p!==void 0?Number(p):-1,total:d,cumulative:g?.cumulative,currentValue:g?.currentValue,safeIndex:g?.safeIndex}}prefixSum(e,t){if(e<0)return{cumulative:0,total:this.total,currentValue:0,safeIndex:0};const r=le(e,0,this.size-1),o=t?.materializeOption;this._materializeRanges(o,r,!0);let l=0,f=r+1;for(;f>0;){const c=this.tree.get(f)??0;l+=c;const u=et(f);if(u===0)break;f-=u}const p=o?.materialize?this.get(r):(this.deltas.get(r)||0)+this.baseValue;return{cumulative:l+this.baseValue*(r+1),total:this.total,currentValue:p,safeIndex:r}}get(e,t){if(e<0||e>=this.size)throw new Error("Index out of bounds");const r=t?.materializeOption;return this._materializeRanges(r,e),(this.deltas.get(e)??0)+this.baseValue}getTotal(e){const t=e?.materializeOption;if(this._materializeRanges(t),this.total===void 0)if(this.size===0)this.total=0;else{this.total=this._computeTreeTotal();const r=this.prefixSum(this.getSize()-1);console.assert(r.cumulative===r.total,"Inconsistent Fenwick Tree state")}return this.total}rebuildTree(e){if(e?.materialize&&this.valueFn){const r=this.valueFn;this.reset(this.size,o=>r(o),{materialize:!0});return}const t=new Map;for(const[r,o]of this.deltas.entries()){if(o===0)continue;let l=r+1;for(;l<=this.size;){t.set(l,(t.get(l)??0)+o);const f=et(l);if(f===0)break;l+=f}}this.tree=t,this.total=this._computeTreeTotal()}calculateAccumulatedError(){if(this.total===void 0)return 0;let e=this.baseValue*this.size;for(const t of this.deltas.values())e+=t;return this.total-e}changeSize(e){const t=this.size;if(e===t)return;if(e<t)for(const o of this.deltas.keys())o>=e&&this.deltas.delete(o);this.size=e,this.rebuildTree();const r=this.prefixSum(this.getSize()-1);console.assert(r.cumulative===r.total,"Inconsistent Fenwick Tree state")}getSize(){return this.size}findIndexAtOrAfter(e,t){return this._findIndex(e,t??{},!0)}findIndexAtOrBefore(e,t){return this._findIndex(e,t??{},!1)}}const Tt=(s,e,t)=>{const r=Math.max(0,s),o=n.useRef(null),l=n.useMemo(()=>new It(r,e,t),[r,e,t]);return Object.is(o.current,l)||console.warn("[useFenwickMapTree] instance changed"),o.current=l,l};class Zt{key;value;prev=null;next=null;constructor(e,t){this.key=e,this.value=t}}class pt{head=null;tail=null;addToTail(e){this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):this.head=this.tail=e}remove(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=null,e.next=null}removeHead(){const e=this.head;return e&&this.remove(e),e}moveToTail(e){this.remove(e),this.addToTail(e)}}function Ct(s){const e=n.useRef(new Map),t=n.useRef(new pt);n.useEffect(()=>{for(;e.current.size>s;){const d=t.current.removeHead();if(d)e.current.delete(d.key);else break}},[s]);const r=n.useCallback(d=>{const g=e.current.get(d);if(g)return t.current.moveToTail(g),g.value},[]),o=n.useCallback((d,g)=>{if(s<=0)return;let C=e.current.get(d);if(C)C.value=g,t.current.moveToTail(C);else{if(e.current.size>=s){const T=t.current.removeHead();T&&e.current.delete(T.key)}C=new Zt(d,g),e.current.set(d,C),t.current.addToTail(C)}},[s]),l=n.useCallback(d=>e.current.has(d),[]),f=n.useCallback(d=>{const g=e.current.get(d);g&&(t.current.remove(g),e.current.delete(d))},[]),p=n.useCallback(()=>{e.current.clear(),t.current=new pt},[]),[c,u]=n.useState(()=>({get:r,set:o,has:l,remove:f,clear:p}));return n.useEffect(()=>u({get:r,set:o,has:l,remove:f,clear:p}),[r,o,l,f,p]),c}const Jt=1e4,Qt=()=>{const{get:s,set:e,has:t,clear:r}=Ct(Jt);return{get:s,set:e,has:t,clear:r}},ie=(s,e)=>e<=0?0:le(s,0,e-1),en=s=>({top:Math.max(0,s?.top??0),bottom:Math.max(0,s?.bottom??0)}),ze=(s,e)=>s<=e?0:s-e,We=(s,e)=>s<=0?e:s+e,mt=s=>{if(!Number.isFinite(s))return 0n;const e=Math.trunc(s);return e<=0?0n:BigInt(e)},tn=(s,e,t,r,o,l,f,p)=>{const c=mt(r);if(c===0n)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const u=k=>k<0n?0n:k>=c?c-1n:k,d={materializeOption:{materialize:!1}},{index:g}=l.findIndexAtOrAfter(s,d);let C;g===-1?C=c-1n:(C=mt(g),C>=c&&(C=c-1n)),s<=0&&(C=0n),p&&s>=f&&(C=c-1n);const T=k=>{let z=0,N=k,R=k,H=0n;for(;N<c&&z<e;){const j=Number(N),_=o(j);if(z+=_,R=N,N+=1n,H+=1n,!Number.isFinite(_)||_<=0)break}return H===0n&&(R=k),{height:z,end:R}};let{height:F,end:V}=T(C);if(F<e&&C>0n){let k=C,z=F;for(;k>0n&&z<e;){k-=1n;const R=Number(k),H=o(R);if(z+=H,!Number.isFinite(H)||H<=0)break}C=u(k);const N=T(C);F=N.height,V=N.end}const J=u(C),O=u(V),ce=u(J-BigInt(Math.max(0,t))),E=u(O+BigInt(Math.max(0,t)));return{renderingStartIndex:ie(Number(ce),r),renderingEndIndex:ie(Number(E),r),visibleStartIndex:ie(Number(J),r),visibleEndIndex:ie(Number(O),r)}},nn=(s,e,t,r,o,l)=>{if(r===0)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const f=l.getTotal(),p=Number.isFinite(f),c=p?Math.min(s,f):s;if(r>Number.MAX_SAFE_INTEGER)return tn(c,e,t,r,o,l,f,p);const{index:u,cumulative:d,currentValue:g}=l.findIndexAtOrAfter(c,{materializeOption:{materialize:!1}}),C=u===-1?e<=0||(d??0)<c+(g??0)?r-1:0:u;let T=ie(C,r),F=0,V=T;for(;V<r&&F<e;)F+=o(V),V++;if(F<e&&T>0){let E=F,k=T-1;for(;k>=0&&E<e;)E+=o(k),k--;for(T=ie(k+1,r),F=0,V=T;V<r&&F<e;)F+=o(V),V++}const J=ie(T-t,r),O=ie(Math.max(V-1,T),r),ce=ie(O+t,r);return{renderingStartIndex:J,renderingEndIndex:ce,visibleStartIndex:T,visibleEndIndex:O}},rn=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),ht=(s,e,t)=>{const r=Math.max(0,e??0),o=n.useRef({lastInvokeAt:0,rafId:null,pendingPayload:null,loopActive:!1,normalizedThrottle:r}),l=n.useCallback(()=>{const c=o.current;c.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(c.rafId),c.rafId=null,c.loopActive=!1},[]),f=n.useCallback(c=>{const u=o.current;u.rafId=null;const d=typeof c=="number"?c:rn(),g=u.normalizedThrottle,C=u.pendingPayload,T=s.current;if(C!==null&&T){const F=d-u.lastInvokeAt;(g===0||u.lastInvokeAt===0||F>=g)&&(u.pendingPayload=null,u.lastInvokeAt=d,t(T,C))}if(u.pendingPayload!==null){typeof requestAnimationFrame=="function"?u.rafId=requestAnimationFrame(f):u.loopActive=!1;return}u.loopActive=!1},[s,t]),p=n.useCallback(()=>{const c=o.current;if(!c.loopActive){if(c.loopActive=!0,typeof requestAnimationFrame=="function"){c.rafId=requestAnimationFrame(f);return}c.loopActive=!1}},[f]);return n.useEffect(()=>()=>{l(),o.current.pendingPayload=null},[l]),n.useEffect(()=>{l();const c=o.current;c.lastInvokeAt=0,c.pendingPayload=null,c.normalizedThrottle=r},[r,l]),n.useCallback(c=>{const u=o.current;u.pendingPayload=c,p()},[p])},sn=({itemCount:s,getItem:e,getItemHeight:t,viewportSize:r,overscanCount:o=15,className:l,onScroll:f,onRangeChange:p,children:c,background:u,initialScrollIndex:d,initialScrollOffset:g,tapScrollCircleOptions:C,scrollBarWidth:T,enableThumbDrag:F,enableTrackClick:V,enableArrowButtons:J,enablePointerDrag:O,inertiaOptions:ce,callbackThrottleMs:E=5,renderThumbOverlay:k,wheelSpeedMultiplier:z,contentInsets:N,enableKeyboardNavigation:R=!0},H)=>{const j=n.useRef(null),_=n.useRef(!1),x=n.useMemo(()=>en(N),[N]),w=n.useRef({size:s,valueOrFn:t,options:{sampleRange:{from:0,to:100}}}),S=Tt(w.current.size,w.current.valueOrFn,w.current.options),[K]=n.useState(()=>{let a=x.top,I=0;if(typeof d=="number"){const v=le(d,0,s-1),D=le(v-o*2,0,s-1),q=le(v+o*2,0,s-1),$=d>0?{materializeOption:{materialize:!0,ranges:[{from:D,to:q}]}}:void 0,{cumulative:Pe,total:Ne,currentValue:ke}=S.prefixSum(d,$),Le=Math.max(Pe-ke,0);a=We(Le,x.top),I=Ne??S.getTotal()}else typeof g=="number"&&(a=We(Math.max(g,0),x.top)),I=S.getTotal();return{position:a,total:I}}),[te,ve]=n.useState(K.position),[ne,U]=n.useState(K.total),[ae,ue]=n.useState(K.position),[y,P]=n.useState(s),M=n.useRef(K.position),re=n.useRef(x.top),B=n.useRef(f??void 0),G=n.useRef(p??void 0),fe=n.useRef(new Map),Q=n.useRef(null),se=n.useRef(null);n.useEffect(()=>{B.current=f??void 0,G.current=p??void 0},[p,f]);const ee=n.useCallback(a=>{if(R&&a&&typeof a.focus=="function")try{a.focus({preventScroll:!0})}catch{a.focus()}},[R]),me=ht(B,E,(a,{position:I,totalHeight:v})=>{a(I,v)}),de=ht(G,E,(a,{renderingStartIndex:I,renderingEndIndex:v,visibleStartIndex:D,visibleEndIndex:q,scrollPosition:$,totalHeight:Pe})=>{a(I,v,D,q,$,Pe)});n.useEffect(()=>(_.current=!0,()=>{_.current=!1}),[]),n.useEffect(()=>{R||(fe.current.clear(),Q.current=null,se.current=null)},[R]);const he=.01,Te=n.useRef({rafId:null,loopActive:!1,idleFrames:0,lastRenderedPosition:K.position}),ye=n.useCallback(()=>{const a=Te.current;a.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.rafId),a.rafId=null,a.loopActive=!1,a.idleFrames=0},[]);n.useEffect(()=>()=>{ye()},[ye]);const Ee=n.useCallback(()=>{const a=Te.current;a.rafId=null;const I=M.current,v=ze(I,x.top),D=S.getTotal();if(ve($=>Math.abs($-I)<he?$:I),me({position:v,totalHeight:D}),Math.abs(a.lastRenderedPosition-I)>=he?(a.lastRenderedPosition=I,a.idleFrames=0):a.idleFrames+=1,a.idleFrames>=2){ye();return}if(typeof requestAnimationFrame=="function"){a.rafId=requestAnimationFrame(Ee);return}a.loopActive=!1},[S,x.top,me,ye]),m=n.useCallback(()=>{const a=Te.current;if(a.idleFrames=0,!a.loopActive){if(a.loopActive=!0,typeof requestAnimationFrame=="function"){a.rafId=requestAnimationFrame(Ee);return}a.loopActive=!1}},[Ee]),h=n.useCallback((a,I)=>{const v=I?.immediate??!1,D=ze(a,x.top);if(M.current=a,v){Te.current.lastRenderedPosition=a,Te.current.idleFrames=0,ve(a),me({position:D,totalHeight:S.getTotal()});return}m()},[m,S,x.top,me]),pe=n.useRef(!1);n.useEffect(()=>{if(!pe.current)if(pe.current=!0,typeof g=="number"){const a=We(Math.max(g,0),x.top),I=Math.abs(a-M.current)>.5;h(a,{immediate:!0}),I&&ue(a)}else h(M.current,{immediate:!0})},[g,x.top,h]),n.useLayoutEffect(()=>{S.setValueFn(t),y!==s&&(S.changeSize(s),P(s));const a=S.getTotal();ne!==a&&U(a)},[S,y,s,ne,t]),n.useLayoutEffect(()=>{ae!==null&&j.current&&(Me.debug("[VirtualScroll] Scrolling to position:",ae),j.current.scrollTo(ae),ue(null))},[ae]),n.useEffect(()=>{const a=re.current;if(a===x.top)return;const I=ze(M.current,a),v=We(I,x.top);re.current=x.top,M.current=v,ue(v),h(v,{immediate:!0})},[x.top,h]);const Z=n.useCallback(a=>{if(!j.current)return;const I=ie(a,y),v=ie(I-o*2,y),D=ie(I+o*2,y),{cumulative:q,total:$,currentValue:Pe}=S.prefixSum(I,{materializeOption:{materialize:!0,ranges:[{from:v,to:D}]}});if(Me.debug("[VirtualScroll] Scrolling to index:",I,"Offset:",q,"Total height:",$,"Current value:",Pe,"safeIndexFrom:",v,"safeIndexTo:",D),!$)return;const Ne=Math.max(q-Pe,0),ke=We(Ne,x.top);U($),ue(ke),Me.debug("[VirtualScroll] Setting scroll position to:",ke)},[S,o,y,x.top]),Y=n.useCallback(a=>{if(!j.current)return;const I=S.getTotal(),v=le(Math.floor(a),0,I),D=S.findIndexAtOrAfter(v,{materializeOption:{materialize:!1}}).index;Z(D)},[S,Z]),we=n.useCallback(a=>{const I=ze(M.current,x.top),v=typeof a=="function"?a(I):a;Y(v);const D=j.current?.getScrollPosition(),q=typeof D=="number"?D:M.current;return h(q),q},[x.top,Y,h]),ge=n.useCallback((a,I)=>{Me.debug("[VirtualScroll] Scroll position changed:",a),h(a)},[h]),Re=n.useMemo(()=>ze(te,x.top),[x.top,te]),xe=n.useMemo(()=>{const a=nn(Re,r,o,y,t,S);return Me.debug("[VirtualScroll] Calculated rendering range:",{...a,scrollPosition:Re,renderingContentSize:S.getTotal(),overscanCount:o,viewportSize:r}),a},[Re,r,o,y,t,S]),{renderingStartIndex:Ae,renderingEndIndex:Ye,visibleStartIndex:Ce,visibleEndIndex:_e}=xe,oe=n.useCallback((a,I)=>{if(!R||y===0)return;const v=ie(a,y);if(!(I?.ensureVisible??!0)){const je=fe.current.get(v);je&&(Q.current=null,se.current=v,ee(je));return}const q=S.prefixSum(v,{materializeOption:{materialize:!1}}),$=q.currentValue,Pe=Math.max(q.cumulative-$,0),Ne=Pe+$,ke=ze(M.current,x.top),Le=ke+r;if(Pe<ke||Ne>Le){Q.current=v,Z(v);return}const Oe=fe.current.get(v);if(Oe){Q.current=null,se.current=v,ee(Oe);return}Q.current=v},[R,y,S,x.top,Z,ee,r]),Se=n.useCallback((a,I)=>{if(!R||a.defaultPrevented||a.altKey||a.metaKey||a.ctrlKey)return;const v=a.target;if(v){const D=v.tagName;if(D==="INPUT"||D==="TEXTAREA"||D==="SELECT"||v.isContentEditable)return}if(a.key==="ArrowDown"){I<y-1&&(a.preventDefault(),oe(I+1));return}if(a.key==="ArrowUp"){I>0&&(a.preventDefault(),oe(I-1));return}if(a.key==="PageDown"){if(I<y-1){a.preventDefault();const D=Math.max(_e-Ce+1,1),q=Math.max(D,1),$=ie(Math.min(I+q,y-1),y);oe($)}return}if(a.key==="PageUp"&&I>0){a.preventDefault();const D=Math.max(_e-Ce+1,1),q=Math.max(D,1),$=ie(I-q,y);oe($)}},[R,y,oe,_e,Ce]),He=n.useCallback(a=>{if(!R)return;const I=ie(a,y);Q.current=null,se.current=I},[R,y]);n.useEffect(()=>{const a=j.current?.getScrollPosition()??0,I=M.current,v=ze(I,x.top);Me.debug("[VirtualScroll] Range change effect triggered",{renderingStartIndex:Ae,renderingEndIndex:Ye,visibleStartIndex:Ce,visibleEndIndex:_e,scrollPositionState:te,paneScrollPosition:I,logicalScrollPosition:v,contentSize:ne,scrollPaneScrollPosition:a}),de({renderingStartIndex:Ae,renderingEndIndex:Ye,visibleStartIndex:Ce,visibleEndIndex:_e,scrollPosition:v,totalHeight:ne})},[ne,Ye,Ae,x.top,de,te,_e,Ce]);const Ke=n.useCallback(a=>{const I=(E??0)>0,v=Math.abs(a-te),D=I&&v>.5?te:a,q=ze(D,x.top);if(Me.debug("[VirtualScroll] Rendering visible items",{currentScrollPosition:a,effectiveScrollPosition:q,renderingStartIndex:Ae,renderingEndIndex:Ye,fenwickSize:y,viewportSize:r,callbackThrottleMs:E,diff:v,rawEffectiveScrollPosition:D}),y===0)return L.jsx("div",{className:"absolute w-full",style:{top:0},children:L.jsx("div",{className:"text-center text-gray-500",children:"No items"})});const $=ie(Ae,y),Pe=ie(Ye,y),{cumulative:Ne,currentValue:ke}=S.prefixSum($,{materializeOption:{materialize:!1}}),Le=Ne-ke,Xe=[],Oe=[];for(let X=$;X<=Pe;X++){const qe=t(X);S.get(X)!==qe&&Xe.push({index:X,value:qe});const{cumulative:Ge,currentValue:i}=S.prefixSum(X,{materializeOption:{materialize:!1}}),b=Ge-i,A=W=>{if(!W){fe.current.delete(X);return}R&&(fe.current.set(X,W),Q.current===X&&(Q.current=null,se.current=X,ee(W)))};Oe.push(L.jsx("div",{ref:A,"data-index":X,"data-virtualscroll-item":"true",style:{position:"absolute",top:b-Le+x.top,width:"100%"},tabIndex:R?-1:void 0,onPointerDown:R?W=>{W.currentTarget.focus({preventScroll:!0})}:void 0,onKeyDownCapture:R?W=>Se(W,X):void 0,onFocusCapture:R?()=>He(X):void 0,children:c(e(X),X)},X))}Xe.length>0&&Promise.resolve().then(()=>{if(!_.current)return;const X=S.updates(Xe);if(!_.current||typeof X!="number")return;U(X),Me.debug("[VirtualScroll] Updated heights for items",Xe,"New total height:",X);const qe=j.current?.getScrollPosition()??M.current;qe===M.current||!_.current||h(qe)});const je=Le-q;if(x.bottom>0){const X=S.getTotal()+x.top-Le;Oe.push(L.jsx("div",{style:{position:"absolute",top:X,height:x.bottom,width:"100%"}},"virtualscroll-bottom-inset"))}return Me.debug("[VirtualScroll] Rendering items",{nodeCount:Oe.length,containerTop:je,logicalScrollPosition:Re,resolvedInsets:x,effectiveScrollPosition:q}),L.jsx("div",{className:"absolute w-full",style:{top:je},children:Oe})},[E,c,R,S,y,e,t,He,Se,Re,Ye,Ae,x,te,ee,h,r]);n.useImperativeHandle(H,()=>({getScrollPosition:()=>j.current?.getScrollPosition()??-1,getContentSize:()=>j.current?.getContentSize()??-1,getViewportSize:()=>j.current?.getViewportSize()??-1,scrollTo:we,scrollToIndex:Z,getFenwickTreeTotalHeight:()=>S.getTotal(),getFenwickSize:()=>S.getSize(),focusItemAtIndex:oe}),[we,Z,S,oe]);const tt=ne+x.top+x.bottom;return L.jsx(bt,{ref:j,contentSize:tt,viewportSize:r,className:l,onScroll:ge,background:u,tapScrollCircleOptions:C,inertiaOptions:ce,itemCount:s,scrollBarWidth:T,enableThumbDrag:F,enableTrackClick:V,enableArrowButtons:J,enablePointerDrag:O,renderThumbOverlay:k,wheelSpeedMultiplier:z,contentInsets:x,children:Ke})},on=n.forwardRef(sn);exports.FenwickMapTree=It;exports.ScrollBar=xt;exports.ScrollPane=bt;exports.VirtualScroll=on;exports.minmax=le;exports.tapScrollCircleSampleVisual=Kt;exports.useFenwickMapTree=Tt;exports.useHeightCache=Qt;exports.useLruCache=Ct;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react/jsx-runtime"),r=require("react"),$e=require("tailwind-merge"),ft={active:!1,offsetX:0,offsetY:0,distance:0,direction:0,pointerId:null},at=6,Nt=8,Lt=({dragState:s,normalizedDistance:e})=>{const t=1+e*.18,n=.16+e*.24,o=.38+e*.28,l=s.active?"80ms ease-out":"220ms ease";return F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"absolute inset-0 rounded-full",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",boxShadow:`0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${n})`,transform:`scale(${t})`,transition:`${l}, ${s.active?"80ms":"260ms"} box-shadow ease`}}),F.jsx("div",{className:"aqvs:tap-scroll-circle-inner absolute rounded-full",style:{background:"linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",boxShadow:"inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",opacity:o,transition:s.active?"120ms opacity ease-out":"220ms opacity ease"}})]})},bt=r.memo(r.forwardRef(({onDragChange:s,className:e,maxVisualDistance:t=160,size:n=40,style:o,opacity:l=1,renderVisual:f},m)=>{const[c,d]=r.useState(ft),u=r.useRef(null),p=r.useRef({x:0,y:0}),P=r.useRef(null),C=r.useRef(0),V=r.useCallback(I=>{d(I),s(I)},[s]),z=r.useCallback((I,h,J=!1)=>{const{x:y,y:Q}=p.current,se=I-y,we=h-Q,B=Math.abs(we),H=B<at?0:we<0?-1:1,ce=C.current;let fe=H;const A=at+Nt;H===0?ce!==0&&B<A?fe=ce:(fe=0,J||(C.current=0)):H!==ce&&ce!==0&&B<A?fe=ce:C.current=H,V({active:J||B>=at,offsetX:se,offsetY:we,distance:B,direction:fe,pointerId:u.current})},[V]),N=r.useCallback(I=>{if(I===null)return;const h=P.current;h?.hasPointerCapture(I)&&h.releasePointerCapture(I)},[]),q=r.useCallback((I=!1)=>{I&&N(u.current),u.current=null,C.current=0,V(ft)},[V,N]),pe=r.useCallback(I=>{I.preventDefault(),I.stopPropagation();const h=P.current??I.currentTarget,{left:J,top:y,width:Q,height:se}=h.getBoundingClientRect();p.current={x:J+Q/2,y:y+se/2},u.current=I.pointerId,h.setPointerCapture(I.pointerId),z(I.clientX,I.clientY,!0)},[z]),X=r.useCallback(I=>{u.current===I.pointerId&&(I.preventDefault(),z(I.clientX,I.clientY))},[z]),D=r.useCallback(I=>{u.current===I.pointerId&&(I.preventDefault(),I.stopPropagation(),q(!0))},[q]);r.useImperativeHandle(m,()=>({reset:()=>{q(!0)},getElement:()=>P.current}),[q]);const R=Math.min(Math.max(l,0),1),L=n/64,w=Math.min(c.distance,t)/t,_=c.direction*w*10*L,ne=f??Lt,le={dragState:c,normalizedDistance:w,sizeScale:L,size:n,opacity:R},U={...o,width:n,height:n,transform:`translateY(${_}px)`};return U.opacity=R,F.jsx("div",{ref:P,"data-testid":"virtual-scroll-tap-circle",className:$e.twMerge("relative flex touch-none select-none items-center justify-center","transition-transform duration-100 ease-out",e),style:U,tabIndex:-1,onPointerDown:pe,onPointerMove:X,onPointerUp:D,onPointerCancel:D,role:"presentation",children:ne(le)})}));bt.displayName="TapScrollCircle";const ue=(s,e,t)=>Math.min(t,Math.max(e,s)),ct="virtualscroll:tap-scroll-cancel",dt=20,Ot=250,Yt=60,zt=20,Xt=20,Ht=240,pt={active:!1,offsetX:0,offsetY:0,distance:0,direction:0,pointerId:null},lt=2.2,jt=8,qt=120,Ut=1/60,Le={enabled:!0,size:40,offsetX:-80,offsetY:0,className:void 0,maxVisualDistance:Ht,minSpeedMultiplier:.2,opacity:.9,renderVisual:void 0,maxSpeedCurve:void 0},Bt=s=>s?{mainSizeKey:"width",crossSizeKey:"height",positionKey:"left",selectDelta:(e,t)=>e,getPointerCoordinate:({clientX:e})=>e,arrowLabels:["Scroll left","Scroll right"],arrowIcons:["◀","▶"],directionClass:"flex flex-row items-stretch",orientation:"horizontal"}:{mainSizeKey:"height",crossSizeKey:"width",positionKey:"top",selectDelta:(e,t)=>t,getPointerCoordinate:({clientY:e})=>e,arrowLabels:["Scroll up","Scroll down"],arrowIcons:["▲","▼"],directionClass:"flex flex-col items-stretch",orientation:"vertical"},$t=(s,e)=>{const t=s?.maxSpeedMultiplier,n=typeof t=="number"?t:Gt(e);return{enabled:s?.enabled??Le.enabled,size:s?.size??Le.size,offsetX:s?.offsetX??Le.offsetX,offsetY:s?.offsetY??Le.offsetY,className:s?.className??Le.className,maxVisualDistance:s?.maxVisualDistance??Le.maxVisualDistance,maxSpeedMultiplier:n,minSpeedMultiplier:Math.max(s?.minSpeedMultiplier??Le.minSpeedMultiplier,0),opacity:ue(s?.opacity??Le.opacity,0,1),renderVisual:s?.renderVisual??Le.renderVisual,maxSpeedCurve:s?.maxSpeedCurve??Le.maxSpeedCurve}},Wt=({isDragging:s,isThumbHovered:e,enableThumbDrag:t})=>r.useMemo(()=>t?s?"dragging":e?"hover":"idle":"disabled",[t,s,e]),Kt=({canUseArrowButtons:s,enableArrowButtons:e,resetTapScroll:t,scrollByStep:n})=>{const o=r.useRef(null),l=r.useRef(null),f=r.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),m=r.useCallback(()=>{f()},[f]),c=r.useCallback(u=>p=>{s&&(p.preventDefault(),p.stopPropagation(),t(),f(),n(u),l.current=window.setTimeout(()=>{o.current=window.setInterval(()=>{n(u)},Yt)},Ot))},[s,f,t,n]),d=r.useCallback(u=>p=>{e&&(p.key==="Enter"||p.key===" "||p.key==="Spacebar")&&(p.preventDefault(),n(u))},[e,n]);return r.useEffect(()=>()=>{f()},[f]),{handleArrowPointerDown:c,handleArrowPointerUp:m,handleArrowKeyDown:d}},Gt=s=>{if(!s||s<=0)return lt;const e=Math.max(1,s),t=Math.log10(e),n=lt+t*jt;return ue(n,lt,qt)},It=({contentSize:s,viewportSize:e,scrollPosition:t,onScroll:n,enableThumbDrag:o=!0,enableTrackClick:l=!0,enableArrowButtons:f=!0,horizontal:m=!1,scrollBarWidth:c=12,className:d,ariaControls:u,tapScrollCircleOptions:p,itemCount:P,renderThumbOverlay:C,visibleStartIndex:V,visibleEndIndex:z})=>{const[N,q]=r.useState(!1),[pe,X]=r.useState(!1),[D,R]=r.useState(!1),L=r.useRef(null),w=r.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}),_=r.useRef({pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}),ne=r.useRef(t),le=r.useRef(pt),U=r.useRef(null),I=r.useRef(null),h=r.useRef(null),J=r.useMemo(()=>$t(p,P),[P,p]),y=r.useMemo(()=>Bt(m),[m]),{enabled:Q,size:se,offsetX:we,offsetY:B,className:H,maxVisualDistance:ce,maxSpeedMultiplier:fe,minSpeedMultiplier:A,opacity:S,renderVisual:M,maxSpeedCurve:ee}=J,$=r.useRef({viewportSize:e,maxScrollPosition:Math.max(s-e,0),scrollBarVisible:s>e,effectiveTapMaxDistance:Math.max(ce,1),tapCircleMaxSpeedMultiplier:fe,tapCircleMinSpeedMultiplier:A,tapCircleMaxSpeedCurve:ee,tapScrollCircleOptions:p}),{mainSizeKey:G,crossSizeKey:de,positionKey:te,selectDelta:oe,getPointerCoordinate:re,arrowLabels:ge,arrowIcons:me,directionClass:xe,orientation:Me}=y,Ae=Math.max(ce,1),ke=e/s,g=c,x=Math.max(e-g*2,0),he=ke*x,Z=Math.min(Math.max(dt,he||0),x||dt),O=s-e,ye=Math.max(x-Z,0),be=O<=0||ye<=0?0:t/O*ye,Ee=be+Z/2,Ie=s>e,Ve=Ie&&f;$.current={viewportSize:e,maxScrollPosition:O,scrollBarVisible:Ie,effectiveTapMaxDistance:Ae,tapCircleMaxSpeedMultiplier:fe,tapCircleMinSpeedMultiplier:A,tapCircleMaxSpeedCurve:ee,tapScrollCircleOptions:p},r.useEffect(()=>{ne.current=t},[t]),r.useEffect(()=>{o||X(!1)},[o]);const Xe=Wt({isDragging:N,isThumbHovered:pe,enableThumbDrag:o}),Te=r.useCallback((i,b)=>{const E=$.current,K=b??ne.current;if(n){const Ne=n(i,K);if(typeof Ne=="number"&&Number.isFinite(Ne))return ne.current=Ne,Ne}const Ce=typeof i=="function"?i(K):i,Se=Math.max(E.maxScrollPosition,0),Fe=E.scrollBarVisible?ue(Ce,0,Se):0;return ne.current=Fe,Fe},[n]),De=r.useCallback(i=>{const b=$.current,E=ne.current;if(!b.scrollBarVisible||b.maxScrollPosition<=0){const Ne=Te(0,E),ot=Ne-E;return{nextPosition:Ne,actualDelta:ot,reachedBoundary:!0}}if(i===0)return{nextPosition:E,actualDelta:0,reachedBoundary:!1};const Ce=Te(Ne=>ue(Ne+i,0,b.maxScrollPosition),E),Se=Ce-E,Fe=Se===0||i<0&&Ce<=0||i>0&&Ce>=b.maxScrollPosition;return{nextPosition:Ce,actualDelta:Se,reachedBoundary:Fe}},[Te]),ie=r.useCallback(()=>{I.current!==null&&(window.cancelAnimationFrame(I.current),I.current=null),h.current=null},[]),ve=r.useCallback(()=>{le.current={...pt},R(!1),U.current?.reset(),ie()},[ie]),qe=r.useCallback(i=>{const b=le.current,E=$.current;if(!b.active||b.direction===0){ie();return}if(!E.scrollBarVisible||E.maxScrollPosition<=0){ie();return}const K=h.current??i,Ce=Math.max((i-K)/1e3,0),Se=Math.min(Ce,Ut);if(h.current=i,Se<=0){I.current=window.requestAnimationFrame(qe);return}const Fe=Math.min(b.distance,E.effectiveTapMaxDistance)/E.effectiveTapMaxDistance,Ne=Fe**1.1,ot=typeof E.tapScrollCircleOptions?.maxSpeedMultiplier=="number",We=Math.max(E.viewportSize*E.tapCircleMinSpeedMultiplier,40),Mt=ot?We:1200;let it=Math.max(E.viewportSize*E.tapCircleMaxSpeedMultiplier,Mt);const Qe=E.tapCircleMaxSpeedCurve;if(Qe){const et=Math.max(Qe.exponentialSteepness,0),Vt=Math.max(Qe.exponentialScale??E.tapCircleMaxSpeedMultiplier,0),Dt=et===0?Fe:Math.expm1(et*Fe),ut=et===0?1:Math.expm1(et)||1,_t=ut===0?Fe:Math.min(Math.max(Dt/ut,0),1),Ft=E.viewportSize*Vt*_t;it=Math.min(it,Math.max(Ft,We))}const vt=Math.max(it,We),Rt=Math.max(Qe?.easedOffset??0,0),wt=Math.min(1,Ne+Rt),yt=We+(vt-We)*wt,Et=b.direction*yt*Se,{actualDelta:At,reachedBoundary:kt}=De(Et);if(kt||At===0){ie();return}I.current=window.requestAnimationFrame(qe)},[De,ie]),Ze=r.useCallback(()=>{I.current===null&&(h.current=null,I.current=window.requestAnimationFrame(qe))},[qe]);r.useEffect(()=>()=>{ie()},[ie]);const nt=r.useCallback(i=>{le.current=i,R(i.active),i.active&&i.direction!==0?Ze():ie()},[Ze,ie]);r.useEffect(()=>{Q||ve()},[ve,Q]),r.useEffect(()=>{const i=b=>{const K=b.detail?.paneId;K&&u&&K!==u||ve()};return window.addEventListener(ct,i),()=>{window.removeEventListener(ct,i)}},[u,ve]),r.useEffect(()=>{if(!Q)return;const i=b=>{if(!le.current.active||le.current.pointerId===b.pointerId)return;const E=b.target;if(!(E instanceof Node)){ve();return}U.current?.getElement()?.contains(E)||ve()};return document.addEventListener("pointerdown",i,!0),()=>{document.removeEventListener("pointerdown",i,!0)}},[ve,Q]);const a=i=>{if(!Ie||ye<=0||O<=0)return 0;const b=ue(i,0,ye);return ue(b/ye*O,0,O)},T=i=>{const b=Math.max(Math.round(e/Xt),zt);De(i*b)},{handleArrowPointerDown:v,handleArrowPointerUp:k,handleArrowKeyDown:j}=Kt({canUseArrowButtons:Ve,enableArrowButtons:f,resetTapScroll:ve,scrollByStep:T}),W=i=>{if(!Ie)return;if(!o){i.preventDefault(),i.stopPropagation();return}if(i.pointerType==="mouse"&&i.button!==0||i.ctrlKey)return;ve();const b=i.currentTarget;b.setPointerCapture&&b.setPointerCapture(i.pointerId),w.current={pointerId:i.pointerId,startThumbPosition:be,startClientX:i.clientX,startClientY:i.clientY},q(!0),X(!0),i.preventDefault(),i.stopPropagation()},Re=i=>{const b=w.current;if(b.pointerId!==i.pointerId)return;const E=i.clientX-b.startClientX,K=i.clientY-b.startClientY,Ce=oe(E,K),Se=a(b.startThumbPosition+Ce);Te(Se),i.cancelable&&i.preventDefault()},Oe=i=>{if(w.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),w.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},q(!1),L.current&&!L.current.matches(":hover")&&X(!1),i.preventDefault(),i.stopPropagation()},_e=i=>{if(w.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),w.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},q(!1),L.current&&!L.current.matches(":hover")&&X(!1)},Ye=i=>{if(!Ie)return;if(!l){i.preventDefault(),i.stopPropagation();return}if(i.pointerType==="mouse"&&i.button!==0||i.ctrlKey)return;const b=i.currentTarget,E=b.getBoundingClientRect(),Ce=re(i)-(m?E.left:E.top);ve();const Se=Ce-Z/2,Fe=a(Se);Te(Fe),b.setPointerCapture&&b.setPointerCapture(i.pointerId),_.current={pointerId:i.pointerId,startThumbPosition:Se,startClientX:i.clientX,startClientY:i.clientY},i.preventDefault(),i.stopPropagation()},Ue=i=>{const b=_.current;if(b.pointerId!==i.pointerId)return;const E=i.clientX-b.startClientX,K=i.clientY-b.startClientY,Ce=oe(E,K),Se=a(b.startThumbPosition+Ce);Te(Se),i.cancelable&&i.preventDefault()},ze=i=>{if(_.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),_.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0},i.preventDefault(),i.stopPropagation()},Be=i=>{if(_.current.pointerId!==i.pointerId)return;const b=i.currentTarget;b.hasPointerCapture(i.pointerId)&&b.releasePointerCapture(i.pointerId),_.current={pointerId:null,startThumbPosition:0,startClientX:0,startClientY:0}},Y=r.useMemo(()=>ue((D?1:.8)*S,0,1),[D,S]),He=r.useMemo(()=>{const b=`calc(50% - ${se/2}px + ${B}px)`;return{left:we,top:b}},[we,B,se]),st=(i,b,E)=>F.jsx("button",{type:"button",tabIndex:-1,className:"aqvs:scrollbar-arrow-button flex items-center justify-center text-xs transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",style:{[G]:g,[de]:c},"aria-label":b,onMouseDown:v(i),onTouchStart:v(i),onMouseUp:k,onMouseLeave:k,onTouchEnd:k,onTouchCancel:k,onKeyDown:j(i),"aria-disabled":!f,disabled:!Ve,children:F.jsx("span",{"aria-hidden":"true",children:E})}),Je=C&&Ie?{orientation:Me,scrollPosition:t,maxScrollPosition:O,contentSize:s,viewportSize:e,thumbSize:Z,thumbPosition:be,thumbCenter:Ee,trackSize:x,isDragging:N,isTapScrollActive:D,visibleStartIndex:V,visibleEndIndex:z}:null;return F.jsxs("div",{className:$e.twMerge("group relative cursor-default select-none",xe,d),style:{[G]:e,[de]:c,backgroundColor:"white",userSelect:"none",position:"relative",touchAction:"none"},role:"scrollbar",tabIndex:-1,"aria-controls":u,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":O,"aria-orientation":m?"horizontal":"vertical",children:[!m&&Ie&&Q&&F.jsx(bt,{ref:U,className:$e.twMerge("pointer-events-auto absolute transition-opacity duration-150",H),size:se,maxVisualDistance:Ae,style:He,opacity:Y,renderVisual:M,onDragChange:nt}),st(-1,ge[0],me[0]),F.jsxs("div",{className:"aqvs:scrollbar-track relative flex-1",style:{borderRadius:c/2,touchAction:"none"},onPointerDown:Ye,onPointerMove:Ue,onPointerUp:ze,onPointerCancel:Be,"aria-disabled":!l,children:[Je&&F.jsx("div",{className:"pointer-events-none absolute inset-0","aria-hidden":!0,children:C?.(Je)}),Ie&&F.jsx("div",{className:"group absolute",style:{[G]:Z,[te]:be,...m?{top:0,bottom:0}:{left:0,right:0},touchAction:"none"},onPointerDown:W,onPointerMove:Re,onPointerUp:Oe,onPointerCancel:_e,role:"slider","aria-orientation":m?"horizontal":"vertical","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":O,"aria-disabled":!o,tabIndex:-1,children:F.jsx("div",{ref:L,className:$e.twMerge("aqvs:scrollbar-thumb absolute",m?"aqvs:scrollbar-thumb-horizontal":"aqvs:scrollbar-thumb-vertical"),"data-thumb-state":Xe,style:{borderRadius:c-1,cursor:o?"pointer":"default"},onMouseEnter:()=>{o&&X(!0)},onMouseLeave:()=>{o&&X(!1)}})})]}),st(1,ge[1],me[1])]})},Pe={debug(s,...e){process.env.NODE_ENV==="___"&&console.debug(`[VirtualScroll] ${s}`,...e)},warn(s,...e){console.warn(`[VirtualScroll] ${s}`,...e)},error(s,...e){console.error(`[VirtualScroll] ${s}`,...e)}},Ke={maxVelocity:6,minVelocity:.02,deceleration:.0025,velocitySampleWindow:90,startVelocityThreshold:.04},tt=(s,e,t)=>{for(const[n,o,l]of e)t==="add"?s.addEventListener(n,o,l):s.removeEventListener(n,o,l)},Tt=r.forwardRef(({children:s,contentSize:e,viewportSize:t,scrollBarWidth:n=12,enableThumbDrag:o=!0,enableTrackClick:l=!0,enableArrowButtons:f=!0,enablePointerDrag:m=!0,onScroll:c,className:d,style:u,background:p,tapScrollCircleOptions:P,inertiaOptions:C,itemCount:V,renderThumbOverlay:z,wheelSpeedMultiplier:N=1,contentInsets:q,visibleStartIndex:pe,visibleEndIndex:X},D)=>{const R=r.useRef(0),L=r.useRef(null),w=r.useRef(null),_=r.useRef({frame:null,velocity:0,lastTimestamp:null}),ne=r.useMemo(()=>({maxVelocity:C?.maxVelocity??Ke.maxVelocity,minVelocity:C?.minVelocity??Ke.minVelocity,deceleration:C?.deceleration??Ke.deceleration,velocitySampleWindow:C?.velocitySampleWindow??Ke.velocitySampleWindow,startVelocityThreshold:C?.startVelocityThreshold??Ke.startVelocityThreshold}),[C]),le=r.useMemo(()=>({top:Math.max(0,q?.top??0),bottom:Math.max(0,q?.bottom??0)}),[q]);Pe.debug("[ScrollPane] ScrollPane rendered",{contentSize:e,viewportSize:t,scrollBarWidth:n,className:d,style:u,tapScrollCircleOptions:P,inertiaOptions:C,enablePointerDrag:m,contentInsets:le});const U=r.useRef({contentSize:e,viewportSize:t}),I=r.useMemo(()=>e>t,[e,t]),h=r.useCallback(S=>{const{contentSize:M,viewportSize:ee}=U.current,$=M>ee,G=R.current;if(Pe.debug("[ScrollPane] scrollTo called",{newPosition:S,contentSize:M,viewportSize:ee,currentIsScrollable:$,prevPosition:G}),!$)return R.current!==0&&(R.current=0,c?.(0,G)),R.current;const de=typeof S=="function"?S(R.current):S,te=Math.max(M-ee,0),oe=ue(de,0,te);return R.current!==oe&&(R.current=oe,c?.(oe,G)),R.current},[c]),J=r.useCallback(()=>{const S=_.current;S.frame!==null&&cancelAnimationFrame(S.frame),S.frame=null,S.velocity=0,S.lastTimestamp=null},[]),y=r.useRef(J);r.useEffect(()=>{y.current=J},[J]);const Q=r.useCallback(S=>{if(!I)return;const{maxVelocity:M,minVelocity:ee,deceleration:$,startVelocityThreshold:G}=ne,de=ue(S,-M,M);if(Math.abs(de)<G)return;J(),_.current.velocity=de,_.current.lastTimestamp=null;const te=oe=>{const re=_.current;if(re.lastTimestamp===null){re.lastTimestamp=oe,re.frame=requestAnimationFrame(te);return}const ge=oe-re.lastTimestamp;if(re.lastTimestamp=oe,ge<=0){re.frame=requestAnimationFrame(te);return}const me=re.velocity;let xe=me;const Me=$*ge;me>0?xe=Math.max(0,me-Me):me<0&&(xe=Math.min(0,me+Me));const ke=(me+xe)/2*ge,g=R.current;ke!==0&&h(be=>be+ke);const x=R.current,{contentSize:he,viewportSize:Z}=U.current,O=Math.max(he-Z,0);re.velocity=xe;const ye=x===g||x<=0&&xe<=0||x>=O&&xe>=0;if(Math.abs(xe)<ee||ye){J();return}re.frame=requestAnimationFrame(te)};_.current.frame=requestAnimationFrame(te)},[I,ne,h,J]),se=r.useRef(Q);r.useEffect(()=>{se.current=Q},[Q]),r.useLayoutEffect(()=>{U.current={contentSize:e,viewportSize:t}},[e,t]),r.useLayoutEffect(()=>{const S=w.current;if(!S)return;const M=()=>{S.scrollTop!==0&&(Pe.debug("[ScrollPane] Native scroll detected, resetting to 0",{scrollTop:S.scrollTop}),S.scrollTop=0),S.scrollLeft!==0&&(S.scrollLeft=0)};return S.addEventListener("scroll",M),()=>S.removeEventListener("scroll",M)},[]),r.useLayoutEffect(()=>{if(I){Pe.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change",{contentSize:e,viewportSize:t,scrollPosition:R.current});const S=ue(e-t,0,e);R.current>S&&h(S)}else h(0)},[I,h,e,t]),r.useEffect(()=>{const S=ee=>{if(!I)return;ee.preventDefault(),J();let $=ee.deltaY;ee.deltaMode===1?$*=16:ee.deltaMode===2&&($*=t),N!==1&&($*=N),Pe.debug("[ScrollPane] wheel event",{deltaY:$,scrollPosition:R.current,wheelSpeedMultiplier:N,deltaMode:ee.deltaMode,scrollTop:w.current?.scrollTop}),h(G=>G+$)},M=L.current;return M&&M.addEventListener("wheel",S,{passive:!1}),()=>{M&&M.removeEventListener("wheel",S)}},[I,h,J,t,N]),r.useImperativeHandle(D,()=>({scrollTo:h,getScrollPosition:()=>R.current,getContentSize:()=>e,getViewportSize:()=>t}),[h,e,t]);const we=r.useRef(h);r.useEffect(()=>{we.current=h},[h]);const B=r.useId(),H=r.useRef({pointerId:null,startClientY:0,startScroll:0,isDragging:!1,shouldCancelNextClick:!1,clickResetTimer:null,velocitySamples:[]}),ce=r.useRef(m);r.useEffect(()=>{ce.current=m},[m]);const fe=r.useRef(I);r.useEffect(()=>{fe.current=I},[I]);const A=r.useRef(ne);return r.useEffect(()=>{A.current=ne},[ne]),r.useEffect(()=>{if(m)return;const S=w.current,M=H.current;M.pointerId!==null&&S&&S.hasPointerCapture(M.pointerId)&&S.releasePointerCapture(M.pointerId),M.clickResetTimer!==null&&(window.clearTimeout(M.clickResetTimer),M.clickResetTimer=null),M.pointerId=null,M.startClientY=0,M.startScroll=0,M.isDragging=!1,M.shouldCancelNextClick=!1,M.velocitySamples=[]},[m]),r.useEffect(()=>{const S=w.current;if(!S)return;const M=6,ee=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),$=()=>{const g=H.current;g.pointerId=null,g.startClientY=0,g.startScroll=0,g.isDragging=!1,g.velocitySamples=[]},G=()=>{const g=H.current;g.clickResetTimer!==null&&(window.clearTimeout(g.clickResetTimer),g.clickResetTimer=null)},de=g=>{const x=H.current,he=ee();x.velocitySamples.push({clientY:g,time:he});const Z=A.current.velocitySampleWindow;x.velocitySamples=x.velocitySamples.filter(O=>he-O.time<=Z)},te=g=>g instanceof HTMLElement&&g.closest("[data-scrollpane-ignore-drag='true']")!==null,oe=g=>{const x=H.current;x.shouldCancelNextClick&&(g.preventDefault(),g.stopPropagation(),x.shouldCancelNextClick=!1)},re=g=>{const x=H.current;x.isDragging||(x.isDragging=!0,x.shouldCancelNextClick=!0,S.hasPointerCapture(g.pointerId)||S.setPointerCapture(g.pointerId),de(g.clientY))},ge=g=>{const x=H.current;if(x.pointerId!==g.pointerId||!(ce.current&&fe.current)||!x.isDragging&&(Math.abs(g.clientY-x.startClientY)<M||(re(g),!x.isDragging)))return;de(g.clientY);const he=g.clientY-x.startClientY,Z=x.startScroll-he;we.current(Z),g.cancelable&&g.preventDefault()},me=g=>{const x=H.current;if(x.pointerId!==g.pointerId)return;x.isDragging&&x.shouldCancelNextClick&&g.cancelable&&(g.preventDefault(),g.stopPropagation()),S.hasPointerCapture(g.pointerId)&&S.releasePointerCapture(g.pointerId);let he=0;if(x.isDragging&&x.velocitySamples.length>=2){const O=x.velocitySamples,ye=A.current.velocitySampleWindow,be=O[O.length-1],Ee=O.find(Ie=>be.time-Ie.time<=ye)??O[0];if(be&&Ee&&be.time!==Ee.time){const Ie=be.clientY-Ee.clientY,Ve=be.time-Ee.time;he=-(Ie/Ve)}}G(),x.shouldCancelNextClick&&(x.clickResetTimer=window.setTimeout(()=>{const O=H.current;O.shouldCancelNextClick=!1,O.clickResetTimer=null},0));const Z=A.current.startVelocityThreshold;$(),Math.abs(he)>=Z&&se.current?.(he)},xe=g=>{if(!(ce.current&&fe.current)||g.button!==0&&g.pointerType==="mouse"||g.ctrlKey||g.metaKey||g.altKey||te(g.target))return;window.dispatchEvent(new CustomEvent(ct,{detail:{paneId:B}})),y.current?.();const x=H.current;G(),x.pointerId=g.pointerId,x.startClientY=g.clientY,x.startScroll=R.current,x.isDragging=!1,x.shouldCancelNextClick=!1,x.velocitySamples=[]},Me=g=>{const x=H.current;x.pointerId===g.pointerId&&(x.shouldCancelNextClick=!1,S.hasPointerCapture(g.pointerId)&&S.releasePointerCapture(g.pointerId),G(),$())},Ae=[["click",oe,!0],["pointerdown",xe,{passive:!1}],["pointermove",ge,{passive:!1}],["pointerup",me,void 0],["pointercancel",Me,void 0]],ke=[["pointermove",ge,{passive:!1}],["pointerup",me,void 0],["pointercancel",Me,void 0]];return tt(S,Ae,"add"),tt(window,ke,"add"),()=>{tt(S,Ae,"remove"),tt(window,ke,"remove");const g=H.current;g.pointerId!==null&&S.hasPointerCapture(g.pointerId)&&S.releasePointerCapture(g.pointerId),G(),$()}},[B]),F.jsxs("div",{ref:L,className:$e.twMerge("flex",d),style:u,children:[F.jsxs("div",{ref:w,className:$e.twMerge("relative h-full flex-1 overflow-hidden"),style:{height:t,paddingTop:le.top,paddingBottom:le.bottom,...m?{touchAction:"none"}:{}},id:B,children:[p,s(R.current)]}),I&&F.jsx(It,{contentSize:e,viewportSize:t,scrollPosition:R.current,onScroll:h,enableThumbDrag:o,enableTrackClick:l,enableArrowButtons:f,scrollBarWidth:n,ariaControls:B,tapScrollCircleOptions:P,itemCount:V,renderThumbOverlay:z,visibleStartIndex:pe,visibleEndIndex:X})]})}),mt=(s,e,t)=>Math.min(Math.max(s,e),t),Zt=({dragState:s,normalizedDistance:e,sizeScale:t,size:n})=>{const o=Math.max(n/2,1),l=1+e*.65,f=Math.max(.65,1-e*.25),m=s.direction*e*26*t,c=.8+e*.18,d=3*t,u=6*t,p=22*t,P=Math.abs(m)+u,C=m>0?d:-Math.abs(m)-d,V=Math.max(2.5,3*t),z=mt(s.offsetX,-o,o),N=mt(s.offsetY,-o,o),q=o*.35,pe=z/o*q,X=N/o*q,D=pe*.45,R=X*.45,L=Math.max(p*.38,6),w=.65+e*.2,_=s.active;return F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"aqvs:tap-scroll-circle-gradient absolute inset-0 rounded-full border border-white/40 shadow-md",style:{transform:`scale(${f}, ${l})`,transition:_?"40ms transform ease-out":"200ms ease transform"}}),F.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full border border-white/50 bg-white/85",style:{width:p,height:p,transform:`translate(calc(-50% + ${pe}px), calc(-50% + ${X}px)) scale(${f}, ${c*l})`,transition:_?"70ms transform ease-out":"200ms ease transform"}}),F.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full bg-white/80",style:{width:L,height:L,transform:`translate(calc(-50% + ${D}px), calc(-50% + ${R}px)) scale(${f}, ${l})`,opacity:w,boxShadow:"0 0 8px rgba(255,255,255,0.45)",transition:_?"120ms opacity 150ms, 120ms transform ease-out ease-out":"220ms ease transform, 240ms opacity ease"}}),F.jsx("div",{className:"absolute top-1/2 left-1/2 rounded-full bg-white/50",style:{width:V,height:P,transform:`translate(-50%, ${C}px)`,opacity:e,transition:_?"40ms height, 60ms opacity ease-out ease-out":"200ms ease height, 120ms ease opacity"}})]})},Jt=s=>{if(!Number.isFinite(s))return 0n;const e=Math.trunc(s);return e<=0?0n:BigInt(e)},rt=s=>{if(s<=0||!Number.isFinite(s))return 0;const e=Math.trunc(s),t=BigInt(e)&-BigInt(e);return Number(t)};class Ct{tree;deltas;size;baseValue;valueFn;total;constructor(e,t,n){this.reset(e,t,n)}reset(e,t,n){if(this.size=e,this.tree=new Map,this.deltas=new Map,this.total=void 0,typeof t=="function"){if(this.valueFn=t,this.size>0){const l=n?.sampleRange??{from:0,to:Math.min(99,this.size-1)},{mode:f,materializedValues:m}=this._calculateMode(l.from,l.to);if(this.baseValue=f,n?.materialize)for(let c=0;c<m.length;c++){const d=m[c],u=l.from+c;if(u>=this.size)break;const p=d-this.baseValue;this.deltas.set(u,p),this._updateTree(u,p)}}else this.baseValue=0;this.total=this.getTotal()}else this.valueFn=void 0,this.baseValue=t,this.total=this.baseValue*this.size}setValueFn(e){typeof e=="function"?this.valueFn=e:(this.valueFn=void 0,this.baseValue=e)}_calculateMode(e,t){if(!this.valueFn)return{mode:0,materializedValues:[]};const n=[];for(let d=e;d<=t&&!(d>=this.size);d++)n.push(this.valueFn(d));const o=[...n];if(n.length===0)return{mode:0,materializedValues:[]};n.sort((d,u)=>d-u);const l=Math.floor(n.length/2);let f;n.length%2===0?f=Math.floor((n[l-1]+n[l])/2):f=n[l];const m=new Map;let c=0;for(const d of n){const u=(m.get(d)??0)+1;m.set(d,u),u>c&&(c=u)}if(c>n.length*.2){const d=[];for(const[p,P]of m.entries())P===c&&d.push(p);const u=d.reduce((p,P)=>p+P,0);f=Math.floor(u/d.length)}return{mode:f,materializedValues:o}}update(e,t){return this.updates([{index:e,value:t}])}updates(e){const t=this._buildDeltaUpdates(e);return t.length>0?this.updateDeltas(t):this.total}updateDelta(e,t){return this.updateDeltas([{index:e,change:t}])}updateDeltas(e){for(const{index:t,change:n}of e){if(t<0||t>=this.size)throw new Error(`Index ${t} out of bounds`);const o=this.deltas.get(t)??0;this.deltas.set(t,o+n),this._updateTree(t,n)}return this.total}_updateTree(e,t){if(t===0)return;let n=e+1;for(;n<=this.size;){this.tree.set(n,(this.tree.get(n)??0)+t);const o=rt(n);if(o===0)break;n+=o}this.total!==void 0&&(this.total+=t)}_buildDeltaUpdates(e){const t=[];for(const{index:n,value:o}of e){if(n<0||n>=this.size)throw new Error(`Index ${n} out of bounds`);if(o<0)throw new Error("Value cannot be negative.");const l=this.deltas.has(n)?(this.deltas.get(n)??0)+this.baseValue:this.baseValue,f=o-l;f!==0&&t.push({index:n,change:f})}return t}_computeTreeTotal(){if(this.size<=0)return 0;let e=0,t=this.size;for(;t>0;){e+=this.tree.get(t)??0;const n=rt(t);if(n===0)break;t-=n}return e+this.baseValue*this.size}_materialize(e,t=!0){if(this.valueFn){const n=this.deltas.get(e)??0,l=this.valueFn(e)-this.baseValue;if(l!==n&&(this.deltas.set(e,l),t)){const f=l-n;this._updateTree(e,f)}}}_materializeRanges(e,t,n=!1){if(!(e?.materialize&&this.valueFn))return;const o=e.ranges;if(o&&o.length>0){for(const m of o){const c=m.from,d=Math.min(m.to,this.size-1);for(let u=c;u<=d;u++)this._materialize(u)}if(t===void 0)return;if(n){this._materialize(t);return}const l=o[0].from,f=o[o.length-1].to;t>=l&&t<=f&&this._materialize(t);return}t!==void 0&&this._materialize(t)}_findIndex(e,t={},n){if(this.size>=Number.MAX_SAFE_INTEGER)return this._findIndexLarge(e,t,n);if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};let o=0,l=this.size-1,f=-1,m,c,d=this.total;for(;o<=l;){const p=Math.floor((o+l)/2);m=this.prefixSum(p,t),d=m.total,(n?m.cumulative>=e:m.cumulative<=e)?(f=p,c=m,n?l=p-1:o=p+1):n?o=p+1:l=p-1}const u=c??m;return{index:f,total:d,cumulative:u?.cumulative,currentValue:u?.currentValue,safeIndex:u?.safeIndex}}_findIndexLarge(e,t,n){if(this.size===0)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};const o=Jt(this.size);if(o===0n)return{index:-1,total:this.total??0,cumulative:void 0,currentValue:void 0,safeIndex:void 0};let l=0n,f=o-1n,m,c,d,u=this.total;for(;l<=f;){const C=l+f>>1n,V=Number(C),z=this.prefixSum(V,t);if(d=z,u=z.total,n?z.cumulative>=e:z.cumulative<=e)if(m=C,c=z,n){if(C===0n)break;f=C-1n}else l=C+1n;else if(n)l=C+1n;else{if(C===0n)break;f=C-1n}}const p=c??d;return{index:m!==void 0?Number(m):-1,total:u,cumulative:p?.cumulative,currentValue:p?.currentValue,safeIndex:p?.safeIndex}}prefixSum(e,t){if(e<0)return{cumulative:0,total:this.total,currentValue:0,safeIndex:0};const n=ue(e,0,this.size-1),o=t?.materializeOption;this._materializeRanges(o,n,!0);let l=0,f=n+1;for(;f>0;){const c=this.tree.get(f)??0;l+=c;const d=rt(f);if(d===0)break;f-=d}const m=o?.materialize?this.get(n):(this.deltas.get(n)||0)+this.baseValue;return{cumulative:l+this.baseValue*(n+1),total:this.total,currentValue:m,safeIndex:n}}get(e,t){if(e<0||e>=this.size)throw new Error("Index out of bounds");const n=t?.materializeOption;return this._materializeRanges(n,e),(this.deltas.get(e)??0)+this.baseValue}getTotal(e){const t=e?.materializeOption;if(this._materializeRanges(t),this.total===void 0)if(this.size===0)this.total=0;else{this.total=this._computeTreeTotal();const n=this.prefixSum(this.getSize()-1);console.assert(n.cumulative===n.total,"Inconsistent Fenwick Tree state")}return this.total}rebuildTree(e){if(e?.materialize&&this.valueFn){const n=this.valueFn;this.reset(this.size,o=>n(o),{materialize:!0});return}const t=new Map;for(const[n,o]of this.deltas.entries()){if(o===0)continue;let l=n+1;for(;l<=this.size;){t.set(l,(t.get(l)??0)+o);const f=rt(l);if(f===0)break;l+=f}}this.tree=t,this.total=this._computeTreeTotal()}calculateAccumulatedError(){if(this.total===void 0)return 0;let e=this.baseValue*this.size;for(const t of this.deltas.values())e+=t;return this.total-e}changeSize(e){const t=this.size;if(e===t)return;if(e<t)for(const o of this.deltas.keys())o>=e&&this.deltas.delete(o);this.size=e,this.rebuildTree();const n=this.prefixSum(this.getSize()-1);console.assert(n.cumulative===n.total,"Inconsistent Fenwick Tree state")}getSize(){return this.size}findIndexAtOrAfter(e,t){return this._findIndex(e,t??{},!0)}findIndexAtOrBefore(e,t){return this._findIndex(e,t??{},!1)}}const St=(s,e,t)=>{const n=Math.max(0,s),o=r.useRef(null),l=r.useMemo(()=>new Ct(n,e,t),[n,e,t]);return Object.is(o.current,l)||console.warn("[useFenwickMapTree] instance changed"),o.current=l,l};class Qt{key;value;prev=null;next=null;constructor(e,t){this.key=e,this.value=t}}class ht{head=null;tail=null;addToTail(e){this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):this.head=this.tail=e}remove(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=null,e.next=null}removeHead(){const e=this.head;return e&&this.remove(e),e}moveToTail(e){this.remove(e),this.addToTail(e)}}function Pt(s){const e=r.useRef(new Map),t=r.useRef(new ht);r.useEffect(()=>{for(;e.current.size>s;){const u=t.current.removeHead();if(u)e.current.delete(u.key);else break}},[s]);const n=r.useCallback(u=>{const p=e.current.get(u);if(p)return t.current.moveToTail(p),p.value},[]),o=r.useCallback((u,p)=>{if(s<=0)return;let P=e.current.get(u);if(P)P.value=p,t.current.moveToTail(P);else{if(e.current.size>=s){const C=t.current.removeHead();C&&e.current.delete(C.key)}P=new Qt(u,p),e.current.set(u,P),t.current.addToTail(P)}},[s]),l=r.useCallback(u=>e.current.has(u),[]),f=r.useCallback(u=>{const p=e.current.get(u);p&&(t.current.remove(p),e.current.delete(u))},[]),m=r.useCallback(()=>{e.current.clear(),t.current=new ht},[]),[c,d]=r.useState(()=>({get:n,set:o,has:l,remove:f,clear:m}));return r.useEffect(()=>d({get:n,set:o,has:l,remove:f,clear:m}),[n,o,l,f,m]),c}const er=1e4,tr=()=>{const{get:s,set:e,has:t,clear:n}=Pt(er);return{get:s,set:e,has:t,clear:n}},ae=(s,e)=>e<=0?0:ue(s,0,e-1),rr=s=>({top:Math.max(0,s?.top??0),bottom:Math.max(0,s?.bottom??0)}),je=(s,e)=>s<=e?0:s-e,Ge=(s,e)=>s<=0?e:s+e,gt=s=>{if(!Number.isFinite(s))return 0n;const e=Math.trunc(s);return e<=0?0n:BigInt(e)},nr=(s,e,t,n,o,l,f,m)=>{const c=gt(n);if(c===0n)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const d=D=>D<0n?0n:D>=c?c-1n:D,u={materializeOption:{materialize:!1}},{index:p}=l.findIndexAtOrAfter(s,u);let P;p===-1?P=c-1n:(P=gt(p),P>=c&&(P=c-1n)),s<=0&&(P=0n),m&&s>=f&&(P=c-1n);const C=D=>{let R=0,L=D,w=D,_=0n;for(;L<c&&R<e;){const ne=Number(L),le=o(ne);if(R+=le,w=L,L+=1n,_+=1n,!Number.isFinite(le)||le<=0)break}return _===0n&&(w=D),{height:R,end:w}};let{height:V,end:z}=C(P);if(V<e&&P>0n){let D=P,R=V;for(;D>0n&&R<e;){D-=1n;const w=Number(D),_=o(w);if(R+=_,!Number.isFinite(_)||_<=0)break}P=d(D);const L=C(P);V=L.height,z=L.end}const N=d(P),q=d(z),pe=d(N-BigInt(Math.max(0,t))),X=d(q+BigInt(Math.max(0,t)));return{renderingStartIndex:ae(Number(pe),n),renderingEndIndex:ae(Number(X),n),visibleStartIndex:ae(Number(N),n),visibleEndIndex:ae(Number(q),n)}},sr=(s,e,t,n,o,l,f)=>{if(n===0)return{renderingStartIndex:0,renderingEndIndex:0,visibleStartIndex:0,visibleEndIndex:0};const m=Number.isFinite(f),c=m?Math.min(Math.max(0,s),f):Math.max(0,s);if(n>=Number.MAX_SAFE_INTEGER)return nr(c,e,t,n,o,l,f,m);const{index:d,cumulative:u,currentValue:p}=l.findIndexAtOrAfter(c,{materializeOption:{materialize:!1}}),P=d===-1?e<=0||(u??0)<c+(p??0)?n-1:0:d;let C=ae(P,n),V=0;if(C===d&&u!==void 0&&p!==void 0)V=u-p-c;else{const{cumulative:D,currentValue:R}=l.prefixSum(C,{materializeOption:{materialize:!1}});V=(D??0)-(R??0)-c}const z=V;let N=C;for(;N<n&&V<e;)V+=o(N),N++;if(V<e&&C>0){let D=V+Math.abs(Math.min(0,z)),R=C-1;for(;R>=0&&D<e;)D+=o(R),R--;for(C=ae(R+1,n),V=0,N=C;N<n&&V<e;)V+=o(N),N++}const q=ae(C-t,n),pe=ae(Math.max(N-1,C),n),X=ae(pe+t,n);return{renderingStartIndex:q,renderingEndIndex:X,visibleStartIndex:C,visibleEndIndex:pe}},or=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),xt=(s,e,t)=>{const n=Math.max(0,e??0),o=r.useRef({lastInvokeAt:0,rafId:null,pendingPayload:null,loopActive:!1,normalizedThrottle:n}),l=r.useCallback(()=>{const c=o.current;c.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(c.rafId),c.rafId=null,c.loopActive=!1},[]),f=r.useCallback(c=>{const d=o.current;d.rafId=null;const u=typeof c=="number"?c:or(),p=d.normalizedThrottle,P=d.pendingPayload,C=s.current;if(P!==null&&C){const V=u-d.lastInvokeAt;(p===0||d.lastInvokeAt===0||V>=p)&&(d.pendingPayload=null,d.lastInvokeAt=u,t(C,P))}if(d.pendingPayload!==null){typeof requestAnimationFrame=="function"?d.rafId=requestAnimationFrame(f):d.loopActive=!1;return}d.loopActive=!1},[s,t]),m=r.useCallback(()=>{const c=o.current;if(!c.loopActive){if(c.loopActive=!0,typeof requestAnimationFrame=="function"){c.rafId=requestAnimationFrame(f);return}c.loopActive=!1}},[f]);return r.useEffect(()=>()=>{l(),o.current.pendingPayload=null},[l]),r.useEffect(()=>{l();const c=o.current;c.lastInvokeAt=0,c.pendingPayload=null,c.normalizedThrottle=n},[n,l]),r.useCallback(c=>{const d=o.current;d.pendingPayload=c,m()},[m])},ir=({itemCount:s,getItem:e,getItemHeight:t,viewportSize:n,overscanCount:o=15,className:l,onScroll:f,onRangeChange:m,children:c,background:d,initialScrollIndex:u,initialScrollOffset:p,tapScrollCircleOptions:P,scrollBarWidth:C,enableThumbDrag:V,enableTrackClick:z,enableArrowButtons:N,enablePointerDrag:q,inertiaOptions:pe,callbackThrottleMs:X=5,renderThumbOverlay:D,wheelSpeedMultiplier:R,contentInsets:L,enableKeyboardNavigation:w=!0,onItemFocus:_,clipItemHeight:ne=!1},le)=>{const U=r.useRef(null),I=r.useRef(!1),h=r.useMemo(()=>rr(L),[L]),J=r.useRef({size:s,valueOrFn:t,options:{sampleRange:{from:0,to:100}}}),y=St(J.current.size,J.current.valueOrFn,J.current.options),[Q]=r.useState(()=>{let a=h.top,T=0;if(typeof u=="number"){const v=ue(u,0,s-1),k=ue(v-o*2,0,s-1),j=ue(v+o*2,0,s-1),W=u>0?{materializeOption:{materialize:!0,ranges:[{from:k,to:j}]}}:void 0,{cumulative:Re,total:Oe,currentValue:_e}=y.prefixSum(u,W),Ye=Math.max(Re-_e,0);a=Ge(Ye,h.top),T=Oe??y.getTotal()}else typeof p=="number"&&(a=Ge(Math.max(p,0),h.top)),T=y.getTotal();return{position:a,total:T}}),[se,we]=r.useState(Q.position),[B,H]=r.useState(Q.total),[ce,fe]=r.useState(Q.position),[A,S]=r.useState(s),M=r.useRef(Q.position),ee=r.useRef(h.top),$=r.useRef(f??void 0),G=r.useRef(m??void 0),de=r.useRef(new Map),te=r.useRef(null),oe=r.useRef(null);r.useEffect(()=>{$.current=f??void 0,G.current=m??void 0},[m,f]);const re=r.useCallback(a=>{if(w&&a&&typeof a.focus=="function")try{a.focus({preventScroll:!0})}catch{a.focus()}},[w]),ge=xt($,X,(a,{position:T,totalHeight:v})=>{a(T,v)}),me=xt(G,X,(a,{renderingStartIndex:T,renderingEndIndex:v,visibleStartIndex:k,visibleEndIndex:j,scrollPosition:W,totalHeight:Re})=>{a(T,v,k,j,W,Re)});r.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]),r.useEffect(()=>{w||(de.current.clear(),te.current=null,oe.current=null)},[w]);const xe=.01,Me=r.useRef({rafId:null,loopActive:!1,idleFrames:0,lastRenderedPosition:Q.position}),Ae=r.useCallback(()=>{const a=Me.current;a.rafId!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.rafId),a.rafId=null,a.loopActive=!1,a.idleFrames=0},[]);r.useEffect(()=>()=>{Ae()},[Ae]);const ke=r.useCallback(()=>{const a=Me.current;a.rafId=null;const T=M.current,v=je(T,h.top),k=y.getTotal();if(we(W=>Math.abs(W-T)<xe?W:T),ge({position:v,totalHeight:k}),Math.abs(a.lastRenderedPosition-T)>=xe?(a.lastRenderedPosition=T,a.idleFrames=0):a.idleFrames+=1,a.idleFrames>=2){Ae();return}if(typeof requestAnimationFrame=="function"){a.rafId=requestAnimationFrame(ke);return}a.loopActive=!1},[y,h.top,ge,Ae]),g=r.useCallback(()=>{const a=Me.current;if(a.idleFrames=0,!a.loopActive){if(a.loopActive=!0,typeof requestAnimationFrame=="function"){a.rafId=requestAnimationFrame(ke);return}a.loopActive=!1}},[ke]),x=r.useCallback((a,T)=>{const v=T?.immediate??!1,k=je(a,h.top);if(M.current=a,v){Me.current.lastRenderedPosition=a,Me.current.idleFrames=0,we(a),ge({position:k,totalHeight:y.getTotal()});return}g()},[g,y,h.top,ge]),he=r.useRef(!1);r.useEffect(()=>{if(!he.current)if(he.current=!0,typeof p=="number"){const a=Ge(Math.max(p,0),h.top),T=Math.abs(a-M.current)>.5;x(a,{immediate:!0}),T&&fe(a)}else x(M.current,{immediate:!0})},[p,h.top,x]),r.useLayoutEffect(()=>{y.setValueFn(t),A!==s&&(y.changeSize(s),S(s));const a=y.getTotal();B!==a&&H(a)},[y,A,s,B,t]),r.useLayoutEffect(()=>{ce!==null&&U.current&&(Pe.debug("[VirtualScroll] Scrolling to position:",ce),U.current.scrollTo(ce),fe(null))},[ce]),r.useEffect(()=>{const a=ee.current;if(a===h.top)return;const T=je(M.current,a),v=Ge(T,h.top);ee.current=h.top,M.current=v,fe(v),x(v,{immediate:!0})},[h.top,x]);const Z=r.useCallback(a=>{if(!U.current)return;const T=ae(a,A),v=ae(T-o*2,A),k=ae(T+o*2,A),{cumulative:j,total:W,currentValue:Re}=y.prefixSum(T,{materializeOption:{materialize:!0,ranges:[{from:v,to:k}]}});if(Pe.debug("[VirtualScroll] Scrolling to index:",T,"Offset:",j,"Total height:",W,"Current value:",Re,"safeIndexFrom:",v,"safeIndexTo:",k),!W)return;const Oe=Math.max(j-Re,0),_e=Ge(Oe,h.top);H(W),fe(_e),Pe.debug("[VirtualScroll] Setting scroll position to:",_e)},[y,o,A,h.top]),O=r.useCallback(a=>{if(!U.current)return;const T=y.getTotal(),v=ue(Math.floor(a),0,T),k=y.findIndexAtOrAfter(v,{materializeOption:{materialize:!1}}).index;Z(k)},[y,Z]),ye=r.useCallback(a=>{const T=je(M.current,h.top),v=typeof a=="function"?a(T):a;O(v);const k=U.current?.getScrollPosition(),j=typeof k=="number"?k:M.current;return x(j),j},[h.top,O,x]),be=r.useCallback((a,T)=>{Pe.debug("[VirtualScroll] Scroll position changed:",a),x(a)},[x]),Ee=r.useMemo(()=>je(se,h.top),[h.top,se]),Ie=r.useMemo(()=>{const a=sr(Ee,n,o,A,t,y,B);return Pe.debug("[VirtualScroll] Calculated rendering range:",{...a,scrollPosition:Ee,renderingContentSize:y.getTotal(),overscanCount:o,viewportSize:n}),a},[Ee,n,o,A,t,y,B]),{renderingStartIndex:Ve,renderingEndIndex:Xe,visibleStartIndex:Te,visibleEndIndex:De}=Ie,ie=r.useCallback((a,T)=>{if(!w||A===0)return;const v=ae(a,A);if(!(T?.ensureVisible??!0)){const Be=de.current.get(v);Be&&(te.current=null,oe.current=v,re(Be));return}const j=y.prefixSum(v,{materializeOption:{materialize:!1}}),W=j.currentValue,Re=Math.max(j.cumulative-W,0),Oe=Re+W,_e=je(M.current,h.top),Ye=_e+n;if(Re<_e||Oe>Ye){te.current=v,Z(v);return}const ze=de.current.get(v);if(ze){te.current=null,oe.current=v,re(ze);return}te.current=v},[w,A,y,h.top,Z,re,n]),ve=r.useCallback((a,T)=>{if(!w||a.defaultPrevented||a.altKey||a.metaKey||a.ctrlKey)return;const v=a.target;if(v){const k=v.tagName;if(k==="INPUT"||k==="TEXTAREA"||k==="SELECT"||v.isContentEditable)return}if(a.key==="ArrowDown"){T<A-1&&(a.preventDefault(),ie(T+1));return}if(a.key==="ArrowUp"){T>0&&(a.preventDefault(),ie(T-1));return}if(a.key==="PageDown"){if(T<A-1){a.preventDefault();const k=Math.max(De-Te+1,1),j=Math.max(k,1),W=ae(Math.min(T+j,A-1),A);ie(W)}return}if(a.key==="PageUp"&&T>0){a.preventDefault();const k=Math.max(De-Te+1,1),j=Math.max(k,1),W=ae(T-j,A);ie(W)}},[w,A,ie,De,Te]),qe=r.useCallback(a=>{if(!w)return;const T=ae(a,A);te.current=null,oe.current=T,_?.(T)},[w,A,_]);r.useEffect(()=>{const a=U.current?.getScrollPosition()??0,T=M.current,v=je(T,h.top);Pe.debug("[VirtualScroll] Range change effect triggered",{renderingStartIndex:Ve,renderingEndIndex:Xe,visibleStartIndex:Te,visibleEndIndex:De,scrollPositionState:se,paneScrollPosition:T,logicalScrollPosition:v,contentSize:B,scrollPaneScrollPosition:a}),me({renderingStartIndex:Ve,renderingEndIndex:Xe,visibleStartIndex:Te,visibleEndIndex:De,scrollPosition:v,totalHeight:B})},[B,Xe,Ve,h.top,me,se,De,Te]);const Ze=r.useCallback(a=>{const T=(X??0)>0,v=Math.abs(a-se),k=T&&v>.5?se:a,j=je(k,h.top);if(Pe.debug("[VirtualScroll] Rendering visible items",{currentScrollPosition:a,effectiveScrollPosition:j,renderingStartIndex:Ve,renderingEndIndex:Xe,fenwickSize:A,viewportSize:n,callbackThrottleMs:X,diff:v,rawEffectiveScrollPosition:k}),A===0)return F.jsx("div",{className:"absolute w-full",style:{top:0},children:F.jsx("div",{className:"text-center text-gray-500",children:"No items"})});const W=ae(Ve,A),Re=ae(Xe,A),{cumulative:Oe,currentValue:_e}=y.prefixSum(W,{materializeOption:{materialize:!1}}),Ye=Oe-_e,Ue=[],ze=[];for(let Y=W;Y<=Re;Y++){const He=t(Y);y.get(Y)!==He&&Ue.push({index:Y,value:He});const{cumulative:Je,currentValue:i}=y.prefixSum(Y,{materializeOption:{materialize:!1}}),b=Je-i,E=K=>{if(!K){de.current.delete(Y);return}w&&(de.current.set(Y,K),te.current===Y&&(te.current=null,oe.current=Y,re(K)))};ze.push(F.jsx("div",{ref:E,"data-index":Y,"data-virtualscroll-item":"true",style:{position:"absolute",top:b-Ye+h.top,width:"100%",height:He,overflow:ne?"hidden":void 0},tabIndex:w?-1:void 0,onPointerDown:w?K=>{K.currentTarget.focus({preventScroll:!0})}:void 0,onKeyDownCapture:w?K=>ve(K,Y):void 0,onFocusCapture:w?()=>qe(Y):void 0,children:c(e(Y),Y)},Y))}Ue.length>0&&Promise.resolve().then(()=>{if(!I.current)return;const Y=y.updates(Ue);if(!I.current||typeof Y!="number")return;H(Y),Pe.debug("[VirtualScroll] Updated heights for items",Ue,"New total height:",Y);const He=U.current?.getScrollPosition()??M.current;He===M.current||!I.current||x(He)});const Be=Ye-j;if(h.bottom>0){const Y=y.getTotal()+h.top-Ye;ze.push(F.jsx("div",{style:{position:"absolute",top:Y,height:h.bottom,width:"100%"}},"virtualscroll-bottom-inset"))}return Pe.debug("[VirtualScroll] Rendering items",{nodeCount:ze.length,containerTop:Be,logicalScrollPosition:Ee,resolvedInsets:h,effectiveScrollPosition:j}),F.jsx("div",{className:"absolute w-full",style:{top:Be},children:ze})},[X,c,w,y,A,e,t,qe,ve,Ee,Xe,Ve,h,se,re,x,n,ne]);r.useImperativeHandle(le,()=>({getScrollPosition:()=>U.current?.getScrollPosition()??-1,getContentSize:()=>U.current?.getContentSize()??-1,getViewportSize:()=>U.current?.getViewportSize()??-1,scrollTo:ye,scrollToIndex:Z,getFenwickTreeTotalHeight:()=>y.getTotal(),getFenwickSize:()=>y.getSize(),focusItemAtIndex:ie}),[ye,Z,y,ie]);const nt=B+h.top+h.bottom;return F.jsx(Tt,{ref:U,contentSize:nt,viewportSize:n,className:l,onScroll:be,background:d,tapScrollCircleOptions:P,inertiaOptions:pe,itemCount:s,scrollBarWidth:C,enableThumbDrag:V,enableTrackClick:z,enableArrowButtons:N,enablePointerDrag:q,renderThumbOverlay:D,wheelSpeedMultiplier:R,contentInsets:h,visibleStartIndex:Te,visibleEndIndex:De,children:Ze})},ar=r.forwardRef(ir);exports.FenwickMapTree=Ct;exports.ScrollBar=It;exports.ScrollPane=Tt;exports.VirtualScroll=ar;exports.minmax=ue;exports.tapScrollCircleSampleVisual=Zt;exports.useFenwickMapTree=St;exports.useHeightCache=tr;exports.useLruCache=Pt;
|