import{A as e,B as t,D as n,H as r,M as i,U as a,_ as o,c as s,f as c,l,m as u,x as d}from"./index-HVdHQ9Gs.js";var f={class:`outer-grid`},p=[`onClickCapture`,`id`],m=[`src`,`alt`],h={class:`photo-abs-container`,absolute:``,"inset-0":``,flex:``,"justify-center":``,"items-center":``},g=[`src`,`alt`],_=s(d({__name:`Photo`,setup(s){function d(e){return Array.from(e).reduce((e,t)=>(e+t.charCodeAt(0)*65535)%22859,0)/22859}async function _(e,t=100){return new Promise(n=>{let r=()=>{let i=e();i?n(i):setTimeout(r,t)};r()})}let v=l(),y=t([]),b=t([]),x={1:0,2:.3,3:.5},S=async()=>{y.value=await(await fetch(`https://p.aza.moe/photos`)).json(),y.value.sort((e,t)=>e.exif.DateTime<t.exif.DateTime?1:-1);let e=[],t=[];y.value.forEach(n=>{t.length===0?t.push(n):t.length>=3||d(n.original_photo)<x[t.length]?(e.push(t),t=[n]):t.push(n)}),t.length>0&&e.push(t),b.value=e},C=e=>(e=e.replace(`data/photos`,`static`).replace(`./`,``),`https://p.aza.moe/${e}`),w=e=>`rotate(${d(e)*20-10}deg)`,T=async(e,t)=>{console.log(`Clicked photo:`,e.id);let n=t.currentTarget,r=n.querySelector(`.photo-wrapper`);r.style.viewTransitionName=`photo-${e.id}`,await document.startViewTransition(()=>{n.classList.toggle(`active`),document.getElementsByClassName(`blur`)[0].toggleAttribute(`hidden`)}).finished,r.style.viewTransitionName=``};return n(async()=>{await S(),v.params.id&&(await _(()=>document.getElementById(`photo-${v.params.id}`))).click()}),(t,n)=>(e(),o(c,null,[n[0]||=u(`div`,{class:`title`},[u(`div`,{class:`font-script-en bold`},`The Wandering Gallery`),u(`div`,{class:`subtitle <sm:hidden`},`想要把旅行中用相机拍到好看照片时的喜悦分享给幸运的路人，所以买了便携照片打印机、搭了这个网页！`)],-1),u(`div`,f,[(e(!0),o(c,null,i(b.value,t=>(e(),o(`div`,{key:t[0].id,flex:``,"justify-center":``,class:r(`grid-cols-${t.length}`)},[(e(!0),o(c,null,i(t,t=>(e(),o(`div`,{key:t.id,onClickCapture:async e=>await T(t,e),class:`img-container`,"cursor-pointer":``,id:`photo-${t.id}`},[u(`img`,{class:`photo`,"w-full":``,"h-full":``,"object-contain":``,"opacity-0":``,src:C(t.thumbnail_edited),alt:t.id},null,8,m),u(`div`,h,[u(`div`,{class:`photo-wrapper`,style:a({transform:w(t.id)})},[u(`img`,{class:`photo`,"w-full":``,"object-contain":``,src:C(t.thumbnail_edited),alt:t.id},null,8,g)],4)])],40,p))),128))],2))),128))]),n[1]||=u(`div`,{class:`blur`,hidden:``,"pos-fixed":``,"inset-0":``,"backdrop-blur-sm":``,"z-5":``},null,-1)],64))}}),[[`__scopeId`,`data-v-5be140d4`]]);export{_ as default};