vue-cal 5.0.1-rc.0 → 5.0.1-rc.2

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