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