import{r,j as t,H as A}from"./app-2gKhTNh_.js";import{L as G}from"./LandingLayout-7uh-oYye.js";import{F as n,ai as P,C as $,k as E,L as F,M as T}from"./index-DQiLWVLj.js";import{L as M}from"./Lightbox-WFGqemP8.js";import{m as a}from"./proxy-N6hiut4S.js";import{A as v}from"./index-Kp1IKsWc.js";import"./index-C1sFUKMq.js";const p=8;function q({campus:o,images:k}){const c=o?.theme||{primary:"bg-gray-600",gradientFrom:"from-gray-600",gradientTo:"to-gray-800"},s=k||[],[i,y]=r.useState("Semua"),[l,f]=r.useState(1),[d,b]=r.useState(null),j=r.useMemo(()=>{const e=new Set(s.map(u=>u.category).filter(u=>u)),h=["Semua",...Array.from(e)];return i!=="Semua"&&!e.has(i)&&y("Semua"),h},[s]),m=r.useMemo(()=>i==="Semua"?s:s.filter(e=>e.category===i),[s,i]),x=Math.ceil(m.length/p),w=(l-1)*p,N=m.slice(w,w+p),C=e=>{y(e),f(1)},g=e=>{f(e),document.getElementById("gallery-grid")?.scrollIntoView({behavior:"smooth"})},I=e=>b({src:e.image_url,title:e.title}),S=()=>b(null),L={backgroundImage:"radial-gradient(circle at 1px 1px, #e2e8f0 0.5px, transparent 0)",backgroundSize:"20px 20px"};return t.jsxs(G,{campus:o,title:`Galeri - ${o.name}`,children:[t.jsx(A,{title:`Galeri - ${o.name}`}),t.jsxs("header",{className:`relative py-24 sm:py-32 bg-gradient-to-r ${c.gradientFrom} ${c.gradientTo} overflow-hidden`,children:[t.jsx("div",{className:"absolute inset-0 opacity-10 mix-blend-overlay",children:t.jsxs("svg",{className:"absolute right-0 bottom-0 transform translate-x-1/2 translate-y-1/2 lg:translate-x-1/3",width:"800",height:"800",fill:"none",viewBox:"0 0 800 800",children:[t.jsx("circle",{cx:"400",cy:"400",r:"400",stroke:"white",strokeWidth:"0.5"}),t.jsx("circle",{cx:"400",cy:"400",r:"300",stroke:"white",strokeWidth:"0.5",strokeDasharray:"2 4"})]})}),t.jsxs("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[t.jsx(a.h1,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.5},className:"text-4xl sm:text-6xl font-extrabold text-white tracking-tight drop-shadow-lg",children:"Galeri Kampus"}),t.jsxs(a.p,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.2},className:"mt-4 text-xl text-gray-200 max-w-3xl mx-auto drop-shadow-md",children:["Lihat lebih dekat berbagai momen, kegiatan, dan fasilitas unggulan di lingkungan ",o.name,"."]})]})]}),t.jsx("div",{className:"relative py-16 sm:py-24",style:L,children:t.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[j.length>1&&t.jsx(a.div,{initial:{opacity:0},whileInView:{opacity:1},viewport:{once:!0},transition:{duration:.5,delay:.2},className:"mb-12 flex justify-center flex-wrap gap-3",children:j.map(e=>t.jsx("button",{onClick:()=>C(e),className:`px-5 py-2 text-sm font-semibold rounded-full transition-all duration-300 transform hover:scale-105
                                        ${i===e?`${c.primary} text-white shadow-lg`:"bg-white text-slate-700 shadow-md hover:bg-slate-100"}`,children:e},e))}),t.jsx(a.div,{layout:!0,id:"gallery-grid",className:"mt-12 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 sm:gap-6",children:t.jsx(v,{children:N.map(e=>t.jsxs(a.div,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:"spring",stiffness:200,damping:25},className:"group relative aspect-[4/3] rounded-xl overflow-hidden shadow-lg cursor-pointer",onClick:()=>I(e),children:[t.jsx("img",{src:e.image_url,alt:e.title,className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),t.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-50 transition-opacity duration-300 flex items-center justify-center",children:t.jsx(n,{icon:P,className:"text-white text-4xl opacity-0 group-hover:opacity-100 transform scale-50 group-hover:scale-100 transition-all duration-300"})}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-black/70 to-transparent",children:t.jsx("h3",{className:"text-white font-semibold text-sm truncate",children:e.title})})]},e.id))})}),s.length===0?t.jsxs(a.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center text-center py-12 text-gray-500",children:[t.jsx(n,{icon:$,className:"text-5xl mb-4"}),t.jsx("h2",{className:"text-2xl font-semibold text-gray-700",children:"Galeri Kosong"}),t.jsx("p",{className:"mt-2",children:"Belum ada foto yang ditambahkan ke galeri kampus ini."})]}):m.length===0&&t.jsxs(a.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col items-center justify-center text-center py-12 text-gray-500",children:[t.jsx(n,{icon:E,className:"text-5xl mb-4"}),t.jsx("h2",{className:"text-2xl font-semibold text-gray-700",children:"Tidak Ada Gambar"}),t.jsxs("p",{className:"mt-2",children:['Tidak ada gambar yang cocok dengan kategori "',i,'".']})]}),x>1&&t.jsxs(a.div,{initial:{opacity:0},animate:{opacity:1},className:"mt-16 flex justify-center items-center space-x-2",children:[t.jsx("button",{onClick:()=>g(l-1),disabled:l===1,className:"w-10 h-10 rounded-full font-semibold text-sm transition-all duration-300 bg-white text-slate-700 shadow-sm hover:bg-slate-100 disabled:opacity-50 disabled:cursor-not-allowed",children:t.jsx(n,{icon:F})}),Array.from({length:x},(e,h)=>h+1).map(e=>t.jsx("button",{onClick:()=>g(e),className:`w-10 h-10 rounded-full font-semibold text-sm transition-all duration-300
                                        ${l===e?`${c.primary} text-white shadow-md`:"bg-white text-slate-700 shadow-sm hover:bg-slate-100"}`,children:e},e)),t.jsx("button",{onClick:()=>g(l+1),disabled:l===x,className:"w-10 h-10 rounded-full font-semibold text-sm transition-all duration-300 bg-white text-slate-700 shadow-sm hover:bg-slate-100 disabled:opacity-50 disabled:cursor-not-allowed",children:t.jsx(n,{icon:T})})]})]})}),t.jsx(v,{children:d&&t.jsx(M,{imageSrc:d.src,imageTitle:d.title,onClose:S})})]})}export{q as default};
