UNPKG

@wslyhbb/vuejs-datepicker

Version:

A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations. Fork of initial vuejs-datepicker which is abandoned.

5 lines 58 kB
"use strict";/*! * vuejs-datepicker v4.3.0 * (c) 2023-2025 Wesley Hobbie * Released under the MIT License. */const d=require("date-fns"),i=require("vue");function w(e){return(t={})=>{const s=t.width?String(t.width):e.defaultWidth;return e.formats[s]||e.formats[e.defaultWidth]}}function m(e){return(t,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let l;if(a==="formatting"&&e.formattingValues){const r=e.defaultFormattingWidth||e.defaultWidth,u=s!=null&&s.width?String(s.width):r;l=e.formattingValues[u]||e.formattingValues[r]}else{const r=e.defaultWidth,u=s!=null&&s.width?String(s.width):e.defaultWidth;l=e.values[u]||e.values[r]}const n=e.argumentCallback?e.argumentCallback(t):t;return l[n]}}function b(e){return(t,s={})=>{const a=s.width,l=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],n=t.match(l);if(!n)return null;const r=n[0],u=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],o=Array.isArray(u)?I(u,D=>D.test(r)):V(u,D=>D.test(r));let g;g=e.valueCallback?e.valueCallback(o):o,g=s.valueCallback?s.valueCallback(g):g;const N=t.slice(r.length);return{value:g,rest:N}}}function V(e,t){for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t(e[s]))return s}function I(e,t){for(let s=0;s<e.length;s++)if(t(e[s]))return s}function B(e){return(t,s={})=>{const a=t.match(e.matchPattern);if(!a)return null;const l=a[0],n=t.match(e.parsePattern);if(!n)return null;let r=e.valueCallback?e.valueCallback(n[0]):n[0];r=s.valueCallback?s.valueCallback(r):r;const u=t.slice(l.length);return{value:r,rest:u}}}const O={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},A=(e,t,s)=>{let a;const l=O[e];return typeof l=="string"?a=l:t===1?a=l.one:a=l.other.replace("{{count}}",t.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a},U={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Y=(e,t,s,a)=>U[e],x={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},H={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},L={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},W={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},$={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},K={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},R=(e,t)=>{const s=Number(e),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},j={ordinalNumber:R,era:m({values:x,defaultWidth:"wide"}),quarter:m({values:H,defaultWidth:"wide",argumentCallback:e=>e-1}),month:m({values:L,defaultWidth:"wide"}),day:m({values:W,defaultWidth:"wide"}),dayPeriod:m({values:$,defaultWidth:"wide",formattingValues:K,defaultFormattingWidth:"wide"})},q=/^(\d+)(th|st|nd|rd)?/i,z=/\d+/i,J={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},X={any:[/^b/i,/^(a|c)/i]},Q={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},G={any:[/1/i,/2/i,/3/i,/4/i]},Z={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},_={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ee={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},te={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},se={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ie={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ae={ordinalNumber:B({matchPattern:q,parsePattern:z,valueCallback:e=>parseInt(e,10)}),era:b({matchPatterns:J,defaultMatchWidth:"wide",parsePatterns:X,defaultParseWidth:"any"}),quarter:b({matchPatterns:Q,defaultMatchWidth:"wide",parsePatterns:G,defaultParseWidth:"any",valueCallback:e=>e+1}),month:b({matchPatterns:Z,defaultMatchWidth:"wide",parsePatterns:_,defaultParseWidth:"any"}),day:b({matchPatterns:ee,defaultMatchWidth:"wide",parsePatterns:te,defaultParseWidth:"any"}),dayPeriod:b({matchPatterns:se,defaultMatchWidth:"any",parsePatterns:ie,defaultParseWidth:"any"})},ne={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},re={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},le={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},oe={date:w({formats:ne,defaultWidth:"full"}),time:w({formats:re,defaultWidth:"full"}),dateTime:w({formats:le,defaultWidth:"full"})},p={code:"en-US",formatDistance:A,formatLong:oe,formatRelative:Y,localize:j,match:ae,options:{weekStartsOn:0,firstWeekContainsDate:1}},T={useUtc:!1,language:p,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){const s=new Date(e.getTime()),a=new Date(t.getTime());return this.useUtc?(s.setUTCHours(0,0,0,0),a.setUTCHours(0,0,0,0)):(s.setHours(0,0,0,0),a.setHours(0,0,0,0)),s.getTime()===a.getTime()},isValidDate(e){return Object.prototype.toString.call(e)!=="[object Date]"?!1:!isNaN(e.getTime())},getDayNameAbbr(e){if(typeof e!="object")throw TypeError("Invalid Type");return d.format(e,"ccc",{locale:this.language})},getDayFromAbbr(e){const t=new Date,s=[0,1,2,3,4,5,6];let a=s.map(l=>d.format(d.setDay(t,l),"ccc",{locale:p}));for(let l=0;l<a.length;l++)if(e.toLowerCase()===a[l].toLowerCase())return l;if(this.language!==p){a=s.map(l=>d.format(d.setDay(t,l),"ccc",{locale:this.language}));for(let l=0;l<a.length;l++)if(e.toLowerCase()===a[l].toLowerCase())return l}throw TypeError("Invalid week day")},getMonthName(e){if(typeof e=="object")return d.format(e,"LLLL",{locale:this.language});if(typeof e=="number")return d.format(d.setMonth(new Date,e),"LLLL",{locale:this.language});throw TypeError("Invalid type")},getMonthNameAbbr(e){if(typeof e=="object")return d.format(e,"LLL",{locale:this.language});if(typeof e=="number")return d.format(d.setMonth(new Date,e),"LLL",{locale:this.language});throw TypeError("Invalid type")},daysInMonth(e,t){return/8|3|5|10/.test(t)?30:t===1?!(e%4)&&e%100||!(e%400)?29:28: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"}},getDaysStartingOn(e,t=!1){const s=new Date,a=[0,1,2,3,4,5,6];let l="ccc";return t&&(l="cccccc"),a.map(n=>d.format(d.setDay(s,n+e),l,{locale:this.language}))},formatDate(e,t){return d.format(e,t,{locale:this.language})},parseDate(e,t="yyyy-MM-dd"){if(typeof e=="string")return d.parse(e,t,new Date,{locale:this.language});if(typeof e=="number")return d.toDate(e)},validateDateInput(e){return e===null||e instanceof Date||typeof e=="string"||typeof e=="number"},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)}},h=(e=!1,t=p)=>({...T,useUtc:e,language:t}),F={...T},P=["dv","fa","ha","he","kwh","ks","ku","ps","ur","yi"],ue=["ja","lt","mn","ko"],C={zh:"年",ja:"年",ko:"년"},E={props:{autofocus:{type:Boolean,default:!1},bootstrapStyling:{type:Boolean,default:!1},clearButton:{type:Boolean,default:!1},clearButtonIcon:{type:String,default:null},calendarButton:{type:Boolean,default:!1},calendarButtonIcon:{type:String,default:null},calendarButtonIconContent:{type:String,default:null},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},pattern:{type:String,default:null},placeholder:{type:String,default:null},refName:{type:String,default:""},required:{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}}},f=(e,t)=>{const s=e.__vccOpts||e;for(const[a,l]of t)s[a]=l;return s},de={name:"DateInput",mixins:[E],props:{isOpen:{type:Boolean,default:!1},language:{type:Object},openDate:Date,parseTypedDate:Function,resetTypedDate:[Date],selectedDate:{type:Date,default:null}},emits:{clearDate:null,closeCalendar:null,open:null,selectTypedDate:e=>e===null||e instanceof Date,setFocus:e=>e.every(t=>["calendarButton","input","prev","up","next","tabbableCell"].includes(t)),typedDate:e=>e===null||e instanceof Date},data(){return{input:null,typedDate:!1,utils:h(this.useUtc,this.language)}},computed:{formattedValue(){return this.selectedDate?this.typedDate?this.typedDate:typeof this.format=="function"?this.format(this.selectedDate):this.utils.formatDate(this.selectedDate,this.format):null},computedInputClass(){return this.bootstrapStyling?typeof this.inputClass=="string"?[this.inputClass,"form-control"].join(" "):{"form-control":!0,...this.inputClass}:this.inputClass}},watch:{language(e){this.utils=h(this.useUtc,e)},useUtc(e){this.utils=h(e,this.language)},resetTypedDate(){this.typedDate=!1}},mounted(){this.input=this.$el.querySelector("input")},methods:{showCalendar(){this.showCalendarOnFocus||this.toggle()},showFocusCalendar(){this.showCalendarOnFocus&&!this.isOpen&&this.$emit("open")},handleKeydownDown(){this.isOpen||this.$emit("open"),this.typeable&&this.$emit("setFocus",["prev","up","next","tabbableCell"])},handleKeydownEnter(){if(!this.typeable)return;if(!this.input.value){this.$emit("selectTypedDate",null);return}const e=this.getTypedDate(this.input.value);isNaN(e)||(this.typedDate=this.input.value,this.$emit("selectTypedDate",e))},handleKeydownEscape(){this.$emit("closeCalendar")},handleKeydownSpace(e){this.typeable||e.preventDefault()},keyUp(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){this.$emit("typedDate",null);return}const t=this.getTypedDate(this.input.value);isNaN(t)||this.$emit("typedDate",t)},handleKeyupSpace(e){if(this.typeable){this.input.value===""&&this.toggle();return}e.preventDefault(),this.toggle()},inputBlurred(){this.typeable&&isNaN(this.getTypedDate(this.input.value))&&(this.clearDate(),this.input.value=null,this.typedDate=null)},handleDelete(){!this.typeable&&this.selectedDate&&this.clearDate()},clearDate(){this.input.value="",this.$emit("clearDate")},getTypedDate(e){return typeof this.parseTypedDate=="function"?this.parseTypedDate(e):this.utils.parseDate(e,typeof this.format=="string"?this.format:void 0)},toggle(e){this.isOpen&&this.$emit("setFocus",[e||"input"]),this.$emit(this.isOpen?"closeCalendar":"open")}}},he=["disabled"],ce={key:0},fe=["id","autofocus","clear-button","disabled","maxlength","name","open-date","pattern","placeholder","readonly","required","tabindex","type","value"],ge=["disabled"],me={key:0};function be(e,t,s,a,l,n){return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass({"input-group":e.bootstrapStyling})},[e.calendarButton?(i.openBlock(),i.createElementBlock("button",{key:0,ref:"calendarButton",class:i.normalizeClass(["vdp-datepicker__calendar-button",{"btn input-group-prepend":e.bootstrapStyling}]),disabled:e.disabled,onClick:t[0]||(t[0]=r=>n.toggle("calendarButton"))},[i.createElementVNode("span",{class:i.normalizeClass({"input-group-text":e.bootstrapStyling})},[i.renderSlot(e.$slots,"calendarBtn",{},()=>[i.createElementVNode("i",{class:i.normalizeClass(e.calendarButtonIcon)},[i.createTextVNode(i.toDisplayString(e.calendarButtonIconContent)+" ",1),e.calendarButtonIcon?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",ce,"…"))],2)])],2)],10,he)):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"beforeDateInput"),i.createElementVNode("input",{id:e.id,ref:e.refName,autocomplete:"off",autofocus:e.autofocus,class:i.normalizeClass(n.computedInputClass),"clear-button":e.clearButton,disabled:e.disabled,maxlength:e.maxlength,name:e.name,"open-date":s.openDate,pattern:e.pattern,placeholder:e.placeholder,readonly:!e.typeable,required:e.required,tabindex:e.tabindex,type:e.inline?"hidden":"text",value:n.formattedValue,onBlur:t[1]||(t[1]=(...r)=>n.inputBlurred&&n.inputBlurred(...r)),onClick:t[2]||(t[2]=(...r)=>n.showCalendar&&n.showCalendar(...r)),onFocus:t[3]||(t[3]=(...r)=>n.showFocusCalendar&&n.showFocusCalendar(...r)),onKeydown:[t[4]||(t[4]=i.withKeys((...r)=>n.handleDelete&&n.handleDelete(...r),["delete"])),t[5]||(t[5]=i.withKeys(i.withModifiers((...r)=>n.handleKeydownDown&&n.handleKeydownDown(...r),["prevent"]),["down"])),t[6]||(t[6]=i.withKeys(i.withModifiers((...r)=>n.handleKeydownEnter&&n.handleKeydownEnter(...r),["prevent"]),["enter"])),t[7]||(t[7]=i.withKeys(i.withModifiers((...r)=>n.handleKeydownEscape&&n.handleKeydownEscape(...r),["prevent"]),["esc"])),t[8]||(t[8]=i.withKeys(r=>n.handleKeydownSpace(r),["space"]))],onKeyup:[t[9]||(t[9]=(...r)=>n.keyUp&&n.keyUp(...r)),t[10]||(t[10]=i.withKeys(r=>n.handleKeyupSpace(r),["space"]))]},null,42,fe),e.clearButton&&s.selectedDate?(i.openBlock(),i.createElementBlock("button",{key:1,class:i.normalizeClass(["vdp-datepicker__clear-button",{"btn input-group-append":e.bootstrapStyling}]),disabled:e.disabled,onClick:t[11]||(t[11]=(...r)=>n.clearDate&&n.clearDate(...r))},[i.createElementVNode("span",{class:i.normalizeClass({"input-group-text":e.bootstrapStyling})},[i.renderSlot(e.$slots,"clearBtn",{},()=>[i.createElementVNode("i",{class:i.normalizeClass(e.clearButtonIcon)},[e.clearButtonIcon?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",me,"×"))],2)])],2)],10,ge)):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"afterDateInput")],2)}const pe=f(de,[["render",be]]),ye={isDefined(e,t){return e&&typeof e[t]<"u"},hasArray(e,t){return 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 l=e[t];return{day:s.getDate(l),month:s.getMonth(l),year:s.getFullYear(l)}}},y=e=>({...ye,utils:e});class c{constructor(t,s){this._utils=t,this._disabledDates=s}get config(){const t=this._disabledDates,s=y(this._utils),a={customPredictor:s.isDefined(t,"customPredictor"),daysOfMonth:s.hasArray(t,"daysOfMonth"),daysOfWeek:s.hasArray(t,"days"),from:s.hasDate(t,"from"),ranges:s.hasArray(t,"ranges"),specificDates:s.hasArray(t,"dates"),to:s.hasDate(t,"to")};return{to:s.dayMonthYear(t,"to"),from:s.dayMonthYear(t,"from"),has:a}}daysInMonth(t){const s=this._utils,a=s.getMonth(t),l=s.getFullYear(t);return s.daysInMonth(l,a)}isDateDisabledVia(t){const s=this._disabledDates,{has:a}=this.config;return{to:()=>a.to&&t<s.to,from:()=>a.from&&t>s.from,range:()=>{if(!a.ranges)return!1;const{ranges:l}=s,n=y(this._utils);return l.some(r=>{const u=n.isDefined(r,"from"),o=n.isDefined(r,"to");return u&&o&&t<r.to&&t>r.from})},customPredictor:()=>a.customPredictor&&s.customPredictor(t),specificDate:()=>a.specificDates?s.dates.some(l=>this._utils.compareDates(t,l)):!1,daysOfWeek:()=>a.daysOfWeek?s.days.indexOf(this._utils.getDay(t))!==-1:!1,daysOfMonth:()=>a.daysOfMonth?s.daysOfMonth.indexOf(this._utils.getDate(t))!==-1:!1}}isMonthDisabledVia(t){const{from:s,has:a,to:l}=this.config,n=this._utils.getMonth(t),r=this._utils.getFullYear(t);return{to:()=>a.to&&r<l.year?!0:a.to&&n<l.month&&r<=l.year,from:()=>a.from&&r>s.year?!0:a.from&&n>s.month&&r>=s.year}}isYearDisabledVia(t){const{from:s,has:a,to:l}=this.config,n=this._utils.getFullYear(t);return{to:()=>a.to&&n<l.year,from:()=>a.from&&n>s.year}}isDateDisabled(t){const s=this.isDateDisabledVia(t);return s.to()||s.from()||s.range()||s.specificDate()||s.daysOfWeek()||s.daysOfMonth()||s.customPredictor()}isMonthDisabled(t){const s=this.isMonthDisabledVia(t);if(s.to()||s.from())return!0;for(let a=1;a<=this.daysInMonth(t);a++){const l=new Date(t);if(l.setDate(a),!this.isDateDisabled(l))return!1}return!0}isYearDisabled(t){const s=this.isYearDisabledVia(t);if(s.to()||s.from())return!0;for(let a=0;a<12;a++){const l=new Date(t);if(l.setMonth(a),!this.isMonthDisabled(l))return!1}return!0}getEarliestPossibleDate(t){if(!t)return null;const s=this._utils;if(this.isDateDisabled(t)){const a=new Date(s.getFullYear(t),s.getMonth(t),s.getDate(t)+1);return this.getEarliestPossibleDate(a)}return t}getLatestPossibleDate(t){const s=this.isYearDisabledVia(t);if(s.to()||s.from())return!0;for(let a=0;a<12;a++){const l=new Date(t);if(l.setMonth(a),!this.isMonthDisabled(l))return!1}return!0}}const De={data(){return{focus:{delay:0,refs:[]},inlineTabbableCell:null,navElements:[],navElementsFocusedIndex:0,resetTabbableCell:!1,tabbableCell:null}},computed:{fallbackElementsToFocus(){const e=["tabbableCell","prev","next"];return this.typeable&&e.unshift("input"),e},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):!0},applyFocus(){const e=[...this.focus.refs,...this.fallbackElementsToFocus];for(let t=0;t<e.length;t++){const s=this.getElementByRef(e[t]);if(s&&s.getAttribute("disabled")===null){s.focus(),this.setNavElementsFocusedIndex();break}}},getActiveCell(){const e=this.getActiveElement(),t=this.hasClass(e,"cell"),s=this.hasClass(e,this.view);return t&&s&&!this.resetTabbableCell?e:null},getActiveElement(){return 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 a=0;a<s.length;a++)if(s[a].timestamp===t.valueOf())return a;return null},getElementByRef(e){return e==="tabbableCell"?this.tabbableCell:e==="input"?this.$refs.dateInput&&this.$refs.dateInput.$refs[this.refName]:e==="calendarButton"?this.$refs.dateInput&&this.$refs.dateInput.$refs.calendarButton:this.$refs.picker&&this.$refs.picker.$refs.pickerHeader&&this.$refs.picker.$refs.pickerHeader.$refs[e]},getElementsFromSlot(e){if(!this.hasSlot(e))return[];if(e==="beforeCalendarHeader")return this.getFocusableElements(this.$refs.view.children[0]);const t=e.indexOf("beforeCalendarHeader")>-1,s=this.$refs.picker.$el,a=t?0:s.children.length-1;return this.getFocusableElements(s.children[a])},getElementsFromHeader(){if(!this.$refs.picker.$refs.pickerHeader)return[];const t=this.$refs.picker.$refs.pickerHeader.$el.querySelectorAll("button:enabled");return[...Array.prototype.slice.call(t)]},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.picker.$el)[0]},getLastInlineFocusableElement(){const e=this.getFocusableElements(this.$refs.picker.$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},hasSlot(e){return!!this.$slots[e]},isTabbingAwayFromInlineDatepicker(e){return this.inline?this.isTabbingAwayFromFirstNavElement(e)?(this.tabAwayFromFirstElement(),!0):this.isTabbingAwayFromLastNavElement(e)?(this.tabAwayFromLastElement(),!0):!1:!1},isTabbingAwayFromFirstNavElement(e){if(!e.shiftKey)return!1;const t=this.getActiveElement(),s=this.navElements[0];return t===s},isTabbingAwayFromLastNavElement(e){if(e.shiftKey)return!1;const t=this.getActiveElement(),s=this.navElements[this.navElements.length-1];return t===s},reviewFocus(){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)},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].filter(t=>!!t).reduce((t,s)=>t.concat(s),[])},setNavElementsFocusedIndex(){const e=this.getActiveElement();for(let t=0;t<this.navElements.length;t++)if(e===this.navElements[t]){this.navElementsFocusedIndex=t;return}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.today:not(.muted):enabled")||e.querySelector("button.cell:not(.muted):enabled")},tabAwayFromFirstElement(){this.getFirstInlineFocusableElement().focus(),this.tabbableCell=this.inlineTabbableCell},tabAwayFromLastElement(){this.getLastInlineFocusableElement().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())},updateTabbableCell(){const e=this.getActiveElement(),t=this.hasClass(e,"cell");(!this.tabbableCell||t)&&this.setTabbableCell()}}},we={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},upButtonClasses:{type:String}},emits:{focusInput:null,pageChange:e=>typeof e=="object",setFocus:e=>e.every(t=>["input","prev","up","next","tabbableCell"].includes(t)),setView:e=>["day","month","year"].includes(e)},computed:{leftButton(){return[this.isRtl?"next":"prev"]},rightButton(){return[this.isRtl?"prev":"next"]}},methods:{arrowLeftPrev(){if(this.isRtl){this.$emit("setFocus",["up","next","tabbableCell"]);return}this.goToPreviousPage()},arrowRightPrev(){if(this.isRtl){this.goToPreviousPage();return}this.$emit("setFocus",["up","next","tabbableCell"])},arrowLeftNext(){if(this.isRtl){this.goToNextPage();return}this.$emit("setFocus",["up","prev","tabbableCell"])},arrowRightNext(){if(this.isRtl){this.$emit("setFocus",["up","prev","tabbableCell"]);return}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)}}},ve=["disabled"],Ce={key:1,ref:"up"},Me=["disabled"];function ke(e,t,s,a,l,n){return i.openBlock(),i.createElementBlock("header",null,[i.createElementVNode("button",{ref:"prev",class:i.normalizeClass(["prev",{btn:s.bootstrapStyling,rtl:s.isRtl}]),disabled:s.isPreviousDisabled,type:"button",onClick:t[0]||(t[0]=r=>s.isRtl?n.goToNextPage():n.goToPreviousPage()),onKeydown:[t[1]||(t[1]=i.withKeys(i.withModifiers((...r)=>n.focusTabbableCell&&n.focusTabbableCell(...r),["prevent"]),["down"])),t[2]||(t[2]=i.withKeys(i.withModifiers((...r)=>n.focusInput&&n.focusInput(...r),["prevent"]),["up"])),t[3]||(t[3]=i.withKeys(i.withModifiers((...r)=>n.arrowLeftPrev&&n.arrowLeftPrev(...r),["prevent"]),["left"])),t[4]||(t[4]=i.withKeys(i.withModifiers((...r)=>n.arrowRightPrev&&n.arrowRightPrev(...r),["prevent"]),["right"]))]},"<",42,ve),s.isUpDisabled?(i.openBlock(),i.createElementBlock("span",Ce,[i.renderSlot(e.$slots,"default")],512)):(i.openBlock(),i.createElementBlock("button",{key:0,ref:"up",class:i.normalizeClass([s.upButtonClasses,"up",{btn:s.bootstrapStyling}]),type:"button",onClick:t[5]||(t[5]=(...r)=>n.selectUpButton&&n.selectUpButton(...r)),onKeydown:[t[6]||(t[6]=i.withKeys(i.withModifiers((...r)=>n.focusTabbableCell&&n.focusTabbableCell(...r),["prevent"]),["down"])),t[7]||(t[7]=i.withKeys(i.withModifiers((...r)=>n.focusInput&&n.focusInput(...r),["prevent"]),["up"])),t[8]||(t[8]=i.withKeys(i.withModifiers((...r)=>n.focusLeftButton&&n.focusLeftButton(...r),["prevent"]),["left"])),t[9]||(t[9]=i.withKeys(i.withModifiers((...r)=>n.focusRightButton&&n.focusRightButton(...r),["prevent"]),["right"]))]},[i.renderSlot(e.$slots,"default")],34)),i.createElementVNode("button",{ref:"next",class:i.normalizeClass(["next",{btn:s.bootstrapStyling,rtl:s.isRtl}]),disabled:s.isNextDisabled,type:"button",onClick:t[10]||(t[10]=r=>s.isRtl?n.goToPreviousPage():n.goToNextPage()),onKeydown:[t[11]||(t[11]=i.withKeys(i.withModifiers((...r)=>n.focusTabbableCell&&n.focusTabbableCell(...r),["prevent"]),["down"])),t[12]||(t[12]=i.withKeys(i.withModifiers((...r)=>n.focusInput&&n.focusInput(...r),["prevent"]),["up"])),t[13]||(t[13]=i.withKeys(i.withModifiers((...r)=>n.arrowLeftNext&&n.arrowLeftNext(...r),["prevent"]),["left"])),t[14]||(t[14]=i.withKeys(i.withModifiers((...r)=>n.arrowRightNext&&n.arrowRightNext(...r),["prevent"]),["right"]))]},">",42,Me)])}const M=f(we,[["render",ke]]),Se={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){return typeof e=="object"},select(e){return typeof e=="object"}},computed:{columns(){return this.view==="day"?7:3}},methods:{cellClasses(e){return["cell",this.view,{blank:e.date==="",btn:this.bootstrapStyling,disabled:e.isDisabled,"highlight-start":e.isHighlightStart,"highlight-end":e.isHighlightEnd,highlighted:e.isHighlighted,muted:e.isPreviousMonth||e.isNextMonth,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})}}},Fe={class:"picker-cells"},Te=["data-id","disabled","onClick","onKeypress","onKeydown"];function Pe(e,t,s,a,l,n){return i.openBlock(),i.createElementBlock("div",Fe,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.cells,(r,u)=>(i.openBlock(),i.createElementBlock("button",{key:r.timestamp,class:i.normalizeClass(n.cellClasses(r)),"data-id":u,disabled:r.isDisabled,type:"button",onClick:o=>e.$emit("select",r),onKeypress:[i.withKeys(o=>e.$emit("select",r),["enter"]),i.withKeys(o=>e.$emit("select",r),["space"])],onKeydown:[i.withKeys(i.withModifiers(o=>n.handleArrow(u,-n.columns),["prevent"]),["up"]),i.withKeys(i.withModifiers(o=>n.handleArrow(u,n.columns),["prevent"]),["down"]),i.withKeys(i.withModifiers(o=>n.handleArrow(u,s.isRtl?1:-1),["prevent"]),["left"]),i.withKeys(i.withModifiers(o=>n.handleArrow(u,s.isRtl?-1:1),["prevent"]),["right"])]},[i.renderSlot(e.$slots,"default",{cell:r})],42,Te))),128))])}const k=f(Se,[["render",Pe]]),S={props:{bootstrapStyling:{type:Boolean,default:!1},calendarClass:[String,Object,Array],calendarStyle:{type:Object},disabledDates:{type:Object},isTypeable:{type:Boolean,default:!1},isUpDisabled:{type:Boolean,default:!1},language:{type:Object},pageDate:{type:Date,default:null},selectedDate:{type:Date,default:null},slideDuration:{type:Number,default:250},tabbableCellId:{type:Number,default:null},useUtc:{type:Boolean,default:!1},visible:{type:Boolean,default:!1}},emits:{select:e=>typeof e=="object",selectedDisabled:e=>typeof e=="object",setFocus:e=>Array.isArray(e)&&e.length===1&&e[0]==="input"},data(){return{utils:h(this.useUtc,this.language)}},watch:{language(e){this.utils=h(this.useUtc,e)},useUtc(e){this.utils=h(e,this.language)}},computed:{disabledConfig(){return this.disabledDates?new c(this.utils,this.disabledDates).config:{has:{from:!1,to:!1}}},earliestPossibleDate(){return this.disabledDates?new c(this.utils,this.disabledDates).getEarliestPossibleDate(this.disabledDates.to):null},isRtl(){return P.indexOf(this.language)!==-1},latestPossibleDate(){return this.disabledDates?new c(this.utils,this.disabledDates).getLatestPossibleDate(this.disabledDates.from):null},pageYear(){return this.utils.getFullYear(this.pageDate)}},methods:{addMoreSteps(e){return e.stepsRemaining<=0&&Math.abs(e.delta)>1?Math.abs(e.delta):e.stepsRemaining},changePageAndSetFocus(e){const{delta:t}=e;t>0&&this.isNextDisabled||t<0&&this.isPreviousDisabled||(this.changePage({incrementBy:Math.sign(t),focusRefs:["arrow-to-cell"]}),this.$nextTick(()=>{this.setFocusOnNewPage(e)}))},focusInput(){this.isTypeable&&this.$emit("setFocus",["input"])},getElement({currentElement:e,delta:t,stepsRemaining:s}){const a=this.getElementSibling(e,t),l={currentElement:a,delta:t,stepsRemaining:s-1};return a?this.isBeyondPossibleDate(l)?this.firstOrLastPossibleDate(l):this.isMutedOrDisabled(a)?(l.stepsRemaining=this.addMoreSteps(l),this.getElement(l)):s>1&&l.currentElement?this.getElement(l):a:this.changePageAndSetFocus(l)},getElementSibling(e,t){return 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=document.activeElement.shadowRoot?document.activeElement.shadowRoot.activeElement:document.activeElement,s=Math.abs(e),a={currentElement:t,delta:e,stepsRemaining:s};this.setFocusToAvailableCell(a)},select(e){e.isDisabled?this.$emit("selectedDisabled",e):this.$emit("select",e)},isBeyondPossibleDate({currentElement:e,delta:t}){return t>0&&this.latestPossibleDate?this.isDatePossible(e,t):t<0&&this.earliestPossibleDate?this.isDatePossible(e,t):!1},isDatePossible(e,t){const s=e.getAttribute("data-id"),a=new Date(this.cells[s].timestamp);return t>0?a>this.latestPossibleDate:a<this.earliestPossibleDate},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),a={currentElement:s,delta:e,stepsRemaining:t};if(t<=0){if(this.isMutedOrDisabled(s)){a.stepsRemaining=Math.abs(a.delta),setTimeout(()=>{this.setFocusToAvailableCell(a)},this.slideDuration);return}setTimeout(()=>{s.focus()},this.slideDuration);return}setTimeout(()=>{this.setFocusToAvailableCell(a)},this.slideDuration)},setFocusToAvailableCell(e){const t=this.getElement(e);t&&t.focus()}}};class v{constructor(t,s,a){this._utils=t,this._disabledDates=s,this._highlighted=a}get config(){const t=this._highlighted,s=y(this._utils),a={customPredictor:s.isDefined(t,"customPredictor"),daysOfMonth:s.hasArray(t,"daysOfMonth"),daysOfWeek:s.hasArray(t,"days"),from:s.hasDate(t,"from"),ranges:s.hasArray(t,"ranges"),specificDates:s.hasArray(t,"dates"),to:s.hasDate(t,"to"),includeDisabled:s.isDefined(t,"includeDisabled")&&t.includeDisabled};return{to:s.dayMonthYear(t,"to"),from:s.dayMonthYear(t,"from"),has:a}}isDateDisabled(t){const s=this._utils,a=this._disabledDates;return new c(s,a).isDateDisabled(t)}isHighlightingNotPossible(t){return!this.config.has.includeDisabled&&this.isDateDisabled(t)}isDateHighlightedVia(t){const s=this._highlighted,{has:a}=this.config;return{to:()=>a.to&&t<s.to,from:()=>a.from&&t>s.from,range:()=>{if(!a.ranges)return!1;const{ranges:l}=s,n=y(this._utils);return l.some(r=>{const u=n.isDefined(r,"from"),o=n.isDefined(r,"to");return u&&o&&t<=r.to&&t>=r.from})},customPredictor:()=>a.customPredictor&&s.customPredictor(t),specificDate:()=>a.specificDates?s.dates.some(l=>this._utils.compareDates(t,l)):!1,daysOfWeek:()=>a.daysOfWeek?s.days.indexOf(this._utils.getDay(t))!==-1:!1,daysOfMonth:()=>a.daysOfMonth?s.daysOfMonth.indexOf(this._utils.getDate(t))!==-1:!1}}isDateHighlighted(t){if(this.isHighlightingNotPossible(t))return!1;const s=this.isDateHighlightedVia(t);return s.to()||s.from()||s.range()||s.specificDate()||s.daysOfWeek()||s.daysOfMonth()||s.customPredictor()}isHighlightStart(t){if(!this.config.has.ranges||!this.isDateHighlighted(t))return!1;for(let s=0;s<this._highlighted.ranges.length;s+=1)if(this._highlighted.ranges[s].from.valueOf()===t.valueOf())return!0;return!1}isHighlightEnd(t){if(!this.config.has.ranges||!this.isDateHighlighted(t))return!1;for(let s=0;s<this._highlighted.ranges.length;s+=1)if(this._highlighted.ranges[s].to.valueOf()===t.valueOf())return!0;return!1}}const Ee={name:"PickerDay",components:{PickerHeader:M,PickerCells:k},mixins:[S],props:{dayCellContent:{type:Function,default:e=>e.date},firstDayOfWeek:{type:String},highlighted:{type:Object,default(){return{}}},mondayFirst:{type:Boolean,default:!1},showEdgeDates:{type:Boolean,default:!1},showFullMonthName:{type:Boolean,default:!1},twoLetterAbbr:{type:Boolean,default:!1}},emits:{pageChange:e=>typeof e=="object",setFocus:e=>e.every(t=>["input","prev","up","next","tabbableCell"].includes(t)),setView:e=>e==="month"},computed:{currMonthName(){return this.showFullMonthName?this.utils.getMonthName(this.pageMonth):this.utils.getMonthNameAbbr(this.pageMonth)},currYearName(){const e=C[this.language]||"";return`${this.pageYear}${e}`},days(){const e=[],t=this.daysFromPrevMonth+this.daysInMonth+this.daysFromNextMonth,s=this.firstDayCellDate();for(let a=0;a<t;a++)e.push(this.makeDay(s)),this.utils.setDate(s,this.utils.getDate(s)+1);return e},daysFromNextMonth(){const e=this.daysFromPrevMonth+this.daysInMonth;return Math.ceil(e/7)*7-e},daysFromPrevMonth(){const e=this.utils.getDay(this.pageDate);return(7-this.firstDayOfWeekNumber+e)%7},daysInMonth(){return this.utils.getDaysInMonth(this.pageDate)},daysOfWeek(){return this.utils.getDaysStartingOn(this.firstDayOfWeekNumber,this.twoLetterAbbr)},firstDayOfWeekNumber(){return this.mondayFirst?1:this.firstDayOfWeek?this.utils.getDayFromAbbr(this.firstDayOfWeek):0},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.disabledConfig.from.month<=this.pageMonth&&this.disabledConfig.from.year<=this.pageYear:!1},isPreviousDisabled(){return this.disabledConfig.has.to?this.disabledConfig.to.month>=this.pageMonth&&this.disabledConfig.to.year>=this.pageYear:!1},pageMonth(){return this.utils.getMonth(this.pageDate)},pageTitleDay(){return ue.indexOf(this.language.code)!==-1?`${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))},changeMonth({incrementBy:e,focusRefs:t}){const s=this.pageDate;this.utils.setMonth(s,this.utils.getMonth(s)+e),this.$emit("pageChange",{focusRefs:t,pageDate:s})},changePage({incrementBy:e,focusRefs:t}){e===1&&!this.isNextDisabled?this.changeMonth({incrementBy:e,focusRefs:t}):e===-1&&!this.isPreviousDisabled&&this.changeMonth({incrementBy:e,focusRefs:t})},isSelectedDate(e){return this.selectedDate&&this.utils.compareDates(this.selectedDate,e)},isDisabledDate(e){return this.disabledDates?new c(this.utils,this.disabledDates).isDateDisabled(e):!1},isHighlightedDate(e){return this.highlighted?new v(this.utils,this.disabledDates,this.highlighted).isDateHighlighted(e):!1},isHighlightStart(e){return this.highlighted?new v(this.utils,this.disabledDates,this.highlighted).isHighlightStart(e):!1},isHighlightEnd(e){return this.highlighted?new v(this.utils,this.disabledDates,this.highlighted).isHighlightEnd(e):!1},makeDay(e){const{utils:t}=this,s=t.getDay(e),a=e>=this.firstOfNextMonth,l=e<this.pageDate,n=s===6,r=s===0;return{date:this.showEdgeDates||!(l||a)?t.getDate(e):"",timestamp:e.getTime(),isSelected:this.isSelectedDate(e),isDisabled:this.isDisabledDate(e),isHighlighted:this.isHighlightedDate(e),isHighlightStart:this.isHighlightStart(e),isHighlightEnd:this.isHighlightEnd(e),isToday:t.compareDates(e,new Date),isWeekend:n||r,isSaturday:n,isSunday:r,isPreviousMonth:l,isNextMonth:a}}}};function Ne(e,t,s,a,l,n){const r=i.resolveComponent("picker-header"),u=i.resolveComponent("picker-cells");return i.withDirectives((i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([e.calendarClass,"vdp-datepicker__calendar"]),style:i.normalizeStyle(e.calendarStyle),onMousedown:t[5]||(t[5]=i.withModifiers(()=>{},["prevent"]))},[i.renderSlot(e.$slots,"beforeCalendarHeader"),i.createVNode(r,{ref:"pickerHeader","bootstrap-styling":e.bootstrapStyling,"is-next-disabled":n.isNextDisabled,"is-previous-disabled":n.isPreviousDisabled,"is-rtl":e.isRtl,"is-up-disabled":e.isUpDisabled,"next-view-up":"month","up-button-classes":"day__month_btn",onFocusInput:e.focusInput,onPageChange:t[0]||(t[0]=o=>n.changePage(o)),onSetFocus:t[1]||(t[1]=o=>e.$emit("setFocus",o)),onSetView:t[2]||(t[2]=o=>e.$emit("setView",o))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(n.pageTitleDay),1)]),_:1},8,["bootstrap-styling","is-next-disabled","is-previous-disabled","is-rtl","is-up-disabled","onFocusInput"]),i.createElementVNode("div",{class:i.normalizeClass({"flex-rtl":e.isRtl})},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.daysOfWeek,o=>(i.openBlock(),i.createElementBlock("span",{class:"cell day-header",key:o.timestamp},i.toDisplayString(o),1))),128)),i.createVNode(u,{ref:"cells","bootstrap-styling":e.bootstrapStyling,cells:n.days,"is-rtl":e.isRtl,"show-edge-dates":s.showEdgeDates,"tabbable-cell-id":e.tabbableCellId,view:"day",onArrow:t[3]||(t[3]=o=>e.handleArrow(o)),onSelect:t[4]||(t[4]=o=>e.select(o))},{default:i.withCtx(({cell:o})=>[i.createTextVNode(i.toDisplayString(s.dayCellContent(o)),1)]),_:1},8,["bootstrap-styling","cells","is-rtl","show-edge-dates","tabbable-cell-id"])],2)],38)),[[i.vShow,e.visible]])}const Ve=f(Ee,[["render",Ne]]),Ie={name:"PickerMonth",components:{PickerHeader:M,PickerCells:k},mixins:[S],emits:{pageChange:e=>typeof e=="object",setFocus:e=>e.every(t=>["input","prev","up","next","tabbableCell"].includes(t)),setView:e=>e==="year"},computed:{isNextDisabled(){return this.disabledConfig.has.from?this.disabledConfig.from.year<=this.pageYear:!1},isPreviousDisabled(){return this.disabledConfig.has.to?this.disabledConfig.to.year>=this.pageYear:!1},months(){const e=this.pageDate,t=[],s=this.useUtc?new Date(Date.UTC(e.getUTCFullYear(),0,e.getUTCDate())):new Date(e.getFullYear(),0,e.getDate(),e.getHours(),e.getMinutes());for(let a=0;a<12;a++)t.push({month:this.utils.getMonthName(s),timestamp:s.getTime(),isDisabled:this.isDisabledMonth(s),isSelected:this.isSelectedMonth(s),isToday:this.isTodayMonth(s)}),this.utils.setMonth(s,this.utils.getMonth(s)+1);return t},pageTitleMonth(){const e=C[this.language]||"";return`${this.pageYear}${e}`}},methods:{changeYear({incrementBy:e,focusRefs:t}){const s=this.pageDate;this.utils.setFullYear(s,this.utils.getFullYear(s)+e),this.$emit("pageChange",{focusRefs:t,pageDate:s})},changePage({incrementBy:e,focusRefs:t}){e===1&&!this.isNextDisabled?this.changeYear({incrementBy:e,focusRefs:t}):e===-1&&!this.isPreviousDisabled&&this.changeYear({incrementBy:e,focusRefs:t})},isSelectedMonth(e){return this.selectedDate&&this.utils.getFullYear(this.selectedDate)===this.utils.getFullYear(e)&&this.utils.getMonth(this.selectedDate)===this.utils.getMonth(e)},isDisabledMonth(e){return this.disabledDates?new c(this.utils,this.disabledDates).isMonthDisabled(e):!1},isTodayMonth(e){const{utils:t}=this,s=new Date(t.setDate(t.getNewDateObject(),1));return t.compareDates(e,s)}}};function Be(e,t,s,a,l,n){const r=i.resolveComponent("picker-header"),u=i.resolveComponent("picker-cells");return i.withDirectives((i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([e.calendarClass,"vdp-datepicker__calendar"]),style:i.normalizeStyle(e.calendarStyle),onMousedown:t[5]||(t[5]=i.withModifiers(()=>{},["prevent"]))},[i.renderSlot(e.$slots,"beforeCalendarHeader"),i.createVNode(r,{ref:"pickerHeader","bootstrap-styling":e.bootstrapStyling,"is-next-disabled":n.isNextDisabled,"is-previous-disabled":n.isPreviousDisabled,"is-rtl":e.isRtl,"is-up-disabled":e.isUpDisabled,"next-view-up":"year","up-button-classes":"month__year_btn",onFocusInput:e.focusInput,onPageChange:t[0]||(t[0]=o=>n.changePage(o)),onSetFocus:t[1]||(t[1]=o=>e.$emit("setFocus",o)),onSetView:t[2]||(t[2]=o=>e.$emit("setView",o))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(n.pageTitleMonth),1)]),_:1},8,["bootstrap-styling","is-next-disabled","is-previous-disabled","is-rtl","is-up-disabled","onFocusInput"]),i.createVNode(u,{ref:"cells","bootstrap-styling":e.bootstrapStyling,cells:n.months,"is-rtl":e.isRtl,"tabbable-cell-id":e.tabbableCellId,view:"month",onArrow:t[3]||(t[3]=o=>e.handleArrow(o)),onSelect:t[4]||(t[4]=o=>e.select(o))},{default:i.withCtx(({cell:o})=>[i.createTextVNode(i.toDisplayString(o.month),1)]),_:1},8,["bootstrap-styling","cells","is-rtl","tabbable-cell-id"])],38)),[[i.vShow,e.visible]])}const Oe=f(Ie,[["render",Be]]),Ae={name:"PickerYear",components:{PickerHeader:M,PickerCells:k},mixins:[S],props:{highlighted:{type:Object,default(){return{}}}},emits:{pageChange:e=>typeof e=="object",setFocus:e=>e.every(t=>["input","prev","up","next","tabbableCell"].includes(t))},computed:{isNextDisabled(){return this.disabledConfig.has.from?this.disabledConfig.from.year<=this.pageDecadeEnd:!1},isPreviousDisabled(){return this.disabledConfig.has.to?this.disabledConfig.to.year>=this.pageDecadeStart:!1},pageDecadeStart(){return Math.floor(this.pageYear/10)*10},pageDecadeEnd(){return this.pageDecadeStart+10-1},years(){const e=this.pageDate,t=[],s=this.useUtc?new Date(Date.UTC(Math.floor(e.getUTCFullYear()/10)*10,e.getUTCMonth(),e.getUTCDate())):new Date(Math.floor(e.getFullYear()/10)*10,e.getMonth(),e.getDate(),e.getHours(),e.getMinutes());for(let a=0;a<10;a++)t.push({year:this.utils.getFullYear(s),timestamp:s.getTime(),isDisabled:this.isDisabledYear(s),isSelected:this.isSelectedYear(s),isToday:this.isTodayYear(s)}),this.utils.setFullYear(s,this.utils.getFullYear(s)+1);return t},pageTitleYear(){const e=C[this.language]||"";return`${this.pageDecadeStart} - ${this.pageDecadeEnd}${e}`}},methods:{changeYear({incrementBy:e,focusRefs:t}){const s=this.pageDate;this.utils.setFullYear(s,this.utils.getFullYear(s)+e),this.$emit("pageChange",{focusRefs:t,pageDate:s})},changePage({incrementBy:e,focusRefs:t}){e===1&&!this.isNextDisabled?this.changeYear({incrementBy:e*10,focusRefs:t}):e===-1&&!this.isPreviousDisabled&&this.changeYear({incrementBy:e*10,focusRefs:t})},isSelectedYear(e){return this.selectedDate&&this.utils.getFullYear(this.selectedDate)===this.utils.getFullYear(e)},isDisabledYear(e){return this.disabledDates?new c(this.utils,this.disabledDates).isYearDisabled(e):!1},isTodayYear(e){const{utils:t}=this,s=t.getFullYear(t.getNewDateObject());return t.getFullYear(e)===s}}};function Ue(e,t,s,a,l,n){const r=i.resolveComponent("picker-header"),u=i.resolveComponent("picker-cells");return i.withDirectives((i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([e.calendarClass,"vdp-datepicker__calendar"]),style:i.normalizeStyle(e.calendarStyle),onMousedown:t[4]||(t[4]=i.withModifiers(()=>{},["prevent"]))},[i.renderSlot(e.$slots,"beforeCalendarHeader"),i.createVNode(r,{ref:"pickerHeader","bootstrap-styling":e.bootstrapStyling,"is-next-disabled":n.isNextDisabled,"is-previous-disabled":n.isPreviousDisabled,"is-rtl":e.isRtl,"is-up-disabled":!0,onFocusInput:e.focusInput,onPageChange:t[0]||(t[0]=o=>n.changePage(o)),onSetFocus:t[1]||(t[1]=o=>e.$emit("setFocus",o))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(n.pageTitleYear),1)]),_:1},8,["bootstrap-styling","is-next-disabled","is-previous-disabled","is-rtl","onFocusInput"]),i.createVNode(u,{ref:"cells","bootstrap-styling":e.bootstrapStyling,cells:n.years,"is-rtl":e.isRtl,"tabbable-cell-id":e.tabbableCellId,view:"year",onArrow:t[2]||(t[2]=o=>e.handleArrow(o)),onSelect:t[3]||(t[3]=o=>e.select(o))},{default:i.withCtx(({cell:o})=>[i.createTextVNode(i.toDisplayString(o.year),1)]),_:1},8,["bootstrap-styling","cells","is-rtl","tabbable-cell-id"])],38)),[[i.vShow,e.visible]])}const Ye=f(Ae,[["render",Ue]]),xe={name:"DatePicker",components:{DateInput:pe,PickerDay:Ve,PickerMonth:Oe,PickerYear:Ye},mixins:[E,De],props:{calendarClass:{type:[String,Object,Array],default:""},dayCellContent:{type:Function},disabledDates:{type:Object},firstDayOfWeek:{type:String},fullMonthName:{type:Boolean},highlighted:{type:Object},initialView:{type:String,default:""},language:{type:Object,default(){return p}},maximumView:{type:String,default:"year"},minimumView:{type:String,default:"day"},mondayFirst:{type:Boolean},openDate:{validator:e=>F.validateDateInput(e)},parseTypedDate:{type:Function},showEdgeDates:{type:Boolean,default:!1},twoLetterAbbr:{type:Boolean},modelValue:{validator:e=>F.validateDateInput(e)},wrapperClass:{type:[String,Object,Array],default:""}},emits:{changedMonth:e=>typeof e=="object",changedYear:e=>typeof e=="object",changedDecade:e=>typeof e=="object",cleared:null,closed:null,"update:modelValue":e=>e instanceof Date||e===null,opened:null,selected:e=>e instanceof Date||e===null,selectedDisabled:e=>typeof e=="object"},data(){const e=this.openDate?new Date(this.openDate):new Date,t=h(this.useUtc,this.language);return{calendarHeight:0,isClickOutside:!1,latestValidTypedDate:null,pageTimestamp:t.setDate(e,1),selectedDate:null,slideDuration:250,resetTypedDate:new Date,utils:t,view:""}},watch:{disabledDates:{handler(){const e=this.selectedDate||this.parseValue(this.modelValue);if(e){if(this.isDateDisabled(e)&&e){this.setDate(null);return}this.dateHasChanged(e)&&this.setDate(e)}},deep:!0},initialView(){this.isOpen&&this.setInitialView()},language(e){this.utils=h(this.useUtc,e)},latestValidTypedDate(e){this.setPageDate(e)},useUtc(e){this.utils=h(e,this.language)},modelValue(e){this.setValue(e)},openDate(){this.setPageDate()},view(e,t){this.handleViewChange(e,t)}},computed:{computedInitialView(){return this.initialView?this.initialView:this.minimumView},computedOpenDate(){const e=this.parseValue(this.openDate),t=this.utils.getNewDateObject(e),s=