@mintplayer/web-components 2.16.0 → 2.18.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.
Files changed (120) hide show
  1. package/accordion/index.mjs +5 -5
  2. package/calendar/index.mjs +1 -1
  3. package/carousel/index.mjs +57 -143
  4. package/charts/core/index.mjs +30 -20
  5. package/charts/core/src/attributes.d.ts +18 -0
  6. package/charts/core/src/index.d.ts +2 -0
  7. package/charts/core/src/view-window.d.ts +46 -0
  8. package/charts/hierarchy/index.mjs +245 -256
  9. package/charts/hierarchy/src/components/mp-hierarchy-chart.d.ts +1 -3
  10. package/charts/sparkline/index.mjs +27 -26
  11. package/charts/trend/index.mjs +21 -20
  12. package/checkbox/index.mjs +1 -1
  13. package/checkbox/src/components/mp-checkbox.d.ts +1 -0
  14. package/chunks/attributes-L3eKsbdy.mjs +16 -0
  15. package/chunks/color-mode-warning-71FmlzWX.mjs +13 -0
  16. package/chunks/{form-check.styles-B0pxJ6YC.mjs → form-check.styles-DqvBnspm.mjs} +24 -3
  17. package/chunks/{mp-calendar.element-CJ8-t-Zn.mjs → mp-calendar.element-BIHS9SZZ.mjs} +11 -6
  18. package/chunks/{mp-checkbox-CzwS7Y_t.mjs → mp-checkbox-zV83gILn.mjs} +44 -36
  19. package/chunks/{mp-datatable-B7st6G-I.mjs → mp-datatable-CEpSxlkd.mjs} +660 -357
  20. package/chunks/{mp-datetime-picker.element-DsWA1AFs.mjs → mp-datetime-picker.element-Cxu5-qRE.mjs} +29 -32
  21. package/chunks/{mp-pagination-Dea75mD4.mjs → mp-pagination-hGy4dL7p.mjs} +9 -4
  22. package/chunks/{mp-radio-cL46sUA0.mjs → mp-radio-BhRVNdKp.mjs} +32 -28
  23. package/chunks/{mp-select-BNrbPwN4.mjs → mp-select-CgqYFvUj.mjs} +41 -26
  24. package/chunks/{mp-splitter-Ckn1kN4v.mjs → mp-splitter-DLehrw3Y.mjs} +144 -120
  25. package/chunks/{mp-timepicker.element-CwaAAOcm.mjs → mp-timepicker.element-BiB9lkgc.mjs} +58 -45
  26. package/chunks/{mp-toggle-button-eo_aTQtu.mjs → mp-toggle-button-CaS9uYLE.mjs} +26 -24
  27. package/chunks/{mp-treeview-C8iltDbq.mjs → mp-treeview-CaMTDrvY.mjs} +51 -50
  28. package/chunks/{overlay-controller-DifgO6jT.mjs → overlay-controller-BHDagokg.mjs} +96 -92
  29. package/chunks/{id-DNZVAnGC.mjs → resource.service--lqLwEqk.mjs} +144 -206
  30. package/chunks/view-window-DGvFiDnW.mjs +263 -0
  31. package/code-snippet/index.mjs +70 -66
  32. package/code-snippet/src/hljs-loaders.generated.d.ts +1 -1
  33. package/custom-elements.json +66193 -0
  34. package/datatable/index.mjs +1 -1
  35. package/datatable/src/components/column-resize.d.ts +11 -0
  36. package/datatable/src/components/index.d.ts +1 -1
  37. package/datatable/src/components/mp-datatable.d.ts +264 -20
  38. package/datatable/src/index.d.ts +1 -1
  39. package/datatable/src/types/labels.d.ts +11 -0
  40. package/datepicker/index.mjs +10 -9
  41. package/datetime-picker/index.mjs +1 -1
  42. package/datetime-picker/src/mp-datetime-picker.element.d.ts +3 -0
  43. package/dock/index.mjs +430 -463
  44. package/dock/src/components/mint-dock-manager.element.d.ts +25 -2
  45. package/dock/src/core/resize.d.ts +60 -0
  46. package/dropdown-menu/index.mjs +4 -2
  47. package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +6 -1
  48. package/dropdown-menu/src/index.d.ts +1 -1
  49. package/dropdown-menu/src/types/dropdown.d.ts +14 -1
  50. package/dropdown-menu/src/types/index.d.ts +1 -1
  51. package/file-manager/index.mjs +63 -61
  52. package/file-manager/src/components/mp-file-manager.d.ts +4 -3
  53. package/multi-range/index.mjs +56 -50
  54. package/multi-range/src/mint-multi-range.element.d.ts +4 -10
  55. package/multi-range/src/pointer-geometry.d.ts +31 -0
  56. package/navbar/index.mjs +89 -439
  57. package/overlay/index.mjs +1 -1
  58. package/overlay/src/overlay-controller.d.ts +0 -14
  59. package/overlay/src/placement.d.ts +48 -0
  60. package/package.json +7 -1
  61. package/pagination/index.mjs +1 -1
  62. package/phone-input/index.mjs +44 -40
  63. package/phone-input/src/components/stack.d.ts +8 -0
  64. package/query-builder/index.mjs +418 -466
  65. package/query-builder/src/dnd/drag-controller.d.ts +12 -8
  66. package/query-builder/src/mp-query-builder.element.d.ts +5 -1
  67. package/query-builder/src/mp-query-condition.element.d.ts +1 -0
  68. package/radio/index.mjs +1 -1
  69. package/radio-group/index.mjs +1 -1
  70. package/ribbon/index.mjs +477 -498
  71. package/ribbon/src/core/band-text-color.d.ts +10 -0
  72. package/ribbon/src/core/key-tip-allocator.d.ts +10 -0
  73. package/ribbon/src/core/plan-reduce-steps.d.ts +62 -0
  74. package/ribbon/src/mp-ribbon.element.d.ts +0 -27
  75. package/scheduler/index.mjs +726 -711
  76. package/scheduler/src/components/mp-scheduler.d.ts +19 -3
  77. package/scheduler/src/drag/drag-manager.d.ts +1 -9
  78. package/scheduler/src/input/input-handler.d.ts +12 -2
  79. package/scheduler/src/utils/geometry.d.ts +39 -0
  80. package/scheduler/src/views/timeline-view.d.ts +0 -1
  81. package/scheduler-core/index.mjs +84 -71
  82. package/scheduler-core/src/services/resource.service.d.ts +0 -12
  83. package/scheduler-core/src/services/timeline.service.d.ts +0 -9
  84. package/select/index.mjs +1 -1
  85. package/select/src/components/mp-select.d.ts +1 -0
  86. package/signature-pad/index.mjs +21 -23
  87. package/signature-pad/src/canvas-point.d.ts +26 -0
  88. package/signature-pad/src/mp-signature-pad.element.d.ts +1 -7
  89. package/splitter/index.mjs +1 -1
  90. package/splitter/src/components/mp-splitter.d.ts +16 -0
  91. package/splitter/src/managers/index.d.ts +1 -0
  92. package/splitter/src/managers/rescale-panel-sizes.d.ts +14 -0
  93. package/swiper-core/index.mjs +2 -2
  94. package/theming/bs-theme-preboot.js +1 -0
  95. package/theming/color-mode.css +36 -0
  96. package/theming/index.d.ts +1 -0
  97. package/theming/index.mjs +327 -0
  98. package/theming/src/components/mp-theme-toggle.d.ts +71 -0
  99. package/theming/src/cookie.d.ts +31 -0
  100. package/theming/src/index.d.ts +5 -0
  101. package/theming/src/preboot.d.ts +1 -0
  102. package/theming/src/resolve.d.ts +36 -0
  103. package/theming/src/store.d.ts +27 -0
  104. package/theming/src/styles/theme-toggle.styles.d.ts +2 -0
  105. package/theming/src/testing/fake-broadcast-channel.d.ts +35 -0
  106. package/theming/src/toggle-modes.d.ts +23 -0
  107. package/tile-manager/index.mjs +252 -211
  108. package/tile-manager/src/components/mint-tile-manager.element.d.ts +8 -0
  109. package/tile-manager/src/utils/grid-geometry.d.ts +49 -0
  110. package/timeline/index.mjs +156 -164
  111. package/timeline/src/components/mp-timeline.d.ts +41 -7
  112. package/timepicker/index.mjs +7 -4
  113. package/timepicker/src/mp-time-list.element.d.ts +26 -0
  114. package/timepicker/src/mp-timepicker.element.d.ts +3 -0
  115. package/toggle-button/index.mjs +1 -1
  116. package/tree-select/index.mjs +21 -9
  117. package/treeview/index.mjs +1 -1
  118. package/treeview/src/components/mp-treeview.d.ts +6 -4
  119. package/chunks/color-DIeST-IS.mjs +0 -224
  120. package/query-builder/src/mp-query-condition.element.template.d.ts +0 -2
@@ -1,15 +1,15 @@
1
1
  import { unsafeCSS as ce, LitElement as he, html as S, nothing as k } from "lit";
2
2
  import { L as ue } from "../chunks/live-announcer-Bi0orG4n.mjs";
3
3
  import { e as pe } from "../chunks/error-text-B45eDAt1.mjs";
4
- import { D as ve, s as H, d as h, j as E, w, v as X, p as me, x as j, z as C, y as O, r as ie, u as re, q as ge, k as fe } from "../chunks/id-DNZVAnGC.mjs";
5
- import { f as ye } from "../chunks/form-control.styles-C3j87Sn3.mjs";
6
- import { i as be } from "../chunks/invalid-feedback.styles-he0JYrJm.mjs";
7
- import { O as _ } from "../chunks/overlay-controller-DifgO6jT.mjs";
8
- import "../chunks/mp-checkbox-CzwS7Y_t.mjs";
9
- import "../chunks/mp-select-BNrbPwN4.mjs";
10
- import "../chunks/mp-datetime-picker.element-DsWA1AFs.mjs";
11
- function oe(p, e = []) {
12
- for (const t of p) {
4
+ import { D as ve, o as H, d as h, j as E, s as w, q as X, l as me, t as j, v as C, u as O, n as re, r as ie, m as ge } from "../chunks/resource.service--lqLwEqk.mjs";
5
+ import { f as fe } from "../chunks/form-control.styles-C3j87Sn3.mjs";
6
+ import { i as ye } from "../chunks/invalid-feedback.styles-he0JYrJm.mjs";
7
+ import { O as _ } from "../chunks/overlay-controller-BHDagokg.mjs";
8
+ import "../chunks/mp-checkbox-zV83gILn.mjs";
9
+ import "../chunks/mp-select-CgqYFvUj.mjs";
10
+ import "../chunks/mp-datetime-picker.element-Cxu5-qRE.mjs";
11
+ function oe(u, e = []) {
12
+ for (const t of u) {
13
13
  if (H(t)) {
14
14
  oe(t.children, e);
15
15
  continue;
@@ -19,40 +19,40 @@ function oe(p, e = []) {
19
19
  }
20
20
  return e;
21
21
  }
22
- function te(p, e) {
22
+ function te(u, e) {
23
23
  const t = oe(e);
24
- if (t.length === 0) return p;
24
+ if (t.length === 0) return u;
25
25
  const s = /* @__PURE__ */ new Map();
26
- for (const i of t) s.set(i.id, i);
26
+ for (const r of t) s.set(r.id, r);
27
27
  const n = [];
28
- for (const i of p)
29
- s.has(i.id) && n.push(i.id), s.set(i.id, i);
28
+ for (const r of u)
29
+ s.has(r.id) && n.push(r.id), s.set(r.id, r);
30
30
  return n.length > 0 && console.warn(
31
31
  `[mp-scheduler] ${n.length} event id(s) appear in both the "events" input and under a resource; the "events" entry wins. Ids: ${n.join(", ")}`
32
32
  ), [...s.values()];
33
33
  }
34
- function we(p, e, t) {
35
- const s = new Set(e), n = (i) => {
36
- for (const r of i)
37
- H(r) && (t.has(r.id) || (t.add(r.id), r.collapsed && s.add(r.id)), n(r.children));
34
+ function be(u, e, t) {
35
+ const s = new Set(e), n = (r) => {
36
+ for (const i of r)
37
+ H(i) && (t.has(i.id) || (t.add(i.id), i.collapsed && s.add(i.id)), n(i.children));
38
38
  };
39
- return n(p), s;
39
+ return n(u), s;
40
40
  }
41
- function ae(p, e = /* @__PURE__ */ new Map()) {
42
- for (const t of p)
41
+ function ae(u, e = /* @__PURE__ */ new Map()) {
42
+ for (const t of u)
43
43
  H(t) ? ae(t.children, e) : e.set(t.id, t);
44
44
  return e;
45
45
  }
46
- function Ee(p, e) {
46
+ function we(u, e) {
47
47
  const t = /* @__PURE__ */ new Map();
48
- for (const s of p) {
49
- const n = s.resourceId != null && e.has(s.resourceId) ? s.resourceId : null, i = t.get(n);
50
- i ? i.push(s) : t.set(n, [s]);
48
+ for (const s of u) {
49
+ const n = s.resourceId != null && e.has(s.resourceId) ? s.resourceId : null, r = t.get(n);
50
+ r ? r.push(s) : t.set(n, [s]);
51
51
  }
52
52
  return t;
53
53
  }
54
- function xe(p = {}) {
55
- const e = { ...ve, ...p };
54
+ function Ee(u = {}) {
55
+ const e = { ...ve, ...u };
56
56
  return {
57
57
  view: e.initialView,
58
58
  date: e.initialDate,
@@ -79,9 +79,9 @@ function xe(p = {}) {
79
79
  focusedDate: null
80
80
  };
81
81
  }
82
- class De {
82
+ class xe {
83
83
  constructor(e = {}) {
84
- this.listeners = /* @__PURE__ */ new Set(), this.warnedUnassignedIds = /* @__PURE__ */ new Set(), this.warnedDanglingIds = /* @__PURE__ */ new Set(), this.flatEventsInput = [], this.seededGroupIds = /* @__PURE__ */ new Set(), this.state = xe(e);
84
+ this.listeners = /* @__PURE__ */ new Set(), this.warnedUnassignedIds = /* @__PURE__ */ new Set(), this.warnedDanglingIds = /* @__PURE__ */ new Set(), this.flatEventsInput = [], this.seededGroupIds = /* @__PURE__ */ new Set(), this.state = Ee(e);
85
85
  }
86
86
  /**
87
87
  * Get current state
@@ -94,7 +94,7 @@ class De {
94
94
  */
95
95
  setState(e) {
96
96
  const t = typeof e == "function" ? e(this.state) : e, s = { ...this.state, ...t }, n = s.resources !== this.state.resources || !this.state.resourceById;
97
- n && (s.resourceById = ae(s.resources)), (s.events !== this.state.events || n || !this.state.eventsByResource) && (s.eventsByResource = Ee(s.events, s.resourceById)), this.state = s, this.warnUnassignedEvents(), this.warnDanglingEvents(), this.notifyListeners();
97
+ n && (s.resourceById = ae(s.resources)), (s.events !== this.state.events || n || !this.state.eventsByResource) && (s.eventsByResource = we(s.events, s.resourceById)), this.state = s, this.warnUnassignedEvents(), this.warnDanglingEvents(), this.notifyListeners();
98
98
  }
99
99
  /**
100
100
  * `options.requireEventResource` is a DEVELOPMENT signal, not a filter: the
@@ -212,7 +212,7 @@ class De {
212
212
  this.setState((t) => ({
213
213
  resources: e,
214
214
  events: te(this.flatEventsInput, e),
215
- collapsedGroups: we(
215
+ collapsedGroups: be(
216
216
  e,
217
217
  t.collapsedGroups,
218
218
  this.seededGroupIds
@@ -379,11 +379,11 @@ class De {
379
379
  */
380
380
  extendSelection(e, t = null) {
381
381
  this.setState((s) => {
382
- const n = s.selectionAnchor ?? s.focusedCell ?? e, i = s.selectionResourceId ?? s.focusedResourceId ?? t;
382
+ const n = s.selectionAnchor ?? s.focusedCell ?? e, r = s.selectionResourceId ?? s.focusedResourceId ?? t;
383
383
  return {
384
384
  selectionAnchor: n,
385
385
  selectionExtent: e,
386
- selectionResourceId: i
386
+ selectionResourceId: r
387
387
  };
388
388
  });
389
389
  }
@@ -405,70 +405,70 @@ class De {
405
405
  this.setState({ focusedDate: e });
406
406
  }
407
407
  }
408
- function le(p) {
409
- return `${p.getFullYear()}-${String(p.getMonth() + 1).padStart(2, "0")}-${String(
410
- p.getDate()
408
+ function le(u) {
409
+ return `${u.getFullYear()}-${String(u.getMonth() + 1).padStart(2, "0")}-${String(
410
+ u.getDate()
411
411
  ).padStart(2, "0")}`;
412
412
  }
413
- function W(p, e, t) {
414
- const s = t.timeFormat, n = h.formatTime(p.start, s, t.locale), i = h.formatTime(p.end, s, t.locale), r = p.start.toLocaleDateString(t.locale, { weekday: "long", month: "short", day: "numeric" }), o = [`${p.title}, ${n}–${i}`, r];
413
+ function N(u, e, t) {
414
+ const s = t.timeFormat, n = h.formatTime(u.start, s, t.locale), r = h.formatTime(u.end, s, t.locale), i = u.start.toLocaleDateString(t.locale, { weekday: "long", month: "short", day: "numeric" }), o = [`${u.title}, ${n}–${r}`, i];
415
415
  return e && o.push(E(w(t.messages).eventOnResource, { resource: e })), o.join(", ");
416
416
  }
417
- function G(p) {
418
- const { selectionAnchor: e, selectionExtent: t, selectionResourceId: s } = p;
417
+ function q(u) {
418
+ const { selectionAnchor: e, selectionExtent: t, selectionResourceId: s } = u;
419
419
  if (!e || !t) return null;
420
- const n = Math.min(e.start.getTime(), t.start.getTime()), i = Math.max(e.end.getTime(), t.end.getTime());
420
+ const n = Math.min(e.start.getTime(), t.start.getTime()), r = Math.max(e.end.getTime(), t.end.getTime());
421
421
  return {
422
422
  start: new Date(n),
423
- end: new Date(i),
423
+ end: new Date(r),
424
424
  resourceId: s
425
425
  };
426
426
  }
427
- function Z(p, e, t = null) {
428
- const s = G(e);
429
- return !s || s.resourceId && t && s.resourceId !== t ? !1 : p.start.getTime() < s.end.getTime() && p.end.getTime() > s.start.getTime();
427
+ function Z(u, e, t = null) {
428
+ const s = q(e);
429
+ return !s || s.resourceId && t && s.resourceId !== t ? !1 : u.start.getTime() < s.end.getTime() && u.end.getTime() > s.start.getTime();
430
430
  }
431
- function q(p, e, t = null) {
432
- const s = p.start.toLocaleDateString(e.locale, {
431
+ function U(u, e, t = null) {
432
+ const s = u.start.toLocaleDateString(e.locale, {
433
433
  weekday: "long",
434
434
  month: "short",
435
435
  day: "numeric"
436
- }), n = h.formatTime(p.start, e.timeFormat, e.locale), i = [`${s}, ${n}`];
437
- return t && i.push(t), i.join(", ");
436
+ }), n = h.formatTime(u.start, e.timeFormat, e.locale), r = [`${s}, ${n}`];
437
+ return t && r.push(t), r.join(", ");
438
438
  }
439
- function Se(p, e) {
440
- const t = G(p);
439
+ function De(u, e) {
440
+ const t = q(u);
441
441
  if (!t) return "";
442
- const { options: s } = p, n = s.timeFormat, i = { weekday: "short", month: "short", day: "numeric" }, r = `${h.formatTime(t.start, n, s.locale)} ${t.start.toLocaleDateString(s.locale, i)}`, o = `${h.formatTime(t.end, n, s.locale)} ${t.end.toLocaleDateString(s.locale, i)}`, a = e * 1e3, l = Math.max(1, Math.round((t.end.getTime() - t.start.getTime()) / a)), d = w(s.messages);
442
+ const { options: s } = u, n = s.timeFormat, r = { weekday: "short", month: "short", day: "numeric" }, i = `${h.formatTime(t.start, n, s.locale)} ${t.start.toLocaleDateString(s.locale, r)}`, o = `${h.formatTime(t.end, n, s.locale)} ${t.end.toLocaleDateString(s.locale, r)}`, a = e * 1e3, l = Math.max(1, Math.round((t.end.getTime() - t.start.getTime()) / a)), d = w(s.messages);
443
443
  return E(d.selection, {
444
- start: r,
444
+ start: i,
445
445
  end: o,
446
446
  count: l,
447
447
  slots: l === 1 ? d.slotSingular : d.slotPlural
448
448
  });
449
449
  }
450
- function ke(p, e, t) {
451
- const s = t.timeFormat, n = p.toLocaleDateString(t.locale, { weekday: "short", month: "short", day: "numeric" });
450
+ function Se(u, e, t) {
451
+ const s = t.timeFormat, n = u.toLocaleDateString(t.locale, { weekday: "short", month: "short", day: "numeric" });
452
452
  return E(w(t.messages).movedTo, {
453
- start: h.formatTime(p, s, t.locale),
453
+ start: h.formatTime(u, s, t.locale),
454
454
  end: h.formatTime(e, s, t.locale),
455
455
  day: n
456
456
  });
457
457
  }
458
- function Me(p, e, t, s) {
459
- const n = s.timeFormat, i = w(s.messages);
460
- return E(i.resizedEdge, {
461
- edge: t === "start" ? i.startEdge : i.endEdge,
462
- start: h.formatTime(p, n, s.locale),
458
+ function ke(u, e, t, s) {
459
+ const n = s.timeFormat, r = w(s.messages);
460
+ return E(r.resizedEdge, {
461
+ edge: t === "start" ? r.startEdge : r.endEdge,
462
+ start: h.formatTime(u, n, s.locale),
463
463
  end: h.formatTime(e, n, s.locale)
464
464
  });
465
465
  }
466
- const Ce = 40, Te = 20;
467
- function se(p, e) {
468
- const [t = 0, s = 0, n = 0] = e.split(":").map(Number), i = new Date(p);
469
- return i.setHours(0, 0, 0, 0), i.setSeconds(t * 3600 + s * 60 + n), i;
466
+ const Me = 40, Ce = 20;
467
+ function se(u, e) {
468
+ const [t = 0, s = 0, n = 0] = e.split(":").map(Number), r = new Date(u);
469
+ return r.setHours(0, 0, 0, 0), r.setSeconds(t * 3600 + s * 60 + n), r;
470
470
  }
471
- class K {
471
+ class G {
472
472
  constructor(e, t) {
473
473
  this.pendingScroll = null, this.container = e, this.state = t;
474
474
  }
@@ -535,12 +535,12 @@ class K {
535
535
  e.style.backgroundColor = s, e.style.color = t.textColor ?? me(s);
536
536
  }
537
537
  partGeometry(e, t, s) {
538
- const n = s.slotDuration ?? 1800, i = se(e, s.slotMinTime ?? "00:00:00"), r = se(e, s.slotMaxTime ?? "24:00:00"), o = Math.max(e.getTime(), i.getTime()), a = Math.min(t.getTime(), r.getTime());
538
+ const n = s.slotDuration ?? 1800, r = se(e, s.slotMinTime ?? "00:00:00"), i = se(e, s.slotMaxTime ?? "24:00:00"), o = Math.max(e.getTime(), r.getTime()), a = Math.min(t.getTime(), i.getTime());
539
539
  if (a <= o) return null;
540
- const l = Ce / (n * 1e3);
540
+ const l = Me / (n * 1e3);
541
541
  return {
542
- top: (o - i.getTime()) * l,
543
- height: Math.max((a - o) * l, Te)
542
+ top: (o - r.getTime()) * l,
543
+ height: Math.max((a - o) * l, Ce)
544
544
  };
545
545
  }
546
546
  createElement(e, ...t) {
@@ -589,8 +589,8 @@ class K {
589
589
  * ['left','right'] for the timeline.
590
590
  */
591
591
  appendResizeHandles(e, t, [s, n] = ["top", "bottom"]) {
592
- const i = this.state.resolvedPermissions;
593
- t.isStart && j("start", { permissions: i, event: t.event }) && e.appendChild(this.createResizeHandle(s, "start")), t.isEnd && j("end", { permissions: i, event: t.event }) && e.appendChild(this.createResizeHandle(n, "end"));
592
+ const r = this.state.resolvedPermissions;
593
+ t.isStart && j("start", { permissions: r, event: t.event }) && e.appendChild(this.createResizeHandle(s, "start")), t.isEnd && j("end", { permissions: r, event: t.event }) && e.appendChild(this.createResizeHandle(n, "end"));
594
594
  }
595
595
  createResizeHandle(e, t) {
596
596
  const s = this.createElement("div", "resize-handle", e);
@@ -617,17 +617,17 @@ class K {
617
617
  "aria-label"
618
618
  ) || e.label;
619
619
  n && t.setAttribute("aria-label", n), t.setAttribute("aria-describedby", "scheduler-kbd-grid"), e.multiselectable && t.setAttribute("aria-multiselectable", "true");
620
- const i = (r, o) => t.querySelectorAll(r).forEach((a) => {
620
+ const r = (i, o) => t.querySelectorAll(i).forEach((a) => {
621
621
  a.hasAttribute("role") || a.setAttribute("role", o);
622
622
  });
623
- e.columnHeaderRow && i(e.columnHeaderRow, "row"), e.columnHeaders && i(e.columnHeaders, "columnheader"), (e.presentation ?? []).forEach((r) => i(r, "presentation")), e.rows && i(e.rows, "row"), e.cells && i(e.cells, "gridcell");
623
+ e.columnHeaderRow && r(e.columnHeaderRow, "row"), e.columnHeaders && r(e.columnHeaders, "columnheader"), (e.presentation ?? []).forEach((i) => r(i, "presentation")), e.rows && r(e.rows, "row"), e.cells && r(e.cells, "gridcell");
624
624
  }
625
625
  /** aria-current="date" on every element the views styled `.today`. */
626
626
  markToday() {
627
627
  this.container.querySelectorAll(".today").forEach((e) => e.setAttribute("aria-current", "date"));
628
628
  }
629
629
  }
630
- class U extends K {
630
+ class K extends G {
631
631
  constructor() {
632
632
  super(...arguments), this.monthCards = /* @__PURE__ */ new Map();
633
633
  }
@@ -635,9 +635,9 @@ class U extends K {
635
635
  this.clearContainer(), this.container.classList.add("scheduler-year-view");
636
636
  const { date: e, options: t } = this.state, s = h.getYearMonths(e), n = this.createElement("div", "scheduler-year-grid");
637
637
  this.monthCards.clear();
638
- for (const i of s) {
639
- const r = this.createMonthCard(i);
640
- n.appendChild(r);
638
+ for (const r of s) {
639
+ const i = this.createMonthCard(r);
640
+ n.appendChild(i);
641
641
  }
642
642
  this.container.appendChild(n), this.applyGridRoles({
643
643
  label: E(w(this.state.options.messages).yearGridLabel, {
@@ -657,26 +657,26 @@ class U extends K {
657
657
  return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
658
658
  }
659
659
  createMonthCard(e) {
660
- const { events: t, options: s } = this.state, n = this.createElement("div", "scheduler-year-month"), i = U.monthKey(e);
661
- n.setAttribute("role", "gridcell"), n.setAttribute("tabindex", "-1"), n.id = `scheduler-cell-y-${i}`, this.setData(n, { month: e.toISOString() }), this.monthCards.set(i, n);
662
- const r = this.createElement("div", "scheduler-year-month-header");
663
- r.textContent = h.getMonthName(e, s.locale), r.setAttribute("role", "button"), r.setAttribute("tabindex", "0"), this.setData(r, { month: e.toISOString() }), n.appendChild(r);
660
+ const { events: t, options: s } = this.state, n = this.createElement("div", "scheduler-year-month"), r = K.monthKey(e);
661
+ n.setAttribute("role", "gridcell"), n.setAttribute("tabindex", "-1"), n.id = `scheduler-cell-y-${r}`, this.setData(n, { month: e.toISOString() }), this.monthCards.set(r, n);
662
+ const i = this.createElement("div", "scheduler-year-month-header");
663
+ i.textContent = h.getMonthName(e, s.locale), i.setAttribute("role", "button"), i.setAttribute("tabindex", "0"), this.setData(i, { month: e.toISOString() }), n.appendChild(i);
664
664
  const o = this.createElement("div", "scheduler-mini-month"), a = h.getMonthWeeks(e, this.firstDayOfWeek), l = a[0];
665
665
  for (const f of l) {
666
666
  const v = this.createElement("div", "scheduler-mini-day", "header");
667
667
  v.textContent = h.getDayName(f, s.locale, "narrow"), v.style.fontWeight = "600", v.style.color = "#666", o.appendChild(v);
668
668
  }
669
- const d = h.getMonthStart(e), c = h.getMonthEnd(e), u = C.filterByRange(t, d, c), m = w(s.messages);
669
+ const d = h.getMonthStart(e), c = h.getMonthEnd(e), p = C.filterByRange(t, d, c), m = w(s.messages);
670
670
  n.setAttribute(
671
671
  "aria-label",
672
672
  E(m.yearMonthCardLabel, {
673
673
  month: `${h.getMonthName(e, s.locale)} ${e.getFullYear()}`,
674
- count: u.length,
675
- events: u.length === 1 ? m.eventSingular : m.eventPlural
674
+ count: p.length,
675
+ events: p.length === 1 ? m.eventSingular : m.eventPlural
676
676
  })
677
677
  );
678
678
  const g = /* @__PURE__ */ new Set();
679
- for (const f of u) {
679
+ for (const f of p) {
680
680
  const v = new Date(f.start);
681
681
  for (v.setHours(0, 0, 0, 0); v <= f.end; )
682
682
  g.add(v.toISOString().split("T")[0]), v.setDate(v.getDate() + 1);
@@ -698,10 +698,10 @@ class U extends K {
698
698
  updateMonthCardFocus() {
699
699
  const e = this.state.focusedDate;
700
700
  let t = !1;
701
- const s = e ? U.monthKey(e) : null;
702
- for (const [n, i] of this.monthCards) {
703
- const r = n === s;
704
- i.setAttribute("tabindex", r ? "0" : "-1"), i.removeAttribute("aria-selected"), r && (t = !0);
701
+ const s = e ? K.monthKey(e) : null;
702
+ for (const [n, r] of this.monthCards) {
703
+ const i = n === s;
704
+ r.setAttribute("tabindex", i ? "0" : "-1"), r.removeAttribute("aria-selected"), i && (t = !0);
705
705
  }
706
706
  t || this.monthCards.values().next().value?.setAttribute("tabindex", "0");
707
707
  }
@@ -726,28 +726,28 @@ class U extends K {
726
726
  this.monthCards.clear(), this.clearContainer();
727
727
  }
728
728
  }
729
- class N extends K {
729
+ class W extends G {
730
730
  constructor() {
731
731
  super(...arguments), this.dayCells = /* @__PURE__ */ new Map();
732
732
  }
733
733
  render() {
734
734
  this.clearContainer(), this.container.classList.add("scheduler-month-view");
735
- const { date: e, options: t } = this.state, s = h.getMonthWeeks(e, this.firstDayOfWeek), n = this.createElement("div", "scheduler-day-headers"), i = s[0];
736
- for (const o of i) {
735
+ const { date: e, options: t } = this.state, s = h.getMonthWeeks(e, this.firstDayOfWeek), n = this.createElement("div", "scheduler-day-headers"), r = s[0];
736
+ for (const o of r) {
737
737
  const a = this.createElement("div", "scheduler-day-header");
738
738
  a.textContent = h.getDayName(o, t.locale), n.appendChild(a);
739
739
  }
740
740
  this.container.appendChild(n);
741
- const r = this.createElement("div", "scheduler-month-grid");
741
+ const i = this.createElement("div", "scheduler-month-grid");
742
742
  for (const o of s) {
743
743
  const a = this.createElement("div", "scheduler-month-week");
744
744
  for (const l of o) {
745
745
  const d = this.createDayCell(l);
746
746
  a.appendChild(d);
747
747
  }
748
- r.appendChild(a);
748
+ i.appendChild(a);
749
749
  }
750
- this.container.appendChild(r), this.renderEvents(), this.updateDayCellFocus(), this.applyGridRoles({
750
+ this.container.appendChild(i), this.renderEvents(), this.updateDayCellFocus(), this.applyGridRoles({
751
751
  label: E(w(this.state.options.messages).monthGridLabel, {
752
752
  date: h.formatDate(this.state.date, this.state.options.locale, {
753
753
  month: "long",
@@ -772,12 +772,12 @@ class N extends K {
772
772
  createDayCell(e) {
773
773
  const { date: t } = this.state, s = this.createElement("div", "scheduler-month-day");
774
774
  h.isSameMonth(e, t) || s.classList.add("other-month"), h.isToday(e) && s.classList.add("today");
775
- const n = N.dayKey(e);
775
+ const n = W.dayKey(e);
776
776
  s.setAttribute("role", "gridcell"), s.setAttribute("tabindex", "-1"), s.id = `scheduler-cell-m-${n}`;
777
- const i = this.createElement("div", "day-number");
778
- i.textContent = String(e.getDate()), s.appendChild(i);
779
- const r = this.createElement("div", "month-events");
780
- return s.appendChild(r), this.dayCells.set(n, s), this.setData(s, { date: n }), s;
777
+ const r = this.createElement("div", "day-number");
778
+ r.textContent = String(e.getDate()), s.appendChild(r);
779
+ const i = this.createElement("div", "month-events");
780
+ return s.appendChild(i), this.dayCells.set(n, s), this.setData(s, { date: n }), s;
781
781
  }
782
782
  /**
783
783
  * Apply roving tabindex based on `state.focusedDate`. The grid must always
@@ -787,37 +787,37 @@ class N extends K {
787
787
  updateDayCellFocus() {
788
788
  const e = this.state.focusedDate;
789
789
  let t = !1;
790
- const s = e ? N.dayKey(e) : null;
791
- for (const [n, i] of this.dayCells) {
792
- const r = n === s;
793
- i.setAttribute("tabindex", r ? "0" : "-1"), i.removeAttribute("aria-selected"), r && (t = !0);
790
+ const s = e ? W.dayKey(e) : null;
791
+ for (const [n, r] of this.dayCells) {
792
+ const i = n === s;
793
+ r.setAttribute("tabindex", i ? "0" : "-1"), r.removeAttribute("aria-selected"), i && (t = !0);
794
794
  }
795
- t || (Array.from(this.dayCells.values()).find((i) => i.classList.contains("today") && !i.classList.contains("other-month")) || Array.from(this.dayCells.values()).find((i) => !i.classList.contains("other-month")) || this.dayCells.values().next().value)?.setAttribute("tabindex", "0");
795
+ t || (Array.from(this.dayCells.values()).find((r) => r.classList.contains("today") && !r.classList.contains("other-month")) || Array.from(this.dayCells.values()).find((r) => !r.classList.contains("other-month")) || this.dayCells.values().next().value)?.setAttribute("tabindex", "0");
796
796
  }
797
797
  renderEvents() {
798
798
  const { date: e, events: t, options: s } = this.state;
799
799
  h.getMonthStart(e), h.getMonthEnd(e);
800
- const n = h.getMonthWeeks(e, this.firstDayOfWeek), i = n[0][0], r = n[n.length - 1][6];
801
- r.setHours(23, 59, 59, 999);
802
- const o = C.filterByRange(t, i, r), a = /* @__PURE__ */ new Map();
800
+ const n = h.getMonthWeeks(e, this.firstDayOfWeek), r = n[0][0], i = n[n.length - 1][6];
801
+ i.setHours(23, 59, 59, 999);
802
+ const o = C.filterByRange(t, r, i), a = /* @__PURE__ */ new Map();
803
803
  for (const d of o) {
804
- const c = new Date(d.start), u = new Date(d.end), m = new Date(c);
805
- for (m.setHours(0, 0, 0, 0); m <= u; ) {
806
- const g = N.dayKey(m);
804
+ const c = new Date(d.start), p = new Date(d.end), m = new Date(c);
805
+ for (m.setHours(0, 0, 0, 0); m <= p; ) {
806
+ const g = W.dayKey(m);
807
807
  a.has(g) || a.set(g, []), a.get(g).push(d), m.setDate(m.getDate() + 1);
808
808
  }
809
809
  }
810
810
  const l = typeof s.dayMaxEvents == "number" ? s.dayMaxEvents : s.dayMaxEvents === !1 ? Number.POSITIVE_INFINITY : 3;
811
811
  for (const [d, c] of a) {
812
- const u = this.dayCells.get(d);
813
- if (!u) continue;
814
- const m = u.querySelector(".month-events");
812
+ const p = this.dayCells.get(d);
813
+ if (!p) continue;
814
+ const m = p.querySelector(".month-events");
815
815
  if (!m) continue;
816
816
  m.innerHTML = "";
817
817
  const g = c.slice(0, l), f = c.length - g.length;
818
818
  for (const v of g) {
819
819
  const y = this.createElement("div", "scheduler-month-event");
820
- y.textContent = v.title, this.applyEventColors(y, v), y.setAttribute("role", "button"), y.setAttribute("tabindex", "0"), y.setAttribute("aria-label", W(v, null, this.state.options)), y.setAttribute(
820
+ y.textContent = v.title, this.applyEventColors(y, v), y.setAttribute("role", "button"), y.setAttribute("tabindex", "0"), y.setAttribute("aria-label", N(v, null, this.state.options)), y.setAttribute(
821
821
  "aria-pressed",
822
822
  String(this.state.selectedEvent?.id === v.id)
823
823
  ), y.setAttribute("aria-describedby", "scheduler-kbd-event"), this.setData(y, { eventId: v.id }), m.appendChild(y);
@@ -846,37 +846,37 @@ class N extends K {
846
846
  this.dayCells.clear(), this.clearContainer();
847
847
  }
848
848
  }
849
- function ne(p, e) {
850
- const t = new Date(p.start);
849
+ function ne(u, e) {
850
+ const t = new Date(u.start);
851
851
  t.setHours(0, 0, 0, 0);
852
- const s = p.start.getTime() - t.getTime(), n = p.end.getTime() - p.start.getTime(), i = new Date(e);
853
- i.setHours(0, 0, 0, 0);
854
- const r = i.getTime() + s;
855
- return { start: new Date(r), end: new Date(r + n) };
852
+ const s = u.start.getTime() - t.getTime(), n = u.end.getTime() - u.start.getTime(), r = new Date(e);
853
+ r.setHours(0, 0, 0, 0);
854
+ const i = r.getTime() + s;
855
+ return { start: new Date(i), end: new Date(i + n) };
856
856
  }
857
- class Ie extends K {
857
+ class Te extends G {
858
858
  constructor() {
859
859
  super(...arguments), this.dayColumns = [], this.eventElements = /* @__PURE__ */ new Map(), this.slotElements = /* @__PURE__ */ new Map();
860
860
  }
861
861
  render() {
862
862
  this.clearContainer(), this.container.classList.add("scheduler-week-view");
863
- const { date: e, options: t } = this.state, s = h.getWeekDays(e, this.firstDayOfWeek), n = this.createElement("div", "scheduler-day-headers"), i = this.createElement("div", "scheduler-time-gutter-space");
864
- i.style.width = "var(--scheduler-time-gutter-width)", n.appendChild(i);
863
+ const { date: e, options: t } = this.state, s = h.getWeekDays(e, this.firstDayOfWeek), n = this.createElement("div", "scheduler-day-headers"), r = this.createElement("div", "scheduler-time-gutter-space");
864
+ r.style.width = "var(--scheduler-time-gutter-width)", n.appendChild(r);
865
865
  for (const d of s) {
866
866
  const c = this.createElement("div", "scheduler-day-header");
867
867
  h.isToday(d) && c.classList.add("today");
868
- const u = this.createElement("div", "day-name");
869
- u.textContent = h.getDayName(d, t.locale);
868
+ const p = this.createElement("div", "day-name");
869
+ p.textContent = h.getDayName(d, t.locale);
870
870
  const m = this.createElement("div", "day-number");
871
871
  m.textContent = String(d.getDate()), m.setAttribute("role", "button"), m.setAttribute("tabindex", "0"), m.setAttribute(
872
872
  "aria-label",
873
873
  E(w(t.messages).openDayView, {
874
874
  date: h.formatDateWithWeekday(d, t.locale)
875
875
  })
876
- ), this.setData(m, { date: le(d) }), c.appendChild(u), c.appendChild(m), n.appendChild(c);
876
+ ), this.setData(m, { date: le(d) }), c.appendChild(p), c.appendChild(m), n.appendChild(c);
877
877
  }
878
878
  this.container.appendChild(n);
879
- const r = this.createElement("div", "scheduler-time-grid"), o = this.createElement("div", "scheduler-time-gutter"), a = h.getTimeSlots(
879
+ const i = this.createElement("div", "scheduler-time-grid"), o = this.createElement("div", "scheduler-time-gutter"), a = h.getTimeSlots(
880
880
  s[0],
881
881
  t.slotDuration,
882
882
  t.slotMinTime,
@@ -886,20 +886,20 @@ class Ie extends K {
886
886
  const c = this.createElement("div", "scheduler-time-slot-label");
887
887
  c.textContent = h.formatTime(d.start, t.timeFormat, t.locale), o.appendChild(c);
888
888
  }
889
- r.appendChild(o);
889
+ i.appendChild(o);
890
890
  const l = this.createElement("div", "scheduler-days-container");
891
891
  this.dayColumns = [];
892
892
  for (let d = 0; d < s.length; d++) {
893
- const c = s[d], u = this.createElement("div", "scheduler-day-column");
894
- this.setData(u, { dayIndex: d }), u.setAttribute(
893
+ const c = s[d], p = this.createElement("div", "scheduler-day-column");
894
+ this.setData(p, { dayIndex: d }), p.setAttribute(
895
895
  "aria-label",
896
896
  h.formatDateWithWeekday(c, t.locale)
897
- ), u.setAttribute("aria-rowindex", String(d + 2));
897
+ ), p.setAttribute("aria-rowindex", String(d + 2));
898
898
  for (let g = 0; g < a.length; g++) {
899
899
  const f = a[g], { start: v, end: y } = ne(f, c), b = this.createElement("div", "scheduler-time-slot");
900
900
  b.setAttribute("role", "gridcell"), b.setAttribute("tabindex", "-1"), b.setAttribute("aria-selected", "false"), b.setAttribute(
901
901
  "aria-label",
902
- q({ start: v }, t)
902
+ U({ start: v }, t)
903
903
  ), b.setAttribute("aria-colindex", String(g + 2)), b.id = `scheduler-cell-w-${d}-${g}`, this.setData(b, {
904
904
  dayIndex: d,
905
905
  slotIndex: g,
@@ -907,12 +907,12 @@ class Ie extends K {
907
907
  end: y.toISOString()
908
908
  });
909
909
  const M = `${d}-${g}`;
910
- this.slotElements.set(M, b), u.appendChild(b);
910
+ this.slotElements.set(M, b), p.appendChild(b);
911
911
  }
912
912
  const m = this.createElement("div", "scheduler-events-container");
913
- u.appendChild(m), this.dayColumns.push(u), l.appendChild(u);
913
+ p.appendChild(m), this.dayColumns.push(p), l.appendChild(p);
914
914
  }
915
- r.appendChild(l), this.container.appendChild(r), this.renderEvents(), this.updateCellFocusAndSelection(), this.renderNowIndicator(s, a), this.applyGridRoles({
915
+ i.appendChild(l), this.container.appendChild(i), this.renderEvents(), this.updateCellFocusAndSelection(), this.renderNowIndicator(s, a), this.applyGridRoles({
916
916
  label: E(w(this.state.options.messages).weekGridLabel, {
917
917
  date: h.formatDateWithWeekday(
918
918
  h.getWeekStart(this.state.date, this.firstDayOfWeek),
@@ -957,9 +957,9 @@ class Ie extends K {
957
957
  let t = !1, s = null;
958
958
  for (const [, n] of this.slotElements) {
959
959
  s || (s = n);
960
- const i = n.dataset.start, r = n.dataset.end;
961
- if (!i || !r) continue;
962
- const o = { start: new Date(i), end: new Date(r) }, a = !!e && o.start.getTime() === e.start.getTime();
960
+ const r = n.dataset.start, i = n.dataset.end;
961
+ if (!r || !i) continue;
962
+ const o = { start: new Date(r), end: new Date(i) }, a = !!e && o.start.getTime() === e.start.getTime();
963
963
  n.setAttribute("tabindex", a ? "0" : "-1");
964
964
  const l = Z(o, this.state, null);
965
965
  n.setAttribute("aria-selected", l ? "true" : "false"), n.classList.toggle("selected", l), a && (t = !0);
@@ -970,16 +970,16 @@ class Ie extends K {
970
970
  return e.slotDuration !== t.slotDuration || e.timeFormat !== t.timeFormat || e.firstDayOfWeek !== t.firstDayOfWeek || e.slotMinTime !== t.slotMinTime || e.slotMaxTime !== t.slotMaxTime || e.locale !== t.locale;
971
971
  }
972
972
  renderEvents() {
973
- const { date: e, events: t, options: s } = this.state, n = h.getWeekDays(e, this.firstDayOfWeek), i = n[0], r = new Date(n[6]);
974
- r.setHours(23, 59, 59, 999);
975
- const o = C.filterByRange(t, i, r), a = [];
973
+ const { date: e, events: t, options: s } = this.state, n = h.getWeekDays(e, this.firstDayOfWeek), r = n[0], i = new Date(n[6]);
974
+ i.setHours(23, 59, 59, 999);
975
+ const o = C.filterByRange(t, r, i), a = [];
976
976
  for (const c of o) {
977
- const { parts: u } = C.splitInParts(c);
978
- a.push(...u);
977
+ const { parts: p } = C.splitInParts(c);
978
+ a.push(...p);
979
979
  }
980
- const l = C.filterPartsByRange(a, i, r), d = C.getTimelinedParts(l);
980
+ const l = C.filterPartsByRange(a, r, i), d = C.getTimelinedParts(l);
981
981
  this.eventElements.forEach((c) => c.remove()), this.eventElements.clear();
982
- for (const { part: c, trackIndex: u, totalTracks: m, colspan: g } of d) {
982
+ for (const { part: c, trackIndex: p, totalTracks: m, colspan: g } of d) {
983
983
  if (!c.event) continue;
984
984
  const f = n.findIndex((M) => h.isSameDay(M, c.start));
985
985
  if (f === -1) continue;
@@ -987,7 +987,7 @@ class Ie extends K {
987
987
  if (!y) continue;
988
988
  const b = this.createEventElement(
989
989
  c,
990
- u,
990
+ p,
991
991
  m,
992
992
  g,
993
993
  s.slotDuration ?? 1800
@@ -995,19 +995,19 @@ class Ie extends K {
995
995
  y.appendChild(b), this.eventElements.set(c.id, b);
996
996
  }
997
997
  }
998
- createEventElement(e, t, s, n, i) {
999
- const r = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === r.id;
1000
- this.state.keyboardMoveEventId, r.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
998
+ createEventElement(e, t, s, n, r) {
999
+ const i = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === i.id;
1000
+ this.state.keyboardMoveEventId, i.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
1001
1001
  "aria-label",
1002
- W(r, null, this.state.options)
1002
+ N(i, null, this.state.options)
1003
1003
  ), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
1004
1004
  const l = this.partGeometry(e.start, e.end, {
1005
1005
  ...this.state.options,
1006
- slotDuration: i
1007
- }), { top: d, height: c } = l ?? { top: 0, height: 0 }, u = t / s * 100, m = n / s * 100;
1008
- o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${u}%`, o.style.width = `calc(${m}% - 2px)`, this.applyEventColors(o, r), this.setData(o, { eventId: r.id });
1006
+ slotDuration: r
1007
+ }), { top: d, height: c } = l ?? { top: 0, height: 0 }, p = t / s * 100, m = n / s * 100;
1008
+ o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${p}%`, o.style.width = `calc(${m}% - 2px)`, this.applyEventColors(o, i), this.setData(o, { eventId: i.id });
1009
1009
  const g = this.createElement("div", "event-content"), f = this.createElement("div", "event-title");
1010
- f.textContent = r.title, g.appendChild(f);
1010
+ f.textContent = i.title, g.appendChild(f);
1011
1011
  const v = this.createElement("div", "event-time");
1012
1012
  return v.textContent = h.formatTimeRange(
1013
1013
  e.start,
@@ -1023,35 +1023,35 @@ class Ie extends K {
1023
1023
  * box hanging out of the first column for a 3-day range.
1024
1024
  */
1025
1025
  renderPreviewEvent() {
1026
- this.container.querySelectorAll(".scheduler-event.preview").forEach((r) => r.remove());
1026
+ this.container.querySelectorAll(".scheduler-event.preview").forEach((i) => i.remove());
1027
1027
  const { previewEvent: e, options: t, date: s } = this.state;
1028
1028
  if (!e) return;
1029
- const n = h.getWeekDays(s, this.firstDayOfWeek), { parts: i } = C.splitInParts(e);
1030
- for (const r of i) {
1031
- const o = n.findIndex((c) => h.isSameDay(c, r.start));
1029
+ const n = h.getWeekDays(s, this.firstDayOfWeek), { parts: r } = C.splitInParts(e);
1030
+ for (const i of r) {
1031
+ const o = n.findIndex((c) => h.isSameDay(c, i.start));
1032
1032
  if (o === -1) continue;
1033
1033
  const a = this.dayColumns[o]?.querySelector(".scheduler-events-container");
1034
1034
  if (!a) continue;
1035
- const l = this.partGeometry(r.start, r.end, t);
1035
+ const l = this.partGeometry(i.start, i.end, t);
1036
1036
  if (!l) continue;
1037
1037
  const d = this.createElement("div", "scheduler-event", "preview");
1038
- r.isStart || d.classList.add("preview-continues-before"), r.isEnd || d.classList.add("preview-continues-after"), d.style.top = `${l.top}px`, d.style.height = `${l.height}px`, d.style.left = "0", d.style.width = "100%", a.appendChild(d);
1038
+ i.isStart || d.classList.add("preview-continues-before"), i.isEnd || d.classList.add("preview-continues-after"), d.style.top = `${l.top}px`, d.style.height = `${l.height}px`, d.style.left = "0", d.style.width = "100%", a.appendChild(d);
1039
1039
  }
1040
1040
  }
1041
1041
  updateGreyedSlots() {
1042
1042
  const { dragState: e, previewEvent: t, options: s, date: n } = this.state;
1043
1043
  if (this.slotElements.forEach((o) => o.classList.remove("greyed")), !e || !t) return;
1044
- const i = h.getWeekDays(n, this.firstDayOfWeek), r = h.getTimeSlots(
1045
- i[0],
1044
+ const r = h.getWeekDays(n, this.firstDayOfWeek), i = h.getTimeSlots(
1045
+ r[0],
1046
1046
  s.slotDuration,
1047
1047
  s.slotMinTime,
1048
1048
  s.slotMaxTime
1049
1049
  );
1050
- for (let o = 0; o < i.length; o++) {
1051
- const a = i[o];
1052
- for (let l = 0; l < r.length; l++) {
1053
- const d = r[l], { start: c, end: u } = ne(d, a);
1054
- if (c < t.end && u > t.start) {
1050
+ for (let o = 0; o < r.length; o++) {
1051
+ const a = r[o];
1052
+ for (let l = 0; l < i.length; l++) {
1053
+ const d = i[l], { start: c, end: p } = ne(d, a);
1054
+ if (c < t.end && p > t.start) {
1055
1055
  const m = `${o}-${l}`, g = this.slotElements.get(m);
1056
1056
  g && g.classList.add("greyed");
1057
1057
  }
@@ -1062,34 +1062,34 @@ class Ie extends K {
1062
1062
  if (!this.state.options.nowIndicator) return;
1063
1063
  const s = /* @__PURE__ */ new Date(), n = e.findIndex((c) => h.isSameDay(c, s));
1064
1064
  if (n === -1) return;
1065
- const i = this.dayColumns[n];
1066
- if (!i) return;
1067
- const r = new Date(s);
1068
- r.setHours(0, 0, 0, 0);
1069
- const o = (s.getTime() - r.getTime()) / (1e3 * 60), a = (this.state.options.slotDuration ?? 1800) / 60, l = o / a * 40, d = this.createElement("div", "scheduler-now-indicator");
1070
- d.style.top = `${l}px`, i.appendChild(d);
1065
+ const r = this.dayColumns[n];
1066
+ if (!r) return;
1067
+ const i = new Date(s);
1068
+ i.setHours(0, 0, 0, 0);
1069
+ const o = (s.getTime() - i.getTime()) / (1e3 * 60), a = (this.state.options.slotDuration ?? 1800) / 60, l = o / a * 40, d = this.createElement("div", "scheduler-now-indicator");
1070
+ d.style.top = `${l}px`, r.appendChild(d);
1071
1071
  }
1072
1072
  updateNowIndicator() {
1073
1073
  if (!this.state.options.nowIndicator) return;
1074
- const { date: e, options: t } = this.state, s = h.getWeekDays(e, this.firstDayOfWeek), n = /* @__PURE__ */ new Date(), i = s.findIndex((u) => h.isSameDay(u, n));
1075
- if (i === -1) return;
1076
- const r = this.dayColumns[i];
1077
- if (!r) return;
1078
- const o = r.querySelector(".scheduler-now-indicator"), a = new Date(n);
1074
+ const { date: e, options: t } = this.state, s = h.getWeekDays(e, this.firstDayOfWeek), n = /* @__PURE__ */ new Date(), r = s.findIndex((p) => h.isSameDay(p, n));
1075
+ if (r === -1) return;
1076
+ const i = this.dayColumns[r];
1077
+ if (!i) return;
1078
+ const o = i.querySelector(".scheduler-now-indicator"), a = new Date(n);
1079
1079
  a.setHours(0, 0, 0, 0);
1080
1080
  const l = (n.getTime() - a.getTime()) / (1e3 * 60), d = (t.slotDuration ?? 1800) / 60, c = l / d * 40;
1081
1081
  if (o)
1082
1082
  o.style.top = `${c}px`;
1083
1083
  else {
1084
- const u = this.createElement("div", "scheduler-now-indicator");
1085
- u.style.top = `${c}px`, r.appendChild(u);
1084
+ const p = this.createElement("div", "scheduler-now-indicator");
1085
+ p.style.top = `${c}px`, i.appendChild(p);
1086
1086
  }
1087
1087
  }
1088
1088
  destroy() {
1089
1089
  this.eventElements.clear(), this.slotElements.clear(), this.dayColumns = [], this.clearContainer();
1090
1090
  }
1091
1091
  }
1092
- class Ae extends K {
1092
+ class Ie extends G {
1093
1093
  constructor() {
1094
1094
  super(...arguments), this.eventsContainer = null, this.slotElements = /* @__PURE__ */ new Map(), this.dayColumn = null;
1095
1095
  }
@@ -1097,17 +1097,17 @@ class Ae extends K {
1097
1097
  this.clearContainer(), this.container.classList.add("scheduler-day-view");
1098
1098
  const { date: e, options: t } = this.state, s = this.createElement("div", "scheduler-day-headers"), n = this.createElement("div", "scheduler-time-gutter-space");
1099
1099
  n.style.width = "var(--scheduler-time-gutter-width)", s.appendChild(n);
1100
- const i = this.createElement("div", "scheduler-day-header");
1101
- h.isToday(e) && i.classList.add("today");
1102
- const r = this.createElement("div", "day-name");
1103
- r.textContent = h.getDayName(e, t.locale);
1100
+ const r = this.createElement("div", "scheduler-day-header");
1101
+ h.isToday(e) && r.classList.add("today");
1102
+ const i = this.createElement("div", "day-name");
1103
+ i.textContent = h.getDayName(e, t.locale);
1104
1104
  const o = this.createElement("div", "day-number");
1105
1105
  o.textContent = String(e.getDate());
1106
1106
  const a = this.createElement("div", "month-year");
1107
1107
  a.textContent = h.formatDate(e, t.locale, {
1108
1108
  month: "long",
1109
1109
  year: "numeric"
1110
- }), a.style.fontSize = "12px", a.style.color = "#666", i.appendChild(r), i.appendChild(o), i.appendChild(a), s.appendChild(i), this.container.appendChild(s);
1110
+ }), a.style.fontSize = "12px", a.style.color = "#666", r.appendChild(i), r.appendChild(o), r.appendChild(a), s.appendChild(r), this.container.appendChild(s);
1111
1111
  const l = this.createElement("div", "scheduler-time-grid"), d = this.createElement("div", "scheduler-time-gutter"), c = h.getTimeSlots(
1112
1112
  e,
1113
1113
  t.slotDuration,
@@ -1119,18 +1119,18 @@ class Ae extends K {
1119
1119
  f.textContent = h.formatTime(g.start, t.timeFormat, t.locale), d.appendChild(f);
1120
1120
  }
1121
1121
  l.appendChild(d);
1122
- const u = this.createElement("div", "scheduler-days-container");
1122
+ const p = this.createElement("div", "scheduler-days-container");
1123
1123
  this.dayColumn = this.createElement("div", "scheduler-day-column");
1124
1124
  const m = this.dayColumn;
1125
1125
  for (let g = 0; g < c.length; g++) {
1126
1126
  const f = c[g], v = this.createElement("div", "scheduler-time-slot");
1127
- v.setAttribute("role", "gridcell"), v.setAttribute("tabindex", "-1"), v.setAttribute("aria-selected", "false"), v.setAttribute("aria-label", q(f, t)), v.id = `scheduler-cell-d-${g}`, this.setData(v, {
1127
+ v.setAttribute("role", "gridcell"), v.setAttribute("tabindex", "-1"), v.setAttribute("aria-selected", "false"), v.setAttribute("aria-label", U(f, t)), v.id = `scheduler-cell-d-${g}`, this.setData(v, {
1128
1128
  slotIndex: g,
1129
1129
  start: f.start.toISOString(),
1130
1130
  end: f.end.toISOString()
1131
1131
  }), this.slotElements.set(g, v), m.appendChild(v);
1132
1132
  }
1133
- this.eventsContainer = this.createElement("div", "scheduler-events-container"), m.appendChild(this.eventsContainer), u.appendChild(m), l.appendChild(u), this.container.appendChild(l), this.renderEvents(), this.updateCellFocusAndSelection(), h.isToday(e) && t.nowIndicator && this.renderNowIndicator(m), this.applyGridRoles({
1133
+ this.eventsContainer = this.createElement("div", "scheduler-events-container"), m.appendChild(this.eventsContainer), p.appendChild(m), l.appendChild(p), this.container.appendChild(l), this.renderEvents(), this.updateCellFocusAndSelection(), h.isToday(e) && t.nowIndicator && this.renderNowIndicator(m), this.applyGridRoles({
1134
1134
  label: E(w(this.state.options.messages).dayGridLabel, {
1135
1135
  date: h.formatDateWithWeekday(this.state.date, this.state.options.locale)
1136
1136
  }),
@@ -1161,9 +1161,9 @@ class Ae extends K {
1161
1161
  let t = !1, s = null;
1162
1162
  for (const [, n] of this.slotElements) {
1163
1163
  s || (s = n);
1164
- const i = n.dataset.start, r = n.dataset.end;
1165
- if (!i || !r) continue;
1166
- const o = { start: new Date(i), end: new Date(r) }, a = !!e && o.start.getTime() === e.start.getTime();
1164
+ const r = n.dataset.start, i = n.dataset.end;
1165
+ if (!r || !i) continue;
1166
+ const o = { start: new Date(r), end: new Date(i) }, a = !!e && o.start.getTime() === e.start.getTime();
1167
1167
  n.setAttribute("tabindex", a ? "0" : "-1");
1168
1168
  const l = Z(o, this.state, null);
1169
1169
  n.setAttribute("aria-selected", l ? "true" : "false"), n.classList.toggle("selected", l), a && (t = !0);
@@ -1175,39 +1175,39 @@ class Ae extends K {
1175
1175
  this.eventsContainer.innerHTML = "";
1176
1176
  const { date: e, events: t, options: s } = this.state, n = new Date(e);
1177
1177
  n.setHours(0, 0, 0, 0);
1178
- const i = new Date(e);
1179
- i.setHours(23, 59, 59, 999);
1180
- const r = C.filterByRange(t, n, i), o = [];
1181
- for (const l of r) {
1182
- const { parts: d } = C.splitInParts(l), c = C.filterPartsByRange(d, n, i);
1178
+ const r = new Date(e);
1179
+ r.setHours(23, 59, 59, 999);
1180
+ const i = C.filterByRange(t, n, r), o = [];
1181
+ for (const l of i) {
1182
+ const { parts: d } = C.splitInParts(l), c = C.filterPartsByRange(d, n, r);
1183
1183
  o.push(...c);
1184
1184
  }
1185
1185
  const a = C.getTimelinedParts(o);
1186
- for (const { part: l, trackIndex: d, totalTracks: c, colspan: u } of a) {
1186
+ for (const { part: l, trackIndex: d, totalTracks: c, colspan: p } of a) {
1187
1187
  if (!l.event) continue;
1188
1188
  const m = this.createEventElement(
1189
1189
  l,
1190
1190
  d,
1191
1191
  c,
1192
- u,
1192
+ p,
1193
1193
  s.slotDuration ?? 1800
1194
1194
  );
1195
1195
  this.eventsContainer.appendChild(m);
1196
1196
  }
1197
1197
  }
1198
- createEventElement(e, t, s, n, i) {
1199
- const r = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === r.id;
1200
- this.state.keyboardMoveEventId, r.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
1198
+ createEventElement(e, t, s, n, r) {
1199
+ const i = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === i.id;
1200
+ this.state.keyboardMoveEventId, i.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
1201
1201
  "aria-label",
1202
- W(r, null, this.state.options)
1202
+ N(i, null, this.state.options)
1203
1203
  ), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
1204
1204
  const l = this.partGeometry(e.start, e.end, {
1205
1205
  ...this.state.options,
1206
- slotDuration: i
1207
- }), { top: d, height: c } = l ?? { top: 0, height: 0 }, u = t / s * 100, m = n / s * 100;
1208
- o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${u}%`, o.style.width = `calc(${m}% - 2px)`, this.applyEventColors(o, r), this.setData(o, { eventId: r.id });
1206
+ slotDuration: r
1207
+ }), { top: d, height: c } = l ?? { top: 0, height: 0 }, p = t / s * 100, m = n / s * 100;
1208
+ o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${p}%`, o.style.width = `calc(${m}% - 2px)`, this.applyEventColors(o, i), this.setData(o, { eventId: i.id });
1209
1209
  const g = this.createElement("div", "event-content"), f = this.createElement("div", "event-title");
1210
- f.textContent = r.title, g.appendChild(f);
1210
+ f.textContent = i.title, g.appendChild(f);
1211
1211
  const v = this.createElement("div", "event-time");
1212
1212
  return v.textContent = h.formatTimeRange(
1213
1213
  e.start,
@@ -1219,15 +1219,15 @@ class Ae extends K {
1219
1219
  renderNowIndicator(e) {
1220
1220
  const t = /* @__PURE__ */ new Date(), s = new Date(t);
1221
1221
  s.setHours(0, 0, 0, 0);
1222
- const n = (t.getTime() - s.getTime()) / (1e3 * 60), i = (this.state.options.slotDuration ?? 1800) / 60, r = n / i * 40, o = this.createElement("div", "scheduler-now-indicator");
1223
- o.style.top = `${r}px`, e.appendChild(o);
1222
+ const n = (t.getTime() - s.getTime()) / (1e3 * 60), r = (this.state.options.slotDuration ?? 1800) / 60, i = n / r * 40, o = this.createElement("div", "scheduler-now-indicator");
1223
+ o.style.top = `${i}px`, e.appendChild(o);
1224
1224
  }
1225
1225
  updateNowIndicator() {
1226
1226
  if (!this.dayColumn || !this.state.options.nowIndicator || !h.isToday(this.state.date)) return;
1227
1227
  const e = this.dayColumn.querySelector(".scheduler-now-indicator"), t = /* @__PURE__ */ new Date(), s = new Date(t);
1228
1228
  s.setHours(0, 0, 0, 0);
1229
- const n = (t.getTime() - s.getTime()) / (1e3 * 60), i = (this.state.options.slotDuration ?? 1800) / 60, r = n / i * 40;
1230
- e ? e.style.top = `${r}px` : this.renderNowIndicator(this.dayColumn);
1229
+ const n = (t.getTime() - s.getTime()) / (1e3 * 60), r = (this.state.options.slotDuration ?? 1800) / 60, i = n / r * 40;
1230
+ e ? e.style.top = `${i}px` : this.renderNowIndicator(this.dayColumn);
1231
1231
  }
1232
1232
  update(e) {
1233
1233
  const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options);
@@ -1242,17 +1242,17 @@ class Ae extends K {
1242
1242
  }
1243
1243
  updateGreyedSlots() {
1244
1244
  const { dragState: e, previewEvent: t, options: s, date: n } = this.state;
1245
- if (this.slotElements.forEach((r) => r.classList.remove("greyed")), !e || !t) return;
1246
- const i = h.getTimeSlots(
1245
+ if (this.slotElements.forEach((i) => i.classList.remove("greyed")), !e || !t) return;
1246
+ const r = h.getTimeSlots(
1247
1247
  n,
1248
1248
  s.slotDuration,
1249
1249
  s.slotMinTime,
1250
1250
  s.slotMaxTime
1251
1251
  );
1252
- for (let r = 0; r < i.length; r++) {
1253
- const o = i[r];
1252
+ for (let i = 0; i < r.length; i++) {
1253
+ const o = r[i];
1254
1254
  if (o.start < t.end && o.end > t.start) {
1255
- const a = this.slotElements.get(r);
1255
+ const a = this.slotElements.get(i);
1256
1256
  a && a.classList.add("greyed");
1257
1257
  }
1258
1258
  }
@@ -1268,19 +1268,33 @@ class Ae extends K {
1268
1268
  this.eventsContainer.querySelectorAll(".scheduler-event.preview").forEach((a) => a.remove());
1269
1269
  const { previewEvent: e, options: t, date: s } = this.state;
1270
1270
  if (!e) return;
1271
- const { parts: n } = C.splitInParts(e), i = n.find((a) => h.isSameDay(s, a.start));
1272
- if (!i) return;
1273
- const r = this.partGeometry(i.start, i.end, t);
1271
+ const { parts: n } = C.splitInParts(e), r = n.find((a) => h.isSameDay(s, a.start));
1274
1272
  if (!r) return;
1273
+ const i = this.partGeometry(r.start, r.end, t);
1274
+ if (!i) return;
1275
1275
  const o = this.createElement("div", "scheduler-event", "preview");
1276
- i.isStart || o.classList.add("preview-continues-before"), i.isEnd || o.classList.add("preview-continues-after"), o.style.top = `${r.top}px`, o.style.height = `${r.height}px`, o.style.left = "0", o.style.width = "100%", this.eventsContainer.appendChild(o);
1276
+ r.isStart || o.classList.add("preview-continues-before"), r.isEnd || o.classList.add("preview-continues-after"), o.style.top = `${i.top}px`, o.style.height = `${i.height}px`, o.style.left = "0", o.style.width = "100%", this.eventsContainer.appendChild(o);
1277
1277
  }
1278
1278
  destroy() {
1279
1279
  this.eventsContainer = null, this.dayColumn = null, this.slotElements.clear(), this.clearContainer();
1280
1280
  }
1281
1281
  }
1282
- const z = "__mp-unassigned__";
1283
- class I extends K {
1282
+ function Ae(u, e, t, s) {
1283
+ const n = (r, i, o) => r < i + t ? -Math.min(1, (i + t - r) / t) * s : r > o - t ? Math.min(1, (r - (o - t)) / t) * s : 0;
1284
+ return {
1285
+ x: n(u.x, e.left, e.right),
1286
+ y: n(u.y, e.top, e.bottom)
1287
+ };
1288
+ }
1289
+ function Re(u, e, t, s) {
1290
+ const n = Math.max(t, e - s);
1291
+ return Math.round(Math.min(Math.max(u, t), n));
1292
+ }
1293
+ function Pe(u, e) {
1294
+ return Math.round(u / (e || 1) * 100);
1295
+ }
1296
+ const $ = "__mp-unassigned__";
1297
+ class P extends G {
1284
1298
  constructor() {
1285
1299
  super(...arguments), this.rowElements = /* @__PURE__ */ new Map(), this.pendingFocusKey = null, this.columnDrag = null, this.boundColumnDragMove = (e) => this.onColumnDragMove(e), this.boundColumnDragEnd = () => this.onColumnDragEnd();
1286
1300
  }
@@ -1304,8 +1318,8 @@ class I extends K {
1304
1318
  */
1305
1319
  get trackMetrics() {
1306
1320
  const e = getComputedStyle(this.container), t = (s, n) => {
1307
- const i = Number.parseFloat(e.getPropertyValue(s).trim());
1308
- return Number.isFinite(i) && i >= 0 ? i : n;
1321
+ const r = Number.parseFloat(e.getPropertyValue(s).trim());
1322
+ return Number.isFinite(r) && r >= 0 ? r : n;
1309
1323
  };
1310
1324
  return {
1311
1325
  height: t("--scheduler-timeline-event-height", 28),
@@ -1315,53 +1329,53 @@ class I extends K {
1315
1329
  }
1316
1330
  render() {
1317
1331
  this.captureActionFocus(), this.clearContainer(), this.container.classList.add("scheduler-timeline-view");
1318
- const { date: e, options: t, resources: s, collapsedGroups: n } = this.state, i = h.getWeekDays(e, this.firstDayOfWeek), r = i.map(
1332
+ const { date: e, options: t, resources: s, collapsedGroups: n } = this.state, r = h.getWeekDays(e, this.firstDayOfWeek), i = r.map(
1319
1333
  (D) => h.getTimeSlots(D, t.slotDuration, t.slotMinTime, t.slotMaxTime)
1320
- ), o = r.reduce((D, T) => D + T.length, 0), a = O.flatten(s, n), l = this.hasUnassignedRow(this.state), d = a.filter((D) => D.visible).length + 2 + (l ? 1 : 0), c = this.createElement("div", "scheduler-timeline");
1334
+ ), o = i.reduce((D, T) => D + T.length, 0), a = O.flatten(s, n), l = this.hasUnassignedRow(this.state), d = a.filter((D) => D.visible).length + 2 + (l ? 1 : 0), c = this.createElement("div", "scheduler-timeline");
1321
1335
  c.setAttribute("role", "grid"), c.setAttribute(
1322
1336
  "aria-label",
1323
1337
  E(w(t.messages).timelineGridLabel, {
1324
- date: h.formatDateWithWeekday(i[0], t.locale)
1338
+ date: h.formatDateWithWeekday(r[0], t.locale)
1325
1339
  })
1326
1340
  ), c.setAttribute("aria-rowcount", String(d)), c.setAttribute("aria-colcount", String(1 + o)), c.setAttribute("aria-describedby", "scheduler-kbd-grid"), c.setAttribute("aria-multiselectable", "true");
1327
- const u = this.createElement("div", "scheduler-timeline-header");
1328
- u.setAttribute("role", "row"), u.setAttribute("aria-rowindex", "1");
1341
+ const p = this.createElement("div", "scheduler-timeline-header");
1342
+ p.setAttribute("role", "row"), p.setAttribute("aria-rowindex", "1");
1329
1343
  const m = this.createElement("div", "scheduler-resource-header");
1330
- m.setAttribute("role", "columnheader"), m.setAttribute("aria-colindex", "1"), m.textContent = w(this.state.options.messages).resourcesHeader, m.appendChild(this.createColumnResizer()), u.appendChild(m);
1344
+ m.setAttribute("role", "columnheader"), m.setAttribute("aria-colindex", "1"), m.textContent = w(this.state.options.messages).resourcesHeader, m.appendChild(this.createColumnResizer()), p.appendChild(m);
1331
1345
  const g = this.createElement("div", "scheduler-timeline-slots-header");
1332
1346
  g.setAttribute("role", "presentation");
1333
1347
  let f = 2;
1334
- for (const [D, T] of i.entries()) {
1335
- const V = r[D].length, P = this.createElement("div", "scheduler-timeline-slot-header", "day");
1336
- P.setAttribute("role", "columnheader"), P.setAttribute("aria-colindex", String(f)), P.setAttribute("aria-colspan", String(V)), f += V, P.style.width = `${V * this.slotWidth}px`;
1348
+ for (const [D, T] of r.entries()) {
1349
+ const V = i[D].length, R = this.createElement("div", "scheduler-timeline-slot-header", "day");
1350
+ R.setAttribute("role", "columnheader"), R.setAttribute("aria-colindex", String(f)), R.setAttribute("aria-colspan", String(V)), f += V, R.style.width = `${V * this.slotWidth}px`;
1337
1351
  const ee = this.createElement("span", "day-label");
1338
- ee.textContent = h.formatDateWithWeekday(T, t.locale), P.appendChild(ee), P.style.borderBottom = "1px solid var(--scheduler-border-color)", g.appendChild(P);
1352
+ ee.textContent = h.formatDateWithWeekday(T, t.locale), R.appendChild(ee), R.style.borderBottom = "1px solid var(--scheduler-border-color)", g.appendChild(R);
1339
1353
  }
1340
- u.appendChild(g);
1354
+ p.appendChild(g);
1341
1355
  const v = this.createElement("div", "scheduler-timeline-head");
1342
- v.appendChild(u), c.appendChild(v);
1356
+ v.appendChild(p), c.appendChild(v);
1343
1357
  const y = this.createElement("div", "scheduler-timeline-header");
1344
1358
  y.setAttribute("role", "row"), y.setAttribute("aria-rowindex", "2");
1345
1359
  const b = this.createElement("div", "scheduler-resource-header");
1346
1360
  b.setAttribute("role", "columnheader"), b.setAttribute("aria-colindex", "1"), b.style.borderBottom = "1px solid var(--scheduler-border-color)", y.appendChild(b);
1347
1361
  const M = this.createElement("div", "scheduler-timeline-slots-header");
1348
1362
  M.setAttribute("role", "presentation");
1349
- let A = 2;
1350
- for (const D of r)
1363
+ let I = 2;
1364
+ for (const D of i)
1351
1365
  for (const T of D) {
1352
- const R = this.createElement("div", "scheduler-timeline-slot-header");
1353
- R.setAttribute("role", "columnheader"), R.setAttribute("aria-colindex", String(A)), A++, R.style.width = `${this.slotWidth}px`, R.textContent = h.formatTime(T.start, t.timeFormat, t.locale), R.style.fontSize = "10px", M.appendChild(R);
1366
+ const A = this.createElement("div", "scheduler-timeline-slot-header");
1367
+ A.setAttribute("role", "columnheader"), A.setAttribute("aria-colindex", String(I)), I++, A.style.width = `${this.slotWidth}px`, A.textContent = h.formatTime(T.start, t.timeFormat, t.locale), A.style.fontSize = "10px", M.appendChild(A);
1354
1368
  }
1355
1369
  y.appendChild(M), v.appendChild(y);
1356
1370
  const x = this.createElement("div", "scheduler-timeline-body"), F = O.flatten(s, n);
1357
1371
  let L = 3;
1358
1372
  for (const D of F) {
1359
1373
  if (!D.visible) continue;
1360
- const T = this.createResourceRow(D, r);
1374
+ const T = this.createResourceRow(D, i);
1361
1375
  T.setAttribute("aria-rowindex", String(L)), x.appendChild(T), L++;
1362
1376
  }
1363
1377
  if (l) {
1364
- const D = this.createUnassignedRow(r);
1378
+ const D = this.createUnassignedRow(i);
1365
1379
  D.setAttribute("aria-rowindex", String(L)), x.appendChild(D), L++;
1366
1380
  }
1367
1381
  if (c.appendChild(x), this.container.appendChild(c), F.length === 0 && !l) {
@@ -1369,7 +1383,7 @@ class I extends K {
1369
1383
  D.textContent = w(t.messages).noResources, x.appendChild(D);
1370
1384
  }
1371
1385
  const Q = this.createAddBar();
1372
- Q && this.container.appendChild(Q), this.renderEvents(i), this.updateCellFocusAndSelection(), this.restoreActionFocus();
1386
+ Q && this.container.appendChild(Q), this.renderEvents(r), this.updateCellFocusAndSelection(), this.restoreActionFocus();
1373
1387
  }
1374
1388
  /**
1375
1389
  * Focus key of an action control: what it does plus which row it belongs to.
@@ -1411,22 +1425,22 @@ class I extends K {
1411
1425
  */
1412
1426
  updateCellFocusAndSelection() {
1413
1427
  const e = this.state.focusedCell, t = this.state.focusedResourceId, s = this.container.querySelectorAll(".scheduler-timeline-slot");
1414
- let n = !1, i = null;
1415
- s.forEach((r) => {
1416
- i || (i = r);
1417
- const o = r.dataset.start, a = r.dataset.end, l = r.dataset.resourceId ?? null;
1428
+ let n = !1, r = null;
1429
+ s.forEach((i) => {
1430
+ r || (r = i);
1431
+ const o = i.dataset.start, a = i.dataset.end, l = i.dataset.resourceId ?? null;
1418
1432
  if (!o || !a) return;
1419
1433
  const d = { start: new Date(o), end: new Date(a) }, c = !!e && d.start.getTime() === e.start.getTime() && t === l;
1420
- r.setAttribute("tabindex", c ? "0" : "-1");
1421
- const u = Z(d, this.state, l);
1422
- r.setAttribute("aria-selected", u ? "true" : "false"), r.classList.toggle("selected", u), c && (n = !0);
1423
- }), !n && i && i.setAttribute("tabindex", "0");
1434
+ i.setAttribute("tabindex", c ? "0" : "-1");
1435
+ const p = Z(d, this.state, l);
1436
+ i.setAttribute("aria-selected", p ? "true" : "false"), i.classList.toggle("selected", p), c && (n = !0);
1437
+ }), !n && r && r.setAttribute("tabindex", "0");
1424
1438
  }
1425
1439
  createResourceRow(e, t) {
1426
1440
  const { options: s } = this.state, n = this.createElement("div", "scheduler-timeline-row");
1427
1441
  n.setAttribute("role", "row"), H(e.item) && n.classList.add("group");
1428
- const i = this.createElement("div", "scheduler-resource-cell");
1429
- if (i.setAttribute("role", "rowheader"), i.setAttribute("aria-colindex", "1"), i.style.paddingLeft = `${8 + e.depth * 16}px`, H(e.item)) {
1442
+ const r = this.createElement("div", "scheduler-resource-cell");
1443
+ if (r.setAttribute("role", "rowheader"), r.setAttribute("aria-colindex", "1"), r.style.paddingLeft = `${8 + e.depth * 16}px`, H(e.item)) {
1430
1444
  const l = this.createElement("button", "expand-toggle");
1431
1445
  l.type = "button";
1432
1446
  const d = this.state.collapsedGroups.has(e.item.id);
@@ -1436,10 +1450,10 @@ class I extends K {
1436
1450
  w(this.state.options.messages)[d ? "expandGroup" : "collapseGroup"],
1437
1451
  { title: e.item.title }
1438
1452
  )
1439
- ), this.setData(l, { action: "toggle-group", groupId: e.item.id }), i.appendChild(l);
1453
+ ), this.setData(l, { action: "toggle-group", groupId: e.item.id }), r.appendChild(l);
1440
1454
  }
1441
- const r = this.createElement("span", "resource-title");
1442
- r.textContent = e.item.title, r.title = e.item.title, this.can("updateResource") && this.setData(r, { resourceId: e.item.id }), i.appendChild(r), this.appendResourceActions(i, e.item), n.appendChild(i);
1455
+ const i = this.createElement("span", "resource-title");
1456
+ i.textContent = e.item.title, i.title = e.item.title, this.can("updateResource") && this.setData(i, { resourceId: e.item.id }), r.appendChild(i), this.appendResourceActions(r, e.item), n.appendChild(r);
1443
1457
  const o = this.createElement("div", "scheduler-timeline-slots");
1444
1458
  o.setAttribute("role", "presentation");
1445
1459
  let a = 2;
@@ -1448,14 +1462,14 @@ class I extends K {
1448
1462
  const c = this.createElement("div", "scheduler-timeline-slot");
1449
1463
  c.setAttribute("role", "gridcell"), c.setAttribute("aria-colindex", String(a)), a++, c.setAttribute("tabindex", "-1"), c.setAttribute("aria-selected", "false"), c.setAttribute(
1450
1464
  "aria-label",
1451
- q(d, this.state.options, e.item.title)
1465
+ U(d, this.state.options, e.item.title)
1452
1466
  ), c.id = `scheduler-cell-t-${e.item.id}-${d.start.getTime()}`, c.style.width = `${this.slotWidth}px`, this.setData(c, {
1453
1467
  resourceId: e.item.id,
1454
1468
  start: d.start.toISOString(),
1455
1469
  end: d.end.toISOString()
1456
1470
  }), o.appendChild(c);
1457
1471
  }
1458
- if (ie(e.item)) {
1472
+ if (re(e.item)) {
1459
1473
  const l = this.createElement("div", "scheduler-timeline-events");
1460
1474
  l.setAttribute("role", "gridcell"), l.setAttribute("aria-colindex", "2"), l.setAttribute("aria-colspan", String(a - 2)), o.appendChild(l);
1461
1475
  }
@@ -1500,16 +1514,16 @@ class I extends K {
1500
1514
  return t.setAttribute("role", "separator"), t.setAttribute("tabindex", "0"), t.setAttribute("aria-orientation", "vertical"), t.setAttribute("aria-label", e.resizeResourceColumn), this.updateResizerValue(t), t.addEventListener("pointerdown", (s) => {
1501
1515
  s.preventDefault(), s.stopPropagation(), this.columnDrag = { startX: s.clientX, startWidth: this.currentColumnWidth() }, document.addEventListener("pointermove", this.boundColumnDragMove), document.addEventListener("pointerup", this.boundColumnDragEnd);
1502
1516
  }), t.addEventListener("keydown", (s) => {
1503
- const i = this.currentColumnWidth();
1517
+ const r = this.currentColumnWidth();
1504
1518
  switch (s.key) {
1505
1519
  case "ArrowLeft":
1506
- s.preventDefault(), this.applyColumnWidth(i - 16);
1520
+ s.preventDefault(), this.applyColumnWidth(r - 16);
1507
1521
  break;
1508
1522
  case "ArrowRight":
1509
- s.preventDefault(), this.applyColumnWidth(i + 16);
1523
+ s.preventDefault(), this.applyColumnWidth(r + 16);
1510
1524
  break;
1511
1525
  case "Home":
1512
- s.preventDefault(), this.applyColumnWidth(I.MIN_COLUMN_PX);
1526
+ s.preventDefault(), this.applyColumnWidth(P.MIN_COLUMN_PX);
1513
1527
  break;
1514
1528
  case "End":
1515
1529
  s.preventDefault(), this.applyColumnWidth(Number.MAX_SAFE_INTEGER);
@@ -1520,27 +1534,27 @@ class I extends K {
1520
1534
  currentColumnWidth() {
1521
1535
  return this.container.querySelector(".scheduler-resource-header")?.getBoundingClientRect().width || 200;
1522
1536
  }
1523
- maxColumnWidth() {
1524
- return Math.max(
1525
- I.MIN_COLUMN_PX,
1526
- this.container.clientWidth - I.MIN_GRID_PX
1527
- );
1528
- }
1529
1537
  applyColumnWidth(e) {
1530
- const t = Math.round(
1531
- Math.min(Math.max(e, I.MIN_COLUMN_PX), this.maxColumnWidth())
1538
+ const t = Re(
1539
+ e,
1540
+ this.container.clientWidth,
1541
+ P.MIN_COLUMN_PX,
1542
+ P.MIN_GRID_PX
1532
1543
  );
1533
1544
  this.container.style.setProperty(
1534
1545
  "--scheduler-resource-column-width",
1535
- `min(${t}px, calc(100% - ${I.MIN_GRID_PX}px))`
1546
+ `min(${t}px, calc(100% - ${P.MIN_GRID_PX}px))`
1536
1547
  );
1537
1548
  const s = this.container.querySelector(".scheduler-column-resizer");
1538
1549
  s && this.updateResizerValue(s, t);
1539
1550
  }
1540
1551
  /** aria-valuenow as a percentage of the scroller, per the splitter pattern. */
1541
1552
  updateResizerValue(e, t) {
1542
- const s = this.container.clientWidth || 1, n = t ?? this.currentColumnWidth();
1543
- e.setAttribute("aria-valuemin", "0"), e.setAttribute("aria-valuemax", "100"), e.setAttribute("aria-valuenow", String(Math.round(n / s * 100)));
1553
+ const s = t ?? this.currentColumnWidth();
1554
+ e.setAttribute("aria-valuemin", "0"), e.setAttribute("aria-valuemax", "100"), e.setAttribute(
1555
+ "aria-valuenow",
1556
+ String(Pe(s, this.container.clientWidth))
1557
+ );
1544
1558
  }
1545
1559
  onColumnDragMove(e) {
1546
1560
  this.columnDrag && this.applyColumnWidth(this.columnDrag.startWidth + (e.clientX - this.columnDrag.startX));
@@ -1550,7 +1564,7 @@ class I extends K {
1550
1564
  }
1551
1565
  /** True when the capability is granted for the whole scheduler. */
1552
1566
  can(e) {
1553
- return re(e, { permissions: this.state.resolvedPermissions });
1567
+ return ie(e, { permissions: this.state.resolvedPermissions });
1554
1568
  }
1555
1569
  /**
1556
1570
  * Per-row resource actions, rendered into the pinned rowheader cell.
@@ -1598,12 +1612,12 @@ class I extends K {
1598
1612
  */
1599
1613
  appendResourceActions(e, t) {
1600
1614
  if (this.rowActions(t).length === 0) return;
1601
- const s = w(this.state.options.messages), n = E(s.rowMenuLabel, { title: t.title }), i = this.createElement("button", "scheduler-row-menu-button");
1602
- i.type = "button", i.setAttribute("aria-label", n), i.title = n, i.setAttribute("aria-haspopup", "dialog"), i.setAttribute("aria-expanded", "false"), i.tabIndex = -1, this.setData(i, { action: "row-menu", resourceId: t.id });
1615
+ const s = w(this.state.options.messages), n = E(s.rowMenuLabel, { title: t.title }), r = this.createElement("button", "scheduler-row-menu-button");
1616
+ r.type = "button", r.setAttribute("aria-label", n), r.title = n, r.setAttribute("aria-haspopup", "dialog"), r.setAttribute("aria-expanded", "false"), r.tabIndex = -1, this.setData(r, { action: "row-menu", resourceId: t.id });
1603
1617
  const o = t.eventColor ?? t.color, a = o ? ge(o) : null;
1604
- o && a && (i.style.background = o, i.style.color = a, i.style.borderColor = o);
1618
+ o && a && (r.style.background = o, r.style.color = a, r.style.borderColor = o);
1605
1619
  const l = this.createElement("span", "action-glyph");
1606
- l.setAttribute("aria-hidden", "true"), l.textContent = "⋯", i.appendChild(l), e.insertBefore(i, e.firstChild);
1620
+ l.setAttribute("aria-hidden", "true"), l.textContent = "⋯", r.appendChild(l), e.insertBefore(r, e.firstChild);
1607
1621
  }
1608
1622
  /**
1609
1623
  * Root-level "Add resource" / "Add group" bar, pinned to the bottom of the
@@ -1619,12 +1633,12 @@ class I extends K {
1619
1633
  if (!e && !t) return null;
1620
1634
  const s = w(this.state.options.messages), n = this.createElement("div", "scheduler-timeline-addbar");
1621
1635
  if (n.setAttribute("role", "toolbar"), n.setAttribute("aria-label", s.addResourceBarLabel), e) {
1622
- const i = this.createElement("button", "scheduler-add-button");
1623
- i.type = "button", i.textContent = s.addResource, this.setData(i, { action: "add-resource" }), n.appendChild(i);
1636
+ const r = this.createElement("button", "scheduler-add-button");
1637
+ r.type = "button", r.textContent = s.addResource, this.setData(r, { action: "add-resource" }), n.appendChild(r);
1624
1638
  }
1625
1639
  if (t) {
1626
- const i = this.createElement("button", "scheduler-add-button");
1627
- i.type = "button", i.textContent = s.addGroup, this.setData(i, { action: "add-group" }), n.appendChild(i);
1640
+ const r = this.createElement("button", "scheduler-add-button");
1641
+ r.type = "button", r.textContent = s.addGroup, this.setData(r, { action: "add-group" }), n.appendChild(r);
1628
1642
  }
1629
1643
  return n;
1630
1644
  }
@@ -1644,33 +1658,33 @@ class I extends K {
1644
1658
  s.setAttribute("role", "row");
1645
1659
  const n = this.createElement("div", "scheduler-resource-cell");
1646
1660
  n.setAttribute("role", "rowheader"), n.setAttribute("aria-colindex", "1"), n.style.paddingLeft = "8px";
1647
- const i = this.createElement("span", "resource-title");
1648
- i.textContent = w(t.messages).unassignedResource, i.title = i.textContent, n.appendChild(i), s.appendChild(n);
1649
- const r = this.createElement("div", "scheduler-timeline-slots");
1650
- r.setAttribute("role", "presentation");
1661
+ const r = this.createElement("span", "resource-title");
1662
+ r.textContent = w(t.messages).unassignedResource, r.title = r.textContent, n.appendChild(r), s.appendChild(n);
1663
+ const i = this.createElement("div", "scheduler-timeline-slots");
1664
+ i.setAttribute("role", "presentation");
1651
1665
  let o = 2;
1652
1666
  for (const l of e)
1653
1667
  for (const d of l) {
1654
1668
  const c = this.createElement("div", "scheduler-timeline-slot");
1655
1669
  c.setAttribute("role", "gridcell"), c.setAttribute("aria-colindex", String(o)), o++, c.setAttribute("tabindex", "-1"), c.setAttribute("aria-selected", "false"), c.setAttribute(
1656
1670
  "aria-label",
1657
- q(
1671
+ U(
1658
1672
  d,
1659
1673
  this.state.options,
1660
1674
  w(this.state.options.messages).unassignedResource
1661
1675
  )
1662
- ), c.id = `scheduler-cell-t-${z}-${d.start.getTime()}`, c.style.width = `${this.slotWidth}px`, this.setData(c, {
1676
+ ), c.id = `scheduler-cell-t-${$}-${d.start.getTime()}`, c.style.width = `${this.slotWidth}px`, this.setData(c, {
1663
1677
  start: d.start.toISOString(),
1664
1678
  end: d.end.toISOString(),
1665
1679
  unassigned: "true"
1666
- }), r.appendChild(c);
1680
+ }), i.appendChild(c);
1667
1681
  }
1668
1682
  const a = this.createElement("div", "scheduler-timeline-events");
1669
- return a.setAttribute("role", "gridcell"), a.setAttribute("aria-colindex", "2"), a.setAttribute("aria-colspan", String(o - 2)), r.appendChild(a), s.appendChild(r), this.rowElements.set(z, s), s;
1683
+ return a.setAttribute("role", "gridcell"), a.setAttribute("aria-colindex", "2"), a.setAttribute("aria-colspan", String(o - 2)), i.appendChild(a), s.appendChild(i), this.rowElements.set($, s), s;
1670
1684
  }
1671
1685
  renderEvents(e) {
1672
- const { resources: t, options: s } = this.state, n = e[0], i = new Date(e[6]);
1673
- i.setHours(23, 59, 59, 999);
1686
+ const { resources: t, options: s } = this.state, n = e[0], r = new Date(e[6]);
1687
+ r.setHours(23, 59, 59, 999);
1674
1688
  const a = h.getTimeSlots(
1675
1689
  e[0],
1676
1690
  s.slotDuration,
@@ -1681,7 +1695,7 @@ class I extends K {
1681
1695
  resourceId: d.id,
1682
1696
  title: d.title
1683
1697
  })),
1684
- ...this.rowElements.has(z) ? [
1698
+ ...this.rowElements.has($) ? [
1685
1699
  {
1686
1700
  resourceId: null,
1687
1701
  title: w(s.messages).unassignedResource
@@ -1689,13 +1703,13 @@ class I extends K {
1689
1703
  ] : []
1690
1704
  ];
1691
1705
  for (const { resourceId: d, title: c } of l) {
1692
- const u = this.rowElements.get(d ?? z);
1693
- if (!u) continue;
1694
- const m = u.querySelector(".scheduler-timeline-events");
1706
+ const p = this.rowElements.get(d ?? $);
1707
+ if (!p) continue;
1708
+ const m = p.querySelector(".scheduler-timeline-events");
1695
1709
  if (!m) continue;
1696
1710
  m.innerHTML = "";
1697
1711
  const f = (this.state.eventsByResource.get(d) ?? []).filter(
1698
- (x) => x.start < i && x.end > n
1712
+ (x) => x.start < r && x.end > n
1699
1713
  ).map((x) => ({
1700
1714
  id: x.id,
1701
1715
  event: x,
@@ -1705,8 +1719,8 @@ class I extends K {
1705
1719
  isEnd: !0,
1706
1720
  dayIndex: 0,
1707
1721
  totalDays: 1
1708
- })), v = C.getTimelinedParts(f), y = v.reduce((x, F) => Math.max(x, F.totalTracks), 1), { height: b, gap: M, padding: A } = this.trackMetrics;
1709
- u.style.minHeight = `${y * b + (y - 1) * M + 2 * A}px`;
1722
+ })), v = C.getTimelinedParts(f), y = v.reduce((x, F) => Math.max(x, F.totalTracks), 1), { height: b, gap: M, padding: I } = this.trackMetrics;
1723
+ p.style.minHeight = `${y * b + (y - 1) * M + 2 * I}px`;
1710
1724
  for (const { part: x, trackIndex: F } of v) {
1711
1725
  if (!x.event) continue;
1712
1726
  const L = this.createEventElement(
@@ -1721,16 +1735,16 @@ class I extends K {
1721
1735
  }
1722
1736
  }
1723
1737
  }
1724
- createEventElement(e, t, s, n, i, r = null) {
1738
+ createEventElement(e, t, s, n, r, i = null) {
1725
1739
  const o = this.createElement("div", "scheduler-timeline-event"), a = this.state.selectedEvent?.id === e.id;
1726
1740
  this.state.keyboardMoveEventId, e.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
1727
1741
  "aria-label",
1728
- W(e, r, this.state.options)
1742
+ N(e, i, this.state.options)
1729
1743
  ), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
1730
- const l = Math.max(e.start.getTime(), s.getTime()), d = s.getTime() + 10080 * 60 * 1e3, c = Math.min(e.end.getTime(), d), u = l - s.getTime(), m = c - l, g = d - s.getTime(), f = u / g * n, v = Math.max(m / g * n, 20), { height: y, gap: b, padding: M } = this.trackMetrics;
1744
+ const l = Math.max(e.start.getTime(), s.getTime()), d = s.getTime() + 10080 * 60 * 1e3, c = Math.min(e.end.getTime(), d), p = l - s.getTime(), m = c - l, g = d - s.getTime(), f = p / g * n, v = Math.max(m / g * n, 20), { height: y, gap: b, padding: M } = this.trackMetrics;
1731
1745
  o.style.left = `${f}px`, o.style.width = `${v}px`, o.style.top = `${M + t * (y + b)}px`, o.style.height = `${y}px`, this.applyEventColors(o, e), this.setData(o, { eventId: e.id });
1732
- const A = this.createElement("div", "event-content"), x = this.createElement("div", "event-title");
1733
- return x.textContent = e.title, A.appendChild(x), o.appendChild(A), this.appendResizeHandles(
1746
+ const I = this.createElement("div", "event-content"), x = this.createElement("div", "event-title");
1747
+ return x.textContent = e.title, I.appendChild(x), o.appendChild(I), this.appendResizeHandles(
1734
1748
  o,
1735
1749
  {
1736
1750
  id: e.id,
@@ -1758,23 +1772,23 @@ class I extends K {
1758
1772
  this.container.querySelector(".scheduler-timeline-event.preview")?.remove();
1759
1773
  const { dragState: t, previewEvent: s, options: n } = this.state;
1760
1774
  if (!s) return;
1761
- const i = t?.event?.id ?? this.state.keyboardMoveEventId, r = this.previewRowKey();
1762
- if (!r) return;
1763
- const a = this.rowElements.get(r)?.querySelector(".scheduler-timeline-events");
1775
+ const r = t?.event?.id ?? this.state.keyboardMoveEventId, i = this.previewRowKey();
1776
+ if (!i) return;
1777
+ const a = this.rowElements.get(i)?.querySelector(".scheduler-timeline-events");
1764
1778
  if (!a) return;
1765
1779
  const d = h.getTimeSlots(
1766
1780
  e[0],
1767
1781
  n.slotDuration,
1768
1782
  n.slotMinTime,
1769
1783
  n.slotMaxTime
1770
- ).length * 7 * this.slotWidth, c = e[0], u = c.getTime() + 10080 * 60 * 1e3, m = Math.max(s.start.getTime(), c.getTime()), g = Math.min(s.end.getTime(), u), f = u - c.getTime(), v = this.createElement("div", "scheduler-timeline-event", "preview");
1784
+ ).length * 7 * this.slotWidth, c = e[0], p = c.getTime() + 10080 * 60 * 1e3, m = Math.max(s.start.getTime(), c.getTime()), g = Math.min(s.end.getTime(), p), f = p - c.getTime(), v = this.createElement("div", "scheduler-timeline-event", "preview");
1771
1785
  v.style.left = `${(m - c.getTime()) / f * d}px`, v.style.width = `${Math.max((g - m) / f * d, 20)}px`;
1772
- const y = i ? (
1786
+ const y = r ? (
1773
1787
  // dataset match rather than an attribute selector: event ids are
1774
1788
  // consumer-supplied and would need CSS escaping.
1775
1789
  Array.from(
1776
1790
  a.querySelectorAll(".scheduler-timeline-event:not(.preview)")
1777
- ).find((b) => b.dataset.eventId === i)
1791
+ ).find((b) => b.dataset.eventId === r)
1778
1792
  ) : void 0;
1779
1793
  if (y)
1780
1794
  v.style.top = y.style.top, v.style.height = y.style.height;
@@ -1803,9 +1817,9 @@ class I extends K {
1803
1817
  const { dragState: e, previewEvent: t } = this.state;
1804
1818
  if (!t) return;
1805
1819
  if (t.resourceId !== void 0)
1806
- return t.resourceId ?? z;
1807
- const s = e?.event?.id ?? this.state.keyboardMoveEventId, n = s ? this.state.events.find((i) => i.id === s) : void 0;
1808
- return n ? n.resourceId ?? z : this.state.selectionResourceId ?? this.state.focusedResourceId ?? void 0;
1820
+ return t.resourceId ?? $;
1821
+ const s = e?.event?.id ?? this.state.keyboardMoveEventId, n = s ? this.state.events.find((r) => r.id === s) : void 0;
1822
+ return n ? n.resourceId ?? $ : this.state.selectionResourceId ?? this.state.focusedResourceId ?? void 0;
1809
1823
  }
1810
1824
  update(e) {
1811
1825
  const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options), n = this.state.resources !== e.resources || this.state.collapsedGroups !== e.collapsedGroups || this.state.resolvedPermissions !== e.resolvedPermissions || this.hasUnassignedRow(this.state) !== this.hasUnassignedRow(e);
@@ -1814,26 +1828,26 @@ class I extends K {
1814
1828
  return;
1815
1829
  }
1816
1830
  this.updateGreyedSlots();
1817
- const i = h.getWeekDays(e.date, this.firstDayOfWeek);
1818
- this.renderEvents(i), this.renderPreviewEvent(i), this.updateCellFocusAndSelection();
1831
+ const r = h.getWeekDays(e.date, this.firstDayOfWeek);
1832
+ this.renderEvents(r), this.renderPreviewEvent(r), this.updateCellFocusAndSelection();
1819
1833
  }
1820
1834
  optionsRequireRerender(e, t) {
1821
1835
  return e.slotDuration !== t.slotDuration || e.timeFormat !== t.timeFormat || e.firstDayOfWeek !== t.firstDayOfWeek || e.slotMinTime !== t.slotMinTime || e.slotMaxTime !== t.slotMaxTime || e.locale !== t.locale;
1822
1836
  }
1823
1837
  updateGreyedSlots() {
1824
1838
  const { dragState: e, previewEvent: t } = this.state;
1825
- if (this.container.querySelectorAll(".scheduler-timeline-slot").forEach((r) => r.classList.remove("greyed")), this.container.querySelectorAll(".scheduler-timeline-row.drop-target").forEach((r) => r.classList.remove("drop-target")), !e || !t) return;
1826
- const n = this.previewRowKey(), i = n ? this.rowElements.get(n) : void 0;
1827
- i && (i.classList.add("drop-target"), i.querySelectorAll(".scheduler-timeline-slot").forEach((r) => {
1828
- const o = new Date(r.dataset.start ?? ""), a = new Date(r.dataset.end ?? "");
1829
- o < t.end && a > t.start && r.classList.add("greyed");
1839
+ if (this.container.querySelectorAll(".scheduler-timeline-slot").forEach((i) => i.classList.remove("greyed")), this.container.querySelectorAll(".scheduler-timeline-row.drop-target").forEach((i) => i.classList.remove("drop-target")), !e || !t) return;
1840
+ const n = this.previewRowKey(), r = n ? this.rowElements.get(n) : void 0;
1841
+ r && (r.classList.add("drop-target"), r.querySelectorAll(".scheduler-timeline-slot").forEach((i) => {
1842
+ const o = new Date(i.dataset.start ?? ""), a = new Date(i.dataset.end ?? "");
1843
+ o < t.end && a > t.start && i.classList.add("greyed");
1830
1844
  }));
1831
1845
  }
1832
1846
  destroy() {
1833
1847
  this.onColumnDragEnd(), this.rowElements.clear(), this.clearContainer();
1834
1848
  }
1835
1849
  }
1836
- const Re = ce(`@charset "UTF-8";
1850
+ const Fe = ce(`@charset "UTF-8";
1837
1851
  /* Layering ladder. Nothing between :host and the events establishes a
1838
1852
  stacking context, so every one of these competes in ONE shared context
1839
1853
  across the whole shadow root — a selected event in one day column is
@@ -1855,8 +1869,8 @@ const Re = ce(`@charset "UTF-8";
1855
1869
  --scheduler-time-gutter-width: 80px;
1856
1870
  --scheduler-event-border-radius: 4px;
1857
1871
  --scheduler-now-indicator-color: var(--bs-danger, #dc3545);
1858
- --scheduler-preview-bg: rgba(0, 123, 255, 0.3);
1859
- --scheduler-greyed-slot-bg: rgba(0, 0, 0, 0.1);
1872
+ --scheduler-preview-bg: rgba(var(--bs-primary-rgb), 0.3);
1873
+ --scheduler-greyed-slot-bg: rgba(var(--bs-emphasis-color-rgb), 0.1);
1860
1874
  --scheduler-column-min-width: 120px;
1861
1875
  --scheduler-touch-hold-duration: 500ms;
1862
1876
  /* Timeline slot width. Was hard-coded at 50px in TS, which made a default week
@@ -3383,23 +3397,30 @@ const Re = ce(`@charset "UTF-8";
3383
3397
  touch-action: none !important;
3384
3398
  }
3385
3399
 
3386
- /* Scrollbar styling */
3400
+ /* Scrollbar styling. Theme tokens, so the bar follows dark mode: the thumb uses
3401
+ --bs-secondary-color (--bs-secondary-bg is nearly invisible on --bs-tertiary-bg
3402
+ in dark). scrollbar-color is the standard path; the webkit rules cover engines
3403
+ that ignore it. */
3404
+ .scheduler-content {
3405
+ scrollbar-color: var(--bs-secondary-color) var(--bs-tertiary-bg);
3406
+ }
3407
+
3387
3408
  .scheduler-content::-webkit-scrollbar {
3388
3409
  width: 8px;
3389
3410
  height: 8px;
3390
3411
  }
3391
3412
 
3392
3413
  .scheduler-content::-webkit-scrollbar-track {
3393
- background: #f1f1f1;
3414
+ background: var(--bs-tertiary-bg);
3394
3415
  }
3395
3416
 
3396
3417
  .scheduler-content::-webkit-scrollbar-thumb {
3397
- background: #c1c1c1;
3418
+ background: var(--bs-secondary-color);
3398
3419
  border-radius: 4px;
3399
3420
  }
3400
3421
 
3401
3422
  .scheduler-content::-webkit-scrollbar-thumb:hover {
3402
- background: #a1a1a1;
3423
+ background: var(--bs-emphasis-color);
3403
3424
  }
3404
3425
 
3405
3426
  @media (prefers-reduced-motion: reduce) {
@@ -3414,7 +3435,7 @@ const Re = ce(`@charset "UTF-8";
3414
3435
  minDurationMs: 1800 * 1e3
3415
3436
  // 30 minutes
3416
3437
  };
3417
- class Pe {
3438
+ class Le {
3418
3439
  constructor(e = {}) {
3419
3440
  this.config = { ...J, ...e };
3420
3441
  }
@@ -3462,9 +3483,9 @@ class Pe {
3462
3483
  * Preserves event duration, applies offset from drag start.
3463
3484
  */
3464
3485
  calculateMovePreview(e, t, s) {
3465
- const n = t.start.getTime() - e.start.getTime(), i = s.end.getTime() - s.start.getTime(), r = new Date(s.start.getTime() + n), o = new Date(r.getTime() + i), a = t.resourceId !== void 0 ? t.resourceId : s.resourceId;
3486
+ const n = t.start.getTime() - e.start.getTime(), r = s.end.getTime() - s.start.getTime(), i = new Date(s.start.getTime() + n), o = new Date(i.getTime() + r), a = t.resourceId !== void 0 ? t.resourceId : s.resourceId;
3466
3487
  return {
3467
- start: r,
3488
+ start: i,
3468
3489
  end: o,
3469
3490
  ...a !== void 0 ? { resourceId: a } : {}
3470
3491
  };
@@ -3492,36 +3513,36 @@ class Pe {
3492
3513
  return { start: t.start, end: n };
3493
3514
  }
3494
3515
  }
3495
- function B(p) {
3516
+ function B(u) {
3496
3517
  return {
3497
3518
  pointerId: 0,
3498
3519
  pointerType: "mouse",
3499
- clientX: p.clientX,
3500
- clientY: p.clientY,
3501
- originalEvent: p,
3502
- target: p.target,
3520
+ clientX: u.clientX,
3521
+ clientY: u.clientY,
3522
+ originalEvent: u,
3523
+ target: u.target,
3503
3524
  isPrimary: !0
3504
3525
  };
3505
3526
  }
3506
- function Y(p) {
3507
- const e = p.touches[0] || p.changedTouches[0];
3527
+ function Y(u) {
3528
+ const e = u.touches[0] || u.changedTouches[0];
3508
3529
  return e ? {
3509
3530
  pointerId: e.identifier,
3510
3531
  pointerType: "touch",
3511
3532
  clientX: e.clientX,
3512
3533
  clientY: e.clientY,
3513
- originalEvent: p,
3534
+ originalEvent: u,
3514
3535
  target: e.target,
3515
3536
  isPrimary: e.identifier === 0
3516
3537
  } : null;
3517
3538
  }
3518
- function de(p, e) {
3519
- const t = e.x - p.x, s = e.y - p.y;
3539
+ function de(u, e) {
3540
+ const t = e.x - u.x, s = e.y - u.y;
3520
3541
  return Math.sqrt(t * t + s * s);
3521
3542
  }
3522
- class Fe {
3543
+ class $e {
3523
3544
  constructor(e = {}) {
3524
- this.state = { phase: "idle" }, this.config = { ...J, ...e }, this.previewCalculator = new Pe(this.config);
3545
+ this.state = { phase: "idle" }, this.config = { ...J, ...e }, this.previewCalculator = new Le(this.config);
3525
3546
  }
3526
3547
  /**
3527
3548
  * Get current state (read-only).
@@ -3595,17 +3616,16 @@ class Fe {
3595
3616
  * Given current state and event, returns new state.
3596
3617
  */
3597
3618
  transition(e) {
3598
- switch (this.state.phase) {
3619
+ const t = this.state;
3620
+ switch (t.phase) {
3599
3621
  case "idle":
3600
3622
  return this.transitionFromIdle(e);
3601
3623
  case "pending":
3602
- return this.transitionFromPending(e);
3624
+ return this.transitionFromPending(t, e);
3603
3625
  case "active":
3604
- return this.transitionFromActive(e);
3626
+ return this.transitionFromActive(t, e);
3605
3627
  case "completing":
3606
3628
  return this.transitionFromCompleting(e);
3607
- default:
3608
- return this.state;
3609
3629
  }
3610
3630
  }
3611
3631
  /**
@@ -3614,13 +3634,13 @@ class Fe {
3614
3634
  transitionFromIdle(e) {
3615
3635
  if (e.type !== "POINTER_DOWN")
3616
3636
  return this.state;
3617
- const { target: t, position: s, slot: n, slotElement: i, immediate: r } = e, o = this.getOperationType(t);
3637
+ const { target: t, position: s, slot: n, slotElement: r, immediate: i } = e, o = this.getOperationType(t);
3618
3638
  if (!o)
3619
3639
  return this.state;
3620
3640
  const a = t.event ?? null;
3621
3641
  if (a && a.draggable === !1)
3622
3642
  return this.state;
3623
- if (r) {
3643
+ if (i) {
3624
3644
  let l = n;
3625
3645
  if (!l && a && (l = {
3626
3646
  start: a.start,
@@ -3650,73 +3670,68 @@ class Fe {
3650
3670
  event: a,
3651
3671
  startPosition: s,
3652
3672
  startSlot: n,
3653
- slotElement: i
3673
+ slotElement: r
3654
3674
  };
3655
3675
  }
3656
3676
  /**
3657
3677
  * Transitions from pending state.
3658
3678
  */
3659
- transitionFromPending(e) {
3660
- if (this.state.phase !== "pending") return this.state;
3661
- switch (e.type) {
3679
+ transitionFromPending(e, t) {
3680
+ switch (t.type) {
3662
3681
  case "POINTER_MOVE":
3663
- return de(
3664
- this.state.startPosition,
3665
- e.position
3666
- ) < this.config.dragThreshold ? this.state : this.activateDrag(e.slot);
3682
+ return de(e.startPosition, t.position) < this.config.dragThreshold ? e : this.activateDrag(e, t.slot);
3667
3683
  case "POINTER_UP":
3668
3684
  return {
3669
3685
  phase: "completing",
3670
3686
  result: {
3671
- type: this.state.operationType,
3672
- preview: this.getInitialPreview(),
3673
- event: this.state.event,
3674
- originalEvent: this.state.event ?? void 0,
3687
+ type: e.operationType,
3688
+ preview: this.getInitialPreview(e),
3689
+ event: e.event,
3690
+ originalEvent: e.event ?? void 0,
3675
3691
  wasClick: !0
3676
3692
  }
3677
3693
  };
3678
3694
  case "CANCEL":
3679
3695
  return { phase: "idle" };
3680
3696
  default:
3681
- return this.state;
3697
+ return e;
3682
3698
  }
3683
3699
  }
3684
3700
  /**
3685
3701
  * Transitions from active state.
3686
3702
  */
3687
- transitionFromActive(e) {
3688
- if (this.state.phase !== "active") return this.state;
3689
- switch (e.type) {
3703
+ transitionFromActive(e, t) {
3704
+ switch (t.type) {
3690
3705
  case "POINTER_MOVE": {
3691
- if (!e.slot)
3692
- return this.state;
3693
- const t = this.previewCalculator.calculatePreview(
3694
- this.state.operationType,
3695
- this.state.startSlot,
3696
- e.slot,
3697
- this.state.originalEvent ?? null
3706
+ if (!t.slot)
3707
+ return e;
3708
+ const s = this.previewCalculator.calculatePreview(
3709
+ e.operationType,
3710
+ e.startSlot,
3711
+ t.slot,
3712
+ e.originalEvent ?? null
3698
3713
  );
3699
- return t ? {
3700
- ...this.state,
3701
- currentSlot: e.slot,
3702
- preview: t
3703
- } : this.state;
3714
+ return s ? {
3715
+ ...e,
3716
+ currentSlot: t.slot,
3717
+ preview: s
3718
+ } : e;
3704
3719
  }
3705
3720
  case "POINTER_UP":
3706
3721
  return {
3707
3722
  phase: "completing",
3708
3723
  result: {
3709
- type: this.state.operationType,
3710
- preview: this.state.preview,
3711
- event: this.state.event,
3712
- originalEvent: this.state.originalEvent,
3724
+ type: e.operationType,
3725
+ preview: e.preview,
3726
+ event: e.event,
3727
+ originalEvent: e.originalEvent,
3713
3728
  wasClick: !1
3714
3729
  }
3715
3730
  };
3716
3731
  case "CANCEL":
3717
3732
  return { phase: "idle" };
3718
3733
  default:
3719
- return this.state;
3734
+ return e;
3720
3735
  }
3721
3736
  }
3722
3737
  /**
@@ -3728,26 +3743,24 @@ class Fe {
3728
3743
  /**
3729
3744
  * Activate drag from pending state.
3730
3745
  */
3731
- activateDrag(e) {
3732
- if (this.state.phase !== "pending")
3733
- return this.state;
3734
- const t = this.state.startSlot ?? e;
3735
- if (!t)
3746
+ activateDrag(e, t) {
3747
+ const s = e.startSlot ?? t;
3748
+ if (!s)
3736
3749
  return { phase: "idle" };
3737
- const s = e ?? t, n = this.previewCalculator.calculatePreview(
3738
- this.state.operationType,
3739
- t,
3750
+ const n = t ?? s, r = this.previewCalculator.calculatePreview(
3751
+ e.operationType,
3740
3752
  s,
3741
- this.state.event
3753
+ n,
3754
+ e.event
3742
3755
  );
3743
- return n ? {
3756
+ return r ? {
3744
3757
  phase: "active",
3745
- operationType: this.state.operationType,
3746
- event: this.state.event,
3747
- startSlot: t,
3748
- currentSlot: s,
3749
- preview: n,
3750
- originalEvent: this.state.event ?? void 0
3758
+ operationType: e.operationType,
3759
+ event: e.event,
3760
+ startSlot: s,
3761
+ currentSlot: n,
3762
+ preview: r,
3763
+ originalEvent: e.event ?? void 0
3751
3764
  } : { phase: "idle" };
3752
3765
  }
3753
3766
  /**
@@ -3768,19 +3781,19 @@ class Fe {
3768
3781
  /**
3769
3782
  * Get initial preview for a pending drag (used for click detection).
3770
3783
  */
3771
- getInitialPreview() {
3772
- return this.state.phase !== "pending" ? { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date() } : this.state.event ? {
3773
- start: this.state.event.start,
3774
- end: this.state.event.end
3775
- } : this.state.startSlot ? {
3776
- start: this.state.startSlot.start,
3777
- end: this.state.startSlot.end
3784
+ getInitialPreview(e) {
3785
+ return e.event ? {
3786
+ start: e.event.start,
3787
+ end: e.event.end
3788
+ } : e.startSlot ? {
3789
+ start: e.startSlot.start,
3790
+ end: e.startSlot.end
3778
3791
  } : { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date() };
3779
3792
  }
3780
3793
  }
3781
- class Le {
3794
+ class ze {
3782
3795
  constructor(e, t = {}) {
3783
- this.pendingUpdate = null, this.latestPointer = null, this.getSlotAtPosition = null, this.stateManager = e, this.config = { ...J, ...t }, this.stateMachine = new Fe(this.config);
3796
+ this.pendingUpdate = null, this.latestPointer = null, this.getSlotAtPosition = null, this.stateManager = e, this.config = { ...J, ...t }, this.stateMachine = new $e(this.config);
3784
3797
  }
3785
3798
  /**
3786
3799
  * Set the function used to get a slot at a position.
@@ -3866,28 +3879,6 @@ class Le {
3866
3879
  destroy() {
3867
3880
  this.cancelPendingUpdate(), this.latestPointer = null, this.getSlotAtPosition = null;
3868
3881
  }
3869
- /**
3870
- * Create a new event from a completed create drag.
3871
- */
3872
- createEventFromResult(e) {
3873
- return {
3874
- id: fe(),
3875
- title: "New Event",
3876
- start: e.preview.start,
3877
- end: e.preview.end,
3878
- color: "#3788d8"
3879
- };
3880
- }
3881
- /**
3882
- * Update an event from a completed move/resize drag.
3883
- */
3884
- updateEventFromResult(e, t) {
3885
- return {
3886
- ...t,
3887
- start: e.preview.start,
3888
- end: e.preview.end
3889
- };
3890
- }
3891
3882
  /**
3892
3883
  * Process pending pointer move using RAF.
3893
3884
  */
@@ -3924,10 +3915,10 @@ class Le {
3924
3915
  this.pendingUpdate !== null && (cancelAnimationFrame(this.pendingUpdate), this.pendingUpdate = null), this.latestPointer = null;
3925
3916
  }
3926
3917
  }
3927
- const ze = 600, $e = 10;
3928
- class He {
3918
+ const He = 600, Oe = 10;
3919
+ class We {
3929
3920
  constructor(e, t) {
3930
- this.lastPointerType = "mouse", this.touchHoldTimer = null, this.touchStartPosition = null, this.isTouchDragMode = !1, this.touchHoldTarget = null, this.touchHoldPointer = null, this.isPanMode = !1, this.panStartPosition = null, this.panStartScroll = null, this.panStartedOnEvent = !1, this.savedBodyStyles = null, this.config = e, this.callbacks = t, this.boundHandleMouseDown = this.handleMouseDown.bind(this), this.boundHandleMouseMove = this.handleMouseMove.bind(this), this.boundHandleMouseUp = this.handleMouseUp.bind(this), this.boundHandleClick = this.handleClick.bind(this), this.boundHandleDblClick = this.handleDblClick.bind(this), this.boundHandleTouchStart = this.handleTouchStart.bind(this), this.boundHandleTouchMove = this.handleTouchMove.bind(this), this.boundHandleTouchEnd = this.handleTouchEnd.bind(this), this.boundHandleTouchCancel = this.handleTouchCancel.bind(this);
3921
+ this.lastPointerType = "mouse", this.touchHoldTimer = null, this.touchStartPosition = null, this.isTouchDragMode = !1, this.touchHoldTarget = null, this.gestureElement = null, this.isPanMode = !1, this.panStartPosition = null, this.panStartScroll = null, this.panStartedOnEvent = !1, this.savedBodyStyles = null, this.config = e, this.callbacks = t, this.boundHandleMouseDown = this.handleMouseDown.bind(this), this.boundHandleMouseMove = this.handleMouseMove.bind(this), this.boundHandleMouseUp = this.handleMouseUp.bind(this), this.boundHandleClick = this.handleClick.bind(this), this.boundHandleDblClick = this.handleDblClick.bind(this), this.boundHandleTouchStart = this.handleTouchStart.bind(this), this.boundHandleTouchMove = this.handleTouchMove.bind(this), this.boundHandleTouchEnd = this.handleTouchEnd.bind(this), this.boundHandleTouchCancel = this.handleTouchCancel.bind(this);
3931
3922
  }
3932
3923
  /**
3933
3924
  * True when the gesture in progress came from a finger.
@@ -3955,7 +3946,7 @@ class He {
3955
3946
  */
3956
3947
  detach() {
3957
3948
  const e = this.config.shadowRoot;
3958
- e.removeEventListener("mousedown", this.boundHandleMouseDown), document.removeEventListener("mousemove", this.boundHandleMouseMove), document.removeEventListener("mouseup", this.boundHandleMouseUp), e.removeEventListener("click", this.boundHandleClick), e.removeEventListener("dblclick", this.boundHandleDblClick), e.removeEventListener("touchstart", this.boundHandleTouchStart), e.removeEventListener("touchmove", this.boundHandleTouchMove), e.removeEventListener("touchend", this.boundHandleTouchEnd), e.removeEventListener("touchcancel", this.boundHandleTouchCancel), this.cancelTouchHold(), this.exitPanMode(), this.removeScrollBlock();
3949
+ e.removeEventListener("mousedown", this.boundHandleMouseDown), document.removeEventListener("mousemove", this.boundHandleMouseMove), document.removeEventListener("mouseup", this.boundHandleMouseUp), e.removeEventListener("click", this.boundHandleClick), e.removeEventListener("dblclick", this.boundHandleDblClick), e.removeEventListener("touchstart", this.boundHandleTouchStart), e.removeEventListener("touchmove", this.boundHandleTouchMove), e.removeEventListener("touchend", this.boundHandleTouchEnd), e.removeEventListener("touchcancel", this.boundHandleTouchCancel), this.unbindGestureElement(), this.cancelTouchHold(), this.exitPanMode(), this.removeScrollBlock();
3959
3950
  }
3960
3951
  /**
3961
3952
  * Check if in touch drag mode.
@@ -3969,9 +3960,9 @@ class He {
3969
3960
  analyzeTarget(e) {
3970
3961
  const t = e.closest(".resize-handle");
3971
3962
  if (t) {
3972
- const r = t.closest(
3963
+ const i = t.closest(
3973
3964
  ".scheduler-event, .scheduler-timeline-event"
3974
- )?.dataset.eventId, o = r ? this.config.getEventById(r) : null;
3965
+ )?.dataset.eventId, o = i ? this.config.getEventById(i) : null;
3975
3966
  if (o)
3976
3967
  return {
3977
3968
  type: "resize-handle",
@@ -3983,9 +3974,9 @@ class He {
3983
3974
  ".scheduler-event:not(.preview), .scheduler-timeline-event:not(.preview)"
3984
3975
  );
3985
3976
  if (s) {
3986
- const i = s.dataset.eventId, r = i ? this.config.getEventById(i) : null;
3987
- if (r)
3988
- return { type: "event", event: r };
3977
+ const r = s.dataset.eventId, i = r ? this.config.getEventById(r) : null;
3978
+ if (i)
3979
+ return { type: "event", event: i };
3989
3980
  }
3990
3981
  const n = e.closest(
3991
3982
  ".scheduler-time-slot, .scheduler-timeline-slot"
@@ -4025,23 +4016,15 @@ class He {
4025
4016
  if (!t) return;
4026
4017
  const s = this.analyzeTarget(t.target);
4027
4018
  if (s.type === "none" || s.type === "slot" && !this.config.isSelectable()) return;
4028
- this.touchStartPosition = { x: t.clientX, y: t.clientY }, this.touchHoldTarget = t.target, this.touchHoldPointer = t, this.panStartedOnEvent = s.type === "event" || s.type === "resize-handle";
4029
- const n = this, i = e.target;
4030
- if (i.addEventListener("touchmove", function(o) {
4031
- n.handleTouchMove(o);
4032
- }, { passive: !1 }), i.addEventListener("touchend", function(o) {
4033
- n.handleTouchEnd(o);
4034
- }), i.addEventListener("touchcancel", function(o) {
4035
- n.handleTouchCancel(o);
4036
- }), s.type === "resize-handle" && s.event && this.config.isEventSelected?.(s.event.id)) {
4019
+ if (this.touchStartPosition = { x: t.clientX, y: t.clientY }, this.touchHoldTarget = t.target, this.panStartedOnEvent = s.type === "event" || s.type === "resize-handle", this.bindGestureElement(e.target), s.type === "resize-handle" && s.event && this.config.isEventSelected?.(s.event.id)) {
4037
4020
  this.activateTouchDragMode(t, s);
4038
4021
  return;
4039
4022
  }
4040
4023
  this.addTouchFeedback(t.target, "pending");
4041
- const r = this.config.touchHoldDuration ?? ze;
4024
+ const n = this.config.touchHoldDuration ?? He;
4042
4025
  this.touchHoldTimer = setTimeout(() => {
4043
4026
  this.activateTouchDragMode(t, s);
4044
- }, r);
4027
+ }, n);
4045
4028
  }
4046
4029
  handleTouchMove(e) {
4047
4030
  if (e.touches.length !== 1) {
@@ -4055,7 +4038,7 @@ class He {
4055
4038
  return;
4056
4039
  }
4057
4040
  if (this.touchHoldTimer && this.touchStartPosition) {
4058
- const s = this.config.touchMoveThreshold ?? $e;
4041
+ const s = this.config.touchMoveThreshold ?? Oe;
4059
4042
  if (de(this.touchStartPosition, {
4060
4043
  x: t.clientX,
4061
4044
  y: t.clientY
@@ -4071,7 +4054,7 @@ class He {
4071
4054
  }
4072
4055
  handleTouchEnd(e) {
4073
4056
  const t = Y(e);
4074
- if (this.isPanMode) {
4057
+ if (this.unbindGestureElement(), this.isPanMode) {
4075
4058
  this.exitPanMode();
4076
4059
  return;
4077
4060
  }
@@ -4080,25 +4063,30 @@ class He {
4080
4063
  const s = this.analyzeTarget(this.touchHoldTarget);
4081
4064
  this.callbacks.onClick(t, s);
4082
4065
  }
4083
- this.touchHoldTarget = null, this.touchHoldPointer = null;
4066
+ this.touchHoldTarget = null;
4084
4067
  return;
4085
4068
  }
4086
4069
  this.isTouchDragMode && t && (this.callbacks.onPointerUp(t), this.exitTouchDragMode());
4087
4070
  }
4088
4071
  handleTouchCancel(e) {
4089
- this.cancelTouchHold(), this.exitPanMode(), this.isTouchDragMode && (this.touchStartPosition && this.callbacks.onPointerUp({
4090
- pointerId: 0,
4091
- pointerType: "touch",
4092
- clientX: this.touchStartPosition.x,
4093
- clientY: this.touchStartPosition.y,
4094
- originalEvent: e,
4095
- target: this.touchHoldTarget ?? document.body,
4096
- isPrimary: !0
4097
- }), this.exitTouchDragMode());
4072
+ this.unbindGestureElement(), this.cancelTouchHold(), this.exitPanMode(), this.isTouchDragMode && (this.callbacks.onPointerCancel?.(), this.exitTouchDragMode());
4073
+ }
4074
+ /**
4075
+ * Listen for the rest of the gesture on the element the touch started on.
4076
+ * At most one element is bound at a time, and it is released when the
4077
+ * gesture ends — before, every touchstart added three listeners that were
4078
+ * never removed.
4079
+ */
4080
+ bindGestureElement(e) {
4081
+ this.unbindGestureElement(), this.gestureElement = e, e.addEventListener("touchmove", this.boundHandleTouchMove, { passive: !1 }), e.addEventListener("touchend", this.boundHandleTouchEnd), e.addEventListener("touchcancel", this.boundHandleTouchCancel);
4082
+ }
4083
+ unbindGestureElement() {
4084
+ const e = this.gestureElement;
4085
+ e && (this.gestureElement = null, e.removeEventListener("touchmove", this.boundHandleTouchMove), e.removeEventListener("touchend", this.boundHandleTouchEnd), e.removeEventListener("touchcancel", this.boundHandleTouchCancel));
4098
4086
  }
4099
4087
  // Touch helpers
4100
4088
  activateTouchDragMode(e, t) {
4101
- if (this.touchHoldTimer = null, this.touchStartPosition = null, this.triggerHapticFeedback(), this.isTouchDragMode = !0, this.touchHoldTarget?.closest(".scheduler-event") || (document.addEventListener("touchmove", this.boundHandleTouchMove, { passive: !1 }), document.addEventListener("touchend", this.boundHandleTouchEnd), document.addEventListener("touchcancel", this.boundHandleTouchCancel)), this.touchHoldTarget && (this.removeTouchFeedback(this.touchHoldTarget, "pending"), this.addTouchFeedback(this.touchHoldTarget, "active")), this.config.shadowRoot.querySelector(".scheduler-container")?.classList.add("touch-drag-mode"), this.applyScrollBlock(), typeof navigator < "u" && typeof navigator.vibrate == "function")
4089
+ if (this.touchHoldTimer = null, this.touchStartPosition = null, this.isTouchDragMode = !0, this.touchHoldTarget?.closest(".scheduler-event") || (document.addEventListener("touchmove", this.boundHandleTouchMove, { passive: !1 }), document.addEventListener("touchend", this.boundHandleTouchEnd), document.addEventListener("touchcancel", this.boundHandleTouchCancel)), this.touchHoldTarget && (this.removeTouchFeedback(this.touchHoldTarget, "pending"), this.addTouchFeedback(this.touchHoldTarget, "active")), this.config.shadowRoot.querySelector(".scheduler-container")?.classList.add("touch-drag-mode"), this.applyScrollBlock(), typeof navigator < "u" && typeof navigator.vibrate == "function")
4102
4090
  try {
4103
4091
  navigator.vibrate(10);
4104
4092
  } catch {
@@ -4109,7 +4097,7 @@ class He {
4109
4097
  this.touchHoldTimer && (clearTimeout(this.touchHoldTimer), this.touchHoldTimer = null), document.removeEventListener("touchmove", this.boundHandleTouchMove), document.removeEventListener("touchend", this.boundHandleTouchEnd), document.removeEventListener("touchcancel", this.boundHandleTouchCancel), this.touchHoldTarget && (this.removeTouchFeedback(this.touchHoldTarget, "pending"), this.removeTouchFeedback(this.touchHoldTarget, "active"));
4110
4098
  }
4111
4099
  exitTouchDragMode() {
4112
- this.isTouchDragMode = !1, this.touchStartPosition = null, this.touchHoldTarget = null, this.touchHoldPointer = null, document.removeEventListener("touchmove", this.boundHandleTouchMove), document.removeEventListener("touchend", this.boundHandleTouchEnd), document.removeEventListener("touchcancel", this.boundHandleTouchCancel), this.config.shadowRoot.querySelector(".scheduler-container")?.classList.remove("touch-drag-mode"), this.removeScrollBlock(), this.config.shadowRoot.querySelectorAll(".touch-hold-active, .touch-hold-pending").forEach((t) => {
4100
+ this.isTouchDragMode = !1, this.touchStartPosition = null, this.touchHoldTarget = null, document.removeEventListener("touchmove", this.boundHandleTouchMove), document.removeEventListener("touchend", this.boundHandleTouchEnd), document.removeEventListener("touchcancel", this.boundHandleTouchCancel), this.config.shadowRoot.querySelector(".scheduler-container")?.classList.remove("touch-drag-mode"), this.removeScrollBlock(), this.config.shadowRoot.querySelectorAll(".touch-hold-active, .touch-hold-pending").forEach((t) => {
4113
4101
  t.classList.remove("touch-hold-active", "touch-hold-pending");
4114
4102
  }), this.callbacks.onTouchDragDeactivated?.();
4115
4103
  }
@@ -4123,8 +4111,6 @@ class He {
4123
4111
  ".scheduler-event, .scheduler-time-slot, .scheduler-timeline-slot"
4124
4112
  )?.classList.remove(`touch-hold-${t}`);
4125
4113
  }
4126
- triggerHapticFeedback() {
4127
- }
4128
4114
  // Pan helpers (touch-only: pan is never initiated from a mouse gesture)
4129
4115
  enterPanMode(e, t) {
4130
4116
  const s = this.callbacks.getScrollContainer?.();
@@ -4138,8 +4124,8 @@ class He {
4138
4124
  if (!this.isPanMode || !this.panStartPosition || !this.panStartScroll) return;
4139
4125
  const s = this.callbacks.getScrollContainer?.();
4140
4126
  if (!s) return;
4141
- const n = this.panStartPosition.x - e, i = this.panStartPosition.y - t;
4142
- s.scrollLeft = this.panStartScroll.left + n, s.scrollTop = this.panStartScroll.top + i;
4127
+ const n = this.panStartPosition.x - e, r = this.panStartPosition.y - t;
4128
+ s.scrollLeft = this.panStartScroll.left + n, s.scrollTop = this.panStartScroll.top + r;
4143
4129
  }
4144
4130
  // Scroll blocking helpers
4145
4131
  applyScrollBlock() {
@@ -4156,7 +4142,7 @@ class He {
4156
4142
  e && e.classList.remove("scroll-blocked");
4157
4143
  }
4158
4144
  }
4159
- class Oe {
4145
+ class Ne {
4160
4146
  constructor(e) {
4161
4147
  this.host = e;
4162
4148
  }
@@ -4256,8 +4242,8 @@ class Oe {
4256
4242
  this.emit({ type: "resource-delete", resource: e, originalEvent: t });
4257
4243
  }
4258
4244
  }
4259
- let Ne = 0;
4260
- class $ extends he {
4245
+ let Be = 0;
4246
+ class z extends he {
4261
4247
  constructor() {
4262
4248
  super(), this.currentView = null, this.currentViewType = null, this.contentContainer = null, this.inputHandler = null, this.previousView = null, this.previousDate = null, this.previousSelectedEventId = null, this.previousRangeKey = "__init__", this.pendingDragUpdate = null, this.latestDragState = null, this.nowIndicatorTimer = null, this.liveAnnouncer = new ue(this), this.popoverDate = null, this.popoverScope = "day", this.popoverAnchorId = null, this.dayPopover = new _(this, {
4263
4249
  anchor: () => this.popoverAnchorCell(),
@@ -4289,7 +4275,7 @@ class $ extends he {
4289
4275
  onClose: () => {
4290
4276
  this.rowMenuResourceId = null, this.requestUpdate(), this.syncRowMenuTriggerState();
4291
4277
  }
4292
- }), this.editorEventId = null, this.editorError = null, this.editorTitleErrorId = `mp-scheduler-${++Ne}-editor-title-error`, this.eventEditorOverlay = new _(this, {
4278
+ }), this.editorEventId = null, this.editorError = null, this.editorTitleErrorId = `mp-scheduler-${++Be}-editor-title-error`, this.eventEditorOverlay = new _(this, {
4293
4279
  anchor: () => this.eventElementById(this.editorEventId),
4294
4280
  trigger: () => this.eventElementById(this.editorEventId),
4295
4281
  panel: () => this.shadowRoot?.querySelector(".scheduler-event-editor") ?? null,
@@ -4300,10 +4286,10 @@ class $ extends he {
4300
4286
  onClose: () => {
4301
4287
  this.editorEventId = null, this.editorError = null, this.editorDraft = null, this.requestUpdate();
4302
4288
  }
4303
- }), this.editorDraft = null, this.headerResizeObserver = null, this.headerIsNarrow = !1, this.keymapView = null, this.previousIsLoading = null, this.edgeScrollFrame = null, this.edgeScrollVector = { x: 0, y: 0 }, this.edgeScrollPointer = null, this.lastEventActivation = null, this.keyboardMove = null, this.stateManager = new De(), this.eventEmitter = new Oe(this), this.dragManager = new Le(this.stateManager), this.dragManager.setSlotResolver((e, t) => this.getSlotAtPosition(e, t)), this.boundHandleKeyDown = this.handleKeyDown.bind(this), this.boundHandleFocusIn = this.handleFocusIn.bind(this), this.boundHandleValueChange = this.handleValueChange.bind(this), this.boundHandleContextMenu = this.handleContextMenu.bind(this), this.boundHandleDblClick = this.handleNativeDblClick.bind(this), this.boundRepositionPopover = () => this.dayPopover.position(), this.boundRepositionEditor = () => this.eventEditorOverlay.position(), this.stateManager.subscribe((e) => this.onStateChange(e));
4289
+ }), this.editorDraft = null, this.headerResizeObserver = null, this.headerIsNarrow = !1, this.keymapView = null, this.previousIsLoading = null, this.edgeScrollFrame = null, this.edgeScrollVector = { x: 0, y: 0 }, this.edgeScrollPointer = null, this.lastEventActivation = null, this.keyboardMove = null, this.stateManager = new xe(), this.eventEmitter = new Ne(this), this.dragManager = new ze(this.stateManager), this.dragManager.setSlotResolver((e, t) => this.getSlotAtPosition(e, t)), this.boundHandleKeyDown = this.handleKeyDown.bind(this), this.boundHandleFocusIn = this.handleFocusIn.bind(this), this.boundHandleValueChange = this.handleValueChange.bind(this), this.boundHandleContextMenu = this.handleContextMenu.bind(this), this.boundHandleDblClick = this.handleNativeDblClick.bind(this), this.boundRepositionPopover = () => this.dayPopover.position(), this.boundRepositionEditor = () => this.eventEditorOverlay.position(), this.stateManager.subscribe((e) => this.onStateChange(e));
4304
4290
  }
4305
4291
  static {
4306
- this.styles = [ye, be, Re];
4292
+ this.styles = [fe, ye, Fe];
4307
4293
  }
4308
4294
  static get observedAttributes() {
4309
4295
  return [
@@ -4319,10 +4305,15 @@ class $ extends he {
4319
4305
  ];
4320
4306
  }
4321
4307
  connectedCallback() {
4322
- super.connectedCallback(), this.inputHandler && this.inputHandler.attach(), this.syncPermissions(), this.addEventListener("keydown", this.boundHandleKeyDown), this.startNowIndicatorTimer();
4308
+ if (super.connectedCallback(), this.inputHandler) {
4309
+ this.inputHandler.attach(), this.dragManager.setSlotResolver((t, s) => this.getSlotAtPosition(t, s));
4310
+ const e = this.shadowRoot?.querySelector(".scheduler-header");
4311
+ e && this.observeHeaderWidth(e), this.renderView();
4312
+ }
4313
+ this.syncPermissions(), this.addEventListener("keydown", this.boundHandleKeyDown), this.startNowIndicatorTimer();
4323
4314
  }
4324
4315
  disconnectedCallback() {
4325
- this.inputHandler?.detach(), this.removeEventListener("keydown", this.boundHandleKeyDown), this.shadowRoot?.removeEventListener("focusin", this.boundHandleFocusIn), this.shadowRoot?.removeEventListener("change", this.boundHandleValueChange), this.shadowRoot?.removeEventListener("contextmenu", this.boundHandleContextMenu), this.shadowRoot?.removeEventListener("dblclick", this.boundHandleDblClick), this.currentView?.destroy(), this.dragManager.destroy(), this.stopNowIndicatorTimer(), this.headerResizeObserver?.disconnect(), this.headerResizeObserver = null, this.stopEdgeScroll(), this.pendingDragUpdate !== null && (cancelAnimationFrame(this.pendingDragUpdate), this.pendingDragUpdate = null), this.latestDragState = null, super.disconnectedCallback();
4316
+ this.inputHandler?.detach(), this.removeEventListener("keydown", this.boundHandleKeyDown), this.shadowRoot?.removeEventListener("focusin", this.boundHandleFocusIn), this.shadowRoot?.removeEventListener("change", this.boundHandleValueChange), this.shadowRoot?.removeEventListener("contextmenu", this.boundHandleContextMenu), this.shadowRoot?.removeEventListener("dblclick", this.boundHandleDblClick), this.currentView?.destroy(), this.dragManager.destroy(), this.stopNowIndicatorTimer(), this.headerResizeObserver?.disconnect(), this.headerResizeObserver = null, this.stopEdgeScroll(), this.cancelPendingDragUpdate(), super.disconnectedCallback();
4326
4317
  }
4327
4318
  attributeChangedCallback(e, t, s) {
4328
4319
  if (super.attributeChangedCallback(e, t, s), t !== s)
@@ -4423,9 +4414,14 @@ class $ extends he {
4423
4414
  set selectedEvent(e) {
4424
4415
  this.stateManager.setSelectedEvent(e);
4425
4416
  }
4417
+ /**
4418
+ * The active time-range selection: the same range `selection-change`
4419
+ * reports, and the one Enter turns into an `event-create` request. Not the
4420
+ * drag or move-mode preview, which is transient and never a selection.
4421
+ */
4426
4422
  get selectedRange() {
4427
- const e = this.stateManager.getState();
4428
- return e.previewEvent ? { start: e.previewEvent.start, end: e.previewEvent.end } : null;
4423
+ const e = q(this.stateManager.getState());
4424
+ return e ? { start: e.start, end: e.end } : null;
4429
4425
  }
4430
4426
  next() {
4431
4427
  this.stateManager.next();
@@ -4631,19 +4627,19 @@ class $ extends he {
4631
4627
  const e = this.rowMenuResourceId;
4632
4628
  if (!e) return k;
4633
4629
  const t = this.findResourceOrGroup(e), s = this.currentView;
4634
- if (!t || !(s instanceof I)) return k;
4630
+ if (!t || !(s instanceof P)) return k;
4635
4631
  const n = s.rowActions(t);
4636
4632
  if (n.length === 0) return k;
4637
- const i = w(this.stateManager.getState().options.messages), r = t, o = r.eventColor ? "eventColor" : "color", a = r.eventColor ?? t.color;
4633
+ const r = w(this.stateManager.getState().options.messages), i = t, o = i.eventColor ? "eventColor" : "color", a = i.eventColor ?? t.color;
4638
4634
  return S`
4639
4635
  <div
4640
4636
  class="scheduler-row-panel"
4641
4637
  role="dialog"
4642
- aria-label=${E(i.rowMenuDialogLabel, { title: t.title })}
4638
+ aria-label=${E(r.rowMenuDialogLabel, { title: t.title })}
4643
4639
  >
4644
4640
  ${n.map((l) => {
4645
4641
  if (l === "set-resource-color") {
4646
- const c = E(i.resourceColor, { title: t.title });
4642
+ const c = E(r.resourceColor, { title: t.title });
4647
4643
  return S`
4648
4644
  <label class="row-action row-action-color">
4649
4645
  <span>${c}</span>
@@ -4659,7 +4655,7 @@ class $ extends he {
4659
4655
  </label>
4660
4656
  `;
4661
4657
  }
4662
- const d = l === "rename-resource" ? E(i.renameResource, { title: t.title }) : l === "add-resource" ? E(i.addResourceToGroup, { title: t.title }) : l === "add-group" ? E(i.addGroupToGroup, { title: t.title }) : E(i.removeResource, { title: t.title });
4658
+ const d = l === "rename-resource" ? E(r.renameResource, { title: t.title }) : l === "add-resource" ? E(r.addResourceToGroup, { title: t.title }) : l === "add-group" ? E(r.addGroupToGroup, { title: t.title }) : E(r.removeResource, { title: t.title });
4663
4659
  return S`
4664
4660
  <button
4665
4661
  type="button"
@@ -4681,20 +4677,20 @@ class $ extends he {
4681
4677
  renderDayPopover() {
4682
4678
  const e = this.popoverDate;
4683
4679
  if (!e) return k;
4684
- const t = this.stateManager.getState(), { options: s } = t, n = this.popoverScope, i = n === "month" ? this.eventsInMonth(e) : this.eventsOnDay(e), r = n === "month" ? `${h.getMonthName(e, s.locale)} ${e.getFullYear()}` : h.formatDateWithWeekday(e, s.locale), o = [...t.resourceById.values()];
4680
+ const t = this.stateManager.getState(), { options: s } = t, n = this.popoverScope, r = n === "month" ? this.eventsInMonth(e) : this.eventsOnDay(e), i = n === "month" ? `${h.getMonthName(e, s.locale)} ${e.getFullYear()}` : h.formatDateWithWeekday(e, s.locale), o = [...t.resourceById.values()];
4685
4681
  return S`
4686
4682
  <div
4687
4683
  class="scheduler-day-popover"
4688
4684
  role="dialog"
4689
- aria-label=${this.msg("dayPopoverLabel", { date: r })}
4685
+ aria-label=${this.msg("dayPopoverLabel", { date: i })}
4690
4686
  >
4691
4687
  <div class="popover-head">
4692
4688
  <div>
4693
- <div class="popover-date">${r}</div>
4689
+ <div class="popover-date">${i}</div>
4694
4690
  <div class="popover-count">
4695
4691
  ${this.msg("dayPopoverCount", {
4696
- count: i.length,
4697
- events: this.msg(i.length === 1 ? "eventSingular" : "eventPlural")
4692
+ count: r.length,
4693
+ events: this.msg(r.length === 1 ? "eventSingular" : "eventPlural")
4698
4694
  })}
4699
4695
  </div>
4700
4696
  </div>
@@ -4707,9 +4703,9 @@ class $ extends he {
4707
4703
  <span aria-hidden="true">×</span>
4708
4704
  </button>
4709
4705
  </div>
4710
- ${i.length === 0 ? S`<p class="popover-empty">${this.msg("dayPopoverEmpty")}</p>` : n === "month" ? this.renderPopoverDayGroups(i, s) : S`
4706
+ ${r.length === 0 ? S`<p class="popover-empty">${this.msg("dayPopoverEmpty")}</p>` : n === "month" ? this.renderPopoverDayGroups(r, s) : S`
4711
4707
  <ul class="popover-events">
4712
- ${i.map((a) => this.renderPopoverEvent(a, s))}
4708
+ ${r.map((a) => this.renderPopoverEvent(a, s))}
4713
4709
  </ul>
4714
4710
  `}
4715
4711
  ${this.can("createEvent") && o.length > 0 ? S`
@@ -4751,7 +4747,7 @@ class $ extends he {
4751
4747
  <button
4752
4748
  type="button"
4753
4749
  class="popover-event"
4754
- aria-label=${W(e, null, t)}
4750
+ aria-label=${N(e, null, t)}
4755
4751
  @click=${(s) => this.selectFromPopover(e, s)}
4756
4752
  >
4757
4753
  <span
@@ -4794,14 +4790,14 @@ class $ extends he {
4794
4790
  return;
4795
4791
  }
4796
4792
  const t = this.shadowRoot?.querySelector(".scheduler-day-popover"), n = (t ? [...t.querySelectorAll(".popover-event")] : []).findIndex(
4797
- (i) => i.getAttribute("aria-label") === W(e, null, this.stateManager.getState().options)
4793
+ (r) => r.getAttribute("aria-label") === N(e, null, this.stateManager.getState().options)
4798
4794
  );
4799
4795
  this.eventEmitter.emitEventDelete(e), this.updateComplete.then(
4800
4796
  () => requestAnimationFrame(() => {
4801
- const i = this.shadowRoot?.querySelector(".scheduler-day-popover");
4802
- if (!i) return;
4803
- const r = [...i.querySelectorAll(".popover-event")];
4804
- (r[Math.min(Math.max(n, 0), r.length - 1)] ?? i.querySelector(".popover-action") ?? i.querySelector(".popover-close"))?.focus();
4797
+ const r = this.shadowRoot?.querySelector(".scheduler-day-popover");
4798
+ if (!r) return;
4799
+ const i = [...r.querySelectorAll(".popover-event")];
4800
+ (i[Math.min(Math.max(n, 0), i.length - 1)] ?? r.querySelector(".popover-action") ?? r.querySelector(".popover-close"))?.focus();
4805
4801
  })
4806
4802
  );
4807
4803
  }
@@ -4811,22 +4807,22 @@ class $ extends he {
4811
4807
  * running in from last month sits under the 1st rather than vanishing).
4812
4808
  */
4813
4809
  renderPopoverDayGroups(e, t) {
4814
- const s = this.popoverDate, n = new Date(s.getFullYear(), s.getMonth(), 1), i = e.reduce((r, o) => {
4810
+ const s = this.popoverDate, n = new Date(s.getFullYear(), s.getMonth(), 1), r = e.reduce((i, o) => {
4815
4811
  const a = o.start < n ? new Date(n) : new Date(o.start);
4816
4812
  a.setHours(0, 0, 0, 0);
4817
- const l = a.getTime(), d = r.get(l) ?? { day: a, events: [] };
4818
- return d.events.push(o), r.set(l, d);
4813
+ const l = a.getTime(), d = i.get(l) ?? { day: a, events: [] };
4814
+ return d.events.push(o), i.set(l, d);
4819
4815
  }, /* @__PURE__ */ new Map());
4820
4816
  return S`
4821
4817
  <ul class="popover-events popover-day-groups">
4822
- ${[...i.values()].map(
4823
- (r) => S`
4818
+ ${[...r.values()].map(
4819
+ (i) => S`
4824
4820
  <li class="popover-day-group">
4825
4821
  <div class="popover-day-label">
4826
- ${h.formatDateWithWeekday(r.day, t.locale)}
4822
+ ${h.formatDateWithWeekday(i.day, t.locale)}
4827
4823
  </div>
4828
4824
  <ul class="popover-events">
4829
- ${r.events.map((o) => this.renderPopoverEvent(o, t))}
4825
+ ${i.events.map((o) => this.renderPopoverEvent(o, t))}
4830
4826
  </ul>
4831
4827
  </li>
4832
4828
  `
@@ -4850,14 +4846,14 @@ class $ extends he {
4850
4846
  * no date-keyed cell — the popover is a month/year surface only.
4851
4847
  */
4852
4848
  defaultPopoverAnchorId(e) {
4853
- return this.stateManager.getState().view === "year" ? `scheduler-cell-y-${U.monthKey(e)}` : `scheduler-cell-m-${N.dayKey(e)}`;
4849
+ return this.stateManager.getState().view === "year" ? `scheduler-cell-y-${K.monthKey(e)}` : `scheduler-cell-m-${W.dayKey(e)}`;
4854
4850
  }
4855
4851
  /** Every event overlapping the given local day, in start order. */
4856
4852
  eventsOnDay(e) {
4857
4853
  const t = new Date(e);
4858
4854
  t.setHours(0, 0, 0, 0);
4859
4855
  const s = new Date(t);
4860
- return s.setDate(s.getDate() + 1), this.stateManager.getState().events.filter((n) => n.start < s && n.end > t).sort((n, i) => n.start.getTime() - i.start.getTime());
4856
+ return s.setDate(s.getDate() + 1), this.stateManager.getState().events.filter((n) => n.start < s && n.end > t).sort((n, r) => n.start.getTime() - r.start.getTime());
4861
4857
  }
4862
4858
  /**
4863
4859
  * Open the date popover for `day`. Anchored on an element resolved LAZILY by
@@ -4884,15 +4880,15 @@ class $ extends he {
4884
4880
  if (!t) return;
4885
4881
  const n = this.shadowRoot?.querySelector(
4886
4882
  "mp-select.popover-resource-select"
4887
- )?.value || void 0, i = new Date(t);
4888
- i.setHours(0, 0, 0, 0);
4889
- const r = new Date(i);
4890
- if (r.setDate(r.getDate() + 1), this.closeDayPopover(), !this.can("createEvent") || !this.allowsCreateAt({ start: i, end: r }, n)) {
4883
+ )?.value || void 0, r = new Date(t);
4884
+ r.setHours(0, 0, 0, 0);
4885
+ const i = new Date(r);
4886
+ if (i.setDate(i.getDate() + 1), this.closeDayPopover(), !this.can("createEvent") || !this.allowsCreateAt({ start: r, end: i }, n)) {
4891
4887
  this.announceDenied();
4892
4888
  return;
4893
4889
  }
4894
4890
  this.eventEmitter.emitEventCreate(
4895
- { start: i, end: r },
4891
+ { start: r, end: i },
4896
4892
  this.stateManager.getState().view,
4897
4893
  e,
4898
4894
  n
@@ -4908,7 +4904,7 @@ class $ extends he {
4908
4904
  /** Every event overlapping `day`'s local month, in start order. */
4909
4905
  eventsInMonth(e) {
4910
4906
  const t = new Date(e.getFullYear(), e.getMonth(), 1), s = new Date(e.getFullYear(), e.getMonth() + 1, 1);
4911
- return this.stateManager.getState().events.filter((n) => n.start < s && n.end > t).sort((n, i) => n.start.getTime() - i.start.getTime());
4907
+ return this.stateManager.getState().events.filter((n) => n.start < s && n.end > t).sort((n, r) => n.start.getTime() - r.start.getTime());
4912
4908
  }
4913
4909
  // ============================================
4914
4910
  // Built-in event editor (R20 / D12.8)
@@ -5001,10 +4997,10 @@ class $ extends he {
5001
4997
  "[data-event-id]:not(.preview)"
5002
4998
  );
5003
4999
  if (!s) {
5004
- const r = t?.closest?.(".scheduler-resource-cell")?.querySelector?.(
5000
+ const i = t?.closest?.(".scheduler-resource-cell")?.querySelector?.(
5005
5001
  ".scheduler-row-menu-button"
5006
5002
  )?.dataset.resourceId;
5007
- r && (e.preventDefault(), this.openRowMenu(r));
5003
+ i && (e.preventDefault(), this.openRowMenu(i));
5008
5004
  return;
5009
5005
  }
5010
5006
  const n = this.getEventById(s.dataset.eventId ?? "");
@@ -5060,10 +5056,10 @@ class $ extends he {
5060
5056
  renderEventEditor() {
5061
5057
  const e = this.editorEventId ? this.getEventById(this.editorEventId) : null, t = this.editorDraft;
5062
5058
  if (!e || !t) return k;
5063
- const { options: s } = this.stateManager.getState(), n = this.can("editEvent", e), i = this.editorError?.field === "title", r = this.editorError?.field === "end", o = pe(
5059
+ const { options: s } = this.stateManager.getState(), n = this.can("editEvent", e), r = this.editorError?.field === "title", i = this.editorError?.field === "end", o = pe(
5064
5060
  this.editorTitleErrorId,
5065
5061
  this.editorError?.message ?? null,
5066
- i
5062
+ r
5067
5063
  ), { canStart: a, canEnd: l, startIsMove: d } = this.editorTimeFields(e), c = t.color ?? X(
5068
5064
  e,
5069
5065
  this.stateManager.getState().resourceById,
@@ -5090,13 +5086,13 @@ class $ extends he {
5090
5086
  <span>${this.msg("editorTitleLabel")}</span>
5091
5087
  <input
5092
5088
  type="text"
5093
- class="form-control form-control-sm editor-input editor-title-input ${i ? "is-invalid" : ""}"
5089
+ class="form-control form-control-sm editor-input editor-title-input ${r ? "is-invalid" : ""}"
5094
5090
  .value=${t.title}
5095
5091
  ?disabled=${!n}
5096
- aria-invalid=${i ? "true" : "false"}
5092
+ aria-invalid=${r ? "true" : "false"}
5097
5093
  aria-errormessage=${o.id}
5098
5094
  aria-describedby=${o.id}
5099
- @input=${(u) => this.updateEditorDraft({ title: u.target.value })}
5095
+ @input=${(p) => this.updateEditorDraft({ title: p.target.value })}
5100
5096
  />
5101
5097
  ${o.node}
5102
5098
  </label>
@@ -5107,7 +5103,7 @@ class $ extends he {
5107
5103
  .value=${t.start}
5108
5104
  .max=${d ? null : t.end}
5109
5105
  ?disabled=${!a}
5110
- @value-change=${(u) => this.onEditorStartChange(u)}
5106
+ @value-change=${(p) => this.onEditorStartChange(p)}
5111
5107
  input-label=${this.msg("editorStartLabel")}
5112
5108
  locale=${s.locale ?? k}
5113
5109
  first-day-of-week=${this.firstDayOfWeek()}
@@ -5122,9 +5118,9 @@ class $ extends he {
5122
5118
  .value=${t.end}
5123
5119
  .min=${t.start}
5124
5120
  ?disabled=${!l}
5125
- ?invalid=${r}
5126
- error-text=${r ? this.editorError.message : k}
5127
- @value-change=${(u) => this.onEditorEndChange(u)}
5121
+ ?invalid=${i}
5122
+ error-text=${i ? this.editorError.message : k}
5123
+ @value-change=${(p) => this.onEditorEndChange(p)}
5128
5124
  input-label=${this.msg("editorEndLabel")}
5129
5125
  locale=${s.locale ?? k}
5130
5126
  first-day-of-week=${this.firstDayOfWeek()}
@@ -5139,7 +5135,7 @@ class $ extends he {
5139
5135
  class="form-control form-control-color editor-input editor-color-input"
5140
5136
  .value=${c}
5141
5137
  ?disabled=${!n || t.inheritColor}
5142
- @input=${(u) => this.updateEditorDraft({ color: u.target.value })}
5138
+ @input=${(p) => this.updateEditorDraft({ color: p.target.value })}
5143
5139
  />
5144
5140
  </label>
5145
5141
  <div class="editor-field editor-inherit">
@@ -5224,21 +5220,21 @@ class $ extends he {
5224
5220
  if (!t || !s) return;
5225
5221
  const n = t.getTime() - s.start.getTime();
5226
5222
  if (n === 0) return;
5227
- const i = this.editorEventId ? this.getEventById(this.editorEventId) : null;
5228
- if (!i || this.editorTimeFields(i).startIsMove) {
5223
+ const r = this.editorEventId ? this.getEventById(this.editorEventId) : null;
5224
+ if (!r || this.editorTimeFields(r).startIsMove) {
5229
5225
  this.updateEditorDraft({ start: t, end: new Date(s.end.getTime() + n) });
5230
5226
  return;
5231
5227
  }
5232
- const r = new Date(s.end.getTime() - this.minutesPerSlot() * 60 * 1e3);
5233
- if (t.getTime() <= r.getTime()) {
5228
+ const i = new Date(s.end.getTime() - this.minutesPerSlot() * 60 * 1e3);
5229
+ if (t.getTime() <= i.getTime()) {
5234
5230
  this.updateEditorDraft({ start: t });
5235
5231
  return;
5236
5232
  }
5237
- this.updateEditorDraft({ start: r });
5233
+ this.updateEditorDraft({ start: i });
5238
5234
  const { options: o } = this.stateManager.getState();
5239
5235
  this.liveAnnouncer.announce(
5240
5236
  this.msg("editorStartClamped", {
5241
- start: h.formatTime(r, o.timeFormat, o.locale)
5237
+ start: h.formatTime(i, o.timeFormat, o.locale)
5242
5238
  })
5243
5239
  );
5244
5240
  }
@@ -5270,10 +5266,10 @@ class $ extends he {
5270
5266
  return;
5271
5267
  }
5272
5268
  this.updateEditorDraft({ end: n });
5273
- const { options: i } = this.stateManager.getState();
5269
+ const { options: r } = this.stateManager.getState();
5274
5270
  this.liveAnnouncer.announce(
5275
5271
  this.msg("editorEndClamped", {
5276
- end: h.formatTime(n, i.timeFormat, i.locale)
5272
+ end: h.formatTime(n, r.timeFormat, r.locale)
5277
5273
  })
5278
5274
  );
5279
5275
  }
@@ -5360,16 +5356,16 @@ class $ extends he {
5360
5356
  `.resource-title[data-resource-id="${this.cssEscape(e)}"]`
5361
5357
  );
5362
5358
  if (!t || !s || s.querySelector("input")) return;
5363
- const n = t.title, i = document.createElement("input");
5364
- i.type = "text", i.className = "form-control form-control-sm rename-input", i.value = n, i.setAttribute(
5359
+ const n = t.title, r = document.createElement("input");
5360
+ r.type = "text", r.className = "form-control form-control-sm rename-input", r.value = n, r.setAttribute(
5365
5361
  "aria-label",
5366
5362
  this.msg("renameResourceLabel", { title: n })
5367
5363
  );
5368
- let r = !1;
5364
+ let i = !1;
5369
5365
  const o = (a) => {
5370
- if (r) return;
5371
- r = !0;
5372
- const l = i.value.trim();
5366
+ if (i) return;
5367
+ i = !0;
5368
+ const l = r.value.trim();
5373
5369
  s.textContent = a && l ? l : n, a && l && l !== n && (this.eventEmitter.emitResourceUpdate(t, { title: l }, new CustomEvent("rename")), this.liveAnnouncer.announce(
5374
5370
  this.msg("resourceRenamed", { from: n, to: l })
5375
5371
  )), requestAnimationFrame(() => {
@@ -5378,9 +5374,9 @@ class $ extends he {
5378
5374
  )?.focus({ preventScroll: !0 });
5379
5375
  });
5380
5376
  };
5381
- i.addEventListener("keydown", (a) => {
5377
+ r.addEventListener("keydown", (a) => {
5382
5378
  a.stopPropagation(), a.key === "Enter" ? (a.preventDefault(), o(!0)) : a.key === "Escape" && (a.preventDefault(), o(!1));
5383
- }), i.addEventListener("blur", () => o(!0)), i.addEventListener("pointerdown", (a) => a.stopPropagation()), s.textContent = "", s.appendChild(i), i.focus(), i.select();
5379
+ }), r.addEventListener("blur", () => o(!0)), r.addEventListener("pointerdown", (a) => a.stopPropagation()), s.textContent = "", s.appendChild(r), r.focus(), r.select();
5384
5380
  }
5385
5381
  /** The in-grid pointer delete (D12.4b's revised home). */
5386
5382
  deleteFromEditor() {
@@ -5412,7 +5408,7 @@ class $ extends he {
5412
5408
  }
5413
5409
  firstUpdated() {
5414
5410
  const e = this.shadowRoot.querySelector(".scheduler-header");
5415
- this.contentContainer = this.shadowRoot.querySelector(".scheduler-content"), this.populateHeader(e), this.observeHeaderWidth(e), this.inputHandler = new He(
5411
+ this.contentContainer = this.shadowRoot.querySelector(".scheduler-content"), this.populateHeader(e), this.observeHeaderWidth(e), this.inputHandler = new We(
5416
5412
  {
5417
5413
  shadowRoot: this.shadowRoot,
5418
5414
  getEventById: (t) => this.getEventById(t),
@@ -5428,6 +5424,7 @@ class $ extends he {
5428
5424
  onPointerUp: (t) => this.handlePointerUp(t),
5429
5425
  onClick: (t, s) => this.handleClick(t, s),
5430
5426
  onDoubleClick: (t, s) => this.handleDoubleClick(t, s),
5427
+ onPointerCancel: () => this.cancelPointerDrag(),
5431
5428
  getScrollContainer: () => this.contentContainer
5432
5429
  }
5433
5430
  ), this.inputHandler.attach(), this.shadowRoot.addEventListener("focusin", this.boundHandleFocusIn), this.shadowRoot.addEventListener("change", this.boundHandleValueChange), this.shadowRoot.addEventListener("contextmenu", this.boundHandleContextMenu), this.shadowRoot.addEventListener("dblclick", this.boundHandleDblClick), this.renderView();
@@ -5439,10 +5436,10 @@ class $ extends he {
5439
5436
  s.type = "button", s.textContent = "‹", s.setAttribute("aria-label", this.msg("previousPeriod")), s.title = this.msg("previousPeriod"), s.addEventListener("click", () => this.prev());
5440
5437
  const n = document.createElement("button");
5441
5438
  n.type = "button", n.textContent = "›", n.setAttribute("aria-label", this.msg("nextPeriod")), n.title = this.msg("nextPeriod"), n.addEventListener("click", () => this.next());
5442
- const i = document.createElement("button");
5443
- i.type = "button", i.textContent = this.msg("today"), i.setAttribute("aria-label", this.msg("jumpToToday")), i.addEventListener("click", () => this.today()), t.appendChild(s), t.appendChild(n), t.appendChild(i);
5444
- const r = document.createElement("div");
5445
- r.className = "scheduler-title", r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), this.updateTitle(r);
5439
+ const r = document.createElement("button");
5440
+ r.type = "button", r.textContent = this.msg("today"), r.setAttribute("aria-label", this.msg("jumpToToday")), r.addEventListener("click", () => this.today()), t.appendChild(s), t.appendChild(n), t.appendChild(r);
5441
+ const i = document.createElement("div");
5442
+ i.className = "scheduler-title", i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true"), this.updateTitle(i);
5446
5443
  const o = document.createElement("div");
5447
5444
  o.className = "scheduler-view-switcher", o.setAttribute("role", "group"), o.setAttribute("aria-label", this.msg("switchView"));
5448
5445
  const a = ["year", "month", "week", "day", "timeline"];
@@ -5452,19 +5449,19 @@ class $ extends he {
5452
5449
  const c = l === this.view;
5453
5450
  d.setAttribute("aria-pressed", String(c)), c && d.classList.add("active"), d.addEventListener("click", () => this.changeView(l)), o.appendChild(d);
5454
5451
  }
5455
- e.appendChild(t), e.appendChild(r), e.appendChild(o);
5452
+ e.appendChild(t), e.appendChild(i), e.appendChild(o);
5456
5453
  }
5457
5454
  updateTitle(e) {
5458
5455
  const t = e ?? this.shadowRoot.querySelector(".scheduler-title");
5459
5456
  if (!t) return;
5460
- const s = this.stateManager.getState(), { date: n, view: i, options: r } = s;
5457
+ const s = this.stateManager.getState(), { date: n, view: r, options: i } = s;
5461
5458
  let o = "";
5462
- switch (i) {
5459
+ switch (r) {
5463
5460
  case "year":
5464
5461
  o = n.getFullYear().toString();
5465
5462
  break;
5466
5463
  case "month":
5467
- o = h.formatDate(n, r.locale, {
5464
+ o = h.formatDate(n, i.locale, {
5468
5465
  month: "long",
5469
5466
  year: "numeric"
5470
5467
  });
@@ -5472,7 +5469,7 @@ class $ extends he {
5472
5469
  case "week":
5473
5470
  case "timeline": {
5474
5471
  const a = h.getWeekStart(n, this.firstDayOfWeek()), l = h.addDays(a, 6);
5475
- o = h.formatDateRange(a, l, r.locale, {
5472
+ o = h.formatDateRange(a, l, i.locale, {
5476
5473
  month: "short",
5477
5474
  day: "numeric",
5478
5475
  year: "numeric"
@@ -5480,7 +5477,7 @@ class $ extends he {
5480
5477
  break;
5481
5478
  }
5482
5479
  case "day":
5483
- o = h.formatDate(n, r.locale, {
5480
+ o = h.formatDate(n, i.locale, {
5484
5481
  weekday: "long",
5485
5482
  month: "long",
5486
5483
  day: "numeric",
@@ -5502,9 +5499,9 @@ class $ extends he {
5502
5499
  if (typeof ResizeObserver > "u") return;
5503
5500
  const t = this.shadowRoot?.querySelector(".scheduler-container");
5504
5501
  this.headerResizeObserver = new ResizeObserver((s) => {
5505
- const i = (s[0]?.contentRect.width ?? e.clientWidth) < $.NARROW_HEADER_WIDTH;
5506
- i !== this.headerIsNarrow && (this.headerIsNarrow = i, requestAnimationFrame(() => {
5507
- e.toggleAttribute("data-narrow", i), t?.toggleAttribute("data-narrow", i);
5502
+ const r = (s[0]?.contentRect.width ?? e.clientWidth) < z.NARROW_HEADER_WIDTH;
5503
+ r !== this.headerIsNarrow && (this.headerIsNarrow = r, requestAnimationFrame(() => {
5504
+ e.toggleAttribute("data-narrow", r), t?.toggleAttribute("data-narrow", r);
5508
5505
  }));
5509
5506
  }), this.headerResizeObserver.observe(e);
5510
5507
  }
@@ -5515,19 +5512,19 @@ class $ extends he {
5515
5512
  const s = this.stateManager.getState();
5516
5513
  switch (s.view) {
5517
5514
  case "year":
5518
- this.currentView = new U(this.contentContainer, s), this.currentViewType = "year";
5515
+ this.currentView = new K(this.contentContainer, s), this.currentViewType = "year";
5519
5516
  break;
5520
5517
  case "month":
5521
- this.currentView = new N(this.contentContainer, s), this.currentViewType = "month";
5518
+ this.currentView = new W(this.contentContainer, s), this.currentViewType = "month";
5522
5519
  break;
5523
5520
  case "week":
5524
- this.currentView = new Ie(this.contentContainer, s), this.currentViewType = "week";
5521
+ this.currentView = new Te(this.contentContainer, s), this.currentViewType = "week";
5525
5522
  break;
5526
5523
  case "day":
5527
- this.currentView = new Ae(this.contentContainer, s), this.currentViewType = "day";
5524
+ this.currentView = new Ie(this.contentContainer, s), this.currentViewType = "day";
5528
5525
  break;
5529
5526
  case "timeline":
5530
- this.currentView = new I(this.contentContainer, s), this.currentViewType = "timeline";
5527
+ this.currentView = new P(this.contentContainer, s), this.currentViewType = "timeline";
5531
5528
  break;
5532
5529
  }
5533
5530
  this.currentView?.render(), t && requestAnimationFrame(() => {
@@ -5542,13 +5539,13 @@ class $ extends he {
5542
5539
  e.isLoading !== this.previousIsLoading && (this.previousIsLoading !== null && this.liveAnnouncer.announce(this.msg(e.isLoading ? "loadingEvents" : "eventsLoaded")), this.previousIsLoading = e.isLoading), this.detectAndEmitChanges(e), this.updateUI(e), this.keymapView !== e.view && (this.keymapView = e.view, this.requestUpdate()), (this.popoverDate || this.editorEventId) && this.requestUpdate();
5543
5540
  }
5544
5541
  detectAndEmitChanges(e) {
5545
- const t = this.previousView !== null && this.previousView !== e.view, s = this.previousDate !== null && this.previousDate.getTime() !== e.date.getTime(), n = e.selectedEvent?.id ?? null, i = G(e), r = i ? `${i.start.getTime()}-${i.end.getTime()}-${e.selectionResourceId ?? ""}` : null, o = this.previousSelectedEventId !== n || this.previousRangeKey !== r;
5542
+ const t = this.previousView !== null && this.previousView !== e.view, s = this.previousDate !== null && this.previousDate.getTime() !== e.date.getTime(), n = e.selectedEvent?.id ?? null, r = q(e), i = r ? `${r.start.getTime()}-${r.end.getTime()}-${e.selectionResourceId ?? ""}` : null, o = this.previousSelectedEventId !== n || this.previousRangeKey !== i;
5546
5543
  (t || s) && this.eventEmitter.emitViewChange(e.view, e.date), o && this.eventEmitter.emitSelectionChange(
5547
5544
  e.selectedEvent,
5548
- i,
5545
+ r,
5549
5546
  e.view,
5550
5547
  e.selectionResourceId ?? void 0
5551
- ), this.previousView = e.view, this.previousDate = new Date(e.date), this.previousSelectedEventId = n, this.previousRangeKey = r;
5548
+ ), this.previousView = e.view, this.previousDate = new Date(e.date), this.previousSelectedEventId = n, this.previousRangeKey = i;
5552
5549
  }
5553
5550
  /**
5554
5551
  * Re-apply the header's localized labels.
@@ -5564,8 +5561,8 @@ class $ extends he {
5564
5561
  if (!e) return;
5565
5562
  const t = e.querySelector(".scheduler-nav");
5566
5563
  t?.setAttribute("aria-label", this.msg("navLabel"));
5567
- const s = t?.querySelectorAll("button"), [n, i, r] = s ? [...s] : [];
5568
- n && (n.setAttribute("aria-label", this.msg("previousPeriod")), n.title = this.msg("previousPeriod")), i && (i.setAttribute("aria-label", this.msg("nextPeriod")), i.title = this.msg("nextPeriod")), r && (r.textContent = this.msg("today"), r.setAttribute("aria-label", this.msg("jumpToToday")));
5564
+ const s = t?.querySelectorAll("button"), [n, r, i] = s ? [...s] : [];
5565
+ n && (n.setAttribute("aria-label", this.msg("previousPeriod")), n.title = this.msg("previousPeriod")), r && (r.setAttribute("aria-label", this.msg("nextPeriod")), r.title = this.msg("nextPeriod")), i && (i.textContent = this.msg("today"), i.setAttribute("aria-label", this.msg("jumpToToday")));
5569
5566
  const o = e.querySelector(".scheduler-view-switcher");
5570
5567
  o?.setAttribute("aria-label", this.msg("switchView")), o?.querySelectorAll("button[data-view]").forEach((a) => {
5571
5568
  const l = a.dataset.view;
@@ -5575,9 +5572,12 @@ class $ extends he {
5575
5572
  updateUI(e) {
5576
5573
  if (!this.shadowRoot) return;
5577
5574
  this.updateTitle(), this.applyHeaderLabels(), this.shadowRoot.querySelectorAll(".scheduler-view-switcher button").forEach((s) => {
5578
- const n = s, i = n.dataset.view === e.view;
5579
- n.classList.toggle("active", i), n.setAttribute("aria-pressed", String(i));
5580
- }), this.currentView && (this.currentViewType !== e.view ? this.renderView() : e.dragState || e.previewEvent ? this.scheduleDragUpdate(e) : this.currentView.update(e));
5575
+ const n = s, r = n.dataset.view === e.view;
5576
+ n.classList.toggle("active", r), n.setAttribute("aria-pressed", String(r));
5577
+ }), this.currentView && (this.currentViewType !== e.view ? this.renderView() : e.dragState || e.previewEvent ? this.scheduleDragUpdate(e) : (this.cancelPendingDragUpdate(), this.currentView.update(e)));
5578
+ }
5579
+ cancelPendingDragUpdate() {
5580
+ this.pendingDragUpdate !== null && (cancelAnimationFrame(this.pendingDragUpdate), this.pendingDragUpdate = null), this.latestDragState = null;
5581
5581
  }
5582
5582
  scheduleDragUpdate(e) {
5583
5583
  this.latestDragState = e, this.pendingDragUpdate === null && (this.pendingDragUpdate = requestAnimationFrame(() => {
@@ -5612,6 +5612,10 @@ class $ extends he {
5612
5612
  const t = this.dragManager.handlePointerUp(e);
5613
5613
  t && this.handleDragComplete(t, e.originalEvent);
5614
5614
  }
5615
+ /** Abandon a pointer drag without committing it (the platform cancelled the touch). */
5616
+ cancelPointerDrag() {
5617
+ this.stopEdgeScroll(), this.dragManager.cancel();
5618
+ }
5615
5619
  static {
5616
5620
  this.EDGE_SCROLL_ZONE_PX = 40;
5617
5621
  }
@@ -5639,11 +5643,12 @@ class $ extends he {
5639
5643
  this.stopEdgeScroll();
5640
5644
  return;
5641
5645
  }
5642
- const s = t.getBoundingClientRect(), n = $.EDGE_SCROLL_ZONE_PX, i = $.EDGE_SCROLL_MAX_PX, r = (o, a, l) => o < a + n ? -Math.min(1, (a + n - o) / n) * i : o > l - n ? Math.min(1, (o - (l - n)) / n) * i : 0;
5643
- if (this.edgeScrollVector = {
5644
- x: r(e.clientX, s.left, s.right),
5645
- y: r(e.clientY, s.top, s.bottom)
5646
- }, this.edgeScrollPointer = e, this.edgeScrollVector.x === 0 && this.edgeScrollVector.y === 0) {
5646
+ if (this.edgeScrollVector = Ae(
5647
+ { x: e.clientX, y: e.clientY },
5648
+ t.getBoundingClientRect(),
5649
+ z.EDGE_SCROLL_ZONE_PX,
5650
+ z.EDGE_SCROLL_MAX_PX
5651
+ ), this.edgeScrollPointer = e, this.edgeScrollVector.x === 0 && this.edgeScrollVector.y === 0) {
5647
5652
  this.stopEdgeScroll();
5648
5653
  return;
5649
5654
  }
@@ -5666,7 +5671,7 @@ class $ extends he {
5666
5671
  }
5667
5672
  registerEventActivation(e, t) {
5668
5673
  const s = Date.now(), n = this.lastEventActivation;
5669
- this.lastEventActivation = { eventId: e.id, time: s }, n && n.eventId === e.id && s - n.time < $.DBLCLICK_WINDOW_MS && (this.lastEventActivation = null, this.eventEmitter.emitEventDblClick(e, t), this.tryOpenEventEditor(e));
5674
+ this.lastEventActivation = { eventId: e.id, time: s }, n && n.eventId === e.id && s - n.time < z.DBLCLICK_WINDOW_MS && (this.lastEventActivation = null, this.eventEmitter.emitEventDblClick(e, t), this.tryOpenEventEditor(e));
5670
5675
  }
5671
5676
  handleDragComplete(e, t) {
5672
5677
  if (e.wasClick) {
@@ -5712,21 +5717,21 @@ class $ extends he {
5712
5717
  if (n) {
5713
5718
  const a = n.dataset.groupId;
5714
5719
  if (a) {
5715
- this.stateManager.toggleGroupCollapse(a), this.renderView();
5720
+ this.stateManager.toggleGroupCollapse(a);
5716
5721
  return;
5717
5722
  }
5718
5723
  }
5719
- const i = s.closest(".scheduler-more-link");
5720
- if (i) {
5721
- const a = i.dataset.date;
5724
+ const r = s.closest(".scheduler-more-link");
5725
+ if (r) {
5726
+ const a = r.dataset.date;
5722
5727
  if (a) {
5723
5728
  this.handleMoreLink(a);
5724
5729
  return;
5725
5730
  }
5726
5731
  }
5727
- const r = s.closest("[data-date]");
5728
- if (r) {
5729
- const a = r.dataset.date;
5732
+ const i = s.closest("[data-date]");
5733
+ if (i) {
5734
+ const a = i.dataset.date;
5730
5735
  if (a) {
5731
5736
  const l = this.parseDayKey(a);
5732
5737
  if (this.eventEmitter.emitDateClick(l, e.originalEvent), s.closest(".day-number")) {
@@ -5760,24 +5765,24 @@ class $ extends he {
5760
5765
  handleResourceAction(e, t) {
5761
5766
  const s = e.closest("[data-action]");
5762
5767
  if (!s) return !1;
5763
- const { action: n, parentId: i, resourceId: r } = s.dataset, o = this.stateManager.getState().view;
5768
+ const { action: n, parentId: r, resourceId: i } = s.dataset, o = this.stateManager.getState().view;
5764
5769
  switch (n) {
5765
5770
  // The trigger itself is not a request — it opens the panel that carries
5766
5771
  // them. Handled here so the click never falls through to the grid.
5767
5772
  case "row-menu":
5768
- return r && this.openRowMenu(r), !0;
5773
+ return i && this.openRowMenu(i), !0;
5769
5774
  // Starts the same inline edit double-click and F2 already start. The panel
5770
5775
  // closes WITHOUT returning focus first: `beginResourceRename` focuses the
5771
5776
  // input it creates, and handing focus back to the trigger on the way there
5772
5777
  // would be a visible detour.
5773
5778
  case "rename-resource":
5774
- return r && this.can("updateResource") && (this.rowMenuOverlay.close(!1), this.beginResourceRename(r)), !0;
5779
+ return i && this.can("updateResource") && (this.rowMenuOverlay.close(!1), this.beginResourceRename(i)), !0;
5775
5780
  case "add-resource":
5776
- return this.can("createResource") && this.eventEmitter.emitResourceCreate("resource", o, t, i), !0;
5781
+ return this.can("createResource") && this.eventEmitter.emitResourceCreate("resource", o, t, r), !0;
5777
5782
  case "add-group":
5778
- return this.can("createGroup") && this.eventEmitter.emitResourceCreate("group", o, t, i), !0;
5783
+ return this.can("createGroup") && this.eventEmitter.emitResourceCreate("group", o, t, r), !0;
5779
5784
  case "delete-resource": {
5780
- const a = r ? this.findResourceOrGroup(r) : null;
5785
+ const a = i ? this.findResourceOrGroup(i) : null;
5781
5786
  return a && this.can("deleteResource") && this.eventEmitter.emitResourceDelete(a, t), !0;
5782
5787
  }
5783
5788
  // The colour input reports through `change`, not `click` — a click merely
@@ -5797,12 +5802,12 @@ class $ extends he {
5797
5802
  handleValueChange(e) {
5798
5803
  const t = e.composedPath?.()[0] ?? e.target;
5799
5804
  if (!t || t.dataset.action !== "set-resource-color" || !this.can("updateResource")) return;
5800
- const { resourceId: s, field: n } = t.dataset, i = s ? this.findResourceOrGroup(s) : null;
5801
- if (!i) return;
5802
- const r = t.value;
5805
+ const { resourceId: s, field: n } = t.dataset, r = s ? this.findResourceOrGroup(s) : null;
5806
+ if (!r) return;
5807
+ const i = t.value;
5803
5808
  this.eventEmitter.emitResourceUpdate(
5804
- i,
5805
- n === "eventColor" ? { eventColor: r } : { color: r },
5809
+ r,
5810
+ n === "eventColor" ? { eventColor: i } : { color: i },
5806
5811
  e
5807
5812
  );
5808
5813
  }
@@ -5828,10 +5833,10 @@ class $ extends he {
5828
5833
  const n = s.dataset.eventId;
5829
5834
  if (!n || !s.classList.contains("scheduler-event") && !s.classList.contains("scheduler-timeline-event") && !s.classList.contains("scheduler-month-event"))
5830
5835
  return;
5831
- const i = this.getEventById(n);
5832
- i && this.stateManager.getState().selectedEvent?.id !== i.id && (this.stateManager.setSelectedEvent(i), this.eventEmitter.emitEventSelected(i, e), requestAnimationFrame(() => {
5833
- const r = `[data-event-id="${this.cssEscape(i.id)}"]`;
5834
- this.shadowRoot?.querySelector(r)?.focus({ preventScroll: !0 });
5836
+ const r = this.getEventById(n);
5837
+ r && this.stateManager.getState().selectedEvent?.id !== r.id && (this.stateManager.setSelectedEvent(r), this.eventEmitter.emitEventSelected(r, e), requestAnimationFrame(() => {
5838
+ const i = `[data-event-id="${this.cssEscape(r.id)}"]`;
5839
+ this.shadowRoot?.querySelector(i)?.focus({ preventScroll: !0 });
5835
5840
  }));
5836
5841
  }
5837
5842
  /**
@@ -5950,7 +5955,7 @@ class $ extends he {
5950
5955
  */
5951
5956
  can(e, t) {
5952
5957
  const { options: s } = this.stateManager.getState();
5953
- return re(e, {
5958
+ return ie(e, {
5954
5959
  permissions: this.effectivePermissions(s),
5955
5960
  event: t ?? null
5956
5961
  });
@@ -6060,14 +6065,14 @@ class $ extends he {
6060
6065
  const n = [...this.stateManager.getState().events].sort((l, d) => {
6061
6066
  const c = l.start.getTime() - d.start.getTime();
6062
6067
  return c !== 0 ? c : l.id.localeCompare(d.id);
6063
- }), i = n.findIndex((l) => l.id === e.id);
6064
- if (i < 0) return;
6065
- const r = n[i + t];
6066
- if (!r) return;
6068
+ }), r = n.findIndex((l) => l.id === e.id);
6069
+ if (r < 0) return;
6070
+ const i = n[r + t];
6071
+ if (!i) return;
6067
6072
  const o = this.shadowRoot;
6068
6073
  if (!o) return;
6069
6074
  o.querySelector(
6070
- `[data-event-id="${this.cssEscape(r.id)}"]`
6075
+ `[data-event-id="${this.cssEscape(i.id)}"]`
6071
6076
  )?.focus({ preventScroll: !1 });
6072
6077
  }
6073
6078
  handleCellKeyDown(e) {
@@ -6081,31 +6086,31 @@ class $ extends he {
6081
6086
  return;
6082
6087
  }
6083
6088
  if (t.focusedCell || this.initFocusedCellFromActive(), e.key === "F2" && t.view === "timeline") {
6084
- const r = this.stateManager.getState().focusedResourceId;
6085
- r && (e.preventDefault(), this.beginResourceRename(r));
6089
+ const i = this.stateManager.getState().focusedResourceId;
6090
+ i && (e.preventDefault(), this.beginResourceRename(i));
6086
6091
  return;
6087
6092
  }
6088
- const s = e.shiftKey, n = e.ctrlKey || e.metaKey, i = t.view === "timeline";
6093
+ const s = e.shiftKey, n = e.ctrlKey || e.metaKey, r = t.view === "timeline";
6089
6094
  switch (e.key) {
6090
6095
  case "ArrowUp":
6091
- e.preventDefault(), i ? this.moveCellByResource(-1, s) : this.moveCellByTime(-1, s);
6096
+ e.preventDefault(), r ? this.moveCellByResource(-1, s) : this.moveCellByTime(-1, s);
6092
6097
  break;
6093
6098
  case "ArrowDown":
6094
- e.preventDefault(), i ? this.moveCellByResource(1, s) : this.moveCellByTime(1, s);
6099
+ e.preventDefault(), r ? this.moveCellByResource(1, s) : this.moveCellByTime(1, s);
6095
6100
  break;
6096
6101
  case "ArrowLeft": {
6097
- if (e.preventDefault(), !i) {
6102
+ if (e.preventDefault(), !r) {
6098
6103
  this.moveCellByDay(-1, s);
6099
6104
  break;
6100
6105
  }
6101
- const r = this.stateManager.getState().focusedCell?.start.getTime();
6106
+ const i = this.stateManager.getState().focusedCell?.start.getTime();
6102
6107
  this.moveCellByTime(-1, s);
6103
6108
  const o = this.stateManager.getState().focusedCell?.start.getTime();
6104
- r !== void 0 && r === o && !s && this.focusRowTrigger();
6109
+ i !== void 0 && i === o && !s && this.focusRowTrigger();
6105
6110
  break;
6106
6111
  }
6107
6112
  case "ArrowRight":
6108
- e.preventDefault(), i ? this.moveCellByTime(1, s) : this.moveCellByDay(1, s);
6113
+ e.preventDefault(), r ? this.moveCellByTime(1, s) : this.moveCellByDay(1, s);
6109
6114
  break;
6110
6115
  case "Home":
6111
6116
  e.preventDefault(), n ? this.moveCellToViewExtreme("start", s) : this.moveCellToColumnExtreme("start", s);
@@ -6137,8 +6142,8 @@ class $ extends he {
6137
6142
  if (!e) return;
6138
6143
  const t = e.dataset.start, s = e.dataset.end;
6139
6144
  if (!t || !s) return;
6140
- const n = { start: new Date(t), end: new Date(s) }, i = e.dataset.resourceId ?? null;
6141
- this.stateManager.setFocusedCell(n, i, !0);
6145
+ const n = { start: new Date(t), end: new Date(s) }, r = e.dataset.resourceId ?? null;
6146
+ this.stateManager.setFocusedCell(n, r, !0);
6142
6147
  }
6143
6148
  /**
6144
6149
  * Month-view keyboard handler (PRD scheduler-controlled-selection §5.1).
@@ -6169,7 +6174,7 @@ class $ extends he {
6169
6174
  e.preventDefault(), this.moveFocusedDateByMonths(1);
6170
6175
  return;
6171
6176
  case "Enter":
6172
- e.preventDefault(), this.commitFocusedDateAsCreate(e, "day");
6177
+ e.preventDefault(), this.commitFocusedDateAsCreate(e);
6173
6178
  return;
6174
6179
  // Space, not Enter: Enter already means "create for this day" and taking
6175
6180
  // it would remove the only keyboard create path in this view.
@@ -6269,90 +6274,91 @@ class $ extends he {
6269
6274
  scrollAndFocusDateCell(e) {
6270
6275
  const t = this.stateManager.getState(), s = this.shadowRoot;
6271
6276
  if (!s) return;
6272
- const n = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, i = t.view === "year" ? `scheduler-cell-y-${n}` : `scheduler-cell-m-${n}-${String(e.getDate()).padStart(2, "0")}`, r = s.getElementById(i);
6273
- r && (r.focus({ preventScroll: !0 }), typeof r.scrollIntoView == "function" && r.scrollIntoView({ block: "nearest", inline: "nearest" }));
6277
+ const n = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, r = t.view === "year" ? `scheduler-cell-y-${n}` : `scheduler-cell-m-${n}-${String(e.getDate()).padStart(2, "0")}`, i = s.getElementById(r);
6278
+ i && (i.focus({ preventScroll: !0 }), typeof i.scrollIntoView == "function" && i.scrollIntoView({ block: "nearest", inline: "nearest" }));
6274
6279
  }
6275
6280
  /**
6276
- * Emit `event-create` covering the focused day (month view) or focused
6277
- * month (year view). No internal mutation per PRD
6278
- * scheduler-controlled-selection — consumer constructs the actual event.
6281
+ * Emit `event-create` covering the focused day (month view). No internal
6282
+ * mutation per PRD scheduler-controlled-selection — consumer constructs the
6283
+ * actual event. (Year view's Enter drills into the month instead, so there
6284
+ * is no month-spanning variant.)
6279
6285
  */
6280
- commitFocusedDateAsCreate(e, t) {
6281
- const s = this.stateManager.getState(), n = s.focusedDate;
6282
- if (!n) return;
6283
- const i = new Date(n);
6284
- i.setHours(0, 0, 0, 0);
6285
- const r = new Date(i);
6286
- if (t === "day" ? r.setDate(r.getDate() + 1) : r.setMonth(r.getMonth() + 1), !this.can("createEvent") || !this.allowsCreateAt({ start: i, end: r })) {
6286
+ commitFocusedDateAsCreate(e) {
6287
+ const t = this.stateManager.getState(), s = t.focusedDate;
6288
+ if (!s) return;
6289
+ const n = new Date(s);
6290
+ n.setHours(0, 0, 0, 0);
6291
+ const r = new Date(n);
6292
+ if (r.setDate(r.getDate() + 1), !this.can("createEvent") || !this.allowsCreateAt({ start: n, end: r })) {
6287
6293
  this.announceDenied();
6288
6294
  return;
6289
6295
  }
6290
6296
  this.eventEmitter.emitEventCreate(
6291
- { start: i, end: r },
6292
- s.view,
6297
+ { start: n, end: r },
6298
+ t.view,
6293
6299
  e
6294
6300
  );
6295
6301
  }
6296
6302
  moveCellByTime(e, t) {
6297
6303
  const s = this.stateManager.getState(), n = s.focusedCell;
6298
6304
  if (!n) return;
6299
- const i = (s.options.slotDuration ?? 1800) * 1e3, r = new Date(n.start.getTime() + e * i), o = new Date(r.getTime() + i);
6300
- this.cellIsWithinView(r, s) && this.commitFocusMove({ start: r, end: o }, s.focusedResourceId, t);
6305
+ const r = (s.options.slotDuration ?? 1800) * 1e3, i = new Date(n.start.getTime() + e * r), o = new Date(i.getTime() + r);
6306
+ this.cellIsWithinView(i, s) && this.commitFocusMove({ start: i, end: o }, s.focusedResourceId, t);
6301
6307
  }
6302
6308
  /** Week view ArrowLeft/Right: ±1 day, same time-of-day. No-op on day view. */
6303
6309
  moveCellByDay(e, t) {
6304
6310
  const s = this.stateManager.getState(), n = s.focusedCell;
6305
6311
  if (!n || s.view !== "week") return;
6306
- const i = (s.options.slotDuration ?? 1800) * 1e3, r = new Date(n.start);
6307
- r.setDate(r.getDate() + e);
6308
- const o = new Date(r.getTime() + i);
6309
- this.cellIsWithinView(r, s) && this.commitFocusMove({ start: r, end: o }, null, t);
6312
+ const r = (s.options.slotDuration ?? 1800) * 1e3, i = new Date(n.start);
6313
+ i.setDate(i.getDate() + e);
6314
+ const o = new Date(i.getTime() + r);
6315
+ this.cellIsWithinView(i, s) && this.commitFocusMove({ start: i, end: o }, null, t);
6310
6316
  }
6311
6317
  /** Timeline ArrowUp/Down: ±1 resource, same time-of-day. PRD D1: cross-resource
6312
6318
  * Shift+Arrow is intentionally ignored (resource is categorical). */
6313
6319
  moveCellByResource(e, t) {
6314
6320
  const s = this.stateManager.getState(), n = s.focusedCell;
6315
6321
  if (!n || s.view !== "timeline" || t) return;
6316
- const i = this.adjacentRow(s.focusedResourceId, e, s, !0);
6317
- i !== void 0 && this.commitFocusMove(n, i, !1);
6322
+ const r = this.adjacentRow(s.focusedResourceId, e, s, !0);
6323
+ r !== void 0 && this.commitFocusMove(n, r, !1);
6318
6324
  }
6319
6325
  moveCellToColumnExtreme(e, t) {
6320
6326
  const s = this.stateManager.getState(), n = s.focusedCell;
6321
6327
  if (!n) return;
6322
- const i = new Date(n.start);
6323
- i.setHours(0, 0, 0, 0);
6324
- const r = h.getTimeSlots(
6325
- i,
6328
+ const r = new Date(n.start);
6329
+ r.setHours(0, 0, 0, 0);
6330
+ const i = h.getTimeSlots(
6331
+ r,
6326
6332
  s.options.slotDuration,
6327
6333
  s.options.slotMinTime,
6328
6334
  s.options.slotMaxTime
6329
- ), o = e === "start" ? r[0] : r[r.length - 1];
6335
+ ), o = e === "start" ? i[0] : i[i.length - 1];
6330
6336
  o && this.commitFocusMove(o, s.focusedResourceId, t);
6331
6337
  }
6332
6338
  moveCellToViewExtreme(e, t) {
6333
6339
  const s = this.stateManager.getState();
6334
- let n = null, i = s.focusedResourceId;
6340
+ let n = null, r = s.focusedResourceId;
6335
6341
  switch (s.view) {
6336
6342
  case "day": {
6337
- const r = h.getTimeSlots(s.date, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
6338
- n = e === "start" ? r[0] : r[r.length - 1];
6343
+ const i = h.getTimeSlots(s.date, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
6344
+ n = e === "start" ? i[0] : i[i.length - 1];
6339
6345
  break;
6340
6346
  }
6341
6347
  case "week": {
6342
- const r = h.getWeekDays(s.date, this.firstDayOfWeek()), o = e === "start" ? r[0] : r[6], a = h.getTimeSlots(o, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
6348
+ const i = h.getWeekDays(s.date, this.firstDayOfWeek()), o = e === "start" ? i[0] : i[6], a = h.getTimeSlots(o, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
6343
6349
  n = e === "start" ? a[0] : a[a.length - 1];
6344
6350
  break;
6345
6351
  }
6346
6352
  case "timeline": {
6347
- const r = this.navigableRows(s, !0);
6348
- if (r.length === 0) return;
6349
- i = e === "start" ? r[0] : r[r.length - 1];
6353
+ const i = this.navigableRows(s, !0);
6354
+ if (i.length === 0) return;
6355
+ r = e === "start" ? i[0] : i[i.length - 1];
6350
6356
  const o = h.getWeekDays(s.date, this.firstDayOfWeek()), a = e === "start" ? o[0] : o[6], l = h.getTimeSlots(a, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
6351
6357
  n = e === "start" ? l[0] : l[l.length - 1];
6352
6358
  break;
6353
6359
  }
6354
6360
  }
6355
- n && this.commitFocusMove(n, i, t);
6361
+ n && this.commitFocusMove(n, r, t);
6356
6362
  }
6357
6363
  /**
6358
6364
  * PageUp/PageDown — advance one period (week or day) and re-focus the same
@@ -6362,15 +6368,15 @@ class $ extends he {
6362
6368
  moveCellByPeriod(e) {
6363
6369
  const t = this.stateManager.getState(), s = t.focusedCell, n = t.date;
6364
6370
  if (e > 0 ? this.next() : this.prev(), !s) return;
6365
- const i = this.stateManager.getState();
6366
- let r;
6367
- if (i.view === "day")
6368
- r = new Date(i.date), r.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
6371
+ const r = this.stateManager.getState();
6372
+ let i;
6373
+ if (r.view === "day")
6374
+ i = new Date(r.date), i.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
6369
6375
  else {
6370
- const l = h.getWeekDays(n, this.firstDayOfWeek()), d = h.getWeekDays(i.date, this.firstDayOfWeek()), c = l.findIndex((m) => h.isSameDay(m, s.start)), u = d[Math.max(0, c)] ?? d[0];
6371
- r = new Date(u), r.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
6376
+ const l = h.getWeekDays(n, this.firstDayOfWeek()), d = h.getWeekDays(r.date, this.firstDayOfWeek()), c = l.findIndex((m) => h.isSameDay(m, s.start)), p = d[Math.max(0, c)] ?? d[0];
6377
+ i = new Date(p), i.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
6372
6378
  }
6373
- const o = (i.options.slotDuration ?? 1800) * 1e3, a = { start: r, end: new Date(r.getTime() + o) };
6379
+ const o = (r.options.slotDuration ?? 1800) * 1e3, a = { start: i, end: new Date(i.getTime() + o) };
6374
6380
  this.commitFocusMove(a, t.focusedResourceId, !1);
6375
6381
  }
6376
6382
  /**
@@ -6379,15 +6385,15 @@ class $ extends he {
6379
6385
  * focused cell or selection range.
6380
6386
  */
6381
6387
  commitFocusMove(e, t, s) {
6382
- const n = this.stateManager.getState(), i = n.options.slotDuration ?? 1800;
6388
+ const n = this.stateManager.getState(), r = n.options.slotDuration ?? 1800;
6383
6389
  if (s) {
6384
6390
  this.stateManager.extendSelection(e, t), this.stateManager.setFocusedCell(e, t, !1);
6385
- const r = this.stateManager.getState();
6386
- this.liveAnnouncer.announce(Se(r, i));
6391
+ const i = this.stateManager.getState();
6392
+ this.liveAnnouncer.announce(De(i, r));
6387
6393
  } else {
6388
6394
  this.stateManager.setFocusedCell(e, t, !0);
6389
- const r = this.getResourceTitle(t);
6390
- this.liveAnnouncer.announce(q(e, n.options, r));
6395
+ const i = this.getResourceTitle(t);
6396
+ this.liveAnnouncer.announce(U(e, n.options, i));
6391
6397
  }
6392
6398
  this.scrollAndFocusCell(e, t);
6393
6399
  }
@@ -6399,16 +6405,16 @@ class $ extends he {
6399
6405
  }
6400
6406
  case "week":
6401
6407
  case "timeline": {
6402
- const s = h.getWeekDays(t.date, this.firstDayOfWeek()), n = this.parseTimeOnDay(s[0], t.options.slotMinTime), i = this.parseTimeOnDay(s[6], t.options.slotMaxTime);
6403
- return e.getTime() >= n.getTime() && e.getTime() < i.getTime();
6408
+ const s = h.getWeekDays(t.date, this.firstDayOfWeek()), n = this.parseTimeOnDay(s[0], t.options.slotMinTime), r = this.parseTimeOnDay(s[6], t.options.slotMaxTime);
6409
+ return e.getTime() >= n.getTime() && e.getTime() < r.getTime();
6404
6410
  }
6405
6411
  default:
6406
6412
  return !1;
6407
6413
  }
6408
6414
  }
6409
6415
  parseTimeOnDay(e, t) {
6410
- const [s, n, i] = (t ?? "00:00:00").split(":").map(Number), r = new Date(e);
6411
- return r.setHours(0, 0, 0, 0), r.setSeconds((s ?? 0) * 3600 + (n ?? 0) * 60 + (i ?? 0)), r;
6416
+ const [s, n, r] = (t ?? "00:00:00").split(":").map(Number), i = new Date(e);
6417
+ return i.setHours(0, 0, 0, 0), i.setSeconds((s ?? 0) * 3600 + (n ?? 0) * 60 + (r ?? 0)), i;
6412
6418
  }
6413
6419
  /**
6414
6420
  * Walk the timeline's RENDERED row order: visible leaf resources, then the
@@ -6421,13 +6427,13 @@ class $ extends he {
6421
6427
  * why the bucket was unreachable by keyboard.
6422
6428
  */
6423
6429
  adjacentRow(e, t, s, n) {
6424
- const i = this.navigableRows(s, n);
6425
- if (i.length === 0) return;
6426
- const r = i.indexOf(e);
6427
- if (r < 0) return i[0];
6428
- const o = r + t;
6429
- if (!(o < 0 || o >= i.length))
6430
- return i[o];
6430
+ const r = this.navigableRows(s, n);
6431
+ if (r.length === 0) return;
6432
+ const i = r.indexOf(e);
6433
+ if (i < 0) return r[0];
6434
+ const o = i + t;
6435
+ if (!(o < 0 || o >= r.length))
6436
+ return r[o];
6431
6437
  }
6432
6438
  /**
6433
6439
  * The rows a keyboard user can land on, in the order the timeline draws them.
@@ -6440,7 +6446,7 @@ class $ extends he {
6440
6446
  * group must never be offered as a destination there.
6441
6447
  */
6442
6448
  navigableRows(e, t) {
6443
- const s = O.flatten(e.resources, e.collapsedGroups).filter((n) => n.visible && (t || ie(n.item))).map((n) => n.item.id);
6449
+ const s = O.flatten(e.resources, e.collapsedGroups).filter((n) => n.visible && (t || re(n.item))).map((n) => n.item.id);
6444
6450
  return (e.eventsByResource.get(null) ?? []).length > 0 && s.push(null), s;
6445
6451
  }
6446
6452
  /**
@@ -6473,8 +6479,8 @@ class $ extends he {
6473
6479
  timeCellElement(e, t) {
6474
6480
  const s = this.shadowRoot;
6475
6481
  if (!s) return null;
6476
- const n = e.toISOString(), r = this.stateManager.getState().view === "timeline" ? t ? `.scheduler-timeline-slot[data-resource-id="${this.cssEscape(t)}"][data-start="${n}"]` : `.scheduler-timeline-slot[data-unassigned][data-start="${n}"]` : `.scheduler-time-slot[data-start="${n}"]`;
6477
- return s.querySelector(r);
6482
+ const n = e.toISOString(), i = this.stateManager.getState().view === "timeline" ? t ? `.scheduler-timeline-slot[data-resource-id="${this.cssEscape(t)}"][data-start="${n}"]` : `.scheduler-timeline-slot[data-unassigned][data-start="${n}"]` : `.scheduler-time-slot[data-start="${n}"]`;
6483
+ return s.querySelector(i);
6478
6484
  }
6479
6485
  /** Re-focus whatever cell the keyboard model currently considers focused. */
6480
6486
  /**
@@ -6493,7 +6499,7 @@ class $ extends he {
6493
6499
  */
6494
6500
  focusFocusedCell() {
6495
6501
  const e = this.stateManager.getState();
6496
- e.focusedCell && this.scrollAndFocusCell(e.focusedCell, e.focusedResourceId), !this.shadowRoot?.activeElement && this.contentContainer?.querySelector('[role="gridcell"][tabindex="0"]')?.focus();
6502
+ e.focusedCell && this.scrollAndFocusCell(e.focusedCell, e.focusedResourceId), this.shadowRoot?.activeElement?.getAttribute("role") !== "gridcell" && this.contentContainer?.querySelector('[role="gridcell"][tabindex="0"]')?.focus();
6497
6503
  }
6498
6504
  /**
6499
6505
  * Parse a `YYYY-MM-DD` day key as a LOCAL date.
@@ -6520,26 +6526,26 @@ class $ extends he {
6520
6526
  * whether/when to clear the selection.
6521
6527
  */
6522
6528
  createEventFromCellOrSelection(e) {
6523
- const t = this.stateManager.getState(), s = G(t);
6524
- let n, i, r;
6529
+ const t = this.stateManager.getState(), s = q(t);
6530
+ let n, r, i;
6525
6531
  if (s)
6526
- n = s.start, i = s.end, r = t.selectionResourceId ?? void 0;
6532
+ n = s.start, r = s.end, i = t.selectionResourceId ?? void 0;
6527
6533
  else if (t.focusedCell)
6528
- n = t.focusedCell.start, i = t.focusedCell.end, r = t.focusedResourceId ?? void 0;
6534
+ n = t.focusedCell.start, r = t.focusedCell.end, i = t.focusedResourceId ?? void 0;
6529
6535
  else
6530
6536
  return;
6531
- if (!this.can("createEvent") || !this.allowsCreateAt({ start: n, end: i }, r)) {
6537
+ if (!this.can("createEvent") || !this.allowsCreateAt({ start: n, end: r }, i)) {
6532
6538
  this.announceDenied();
6533
6539
  return;
6534
6540
  }
6535
6541
  this.eventEmitter.emitEventCreate(
6536
- { start: n, end: i },
6542
+ { start: n, end: r },
6537
6543
  t.view,
6538
6544
  e,
6539
- r
6545
+ i
6540
6546
  ), this.liveAnnouncer.announce(this.msg("selectionCommitted", {
6541
6547
  start: h.formatTime(n, t.options.timeFormat, t.options.locale),
6542
- end: h.formatTime(i, t.options.timeFormat, t.options.locale)
6548
+ end: h.formatTime(r, t.options.timeFormat, t.options.locale)
6543
6549
  }));
6544
6550
  }
6545
6551
  /**
@@ -6576,8 +6582,8 @@ class $ extends he {
6576
6582
  minutes: s
6577
6583
  })
6578
6584
  ), requestAnimationFrame(() => {
6579
- const i = `[data-event-id="${this.cssEscape(e.id)}"]`;
6580
- this.shadowRoot?.querySelector(i)?.focus({ preventScroll: !0 });
6585
+ const r = `[data-event-id="${this.cssEscape(e.id)}"]`;
6586
+ this.shadowRoot?.querySelector(r)?.focus({ preventScroll: !0 });
6581
6587
  });
6582
6588
  }
6583
6589
  /**
@@ -6599,19 +6605,19 @@ class $ extends he {
6599
6605
  e.preventDefault(), this.commitEventMoveMode();
6600
6606
  return;
6601
6607
  }
6602
- const t = this.stateManager.getState().view, s = t === "timeline", n = this.minutesPerSlot() * 60 * 1e3, i = e.shiftKey, r = e.altKey;
6608
+ const t = this.stateManager.getState().view, s = t === "timeline", n = this.minutesPerSlot() * 60 * 1e3, r = e.shiftKey, i = e.altKey;
6603
6609
  switch (e.key) {
6604
6610
  case "ArrowUp":
6605
- e.preventDefault(), s ? !i && !r && this.nudgeKeyboardMoveResource(-1) : i && r ? this.resizeKeyboardMoveEdge("start", -n) : i ? this.resizeKeyboardMoveEdge("end", -n) : this.nudgeKeyboardMove(-n);
6611
+ e.preventDefault(), s ? !r && !i && this.nudgeKeyboardMoveResource(-1) : r && i ? this.resizeKeyboardMoveEdge("start", -n) : r ? this.resizeKeyboardMoveEdge("end", -n) : this.nudgeKeyboardMove(-n);
6606
6612
  return;
6607
6613
  case "ArrowDown":
6608
- e.preventDefault(), s ? !i && !r && this.nudgeKeyboardMoveResource(1) : i && r ? this.resizeKeyboardMoveEdge("start", +n) : i ? this.resizeKeyboardMoveEdge("end", +n) : this.nudgeKeyboardMove(+n);
6614
+ e.preventDefault(), s ? !r && !i && this.nudgeKeyboardMoveResource(1) : r && i ? this.resizeKeyboardMoveEdge("start", +n) : r ? this.resizeKeyboardMoveEdge("end", +n) : this.nudgeKeyboardMove(+n);
6609
6615
  return;
6610
6616
  case "ArrowLeft":
6611
- e.preventDefault(), s ? i && r ? this.resizeKeyboardMoveEdge("start", -n) : i ? this.resizeKeyboardMoveEdge("end", -n) : this.nudgeKeyboardMove(-n) : t === "week" && (i && r ? this.resizeKeyboardMoveEdge("start", -864e5) : i ? this.resizeKeyboardMoveEdge("end", -864e5) : this.nudgeKeyboardMove(-864e5));
6617
+ e.preventDefault(), s ? r && i ? this.resizeKeyboardMoveEdge("start", -n) : r ? this.resizeKeyboardMoveEdge("end", -n) : this.nudgeKeyboardMove(-n) : t === "week" && (r && i ? this.resizeKeyboardMoveEdge("start", -864e5) : r ? this.resizeKeyboardMoveEdge("end", -864e5) : this.nudgeKeyboardMove(-864e5));
6612
6618
  return;
6613
6619
  case "ArrowRight":
6614
- e.preventDefault(), s ? i && r ? this.resizeKeyboardMoveEdge("start", +n) : i ? this.resizeKeyboardMoveEdge("end", +n) : this.nudgeKeyboardMove(+n) : t === "week" && (i && r ? this.resizeKeyboardMoveEdge("start", 864e5) : i ? this.resizeKeyboardMoveEdge("end", 864e5) : this.nudgeKeyboardMove(864e5));
6620
+ e.preventDefault(), s ? r && i ? this.resizeKeyboardMoveEdge("start", +n) : r ? this.resizeKeyboardMoveEdge("end", +n) : this.nudgeKeyboardMove(+n) : t === "week" && (r && i ? this.resizeKeyboardMoveEdge("start", 864e5) : r ? this.resizeKeyboardMoveEdge("end", 864e5) : this.nudgeKeyboardMove(864e5));
6615
6621
  return;
6616
6622
  }
6617
6623
  }
@@ -6623,7 +6629,7 @@ class $ extends he {
6623
6629
  nudgeKeyboardMove(e) {
6624
6630
  if (!this.keyboardMove) return;
6625
6631
  const t = new Date(this.keyboardMove.workingStart.getTime() + e), s = new Date(this.keyboardMove.workingEnd.getTime() + e);
6626
- this.keyboardMove.workingStart = t, this.keyboardMove.workingEnd = s, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(ke(t, s, this.stateManager.getState().options));
6632
+ this.keyboardMove.workingStart = t, this.keyboardMove.workingEnd = s, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(Se(t, s, this.stateManager.getState().options));
6627
6633
  }
6628
6634
  /** Walk to the next/previous row (timeline only). Updates the preview's resourceId. */
6629
6635
  nudgeKeyboardMoveResource(e) {
@@ -6651,11 +6657,11 @@ class $ extends he {
6651
6657
  return;
6652
6658
  }
6653
6659
  const n = this.minutesPerSlot() * 60 * 1e3;
6654
- let i = this.keyboardMove.workingStart, r = this.keyboardMove.workingEnd;
6660
+ let r = this.keyboardMove.workingStart, i = this.keyboardMove.workingEnd;
6655
6661
  if (e === "end") {
6656
- if (r = new Date(r.getTime() + t), r.getTime() - i.getTime() < n) return;
6657
- } else if (i = new Date(i.getTime() + t), r.getTime() - i.getTime() < n) return;
6658
- this.keyboardMove.workingStart = i, this.keyboardMove.workingEnd = r, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(Me(i, r, e, this.stateManager.getState().options));
6662
+ if (i = new Date(i.getTime() + t), i.getTime() - r.getTime() < n) return;
6663
+ } else if (r = new Date(r.getTime() + t), i.getTime() - r.getTime() < n) return;
6664
+ this.keyboardMove.workingStart = r, this.keyboardMove.workingEnd = i, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(ke(r, i, e, this.stateManager.getState().options));
6659
6665
  }
6660
6666
  /** Mirror keyboardMove.working* into state.previewEvent so views render the destination,
6661
6667
  * then scroll the destination into view so the sighted-keyboard user can see it (PRD D6). */
@@ -6672,9 +6678,9 @@ class $ extends he {
6672
6678
  resourceId: n
6673
6679
  }
6674
6680
  }), requestAnimationFrame(() => {
6675
- const i = this.shadowRoot;
6676
- if (!i) return;
6677
- i.querySelector(`[data-event-id="${this.cssEscape(e)}"]`)?.focus({ preventScroll: !0 });
6681
+ const r = this.shadowRoot;
6682
+ if (!r) return;
6683
+ r.querySelector(`[data-event-id="${this.cssEscape(e)}"]`)?.focus({ preventScroll: !0 });
6678
6684
  const o = this.timeCellElement(t, n);
6679
6685
  o && typeof o.scrollIntoView == "function" && o.scrollIntoView({ block: "nearest", inline: "nearest" });
6680
6686
  });
@@ -6716,9 +6722,18 @@ class $ extends he {
6716
6722
  // ============================================
6717
6723
  // Slot Resolution
6718
6724
  // ============================================
6725
+ /**
6726
+ * The one hit-test seam (PRD test-coverage P2-D4): which elements sit under a
6727
+ * viewport point, topmost first. Every pointer-to-slot resolution goes
6728
+ * through here, so a spec can answer "what is under the pointer" without
6729
+ * inventing a single rect value.
6730
+ */
6731
+ elementsAt(e, t) {
6732
+ return this.shadowRoot.elementsFromPoint(e, t);
6733
+ }
6719
6734
  getSlotAtPosition(e, t) {
6720
- const n = this.shadowRoot.elementsFromPoint(e, t).find(
6721
- (i) => i.matches(".scheduler-time-slot, .scheduler-timeline-slot")
6735
+ const n = this.elementsAt(e, t).find(
6736
+ (r) => r.matches(".scheduler-time-slot, .scheduler-timeline-slot")
6722
6737
  );
6723
6738
  return n ? this.getSlotFromElement(n) : null;
6724
6739
  }
@@ -6733,16 +6748,16 @@ class $ extends he {
6733
6748
  };
6734
6749
  }
6735
6750
  }
6736
- typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler", $);
6751
+ typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler", z);
6737
6752
  export {
6738
- K as BaseView,
6739
- Ae as DayView,
6740
- N as MonthView,
6741
- $ as MpScheduler,
6742
- De as SchedulerStateManager,
6743
- I as TimelineView,
6744
- Ie as WeekView,
6745
- U as YearView,
6746
- xe as createInitialState,
6747
- Re as schedulerStyles
6753
+ G as BaseView,
6754
+ Ie as DayView,
6755
+ W as MonthView,
6756
+ z as MpScheduler,
6757
+ xe as SchedulerStateManager,
6758
+ P as TimelineView,
6759
+ Te as WeekView,
6760
+ K as YearView,
6761
+ Ee as createInitialState,
6762
+ Fe as schedulerStyles
6748
6763
  };