vue-cal 5.0.1-rc.1 → 5.0.1-rc.11

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