import{j as e}from"./ui-vendor-CJlQk0Tq.js";import{r as t}from"./react-vendor-f6QdChhz.js";import{g as s,h as a,X as l,c$ as r,$ as n,a1 as c}from"./index-BzXujQ-F.js";import{g as o}from"./bunny-image-VphMgYzL.js";const i=e=>{if(!e)return!0;const t=e.toLowerCase();return t.includes("placeholder")||t.includes("no-image")||t.includes("not-found")||t.includes("undefined")||"null"===t||""===t.trim()},d={shed:"https://structures.b-cdn.net/fallback/shed-placeholder.jpg",garage:"https://structures.b-cdn.net/fallback/garage-placeholder.jpg",other:"https://structures.b-cdn.net/fallback/structure-placeholder.jpg",greenhouse:"https://structures.b-cdn.net/fallback/greenhouse-placeholder.jpg",default:"https://structures.b-cdn.net/fallback/structure-placeholder.jpg"},h=e=>e&&d[e]||d.default,u=({selectedImage:d,selectedImageIndex:u,images:b,onClose:x,onPrevious:m,onNext:g,highQuality:p=!0})=>{const[j,f]=t.useState(!1),[N,k]=t.useState(!1);if(!d)return null;const w=i(d.src)||j,v=h(d.category),y=w?v:o(d.src,p?{width:1600,height:1200,quality:90}:{width:1200,height:900});return e.jsx(s,{open:!!d,onOpenChange:x,children:e.jsx(a,{className:"max-w-5xl p-1 bg-black/95 border-none",hideCloseButton:!0,children:e.jsxs("div",{className:"relative flex flex-col",children:[e.jsx("button",{onClick:x,className:"absolute top-4 right-4 z-50 bg-black/60 hover:bg-black/80 rounded-full p-2 transition-colors","aria-label":"Close image",children:e.jsx(l,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{className:"flex-1 flex items-center justify-center min-h-[300px]",children:[!N&&!j&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"w-12 h-12 border-4 border-t-blue-500 border-r-transparent border-b-blue-500 border-l-transparent rounded-full animate-spin"})}),e.jsx("img",{src:y,alt:d.alt,width:1600,height:1200,className:"max-h-[80vh] max-w-full object-contain",onError:()=>{f(!0),k(!0)},onLoad:()=>{k(!0),f(!1)}}),w&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-white",children:[e.jsx(r,{className:"h-16 w-16 text-gray-400 mb-4"}),e.jsx("p",{children:"Image could not be loaded"})]}),b.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:m,className:"absolute left-4 top-1/2 -translate-y-1/2 p-2 bg-black/60 rounded-full text-white hover:bg-black/80 transition-colors","aria-label":"Previous image",children:e.jsx(n,{className:"h-6 w-6"})}),e.jsx("button",{onClick:g,className:"absolute right-4 top-1/2 -translate-y-1/2 p-2 bg-black/60 rounded-full text-white hover:bg-black/80 transition-colors","aria-label":"Next image",children:e.jsx(c,{className:"h-6 w-6"})})]})]}),e.jsxs("div",{className:"absolute top-4 left-4 bg-black/60 px-3 py-1 rounded-full text-white text-sm",children:[u+1," / ",b.length]}),d.caption&&e.jsxs("div",{className:"p-4 text-white text-center",children:[e.jsx("p",{children:d.caption}),d.category&&e.jsx("span",{className:"text-sm text-gray-300 mt-1 block",children:d.category})]})]})})})};export{u as I,h as g,i};