import{_ as x,r as f,z as c,o as m,c as h,b as r,t as V,B as g,g as B,e as w,L as M,h as N,d as $,M as y}from"./index-C3YRBAZr.js";import{l as A,i as T,a as F,F as q}from"./es-CHWiAYiD.js";const z=["aria-expanded"],E={class:"month-pick__toggle-label"},L={class:"fc-wrap"},O={__name:"MonthPickCalendar",props:{modelValue:{type:String,default:""},highlightDates:{type:Array,default:()=>[]},badgeByDate:{type:Object,default:()=>({})},minDate:{type:String,default:""},collapsible:{type:Boolean,default:!0},defaultCollapsed:{type:Boolean,default:!1},title:{type:String,default:"Calendario"}},emits:["update:modelValue","range-change"],setup(o,{emit:b}){const a=o,n=f(a.defaultCollapsed);c(()=>a.defaultCollapsed,e=>{n.value=e});const u=b,d=f(null);function s(e){const t=e.getFullYear(),l=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${l}-${i}`}function D(){return new Set(a.highlightDates.map(e=>String(e).slice(0,10)))}function C(e){const t=s(e.start),l=s(new Date(e.end.getTime()-1));u("range-change",{from:t,to:l})}function S(e){const t=s(e.date);a.minDate&&t<a.minDate||u("update:modelValue",t)}function k(e){const t=s(e.date),l=[];return a.minDate&&t<a.minDate&&l.push("cal-day-past"),D().has(t)&&l.push("cal-day-has-slots"),a.modelValue&&t===a.modelValue.slice(0,10)&&l.push("cal-day-selected"),l}function v(e){if(e.el.querySelector(".cal-appt-badge"))return;const t=s(e.date),l=a.badgeByDate[t];if(l!=null&&Number(l)>0){e.el.setAttribute("title",`${l} cita(s)`);const i=document.createElement("span");i.className="cal-appt-badge",i.textContent=String(l);const p=e.el.querySelector(".fc-daygrid-day-top");p&&p.appendChild(i)}}const _={plugins:[T,F],initialView:"dayGridMonth",locale:A,initialDate:a.modelValue||void 0,headerToolbar:{left:"prev,next today",center:"title",right:""},buttonText:{today:"Hoy"},height:"auto",fixedWeekCount:!1,selectable:!1,dateClick:S,datesSet:C,dayCellClassNames:k,dayCellDidMount:v};return c(()=>[a.modelValue,a.highlightDates,a.minDate,a.badgeByDate],()=>{y(()=>{d.value?.getApi()?.render()})},{deep:!0}),c(()=>a.modelValue,e=>{e&&y(()=>{const t=d.value?.getApi();t&&t.gotoDate(e)})}),(e,t)=>(m(),h("div",{class:g(["month-pick",{"month-pick--collapsible":o.collapsible}])},[o.collapsible?(m(),h("button",{key:0,type:"button",class:"month-pick__toggle","aria-expanded":!n.value,onClick:t[0]||(t[0]=l=>n.value=!n.value)},[r("span",E,V(o.title),1),r("span",{class:g(["month-pick__chev",{"is-open":!n.value}]),"aria-hidden":"true"},"▾",2)],8,z)):B("",!0),w(r("div",L,[N($(q),{ref_key:"fcRef",ref:d,options:_},null,512)],512),[[M,!o.collapsible||!n.value]])],2))}},Y=x(O,[["__scopeId","data-v-e3db4d28"]]);export{Y as M};
