import{r as i,j as e,ag as m,ah as b,w as j,ai as v}from"./vendor-laZsiqLO.js";import{C as N,a as w,b as C}from"./carousel-C9slTU5h.js";import{S as h}from"./skeleton-uyR1XZG9.js";import{c as k}from"./utils-RgT4yCq8.js";import{u as y}from"./app-D2josV_r.js";import"./button-B8f8jW4H.js";import"./bootstrap-CBwglqL9.js";/* empty css            */function T({post:a,sortedImages:s,gallerySlides:n}){const{openLightbox:c}=y(),[t,p]=i.useState(null),[r,u]=i.useState(0),[x,f]=i.useState(0),[g,d]=i.useState(!1);return i.useEffect(()=>{t&&(f(t.scrollSnapList().length),u(t.selectedScrollSnap()),t.on("select",()=>{d(!0),u(t.selectedScrollSnap()),setTimeout(()=>d(!1),400)}))},[t]),s.length<=1&&!a.image_path?null:e.jsx("div",{className:"mb-8",children:s.length>1?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"group relative w-full rounded-2xl overflow-hidden shadow-2xl bg-black",children:[e.jsx(N,{setApi:p,className:"w-full",children:e.jsx(w,{children:s.map((o,l)=>e.jsxs(C,{className:"relative w-full aspect-video md:aspect-[2/1]",children:[e.jsx("img",{src:o.image_path,alt:o.caption||a.title,className:"w-full h-full object-cover cursor-zoom-in",onClick:()=>c(n,l)}),e.jsx("div",{className:"absolute top-4 right-4 bg-black/50 p-2 rounded-full text-white opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:e.jsx(m,{className:"w-4 h-4"})})]},o.id))})}),e.jsxs("div",{className:"absolute bottom-4 left-4 right-4 flex items-center gap-4 z-20 pointer-events-none",children:[e.jsx("button",{onClick:()=>t?.scrollPrev(),className:"pointer-events-auto h-8 w-8 rounded-full bg-white text-black flex items-center justify-center hover:bg-gray-200 transition-colors shadow-lg active:scale-95 rtl:rotate-180",children:e.jsx(b,{className:"w-5 h-5"})}),e.jsx("div",{className:"flex-1 flex gap-2 h-1 pointer-events-auto",children:Array.from({length:x}).map((o,l)=>e.jsx("button",{onClick:()=>t?.scrollTo(l),className:k("h-full flex-1 rounded-full transition-all duration-300 ease-in-out",r===l?"bg-red-600":"bg-white/20 hover:bg-white/40")},l))}),e.jsx("button",{onClick:()=>t?.scrollNext(),className:"pointer-events-auto h-8 w-8 rounded-full bg-white text-black flex items-center justify-center hover:bg-gray-200 transition-colors shadow-lg active:scale-95 rtl:rotate-180",children:e.jsx(j,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"min-h-[24px] px-1",children:g?e.jsxs("div",{className:"space-y-2 animate-pulse flex flex-col items-center",children:[e.jsx(h,{className:"h-4 w-3/4 rounded"}),e.jsx(h,{className:"h-3 w-1/2 rounded"})]}):e.jsx("div",{className:"text-center animate-in fade-in slide-in-from-top-1 duration-300",children:s[r]?.caption&&s[r].caption.trim()!==""?e.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground italic",children:[e.jsx(v,{className:"w-4 h-4 opacity-50 shrink-0"}),e.jsx("span",{children:s[r].caption})]}):null})})]}):a.image_path&&e.jsxs("figure",{className:"rounded-2xl overflow-hidden bg-muted border border-border shadow-lg relative group",children:[e.jsx("img",{src:a.image_path,alt:a.title,className:"w-full h-auto object-cover cursor-zoom-in",onClick:()=>c(n,0)}),e.jsx("div",{className:"absolute top-4 right-4 bg-black/50 p-2 rounded-full text-white opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:e.jsx(m,{className:"w-4 h-4"})}),a.images?.[0]?.caption&&a.images[0].caption.trim()!==""&&e.jsx("figcaption",{className:"p-3 text-center text-sm text-muted-foreground bg-background/50 backdrop-blur border-t italic",children:a.images[0].caption})]})})}export{T as default};
