import{_ as z}from"./Section.yx9Eiag9.js";import{_ as K}from"./TagList.vue.D3xSu0MF.js";import{_ as U}from"./PagePreview.vue.n8JFaC2y.js";import{g as N,r as n,y as R,P as W,o as r,c as d,Q as G,m as e,R as J,i as X,s as Y,x as V,D as Z,M as ee,N as te,j as B,w as a,n as g,k as ne,b as o,a as C,A as se,F as ae,B as oe,L as M,O as re}from"./entry.Ddy3dMw-.js";import{_ as ie}from"./Page.CmHHJXlr.js";import{u as le}from"./pagination.4ttdWwDo.js";import{b as ue,c as ce}from"./index.CcnDKlv-.js";import"./home.DFk1FaXE.js";import"./image.Ca_qe83Z.js";import"./Image.vue.NJXRPlQC.js";import"./Image.vue.CPCAhc4E.js";import"./Video.vue.CoJ9SN4r.js";const me=N({__name:"IntersectionObserver",emits:["on-enter","on-leave"],setup(j,{emit:c}){const m=n(null),t=n(!1),i=n(),p=c;return R(()=>{i.value=new IntersectionObserver(_=>{_.forEach(l=>{l.isIntersecting?(t.value||p("on-enter"),t.value=!0):(t.value&&p("on-leave"),t.value=!1)})},{rootMargin:"0px 0px 0px 0px",threshold:.5}),!(!m.value||!i.value)&&i.value.observe(m.value)}),W(()=>{i.value&&i.value.disconnect()}),(_,l)=>(r(),d("div",{ref_key:"el",ref:m},[G(_.$slots,"default",{isIntersecting:e(t)})],512))}}),_e=["innerHTML"],ve={class:"relative"},de={key:0,initial:{opacity:0,y:10},visibleOnce:{opacity:1,y:0,transition:{type:"spring",stiffness:150,damping:50,mass:.5}}},pe={class:"leading-tight small"},fe={key:0,class:"flex items-center justify-center mt-gap-2"},Se=N({__name:"index",async setup(j){let c,m;const t=J(),i=()=>{const f=t.currentRoute.value.query;y.value=f.field},{data:p,error:_}=([c,m]=X(()=>ne(ue())),c=await c,m(),c);if(!p.value)throw _.value?_.value:new Error("No data");const l=p.value.result,y=n(void 0);i(),Y(l);const O=n(0),{paginationState:I,loadMore:q}=le(100,ce),h=n([]),w=n([]),P=async()=>{var x;const{data:f,error:E}=await q(void 0,y.value);if(!f.value)throw E.value?E.value:new Error("No data");const s=(x=f.value.result)==null?void 0:x.data;s&&(h.value=[...h.value,...s]),s&&(w.value[O.value]={itemIdsToShow:s.map(u=>u.id),items:[...h.value],isVisible:!0}),O.value++,await new Promise(u=>setTimeout(u,1e3)),Object.values(w.value).forEach((u,k)=>{u.isVisible=k===O.value-1})},b=n([]);V(()=>t.currentRoute.value.query,()=>{y.value=t.currentRoute.value.query.field}),V(()=>[y.value],()=>{h.value=[],b.value=[],P()}),R(async()=>{await Z(),P()});const T=n(null),$=()=>{T.value=setTimeout(()=>{P()},500)},D=()=>{T.value&&clearTimeout(T.value)};return(f,E)=>{const s=z,x=K,u=U,k=me,F=ee("masonry-wall"),Q=oe,A=ie,H=te("motion");return e(l)?(r(),B(A,{key:0},{default:a(()=>[o(s,null,{default:a(()=>[e(l).text?(r(),d("h1",{key:0,innerHTML:e(l).text},null,8,_e)):g("",!0)]),_:1}),o(s,null,{default:a(()=>[C("div",ve,[(r(!0),d(ae,null,se(Object.values(e(w)),(S,L)=>(r(),d("div",{key:L,class:M({"absolute w-full top-0 left-0 z-10":L<Object.values(e(w)).length-1})},[S.isVisible?(r(),B(F,{key:0,items:S.items,"ssr-columns":3,"column-width":300,"max-columns":3,gap:32},{default:a(({item:v})=>[o(k,{onOnEnter:ge=>e(b).push(v.id)},{default:a(()=>[C("div",{class:M(["mb-em",{"h-32":!e(b).includes(v.id)}])},[e(b).includes(v.id)?re((r(),d("div",de,[o(u,{item:v},{fields:a(()=>[C("div",pe,[o(x,{block:{id:v.id,isHidden:!1,type:"taglist",content:{tags:v.fields.toString(),customtags:""}}},null,8,["block"])])]),_:2},1032,["item"])])),[[H]]):g("",!0)],2)]),_:2},1032,["onOnEnter"])]),_:2},1032,["items"])):g("",!0)],2))),128))])]),_:1}),o(Q,null,{default:a(()=>[o(s,null,{default:a(()=>[e(I)&&e(I).page<e(I).pages?(r(),d("div",fe,[o(k,{onOnEnter:$,onOnLeave:D})])):g("",!0)]),_:1})]),_:1})]),_:1})):g("",!0)}}});export{Se as default};