1import{r,j as a,w as x,B as N}from"./index-C0lDKHoD.js";import{a as p}from"./OptimizedImage-MFMhe4pp.js";import{A as R}from"./arrow-left-UdLjxIX8.js";import{A as k}from"./arrow-right-DGYdj4yi.js";const w=r.createContext(null);function m(){const o=r.useContext(w);if(!o)throw new Error("useCarousel must be used within a <Carousel />");return o}const z=r.forwardRef(({orientation:o="horizontal",opts:l,setApi:s,plugins:t,className:c,children:i,...u},f)=>{const[v,e]=p({...l,axis:o==="horizontal"?"x":"y"},t),[y,b]=r.useState(!1),[j,P]=r.useState(!1),d=r.useCallback(n=>{n&&(b(n.canScrollPrev()),P(n.canScrollNext()))},[]),C=r.useCallback(()=>{e==null||e.scrollPrev()},[e]),h=r.useCallback(()=>{e==null||e.scrollNext()},[e]),S=r.useCallback(n=>{n.key==="ArrowLeft"?(n.preventDefault(),C()):n.key==="ArrowRight"&&(n.preventDefault(),h())},[C,h]);return r.useEffect(()=>{!e||!s||s(e)},[e,s]),r.useEffect(()=>{if(e)return d(e),e.on("reInit",d),e.on("select",d),()=>{e==null||e.off("select",d)}},[e,d]),a.jsx(w.Provider,{value:{carouselRef:v,api:e,opts:l,orientation:o||((l==null?void 0:l.axis)==="y"?"vertical":"horizontal"),scrollPrev:C,scrollNext:h,canScrollPrev:y,canScrollNext:j},children:a.jsx("div",{ref:f,onKeyDownCapture:S,className:x("relative",c),role:"region","aria-roledescription":"carousel",...u,children:i})})});z.displayName="Carousel";const g=r.forwardRef(({className:o,...l},s)=>{const{carouselRef:t,orientation:c}=m();return a.jsx("div",{ref:t,className:"overflow-hidden",children:a.jsx("div",{ref:s,className:x("flex",c==="horizontal"?"-ml-4":"-mt-4 flex-col",o),...l})})});g.displayName="CarouselContent";const E=r.forwardRef(({className:o,...l},s)=>{const{orientation:t}=m();return a.jsx("div",{ref:s,role:"group","aria-roledescription":"slide",className:x("min-w-0 shrink-0 grow-0 basis-full",t==="horizontal"?"pl-4":"pt-4",o),...l})});E.displayName="CarouselItem";const A=r.forwardRef(({className:o,variant:l="outline",size:s="icon",...t},c)=>{const{orientation:i,scrollPrev:u,canScrollPrev:f}=m();return a.jsxs(N,{ref:c,variant:l,size:s,className:x("absolute h-8 w-8 rounded-full",i==="horizontal"?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",o),disabled:!f,onClick:u,...t,children:[a.jsx(R,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Previous slide"})]})});A.displayName="CarouselPrevious";const D=r.forwardRef(({className:o,variant:l="outline",size:s="icon",...t},c)=>{const{orientation:i,scrollNext:u,canScrollNext:f}=m();return a.jsxs(N,{ref:c,variant:l,size:s,className:x("absolute h-8 w-8 rounded-full",i==="horizontal"?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",o),disabled:!f,onClick:u,...t,children:[a.jsx(k,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Next slide"})]})});D.displayName="CarouselNext";export{z as C,g as a,E as b,A as c,D as d};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.