import{d as L,k as T,r as h,c as k,bw as N,af as R,ah as G,s as y,t as I,w as i,v as C,x as g,y as s,bx as F,by as D,C as M,F as O,D as U,W as V,m as n,z as S,al as j,I as A,ag as B,G as W,A as z,V as q,b as H}from"./entry.i4-YWfY3.js";import{b,u as J}from"./calendar.CIWpdKVI.js";import{D as K}from"./datetime.lqzArHOP.js";import{_ as Q}from"./index.vue.NDEmE0EU.js";import{_ as X}from"./nuxt-layout.DcX9Wg7V.js";import{u as Y}from"./meta.wblBiaR4.js";import{u as Z}from"./meta-social.Cquc1gBX.js";import"./VPagination.DIJAIegk.js";import"./search.BZUlJTgR.js";import"./url.BYhwQlO0.js";import"./VChip.BC1vQyqb.js";import"./VWindowItem.DkWTNiOX.js";const ee={class:"text-h6 font-weight-thin text-center"},te=L({__name:"Calendar",props:{events:{},modelValue:{}},emits:["update:modelValue"],setup(x,{emit:w}){const f=x,{FullCalendar:v,dayGridPlugin:c,timeGridPlugin:E,listPlugin:P}=T().$FullCalendar,o=h(),a=k(()=>o.value.calendar),d=w,r=[{label:"Month",view:"dayGridMonth"},{label:"Week",view:"timeGridWeek"}],m=N({plugins:[c,E,P],initialView:r[0].view,nowIndicator:!0,headerToolbar:!1,eventDisplay:"block",eventBackgroundColor:"rgb(5, 65, 115)",datesSet:t=>{d("update:modelValue",t)},eventDidMount:({el:t,event:l})=>{t.title=l.title,l.extendedProps.cancelled&&t.classList.add("cancelled")}}),e=k(()=>f.events.map(t=>{var u;const l=!!t.all_day;return{id:t.system.uid,title:(u=b(t))==null?void 0:u.title,url:t.url,start:t.start_date,end:l?K.fromISO(t.end_date).startOf("day").plus({days:1}).toISODate():t.end_date,allDay:l,extendedProps:t}}));return R(e,t=>{m.events=t}),G(()=>{m.height="auto",o.value.calendar.updateSize()}),(t,l)=>(y(),I(A,{variant:"flat"},{default:i(()=>{var u;return[C("div",ee,g((u=t.modelValue)==null?void 0:u.view.title),1),s(F,{color:"white"},{default:i(()=>[s(D,{divided:"",variant:"outlined"},{default:i(()=>[(y(),M(O,null,U(r,({label:p,view:_})=>{var $;return s(V,{onClick:oe=>n(a).changeView(_),active:(($=t.modelValue)==null?void 0:$.view.type)===_},{default:i(()=>[S(g(p),1)]),_:2},1032,["onClick","active"])}),64))]),_:1}),s(j),s(D,{divided:"",variant:"outlined"},{default:i(()=>[s(V,{onClick:l[0]||(l[0]=p=>n(a).today())},{default:i(()=>[S(" Today ")]),_:1}),s(V,{onClick:l[1]||(l[1]=p=>n(a).prev()),title:"Previous",icon:"fa fa-chevron-left"}),s(V,{onClick:l[2]||(l[2]=p=>n(a).next()),title:"Next",icon:"fa fa-chevron-right"})]),_:1})]),_:1}),s(n(v),{ref_key:"calendarRef",ref:o,options:n(m)},null,8,["options"])]}),_:1}))}}),ae={class:"text-overline"},ne={class:"font-weight-bold"},ge=L({__name:"index",setup(x){Y("Events"),Z(void 0,{title:"Events"});const w=o=>{var a,d,r,m,e;return(e=H((m=(r=(d=(a=b(o))==null?void 0:a.base)==null?void 0:d.image)==null?void 0:r[0])==null?void 0:m.public_id,{width:64}))==null?void 0:e.toURL()},f=h(0),v=k(()=>f.value===1),c=h(),E=k(()=>({hitsPerPage:v.value?1e3:void 0,filters:v.value&&c.value?`_start_date:${c.value.start.getTime()} TO ${c.value.end.getTime()}`:void 0})),P=o=>{var a,d,r;return((r=(d=(a=o.locationConnection)==null?void 0:a.edges)==null?void 0:d[0])==null?void 0:r.node)??void 0};return(o,a)=>{const d=te,r=Q,m=X;return y(),I(m,null,{default:i(()=>[C("article",null,[s(r,{tab:n(f),"onUpdate:tab":a[1]||(a[1]=e=>B(f)?f.value=e:null),config:[n(E)],"hide-hits":n(v),placeholder:n(v)?"Filter":void 0},{default:i(({items:e})=>[n(v)?(y(),I(d,{key:0,modelValue:n(c),"onUpdate:modelValue":a[0]||(a[0]=t=>B(c)?c.value=t:null),events:e},null,8,["modelValue","events"])):W("",!0)]),hit:i(({hit:e,index:t,sendEvent:l})=>[s(z,{href:e==null?void 0:e.url,"append-avatar":w(e),onClick:u=>l("click",e,e.objectID)},{default:i(()=>{var u,p,_;return[C("div",ae,g(((u=P(e))==null?void 0:u.title)??((p=("useParentEvent"in o?o.useParentEvent:n(b))(e))==null?void 0:p.calendar)),1),C("div",ne,g([e.cancelled?"CANCELLED":null,(_=("useParentEvent"in o?o.useParentEvent:n(b))(e))==null?void 0:_.title].filter(Boolean).join(" - ")),1),s(q,null,{default:i(()=>[S(g([("useEventInstanceRange"in o?o.useEventInstanceRange:n(J))(e,!0),e.notes].filter(Boolean).join(" - ")),1)]),_:2},1024)]}),_:2},1032,["href","append-avatar","onClick"])]),_:1},8,["tab","config","hide-hits","placeholder"])])]),_:1})}}});export{ge as default};