@radix-ui/react-scroll-area
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -1,2 +0,2 @@ | ||
function e(e){return e&&e.__esModule?e.default:e}function t(e,t,r){Object.defineProperty(e,t,{get:r,enumerable:!0})}var r=e(require("@babel/runtime/helpers/defineProperty")),n=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-use-layout-effect").useLayoutEffect,i=require("@radix-ui/react-use-callback-ref").useCallbackRef,l=require("@radix-ui/react-context").createContext,s=require("@radix-ui/react-compose-refs").useComposedRefs,c=require("@radix-ui/primitive").composeEventHandlers,a=require("@radix-ui/number").clamp,u=require("react"),d=u.createContext,f=u.useContext,p=u.forwardRef,h=u.useState,m=u.useRef,b=u.createElement,v=u.useMemo,S=u.useReducer,x=u.useCallback,g=u.useEffect,w=u.useImperativeHandle,y=e(require("@babel/runtime/helpers/extends")),R={};const T="function"==typeof Float32Array;function E(e,t){return 1-3*t+3*e}function A(e,t){return 3*t-6*e}function I(e){return 3*e}function z(e,t,r){return((E(t,r)*e+A(t,r))*e+I(t))*e}function k(e,t,r){return 3*E(t,r)*e*e+2*A(t,r)*e+I(t)}function P(e){return e}function L(e,t,r,n){if(!(0<=e&&e<=1&&0<=r&&r<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&r===n)return P;const o=T?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)o[t]=z(.1*t,e,r);function i(t){let n=0,i=1;for(;10!==i&&o[i]<=t;++i)n+=.1;--i;const l=n+.1*((t-o[i])/(o[i+1]-o[i])),s=k(l,e,r);return s>=.001?function(e,t,r,n){for(let o=0;o<4;++o){const o=k(t,r,n);if(0===o)return t;t-=(z(t,r,n)-e)/o}return t}(t,l,e,r):0===s?l:function(e,t,r,n,o){let i,l,s=0;do{l=t+(r-t)/2,i=z(l,n,o)-e,i>0?r=l:t=l}while(Math.abs(i)>1e-7&&++s<10);return l}(t,n,n+.1,e,r)}return function(e){return 0===e||1===e?e:z(i(e),t,n)}}var X,Y;(Y=X||(X={}))[Y.Idle=0]="Idle",Y[Y.Stopped=1]="Stopped",Y[Y.Queuing=2]="Queuing",Y[Y.Pending=3]="Pending",Y[Y.Resolved=4]="Resolved",Y[Y.Error=5]="Error";class V{constructor(){r(this,"queue",[]),r(this,"_state",X.Idle)}restart(){this.state===X.Stopped&&(this._state=X.Idle)}rejectItem(e,t){this.stateIs(X.Pending,X.Queuing)&&(this._state=this.isEmpty()?X.Error:X.Queuing,e(t),this.dequeue())}resolveItem(e,t){this.stateIs(X.Pending,X.Queuing)&&(this._state=this.isEmpty()?X.Resolved:X.Queuing,e(t),this.dequeue())}get isBusy(){return this.state===X.Queuing||this.state===X.Pending}enqueue(e){return this.restart(),new Promise(((t,r)=>{this.queue.push({promise:e,resolve:t,reject:r}),this.dequeue()}))}dequeue(){if(this.stateIs(X.Error,X.Resolved,X.Idle,X.Queuing)){if(this.isEmpty())return;const e=this.queue.shift();try{this._state=X.Pending,e.promise().then((t=>{this.resolveItem(e.resolve,t)})).catch((t=>{this.rejectItem(e.reject,t)}))}catch(t){this.rejectItem(e.reject,t)}}}get state(){return this._state}stateIs(...e){return e.includes(this.state)}isEmpty(){return this.queue.length<=0}stop(){this.stateIs(X.Pending,X.Queuing)&&(this._state=X.Stopped,this.queue=[])}}let C=!1,B=0;function H(e){"touch"===e.pointerType&&(C=!0,setTimeout((function(){C=!1}),50))}function O(){if("undefined"!=typeof document)return document.addEventListener("pointerup",H),B++,function(){B--,B>0||document.removeEventListener("pointerup",H)}}function q(e={}){const{onHoverStart:t,onHoverChange:r,onHoverEnd:n,isDisabled:o}=e,[i,l]=h(!1),s=m({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;g(O,[]);return{hoverProps:v((function(){return{onPointerEnter:function(e){C&&"mouse"===e.pointerType||function(e,n){if(o||"touch"===n||s.isHovered)return;s.isHovered=!0;const i=e.target;t&&t({type:"hoverstart",target:i,pointerType:n}),r&&r(!0),l(!0)}(e,e.pointerType)},onPointerLeave:function(e){!function(e,t){if(o||"touch"===t||!s.isHovered)return;s.isHovered=!1;const i=e.target;n&&n({type:"hoverend",target:i,pointerType:t}),r&&r(!1),l(!1)}(e,e.pointerType)}}}),[o,s,t,r,n]),isHovered:i}}const M=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return{...e,[t]:st(t)}}),{});var W,_,N,F;exports.SCROLL_AREA_CSS_PROPS=M,(_=W||(W={})).Idle="Idle",_.Thumbing="Thumbing",_.Tracking="Tracking",_.ButtonScrolling="ButtonScrolling",(F=N||(N={}))[F.DeriveStateFromProps=0]="DeriveStateFromProps",F[F.HandleScrollAreaResize=1]="HandleScrollAreaResize",F[F.HandleViewportResize=2]="HandleViewportResize",F[F.HandleScrollbarResize=3]="HandleScrollbarResize",F[F.HandleTrackResize=4]="HandleTrackResize",F[F.SetContentOverflowing=5]="SetContentOverflowing",F[F.SetExplicitResize=6]="SetExplicitResize",F[F.StartTracking=7]="StartTracking",F[F.StopTracking=8]="StopTracking",F[F.StartThumbing=9]="StartThumbing",F[F.StopThumbing=10]="StopThumbing",F[F.StartButtonPress=11]="StartButtonPress",F[F.StopButtonPress=12]="StopButtonPress",F[F.SetScrollbarIsVisible=13]="SetScrollbarIsVisible";const Q={overflowX:"auto",overflowY:"auto",scrollbarVisibility:"hover",scrollbarVisibilityRestTimeout:600,dir:"ltr",trackClickBehavior:"relative",unstable_prefersReducedMotion:!1},[D,j]=l("ScrollArea"),[$,U]=l("ScrollArea"),Z=d({});function G(){return f(Z)}Z.displayName="ScrollAreaStateContext";const J=d(!0),K=()=>f(J),[ee,te]=l("ScrollArea"),re=p((function(e,t){const{unstable_forceNative:r=!1,...n}={...Q,...e},[i,l]=h(!0);o((()=>{l(r||!("ResizeObserver"in window&&function(){var e,t;if(!Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document))return!1;let r=!1;try{document.querySelector("::-webkit-scrollbar"),r=!0}catch(e){}return!!(null!==(e=window.CSS)&&void 0!==e&&null!==(t=e.supports)&&void 0!==t&&t.call(e,"scrollbar-width: none")||r)}()))}),[r]);const s=i?oe:se,c=m(null),a=m(null);return function(e,t,r){w(e,(()=>{const e=t.current,n=r.current||e,o={scrollIntent:function(...e){n.scroll.call(n,...e)},scrollByIntent:function(...e){n.scrollBy.call(n,...e)},scrollIntoViewIntent:function(...e){n.scrollIntoView.call(n,...e)},scrollToIntent:function(...e){n.scrollTo.call(n,...e)},get scrollTopIntent(){return n.scrollTop},set scrollTopIntent(e){n.scrollTop=e},get scrollLeftIntent(){return n.scrollLeft},set scrollLeftIntent(e){n.scrollLeft=e},get scrollHeightIntent(){return n.scrollHeight},get scrollWidthIntent(){return n.scrollWidth},addScrollListener:function(...e){n.addEventListener("scroll",...e)},removeScrollListener:function(...e){n.removeEventListener("scroll",...e)}};return Object.assign(e,o)}))}(t,a,c),b(J.Provider,{value:i},b(s,y({positionRef:c,scrollAreaRef:a},n,{ref:t})))}));exports.ScrollArea=re;const ne=p((function(e,t){const r={...Q,...e},n=m(null),o=m(null);return b(J.Provider,{value:!1},b(se,y({positionRef:n,scrollAreaRef:o},r,{ref:t})))})),oe=p((function(e,t){const{overflowX:r,overflowY:o,scrollbarVisibility:i,scrollbarVisibilityRestTimeout:l,trackClickBehavior:c,unstable_prefersReducedMotion:a,scrollAreaRef:u,positionRef:d,...f}={...Q,...e},p=s(u,t);return b(n,y({},f,{ref:p,style:{...f.style,overflowX:r,overflowY:o,resize:"none"}}))})),ie={width:0,height:0},le={state:W.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:ie,viewport:ie,position:ie,scrollbarY:ie,scrollbarX:ie,trackY:ie,trackX:ie}},se=p((function(e,t){const{onScroll:r,overflowX:o,overflowY:l,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:u,trackClickBehavior:d,unstable_prefersReducedMotion:f,positionRef:p,scrollAreaRef:x,...w}={...Q,...e},R=i(r),T=m(null),E=m(null),A=m(null),I=m(null),z=m(null),k=m(null),P=m(null),L=m(null),X=m(null),Y=m(null),V=m(null),C=v((()=>({buttonDownRef:T,buttonLeftRef:E,buttonRightRef:A,buttonUpRef:I,viewportRef:z,positionRef:p,scrollAreaRef:x,scrollbarXRef:k,scrollbarYRef:P,thumbXRef:L,thumbYRef:X,trackXRef:Y,trackYRef:V})),[]),B=function(e){const[t,r]=h(!1);return g((()=>{var t;function n(e){r(!e.matches)}const o=((null===(t=e.current)||void 0===t?void 0:t.ownerDocument.defaultView)||window).matchMedia("(prefers-reduced-motion: no-preference)");return o.addEventListener("change",n),()=>{o.removeEventListener("change",n)}}),[e]),t}(x),H=null!=f?f:B,[O,W]=S(Xe,{...le,scrollbarIsVisibleX:"always"===a,scrollbarIsVisibleY:"always"===a}),{hoverProps:{onPointerEnter:_,onPointerLeave:F},isHovered:j}=q(),U=s(t,x);Ye(x,((e,t)=>{const r=getComputedStyle(t);W({type:N.HandleScrollAreaResize,scrollAreaComputedStyle:r,width:e.inlineSize,height:e.blockSize})}));const G="always"===a&&("scroll"===o||"auto"===o&&O.contentIsOverflowingX),J="always"===a&&("scroll"===l||"auto"===l&&O.contentIsOverflowingY),{domSizes:K}=O,te={[M.scrollbarXOffset]:G&&K.scrollbarX.height?K.scrollbarX.height+"px":0,[M.scrollbarYOffset]:J&&K.scrollbarY.width?K.scrollbarY.width+"px":0,[M.positionWidth]:K.position.width?K.position.width+"px":"auto",[M.positionHeight]:K.position.height?K.position.height+"px":"auto"};return b(ee,{dispatch:W},b(D,C,b($,{dir:e.dir,isHovered:j,onScroll:R,overflowX:o,overflowY:l,prefersReducedMotion:H,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:u,trackClickBehavior:d},b(Z.Provider,{value:O},b(n,y({},w,{ref:U,style:{...w.style,...te},onPointerEnter:c(e.onPointerEnter,_),onPointerLeave:c(e.onPointerLeave,F)}))))))})),ce=p((function(e,t){const{positionRef:r,thumbXRef:i,thumbYRef:l,trackXRef:a,trackYRef:u,viewportRef:d}=j("ScrollAreaViewport"),{onScroll:f,overflowX:p,overflowY:h,scrollbarVisibility:v}=U("ScrollAreaViewport"),S=G(),{dispatch:g}=te("ScrollAreaViewport"),w=s(t,d);Ye(d,(e=>{g({type:N.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));const R=x((function(){const e=r.current,t=i.current,n=l.current,o=a.current,s=u.current;t&&o&&e&&dt({thumbElement:t,trackElement:o,axis:"x",positionElement:e}),n&&s&&e&&dt({thumbElement:n,trackElement:s,axis:"y",positionElement:e})}),[r,i,l,a,u]),T=m(0),E=m(0);const A=c(f,(function(){r.current&&(R(),function(){if(!r.current)return;const e=r.current.scrollTop,t=r.current.scrollLeft,n=e!==T.current,o=t!==E.current;n===S.scrollbarIsVisibleY&&o===S.scrollbarIsVisibleX||g({type:N.SetScrollbarIsVisible,scrollbarVisibility:v,x:o,y:n}),T.current=e<=0?0:e,E.current=t<=0?0:t}())}));return o((()=>{R()}),[R]),o((function(){const e=r.current;if(!e)return;const t=at(e,{axis:"x"}),n=at(e,{axis:"y"});t===S.contentIsOverflowingX&&n===S.contentIsOverflowingY||g({type:N.SetContentOverflowing,x:t,y:n})}),[S.contentIsOverflowingX,S.contentIsOverflowingY,g,r,S.domSizes.position.height,S.domSizes.position.width,S.domSizes.viewport.height,S.domSizes.viewport.width]),b("div",{"data-radix-scroll-area-viewport-position":"",ref:r,onScroll:A,style:{zIndex:1,width:`var(${M.positionWidth})`,height:`var(${M.positionHeight})`,scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:p,overflowY:h}},b("div",{"data-radix-scroll-area-viewport-position-inner":"",style:{display:"table",width:"100%",paddingBottom:`var(${M.scrollbarXOffset})`,paddingRight:`var(${M.scrollbarYOffset})`}},b(n,y({},e,{ref:w}))))})),ae=p((function(e,t){return K()?b(n,y({},e,{ref:t})):b(ce,y({},e,{ref:t}))}));exports.ScrollAreaViewport=ae,ae.displayName="ScrollAreaViewport";const[ue,de]=l("ScrollAreaScrollbar"),fe=p((function(e,t){var r;const{axis:o,name:i,onWheel:l,onPointerDown:a,onPointerUp:u,onPointerMove:d,...f}=e,{dispatch:p}=te(i),{scrollbarVisibility:h,scrollbarVisibilityRestTimeout:v,isHovered:S}=U(i),{["x"===o?"contentIsOverflowingX":"contentIsOverflowingY"]:x,["x"===o?"scrollbarIsVisibleX":"scrollbarIsVisibleY"]:w}=G(),R=j(i),{positionRef:T}=R,E=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(o,R),A=s(E,t),I=function(e){const t=m();t.current||(t.current={v:e()});return t.current.v}((()=>new V));Ye(E,(e=>{p({type:N.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:o})}));const z=c(l,(function(e){const t=Math.abs(e.deltaX),r=Math.abs(e.deltaY);T.current&&(t>0&&t>r&&(T.current.scrollLeft+=e.deltaX),r>0&&r>t&&(T.current.scrollTop+=e.deltaY))})),k=m();function P(){clearTimeout(k.current),k.current=setTimeout((()=>{p({type:N.SetScrollbarIsVisible,scrollbarVisibility:h,[o]:!1})}),v)}g((()=>{if(w)return k.current=setTimeout((()=>{p({type:N.SetScrollbarIsVisible,scrollbarVisibility:h,[o]:!1})}),v),function(){clearTimeout(k.current)}}),[o,p,w,h,v]);const L=m(!1),X=c(a,(e=>{L.current=!0,clearTimeout(k.current)})),Y=c(u,(e=>{L.current=!1,P()})),C=c(d,(e=>{L.current||P()})),B=function(){var e,t;const r=(null===(e=f.style)||void 0===e?void 0:e.opacity)||1;switch(h){case"always":return null===(t=f.style)||void 0===t?void 0:t.opacity;case"scroll":return w?r:0;case"hover":return S||w?r:0}}(),H=function(){var e,t;const r=(null===(e=f.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(h){case"always":return null===(t=f.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return w?r:"none";case"hover":return S||w?r:"none"}}();return b(ue,{axis:o,scrollAnimationQueue:I},b(n,y({},f,{ref:A,style:{...f.style,display:x?null===(r=f.style)||void 0===r?void 0:r.display:"none",opacity:B,pointerEvents:H},onPointerDown:X,onPointerUp:Y,onPointerMove:C,onWheel:z})))})),pe=p((function(e,t){const{domSizes:r}=G();return K()?null:b(fe,y({},e,{ref:t,axis:"x",name:"ScrollAreaScrollbarX",style:{...e.style,[M.scrollbarXSize]:r.scrollbarX.height?r.scrollbarX.height+"px":0}}))}));exports.ScrollAreaScrollbarX=pe,pe.displayName="ScrollAreaScrollbarX";const he=p((function(e,t){const{domSizes:r}=G();return K()?null:b(fe,y({},e,{ref:t,axis:"y",name:"ScrollAreaScrollbarY",style:{...e.style,[M.scrollbarYSize]:r.scrollbarY.width?r.scrollbarY.width+"px":0}}))}));exports.ScrollAreaScrollbarY=he,he.displayName="ScrollAreaScrollbarY";const me=p((function(e,t){const{onPointerDown:r,...o}=e,{axis:l,scrollAnimationQueue:u}=de("ScrollAreaTrack"),{dispatch:d}=te("ScrollAreaTrack"),f=j("ScrollAreaTrack"),{trackClickBehavior:p,prefersReducedMotion:h}=U("ScrollAreaTrack"),{positionRef:v}=f,S=Oe(l,f),x=He(l,f),w=s(S,t),R=i(r);Ye(S,(e=>{d({type:N.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:l})}));const T=m();return g((()=>{let e=null,t=null;const r=Me(S),n=We(x),o=_e(v),i=c(R,(function(i){if(!ft(i)||i.target===n||n.contains(i.target))return;const c=function({event:e,axis:t,thumbElement:r}){const{[t]:n}=Ge(e);return n<r.getBoundingClientRect()["y"===t?"top":"left"]?"start":"end"}({event:i,axis:l,thumbElement:n});if(clearTimeout(t),"page"===p){if(d({type:N.StartTracking}),document.addEventListener("pointermove",s),document.addEventListener("pointerup",f),r.setPointerCapture(i.pointerId),h){const e=Fe({direction:c,positionElement:o,axis:l}),t=it(o,{direction:c,distance:e,axis:l});je(o,{axis:l,value:t})}else u.enqueue((()=>Ve({duration:200,timing:L(.16,0,.73,1),draw:Ce({positionElement:o,direction:c,axis:l}),rafIdRef:T})));return e=setTimeout((()=>{const t=Ge(i),n=Ne({axis:l,direction:c,pointerPosition:t,positionElement:o,trackElement:r});if(!("start"===c&&n>0||"end"===c&&n<0)){if(h){const e=it(o,{direction:c,distance:n,axis:l});je(o,{axis:l,value:e})}else{const e=Math.round(Math.abs(n)),i=a(e,[100,500]);u.enqueue((()=>Ve({duration:i,timing:e=>e,draw:Be({axis:l,direction:c,pointerPosition:t,positionElement:o,trackElement:r}),rafIdRef:T})))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}{const e=Ge(i),t=Ne({axis:l,direction:c,pointerPosition:e,positionElement:o,trackElement:r}),s=it(o,{direction:c,distance:t,axis:l});je(o,{axis:l,value:s});const a=new PointerEvent("pointerdown",i);requestAnimationFrame((()=>{n.dispatchEvent(a)}))}}));return r.addEventListener("pointerdown",i),function(){cancelAnimationFrame(T.current),clearTimeout(e),clearTimeout(t),r.removeEventListener("pointerdown",i),document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",f),d({type:N.StopTracking}),u.stop()};function s(t){"mouse"===t.pointerType&&ct(t,r)&&(clearTimeout(e),document.removeEventListener("pointermove",s),u.stop())}function f(n){r.releasePointerCapture(n.pointerId),clearTimeout(e),document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",f),u.stop(),d({type:N.StopTracking}),t=setTimeout((()=>{u.stop()}),200)}}),[l,h,p,d,R,v,u,x,S]),b(n,y({"data-axis":l},o,{ref:w}))}));exports.ScrollAreaTrack=me,me.displayName="ScrollAreaTrack";const be=p((function(e,t){const{onPointerDown:r,...l}=e,{axis:a}=de("ScrollAreaThumb"),u=j("ScrollAreaThumb"),{dispatch:d}=te("ScrollAreaThumb"),{positionRef:f}=u,p=He(a,u),v=Oe(a,u),S=s(p,t),x=G(),w=i(r),R=m(0),T=m(0),E=m({size:0,positionStart:0}),A=m({size:0,positionStart:0}),I=m(!1);o((()=>{if(!I.current)return void(I.current=!0);dt({thumbElement:We(p),trackElement:Me(v),positionElement:_e(f),axis:a})}),[p,v,f,a,...lt(x.domSizes)]);const z="x"===a?x.domSizes.trackX.width:x.domSizes.trackY.height,k=m(z);o((()=>{k.current=z})),g((()=>{const e=We(p),t=Me(v),r=_e(f),n=c(w,(function(r){if(!ft(r))return;const n=Ge(r)[a];E.current=Ze(e,{axis:a}),A.current=Ze(t,{axis:a}),T.current=n,R.current=n,e.setPointerCapture(r.pointerId),document.addEventListener("pointerup",l),document.addEventListener("pointermove",i),d({type:N.StartThumbing})}));return e.addEventListener("pointerdown",n),function(){e.removeEventListener("pointerdown",n),o()};function o(){document.removeEventListener("pointermove",i),document.removeEventListener("pointerup",l),d({type:N.StopThumbing})}function i(e){const t=Ge(e)[a],n=t-T.current,o=k.current;if(ut(r,{axis:a,delta:n})){const{positionStart:e}=A.current,{positionStart:n}=E.current,i=R.current-n,l=Math.round(t-e),s=Math.round((l-i)/o*100)/100,c=Ue(r,{axis:a});je(r,{axis:a,value:s*c}),T.current=t,d({type:N.StartThumbing})}}function l(t){e.releasePointerCapture(t.pointerId),o()}}),[a,w,d,f,u,p,v]);const[P,L]=h({});return o((()=>{const e=f.current,t=v.current;L(function(e){const{trackElement:t,positionElement:r,axis:n}=e;if(!t||!r)return{};const o=Qe(r,{axis:n}),i=$e(t,{axis:n}),l=o*i;if(!at(r,{axis:n}))return{display:"none",width:0,height:0};return{["x"===n?"width":"height"]:l}}({positionElement:e,trackElement:t,axis:a}))}),[a,f,v,...lt(x.domSizes)]),b(n,y({"data-axis":a},l,{ref:S,style:{...l.style,...P,..."x"===a?{[M.scrollbarThumbWillChange]:"left",[M.scrollbarThumbHeight]:"100%",[M.scrollbarThumbWidth]:"auto"}:{[M.scrollbarThumbWillChange]:"top",[M.scrollbarThumbHeight]:"auto",[M.scrollbarThumbWidth]:"100%"}}}))}));exports.ScrollAreaThumb=be,be.displayName="ScrollAreaThumb";const ve=p((function(e,t){const{direction:r,name:o,onPointerDown:l,...a}=e,{axis:u,scrollAnimationQueue:d}=de(o),{dispatch:f}=te(o),p=j(o),{prefersReducedMotion:h}=U(o),{positionRef:v}=p,S=function(e,t,r){switch(function(e,t){if("start"===e)return"x"===t?"left":"up";return"x"===t?"right":"down"}(e,t)){case"down":return r.buttonDownRef;case"up":return r.buttonUpRef;case"left":return r.buttonLeftRef;case"right":return r.buttonRightRef}}(r,u,p),x=s(S,t),w=m(),R=i(l);return g((()=>{const e=function(e,t){const r="end"===t?"ScrollAreaButtonEnd":"ScrollAreaButtonStart";return qe(e,`A ref for ${r} was not placed as expected. ${r} should always be used within a ScrollArea component, and it should not be rendered conditionally.`)}(S,r),t=_e(v);let n,o=null;const i=c(R,(function(i){if(!ft(i))return;e.setPointerCapture(i.pointerId),document.addEventListener("pointerup",s),document.addEventListener("pointermove",l),f({type:N.StartButtonPress});const c="start"===r?-1:1;h?Je(t,{axis:u,value:51*c}):ut(t,{axis:u,delta:c})&&d.enqueue((()=>Ve({duration:135,timing:L(.16,0,.73,1),draw:function(e){Je(t,{axis:u,value:15*e*c})},rafIdRef:w}))),n=setTimeout((()=>{if(h)o=setInterval((()=>{ut(t,{axis:u,delta:c})?Je(t,{axis:u,value:60*c}):clearInterval(o)}),135);else{const r=i.pointerId;!function n(){ut(t,{axis:u,delta:c})&&d.enqueue((()=>Ve({duration:135,timing:e=>e,draw:function(e){Je(t,{axis:u,value:e*(15*c)})},done:e.hasPointerCapture(r)?n:void 0,rafIdRef:w})))}()}clearTimeout(n)}),400)}));return e.addEventListener("pointerdown",i),function(){e.removeEventListener("pointerdown",i),document.removeEventListener("pointerup",s),document.removeEventListener("pointermove",l),clearTimeout(n),clearInterval(o),cancelAnimationFrame(w.current),f({type:N.StopButtonPress})};function l(t){"mouse"===t.pointerType&&ct(t,e)&&(clearTimeout(n),document.removeEventListener("pointermove",l))}function s(t){clearTimeout(n),clearInterval(o),e.releasePointerCapture(t.pointerId),e.removeEventListener("pointerup",s),f({type:N.StopButtonPress})}}),[u,r,h,S,f,R,d,v]),b(n,y({},a,{ref:x,"data-axis":u}))})),Se=p((function(e,t){return b(ve,y({},e,{ref:t,name:"ScrollAreaButtonStart",direction:"start"}))}));exports.ScrollAreaButtonStart=Se,Se.displayName="ScrollAreaButtonStart";const xe=p((function(e,t){return b(ve,y({},e,{ref:t,name:"ScrollAreaButtonEnd",direction:"end"}))}));exports.ScrollAreaButtonEnd=xe,xe.displayName="ScrollAreaButtonEnd";const ge=p((function(e,t){const{positionRef:r}=j("ScrollAreaCorner"),{dispatch:i}=te("ScrollAreaCorner"),{dir:l}=U("ScrollAreaCorner"),{domSizes:s}=G(),c="rtl"===l,a={[M.cornerLeft]:c?0:"unset",[M.cornerRight]:c?"unset":0,[M.cornerHeight]:s.scrollbarX.height?s.scrollbarX.height+"px":s.scrollbarY.width?s.scrollbarY.width+"px":"16px",[M.cornerWidth]:s.scrollbarY.width?s.scrollbarY.width+"px":s.scrollbarX.height?s.scrollbarX.height+"px":"16px",position:"absolute"};return o((()=>{if(r.current){const e=getComputedStyle(r.current);i({type:N.SetExplicitResize,value:e.resize})}}),[i,r]),b(n,y({},e,{ref:t,style:{...e.style,...a}}))})),we=p((function(e,t){return K()?null:b(ge,y({},e,{ref:t}))}));exports.ScrollAreaCorner=we,we.displayName="ScrollAreaCorner";const ye=re;exports.Root=ye;const Re=ae;exports.Viewport=Re;const Te=pe;exports.ScrollbarX=Te;const Ee=he;exports.ScrollbarY=Ee;const Ae=Se;exports.ButtonStart=Ae;const Ie=xe;exports.ButtonEnd=Ie;const ze=me;exports.Track=ze;const ke=be;exports.Thumb=ke;const Pe=we;exports.Corner=Pe;const Le=ne;function Xe(e,t){switch(t.type){case N.SetExplicitResize:return{...e,explicitResize:t.value};case N.HandleScrollAreaResize:{const r=t.scrollAreaComputedStyle,n=parseInt(r.borderTopWidth),o=parseInt(r.borderRightWidth),i=parseInt(r.borderBottomWidth),l=parseInt(r.borderLeftWidth),s=parseInt(r.paddingTop),c=parseInt(r.paddingRight),a=parseInt(r.paddingBottom),u=parseInt(r.paddingLeft);return{...e,domSizes:{...e.domSizes,scrollArea:{width:t.width,height:t.height},position:{width:t.width-l-o-u-c,height:t.height-n-i-s-a}}}}case N.SetContentOverflowing:return{...e,contentIsOverflowingX:t.x,contentIsOverflowingY:t.y};case N.SetScrollbarIsVisible:var r,n;return"always"===t.scrollbarVisibility?{...e,scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}:{...e,scrollbarIsVisibleX:null!==(r=t.x)&&void 0!==r?r:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(n=t.y)&&void 0!==n?n:e.scrollbarIsVisibleY};case N.HandleViewportResize:return{...e,domSizes:{...e.domSizes,viewport:{width:t.width,height:t.height}}};case N.HandleScrollbarResize:return{...e,domSizes:{...e.domSizes,["x"===t.axis?"scrollbarX":"scrollbarY"]:{height:t.height,width:t.width}}};case N.HandleTrackResize:return{...e,domSizes:{...e.domSizes,["x"===t.axis?"trackX":"trackY"]:{height:t.height,width:t.width}}};case N.StartTracking:return{...e,state:W.Tracking};case N.StopTracking:return{...e,state:W.Idle};case N.StartThumbing:return{...e,state:W.Thumbing};case N.StopThumbing:return{...e,state:W.Idle};case N.StartButtonPress:return{...e,state:W.ButtonScrolling};case N.StopButtonPress:return{...e,state:W.Idle}}return e}function Ye(e,t){const r=i(t);o((()=>{var t;const n=e.current;if(!n)return;const o=new ResizeObserver((([e])=>{const t=function(e){if("borderBoxSize"in e)return Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize;const t=e.target.getBoundingClientRect();return{inlineSize:t.width,blockSize:t.height}}(e);r(t,e.target)})),i=n.getBoundingClientRect();return r({inlineSize:i.width,blockSize:i.height},n),null===(t=o.observe)||void 0===t||t.call(o,n),function(){o.disconnect()}}),[r,e])}function Ve({duration:e,draw:t,timing:r,done:n,rafIdRef:o}){return new Promise((i=>{let l=performance.now(),s=!1;o.current=requestAnimationFrame((function c(u){l=u<l?u:l;const d=a((u-l)/e,[0,1]);t(r(d)),d<1?!s&&(o.current=requestAnimationFrame(c)):(s=!0,cancelAnimationFrame(o.current),i("done"),n&&n())}))}))}function Ce({axis:e,direction:t,positionElement:r}){let n=Fe({axis:e,direction:t,positionElement:r});return function(o){const i=n*Math.min(o,1),l=it(r,{direction:t,distance:i,axis:e});n-=i,je(r,{axis:e,value:l})}}function Be({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){let i=Ne({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o});return function(r){const o=Math.pow(10,3),l=Math.round(i*Math.min(r,1)*o)/o,s=it(n,{direction:t,distance:l,axis:e});i-=l,je(n,{axis:e,value:s})}}function He(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function Oe(e,t){return"x"===e?t.trackXRef:t.trackYRef}function qe(e,t){const{current:r}=e;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function Me(e){return qe(e,"A ref for ScrollAreaTrack was not placed as expected. ScrollAreaTrack should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function We(e){return qe(e,"A ref for ScrollAreaThumb was not placed as expected. ScrollAreaThumb should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function _e(e){return qe(e,"A ref for an internal component in ScrollAreaViewport was not placed as expected. ScrollAreaViewport should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function Ne({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){const i=De(n,{axis:e}),l=Ue(n,{axis:e}),s=$e(n,{axis:e}),{positionStart:c,size:a}=Ze(o,{axis:e}),u=Math.round(r[e]-c),d=Math.round(u/a*100)/100,f="start"===t?d*l:d*l-s;return f<i?f-i-s/2:f-i+s/2}function Fe({axis:e,direction:t,positionElement:r}){return($e(r,{axis:e})-40)*("end"===t?1:-1)}function Qe(e,{axis:t}){const r=Ue(e,{axis:t});return $e(e,{axis:t})/r}function De(e,{axis:t}){return e["x"===t?"scrollLeft":"scrollTop"]}function je(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]=r}function $e(e,{axis:t}){return e["x"===t?"clientWidth":"clientHeight"]}function Ue(e,{axis:t}){return e["x"===t?"scrollWidth":"scrollHeight"]}function Ze(e,{axis:t}){const{[t]:r,["y"===t?"top":"left"]:n,["y"===t?"bottom":"right"]:o,["y"===t?"height":"width"]:i}=e.getBoundingClientRect();return{coord:r,positionStart:n,positionEnd:o,size:i}}function Ge(e){return{x:e.clientX,y:e.clientY}}function Je(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]+=r}function Ke(e){return!(!e||0!==e.scrollTop)}function et(e){return!(!e||e.scrollLeft!==ot(e))}function tt(e){return!(!e||e.scrollTop!==nt(e))}function rt(e){return!(!e||0!==e.scrollLeft)}function nt(e){return e.scrollHeight-e.clientHeight}function ot(e){return e.scrollWidth-e.clientWidth}function it(e,{direction:t,distance:r,axis:n}){const{["x"===n?"scrollLeft":"scrollTop"]:o}=e,i=o+r,l="end"===t?function(e,t){return"x"===t?ot(e):nt(e)}(e,n):0;return"end"===t?Math.min(l,i):Math.max(l,i)}function lt(e){const t=[];for(const r of Object.keys(e)){const n=e[r];t.push(n.height,n.width)}return t}function st(e){return`--radix-scroll-area-${e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}`}function ct(e,t,r){r=r||t.getBoundingClientRect();const n=Ge(e);return n.x<r.left||n.x>r.right||n.y<r.top||n.y>r.bottom}function at(e,{axis:t}){return Qe(e,{axis:t})<1}function ut(e,{axis:t,delta:r}){return!(0===r||r<0&&("x"===t?rt:Ke)(e)||r>0&&("x"===t?et:tt)(e))}function dt(e){const{thumbElement:t,positionElement:r,axis:n}=e,o=Ue(r,{axis:n}),i=$e(r,{axis:n}),l=De(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left=100*l+"%":"y"===n&&(t.style.top=100*l+"%"))}function ft(e){return 0===e.button}exports.unstable_ScrollAreaNoNativeFallback=Le,t(R,"SCROLL_AREA_CSS_PROPS",(function(){return M})),t(R,"Corner",(function(){return Pe})),t(R,"Thumb",(function(){return ke})),t(R,"Track",(function(){return ze})),t(R,"ButtonEnd",(function(){return Ie})),t(R,"ButtonStart",(function(){return Ae})),t(R,"ScrollbarY",(function(){return Ee})),t(R,"ScrollbarX",(function(){return Te})),t(R,"Viewport",(function(){return Re})),t(R,"Root",(function(){return ye})),t(R,"unstable_ScrollAreaNoNativeFallback",(function(){return Le})),t(R,"ScrollAreaCorner",(function(){return we})),t(R,"ScrollAreaThumb",(function(){return be})),t(R,"ScrollAreaTrack",(function(){return me})),t(R,"ScrollAreaButtonEnd",(function(){return xe})),t(R,"ScrollAreaButtonStart",(function(){return Se})),t(R,"ScrollAreaScrollbarY",(function(){return he})),t(R,"ScrollAreaScrollbarX",(function(){return pe})),t(R,"ScrollAreaViewport",(function(){return ae})),t(R,"ScrollArea",(function(){return re})); | ||
var e,t,r=f(require("@babel/runtime/helpers/defineProperty")),n=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-use-layout-effect").useLayoutEffect,i=require("@radix-ui/react-use-callback-ref").useCallbackRef,s=require("@radix-ui/react-context").createContext,l=require("@radix-ui/react-compose-refs").useComposedRefs,c=require("@radix-ui/primitive").composeEventHandlers,a=require("@radix-ui/number").clamp,u=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e),d=f(require("@babel/runtime/helpers/extends"));function f(e){return e&&e.__esModule?e.default:e}const p="function"==typeof Float32Array;function h(e,t){return 1-3*t+3*e}function m(e,t){return 3*t-6*e}function b(e){return 3*e}function v(e,t,r){return((h(t,r)*e+m(t,r))*e+b(t))*e}function S(e,t,r){return 3*h(t,r)*e*e+2*m(t,r)*e+b(t)}function x(e){return e}function w(e,t,r,n){if(!(0<=e&&e<=1&&0<=r&&r<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&r===n)return x;const o=p?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)o[t]=v(.1*t,e,r);function i(t){let n=0,i=1;for(;10!==i&&o[i]<=t;++i)n+=.1;--i;const s=n+.1*((t-o[i])/(o[i+1]-o[i])),l=S(s,e,r);return l>=.001?function(e,t,r,n){for(let o=0;o<4;++o){const o=S(t,r,n);if(0===o)return t;t-=(v(t,r,n)-e)/o}return t}(t,s,e,r):0===l?s:function(e,t,r,n,o){let i,s,l=0;do{s=t+(r-t)/2,i=v(s,n,o)-e,i>0?r=s:t=s}while(Math.abs(i)>1e-7&&++l<10);return s}(t,n,n+.1,e,r)}return function(e){return 0===e||1===e?e:v(i(e),t,n)}}var g,R;(R=g||(g={}))[R.Idle=0]="Idle",R[R.Stopped=1]="Stopped",R[R.Queuing=2]="Queuing",R[R.Pending=3]="Pending",R[R.Resolved=4]="Resolved",R[R.Error=5]="Error";class y{constructor(){r(this,"queue",[]),r(this,"_state",g.Idle)}restart(){this.state===g.Stopped&&(this._state=g.Idle)}rejectItem(e,t){this.stateIs(g.Pending,g.Queuing)&&(this._state=this.isEmpty()?g.Error:g.Queuing,e(t),this.dequeue())}resolveItem(e,t){this.stateIs(g.Pending,g.Queuing)&&(this._state=this.isEmpty()?g.Resolved:g.Queuing,e(t),this.dequeue())}get isBusy(){return this.state===g.Queuing||this.state===g.Pending}enqueue(e){return this.restart(),new Promise(((t,r)=>{this.queue.push({promise:e,resolve:t,reject:r}),this.dequeue()}))}dequeue(){if(this.stateIs(g.Error,g.Resolved,g.Idle,g.Queuing)){if(this.isEmpty())return;const e=this.queue.shift();try{this._state=g.Pending,e.promise().then((t=>{this.resolveItem(e.resolve,t)})).catch((t=>{this.rejectItem(e.reject,t)}))}catch(t){this.rejectItem(e.reject,t)}}}get state(){return this._state}stateIs(...e){return e.includes(this.state)}isEmpty(){return this.queue.length<=0}stop(){this.stateIs(g.Pending,g.Queuing)&&(this._state=g.Stopped,this.queue=[])}}let E=!1,T=0;function I(e){"touch"===e.pointerType&&(E=!0,setTimeout((function(){E=!1}),50))}function A(){if("undefined"!=typeof document)return document.addEventListener("pointerup",I),T++,function(){T--,T>0||document.removeEventListener("pointerup",I)}}function z(e={}){const{onHoverStart:t,onHoverChange:r,onHoverEnd:n,isDisabled:o}=e,[i,s]=u.useState(!1),l=u.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;u.useEffect(A,[]);return{hoverProps:u.useMemo((function(){return{onPointerEnter(e){E&&"mouse"===e.pointerType||function(e,n){if(o||"touch"===n||l.isHovered)return;l.isHovered=!0;const i=e.target;t&&t({type:"hoverstart",target:i,pointerType:n}),r&&r(!0),s(!0)}(e,e.pointerType)},onPointerLeave(e){!function(e,t){if(o||"touch"===t||!l.isHovered)return;l.isHovered=!1;const i=e.target;n&&n({type:"hoverend",target:i,pointerType:t}),r&&r(!1),s(!1)}(e,e.pointerType)}}}),[o,l,t,r,n]),isHovered:i}}const k=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return{...e,[t]:Ze(t)}}),{});var P,L,X,Y;exports.SCROLL_AREA_CSS_PROPS=k,(L=P||(P={})).Idle="Idle",L.Thumbing="Thumbing",L.Tracking="Tracking",L.ButtonScrolling="ButtonScrolling",(Y=X||(X={}))[Y.DeriveStateFromProps=0]="DeriveStateFromProps",Y[Y.HandleScrollAreaResize=1]="HandleScrollAreaResize",Y[Y.HandleViewportResize=2]="HandleViewportResize",Y[Y.HandleScrollbarResize=3]="HandleScrollbarResize",Y[Y.HandleTrackResize=4]="HandleTrackResize",Y[Y.SetContentOverflowing=5]="SetContentOverflowing",Y[Y.SetExplicitResize=6]="SetExplicitResize",Y[Y.StartTracking=7]="StartTracking",Y[Y.StopTracking=8]="StopTracking",Y[Y.StartThumbing=9]="StartThumbing",Y[Y.StopThumbing=10]="StopThumbing",Y[Y.StartButtonPress=11]="StartButtonPress",Y[Y.StopButtonPress=12]="StopButtonPress",Y[Y.SetScrollbarIsVisible=13]="SetScrollbarIsVisible";const V={overflowX:"auto",overflowY:"auto",scrollbarVisibility:"hover",scrollbarVisibilityRestTimeout:600,dir:"ltr",trackClickBehavior:"relative",unstable_prefersReducedMotion:!1},[C,H]=s("ScrollArea"),[B,O]=s("ScrollArea"),M=u.createContext({});function q(){return u.useContext(M)}M.displayName="ScrollAreaStateContext";const W=u.createContext(!0),_=()=>u.useContext(W),[N,Q]=s("ScrollArea"),D=u.forwardRef((function(e,t){const{unstable_forceNative:r=!1,...n}={...V,...e},[i,s]=u.useState(!0);o((()=>{s(r||!("ResizeObserver"in window&&function(){var e,t;if(!Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document))return!1;let r=!1;try{document.querySelector("::-webkit-scrollbar"),r=!0}catch(e){}return!!(null!==(e=window.CSS)&&void 0!==e&&null!==(t=e.supports)&&void 0!==t&&t.call(e,"scrollbar-width: none")||r)}()))}),[r]);const l=i?j:Z,c=u.useRef(null),a=u.useRef(null);return function(e,t,r){u.useImperativeHandle(e,(()=>{const e=t.current,n=r.current||e,o={scrollIntent(...e){n.scroll.call(n,...e)},scrollByIntent(...e){n.scrollBy.call(n,...e)},scrollIntoViewIntent(...e){n.scrollIntoView.call(n,...e)},scrollToIntent(...e){n.scrollTo.call(n,...e)},get scrollTopIntent(){return n.scrollTop},set scrollTopIntent(e){n.scrollTop=e},get scrollLeftIntent(){return n.scrollLeft},set scrollLeftIntent(e){n.scrollLeft=e},get scrollHeightIntent(){return n.scrollHeight},get scrollWidthIntent(){return n.scrollWidth},addScrollListener(...e){n.addEventListener("scroll",...e)},removeScrollListener(...e){n.removeEventListener("scroll",...e)}};return Object.assign(e,o)}))}(t,a,c),u.createElement(W.Provider,{value:i},u.createElement(l,d({positionRef:c,scrollAreaRef:a},n,{ref:t})))}));exports.ScrollArea=D;const F=u.forwardRef((function(e,t){const r={...V,...e},n=u.useRef(null),o=u.useRef(null);return u.createElement(W.Provider,{value:!1},u.createElement(Z,d({positionRef:n,scrollAreaRef:o},r,{ref:t})))})),j=u.forwardRef((function(e,t){const{overflowX:r,overflowY:o,scrollbarVisibility:i,scrollbarVisibilityRestTimeout:s,trackClickBehavior:c,unstable_prefersReducedMotion:a,scrollAreaRef:f,positionRef:p,...h}={...V,...e},m=l(f,t);return u.createElement(n,d({},h,{ref:m,style:{...h.style,overflowX:r,overflowY:o,resize:"none"}}))})),$={width:0,height:0},U={state:P.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:$,viewport:$,position:$,scrollbarY:$,scrollbarX:$,trackY:$,trackX:$}},Z=u.forwardRef((function(e,t){const{onScroll:r,overflowX:o,overflowY:s,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:f,trackClickBehavior:p,unstable_prefersReducedMotion:h,positionRef:m,scrollAreaRef:b,...v}={...V,...e},S=i(r),x=u.useRef(null),w=u.useRef(null),g=u.useRef(null),R=u.useRef(null),y=u.useRef(null),E=u.useRef(null),T=u.useRef(null),I=u.useRef(null),A=u.useRef(null),P=u.useRef(null),L=u.useRef(null),Y=u.useMemo((()=>({buttonDownRef:x,buttonLeftRef:w,buttonRightRef:g,buttonUpRef:R,viewportRef:y,positionRef:m,scrollAreaRef:b,scrollbarXRef:E,scrollbarYRef:T,thumbXRef:I,thumbYRef:A,trackXRef:P,trackYRef:L})),[]),H=function(e){const[t,r]=u.useState(!1);return u.useEffect((()=>{var t;function n(e){r(!e.matches)}const o=((null===(t=e.current)||void 0===t?void 0:t.ownerDocument.defaultView)||window).matchMedia("(prefers-reduced-motion: no-preference)");return o.addEventListener("change",n),()=>{o.removeEventListener("change",n)}}),[e]),t}(b),O=null!=h?h:H,[q,W]=u.useReducer(ge,{...U,scrollbarIsVisibleX:"always"===a,scrollbarIsVisibleY:"always"===a}),{hoverProps:{onPointerEnter:_,onPointerLeave:Q},isHovered:D}=z(),F=l(t,b);Re(b,((e,t)=>{const r=getComputedStyle(t);W({type:X.HandleScrollAreaResize,scrollAreaComputedStyle:r,width:e.inlineSize,height:e.blockSize})}));const j="always"===a&&("scroll"===o||"auto"===o&&q.contentIsOverflowingX),$="always"===a&&("scroll"===s||"auto"===s&&q.contentIsOverflowingY),{domSizes:Z}=q,G={[k.scrollbarXOffset]:j&&Z.scrollbarX.height?Z.scrollbarX.height+"px":0,[k.scrollbarYOffset]:$&&Z.scrollbarY.width?Z.scrollbarY.width+"px":0,[k.positionWidth]:Z.position.width?Z.position.width+"px":"auto",[k.positionHeight]:Z.position.height?Z.position.height+"px":"auto"};return u.createElement(N,{dispatch:W},u.createElement(C,Y,u.createElement(B,{dir:e.dir,isHovered:D,onScroll:S,overflowX:o,overflowY:s,prefersReducedMotion:O,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:f,trackClickBehavior:p},u.createElement(M.Provider,{value:q},u.createElement(n,d({},v,{ref:F,style:{...v.style,...G},onPointerEnter:c(e.onPointerEnter,_),onPointerLeave:c(e.onPointerLeave,Q)}))))))})),G=u.forwardRef((function(e,t){const{positionRef:r,thumbXRef:i,thumbYRef:s,trackXRef:a,trackYRef:f,viewportRef:p}=H("ScrollAreaViewport"),{onScroll:h,overflowX:m,overflowY:b,scrollbarVisibility:v}=O("ScrollAreaViewport"),S=q(),{dispatch:x}=Q("ScrollAreaViewport"),w=l(t,p);Re(p,(e=>{x({type:X.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));const g=u.useCallback((function(){const e=r.current,t=i.current,n=s.current,o=a.current,l=f.current;t&&o&&e&&et({thumbElement:t,trackElement:o,axis:"x",positionElement:e}),n&&l&&e&&et({thumbElement:n,trackElement:l,axis:"y",positionElement:e})}),[r,i,s,a,f]),R=u.useRef(0),y=u.useRef(0);const E=c(h,(function(){r.current&&(g(),function(){if(!r.current)return;const e=r.current.scrollTop,t=r.current.scrollLeft,n=e!==R.current,o=t!==y.current;n===S.scrollbarIsVisibleY&&o===S.scrollbarIsVisibleX||x({type:X.SetScrollbarIsVisible,scrollbarVisibility:v,x:o,y:n}),R.current=e<=0?0:e,y.current=t<=0?0:t}())}));return o((()=>{g()}),[g]),o((function(){const e=r.current;if(!e)return;const t=Je(e,{axis:"x"}),n=Je(e,{axis:"y"});t===S.contentIsOverflowingX&&n===S.contentIsOverflowingY||x({type:X.SetContentOverflowing,x:t,y:n})}),[S.contentIsOverflowingX,S.contentIsOverflowingY,x,r,S.domSizes.position.height,S.domSizes.position.width,S.domSizes.viewport.height,S.domSizes.viewport.width]),u.createElement("div",{"data-radix-scroll-area-viewport-position":"",ref:r,onScroll:E,style:{zIndex:1,width:`var(${k.positionWidth})`,height:`var(${k.positionHeight})`,scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:m,overflowY:b}},u.createElement("div",{"data-radix-scroll-area-viewport-position-inner":"",style:{display:"table",width:"100%",paddingBottom:`var(${k.scrollbarXOffset})`,paddingRight:`var(${k.scrollbarYOffset})`}},u.createElement(n,d({},e,{ref:w}))))})),J=u.forwardRef((function(e,t){return _()?u.createElement(n,d({},e,{ref:t})):u.createElement(G,d({},e,{ref:t}))}));exports.ScrollAreaViewport=J,J.displayName="ScrollAreaViewport";const[K,ee]=s("ScrollAreaScrollbar"),te=u.forwardRef((function(e,t){var r;const{axis:o,name:i,onWheel:s,onPointerDown:a,onPointerUp:f,onPointerMove:p,...h}=e,{dispatch:m}=Q(i),{scrollbarVisibility:b,scrollbarVisibilityRestTimeout:v,isHovered:S}=O(i),{["x"===o?"contentIsOverflowingX":"contentIsOverflowingY"]:x,["x"===o?"scrollbarIsVisibleX":"scrollbarIsVisibleY"]:w}=q(),g=H(i),{positionRef:R}=g,E=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(o,g),T=l(E,t),I=function(e){const t=u.useRef();t.current||(t.current={v:e()});return t.current.v}((()=>new y));Re(E,(e=>{m({type:X.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:o})}));const A=c(s,(function(e){const t=Math.abs(e.deltaX),r=Math.abs(e.deltaY);R.current&&(t>0&&t>r&&(R.current.scrollLeft+=e.deltaX),r>0&&r>t&&(R.current.scrollTop+=e.deltaY))})),z=u.useRef();function k(){clearTimeout(z.current),z.current=setTimeout((()=>{m({type:X.SetScrollbarIsVisible,scrollbarVisibility:b,[o]:!1})}),v)}u.useEffect((()=>{if(w)return z.current=setTimeout((()=>{m({type:X.SetScrollbarIsVisible,scrollbarVisibility:b,[o]:!1})}),v),function(){clearTimeout(z.current)}}),[o,m,w,b,v]);const P=u.useRef(!1),L=c(a,(e=>{P.current=!0,clearTimeout(z.current)})),Y=c(f,(e=>{P.current=!1,k()})),V=c(p,(e=>{P.current||k()})),C=function(){var e,t;const r=(null===(e=h.style)||void 0===e?void 0:e.opacity)||1;switch(b){case"always":return null===(t=h.style)||void 0===t?void 0:t.opacity;case"scroll":return w?r:0;case"hover":return S||w?r:0}}(),B=function(){var e,t;const r=(null===(e=h.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(b){case"always":return null===(t=h.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return w?r:"none";case"hover":return S||w?r:"none"}}();return u.createElement(K,{axis:o,scrollAnimationQueue:I},u.createElement(n,d({},h,{ref:T,style:{...h.style,display:x?null===(r=h.style)||void 0===r?void 0:r.display:"none",opacity:C,pointerEvents:B},onPointerDown:L,onPointerUp:Y,onPointerMove:V,onWheel:A})))})),re=u.forwardRef((function(e,t){const{domSizes:r}=q();return _()?null:u.createElement(te,d({},e,{ref:t,axis:"x",name:"ScrollAreaScrollbarX",style:{...e.style,[k.scrollbarXSize]:r.scrollbarX.height?r.scrollbarX.height+"px":0}}))}));exports.ScrollAreaScrollbarX=re,re.displayName="ScrollAreaScrollbarX";const ne=u.forwardRef((function(e,t){const{domSizes:r}=q();return _()?null:u.createElement(te,d({},e,{ref:t,axis:"y",name:"ScrollAreaScrollbarY",style:{...e.style,[k.scrollbarYSize]:r.scrollbarY.width?r.scrollbarY.width+"px":0}}))}));exports.ScrollAreaScrollbarY=ne,ne.displayName="ScrollAreaScrollbarY";const oe=u.forwardRef((function(e,t){const{onPointerDown:r,...o}=e,{axis:s,scrollAnimationQueue:f}=ee("ScrollAreaTrack"),{dispatch:p}=Q("ScrollAreaTrack"),h=H("ScrollAreaTrack"),{trackClickBehavior:m,prefersReducedMotion:b}=O("ScrollAreaTrack"),{positionRef:v}=h,S=Ae(s,h),x=Ie(s,h),g=l(S,t),R=i(r);Re(S,(e=>{p({type:X.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:s})}));const y=u.useRef();return u.useEffect((()=>{let e=null,t=null;const r=ke(S),n=Pe(x),o=Le(v),i=c(R,(function(i){if(!tt(i)||i.target===n||n.contains(i.target))return;const c=function({event:e,axis:t,thumbElement:r}){const{[t]:n}=qe(e);return n<r.getBoundingClientRect()["y"===t?"top":"left"]?"start":"end"}({event:i,axis:s,thumbElement:n});if(clearTimeout(t),"page"===m){if(p({type:X.StartTracking}),document.addEventListener("pointermove",l),document.addEventListener("pointerup",u),r.setPointerCapture(i.pointerId),b){const e=Ye({direction:c,positionElement:o,axis:s}),t=$e(o,{direction:c,distance:e,axis:s});He(o,{axis:s,value:t})}else f.enqueue((()=>ye({duration:200,timing:w(.16,0,.73,1),draw:Ee({positionElement:o,direction:c,axis:s}),rafIdRef:y})));return e=setTimeout((()=>{const t=qe(i),n=Xe({axis:s,direction:c,pointerPosition:t,positionElement:o,trackElement:r});if(!("start"===c&&n>0||"end"===c&&n<0)){if(b){const e=$e(o,{direction:c,distance:n,axis:s});He(o,{axis:s,value:e})}else{const e=Math.round(Math.abs(n)),i=a(e,[100,500]);f.enqueue((()=>ye({duration:i,timing:e=>e,draw:Te({axis:s,direction:c,pointerPosition:t,positionElement:o,trackElement:r}),rafIdRef:y})))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}{const e=qe(i),t=Xe({axis:s,direction:c,pointerPosition:e,positionElement:o,trackElement:r}),l=$e(o,{direction:c,distance:t,axis:s});He(o,{axis:s,value:l});const a=new PointerEvent("pointerdown",i);requestAnimationFrame((()=>{n.dispatchEvent(a)}))}}));return r.addEventListener("pointerdown",i),function(){cancelAnimationFrame(y.current),clearTimeout(e),clearTimeout(t),r.removeEventListener("pointerdown",i),document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",u),p({type:X.StopTracking}),f.stop()};function l(t){"mouse"===t.pointerType&&Ge(t,r)&&(clearTimeout(e),document.removeEventListener("pointermove",l),f.stop())}function u(n){r.releasePointerCapture(n.pointerId),clearTimeout(e),document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",u),f.stop(),p({type:X.StopTracking}),t=setTimeout((()=>{f.stop()}),200)}}),[s,b,m,p,R,v,f,x,S]),u.createElement(n,d({"data-axis":s},o,{ref:g}))}));exports.ScrollAreaTrack=oe,oe.displayName="ScrollAreaTrack";const ie=u.forwardRef((function(e,t){const{onPointerDown:r,...s}=e,{axis:a}=ee("ScrollAreaThumb"),f=H("ScrollAreaThumb"),{dispatch:p}=Q("ScrollAreaThumb"),{positionRef:h}=f,m=Ie(a,f),b=Ae(a,f),v=l(m,t),S=q(),x=i(r),w=u.useRef(0),g=u.useRef(0),R=u.useRef({size:0,positionStart:0}),y=u.useRef({size:0,positionStart:0}),E=u.useRef(!1);o((()=>{if(!E.current)return void(E.current=!0);et({thumbElement:Pe(m),trackElement:ke(b),positionElement:Le(h),axis:a})}),[m,b,h,a,...Ue(S.domSizes)]);const T="x"===a?S.domSizes.trackX.width:S.domSizes.trackY.height,I=u.useRef(T);o((()=>{I.current=T})),u.useEffect((()=>{const e=Pe(m),t=ke(b),r=Le(h),n=c(x,(function(r){if(!tt(r))return;const n=qe(r)[a];R.current=Me(e,{axis:a}),y.current=Me(t,{axis:a}),g.current=n,w.current=n,e.setPointerCapture(r.pointerId),document.addEventListener("pointerup",s),document.addEventListener("pointermove",i),p({type:X.StartThumbing})}));return e.addEventListener("pointerdown",n),function(){e.removeEventListener("pointerdown",n),o()};function o(){document.removeEventListener("pointermove",i),document.removeEventListener("pointerup",s),p({type:X.StopThumbing})}function i(e){const t=qe(e)[a],n=t-g.current,o=I.current;if(Ke(r,{axis:a,delta:n})){const{positionStart:e}=y.current,{positionStart:n}=R.current,i=w.current-n,s=Math.round(t-e),l=Math.round((s-i)/o*100)/100,c=Oe(r,{axis:a});He(r,{axis:a,value:l*c}),g.current=t,p({type:X.StartThumbing})}}function s(t){e.releasePointerCapture(t.pointerId),o()}}),[a,x,p,h,f,m,b]);const[A,z]=u.useState({});return o((()=>{const e=h.current,t=b.current;z(function(e){const{trackElement:t,positionElement:r,axis:n}=e;if(!t||!r)return{};const o=Ve(r,{axis:n}),i=Be(t,{axis:n}),s=o*i;if(!Je(r,{axis:n}))return{display:"none",width:0,height:0};return{["x"===n?"width":"height"]:s}}({positionElement:e,trackElement:t,axis:a}))}),[a,h,b,...Ue(S.domSizes)]),u.createElement(n,d({"data-axis":a},s,{ref:v,style:{...s.style,...A,..."x"===a?{[k.scrollbarThumbWillChange]:"left",[k.scrollbarThumbHeight]:"100%",[k.scrollbarThumbWidth]:"auto"}:{[k.scrollbarThumbWillChange]:"top",[k.scrollbarThumbHeight]:"auto",[k.scrollbarThumbWidth]:"100%"}}}))}));exports.ScrollAreaThumb=ie,ie.displayName="ScrollAreaThumb";const se=u.forwardRef((function(e,t){const{direction:r,name:o,onPointerDown:s,...a}=e,{axis:f,scrollAnimationQueue:p}=ee(o),{dispatch:h}=Q(o),m=H(o),{prefersReducedMotion:b}=O(o),{positionRef:v}=m,S=function(e,t,r){switch(function(e,t){if("start"===e)return"x"===t?"left":"up";return"x"===t?"right":"down"}(e,t)){case"down":return r.buttonDownRef;case"up":return r.buttonUpRef;case"left":return r.buttonLeftRef;case"right":return r.buttonRightRef}}(r,f,m),x=l(S,t),g=u.useRef(),R=i(s);return u.useEffect((()=>{const e=function(e,t){const r="end"===t?"ScrollAreaButtonEnd":"ScrollAreaButtonStart";return ze(e,`A ref for ${r} was not placed as expected. ${r} should always be used within a ScrollArea component, and it should not be rendered conditionally.`)}(S,r),t=Le(v);let n,o=null;const i=c(R,(function(i){if(!tt(i))return;e.setPointerCapture(i.pointerId),document.addEventListener("pointerup",l),document.addEventListener("pointermove",s),h({type:X.StartButtonPress});const c="start"===r?-1:1;b?We(t,{axis:f,value:51*c}):Ke(t,{axis:f,delta:c})&&p.enqueue((()=>ye({duration:135,timing:w(.16,0,.73,1),draw(e){We(t,{axis:f,value:15*e*c})},rafIdRef:g}))),n=setTimeout((()=>{if(b)o=setInterval((()=>{Ke(t,{axis:f,delta:c})?We(t,{axis:f,value:60*c}):clearInterval(o)}),135);else{const r=i.pointerId;!function n(){Ke(t,{axis:f,delta:c})&&p.enqueue((()=>ye({duration:135,timing:e=>e,draw(e){We(t,{axis:f,value:e*(15*c)})},done:e.hasPointerCapture(r)?n:void 0,rafIdRef:g})))}()}clearTimeout(n)}),400)}));return e.addEventListener("pointerdown",i),function(){e.removeEventListener("pointerdown",i),document.removeEventListener("pointerup",l),document.removeEventListener("pointermove",s),clearTimeout(n),clearInterval(o),cancelAnimationFrame(g.current),h({type:X.StopButtonPress})};function s(t){"mouse"===t.pointerType&&Ge(t,e)&&(clearTimeout(n),document.removeEventListener("pointermove",s))}function l(t){clearTimeout(n),clearInterval(o),e.releasePointerCapture(t.pointerId),e.removeEventListener("pointerup",l),h({type:X.StopButtonPress})}}),[f,r,b,S,h,R,p,v]),u.createElement(n,d({},a,{ref:x,"data-axis":f}))})),le=u.forwardRef((function(e,t){return u.createElement(se,d({},e,{ref:t,name:"ScrollAreaButtonStart",direction:"start"}))}));exports.ScrollAreaButtonStart=le,le.displayName="ScrollAreaButtonStart";const ce=u.forwardRef((function(e,t){return u.createElement(se,d({},e,{ref:t,name:"ScrollAreaButtonEnd",direction:"end"}))}));exports.ScrollAreaButtonEnd=ce,ce.displayName="ScrollAreaButtonEnd";const ae=u.forwardRef((function(e,t){const{positionRef:r}=H("ScrollAreaCorner"),{dispatch:i}=Q("ScrollAreaCorner"),{dir:s}=O("ScrollAreaCorner"),{domSizes:l}=q(),c="rtl"===s,a={[k.cornerLeft]:c?0:"unset",[k.cornerRight]:c?"unset":0,[k.cornerHeight]:l.scrollbarX.height?l.scrollbarX.height+"px":l.scrollbarY.width?l.scrollbarY.width+"px":"16px",[k.cornerWidth]:l.scrollbarY.width?l.scrollbarY.width+"px":l.scrollbarX.height?l.scrollbarX.height+"px":"16px",position:"absolute"};return o((()=>{if(r.current){const e=getComputedStyle(r.current);i({type:X.SetExplicitResize,value:e.resize})}}),[i,r]),u.createElement(n,d({},e,{ref:t,style:{...e.style,...a}}))})),ue=u.forwardRef((function(e,t){return _()?null:u.createElement(ae,d({},e,{ref:t}))}));exports.ScrollAreaCorner=ue,ue.displayName="ScrollAreaCorner";const de=D;exports.Root=de;const fe=J;exports.Viewport=fe;const pe=re;exports.ScrollbarX=pe;const he=ne;exports.ScrollbarY=he;const me=le;exports.ButtonStart=me;const be=ce;exports.ButtonEnd=be;const ve=oe;exports.Track=ve;const Se=ie;exports.Thumb=Se;const xe=ue;exports.Corner=xe;const we=F;function ge(e,t){switch(t.type){case X.SetExplicitResize:return{...e,explicitResize:t.value};case X.HandleScrollAreaResize:{const r=t.scrollAreaComputedStyle,n=parseInt(r.borderTopWidth),o=parseInt(r.borderRightWidth),i=parseInt(r.borderBottomWidth),s=parseInt(r.borderLeftWidth),l=parseInt(r.paddingTop),c=parseInt(r.paddingRight),a=parseInt(r.paddingBottom),u=parseInt(r.paddingLeft);return{...e,domSizes:{...e.domSizes,scrollArea:{width:t.width,height:t.height},position:{width:t.width-s-o-u-c,height:t.height-n-i-l-a}}}}case X.SetContentOverflowing:return{...e,contentIsOverflowingX:t.x,contentIsOverflowingY:t.y};case X.SetScrollbarIsVisible:var r,n;return"always"===t.scrollbarVisibility?{...e,scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}:{...e,scrollbarIsVisibleX:null!==(r=t.x)&&void 0!==r?r:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(n=t.y)&&void 0!==n?n:e.scrollbarIsVisibleY};case X.HandleViewportResize:return{...e,domSizes:{...e.domSizes,viewport:{width:t.width,height:t.height}}};case X.HandleScrollbarResize:return{...e,domSizes:{...e.domSizes,["x"===t.axis?"scrollbarX":"scrollbarY"]:{height:t.height,width:t.width}}};case X.HandleTrackResize:return{...e,domSizes:{...e.domSizes,["x"===t.axis?"trackX":"trackY"]:{height:t.height,width:t.width}}};case X.StartTracking:return{...e,state:P.Tracking};case X.StopTracking:return{...e,state:P.Idle};case X.StartThumbing:return{...e,state:P.Thumbing};case X.StopThumbing:return{...e,state:P.Idle};case X.StartButtonPress:return{...e,state:P.ButtonScrolling};case X.StopButtonPress:return{...e,state:P.Idle}}return e}function Re(e,t){const r=i(t);o((()=>{var t;const n=e.current;if(!n)return;const o=new ResizeObserver((([e])=>{const t=function(e){if("borderBoxSize"in e)return Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize;const t=e.target.getBoundingClientRect();return{inlineSize:t.width,blockSize:t.height}}(e);r(t,e.target)})),i=n.getBoundingClientRect();return r({inlineSize:i.width,blockSize:i.height},n),null===(t=o.observe)||void 0===t||t.call(o,n),function(){o.disconnect()}}),[r,e])}function ye({duration:e,draw:t,timing:r,done:n,rafIdRef:o}){return new Promise((i=>{let s=performance.now(),l=!1;o.current=requestAnimationFrame((function c(u){s=u<s?u:s;const d=a((u-s)/e,[0,1]);t(r(d)),d<1?!l&&(o.current=requestAnimationFrame(c)):(l=!0,cancelAnimationFrame(o.current),i("done"),n&&n())}))}))}function Ee({axis:e,direction:t,positionElement:r}){let n=Ye({axis:e,direction:t,positionElement:r});return function(o){const i=n*Math.min(o,1),s=$e(r,{direction:t,distance:i,axis:e});n-=i,He(r,{axis:e,value:s})}}function Te({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){let i=Xe({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o});return function(r){const o=Math.pow(10,3),s=Math.round(i*Math.min(r,1)*o)/o,l=$e(n,{direction:t,distance:s,axis:e});i-=s,He(n,{axis:e,value:l})}}function Ie(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function Ae(e,t){return"x"===e?t.trackXRef:t.trackYRef}function ze(e,t){const{current:r}=e;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function ke(e){return ze(e,"A ref for ScrollAreaTrack was not placed as expected. ScrollAreaTrack should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function Pe(e){return ze(e,"A ref for ScrollAreaThumb was not placed as expected. ScrollAreaThumb should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function Le(e){return ze(e,"A ref for an internal component in ScrollAreaViewport was not placed as expected. ScrollAreaViewport should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function Xe({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){const i=Ce(n,{axis:e}),s=Oe(n,{axis:e}),l=Be(n,{axis:e}),{positionStart:c,size:a}=Me(o,{axis:e}),u=Math.round(r[e]-c),d=Math.round(u/a*100)/100,f="start"===t?d*s:d*s-l;return f<i?f-i-l/2:f-i+l/2}function Ye({axis:e,direction:t,positionElement:r}){return(Be(r,{axis:e})-40)*("end"===t?1:-1)}function Ve(e,{axis:t}){const r=Oe(e,{axis:t});return Be(e,{axis:t})/r}function Ce(e,{axis:t}){return e["x"===t?"scrollLeft":"scrollTop"]}function He(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]=r}function Be(e,{axis:t}){return e["x"===t?"clientWidth":"clientHeight"]}function Oe(e,{axis:t}){return e["x"===t?"scrollWidth":"scrollHeight"]}function Me(e,{axis:t}){const{[t]:r,["y"===t?"top":"left"]:n,["y"===t?"bottom":"right"]:o,["y"===t?"height":"width"]:i}=e.getBoundingClientRect();return{coord:r,positionStart:n,positionEnd:o,size:i}}function qe(e){return{x:e.clientX,y:e.clientY}}function We(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]+=r}function _e(e){return!(!e||0!==e.scrollTop)}function Ne(e){return!(!e||e.scrollLeft!==je(e))}function Qe(e){return!(!e||e.scrollTop!==Fe(e))}function De(e){return!(!e||0!==e.scrollLeft)}function Fe(e){return e.scrollHeight-e.clientHeight}function je(e){return e.scrollWidth-e.clientWidth}function $e(e,{direction:t,distance:r,axis:n}){const{["x"===n?"scrollLeft":"scrollTop"]:o}=e,i=o+r,s="end"===t?function(e,t){return"x"===t?je(e):Fe(e)}(e,n):0;return"end"===t?Math.min(s,i):Math.max(s,i)}function Ue(e){const t=[];for(const r of Object.keys(e)){const n=e[r];t.push(n.height,n.width)}return t}function Ze(e){return`--radix-scroll-area-${e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}`}function Ge(e,t,r){r=r||t.getBoundingClientRect();const n=qe(e);return n.x<r.left||n.x>r.right||n.y<r.top||n.y>r.bottom}function Je(e,{axis:t}){return Ve(e,{axis:t})<1}function Ke(e,{axis:t,delta:r}){return!(0===r||r<0&&("x"===t?De:_e)(e)||r>0&&("x"===t?Ne:Qe)(e))}function et(e){const{thumbElement:t,positionElement:r,axis:n}=e,o=Oe(r,{axis:n}),i=Be(r,{axis:n}),s=Ce(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left=100*s+"%":"y"===n&&(t.style.top=100*s+"%"))}function tt(e){return 0===e.button}exports.unstable_ScrollAreaNoNativeFallback=we; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
function e(e,t,r){Object.defineProperty(e,t,{get:r,enumerable:!0})}import t from"@babel/runtime/helpers/esm/defineProperty";import{Primitive as r}from"@radix-ui/react-primitive";import{useLayoutEffect as n}from"@radix-ui/react-use-layout-effect";import{useCallbackRef as o}from"@radix-ui/react-use-callback-ref";import{createContext as i}from"@radix-ui/react-context";import{useComposedRefs as l}from"@radix-ui/react-compose-refs";import{composeEventHandlers as c}from"@radix-ui/primitive";import{clamp as s}from"@radix-ui/number";import{createContext as a,useContext as u,forwardRef as d,useState as p,useRef as f,createElement as S,useMemo as h,useReducer as m,useCallback as b,useEffect as v,useImperativeHandle as x}from"react";import g from"@babel/runtime/helpers/esm/extends";var R={};const A="function"==typeof Float32Array;function w(e,t){return 1-3*t+3*e}function y(e,t){return 3*t-6*e}function E(e){return 3*e}function T(e,t,r){return((w(t,r)*e+y(t,r))*e+E(t))*e}function P(e,t,r){return 3*w(t,r)*e*e+2*y(t,r)*e+E(t)}function L(e){return e}function C(e,t,r,n){if(!(0<=e&&e<=1&&0<=r&&r<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&r===n)return L;const o=A?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)o[t]=T(.1*t,e,r);function i(t){let n=0,i=1;for(;10!==i&&o[i]<=t;++i)n+=.1;--i;const l=n+.1*((t-o[i])/(o[i+1]-o[i])),c=P(l,e,r);return c>=.001?function(e,t,r,n){for(let o=0;o<4;++o){const o=P(t,r,n);if(0===o)return t;t-=(T(t,r,n)-e)/o}return t}(t,l,e,r):0===c?l:function(e,t,r,n,o){let i,l,c=0;do{l=t+(r-t)/2,i=T(l,n,o)-e,i>0?r=l:t=l}while(Math.abs(i)>1e-7&&++c<10);return l}(t,n,n+.1,e,r)}return function(e){return 0===e||1===e?e:T(i(e),t,n)}}var I,_;(_=I||(I={}))[_.Idle=0]="Idle",_[_.Stopped=1]="Stopped",_[_.Queuing=2]="Queuing",_[_.Pending=3]="Pending",_[_.Resolved=4]="Resolved",_[_.Error=5]="Error";class k{constructor(){t(this,"queue",[]),t(this,"_state",I.Idle)}restart(){this.state===I.Stopped&&(this._state=I.Idle)}rejectItem(e,t){this.stateIs(I.Pending,I.Queuing)&&(this._state=this.isEmpty()?I.Error:I.Queuing,e(t),this.dequeue())}resolveItem(e,t){this.stateIs(I.Pending,I.Queuing)&&(this._state=this.isEmpty()?I.Resolved:I.Queuing,e(t),this.dequeue())}get isBusy(){return this.state===I.Queuing||this.state===I.Pending}enqueue(e){return this.restart(),new Promise(((t,r)=>{this.queue.push({promise:e,resolve:t,reject:r}),this.dequeue()}))}dequeue(){if(this.stateIs(I.Error,I.Resolved,I.Idle,I.Queuing)){if(this.isEmpty())return;const e=this.queue.shift();try{this._state=I.Pending,e.promise().then((t=>{this.resolveItem(e.resolve,t)})).catch((t=>{this.rejectItem(e.reject,t)}))}catch(t){this.rejectItem(e.reject,t)}}}get state(){return this._state}stateIs(...e){return e.includes(this.state)}isEmpty(){return this.queue.length<=0}stop(){this.stateIs(I.Pending,I.Queuing)&&(this._state=I.Stopped,this.queue=[])}}let z=!1,O=0;function X(e){"touch"===e.pointerType&&(z=!0,setTimeout((function(){z=!1}),50))}function Y(){if("undefined"!=typeof document)return document.addEventListener("pointerup",X),O++,function(){O--,O>0||document.removeEventListener("pointerup",X)}}function V(e={}){const{onHoverStart:t,onHoverChange:r,onHoverEnd:n,isDisabled:o}=e,[i,l]=p(!1),c=f({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;v(Y,[]);return{hoverProps:h((function(){return{onPointerEnter:function(e){z&&"mouse"===e.pointerType||function(e,n){if(o||"touch"===n||c.isHovered)return;c.isHovered=!0;const i=e.target;t&&t({type:"hoverstart",target:i,pointerType:n}),r&&r(!0),l(!0)}(e,e.pointerType)},onPointerLeave:function(e){!function(e,t){if(o||"touch"===t||!c.isHovered)return;c.isHovered=!1;const i=e.target;n&&n({type:"hoverend",target:i,pointerType:t}),r&&r(!1),l(!1)}(e,e.pointerType)}}}),[o,c,t,r,n]),isHovered:i}}export const SCROLL_AREA_CSS_PROPS=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return{...e,[t]:He(t)}}),{});var B,H,M,W;(H=B||(B={})).Idle="Idle",H.Thumbing="Thumbing",H.Tracking="Tracking",H.ButtonScrolling="ButtonScrolling",(W=M||(M={}))[W.DeriveStateFromProps=0]="DeriveStateFromProps",W[W.HandleScrollAreaResize=1]="HandleScrollAreaResize",W[W.HandleViewportResize=2]="HandleViewportResize",W[W.HandleScrollbarResize=3]="HandleScrollbarResize",W[W.HandleTrackResize=4]="HandleTrackResize",W[W.SetContentOverflowing=5]="SetContentOverflowing",W[W.SetExplicitResize=6]="SetExplicitResize",W[W.StartTracking=7]="StartTracking",W[W.StopTracking=8]="StopTracking",W[W.StartThumbing=9]="StartThumbing",W[W.StopThumbing=10]="StopThumbing",W[W.StartButtonPress=11]="StartButtonPress",W[W.StopButtonPress=12]="StopButtonPress",W[W.SetScrollbarIsVisible=13]="SetScrollbarIsVisible";const q={overflowX:"auto",overflowY:"auto",scrollbarVisibility:"hover",scrollbarVisibilityRestTimeout:600,dir:"ltr",trackClickBehavior:"relative",unstable_prefersReducedMotion:!1},[N,F]=i("ScrollArea"),[Q,D]=i("ScrollArea"),j=a({});function $(){return u(j)}j.displayName="ScrollAreaStateContext";const U=a(!0),Z=()=>u(U),[G,J]=i("ScrollArea");export const ScrollArea=d((function(e,t){const{unstable_forceNative:r=!1,...o}={...q,...e},[i,l]=p(!0);n((()=>{l(r||!("ResizeObserver"in window&&function(){var e,t;if(!Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document))return!1;let r=!1;try{document.querySelector("::-webkit-scrollbar"),r=!0}catch(e){}return!!(null!==(e=window.CSS)&&void 0!==e&&null!==(t=e.supports)&&void 0!==t&&t.call(e,"scrollbar-width: none")||r)}()))}),[r]);const c=i?ee:ne,s=f(null),a=f(null);return function(e,t,r){x(e,(()=>{const e=t.current,n=r.current||e,o={scrollIntent:function(...e){n.scroll.call(n,...e)},scrollByIntent:function(...e){n.scrollBy.call(n,...e)},scrollIntoViewIntent:function(...e){n.scrollIntoView.call(n,...e)},scrollToIntent:function(...e){n.scrollTo.call(n,...e)},get scrollTopIntent(){return n.scrollTop},set scrollTopIntent(e){n.scrollTop=e},get scrollLeftIntent(){return n.scrollLeft},set scrollLeftIntent(e){n.scrollLeft=e},get scrollHeightIntent(){return n.scrollHeight},get scrollWidthIntent(){return n.scrollWidth},addScrollListener:function(...e){n.addEventListener("scroll",...e)},removeScrollListener:function(...e){n.removeEventListener("scroll",...e)}};return Object.assign(e,o)}))}(t,a,s),S(U.Provider,{value:i},S(c,g({positionRef:s,scrollAreaRef:a},o,{ref:t})))}));const K=d((function(e,t){const r={...q,...e},n=f(null),o=f(null);return S(U.Provider,{value:!1},S(ne,g({positionRef:n,scrollAreaRef:o},r,{ref:t})))})),ee=d((function(e,t){const{overflowX:n,overflowY:o,scrollbarVisibility:i,scrollbarVisibilityRestTimeout:c,trackClickBehavior:s,unstable_prefersReducedMotion:a,scrollAreaRef:u,positionRef:d,...p}={...q,...e},f=l(u,t);return S(r,g({},p,{ref:f,style:{...p.style,overflowX:n,overflowY:o,resize:"none"}}))})),te={width:0,height:0},re={state:B.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:te,viewport:te,position:te,scrollbarY:te,scrollbarX:te,trackY:te,trackX:te}},ne=d((function(e,t){const{onScroll:n,overflowX:i,overflowY:s,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:u,trackClickBehavior:d,unstable_prefersReducedMotion:b,positionRef:x,scrollAreaRef:R,...A}={...q,...e},w=o(n),y=f(null),E=f(null),T=f(null),P=f(null),L=f(null),C=f(null),I=f(null),_=f(null),k=f(null),z=f(null),O=f(null),X=h((()=>({buttonDownRef:y,buttonLeftRef:E,buttonRightRef:T,buttonUpRef:P,viewportRef:L,positionRef:x,scrollAreaRef:R,scrollbarXRef:C,scrollbarYRef:I,thumbXRef:_,thumbYRef:k,trackXRef:z,trackYRef:O})),[]),Y=function(e){const[t,r]=p(!1);return v((()=>{var t;function n(e){r(!e.matches)}const o=((null===(t=e.current)||void 0===t?void 0:t.ownerDocument.defaultView)||window).matchMedia("(prefers-reduced-motion: no-preference)");return o.addEventListener("change",n),()=>{o.removeEventListener("change",n)}}),[e]),t}(R),B=null!=b?b:Y,[H,W]=m(ue,{...re,scrollbarIsVisibleX:"always"===a,scrollbarIsVisibleY:"always"===a}),{hoverProps:{onPointerEnter:F,onPointerLeave:D},isHovered:$}=V(),U=l(t,R);de(R,((e,t)=>{const r=getComputedStyle(t);W({type:M.HandleScrollAreaResize,scrollAreaComputedStyle:r,width:e.inlineSize,height:e.blockSize})}));const Z="always"===a&&("scroll"===i||"auto"===i&&H.contentIsOverflowingX),J="always"===a&&("scroll"===s||"auto"===s&&H.contentIsOverflowingY),{domSizes:K}=H,ee={[SCROLL_AREA_CSS_PROPS.scrollbarXOffset]:Z&&K.scrollbarX.height?K.scrollbarX.height+"px":0,[SCROLL_AREA_CSS_PROPS.scrollbarYOffset]:J&&K.scrollbarY.width?K.scrollbarY.width+"px":0,[SCROLL_AREA_CSS_PROPS.positionWidth]:K.position.width?K.position.width+"px":"auto",[SCROLL_AREA_CSS_PROPS.positionHeight]:K.position.height?K.position.height+"px":"auto"};return S(G,{dispatch:W},S(N,X,S(Q,{dir:e.dir,isHovered:$,onScroll:w,overflowX:i,overflowY:s,prefersReducedMotion:B,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:u,trackClickBehavior:d},S(j.Provider,{value:H},S(r,g({},A,{ref:U,style:{...A.style,...ee},onPointerEnter:c(e.onPointerEnter,F),onPointerLeave:c(e.onPointerLeave,D)}))))))})),oe=d((function(e,t){const{positionRef:o,thumbXRef:i,thumbYRef:s,trackXRef:a,trackYRef:u,viewportRef:d}=F("ScrollAreaViewport"),{onScroll:p,overflowX:h,overflowY:m,scrollbarVisibility:v}=D("ScrollAreaViewport"),x=$(),{dispatch:R}=J("ScrollAreaViewport"),A=l(t,d);de(d,(e=>{R({type:M.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));const w=b((function(){const e=o.current,t=i.current,r=s.current,n=a.current,l=u.current;t&&n&&e&&Ne({thumbElement:t,trackElement:n,axis:"x",positionElement:e}),r&&l&&e&&Ne({thumbElement:r,trackElement:l,axis:"y",positionElement:e})}),[o,i,s,a,u]),y=f(0),E=f(0);const T=c(p,(function(){o.current&&(w(),function(){if(!o.current)return;const e=o.current.scrollTop,t=o.current.scrollLeft,r=e!==y.current,n=t!==E.current;r===x.scrollbarIsVisibleY&&n===x.scrollbarIsVisibleX||R({type:M.SetScrollbarIsVisible,scrollbarVisibility:v,x:n,y:r}),y.current=e<=0?0:e,E.current=t<=0?0:t}())}));return n((()=>{w()}),[w]),n((function(){const e=o.current;if(!e)return;const t=We(e,{axis:"x"}),r=We(e,{axis:"y"});t===x.contentIsOverflowingX&&r===x.contentIsOverflowingY||R({type:M.SetContentOverflowing,x:t,y:r})}),[x.contentIsOverflowingX,x.contentIsOverflowingY,R,o,x.domSizes.position.height,x.domSizes.position.width,x.domSizes.viewport.height,x.domSizes.viewport.width]),S("div",{"data-radix-scroll-area-viewport-position":"",ref:o,onScroll:T,style:{zIndex:1,width:`var(${SCROLL_AREA_CSS_PROPS.positionWidth})`,height:`var(${SCROLL_AREA_CSS_PROPS.positionHeight})`,scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:h,overflowY:m}},S("div",{"data-radix-scroll-area-viewport-position-inner":"",style:{display:"table",width:"100%",paddingBottom:`var(${SCROLL_AREA_CSS_PROPS.scrollbarXOffset})`,paddingRight:`var(${SCROLL_AREA_CSS_PROPS.scrollbarYOffset})`}},S(r,g({},e,{ref:A}))))}));export const ScrollAreaViewport=d((function(e,t){return Z()?S(r,g({},e,{ref:t})):S(oe,g({},e,{ref:t}))}));ScrollAreaViewport.displayName="ScrollAreaViewport";const[ie,le]=i("ScrollAreaScrollbar"),ce=d((function(e,t){var n;const{axis:o,name:i,onWheel:s,onPointerDown:a,onPointerUp:u,onPointerMove:d,...p}=e,{dispatch:h}=J(i),{scrollbarVisibility:m,scrollbarVisibilityRestTimeout:b,isHovered:x}=D(i),{["x"===o?"contentIsOverflowingX":"contentIsOverflowingY"]:R,["x"===o?"scrollbarIsVisibleX":"scrollbarIsVisibleY"]:A}=$(),w=F(i),{positionRef:y}=w,E=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(o,w),T=l(E,t),P=function(e){const t=f();t.current||(t.current={v:e()});return t.current.v}((()=>new k));de(E,(e=>{h({type:M.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:o})}));const L=c(s,(function(e){const t=Math.abs(e.deltaX),r=Math.abs(e.deltaY);y.current&&(t>0&&t>r&&(y.current.scrollLeft+=e.deltaX),r>0&&r>t&&(y.current.scrollTop+=e.deltaY))})),C=f();function I(){clearTimeout(C.current),C.current=setTimeout((()=>{h({type:M.SetScrollbarIsVisible,scrollbarVisibility:m,[o]:!1})}),b)}v((()=>{if(A)return C.current=setTimeout((()=>{h({type:M.SetScrollbarIsVisible,scrollbarVisibility:m,[o]:!1})}),b),function(){clearTimeout(C.current)}}),[o,h,A,m,b]);const _=f(!1),z=c(a,(e=>{_.current=!0,clearTimeout(C.current)})),O=c(u,(e=>{_.current=!1,I()})),X=c(d,(e=>{_.current||I()})),Y=function(){var e,t;const r=(null===(e=p.style)||void 0===e?void 0:e.opacity)||1;switch(m){case"always":return null===(t=p.style)||void 0===t?void 0:t.opacity;case"scroll":return A?r:0;case"hover":return x||A?r:0}}(),V=function(){var e,t;const r=(null===(e=p.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(m){case"always":return null===(t=p.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return A?r:"none";case"hover":return x||A?r:"none"}}();return S(ie,{axis:o,scrollAnimationQueue:P},S(r,g({},p,{ref:T,style:{...p.style,display:R?null===(n=p.style)||void 0===n?void 0:n.display:"none",opacity:Y,pointerEvents:V},onPointerDown:z,onPointerUp:O,onPointerMove:X,onWheel:L})))}));export const ScrollAreaScrollbarX=d((function(e,t){const{domSizes:r}=$();return Z()?null:S(ce,g({},e,{ref:t,axis:"x",name:"ScrollAreaScrollbarX",style:{...e.style,[SCROLL_AREA_CSS_PROPS.scrollbarXSize]:r.scrollbarX.height?r.scrollbarX.height+"px":0}}))}));ScrollAreaScrollbarX.displayName="ScrollAreaScrollbarX";export const ScrollAreaScrollbarY=d((function(e,t){const{domSizes:r}=$();return Z()?null:S(ce,g({},e,{ref:t,axis:"y",name:"ScrollAreaScrollbarY",style:{...e.style,[SCROLL_AREA_CSS_PROPS.scrollbarYSize]:r.scrollbarY.width?r.scrollbarY.width+"px":0}}))}));ScrollAreaScrollbarY.displayName="ScrollAreaScrollbarY";export const ScrollAreaTrack=d((function(e,t){const{onPointerDown:n,...i}=e,{axis:a,scrollAnimationQueue:u}=le("ScrollAreaTrack"),{dispatch:d}=J("ScrollAreaTrack"),p=F("ScrollAreaTrack"),{trackClickBehavior:h,prefersReducedMotion:m}=D("ScrollAreaTrack"),{positionRef:b}=p,x=me(a,p),R=he(a,p),A=l(x,t),w=o(n);de(x,(e=>{d({type:M.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:a})}));const y=f();return v((()=>{let e=null,t=null;const r=ve(x),n=xe(R),o=ge(b),i=c(w,(function(i){if(!Fe(i)||i.target===n||n.contains(i.target))return;const c=function({event:e,axis:t,thumbElement:r}){const{[t]:n}=Ce(e);return n<r.getBoundingClientRect()["y"===t?"top":"left"]?"start":"end"}({event:i,axis:a,thumbElement:n});if(clearTimeout(t),"page"===h){if(d({type:M.StartTracking}),document.addEventListener("pointermove",l),document.addEventListener("pointerup",p),r.setPointerCapture(i.pointerId),m){const e=Ae({direction:c,positionElement:o,axis:a}),t=Ve(o,{direction:c,distance:e,axis:a});Ee(o,{axis:a,value:t})}else u.enqueue((()=>pe({duration:200,timing:C(.16,0,.73,1),draw:fe({positionElement:o,direction:c,axis:a}),rafIdRef:y})));return e=setTimeout((()=>{const t=Ce(i),n=Re({axis:a,direction:c,pointerPosition:t,positionElement:o,trackElement:r});if(!("start"===c&&n>0||"end"===c&&n<0)){if(m){const e=Ve(o,{direction:c,distance:n,axis:a});Ee(o,{axis:a,value:e})}else{const e=Math.round(Math.abs(n)),i=s(e,[100,500]);u.enqueue((()=>pe({duration:i,timing:e=>e,draw:Se({axis:a,direction:c,pointerPosition:t,positionElement:o,trackElement:r}),rafIdRef:y})))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}{const e=Ce(i),t=Re({axis:a,direction:c,pointerPosition:e,positionElement:o,trackElement:r}),l=Ve(o,{direction:c,distance:t,axis:a});Ee(o,{axis:a,value:l});const s=new PointerEvent("pointerdown",i);requestAnimationFrame((()=>{n.dispatchEvent(s)}))}}));return r.addEventListener("pointerdown",i),function(){cancelAnimationFrame(y.current),clearTimeout(e),clearTimeout(t),r.removeEventListener("pointerdown",i),document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",p),d({type:M.StopTracking}),u.stop()};function l(t){"mouse"===t.pointerType&&Me(t,r)&&(clearTimeout(e),document.removeEventListener("pointermove",l),u.stop())}function p(n){r.releasePointerCapture(n.pointerId),clearTimeout(e),document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",p),u.stop(),d({type:M.StopTracking}),t=setTimeout((()=>{u.stop()}),200)}}),[a,m,h,d,w,b,u,R,x]),S(r,g({"data-axis":a},i,{ref:A}))}));ScrollAreaTrack.displayName="ScrollAreaTrack";export const ScrollAreaThumb=d((function(e,t){const{onPointerDown:i,...s}=e,{axis:a}=le("ScrollAreaThumb"),u=F("ScrollAreaThumb"),{dispatch:d}=J("ScrollAreaThumb"),{positionRef:h}=u,m=he(a,u),b=me(a,u),x=l(m,t),R=$(),A=o(i),w=f(0),y=f(0),E=f({size:0,positionStart:0}),T=f({size:0,positionStart:0}),P=f(!1);n((()=>{if(!P.current)return void(P.current=!0);Ne({thumbElement:xe(m),trackElement:ve(b),positionElement:ge(h),axis:a})}),[m,b,h,a,...Be(R.domSizes)]);const L="x"===a?R.domSizes.trackX.width:R.domSizes.trackY.height,C=f(L);n((()=>{C.current=L})),v((()=>{const e=xe(m),t=ve(b),r=ge(h),n=c(A,(function(r){if(!Fe(r))return;const n=Ce(r)[a];E.current=Le(e,{axis:a}),T.current=Le(t,{axis:a}),y.current=n,w.current=n,e.setPointerCapture(r.pointerId),document.addEventListener("pointerup",l),document.addEventListener("pointermove",i),d({type:M.StartThumbing})}));return e.addEventListener("pointerdown",n),function(){e.removeEventListener("pointerdown",n),o()};function o(){document.removeEventListener("pointermove",i),document.removeEventListener("pointerup",l),d({type:M.StopThumbing})}function i(e){const t=Ce(e)[a],n=t-y.current,o=C.current;if(qe(r,{axis:a,delta:n})){const{positionStart:e}=T.current,{positionStart:n}=E.current,i=w.current-n,l=Math.round(t-e),c=Math.round((l-i)/o*100)/100,s=Pe(r,{axis:a});Ee(r,{axis:a,value:c*s}),y.current=t,d({type:M.StartThumbing})}}function l(t){e.releasePointerCapture(t.pointerId),o()}}),[a,A,d,h,u,m,b]);const[I,_]=p({});return n((()=>{const e=h.current,t=b.current;_(function(e){const{trackElement:t,positionElement:r,axis:n}=e;if(!t||!r)return{};const o=we(r,{axis:n}),i=Te(t,{axis:n}),l=o*i;if(!We(r,{axis:n}))return{display:"none",width:0,height:0};return{["x"===n?"width":"height"]:l}}({positionElement:e,trackElement:t,axis:a}))}),[a,h,b,...Be(R.domSizes)]),S(r,g({"data-axis":a},s,{ref:x,style:{...s.style,...I,..."x"===a?{[SCROLL_AREA_CSS_PROPS.scrollbarThumbWillChange]:"left",[SCROLL_AREA_CSS_PROPS.scrollbarThumbHeight]:"100%",[SCROLL_AREA_CSS_PROPS.scrollbarThumbWidth]:"auto"}:{[SCROLL_AREA_CSS_PROPS.scrollbarThumbWillChange]:"top",[SCROLL_AREA_CSS_PROPS.scrollbarThumbHeight]:"auto",[SCROLL_AREA_CSS_PROPS.scrollbarThumbWidth]:"100%"}}}))}));ScrollAreaThumb.displayName="ScrollAreaThumb";const se=d((function(e,t){const{direction:n,name:i,onPointerDown:s,...a}=e,{axis:u,scrollAnimationQueue:d}=le(i),{dispatch:p}=J(i),h=F(i),{prefersReducedMotion:m}=D(i),{positionRef:b}=h,x=function(e,t,r){switch(function(e,t){if("start"===e)return"x"===t?"left":"up";return"x"===t?"right":"down"}(e,t)){case"down":return r.buttonDownRef;case"up":return r.buttonUpRef;case"left":return r.buttonLeftRef;case"right":return r.buttonRightRef}}(n,u,h),R=l(x,t),A=f(),w=o(s);return v((()=>{const e=function(e,t){const r="end"===t?"ScrollAreaButtonEnd":"ScrollAreaButtonStart";return be(e,`A ref for ${r} was not placed as expected. ${r} should always be used within a ScrollArea component, and it should not be rendered conditionally.`)}(x,n),t=ge(b);let r,o=null;const i=c(w,(function(i){if(!Fe(i))return;e.setPointerCapture(i.pointerId),document.addEventListener("pointerup",s),document.addEventListener("pointermove",l),p({type:M.StartButtonPress});const c="start"===n?-1:1;m?Ie(t,{axis:u,value:51*c}):qe(t,{axis:u,delta:c})&&d.enqueue((()=>pe({duration:135,timing:C(.16,0,.73,1),draw:function(e){Ie(t,{axis:u,value:15*e*c})},rafIdRef:A}))),r=setTimeout((()=>{if(m)o=setInterval((()=>{qe(t,{axis:u,delta:c})?Ie(t,{axis:u,value:60*c}):clearInterval(o)}),135);else{const r=i.pointerId;!function n(){qe(t,{axis:u,delta:c})&&d.enqueue((()=>pe({duration:135,timing:e=>e,draw:function(e){Ie(t,{axis:u,value:e*(15*c)})},done:e.hasPointerCapture(r)?n:void 0,rafIdRef:A})))}()}clearTimeout(r)}),400)}));return e.addEventListener("pointerdown",i),function(){e.removeEventListener("pointerdown",i),document.removeEventListener("pointerup",s),document.removeEventListener("pointermove",l),clearTimeout(r),clearInterval(o),cancelAnimationFrame(A.current),p({type:M.StopButtonPress})};function l(t){"mouse"===t.pointerType&&Me(t,e)&&(clearTimeout(r),document.removeEventListener("pointermove",l))}function s(t){clearTimeout(r),clearInterval(o),e.releasePointerCapture(t.pointerId),e.removeEventListener("pointerup",s),p({type:M.StopButtonPress})}}),[u,n,m,x,p,w,d,b]),S(r,g({},a,{ref:R,"data-axis":u}))}));export const ScrollAreaButtonStart=d((function(e,t){return S(se,g({},e,{ref:t,name:"ScrollAreaButtonStart",direction:"start"}))}));ScrollAreaButtonStart.displayName="ScrollAreaButtonStart";export const ScrollAreaButtonEnd=d((function(e,t){return S(se,g({},e,{ref:t,name:"ScrollAreaButtonEnd",direction:"end"}))}));ScrollAreaButtonEnd.displayName="ScrollAreaButtonEnd";const ae=d((function(e,t){const{positionRef:o}=F("ScrollAreaCorner"),{dispatch:i}=J("ScrollAreaCorner"),{dir:l}=D("ScrollAreaCorner"),{domSizes:c}=$(),s="rtl"===l,a={[SCROLL_AREA_CSS_PROPS.cornerLeft]:s?0:"unset",[SCROLL_AREA_CSS_PROPS.cornerRight]:s?"unset":0,[SCROLL_AREA_CSS_PROPS.cornerHeight]:c.scrollbarX.height?c.scrollbarX.height+"px":c.scrollbarY.width?c.scrollbarY.width+"px":"16px",[SCROLL_AREA_CSS_PROPS.cornerWidth]:c.scrollbarY.width?c.scrollbarY.width+"px":c.scrollbarX.height?c.scrollbarX.height+"px":"16px",position:"absolute"};return n((()=>{if(o.current){const e=getComputedStyle(o.current);i({type:M.SetExplicitResize,value:e.resize})}}),[i,o]),S(r,g({},e,{ref:t,style:{...e.style,...a}}))}));export const ScrollAreaCorner=d((function(e,t){return Z()?null:S(ae,g({},e,{ref:t}))}));ScrollAreaCorner.displayName="ScrollAreaCorner";export const Root=ScrollArea;export const Viewport=ScrollAreaViewport;export const ScrollbarX=ScrollAreaScrollbarX;export const ScrollbarY=ScrollAreaScrollbarY;export const ButtonStart=ScrollAreaButtonStart;export const ButtonEnd=ScrollAreaButtonEnd;export const Track=ScrollAreaTrack;export const Thumb=ScrollAreaThumb;export const Corner=ScrollAreaCorner;export const unstable_ScrollAreaNoNativeFallback=K;function ue(e,t){switch(t.type){case M.SetExplicitResize:return{...e,explicitResize:t.value};case M.HandleScrollAreaResize:{const r=t.scrollAreaComputedStyle,n=parseInt(r.borderTopWidth),o=parseInt(r.borderRightWidth),i=parseInt(r.borderBottomWidth),l=parseInt(r.borderLeftWidth),c=parseInt(r.paddingTop),s=parseInt(r.paddingRight),a=parseInt(r.paddingBottom),u=parseInt(r.paddingLeft);return{...e,domSizes:{...e.domSizes,scrollArea:{width:t.width,height:t.height},position:{width:t.width-l-o-u-s,height:t.height-n-i-c-a}}}}case M.SetContentOverflowing:return{...e,contentIsOverflowingX:t.x,contentIsOverflowingY:t.y};case M.SetScrollbarIsVisible:var r,n;return"always"===t.scrollbarVisibility?{...e,scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}:{...e,scrollbarIsVisibleX:null!==(r=t.x)&&void 0!==r?r:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(n=t.y)&&void 0!==n?n:e.scrollbarIsVisibleY};case M.HandleViewportResize:return{...e,domSizes:{...e.domSizes,viewport:{width:t.width,height:t.height}}};case M.HandleScrollbarResize:return{...e,domSizes:{...e.domSizes,["x"===t.axis?"scrollbarX":"scrollbarY"]:{height:t.height,width:t.width}}};case M.HandleTrackResize:return{...e,domSizes:{...e.domSizes,["x"===t.axis?"trackX":"trackY"]:{height:t.height,width:t.width}}};case M.StartTracking:return{...e,state:B.Tracking};case M.StopTracking:return{...e,state:B.Idle};case M.StartThumbing:return{...e,state:B.Thumbing};case M.StopThumbing:return{...e,state:B.Idle};case M.StartButtonPress:return{...e,state:B.ButtonScrolling};case M.StopButtonPress:return{...e,state:B.Idle}}return e}function de(e,t){const r=o(t);n((()=>{var t;const n=e.current;if(!n)return;const o=new ResizeObserver((([e])=>{const t=function(e){if("borderBoxSize"in e)return Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize;const t=e.target.getBoundingClientRect();return{inlineSize:t.width,blockSize:t.height}}(e);r(t,e.target)})),i=n.getBoundingClientRect();return r({inlineSize:i.width,blockSize:i.height},n),null===(t=o.observe)||void 0===t||t.call(o,n),function(){o.disconnect()}}),[r,e])}function pe({duration:e,draw:t,timing:r,done:n,rafIdRef:o}){return new Promise((i=>{let l=performance.now(),c=!1;o.current=requestAnimationFrame((function a(u){l=u<l?u:l;const d=s((u-l)/e,[0,1]);t(r(d)),d<1?!c&&(o.current=requestAnimationFrame(a)):(c=!0,cancelAnimationFrame(o.current),i("done"),n&&n())}))}))}function fe({axis:e,direction:t,positionElement:r}){let n=Ae({axis:e,direction:t,positionElement:r});return function(o){const i=n*Math.min(o,1),l=Ve(r,{direction:t,distance:i,axis:e});n-=i,Ee(r,{axis:e,value:l})}}function Se({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){let i=Re({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o});return function(r){const o=Math.pow(10,3),l=Math.round(i*Math.min(r,1)*o)/o,c=Ve(n,{direction:t,distance:l,axis:e});i-=l,Ee(n,{axis:e,value:c})}}function he(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function me(e,t){return"x"===e?t.trackXRef:t.trackYRef}function be(e,t){const{current:r}=e;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function ve(e){return be(e,"A ref for ScrollAreaTrack was not placed as expected. ScrollAreaTrack should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function xe(e){return be(e,"A ref for ScrollAreaThumb was not placed as expected. ScrollAreaThumb should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function ge(e){return be(e,"A ref for an internal component in ScrollAreaViewport was not placed as expected. ScrollAreaViewport should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function Re({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){const i=ye(n,{axis:e}),l=Pe(n,{axis:e}),c=Te(n,{axis:e}),{positionStart:s,size:a}=Le(o,{axis:e}),u=Math.round(r[e]-s),d=Math.round(u/a*100)/100,p="start"===t?d*l:d*l-c;return p<i?p-i-c/2:p-i+c/2}function Ae({axis:e,direction:t,positionElement:r}){return(Te(r,{axis:e})-40)*("end"===t?1:-1)}function we(e,{axis:t}){const r=Pe(e,{axis:t});return Te(e,{axis:t})/r}function ye(e,{axis:t}){return e["x"===t?"scrollLeft":"scrollTop"]}function Ee(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]=r}function Te(e,{axis:t}){return e["x"===t?"clientWidth":"clientHeight"]}function Pe(e,{axis:t}){return e["x"===t?"scrollWidth":"scrollHeight"]}function Le(e,{axis:t}){const{[t]:r,["y"===t?"top":"left"]:n,["y"===t?"bottom":"right"]:o,["y"===t?"height":"width"]:i}=e.getBoundingClientRect();return{coord:r,positionStart:n,positionEnd:o,size:i}}function Ce(e){return{x:e.clientX,y:e.clientY}}function Ie(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]+=r}function _e(e){return!(!e||0!==e.scrollTop)}function ke(e){return!(!e||e.scrollLeft!==Ye(e))}function ze(e){return!(!e||e.scrollTop!==Xe(e))}function Oe(e){return!(!e||0!==e.scrollLeft)}function Xe(e){return e.scrollHeight-e.clientHeight}function Ye(e){return e.scrollWidth-e.clientWidth}function Ve(e,{direction:t,distance:r,axis:n}){const{["x"===n?"scrollLeft":"scrollTop"]:o}=e,i=o+r,l="end"===t?function(e,t){return"x"===t?Ye(e):Xe(e)}(e,n):0;return"end"===t?Math.min(l,i):Math.max(l,i)}function Be(e){const t=[];for(const r of Object.keys(e)){const n=e[r];t.push(n.height,n.width)}return t}function He(e){return`--radix-scroll-area-${e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}`}function Me(e,t,r){r=r||t.getBoundingClientRect();const n=Ce(e);return n.x<r.left||n.x>r.right||n.y<r.top||n.y>r.bottom}function We(e,{axis:t}){return we(e,{axis:t})<1}function qe(e,{axis:t,delta:r}){return!(0===r||r<0&&("x"===t?Oe:_e)(e)||r>0&&("x"===t?ke:ze)(e))}function Ne(e){const{thumbElement:t,positionElement:r,axis:n}=e,o=Pe(r,{axis:n}),i=Te(r,{axis:n}),l=ye(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left=100*l+"%":"y"===n&&(t.style.top=100*l+"%"))}function Fe(e){return 0===e.button}e(R,"SCROLL_AREA_CSS_PROPS",(function(){return SCROLL_AREA_CSS_PROPS})),e(R,"Corner",(function(){return Corner})),e(R,"Thumb",(function(){return Thumb})),e(R,"Track",(function(){return Track})),e(R,"ButtonEnd",(function(){return ButtonEnd})),e(R,"ButtonStart",(function(){return ButtonStart})),e(R,"ScrollbarY",(function(){return ScrollbarY})),e(R,"ScrollbarX",(function(){return ScrollbarX})),e(R,"Viewport",(function(){return Viewport})),e(R,"Root",(function(){return Root})),e(R,"unstable_ScrollAreaNoNativeFallback",(function(){return unstable_ScrollAreaNoNativeFallback})),e(R,"ScrollAreaCorner",(function(){return ScrollAreaCorner})),e(R,"ScrollAreaThumb",(function(){return ScrollAreaThumb})),e(R,"ScrollAreaTrack",(function(){return ScrollAreaTrack})),e(R,"ScrollAreaButtonEnd",(function(){return ScrollAreaButtonEnd})),e(R,"ScrollAreaButtonStart",(function(){return ScrollAreaButtonStart})),e(R,"ScrollAreaScrollbarY",(function(){return ScrollAreaScrollbarY})),e(R,"ScrollAreaScrollbarX",(function(){return ScrollAreaScrollbarX})),e(R,"ScrollAreaViewport",(function(){return ScrollAreaViewport})),e(R,"ScrollArea",(function(){return ScrollArea})); | ||
import e from"@babel/runtime/helpers/esm/defineProperty";import{Primitive as t}from"@radix-ui/react-primitive";import{useLayoutEffect as r}from"@radix-ui/react-use-layout-effect";import{useCallbackRef as n}from"@radix-ui/react-use-callback-ref";import{createContext as o}from"@radix-ui/react-context";import{useComposedRefs as i}from"@radix-ui/react-compose-refs";import{composeEventHandlers as l}from"@radix-ui/primitive";import{clamp as s}from"@radix-ui/number";import*as c from"react";import a from"@babel/runtime/helpers/esm/extends";const u="function"==typeof Float32Array;function d(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function p(e){return 3*e}function h(e,t,r){return((d(t,r)*e+f(t,r))*e+p(t))*e}function m(e,t,r){return 3*d(t,r)*e*e+2*f(t,r)*e+p(t)}function S(e){return e}function b(e,t,r,n){if(!(0<=e&&e<=1&&0<=r&&r<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&r===n)return S;const o=u?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)o[t]=h(.1*t,e,r);function i(t){let n=0,i=1;for(;10!==i&&o[i]<=t;++i)n+=.1;--i;const l=n+.1*((t-o[i])/(o[i+1]-o[i])),s=m(l,e,r);return s>=.001?function(e,t,r,n){for(let o=0;o<4;++o){const o=m(t,r,n);if(0===o)return t;t-=(h(t,r,n)-e)/o}return t}(t,l,e,r):0===s?l:function(e,t,r,n,o){let i,l,s=0;do{l=t+(r-t)/2,i=h(l,n,o)-e,i>0?r=l:t=l}while(Math.abs(i)>1e-7&&++s<10);return l}(t,n,n+.1,e,r)}return function(e){return 0===e||1===e?e:h(i(e),t,n)}}var v,R;(R=v||(v={}))[R.Idle=0]="Idle",R[R.Stopped=1]="Stopped",R[R.Queuing=2]="Queuing",R[R.Pending=3]="Pending",R[R.Resolved=4]="Resolved",R[R.Error=5]="Error";class x{constructor(){e(this,"queue",[]),e(this,"_state",v.Idle)}restart(){this.state===v.Stopped&&(this._state=v.Idle)}rejectItem(e,t){this.stateIs(v.Pending,v.Queuing)&&(this._state=this.isEmpty()?v.Error:v.Queuing,e(t),this.dequeue())}resolveItem(e,t){this.stateIs(v.Pending,v.Queuing)&&(this._state=this.isEmpty()?v.Resolved:v.Queuing,e(t),this.dequeue())}get isBusy(){return this.state===v.Queuing||this.state===v.Pending}enqueue(e){return this.restart(),new Promise(((t,r)=>{this.queue.push({promise:e,resolve:t,reject:r}),this.dequeue()}))}dequeue(){if(this.stateIs(v.Error,v.Resolved,v.Idle,v.Queuing)){if(this.isEmpty())return;const e=this.queue.shift();try{this._state=v.Pending,e.promise().then((t=>{this.resolveItem(e.resolve,t)})).catch((t=>{this.rejectItem(e.reject,t)}))}catch(t){this.rejectItem(e.reject,t)}}}get state(){return this._state}stateIs(...e){return e.includes(this.state)}isEmpty(){return this.queue.length<=0}stop(){this.stateIs(v.Pending,v.Queuing)&&(this._state=v.Stopped,this.queue=[])}}let w=!1,g=0;function E(e){"touch"===e.pointerType&&(w=!0,setTimeout((function(){w=!1}),50))}function A(){if("undefined"!=typeof document)return document.addEventListener("pointerup",E),g++,function(){g--,g>0||document.removeEventListener("pointerup",E)}}function y(e={}){const{onHoverStart:t,onHoverChange:r,onHoverEnd:n,isDisabled:o}=e,[i,l]=c.useState(!1),s=c.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;c.useEffect(A,[]);return{hoverProps:c.useMemo((function(){return{onPointerEnter(e){w&&"mouse"===e.pointerType||function(e,n){if(o||"touch"===n||s.isHovered)return;s.isHovered=!0;const i=e.target;t&&t({type:"hoverstart",target:i,pointerType:n}),r&&r(!0),l(!0)}(e,e.pointerType)},onPointerLeave(e){!function(e,t){if(o||"touch"===t||!s.isHovered)return;s.isHovered=!1;const i=e.target;n&&n({type:"hoverend",target:i,pointerType:t}),r&&r(!1),l(!1)}(e,e.pointerType)}}}),[o,s,t,r,n]),isHovered:i}}export const SCROLL_AREA_CSS_PROPS=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return{...e,[t]:Pe(t)}}),{});var T,P,L,I;(P=T||(T={})).Idle="Idle",P.Thumbing="Thumbing",P.Tracking="Tracking",P.ButtonScrolling="ButtonScrolling",(I=L||(L={}))[I.DeriveStateFromProps=0]="DeriveStateFromProps",I[I.HandleScrollAreaResize=1]="HandleScrollAreaResize",I[I.HandleViewportResize=2]="HandleViewportResize",I[I.HandleScrollbarResize=3]="HandleScrollbarResize",I[I.HandleTrackResize=4]="HandleTrackResize",I[I.SetContentOverflowing=5]="SetContentOverflowing",I[I.SetExplicitResize=6]="SetExplicitResize",I[I.StartTracking=7]="StartTracking",I[I.StopTracking=8]="StopTracking",I[I.StartThumbing=9]="StartThumbing",I[I.StopThumbing=10]="StopThumbing",I[I.StartButtonPress=11]="StartButtonPress",I[I.StopButtonPress=12]="StopButtonPress",I[I.SetScrollbarIsVisible=13]="SetScrollbarIsVisible";const C={overflowX:"auto",overflowY:"auto",scrollbarVisibility:"hover",scrollbarVisibilityRestTimeout:600,dir:"ltr",trackClickBehavior:"relative",unstable_prefersReducedMotion:!1},[z,_]=o("ScrollArea"),[k,O]=o("ScrollArea"),X=c.createContext({});function Y(){return c.useContext(X)}X.displayName="ScrollAreaStateContext";const V=c.createContext(!0),B=()=>c.useContext(V),[H,M]=o("ScrollArea");export const ScrollArea=c.forwardRef((function(e,t){const{unstable_forceNative:n=!1,...o}={...C,...e},[i,l]=c.useState(!0);r((()=>{l(n||!("ResizeObserver"in window&&function(){var e,t;if(!Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document))return!1;let r=!1;try{document.querySelector("::-webkit-scrollbar"),r=!0}catch(e){}return!!(null!==(e=window.CSS)&&void 0!==e&&null!==(t=e.supports)&&void 0!==t&&t.call(e,"scrollbar-width: none")||r)}()))}),[n]);const s=i?q:D,u=c.useRef(null),d=c.useRef(null);return function(e,t,r){c.useImperativeHandle(e,(()=>{const e=t.current,n=r.current||e,o={scrollIntent(...e){n.scroll.call(n,...e)},scrollByIntent(...e){n.scrollBy.call(n,...e)},scrollIntoViewIntent(...e){n.scrollIntoView.call(n,...e)},scrollToIntent(...e){n.scrollTo.call(n,...e)},get scrollTopIntent(){return n.scrollTop},set scrollTopIntent(e){n.scrollTop=e},get scrollLeftIntent(){return n.scrollLeft},set scrollLeftIntent(e){n.scrollLeft=e},get scrollHeightIntent(){return n.scrollHeight},get scrollWidthIntent(){return n.scrollWidth},addScrollListener(...e){n.addEventListener("scroll",...e)},removeScrollListener(...e){n.removeEventListener("scroll",...e)}};return Object.assign(e,o)}))}(t,d,u),c.createElement(V.Provider,{value:i},c.createElement(s,a({positionRef:u,scrollAreaRef:d},o,{ref:t})))}));const W=c.forwardRef((function(e,t){const r={...C,...e},n=c.useRef(null),o=c.useRef(null);return c.createElement(V.Provider,{value:!1},c.createElement(D,a({positionRef:n,scrollAreaRef:o},r,{ref:t})))})),q=c.forwardRef((function(e,r){const{overflowX:n,overflowY:o,scrollbarVisibility:l,scrollbarVisibilityRestTimeout:s,trackClickBehavior:u,unstable_prefersReducedMotion:d,scrollAreaRef:f,positionRef:p,...h}={...C,...e},m=i(f,r);return c.createElement(t,a({},h,{ref:m,style:{...h.style,overflowX:n,overflowY:o,resize:"none"}}))})),N={width:0,height:0},Q={state:T.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:N,viewport:N,position:N,scrollbarY:N,scrollbarX:N,trackY:N,trackX:N}},D=c.forwardRef((function(e,r){const{onScroll:o,overflowX:s,overflowY:u,scrollbarVisibility:d,scrollbarVisibilityRestTimeout:f,trackClickBehavior:p,unstable_prefersReducedMotion:h,positionRef:m,scrollAreaRef:S,...b}={...C,...e},v=n(o),R=c.useRef(null),x=c.useRef(null),w=c.useRef(null),g=c.useRef(null),E=c.useRef(null),A=c.useRef(null),T=c.useRef(null),P=c.useRef(null),I=c.useRef(null),_=c.useRef(null),O=c.useRef(null),Y=c.useMemo((()=>({buttonDownRef:R,buttonLeftRef:x,buttonRightRef:w,buttonUpRef:g,viewportRef:E,positionRef:m,scrollAreaRef:S,scrollbarXRef:A,scrollbarYRef:T,thumbXRef:P,thumbYRef:I,trackXRef:_,trackYRef:O})),[]),V=function(e){const[t,r]=c.useState(!1);return c.useEffect((()=>{var t;function n(e){r(!e.matches)}const o=((null===(t=e.current)||void 0===t?void 0:t.ownerDocument.defaultView)||window).matchMedia("(prefers-reduced-motion: no-preference)");return o.addEventListener("change",n),()=>{o.removeEventListener("change",n)}}),[e]),t}(S),B=null!=h?h:V,[M,W]=c.useReducer(J,{...Q,scrollbarIsVisibleX:"always"===d,scrollbarIsVisibleY:"always"===d}),{hoverProps:{onPointerEnter:q,onPointerLeave:N},isHovered:D}=y(),F=i(r,S);K(S,((e,t)=>{const r=getComputedStyle(t);W({type:L.HandleScrollAreaResize,scrollAreaComputedStyle:r,width:e.inlineSize,height:e.blockSize})}));const $="always"===d&&("scroll"===s||"auto"===s&&M.contentIsOverflowingX),j="always"===d&&("scroll"===u||"auto"===u&&M.contentIsOverflowingY),{domSizes:U}=M,Z={[SCROLL_AREA_CSS_PROPS.scrollbarXOffset]:$&&U.scrollbarX.height?U.scrollbarX.height+"px":0,[SCROLL_AREA_CSS_PROPS.scrollbarYOffset]:j&&U.scrollbarY.width?U.scrollbarY.width+"px":0,[SCROLL_AREA_CSS_PROPS.positionWidth]:U.position.width?U.position.width+"px":"auto",[SCROLL_AREA_CSS_PROPS.positionHeight]:U.position.height?U.position.height+"px":"auto"};return c.createElement(H,{dispatch:W},c.createElement(z,Y,c.createElement(k,{dir:e.dir,isHovered:D,onScroll:v,overflowX:s,overflowY:u,prefersReducedMotion:B,scrollbarVisibility:d,scrollbarVisibilityRestTimeout:f,trackClickBehavior:p},c.createElement(X.Provider,{value:M},c.createElement(t,a({},b,{ref:F,style:{...b.style,...Z},onPointerEnter:l(e.onPointerEnter,q),onPointerLeave:l(e.onPointerLeave,N)}))))))})),F=c.forwardRef((function(e,n){const{positionRef:o,thumbXRef:s,thumbYRef:u,trackXRef:d,trackYRef:f,viewportRef:p}=_("ScrollAreaViewport"),{onScroll:h,overflowX:m,overflowY:S,scrollbarVisibility:b}=O("ScrollAreaViewport"),v=Y(),{dispatch:R}=M("ScrollAreaViewport"),x=i(n,p);K(p,(e=>{R({type:L.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));const w=c.useCallback((function(){const e=o.current,t=s.current,r=u.current,n=d.current,i=f.current;t&&n&&e&&ze({thumbElement:t,trackElement:n,axis:"x",positionElement:e}),r&&i&&e&&ze({thumbElement:r,trackElement:i,axis:"y",positionElement:e})}),[o,s,u,d,f]),g=c.useRef(0),E=c.useRef(0);const A=l(h,(function(){o.current&&(w(),function(){if(!o.current)return;const e=o.current.scrollTop,t=o.current.scrollLeft,r=e!==g.current,n=t!==E.current;r===v.scrollbarIsVisibleY&&n===v.scrollbarIsVisibleX||R({type:L.SetScrollbarIsVisible,scrollbarVisibility:b,x:n,y:r}),g.current=e<=0?0:e,E.current=t<=0?0:t}())}));return r((()=>{w()}),[w]),r((function(){const e=o.current;if(!e)return;const t=Ie(e,{axis:"x"}),r=Ie(e,{axis:"y"});t===v.contentIsOverflowingX&&r===v.contentIsOverflowingY||R({type:L.SetContentOverflowing,x:t,y:r})}),[v.contentIsOverflowingX,v.contentIsOverflowingY,R,o,v.domSizes.position.height,v.domSizes.position.width,v.domSizes.viewport.height,v.domSizes.viewport.width]),c.createElement("div",{"data-radix-scroll-area-viewport-position":"",ref:o,onScroll:A,style:{zIndex:1,width:`var(${SCROLL_AREA_CSS_PROPS.positionWidth})`,height:`var(${SCROLL_AREA_CSS_PROPS.positionHeight})`,scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:m,overflowY:S}},c.createElement("div",{"data-radix-scroll-area-viewport-position-inner":"",style:{display:"table",width:"100%",paddingBottom:`var(${SCROLL_AREA_CSS_PROPS.scrollbarXOffset})`,paddingRight:`var(${SCROLL_AREA_CSS_PROPS.scrollbarYOffset})`}},c.createElement(t,a({},e,{ref:x}))))}));export const ScrollAreaViewport=c.forwardRef((function(e,r){return B()?c.createElement(t,a({},e,{ref:r})):c.createElement(F,a({},e,{ref:r}))}));ScrollAreaViewport.displayName="ScrollAreaViewport";const[$,j]=o("ScrollAreaScrollbar"),U=c.forwardRef((function(e,r){var n;const{axis:o,name:s,onWheel:u,onPointerDown:d,onPointerUp:f,onPointerMove:p,...h}=e,{dispatch:m}=M(s),{scrollbarVisibility:S,scrollbarVisibilityRestTimeout:b,isHovered:v}=O(s),{["x"===o?"contentIsOverflowingX":"contentIsOverflowingY"]:R,["x"===o?"scrollbarIsVisibleX":"scrollbarIsVisibleY"]:w}=Y(),g=_(s),{positionRef:E}=g,A=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(o,g),y=i(A,r),T=function(e){const t=c.useRef();t.current||(t.current={v:e()});return t.current.v}((()=>new x));K(A,(e=>{m({type:L.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:o})}));const P=l(u,(function(e){const t=Math.abs(e.deltaX),r=Math.abs(e.deltaY);E.current&&(t>0&&t>r&&(E.current.scrollLeft+=e.deltaX),r>0&&r>t&&(E.current.scrollTop+=e.deltaY))})),I=c.useRef();function C(){clearTimeout(I.current),I.current=setTimeout((()=>{m({type:L.SetScrollbarIsVisible,scrollbarVisibility:S,[o]:!1})}),b)}c.useEffect((()=>{if(w)return I.current=setTimeout((()=>{m({type:L.SetScrollbarIsVisible,scrollbarVisibility:S,[o]:!1})}),b),function(){clearTimeout(I.current)}}),[o,m,w,S,b]);const z=c.useRef(!1),k=l(d,(e=>{z.current=!0,clearTimeout(I.current)})),X=l(f,(e=>{z.current=!1,C()})),V=l(p,(e=>{z.current||C()})),B=function(){var e,t;const r=(null===(e=h.style)||void 0===e?void 0:e.opacity)||1;switch(S){case"always":return null===(t=h.style)||void 0===t?void 0:t.opacity;case"scroll":return w?r:0;case"hover":return v||w?r:0}}(),H=function(){var e,t;const r=(null===(e=h.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(S){case"always":return null===(t=h.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return w?r:"none";case"hover":return v||w?r:"none"}}();return c.createElement($,{axis:o,scrollAnimationQueue:T},c.createElement(t,a({},h,{ref:y,style:{...h.style,display:R?null===(n=h.style)||void 0===n?void 0:n.display:"none",opacity:B,pointerEvents:H},onPointerDown:k,onPointerUp:X,onPointerMove:V,onWheel:P})))}));export const ScrollAreaScrollbarX=c.forwardRef((function(e,t){const{domSizes:r}=Y();return B()?null:c.createElement(U,a({},e,{ref:t,axis:"x",name:"ScrollAreaScrollbarX",style:{...e.style,[SCROLL_AREA_CSS_PROPS.scrollbarXSize]:r.scrollbarX.height?r.scrollbarX.height+"px":0}}))}));ScrollAreaScrollbarX.displayName="ScrollAreaScrollbarX";export const ScrollAreaScrollbarY=c.forwardRef((function(e,t){const{domSizes:r}=Y();return B()?null:c.createElement(U,a({},e,{ref:t,axis:"y",name:"ScrollAreaScrollbarY",style:{...e.style,[SCROLL_AREA_CSS_PROPS.scrollbarYSize]:r.scrollbarY.width?r.scrollbarY.width+"px":0}}))}));ScrollAreaScrollbarY.displayName="ScrollAreaScrollbarY";export const ScrollAreaTrack=c.forwardRef((function(e,r){const{onPointerDown:o,...u}=e,{axis:d,scrollAnimationQueue:f}=j("ScrollAreaTrack"),{dispatch:p}=M("ScrollAreaTrack"),h=_("ScrollAreaTrack"),{trackClickBehavior:m,prefersReducedMotion:S}=O("ScrollAreaTrack"),{positionRef:v}=h,R=oe(d,h),x=ne(d,h),w=i(R,r),g=n(o);K(R,(e=>{p({type:L.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:d})}));const E=c.useRef();return c.useEffect((()=>{let e=null,t=null;const r=le(R),n=se(x),o=ce(v),i=l(g,(function(i){if(!_e(i)||i.target===n||n.contains(i.target))return;const l=function({event:e,axis:t,thumbElement:r}){const{[t]:n}=be(e);return n<r.getBoundingClientRect()["y"===t?"top":"left"]?"start":"end"}({event:i,axis:d,thumbElement:n});if(clearTimeout(t),"page"===m){if(p({type:L.StartTracking}),document.addEventListener("pointermove",c),document.addEventListener("pointerup",a),r.setPointerCapture(i.pointerId),S){const e=ue({direction:l,positionElement:o,axis:d}),t=ye(o,{direction:l,distance:e,axis:d});pe(o,{axis:d,value:t})}else f.enqueue((()=>ee({duration:200,timing:b(.16,0,.73,1),draw:te({positionElement:o,direction:l,axis:d}),rafIdRef:E})));return e=setTimeout((()=>{const t=be(i),n=ae({axis:d,direction:l,pointerPosition:t,positionElement:o,trackElement:r});if(!("start"===l&&n>0||"end"===l&&n<0)){if(S){const e=ye(o,{direction:l,distance:n,axis:d});pe(o,{axis:d,value:e})}else{const e=Math.round(Math.abs(n)),i=s(e,[100,500]);f.enqueue((()=>ee({duration:i,timing:e=>e,draw:re({axis:d,direction:l,pointerPosition:t,positionElement:o,trackElement:r}),rafIdRef:E})))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}{const e=be(i),t=ae({axis:d,direction:l,pointerPosition:e,positionElement:o,trackElement:r}),s=ye(o,{direction:l,distance:t,axis:d});pe(o,{axis:d,value:s});const c=new PointerEvent("pointerdown",i);requestAnimationFrame((()=>{n.dispatchEvent(c)}))}}));return r.addEventListener("pointerdown",i),function(){cancelAnimationFrame(E.current),clearTimeout(e),clearTimeout(t),r.removeEventListener("pointerdown",i),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",a),p({type:L.StopTracking}),f.stop()};function c(t){"mouse"===t.pointerType&&Le(t,r)&&(clearTimeout(e),document.removeEventListener("pointermove",c),f.stop())}function a(n){r.releasePointerCapture(n.pointerId),clearTimeout(e),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",a),f.stop(),p({type:L.StopTracking}),t=setTimeout((()=>{f.stop()}),200)}}),[d,S,m,p,g,v,f,x,R]),c.createElement(t,a({"data-axis":d},u,{ref:w}))}));ScrollAreaTrack.displayName="ScrollAreaTrack";export const ScrollAreaThumb=c.forwardRef((function(e,o){const{onPointerDown:s,...u}=e,{axis:d}=j("ScrollAreaThumb"),f=_("ScrollAreaThumb"),{dispatch:p}=M("ScrollAreaThumb"),{positionRef:h}=f,m=ne(d,f),S=oe(d,f),b=i(m,o),v=Y(),R=n(s),x=c.useRef(0),w=c.useRef(0),g=c.useRef({size:0,positionStart:0}),E=c.useRef({size:0,positionStart:0}),A=c.useRef(!1);r((()=>{if(!A.current)return void(A.current=!0);ze({thumbElement:se(m),trackElement:le(S),positionElement:ce(h),axis:d})}),[m,S,h,d,...Te(v.domSizes)]);const y="x"===d?v.domSizes.trackX.width:v.domSizes.trackY.height,T=c.useRef(y);r((()=>{T.current=y})),c.useEffect((()=>{const e=se(m),t=le(S),r=ce(h),n=l(R,(function(r){if(!_e(r))return;const n=be(r)[d];g.current=Se(e,{axis:d}),E.current=Se(t,{axis:d}),w.current=n,x.current=n,e.setPointerCapture(r.pointerId),document.addEventListener("pointerup",s),document.addEventListener("pointermove",i),p({type:L.StartThumbing})}));return e.addEventListener("pointerdown",n),function(){e.removeEventListener("pointerdown",n),o()};function o(){document.removeEventListener("pointermove",i),document.removeEventListener("pointerup",s),p({type:L.StopThumbing})}function i(e){const t=be(e)[d],n=t-w.current,o=T.current;if(Ce(r,{axis:d,delta:n})){const{positionStart:e}=E.current,{positionStart:n}=g.current,i=x.current-n,l=Math.round(t-e),s=Math.round((l-i)/o*100)/100,c=me(r,{axis:d});pe(r,{axis:d,value:s*c}),w.current=t,p({type:L.StartThumbing})}}function s(t){e.releasePointerCapture(t.pointerId),o()}}),[d,R,p,h,f,m,S]);const[P,I]=c.useState({});return r((()=>{const e=h.current,t=S.current;I(function(e){const{trackElement:t,positionElement:r,axis:n}=e;if(!t||!r)return{};const o=de(r,{axis:n}),i=he(t,{axis:n}),l=o*i;if(!Ie(r,{axis:n}))return{display:"none",width:0,height:0};return{["x"===n?"width":"height"]:l}}({positionElement:e,trackElement:t,axis:d}))}),[d,h,S,...Te(v.domSizes)]),c.createElement(t,a({"data-axis":d},u,{ref:b,style:{...u.style,...P,..."x"===d?{[SCROLL_AREA_CSS_PROPS.scrollbarThumbWillChange]:"left",[SCROLL_AREA_CSS_PROPS.scrollbarThumbHeight]:"100%",[SCROLL_AREA_CSS_PROPS.scrollbarThumbWidth]:"auto"}:{[SCROLL_AREA_CSS_PROPS.scrollbarThumbWillChange]:"top",[SCROLL_AREA_CSS_PROPS.scrollbarThumbHeight]:"auto",[SCROLL_AREA_CSS_PROPS.scrollbarThumbWidth]:"100%"}}}))}));ScrollAreaThumb.displayName="ScrollAreaThumb";const Z=c.forwardRef((function(e,r){const{direction:o,name:s,onPointerDown:u,...d}=e,{axis:f,scrollAnimationQueue:p}=j(s),{dispatch:h}=M(s),m=_(s),{prefersReducedMotion:S}=O(s),{positionRef:v}=m,R=function(e,t,r){switch(function(e,t){if("start"===e)return"x"===t?"left":"up";return"x"===t?"right":"down"}(e,t)){case"down":return r.buttonDownRef;case"up":return r.buttonUpRef;case"left":return r.buttonLeftRef;case"right":return r.buttonRightRef}}(o,f,m),x=i(R,r),w=c.useRef(),g=n(u);return c.useEffect((()=>{const e=function(e,t){const r="end"===t?"ScrollAreaButtonEnd":"ScrollAreaButtonStart";return ie(e,`A ref for ${r} was not placed as expected. ${r} should always be used within a ScrollArea component, and it should not be rendered conditionally.`)}(R,o),t=ce(v);let r,n=null;const i=l(g,(function(i){if(!_e(i))return;e.setPointerCapture(i.pointerId),document.addEventListener("pointerup",c),document.addEventListener("pointermove",s),h({type:L.StartButtonPress});const l="start"===o?-1:1;S?ve(t,{axis:f,value:51*l}):Ce(t,{axis:f,delta:l})&&p.enqueue((()=>ee({duration:135,timing:b(.16,0,.73,1),draw(e){ve(t,{axis:f,value:15*e*l})},rafIdRef:w}))),r=setTimeout((()=>{if(S)n=setInterval((()=>{Ce(t,{axis:f,delta:l})?ve(t,{axis:f,value:60*l}):clearInterval(n)}),135);else{const r=i.pointerId;!function n(){Ce(t,{axis:f,delta:l})&&p.enqueue((()=>ee({duration:135,timing:e=>e,draw(e){ve(t,{axis:f,value:e*(15*l)})},done:e.hasPointerCapture(r)?n:void 0,rafIdRef:w})))}()}clearTimeout(r)}),400)}));return e.addEventListener("pointerdown",i),function(){e.removeEventListener("pointerdown",i),document.removeEventListener("pointerup",c),document.removeEventListener("pointermove",s),clearTimeout(r),clearInterval(n),cancelAnimationFrame(w.current),h({type:L.StopButtonPress})};function s(t){"mouse"===t.pointerType&&Le(t,e)&&(clearTimeout(r),document.removeEventListener("pointermove",s))}function c(t){clearTimeout(r),clearInterval(n),e.releasePointerCapture(t.pointerId),e.removeEventListener("pointerup",c),h({type:L.StopButtonPress})}}),[f,o,S,R,h,g,p,v]),c.createElement(t,a({},d,{ref:x,"data-axis":f}))}));export const ScrollAreaButtonStart=c.forwardRef((function(e,t){return c.createElement(Z,a({},e,{ref:t,name:"ScrollAreaButtonStart",direction:"start"}))}));ScrollAreaButtonStart.displayName="ScrollAreaButtonStart";export const ScrollAreaButtonEnd=c.forwardRef((function(e,t){return c.createElement(Z,a({},e,{ref:t,name:"ScrollAreaButtonEnd",direction:"end"}))}));ScrollAreaButtonEnd.displayName="ScrollAreaButtonEnd";const G=c.forwardRef((function(e,n){const{positionRef:o}=_("ScrollAreaCorner"),{dispatch:i}=M("ScrollAreaCorner"),{dir:l}=O("ScrollAreaCorner"),{domSizes:s}=Y(),u="rtl"===l,d={[SCROLL_AREA_CSS_PROPS.cornerLeft]:u?0:"unset",[SCROLL_AREA_CSS_PROPS.cornerRight]:u?"unset":0,[SCROLL_AREA_CSS_PROPS.cornerHeight]:s.scrollbarX.height?s.scrollbarX.height+"px":s.scrollbarY.width?s.scrollbarY.width+"px":"16px",[SCROLL_AREA_CSS_PROPS.cornerWidth]:s.scrollbarY.width?s.scrollbarY.width+"px":s.scrollbarX.height?s.scrollbarX.height+"px":"16px",position:"absolute"};return r((()=>{if(o.current){const e=getComputedStyle(o.current);i({type:L.SetExplicitResize,value:e.resize})}}),[i,o]),c.createElement(t,a({},e,{ref:n,style:{...e.style,...d}}))}));export const ScrollAreaCorner=c.forwardRef((function(e,t){return B()?null:c.createElement(G,a({},e,{ref:t}))}));ScrollAreaCorner.displayName="ScrollAreaCorner";export const Root=ScrollArea;export const Viewport=ScrollAreaViewport;export const ScrollbarX=ScrollAreaScrollbarX;export const ScrollbarY=ScrollAreaScrollbarY;export const ButtonStart=ScrollAreaButtonStart;export const ButtonEnd=ScrollAreaButtonEnd;export const Track=ScrollAreaTrack;export const Thumb=ScrollAreaThumb;export const Corner=ScrollAreaCorner;export const unstable_ScrollAreaNoNativeFallback=W;function J(e,t){switch(t.type){case L.SetExplicitResize:return{...e,explicitResize:t.value};case L.HandleScrollAreaResize:{const r=t.scrollAreaComputedStyle,n=parseInt(r.borderTopWidth),o=parseInt(r.borderRightWidth),i=parseInt(r.borderBottomWidth),l=parseInt(r.borderLeftWidth),s=parseInt(r.paddingTop),c=parseInt(r.paddingRight),a=parseInt(r.paddingBottom),u=parseInt(r.paddingLeft);return{...e,domSizes:{...e.domSizes,scrollArea:{width:t.width,height:t.height},position:{width:t.width-l-o-u-c,height:t.height-n-i-s-a}}}}case L.SetContentOverflowing:return{...e,contentIsOverflowingX:t.x,contentIsOverflowingY:t.y};case L.SetScrollbarIsVisible:var r,n;return"always"===t.scrollbarVisibility?{...e,scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}:{...e,scrollbarIsVisibleX:null!==(r=t.x)&&void 0!==r?r:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(n=t.y)&&void 0!==n?n:e.scrollbarIsVisibleY};case L.HandleViewportResize:return{...e,domSizes:{...e.domSizes,viewport:{width:t.width,height:t.height}}};case L.HandleScrollbarResize:return{...e,domSizes:{...e.domSizes,["x"===t.axis?"scrollbarX":"scrollbarY"]:{height:t.height,width:t.width}}};case L.HandleTrackResize:return{...e,domSizes:{...e.domSizes,["x"===t.axis?"trackX":"trackY"]:{height:t.height,width:t.width}}};case L.StartTracking:return{...e,state:T.Tracking};case L.StopTracking:return{...e,state:T.Idle};case L.StartThumbing:return{...e,state:T.Thumbing};case L.StopThumbing:return{...e,state:T.Idle};case L.StartButtonPress:return{...e,state:T.ButtonScrolling};case L.StopButtonPress:return{...e,state:T.Idle}}return e}function K(e,t){const o=n(t);r((()=>{var t;const r=e.current;if(!r)return;const n=new ResizeObserver((([e])=>{const t=function(e){if("borderBoxSize"in e)return Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize;const t=e.target.getBoundingClientRect();return{inlineSize:t.width,blockSize:t.height}}(e);o(t,e.target)})),i=r.getBoundingClientRect();return o({inlineSize:i.width,blockSize:i.height},r),null===(t=n.observe)||void 0===t||t.call(n,r),function(){n.disconnect()}}),[o,e])}function ee({duration:e,draw:t,timing:r,done:n,rafIdRef:o}){return new Promise((i=>{let l=performance.now(),c=!1;o.current=requestAnimationFrame((function a(u){l=u<l?u:l;const d=s((u-l)/e,[0,1]);t(r(d)),d<1?!c&&(o.current=requestAnimationFrame(a)):(c=!0,cancelAnimationFrame(o.current),i("done"),n&&n())}))}))}function te({axis:e,direction:t,positionElement:r}){let n=ue({axis:e,direction:t,positionElement:r});return function(o){const i=n*Math.min(o,1),l=ye(r,{direction:t,distance:i,axis:e});n-=i,pe(r,{axis:e,value:l})}}function re({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){let i=ae({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o});return function(r){const o=Math.pow(10,3),l=Math.round(i*Math.min(r,1)*o)/o,s=ye(n,{direction:t,distance:l,axis:e});i-=l,pe(n,{axis:e,value:s})}}function ne(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function oe(e,t){return"x"===e?t.trackXRef:t.trackYRef}function ie(e,t){const{current:r}=e;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function le(e){return ie(e,"A ref for ScrollAreaTrack was not placed as expected. ScrollAreaTrack should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function se(e){return ie(e,"A ref for ScrollAreaThumb was not placed as expected. ScrollAreaThumb should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function ce(e){return ie(e,"A ref for an internal component in ScrollAreaViewport was not placed as expected. ScrollAreaViewport should always be used within a ScrollArea component, and it should not be rendered conditionally.")}function ae({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){const i=fe(n,{axis:e}),l=me(n,{axis:e}),s=he(n,{axis:e}),{positionStart:c,size:a}=Se(o,{axis:e}),u=Math.round(r[e]-c),d=Math.round(u/a*100)/100,f="start"===t?d*l:d*l-s;return f<i?f-i-s/2:f-i+s/2}function ue({axis:e,direction:t,positionElement:r}){return(he(r,{axis:e})-40)*("end"===t?1:-1)}function de(e,{axis:t}){const r=me(e,{axis:t});return he(e,{axis:t})/r}function fe(e,{axis:t}){return e["x"===t?"scrollLeft":"scrollTop"]}function pe(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]=r}function he(e,{axis:t}){return e["x"===t?"clientWidth":"clientHeight"]}function me(e,{axis:t}){return e["x"===t?"scrollWidth":"scrollHeight"]}function Se(e,{axis:t}){const{[t]:r,["y"===t?"top":"left"]:n,["y"===t?"bottom":"right"]:o,["y"===t?"height":"width"]:i}=e.getBoundingClientRect();return{coord:r,positionStart:n,positionEnd:o,size:i}}function be(e){return{x:e.clientX,y:e.clientY}}function ve(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]+=r}function Re(e){return!(!e||0!==e.scrollTop)}function xe(e){return!(!e||e.scrollLeft!==Ae(e))}function we(e){return!(!e||e.scrollTop!==Ee(e))}function ge(e){return!(!e||0!==e.scrollLeft)}function Ee(e){return e.scrollHeight-e.clientHeight}function Ae(e){return e.scrollWidth-e.clientWidth}function ye(e,{direction:t,distance:r,axis:n}){const{["x"===n?"scrollLeft":"scrollTop"]:o}=e,i=o+r,l="end"===t?function(e,t){return"x"===t?Ae(e):Ee(e)}(e,n):0;return"end"===t?Math.min(l,i):Math.max(l,i)}function Te(e){const t=[];for(const r of Object.keys(e)){const n=e[r];t.push(n.height,n.width)}return t}function Pe(e){return`--radix-scroll-area-${e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}`}function Le(e,t,r){r=r||t.getBoundingClientRect();const n=be(e);return n.x<r.left||n.x>r.right||n.y<r.top||n.y>r.bottom}function Ie(e,{axis:t}){return de(e,{axis:t})<1}function Ce(e,{axis:t,delta:r}){return!(0===r||r<0&&("x"===t?ge:Re)(e)||r>0&&("x"===t?xe:we)(e))}function ze(e){const{thumbElement:t,positionElement:r,axis:n}=e,o=me(r,{axis:n}),i=he(r,{axis:n}),l=fe(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left=100*l+"%":"y"===n&&(t.style.top=100*l+"%"))}function _e(e){return 0===e.button} | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-scroll-area", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"license": "MIT", | ||
@@ -21,10 +21,10 @@ "source": "src/index.ts", | ||
"@babel/runtime": "^7.13.10", | ||
"@radix-ui/number": "0.0.3", | ||
"@radix-ui/primitive": "0.0.3", | ||
"@radix-ui/react-compose-refs": "0.0.3", | ||
"@radix-ui/react-context": "0.0.3", | ||
"@radix-ui/react-polymorphic": "0.0.8", | ||
"@radix-ui/react-primitive": "0.0.9", | ||
"@radix-ui/react-use-callback-ref": "0.0.3", | ||
"@radix-ui/react-use-layout-effect": "0.0.3" | ||
"@radix-ui/number": "0.0.4", | ||
"@radix-ui/primitive": "0.0.4", | ||
"@radix-ui/react-compose-refs": "0.0.4", | ||
"@radix-ui/react-context": "0.0.4", | ||
"@radix-ui/react-polymorphic": "0.0.9", | ||
"@radix-ui/react-primitive": "0.0.10", | ||
"@radix-ui/react-use-callback-ref": "0.0.4", | ||
"@radix-ui/react-use-layout-effect": "0.0.4" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
349945
334
2
+ Added@radix-ui/number@0.0.4(transitive)
+ Added@radix-ui/primitive@0.0.4(transitive)
+ Added@radix-ui/react-compose-refs@0.0.4(transitive)
+ Added@radix-ui/react-context@0.0.4(transitive)
+ Added@radix-ui/react-polymorphic@0.0.9(transitive)
+ Added@radix-ui/react-primitive@0.0.10(transitive)
+ Added@radix-ui/react-use-callback-ref@0.0.4(transitive)
+ Added@radix-ui/react-use-layout-effect@0.0.4(transitive)
- Removed@radix-ui/number@0.0.3(transitive)
- Removed@radix-ui/primitive@0.0.3(transitive)
- Removed@radix-ui/react-compose-refs@0.0.3(transitive)
- Removed@radix-ui/react-context@0.0.3(transitive)
- Removed@radix-ui/react-polymorphic@0.0.8(transitive)
- Removed@radix-ui/react-primitive@0.0.9(transitive)
- Removed@radix-ui/react-use-callback-ref@0.0.3(transitive)
- Removed@radix-ui/react-use-layout-effect@0.0.3(transitive)
Updated@radix-ui/number@0.0.4
Updated@radix-ui/primitive@0.0.4