"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),g=require("../../../../components/Icon/constants.cjs.js"),a=require("../../../../src/pageComponents/Footer/components/TopTreatmentsSlider/topTreatmentsSlider.module.css"),m=require("../../../../components/Typography/Typography.cjs.js"),_=require("../../../../components/Button/Button.cjs.js"),j=require("../../../../components/Icon/Icon.cjs.js"),C=({title:N,products:n})=>{const[i,h]=t.useState(0),[l,c]=t.useState(1),[r,o]=t.useState(!1),v=t.useMemo(()=>{if(n.length===2){const d=(i-1+n.length)%n.length,x=(i+1)%n.length;return[n[d],n[i===d?x:i],n[x]].filter((b,p,T)=>T.findIndex(S=>S.name===b.name)===p)}const s=(i-1+n.length)%n.length,I=(i+1)%n.length;return[n[s],n[i],n[I]]},[i,n]),y=t.useCallback(s=>{s.stopPropagation(),!r&&(o(!0),c(2))},[r]),f=t.useCallback(s=>{s.stopPropagation(),!r&&(o(!0),c(0))},[r]),u=()=>{l===2?h(s=>(s+1)%n.length):l===0&&h(s=>(s-1+n.length)%n.length),c(1),o(!1)};return e.jsxs("div",{className:a.root,children:[e.jsx(m.Typography,{as:"span",defaultVariant:"labelSm",mobileVariant:"labelXs",weight:"regular",emphasis:!0,className:a.title,children:N}),e.jsxs("div",{className:a.sliderContainer,children:[e.jsx("div",{className:a.sliderTrack,style:{transform:`translateX(calc(-${l*100}% - ${l*10}px))`,transition:r?"transform 0.3s cubic-bezier(0.4,0,0.2,1)":"none"},onTransitionEnd:u,children:v.map(s=>e.jsx("a",{href:s.link,className:a.slide,children:e.jsxs("div",{className:a.productCard,children:[e.jsx("div",{className:a.imageWrapper,children:e.jsx("img",{src:s.image,alt:s.name,className:a.image})}),e.jsxs("div",{className:a.rightSide,children:[e.jsxs("div",{className:a.headerSplit,children:[e.jsx("div",{className:a.nameContainer,children:e.jsx(m.Typography,{defaultVariant:"headingXs",children:s.name})}),e.jsx(m.Typography,{defaultVariant:"bodyMd",mobileVariant:"bodySm",className:a.price,children:`Starting at ${s.price}/mo`})]}),e.jsx("div",{className:a.actions,children:e.jsx("div",{className:a.btnLearnMore,children:e.jsx(_.Button,{size:"sm",variant:"primary-invert",children:"Learn More"})})})]})]})},s.name))}),e.jsxs("div",{className:a.switchers,children:[e.jsx("div",{className:a.arrowIcon,onClick:f,children:e.jsx(j.Icon,{name:g.EIconName.ARROW_BACK})}),e.jsx("div",{className:a.arrowIcon,onClick:y,children:e.jsx(j.Icon,{name:g.EIconName.ARROW_FORWARD})})]})]})]})};exports.TopTreatmentsSlider=C;
