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