UNPKG

@quasar/quasar-ui-qcalendar

Version:

QCalendar - Day/Month/Week Calendars, Popups, Date Pickers, Schedules, Agendas, Planners and Tasks for your Vue Apps

6 lines 46.4 kB
/*! * @quasar/quasar-ui-qcalendar v4.1.2 * (c) 2025 Jeff Galbraith <jeff@quasar.dev> * Released under the MIT License. */ import{reactive,ref,computed,withDirectives,h,watch,getCurrentInstance,onBeforeUnmount,defineComponent,onBeforeUpdate,onMounted,Transition}from"vue";const PARSE_DATETIME=/^(\d{4})-(\d{1,2})(-(\d{1,2}))?([^\d]+(\d{1,2}))?(:(\d{1,2}))?(:(\d{1,2}))?(.(\d{1,3}))?$/,PARSE_DATE=/^(\d{4})-(\d{1,2})(-(\d{1,2}))?/,PARSE_TIME=/(\d\d?)(:(\d\d?)|)(:(\d\d?)|)/,DAYS_IN_MONTH=[0,31,28,31,30,31,30,31,31,30,31,30,31],DAYS_IN_MONTH_LEAP=[0,31,29,31,30,31,30,31,31,30,31,30,31],TIME_CONSTANTS={MILLISECONDS_IN:{SECOND:1e3,MINUTE:6e4,HOUR:36e5,DAY:864e5,WEEK:6048e5},SECONDS_IN:{MINUTE:60,HOUR:3600,DAY:86400,WEEK:604800},MINUTES_IN:{MINUTE:1,HOUR:60,DAY:1440,WEEK:10080},HOURS_IN:{DAY:24,WEEK:168},DAYS_IN:{WEEK:7}},DAYS_IN_MONTH_MIN=28,DAYS_IN_MONTH_MAX=31,MONTH_MAX=12,MONTH_MIN=1,DAY_MIN=1,FIRST_HOUR=0;function validateTimestamp(e){return"string"===typeof e&&PARSE_DATETIME.test(e)}function parsed(e){if("string"!==typeof e)return null;const t=PARSE_DATETIME.exec(e);if(!t||!t[1]||!t[2])return null;const a=parseInt(t[1],10),n=parseInt(t[2],10),r=parseInt(t[4]||"1",10),o=parseInt(t[6]||"0",10),i=parseInt(t[8]||"0",10);return{date:e,time:o.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0"),year:a,month:n,day:r,hour:o,minute:i,hasDay:!!t[4],hasTime:!0,past:!1,current:!1,future:!1,disabled:!1,weekday:0,doy:0,workweek:0}}function parseDate(e,t=!1){if(!(e instanceof Date))return null;const a=t?"UTC":"";return updateFormatted({date:padNumber(e[`get${a}FullYear`](),4)+"-"+padNumber(e[`get${a}Month`]()+1,2)+"-"+padNumber(e[`get${a}Date`](),2),time:padNumber(e[`get${a}Hours`]()||0,2)+":"+padNumber(e[`get${a}Minutes`]()||0,2),year:e[`get${a}FullYear`](),month:e[`get${a}Month`]()+1,day:e[`get${a}Date`](),hour:e[`get${a}Hours`](),minute:e[`get${a}Minutes`](),weekday:0,doy:0,workweek:0,hasDay:!0,hasTime:!0,past:!1,current:!1,future:!1,disabled:!1})}function padNumber(e,t){let a=String(e);while(a.length<t)a="0"+a;return a}function isLeapYear(e){return e%4===0&&e%100!==0||e%400===0}function daysInMonth(e,t){return(isLeapYear(e)?DAYS_IN_MONTH_LEAP:DAYS_IN_MONTH)[t]}function nextDay(e){const t=new Date(e.year,e.month-1,e.day+1);return updateFormatted(normalizeTimestamp({...e,year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}))}function prevDay(e){const t=new Date(e.year,e.month-1,e.day-1);return updateFormatted(normalizeTimestamp({...e,year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}))}function today(){const e=new Date,t=e.getMonth()+1,a=e.getDate(),n=e.getFullYear();return[n,padNumber(t,2),padNumber(a,2)].join("-")}function isToday(e){return e===today()}function getStartOfWeek(e,t,a){let n=copyTimestamp(e);if(t){if(1===n.day||0===n.weekday)while(!t.includes(Number(n.weekday)))n=nextDay(n);n=findWeekday(n,t[0],prevDay),n=updateFormatted(n),a&&(n=updateRelative(n,a,n.hasTime))}return n}function getEndOfWeek(e,t,a){let n=copyTimestamp(e);if(t&&Array.isArray(t)){const r=daysInMonth(n.year,n.month);if(r===n.day||n.weekday===t[t.length-1])while(!t.includes(Number(n.weekday)))n=prevDay(n);n=findWeekday(n,t[t.length-1],nextDay),n=updateFormatted(n),a&&(n=updateRelative(n,a,n.hasTime))}return n}function getStartOfMonth(e){let t=copyTimestamp(e);return t.day=DAY_MIN,t=updateFormatted(t),t}function getEndOfMonth(e){let t=copyTimestamp(e);return t.day=daysInMonth(t.year,t.month),t=updateFormatted(t),t}function parseTime(e){const t=Object.prototype.toString.call(e);switch(t){case"[object Number]":return e;case"[object String]":{const a=PARSE_TIME.exec(e);return a?60*parseInt(a[1],10)+parseInt(a[3]||"0",10):!1}case"[object Object]":return"object"!==typeof e||"number"!==typeof e.hour||"number"!==typeof e.minute?!1:"object"===typeof e&&"hour"in e&&"minute"in e&&60*e.hour+e.minute}return!1}function compareTimestamps(e,t){return!(!e||!t)&&e.year===t.year&&e.month===t.month&&e.day===t.day&&e.hour===t.hour&&e.minute===t.minute}function compareDate(e,t){return getDate(e)===getDate(t)}function compareTime(e,t){return getTime(e)===getTime(t)}function compareDateTime(e,t){return getDateTime(e)===getDateTime(t)}function parseTimestamp(e,t=null){let a=parsed(e);return a?(a=updateFormatted(a),t&&(a=updateRelative(a,t,a.hasTime)),a):null}function getDayIdentifier(e){return 1e8*(e.year??0)+1e6*(e.month??0)+1e4*(e.day??0)}function getTimeIdentifier(e){return 100*(e.hour??0)+(e.minute??0)}function getDayTimeIdentifier(e){return getDayIdentifier(e)+getTimeIdentifier(e)}function diffTimestamp(e,t,a=!1){const n=Date.UTC(e.year??0,(e.month??1)-1,e.day??1,e.hour??0,e.minute??0),r=Date.UTC(t.year??0,(t.month??1)-1,t.day??1,t.hour??0,t.minute??0);return!0===a&&r<n?0:r-n}function updateRelative(e,t,a=!1){let n=copyTimestamp(e),r=getDayIdentifier(t),o=getDayIdentifier(n),i=r===o;return n.hasTime&&a&&i&&(r=getTimeIdentifier(t),o=getTimeIdentifier(n),i=r===o),n.past=o<r,n.current=i,n.future=o>r,n.currentWeekday=n.weekday===t.weekday,n}function updateMinutes(e,t,a=null){let n=copyTimestamp(e);return n.hasTime=!0,n.hour=Math.floor(t/TIME_CONSTANTS.MINUTES_IN.HOUR),n.minute=t%TIME_CONSTANTS.MINUTES_IN.HOUR,n.time=getTime(n),a&&(n=updateRelative(n,a,!0)),n}function updateWeekday(e){let t=copyTimestamp(e);return t.weekday=getWeekday(t),t}function updateDayOfYear(e){let t=copyTimestamp(e);return t.doy=getDayOfYear(t)||0,t}function updateWorkWeek(e){let t=copyTimestamp(e);return t.workweek=getWorkWeek(t),t}function updateDisabled(e,t,a,n,r){let o=copyTimestamp(e);const i=getDayIdentifier(o);if(void 0!==t){const l=parsed(t);if(l){const c=getDayIdentifier(l);i<=c&&(o.disabled=!0)}}if(!0!==o.disabled&&void 0!==a){const m=parsed(a);if(m){const p=getDayIdentifier(m);i>=p&&(o.disabled=!0)}}if(!0!==o.disabled&&Array.isArray(n)&&n.length>0)for(var u in n)if(n[u]===o.weekday){o.disabled=!0;break}if(!0!==o.disabled&&Array.isArray(r)&&r.length>0)for(var s in r)if(Array.isArray(r[s])&&2===r[s].length&&r[s][0]&&r[s][1]){const v=parsed(r[s][0]),y=parsed(r[s][1]);if(v&&y&&isBetweenDates(o,v,y)){o.disabled=!0;break}}else{const f=r[s];if(Array.isArray(f))for(var d of f){const g=parseTimestamp(d);if(g){const h=getDayIdentifier(g);if(h===i){o.disabled=!0;break}}}else if(f){const T=parseTimestamp(f);if(T){const D=getDayIdentifier(T);D===i&&(o.disabled=!0)}}}return o}function updateFormatted(e){let t=copyTimestamp(e);return t.hasTime=!0,t.time=getTime(t),t.date=getDate(t),t.weekday=getWeekday(t),t.doy=getDayOfYear(t)||0,t.workweek=getWorkWeek(t),t}function getDayOfYear(e){if(0!==e.year)return(Date.UTC(e.year,e.month-1,e.day)-Date.UTC(e.year,0,0))/24/60/60/1e3}function getWorkWeek(e){let t=copyTimestamp(e);if(0===t.year){const r=parseTimestamp(today());r&&(t=r)}const a=new Date(Date.UTC(t.year,t.month-1,t.day)),n=4;a.setUTCDate(a.getUTCDate()-(a.getUTCDay()+6)%7+n),a.setUTCDate(a.getUTCDate()+n-(a.getUTCDay()||7));e=new Date(Date.UTC(a.getUTCFullYear(),0,1)),e=Math.ceil(((a.valueOf()-e.valueOf())/864e5+1)/7);return e}function getWeekday(e){let t=e.weekday;if(e.hasDay){const a=Math.floor,n=e.day,r=(e.month+9)%MONTH_MAX+1,o=a(e.year/100),i=e.year%100-(e.month<=2?1:0);t=((n+a(2.6*r-.2)-2*o+i+a(i/4)+a(o/4))%7+7)%7}return t??0}function copyTimestamp(e){return{...e}}function getDate(e){let t=padNumber(e.year,4)+"-"+padNumber(e.month,2);return e.hasDay&&(t+="-"+padNumber(e.day,2)),t}function getTime(e){return e.hasTime?padNumber(e.hour,2)+":"+padNumber(e.minute,2):""}function getDateTime(e){return getDate(e)+" "+(e.hasTime?getTime(e):"00:00")}function moveRelativeDays(e,t=nextDay,a=1,n=[0,1,2,3,4,5,6]){const r=copyTimestamp(e);return relativeDays(r,t,a,n)}function relativeDays(e,t=nextDay,a=1,n=[0,1,2,3,4,5,6]){let r=copyTimestamp(e);n.includes(Number(r.weekday))||0!==r.weekday||t!==nextDay||++a;while(--a>=0)r=t(r),n.length<7&&!n.includes(Number(r.weekday))&&++a;return r}function findWeekday(e,t,a=nextDay,n=6){let r=copyTimestamp(e);while(r.weekday!==t&&--n>=0)r=a(r);return r}function createDayList(e,t,a,n=[0,1,2,3,4,5,6],r=void 0,o=void 0,i=[],u=[],s=42,d=0){const l=getDayIdentifier(e),c=getDayIdentifier(t),m=[];let p=copyTimestamp(e),v=0,y=v===c;if(!(c<l))while((!y||m.length<d)&&m.length<s){if(v=getDayIdentifier(p),y=y||v>c&&m.length>=d,y)break;if(n.includes(Number(p.weekday))){let e=copyTimestamp(p);e=updateFormatted(e),e=updateRelative(e,a),e=updateDisabled(e,r,o,i,u),m.push(e)}p=relativeDays(p,nextDay)}return m}function createIntervalList(t,a,n,r,o){const i=[];for(let e=0;e<r;++e){const u=(a+e)*n,s=copyTimestamp(t);i.push(updateMinutes(s,u,o))}return i}function createNativeLocaleFormatter(n,r){const e=()=>"";return"undefined"===typeof Intl||"undefined"===typeof Intl.DateTimeFormat?e:(t,e)=>{try{const a=new Intl.DateTimeFormat(n||void 0,r(t,e));return a.format(makeDateTime(t))}catch(e){return console.error(`Intl.DateTimeFormat: ${e.message} -> `+getDateTime(t)),""}}}function makeDate(e,t=!0){return t?new Date(Date.UTC(e.year,e.month-1,e.day,0,0)):new Date(e.year,e.month-1,e.day,0,0)}function makeDateTime(e,t=!0){return t?new Date(Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute)):new Date(e.year,e.month-1,e.day,e.hour,e.minute)}function validateNumber(e){return isFinite(Number(e))}function maxTimestamp(e,t=!1){const a=!0===t?getDayTimeIdentifier:getDayIdentifier;return e.reduce((e,t)=>{return Math.max(a(e),a(t))===a(e)?e:t})}function minTimestamp(e,t=!1){const a=!0===t?getDayTimeIdentifier:getDayIdentifier;return e.reduce((e,t)=>{return Math.min(a(e),a(t))===a(e)?e:t})}function isBetweenDates(e,t,a,n=!1){const r=getDayIdentifier(e)+(!0===n?getTimeIdentifier(e):0),o=getDayIdentifier(t)+(!0===n?getTimeIdentifier(t):0),i=getDayIdentifier(a)+(!0===n?getTimeIdentifier(a):0);return r>=o&&r<=i}function isOverlappingDates(e,t,a,n){const r=getDayIdentifier(e),o=getDayIdentifier(t),i=getDayIdentifier(a),u=getDayIdentifier(n);return r>=i&&r<=u||o>=i&&o<=u||i>=r&&o>=u}function addToDate(e,t){const a=copyTimestamp(e);return t.year&&(a.year+=t.year),t.month&&(a.month+=t.month),t.day&&(a.day+=t.day),t.hour&&(a.hour+=t.hour),t.minute&&(a.minute+=t.minute),updateFormatted(normalizeTimestamp(a))}function normalizeTimestamp(e){const t=new Date(e.year,e.month-1,e.day,e.hour,e.minute);return{...e,year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes()}}function daysBetween(e,t){const a=diffTimestamp(e,t,!0);return Math.floor(a/TIME_CONSTANTS.MILLISECONDS_IN.DAY)}function weeksBetween(e,t){let a=copyTimestamp(e),n=copyTimestamp(t);return a=findWeekday(a,0),n=findWeekday(n,6),Math.ceil(daysBetween(a,n)/TIME_CONSTANTS.DAYS_IN.WEEK)}const weekdayDateMap={Sun:new Date("2020-01-05T00:00:00.000Z"),Mon:new Date("2020-01-06T00:00:00.000Z"),Tue:new Date("2020-01-07T00:00:00.000Z"),Wed:new Date("2020-01-08T00:00:00.000Z"),Thu:new Date("2020-01-09T00:00:00.000Z"),Fri:new Date("2020-01-10T00:00:00.000Z"),Sat:new Date("2020-01-11T00:00:00.000Z")};function getWeekdayFormatter(){const e=()=>"",r={long:{timeZone:"UTC",weekday:"long"},short:{timeZone:"UTC",weekday:"short"},narrow:{timeZone:"UTC",weekday:"narrow"}};return"undefined"===typeof Intl||"undefined"===typeof Intl.DateTimeFormat?e:t;function t(t,e,a){try{const n=new Intl.DateTimeFormat(a||void 0,r[e]||r["long"]);return n.format(weekdayDateMap[t])}catch(e){return e instanceof Error&&console.error(`Intl.DateTimeFormat: ${e.message} -> day of week: `+t),""}}}function getWeekdayNames(t,a){const e=Object.keys(weekdayDateMap),n=getWeekdayFormatter();return e.map(e=>String(n(e,t,a)))}function getMonthFormatter(){const e=()=>"",o={long:{timeZone:"UTC",month:"long"},short:{timeZone:"UTC",month:"short"},narrow:{timeZone:"UTC",month:"narrow"}};return"undefined"===typeof Intl||"undefined"===typeof Intl.DateTimeFormat?e:t;function t(t,e,a){try{const n=new Intl.DateTimeFormat(a||void 0,o[e]||o["long"]),r=new Date;return r.setDate(1),r.setMonth(t),n.format(r)}catch(e){return e instanceof Error&&console.error(`Intl.DateTimeFormat: ${e.message} -> month: `+t),""}}}function getMonthNames(t,a){const n=getMonthFormatter();return[...Array(12).keys()].map(e=>n(e,t,a))}var Timestamp={PARSE_DATETIME:PARSE_DATETIME,PARSE_DATE:PARSE_DATE,PARSE_TIME:PARSE_TIME,DAYS_IN_MONTH:DAYS_IN_MONTH,DAYS_IN_MONTH_LEAP:DAYS_IN_MONTH_LEAP,DAYS_IN_MONTH_MIN:DAYS_IN_MONTH_MIN,DAYS_IN_MONTH_MAX:DAYS_IN_MONTH_MAX,MONTH_MAX:MONTH_MAX,MONTH_MIN:MONTH_MIN,DAY_MIN:DAY_MIN,TIME_CONSTANTS:TIME_CONSTANTS,FIRST_HOUR:FIRST_HOUR,today:today,getStartOfWeek:getStartOfWeek,getEndOfWeek:getEndOfWeek,getStartOfMonth:getStartOfMonth,getEndOfMonth:getEndOfMonth,parseTime:parseTime,validateTimestamp:validateTimestamp,parsed:parsed,parseTimestamp:parseTimestamp,parseDate:parseDate,getDayIdentifier:getDayIdentifier,getTimeIdentifier:getTimeIdentifier,getDayTimeIdentifier:getDayTimeIdentifier,diffTimestamp:diffTimestamp,updateRelative:updateRelative,updateMinutes:updateMinutes,updateWeekday:updateWeekday,updateDayOfYear:updateDayOfYear,updateWorkWeek:updateWorkWeek,updateDisabled:updateDisabled,updateFormatted:updateFormatted,getDayOfYear:getDayOfYear,getWorkWeek:getWorkWeek,getWeekday:getWeekday,isLeapYear:isLeapYear,daysInMonth:daysInMonth,copyTimestamp:copyTimestamp,padNumber:padNumber,getDate:getDate,getTime:getTime,getDateTime:getDateTime,nextDay:nextDay,prevDay:prevDay,relativeDays:relativeDays,findWeekday:findWeekday,createDayList:createDayList,createIntervalList:createIntervalList,createNativeLocaleFormatter:createNativeLocaleFormatter,makeDate:makeDate,makeDateTime:makeDateTime,validateNumber:validateNumber,isBetweenDates:isBetweenDates,isOverlappingDates:isOverlappingDates,daysBetween:daysBetween,weeksBetween:weeksBetween,addToDate:addToDate,compareTimestamps:compareTimestamps,compareDate:compareDate,compareTime:compareTime,compareDateTime:compareDateTime,getWeekdayFormatter:getWeekdayFormatter,getWeekdayNames:getWeekdayNames,getMonthFormatter:getMonthFormatter,getMonthNames:getMonthNames},Timestamp$1=Object.freeze({__proto__:null,DAYS_IN_MONTH:DAYS_IN_MONTH,DAYS_IN_MONTH_LEAP:DAYS_IN_MONTH_LEAP,DAYS_IN_MONTH_MAX:DAYS_IN_MONTH_MAX,DAYS_IN_MONTH_MIN:DAYS_IN_MONTH_MIN,DAY_MIN:DAY_MIN,FIRST_HOUR:FIRST_HOUR,MONTH_MAX:MONTH_MAX,MONTH_MIN:MONTH_MIN,PARSE_DATE:PARSE_DATE,PARSE_DATETIME:PARSE_DATETIME,PARSE_TIME:PARSE_TIME,TIME_CONSTANTS:TIME_CONSTANTS,addToDate:addToDate,compareDate:compareDate,compareDateTime:compareDateTime,compareTime:compareTime,compareTimestamps:compareTimestamps,copyTimestamp:copyTimestamp,createDayList:createDayList,createIntervalList:createIntervalList,createNativeLocaleFormatter:createNativeLocaleFormatter,daysBetween:daysBetween,daysInMonth:daysInMonth,default:Timestamp,diffTimestamp:diffTimestamp,findWeekday:findWeekday,getDate:getDate,getDateTime:getDateTime,getDayIdentifier:getDayIdentifier,getDayOfYear:getDayOfYear,getDayTimeIdentifier:getDayTimeIdentifier,getEndOfMonth:getEndOfMonth,getEndOfWeek:getEndOfWeek,getMonthFormatter:getMonthFormatter,getMonthNames:getMonthNames,getStartOfMonth:getStartOfMonth,getStartOfWeek:getStartOfWeek,getTime:getTime,getTimeIdentifier:getTimeIdentifier,getWeekday:getWeekday,getWeekdayFormatter:getWeekdayFormatter,getWeekdayNames:getWeekdayNames,getWorkWeek:getWorkWeek,isBetweenDates:isBetweenDates,isLeapYear:isLeapYear,isOverlappingDates:isOverlappingDates,isToday:isToday,makeDate:makeDate,makeDateTime:makeDateTime,maxTimestamp:maxTimestamp,minTimestamp:minTimestamp,moveRelativeDays:moveRelativeDays,nextDay:nextDay,padNumber:padNumber,parseDate:parseDate,parseTime:parseTime,parseTimestamp:parseTimestamp,parsed:parsed,prevDay:prevDay,relativeDays:relativeDays,today:today,updateDayOfYear:updateDayOfYear,updateDisabled:updateDisabled,updateFormatted:updateFormatted,updateMinutes:updateMinutes,updateRelative:updateRelative,updateWeekday:updateWeekday,updateWorkWeek:updateWorkWeek,validateNumber:validateNumber,validateTimestamp:validateTimestamp,weeksBetween:weeksBetween});function convertToUnit(e,t="px"){if(e)return isNaN(e)?String(e):"auto"===e?e:""+Number(e)+t}function indexOf(t,a){for(let e=0;e<t.length;e++)if(!0===a(t[e],e))return e;return-1}function minCharWidth(e,t){return 0===t?e:e.slice(0,t)}var helpers={convertToUnit:convertToUnit,indexOf:indexOf,minCharWidth:minCharWidth},helpers$1=Object.freeze({__proto__:null,convertToUnit:convertToUnit,default:helpers,indexOf:indexOf,minCharWidth:minCharWidth});const ResizeObserverDirective={mounted(e,t){if("function"===typeof t.value){const a=t.value,n={callback:a,size:{width:0,height:0},observer:new ResizeObserver(e=>{const t=e[0].contentRect;t.width===n.size.width&&t.height===n.size.height||(n.size.width=t.width,n.size.height=t.height,n.debounceTimeout&&clearTimeout(n.debounceTimeout),n.debounceTimeout=setTimeout(()=>{n.callback(n.size),n.debounceTimeout=void 0},100))})};n.observer.observe(e),e.__onResizeObserver=n}},beforeUnmount(e){if(e.__onResizeObserver){const{observer:t,debounceTimeout:a}=e.__onResizeObserver;a&&clearTimeout(a),t.unobserve(e),delete e.__onResizeObserver}}};function useCalendar(t,a,{scrollArea:e,pane:n}){if(!a){const l="[error: renderCalendar] no renderFunc has been supplied to useCalendar";throw console.error(l),new Error(l)}const r=reactive({width:0,height:0}),o=ref(null);function i({width:e,height:t}){r.width=e,r.height=t}const u=computed(()=>{return!0!==t.noScroll&&e.value&&n.value&&r.height?e.value.offsetWidth-n.value.offsetWidth:0});function s(){}function d(){const e={ref:o,role:"complementary",lang:t.locale,class:`q-calendar ${t.dark?"q-calendar--dark":""} `+(t.bordered?"q-calendar__bordered":"")};return withDirectives(h("div",{...e},[a()]),[[ResizeObserverDirective,i]])}return{rootRef:o,scrollWidth:u,__initCalendar:s,__renderCalendar:d}}const isValidFocusType=e=>e.every(e=>["day","date","weekday","interval","time","resource","task"].includes(e)),useCommonProps={modelValue:{type:String,default:today(),validator:e=>""===e||validateTimestamp(e)},weekdays:{type:Array,default:()=>[0,1,2,3,4,5,6]},dateType:{type:String,default:"round",validator:e=>["round","rounded","square"].includes(e)},weekdayAlign:{type:String,default:"center",validator:e=>["left","center","right"].includes(e)},dateAlign:{type:String,default:"center",validator:e=>["left","center","right"].includes(e)},bordered:Boolean,dark:Boolean,noAria:Boolean,noActiveDate:Boolean,noHeader:Boolean,noScroll:Boolean,shortWeekdayLabel:Boolean,noDefaultHeaderText:Boolean,noDefaultHeaderBtn:Boolean,minWeekdayLabel:{type:[Number,String],default:1},weekdayBreakpoints:{type:Array,default:()=>[75,35],validator:e=>2===e.length},locale:{type:String,default:"en-US"},animated:Boolean,transitionPrev:{type:String,default:"slide-right"},transitionNext:{type:String,default:"slide-left"},disabledDays:Array,disabledBefore:String,disabledAfter:String,disabledWeekdays:{type:Array,default:()=>[]},dragEnterFunc:Function,dragOverFunc:Function,dragLeaveFunc:Function,dropFunc:Function,selectedDates:{type:[Array,Set],default:()=>[]},selectedStartEndDates:{type:Array,default:()=>[]},hoverable:Boolean,focusable:Boolean,focusType:{type:Array,default:()=>["date"],validator:isValidFocusType}};function useCommon(t,{startDate:e,endDate:a,times:n}){const r=computed(()=>parseTimestamp(e.value)),o=computed(()=>{return"0000-00-00"===a.value?getEndOfWeek(r.value,t.weekdays,n.today):parseTimestamp(a.value)||r.value}),i=computed(()=>createNativeLocaleFormatter(t.locale,()=>({timeZone:"UTC",day:"numeric"}))),u=computed(()=>createNativeLocaleFormatter(t.locale,(e,t)=>({timeZone:"UTC",weekday:t?"short":"long"}))),s=computed(()=>createNativeLocaleFormatter(t.locale,()=>({timeZone:"UTC",dateStyle:"full"})));function d(e,t){return e&&e.length>0&&e.includes(t.date)}function l(e,t){const a={firstDay:!1,betweenDays:!1,lastDay:!1};if(2===e.length){const n=getDayIdentifier(t),r=getDayIdentifier(parsed(e[0])),o=getDayIdentifier(parsed(e[1]));a.firstDay=r===n,a.lastDay=o===n,a.betweenDays=r<n&&o>n}return a}function c(e,t=!1,a=[],n=[],r=!1){const o=d(a,e),{firstDay:i,lastDay:u,betweenDays:s}=l(n,e);return{"q-past-day":!i&&!s&&!u&&!o&&!t&&!!e.past,"q-future-day":!i&&!s&&!u&&!o&&!t&&!!e.future,"q-outside":t,"q-current-day":!!e.current,"q-selected":o,"q-range-first":i,"q-range":s,"q-range-last":u,"q-range-hover":r&&(i||u||s),"q-disabled-day disabled":!0===e.disabled}}function m(e){return getStartOfWeek(e,t.weekdays,n.today)}function p(e){return getEndOfWeek(e,t.weekdays,n.today)}function v(){return{}}return{parsedStart:r,parsedEnd:o,dayFormatter:i,weekdayFormatter:u,ariaDateFormatter:s,arrayHasDate:d,checkDays:l,getRelativeClasses:c,startOfWeek:m,endOfWeek:p,dayStyleDefault:v}}function scrollTo(e,t){e instanceof Window?e.scrollTo({top:t,behavior:"instant"}):e.scrollTop=t}function getVerticalScrollPosition(e){return e instanceof Window?e.scrollY:e.scrollTop}function animVerticalScrollTo(o,i,u=500,s=performance.now(),d=getVerticalScrollPosition(o)){u<=0||d===i?scrollTo(o,i):requestAnimationFrame(e=>{const t=e-s,a=Math.min(t/u,1),n=e=>e<.5?2*e*e:(4-2*e)*e-1,r=d+(i-d)*n(a);scrollTo(o,r),a<1&&animVerticalScrollTo(o,i,u,s,d)})}function animHorizontalScrollTo(r,e,o=500){const i=r.scrollLeft,u=e-i;let s=null;function d(e){null===s&&(s=e);const t=e-s,a=Math.min(t/o,1),n=e=>e<.5?2*e*e:(4-2*e)*e-1;r.scrollLeft=i+u*n(a),t<o&&requestAnimationFrame(d)}requestAnimationFrame(d)}const useIntervalProps={view:{type:String,validator:e=>["day","week","month","month-interval"].includes(e),default:"day"},shortIntervalLabel:Boolean,intervalHeight:{type:[Number,String],default:40,validator:validateNumber},intervalMinutes:{type:[Number,String],default:60,validator:validateNumber},intervalStart:{type:[Number,String],default:0,validator:validateNumber},intervalCount:{type:[Number,String],default:24,validator:validateNumber},intervalStyle:{type:Function,default:null},intervalClass:{type:Function,default:null},weekdayStyle:{type:Function,default:null},weekdayClass:{type:Function,default:null},showIntervalLabel:{type:Function,default:null},hour24Format:Boolean,timeClicksClamped:Boolean,dateHeader:{type:String,default:"stacked",validator:e=>["stacked","inline","inverted"].includes(e)}},useResourceProps={modelResources:{type:Array},resourceKey:{type:String,default:"id"},resourceLabel:{type:String,default:"label"},resourceHeight:{type:[Number,String],default:0,validator:validateNumber},resourceMinHeight:{type:[Number,String],default:70,validator:validateNumber},resourceStyle:{type:Function,default:null},resourceClass:{type:Function,default:null},cellWidth:{type:[Number,String],default:100},intervalHeaderHeight:{type:[Number,String],default:20,validator:validateNumber},noSticky:Boolean};function useInterval(o,{times:t,scrollArea:n,parsedStart:e,parsedEnd:a,maxDays:r,size:i,headerColumnRef:u}){const s=computed(()=>parseInt(String(o.intervalStart),10)),m=computed(()=>parseInt(String(o.intervalMinutes),10)),d=computed(()=>parseInt(String(o.intervalCount),10)),p=computed(()=>parseFloat(String(o.intervalHeight))),v=computed(()=>{let e=0;const t=Number(o.columnCount);return o.cellWidth?e=Number(o.cellWidth):i.width>0&&u.value&&(e=u.value.offsetWidth/(t>1?t:r.value)),e}),l=computed(()=>s.value*m.value),c=computed(()=>d.value*p.value),y=computed(()=>d.value*v.value),f=computed(()=>D(e.value)),g=computed(()=>k(a.value)),h=computed(()=>{return createDayList(e.value,a.value,t.today,o.weekdays,o.disabledBefore,o.disabledAfter,o.disabledWeekdays,o.disabledDays,r.value)}),T=computed(()=>{return h.value.map(e=>createIntervalList(e,s.value,m.value,d.value,t.now))});function D(e){return getStartOfWeek(e,o.weekdays,t.today)}function k(e){return getEndOfWeek(e,o.weekdays,t.today)}function w(e,t){return e&&e.length>0&&e.includes(getDateTime(t))}function N(e,t){const a={firstDay:!1,betweenDays:!1,lastDay:!1};if(e&&2===e.length){const n=getDayTimeIdentifier(t),r=getDayTimeIdentifier(parsed(e[0])),o=getDayTimeIdentifier(parsed(e[1]));a.firstDay=r===n,a.lastDay=o===n,a.betweenDays=r<n&&o>n}return a}function M(e,t=[],a=[]){const n=w(t,e),{firstDay:r,lastDay:o,betweenDays:i}=N(a,e);return{"q-selected":n,"q-range-first":!0===r,"q-range":!0===i,"q-range-last":!0===o,"q-disabled-interval disabled":!0===e.disabled}}function _(e,t,a){return[]}const I=computed(()=>{const a={timeZone:"UTC",hour12:!o.hour24Format,hour:"2-digit",minute:"2-digit"},n={timeZone:"UTC",hour12:!o.hour24Format,hour:"numeric",minute:"2-digit"},r={timeZone:"UTC",hour12:!o.hour24Format,hour:"numeric"};return createNativeLocaleFormatter(o.locale,(e,t)=>t?0===e.minute?r:n:a)}),b=computed(()=>{const e={timeZone:"UTC",dateStyle:"full",timeStyle:"short"};return createNativeLocaleFormatter(o.locale,()=>e)});function S(e){const t=T.value[0][0],a=t.hour===e.hour&&t.minute===e.minute;return!a&&0===e.minute}function E(e){}function O(e){return{}}function A(e,t,a=!1,n){let r=copyTimestamp(t);if(e.currentTarget){const o=e.currentTarget.getBoundingClientRect(),i=e,u=e,s=i.changedTouches||i.touches,d=(s&&s[0]?s[0]:u).clientY,l=(d-o.top)/p.value,c=Math.floor((a?Math.floor(l):l)*m.value);0!==c&&(r=addToDate(r,{minute:c})),n&&(r=updateRelative(r,n,!0))}return r}function H(e,t,a=!1,n){let r=copyTimestamp(t);const o=e.currentTarget.getBoundingClientRect(),i=e,u=e,s=i.changedTouches||i.touches,d=(s&&s[0]?s[0]:u).clientY,l=(d-o.top)/p.value,c=Math.floor((a?Math.floor(l):l)*m.value);return 0!==c&&(r=addToDate(r,{minute:c})),n&&(r=updateRelative(r,n,!0)),r}function x(e,t,a=!1,n){let r=copyTimestamp(t);if(e.currentTarget){const o=e.currentTarget.getBoundingClientRect(),i=e,u=e,s=i.changedTouches||i.touches,d=(s&&s[0]?s[0]:u).clientX,l=(d-o.left)/v.value,c=Math.floor((a?Math.floor(l):l)*m.value);0!==c&&(r=addToDate(r,{minute:c})),n&&(r=updateRelative(r,n,!0))}return r}function U(e,t){const a={timestamp:e,timeStartPos:C,timeDurationHeight:F};return void 0!==t&&(a.columnIndex=t),a}function L(e,t){const a={timestamp:copyTimestamp(e),timeStartPosX:R,timeDurationWidth:W};return void 0!==t&&(a.index=t),a}function Y(e,t=0){const a=C(e);return!(!1===a||!n.value)&&(animVerticalScrollTo(n.value,a,t),!0)}function P(e,t=0){const a=R(e);return!(!1===a||!n.value)&&(animHorizontalScrollTo(n.value,a,t),!0)}function F(e){return e/m.value*p.value}function W(e){return e/m.value*v.value}function q(e){return e*m.value/p.value}function B(e){return e*m.value/v.value}function C(e,t=!0){const a=parseTime(e);if(!1===a)return!1;const n=l.value,r=d.value*m.value,o=(a-n)/r;let i=o*c.value;return t&&(i<0&&(i=0),i>c.value)&&(i=c.value),i}function R(e,t=!0){const a=parseTime(e);if(!1===a)return!1;const n=l.value,r=d.value*m.value,o=(a-n)/r;let i=o*y.value;return t&&(i<0&&(i=0),i>y.value)&&(i=y.value),i}return{parsedIntervalStart:s,parsedIntervalMinutes:m,parsedIntervalCount:d,parsedIntervalHeight:p,parsedCellWidth:v,parsedStartMinute:l,bodyHeight:c,bodyWidth:y,parsedWeekStart:f,parsedWeekEnd:g,days:h,intervals:T,intervalFormatter:I,ariaDateTimeFormatter:b,arrayHasDateTime:w,checkIntervals:N,getIntervalClasses:M,getResourceClasses:_,showIntervalLabelDefault:S,showResourceLabelDefault:E,styleDefault:O,getTimestampAtEventInterval:A,getTimestampAtEvent:H,getTimestampAtEventX:x,getScopeForSlot:U,getScopeForSlotX:L,scrollToTime:Y,scrollToTimeX:P,timeDurationHeight:F,timeDurationWidth:W,heightToMinutes:q,widthToMinutes:B,timeStartPos:C,timeStartPosX:R}}const useColumnProps={columnCount:{type:[Number,String],default:0,validator:validateNumber},columnIndexStart:{type:[Number,String],default:0,validator:validateNumber}},useMaxDaysProps={maxDays:{type:Number,default:1}},useTimesProps={now:{type:String,validator:e=>""===e||validateTimestamp(e),default:""}};function useTimes(e){const t=reactive({now:parseTimestamp("0000-00-00 00:00"),today:parseTimestamp("0000-00-00")}),a=computed(()=>e.now?parseTimestamp(e.now):o());function n(){t.now&&t.today&&(t.now.current=t.today.current=!0,t.now.past=t.today.past=!1,t.now.future=t.today.future=!1)}function r(){const e=a.value||o();i(e,t.now),u(e,t.now),i(e,t.today)}function o(){return parseDate(new Date)}function i(e,t){e.date!==t.date&&(t.year=e.year,t.month=e.month,t.day=e.day,t.weekday=e.weekday,t.date=e.date)}function u(e,t){e.time!==t.time&&(t.hour=e.hour,t.minute=e.minute,t.time=e.time)}return watch(a,()=>r()),{times:t,parsedNow:a,setCurrent:n,updateCurrent:r,getNow:o,updateDay:i,updateTime:u}}function useRenderValues(r,{parsedView:o,parsedValue:i,times:u}){const e=computed(()=>{const e=i.value;let t=r.maxDays,a=e,n=e;switch(o.value){case"month":a=getStartOfMonth(e),n=getEndOfMonth(e),t=daysInMonth(a.year,a.month);break;case"week":case"week-agenda":case"week-scheduler":a=getStartOfWeek(e,r.weekdays,u.today),n=getEndOfWeek(a,r.weekdays,u.today),t=r.weekdays.length;break;case"day":case"scheduler":case"agenda":n=moveRelativeDays(copyTimestamp(n),nextDay,t>1?t-1:t,r.weekdays),n=updateFormatted(n);break;case"month-interval":case"month-scheduler":case"month-agenda":a=getStartOfMonth(e),n=getEndOfMonth(e),n=updateFormatted(n),t=daysInMonth(a.year,a.month);break;case"resource":t=1,n=moveRelativeDays(copyTimestamp(n),nextDay,t,r.weekdays),n=updateFormatted(n);break}return{start:a,end:n,maxDays:t}});return{renderValues:e}}const toCamelCase=e=>e.replace(/(-\w)/g,e=>e[1].toUpperCase());function getMouseEventHandlers(t,e,a,n){const r={};for(const o in a){const i=a[o],u=toCamelCase("on-"+o);if(!e.value)return console.warn("$listeners has not been set up"),{};if(void 0!==e.value[u]){const s="on"+i.event.charAt(0).toUpperCase()+i.event.slice(1),d=e=>{return(void 0===i.button||"buttons"in e&&e.buttons>0&&e.button===i.button)&&(i.prevent&&e.preventDefault(),i.stop&&e.stopPropagation(),t(o,n(e,o))),i.result};s in r?Array.isArray(r[s])?r[s].push(d):r[s]=[r[s],d]:r[s]=d}}return r}function getDefaultMouseEventHandlers(e,t,a,n){return getMouseEventHandlers(e,t,getMouseEventName(a),n)}function getMouseEventName(e){return{["click"+e]:{event:"click"},["contextmenu"+e]:{event:"contextmenu",prevent:!0,result:!1},["mousedown"+e]:{event:"mousedown"},["mousemove"+e]:{event:"mousemove"},["mouseup"+e]:{event:"mouseup"},["mouseenter"+e]:{event:"mouseenter"},["mouseleave"+e]:{event:"mouseleave"},["touchstart"+e]:{event:"touchstart"},["touchmove"+e]:{event:"touchmove"},["touchend"+e]:{event:"touchend"}}}function getRawMouseEvents(e){return Object.keys(getMouseEventName(e))}function useMouseEvents(a,n){return{getMouseEventHandlers:(e,t)=>getMouseEventHandlers(a,n,e,t),getDefaultMouseEventHandlers:(e,t)=>getDefaultMouseEventHandlers(a,n,e,t),getMouseEventName:getMouseEventName,getRawMouseEvents:getRawMouseEvents}}const useMoveEmits=["moved"];function useMove(s,{parsedView:d,parsedValue:l,direction:c,maxDays:m,times:p,emittedValue:v,emit:y}){function e(a=1){if(0===a)v.value=today();else{let e=copyTimestamp(l.value);const n=getEndOfMonth(e),r=a>0,o=r?nextDay:prevDay,i=r?n.day:1;let t=r?a:-a;c.value=r?"next":"prev";const u=s.weekdays.length;while(--t>=0)switch(d.value){case"month":e.day=i,e=o(e),e=updateWeekday(e);while(!s.weekdays.includes(Number(e.weekday)))e=addToDate(e,{day:r?1:-1});break;case"week":case"week-agenda":case"week-scheduler":e=relativeDays(e,o,u,s.weekdays);break;case"day":case"scheduler":case"agenda":e=relativeDays(e,o,m.value,s.weekdays);break;case"month-interval":case"month-agenda":case"month-scheduler":e.day=i,e=o(e);break;case"resource":e=relativeDays(e,o,m.value,s.weekdays);break}e=updateWeekday(e),e=updateFormatted(e),e=updateDayOfYear(e),e=updateRelative(e,p.now),v.value=e.date,y("moved",e)}}return{move:e}}const listenerRE=/^on[A-Z]/;function useEmitListeners(e=getCurrentInstance()){return{emitListeners:computed(()=>{const t={};return e?.vnode?.props&&Object.keys(e.vnode.props).forEach(e=>{listenerRE.test(e)&&(t[e]=!0)}),t})}}function useFocusHelper(){const e={"aria-hidden":"true",class:"q-calendar__focus-helper"};return[h("span",e)]}const useCheckChangeEmits=["change"];function useCheckChange(n,{days:r,lastStart:o,lastEnd:i}){function e(){const e=r.value;if(0===e.length)return!1;const t=e[0].date,a=e[e.length-1].date;return(!o.value||!i.value||t!==o.value||a!==i.value)&&(o.value=t,i.value=a,n("change",{start:t,end:a,days:e}),!0)}return{checkChange:e}}function useEventUtils(){function e(e,t){return(Array.isArray(t)?t:[t]).includes(e.keyCode)}return{isKeyCode:e}}const isKeyCode=useEventUtils().isKeyCode,useNavigationProps={useNavigation:Boolean};function useNavigation(t,{rootRef:a,focusRef:n,focusValue:r,datesRef:o,parsedView:i,emittedValue:u,direction:s,times:d}){let e=!1;function l(){e||document&&(e=!0,document.addEventListener("keyup",y),document.addEventListener("keydown",v))}function c(){document&&(document.removeEventListener("keyup",y),document.removeEventListener("keydown",v),e=!1)}function m(e){if(e&&document){const t=document.activeElement;if(t!==document.body&&a.value?.contains(t))return!0}return!1}function p(){let t=0;const a=window.setInterval(()=>{const e=o.value[n.value];e&&(e.focus(),50!==++t)&&document.activeElement!==e||window.clearInterval(a)},250)}function v(e){m(e)&&isKeyCode(e,[33,34,35,36,37,38,39,40])&&(e.stopPropagation(),e.preventDefault())}function y(e){if(m(e)&&isKeyCode(e,[33,34,35,36,37,38,39,40])){const t={33:D,34:k,35:N,36:w,37:h,38:f,39:T,40:g};t[e.keyCode]?.()}}function f(){let e=copyTimestamp(r.value);if("month"===i.value){if(e=addToDate(e,{day:-7}),r.value.month!==e.month)return s.value="prev",void(u.value=e.date)}else e=addToDate(e,{minute:Number(t.intervalMinutes)});s.value="prev",n.value=e.date}function g(){let e=copyTimestamp(r.value);if("month"===i.value){if(e=addToDate(e,{day:7}),r.value.month!==e.month)return s.value="next",void(u.value=e.date)}else e=addToDate(e,{minute:Number(t.intervalMinutes)});s.value="next",n.value=e.date}function h(){let e=copyTimestamp(r.value);s.value="prev";do{e=addToDate(e,{day:-1})}while(!t.weekdays.includes(Number(e.weekday)));n.value=e.date}function T(){let e=copyTimestamp(r.value);s.value="next";do{e=addToDate(e,{day:1})}while(!t.weekdays.includes(Number(e.weekday)));n.value=e.date}function D(){let e=copyTimestamp(r.value);e="month"===i.value?addToDate(e,{month:-1}):addToDate(e,{day:-7}),s.value="prev",n.value=e.date}function k(){let e=copyTimestamp(r.value);e="month"===i.value?addToDate(e,{month:1}):addToDate(e,{day:7}),s.value="next",n.value=e.date}function w(){let e=copyTimestamp(r.value);e="month"===i.value?getStartOfMonth(e):getStartOfWeek(e,t.weekdays||[],d.today);while(!t.weekdays.includes(Number(e.weekday)))e=addToDate(e,{day:-1});n.value=e.date}function N(){let e=copyTimestamp(r.value);e="month"===i.value?getEndOfMonth(e):getEndOfWeek(e,t.weekdays||[],d.today);while(!t.weekdays.includes(Number(e.weekday)))e=addToDate(e,{day:-1});n.value=e.date}return onBeforeUnmount(()=>{c()}),watch(()=>t.useNavigation,e=>{(!0===e?l:c)()}),!0===t.useNavigation&&l(),{startNavigation:l,endNavigation:c,tryFocus:p}}var QCalendarResource=defineComponent({name:"QCalendarResource",props:{...useCommonProps,...useResourceProps,...useIntervalProps,...useColumnProps,...useMaxDaysProps,...useTimesProps,...useNavigationProps},emits:["update:model-value","update:model-resources","resource-expanded",...useCheckChangeEmits,...useMoveEmits,...getRawMouseEvents("-date"),...getRawMouseEvents("-interval"),...getRawMouseEvents("-head-day"),...getRawMouseEvents("-time"),...getRawMouseEvents("-head-resources"),...getRawMouseEvents("-resource")],setup(p,{slots:v,emit:m,expose:x}){const e=ref(null),U=ref(null),L=ref(null),t=ref(null),y=ref(p.modelValue||today()),a=ref(parsed(p.modelValue||today())),f=ref({}),g=ref({}),i=ref("next"),u=ref(p.modelValue||today()),s=ref("0000-00-00"),d=ref(0),r=ref(p.modelValue),l=reactive({width:0,height:0}),T=ref(""),D=ref(""),k=ref(""),Y=ref(null),P=ref(null),n=(watch(()=>p.view,()=>{d.value=0}),computed(()=>{return"month"===p.view?"month-interval":p.view})),w=computed(()=>{return parseInt(String(p.cellWidth),10)}),o=getCurrentInstance();if(null===o)throw new Error("current instance is null");const N=useEmitListeners(o).emitListeners,{times:c,setCurrent:q,updateCurrent:M}=useTimes(p),{parsedStart:_,parsedEnd:B,dayStyleDefault:I}=(M(),q(),useCommon(p,{startDate:u,endDate:s,times:c})),b=computed(()=>{return parseTimestamp(p.modelValue,c.now)||_.value||c.today}),V=(a.value=b.value,y.value=b.value.date,useRenderValues(p,{parsedView:n,times:c,parsedValue:b})).renderValues,{rootRef:z,__renderCalendar:X}=useCalendar(p,Te,{scrollArea:e,pane:U}),{days:S,intervals:E,intervalFormatter:K,styleDefault:Z,scrollToTimeX:$,timeDurationWidth:O,timeStartPosX:A,widthToMinutes:j}=useInterval(p,{times:c,scrollArea:e,parsedStart:_,parsedEnd:B,maxDays:d,size:l,headerColumnRef:t}),F=useMove(p,{parsedView:n,parsedValue:b,direction:i,maxDays:d,times:c,emittedValue:r,emit:m}).move,W=useMouseEvents(m,N).getDefaultMouseEventHandlers,Q=useCheckChange(m,{days:S,lastStart:Y,lastEnd:P}).checkChange,G=useEventUtils().isKeyCode,J=useNavigation(p,{rootRef:z,focusRef:y,focusValue:a,datesRef:f,parsedView:n,emittedValue:r,direction:i,times:c}).tryFocus,C=computed(()=>{const e=parseInt(String(p.resourceHeight),10);return 0===e?"auto":e}),R=computed(()=>{return parseInt(String(p.resourceMinHeight),10)}),H=computed(()=>{return parseInt(String(p.intervalHeaderHeight),10)});function ee(){r.value=today()}function te(e=1){F(e)}function ae(e=1){F(-e)}function ne({width:e,height:t}){l.width=e,l.height=t}function re(e){return e.date===r.value}function oe(){const e={height:convertToUnit(H.value)};return h("div",{ref:L,roll:"presentation",class:{"q-calendar-resource__head":!0,"q-calendar__sticky":!0!==p.noSticky},style:e},[ie(),ue()])}function ie(){const e=v["head-resources"],t=convertToUnit(H.value),a={timestamps:E,date:p.modelValue,resources:p.modelResources};return h("div",{class:{"q-calendar-resource__head--resources":!0,"q-calendar__sticky":!0!==p.noSticky},style:{height:t},...W("-head-resources",e=>{return{scope:a,event:e}})},[e&&e({scope:a})])}function ue(){return h("div",{ref:t,class:{"q-calendar-resource__head--intervals":!0}},[E.value.map(e=>e.map((e,t)=>se(e,t)))])}function se(e,t){const a=v["interval-label"],n=!0!==p.noActiveDate&&re(e),r=convertToUnit(w.value),o=convertToUnit(H.value),i=p.shortIntervalLabel,u=K.value(e,i),s={timestamp:e,index:t,label:u,droppable:T.value===u},d=p.intervalStyle||I,l={width:r,maxWidth:r,minWidth:r,height:o,...d({scope:s})},c="function"===typeof p.intervalClass?p.intervalClass({scope:s}):{},m=!0===p.focusable&&p.focusType.includes("interval");return h("div",{key:u,tabindex:!0===m?0:-1,class:{"q-calendar-resource__head--interval":!0,...c,"q-active-date":n,"q-calendar__hoverable":!0===p.hoverable,"q-calendar__focusable":!0===m},style:l,onDragenter:e=>{void 0!==p.dragEnterFunc&&"function"===typeof p.dragEnterFunc&&(!0===p.dragEnterFunc(e,"interval",{scope:s})?T.value=u:T.value="")},onDragover:e=>{void 0!==p.dragOverFunc&&"function"===typeof p.dragOverFunc&&(!0===p.dragOverFunc(e,"interval",{scope:s})?T.value=u:T.value="")},onDragleave:e=>{void 0!==p.dragLeaveFunc&&"function"===typeof p.dragLeaveFunc&&(!0===p.dragLeaveFunc(e,"interval",{scope:s})?T.value=u:T.value="")},onDrop:e=>{void 0!==p.dropFunc&&"function"===typeof p.dropFunc&&(!0===p.dropFunc(e,"interval",{scope:s})?T.value=u:T.value="")},onFocus:()=>{!0===m&&(y.value=u)},...W("-interval",e=>{return{scope:s,event:e}})},[a?a({scope:s}):u,useFocusHelper()])}function de(){return h("div",{class:"q-calendar-resource__body"},[le()])}function le(){return h("div",{ref:e,class:{"q-calendar-resource__scroll-area":!0,"q-calendar__scroll":!0}},[me()])}function ce(){return h("div",{},"No resources have been defined")}function me(){return h("div",{class:"q-calendar-resource__day--container"},[oe(),void 0===p.modelResources&&ce(),void 0!==p.modelResources&&pe()])}function pe(){const e={class:"q-calendar-resource__resources--body"};return h("div",e,ve())}function ve(e=void 0,a=0,n=!0){return void 0===e&&(e=p.modelResources),e.map((e,t)=>{return ye(e,t,a,void 0!==e.children?e.expanded:n)}).filter(e=>!!e)}function ye(e,t,a=0,n=!0){const r={},o=(r.height="auto"===C.value?C.value:convertToUnit(C.value),R.value>0&&(r.minHeight=convertToUnit(R.value)),h("div",{key:e[p.resourceKey]+"-"+t,class:{"q-calendar-resource__resource--row":!0},style:r},[fe(e,t,a,n),ge(e,t)]));return void 0!==e.children?[o,h("div",{class:{"q-calendar__child":!0,"q-calendar__child--expanded":!0===n,"q-calendar__child--collapsed":!0!==n}},[ve(e.children,a+1,!1===n?n:e.expanded)])]:[o]}function fe(t,e,a=0,n=!0){const r=v["resource-label"],o={},i=(o.height=void 0!==t.height?convertToUnit(parseInt(t.height,10)):C.value?convertToUnit(C.value):"auto",R.value>0&&(o.minHeight=convertToUnit(R.value)),p.resourceStyle||Z),u=t[p.resourceLabel],s=!0===p.focusable&&p.focusType.includes("resource")&&!0===n,d=t[p.resourceKey],l={resource:t,timestamps:E,resourceIndex:e,indentLevel:a,label:u,droppable:D.value===d},c="function"===typeof p.resourceClass?p.resourceClass({scope:l}):{};return h("div",{key:t[p.resourceKey]+"-"+e,ref:e=>{e instanceof HTMLElement&&(g.value[t[p.resourceKey]]=e)},tabindex:!0===s?0:-1,class:{"q-calendar-resource__resource":0===a,"q-calendar-resource__resource--section":0!==a,...c,"q-calendar__sticky":!0!==p.noSticky,"q-calendar__hoverable":!0===p.hoverable,"q-calendar__focusable":!0===s},style:{...o,...i({scope:l})},onDragenter:e=>{void 0!==p.dragEnterFunc&&"function"===typeof p.dragEnterFunc&&(!0===p.dragEnterFunc(e,"resource",{scope:l})?D.value=d:D.value="")},onDragover:e=>{void 0!==p.dragOverFunc&&"function"===typeof p.dragOverFunc&&(!0===p.dragOverFunc(e,"resource",{scope:l})?D.value=d:D.value="")},onDragleave:e=>{void 0!==p.dragLeaveFunc&&"function"===typeof p.dragLeaveFunc&&(!0===p.dragLeaveFunc(e,"resource",{scope:l})?D.value=d:D.value="")},onDrop:e=>{void 0!==p.dropFunc&&"function"===typeof p.dropFunc&&(!0===p.dropFunc(e,"resource",{scope:l})?D.value=d:D.value="")},onKeydown:e=>{G(e,[13,32])&&(e.stopPropagation(),e.preventDefault())},onKeyup:e=>{G(e,[13,32])&&void 0!==N.value.onClickResource&&m("click-resource",{scope:l,event:e})},...W("-resource",e=>{return{scope:l,event:e}})},[[h("div",{class:{"q-calendar__parent":void 0!==t.children,"q-calendar__parent--expanded":void 0!==t.children&&!0===t.expanded,"q-calendar__parent--collapsed":void 0!==t.children&&!0!==t.expanded},onClick:e=>{e.stopPropagation(),t.expanded=!t.expanded,m("resource-expanded",{expanded:t.expanded,scope:l})}}),h("div",{class:{"q-calendar-resource__resource--text":!0,"q-calendar__ellipsis":!0},style:{paddingLeft:10*a+2+"px"}},[r?r({scope:l}):u]),useFocusHelper()]])}function ge(t,a){const e=v["resource-intervals"],n={resource:t,timestamps:E,resourceIndex:a,timeStartPosX:A,timeDurationWidth:O};return h("div",{class:"q-calendar-resource__resource--intervals"},[E.value.map(e=>e.map(e=>he(t,e,a))),e&&e({scope:n})])}function he(t,e,a){const n=v["resource-interval"],r=!0!==p.noActiveDate&&re(e),o=t[p.resourceKey],i=e.time+"-"+o,u=!0===p.focusable&&p.focusType.includes("time"),s={activeDate:r,resource:t,timestamp:e,resourceIndex:a,droppable:k.value===i},d=p.intervalStyle||I,l=convertToUnit(w.value),c={width:l,maxWidth:l,minWidth:l,...d({scope:s})};return c.height=void 0!==t.height?convertToUnit(parseInt(t.height,10)):"auto"===C.value?C.value:convertToUnit(C.value),R.value>0&&(c.minHeight=convertToUnit(R.value)),h("div",{key:i,ref:e=>{e instanceof HTMLElement&&(f.value[t[p.resourceKey]]=e)},tabindex:!0===u?0:-1,class:{"q-calendar-resource__resource--interval":!0,"q-active-date":r,"q-calendar__hoverable":!0===p.hoverable,"q-calendar__focusable":!0===u},style:c,onDragenter:e=>{void 0!==p.dragEnterFunc&&"function"===typeof p.dragEnterFunc&&(!0===p.dragEnterFunc(e,"time",{scope:s})?k.value=i:k.value="")},onDragover:e=>{void 0!==p.dragOverFunc&&"function"===typeof p.dragOverFunc&&(!0===p.dragOverFunc(e,"time",{scope:s})?k.value=i:k.value="")},onDragleave:e=>{void 0!==p.dragLeaveFunc&&"function"===typeof p.dragLeaveFunc&&(!0===p.dragLeaveFunc(e,"time",{scope:s})?k.value=i:k.value="")},onDrop:e=>{void 0!==p.dropFunc&&"function"===typeof p.dropFunc&&(!0===p.dropFunc(e,"time",{scope:s})?k.value=i:k.value="")},onFocus:()=>{!0===u&&(y.value=i)},...W("-time",e=>{return{scope:s,event:e}})},[n&&n({scope:s}),useFocusHelper()])}function Te(){const{start:e,end:t,maxDays:a}=V.value,n=(u.value===e.date&&s.value===t.date&&d.value===a||(u.value=e.date,s.value=t.date,d.value=a),l.width>0),r=withDirectives(h("div",{class:"q-calendar-resource",key:u.value},[!0===n&&de()]),[[ResizeObserverDirective,ne]]);if(!0!==p.animated)return r;{const o="q-calendar--"+("prev"===i.value?p.transitionPrev:p.transitionNext);return h(Transition,{name:o,appear:!0},()=>r)}}return watch([S],Q,{deep:!0,immediate:!0}),watch(()=>p.modelValue,(e,t)=>{if(r.value!==e){if(!0===p.animated){const a=getDayIdentifier(parsed(e)),n=getDayIdentifier(parsed(t));i.value=a>=n?"next":"prev"}r.value=e}y.value=e}),watch(r,(e,t)=>{if(r.value!==p.modelValue){if(!0===p.animated){const a=getDayIdentifier(parsed(e)),n=getDayIdentifier(parsed(t));i.value=a>=n?"next":"prev"}m("update:model-value",e)}}),watch(y,e=>{e&&(a.value=parseTimestamp(e))}),watch(a,()=>{f.value[y.value]?f.value[y.value].focus():J()}),onBeforeUpdate(()=>{f.value={},g.value={}}),onMounted(()=>{}),x({prev:ae,next:te,move:F,moveToToday:ee,updateCurrent:M,timeStartPosX:A,timeDurationWidth:O,widthToMinutes:j,scrollToTimeX:$}),()=>X()}});const version="4.1.2";var Plugin={version:version,QCalendarResource:QCalendarResource,...Timestamp$1,...helpers$1,install(e){e.component(String(QCalendarResource.name),QCalendarResource)}};export{DAYS_IN_MONTH,DAYS_IN_MONTH_LEAP,DAYS_IN_MONTH_MAX,DAYS_IN_MONTH_MIN,DAY_MIN,FIRST_HOUR,MONTH_MAX,MONTH_MIN,PARSE_DATE,PARSE_DATETIME,PARSE_TIME,QCalendarResource,TIME_CONSTANTS,addToDate,compareDate,compareDateTime,compareTime,compareTimestamps,convertToUnit,copyTimestamp,createDayList,createIntervalList,createNativeLocaleFormatter,daysBetween,daysInMonth,Plugin as default,diffTimestamp,findWeekday,getDate,getDateTime,getDayIdentifier,getDayOfYear,getDayTimeIdentifier,getEndOfMonth,getEndOfWeek,getMonthFormatter,getMonthNames,getStartOfMonth,getStartOfWeek,getTime,getTimeIdentifier,getWeekday,getWeekdayFormatter,getWeekdayNames,getWorkWeek,indexOf,isBetweenDates,isLeapYear,isOverlappingDates,isToday,makeDate,makeDateTime,maxTimestamp,minCharWidth,minTimestamp,moveRelativeDays,nextDay,padNumber,parseDate,parseTime,parseTimestamp,parsed,prevDay,relativeDays,today,updateDayOfYear,updateDisabled,updateFormatted,updateMinutes,updateRelative,updateWeekday,updateWorkWeek,validateNumber,validateTimestamp,version,weeksBetween};