@radix-ui/react-scroll-area
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -1,2 +0,2 @@ | ||
var e,r,t=(e={},r=require("react"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e),n=require("@radix-ui/utils"),o=n.canUseDOM,i=n.clamp,l=n.getSelector,a=n.getSelectorObj,c=n.getResizeObserverEntryBorderBoxSize,s=n.isMainClick,u=n.namespaced,f=require("@radix-ui/react-primitive").Primitive,d=require("@radix-ui/react-utils"),p=d.composeEventHandlers,v=d.createContext,h=d.getOwnerGlobals,m=d.useCallbackRef,b=d.useComposedRefs,y=d.useConstant,S=d.useLayoutEffect,w=d.usePrefersReducedMotion;var g,x,R="function"==typeof Float32Array;function E(e,r){return 1-3*r+3*e}function A(e,r){return 3*r-6*e}function T(e){return 3*e}function I(e,r,t){return((E(r,t)*e+A(r,t))*e+T(r))*e}function k(e,r,t){return 3*E(r,t)*e*e+2*A(r,t)*e+T(r)}function P(e){return e}function O(e,r,t,n){if(!(0<=e&&e<=1&&0<=t&&t<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===r&&t===n)return P;for(var o=R?new Float32Array(11):new Array(11),i=0;i<11;++i)o[i]=I(.1*i,e,t);function l(r){for(var n=0,i=1;10!==i&&o[i]<=r;++i)n+=.1;--i;var l=n+.1*((r-o[i])/(o[i+1]-o[i])),a=k(l,e,t);return a>=.001?function(e,r,t,n){for(var o=0;o<4;++o){var i=k(r,t,n);if(0===i)return r;r-=(I(r,t,n)-e)/i}return r}(r,l,e,t):0===a?l:function(e,r,t,n,o){var i,l,a=0;do{(i=I(l=r+(t-r)/2,n,o)-e)>0?t=l:r=l}while(Math.abs(i)>1e-7&&++a<10);return l}(r,n,n+.1,e,t)}return function(e){return 0===e||1===e?e:I(l(e),r,n)}}function z(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}(x=g||(g={}))[x.Idle=0]="Idle",x[x.Stopped=1]="Stopped",x[x.Queuing=2]="Queuing",x[x.Pending=3]="Pending",x[x.Resolved=4]="Resolved",x[x.Error=5]="Error";var X=function(){function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),C(this,"queue",[]),C(this,"_state",g.Idle)}var r,t,n;return r=e,(t=[{key:"restart",value:function(){this.state===g.Stopped&&(this._state=g.Idle)}},{key:"rejectItem",value:function(e,r){this.stateIs(g.Pending,g.Queuing)&&(this._state=this.isEmpty()?g.Error:g.Queuing,e(r),this.dequeue())}},{key:"resolveItem",value:function(e,r){this.stateIs(g.Pending,g.Queuing)&&(this._state=this.isEmpty()?g.Resolved:g.Queuing,e(r),this.dequeue())}},{key:"enqueue",value:function(e){var r=this;return this.restart(),new Promise((function(t,n){r.queue.push({promise:e,resolve:t,reject:n}),r.dequeue()}))}},{key:"dequeue",value:function(){var e=this;if(this.stateIs(g.Error,g.Resolved,g.Idle,g.Queuing)){if(this.isEmpty())return;var r=this.queue.shift();try{this._state=g.Pending,r.promise().then((function(t){e.resolveItem(r.resolve,t)})).catch((function(t){e.rejectItem(r.reject,t)}))}catch(e){this.rejectItem(r.reject,e)}}}},{key:"stateIs",value:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.includes(this.state)}},{key:"isEmpty",value:function(){return this.queue.length<=0}},{key:"stop",value:function(){this.stateIs(g.Pending,g.Queuing)&&(this._state=g.Stopped,this.queue=[])}},{key:"isBusy",get:function(){return this.state===g.Queuing||this.state===g.Pending}},{key:"state",get:function(){return this._state}}])&&z(r.prototype,t),n&&z(r,n),e}();function Y(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,i=void 0;try{for(var l,a=e[Symbol.iterator]();!(n=(l=a.next()).done)&&(t.push(l.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return V(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return V(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var L=!1,H=0;function B(e){"touch"===e.pointerType&&(L=!0,setTimeout((function(){L=!1}),50))}function j(){if("undefined"!=typeof document)return document.addEventListener("pointerup",B),H++,function(){--H>0||document.removeEventListener("pointerup",B)}}function M(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.onHoverStart,n=e.onHoverChange,o=e.onHoverEnd,i=e.isDisabled,l=t.useState(!1),a=Y(l,2),c=a[0],s=a[1],u=t.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;t.useEffect(j,[]);var f=t.useMemo((function(){return{onPointerEnter:function(e){L&&"mouse"===e.pointerType||function(e,t){if(!i&&"touch"!==t&&!u.isHovered){u.isHovered=!0;var o=e.target;r&&r({type:"hoverstart",target:o,pointerType:t}),n&&n(!0),s(!0)}}(e,e.pointerType)},onPointerLeave:function(e){!function(e,r){if(!i&&"touch"!==r&&u.isHovered){u.isHovered=!1;var t=e.target;o&&o({type:"hoverend",target:t,pointerType:r}),n&&n(!1),s(!1)}}(e,e.pointerType)}}}),[i,u,r,n,o]);return{hoverProps:f,isHovered:c}}function W(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||U(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(){return(D=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function q(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?q(Object(t),!0).forEach((function(r){N(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):q(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function N(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Q(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function F(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,i=void 0;try{for(var l,a=e[Symbol.iterator]();!(n=(l=a.next()).done)&&(t.push(l.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return t}(e,r)||U(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(e,r){if(e){if("string"==typeof e)return $(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?$(e,r):void 0}}function $(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var G,J,K,Z,ee=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,r){return _(_({},e),{},N({},r,(t=r,"--".concat(u("ScrollArea".concat((n=t,n.charAt(0).toUpperCase()+n.slice(1))))))));var t,n}),{});exports.SCROLL_AREA_CSS_PROPS=ee,(J=G||(G={})).Idle="Idle",J.Thumbing="Thumbing",J.Tracking="Tracking",J.ButtonScrolling="ButtonScrolling",(Z=K||(K={}))[Z.DeriveStateFromProps=0]="DeriveStateFromProps",Z[Z.HandleScrollAreaResize=1]="HandleScrollAreaResize",Z[Z.HandleViewportResize=2]="HandleViewportResize",Z[Z.HandleScrollbarResize=3]="HandleScrollbarResize",Z[Z.HandleTrackResize=4]="HandleTrackResize",Z[Z.SetContentOverflowing=5]="SetContentOverflowing",Z[Z.SetExplicitResize=6]="SetExplicitResize",Z[Z.StartTracking=7]="StartTracking",Z[Z.StopTracking=8]="StopTracking",Z[Z.StartThumbing=9]="StartThumbing",Z[Z.StopThumbing=10]="StopThumbing",Z[Z.StartButtonPress=11]="StartButtonPress",Z[Z.StopButtonPress=12]="StopButtonPress",Z[Z.SetScrollbarIsVisible=13]="SetScrollbarIsVisible";var re={overflowX:"auto",overflowY:"auto",scrollbarVisibility:"hover",scrollbarVisibilityRestTimeout:600,dir:"ltr",trackClickBehavior:"relative",unstable_prefersReducedMotion:!1},te=F(v("ScrollAreaRefsContext","ScrollArea"),2),ne=te[0],oe=te[1],ie=F(v("ScrollAreaContext","ScrollArea"),2),le=ie[0],ae=ie[1],ce=t.createContext({});function se(){return t.useContext(ce)}ce.displayName="ScrollAreaStateContext";var ue=t.createContext(!0),fe=function(){return t.useContext(ue)},de=F(v("DispatchContext","ScrollArea"),2),pe=de[0],ve=de[1],he=t.forwardRef((function(e,r){var n=_(_({},re),e),i=n.unstable_forceNative,l=void 0!==i&&i,a=n.children,c=Q(n,["unstable_forceNative","children"]),s=F(t.useState(!0),2),u=s[0],f=s[1];S((function(){f(l||!("ResizeObserver"in window&&function(){var e,r;if(!o())return!1;var t=!1;try{document.querySelector("::-webkit-scrollbar"),t=!0}catch(e){}return!(!(null===(e=window.CSS)||void 0===e||null===(r=e.supports)||void 0===r?void 0:r.call(e,"scrollbar-width: none"))&&!t)}()))}),[l]);var d=u?be:we,p=t.useRef(null),v=t.useRef(null);return function(e,r,n){t.useImperativeHandle(e,(function(){var e=r.current,t=n.current||e,o={scrollIntent:function(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];(e=t.scroll).call.apply(e,[t].concat(n))},scrollByIntent:function(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];(e=t.scrollBy).call.apply(e,[t].concat(n))},scrollIntoViewIntent:function(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];(e=t.scrollIntoView).call.apply(e,[t].concat(n))},scrollToIntent:function(){for(var e,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];(e=t.scrollTo).call.apply(e,[t].concat(n))},get scrollTopIntent(){return t.scrollTop},set scrollTopIntent(e){t.scrollTop=e},get scrollLeftIntent(){return t.scrollLeft},set scrollLeftIntent(e){t.scrollLeft=e},get scrollHeightIntent(){return t.scrollHeight},get scrollWidthIntent(){return t.scrollWidth},addScrollListener:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];t.addEventListener.apply(t,["scroll"].concat(r))},removeScrollListener:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];t.removeEventListener.apply(t,["scroll"].concat(r))}};return Object.assign(e,o)}))}(r,v,p),t.createElement(d,D({positionRef:p,scrollAreaRef:v},c,{ref:r}),t.createElement(ue.Provider,{value:u},a))}));exports.ScrollArea=he;var me=t.forwardRef((function(e,r){var n=_(_({},re),e),o=n.children,i=Q(n,["children"]),l=t.useRef(null),a=t.useRef(null);return t.createElement(we,D({positionRef:l,scrollAreaRef:a},i,{ref:r}),t.createElement(ue.Provider,{value:!1},o))})),be=t.forwardRef((function(e,r){var n=_(_({},re),e),o=n.selector,i=void 0===o?l("ScrollArea"):o,a=n.overflowX,c=n.overflowY,s=(n.scrollbarVisibility,n.scrollbarVisibilityRestTimeout,n.trackClickBehavior,n.unstable_prefersReducedMotion,n.scrollAreaRef),u=(n.positionRef,Q(n,["selector","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","scrollAreaRef","positionRef"])),d=b(s,r);return t.createElement(f,D({},u,{selector:i,ref:d,style:_(_({},u.style),{},{overflowX:a,overflowY:c,resize:"none"})}))})),ye={width:0,height:0},Se={state:G.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:ye,viewport:ye,position:ye,scrollbarY:ye,scrollbarX:ye,trackY:ye,trackX:ye}},we=t.forwardRef((function(e,r){var n,o=_(_({},re),e),i=o.selector,a=void 0===i?l("ScrollArea"):i,c=o.children,s=o.onScroll,u=o.overflowX,d=o.overflowY,v=o.scrollbarVisibility,y=o.scrollbarVisibilityRestTimeout,S=o.trackClickBehavior,g=o.unstable_prefersReducedMotion,x=o.positionRef,R=o.scrollAreaRef,E=Q(o,["selector","children","onScroll","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","positionRef","scrollAreaRef"]),A=m(s),T=t.useRef(null),I=t.useRef(null),k=t.useRef(null),P=t.useRef(null),O=t.useRef(null),z=t.useRef(null),C=t.useRef(null),X=t.useRef(null),Y=t.useRef(null),V=t.useRef(null),L=t.useRef(null),H=t.useMemo((function(){return{buttonDownRef:T,buttonLeftRef:I,buttonRightRef:k,buttonUpRef:P,viewportRef:O,positionRef:x,scrollAreaRef:R,scrollbarXRef:z,scrollbarYRef:C,thumbXRef:X,thumbYRef:Y,trackXRef:V,trackYRef:L}}),[]),B=w(R),j=null!=g?g:B,W=F(t.useReducer(Qe,_(_({},Se),{},{scrollbarIsVisibleX:"always"===v,scrollbarIsVisibleY:"always"===v})),2),q=W[0],U=W[1],$=M(),G=$.hoverProps,J=G.onPointerEnter,Z=G.onPointerLeave,te=$.isHovered,oe=t.useMemo((function(){return{dir:e.dir,isHovered:te,onScroll:A,overflowX:u,overflowY:d,prefersReducedMotion:j,scrollbarVisibility:v,scrollbarVisibilityRestTimeout:y,trackClickBehavior:S}}),[e.dir,A,te,u,d,j,v,y,S]),ie=b(r,R);Fe(R,(function(e,r){var t=h(R).ownerWindow.getComputedStyle(r);U({type:K.HandleScrollAreaResize,scrollAreaComputedStyle:t,width:e.inlineSize,height:e.blockSize})}));var ae="always"===v&&("scroll"===u||"auto"===u&&q.contentIsOverflowingX),se="always"===v&&("scroll"===d||"auto"===d&&q.contentIsOverflowingY),ue=q.domSizes,fe=(N(n={},ee.scrollbarXOffset,ae&&ue.scrollbarX.height?ue.scrollbarX.height+"px":0),N(n,ee.scrollbarYOffset,se&&ue.scrollbarY.width?ue.scrollbarY.width+"px":0),N(n,ee.positionWidth,ue.position.width?ue.position.width+"px":"auto"),N(n,ee.positionHeight,ue.position.height?ue.position.height+"px":"auto"),n);return t.createElement(pe.Provider,{value:U},t.createElement(ne.Provider,{value:H},t.createElement(le.Provider,{value:oe},t.createElement(ce.Provider,{value:q},t.createElement(f,D({},E,{selector:a,ref:ie,style:_(_({},E.style),fe),onPointerEnter:p(e.onPointerEnter,J),onPointerLeave:p(e.onPointerLeave,Z)}),c)))))})),ge=t.forwardRef((function(e,r){var n=e.selector,o=void 0===n?l("ScrollAreaViewport"):n,i=Q(e,["selector"]),c=oe("ScrollAreaViewport"),s=c.positionRef,u=c.thumbXRef,d=c.thumbYRef,v=c.trackXRef,h=c.trackYRef,m=c.viewportRef,y=ae("ScrollAreaViewport"),w=y.onScroll,g=y.overflowX,x=y.overflowY,R=y.scrollbarVisibility,E=se(),A=ve("ScrollAreaViewport"),T=b(r,m);Fe(m,(function(e){A({type:K.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));var I=t.useCallback((function(){var e=s.current,r=u.current,t=d.current,n=v.current,o=h.current;r&&n&&e&&Er({thumbElement:r,trackElement:n,axis:"x",positionElement:e}),t&&o&&e&&Er({thumbElement:t,trackElement:o,axis:"y",positionElement:e})}),[s,u,d,v,h]),k=t.useRef(0),P=t.useRef(0);var O=p(w,(function(){s.current&&(I(),function(){if(s.current){var e=s.current.scrollTop,r=s.current.scrollLeft,t=e!==k.current,n=r!==P.current;t===E.scrollbarIsVisibleY&&n===E.scrollbarIsVisibleX||A({type:K.SetScrollbarIsVisible,scrollbarVisibility:R,x:n,y:t}),k.current=e<=0?0:e,P.current=r<=0?0:r}}())}));return S((function(){I()}),[I]),S((function(){var e=s.current;if(e){var r=xr(e,{axis:"x"}),t=xr(e,{axis:"y"});r===E.contentIsOverflowingX&&t===E.contentIsOverflowingY||A({type:K.SetContentOverflowing,x:r,y:t})}}),[E.contentIsOverflowingX,E.contentIsOverflowingY,A,s,E.domSizes.position.height,E.domSizes.position.width,E.domSizes.viewport.height,E.domSizes.viewport.width]),t.createElement("div",D({},o?a(o+"-position"):void 0,{ref:s,onScroll:O,style:{zIndex:1,width:"var(".concat(ee.positionWidth,")"),height:"var(".concat(ee.positionHeight,")"),scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:g,overflowY:x}}),t.createElement("div",D({},o?a(o+"-position-inner"):void 0,{style:{display:"table",width:"100%",paddingBottom:"var(".concat(ee.scrollbarXOffset,")"),paddingRight:"var(".concat(ee.scrollbarYOffset,")")}}),t.createElement(f,D({selector:o},i,{ref:T}))))})),xe=t.forwardRef((function(e,r){return fe()?t.createElement(f,D({},e,{selector:e.selector||l("ScrollAreaViewport"),ref:r})):t.createElement(ge,D({},e,{ref:r}))}));exports.ScrollAreaViewport=xe,xe.displayName="ScrollAreaViewport";var Re=F(v("ScrollbarContext","ScrollAreaScrollbar"),2),Ee=Re[0],Ae=Re[1],Te=t.forwardRef((function(e,r){var n,o=e.axis,i=e.name,l=e.onWheel,a=e.onPointerDown,c=e.onPointerUp,s=e.onPointerMove,u=Q(e,["axis","name","onWheel","onPointerDown","onPointerUp","onPointerMove"]),d=ve(i),v=ae(i),h=v.scrollbarVisibility,m=v.scrollbarVisibilityRestTimeout,S=v.isHovered,w=se(),g=w["x"===o?"contentIsOverflowingX":"contentIsOverflowingY"],x=w["x"===o?"scrollbarIsVisibleX":"scrollbarIsVisibleY"],R=oe(i),E=R.positionRef,A=function(e,r){return"x"===e?r.scrollbarXRef:r.scrollbarYRef}(o,R),T=b(A,r),I=y((function(){return new X}));Fe(A,(function(e){d({type:K.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:o})}));var k=p(l,(function(e){var r=Math.abs(e.deltaX),t=Math.abs(e.deltaY);E.current&&(r>0&&r>t&&(E.current.scrollLeft+=e.deltaX),t>0&&t>r&&(E.current.scrollTop+=e.deltaY))})),P=t.useRef();function O(){clearTimeout(P.current),P.current=setTimeout((function(){d(N({type:K.SetScrollbarIsVisible,scrollbarVisibility:h},o,!1))}),m)}t.useEffect((function(){if(x)return P.current=setTimeout((function(){d(N({type:K.SetScrollbarIsVisible,scrollbarVisibility:h},o,!1))}),m),function(){clearTimeout(P.current)}}),[o,d,x,h,m]);var z=t.useRef(!1),C=p(a,(function(e){z.current=!0,clearTimeout(P.current)})),Y=p(c,(function(e){z.current=!1,O()})),V=p(s,(function(e){z.current||O()})),L=function(){var e,r,t=(null===(e=u.style)||void 0===e?void 0:e.opacity)||1;switch(h){case"always":return null===(r=u.style)||void 0===r?void 0:r.opacity;case"scroll":return x?t:0;case"hover":return S||x?t:0}}(),H=function(){var e,r,t=(null===(e=u.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(h){case"always":return null===(r=u.style)||void 0===r?void 0:r.pointerEvents;case"scroll":return x?t:"none";case"hover":return S||x?t:"none"}}(),B=t.useMemo((function(){return{axis:o,scrollAnimationQueue:I}}),[o,I]);return t.createElement(Ee.Provider,{value:B},t.createElement(f,D({},u,{ref:T,style:_(_({},u.style),{},{display:g?null===(n=u.style)||void 0===n?void 0:n.display:"none",opacity:L,pointerEvents:H}),onPointerDown:C,onPointerUp:Y,onPointerMove:V,onWheel:k})))})),Ie=t.forwardRef((function(e,r){var n=e.selector,o=void 0===n?l("ScrollAreaScrollbarX"):n,i=Q(e,["selector"]),a=se().domSizes;return fe()?null:t.createElement(Te,D({},i,{selector:o,ref:r,axis:"x",name:"ScrollAreaScrollbarX",style:_(_({},e.style),{},N({},ee.scrollbarXSize,a.scrollbarX.height?a.scrollbarX.height+"px":0))}))}));exports.ScrollAreaScrollbarX=Ie,Ie.displayName="ScrollAreaScrollbarX";var ke=t.forwardRef((function(e,r){var n=e.selector,o=void 0===n?l("ScrollAreaScrollbarY"):n,i=Q(e,["selector"]),a=se().domSizes;return fe()?null:t.createElement(Te,D({},i,{selector:o,ref:r,axis:"y",name:"ScrollAreaScrollbarY",style:_(_({},e.style),{},N({},ee.scrollbarYSize,a.scrollbarY.width?a.scrollbarY.width+"px":0))}))}));exports.ScrollAreaScrollbarY=ke,ke.displayName="ScrollAreaScrollbarY";var Pe=t.forwardRef((function(e,r){var n=e.selector,o=void 0===n?l("ScrollAreaTrack"):n,a=e.onPointerDown,c=Q(e,["selector","onPointerDown"]),u=Ae("ScrollAreaTrack"),d=u.axis,v=u.scrollAnimationQueue,y=ve("ScrollAreaTrack"),S=oe("ScrollAreaTrack"),w=ae("ScrollAreaTrack"),g=w.trackClickBehavior,x=w.prefersReducedMotion,R=S.positionRef,E=Ke(d,S),A=Je(d,S),T=b(E,r),I=m(a);Fe(E,(function(e){y({type:K.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:d})}));var k=t.useRef();return t.useEffect((function(){var e=null,r=null,t=er(E),n=rr(A),o=tr(R),l=h(R).ownerDocument,a=p(I,(function(a){if(s(a)&&a.target!==n&&!n.contains(a.target)){var f=function(e){var r=e.event,t=e.axis,n=e.thumbElement;return fr(r)[t]<n.getBoundingClientRect()["y"===t?"top":"left"]?"start":"end"}({event:a,axis:d,thumbElement:n});if(clearTimeout(r),"page"===g){if(y({type:K.StartTracking}),l.addEventListener("pointermove",c),l.addEventListener("pointerup",u),t.setPointerCapture(a.pointerId),x){var p=or({direction:f,positionElement:o,axis:d}),h=Sr(o,{direction:f,distance:p,axis:d});ar(o,{axis:d,value:h})}else v.enqueue((function(){return Ue({duration:200,timing:O(.16,0,.73,1),draw:$e({positionElement:o,direction:f,axis:d}),rafIdRef:k})}));return e=setTimeout((function(){var r=fr(a),n=nr({axis:d,direction:f,pointerPosition:r,positionElement:o,trackElement:t});if(!("start"===f&&n>0||"end"===f&&n<0)){if(x){var l=Sr(o,{direction:f,distance:n,axis:d});ar(o,{axis:d,value:l})}else{var c=Math.round(Math.abs(n)),s=i(c,[100,500]);v.enqueue((function(){return Ue({duration:s,timing:function(e){return e},draw:Ge({axis:d,direction:f,pointerPosition:r,positionElement:o,trackElement:t}),rafIdRef:k})}))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}var m=fr(a),b=nr({axis:d,direction:f,pointerPosition:m,positionElement:o,trackElement:t}),S=Sr(o,{direction:f,distance:b,axis:d});ar(o,{axis:d,value:S});var w=new PointerEvent("pointerdown",a);requestAnimationFrame((function(){n.dispatchEvent(w)}))}}));return t.addEventListener("pointerdown",a),function(){cancelAnimationFrame(k.current),clearTimeout(e),clearTimeout(r),t.removeEventListener("pointerdown",a),l.removeEventListener("pointermove",c),l.removeEventListener("pointerup",u),y({type:K.StopTracking}),v.stop()};function c(r){"mouse"===r.pointerType&&gr(r,t)&&(clearTimeout(e),l.removeEventListener("pointermove",c),v.stop())}function u(n){t.releasePointerCapture(n.pointerId),clearTimeout(e),l.removeEventListener("pointermove",c),l.removeEventListener("pointerup",u),v.stop(),y({type:K.StopTracking}),r=setTimeout((function(){v.stop()}),200)}}),[d,x,g,y,I,R,v,A,E]),t.createElement(f,D({},c,{selector:o,ref:T,"data-axis":d}))}));exports.ScrollAreaTrack=Pe,Pe.displayName="ScrollAreaTrack";var Oe=t.forwardRef((function(e,r){var n,o,i=e.selector,a=void 0===i?l("ScrollAreaThumb"):i,c=e.onPointerDown,u=Q(e,["selector","onPointerDown"]),d=Ae("ScrollAreaThumb").axis,v=oe("ScrollAreaThumb"),y=ve("ScrollAreaThumb"),w=v.positionRef,g=Je(d,v),x=Ke(d,v),R=b(g,r),E=se(),A=m(c),T=t.useRef(0),I=t.useRef(0),k=t.useRef({size:0,positionStart:0}),P=t.useRef({size:0,positionStart:0}),O=t.useRef(!1);S((function(){O.current?Er({thumbElement:rr(g),trackElement:er(x),positionElement:tr(w),axis:d}):O.current=!0}),[g,x,w,d].concat(W(wr(E.domSizes))));var z="x"===d?E.domSizes.trackX.width:E.domSizes.trackY.height,C=t.useRef(z);S((function(){C.current=z})),t.useEffect((function(){var e=rr(g),r=er(x),t=tr(w),n=h(w).ownerDocument,o=p(A,(function(t){if(s(t)){var o=fr(t)[d];k.current=ur(e,{axis:d}),P.current=ur(r,{axis:d}),I.current=o,T.current=o,e.setPointerCapture(t.pointerId),n.addEventListener("pointerup",a),n.addEventListener("pointermove",l),y({type:K.StartThumbing})}}));return e.addEventListener("pointerdown",o),function(){e.removeEventListener("pointerdown",o),i()};function i(){n.removeEventListener("pointermove",l),n.removeEventListener("pointerup",a),y({type:K.StopThumbing})}function l(e){var r=fr(e)[d],n=r-I.current,o=C.current;if(Rr(t,{axis:d,delta:n})){var i=P.current.positionStart,l=k.current.positionStart,a=T.current-l,c=Math.round(r-i),s=Math.round((c-a)/o*100)/100,u=sr(t,{axis:d});ar(t,{axis:d,value:s*u}),I.current=r,y({type:K.StartThumbing})}}function a(r){e.releasePointerCapture(r.pointerId),i()}}),[d,A,y,w,v,g,x]);var X=F(t.useState({}),2),Y=X[0],V=X[1];return S((function(){var e=w.current,r=x.current;V(function(e){var r=e.trackElement,t=e.positionElement,n=e.axis;if(!r||!t)return{};var o=ir(t,{axis:n}),i=cr(r,{axis:n}),l=o*i;if(!xr(t,{axis:n}))return{display:"none",width:0,height:0};return N({},"x"===n?"width":"height",l)}({positionElement:e,trackElement:r,axis:d}))}),[d,w,x].concat(W(wr(E.domSizes)))),t.createElement(f,D({},u,{selector:a,ref:R,"data-axis":d,style:_(_(_({},u.style),Y),"x"===d?(n={},N(n,ee.scrollbarThumbWillChange,"left"),N(n,ee.scrollbarThumbHeight,"100%"),N(n,ee.scrollbarThumbWidth,"auto"),n):(o={},N(o,ee.scrollbarThumbWillChange,"top"),N(o,ee.scrollbarThumbHeight,"auto"),N(o,ee.scrollbarThumbWidth,"100%"),o))}))}));exports.ScrollAreaThumb=Oe,Oe.displayName="ScrollAreaThumb";var ze=t.forwardRef((function(e,r){var n=e.direction,o=e.name,i=e.onPointerDown,l=Q(e,["direction","name","onPointerDown"]),a=Ae(o),c=a.axis,u=a.scrollAnimationQueue,d=ve(o),v=oe(o),y=ae(o).prefersReducedMotion,S=v.positionRef,w=function(e,r,t){switch(function(e,r){if("start"===e)return"x"===r?"left":"up";return"x"===r?"right":"down"}(e,r)){case"down":return t.buttonDownRef;case"up":return t.buttonUpRef;case"left":return t.buttonLeftRef;case"right":return t.buttonRightRef}}(n,c,v),g=b(w,r),x=t.useRef(),R=m(i);return t.useEffect((function(){var e,r=function(e,r){var t="end"===r?"ScrollAreaButtonEnd":"ScrollAreaButtonStart";return Ze(e,"A ref for ".concat(t," was not placed as expected. ").concat(t," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}(w,n),t=tr(S),o=h(S).ownerDocument,i=null,l=p(R,(function(l){if(s(l)){r.setPointerCapture(l.pointerId),o.addEventListener("pointerup",f),o.addEventListener("pointermove",a),d({type:K.StartButtonPress});var p="start"===n?-1:1;y?dr(t,{axis:c,value:51*p}):Rr(t,{axis:c,delta:p})&&u.enqueue((function(){return Ue({duration:135,timing:O(.16,0,.73,1),draw:function(e){dr(t,{axis:c,value:15*e*p})},rafIdRef:x})})),e=setTimeout((function(){if(y)i=setInterval((function(){Rr(t,{axis:c,delta:p})?dr(t,{axis:c,value:60*p}):clearInterval(i)}),135);else{var n=l.pointerId;!function e(){Rr(t,{axis:c,delta:p})&&u.enqueue((function(){return Ue({duration:135,timing:function(e){return e},draw:function(e){dr(t,{axis:c,value:e*(15*p)})},done:r.hasPointerCapture(n)?e:void 0,rafIdRef:x})}))}()}clearTimeout(e)}),400)}}));return r.addEventListener("pointerdown",l),function(){r.removeEventListener("pointerdown",l),o.removeEventListener("pointerup",f),o.removeEventListener("pointermove",a),clearTimeout(e),clearInterval(i),cancelAnimationFrame(x.current),d({type:K.StopButtonPress})};function a(t){"mouse"===t.pointerType&&gr(t,r)&&(clearTimeout(e),o.removeEventListener("pointermove",a))}function f(t){clearTimeout(e),clearInterval(i),r.releasePointerCapture(t.pointerId),r.removeEventListener("pointerup",f),d({type:K.StopButtonPress})}}),[c,n,y,w,d,R,u,S]),t.createElement(f,D({},l,{ref:g,"data-axis":c}))})),Ce=t.forwardRef((function(e,r){var n=e.selector,o=void 0===n?l("ScrollAreaButtonStart"):n,i=Q(e,["selector"]);return t.createElement(ze,D({},i,{selector:o,ref:r,name:"ScrollAreaButtonStart",direction:"start"}))}));exports.ScrollAreaButtonStart=Ce,Ce.displayName="ScrollAreaButtonStart";var Xe=t.forwardRef((function(e,r){var n=e.selector,o=void 0===n?l("ScrollAreaButtonEnd"):n,i=Q(e,["selector"]);return t.createElement(ze,D({},i,{selector:o,ref:r,name:"ScrollAreaButtonEnd",direction:"end"}))}));exports.ScrollAreaButtonEnd=Xe,Xe.displayName="ScrollAreaButtonEnd";var Ye=t.forwardRef((function(e,r){var n,o=e.selector,i=void 0===o?l("ScrollAreaCorner"):o,a=Q(e,["selector"]),c=oe("ScrollAreaCorner").positionRef,s=ve("ScrollAreaCorner"),u=ae("ScrollAreaCorner").dir,d=se().domSizes,p="rtl"===u,v=(N(n={},ee.cornerLeft,p?0:"unset"),N(n,ee.cornerRight,p?"unset":0),N(n,ee.cornerHeight,d.scrollbarX.height?d.scrollbarX.height+"px":d.scrollbarY.width?d.scrollbarY.width+"px":"16px"),N(n,ee.cornerWidth,d.scrollbarY.width?d.scrollbarY.width+"px":d.scrollbarX.height?d.scrollbarX.height+"px":"16px"),N(n,"position","absolute"),n);return S((function(){if(c.current){var e=h(c).ownerWindow.getComputedStyle(c.current);s({type:K.SetExplicitResize,value:e.resize})}}),[s,c]),t.createElement(f,D({},a,{selector:i,ref:r,style:_(_({},e.style),v)}))})),Ve=t.forwardRef((function(e,r){return fe()?null:t.createElement(Ye,D({},e,{ref:r}))}));exports.ScrollAreaCorner=Ve,Ve.displayName="ScrollAreaCorner";var Le=he;exports.Root=Le;var He=xe;exports.Viewport=He;var Be=Ie;exports.ScrollbarX=Be;var je=ke;exports.ScrollbarY=je;var Me=Ce;exports.ButtonStart=Me;var We=Xe;exports.ButtonEnd=We;var De=Pe;exports.Track=De;var qe=Oe;exports.Thumb=qe;var _e=Ve;exports.Corner=_e;var Ne=me;function Qe(e,r){switch(r.type){case K.SetExplicitResize:return _(_({},e),{},{explicitResize:r.value});case K.HandleScrollAreaResize:var t=r.scrollAreaComputedStyle,n=parseInt(t.borderTopWidth),o=parseInt(t.borderRightWidth),i=parseInt(t.borderBottomWidth),l=parseInt(t.borderLeftWidth),a=parseInt(t.paddingTop),c=parseInt(t.paddingRight),s=parseInt(t.paddingBottom),u=parseInt(t.paddingLeft);return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},{scrollArea:{width:r.width,height:r.height},position:{width:r.width-l-o-u-c,height:r.height-n-i-a-s}})});case K.SetContentOverflowing:return _(_({},e),{},{contentIsOverflowingX:r.x,contentIsOverflowingY:r.y});case K.SetScrollbarIsVisible:var f,d;return"always"===r.scrollbarVisibility?_(_({},e),{},{scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}):_(_({},e),{},{scrollbarIsVisibleX:null!==(f=r.x)&&void 0!==f?f:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(d=r.y)&&void 0!==d?d:e.scrollbarIsVisibleY});case K.HandleViewportResize:return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},{viewport:{width:r.width,height:r.height}})});case K.HandleScrollbarResize:return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},N({},"x"===r.axis?"scrollbarX":"scrollbarY",{height:r.height,width:r.width}))});case K.HandleTrackResize:return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},N({},"x"===r.axis?"trackX":"trackY",{height:r.height,width:r.width}))});case K.StartTracking:return _(_({},e),{},{state:G.Tracking});case K.StopTracking:return _(_({},e),{},{state:G.Idle});case K.StartThumbing:return _(_({},e),{},{state:G.Thumbing});case K.StopThumbing:return _(_({},e),{},{state:G.Idle});case K.StartButtonPress:return _(_({},e),{},{state:G.ButtonScrolling});case K.StopButtonPress:return _(_({},e),{},{state:G.Idle})}return e}function Fe(e,r){var t=m(r);S((function(){var r,n=e.current;if(n){var o=new ResizeObserver((function(e){var r=F(e,1)[0],n=c(r);t(n,r.target)})),i=n.getBoundingClientRect();return t({inlineSize:i.width,blockSize:i.height},n),null===(r=o.observe)||void 0===r||r.call(o,n),function(){o.disconnect()}}}),[t,e])}function Ue(e){var r=e.duration,t=e.draw,n=e.timing,o=e.done,l=e.rafIdRef;return new Promise((function(e){var a=performance.now(),c=!1;l.current=requestAnimationFrame((function s(u){var f=i((u-(a=u<a?u:a))/r,[0,1]);t(n(f)),f<1?!c&&(l.current=requestAnimationFrame(s)):(c=!0,cancelAnimationFrame(l.current),e("done"),o&&o())}))}))}function $e(e){var r=e.axis,t=e.direction,n=e.positionElement,o=or({axis:r,direction:t,positionElement:n});return function(e){var i=o*Math.min(e,1),l=Sr(n,{direction:t,distance:i,axis:r});o-=i,ar(n,{axis:r,value:l})}}function Ge(e){var r=e.axis,t=e.direction,n=e.pointerPosition,o=e.positionElement,i=e.trackElement,l=nr({axis:r,direction:t,pointerPosition:n,positionElement:o,trackElement:i});return function(e){var n=Math.pow(10,3),i=Math.round(l*Math.min(e,1)*n)/n,a=Sr(o,{direction:t,distance:i,axis:r});l-=i,ar(o,{axis:r,value:a})}}function Je(e,r){return"x"===e?r.thumbXRef:r.thumbYRef}function Ke(e,r){return"x"===e?r.trackXRef:r.trackYRef}function Ze(e,r){var t=e.current;return function(e,r){if(null==e)throw new Error(r)}(t,r),t}function er(e){return Ze(e,"A ref for ".concat("ScrollAreaTrack"," was not placed as expected. ").concat("ScrollAreaTrack"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function rr(e){return Ze(e,"A ref for ".concat("ScrollAreaThumb"," was not placed as expected. ").concat("ScrollAreaThumb"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function tr(e){return Ze(e,"A ref for an internal component in ".concat("ScrollAreaViewport"," was not placed as expected. ").concat("ScrollAreaViewport"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function nr(e){var r=e.axis,t=e.direction,n=e.pointerPosition,o=e.positionElement,i=e.trackElement,l=lr(o,{axis:r}),a=sr(o,{axis:r}),c=cr(o,{axis:r}),s=ur(i,{axis:r}),u=s.positionStart,f=s.size,d=Math.round(n[r]-u),p=Math.round(d/f*100)/100,v="start"===t?p*a:p*a-c;return v<l?v-l-c/2:v-l+c/2}function or(e){var r=e.axis,t=e.direction;return(cr(e.positionElement,{axis:r})-40)*("end"===t?1:-1)}function ir(e,r){var t=r.axis,n=sr(e,{axis:t});return cr(e,{axis:t})/n}function lr(e,r){return e["x"===r.axis?"scrollLeft":"scrollTop"]}function ar(e,r){var t=r.axis,n=r.value;e["x"===t?"scrollLeft":"scrollTop"]=n}function cr(e,r){return e["x"===r.axis?"clientWidth":"clientHeight"]}function sr(e,r){return e["x"===r.axis?"scrollWidth":"scrollHeight"]}function ur(e,r){var t=r.axis,n=e.getBoundingClientRect();return{coord:n[t],positionStart:n["y"===t?"top":"left"],positionEnd:n["y"===t?"bottom":"right"],size:n["y"===t?"height":"width"]}}function fr(e){return{x:e.clientX,y:e.clientY}}function dr(e,r){var t=r.axis,n=r.value;e["x"===t?"scrollLeft":"scrollTop"]+=n}function pr(e){return!(!e||0!==e.scrollTop)}function vr(e){return!(!e||e.scrollLeft!==yr(e))}function hr(e){return!(!e||e.scrollTop!==br(e))}function mr(e){return!(!e||0!==e.scrollLeft)}function br(e){return e.scrollHeight-e.clientHeight}function yr(e){return e.scrollWidth-e.clientWidth}function Sr(e,r){var t=r.direction,n=r.distance,o=r.axis,i=e["x"===o?"scrollLeft":"scrollTop"]+n,l="end"===t?function(e,r){return"x"===r?yr(e):br(e)}(e,o):0;return"end"===t?Math.min(l,i):Math.max(l,i)}function wr(e){for(var r=[],t=0,n=Object.keys(e);t<n.length;t++){var o=e[n[t]];r.push(o.height,o.width)}return r}function gr(e,r,t){t=t||r.getBoundingClientRect();var n=fr(e);return n.x<t.left||n.x>t.right||n.y<t.top||n.y>t.bottom}function xr(e,r){return ir(e,{axis:r.axis})<1}function Rr(e,r){var t=r.axis,n=r.delta;return!(0===n||n<0&&("x"===t?mr:pr)(e)||n>0&&("x"===t?vr:hr)(e))}function Er(e){var r=e.thumbElement,t=e.positionElement,n=e.axis,o=sr(t,{axis:n}),i=cr(t,{axis:n}),l=lr(t,{axis:n})/o;i/o>=1||("x"===n?r.style.left="".concat(100*l,"%"):"y"===n&&(r.style.top="".concat(100*l,"%")))}exports.unstable_ScrollAreaNoNativeFallback=Ne; | ||
var e,t,r=(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),n=require("@radix-ui/utils"),o=n.canUseDOM,i=n.clamp,l=n.getSelector,a=n.getSelectorObj,c=n.getResizeObserverEntryBorderBoxSize,s=n.isMainClick,u=n.namespaced,f=require("@radix-ui/react-primitive").Primitive,d=require("@radix-ui/react-utils"),p=d.composeEventHandlers,v=d.createContext,h=d.getOwnerGlobals,m=d.useCallbackRef,b=d.useComposedRefs,y=d.useConstant,S=d.useLayoutEffect,w=d.usePrefersReducedMotion;var g,x,R="function"==typeof Float32Array;function E(e,t){return 1-3*t+3*e}function A(e,t){return 3*t-6*e}function T(e){return 3*e}function I(e,t,r){return((E(t,r)*e+A(t,r))*e+T(t))*e}function k(e,t,r){return 3*E(t,r)*e*e+2*A(t,r)*e+T(t)}function P(e){return e}function O(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;for(var o=R?new Float32Array(11):new Array(11),i=0;i<11;++i)o[i]=I(.1*i,e,r);function l(t){for(var n=0,i=1;10!==i&&o[i]<=t;++i)n+=.1;--i;var l=n+.1*((t-o[i])/(o[i+1]-o[i])),a=k(l,e,r);return a>=.001?function(e,t,r,n){for(var o=0;o<4;++o){var i=k(t,r,n);if(0===i)return t;t-=(I(t,r,n)-e)/i}return t}(t,l,e,r):0===a?l:function(e,t,r,n,o){var i,l,a=0;do{(i=I(l=t+(r-t)/2,n,o)-e)>0?r=l:t=l}while(Math.abs(i)>1e-7&&++a<10);return l}(t,n,n+.1,e,r)}return function(e){return 0===e||1===e?e:I(l(e),t,n)}}function z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}(x=g||(g={}))[x.Idle=0]="Idle",x[x.Stopped=1]="Stopped",x[x.Queuing=2]="Queuing",x[x.Pending=3]="Pending",x[x.Resolved=4]="Resolved",x[x.Error=5]="Error";var X=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),C(this,"queue",[]),C(this,"_state",g.Idle)}var t,r,n;return t=e,(r=[{key:"restart",value:function(){this.state===g.Stopped&&(this._state=g.Idle)}},{key:"rejectItem",value:function(e,t){this.stateIs(g.Pending,g.Queuing)&&(this._state=this.isEmpty()?g.Error:g.Queuing,e(t),this.dequeue())}},{key:"resolveItem",value:function(e,t){this.stateIs(g.Pending,g.Queuing)&&(this._state=this.isEmpty()?g.Resolved:g.Queuing,e(t),this.dequeue())}},{key:"enqueue",value:function(e){var t=this;return this.restart(),new Promise((function(r,n){t.queue.push({promise:e,resolve:r,reject:n}),t.dequeue()}))}},{key:"dequeue",value:function(){var e=this;if(this.stateIs(g.Error,g.Resolved,g.Idle,g.Queuing)){if(this.isEmpty())return;var t=this.queue.shift();try{this._state=g.Pending,t.promise().then((function(r){e.resolveItem(t.resolve,r)})).catch((function(r){e.rejectItem(t.reject,r)}))}catch(e){this.rejectItem(t.reject,e)}}}},{key:"stateIs",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.includes(this.state)}},{key:"isEmpty",value:function(){return this.queue.length<=0}},{key:"stop",value:function(){this.stateIs(g.Pending,g.Queuing)&&(this._state=g.Stopped,this.queue=[])}},{key:"isBusy",get:function(){return this.state===g.Queuing||this.state===g.Pending}},{key:"state",get:function(){return this._state}}])&&z(t.prototype,r),n&&z(t,n),e}();function Y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var l,a=e[Symbol.iterator]();!(n=(l=a.next()).done)&&(r.push(l.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return V(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return V(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var L=!1,H=0;function B(e){"touch"===e.pointerType&&(L=!0,setTimeout((function(){L=!1}),50))}function j(){if("undefined"!=typeof document)return document.addEventListener("pointerup",B),H++,function(){--H>0||document.removeEventListener("pointerup",B)}}function M(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.onHoverStart,n=e.onHoverChange,o=e.onHoverEnd,i=e.isDisabled,l=r.useState(!1),a=Y(l,2),c=a[0],s=a[1],u=r.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;r.useEffect(j,[]);var f=r.useMemo((function(){return{onPointerEnter:function(e){L&&"mouse"===e.pointerType||function(e,r){if(!i&&"touch"!==r&&!u.isHovered){u.isHovered=!0;var o=e.target;t&&t({type:"hoverstart",target:o,pointerType:r}),n&&n(!0),s(!0)}}(e,e.pointerType)},onPointerLeave:function(e){!function(e,t){if(!i&&"touch"!==t&&u.isHovered){u.isHovered=!1;var r=e.target;o&&o({type:"hoverend",target:r,pointerType:t}),n&&n(!1),s(!1)}}(e,e.pointerType)}}}),[i,u,t,n,o]);return{hoverProps:f,isHovered:c}}function W(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||U(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(){return(D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?q(Object(r),!0).forEach((function(t){N(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function F(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,i=void 0;try{for(var l,a=e[Symbol.iterator]();!(n=(l=a.next()).done)&&(r.push(l.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(e,t)||U(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(e,t){if(e){if("string"==typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(e,t):void 0}}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var G,J,K,Z,ee=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return _(_({},e),{},N({},t,(r=t,"--".concat(u("ScrollArea".concat((n=r,n.charAt(0).toUpperCase()+n.slice(1))))))));var r,n}),{});exports.SCROLL_AREA_CSS_PROPS=ee,(J=G||(G={})).Idle="Idle",J.Thumbing="Thumbing",J.Tracking="Tracking",J.ButtonScrolling="ButtonScrolling",(Z=K||(K={}))[Z.DeriveStateFromProps=0]="DeriveStateFromProps",Z[Z.HandleScrollAreaResize=1]="HandleScrollAreaResize",Z[Z.HandleViewportResize=2]="HandleViewportResize",Z[Z.HandleScrollbarResize=3]="HandleScrollbarResize",Z[Z.HandleTrackResize=4]="HandleTrackResize",Z[Z.SetContentOverflowing=5]="SetContentOverflowing",Z[Z.SetExplicitResize=6]="SetExplicitResize",Z[Z.StartTracking=7]="StartTracking",Z[Z.StopTracking=8]="StopTracking",Z[Z.StartThumbing=9]="StartThumbing",Z[Z.StopThumbing=10]="StopThumbing",Z[Z.StartButtonPress=11]="StartButtonPress",Z[Z.StopButtonPress=12]="StopButtonPress",Z[Z.SetScrollbarIsVisible=13]="SetScrollbarIsVisible";var te={overflowX:"auto",overflowY:"auto",scrollbarVisibility:"hover",scrollbarVisibilityRestTimeout:600,dir:"ltr",trackClickBehavior:"relative",unstable_prefersReducedMotion:!1},re=F(v("ScrollAreaRefsContext","ScrollArea"),2),ne=re[0],oe=re[1],ie=F(v("ScrollAreaContext","ScrollArea"),2),le=ie[0],ae=ie[1],ce=r.createContext({});function se(){return r.useContext(ce)}ce.displayName="ScrollAreaStateContext";var ue=r.createContext(!0),fe=function(){return r.useContext(ue)},de=F(v("DispatchContext","ScrollArea"),2),pe=de[0],ve=de[1],he=r.forwardRef((function(e,t){var n=_(_({},te),e),i=n.unstable_forceNative,l=void 0!==i&&i,a=Q(n,["unstable_forceNative"]),c=F(r.useState(!0),2),s=c[0],u=c[1];S((function(){u(l||!("ResizeObserver"in window&&function(){var e,t;if(!o())return!1;var 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?void 0:t.call(e,"scrollbar-width: none"))&&!r)}()))}),[l]);var f=s?be:we,d=r.useRef(null),p=r.useRef(null);return function(e,t,n){r.useImperativeHandle(e,(function(){var e=t.current,r=n.current||e,o={scrollIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scroll).call.apply(e,[r].concat(n))},scrollByIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scrollBy).call.apply(e,[r].concat(n))},scrollIntoViewIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scrollIntoView).call.apply(e,[r].concat(n))},scrollToIntent:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(e=r.scrollTo).call.apply(e,[r].concat(n))},get scrollTopIntent(){return r.scrollTop},set scrollTopIntent(e){r.scrollTop=e},get scrollLeftIntent(){return r.scrollLeft},set scrollLeftIntent(e){r.scrollLeft=e},get scrollHeightIntent(){return r.scrollHeight},get scrollWidthIntent(){return r.scrollWidth},addScrollListener:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.addEventListener.apply(r,["scroll"].concat(t))},removeScrollListener:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.removeEventListener.apply(r,["scroll"].concat(t))}};return Object.assign(e,o)}))}(t,p,d),r.createElement(ue.Provider,{value:s},r.createElement(f,D({positionRef:d,scrollAreaRef:p},a,{ref:t})))}));exports.ScrollArea=he;var me=r.forwardRef((function(e,t){var n=_(_({},te),e),o=r.useRef(null),i=r.useRef(null);return r.createElement(ue.Provider,{value:!1},r.createElement(we,D({positionRef:o,scrollAreaRef:i},n,{ref:t})))})),be=r.forwardRef((function(e,t){var n=_(_({},te),e),o=n.selector,i=void 0===o?l("ScrollArea"):o,a=n.overflowX,c=n.overflowY,s=(n.scrollbarVisibility,n.scrollbarVisibilityRestTimeout,n.trackClickBehavior,n.unstable_prefersReducedMotion,n.scrollAreaRef),u=(n.positionRef,Q(n,["selector","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","scrollAreaRef","positionRef"])),d=b(s,t);return r.createElement(f,D({},u,{selector:i,ref:d,style:_(_({},u.style),{},{overflowX:a,overflowY:c,resize:"none"})}))})),ye={width:0,height:0},Se={state:G.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:ye,viewport:ye,position:ye,scrollbarY:ye,scrollbarX:ye,trackY:ye,trackX:ye}},we=r.forwardRef((function(e,t){var n,o=_(_({},te),e),i=o.selector,a=void 0===i?l("ScrollArea"):i,c=o.onScroll,s=o.overflowX,u=o.overflowY,d=o.scrollbarVisibility,v=o.scrollbarVisibilityRestTimeout,y=o.trackClickBehavior,S=o.unstable_prefersReducedMotion,g=o.positionRef,x=o.scrollAreaRef,R=Q(o,["selector","onScroll","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","positionRef","scrollAreaRef"]),E=m(c),A=r.useRef(null),T=r.useRef(null),I=r.useRef(null),k=r.useRef(null),P=r.useRef(null),O=r.useRef(null),z=r.useRef(null),C=r.useRef(null),X=r.useRef(null),Y=r.useRef(null),V=r.useRef(null),L=r.useMemo((function(){return{buttonDownRef:A,buttonLeftRef:T,buttonRightRef:I,buttonUpRef:k,viewportRef:P,positionRef:g,scrollAreaRef:x,scrollbarXRef:O,scrollbarYRef:z,thumbXRef:C,thumbYRef:X,trackXRef:Y,trackYRef:V}}),[]),H=w(x),B=null!=S?S:H,j=F(r.useReducer(Qe,_(_({},Se),{},{scrollbarIsVisibleX:"always"===d,scrollbarIsVisibleY:"always"===d})),2),W=j[0],q=j[1],U=M(),$=U.hoverProps,G=$.onPointerEnter,J=$.onPointerLeave,Z=U.isHovered,re=r.useMemo((function(){return{dir:e.dir,isHovered:Z,onScroll:E,overflowX:s,overflowY:u,prefersReducedMotion:B,scrollbarVisibility:d,scrollbarVisibilityRestTimeout:v,trackClickBehavior:y}}),[e.dir,E,Z,s,u,B,d,v,y]),oe=b(t,x);Fe(x,(function(e,t){var r=h(x).ownerWindow.getComputedStyle(t);q({type:K.HandleScrollAreaResize,scrollAreaComputedStyle:r,width:e.inlineSize,height:e.blockSize})}));var ie="always"===d&&("scroll"===s||"auto"===s&&W.contentIsOverflowingX),ae="always"===d&&("scroll"===u||"auto"===u&&W.contentIsOverflowingY),se=W.domSizes,ue=(N(n={},ee.scrollbarXOffset,ie&&se.scrollbarX.height?se.scrollbarX.height+"px":0),N(n,ee.scrollbarYOffset,ae&&se.scrollbarY.width?se.scrollbarY.width+"px":0),N(n,ee.positionWidth,se.position.width?se.position.width+"px":"auto"),N(n,ee.positionHeight,se.position.height?se.position.height+"px":"auto"),n);return r.createElement(pe.Provider,{value:q},r.createElement(ne.Provider,{value:L},r.createElement(le.Provider,{value:re},r.createElement(ce.Provider,{value:W},r.createElement(f,D({},R,{selector:a,ref:oe,style:_(_({},R.style),ue),onPointerEnter:p(e.onPointerEnter,G),onPointerLeave:p(e.onPointerLeave,J)}))))))})),ge=r.forwardRef((function(e,t){var n=e.selector,o=void 0===n?l("ScrollAreaViewport"):n,i=Q(e,["selector"]),c=oe("ScrollAreaViewport"),s=c.positionRef,u=c.thumbXRef,d=c.thumbYRef,v=c.trackXRef,h=c.trackYRef,m=c.viewportRef,y=ae("ScrollAreaViewport"),w=y.onScroll,g=y.overflowX,x=y.overflowY,R=y.scrollbarVisibility,E=se(),A=ve("ScrollAreaViewport"),T=b(t,m);Fe(m,(function(e){A({type:K.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));var I=r.useCallback((function(){var e=s.current,t=u.current,r=d.current,n=v.current,o=h.current;t&&n&&e&&Et({thumbElement:t,trackElement:n,axis:"x",positionElement:e}),r&&o&&e&&Et({thumbElement:r,trackElement:o,axis:"y",positionElement:e})}),[s,u,d,v,h]),k=r.useRef(0),P=r.useRef(0);var O=p(w,(function(){s.current&&(I(),function(){if(s.current){var e=s.current.scrollTop,t=s.current.scrollLeft,r=e!==k.current,n=t!==P.current;r===E.scrollbarIsVisibleY&&n===E.scrollbarIsVisibleX||A({type:K.SetScrollbarIsVisible,scrollbarVisibility:R,x:n,y:r}),k.current=e<=0?0:e,P.current=t<=0?0:t}}())}));return S((function(){I()}),[I]),S((function(){var e=s.current;if(e){var t=xt(e,{axis:"x"}),r=xt(e,{axis:"y"});t===E.contentIsOverflowingX&&r===E.contentIsOverflowingY||A({type:K.SetContentOverflowing,x:t,y:r})}}),[E.contentIsOverflowingX,E.contentIsOverflowingY,A,s,E.domSizes.position.height,E.domSizes.position.width,E.domSizes.viewport.height,E.domSizes.viewport.width]),r.createElement("div",D({},o?a(o+"-position"):void 0,{ref:s,onScroll:O,style:{zIndex:1,width:"var(".concat(ee.positionWidth,")"),height:"var(".concat(ee.positionHeight,")"),scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:g,overflowY:x}}),r.createElement("div",D({},o?a(o+"-position-inner"):void 0,{style:{display:"table",width:"100%",paddingBottom:"var(".concat(ee.scrollbarXOffset,")"),paddingRight:"var(".concat(ee.scrollbarYOffset,")")}}),r.createElement(f,D({selector:o},i,{ref:T}))))})),xe=r.forwardRef((function(e,t){return fe()?r.createElement(f,D({},e,{selector:e.selector||l("ScrollAreaViewport"),ref:t})):r.createElement(ge,D({},e,{ref:t}))}));exports.ScrollAreaViewport=xe,xe.displayName="ScrollAreaViewport";var Re=F(v("ScrollbarContext","ScrollAreaScrollbar"),2),Ee=Re[0],Ae=Re[1],Te=r.forwardRef((function(e,t){var n,o=e.axis,i=e.name,l=e.onWheel,a=e.onPointerDown,c=e.onPointerUp,s=e.onPointerMove,u=Q(e,["axis","name","onWheel","onPointerDown","onPointerUp","onPointerMove"]),d=ve(i),v=ae(i),h=v.scrollbarVisibility,m=v.scrollbarVisibilityRestTimeout,S=v.isHovered,w=se(),g=w["x"===o?"contentIsOverflowingX":"contentIsOverflowingY"],x=w["x"===o?"scrollbarIsVisibleX":"scrollbarIsVisibleY"],R=oe(i),E=R.positionRef,A=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(o,R),T=b(A,t),I=y((function(){return new X}));Fe(A,(function(e){d({type:K.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:o})}));var k=p(l,(function(e){var 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))})),P=r.useRef();function O(){clearTimeout(P.current),P.current=setTimeout((function(){d(N({type:K.SetScrollbarIsVisible,scrollbarVisibility:h},o,!1))}),m)}r.useEffect((function(){if(x)return P.current=setTimeout((function(){d(N({type:K.SetScrollbarIsVisible,scrollbarVisibility:h},o,!1))}),m),function(){clearTimeout(P.current)}}),[o,d,x,h,m]);var z=r.useRef(!1),C=p(a,(function(e){z.current=!0,clearTimeout(P.current)})),Y=p(c,(function(e){z.current=!1,O()})),V=p(s,(function(e){z.current||O()})),L=function(){var e,t,r=(null===(e=u.style)||void 0===e?void 0:e.opacity)||1;switch(h){case"always":return null===(t=u.style)||void 0===t?void 0:t.opacity;case"scroll":return x?r:0;case"hover":return S||x?r:0}}(),H=function(){var e,t,r=(null===(e=u.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(h){case"always":return null===(t=u.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return x?r:"none";case"hover":return S||x?r:"none"}}(),B=r.useMemo((function(){return{axis:o,scrollAnimationQueue:I}}),[o,I]);return r.createElement(Ee.Provider,{value:B},r.createElement(f,D({},u,{ref:T,style:_(_({},u.style),{},{display:g?null===(n=u.style)||void 0===n?void 0:n.display:"none",opacity:L,pointerEvents:H}),onPointerDown:C,onPointerUp:Y,onPointerMove:V,onWheel:k})))})),Ie=r.forwardRef((function(e,t){var n=e.selector,o=void 0===n?l("ScrollAreaScrollbarX"):n,i=Q(e,["selector"]),a=se().domSizes;return fe()?null:r.createElement(Te,D({},i,{selector:o,ref:t,axis:"x",name:"ScrollAreaScrollbarX",style:_(_({},e.style),{},N({},ee.scrollbarXSize,a.scrollbarX.height?a.scrollbarX.height+"px":0))}))}));exports.ScrollAreaScrollbarX=Ie,Ie.displayName="ScrollAreaScrollbarX";var ke=r.forwardRef((function(e,t){var n=e.selector,o=void 0===n?l("ScrollAreaScrollbarY"):n,i=Q(e,["selector"]),a=se().domSizes;return fe()?null:r.createElement(Te,D({},i,{selector:o,ref:t,axis:"y",name:"ScrollAreaScrollbarY",style:_(_({},e.style),{},N({},ee.scrollbarYSize,a.scrollbarY.width?a.scrollbarY.width+"px":0))}))}));exports.ScrollAreaScrollbarY=ke,ke.displayName="ScrollAreaScrollbarY";var Pe=r.forwardRef((function(e,t){var n=e.selector,o=void 0===n?l("ScrollAreaTrack"):n,a=e.onPointerDown,c=Q(e,["selector","onPointerDown"]),u=Ae("ScrollAreaTrack"),d=u.axis,v=u.scrollAnimationQueue,y=ve("ScrollAreaTrack"),S=oe("ScrollAreaTrack"),w=ae("ScrollAreaTrack"),g=w.trackClickBehavior,x=w.prefersReducedMotion,R=S.positionRef,E=Ke(d,S),A=Je(d,S),T=b(E,t),I=m(a);Fe(E,(function(e){y({type:K.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:d})}));var k=r.useRef();return r.useEffect((function(){var e=null,t=null,r=et(E),n=tt(A),o=rt(R),l=h(R).ownerDocument,a=p(I,(function(a){if(s(a)&&a.target!==n&&!n.contains(a.target)){var f=function(e){var t=e.event,r=e.axis,n=e.thumbElement;return ft(t)[r]<n.getBoundingClientRect()["y"===r?"top":"left"]?"start":"end"}({event:a,axis:d,thumbElement:n});if(clearTimeout(t),"page"===g){if(y({type:K.StartTracking}),l.addEventListener("pointermove",c),l.addEventListener("pointerup",u),r.setPointerCapture(a.pointerId),x){var p=ot({direction:f,positionElement:o,axis:d}),h=St(o,{direction:f,distance:p,axis:d});at(o,{axis:d,value:h})}else v.enqueue((function(){return Ue({duration:200,timing:O(.16,0,.73,1),draw:$e({positionElement:o,direction:f,axis:d}),rafIdRef:k})}));return e=setTimeout((function(){var t=ft(a),n=nt({axis:d,direction:f,pointerPosition:t,positionElement:o,trackElement:r});if(!("start"===f&&n>0||"end"===f&&n<0)){if(x){var l=St(o,{direction:f,distance:n,axis:d});at(o,{axis:d,value:l})}else{var c=Math.round(Math.abs(n)),s=i(c,[100,500]);v.enqueue((function(){return Ue({duration:s,timing:function(e){return e},draw:Ge({axis:d,direction:f,pointerPosition:t,positionElement:o,trackElement:r}),rafIdRef:k})}))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}var m=ft(a),b=nt({axis:d,direction:f,pointerPosition:m,positionElement:o,trackElement:r}),S=St(o,{direction:f,distance:b,axis:d});at(o,{axis:d,value:S});var w=new PointerEvent("pointerdown",a);requestAnimationFrame((function(){n.dispatchEvent(w)}))}}));return r.addEventListener("pointerdown",a),function(){cancelAnimationFrame(k.current),clearTimeout(e),clearTimeout(t),r.removeEventListener("pointerdown",a),l.removeEventListener("pointermove",c),l.removeEventListener("pointerup",u),y({type:K.StopTracking}),v.stop()};function c(t){"mouse"===t.pointerType&>(t,r)&&(clearTimeout(e),l.removeEventListener("pointermove",c),v.stop())}function u(n){r.releasePointerCapture(n.pointerId),clearTimeout(e),l.removeEventListener("pointermove",c),l.removeEventListener("pointerup",u),v.stop(),y({type:K.StopTracking}),t=setTimeout((function(){v.stop()}),200)}}),[d,x,g,y,I,R,v,A,E]),r.createElement(f,D({},c,{selector:o,ref:T,"data-axis":d}))}));exports.ScrollAreaTrack=Pe,Pe.displayName="ScrollAreaTrack";var Oe=r.forwardRef((function(e,t){var n,o,i=e.selector,a=void 0===i?l("ScrollAreaThumb"):i,c=e.onPointerDown,u=Q(e,["selector","onPointerDown"]),d=Ae("ScrollAreaThumb").axis,v=oe("ScrollAreaThumb"),y=ve("ScrollAreaThumb"),w=v.positionRef,g=Je(d,v),x=Ke(d,v),R=b(g,t),E=se(),A=m(c),T=r.useRef(0),I=r.useRef(0),k=r.useRef({size:0,positionStart:0}),P=r.useRef({size:0,positionStart:0}),O=r.useRef(!1);S((function(){O.current?Et({thumbElement:tt(g),trackElement:et(x),positionElement:rt(w),axis:d}):O.current=!0}),[g,x,w,d].concat(W(wt(E.domSizes))));var z="x"===d?E.domSizes.trackX.width:E.domSizes.trackY.height,C=r.useRef(z);S((function(){C.current=z})),r.useEffect((function(){var e=tt(g),t=et(x),r=rt(w),n=h(w).ownerDocument,o=p(A,(function(r){if(s(r)){var o=ft(r)[d];k.current=ut(e,{axis:d}),P.current=ut(t,{axis:d}),I.current=o,T.current=o,e.setPointerCapture(r.pointerId),n.addEventListener("pointerup",a),n.addEventListener("pointermove",l),y({type:K.StartThumbing})}}));return e.addEventListener("pointerdown",o),function(){e.removeEventListener("pointerdown",o),i()};function i(){n.removeEventListener("pointermove",l),n.removeEventListener("pointerup",a),y({type:K.StopThumbing})}function l(e){var t=ft(e)[d],n=t-I.current,o=C.current;if(Rt(r,{axis:d,delta:n})){var i=P.current.positionStart,l=k.current.positionStart,a=T.current-l,c=Math.round(t-i),s=Math.round((c-a)/o*100)/100,u=st(r,{axis:d});at(r,{axis:d,value:s*u}),I.current=t,y({type:K.StartThumbing})}}function a(t){e.releasePointerCapture(t.pointerId),i()}}),[d,A,y,w,v,g,x]);var X=F(r.useState({}),2),Y=X[0],V=X[1];return S((function(){var e=w.current,t=x.current;V(function(e){var t=e.trackElement,r=e.positionElement,n=e.axis;if(!t||!r)return{};var o=it(r,{axis:n}),i=ct(t,{axis:n}),l=o*i;if(!xt(r,{axis:n}))return{display:"none",width:0,height:0};return N({},"x"===n?"width":"height",l)}({positionElement:e,trackElement:t,axis:d}))}),[d,w,x].concat(W(wt(E.domSizes)))),r.createElement(f,D({},u,{selector:a,ref:R,"data-axis":d,style:_(_(_({},u.style),Y),"x"===d?(n={},N(n,ee.scrollbarThumbWillChange,"left"),N(n,ee.scrollbarThumbHeight,"100%"),N(n,ee.scrollbarThumbWidth,"auto"),n):(o={},N(o,ee.scrollbarThumbWillChange,"top"),N(o,ee.scrollbarThumbHeight,"auto"),N(o,ee.scrollbarThumbWidth,"100%"),o))}))}));exports.ScrollAreaThumb=Oe,Oe.displayName="ScrollAreaThumb";var ze=r.forwardRef((function(e,t){var n=e.direction,o=e.name,i=e.onPointerDown,l=Q(e,["direction","name","onPointerDown"]),a=Ae(o),c=a.axis,u=a.scrollAnimationQueue,d=ve(o),v=oe(o),y=ae(o).prefersReducedMotion,S=v.positionRef,w=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,c,v),g=b(w,t),x=r.useRef(),R=m(i);return r.useEffect((function(){var e,t=function(e,t){var r="end"===t?"ScrollAreaButtonEnd":"ScrollAreaButtonStart";return Ze(e,"A ref for ".concat(r," was not placed as expected. ").concat(r," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}(w,n),r=rt(S),o=h(S).ownerDocument,i=null,l=p(R,(function(l){if(s(l)){t.setPointerCapture(l.pointerId),o.addEventListener("pointerup",f),o.addEventListener("pointermove",a),d({type:K.StartButtonPress});var p="start"===n?-1:1;y?dt(r,{axis:c,value:51*p}):Rt(r,{axis:c,delta:p})&&u.enqueue((function(){return Ue({duration:135,timing:O(.16,0,.73,1),draw:function(e){dt(r,{axis:c,value:15*e*p})},rafIdRef:x})})),e=setTimeout((function(){if(y)i=setInterval((function(){Rt(r,{axis:c,delta:p})?dt(r,{axis:c,value:60*p}):clearInterval(i)}),135);else{var n=l.pointerId;!function e(){Rt(r,{axis:c,delta:p})&&u.enqueue((function(){return Ue({duration:135,timing:function(e){return e},draw:function(e){dt(r,{axis:c,value:e*(15*p)})},done:t.hasPointerCapture(n)?e:void 0,rafIdRef:x})}))}()}clearTimeout(e)}),400)}}));return t.addEventListener("pointerdown",l),function(){t.removeEventListener("pointerdown",l),o.removeEventListener("pointerup",f),o.removeEventListener("pointermove",a),clearTimeout(e),clearInterval(i),cancelAnimationFrame(x.current),d({type:K.StopButtonPress})};function a(r){"mouse"===r.pointerType&>(r,t)&&(clearTimeout(e),o.removeEventListener("pointermove",a))}function f(r){clearTimeout(e),clearInterval(i),t.releasePointerCapture(r.pointerId),t.removeEventListener("pointerup",f),d({type:K.StopButtonPress})}}),[c,n,y,w,d,R,u,S]),r.createElement(f,D({},l,{ref:g,"data-axis":c}))})),Ce=r.forwardRef((function(e,t){var n=e.selector,o=void 0===n?l("ScrollAreaButtonStart"):n,i=Q(e,["selector"]);return r.createElement(ze,D({},i,{selector:o,ref:t,name:"ScrollAreaButtonStart",direction:"start"}))}));exports.ScrollAreaButtonStart=Ce,Ce.displayName="ScrollAreaButtonStart";var Xe=r.forwardRef((function(e,t){var n=e.selector,o=void 0===n?l("ScrollAreaButtonEnd"):n,i=Q(e,["selector"]);return r.createElement(ze,D({},i,{selector:o,ref:t,name:"ScrollAreaButtonEnd",direction:"end"}))}));exports.ScrollAreaButtonEnd=Xe,Xe.displayName="ScrollAreaButtonEnd";var Ye=r.forwardRef((function(e,t){var n,o=e.selector,i=void 0===o?l("ScrollAreaCorner"):o,a=Q(e,["selector"]),c=oe("ScrollAreaCorner").positionRef,s=ve("ScrollAreaCorner"),u=ae("ScrollAreaCorner").dir,d=se().domSizes,p="rtl"===u,v=(N(n={},ee.cornerLeft,p?0:"unset"),N(n,ee.cornerRight,p?"unset":0),N(n,ee.cornerHeight,d.scrollbarX.height?d.scrollbarX.height+"px":d.scrollbarY.width?d.scrollbarY.width+"px":"16px"),N(n,ee.cornerWidth,d.scrollbarY.width?d.scrollbarY.width+"px":d.scrollbarX.height?d.scrollbarX.height+"px":"16px"),N(n,"position","absolute"),n);return S((function(){if(c.current){var e=h(c).ownerWindow.getComputedStyle(c.current);s({type:K.SetExplicitResize,value:e.resize})}}),[s,c]),r.createElement(f,D({},a,{selector:i,ref:t,style:_(_({},e.style),v)}))})),Ve=r.forwardRef((function(e,t){return fe()?null:r.createElement(Ye,D({},e,{ref:t}))}));exports.ScrollAreaCorner=Ve,Ve.displayName="ScrollAreaCorner";var Le=he;exports.Root=Le;var He=xe;exports.Viewport=He;var Be=Ie;exports.ScrollbarX=Be;var je=ke;exports.ScrollbarY=je;var Me=Ce;exports.ButtonStart=Me;var We=Xe;exports.ButtonEnd=We;var De=Pe;exports.Track=De;var qe=Oe;exports.Thumb=qe;var _e=Ve;exports.Corner=_e;var Ne=me;function Qe(e,t){switch(t.type){case K.SetExplicitResize:return _(_({},e),{},{explicitResize:t.value});case K.HandleScrollAreaResize:var r=t.scrollAreaComputedStyle,n=parseInt(r.borderTopWidth),o=parseInt(r.borderRightWidth),i=parseInt(r.borderBottomWidth),l=parseInt(r.borderLeftWidth),a=parseInt(r.paddingTop),c=parseInt(r.paddingRight),s=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-a-s}})});case K.SetContentOverflowing:return _(_({},e),{},{contentIsOverflowingX:t.x,contentIsOverflowingY:t.y});case K.SetScrollbarIsVisible:var f,d;return"always"===t.scrollbarVisibility?_(_({},e),{},{scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}):_(_({},e),{},{scrollbarIsVisibleX:null!==(f=t.x)&&void 0!==f?f:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(d=t.y)&&void 0!==d?d:e.scrollbarIsVisibleY});case K.HandleViewportResize:return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},{viewport:{width:t.width,height:t.height}})});case K.HandleScrollbarResize:return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},N({},"x"===t.axis?"scrollbarX":"scrollbarY",{height:t.height,width:t.width}))});case K.HandleTrackResize:return _(_({},e),{},{domSizes:_(_({},e.domSizes),{},N({},"x"===t.axis?"trackX":"trackY",{height:t.height,width:t.width}))});case K.StartTracking:return _(_({},e),{},{state:G.Tracking});case K.StopTracking:return _(_({},e),{},{state:G.Idle});case K.StartThumbing:return _(_({},e),{},{state:G.Thumbing});case K.StopThumbing:return _(_({},e),{},{state:G.Idle});case K.StartButtonPress:return _(_({},e),{},{state:G.ButtonScrolling});case K.StopButtonPress:return _(_({},e),{},{state:G.Idle})}return e}function Fe(e,t){var r=m(t);S((function(){var t,n=e.current;if(n){var o=new ResizeObserver((function(e){var t=F(e,1)[0],n=c(t);r(n,t.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 Ue(e){var t=e.duration,r=e.draw,n=e.timing,o=e.done,l=e.rafIdRef;return new Promise((function(e){var a=performance.now(),c=!1;l.current=requestAnimationFrame((function s(u){var f=i((u-(a=u<a?u:a))/t,[0,1]);r(n(f)),f<1?!c&&(l.current=requestAnimationFrame(s)):(c=!0,cancelAnimationFrame(l.current),e("done"),o&&o())}))}))}function $e(e){var t=e.axis,r=e.direction,n=e.positionElement,o=ot({axis:t,direction:r,positionElement:n});return function(e){var i=o*Math.min(e,1),l=St(n,{direction:r,distance:i,axis:t});o-=i,at(n,{axis:t,value:l})}}function Ge(e){var t=e.axis,r=e.direction,n=e.pointerPosition,o=e.positionElement,i=e.trackElement,l=nt({axis:t,direction:r,pointerPosition:n,positionElement:o,trackElement:i});return function(e){var n=Math.pow(10,3),i=Math.round(l*Math.min(e,1)*n)/n,a=St(o,{direction:r,distance:i,axis:t});l-=i,at(o,{axis:t,value:a})}}function Je(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function Ke(e,t){return"x"===e?t.trackXRef:t.trackYRef}function Ze(e,t){var r=e.current;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function et(e){return Ze(e,"A ref for ".concat("ScrollAreaTrack"," was not placed as expected. ").concat("ScrollAreaTrack"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function tt(e){return Ze(e,"A ref for ".concat("ScrollAreaThumb"," was not placed as expected. ").concat("ScrollAreaThumb"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function rt(e){return Ze(e,"A ref for an internal component in ".concat("ScrollAreaViewport"," was not placed as expected. ").concat("ScrollAreaViewport"," should always be used within a ").concat("ScrollArea"," component, and it should not be rendered conditionally."))}function nt(e){var t=e.axis,r=e.direction,n=e.pointerPosition,o=e.positionElement,i=e.trackElement,l=lt(o,{axis:t}),a=st(o,{axis:t}),c=ct(o,{axis:t}),s=ut(i,{axis:t}),u=s.positionStart,f=s.size,d=Math.round(n[t]-u),p=Math.round(d/f*100)/100,v="start"===r?p*a:p*a-c;return v<l?v-l-c/2:v-l+c/2}function ot(e){var t=e.axis,r=e.direction;return(ct(e.positionElement,{axis:t})-40)*("end"===r?1:-1)}function it(e,t){var r=t.axis,n=st(e,{axis:r});return ct(e,{axis:r})/n}function lt(e,t){return e["x"===t.axis?"scrollLeft":"scrollTop"]}function at(e,t){var r=t.axis,n=t.value;e["x"===r?"scrollLeft":"scrollTop"]=n}function ct(e,t){return e["x"===t.axis?"clientWidth":"clientHeight"]}function st(e,t){return e["x"===t.axis?"scrollWidth":"scrollHeight"]}function ut(e,t){var r=t.axis,n=e.getBoundingClientRect();return{coord:n[r],positionStart:n["y"===r?"top":"left"],positionEnd:n["y"===r?"bottom":"right"],size:n["y"===r?"height":"width"]}}function ft(e){return{x:e.clientX,y:e.clientY}}function dt(e,t){var r=t.axis,n=t.value;e["x"===r?"scrollLeft":"scrollTop"]+=n}function pt(e){return!(!e||0!==e.scrollTop)}function vt(e){return!(!e||e.scrollLeft!==yt(e))}function ht(e){return!(!e||e.scrollTop!==bt(e))}function mt(e){return!(!e||0!==e.scrollLeft)}function bt(e){return e.scrollHeight-e.clientHeight}function yt(e){return e.scrollWidth-e.clientWidth}function St(e,t){var r=t.direction,n=t.distance,o=t.axis,i=e["x"===o?"scrollLeft":"scrollTop"]+n,l="end"===r?function(e,t){return"x"===t?yt(e):bt(e)}(e,o):0;return"end"===r?Math.min(l,i):Math.max(l,i)}function wt(e){for(var t=[],r=0,n=Object.keys(e);r<n.length;r++){var o=e[n[r]];t.push(o.height,o.width)}return t}function gt(e,t,r){r=r||t.getBoundingClientRect();var n=ft(e);return n.x<r.left||n.x>r.right||n.y<r.top||n.y>r.bottom}function xt(e,t){return it(e,{axis:t.axis})<1}function Rt(e,t){var r=t.axis,n=t.delta;return!(0===n||n<0&&("x"===r?mt:pt)(e)||n>0&&("x"===r?vt:ht)(e))}function Et(e){var t=e.thumbElement,r=e.positionElement,n=e.axis,o=st(r,{axis:n}),i=ct(r,{axis:n}),l=lt(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left="".concat(100*l,"%"):"y"===n&&(t.style.top="".concat(100*l,"%")))}exports.unstable_ScrollAreaNoNativeFallback=Ne; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import*as e from"react";import{canUseDOM as t,clamp as r,getSelector as n,getSelectorObj as o,getResizeObserverEntryBorderBoxSize as i,isMainClick as l,namespaced as s}from"@radix-ui/utils";import{Primitive as c}from"@radix-ui/react-primitive";import{composeEventHandlers as a,createContext as u,getOwnerGlobals as d,useCallbackRef as f,useComposedRefs as p,useConstant as h,useLayoutEffect as m,usePrefersReducedMotion as S}from"@radix-ui/react-utils";const b="function"==typeof Float32Array;function v(e,t){return 1-3*t+3*e}function R(e,t){return 3*t-6*e}function w(e){return 3*e}function g(e,t,r){return((v(t,r)*e+R(t,r))*e+w(t))*e}function x(e,t,r){return 3*v(t,r)*e*e+2*R(t,r)*e+w(t)}function y(e){return e}function E(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 y;const o=b?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)o[t]=g(.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=x(l,e,r);return s>=.001?function(e,t,r,n){for(let o=0;o<4;++o){const o=x(t,r,n);if(0===o)return t;t-=(g(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=g(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:g(i(e),t,n)}}function P(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var A,O;(O=A||(A={}))[O.Idle=0]="Idle",O[O.Stopped=1]="Stopped",O[O.Queuing=2]="Queuing",O[O.Pending=3]="Pending",O[O.Resolved=4]="Resolved",O[O.Error=5]="Error";class T{constructor(){P(this,"queue",[]),P(this,"_state",A.Idle)}restart(){this.state===A.Stopped&&(this._state=A.Idle)}rejectItem(e,t){this.stateIs(A.Pending,A.Queuing)&&(this._state=this.isEmpty()?A.Error:A.Queuing,e(t),this.dequeue())}resolveItem(e,t){this.stateIs(A.Pending,A.Queuing)&&(this._state=this.isEmpty()?A.Resolved:A.Queuing,e(t),this.dequeue())}get isBusy(){return this.state===A.Queuing||this.state===A.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(A.Error,A.Resolved,A.Idle,A.Queuing)){if(this.isEmpty())return;const e=this.queue.shift();try{this._state=A.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(A.Pending,A.Queuing)&&(this._state=A.Stopped,this.queue=[])}}let L=!1,I=0;function C(e){"touch"===e.pointerType&&(L=!0,setTimeout((function(){L=!1}),50))}function _(){if("undefined"!=typeof document)return document.addEventListener("pointerup",C),I++,function(){I--,I>0||document.removeEventListener("pointerup",C)}}function k(t={}){const{onHoverStart:r,onHoverChange:n,onHoverEnd:o,isDisabled:i}=t,[l,s]=e.useState(!1),c=e.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;e.useEffect(_,[]);return{hoverProps:e.useMemo((function(){return{onPointerEnter(e){L&&"mouse"===e.pointerType||function(e,t){if(i||"touch"===t||c.isHovered)return;c.isHovered=!0;const o=e.target;r&&r({type:"hoverstart",target:o,pointerType:t}),n&&n(!0),s(!0)}(e,e.pointerType)},onPointerLeave(e){!function(e,t){if(i||"touch"===t||!c.isHovered)return;c.isHovered=!1;const r=e.target;o&&o({type:"hoverend",target:r,pointerType:t}),n&&n(!1),s(!1)}(e,e.pointerType)}}}),[i,c,r,n,o]),isHovered:l}}function z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?X(Object(r),!0).forEach((function(t){V(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}export const SCROLL_AREA_CSS_PROPS=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return Y(Y({},e),{},{[t]:(n=t,"--".concat(s("ScrollArea".concat((r=n,r.charAt(0).toUpperCase()+r.slice(1))))))});var r;var n}),{});var B,M,j,W;(M=B||(B={})).Idle="Idle",M.Thumbing="Thumbing",M.Tracking="Tracking",M.ButtonScrolling="ButtonScrolling",(W=j||(j={}))[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 D="ScrollArea",q={overflowX:"auto",overflowY:"auto",scrollbarVisibility:"hover",scrollbarVisibilityRestTimeout:600,dir:"ltr",trackClickBehavior:"relative",unstable_prefersReducedMotion:!1},[N,Q]=u("ScrollAreaRefsContext",D),[F,U]=u("ScrollAreaContext",D),G=e.createContext({});function J(){return e.useContext(G)}G.displayName="ScrollAreaStateContext";const K=e.createContext(!0),Z=()=>e.useContext(K),[$,ee]=u("DispatchContext",D);export const ScrollArea=e.forwardRef((function(r,n){const o=Y(Y({},q),r),{unstable_forceNative:i=!1,children:l}=o,s=H(o,["unstable_forceNative","children"]),[c,a]=e.useState(!0);m((()=>{a(i||!("ResizeObserver"in window&&function(){var e,r;if(!t())return!1;let n=!1;try{document.querySelector("::-webkit-scrollbar"),n=!0}catch(e){}return!(!(null===(e=window.CSS)||void 0===e||null===(r=e.supports)||void 0===r?void 0:r.call(e,"scrollbar-width: none"))&&!n)}()))}),[i]);const u=c?re:ie,d=e.useRef(null),f=e.useRef(null);return function(t,r,n){e.useImperativeHandle(t,(()=>{const e=r.current,t=n.current||e,o={scrollIntent(...e){t.scroll.call(t,...e)},scrollByIntent(...e){t.scrollBy.call(t,...e)},scrollIntoViewIntent(...e){t.scrollIntoView.call(t,...e)},scrollToIntent(...e){t.scrollTo.call(t,...e)},get scrollTopIntent(){return t.scrollTop},set scrollTopIntent(e){t.scrollTop=e},get scrollLeftIntent(){return t.scrollLeft},set scrollLeftIntent(e){t.scrollLeft=e},get scrollHeightIntent(){return t.scrollHeight},get scrollWidthIntent(){return t.scrollWidth},addScrollListener(...e){t.addEventListener("scroll",...e)},removeScrollListener(...e){t.removeEventListener("scroll",...e)}};return Object.assign(e,o)}))}(n,f,d),e.createElement(u,z({positionRef:d,scrollAreaRef:f},s,{ref:n}),e.createElement(K.Provider,{value:c},l))}));const te=e.forwardRef((function(t,r){const n=Y(Y({},q),t),{children:o}=n,i=H(n,["children"]),l=e.useRef(null),s=e.useRef(null);return e.createElement(ie,z({positionRef:l,scrollAreaRef:s},i,{ref:r}),e.createElement(K.Provider,{value:!1},o))})),re=e.forwardRef((function(t,r){const o=Y(Y({},q),t),{selector:i=n(D),overflowX:l,overflowY:s,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:u,trackClickBehavior:d,unstable_prefersReducedMotion:f,scrollAreaRef:h,positionRef:m}=o,S=H(o,["selector","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","scrollAreaRef","positionRef"]),b=p(h,r);return e.createElement(c,z({},S,{selector:i,ref:b,style:Y(Y({},S.style),{},{overflowX:l,overflowY:s,resize:"none"})}))})),ne={width:0,height:0},oe={state:B.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:ne,viewport:ne,position:ne,scrollbarY:ne,scrollbarX:ne,trackY:ne,trackX:ne}},ie=e.forwardRef((function(t,r){const o=Y(Y({},q),t),{selector:i=n(D),children:l,onScroll:s,overflowX:u,overflowY:h,scrollbarVisibility:m,scrollbarVisibilityRestTimeout:b,trackClickBehavior:v,unstable_prefersReducedMotion:R,positionRef:w,scrollAreaRef:g}=o,x=H(o,["selector","children","onScroll","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","positionRef","scrollAreaRef"]),y=f(s),E=e.useRef(null),P=e.useRef(null),A=e.useRef(null),O=e.useRef(null),T=e.useRef(null),L=e.useRef(null),I=e.useRef(null),C=e.useRef(null),_=e.useRef(null),X=e.useRef(null),V=e.useRef(null),B=e.useMemo((()=>({buttonDownRef:E,buttonLeftRef:P,buttonRightRef:A,buttonUpRef:O,viewportRef:T,positionRef:w,scrollAreaRef:g,scrollbarXRef:L,scrollbarYRef:I,thumbXRef:C,thumbYRef:_,trackXRef:X,trackYRef:V})),[]),M=S(g),W=null!=R?R:M,[Q,U]=e.useReducer(we,Y(Y({},oe),{},{scrollbarIsVisibleX:"always"===m,scrollbarIsVisibleY:"always"===m})),{hoverProps:{onPointerEnter:J,onPointerLeave:K},isHovered:Z}=k(),ee=e.useMemo((()=>({dir:t.dir,isHovered:Z,onScroll:y,overflowX:u,overflowY:h,prefersReducedMotion:W,scrollbarVisibility:m,scrollbarVisibilityRestTimeout:b,trackClickBehavior:v})),[t.dir,y,Z,u,h,W,m,b,v]),te=p(r,g);ge(g,((e,t)=>{const{ownerWindow:r}=d(g),n=r.getComputedStyle(t);U({type:j.HandleScrollAreaResize,scrollAreaComputedStyle:n,width:e.inlineSize,height:e.blockSize})}));const re="always"===m&&("scroll"===u||"auto"===u&&Q.contentIsOverflowingX),ne="always"===m&&("scroll"===h||"auto"===h&&Q.contentIsOverflowingY),{domSizes:ie}=Q,le={[SCROLL_AREA_CSS_PROPS.scrollbarXOffset]:re&&ie.scrollbarX.height?ie.scrollbarX.height+"px":0,[SCROLL_AREA_CSS_PROPS.scrollbarYOffset]:ne&&ie.scrollbarY.width?ie.scrollbarY.width+"px":0,[SCROLL_AREA_CSS_PROPS.positionWidth]:ie.position.width?ie.position.width+"px":"auto",[SCROLL_AREA_CSS_PROPS.positionHeight]:ie.position.height?ie.position.height+"px":"auto"};return e.createElement($.Provider,{value:U},e.createElement(N.Provider,{value:B},e.createElement(F.Provider,{value:ee},e.createElement(G.Provider,{value:Q},e.createElement(c,z({},x,{selector:i,ref:te,style:Y(Y({},x.style),le),onPointerEnter:a(t.onPointerEnter,J),onPointerLeave:a(t.onPointerLeave,K)}),l)))))})),le="ScrollAreaViewport",se=e.forwardRef((function(t,r){const{selector:i=n(le)}=t,l=H(t,["selector"]),{positionRef:s,thumbXRef:u,thumbYRef:d,trackXRef:f,trackYRef:h,viewportRef:S}=Q(le),{onScroll:b,overflowX:v,overflowY:R,scrollbarVisibility:w}=U(le),g=J(),x=ee(le),y=p(r,S);ge(S,(e=>{x({type:j.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));const E=e.useCallback((function(){const e=s.current,t=u.current,r=d.current,n=f.current,o=h.current;t&&n&&e&&Ze({thumbElement:t,trackElement:n,axis:"x",positionElement:e}),r&&o&&e&&Ze({thumbElement:r,trackElement:o,axis:"y",positionElement:e})}),[s,u,d,f,h]),P=e.useRef(0),A=e.useRef(0);const O=a(b,(function(){s.current&&(E(),function(){if(!s.current)return;const e=s.current.scrollTop,t=s.current.scrollLeft,r=e!==P.current,n=t!==A.current;r===g.scrollbarIsVisibleY&&n===g.scrollbarIsVisibleX||x({type:j.SetScrollbarIsVisible,scrollbarVisibility:w,x:n,y:r}),P.current=e<=0?0:e,A.current=t<=0?0:t}())}));return m((()=>{E()}),[E]),m((function(){const e=s.current;if(!e)return;const t=Je(e,{axis:"x"}),r=Je(e,{axis:"y"});t===g.contentIsOverflowingX&&r===g.contentIsOverflowingY||x({type:j.SetContentOverflowing,x:t,y:r})}),[g.contentIsOverflowingX,g.contentIsOverflowingY,x,s,g.domSizes.position.height,g.domSizes.position.width,g.domSizes.viewport.height,g.domSizes.viewport.width]),e.createElement("div",z({},i?o(i+"-position"):void 0,{ref:s,onScroll:O,style:{zIndex:1,width:"var(".concat(SCROLL_AREA_CSS_PROPS.positionWidth,")"),height:"var(".concat(SCROLL_AREA_CSS_PROPS.positionHeight,")"),scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:v,overflowY:R}}),e.createElement("div",z({},i?o(i+"-position-inner"):void 0,{style:{display:"table",width:"100%",paddingBottom:"var(".concat(SCROLL_AREA_CSS_PROPS.scrollbarXOffset,")"),paddingRight:"var(".concat(SCROLL_AREA_CSS_PROPS.scrollbarYOffset,")")}}),e.createElement(c,z({selector:i},l,{ref:y}))))}));export const ScrollAreaViewport=e.forwardRef((function(t,r){return Z()?e.createElement(c,z({},t,{selector:t.selector||n(le),ref:r})):e.createElement(se,z({},t,{ref:r}))}));ScrollAreaViewport.displayName=le;const ce="ScrollAreaScrollbarX",ae="ScrollAreaScrollbarY",[ue,de]=u("ScrollbarContext","ScrollAreaScrollbar"),fe=e.forwardRef((function(t,r){var n;const{axis:o,name:i,onWheel:l,onPointerDown:s,onPointerUp:u,onPointerMove:d}=t,f=H(t,["axis","name","onWheel","onPointerDown","onPointerUp","onPointerMove"]),m=ee(i),{scrollbarVisibility:S,scrollbarVisibilityRestTimeout:b,isHovered:v}=U(i),{["x"===o?"contentIsOverflowingX":"contentIsOverflowingY"]:R,["x"===o?"scrollbarIsVisibleX":"scrollbarIsVisibleY"]:w}=J(),g=Q(i),{positionRef:x}=g,y=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(o,g),E=p(y,r),P=h((()=>new T));ge(y,(e=>{m({type:j.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:o})}));const A=a(l,(function(e){const t=Math.abs(e.deltaX),r=Math.abs(e.deltaY);x.current&&(t>0&&t>r&&(x.current.scrollLeft+=e.deltaX),r>0&&r>t&&(x.current.scrollTop+=e.deltaY))})),O=e.useRef();function L(){clearTimeout(O.current),O.current=setTimeout((()=>{m({type:j.SetScrollbarIsVisible,scrollbarVisibility:S,[o]:!1})}),b)}e.useEffect((()=>{if(w)return O.current=setTimeout((()=>{m({type:j.SetScrollbarIsVisible,scrollbarVisibility:S,[o]:!1})}),b),function(){clearTimeout(O.current)}}),[o,m,w,S,b]);const I=e.useRef(!1),C=a(s,(e=>{I.current=!0,clearTimeout(O.current)})),_=a(u,(e=>{I.current=!1,L()})),k=a(d,(e=>{I.current||L()})),X=function(){var e,t;const r=(null===(e=f.style)||void 0===e?void 0:e.opacity)||1;switch(S){case"always":return null===(t=f.style)||void 0===t?void 0:t.opacity;case"scroll":return w?r:0;case"hover":return v||w?r:0}}(),V=function(){var e,t;const r=(null===(e=f.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(S){case"always":return null===(t=f.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return w?r:"none";case"hover":return v||w?r:"none"}}(),B=e.useMemo((()=>({axis:o,scrollAnimationQueue:P})),[o,P]);return e.createElement(ue.Provider,{value:B},e.createElement(c,z({},f,{ref:E,style:Y(Y({},f.style),{},{display:R?null===(n=f.style)||void 0===n?void 0:n.display:"none",opacity:X,pointerEvents:V}),onPointerDown:C,onPointerUp:_,onPointerMove:k,onWheel:A})))}));export const ScrollAreaScrollbarX=e.forwardRef((function(t,r){const{selector:o=n(ce)}=t,i=H(t,["selector"]),{domSizes:l}=J();return Z()?null:e.createElement(fe,z({},i,{selector:o,ref:r,axis:"x",name:ce,style:Y(Y({},t.style),{},{[SCROLL_AREA_CSS_PROPS.scrollbarXSize]:l.scrollbarX.height?l.scrollbarX.height+"px":0})}))}));ScrollAreaScrollbarX.displayName=ce;export const ScrollAreaScrollbarY=e.forwardRef((function(t,r){const{selector:o=n(ae)}=t,i=H(t,["selector"]),{domSizes:l}=J();return Z()?null:e.createElement(fe,z({},i,{selector:o,ref:r,axis:"y",name:ae,style:Y(Y({},t.style),{},{[SCROLL_AREA_CSS_PROPS.scrollbarYSize]:l.scrollbarY.width?l.scrollbarY.width+"px":0})}))}));ScrollAreaScrollbarY.displayName=ae;const pe="ScrollAreaTrack";export const ScrollAreaTrack=e.forwardRef((function(t,o){const{selector:i=n(pe),onPointerDown:s}=t,u=H(t,["selector","onPointerDown"]),{axis:h,scrollAnimationQueue:m}=de(pe),S=ee(pe),b=Q(pe),{trackClickBehavior:v,prefersReducedMotion:R}=U(pe),{positionRef:w}=b,g=Ae(h,b),x=Pe(h,b),y=p(g,o),P=f(s);ge(g,(e=>{S({type:j.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:h})}));const A=e.useRef();return e.useEffect((()=>{let e=null,t=null;const n=Te(g),o=Le(x),i=Ie(w),{ownerDocument:s}=d(w),c=a(P,(function(c){if(!l(c)||c.target===o||o.contains(c.target))return;const a=function({event:e,axis:t,thumbElement:r}){const{[t]:n}=Be(e);return n<r.getBoundingClientRect()["y"===t?"top":"left"]?"start":"end"}({event:c,axis:h,thumbElement:o});if(clearTimeout(t),"page"===v){if(S({type:j.StartTracking}),s.addEventListener("pointermove",u),s.addEventListener("pointerup",f),n.setPointerCapture(c.pointerId),R){const e=_e({direction:a,positionElement:i,axis:h}),t=Fe(i,{direction:a,distance:e,axis:h});Xe(i,{axis:h,value:t})}else m.enqueue((()=>xe({duration:200,timing:E(.16,0,.73,1),draw:ye({positionElement:i,direction:a,axis:h}),rafIdRef:A})));return e=setTimeout((()=>{const t=Be(c),o=Ce({axis:h,direction:a,pointerPosition:t,positionElement:i,trackElement:n});if(!("start"===a&&o>0||"end"===a&&o<0)){if(R){const e=Fe(i,{direction:a,distance:o,axis:h});Xe(i,{axis:h,value:e})}else{const e=Math.round(Math.abs(o)),l=r(e,[100,500]);m.enqueue((()=>xe({duration:l,timing:e=>e,draw:Ee({axis:h,direction:a,pointerPosition:t,positionElement:i,trackElement:n}),rafIdRef:A})))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}{const e=Be(c),t=Ce({axis:h,direction:a,pointerPosition:e,positionElement:i,trackElement:n}),r=Fe(i,{direction:a,distance:t,axis:h});Xe(i,{axis:h,value:r});const l=new PointerEvent("pointerdown",c);requestAnimationFrame((()=>{o.dispatchEvent(l)}))}}));return n.addEventListener("pointerdown",c),function(){cancelAnimationFrame(A.current),clearTimeout(e),clearTimeout(t),n.removeEventListener("pointerdown",c),s.removeEventListener("pointermove",u),s.removeEventListener("pointerup",f),S({type:j.StopTracking}),m.stop()};function u(t){"mouse"===t.pointerType&&Ge(t,n)&&(clearTimeout(e),s.removeEventListener("pointermove",u),m.stop())}function f(r){n.releasePointerCapture(r.pointerId),clearTimeout(e),s.removeEventListener("pointermove",u),s.removeEventListener("pointerup",f),m.stop(),S({type:j.StopTracking}),t=setTimeout((()=>{m.stop()}),200)}}),[h,R,v,S,P,w,m,x,g]),e.createElement(c,z({},u,{selector:i,ref:y,"data-axis":h}))}));ScrollAreaTrack.displayName=pe;const he="ScrollAreaThumb";export const ScrollAreaThumb=e.forwardRef((function(t,r){const{selector:o=n(he),onPointerDown:i}=t,s=H(t,["selector","onPointerDown"]),{axis:u}=de(he),h=Q(he),S=ee(he),{positionRef:b}=h,v=Pe(u,h),R=Ae(u,h),w=p(v,r),g=J(),x=f(i),y=e.useRef(0),E=e.useRef(0),P=e.useRef({size:0,positionStart:0}),A=e.useRef({size:0,positionStart:0}),O=e.useRef(!1);m((()=>{if(!O.current)return void(O.current=!0);Ze({thumbElement:Le(v),trackElement:Te(R),positionElement:Ie(b),axis:u})}),[v,R,b,u,...Ue(g.domSizes)]);const T="x"===u?g.domSizes.trackX.width:g.domSizes.trackY.height,L=e.useRef(T);m((()=>{L.current=T})),e.useEffect((()=>{const e=Le(v),t=Te(R),r=Ie(b),{ownerDocument:n}=d(b),o=a(x,(function(r){if(!l(r))return;const o=Be(r)[u];P.current=He(e,{axis:u}),A.current=He(t,{axis:u}),E.current=o,y.current=o,e.setPointerCapture(r.pointerId),n.addEventListener("pointerup",c),n.addEventListener("pointermove",s),S({type:j.StartThumbing})}));return e.addEventListener("pointerdown",o),function(){e.removeEventListener("pointerdown",o),i()};function i(){n.removeEventListener("pointermove",s),n.removeEventListener("pointerup",c),S({type:j.StopThumbing})}function s(e){const t=Be(e)[u],n=t-E.current,o=L.current;if(Ke(r,{axis:u,delta:n})){const{positionStart:e}=A.current,{positionStart:n}=P.current,i=y.current-n,l=Math.round(t-e),s=Math.round((l-i)/o*100)/100,c=Ve(r,{axis:u});Xe(r,{axis:u,value:s*c}),E.current=t,S({type:j.StartThumbing})}}function c(t){e.releasePointerCapture(t.pointerId),i()}}),[u,x,S,b,h,v,R]);const[I,C]=e.useState({});return m((()=>{const e=b.current,t=R.current;C(function(e){const{trackElement:t,positionElement:r,axis:n}=e;if(!t||!r)return{};const o=ke(r,{axis:n}),i=Ye(t,{axis:n}),l=o*i;if(!Je(r,{axis:n}))return{display:"none",width:0,height:0};return{["x"===n?"width":"height"]:l}}({positionElement:e,trackElement:t,axis:u}))}),[u,b,R,...Ue(g.domSizes)]),e.createElement(c,z({},s,{selector:o,ref:w,"data-axis":u,style:Y(Y(Y({},s.style),I),"x"===u?{[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=he;const me="ScrollAreaButtonStart",Se="ScrollAreaButtonEnd",be=e.forwardRef((function(t,r){const{direction:n,name:o,onPointerDown:i}=t,s=H(t,["direction","name","onPointerDown"]),{axis:u,scrollAnimationQueue:h}=de(o),m=ee(o),S=Q(o),{prefersReducedMotion:b}=U(o),{positionRef:v}=S,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}}(n,u,S),w=p(R,r),g=e.useRef(),x=f(i);return e.useEffect((()=>{const e=function(e,t){const r="end"===t?Se:me;return Oe(e,"A ref for ".concat(r," was not placed as expected. ").concat(r," should always be used within a ").concat(D," component, and it should not be rendered conditionally."))}(R,n),t=Ie(v),{ownerDocument:r}=d(v);let o,i=null;const s=a(x,(function(s){if(!l(s))return;e.setPointerCapture(s.pointerId),r.addEventListener("pointerup",f),r.addEventListener("pointermove",c),m({type:j.StartButtonPress});const a="start"===n?-1:1;b?Me(t,{axis:u,value:51*a}):Ke(t,{axis:u,delta:a})&&h.enqueue((()=>xe({duration:135,timing:E(.16,0,.73,1),draw(e){Me(t,{axis:u,value:15*e*a})},rafIdRef:g}))),o=setTimeout((()=>{if(b)i=setInterval((()=>{Ke(t,{axis:u,delta:a})?Me(t,{axis:u,value:60*a}):clearInterval(i)}),135);else{const r=s.pointerId;!function n(){Ke(t,{axis:u,delta:a})&&h.enqueue((()=>xe({duration:135,timing:e=>e,draw(e){Me(t,{axis:u,value:e*(15*a)})},done:e.hasPointerCapture(r)?n:void 0,rafIdRef:g})))}()}clearTimeout(o)}),400)}));return e.addEventListener("pointerdown",s),function(){e.removeEventListener("pointerdown",s),r.removeEventListener("pointerup",f),r.removeEventListener("pointermove",c),clearTimeout(o),clearInterval(i),cancelAnimationFrame(g.current),m({type:j.StopButtonPress})};function c(t){"mouse"===t.pointerType&&Ge(t,e)&&(clearTimeout(o),r.removeEventListener("pointermove",c))}function f(t){clearTimeout(o),clearInterval(i),e.releasePointerCapture(t.pointerId),e.removeEventListener("pointerup",f),m({type:j.StopButtonPress})}}),[u,n,b,R,m,x,h,v]),e.createElement(c,z({},s,{ref:w,"data-axis":u}))}));export const ScrollAreaButtonStart=e.forwardRef((function(t,r){const{selector:o=n(me)}=t,i=H(t,["selector"]);return e.createElement(be,z({},i,{selector:o,ref:r,name:me,direction:"start"}))}));ScrollAreaButtonStart.displayName=me;export const ScrollAreaButtonEnd=e.forwardRef((function(t,r){const{selector:o=n(Se)}=t,i=H(t,["selector"]);return e.createElement(be,z({},i,{selector:o,ref:r,name:Se,direction:"end"}))}));ScrollAreaButtonEnd.displayName=Se;const ve="ScrollAreaCorner",Re=e.forwardRef((function(t,r){const{selector:o=n(ve)}=t,i=H(t,["selector"]),{positionRef:l}=Q(ve),s=ee(ve),{dir:a}=U(ve),{domSizes:u}=J(),f="rtl"===a,p={[SCROLL_AREA_CSS_PROPS.cornerLeft]:f?0:"unset",[SCROLL_AREA_CSS_PROPS.cornerRight]:f?"unset":0,[SCROLL_AREA_CSS_PROPS.cornerHeight]:u.scrollbarX.height?u.scrollbarX.height+"px":u.scrollbarY.width?u.scrollbarY.width+"px":"16px",[SCROLL_AREA_CSS_PROPS.cornerWidth]:u.scrollbarY.width?u.scrollbarY.width+"px":u.scrollbarX.height?u.scrollbarX.height+"px":"16px",position:"absolute"};return m((()=>{if(l.current){const{ownerWindow:e}=d(l),t=e.getComputedStyle(l.current);s({type:j.SetExplicitResize,value:t.resize})}}),[s,l]),e.createElement(c,z({},i,{selector:o,ref:r,style:Y(Y({},t.style),p)}))}));export const ScrollAreaCorner=e.forwardRef((function(t,r){return Z()?null:e.createElement(Re,z({},t,{ref:r}))}));ScrollAreaCorner.displayName=ve;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=te;function we(e,t){switch(t.type){case j.SetExplicitResize:return Y(Y({},e),{},{explicitResize:t.value});case j.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 Y(Y({},e),{},{domSizes:Y(Y({},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 j.SetContentOverflowing:return Y(Y({},e),{},{contentIsOverflowingX:t.x,contentIsOverflowingY:t.y});case j.SetScrollbarIsVisible:var r,n;return"always"===t.scrollbarVisibility?Y(Y({},e),{},{scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}):Y(Y({},e),{},{scrollbarIsVisibleX:null!==(r=t.x)&&void 0!==r?r:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(n=t.y)&&void 0!==n?n:e.scrollbarIsVisibleY});case j.HandleViewportResize:return Y(Y({},e),{},{domSizes:Y(Y({},e.domSizes),{},{viewport:{width:t.width,height:t.height}})});case j.HandleScrollbarResize:return Y(Y({},e),{},{domSizes:Y(Y({},e.domSizes),{},{["x"===t.axis?"scrollbarX":"scrollbarY"]:{height:t.height,width:t.width}})});case j.HandleTrackResize:return Y(Y({},e),{},{domSizes:Y(Y({},e.domSizes),{},{["x"===t.axis?"trackX":"trackY"]:{height:t.height,width:t.width}})});case j.StartTracking:return Y(Y({},e),{},{state:B.Tracking});case j.StopTracking:return Y(Y({},e),{},{state:B.Idle});case j.StartThumbing:return Y(Y({},e),{},{state:B.Thumbing});case j.StopThumbing:return Y(Y({},e),{},{state:B.Idle});case j.StartButtonPress:return Y(Y({},e),{},{state:B.ButtonScrolling});case j.StopButtonPress:return Y(Y({},e),{},{state:B.Idle})}return e}function ge(e,t){const r=f(t);m((()=>{var t;const n=e.current;if(!n)return;const o=new ResizeObserver((([e])=>{const t=i(e);r(t,e.target)})),l=n.getBoundingClientRect();return r({inlineSize:l.width,blockSize:l.height},n),null===(t=o.observe)||void 0===t||t.call(o,n),function(){o.disconnect()}}),[r,e])}function xe({duration:e,draw:t,timing:n,done:o,rafIdRef:i}){return new Promise((l=>{let s=performance.now(),c=!1;i.current=requestAnimationFrame((function a(u){s=u<s?u:s;const d=r((u-s)/e,[0,1]);t(n(d)),d<1?!c&&(i.current=requestAnimationFrame(a)):(c=!0,cancelAnimationFrame(i.current),l("done"),o&&o())}))}))}function ye({axis:e,direction:t,positionElement:r}){let n=_e({axis:e,direction:t,positionElement:r});return function(o){const i=n*Math.min(o,1),l=Fe(r,{direction:t,distance:i,axis:e});n-=i,Xe(r,{axis:e,value:l})}}function Ee({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){let i=Ce({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=Fe(n,{direction:t,distance:l,axis:e});i-=l,Xe(n,{axis:e,value:s})}}function Pe(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function Ae(e,t){return"x"===e?t.trackXRef:t.trackYRef}function Oe(e,t){const{current:r}=e;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function Te(e){return Oe(e,"A ref for ".concat(pe," was not placed as expected. ").concat(pe," should always be used within a ").concat(D," component, and it should not be rendered conditionally."))}function Le(e){return Oe(e,"A ref for ".concat(he," was not placed as expected. ").concat(he," should always be used within a ").concat(D," component, and it should not be rendered conditionally."))}function Ie(e){return Oe(e,"A ref for an internal component in ".concat(le," was not placed as expected. ").concat(le," should always be used within a ").concat(D," component, and it should not be rendered conditionally."))}function Ce({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){const i=ze(n,{axis:e}),l=Ve(n,{axis:e}),s=Ye(n,{axis:e}),{positionStart:c,size:a}=He(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 _e({axis:e,direction:t,positionElement:r}){return(Ye(r,{axis:e})-40)*("end"===t?1:-1)}function ke(e,{axis:t}){const r=Ve(e,{axis:t});return Ye(e,{axis:t})/r}function ze(e,{axis:t}){return e["x"===t?"scrollLeft":"scrollTop"]}function Xe(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]=r}function Ye(e,{axis:t}){return e["x"===t?"clientWidth":"clientHeight"]}function Ve(e,{axis:t}){return e["x"===t?"scrollWidth":"scrollHeight"]}function He(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 Me(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]+=r}function je(e){return!(!e||0!==e.scrollTop)}function We(e){return!(!e||e.scrollLeft!==Qe(e))}function De(e){return!(!e||e.scrollTop!==Ne(e))}function qe(e){return!(!e||0!==e.scrollLeft)}function Ne(e){return e.scrollHeight-e.clientHeight}function Qe(e){return e.scrollWidth-e.clientWidth}function Fe(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?Qe(e):Ne(e)}(e,n):0;return"end"===t?Math.min(l,i):Math.max(l,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 Ge(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 Je(e,{axis:t}){return ke(e,{axis:t})<1}function Ke(e,{axis:t,delta:r}){return!(0===r||r<0&&("x"===t?qe:je)(e)||r>0&&("x"===t?We:De)(e))}function Ze(e){const{thumbElement:t,positionElement:r,axis:n}=e,o=Ve(r,{axis:n}),i=Ye(r,{axis:n}),l=ze(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left="".concat(100*l,"%"):"y"===n&&(t.style.top="".concat(100*l,"%")))} | ||
import*as e from"react";import{canUseDOM as t,clamp as r,getSelector as n,getSelectorObj as o,getResizeObserverEntryBorderBoxSize as i,isMainClick as l,namespaced as s}from"@radix-ui/utils";import{Primitive as c}from"@radix-ui/react-primitive";import{composeEventHandlers as a,createContext as u,getOwnerGlobals as d,useCallbackRef as f,useComposedRefs as p,useConstant as h,useLayoutEffect as m,usePrefersReducedMotion as S}from"@radix-ui/react-utils";const b="function"==typeof Float32Array;function v(e,t){return 1-3*t+3*e}function R(e,t){return 3*t-6*e}function w(e){return 3*e}function g(e,t,r){return((v(t,r)*e+R(t,r))*e+w(t))*e}function x(e,t,r){return 3*v(t,r)*e*e+2*R(t,r)*e+w(t)}function y(e){return e}function E(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 y;const o=b?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)o[t]=g(.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=x(l,e,r);return s>=.001?function(e,t,r,n){for(let o=0;o<4;++o){const o=x(t,r,n);if(0===o)return t;t-=(g(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=g(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:g(i(e),t,n)}}function P(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var A,O;(O=A||(A={}))[O.Idle=0]="Idle",O[O.Stopped=1]="Stopped",O[O.Queuing=2]="Queuing",O[O.Pending=3]="Pending",O[O.Resolved=4]="Resolved",O[O.Error=5]="Error";class T{constructor(){P(this,"queue",[]),P(this,"_state",A.Idle)}restart(){this.state===A.Stopped&&(this._state=A.Idle)}rejectItem(e,t){this.stateIs(A.Pending,A.Queuing)&&(this._state=this.isEmpty()?A.Error:A.Queuing,e(t),this.dequeue())}resolveItem(e,t){this.stateIs(A.Pending,A.Queuing)&&(this._state=this.isEmpty()?A.Resolved:A.Queuing,e(t),this.dequeue())}get isBusy(){return this.state===A.Queuing||this.state===A.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(A.Error,A.Resolved,A.Idle,A.Queuing)){if(this.isEmpty())return;const e=this.queue.shift();try{this._state=A.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(A.Pending,A.Queuing)&&(this._state=A.Stopped,this.queue=[])}}let L=!1,I=0;function C(e){"touch"===e.pointerType&&(L=!0,setTimeout((function(){L=!1}),50))}function _(){if("undefined"!=typeof document)return document.addEventListener("pointerup",C),I++,function(){I--,I>0||document.removeEventListener("pointerup",C)}}function k(t={}){const{onHoverStart:r,onHoverChange:n,onHoverEnd:o,isDisabled:i}=t,[l,s]=e.useState(!1),c=e.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1}).current;e.useEffect(_,[]);return{hoverProps:e.useMemo((function(){return{onPointerEnter(e){L&&"mouse"===e.pointerType||function(e,t){if(i||"touch"===t||c.isHovered)return;c.isHovered=!0;const o=e.target;r&&r({type:"hoverstart",target:o,pointerType:t}),n&&n(!0),s(!0)}(e,e.pointerType)},onPointerLeave(e){!function(e,t){if(i||"touch"===t||!c.isHovered)return;c.isHovered=!1;const r=e.target;o&&o({type:"hoverend",target:r,pointerType:t}),n&&n(!1),s(!1)}(e,e.pointerType)}}}),[i,c,r,n,o]),isHovered:l}}function z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?X(Object(r),!0).forEach((function(t){V(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}export const SCROLL_AREA_CSS_PROPS=["positionWidth","positionHeight","scrollbarXOffset","scrollbarYOffset","scrollbarXSize","scrollbarYSize","scrollbarThumbWillChange","scrollbarThumbHeight","scrollbarThumbWidth","cornerLeft","cornerRight","cornerWidth","cornerHeight"].reduce((function(e,t){return Y(Y({},e),{},{[t]:(n=t,"--".concat(s("ScrollArea".concat((r=n,r.charAt(0).toUpperCase()+r.slice(1))))))});var r;var n}),{});var B,M,j,W;(M=B||(B={})).Idle="Idle",M.Thumbing="Thumbing",M.Tracking="Tracking",M.ButtonScrolling="ButtonScrolling",(W=j||(j={}))[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 D="ScrollArea",q={overflowX:"auto",overflowY:"auto",scrollbarVisibility:"hover",scrollbarVisibilityRestTimeout:600,dir:"ltr",trackClickBehavior:"relative",unstable_prefersReducedMotion:!1},[N,Q]=u("ScrollAreaRefsContext",D),[F,U]=u("ScrollAreaContext",D),G=e.createContext({});function J(){return e.useContext(G)}G.displayName="ScrollAreaStateContext";const K=e.createContext(!0),Z=()=>e.useContext(K),[$,ee]=u("DispatchContext",D);export const ScrollArea=e.forwardRef((function(r,n){const o=Y(Y({},q),r),{unstable_forceNative:i=!1}=o,l=H(o,["unstable_forceNative"]),[s,c]=e.useState(!0);m((()=>{c(i||!("ResizeObserver"in window&&function(){var e,r;if(!t())return!1;let n=!1;try{document.querySelector("::-webkit-scrollbar"),n=!0}catch(e){}return!(!(null===(e=window.CSS)||void 0===e||null===(r=e.supports)||void 0===r?void 0:r.call(e,"scrollbar-width: none"))&&!n)}()))}),[i]);const a=s?re:ie,u=e.useRef(null),d=e.useRef(null);return function(t,r,n){e.useImperativeHandle(t,(()=>{const e=r.current,t=n.current||e,o={scrollIntent(...e){t.scroll.call(t,...e)},scrollByIntent(...e){t.scrollBy.call(t,...e)},scrollIntoViewIntent(...e){t.scrollIntoView.call(t,...e)},scrollToIntent(...e){t.scrollTo.call(t,...e)},get scrollTopIntent(){return t.scrollTop},set scrollTopIntent(e){t.scrollTop=e},get scrollLeftIntent(){return t.scrollLeft},set scrollLeftIntent(e){t.scrollLeft=e},get scrollHeightIntent(){return t.scrollHeight},get scrollWidthIntent(){return t.scrollWidth},addScrollListener(...e){t.addEventListener("scroll",...e)},removeScrollListener(...e){t.removeEventListener("scroll",...e)}};return Object.assign(e,o)}))}(n,d,u),e.createElement(K.Provider,{value:s},e.createElement(a,z({positionRef:u,scrollAreaRef:d},l,{ref:n})))}));const te=e.forwardRef((function(t,r){const n=Y(Y({},q),t),o=e.useRef(null),i=e.useRef(null);return e.createElement(K.Provider,{value:!1},e.createElement(ie,z({positionRef:o,scrollAreaRef:i},n,{ref:r})))})),re=e.forwardRef((function(t,r){const o=Y(Y({},q),t),{selector:i=n(D),overflowX:l,overflowY:s,scrollbarVisibility:a,scrollbarVisibilityRestTimeout:u,trackClickBehavior:d,unstable_prefersReducedMotion:f,scrollAreaRef:h,positionRef:m}=o,S=H(o,["selector","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","scrollAreaRef","positionRef"]),b=p(h,r);return e.createElement(c,z({},S,{selector:i,ref:b,style:Y(Y({},S.style),{},{overflowX:l,overflowY:s,resize:"none"})}))})),ne={width:0,height:0},oe={state:B.Idle,explicitResize:"initial",contentIsOverflowingX:!1,contentIsOverflowingY:!1,scrollbarIsVisibleX:!1,scrollbarIsVisibleY:!1,domSizes:{scrollArea:ne,viewport:ne,position:ne,scrollbarY:ne,scrollbarX:ne,trackY:ne,trackX:ne}},ie=e.forwardRef((function(t,r){const o=Y(Y({},q),t),{selector:i=n(D),onScroll:l,overflowX:s,overflowY:u,scrollbarVisibility:h,scrollbarVisibilityRestTimeout:m,trackClickBehavior:b,unstable_prefersReducedMotion:v,positionRef:R,scrollAreaRef:w}=o,g=H(o,["selector","onScroll","overflowX","overflowY","scrollbarVisibility","scrollbarVisibilityRestTimeout","trackClickBehavior","unstable_prefersReducedMotion","positionRef","scrollAreaRef"]),x=f(l),y=e.useRef(null),E=e.useRef(null),P=e.useRef(null),A=e.useRef(null),O=e.useRef(null),T=e.useRef(null),L=e.useRef(null),I=e.useRef(null),C=e.useRef(null),_=e.useRef(null),X=e.useRef(null),V=e.useMemo((()=>({buttonDownRef:y,buttonLeftRef:E,buttonRightRef:P,buttonUpRef:A,viewportRef:O,positionRef:R,scrollAreaRef:w,scrollbarXRef:T,scrollbarYRef:L,thumbXRef:I,thumbYRef:C,trackXRef:_,trackYRef:X})),[]),B=S(w),M=null!=v?v:B,[W,Q]=e.useReducer(we,Y(Y({},oe),{},{scrollbarIsVisibleX:"always"===h,scrollbarIsVisibleY:"always"===h})),{hoverProps:{onPointerEnter:U,onPointerLeave:J},isHovered:K}=k(),Z=e.useMemo((()=>({dir:t.dir,isHovered:K,onScroll:x,overflowX:s,overflowY:u,prefersReducedMotion:M,scrollbarVisibility:h,scrollbarVisibilityRestTimeout:m,trackClickBehavior:b})),[t.dir,x,K,s,u,M,h,m,b]),ee=p(r,w);ge(w,((e,t)=>{const{ownerWindow:r}=d(w),n=r.getComputedStyle(t);Q({type:j.HandleScrollAreaResize,scrollAreaComputedStyle:n,width:e.inlineSize,height:e.blockSize})}));const te="always"===h&&("scroll"===s||"auto"===s&&W.contentIsOverflowingX),re="always"===h&&("scroll"===u||"auto"===u&&W.contentIsOverflowingY),{domSizes:ne}=W,ie={[SCROLL_AREA_CSS_PROPS.scrollbarXOffset]:te&&ne.scrollbarX.height?ne.scrollbarX.height+"px":0,[SCROLL_AREA_CSS_PROPS.scrollbarYOffset]:re&&ne.scrollbarY.width?ne.scrollbarY.width+"px":0,[SCROLL_AREA_CSS_PROPS.positionWidth]:ne.position.width?ne.position.width+"px":"auto",[SCROLL_AREA_CSS_PROPS.positionHeight]:ne.position.height?ne.position.height+"px":"auto"};return e.createElement($.Provider,{value:Q},e.createElement(N.Provider,{value:V},e.createElement(F.Provider,{value:Z},e.createElement(G.Provider,{value:W},e.createElement(c,z({},g,{selector:i,ref:ee,style:Y(Y({},g.style),ie),onPointerEnter:a(t.onPointerEnter,U),onPointerLeave:a(t.onPointerLeave,J)}))))))})),le="ScrollAreaViewport",se=e.forwardRef((function(t,r){const{selector:i=n(le)}=t,l=H(t,["selector"]),{positionRef:s,thumbXRef:u,thumbYRef:d,trackXRef:f,trackYRef:h,viewportRef:S}=Q(le),{onScroll:b,overflowX:v,overflowY:R,scrollbarVisibility:w}=U(le),g=J(),x=ee(le),y=p(r,S);ge(S,(e=>{x({type:j.HandleViewportResize,width:e.inlineSize,height:e.blockSize})}));const E=e.useCallback((function(){const e=s.current,t=u.current,r=d.current,n=f.current,o=h.current;t&&n&&e&&Ze({thumbElement:t,trackElement:n,axis:"x",positionElement:e}),r&&o&&e&&Ze({thumbElement:r,trackElement:o,axis:"y",positionElement:e})}),[s,u,d,f,h]),P=e.useRef(0),A=e.useRef(0);const O=a(b,(function(){s.current&&(E(),function(){if(!s.current)return;const e=s.current.scrollTop,t=s.current.scrollLeft,r=e!==P.current,n=t!==A.current;r===g.scrollbarIsVisibleY&&n===g.scrollbarIsVisibleX||x({type:j.SetScrollbarIsVisible,scrollbarVisibility:w,x:n,y:r}),P.current=e<=0?0:e,A.current=t<=0?0:t}())}));return m((()=>{E()}),[E]),m((function(){const e=s.current;if(!e)return;const t=Je(e,{axis:"x"}),r=Je(e,{axis:"y"});t===g.contentIsOverflowingX&&r===g.contentIsOverflowingY||x({type:j.SetContentOverflowing,x:t,y:r})}),[g.contentIsOverflowingX,g.contentIsOverflowingY,x,s,g.domSizes.position.height,g.domSizes.position.width,g.domSizes.viewport.height,g.domSizes.viewport.width]),e.createElement("div",z({},i?o(i+"-position"):void 0,{ref:s,onScroll:O,style:{zIndex:1,width:"var(".concat(SCROLL_AREA_CSS_PROPS.positionWidth,")"),height:"var(".concat(SCROLL_AREA_CSS_PROPS.positionHeight,")"),scrollbarWidth:"none",overflowScrolling:"touch",resize:"none",overflowX:v,overflowY:R}}),e.createElement("div",z({},i?o(i+"-position-inner"):void 0,{style:{display:"table",width:"100%",paddingBottom:"var(".concat(SCROLL_AREA_CSS_PROPS.scrollbarXOffset,")"),paddingRight:"var(".concat(SCROLL_AREA_CSS_PROPS.scrollbarYOffset,")")}}),e.createElement(c,z({selector:i},l,{ref:y}))))}));export const ScrollAreaViewport=e.forwardRef((function(t,r){return Z()?e.createElement(c,z({},t,{selector:t.selector||n(le),ref:r})):e.createElement(se,z({},t,{ref:r}))}));ScrollAreaViewport.displayName=le;const ce="ScrollAreaScrollbarX",ae="ScrollAreaScrollbarY",[ue,de]=u("ScrollbarContext","ScrollAreaScrollbar"),fe=e.forwardRef((function(t,r){var n;const{axis:o,name:i,onWheel:l,onPointerDown:s,onPointerUp:u,onPointerMove:d}=t,f=H(t,["axis","name","onWheel","onPointerDown","onPointerUp","onPointerMove"]),m=ee(i),{scrollbarVisibility:S,scrollbarVisibilityRestTimeout:b,isHovered:v}=U(i),{["x"===o?"contentIsOverflowingX":"contentIsOverflowingY"]:R,["x"===o?"scrollbarIsVisibleX":"scrollbarIsVisibleY"]:w}=J(),g=Q(i),{positionRef:x}=g,y=function(e,t){return"x"===e?t.scrollbarXRef:t.scrollbarYRef}(o,g),E=p(y,r),P=h((()=>new T));ge(y,(e=>{m({type:j.HandleScrollbarResize,width:e.inlineSize,height:e.blockSize,axis:o})}));const A=a(l,(function(e){const t=Math.abs(e.deltaX),r=Math.abs(e.deltaY);x.current&&(t>0&&t>r&&(x.current.scrollLeft+=e.deltaX),r>0&&r>t&&(x.current.scrollTop+=e.deltaY))})),O=e.useRef();function L(){clearTimeout(O.current),O.current=setTimeout((()=>{m({type:j.SetScrollbarIsVisible,scrollbarVisibility:S,[o]:!1})}),b)}e.useEffect((()=>{if(w)return O.current=setTimeout((()=>{m({type:j.SetScrollbarIsVisible,scrollbarVisibility:S,[o]:!1})}),b),function(){clearTimeout(O.current)}}),[o,m,w,S,b]);const I=e.useRef(!1),C=a(s,(e=>{I.current=!0,clearTimeout(O.current)})),_=a(u,(e=>{I.current=!1,L()})),k=a(d,(e=>{I.current||L()})),X=function(){var e,t;const r=(null===(e=f.style)||void 0===e?void 0:e.opacity)||1;switch(S){case"always":return null===(t=f.style)||void 0===t?void 0:t.opacity;case"scroll":return w?r:0;case"hover":return v||w?r:0}}(),V=function(){var e,t;const r=(null===(e=f.style)||void 0===e?void 0:e.pointerEvents)||"auto";switch(S){case"always":return null===(t=f.style)||void 0===t?void 0:t.pointerEvents;case"scroll":return w?r:"none";case"hover":return v||w?r:"none"}}(),B=e.useMemo((()=>({axis:o,scrollAnimationQueue:P})),[o,P]);return e.createElement(ue.Provider,{value:B},e.createElement(c,z({},f,{ref:E,style:Y(Y({},f.style),{},{display:R?null===(n=f.style)||void 0===n?void 0:n.display:"none",opacity:X,pointerEvents:V}),onPointerDown:C,onPointerUp:_,onPointerMove:k,onWheel:A})))}));export const ScrollAreaScrollbarX=e.forwardRef((function(t,r){const{selector:o=n(ce)}=t,i=H(t,["selector"]),{domSizes:l}=J();return Z()?null:e.createElement(fe,z({},i,{selector:o,ref:r,axis:"x",name:ce,style:Y(Y({},t.style),{},{[SCROLL_AREA_CSS_PROPS.scrollbarXSize]:l.scrollbarX.height?l.scrollbarX.height+"px":0})}))}));ScrollAreaScrollbarX.displayName=ce;export const ScrollAreaScrollbarY=e.forwardRef((function(t,r){const{selector:o=n(ae)}=t,i=H(t,["selector"]),{domSizes:l}=J();return Z()?null:e.createElement(fe,z({},i,{selector:o,ref:r,axis:"y",name:ae,style:Y(Y({},t.style),{},{[SCROLL_AREA_CSS_PROPS.scrollbarYSize]:l.scrollbarY.width?l.scrollbarY.width+"px":0})}))}));ScrollAreaScrollbarY.displayName=ae;const pe="ScrollAreaTrack";export const ScrollAreaTrack=e.forwardRef((function(t,o){const{selector:i=n(pe),onPointerDown:s}=t,u=H(t,["selector","onPointerDown"]),{axis:h,scrollAnimationQueue:m}=de(pe),S=ee(pe),b=Q(pe),{trackClickBehavior:v,prefersReducedMotion:R}=U(pe),{positionRef:w}=b,g=Ae(h,b),x=Pe(h,b),y=p(g,o),P=f(s);ge(g,(e=>{S({type:j.HandleTrackResize,width:e.inlineSize,height:e.blockSize,axis:h})}));const A=e.useRef();return e.useEffect((()=>{let e=null,t=null;const n=Te(g),o=Le(x),i=Ie(w),{ownerDocument:s}=d(w),c=a(P,(function(c){if(!l(c)||c.target===o||o.contains(c.target))return;const a=function({event:e,axis:t,thumbElement:r}){const{[t]:n}=Be(e);return n<r.getBoundingClientRect()["y"===t?"top":"left"]?"start":"end"}({event:c,axis:h,thumbElement:o});if(clearTimeout(t),"page"===v){if(S({type:j.StartTracking}),s.addEventListener("pointermove",u),s.addEventListener("pointerup",f),n.setPointerCapture(c.pointerId),R){const e=_e({direction:a,positionElement:i,axis:h}),t=Fe(i,{direction:a,distance:e,axis:h});Xe(i,{axis:h,value:t})}else m.enqueue((()=>xe({duration:200,timing:E(.16,0,.73,1),draw:ye({positionElement:i,direction:a,axis:h}),rafIdRef:A})));return e=setTimeout((()=>{const t=Be(c),o=Ce({axis:h,direction:a,pointerPosition:t,positionElement:i,trackElement:n});if(!("start"===a&&o>0||"end"===a&&o<0)){if(R){const e=Fe(i,{direction:a,distance:o,axis:h});Xe(i,{axis:h,value:e})}else{const e=Math.round(Math.abs(o)),l=r(e,[100,500]);m.enqueue((()=>xe({duration:l,timing:e=>e,draw:Ee({axis:h,direction:a,pointerPosition:t,positionElement:i,trackElement:n}),rafIdRef:A})))}clearTimeout(e)}}),400),function(){clearTimeout(e)}}{const e=Be(c),t=Ce({axis:h,direction:a,pointerPosition:e,positionElement:i,trackElement:n}),r=Fe(i,{direction:a,distance:t,axis:h});Xe(i,{axis:h,value:r});const l=new PointerEvent("pointerdown",c);requestAnimationFrame((()=>{o.dispatchEvent(l)}))}}));return n.addEventListener("pointerdown",c),function(){cancelAnimationFrame(A.current),clearTimeout(e),clearTimeout(t),n.removeEventListener("pointerdown",c),s.removeEventListener("pointermove",u),s.removeEventListener("pointerup",f),S({type:j.StopTracking}),m.stop()};function u(t){"mouse"===t.pointerType&&Ge(t,n)&&(clearTimeout(e),s.removeEventListener("pointermove",u),m.stop())}function f(r){n.releasePointerCapture(r.pointerId),clearTimeout(e),s.removeEventListener("pointermove",u),s.removeEventListener("pointerup",f),m.stop(),S({type:j.StopTracking}),t=setTimeout((()=>{m.stop()}),200)}}),[h,R,v,S,P,w,m,x,g]),e.createElement(c,z({},u,{selector:i,ref:y,"data-axis":h}))}));ScrollAreaTrack.displayName=pe;const he="ScrollAreaThumb";export const ScrollAreaThumb=e.forwardRef((function(t,r){const{selector:o=n(he),onPointerDown:i}=t,s=H(t,["selector","onPointerDown"]),{axis:u}=de(he),h=Q(he),S=ee(he),{positionRef:b}=h,v=Pe(u,h),R=Ae(u,h),w=p(v,r),g=J(),x=f(i),y=e.useRef(0),E=e.useRef(0),P=e.useRef({size:0,positionStart:0}),A=e.useRef({size:0,positionStart:0}),O=e.useRef(!1);m((()=>{if(!O.current)return void(O.current=!0);Ze({thumbElement:Le(v),trackElement:Te(R),positionElement:Ie(b),axis:u})}),[v,R,b,u,...Ue(g.domSizes)]);const T="x"===u?g.domSizes.trackX.width:g.domSizes.trackY.height,L=e.useRef(T);m((()=>{L.current=T})),e.useEffect((()=>{const e=Le(v),t=Te(R),r=Ie(b),{ownerDocument:n}=d(b),o=a(x,(function(r){if(!l(r))return;const o=Be(r)[u];P.current=He(e,{axis:u}),A.current=He(t,{axis:u}),E.current=o,y.current=o,e.setPointerCapture(r.pointerId),n.addEventListener("pointerup",c),n.addEventListener("pointermove",s),S({type:j.StartThumbing})}));return e.addEventListener("pointerdown",o),function(){e.removeEventListener("pointerdown",o),i()};function i(){n.removeEventListener("pointermove",s),n.removeEventListener("pointerup",c),S({type:j.StopThumbing})}function s(e){const t=Be(e)[u],n=t-E.current,o=L.current;if(Ke(r,{axis:u,delta:n})){const{positionStart:e}=A.current,{positionStart:n}=P.current,i=y.current-n,l=Math.round(t-e),s=Math.round((l-i)/o*100)/100,c=Ve(r,{axis:u});Xe(r,{axis:u,value:s*c}),E.current=t,S({type:j.StartThumbing})}}function c(t){e.releasePointerCapture(t.pointerId),i()}}),[u,x,S,b,h,v,R]);const[I,C]=e.useState({});return m((()=>{const e=b.current,t=R.current;C(function(e){const{trackElement:t,positionElement:r,axis:n}=e;if(!t||!r)return{};const o=ke(r,{axis:n}),i=Ye(t,{axis:n}),l=o*i;if(!Je(r,{axis:n}))return{display:"none",width:0,height:0};return{["x"===n?"width":"height"]:l}}({positionElement:e,trackElement:t,axis:u}))}),[u,b,R,...Ue(g.domSizes)]),e.createElement(c,z({},s,{selector:o,ref:w,"data-axis":u,style:Y(Y(Y({},s.style),I),"x"===u?{[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=he;const me="ScrollAreaButtonStart",Se="ScrollAreaButtonEnd",be=e.forwardRef((function(t,r){const{direction:n,name:o,onPointerDown:i}=t,s=H(t,["direction","name","onPointerDown"]),{axis:u,scrollAnimationQueue:h}=de(o),m=ee(o),S=Q(o),{prefersReducedMotion:b}=U(o),{positionRef:v}=S,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}}(n,u,S),w=p(R,r),g=e.useRef(),x=f(i);return e.useEffect((()=>{const e=function(e,t){const r="end"===t?Se:me;return Oe(e,"A ref for ".concat(r," was not placed as expected. ").concat(r," should always be used within a ").concat(D," component, and it should not be rendered conditionally."))}(R,n),t=Ie(v),{ownerDocument:r}=d(v);let o,i=null;const s=a(x,(function(s){if(!l(s))return;e.setPointerCapture(s.pointerId),r.addEventListener("pointerup",f),r.addEventListener("pointermove",c),m({type:j.StartButtonPress});const a="start"===n?-1:1;b?Me(t,{axis:u,value:51*a}):Ke(t,{axis:u,delta:a})&&h.enqueue((()=>xe({duration:135,timing:E(.16,0,.73,1),draw(e){Me(t,{axis:u,value:15*e*a})},rafIdRef:g}))),o=setTimeout((()=>{if(b)i=setInterval((()=>{Ke(t,{axis:u,delta:a})?Me(t,{axis:u,value:60*a}):clearInterval(i)}),135);else{const r=s.pointerId;!function n(){Ke(t,{axis:u,delta:a})&&h.enqueue((()=>xe({duration:135,timing:e=>e,draw(e){Me(t,{axis:u,value:e*(15*a)})},done:e.hasPointerCapture(r)?n:void 0,rafIdRef:g})))}()}clearTimeout(o)}),400)}));return e.addEventListener("pointerdown",s),function(){e.removeEventListener("pointerdown",s),r.removeEventListener("pointerup",f),r.removeEventListener("pointermove",c),clearTimeout(o),clearInterval(i),cancelAnimationFrame(g.current),m({type:j.StopButtonPress})};function c(t){"mouse"===t.pointerType&&Ge(t,e)&&(clearTimeout(o),r.removeEventListener("pointermove",c))}function f(t){clearTimeout(o),clearInterval(i),e.releasePointerCapture(t.pointerId),e.removeEventListener("pointerup",f),m({type:j.StopButtonPress})}}),[u,n,b,R,m,x,h,v]),e.createElement(c,z({},s,{ref:w,"data-axis":u}))}));export const ScrollAreaButtonStart=e.forwardRef((function(t,r){const{selector:o=n(me)}=t,i=H(t,["selector"]);return e.createElement(be,z({},i,{selector:o,ref:r,name:me,direction:"start"}))}));ScrollAreaButtonStart.displayName=me;export const ScrollAreaButtonEnd=e.forwardRef((function(t,r){const{selector:o=n(Se)}=t,i=H(t,["selector"]);return e.createElement(be,z({},i,{selector:o,ref:r,name:Se,direction:"end"}))}));ScrollAreaButtonEnd.displayName=Se;const ve="ScrollAreaCorner",Re=e.forwardRef((function(t,r){const{selector:o=n(ve)}=t,i=H(t,["selector"]),{positionRef:l}=Q(ve),s=ee(ve),{dir:a}=U(ve),{domSizes:u}=J(),f="rtl"===a,p={[SCROLL_AREA_CSS_PROPS.cornerLeft]:f?0:"unset",[SCROLL_AREA_CSS_PROPS.cornerRight]:f?"unset":0,[SCROLL_AREA_CSS_PROPS.cornerHeight]:u.scrollbarX.height?u.scrollbarX.height+"px":u.scrollbarY.width?u.scrollbarY.width+"px":"16px",[SCROLL_AREA_CSS_PROPS.cornerWidth]:u.scrollbarY.width?u.scrollbarY.width+"px":u.scrollbarX.height?u.scrollbarX.height+"px":"16px",position:"absolute"};return m((()=>{if(l.current){const{ownerWindow:e}=d(l),t=e.getComputedStyle(l.current);s({type:j.SetExplicitResize,value:t.resize})}}),[s,l]),e.createElement(c,z({},i,{selector:o,ref:r,style:Y(Y({},t.style),p)}))}));export const ScrollAreaCorner=e.forwardRef((function(t,r){return Z()?null:e.createElement(Re,z({},t,{ref:r}))}));ScrollAreaCorner.displayName=ve;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=te;function we(e,t){switch(t.type){case j.SetExplicitResize:return Y(Y({},e),{},{explicitResize:t.value});case j.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 Y(Y({},e),{},{domSizes:Y(Y({},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 j.SetContentOverflowing:return Y(Y({},e),{},{contentIsOverflowingX:t.x,contentIsOverflowingY:t.y});case j.SetScrollbarIsVisible:var r,n;return"always"===t.scrollbarVisibility?Y(Y({},e),{},{scrollbarIsVisibleX:!0,scrollbarIsVisibleY:!0}):Y(Y({},e),{},{scrollbarIsVisibleX:null!==(r=t.x)&&void 0!==r?r:e.scrollbarIsVisibleX,scrollbarIsVisibleY:null!==(n=t.y)&&void 0!==n?n:e.scrollbarIsVisibleY});case j.HandleViewportResize:return Y(Y({},e),{},{domSizes:Y(Y({},e.domSizes),{},{viewport:{width:t.width,height:t.height}})});case j.HandleScrollbarResize:return Y(Y({},e),{},{domSizes:Y(Y({},e.domSizes),{},{["x"===t.axis?"scrollbarX":"scrollbarY"]:{height:t.height,width:t.width}})});case j.HandleTrackResize:return Y(Y({},e),{},{domSizes:Y(Y({},e.domSizes),{},{["x"===t.axis?"trackX":"trackY"]:{height:t.height,width:t.width}})});case j.StartTracking:return Y(Y({},e),{},{state:B.Tracking});case j.StopTracking:return Y(Y({},e),{},{state:B.Idle});case j.StartThumbing:return Y(Y({},e),{},{state:B.Thumbing});case j.StopThumbing:return Y(Y({},e),{},{state:B.Idle});case j.StartButtonPress:return Y(Y({},e),{},{state:B.ButtonScrolling});case j.StopButtonPress:return Y(Y({},e),{},{state:B.Idle})}return e}function ge(e,t){const r=f(t);m((()=>{var t;const n=e.current;if(!n)return;const o=new ResizeObserver((([e])=>{const t=i(e);r(t,e.target)})),l=n.getBoundingClientRect();return r({inlineSize:l.width,blockSize:l.height},n),null===(t=o.observe)||void 0===t||t.call(o,n),function(){o.disconnect()}}),[r,e])}function xe({duration:e,draw:t,timing:n,done:o,rafIdRef:i}){return new Promise((l=>{let s=performance.now(),c=!1;i.current=requestAnimationFrame((function a(u){s=u<s?u:s;const d=r((u-s)/e,[0,1]);t(n(d)),d<1?!c&&(i.current=requestAnimationFrame(a)):(c=!0,cancelAnimationFrame(i.current),l("done"),o&&o())}))}))}function ye({axis:e,direction:t,positionElement:r}){let n=_e({axis:e,direction:t,positionElement:r});return function(o){const i=n*Math.min(o,1),l=Fe(r,{direction:t,distance:i,axis:e});n-=i,Xe(r,{axis:e,value:l})}}function Ee({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){let i=Ce({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=Fe(n,{direction:t,distance:l,axis:e});i-=l,Xe(n,{axis:e,value:s})}}function Pe(e,t){return"x"===e?t.thumbXRef:t.thumbYRef}function Ae(e,t){return"x"===e?t.trackXRef:t.trackYRef}function Oe(e,t){const{current:r}=e;return function(e,t){if(null==e)throw new Error(t)}(r,t),r}function Te(e){return Oe(e,"A ref for ".concat(pe," was not placed as expected. ").concat(pe," should always be used within a ").concat(D," component, and it should not be rendered conditionally."))}function Le(e){return Oe(e,"A ref for ".concat(he," was not placed as expected. ").concat(he," should always be used within a ").concat(D," component, and it should not be rendered conditionally."))}function Ie(e){return Oe(e,"A ref for an internal component in ".concat(le," was not placed as expected. ").concat(le," should always be used within a ").concat(D," component, and it should not be rendered conditionally."))}function Ce({axis:e,direction:t,pointerPosition:r,positionElement:n,trackElement:o}){const i=ze(n,{axis:e}),l=Ve(n,{axis:e}),s=Ye(n,{axis:e}),{positionStart:c,size:a}=He(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 _e({axis:e,direction:t,positionElement:r}){return(Ye(r,{axis:e})-40)*("end"===t?1:-1)}function ke(e,{axis:t}){const r=Ve(e,{axis:t});return Ye(e,{axis:t})/r}function ze(e,{axis:t}){return e["x"===t?"scrollLeft":"scrollTop"]}function Xe(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]=r}function Ye(e,{axis:t}){return e["x"===t?"clientWidth":"clientHeight"]}function Ve(e,{axis:t}){return e["x"===t?"scrollWidth":"scrollHeight"]}function He(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 Me(e,{axis:t,value:r}){e["x"===t?"scrollLeft":"scrollTop"]+=r}function je(e){return!(!e||0!==e.scrollTop)}function We(e){return!(!e||e.scrollLeft!==Qe(e))}function De(e){return!(!e||e.scrollTop!==Ne(e))}function qe(e){return!(!e||0!==e.scrollLeft)}function Ne(e){return e.scrollHeight-e.clientHeight}function Qe(e){return e.scrollWidth-e.clientWidth}function Fe(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?Qe(e):Ne(e)}(e,n):0;return"end"===t?Math.min(l,i):Math.max(l,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 Ge(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 Je(e,{axis:t}){return ke(e,{axis:t})<1}function Ke(e,{axis:t,delta:r}){return!(0===r||r<0&&("x"===t?qe:je)(e)||r>0&&("x"===t?We:De)(e))}function Ze(e){const{thumbElement:t,positionElement:r,axis:n}=e,o=Ve(r,{axis:n}),i=Ye(r,{axis:n}),l=ze(r,{axis:n})/o;i/o>=1||("x"===n?t.style.left="".concat(100*l,"%"):"y"===n&&(t.style.top="".concat(100*l,"%")))} | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-scroll-area", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"license": "MIT", | ||
@@ -19,5 +19,5 @@ "source": "src/index.ts", | ||
"dependencies": { | ||
"@radix-ui/react-polymorphic": "0.0.3", | ||
"@radix-ui/react-primitive": "0.0.2", | ||
"@radix-ui/react-utils": "0.0.3", | ||
"@radix-ui/react-polymorphic": "0.0.4", | ||
"@radix-ui/react-primitive": "0.0.3", | ||
"@radix-ui/react-utils": "0.0.4", | ||
"@radix-ui/utils": "0.0.3" | ||
@@ -24,0 +24,0 @@ }, |
Sorry, the diff of this file is not supported yet
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
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
366022
+ Added@radix-ui/react-polymorphic@0.0.4(transitive)
+ Added@radix-ui/react-primitive@0.0.3(transitive)
+ Added@radix-ui/react-utils@0.0.4(transitive)
- Removed@radix-ui/react-polymorphic@0.0.3(transitive)
- Removed@radix-ui/react-primitive@0.0.2(transitive)
- Removed@radix-ui/react-utils@0.0.3(transitive)
Updated@radix-ui/react-utils@0.0.4