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 3.0.0-beta.30 to 3.0.0-beta.31

2

index.js

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

/*! name: vanilla-calendar-pro v3.0.0-beta.30 | url: https://github.com/uvarov-frontend/vanilla-calendar-pro */
/*! name: vanilla-calendar-pro v3.0.0-beta.31 | 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).VanillaCalendarPro={})}(this,(function(e){"use strict";var t=Object.defineProperty,a=Object.defineProperties,n=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,s=(e,a,n)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n,o=(e,t)=>{for(var a in t||(t={}))r.call(t,a)&&s(e,a,t[a]);if(i)for(var a of i(t))l.call(t,a)&&s(e,a,t[a]);return e},d=(e,t,a)=>(s(e,"symbol"!=typeof t?t+"":t,a),a);const c=e=>`${e} is not found, check the first argument passed to new VanillaCalendarPro.`,v='The calendar has not been initialized, please initialize it using the "init()" method first.',p="You specified an incorrect language label or did not specify the required number of values ​​for «locale.weekdays» or «locale.months».",u="The value of the time property can be: false, 12 or 24.";function m(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 h(){return{vw:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),vh:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}}function y(e){const{top:t,left:a}={left:window.scrollX||document.documentElement.scrollLeft||0,top:window.scrollY||document.documentElement.scrollTop||0},{top:n,left:i}=m(e),{vh:r,vw:l}=h(),s=n-t,o=i-a;return{top:s,bottom:r-(s+e.clientHeight),left:o,right:l-(o+e.clientWidth)}}function g(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}=y(e),{top:s,left:o}=m(e),{height:d,width:c}=t.getBoundingClientRect(),{vh:v,vw:p}=h(),u=p/2,g=v/2;return[{condition:s<g,position:"top"},{condition:s>g,position:"bottom"},{condition:o<u,position:"left"},{condition:o>u,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 b=(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}=g(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))))},M=e=>new Date(`${e}T00:00:00.000Z`),D=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,f=(e,t,a,n="")=>{t?e.setAttribute(a,n):e.getAttribute(a)===n&&e.removeAttribute(a)},w=(e,t,a,n,i,r,l)=>{var s,o,d,c;const v=M(e.private.displayDateMin)>M(r)||M(e.private.displayDateMax)<M(r)||(null==(s=e.private.disableDates)?void 0:s.includes(r))||!e.selectionMonthsMode&&"current"!==l||!e.selectionYearsMode&&M(r).getFullYear()!==t;if(f(a,v,"data-vc-date-disabled"),n&&f(n,v,"aria-disabled","true"),n&&f(n,v,"tabindex","-1"),f(a,!e.disableToday&&D(e.dateToday)===r,"data-vc-date-today"),f(a,!e.disableToday&&D(e.dateToday)===r,"aria-current","date"),f(a,null==(o=e.selectedWeekends)?void 0:o.includes(i),"data-vc-date-weekend"),f(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&&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&&n.removeAttribute("aria-selected")),!e.private.disableDates.includes(r)&&e.enableEdgeDatesOnly&&e.private.selectedDates.length>1&&"multiple-ranged"===e.selectionDatesMode){const t=M(e.private.selectedDates[0]),n=M(e.private.selectedDates[e.private.selectedDates.length-1]),i=M(r);f(a,i>t&&i<n,"data-vc-date-selected","middle")}},E=(e,t)=>{const a=M(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}},T=(e,t,a,n,i,r)=>{const l=M(i).getDay(),s="string"==typeof e.locale&&e.locale.length?e.locale:"en",o=document.createElement("div");let d;o.className=e.styles.date,o.dataset.vcDate=i,o.dataset.vcDateMonth=r,o.dataset.vcDateWeekDay=String(l),("current"===r||e.displayDatesOutside)&&(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),o.appendChild(d)),e.enableWeekNumbers&&((e,t,a)=>{const n=E(a,e.firstWeekday);n&&(t.dataset.vcDateWeekNumber=String(n.week))})(e,o,i),((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),w(e,t,o,d,l,i,r),a.appendChild(o),e.onCreateDateEls&&e.onCreateDateEls(o,e)},k=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++)T(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);T(e,n,t,r,D(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);T(e,n,t,a,`${o}-${d}-${i}`,"next")}})(e,a,d,s,l,o),b(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=E(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)}))},$=e=>`\n <div class="${e.styles.header}" data-vc="header" role="toolbar" aria-label="${e.labels.navigation}">\n <#ArrowPrev [month] />\n <div class="${e.styles.headerContent}" data-vc-header="content">\n <#Month />\n <#Year />\n </div>\n <#ArrowNext [month] />\n </div>\n <div class="${e.styles.wrapper}" data-vc="wrapper">\n <#WeekNumbers />\n <div class="${e.styles.content}" data-vc="content">\n <#Week />\n <#Dates />\n </div>\n </div>\n <#ControlTime />\n`,A=e=>`\n <div class="${e.styles.header}" data-vc="header" role="toolbar" aria-label="${e.labels.navigation}">\n <div class="${e.styles.headerContent}" data-vc-header="content">\n <#Month />\n <#Year />\n </div>\n </div>\n <div class="${e.styles.wrapper}" data-vc="wrapper">\n <div class="${e.styles.content}" data-vc="content">\n <#Months />\n </div>\n </div>\n`,S=e=>`\n <div class="${e.styles.controls}" data-vc="controls" role="toolbar" aria-label="${e.labels.navigation}">\n <#ArrowPrev [month] />\n <#ArrowNext [month] />\n </div>\n <div class="${e.styles.grid}" data-vc="grid">\n <#Multiple>\n <div class="${e.styles.column}" data-vc="column" role="region">\n <div class="${e.styles.header}" data-vc="header">\n <div class="${e.styles.headerContent}" data-vc-header="content">\n <#Month />\n <#Year />\n </div>\n </div>\n <div class="${e.styles.wrapper}" data-vc="wrapper">\n <#WeekNumbers />\n <div class="${e.styles.content}" data-vc="content">\n <#Week />\n <#Dates />\n </div>\n </div>\n </div>\n <#/Multiple>\n </div>\n <#ControlTime />\n`,x=e=>`\n <div class="${e.styles.header}" data-vc="header" role="toolbar" aria-label="${e.labels.navigation}">\n <#ArrowPrev [year] />\n <div class="${e.styles.headerContent}" data-vc-header="content">\n <#Month />\n <#Year />\n </div>\n <#ArrowNext [year] />\n </div>\n <div class="${e.styles.wrapper}" data-vc="wrapper">\n <div class="${e.styles.content}" data-vc="content">\n <#Years />\n </div>\n </div>\n`,Y=e=>"multiple"===e.viewType?1===e.displayMonthsCount?2:e.displayMonthsCount>12?12:e.displayMonthsCount:1,C={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>`},N=(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=C[i];const l=r?r(e,null!=n?n:null):"";return e.sanitizerHTML(l)})).replace(/[\n\t]/g,""),L=(e,t)=>{const a={default:$,month:A,year:x,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&&Y(e))e.private.mainElement.innerHTML=((e,t)=>t.replace(new RegExp("<#Multiple>(.*?)<#\\/Multiple>","gs"),((t,a)=>{const n=Array(Y(e)).fill(a).join("");return e.sanitizerHTML(n)})).replace(/[\n\t]/g,""))(e,N(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=N(e,e.layouts[e.private.currentType])))}e.private.mainElement.innerHTML=N(e,e.layouts[e.private.currentType])}},W=(e,t,a,n)=>{e.style.visibility=a?"hidden":"",t.style.visibility=n?"hidden":""},H=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=M(D(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();W(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());W(t,a,n,i)})(e,t,a)};n["multiple"===e.private.currentType?"default":e.private.currentType]()},P=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)))))},q=(e,t,a,n,i)=>{var r;const l={month:"[data-vc-months-month]",year:"[data-vc-years-year]"},s={month:{selected:"data-vc-months-month-selected",aria:"aria-selected",value:"vcMonthsMonth",selectedProperty:"selectedMonth"},year:{selected:"data-vc-years-year-selected",aria:"aria-selected",value:"vcYearsYear",selectedProperty:"selectedYear"}};i&&(null==(r=e.private.mainElement.querySelectorAll(l[a]))||r.forEach((e=>{e.removeAttribute(s[a].selected),e.removeAttribute(s[a].aria)})),e.private[s[a].selectedProperty]=Number(t.dataset[s[a].value]),P(e),"year"===a&&H(e)),n&&(t.setAttribute(s[a].selected,""),t.setAttribute(s[a].aria,"true"))},F=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},I=(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}`,r&&(s.ariaDisabled="true"),r&&(s.tabIndex=-1),s.disabled=r,q(e,s,"month",a===l,!1),s},_=(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",L(e,t),P(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()+F(e)&&r<=e.private.dateMin.getFullYear()||t>e.private.dateMax.getMonth()+F(e)&&r>=e.private.dateMax.getFullYear()||t!==l&&!o.includes(t),n=I(e,d,l,e.private.locale.months.short[t],e.private.locale.months.long[t],a,t);s.appendChild(n),e.onCreateMonthEls&&e.onCreateMonthEls(n,e)}null==(n=e.private.mainElement.querySelector("[data-vc-months-month]"))||n.focus()},O=(e,t,a,n,i)=>`\n <label class="${t}" data-vc-time-input="${e}">\n <input type="text" name="${e}" maxlength="2" aria-label="${a[`input${e.charAt(0).toUpperCase()+e.slice(1)}`]}" value="${n}" ${i?"disabled":""}>\n </label>\n`,K=(e,t,a,n,i,r,l)=>`\n <label class="${t}" data-vc-time-range="${e}">\n <input type="range" name="${e}" min="${n}" max="${i}" step="${r}" aria-label="${a[`range${e.charAt(0).toUpperCase()+e.slice(1)}`]}" value="${l}">\n </label>\n`,j=(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)},z=(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)},U=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)),R=(e,t,a,n)=>{e.value=a,t.value=n},Z=(e,t,a,n,i,r,l)=>{const s={hour:(s,o,d)=>{if(!e.selectionTimeMode)return;const c={12:()=>{if(!e.private.selectedKeeping)return;const c=Number(z(o,e.private.selectedKeeping));if(!(c<=r&&c>=l))return R(a,t,e.private.selectedHours,e.private.selectedHours),void(e.onChangeTime&&e.onChangeTime(d,e,!0));R(a,t,U(o),z(o,e.private.selectedKeeping)),s>12&&((e,t,a)=>{t&&a&&(e.private.selectedKeeping=a,t.innerText=a)})(e,n,"PM"),j(e,d,U(o),i)},24:()=>{if(!(s<=r&&s>=l))return R(a,t,e.private.selectedHours,e.private.selectedHours),void(e.onChangeTime&&e.onChangeTime(d,e,!0));R(a,t,o,o),j(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,j(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)}},B=(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;o&&!d&&((e,t,a)=>{t&&(e.private.selectedKeeping=a,t.innerText=a)})(e,n,0===l||c?"AM":"PM"),((e,t,a,n,i)=>{t.value=i,j(e,a,i,n)})(e,a,r,i,!o||d||c?s:U(t.value))};return t.addEventListener("input",r),()=>{t.removeEventListener("input",r)}},G=e=>e.setAttribute("data-vc-input-focus",""),V=e=>e.removeAttribute("data-vc-input-focus"),J=(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&&G(i),e.target===n&&G(r)},o=e=>{e.target===a&&V(i),e.target===n&&V(r)};return t.addEventListener("mouseover",s),t.addEventListener("mouseout",o),Z(e,a,i,l,"hour",e.timeMaxHour,e.timeMinHour),Z(e,n,r,l,"minute",e.timeMaxMinute,e.timeMinMinute),B(e,a,i,l,"hour"),B(e,n,r,l,"minute"),l&&((e,t,a,n,i)=>{const r=r=>{const l="AM"===e.private.selectedKeeping?"PM":"AM",s=z(e.private.selectedHours,l);Number(s)<=n&&Number(s)>=i?(e.private.selectedKeeping=l,a.value=s,j(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)}},X=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)}))}))},Q=(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}`,n&&(r.ariaDisabled="true"),n&&(r.tabIndex=-1),r.disabled=n,q(e,r,"year",a===i,!1),r},ee=(e,t)=>{var a;const n=(null==t?void 0:t.dataset.vcYear)?Number(t.dataset.vcYear):e.private.selectedYear;e.private.currentType="year",L(e,t),P(e),H(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=Q(e,l,n,a,t);i.appendChild(s),e.onCreateYearEls&&e.onCreateYearEls(s,e)}null==(a=e.private.mainElement.querySelector("[data-vc-years-year]"))||a.focus()},te={value:!1,set:()=>te.value=!0,check:()=>te.value},ae=(e,t)=>e.dataset.vcTheme=t,ne=(e,t)=>{if(ae(e.private.mainElement,t.matches?"dark":"light"),"system"!==e.selectedTheme||te.check())return;const a=e=>{const t=document.querySelectorAll('[data-vc="calendar"]');null==t||t.forEach((t=>ae(t,e.matches?"dark":"light")))};t.addEventListener?t.addEventListener("change",a):t.addListener(a),te.set()},ie=(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 ne(e,t);const i=a.getAttribute(n);i?(ae(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&&ae(e.private.mainElement,n);break}})).observe(t,{attributes:!0})})(e,a,n)):ne(e,t)},re=e=>e.charAt(0).toUpperCase()+e.slice(1).replace(/\./,""),le=e=>{var t,a,n,i,r,l,s,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(p);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(re(i)),e.private.locale.weekdays.long.push(re(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(re(i)),e.private.locale.months.long.push(re(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==(s=e.locale)?void 0:s.months)?void 0:d.long[11])))throw new Error(p);e.private.locale=o({},e.locale)}},se=e=>{const t={default:()=>{X(e),k(e)},multiple:()=>{X(e),k(e)},month:()=>_(e),year:()=>ee(e)};(e=>{"not all"!==window.matchMedia("(prefers-color-scheme)").media?"system"===e.selectedTheme?ie(e,window.matchMedia("(prefers-color-scheme: dark)")):ae(e.private.mainElement,e.selectedTheme):ae(e.private.mainElement,"light")})(e),le(e),L(e),P(e),H(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?z(e.private.selectedHours,e.private.selectedKeeping):e.private.selectedHours,s="range"===e.timeControls;var o;t.innerHTML=e.sanitizerHTML(`\n <div class="${e.styles.timeContent}" data-vc-time="content">\n ${O("hour",e.styles.timeHour,e.labels,e.private.selectedHours,s)}\n ${O("minute",e.styles.timeMinute,e.labels,e.private.selectedMinutes,s)}\n ${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>`):""}\n </div>\n <div class="${e.styles.timeRanges}" data-vc-time="ranges">\n ${K("hour",e.styles.timeRange,e.labels,a,n,e.timeStepHour,l)}\n ${K("minute",e.styles.timeRange,e.labels,i,r,e.timeStepMinute,e.private.selectedMinutes)}\n </div>\n `),J(e,t)})(e),t[e.private.currentType]()},oe=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)}},de=(e,t)=>{const a=M(D(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()],P(e),H(e),k(e)},ce=e=>void 0===e.enableDateToggle||("function"==typeof e.enableDateToggle?e.enableDateToggle(e):e.enableDateToggle),ve=(e,t,a)=>{const n=t.dataset.vcDate,i=t.closest("[data-vc-date][data-vc-date-selected]"),r=ce(e);i&&!r||(e.private.selectedDates=i?e.private.selectedDates.filter((e=>e!==n)):a?[...e.private.selectedDates,n]:[n])},pe=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=M(a),r=M(n),l=new Date(i.getTime());for(;l<=r;l.setDate(l.getDate()+1))e.push(D(l));return t}));return e}),[]),ue={self:null,rangeMin:void 0,rangeMax:void 0},me=()=>{var e,t;if(!(null==(t=null==(e=ue.self)?void 0:e.private)?void 0:t.mainElement))return;ue.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)))))},he=(e,t,a)=>{var n,i,r;if(!(null==(i=null==(n=ue.self)?void 0:n.private)?void 0:i.selectedDates))return;const l=D(e);if(null==(r=ue.self.private.disableDates)?void 0:r.includes(l))return;const s=ue.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=""))},ye=e=>{var t,a;if(!e.target||!(null==(a=null==(t=ue.self)?void 0:t.private)?void 0:a.selectedDates))return;if(!e.target.closest('[data-vc="dates"]'))return void me();const n=e.target.closest("[data-vc-date]");if(!n)return;const i=n.dataset.vcDate,r=M(ue.self.private.selectedDates[0]),l=M(i),s=ue.self.private.mainElement.querySelectorAll(`[data-vc-date="${ue.self.private.selectedDates[0]}"]`),o=ue.self.private.mainElement.querySelectorAll(`[data-vc-date="${i}"]`),[d,c]=r<l?[s,o]:[o,s],[v,p]=r<l?[r,l]:[l,r];me();for(let e=new Date(v);e<=p;e.setDate(e.getDate()+1))he(e,d,c)},ge=e=>{ue.self&&"Escape"===e.key&&(ue.self.private.selectedDates=[],ue.self.private.mainElement.removeEventListener("mousemove",ye),document.removeEventListener("keydown",ge),se(ue.self))},be=(e,t)=>{var a;if(t){const n=1===e.private.selectedDates.length&&e.private.selectedDates[0].includes(t);e.private.selectedDates=n&&!ce(e)?[t,t]:n&&ce(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&&(ue.rangeMin=ue.rangeMin?ue.rangeMin:e.private.displayDateMin,ue.rangeMax=ue.rangeMax?ue.rangeMax:e.private.displayDateMax),ue.self=e,me();const n={set:()=>{e.private.mainElement.addEventListener("mousemove",ye),e.private.mainElement.addEventListener("keydown",ge),e.disableDatesGaps&&(()=>{var e,t,a,n;if(!(null==(a=null==(t=null==(e=ue.self)?void 0:e.private)?void 0:t.selectedDates)?void 0:a[0])||!(null==(n=ue.self.private.disableDates)?void 0:n[0]))return;const i=M(ue.self.private.selectedDates[0]),[r,l]=ue.self.private.disableDates.map((e=>M(e))).reduce((([e,t],a)=>[i>=a?a:e,i<a&&null===t?a:t]),[null,null]);r&&(ue.self.private.displayDateMin=D(new Date(r.setDate(r.getDate()+1)))),l&&(ue.self.private.displayDateMax=D(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=pe([`${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",ye),e.private.mainElement.removeEventListener("keydown",ge),e.disableDatesGaps&&ue.self&&(ue.self.private.displayDateMin=ue.rangeMin,ue.self.private.displayDateMax=ue.rangeMax)}};n[1===e.private.selectedDates.length?"set":"reset"]()},Me=e=>{e.private.mainElement.querySelectorAll("[data-vc-date]").forEach((t=>{const a=t.querySelector("[data-vc-date-btn]"),n=t.dataset.vcDate,i=M(n).getDay();w(e,e.private.selectedYear,t,a,i,n,"current")}))},De=["month","year"],fe=(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},we=(e,t,a,n)=>{var i;const r={year:()=>{if("multiple"===e.viewType)return((e,t)=>{const a=fe(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=fe(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?(e.private.currentType=e.viewType,se(e),null==(i=e.private.mainElement.querySelector(`[data-vc="${a}"]`))||i.focus()):q(e,n,a,!0,!0)},Ee=(e,t)=>{const a={month:e.selectionMonthsMode,year:e.selectionYearsMode};De.forEach((n=>{a[n]&&t.target&&((e,t,a)=>{var n;const i=t.target,r=i.closest(`[data-vc="${a}"]`),l={year:()=>ee(e,i),month:()=>_(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 we(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,se(e),null==(n=e.private.mainElement.querySelector(`[data-vc="${a}"]`))||n.focus())})(e,t,n)}))},Te=e=>{const t=t=>{((e,t)=>{const a=t.target.closest("[data-vc-arrow]");a&&(["default","multiple"].includes(e.private.currentType)?de(e,a.dataset.vcArrow):"year"===e.private.currentType&&void 0!==e.private.displayYear&&(e.private.displayYear+={prev:-15,next:15}[a.dataset.vcArrow],ee(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:()=>ve(e,r,!1),multiple:()=>ve(e,r,!0),"multiple-ranged":()=>be(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?de(e,"prev"):Me(e),next:()=>e.enableMonthChangeOnDayClick?de(e,"next"):Me(e),current:()=>Me(e)})[l?"prev":s?"next":"current"]()})(e,t),Ee(e,t)};return e.private.mainElement.addEventListener("click",t),()=>e.private.mainElement.removeEventListener("click",t)},ke=()=>{const e=new Date;return new Date(e.getTime()-6e4*e.getTimezoneOffset()).toISOString().substring(0,10)},$e=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=M(pe(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=ke()),"today"===e.dateMax&&(e.dateMax=ke()),"today"===e.displayDateMin&&(e.displayDateMin=ke()),"today"===e.displayDateMax&&(e.displayDateMax=ke()),e.displayDateMin=e.displayDateMin?M(e.dateMin)>=M(e.displayDateMin)?e.dateMin:e.displayDateMin:e.dateMin,e.displayDateMax=e.displayDateMax?M(e.dateMax)<=M(e.displayDateMax)?e.dateMax:e.displayDateMax:e.dateMax;const i=e.disableDatesPast&&!e.disableAllDates&&M(e.displayDateMin)<e.dateToday;e.private.displayDateMin=i||e.disableAllDates?D(e.dateToday):e.displayDateMin,e.private.displayDateMax=e.disableAllDates?D(e.dateToday):e.displayDateMax,e.private.disableDates=e.disableDates&&!e.disableAllDates?pe(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?pe(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])?pe(e.selectedDates):[]})(e),(e=>{e.private.dateMin=e.displayDisabledDates?M(e.dateMin):M(e.private.displayDateMin),e.private.dateMax=e.displayDisabledDates?M(e.dateMax):M(e.private.displayDateMax)})(e),(e=>{var t,a,n;if(!e.selectionTimeMode)return;if(![12,24].includes(e.selectionTimeMode))throw new Error(u);const i=12===e.selectionTimeMode,r=i?/^(0[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?U(String(e.timeMinHour)):String(e.timeMinHour),s=String(e.timeMinMinute),o=i?Number(U(String(e.timeMinHour)))>=12?"PM":"AM":null),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)},Ae=(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:[]}}),$e(e),se(e),e.selectedYear=s.year,e.selectedMonth=s.month,e.selectedDates=s.dates,e.selectedTime=s.time,"multiple-ranged"===e.selectionDatesMode&&n&&be(e)};const Se=(e,t,a)=>{if(!e)return;const n="auto"===a?function(e,t){const a="left";if(!t||!e)return a;const{canShow:n,parentPositions:i}=g(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}=m(e),d=s+i[r];let c=o+i[l];const{vw:v}=h();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`})},xe=(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((()=>{Se(e.private.inputElement,a,e.positionToInput),e.private.mainElement.style.visibility="visible",e.show()})),Ae(e,{year:!0,month:!0,dates:!0,time:!0,locale:!0}),e.onInit&&e.onInit(e),oe(e),Te(e)},Ye=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=()=>Se(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?(Se(e.private.inputElement,e.private.mainElement,e.positionToInput),e.private.mainElement.style.visibility="visible",e.show()):t.push(xe(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):($e(e),se(e),e.onInit&&e.onInit(e),oe(e),Te(e))),Ce=(e,t)=>{const a=Object.keys(t);for(let n=0;n<a.length;n++){const i=a[n];"object"!=typeof e[i]||"object"!=typeof t[i]||t[i]instanceof Date||Array.isArray(t[i])?void 0!==t[i]&&(e[i]=t[i]):Ce(e[i],t[i])}},Ne={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:"},Le={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 We{constructor(){d(this,"viewType","default"),d(this,"isInput",!1),d(this,"positionToInput","left"),d(this,"firstWeekday",1),d(this,"monthsToSwitch",1),d(this,"themeAttrDetect","html[data-theme]"),d(this,"locale","en"),d(this,"dateToday",new Date),d(this,"dateMin","1970-01-01"),d(this,"dateMax","2470-12-31"),d(this,"displayMonthsCount",2),d(this,"displayDateMin"),d(this,"displayDateMax"),d(this,"displayDatesOutside",!0),d(this,"displayDisabledDates",!1),d(this,"disableDates",[]),d(this,"disableAllDates",!1),d(this,"disableDatesPast",!1),d(this,"disableDatesGaps",!1),d(this,"disableWeekdays",[]),d(this,"disableToday",!1),d(this,"enableDates",[]),d(this,"enableEdgeDatesOnly",!0),d(this,"enableDateToggle",!0),d(this,"enableWeekNumbers",!1),d(this,"enableMonthChangeOnDayClick",!0),d(this,"enableJumpToSelectedDate",!1),d(this,"selectionDatesMode","single"),d(this,"selectionMonthsMode",!0),d(this,"selectionYearsMode",!0),d(this,"selectionTimeMode",!1),d(this,"selectedDates",[]),d(this,"selectedMonth"),d(this,"selectedYear"),d(this,"selectedHolidays",[]),d(this,"selectedWeekends",[0,6]),d(this,"selectedTime"),d(this,"selectedTheme","system"),d(this,"timeMinHour",0),d(this,"timeMaxHour",23),d(this,"timeMinMinute",0),d(this,"timeMaxMinute",59),d(this,"timeControls","all"),d(this,"timeStepHour",1),d(this,"timeStepMinute",1),d(this,"sanitizerHTML",(e=>e)),d(this,"onClickDate"),d(this,"onClickWeekDay"),d(this,"onClickWeekNumber"),d(this,"onClickTitle"),d(this,"onClickMonth"),d(this,"onClickYear"),d(this,"onClickArrow"),d(this,"onChangeTime"),d(this,"onChangeToInput"),d(this,"onCreateDateEls"),d(this,"onCreateMonthEls"),d(this,"onCreateYearEls"),d(this,"onInit"),d(this,"onUpdate"),d(this,"onDestroy"),d(this,"onShow"),d(this,"onHide"),d(this,"popups",{}),d(this,"labels",o({},Ne)),d(this,"layouts",{default:"",multiple:"",month:"",year:""}),d(this,"styles",o({},Le))}}const He=class e extends We{constructor(t,i){var r,l;super(),d(this,"init",(()=>Ye(this))),d(this,"update",(e=>((e,t)=>{if(!e.private.isInit)throw new Error(v);e.isInput&&!e.private.isInputInit&&xe(e,!1),Ae(e,o(o({},{year:!1,month:!1,dates:!1,time:!1,locale:!1}),t)),e.onUpdate&&e.onUpdate(e)})(this,e))),d(this,"destroy",(()=>(e=>{var t,a,n,i,r;if(!e.private.isInit)throw new Error(v);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))),d(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()})),d(this,"hide",(()=>{var e;(e=this).private.currentType&&(e.private.mainElement.dataset.vcCalendarHidden="",e.onHide&&e.onHide(e))})),d(this,"set",((e,t)=>((e,t,a)=>{Ce(e,t),Ae(e,o(o({},{year:!0,month:!0,dates:!0,time:!0,locale:!0}),a))})(this,e,t))),d(this,"private"),this.private=(l=o({},this.private),a(l,n({locale:{months:{short:[],long:[]},weekdays:{short:[],long:[]}}}))),this.private.mainElement="string"==typeof t?null!=(r=e.memoizedElements.get(t))?r:this.queryAndMemoize(t):t,i&&Ce(this,i)}queryAndMemoize(t){const a=document.querySelector(t);if(!a)throw new Error(c(t));return e.memoizedElements.set(t,a),a}};d(He,"memoizedElements",new Map);let Pe=He;e.VanillaCalendarPro=Pe,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
{
"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.30",
"version": "3.0.0-beta.31",
"private": false,

@@ -59,3 +59,3 @@ "homepage": "https://vanilla-calendar.pro",

},
"./dist/*": "./dist/*",
"./styles/*": "./styles/*",
"./package.json": "./package.json"

@@ -62,0 +62,0 @@ },

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

/*! name: vanilla-calendar-pro v3.0.0-beta.30 | url: https://github.com/uvarov-frontend/vanilla-calendar-pro */
/*! name: vanilla-calendar-pro v3.0.0-beta.31 | 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).VanillaCalendarProUtils={})}(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,o,r)=>{const i=t(o),d=t(r),s=new Date(i.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