vue-cal 5.0.1-rc.3 → 5.0.1-rc.31

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