UNPKG

@sbh321/qcalendar

Version:

A forked version of Jeff Galbraith's fork of Quasar UI QCalendar

6 lines 127 kB
/*! * @subhambhandari/qcalendar v4.0.0-beta.19 * (c) 2024 Subham Bhandari <bhandarimaiya65@gmail.com> * Released under the MIT License. */ import{reactive,ref,computed,withDirectives,h,watch,getCurrentInstance,onBeforeUnmount,defineComponent,onBeforeUpdate,onMounted,Transition,nextTick}from"vue";const PARSE_REGEX=/^(\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],DAYS_IN_MONTH_MIN=28,DAYS_IN_MONTH_MAX=31,MONTH_MAX=12,MONTH_MIN=1,DAY_MIN=1,DAYS_IN_WEEK=7,MINUTES_IN_HOUR=60,HOURS_IN_DAY=24,FIRST_HOUR=0,MILLISECONDS_IN_MINUTE=6e4,MILLISECONDS_IN_HOUR=36e5,MILLISECONDS_IN_DAY=864e5,MILLISECONDS_IN_WEEK=6048e5,Timestamp={date:"",time:"",year:0,month:0,day:0,weekday:0,hour:0,minute:0,doy:0,workweek:0,hasDay:!1,hasTime:!1,past:!1,current:!1,future:!1,disabled:!1,currentWeekday:!1},TimeObject={hour:0,minute:0};function today(){const e=new Date,a=""+(e.getMonth()+1),t=""+e.getDate(),n=e.getFullYear();return[n,padNumber(a,2),padNumber(t,2)].join("-")}function getStartOfWeek(e,a,t){let n=copyTimestamp(e);if(1===n.day||0===n.weekday)while(!a.includes(n.weekday))n=nextDay(n);return n=findWeekday(n,a[0],prevDay),n=updateFormatted(n),t&&(n=updateRelative(n,t,n.hasTime)),n}function getEndOfWeek(e,a,t){let n=copyTimestamp(e);const r=daysInMonth(n.year,n.month);if(r===n.day||6===n.weekday)while(!a.includes(n.weekday))n=prevDay(n);return n=findWeekday(n,a[a.length-1],nextDay),n=updateFormatted(n),t&&(n=updateRelative(n,t,n.hasTime)),n}function getStartOfMonth(e){const a=copyTimestamp(e);return a.day=DAY_MIN,updateFormatted(a),a}function getEndOfMonth(e){const a=copyTimestamp(e);return a.day=daysInMonth(a.year,a.month),updateFormatted(a),a}function parseTime(e){const a=Object.prototype.toString.call(e);switch(a){case"[object Number]":return e;case"[object String]":{const t=PARSE_TIME.exec(e);return t?60*parseInt(t[1],10)+parseInt(t[3]||0,10):!1}case"[object Object]":return"number"!==typeof e.hour||"number"!==typeof e.minute?!1:60*e.hour+e.minute}return!1}function validateTimestamp(e){return!!PARSE_REGEX.exec(e)}function compareTimestamps(e,a){return JSON.stringify(e)===JSON.stringify(a)}function compareDate(e,a){return getDate(e)===getDate(a)}function compareTime(e,a){return getTime(e)===getTime(a)}function compareDateTime(e,a){return getDateTime(e)===getDateTime(a)}function parsed(e){const a=PARSE_REGEX.exec(e);return a?{date:e,time:padNumber(parseInt(a[6],10)||0,2)+":"+padNumber(parseInt(a[8],10)||0,2),year:parseInt(a[1],10),month:parseInt(a[2],10),day:parseInt(a[4],10)||1,hour:isNaN(parseInt(a[6],10))?0:parseInt(a[6],10),minute:isNaN(parseInt(a[8],10))?0:parseInt(a[8],10),weekday:0,doy:0,workweek:0,hasDay:!!a[4],hasTime:!0,past:!1,current:!1,future:!1,disabled:!1}:null}function parseTimestamp(e,a){let t=parsed(e);return null===t?null:(t=updateFormatted(t),a&&updateRelative(t,a,t.hasTime),t)}function parseDate(e,a=!1){const t=a?"UTC":"";return updateFormatted({date:padNumber(e[`get${t}FullYear`](),4)+"-"+padNumber(e[`get${t}Month`]()+1,2)+"-"+padNumber(e[`get${t}Date`](),2),time:padNumber(e[`get${t}Hours`]()||0,2)+":"+padNumber(e[`get${t}Minutes`]()||0,2),year:e[`get${t}FullYear`](),month:e[`get${t}Month`]()+1,day:e[`get${t}Date`](),hour:e[`get${t}Hours`](),minute:e[`get${t}Minutes`](),weekday:0,doy:0,workweek:0,hasDay:!0,hasTime:!0,past:!1,current:!1,future:!1,disabled:!1})}function getDayIdentifier(e){return 1e8*e.year+1e6*e.month+1e4*e.day}function getTimeIdentifier(e){return 100*e.hour+e.minute}function getDayTimeIdentifier(e){return getDayIdentifier(e)+getTimeIdentifier(e)}function diffTimestamp(e,a,t){const n=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute),r=Date.UTC(a.year,a.month-1,a.day,a.hour,a.minute);return!0===t&&r<n?0:r-n}function updateRelative(e,a,t=!1){let n=getDayIdentifier(a),r=getDayIdentifier(e),d=n===r;return e.hasTime&&t&&d&&(n=getTimeIdentifier(a),r=getTimeIdentifier(e),d=n===r),e.past=r<n,e.current=d,e.future=r>n,e.currentWeekday=e.weekday===a.weekday,e}function updateMinutes(e,a,t){return e.hasTime=!0,e.hour=Math.floor(a/MINUTES_IN_HOUR),e.minute=a%MINUTES_IN_HOUR,e.time=getTime(e),t&&updateRelative(e,t,!0),e}function updateWeekday(e){return e.weekday=getWeekday(e),e}function updateDayOfYear(e){return e.doy=getDayOfYear(e),e}function updateWorkWeek(e){return e.workweek=getWorkWeek(e),e}function updateDisabled(e,a,t,n,r){const d=getDayIdentifier(e);if(void 0!==a){const o=getDayIdentifier(parsed(a));d<=o&&(e.disabled=!0)}if(!0!==e.disabled&&void 0!==t){const l=getDayIdentifier(parsed(t));d>=l&&(e.disabled=!0)}if(!0!==e.disabled&&Array.isArray(n)&&n.length>0)for(const u in n)if(n[u]===e.weekday){e.disabled=!0;break}if(!0!==e.disabled&&Array.isArray(r)&&r.length>0)for(const i in r)if(Array.isArray(r[i])&&2===r[i].length){const s=parsed(r[i][0]),c=parsed(r[i][1]);if(isBetweenDates(e,s,c)){e.disabled=!0;break}}else{const v=getDayIdentifier(parseTimestamp(r[i]+" 00:00"));if(v===d){e.disabled=!0;break}}return e}function updateFormatted(e){return e.hasTime=!0,e.time=getTime(e),e.date=getDate(e),e.weekday=getWeekday(e),e.doy=getDayOfYear(e),e.workweek=getWorkWeek(e),e}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){0===e.year&&(e=parseTimestamp(today()));const a=makeDate(e);if(isNaN(a))return 0;const t=new Date(a.getFullYear(),a.getMonth(),a.getDate()),n=(t.setDate(t.getDate()-(t.getDay()+6)%7+3),new Date(t.getFullYear(),0,4)),r=(n.setDate(n.getDate()-(n.getDay()+6)%7+3),t.getTimezoneOffset()-n.getTimezoneOffset()),d=(t.setHours(t.getHours()-r),(t-n)/MILLISECONDS_IN_WEEK);return 1+Math.floor(d)}function getWeekday(e){let a=e.weekday;if(e.hasDay){const t=Math.floor,n=e.day,r=(e.month+9)%MONTH_MAX+1,d=t(e.year/100),o=e.year%100-(e.month<=2?1:0);a=((n+t(2.6*r-.2)-2*d+o+t(o/4)+t(d/4))%7+7)%7}return a}function isLeapYear(e){return 1===(e%4===0^e%100===0^e%400===0)}function daysInMonth(e,a){return(isLeapYear(e)?DAYS_IN_MONTH_LEAP:DAYS_IN_MONTH)[a]}function copyTimestamp(e){return{...e}}function padNumber(e,a){let t=String(e);while(t.length<a)t="0"+t;return t}function getDate(e){let a=padNumber(e.year,4)+"-"+padNumber(e.month,2);return e.hasDay&&(a+="-"+padNumber(e.day,2)),a}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 nextDay(e){return++e.day,e.weekday=(e.weekday+1)%DAYS_IN_WEEK,e.day>DAYS_IN_MONTH_MIN&&e.day>daysInMonth(e.year,e.month)&&(e.day=DAY_MIN,++e.month,e.month>MONTH_MAX)&&(e.month=MONTH_MIN,++e.year),e}function prevDay(e){return e.day--,e.weekday=(e.weekday+6)%DAYS_IN_WEEK,e.day<DAY_MIN&&(e.month--,e.month<MONTH_MIN&&(e.year--,e.month=MONTH_MAX),e.day=daysInMonth(e.year,e.month)),e}function moveRelativeDays(e,a=nextDay,t=1,n=[0,1,2,3,4,5,6]){return relativeDays(e,a,t,n)}function relativeDays(e,a=nextDay,t=1,n=[0,1,2,3,4,5,6]){n.includes(e.weekday)||0!==e.weekday||a!==nextDay||++t;while(--t>=0)e=a(e),n.length<7&&!n.includes(e.weekday)&&++t;return e}function findWeekday(e,a,t=nextDay,n=6){while(e.weekday!==a&&--n>=0)e=t(e);return e}function getWeekdaySkips(a){const e=[1,1,1,1,1,1,1],n=[0,0,0,0,0,0,0];for(let e=0;e<a.length;++e)n[a[e]]=1;for(let t=0;t<DAYS_IN_WEEK;++t){let a=1;for(let e=1;e<DAYS_IN_WEEK;++e){const r=(t+e)%DAYS_IN_WEEK;if(n[r])break;++a}e[t]=n[t]*a}return e}function createDayList(e,a,t,n,r,d,o=[],l=[],u=42,i=0){const s=getDayIdentifier(a),c=[];let v=copyTimestamp(e),p=0,m=p===s;if(!(s<getDayIdentifier(e)))while((!m||c.length<i)&&c.length<u){if(p=getDayIdentifier(v),m=m||p>s&&c.length>=i,m)break;if(0===n[v.weekday]);else{const y=copyTimestamp(v);updateFormatted(y),updateRelative(y,t),updateDisabled(y,r,d,o,l),c.push(y)}v=relativeDays(v,nextDay)}return c}function createIntervalList(a,t,n,r,d){const o=[];for(let e=0;e<r;++e){const l=(t+e)*n,u=copyTimestamp(a);o.push(updateMinutes(u,l,d))}return o}function createNativeLocaleFormatter(n,r){const d=(e,a)=>"";return"undefined"===typeof Intl||"undefined"===typeof Intl.DateTimeFormat?d:(a,e)=>{try{const t=new Intl.DateTimeFormat(n||void 0,r(a,e));return t.format(makeDateTime(a))}catch(e){return console.error(`Intl.DateTimeFormat: ${e.message} -> `+getDateTime(a)),d}}}function makeDate(e,a=!0){return a?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,a=!0){return a?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(parseInt(e,10))}function maxTimestamp(e,a=!1){const t=!0===a?getDayTimeIdentifier:getDayIdentifier;return e.reduce((e,a)=>{return Math.max(t(e),t(a))===t(e)?e:a})}function minTimestamp(e,a=!1){const t=!0===a?getDayTimeIdentifier:getDayIdentifier;return e.reduce((e,a)=>{return Math.min(t(e),t(a))===t(e)?e:a})}function isBetweenDates(e,a,t,n){const r=getDayIdentifier(e)+(!0===n?getTimeIdentifier(e):0),d=getDayIdentifier(a)+(!0===n?getTimeIdentifier(a):0),o=getDayIdentifier(t)+(!0===n?getTimeIdentifier(t):0);return r>=d&&r<=o}function isOverlappingDates(e,a,t,n){const r=getDayIdentifier(e),d=getDayIdentifier(a),o=getDayIdentifier(t),l=getDayIdentifier(n);return r>=o&&r<=l||d>=o&&d<=l||o>=r&&d>=l}function addToDate(e,a){const n=copyTimestamp(e);let r;return __forEachObject(a,(e,a)=>{if(void 0!==n[a]){n[a]+=parseInt(e,10);const t=NORMALIZE_TYPES.indexOf(a);-1!==t&&(r=void 0===r?t:Math.min(t,r))}}),void 0!==r&&__normalize(n,NORMALIZE_TYPES[r]),updateFormatted(n),n}const NORMALIZE_TYPES=["minute","hour","day","month"];function __forEachObject(a,t){Object.keys(a).forEach(e=>t(a[e],e))}function __normalizeMinute(e){if(e.minute>=MINUTES_IN_HOUR||e.minute<0){const a=Math.floor(e.minute/MINUTES_IN_HOUR);e.minute-=a*MINUTES_IN_HOUR,e.hour+=a,__normalizeHour(e)}return e}function __normalizeHour(e){if(e.hour>=HOURS_IN_DAY||e.hour<0){const a=Math.floor(e.hour/HOURS_IN_DAY);e.hour-=a*HOURS_IN_DAY,e.day+=a,__normalizeDay(e)}return e}function __normalizeDay(a){__normalizeMonth(a);let t=daysInMonth(a.year,a.month);if(a.day>t){++a.month,a.month>MONTH_MAX&&__normalizeMonth(a);let e=a.day-t;t=daysInMonth(a.year,a.month);do{e>t&&(++a.month,a.month>MONTH_MAX&&__normalizeMonth(a),e-=t,t=daysInMonth(a.year,a.month))}while(e>t);a.day=e}else if(a.day<=0){let e=-1*a.day;--a.month,a.month<=0&&__normalizeMonth(a),t=daysInMonth(a.year,a.month);do{e>t&&(e-=t,--a.month,a.month<=0&&__normalizeMonth(a),t=daysInMonth(a.year,a.month))}while(e>t);a.day=t-e}return a}function __normalizeMonth(e){if(e.month>MONTH_MAX){const a=Math.floor(e.month/MONTH_MAX);e.month=e.month%MONTH_MAX,e.year+=a}else e.month<MONTH_MIN&&(e.month+=MONTH_MAX,--e.year);return e}function __normalize(e,a){switch(a){case"minute":return __normalizeMinute(e);case"hour":return __normalizeHour(e);case"day":return __normalizeDay(e);case"month":return __normalizeMonth(e)}}function daysBetween(e,a){const t=diffTimestamp(e,a,!0);return Math.floor(t/MILLISECONDS_IN_DAY)}function weeksBetween(e,a){let t=copyTimestamp(e),n=copyTimestamp(a);return t=findWeekday(t,0),n=findWeekday(n,6),Math.ceil(daysBetween(t,n)/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 r=(e,a)=>"",d={long:{timeZone:"UTC",weekday:"long"},short:{timeZone:"UTC",weekday:"short"},narrow:{timeZone:"UTC",weekday:"narrow"}};return"undefined"===typeof Intl||"undefined"===typeof Intl.DateTimeFormat?r:e;function e(a,e,t){try{const n=new Intl.DateTimeFormat(t||void 0,d[e]||d["long"]);return n.format(weekdayDateMap[a])}catch(e){return console.error(`Intl.DateTimeFormat: ${e.message} -> day of week: `+a),r}}}function getWeekdayNames(a,t){const e=Object.keys(weekdayDateMap),n=getWeekdayFormatter();return e.map(e=>n(e,a,t))}function getMonthFormatter(){const d=(e,a)=>"",o={long:{timeZone:"UTC",month:"long"},short:{timeZone:"UTC",month:"short"},narrow:{timeZone:"UTC",month:"narrow"}};return"undefined"===typeof Intl||"undefined"===typeof Intl.DateTimeFormat?d:e;function e(a,e,t){try{const n=new Intl.DateTimeFormat(t||void 0,o[e]||o["long"]),r=new Date;return r.setDate(1),r.setMonth(a),n.format(r)}catch(e){return console.error(`Intl.DateTimeFormat: ${e.message} -> month: `+a),d}}}function getMonthNames(a,t){const n=getMonthFormatter();return[...Array(12).keys()].map(e=>n(e,a,t))}function convertToUnit(e,a="px"){if(null!=e&&""!==e)return isNaN(e)?String(e):"auto"===e?e:""+Number(e)+a}function indexOf(a,t){for(let e=0;e<a.length;e++)if(!0===t(a[e],e))return e;return-1}function minCharWidth(e,a){return 0===a?e:e.slice(0,a)}var ResizeObserver$1={name:"ResizeObserver",mounted(e,{value:a}){if(a){const t={};t.callback=a,t.size={width:0,height:0},t.observer=new ResizeObserver(e=>{const a=e[0].contentRect;a.width===t.size.width&&a.height===t.size.height||(t.size.width=a.width,t.size.height=a.height,t.callback(t.size))}),t.observer.observe(e),e.__onResizeObserver=t}},beforeUnmount(e){if(e.__onResizeObserver){const a=e.__onResizeObserver["observer"];a.unobserve(e),delete e.__onResizeObserver}}};function useCalendar(a,t,{scrollArea:e,pane:n}){if(!t){const s="[error: renderCalendar] no renderFunc has been supplied to useCalendar";throw console.error(s),new Error(s)}const r=reactive({width:0,height:0}),d=ref(null);function o({width:e,height:a}){r.width=e,r.height=a}const l=computed(()=>{return!0!==a.noScroll&&e.value&&n.value&&r.height?e.value.offsetWidth-n.value.offsetWidth:0});function u(){}function i(){const e={ref:d,role:"complementary",lang:a.locale,class:`q-calendar ${a.dark?"q-calendar--dark":""} `+(a.bordered?"q-calendar__bordered":"")};return withDirectives(h("div",{...e},[t()]),[[ResizeObserver$1,o]])}return{rootRef:d,scrollWidth:l,__initCalendar:u,__renderCalendar:i}}const 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:{type:Function},dragOverFunc:{type:Function},dragLeaveFunc:{type:Function},dropFunc:{type:Function},selectedDates:{type:Array,default:()=>[]},selectedStartEndDates:{type:Array,default:()=>[]},hoverable:Boolean,focusable:Boolean,focusType:{type:Array,default:["date"],validator:e=>{let a=!0;e.forEach(e=>{!0!==["day","date","weekday","interval","time","resource","task"].includes(e)&&(a=!1)});return a}}};function useCommon(r,{startDate:e,endDate:a,times:t}){const n=computed(()=>getWeekdaySkips(r.weekdays)),d=computed(()=>parseTimestamp(e.value)),o=computed(()=>{if("0000-00-00"===a.value)return m(d.value);return parseTimestamp(a.value)}),l=computed(()=>{const t={timeZone:"UTC",day:"numeric"};return createNativeLocaleFormatter(r.locale,(e,a)=>t)}),u=computed(()=>{const t={timeZone:"UTC",weekday:"long"};const n={timeZone:"UTC",weekday:"short"};return createNativeLocaleFormatter(r.locale,(e,a)=>a?n:t)}),i=computed(()=>{const a={timeZone:"UTC",dateStyle:"full"};return createNativeLocaleFormatter(r.locale,e=>a)});function s(e,a){return e&&e.length>0&&e.includes(a.date)}function c(e,a){const t={firstDay:!1,betweenDays:!1,lastDay:!1};if(e&&2===e.length){const n=getDayIdentifier(a),r=getDayIdentifier(parsed(e[0])),d=getDayIdentifier(parsed(e[1]));t.firstDay=r===n,t.lastDay=d===n,t.betweenDays=r<n&&d>n}return t}function v(e,a=!1,t=[],n=[],r=!1){const d=s(t,e),{firstDay:o,lastDay:l,betweenDays:u}=c(n,e);return{"q-past-day":!0!==o&&!0!==u&&!0!==l&&!0!==d&&!0!==a&&e.past,"q-future-day":!0!==o&&!0!==u&&!0!==l&&!0!==d&&!0!==a&&e.future,"q-outside":a,"q-current-day":e.current,"q-selected":d,"q-range-first":!0===o,"q-range":!0===u,"q-range-last":!0===l,"q-range-hover":!0===r&&(!0===o||!0===l||!0===u),"q-disabled-day disabled":!0===e.disabled}}function p(e){return getStartOfWeek(e,r.weekdays,t.today)}function m(e){return getEndOfWeek(e,r.weekdays,t.today)}function y(e){}return{weekdaySkips:n,parsedStart:d,parsedEnd:o,dayFormatter:l,weekdayFormatter:u,ariaDateFormatter:i,arrayHasDate:s,checkDays:c,getRelativeClasses:v,startOfWeek:p,endOfWeek:m,dayStyleDefault:y}}function scrollTo(e,a){e===window?window.scrollTo(window.pageXOffset||window.scrollX||document.body.scrollLeft||0,a):e.scrollTop=a}function scrollToHorizontal(e,a){e===window?window.scrollTo(a,window.pageYOffset||window.scrollY||document.body.scrollTop||0):e.scrollLeft=a}function getVerticalScrollPosition(e){return e===window?window.pageYOffset||window.scrollY||document.body.scrollTop||0:e.scrollTop}function getHorizontalScrollPosition(e){return e===window?window.pageXOffset||window.scrollX||document.body.scrollLeft||0:e.scrollLeft}function animVerticalScrollTo(n,r,d=0){const o=void 0===arguments[3]?performance.now():arguments[3],l=getVerticalScrollPosition(n);d<=0?l!==r&&scrollTo(n,r):requestAnimationFrame(e=>{const a=e-o;const t=l+(r-l)/Math.max(a,d)*a;scrollTo(n,t);t!==r&&animVerticalScrollTo(n,r,d-a,e)})}function animHorizontalScrollTo(n,r,d=0){const o=void 0===arguments[3]?performance.now():arguments[3],l=getHorizontalScrollPosition(n);d<=0?l!==r&&scrollToHorizontal(n,r):requestAnimationFrame(e=>{const a=e-o;const t=l+(r-l)/Math.max(a,d)*a;setHorizontalScroll(n,t);t!==r&&animHorizontalScrollTo(n,r,d-a,e)})}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)}},useSchedulerProps={view:{type:String,validator:e=>["day","week","month","month-interval"].includes(e),default:"day"},modelResources:{type:Array},resourceKey:{type:[String,Number],default:"id"},resourceLabel:{type:[String,Number],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},weekdayStyle:{type:Function,default:null},weekdayClass:{type:Function,default:null},dayStyle:{type:Function,default:null},dayClass:{type:Function,default:null},dateHeader:{type:String,default:"stacked",validator:e=>["stacked","inline","inverted"].includes(e)}},useAgendaProps={view:{type:String,validator:e=>["day","week","month","month-interval"].includes(e),default:"day"},leftColumnOptions:{type:Array},rightColumnOptions:{type:Array},columnOptionsId:{type:String},columnOptionsLabel:{type:String},weekdayStyle:{type:Function,default:null},weekdayClass:{type:Function,default:null},dayStyle:{type:Function,default:null},dayClass:{type:Function,default:null},dateHeader:{type:String,default:"stacked",validator:e=>["stacked","inline","inverted"].includes(e)},dayHeight:{type:[Number,String],default:0,validator:validateNumber},dayMinHeight:{type:[Number,String],default:40,validator:validateNumber}},useResourceProps={modelResources:{type:Array},resourceKey:{type:[String,Number],default:"id"},resourceLabel:{type:[String,Number],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(d,{weekdaySkips:e,times:a,scrollArea:n,parsedStart:t,parsedEnd:r,maxDays:o,size:l,headerColumnRef:u}){const i=computed(()=>parseInt(d.intervalStart,10)),v=computed(()=>parseInt(d.intervalMinutes,10)),s=computed(()=>parseInt(d.intervalCount,10)),p=computed(()=>parseFloat(d.intervalHeight)),m=computed(()=>{let e=0;d.cellWidth?e=d.cellWidth:l.width>0&&u.value&&(e=u.value.offsetWidth/(d.columnCount>1?d.columnCount:o.value));return e}),c=computed(()=>i.value*v.value),y=computed(()=>s.value*p.value),h=computed(()=>s.value*m.value),f=computed(()=>w(t.value)),g=computed(()=>D(r.value)),_=computed(()=>{return createDayList(t.value,r.value,a.today,e.value,d.disabledBefore,d.disabledAfter,d.disabledWeekdays,d.disabledDays,o.value)}),k=computed(()=>{return _.value.map(e=>createIntervalList(e,i.value,v.value,s.value,a.now))});function w(e){return getStartOfWeek(e,d.weekdays,a.today)}function D(e){return getEndOfWeek(e,d.weekdays,a.today)}function b(e,a){return e&&e.length>0&&e.includes(getDateTime(a))}function T(e,a){const t={firstDay:!1,betweenDays:!1,lastDay:!1};if(e&&2===e.length){const n=getDayTimeIdentifier(a),r=getDayTimeIdentifier(parsed(e[0])),d=getDayTimeIdentifier(parsed(e[1]));t.firstDay=r===n,t.lastDay=d===n,t.betweenDays=r<n&&d>n}return t}function I(e,a=[],t=[]){const n=b(a,e),{firstDay:r,lastDay:d,betweenDays:o}=T(t,e);return{"q-selected":n,"q-range-first":!0===r,"q-range":!0===o,"q-range-last":!0===d,"q-disabled-interval disabled":!0===e.disabled}}function C(e,a=0,t){return[]}const S=computed(()=>{const t={timeZone:"UTC",hour12:!d.hour24Format,hour:"2-digit",minute:"2-digit"};const n={timeZone:"UTC",hour12:!d.hour24Format,hour:"numeric",minute:"2-digit"};const r={timeZone:"UTC",hour12:!d.hour24Format,hour:"numeric"};return createNativeLocaleFormatter(d.locale,(e,a)=>a?0===e.minute?r:n:t)}),M=computed(()=>{const a={timeZone:"UTC",dateStyle:"full",timeStyle:"short"};return createNativeLocaleFormatter(d.locale,e=>a)});function F(e){const a=k.value[0][0],t=a.hour===e.hour&&a.minute===e.minute;return!t&&0===e.minute}function E(e){}function q(e){}function A(e,a,t=!1,n=void 0){let r=copyTimestamp(a);const d=e.currentTarget.getBoundingClientRect(),o=e,l=e,u=o.changedTouches||o.touches,i=(u&&u[0]?u[0]:l).clientY,s=(i-d.top)/p.value,c=Math.floor((t?Math.floor(s):s)*v.value);return 0!==c&&(r=addToDate(r,{minute:c})),n&&updateRelative(r,n,!0),r}function H(e,a,t=!1,n=void 0){let r=copyTimestamp(a);const d=e.currentTarget.getBoundingClientRect(),o=e,l=e,u=o.changedTouches||o.touches,i=(u&&u[0]?u[0]:l).clientY,s=(i-d.top)/p.value,c=Math.floor((t?Math.floor(s):s)*v.value);return 0!==c&&(r=addToDate(r,{minute:c})),n&&updateRelative(r,n,!0),r}function R(e,a,t=!1,n=void 0){let r=copyTimestamp(a);const d=e.currentTarget.getBoundingClientRect(),o=e,l=e,u=o.changedTouches||o.touches,i=(u&&u[0]?u[0]:l).clientX,s=(i-d.left)/m.value,c=Math.floor((t?Math.floor(s):s)*v.value);return 0!==c&&(r=addToDate(r,{minute:c})),n&&updateRelative(r,n,!0),r}function L(e,a){const t={timestamp:e};return t.timeStartPos=W,t.timeDurationHeight=x,void 0!==a&&(t.columnIndex=a),t}function P(e,a){const t={timestamp:copyTimestamp(e)};return t.timeStartPosX=O,t.timeDurationWidth=N,void 0!==a&&(t.index=a),t}function V(e,a=0){const t=W(e);return!(!1===t||!n.value)&&(animVerticalScrollTo(n.value,t,a),!0)}function U(e,a=0){const t=O(e);return!(!1===t||!n.value)&&(animHorizontalScrollTo(n.value,t,a),!0)}function x(e){return e/v.value*p.value}function N(e){return e/v.value*m.value}function B(e){return parseInt(e,10)*v.value/p.value}function Y(e){return parseInt(e,10)*v.value/m.value}function W(e,a=!0){const t=parseTime(e);if(!1===t)return!1;const n=c.value,r=s.value*v.value,d=(t-n)/r;let o=d*y.value;return a&&(o<0&&(o=0),o>y.value)&&(o=y.value),o}function O(e,a=!0){const t=parseTime(e);if(!1===t)return!1;const n=c.value,r=s.value*v.value,d=(t-n)/r;let o=d*h.value;return a&&(o<0&&(o=0),o>h.value)&&(o=h.value),o}return{parsedIntervalStart:i,parsedIntervalMinutes:v,parsedIntervalCount:s,parsedIntervalHeight:p,parsedCellWidth:m,parsedStartMinute:c,bodyHeight:y,bodyWidth:h,parsedWeekStart:f,parsedWeekEnd:g,days:_,intervals:k,intervalFormatter:S,ariaDateTimeFormatter:M,arrayHasDateTime:b,checkIntervals:T,getIntervalClasses:I,getResourceClasses:C,showIntervalLabelDefault:F,showResourceLabelDefault:E,styleDefault:q,getTimestampAtEventInterval:A,getTimestampAtEvent:H,getTimestampAtEventX:R,getScopeForSlot:L,getScopeForSlotX:P,scrollToTime:V,scrollToTimeX:U,timeDurationHeight:x,timeDurationWidth:N,heightToMinutes:B,widthToMinutes:Y,timeStartPos:W,timeStartPosX:O}}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 a=reactive({now:parseTimestamp("0000-00-00 00:00"),today:parseTimestamp("0000-00-00")}),t=computed(()=>e.now?parseTimestamp(e.now):d());function n(){a.now.current=a.today.current=!0,a.now.past=a.today.past=!1,a.now.future=a.today.future=!1}function r(){const e=t.value||d();o(e,a.now),l(e,a.now),o(e,a.today)}function d(){return parseDate(new Date)}function o(e,a){e.date!==a.date&&(a.year=e.year,a.month=e.month,a.day=e.day,a.weekday=e.weekday,a.date=e.date)}function l(e,a){e.time!==a.time&&(a.hour=e.hour,a.minute=e.minute,a.time=e.time)}return watch(()=>t,e=>r()),{times:a,parsedNow:t,setCurrent:n,updateCurrent:r,getNow:d,updateDay:o,updateTime:l}}function useRenderValues(r,{parsedView:d,parsedValue:o,times:l}){const e=computed(()=>{const e=o.value;let a=r.maxDays;let t=e;let n=e;switch(d.value){case"month":t=getStartOfMonth(e),n=getEndOfMonth(e),a=daysInMonth(t.year,t.month);break;case"week":case"week-agenda":case"week-scheduler":t=getStartOfWeek(e,r.weekdays,l.today),n=getEndOfWeek(t,r.weekdays,l.today),a=r.weekdays.length;break;case"day":case"scheduler":case"agenda":n=moveRelativeDays(copyTimestamp(n),nextDay,a>1?a-1:a,r.weekdays),updateFormatted(n);break;case"month-interval":case"month-scheduler":case"month-agenda":t=getStartOfMonth(e),n=getEndOfMonth(e),updateFormatted(n),a=daysInMonth(t.year,t.month);break;case"resource":a=1,n=moveRelativeDays(copyTimestamp(n),nextDay,a,r.weekdays),updateFormatted(n);break}return{start:t,end:n,maxDays:a}});return{renderValues:e}}const toCamelCase=e=>e.replace(/(-\w)/g,e=>e[1].toUpperCase());let $listeners,$emit;function getMouseEventHandlers(e,t){const a={};for(const n in e){const r=e[n],d=toCamelCase("on-"+n);if(void 0===$listeners)return void console.warn("$listeners has not been set up");if(void 0!==$listeners.value[d]){const o="on"+r.event.charAt(0).toUpperCase()+r.event.slice(1),l=e=>{const a=e;(void 0===r.button||a.buttons>0&&a.button===r.button)&&(r.prevent&&a.preventDefault(),r.stop&&a.stopPropagation(),$emit(n,t(a,n)));return r.result};o in a?Array.isArray(a[o])?a[o].push(l):a[o]=[a[o],l]:a[o]=l}}return a}function getDefaultMouseEventHandlers(e,a){return getMouseEventHandlers(getMouseEventName(e),a)}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 useMouse(e,a){return $emit=e,$listeners=a,{getMouseEventHandlers:getMouseEventHandlers,getDefaultMouseEventHandlers:getDefaultMouseEventHandlers,getMouseEventName:getMouseEventName,getRawMouseEvents:getRawMouseEvents}}const useMoveEmits=["moved"];function useMove(l,{parsedView:u,parsedValue:i,weekdaySkips:s,direction:c,maxDays:v,times:p,emittedValue:m,emit:y}){function e(t=1){if(0===t)m.value=today();else{let e=copyTimestamp(i.value);const n=t>0,r=n?nextDay:prevDay,d=n?DAYS_IN_MONTH_MAX:DAY_MIN;let a=n?t:-t;c.value=n?"next":"prev";const o=s.value.filter(e=>0!==e).length;while(--a>=0)switch(u.value){case"month":e.day=d,r(e),updateWeekday(e);while(0===s.value[e.weekday])e=addToDate(e,{day:!0===n?1:-1});break;case"week":case"week-agenda":case"week-scheduler":relativeDays(e,r,o,l.weekdays);break;case"day":case"scheduler":case"agenda":relativeDays(e,r,v.value,l.weekdays);break;case"month-interval":case"month-agenda":case"month-scheduler":e.day=d,r(e);break;case"resource":relativeDays(e,r,v.value,l.weekdays);break}updateWeekday(e),updateFormatted(e),updateDayOfYear(e),updateRelative(e,p.now),m.value=e.date,y("moved",e)}}return{move:e}}const listenerRE=/^on[A-Z]/;function useEmitListeners(e=getCurrentInstance()){return{emitListeners:computed(()=>{const a={};e.vnode&&e.vnode.props&&Object.keys(e.vnode.props).forEach(e=>{listenerRE.test(e)&&(a[e]=!0)});return a})}}function useFocusHelper(){const e={"aria-hidden":"true",class:"q-calendar__focus-helper"};return[h("span",e)]}function useButton({focusable:e,focusType:a},t,n){const r=e&&a.includes("date");return h("button",{...t,tabindex:r?0:-1},[n,r&&useFocusHelper()])}const useCellWidthProps={cellWidth:[Number,String]};function useCellWidth(e){const a=computed(()=>void 0!==e.cellWidth);return{isSticky:a}}const useCheckChangeEmits=["change"];function useCheckChange(t,{days:n,lastStart:r,lastEnd:d}){function e(){if(n.value&&n.value.length>0){const e=n.value[0].date,a=n.value[n.value.length-1].date;if(null===r.value||null===d.value||e!==r.value||a!==d.value)return r.value=e,d.value=a,t("change",{start:e,end:a,days:n.value}),!0}return!1}return{checkChange:e}}function useEvents(){function e(a,{bubbles:t=!1,cancelable:n=!1}={}){try{return new CustomEvent(a,{bubbles:t,cancelable:n})}catch(e){const r=document.createEvent("Event");return r.initEvent(a,t,n),r}}function a(e,a){return[].concat(a).includes(e.keyCode)}return{createEvent:e,isKeyCode:a}}const isKeyCode=useEvents()["isKeyCode"],useNavigationProps={useNavigation:Boolean};function useKeyboard(t,{rootRef:n,focusRef:r,focusValue:d,datesRef:o,parsedView:l,emittedValue:u,weekdaySkips:i,direction:s,times:c}){let e=!1;function a(){!0!==e&&document&&(e=!0,document.addEventListener("keyup",h),document.addEventListener("keydown",y))}function v(){document&&(document.removeEventListener("keyup",h),document.removeEventListener("keydown",y),e=!1)}function p(e){if(void 0!==e&&document){const a=document.activeElement;if(a!==document.body&&!0===n.value.contains(a))return!0}return!1}function m(){let e=0;const a=setInterval(()=>{o.value[r.value]&&(o.value[r.value].focus(),50!==++e)&&document.activeElement!==o.value[r.value]||clearInterval(a)},250)}function y(e){p(e)&&isKeyCode(e,[33,34,35,36,37,38,39,40])&&(e.stopPropagation(),e.preventDefault())}function h(e){if(p(e)&&isKeyCode(e,[33,34,35,36,37,38,39,40]))switch(e.keyCode){case 33:w();break;case 34:D();break;case 35:T();break;case 36:b();break;case 37:_();break;case 38:f();break;case 39:k();break;case 40:g();break}}function f(e){let a=copyTimestamp(d.value);if("month"===l.value){if(a=addToDate(a,{day:-7}),d.value.month!==a.month)return s.value="prev",void(u.value=a.date)}else"day"!==l.value&&"week"!==l.value&&"month-interval"!==l.value||(a=addToDate(a,{minute:parseInt(t.intervalMinutes)}));s.value="prev",r.value=a.date}function g(e){let a=copyTimestamp(d.value);if("month"===l.value){if(a=addToDate(a,{day:7}),d.value.month!==a.month)return s.value="next",void(u.value=a.date)}else"day"!==l.value&&"week"!==l.value&&"month-interval"!==l.value||(a=addToDate(a,{minute:parseInt(t.intervalMinutes)}));s.value="next",r.value=a.date}function _(e){let a=copyTimestamp(d.value);s.value="prev";do{a=addToDate(a,{day:-1})}while(0===i.value[a.weekday]);if("month"===l.value||"month-interval"===l.value){if(d.value.month!==a.month)return void(u.value=a.date)}else if("week"===l.value){if(a.weekday>d.value.weekday)return void(u.value=a.date)}else if("day"===l.value)return void(u.value=a.date);r.value=a.date}function k(e){let a=copyTimestamp(d.value);s.value="next";do{a=addToDate(a,{day:1})}while(0===i.value[a.weekday]);if("month"===l.value||"month-interval"===l.value){if(d.value.month!==a.month)return void(u.value=a.date)}else if("week"===l.value){if(a.weekday<d.value.weekday)return void(u.value=a.date)}else if("day"===l.value)return void(u.value=a.date);r.value=a.date}function w(e){let a=copyTimestamp(d.value);if("month"===l.value||"month-interval"===l.value){a=addToDate(a,{month:-1});const t=a.day<=15?1:-1;while(0===i.value[a.weekday])a=addToDate(a,{day:t})}else"day"===l.value?a=addToDate(a,{day:-1}):"week"===l.value&&(a=addToDate(a,{day:-7}));s.value="prev",r.value=a.date}function D(e){let a=copyTimestamp(d.value);if("month"===l.value||"month-interval"===l.value){a=addToDate(a,{month:1});const t=a.day<=15?1:-1;while(0===i.value[a.weekday])a=addToDate(a,{day:t})}else"day"===l.value?a=addToDate(a,{day:1}):"week"===l.value&&(a=addToDate(a,{day:7}));s.value="next",r.value=a.date}function b(e){let a=copyTimestamp(d.value);"month"===l.value||"month-interval"===l.value?a=getStartOfMonth(a):"week"===l.value&&(a=getStartOfWeek(a,t.weekdays,c.today));while(0===i.value[a.weekday])a=addToDate(a,{day:-1});r.value=a.date}function T(e){let a=copyTimestamp(d.value);"month"===l.value||"month-interval"===l.value?a=getEndOfMonth(a):"week"===l.value&&(a=getEndOfWeek(a,t.weekdays,c.today));while(0===i.value[a.weekday])a=addToDate(a,{day:-1});r.value=a.date}return onBeforeUnmount(()=>{v()}),watch(()=>t.useNavigation,e=>{(!0===e?a:v)()}),!0===t.useNavigation&&a(),{startNavigation:a,endNavigation:v,tryFocus:m}}var QCalendarAgenda=defineComponent({name:"QCalendarAgenda",directives:[ResizeObserver$1],props:{...useCommonProps,...useAgendaProps,...useColumnProps,...useMaxDaysProps,...useTimesProps,...useCellWidthProps,...useNavigationProps},emits:["update:model-value",...useCheckChangeEmits,...useMoveEmits,...getRawMouseEvents("-date"),...getRawMouseEvents("-head-day"),...getRawMouseEvents("-time")],setup(v,{slots:p,emit:l,expose:H}){const e=ref(null),R=ref(null),L=ref(null),m=ref(null),a=ref(null),y=ref({}),t=ref({}),n=ref({}),o=ref("next"),u=ref(today()),i=ref("0000-00-00"),s=ref(0),c=ref(v.modelValue),f=reactive({width:0,height:0}),g=ref(!1),P=ref(null),V=ref(null),r=(watch(()=>v.view,()=>{s.value=0}),computed(()=>{if("month"===v.view)return"month-interval";return v.view})),U=getCurrentInstance();if(null===U)throw new Error("current instance is null");const B=useEmitListeners(U)["emitListeners"],_=useCellWidth(v)["isSticky"],{times:d,setCurrent:Y,updateCurrent:K}=(watch(_,e=>{}),useTimes(v)),{weekdaySkips:k,parsedStart:z,parsedEnd:Q,dayFormatter:X,weekdayFormatter:$,ariaDateFormatter:Z,dayStyleDefault:j,getRelativeClasses:w}=(K(),Y(),useCommon(v,{startDate:u,endDate:i,times:d})),D=computed(()=>{return parseTimestamp(v.modelValue,d.now)||z.value||d.today}),G=(a.value=D.value,m.value=D.value.date,useRenderValues(v,{parsedView:r,parsedValue:D,times:d}))["renderValues"],{rootRef:b,scrollWidth:J,__initCalendar:ee,__renderCalendar:ae}=useCalendar(v,Me,{scrollArea:e,pane:R}),{days:T,parsedCellWidth:te,getScopeForSlot:I}=useInterval(v,{weekdaySkips:k,times:d,scrollArea:e,parsedStart:z,parsedEnd:Q,maxDays:s,size:f,headerColumnRef:L}),C=useMove(v,{parsedView:r,parsedValue:D,weekdaySkips:k,direction:o,maxDays:s,times:d,emittedValue:c,emit:l})["move"],S=useMouse(l,B)["getDefaultMouseEventHandlers"],ne=useCheckChange(l,{days:T,lastStart:P,lastEnd:V})["checkChange"],re=useEvents()["isKeyCode"],de=useKeyboard(v,{rootRef:b,focusRef:m,focusValue:a,datesRef:y,days:T,parsedView:r,parsedValue:D,emittedValue:c,weekdaySkips:k,direction:o,times:d})["tryFocus"],M=computed(()=>{return T.value.length+(!0===F.value?v.leftColumnOptions.length:0)+(!0===E.value?v.rightColumnOptions.length:0)+T.value.length===1&&parseInt(v.columnCount,10)>0?parseInt(v.columnCount,10):0}),F=computed(()=>{return void 0!==v.leftColumnOptions&&Array.isArray(v.leftColumnOptions)}),E=computed(()=>{return void 0!==v.rightColumnOptions&&Array.isArray(v.rightColumnOptions)}),q=computed(()=>{if(b.value){const e=f.width||b.value.getBoundingClientRect().width;if(e&&M.value)return(e-J.value)/M.value+"px"}return 100/M.value+"%"});function oe(){c.value=today()}function le(e=1){C(e)}function ue(e=1){C(-e)}function ie({width:e,height:a}){f.width=e,f.height=a}function x(e){return e.date===c.value}function N(t,n){const e=p["head-column"],a={column:t,index:n,days:T.value},r=!0===_.value?v.cellWidth:q.value,d=!0===v.focusable&&v.focusType.includes("weekday"),o=void 0!==v.columnOptionsId?t[v.columnOptionsId]:void 0,l={maxWidth:r,width:r};return h("div",{key:o,tabindex:!0===d?0:-1,class:{"q-calendar-agenda__head--day":!0,"q-column-day":!0,"q-calendar__hoverable":!0===v.hoverable,"q-calendar__focusable":!0===d},style:l,onDragenter:e=>{void 0!==v.dragEnterFunc&&"function"===typeof v.dragEnterFunc&&(!0===v.dragEnterFunc(e,"head-column",a)?g.value=o:g.value="")},onDragover:e=>{void 0!==v.dragOverFunc&&"function"===typeof v.dragOverFunc&&(!0===v.dragOverFunc(e,"head-column",a)?g.value=o:g.value="")},onDragleave:e=>{void 0!==v.dragLeaveFunc&&"function"===typeof v.dragLeaveFunc&&(!0===v.dragLeaveFunc(e,"head-column",a)?g.value=o:g.value="")},onDrop:e=>{void 0!==v.dropFunc&&"function"===typeof v.dropFunc&&(!0===v.dropFunc(e,"head-column",a)?g.value=o:g.value="")},...S("-head-column",(e,a)=>{return{scope:{column:t,index:n},event:e}})},[!0!==v.noDefaultHeaderText&&se(t),e&&e(a),useFocusHelper()])}function se(e){const a=p["head-column-label"],t={column:e},n=void 0!==v.columnOptionsLabel?e[v.columnOptionsLabel]:e.label,r=h("div",{class:{"q-calendar-agenda__head--weekday":!0,["q-calendar__"+v.weekdayAlign]:!0,ellipsis:!0},style:{alignSelf:"center"}},[a&&a({scope:t}),!a&&h("span",{class:"ellipsis"},n)]);return"stacked"===v.dateHeader?r:h("div",{class:"q-calendar__header--inline",style:{height:"100%"}},[r])}function ce(){return h("div",{roll:"presentation",class:{"q-calendar-agenda__head":!0,"q-calendar__sticky":!0===_.value},style:{marginRight:J.value+"px"}},[ve()])}function ve(){return h("div",{ref:L,class:{"q-calendar-agenda__head--days__column":!0}},[pe(),me()])}function pe(){return h("div",{class:{"q-calendar-agenda__head--days__weekdays":!0}},[...ye()])}function me(){const e=p["head-days-events"];return nextTick(()=>{if(n.value&&0===v.columnCount&&window)try{const e=window.getComputedStyle(n.value);t.value.parentElement.style.height=e.height,t.value.style.height=e.height}catch(e){}}),h("div",{class:{"q-calendar-agenda__head--days__event":!0}},[e&&h("div",{ref:t,style:{position:"absolute",left:0,top:0,right:0,overflow:"hidden",zIndex:1}},[e({scope:{days:T.value,ref:n}})]),...he()])}function ye(){return 1===T.value.length&&parseInt(v.columnCount,10)>0?[!0===F.value&&v.leftColumnOptions.map((e,a)=>N(e,a)),Array.apply(null,new Array(parseInt(v.columnCount,10))).map((e,a)=>a+parseInt(v.columnIndexStart,10)).map(e=>fe(T.value[0],e)),!0===E.value&&v.rightColumnOptions.map((e,a)=>N(e,a))]:[!0===F.value&&v.leftColumnOptions.map((e,a)=>N(e,a)),T.value.map(e=>fe(e)),!0===E.value&&v.rightColumnOptions.map((e,a)=>N(e,a))]}function he(){return 1===T.value.length&&parseInt(v.columnCount,10)>0?[Array.apply(null,new Array(parseInt(v.columnCount,10))).map((e,a)=>a+parseInt(v.columnIndexStart,10)).map(e=>_e(T.value[0],e))]:T.value.map(e=>_e(e))}function fe(a,e){const t=p["head-day"],n=p["head-date"],r=!0!==v.noActiveDate&&x(a),d=I(a,e),o=(d.activeDate=r,d.droppable=g.value===a.date,d.disabled=!!v.disabledWeekdays&&v.disabledWeekdays.includes(a.weekday),!0===_.value?v.cellWidth:q.value),l=v.weekdayStyle||j,u={width:o,maxWidth:o,...l({scope:d})},i=(!0===_.value&&(u.minWidth=o),"function"===typeof v.weekdayClass?v.weekdayClass({scope:d}):{}),s=!0===v.focusable&&v.focusType.includes("weekday"),c={key:a.date+(void 0!==e?"-"+e:""),ref:e=>{y.value[a.date]=e},tabindex:!0===s?0:-1,class:{"q-calendar-agenda__head--day":!0,...i,...w(a),"q-active-date":r,"q-calendar__hoverable":!0===v.hoverable,"q-calendar__focusable":!0===s},style:u,onDragenter:e=>{void 0!==v.dragEnterFunc&&"function"===typeof v.dragEnterFunc&&(!0===v.dragEnterFunc(e,"head-day",d)?g.value=a.date:g.value="")},onDragover:e=>{void 0!==v.dragOverFunc&&"function"===typeof v.dragOverFunc&&(!0===v.dragOverFunc(e,"head-day",d)?g.value=a.date:g.value="")},onDragleave:e=>{void 0!==v.dragLeaveFunc&&"function"===typeof v.dragLeaveFunc&&(!0===v.dragLeaveFunc(e,"head-day",d)?g.value=a.date:g.value="")},onDrop:e=>{void 0!==v.dropFunc&&"function"===typeof v.dropFunc&&(!0===v.dropFunc(e,"head-day",d)?g.value=a.date:g.value="")},onFocus:e=>{!0===s&&(m.value=a.date)},...S("-head-day",e=>{return{scope:d,event:e}})};return h("div",c,[void 0!==t&&t({scope:d}),void 0===t&&ge(a),void 0===t&&n&&n({scope:d}),useFocusHelper()])}function ge(e){return"stacked"===v.dateHeader?[!0!==v.noDefaultHeaderText&&W(e),!0!==v.noDefaultHeaderBtn&&O(e)]:"inline"===v.dateHeader?("left"===v.weekdayAlign&&"right"===v.dateAlign||"right"===v.weekdayAlign&&v.dateAlign,h("div",{class:"q-calendar__header--inline"},[!0!==v.noDefaultHeaderText&&W(e),!0!==v.noDefaultHeaderBtn&&O(e)])):"inverted"===v.dateHeader?("left"===v.weekdayAlign&&"right"===v.dateAlign||"right"===v.weekdayAlign&&v.dateAlign,h("div",{class:"q-calendar__header--inline"},[!0!==v.noDefaultHeaderBtn&&O(e),!0!==v.noDefaultHeaderText&&W(e)])):void 0}function _e(e,a){const t=p["head-day-event"],n=!0!==v.noActiveDate&&x(e),r=I(e,a),d=(r.activeDate=n,r.disabled=!!v.disabledWeekdays&&v.disabledWeekdays.includes(e.weekday),!0===_.value?v.cellWidth:q.value),o={width:d,maxWidth:d};return!0===_.value&&(o.minWidth=d),h("div",{key:"event-"+e.date+(void 0!==a?"-"+a:""),class:{"q-calendar-agenda__head--day__event":!0,...w(e),"q-active-date":n},style:o},[t&&t({scope:r})])}function W(e){const a=p["head-weekday-label"],t=I(e),n=(t.shortWeekdayLabel=v.shortWeekdayLabel,{class:{"q-calendar-agenda__head--weekday":!0,["q-calendar__"+v.weekdayAlign]:!0,"q-calendar__ellipsis":!0}});return h("div",n,a&&a({scope:t})||ke(e,v.shortWeekdayLabel))}function ke(e,a){const t=$.value(e,a||v.weekdayBreakpoints[0]>0&&te.value<=v.weekdayBreakpoints[0]);return h("span",{class:"q-calendar__ellipsis"},v.weekdayBreakpoints[1]>0&&te.value<=v.weekdayBreakpoints[1]?minCharWidth(t,v.minWeekdayLabel):t)}function O(e){const a={class:{"q-calendar-agenda__head--date":!0,["q-calendar__"+v.dateAlign]:!0}};return h("div",a,we(e))}function we(t){const e=!0!==v.noActiveDate&&x(t),a=X.value(t,!1),n=p["head-day-label"],r=p["head-day-button"],d={dayLabel:a,timestamp:t,activeDate:e,disabled:!!v.disabledWeekdays&&v.disabledWeekdays.includes(t.weekday)},o={class:{"q-calendar-agenda__head--day__label":!0,"q-calendar__button":!0,"q-calendar__button--round":"round"===v.dateType,"q-calendar__button--rounded":"rounded"===v.dateType,"q-calendar__button--bordered":!0===t.current,"q-calendar__focusable":!0},disabled:t.disabled,onKeydown:e=>{!0!==t.disabled&&re(e,[13,32])&&(e.stopPropagation(),e.preventDefault())},onKeyup:e=>{!0!==t.disabled&&re(e,[13,32])&&(c.value=t.date,void 0!==B.value.onClickDate)&&l("click-date",{scope:d})},...S("-date",(e,a)=>{"click-date"!==a&&"contextmenu-date"!==a||(c.value=t.date,"click-date"===a&&e.preventDefault());return{scope:d,event:e}})};return!0!==v.noAria&&(o.ariaLabel=Z.value(t)),r?r({scope:d}):useButton(v,o,n?n({scope:d}):a)}function De(){return h("div",{class:"q-calendar-agenda__body"},[be()])}function be(){return!0===_.value?h("div",{ref:e,class:{"q-calendar-agenda__scroll-area":!0,"q-calendar__scroll":!0}},[Ie()]):!0===v.noScroll?Te():h("div",{ref:e,class:{"q-calendar-agenda__scroll-area":!0,"q-calendar__scroll":!0}},[Te()])}function Te(){return h("div",{ref:R,class:"q-calendar-agenda__pane"},[Ie()])}function Ie(){const e=p["day-container"];return h("div",{class:"q-calendar-agenda__day-container"},[!0===_.value&&!0!==v.noHeader&&ce(),h("div",{style:{display:"flex",flexDirection:"row",height:"100%"}},[...Ce()]),e&&e({scope:{days:T.value}})])}function Ce(){return 1===T.value.length&&parseInt(v.columnCount,10)>0?[!0===F.value&&v.leftColumnOptions.map((e,a)=>A(e,a)),Array.apply(null,new Array(parseInt(v.columnCount,10))).map((e,a)=>a+parseInt(v.columnIndexStart,10)).map(e=>Se(T.value[0],0,e)),!0===E.value&&v.rightColumnOptions.map((e,a)=>A(e,a))]:[!0===F.value&&v.leftColumnOptions.map((e,a)=>A(e,a)),T.value.map((e,a)=>Se(e)),!0===E.value&&v.rightColumnOptions.map((e,a)=>A(e,a))]}function A(e,a){const t=p.column,n={column:e,days:T.value,index:a},r=!0===_.value?v.cellWidth:q.value,d=!0===v.focusable&&v.focusType.includes("day"),o=void 0!==v.columnOptionsId?e[v.columnOptionsId]:void 0;return h("div",{key:o,tabindex:!0===d?0:-1,class:{"q-calendar-agenda__day":!0,"q-column-day":!0,"q-calendar__hoverable":!0===v.hoverable,"q-calendar__focusable":!0===d},style:{maxWidth:r,width:r},onDragenter:e=>{void 0!==v.dragEnterFunc&&"function"===typeof v.dragEnterFunc&&(!0===v.dragEnterFunc(e,"column",n)?g.value=o:g.value="")},onDragover:e=>{void 0!==v.dragOverFunc&&"function"===typeof v.dragOverFunc&&(!0===v.dragOverFunc(e,"column",n)?g.value=o:g.value="")},onDragleave:e=>{void 0!==v.dragLeaveFunc&&"function"===typeof v.dragLeaveFunc&&(!0===v.dragLeaveFunc(e,"column",n)?g.value=o:g.value="")},onDrop:e=>{void 0!==v.dropFunc&&"function"===typeof v.dropFunc&&(!0===v.dropFunc(e,"column",n)?g.value=o:g.value="")},...S("-column",(e,a)=>{return{scope:n,event:e}})},[t&&t({scope:n})])}function Se(e,a,t){const n=p.day,r=I(e,t),d=!0===_.value?v.cellWidth:q.value,o={width:d,maxWidth:d};return!0===_.value&&(o.minWidth=d),o.height=parseInt(v.dayHeight,10)>0?convertToUnit(parseInt(v.dayHeight,10)):"auto",parseInt(v.dayMinHeight,10)>0&&(o.minHeight=convertToUnit(parseInt(v.dayMinHeight,10))),h("div",{key:e.date+(void 0!==t?":"+t:""),class:{"q-calendar-agenda__day":!0,...w(e)},style:o},[n&&n({scope:r})])}function Me(){const{start:e,end:a,maxDays:t}=G.value,n=(u.value===e.date&&i.value===a.date&&s.value===t||(u.value=e.date,i.value=a.date,s.value=t),f.width>0),r=withDirectives(h("div",{class:"q-calendar-agenda",key:u.value},[!0===n&&!0!==_.value&&!0!==v.noHeader&&ce(),!0===n&&De()]),[[ResizeObserver$1,ie]]);if(!0!==v.animated)return r;{const d="q-calendar--"+("prev"===o.value?v.transitionPrev:v.transitionNext);return h(Transition,{name:d,appear:!0},()=>r)}}return watch([T],ne,{deep:!0,immediate:!0}),watch(()=>v.modelValue,(e,a)=>{if(c.value!==e){if(!0===v.animated){const t=getDayIdentifier(parsed(e)),n=getDayIdentifier(parsed(a));o.value=t>=n?"next":"prev"}c.value=e}m.value=e}),watch(c,(e,a)=>{if(c.value!==v.modelValue){if(!0===v.animated){const t=getDayIdentifier(parsed(e)),n=getDayIdentifier(parsed(a));o.value=t>=n?"next":"prev"}l("update:model-value",e)}}),watch(m,e=>{e&&(a.value=parseTimestamp(e))}),watch(a,e=>{y.value[m.value]?y.value[m.value].focus():de()}),watch(()=>v.maxDays,e=>{s.value=e}),onBeforeUpdate(()=>{y.value={}}),onMounted(()=>{ee()}),H({prev:ue,next:le,move:C,moveToToday:oe,updateCurrent:K}),()=>ae()}}),QCalendarDay=defineComponent({name:"QCalendarDay",directives:[ResizeObserver$1],props:{...useCommonProps,...useIntervalProps,...useColumnProps,...useMaxDaysProps,...useTimesProps,...useCellWidthProps,...useNavigationProps},emits:["update:model-value",...useCheckChangeEmits,...useMoveEmits,...getRawMouseEvents("-date"),...getRawMouseEvents("-interval"),...getRawMouseEvents("-head-intervals"),...getRawMouseEvents("-head-day"),...getRawMouseEvents("-time")],setup(p,{slots:m,emit:c,expose:H}){const e=ref(null),R=ref(null),L=ref(null),y=ref(null),a=ref(null),f=ref({}),t=ref({}),n=ref({}),o=ref("next"),l=ref(p.modelValue||today()),u=ref("0000-00-00"),i=ref(0),g=ref(p.modelValue),s=reactive({width:0,height:0}),_=ref(!1),v=ref(!1),P=ref(null),V=ref(null),r=(watch(()=>p.view,()=>{i.value=0}),computed(()=>{if("month"===p.view)return"month-interval";return p.view})),U=getCurrentInstance();if(null===U)throw new Error("current instance is null");const k=useEmitListeners(U)["emitListeners"],w=useCellWidth(p)["isSticky"],{times:D,setCurrent:B,updateCurrent:Y}=useTimes(p),{weekdaySkips:d,parsedStart:b,parsedEnd:K,dayFormatter:z,weekdayFormatter:Q,ariaDateFormatter:X,dayStyleDefault:$,getRelativeClasses:T}=(Y(),B(),useCommon(p,{startDate:l,endDate:u,times:D})),I=computed(()=>{return parseTimestamp(p.modelValue,D.now)||b.value||D.today}),Z=(a.value=I.value,y.value=I.value.date,useRenderValues(p,{parsedView:r,parsedValue:I,times:D}))["renderValues"],{rootRef:C,scrollWidth:j,__initCalendar:G,__renderCalendar:J}=useCalendar(p,Ke,{scrollArea:e,pane:R}),{days:S,intervals:ee,intervalFormatter:ae,ariaDateTimeFormatter:te,parsedCellWidth:M,getIntervalClasses:ne,showIntervalLabelDefault:re,styleDefault:de,getTimestampAtEventInterval:oe,getTimestampAtEvent:le,get