"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2250],{62250:(e,l,t)=>{t.r(l),t.d(l,{Carousel:()=>f,CarouselContent:()=>x,CarouselItem:()=>h,CarouselNext:()=>C,CarouselPrevious:()=>v});var a=t(53891),r=t(59110),s=t(53540),o=t(80685),n=t(73987),i=t(96740),u=t(61971);let c=n.createContext(null);function d(){let e=n.useContext(c);if(!e)throw Error("useCarousel must be used within a <Carousel />");return e}function f(e){let{orientation:l="horizontal",opts:t,setApi:s,plugins:o,className:i,children:d,...f}=e,[x,h]=(0,r.A)({...t,axis:"horizontal"===l?"x":"y"},o),[v,C]=n.useState(!1),[p,m]=n.useState(!1),N=n.useCallback(e=>{e&&(C(e.canScrollPrev()),m(e.canScrollNext()))},[]),b=n.useCallback(()=>{null==h||h.scrollPrev()},[h]),k=n.useCallback(()=>{null==h||h.scrollNext()},[h]),j=n.useCallback(e=>{"ArrowLeft"===e.key?(e.preventDefault(),b()):"ArrowRight"===e.key&&(e.preventDefault(),k())},[b,k]);return n.useEffect(()=>{h&&s&&s(h)},[h,s]),n.useEffect(()=>{if(h)return N(h),h.on("reInit",N),h.on("select",N),()=>{null==h||h.off("select",N)}},[h,N]),(0,a.jsx)(c.Provider,{value:{carouselRef:x,api:h,opts:t,orientation:l||((null==t?void 0:t.axis)==="y"?"vertical":"horizontal"),scrollPrev:b,scrollNext:k,canScrollPrev:v,canScrollNext:p},children:(0,a.jsx)("div",{onKeyDownCapture:j,className:(0,u.cn)("relative",i),role:"region","aria-roledescription":"carousel","data-slot":"carousel",...f,children:d})})}function x(e){let{className:l,...t}=e,{carouselRef:r,orientation:s}=d();return(0,a.jsx)("div",{ref:r,className:"overflow-hidden","data-slot":"carousel-content",children:(0,a.jsx)("div",{className:(0,u.cn)("flex","horizontal"===s?"-ml-4":"-mt-4 flex-col",l),...t})})}function h(e){let{className:l,...t}=e,{orientation:r}=d();return(0,a.jsx)("div",{role:"group","aria-roledescription":"slide","data-slot":"carousel-item",className:(0,u.cn)("min-w-0 shrink-0 grow-0 basis-full","horizontal"===r?"pl-4":"pt-4",l),...t})}function v(e){let{className:l,variant:t="outline",size:r="icon",...o}=e,{orientation:n,scrollPrev:c,canScrollPrev:f}=d();return(0,a.jsxs)(i.Button,{"data-slot":"carousel-previous",variant:t,size:r,className:(0,u.cn)("absolute size-8 rounded-full","horizontal"===n?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",l),disabled:!f,onClick:c,...o,children:[(0,a.jsx)(s.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Previous slide"})]})}function C(e){let{className:l,variant:t="outline",size:r="icon",...s}=e,{orientation:n,scrollNext:c,canScrollNext:f}=d();return(0,a.jsxs)(i.Button,{"data-slot":"carousel-next",variant:t,size:r,className:(0,u.cn)("absolute size-8 rounded-full","horizontal"===n?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",l),disabled:!f,onClick:c,...s,children:[(0,a.jsx)(o.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Next slide"})]})}}}]);