Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vanilla-calendar-pro

Package Overview
Dependencies
Maintainers
0
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vanilla-calendar-pro - npm Package Compare versions

Comparing version 2.9.10 to 3.0.0-beta.1

utilities/types.ts

4

build/vanilla-calendar.min.js

@@ -1,2 +0,2 @@

/*! name: vanilla-calendar-pro v2.9.10 | url: https://github.com/uvarov-frontend/vanilla-calendar-pro */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VanillaCalendar=t()}(this,(function(){"use strict";var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(t,n,a)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[n]=a,l=(e,l)=>{for(var i in l||(l={}))n.call(l,i)&&s(e,i,l[i]);if(t)for(var i of t(l))a.call(l,i)&&s(e,i,l[i]);return e},i=(e,t,n)=>(s(e,"symbol"!=typeof t?t+"":t,n),n);const r={calendar:"vanilla-calendar",calendarDefault:"vanilla-calendar_default",calendarMultiple:"vanilla-calendar_multiple",calendarMonth:"vanilla-calendar_month",calendarYear:"vanilla-calendar_year",calendarHidden:"vanilla-calendar_hidden",calendarToInput:"vanilla-calendar_to-input",calendarToInputTop:"vanilla-calendar_to-input_top",calendarToInputBottom:"vanilla-calendar_to-input_bottom",controls:"vanilla-calendar-controls",grid:"vanilla-calendar-grid",gridDisabled:"vanilla-calendar-grid_disabled",column:"vanilla-calendar-column",columnMonth:"vanilla-calendar-column_month",columnYear:"vanilla-calendar-column_year",header:"vanilla-calendar-header",headerContent:"vanilla-calendar-header__content",month:"vanilla-calendar-month",monthDisabled:"vanilla-calendar-month_disabled",year:"vanilla-calendar-year",yearDisabled:"vanilla-calendar-year_disabled",arrow:"vanilla-calendar-arrow",arrowPrev:"vanilla-calendar-arrow_prev",arrowNext:"vanilla-calendar-arrow_next",wrapper:"vanilla-calendar-wrapper",content:"vanilla-calendar-content",week:"vanilla-calendar-week",weekDay:"vanilla-calendar-week__day",weekDayWeekend:"vanilla-calendar-week__day_weekend",days:"vanilla-calendar-days",daysSelecting:"vanilla-calendar-days_selecting",months:"vanilla-calendar-months",monthsSelecting:"vanilla-calendar-months_selecting",monthsMonth:"vanilla-calendar-months__month",monthsMonthSelected:"vanilla-calendar-months__month_selected",monthsMonthDisabled:"vanilla-calendar-months__month_disabled",years:"vanilla-calendar-years",yearsSelecting:"vanilla-calendar-years_selecting",yearsYear:"vanilla-calendar-years__year",yearsYearSelected:"vanilla-calendar-years__year_selected",yearsYearDisabled:"vanilla-calendar-years__year_disabled",time:"vanilla-calendar-time",timeContent:"vanilla-calendar-time__content",timeHours:"vanilla-calendar-time__hours",timeMinutes:"vanilla-calendar-time__minutes",timeKeeping:"vanilla-calendar-time__keeping",timeRanges:"vanilla-calendar-time__ranges",timeRange:"vanilla-calendar-time__range",day:"vanilla-calendar-day",dayHoverFirst:"vanilla-calendar-day_hover-first",dayHoverLast:"vanilla-calendar-day_hover-last",dayHoverIntermediate:"vanilla-calendar-day_hover-intermediate",daySelectedFirst:"vanilla-calendar-day_selected-first",daySelectedLast:"vanilla-calendar-day_selected-last",daySelectedIntermediate:"vanilla-calendar-day_selected-intermediate",dayPopup:"vanilla-calendar-day__popup",dayBtn:"vanilla-calendar-day__btn",dayBtnPrev:"vanilla-calendar-day__btn_prev",dayBtnNext:"vanilla-calendar-day__btn_next",dayBtnToday:"vanilla-calendar-day__btn_today",dayBtnSelected:"vanilla-calendar-day__btn_selected",dayBtnHover:"vanilla-calendar-day__btn_hover",dayBtnDisabled:"vanilla-calendar-day__btn_disabled",dayBtnWeekend:"vanilla-calendar-day__btn_weekend",dayBtnHoliday:"vanilla-calendar-day__btn_holiday",weekNumbers:"vanilla-calendar-week-numbers",weekNumbersTitle:"vanilla-calendar-week-numbers__title",weekNumbersContent:"vanilla-calendar-week-numbers__content",weekNumber:"vanilla-calendar-week-number",isFocus:"vanilla-calendar-is-focus"},d=e=>`<div class="${e.controls}"><#ArrowPrev /><#ArrowNext /></div><div class="${e.grid}"><#Multiple><div class="${e.column}"><div class="${e.header}"><div class="${e.headerContent}"><#Month /><#Year /></div></div><div class="${e.wrapper}"><#WeekNumbers /><div class="${e.content}"><#Week /><#Days /></div></div></div><#/Multiple></div><#ControlTime />`,o=e=>`<div class="${e.header}"><div class="${e.headerContent}"><#Month /><#Year /></div></div><div class="${e.wrapper}"><div class="${e.content}"><#Months /></div></div>`,c=e=>`<div class="${e.header}"><#ArrowPrev /><div class="${e.headerContent}"><#Month /><#Year /></div><#ArrowNext /></div><div class="${e.wrapper}"><div class="${e.content}"><#Years /></div></div>`;class u{constructor(){var e;i(this,"isInit",!1),i(this,"isInputInit",!1),i(this,"input",!1),i(this,"type","default"),i(this,"months",2),i(this,"jumpMonths",1),i(this,"jumpToSelectedDate",!1),i(this,"toggleSelected",!0),i(this,"date",{min:"1970-01-01",max:"2470-12-31",today:new Date}),i(this,"settings",{lang:"en",iso8601:!0,range:{min:void 0,max:void 0,disablePast:!1,disableGaps:!1,edgesOnly:!1,disableAllDays:!1,disableWeekday:void 0,disabled:void 0,enabled:void 0},selection:{day:"single",month:!0,year:!0,time:!1,controlTime:"all",stepHours:1,stepMinutes:1,cancelableDay:!0},selected:{dates:void 0,month:void 0,year:void 0,holidays:void 0,time:void 0},visibility:{theme:"system",themeDetect:"html[data-theme]",monthShort:!0,weekNumbers:!1,weekend:!0,today:!0,disabled:!1,daysOutside:!0,positionToInput:"left"}}),i(this,"locale",{months:[],weekday:[]}),i(this,"sanitizer",(e=>e)),i(this,"actions",{clickDay:null,clickWeekNumber:null,clickMonth:null,clickYear:null,clickArrow:null,changeTime:null,changeToInput:null,getDays:null,getMonths:null,getYears:null,initCalendar:null,updateCalendar:null,destroyCalendar:null,showCalendar:null,hideCalendar:null}),i(this,"popups",{}),i(this,"CSSClasses",l({},r)),i(this,"DOMTemplates",{default:(e=this.CSSClasses,`<div class="${e.header}"><#ArrowPrev /><div class="${e.headerContent}"><#Month /><#Year /></div><#ArrowNext /></div><div class="${e.wrapper}"><#WeekNumbers /><div class="${e.content}"><#Week /><#Days /></div></div><#ControlTime />`),multiple:d(this.CSSClasses),month:o(this.CSSClasses),year:c(this.CSSClasses)}),i(this,"HTMLElement"),i(this,"HTMLOriginalElement"),i(this,"HTMLInputElement"),i(this,"rangeMin"),i(this,"rangeMax"),i(this,"rangeDisabled"),i(this,"rangeEnabled"),i(this,"selectedDates"),i(this,"selectedHolidays"),i(this,"selectedMonth"),i(this,"selectedYear"),i(this,"selectedHours"),i(this,"selectedMinutes"),i(this,"selectedKeeping"),i(this,"selectedTime"),i(this,"currentType"),i(this,"correctMonths"),i(this,"viewYear"),i(this,"dateMin"),i(this,"dateMax")}}const m=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,g=e=>new Date(`${e}T00:00:00`),h=e=>e.reduce(((e,t)=>{if(t instanceof Date||"number"==typeof t){const n=t instanceof Date?t:new Date(t);e.push(n.toISOString().substring(0,10))}else t.match(/^(\d{4}-\d{2}-\d{2})$/g)?e.push(t):t.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,((t,n,a)=>{const s=g(n),l=g(a),i=new Date(s.getTime());for(;i<=l;i.setDate(i.getDate()+1))e.push(m(i));return t}));return e}),[]),y=()=>{const e=new Date;return new Date(e.getTime()-6e4*e.getTimezoneOffset()).toISOString().substring(0,10)},v=e=>e?{0:"12",13:"01",14:"02",15:"03",16:"04",17:"05",18:"06",19:"07",20:"08",21:"09",22:"10",23:"11"}[Number(e)]||String(e):"",p=e=>`${e} is not found, check the first argument passed to new VanillaCalendar.`,S='The calendar has not been initialized, please initialize it using the "init()" method first.',M='You specified "define" for "settings.lang" but did not provide the required values for "locale.weekday" or "locale.months".',C='Incorrect name of theme in "settings.visibility.theme".',b="The value of the time property can be: false, true, 12 or 24.",f=e=>{e.currentType=e.type,(e=>{var t;if(e.jumpToSelectedDate&&(null==(t=e.settings.selected.dates)?void 0:t.length)&&void 0===e.settings.selected.month&&void 0===e.settings.selected.year){const t=g(h(e.settings.selected.dates)[0]);e.settings.selected.month=t.getMonth(),e.settings.selected.year=t.getFullYear()}const n=void 0!==e.settings.selected.month&&Number(e.settings.selected.month)>=0&&Number(e.settings.selected.month)<12,a=void 0!==e.settings.selected.year&&Number(e.settings.selected.year)>=0&&Number(e.settings.selected.year)<=9999;e.selectedMonth=n?Number(e.settings.selected.month):e.date.today.getMonth(),e.selectedYear=a?Number(e.settings.selected.year):e.date.today.getFullYear(),e.viewYear=e.selectedYear})(e),(e=>{var t,n,a;"today"===e.date.min&&(e.date.min=y()),"today"===e.date.max&&(e.date.max=y()),"today"===e.settings.range.min&&(e.settings.range.min=y()),"today"===e.settings.range.max&&(e.settings.range.max=y()),e.settings.range.min=e.settings.range.min?g(e.date.min)>=g(e.settings.range.min)?e.date.min:e.settings.range.min:e.date.min,e.settings.range.max=e.settings.range.max?g(e.date.max)<=g(e.settings.range.max)?e.date.max:e.settings.range.max:e.date.max;const s=e.settings.range.disablePast&&!e.settings.range.disableAllDays&&g(e.settings.range.min)<e.date.today;e.rangeMin=s||e.settings.range.disableAllDays?m(e.date.today):e.settings.range.min,e.rangeMax=e.settings.range.disableAllDays?m(e.date.today):e.settings.range.max,e.rangeDisabled=e.settings.range.disabled&&!e.settings.range.disableAllDays?h(e.settings.range.disabled):e.settings.range.disableAllDays?[e.rangeMin]:[],e.rangeDisabled.length>1&&e.rangeDisabled.sort(((e,t)=>+new Date(e)-+new Date(t))),e.rangeEnabled=e.settings.range.enabled?h(e.settings.range.enabled):[],(null==(t=e.rangeEnabled)?void 0:t[0])&&(null==(n=e.rangeDisabled)?void 0:n[0])&&(e.rangeDisabled=e.rangeDisabled.filter((t=>!e.rangeEnabled.includes(t)))),e.rangeEnabled.length>1&&e.rangeEnabled.sort(((e,t)=>+new Date(e)-+new Date(t))),(null==(a=e.rangeEnabled)?void 0:a[0])&&e.settings.range.disableAllDays&&(e.rangeMin=e.rangeEnabled[0],e.rangeMax=e.rangeEnabled[e.rangeEnabled.length-1])})(e),(e=>{var t,n;e.selectedDates=(null==(t=e.settings.selected.dates)?void 0:t[0])?h(e.settings.selected.dates):[],e.selectedHolidays=(null==(n=e.settings.selected.holidays)?void 0:n[0])?h(e.settings.selected.holidays):[]})(e),(e=>{e.dateMin=e.settings.visibility.disabled?g(e.date.min):g(e.rangeMin),e.dateMax=e.settings.visibility.disabled?g(e.date.max):g(e.rangeMax)})(e),(e=>{const t=!0===e.settings.selection.time||12===e.settings.selection.time;if(t||24===e.settings.selection.time){let n=!1;if("string"==typeof e.settings.selected.time){const a=t?/^([0-9]|0[1-9]|1[0-2]):([0-5][0-9])|(AM|PM)/g:/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])/g;e.settings.selected.time.replace(a,((a,s,l,i)=>(s&&l&&(n=!0,e.selectedHours=s,e.selectedMinutes=l),i&&t?e.selectedKeeping=i:t&&(e.selectedKeeping="AM"),"")))}!n&&t?(e.selectedHours=v(String(e.date.today.getHours())),e.selectedMinutes=String(e.date.today.getMinutes()),e.selectedKeeping=Number(e.date.today.getHours())>=12?"PM":"AM"):n||(e.selectedHours=String(e.date.today.getHours()),e.selectedMinutes=String(e.date.today.getMinutes())),e.selectedHours=Number(e.selectedHours)<10?`0${Number(e.selectedHours)}`:`${e.selectedHours}`,e.selectedMinutes=Number(e.selectedMinutes)<10?`0${Number(e.selectedMinutes)}`:`${e.selectedMinutes}`,e.selectedTime=`${e.selectedHours}:${e.selectedMinutes}${e.selectedKeeping?` ${e.selectedKeeping}`:""}`}else if(e.settings.selection.time)throw new Error(b)})(e),(e=>{e.correctMonths="multiple"===e.type?1===e.months?2:e.months>12?12:e.months:1})(e)},w=({arrowPrev:e,arrowNext:t,isPrevHidden:n,isNextHidden:a})=>{e.style.visibility=n?"hidden":"",t.style.visibility=a?"hidden":""},D=e=>{var t,n;if("month"===e.currentType)return;const a=null==(t=e.HTMLElement)?void 0:t.querySelector(`.${e.CSSClasses.arrowPrev}`),s=null==(n=e.HTMLElement)?void 0:n.querySelector(`.${e.CSSClasses.arrowNext}`);if(!a||!s)return;({default:()=>{const t=g(m(new Date(e.selectedYear,e.selectedMonth,1))),n=new Date(t.getTime()),l=new Date(t.getTime());n.setMonth(n.getMonth()-e.jumpMonths),l.setMonth(l.getMonth()+e.jumpMonths),e.settings.selection.year||(e.dateMin.setFullYear(t.getFullYear()),e.dateMax.setFullYear(t.getFullYear()));const i=!e.settings.selection.month||n.getFullYear()<e.dateMin.getFullYear()||n.getFullYear()===e.dateMin.getFullYear()&&n.getMonth()<e.dateMin.getMonth(),r=!e.settings.selection.month||l.getFullYear()>e.dateMax.getFullYear()||l.getFullYear()===e.dateMax.getFullYear()&&l.getMonth()>e.dateMax.getMonth();w({arrowPrev:a,arrowNext:s,isPrevHidden:i,isNextHidden:r})},year:()=>{w({arrowPrev:a,arrowNext:s,isPrevHidden:e.dateMin.getFullYear()&&e.viewYear-7<=e.dateMin.getFullYear(),isNextHidden:e.dateMax.getFullYear()&&e.viewYear+7>=e.dateMax.getFullYear()})}})["multiple"===e.currentType?"default":e.currentType]()},T=(e,t)=>{if(!e)return null;const n=g(e),a=t?n.getDay()||7:n.getDay();n.setDate(n.getDate()+4-a);const s=new Date(n.getFullYear(),0,1),l=Math.ceil(((+n-+s)/864e5+1)/7);return{year:n.getFullYear(),week:l}};function L(e){if(!e||!e.getBoundingClientRect)return{top:0,bottom:0,left:0,right:0};const t=e.getBoundingClientRect(),n=document.documentElement;return{bottom:t.bottom,right:t.right,top:t.top+window.scrollY-n.clientTop,left:t.left+window.scrollX-n.clientLeft}}function E(){return{vw:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),vh:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}}function $(e){const{top:t,left:n}={left:window.scrollX||document.documentElement.scrollLeft||0,top:window.scrollY||document.documentElement.scrollTop||0},{top:a,left:s}=L(e),{vh:l,vw:i}=E(),r=a-t,d=s-n;return{top:r,bottom:l-(r+e.clientHeight),left:d,right:i-(d+e.clientWidth)}}function H(e,t,n=5){const a={top:!0,bottom:!0,left:!0,right:!0},s=[];if(!t||!e)return{canShow:a,parentPositions:s};const{bottom:l,top:i}=$(e),{top:r,left:d}=L(e),{height:o,width:c}=t.getBoundingClientRect(),{vh:u,vw:m}=E(),g=m/2,h=u/2;return[{condition:r<h,position:"top"},{condition:r>h,position:"bottom"},{condition:d<g,position:"left"},{condition:d>g,position:"right"}].forEach((({condition:e,position:t})=>{e&&s.push(t)})),Object.assign(a,{top:o<=i-n,bottom:o<=l-n,left:c<=d,right:c<=m-d}),{canShow:a,parentPositions:s}}const k=(e,t,n,a)=>{if(e){const s="auto"===n?function(e,t){const n="left";if(!t||!e)return n;const{canShow:a,parentPositions:s}=H(e,t),l=a.left&&a.right;return(l&&a.bottom?"center":l&&a.top?["top","center"]:Array.isArray(s)?["bottom"===s[0]?"top":"bottom",...s.slice(1)]:s)||n}(e,t):n,l={top:-t.offsetHeight,bottom:e.offsetHeight,left:0,center:e.offsetWidth/2-t.offsetWidth/2,right:e.offsetWidth-t.offsetWidth},i=Array.isArray(s)?s[0]:"bottom",r=Array.isArray(s)?s[1]:s;"bottom"===i?(t.classList.remove(a.calendarToInputTop),t.classList.add(a.calendarToInputBottom)):(t.classList.remove(a.calendarToInputBottom),t.classList.add(a.calendarToInputTop));const{top:d,left:o}=L(e),c=d+l[i];let u=o+l[r];const{vw:m}=E();if(u+t.clientWidth>m){const e=window.innerWidth-document.body.clientWidth;u=m-t.clientWidth-e}else u<0&&(u=0);Object.assign(t.style,{left:`${u}px`,top:`${c}px`})}},x=(e,t)=>{var n;e.popups&&(null==(n=Object.entries(e.popups))||n.forEach((([n,a])=>((e,t,n,a)=>{const s=e.CSSClasses.dayPopup,l=a.querySelector(`[data-calendar-day="${t}"]`);if(l&&((null==n?void 0:n.modifier)&&l.classList.add(...n.modifier.trim().split(" ")),null==n?void 0:n.html)){const t=l.parentElement,a=document.createElement("div");a.className=s,a.innerHTML=e.sanitizer(n.html),t.appendChild(a),setTimeout((()=>{if(a){const{canShow:e}=H(t,a),n=5;let s=t.offsetHeight,l=0;e.bottom||(s=-a.offsetHeight-n),e.left&&!e.right&&(l=t.offsetWidth-a.offsetWidth/2),!e.left&&e.right&&(l=a.offsetWidth/2),Object.assign(a.style,{left:`${l}px`,top:`${s}px`})}}))}})(e,n,a,t))))},Y=(e,t,n,a,s)=>{const l=t[n].querySelector(`.${e.CSSClasses.dayBtn}`),i=T(null==l?void 0:l.dataset.calendarDay,e.settings.iso8601);if(!i)return;const r=a.cloneNode(!0);r.innerText=String(i.week),r.dataset.calendarYearWeek=String(i.year),s.appendChild(r)},_=(e,t,n,a,s,l,i,r)=>{const d=document.createElement("div");d.className=e.CSSClasses.day;const o=document.createElement("button");o.className=`${e.CSSClasses.dayBtn}${r?` ${r}`:""}`,o.type="button",o.innerText=String(a),o.dataset.calendarDay=l;e.settings.visibility.weekNumbers&&(()=>{const t=T(l,e.settings.iso8601);t&&(o.dataset.calendarWeekNumber=String(t.week))})(),i?e.settings.visibility.daysOutside&&d.appendChild(o):d.appendChild(o),((e,t,n)=>{var a,s,l,i,r;const d=null==(a=e.settings.range.disableWeekday)?void 0:a.includes(n),o=e.settings.range.disableAllDays&&!!(null==(s=e.rangeEnabled)?void 0:s[0]);!d&&!o||(null==(l=e.rangeEnabled)?void 0:l.includes(t))||(null==(i=e.rangeDisabled)?void 0:i.includes(t))||(e.rangeDisabled.push(t),null==(r=e.rangeDisabled)||r.sort(((e,t)=>+new Date(e)-+new Date(t))))})(e,l,s),((e,t,n,a,s,l,i)=>{var r,d,o;if((g(e.rangeMin)>g(l)||g(e.rangeMax)<g(l)||(null==(r=e.rangeDisabled)?void 0:r.includes(l))||!e.settings.selection.month&&i||!e.settings.selection.year&&g(l).getFullYear()!==t)&&(a.classList.add(e.CSSClasses.dayBtnDisabled),a.tabIndex=-1),e.settings.visibility.today&&m(e.date.today)===l&&a.classList.add(e.CSSClasses.dayBtnToday),!e.settings.visibility.weekend||0!==s&&6!==s||a.classList.add(e.CSSClasses.dayBtnWeekend),(null==(d=e.selectedHolidays)?void 0:d.includes(l))&&a.classList.add(e.CSSClasses.dayBtnHoliday),(null==(o=e.selectedDates)?void 0:o.includes(l))&&(a.classList.add(e.CSSClasses.dayBtnSelected),e.selectedDates.length>1&&"multiple-ranged"===e.settings.selection.day&&(e.selectedDates[0]===l&&n.classList.add(e.CSSClasses.daySelectedFirst),e.selectedDates[e.selectedDates.length-1]===l&&n.classList.add(e.CSSClasses.daySelectedLast),e.selectedDates[0]!==l&&e.selectedDates[e.selectedDates.length-1]!==l&&n.classList.add(e.CSSClasses.daySelectedIntermediate))),e.settings.range.edgesOnly&&e.selectedDates.length>1&&"multiple-ranged"===e.settings.selection.day){const t=+new Date(e.selectedDates[0]),s=+new Date(e.selectedDates[e.selectedDates.length-1]),i=+new Date(l);i>t&&i<s&&(a.classList.add(e.CSSClasses.dayBtnSelected),n.classList.add(e.CSSClasses.daySelectedIntermediate))}})(e,t,d,o,s,l,i),n.appendChild(d),e.actions.getDays&&e.actions.getDays(a,l,d,o,e)},N=e=>{const t=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.days}`),n=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.weekNumbers}`),a=new Date(e.selectedYear,e.selectedMonth,1);t.forEach(((t,s)=>{const l=new Date(a);l.setMonth(l.getMonth()+s);const i=l.getMonth(),r=l.getFullYear(),d=new Date(r,i,1),o=new Date(r,i+1,0).getDate(),c=e.settings.iso8601?(0!==d.getDay()?d.getDay():7)-1:d.getDay();e.settings.selection.day&&t.classList.add(e.CSSClasses.daysSelecting),t.textContent="",((e,t,n,a,s)=>{let l=new Date(n,a,0).getDate()-(s-1);const i=0===a?n-1:n,r=0===a?12:a<10?`0${a}`:a;for(let a=s;a>0;a--,l++){const a=`${i}-${r}-${l}`,s=g(a).getDay();_(e,n,t,l,s,a,!0,e.CSSClasses.dayBtnPrev)}})(e,t,r,i,c),((e,t,n,a,s)=>{for(let l=1;l<=n;l++){const n=new Date(a,s,l),i=m(n),r=n.getDay();_(e,a,t,l,r,i,!1,null)}})(e,t,o,r,i),((e,t,n,a,s,l)=>{const i=l+n,r=7*Math.ceil(i/7)-i,d=s+1===12?a+1:a,o=s+1===12?"01":s+2<10?`0${s+2}`:s+2;for(let n=1;n<=r;n++){const s=`${d}-${o}-${n<10?`0${n}`:String(n)}`,l=g(s).getDay();_(e,a,t,n,l,s,!0,e.CSSClasses.dayBtnNext)}})(e,t,o,r,i,c),((e,t,n,a,s)=>{if(!e.settings.visibility.weekNumbers)return;a.textContent="";const l=document.createElement("b");l.className=e.CSSClasses.weekNumbersTitle,l.innerText="#",a.appendChild(l);const i=document.createElement("div");i.className=e.CSSClasses.weekNumbersContent,a.appendChild(i);const r=document.createElement("button");r.type="button",r.className=e.CSSClasses.weekNumber;const d=s.querySelectorAll(`.${e.CSSClasses.day}`),o=Math.ceil((t+n)/7);for(let t=0;t<o;t++)Y(e,d,0===t?6:7*t,r,i)})(e,c,o,n[s],t),x(e,t)}))},A=e=>{var t,n;const a=null==(t=e.HTMLElement)?void 0:t.querySelectorAll("[data-calendar-selected-month]"),s=null==(n=e.HTMLElement)?void 0:n.querySelectorAll("[data-calendar-selected-year]");if(!(null==a?void 0:a[0])&&(null==s?void 0:s[0]))return;const l=new Date(e.selectedYear,e.selectedMonth,1);null==a||a.forEach(((t,n)=>((e,t,n,a)=>{const s=new Date(a.setMonth(e.selectedMonth+n)).getMonth(),l=!1===e.settings.selection.month||"only-arrows"===e.settings.selection.month;t.tabIndex=l?-1:0,t.classList.toggle(e.CSSClasses.monthDisabled,l),t.setAttribute("data-calendar-selected-month",String(s)),t.innerText=e.locale.months[s]})(e,t,n,l))),null==s||s.forEach(((t,n)=>((e,t,n,a)=>{const s=new Date(a.setFullYear(e.selectedYear,e.selectedMonth+n)).getFullYear(),l=!1===e.settings.selection.year||"only-arrows"===e.settings.selection.year;t.tabIndex=l?-1:0,t.classList.toggle(e.CSSClasses.yearDisabled,l),t.setAttribute("data-calendar-selected-year",String(s)),t.innerText=String(s)})(e,t,n,l)))},I=(e,t)=>{const n=g(m(new Date(e.selectedYear,e.selectedMonth,1)));({prev:()=>n.setMonth(n.getMonth()-e.jumpMonths),next:()=>n.setMonth(n.getMonth()+e.jumpMonths)})[t](),[e.selectedMonth,e.selectedYear]=[n.getMonth(),n.getFullYear()],A(e),D(e),N(e)},P=Object.freeze(Object.defineProperty({__proto__:null,ArrowNext:e=>`<button type="button"class="${e.CSSClasses.arrow} ${e.CSSClasses.arrowNext}"data-calendar-arrow="next"></button>`,ArrowPrev:e=>`<button type="button"class="${e.CSSClasses.arrow} ${e.CSSClasses.arrowPrev}"data-calendar-arrow="prev"></button>`,ControlTime:e=>e.settings.selection.time?`<div class="${e.CSSClasses.time}"></div>`:"",Days:e=>`<div class="${e.CSSClasses.days}"></div>`,Month:e=>`<button type="button"class="${e.CSSClasses.month}"data-calendar-selected-month></button>`,Months:e=>`<div class="${e.CSSClasses.months}"></div>`,Week:e=>`<div class="${e.CSSClasses.week}"></div>`,WeekNumbers:e=>e.settings.visibility.weekNumbers?`<div class="${e.CSSClasses.weekNumbers}"></div>`:"",Year:e=>`<button type="button"class="${e.CSSClasses.year}"data-calendar-selected-year></button>`,Years:e=>`<div class="${e.CSSClasses.years}"></div>`},Symbol.toStringTag,{value:"Module"})),F=(e,t)=>t.replace(/[\n\t]/g,"").replace(/<#(?!\/?Multiple)(.*?)>/g,((t,n)=>{const a=(s=n.replace(/[/\s\n\t]/g,""),P[s]);var s;const l=a?a(e):"";return e.sanitizer(l)})).replace(/[\n\t]/g,""),W=(e,t)=>{const{HTMLElement:n,CSSClasses:a,DOMTemplates:s,type:l,currentType:i,correctMonths:r}=e,d=(s,l)=>{if(!t)return;const i=n.querySelector(`.${a.controls}`);i&&n.removeChild(i);n.querySelector(`.${a.grid}`).classList.add(a.gridDisabled);const r=t.closest(`.${a.column}`);r.classList.add(s),r.innerHTML=F(e,l)},o={default:()=>{n.classList.add(a.calendarDefault),n.classList.remove(a.calendarMonth,a.calendarYear),n.innerHTML=F(e,s.default)},multiple:()=>{r&&(n.classList.add(a.calendarMultiple),n.classList.remove(a.calendarMonth,a.calendarYear),n.innerHTML=((e,t)=>t.replace(/<#Multiple>(.*?)<#\/Multiple>/g,((t,n)=>{let a="";for(let t=0;t<e.correctMonths;t++)a+=n;return e.sanitizer(a)})).replace(/[\n\t]/g,""))(e,F(e,s.multiple)))},month:()=>{"multiple"!==l?(n.classList.add(a.calendarMonth),n.classList.remove(a.calendarDefault,a.calendarYear),n.innerHTML=F(e,s.month)):d(a.columnMonth,s.month)},year:()=>{"multiple"!==l?(n.classList.add(a.calendarYear),n.classList.remove(a.calendarDefault,a.calendarMonth),n.innerHTML=F(e,s.year)):d(a.columnYear,s.year)}};n.classList.add(a.calendar),o[i]()},q=(e,t,n,a,s)=>{const l=t.cloneNode(!1);return l.className=`${e.CSSClasses.yearsYear}${n===s?` ${e.CSSClasses.yearsYearSelected}`:a?` ${e.CSSClasses.yearsYearDisabled}`:""}`,l.dataset.calendarYear=String(s),l.title=String(s),l.innerText=String(s),a&&(l.tabIndex=-1),l},B=(e,t)=>{const n=(null==t?void 0:t.dataset.calendarSelectedYear)?Number(null==t?void 0:t.dataset.calendarSelectedYear):e.selectedYear;e.currentType="year",W(e,t),A(e),D(e);const a=e.HTMLElement.querySelector(`.${e.CSSClasses.years}`);if(!e.settings.selection.year||!a)return;a.classList.add(e.CSSClasses.yearsSelecting);const s="multiple"!==e.type||e.selectedYear===n?0:1,l=document.createElement("button");l.type="button";for(let t=e.viewYear-7;t<e.viewYear+8;t++){const i=t<e.dateMin.getFullYear()+s||t>e.dateMax.getFullYear(),r=q(e,l,n,i,t);a.appendChild(r),e.actions.getYears&&e.actions.getYears(t,r,e)}},O=e=>`${e.charAt(0).toUpperCase()}${e.substring(1,e.length)}`.replace(/\./,""),j=(e,t)=>{const n=new Date(`1978-01-0${t+1}T00:00:00.000Z`).toLocaleString(e.settings.lang,{weekday:"short",timeZone:"UTC"});e.locale.weekday.push(O(n))},K=(e,t)=>{const n=new Date(`1978-${t+1<=9?`0${t+1}`:t+1}-01T00:00:00.000Z`).toLocaleString(e.settings.lang,{month:"long",timeZone:"UTC"});e.locale.months.push(O(n))},z=e=>{if("multiple"!==e.type)return 0;const t=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),n=Array.from(t).findIndex((t=>t.classList.contains(`${e.CSSClasses.columnMonth}`)));return n>0?n:0},R=(e,t,n,a,s,l)=>{const i=t.cloneNode(!1);return i.className=`${e.CSSClasses.monthsMonth}${n===l?` ${e.CSSClasses.monthsMonthSelected}`:s?` ${e.CSSClasses.monthsMonthDisabled}`:""}`,i.title=a,i.innerText=`${e.settings.visibility.monthShort?a.substring(0,3):a}`,i.dataset.calendarMonth=String(l),s&&(i.tabIndex=-1),i},G=(e,t)=>{var n,a;const s=(null==t?void 0:t.dataset.calendarSelectedMonth)?Number(t.dataset.calendarSelectedMonth):e.selectedMonth,l=null==(n=null==t?void 0:t.closest(`.${e.CSSClasses.column}`))?void 0:n.querySelector(`.${e.CSSClasses.year}`),i=l?Number(l.dataset.calendarSelectedYear):e.selectedYear;e.currentType="month",W(e,t),A(e);const r=null==(a=e.HTMLElement)?void 0:a.querySelector(`.${e.CSSClasses.months}`);if(!e.settings.selection.month||!r)return;r.classList.add(e.CSSClasses.monthsSelecting);const d=e.jumpMonths>1?e.locale.months.map(((t,n)=>s-e.jumpMonths*n)).concat(e.locale.months.map(((t,n)=>s+e.jumpMonths*n))).filter((e=>e>=0&&e<=12)):Array.from(Array(12).keys()),o=document.createElement("button");o.type="button";for(let t=0;t<12;t++){const n=e.locale.months[t],a=t<e.dateMin.getMonth()+z(e)&&i<=e.dateMin.getFullYear()||t>e.dateMax.getMonth()+z(e)&&i>=e.dateMax.getFullYear()||t!==s&&!d.includes(t),l=R(e,o,s,n,a,t);r.appendChild(l),e.actions.getMonths&&e.actions.getMonths(t,l,e)}},Z=(e,t)=>e&&t?{0:{AM:"00",PM:"12"},1:{AM:"01",PM:"13"},2:{AM:"02",PM:"14"},3:{AM:"03",PM:"15"},4:{AM:"04",PM:"16"},5:{AM:"05",PM:"17"},6:{AM:"06",PM:"18"},7:{AM:"07",PM:"19"},8:{AM:"08",PM:"20"},9:{AM:"09",PM:"21"},10:{AM:"10",PM:"22"},11:{AM:"11",PM:"23"},12:{AM:"12",PM:"12"}}[Number(e)][t]:"",U=(e,t,n)=>e.querySelector(`.${t}${n?` input[name="${n}"]`:""}`),V=(e,t,n)=>{e.addEventListener("mouseover",(()=>t.classList.add(n))),e.addEventListener("mouseout",(()=>t.classList.remove(n)))},X=(e,t,n,a)=>{({hours:()=>{e.selectedHours=n},minutes:()=>{e.selectedMinutes=n}})[a](),e.selectedTime=`${e.selectedHours}:${e.selectedMinutes}${e.selectedKeeping?` ${e.selectedKeeping}`:""}`,e.actions.changeTime&&e.actions.changeTime(t,e),e.input&&e.HTMLInputElement&&e.actions.changeToInput&&e.actions.changeToInput(t,e)},J=(e,t,n,a,s,l)=>{t.addEventListener("input",(t=>{const i=t.target,r=Number(i.value),d=r<10?`0${r}`:`${r}`;if("hours"!==s||12!==l)return n.value=d,void X(e,t,d,s);r<l&&r>0?(n.value=d,e.selectedKeeping="AM",a.innerText=e.selectedKeeping,X(e,t,d,s)):(0===r?(e.selectedKeeping="AM",a.innerText="AM"):(e.selectedKeeping="PM",a.innerText="PM"),n.value=v(i.value),X(e,t,v(i.value),s))}))},Q=(e,t,n,a,s,l)=>{n.addEventListener("change",(n=>{const i=n.target,r=Number(i.value),d=r<10?`0${r}`:`${r}`;"hours"===s&&12===l?i.value&&r<=l&&r>0?(i.value=d,t.value=Z(d,e.selectedKeeping),X(e,n,d,s)):i.value&&r<24&&(r>l||0===r)?(0===r?(e.selectedKeeping="AM",a.innerText="AM"):(e.selectedKeeping="PM",a.innerText="PM"),i.value=v(i.value),t.value=d,X(e,n,v(i.value),s)):i.value=e.selectedHours:i.value&&r<=l&&r>=0?(i.value=d,t.value=d,X(e,n,d,s)):"hours"===s?i.value=e.selectedHours:"minutes"===s&&(i.value=e.selectedMinutes)}))},ee=(e,t,n)=>{const a=24===n?23:n||12,s=U(t,e.CSSClasses.timeRange,"hours"),l=U(t,e.CSSClasses.timeRange,"minutes"),i=U(t,e.CSSClasses.timeHours,"hours"),r=U(t,e.CSSClasses.timeMinutes,"minutes"),d=t.querySelector(`.${e.CSSClasses.timeKeeping}`);V(s,i,e.CSSClasses.isFocus),V(l,r,e.CSSClasses.isFocus),J(e,s,i,d,"hours",a),J(e,l,r,d,"minutes",0),Q(e,s,i,d,"hours",a),Q(e,l,r,d,"minutes",59),d&&((e,t,n)=>{t.addEventListener("click",(a=>{e.selectedKeeping=t.innerText.includes("AM")?"PM":"AM",t.innerText=e.selectedKeeping,n.value=Z(e.selectedHours,e.selectedKeeping),X(e,a,e.selectedHours,"hours")}))})(e,d,s)},te=(e,t,n,a)=>`<label class="${t}"><input type="text"name="${e}"maxlength="2"value="${n}"${a?"disabled":""}></label>`,ne=(e,t,n,a,s,l)=>`<label class="${t}"><input type="range"name="${e}"min="${n}"max="${a}"step="${s}"value="${l}"></label>`,ae=e=>{const t=[...e.locale.weekday];if(!t[0])return;e.settings.iso8601&&t.push(t.shift());e.HTMLElement.querySelectorAll(`.${e.CSSClasses.week}`).forEach((n=>((e,t,n)=>{const a=document.createElement("b");t.textContent="";for(let s=0;s<n.length;s++){const l=n[s],i=a.cloneNode(!0);i.className=`${e.CSSClasses.weekDay}`,i.className=`${e.CSSClasses.weekDay}${e.settings.visibility.weekend&&e.settings.iso8601?5===s||6===s?` ${e.CSSClasses.weekDayWeekend}`:"":!e.settings.visibility.weekend||e.settings.iso8601||0!==s&&6!==s?"":` ${e.CSSClasses.weekDayWeekend}`}`,i.innerText=`${l}`,t.appendChild(i)}})(e,n,t)))},se=["light","dark","system"],le={value:!1,set:()=>{le.value=!0},check:()=>le.value},ie=(e,t)=>se.find((n=>{var a;return"system"!==n&&(null==(a=e.getAttribute(t))?void 0:a.includes(n))})),re=(e,t)=>{e.dataset.calendarTheme=t},de=(e,t)=>{var n;if(n=t,re(e.HTMLElement,n.matches?"dark":"light"),"system"!==e.settings.visibility.theme||le.check())return;const a=t=>{const n=document.querySelectorAll(`.${e.CSSClasses.calendar}`);null==n||n.forEach((e=>re(e,t.matches?"dark":"light")))};t.addEventListener?t.addEventListener("change",a):t.addListener(a),le.set()},oe=(e,t)=>{const n=e.settings.visibility.themeDetect?document.querySelector(e.settings.visibility.themeDetect):null;if(!n)return void de(e,t);const a=e.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,((e,t)=>t)),s=ie(n,a);s?(re(e.HTMLElement,s),((e,t,n)=>{new MutationObserver((a=>{for(let s=0;s<a.length;s++)if(a[s].attributeName===n){const a=ie(t,n);a&&re(e.HTMLElement,a);break}})).observe(t,{attributes:!0})})(e,n,a)):de(e,t)},ce=e=>{const t={default:()=>{ae(e),N(e)},multiple:()=>{ae(e),N(e)},month:()=>G(e),year:()=>B(e)};(e=>{if(!se.includes(e.settings.visibility.theme))throw new Error(C);if("not all"===window.matchMedia("(prefers-color-scheme)").media)return void re(e.HTMLElement,"light");({light:()=>re(e.HTMLElement,"light"),dark:()=>re(e.HTMLElement,"dark"),system:()=>oe(e,window.matchMedia("(prefers-color-scheme: dark)"))})[e.settings.visibility.theme]()})(e),(e=>{if("define"!==e.settings.lang||!e.locale.weekday[6]||!e.locale.months[11]){if("define"===e.settings.lang)throw new Error(M);e.locale.weekday=[],e.locale.months=[];for(let t=0;t<7;t++)j(e,t);for(let t=0;t<12;t++)K(e,t)}})(e),W(e),A(e),D(e),(e=>{const t=e.HTMLElement.querySelector(`.${e.CSSClasses.time}`);if(!t)return;const n=!0===e.settings.selection.time?12:e.settings.selection.time,a="range"===e.settings.selection.controlTime,[s,l]=[0,23],[i,r]=[0,59];t.innerHTML=e.sanitizer(`<div class="${e.CSSClasses.timeContent}">${te("hours",e.CSSClasses.timeHours,e.selectedHours,a)}${te("minutes",e.CSSClasses.timeMinutes,e.selectedMinutes,a)}${12===n?`<button type="button" class="${e.CSSClasses.timeKeeping}"${a?"disabled":""}>${e.selectedKeeping}</button>`:""}</div><div class="${e.CSSClasses.timeRanges}">${ne("hours",e.CSSClasses.timeRange,s,l,e.settings.selection.stepHours,e.selectedKeeping?Z(e.selectedHours,e.selectedKeeping):e.selectedHours)}${ne("minutes",e.CSSClasses.timeRange,i,r,e.settings.selection.stepMinutes,e.selectedMinutes)}</div>`),ee(e,t,n)})(e),t[e.currentType]()},ue={self:null,rangeMin:void 0,rangeMax:void 0},me=()=>{var e;if(!(null==(e=ue.self)?void 0:e.HTMLElement))return;const{CSSClasses:t}=ue.self;ue.self.HTMLElement.querySelectorAll(`.${ue.self.CSSClasses.dayBtnHover}`).forEach((e=>{var n;e.classList.remove(ue.self.CSSClasses.dayBtnHover),null==(n=e.parentElement)||n.classList.remove(t.dayHoverIntermediate,t.dayHoverFirst,t.dayHoverLast)}))},ge=(e,t,n)=>{var a,s,l;if(!(null==(a=ue.self)?void 0:a.selectedDates))return;const i=m(e),{CSSClasses:r}=ue.self;if(null==(s=ue.self.rangeDisabled)?void 0:s.includes(i))return;const d=null==(l=ue.self.HTMLElement)?void 0:l.querySelectorAll(`[data-calendar-day="${i}"]`);null==d||d.forEach((e=>{var t;e.classList.add(r.dayBtnHover),null==(t=e.parentElement)||t.classList.add(r.dayHoverIntermediate)})),null==t||t.forEach((e=>{var t;return null==(t=e.parentElement)?void 0:t.classList.add(r.dayHoverFirst)})),null==n||n.forEach((e=>{var t;return null==(t=e.parentElement)?void 0:t.classList.add(r.dayHoverLast)}))},he=e=>{var t;if(!e.target||!(null==(t=ue.self)?void 0:t.selectedDates))return;if(!e.target.closest(`.${ue.self.CSSClasses.days}`))return void me();const n=e.target.closest("[data-calendar-day]");if(!n)return;const a=n.dataset.calendarDay,s=g(ue.self.selectedDates[0]),l=g(a),i=ue.self.HTMLElement.querySelectorAll(`[data-calendar-day="${ue.self.selectedDates[0]}"]`),r=ue.self.HTMLElement.querySelectorAll(`[data-calendar-day="${a}"]`),[d,o]=s<l?[i,r]:[r,i],[c,u]=s<l?[s,l]:[l,s];me();for(let e=new Date(c);e<=u;e.setDate(e.getDate()+1))ge(e,d,o)},ye=e=>{ue.self&&"Escape"===e.key&&(ue.self.selectedDates=[],ue.self.HTMLElement.removeEventListener("mousemove",he),document.removeEventListener("keydown",ye),ce(ue.self))},ve=(e,t)=>{var n;if(t){const a=1===e.selectedDates.length&&e.selectedDates[0].includes(t);e.selectedDates=a&&!e.settings.selection.cancelableDay?[t,t]:a&&e.settings.selection.cancelableDay?[]:e.selectedDates.length>1?[t]:[...e.selectedDates,t],null==(n=e.selectedDates)||n.sort(((e,t)=>+new Date(e)-+new Date(t)))}e.settings.range.disableGaps&&(ue.rangeMin=ue.rangeMin?ue.rangeMin:e.rangeMin,ue.rangeMax=ue.rangeMax?ue.rangeMax:e.rangeMax),ue.self=e;const a={set:()=>{e.HTMLElement.addEventListener("mousemove",he),document.addEventListener("keydown",ye),e.settings.range.disableGaps&&(()=>{var e,t,n;if(!(null==(t=null==(e=ue.self)?void 0:e.selectedDates)?void 0:t[0])||!(null==(n=ue.self.rangeDisabled)?void 0:n[0]))return;const a=g(ue.self.selectedDates[0]),[s,l]=ue.self.rangeDisabled.map((e=>g(e))).reduce((([e,t],n)=>[a>=n?n:e,a<n&&null===t?n:t]),[null,null]);s&&(ue.self.rangeMin=m(new Date(s.setDate(s.getDate()+1)))),l&&(ue.self.rangeMax=m(new Date(l.setDate(l.getDate()-1))))})()},reset:()=>{const[t,n]=[e.selectedDates[0],e.selectedDates[e.selectedDates.length-1]];e.selectedDates=e.selectedDates[0]!==e.selectedDates[e.selectedDates.length-1]?e.settings.range.edgesOnly?[t,n]:h([`${t}:${n}`]):[e.selectedDates[0],e.selectedDates[0]],e.HTMLElement.removeEventListener("mousemove",he),document.removeEventListener("keydown",ye),e.settings.range.disableGaps&&ue.self&&(ue.self.rangeMin=ue.rangeMin,ue.self.rangeMax=ue.rangeMax)}};a[1===e.selectedDates.length?"set":"reset"]()},pe=(e,t,n)=>{if(!t.dataset.calendarDay)return;const a=t.dataset.calendarDay,s=t.classList.contains(e.CSSClasses.dayBtnSelected);if(s&&!e.settings.selection.cancelableDay)return;let l=!0;void 0!==e.toggleSelected&&(l="function"==typeof e.toggleSelected?e.toggleSelected(e):e.toggleSelected),s&&!l||(e.selectedDates=s?e.selectedDates.filter((e=>e!==a)):n?[...e.selectedDates,a]:[a])},Se=(e,t,n,a,s)=>{const l=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),i=Array.from(l).findIndex((e=>e.classList.contains(t))),r=Number(l[i].querySelector(`.${n}`).getAttribute(s));return"month"===e.currentType&&i>=0?a-i:"year"===e.currentType&&e.selectedYear!==r?a-1:a},Me=(e,t,n,a)=>{if(!e.settings.selection[n])return;const s=t.target,l=e=>s.closest(`.${e}`),i=l(a.header),r=l(a.item),d=l(e.CSSClasses.grid),o=l(e.CSSClasses.column);if(e.currentType!==n&&i){({year:()=>B(e,s),month:()=>G(e,s)})[n]()}else r?((e,t,n,a,s)=>{const l={year:()=>{var n,a;return null==(a=(n=e.actions).clickYear)?void 0:a.call(n,t,e)},month:()=>{var n,a;return null==(a=(n=e.actions).clickMonth)?void 0:a.call(n,t,e)}};({year:()=>{if("multiple"===e.type){const t=Se(e,e.CSSClasses.columnYear,e.CSSClasses.year,Number(s.dataset.calendarYear),"data-calendar-selected-year"),n=e.selectedMonth<e.dateMin.getMonth()&&t<=e.dateMin.getFullYear(),a=e.selectedMonth>e.dateMax.getMonth()&&t>=e.dateMax.getFullYear(),l=t<e.dateMin.getFullYear(),i=t>e.dateMax.getFullYear();n||l?(e.selectedYear=e.dateMin.getFullYear(),e.selectedMonth=e.dateMin.getMonth()):a||i?(e.selectedYear=e.dateMax.getFullYear(),e.selectedMonth=e.dateMax.getMonth()):e.selectedYear=t}else e.selectedYear=Number(s.dataset.calendarYear)},month:()=>{if("multiple"===e.type){const t=Se(e,e.CSSClasses.columnMonth,e.CSSClasses.month,Number(s.dataset.calendarMonth),"data-calendar-selected-month"),n=s.closest(`.${a.column}`).querySelector(`.${e.CSSClasses.year}`);e.selectedYear=Number(n.dataset.calendarSelectedYear);const l=t<e.dateMin.getMonth()&&e.selectedYear<=e.dateMin.getFullYear(),i=t>e.dateMax.getMonth()&&e.selectedYear>=e.dateMax.getFullYear();e.selectedMonth=l?e.dateMin.getMonth():i?e.dateMax.getMonth():t}else e.selectedMonth=Number(s.dataset.calendarMonth)}})[n](),l[n](),e.currentType=e.type,ce(e)})(e,t,n,a,r):(e.currentType===n&&i||"multiple"===e.type&&e.currentType===n&&d&&!o)&&(e.currentType=e.type,ce(e))},Ce=e=>{const t=t=>{((e,t)=>{const n=t.target.closest(`.${e.CSSClasses.arrow}`);n&&(["default","multiple"].includes(e.currentType)?I(e,n.dataset.calendarArrow):"year"===e.currentType&&void 0!==e.viewYear&&(e.viewYear+={prev:-15,next:15}[n.dataset.calendarArrow],B(e,t.target)),e.actions.clickArrow&&e.actions.clickArrow(t,e))})(e,t),((e,t)=>{var n;if(!e.settings.visibility.weekNumbers||!e.actions.clickWeekNumber)return;const a=t.target.closest(`.${e.CSSClasses.weekNumber}`),s=null==(n=e.HTMLElement)?void 0:n.querySelectorAll("[data-calendar-week-number]");if(!a||!s)return;const l=Number(a.innerText),i=Number(a.dataset.calendarYearWeek),r=Array.from(s).filter((e=>Number(e.dataset.calendarWeekNumber)===l));e.actions.clickWeekNumber(t,l,r,i,e)})(e,t),((e,t)=>{var n;const a=t.target,s=e=>a.closest(`.${e}`),l=s(e.CSSClasses.dayBtn);if(!e.settings.selection.day||!["single","multiple","multiple-ranged"].includes(e.settings.selection.day)||!l)return;({single:()=>pe(e,l,!1),multiple:()=>pe(e,l,!0),"multiple-ranged":()=>ve(e,l.dataset.calendarDay)})[e.settings.selection.day](),null==(n=e.selectedDates)||n.sort(((e,t)=>+new Date(e)-+new Date(t))),e.actions.clickDay&&e.actions.clickDay(t,e),e.input&&e.HTMLInputElement&&e.HTMLElement&&e.actions.changeToInput&&e.actions.changeToInput(t,e);const i=s(e.CSSClasses.dayBtnPrev),r=s(e.CSSClasses.dayBtnNext);({prev:()=>I(e,"prev"),next:()=>I(e,"next"),default:()=>N(e)})[i?"prev":r?"next":"default"]()})(e,t),Me(e,t,"month",{header:e.CSSClasses.month,item:e.CSSClasses.monthsMonth,column:e.CSSClasses.columnMonth}),Me(e,t,"year",{header:e.CSSClasses.year,item:e.CSSClasses.yearsYear,column:e.CSSClasses.columnYear})};return e.HTMLElement.addEventListener("click",t),()=>e.HTMLElement.removeEventListener("click",t)},be=(e,{year:t,month:n,dates:a,holidays:s,time:i}={})=>{var r;const d=l({},e.settings.selected);e.settings.selected.year=t?d.year:e.selectedYear,e.settings.selected.month=n?d.month:e.selectedMonth,e.settings.selected.holidays=s?d.holidays:e.selectedHolidays,e.settings.selected.time=i?d.time:e.selectedTime,e.settings.selected.dates="only-first"===a&&(null==(r=e.selectedDates)?void 0:r[0])?[e.selectedDates[0]]:!0===a?d.dates:e.selectedDates,f(e),ce(e),e.settings.selected=d,"multiple-ranged"===e.settings.selection.day&&a&&ve(e)},fe=(e,t=!0)=>{e.isInputInit=!0;const n=document.createElement("div");return n.className=`${e.CSSClasses.calendar} ${e.CSSClasses.calendarToInput} ${e.CSSClasses.calendarHidden}`,e.HTMLElement=n,document.body.appendChild(e.HTMLElement),e.HTMLElement.style.visibility="hidden",t&&queueMicrotask((()=>{k(e.HTMLInputElement,n,e.settings.visibility.positionToInput,e.CSSClasses),e.HTMLElement.style.visibility="visible",e.show()})),be(e,{year:!0,month:!0,dates:!0,holidays:!0,time:!0}),e.actions.initCalendar&&e.actions.initCalendar(e),Ce(e)},we=e=>(e.HTMLOriginalElement=e.HTMLElement.cloneNode(!0),e.isInit=!0,e.input?(e=>{const t=[];e.HTMLInputElement=e.HTMLElement;const n=()=>k(e.HTMLInputElement,e.HTMLElement,e.settings.visibility.positionToInput,e.CSSClasses),a=t=>{"Escape"===t.key&&((null==e?void 0:e.HTMLInputElement)&&(null==e?void 0:e.HTMLElement)&&e.hide(),document.removeEventListener("keydown",a))},s=t=>{var a;e&&t.target!==e.HTMLInputElement&&!(null==(a=e.HTMLElement)?void 0:a.contains(t.target))&&(e.HTMLInputElement&&e.HTMLElement&&e.hide(),window.removeEventListener("resize",n),document.removeEventListener("click",s,{capture:!0}))},l=()=>{e.isInputInit?(k(e.HTMLInputElement,e.HTMLElement,e.settings.visibility.positionToInput,e.CSSClasses),e.HTMLElement.style.visibility="visible",e.show()):t.push(fe(e)),window.addEventListener("resize",n),document.addEventListener("click",s,{capture:!0}),document.addEventListener("keydown",a)};return e.HTMLInputElement.addEventListener("click",l),e.HTMLInputElement.addEventListener("focus",l),()=>{t.forEach((e=>e()))}})(e):(f(e),ce(e),e.actions.initCalendar&&e.actions.initCalendar(e),Ce(e)));return class extends u{constructor(e,t){if(super(),i(this,"init",(()=>we(this))),i(this,"update",(e=>((e,{year:t,month:n,dates:a,holidays:s,time:l}={})=>{if(!e.isInit)throw new Error(S);e.input&&!e.isInputInit&&fe(e,!1),be(e,{year:t,month:n,dates:a,holidays:s,time:l}),e.actions.updateCalendar&&e.actions.updateCalendar(e)})(this,e))),i(this,"destroy",(()=>(e=>{var t,n,a,s,l,i;if(!e.isInit)throw new Error(S);e.input?(null==(n=null==(t=e.HTMLElement)?void 0:t.parentElement)||n.removeChild(e.HTMLElement),null==(s=null==(a=e.HTMLInputElement)?void 0:a.replaceWith)||s.call(a,e.HTMLOriginalElement),e.HTMLInputElement=void 0):null==(i=null==(l=e.HTMLElement)?void 0:l.replaceWith)||i.call(l,e.HTMLOriginalElement),e.HTMLElement=e.HTMLOriginalElement,e.actions.destroyCalendar&&e.actions.destroyCalendar(e)})(this))),i(this,"show",(()=>{var e;(e=this).currentType?(e.HTMLElement.classList.remove(e.CSSClasses.calendarHidden),e.actions.showCalendar&&e.actions.showCalendar(e)):e.HTMLElement.click()})),i(this,"hide",(()=>{var e;(e=this).currentType&&(e.HTMLElement.classList.add(e.CSSClasses.calendarHidden),e.actions.hideCalendar&&e.actions.hideCalendar(e))})),this.HTMLElement="string"==typeof e?document.querySelector(e):e,!this.HTMLElement)throw new Error(p(e));if(!t)return;const n=(e,t)=>{Object.keys(t).forEach((a=>{"object"!=typeof e[a]||"object"!=typeof t[a]||t[a]instanceof Date?e[a]=t[a]:n(e[a],t[a])}))};n(this,t)}}}));
/*! name: vanilla-calendar-pro v3.0.0 | url: https://github.com/uvarov-frontend/vanilla-calendar-pro */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VanillaCalendar=t()}(this,(function(){"use strict";var e=Object.defineProperty,t=Object.defineProperties,a=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,l=(t,a,n)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[a]=n,s=(e,t)=>{for(var a in t||(t={}))i.call(t,a)&&l(e,a,t[a]);if(n)for(var a of n(t))r.call(t,a)&&l(e,a,t[a]);return e},o=(e,t,a)=>(l(e,"symbol"!=typeof t?t+"":t,a),a);const d=e=>`${e} is not found, check the first argument passed to new VanillaCalendar.`,c='The calendar has not been initialized, please initialize it using the "init()" method first.',v="You specified an incorrect language label or did not specify the required number of values ​​for «locale.weekdays» or «locale.months».",p="The value of the time property can be: false, 12 or 24.";function u(e){if(!e||!e.getBoundingClientRect)return{top:0,bottom:0,left:0,right:0};const t=e.getBoundingClientRect(),a=document.documentElement;return{bottom:t.bottom,right:t.right,top:t.top+window.scrollY-a.clientTop,left:t.left+window.scrollX-a.clientLeft}}function m(){return{vw:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),vh:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}}function h(e){const{top:t,left:a}={left:window.scrollX||document.documentElement.scrollLeft||0,top:window.scrollY||document.documentElement.scrollTop||0},{top:n,left:i}=u(e),{vh:r,vw:l}=m(),s=n-t,o=i-a;return{top:s,bottom:r-(s+e.clientHeight),left:o,right:l-(o+e.clientWidth)}}function y(e,t,a=5){const n={top:!0,bottom:!0,left:!0,right:!0},i=[];if(!t||!e)return{canShow:n,parentPositions:i};const{bottom:r,top:l}=h(e),{top:s,left:o}=u(e),{height:d,width:c}=t.getBoundingClientRect(),{vh:v,vw:p}=m(),y=p/2,g=v/2;return[{condition:s<g,position:"top"},{condition:s>g,position:"bottom"},{condition:o<y,position:"left"},{condition:o>y,position:"right"}].forEach((({condition:e,position:t})=>{e&&i.push(t)})),Object.assign(n,{top:d<=l-a,bottom:d<=r-a,left:c<=o,right:c<=p-o}),{canShow:n,parentPositions:i}}const g=(e,t)=>{var a;e.popups&&(null==(a=Object.entries(e.popups))||a.forEach((([a,n])=>((e,t,a,n)=>{var i;const r=n.querySelector(`[data-vc-date="${t}"]`);if(!r)return;const l=r.querySelector("[data-vc-date-btn]");if((null==a?void 0:a.modifier)&&l.classList.add(...a.modifier.trim().split(" ")),null==a?void 0:a.html){const t=document.createElement("div");t.className=e.styles.datePopup,t.dataset.vcDatePopup="",t.innerHTML=e.sanitizerHTML(a.html),l.ariaExpanded="true",l.ariaLabel=`${l.ariaLabel}, ${null==(i=null==t?void 0:t.textContent)?void 0:i.replace(/^\s+|\s+(?=\s)|\s+$/g,"").replace(/&nbsp;/g," ")}`,r.appendChild(t),setTimeout((()=>{if(t){const{canShow:e}=y(r,t),a=5;let n=r.offsetHeight,i=0;e.bottom||(n=-t.offsetHeight-a),e.left&&!e.right&&(i=r.offsetWidth-t.offsetWidth/2),!e.left&&e.right&&(i=t.offsetWidth/2),Object.assign(t.style,{left:`${i}px`,top:`${n}px`})}}))}})(e,a,n,t))))},b=e=>new Date(`${e}T00:00:00.000Z`),M=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,D=(e,t,a,n="")=>{t?e.setAttribute(a,n):e.getAttribute(a)===n&&e.removeAttribute(a)},f=(e,t,a,n,i,r,l)=>{var s,o,d,c;const v=b(e.private.displayDateMin)>b(r)||b(e.private.displayDateMax)<b(r)||(null==(s=e.private.disableDates)?void 0:s.includes(r))||!e.selectionMonthsMode&&"current"!==l||!e.selectionYearsMode&&b(r).getFullYear()!==t;if(D(a,v,"data-vc-date-disabled"),D(n,v,"aria-disabled","true"),D(n,v,"tabindex","-1"),D(a,!e.disableToday&&M(e.dateToday)===r,"data-vc-date-today"),D(a,!e.disableToday&&M(e.dateToday)===r,"aria-current","date"),D(a,null==(o=e.selectedWeekends)?void 0:o.includes(i),"data-vc-date-weekend"),D(a,null==(d=e.selectedHolidays)?void 0:d.includes(r),"data-vc-date-holiday"),(null==(c=e.private.selectedDates)?void 0:c.includes(r))?(a.setAttribute("data-vc-date-selected",""),n.setAttribute("aria-selected","true"),e.private.selectedDates.length>1&&"multiple-ranged"===e.selectionDatesMode&&(e.private.selectedDates[0]===r&&a.setAttribute("data-vc-date-selected","first"),e.private.selectedDates[e.private.selectedDates.length-1]===r&&a.setAttribute("data-vc-date-selected","last"),e.private.selectedDates[0]!==r&&e.private.selectedDates[e.private.selectedDates.length-1]!==r&&a.setAttribute("data-vc-date-selected","middle"))):a.hasAttribute("data-vc-date-selected")&&(a.removeAttribute("data-vc-date-selected"),n.removeAttribute("aria-selected")),!e.private.disableDates.includes(r)&&e.enableEdgeDatesOnly&&e.private.selectedDates.length>1&&"multiple-ranged"===e.selectionDatesMode){const t=b(e.private.selectedDates[0]),n=b(e.private.selectedDates[e.private.selectedDates.length-1]),i=b(r);D(a,i>t&&i<n,"data-vc-date-selected","middle")}},w=(e,t)=>{const a=b(e),n=(a.getDay()-t+7)%7;a.setDate(a.getDate()+4-n);const i=new Date(a.getFullYear(),0,1),r=Math.ceil(((+a-+i)/864e5+1)/7);return{year:a.getFullYear(),week:r}},E=(e,t,a,n,i,r)=>{const l=b(i).getDay(),s="string"==typeof e.locale&&e.locale.length?e.locale:"en",o=document.createElement("div");o.className=e.styles.date,o.dataset.vcDate=i,o.dataset.vcDateMonth=r,o.dataset.vcDateWeekDay=String(l);const d=document.createElement("button");d.className=e.styles.dateBtn,d.type="button",d.role="gridcell",d.ariaLabel=((e,t,a)=>new Date(`${e}T00:00:00.000Z`).toLocaleString(t,a))(i,s,{dateStyle:"long",timeZone:"UTC"}),d.dataset.vcDateBtn="",d.innerText=String(n),e.enableWeekNumbers&&((e,t,a)=>{const n=w(a,e.firstWeekday);n&&(t.dataset.vcDateWeekNumber=String(n.week))})(e,o,i),("current"===r||e.displayDatesOutside)&&o.appendChild(d),((e,t,a)=>{var n,i,r,l,s;const o=null==(n=e.disableWeekdays)?void 0:n.includes(a),d=e.disableAllDates&&!!(null==(i=e.private.enableDates)?void 0:i[0]);!o&&!d||(null==(r=e.private.enableDates)?void 0:r.includes(t))||(null==(l=e.private.disableDates)?void 0:l.includes(t))||(e.private.disableDates.push(t),null==(s=e.private.disableDates)||s.sort(((e,t)=>+new Date(e)-+new Date(t))))})(e,i,l),f(e,t,o,d,l,i,r),a.appendChild(o)},T=e=>{const t=new Date(e.private.selectedYear,e.private.selectedMonth,1),a=e.private.mainElement.querySelectorAll('[data-vc="dates"]'),n=e.private.mainElement.querySelectorAll('[data-vc-week="numbers"]');a.forEach(((a,i)=>{e.selectionDatesMode||(a.dataset.vcDatesDisabled=""),a.textContent="";const r=new Date(t);r.setMonth(r.getMonth()+i);const l=r.getMonth(),s=r.getFullYear(),o=(new Date(s,l,1).getDay()-e.firstWeekday+7)%7,d=new Date(s,l+1,0).getDate();((e,t,a,n,i)=>{let r=new Date(a,n,0).getDate()-(i-1);const l=0===n?a-1:a,s=0===n?12:n<10?`0${n}`:n;for(let n=i;n>0;n--,r++)E(e,a,t,r,`${l}-${s}-${r}`,"prev")})(e,a,s,l,o),((e,t,a,n,i)=>{for(let r=1;r<=a;r++){const a=new Date(n,i,r);E(e,n,t,r,M(a),"current")}})(e,a,d,s,l),((e,t,a,n,i,r)=>{const l=r+a,s=7*Math.ceil(l/7)-l,o=i+1===12?n+1:n,d=i+1===12?"01":i+2<10?`0${i+2}`:i+2;for(let a=1;a<=s;a++){const i=a<10?`0${a}`:String(a);E(e,n,t,a,`${o}-${d}-${i}`,"next")}})(e,a,d,s,l,o),g(e,a),((e,t,a,n,i)=>{if(!e.enableWeekNumbers)return;n.textContent="";const r=document.createElement("b");r.className=e.styles.weekNumbersTitle,r.innerText="#",r.dataset.vcWeekNumbers="title",n.appendChild(r);const l=document.createElement("div");l.className=e.styles.weekNumbersContent,l.dataset.vcWeekNumbers="content",n.appendChild(l);const s=document.createElement("button");s.type="button",s.className=e.styles.weekNumber;const o=i.querySelectorAll("[data-vc-date]"),d=Math.ceil((t+a)/7);for(let t=0;t<d;t++){const a=o[0===t?6:7*t].dataset.vcDate,n=w(a,e.firstWeekday);if(!n)return;const i=s.cloneNode(!0);i.innerText=String(n.week),i.dataset.vcWeekNumber=String(n.week),i.dataset.vcWeekYear=String(n.year),i.role="rowheader",i.ariaLabel=`${n.week}`,l.appendChild(i)}})(e,o,d,n[i],a)}))},k=e=>`<div class="${e.styles.header}" data-vc="header" role="toolbar" aria-label="${e.labels.navigation}"><#ArrowPrev [month] /><div class="${e.styles.headerContent}" data-vc-header="content"><#Month /><#Year /></div><#ArrowNext [month] /></div><div class="${e.styles.wrapper}" data-vc="wrapper"><#WeekNumbers /><div class="${e.styles.content}" data-vc="content"><#Week /><#Dates /></div></div><#ControlTime />\n`,$=e=>`<div class="${e.styles.header}" data-vc="header" role="toolbar" aria-label="${e.labels.navigation}"><div class="${e.styles.headerContent}" data-vc-header="content"><#Month /><#Year /></div></div><div class="${e.styles.wrapper}" data-vc="wrapper"><div class="${e.styles.content}" data-vc="content"><#Months /></div></div>\n`,S=e=>`<div class="${e.styles.controls}" data-vc="controls" role="toolbar" aria-label="${e.labels.navigation}"><#ArrowPrev [month] /><#ArrowNext [month] /></div><div class="${e.styles.grid}" data-vc="grid"><#Multiple><div class="${e.styles.column}" data-vc="column" role="region"><div class="${e.styles.header}" data-vc="header"><div class="${e.styles.headerContent}" data-vc-header="content"><#Month /><#Year /></div></div><div class="${e.styles.wrapper}" data-vc="wrapper"><#WeekNumbers /><div class="${e.styles.content}" data-vc="content"><#Week /><#Dates /></div></div></div><#/Multiple></div><#ControlTime />\n`,A=e=>`<div class="${e.styles.header}" data-vc="header" role="toolbar" aria-label="${e.labels.navigation}"><#ArrowPrev [year] /><div class="${e.styles.headerContent}" data-vc-header="content"><#Month /><#Year /></div><#ArrowNext [year] /></div><div class="${e.styles.wrapper}" data-vc="wrapper"><div class="${e.styles.content}" data-vc="content"><#Years /></div></div>\n`,x=e=>"multiple"===e.viewType?1===e.displayMonthsCount?2:e.displayMonthsCount>12?12:e.displayMonthsCount:1,Y={ArrowNext:(e,t)=>`<button type="button" class="${e.styles.arrowNext}" data-vc-arrow="next" aria-label="${e.labels.arrowNext[t]}"></button>`,ArrowPrev:(e,t)=>`<button type="button" class="${e.styles.arrowPrev}" data-vc-arrow="prev" aria-label="${e.labels.arrowPrev[t]}"></button>`,ControlTime:e=>e.selectionTimeMode?`<div class="${e.styles.time}" data-vc="time" role="group" aria-label="${e.labels.selectingTime}"></div>`:"",Dates:e=>`<div class="${e.styles.dates}" data-vc="dates" role="grid" aria-live="assertive" aria-label="${e.labels.dates}" ${"multiple"===e.viewType?"aria-multiselectable":""}></div>`,Month:e=>`<button type="button" class="${e.styles.month}" data-vc="month"></button>`,Months:e=>`<div class="${e.styles.months}" data-vc="months" role="grid" aria-live="assertive" aria-label="${e.labels.months}"></div>`,Week:e=>`<div class="${e.styles.week}" data-vc="week" role="row" aria-label="${e.labels.week}"></div>`,WeekNumbers:e=>e.enableWeekNumbers?`<div class="${e.styles.weekNumbers}" data-vc-week="numbers" role="row" aria-label="${e.labels.weekNumber}"></div>`:"",Year:e=>`<button type="button" class="${e.styles.year}" data-vc="year"></button>`,Years:e=>`<div class="${e.styles.years}" data-vc="years" role="grid" aria-live="assertive" aria-label="${e.labels.years}"></div>`},C=(e,t)=>t.replace(/[\n\t]/g,"").replace(/<#(?!\/?Multiple)(.*?)>/g,((t,a)=>{const n=(a.match(/\[(.*?)\]/)||[])[1],i=a.replace(/[/\s\n\t]|\[(.*?)\]/g,""),r=Y[i];const l=r?r(e,null!=n?n:null):"";return e.sanitizerHTML(l)})).replace(/[\n\t]/g,""),N=(e,t)=>{const a={default:k,month:$,year:A,multiple:S};if(Object.keys(a).forEach((t=>{const n=t;e.layouts[n].length||(e.layouts[n]=a[n](e))})),e.private.mainElement.className=e.styles.calendar,e.private.mainElement.dataset.vc="calendar",e.private.mainElement.dataset.vcType=e.private.currentType,e.private.mainElement.role="application",e.private.mainElement.tabIndex=0,e.private.mainElement.ariaLabel=e.labels.application,"multiple"===e.private.currentType&&x(e))e.private.mainElement.innerHTML=((e,t)=>t.replace(new RegExp("<#Multiple>(.*?)<#\\/Multiple>","gs"),((t,a)=>{const n=Array(x(e)).fill(a).join("");return e.sanitizerHTML(n)})).replace(/[\n\t]/g,""))(e,C(e,e.layouts[e.private.currentType]));else{if("multiple"===e.viewType&&t){const a=e.private.mainElement.querySelector('[data-vc="controls"]'),n=e.private.mainElement.querySelector('[data-vc="grid"]'),i=t.closest('[data-vc="column"]');return a&&e.private.mainElement.removeChild(a),n&&(n.dataset.vcGrid="hidden"),i&&(i.dataset.vcColumn=e.private.currentType),void(i&&(i.innerHTML=C(e,e.layouts[e.private.currentType])))}e.private.mainElement.innerHTML=C(e,e.layouts[e.private.currentType])}},L=e=>{const t=e.private.mainElement.querySelectorAll('[data-vc="month"]'),a=e.private.mainElement.querySelectorAll('[data-vc="year"]'),n=new Date(e.private.selectedYear,e.private.selectedMonth,1);[t,a].forEach((t=>null==t?void 0:t.forEach(((t,a)=>((e,t,a,n,i)=>{const r=new Date(n.setFullYear(e.private.selectedYear,e.private.selectedMonth+a)).getFullYear(),l=new Date(n.setMonth(e.private.selectedMonth+a)).getMonth(),s=e.private.locale.months.long[l],o=t.closest('[data-vc="column"]');o&&(o.ariaLabel=`${s} ${r}`);const d={month:{id:l,label:s},year:{id:r,label:r}};t.innerText=String(d[i].label),t.dataset[`vc${i.charAt(0).toUpperCase()+i.slice(1)}`]=String(d[i].id),t.ariaLabel=`${e.labels[i]} ${d[i].label}`;const c={month:e.selectionMonthsMode,year:e.selectionYearsMode},v=!1===c[i]||"only-arrows"===c[i];v&&(t.tabIndex=-1),t.disabled=v})(e,t,a,n,t.dataset.vc)))))},W=e=>{if("multiple"!==e.viewType)return 0;const t=e.private.mainElement.querySelectorAll('[data-vc="column"]'),a=Array.from(t).findIndex((e=>e.closest('[data-vc-column="month"]')));return a>0?a:0},H=(e,t,a,n,i,r,l)=>{const s=t.cloneNode(!1);return s.className=e.styles.monthsMonth,s.innerText=n,s.ariaLabel=i,s.role="gridcell",s.dataset.vcMonthsMonth=`${l}`,a===l&&(s.dataset.vcMonthsMonthSelected=""),a===l&&(s.ariaSelected="true"),r&&(s.ariaDisabled="true"),r&&(s.tabIndex=-1),s.disabled=r,s},q=(e,t)=>{var a,n;const i=null==(a=null==t?void 0:t.closest('[data-vc="header"]'))?void 0:a.querySelector('[data-vc="year"]'),r=i?Number(i.dataset.vcYear):e.private.selectedYear,l=(null==t?void 0:t.dataset.vcMonth)?Number(t.dataset.vcMonth):e.private.selectedMonth;e.private.currentType="month",N(e,t),L(e);const s=e.private.mainElement.querySelector('[data-vc="months"]');if(!e.selectionMonthsMode||!s)return;const o=e.monthsToSwitch>1?e.private.locale.months.long.map(((t,a)=>l-e.monthsToSwitch*a)).concat(e.private.locale.months.long.map(((t,a)=>l+e.monthsToSwitch*a))).filter((e=>e>=0&&e<=12)):Array.from(Array(12).keys()),d=document.createElement("button");d.type="button";for(let t=0;t<12;t++){const a=t<e.private.dateMin.getMonth()+W(e)&&r<=e.private.dateMin.getFullYear()||t>e.private.dateMax.getMonth()+W(e)&&r>=e.private.dateMax.getFullYear()||t!==l&&!o.includes(t),n=H(e,d,l,e.private.locale.months.short[t],e.private.locale.months.long[t],a,t);s.appendChild(n)}null==(n=e.private.mainElement.querySelector("[data-vc-months-month]"))||n.focus()},P=(e,t,a,n,i)=>`<label class="${t}" data-vc-time-input="${e}"><input type="text" name="${e}" maxlength="2" aria-label="${a[`input${e.charAt(0).toUpperCase()+e.slice(1)}`]}" value="${n}" ${i?"disabled":""}></label>\n`,F=(e,t,a,n,i,r,l)=>`<label class="${t}" data-vc-time-range="${e}"><input type="range" name="${e}" min="${n}" max="${i}" step="${r}" aria-label="${a[`range${e.charAt(0).toUpperCase()+e.slice(1)}`]}" value="${l}"></label>\n`,I=(e,t,a,n)=>{({hour:()=>e.private.selectedHours=a,minute:()=>e.private.selectedMinutes=a})[n](),e.private.selectedTime=`${e.private.selectedHours}:${e.private.selectedMinutes}${e.private.selectedKeeping?` ${e.private.selectedKeeping}`:""}`,e.onChangeTime&&e.onChangeTime(t,e,!1),e.isInput&&e.private.inputElement&&e.private.mainElement&&e.onChangeToInput&&e.onChangeToInput(t,e)},O=(e,t)=>{var a;return(null==(a={0:{AM:"00",PM:"12"},1:{AM:"01",PM:"13"},2:{AM:"02",PM:"14"},3:{AM:"03",PM:"15"},4:{AM:"04",PM:"16"},5:{AM:"05",PM:"17"},6:{AM:"06",PM:"18"},7:{AM:"07",PM:"19"},8:{AM:"08",PM:"20"},9:{AM:"09",PM:"21"},10:{AM:"10",PM:"22"},11:{AM:"11",PM:"23"},12:{AM:"00",PM:"12"}}[Number(e)])?void 0:a[t])||String(e)},_=e=>({0:"12",13:"01",14:"02",15:"03",16:"04",17:"05",18:"06",19:"07",20:"08",21:"09",22:"10",23:"11"}[Number(e)]||String(e)),K=(e,t,a,n)=>{e.value=a,t.value=n},j=(e,t,a,n,i,r,l)=>{const s={hour:(s,o,d)=>{if(!e.selectionTimeMode)return;const c={12:()=>{const c=Number(O(o,e.private.selectedKeeping));if(!(c<=r&&c>=l))return K(a,t,e.private.selectedHours,e.private.selectedHours),void(e.onChangeTime&&e.onChangeTime(d,e,!0));K(a,t,_(o),O(o,e.private.selectedKeeping)),s>12&&((e,t,a)=>{t&&(e.private.selectedKeeping=a,t.innerText=a)})(e,n,"PM"),I(e,d,o,i)},24:()=>{if(!(s<=r&&s>=l))return K(a,t,e.private.selectedHours,e.private.selectedHours),void(e.onChangeTime&&e.onChangeTime(d,e,!0));K(a,t,o,o),I(e,d,o,i)}};c[e.selectionTimeMode]()},minute:(n,s,o)=>{if(!(n<=r&&n>=l))return a.value=e.private.selectedMinutes,void(e.onChangeTime&&e.onChangeTime(o,e,!0));a.value=s,t.value=s,I(e,o,s,i)}},o=e=>{const t=Number(a.value),n=a.value.padStart(2,"0");s[i]&&s[i](t,n,e)};return a.addEventListener("change",o),()=>{a.removeEventListener("change",o)}},z=(e,t,a,n,i)=>{const r=r=>{const l=Number(t.value),s=t.value.padStart(2,"0"),o="hour"===i,d=24===e.selectionTimeMode,c=l>0&&l<12;((e,t,a,n,i)=>{t.value=i,I(e,a,i,n)})(e,a,r,i,!o||d||c?s:_(t.value)),o&&!d&&((e,t,a)=>{t&&(e.private.selectedKeeping=a,t.innerText=a)})(e,n,0===l||c?"AM":"PM")};return t.addEventListener("input",r),()=>{t.removeEventListener("input",r)}},U=e=>e.setAttribute("data-vc-input-focus",""),R=e=>e.removeAttribute("data-vc-input-focus"),Z=(e,t)=>{const a=t.querySelector('[data-vc-time-range="hour"] input[name="hour"]'),n=t.querySelector('[data-vc-time-range="minute"] input[name="minute"]'),i=t.querySelector('[data-vc-time-input="hour"] input[name="hour"]'),r=t.querySelector('[data-vc-time-input="minute"] input[name="minute"]'),l=t.querySelector('[data-vc-time="keeping"]');if(!(a&&n&&i&&r))return;const s=e=>{e.target===a&&U(i),e.target===n&&U(r)},o=e=>{e.target===a&&R(i),e.target===n&&R(r)};return t.addEventListener("mouseover",s),t.addEventListener("mouseout",o),j(e,a,i,l,"hour",e.timeMaxHour,e.timeMinHour),j(e,n,r,l,"minute",e.timeMaxMinute,e.timeMinMinute),z(e,a,i,l,"hour"),z(e,n,r,l,"minute"),l&&((e,t,a,n,i)=>{const r=r=>{const l="AM"===e.private.selectedKeeping?"PM":"AM",s=O(e.private.selectedHours,l);Number(s)<=n&&Number(s)>=i?(e.private.selectedKeeping=l,a.value=s,I(e,r,e.private.selectedHours,"hour"),t.ariaLabel=`${e.labels.btnKeeping} ${e.private.selectedKeeping}`,t.innerText=e.private.selectedKeeping):e.onChangeTime&&e.onChangeTime(r,e,!0)};t.addEventListener("click",r)})(e,l,a,e.timeMaxHour,e.timeMinHour),()=>{t.removeEventListener("mouseover",s),t.removeEventListener("mouseout",o)}},B=e=>{const t=e.selectedWeekends?[...e.selectedWeekends]:[],a=[...e.private.locale.weekdays.long].reduce(((a,n,i)=>[...a,{id:i,titleShort:e.private.locale.weekdays.short[i],titleLong:n,isWeekend:t.includes(i)}]),[]),n=[...a.slice(e.firstWeekday),...a.slice(0,e.firstWeekday)];e.private.mainElement.querySelectorAll('[data-vc="week"]').forEach((t=>{const a=document.createElement("button");a.type="button",n.forEach((n=>{const i=a.cloneNode(!0);i.innerText=n.titleShort,i.className=e.styles.weekDay,i.role="columnheader",i.ariaLabel=n.titleLong,i.dataset.vcWeekDay=String(n.id),n.isWeekend&&(i.dataset.vcWeekDayOff=""),t.appendChild(i)}))}))},G=(e,t,a,n)=>{e.style.visibility=a?"hidden":"",t.style.visibility=n?"hidden":""},J=e=>{if("month"===e.private.currentType)return;const t=e.private.mainElement.querySelector('[data-vc-arrow="prev"]'),a=e.private.mainElement.querySelector('[data-vc-arrow="next"]');if(!t||!a)return;const n={default:()=>((e,t,a)=>{const n=b(M(new Date(e.private.selectedYear,e.private.selectedMonth,1))),i=new Date(n.getTime()),r=new Date(n.getTime());i.setMonth(i.getMonth()-e.monthsToSwitch),r.setMonth(r.getMonth()+e.monthsToSwitch),e.selectionYearsMode||(e.private.dateMin.setFullYear(n.getFullYear()),e.private.dateMax.setFullYear(n.getFullYear()));const l=!e.selectionMonthsMode||i.getFullYear()<e.private.dateMin.getFullYear()||i.getFullYear()===e.private.dateMin.getFullYear()&&i.getMonth()<e.private.dateMin.getMonth(),s=!e.selectionMonthsMode||r.getFullYear()>e.private.dateMax.getFullYear()||r.getFullYear()===e.private.dateMax.getFullYear()&&r.getMonth()>e.private.dateMax.getMonth();G(t,a,l,s)})(e,t,a),year:()=>((e,t,a)=>{const n=!!(e.private.dateMin.getFullYear()&&e.private.displayYear-7<=e.private.dateMin.getFullYear()),i=!!(e.private.dateMax.getFullYear()&&e.private.displayYear+7>=e.private.dateMax.getFullYear());G(t,a,n,i)})(e,t,a)};n["multiple"===e.private.currentType?"default":e.private.currentType]()},V=(e,t,a,n,i)=>{const r=t.cloneNode(!1);return r.className=e.styles.yearsYear,r.innerText=String(i),r.ariaLabel=String(i),r.role="gridcell",r.dataset.vcYearsYear=`${i}`,a===i&&(r.dataset.vcYearsYearSelected=""),a===i&&(r.ariaSelected="true"),n&&(r.ariaDisabled="true"),n&&(r.tabIndex=-1),r.disabled=n,r},X=(e,t)=>{var a;const n=(null==t?void 0:t.dataset.vcYear)?Number(t.dataset.vcYear):e.private.selectedYear;e.private.currentType="year",N(e,t),L(e),J(e);const i=e.private.mainElement.querySelector('[data-vc="years"]');if(!e.selectionYearsMode||!i)return;const r="multiple"!==e.viewType||e.private.selectedYear===n?0:1,l=document.createElement("button");l.type="button";for(let t=e.private.displayYear-7;t<e.private.displayYear+8;t++){const a=t<e.private.dateMin.getFullYear()+r||t>e.private.dateMax.getFullYear(),s=V(e,l,n,a,t);i.appendChild(s)}null==(a=e.private.mainElement.querySelector("[data-vc-years-year]"))||a.focus()},Q={value:!1,set:()=>Q.value=!0,check:()=>Q.value},ee=(e,t)=>e.dataset.vcTheme=t,te=(e,t)=>{if(ee(e.private.mainElement,t.matches?"dark":"light"),"system"!==e.selectedTheme||Q.check())return;const a=e=>{const t=document.querySelectorAll('[data-vc="calendar"]');null==t||t.forEach((t=>ee(t,e.matches?"dark":"light")))};t.addEventListener?t.addEventListener("change",a):t.addListener(a),Q.set()},ae=(e,t)=>{const a=e.themeAttrDetect?document.querySelector(e.themeAttrDetect):null,n=e.themeAttrDetect.replace(/^.*\[(.+)\]/g,((e,t)=>t));if(!a||"system"===a.getAttribute(n))return void te(e,t);const i=a.getAttribute(n);i?(ee(e.private.mainElement,i),((e,t,a)=>{new MutationObserver((n=>{for(let i=0;i<n.length;i++)if(n[i].attributeName===a){const n=t.getAttribute(a);n&&ee(e.private.mainElement,n);break}})).observe(t,{attributes:!0})})(e,a,n)):te(e,t)},ne=e=>e.charAt(0).toUpperCase()+e.slice(1).replace(/\./,""),ie=e=>{var t,a,n,i,r,l,o,d;if(!(e.private.locale.weekdays.short[6]&&e.private.locale.weekdays.long[6]&&e.private.locale.months.short[11]&&e.private.locale.months.long[11]))if("string"==typeof e.locale){if("string"==typeof e.locale&&!e.locale.length)throw new Error(v);Array.from({length:7},((t,a)=>((e,t,a)=>{const n=new Date(`1978-01-0${t+1}T00:00:00.000Z`),i=n.toLocaleString(a,{weekday:"short",timeZone:"UTC"}),r=n.toLocaleString(a,{weekday:"long",timeZone:"UTC"});e.private.locale.weekdays.short.push(ne(i)),e.private.locale.weekdays.long.push(ne(r))})(e,a,e.locale))),Array.from({length:12},((t,a)=>((e,t,a)=>{const n=new Date(`1978-${String(t+1).padStart(2,"0")}-01T00:00:00.000Z`),i=n.toLocaleString(a,{month:"short",timeZone:"UTC"}),r=n.toLocaleString(a,{month:"long",timeZone:"UTC"});e.private.locale.months.short.push(ne(i)),e.private.locale.months.long.push(ne(r))})(e,a,e.locale)))}else{if(!((null==(a=null==(t=e.locale)?void 0:t.weekdays)?void 0:a.short[6])&&(null==(i=null==(n=e.locale)?void 0:n.weekdays)?void 0:i.long[6])&&(null==(l=null==(r=e.locale)?void 0:r.months)?void 0:l.short[11])&&(null==(d=null==(o=e.locale)?void 0:o.months)?void 0:d.long[11])))throw new Error(v);e.private.locale=s({},e.locale)}},re=e=>{const t={default:()=>{B(e),T(e)},multiple:()=>{B(e),T(e)},month:()=>q(e),year:()=>X(e)};(e=>{"not all"!==window.matchMedia("(prefers-color-scheme)").media?"system"===e.selectedTheme?ae(e,window.matchMedia("(prefers-color-scheme: dark)")):ee(e.private.mainElement,e.selectedTheme):ee(e.private.mainElement,"light")})(e),ie(e),N(e),L(e),J(e),(e=>{const t=e.private.mainElement.querySelector('[data-vc="time"]');if(!e.selectionTimeMode||!t)return;const[a,n]=[e.timeMinHour,e.timeMaxHour],[i,r]=[e.timeMinMinute,e.timeMaxMinute],l=e.private.selectedKeeping?O(e.private.selectedHours,e.private.selectedKeeping):e.private.selectedHours,s="range"===e.timeControls;var o;t.innerHTML=e.sanitizerHTML(`<div class="${e.styles.timeContent}" data-vc-time="content">${P("hour",e.styles.timeHour,e.labels,l,s)}${P("minute",e.styles.timeMinute,e.labels,e.private.selectedMinutes,s)}${12===e.selectionTimeMode?(o=e.private.selectedKeeping,`<button type="button" class="${e.styles.timeKeeping}" aria-label="${e.labels.btnKeeping} ${o}" data-vc-time="keeping" ${s?"disabled":""}>${o}</button>`):""}</div><div class="${e.styles.timeRanges}" data-vc-time="ranges">${F("hour",e.styles.timeRange,e.labels,a,n,e.timeStepHour,l)}${F("minute",e.styles.timeRange,e.labels,i,r,e.timeStepMinute,e.private.selectedMinutes)}</div>`),Z(e,t)})(e),t[e.private.currentType]()},le=e=>{const t=()=>Array.from(e.private.mainElement.querySelectorAll('[data-vc="calendar"] button'));let a=0;const n={ArrowUp:(e,t)=>Math.max(0,e-t),ArrowDown:(e,a)=>Math.min(t().length-1,e+a),ArrowLeft:e=>Math.max(0,e-1),ArrowRight:e=>Math.min(t().length-1,e+1)},i=e=>{var i,r;if(!n[e.key]||"button"!==(null==(i=e.target)?void 0:i.localName))return;const l=t(),s=l[a].hasAttribute("data-vc-date-btn")?7:l[a].hasAttribute("data-vc-months-month")?4:l[a].hasAttribute("data-vc-years-year")?5:1;a=n[e.key](a,s),null==(r=l[a])||r.focus()};return e.private.mainElement.addEventListener("keydown",i),()=>{e.private.mainElement.removeEventListener("keydown",i)}},se=(e,t)=>{const a=b(M(new Date(e.private.selectedYear,e.private.selectedMonth,1)));({prev:()=>a.setMonth(a.getMonth()-e.monthsToSwitch),next:()=>a.setMonth(a.getMonth()+e.monthsToSwitch)})[t](),[e.private.selectedMonth,e.private.selectedYear]=[a.getMonth(),a.getFullYear()],L(e),J(e),T(e)},oe=e=>void 0===e.enableDateToggle||("function"==typeof e.enableDateToggle?e.enableDateToggle(e):e.enableDateToggle),de=(e,t,a)=>{const n=t.dataset.vcDate,i=t.closest("[data-vc-date][data-vc-date-selected]"),r=oe(e);i&&!r||(e.private.selectedDates=i?e.private.selectedDates.filter((e=>e!==n)):a?[...e.private.selectedDates,n]:[n])},ce=e=>e.reduce(((e,t)=>{if(t instanceof Date||"number"==typeof t){const a=t instanceof Date?t:new Date(t);e.push(a.toISOString().substring(0,10))}else t.match(/^(\d{4}-\d{2}-\d{2})$/g)?e.push(t):t.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,((t,a,n)=>{const i=b(a),r=b(n),l=new Date(i.getTime());for(;l<=r;l.setDate(l.getDate()+1))e.push(M(l));return t}));return e}),[]),ve={self:null,rangeMin:void 0,rangeMax:void 0},pe=()=>{var e,t;if(!(null==(t=null==(e=ve.self)?void 0:e.private)?void 0:t.mainElement))return;ve.self.private.mainElement.querySelectorAll("[data-vc-date]").forEach((e=>["data-vc-date-hover","data-vc-date-hover-first","data-vc-date-hover-last"].forEach((t=>e.removeAttribute(t)))))},ue=(e,t,a)=>{var n,i,r;if(!(null==(i=null==(n=ve.self)?void 0:n.private)?void 0:i.selectedDates))return;const l=M(e);if(null==(r=ve.self.private.disableDates)?void 0:r.includes(l))return;const s=ve.self.private.mainElement.querySelectorAll(`[data-vc-date="${l}"]`);null==s||s.forEach((e=>e.dataset.vcDateHover="")),t.forEach((e=>e.dataset.vcDateHoverFirst="")),a.forEach((e=>e.dataset.vcDateHoverLast=""))},me=e=>{var t,a;if(!e.target||!(null==(a=null==(t=ve.self)?void 0:t.private)?void 0:a.selectedDates))return;if(!e.target.closest('[data-vc="dates"]'))return void pe();const n=e.target.closest("[data-vc-date]");if(!n)return;const i=n.dataset.vcDate,r=b(ve.self.private.selectedDates[0]),l=b(i),s=ve.self.private.mainElement.querySelectorAll(`[data-vc-date="${ve.self.private.selectedDates[0]}"]`),o=ve.self.private.mainElement.querySelectorAll(`[data-vc-date="${i}"]`),[d,c]=r<l?[s,o]:[o,s],[v,p]=r<l?[r,l]:[l,r];pe();for(let e=new Date(v);e<=p;e.setDate(e.getDate()+1))ue(e,d,c)},he=e=>{ve.self&&"Escape"===e.key&&(ve.self.private.selectedDates=[],ve.self.private.mainElement.removeEventListener("mousemove",me),document.removeEventListener("keydown",he),re(ve.self))},ye=(e,t)=>{var a;if(t){const n=1===e.private.selectedDates.length&&e.private.selectedDates[0].includes(t);e.private.selectedDates=n&&!oe(e)?[t,t]:n&&oe(e)?[]:e.private.selectedDates.length>1?[t]:[...e.private.selectedDates,t],null==(a=e.private.selectedDates)||a.sort(((e,t)=>+new Date(e)-+new Date(t)))}e.disableDatesGaps&&(ve.rangeMin=ve.rangeMin?ve.rangeMin:e.private.displayDateMin,ve.rangeMax=ve.rangeMax?ve.rangeMax:e.private.displayDateMax),ve.self=e,pe();const n={set:()=>{e.private.mainElement.addEventListener("mousemove",me),e.private.mainElement.addEventListener("keydown",he),e.disableDatesGaps&&(()=>{var e,t,a,n;if(!(null==(a=null==(t=null==(e=ve.self)?void 0:e.private)?void 0:t.selectedDates)?void 0:a[0])||!(null==(n=ve.self.private.disableDates)?void 0:n[0]))return;const i=b(ve.self.private.selectedDates[0]),[r,l]=ve.self.private.disableDates.map((e=>b(e))).reduce((([e,t],a)=>[i>=a?a:e,i<a&&null===t?a:t]),[null,null]);r&&(ve.self.private.displayDateMin=M(new Date(r.setDate(r.getDate()+1)))),l&&(ve.self.private.displayDateMax=M(new Date(l.setDate(l.getDate()-1))))})()},reset:()=>{const[t,a]=[e.private.selectedDates[0],e.private.selectedDates[e.private.selectedDates.length-1]],n=e.private.selectedDates[0]!==e.private.selectedDates[e.private.selectedDates.length-1],i=ce([`${t}:${a}`]).filter((t=>!e.private.disableDates.includes(t)));e.private.selectedDates=n?e.enableEdgeDatesOnly?[t,a]:i:[e.private.selectedDates[0],e.private.selectedDates[0]],e.private.mainElement.removeEventListener("mousemove",me),e.private.mainElement.removeEventListener("keydown",he),e.disableDatesGaps&&ve.self&&(ve.self.private.displayDateMin=ve.rangeMin,ve.self.private.displayDateMax=ve.rangeMax)}};n[1===e.private.selectedDates.length?"set":"reset"]()},ge=e=>{e.private.mainElement.querySelectorAll("[data-vc-date]").forEach((t=>{const a=t.querySelector("[data-vc-date-btn]"),n=t.dataset.vcDate,i=b(n).getDay();f(e,e.private.selectedYear,t,a,i,n,"current")}))},be=["month","year"],Me=(e,t,a)=>{const n=e.private.mainElement.querySelectorAll('[data-vc="column"]'),i=Array.from(n).findIndex((e=>e.closest(`[data-vc-column="${t}"]`))),r=Number(n[i].querySelector(`[data-vc="${t}"]`).getAttribute(`data-vc-${t}`));return"month"===e.private.currentType&&i>=0?a-i:"year"===e.private.currentType&&e.private.selectedYear!==r?a-1:a},De=(e,t,a,n)=>{var i;const r={year:()=>{if("multiple"===e.viewType)return((e,t)=>{const a=Me(e,"year",Number(t.dataset.vcYearsYear)),n=e.private.selectedMonth<e.private.dateMin.getMonth()&&a<=e.private.dateMin.getFullYear(),i=e.private.selectedMonth>e.private.dateMax.getMonth()&&a>=e.private.dateMax.getFullYear(),r=a<e.private.dateMin.getFullYear(),l=a>e.private.dateMax.getFullYear();e.private.selectedYear=n||r?e.private.dateMin.getFullYear():i||l?e.private.dateMax.getFullYear():a,e.private.selectedMonth=n||r?e.private.dateMin.getMonth():i||l?e.private.dateMax.getMonth():e.private.selectedMonth})(e,n);e.private.selectedYear=Number(n.dataset.vcYearsYear)},month:()=>{if("multiple"===e.viewType)return((e,t)=>{const a=t.closest('[data-vc-column="month"]').querySelector('[data-vc="year"]'),n=Me(e,"month",Number(t.dataset.vcMonthsMonth)),i=Number(a.dataset.vcYear),r=n<e.private.dateMin.getMonth()&&i<=e.private.dateMin.getFullYear(),l=n>e.private.dateMax.getMonth()&&i>=e.private.dateMax.getFullYear();e.private.selectedYear=i,e.private.selectedMonth=r?e.private.dateMin.getMonth():l?e.private.dateMax.getMonth():n})(e,n);e.private.selectedMonth=Number(n.dataset.vcMonthsMonth)}};r[a]();({year:()=>{var a;return null==(a=e.onClickYear)?void 0:a.call(e,t,e)},month:()=>{var a;return null==(a=e.onClickMonth)?void 0:a.call(e,t,e)}})[a](),e.private.currentType=e.viewType,re(e),null==(i=e.private.mainElement.querySelector(`[data-vc="${a}"]`))||i.focus()},fe=(e,t)=>{const a={month:e.selectionMonthsMode,year:e.selectionYearsMode};be.forEach((n=>{a[n]&&t.target&&((e,t,a)=>{var n;const i=t.target,r=i.closest(`[data-vc="${a}"]`),l={year:()=>X(e,i),month:()=>q(e,i)};if(r&&e.onClickTitle&&e.onClickTitle(t,e),r&&e.private.currentType!==a)return l[a]();const s=i.closest(`[data-vc-${a}s-${a}]`);if(s)return De(e,t,a,s);const o=i.closest('[data-vc="grid"]'),d=i.closest('[data-vc="column"]');(e.private.currentType===a&&r||"multiple"===e.viewType&&e.private.currentType===a&&o&&!d)&&(e.private.currentType=e.viewType,re(e),null==(n=e.private.mainElement.querySelector(`[data-vc="${a}"]`))||n.focus())})(e,t,n)}))},we=e=>{const t=t=>{((e,t)=>{const a=t.target.closest("[data-vc-arrow]");a&&(["default","multiple"].includes(e.private.currentType)?se(e,a.dataset.vcArrow):"year"===e.private.currentType&&void 0!==e.private.displayYear&&(e.private.displayYear+={prev:-15,next:15}[a.dataset.vcArrow],X(e,t.target)),e.onClickArrow&&e.onClickArrow(t,e))})(e,t),((e,t)=>{if(!e.onClickWeekDay)return;const a=t.target.closest("[data-vc-week-day]"),n=t.target.closest('[data-vc="column"]'),i=n?n.querySelectorAll("[data-vc-date-week-day]"):e.private.mainElement.querySelectorAll("[data-vc-date-week-day]");if(!a||!i[0])return;const r=Number(a.dataset.vcWeekDay),l=Array.from(i).filter((e=>Number(e.dataset.vcDateWeekDay)===r));e.onClickWeekDay(t,r,l,e)})(e,t),((e,t)=>{if(!e.enableWeekNumbers||!e.onClickWeekNumber)return;const a=t.target.closest("[data-vc-week-number]"),n=e.private.mainElement.querySelectorAll("[data-vc-date-week-number]");if(!a||!n[0])return;const i=Number(a.innerText),r=Number(a.dataset.vcWeekYear),l=Array.from(n).filter((e=>Number(e.dataset.vcDateWeekNumber)===i));e.onClickWeekNumber(t,i,l,r,e)})(e,t),((e,t)=>{var a;const n=t.target,i=n.closest("[data-vc-date-btn]");if(!e.selectionDatesMode||!["single","multiple","multiple-ranged"].includes(e.selectionDatesMode)||!i)return;const r=i.closest("[data-vc-date]");({single:()=>de(e,r,!1),multiple:()=>de(e,r,!0),"multiple-ranged":()=>ye(e,r.dataset.vcDate)})[e.selectionDatesMode](),null==(a=e.private.selectedDates)||a.sort(((e,t)=>+new Date(e)-+new Date(t))),e.onClickDate&&e.onClickDate(t,e),e.isInput&&e.private.inputElement&&e.private.mainElement&&e.onChangeToInput&&e.onChangeToInput(t,e);const l=n.closest('[data-vc-date-month="prev"]'),s=n.closest('[data-vc-date-month="next"]');({prev:()=>e.enableMonthChangeOnDayClick?se(e,"prev"):ge(e),next:()=>e.enableMonthChangeOnDayClick?se(e,"next"):ge(e),current:()=>ge(e)})[l?"prev":s?"next":"current"]()})(e,t),fe(e,t)};return e.private.mainElement.addEventListener("click",t),()=>e.private.mainElement.removeEventListener("click",t)};const Ee=(e,t,a)=>{if(e){const n="auto"===a?function(e,t){const a="left";if(!t||!e)return a;const{canShow:n,parentPositions:i}=y(e,t),r=n.left&&n.right;return(r&&n.bottom?"center":r&&n.top?["top","center"]:Array.isArray(i)?["bottom"===i[0]?"top":"bottom",...i.slice(1)]:i)||a}(e,t):a,i={top:-t.offsetHeight,bottom:e.offsetHeight,left:0,center:e.offsetWidth/2-t.offsetWidth/2,right:e.offsetWidth-t.offsetWidth},r=Array.isArray(n)?n[0]:"bottom",l=Array.isArray(n)?n[1]:n;t.dataset.vcPosition=r;const{top:s,left:o}=u(e),d=s+i[r];let c=o+i[l];const{vw:v}=m();if(c+t.clientWidth>v){const e=window.innerWidth-document.body.clientWidth;c=v-t.clientWidth-e}else c<0&&(c=0);Object.assign(t.style,{left:`${c}px`,top:`${d}px`})}},Te=()=>{const e=new Date;return new Date(e.getTime()-6e4*e.getTimezoneOffset()).toISOString().substring(0,10)},ke=e=>{e.private.currentType=e.viewType,(e=>{var t;if(e.enableJumpToSelectedDate&&(null==(t=e.selectedDates)?void 0:t.length)&&void 0===e.selectedMonth&&void 0===e.selectedYear){const t=b(ce(e.selectedDates)[0]);e.selectedMonth=t.getMonth(),e.selectedYear=t.getFullYear()}const a=void 0!==e.selectedMonth&&Number(e.selectedMonth)>=0&&Number(e.selectedMonth)<12,n=void 0!==e.selectedYear&&Number(e.selectedYear)>=0&&Number(e.selectedYear)<=9999;e.private.selectedMonth=a?Number(e.selectedMonth):e.dateToday.getMonth(),e.private.selectedYear=n?Number(e.selectedYear):e.dateToday.getFullYear(),e.private.displayYear=e.private.selectedYear})(e),(e=>{var t,a,n;"today"===e.dateMin&&(e.dateMin=Te()),"today"===e.dateMax&&(e.dateMax=Te()),"today"===e.displayDateMin&&(e.displayDateMin=Te()),"today"===e.displayDateMax&&(e.displayDateMax=Te()),e.displayDateMin=e.displayDateMin?b(e.dateMin)>=b(e.displayDateMin)?e.dateMin:e.displayDateMin:e.dateMin,e.displayDateMax=e.displayDateMax?b(e.dateMax)<=b(e.displayDateMax)?e.dateMax:e.displayDateMax:e.dateMax;const i=e.disableDatesPast&&!e.disableAllDates&&b(e.displayDateMin)<e.dateToday;e.private.displayDateMin=i||e.disableAllDates?M(e.dateToday):e.displayDateMin,e.private.displayDateMax=e.disableAllDates?M(e.dateToday):e.displayDateMax,e.private.disableDates=e.disableDates&&!e.disableAllDates?ce(e.disableDates):e.disableAllDates?[e.private.displayDateMin]:[],e.private.disableDates.length>1&&e.private.disableDates.sort(((e,t)=>+new Date(e)-+new Date(t))),e.private.enableDates=e.enableDates?ce(e.enableDates):[],(null==(t=e.private.enableDates)?void 0:t[0])&&(null==(a=e.private.disableDates)?void 0:a[0])&&(e.private.disableDates=e.private.disableDates.filter((t=>!e.private.enableDates.includes(t)))),e.private.enableDates.length>1&&e.private.enableDates.sort(((e,t)=>+new Date(e)-+new Date(t))),(null==(n=e.private.enableDates)?void 0:n[0])&&e.disableAllDates&&(e.private.displayDateMin=e.private.enableDates[0],e.private.displayDateMax=e.private.enableDates[e.private.enableDates.length-1])})(e),(e=>{var t;e.private.selectedDates=(null==(t=e.selectedDates)?void 0:t[0])?ce(e.selectedDates):[]})(e),(e=>{e.private.dateMin=e.displayDisabledDates?b(e.dateMin):b(e.private.displayDateMin),e.private.dateMax=e.displayDisabledDates?b(e.dateMax):b(e.private.displayDateMax)})(e),(e=>{var t,a,n;if(!e.selectionTimeMode)return;if(![12,24].includes(e.selectionTimeMode))throw new Error(p);const i=12===e.selectionTimeMode,r=i?/^([1-9]|1[0-2]):([0-5][0-9]) ?(AM|PM)?$/i:/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])$/;let[l,s,o]=null!=(n=null==(a=null==(t=e.selectedTime)?void 0:t.match(r))?void 0:a.slice(1))?n:[];l?i&&!o&&(o="AM"):(l=i?_(String(e.timeMinHour)):String(e.timeMinHour),s=String(e.timeMinMinute),o=i&&Number(_(String(e.timeMinHour)))>=12?"PM":"AM"),e.private.selectedHours=l.padStart(2,"0"),e.private.selectedMinutes=s.padStart(2,"0"),e.private.selectedKeeping=o,e.private.selectedTime=`${e.private.selectedHours}:${e.private.selectedMinutes}${o?` ${o}`:""}`})(e)},$e=(e,{year:t,month:a,dates:n,time:i,locale:r}={})=>{var l;const s={year:e.selectedYear,month:e.selectedMonth,dates:e.selectedDates,time:e.selectedTime};e.selectedYear=t?s.year:e.private.selectedYear,e.selectedMonth=a?s.month:e.private.selectedMonth,e.selectedTime=i?s.time:e.private.selectedTime,e.selectedDates="only-first"===n&&(null==(l=e.private.selectedDates)?void 0:l[0])?[e.private.selectedDates[0]]:!0===n?s.dates:e.private.selectedDates,r&&(e.private.locale={months:{short:[],long:[]},weekdays:{short:[],long:[]}}),ke(e),re(e),e.selectedYear=s.year,e.selectedMonth=s.month,e.selectedDates=s.dates,e.selectedTime=s.time,"multiple-ranged"===e.selectionDatesMode&&n&&ye(e)},Se=(e,t=!0)=>{const a=document.createElement("div");return a.className=e.styles.calendar,a.dataset.vc="calendar",a.dataset.vcInput="",a.dataset.vcCalendarHidden="",a.style.visibility="hidden",e.private.isInputInit=!0,e.private.mainElement=a,document.body.appendChild(e.private.mainElement),t&&queueMicrotask((()=>{Ee(e.private.inputElement,a,e.positionToInput),e.private.mainElement.style.visibility="visible",e.show()})),$e(e,{year:!0,month:!0,dates:!0,time:!0,locale:!0}),e.onInit&&e.onInit(e),le(e),we(e)},Ae=e=>(e.private.originalElement=e.private.mainElement.cloneNode(!0),e.private.isInit=!0,e.isInput?(e=>{const t=[];e.private.inputElement=e.private.mainElement;const a=()=>Ee(e.private.inputElement,e.private.mainElement,e.positionToInput),n=t=>{var a,i;"Escape"===t.key&&((null==(a=null==e?void 0:e.private)?void 0:a.inputElement)&&(null==(i=null==e?void 0:e.private)?void 0:i.mainElement)&&e.hide(),document.removeEventListener("keydown",n))},i=t=>{e&&t.target!==e.private.inputElement&&!e.private.mainElement.contains(t.target)&&(e.private.inputElement&&e.private.mainElement&&e.hide(),window.removeEventListener("resize",a),document.removeEventListener("click",i,{capture:!0}))},r=()=>{e.private.isInputInit?(Ee(e.private.inputElement,e.private.mainElement,e.positionToInput),e.private.mainElement.style.visibility="visible",e.show()):t.push(Se(e)),window.addEventListener("resize",a),document.addEventListener("click",i,{capture:!0}),document.addEventListener("keydown",n)};return e.private.inputElement.addEventListener("click",r),e.private.inputElement.addEventListener("focus",r),()=>{t.forEach((e=>e()))}})(e):(ke(e),re(e),e.onInit&&e.onInit(e),le(e),we(e))),xe={application:"Calendar",navigation:"Calendar Navigation",arrowNext:{month:"Next month",year:"Next list of years"},arrowPrev:{month:"Previous month",year:"Previous list of years"},month:"Select month, current selected month:",months:"List of months",year:"Select year, current selected year:",years:"List of years",week:"Days of the week",weekNumber:"Numbers of weeks in a year",dates:"Dates in the current month",selectingTime:"Selecting a time ",inputHour:"Hours",inputMinute:"Minutes",rangeHour:"Slider for selecting hours",rangeMinute:"Slider for selecting minutes",btnKeeping:"Switch AM/PM, current position:"},Ye={calendar:"vc",controls:"vc-controls",grid:"vc-grid",column:"vc-column",header:"vc-header",headerContent:"vc-header__content",month:"vc-month",year:"vc-year",arrowPrev:"vc-arrow vc-arrow_prev",arrowNext:"vc-arrow vc-arrow_next",wrapper:"vc-wrapper",content:"vc-content",months:"vc-months",monthsMonth:"vc-months__month",years:"vc-years",yearsYear:"vc-years__year",week:"vc-week",weekDay:"vc-week__day",weekNumbers:"vc-week-numbers",weekNumbersTitle:"vc-week-numbers__title",weekNumbersContent:"vc-week-numbers__content",weekNumber:"vc-week-number",dates:"vc-dates",date:"vc-date",dateBtn:"vc-date__btn",datePopup:"vc-date__popup",time:"vc-time",timeContent:"vc-time__content",timeHour:"vc-time__hour",timeMinute:"vc-time__minute",timeKeeping:"vc-time__keeping",timeRanges:"vc-time__ranges",timeRange:"vc-time__range"};class Ce{constructor(){o(this,"viewType","default"),o(this,"isInput",!1),o(this,"positionToInput","left"),o(this,"firstWeekday",1),o(this,"monthsToSwitch",1),o(this,"themeAttrDetect","html[data-theme]"),o(this,"locale","en"),o(this,"dateToday",new Date),o(this,"dateMin","1970-01-01"),o(this,"dateMax","2470-12-31"),o(this,"displayMonthsCount",2),o(this,"displayDateMin"),o(this,"displayDateMax"),o(this,"displayDatesOutside",!0),o(this,"displayDisabledDates",!1),o(this,"disableDates",[]),o(this,"disableAllDates",!1),o(this,"disableDatesPast",!1),o(this,"disableDatesGaps",!1),o(this,"disableWeekdays",[]),o(this,"disableToday",!1),o(this,"enableDates",[]),o(this,"enableEdgeDatesOnly",!0),o(this,"enableDateToggle",!0),o(this,"enableWeekNumbers",!1),o(this,"enableMonthChangeOnDayClick",!0),o(this,"enableJumpToSelectedDate",!1),o(this,"selectionDatesMode","single"),o(this,"selectionMonthsMode",!0),o(this,"selectionYearsMode",!0),o(this,"selectionTimeMode",!1),o(this,"selectedDates",[]),o(this,"selectedMonth"),o(this,"selectedYear"),o(this,"selectedHolidays",[]),o(this,"selectedWeekends",[0,6]),o(this,"selectedTime"),o(this,"selectedTheme","system"),o(this,"timeMinHour",0),o(this,"timeMaxHour",23),o(this,"timeMinMinute",0),o(this,"timeMaxMinute",59),o(this,"timeControls","all"),o(this,"timeStepHour",1),o(this,"timeStepMinute",1),o(this,"sanitizerHTML",(e=>e)),o(this,"onClickDate"),o(this,"onClickWeekDay"),o(this,"onClickWeekNumber"),o(this,"onClickTitle"),o(this,"onClickMonth"),o(this,"onClickYear"),o(this,"onClickArrow"),o(this,"onChangeTime"),o(this,"onChangeToInput"),o(this,"onInit"),o(this,"onUpdate"),o(this,"onDestroy"),o(this,"onShow"),o(this,"onHide"),o(this,"popups",{}),o(this,"labels",s({},xe)),o(this,"layouts",{default:"",multiple:"",month:"",year:""}),o(this,"styles",s({},Ye))}}const Ne=class e extends Ce{constructor(n,i){var r,l;super(),o(this,"init",(()=>Ae(this))),o(this,"update",(e=>((e,{year:t,month:a,dates:n,time:i,locale:r}={})=>{if(!e.private.isInit)throw new Error(c);e.isInput&&!e.private.isInputInit&&Se(e,!1),$e(e,{year:t,month:a,dates:n,time:i,locale:r}),e.onUpdate&&e.onUpdate(e)})(this,e))),o(this,"destroy",(()=>(e=>{var t,a,n,i,r;if(!e.private.isInit)throw new Error(c);e.isInput?(null==(t=e.private.mainElement.parentElement)||t.removeChild(e.private.mainElement),null==(n=null==(a=e.private.inputElement)?void 0:a.replaceWith)||n.call(a,e.private.originalElement),e.private.inputElement=void 0):null==(r=(i=e.private.mainElement).replaceWith)||r.call(i,e.private.originalElement),e.private.mainElement=e.private.originalElement,e.onDestroy&&e.onDestroy(e)})(this))),o(this,"show",(()=>{var e;(e=this).private.currentType?(e.private.mainElement.removeAttribute("data-vc-calendar-hidden"),e.onShow&&e.onShow(e)):e.private.mainElement.click()})),o(this,"hide",(()=>{var e;(e=this).private.currentType&&(e.private.mainElement.dataset.vcCalendarHidden="",e.onHide&&e.onHide(e))})),o(this,"private"),this.private=(l=s({},this.private),t(l,a({locale:{months:{short:[],long:[]},weekdays:{short:[],long:[]}}}))),this.private.mainElement="string"==typeof n?null!=(r=e.memoizedElements.get(n))?r:this.queryAndMemoize(n):n,i&&this.applyOptions(i)}queryAndMemoize(t){const a=document.querySelector(t);if(!a)throw new Error(d(t));return e.memoizedElements.set(t,a),a}applyOptions(e){const t=(e,a)=>{Object.keys(a).forEach((n=>{"object"!=typeof e[n]||"object"!=typeof a[n]||a[n]instanceof Date||Array.isArray(a[n])?void 0!==a[n]&&(e[n]=a[n]):t(e[n],a[n])}))};t(this,e)}};return o(Ne,"memoizedElements",new Map),Ne}));
{
"name": "vanilla-calendar-pro",
"version": "2.9.10",
"description": "Vanilla Calendar is a versatile JavaScript date and time picker with TypeScript support, making it compatible with any JavaScript framework or library. It is designed to be lightweight, simple to use, and feature-rich without relying on external dependencies.",
"homepage": "https://vanilla-calendar.pro",
"keywords": [
"calendar",
"js",
"ts",
"javascript",
"typescript",
"native",
"react",
"pure",
"default",
"vanilla",
"vanilla-js",
"picker",
"date-picker",
"datepicker",
"timepicker",
"iso8601"
],
"repository": {
"type": "git",
"url": "https://github.com/uvarov-frontend/vanilla-calendar-pro.git"
},
"author": {
"name": "Yury Uvarov",
"email": "uvarov.frontend@gmail.com",
"url": "https://frontend.uvarov.tech"
},
"license": "MIT",
"main": "./build/vanilla-calendar.min.js",
"module": "./build/vanilla-calendar.min.mjs",
"style": "./build/vanilla-calendar.min.css",
"source": "./src/vanilla-calendar.ts",
"types": "./index.d.ts",
"exports": {
".": {
"types": "./index.d.ts",
"node": "./build/vanilla-calendar.min.js",
"require": "./build/vanilla-calendar.min.js",
"import": "./build/vanilla-calendar.min.mjs"
},
"./utilities": {
"types": "./utilities/index.d.ts",
"node": "./utilities/index.js",
"require": "./utilities/index.js",
"import": "./utilities/index.mjs"
},
"./types": "./types.ts",
"./package.json": "./package.json",
"./build/*": "./build/*",
"./build/themes/*": "./build/themes/*"
},
"devDependencies": {},
"dependencies": {}
"name": "vanilla-calendar-pro",
"description": "The Vanilla Calendar Pro is a versatile JavaScript date and time picker component with TypeScript support, making it compatible with any JavaScript frameworks and libraries. It is designed to be lightweight, easy to use, and feature-rich, without relying on external dependencies.",
"version": "3.0.0-beta.1",
"homepage": "https://vanilla-calendar.pro",
"keywords": [
"calendar",
"js",
"ts",
"javascript",
"typescript",
"native",
"react",
"pure",
"default",
"vanilla",
"vanilla-js",
"picker",
"date-picker",
"datepicker",
"timepicker"
],
"repository": {
"type": "git",
"url": "https://github.com/uvarov-frontend/vanilla-calendar-pro.git"
},
"author": {
"name": "Yury Uvarov",
"email": "uvarov.frontend@gmail.com",
"url": "https://frontend.uvarov.tech"
},
"bugs": {
"url": "https://github.com/uvarov-frontend/vanilla-calendar-pro/issues",
"email": "uvarov.frontend@gmail.com"
},
"funding": {
"type": "individual",
"url": "https://buymeacoffee.com/uvarov"
},
"license": "MIT",
"main": "./build/vanilla-calendar.min.js",
"module": "./build/vanilla-calendar.min.mjs",
"style": "./build/vanilla-calendar.min.css",
"source": "./src/vanilla-calendar.ts",
"types": "./types.ts",
"exports": {
".": {
"types": "./types.ts",
"node": "./build/vanilla-calendar.min.js",
"require": "./build/vanilla-calendar.min.js",
"import": "./build/vanilla-calendar.min.mjs"
},
"./utilities": {
"types": "./utilities/index.d.ts",
"node": "./utilities/index.js",
"require": "./utilities/index.js",
"import": "./utilities/index.mjs"
},
"./types": "./types.ts",
"./package.json": "./package.json",
"./build/*": "./build/*",
"./build/themes/*": "./build/themes/*"
},
"devDependencies": {},
"dependencies": {}
}

@@ -1,227 +0,113 @@

import classes from './classes';
import type VanillaCalendar from '@src/vanilla-calendar';
import type labels from './src/labels';
import type options from './src/options';
import type styles from './src/styles';
type LeadingZero = `${0}${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}`;
type MM = LeadingZero | 10 | 11 | 12;
type DD = LeadingZero | `${1 | 2}${0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}` | 30 | 31;
export type FormatDateString = `${number}-${MM}-${DD}`;
export type MonthsCount = number;
export type Positions = 'bottom' | 'top' | 'center' | 'left' | 'right';
export interface HtmlElementPosition {
top: number;
bottom: number;
left: number;
right: number;
}
export type Range<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Range<N, [...Acc, Acc['length']]>;
export type ToggleSelected = boolean | ((self: VanillaCalendar) => boolean);
export type TypesCalendar = 'default' | 'multiple' | 'month' | 'year';
export type CSSClasses = typeof classes;
export type WeekDayID = 0 | 1 | 2 | 3 | 4 | 5 | 6;
export interface IDates {
min: FormatDateString | 'today';
max: FormatDateString | 'today';
today: Date;
}
export type WeekDays<T> = [...T[]];
export interface IRange {
/** This parameter sets the minimum date that the user can choose */
min?: FormatDateString | 'today';
/** This parameter sets the maximum date that the user can choose */
max?: FormatDateString | 'today';
/** This parameter disables all past days. */
disablePast: boolean;
/**
* This parameter disables the selection of days within a range with disabled dates.
* Only works when `settings.selection.day` is set to `'multiple-ranged'`.
*/
disableGaps: boolean;
/**
* This parameter will only keep references of the date range edges (start/end dates) in the `settings.selected.dates` array.
* Only works when `settings.selection.day` is set to `'multiple-ranged'`.
*/
edgesOnly?: boolean;
/** This parameter disables all days and can be useful when using `settings.range.enabled` */
disableAllDays: boolean;
/** This parameter allows you to disable specified weekdays. */
disableWeekday?: number[];
/** This parameter allows you to disable specific dates regardless of the specified range. */
disabled?: Array<Date | number | FormatDateString>;
/** This parameter allows you to enable specific dates regardless of the range and disabled dates. */
enabled?: Array<Date | number | FormatDateString>;
}
export type LocaleStated = {
months: {
long: string[];
short: string[];
};
weekdays: {
long: string[];
short: string[];
};
};
export interface ISelection {
day: false | 'single' | 'multiple' | 'multiple-ranged';
month: boolean | 'only-arrows';
year: boolean | 'only-arrows';
time: boolean | 12 | 24;
controlTime: 'all' | 'range';
stepHours: number;
stepMinutes: number;
cancelableDay: boolean;
}
export type Locale = string | LocaleStated;
export interface ISelected {
dates?: Array<Date | number | FormatDateString>;
month?: number;
year?: number;
holidays?: Array<Date | number | FormatDateString>;
time?: string;
}
export type Popup = {
modifier: string;
html: string;
};
export type ToggleSelected = boolean | ((self: IVanillaCalendar) => boolean);
export type Popups = {
[date in FormatDateString]: Popup;
};
export interface IVisibility {
/** This parameter determines the theme of the calendar. By default, the theme is determined by the user's system or website settings. */
theme: 'light' | 'dark' | 'system';
/** To automatically detect and apply the website's theme to the calendar, you can pass a string value as a CSS selector. */
themeDetect: string | false;
/** This parameter allows you to use abbreviated month names when selecting a month. */
monthShort: boolean;
/** With this parameter, you can decide whether to display week numbers in the calendar. */
weekNumbers: boolean;
/** This parameter allows you to highlight weekends in the calendar. */
weekend: boolean;
/** With this parameter, you can highlight the current day in the calendar. */
today: boolean;
/** This parameter determines whether all days, including disabled days, will be displayed. */
disabled: boolean;
/** With this parameter, you can decide whether to display days from the previous and next months. */
daysOutside: boolean;
/** This parameter specifies the position of the calendar relative to input, if the calendar is initialized with the `input` parameter. */
positionToInput: 'auto' | 'center' | 'left' | 'right' | ['bottom' | 'top', 'center' | 'left' | 'right'];
}
export type Dates = {
min: FormatDateString | 'today';
max: FormatDateString | 'today';
today: Date;
};
export interface ISettings {
lang: string;
iso8601: boolean;
range: IRange;
selection: ISelection;
selected: ISelected;
visibility: IVisibility;
}
export type HtmlElementPosition = {
top: number;
bottom: number;
left: number;
right: number;
};
export interface ILocale {
months: string[] | [];
weekday: string[] | [];
}
export interface IActions {
clickDay: ((e: MouseEvent, self: IVanillaCalendar) => void) | null;
clickWeekNumber: ((e: MouseEvent, number: number, days: HTMLElement[], year: number, self: IVanillaCalendar) => void) | null;
clickMonth: ((e: MouseEvent, self: IVanillaCalendar) => void) | null;
clickYear: ((e: MouseEvent, self: IVanillaCalendar) => void) | null;
clickArrow: ((e: MouseEvent, self: IVanillaCalendar) => void) | null;
changeTime: ((e: Event, self: IVanillaCalendar) => void) | null;
changeToInput: ((e: Event, self: IVanillaCalendar) => void) | null;
getDays: ((day: number, date: FormatDateString, HTMLElement: HTMLElement, HTMLButtonElement: HTMLButtonElement, self: IVanillaCalendar) => void) | null;
getMonths: ((month: number, HTMLElement: HTMLElement, self: IVanillaCalendar) => void) | null;
getYears: ((year: number, HTMLElement: HTMLElement, self: IVanillaCalendar) => void) | null;
initCalendar: ((self: IVanillaCalendar) => void) | null;
updateCalendar: ((self: IVanillaCalendar) => void) | null;
destroyCalendar: ((self: IVanillaCalendar) => void) | null;
showCalendar: ((self: IVanillaCalendar) => void) | null;
hideCalendar: ((self: IVanillaCalendar) => void) | null;
}
export type IPopup = {
modifier?: string;
html?: string;
export type Reset = {
year?: boolean;
month?: boolean;
dates?: boolean | 'only-first';
time?: boolean;
locale?: boolean;
};
export type IPopups = {
[date in FormatDateString]: IPopup;
export type PrivateVariables = {
isInit: boolean;
isInputInit: boolean;
currentType: TypesCalendar;
locale: LocaleStated;
mainElement: HTMLElement;
originalElement: HTMLElement;
inputElement?: HTMLInputElement;
dateMin: Date;
dateMax: Date;
displayDateMin: FormatDateString;
displayDateMax: FormatDateString;
displayYear: number;
disableDates: FormatDateString[];
enableDates: FormatDateString[];
selectedDates: FormatDateString[];
selectedMonth: number;
selectedYear: number;
selectedHours: string;
selectedMinutes: string;
selectedKeeping: string;
selectedTime: string;
};
export interface IDOMTemplates {
default: string;
multiple: string;
month: string;
year: string;
}
export type Styles = typeof styles;
export interface IReset {
year?: boolean;
month?: boolean;
dates?: boolean | 'only-first';
holidays?: boolean;
time?: boolean;
}
export type Labels = typeof labels;
export interface IOptions {
input?: boolean;
type?: TypesCalendar;
months?: number;
jumpMonths?: number;
jumpToSelectedDate?: boolean;
toggleSelected?: ToggleSelected;
date?: Partial<IDates>;
sanitizer?: (dirtyHtml: string) => unknown;
settings?: Partial<{
lang: string;
iso8601: boolean;
range: Partial<IRange>;
selection: Partial<ISelection>;
selected: Partial<ISelected>;
visibility: Partial<IVisibility>;
}>;
locale?: Partial<ILocale>;
actions?: Partial<IActions>;
popups?: IPopups;
CSSClasses?: Partial<CSSClasses>;
DOMTemplates?: Partial<IDOMTemplates>;
}
export type Layouts = {
default: string;
multiple: string;
month: string;
year: string;
};
export interface IVanillaCalendar {
input: boolean;
type: TypesCalendar;
months: number;
jumpMonths: number;
jumpToSelectedDate: boolean;
toggleSelected: ToggleSelected
date: IDates;
settings: {
lang: string;
iso8601: boolean;
range: IRange;
selection: ISelection;
selected: ISelected;
visibility: IVisibility;
};
locale: ILocale;
actions: IActions;
sanitizer: (dirtyHtml: string) => unknown;
popups: IPopups;
CSSClasses: CSSClasses;
DOMTemplates: IDOMTemplates;
export type Options = Omit<Partial<options>, 'labels' | 'layouts' | 'styles'> & {
labels?: Partial<Labels>;
layouts?: Partial<Layouts>;
styles?: Partial<Styles>;
};
init: () => () => void;
update: (reset?: IReset) => void;
destroy: () => void;
show: () => void;
hide: () => void;
readonly HTMLElement: HTMLElement;
readonly HTMLOriginalElement: HTMLElement;
readonly HTMLInputElement?: HTMLInputElement;
readonly rangeMin: FormatDateString;
readonly rangeMax: FormatDateString;
readonly rangeDisabled: FormatDateString[];
readonly rangeEnabled: FormatDateString[];
readonly selectedDates: FormatDateString[];
readonly selectedHolidays: FormatDateString[];
readonly selectedMonth: number;
readonly selectedYear: number;
readonly selectedHours?: string;
readonly selectedMinutes?: string;
readonly selectedKeeping?: string;
readonly selectedTime?: string;
readonly currentType: TypesCalendar;
readonly correctMonths: number;
readonly viewYear: number;
readonly dateMin: Date;
readonly dateMax: Date;
readonly isInit: boolean;
readonly isInputInit: boolean;
}
export { VanillaCalendar };

@@ -1,2 +0,2 @@

/*! name: vanilla-calendar-pro v2.9.10 | url: https://github.com/uvarov-frontend/vanilla-calendar-pro */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VanillaCalendarUtilities={})}(this,(function(e){"use strict";const t=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,n=e=>new Date(`${e}T00:00:00`);e.getDate=e=>n(e),e.getDateString=e=>t(e),e.parseDates=e=>(e=>e.reduce(((e,a)=>{if(a instanceof Date||"number"==typeof a){const t=a instanceof Date?a:new Date(a);e.push(t.toISOString().substring(0,10))}else a.match(/^(\d{4}-\d{2}-\d{2})$/g)?e.push(a):a.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,((a,i,o)=>{const r=n(i),d=n(o),s=new Date(r.getTime());for(;s<=d;s.setDate(s.getDate()+1))e.push(t(s));return a}));return e}),[]))(e),Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
/*! name: vanilla-calendar-pro v3.0.0 | url: https://github.com/uvarov-frontend/vanilla-calendar-pro */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VanillaCalendarUtilities={})}(this,(function(e){"use strict";const t=e=>new Date(`${e}T00:00:00.000Z`),n=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;e.getDate=e=>t(e),e.getDateString=e=>n(e),e.parseDates=e=>(e=>e.reduce(((e,a)=>{if(a instanceof Date||"number"==typeof a){const t=a instanceof Date?a:new Date(a);e.push(t.toISOString().substring(0,10))}else a.match(/^(\d{4}-\d{2}-\d{2})$/g)?e.push(a):a.replace(/(\d{4}-\d{2}-\d{2}).*?(\d{4}-\d{2}-\d{2})/g,((a,i,o)=>{const r=t(i),d=t(o),s=new Date(r.getTime());for(;s<=d;s.setDate(s.getDate()+1))e.push(n(s));return a}));return e}),[]))(e),Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc