import{a as e,c as t,f as n,n as r}from"./apiFetch-C4rLkcBG.js";var i=n();function a(e){let t={};return e.searchTerm&&(t.search_term=e.searchTerm),e.startDate&&(t.start_date=e.startDate),e.endDate&&(t.end_date=e.endDate),e.locationText&&(t.location_text=e.locationText),e.city&&(t.city=e.city),e.country&&(t.country=e.country),e.minPrice!==void 0&&(t.min_price=e.minPrice),e.maxPrice!==void 0&&(t.max_price=e.maxPrice),e.freeOnly&&(t.free_only=!0),e.paidOnly&&(t.paid_only=!0),e.excludeFull&&(t.exclude_full=!0),e.isPrivate&&(t.is_private=!0),e.isPublic&&(t.is_public=!0),e.organizerId&&(t.organizer_id=e.organizerId),e.radiusKm&&e.userLatitude!==void 0&&e.userLongitude!==void 0&&(t.lat=e.userLatitude,t.lng=e.userLongitude,t.radius_km=e.radiusKm),t}function o(e,t){let n=new URLSearchParams,r=a(t);for(let[e,t]of Object.entries(r))t!==void 0&&n.append(e,String(t));t.statuses?.forEach(e=>n.append(`statuses`,e)),t.categoryIds?.forEach(e=>n.append(`category_ids`,e));let i=n.toString();return i?`${e}?${i}`:e}var s=new class{async getEvents(){return r(`${i}/events`)}async getFilteredEvents(e){return r(o(`${i}/events`,e))}async getEventById(e){return r(`${i}/events/${e}`)}async createEvent(e){return r(`${i}/events`,{method:`POST`,body:e})}async updateEvent(e,t){return r(`${i}/events/${e}`,{method:`PUT`,body:t})}async deleteEvent(e){await r(`${i}/events/${e}`,{method:`DELETE`})}async registerToEvent(e,t,n=`player`){await r(`${i}/events/${e}/register`,{method:`POST`,body:{userId:t,role:n}})}async unregisterFromEvent(e,t){await r(`${i}/events/${e}/unregister`,{method:`POST`,body:{userId:t}})}async getEventParticipants(e){return r(`${i}/events/${e}/participants`)}async isUserRegisteredToEvent(e,t){return r(`${i}/events/${e}/participants/${t}/check`)}},c=async(e=!1)=>r(e?`${t.EVENTS.LIST}?refresh=${Date.now()}`:`${i}${t.EVENTS.LIST}`),l=async(e,n=!1)=>{let a=`${i}${t.EVENTS.BY_ID(e)}`;return r(n?`${a}?refresh=${Date.now()}`:a)},u=async n=>r(`${i}${t.EVENTS.CREATE}`,{method:`POST`,body:n,timeout:e.TIMEOUTS.UPLOAD}),d=async(n,a)=>r(`${i}${t.EVENTS.UPDATE(n)}`,{method:`PUT`,body:a,timeout:e.TIMEOUTS.UPLOAD}),f=async e=>r(`${i}/events/${e}/participants`),p=async e=>r(`${i}${t.EVENTS.DELETE(e)}`,{method:`DELETE`}),m=()=>{},h=async e=>r(o(`${i}${t.EVENTS.LIST}`,e));export{c as a,h as c,s as i,d as l,u as n,l as o,p as r,f as s,m as t};