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

vanilla-calendar-pro

Package Overview
Dependencies
Maintainers
1
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.2 to 2.9.3

2

build/vanilla-calendar.min.js
/*! name: vanilla-calendar-pro | 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,a=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,s=(t,a,n)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[a]=n,l=(e,l)=>{for(var i in l||(l={}))a.call(l,i)&&s(e,i,l[i]);if(t)for(var i of t(l))n.call(l,i)&&s(e,i,l[i]);return e},i=(e,t,a)=>(s(e,"symbol"!=typeof t?t+"":t,a),a);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",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,"input",!1),i(this,"type","default"),i(this,"months",2),i(this,"jumpMonths",1),i(this,"date",{min:"1970-01-01",max:"2470-12-31",today:new Date}),i(this,"settings",{lang:"en",iso8601:!0,range:{min:this.date.min,max:this.date.max,disablePast:!1,disableGaps:!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,"actions",{clickDay:null,clickWeekNumber:null,clickMonth:null,clickYear:null,clickArrow:null,changeTime:null,changeToInput:null,getDays:null,hideCalendar:null,showCalendar: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)=>(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 s=g(a),l=g(n),i=new Date(s.getTime());for(;i<=l;i.setDate(i.getDate()+1))e.push(m(i));return t})),e)),[]),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):"",y=e=>`${e} is not found, check the first argument passed to new VanillaCalendar.`,M='The calendar has not been initialized, please initialize it using the "init()" method first.',S='You specified "define" for "settings.lang" but did not provide the required values for "locale.weekday" or "locale.months".',p='Incorrect name of theme in "settings.visibility.theme".',b="The value of the time property can be: false, true, 12 or 24.",C=e=>{e.currentType=e.type,(e=>{const t=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=t?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,a,n;e.settings.range.min=g(e.date.min)>=g(e.settings.range.min)?e.date.min:e.settings.range.min,e.settings.range.max=g(e.date.max)<=g(e.settings.range.max)?e.date.max:e.settings.range.max;const s=e.settings.range.disablePast&&!e.settings.range.disableAllDays&&g(e.settings.range.min)<e.date.today;e.rangeMin=s?m(e.date.today):e.settings.range.disableAllDays?m(new Date(e.selectedYear,e.selectedMonth,1)):e.settings.range.min,e.rangeMax=e.settings.range.disableAllDays?m(new Date(e.selectedYear,e.selectedMonth,1)):e.settings.range.max,e.rangeDisabled=e.settings.range.disabled&&!e.settings.range.disableAllDays?h(e.settings.range.disabled):[],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==(a=e.rangeDisabled)?void 0:a[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==(n=e.rangeEnabled)?void 0:n[0])&&e.settings.range.disableAllDays&&(e.rangeMin=e.rangeEnabled[0],e.rangeMax=e.rangeEnabled[e.rangeEnabled.length-1])})(e),(e=>{var t,a;e.selectedDates=(null==(t=e.settings.selected.dates)?void 0:t[0])?h(e.settings.selected.dates):[],e.selectedHolidays=(null==(a=e.settings.selected.holidays)?void 0:a[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 a=!1;if("string"==typeof e.settings.selected.time){const n=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(n,((n,s,l,i)=>(s&&l&&(a=!0,e.selectedHours=s,e.selectedMinutes=l),i&&t?e.selectedKeeping=i:t&&(e.selectedKeeping="AM"),"")))}!a&&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"):a||(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)},f=e=>({hide(){e.HTMLElement.classList.add(e.CSSClasses.calendarHidden),e.actions.hideCalendar&&e.actions.hideCalendar(e)},show(){e.HTMLElement.classList.remove(e.CSSClasses.calendarHidden),e.actions.showCalendar&&e.actions.showCalendar(e)},self:e}),D=({arrowPrev:e,arrowNext:t,isPrevHidden:a,isNextHidden:n})=>{e.style.visibility=a?"hidden":"",t.style.visibility=n?"hidden":""},w=e=>{var t,a;if("month"===e.currentType)return;const n=null==(t=e.HTMLElement)?void 0:t.querySelector(`.${e.CSSClasses.arrowPrev}`),s=null==(a=e.HTMLElement)?void 0:a.querySelector(`.${e.CSSClasses.arrowNext}`);if(!n||!s)return;({default:()=>{const t=g(m(new Date(e.selectedYear,e.selectedMonth,1))),a=new Date(t.getTime()),l=new Date(t.getTime());a.setMonth(a.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||a.getFullYear()<e.dateMin.getFullYear()||a.getFullYear()===e.dateMin.getFullYear()&&a.getMonth()<e.dateMin.getMonth(),r=!e.settings.selection.month||l.getFullYear()>e.dateMax.getFullYear()||l.getFullYear()===e.dateMax.getFullYear()&&l.getMonth()>e.dateMax.getMonth();D({arrowPrev:n,arrowNext:s,isPrevHidden:i,isNextHidden:r})},year:()=>{D({arrowPrev:n,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 a=g(e),n=t?a.getDay()||7:a.getDay();a.setDate(a.getDate()+4-n);const s=new Date(a.getFullYear(),0,1),l=Math.ceil(((+a-+s)/864e5+1)/7);return{year:a.getFullYear(),week:l}},$=(e,t,a,n,s)=>{const l=t[a].querySelector(`.${e.CSSClasses.dayBtn}`),i=T(null==l?void 0:l.dataset.calendarDay,e.settings.iso8601);if(!i)return;const r=n.cloneNode(!0);r.innerText=String(i.week),r.dataset.calendarYearWeek=String(i.year),s.append(r)},L=(e,t,a,n,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(n),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.append(o):d.append(o),((e,t,a)=>{var n,s,l,i,r;const d=null==(n=e.settings.range.disableWeekday)?void 0:n.includes(a),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,a,n,s,l,i)=>{var r,d,o;(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)&&(n.classList.add(e.CSSClasses.dayBtnDisabled),n.tabIndex=-1),e.settings.visibility.today&&m(e.date.today)===l&&n.classList.add(e.CSSClasses.dayBtnToday),!e.settings.visibility.weekend||0!==s&&6!==s||n.classList.add(e.CSSClasses.dayBtnWeekend),(null==(d=e.selectedHolidays)?void 0:d.includes(l))&&n.classList.add(e.CSSClasses.dayBtnHoliday),(null==(o=e.selectedDates)?void 0:o.includes(l))&&(n.classList.add(e.CSSClasses.dayBtnSelected),e.selectedDates.length>1&&"multiple-ranged"===e.settings.selection.day&&(e.selectedDates[0]===l&&a.classList.add(e.CSSClasses.daySelectedFirst),e.selectedDates[e.selectedDates.length-1]===l&&a.classList.add(e.CSSClasses.daySelectedLast),e.selectedDates[0]!==l&&e.selectedDates[e.selectedDates.length-1]!==l&&a.classList.add(e.CSSClasses.daySelectedIntermediate)))})(e,t,d,o,s,l,i),a.append(d),e.actions.getDays&&e.actions.getDays(n,l,d,o,e)},H=e=>{const t=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.days}`),a=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.weekNumbers}`),n=new Date(e.selectedYear,e.selectedMonth,1);(e.settings.range.disableAllDays||e.settings.range.disableWeekday)&&e.rangeDisabled[0]&&(e.rangeDisabled=[]),t.forEach(((t,s)=>{const l=new Date(n);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.innerHTML="",((e,t,a,n,s)=>{let l=new Date(a,n,0).getDate()-(s-1);const i=0===n?a-1:a,r=0===n?12:n<10?`0${n}`:n;for(let n=s;n>0;n--,l++){const n=`${i}-${r}-${l}`,s=g(n).getDay();L(e,a,t,l,s,n,!0,e.CSSClasses.dayBtnPrev)}})(e,t,r,i,c),((e,t,a,n,s)=>{for(let l=1;l<=a;l++){const a=new Date(n,s,l),i=m(a),r=a.getDay();L(e,n,t,l,r,i,!1,null)}})(e,t,o,r,i),((e,t,a,n,s,l)=>{const i=l+a,r=7*Math.ceil(i/7)-i,d=s+1===12?n+1:n,o=s+1===12?"01":s+2<10?`0${s+2}`:s+2;for(let a=1;a<=r;a++){const s=`${d}-${o}-${a<10?`0${a}`:String(a)}`,l=g(s).getDay();L(e,n,t,a,l,s,!0,e.CSSClasses.dayBtnNext)}})(e,t,o,r,i,c),((e,t,a,n,s)=>{if(!e.settings.visibility.weekNumbers)return;n.innerHTML="";const l=document.createElement("b");l.className=e.CSSClasses.weekNumbersTitle,l.innerText="#",n.append(l);const i=document.createElement("div");i.className=e.CSSClasses.weekNumbersContent,n.append(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+a)/7);for(let t=0;t<o;t++)$(e,d,0===t?6:7*t,r,i)})(e,c,o,a[s],t),((e,t)=>{var a;e.popups&&(null==(a=Object.entries(e.popups))||a.forEach((([a,n])=>((e,t,a,n)=>{const s=a.querySelector(`[data-calendar-day="${e}"]`);s&&((null==t?void 0:t.modifier)&&s.classList.add(...t.modifier.trim().split(" ")),(null==t?void 0:t.html)&&(s.parentElement.innerHTML+=`<div class="${n}">${t.html}</div>`))})(a,n,t,e.CSSClasses.dayPopup))))})(e,t)}))},E=e=>{var t,a;const n=null==(t=e.HTMLElement)?void 0:t.querySelectorAll("[data-calendar-selected-month]"),s=null==(a=e.HTMLElement)?void 0:a.querySelectorAll("[data-calendar-selected-year]");if(!(null==n?void 0:n[0])&&(null==s?void 0:s[0]))return;const l=new Date(e.selectedYear,e.selectedMonth,1);null==n||n.forEach(((t,a)=>((e,t,a,n)=>{const s=new Date(n.setMonth(e.selectedMonth+a)).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,a,l))),null==s||s.forEach(((t,a)=>((e,t,a,n)=>{const s=new Date(n.setFullYear(e.selectedYear,e.selectedMonth+a)).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,a,l)))},k=(e,t)=>{const a=g(m(new Date(e.selectedYear,e.selectedMonth,1)));({prev:()=>a.setMonth(a.getMonth()-e.jumpMonths),next:()=>a.setMonth(a.getMonth()+e.jumpMonths)})[t](),[e.selectedMonth,e.selectedYear]=[a.getMonth(),a.getFullYear()],E(e),w(e),H(e)},Y=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"})),x=(e,t)=>t.replace(/[\n\t]/g,"").replace(/<#(?!\/?Multiple)(.*?)>/g,((t,a)=>{const n=(s=a.replace(/[/\s\n\t]/g,""),Y[s]);var s;return n?n(e):""})).replace(/[\n\t]/g,""),_=(e,t)=>{const{HTMLElement:a,CSSClasses:n,DOMTemplates:s,type:l,currentType:i,correctMonths:r}=e,d=(s,l)=>{if(!t)return;const i=a.querySelector(`.${n.controls}`);i&&a.removeChild(i);a.querySelector(`.${n.grid}`).classList.add(n.gridDisabled);const r=t.closest(`.${n.column}`);r.classList.add(s),r.innerHTML=x(e,l)},o={default:()=>{a.classList.add(n.calendarDefault),a.classList.remove(n.calendarMonth,n.calendarYear),a.innerHTML=x(e,s.default)},multiple:()=>{r&&(a.classList.add(n.calendarMultiple),a.classList.remove(n.calendarMonth,n.calendarYear),a.innerHTML=((e,t)=>t.replace(/<#Multiple>(.*?)<#\/Multiple>/g,((t,a)=>{let n="";for(let t=0;t<e.correctMonths;t++)n+=a;return n})).replace(/[\n\t]/g,""))(e,x(e,s.multiple)))},month:()=>{"multiple"!==l?(a.classList.add(n.calendarMonth),a.classList.remove(n.calendarDefault,n.calendarYear),a.innerHTML=x(e,s.month)):d(n.columnMonth,s.month)},year:()=>{"multiple"!==l?(a.classList.add(n.calendarYear),a.classList.remove(n.calendarDefault,n.calendarMonth),a.innerHTML=x(e,s.year)):d(n.columnYear,s.year)}};a.classList.add(n.calendar),o[i]()},N=(e,t,a,n,s)=>{const l=t.cloneNode(!1);return l.className=`${e.CSSClasses.yearsYear}${a===s?` ${e.CSSClasses.yearsYearSelected}`:n?` ${e.CSSClasses.yearsYearDisabled}`:""}`,l.dataset.calendarYear=String(s),l.title=String(s),l.innerText=String(s),n&&(l.tabIndex=-1),l},A=(e,t)=>{const a=(null==t?void 0:t.dataset.calendarSelectedYear)?Number(null==t?void 0:t.dataset.calendarSelectedYear):e.selectedYear;e.currentType="year",_(e,t),E(e),w(e);const n=e.HTMLElement.querySelector(`.${e.CSSClasses.years}`);if(!e.settings.selection.year||!n)return;n.classList.add(e.CSSClasses.yearsSelecting);const s="multiple"!==e.type||e.selectedYear===a?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();n.append(N(e,l,a,i,t))}},F=e=>`${e.charAt(0).toUpperCase()}${e.substring(1,e.length)}`.replace(/\./,""),P=(e,t)=>{const a=new Date(0,0,t).toLocaleString(e.settings.lang,{weekday:"short"});e.locale.weekday.push(F(a))},I=(e,t)=>{const a=new Date(0,t).toLocaleString(e.settings.lang,{month:"long"});e.locale.months.push(F(a))},q=e=>{if("multiple"!==e.type)return 0;const t=[...e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`)].findIndex((t=>t.classList.contains(`${e.CSSClasses.columnMonth}`)));return t>0?t:0},W=(e,t,a,n,s,l)=>{const i=t.cloneNode(!1);return i.className=`${e.CSSClasses.monthsMonth}${a===l?` ${e.CSSClasses.monthsMonthSelected}`:s?` ${e.CSSClasses.monthsMonthDisabled}`:""}`,i.title=n,i.innerText=`${e.settings.visibility.monthShort?n.substring(0,3):n}`,i.dataset.calendarMonth=String(l),s&&(i.tabIndex=-1),i},B=(e,t)=>{var a,n;const s=(null==t?void 0:t.dataset.calendarSelectedMonth)?Number(t.dataset.calendarSelectedMonth):e.selectedMonth,l=null==(a=null==t?void 0:t.closest(`.${e.CSSClasses.column}`))?void 0:a.querySelector(`.${e.CSSClasses.year}`),i=l?Number(l.dataset.calendarSelectedYear):e.selectedYear;e.currentType="month",_(e,t),E(e);const r=null==(n=e.HTMLElement)?void 0:n.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,a)=>s-e.jumpMonths*a)).concat(e.locale.months.map(((t,a)=>s+e.jumpMonths*a))).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 a=e.locale.months[t],n=t<e.dateMin.getMonth()+q(e)&&i<=e.dateMin.getFullYear()||t>e.dateMax.getMonth()+q(e)&&i>=e.dateMax.getFullYear()||t!==s&&!d.includes(t);r.append(W(e,o,s,a,n,t))}},K=(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]:"",O=(e,t,a)=>e.querySelector(`.${t}${a?` input[name="${a}"]`:""}`),j=(e,t,a)=>{e.addEventListener("mouseover",(()=>t.classList.add(a))),e.addEventListener("mouseout",(()=>t.classList.remove(a)))},R=(e,t,a,n)=>{({hours:()=>{e.selectedHours=a},minutes:()=>{e.selectedMinutes=a}})[n](),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,f(e),e)},z=(e,t,a,n,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 a.value=d,void R(e,t,d,s);r<l&&r>0?(a.value=d,e.selectedKeeping="AM",n.innerText=e.selectedKeeping,R(e,t,d,s)):(0===r?(e.selectedKeeping="AM",n.innerText="AM"):(e.selectedKeeping="PM",n.innerText="PM"),a.value=v(i.value),R(e,t,v(i.value),s))}))},G=(e,t,a,n,s,l)=>{a.addEventListener("change",(a=>{const i=a.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=K(d,e.selectedKeeping),R(e,a,d,s)):i.value&&r<24&&(r>l||0===r)?(0===r?(e.selectedKeeping="AM",n.innerText="AM"):(e.selectedKeeping="PM",n.innerText="PM"),i.value=v(i.value),t.value=d,R(e,a,v(i.value),s)):i.value=e.selectedHours:i.value&&r<=l&&r>=0?(i.value=d,t.value=d,R(e,a,d,s)):"hours"===s?i.value=e.selectedHours:"minutes"===s&&(i.value=e.selectedMinutes)}))},V=(e,t,a)=>{const n=24===a?23:a||12,s=O(t,e.CSSClasses.timeRange,"hours"),l=O(t,e.CSSClasses.timeRange,"minutes"),i=O(t,e.CSSClasses.timeHours,"hours"),r=O(t,e.CSSClasses.timeMinutes,"minutes"),d=t.querySelector(`.${e.CSSClasses.timeKeeping}`);j(s,i,e.CSSClasses.isFocus),j(l,r,e.CSSClasses.isFocus),z(e,s,i,d,"hours",n),z(e,l,r,d,"minutes",0),G(e,s,i,d,"hours",n),G(e,l,r,d,"minutes",59),d&&((e,t,a)=>{t.addEventListener("click",(n=>{e.selectedKeeping=t.innerText.includes("AM")?"PM":"AM",t.innerText=e.selectedKeeping,a.value=K(e.selectedHours,e.selectedKeeping),R(e,n,e.selectedHours,"hours")}))})(e,d,s)},U=(e,t,a,n)=>`<label class="${t}"><input type="text"name="${e}"maxlength="2"value="${a}"${n?"disabled":""}></label>`,J=(e,t,a,n,s,l)=>`<label class="${t}"><input type="range"name="${e}"min="${a}"max="${n}"step="${s}"value="${l}"></label>`,Q=e=>{const t=[...e.locale.weekday];if(!t[0])return;e.settings.iso8601&&t.push(t.shift());e.HTMLElement.querySelectorAll(`.${e.CSSClasses.week}`).forEach((a=>((e,t,a)=>{const n=document.createElement("b");t.innerHTML="";for(let s=0;s<a.length;s++){const l=a[s],i=n.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.append(i)}})(e,a,t)))},X=["light","dark","system"],Z={value:!1,set:()=>{Z.value=!0},check:()=>Z.value},ee=(e,t)=>X.find((a=>{var n;return"system"!==a&&(null==(n=e.getAttribute(t))?void 0:n.includes(a))})),te=(e,t)=>{e.dataset.calendarTheme=t},ae=(e,t)=>{const a=t=>te(e.HTMLElement,t.matches?"dark":"light");a(t),"system"!==e.settings.visibility.theme||Z.check()||(t.addEventListener("change",a),Z.set())},ne=(e,t)=>{const a=e.settings.visibility.themeDetect?document.querySelector(e.settings.visibility.themeDetect):null;if(a){const n=e.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,((e,t)=>t)),s=ee(a,n);s?(te(e.HTMLElement,s),((e,t,a)=>{new MutationObserver((n=>{for(let s=0;s<n.length;s++)if(n[s].attributeName===a){const n=ee(t,a);n&&te(e.HTMLElement,n);break}})).observe(t,{attributes:!0})})(e,a,n)):ae(e,t)}else ae(e,t)},se=e=>{const t={default:()=>{Q(e),H(e)},multiple:()=>{Q(e),H(e)},month:()=>B(e),year:()=>A(e)};(e=>{if(!X.includes(e.settings.visibility.theme))throw new Error(p);let t;if("not all"===window.matchMedia("(prefers-color-scheme)").media)return void te(e.HTMLElement,"light");t=window.matchMedia("(prefers-color-scheme: dark)"),{light:()=>te(e.HTMLElement,"light"),dark:()=>te(e.HTMLElement,"dark"),system:()=>ne(e,t)}[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(S);e.locale.weekday=[],e.locale.months=[];for(let t=0;t<7;t++)P(e,t);for(let t=0;t<12;t++)I(e,t)}})(e),_(e),E(e),w(e),(e=>{const t=e.HTMLElement.querySelector(`.${e.CSSClasses.time}`);if(!t)return;const a=!0===e.settings.selection.time?12:e.settings.selection.time,n="range"===e.settings.selection.controlTime,[s,l]=[0,23],[i,r]=[0,59];t.innerHTML=`<div class="${e.CSSClasses.timeContent}">${U("hours",e.CSSClasses.timeHours,e.selectedHours,n)}${U("minutes",e.CSSClasses.timeMinutes,e.selectedMinutes,n)}${12===a?`<button type="button" class="${e.CSSClasses.timeKeeping}"${n?"disabled":""}>${e.selectedKeeping}</button>`:""}</div><div class="${e.CSSClasses.timeRanges}">${J("hours",e.CSSClasses.timeRange,s,l,e.settings.selection.stepHours,e.selectedKeeping?K(e.selectedHours,e.selectedKeeping):e.selectedHours)}${J("minutes",e.CSSClasses.timeRange,i,r,e.settings.selection.stepMinutes,e.selectedMinutes)}</div>`,V(e,t,a)})(e),t[e.currentType]()},le={self:null,rangeMin:void 0,rangeMax:void 0},ie=()=>{var e;if(!(null==(e=le.self)?void 0:e.HTMLElement))return;const{CSSClasses:t}=le.self;le.self.HTMLElement.querySelectorAll(`.${le.self.CSSClasses.dayBtnHover}`).forEach((e=>{var a;e.classList.remove(le.self.CSSClasses.dayBtnHover),null==(a=e.parentElement)||a.classList.remove(t.dayHoverIntermediate,t.dayHoverFirst,t.dayHoverLast)}))},re=(e,t,a)=>{var n,s,l;if(!(null==(n=le.self)?void 0:n.selectedDates))return;const i=m(e),{CSSClasses:r}=le.self;if(null==(s=le.self.rangeDisabled)?void 0:s.includes(i))return;const d=null==(l=le.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==a||a.forEach((e=>{var t;return null==(t=e.parentElement)?void 0:t.classList.add(r.dayHoverLast)}))},de=e=>{var t;if(!e.target||!(null==(t=le.self)?void 0:t.selectedDates))return;if(!e.target.closest(`.${le.self.CSSClasses.days}`))return void ie();const a=e.target.closest("[data-calendar-day]");if(!a)return;const n=a.dataset.calendarDay,s=g(le.self.selectedDates[0]),l=g(n),i=le.self.HTMLElement.querySelectorAll(`[data-calendar-day="${le.self.selectedDates[0]}"]`),r=le.self.HTMLElement.querySelectorAll(`[data-calendar-day="${n}"]`),[d,o]=s<l?[i,r]:[r,i],[c,u]=s<l?[s,l]:[l,s];ie();for(let e=new Date(c);e<=u;e.setDate(e.getDate()+1))re(e,d,o)},oe=e=>{le.self&&"Escape"===e.key&&(le.self.selectedDates=[],le.self.HTMLElement.removeEventListener("mousemove",de),document.removeEventListener("keydown",oe),se(le.self))},ce=(e,t)=>{var a;if(t){const n=1===e.selectedDates.length&&e.selectedDates[0].includes(t);e.selectedDates=n&&!e.settings.selection.cancelableDay?[t,t]:n&&e.settings.selection.cancelableDay?[]:e.selectedDates.length>1?[t]:[...e.selectedDates,t],null==(a=e.selectedDates)||a.sort(((e,t)=>+new Date(e)-+new Date(t)))}e.settings.range.disableGaps&&(le.rangeMin=le.rangeMin?le.rangeMin:e.rangeMin,le.rangeMax=le.rangeMax?le.rangeMax:e.rangeMax),le.self=e;const n={set:()=>{e.HTMLElement.addEventListener("mousemove",de),document.addEventListener("keydown",oe),e.settings.range.disableGaps&&(()=>{var e,t,a;if(!(null==(t=null==(e=le.self)?void 0:e.selectedDates)?void 0:t[0])||!le.self.rangeDisabled||(null==(a=le.self.rangeDisabled)?void 0:a.length)<2)return;const n=g(le.self.selectedDates[0]),[s,l]=le.self.rangeDisabled.map((e=>g(e))).reduce((([e,t],a)=>[n>=a?a:e,n<a&&null===t?a:t]),[null,null]);s&&(le.self.rangeMin=m(new Date(s.setDate(s.getDate()+1)))),l&&(le.self.rangeMax=m(new Date(l.setDate(l.getDate()-1))))})()},reset:()=>{const[t,a]=[e.selectedDates[0],e.selectedDates[e.selectedDates.length-1]];e.selectedDates=e.selectedDates[0]!==e.selectedDates[e.selectedDates.length-1]?h([`${t}:${a}`]):[e.selectedDates[0],e.selectedDates[0]],e.HTMLElement.removeEventListener("mousemove",de),document.removeEventListener("keydown",oe),e.settings.range.disableGaps&&le.self&&(le.self.rangeMin=le.rangeMin,le.self.rangeMax=le.rangeMax)}};n[1===e.selectedDates.length?"set":"reset"]()},ue=(e,t,a)=>{if(!t.dataset.calendarDay)return;const n=t.dataset.calendarDay,s=t.classList.contains(e.CSSClasses.dayBtnSelected);s&&!e.settings.selection.cancelableDay||(e.selectedDates=s?e.selectedDates.filter((e=>e!==n)):a?[...e.selectedDates,n]:[n])},me=(e,t,a,n,s)=>{const l=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),i=[...l].findIndex((e=>e.classList.contains(t))),r=Number(l[i].querySelector(`.${a}`).getAttribute(s));return"month"===e.currentType&&i>=0?n-i:"year"===e.currentType&&e.selectedYear!==r?n-1:n},ge=(e,t,a,n)=>{if(!e.settings.selection[a])return;const s=t.target,l=e=>s.closest(`.${e}`),i=l(n.header),r=l(n.item),d=l(e.CSSClasses.grid),o=l(e.CSSClasses.column);if(e.currentType!==a&&i){({year:()=>A(e,s),month:()=>B(e,s)})[a]()}else r?((e,t,a,n,s)=>{const l={year:()=>{var a,n;return null==(n=(a=e.actions).clickYear)?void 0:n.call(a,t,e)},month:()=>{var a,n;return null==(n=(a=e.actions).clickMonth)?void 0:n.call(a,t,e)}};({year:()=>{if("multiple"===e.type){const t=me(e,e.CSSClasses.columnYear,e.CSSClasses.year,Number(s.dataset.calendarYear),"data-calendar-selected-year"),a=e.selectedMonth<e.dateMin.getMonth()&&t<=e.dateMin.getFullYear(),n=e.selectedMonth>e.dateMax.getMonth()&&t>=e.dateMax.getFullYear(),l=t<e.dateMin.getFullYear(),i=t>e.dateMax.getFullYear();a||l?(e.selectedYear=e.dateMin.getFullYear(),e.selectedMonth=e.dateMin.getMonth()):n||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=me(e,e.CSSClasses.columnMonth,e.CSSClasses.month,Number(s.dataset.calendarMonth),"data-calendar-selected-month"),a=s.closest(`.${n.column}`).querySelector(`.${e.CSSClasses.year}`);e.selectedYear=Number(a.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)}})[a](),l[a](),e.currentType=e.type,se(e)})(e,t,a,n,r):(e.currentType===a&&i||"multiple"===e.type&&e.currentType===a&&d&&!o)&&(e.currentType=e.type,se(e))},he=e=>{e.HTMLElement.addEventListener("click",(t=>{((e,t)=>{const a=t.target.closest(`.${e.CSSClasses.arrow}`);a&&(["default","multiple"].includes(e.currentType)?k(e,a.dataset.calendarArrow):"year"===e.currentType&&void 0!==e.viewYear&&(e.viewYear+={prev:-15,next:15}[a.dataset.calendarArrow],A(e,t.target)),e.actions.clickArrow&&e.actions.clickArrow(t,e))})(e,t),((e,t)=>{var a;if(!e.settings.visibility.weekNumbers||!e.actions.clickWeekNumber)return;const n=t.target.closest(`.${e.CSSClasses.weekNumber}`),s=null==(a=e.HTMLElement)?void 0:a.querySelectorAll("[data-calendar-week-number]");if(!n||!s)return;const l=Number(n.innerText),i=Number(n.dataset.calendarYearWeek),r=[...s].filter((e=>Number(e.dataset.calendarWeekNumber)===l));e.actions.clickWeekNumber(t,l,r,i,e)})(e,t),((e,t)=>{var a;const n=t.target,s=e=>n.closest(`.${e}`),l=s(e.CSSClasses.dayBtn);if(!e.settings.selection.day||!["single","multiple","multiple-ranged"].includes(e.settings.selection.day)||!l)return;({single:()=>ue(e,l,!1),multiple:()=>ue(e,l,!0),"multiple-ranged":()=>ce(e,l.dataset.calendarDay)})[e.settings.selection.day](),null==(a=e.selectedDates)||a.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,f(e),e);const i=s(e.CSSClasses.dayBtnPrev),r=s(e.CSSClasses.dayBtnNext);({prev:()=>k(e,"prev"),next:()=>k(e,"next"),default:()=>H(e)})[i?"prev":r?"next":"default"]()})(e,t),ge(e,t,"month",{header:e.CSSClasses.month,item:e.CSSClasses.monthsMonth,column:e.CSSClasses.columnMonth}),ge(e,t,"year",{header:e.CSSClasses.year,item:e.CSSClasses.yearsYear,column:e.CSSClasses.columnYear})}))},ve=(e,{year:t,month:a,dates:n,holidays:s,time:i}={})=>{var r;if(!e.isInit)throw new Error(M);const d=l({},e.settings.selected);e.settings.selected.year=t?d.year:e.selectedYear,e.settings.selected.month=a?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"===n&&(null==(r=e.selectedDates)?void 0:r[0])?[e.selectedDates[0]]:!0===n?d.dates:e.selectedDates,C(e),se(e),e.settings.selected=d,"multiple-ranged"===e.settings.selection.day&&n&&ce(e)},ye=(e,t,a)=>{const n={left:0,center:e.offsetWidth/2-t.offsetWidth/2,right:e.offsetWidth-t.offsetWidth};let s=e.offsetHeight,l=n[a];for(let t=e;t;t=t.offsetParent)s+=t.offsetTop||0,l+=t.offsetLeft||0;Object.assign(t.style,{left:`${l}px`,top:`${s}px`})},Me=e=>{let t=!0;e.HTMLInputElement=e.HTMLElement;const a=()=>ye(e.HTMLInputElement,e.HTMLElement,e.settings.visibility.positionToInput),n=t=>{var s;e&&t.target!==e.HTMLInputElement&&!(null==(s=e.HTMLElement)?void 0:s.contains(t.target))&&(e.HTMLInputElement&&e.HTMLElement&&f(e).hide(),window.removeEventListener("resize",a),document.removeEventListener("click",n,{capture:!0}))};e.HTMLInputElement.addEventListener("click",(()=>{t?(()=>{const a=document.createElement("div");a.className=`${e.CSSClasses.calendar} ${e.CSSClasses.calendarToInput} ${e.CSSClasses.calendarHidden}`,e.HTMLElement=a,document.body.append(e.HTMLElement),ye(e.HTMLInputElement,a,e.settings.visibility.positionToInput),t=!1,setTimeout((()=>f(e).show()),0),ve(e),he(e)})():(ye(e.HTMLInputElement,e.HTMLElement,e.settings.visibility.positionToInput),f(e).show()),window.addEventListener("resize",a),document.addEventListener("click",n,{capture:!0})}))};return class extends u{constructor(e,t){if(super(),i(this,"init",(()=>{return(e=this).HTMLOriginalElement=e.HTMLElement.cloneNode(!0),e.isInit=!0,void(e.input?Me(e):(C(e),se(e),he(e)));var e})),i(this,"update",(e=>ve(this,e))),i(this,"destroy",(()=>(e=>{var t,a,n,s;if(!e.isInit)throw new Error(M);e.input?(null==(a=null==(t=e.HTMLElement)?void 0:t.parentElement)||a.removeChild(e.HTMLElement),null==(n=e.HTMLInputElement)||n.replaceWith(e.HTMLOriginalElement),e.HTMLInputElement=void 0):null==(s=e.HTMLElement)||s.replaceWith(e.HTMLOriginalElement),e.HTMLElement=e.HTMLOriginalElement})(this))),this.HTMLElement="string"==typeof e?document.querySelector(e):e,!this.HTMLElement)throw new Error(y(e));if(!t)return;const a=(e,t)=>{Object.keys(t).forEach((n=>{"object"!=typeof e[n]||"object"!=typeof t[n]||t[n]instanceof Date?e[n]=t[n]:a(e[n],t[n])}))};a(this,t)}}}));
!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,a=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,s=(t,a,n)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[a]=n,l=(e,l)=>{for(var i in l||(l={}))a.call(l,i)&&s(e,i,l[i]);if(t)for(var i of t(l))n.call(l,i)&&s(e,i,l[i]);return e},i=(e,t,a)=>(s(e,"symbol"!=typeof t?t+"":t,a),a);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",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,"input",!1),i(this,"type","default"),i(this,"months",2),i(this,"jumpMonths",1),i(this,"date",{min:"1970-01-01",max:"2470-12-31",today:new Date}),i(this,"settings",{lang:"en",iso8601:!0,range:{min:this.date.min,max:this.date.max,disablePast:!1,disableGaps:!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,"actions",{clickDay:null,clickWeekNumber:null,clickMonth:null,clickYear:null,clickArrow:null,changeTime:null,changeToInput:null,getDays:null,hideCalendar:null,showCalendar: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)=>(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 s=g(a),l=g(n),i=new Date(s.getTime());for(;i<=l;i.setDate(i.getDate()+1))e.push(m(i));return t})),e)),[]),y=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):"",v=e=>`${e} is not found, check the first argument passed to new VanillaCalendar.`,M='The calendar has not been initialized, please initialize it using the "init()" method first.',S='You specified "define" for "settings.lang" but did not provide the required values for "locale.weekday" or "locale.months".',p='Incorrect name of theme in "settings.visibility.theme".',C="The value of the time property can be: false, true, 12 or 24.",b=e=>{e.currentType=e.type,(e=>{const t=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=t?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,a,n;e.settings.range.min=g(e.date.min)>=g(e.settings.range.min)?e.date.min:e.settings.range.min,e.settings.range.max=g(e.date.max)<=g(e.settings.range.max)?e.date.max:e.settings.range.max;const s=e.settings.range.disablePast&&!e.settings.range.disableAllDays&&g(e.settings.range.min)<e.date.today;e.rangeMin=s?m(e.date.today):e.settings.range.disableAllDays?m(new Date(e.selectedYear,e.selectedMonth,1)):e.settings.range.min,e.rangeMax=e.settings.range.disableAllDays?m(new Date(e.selectedYear,e.selectedMonth,1)):e.settings.range.max,e.rangeDisabled=e.settings.range.disabled&&!e.settings.range.disableAllDays?h(e.settings.range.disabled):[],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==(a=e.rangeDisabled)?void 0:a[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==(n=e.rangeEnabled)?void 0:n[0])&&e.settings.range.disableAllDays&&(e.rangeMin=e.rangeEnabled[0],e.rangeMax=e.rangeEnabled[e.rangeEnabled.length-1])})(e),(e=>{var t,a;e.selectedDates=(null==(t=e.settings.selected.dates)?void 0:t[0])?h(e.settings.selected.dates):[],e.selectedHolidays=(null==(a=e.settings.selected.holidays)?void 0:a[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 a=!1;if("string"==typeof e.settings.selected.time){const n=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(n,((n,s,l,i)=>(s&&l&&(a=!0,e.selectedHours=s,e.selectedMinutes=l),i&&t?e.selectedKeeping=i:t&&(e.selectedKeeping="AM"),"")))}!a&&t?(e.selectedHours=y(String(e.date.today.getHours())),e.selectedMinutes=String(e.date.today.getMinutes()),e.selectedKeeping=Number(e.date.today.getHours())>=12?"PM":"AM"):a||(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(C)})(e),(e=>{e.correctMonths="multiple"===e.type?1===e.months?2:e.months>12?12:e.months:1})(e)},f=e=>({hide(){e.HTMLElement.classList.add(e.CSSClasses.calendarHidden),e.actions.hideCalendar&&e.actions.hideCalendar(e)},show(){e.HTMLElement.classList.remove(e.CSSClasses.calendarHidden),e.actions.showCalendar&&e.actions.showCalendar(e)},self:e}),D=({arrowPrev:e,arrowNext:t,isPrevHidden:a,isNextHidden:n})=>{e.style.visibility=a?"hidden":"",t.style.visibility=n?"hidden":""},w=e=>{var t,a;if("month"===e.currentType)return;const n=null==(t=e.HTMLElement)?void 0:t.querySelector(`.${e.CSSClasses.arrowPrev}`),s=null==(a=e.HTMLElement)?void 0:a.querySelector(`.${e.CSSClasses.arrowNext}`);if(!n||!s)return;({default:()=>{const t=g(m(new Date(e.selectedYear,e.selectedMonth,1))),a=new Date(t.getTime()),l=new Date(t.getTime());a.setMonth(a.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||a.getFullYear()<e.dateMin.getFullYear()||a.getFullYear()===e.dateMin.getFullYear()&&a.getMonth()<e.dateMin.getMonth(),r=!e.settings.selection.month||l.getFullYear()>e.dateMax.getFullYear()||l.getFullYear()===e.dateMax.getFullYear()&&l.getMonth()>e.dateMax.getMonth();D({arrowPrev:n,arrowNext:s,isPrevHidden:i,isNextHidden:r})},year:()=>{D({arrowPrev:n,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 a=g(e),n=t?a.getDay()||7:a.getDay();a.setDate(a.getDate()+4-n);const s=new Date(a.getFullYear(),0,1),l=Math.ceil(((+a-+s)/864e5+1)/7);return{year:a.getFullYear(),week:l}},$=(e,t,a,n,s)=>{const l=t[a].querySelector(`.${e.CSSClasses.dayBtn}`),i=T(null==l?void 0:l.dataset.calendarDay,e.settings.iso8601);if(!i)return;const r=n.cloneNode(!0);r.innerText=String(i.week),r.dataset.calendarYearWeek=String(i.year),s.append(r)},L=(e,t,a,n,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(n),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.append(o):d.append(o),((e,t,a)=>{var n,s,l,i,r;const d=null==(n=e.settings.range.disableWeekday)?void 0:n.includes(a),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,a,n,s,l,i)=>{var r,d,o;(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)&&(n.classList.add(e.CSSClasses.dayBtnDisabled),n.tabIndex=-1),e.settings.visibility.today&&m(e.date.today)===l&&n.classList.add(e.CSSClasses.dayBtnToday),!e.settings.visibility.weekend||0!==s&&6!==s||n.classList.add(e.CSSClasses.dayBtnWeekend),(null==(d=e.selectedHolidays)?void 0:d.includes(l))&&n.classList.add(e.CSSClasses.dayBtnHoliday),(null==(o=e.selectedDates)?void 0:o.includes(l))&&(n.classList.add(e.CSSClasses.dayBtnSelected),e.selectedDates.length>1&&"multiple-ranged"===e.settings.selection.day&&(e.selectedDates[0]===l&&a.classList.add(e.CSSClasses.daySelectedFirst),e.selectedDates[e.selectedDates.length-1]===l&&a.classList.add(e.CSSClasses.daySelectedLast),e.selectedDates[0]!==l&&e.selectedDates[e.selectedDates.length-1]!==l&&a.classList.add(e.CSSClasses.daySelectedIntermediate)))})(e,t,d,o,s,l,i),a.append(d),e.actions.getDays&&e.actions.getDays(n,l,d,o,e)},H=e=>{const t=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.days}`),a=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.weekNumbers}`),n=new Date(e.selectedYear,e.selectedMonth,1);(e.settings.range.disableAllDays||e.settings.range.disableWeekday)&&e.rangeDisabled[0]&&(e.rangeDisabled=[]),t.forEach(((t,s)=>{const l=new Date(n);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.innerHTML="",((e,t,a,n,s)=>{let l=new Date(a,n,0).getDate()-(s-1);const i=0===n?a-1:a,r=0===n?12:n<10?`0${n}`:n;for(let n=s;n>0;n--,l++){const n=`${i}-${r}-${l}`,s=g(n).getDay();L(e,a,t,l,s,n,!0,e.CSSClasses.dayBtnPrev)}})(e,t,r,i,c),((e,t,a,n,s)=>{for(let l=1;l<=a;l++){const a=new Date(n,s,l),i=m(a),r=a.getDay();L(e,n,t,l,r,i,!1,null)}})(e,t,o,r,i),((e,t,a,n,s,l)=>{const i=l+a,r=7*Math.ceil(i/7)-i,d=s+1===12?n+1:n,o=s+1===12?"01":s+2<10?`0${s+2}`:s+2;for(let a=1;a<=r;a++){const s=`${d}-${o}-${a<10?`0${a}`:String(a)}`,l=g(s).getDay();L(e,n,t,a,l,s,!0,e.CSSClasses.dayBtnNext)}})(e,t,o,r,i,c),((e,t,a,n,s)=>{if(!e.settings.visibility.weekNumbers)return;n.innerHTML="";const l=document.createElement("b");l.className=e.CSSClasses.weekNumbersTitle,l.innerText="#",n.append(l);const i=document.createElement("div");i.className=e.CSSClasses.weekNumbersContent,n.append(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+a)/7);for(let t=0;t<o;t++)$(e,d,0===t?6:7*t,r,i)})(e,c,o,a[s],t),((e,t)=>{var a;e.popups&&(null==(a=Object.entries(e.popups))||a.forEach((([a,n])=>((e,t,a,n)=>{const s=a.querySelector(`[data-calendar-day="${e}"]`);s&&((null==t?void 0:t.modifier)&&s.classList.add(...t.modifier.trim().split(" ")),(null==t?void 0:t.html)&&(s.parentElement.innerHTML+=`<div class="${n}">${t.html}</div>`))})(a,n,t,e.CSSClasses.dayPopup))))})(e,t)}))},E=e=>{var t,a;const n=null==(t=e.HTMLElement)?void 0:t.querySelectorAll("[data-calendar-selected-month]"),s=null==(a=e.HTMLElement)?void 0:a.querySelectorAll("[data-calendar-selected-year]");if(!(null==n?void 0:n[0])&&(null==s?void 0:s[0]))return;const l=new Date(e.selectedYear,e.selectedMonth,1);null==n||n.forEach(((t,a)=>((e,t,a,n)=>{const s=new Date(n.setMonth(e.selectedMonth+a)).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,a,l))),null==s||s.forEach(((t,a)=>((e,t,a,n)=>{const s=new Date(n.setFullYear(e.selectedYear,e.selectedMonth+a)).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,a,l)))},k=(e,t)=>{const a=g(m(new Date(e.selectedYear,e.selectedMonth,1)));({prev:()=>a.setMonth(a.getMonth()-e.jumpMonths),next:()=>a.setMonth(a.getMonth()+e.jumpMonths)})[t](),[e.selectedMonth,e.selectedYear]=[a.getMonth(),a.getFullYear()],E(e),w(e),H(e)},Y=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"})),x=(e,t)=>t.replace(/[\n\t]/g,"").replace(/<#(?!\/?Multiple)(.*?)>/g,((t,a)=>{const n=(s=a.replace(/[/\s\n\t]/g,""),Y[s]);var s;return n?n(e):""})).replace(/[\n\t]/g,""),_=(e,t)=>{const{HTMLElement:a,CSSClasses:n,DOMTemplates:s,type:l,currentType:i,correctMonths:r}=e,d=(s,l)=>{if(!t)return;const i=a.querySelector(`.${n.controls}`);i&&a.removeChild(i);a.querySelector(`.${n.grid}`).classList.add(n.gridDisabled);const r=t.closest(`.${n.column}`);r.classList.add(s),r.innerHTML=x(e,l)},o={default:()=>{a.classList.add(n.calendarDefault),a.classList.remove(n.calendarMonth,n.calendarYear),a.innerHTML=x(e,s.default)},multiple:()=>{r&&(a.classList.add(n.calendarMultiple),a.classList.remove(n.calendarMonth,n.calendarYear),a.innerHTML=((e,t)=>t.replace(/<#Multiple>(.*?)<#\/Multiple>/g,((t,a)=>{let n="";for(let t=0;t<e.correctMonths;t++)n+=a;return n})).replace(/[\n\t]/g,""))(e,x(e,s.multiple)))},month:()=>{"multiple"!==l?(a.classList.add(n.calendarMonth),a.classList.remove(n.calendarDefault,n.calendarYear),a.innerHTML=x(e,s.month)):d(n.columnMonth,s.month)},year:()=>{"multiple"!==l?(a.classList.add(n.calendarYear),a.classList.remove(n.calendarDefault,n.calendarMonth),a.innerHTML=x(e,s.year)):d(n.columnYear,s.year)}};a.classList.add(n.calendar),o[i]()},N=(e,t,a,n,s)=>{const l=t.cloneNode(!1);return l.className=`${e.CSSClasses.yearsYear}${a===s?` ${e.CSSClasses.yearsYearSelected}`:n?` ${e.CSSClasses.yearsYearDisabled}`:""}`,l.dataset.calendarYear=String(s),l.title=String(s),l.innerText=String(s),n&&(l.tabIndex=-1),l},A=(e,t)=>{const a=(null==t?void 0:t.dataset.calendarSelectedYear)?Number(null==t?void 0:t.dataset.calendarSelectedYear):e.selectedYear;e.currentType="year",_(e,t),E(e),w(e);const n=e.HTMLElement.querySelector(`.${e.CSSClasses.years}`);if(!e.settings.selection.year||!n)return;n.classList.add(e.CSSClasses.yearsSelecting);const s="multiple"!==e.type||e.selectedYear===a?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();n.append(N(e,l,a,i,t))}},F=e=>`${e.charAt(0).toUpperCase()}${e.substring(1,e.length)}`.replace(/\./,""),P=(e,t)=>{const a=new Date(`1978-01-0${t+1}T00:00:00.000Z`).toLocaleString(e.settings.lang,{weekday:"short",timeZone:"UTC"});e.locale.weekday.push(F(a))},I=(e,t)=>{const a=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(F(a))},q=e=>{if("multiple"!==e.type)return 0;const t=[...e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`)].findIndex((t=>t.classList.contains(`${e.CSSClasses.columnMonth}`)));return t>0?t:0},W=(e,t,a,n,s,l)=>{const i=t.cloneNode(!1);return i.className=`${e.CSSClasses.monthsMonth}${a===l?` ${e.CSSClasses.monthsMonthSelected}`:s?` ${e.CSSClasses.monthsMonthDisabled}`:""}`,i.title=n,i.innerText=`${e.settings.visibility.monthShort?n.substring(0,3):n}`,i.dataset.calendarMonth=String(l),s&&(i.tabIndex=-1),i},B=(e,t)=>{var a,n;const s=(null==t?void 0:t.dataset.calendarSelectedMonth)?Number(t.dataset.calendarSelectedMonth):e.selectedMonth,l=null==(a=null==t?void 0:t.closest(`.${e.CSSClasses.column}`))?void 0:a.querySelector(`.${e.CSSClasses.year}`),i=l?Number(l.dataset.calendarSelectedYear):e.selectedYear;e.currentType="month",_(e,t),E(e);const r=null==(n=e.HTMLElement)?void 0:n.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,a)=>s-e.jumpMonths*a)).concat(e.locale.months.map(((t,a)=>s+e.jumpMonths*a))).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 a=e.locale.months[t],n=t<e.dateMin.getMonth()+q(e)&&i<=e.dateMin.getFullYear()||t>e.dateMax.getMonth()+q(e)&&i>=e.dateMax.getFullYear()||t!==s&&!d.includes(t);r.append(W(e,o,s,a,n,t))}},K=(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]:"",O=(e,t,a)=>e.querySelector(`.${t}${a?` input[name="${a}"]`:""}`),j=(e,t,a)=>{e.addEventListener("mouseover",(()=>t.classList.add(a))),e.addEventListener("mouseout",(()=>t.classList.remove(a)))},R=(e,t,a,n)=>{({hours:()=>{e.selectedHours=a},minutes:()=>{e.selectedMinutes=a}})[n](),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,f(e),e)},z=(e,t,a,n,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 a.value=d,void R(e,t,d,s);r<l&&r>0?(a.value=d,e.selectedKeeping="AM",n.innerText=e.selectedKeeping,R(e,t,d,s)):(0===r?(e.selectedKeeping="AM",n.innerText="AM"):(e.selectedKeeping="PM",n.innerText="PM"),a.value=y(i.value),R(e,t,y(i.value),s))}))},G=(e,t,a,n,s,l)=>{a.addEventListener("change",(a=>{const i=a.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=K(d,e.selectedKeeping),R(e,a,d,s)):i.value&&r<24&&(r>l||0===r)?(0===r?(e.selectedKeeping="AM",n.innerText="AM"):(e.selectedKeeping="PM",n.innerText="PM"),i.value=y(i.value),t.value=d,R(e,a,y(i.value),s)):i.value=e.selectedHours:i.value&&r<=l&&r>=0?(i.value=d,t.value=d,R(e,a,d,s)):"hours"===s?i.value=e.selectedHours:"minutes"===s&&(i.value=e.selectedMinutes)}))},Z=(e,t,a)=>{const n=24===a?23:a||12,s=O(t,e.CSSClasses.timeRange,"hours"),l=O(t,e.CSSClasses.timeRange,"minutes"),i=O(t,e.CSSClasses.timeHours,"hours"),r=O(t,e.CSSClasses.timeMinutes,"minutes"),d=t.querySelector(`.${e.CSSClasses.timeKeeping}`);j(s,i,e.CSSClasses.isFocus),j(l,r,e.CSSClasses.isFocus),z(e,s,i,d,"hours",n),z(e,l,r,d,"minutes",0),G(e,s,i,d,"hours",n),G(e,l,r,d,"minutes",59),d&&((e,t,a)=>{t.addEventListener("click",(n=>{e.selectedKeeping=t.innerText.includes("AM")?"PM":"AM",t.innerText=e.selectedKeeping,a.value=K(e.selectedHours,e.selectedKeeping),R(e,n,e.selectedHours,"hours")}))})(e,d,s)},U=(e,t,a,n)=>`<label class="${t}"><input type="text"name="${e}"maxlength="2"value="${a}"${n?"disabled":""}></label>`,V=(e,t,a,n,s,l)=>`<label class="${t}"><input type="range"name="${e}"min="${a}"max="${n}"step="${s}"value="${l}"></label>`,J=e=>{const t=[...e.locale.weekday];if(!t[0])return;e.settings.iso8601&&t.push(t.shift());e.HTMLElement.querySelectorAll(`.${e.CSSClasses.week}`).forEach((a=>((e,t,a)=>{const n=document.createElement("b");t.innerHTML="";for(let s=0;s<a.length;s++){const l=a[s],i=n.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.append(i)}})(e,a,t)))},Q=["light","dark","system"],X={value:!1,set:()=>{X.value=!0},check:()=>X.value},ee=(e,t)=>Q.find((a=>{var n;return"system"!==a&&(null==(n=e.getAttribute(t))?void 0:n.includes(a))})),te=(e,t)=>{e.dataset.calendarTheme=t},ae=(e,t)=>{const a=t=>te(e.HTMLElement,t.matches?"dark":"light");a(t),"system"!==e.settings.visibility.theme||X.check()||(t.addEventListener("change",a),X.set())},ne=(e,t)=>{const a=e.settings.visibility.themeDetect?document.querySelector(e.settings.visibility.themeDetect):null;if(a){const n=e.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,((e,t)=>t)),s=ee(a,n);s?(te(e.HTMLElement,s),((e,t,a)=>{new MutationObserver((n=>{for(let s=0;s<n.length;s++)if(n[s].attributeName===a){const n=ee(t,a);n&&te(e.HTMLElement,n);break}})).observe(t,{attributes:!0})})(e,a,n)):ae(e,t)}else ae(e,t)},se=e=>{const t={default:()=>{J(e),H(e)},multiple:()=>{J(e),H(e)},month:()=>B(e),year:()=>A(e)};(e=>{if(!Q.includes(e.settings.visibility.theme))throw new Error(p);let t;if("not all"===window.matchMedia("(prefers-color-scheme)").media)return void te(e.HTMLElement,"light");t=window.matchMedia("(prefers-color-scheme: dark)"),{light:()=>te(e.HTMLElement,"light"),dark:()=>te(e.HTMLElement,"dark"),system:()=>ne(e,t)}[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(S);e.locale.weekday=[],e.locale.months=[];for(let t=0;t<7;t++)P(e,t);for(let t=0;t<12;t++)I(e,t)}})(e),_(e),E(e),w(e),(e=>{const t=e.HTMLElement.querySelector(`.${e.CSSClasses.time}`);if(!t)return;const a=!0===e.settings.selection.time?12:e.settings.selection.time,n="range"===e.settings.selection.controlTime,[s,l]=[0,23],[i,r]=[0,59];t.innerHTML=`<div class="${e.CSSClasses.timeContent}">${U("hours",e.CSSClasses.timeHours,e.selectedHours,n)}${U("minutes",e.CSSClasses.timeMinutes,e.selectedMinutes,n)}${12===a?`<button type="button" class="${e.CSSClasses.timeKeeping}"${n?"disabled":""}>${e.selectedKeeping}</button>`:""}</div><div class="${e.CSSClasses.timeRanges}">${V("hours",e.CSSClasses.timeRange,s,l,e.settings.selection.stepHours,e.selectedKeeping?K(e.selectedHours,e.selectedKeeping):e.selectedHours)}${V("minutes",e.CSSClasses.timeRange,i,r,e.settings.selection.stepMinutes,e.selectedMinutes)}</div>`,Z(e,t,a)})(e),t[e.currentType]()},le={self:null,rangeMin:void 0,rangeMax:void 0},ie=()=>{var e;if(!(null==(e=le.self)?void 0:e.HTMLElement))return;const{CSSClasses:t}=le.self;le.self.HTMLElement.querySelectorAll(`.${le.self.CSSClasses.dayBtnHover}`).forEach((e=>{var a;e.classList.remove(le.self.CSSClasses.dayBtnHover),null==(a=e.parentElement)||a.classList.remove(t.dayHoverIntermediate,t.dayHoverFirst,t.dayHoverLast)}))},re=(e,t,a)=>{var n,s,l;if(!(null==(n=le.self)?void 0:n.selectedDates))return;const i=m(e),{CSSClasses:r}=le.self;if(null==(s=le.self.rangeDisabled)?void 0:s.includes(i))return;const d=null==(l=le.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==a||a.forEach((e=>{var t;return null==(t=e.parentElement)?void 0:t.classList.add(r.dayHoverLast)}))},de=e=>{var t;if(!e.target||!(null==(t=le.self)?void 0:t.selectedDates))return;if(!e.target.closest(`.${le.self.CSSClasses.days}`))return void ie();const a=e.target.closest("[data-calendar-day]");if(!a)return;const n=a.dataset.calendarDay,s=g(le.self.selectedDates[0]),l=g(n),i=le.self.HTMLElement.querySelectorAll(`[data-calendar-day="${le.self.selectedDates[0]}"]`),r=le.self.HTMLElement.querySelectorAll(`[data-calendar-day="${n}"]`),[d,o]=s<l?[i,r]:[r,i],[c,u]=s<l?[s,l]:[l,s];ie();for(let e=new Date(c);e<=u;e.setDate(e.getDate()+1))re(e,d,o)},oe=e=>{le.self&&"Escape"===e.key&&(le.self.selectedDates=[],le.self.HTMLElement.removeEventListener("mousemove",de),document.removeEventListener("keydown",oe),se(le.self))},ce=(e,t)=>{var a;if(t){const n=1===e.selectedDates.length&&e.selectedDates[0].includes(t);e.selectedDates=n&&!e.settings.selection.cancelableDay?[t,t]:n&&e.settings.selection.cancelableDay?[]:e.selectedDates.length>1?[t]:[...e.selectedDates,t],null==(a=e.selectedDates)||a.sort(((e,t)=>+new Date(e)-+new Date(t)))}e.settings.range.disableGaps&&(le.rangeMin=le.rangeMin?le.rangeMin:e.rangeMin,le.rangeMax=le.rangeMax?le.rangeMax:e.rangeMax),le.self=e;const n={set:()=>{e.HTMLElement.addEventListener("mousemove",de),document.addEventListener("keydown",oe),e.settings.range.disableGaps&&(()=>{var e,t,a;if(!(null==(t=null==(e=le.self)?void 0:e.selectedDates)?void 0:t[0])||!le.self.rangeDisabled||(null==(a=le.self.rangeDisabled)?void 0:a.length)<2)return;const n=g(le.self.selectedDates[0]),[s,l]=le.self.rangeDisabled.map((e=>g(e))).reduce((([e,t],a)=>[n>=a?a:e,n<a&&null===t?a:t]),[null,null]);s&&(le.self.rangeMin=m(new Date(s.setDate(s.getDate()+1)))),l&&(le.self.rangeMax=m(new Date(l.setDate(l.getDate()-1))))})()},reset:()=>{const[t,a]=[e.selectedDates[0],e.selectedDates[e.selectedDates.length-1]];e.selectedDates=e.selectedDates[0]!==e.selectedDates[e.selectedDates.length-1]?h([`${t}:${a}`]):[e.selectedDates[0],e.selectedDates[0]],e.HTMLElement.removeEventListener("mousemove",de),document.removeEventListener("keydown",oe),e.settings.range.disableGaps&&le.self&&(le.self.rangeMin=le.rangeMin,le.self.rangeMax=le.rangeMax)}};n[1===e.selectedDates.length?"set":"reset"]()},ue=(e,t,a)=>{if(!t.dataset.calendarDay)return;const n=t.dataset.calendarDay,s=t.classList.contains(e.CSSClasses.dayBtnSelected);s&&!e.settings.selection.cancelableDay||(e.selectedDates=s?e.selectedDates.filter((e=>e!==n)):a?[...e.selectedDates,n]:[n])},me=(e,t,a,n,s)=>{const l=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),i=[...l].findIndex((e=>e.classList.contains(t))),r=Number(l[i].querySelector(`.${a}`).getAttribute(s));return"month"===e.currentType&&i>=0?n-i:"year"===e.currentType&&e.selectedYear!==r?n-1:n},ge=(e,t,a,n)=>{if(!e.settings.selection[a])return;const s=t.target,l=e=>s.closest(`.${e}`),i=l(n.header),r=l(n.item),d=l(e.CSSClasses.grid),o=l(e.CSSClasses.column);if(e.currentType!==a&&i){({year:()=>A(e,s),month:()=>B(e,s)})[a]()}else r?((e,t,a,n,s)=>{const l={year:()=>{var a,n;return null==(n=(a=e.actions).clickYear)?void 0:n.call(a,t,e)},month:()=>{var a,n;return null==(n=(a=e.actions).clickMonth)?void 0:n.call(a,t,e)}};({year:()=>{if("multiple"===e.type){const t=me(e,e.CSSClasses.columnYear,e.CSSClasses.year,Number(s.dataset.calendarYear),"data-calendar-selected-year"),a=e.selectedMonth<e.dateMin.getMonth()&&t<=e.dateMin.getFullYear(),n=e.selectedMonth>e.dateMax.getMonth()&&t>=e.dateMax.getFullYear(),l=t<e.dateMin.getFullYear(),i=t>e.dateMax.getFullYear();a||l?(e.selectedYear=e.dateMin.getFullYear(),e.selectedMonth=e.dateMin.getMonth()):n||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=me(e,e.CSSClasses.columnMonth,e.CSSClasses.month,Number(s.dataset.calendarMonth),"data-calendar-selected-month"),a=s.closest(`.${n.column}`).querySelector(`.${e.CSSClasses.year}`);e.selectedYear=Number(a.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)}})[a](),l[a](),e.currentType=e.type,se(e)})(e,t,a,n,r):(e.currentType===a&&i||"multiple"===e.type&&e.currentType===a&&d&&!o)&&(e.currentType=e.type,se(e))},he=e=>{e.HTMLElement.addEventListener("click",(t=>{((e,t)=>{const a=t.target.closest(`.${e.CSSClasses.arrow}`);a&&(["default","multiple"].includes(e.currentType)?k(e,a.dataset.calendarArrow):"year"===e.currentType&&void 0!==e.viewYear&&(e.viewYear+={prev:-15,next:15}[a.dataset.calendarArrow],A(e,t.target)),e.actions.clickArrow&&e.actions.clickArrow(t,e))})(e,t),((e,t)=>{var a;if(!e.settings.visibility.weekNumbers||!e.actions.clickWeekNumber)return;const n=t.target.closest(`.${e.CSSClasses.weekNumber}`),s=null==(a=e.HTMLElement)?void 0:a.querySelectorAll("[data-calendar-week-number]");if(!n||!s)return;const l=Number(n.innerText),i=Number(n.dataset.calendarYearWeek),r=[...s].filter((e=>Number(e.dataset.calendarWeekNumber)===l));e.actions.clickWeekNumber(t,l,r,i,e)})(e,t),((e,t)=>{var a;const n=t.target,s=e=>n.closest(`.${e}`),l=s(e.CSSClasses.dayBtn);if(!e.settings.selection.day||!["single","multiple","multiple-ranged"].includes(e.settings.selection.day)||!l)return;({single:()=>ue(e,l,!1),multiple:()=>ue(e,l,!0),"multiple-ranged":()=>ce(e,l.dataset.calendarDay)})[e.settings.selection.day](),null==(a=e.selectedDates)||a.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,f(e),e);const i=s(e.CSSClasses.dayBtnPrev),r=s(e.CSSClasses.dayBtnNext);({prev:()=>k(e,"prev"),next:()=>k(e,"next"),default:()=>H(e)})[i?"prev":r?"next":"default"]()})(e,t),ge(e,t,"month",{header:e.CSSClasses.month,item:e.CSSClasses.monthsMonth,column:e.CSSClasses.columnMonth}),ge(e,t,"year",{header:e.CSSClasses.year,item:e.CSSClasses.yearsYear,column:e.CSSClasses.columnYear})}))},ye=(e,{year:t,month:a,dates:n,holidays:s,time:i}={})=>{var r;if(!e.isInit)throw new Error(M);const d=l({},e.settings.selected);e.settings.selected.year=t?d.year:e.selectedYear,e.settings.selected.month=a?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"===n&&(null==(r=e.selectedDates)?void 0:r[0])?[e.selectedDates[0]]:!0===n?d.dates:e.selectedDates,b(e),se(e),e.settings.selected=d,"multiple-ranged"===e.settings.selection.day&&n&&ce(e)},ve=(e,t,a)=>{const n={left:0,center:e.offsetWidth/2-t.offsetWidth/2,right:e.offsetWidth-t.offsetWidth};let s=e.offsetHeight,l=n[a];for(let t=e;t;t=t.offsetParent)s+=t.offsetTop||0,l+=t.offsetLeft||0;Object.assign(t.style,{left:`${l}px`,top:`${s}px`})},Me=e=>{let t=!0;e.HTMLInputElement=e.HTMLElement;const a=()=>ve(e.HTMLInputElement,e.HTMLElement,e.settings.visibility.positionToInput),n=t=>{var s;e&&t.target!==e.HTMLInputElement&&!(null==(s=e.HTMLElement)?void 0:s.contains(t.target))&&(e.HTMLInputElement&&e.HTMLElement&&f(e).hide(),window.removeEventListener("resize",a),document.removeEventListener("click",n,{capture:!0}))};e.HTMLInputElement.addEventListener("click",(()=>{t?(()=>{const a=document.createElement("div");a.className=`${e.CSSClasses.calendar} ${e.CSSClasses.calendarToInput} ${e.CSSClasses.calendarHidden}`,e.HTMLElement=a,document.body.append(e.HTMLElement),ve(e.HTMLInputElement,a,e.settings.visibility.positionToInput),t=!1,setTimeout((()=>f(e).show()),0),ye(e,{year:!0,month:!0,dates:!0,holidays:!0,time:!0}),he(e)})():(ve(e.HTMLInputElement,e.HTMLElement,e.settings.visibility.positionToInput),f(e).show()),window.addEventListener("resize",a),document.addEventListener("click",n,{capture:!0})}))};return class extends u{constructor(e,t){if(super(),i(this,"init",(()=>{return(e=this).HTMLOriginalElement=e.HTMLElement.cloneNode(!0),e.isInit=!0,void(e.input?Me(e):(b(e),se(e),he(e)));var e})),i(this,"update",(e=>ye(this,e))),i(this,"destroy",(()=>(e=>{var t,a,n,s;if(!e.isInit)throw new Error(M);e.input?(null==(a=null==(t=e.HTMLElement)?void 0:t.parentElement)||a.removeChild(e.HTMLElement),null==(n=e.HTMLInputElement)||n.replaceWith(e.HTMLOriginalElement),e.HTMLInputElement=void 0):null==(s=e.HTMLElement)||s.replaceWith(e.HTMLOriginalElement),e.HTMLElement=e.HTMLOriginalElement})(this))),this.HTMLElement="string"==typeof e?document.querySelector(e):e,!this.HTMLElement)throw new Error(v(e));if(!t)return;const a=(e,t)=>{Object.keys(t).forEach((n=>{"object"!=typeof e[n]||"object"!=typeof t[n]||t[n]instanceof Date?e[n]=t[n]:a(e[n],t[n])}))};a(this,t)}}}));
{
"name": "vanilla-calendar-pro",
"version": "2.9.2",
"version": "2.9.3",
"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.",

@@ -5,0 +5,0 @@ "homepage": "https://vanilla-calendar.pro",

@@ -160,3 +160,3 @@ # VanillaCalendar - A Lightweight, Feature-Rich JavaScript Date and Time Picker

For detailed information on the available parameters and settings, please refer to the [API reference](https://vanilla-calendar.pro/docs/reference/).
For detailed information on the available parameters and settings, please refer to the [API reference](https://vanilla-calendar.pro/docs/reference/main/create-an-instance).

@@ -163,0 +163,0 @@ ## Sponsor

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