import{c as ae,n as y,v as ie,j as h,P as L,p as O,q as C,u as P,a as de,x as ue}from"./vendor-radix-DNp60FuA.js";import{r as c}from"./vendor-react-DL0tRKZA.js";import{p as q}from"./index-DyYtMrmN.js";function fe(e,o){return c.useReducer((r,n)=>o[r][n]??r,e)}var U="ScrollArea",[$,De]=ae(U),[he,v]=$(U),G=c.forwardRef((e,o)=>{const{__scopeScrollArea:r,type:n="hover",dir:t,scrollHideDelay:l=600,...a}=e,[s,i]=c.useState(null),[u,d]=c.useState(null),[b,f]=c.useState(null),[S,m]=c.useState(null),[A,Y]=c.useState(null),[x,_]=c.useState(0),[M,D]=c.useState(0),[j,T]=c.useState(!1),[N,W]=c.useState(!1),p=y(o,E=>i(E)),w=ie(t);return h.jsx(he,{scope:r,type:n,dir:w,scrollHideDelay:l,scrollArea:s,viewport:u,onViewportChange:d,content:b,onContentChange:f,scrollbarX:S,onScrollbarXChange:m,scrollbarXEnabled:j,onScrollbarXEnabledChange:T,scrollbarY:A,onScrollbarYChange:Y,scrollbarYEnabled:N,onScrollbarYEnabledChange:W,onCornerWidthChange:_,onCornerHeightChange:D,children:h.jsx(L.div,{dir:w,...a,ref:p,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":M+"px",...e.style}})})});G.displayName=U;var J="ScrollAreaViewport",K=c.forwardRef((e,o)=>{const{__scopeScrollArea:r,children:n,asChild:t,nonce:l,...a}=e,s=v(J,r),i=c.useRef(null),u=y(o,i,s.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:`
[data-radix-scroll-area-viewport] {
scrollbar-width: none;
-ms-overflow-style: none;
-webkit-overflow-scrolling: touch;
}
[data-radix-scroll-area-viewport]::-webkit-scrollbar {
display: none;
}
:where([data-radix-scroll-area-viewport]) {
display: flex;
flex-direction: column;
align-items: stretch;
}
:where([data-radix-scroll-area-content]) {
flex-grow: 1;
}
`},nonce:l}),h.jsx(L.div,{"data-radix-scroll-area-viewport":"",...a,asChild:t,ref:u,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:Ce({asChild:t,children:n},d=>h.jsx("div",{"data-radix-scroll-area-content":"",ref:s.onContentChange,style:{minWidth:s.scrollbarXEnabled?"fit-content":void 0},children:d}))})]})});K.displayName=J;var g="ScrollAreaScrollbar",V=c.forwardRef((e,o)=>{const{forceMount:r,...n}=e,t=v(g,e.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:a}=t,s=e.orientation==="horizontal";return c.useEffect(()=>(s?l(!0):a(!0),()=>{s?l(!1):a(!1)}),[s,l,a]),t.type==="hover"?h.jsx(be,{...n,ref:o,forceMount:r}):t.type==="scroll"?h.jsx(Se,{...n,ref:o,forceMount:r}):t.type==="auto"?h.jsx(Q,{...n,ref:o,forceMount:r}):t.type==="always"?h.jsx(B,{...n,ref:o}):null});V.displayName=g;var be=c.forwardRef((e,o)=>{const{forceMount:r,...n}=e,t=v(g,e.__scopeScrollArea),[l,a]=c.useState(!1);return c.useEffect(()=>{const s=t.scrollArea;let i=0;if(s){const u=()=>{window.clearTimeout(i),a(!0)},d=()=>{i=window.setTimeout(()=>a(!1),t.scrollHideDelay)};return s.addEventListener("pointerenter",u),s.addEventListener("pointerleave",d),()=>{window.clearTimeout(i),s.removeEventListener("pointerenter",u),s.removeEventListener("pointerleave",d)}}},[t.scrollArea,t.scrollHideDelay]),h.jsx(O,{present:r||l,children:h.jsx(Q,{"data-state":l?"visible":"hidden",...n,ref:o})})}),Se=c.forwardRef((e,o)=>{const{forceMount:r,...n}=e,t=v(g,e.__scopeScrollArea),l=e.orientation==="horizontal",a=X(()=>i("SCROLL_END"),100),[s,i]=fe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return c.useEffect(()=>{if(s==="idle"){const u=window.setTimeout(()=>i("HIDE"),t.scrollHideDelay);return()=>window.clearTimeout(u)}},[s,t.scrollHideDelay,i]),c.useEffect(()=>{const u=t.viewport,d=l?"scrollLeft":"scrollTop";if(u){let b=u[d];const f=()=>{const S=u[d];b!==S&&(i("SCROLL"),a()),b=S};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[t.viewport,l,i,a]),h.jsx(O,{present:r||s!=="hidden",children:h.jsx(B,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:o,onPointerEnter:C(e.onPointerEnter,()=>i("POINTER_ENTER")),onPointerLeave:C(e.onPointerLeave,()=>i("POINTER_LEAVE"))})})}),Q=c.forwardRef((e,o)=>{const r=v(g,e.__scopeScrollArea),{forceMount:n,...t}=e,[l,a]=c.useState(!1),s=e.orientation==="horizontal",i=X(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?u:d)}},10);return R(r.viewport,i),R(r.content,i),h.jsx(O,{present:n||l,children:h.jsx(B,{"data-state":l?"visible":"hidden",...t,ref:o})})}),B=c.forwardRef((e,o)=>{const{orientation:r="vertical",...n}=e,t=v(g,e.__scopeScrollArea),l=c.useRef(null),a=c.useRef(0),[s,i]=c.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=te(s.viewport,s.content),d={...n,sizes:s,onSizesChange:i,hasThumb:u>0&&u<1,onThumbChange:f=>l.current=f,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:f=>a.current=f};function b(f,S){return xe(f,a.current,s,S)}return r==="horizontal"?h.jsx(pe,{...d,ref:o,onThumbPositionChange:()=>{if(t.viewport&&l.current){const f=t.viewport.scrollLeft,S=F(f,s,t.dir);l.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollLeft=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollLeft=b(f,t.dir))}}):r==="vertical"?h.jsx(me,{...d,ref:o,onThumbPositionChange:()=>{if(t.viewport&&l.current){const f=t.viewport.scrollTop,S=F(f,s);l.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollTop=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollTop=b(f))}}):null}),pe=c.forwardRef((e,o)=>{const{sizes:r,onSizesChange:n,...t}=e,l=v(g,e.__scopeScrollArea),[a,s]=c.useState(),i=c.useRef(null),u=y(o,i,l.onScrollbarXChange);return c.useEffect(()=>{i.current&&s(getComputedStyle(i.current))},[i]),h.jsx(ee,{"data-orientation":"horizontal",...t,ref:u,sizes:r,style:{bottom:0,left:l.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:l.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":I(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,b)=>{if(l.viewport){const f=l.viewport.scrollLeft+d.deltaX;e.onWheelScroll(f),le(f,b)&&d.preventDefault()}},onResize:()=>{i.current&&l.viewport&&a&&n({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:z(a.paddingLeft),paddingEnd:z(a.paddingRight)}})}})}),me=c.forwardRef((e,o)=>{const{sizes:r,onSizesChange:n,...t}=e,l=v(g,e.__scopeScrollArea),[a,s]=c.useState(),i=c.useRef(null),u=y(o,i,l.onScrollbarYChange);return c.useEffect(()=>{i.current&&s(getComputedStyle(i.current))},[i]),h.jsx(ee,{"data-orientation":"vertical",...t,ref:u,sizes:r,style:{top:0,right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":I(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,b)=>{if(l.viewport){const f=l.viewport.scrollTop+d.deltaY;e.onWheelScroll(f),le(f,b)&&d.preventDefault()}},onResize:()=>{i.current&&l.viewport&&a&&n({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:z(a.paddingTop),paddingEnd:z(a.paddingBottom)}})}})}),[ve,Z]=$(g),ee=c.forwardRef((e,o)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:t,onThumbChange:l,onThumbPointerUp:a,onThumbPointerDown:s,onThumbPositionChange:i,onDragScroll:u,onWheelScroll:d,onResize:b,...f}=e,S=v(g,r),[m,A]=c.useState(null),Y=y(o,p=>A(p)),x=c.useRef(null),_=c.useRef(""),M=S.viewport,D=n.content-n.viewport,j=P(d),T=P(i),N=X(b,10);function W(p){if(x.current){const w=p.clientX-x.current.left,E=p.clientY-x.current.top;u({x:w,y:E})}}return c.useEffect(()=>{const p=w=>{const E=w.target;(m==null?void 0:m.contains(E))&&j(w,D)};return document.addEventListener("wheel",p,{passive:!1}),()=>document.removeEventListener("wheel",p,{passive:!1})},[M,m,D,j]),c.useEffect(T,[n,T]),R(m,N),R(S.content,N),h.jsx(ve,{scope:r,scrollbar:m,hasThumb:t,onThumbChange:P(l),onThumbPointerUp:P(a),onThumbPositionChange:T,onThumbPointerDown:P(s),children:h.jsx(L.div,{...f,ref:Y,style:{position:"absolute",...f.style},onPointerDown:C(e.onPointerDown,p=>{p.button===0&&(p.target.setPointerCapture(p.pointerId),x.current=m.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),W(p))}),onPointerMove:C(e.onPointerMove,W),onPointerUp:C(e.onPointerUp,p=>{const w=p.target;w.hasPointerCapture(p.pointerId)&&w.releasePointerCapture(p.pointerId),document.body.style.webkitUserSelect=_.current,S.viewport&&(S.viewport.style.scrollBehavior=""),x.current=null})})})}),H="ScrollAreaThumb",re=c.forwardRef((e,o)=>{const{forceMount:r,...n}=e,t=Z(H,e.__scopeScrollArea);return h.jsx(O,{present:r||t.hasThumb,children:h.jsx(we,{ref:o,...n})})}),we=c.forwardRef((e,o)=>{const{__scopeScrollArea:r,style:n,...t}=e,l=v(H,r),a=Z(H,r),{onThumbPositionChange:s}=a,i=y(o,b=>a.onThumbChange(b)),u=c.useRef(),d=X(()=>{u.current&&(u.current(),u.current=void 0)},100);return c.useEffect(()=>{const b=l.viewport;if(b){const f=()=>{if(d(),!u.current){const S=Pe(b,s);u.current=S,s()}};return s(),b.addEventListener("scroll",f),()=>b.removeEventListener("scroll",f)}},[l.viewport,d,s]),h.jsx(L.div,{"data-state":a.hasThumb?"visible":"hidden",...t,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:C(e.onPointerDownCapture,b=>{const S=b.target.getBoundingClientRect(),m=b.clientX-S.left,A=b.clientY-S.top;a.onThumbPointerDown({x:m,y:A})}),onPointerUp:C(e.onPointerUp,a.onThumbPointerUp)})});re.displayName=H;var k="ScrollAreaCorner",oe=c.forwardRef((e,o)=>{const r=v(k,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?h.jsx(ge,{...e,ref:o}):null});oe.displayName=k;var ge=c.forwardRef((e,o)=>{const{__scopeScrollArea:r,...n}=e,t=v(k,r),[l,a]=c.useState(0),[s,i]=c.useState(0),u=!!(l&&s);return R(t.scrollbarX,()=>{var b;const d=((b=t.scrollbarX)==null?void 0:b.offsetHeight)||0;t.onCornerHeightChange(d),i(d)}),R(t.scrollbarY,()=>{var b;const d=((b=t.scrollbarY)==null?void 0:b.offsetWidth)||0;t.onCornerWidthChange(d),a(d)}),u?h.jsx(L.div,{...n,ref:o,style:{width:l,height:s,position:"absolute",right:t.dir==="ltr"?0:void 0,left:t.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function z(e){return e?parseInt(e,10):0}function te(e,o){const r=e/o;return isNaN(r)?0:r}function I(e){const o=te(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*o;return Math.max(n,18)}function xe(e,o,r,n="ltr"){const t=I(r),l=t/2,a=o||l,s=t-a,i=r.scrollbar.paddingStart+a,u=r.scrollbar.size-r.scrollbar.paddingEnd-s,d=r.content-r.viewport,b=n==="ltr"?[0,d]:[d*-1,0];return ne([i,u],b)(e)}function F(e,o,r="ltr"){const n=I(o),t=o.scrollbar.paddingStart+o.scrollbar.paddingEnd,l=o.scrollbar.size-t,a=o.content-o.viewport,s=l-n,i=r==="ltr"?[0,a]:[a*-1,0],u=ue(e,i);return ne([0,a],[0,s])(u)}function ne(e,o){return r=>{if(e[0]===e[1]||o[0]===o[1])return o[0];const n=(o[1]-o[0])/(e[1]-e[0]);return o[0]+n*(r-e[0])}}function le(e,o){return e>0&&e<o}var Pe=(e,o=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function t(){const l={left:e.scrollLeft,top:e.scrollTop},a=r.left!==l.left,s=r.top!==l.top;(a||s)&&o(),r=l,n=window.requestAnimationFrame(t)}(),()=>window.cancelAnimationFrame(n)};function X(e,o){const r=P(e),n=c.useRef(0);return c.useEffect(()=>()=>window.clearTimeout(n.current),[]),c.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,o)},[r,o])}function R(e,o){const r=P(o);de(()=>{let n=0;if(e){const t=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return t.observe(e),()=>{window.cancelAnimationFrame(n),t.unobserve(e)}}},[e,r])}function Ce(e,o){const{asChild:r,children:n}=e;if(!r)return typeof o=="function"?o(n):o;const t=c.Children.only(n);return c.cloneElement(t,{children:typeof o=="function"?o(t.props.children):o})}var ce=G,Ee=K,Re=oe;const ye=c.forwardRef(({className:e,children:o,...r},n)=>h.jsxs(ce,{ref:n,className:q("relative overflow-hidden",e),...r,children:[h.jsx(Ee,{className:"h-full w-full rounded-[inherit]",children:o}),h.jsx(se,{}),h.jsx(Re,{})]}));ye.displayName=ce.displayName;const se=c.forwardRef(({className:e,orientation:o="vertical",...r},n)=>h.jsx(V,{ref:n,orientation:o,className:q("flex touch-none select-none transition-colors",o==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",o==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:h.jsx(re,{className:"relative flex-1 rounded-full bg-border"})}));se.displayName=V.displayName;export{ye as S};