import{r as n,j as a}from"./app-C417rstp.js";import{p as k,n as E}from"./index-C9OncgsG.js";import{A as I}from"./index-CIV8c8cT.js";import{m as N}from"./proxy-Bepa3l_N.js";function L({imagenes:p}){const c=p,o=n.useMemo(()=>Array.from({length:c},(e,t)=>`/images/laboratorios/laboratorios_${t+1}.png`),[c]),[r,s]=n.useState(0),[u,i]=n.useState(0),[d,h]=n.useState(!1),g=n.useRef(null);n.useEffect(()=>{if(d)return;const e=setInterval(()=>{i(1),s(t=>(t+1)%o.length)},5e3);return()=>clearInterval(e)},[d,o.length]);const b=()=>{i(-1),s(e=>(e-1+o.length)%o.length)},m=()=>{i(1),s(e=>(e+1)%o.length)},l=n.useRef({x:0,y:0,t:0}),w=e=>{const t=e.touches[0];l.current={x:t.clientX,y:t.clientY,t:Date.now()}},v=e=>{var x,f;const t=(((f=(x=e.changedTouches)==null?void 0:x[0])==null?void 0:f.clientX)??0)-l.current.x,y=Date.now()-l.current.t;Math.abs(t)>40&&y<600&&(t>0?b():m())},j={enter:e=>({x:e>0?60:-60,opacity:0,scale:.98}),center:{x:0,opacity:1,scale:1,transition:{duration:.45,ease:"easeOut"}},exit:e=>({x:e>0?-60:60,opacity:0,scale:.98,transition:{duration:.35,ease:"easeIn"}})};return a.jsxs("div",{ref:g,className:"relative w-full h-[280px] sm:h-[360px] lg:h-[420px] select-none",onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),onTouchStart:w,onTouchEnd:v,role:"region","aria-label":"Galería de laboratorios DETRI",children:[a.jsx(I,{custom:u,mode:"popLayout",children:a.jsx(N.img,{src:o[r],alt:`Laboratorio ${r+1}`,className:"absolute inset-0 w-full h-full object-cover",custom:u,initial:"enter",animate:"center",exit:"exit",variants:j,draggable:!1},o[r])}),a.jsx("button",{"aria-label":"Anterior",onClick:b,className:`absolute left-2 top-1/2 -translate-y-1/2 p-2 rounded-full
                   bg-white/70 hover:bg-white shadow-md border border-white/60
                   text-ink/80 backdrop-blur`,children:a.jsx(k,{})}),a.jsx("button",{"aria-label":"Siguiente",onClick:m,className:`absolute right-2 top-1/2 -translate-y-1/2 p-2 rounded-full
                   bg-white/70 hover:bg-white shadow-md border border-white/60
                   text-ink/80 backdrop-blur`,children:a.jsx(E,{})}),a.jsx("div",{className:"absolute bottom-3 left-0 right-0 flex items-center justify-center gap-2",children:o.map((e,t)=>a.jsx("button",{"aria-label":`Ir a la imagen ${t+1}`,onClick:()=>{i(t>r?1:-1),s(t)},className:`h-2.5 w-2.5 rounded-full transition
                        ${t===r?"bg-primary-600":"bg-white/60 hover:bg-white"}`},t))})]})}export{L as default};
