@mst101/vue-datepicker
Version:
A simple, but powerful, Vue 3 datepicker component. Supports disabling of dates, inline mode, translations & custom slots
1 lines • 64.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Datepicker=t(e.Vue)}(this,(function(e){"use strict";var t=Object.defineProperty,s=Object.defineProperties,i=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,o=(e,s,i)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[s]=i,r=(e,t)=>{for(var s in t||(t={}))n.call(t,s)&&o(e,s,t[s]);if(a)for(var s of a(t))l.call(t,s)&&o(e,s,t[s]);return e},h=(e,t)=>s(e,i(t));const d=new class{constructor(e,t,s,i,a=!1,n=!1,l=""){this.language=e,this.months=t,this.monthsAbbr=s,this.days=i,this.rtl=a,this.ymd=n,this.yearSuffix=l}get language(){return this._language}set language(e){if("string"!=typeof e)throw new TypeError("Language must be a string");this._language=e}get months(){return this._months}set months(e){if(12!==e.length)throw new RangeError(`There must be 12 months for ${this.language} language`);this._months=e}get monthsAbbr(){return this._monthsAbbr}set monthsAbbr(e){if(12!==e.length)throw new RangeError(`There must be 12 abbreviated months for ${this.language} language`);this._monthsAbbr=e}get days(){return this._days}set days(e){if(7!==e.length)throw new RangeError(`There must be 7 days for ${this.language} language`);this._days=e}getDaysStartingOn(e){const t=this._days.slice(e),s=this._days.slice(0,e);return t.concat(s)}getMonthByAbbrName(e){const t=this._monthsAbbr.findIndex((t=>t===e))+1;return t<10?`0${t}`:`${t}`}getMonthByName(e){const t=this._months.findIndex((t=>t===e))+1;return t<10?`0${t}`:`${t}`}}("English",["January","February","March","April","May","June","July","August","September","October","November","December"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]),u=["beforeCalendarHeaderDay","calendarFooterDay","beforeCalendarHeaderMonth","calendarFooterMonth","beforeCalendarHeaderYear","calendarFooterYear","nextIntervalBtn","prevIntervalBtn"];const c={useUtc:!1,getFullYear(e){return this.useUtc?e.getUTCFullYear():e.getFullYear()},getMonth(e){return this.useUtc?e.getUTCMonth():e.getMonth()},getDaysInMonth(e){return this.daysInMonth(this.getFullYear(e),this.getMonth(e))},getDate(e){return this.useUtc?e.getUTCDate():e.getDate()},getDay(e){return this.useUtc?e.getUTCDay():e.getDay()},getHours(e){return this.useUtc?e.getUTCHours():e.getHours()},getMinutes(e){return this.useUtc?e.getUTCMinutes():e.getMinutes()},setFullYear(e,t){return this.useUtc?e.setUTCFullYear(t):e.setFullYear(t)},setMonth(e,t){return this.useUtc?e.setUTCMonth(t):e.setMonth(t)},setDate(e,t){return this.useUtc?e.setUTCDate(t):e.setDate(t)},compareDates(e,t){if(null===e&&null===t)return!0;if(null!==e&&null===t||null!==t&&null===e)return!1;const s=new Date(e.valueOf()),i=new Date(t.valueOf());return this.resetDateTime(s),this.resetDateTime(i),s.valueOf()===i.valueOf()},isValidDate:e=>"[object Date]"===Object.prototype.toString.call(e)&&!Number.isNaN(e.valueOf()),getDayNameAbbr(e,t){if("object"!=typeof e)throw TypeError("Invalid Type");return t[this.getDay(e)]},getDayFromAbbr(e){for(let t=0;t<d.days.length;t+=1)if(e.toLowerCase()===d.days[t].toLowerCase())return t;throw TypeError("Invalid week day")},getMonthName(e,t){if(!t)throw Error("missing 2nd parameter Months array");if("object"==typeof e)return t[this.getMonth(e)];if("number"==typeof e)return t[e];throw TypeError("Invalid type")},getMonthNameAbbr(e,t){if(!t)throw Error("missing 2nd parameter Months array");if("object"==typeof e)return t[this.getMonth(e)];if("number"==typeof e)return t[e];throw TypeError("Invalid type")},daysInMonth:(e,t)=>/8|3|5|10/.test(t.toString())?30:1===t?(e%4||!(e%100))&&e%400?28:29:31,getNthSuffix(e){switch(e){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}},formatDate(e,t,s=d){const i=this.getFullYear(e),a=this.getMonth(e)+1,n=this.getDate(e),l={d:n,dd:`0${n}`.slice(-2),E:this.getDayNameAbbr(e,s.days),o:this.getNthSuffix(this.getDate(e)),M:a,MM:`0${a}`.slice(-2),MMM:this.getMonthNameAbbr(this.getMonth(e),s.monthsAbbr),MMMM:this.getMonthName(this.getMonth(e),s.months),yy:String(i).slice(2),yyyy:i};return t.replace(/y{4}|y{2}|M{1,4}|d{1,2}|o|E/g,(e=>l[e]))},parseDate(e,t,s=d,i=null){if(!e||!t)return e;if(i)return function(e,t,s){if("function"!=typeof s)throw new Error("Parser needs to be a function");if("function"!=typeof t)throw new Error("Format needs to be a function when using a custom parser");return s(e)}(e,t,i);const a=(({dateStr:e,formatStr:t,translation:s,currentYear:i,time:a})=>{const n=t.match(/-|\/|\s|\./)||["-"],l=t.split(n[0]),o=e.split(n[0]),r=[i.toString(),"01","01"];for(let h=0;h<l.length;h+=1)if(/yyyy/i.test(l[h]))r[0]=o[h];else if(/mmmm/i.test(l[h]))r[1]=s.getMonthByName(o[h]);else if(/mmm/i.test(l[h]))r[1]=s.getMonthByAbbrName(o[h]);else if(/mm/i.test(l[h]))r[1]=o[h];else if(/m/i.test(l[h]))r[1]=o[h];else if(/dd/i.test(l[h]))r[2]=o[h];else if(/d/i.test(l[h])){const e=o[h].replace(/st|rd|nd|th/g,"");r[2]=e<10?`0${e}`:`${e}`}return`${r.join("-")}${a}`})({dateStr:e,formatStr:t,translation:s,currentYear:this.getFullYear(new Date),time:this.getTime()}),n=Date.parse(a);return Number.isNaN(n)?e:new Date(n)},parseAsDate(e){if("string"==typeof e||"number"==typeof e){const t=new Date(e);return this.isValidDate(t)?t:null}return this.isValidDate(e)?e:null},getTime(){const e="T00:00:00";return this.useUtc?`${e}Z`:e},resetDateTime(e){return new Date(this.useUtc?e.setUTCHours(0,0,0,0):e.setHours(0,0,0,0))},getNewDateObject(e){return e?this.resetDateTime(new Date(e)):this.resetDateTime(new Date)},getOpenDate(e,t,s){const i=this.parseAsDate(e),a=this.getNewDateObject(i),n=t||a;return this.adjustDateToView(n,s)},adjustDateToView(e,t){const s=this.getNewDateObject(e);if("year"===t){const e=new Date(this.setDate(s,1)),t=this.setMonth(e,0);return new Date(t)}return"month"===t?new Date(this.setDate(s,1)):s}},p=e=>h(r({},c),{useUtc:e}),b={props:{autofocus:{type:Boolean,default:!1},bootstrapStyling:{type:Boolean,default:!1},clearButton:{type:Boolean,default:null},calendarButton:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},format:{type:[String,Function],default:"dd MMM yyyy"},id:{type:String,default:null},inline:{type:Boolean,default:!1},inputClass:{type:[String,Object,Array],default:null},maxlength:{type:[Number,String],default:null},name:{type:String,default:null},openDate:{type:[String,Date,Number],default:null},parser:{type:Function,default:null},pattern:{type:String,default:null},placeholder:{type:String,default:null},refName:{type:String,default:""},required:{type:Boolean,default:!1},showCalendarOnButtonClick:{type:Boolean,default:!1},showCalendarOnFocus:{type:Boolean,default:!1},tabindex:{type:[Number,String],default:null},typeable:{type:Boolean,default:!1},useUtc:{type:Boolean,default:!1}}},g=(e,t)=>{const s=e.__vccOpts||e;for(const[i,a]of t)s[i]=a;return s},m={name:"DateInput",mixins:[b],props:{isOpen:{type:Boolean,default:!1},selectedDate:{type:Date,default:null},slideDuration:{type:Number,default:250},translation:{type:Object,default:()=>({})}},emits:{blur:null,clearDate:null,close:null,focus:null,open:null,selectTypedDate:e=>null===e||e instanceof Date,setFocus:e=>e.every((e=>["calendarButton","input","prev","up","next","tabbableCell"].includes(e))),tab:null,typedDate:e=>null===e||e instanceof Date},data(){return{input:null,isInputFocused:!1,shouldToggleOnFocus:!1,shouldToggleOnClick:!0,typedDate:"",utils:p(this.useUtc)}},computed:{computedInputClass(){return this.bootstrapStyling?"string"==typeof this.inputClass?[this.inputClass,"form-control"].join(" "):r({"form-control":!0},this.inputClass):this.inputClass},formattedValue(){return this.typeable?this.typedDate:this.formatDate(this.selectedDate)}},watch:{showCalendarOnFocus:{immediate:!0,handler(e){e&&(this.shouldToggleOnFocus=!this.isOpen)}},isOpen(e,t){this.$nextTick((()=>{if(e&&this.showCalendarOnFocus){if(t&&!this.isInputFocused)return void(this.shouldToggleOnFocus=!0);this.shouldToggleOnFocus=!1}}))},selectedDate:{immediate:!0,handler(e){this.typeable&&(this.typedDate=this.formatDate(e))}}},mounted(){this.input=this.$el.querySelector("input")},methods:{clearDate(){this.input.value="",this.$emit("clearDate")},formatDate(e){return e?"function"==typeof this.format?this.format(new Date(e)):this.utils.formatDate(new Date(e),this.format,this.translation):""},formatTypedDate(){const e=this.parseInput();this.utils.isValidDate(e)?this.typedDate=this.formatDate(e):(this.input.value="",this.typedDate="")},handleInputBlur(){this.showCalendarOnFocus&&!this.isOpen&&(this.shouldToggleOnFocus=!0),this.typeable&&this.formatTypedDate(),this.isInputFocused=!1},handleButtonFocus(){this.showCalendarOnFocus&&(this.shouldToggleOnFocus=!0)},handleDelete(){!this.typeable&&this.selectedDate&&this.clearDate()},handleInputClick(){this.showCalendarOnButtonClick||this.shouldToggleOnClick&&this.toggle()},handleInputFocus(){this.showCalendarOnButtonClick||(this.isInputFocused=!0,!this.isOpen&&this.shouldToggleOnFocus&&(this.shouldToggleOnClick=!1),this.shouldToggleOnFocus&&!this.isOpen&&(this.$emit("open"),setTimeout((()=>{this.shouldToggleOnClick=!0}),this.slideDuration)))},handleKeydownDown(){this.isOpen||this.$emit("open"),this.typeable&&this.$emit("setFocus",["prev","up","next","tabbableCell"])},handleKeydownEnter(){if(!this.typeable)return;if(!this.input.value)return void this.$emit("selectTypedDate",null);const e=this.parseInput();this.utils.isValidDate(e)&&this.$emit("selectTypedDate",e)},handleKeydownEscape(){this.isOpen&&this.$emit("close")},handleKeydownSpace(e){this.typeable||e.preventDefault()},handleKeyup(e){if(!this.typeable||["Control","Escape","Shift","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key))return;if(this.typedDate=this.input.value,!this.input.value)return void this.$emit("typedDate",null);const t=this.parseInput();this.utils.isValidDate(t)&&this.$emit("typedDate",t)},handleKeyupSpace(e){this.typeable?""===this.input.value&&this.toggle():(e.preventDefault(),this.showCalendarOnButtonClick||this.toggle())},parseInput(){return new Date(this.utils.parseDate(this.input.value.trim(),this.format,this.translation,this.parser))},toggle(e){this.isOpen&&this.$emit("setFocus",[e||"input"]),this.$emit(this.isOpen?"close":"open")}}},f=["disabled"],y=["id","autofocus","clear-button","disabled","maxlength","name","pattern","placeholder","readonly","required","tabindex","type","value"],D=["disabled"];const w=g(m,[["render",function(t,s,i,a,n,l){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"input-group":t.bootstrapStyling})},[e.renderSlot(t.$slots,"beforeDateInput"),t.calendarButton?(e.openBlock(),e.createElementBlock("button",{key:0,ref:"calendarButton",class:e.normalizeClass(["vdp-datepicker__calendar-button",{"btn input-group-prepend":t.bootstrapStyling}]),"data-test-calendar-button":"",disabled:t.disabled,type:"button",onClick:s[0]||(s[0]=e=>l.toggle("calendarButton")),onFocus:s[1]||(s[1]=(...e)=>l.handleButtonFocus&&l.handleButtonFocus(...e))},[e.createElementVNode("span",{class:e.normalizeClass({"input-group-text":t.bootstrapStyling})},[e.renderSlot(t.$slots,"calendarBtn",{},(()=>[e.createTextVNode("…")]))],2)],42,f)):e.createCommentVNode("",!0),e.createElementVNode("input",{id:t.id,ref:t.refName,autocomplete:"off",autofocus:t.autofocus,class:e.normalizeClass(l.computedInputClass),"clear-button":t.clearButton,"data-test-input":"",disabled:t.disabled,maxlength:t.maxlength,name:t.name,pattern:t.pattern,placeholder:t.placeholder,readonly:!t.typeable,required:t.required,tabindex:t.tabindex,type:t.inline?"hidden":null,value:l.formattedValue,onBlur:s[2]||(s[2]=(...e)=>l.handleInputBlur&&l.handleInputBlur(...e)),onClick:s[3]||(s[3]=(...e)=>l.handleInputClick&&l.handleInputClick(...e)),onFocus:s[4]||(s[4]=(...e)=>l.handleInputFocus&&l.handleInputFocus(...e)),onKeydown:[s[5]||(s[5]=e.withKeys(((...e)=>l.handleDelete&&l.handleDelete(...e)),["delete"])),s[6]||(s[6]=e.withKeys(e.withModifiers(((...e)=>l.handleKeydownDown&&l.handleKeydownDown(...e)),["prevent"]),["down"])),s[7]||(s[7]=e.withKeys(e.withModifiers(((...e)=>l.handleKeydownEnter&&l.handleKeydownEnter(...e)),["prevent"]),["enter"])),s[8]||(s[8]=e.withKeys(e.withModifiers(((...e)=>l.handleKeydownEscape&&l.handleKeydownEscape(...e)),["prevent"]),["esc"])),s[9]||(s[9]=e.withKeys((e=>l.handleKeydownSpace(e)),["space"])),s[10]||(s[10]=e.withKeys((e=>t.$emit("tab",e)),["tab"]))],onKeyup:[s[11]||(s[11]=e=>l.handleKeyup(e)),s[12]||(s[12]=e.withKeys((e=>l.handleKeyupSpace(e)),["space"]))]},null,42,y),t.clearButton&&i.selectedDate?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vdp-datepicker__clear-button",{"btn input-group-append":t.bootstrapStyling}]),"data-test-clear-button":"",disabled:t.disabled,type:"button",onClick:s[13]||(s[13]=(...e)=>l.clearDate&&l.clearDate(...e))},[e.createElementVNode("span",{class:e.normalizeClass({"input-group-text":t.bootstrapStyling})},[e.renderSlot(t.$slots,"clearBtn",{},(()=>[e.createTextVNode("×")]))],2)],10,D)):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"afterDateInput")],2)}]]),v={isDefined:(e,t)=>e&&void 0!==e[t],hasArray:(e,t)=>e&&Array.isArray(e[t]),hasDate(e,t){return this.isDefined(e,t)&&this.utils.isValidDate(e[t])},dayMonthYear(e,t){const{utils:s}=this;if(!this.hasDate(e,t))return{day:void 0,month:void 0,year:void 0};const i=e[t];return{day:s.getDate(i),month:s.getMonth(i),year:s.getFullYear(i)}}},C=e=>h(r({},v),{utils:e});class F{constructor(e,t){this._utils=e,this._disabledDates=t}get config(){const e=this._disabledDates,t=C(this._utils),s={customPredictor:t.isDefined(e,"customPredictor"),daysOfMonth:t.hasArray(e,"daysOfMonth"),daysOfWeek:t.hasArray(e,"days"),from:t.hasDate(e,"from"),ranges:t.hasArray(e,"ranges"),specificDates:t.hasArray(e,"dates"),to:t.hasDate(e,"to")};return{to:t.dayMonthYear(e,"to"),from:t.dayMonthYear(e,"from"),has:s}}daysInMonth(e){const t=this._utils,s=t.getMonth(e),i=t.getFullYear(e);return t.daysInMonth(i,s)}isDateDisabledVia(e){const t=this._disabledDates,{has:s}=this.config;return{to:()=>s.to&&e<=t.to,from:()=>s.from&&e>=t.from,range:()=>{if(!s.ranges)return!1;const{ranges:i}=t,a=C(this._utils);return i.some((t=>{const s=a.isDefined(t,"from"),i=a.isDefined(t,"to");return s&&i&&e<=t.to&&e>=t.from}))},customPredictor:()=>s.customPredictor&&t.customPredictor(e),specificDate:()=>!!s.specificDates&&t.dates.some((t=>this._utils.compareDates(e,t))),daysOfWeek:()=>!!s.daysOfWeek&&-1!==t.days.indexOf(this._utils.getDay(e)),daysOfMonth:()=>!!s.daysOfMonth&&-1!==t.daysOfMonth.indexOf(this._utils.getDate(e))}}isMonthDisabledVia(e){const{from:t,has:s,to:i}=this.config,a=this._utils.getMonth(e),n=this._utils.getFullYear(e);return{to:()=>!!(s.to&&n<i.year)||s.to&&a<i.month&&n<=i.year,from:()=>!!(s.from&&n>t.year)||s.from&&a>t.month&&n>=t.year}}isYearDisabledVia(e){const{from:t,has:s,to:i}=this.config,a=this._utils.getFullYear(e);return{to:()=>s.to&&a<i.year,from:()=>s.from&&a>t.year}}isDateDisabled(e){const t=this.isDateDisabledVia(e);return t.to()||t.from()||t.range()||t.specificDate()||t.daysOfWeek()||t.daysOfMonth()||t.customPredictor()}isMonthDisabled(e){const t=this.isMonthDisabledVia(e);if(t.to()||t.from())return!0;for(let s=1;s<=this.daysInMonth(e);s+=1){const t=new Date(e);if(t.setDate(s),!this.isDateDisabled(t))return!1}return!0}isYearDisabled(e){const t=this.isYearDisabledVia(e);if(t.to()||t.from())return!0;for(let s=0;s<12;s+=1){const t=new Date(e);if(t.setMonth(s),!this.isMonthDisabled(t))return!1}return!0}getEarliestPossibleDate(e){if(!e)return null;const t=this._utils;if(this.isDateDisabled(e)){const s=new Date(t.getFullYear(e),t.getMonth(e),t.getDate(e)+1);return this.getEarliestPossibleDate(s)}return e}getLatestPossibleDate(e){if(!e)return null;const t=this._utils;if(this.isDateDisabled(e)){const s=new Date(t.getFullYear(e),t.getMonth(e),t.getDate(e)-1);return this.getLatestPossibleDate(s)}return e}}const k={data:()=>({focus:{delay:0,refs:[]},inlineTabbableCell:null,isActive:!1,isRevertingToOpenDate:!1,navElements:[],navElementsFocusedIndex:0,resetTabbableCell:!1,skipReviewFocus:!1,tabbableCell:null,transitionName:""}),computed:{fallbackElementsToFocus(){const e=["tabbableCell","prev","next"];return this.typeable&&e.unshift("input"),e},focusedDateTimestamp(){const e=new Date(this.pageTimestamp);if(this.hasClass(this.tabbableCell,"day"))return this.utils.setDate(e,this.tabbableCell.innerHTML.trim());if(this.hasClass(this.tabbableCell,"month"))return this.utils.setMonth(e,this.tabbableCellId);const t=this.utils.getFullYear(e)-1;return this.utils.setFullYear(e,t+this.tabbableCellId)},tabbableCellId(){return this.tabbableCell&&Number(this.tabbableCell.getAttribute("data-id"))}},methods:{getCellDate(e){switch(this.view){case"month":return new Date(this.utils.setDate(e,1));case"year":return new Date(this.utils.setMonth(new Date(this.utils.setDate(e,1)),0));default:return e}},allowNormalTabbing(e){return!this.isOpen||this.isTabbingAwayFromInlineDatepicker(e)},applyFocus(){const e=[...this.focus.refs,...this.fallbackElementsToFocus];for(let t=0;t<e.length;t+=1){const s=this.getElementByRef(e[t]);if(s&&null===s.getAttribute("disabled")){s.focus(),this.setNavElementsFocusedIndex();break}}},focusInlineTabbableCell(){this.inlineTabbableCell?this.inlineTabbableCell.focus():(this.resetTabbableCell=!0,this.setTabbableCell(),this.tabbableCell.focus(),this.resetTabbableCell=!1)},getActiveCell(){const e=this.getActiveElement(),t=this.hasClass(e,"cell"),s=this.hasClass(e,this.view);return t&&s&&!this.resetTabbableCell?e:null},getActiveElement:()=>document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement,getCellId(e){if(!e||!this.$refs.picker.$refs.cells)return null;const t=this.getCellDate(e),{cells:s}=this.$refs.picker.$refs.cells;for(let i=0;i<s.length;i+=1)if(s[i].timestamp===t.valueOf())return i;return null},getElementByRef(e){return"tabbableCell"===e?this.tabbableCell:"input"===e?this.$refs.dateInput&&this.$refs.dateInput.$refs[this.refName]:"calendarButton"===e?this.$refs.dateInput&&this.$refs.dateInput.$refs.calendarButton:"openDate"===e?this.$refs.picker.$refs.cells.$refs.openDate[0]:this.showHeader?this.$refs.picker&&this.$refs.picker.$refs.pickerHeader&&this.$refs.picker.$refs.pickerHeader.$refs[e]:null},getElementsFromCalendarFooter(){const e=this.hasSlot("beforeCalendarHeader")?2:1;return this.getFocusableElements(this.$refs.view.children[e])},getElementsFromSlot(e){if(!this.hasSlot(e))return[];if("beforeCalendarHeader"===e)return this.getFocusableElements(this.$refs.view.children[0]);if("calendarFooter"===e)return this.getElementsFromCalendarFooter();const t=e.indexOf("beforeCalendarHeader")>-1,s=this.$refs.picker.$el,i=t?0:s.children.length-1;return this.getFocusableElements(s.children[i])},getElementsFromHeader(){if(!this.$refs.picker.$refs.pickerHeader)return[];const e=this.$refs.picker.$refs.pickerHeader.$el.querySelectorAll("button:enabled");return[...Array.prototype.slice.call(e)]},getFocusableElements(e){if(!e)return[];const t=e.querySelectorAll('button:enabled:not([tabindex="-1"]), [href]:not([tabindex="-1"]), input:not([tabindex="-1"]):not([type=hidden]), select:enabled:not([tabindex="-1"]), textarea:enabled:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])');return[...Array.prototype.slice.call(t)]},getFirstInlineFocusableElement(){return this.getFocusableElements(this.$refs.popup.$el)[0]},getLastInlineFocusableElement(){const e=this.getFocusableElements(this.$refs.popup.$el);return e[e.length-1]},getInputField(){return!this.typeable||this.inline?null:this.$refs.dateInput.$refs[this.refName]},getTypedCell(){if(!this.typeable)return null;const e=this.getCellId(this.latestValidTypedDate);return e?this.$refs.picker.$refs.cells.$el.children[e]:null},handleFocusIn(){document.datepickerId=this.datepickerId,this.globalDatepickerId=this.datepickerId,this.isActive=!0,this.setInlineTabbableCell(),this.setNavElements()},handleFocusOut(){this.isActive=!1,this.globalDatepickerId=""},hasSlot(e){return!!this.$slots[e]},isTabbingAwayFromInlineDatepicker(e){return!!this.inline&&(this.isTabbingAwayFromFirstNavElement(e)?(this.tabAwayFromFirstElement(),!0):!!this.isTabbingAwayFromLastNavElement(e)&&(this.tabAwayFromLastElement(),!0))},isTabbingAwayFromFirstNavElement(e){if(!e.shiftKey)return!1;return this.getActiveElement()===this.navElements[0]},isTabbingAwayFromLastNavElement(e){if(e.shiftKey)return!1;return this.getActiveElement()===this.navElements[this.navElements.length-1]},resetFocusToOpenDate(e){this.focus.refs=["openDate"],this.setTransitionAndFocusDelay(e,this.computedOpenDate),this.isMinimumView||(this.isRevertingToOpenDate=!0,this.view=this.minimumView),this.setPageDate(this.computedOpenDate),this.reviewFocus()},reviewFocus(){this.skipReviewFocus||(this.tabbableCell=null,this.resetTabbableCell=!0,this.$nextTick((()=>{this.setNavElements(),setTimeout((()=>{this.applyFocus()}),this.focus.delay),this.resetTabbableCell=!1})))},setInlineTabbableCell(){this.inline&&(this.inlineTabbableCell=this.tabbableCell)},setTransitionAndFocusDelay(e,t){const s=this.utils.setDate(new Date(e),1)<this.utils.setDate(new Date(t),1);this.isMinimumView?this.focus.delay=s?this.slideDuration:0:this.focus.delay=0,this.setTransitionName(t-e)},setFocus(e){this.focus.refs=e,this.applyFocus()},setNavElements(){if(!this.view)return;this.updateTabbableCell();const e=this.ucFirst(this.view);this.navElements=[this.getInputField(),this.getElementsFromSlot("beforeCalendarHeader"),this.getElementsFromSlot(`beforeCalendarHeader${e}`),this.getElementsFromHeader(),this.tabbableCell,this.getElementsFromSlot(`calendarFooter${e}`),this.getElementsFromSlot("calendarFooter")].filter((e=>!!e)).reduce(((e,t)=>e.concat(t)),[])},setNavElementsFocusedIndex(){const e=this.getActiveElement();for(let t=0;t<this.navElements.length;t+=1)if(e===this.navElements[t])return void(this.navElementsFocusedIndex=t);this.navElementsFocusedIndex=0},setTabbableCell(){if(!this.$refs.picker||!this.$refs.picker.$refs.cells)return;const e=this.$refs.picker.$refs.cells.$el;this.tabbableCell=this.getActiveCell()||this.getTypedCell()||e.querySelector("button.selected:not(.muted):enabled")||e.querySelector("button.open:not(.muted):enabled")||e.querySelector("button.today:not(.muted):enabled")||e.querySelector("button.cell:not(.muted):enabled")},setTransitionName(e){const t=e>0;this.isRtl?this.transitionName=t?"slide-left":"slide-right":this.transitionName=t?"slide-right":"slide-left"},tabAwayFromFirstElement(){const e=this.getFirstInlineFocusableElement();this.setInlineTabbableCell(),e.focus(),this.tabbableCell=this.inlineTabbableCell},tabAwayFromLastElement(){const e=this.getLastInlineFocusableElement();this.setInlineTabbableCell(),e.focus(),this.tabbableCell=this.inlineTabbableCell},tabBackwards(){this.navElementsFocusedIndex-=1,this.navElementsFocusedIndex<0&&(this.navElementsFocusedIndex=this.navElements.length-1),this.navElements[this.navElementsFocusedIndex].focus()},tabForwards(){this.navElementsFocusedIndex+=1,this.navElementsFocusedIndex>=this.navElements.length&&(this.navElementsFocusedIndex=0),this.navElements[this.navElementsFocusedIndex].focus()},tabThroughNavigation(e){this.allowNormalTabbing(e)||(e.preventDefault(),e.shiftKey?this.tabBackwards():this.tabForwards())},tabToCorrectInlineCell(){const e=this.getLastInlineFocusableElement(),t=this.hasClass(e,"cell"),s=this.getActiveElement();t&&s===e?this.focusInlineTabbableCell():this.$nextTick((()=>{"0"===s.getAttribute("data-id")&&this.focusInlineTabbableCell()}))},updateTabbableCell(){const e=this.getActiveElement(),t=this.hasClass(e,"cell");(!this.tabbableCell||t)&&this.setTabbableCell()}}},T={name:"PickerHeader",props:{bootstrapStyling:{type:Boolean,default:!1},isNextDisabled:{type:Boolean,required:!0},isPreviousDisabled:{type:Boolean,required:!0},isRtl:{type:Boolean,required:!0},isUpDisabled:{type:Boolean,default:!1},nextViewUp:{type:String,default:null}},emits:{focusInput:null,pageChange:e=>"object"==typeof e,setFocus:e=>e.every((e=>["input","prev","up","next","tabbableCell"].includes(e))),setView:e=>["day","month","year"].includes(e)},data:()=>({previousPage:{incrementBy:-1,focusRefs:["prev"]},nextPage:{incrementBy:1,focusRefs:["next"]}}),computed:{leftButton(){return[this.isRtl?"next":"prev"]},rightButton(){return[this.isRtl?"prev":"next"]}},methods:{arrowLeftPrev(){this.isRtl?this.$emit("setFocus",["up","next","tabbableCell"]):this.goToPreviousPage()},arrowRightPrev(){this.isRtl?this.goToPreviousPage():this.$emit("setFocus",["up","next","tabbableCell"])},arrowLeftNext(){this.isRtl?this.goToNextPage():this.$emit("setFocus",["up","prev","tabbableCell"])},arrowRightNext(){this.isRtl?this.$emit("setFocus",["up","prev","tabbableCell"]):this.goToNextPage()},focusInput(){this.$emit("focusInput")},focusTabbableCell(){this.$emit("setFocus",["tabbableCell"])},focusLeftButton(){this.$emit("setFocus",this.leftButton)},focusRightButton(){this.$emit("setFocus",this.rightButton)},goToNextPage(){this.$emit("pageChange",{incrementBy:1,focusRefs:["next"]})},goToPreviousPage(){this.$emit("pageChange",{incrementBy:-1,focusRefs:["prev"]})},selectUpButton(){this.isUpDisabled||this.$emit("setView",this.nextViewUp)}}},O=["disabled"],M=e.createElementVNode("span",{class:"default"},"<",-1),S=["disabled"],$=["disabled"],x=e.createElementVNode("span",{class:"default"},">",-1);const I={components:{PickerHeader:g(T,[["render",function(t,s,i,a,n,l){return e.openBlock(),e.createElementBlock("header",null,[e.createElementVNode("button",{ref:"prev",class:e.normalizeClass(["prev",{btn:i.bootstrapStyling,rtl:i.isRtl}]),"data-test-previous-button":"",disabled:i.isPreviousDisabled,type:"button",onClick:s[0]||(s[0]=e.withModifiers(((...e)=>l.goToPreviousPage&&l.goToPreviousPage(...e)),["stop"])),onKeydown:[s[1]||(s[1]=e.withKeys(e.withModifiers(((...e)=>l.focusTabbableCell&&l.focusTabbableCell(...e)),["prevent"]),["down"])),s[2]||(s[2]=e.withKeys(e.withModifiers(((...e)=>l.focusInput&&l.focusInput(...e)),["prevent"]),["up"])),s[3]||(s[3]=e.withKeys(e.withModifiers(((...e)=>l.arrowLeftPrev&&l.arrowLeftPrev(...e)),["prevent"]),["left"])),s[4]||(s[4]=e.withKeys(e.withModifiers(((...e)=>l.arrowRightPrev&&l.arrowRightPrev(...e)),["prevent"]),["right"]))]},[e.renderSlot(t.$slots,"prevIntervalBtn",{},(()=>[M]))],42,O),e.createElementVNode("button",{ref:"up",class:e.normalizeClass(["vdp-datepicker__up",{btn:i.bootstrapStyling}]),"data-test-up-button":"",disabled:i.isUpDisabled,type:"button",onClick:s[5]||(s[5]=(...e)=>l.selectUpButton&&l.selectUpButton(...e)),onKeydown:[s[6]||(s[6]=e.withKeys(e.withModifiers(((...e)=>l.focusTabbableCell&&l.focusTabbableCell(...e)),["prevent"]),["down"])),s[7]||(s[7]=e.withKeys(e.withModifiers(((...e)=>l.focusInput&&l.focusInput(...e)),["prevent"]),["up"])),s[8]||(s[8]=e.withKeys(e.withModifiers(((...e)=>l.focusLeftButton&&l.focusLeftButton(...e)),["prevent"]),["left"])),s[9]||(s[9]=e.withKeys(e.withModifiers(((...e)=>l.focusRightButton&&l.focusRightButton(...e)),["prevent"]),["right"]))]},[e.renderSlot(t.$slots,"default")],42,S),e.createElementVNode("button",{ref:"next",class:e.normalizeClass(["next",{btn:i.bootstrapStyling,rtl:i.isRtl}]),"data-test-next-button":"",disabled:i.isNextDisabled,type:"button",onClick:s[10]||(s[10]=e.withModifiers(((...e)=>l.goToNextPage&&l.goToNextPage(...e)),["stop"])),onKeydown:[s[11]||(s[11]=e.withKeys(e.withModifiers(((...e)=>l.focusTabbableCell&&l.focusTabbableCell(...e)),["prevent"]),["down"])),s[12]||(s[12]=e.withKeys(e.withModifiers(((...e)=>l.focusInput&&l.focusInput(...e)),["prevent"]),["up"])),s[13]||(s[13]=e.withKeys(e.withModifiers(((...e)=>l.arrowLeftNext&&l.arrowLeftNext(...e)),["prevent"]),["left"])),s[14]||(s[14]=e.withKeys(e.withModifiers(((...e)=>l.arrowRightNext&&l.arrowRightNext(...e)),["prevent"]),["right"]))]},[e.renderSlot(t.$slots,"nextIntervalBtn",{},(()=>[x]))],42,$)])}]])},props:{bootstrapStyling:{type:Boolean,default:!1},disabledDates:{type:Object,default:null},isRtl:{type:Boolean,default:!1},isTypeable:{type:Boolean,default:!1},isUpDisabled:{type:Boolean,default:!1},isMinimumView:{type:Boolean,default:!0},openDate:{type:[String,Date,Number],default:null},pageDate:{type:Date,default:null},selectedDate:{type:Date,default:null},showHeader:{type:Boolean,default:!0},slideDuration:{type:Number,default:250},tabbableCellId:{type:Number,default:null},transitionName:{type:String,default:""},translation:{type:Object,default:()=>({})},useUtc:{type:Boolean,default:!1},view:{type:String,default:"day"}},emits:{pageChange:e=>"object"==typeof e,select:e=>"object"==typeof e,setFocus:e=>e===["input"],setSkipReviewFocus:e=>"boolean"==typeof e,setTransitionName:e=>-1===e||1===e},data(){return{utils:p(this.useUtc)}},computed:{disabledConfig(){return this.disabledDates?new F(this.utils,this.disabledDates).config:{has:{from:!1,to:!1}}},earliestPossibleDate(){return this.disabledDates?new F(this.utils,this.disabledDates).getEarliestPossibleDate(this.disabledDates.to):null},latestPossibleDate(){return this.disabledDates?new F(this.utils,this.disabledDates).getLatestPossibleDate(this.disabledDates.from):null},pageYear(){return this.utils.getFullYear(this.pageDate)}},methods:{addMoreSteps:e=>e.stepsRemaining<=0&&Math.abs(e.delta)>1?Math.abs(e.delta):e.stepsRemaining,changePage({incrementBy:e,focusRefs:t}){const{pageDate:s,utils:i}=this,a="year"===this.view?e*this.yearRange:e;this.$emit("setTransitionName",e),"day"===this.view?i.setMonth(s,i.getMonth(s)+a):i.setFullYear(s,i.getFullYear(s)+a),this.$emit("pageChange",{focusRefs:t,pageDate:s})},changePageAndSetFocus(e){const{delta:t}=e;t>0&&this.isNextDisabled||t<0&&this.isPreviousDisabled||(this.$emit("setSkipReviewFocus",!0),this.changePage({incrementBy:Math.sign(t),focusRefs:["arrow-to-cell"]}),this.$nextTick((()=>{this.setFocusOnNewPage(e),this.$emit("setSkipReviewFocus",!1)})))},focusInput(){this.isTypeable&&this.$emit("setFocus",["input"])},getElement({currentElement:e,delta:t,stepsRemaining:s}){const i=this.getElementSibling(e,t),a={currentElement:i,delta:t,stepsRemaining:s-1};return i?this.isBeyondPossibleDate(a)?this.firstOrLastPossibleDate(a):this.isMutedOrDisabled(i)?(a.stepsRemaining=this.addMoreSteps(a),this.getElement(a)):s>1&&a.currentElement?this.getElement(a):i:this.changePageAndSetFocus(a)},getElementSibling:(e,t)=>t>0?e.nextElementSibling:e.previousElementSibling,getFirstOrLastElement(e){const t=e>0,s=this.$refs.cells.$el.children;return t?s[0]:s[s.length-1]},firstOrLastPossibleDate({currentElement:e,delta:t}){return t>0?this.getElementSibling(e,-1):this.getElementSibling(e,1)},handleArrow({delta:e}){const t={currentElement:document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement,delta:e,stepsRemaining:Math.abs(e)};this.setFocusToAvailableCell(t)},select(e){e.isPreviousMonth&&this.$emit("setTransitionName",-1),e.isNextMonth&&this.$emit("setTransitionName",1),this.$emit("select",e)},isBeyondPossibleDate({currentElement:e,delta:t}){return(t>0&&this.latestPossibleDate||!!(t<0&&this.earliestPossibleDate))&&this.isDatePossible(e,t)},isDatePossible(e,t){const s=e.getAttribute("data-id"),i=new Date(this.cells[s].timestamp);return t>0?i>this.utils.adjustDateToView(this.latestPossibleDate,this.view):i<this.utils.adjustDateToView(this.earliestPossibleDate,this.view)},isMutedOrDisabled(e){const t=e.classList.value.split(" ").includes("muted"),s=e.disabled;return t||s},setFocusOnNewPage({delta:e,stepsRemaining:t}){const s=this.getFirstOrLastElement(e),i={currentElement:s,delta:e,stepsRemaining:t},a=this.slideDuration;if(t<=0)return this.isMutedOrDisabled(s)?(i.stepsRemaining=Math.abs(i.delta),void setTimeout((()=>{this.setFocusToAvailableCell(i)}),a)):void setTimeout((()=>{s.focus()}),a);setTimeout((()=>{this.setFocusToAvailableCell(i)}),a)},setFocusToAvailableCell(e){const t=this.getElement(e);t&&t.focus()}}};class B{constructor(e,t,s){this._utils=e,this._disabledDates=t,this._highlighted=s}get config(){const e=this._highlighted,t=C(this._utils),s={customPredictor:t.isDefined(e,"customPredictor"),daysOfMonth:t.hasArray(e,"daysOfMonth"),daysOfWeek:t.hasArray(e,"days"),from:t.hasDate(e,"from"),ranges:t.hasArray(e,"ranges"),specificDates:t.hasArray(e,"dates"),to:t.hasDate(e,"to"),includeDisabled:t.isDefined(e,"includeDisabled")&&e.includeDisabled};return{to:t.dayMonthYear(e,"to"),from:t.dayMonthYear(e,"from"),has:s}}isDateDisabled(e){const t=this._utils,s=this._disabledDates;return new F(t,s).isDateDisabled(e)}isHighlightingNotPossible(e){return!this.config.has.includeDisabled&&this.isDateDisabled(e)}isDateHighlightedVia(e){const t=this._highlighted,{has:s}=this.config;return{to:()=>s.to&&e<=t.to,from:()=>s.from&&e>=t.from,range:()=>{if(!s.ranges)return!1;const{ranges:i}=t,a=C(this._utils);return i.some((t=>{const s=a.isDefined(t,"from"),i=a.isDefined(t,"to");return s&&i&&e<=t.to&&e>=t.from}))},customPredictor:()=>s.customPredictor&&t.customPredictor(e),specificDate:()=>!!s.specificDates&&t.dates.some((t=>this._utils.compareDates(e,t))),daysOfWeek:()=>!!s.daysOfWeek&&-1!==t.days.indexOf(this._utils.getDay(e)),daysOfMonth:()=>!!s.daysOfMonth&&-1!==t.daysOfMonth.indexOf(this._utils.getDate(e))}}isDateHighlighted(e){if(this.isHighlightingNotPossible(e))return!1;const t=this.isDateHighlightedVia(e);return t.to()||t.from()||t.range()||t.specificDate()||t.daysOfWeek()||t.daysOfMonth()||t.customPredictor()}isHighlightStart(e){if(!this.config.has.ranges||!this.isDateHighlighted(e))return!1;for(let t=0;t<this._highlighted.ranges.length;t+=1){if(this._highlighted.ranges[t].from.valueOf()===e.valueOf())return!0}return!1}isHighlightEnd(e){if(!this.config.has.ranges||!this.isDateHighlighted(e))return!1;for(let t=0;t<this._highlighted.ranges.length;t+=1){if(this._highlighted.ranges[t].to.valueOf()===e.valueOf())return!0}return!1}}const E={name:"PickerCells",props:{bootstrapStyling:{type:Boolean,default:!1},cells:{type:Array,required:!0},isRtl:{type:Boolean,default:!1},showEdgeDates:{type:Boolean,default:!0},tabbableCellId:{type:Number,default:null},view:{type:String,validator:e=>["day","month","year"].includes(e),required:!0}},emits:{arrow:e=>"object"==typeof e,select:e=>"object"==typeof e},computed:{columns(){return"day"===this.view?7:3}},methods:{cellClasses(e){return["cell",this.view,{btn:this.bootstrapStyling,disabled:e.isDisabled,"highlight-start":e.isHighlightStart,"highlight-end":e.isHighlightEnd,highlighted:e.isHighlighted,muted:e.isPreviousMonth||e.isNextMonth,open:e.isOpenDate,sat:e.isSaturday,sun:e.isSunday,selected:this.showEdgeDates?e.isSelected:e.isSelected&&!e.isPreviousMonth&&!e.isNextMonth,today:this.showEdgeDates?e.isToday:e.isToday&&!e.isPreviousMonth&&!e.isNextMonth,weekend:e.isWeekend}]},handleArrow(e,t){this.$emit("arrow",{cellId:e,delta:t})},isTabbableCell(e,t){return this.tabbableCellId?t===this.tabbableCellId||null:e.isOpenDate||null}}},N={class:"picker-cells","data-test-picker-cells":""},V=["data-id","data-test-tabbable-cell","data-test-open-date","data-test-today-cell","disabled","onClick","onKeydown"];const P=g(E,[["render",function(t,s,i,a,n,l){return e.openBlock(),e.createElementBlock("div",N,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.cells,((s,a)=>(e.openBlock(),e.createElementBlock("button",{key:s.timestamp,ref_for:!0,ref:s.isOpenDate?"openDate":null,class:e.normalizeClass(l.cellClasses(s)),"data-id":a,"data-test-tabbable-cell":l.isTabbableCell(s,a),"data-test-open-date":s.isOpenDate||null,"data-test-today-cell":s.isToday||null,disabled:s.isDisabled,type:"button",onClick:e=>t.$emit("select",s),onKeydown:[e.withKeys(e.withModifiers((e=>l.handleArrow(a,-l.columns)),["prevent"]),["up"]),e.withKeys(e.withModifiers((e=>l.handleArrow(a,l.columns)),["prevent"]),["down"]),e.withKeys(e.withModifiers((e=>l.handleArrow(a,i.isRtl?1:-1)),["prevent"]),["left"]),e.withKeys(e.withModifiers((e=>l.handleArrow(a,i.isRtl?-1:1)),["prevent"]),["right"])]},[e.renderSlot(t.$slots,"default",{cell:s})],42,V)))),128))])}]]),A={name:"PickerDay",components:{PickerCells:P},mixins:[I],props:{dayCellContent:{type:Function,default:e=>e.date},firstDayOfWeek:{type:String,default:"sun"},highlighted:{type:Object,default:()=>({})},showFullMonthName:{type:Boolean,default:!1},showEdgeDates:{type:Boolean,default:!0}},emits:{setFocus:e=>e.every((e=>["input","prev","up","next","tabbableCell"].includes(e))),setView:e=>"month"===e},computed:{cells(){const e=[],t=this.daysFromPrevMonth+this.daysInMonth+this.daysFromNextMonth,s=this.firstDayCellDate();for(let i=0;i<t;i+=1)e.push(this.makeDay(s)),this.utils.setDate(s,this.utils.getDate(s)+1);return e},currMonthName(){const e=this.showFullMonthName?this.translation.months:this.translation.monthsAbbr;return this.utils.getMonthNameAbbr(this.pageMonth,e)},currYearName(){const{yearSuffix:e}=this.translation;return`${this.pageYear}${e}`},daysOfWeek(){return this.translation.getDaysStartingOn(this.firstDayOfWeekNumber)},daysInMonth(){return this.utils.getDaysInMonth(this.pageDate)},daysFromPrevMonth(){const e=this.utils.getDay(this.pageDate);return(7-this.firstDayOfWeekNumber+e)%7},daysFromNextMonth(){const e=this.daysFromPrevMonth+this.daysInMonth;return 7*Math.ceil(e/7)-e},firstDayOfWeekNumber(){return this.utils.getDayFromAbbr(this.firstDayOfWeek)},firstOfNextMonth(){const e=new Date(this.pageDate);return new Date(this.utils.setMonth(e,this.utils.getMonth(e)+1))},isNextDisabled(){return!!this.disabledConfig.has.from&&this.latestPossibleDate<this.firstOfNextMonth},isPreviousDisabled(){return!!this.disabledConfig.has.to&&this.earliestPossibleDate>this.lastOfPreviousMonth},lastOfPreviousMonth(){const e=new Date(this.pageDate);return new Date(this.utils.setDate(e,0))},pageMonth(){return this.utils.getMonth(this.pageDate)},pageTitleDay(){return this.translation.ymd?`${this.currYearName} ${this.currMonthName}`:`${this.currMonthName} ${this.currYearName}`}},methods:{firstDayCellDate(){const e=new Date(this.pageDate);return new Date(this.utils.setDate(e,1-this.daysFromPrevMonth))},isDisabledDate(e){return!!this.disabledDates&&new F(this.utils,this.disabledDates).isDateDisabled(e)},isHighlightedDate(e){return!!this.highlighted&&new B(this.utils,this.disabledDates,this.highlighted).isDateHighlighted(e)},isHighlightEnd(e){return!!this.highlighted&&new B(this.utils,this.disabledDates,this.highlighted).isHighlightEnd(e)},isHighlightStart(e){return!!this.highlighted&&new B(this.utils,this.disabledDates,this.highlighted).isHighlightStart(e)},isSelectedDate(e){return!!this.selectedDate&&this.utils.compareDates(this.selectedDate,e)},makeDay(e){const{utils:t}=this,s=t.getDay(e),i=e>=this.firstOfNextMonth,a=e<this.pageDate,n=6===s,l=0===s,o=this.showEdgeDates||!(a||i);return{date:o?t.getDate(e):"",timestamp:e.valueOf(),isSelected:this.isSelectedDate(e),isDisabled:!o||this.isDisabledDate(e),isHighlighted:this.isHighlightedDate(e),isHighlightStart:this.isHighlightStart(e),isHighlightEnd:this.isHighlightEnd(e),isOpenDate:t.compareDates(e,this.openDate),isToday:t.compareDates(e,t.getNewDateObject()),isWeekend:n||l,isSaturday:n,isSunday:l,isPreviousMonth:a,isNextMonth:i}}}},R={key:0},Y={class:"day-header"},H={class:"cells-wrapper"},_={key:2};const K={key:0},U={class:"cells-wrapper"},j={key:2};const L={key:0},W={class:"cells-wrapper"},q={key:2};const z={name:"DatePicker",components:{DateInput:w,PickerDay:g(A,[["render",function(t,s,i,a,n,l){const o=e.resolveComponent("PickerHeader"),r=e.resolveComponent("PickerCells");return e.openBlock(),e.createElementBlock("div",null,[t.$slots.beforeCalendarHeaderDay?(e.openBlock(),e.createElementBlock("div",R,[e.renderSlot(t.$slots,"beforeCalendarHeaderDay")])):e.createCommentVNode("",!0),t.showHeader?(e.openBlock(),e.createBlock(o,{key:1,ref:"pickerHeader","bootstrap-styling":t.bootstrapStyling,"is-next-disabled":l.isNextDisabled,"is-previous-disabled":l.isPreviousDisabled,"is-rtl":t.isRtl,"is-up-disabled":t.isUpDisabled,"next-view-up":"month",onFocusInput:t.focusInput,onPageChange:s[0]||(s[0]=e=>t.changePage(e)),onSetFocus:s[1]||(s[1]=e=>t.$emit("setFocus",e)),onSetView:s[2]||(s[2]=e=>t.$emit("setView",e))},{prevIntervalBtn:e.withCtx((()=>[e.renderSlot(t.$slots,"prevIntervalBtn")])),nextIntervalBtn:e.withCtx((()=>[e.renderSlot(t.$slots,"nextIntervalBtn")])),default:e.withCtx((()=>[e.createTextVNode(" "+e.toDisplayString(l.pageTitleDay)+" ",1)])),_:3},8,["bootstrap-styling","is-next-disabled","is-previous-disabled","is-rtl","is-up-disabled","onFocusInput"])):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.createElementVNode("div",Y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.daysOfWeek,(t=>(e.openBlock(),e.createElementBlock("span",{key:t},e.toDisplayString(t),1)))),128))]),e.createElementVNode("div",H,[e.createVNode(e.Transition,{name:t.transitionName},{default:e.withCtx((()=>[(e.openBlock(),e.createBlock(r,{ref:"cells",key:l.pageTitleDay,"bootstrap-styling":t.bootstrapStyling,cells:l.cells,"is-rtl":t.isRtl,"show-edge-dates":i.showEdgeDates,"tabbable-cell-id":t.tabbableCellId,view:"day",onArrow:s[3]||(s[3]=e=>t.handleArrow(e)),onSelect:s[4]||(s[4]=e=>t.select(e))},{default:e.withCtx((({cell:s})=>[e.renderSlot(t.$slots,"dayCellContent",{cell:s},(()=>[e.createTextVNode(e.toDisplayString(i.dayCellContent(s)),1)]))])),_:3},8,["bootstrap-styling","cells","is-rtl","show-edge-dates","tabbable-cell-id"]))])),_:3},8,["name"])])]),t.$slots.calendarFooterDay?(e.openBlock(),e.createElementBlock("div",_,[e.renderSlot(t.$slots,"calendarFooterDay")])):e.createCommentVNode("",!0)])}]]),PickerMonth:g({name:"PickerMonth",components:{PickerCells:P},mixins:[I],emits:{setFocus:e=>e.every((e=>["input","prev","up","next","tabbableCell"].includes(e))),setView:e=>"year"===e},computed:{cells(){const{utils:e}=this,t=[],s=this.firstMonthCellDate();for(let i=0;i<12;i+=1)t.push({month:e.getMonthName(i,this.translation.months),timestamp:s.valueOf(),isDisabled:this.isDisabledMonth(s),isOpenDate:this.isOpenMonth(s),isSelected:this.isSelectedMonth(s),isToday:this.isTodayMonth(s)}),e.setMonth(s,e.getMonth(s)+1);return t},isNextDisabled(){return!!this.disabledConfig.has.from&&this.latestPossibleDate<=new Date(this.pageYear,11,31)},isPreviousDisabled(){return!!this.disabledConfig.has.to&&this.earliestPossibleDate>=new Date(this.pageYear,0,1)},pageTitleMonth(){const{yearSuffix:e}=this.translation;return`${this.pageYear}${e}`}},methods:{firstMonthCellDate(){const e=new Date(this.pageDate);return new Date(this.utils.setMonth(e,0))},isDisabledMonth(e){return!!this.disabledDates&&new F(this.utils,this.disabledDates).isMonthDisabled(e)},isOpenMonth(e){if(!this.openDate)return!1;const t=this.utils.getMonth(this.openDate),s=this.utils.getFullYear(this.openDate),i=this.utils.getMonth(e),a=this.utils.getFullYear(e);return t===i&&s===a},isSelectedMonth(e){if(!this.selectedDate)return!1;const t=this.utils.getMonth(e),s=this.utils.getFullYear(e);return this.selectedDate&&s===this.utils.getFullYear(this.selectedDate)&&t===this.utils.getMonth(this.selectedDate)},isTodayMonth(e){const{utils:t}=this,s=new Date(t.setDate(t.getNewDateObject(),1));return t.compareDates(e,s)}}},[["render",function(t,s,i,a,n,l){const o=e.resolveComponent("PickerHeader"),r=e.resolveComponent("PickerCells");return e.openBlock(),e.createElementBlock("div",null,[t.$slots.beforeCalendarHeaderMonth?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"beforeCalendarHeaderMonth")])):e.createCommentVNode("",!0),t.showHeader?(e.openBlock(),e.createBlock(o,{key:1,ref:"pickerHeader","bootstrap-styling":t.bootstrapStyling,"is-next-disabled":l.isNextDisabled,"is-previous-disabled":l.isPreviousDisabled,"is-rtl":t.isRtl,"is-up-disabled":t.isUpDisabled,"next-view-up":"year",onFocusInput:t.focusInput,onPageChange:s[0]||(s[0]=e=>t.changePage(e)),onSetFocus:s[1]||(s[1]=e=>t.$emit("setFocus",e)),onSetView:s[2]||(s[2]=e=>t.$emit("setView",e))},{prevIntervalBtn:e.withCtx((()=>[e.renderSlot(t.$slots,"prevIntervalBtn")])),nextIntervalBtn:e.withCtx((()=>[e.renderSlot(t.$slots,"nextIntervalBtn")])),default:e.withCtx((()=>[e.createTextVNode(" "+e.toDisplayString(l.pageTitleMonth)+" ",1)])),_:3},8,["bootstrap-styling","is-next-disabled","is-previous-disabled","is-rtl","is-up-disabled","onFocusInput"])):e.createCommentVNode("",!0),e.createElementVNode("div",U,[e.createVNode(e.Transition,{name:t.transitionName},{default:e.withCtx((()=>[(e.openBlock(),e.createBlock(r,{ref:"cells",key:l.pageTitleMonth,"bootstrap-styling":t.bootstrapStyling,cells:l.cells,"is-rtl":t.isRtl,"tabbable-cell-id":t.tabbableCellId,view:"month",onArrow:s[3]||(s[3]=e=>t.handleArrow(e)),onSelect:s[4]||(s[4]=e=>t.select(e))},{default:e.withCtx((({cell:t})=>[e.createTextVNode(e.toDisplayString(t.month),1)])),_:1},8,["bootstrap-styling","cells","is-rtl","tabbable-cell-id"]))])),_:1},8,["name"])]),t.$slots.calendarFooterMonth?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(t.$slots,"calendarFooterMonth")])):e.createCommentVNode("",!0)])}]]),PickerYear:g({name:"PickerYear",components:{PickerCells:P},mixins:[I],props:{yearRange:{type:Number,default:10}},emits:{setFocus:e=>e.every((e=>["input","prev","up","next","tabbableCell"].includes(e)))},computed:{cells(){const{utils:e}=this,t=[],s=this.firstYearCellDate();for(let a=0;a<this.yearRange;a+=1)t.push({year:e.getFullYear(s),timestamp:s.valueOf(),isDisabled:this.isDisabledYear(s),isOpenDate:this.isOpenYear(s),isSelected:this.isSelectedYear(s),isToday:this.isTodayYear(s)}),e.setFullYear(s,e.getFullYear(s)+1);const i=3*Math.ceil(this.yearRange/3);for(let a=t.length;a<i;a+=1)t.push({id:a,isDisabled:!0});return t},isNextDisabled(){if(!this.disabledConfig.has.from)return!1;const e=new Date(this.pageDecadeEnd+1,0,1);return this.latestPossibleDate<e},isPreviousDisabled(){if(!this.disabledConfig.has.to)return!1;const e=new Date(this.pageDecadeStart-1,11,31);return this.earliestPossibleDate>e},pageDecadeStart(){return Math.floor(this.pageYear/this.yearRange)*this.yearRange},pageDecadeEnd(){return this.pageDecadeStart+this.yearRange-1},pageTitleYear(){const{yearSuffix:e}=this.translation;return`${this.pageDecadeStart} - ${this.pageDecadeEnd}${e}`}},methods:{firstYearCellDate(){const{utils:e}=this,t=new Date(this.pageDate),s=Math.floor(e.getFullYear(t)/this.yearRange)*this.yearRange,i=new Date(e.setFullYear(t,s));return this.utils.adjustDateToView(i,"year")},isDisabledYear(e){return!!this.disabledDates&&new F(this.utils,this.disabledDates).isYearDisabled(e)},isOpenYear(e){if(!this.openDate)return!1;return this.utils.getFullYear(this.openDate)===this.utils.getFullYear(e)},isSelectedYear(e){if(!this.selectedDate)return!1;const t=this.utils.getFullYear(e);return this.selectedDate&&t===this.utils.getFullYear(this.selectedDate)},isTodayYear(e){const{utils:t}=this,s=t.getFullYear(t.getNewDateObject());return t.getFullYear(e)===s}}},[["render",function(t,s,i,a,n,l){const o=e.resolveComponent("PickerHeader"),r=e.resolveComponent("PickerCells");return e.openBlock(),e.createElementBlock("div",null,[t.$slots.beforeCalendarHeaderYear?(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(t.$slots,"beforeCalendarHeaderYear")])):e.createCommentVNode("",!0),t.showHeader?(e.openBlock(),e.createBlock(o,{key:1,ref:"pickerHeader","bootstrap-styling":t.bootstrapStyling,"is-next-disabled":l.isNextDisabled,"is-previous-disabled":l.isPreviousDisabled,"is-rtl":t.isRtl,"is-up-disabled":!0,onFocusInput:t.focusInput,onPageChange:s[0]||(s[0]=e=>t.changePage(e)),onSetFocus:s[1]||(s[1]=e=>t.$emit("setFocus",e))},{prevIntervalBtn:e.withCtx((()=>[e.renderSlot(t.$slots,"prevIntervalBtn")])),nextIntervalBtn:e.withCtx((()=>[e.renderSlot(t.$slots,"nextIntervalBtn")])),default:e.withCtx((()=>[e.createTextVNode(" "+e.toDisplayString(l.pageTitleYear)+" ",1)])),_:3},8,["bootstrap-styling","is-next-disabled","is-previous-disabled","is-rtl","onFocusInput"])):e.createCommentVNode("",!0),e.createElementVNode("div",W,[e.createVNode(e.Transition,{name:t.transitionName},{default:e.withCtx((()=>[(e.openBlock(),e.createBlock(r,{ref:"cells",key:l.pageTitleYear,"bootstrap-styling":t.bootstrapStyling,cells:l.cells,"is-rtl":t.isRtl,"tabbable-cell-id":t.tabbableCellId,view:"year",onArrow:s[2]||(s[2]=e=>t.handleArrow(e)),onSelect:s[3]||(s[3]=e=>t.select(e))},{default:e.withCtx((({cell:t})=>[e.createTextVNode(e.toDisplayString(t.year),1)])),_:1},8,["bootstrap-styling","cells","is-rtl","tabbable-cell-id"]))])),_:1},8,["name"])]),t.$slots.calendarFooterYear?(e.openBlock(),e.createElementBlock("div",q,[e.renderSlot(t.$slots,"calendarFooterYear")])):e.createCommentVNode("",!0)])}]]),Popup:{name:"Popup",props:{appendToBody:{type:Boolean,default:!0},fixedPosition:{type:String,default:""},inline:{type:Boolean,default:!1},rtl:{type:Boolean,default:!1},visible:{type:Boolean,default:!1}},data:()=>({popupRect:null}),watch:{visible:{immediate:!0,handler(e){e&&this.displayPopup()}}},mounted(){this.inline||this.appendToBody&&document.body.appendChild(this.$el)},beforeUnmount(){this.inline||this.appendToBody&&this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el)},methods:{setTopStyle(){if(this.appendToBody){const e=this.$parent.$el.getBoundingClientRect();this.$el.style.top=`${e.bottom+window.scrollY}px`}},displayPopup(){if(this.inline||!this.visible)return;this.setTopStyle();const e=this.$el.children[0],t=this.$parent.$el;this.popupRect||(this.popupRect=function(e){const t=e.style.display,s=e.style.visibility;e.style.display="block",e.style.visibility="hidden";const i=window.getComputedStyle(e),a=e.offsetWidth+parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),n=e.offsetHeight+parseInt(i.marginTop,10)+parseInt(i.marginBottom,10);return e.style.display=t,e.style.visibility=s,{width:a,height:n}}(e));const{width:s,height:i}=this.popupRect,{left:a,top:n}=function({el:e,e