vue-cal 5.0.1-rc.18 → 5.0.1-rc.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { computed as $, reactive as $e, watch as me, toRefs as wt, ref as ie, onBeforeUnmount as Xe, inject as Ne, createElementBlock as O, openBlock as S, renderSlot as N, createCommentVNode as U, unref as V, Fragment as ne, renderList as be, normalizeClass as De, createElementVNode as ge, createVNode as Oe, Transition as Ge, withCtx as q, createBlock as Se, resolveDynamicComponent as Qe, mergeProps as ye, toHandlers as Ie, normalizeProps as se, guardReactiveProps as le, toDisplayString as re, normalizeStyle as ke, onMounted as qe, withModifiers as xe, nextTick as Ue, createTextVNode as et, TransitionGroup as tt, createSlots as je, useTemplateRef as _t, useId as kt, useAttrs as bt, provide as Tt } from "vue";
1
+ import { computed as M, reactive as $e, watch as me, toRefs as wt, ref as ue, onBeforeUnmount as Xe, inject as Ne, createElementBlock as j, openBlock as C, renderSlot as P, createCommentVNode as K, unref as V, Fragment as re, renderList as ke, normalizeClass as ye, createElementVNode as ge, createVNode as Oe, Transition as Ge, withCtx as J, createBlock as Se, resolveDynamicComponent as Qe, mergeProps as de, toHandlers as Be, normalizeProps as ee, toDisplayString as ie, normalizeStyle as _e, onMounted as qe, withModifiers as xe, nextTick as Ue, createTextVNode as et, TransitionGroup as tt, createSlots as je, useTemplateRef as _t, useId as kt, useAttrs as bt, provide as $t, guardReactiveProps as ae } from "vue";
2
2
  /**
3
- * vue-cal v5.0.1-rc.18
3
+ * vue-cal v5.0.1-rc.19
4
4
  * (c) 2024-2025 Antoni Andre <antoniandre.web@gmail.com>
5
5
  * @license MIT
6
6
  */
@@ -33,366 +33,366 @@ const fe = {
33
33
  years: { cols: 5, rows: 5 }
34
34
  // Arbitrary range of quarters of century (25y).
35
35
  }
36
- }, $t = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], Re = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], Mt = Re.reduce((D, n, r) => (D[n] = r || 7, D), {}), Yt = (D, n, r) => {
37
- const { dateUtils: h } = D, p = !1, b = $(() => {
38
- if (W.value[n.view]) return n.view;
39
- const s = n.datePicker ? "month" : "week", l = n.view || s;
40
- return W.value[l] ? l : (console.warn(
41
- `Vue Cal: the provided or default view \`${l}\` is either invalid or not in the list of available views. The first available view will be chosen: \`${Object.keys(W.value)[0]}\`.`
36
+ }, Tt = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], Re = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], Mt = Re.reduce((y, s, r) => (y[s] = r || 7, y), {}), Yt = (y, s, r) => {
37
+ const { dateUtils: d } = y, w = !1, b = M(() => {
38
+ if (W.value[s.view]) return s.view;
39
+ const l = s.datePicker ? "month" : "week", p = s.view || l;
40
+ return W.value[p] ? p : (console.warn(
41
+ `Vue Cal: the provided or default view \`${p}\` is either invalid or not in the list of available views. The first available view will be chosen: \`${Object.keys(W.value)[0]}\`.`
42
42
  ), Object.keys(W.value)[0]);
43
- }), H = $(() => n.sm && !n.xs), m = $(() => n.xs || n.datePicker), j = $(() => n.clickToNavigate || n.datePicker && n.clickToNavigate !== !1), i = $(() => {
44
- const s = {
43
+ }), H = M(() => s.sm && !s.xs), f = M(() => s.xs || s.datePicker), F = M(() => s.clickToNavigate || s.datePicker && s.clickToNavigate !== !1), u = M(() => {
44
+ const l = {
45
45
  cell: {},
46
46
  // All possible event listeners to attach to cells.
47
47
  event: {}
48
48
  // All possible event listeners to attach to calendar events.
49
- }, l = (_) => _.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
50
- for (const [_, t] of Object.entries(r)) {
51
- const [C, L, J] = _.match(/^on(Cell|Event)(.+)$/) || [];
52
- C && (s[L.toLowerCase()][l(J).replace(/^-+|-+$/g, "")] = t);
49
+ }, p = (k) => k.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
50
+ for (const [k, a] of Object.entries(r)) {
51
+ const [O, B, R] = k.match(/^on(Cell|Event)(.+)$/) || [];
52
+ O && (l[B.toLowerCase()][p(R).replace(/^-+|-+$/g, "")] = a);
53
53
  }
54
- return s;
55
- }), f = $(() => {
56
- var l;
57
- const s = {};
58
- return n.hideWeekends && (s[6] = !0) && (s[7] = !0), (l = n.hideWeekdays) != null && l.length && n.hideWeekdays.forEach((_) => s[Mt[_]] = !0), s;
59
- }), T = $(() => n.hideWeekends || f.value[6] && f.value[7]), W = $(() => {
60
- const s = n.datePicker;
61
- let l = 0, _ = {};
62
- const t = n.views;
63
- return s && !t ? {
54
+ return l;
55
+ }), m = M(() => {
56
+ var p;
57
+ const l = {};
58
+ return s.hideWeekends && (l[6] = !0) && (l[7] = !0), (p = s.hideWeekdays) != null && p.length && s.hideWeekdays.forEach((k) => l[Mt[k]] = !0), l;
59
+ }), Y = M(() => s.hideWeekends || m.value[6] && m.value[7]), W = M(() => {
60
+ const l = s.datePicker;
61
+ let p = 0, k = {};
62
+ const a = s.views;
63
+ return l && !a ? {
64
64
  month: { ...fe.availableViews.month },
65
65
  year: { ...fe.availableViews.year },
66
66
  years: { ...fe.availableViews.years }
67
- } : (t ? (Array.isArray(t) ? _ = t.reduce((C, L) => (typeof L == "string" && fe.availableViews[L] ? C[L] = fe.availableViews[L] : l++, C), {}) : typeof t == "object" && (_ = Object.entries(t).reduce((C, [L, J]) => {
68
- const { cols: Z, rows: ue } = fe.availableViews[L];
69
- return C[L] = { cols: J.cols || Z, rows: J.rows || ue }, C;
70
- }, {})), l && console.warn("Vue Cal: the provided `views` prop contains invalid views that will be ignored."), Object.keys(_).length || (console.warn("Vue Cal: No valid view in the provided `views` prop. Falling back to default views."), _ = { ...fe.availableViews })) : _ = { ...fe.availableViews }, _);
71
- }), R = $(() => n.datePicker ? "month" : W.value.week ? "week" : Object.keys(W.value)[0]), o = $(() => {
72
- if (typeof n.selectedDate == "string") return h.stringToDate(n.selectedDate);
73
- if (n.selectedDate instanceof Date) return n.selectedDate;
74
- n.selectedDate ? console.warn("Vue Cal: The provided selected date is invalid:", n.selectedDate) : console.log("Vue Cal: Info - The provided selected date is undefined.");
75
- }), c = $(() => {
76
- if (!n.disableDays) return [];
77
- const s = [];
78
- if (Array.isArray(n.disableDays))
79
- for (let l of n.disableDays) {
80
- let _ = l;
81
- typeof l == "string" ? _ = h.stringToDate(l) : l instanceof Date && (l = h.formatDate(l, "YYYY-MM-DD")), _ instanceof Date && !isNaN(_.getTime()) ? s.push(l) : console.warn("Vue Cal: The provided `disableDays` prop contains an invalid date:", l);
67
+ } : (a ? (Array.isArray(a) ? k = a.reduce((O, B) => (typeof B == "string" && fe.availableViews[B] ? O[B] = fe.availableViews[B] : p++, O), {}) : typeof a == "object" && (k = Object.entries(a).reduce((O, [B, R]) => {
68
+ const { cols: oe, rows: te } = fe.availableViews[B];
69
+ return O[B] = { cols: R.cols || oe, rows: R.rows || te }, O;
70
+ }, {})), p && console.warn("Vue Cal: the provided `views` prop contains invalid views that will be ignored."), Object.keys(k).length || (console.warn("Vue Cal: No valid view in the provided `views` prop. Falling back to default views."), k = { ...fe.availableViews })) : k = { ...fe.availableViews }, k);
71
+ }), q = M(() => s.datePicker ? "month" : W.value.week ? "week" : Object.keys(W.value)[0]), t = M(() => {
72
+ if (typeof s.selectedDate == "string") return d.stringToDate(s.selectedDate);
73
+ if (s.selectedDate instanceof Date) return s.selectedDate;
74
+ s.selectedDate ? console.warn("Vue Cal: The provided selected date is invalid:", s.selectedDate) : console.log("Vue Cal: Info - The provided selected date is undefined.");
75
+ }), o = M(() => {
76
+ if (!s.disableDays) return [];
77
+ const l = [];
78
+ if (Array.isArray(s.disableDays))
79
+ for (let p of s.disableDays) {
80
+ let k = p;
81
+ typeof p == "string" ? k = d.stringToDate(p) : p instanceof Date && (p = d.formatDate(p, "YYYY-MM-DD")), k instanceof Date && !isNaN(k.getTime()) ? l.push(p) : console.warn("Vue Cal: The provided `disableDays` prop contains an invalid date:", p);
82
82
  }
83
- else console.warn("Vue Cal: The provided `disableDays` prop is invalid:", n.disableDays);
84
- return s;
85
- }), e = $(() => {
86
- let s = null;
87
- return n.minDate && typeof n.minDate == "string" ? s = h.stringToDate(n.minDate) : n.minDate && n.minDate instanceof Date && (s = n.minDate), (s == null ? void 0 : s.getTime()) || null;
88
- }), d = $(() => {
89
- let s = null;
90
- return n.maxDate && typeof n.maxDate == "string" ? s = h.stringToDate(n.maxDate) : n.maxDate && n.maxDate instanceof Date && (s = n.maxDate), (s == null ? void 0 : s.getTime()) || null;
91
- }), g = $(() => {
92
- var _;
93
- const { view: s } = D;
94
- return n.schedules.length && (s.isDay || s.isDays || s.isWeek) && ((_ = n.schedules) == null ? void 0 : _.map((t, C) => ({ ...t, id: t.id ?? C + 1 }))) || void 0;
95
- }), M = $(() => {
96
- const s = {
83
+ else console.warn("Vue Cal: The provided `disableDays` prop is invalid:", s.disableDays);
84
+ return l;
85
+ }), e = M(() => {
86
+ let l = null;
87
+ return s.minDate && typeof s.minDate == "string" ? l = d.stringToDate(s.minDate) : s.minDate && s.minDate instanceof Date && (l = s.minDate), (l == null ? void 0 : l.getTime()) || null;
88
+ }), h = M(() => {
89
+ let l = null;
90
+ return s.maxDate && typeof s.maxDate == "string" ? l = d.stringToDate(s.maxDate) : s.maxDate && s.maxDate instanceof Date && (l = s.maxDate), (l == null ? void 0 : l.getTime()) || null;
91
+ }), c = M(() => {
92
+ var k;
93
+ const { view: l } = y;
94
+ return s.schedules.length && (l.isDay || l.isDays || l.isWeek) && ((k = s.schedules) == null ? void 0 : k.map((a, O) => ({ ...a, id: a.id ?? O + 1 }))) || void 0;
95
+ }), E = M(() => {
96
+ const l = {
97
97
  drag: !0,
98
98
  resize: !0,
99
99
  delete: !0,
100
100
  create: !0
101
101
  };
102
- return n.editableEvents === !0 ? s : n.editableEvents === !1 ? Object.keys(s).map((l) => s[l] = !1) : { ...s, ...n.editableEvents };
103
- }), P = async (s) => {
104
- var _;
105
- let l = /* @__PURE__ */ Object.assign({ "../i18n/ar.json": () => import("./i18n/ar.js").then((t) => t.default), "../i18n/bg.json": () => import("./i18n/bg.js").then((t) => t.default), "../i18n/bn.json": () => import("./i18n/bn.js").then((t) => t.default), "../i18n/bs.json": () => import("./i18n/bs.js").then((t) => t.default), "../i18n/ca.json": () => import("./i18n/ca.js").then((t) => t.default), "../i18n/cs.json": () => import("./i18n/cs.js").then((t) => t.default), "../i18n/da.json": () => import("./i18n/da.js").then((t) => t.default), "../i18n/de.json": () => import("./i18n/de.js").then((t) => t.default), "../i18n/el.json": () => import("./i18n/el.js").then((t) => t.default), "../i18n/en-gb.json": () => import("./i18n/en-gb.js").then((t) => t.default), "../i18n/en-us.json": () => Promise.resolve().then(() => Vt).then((t) => t.default), "../i18n/es.json": () => import("./i18n/es.js").then((t) => t.default), "../i18n/et.json": () => import("./i18n/et.js").then((t) => t.default), "../i18n/fa.json": () => import("./i18n/fa.js").then((t) => t.default), "../i18n/fi.json": () => import("./i18n/fi.js").then((t) => t.default), "../i18n/fr.json": () => import("./i18n/fr.js").then((t) => t.default), "../i18n/he.json": () => import("./i18n/he.js").then((t) => t.default), "../i18n/hr.json": () => import("./i18n/hr.js").then((t) => t.default), "../i18n/hu.json": () => import("./i18n/hu.js").then((t) => t.default), "../i18n/id.json": () => import("./i18n/id.js").then((t) => t.default), "../i18n/is.json": () => import("./i18n/is.js").then((t) => t.default), "../i18n/it.json": () => import("./i18n/it.js").then((t) => t.default), "../i18n/ja.json": () => import("./i18n/ja.js").then((t) => t.default), "../i18n/ka.json": () => import("./i18n/ka.js").then((t) => t.default), "../i18n/ko.json": () => import("./i18n/ko.js").then((t) => t.default), "../i18n/lt.json": () => import("./i18n/lt.js").then((t) => t.default), "../i18n/mn.json": () => import("./i18n/mn.js").then((t) => t.default), "../i18n/nl.json": () => import("./i18n/nl.js").then((t) => t.default), "../i18n/no.json": () => import("./i18n/no.js").then((t) => t.default), "../i18n/pl.json": () => import("./i18n/pl.js").then((t) => t.default), "../i18n/pt-br.json": () => import("./i18n/pt-br.js").then((t) => t.default), "../i18n/pt-pt.json": () => import("./i18n/pt-pt.js").then((t) => t.default), "../i18n/ro.json": () => import("./i18n/ro.js").then((t) => t.default), "../i18n/ru.json": () => import("./i18n/ru.js").then((t) => t.default), "../i18n/sk.json": () => import("./i18n/sk.js").then((t) => t.default), "../i18n/sl.json": () => import("./i18n/sl.js").then((t) => t.default), "../i18n/sq.json": () => import("./i18n/sq.js").then((t) => t.default), "../i18n/sr.json": () => import("./i18n/sr.js").then((t) => t.default), "../i18n/sv.json": () => import("./i18n/sv.js").then((t) => t.default), "../i18n/tr.json": () => import("./i18n/tr.js").then((t) => t.default), "../i18n/uk.json": () => import("./i18n/uk.js").then((t) => t.default), "../i18n/vi.json": () => import("./i18n/vi.js").then((t) => t.default), "../i18n/zh-cn.json": () => import("./i18n/zh-cn.js").then((t) => t.default), "../i18n/zh-hk.json": () => import("./i18n/zh-hk.js").then((t) => t.default) });
102
+ return s.editableEvents === !0 ? l : s.editableEvents === !1 ? Object.keys(l).map((p) => l[p] = !1) : { ...l, ...s.editableEvents };
103
+ }), L = M(() => {
104
+ const { view: l } = y, { eventCount: p } = s;
105
+ return (Array.isArray(p) ? p.includes(l.id) : p) && (l.isMonth && !s.eventsOnMonthView || l.isYear);
106
+ }), z = async (l) => {
107
+ var k;
108
+ let p = /* @__PURE__ */ Object.assign({ "../i18n/ar.json": () => import("./i18n/ar.js").then((a) => a.default), "../i18n/bg.json": () => import("./i18n/bg.js").then((a) => a.default), "../i18n/bn.json": () => import("./i18n/bn.js").then((a) => a.default), "../i18n/bs.json": () => import("./i18n/bs.js").then((a) => a.default), "../i18n/ca.json": () => import("./i18n/ca.js").then((a) => a.default), "../i18n/cs.json": () => import("./i18n/cs.js").then((a) => a.default), "../i18n/da.json": () => import("./i18n/da.js").then((a) => a.default), "../i18n/de.json": () => import("./i18n/de.js").then((a) => a.default), "../i18n/el.json": () => import("./i18n/el.js").then((a) => a.default), "../i18n/en-gb.json": () => import("./i18n/en-gb.js").then((a) => a.default), "../i18n/en-us.json": () => Promise.resolve().then(() => Vt).then((a) => a.default), "../i18n/es.json": () => import("./i18n/es.js").then((a) => a.default), "../i18n/et.json": () => import("./i18n/et.js").then((a) => a.default), "../i18n/fa.json": () => import("./i18n/fa.js").then((a) => a.default), "../i18n/fi.json": () => import("./i18n/fi.js").then((a) => a.default), "../i18n/fr.json": () => import("./i18n/fr.js").then((a) => a.default), "../i18n/he.json": () => import("./i18n/he.js").then((a) => a.default), "../i18n/hr.json": () => import("./i18n/hr.js").then((a) => a.default), "../i18n/hu.json": () => import("./i18n/hu.js").then((a) => a.default), "../i18n/id.json": () => import("./i18n/id.js").then((a) => a.default), "../i18n/is.json": () => import("./i18n/is.js").then((a) => a.default), "../i18n/it.json": () => import("./i18n/it.js").then((a) => a.default), "../i18n/ja.json": () => import("./i18n/ja.js").then((a) => a.default), "../i18n/ka.json": () => import("./i18n/ka.js").then((a) => a.default), "../i18n/ko.json": () => import("./i18n/ko.js").then((a) => a.default), "../i18n/lt.json": () => import("./i18n/lt.js").then((a) => a.default), "../i18n/mn.json": () => import("./i18n/mn.js").then((a) => a.default), "../i18n/nl.json": () => import("./i18n/nl.js").then((a) => a.default), "../i18n/no.json": () => import("./i18n/no.js").then((a) => a.default), "../i18n/pl.json": () => import("./i18n/pl.js").then((a) => a.default), "../i18n/pt-br.json": () => import("./i18n/pt-br.js").then((a) => a.default), "../i18n/pt-pt.json": () => import("./i18n/pt-pt.js").then((a) => a.default), "../i18n/ro.json": () => import("./i18n/ro.js").then((a) => a.default), "../i18n/ru.json": () => import("./i18n/ru.js").then((a) => a.default), "../i18n/sk.json": () => import("./i18n/sk.js").then((a) => a.default), "../i18n/sl.json": () => import("./i18n/sl.js").then((a) => a.default), "../i18n/sq.json": () => import("./i18n/sq.js").then((a) => a.default), "../i18n/sr.json": () => import("./i18n/sr.js").then((a) => a.default), "../i18n/sv.json": () => import("./i18n/sv.js").then((a) => a.default), "../i18n/tr.json": () => import("./i18n/tr.js").then((a) => a.default), "../i18n/uk.json": () => import("./i18n/uk.js").then((a) => a.default), "../i18n/vi.json": () => import("./i18n/vi.js").then((a) => a.default), "../i18n/zh-cn.json": () => import("./i18n/zh-cn.js").then((a) => a.default), "../i18n/zh-hk.json": () => import("./i18n/zh-hk.js").then((a) => a.default) });
106
109
  {
107
- if (!l[`../i18n/${s}.json`]) {
108
- console.warn(`Vue Cal: the locale \`${s}\` does not exist. Falling back to \`en-us\`.`), s = "en-us";
110
+ if (!p[`../i18n/${l}.json`]) {
111
+ console.warn(`Vue Cal: the locale \`${l}\` does not exist. Falling back to \`en-us\`.`), l = "en-us";
109
112
  return;
110
113
  }
111
- l = await ((_ = l[`../i18n/${s}.json`]) == null ? void 0 : _.call(l));
114
+ p = await ((k = p[`../i18n/${l}.json`]) == null ? void 0 : k.call(p));
112
115
  }
113
- D.texts = Object.assign(D.texts, Object.assign({ ...fe.texts }, l)), h.updateTexts(D.texts);
114
- }, A = $e(n.events || []);
115
- return me(() => n.events, (s) => A.splice(0, A.length, ...s)), me(() => n.locale, (s) => P(s || "en-us")), (n.locale || !D.texts.today) && P(n.locale || "en-us"), {
116
- ...wt(n),
117
- events: A,
116
+ y.texts = Object.assign(y.texts, Object.assign({ ...fe.texts }, p)), d.updateTexts(y.texts);
117
+ }, D = $e(s.events || []);
118
+ return me(() => s.events, (l) => D.splice(0, D.length, ...l)), me(() => s.locale, (l) => z(l || "en-us")), (s.locale || !y.texts.today) && z(s.locale || "en-us"), {
119
+ ...wt(s),
120
+ events: D,
118
121
  // All the events listeners for cells and events that the end user may have attached to vue-cal.
119
- eventListeners: i,
120
- defaultView: R,
122
+ eventListeners: u,
123
+ defaultView: q,
121
124
  availableViews: W,
122
- disableDays: c,
123
- ready: p,
125
+ disableDays: o,
126
+ ready: w,
124
127
  sm: H,
125
- xs: m,
126
- clickToNavigate: j,
127
- hideWeekdays: f,
128
- hideWeekends: T,
128
+ xs: f,
129
+ clickToNavigate: F,
130
+ hideWeekdays: m,
131
+ hideWeekends: Y,
129
132
  minTimestamp: e,
130
- maxTimestamp: d,
131
- schedules: g,
132
- selectedDate: o,
133
- editableEvents: M,
133
+ maxTimestamp: h,
134
+ schedules: c,
135
+ selectedDate: t,
136
+ editableEvents: E,
137
+ showCellEventCount: L,
134
138
  view: b,
135
139
  // Getters.
136
140
  get hasHiddenDays() {
137
- return Object.keys(f.value).length;
141
+ return Object.keys(m.value).length;
138
142
  },
139
143
  get size() {
140
- return m.value ? "xs" : H.value ? "sm" : "lg";
144
+ return f.value ? "xs" : H.value ? "sm" : "lg";
141
145
  },
142
- loadTexts: P
146
+ loadTexts: z
143
147
  };
144
- }, Ve = (D, n) => {
145
- const r = n.timeTo - n.timeFrom;
146
- return (D - n.timeFrom) * 100 / r;
147
- }, Pe = (D, n) => {
148
- const r = n.timeTo - n.timeFrom;
149
- return ~~(D * r / 100 + n.timeFrom);
150
- }, Ze = (D, n) => {
151
- const r = n.clientHeight;
152
- return D * 100 / r;
153
- }, Be = $e({ id: null, date: null });
148
+ }, Ve = (y, s) => {
149
+ const r = s.timeTo - s.timeFrom;
150
+ return (y - s.timeFrom) * 100 / r;
151
+ }, Fe = (y, s) => {
152
+ const r = s.timeTo - s.timeFrom;
153
+ return ~~(y * r / 100 + s.timeFrom);
154
+ }, Ze = (y, s) => {
155
+ const r = s.clientHeight;
156
+ return y * 100 / r;
157
+ }, Ie = $e({ id: null, date: null });
154
158
  let at = !1, Je = !0;
155
- const we = $e({ el: null, cell: null, timeout: null }), _e = $e({
159
+ const pe = $e({ el: null, cell: null, timeout: null }), we = $e({
156
160
  eventId: null,
157
161
  fromVueCal: null,
158
162
  toVueCal: null
159
163
  });
160
- function Et(D) {
161
- const { config: n, view: r, eventsManager: h, emit: p, uid: b, dateUtils: H } = D, m = (e) => {
164
+ function Et(y) {
165
+ const { config: s, view: r, eventsManager: d, emit: w, uid: b, dateUtils: H } = y, f = (e) => {
162
166
  var l;
163
- const { timeStep: d, timeCellHeight: g, timeFrom: M } = n, P = (((l = e.touches) == null ? void 0 : l[0]) || e).clientY, { top: A } = e.currentTarget.getBoundingClientRect(), s = P - A - ~~e.dataTransfer.getData("cursor-grab-at");
164
- return Pe(Ze(s, e.currentTarget), n);
165
- }, j = (e, d, g) => {
166
- const M = d.duration || i(d.start, d.end) || n.timeStep;
167
- let P = Math.max(m(e), 0);
168
- if (n.snapToInterval) {
169
- const _ = P + n.snapToInterval / 2;
170
- P = _ - _ % n.snapToInterval;
167
+ const { timeStep: h, timeCellHeight: c, timeFrom: E } = s, L = (((l = e.touches) == null ? void 0 : l[0]) || e).clientY, { top: z } = e.currentTarget.getBoundingClientRect(), D = L - z - ~~e.dataTransfer.getData("cursor-grab-at");
168
+ return Fe(Ze(D, e.currentTarget), s);
169
+ }, F = (e, h, c) => {
170
+ const E = h.duration || u(h.start, h.end) || s.timeStep;
171
+ let L = Math.max(f(e), 0);
172
+ if (s.snapToInterval) {
173
+ const p = L + s.snapToInterval / 2;
174
+ L = p - p % s.snapToInterval;
171
175
  }
172
- const A = new Date(new Date(g).setMinutes(P)), s = Math.min(P + M, 24 * 60), l = new Date(new Date(g).setMinutes(s));
173
- return { start: A, end: l };
174
- }, i = (e, d) => Math.round((d - e) / 6e4);
176
+ const z = new Date(new Date(c).setMinutes(L)), D = Math.min(L + E, 24 * 60), l = new Date(new Date(c).setMinutes(D));
177
+ return { start: z, end: l };
178
+ }, u = (e, h) => Math.round((h - e) / 6e4);
175
179
  return {
176
- eventDragStart: (e, d) => {
177
- if (e.target.nodeType === 3 || D.touch.isResizingEvent) return e.preventDefault();
180
+ eventDragStart: (e, h) => {
181
+ if (e.target.nodeType === 3 || y.touch.isResizingEvent) return e.preventDefault();
178
182
  e.dataTransfer.effectAllowed = "move", e.dataTransfer.dropEffect = "move";
179
- const g = { ...d, _: { id: d._.id, duration: i(d.start, d.end) } };
183
+ const c = { ...h, _: { id: h._.id, duration: u(h.start, h.end) } };
180
184
  try {
181
- e.dataTransfer.setData("text/plain", ""), e.dataTransfer.setData("event", JSON.stringify(g)), e.dataTransfer.setData("cursor-grab-at", e.offsetY);
182
- } catch (P) {
183
- return console.warn("Vue Cal: Failed to set drag data:", P), e.preventDefault();
185
+ e.dataTransfer.setData("text/plain", ""), e.dataTransfer.setData("event", JSON.stringify(c)), e.dataTransfer.setData("cursor-grab-at", e.offsetY);
186
+ } catch (L) {
187
+ return console.warn("Vue Cal: Failed to set drag data:", L), e.preventDefault();
184
188
  }
185
- _e.eventId = d._.id, _e.fromVueCal = b, p("event-drag-start", {
189
+ we.eventId = h._.id, we.fromVueCal = b, w("event-drag-start", {
186
190
  e,
187
- event: d
191
+ event: h
188
192
  });
189
- const M = e.target.closest(".vuecal__event");
190
- M.classList.add("vuecal__event--dragging-ghost"), setTimeout(() => {
191
- M.classList.add("vuecal__event--dragging-original"), M.classList.remove("vuecal__event--dragging-ghost");
192
- }, 0), at = !1, Object.assign(Be, { id: r.id, date: r.firstCellDate }), Je = !0, D.touch.isDraggingEvent = !0;
193
+ const E = e.target.closest(".vuecal__event");
194
+ E.classList.add("vuecal__event--dragging-ghost"), setTimeout(() => {
195
+ E.classList.add("vuecal__event--dragging-original"), E.classList.remove("vuecal__event--dragging-ghost");
196
+ }, 0), at = !1, Object.assign(Ie, { id: r.id, date: r.firstCellDate }), Je = !0, y.touch.isDraggingEvent = !0;
193
197
  },
194
- eventDragEnd: (e, d) => {
195
- _e.eventId = null, e.target.closest(".vuecal__event").classList.remove("vuecal__event--dragging-original");
196
- const { fromVueCal: g, toVueCal: M } = _e;
197
- M && g !== M && h.deleteEvent(d._.id, 3), at && Je && Be.id && r.switchView(Be.id, Be.date, !0), p("event-drag-end", {
198
+ eventDragEnd: (e, h) => {
199
+ we.eventId = null, e.target.closest(".vuecal__event").classList.remove("vuecal__event--dragging-original");
200
+ const { fromVueCal: c, toVueCal: E } = we;
201
+ E && c !== E && d.deleteEvent(h._.id, 3), at && Je && Ie.id && r.switchView(Ie.id, Ie.date, !0), w("event-drag-end", {
198
202
  e,
199
- event: d,
200
- external: _e.fromVueCal !== b
201
- }), _e.fromVueCal = null, _e.toVueCal = null, D.touch.isDraggingEvent = !1;
203
+ event: h,
204
+ external: we.fromVueCal !== b
205
+ }), we.fromVueCal = null, we.toVueCal = null, y.touch.isDraggingEvent = !1;
202
206
  },
203
- cellDragEnter: (e, d) => {
204
- const { start: g } = d, M = e.currentTarget;
207
+ cellDragEnter: (e, h) => {
208
+ const { start: c } = h, E = e.currentTarget;
205
209
  if (!e.currentTarget.contains(e.relatedTarget)) {
206
- if (M === we.el || !M.className.includes("vuecal__cell-content")) return !1;
207
- we.el && (we.cell.highlighted = !1), Object.assign(we, { el: M, cell: d, timeout: clearTimeout(we.timeout) }), d.highlighted = !0, ["years", "year", "month"].includes(r.id) && (we.timeout = setTimeout(() => D.switchToNarrowerView(g), 2e3));
210
+ if (E === pe.el || !E.className.includes("vuecal__cell-content")) return !1;
211
+ pe.el && (pe.cell.highlighted = !1), Object.assign(pe, { el: E, cell: h, timeout: clearTimeout(pe.timeout) }), h.highlighted = !0, ["years", "year", "month"].includes(r.id) && (pe.timeout = setTimeout(() => y.switchToNarrowerView(c), 2e3));
208
212
  }
209
213
  },
210
- cellDragOver: (e, d) => {
211
- const { start: g, schedule: M } = d;
212
- e.preventDefault(), d.highlighted = !0, (M || M === 0) && (d.highlightedSchedule = M);
214
+ cellDragOver: (e, h) => {
215
+ const { start: c, schedule: E } = h;
216
+ e.preventDefault(), h.highlighted = !0, (E || E === 0) && (h.highlightedSchedule = E);
213
217
  },
214
- cellDragLeave: (e, d) => {
215
- e.preventDefault(), !e.currentTarget.contains(e.relatedTarget) && (d.highlightedSchedule = !1, we.cell === d && (clearTimeout(we.timeout), Object.assign(we, { el: null, cell: null, timeout: null }), d.highlighted = !1));
218
+ cellDragLeave: (e, h) => {
219
+ e.preventDefault(), !e.currentTarget.contains(e.relatedTarget) && (h.highlightedSchedule = !1, pe.cell === h && (clearTimeout(pe.timeout), Object.assign(pe, { el: null, cell: null, timeout: null }), h.highlighted = !1));
216
220
  },
217
- cellDragDrop: async (e, d) => {
218
- var C, L, J;
219
- e.preventDefault(), clearTimeout(we.timeout), Object.assign(we, { el: null, cell: null, timeout: null });
220
- const g = JSON.parse(e.dataTransfer.getData("event") || "{}");
221
- g.start && (g.start = new Date(g.start)), g.end && (g.end = new Date(g.end));
222
- let M;
223
- const { start: P, end: A } = j(e, g, d.start), { schedule: s } = ((C = e.target.closest("[data-schedule]")) == null ? void 0 : C.dataset) || {};
221
+ cellDragDrop: async (e, h) => {
222
+ var a, O, B;
223
+ e.preventDefault(), clearTimeout(pe.timeout), Object.assign(pe, { el: null, cell: null, timeout: null });
224
+ const c = JSON.parse(e.dataTransfer.getData("event") || "{}");
225
+ c.start && (c.start = new Date(c.start)), c.end && (c.end = new Date(c.end));
226
+ let E;
227
+ const { start: L, end: z } = F(e, c, h.start), { schedule: D } = ((a = e.target.closest("[data-schedule]")) == null ? void 0 : a.dataset) || {};
224
228
  let l = () => {
225
229
  };
226
- _e.fromVueCal === b ? (M = h.getEvent(g._.id), M && (M._.dragging = !1, l = () => {
227
- M.start = P, M.end = A, s !== void 0 && (M.schedule = ~~s);
228
- })) : (M = {
229
- ...g,
230
- start: P,
231
- end: A,
232
- ...s !== void 0 && { schedule: ~~s },
233
- _: { id: ((L = g._) == null ? void 0 : L.id) || g.id, duration: i(P, A) },
234
- getOverlappingEvents: () => h.getEventsInRange(
235
- h.getEventsByDate(H.formatDate(P), !0),
236
- { start: P, end: A },
237
- { schedule: ~~s }
238
- )
230
+ we.fromVueCal === b ? (E = d.getEvent(c._.id), E && (E._.dragging = !1, l = () => {
231
+ E.start = L, E.end = z, D !== void 0 && (E.schedule = ~~D);
232
+ })) : (E = {
233
+ ...c,
234
+ start: L,
235
+ end: z,
236
+ ...D !== void 0 && { schedule: ~~D },
237
+ _: { id: ((O = c._) == null ? void 0 : O.id) || c.id, duration: u(L, z) },
238
+ getOverlappingEvents: () => d.getEventsInRange(L, z, { schedule: ~~D })
239
239
  }, l = () => {
240
- M = h.createEvent(M);
240
+ E = d.createEvent(E);
241
241
  });
242
- let _ = !0;
243
- const { drop: t } = (J = n.eventListeners) == null ? void 0 : J.event;
244
- t && (_ = await t({
242
+ let p = !0;
243
+ const { drop: k } = (B = s.eventListeners) == null ? void 0 : B.event;
244
+ k && (p = await k({
245
245
  e,
246
- event: { ...M, start: P, end: A, schedule: ~~s },
247
- overlaps: M.getOverlappingEvents({ start: P, end: A, schedule: ~~s }),
248
- cell: d,
249
- external: _e.fromVueCal !== b
250
- })), _ !== !1 && l(), d.highlighted = !1, d.highlightedSchedule = null, Je = !1, _e.toVueCal = b, p("event-dropped", {
246
+ event: { ...E, start: L, end: z, schedule: ~~D },
247
+ overlaps: E.getOverlappingEvents({ start: L, end: z, schedule: ~~D }),
248
+ cell: h,
249
+ external: we.fromVueCal !== b
250
+ })), p !== !1 && l(), h.highlighted = !1, h.highlightedSchedule = null, Je = !1, we.toVueCal = b, w("event-dropped", {
251
251
  e,
252
- cell: d,
253
- event: M,
254
- originalEvent: g,
255
- external: _e.fromVueCal !== b
252
+ cell: h,
253
+ event: E,
254
+ originalEvent: c,
255
+ external: we.fromVueCal !== b
256
256
  });
257
257
  }
258
258
  };
259
259
  }
260
- const st = (D, n) => {
261
- let r, h, p, b = {}, H = {};
262
- const m = ie(D), j = () => {
263
- m.value.today || (m.value = n), Date.prototype.addDays = function(a) {
264
- return W(this, a || 0);
265
- }, Date.prototype.subtractDays = function(a) {
266
- return R(this, a || 0);
267
- }, Date.prototype.addHours = function(a) {
268
- return o(this, a || 0);
269
- }, Date.prototype.subtractHours = function(a) {
270
- return c(this, a || 0);
271
- }, Date.prototype.addMinutes = function(a) {
272
- return e(this, a || 0);
273
- }, Date.prototype.subtractMinutes = function(a) {
274
- return d(this, a || 0);
260
+ const st = (y, s) => {
261
+ let r, d, w, b = {}, H = {};
262
+ const f = ue(y), F = () => {
263
+ f.value.today || (f.value = s), Date.prototype.addDays = function(n) {
264
+ return W(this, n || 0);
265
+ }, Date.prototype.subtractDays = function(n) {
266
+ return q(this, n || 0);
267
+ }, Date.prototype.addHours = function(n) {
268
+ return t(this, n || 0);
269
+ }, Date.prototype.subtractHours = function(n) {
270
+ return o(this, n || 0);
271
+ }, Date.prototype.addMinutes = function(n) {
272
+ return e(this, n || 0);
273
+ }, Date.prototype.subtractMinutes = function(n) {
274
+ return h(this, n || 0);
275
275
  }, Date.prototype.getWeek = function() {
276
- return M(this);
276
+ return E(this);
277
277
  }, Date.prototype.isToday = function() {
278
- return P(this);
278
+ return L(this);
279
279
  }, Date.prototype.isLeapYear = function() {
280
280
  return l(this);
281
- }, Date.prototype.format = function(a = "YYYY-MM-DD") {
282
- return ue(this, a);
283
- }, Date.prototype.formatTime = function(a = "HH:mm") {
284
- return de(this, a);
281
+ }, Date.prototype.format = function(n = "YYYY-MM-DD") {
282
+ return oe(this, n);
283
+ }, Date.prototype.formatTime = function(n = "HH:mm") {
284
+ return se(this, n);
285
285
  };
286
- }, i = () => {
286
+ }, u = () => {
287
287
  delete Date.prototype.addDays, delete Date.prototype.subtractDays, delete Date.prototype.addHours, delete Date.prototype.subtractHours, delete Date.prototype.addMinutes, delete Date.prototype.subtractMinutes, delete Date.prototype.getWeek, delete Date.prototype.isToday, delete Date.prototype.isLeapYear, delete Date.prototype.format, delete Date.prototype.formatTime;
288
- }, f = (a) => {
289
- m.value = a, Date.prototype.subtractDays && j();
290
- }, T = () => (h !== (/* @__PURE__ */ new Date()).getDate() && (r = /* @__PURE__ */ new Date(), h = r.getDate(), p = `${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`), p), W = (a, w) => {
291
- const y = new Date(a.valueOf());
292
- return y.setDate(y.getDate() + w), y;
293
- }, R = (a, w) => {
294
- const y = new Date(a.valueOf());
295
- return y.setDate(y.getDate() - w), y;
296
- }, o = (a, w) => {
297
- const y = new Date(a.valueOf());
298
- return y.setHours(y.getHours() + w), y;
299
- }, c = (a, w) => {
300
- const y = new Date(a.valueOf());
301
- return y.setHours(y.getHours() - w), y;
302
- }, e = (a, w) => {
303
- const y = new Date(a.valueOf());
304
- return y.setMinutes(y.getMinutes() + w), y;
305
- }, d = (a, w) => {
306
- const y = new Date(a.valueOf());
307
- return y.setMinutes(y.getMinutes() - w), y;
308
- }, g = (a, w) => {
309
- const y = (B) => {
310
- const Q = B % w;
311
- return Q !== 0 && (B += Q >= w / 2 ? w - Q : -Q), B;
288
+ }, m = (n) => {
289
+ f.value = n, Date.prototype.subtractDays && F();
290
+ }, Y = () => (d !== (/* @__PURE__ */ new Date()).getDate() && (r = /* @__PURE__ */ new Date(), d = r.getDate(), w = `${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`), w), W = (n, _) => {
291
+ const g = new Date(n.valueOf());
292
+ return g.setDate(g.getDate() + _), g;
293
+ }, q = (n, _) => {
294
+ const g = new Date(n.valueOf());
295
+ return g.setDate(g.getDate() - _), g;
296
+ }, t = (n, _) => {
297
+ const g = new Date(n.valueOf());
298
+ return g.setHours(g.getHours() + _), g;
299
+ }, o = (n, _) => {
300
+ const g = new Date(n.valueOf());
301
+ return g.setHours(g.getHours() - _), g;
302
+ }, e = (n, _) => {
303
+ const g = new Date(n.valueOf());
304
+ return g.setMinutes(g.getMinutes() + _), g;
305
+ }, h = (n, _) => {
306
+ const g = new Date(n.valueOf());
307
+ return g.setMinutes(g.getMinutes() - _), g;
308
+ }, c = (n, _) => {
309
+ const g = (A) => {
310
+ const x = A % _;
311
+ return x !== 0 && (A += x >= _ / 2 ? _ - x : -x), A;
312
312
  };
313
- if (typeof a == "number") return y(a);
314
- if (a instanceof Date) {
315
- let B = y(a.getMinutes());
316
- B >= 60 && (a.setHours(a.getHours() + 1), B = 0), a.setMinutes(B, 0, 0);
313
+ if (typeof n == "number") return g(n);
314
+ if (n instanceof Date) {
315
+ let A = g(n.getMinutes());
316
+ A >= 60 && (n.setHours(n.getHours() + 1), A = 0), n.setMinutes(A, 0, 0);
317
317
  }
318
- }, M = (a, w = !1) => {
319
- const y = new Date(Date.UTC(a.getFullYear(), a.getMonth(), a.getDate())), B = y.getUTCDay() || 7;
320
- y.setUTCDate(y.getUTCDate() + 4 - B);
321
- const Q = new Date(Date.UTC(y.getUTCFullYear(), 0, 1));
322
- return Math.ceil(((y - Q) / 864e5 + 1) / 7) + (w ? 1 : 0);
323
- }, P = (a) => `${a.getFullYear()}-${a.getMonth()}-${a.getDate()}` === T(), A = (a, w) => {
324
- if (!a || !w) return console.warn(`Vue Cal: missing date${a ? "2" : "1"} parameter for comparison with \`isSameDate(date1, date2)\`.`);
325
- if (Z(a)) {
326
- if (!Z(w)) return console.warn(`Vue Cal: invalid date2 provided for comparison with \`isSameDate(date1, date2)\`: \`${w}\`.`);
327
- } else return console.warn(`Vue Cal: invalid date1 provided for comparison with \`isSameDate(date1, date2)\`: \`${a}\`.`);
328
- return a.getFullYear() === w.getFullYear() && a.getMonth() === w.getMonth() && a.getDate() === w.getDate();
329
- }, s = (a, w, y) => Z(a) ? a.getTime() >= w && a.getTime() <= y : console.warn(`Vue Cal: invalid date provided to \`isInRange(date, rangeStart, rangeEnd)\`: \`${a}\`.`), l = (a) => {
330
- const w = a.getFullYear();
331
- return !(w % 400) || w % 100 && !(w % 4);
332
- }, _ = (a = null, w) => {
333
- const y = a && new Date(a.valueOf()) || /* @__PURE__ */ new Date(), B = w ? 7 : 6;
334
- return y.setDate(y.getDate() - (y.getDay() + B) % 7), y;
335
- }, t = (a) => a instanceof Date ? a : (a.length === 10 && (a += " 00:00"), new Date(a.replace(/-/g, "/"))), C = (a) => a.getHours() * 60 + a.getMinutes(), L = (a, w) => {
336
- typeof a == "string" && (a = a.replace(/-/g, "/")), typeof w == "string" && (w = w.replace(/-/g, "/")), a = new Date(a).setHours(0, 0, 0, 0), w = new Date(w).setHours(0, 0, 1, 0);
337
- const y = (new Date(w).getTimezoneOffset() - new Date(a).getTimezoneOffset()) * 60 * 1e3;
338
- return Math.ceil((w - a - y) / (24 * 3600 * 1e3));
339
- }, J = (a, w, y) => Math.abs(a.getTime() - w.getTime()) <= y * 60 * 1e3, Z = (a) => a && a instanceof Date && !isNaN(a), ue = (a, w = "YYYY-MM-DD", y = null) => {
340
- if (y || (y = m.value), w || (w = "YYYY-MM-DD"), w === "YYYY-MM-DD") return ce(a);
318
+ }, E = (n, _ = !1) => {
319
+ const g = new Date(Date.UTC(n.getFullYear(), n.getMonth(), n.getDate())), A = g.getUTCDay() || 7;
320
+ g.setUTCDate(g.getUTCDate() + 4 - A);
321
+ const x = new Date(Date.UTC(g.getUTCFullYear(), 0, 1));
322
+ return Math.ceil(((g - x) / 864e5 + 1) / 7) + (_ ? 1 : 0);
323
+ }, L = (n) => `${n.getFullYear()}-${n.getMonth()}-${n.getDate()}` === Y(), z = (n, _) => {
324
+ if (!n || !_) return console.warn(`Vue Cal: missing date${n ? "2" : "1"} parameter for comparison with \`isSameDate(date1, date2)\`.`);
325
+ if (R(n)) {
326
+ if (!R(_)) return console.warn(`Vue Cal: invalid date2 provided for comparison with \`isSameDate(date1, date2)\`: \`${_}\`.`);
327
+ } else return console.warn(`Vue Cal: invalid date1 provided for comparison with \`isSameDate(date1, date2)\`: \`${n}\`.`);
328
+ return n.getFullYear() === _.getFullYear() && n.getMonth() === _.getMonth() && n.getDate() === _.getDate();
329
+ }, D = (n, _, g) => R(n) ? n.getTime() >= _ && n.getTime() <= g : console.warn(`Vue Cal: invalid date provided to \`isInRange(date, rangeStart, rangeEnd)\`: \`${n}\`.`), l = (n) => {
330
+ const _ = n.getFullYear();
331
+ return !(_ % 400) || _ % 100 && !(_ % 4);
332
+ }, p = (n = null, _) => {
333
+ const g = n && new Date(n.valueOf()) || /* @__PURE__ */ new Date(), A = _ ? 7 : 6;
334
+ return g.setDate(g.getDate() - (g.getDay() + A) % 7), g;
335
+ }, k = (n) => n instanceof Date ? n : (n.length === 10 && (n += " 00:00"), new Date(n.replace(/-/g, "/"))), a = (n) => n.getHours() * 60 + n.getMinutes(), O = (n, _) => {
336
+ typeof n == "string" && (n = n.replace(/-/g, "/")), typeof _ == "string" && (_ = _.replace(/-/g, "/")), n = new Date(n).setHours(0, 0, 0, 0), _ = new Date(_).setHours(0, 0, 1, 0);
337
+ const g = (new Date(_).getTimezoneOffset() - new Date(n).getTimezoneOffset()) * 60 * 1e3;
338
+ return Math.ceil((_ - n - g) / (24 * 3600 * 1e3));
339
+ }, B = (n, _, g) => Math.abs(n.getTime() - _.getTime()) <= g * 60 * 1e3, R = (n) => n && n instanceof Date && !isNaN(n), oe = (n, _ = "YYYY-MM-DD", g = null) => {
340
+ if (g || (g = f.value), _ || (_ = "YYYY-MM-DD"), _ === "YYYY-MM-DD") return te(n);
341
341
  b = {}, H = {};
342
- const B = {
343
- YYYY: () => ee(a, y).YYYY,
344
- YY: () => ee(a, y).YY(),
345
- M: () => ee(a, y).M,
346
- MM: () => ee(a, y).MM(),
347
- MMM: () => ee(a, y).MMM(),
348
- MMMM: () => ee(a, y).MMMM(),
349
- MMMMG: () => ee(a, y).MMMMG(),
350
- D: () => ee(a, y).D,
351
- DD: () => ee(a, y).DD(),
352
- S: () => ee(a, y).S(),
353
- d: () => ee(a, y).d,
354
- dd: () => ee(a, y).dd(),
355
- ddd: () => ee(a, y).ddd(),
356
- dddd: () => ee(a, y).dddd(),
357
- HH: () => x(a, y).HH,
358
- H: () => x(a, y).H,
359
- hh: () => x(a, y).hh,
360
- h: () => x(a, y).h,
361
- am: () => x(a, y).am,
362
- AM: () => x(a, y).AM,
363
- mm: () => x(a, y).mm,
364
- m: () => x(a, y).m,
365
- s: () => x(a, y).s
342
+ const A = {
343
+ YYYY: () => Q(n, g).YYYY,
344
+ YY: () => Q(n, g).YY(),
345
+ M: () => Q(n, g).M,
346
+ MM: () => Q(n, g).MM(),
347
+ MMM: () => Q(n, g).MMM(),
348
+ MMMM: () => Q(n, g).MMMM(),
349
+ MMMMG: () => Q(n, g).MMMMG(),
350
+ D: () => Q(n, g).D,
351
+ DD: () => Q(n, g).DD(),
352
+ S: () => Q(n, g).S(),
353
+ d: () => Q(n, g).d,
354
+ dd: () => Q(n, g).dd(),
355
+ ddd: () => Q(n, g).ddd(),
356
+ dddd: () => Q(n, g).dddd(),
357
+ HH: () => le(n, g).HH,
358
+ H: () => le(n, g).H,
359
+ hh: () => le(n, g).hh,
360
+ h: () => le(n, g).h,
361
+ am: () => le(n, g).am,
362
+ AM: () => le(n, g).AM,
363
+ mm: () => le(n, g).mm,
364
+ m: () => le(n, g).m,
365
+ s: () => le(n, g).s
366
366
  };
367
- return w.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (Q, he) => {
368
- const te = B[he.replace(/\{|\}/g, "")];
369
- return te !== void 0 ? te() : he;
367
+ return _.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (x, he) => {
368
+ const i = A[he.replace(/\{|\}/g, "")];
369
+ return i !== void 0 ? i() : he;
370
370
  });
371
- }, ce = (a) => {
372
- const w = a.getMonth() + 1, y = a.getDate();
373
- return `${a.getFullYear()}-${w < 10 ? "0" : ""}${w}-${y < 10 ? "0" : ""}${y}`;
374
- }, de = (a, w = "HH:mm", y = null, B = !1) => {
375
- let Q = !1;
376
- if (B) {
377
- const [u, k, E] = [a.getHours(), a.getMinutes(), a.getSeconds()];
378
- u + k + E === 141 && (Q = !0);
371
+ }, te = (n) => {
372
+ const _ = n.getMonth() + 1, g = n.getDate();
373
+ return `${n.getFullYear()}-${_ < 10 ? "0" : ""}${_}-${g < 10 ? "0" : ""}${g}`;
374
+ }, se = (n, _ = "HH:mm", g = null, A = !1) => {
375
+ let x = !1;
376
+ if (A) {
377
+ const [T, S, $] = [n.getHours(), n.getMinutes(), n.getSeconds()];
378
+ T + S + $ === 141 && (x = !0);
379
379
  }
380
- if (a instanceof Date && w === "HH:mm") return Q ? "24:00" : pe(a);
381
- H = {}, y || (y = m.value);
382
- const he = x(a, y), te = w.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (u, k) => {
383
- const E = he[k.replace(/\{|\}/g, "")];
384
- return E !== void 0 ? E : k;
380
+ if (n instanceof Date && _ === "HH:mm") return x ? "24:00" : ce(n);
381
+ H = {}, g || (g = f.value);
382
+ const he = le(n, g), i = _.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (T, S) => {
383
+ const $ = he[S.replace(/\{|\}/g, "")];
384
+ return $ !== void 0 ? $ : S;
385
385
  });
386
- return Q ? te.replace("23:59", "24:00") : te;
387
- }, pe = (a) => {
388
- const w = a.getHours(), y = a.getMinutes();
389
- return `${(w < 10 ? "0" : "") + w}:${(y < 10 ? "0" : "") + y}`;
390
- }, oe = (a) => {
391
- const w = Math.floor(a / 60).toString().padStart(2, 0), y = (a % 60).toString().padStart(2, 0);
392
- return `${w}:${y}`;
393
- }, K = (a) => {
394
- if (a > 3 && a < 21) return "th";
395
- switch (a % 10) {
386
+ return x ? i.replace("23:59", "24:00") : i;
387
+ }, ce = (n) => {
388
+ const _ = n.getHours(), g = n.getMinutes();
389
+ return `${(_ < 10 ? "0" : "") + _}:${(g < 10 ? "0" : "") + g}`;
390
+ }, X = (n) => {
391
+ const _ = Math.floor(n / 60).toString().padStart(2, 0), g = (n % 60).toString().padStart(2, 0);
392
+ return `${_}:${g}`;
393
+ }, Ee = (n) => {
394
+ if (n > 3 && n < 21) return "th";
395
+ switch (n % 10) {
396
396
  case 1:
397
397
  return "st";
398
398
  case 2:
@@ -402,94 +402,97 @@ const st = (D, n) => {
402
402
  default:
403
403
  return "th";
404
404
  }
405
- }, ee = (a, w) => {
405
+ }, Q = (n, _) => {
406
406
  if (b.D) return b;
407
- const y = a.getFullYear(), B = a.getMonth() + 1, Q = a.getDate(), te = (a.getDay() - 1 + 7) % 7;
407
+ const g = n.getFullYear(), A = n.getMonth() + 1, x = n.getDate(), i = (n.getDay() - 1 + 7) % 7;
408
408
  return b = {
409
409
  // Year.
410
- YYYY: y,
410
+ YYYY: g,
411
411
  // 2024.
412
- YY: () => y.toString().substring(2),
412
+ YY: () => g.toString().substring(2),
413
413
  // 24.
414
414
  // Month.
415
- M: B,
415
+ M: A,
416
416
  // 1 to 12.
417
- MM: () => B.toString().padStart(2, 0),
417
+ MM: () => A.toString().padStart(2, 0),
418
418
  // 01 to 12.
419
- MMM: () => w.months[B - 1].substring(0, 3),
419
+ MMM: () => _.months[A - 1].substring(0, 3),
420
420
  // Jan to Dec.
421
- MMMM: () => w.months[B - 1],
421
+ MMMM: () => _.months[A - 1],
422
422
  // January to December.
423
- MMMMG: () => (w.monthsGenitive || w.months)[B - 1],
423
+ MMMMG: () => (_.monthsGenitive || _.months)[A - 1],
424
424
  // January to December in genitive form (Greek...)
425
425
  // Day.
426
- D: Q,
426
+ D: x,
427
427
  // 1 to 31.
428
- DD: () => Q.toString().padStart(2, 0),
428
+ DD: () => x.toString().padStart(2, 0),
429
429
  // 01 to 31.
430
- S: () => K(Q),
430
+ S: () => Ee(x),
431
431
  // st, nd, rd, th.
432
432
  // Day of the week.
433
- d: te + 1,
433
+ d: i + 1,
434
434
  // 1 to 7 with 7 = Sunday.
435
435
  // Some locales have same start for all the days, so they have specific abbrev in weekDaysShort.
436
- dd: () => w.weekDaysShort.length ? w.weekDaysShort[te] : w.weekDays[te][0],
436
+ dd: () => _.weekDaysShort.length ? _.weekDaysShort[i] : _.weekDays[i][0],
437
437
  // M to S.
438
- ddd: () => w.weekDaysShort.length ? w.weekDaysShort[te] : w.weekDays[te].substr(0, 3),
438
+ ddd: () => _.weekDaysShort.length ? _.weekDaysShort[i] : _.weekDays[i].substr(0, 3),
439
439
  // Mon to Sun.
440
- dddd: () => w.weekDays[te]
440
+ dddd: () => _.weekDays[i]
441
441
  // Monday to Sunday.
442
442
  }, b;
443
- }, x = (a, w) => {
443
+ }, le = (n, _) => {
444
444
  if (H.am) return H;
445
- let y, B, Q;
446
- a instanceof Date ? (y = a.getHours(), B = a.getMinutes(), Q = a.getSeconds()) : (y = Math.floor(a / 60), B = Math.floor(a % 60));
447
- const he = y % 12 ? y % 12 : 12, te = (w || { am: "am", pm: "pm" })[y === 24 || y < 12 ? "am" : "pm"];
445
+ let g, A, x;
446
+ n instanceof Date ? (g = n.getHours(), A = n.getMinutes(), x = n.getSeconds()) : (g = Math.floor(n / 60), A = Math.floor(n % 60));
447
+ const he = g % 12 ? g % 12 : 12, i = (_ || { am: "am", pm: "pm" })[g === 24 || g < 12 ? "am" : "pm"];
448
448
  return H = {
449
- H: y,
449
+ H: g,
450
450
  h: he,
451
- HH: y.toString().padStart(2, 0),
451
+ HH: g.toString().padStart(2, 0),
452
452
  hh: he.toString().padStart(2, 0),
453
- am: te,
454
- AM: te.toUpperCase(),
455
- m: B,
456
- mm: B.toString().padStart(2, 0),
457
- s: Q
453
+ am: i,
454
+ AM: i.toUpperCase(),
455
+ m: A,
456
+ mm: A.toString().padStart(2, 0),
457
+ s: x
458
458
  }, H;
459
459
  };
460
460
  return {
461
- addDatePrototypes: j,
462
- removeDatePrototypes: i,
463
- updateTexts: f,
461
+ addDatePrototypes: F,
462
+ removeDatePrototypes: u,
463
+ updateTexts: m,
464
464
  addDays: W,
465
- subtractDays: R,
466
- addHours: o,
467
- subtractHours: c,
465
+ subtractDays: q,
466
+ addHours: t,
467
+ subtractHours: o,
468
468
  addMinutes: e,
469
- subtractMinutes: d,
470
- snapToInterval: g,
471
- getWeek: M,
472
- isToday: P,
473
- isSameDate: A,
474
- isInRange: s,
469
+ subtractMinutes: h,
470
+ snapToInterval: c,
471
+ getWeek: E,
472
+ isToday: L,
473
+ isSameDate: z,
474
+ isInRange: D,
475
475
  isLeapYear: l,
476
- getPreviousFirstDayOfWeek: _,
477
- stringToDate: t,
478
- dateToMinutes: C,
479
- countDays: L,
480
- datesInSameTimeStep: J,
481
- isValid: Z,
482
- formatDate: ue,
483
- formatDateLite: ce,
484
- formatTime: de,
485
- formatTimeLite: pe,
486
- formatMinutes: oe
476
+ getPreviousFirstDayOfWeek: p,
477
+ stringToDate: k,
478
+ dateToMinutes: a,
479
+ countDays: O,
480
+ datesInSameTimeStep: B,
481
+ isValid: R,
482
+ formatDate: oe,
483
+ formatDateLite: te,
484
+ formatTime: se,
485
+ formatTimeLite: ce,
486
+ formatMinutes: X
487
487
  };
488
- }, St = (D) => {
489
- const { dateUtils: n, config: r } = D;
490
- let h = 0;
491
- const p = $(() => {
492
- const o = {
488
+ }, St = (y) => {
489
+ const { dateUtils: s, config: r } = y;
490
+ let d = 0;
491
+ const w = M(() => {
492
+ const t = {
493
+ // A map of events indexed by { YYYY: { MM: { DD: [] } } }.
494
+ // Each year contains a map of 12 months starting from 1, each containing a map of days starting from 1, each containing an array of event IDs.
495
+ byYear: {},
493
496
  byDate: {},
494
497
  // A map of single-day events indexed by date.
495
498
  recurring: [],
@@ -497,434 +500,454 @@ const st = (D, n) => {
497
500
  multiday: [],
498
501
  // An array of events IDs that are multiday.
499
502
  byId: {}
500
- // A map of all the events indexed by ID for fast lookup.
501
- }, c = r.events.sort((e, d) => e.start - d.start < 0 ? -1 : 1);
502
- for (const e of c)
503
- b(e), e._ || (e._ = {}), e._.id = e._.id || ++h, e.delete || (e.delete = (d) => f(e._.id, d)), e._.deleting = !1, e._.deleted = !1, e.isOverlapping = (d = null) => e.getOverlappingEvents(d).length, e.getOverlappingEvents = (d = null) => {
504
- var g;
505
- return W(
506
- m(n.formatDate((d == null ? void 0 : d.start) || e.start), !0),
507
- { start: (d == null ? void 0 : d.start) || e.start, end: (d == null ? void 0 : d.end) || e.end },
508
- { excludeIds: [e._.id], schedule: (g = r.schedules) != null && g.length ? ~~((d == null ? void 0 : d.schedule) || e.schedule) : null }
509
- );
510
- }, e._.register = (d) => {
511
- e._.$el = d, e._.fireCreated && (D.emit("event-created", e), delete e._.fireCreated);
512
- }, e._.unregister = () => {
513
- e._.$el = null, e._.register = null, e.isOverlapping = null, e.getOverlappingEvents = null, e.delete = null;
514
- }, o.byId[e._.id] = e, e.recurring ? o.recurring.push(e._.id) : e._.multiday ? (o.multiday.push(e._.id), o.byDate[e._.startFormatted] || (o.byDate[e._.startFormatted] = []), o.byDate[e._.startFormatted].push(e._.id)) : (o.byDate[e._.startFormatted] || (o.byDate[e._.startFormatted] = []), o.byDate[e._.startFormatted].push(e._.id));
515
- return o;
516
- }), b = (o) => {
517
- if (typeof o.start == "string" && (o.start = n.stringToDate(o.start)), typeof o.end == "string" && (o.end = n.stringToDate(o.end)), o.start.setSeconds(0, 0), o.end.setSeconds(0, 0), isNaN(o.start) || isNaN(o.end)) {
518
- isNaN(o.start) ? console.error(`Vue Cal: invalid start date for event "${o.title}".`, o.start) : console.error(`Vue Cal: invalid end date for event "${o.title}".`, o.end);
503
+ // A map of all the events indexed by ID for fast lookup. Each event is the original full event object.
504
+ }, o = r.events.sort((e, h) => e.start - h.start < 0 ? -1 : 1);
505
+ for (const e of o)
506
+ if (b(e), H(e), t.byId[e._.id] = e, e.recurring)
507
+ t.recurring.push(e._.id);
508
+ else if (e._.multiday)
509
+ t.multiday.push(e._.id), t.byDate[e._.startFormatted] || (t.byDate[e._.startFormatted] = []), t.byDate[e._.startFormatted].push(e._.id);
510
+ else {
511
+ t.byDate[e._.startFormatted] || (t.byDate[e._.startFormatted] = []), t.byDate[e._.startFormatted].push(e._.id);
512
+ const h = e._.startFormatted.substring(0, 4), c = e._.startFormatted.substring(5, 7), E = e._.startFormatted.substring(8, 10);
513
+ t.byYear[h] || (t.byYear[h] = {}), t.byYear[h][c] || (t.byYear[h][c] = {}), t.byYear[h][c][E] || (t.byYear[h][c][E] = []), t.byYear[h][c][E].push(e._.id);
514
+ }
515
+ return t;
516
+ }), b = (t) => {
517
+ if (typeof t.start == "string" && (t.start = s.stringToDate(t.start)), typeof t.end == "string" && (t.end = s.stringToDate(t.end)), t.start.setSeconds(0, 0), t.end.setSeconds(0, 0), isNaN(t.start) || isNaN(t.end)) {
518
+ isNaN(t.start) ? console.error(`Vue Cal: invalid start date for event "${t.title}".`, t.start) : console.error(`Vue Cal: invalid end date for event "${t.title}".`, t.end);
519
519
  return;
520
- } else o.end.getTime() < o.start.getTime() && console.error(`Vue Cal: invalid event dates for event "${o.title}". The event ends before it starts.`, o.start, o.end);
521
- o._ || (o._ = {}), o._.multiday = !n.isSameDate(o.start, new Date(o.end.getTime() - 1)), o._.startFormatted = n.formatDate(o.start), o._.startMinutes = ~~n.dateToMinutes(o.start), o._.endMinutes = ~~n.dateToMinutes(o.end);
522
- const c = o.start.getHours(), e = o.start.getMinutes().toString().padStart(2, 0), d = o.end.getHours(), g = o.end.getMinutes().toString().padStart(2, 0);
523
- o._.startTimeFormatted24 = `${c.toString().padStart(2, 0)}:${e}`, o._.startTimeFormatted12 = `${c % 12 || 12}${e ? `:${e}` : ""} ${c < 12 ? "AM" : "PM"}`, o._.endTimeFormatted24 = `${d.toString().padStart(2, 0)}:${g}`, o._.endTimeFormatted12 = `${d % 12 || 12}${g ? `:${g}` : ""} ${d < 12 ? "AM" : "PM"}`, o._.duration = Math.abs(~~((o.end - o.start) / 6e4));
524
- }, H = (o) => p.value.byId[o], m = (o, c = !1, e = !1) => {
525
- let d = p.value.byDate[o] || [];
526
- return d = c || e ? d.map(H) : d, e || (d = d.filter((g) => !g.background && !g._.deleted), c || (d = d.map((g) => g._.id))), d;
527
- }, j = (o) => {
528
- const c = {};
529
- for (const { startFormatted: e } of o) {
530
- c[e] = [];
531
- const d = m(e, !1, !0);
532
- d.length && c[e].push(...d);
520
+ } else t.end.getTime() < t.start.getTime() && console.error(`Vue Cal: invalid event dates for event "${t.title}". The event ends before it starts.`, t.start, t.end);
521
+ t._ || (t._ = {}), t._.multiday = !s.isSameDate(t.start, new Date(t.end.getTime() - 1)), t._.startFormatted = s.formatDate(t.start), t._.startMinutes = ~~s.dateToMinutes(t.start), t._.endMinutes = ~~s.dateToMinutes(t.end);
522
+ const o = t.start.getHours(), e = t.start.getMinutes().toString().padStart(2, 0), h = t.end.getHours(), c = t.end.getMinutes().toString().padStart(2, 0);
523
+ t._.startTimeFormatted24 = `${o.toString().padStart(2, 0)}:${e}`, t._.startTimeFormatted12 = `${o % 12 || 12}${e ? `:${e}` : ""} ${o < 12 ? "AM" : "PM"}`, t._.endTimeFormatted24 = `${h.toString().padStart(2, 0)}:${c}`, t._.endTimeFormatted12 = `${h % 12 || 12}${c ? `:${c}` : ""} ${h < 12 ? "AM" : "PM"}`, t._.duration = Math.abs(~~((t.end - t.start) / 6e4));
524
+ }, H = (t) => {
525
+ t._ || (t._ = {}), t._.id = t._.id || ++d, t.delete || (t.delete = (o) => m(t._.id, o)), t._.deleting = !1, t._.deleted = !1, t.isOverlapping = (o = null) => t.getOverlappingEvents(o).length, t.getOverlappingEvents = (o = null) => {
526
+ var e;
527
+ return W(
528
+ (o == null ? void 0 : o.start) || t.start,
529
+ (o == null ? void 0 : o.end) || t.end,
530
+ { excludeIds: [t._.id], schedule: (e = r.schedules) != null && e.length ? ~~((o == null ? void 0 : o.schedule) || t.schedule) : null }
531
+ );
532
+ }, t._.register = (o) => {
533
+ t._.$el = o, t._.fireCreated && (y.emit("event-created", t), delete t._.fireCreated);
534
+ }, t._.unregister = () => {
535
+ t._.$el = null, t._.register = null, t.isOverlapping = null, t.getOverlappingEvents = null, t.delete = null;
536
+ };
537
+ }, f = (t) => w.value.byId[t], F = (t) => {
538
+ const o = [];
539
+ for (const { start: e, end: h } of t) {
540
+ const c = W(e, h);
541
+ c.length && o.push(...c);
533
542
  }
534
- return c;
535
- }, i = (o) => {
536
- if (!o.start || !o.end) {
543
+ return o;
544
+ }, u = (t) => {
545
+ if (!t.start || !t.end) {
537
546
  console.error("Vue Cal: Cannot create an event without valid start and end dates.");
538
547
  return;
539
548
  }
540
- return r.snapToInterval && (n.snapToInterval(o.start, r.snapToInterval), n.snapToInterval(o.end, r.snapToInterval)), o = { ...o }, o._ || (o._ = {}), o._.id = ++h, o._.fireCreated = !0, r.events.push(o), o;
541
- }, f = async (o, c = 0) => {
542
- var P, A;
543
- if (!o) return console.warn("Vue Cal: Cannot delete event without its ID or criteria.");
544
- let e = typeof o == "string" || !isNaN(o) ? o : null;
545
- const d = typeof o == "object" ? Object.entries(o) : null;
546
- if (d) {
547
- const [s, l] = d[0];
548
- e = (P = r.events.find((_) => _[s] === l)) == null ? void 0 : P._.id;
549
+ return r.snapToInterval && (s.snapToInterval(t.start, r.snapToInterval), s.snapToInterval(t.end, r.snapToInterval)), t = { ...t }, t._ || (t._ = {}), t._.id = ++d, t._.fireCreated = !0, r.events.push(t), t;
550
+ }, m = async (t, o = 0) => {
551
+ var L, z;
552
+ if (!t) return console.warn("Vue Cal: Cannot delete event without its ID or criteria.");
553
+ let e = typeof t == "string" || !isNaN(t) ? t : null;
554
+ const h = typeof t == "object" ? Object.entries(t) : null;
555
+ if (h) {
556
+ const [D, l] = h[0];
557
+ e = (L = r.events.find((p) => p[D] === l)) == null ? void 0 : L._.id;
549
558
  }
550
559
  if (!r.editableEvents.delete)
551
560
  return console.info("Vue Cal: Event deletion is disabled. Enable it with the `editable-events` props.");
552
561
  if (!e) return console.warn("Vue Cal: Cannot delete event without its ID.");
553
- const g = r.events.findIndex((s) => s._.id === e);
554
- if (g === -1) return console.warn(`Vue Cal: Cannot delete unknown event \`${e}\`.`);
555
- const M = r.events[g];
556
- if (M.deletable === !1) return console.warn(`Vue Cal: Can't delete event \`${e}\` since it was explicitely set to \`delete: false\`.`);
557
- switch (c) {
562
+ const c = r.events.findIndex((D) => D._.id === e);
563
+ if (c === -1) return console.warn(`Vue Cal: Cannot delete unknown event \`${e}\`.`);
564
+ const E = r.events[c];
565
+ if (E.deletable === !1) return console.warn(`Vue Cal: Can't delete event \`${e}\` since it was explicitely set to \`delete: false\`.`);
566
+ switch (o) {
558
567
  case 0:
559
- M._.deleting ? r.events.splice(g, 1) : M._.deleting = !0;
568
+ E._.deleting ? r.events.splice(c, 1) : E._.deleting = !0;
560
569
  break;
561
570
  // Display the delete button.
562
571
  case 1:
563
- M._.deleting = !0;
572
+ E._.deleting = !0;
564
573
  break;
565
574
  // Visual deletion + external DOM event firing.
566
575
  // When explicitly using this stage, the event will be visually deleted but still present in the
567
576
  // source of truth until the cell is unmounted (by navigating away).
568
577
  case 2:
569
- M._.deleted = !0, r.events[g]._.deleted = !0, (A = M._.$el) == null || A.dispatchEvent(new CustomEvent("event-deleted", { detail: M._.id }));
578
+ E._.deleted = !0, r.events[c]._.deleted = !0, (z = E._.$el) == null || z.dispatchEvent(new CustomEvent("event-deleted", { detail: E._.id }));
570
579
  break;
571
580
  // Effective deletion from the source of truth (by default, when unmounting the cell).
572
581
  case 3:
573
- r.events.splice(g, 1), D.emit("update:events", r.events), D.emit("event-delete", M);
582
+ r.events.splice(c, 1), y.emit("update:events", r.events), y.emit("event-delete", E);
574
583
  break;
575
584
  }
576
585
  return !0;
577
- }, T = (o) => {
578
- const c = m(o, !0);
579
- if (!c.length) return { cellOverlaps: {}, longestStreak: 0 };
580
- const e = {};
581
- let d = [], g = 0;
582
- c.sort((M, P) => M.start - P.start || M.end - M.start - (P.end - P.start));
583
- for (const M of c) {
584
- const P = M._.id;
585
- e[P] || (e[P] = { overlaps: /* @__PURE__ */ new Set(), maxConcurrent: 1, position: 0 }), d = d.filter((t) => t.end > M.start);
586
- const A = d.filter((t) => {
587
- var L;
588
- return (!((L = r.schedules) != null && L.length) || M.schedule === t.schedule) && t.start < M.end;
589
- }), s = new Set(A.map((t) => {
590
- var C;
591
- return ((C = e[t._.id]) == null ? void 0 : C.position) ?? 0;
586
+ }, Y = (t, o) => {
587
+ const e = W(t, o);
588
+ if (!e.length) return { cellOverlaps: {}, longestStreak: 0 };
589
+ const h = {};
590
+ let c = [], E = 0;
591
+ e.sort((L, z) => L.start - z.start || L.end - L.start - (z.end - z.start));
592
+ for (const L of e) {
593
+ const z = L._.id;
594
+ h[z] || (h[z] = { overlaps: /* @__PURE__ */ new Set(), maxConcurrent: 1, position: 0 }), c = c.filter((a) => a.end > L.start);
595
+ const D = c.filter((a) => {
596
+ var B;
597
+ return (!((B = r.schedules) != null && B.length) || L.schedule === a.schedule) && a.start < L.end;
598
+ }), l = new Set(D.map((a) => {
599
+ var O;
600
+ return ((O = h[a._.id]) == null ? void 0 : O.position) ?? 0;
592
601
  }));
593
- let l = 0;
594
- for (; s.has(l); ) l++;
595
- e[P].position = l, d.push(M);
596
- const _ = Math.max(1, ...A.map((t) => {
597
- var C;
598
- return ((C = e[t._.id]) == null ? void 0 : C.maxConcurrent) ?? 1;
602
+ let p = 0;
603
+ for (; l.has(p); ) p++;
604
+ h[z].position = p, c.push(L);
605
+ const k = Math.max(1, ...D.map((a) => {
606
+ var O;
607
+ return ((O = h[a._.id]) == null ? void 0 : O.maxConcurrent) ?? 1;
599
608
  }));
600
- e[P].maxConcurrent = Math.max(A.length + 1, _);
601
- for (const t of A)
602
- e[t._.id].overlaps.add(P), e[P].overlaps.add(t._.id), e[t._.id].maxConcurrent = e[P].maxConcurrent;
603
- g = Math.max(g, e[P].maxConcurrent);
609
+ h[z].maxConcurrent = Math.max(D.length + 1, k);
610
+ for (const a of D)
611
+ h[a._.id].overlaps.add(z), h[z].overlaps.add(a._.id), h[a._.id].maxConcurrent = h[z].maxConcurrent;
612
+ E = Math.max(E, h[z].maxConcurrent);
604
613
  }
605
- for (const M in e) e[M].overlaps = [...e[M].overlaps];
606
- return { cellOverlaps: e, longestStreak: g };
607
- }, W = (o = [], { start: c, end: e }, { excludeIds: d = [], schedule: g = null }) => {
608
- var A;
609
- const M = new Set(d), P = [];
610
- for (const s of o)
611
- !M.has((A = s._) == null ? void 0 : A.id) && (g === null || g === s.schedule) && R(s, c, e) && P.push(s);
612
- return P;
613
- }, R = (o, c, e) => {
614
- const d = o.allDay || !r.time, g = d ? new Date(o.start).setHours(0, 0, 0, 0) : o.start.getTime(), M = d ? new Date(o.end).setHours(23, 59, 59, 999) : o.end.getTime(), P = d ? new Date(c).setHours(0, 0, 0, 0) : c.getTime(), A = d ? new Date(e).setHours(23, 59, 59, 999) : e.getTime();
615
- return M > P && g < A;
614
+ for (const L in h) h[L].overlaps = [...h[L].overlaps];
615
+ return { cellOverlaps: h, longestStreak: E };
616
+ }, W = (t, o, { excludeIds: e = [], schedule: h = null, background: c = !0 } = {}) => {
617
+ const E = t.getFullYear(), L = o.getFullYear(), z = t.getMonth() + 1, D = o.getMonth() + 1, l = t.getDate(), p = o.getDate(), k = t.getTime(), a = o.getTime(), O = [], B = new Set(e);
618
+ for (let R = E; R <= L; R++) {
619
+ const oe = `${R}`, te = w.value.byYear[oe];
620
+ if (!te) continue;
621
+ const se = R === E ? z : 1, ce = R === L ? D : 12;
622
+ for (let X = se; X <= ce; X++) {
623
+ const Ee = String(X).padStart(2, "0"), Q = te[Ee];
624
+ if (Q)
625
+ for (const le in Q) {
626
+ const n = +le;
627
+ if (R === E && X === z && n < l || R === L && X === D && n > p) continue;
628
+ const _ = Q[le];
629
+ for (let g = 0; g < _.length; g++) {
630
+ const A = w.value.byId[_[g]];
631
+ !A || B.has(A._.id) || h !== null && h !== A.schedule || c === !1 && A.background || A.end.getTime() > k && A.start.getTime() < a && O.push(A);
632
+ }
633
+ }
634
+ }
635
+ }
636
+ return O;
616
637
  };
617
638
  return {
618
- events: p,
619
- getEvent: H,
620
- getEventsByDate: m,
621
- getViewEvents: j,
622
- getCellOverlappingEvents: T,
639
+ events: w,
640
+ getEvent: f,
641
+ getViewEvents: F,
642
+ getCellOverlappingEvents: Y,
623
643
  getEventsInRange: W,
624
- createEvent: i,
625
- deleteEvent: f,
626
- isEventInRange: R
644
+ createEvent: u,
645
+ deleteEvent: m,
646
+ isEventInRange: (t, o, e) => {
647
+ const h = t.allDay || !r.time, c = h ? new Date(t.start).setHours(0, 0, 0, 0) : t.start.getTime(), E = h ? new Date(t.end).setHours(23, 59, 59, 999) : t.end.getTime(), L = h ? new Date(o).setHours(0, 0, 0, 0) : o.getTime(), z = h ? new Date(e).setHours(23, 59, 59, 999) : e.getTime();
648
+ return E > L && c < z;
649
+ }
627
650
  };
628
- }, Ct = ({ config: D, dateUtils: n, emit: r, texts: h, eventsManager: p }, b) => {
629
- const { availableViews: H } = D, m = ie(D.view && H[D.view] ? D.view : D.defaultView), j = ie(D.selectedDate || null), i = ie(/* @__PURE__ */ new Date()), f = ie(new Date(D.viewDate || i.value));
630
- f.value.setHours(0, 0, 0, 0);
631
- const T = ie(new Date(f));
651
+ }, Ct = ({ config: y, dateUtils: s, emit: r, texts: d, eventsManager: w }, b) => {
652
+ const { availableViews: H } = y, f = ue(y.view && H[y.view] ? y.view : y.defaultView), F = ue(y.selectedDate || null), u = ue(/* @__PURE__ */ new Date()), m = ue(new Date(y.viewDate || u.value));
653
+ m.value.setHours(0, 0, 0, 0);
654
+ const Y = ue(new Date(m));
632
655
  let W = null;
633
- const R = $(() => m.value === "month" ? T.value : l.value), o = $(() => m.value === "month" ? new Date(T.value.getFullYear(), T.value.getMonth() + 1, 0, 23, 59, 59, 999) : t.value), c = $(() => m.value === "week" ? n.getPreviousFirstDayOfWeek(l.value, D.startWeekOnSunday) : m.value === "month" ? l.value : R.value), e = $(() => {
634
- if (m.value === "week") {
635
- const v = n.addDays(c.value, 7);
656
+ const q = M(() => f.value === "month" ? Y.value : l.value), t = M(() => f.value === "month" ? new Date(Y.value.getFullYear(), Y.value.getMonth() + 1, 0, 23, 59, 59, 999) : k.value), o = M(() => f.value === "week" ? s.getPreviousFirstDayOfWeek(l.value, y.startWeekOnSunday) : f.value === "month" ? l.value : q.value), e = M(() => {
657
+ if (f.value === "week") {
658
+ const v = s.addDays(o.value, 7);
636
659
  return v.setMilliseconds(-1), v;
637
660
  }
638
- return m.value === "month" ? t.value : o.value;
639
- }), d = $(() => {
640
- const v = i.value.getTime();
641
- if (m.value === "week")
642
- return c.value.getTime() <= v && v <= e.value.getTime();
643
- const F = l.value.getTime(), X = t.value.getTime();
644
- return F <= v && v <= X;
661
+ return f.value === "month" ? k.value : t.value;
662
+ }), h = M(() => {
663
+ const v = u.value.getTime();
664
+ if (f.value === "week")
665
+ return o.value.getTime() <= v && v <= e.value.getTime();
666
+ const N = l.value.getTime(), Z = k.value.getTime();
667
+ return N <= v && v <= Z;
645
668
  });
646
- function g() {
647
- i.value = /* @__PURE__ */ new Date(), W = setTimeout(g, 60 * 1e3);
669
+ function c() {
670
+ u.value = /* @__PURE__ */ new Date(), W = setTimeout(c, 60 * 1e3);
648
671
  }
649
- function M() {
650
- W = setTimeout(g, (60 - (/* @__PURE__ */ new Date()).getSeconds()) * 1e3), g();
672
+ function E() {
673
+ W = setTimeout(c, (60 - (/* @__PURE__ */ new Date()).getSeconds()) * 1e3), c();
651
674
  }
652
- const P = $(() => {
653
- if (!D.availableViews[m.value]) return 1;
654
- let v = D.availableViews[m.value].cols;
655
- return D.hasHiddenDays && ["week", "month"].includes(m.value) && (v -= D.hasHiddenDays), v;
656
- }), A = $(() => {
675
+ const L = M(() => {
676
+ if (!y.availableViews[f.value]) return 1;
677
+ let v = y.availableViews[f.value].cols;
678
+ return y.hasHiddenDays && ["week", "month"].includes(f.value) && (v -= y.hasHiddenDays), v;
679
+ }), z = M(() => {
657
680
  var v;
658
- return ((v = D.availableViews[m.value]) == null ? void 0 : v.rows) || 1;
659
- }), s = $(() => P.value * A.value), l = $(() => {
660
- if (m.value === "month") {
661
- let v = T.value.getDay() || 7;
662
- return D.startWeekOnSunday && !D.hideWeekdays[7] && (v += 1), D.viewDayOffset && (v -= D.viewDayOffset), n.subtractDays(T.value, v - 1);
681
+ return ((v = y.availableViews[f.value]) == null ? void 0 : v.rows) || 1;
682
+ }), D = M(() => L.value * z.value), l = M(() => {
683
+ if (f.value === "month") {
684
+ let v = Y.value.getDay() || 7;
685
+ return y.startWeekOnSunday && !y.hideWeekdays[7] && (v += 1), y.viewDayOffset && (v -= y.viewDayOffset), s.subtractDays(Y.value, v - 1);
663
686
  }
664
- if (m.value === "week") {
665
- const v = "1234567".split("").filter((X) => !Object.keys(D.hideWeekdays).includes(X));
666
- let F = Math.min(...v);
667
- return D.startWeekOnSunday && !D.hideWeekdays[7] && (F = 1), D.viewDayOffset && (F += D.viewDayOffset), n.addDays(T.value, F - 1);
687
+ if (f.value === "week") {
688
+ const v = "1234567".split("").filter((Z) => !Object.keys(y.hideWeekdays).includes(Z));
689
+ let N = Math.min(...v);
690
+ return y.startWeekOnSunday && !y.hideWeekdays[7] && (N = 1), y.viewDayOffset && (N += y.viewDayOffset), s.addDays(Y.value, N - 1);
668
691
  }
669
- return T.value;
670
- }), _ = $(() => {
671
- const v = [], F = ["days", "week", "month"].includes(m.value);
672
- let X = 0;
673
- for (let G = 0; G < s.value + X; G++)
674
- switch (m.value) {
692
+ return Y.value;
693
+ }), p = M(() => {
694
+ const v = [], N = ["days", "week", "month"].includes(f.value);
695
+ let Z = 0;
696
+ for (let U = 0; U < D.value + Z; U++)
697
+ switch (f.value) {
675
698
  case "day":
676
699
  case "days":
677
700
  case "week":
678
701
  case "month": {
679
- const ve = n.addDays(l.value, G), We = ve.getDay() || 7;
680
- if (F && D.hasHiddenDays && D.hideWeekdays[We]) {
681
- X++;
702
+ const ve = s.addDays(l.value, U), We = ve.getDay() || 7;
703
+ if (N && y.hasHiddenDays && y.hideWeekdays[We]) {
704
+ Z++;
682
705
  continue;
683
706
  }
684
707
  const Ce = new Date(ve);
685
- Ce.setHours(23, 59, 59, 999), v.push({ start: ve, startFormatted: n.formatDate(ve), end: Ce });
708
+ Ce.setHours(23, 59, 59, 999), v.push({ start: ve, startFormatted: s.formatDate(ve), end: Ce });
686
709
  break;
687
710
  }
688
711
  case "year":
689
712
  v.push({
690
- start: new Date(l.value.getFullYear(), G, 1, 0, 0, 0, 0),
691
- end: new Date(l.value.getFullYear(), G + 1, 0, 23, 59, 59, 999)
713
+ start: new Date(l.value.getFullYear(), U, 1, 0, 0, 0, 0),
714
+ end: new Date(l.value.getFullYear(), U + 1, 0, 23, 59, 59, 999)
692
715
  });
693
716
  break;
694
717
  case "years":
695
718
  v.push({
696
- start: new Date(l.value.getFullYear() + G, 0, 1, 0, 0, 0, 0),
697
- end: new Date(l.value.getFullYear() + G + 1, 0, 0, 23, 59, 59, 999)
719
+ start: new Date(l.value.getFullYear() + U, 0, 1, 0, 0, 0, 0),
720
+ end: new Date(l.value.getFullYear() + U + 1, 0, 0, 23, 59, 59, 999)
698
721
  });
699
722
  break;
700
723
  }
701
724
  return v;
702
- }), t = $(() => _.value[_.value.length - 1].end), C = ie("right"), L = $(() => {
703
- const v = Object.keys(D.availableViews);
704
- return v[v.indexOf(m.value) + 1];
705
- }), J = $(() => {
706
- const v = Object.keys(D.availableViews);
707
- return v[v.indexOf(m.value) - 1];
725
+ }), k = M(() => p.value[p.value.length - 1].end), a = ue("right"), O = M(() => {
726
+ const v = Object.keys(y.availableViews);
727
+ return v[v.indexOf(f.value) + 1];
728
+ }), B = M(() => {
729
+ const v = Object.keys(y.availableViews);
730
+ return v[v.indexOf(f.value) - 1];
708
731
  });
709
- function Z(v, F, X = !1) {
710
- if (!F || !F[v]) return v + 1;
711
- const G = F[v];
712
- return X && typeof G == "string" ? G.substring(0, 3) : G;
732
+ function R(v, N, Z = !1) {
733
+ if (!N || !N[v]) return v + 1;
734
+ const U = N[v];
735
+ return Z && typeof U == "string" ? U.substring(0, 3) : U;
713
736
  }
714
- function ue(v, F, X) {
715
- const { monthsArray: G, monthBeforeDay: ve, canTruncate: We, xs: Ce } = X, Me = v.getMonth(), Ye = v.getFullYear(), Ee = F.getMonth(), Fe = F.getFullYear(), Ae = Me !== Ee, pt = Ye !== Fe, Te = We && (Ce || Ae), Le = v.getDate(), He = F.getDate();
716
- return pt ? ve ? `${Z(Me, G, Te)} ${Le}, ${Ye} - ${Z(Ee, G, Te)} ${He}, ${Fe}` : `${Le} ${Z(Me, G, Te)} ${Ye} - ${He} ${Z(Ee, G, Te)} ${Fe}` : Ae ? ve ? `${Z(Me, G, Te)} ${Le} - ${Z(Ee, G, Te)} ${He}, ${Ye}` : `${Le} ${Z(Me, G, Te)} - ${He} ${Z(Ee, G, Te)} ${Ye}` : ve ? `${Z(Me, G, Te)} ${Le}-${He}, ${Ye}` : `${Le}-${He} ${Z(Me, G, Te)} ${Ye}`;
737
+ function oe(v, N, Z) {
738
+ const { monthsArray: U, monthBeforeDay: ve, canTruncate: We, xs: Ce } = Z, Te = v.getMonth(), Me = v.getFullYear(), Ye = N.getMonth(), Pe = N.getFullYear(), Ae = Te !== Ye, pt = Me !== Pe, be = We && (Ce || Ae), Le = v.getDate(), He = N.getDate();
739
+ return pt ? ve ? `${R(Te, U, be)} ${Le}, ${Me} - ${R(Ye, U, be)} ${He}, ${Pe}` : `${Le} ${R(Te, U, be)} ${Me} - ${He} ${R(Ye, U, be)} ${Pe}` : Ae ? ve ? `${R(Te, U, be)} ${Le} - ${R(Ye, U, be)} ${He}, ${Me}` : `${Le} ${R(Te, U, be)} - ${He} ${R(Ye, U, be)} ${Me}` : ve ? `${R(Te, U, be)} ${Le}-${He}, ${Me}` : `${Le}-${He} ${R(Te, U, be)} ${Me}`;
717
740
  }
718
- const ce = $(() => {
719
- const { dateFormat: v, months: F, monthsGenitive: X, week: G, truncations: ve } = h, We = D.locale, Ce = ve !== !1, Me = v.indexOf("M") < v.indexOf("D"), Ye = X && We === "el" ? X : F;
720
- switch (m.value) {
741
+ const te = M(() => {
742
+ const { dateFormat: v, months: N, monthsGenitive: Z, week: U, truncations: ve } = d, We = y.locale, Ce = ve !== !1, Te = v.indexOf("M") < v.indexOf("D"), Me = Z && We === "el" ? Z : N;
743
+ switch (f.value) {
721
744
  case "day":
722
- return n.formatDate(l.value, v);
745
+ return s.formatDate(l.value, v);
723
746
  case "days":
724
747
  case "week": {
725
- const Ee = {
726
- monthsArray: Ye,
727
- monthBeforeDay: Me,
748
+ const Ye = {
749
+ monthsArray: Me,
750
+ monthBeforeDay: Te,
728
751
  canTruncate: Ce,
729
- xs: D.xs
752
+ xs: y.xs
730
753
  };
731
- let Fe = ue(l.value, t.value, Ee);
732
- if (m.value === "week") {
733
- const Ae = n.getWeek(
754
+ let Pe = oe(l.value, k.value, Ye);
755
+ if (f.value === "week") {
756
+ const Ae = s.getWeek(
734
757
  l.value,
735
- D.startWeekOnSunday && !D.hideWeekdays[7]
758
+ y.startWeekOnSunday && !y.hideWeekdays[7]
736
759
  );
737
- Fe += ` <small>${G} ${Ae}</small>`;
760
+ Pe += ` <small>${U} ${Ae}</small>`;
738
761
  }
739
- return Fe;
762
+ return Pe;
740
763
  }
741
764
  case "month": {
742
- const Ee = `${D.xs && Ce ? "MMM" : "MMMM"} YYYY`;
743
- return n.formatDate(R.value, Ee);
765
+ const Ye = `${y.xs && Ce ? "MMM" : "MMMM"} YYYY`;
766
+ return s.formatDate(q.value, Ye);
744
767
  }
745
768
  case "year":
746
769
  return l.value.getFullYear();
747
770
  case "years":
748
- return `${l.value.getFullYear()} - ${o.value.getFullYear()}`;
771
+ return `${l.value.getFullYear()} - ${t.value.getFullYear()}`;
749
772
  }
750
773
  });
751
- function de() {
752
- switch (T.value = new Date(f.value || i.value), T.value.setHours(0, 0, 0, 0), m.value) {
774
+ function se() {
775
+ switch (Y.value = new Date(m.value || u.value), Y.value.setHours(0, 0, 0, 0), f.value) {
753
776
  case "day":
754
777
  break;
755
778
  case "days":
756
779
  break;
757
780
  case "week":
758
- T.value = n.getPreviousFirstDayOfWeek(T.value, D.startWeekOnSunday && !D.hideWeekdays[7]);
781
+ Y.value = s.getPreviousFirstDayOfWeek(Y.value, y.startWeekOnSunday && !y.hideWeekdays[7]);
759
782
  break;
760
783
  case "month":
761
- T.value = new Date(T.value.getFullYear(), T.value.getMonth(), 1, 0, 0, 0, 0);
784
+ Y.value = new Date(Y.value.getFullYear(), Y.value.getMonth(), 1, 0, 0, 0, 0);
762
785
  break;
763
786
  case "year":
764
- T.value = new Date(T.value.getFullYear(), 0, 1, 0, 0, 0, 0);
787
+ Y.value = new Date(Y.value.getFullYear(), 0, 1, 0, 0, 0, 0);
765
788
  break;
766
789
  case "years":
767
- T.value = new Date(T.value.getFullYear() - T.value.getFullYear() % s.value, 0, 1, 0, 0, 0, 0);
790
+ Y.value = new Date(Y.value.getFullYear() - Y.value.getFullYear() % D.value, 0, 1, 0, 0, 0, 0);
768
791
  break;
769
792
  }
770
- D.ready && r("view-change", {
771
- id: m.value,
772
- title: ce.value,
773
- start: R.value,
774
- end: o.value,
775
- extendedStart: c.value,
793
+ y.ready && r("view-change", {
794
+ id: f.value,
795
+ title: te.value,
796
+ start: q.value,
797
+ end: t.value,
798
+ extendedStart: o.value,
776
799
  extendedEnd: e.value,
777
- cellDates: _.value,
778
- containsToday: d.value,
779
- events: z.value
780
- }), i.value = /* @__PURE__ */ new Date();
800
+ cellDates: p.value,
801
+ containsToday: h.value,
802
+ events: G.value
803
+ }), u.value = /* @__PURE__ */ new Date();
781
804
  }
782
- function pe(v) {
783
- const F = m.value, X = D.availableViews[F];
784
- v[F] && JSON.stringify(v[F]) === JSON.stringify(X) || de();
805
+ function ce(v) {
806
+ const N = f.value, Z = y.availableViews[N];
807
+ v[N] && JSON.stringify(v[N]) === JSON.stringify(Z) || se();
785
808
  }
786
- function oe(v, F = !0) {
787
- const X = Object.keys(D.availableViews);
788
- m.value !== v && (X.includes(v) ? (C.value = X.indexOf(v) < X.indexOf(m.value) ? "left" : "right", m.value = v, r("update:view", v), de()) : console.warn(`Vue Cal: the \`${v}\` view is not available.`));
809
+ function X(v, N = !0) {
810
+ const Z = Object.keys(y.availableViews);
811
+ f.value !== v && (Z.includes(v) ? (a.value = Z.indexOf(v) < Z.indexOf(f.value) ? "left" : "right", f.value = v, r("update:view", v), se()) : console.warn(`Vue Cal: the \`${v}\` view is not available.`));
789
812
  }
790
- function K() {
791
- L.value ? oe(L.value) : console.warn("Vue Cal: no broader view is available.");
813
+ function Ee() {
814
+ O.value ? X(O.value) : console.warn("Vue Cal: no broader view is available.");
792
815
  }
793
- function ee() {
794
- J.value ? oe(J.value) : console.warn("Vue Cal: no narrower view is available.");
816
+ function Q() {
817
+ B.value ? X(B.value) : console.warn("Vue Cal: no narrower view is available.");
795
818
  }
796
- function x() {
797
- w(!1);
819
+ function le() {
820
+ _(!1);
798
821
  }
799
- function a() {
800
- w(!0);
822
+ function n() {
823
+ _(!0);
801
824
  }
802
- function w(v = !0) {
803
- let F = new Date(f.value);
804
- switch (m.value) {
825
+ function _(v = !0) {
826
+ let N = new Date(m.value);
827
+ switch (f.value) {
805
828
  case "day":
806
829
  case "days":
807
- v ? F = n.addDays(t.value, 1) : F = n.subtractDays(l.value, s.value);
830
+ v ? N = s.addDays(k.value, 1) : N = s.subtractDays(l.value, D.value);
808
831
  break;
809
832
  case "week": {
810
- v ? (F = n.addDays(e.value, 1), F.setHours(0, 0, 0, 0)) : F = n.subtractDays(c.value, s.value);
833
+ v ? (N = s.addDays(e.value, 1), N.setHours(0, 0, 0, 0)) : N = s.subtractDays(o.value, D.value);
811
834
  break;
812
835
  }
813
836
  case "month": {
814
- const X = v ? 1 : -1;
815
- F = new Date(F.getFullYear(), F.getMonth() + X, 1, 0, 0, 0, 0);
837
+ const Z = v ? 1 : -1;
838
+ N = new Date(N.getFullYear(), N.getMonth() + Z, 1, 0, 0, 0, 0);
816
839
  break;
817
840
  }
818
841
  case "year": {
819
- const X = v ? 1 : -1;
820
- F = new Date(F.getFullYear() + X, 1, 1, 0, 0, 0, 0);
842
+ const Z = v ? 1 : -1;
843
+ N = new Date(N.getFullYear() + Z, 1, 1, 0, 0, 0, 0);
821
844
  break;
822
845
  }
823
846
  case "years": {
824
- const X = v ? s.value : -s.value;
825
- F = new Date(F.getFullYear() + X, 1, 1, 0, 0, 0, 0);
847
+ const Z = v ? D.value : -D.value;
848
+ N = new Date(N.getFullYear() + Z, 1, 1, 0, 0, 0, 0);
826
849
  break;
827
850
  }
828
851
  }
829
- B(F);
852
+ A(N);
830
853
  }
831
- function y() {
854
+ function g() {
832
855
  const v = /* @__PURE__ */ new Date();
833
- v.setHours(0, 0, 0, 0), B(v);
856
+ v.setHours(0, 0, 0, 0), A(v);
834
857
  }
835
- function B(v, F = !0, X = !1) {
836
- if (!n.isValid(v)) return console.warn("Vue Cal: can't navigate to the given date: invalid date provided to `updateViewDate(date)`.");
837
- let [G, ve] = [l.value, t.value];
838
- m.value === "month" && ([G, ve] = [R.value, o.value]), (!n.isInRange(v, G, ve) || X) && (v.setHours(0, 0, 0, 0), C.value = v.getTime() < G.getTime() ? "left" : "right", f.value = v, F && r("update:viewDate", v), de());
858
+ function A(v, N = !0, Z = !1) {
859
+ if (!s.isValid(v)) return console.warn("Vue Cal: can't navigate to the given date: invalid date provided to `updateViewDate(date)`.");
860
+ let [U, ve] = [l.value, k.value];
861
+ f.value === "month" && ([U, ve] = [q.value, t.value]), (!s.isInRange(v, U, ve) || Z) && (v.setHours(0, 0, 0, 0), a.value = v.getTime() < U.getTime() ? "left" : "right", m.value = v, N && r("update:viewDate", v), se());
839
862
  }
840
- function Q(v, F = !0) {
841
- if (!n.isValid(v)) return console.warn("Vue Cal: can't update the selected date: invalid date provided to `updateSelectedDate(date)`.");
842
- const { isValid: X, isSameDate: G } = n;
843
- (!j.value || !X(j.value) || !G(v, j.value)) && (v.setHours(0, 0, 0, 0), j.value = v, F && r("update:selectedDate", v));
863
+ function x(v, N = !0) {
864
+ if (!s.isValid(v)) return console.warn("Vue Cal: can't update the selected date: invalid date provided to `updateSelectedDate(date)`.");
865
+ const { isValid: Z, isSameDate: U } = s;
866
+ (!F.value || !Z(F.value) || !U(v, F.value)) && (v.setHours(0, 0, 0, 0), F.value = v, N && r("update:selectedDate", v));
844
867
  }
845
868
  function he(v) {
846
- !v && !T.value.getDay() ? B(n.addDays(T.value, 1), !0, !0) : (C.value = "left", de());
869
+ !v && !Y.value.getDay() ? A(s.addDays(Y.value, 1), !0, !0) : (a.value = "left", se());
847
870
  }
848
- function te(v) {
849
- v && D.startWeekOnSunday && !T.value.getDay() ? B(n.addDays(T.value, 1), !0, !0) : !v && D.startWeekOnSunday && T.value.getDay() === 1 && B(n.subtractDays(T.value, 1), !0, !0);
871
+ function i(v) {
872
+ v && y.startWeekOnSunday && !Y.value.getDay() ? A(s.addDays(Y.value, 1), !0, !0) : !v && y.startWeekOnSunday && Y.value.getDay() === 1 && A(s.subtractDays(Y.value, 1), !0, !0);
850
873
  }
851
- function u() {
852
- console.log("toggling weekdays", D.hideWeekdays);
874
+ function T() {
875
+ console.log("toggling weekdays", y.hideWeekdays);
853
876
  }
854
- function k(v) {
855
- var G;
856
- const F = (G = b.value) == null ? void 0 : G.querySelector(".vuecal__scrollable"), X = v ? v * D.timeCellHeight / D.timeStep : 0;
857
- F == null || F.scrollTo({ top: X, behavior: "smooth" });
877
+ function S(v) {
878
+ var U;
879
+ const N = (U = b.value) == null ? void 0 : U.querySelector(".vuecal__scrollable"), Z = v ? v * y.timeCellHeight / y.timeStep : 0;
880
+ N == null || N.scrollTo({ top: Z, behavior: "smooth" });
858
881
  }
859
- function E() {
882
+ function $() {
860
883
  const v = /* @__PURE__ */ new Date();
861
- k(v.getHours() * 60 + v.getMinutes());
884
+ S(v.getHours() * 60 + v.getMinutes());
862
885
  }
863
- function Y() {
864
- k(0);
886
+ function I() {
887
+ S(0);
865
888
  }
866
- const z = $(() => p.getViewEvents(_.value)), I = p.createEvent, ae = p.deleteEvent;
867
- return me(() => D.view, (v) => oe(v, !1)), me(() => D.availableViews, pe), me(() => D.datePicker, () => oe("month", !1)), me(() => D.viewDate, (v) => B(v, !1)), me(() => D.selectedDate, (v) => Q(v, !1)), me(() => D.startWeekOnSunday, (v) => he(v)), me(() => D.hideWeekends, (v) => te(v)), me(() => D.hideWeekdays, u), me(() => s.value, () => {
868
- s.value > 90 && console.warn("Vue Cal: high cell count detected. Performance may degrade when interactions are enabled.");
869
- }), me(() => D.watchRealTime, (v) => {
870
- v && D.time ? M() : W = clearTimeout(W);
871
- }), de(), D.time && D.watchRealTime && M(), Xe(() => W = clearTimeout(W)), {
872
- now: i,
873
- id: m,
874
- broaderView: L,
875
- narrowerView: J,
876
- title: ce,
877
- viewDate: f,
878
- start: R,
879
- end: o,
880
- extendedStart: c,
889
+ const G = M(() => w.getViewEvents(p.value)), ne = w.createEvent, De = w.deleteEvent;
890
+ return me(() => y.view, (v) => X(v, !1)), me(() => y.availableViews, ce), me(() => y.datePicker, () => X("month", !1)), me(() => y.viewDate, (v) => A(v, !1)), me(() => y.selectedDate, (v) => x(v, !1)), me(() => y.startWeekOnSunday, (v) => he(v)), me(() => y.hideWeekends, (v) => i(v)), me(() => y.hideWeekdays, T), me(() => D.value, () => {
891
+ D.value > 90 && console.warn("Vue Cal: high cell count detected. Performance may degrade when interactions are enabled.");
892
+ }), me(() => y.watchRealTime, (v) => {
893
+ v && y.time ? E() : W = clearTimeout(W);
894
+ }), se(), y.time && y.watchRealTime && E(), Xe(() => W = clearTimeout(W)), {
895
+ now: u,
896
+ id: f,
897
+ broaderView: O,
898
+ narrowerView: B,
899
+ title: te,
900
+ viewDate: m,
901
+ start: q,
902
+ end: t,
903
+ extendedStart: o,
881
904
  // Full range, including out of scope month days, and hidden leading/trailing days.
882
905
  extendedEnd: e,
883
906
  // Full range, including out of scope month days, and hidden leading/trailing days.
884
907
  firstCellDate: l,
885
- lastCellDate: t,
886
- containsToday: d,
887
- selectedDate: j,
888
- cellDates: _,
889
- cols: P,
890
- rows: A,
908
+ lastCellDate: k,
909
+ containsToday: h,
910
+ selectedDate: F,
911
+ cellDates: p,
912
+ cols: L,
913
+ rows: z,
891
914
  // All the events are stored and indexed in the events object of the eventsManager.
892
915
  // The following events array is only a subset of visible ones, plus any potential recurring
893
916
  // and multi-day events.
894
- events: z,
895
- transitionDirection: C,
896
- switch: oe,
897
- broader: K,
898
- narrower: ee,
899
- previous: x,
900
- next: a,
901
- navigate: w,
902
- goToToday: y,
903
- updateViewDate: B,
904
- updateSelectedDate: Q,
905
- scrollToCurrentTime: E,
906
- scrollToTime: k,
907
- scrollTop: Y,
908
- createEvent: I,
909
- deleteEvent: ae,
917
+ events: G,
918
+ transitionDirection: a,
919
+ switch: X,
920
+ broader: Ee,
921
+ narrower: Q,
922
+ previous: le,
923
+ next: n,
924
+ navigate: _,
925
+ goToToday: g,
926
+ updateViewDate: A,
927
+ updateSelectedDate: x,
928
+ scrollToCurrentTime: $,
929
+ scrollToTime: S,
930
+ scrollTop: I,
931
+ createEvent: ne,
932
+ deleteEvent: De,
910
933
  // Getters.
911
934
  get isDay() {
912
- return m.value === "day";
935
+ return f.value === "day";
913
936
  },
914
937
  get isDays() {
915
- return m.value === "days";
938
+ return f.value === "days";
916
939
  },
917
940
  get isWeek() {
918
- return m.value === "week";
941
+ return f.value === "week";
919
942
  },
920
943
  get isMonth() {
921
- return m.value === "month";
944
+ return f.value === "month";
922
945
  },
923
946
  get isYear() {
924
- return m.value === "year";
947
+ return f.value === "year";
925
948
  },
926
949
  get isYears() {
927
- return m.value === "years";
950
+ return f.value === "years";
928
951
  }
929
952
  };
930
953
  }, lt = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], rt = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], ot = "Years", it = "Year", ut = "Month", ct = "Week", dt = "Days", vt = "Day", mt = "Today", ft = "No Event", gt = "All day", ht = "Delete", yt = "Create an event", Dt = "dddd, MMMM D, YYYY", Ke = {
@@ -964,11 +987,11 @@ const st = (D, n) => {
964
987
  // Make texts reactive before a locale is loaded.
965
988
  dateUtils: st(fe.texts, Ke)
966
989
  // Some Date utils functions need localized texts.
967
- }), Ot = ({ props: D, emit: n, attrs: r, vuecalEl: h, uid: p }) => {
990
+ }), Ot = ({ props: y, emit: s, attrs: r, vuecalEl: d, uid: w }) => {
968
991
  const b = $e({
969
- uid: p,
992
+ uid: w,
970
993
  // The Vuecal instance unique ID, used for dnd source-target identification.
971
- emit: n,
994
+ emit: s,
972
995
  texts: { ...ze.texts },
973
996
  // Make texts reactive before a locale is loaded.
974
997
  // The date utils composable.
@@ -989,8 +1012,8 @@ const st = (D, n) => {
989
1012
  isResizingEvent: !1
990
1013
  }
991
1014
  });
992
- return b.dateUtils = st(Object.assign(fe.texts, b.texts), Ke), b.config = Yt(b, D, r), b.eventsManager = St(b), b.view = Ct(b, h), b.dnd = Et(b), b;
993
- }, jt = 24 * 60, Pt = {
1015
+ return b.dateUtils = st(Object.assign(fe.texts, b.texts), Ke), b.config = Yt(b, y, r), b.eventsManager = St(b), b.view = Ct(b, d), b.dnd = Et(b), b;
1016
+ }, jt = 24 * 60, Ft = {
994
1017
  allDayEvents: { type: [Boolean, String], default: !1 },
995
1018
  // Coming soon.
996
1019
  stackEvents: { type: Boolean, default: !1 },
@@ -1011,8 +1034,9 @@ const st = (D, n) => {
1011
1034
  // The array of events to display in Vue Cal.
1012
1035
  // Can hold just the view events and be updated or the full array of all events available.
1013
1036
  events: { type: Array, default: () => [] },
1014
- eventCount: { type: Boolean, default: !1 },
1015
- // Displays an events counter in each cell on month view.
1037
+ // Displays an events counter in each cell on month view or year view.
1038
+ // Can be a boolean or an array of views to display the event count on.
1039
+ eventCount: { type: [Boolean, Array], default: !1 },
1016
1040
  eventsOnMonthView: { type: Boolean, default: !1 },
1017
1041
  // Displays events in full on month view.
1018
1042
  hideWeekdays: { type: Array, default: () => [] },
@@ -1086,7 +1110,7 @@ const st = (D, n) => {
1086
1110
  // minScheduleWidth: { type: Number, default: 0 },
1087
1111
  // overlapsPerTimeStep: { type: Boolean, default: false },
1088
1112
  // resizeX: { type: Boolean, default: false },
1089
- }, Ft = { class: "vuecal__header" }, Lt = {
1113
+ }, Pt = { class: "vuecal__header" }, Lt = {
1090
1114
  key: 0,
1091
1115
  class: "vuecal__views-bar"
1092
1116
  }, Ht = ["onClick", "innerHTML"], zt = {
@@ -1094,53 +1118,53 @@ const st = (D, n) => {
1094
1118
  class: "vuecal__title-bar"
1095
1119
  }, Nt = { class: "vuecal__transition-wrap" }, Wt = ["disabled", "innerHTML"], At = {
1096
1120
  __name: "header",
1097
- setup(D) {
1098
- const n = Ne("vuecal"), { view: r, config: h } = n, p = () => {
1099
- h.clickToNavigate && r.broader();
1100
- }, b = $(() => h.clickToNavigate ? { click: p } : {});
1101
- return (H, m) => (S(), O("div", Ft, [
1102
- N(H.$slots, "header", {
1121
+ setup(y) {
1122
+ const s = Ne("vuecal"), { view: r, config: d } = s, w = () => {
1123
+ d.clickToNavigate && r.broader();
1124
+ }, b = M(() => d.clickToNavigate ? { click: w } : {});
1125
+ return (H, f) => (C(), j("div", Pt, [
1126
+ P(H.$slots, "header", {
1103
1127
  view: V(r),
1104
- availableViews: V(h).availableViews,
1105
- vuecal: V(n)
1128
+ availableViews: V(d).availableViews,
1129
+ vuecal: V(s)
1106
1130
  }),
1107
- H.$slots.header ? U("", !0) : (S(), O(ne, { key: 0 }, [
1108
- V(h).viewsBar ? (S(), O("div", Lt, [
1109
- (S(!0), O(ne, null, be(V(h).availableViews, (j, i) => (S(), O("button", {
1110
- class: De(["vuecal__view-button", { "vuecal__view-button--active": V(r).id === i }]),
1111
- onClick: (f) => V(r).switch(i),
1112
- innerHTML: V(n).texts[i],
1131
+ H.$slots.header ? K("", !0) : (C(), j(re, { key: 0 }, [
1132
+ V(d).viewsBar ? (C(), j("div", Lt, [
1133
+ (C(!0), j(re, null, ke(V(d).availableViews, (F, u) => (C(), j("button", {
1134
+ class: ye(["vuecal__view-button", { "vuecal__view-button--active": V(r).id === u }]),
1135
+ onClick: (m) => V(r).switch(u),
1136
+ innerHTML: V(s).texts[u],
1113
1137
  type: "button"
1114
1138
  }, null, 10, Ht))), 256))
1115
- ])) : U("", !0),
1116
- V(h).titleBar ? (S(), O("nav", zt, [
1139
+ ])) : K("", !0),
1140
+ V(d).titleBar ? (C(), j("nav", zt, [
1117
1141
  ge("button", {
1118
- class: De(["vuecal__nav vuecal__nav--prev", { "vuecal__nav--default": !H.$slots["previous-button"] }]),
1119
- onClick: m[0] || (m[0] = (...j) => V(r).previous && V(r).previous(...j)),
1142
+ class: ye(["vuecal__nav vuecal__nav--prev", { "vuecal__nav--default": !H.$slots["previous-button"] }]),
1143
+ onClick: f[0] || (f[0] = (...F) => V(r).previous && V(r).previous(...F)),
1120
1144
  type: "button"
1121
1145
  }, [
1122
- N(H.$slots, "previous-button")
1146
+ P(H.$slots, "previous-button")
1123
1147
  ], 2),
1124
1148
  ge("div", Nt, [
1125
1149
  Oe(Ge, {
1126
1150
  name: `vuecal-slide-fade--${V(r).transitionDirection}`
1127
1151
  }, {
1128
- default: q(() => [
1129
- (S(), O("div", {
1152
+ default: J(() => [
1153
+ (C(), j("div", {
1130
1154
  key: V(r).id + V(r).start.getTime()
1131
1155
  }, [
1132
- H.$slots.title ? (S(), Se(Qe(V(h).clickToNavigate && V(r).broaderView ? "button" : "div"), ye({
1156
+ H.$slots.title || H.$slots[`title.${V(r).id}`] ? (C(), Se(Qe(V(d).clickToNavigate && V(r).broaderView ? "button" : "div"), de({
1133
1157
  key: 0,
1134
1158
  class: "vuecal__title"
1135
- }, Ie(b.value)), {
1136
- default: q(() => [
1137
- N(H.$slots, "title", se(le(V(r))))
1159
+ }, Be(b.value)), {
1160
+ default: J(() => [
1161
+ H.$slots[`title.${V(r).id}`] ? P(H.$slots, `title.${V(r).id}`, ee(de({ key: 0 }, V(r)))) : P(H.$slots, "title", ee(de({ key: 1 }, V(r))))
1138
1162
  ]),
1139
1163
  _: 3
1140
- }, 16)) : (S(), Se(Qe(V(h).clickToNavigate && V(r).broaderView ? "button" : "div"), ye({
1164
+ }, 16)) : (C(), Se(Qe(V(d).clickToNavigate && V(r).broaderView ? "button" : "div"), de({
1141
1165
  key: 1,
1142
1166
  class: "vuecal__title"
1143
- }, Ie(b.value), {
1167
+ }, Be(b.value), {
1144
1168
  innerHTML: V(r).title
1145
1169
  }), null, 16, ["innerHTML"]))
1146
1170
  ]))
@@ -1148,35 +1172,35 @@ const st = (D, n) => {
1148
1172
  _: 3
1149
1173
  }, 8, ["name"])
1150
1174
  ]),
1151
- V(h).todayButton ? (S(), O(ne, { key: 0 }, [
1152
- H.$slots["today-button"] ? N(H.$slots, "today-button", {
1175
+ V(d).todayButton ? (C(), j(re, { key: 0 }, [
1176
+ H.$slots["today-button"] ? P(H.$slots, "today-button", {
1153
1177
  key: 0,
1154
1178
  navigate: () => !V(r).containsToday && V(r).goToToday(),
1155
1179
  active: V(r).containsToday
1156
- }) : (S(), O("button", {
1180
+ }) : (C(), j("button", {
1157
1181
  key: 1,
1158
- class: De(["vuecal__nav vuecal__nav--today vuecal__nav--default", { "vuecal__nav--active": V(r).containsToday }]),
1159
- onClick: m[1] || (m[1] = (j) => !V(r).containsToday && V(r).goToToday()),
1182
+ class: ye(["vuecal__nav vuecal__nav--today vuecal__nav--default", { "vuecal__nav--active": V(r).containsToday }]),
1183
+ onClick: f[1] || (f[1] = (F) => !V(r).containsToday && V(r).goToToday()),
1160
1184
  disabled: !!V(r).containsToday,
1161
1185
  type: "button",
1162
- innerHTML: V(n).texts.today
1186
+ innerHTML: V(s).texts.today
1163
1187
  }, null, 10, Wt))
1164
- ], 64)) : U("", !0),
1188
+ ], 64)) : K("", !0),
1165
1189
  ge("button", {
1166
- class: De(["vuecal__nav vuecal__nav--next", { "vuecal__nav--default": !H.$slots["next-button"] }]),
1167
- onClick: m[2] || (m[2] = (...j) => V(r).next && V(r).next(...j)),
1190
+ class: ye(["vuecal__nav vuecal__nav--next", { "vuecal__nav--default": !H.$slots["next-button"] }]),
1191
+ onClick: f[2] || (f[2] = (...F) => V(r).next && V(r).next(...F)),
1168
1192
  type: "button"
1169
1193
  }, [
1170
- N(H.$slots, "next-button")
1194
+ P(H.$slots, "next-button")
1171
1195
  ], 2)
1172
- ])) : U("", !0)
1196
+ ])) : K("", !0)
1173
1197
  ], 64))
1174
1198
  ]));
1175
1199
  }
1176
- }, Bt = {
1200
+ }, It = {
1177
1201
  key: 0,
1178
1202
  class: "vuecal__headings"
1179
- }, It = {
1203
+ }, Bt = {
1180
1204
  key: 0,
1181
1205
  class: "vuecal__weekdays-headings"
1182
1206
  }, Rt = ["onClick"], Xt = { class: "vuecal__weekday-day" }, Gt = {
@@ -1187,93 +1211,93 @@ const st = (D, n) => {
1187
1211
  class: "vuecal__schedules-headings w-flex grow"
1188
1212
  }, Ut = ["innerHTML"], qt = {
1189
1213
  __name: "headings-bar",
1190
- setup(D) {
1191
- const n = Ne("vuecal"), { view: r, config: h, dateUtils: p } = n, b = $(() => h.xs ? "day-xs" : h.sm || r.isDays || r.isMonth ? "day-sm" : "day"), H = $(() => (r.isDay || r.isDays || r.isWeek || r.isMonth) && !(r.isDay && !h.schedules)), m = $(() => r.cellDates.slice(0, r.cols).map(({ start: i }) => ({
1192
- id: Re[i.getDay()],
1193
- date: i,
1194
- dateNumber: i.getDate(),
1195
- day: p.formatDate(i, "dddd"),
1196
- "day-sm": p.formatDate(i, "ddd"),
1197
- "day-xs": p.formatDate(i, "dd"),
1198
- isToday: p.isToday(i)
1199
- }))), j = {
1200
- click: (i) => {
1201
- (r.isDays || r.isWeek) && r.updateSelectedDate(i);
1214
+ setup(y) {
1215
+ const s = Ne("vuecal"), { view: r, config: d, dateUtils: w } = s, b = M(() => d.xs ? "day-xs" : d.sm || r.isDays || r.isMonth ? "day-sm" : "day"), H = M(() => (r.isDay || r.isDays || r.isWeek || r.isMonth) && !(r.isDay && !d.schedules)), f = M(() => r.cellDates.slice(0, r.cols).map(({ start: u }) => ({
1216
+ id: Re[u.getDay()],
1217
+ date: u,
1218
+ dateNumber: u.getDate(),
1219
+ day: w.formatDate(u, "dddd"),
1220
+ "day-sm": w.formatDate(u, "ddd"),
1221
+ "day-xs": w.formatDate(u, "dd"),
1222
+ isToday: w.isToday(u)
1223
+ }))), F = {
1224
+ click: (u) => {
1225
+ (r.isDays || r.isWeek) && r.updateSelectedDate(u);
1202
1226
  }
1203
1227
  };
1204
- return (i, f) => H.value ? (S(), O("div", Bt, [
1205
- V(r).isDay ? U("", !0) : (S(), O("div", It, [
1206
- (S(!0), O(ne, null, be(m.value, (T, W) => (S(), O("div", {
1207
- class: De(["vuecal__weekday", { "vuecal__weekday--today": T.isToday }]),
1228
+ return (u, m) => H.value ? (C(), j("div", It, [
1229
+ V(r).isDay ? K("", !0) : (C(), j("div", Bt, [
1230
+ (C(!0), j(re, null, ke(f.value, (Y, W) => (C(), j("div", {
1231
+ class: ye(["vuecal__weekday", { "vuecal__weekday--today": Y.isToday }]),
1208
1232
  key: W,
1209
- onClick: (R) => j.click(T.date)
1233
+ onClick: (q) => F.click(Y.date)
1210
1234
  }, [
1211
- N(i.$slots, "weekday-heading", {
1212
- label: T[b.value],
1213
- id: T.id,
1214
- date: T.date
1235
+ P(u.$slots, "weekday-heading", {
1236
+ label: Y[b.value],
1237
+ id: Y.id,
1238
+ date: Y.date
1215
1239
  }, () => [
1216
- ge("span", Xt, re(T[b.value]), 1),
1217
- V(r).isMonth ? U("", !0) : (S(), O("strong", Gt, re(T.dateNumber), 1))
1240
+ ge("span", Xt, ie(Y[b.value]), 1),
1241
+ V(r).isMonth ? K("", !0) : (C(), j("strong", Gt, ie(Y.dateNumber), 1))
1218
1242
  ])
1219
1243
  ], 10, Rt))), 128))
1220
1244
  ])),
1221
- V(h).schedules ? (S(), O("div", Jt, [
1222
- (S(!0), O(ne, null, be(m.value, (T, W) => (S(), O(ne, { key: W }, [
1223
- (S(!0), O(ne, null, be(V(h).schedules, (R, o) => (S(), O(ne, { key: o }, [
1224
- i.$slots["schedule-heading"] ? (S(), O("div", {
1245
+ V(d).schedules ? (C(), j("div", Jt, [
1246
+ (C(!0), j(re, null, ke(f.value, (Y, W) => (C(), j(re, { key: W }, [
1247
+ (C(!0), j(re, null, ke(V(d).schedules, (q, t) => (C(), j(re, { key: t }, [
1248
+ u.$slots["schedule-heading"] ? (C(), j("div", {
1225
1249
  key: 0,
1226
- class: De(["vuecal__schedule vuecal__schedule--heading", R.class])
1250
+ class: ye(["vuecal__schedule vuecal__schedule--heading", q.class])
1227
1251
  }, [
1228
- N(i.$slots, "schedule-heading", {
1229
- schedule: R,
1252
+ P(u.$slots, "schedule-heading", {
1253
+ schedule: q,
1230
1254
  view: V(r)
1231
1255
  })
1232
- ], 2)) : (S(), O("div", {
1256
+ ], 2)) : (C(), j("div", {
1233
1257
  key: 1,
1234
- class: De(["vuecal__schedule vuecal__schedule--heading", R.class]),
1235
- innerHTML: R.label
1258
+ class: ye(["vuecal__schedule vuecal__schedule--heading", q.class]),
1259
+ innerHTML: q.label
1236
1260
  }, null, 10, Ut))
1237
1261
  ], 64))), 128))
1238
1262
  ], 64))), 128))
1239
- ])) : U("", !0)
1240
- ])) : U("", !0);
1263
+ ])) : K("", !0)
1264
+ ])) : K("", !0);
1241
1265
  }
1242
1266
  }, Zt = { class: "vuecal__time-column" }, Kt = {
1243
1267
  __name: "time-column",
1244
- setup(D) {
1245
- const n = Ne("vuecal"), { config: r, texts: h } = n, p = $(() => {
1268
+ setup(y) {
1269
+ const s = Ne("vuecal"), { config: r, texts: d } = s, w = M(() => {
1246
1270
  const b = [];
1247
- for (let m = r.timeFrom; m < r.timeTo; m += r.timeStep) {
1248
- const j = m + r.timeStep > r.timeTo, i = ~~(m / 60), f = m % 60, T = h[m < 720 ? "am" : "pm"];
1271
+ for (let f = r.timeFrom; f < r.timeTo; f += r.timeStep) {
1272
+ const F = f + r.timeStep > r.timeTo, u = ~~(f / 60), m = f % 60, Y = d[f < 720 ? "am" : "pm"];
1249
1273
  let W = null;
1250
- j && (W = `calc(var(--vuecal-time-cell-height) * ${(r.timeTo - m) / r.timeStep})`), b.push({
1251
- minutesSum: m,
1274
+ F && (W = `calc(var(--vuecal-time-cell-height) * ${(r.timeTo - f) / r.timeStep})`), b.push({
1275
+ minutesSum: f,
1252
1276
  // The sum of hours + minutes in minutes.
1253
- hours: i,
1254
- minutes: f,
1255
- formatted12: `${i % 12 ? i % 12 : 12}${f ? `:${f.toString().padStart(2, 0)}` : ""}${T}`,
1256
- formatted24: `${i.toString().padStart(2, 0)}:${f.toString().padStart(2, 0)}`,
1277
+ hours: u,
1278
+ minutes: m,
1279
+ formatted12: `${u % 12 ? u % 12 : 12}${m ? `:${m.toString().padStart(2, 0)}` : ""}${Y}`,
1280
+ formatted24: `${u.toString().padStart(2, 0)}:${m.toString().padStart(2, 0)}`,
1257
1281
  height: W
1258
1282
  });
1259
1283
  }
1260
1284
  return b;
1261
1285
  });
1262
- return (b, H) => (S(), O("div", Zt, [
1263
- (S(!0), O(ne, null, be(p.value, (m, j) => (S(), O("div", {
1286
+ return (b, H) => (C(), j("div", Zt, [
1287
+ (C(!0), j(re, null, ke(w.value, (f, F) => (C(), j("div", {
1264
1288
  class: "vuecal__time-cell",
1265
- key: j,
1266
- style: ke({ height: m.height || null })
1289
+ key: F,
1290
+ style: _e({ height: f.height || null })
1267
1291
  }, [
1268
- N(b.$slots, "time-cell", {
1269
- index: j,
1270
- minutes: m.minutes,
1271
- hours: m.hours,
1272
- minutesSum: m.minutesSum,
1273
- format12: m.formatted12,
1274
- format24: m.formatted24
1292
+ P(b.$slots, "time-cell", {
1293
+ index: F,
1294
+ minutes: f.minutes,
1295
+ hours: f.hours,
1296
+ minutesSum: f.minutesSum,
1297
+ format12: f.formatted12,
1298
+ format24: f.formatted24
1275
1299
  }, () => [
1276
- ge("label", null, re(V(r).twelveHour ? m.formatted12 : m.formatted24), 1)
1300
+ ge("label", null, ie(V(r).twelveHour ? f.formatted12 : f.formatted24), 1)
1277
1301
  ])
1278
1302
  ], 4))), 128))
1279
1303
  ]));
@@ -1287,8 +1311,8 @@ const st = (D, n) => {
1287
1311
  event: { type: Object, required: !0 }
1288
1312
  },
1289
1313
  emits: ["event-drag-start", "event-drag-end", "event-resize-start", "event-resize-end"],
1290
- setup(D, { emit: n }) {
1291
- const { config: r, view: h, dnd: p, touch: b, dateUtils: H } = Ne("vuecal"), m = D, j = ie(null), i = $e(m.event), f = $e({
1314
+ setup(y, { emit: s }) {
1315
+ const { config: r, view: d, dnd: w, touch: b, dateUtils: H } = Ne("vuecal"), f = y, F = ue(null), u = $e(f.event), m = $e({
1292
1316
  dragging: !1,
1293
1317
  resizing: !1,
1294
1318
  fromResizer: !1,
@@ -1322,158 +1346,158 @@ const st = (D, n) => {
1322
1346
  cellEl: null,
1323
1347
  // Store the cell DOM node for a more efficient resizing calc in mousemove/touchmove.
1324
1348
  schedule: null
1325
- }), T = $(() => r.editableEvents.drag && i.draggable !== !1 && !i.background), W = $(() => r.time && r.editableEvents.resize && i.resizable !== !1 && !i.background);
1326
- $(() => r.editableEvents.delete && i.deletable !== !1 && !i.background);
1327
- const R = $(() => {
1328
- var s, l, _;
1349
+ }), Y = M(() => r.editableEvents.drag && u.draggable !== !1 && !u.background), W = M(() => d.isMonth || d.isYear || d.isYears ? !1 : r.time && r.editableEvents.resize && u.resizable !== !1 && !u.background);
1350
+ M(() => r.editableEvents.delete && u.deletable !== !1 && !u.background);
1351
+ const q = M(() => {
1352
+ var D, l, p;
1329
1353
  return {
1330
- [`vuecal__event--${i._.id}`]: !0,
1331
- [i.class]: !!i.class,
1332
- "vuecal__event--recurring": !!i.recurring,
1333
- "vuecal__event--background": !!i.background,
1334
- "vuecal__event--multiday": !!((s = i._) != null && s.multiday),
1335
- "vuecal__event--cut-top": ((l = i._) == null ? void 0 : l.startMinutes) < r.timeFrom,
1336
- "vuecal__event--cut-bottom": ((_ = i._) == null ? void 0 : _.endMinutes) > r.timeTo || i.end.getDate() !== i.start.getDate(),
1354
+ [`vuecal__event--${u._.id}`]: !0,
1355
+ [u.class]: !!u.class,
1356
+ "vuecal__event--recurring": !!u.recurring,
1357
+ "vuecal__event--background": !!u.background,
1358
+ "vuecal__event--multiday": !!((D = u._) != null && D.multiday),
1359
+ "vuecal__event--cut-top": ((l = u._) == null ? void 0 : l.startMinutes) < r.timeFrom,
1360
+ "vuecal__event--cut-bottom": ((p = u._) == null ? void 0 : p.endMinutes) > r.timeTo || u.end.getDate() !== u.start.getDate(),
1337
1361
  // Only apply the dragging class on the event copy that is being dragged.
1338
- "vuecal__event--dragging": !i._.draggingGhost && i._.dragging,
1362
+ "vuecal__event--dragging": !u._.draggingGhost && u._.dragging,
1339
1363
  // Only apply the dragging-ghost class on the event original that remains fixed while a copy is being
1340
1364
  // dragged. Sometimes when dragging fast the dragging-ghost class would get stuck and events stays
1341
1365
  // invisible, so if dragging is false, disable the dragging-ghost class as well.
1342
1366
  // On event drop, if the new position of the event is approved, only remove the dragging-ghost class
1343
1367
  // after event deletion (event._.dragging is already false) so the event ghost does not flash in before
1344
1368
  // deletion.
1345
- "vuecal__event--dragging-ghost": i._.draggingGhost,
1346
- "vuecal__event--resizing": f.resizing
1369
+ "vuecal__event--dragging-ghost": u._.draggingGhost,
1370
+ "vuecal__event--resizing": m.resizing
1347
1371
  };
1348
- }), o = $(() => {
1349
- const s = (h.isDay || h.isDays || h.isWeek) && r.time;
1350
- if (!s && !i.backgroundColor && !i.color) return !1;
1372
+ }), t = M(() => {
1373
+ const D = (d.isDay || d.isDays || d.isWeek) && r.time;
1374
+ if (!D && !u.backgroundColor && !u.color) return !1;
1351
1375
  const l = {
1352
- backgroundColor: i.backgroundColor || null,
1353
- color: i.color || null
1376
+ backgroundColor: u.backgroundColor || null,
1377
+ color: u.color || null
1354
1378
  };
1355
- if (s) {
1356
- const _ = Math.max(r.timeFrom, i._.startMinutes), t = Math.min(r.timeTo, i._.endMinutes), C = Ve(_, r), L = Ve(t, r) - C;
1357
- l.top = `${C}%`, l.height = `${L}%`;
1379
+ if (D) {
1380
+ const p = Math.max(r.timeFrom, u._.startMinutes), k = Math.min(r.timeTo, u._.endMinutes), a = Ve(p, r), O = Ve(k, r) - a;
1381
+ l.top = `${a}%`, l.height = `${O}%`;
1358
1382
  }
1359
1383
  return l;
1360
- }), c = $(() => {
1361
- const s = { ...r.eventListeners.event };
1362
- for (const [t, C] of Object.entries(s))
1363
- ["resize-end"].includes(t) || (s[t] = (L) => {
1364
- L.type !== "drop" && C(L.type ? { e: L, event: i } : L);
1384
+ }), o = M(() => {
1385
+ const D = { ...r.eventListeners.event };
1386
+ for (const [k, a] of Object.entries(D))
1387
+ ["resize-end"].includes(k) || (D[k] = (O) => {
1388
+ O.type !== "drop" && a(O.type ? { e: O, event: u } : O);
1365
1389
  });
1366
- const l = { ...s };
1367
- s.touchstart = (t) => {
1368
- var C;
1369
- t.stopPropagation(), e(t), (C = l.touchstart) == null || C.call(l, { e: t, event: i });
1370
- }, s.mousedown = (t) => {
1371
- var C;
1372
- t.stopPropagation(), e(t), (C = l.mousedown) == null || C.call(l, { e: t, event: i });
1390
+ const l = { ...D };
1391
+ D.touchstart = (k) => {
1392
+ var a;
1393
+ k.stopPropagation(), e(k), (a = l.touchstart) == null || a.call(l, { e: k, event: u });
1394
+ }, D.mousedown = (k) => {
1395
+ var a;
1396
+ k.stopPropagation(), e(k), (a = l.mousedown) == null || a.call(l, { e: k, event: u });
1373
1397
  };
1374
- let _ = null;
1375
- return s.click = (t) => {
1376
- var C;
1377
- (C = l.click) == null || C.call(l, { e: t, event: i }), _ ? _ = clearTimeout(_) : _ = setTimeout(() => {
1378
- var L;
1379
- _ = null, (L = l["delayed-click"]) == null || L.call(l, { e: t, event: i });
1398
+ let p = null;
1399
+ return D.click = (k) => {
1400
+ var a;
1401
+ (a = l.click) == null || a.call(l, { e: k, event: u }), p ? p = clearTimeout(p) : p = setTimeout(() => {
1402
+ var O;
1403
+ p = null, (O = l["delayed-click"]) == null || O.call(l, { e: k, event: u });
1380
1404
  }, 400);
1381
- }, s.dblclick = (t) => {
1382
- l.dblclick ? l.dblclick({ e: t, event: i }) : i.delete(1);
1383
- }, s;
1384
- }), e = (s) => {
1385
- var t, C, L;
1386
- const l = ((t = s.touches) == null ? void 0 : t[0]) || s;
1387
- f.fromResizer = l.target.matches(".vuecal__event-resizer, .vuecal__event-resizer *");
1388
- const _ = j.value.getBoundingClientRect();
1389
- f.startX = (((C = s.touches) == null ? void 0 : C[0]) || s).clientX - _.left, f.startY = (((L = s.touches) == null ? void 0 : L[0]) || s).clientY - _.top, f.startPercentageX = f.startX * 100 / _.width, f.startPercentageY = f.startY * 100 / _.height, f.cellEl = j.value.closest(".vuecal__cell"), f.resizeStartDate = i.start, A(s.type === "touchstart" ? "touchmove" : "mousemove", d), A(s.type === "touchstart" ? "touchend" : "mouseup", g, { once: !0 }), f.holdTimer = setTimeout(() => {
1390
- var J, Z;
1391
- f.holding = !0, (Z = (J = c.value).hold) == null || Z.call(J, { e: s, event: i });
1405
+ }, D.dblclick = (k) => {
1406
+ l.dblclick ? l.dblclick({ e: k, event: u }) : u.delete(1);
1407
+ }, D;
1408
+ }), e = (D) => {
1409
+ var k, a, O;
1410
+ const l = ((k = D.touches) == null ? void 0 : k[0]) || D;
1411
+ m.fromResizer = l.target.matches(".vuecal__event-resizer, .vuecal__event-resizer *");
1412
+ const p = F.value.getBoundingClientRect();
1413
+ m.startX = (((a = D.touches) == null ? void 0 : a[0]) || D).clientX - p.left, m.startY = (((O = D.touches) == null ? void 0 : O[0]) || D).clientY - p.top, m.startPercentageX = m.startX * 100 / p.width, m.startPercentageY = m.startY * 100 / p.height, m.cellEl = F.value.closest(".vuecal__cell"), m.resizeStartDate = u.start, z(D.type === "touchstart" ? "touchmove" : "mousemove", h), z(D.type === "touchstart" ? "touchend" : "mouseup", c, { once: !0 }), m.holdTimer = setTimeout(() => {
1414
+ var B, R;
1415
+ m.holding = !0, (R = (B = o.value).hold) == null || R.call(B, { e: D, event: u });
1392
1416
  }, 1e3);
1393
- }, d = async (s) => {
1394
- var _, t, C, L;
1395
- const l = ((_ = s.touches) == null ? void 0 : _[0]) || s;
1396
- if (f.fromResizer && !f.resizing && (f.resizing = !0, f.resizingOriginalEvent = { ...i, _: { ...i._ } }, b.isResizingEvent = !0, (C = (t = c.value).resizeStart) == null || C.call(t, { e: s, event: i })), f.holdTimer = clearTimeout(f.holdTimer), f.holding = !1, f.cellEl) {
1397
- const { top: J, left: Z, width: ue, height: ce } = f.cellEl.getBoundingClientRect();
1398
- f.moveX = l.clientX - Z, f.moveY = l.clientY - J, f.movePercentageX = f.moveX * 100 / ue, f.movePercentageY = f.moveY * 100 / ce;
1417
+ }, h = async (D) => {
1418
+ var p, k, a, O;
1419
+ const l = ((p = D.touches) == null ? void 0 : p[0]) || D;
1420
+ if (m.fromResizer && !m.resizing && (m.resizing = !0, m.resizingOriginalEvent = { ...u, _: { ...u._ } }, b.isResizingEvent = !0, (a = (k = o.value).resizeStart) == null || a.call(k, { e: D, event: u })), m.holdTimer = clearTimeout(m.holdTimer), m.holding = !1, m.cellEl) {
1421
+ const { top: B, left: R, width: oe, height: te } = m.cellEl.getBoundingClientRect();
1422
+ m.moveX = l.clientX - R, m.moveY = l.clientY - B, m.movePercentageX = m.moveX * 100 / oe, m.movePercentageY = m.moveY * 100 / te;
1399
1423
  }
1400
- if (f.fromResizer) {
1401
- const { newStart: J, newEnd: Z } = M(i);
1402
- let ue = !0;
1403
- const { resize: ce } = (L = r.eventListeners) == null ? void 0 : L.event;
1404
- ce && (ue = await ce({
1405
- e: s,
1406
- event: { ...i, start: J, end: Z },
1407
- overlaps: i.getOverlappingEvents({ start: J, end: Z })
1408
- })), ue !== !1 ? (i.start = J, i.end = Z, f.resizingLastAcceptedEvent && (f.resizingLastAcceptedEvent = null)) : ce && (f.resizingLastAcceptedEvent = { ...i, _: { ...i._ } });
1424
+ if (m.fromResizer) {
1425
+ const { newStart: B, newEnd: R } = E(u);
1426
+ let oe = !0;
1427
+ const { resize: te } = (O = r.eventListeners) == null ? void 0 : O.event;
1428
+ te && (oe = await te({
1429
+ e: D,
1430
+ event: { ...u, start: B, end: R },
1431
+ overlaps: u.getOverlappingEvents({ start: B, end: R })
1432
+ })), oe !== !1 ? (u.start = B, u.end = R, m.resizingLastAcceptedEvent && (m.resizingLastAcceptedEvent = null)) : te && (m.resizingLastAcceptedEvent = { ...u, _: { ...u._ } });
1409
1433
  }
1410
- }, g = async (s) => {
1411
- var l, _;
1412
- if (f.holdTimer = clearTimeout(f.holdTimer), f.holding = !1, f.resizing) {
1413
- const { newStart: t, newEnd: C } = M(i);
1414
- let L = !0;
1415
- const J = c.value["resize-end"];
1416
- J && (L = await J({
1417
- e: s,
1418
- event: i,
1419
- original: f.resizingOriginalEvent,
1434
+ }, c = async (D) => {
1435
+ var l, p;
1436
+ if (m.holdTimer = clearTimeout(m.holdTimer), m.holding = !1, m.resizing) {
1437
+ const { newStart: k, newEnd: a } = E(u);
1438
+ let O = !0;
1439
+ const B = o.value["resize-end"];
1440
+ B && (O = await B({
1441
+ e: D,
1442
+ event: u,
1443
+ original: m.resizingOriginalEvent,
1420
1444
  // Original event details before resizing.
1421
- overlaps: i.getOverlappingEvents({ start: t, end: C })
1422
- })), i.start = L === !1 ? (f.resizingLastAcceptedEvent || f.resizingOriginalEvent).start : ((l = f.resizingLastAcceptedEvent) == null ? void 0 : l.start) || t, i.end = L === !1 ? (f.resizingLastAcceptedEvent || f.resizingOriginalEvent).end : ((_ = f.resizingLastAcceptedEvent) == null ? void 0 : _.end) || C, i._.duration < 1 && (i.start = f.resizingOriginalEvent.start, i.end = f.resizingOriginalEvent.end), b.isResizingEvent = !1;
1445
+ overlaps: u.getOverlappingEvents({ start: k, end: a })
1446
+ })), u.start = O === !1 ? (m.resizingLastAcceptedEvent || m.resizingOriginalEvent).start : ((l = m.resizingLastAcceptedEvent) == null ? void 0 : l.start) || k, u.end = O === !1 ? (m.resizingLastAcceptedEvent || m.resizingOriginalEvent).end : ((p = m.resizingLastAcceptedEvent) == null ? void 0 : p.end) || a, u._.duration < 1 && (u.start = m.resizingOriginalEvent.start, u.end = m.resizingOriginalEvent.end), b.isResizingEvent = !1;
1423
1447
  }
1424
- document.removeEventListener(s.type === "touchend" ? "touchmove" : "mousemove", d), f.resizing = !1, f.fromResizer = !1, f.dragging = !1, f.startX = 0, f.startY = 0, f.moveX = 0, f.moveY = 0, f.startPercentageX = 0, f.startPercentageY = 0, f.movePercentageX = 0, f.movePercentageY = 0, f.cellEl = null, f.resizeStartDate = null, f.resizingOriginalEvent = null, f.resizingLastAcceptedEvent = null, f.schedule = null;
1425
- }, M = (s) => {
1426
- const l = new Date(s.start.getFullYear(), s.start.getMonth(), s.start.getDate());
1448
+ document.removeEventListener(D.type === "touchend" ? "touchmove" : "mousemove", h), m.resizing = !1, m.fromResizer = !1, m.dragging = !1, m.startX = 0, m.startY = 0, m.moveX = 0, m.moveY = 0, m.startPercentageX = 0, m.startPercentageY = 0, m.movePercentageX = 0, m.movePercentageY = 0, m.cellEl = null, m.resizeStartDate = null, m.resizingOriginalEvent = null, m.resizingLastAcceptedEvent = null, m.schedule = null;
1449
+ }, E = (D) => {
1450
+ const l = new Date(D.start.getFullYear(), D.start.getMonth(), D.start.getDate());
1427
1451
  new Date(l).setDate(l.getDate() + 1);
1428
- let t = Pe(f.movePercentageY, r);
1429
- if (t = Math.max(0, Math.min(t, 24 * 60)), r.snapToInterval) {
1430
- const J = t + r.snapToInterval / 2;
1431
- t = J - J % r.snapToInterval;
1452
+ let k = Fe(m.movePercentageY, r);
1453
+ if (k = Math.max(0, Math.min(k, 24 * 60)), r.snapToInterval) {
1454
+ const B = k + r.snapToInterval / 2;
1455
+ k = B - B % r.snapToInterval;
1432
1456
  }
1433
- let C = s.start, L = new Date(l.getTime() + t * 6e4);
1434
- return L < f.resizeStartDate && (C = L, L = f.resizeStartDate), { newStart: C, newEnd: L };
1457
+ let a = D.start, O = new Date(l.getTime() + k * 6e4);
1458
+ return O < m.resizeStartDate && (a = O, O = m.resizeStartDate), { newStart: a, newEnd: O };
1435
1459
  };
1436
- qe(() => i._.register(j.value));
1437
- const P = [], A = (s, l, _) => {
1438
- document.addEventListener(s, l, _), P.push({ event: s, handler: l, options: _ });
1460
+ qe(() => u._.register(F.value));
1461
+ const L = [], z = (D, l, p) => {
1462
+ document.addEventListener(D, l, p), L.push({ event: D, handler: l, options: p });
1439
1463
  };
1440
1464
  return Xe(() => {
1441
- i._.unregister();
1442
- for (const { event: s, handler: l, options: _ } of P)
1443
- document.removeEventListener(s, l, _);
1444
- }), (s, l) => (S(), O("div", ye({ class: "vuecal__event" }, Ie(c.value, !0), {
1465
+ u._.unregister();
1466
+ for (const { event: D, handler: l, options: p } of L)
1467
+ document.removeEventListener(D, l, p);
1468
+ }), (D, l) => (C(), j("div", de({ class: "vuecal__event" }, Be(o.value, !0), {
1445
1469
  ref_key: "eventEl",
1446
- ref: j,
1447
- class: R.value,
1448
- style: o.value,
1449
- draggable: T.value ? "true" : void 0,
1450
- onDragstart: l[2] || (l[2] = (_) => T.value && V(p).eventDragStart(_, i)),
1451
- onDragend: l[3] || (l[3] = (_) => T.value && V(p).eventDragEnd(_, i))
1470
+ ref: F,
1471
+ class: q.value,
1472
+ style: t.value,
1473
+ draggable: Y.value ? "true" : void 0,
1474
+ onDragstart: l[2] || (l[2] = (p) => Y.value && V(w).eventDragStart(p, u)),
1475
+ onDragend: l[3] || (l[3] = (p) => Y.value && V(w).eventDragEnd(p, u))
1452
1476
  }), [
1453
1477
  ge("div", xt, [
1454
- N(s.$slots, "event", { event: i }, () => [
1455
- ge("div", ea, re(i.title), 1),
1456
- V(r).time ? (S(), O("div", ta, re(i._[`startTimeFormatted${V(r).twelveHour ? 12 : 24}`]) + `
1457
- - ` + re(i._[`endTimeFormatted${V(r).twelveHour ? 12 : 24}`]), 1)) : U("", !0),
1478
+ P(D.$slots, "event", { event: u }, () => [
1479
+ ge("div", ea, ie(u.title), 1),
1480
+ V(r).time ? (C(), j("div", ta, ie(u._[`startTimeFormatted${V(r).twelveHour ? 12 : 24}`]) + `
1481
+ - ` + ie(u._[`endTimeFormatted${V(r).twelveHour ? 12 : 24}`]), 1)) : K("", !0),
1458
1482
  ge("div", {
1459
1483
  class: "vuecal__event-content",
1460
- innerHTML: i.content
1484
+ innerHTML: u.content
1461
1485
  }, null, 8, aa)
1462
1486
  ])
1463
1487
  ]),
1464
- W.value ? (S(), O("div", {
1488
+ W.value ? (C(), j("div", {
1465
1489
  key: 0,
1466
1490
  class: "vuecal__event-resizer",
1467
1491
  onDragstart: l[0] || (l[0] = xe(() => {
1468
1492
  }, ["prevent", "stop"]))
1469
- }, null, 32)) : U("", !0),
1493
+ }, null, 32)) : K("", !0),
1470
1494
  Oe(Ge, { name: "vuecal-delete-btn" }, {
1471
- default: q(() => [
1472
- i._.deleting ? (S(), O("div", {
1495
+ default: J(() => [
1496
+ u._.deleting ? (C(), j("div", {
1473
1497
  key: 0,
1474
1498
  class: "vuecal__event-delete",
1475
- onClick: l[1] || (l[1] = xe((_) => i.delete(3), ["stop"]))
1476
- }, "Delete")) : U("", !0)
1499
+ onClick: l[1] || (l[1] = xe((p) => u.delete(3), ["stop"]))
1500
+ }, "Delete")) : K("", !0)
1477
1501
  ]),
1478
1502
  _: 1
1479
1503
  })
@@ -1509,10 +1533,10 @@ const st = (D, n) => {
1509
1533
  end: { type: Date, required: !0 },
1510
1534
  index: { type: Number, required: !0 }
1511
1535
  },
1512
- setup(D) {
1513
- const n = D, r = Ne("vuecal"), { view: h, config: p, dateUtils: b, eventsManager: H, dnd: m, touch: j } = r, i = $(() => b.isToday(n.start)), f = ie(null), T = ie([]), W = ie(!1), R = (u) => {
1514
- T.value.push(u.detail), W.value = !0;
1515
- }, o = () => setTimeout(() => W.value = !1, 300), c = $e({
1536
+ setup(y) {
1537
+ const s = y, r = Ne("vuecal"), { view: d, config: w, dateUtils: b, eventsManager: H, dnd: f, touch: F } = r, u = M(() => b.isToday(s.start)), m = ue(null), Y = ue([]), W = ue(!1), q = (i) => {
1538
+ Y.value.push(i.detail), W.value = !0;
1539
+ }, t = () => setTimeout(() => W.value = !1, 300), o = $e({
1516
1540
  dragging: !1,
1517
1541
  holding: !1,
1518
1542
  // When the cell is clicked and hold for a certain amount of time.
@@ -1533,411 +1557,414 @@ const st = (D, n) => {
1533
1557
  movePercentageX: 0,
1534
1558
  movePercentageY: 0,
1535
1559
  schedule: null
1536
- }), e = ie(!1), d = ie({ cellOverlaps: {}, longestStreak: 0 }), g = $(() => {
1537
- let u = Math.min(c.startPercentageY, c.movePercentageY), k = Math.max(c.startPercentageY, c.movePercentageY), E = Pe(u, p), Y = Pe(k, p);
1538
- return p.snapToInterval && (E = b.snapToInterval(E, p.snapToInterval), Y = b.snapToInterval(Y, p.snapToInterval), u = Ve(E, p), k = Ve(Y, p)), {
1560
+ }), e = ue(!1), h = ue({ cellOverlaps: {}, longestStreak: 0 }), c = M(() => {
1561
+ let i = Math.min(o.startPercentageY, o.movePercentageY), T = Math.max(o.startPercentageY, o.movePercentageY), S = Fe(i, w), $ = Fe(T, w);
1562
+ return w.snapToInterval && (S = b.snapToInterval(S, w.snapToInterval), $ = b.snapToInterval($, w.snapToInterval), i = Ve(S, w), T = Ve($, w)), {
1539
1563
  style: {
1540
- top: `${u}%`,
1541
- height: `${Math.abs(k - u)}%`
1564
+ top: `${i}%`,
1565
+ height: `${Math.abs(T - i)}%`
1542
1566
  },
1543
- startMinutes: E,
1544
- endMinutes: Y,
1545
- start: b.formatMinutes(E),
1546
- end: b.formatMinutes(Y),
1547
- ...c.schedule ? { schedule: c.schedule } : {}
1567
+ startMinutes: S,
1568
+ endMinutes: $,
1569
+ start: b.formatMinutes(S),
1570
+ end: b.formatMinutes($),
1571
+ ...o.schedule ? { schedule: o.schedule } : {}
1548
1572
  };
1549
- }), M = $(() => {
1550
- const u = p.editableEvents.create && (c.dragging || e.value), k = p.eventCreateMinDrag && c.thresholdPassed || !p.eventCreateMinDrag;
1551
- return u && k;
1552
- }), P = $(() => {
1553
- var ae;
1554
- const u = /* @__PURE__ */ new Date(), k = h.start.getFullYear(), E = h.start.getMonth(), Y = n.start.getFullYear(), z = n.start.getMonth();
1573
+ }), E = M(() => {
1574
+ const i = w.editableEvents.create && (o.dragging || e.value), T = w.eventCreateMinDrag && o.thresholdPassed || !w.eventCreateMinDrag;
1575
+ return i && T;
1576
+ }), L = M(() => {
1577
+ var ne;
1578
+ const i = /* @__PURE__ */ new Date(), T = d.start.getFullYear(), S = d.start.getMonth(), $ = s.start.getFullYear(), I = s.start.getMonth();
1555
1579
  return {
1556
- [`vuecal__cell--${Re[n.start.getDay()]}`]: h.isDay || h.isDays || h.isWeek || h.isMonth,
1557
- [`vuecal__cell--${$t[z]}`]: h.isYear,
1558
- [`vuecal__cell--${Y}`]: h.isYears,
1559
- "vuecal__cell--today": i.value,
1560
- "vuecal__cell--current-month": h.isYear && Y === u.getFullYear() && z === u.getMonth(),
1561
- "vuecal__cell--current-year": h.isYears && Y === u.getFullYear(),
1562
- "vuecal__cell--out-of-range": h.isMonth && (Y !== k || z !== E),
1563
- "vuecal__cell--before-min": de.value && ue.value,
1564
- "vuecal__cell--after-max": de.value && ce.value,
1565
- "vuecal__cell--disabled": de.value,
1566
- "vuecal__cell--selected": h.selectedDate && h.selectedDate.getTime() >= n.start.getTime() && h.selectedDate.getTime() <= n.end.getTime(),
1567
- "vuecal__cell--has-schedules": (ae = p.schedules) == null ? void 0 : ae.length,
1568
- "vuecal__cell--dragging": c.dragging,
1569
- "vuecal__cell--has-events": l.value.length
1580
+ [`vuecal__cell--${Re[s.start.getDay()]}`]: d.isDay || d.isDays || d.isWeek || d.isMonth,
1581
+ [`vuecal__cell--${Tt[I]}`]: d.isYear,
1582
+ [`vuecal__cell--${$}`]: d.isYears,
1583
+ "vuecal__cell--today": u.value,
1584
+ "vuecal__cell--current-month": d.isYear && $ === i.getFullYear() && I === i.getMonth(),
1585
+ "vuecal__cell--current-year": d.isYears && $ === i.getFullYear(),
1586
+ "vuecal__cell--out-of-range": d.isMonth && ($ !== T || I !== S),
1587
+ "vuecal__cell--before-min": te.value && R.value,
1588
+ "vuecal__cell--after-max": te.value && oe.value,
1589
+ "vuecal__cell--disabled": te.value,
1590
+ "vuecal__cell--selected": d.selectedDate && d.selectedDate.getTime() >= s.start.getTime() && d.selectedDate.getTime() <= s.end.getTime(),
1591
+ "vuecal__cell--has-schedules": (ne = w.schedules) == null ? void 0 : ne.length,
1592
+ "vuecal__cell--dragging": o.dragging,
1593
+ "vuecal__cell--has-events": D.value.length
1570
1594
  };
1571
- }), A = $(() => b.formatDate(n.start)), s = $(() => {
1572
- switch (h.id) {
1595
+ });
1596
+ M(() => b.formatDate(s.start));
1597
+ const z = M(() => {
1598
+ switch (d.id) {
1573
1599
  case "day":
1574
1600
  return "";
1575
1601
  case "days":
1576
- return p.availableViews.days.rows > 1 && b.formatDate(n.start, "D"), "";
1602
+ return w.availableViews.days.rows > 1 && b.formatDate(s.start, "D"), "";
1577
1603
  case "week":
1578
1604
  return "";
1579
1605
  case "month":
1580
- return b.formatDate(n.start, "D");
1606
+ return b.formatDate(s.start, "D");
1581
1607
  case "year":
1582
- return b.formatDate(n.start, p.xs ? "MMM" : "MMMM");
1608
+ return b.formatDate(s.start, w.xs ? "MMM" : "MMMM");
1583
1609
  case "years":
1584
- return b.formatDate(n.start, "YYYY");
1610
+ return b.formatDate(s.start, "YYYY");
1585
1611
  }
1586
- }), l = $(() => p.datePicker ? [] : H.getEventsByDate(A.value, !0, !0).filter((u) => !T.value.includes(u._.id))), _ = $(() => l.value.filter((u) => !u.background)), t = $(() => {
1587
- var u;
1588
- return (u = p.schedules) == null ? void 0 : u.reduce((k, E) => (k[E.id] = l.value.filter((Y) => Y.schedule === E.id), k), {});
1589
- }), C = $(() => {
1590
- const u = {};
1591
- for (const k of l.value) {
1592
- const E = k._.id, { maxConcurrent: Y = 1, position: z = 0 } = d.value.cellOverlaps[E] || {};
1593
- u[E] = { left: `${100 / Y * z}%` }, p.stackEvents ? u[E].width = `${100 / Y + (z === Y - 1 ? 0 : 15)}%` : u[E].width = `${100 / Y}%`;
1612
+ }), D = M(() => w.datePicker ? [] : H.getEventsInRange(s.start, s.end, { excludeIds: Y.value })), l = M(() => D.value.filter((i) => !i.background)), p = M(() => {
1613
+ var i;
1614
+ return (i = w.schedules) == null ? void 0 : i.reduce((T, S) => (T[S.id] = D.value.filter(($) => $.schedule === S.id), T), {});
1615
+ }), k = M(() => {
1616
+ if (d.isMonth || d.isYear || d.isYears) return {};
1617
+ const i = {};
1618
+ for (const T of D.value) {
1619
+ const S = T._.id, { maxConcurrent: $ = 1, position: I = 0 } = h.value.cellOverlaps[S] || {};
1620
+ i[S] = { left: `${100 / $ * I}%` }, w.stackEvents ? i[S].width = `${100 / $ + (I === $ - 1 ? 0 : 15)}%` : i[S].width = `${100 / $}%`;
1594
1621
  }
1595
- return u;
1596
- }), L = $(() => {
1597
- const u = {};
1598
- for (const k of l.value) {
1599
- const E = k._.id, { maxConcurrent: Y = 1, position: z = 0 } = d.value.cellOverlaps[E] || {};
1600
- u[E] = `vuecal__event--stack-${z + 1}-${Y}`;
1622
+ return i;
1623
+ }), a = M(() => {
1624
+ const i = {};
1625
+ for (const T of D.value) {
1626
+ const S = T._.id, { maxConcurrent: $ = 1, position: I = 0 } = h.value.cellOverlaps[S] || {};
1627
+ i[S] = `vuecal__event--stack-${I + 1}-${$}`;
1601
1628
  }
1602
- return u;
1603
- }), J = $(() => h.isMonth && p.eventCount && !p.eventsOnMonthView && _.value.length), Z = $(() => {
1604
- var E;
1605
- if (!p.specialHours || h.isMonth || h.isYear || h.isYears) return;
1606
- const u = Re[n.start.getDay()];
1607
- let k = (E = p.specialHours) == null ? void 0 : E[u];
1608
- if (k)
1609
- return Array.isArray(k) || (k = [k]), k.map((Y) => {
1610
- let { from: z, to: I, class: ae, label: v } = Y;
1611
- if (isNaN(z) || isNaN(I) || p.timeFrom >= I || p.timeTo <= z) return;
1612
- z = Math.max(p.timeFrom, z), I = Math.min(p.timeTo, I);
1613
- const F = Ve(z, p), X = Ve(I, p) - F;
1629
+ return i;
1630
+ }), O = M(() => w.showCellEventCount && l.value.length), B = M(() => {
1631
+ var S;
1632
+ if (!w.specialHours || d.isMonth || d.isYear || d.isYears) return;
1633
+ const i = Re[s.start.getDay()];
1634
+ let T = (S = w.specialHours) == null ? void 0 : S[i];
1635
+ if (T)
1636
+ return Array.isArray(T) || (T = [T]), T.map(($) => {
1637
+ let { from: I, to: G, class: ne, label: De } = $;
1638
+ if (isNaN(I) || isNaN(G) || w.timeFrom >= G || w.timeTo <= I) return;
1639
+ I = Math.max(w.timeFrom, I), G = Math.min(w.timeTo, G);
1640
+ const v = Ve(I, w), N = Ve(G, w) - v;
1614
1641
  return {
1615
- style: { top: `${F}%`, height: `${X}%` },
1616
- label: v,
1617
- class: ae
1642
+ style: { top: `${v}%`, height: `${N}%` },
1643
+ label: De,
1644
+ class: ne
1618
1645
  };
1619
- }).filter((Y) => !!Y);
1620
- }), ue = $(() => p.minTimestamp !== null && p.minTimestamp > n.end.getTime()), ce = $(() => p.maxTimestamp && p.maxTimestamp < n.start.getTime()), de = $(() => {
1621
- const { disableDays: u } = p, k = h.isYear || h.isYears;
1622
- return u.length && u.includes(b.formatDate(n.start)) && !k ? !0 : ue.value || ce.value;
1623
- }), pe = $e({
1624
- show: $(() => {
1625
- if (!(!h.isDay && !h.isDays && !h.isWeek) && !(!i.value || !p.time) && !(p.timeFrom > b.dateToMinutes(h.now)) && !(b.dateToMinutes(h.now) > p.timeTo))
1646
+ }).filter(($) => !!$);
1647
+ }), R = M(() => w.minTimestamp !== null && w.minTimestamp > s.end.getTime()), oe = M(() => w.maxTimestamp && w.maxTimestamp < s.start.getTime()), te = M(() => {
1648
+ const { disableDays: i } = w, T = d.isYear || d.isYears;
1649
+ return i.length && i.includes(b.formatDate(s.start)) && !T ? !0 : R.value || oe.value;
1650
+ }), se = $e({
1651
+ show: M(() => {
1652
+ if (!(!d.isDay && !d.isDays && !d.isWeek) && !(!u.value || !w.time) && !(w.timeFrom > b.dateToMinutes(d.now)) && !(b.dateToMinutes(d.now) > w.timeTo))
1626
1653
  return !0;
1627
1654
  }),
1628
- nowInMinutes: $(() => b.dateToMinutes(h.now)),
1629
- todaysTimePosition: $(() => Ve(pe.nowInMinutes, p)),
1630
- style: $(() => `top: ${pe.todaysTimePosition}%`),
1631
- currentTime: $(() => b.formatTime(h.now))
1632
- }), oe = $(() => {
1633
- if (de.value) return {};
1634
- const u = { ...p.eventListeners.cell };
1635
- for (const [Y, z] of Object.entries(u))
1636
- u[Y] = (I) => {
1637
- var ae, v, F;
1638
- (F = (v = I.target || ((ae = I.e) == null ? void 0 : ae.target)).closest) != null && F.call(v, ".vuecal__event") || z(I.type ? { e: I, cell: K.value, cursor: x.value } : I);
1655
+ nowInMinutes: M(() => b.dateToMinutes(d.now)),
1656
+ todaysTimePosition: M(() => Ve(se.nowInMinutes, w)),
1657
+ style: M(() => `top: ${se.todaysTimePosition}%`),
1658
+ currentTime: M(() => b.formatTime(d.now))
1659
+ }), ce = M(() => {
1660
+ if (te.value) return {};
1661
+ const i = { ...w.eventListeners.cell };
1662
+ for (const [$, I] of Object.entries(i))
1663
+ i[$] = (G) => {
1664
+ var ne, De, v;
1665
+ (v = (De = G.target || ((ne = G.e) == null ? void 0 : ne.target)).closest) != null && v.call(De, ".vuecal__event") || I(G.type ? { e: G, cell: X.value, cursor: Q.value } : G);
1639
1666
  };
1640
- const k = { ...u };
1641
- let E = null;
1642
- return u.click = (Y) => {
1643
- var I;
1644
- a();
1645
- const z = ee(Y);
1646
- (I = k.click) == null || I.call(k, { e: Y, cell: K.value, cursor: z }), E ? E = clearTimeout(E) : E = setTimeout(() => {
1647
- var ae;
1648
- E = null, (ae = k["delayed-click"]) == null || ae.call(k, { e: Y, cell: K.value, cursor: z });
1667
+ const T = { ...i };
1668
+ let S = null;
1669
+ return i.click = ($) => {
1670
+ var G;
1671
+ le();
1672
+ const I = Ee($);
1673
+ (G = T.click) == null || G.call(T, { e: $, cell: X.value, cursor: I }), S ? S = clearTimeout(S) : S = setTimeout(() => {
1674
+ var ne;
1675
+ S = null, (ne = T["delayed-click"]) == null || ne.call(T, { e: $, cell: X.value, cursor: I });
1649
1676
  }, 400);
1650
- }, (p.time && h.isDay || h.isDays || h.isWeek) && (u.touchstart = (Y) => {
1651
- var z;
1652
- w(Y.e || Y), (z = k.touchstart) == null || z.call(k, { e: Y, cell: K.value, cursor: x.value });
1653
- }, u.mousedown = (Y) => {
1654
- var z;
1655
- w(Y.e || Y), (z = k.mousedown) == null || z.call(k, { e: Y, cell: K.value, cursor: x.value });
1656
- }), k.dblclick && (u.dblclick = (Y) => {
1657
- var z;
1658
- (z = k.dblclick) == null || z.call(k, { e: Y, cell: K.value, cursor: ee(Y) });
1659
- }), p.editableEvents.drag && (u.dragenter = (Y) => m.cellDragEnter(Y, K.value), u.dragover = (Y) => {
1660
- Y.preventDefault(), m.cellDragOver(Y, K.value);
1661
- }, u.dragleave = (Y) => m.cellDragLeave(Y, K.value), u.drop = (Y) => m.cellDragDrop(Y, K.value)), u;
1662
- }), K = $(() => ({
1663
- start: n.start,
1664
- end: n.end,
1665
- events: l,
1666
- ...c.schedule ? { schedule: c.schedule } : {},
1667
- goNarrower: () => h.narrower(),
1668
- goBroader: () => h.broader(),
1669
- broader: h.broaderView,
1670
- narrower: h.narrowerView
1671
- })), ee = (u) => {
1672
- var I;
1673
- const k = (((I = u.touches) == null ? void 0 : I[0]) || u).clientY, { top: E } = f.value.getBoundingClientRect(), Y = Ze(k - E, f.value), z = new Date(n.start);
1674
- return z.setMinutes(Pe(Y, p)), { y: Y, date: z };
1675
- }, x = $(() => {
1676
- const u = Pe(c.movePercentageY || c.startPercentageY, p), k = new Date(n.start);
1677
- return k.setMinutes(u), {
1678
- x: c.movePercentageX || c.startPercentageX,
1679
- y: c.movePercentageY || c.startPercentageY,
1680
- date: k
1677
+ }, (w.time && d.isDay || d.isDays || d.isWeek) && (i.touchstart = ($) => {
1678
+ var I;
1679
+ n($.e || $), (I = T.touchstart) == null || I.call(T, { e: $, cell: X.value, cursor: Q.value });
1680
+ }, i.mousedown = ($) => {
1681
+ var I;
1682
+ n($.e || $), (I = T.mousedown) == null || I.call(T, { e: $, cell: X.value, cursor: Q.value });
1683
+ }), T.dblclick && (i.dblclick = ($) => {
1684
+ var I;
1685
+ (I = T.dblclick) == null || I.call(T, { e: $, cell: X.value, cursor: Ee($) });
1686
+ }), w.editableEvents.drag && (i.dragenter = ($) => f.cellDragEnter($, X.value), i.dragover = ($) => {
1687
+ $.preventDefault(), f.cellDragOver($, X.value);
1688
+ }, i.dragleave = ($) => f.cellDragLeave($, X.value), i.drop = ($) => f.cellDragDrop($, X.value)), i;
1689
+ }), X = M(() => ({
1690
+ start: s.start,
1691
+ end: s.end,
1692
+ events: D,
1693
+ ...o.schedule ? { schedule: o.schedule } : {},
1694
+ goNarrower: () => d.narrower(),
1695
+ goBroader: () => d.broader(),
1696
+ broader: d.broaderView,
1697
+ narrower: d.narrowerView
1698
+ })), Ee = (i) => {
1699
+ var G;
1700
+ const T = (((G = i.touches) == null ? void 0 : G[0]) || i).clientY, { top: S } = m.value.getBoundingClientRect(), $ = Ze(T - S, m.value), I = new Date(s.start);
1701
+ return I.setMinutes(Fe($, w)), { y: $, date: I };
1702
+ }, Q = M(() => {
1703
+ const i = Fe(o.movePercentageY || o.startPercentageY, w), T = new Date(s.start);
1704
+ return T.setMinutes(i), {
1705
+ x: o.movePercentageX || o.startPercentageX,
1706
+ y: o.movePercentageY || o.startPercentageY,
1707
+ date: T
1681
1708
  };
1682
- }), a = () => {
1683
- h.updateSelectedDate(n.start), p.clickToNavigate && ((h.isMonth || h.isDays || h.isWeek) && p.availableViews.day ? h.switch("day") : h.isYear && p.availableViews.month ? h.switch("month") : h.isYears && p.availableViews.year && h.switch("year")), h.updateViewDate(n.start);
1684
- }, w = (u) => {
1685
- var E, Y;
1686
- c.schedule = ~~u.target.dataset.schedule;
1687
- const k = f.value.getBoundingClientRect();
1688
- c.startX = (((E = u.touches) == null ? void 0 : E[0]) || u).clientX - k.left, c.startY = (((Y = u.touches) == null ? void 0 : Y[0]) || u).clientY - k.top, c.startPercentageX = c.startX * 100 / k.width, c.startPercentageY = c.startY * 100 / k.height, c.thresholdPassed = !1, document.addEventListener(u.type === "touchstart" ? "touchmove" : "mousemove", y), document.addEventListener(u.type === "touchstart" ? "touchend" : "mouseup", B, { once: !0 }), c.holdTimer = setTimeout(() => {
1689
- var z, I;
1690
- c.holding = !0, (I = (z = oe.value).hold) == null || I.call(z, { e: u, cell: K.value, cursor: x.value });
1709
+ }), le = () => {
1710
+ d.updateSelectedDate(s.start), w.clickToNavigate && ((d.isMonth || d.isDays || d.isWeek) && w.availableViews.day ? d.switch("day") : d.isYear && w.availableViews.month ? d.switch("month") : d.isYears && w.availableViews.year && d.switch("year")), d.updateViewDate(s.start);
1711
+ }, n = (i) => {
1712
+ var S, $;
1713
+ o.schedule = ~~i.target.dataset.schedule;
1714
+ const T = m.value.getBoundingClientRect();
1715
+ o.startX = (((S = i.touches) == null ? void 0 : S[0]) || i).clientX - T.left, o.startY = ((($ = i.touches) == null ? void 0 : $[0]) || i).clientY - T.top, o.startPercentageX = o.startX * 100 / T.width, o.startPercentageY = o.startY * 100 / T.height, o.thresholdPassed = !1, document.addEventListener(i.type === "touchstart" ? "touchmove" : "mousemove", _), document.addEventListener(i.type === "touchstart" ? "touchend" : "mouseup", g, { once: !0 }), o.holdTimer = setTimeout(() => {
1716
+ var I, G;
1717
+ o.holding = !0, (G = (I = ce.value).hold) == null || G.call(I, { e: i, cell: X.value, cursor: Q.value });
1691
1718
  }, 1e3);
1692
- }, y = (u) => {
1693
- var E, Y, z, I, ae, v;
1694
- c.dragging || (j.isDraggingCell = !0, (Y = (E = oe.value)["drag-start"]) == null || Y.call(E, { e: u, cell: K.value, cursor: x.value })), c.dragging = !0, c.holdTimer = clearTimeout(c.holdTimer), c.holding = !1;
1695
- const k = f.value.getBoundingClientRect();
1696
- c.moveX = (((z = u.touches) == null ? void 0 : z[0]) || u).clientX - k.left, c.moveY = (((I = u.touches) == null ? void 0 : I[0]) || u).clientY - k.top, c.movePercentageX = c.moveX * 100 / k.width, c.movePercentageY = c.moveY * 100 / k.height, p.eventCreateMinDrag && Math.abs(c.startY - c.moveY) > p.eventCreateMinDrag && (c.thresholdPassed = !0), (v = (ae = oe.value).drag) == null || v.call(ae, { e: u, cell: K.value, cursor: x.value });
1697
- }, B = async (u) => {
1698
- var k, E;
1699
- document.removeEventListener(u.type === "touchend" ? "touchmove" : "mousemove", y, { passive: !1 }), c.dragging && ((E = (k = oe.value)["drag-end"]) == null || E.call(k, { e: u, cell: K.value, cursor: x.value }), j.isDraggingCell = !1, p.editableEvents.create && (e.value = !0, await Q(u), e.value = !1)), c.holdTimer = clearTimeout(c.holdTimer), c.holding = !1, c.dragging = !1, c.startX = 0, c.startY = 0, c.moveX = 0, c.moveY = 0, c.startPercentageX = 0, c.startPercentageY = 0, c.movePercentageX = 0, c.movePercentageY = 0, c.thresholdPassed = !1, c.schedule = null;
1700
- }, Q = async (u) => {
1701
- if (!M.value) return;
1702
- let { start: k, end: E, startMinutes: Y, endMinutes: z } = g.value;
1703
- k = new Date(n.start), k.setMinutes(Y), E = new Date(n.start), E.setMinutes(z);
1704
- let I = { ...g.value, start: k, end: E };
1705
- const { create: ae } = p.eventListeners.event;
1706
- if (typeof ae == "function") {
1707
- const v = I;
1708
- I = await new Promise((F) => ae({ e: u, event: I, cell: K.value, resolve: F, cursor: x.value })), I && typeof I == "object" && h.createEvent(I), I && typeof I == "boolean" && h.createEvent(v);
1709
- } else h.createEvent(I);
1719
+ }, _ = (i) => {
1720
+ var S, $, I, G, ne, De;
1721
+ o.dragging || (F.isDraggingCell = !0, ($ = (S = ce.value)["drag-start"]) == null || $.call(S, { e: i, cell: X.value, cursor: Q.value })), o.dragging = !0, o.holdTimer = clearTimeout(o.holdTimer), o.holding = !1;
1722
+ const T = m.value.getBoundingClientRect();
1723
+ o.moveX = (((I = i.touches) == null ? void 0 : I[0]) || i).clientX - T.left, o.moveY = (((G = i.touches) == null ? void 0 : G[0]) || i).clientY - T.top, o.movePercentageX = o.moveX * 100 / T.width, o.movePercentageY = o.moveY * 100 / T.height, w.eventCreateMinDrag && Math.abs(o.startY - o.moveY) > w.eventCreateMinDrag && (o.thresholdPassed = !0), (De = (ne = ce.value).drag) == null || De.call(ne, { e: i, cell: X.value, cursor: Q.value });
1724
+ }, g = async (i) => {
1725
+ var T, S;
1726
+ document.removeEventListener(i.type === "touchend" ? "touchmove" : "mousemove", _, { passive: !1 }), o.dragging && ((S = (T = ce.value)["drag-end"]) == null || S.call(T, { e: i, cell: X.value, cursor: Q.value }), F.isDraggingCell = !1, w.editableEvents.create && (e.value = !0, await A(i), e.value = !1)), o.holdTimer = clearTimeout(o.holdTimer), o.holding = !1, o.dragging = !1, o.startX = 0, o.startY = 0, o.moveX = 0, o.moveY = 0, o.startPercentageX = 0, o.startPercentageY = 0, o.movePercentageX = 0, o.movePercentageY = 0, o.thresholdPassed = !1, o.schedule = null;
1727
+ }, A = async (i) => {
1728
+ if (!E.value) return;
1729
+ let { start: T, end: S, startMinutes: $, endMinutes: I } = c.value;
1730
+ T = new Date(s.start), T.setMinutes($), S = new Date(s.start), S.setMinutes(I);
1731
+ let G = { ...c.value, start: T, end: S };
1732
+ const { create: ne } = w.eventListeners.event;
1733
+ if (typeof ne == "function") {
1734
+ const De = G;
1735
+ G = await new Promise((v) => ne({ e: i, event: G, cell: X.value, resolve: v, cursor: Q.value })), G && typeof G == "object" && d.createEvent(G), G && typeof G == "boolean" && d.createEvent(De);
1736
+ } else d.createEvent(G);
1737
+ }, x = () => {
1738
+ var i;
1739
+ for (const T of Object.keys(ce.value))
1740
+ (i = m.value) == null || i.removeEventListener(T, ce.value[T]);
1710
1741
  }, he = () => {
1711
- var u;
1712
- for (const k of Object.keys(oe.value))
1713
- (u = f.value) == null || u.removeEventListener(k, oe.value[k]);
1714
- }, te = () => {
1715
- d.value = H.getCellOverlappingEvents(A.value);
1742
+ h.value = H.getCellOverlappingEvents(s.start, s.end);
1716
1743
  };
1717
1744
  return me(
1718
1745
  // Watch event IDs and start/end dates (only) to detect event resizing/dnd.
1719
- () => _.value.map((u) => `${u._.id}${u.start.getTime()}${u.end.getTime()}`).join(),
1746
+ () => !d.isYears && !d.isYear && l.value.map((i) => `${i._.id}${i.start.getTime()}${i.end.getTime()}`).join(),
1720
1747
  async () => {
1721
- await Ue(), te();
1748
+ await Ue(), he();
1722
1749
  },
1723
1750
  { immediate: !0, flush: "post" }
1724
1751
  // Use flush: 'post' to prevent infinite updates.
1725
1752
  ), Xe(async () => {
1726
- for (const u of T.value) H.deleteEvent(u, 3);
1727
- he(), await Ue();
1728
- }), (u, k) => (S(), O("div", ye({
1729
- class: ["vuecal__cell", P.value],
1753
+ for (const i of Y.value) H.deleteEvent(i, 3);
1754
+ x(), await Ue();
1755
+ }), (i, T) => (C(), j("div", de({
1756
+ class: ["vuecal__cell", L.value],
1730
1757
  ref_key: "cellEl",
1731
- ref: f
1732
- }, Ie(oe.value, !0)), [
1733
- u.$slots.cell ? N(u.$slots, "cell", {
1758
+ ref: m
1759
+ }, Be(ce.value, !0)), [
1760
+ i.$slots.cell ? P(i.$slots, "cell", {
1734
1761
  key: 0,
1735
- cell: K.value
1736
- }) : U("", !0),
1737
- Z.value ? (S(!0), O(ne, { key: 1 }, be(Z.value, (E, Y) => (S(), O("div", {
1738
- class: De(["vuecal__special-hours", E.class]),
1739
- style: ke(E.style),
1740
- innerHTML: E.label || ""
1741
- }, null, 14, na))), 256)) : U("", !0),
1742
- !u.$slots.cell && V(p).schedules ? (S(!0), O(ne, { key: 2 }, be(V(p).schedules, (E) => (S(), O("div", {
1743
- class: De(["vuecal__schedule vuecal__schedule--cell", E.class]),
1744
- key: E.id,
1745
- style: ke(E.style || null),
1746
- "data-schedule": E.id
1762
+ cell: X.value
1763
+ }) : K("", !0),
1764
+ B.value ? (C(!0), j(re, { key: 1 }, ke(B.value, (S, $) => (C(), j("div", {
1765
+ class: ye(["vuecal__special-hours", S.class]),
1766
+ style: _e(S.style),
1767
+ innerHTML: S.label || ""
1768
+ }, null, 14, na))), 256)) : K("", !0),
1769
+ !i.$slots.cell && V(w).schedules ? (C(!0), j(re, { key: 2 }, ke(V(w).schedules, (S) => (C(), j("div", {
1770
+ class: ye(["vuecal__schedule vuecal__schedule--cell", S.class]),
1771
+ key: S.id,
1772
+ style: _e(S.style || null),
1773
+ "data-schedule": S.id
1747
1774
  }, [
1748
- u.$slots["cell-events"] ? N(u.$slots, "cell-events", {
1775
+ i.$slots["cell-events"] ? P(i.$slots, "cell-events", {
1749
1776
  key: 0,
1750
- cell: K.value
1751
- }) : U("", !0),
1752
- s.value || u.$slots["cell-date"] ? (S(), O("div", la, [
1753
- N(u.$slots, "cell-date", { cell: K.value }, () => [
1754
- et(re(s.value), 1)
1777
+ cell: X.value
1778
+ }) : K("", !0),
1779
+ z.value || i.$slots["cell-date"] ? (C(), j("div", la, [
1780
+ P(i.$slots, "cell-date", { cell: X.value }, () => [
1781
+ et(ie(z.value), 1)
1755
1782
  ])
1756
- ])) : U("", !0),
1757
- u.$slots["cell-content"] ? (S(), O("div", ra, [
1758
- N(u.$slots, "cell-content", { cell: K.value })
1759
- ])) : U("", !0),
1760
- u.$slots["cell-events"] && l.value.length ? (S(), O("div", oa, [
1761
- N(u.$slots, "cell-events", { cell: K.value })
1762
- ])) : l.value.length || W.value ? (S(), Se(tt, {
1783
+ ])) : K("", !0),
1784
+ i.$slots["cell-content"] ? (C(), j("div", ra, [
1785
+ P(i.$slots, "cell-content", { cell: X.value })
1786
+ ])) : K("", !0),
1787
+ i.$slots["cell-events"] && D.value.length ? (C(), j("div", oa, [
1788
+ P(i.$slots, "cell-events", { cell: X.value })
1789
+ ])) : D.value.length || W.value ? (C(), Se(tt, {
1763
1790
  key: 4,
1764
1791
  class: "vuecal__cell-events",
1765
1792
  name: "vuecal-event-delete",
1766
- onBeforeLeave: k[0] || (k[0] = (Y) => W.value = !0),
1767
- onAfterLeave: o,
1793
+ onBeforeLeave: T[0] || (T[0] = ($) => W.value = !0),
1794
+ onAfterLeave: t,
1768
1795
  tag: "div"
1769
1796
  }, {
1770
- default: q(() => [
1771
- (S(!0), O(ne, null, be(t.value[E.id], (Y) => (S(), Se(nt, {
1772
- key: Y._.id,
1773
- event: Y,
1774
- onEventDeleted: R,
1775
- style: ke(C.value[Y._.id])
1797
+ default: J(() => [
1798
+ (C(!0), j(re, null, ke(p.value[S.id], ($) => (C(), Se(nt, {
1799
+ key: $._.id,
1800
+ event: $,
1801
+ onEventDeleted: q,
1802
+ style: _e(k.value[$._.id])
1776
1803
  }, je({ _: 2 }, [
1777
- u.$slots.event ? {
1804
+ i.$slots.event ? {
1778
1805
  name: "event",
1779
- fn: q((z) => [
1780
- N(u.$slots, "event", ye({ ref_for: !0 }, z))
1806
+ fn: J((I) => [
1807
+ P(i.$slots, "event", de({ ref_for: !0 }, I))
1781
1808
  ]),
1782
1809
  key: "0"
1783
1810
  } : void 0
1784
1811
  ]), 1032, ["event", "style"]))), 128))
1785
1812
  ]),
1786
1813
  _: 2
1787
- }, 1024)) : U("", !0),
1788
- M.value && c.schedule === E.id ? (S(), O("div", {
1814
+ }, 1024)) : K("", !0),
1815
+ E.value && o.schedule === S.id ? (C(), j("div", {
1789
1816
  key: 5,
1790
1817
  class: "vuecal__event-placeholder",
1791
- style: ke(g.value.style)
1792
- }, re(g.value.start) + " - " + re(g.value.end), 5)) : U("", !0)
1793
- ], 14, sa))), 128)) : U("", !0),
1794
- !u.$slots.cell && !V(p).schedules ? (S(), O(ne, { key: 3 }, [
1795
- u.$slots["cell-events"] ? N(u.$slots, "cell-events", {
1818
+ style: _e(c.value.style)
1819
+ }, ie(c.value.start) + " - " + ie(c.value.end), 5)) : K("", !0)
1820
+ ], 14, sa))), 128)) : K("", !0),
1821
+ !i.$slots.cell && !V(w).schedules ? (C(), j(re, { key: 3 }, [
1822
+ i.$slots["cell-events"] ? P(i.$slots, "cell-events", {
1796
1823
  key: 0,
1797
- cell: K.value
1798
- }) : U("", !0),
1799
- s.value || u.$slots["cell-date"] ? (S(), O("div", ia, [
1800
- N(u.$slots, "cell-date", { cell: K.value }, () => [
1801
- et(re(s.value), 1)
1824
+ cell: X.value
1825
+ }) : K("", !0),
1826
+ z.value || i.$slots["cell-date"] ? (C(), j("div", ia, [
1827
+ P(i.$slots, "cell-date", { cell: X.value }, () => [
1828
+ et(ie(z.value), 1)
1802
1829
  ])
1803
- ])) : U("", !0),
1804
- u.$slots["cell-content"] ? (S(), O("div", ua, [
1805
- N(u.$slots, "cell-content", { cell: K.value })
1806
- ])) : U("", !0),
1807
- u.$slots["cell-events"] && l.value.length ? (S(), O("div", ca, [
1808
- N(u.$slots, "cell-events", { cell: K.value })
1809
- ])) : (l.value.length || W.value) && !(V(h).isMonth && !V(p).eventsOnMonthView) ? (S(), Se(tt, {
1830
+ ])) : K("", !0),
1831
+ i.$slots["cell-content"] ? (C(), j("div", ua, [
1832
+ P(i.$slots, "cell-content", { cell: X.value })
1833
+ ])) : K("", !0),
1834
+ i.$slots["cell-events"] && D.value.length ? (C(), j("div", ca, [
1835
+ P(i.$slots, "cell-events", { cell: X.value })
1836
+ ])) : !(V(d).isMonth && !V(w).eventsOnMonthView) && !V(d).isYear && !V(d).isYears && (D.value.length || W.value) ? (C(), Se(tt, {
1810
1837
  key: 4,
1811
1838
  class: "vuecal__cell-events",
1812
1839
  name: "vuecal-event-delete",
1813
- onBeforeLeave: k[1] || (k[1] = (E) => W.value = !0),
1814
- onAfterLeave: o,
1840
+ onBeforeLeave: T[1] || (T[1] = (S) => W.value = !0),
1841
+ onAfterLeave: t,
1815
1842
  tag: "div"
1816
1843
  }, {
1817
- default: q(() => [
1818
- (S(!0), O(ne, null, be(l.value, (E) => (S(), Se(nt, {
1819
- key: E._.id,
1820
- event: E,
1821
- onEventDeleted: R,
1822
- class: De(L.value[E._.id]),
1823
- style: ke(C.value[E._.id])
1844
+ default: J(() => [
1845
+ (C(!0), j(re, null, ke(D.value, (S) => (C(), Se(nt, {
1846
+ key: S._.id,
1847
+ event: S,
1848
+ onEventDeleted: q,
1849
+ class: ye(a.value[S._.id]),
1850
+ style: _e(k.value[S._.id])
1824
1851
  }, je({ _: 2 }, [
1825
- u.$slots.event ? {
1852
+ i.$slots.event ? {
1826
1853
  name: "event",
1827
- fn: q((Y) => [
1828
- N(u.$slots, "event", ye({ ref_for: !0 }, Y))
1854
+ fn: J(($) => [
1855
+ P(i.$slots, "event", de({ ref_for: !0 }, $))
1829
1856
  ]),
1830
1857
  key: "0"
1831
1858
  } : void 0
1832
1859
  ]), 1032, ["event", "class", "style"]))), 128))
1833
1860
  ]),
1834
1861
  _: 3
1835
- })) : U("", !0),
1836
- M.value ? (S(), O("div", {
1862
+ })) : K("", !0),
1863
+ E.value ? (C(), j("div", {
1837
1864
  key: 5,
1838
1865
  class: "vuecal__event-placeholder",
1839
- style: ke(g.value.style)
1840
- }, re(g.value.start) + " - " + re(g.value.end), 5)) : U("", !0)
1841
- ], 64)) : U("", !0),
1842
- u.$slots["event-count"] ? N(u.$slots, "event-count", {
1866
+ style: _e(c.value.style)
1867
+ }, ie(c.value.start) + " - " + ie(c.value.end), 5)) : K("", !0)
1868
+ ], 64)) : K("", !0),
1869
+ i.$slots["event-count"] ? P(i.$slots, "event-count", {
1843
1870
  key: 4,
1844
- events: _.value
1845
- }) : J.value ? (S(), O("div", da, re(_.value.length), 1)) : U("", !0),
1846
- pe.show ? (S(), O("div", {
1871
+ events: l.value
1872
+ }) : O.value ? (C(), j("div", da, ie(l.value.length), 1)) : K("", !0),
1873
+ se.show ? (C(), j("div", {
1847
1874
  key: 6,
1848
1875
  class: "vuecal__now-line",
1849
- style: ke(pe.style),
1850
- title: pe.currentTime
1876
+ style: _e(se.style),
1877
+ title: se.currentTime
1851
1878
  }, [
1852
- ge("span", null, re(pe.currentTime), 1)
1853
- ], 12, va)) : U("", !0)
1879
+ ge("span", null, ie(se.currentTime), 1)
1880
+ ], 12, va)) : K("", !0)
1854
1881
  ], 16));
1855
1882
  }
1856
1883
  }, fa = {
1857
1884
  __name: "body",
1858
- setup(D) {
1859
- const n = Ne("vuecal"), { view: r, config: h, dateUtils: p } = n, b = ie(null), H = ie(null), m = $(() => ({
1885
+ setup(y) {
1886
+ const s = Ne("vuecal"), { view: r, config: d, dateUtils: w } = s, b = ue(null), H = ue(null), f = M(() => ({
1860
1887
  "--vuecal-grid-columns": r.cols,
1861
1888
  "--vuecal-grid-rows": r.rows
1862
- })), j = $(() => {
1863
- const T = p.formatTime(Pe(H.value, h));
1889
+ })), F = M(() => {
1890
+ const Y = w.formatTime(Fe(H.value, d));
1864
1891
  return {
1865
1892
  style: { top: `${H.value}%` },
1866
- time: T
1893
+ time: Y
1867
1894
  };
1868
- }), i = (T) => {
1869
- var o;
1895
+ }), u = (Y) => {
1896
+ var t;
1870
1897
  if (r.isMonth || r.isYear || r.isYears) return;
1871
- const W = (((o = T.touches) == null ? void 0 : o[0]) || T).clientY, { top: R } = b.value.getBoundingClientRect();
1872
- H.value = Ze(W - R, b.value);
1873
- }, f = () => {
1898
+ const W = (((t = Y.touches) == null ? void 0 : t[0]) || Y).clientY, { top: q } = b.value.getBoundingClientRect();
1899
+ H.value = Ze(W - q, b.value);
1900
+ }, m = () => {
1874
1901
  H.value = null;
1875
1902
  };
1876
1903
  return qe(() => {
1877
- b.value.addEventListener("mousemove", i), b.value.addEventListener("touchmove", i), b.value.addEventListener("mouseleave", f), b.value.addEventListener("touchend", f);
1904
+ b.value.addEventListener("mousemove", u), b.value.addEventListener("touchmove", u), b.value.addEventListener("mouseleave", m), b.value.addEventListener("touchend", m);
1878
1905
  }), Xe(() => {
1879
- b.value && (b.value.removeEventListener("mousemove", i), b.value.removeEventListener("touchmove", i), b.value.removeEventListener("mouseleave", f), b.value.removeEventListener("touchend", f));
1880
- }), (T, W) => (S(), O("div", {
1906
+ b.value && (b.value.removeEventListener("mousemove", u), b.value.removeEventListener("touchmove", u), b.value.removeEventListener("mouseleave", m), b.value.removeEventListener("touchend", m));
1907
+ }), (Y, W) => (C(), j("div", {
1881
1908
  class: "vuecal__body",
1882
1909
  ref_key: "bodyEl",
1883
1910
  ref: b,
1884
- style: ke(m.value)
1911
+ style: _e(f.value)
1885
1912
  }, [
1886
1913
  Oe(Ge, { name: "vuecal-shrink" }, {
1887
- default: q(() => [
1888
- V(h).timeAtCursor && H.value !== null ? (S(), O("div", {
1914
+ default: J(() => [
1915
+ V(d).timeAtCursor && H.value !== null ? (C(), j("div", {
1889
1916
  key: 0,
1890
1917
  class: "vuecal__time-at-cursor",
1891
- style: ke(j.value.style)
1918
+ style: _e(F.value.style)
1892
1919
  }, [
1893
- ge("label", null, re(j.value.time), 1)
1894
- ], 4)) : U("", !0)
1920
+ ge("label", null, ie(F.value.time), 1)
1921
+ ], 4)) : K("", !0)
1895
1922
  ]),
1896
1923
  _: 1
1897
1924
  }),
1898
- (S(!0), O(ne, null, be(V(r).cellDates, (R, o) => (S(), Se(ma, {
1899
- key: o,
1900
- start: R.start,
1901
- end: R.end,
1902
- index: o
1925
+ (C(!0), j(re, null, ke(V(r).cellDates, (q, t) => (C(), Se(ma, {
1926
+ key: t,
1927
+ start: q.start,
1928
+ end: q.end,
1929
+ index: t
1903
1930
  }, je({ _: 2 }, [
1904
- T.$slots.cell ? {
1931
+ Y.$slots.cell ? {
1905
1932
  name: "cell",
1906
- fn: q((c) => [
1907
- N(T.$slots, "cell", ye({ ref_for: !0 }, c))
1933
+ fn: J((o) => [
1934
+ P(Y.$slots, "cell", de({ ref_for: !0 }, o))
1908
1935
  ]),
1909
1936
  key: "0"
1910
1937
  } : void 0,
1911
- T.$slots["cell-date"] ? {
1938
+ Y.$slots["cell-date"] ? {
1912
1939
  name: "cell-date",
1913
- fn: q((c) => [
1914
- N(T.$slots, "cell-date", ye({ ref_for: !0 }, c))
1940
+ fn: J((o) => [
1941
+ P(Y.$slots, "cell-date", de({ ref_for: !0 }, o))
1915
1942
  ]),
1916
1943
  key: "1"
1917
1944
  } : void 0,
1918
- T.$slots["cell-content"] ? {
1945
+ Y.$slots["cell-content"] ? {
1919
1946
  name: "cell-content",
1920
- fn: q((c) => [
1921
- N(T.$slots, "cell-content", ye({ ref_for: !0 }, c))
1947
+ fn: J((o) => [
1948
+ P(Y.$slots, "cell-content", de({ ref_for: !0 }, o))
1922
1949
  ]),
1923
1950
  key: "2"
1924
1951
  } : void 0,
1925
- T.$slots["cell-events"] ? {
1952
+ Y.$slots["cell-events"] ? {
1926
1953
  name: "cell-events",
1927
- fn: q((c) => [
1928
- N(T.$slots, "cell-events", ye({ ref_for: !0 }, c))
1954
+ fn: J((o) => [
1955
+ P(Y.$slots, "cell-events", de({ ref_for: !0 }, o))
1929
1956
  ]),
1930
1957
  key: "3"
1931
- } : T.$slots.event ? {
1958
+ } : Y.$slots.event ? {
1932
1959
  name: "event",
1933
- fn: q((c) => [
1934
- N(T.$slots, "event", ye({ ref_for: !0 }, c))
1960
+ fn: J((o) => [
1961
+ P(Y.$slots, "event", de({ ref_for: !0 }, o))
1935
1962
  ]),
1936
1963
  key: "4"
1937
- } : T.$slots["event-count"] ? {
1964
+ } : Y.$slots["event-count"] ? {
1938
1965
  name: "event-count",
1939
- fn: q((c) => [
1940
- N(T.$slots, "event-count", ye({ ref_for: !0 }, c))
1966
+ fn: J((o) => [
1967
+ P(Y.$slots, "event-count", de({ ref_for: !0 }, o))
1941
1968
  ]),
1942
1969
  key: "5"
1943
1970
  } : void 0
@@ -1949,7 +1976,7 @@ const st = (D, n) => {
1949
1976
  class: "vuecal__week-numbers"
1950
1977
  }, Da = { class: "vuecal__week-number" }, pa = { class: "vuecal__body-wrap" }, _a = {
1951
1978
  __name: "index",
1952
- props: Pt,
1979
+ props: Ft,
1953
1980
  emits: [
1954
1981
  "ready",
1955
1982
  "view-change",
@@ -1963,130 +1990,172 @@ const st = (D, n) => {
1963
1990
  "event-drag-start",
1964
1991
  "event-drag-end"
1965
1992
  ],
1966
- setup(D, { expose: n, emit: r }) {
1967
- const h = D, p = r, b = _t("vuecal-el"), H = Ot({ props: h, emit: p, attrs: bt(), vuecalEl: b, uid: kt() }), { config: m, view: j, dateUtils: i, touch: f } = H, T = $(() => m.time && (j.isDay || j.isDays || j.isWeek)), W = $(() => Array(j.rows).fill().map((e, d) => i.getWeek(i.addDays(j.firstCellDate, 7 * d)))), R = $(() => {
1993
+ setup(y, { expose: s, emit: r }) {
1994
+ const d = y, w = r, b = _t("vuecal-el"), H = Ot({ props: d, emit: w, attrs: bt(), vuecalEl: b, uid: kt() }), { config: f, view: F, dateUtils: u, touch: m } = H, Y = M(() => f.time && (F.isDay || F.isDays || F.isWeek)), W = M(() => Array(F.rows).fill().map((e, h) => u.getWeek(u.addDays(F.firstCellDate, 7 * h)))), q = M(() => {
1968
1995
  var e;
1969
1996
  return {
1970
- "vuecal--ready": m.ready,
1971
- [`vuecal--${m.theme}-theme`]: m.theme,
1972
- [`vuecal--${m.size}`]: !0,
1973
- "vuecal--date-picker": m.datePicker,
1974
- "vuecal--dark": m.dark,
1975
- "vuecal--light": !m.dark,
1976
- [`vuecal--${j.id}-view`]: !0,
1977
- "vuecal--view-has-time": T.value,
1978
- "vuecal--timeless": !m.time,
1979
- "vuecal--dragging-cell": f.isDraggingCell,
1980
- "vuecal--dragging-event": f.isDraggingEvent,
1981
- "vuecal--resizing-event": f.isResizingEvent,
1982
- "vuecal--has-schedules": (e = m.schedules) == null ? void 0 : e.length
1997
+ "vuecal--ready": f.ready,
1998
+ [`vuecal--${f.theme}-theme`]: f.theme,
1999
+ [`vuecal--${f.size}`]: !0,
2000
+ "vuecal--date-picker": f.datePicker,
2001
+ "vuecal--dark": f.dark,
2002
+ "vuecal--light": !f.dark,
2003
+ [`vuecal--${F.id}-view`]: !0,
2004
+ "vuecal--view-has-time": Y.value,
2005
+ "vuecal--timeless": !f.time,
2006
+ "vuecal--dragging-cell": m.isDraggingCell,
2007
+ "vuecal--dragging-event": m.isDraggingEvent,
2008
+ "vuecal--resizing-event": m.isResizingEvent,
2009
+ "vuecal--has-schedules": (e = f.schedules) == null ? void 0 : e.length
1983
2010
  };
1984
- }), o = $(() => ({
1985
- "--vuecal-time-cell-height": m.timeCellHeight && `${m.timeCellHeight}px`
1986
- })), c = $(() => {
1987
- var e, d;
2011
+ }), t = M(() => ({
2012
+ "--vuecal-time-cell-height": f.timeCellHeight && `${f.timeCellHeight}px`
2013
+ })), o = M(() => {
2014
+ var e, h;
1988
2015
  return {
1989
- "vuecal__scrollable--row": T.value || m.weekNumbers && j.isMonth,
2016
+ "vuecal__scrollable--row": Y.value || f.weekNumbers && F.isMonth,
1990
2017
  // Keep the states inside the Vue transition wrapper for smooth CSS transitions.
1991
- [`vuecal__scrollable--${j.id}-view`]: !0,
1992
- "vuecal__scrollable--has-schedules": (e = m.schedules) == null ? void 0 : e.length,
1993
- "vuecal__scrollable--no-schedules": !((d = m.schedules) != null && d.length)
2018
+ [`vuecal__scrollable--${F.id}-view`]: !0,
2019
+ "vuecal__scrollable--has-schedules": (e = f.schedules) == null ? void 0 : e.length,
2020
+ "vuecal__scrollable--no-schedules": !((h = f.schedules) != null && h.length)
1994
2021
  };
1995
2022
  });
1996
2023
  return qe(async () => {
1997
- await Ue(), m.ready = !0, p("ready", { config: m, view: j });
1998
- }), Tt("vuecal", H), n({ view: H.view }), (e, d) => (S(), O("div", {
1999
- class: De(["vuecal", R.value]),
2024
+ await Ue(), f.ready = !0, w("ready", { config: f, view: F });
2025
+ }), $t("vuecal", H), s({ view: H.view }), (e, h) => (C(), j("div", {
2026
+ class: ye(["vuecal", q.value]),
2000
2027
  ref: "vuecal-el",
2001
2028
  "data-locale": e.locale,
2002
- style: ke(o.value)
2029
+ style: _e(t.value)
2003
2030
  }, [
2004
- e.$slots.diy ? N(e.$slots, "diy", {
2031
+ e.$slots.diy ? P(e.$slots, "diy", {
2005
2032
  key: 0,
2006
2033
  vuecal: V(H)
2007
- }) : (S(), O(ne, { key: 1 }, [
2034
+ }) : (C(), j(re, { key: 1 }, [
2008
2035
  Oe(At, null, je({ _: 2 }, [
2009
2036
  e.$slots.header ? {
2010
2037
  name: "header",
2011
- fn: q((g) => [
2012
- N(e.$slots, "header", se(le(g)))
2038
+ fn: J((c) => [
2039
+ P(e.$slots, "header", ee(ae(c)))
2013
2040
  ]),
2014
2041
  key: "0"
2015
2042
  } : void 0,
2016
2043
  !e.$slots.header && e.$slots["previous-button"] ? {
2017
2044
  name: "previous-button",
2018
- fn: q((g) => [
2019
- N(e.$slots, "previous-button", se(le(g)))
2045
+ fn: J((c) => [
2046
+ P(e.$slots, "previous-button", ee(ae(c)))
2020
2047
  ]),
2021
2048
  key: "1"
2022
2049
  } : void 0,
2023
2050
  !e.$slots.header && e.$slots["next-button"] ? {
2024
2051
  name: "next-button",
2025
- fn: q((g) => [
2026
- N(e.$slots, "next-button", se(le(g)))
2052
+ fn: J((c) => [
2053
+ P(e.$slots, "next-button", ee(ae(c)))
2027
2054
  ]),
2028
2055
  key: "2"
2029
2056
  } : void 0,
2030
2057
  !e.$slots.header && e.$slots["today-button"] ? {
2031
2058
  name: "today-button",
2032
- fn: q((g) => [
2033
- N(e.$slots, "today-button", se(le(g)))
2059
+ fn: J((c) => [
2060
+ P(e.$slots, "today-button", ee(ae(c)))
2034
2061
  ]),
2035
2062
  key: "3"
2036
2063
  } : void 0,
2037
2064
  !e.$slots.header && e.$slots.title ? {
2038
2065
  name: "title",
2039
- fn: q((g) => [
2040
- N(e.$slots, "title", se(le(g)))
2066
+ fn: J((c) => [
2067
+ P(e.$slots, "title", ee(ae(c)))
2041
2068
  ]),
2042
2069
  key: "4"
2043
2070
  } : void 0,
2071
+ !e.$slots.header && e.$slots["title.day"] ? {
2072
+ name: "title.day",
2073
+ fn: J((c) => [
2074
+ P(e.$slots, "title.day", ee(ae(c)))
2075
+ ]),
2076
+ key: "5"
2077
+ } : void 0,
2078
+ !e.$slots.header && e.$slots["title.days"] ? {
2079
+ name: "title.days",
2080
+ fn: J((c) => [
2081
+ P(e.$slots, "title.days", ee(ae(c)))
2082
+ ]),
2083
+ key: "6"
2084
+ } : void 0,
2085
+ !e.$slots.header && e.$slots["title.week"] ? {
2086
+ name: "title.week",
2087
+ fn: J((c) => [
2088
+ P(e.$slots, "title.week", ee(ae(c)))
2089
+ ]),
2090
+ key: "7"
2091
+ } : void 0,
2092
+ !e.$slots.header && e.$slots["title.month"] ? {
2093
+ name: "title.month",
2094
+ fn: J((c) => [
2095
+ P(e.$slots, "title.month", ee(ae(c)))
2096
+ ]),
2097
+ key: "8"
2098
+ } : void 0,
2099
+ !e.$slots.header && e.$slots["title.year"] ? {
2100
+ name: "title.year",
2101
+ fn: J((c) => [
2102
+ P(e.$slots, "title.year", ee(ae(c)))
2103
+ ]),
2104
+ key: "9"
2105
+ } : void 0,
2106
+ !e.$slots.header && e.$slots["title.years"] ? {
2107
+ name: "title.years",
2108
+ fn: J((c) => [
2109
+ P(e.$slots, "title.years", ee(ae(c)))
2110
+ ]),
2111
+ key: "10"
2112
+ } : void 0,
2044
2113
  !e.$slots.header && e.$slots["schedule-heading"] ? {
2045
2114
  name: "schedule-heading",
2046
- fn: q((g) => [
2047
- N(e.$slots, "schedule-heading", se(le(g)))
2115
+ fn: J((c) => [
2116
+ P(e.$slots, "schedule-heading", ee(ae(c)))
2048
2117
  ]),
2049
- key: "5"
2118
+ key: "11"
2050
2119
  } : void 0
2051
2120
  ]), 1024),
2052
2121
  ge("div", ha, [
2053
2122
  Oe(Ge, {
2054
- name: `vuecal-slide-fade--${V(j).transitionDirection}`
2123
+ name: `vuecal-slide-fade--${V(F).transitionDirection}`
2055
2124
  }, {
2056
- default: q(() => [
2057
- (S(), O("div", {
2058
- class: De(["vuecal__scrollable", c.value]),
2059
- key: V(j).id + V(j).start.getTime()
2125
+ default: J(() => [
2126
+ (C(), j("div", {
2127
+ class: ye(["vuecal__scrollable", o.value]),
2128
+ key: V(F).id + V(F).start.getTime()
2060
2129
  }, [
2061
- T.value ? (S(), Se(Kt, { key: 0 }, je({ _: 2 }, [
2130
+ Y.value ? (C(), Se(Kt, { key: 0 }, je({ _: 2 }, [
2062
2131
  e.$slots["time-cell"] ? {
2063
2132
  name: "time-cell",
2064
- fn: q((g) => [
2065
- N(e.$slots, "time-cell", se(le(g)))
2133
+ fn: J((c) => [
2134
+ P(e.$slots, "time-cell", ee(ae(c)))
2066
2135
  ]),
2067
2136
  key: "0"
2068
2137
  } : void 0
2069
- ]), 1024)) : U("", !0),
2070
- V(m).weekNumbers && V(j).isMonth ? (S(), O("div", ya, [
2071
- (S(!0), O(ne, null, be(W.value, (g) => (S(), O("div", Da, [
2072
- N(e.$slots, "week-number", {}, () => [
2073
- ge("small", null, re(g), 1)
2138
+ ]), 1024)) : K("", !0),
2139
+ V(f).weekNumbers && V(F).isMonth ? (C(), j("div", ya, [
2140
+ (C(!0), j(re, null, ke(W.value, (c) => (C(), j("div", Da, [
2141
+ P(e.$slots, "week-number", {}, () => [
2142
+ ge("small", null, ie(c), 1)
2074
2143
  ])
2075
2144
  ]))), 256))
2076
- ])) : U("", !0),
2145
+ ])) : K("", !0),
2077
2146
  ge("div", pa, [
2078
2147
  Oe(qt, null, je({ _: 2 }, [
2079
2148
  e.$slots["weekday-heading"] ? {
2080
2149
  name: "weekday-heading",
2081
- fn: q((g) => [
2082
- N(e.$slots, "weekday-heading", se(le(g)))
2150
+ fn: J((c) => [
2151
+ P(e.$slots, "weekday-heading", ee(ae(c)))
2083
2152
  ]),
2084
2153
  key: "0"
2085
2154
  } : void 0,
2086
2155
  e.$slots["schedule-heading"] ? {
2087
2156
  name: "schedule-heading",
2088
- fn: q((g) => [
2089
- N(e.$slots, "schedule-heading", se(le(g)))
2157
+ fn: J((c) => [
2158
+ P(e.$slots, "schedule-heading", ee(ae(c)))
2090
2159
  ]),
2091
2160
  key: "1"
2092
2161
  } : void 0
@@ -2094,43 +2163,43 @@ const st = (D, n) => {
2094
2163
  Oe(fa, null, je({ _: 2 }, [
2095
2164
  e.$slots.cell ? {
2096
2165
  name: "cell",
2097
- fn: q((g) => [
2098
- N(e.$slots, "cell", se(le(g)))
2166
+ fn: J((c) => [
2167
+ P(e.$slots, "cell", ee(ae(c)))
2099
2168
  ]),
2100
2169
  key: "0"
2101
2170
  } : void 0,
2102
2171
  !e.$slots.cell && e.$slots["cell-date"] ? {
2103
2172
  name: "cell-date",
2104
- fn: q((g) => [
2105
- N(e.$slots, "cell-date", se(le(g)))
2173
+ fn: J((c) => [
2174
+ P(e.$slots, "cell-date", ee(ae(c)))
2106
2175
  ]),
2107
2176
  key: "1"
2108
2177
  } : void 0,
2109
2178
  !e.$slots.cell && e.$slots["cell-content"] ? {
2110
2179
  name: "cell-content",
2111
- fn: q((g) => [
2112
- N(e.$slots, "cell-content", se(le(g)))
2180
+ fn: J((c) => [
2181
+ P(e.$slots, "cell-content", ee(ae(c)))
2113
2182
  ]),
2114
2183
  key: "2"
2115
2184
  } : void 0,
2116
2185
  !e.$slots.cell && e.$slots["cell-events"] ? {
2117
2186
  name: "cell-events",
2118
- fn: q((g) => [
2119
- N(e.$slots, "cell-events", se(le(g)))
2187
+ fn: J((c) => [
2188
+ P(e.$slots, "cell-events", ee(ae(c)))
2120
2189
  ]),
2121
2190
  key: "3"
2122
2191
  } : void 0,
2123
2192
  !e.$slots.cell && e.$slots.event ? {
2124
2193
  name: "event",
2125
- fn: q((g) => [
2126
- N(e.$slots, "event", se(le(g)))
2194
+ fn: J((c) => [
2195
+ P(e.$slots, "event", ee(ae(c)))
2127
2196
  ]),
2128
2197
  key: "4"
2129
2198
  } : void 0,
2130
2199
  !e.$slots.cell && e.$slots["event-count"] ? {
2131
2200
  name: "event-count",
2132
- fn: q((g) => [
2133
- N(e.$slots, "event-count", se(le(g)))
2201
+ fn: J((c) => [
2202
+ P(e.$slots, "event-count", ee(ae(c)))
2134
2203
  ]),
2135
2204
  key: "5"
2136
2205
  } : void 0
@@ -2144,12 +2213,12 @@ const st = (D, n) => {
2144
2213
  ], 64))
2145
2214
  ], 14, ga));
2146
2215
  }
2147
- }, ka = (D) => {
2148
- ze.texts = { ...fe.texts, ...D }, ze.dateUtils.updateTexts(ze.texts);
2216
+ }, ka = (y) => {
2217
+ ze.texts = { ...fe.texts, ...y }, ze.dateUtils.updateTexts(ze.texts);
2149
2218
  }, {
2150
2219
  addDatePrototypes: ba,
2151
- removeDatePrototypes: Ta,
2152
- updateTexts: $a,
2220
+ removeDatePrototypes: $a,
2221
+ updateTexts: Ta,
2153
2222
  addDays: Ma,
2154
2223
  subtractDays: Ya,
2155
2224
  addHours: Ea,
@@ -2158,16 +2227,16 @@ const st = (D, n) => {
2158
2227
  subtractMinutes: Va,
2159
2228
  getWeek: Oa,
2160
2229
  isToday: ja,
2161
- isSameDate: Pa,
2162
- isInRange: Fa,
2230
+ isSameDate: Fa,
2231
+ isInRange: Pa,
2163
2232
  isLeapYear: La,
2164
2233
  getPreviousFirstDayOfWeek: Ha,
2165
2234
  stringToDate: za,
2166
2235
  dateToMinutes: Na,
2167
2236
  countDays: Wa,
2168
2237
  datesInSameTimeStep: Aa,
2169
- isValid: Ba,
2170
- formatDate: Ia,
2238
+ isValid: Ia,
2239
+ formatDate: Ba,
2171
2240
  formatDateLite: Ra,
2172
2241
  formatTime: Xa,
2173
2242
  formatTimeLite: Ga,
@@ -2182,23 +2251,23 @@ export {
2182
2251
  Wa as countDays,
2183
2252
  Na as dateToMinutes,
2184
2253
  Aa as datesInSameTimeStep,
2185
- Ia as formatDate,
2254
+ Ba as formatDate,
2186
2255
  Ra as formatDateLite,
2187
2256
  Ja as formatMinutes,
2188
2257
  Xa as formatTime,
2189
2258
  Ga as formatTimeLite,
2190
2259
  Ha as getPreviousFirstDayOfWeek,
2191
2260
  Oa as getWeek,
2192
- Fa as isInRange,
2261
+ Pa as isInRange,
2193
2262
  La as isLeapYear,
2194
- Pa as isSameDate,
2263
+ Fa as isSameDate,
2195
2264
  ja as isToday,
2196
- Ba as isValidDate,
2197
- Ta as removeDatePrototypes,
2265
+ Ia as isValidDate,
2266
+ $a as removeDatePrototypes,
2198
2267
  za as stringToDate,
2199
2268
  Ya as subtractDays,
2200
2269
  Sa as subtractHours,
2201
2270
  Va as subtractMinutes,
2202
- $a as updateTexts,
2271
+ Ta as updateTexts,
2203
2272
  ka as useLocale
2204
2273
  };