calkit 0.1.0 → 0.2.0

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.
package/dist/calkit.es.js CHANGED
@@ -1,4 +1,4 @@
1
- class Se extends HTMLElement {
1
+ class Me extends HTMLElement {
2
2
  constructor() {
3
3
  super(), this.attachShadow({ mode: "open" }), this._initialized = !1;
4
4
  }
@@ -27,6 +27,9 @@ class Se extends HTMLElement {
27
27
  /** Subclasses override to update Shadow DOM. */
28
28
  render() {
29
29
  }
30
+ /** Reset selection state. Subclasses should override with specific logic. */
31
+ clear() {
32
+ }
30
33
  /** Dispatch a composed, bubbling custom event. */
31
34
  emit(e, a = {}) {
32
35
  this.dispatchEvent(
@@ -51,7 +54,7 @@ class Se extends HTMLElement {
51
54
  return this.shadowRoot.querySelectorAll(e);
52
55
  }
53
56
  }
54
- function Te(n) {
57
+ function Ae(n) {
55
58
  let e = { ...n };
56
59
  const a = /* @__PURE__ */ new Set();
57
60
  return {
@@ -78,7 +81,7 @@ function Te(n) {
78
81
  }
79
82
  };
80
83
  }
81
- const ne = [
84
+ const Ce = [
82
85
  "January",
83
86
  "February",
84
87
  "March",
@@ -91,21 +94,82 @@ const ne = [
91
94
  "October",
92
95
  "November",
93
96
  "December"
94
- ], bt = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], _t = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], yt = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
95
- function Qe(n, e = "short") {
96
- const a = G(n);
97
- return a ? e === "long" ? _t[a.getDay()] : yt[a.getDay()] : "";
97
+ ], wt = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Et = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Lt = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
98
+ function st(n) {
99
+ if (!n) return Ce;
100
+ try {
101
+ const e = new Intl.DateTimeFormat(n, { month: "long" });
102
+ return Array.from({ length: 12 }, (a, t) => {
103
+ const s = e.format(new Date(2024, t, 1));
104
+ return s.charAt(0).toUpperCase() + s.slice(1);
105
+ });
106
+ } catch {
107
+ return Ce;
108
+ }
98
109
  }
99
- function et(n = 0) {
100
- const e = [];
101
- for (let a = 0; a < 7; a++)
102
- e.push(bt[(n + a) % 7]);
103
- return e;
110
+ function Re(n) {
111
+ if (!n)
112
+ return [
113
+ "Jan",
114
+ "Feb",
115
+ "Mar",
116
+ "Apr",
117
+ "May",
118
+ "Jun",
119
+ "Jul",
120
+ "Aug",
121
+ "Sep",
122
+ "Oct",
123
+ "Nov",
124
+ "Dec"
125
+ ];
126
+ try {
127
+ const e = new Intl.DateTimeFormat(n, { month: "short" });
128
+ return Array.from({ length: 12 }, (a, t) => {
129
+ const s = e.format(new Date(2024, t, 1));
130
+ return s.charAt(0).toUpperCase() + s.slice(1);
131
+ });
132
+ } catch {
133
+ return [
134
+ "Jan",
135
+ "Feb",
136
+ "Mar",
137
+ "Apr",
138
+ "May",
139
+ "Jun",
140
+ "Jul",
141
+ "Aug",
142
+ "Sep",
143
+ "Oct",
144
+ "Nov",
145
+ "Dec"
146
+ ];
147
+ }
148
+ }
149
+ function nt(n, e = "short", a) {
150
+ const t = U(n);
151
+ return t ? e === "long" ? Et[t.getDay()] : Lt[t.getDay()] : "";
152
+ }
153
+ function it(n = 0, e) {
154
+ if (e)
155
+ try {
156
+ const t = new Intl.DateTimeFormat(e, { weekday: "short" }), s = [];
157
+ for (let i = 0; i < 7; i++) {
158
+ const l = new Date(2024, 0, 7 + (n + i) % 7), r = t.format(l);
159
+ s.push(r.charAt(0).toUpperCase() + r.slice(1));
160
+ }
161
+ return s;
162
+ } catch {
163
+ }
164
+ const a = [];
165
+ for (let t = 0; t < 7; t++)
166
+ a.push(wt[(n + t) % 7]);
167
+ return a;
104
168
  }
105
- function Xe(n, e) {
169
+ function Ue(n, e) {
106
170
  return new Date(n, e + 1, 0).getDate();
107
171
  }
108
- function xt(n, e) {
172
+ function Ct(n, e) {
109
173
  return new Date(n, e, 1).getDay();
110
174
  }
111
175
  function Z(n) {
@@ -113,7 +177,7 @@ function Z(n) {
113
177
  const e = n instanceof Date ? n : new Date(n.year, n.month, n.day), a = e.getFullYear(), t = String(e.getMonth() + 1).padStart(2, "0"), s = String(e.getDate()).padStart(2, "0");
114
178
  return `${a}-${t}-${s}`;
115
179
  }
116
- function G(n) {
180
+ function U(n) {
117
181
  if (!n) return null;
118
182
  if (n instanceof Date) return n;
119
183
  if (typeof n == "string") {
@@ -124,12 +188,12 @@ function G(n) {
124
188
  }
125
189
  function de(n, e) {
126
190
  if (!n || !e) return !1;
127
- const a = G(n), t = G(e);
191
+ const a = U(n), t = U(e);
128
192
  return !a || !t ? !1 : a.getFullYear() === t.getFullYear() && a.getMonth() === t.getMonth() && a.getDate() === t.getDate();
129
193
  }
130
- function kt(n, e, a) {
194
+ function Dt(n, e, a) {
131
195
  if (!n || !e || !a) return !1;
132
- const t = G(n), s = G(e), i = G(a);
196
+ const t = U(n), s = U(e), i = U(a);
133
197
  if (!t || !s || !i) return !1;
134
198
  const l = t.getTime(), r = Math.min(s.getTime(), i.getTime()), o = Math.max(s.getTime(), i.getTime());
135
199
  return l >= r && l <= o;
@@ -142,28 +206,28 @@ function ge(n, e, a) {
142
206
  return { year: t.getFullYear(), month: t.getMonth() };
143
207
  }
144
208
  function ye(n, e) {
145
- const a = G(n);
209
+ const a = U(n);
146
210
  return a ? (a.setDate(a.getDate() + e), Z(a)) : n;
147
211
  }
148
- function tt(n, e, a = 0) {
149
- const t = Xe(n, e), i = (xt(n, e) - a + 7) % 7, l = [], r = me(), o = ge(n, e, -1), h = Xe(o.year, o.month);
150
- for (let g = i - 1; g >= 0; g--) {
151
- const u = h - g, p = Z({ year: o.year, month: o.month, day: u });
152
- l.push({ year: o.year, month: o.month, day: u, dateString: p, isCurrentMonth: !1, isToday: p === r });
212
+ function lt(n, e, a = 0) {
213
+ const t = Ue(n, e), i = (Ct(n, e) - a + 7) % 7, l = [], r = me(), o = ge(n, e, -1), h = Ue(o.year, o.month);
214
+ for (let p = i - 1; p >= 0; p--) {
215
+ const u = h - p, g = Z({ year: o.year, month: o.month, day: u });
216
+ l.push({ year: o.year, month: o.month, day: u, dateString: g, isCurrentMonth: !1, isToday: g === r });
153
217
  }
154
- for (let g = 1; g <= t; g++) {
155
- const u = Z({ year: n, month: e, day: g });
156
- l.push({ year: n, month: e, day: g, dateString: u, isCurrentMonth: !0, isToday: u === r });
218
+ for (let p = 1; p <= t; p++) {
219
+ const u = Z({ year: n, month: e, day: p });
220
+ l.push({ year: n, month: e, day: p, dateString: u, isCurrentMonth: !0, isToday: u === r });
157
221
  }
158
222
  const c = ge(n, e, 1);
159
223
  let d = 1;
160
224
  for (; l.length < 42; ) {
161
- const g = Z({ year: c.year, month: c.month, day: d });
162
- l.push({ year: c.year, month: c.month, day: d, dateString: g, isCurrentMonth: !1, isToday: g === r }), d++;
225
+ const p = Z({ year: c.year, month: c.month, day: d });
226
+ l.push({ year: c.year, month: c.month, day: d, dateString: p, isCurrentMonth: !1, isToday: p === r }), d++;
163
227
  }
164
228
  return l;
165
229
  }
166
- const Me = `
230
+ const $e = `
167
231
  :host {
168
232
  /* Light theme (default) */
169
233
  --cal-bg: 0 0% 100%;
@@ -331,7 +395,7 @@ const Me = `
331
395
  --cal-status-success-border: 152 40% 28%;
332
396
  }
333
397
  }
334
- `, Ae = `
398
+ `, ze = `
335
399
  :host {
336
400
  display: inline-block;
337
401
  font-family: inherit;
@@ -372,7 +436,7 @@ const Me = `
372
436
  [hidden] {
373
437
  display: none !important;
374
438
  }
375
- `, $e = `
439
+ `, Ie = `
376
440
  @keyframes cal-fade-in {
377
441
  from { opacity: 0; }
378
442
  to { opacity: 1; }
@@ -436,30 +500,41 @@ const Me = `
436
500
  .cal-skeleton--rect {
437
501
  border-radius: var(--cal-radius-sm);
438
502
  }
439
- `, Ge = {
503
+ `, Je = {
440
504
  blue: { bg: "var(--cal-booking-blue-bg)", fg: "var(--cal-booking-blue-fg)", hover: "var(--cal-booking-blue-hover)" },
441
505
  green: { bg: "var(--cal-booking-green-bg)", fg: "var(--cal-booking-green-fg)", hover: "var(--cal-booking-green-hover)" },
442
506
  red: { bg: "var(--cal-booking-red-bg)", fg: "var(--cal-booking-red-fg)", hover: "var(--cal-booking-red-hover)" },
443
507
  orange: { bg: "var(--cal-booking-orange-bg)", fg: "var(--cal-booking-orange-fg)", hover: "var(--cal-booking-orange-hover)" },
444
508
  gray: { bg: "var(--cal-booking-gray-bg)", fg: "var(--cal-booking-gray-fg)", hover: "var(--cal-booking-gray-hover)" }
445
509
  }, _e = "blue";
446
- function xe(n) {
447
- return Ge[n] || Ge[_e];
510
+ function xe(n, e) {
511
+ return e && e[n] ? e[n] : Je[n] || Je[_e];
512
+ }
513
+ function rt(n) {
514
+ if (!Array.isArray(n) || !n.length) return null;
515
+ const e = {};
516
+ for (const a of n)
517
+ !a.name || !a.bg || !a.fg || (e[a.name] = {
518
+ bg: a.bg,
519
+ fg: a.fg,
520
+ hover: a.hover || a.bg
521
+ });
522
+ return Object.keys(e).length ? e : null;
448
523
  }
449
- function wt(n, e = [], a = {}, t = null) {
450
- const s = e.find((p) => p.end === n), i = e.find((p) => p.start === n), l = e.find(
451
- (p) => p.start < n && p.end > n
524
+ function Tt(n, e = [], a = {}, t = null, s = null) {
525
+ const i = e.find((f) => f.end === n), l = e.find((f) => f.start === n), r = e.find(
526
+ (f) => f.start < n && f.end > n
452
527
  );
453
- let r = "available", o = null, h = !1, c = null, d = null, g = null;
454
- s && i ? (r = "half-day", h = !0, c = xe(s.color || _e), d = xe(i.color || _e)) : l ? (r = "booked", g = xe(l.color || _e)) : i && !s ? (r = "checkin-only", d = xe(i.color || _e)) : s && !i && (r = "checkout-only", c = xe(s.color || _e));
455
- const u = a[n];
456
- if (u && (u.status && (r = u.status), u.label !== void 0 && (o = u.label)), t) {
457
- const p = t(n);
458
- p && (p.status && (r = p.status), p.label !== void 0 && (o = p.label));
459
- }
460
- return { status: r, label: o, checkoutBooking: s, checkinBooking: i, halfDay: h, colorOut: c, colorIn: d, colorFull: g };
528
+ let o = "available", h = null, c = !1, d = null, p = null, u = null;
529
+ i && l ? (o = "half-day", c = !0, d = xe(i.color || _e, s), p = xe(l.color || _e, s)) : r ? (o = "booked", u = xe(r.color || _e, s)) : l && !i ? (o = "checkin-only", p = xe(l.color || _e, s)) : i && !l && (o = "checkout-only", d = xe(i.color || _e, s));
530
+ const g = a[n];
531
+ if (g && (g.status && (o = g.status), g.label !== void 0 && (h = g.label)), t) {
532
+ const f = t(n);
533
+ f && (f.status && (o = f.status), f.label !== void 0 && (h = f.label));
534
+ }
535
+ return { status: o, label: h, checkoutBooking: i, checkinBooking: l, halfDay: c, colorOut: d, colorIn: p, colorFull: u };
461
536
  }
462
- function at(n, e, a = []) {
537
+ function ot(n, e, a = []) {
463
538
  if (!n || !e) return !0;
464
539
  const t = n < e ? n : e, s = n < e ? e : n;
465
540
  for (const i of a)
@@ -467,10 +542,10 @@ function at(n, e, a = []) {
467
542
  return !1;
468
543
  return !0;
469
544
  }
470
- function Et(n, e, a = []) {
471
- return !n || !e ? !1 : !at(n, e, a);
545
+ function St(n, e, a = []) {
546
+ return !n || !e ? !1 : !ot(n, e, a);
472
547
  }
473
- function st(n) {
548
+ function ct(n) {
474
549
  const {
475
550
  year: e,
476
551
  month: a,
@@ -483,77 +558,79 @@ function st(n) {
483
558
  maxDate: h,
484
559
  disabledDates: c = [],
485
560
  mode: d = "single",
486
- focusedDate: g,
561
+ focusedDate: p,
487
562
  onSelect: u,
488
- onHover: p,
563
+ onHover: g,
489
564
  // Booking-specific params
490
- bookings: _ = null,
565
+ bookings: f = null,
491
566
  dayData: m = null,
492
- labelFormula: v = null,
493
- showLabelsOnHover: C = !1
494
- } = n, k = _ !== null, S = document.createElement("div");
495
- S.setAttribute("role", "grid"), S.classList.add("cal-grid");
567
+ labelFormula: b = null,
568
+ showLabelsOnHover: y = !1,
569
+ locale: w,
570
+ customColors: A = null
571
+ } = n, I = f !== null, q = document.createElement("div");
572
+ q.setAttribute("role", "grid"), q.classList.add("cal-grid");
496
573
  const B = document.createElement("div");
497
574
  B.setAttribute("role", "row"), B.classList.add("cal-weekdays");
498
- for (const M of et(t)) {
499
- const x = document.createElement("div");
500
- x.setAttribute("role", "columnheader"), x.setAttribute("aria-label", M), x.classList.add("cal-weekday"), x.textContent = M, B.appendChild(x);
501
- }
502
- S.appendChild(B);
503
- const V = tt(e, a, t), O = d === "range" && i && !l && r || k && i && !l && r ? r : l, N = k ? Et(i, r, _) : !1;
504
- let I;
505
- return V.forEach((M, x) => {
506
- x % 7 === 0 && (I = document.createElement("div"), I.setAttribute("role", "row"), I.classList.add("cal-row"), S.appendChild(I));
507
- const f = document.createElement("button");
508
- f.setAttribute("role", "gridcell"), f.setAttribute("part", "day"), f.classList.add("cal-day");
509
- const F = M.dateString;
510
- f.dataset.date = F;
511
- const R = new Date(M.year, M.month, M.day);
512
- f.setAttribute("aria-label", R.toLocaleDateString("en-US", {
575
+ for (const L of it(t, w)) {
576
+ const W = document.createElement("div");
577
+ W.setAttribute("role", "columnheader"), W.setAttribute("aria-label", L), W.classList.add("cal-weekday"), W.textContent = L, B.appendChild(W);
578
+ }
579
+ q.appendChild(B);
580
+ const j = lt(e, a, t), H = d === "range" && i && !l && r || I && i && !l && r ? r : l, F = I ? St(i, r, f) : !1;
581
+ let k;
582
+ return j.forEach((L, W) => {
583
+ W % 7 === 0 && (k = document.createElement("div"), k.setAttribute("role", "row"), k.classList.add("cal-row"), q.appendChild(k));
584
+ const v = document.createElement("button");
585
+ v.setAttribute("role", "gridcell"), v.setAttribute("part", "day"), v.classList.add("cal-day");
586
+ const C = L.dateString;
587
+ v.dataset.date = C;
588
+ const x = new Date(L.year, L.month, L.day);
589
+ v.setAttribute("aria-label", x.toLocaleDateString("en-US", {
513
590
  weekday: "long",
514
591
  year: "numeric",
515
592
  month: "long",
516
593
  day: "numeric"
517
- })), M.isCurrentMonth || f.classList.add("cal-day--outside"), M.isToday && f.classList.add("cal-day--today");
518
- let L = null, y = !1;
519
- if (k) {
520
- L = wt(F, _, m || {}, v);
521
- const { status: E, label: Y, halfDay: W, colorOut: $, colorIn: T, colorFull: z } = L;
522
- if (E === "booked" && (f.classList.add("cal-day--booked"), z && (f.style.setProperty("--booking-bg", `hsl(${z.bg})`), f.style.setProperty("--booking-fg", `hsl(${z.fg})`), f.style.setProperty("--booking-hover", `hsl(${z.hover})`)), y = !0), E === "blocked" && (f.classList.add("cal-day--blocked"), y = !0), W && (f.classList.add("cal-day--half-day"), $ && f.style.setProperty("--half-day-color-out", `hsl(${$.bg})`), T && f.style.setProperty("--half-day-color-in", `hsl(${T.bg})`), y = !0), E === "checkout-only" && (f.classList.add("cal-day--checkout-only"), $ && f.style.setProperty("--half-day-color-out", `hsl(${$.bg})`)), E === "checkin-only" && (f.classList.add("cal-day--checkin-only"), T && f.style.setProperty("--half-day-color-in", `hsl(${T.bg})`)), C) {
523
- let q = null;
524
- if (W && L.checkoutBooking && L.checkinBooking)
525
- q = `${L.checkoutBooking.label || ""} / ${L.checkinBooking.label || ""}`;
526
- else if (E === "booked") {
527
- const Q = _.find((be) => be.start <= F && be.end > F);
528
- Q && (q = Q.label);
529
- } else E === "checkout-only" && L.checkoutBooking ? q = L.checkoutBooking.label : E === "checkin-only" && L.checkinBooking && (q = L.checkinBooking.label);
530
- q && f.setAttribute("data-booking-label", q);
594
+ })), L.isCurrentMonth || v.classList.add("cal-day--outside"), L.isToday && v.classList.add("cal-day--today");
595
+ let T = null, X = !1;
596
+ if (I) {
597
+ T = Tt(C, f, m || {}, b, A);
598
+ const { status: O, label: S, halfDay: M, colorOut: z, colorIn: G, colorFull: Q } = T;
599
+ if (O === "booked" && (v.classList.add("cal-day--booked"), Q && (v.style.setProperty("--booking-bg", `hsl(${Q.bg})`), v.style.setProperty("--booking-fg", `hsl(${Q.fg})`), v.style.setProperty("--booking-hover", `hsl(${Q.hover})`)), X = !0), O === "blocked" && (v.classList.add("cal-day--blocked"), X = !0), M && (v.classList.add("cal-day--half-day"), z && v.style.setProperty("--half-day-color-out", `hsl(${z.bg})`), G && v.style.setProperty("--half-day-color-in", `hsl(${G.bg})`), X = !0), O === "checkout-only" && (v.classList.add("cal-day--checkout-only"), z && v.style.setProperty("--half-day-color-out", `hsl(${z.bg})`)), O === "checkin-only" && (v.classList.add("cal-day--checkin-only"), G && v.style.setProperty("--half-day-color-in", `hsl(${G.bg})`)), y) {
600
+ let ne = null;
601
+ if (M && T.checkoutBooking && T.checkinBooking)
602
+ ne = `${T.checkoutBooking.label || ""} / ${T.checkinBooking.label || ""}`;
603
+ else if (O === "booked") {
604
+ const ve = f.find((E) => E.start <= C && E.end > C);
605
+ ve && (ne = ve.label);
606
+ } else O === "checkout-only" && T.checkoutBooking ? ne = T.checkoutBooking.label : O === "checkin-only" && T.checkinBooking && (ne = T.checkinBooking.label);
607
+ ne && v.setAttribute("data-booking-label", ne);
531
608
  }
532
- if (N && i && !l && r) {
533
- const q = i < r ? i : r, Q = i < r ? r : i;
534
- F >= q && F <= Q && f.classList.add("cal-day--invalid-range");
609
+ if (F && i && !l && r) {
610
+ const ne = i < r ? i : r, ve = i < r ? r : i;
611
+ C >= ne && C <= ve && v.classList.add("cal-day--invalid-range");
535
612
  }
536
613
  }
537
- if (k ? i && l && (de(F, i) || de(F, l)) ? (f.classList.add("cal-day--selected"), f.setAttribute("aria-selected", "true")) : f.setAttribute("aria-selected", "false") : s.some((Y) => de(Y, F)) ? (f.classList.add("cal-day--selected"), f.setAttribute("aria-selected", "true")) : f.setAttribute("aria-selected", "false"), (d === "range" || k) && i && O) {
538
- const E = de(F, i), Y = de(F, O), W = kt(F, i, O);
539
- E && f.classList.add("cal-day--range-start"), Y && f.classList.add("cal-day--range-end"), W && !E && !Y && f.classList.add("cal-day--in-range");
614
+ if (I ? i && l && (de(C, i) || de(C, l)) ? (v.classList.add("cal-day--selected"), v.setAttribute("aria-selected", "true")) : v.setAttribute("aria-selected", "false") : s.some((S) => de(S, C)) ? (v.classList.add("cal-day--selected"), v.setAttribute("aria-selected", "true")) : v.setAttribute("aria-selected", "false"), (d === "range" || I) && i && H) {
615
+ const O = de(C, i), S = de(C, H), M = Dt(C, i, H);
616
+ O && v.classList.add("cal-day--range-start"), S && v.classList.add("cal-day--range-end"), M && !O && !S && v.classList.add("cal-day--in-range");
540
617
  }
541
- const K = Lt(F, o, h, c) || y;
542
- if (K && (f.classList.add("cal-day--disabled"), f.disabled = !0, f.setAttribute("aria-disabled", "true")), g && de(F, g) ? f.setAttribute("tabindex", "0") : f.setAttribute("tabindex", "-1"), k && L && L.label != null) {
543
- f.classList.add("cal-day--with-label");
544
- const E = document.createElement("span");
545
- E.classList.add("cal-day__number"), E.textContent = M.day, f.appendChild(E);
546
- const Y = document.createElement("span");
547
- Y.classList.add("cal-day__label"), Y.textContent = L.label, f.appendChild(Y);
618
+ const R = Mt(C, o, h, c) || X;
619
+ if (R && (v.classList.add("cal-day--disabled"), v.disabled = !0, v.setAttribute("aria-disabled", "true")), p && de(C, p) ? v.setAttribute("tabindex", "0") : v.setAttribute("tabindex", "-1"), I && T && T.label != null) {
620
+ v.classList.add("cal-day--with-label");
621
+ const O = document.createElement("span");
622
+ O.classList.add("cal-day__number"), O.textContent = L.day, v.appendChild(O);
623
+ const S = document.createElement("span");
624
+ S.classList.add("cal-day__label"), S.textContent = T.label, v.appendChild(S);
548
625
  } else
549
- f.textContent = M.day;
550
- K ? k && f.addEventListener("mouseenter", () => p == null ? void 0 : p(F)) : (f.addEventListener("click", () => u == null ? void 0 : u(F)), f.addEventListener("mouseenter", () => p == null ? void 0 : p(F))), I.appendChild(f);
551
- }), S.addEventListener("mouseleave", () => p == null ? void 0 : p(null)), S;
626
+ v.textContent = L.day;
627
+ R ? I && v.addEventListener("mouseenter", () => g == null ? void 0 : g(C)) : (v.addEventListener("click", () => u == null ? void 0 : u(C)), v.addEventListener("mouseenter", () => g == null ? void 0 : g(C))), k.appendChild(v);
628
+ }), q.addEventListener("mouseleave", () => g == null ? void 0 : g(null)), q;
552
629
  }
553
- function Lt(n, e, a, t) {
630
+ function Mt(n, e, a, t) {
554
631
  return !!(t.includes(n) || e && n < e || a && n > a);
555
632
  }
556
- const nt = `
633
+ const dt = `
557
634
  .cal-grid {
558
635
  display: flex;
559
636
  flex-direction: column;
@@ -811,18 +888,18 @@ const nt = `
811
888
  pointer-events: none;
812
889
  z-index: 10;
813
890
  }
814
- `, Oe = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12L6 8l4-4"/></svg>', Fe = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4l4 4-4 4"/></svg>';
815
- function Le({ year: n, month: e, onPrev: a, onNext: t, onTitleClick: s }) {
816
- const i = document.createElement("div");
817
- i.classList.add("cal-nav");
818
- const l = document.createElement("button");
819
- l.classList.add("cal-nav__btn", "cal-nav__btn--prev"), l.innerHTML = Oe, l.setAttribute("aria-label", "Previous month"), l.addEventListener("click", a);
820
- const r = s ? "button" : "div", o = document.createElement(r);
821
- o.classList.add("cal-nav__title"), s && (o.classList.add("cal-nav__title--interactive"), o.setAttribute("aria-label", `Select month and year, currently ${ne[e]} ${n}`), o.addEventListener("click", s)), o.setAttribute("aria-live", "polite"), o.textContent = `${ne[e]} ${n}`;
822
- const h = document.createElement("button");
823
- return h.classList.add("cal-nav__btn", "cal-nav__btn--next"), h.innerHTML = Fe, h.setAttribute("aria-label", "Next month"), h.addEventListener("click", t), i.appendChild(l), i.appendChild(o), i.appendChild(h), i;
891
+ `, je = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12L6 8l4-4"/></svg>', Ne = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4l4 4-4 4"/></svg>';
892
+ function De({ year: n, month: e, onPrev: a, onNext: t, onTitleClick: s, locale: i }) {
893
+ const l = document.createElement("div");
894
+ l.classList.add("cal-nav");
895
+ const r = document.createElement("button");
896
+ r.classList.add("cal-nav__btn", "cal-nav__btn--prev"), r.innerHTML = je, r.setAttribute("aria-label", "Previous month"), r.addEventListener("click", a);
897
+ const o = st(i), h = s ? "button" : "div", c = document.createElement(h);
898
+ c.classList.add("cal-nav__title"), s && (c.classList.add("cal-nav__title--interactive"), c.setAttribute("aria-label", `Select month and year, currently ${o[e]} ${n}`), c.addEventListener("click", s)), c.setAttribute("aria-live", "polite"), c.textContent = `${o[e]} ${n}`;
899
+ const d = document.createElement("button");
900
+ return d.classList.add("cal-nav__btn", "cal-nav__btn--next"), d.innerHTML = Ne, d.setAttribute("aria-label", "Next month"), d.addEventListener("click", t), l.appendChild(r), l.appendChild(c), l.appendChild(d), l;
824
901
  }
825
- const it = `
902
+ const ht = `
826
903
  .cal-nav {
827
904
  display: flex;
828
905
  align-items: center;
@@ -863,51 +940,39 @@ const it = `
863
940
  .cal-nav__title--interactive:hover {
864
941
  background: hsl(var(--cal-hover));
865
942
  }
866
- `, Ct = [
867
- "Jan",
868
- "Feb",
869
- "Mar",
870
- "Apr",
871
- "May",
872
- "Jun",
873
- "Jul",
874
- "Aug",
875
- "Sep",
876
- "Oct",
877
- "Nov",
878
- "Dec"
879
- ];
880
- function lt({
943
+ `;
944
+ function ut({
881
945
  pickerYear: n,
882
946
  viewMonth: e,
883
947
  viewYear: a,
884
948
  onMonthSelect: t,
885
949
  onYearPrev: s,
886
950
  onYearNext: i,
887
- onClose: l
951
+ onClose: l,
952
+ locale: r
888
953
  }) {
889
- const r = document.createElement("div");
890
- r.classList.add("cal-myp", "cal-animate-fade");
891
954
  const o = document.createElement("div");
892
- o.classList.add("cal-myp__year-nav");
893
- const h = document.createElement("button");
894
- h.classList.add("cal-nav__btn"), h.innerHTML = Oe, h.setAttribute("aria-label", "Previous year"), h.addEventListener("click", s);
895
- const c = document.createElement("div");
896
- c.classList.add("cal-myp__year-label"), c.textContent = n;
897
- const d = document.createElement("button");
898
- d.classList.add("cal-nav__btn"), d.innerHTML = Fe, d.setAttribute("aria-label", "Next year"), d.addEventListener("click", i), o.appendChild(h), o.appendChild(c), o.appendChild(d), r.appendChild(o);
899
- const g = document.createElement("div");
900
- g.classList.add("cal-myp__grid");
901
- const u = /* @__PURE__ */ new Date(), p = u.getMonth(), _ = u.getFullYear();
902
- for (let m = 0; m < 12; m++) {
903
- const v = document.createElement("button");
904
- v.classList.add("cal-myp__cell"), v.textContent = Ct[m], m === e && n === a && v.classList.add("cal-myp__cell--active"), m === p && n === _ && v.classList.add("cal-myp__cell--today"), v.addEventListener("click", () => t(m, n)), g.appendChild(v);
905
- }
906
- return r.appendChild(g), r.addEventListener("keydown", (m) => {
907
- m.key === "Escape" && (m.stopPropagation(), l());
908
- }), r;
955
+ o.classList.add("cal-myp", "cal-animate-fade");
956
+ const h = document.createElement("div");
957
+ h.classList.add("cal-myp__year-nav");
958
+ const c = document.createElement("button");
959
+ c.classList.add("cal-nav__btn"), c.innerHTML = je, c.setAttribute("aria-label", "Previous year"), c.addEventListener("click", s);
960
+ const d = document.createElement("div");
961
+ d.classList.add("cal-myp__year-label"), d.textContent = n;
962
+ const p = document.createElement("button");
963
+ p.classList.add("cal-nav__btn"), p.innerHTML = Ne, p.setAttribute("aria-label", "Next year"), p.addEventListener("click", i), h.appendChild(c), h.appendChild(d), h.appendChild(p), o.appendChild(h);
964
+ const u = document.createElement("div");
965
+ u.classList.add("cal-myp__grid");
966
+ const g = Re(r), f = /* @__PURE__ */ new Date(), m = f.getMonth(), b = f.getFullYear();
967
+ for (let y = 0; y < 12; y++) {
968
+ const w = document.createElement("button");
969
+ w.classList.add("cal-myp__cell"), w.textContent = g[y], y === e && n === a && w.classList.add("cal-myp__cell--active"), y === m && n === b && w.classList.add("cal-myp__cell--today"), w.addEventListener("click", () => t(y, n)), u.appendChild(w);
970
+ }
971
+ return o.appendChild(u), o.addEventListener("keydown", (y) => {
972
+ y.key === "Escape" && (y.stopPropagation(), l());
973
+ }), o;
909
974
  }
910
- const rt = `
975
+ const pt = `
911
976
  .cal-myp {
912
977
  width: calc(7 * var(--cal-cell-size));
913
978
  }
@@ -965,58 +1030,74 @@ const rt = `
965
1030
  border: 1px solid hsl(var(--cal-border));
966
1031
  font-weight: 600;
967
1032
  }
968
- `;
969
- function Dt() {
1033
+ `, Ve = {
1034
+ today: "Today",
1035
+ "this-week": "This Week",
1036
+ "next-7": "Next 7 Days",
1037
+ "next-30": "Next 30 Days"
1038
+ };
1039
+ function Le(n, e) {
1040
+ if (!e) return Ve[n] || n;
1041
+ try {
1042
+ if (n === "today") {
1043
+ const s = new Intl.RelativeTimeFormat(e, { numeric: "auto" }).formatToParts(0, "day").map((i) => i.value).join("");
1044
+ return s.charAt(0).toUpperCase() + s.slice(1);
1045
+ }
1046
+ } catch {
1047
+ }
1048
+ return Ve[n] || n;
1049
+ }
1050
+ function At(n) {
970
1051
  return [
971
1052
  {
972
1053
  key: "today",
973
- label: "Today",
1054
+ label: Le("today", n),
974
1055
  resolve() {
975
- const n = me();
976
- return { start: n, end: n };
1056
+ const e = me();
1057
+ return { start: e, end: e };
977
1058
  }
978
1059
  },
979
1060
  {
980
1061
  key: "this-week",
981
- label: "This Week",
1062
+ label: Le("this-week", n),
982
1063
  resolve() {
983
- const n = /* @__PURE__ */ new Date(), e = n.getDay(), a = new Date(n);
984
- a.setDate(n.getDate() - e);
985
- const t = new Date(a);
986
- return t.setDate(a.getDate() + 6), { start: Z(a), end: Z(t) };
1064
+ const e = /* @__PURE__ */ new Date(), a = e.getDay(), t = new Date(e);
1065
+ t.setDate(e.getDate() - a);
1066
+ const s = new Date(t);
1067
+ return s.setDate(t.getDate() + 6), { start: Z(t), end: Z(s) };
987
1068
  }
988
1069
  },
989
1070
  {
990
1071
  key: "next-7",
991
- label: "Next 7 Days",
1072
+ label: Le("next-7", n),
992
1073
  resolve() {
993
- const n = /* @__PURE__ */ new Date(), e = /* @__PURE__ */ new Date();
994
- return e.setDate(n.getDate() + 6), { start: Z(n), end: Z(e) };
1074
+ const e = /* @__PURE__ */ new Date(), a = /* @__PURE__ */ new Date();
1075
+ return a.setDate(e.getDate() + 6), { start: Z(e), end: Z(a) };
995
1076
  }
996
1077
  },
997
1078
  {
998
1079
  key: "next-30",
999
- label: "Next 30 Days",
1080
+ label: Le("next-30", n),
1000
1081
  resolve() {
1001
- const n = /* @__PURE__ */ new Date(), e = /* @__PURE__ */ new Date();
1002
- return e.setDate(n.getDate() + 29), { start: Z(n), end: Z(e) };
1082
+ const e = /* @__PURE__ */ new Date(), a = /* @__PURE__ */ new Date();
1083
+ return a.setDate(e.getDate() + 29), { start: Z(e), end: Z(a) };
1003
1084
  }
1004
1085
  }
1005
1086
  ];
1006
1087
  }
1007
- function St({ presetKeys: n, onSelect: e }) {
1008
- const a = document.createElement("div");
1009
- a.classList.add("cal-presets");
1010
- const t = Dt(), s = n.map((i) => t.find((l) => l.key === i)).filter(Boolean);
1011
- for (const i of s) {
1012
- const l = document.createElement("button");
1013
- l.classList.add("cal-preset"), l.textContent = i.label, l.addEventListener("click", () => {
1014
- e == null || e(i.resolve());
1015
- }), a.appendChild(l);
1088
+ function $t({ presetKeys: n, onSelect: e, locale: a }) {
1089
+ const t = document.createElement("div");
1090
+ t.classList.add("cal-presets");
1091
+ const s = At(a), i = n.map((l) => s.find((r) => r.key === l)).filter(Boolean);
1092
+ for (const l of i) {
1093
+ const r = document.createElement("button");
1094
+ r.classList.add("cal-preset"), r.textContent = l.label, r.addEventListener("click", () => {
1095
+ e == null || e(l.resolve());
1096
+ }), t.appendChild(r);
1016
1097
  }
1017
- return a;
1098
+ return t;
1018
1099
  }
1019
- const Tt = `
1100
+ const zt = `
1020
1101
  .cal-presets {
1021
1102
  display: flex;
1022
1103
  flex-wrap: wrap;
@@ -1043,14 +1124,14 @@ const Tt = `
1043
1124
  background: hsl(var(--cal-hover));
1044
1125
  }
1045
1126
  `;
1046
- function Ne({ trigger: n, content: e, onClose: a }) {
1127
+ function qe({ trigger: n, content: e, onClose: a }) {
1047
1128
  const t = document.createElement("div");
1048
1129
  t.classList.add("cal-popover"), t.setAttribute("role", "dialog"), t.setAttribute("aria-modal", "false"), t.style.display = "none", t.appendChild(e);
1049
1130
  let s = !1;
1050
1131
  function i() {
1051
1132
  t.classList.remove("cal-popover--above");
1052
- const d = n.getBoundingClientRect(), g = t.offsetHeight, u = window.innerHeight - d.bottom, p = d.top;
1053
- u < g + 8 && p > u ? (t.classList.add("cal-popover--above"), t.style.top = "auto", t.style.bottom = "100%", t.style.marginBottom = "4px", t.style.marginTop = "0") : (t.style.top = "100%", t.style.bottom = "auto", t.style.marginTop = "4px", t.style.marginBottom = "0");
1133
+ const d = n.getBoundingClientRect(), p = t.offsetHeight, u = window.innerHeight - d.bottom, g = d.top;
1134
+ u < p + 8 && g > u ? (t.classList.add("cal-popover--above"), t.style.top = "auto", t.style.bottom = "100%", t.style.marginBottom = "4px", t.style.marginTop = "0") : (t.style.top = "100%", t.style.bottom = "auto", t.style.marginTop = "4px", t.style.marginBottom = "0");
1054
1135
  }
1055
1136
  function l() {
1056
1137
  s || (s = !0, t.style.display = "", t.classList.add("cal-animate-slide-up"), requestAnimationFrame(() => i()), document.addEventListener("click", o, !0), document.addEventListener("keydown", h, !0));
@@ -1060,8 +1141,8 @@ function Ne({ trigger: n, content: e, onClose: a }) {
1060
1141
  }
1061
1142
  function o(d) {
1062
1143
  var u;
1063
- const g = (u = n.getRootNode()) == null ? void 0 : u.host;
1064
- g && !g.contains(d.target) && d.target !== g && r();
1144
+ const p = (u = n.getRootNode()) == null ? void 0 : u.host;
1145
+ p && !p.contains(d.target) && d.target !== p && r();
1065
1146
  }
1066
1147
  function h(d) {
1067
1148
  d.key === "Escape" && (d.stopPropagation(), r());
@@ -1073,7 +1154,7 @@ function Ne({ trigger: n, content: e, onClose: a }) {
1073
1154
  return s;
1074
1155
  } };
1075
1156
  }
1076
- const Re = `
1157
+ const We = `
1077
1158
  .cal-popover-wrapper {
1078
1159
  position: relative;
1079
1160
  display: inline-block;
@@ -1119,7 +1200,7 @@ const Re = `
1119
1200
  color: hsl(var(--cal-fg-muted));
1120
1201
  }
1121
1202
  `;
1122
- function ot({ columns: n = 3, rows: e = 4, durationLabels: a = !1 } = {}) {
1203
+ function gt({ columns: n = 3, rows: e = 4, durationLabels: a = !1 } = {}) {
1123
1204
  const t = document.createElement("div");
1124
1205
  t.setAttribute("role", "status"), t.setAttribute("aria-label", "Loading..."), t.classList.add("cal-skeleton-time-grid"), a && t.classList.add("cal-skeleton-time-grid--duration");
1125
1206
  const s = n * e;
@@ -1129,7 +1210,7 @@ function ot({ columns: n = 3, rows: e = 4, durationLabels: a = !1 } = {}) {
1129
1210
  }
1130
1211
  return t;
1131
1212
  }
1132
- function ct({ rows: n = 5 } = {}) {
1213
+ function mt({ rows: n = 5 } = {}) {
1133
1214
  const e = document.createElement("div");
1134
1215
  e.setAttribute("role", "status"), e.setAttribute("aria-label", "Loading..."), e.classList.add("cal-skeleton-calendar-grid");
1135
1216
  for (let t = 0; t < 7; t++) {
@@ -1143,7 +1224,7 @@ function ct({ rows: n = 5 } = {}) {
1143
1224
  }
1144
1225
  return e;
1145
1226
  }
1146
- const je = `
1227
+ const Xe = `
1147
1228
  .cal-skeleton-time-grid {
1148
1229
  display: grid;
1149
1230
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
@@ -1176,17 +1257,17 @@ const je = `
1176
1257
  aspect-ratio: 1;
1177
1258
  border-radius: var(--cal-radius-sm) !important;
1178
1259
  }
1179
- `, Ke = {
1260
+ `, Ze = {
1180
1261
  error: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 4v3M7 9.5v.01"/></svg>',
1181
1262
  warning: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M7 1.5L1 12.5h12L7 1.5zM7 6v2.5M7 10.5v.01"/></svg>',
1182
1263
  info: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 6.5V10M7 4.5v.01"/></svg>',
1183
1264
  success: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M4.5 7l2 2L9.5 5"/></svg>'
1184
1265
  };
1185
- function ze({ type: n = "info", message: e, dismissible: a = !0, onDismiss: t }) {
1266
+ function Ye({ type: n = "info", message: e, dismissible: a = !0, onDismiss: t }) {
1186
1267
  const s = document.createElement("div");
1187
1268
  s.classList.add("cal-status", `cal-status--${n}`, "cal-animate-slide-up"), s.setAttribute("role", n === "error" ? "alert" : "status"), s.setAttribute("aria-live", n === "error" ? "assertive" : "polite");
1188
1269
  const i = document.createElement("span");
1189
- i.classList.add("cal-status__icon"), i.innerHTML = Ke[n] || Ke.info, s.appendChild(i);
1270
+ i.classList.add("cal-status__icon"), i.innerHTML = Ze[n] || Ze.info, s.appendChild(i);
1190
1271
  const l = document.createElement("span");
1191
1272
  if (l.classList.add("cal-status__text"), l.textContent = e, s.appendChild(l), a) {
1192
1273
  const r = document.createElement("button");
@@ -1194,7 +1275,7 @@ function ze({ type: n = "info", message: e, dismissible: a = !0, onDismiss: t })
1194
1275
  }
1195
1276
  return s;
1196
1277
  }
1197
- const Ye = `
1278
+ const Pe = `
1198
1279
  .cal-status {
1199
1280
  display: flex;
1200
1281
  align-items: center;
@@ -1256,7 +1337,7 @@ const Ye = `
1256
1337
  color: hsl(var(--cal-status-success-fg));
1257
1338
  border: 1px solid hsl(var(--cal-status-success-border));
1258
1339
  }
1259
- `, Mt = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>', At = `
1340
+ `, It = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>', Yt = `
1260
1341
  .cal-picker {
1261
1342
  background: hsl(var(--cal-bg));
1262
1343
  border-radius: var(--cal-radius);
@@ -1277,9 +1358,9 @@ const Ye = `
1277
1358
  flex: 0 0 auto;
1278
1359
  }
1279
1360
  `;
1280
- class $t extends Se {
1361
+ class Pt extends Me {
1281
1362
  static get styles() {
1282
- return [Me, Ae, $e, nt, it, rt, Tt, Re, je, Ye, At];
1363
+ return [$e, ze, Ie, dt, ht, pt, zt, We, Xe, Pe, Yt];
1283
1364
  }
1284
1365
  static get observedAttributes() {
1285
1366
  return ["mode", "display", "theme", "value", "min-date", "max-date", "disabled-dates", "first-day", "locale", "presets", "placeholder", "loading"];
@@ -1287,7 +1368,7 @@ class $t extends Se {
1287
1368
  constructor() {
1288
1369
  super();
1289
1370
  const e = /* @__PURE__ */ new Date();
1290
- this._store = Te({
1371
+ this._store = Ae({
1291
1372
  viewYear: e.getFullYear(),
1292
1373
  viewMonth: e.getMonth(),
1293
1374
  selectedDates: [],
@@ -1323,6 +1404,9 @@ class $t extends Se {
1323
1404
  get maxDate() {
1324
1405
  return this.getAttribute("max-date") || null;
1325
1406
  }
1407
+ get locale() {
1408
+ return this.getAttribute("locale") || void 0;
1409
+ }
1326
1410
  get loading() {
1327
1411
  return this.hasAttribute("loading");
1328
1412
  }
@@ -1353,7 +1437,7 @@ class $t extends Se {
1353
1437
  } else this.mode === "multi" && Array.isArray(e) ? (this._store.set({ selectedDates: e }), e.length && this._navigateToDate(e[0])) : typeof e == "string" ? (this._store.set({ selectedDates: [e], rangeStart: null, rangeEnd: null }), this._navigateToDate(e)) : this._store.set({ selectedDates: [], rangeStart: null, rangeEnd: null });
1354
1438
  }
1355
1439
  _navigateToDate(e) {
1356
- const a = G(e);
1440
+ const a = U(e);
1357
1441
  a && this._store.set({ viewYear: a.getFullYear(), viewMonth: a.getMonth() });
1358
1442
  }
1359
1443
  connectedCallback() {
@@ -1454,7 +1538,7 @@ class $t extends Se {
1454
1538
  e.stopPropagation(), this._store.set({ pickingMonth: !1 });
1455
1539
  return;
1456
1540
  }
1457
- const a = this._store.getState(), t = G(a.focusedDate);
1541
+ const a = this._store.getState(), t = U(a.focusedDate);
1458
1542
  if (!t) return;
1459
1543
  let s = null;
1460
1544
  switch (e.key) {
@@ -1503,8 +1587,8 @@ class $t extends Se {
1503
1587
  const o = r === t, h = r === i;
1504
1588
  let c = !1;
1505
1589
  if (t && i) {
1506
- const d = t < i ? t : i, g = t < i ? i : t;
1507
- c = r >= d && r <= g && !o && !h;
1590
+ const d = t < i ? t : i, p = t < i ? i : t;
1591
+ c = r >= d && r <= p && !o && !h;
1508
1592
  }
1509
1593
  l.classList.toggle("cal-day--range-start", o && !!i), l.classList.toggle("cal-day--range-end", h && !!i), l.classList.toggle("cal-day--in-range", c);
1510
1594
  }
@@ -1519,10 +1603,18 @@ class $t extends Se {
1519
1603
  goToMonth(e, a) {
1520
1604
  this._store.set({ viewYear: a, viewMonth: e });
1521
1605
  }
1606
+ clear() {
1607
+ this._store.set({
1608
+ selectedDates: [],
1609
+ rangeStart: null,
1610
+ rangeEnd: null,
1611
+ hoverDate: null
1612
+ }), this.emit("cal:change", { value: null });
1613
+ }
1522
1614
  // -- Render --
1523
1615
  _renderCalendarContent() {
1524
1616
  const e = this._store.getState(), a = document.createElement("div");
1525
- if (a.classList.add("cal-picker"), e.statusType && e.statusMessage && a.appendChild(ze({
1617
+ if (a.classList.add("cal-picker"), e.statusType && e.statusMessage && a.appendChild(Ye({
1526
1618
  type: e.statusType,
1527
1619
  message: e.statusMessage,
1528
1620
  dismissible: e.statusDismissible,
@@ -1531,14 +1623,14 @@ class $t extends Se {
1531
1623
  const l = document.createElement("div");
1532
1624
  l.classList.add("cal-months");
1533
1625
  const r = document.createElement("div");
1534
- return r.classList.add("cal-month"), r.appendChild(ct()), l.appendChild(r), a.appendChild(l), a.addEventListener("keydown", (o) => this._handleKeydown(o)), a;
1626
+ return r.classList.add("cal-month"), r.appendChild(mt()), l.appendChild(r), a.appendChild(l), a.addEventListener("keydown", (o) => this._handleKeydown(o)), a;
1535
1627
  }
1536
1628
  const t = document.createElement("div");
1537
1629
  t.classList.add("cal-months");
1538
1630
  const s = this.mode === "range" && this.hasAttribute("dual"), i = s ? 2 : 1;
1539
1631
  for (let l = 0; l < i; l++) {
1540
1632
  const { year: r, month: o } = l === 0 ? { year: e.viewYear, month: e.viewMonth } : ge(e.viewYear, e.viewMonth, 1), h = document.createElement("div");
1541
- if (h.classList.add("cal-month"), l === 0 && h.appendChild(Le({
1633
+ if (h.classList.add("cal-month"), l === 0 && h.appendChild(De({
1542
1634
  year: r,
1543
1635
  month: o,
1544
1636
  onPrev: e.pickingMonth ? () => {
@@ -1547,26 +1639,29 @@ class $t extends Se {
1547
1639
  } : () => {
1548
1640
  s || this._nextMonth();
1549
1641
  },
1550
- onTitleClick: () => this._toggleMonthPicker()
1551
- })), l === 1 && h.appendChild(Le({
1642
+ onTitleClick: () => this._toggleMonthPicker(),
1643
+ locale: this.locale
1644
+ })), l === 1 && h.appendChild(De({
1552
1645
  year: r,
1553
1646
  month: o,
1554
1647
  onPrev: () => {
1555
1648
  },
1556
- onNext: () => this._nextMonth()
1649
+ onNext: () => this._nextMonth(),
1650
+ locale: this.locale
1557
1651
  })), e.pickingMonth && l === 0) {
1558
- const c = lt({
1652
+ const c = ut({
1559
1653
  pickerYear: e.pickerYear,
1560
1654
  viewMonth: e.viewMonth,
1561
1655
  viewYear: e.viewYear,
1562
- onMonthSelect: (d, g) => this._selectMonthFromPicker(d, g),
1656
+ onMonthSelect: (d, p) => this._selectMonthFromPicker(d, p),
1563
1657
  onYearPrev: () => this._store.set({ pickerYear: e.pickerYear - 1 }),
1564
1658
  onYearNext: () => this._store.set({ pickerYear: e.pickerYear + 1 }),
1565
- onClose: () => this._store.set({ pickingMonth: !1 })
1659
+ onClose: () => this._store.set({ pickingMonth: !1 }),
1660
+ locale: this.locale
1566
1661
  });
1567
1662
  h.appendChild(c);
1568
1663
  } else {
1569
- const c = e.navDirection === "next" ? "cal-animate-slide-left" : e.navDirection === "prev" ? "cal-animate-slide-right" : "", d = st({
1664
+ const c = e.navDirection === "next" ? "cal-animate-slide-left" : e.navDirection === "prev" ? "cal-animate-slide-right" : "", d = ct({
1570
1665
  year: r,
1571
1666
  month: o,
1572
1667
  firstDay: this.firstDay,
@@ -1579,16 +1674,18 @@ class $t extends Se {
1579
1674
  disabledDates: this.disabledDates,
1580
1675
  mode: this.mode,
1581
1676
  focusedDate: e.focusedDate,
1582
- onSelect: (g) => this._handleSelect(g),
1583
- onHover: (g) => this._handleHover(g)
1677
+ onSelect: (p) => this._handleSelect(p),
1678
+ onHover: (p) => this._handleHover(p),
1679
+ locale: this.locale
1584
1680
  });
1585
1681
  c && d.classList.add(c), h.appendChild(d);
1586
1682
  }
1587
1683
  t.appendChild(h);
1588
1684
  }
1589
- return a.appendChild(t), this.mode === "range" && this.presetKeys.length && a.appendChild(St({
1685
+ return a.appendChild(t), this.mode === "range" && this.presetKeys.length && a.appendChild($t({
1590
1686
  presetKeys: this.presetKeys,
1591
- onSelect: (l) => this._handlePresetSelect(l)
1687
+ onSelect: (l) => this._handlePresetSelect(l),
1688
+ locale: this.locale
1592
1689
  })), a.addEventListener("keydown", (l) => this._handleKeydown(l)), a;
1593
1690
  }
1594
1691
  _formatTriggerText() {
@@ -1596,8 +1693,14 @@ class $t extends Se {
1596
1693
  return this.mode === "range" && e.rangeStart && e.rangeEnd ? `${this._formatShortDate(e.rangeStart)} – ${this._formatShortDate(e.rangeEnd)}` : e.selectedDates.length ? this.mode === "multi" ? `${e.selectedDates.length} dates selected` : this._formatShortDate(e.selectedDates[0]) : null;
1597
1694
  }
1598
1695
  _formatShortDate(e) {
1599
- const a = G(e);
1600
- return a ? `${ne[a.getMonth()].slice(0, 3)} ${a.getDate()}, ${a.getFullYear()}` : e;
1696
+ const a = U(e);
1697
+ if (!a) return e;
1698
+ if (this.locale)
1699
+ try {
1700
+ return new Intl.DateTimeFormat(this.locale, { month: "short", day: "numeric", year: "numeric" }).format(a);
1701
+ } catch {
1702
+ }
1703
+ return `${Re(this.locale)[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`;
1601
1704
  }
1602
1705
  render() {
1603
1706
  var t;
@@ -1612,10 +1715,10 @@ class $t extends Se {
1612
1715
  const i = document.createElement("button");
1613
1716
  i.classList.add("cal-trigger");
1614
1717
  const l = document.createElement("span");
1615
- l.classList.add("cal-trigger__icon"), l.innerHTML = Mt, i.appendChild(l);
1718
+ l.classList.add("cal-trigger__icon"), l.innerHTML = It, i.appendChild(l);
1616
1719
  const r = this._formatTriggerText(), o = document.createElement("span");
1617
1720
  r ? o.textContent = r : (o.textContent = this.placeholder, o.classList.add("cal-trigger--placeholder")), i.appendChild(o), s.appendChild(i);
1618
- const h = this._renderCalendarContent(), c = Ne({
1721
+ const h = this._renderCalendarContent(), c = qe({
1619
1722
  trigger: i,
1620
1723
  content: h,
1621
1724
  onClose: () => {
@@ -1649,7 +1752,7 @@ function he(n, e, a = "24h") {
1649
1752
  }
1650
1753
  return `${String(n).padStart(2, "0")}:${t}`;
1651
1754
  }
1652
- function b(n) {
1755
+ function _(n) {
1653
1756
  const e = le(n);
1654
1757
  return e ? e.hours * 60 + e.minutes : 0;
1655
1758
  }
@@ -1658,28 +1761,32 @@ function ie(n) {
1658
1761
  return `${String(e).padStart(2, "0")}:${String(a).padStart(2, "0")}`;
1659
1762
  }
1660
1763
  function Ee(n, e, a) {
1661
- const t = [], s = b(n), i = b(e);
1764
+ const t = [], s = _(n);
1765
+ let i = _(e);
1766
+ i <= s && (i += 1440);
1662
1767
  for (let l = s; l <= i; l += a)
1663
- t.push(ie(l));
1768
+ t.push(ie(l % 1440));
1664
1769
  return t;
1665
1770
  }
1666
- function dt(n, e, a, t = "24h") {
1667
- const s = [], i = b(n), l = b(e);
1771
+ function ft(n, e, a, t = "24h") {
1772
+ const s = [], i = _(n);
1773
+ let l = _(e);
1774
+ l <= i && (l += 1440);
1668
1775
  for (let r = i; r <= l; r += a) {
1669
- const o = ie(r), h = r + a, c = ie(Math.min(h, l + a)), d = le(o), g = le(c), u = d ? he(d.hours, d.minutes, t) : o, p = g ? he(g.hours, g.minutes, t) : c;
1670
- s.push({ time: o, displayText: `${u}–${p}` });
1776
+ const o = ie(r % 1440), h = r + a, c = ie(Math.min(h, l + a) % 1440), d = le(o), p = le(c), u = d ? he(d.hours, d.minutes, t) : o, g = p ? he(p.hours, p.minutes, t) : c;
1777
+ s.push({ time: o, displayText: `${u}–${g}` });
1671
1778
  }
1672
1779
  return s;
1673
1780
  }
1674
- function ht() {
1781
+ function bt() {
1675
1782
  const n = /* @__PURE__ */ new Date();
1676
1783
  return `${String(n.getHours()).padStart(2, "0")}:${String(n.getMinutes()).padStart(2, "0")}`;
1677
1784
  }
1678
- function Ue(n, e, a) {
1679
- const t = b(n), s = b(e), i = b(a), l = Math.min(s, i), r = Math.max(s, i);
1680
- return t >= l && t <= r;
1785
+ function Qe(n, e, a) {
1786
+ const t = _(n), s = _(e), i = _(a);
1787
+ return i >= s ? t >= s && t <= i : t >= s || t <= i;
1681
1788
  }
1682
- function ut(n) {
1789
+ function vt(n) {
1683
1790
  const {
1684
1791
  slots: e = [],
1685
1792
  mode: a = "single",
@@ -1693,33 +1800,33 @@ function ut(n) {
1693
1800
  durationLabels: c = !1
1694
1801
  } = n, d = document.createElement("div");
1695
1802
  d.classList.add("cal-time-grid"), c && d.classList.add("cal-time-grid--duration"), d.setAttribute("role", "listbox"), a === "multi" && d.setAttribute("aria-multiselectable", "true");
1696
- for (const g of e) {
1803
+ for (const p of e) {
1697
1804
  const u = document.createElement("button");
1698
- u.classList.add("cal-time-slot"), u.setAttribute("role", "option"), u.dataset.time = g.time;
1699
- const p = le(g.time), _ = g.displayText ? g.displayText : p ? he(p.hours, p.minutes, t) : g.time, m = document.createElement("span");
1700
- if (m.classList.add("cal-time-slot__time"), m.textContent = _, u.appendChild(m), g.label) {
1701
- const k = document.createElement("span");
1702
- k.classList.add("cal-time-slot__label"), k.textContent = g.label, u.appendChild(k);
1805
+ u.classList.add("cal-time-slot"), u.setAttribute("role", "option"), u.dataset.time = p.time;
1806
+ const g = le(p.time), f = p.displayText ? p.displayText : g ? he(g.hours, g.minutes, t) : p.time, m = document.createElement("span");
1807
+ if (m.classList.add("cal-time-slot__time"), m.textContent = f, u.appendChild(m), p.label) {
1808
+ const w = document.createElement("span");
1809
+ w.classList.add("cal-time-slot__label"), w.textContent = p.label, u.appendChild(w);
1703
1810
  }
1704
- const v = g.available === !1 || r.includes(g.time);
1705
- if (v && (u.classList.add("cal-time-slot--unavailable"), u.disabled = !0, u.setAttribute("aria-disabled", "true")), zt(g.time, s, a) ? (u.classList.add("cal-time-slot--selected"), u.setAttribute("aria-selected", "true")) : u.setAttribute("aria-selected", "false"), a === "range" && l && !Yt(s) && i) {
1706
- const k = Ue(g.time, l, i), S = g.time === l, B = g.time === i;
1707
- k && !S && !B && u.classList.add("cal-time-slot--in-range"), S && u.classList.add("cal-time-slot--range-start"), B && u.classList.add("cal-time-slot--range-end");
1811
+ const b = p.available === !1 || r.includes(p.time);
1812
+ if (b && (u.classList.add("cal-time-slot--unavailable"), u.disabled = !0, u.setAttribute("aria-disabled", "true")), Ht(p.time, s, a) ? (u.classList.add("cal-time-slot--selected"), u.setAttribute("aria-selected", "true")) : u.setAttribute("aria-selected", "false"), a === "range" && l && !Bt(s) && i) {
1813
+ const w = Qe(p.time, l, i), A = p.time === l, I = p.time === i;
1814
+ w && !A && !I && u.classList.add("cal-time-slot--in-range"), A && u.classList.add("cal-time-slot--range-start"), I && u.classList.add("cal-time-slot--range-end");
1708
1815
  } else if (a === "range" && s && typeof s == "object" && s.start && s.end) {
1709
- const k = Ue(g.time, s.start, s.end), S = g.time === s.start, B = g.time === s.end;
1710
- S && u.classList.add("cal-time-slot--range-start", "cal-time-slot--selected"), B && u.classList.add("cal-time-slot--range-end", "cal-time-slot--selected"), k && !S && !B && u.classList.add("cal-time-slot--in-range");
1816
+ const w = Qe(p.time, s.start, s.end), A = p.time === s.start, I = p.time === s.end;
1817
+ A && u.classList.add("cal-time-slot--range-start", "cal-time-slot--selected"), I && u.classList.add("cal-time-slot--range-end", "cal-time-slot--selected"), w && !A && !I && u.classList.add("cal-time-slot--in-range");
1711
1818
  }
1712
- v || (u.addEventListener("click", () => o == null ? void 0 : o(g.time)), u.addEventListener("mouseenter", () => h == null ? void 0 : h(g.time))), d.appendChild(u);
1819
+ b || (u.addEventListener("click", () => o == null ? void 0 : o(p.time)), u.addEventListener("mouseenter", () => h == null ? void 0 : h(p.time))), d.appendChild(u);
1713
1820
  }
1714
1821
  return d.addEventListener("mouseleave", () => h == null ? void 0 : h(null)), d;
1715
1822
  }
1716
- function zt(n, e, a) {
1823
+ function Ht(n, e, a) {
1717
1824
  return e ? a === "single" ? e === n : a === "multi" ? Array.isArray(e) && e.includes(n) : a === "range" && typeof e == "object" && e.start && e.end ? e.start === n || e.end === n : !1 : !1;
1718
1825
  }
1719
- function Yt(n) {
1826
+ function Bt(n) {
1720
1827
  return n && typeof n == "object" && n.start && n.end;
1721
1828
  }
1722
- const pt = `
1829
+ const _t = `
1723
1830
  .cal-time-grid {
1724
1831
  display: grid;
1725
1832
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
@@ -1801,7 +1908,7 @@ const pt = `
1801
1908
  .cal-time-grid--duration .cal-time-slot {
1802
1909
  font-size: 12px;
1803
1910
  }
1804
- `, It = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>', Pt = `
1911
+ `, Ot = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>', Ft = `
1805
1912
  .cal-picker {
1806
1913
  background: hsl(var(--cal-bg));
1807
1914
  border-radius: var(--cal-radius);
@@ -1836,9 +1943,9 @@ const pt = `
1836
1943
  margin-bottom: 8px;
1837
1944
  }
1838
1945
  `;
1839
- class Ht extends Se {
1946
+ class Rt extends Me {
1840
1947
  static get styles() {
1841
- return [Me, Ae, $e, nt, pt, it, rt, Re, je, Ye, Pt];
1948
+ return [$e, ze, Ie, dt, _t, ht, pt, We, Xe, Pe, Ft];
1842
1949
  }
1843
1950
  static get observedAttributes() {
1844
1951
  return [
@@ -1847,6 +1954,7 @@ class Ht extends Se {
1847
1954
  "min-date",
1848
1955
  "max-date",
1849
1956
  "first-day",
1957
+ "locale",
1850
1958
  "placeholder",
1851
1959
  "dual",
1852
1960
  "show-labels-on-hover",
@@ -1862,7 +1970,7 @@ class Ht extends Se {
1862
1970
  constructor() {
1863
1971
  super();
1864
1972
  const e = /* @__PURE__ */ new Date();
1865
- this._store = Te({
1973
+ this._store = Ae({
1866
1974
  viewYear: e.getFullYear(),
1867
1975
  viewMonth: e.getMonth(),
1868
1976
  rangeStart: null,
@@ -1882,7 +1990,7 @@ class Ht extends Se {
1882
1990
  statusType: null,
1883
1991
  statusMessage: null,
1884
1992
  statusDismissible: !0
1885
- }), this._bookings = [], this._dayData = {}, this._labelFormula = null, this._timeSlots = null, this._popover = null, this._unsubscribe = null, this._rendering = !1;
1993
+ }), this._bookings = [], this._dayData = {}, this._labelFormula = null, this._colors = null, this._customColorMap = null, this._timeSlots = null, this._popover = null, this._unsubscribe = null, this._rendering = !1;
1886
1994
  }
1887
1995
  // -- Attribute getters --
1888
1996
  get display() {
@@ -1900,6 +2008,9 @@ class Ht extends Se {
1900
2008
  get maxDate() {
1901
2009
  return this.getAttribute("max-date") || null;
1902
2010
  }
2011
+ get locale() {
2012
+ return this.getAttribute("locale") || void 0;
2013
+ }
1903
2014
  get showLabelsOnHover() {
1904
2015
  return this.hasAttribute("show-labels-on-hover");
1905
2016
  }
@@ -1952,6 +2063,15 @@ class Ht extends Se {
1952
2063
  set timeSlots(e) {
1953
2064
  this._timeSlots = Array.isArray(e) ? e : null, this._initialized && this.render();
1954
2065
  }
2066
+ get colors() {
2067
+ return this._colors;
2068
+ }
2069
+ set colors(e) {
2070
+ if (this._colors = Array.isArray(e) ? e : null, this._customColorMap = rt(this._colors), this._customColorMap)
2071
+ for (const [a, t] of Object.entries(this._customColorMap))
2072
+ this.style.setProperty(`--cal-booking-${a}-bg`, t.bg), this.style.setProperty(`--cal-booking-${a}-fg`, t.fg), this.style.setProperty(`--cal-booking-${a}-hover`, t.hover);
2073
+ this._initialized && this.render();
2074
+ }
1955
2075
  get value() {
1956
2076
  const e = this._store.getState();
1957
2077
  if (!e.rangeStart || !e.rangeEnd) return null;
@@ -1972,7 +2092,7 @@ class Ht extends Se {
1972
2092
  });
1973
2093
  }
1974
2094
  _navigateToDate(e) {
1975
- const a = G(e);
2095
+ const a = U(e);
1976
2096
  a && this._store.set({ viewYear: a.getFullYear(), viewMonth: a.getMonth() });
1977
2097
  }
1978
2098
  connectedCallback() {
@@ -2009,7 +2129,7 @@ class Ht extends Se {
2009
2129
  });
2010
2130
  else {
2011
2131
  let t = a.rangeStart, s = e;
2012
- if (t > s && ([t, s] = [s, t]), !at(t, s, this._bookings)) {
2132
+ if (t > s && ([t, s] = [s, t]), !ot(t, s, this._bookings)) {
2013
2133
  this.emit("cal:selection-invalid", { start: t, end: s }), this._store.set({
2014
2134
  rangeStart: null,
2015
2135
  rangeEnd: null,
@@ -2070,14 +2190,14 @@ class Ht extends Se {
2070
2190
  const h = o === t && !!i, c = o === i && !!i;
2071
2191
  let d = !1;
2072
2192
  if (t && i) {
2073
- const u = t < i ? t : i, p = t < i ? i : t;
2074
- d = o >= u && o <= p && !h && !c;
2193
+ const u = t < i ? t : i, g = t < i ? i : t;
2194
+ d = o >= u && o <= g && !h && !c;
2075
2195
  }
2076
- const g = l && t && !e.rangeEnd && s && (() => {
2077
- const u = t < s ? t : s, p = t < s ? s : t;
2078
- return o >= u && o <= p;
2196
+ const p = l && t && !e.rangeEnd && s && (() => {
2197
+ const u = t < s ? t : s, g = t < s ? s : t;
2198
+ return o >= u && o <= g;
2079
2199
  })();
2080
- r.classList.toggle("cal-day--range-start", h), r.classList.toggle("cal-day--range-end", c), r.classList.toggle("cal-day--in-range", d), r.classList.toggle("cal-day--invalid-range", !!g);
2200
+ r.classList.toggle("cal-day--range-start", h), r.classList.toggle("cal-day--range-end", c), r.classList.toggle("cal-day--in-range", d), r.classList.toggle("cal-day--invalid-range", !!p);
2081
2201
  }
2082
2202
  }
2083
2203
  // -- Navigation --
@@ -2110,7 +2230,7 @@ class Ht extends Se {
2110
2230
  e.stopPropagation(), this._store.set({ pickingMonth: !1 });
2111
2231
  return;
2112
2232
  }
2113
- const a = this._store.getState(), t = G(a.focusedDate);
2233
+ const a = this._store.getState(), t = U(a.focusedDate);
2114
2234
  if (!t) return;
2115
2235
  let s = null;
2116
2236
  switch (e.key) {
@@ -2160,14 +2280,24 @@ class Ht extends Se {
2160
2280
  goToMonth(e, a) {
2161
2281
  this._store.set({ viewYear: a, viewMonth: e });
2162
2282
  }
2283
+ clear() {
2284
+ this._store.set({
2285
+ rangeStart: null,
2286
+ rangeEnd: null,
2287
+ hoverDate: null,
2288
+ startTime: null,
2289
+ endTime: null,
2290
+ timeSelectPhase: null
2291
+ }), this.emit("cal:change", { value: null });
2292
+ }
2163
2293
  // -- Time slots generation --
2164
2294
  _getTimeSlotArray() {
2165
- return this._timeSlots ? this._timeSlots : this.durationLabels ? dt(this.timeStartTime, this.timeEndTime, this.timeInterval, this.timeFormat).map((a) => ({ ...a, available: !0 })) : Ee(this.timeStartTime, this.timeEndTime, this.timeInterval).map((a) => ({ time: a, available: !0 }));
2295
+ return this._timeSlots ? this._timeSlots : this.durationLabels ? ft(this.timeStartTime, this.timeEndTime, this.timeInterval, this.timeFormat).map((a) => ({ ...a, available: !0 })) : Ee(this.timeStartTime, this.timeEndTime, this.timeInterval).map((a) => ({ time: a, available: !0 }));
2166
2296
  }
2167
2297
  // -- Render --
2168
2298
  _renderCalendarContent() {
2169
2299
  const e = this._store.getState(), a = document.createElement("div");
2170
- if (a.classList.add("cal-picker"), e.statusType && e.statusMessage && a.appendChild(ze({
2300
+ if (a.classList.add("cal-picker"), e.statusType && e.statusMessage && a.appendChild(Ye({
2171
2301
  type: e.statusType,
2172
2302
  message: e.statusMessage,
2173
2303
  dismissible: e.statusDismissible,
@@ -2176,9 +2306,9 @@ class Ht extends Se {
2176
2306
  const l = document.createElement("div");
2177
2307
  l.classList.add("cal-months");
2178
2308
  const r = document.createElement("div");
2179
- if (r.classList.add("cal-month"), r.appendChild(ct()), l.appendChild(r), a.appendChild(l), this.timeSlotsEnabled) {
2309
+ if (r.classList.add("cal-month"), r.appendChild(mt()), l.appendChild(r), a.appendChild(l), this.timeSlotsEnabled) {
2180
2310
  const o = document.createElement("div");
2181
- o.classList.add("cal-booking-time-section"), o.appendChild(ot({ durationLabels: this.durationLabels })), a.appendChild(o);
2311
+ o.classList.add("cal-booking-time-section"), o.appendChild(gt({ durationLabels: this.durationLabels })), a.appendChild(o);
2182
2312
  }
2183
2313
  return a.addEventListener("keydown", (o) => this._handleKeydown(o)), a;
2184
2314
  }
@@ -2187,7 +2317,7 @@ class Ht extends Se {
2187
2317
  const s = this.hasAttribute("dual"), i = s ? 2 : 1;
2188
2318
  for (let l = 0; l < i; l++) {
2189
2319
  const { year: r, month: o } = l === 0 ? { year: e.viewYear, month: e.viewMonth } : ge(e.viewYear, e.viewMonth, 1), h = document.createElement("div");
2190
- if (h.classList.add("cal-month"), l === 0 && h.appendChild(Le({
2320
+ if (h.classList.add("cal-month"), l === 0 && h.appendChild(De({
2191
2321
  year: r,
2192
2322
  month: o,
2193
2323
  onPrev: e.pickingMonth ? () => {
@@ -2196,26 +2326,29 @@ class Ht extends Se {
2196
2326
  } : () => {
2197
2327
  s || this._nextMonth();
2198
2328
  },
2199
- onTitleClick: () => this._toggleMonthPicker()
2200
- })), l === 1 && h.appendChild(Le({
2329
+ onTitleClick: () => this._toggleMonthPicker(),
2330
+ locale: this.locale
2331
+ })), l === 1 && h.appendChild(De({
2201
2332
  year: r,
2202
2333
  month: o,
2203
2334
  onPrev: () => {
2204
2335
  },
2205
- onNext: () => this._nextMonth()
2336
+ onNext: () => this._nextMonth(),
2337
+ locale: this.locale
2206
2338
  })), e.pickingMonth && l === 0) {
2207
- const c = lt({
2339
+ const c = ut({
2208
2340
  pickerYear: e.pickerYear,
2209
2341
  viewMonth: e.viewMonth,
2210
2342
  viewYear: e.viewYear,
2211
- onMonthSelect: (d, g) => this._selectMonthFromPicker(d, g),
2343
+ onMonthSelect: (d, p) => this._selectMonthFromPicker(d, p),
2212
2344
  onYearPrev: () => this._store.set({ pickerYear: e.pickerYear - 1 }),
2213
2345
  onYearNext: () => this._store.set({ pickerYear: e.pickerYear + 1 }),
2214
- onClose: () => this._store.set({ pickingMonth: !1 })
2346
+ onClose: () => this._store.set({ pickingMonth: !1 }),
2347
+ locale: this.locale
2215
2348
  });
2216
2349
  h.appendChild(c);
2217
2350
  } else {
2218
- const c = e.navDirection === "next" ? "cal-animate-slide-left" : e.navDirection === "prev" ? "cal-animate-slide-right" : "", d = st({
2351
+ const c = e.navDirection === "next" ? "cal-animate-slide-left" : e.navDirection === "prev" ? "cal-animate-slide-right" : "", d = ct({
2219
2352
  year: r,
2220
2353
  month: o,
2221
2354
  firstDay: this.firstDay,
@@ -2226,13 +2359,15 @@ class Ht extends Se {
2226
2359
  maxDate: this.maxDate,
2227
2360
  focusedDate: e.focusedDate,
2228
2361
  mode: "range",
2229
- onSelect: (g) => this._handleSelect(g),
2230
- onHover: (g) => this._handleHover(g),
2362
+ onSelect: (p) => this._handleSelect(p),
2363
+ onHover: (p) => this._handleHover(p),
2231
2364
  // Booking-specific params
2232
2365
  bookings: this._bookings,
2233
2366
  dayData: this._dayData,
2234
2367
  labelFormula: this._labelFormula,
2235
- showLabelsOnHover: this.showLabelsOnHover
2368
+ showLabelsOnHover: this.showLabelsOnHover,
2369
+ locale: this.locale,
2370
+ customColors: this._customColorMap
2236
2371
  });
2237
2372
  c && d.classList.add(c), h.appendChild(d);
2238
2373
  }
@@ -2243,7 +2378,7 @@ class Ht extends Se {
2243
2378
  l.classList.add("cal-booking-time-section");
2244
2379
  const r = document.createElement("div");
2245
2380
  r.classList.add("cal-booking-time-header"), r.textContent = e.timeSelectPhase === "start" ? "Select check-in time" : "Select check-out time", l.appendChild(r);
2246
- const o = this._getTimeSlotArray(), h = ut({
2381
+ const o = this._getTimeSlotArray(), h = vt({
2247
2382
  slots: o,
2248
2383
  mode: "single",
2249
2384
  format: this.timeFormat,
@@ -2266,8 +2401,14 @@ class Ht extends Se {
2266
2401
  return null;
2267
2402
  }
2268
2403
  _formatShortDate(e) {
2269
- const a = G(e);
2270
- return a ? `${ne[a.getMonth()].slice(0, 3)} ${a.getDate()}, ${a.getFullYear()}` : e;
2404
+ const a = U(e);
2405
+ if (!a) return e;
2406
+ if (this.locale)
2407
+ try {
2408
+ return new Intl.DateTimeFormat(this.locale, { month: "short", day: "numeric", year: "numeric" }).format(a);
2409
+ } catch {
2410
+ }
2411
+ return `${Re(this.locale)[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`;
2271
2412
  }
2272
2413
  render() {
2273
2414
  var t;
@@ -2282,10 +2423,10 @@ class Ht extends Se {
2282
2423
  const i = document.createElement("button");
2283
2424
  i.classList.add("cal-trigger");
2284
2425
  const l = document.createElement("span");
2285
- l.classList.add("cal-trigger__icon"), l.innerHTML = It, i.appendChild(l);
2426
+ l.classList.add("cal-trigger__icon"), l.innerHTML = Ot, i.appendChild(l);
2286
2427
  const r = this._formatTriggerText(), o = document.createElement("span");
2287
2428
  r ? o.textContent = r : (o.textContent = this.placeholder, o.classList.add("cal-trigger--placeholder")), i.appendChild(o), s.appendChild(i);
2288
- const h = this._renderCalendarContent(), c = Ne({
2429
+ const h = this._renderCalendarContent(), c = qe({
2289
2430
  trigger: i,
2290
2431
  content: h,
2291
2432
  onClose: () => {
@@ -2300,7 +2441,7 @@ class Ht extends Se {
2300
2441
  this._store.set({ navDirection: null }), this._rendering = !1;
2301
2442
  }
2302
2443
  }
2303
- const Bt = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="6"/><path d="M8 4.5V8l2.5 1.5"/></svg>', Ot = `
2444
+ const jt = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="6"/><path d="M8 4.5V8l2.5 1.5"/></svg>', Nt = `
2304
2445
  .cal-timepicker {
2305
2446
  background: hsl(var(--cal-bg));
2306
2447
  border-radius: var(--cal-radius);
@@ -2321,15 +2462,15 @@ const Bt = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="
2321
2462
  padding: 0 4px;
2322
2463
  }
2323
2464
  `;
2324
- class Ft extends Se {
2465
+ class qt extends Me {
2325
2466
  static get styles() {
2326
- return [Me, Ae, $e, pt, Re, je, Ye, Ot];
2467
+ return [$e, ze, Ie, _t, We, Xe, Pe, Nt];
2327
2468
  }
2328
2469
  static get observedAttributes() {
2329
- return ["mode", "display", "theme", "start-time", "end-time", "interval", "format", "placeholder", "value", "duration-labels", "loading"];
2470
+ return ["mode", "display", "theme", "start-time", "end-time", "interval", "format", "placeholder", "value", "duration-labels", "loading", "locale", "min-time"];
2330
2471
  }
2331
2472
  constructor() {
2332
- super(), this._store = Te({
2473
+ super(), this._store = Ae({
2333
2474
  selected: null,
2334
2475
  // string | string[] | {start, end}
2335
2476
  rangeStart: null,
@@ -2372,6 +2513,12 @@ class Ft extends Se {
2372
2513
  set loading(e) {
2373
2514
  e ? this.setAttribute("loading", "") : this.removeAttribute("loading");
2374
2515
  }
2516
+ get locale() {
2517
+ return this.getAttribute("locale") || void 0;
2518
+ }
2519
+ get minTime() {
2520
+ return this.getAttribute("min-time") || null;
2521
+ }
2375
2522
  // -- Properties --
2376
2523
  get slots() {
2377
2524
  return this._slots;
@@ -2389,16 +2536,26 @@ class Ft extends Se {
2389
2536
  return this._store.getState().selected;
2390
2537
  }
2391
2538
  set value(e) {
2392
- this.mode === "single" && typeof e == "string" ? this._store.set({ selected: e, rangeStart: null }) : this.mode === "multi" && Array.isArray(e) ? this._store.set({ selected: [...e].sort((a, t) => b(a) - b(t)), rangeStart: null }) : this.mode === "range" && e && typeof e == "object" ? this._store.set({ selected: { start: e.start, end: e.end }, rangeStart: null }) : this._store.set({ selected: null, rangeStart: null });
2539
+ this.mode === "single" && typeof e == "string" ? this._store.set({ selected: e, rangeStart: null }) : this.mode === "multi" && Array.isArray(e) ? this._store.set({ selected: [...e].sort((a, t) => _(a) - _(t)), rangeStart: null }) : this.mode === "range" && e && typeof e == "object" ? this._store.set({ selected: { start: e.start, end: e.end }, rangeStart: null }) : this._store.set({ selected: null, rangeStart: null });
2393
2540
  }
2394
2541
  _getEffectiveSlots() {
2395
- return this._slots ? this._slots : this.durationLabels ? dt(this.startTime, this.endTime, this.interval, this.format).map((t) => ({
2396
- ...t,
2397
- available: !this._unavailableTimes.includes(t.time)
2398
- })) : Ee(this.startTime, this.endTime, this.interval).map((a) => ({
2399
- time: a,
2400
- available: !this._unavailableTimes.includes(a)
2542
+ let e;
2543
+ this._slots ? e = this._slots : this.durationLabels ? e = ft(this.startTime, this.endTime, this.interval, this.format).map((s) => ({
2544
+ ...s,
2545
+ available: !this._unavailableTimes.includes(s.time)
2546
+ })) : e = Ee(this.startTime, this.endTime, this.interval).map((s) => ({
2547
+ time: s,
2548
+ available: !this._unavailableTimes.includes(s)
2401
2549
  }));
2550
+ const a = this.minTime;
2551
+ if (a) {
2552
+ const t = _(a);
2553
+ e = e.map((s) => {
2554
+ const i = typeof s == "string" ? s : s.time;
2555
+ return _(i) < t ? typeof s == "string" ? { time: s, available: !1 } : { ...s, available: !1 } : s;
2556
+ });
2557
+ }
2558
+ return e;
2402
2559
  }
2403
2560
  connectedCallback() {
2404
2561
  super.connectedCallback(), this._unsubscribe = this._store.subscribe((a, t) => {
@@ -2439,13 +2596,13 @@ class Ft extends Se {
2439
2596
  this._store.set({ selected: e }), this.emit("cal:time-change", { value: e }), this.display === "popover" && this.close();
2440
2597
  else if (this.mode === "multi") {
2441
2598
  const t = Array.isArray(a.selected) ? [...a.selected] : [], s = t.indexOf(e);
2442
- s >= 0 ? t.splice(s, 1) : t.push(e), t.sort((i, l) => b(i) - b(l)), this._store.set({ selected: t }), this.emit("cal:time-change", { value: t });
2599
+ s >= 0 ? t.splice(s, 1) : t.push(e), t.sort((i, l) => _(i) - _(l)), this._store.set({ selected: t }), this.emit("cal:time-change", { value: t });
2443
2600
  } else if (this.mode === "range")
2444
2601
  if (!a.rangeStart || a.selected && typeof a.selected == "object" && a.selected.start && a.selected.end)
2445
2602
  this._store.set({ rangeStart: e, selected: null, hoverTime: null });
2446
2603
  else {
2447
2604
  let t = a.rangeStart, s = e;
2448
- b(t) > b(s) && ([t, s] = [s, t]);
2605
+ _(t) > _(s) && ([t, s] = [s, t]);
2449
2606
  const i = { start: t, end: s };
2450
2607
  this._store.set({ selected: i, rangeStart: null, hoverTime: null }), this.emit("cal:time-change", { value: i }), this.display === "popover" && this.close();
2451
2608
  }
@@ -2460,8 +2617,8 @@ class Ft extends Se {
2460
2617
  const o = r.dataset.time;
2461
2618
  if (!(!o || r.disabled))
2462
2619
  if (t && !l && s) {
2463
- const h = b(t) < b(s) ? t : s, c = b(t) < b(s) ? s : t, d = b(o), g = d > b(h) && d < b(c), u = o === t, p = o === s;
2464
- r.classList.toggle("cal-time-slot--range-start", u), r.classList.toggle("cal-time-slot--range-end", p), r.classList.toggle("cal-time-slot--in-range", g);
2620
+ const h = _(t) < _(s) ? t : s, c = _(t) < _(s) ? s : t, d = _(o), p = d > _(h) && d < _(c), u = o === t, g = o === s;
2621
+ r.classList.toggle("cal-time-slot--range-start", u), r.classList.toggle("cal-time-slot--range-end", g), r.classList.toggle("cal-time-slot--in-range", p);
2465
2622
  } else t || r.classList.remove("cal-time-slot--range-start", "cal-time-slot--range-end", "cal-time-slot--in-range");
2466
2623
  }
2467
2624
  }
@@ -2472,10 +2629,17 @@ class Ft extends Se {
2472
2629
  close() {
2473
2630
  this._popover && (this._popover.close(), this._store.set({ isOpen: !1 }), this.emit("cal:close"));
2474
2631
  }
2632
+ clear() {
2633
+ this._store.set({
2634
+ selected: null,
2635
+ rangeStart: null,
2636
+ hoverTime: null
2637
+ }), this.emit("cal:time-change", { value: null });
2638
+ }
2475
2639
  // -- Render --
2476
2640
  _renderTimepickerContent() {
2477
2641
  const e = this._store.getState(), a = document.createElement("div");
2478
- a.classList.add("cal-timepicker"), e.statusType && e.statusMessage && a.appendChild(ze({
2642
+ a.classList.add("cal-timepicker"), e.statusType && e.statusMessage && a.appendChild(Ye({
2479
2643
  type: e.statusType,
2480
2644
  message: e.statusMessage,
2481
2645
  dismissible: e.statusDismissible,
@@ -2483,9 +2647,9 @@ class Ft extends Se {
2483
2647
  }));
2484
2648
  const t = document.createElement("div");
2485
2649
  if (t.classList.add("cal-timepicker__header"), t.textContent = "Select Time", a.appendChild(t), this.loading)
2486
- a.appendChild(ot({ durationLabels: this.durationLabels }));
2650
+ a.appendChild(gt({ durationLabels: this.durationLabels }));
2487
2651
  else {
2488
- const s = this._getEffectiveSlots(), i = ut({
2652
+ const s = this._getEffectiveSlots(), i = vt({
2489
2653
  slots: s,
2490
2654
  mode: this.mode,
2491
2655
  format: this.format,
@@ -2518,10 +2682,10 @@ class Ft extends Se {
2518
2682
  const i = document.createElement("button");
2519
2683
  i.classList.add("cal-trigger");
2520
2684
  const l = document.createElement("span");
2521
- l.classList.add("cal-trigger__icon"), l.innerHTML = Bt, i.appendChild(l);
2685
+ l.classList.add("cal-trigger__icon"), l.innerHTML = jt, i.appendChild(l);
2522
2686
  const r = this._formatTriggerText(), o = document.createElement("span");
2523
2687
  r ? o.textContent = r : (o.textContent = this.placeholder, o.classList.add("cal-trigger--placeholder")), i.appendChild(o), s.appendChild(i);
2524
- const h = this._renderTimepickerContent(), c = Ne({
2688
+ const h = this._renderTimepickerContent(), c = qe({
2525
2689
  trigger: i,
2526
2690
  content: h,
2527
2691
  onClose: () => {
@@ -2536,42 +2700,43 @@ class Ft extends Se {
2536
2700
  this._rendering = !1;
2537
2701
  }
2538
2702
  }
2539
- function Nt(n, e = 0) {
2540
- const a = G(n);
2703
+ function Wt(n, e = 0) {
2704
+ const a = U(n);
2541
2705
  if (!a) return n;
2542
2706
  const s = (a.getDay() - e + 7) % 7;
2543
2707
  return a.setDate(a.getDate() - s), Z(a);
2544
2708
  }
2545
- function Be(n, e = 0) {
2546
- const a = Nt(n, e), t = [];
2709
+ function Fe(n, e = 0) {
2710
+ const a = Wt(n, e), t = [];
2547
2711
  for (let s = 0; s < 7; s++)
2548
2712
  t.push(ye(a, s));
2549
2713
  return t;
2550
2714
  }
2551
- function Rt(n, e, a) {
2552
- const t = G(e);
2553
- if (!t) return "";
2715
+ function Xt(n, e, a, t) {
2716
+ const s = U(e);
2717
+ if (!s) return "";
2718
+ const i = st(t);
2554
2719
  if (n === "day")
2555
- return `${ne[t.getMonth()]} ${t.getDate()}, ${t.getFullYear()}`;
2720
+ return `${i[s.getMonth()]} ${s.getDate()}, ${s.getFullYear()}`;
2556
2721
  if (n === "week" && a && a.length === 7) {
2557
- const s = G(a[0]), i = G(a[6]);
2558
- return !s || !i ? "" : s.getMonth() === i.getMonth() ? `${ne[s.getMonth()]} ${s.getDate()}–${i.getDate()}, ${s.getFullYear()}` : s.getFullYear() === i.getFullYear() ? `${ne[s.getMonth()].slice(0, 3)} ${s.getDate()} – ${ne[i.getMonth()].slice(0, 3)} ${i.getDate()}, ${s.getFullYear()}` : `${ne[s.getMonth()].slice(0, 3)} ${s.getDate()}, ${s.getFullYear()} – ${ne[i.getMonth()].slice(0, 3)} ${i.getDate()}, ${i.getFullYear()}`;
2722
+ const l = U(a[0]), r = U(a[6]);
2723
+ return !l || !r ? "" : l.getMonth() === r.getMonth() ? `${i[l.getMonth()]} ${l.getDate()}–${r.getDate()}, ${l.getFullYear()}` : l.getFullYear() === r.getFullYear() ? `${i[l.getMonth()].slice(0, 3)} ${l.getDate()} – ${i[r.getMonth()].slice(0, 3)} ${r.getDate()}, ${l.getFullYear()}` : `${i[l.getMonth()].slice(0, 3)} ${l.getDate()}, ${l.getFullYear()} – ${i[r.getMonth()].slice(0, 3)} ${r.getDate()}, ${r.getFullYear()}`;
2559
2724
  }
2560
- return n === "month" ? `${ne[t.getMonth()]} ${t.getFullYear()}` : "";
2725
+ return n === "month" ? `${i[s.getMonth()]} ${s.getFullYear()}` : "";
2561
2726
  }
2562
2727
  function ke(n, e) {
2563
2728
  return n.filter((a) => a.start ? a.end && a.end !== a.start ? e >= a.start && e <= a.end : a.start === e : !1);
2564
2729
  }
2565
- function Ce(n) {
2730
+ function Te(n) {
2566
2731
  if (!n.length) return n;
2567
2732
  const e = [...n].sort((t, s) => {
2568
- const i = b(t.startTime || "00:00"), l = b(s.startTime || "00:00");
2733
+ const i = _(t.startTime || "00:00"), l = _(s.startTime || "00:00");
2569
2734
  if (i !== l) return i - l;
2570
- const r = b(t.endTime || "23:59");
2571
- return b(s.endTime || "23:59") - l - (r - i);
2735
+ const r = _(t.endTime || "23:59");
2736
+ return _(s.endTime || "23:59") - l - (r - i);
2572
2737
  }), a = [];
2573
2738
  for (const t of e) {
2574
- const s = b(t.startTime || "00:00"), i = b(t.endTime || "23:59");
2739
+ const s = _(t.startTime || "00:00"), i = _(t.endTime || "23:59");
2575
2740
  let l = !1;
2576
2741
  for (let r = 0; r < a.length; r++)
2577
2742
  if (s >= a[r]) {
@@ -2581,10 +2746,10 @@ function Ce(n) {
2581
2746
  l || (t._col = a.length, a.push(i));
2582
2747
  }
2583
2748
  for (const t of e) {
2584
- const s = b(t.startTime || "00:00"), i = b(t.endTime || "23:59");
2749
+ const s = _(t.startTime || "00:00"), i = _(t.endTime || "23:59");
2585
2750
  let l = t._col;
2586
2751
  for (const r of e) {
2587
- const o = b(r.startTime || "00:00"), h = b(r.endTime || "23:59");
2752
+ const o = _(r.startTime || "00:00"), h = _(r.endTime || "23:59");
2588
2753
  o < i && h > s && (l = Math.max(l, r._col));
2589
2754
  }
2590
2755
  t._totalCols = l + 1;
@@ -2592,76 +2757,93 @@ function Ce(n) {
2592
2757
  return e;
2593
2758
  }
2594
2759
  function pe(n, e, a, t) {
2595
- return (b(n) - b(e)) / t * a;
2760
+ return (_(n) - _(e)) / t * a;
2596
2761
  }
2597
- function Ve(n, e, a, t) {
2598
- const s = n / a * t, i = b(e) + s;
2762
+ function et(n, e, a, t) {
2763
+ const s = n / a * t, i = _(e) + s;
2599
2764
  return ie(Math.round(i));
2600
2765
  }
2601
- function Je(n, e) {
2602
- const a = b(n), t = Math.round(a / e) * e;
2766
+ function tt(n, e) {
2767
+ const a = _(n), t = Math.round(a / e) * e;
2603
2768
  return ie(t);
2604
2769
  }
2605
- function jt(n, e, a) {
2770
+ function Gt(n, e, a) {
2606
2771
  return ke(n, a).filter(
2607
2772
  (t) => t.resourceId === e
2608
2773
  );
2609
2774
  }
2610
- function gt(n, e, a, t, s) {
2611
- const i = jt(n, e, a), l = b(t), r = b(s);
2775
+ function yt(n, e, a, t, s) {
2776
+ const i = Gt(n, e, a), l = _(t), r = _(s);
2612
2777
  for (const o of i) {
2613
2778
  if (!o.startTime || !o.endTime) continue;
2614
- const h = b(o.startTime), c = b(o.endTime);
2779
+ const h = _(o.startTime), c = _(o.endTime);
2615
2780
  if (l < c && r > h)
2616
2781
  return !1;
2617
2782
  }
2618
2783
  return !0;
2619
2784
  }
2620
- function qt(n, e, a, t, s = "08:00", i = "18:00") {
2785
+ function Kt(n, e, a, t, s = "08:00", i = "18:00") {
2621
2786
  const { duration: l, resourceId: r, minCapacity: o } = n, h = n.date || me(), c = 14;
2622
2787
  let d = e;
2623
- r && (d = e.filter((p) => p.id === r)), o && (d = d.filter(
2624
- (p) => p.capacity && p.capacity >= o
2788
+ r && (d = e.filter((g) => g.id === r)), o && (d = d.filter(
2789
+ (g) => g.capacity && g.capacity >= o
2625
2790
  ));
2626
- const g = b(s), u = b(i);
2627
- for (let p = 0; p < c; p++) {
2628
- const _ = ye(h, p);
2791
+ const p = _(s), u = _(i);
2792
+ for (let g = 0; g < c; g++) {
2793
+ const f = ye(h, g);
2629
2794
  for (const m of d)
2630
- for (let v = g; v + l <= u; v += t) {
2631
- const C = ie(v), k = ie(v + l);
2632
- if (gt(a, m.id, _, C, k))
2795
+ for (let b = p; b + l <= u; b += t) {
2796
+ const y = ie(b), w = ie(b + l);
2797
+ if (yt(a, m.id, f, y, w))
2633
2798
  return {
2634
2799
  resourceId: m.id,
2635
- date: _,
2636
- startTime: C,
2637
- endTime: k
2800
+ date: f,
2801
+ startTime: y,
2802
+ endTime: w
2638
2803
  };
2639
2804
  }
2640
2805
  }
2641
2806
  return null;
2642
2807
  }
2643
- function Wt({ title: n, view: e, onPrev: a, onNext: t, onToday: s, onViewChange: i }) {
2644
- const l = document.createElement("div");
2645
- l.classList.add("cal-sched-nav");
2808
+ function Ut({ title: n, view: e, onPrev: a, onNext: t, onToday: s, onViewChange: i, locale: l }) {
2646
2809
  const r = document.createElement("div");
2647
- r.classList.add("cal-sched-nav__left");
2648
- const o = document.createElement("button");
2649
- o.classList.add("cal-sched-nav__btn"), o.innerHTML = Oe, o.setAttribute("aria-label", "Previous"), o.addEventListener("click", a);
2810
+ r.classList.add("cal-sched-nav");
2811
+ const o = document.createElement("div");
2812
+ o.classList.add("cal-sched-nav__left");
2650
2813
  const h = document.createElement("button");
2651
- h.classList.add("cal-sched-nav__btn"), h.innerHTML = Fe, h.setAttribute("aria-label", "Next"), h.addEventListener("click", t);
2814
+ h.classList.add("cal-sched-nav__btn"), h.innerHTML = je, h.setAttribute("aria-label", "Previous"), h.addEventListener("click", a);
2652
2815
  const c = document.createElement("button");
2653
- c.classList.add("cal-sched-nav__today"), c.textContent = "Today", c.addEventListener("click", s);
2654
- const d = document.createElement("span");
2655
- d.classList.add("cal-sched-nav__title"), d.setAttribute("aria-live", "polite"), d.textContent = n, r.appendChild(o), r.appendChild(h), r.appendChild(c), r.appendChild(d);
2816
+ c.classList.add("cal-sched-nav__btn"), c.innerHTML = Ne, c.setAttribute("aria-label", "Next"), c.addEventListener("click", t);
2817
+ let d = "Today";
2818
+ if (l)
2819
+ try {
2820
+ const y = new Intl.RelativeTimeFormat(l, { numeric: "auto" }).formatToParts(0, "day").map((w) => w.value).join("");
2821
+ d = y.charAt(0).toUpperCase() + y.slice(1);
2822
+ } catch {
2823
+ }
2824
+ const p = document.createElement("button");
2825
+ p.classList.add("cal-sched-nav__today"), p.textContent = d, p.addEventListener("click", s);
2826
+ const u = document.createElement("span");
2827
+ u.classList.add("cal-sched-nav__title"), u.setAttribute("aria-live", "polite"), u.textContent = n, o.appendChild(h), o.appendChild(c), o.appendChild(p), o.appendChild(u);
2656
2828
  const g = document.createElement("div");
2657
2829
  g.classList.add("cal-sched-nav__tabs");
2658
- for (const u of ["day", "week", "month"]) {
2659
- const p = document.createElement("button");
2660
- p.classList.add("cal-sched-nav__tab"), u === e && p.classList.add("cal-sched-nav__tab--active"), p.textContent = u.charAt(0).toUpperCase() + u.slice(1), p.addEventListener("click", () => i(u)), g.appendChild(p);
2830
+ const f = { day: "Day", week: "Week", month: "Month" };
2831
+ if (l)
2832
+ try {
2833
+ const m = new Intl.DisplayNames(l, { type: "dateTimeField" });
2834
+ for (const b of ["day", "week", "month"]) {
2835
+ const y = m.of(b);
2836
+ y && (f[b] = y.charAt(0).toUpperCase() + y.slice(1));
2837
+ }
2838
+ } catch {
2839
+ }
2840
+ for (const m of ["day", "week", "month"]) {
2841
+ const b = document.createElement("button");
2842
+ b.classList.add("cal-sched-nav__tab"), m === e && b.classList.add("cal-sched-nav__tab--active"), b.textContent = f[m], b.addEventListener("click", () => i(m)), g.appendChild(b);
2661
2843
  }
2662
- return l.appendChild(r), l.appendChild(g), l;
2844
+ return r.appendChild(o), r.appendChild(g), r;
2663
2845
  }
2664
- const Xt = `
2846
+ const Jt = `
2665
2847
  .cal-sched-nav {
2666
2848
  display: flex;
2667
2849
  align-items: center;
@@ -2750,7 +2932,7 @@ const Xt = `
2750
2932
  color: hsl(var(--cal-accent-fg));
2751
2933
  }
2752
2934
  `;
2753
- function mt({ startTime: n, endTime: e, interval: a, slotHeight: t, format: s }) {
2935
+ function xt({ startTime: n, endTime: e, interval: a, slotHeight: t, format: s }) {
2754
2936
  const i = document.createElement("div");
2755
2937
  i.classList.add("cal-sched-time-axis");
2756
2938
  const l = Ee(n, e, a);
@@ -2766,7 +2948,7 @@ function mt({ startTime: n, endTime: e, interval: a, slotHeight: t, format: s })
2766
2948
  }
2767
2949
  return i;
2768
2950
  }
2769
- const Gt = `
2951
+ const Vt = `
2770
2952
  .cal-sched-time-axis {
2771
2953
  display: flex;
2772
2954
  flex-direction: column;
@@ -2792,7 +2974,7 @@ const Gt = `
2792
2974
  user-select: none;
2793
2975
  }
2794
2976
  `;
2795
- function Kt({ resource: n, width: e }) {
2977
+ function Zt({ resource: n, width: e }) {
2796
2978
  const a = document.createElement("div");
2797
2979
  a.classList.add("cal-sched-resource-header"), e && (a.style.width = `${e}px`), a.style.flex = e ? `0 0 ${e}px` : "1 1 0";
2798
2980
  const t = document.createElement("span");
@@ -2806,14 +2988,14 @@ function Kt({ resource: n, width: e }) {
2806
2988
  }
2807
2989
  return a;
2808
2990
  }
2809
- function Ut({ resources: n }) {
2991
+ function Qt({ resources: n }) {
2810
2992
  const e = document.createElement("div");
2811
2993
  e.classList.add("cal-sched-resource-header-row");
2812
2994
  for (const a of n)
2813
- e.appendChild(Kt({ resource: a }));
2995
+ e.appendChild(Zt({ resource: a }));
2814
2996
  return e;
2815
2997
  }
2816
- const Vt = `
2998
+ const ea = `
2817
2999
  .cal-sched-resource-header-row {
2818
3000
  display: flex;
2819
3001
  border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
@@ -2858,29 +3040,29 @@ const Vt = `
2858
3040
  flex-shrink: 0;
2859
3041
  }
2860
3042
  `;
2861
- function De({ event: n, gridStartTime: e, slotHeight: a, interval: t, format: s, onClick: i, eventContent: l, showTime: r = !0, resource: o, draggable: h }) {
3043
+ function Se({ event: n, gridStartTime: e, slotHeight: a, interval: t, format: s, onClick: i, eventContent: l, showTime: r = !0, resource: o, draggable: h }) {
2862
3044
  const c = document.createElement("div");
2863
3045
  c.classList.add("cal-sched-event"), c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.dataset.eventId = n.id;
2864
3046
  const d = !!n.locked;
2865
3047
  h && !d && (c.dataset.draggable = "true"), d && c.classList.add("cal-sched-event--locked");
2866
- const g = n.color || "blue";
2867
- if (c.style.setProperty("--ev-bg", `var(--cal-booking-${g}-bg)`), c.style.setProperty("--ev-fg", `var(--cal-booking-${g}-fg)`), n.startTime && n.endTime) {
2868
- const u = pe(n.startTime, e, a, t), p = pe(n.endTime, e, a, t), _ = Math.max(p - u, a * 0.5);
2869
- if (c.style.top = `${u}px`, c.style.height = `${_}px`, n._totalCols > 1) {
3048
+ const p = n.color || "blue";
3049
+ if (c.style.setProperty("--ev-bg", `var(--cal-booking-${p}-bg)`), c.style.setProperty("--ev-fg", `var(--cal-booking-${p}-fg)`), n.startTime && n.endTime) {
3050
+ const u = pe(n.startTime, e, a, t), g = pe(n.endTime, e, a, t), f = Math.max(g - u, a * 0.5);
3051
+ if (c.style.top = `${u}px`, c.style.height = `${f}px`, n._totalCols > 1) {
2870
3052
  const m = 100 / n._totalCols;
2871
3053
  c.style.left = `${n._col * m}%`, c.style.width = `${m}%`;
2872
3054
  }
2873
3055
  }
2874
3056
  if (typeof l == "function") {
2875
- const u = l(n, o), p = document.createElement("div");
2876
- p.classList.add("cal-sched-event__custom"), u instanceof HTMLElement ? p.appendChild(u) : u != null && (p.textContent = String(u)), c.appendChild(p);
3057
+ const u = l(n, o), g = document.createElement("div");
3058
+ g.classList.add("cal-sched-event__custom"), u instanceof HTMLElement ? g.appendChild(u) : u != null && (g.textContent = String(u)), c.appendChild(g);
2877
3059
  } else {
2878
3060
  const u = document.createElement("div");
2879
3061
  if (u.classList.add("cal-sched-event__title"), u.textContent = n.title || "", c.appendChild(u), r && n.startTime && n.endTime) {
2880
- const p = document.createElement("div");
2881
- p.classList.add("cal-sched-event__time");
2882
- const _ = le(n.startTime), m = le(n.endTime);
2883
- _ && m && (p.textContent = `${he(_.hours, _.minutes, s)}–${he(m.hours, m.minutes, s)}`), c.appendChild(p);
3062
+ const g = document.createElement("div");
3063
+ g.classList.add("cal-sched-event__time");
3064
+ const f = le(n.startTime), m = le(n.endTime);
3065
+ f && m && (g.textContent = `${he(f.hours, f.minutes, s)}–${he(m.hours, m.minutes, s)}`), c.appendChild(g);
2884
3066
  }
2885
3067
  }
2886
3068
  if (h && !d) {
@@ -2897,7 +3079,7 @@ function De({ event: n, gridStartTime: e, slotHeight: a, interval: t, format: s,
2897
3079
  (u.key === "Enter" || u.key === " ") && (u.preventDefault(), u.stopPropagation(), i(n));
2898
3080
  })), c;
2899
3081
  }
2900
- function ft({ event: n, onClick: e, eventContent: a, resource: t }) {
3082
+ function kt({ event: n, onClick: e, eventContent: a, resource: t }) {
2901
3083
  const s = document.createElement("div");
2902
3084
  s.classList.add("cal-sched-allday-chip"), s.dataset.eventId = n.id;
2903
3085
  const i = n.color || "blue";
@@ -2910,7 +3092,7 @@ function ft({ event: n, onClick: e, eventContent: a, resource: t }) {
2910
3092
  l.stopPropagation(), e(n);
2911
3093
  }), s;
2912
3094
  }
2913
- function Jt({ event: n, format: e, onClick: a, eventContent: t, resource: s }) {
3095
+ function ta({ event: n, format: e, onClick: a, eventContent: t, resource: s }) {
2914
3096
  const i = document.createElement("div");
2915
3097
  i.classList.add("cal-sched-month-chip"), i.dataset.eventId = n.id;
2916
3098
  const l = n.color || "blue";
@@ -2932,7 +3114,7 @@ function Jt({ event: n, format: e, onClick: a, eventContent: t, resource: s }) {
2932
3114
  r.stopPropagation(), a(n);
2933
3115
  }), i;
2934
3116
  }
2935
- const Zt = `
3117
+ const aa = `
2936
3118
  .cal-sched-event {
2937
3119
  position: absolute;
2938
3120
  left: 2px;
@@ -3070,7 +3252,7 @@ function we({ date: n, startTime: e, endTime: a, resourceName: t, format: s, onC
3070
3252
  h.stopPropagation(), i == null || i();
3071
3253
  }), l.appendChild(o), l.addEventListener("click", (h) => h.stopPropagation()), l;
3072
3254
  }
3073
- const Qt = `
3255
+ const sa = `
3074
3256
  .cal-sched-slot-prompt {
3075
3257
  position: absolute;
3076
3258
  z-index: 10;
@@ -3135,7 +3317,7 @@ const Qt = `
3135
3317
  box-shadow: inset 0 0 0 1.5px hsl(var(--cal-accent));
3136
3318
  }
3137
3319
  `;
3138
- function ea({
3320
+ function na({
3139
3321
  date: n,
3140
3322
  resources: e,
3141
3323
  events: a,
@@ -3148,129 +3330,129 @@ function ea({
3148
3330
  resourceMode: h,
3149
3331
  selectedSlot: c,
3150
3332
  eventContent: d,
3151
- showTime: g = !0,
3333
+ showTime: p = !0,
3152
3334
  draggable: u,
3153
- onSlotClick: p,
3154
- onEventClick: _,
3335
+ onSlotClick: g,
3336
+ onEventClick: f,
3155
3337
  onSlotCreate: m
3156
3338
  }) {
3157
- const v = document.createElement("div");
3158
- v.classList.add("cal-sched-day"), o === "horizontal" && v.classList.add("cal-sched-day--horizontal");
3159
- const C = h === "tabs", k = e.length > 1 && !C, S = ke(a, n), B = S.filter((x) => !x.startTime || !x.endTime), V = S.filter((x) => x.startTime && x.endTime), O = Ee(t, s, i);
3160
- if (B.length > 0) {
3161
- const x = document.createElement("div");
3162
- x.classList.add("cal-sched-day__allday");
3163
- const f = document.createElement("div");
3164
- f.classList.add("cal-sched-day__allday-label"), f.textContent = "All day", x.appendChild(f);
3165
- const F = document.createElement("div");
3166
- F.classList.add("cal-sched-day__allday-chips");
3167
- for (const R of B) {
3168
- const L = e.find((y) => y.id === R.resourceId);
3169
- F.appendChild(ft({
3170
- event: R,
3171
- onClick: (y) => _ == null ? void 0 : _(y, R.resourceId, L),
3339
+ const b = document.createElement("div");
3340
+ b.classList.add("cal-sched-day"), o === "horizontal" && b.classList.add("cal-sched-day--horizontal");
3341
+ const y = h === "tabs", w = e.length > 1 && !y, A = ke(a, n), I = A.filter((k) => !k.startTime || !k.endTime), q = A.filter((k) => k.startTime && k.endTime), B = Ee(t, s, i);
3342
+ if (I.length > 0) {
3343
+ const k = document.createElement("div");
3344
+ k.classList.add("cal-sched-day__allday");
3345
+ const L = document.createElement("div");
3346
+ L.classList.add("cal-sched-day__allday-label"), L.textContent = "All day", k.appendChild(L);
3347
+ const W = document.createElement("div");
3348
+ W.classList.add("cal-sched-day__allday-chips");
3349
+ for (const v of I) {
3350
+ const C = e.find((x) => x.id === v.resourceId);
3351
+ W.appendChild(kt({
3352
+ event: v,
3353
+ onClick: (x) => f == null ? void 0 : f(x, v.resourceId, C),
3172
3354
  eventContent: d,
3173
- resource: L
3355
+ resource: C
3174
3356
  }));
3175
3357
  }
3176
- x.appendChild(F), v.appendChild(x);
3177
- }
3178
- if (k) {
3179
- const x = document.createElement("div");
3180
- x.classList.add("cal-sched-day__header");
3181
- const f = document.createElement("div");
3182
- f.classList.add("cal-sched-day__header-spacer"), x.appendChild(f), x.appendChild(Ut({ resources: e })), v.appendChild(x);
3183
- }
3184
- const N = document.createElement("div");
3185
- N.classList.add("cal-sched-day__grid-area"), N.appendChild(mt({ startTime: t, endTime: s, interval: i, slotHeight: l, format: r }));
3186
- const I = document.createElement("div");
3187
- if (I.classList.add("cal-sched-day__lanes"), k)
3188
- for (const x of e) {
3189
- const f = document.createElement("div");
3190
- f.classList.add("cal-sched-day__lane"), f.style.flex = "1 1 0", f.dataset.resourceId = x.id, f.dataset.date = n;
3191
- for (let L = 0; L < O.length; L++) {
3192
- const y = document.createElement("div");
3193
- y.classList.add("cal-sched-day__slot"), y.style.height = `${l}px`, y.dataset.time = O[L], y.dataset.resourceId = x.id;
3194
- const H = L < O.length - 1 ? O[L + 1] : s;
3195
- c && c.date === n && c.startTime === O[L] && c.resourceId === x.id && (y.classList.add("cal-sched-day__slot--selected"), y.appendChild(we({
3358
+ k.appendChild(W), b.appendChild(k);
3359
+ }
3360
+ if (w) {
3361
+ const k = document.createElement("div");
3362
+ k.classList.add("cal-sched-day__header");
3363
+ const L = document.createElement("div");
3364
+ L.classList.add("cal-sched-day__header-spacer"), k.appendChild(L), k.appendChild(Qt({ resources: e })), b.appendChild(k);
3365
+ }
3366
+ const j = document.createElement("div");
3367
+ j.classList.add("cal-sched-day__grid-area"), j.appendChild(xt({ startTime: t, endTime: s, interval: i, slotHeight: l, format: r }));
3368
+ const H = document.createElement("div");
3369
+ if (H.classList.add("cal-sched-day__lanes"), w)
3370
+ for (const k of e) {
3371
+ const L = document.createElement("div");
3372
+ L.classList.add("cal-sched-day__lane"), L.style.flex = "1 1 0", L.dataset.resourceId = k.id, L.dataset.date = n;
3373
+ for (let C = 0; C < B.length; C++) {
3374
+ const x = document.createElement("div");
3375
+ x.classList.add("cal-sched-day__slot"), x.style.height = `${l}px`, x.dataset.time = B[C], x.dataset.resourceId = k.id;
3376
+ const T = C < B.length - 1 ? B[C + 1] : s;
3377
+ c && c.date === n && c.startTime === B[C] && c.resourceId === k.id && (x.classList.add("cal-sched-day__slot--selected"), x.appendChild(we({
3196
3378
  date: n,
3197
- startTime: O[L],
3198
- endTime: H,
3199
- resourceName: x.name,
3379
+ startTime: B[C],
3380
+ endTime: T,
3381
+ resourceName: k.name,
3200
3382
  format: r,
3201
- onCreate: () => m == null ? void 0 : m(n, O[L], H, x.id, x)
3202
- }))), y.addEventListener("click", () => {
3203
- p == null || p(n, O[L], H, x.id, x);
3204
- }), f.appendChild(y);
3383
+ onCreate: () => m == null ? void 0 : m(n, B[C], T, k.id, k)
3384
+ }))), x.addEventListener("click", () => {
3385
+ g == null || g(n, B[C], T, k.id, k);
3386
+ }), L.appendChild(x);
3205
3387
  }
3206
- const F = V.filter((L) => L.resourceId === x.id), R = Ce(F);
3207
- for (const L of R)
3208
- f.appendChild(De({
3209
- event: L,
3388
+ const W = q.filter((C) => C.resourceId === k.id), v = Te(W);
3389
+ for (const C of v)
3390
+ L.appendChild(Se({
3391
+ event: C,
3210
3392
  gridStartTime: t,
3211
3393
  slotHeight: l,
3212
3394
  interval: i,
3213
3395
  format: r,
3214
- onClick: (y) => _ == null ? void 0 : _(y, x.id, x),
3396
+ onClick: (x) => f == null ? void 0 : f(x, k.id, k),
3215
3397
  eventContent: d,
3216
- showTime: g,
3217
- resource: x,
3398
+ showTime: p,
3399
+ resource: k,
3218
3400
  draggable: u
3219
3401
  }));
3220
- I.appendChild(f);
3402
+ H.appendChild(L);
3221
3403
  }
3222
3404
  else {
3223
- const x = document.createElement("div");
3224
- x.classList.add("cal-sched-day__lane"), x.style.flex = "1 1 0", x.dataset.date = n;
3225
- const f = e.length === 1 ? e[0] : null;
3226
- f && (x.dataset.resourceId = f.id);
3227
- for (let R = 0; R < O.length; R++) {
3228
- const L = document.createElement("div");
3229
- L.classList.add("cal-sched-day__slot"), L.style.height = `${l}px`, L.dataset.time = O[R];
3230
- const y = R < O.length - 1 ? O[R + 1] : s, H = (f == null ? void 0 : f.id) || null;
3231
- c && c.date === n && c.startTime === O[R] && (c.resourceId === H || !c.resourceId && !H) && (L.classList.add("cal-sched-day__slot--selected"), L.appendChild(we({
3405
+ const k = document.createElement("div");
3406
+ k.classList.add("cal-sched-day__lane"), k.style.flex = "1 1 0", k.dataset.date = n;
3407
+ const L = e.length === 1 ? e[0] : null;
3408
+ L && (k.dataset.resourceId = L.id);
3409
+ for (let v = 0; v < B.length; v++) {
3410
+ const C = document.createElement("div");
3411
+ C.classList.add("cal-sched-day__slot"), C.style.height = `${l}px`, C.dataset.time = B[v];
3412
+ const x = v < B.length - 1 ? B[v + 1] : s, T = (L == null ? void 0 : L.id) || null;
3413
+ c && c.date === n && c.startTime === B[v] && (c.resourceId === T || !c.resourceId && !T) && (C.classList.add("cal-sched-day__slot--selected"), C.appendChild(we({
3232
3414
  date: n,
3233
- startTime: O[R],
3234
- endTime: y,
3235
- resourceName: (f == null ? void 0 : f.name) || null,
3415
+ startTime: B[v],
3416
+ endTime: x,
3417
+ resourceName: (L == null ? void 0 : L.name) || null,
3236
3418
  format: r,
3237
- onCreate: () => m == null ? void 0 : m(n, O[R], y, H, f)
3238
- }))), L.addEventListener("click", () => {
3239
- p == null || p(n, O[R], y, H, f);
3240
- }), x.appendChild(L);
3419
+ onCreate: () => m == null ? void 0 : m(n, B[v], x, T, L)
3420
+ }))), C.addEventListener("click", () => {
3421
+ g == null || g(n, B[v], x, T, L);
3422
+ }), k.appendChild(C);
3241
3423
  }
3242
- const F = Ce(V);
3243
- for (const R of F) {
3244
- const L = e.find((y) => y.id === R.resourceId) || e[0];
3245
- x.appendChild(De({
3246
- event: R,
3424
+ const W = Te(q);
3425
+ for (const v of W) {
3426
+ const C = e.find((x) => x.id === v.resourceId) || e[0];
3427
+ k.appendChild(Se({
3428
+ event: v,
3247
3429
  gridStartTime: t,
3248
3430
  slotHeight: l,
3249
3431
  interval: i,
3250
3432
  format: r,
3251
- onClick: (y) => _ == null ? void 0 : _(y, R.resourceId, L),
3433
+ onClick: (x) => f == null ? void 0 : f(x, v.resourceId, C),
3252
3434
  eventContent: d,
3253
- showTime: g,
3254
- resource: L,
3435
+ showTime: p,
3436
+ resource: C,
3255
3437
  draggable: u
3256
3438
  }));
3257
3439
  }
3258
- I.appendChild(x);
3259
- }
3260
- N.appendChild(I);
3261
- const M = me();
3262
- if (de(n, M)) {
3263
- const x = ht(), f = b(x), F = b(t), R = b(s);
3264
- if (f >= F && f <= R) {
3265
- const L = pe(x, t, l, i), y = document.createElement("div");
3266
- y.classList.add("cal-sched-now-line"), y.style.top = `${L}px`;
3267
- const H = document.createElement("div");
3268
- H.classList.add("cal-sched-now-line__dot"), y.appendChild(H), I.appendChild(y);
3440
+ H.appendChild(k);
3441
+ }
3442
+ j.appendChild(H);
3443
+ const F = me();
3444
+ if (de(n, F)) {
3445
+ const k = bt(), L = _(k), W = _(t), v = _(s);
3446
+ if (L >= W && L <= v) {
3447
+ const C = pe(k, t, l, i), x = document.createElement("div");
3448
+ x.classList.add("cal-sched-now-line"), x.style.top = `${C}px`;
3449
+ const T = document.createElement("div");
3450
+ T.classList.add("cal-sched-now-line__dot"), x.appendChild(T), H.appendChild(x);
3269
3451
  }
3270
3452
  }
3271
- return v.appendChild(N), v;
3453
+ return b.appendChild(j), b;
3272
3454
  }
3273
- const ta = `
3455
+ const ia = `
3274
3456
  .cal-sched-day {
3275
3457
  display: flex;
3276
3458
  flex-direction: column;
@@ -3409,8 +3591,8 @@ const ta = `
3409
3591
  justify-content: center;
3410
3592
  padding: 4px 0;
3411
3593
  }
3412
- `, Pe = 3, He = 5;
3413
- function aa({
3594
+ `, Be = 3, Oe = 5;
3595
+ function la({
3414
3596
  date: n,
3415
3597
  firstDay: e,
3416
3598
  resources: a,
@@ -3423,195 +3605,195 @@ function aa({
3423
3605
  layout: h,
3424
3606
  resourceMode: c,
3425
3607
  selectedSlot: d,
3426
- eventContent: g,
3608
+ eventContent: p,
3427
3609
  showTime: u = !0,
3428
- draggable: p,
3429
- allDayCollapsed: _,
3610
+ draggable: g,
3611
+ allDayCollapsed: f,
3430
3612
  onToggleAllDay: m,
3431
- onSlotClick: v,
3432
- onEventClick: C,
3433
- onSlotCreate: k
3613
+ onSlotClick: b,
3614
+ onEventClick: y,
3615
+ onSlotCreate: w
3434
3616
  }) {
3435
- const S = document.createElement("div");
3436
- S.classList.add("cal-sched-week"), h === "horizontal" && S.classList.add("cal-sched-week--horizontal");
3437
- const B = Be(n, e), V = c === "tabs", O = a.length > 1 && !V, N = Ee(s, i, l), I = me(), M = {};
3438
- for (const y of B) {
3439
- const H = ke(t, y).filter((K) => !K.startTime || !K.endTime);
3440
- H.length && (M[y] = H);
3441
- }
3442
- if (Object.keys(M).length > 0) {
3443
- const y = document.createElement("div");
3444
- y.classList.add("cal-sched-week__allday"), _ && y.classList.add("cal-sched-week__allday--collapsed");
3445
- const H = document.createElement("div");
3446
- H.classList.add("cal-sched-week__allday-spacer");
3447
- const K = document.createElement("span");
3448
- K.textContent = "All day", H.appendChild(K);
3449
- const E = document.createElement("button");
3450
- E.classList.add("cal-sched-week__allday-toggle"), E.setAttribute("aria-label", _ ? "Expand all-day events" : "Collapse all-day events"), E.innerHTML = _ ? '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5l3 3 3-3"/></svg>' : '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7l3-3 3 3"/></svg>', E.addEventListener("click", (Y) => {
3451
- Y.stopPropagation(), m == null || m();
3452
- }), H.appendChild(E), y.appendChild(H);
3453
- for (const Y of B) {
3454
- const W = document.createElement("div");
3455
- W.classList.add("cal-sched-week__allday-cell");
3456
- const $ = M[Y] || [];
3457
- if (_) {
3458
- if ($.length > 0) {
3459
- const T = document.createElement("div");
3460
- T.classList.add("cal-sched-week__allday-dots");
3461
- const z = $.slice(0, He);
3462
- for (const q of z) {
3617
+ const A = document.createElement("div");
3618
+ A.classList.add("cal-sched-week"), h === "horizontal" && A.classList.add("cal-sched-week--horizontal");
3619
+ const I = Fe(n, e), q = c === "tabs", B = a.length > 1 && !q, j = Ee(s, i, l), H = me(), F = {};
3620
+ for (const x of I) {
3621
+ const T = ke(t, x).filter((X) => !X.startTime || !X.endTime);
3622
+ T.length && (F[x] = T);
3623
+ }
3624
+ if (Object.keys(F).length > 0) {
3625
+ const x = document.createElement("div");
3626
+ x.classList.add("cal-sched-week__allday"), f && x.classList.add("cal-sched-week__allday--collapsed");
3627
+ const T = document.createElement("div");
3628
+ T.classList.add("cal-sched-week__allday-spacer");
3629
+ const X = document.createElement("span");
3630
+ X.textContent = "All day", T.appendChild(X);
3631
+ const Y = document.createElement("button");
3632
+ Y.classList.add("cal-sched-week__allday-toggle"), Y.setAttribute("aria-label", f ? "Expand all-day events" : "Collapse all-day events"), Y.innerHTML = f ? '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5l3 3 3-3"/></svg>' : '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7l3-3 3 3"/></svg>', Y.addEventListener("click", (R) => {
3633
+ R.stopPropagation(), m == null || m();
3634
+ }), T.appendChild(Y), x.appendChild(T);
3635
+ for (const R of I) {
3636
+ const O = document.createElement("div");
3637
+ O.classList.add("cal-sched-week__allday-cell");
3638
+ const S = F[R] || [];
3639
+ if (f) {
3640
+ if (S.length > 0) {
3641
+ const M = document.createElement("div");
3642
+ M.classList.add("cal-sched-week__allday-dots");
3643
+ const z = S.slice(0, Oe);
3644
+ for (const G of z) {
3463
3645
  const Q = document.createElement("span");
3464
3646
  Q.classList.add("cal-sched-week__allday-dot");
3465
- const be = q.color || "blue";
3466
- Q.style.background = `hsl(var(--cal-booking-${be}-fg))`, T.appendChild(Q);
3647
+ const ne = G.color || "blue";
3648
+ Q.style.background = `hsl(var(--cal-booking-${ne}-fg))`, M.appendChild(Q);
3467
3649
  }
3468
- if ($.length > He) {
3469
- const q = document.createElement("span");
3470
- q.classList.add("cal-sched-week__allday-overflow"), q.textContent = `+${$.length - He}`, T.appendChild(q);
3650
+ if (S.length > Oe) {
3651
+ const G = document.createElement("span");
3652
+ G.classList.add("cal-sched-week__allday-overflow"), G.textContent = `+${S.length - Oe}`, M.appendChild(G);
3471
3653
  }
3472
- W.appendChild(T);
3654
+ O.appendChild(M);
3473
3655
  }
3474
3656
  } else {
3475
- const T = $.slice(0, Pe);
3476
- for (const z of T) {
3477
- const q = a.find((Q) => Q.id === z.resourceId);
3478
- W.appendChild(ft({
3657
+ const M = S.slice(0, Be);
3658
+ for (const z of M) {
3659
+ const G = a.find((Q) => Q.id === z.resourceId);
3660
+ O.appendChild(kt({
3479
3661
  event: z,
3480
- onClick: (Q) => C == null ? void 0 : C(Q, z.resourceId, q),
3481
- eventContent: g,
3482
- resource: q
3662
+ onClick: (Q) => y == null ? void 0 : y(Q, z.resourceId, G),
3663
+ eventContent: p,
3664
+ resource: G
3483
3665
  }));
3484
3666
  }
3485
- if ($.length > Pe) {
3667
+ if (S.length > Be) {
3486
3668
  const z = document.createElement("span");
3487
- z.classList.add("cal-sched-week__allday-overflow"), z.textContent = `+${$.length - Pe}`, W.appendChild(z);
3669
+ z.classList.add("cal-sched-week__allday-overflow"), z.textContent = `+${S.length - Be}`, O.appendChild(z);
3488
3670
  }
3489
3671
  }
3490
- y.appendChild(W);
3672
+ x.appendChild(O);
3491
3673
  }
3492
- S.appendChild(y);
3674
+ A.appendChild(x);
3493
3675
  }
3494
- const f = document.createElement("div");
3495
- f.classList.add("cal-sched-week__header");
3496
- const F = document.createElement("div");
3497
- F.classList.add("cal-sched-week__header-spacer"), f.appendChild(F);
3498
- for (const y of B) {
3499
- const H = G(y), K = document.createElement("div");
3500
- K.classList.add("cal-sched-week__day-header"), de(y, I) && K.classList.add("cal-sched-week__day-header--today");
3501
- const E = document.createElement("span");
3502
- E.classList.add("cal-sched-week__day-name"), E.textContent = Qe(y);
3676
+ const L = document.createElement("div");
3677
+ L.classList.add("cal-sched-week__header");
3678
+ const W = document.createElement("div");
3679
+ W.classList.add("cal-sched-week__header-spacer"), L.appendChild(W);
3680
+ for (const x of I) {
3681
+ const T = U(x), X = document.createElement("div");
3682
+ X.classList.add("cal-sched-week__day-header"), de(x, H) && X.classList.add("cal-sched-week__day-header--today");
3503
3683
  const Y = document.createElement("span");
3504
- if (Y.classList.add("cal-sched-week__day-num"), de(y, I) && Y.classList.add("cal-sched-week__day-num--today"), Y.textContent = H ? H.getDate() : "", K.appendChild(E), K.appendChild(Y), O) {
3505
- const W = document.createElement("div");
3506
- W.classList.add("cal-sched-week__res-row");
3507
- for (const $ of a) {
3508
- const T = document.createElement("span");
3509
- T.classList.add("cal-sched-week__res-label");
3684
+ Y.classList.add("cal-sched-week__day-name"), Y.textContent = nt(x);
3685
+ const R = document.createElement("span");
3686
+ if (R.classList.add("cal-sched-week__day-num"), de(x, H) && R.classList.add("cal-sched-week__day-num--today"), R.textContent = T ? T.getDate() : "", X.appendChild(Y), X.appendChild(R), B) {
3687
+ const O = document.createElement("div");
3688
+ O.classList.add("cal-sched-week__res-row");
3689
+ for (const S of a) {
3690
+ const M = document.createElement("span");
3691
+ M.classList.add("cal-sched-week__res-label");
3510
3692
  const z = document.createElement("span");
3511
- z.classList.add("cal-sched-week__res-dot"), z.style.background = `hsl(var(--cal-booking-${$.color || "blue"}-fg))`, T.appendChild(z), T.appendChild(document.createTextNode($.name)), W.appendChild(T);
3693
+ z.classList.add("cal-sched-week__res-dot"), z.style.background = `hsl(var(--cal-booking-${S.color || "blue"}-fg))`, M.appendChild(z), M.appendChild(document.createTextNode(S.name)), O.appendChild(M);
3512
3694
  }
3513
- K.appendChild(W);
3695
+ X.appendChild(O);
3514
3696
  }
3515
- f.appendChild(K);
3697
+ L.appendChild(X);
3516
3698
  }
3517
- S.appendChild(f);
3518
- const R = document.createElement("div");
3519
- R.classList.add("cal-sched-week__grid-area"), R.appendChild(mt({ startTime: s, endTime: i, interval: l, slotHeight: r, format: o }));
3520
- const L = document.createElement("div");
3521
- L.classList.add("cal-sched-week__cols");
3522
- for (const y of B) {
3523
- const H = document.createElement("div");
3524
- H.classList.add("cal-sched-week__day-col"), H.dataset.date = y, de(y, I) && H.classList.add("cal-sched-week__day-col--today");
3525
- const K = ke(t, y).filter((E) => E.startTime && E.endTime);
3526
- if (O)
3527
- for (const E of a) {
3528
- const Y = document.createElement("div");
3529
- Y.classList.add("cal-sched-week__lane"), Y.dataset.resourceId = E.id;
3530
- for (let T = 0; T < N.length; T++) {
3699
+ A.appendChild(L);
3700
+ const v = document.createElement("div");
3701
+ v.classList.add("cal-sched-week__grid-area"), v.appendChild(xt({ startTime: s, endTime: i, interval: l, slotHeight: r, format: o }));
3702
+ const C = document.createElement("div");
3703
+ C.classList.add("cal-sched-week__cols");
3704
+ for (const x of I) {
3705
+ const T = document.createElement("div");
3706
+ T.classList.add("cal-sched-week__day-col"), T.dataset.date = x, de(x, H) && T.classList.add("cal-sched-week__day-col--today");
3707
+ const X = ke(t, x).filter((Y) => Y.startTime && Y.endTime);
3708
+ if (B)
3709
+ for (const Y of a) {
3710
+ const R = document.createElement("div");
3711
+ R.classList.add("cal-sched-week__lane"), R.dataset.resourceId = Y.id;
3712
+ for (let M = 0; M < j.length; M++) {
3531
3713
  const z = document.createElement("div");
3532
- z.classList.add("cal-sched-week__slot"), z.style.height = `${r}px`, z.dataset.time = N[T];
3533
- const q = T < N.length - 1 ? N[T + 1] : i;
3534
- d && d.date === y && d.startTime === N[T] && d.resourceId === E.id && (z.classList.add("cal-sched-week__slot--selected"), z.appendChild(we({
3535
- date: y,
3536
- startTime: N[T],
3537
- endTime: q,
3538
- resourceName: E.name,
3714
+ z.classList.add("cal-sched-week__slot"), z.style.height = `${r}px`, z.dataset.time = j[M];
3715
+ const G = M < j.length - 1 ? j[M + 1] : i;
3716
+ d && d.date === x && d.startTime === j[M] && d.resourceId === Y.id && (z.classList.add("cal-sched-week__slot--selected"), z.appendChild(we({
3717
+ date: x,
3718
+ startTime: j[M],
3719
+ endTime: G,
3720
+ resourceName: Y.name,
3539
3721
  format: o,
3540
- onCreate: () => k == null ? void 0 : k(y, N[T], q, E.id, E)
3722
+ onCreate: () => w == null ? void 0 : w(x, j[M], G, Y.id, Y)
3541
3723
  }))), z.addEventListener("click", () => {
3542
- v == null || v(y, N[T], q, E.id, E);
3543
- }), Y.appendChild(z);
3724
+ b == null || b(x, j[M], G, Y.id, Y);
3725
+ }), R.appendChild(z);
3544
3726
  }
3545
- const W = K.filter((T) => T.resourceId === E.id), $ = Ce(W);
3546
- for (const T of $)
3547
- Y.appendChild(De({
3548
- event: T,
3727
+ const O = X.filter((M) => M.resourceId === Y.id), S = Te(O);
3728
+ for (const M of S)
3729
+ R.appendChild(Se({
3730
+ event: M,
3549
3731
  gridStartTime: s,
3550
3732
  slotHeight: r,
3551
3733
  interval: l,
3552
3734
  format: o,
3553
- onClick: (z) => C == null ? void 0 : C(z, E.id, E),
3554
- eventContent: g,
3735
+ onClick: (z) => y == null ? void 0 : y(z, Y.id, Y),
3736
+ eventContent: p,
3555
3737
  showTime: u,
3556
- resource: E,
3557
- draggable: p
3738
+ resource: Y,
3739
+ draggable: g
3558
3740
  }));
3559
- H.appendChild(Y);
3741
+ T.appendChild(R);
3560
3742
  }
3561
3743
  else {
3562
- const E = document.createElement("div");
3563
- E.classList.add("cal-sched-week__lane", "cal-sched-week__lane--full");
3564
- const Y = a.length === 1 ? a[0] : null;
3565
- Y && (E.dataset.resourceId = Y.id);
3566
- for (let $ = 0; $ < N.length; $++) {
3567
- const T = document.createElement("div");
3568
- T.classList.add("cal-sched-week__slot"), T.style.height = `${r}px`, T.dataset.time = N[$];
3569
- const z = $ < N.length - 1 ? N[$ + 1] : i, q = (Y == null ? void 0 : Y.id) || null;
3570
- d && d.date === y && d.startTime === N[$] && (d.resourceId === q || !d.resourceId && !q) && (T.classList.add("cal-sched-week__slot--selected"), T.appendChild(we({
3571
- date: y,
3572
- startTime: N[$],
3744
+ const Y = document.createElement("div");
3745
+ Y.classList.add("cal-sched-week__lane", "cal-sched-week__lane--full");
3746
+ const R = a.length === 1 ? a[0] : null;
3747
+ R && (Y.dataset.resourceId = R.id);
3748
+ for (let S = 0; S < j.length; S++) {
3749
+ const M = document.createElement("div");
3750
+ M.classList.add("cal-sched-week__slot"), M.style.height = `${r}px`, M.dataset.time = j[S];
3751
+ const z = S < j.length - 1 ? j[S + 1] : i, G = (R == null ? void 0 : R.id) || null;
3752
+ d && d.date === x && d.startTime === j[S] && (d.resourceId === G || !d.resourceId && !G) && (M.classList.add("cal-sched-week__slot--selected"), M.appendChild(we({
3753
+ date: x,
3754
+ startTime: j[S],
3573
3755
  endTime: z,
3574
- resourceName: (Y == null ? void 0 : Y.name) || null,
3756
+ resourceName: (R == null ? void 0 : R.name) || null,
3575
3757
  format: o,
3576
- onCreate: () => k == null ? void 0 : k(y, N[$], z, q, Y)
3577
- }))), T.addEventListener("click", () => {
3578
- v == null || v(y, N[$], z, q, Y);
3579
- }), E.appendChild(T);
3758
+ onCreate: () => w == null ? void 0 : w(x, j[S], z, G, R)
3759
+ }))), M.addEventListener("click", () => {
3760
+ b == null || b(x, j[S], z, G, R);
3761
+ }), Y.appendChild(M);
3580
3762
  }
3581
- const W = Ce(K);
3582
- for (const $ of W) {
3583
- const T = a.find((z) => z.id === $.resourceId) || a[0];
3584
- E.appendChild(De({
3585
- event: $,
3763
+ const O = Te(X);
3764
+ for (const S of O) {
3765
+ const M = a.find((z) => z.id === S.resourceId) || a[0];
3766
+ Y.appendChild(Se({
3767
+ event: S,
3586
3768
  gridStartTime: s,
3587
3769
  slotHeight: r,
3588
3770
  interval: l,
3589
3771
  format: o,
3590
- onClick: (z) => C == null ? void 0 : C(z, $.resourceId, T),
3591
- eventContent: g,
3772
+ onClick: (z) => y == null ? void 0 : y(z, S.resourceId, M),
3773
+ eventContent: p,
3592
3774
  showTime: u,
3593
- resource: T,
3594
- draggable: p
3775
+ resource: M,
3776
+ draggable: g
3595
3777
  }));
3596
3778
  }
3597
- H.appendChild(E);
3779
+ T.appendChild(Y);
3598
3780
  }
3599
- L.appendChild(H);
3600
- }
3601
- if (B.includes(I)) {
3602
- const y = ht(), H = b(y), K = b(s), E = b(i);
3603
- if (H >= K && H <= E) {
3604
- const Y = B.indexOf(I), W = pe(y, s, r, l), $ = document.createElement("div");
3605
- $.classList.add("cal-sched-now-line", "cal-sched-now-line--week"), $.style.top = `${W}px`;
3606
- const T = 100 / 7;
3607
- $.style.left = `${Y * T}%`, $.style.width = `${T}%`;
3781
+ C.appendChild(T);
3782
+ }
3783
+ if (I.includes(H)) {
3784
+ const x = bt(), T = _(x), X = _(s), Y = _(i);
3785
+ if (T >= X && T <= Y) {
3786
+ const R = I.indexOf(H), O = pe(x, s, r, l), S = document.createElement("div");
3787
+ S.classList.add("cal-sched-now-line", "cal-sched-now-line--week"), S.style.top = `${O}px`;
3788
+ const M = 100 / 7;
3789
+ S.style.left = `${R * M}%`, S.style.width = `${M}%`;
3608
3790
  const z = document.createElement("div");
3609
- z.classList.add("cal-sched-now-line__dot"), $.appendChild(z), L.appendChild($);
3791
+ z.classList.add("cal-sched-now-line__dot"), S.appendChild(z), C.appendChild(S);
3610
3792
  }
3611
3793
  }
3612
- return R.appendChild(L), S.appendChild(R), S;
3794
+ return v.appendChild(C), A.appendChild(v), A;
3613
3795
  }
3614
- const sa = `
3796
+ const ra = `
3615
3797
  .cal-sched-week {
3616
3798
  display: flex;
3617
3799
  flex-direction: column;
@@ -3829,8 +4011,8 @@ const sa = `
3829
4011
  z-index: 5;
3830
4012
  pointer-events: none;
3831
4013
  }
3832
- `, Ze = 3;
3833
- function na({
4014
+ `, at = 3;
4015
+ function oa({
3834
4016
  date: n,
3835
4017
  firstDay: e,
3836
4018
  resources: a,
@@ -3845,59 +4027,59 @@ function na({
3845
4027
  }) {
3846
4028
  const d = document.createElement("div");
3847
4029
  d.classList.add("cal-sched-month");
3848
- const g = G(n);
3849
- if (!g) return d;
3850
- const u = g.getFullYear(), p = g.getMonth();
4030
+ const p = U(n);
4031
+ if (!p) return d;
4032
+ const u = p.getFullYear(), g = p.getMonth();
3851
4033
  me();
3852
- const _ = document.createElement("div");
3853
- _.classList.add("cal-sched-month__weekdays");
3854
- const m = et(e);
3855
- for (const k of m) {
3856
- const S = document.createElement("div");
3857
- S.classList.add("cal-sched-month__weekday"), S.textContent = k, _.appendChild(S);
3858
- }
3859
- d.appendChild(_);
3860
- const v = document.createElement("div");
3861
- v.classList.add("cal-sched-month__grid");
3862
- const C = tt(u, p, e);
3863
- for (const k of C) {
3864
- const S = document.createElement("div");
3865
- S.classList.add("cal-sched-month__cell"), k.isCurrentMonth || S.classList.add("cal-sched-month__cell--outside"), k.isToday && S.classList.add("cal-sched-month__cell--today"), l && k.dateString === l && S.classList.add("cal-sched-month__cell--selected"), S.addEventListener("click", (M) => {
3866
- M.target.closest(".cal-sched-month-chip") || o == null || o(k.dateString);
4034
+ const f = document.createElement("div");
4035
+ f.classList.add("cal-sched-month__weekdays");
4036
+ const m = it(e);
4037
+ for (const w of m) {
4038
+ const A = document.createElement("div");
4039
+ A.classList.add("cal-sched-month__weekday"), A.textContent = w, f.appendChild(A);
4040
+ }
4041
+ d.appendChild(f);
4042
+ const b = document.createElement("div");
4043
+ b.classList.add("cal-sched-month__grid");
4044
+ const y = lt(u, g, e);
4045
+ for (const w of y) {
4046
+ const A = document.createElement("div");
4047
+ A.classList.add("cal-sched-month__cell"), w.isCurrentMonth || A.classList.add("cal-sched-month__cell--outside"), w.isToday && A.classList.add("cal-sched-month__cell--today"), l && w.dateString === l && A.classList.add("cal-sched-month__cell--selected"), A.addEventListener("click", (F) => {
4048
+ F.target.closest(".cal-sched-month-chip") || o == null || o(w.dateString);
3867
4049
  });
4050
+ const I = document.createElement("div");
4051
+ I.classList.add("cal-sched-month__day-num"), w.isToday && I.classList.add("cal-sched-month__day-num--today"), I.textContent = w.day, A.appendChild(I);
4052
+ let q = ke(t, w.dateString);
4053
+ i && (q = q.filter((F) => F.resourceId === i)), q.sort((F, k) => F.startTime && !k.startTime ? -1 : !F.startTime && k.startTime ? 1 : F.startTime && k.startTime ? F.startTime.localeCompare(k.startTime) : 0);
3868
4054
  const B = document.createElement("div");
3869
- B.classList.add("cal-sched-month__day-num"), k.isToday && B.classList.add("cal-sched-month__day-num--today"), B.textContent = k.day, S.appendChild(B);
3870
- let V = ke(t, k.dateString);
3871
- i && (V = V.filter((M) => M.resourceId === i)), V.sort((M, x) => M.startTime && !x.startTime ? -1 : !M.startTime && x.startTime ? 1 : M.startTime && x.startTime ? M.startTime.localeCompare(x.startTime) : 0);
3872
- const O = document.createElement("div");
3873
- O.classList.add("cal-sched-month__events");
3874
- const N = V.slice(0, Ze), I = V.length - Ze;
3875
- for (const M of N) {
3876
- const x = a.find((f) => f.id === M.resourceId);
3877
- O.appendChild(Jt({
3878
- event: M,
4055
+ B.classList.add("cal-sched-month__events");
4056
+ const j = q.slice(0, at), H = q.length - at;
4057
+ for (const F of j) {
4058
+ const k = a.find((L) => L.id === F.resourceId);
4059
+ B.appendChild(ta({
4060
+ event: F,
3879
4061
  format: s,
3880
- onClick: (f) => h == null ? void 0 : h(f, M.resourceId, x),
4062
+ onClick: (L) => h == null ? void 0 : h(L, F.resourceId, k),
3881
4063
  eventContent: r,
3882
- resource: x
4064
+ resource: k
3883
4065
  }));
3884
4066
  }
3885
- if (I > 0) {
3886
- const M = document.createElement("div");
3887
- M.classList.add("cal-sched-month__more"), M.textContent = `+${I} more`, O.appendChild(M);
4067
+ if (H > 0) {
4068
+ const F = document.createElement("div");
4069
+ F.classList.add("cal-sched-month__more"), F.textContent = `+${H} more`, B.appendChild(F);
3888
4070
  }
3889
- S.appendChild(O), l && k.dateString === l && (S.style.position = "relative", S.appendChild(we({
3890
- date: k.dateString,
4071
+ A.appendChild(B), l && w.dateString === l && (A.style.position = "relative", A.appendChild(we({
4072
+ date: w.dateString,
3891
4073
  startTime: null,
3892
4074
  endTime: null,
3893
4075
  resourceName: null,
3894
4076
  format: s,
3895
- onCreate: () => c == null ? void 0 : c(k.dateString)
3896
- }))), v.appendChild(S);
4077
+ onCreate: () => c == null ? void 0 : c(w.dateString)
4078
+ }))), b.appendChild(A);
3897
4079
  }
3898
- return d.appendChild(v), d;
4080
+ return d.appendChild(b), d;
3899
4081
  }
3900
- const ia = `
4082
+ const ca = `
3901
4083
  .cal-sched-month {
3902
4084
  border: 1px solid hsl(var(--cal-sched-grid-line));
3903
4085
  border-radius: var(--cal-radius);
@@ -3982,7 +4164,7 @@ const ia = `
3982
4164
  color: hsl(var(--cal-fg));
3983
4165
  }
3984
4166
  `;
3985
- function la({ columns: n = 3, rows: e = 10, slotHeight: a = 48 } = {}) {
4167
+ function da({ columns: n = 3, rows: e = 10, slotHeight: a = 48 } = {}) {
3986
4168
  const t = document.createElement("div");
3987
4169
  t.setAttribute("role", "status"), t.setAttribute("aria-label", "Loading..."), t.classList.add("cal-sched-skeleton-grid");
3988
4170
  const s = document.createElement("div");
@@ -4004,8 +4186,8 @@ function la({ columns: n = 3, rows: e = 10, slotHeight: a = 48 } = {}) {
4004
4186
  for (let c = 0; c < n; c++) {
4005
4187
  const d = document.createElement("div");
4006
4188
  if (d.classList.add("cal-sched-skeleton-grid__cell"), Math.random() < 0.15) {
4007
- const g = document.createElement("div");
4008
- g.classList.add("cal-skeleton", "cal-skeleton--rect", "cal-sched-skeleton-grid__event"), g.style.height = `${a * (1 + Math.floor(Math.random() * 2))}px`, d.appendChild(g);
4189
+ const p = document.createElement("div");
4190
+ p.classList.add("cal-skeleton", "cal-skeleton--rect", "cal-sched-skeleton-grid__event"), p.style.height = `${a * (1 + Math.floor(Math.random() * 2))}px`, d.appendChild(p);
4009
4191
  }
4010
4192
  o.appendChild(d);
4011
4193
  }
@@ -4013,7 +4195,7 @@ function la({ columns: n = 3, rows: e = 10, slotHeight: a = 48 } = {}) {
4013
4195
  }
4014
4196
  return t.appendChild(l), t;
4015
4197
  }
4016
- function ra() {
4198
+ function ha() {
4017
4199
  const n = document.createElement("div");
4018
4200
  n.setAttribute("role", "status"), n.setAttribute("aria-label", "Loading..."), n.classList.add("cal-sched-skeleton-month");
4019
4201
  const e = document.createElement("div");
@@ -4039,7 +4221,7 @@ function ra() {
4039
4221
  }
4040
4222
  return n.appendChild(a), n;
4041
4223
  }
4042
- const oa = `
4224
+ const ua = `
4043
4225
  .cal-sched-skeleton-grid {
4044
4226
  border: 1px solid hsl(var(--cal-sched-grid-line));
4045
4227
  border-radius: var(--cal-radius);
@@ -4144,7 +4326,7 @@ const oa = `
4144
4326
  width: 85%;
4145
4327
  }
4146
4328
  `;
4147
- function ca({ event: n, resource: e, format: a, onClose: t, actions: s, onAction: i }) {
4329
+ function pa({ event: n, resource: e, format: a, onClose: t, actions: s, onAction: i }) {
4148
4330
  const l = document.createElement("div");
4149
4331
  l.classList.add("cal-sched-detail-backdrop"), l.addEventListener("click", t);
4150
4332
  const r = document.createElement("div");
@@ -4157,69 +4339,69 @@ function ca({ event: n, resource: e, format: a, onClose: t, actions: s, onAction
4157
4339
  if (d.classList.add("cal-sched-detail__title"), d.textContent = n.title || "Untitled", r.appendChild(d), n.startTime && n.endTime) {
4158
4340
  const u = document.createElement("div");
4159
4341
  u.classList.add("cal-sched-detail__row");
4160
- const p = document.createElement("span");
4161
- p.classList.add("cal-sched-detail__icon"), p.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="5.5"/><path d="M7 4v3.5l2.5 1.5"/></svg>', u.appendChild(p);
4162
- const _ = le(n.startTime), m = le(n.endTime), v = document.createElement("span");
4163
- _ && m && (v.textContent = `${he(_.hours, _.minutes, a)}–${he(m.hours, m.minutes, a)}`), u.appendChild(v), r.appendChild(u);
4342
+ const g = document.createElement("span");
4343
+ g.classList.add("cal-sched-detail__icon"), g.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="5.5"/><path d="M7 4v3.5l2.5 1.5"/></svg>', u.appendChild(g);
4344
+ const f = le(n.startTime), m = le(n.endTime), b = document.createElement("span");
4345
+ f && m && (b.textContent = `${he(f.hours, f.minutes, a)}–${he(m.hours, m.minutes, a)}`), u.appendChild(b), r.appendChild(u);
4164
4346
  }
4165
4347
  if (n.start) {
4166
4348
  const u = document.createElement("div");
4167
4349
  u.classList.add("cal-sched-detail__row");
4168
- const p = document.createElement("span");
4169
- p.classList.add("cal-sched-detail__icon"), p.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="1.5" y="2.5" width="11" height="9.5" rx="1.5"/><path d="M4.5 1v2.5M9.5 1v2.5M1.5 5.5h11"/></svg>', u.appendChild(p);
4170
- const _ = G(n.start), m = document.createElement("span");
4171
- if (_) {
4172
- let v = `${Qe(n.start, "long")}, ${ne[_.getMonth()]} ${_.getDate()}`;
4350
+ const g = document.createElement("span");
4351
+ g.classList.add("cal-sched-detail__icon"), g.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="1.5" y="2.5" width="11" height="9.5" rx="1.5"/><path d="M4.5 1v2.5M9.5 1v2.5M1.5 5.5h11"/></svg>', u.appendChild(g);
4352
+ const f = U(n.start), m = document.createElement("span");
4353
+ if (f) {
4354
+ let b = `${nt(n.start, "long")}, ${Ce[f.getMonth()]} ${f.getDate()}`;
4173
4355
  if (n.end && n.end !== n.start) {
4174
- const C = G(n.end);
4175
- C && (v += ` – ${ne[C.getMonth()]} ${C.getDate()}`);
4356
+ const y = U(n.end);
4357
+ y && (b += ` – ${Ce[y.getMonth()]} ${y.getDate()}`);
4176
4358
  }
4177
- m.textContent = v;
4359
+ m.textContent = b;
4178
4360
  }
4179
4361
  u.appendChild(m), r.appendChild(u);
4180
4362
  }
4181
4363
  if (e && e.name) {
4182
4364
  const u = document.createElement("div");
4183
4365
  u.classList.add("cal-sched-detail__row");
4184
- const p = document.createElement("span");
4185
- p.classList.add("cal-sched-detail__res-dot"), p.style.background = `hsl(var(--cal-booking-${e.color || "blue"}-fg))`, u.appendChild(p);
4186
- const _ = document.createElement("span");
4187
- _.textContent = e.name, e.capacity && (_.textContent += ` (capacity: ${e.capacity})`), u.appendChild(_), r.appendChild(u);
4366
+ const g = document.createElement("span");
4367
+ g.classList.add("cal-sched-detail__res-dot"), g.style.background = `hsl(var(--cal-booking-${e.color || "blue"}-fg))`, u.appendChild(g);
4368
+ const f = document.createElement("span");
4369
+ f.textContent = e.name, e.capacity && (f.textContent += ` (capacity: ${e.capacity})`), u.appendChild(f), r.appendChild(u);
4188
4370
  }
4189
4371
  if (n.metadata && typeof n.metadata == "object") {
4190
4372
  const u = Object.entries(n.metadata);
4191
4373
  if (u.length > 0) {
4192
- const p = document.createElement("div");
4193
- p.classList.add("cal-sched-detail__meta");
4194
- for (const [_, m] of u) {
4195
- const v = document.createElement("div");
4196
- v.classList.add("cal-sched-detail__meta-row");
4197
- const C = document.createElement("span");
4198
- C.classList.add("cal-sched-detail__meta-label"), C.textContent = _;
4199
- const k = document.createElement("span");
4200
- k.textContent = String(m), v.appendChild(C), v.appendChild(k), p.appendChild(v);
4374
+ const g = document.createElement("div");
4375
+ g.classList.add("cal-sched-detail__meta");
4376
+ for (const [f, m] of u) {
4377
+ const b = document.createElement("div");
4378
+ b.classList.add("cal-sched-detail__meta-row");
4379
+ const y = document.createElement("span");
4380
+ y.classList.add("cal-sched-detail__meta-label"), y.textContent = f;
4381
+ const w = document.createElement("span");
4382
+ w.textContent = String(m), b.appendChild(y), b.appendChild(w), g.appendChild(b);
4201
4383
  }
4202
- r.appendChild(p);
4384
+ r.appendChild(g);
4203
4385
  }
4204
4386
  }
4205
4387
  if (s && s.length > 0) {
4206
4388
  const u = document.createElement("div");
4207
4389
  u.classList.add("cal-sched-detail__actions");
4208
- for (const p of s) {
4209
- const _ = document.createElement("button");
4210
- _.classList.add("cal-sched-detail__action"), p.type === "danger" && _.classList.add("cal-sched-detail__action--danger"), _.textContent = p.label, _.addEventListener("click", () => {
4211
- i == null || i(p.label);
4212
- }), u.appendChild(_);
4390
+ for (const g of s) {
4391
+ const f = document.createElement("button");
4392
+ f.classList.add("cal-sched-detail__action"), g.type === "danger" && f.classList.add("cal-sched-detail__action--danger"), f.textContent = g.label, f.addEventListener("click", () => {
4393
+ i == null || i(g.label);
4394
+ }), u.appendChild(f);
4213
4395
  }
4214
4396
  r.appendChild(u);
4215
4397
  }
4216
4398
  l.appendChild(r);
4217
- const g = (u) => {
4399
+ const p = (u) => {
4218
4400
  u.key === "Escape" && t();
4219
4401
  };
4220
- return l.addEventListener("keydown", g), requestAnimationFrame(() => o.focus()), l;
4402
+ return l.addEventListener("keydown", p), requestAnimationFrame(() => o.focus()), l;
4221
4403
  }
4222
- const da = `
4404
+ const ga = `
4223
4405
  .cal-sched-detail-backdrop {
4224
4406
  position: absolute;
4225
4407
  inset: 0;
@@ -4358,7 +4540,7 @@ const da = `
4358
4540
  background: hsl(var(--cal-status-error-bg));
4359
4541
  }
4360
4542
  `;
4361
- function ha({ resources: n, selectedResourceId: e, onResourceFilter: a }) {
4543
+ function ma({ resources: n, selectedResourceId: e, onResourceFilter: a }) {
4362
4544
  const t = document.createElement("div");
4363
4545
  t.classList.add("cal-sched-res-tabs");
4364
4546
  const s = document.createElement("button");
@@ -4371,7 +4553,7 @@ function ha({ resources: n, selectedResourceId: e, onResourceFilter: a }) {
4371
4553
  }
4372
4554
  return t;
4373
4555
  }
4374
- const ua = `
4556
+ const fa = `
4375
4557
  .cal-sched-res-tabs {
4376
4558
  display: flex;
4377
4559
  gap: 4px;
@@ -4416,13 +4598,13 @@ const ua = `
4416
4598
  border-radius: 50%;
4417
4599
  }
4418
4600
  `;
4419
- function pa({ onClick: n }) {
4601
+ function ba({ onClick: n }) {
4420
4602
  const e = document.createElement("button");
4421
4603
  return e.classList.add("cal-sched-fab"), e.setAttribute("aria-label", "Create event"), e.innerHTML = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M10 4v12M4 10h12"/></svg>', e.addEventListener("click", (a) => {
4422
4604
  a.stopPropagation(), n == null || n();
4423
4605
  }), e;
4424
4606
  }
4425
- const ga = `
4607
+ const va = `
4426
4608
  .cal-sched-fab {
4427
4609
  position: absolute;
4428
4610
  bottom: 16px;
@@ -4454,40 +4636,40 @@ const ga = `
4454
4636
  outline: 2px solid hsl(var(--cal-ring));
4455
4637
  outline-offset: 2px;
4456
4638
  }
4457
- `, ma = 4;
4458
- function fa({ shadowRoot: n, getConfig: e, getViewInfo: a, getEvents: t, onMove: s, onResize: i, onCreate: l }) {
4459
- let r = !1, o = null, h = null, c = null, d = null, g = 0, u = 0, p = 0, _ = 0, m = !1, v = null, C = null, k = null, S = null, B = null, V = null, O = null, N = null, I = null, M = null, x = null, f = null, F = 0;
4460
- function R(w) {
4461
- if (!r || w.button !== 0) return;
4462
- const A = w.target.closest(".cal-sched-event__resize-handle"), P = w.target.closest('.cal-sched-event[data-draggable="true"]');
4639
+ `, _a = 4;
4640
+ function ya({ shadowRoot: n, getConfig: e, getViewInfo: a, getEvents: t, onMove: s, onResize: i, onCreate: l }) {
4641
+ let r = !1, o = null, h = null, c = null, d = null, p = 0, u = 0, g = 0, f = 0, m = !1, b = null, y = null, w = null, A = null, I = null, q = null, B = null, j = null, H = null, F = null, k = null, L = null, W = 0;
4642
+ function v(E) {
4643
+ if (!r || E.button !== 0) return;
4644
+ const $ = E.target.closest(".cal-sched-event__resize-handle"), P = E.target.closest('.cal-sched-event[data-draggable="true"]');
4463
4645
  if (P) {
4464
- const U = P.dataset.eventId;
4465
- if (h = t().find((j) => j.id === U), !h) return;
4466
- w.preventDefault(), w.stopPropagation(), N = P, O = w.pointerId, P.setPointerCapture(w.pointerId), p = w.clientX, _ = w.clientY, m = !1, C = h.startTime, v = h.endTime, k = h.start, S = h.resourceId, A ? (o = "resize", d = P, d.classList.add("cal-sched-event--resizing")) : (o = "move", d = P);
4646
+ const J = P.dataset.eventId;
4647
+ if (h = t().find((N) => N.id === J), !h) return;
4648
+ E.preventDefault(), E.stopPropagation(), j = P, B = E.pointerId, P.setPointerCapture(E.pointerId), g = E.clientX, f = E.clientY, m = !1, y = h.startTime, b = h.endTime, w = h.start, A = h.resourceId, $ ? (o = "resize", d = P, d.classList.add("cal-sched-event--resizing")) : (o = "move", d = P);
4467
4649
  } else {
4468
- const U = w.target.closest("[data-time]");
4469
- if (!U || w.target.closest(".cal-sched-slot-prompt")) return;
4470
- const D = H(w.clientX, w.clientY);
4650
+ const J = E.target.closest("[data-time]");
4651
+ if (!J || E.target.closest(".cal-sched-slot-prompt")) return;
4652
+ const D = T(E.clientX, E.clientY);
4471
4653
  if (!D) return;
4472
- w.preventDefault(), o = "create", p = w.clientX, _ = w.clientY, m = !1, M = D.date, x = D.resourceId, f = D.time;
4473
- const j = n.querySelectorAll("[data-time]");
4474
- j.length > 0 && (F = j[0].getBoundingClientRect().top), N = U, O = w.pointerId, U.setPointerCapture(w.pointerId);
4654
+ E.preventDefault(), o = "create", g = E.clientX, f = E.clientY, m = !1, F = D.date, k = D.resourceId, L = D.time;
4655
+ const N = n.querySelectorAll("[data-time]");
4656
+ N.length > 0 && (W = N[0].getBoundingClientRect().top), j = J, B = E.pointerId, J.setPointerCapture(E.pointerId);
4475
4657
  }
4476
- n.addEventListener("pointermove", L), n.addEventListener("pointerup", y);
4658
+ n.addEventListener("pointermove", C), n.addEventListener("pointerup", x);
4477
4659
  }
4478
- function L(w) {
4660
+ function C(E) {
4479
4661
  if (!o) return;
4480
- const A = w.clientX - p, P = w.clientY - _, U = Math.sqrt(A * A + P * P);
4481
- if (!(!m && U < ma)) {
4662
+ const $ = E.clientX - g, P = E.clientY - f, J = Math.sqrt($ * $ + P * P);
4663
+ if (!(!m && J < _a)) {
4482
4664
  if (m = !0, o === "move") {
4483
4665
  if (!c && d) {
4484
- const j = d.getBoundingClientRect();
4485
- g = p - j.left, u = _ - j.top, c = d.cloneNode(!0), c.classList.add("cal-sched-event--ghost"), c.style.cssText = `
4666
+ const N = d.getBoundingClientRect();
4667
+ p = g - N.left, u = f - N.top, c = d.cloneNode(!0), c.classList.add("cal-sched-event--ghost"), c.style.cssText = `
4486
4668
  position: fixed;
4487
- width: ${j.width}px;
4488
- height: ${j.height}px;
4489
- left: ${j.left}px;
4490
- top: ${j.top}px;
4669
+ width: ${N.width}px;
4670
+ height: ${N.height}px;
4671
+ left: ${N.left}px;
4672
+ top: ${N.top}px;
4491
4673
  z-index: 1000;
4492
4674
  pointer-events: none;
4493
4675
  opacity: 0.85;
@@ -4502,121 +4684,121 @@ function fa({ shadowRoot: n, getConfig: e, getViewInfo: a, getEvents: t, onMove:
4502
4684
  overflow: hidden;
4503
4685
  `, c.style.setProperty("--ev-bg", d.style.getPropertyValue("--ev-bg")), c.style.setProperty("--ev-fg", d.style.getPropertyValue("--ev-fg")), n.appendChild(c), d.classList.add("cal-sched-event--dragging");
4504
4686
  }
4505
- c && (c.style.left = `${w.clientX - g}px`, c.style.top = `${w.clientY - u}px`);
4506
- const D = H(w.clientX, w.clientY);
4507
- D ? K(D) : E();
4687
+ c && (c.style.left = `${E.clientX - p}px`, c.style.top = `${E.clientY - u}px`);
4688
+ const D = T(E.clientX, E.clientY);
4689
+ D ? X(D) : Y();
4508
4690
  } else if (o === "resize") {
4509
- const D = e(), j = D.snapInterval || D.interval, ae = D.slotHeight * (j / D.interval), re = w.clientY - _, J = Math.round(re / ae) * j, ve = b(v), ue = b(C);
4510
- let te = ve + J;
4511
- const se = D.minDuration || j, oe = ue + se;
4691
+ const D = e(), N = D.snapInterval || D.interval, ae = D.slotHeight * (N / D.interval), re = E.clientY - f, V = Math.round(re / ae) * N, be = _(b), ue = _(y);
4692
+ let te = be + V;
4693
+ const se = D.minDuration || N, oe = ue + se;
4512
4694
  if (te < oe && (te = oe), D.maxDuration) {
4513
4695
  const fe = ue + D.maxDuration;
4514
4696
  te > fe && (te = fe);
4515
4697
  }
4516
- const X = b(D.endTime);
4517
- te > X && (te = X);
4698
+ const K = _(D.endTime);
4699
+ te > K && (te = K);
4518
4700
  const ce = ie(te);
4519
4701
  if (d) {
4520
- const fe = pe(C, D.startTime, D.slotHeight, D.interval), Ie = pe(ce, D.startTime, D.slotHeight, D.interval);
4521
- d.style.height = `${Math.max(Ie - fe, D.slotHeight * 0.5)}px`;
4702
+ const fe = pe(y, D.startTime, D.slotHeight, D.interval), He = pe(ce, D.startTime, D.slotHeight, D.interval);
4703
+ d.style.height = `${Math.max(He - fe, D.slotHeight * 0.5)}px`;
4522
4704
  }
4523
- W(w.clientX, w.clientY, ce, D.format);
4705
+ O(E.clientX, E.clientY, ce, D.format);
4524
4706
  } else if (o === "create") {
4525
- const D = e(), j = D.snapInterval || D.interval, ae = w.clientY - F, re = Ve(Math.max(0, ae), D.startTime, D.slotHeight, D.interval), ee = Je(re, j), J = b(ee), ve = b(f), ue = b(D.endTime), te = D.minDuration || j;
4526
- let se = Math.max(J, ve + te);
4707
+ const D = e(), N = D.snapInterval || D.interval, ae = E.clientY - W, re = et(Math.max(0, ae), D.startTime, D.slotHeight, D.interval), ee = tt(re, N), V = _(ee), be = _(L), ue = _(D.endTime), te = D.minDuration || N;
4708
+ let se = Math.max(V, be + te);
4527
4709
  if (D.maxDuration) {
4528
- const X = ve + D.maxDuration;
4529
- se > X && (se = X);
4710
+ const K = be + D.maxDuration;
4711
+ se > K && (se = K);
4530
4712
  }
4531
4713
  se > ue && (se = ue);
4532
4714
  const oe = ie(se);
4533
- if (!I) {
4534
- I = document.createElement("div"), I.classList.add("cal-sched-create-preview");
4535
- let X = null;
4536
- x && (X = n.querySelector(`[data-resource-id="${x}"][data-date="${M}"]`), X || (X = n.querySelector(`[data-date="${M}"] [data-resource-id="${x}"]`))), X || (X = n.querySelector(`[data-date="${M}"] .cal-sched-week__lane`) || n.querySelector(`[data-date="${M}"] .cal-sched-day__lane`) || n.querySelector(`[data-date="${M}"]`)), X && X.appendChild(I);
4715
+ if (!H) {
4716
+ H = document.createElement("div"), H.classList.add("cal-sched-create-preview");
4717
+ let K = null;
4718
+ k && (K = n.querySelector(`[data-resource-id="${k}"][data-date="${F}"]`), K || (K = n.querySelector(`[data-date="${F}"] [data-resource-id="${k}"]`))), K || (K = n.querySelector(`[data-date="${F}"] .cal-sched-week__lane`) || n.querySelector(`[data-date="${F}"] .cal-sched-day__lane`) || n.querySelector(`[data-date="${F}"]`)), K && K.appendChild(H);
4537
4719
  }
4538
- if (I) {
4539
- const X = e(), ce = pe(f, X.startTime, X.slotHeight, X.interval), fe = pe(oe, X.startTime, X.slotHeight, X.interval);
4540
- I.style.top = `${ce}px`, I.style.height = `${Math.max(fe - ce, X.slotHeight * 0.5)}px`, I.dataset.endTime = oe;
4720
+ if (H) {
4721
+ const K = e(), ce = pe(L, K.startTime, K.slotHeight, K.interval), fe = pe(oe, K.startTime, K.slotHeight, K.interval);
4722
+ H.style.top = `${ce}px`, H.style.height = `${Math.max(fe - ce, K.slotHeight * 0.5)}px`, H.dataset.endTime = oe;
4541
4723
  }
4542
- W(w.clientX, w.clientY, oe, D.format);
4724
+ O(E.clientX, E.clientY, oe, D.format);
4543
4725
  }
4544
4726
  }
4545
4727
  }
4546
- function y(w) {
4728
+ function x(E) {
4547
4729
  if (o) {
4548
- if (n.removeEventListener("pointermove", L), n.removeEventListener("pointerup", y), N && O != null) {
4730
+ if (n.removeEventListener("pointermove", C), n.removeEventListener("pointerup", x), j && B != null) {
4549
4731
  try {
4550
- N.releasePointerCapture(O);
4732
+ j.releasePointerCapture(B);
4551
4733
  } catch {
4552
4734
  }
4553
- N = null, O = null;
4735
+ j = null, B = null;
4554
4736
  }
4555
4737
  if (o === "move") {
4556
- if (E(), c && (c.remove(), c = null), d && d.classList.remove("cal-sched-event--dragging"), m) {
4738
+ if (Y(), c && (c.remove(), c = null), d && d.classList.remove("cal-sched-event--dragging"), m) {
4557
4739
  d && (d.dataset.wasDragged = "true");
4558
- const A = H(w.clientX, w.clientY);
4559
- if (A && h) {
4560
- const P = e(), U = b(v) - b(C), D = A.time, j = b(D), ae = Math.min(j + U, b(P.endTime)), re = ie(ae), ee = {
4561
- date: k,
4562
- startTime: C,
4563
- endTime: v,
4564
- resourceId: S
4565
- }, J = {
4566
- date: A.date,
4740
+ const $ = T(E.clientX, E.clientY);
4741
+ if ($ && h) {
4742
+ const P = e(), J = _(b) - _(y), D = $.time, N = _(D), ae = Math.min(N + J, _(P.endTime)), re = ie(ae), ee = {
4743
+ date: w,
4744
+ startTime: y,
4745
+ endTime: b,
4746
+ resourceId: A
4747
+ }, V = {
4748
+ date: $.date,
4567
4749
  startTime: D,
4568
4750
  endTime: re,
4569
- resourceId: A.resourceId || S
4751
+ resourceId: $.resourceId || A
4570
4752
  };
4571
- (ee.date !== J.date || ee.startTime !== J.startTime || ee.resourceId !== J.resourceId) && (s == null || s({ event: h, from: ee, to: J }));
4753
+ (ee.date !== V.date || ee.startTime !== V.startTime || ee.resourceId !== V.resourceId) && (s == null || s({ event: h, from: ee, to: V }));
4572
4754
  }
4573
4755
  }
4574
4756
  } else if (o === "resize") {
4575
4757
  if (m) {
4576
- const A = e(), P = A.snapInterval || A.interval, U = A.slotHeight * (P / A.interval), D = w.clientY - _, ae = Math.round(D / U) * P, re = b(v), ee = b(C);
4577
- let J = re + ae;
4578
- const ve = A.minDuration || P, ue = ee + ve;
4579
- if (J < ue && (J = ue), A.maxDuration) {
4580
- const oe = ee + A.maxDuration;
4581
- J > oe && (J = oe);
4758
+ const $ = e(), P = $.snapInterval || $.interval, J = $.slotHeight * (P / $.interval), D = E.clientY - f, ae = Math.round(D / J) * P, re = _(b), ee = _(y);
4759
+ let V = re + ae;
4760
+ const be = $.minDuration || P, ue = ee + be;
4761
+ if (V < ue && (V = ue), $.maxDuration) {
4762
+ const oe = ee + $.maxDuration;
4763
+ V > oe && (V = oe);
4582
4764
  }
4583
- const te = b(A.endTime);
4584
- J > te && (J = te);
4585
- const se = ie(J);
4586
- d && (d.dataset.wasDragged = "true"), se !== v && h && (i == null || i({
4765
+ const te = _($.endTime);
4766
+ V > te && (V = te);
4767
+ const se = ie(V);
4768
+ d && (d.dataset.wasDragged = "true"), se !== b && h && (i == null || i({
4587
4769
  event: h,
4588
- from: { endTime: v },
4770
+ from: { endTime: b },
4589
4771
  to: { endTime: se }
4590
4772
  }));
4591
4773
  }
4592
- d && d.classList.remove("cal-sched-event--resizing"), $();
4774
+ d && d.classList.remove("cal-sched-event--resizing"), S();
4593
4775
  } else if (o === "create") {
4594
- $();
4595
- const A = (I == null ? void 0 : I.dataset.endTime) || null;
4596
- I && (I.remove(), I = null), m && M && f && A && (l == null || l({
4597
- date: M,
4598
- startTime: f,
4599
- endTime: A,
4600
- resourceId: x
4601
- })), M = null, x = null, f = null, F = 0;
4776
+ S();
4777
+ const $ = (H == null ? void 0 : H.dataset.endTime) || null;
4778
+ H && (H.remove(), H = null), m && F && L && $ && (l == null || l({
4779
+ date: F,
4780
+ startTime: L,
4781
+ endTime: $,
4782
+ resourceId: k
4783
+ })), F = null, k = null, L = null, W = 0;
4602
4784
  }
4603
- o = null, h = null, d = null, g = 0, u = 0, p = 0, _ = 0, m = !1, v = null, C = null, k = null, S = null;
4785
+ o = null, h = null, d = null, p = 0, u = 0, g = 0, f = 0, m = !1, b = null, y = null, w = null, A = null;
4604
4786
  }
4605
4787
  }
4606
- function H(w, A) {
4607
- const P = e(), U = n.querySelectorAll("[data-date]");
4608
- let D = null, j = null;
4609
- for (const ce of U) {
4788
+ function T(E, $) {
4789
+ const P = e(), J = n.querySelectorAll("[data-date]");
4790
+ let D = null, N = null;
4791
+ for (const ce of J) {
4610
4792
  const fe = ce.getBoundingClientRect();
4611
- if (w >= fe.left && w <= fe.right) {
4793
+ if (E >= fe.left && E <= fe.right) {
4612
4794
  if (D = ce.dataset.date, ce.dataset.resourceId)
4613
- j = ce.dataset.resourceId;
4795
+ N = ce.dataset.resourceId;
4614
4796
  else {
4615
- const Ie = ce.querySelectorAll("[data-resource-id]");
4616
- for (const qe of Ie) {
4617
- const We = qe.getBoundingClientRect();
4618
- if (w >= We.left && w <= We.right) {
4619
- j = qe.dataset.resourceId;
4797
+ const He = ce.querySelectorAll("[data-resource-id]");
4798
+ for (const Ge of He) {
4799
+ const Ke = Ge.getBoundingClientRect();
4800
+ if (E >= Ke.left && E <= Ke.right) {
4801
+ N = Ge.dataset.resourceId;
4620
4802
  break;
4621
4803
  }
4622
4804
  }
@@ -4627,76 +4809,76 @@ function fa({ shadowRoot: n, getConfig: e, getViewInfo: a, getEvents: t, onMove:
4627
4809
  if (!D) return null;
4628
4810
  const ae = n.querySelectorAll("[data-time]");
4629
4811
  if (ae.length === 0) return null;
4630
- const ee = ae[0].getBoundingClientRect().top, J = A - ee;
4631
- if (J < 0) return null;
4632
- const ve = P.snapInterval || P.interval, ue = Ve(J, P.startTime, P.slotHeight, P.interval), te = Je(ue, ve), se = b(te), oe = b(P.startTime), X = b(P.endTime);
4633
- return se < oe || se >= X ? null : {
4812
+ const ee = ae[0].getBoundingClientRect().top, V = $ - ee;
4813
+ if (V < 0) return null;
4814
+ const be = P.snapInterval || P.interval, ue = et(V, P.startTime, P.slotHeight, P.interval), te = tt(ue, be), se = _(te), oe = _(P.startTime), K = _(P.endTime);
4815
+ return se < oe || se >= K ? null : {
4634
4816
  date: D,
4635
4817
  time: te,
4636
- resourceId: j
4818
+ resourceId: N
4637
4819
  };
4638
4820
  }
4639
- function K(w) {
4640
- E();
4641
- const A = e();
4642
- let P = A.interval;
4643
- h && C && v && (P = b(v) - b(C));
4644
- let D = b(w.time) + P;
4645
- const j = b(A.endTime);
4646
- D > j && (D = j);
4821
+ function X(E) {
4822
+ Y();
4823
+ const $ = e();
4824
+ let P = $.interval;
4825
+ h && y && b && (P = _(b) - _(y));
4826
+ let D = _(E.time) + P;
4827
+ const N = _($.endTime);
4828
+ D > N && (D = N);
4647
4829
  const ae = ie(D);
4648
- let re = Y(w.date, w.resourceId);
4830
+ let re = R(E.date, E.resourceId);
4649
4831
  if (!re) return;
4650
- V = document.createElement("div"), V.classList.add("cal-sched-drop-preview");
4651
- const ee = pe(w.time, A.startTime, A.slotHeight, A.interval), J = pe(ae, A.startTime, A.slotHeight, A.interval);
4652
- V.style.top = `${ee}px`, V.style.height = `${Math.max(J - ee, A.slotHeight * 0.5)}px`, re.appendChild(V);
4832
+ q = document.createElement("div"), q.classList.add("cal-sched-drop-preview");
4833
+ const ee = pe(E.time, $.startTime, $.slotHeight, $.interval), V = pe(ae, $.startTime, $.slotHeight, $.interval);
4834
+ q.style.top = `${ee}px`, q.style.height = `${Math.max(V - ee, $.slotHeight * 0.5)}px`, re.appendChild(q);
4653
4835
  }
4654
- function E() {
4655
- V && (V.remove(), V = null);
4836
+ function Y() {
4837
+ q && (q.remove(), q = null);
4656
4838
  }
4657
- function Y(w, A) {
4658
- if (A) {
4659
- let U = n.querySelector(
4660
- `[data-resource-id="${A}"][data-date="${w}"]`
4839
+ function R(E, $) {
4840
+ if ($) {
4841
+ let J = n.querySelector(
4842
+ `[data-resource-id="${$}"][data-date="${E}"]`
4661
4843
  );
4662
- if (U || (U = n.querySelector(
4663
- `[data-date="${w}"] [data-resource-id="${A}"]`
4664
- )), U) return U;
4844
+ if (J || (J = n.querySelector(
4845
+ `[data-date="${E}"] [data-resource-id="${$}"]`
4846
+ )), J) return J;
4665
4847
  }
4666
- const P = n.querySelector(`[data-date="${w}"]`);
4848
+ const P = n.querySelector(`[data-date="${E}"]`);
4667
4849
  return P ? P.querySelector(".cal-sched-week__lane") || P.querySelector(".cal-sched-day__lane") || P : null;
4668
4850
  }
4669
- function W(w, A, P, U) {
4670
- B || (B = document.createElement("div"), B.classList.add("cal-sched-drag-time-label"), n.appendChild(B));
4671
- const { hours: D, minutes: j } = T(P), ae = U === "12h" ? z(D, j) : P;
4672
- B.textContent = ae, B.style.left = `${w + 12}px`, B.style.top = `${A - 8}px`;
4851
+ function O(E, $, P, J) {
4852
+ I || (I = document.createElement("div"), I.classList.add("cal-sched-drag-time-label"), n.appendChild(I));
4853
+ const { hours: D, minutes: N } = M(P), ae = J === "12h" ? z(D, N) : P;
4854
+ I.textContent = ae, I.style.left = `${E + 12}px`, I.style.top = `${$ - 8}px`;
4673
4855
  }
4674
- function $() {
4675
- B && (B.remove(), B = null);
4856
+ function S() {
4857
+ I && (I.remove(), I = null);
4676
4858
  }
4677
- function T(w) {
4678
- const [A, P] = w.split(":").map(Number);
4679
- return { hours: A, minutes: P };
4859
+ function M(E) {
4860
+ const [$, P] = E.split(":").map(Number);
4861
+ return { hours: $, minutes: P };
4680
4862
  }
4681
- function z(w, A) {
4682
- const P = w >= 12 ? "PM" : "AM";
4683
- return `${w % 12 || 12}:${String(A).padStart(2, "0")} ${P}`;
4863
+ function z(E, $) {
4864
+ const P = E >= 12 ? "PM" : "AM";
4865
+ return `${E % 12 || 12}:${String($).padStart(2, "0")} ${P}`;
4684
4866
  }
4685
- function q() {
4686
- r || (r = !0, n.addEventListener("pointerdown", R));
4867
+ function G() {
4868
+ r || (r = !0, n.addEventListener("pointerdown", v));
4687
4869
  }
4688
4870
  function Q() {
4689
- r = !1, n.removeEventListener("pointerdown", R), n.removeEventListener("pointermove", L), n.removeEventListener("pointerup", y), be();
4871
+ r = !1, n.removeEventListener("pointerdown", v), n.removeEventListener("pointermove", C), n.removeEventListener("pointerup", x), ne();
4690
4872
  }
4691
- function be() {
4692
- c && (c.remove(), c = null), I && (I.remove(), I = null), d && (d.classList.remove("cal-sched-event--dragging", "cal-sched-event--resizing"), d = null), E(), $(), o = null, h = null, m = !1;
4873
+ function ne() {
4874
+ c && (c.remove(), c = null), H && (H.remove(), H = null), d && (d.classList.remove("cal-sched-event--dragging", "cal-sched-event--resizing"), d = null), Y(), S(), o = null, h = null, m = !1;
4693
4875
  }
4694
- function vt() {
4876
+ function ve() {
4695
4877
  Q();
4696
4878
  }
4697
- return { enable: q, disable: Q, destroy: vt };
4879
+ return { enable: G, disable: Q, destroy: ve };
4698
4880
  }
4699
- const va = `
4881
+ const xa = `
4700
4882
  [data-draggable="true"] {
4701
4883
  cursor: grab;
4702
4884
  }
@@ -4781,7 +4963,7 @@ const va = `
4781
4963
  z-index: 1001;
4782
4964
  white-space: nowrap;
4783
4965
  }
4784
- `, ba = `
4966
+ `, ka = `
4785
4967
  .cal-sched {
4786
4968
  background: hsl(var(--cal-bg));
4787
4969
  border-radius: var(--cal-radius);
@@ -4793,27 +4975,27 @@ const va = `
4793
4975
  position: relative;
4794
4976
  }
4795
4977
  `;
4796
- class _a extends Se {
4978
+ class wa extends Me {
4797
4979
  static get styles() {
4798
4980
  return [
4799
- Me,
4800
- Ae,
4801
4981
  $e,
4802
- Xt,
4803
- Gt,
4982
+ ze,
4983
+ Ie,
4984
+ Jt,
4804
4985
  Vt,
4805
- Zt,
4806
- ta,
4807
- sa,
4986
+ ea,
4987
+ aa,
4808
4988
  ia,
4809
- oa,
4810
- Ye,
4811
- da,
4989
+ ra,
4990
+ ca,
4812
4991
  ua,
4813
- Qt,
4992
+ Pe,
4814
4993
  ga,
4994
+ fa,
4995
+ sa,
4815
4996
  va,
4816
- ba
4997
+ xa,
4998
+ ka
4817
4999
  ];
4818
5000
  }
4819
5001
  static get observedAttributes() {
@@ -4835,11 +5017,12 @@ class _a extends Se {
4835
5017
  "draggable-events",
4836
5018
  "snap-interval",
4837
5019
  "min-duration",
4838
- "max-duration"
5020
+ "max-duration",
5021
+ "locale"
4839
5022
  ];
4840
5023
  }
4841
5024
  constructor() {
4842
- super(), this._store = Te({
5025
+ super(), this._store = Ae({
4843
5026
  view: "week",
4844
5027
  anchorDate: me(),
4845
5028
  layout: "vertical",
@@ -4855,7 +5038,7 @@ class _a extends Se {
4855
5038
  statusDismissible: !0,
4856
5039
  // All-day collapse
4857
5040
  allDayCollapsed: !1
4858
- }), this._resources = [], this._events = [], this._eventActions = [], this._eventContent = null, this._unsubscribe = null, this._rendering = !1, this._nowTimer = null, this._dragManager = null;
5041
+ }), this._resources = [], this._events = [], this._eventActions = [], this._eventContent = null, this._colors = null, this._customColorMap = null, this._unsubscribe = null, this._rendering = !1, this._nowTimer = null, this._dragManager = null;
4859
5042
  }
4860
5043
  // -- Attribute getters --
4861
5044
  get view() {
@@ -4912,6 +5095,9 @@ class _a extends Se {
4912
5095
  const e = this.getAttribute("max-duration");
4913
5096
  return e ? parseInt(e, 10) : null;
4914
5097
  }
5098
+ get locale() {
5099
+ return this.getAttribute("locale") || void 0;
5100
+ }
4915
5101
  // -- Properties --
4916
5102
  get resources() {
4917
5103
  return this._resources;
@@ -4937,6 +5123,15 @@ class _a extends Se {
4937
5123
  set eventContent(e) {
4938
5124
  this._eventContent = typeof e == "function" ? e : null, this._initialized && this.render();
4939
5125
  }
5126
+ get colors() {
5127
+ return this._colors;
5128
+ }
5129
+ set colors(e) {
5130
+ if (this._colors = Array.isArray(e) ? e : null, this._customColorMap = rt(this._colors), this._customColorMap)
5131
+ for (const [a, t] of Object.entries(this._customColorMap))
5132
+ this.style.setProperty(`--cal-booking-${a}-bg`, t.bg), this.style.setProperty(`--cal-booking-${a}-fg`, t.fg), this.style.setProperty(`--cal-booking-${a}-hover`, t.hover);
5133
+ this._initialized && this.render();
5134
+ }
4940
5135
  get value() {
4941
5136
  return this._lastSlotValue || null;
4942
5137
  }
@@ -4986,7 +5181,7 @@ class _a extends Se {
4986
5181
  this.goToDate(me());
4987
5182
  }
4988
5183
  next() {
4989
- const e = this._store.getState(), a = G(e.anchorDate);
5184
+ const e = this._store.getState(), a = U(e.anchorDate);
4990
5185
  if (!a) return;
4991
5186
  let t;
4992
5187
  if (e.view === "day")
@@ -5000,7 +5195,7 @@ class _a extends Se {
5000
5195
  this._store.set({ anchorDate: t }), this.emit("cal:date-change", { date: t, view: e.view });
5001
5196
  }
5002
5197
  prev() {
5003
- const e = this._store.getState(), a = G(e.anchorDate);
5198
+ const e = this._store.getState(), a = U(e.anchorDate);
5004
5199
  if (!a) return;
5005
5200
  let t;
5006
5201
  if (e.view === "day")
@@ -5014,7 +5209,7 @@ class _a extends Se {
5014
5209
  this._store.set({ anchorDate: t }), this.emit("cal:date-change", { date: t, view: e.view });
5015
5210
  }
5016
5211
  findAvailableSlot(e) {
5017
- return qt(
5212
+ return Kt(
5018
5213
  e,
5019
5214
  this._resources,
5020
5215
  this._events,
@@ -5024,7 +5219,14 @@ class _a extends Se {
5024
5219
  );
5025
5220
  }
5026
5221
  isSlotAvailable(e, a, t, s) {
5027
- return gt(this._events, s, e, a, t);
5222
+ return yt(this._events, s, e, a, t);
5223
+ }
5224
+ clear() {
5225
+ this._store.set({
5226
+ selectedSlot: null,
5227
+ detailEvent: null,
5228
+ detailResource: null
5229
+ }), this._lastSlotValue = null;
5028
5230
  }
5029
5231
  // -- Event handlers --
5030
5232
  _handleSlotClick(e, a, t, s, i) {
@@ -5058,7 +5260,7 @@ class _a extends Se {
5058
5260
  });
5059
5261
  }
5060
5262
  _initDrag() {
5061
- this._dragManager || (this._dragManager = fa({
5263
+ this._dragManager || (this._dragManager = ya({
5062
5264
  shadowRoot: this.shadowRoot,
5063
5265
  getConfig: () => ({
5064
5266
  slotHeight: this.slotHeight,
@@ -5075,7 +5277,7 @@ class _a extends Se {
5075
5277
  return {
5076
5278
  view: e.view,
5077
5279
  anchorDate: e.anchorDate,
5078
- weekDates: Be(e.anchorDate, this.firstDay),
5280
+ weekDates: Fe(e.anchorDate, this.firstDay),
5079
5281
  resources: this._resources.length > 0 ? this._resources : [{ id: "__default", name: "" }],
5080
5282
  resourceMode: this.resourceMode,
5081
5283
  selectedResourceId: e.selectedResourceId
@@ -5103,58 +5305,59 @@ class _a extends Se {
5103
5305
  }
5104
5306
  // -- Render --
5105
5307
  render() {
5106
- var _;
5308
+ var f;
5107
5309
  if (this._rendering) return;
5108
5310
  this._rendering = !0;
5109
5311
  const e = this.shadowRoot, a = [...e.childNodes];
5110
5312
  for (const m of a)
5111
5313
  m.nodeName !== "STYLE" && !(m instanceof CSSStyleSheet) && e.removeChild(m);
5112
5314
  const t = this._store.getState(), s = document.createElement("div");
5113
- s.classList.add("cal-sched"), t.statusType && t.statusMessage && s.appendChild(ze({
5315
+ s.classList.add("cal-sched"), t.statusType && t.statusMessage && s.appendChild(Ye({
5114
5316
  type: t.statusType,
5115
5317
  message: t.statusMessage,
5116
5318
  dismissible: t.statusDismissible,
5117
5319
  onDismiss: () => this.clearStatus()
5118
5320
  }));
5119
- const i = t.view, l = t.anchorDate, r = Be(l, this.firstDay), o = Rt(i, l, r), h = this.resourceMode;
5120
- s.appendChild(Wt({
5321
+ const i = t.view, l = t.anchorDate, r = Fe(l, this.firstDay), o = Xt(i, l, r, this.locale), h = this.resourceMode;
5322
+ s.appendChild(Ut({
5121
5323
  title: o,
5122
5324
  view: i,
5123
5325
  onPrev: () => this.prev(),
5124
5326
  onNext: () => this.next(),
5125
5327
  onToday: () => this.today(),
5126
- onViewChange: (m) => this._handleViewChange(m)
5328
+ onViewChange: (m) => this._handleViewChange(m),
5329
+ locale: this.locale
5127
5330
  }));
5128
5331
  const c = this._resources.length > 0 ? this._resources : [{ id: "__default", name: "" }], d = h === "tabs" && c.length > 1 && c[0].id !== "__default";
5129
- d && !this.loading && s.appendChild(ha({
5332
+ d && !this.loading && s.appendChild(ma({
5130
5333
  resources: c,
5131
5334
  selectedResourceId: t.selectedResourceId,
5132
5335
  onResourceFilter: (m) => this._handleResourceFilter(m)
5133
5336
  }));
5134
- let g = this._events;
5135
- d && t.selectedResourceId && (g = this._events.filter((m) => m.resourceId === t.selectedResourceId));
5337
+ let p = this._events;
5338
+ d && t.selectedResourceId && (p = this._events.filter((m) => m.resourceId === t.selectedResourceId));
5136
5339
  let u = c;
5137
5340
  if (d && t.selectedResourceId) {
5138
- const m = c.find((v) => v.id === t.selectedResourceId);
5341
+ const m = c.find((b) => b.id === t.selectedResourceId);
5139
5342
  m && (u = [m]);
5140
5343
  }
5141
- const p = document.createElement("div");
5142
- if (p.classList.add("cal-sched__body"), this.loading)
5344
+ const g = document.createElement("div");
5345
+ if (g.classList.add("cal-sched__body"), this.loading)
5143
5346
  if (i === "month")
5144
- p.appendChild(ra());
5347
+ g.appendChild(ha());
5145
5348
  else {
5146
5349
  const m = i === "week" ? 7 : Math.max(this._resources.length, 1);
5147
- p.appendChild(la({
5350
+ g.appendChild(da({
5148
5351
  columns: m,
5149
- rows: Math.ceil((b(this.endTime) - b(this.startTime)) / this.interval),
5352
+ rows: Math.ceil((_(this.endTime) - _(this.startTime)) / this.interval),
5150
5353
  slotHeight: this.slotHeight
5151
5354
  }));
5152
5355
  }
5153
5356
  else
5154
- i === "day" ? p.appendChild(ea({
5357
+ i === "day" ? g.appendChild(na({
5155
5358
  date: l,
5156
5359
  resources: u,
5157
- events: g,
5360
+ events: p,
5158
5361
  startTime: this.startTime,
5159
5362
  endTime: this.endTime,
5160
5363
  interval: this.interval,
@@ -5166,14 +5369,14 @@ class _a extends Se {
5166
5369
  eventContent: this._eventContent,
5167
5370
  showTime: this.showEventTime,
5168
5371
  draggable: this.draggableEvents,
5169
- onSlotClick: (m, v, C, k, S) => this._handleSlotClick(m, v, C, k, S),
5170
- onEventClick: (m, v, C) => this._handleEventClick(m, v, C),
5171
- onSlotCreate: (m, v, C, k, S) => this._handleSlotCreate(m, v, C, k, S)
5172
- })) : i === "week" ? p.appendChild(aa({
5372
+ onSlotClick: (m, b, y, w, A) => this._handleSlotClick(m, b, y, w, A),
5373
+ onEventClick: (m, b, y) => this._handleEventClick(m, b, y),
5374
+ onSlotCreate: (m, b, y, w, A) => this._handleSlotCreate(m, b, y, w, A)
5375
+ })) : i === "week" ? g.appendChild(la({
5173
5376
  date: l,
5174
5377
  firstDay: this.firstDay,
5175
5378
  resources: u,
5176
- events: g,
5379
+ events: p,
5177
5380
  startTime: this.startTime,
5178
5381
  endTime: this.endTime,
5179
5382
  interval: this.interval,
@@ -5187,44 +5390,44 @@ class _a extends Se {
5187
5390
  draggable: this.draggableEvents,
5188
5391
  allDayCollapsed: t.allDayCollapsed,
5189
5392
  onToggleAllDay: () => this._store.set({ allDayCollapsed: !t.allDayCollapsed }),
5190
- onSlotClick: (m, v, C, k, S) => this._handleSlotClick(m, v, C, k, S),
5191
- onEventClick: (m, v, C) => this._handleEventClick(m, v, C),
5192
- onSlotCreate: (m, v, C, k, S) => this._handleSlotCreate(m, v, C, k, S)
5193
- })) : i === "month" && p.appendChild(na({
5393
+ onSlotClick: (m, b, y, w, A) => this._handleSlotClick(m, b, y, w, A),
5394
+ onEventClick: (m, b, y) => this._handleEventClick(m, b, y),
5395
+ onSlotCreate: (m, b, y, w, A) => this._handleSlotCreate(m, b, y, w, A)
5396
+ })) : i === "month" && g.appendChild(oa({
5194
5397
  date: l,
5195
5398
  firstDay: this.firstDay,
5196
5399
  resources: u,
5197
- events: g,
5400
+ events: p,
5198
5401
  format: this.format,
5199
5402
  selectedResourceId: t.selectedResourceId,
5200
- selectedDate: ((_ = t.selectedSlot) == null ? void 0 : _.date) || null,
5403
+ selectedDate: ((f = t.selectedSlot) == null ? void 0 : f.date) || null,
5201
5404
  eventContent: this._eventContent,
5202
5405
  onSlotClick: (m) => this._handleSlotClick(m, null, null, null, null),
5203
- onEventClick: (m, v, C) => this._handleEventClick(m, v, C),
5406
+ onEventClick: (m, b, y) => this._handleEventClick(m, b, y),
5204
5407
  onSlotCreate: (m) => this._handleSlotCreate(m, null, null, null, null)
5205
5408
  }));
5206
- s.appendChild(p), t.detailEvent && p.appendChild(ca({
5409
+ s.appendChild(g), t.detailEvent && g.appendChild(pa({
5207
5410
  event: t.detailEvent,
5208
5411
  resource: t.detailResource,
5209
5412
  format: this.format,
5210
5413
  onClose: () => this._closeDetail(),
5211
5414
  actions: this._eventActions,
5212
5415
  onAction: (m) => this._handleEventAction(m)
5213
- })), this.showFab && !this.loading && p.appendChild(pa({
5416
+ })), this.showFab && !this.loading && g.appendChild(ba({
5214
5417
  onClick: () => this._handleFabClick()
5215
5418
  })), e.appendChild(s), this._escHandler || (this._escHandler = (m) => {
5216
5419
  m.key === "Escape" && this._store.get("selectedSlot") && this._dismissSlot();
5217
5420
  }, this.shadowRoot.addEventListener("keydown", this._escHandler), document.addEventListener("keydown", this._escHandler)), this._rendering = !1;
5218
5421
  }
5219
5422
  }
5220
- customElements.get("cal-datepicker") || customElements.define("cal-datepicker", $t);
5221
- customElements.get("cal-booking") || customElements.define("cal-booking", Ht);
5222
- customElements.get("cal-timepicker") || customElements.define("cal-timepicker", Ft);
5223
- customElements.get("cal-scheduler") || customElements.define("cal-scheduler", _a);
5423
+ customElements.get("cal-datepicker") || customElements.define("cal-datepicker", Pt);
5424
+ customElements.get("cal-booking") || customElements.define("cal-booking", Rt);
5425
+ customElements.get("cal-timepicker") || customElements.define("cal-timepicker", qt);
5426
+ customElements.get("cal-scheduler") || customElements.define("cal-scheduler", wa);
5224
5427
  export {
5225
- Ht as CalBooking,
5226
- $t as CalDatepicker,
5227
- _a as CalScheduler,
5228
- Ft as CalTimepicker
5428
+ Rt as CalBooking,
5429
+ Pt as CalDatepicker,
5430
+ wa as CalScheduler,
5431
+ qt as CalTimepicker
5229
5432
  };
5230
5433
  //# sourceMappingURL=calkit.es.js.map