"use client";import{a as d}from"./chunk-EIQPM3DQ.mjs";import{a as I}from"./chunk-EI3IJHIE.mjs";import{a as G}from"./chunk-JNIJ5N3Y.mjs";import{c as h}from"./chunk-S7CSCIW4.mjs";import"./chunk-JZXLCA2E.mjs";import{UniformSlot as R}from"@uniformdev/canvas-next-rsc/component";import F from"react-responsive-masonry";import{Fragment as v,jsx as y}from"react/jsx-runtime";var g={firstLineCount:2,secondLineCount:3,otherLinesCount:4},L=({slot:n,aspectRatio:s,config:r})=>{let{firstLineCount:i=g.firstLineCount,secondLineCount:p=g.secondLineCount,otherLinesCount:m=g.otherLinesCount}=r||{},{items:f=[]}=n||{},c=f.reduce((e,o,t)=>(t<i?e[0]?.push(o):t<i+p?e[1]?.push(o):e[2]?.push(o),e),[[],[],[]])||[];return y(v,{children:c?.map((e,o)=>e.length?y(F,{columnsCount:o<2||e.length<m?e.length:m,gutter:"4px",children:e.map((t,u)=>y("div",{className:h("flex flex-1 items-center justify-center",{[`aspect-${s}`]:!!s}),children:t},`img-${u}`))},`line-${o}`):null)})};import{jsx as l}from"react/jsx-runtime";var M=({slots:n,aspectRatio:s,items:r,backgroundColor:i,spacing:p,border:m,fluidContent:f,fullHeight:c,config:e,context:o,component:t})=>{let u=r?.length?{name:"items",items:G(r)?.map((a,C)=>l(d,{src:a.url,style:{objectFit:"cover"},alt:`Image ${C}`,fill:!0},a?.id||`image-${C}`))||[]}:n.imageGalleryItems,P=!r?.length&&!t?.slots?.imageGalleryItems?.filter(({_id:a})=>!a?.startsWith("placeholder"))?.length;return l(I,{backgroundColor:i,spacing:p,border:m,fluidContent:f,fullHeight:c,children:l("div",{className:"flex flex-col gap-1",children:P?l(R,{context:o,slot:n.imageGalleryItems,data:t}):l(L,{slot:u,aspectRatio:s,config:e})})})};export{M as ImageGallery};
