vue-cal 5.0.1-rc.7 → 5.0.1-rc.8

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