"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("date-fns"),y=require("./datepicker-constants.cjs"),u=t=>t?new Date(t):new Date,g=(t,e,a)=>{const o=u(JSON.parse(JSON.stringify(t))),s=[];for(let r=0;r<7;r++){const c=n.addDays(o,r),D=n.getMonth(c)!==e;s.push({text:c.getDate(),value:c,currentMonth:!D,isFirstDayOfMonth:c.getDate()===1&&!D,selected:a?c.getDate()===a&&!D:!1})}return s},h=(t,e)=>!t||!e?!1:n.isEqual(t,e),m=(t,e,a)=>{const o=[],s=u(new Date(e,t)),r=u(new Date(e,t+1,0)),c=y.WEEK_START,D=n.startOfWeek(s,{weekStartsOn:c}),d=i=>{const f=g(i,t,a);if(o.push({days:f}),!o[o.length-1].days.some(l=>h(l.value,r))){const l=n.addDays(i,7);d(l)}};return d(D),o},M=(t,e)=>{const a=[1,2,3,4,5,6,7].map(r=>new Intl.DateTimeFormat(t,{weekday:"short",timeZone:"UTC"}).format(new Date(`2017-01-0${r}T00:00:00+00:00`)).slice(0,2)),o=a.slice(0,e),s=a.slice(e+1,a.length);return[a[e]].concat(...s).concat(...o)},w=(t,e,a)=>new Intl.DateTimeFormat(a,{month:e}).format(new Date(2e3,t,1)),k=(t,e,a)=>new Intl.DateTimeFormat(a,{dateStyle:e}).format(new Date(t)),W=t=>{const e=new Date(t),a=n.getDay(e),o=n.addMonths(e,1),s=n.startOfMonth(o),r=n.getDay(s),c=(a-r+7)%7,D=n.addDays(s,c);return n.getDate(D)},O=t=>{const e=new Date(t),a=n.getDay(e);let s=n.endOfMonth(n.subMonths(e,1));for(;n.getDay(s)!==a;)s=n.addDays(s,-1);return n.getDate(s)};exports.calculateNextFocusDate=W;exports.calculatePrevFocusDate=O;exports.formatDate=k;exports.formatMonth=w;exports.getCalendarDays=m;exports.getWeekDayNames=M;
//# sourceMappingURL=utils.cjs.map
