import{d as m}from"./app-eBVI1eNF.js";import{a as n,k as S}from"./EchoChannel-Dko4GTAA.js";const R=m("gate",()=>{const a=n(null),d=n(!1),v=n(!1),f=n(!1),r=n(!1),o=n([]),c=n(),u=n(window.matchMedia("(pointer: coarse)").matches);S(window.matchMedia("(pointer: coarse)"),"change",e=>{u.value=e.matches});const h=async e=>{const s=await fetch(`/event-gate/${e.id}/register`,{headers:{"X-CSRF-TOKEN":a.value},method:"POST"}),{success:t}=await s.json();return t},p=async e=>{const s=await fetch(`/event-gate/${e.id}/quote`,{headers:{"X-CSRF-TOKEN":a.value},method:"POST"}),{success:t}=await s.json();return t},l=async e=>{o.value=o.value.map(s=>(s.data=s.data.map(t=>t.id===e.id?e:t),s.isPersonal&&!s.data.find(t=>t.id===e.id)&&s.data.push(e),s)),c.value.id===e.id&&(c.value=e)};return{csrf:a,eventHero:c,eventLists:o,cardHover:d,autoClose:v,lockHovering:f,isTouching:u,replayIsStart:r,eventQuote:p,eventRegister:h,updateEventSession:async e=>{const s=e.sessions.filter(i=>i.selected).map(i=>i.id),t=await fetch(`/event-gate/${e.id}/sessions`,{headers:{"X-CSRF-TOKEN":a.value,"Content-Type":"application/json"},body:JSON.stringify({sessions:s}),method:"POST"}),{success:w}=await t.json();return await l(e),w},updateCard:l,downloadCalendar:async e=>{const s=await fetch(`/event-gate/${e.id}/calendar`),{success:t}=await s.json();return t},startReplay:()=>{r.value=!0}}});export{R as u};