import{C as x}from"./card-event.cc16f618.1750111005555.js";import{S as k,C}from"./carousel.faa29078.1750111005555.js";import{q as S,u as V,r,W as b,w as z,$ as E,o as s,e as n,f as l,i,C as B,A as f,V as h,M as N,E as A,F as M,J as W,j as D,B as d}from"./index.737529e8.1750111005555.js";import"./moment.a9aaa855.1750111005555.js";import"./no-image.16d7b980.1750111005555.js";import"./_plugin-vue_export-helper.c27b6911.1750111005555.js";const P={key:0,class:"position-relative"},j={key:0,class:"d-flex justify-space-between align-center flex-row w-100 position-absolute",style:{top:"45%"}},q={key:1,class:"text-center font-weight-bold"},U={__name:"eventos-home",setup(F){const{width:u}=S(),g=V("userData").value,c=r(!1),t=r([]);b(()=>{y()});const a=r(!1);a.value=u.value<768,z(u,()=>{a.value=u.value<768});const y=async()=>{c.value=!0;try{const o=await E("/events/getAll/u",{method:"GET",query:{itemsPerPage:10,userData:JSON.stringify(g)}});if(!o)return;console.log("Eventos:",o),t.value=o.eventos}catch(o){console.error("Erro ao buscar eventos:",o,o.response),t.value=[]}c.value=!1},e=r(0),w=()=>{e.value+=a?1:2,e.value>=t.value.length&&(e.value=0)},_=()=>{e.value-=a?1:2,e.value<0&&(e.value=t.value.length-1)};return(o,v)=>t.value.length>0||c.value?(s(),n("div",P,[l(f(C),{"items-to-show":a.value?1:3,ref:"carousel",modelValue:e.value,"onUpdate:modelValue":v[0]||(v[0]=m=>e.value=m),autoplay:4e3,style:B(a.value?"":"margin-left: 45px; margin-right: 45px;"),snapAlign:t.value.length>=3?"center":"start"},{slides:i(({slideWidth:m,currentSlide:J})=>[(s(!0),n(M,null,W(t.value,(p,T)=>(s(),D(f(k),{key:p.id},{default:i(()=>[l(x,{event:p,isHomePage:!0},null,8,["event"])]),_:2},1024))),128))]),_:1},8,["items-to-show","modelValue","style","snapAlign"]),a.value?N("",!0):(s(),n("div",j,[l(h,{variant:"elevated",icon:"",onClick:_,color:"primary",size:"small"},{default:i(()=>[l(d,{icon:"tabler-caret-left-filled",color:"white",size:"25"})]),_:1}),l(h,{variant:"elevated",icon:"",onClick:w,color:"primary",size:"small"},{default:i(()=>[l(d,{icon:"tabler-caret-right-filled",color:"white",size:"25"})]),_:1})]))])):(s(),n("p",q,[l(d,{icon:"tabler-mood-sad",color:"primary",size:"22"}),A(" Nenhum evento disponível no momento. ")]))}};export{U as default};
