"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),x=require("gsap"),h=require("../../node_modules/.pnpm/gsap@3.13.0/node_modules/gsap/Flip.cjs.js"),T=require("@gsap/react"),N=require("../../utils/cn/cn.cjs.js"),t=require("../../src/modules/SlidingTabsGallery/SlidingTabsGallery.module.css"),v=require("../../pageComponents/Bubbles/Bubbles.cjs.js"),f=require("../../components/HighlightedTitle/HighlightedTitle.cjs.js"),b=require("../../components/Typography/Typography.cjs.js"),R=require("../../components/Icon/Icon.cjs.js"),C=require("../../pageComponents/Gradient/Gradient.cjs.js");x.registerPlugin(h.Flip);const q=({title:y,tabs:d,withBubbles:p})=>{const s=g.useRef(null),a=g.useRef(null),[l,m]=g.useState(d[0]);T.useGSAP(()=>{const n=s.current,i=a.current,u=c=>{if(n&&i&&c){const o=i.getBoundingClientRect(),r=c.getBoundingClientRect();x.set(n,{left:r.left-o.left,top:r.top-o.top,width:r.width,height:r.height})}};if(i&&i.children.length>1){const c=i.children[1];c&&u(c)}},{dependencies:[d,m],scope:a});const j=(n,i)=>{if(n===l)return;const u=h.Flip.getState(s.current);if(m(n),s.current&&a.current&&a.current.children.length>i+1){const c=a.current.children[i+1];if(c){const o=a.current.getBoundingClientRect(),r=c.getBoundingClientRect();s.current.style.left=`${r.left-o.left}px`,s.current.style.top=`${r.top-o.top}px`,s.current.style.width=`${r.width}px`,s.current.style.height=`${r.height}px`}}h.Flip.from(u,{targets:s.current,duration:.3,ease:"power1.inOut"})};return e.jsxs("section",{className:t.root,children:[p&&e.jsx(v.Bubbles,{className:t.bubbles}),e.jsxs("div",{className:t.container,children:[e.jsx(f.HighlightedTitle,{as:"div",title:y,className:t.header,colorScheme:"dark"}),e.jsxs("div",{className:t.content,children:[l.image&&e.jsx("div",{className:t.imageWrap,children:e.jsx("img",{src:l.image,alt:"Total Care",className:t.image})}),e.jsx("div",{className:t.tabsContainer,children:e.jsxs("div",{ref:a,className:t.tabs,children:[e.jsx("div",{ref:s,id:"marker",className:t.marker}),d.map((n,i)=>e.jsxs("button",{className:N.cn(t.tab,{[t.active]:l===n}),onClick:()=>j(n,i),children:[n.icon&&e.jsx(b.Typography,{defaultVariant:"displayMd",className:t.icon,children:e.jsx(R.Icon,{name:n.icon})}),e.jsx(b.Typography,{defaultVariant:"displayMd",className:t.hideMobile,children:n.label})]},n.label))]})}),l.description&&e.jsx("div",{className:t.description,children:e.jsx(f.HighlightedTitle,{as:"div",defaultVariant:"bodyXl",mobileVariant:"bodyMd",className:t.descriptionText,title:l.description,colorScheme:"dark"})})]})]}),p&&e.jsx(C.Gradient,{variant:"blue"})]})};exports.SlidingTabsGallery=q;
