@mintplayer/web-components 2.7.0 → 2.8.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.
@@ -1,16 +1,16 @@
1
- import { unsafeCSS as J, LitElement as re, html as D, nothing as T } from "lit";
2
- import { L as ne } from "../chunks/live-announcer-Bi0orG4n.mjs";
3
- import { e as ie } from "../chunks/error-text-B45eDAt1.mjs";
4
- import { D as oe, q as L, d as h, u as E, i as S, t as U, o as ae, v as K, x as C, w as R, p as G, s as Q, j as le } from "../chunks/id-BstjfRrz.mjs";
5
- import { i as de } from "../chunks/invalid-feedback.styles-he0JYrJm.mjs";
6
- import { O as Y } from "../chunks/overlay-controller-D6agzzOI.mjs";
1
+ import { unsafeCSS as ne, LitElement as he, html as S, nothing as k } from "lit";
2
+ import { L as ue } from "../chunks/live-announcer-Bi0orG4n.mjs";
3
+ import { e as pe } from "../chunks/error-text-B45eDAt1.mjs";
4
+ import { D as me, s as H, d as h, j as E, w, v as X, p as ve, x as j, z as C, y as O, r as oe, u as ie, q as ge, k as fe } from "../chunks/id-DNZVAnGC.mjs";
5
+ import { i as ye } from "../chunks/invalid-feedback.styles-he0JYrJm.mjs";
6
+ import { O as _ } from "../chunks/overlay-controller-D6agzzOI.mjs";
7
7
  import "../chunks/mp-checkbox-6EJwdUIn.mjs";
8
8
  import "../chunks/mp-select-CKX0eM5C.mjs";
9
- import "../chunks/mp-datetime-picker.element-MPTRHwyc.mjs";
10
- function ee(p, e = []) {
9
+ import "../chunks/mp-datetime-picker.element-D1CiLbHm.mjs";
10
+ function ae(p, e = []) {
11
11
  for (const t of p) {
12
- if (L(t)) {
13
- ee(t.children, e);
12
+ if (H(t)) {
13
+ ae(t.children, e);
14
14
  continue;
15
15
  }
16
16
  for (const s of t.events ?? [])
@@ -18,8 +18,8 @@ function ee(p, e = []) {
18
18
  }
19
19
  return e;
20
20
  }
21
- function X(p, e) {
22
- const t = ee(e);
21
+ function te(p, e) {
22
+ const t = ae(e);
23
23
  if (t.length === 0) return p;
24
24
  const s = /* @__PURE__ */ new Map();
25
25
  for (const n of t) s.set(n.id, n);
@@ -30,19 +30,19 @@ function X(p, e) {
30
30
  `[mp-scheduler] ${r.length} event id(s) appear in both the "events" input and under a resource; the "events" entry wins. Ids: ${r.join(", ")}`
31
31
  ), [...s.values()];
32
32
  }
33
- function ce(p, e, t) {
33
+ function be(p, e, t) {
34
34
  const s = new Set(e), r = (n) => {
35
- for (const i of n)
36
- L(i) && (t.has(i.id) || (t.add(i.id), i.collapsed && s.add(i.id)), r(i.children));
35
+ for (const o of n)
36
+ H(o) && (t.has(o.id) || (t.add(o.id), o.collapsed && s.add(o.id)), r(o.children));
37
37
  };
38
38
  return r(p), s;
39
39
  }
40
- function te(p, e = /* @__PURE__ */ new Map()) {
40
+ function le(p, e = /* @__PURE__ */ new Map()) {
41
41
  for (const t of p)
42
- L(t) ? te(t.children, e) : e.set(t.id, t);
42
+ H(t) ? le(t.children, e) : e.set(t.id, t);
43
43
  return e;
44
44
  }
45
- function he(p, e) {
45
+ function we(p, e) {
46
46
  const t = /* @__PURE__ */ new Map();
47
47
  for (const s of p) {
48
48
  const r = s.resourceId != null && e.has(s.resourceId) ? s.resourceId : null, n = t.get(r);
@@ -50,8 +50,8 @@ function he(p, e) {
50
50
  }
51
51
  return t;
52
52
  }
53
- function ue(p = {}) {
54
- const e = { ...oe, ...p };
53
+ function Ee(p = {}) {
54
+ const e = { ...me, ...p };
55
55
  return {
56
56
  view: e.initialView,
57
57
  date: e.initialDate,
@@ -78,9 +78,9 @@ function ue(p = {}) {
78
78
  focusedDate: null
79
79
  };
80
80
  }
81
- class pe {
81
+ class xe {
82
82
  constructor(e = {}) {
83
- this.listeners = /* @__PURE__ */ new Set(), this.warnedUnassignedIds = /* @__PURE__ */ new Set(), this.warnedDanglingIds = /* @__PURE__ */ new Set(), this.flatEventsInput = [], this.seededGroupIds = /* @__PURE__ */ new Set(), this.state = ue(e);
83
+ 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);
84
84
  }
85
85
  /**
86
86
  * Get current state
@@ -93,7 +93,7 @@ class pe {
93
93
  */
94
94
  setState(e) {
95
95
  const t = typeof e == "function" ? e(this.state) : e, s = { ...this.state, ...t }, r = s.resources !== this.state.resources || !this.state.resourceById;
96
- r && (s.resourceById = te(s.resources)), (s.events !== this.state.events || r || !this.state.eventsByResource) && (s.eventsByResource = he(s.events, s.resourceById)), this.state = s, this.warnUnassignedEvents(), this.warnDanglingEvents(), this.notifyListeners();
96
+ r && (s.resourceById = le(s.resources)), (s.events !== this.state.events || r || !this.state.eventsByResource) && (s.eventsByResource = we(s.events, s.resourceById)), this.state = s, this.warnUnassignedEvents(), this.warnDanglingEvents(), this.notifyListeners();
97
97
  }
98
98
  /**
99
99
  * `options.requireEventResource` is a DEVELOPMENT signal, not a filter: the
@@ -164,7 +164,7 @@ class pe {
164
164
  */
165
165
  setEvents(e) {
166
166
  this.flatEventsInput = e, this.setState((t) => ({
167
- events: X(e, t.resources)
167
+ events: te(e, t.resources)
168
168
  }));
169
169
  }
170
170
  /**
@@ -210,8 +210,8 @@ class pe {
210
210
  setResources(e) {
211
211
  this.setState((t) => ({
212
212
  resources: e,
213
- events: X(this.flatEventsInput, e),
214
- collapsedGroups: ce(
213
+ events: te(this.flatEventsInput, e),
214
+ collapsedGroups: be(
215
215
  e,
216
216
  t.collapsedGroups,
217
217
  this.seededGroupIds
@@ -404,11 +404,16 @@ class pe {
404
404
  this.setState({ focusedDate: e });
405
405
  }
406
406
  }
407
- function $(p, e, t) {
408
- const s = t.timeFormat ?? "24h", r = h.formatTime(p.start, s), n = h.formatTime(p.end, s), i = p.start.toLocaleDateString(t.locale, { weekday: "long", month: "short", day: "numeric" }), o = [`${p.title}, ${r}–${n}`, i];
409
- return e && o.push(S(E(t.messages).eventOnResource, { resource: e })), o.join(", ");
407
+ function de(p) {
408
+ return `${p.getFullYear()}-${String(p.getMonth() + 1).padStart(2, "0")}-${String(
409
+ p.getDate()
410
+ ).padStart(2, "0")}`;
410
411
  }
411
- function W(p) {
412
+ function W(p, e, t) {
413
+ const s = t.timeFormat, r = h.formatTime(p.start, s, t.locale), n = h.formatTime(p.end, s, t.locale), o = p.start.toLocaleDateString(t.locale, { weekday: "long", month: "short", day: "numeric" }), i = [`${p.title}, ${r}–${n}`, o];
414
+ return e && i.push(E(w(t.messages).eventOnResource, { resource: e })), i.join(", ");
415
+ }
416
+ function G(p) {
412
417
  const { selectionAnchor: e, selectionExtent: t, selectionResourceId: s } = p;
413
418
  if (!e || !t) return null;
414
419
  const r = Math.min(e.start.getTime(), t.start.getTime()), n = Math.max(e.end.getTime(), t.end.getTime());
@@ -418,53 +423,68 @@ function W(p) {
418
423
  resourceId: s
419
424
  };
420
425
  }
421
- function V(p, e, t = null) {
422
- const s = W(e);
426
+ function Z(p, e, t = null) {
427
+ const s = G(e);
423
428
  return !s || s.resourceId && t && s.resourceId !== t ? !1 : p.start.getTime() < s.end.getTime() && p.end.getTime() > s.start.getTime();
424
429
  }
425
- function ve(p, e, t = null) {
430
+ function q(p, e, t = null) {
426
431
  const s = p.start.toLocaleDateString(e.locale, {
427
432
  weekday: "long",
428
433
  month: "short",
429
434
  day: "numeric"
430
- }), r = h.formatTime(p.start, e.timeFormat ?? "24h"), n = [`${s}, ${r}`];
435
+ }), r = h.formatTime(p.start, e.timeFormat, e.locale), n = [`${s}, ${r}`];
431
436
  return t && n.push(t), n.join(", ");
432
437
  }
433
- function me(p, e) {
434
- const t = W(p);
438
+ function De(p, e) {
439
+ const t = G(p);
435
440
  if (!t) return "";
436
- const { options: s } = p, r = s.timeFormat ?? "24h", n = { weekday: "short", month: "short", day: "numeric" }, i = `${h.formatTime(t.start, r)} ${t.start.toLocaleDateString(s.locale, n)}`, o = `${h.formatTime(t.end, r)} ${t.end.toLocaleDateString(s.locale, n)}`, a = e * 1e3, l = Math.max(1, Math.round((t.end.getTime() - t.start.getTime()) / a)), d = E(s.messages);
437
- return S(d.selection, {
438
- start: i,
439
- end: o,
441
+ const { options: s } = p, r = s.timeFormat, n = { weekday: "short", month: "short", day: "numeric" }, o = `${h.formatTime(t.start, r, s.locale)} ${t.start.toLocaleDateString(s.locale, n)}`, i = `${h.formatTime(t.end, r, s.locale)} ${t.end.toLocaleDateString(s.locale, n)}`, a = e * 1e3, l = Math.max(1, Math.round((t.end.getTime() - t.start.getTime()) / a)), d = w(s.messages);
442
+ return E(d.selection, {
443
+ start: o,
444
+ end: i,
440
445
  count: l,
441
446
  slots: l === 1 ? d.slotSingular : d.slotPlural
442
447
  });
443
448
  }
444
- function ge(p, e, t) {
445
- const s = t.timeFormat ?? "24h", r = p.toLocaleDateString(t.locale, { weekday: "short", month: "short", day: "numeric" });
446
- return S(E(t.messages).movedTo, {
447
- start: h.formatTime(p, s),
448
- end: h.formatTime(e, s),
449
+ function Se(p, e, t) {
450
+ const s = t.timeFormat, r = p.toLocaleDateString(t.locale, { weekday: "short", month: "short", day: "numeric" });
451
+ return E(w(t.messages).movedTo, {
452
+ start: h.formatTime(p, s, t.locale),
453
+ end: h.formatTime(e, s, t.locale),
449
454
  day: r
450
455
  });
451
456
  }
452
- function fe(p, e, t, s) {
453
- const r = s.timeFormat ?? "24h", n = E(s.messages);
454
- return S(n.resizedEdge, {
457
+ function ke(p, e, t, s) {
458
+ const r = s.timeFormat, n = w(s.messages);
459
+ return E(n.resizedEdge, {
455
460
  edge: t === "start" ? n.startEdge : n.endEdge,
456
- start: h.formatTime(p, r),
457
- end: h.formatTime(e, r)
461
+ start: h.formatTime(p, r, s.locale),
462
+ end: h.formatTime(e, r, s.locale)
458
463
  });
459
464
  }
460
- const ye = 40, be = 20;
461
- function j(p, e) {
465
+ const Me = 40, Ce = 20;
466
+ function se(p, e) {
462
467
  const [t = 0, s = 0, r = 0] = e.split(":").map(Number), n = new Date(p);
463
468
  return n.setHours(0, 0, 0, 0), n.setSeconds(t * 3600 + s * 60 + r), n;
464
469
  }
465
- class B {
470
+ class K {
466
471
  constructor(e, t) {
467
- this.container = e, this.state = t;
472
+ this.pendingScroll = null, this.container = e, this.state = t;
473
+ }
474
+ /**
475
+ * The week's first day for the current options — the consumer's choice if they
476
+ * made one, otherwise the locale's own convention (Sunday for en-US and ja-JP,
477
+ * Monday across most of Europe).
478
+ *
479
+ * Resolved at the point of use rather than written back into `options`:
480
+ * `setOptions` merges cumulatively, so a stored derivation would freeze at the
481
+ * locale that produced it and quietly ignore a later locale change.
482
+ */
483
+ get firstDayOfWeek() {
484
+ return h.resolveFirstDayOfWeek(
485
+ this.state.options.firstDayOfWeek,
486
+ this.state.options.locale
487
+ );
468
488
  }
469
489
  /**
470
490
  * Update the now indicator position (called every minute)
@@ -506,20 +526,20 @@ class B {
506
526
  * `Resource.color`/`eventColor` sat in the model unread.
507
527
  */
508
528
  applyEventColors(e, t) {
509
- const s = U(
529
+ const s = X(
510
530
  t,
511
531
  this.state.resourceById,
512
532
  this.state.options.defaultEventColor
513
533
  );
514
- e.style.backgroundColor = s, e.style.color = t.textColor ?? ae(s);
534
+ e.style.backgroundColor = s, e.style.color = t.textColor ?? ve(s);
515
535
  }
516
536
  partGeometry(e, t, s) {
517
- const r = s.slotDuration ?? 1800, n = j(e, s.slotMinTime ?? "00:00:00"), i = j(e, s.slotMaxTime ?? "24:00:00"), o = Math.max(e.getTime(), n.getTime()), a = Math.min(t.getTime(), i.getTime());
518
- if (a <= o) return null;
519
- const l = ye / (r * 1e3);
537
+ const r = s.slotDuration ?? 1800, n = se(e, s.slotMinTime ?? "00:00:00"), o = se(e, s.slotMaxTime ?? "24:00:00"), i = Math.max(e.getTime(), n.getTime()), a = Math.min(t.getTime(), o.getTime());
538
+ if (a <= i) return null;
539
+ const l = Me / (r * 1e3);
520
540
  return {
521
- top: (o - n.getTime()) * l,
522
- height: Math.max((a - o) * l, be)
541
+ top: (i - n.getTime()) * l,
542
+ height: Math.max((a - i) * l, Ce)
523
543
  };
524
544
  }
525
545
  createElement(e, ...t) {
@@ -533,19 +553,23 @@ class B {
533
553
  for (const [s, r] of Object.entries(t))
534
554
  e.dataset[s] = String(r);
535
555
  }
536
- /**
537
- * Helper to clear container
538
- */
539
556
  clearContainer() {
540
- this.container.innerHTML = "";
541
- for (const e of [
557
+ const e = !this.pendingScroll && (this.container.scrollLeft || this.container.scrollTop);
558
+ if (e && (this.pendingScroll = { left: this.container.scrollLeft, top: this.container.scrollTop }), this.container.innerHTML = "", e) {
559
+ const t = { left: this.container.scrollLeft, top: this.container.scrollTop };
560
+ queueMicrotask(() => {
561
+ const s = this.pendingScroll;
562
+ this.pendingScroll = null, s && (this.container.scrollLeft !== t.left || this.container.scrollTop !== t.top || (this.container.scrollLeft = s.left, this.container.scrollTop = s.top));
563
+ });
564
+ }
565
+ for (const t of [
542
566
  "role",
543
567
  "aria-label",
544
568
  "aria-describedby",
545
569
  "aria-multiselectable",
546
570
  "aria-rowcount"
547
571
  ])
548
- this.container.removeAttribute(e);
572
+ this.container.removeAttribute(t);
549
573
  this.container.classList.remove(
550
574
  "scheduler-week-view",
551
575
  "scheduler-day-view",
@@ -565,7 +589,7 @@ class B {
565
589
  */
566
590
  appendResizeHandles(e, t, [s, r] = ["top", "bottom"]) {
567
591
  const n = this.state.resolvedPermissions;
568
- t.isStart && K("start", { permissions: n, event: t.event }) && e.appendChild(this.createResizeHandle(s, "start")), t.isEnd && K("end", { permissions: n, event: t.event }) && e.appendChild(this.createResizeHandle(r, "end"));
592
+ t.isStart && j("start", { permissions: n, event: t.event }) && e.appendChild(this.createResizeHandle(s, "start")), t.isEnd && j("end", { permissions: n, event: t.event }) && e.appendChild(this.createResizeHandle(r, "end"));
569
593
  }
570
594
  createResizeHandle(e, t) {
571
595
  const s = this.createElement("div", "resize-handle", e);
@@ -587,18 +611,22 @@ class B {
587
611
  */
588
612
  applyGridRoles(e) {
589
613
  const t = this.container;
590
- t.getAttribute("role") !== "grid" && t.setAttribute("role", "grid"), t.setAttribute("aria-describedby", "scheduler-kbd-grid"), e.multiselectable && t.setAttribute("aria-multiselectable", "true");
591
- const s = (r, n) => t.querySelectorAll(r).forEach((i) => {
592
- i.hasAttribute("role") || i.setAttribute("role", n);
614
+ t.getAttribute("role") !== "grid" && t.setAttribute("role", "grid");
615
+ const r = this.container.getRootNode().host?.getAttribute(
616
+ "aria-label"
617
+ ) || e.label;
618
+ r && t.setAttribute("aria-label", r), t.setAttribute("aria-describedby", "scheduler-kbd-grid"), e.multiselectable && t.setAttribute("aria-multiselectable", "true");
619
+ const n = (o, i) => t.querySelectorAll(o).forEach((a) => {
620
+ a.hasAttribute("role") || a.setAttribute("role", i);
593
621
  });
594
- e.columnHeaderRow && s(e.columnHeaderRow, "row"), e.columnHeaders && s(e.columnHeaders, "columnheader"), (e.presentation ?? []).forEach((r) => s(r, "presentation")), e.rows && s(e.rows, "row"), e.cells && s(e.cells, "gridcell");
622
+ e.columnHeaderRow && n(e.columnHeaderRow, "row"), e.columnHeaders && n(e.columnHeaders, "columnheader"), (e.presentation ?? []).forEach((o) => n(o, "presentation")), e.rows && n(e.rows, "row"), e.cells && n(e.cells, "gridcell");
595
623
  }
596
624
  /** aria-current="date" on every element the views styled `.today`. */
597
625
  markToday() {
598
626
  this.container.querySelectorAll(".today").forEach((e) => e.setAttribute("aria-current", "date"));
599
627
  }
600
628
  }
601
- class N extends B {
629
+ class U extends K {
602
630
  constructor() {
603
631
  super(...arguments), this.monthCards = /* @__PURE__ */ new Map();
604
632
  }
@@ -607,10 +635,15 @@ class N extends B {
607
635
  const { date: e, options: t } = this.state, s = h.getYearMonths(e), r = this.createElement("div", "scheduler-year-grid");
608
636
  this.monthCards.clear();
609
637
  for (const n of s) {
610
- const i = this.createMonthCard(n);
611
- r.appendChild(i);
638
+ const o = this.createMonthCard(n);
639
+ r.appendChild(o);
612
640
  }
613
- this.container.appendChild(r), this.applyGridRoles({ rows: ".scheduler-year-grid" }), this.markToday(), this.updateMonthCardFocus();
641
+ this.container.appendChild(r), this.applyGridRoles({
642
+ label: E(w(this.state.options.messages).yearGridLabel, {
643
+ date: String(this.state.date.getFullYear())
644
+ }),
645
+ rows: ".scheduler-year-grid"
646
+ }), this.markToday(), this.updateMonthCardFocus();
614
647
  }
615
648
  /**
616
649
  * Build a `YYYY-MM` key from a Date, which is the unit of focus on year
@@ -623,38 +656,38 @@ class N extends B {
623
656
  return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
624
657
  }
625
658
  createMonthCard(e) {
626
- const { events: t, options: s } = this.state, r = this.createElement("div", "scheduler-year-month"), n = N.monthKey(e);
659
+ const { events: t, options: s } = this.state, r = this.createElement("div", "scheduler-year-month"), n = U.monthKey(e);
627
660
  r.setAttribute("role", "gridcell"), r.setAttribute("tabindex", "-1"), r.id = `scheduler-cell-y-${n}`, this.setData(r, { month: e.toISOString() }), this.monthCards.set(n, r);
628
- const i = this.createElement("div", "scheduler-year-month-header");
629
- i.textContent = h.getMonthName(e, s.locale), i.setAttribute("role", "button"), i.setAttribute("tabindex", "0"), this.setData(i, { month: e.toISOString() }), r.appendChild(i);
630
- const o = this.createElement("div", "scheduler-mini-month"), a = h.getMonthWeeks(e, s.firstDayOfWeek), l = a[0];
661
+ const o = this.createElement("div", "scheduler-year-month-header");
662
+ o.textContent = h.getMonthName(e, s.locale), o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), this.setData(o, { month: e.toISOString() }), r.appendChild(o);
663
+ const i = this.createElement("div", "scheduler-mini-month"), a = h.getMonthWeeks(e, this.firstDayOfWeek), l = a[0];
631
664
  for (const f of l) {
632
- const v = this.createElement("div", "scheduler-mini-day", "header");
633
- v.textContent = h.getDayName(f, s.locale, "narrow"), v.style.fontWeight = "600", v.style.color = "#666", o.appendChild(v);
665
+ const m = this.createElement("div", "scheduler-mini-day", "header");
666
+ m.textContent = h.getDayName(f, s.locale, "narrow"), m.style.fontWeight = "600", m.style.color = "#666", i.appendChild(m);
634
667
  }
635
- const d = h.getMonthStart(e), c = h.getMonthEnd(e), u = C.filterByRange(t, d, c), m = E(s.messages);
668
+ const d = h.getMonthStart(e), c = h.getMonthEnd(e), u = C.filterByRange(t, d, c), v = w(s.messages);
636
669
  r.setAttribute(
637
670
  "aria-label",
638
- S(m.yearMonthCardLabel, {
671
+ E(v.yearMonthCardLabel, {
639
672
  month: `${h.getMonthName(e, s.locale)} ${e.getFullYear()}`,
640
673
  count: u.length,
641
- events: u.length === 1 ? m.eventSingular : m.eventPlural
674
+ events: u.length === 1 ? v.eventSingular : v.eventPlural
642
675
  })
643
676
  );
644
677
  const g = /* @__PURE__ */ new Set();
645
678
  for (const f of u) {
646
- const v = new Date(f.start);
647
- for (v.setHours(0, 0, 0, 0); v <= f.end; )
648
- g.add(v.toISOString().split("T")[0]), v.setDate(v.getDate() + 1);
679
+ const m = new Date(f.start);
680
+ for (m.setHours(0, 0, 0, 0); m <= f.end; )
681
+ g.add(m.toISOString().split("T")[0]), m.setDate(m.getDate() + 1);
649
682
  }
650
683
  for (const f of a)
651
- for (const v of f) {
684
+ for (const m of f) {
652
685
  const y = this.createElement("div", "scheduler-mini-day");
653
- y.textContent = String(v.getDate()), this.setData(y, { date: v.toISOString() }), h.isSameMonth(v, e) || y.classList.add("other-month"), h.isToday(v) && y.classList.add("today");
654
- const w = v.toISOString().split("T")[0];
655
- g.has(w) && y.classList.add("has-events"), o.appendChild(y);
686
+ y.textContent = String(m.getDate()), this.setData(y, { date: m.toISOString() }), h.isSameMonth(m, e) || y.classList.add("other-month"), h.isToday(m) && y.classList.add("today");
687
+ const b = m.toISOString().split("T")[0];
688
+ g.has(b) && y.classList.add("has-events"), i.appendChild(y);
656
689
  }
657
- return r.appendChild(o), r;
690
+ return r.appendChild(i), r;
658
691
  }
659
692
  /**
660
693
  * Apply roving tabindex based on `state.focusedDate`'s month. Year-view's
@@ -664,47 +697,62 @@ class N extends B {
664
697
  updateMonthCardFocus() {
665
698
  const e = this.state.focusedDate;
666
699
  let t = !1;
667
- const s = e ? N.monthKey(e) : null;
700
+ const s = e ? U.monthKey(e) : null;
668
701
  for (const [r, n] of this.monthCards) {
669
- const i = r === s;
670
- n.setAttribute("tabindex", i ? "0" : "-1"), n.removeAttribute("aria-selected"), i && (t = !0);
702
+ const o = r === s;
703
+ n.setAttribute("tabindex", o ? "0" : "-1"), n.removeAttribute("aria-selected"), o && (t = !0);
671
704
  }
672
705
  t || this.monthCards.values().next().value?.setAttribute("tabindex", "0");
673
706
  }
674
707
  update(e) {
675
- const t = this.state.date.getFullYear() !== e.date.getFullYear();
676
- if (this.state = e, t) {
708
+ const t = this.state.date.getFullYear() !== e.date.getFullYear(), s = this.optionsRequireRerender(this.state.options, e.options);
709
+ if (this.state = e, t || s) {
677
710
  this.render();
678
711
  return;
679
712
  }
680
713
  this.updateMonthCardFocus();
681
714
  }
715
+ /**
716
+ * The check the other three views already had, and this one did not: without it
717
+ * a runtime `locale` or `firstDayOfWeek` change left all twelve mini-calendars
718
+ * frozen at the previous locale, so a language switch appeared to do nothing
719
+ * while the year view was showing.
720
+ */
721
+ optionsRequireRerender(e, t) {
722
+ return e.firstDayOfWeek !== t.firstDayOfWeek || e.locale !== t.locale;
723
+ }
682
724
  destroy() {
683
725
  this.monthCards.clear(), this.clearContainer();
684
726
  }
685
727
  }
686
- class z extends B {
728
+ class N extends K {
687
729
  constructor() {
688
730
  super(...arguments), this.dayCells = /* @__PURE__ */ new Map();
689
731
  }
690
732
  render() {
691
733
  this.clearContainer(), this.container.classList.add("scheduler-month-view");
692
- const { date: e, options: t } = this.state, s = h.getMonthWeeks(e, t.firstDayOfWeek), r = this.createElement("div", "scheduler-day-headers"), n = s[0];
693
- for (const o of n) {
734
+ const { date: e, options: t } = this.state, s = h.getMonthWeeks(e, this.firstDayOfWeek), r = this.createElement("div", "scheduler-day-headers"), n = s[0];
735
+ for (const i of n) {
694
736
  const a = this.createElement("div", "scheduler-day-header");
695
- a.textContent = h.getDayName(o, t.locale), r.appendChild(a);
737
+ a.textContent = h.getDayName(i, t.locale), r.appendChild(a);
696
738
  }
697
739
  this.container.appendChild(r);
698
- const i = this.createElement("div", "scheduler-month-grid");
699
- for (const o of s) {
740
+ const o = this.createElement("div", "scheduler-month-grid");
741
+ for (const i of s) {
700
742
  const a = this.createElement("div", "scheduler-month-week");
701
- for (const l of o) {
743
+ for (const l of i) {
702
744
  const d = this.createDayCell(l);
703
745
  a.appendChild(d);
704
746
  }
705
- i.appendChild(a);
747
+ o.appendChild(a);
706
748
  }
707
- this.container.appendChild(i), this.renderEvents(), this.updateDayCellFocus(), this.applyGridRoles({
749
+ this.container.appendChild(o), this.renderEvents(), this.updateDayCellFocus(), this.applyGridRoles({
750
+ label: E(w(this.state.options.messages).monthGridLabel, {
751
+ date: h.formatDate(this.state.date, this.state.options.locale, {
752
+ month: "long",
753
+ year: "numeric"
754
+ })
755
+ }),
708
756
  columnHeaderRow: ":scope > .scheduler-day-headers",
709
757
  columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
710
758
  presentation: [".scheduler-month-grid"],
@@ -718,17 +766,17 @@ class z extends B {
718
766
  * cell IDs would not match the visible day numbers.
719
767
  */
720
768
  static dayKey(e) {
721
- return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
769
+ return de(e);
722
770
  }
723
771
  createDayCell(e) {
724
772
  const { date: t } = this.state, s = this.createElement("div", "scheduler-month-day");
725
773
  h.isSameMonth(e, t) || s.classList.add("other-month"), h.isToday(e) && s.classList.add("today");
726
- const r = z.dayKey(e);
774
+ const r = N.dayKey(e);
727
775
  s.setAttribute("role", "gridcell"), s.setAttribute("tabindex", "-1"), s.id = `scheduler-cell-m-${r}`;
728
776
  const n = this.createElement("div", "day-number");
729
777
  n.textContent = String(e.getDate()), s.appendChild(n);
730
- const i = this.createElement("div", "month-events");
731
- return s.appendChild(i), this.dayCells.set(r, s), this.setData(s, { date: r }), s;
778
+ const o = this.createElement("div", "month-events");
779
+ return s.appendChild(o), this.dayCells.set(r, s), this.setData(s, { date: r }), s;
732
780
  }
733
781
  /**
734
782
  * Apply roving tabindex based on `state.focusedDate`. The grid must always
@@ -738,44 +786,47 @@ class z extends B {
738
786
  updateDayCellFocus() {
739
787
  const e = this.state.focusedDate;
740
788
  let t = !1;
741
- const s = e ? z.dayKey(e) : null;
789
+ const s = e ? N.dayKey(e) : null;
742
790
  for (const [r, n] of this.dayCells) {
743
- const i = r === s;
744
- n.setAttribute("tabindex", i ? "0" : "-1"), n.removeAttribute("aria-selected"), i && (t = !0);
791
+ const o = r === s;
792
+ n.setAttribute("tabindex", o ? "0" : "-1"), n.removeAttribute("aria-selected"), o && (t = !0);
745
793
  }
746
794
  t || (Array.from(this.dayCells.values()).find((n) => n.classList.contains("today") && !n.classList.contains("other-month")) || Array.from(this.dayCells.values()).find((n) => !n.classList.contains("other-month")) || this.dayCells.values().next().value)?.setAttribute("tabindex", "0");
747
795
  }
748
796
  renderEvents() {
749
797
  const { date: e, events: t, options: s } = this.state;
750
798
  h.getMonthStart(e), h.getMonthEnd(e);
751
- const r = h.getMonthWeeks(e, s.firstDayOfWeek), n = r[0][0], i = r[r.length - 1][6];
752
- i.setHours(23, 59, 59, 999);
753
- const o = C.filterByRange(t, n, i), a = /* @__PURE__ */ new Map();
754
- for (const d of o) {
755
- const c = new Date(d.start), u = new Date(d.end), m = new Date(c);
756
- for (m.setHours(0, 0, 0, 0); m <= u; ) {
757
- const g = z.dayKey(m);
758
- a.has(g) || a.set(g, []), a.get(g).push(d), m.setDate(m.getDate() + 1);
799
+ const r = h.getMonthWeeks(e, this.firstDayOfWeek), n = r[0][0], o = r[r.length - 1][6];
800
+ o.setHours(23, 59, 59, 999);
801
+ const i = C.filterByRange(t, n, o), a = /* @__PURE__ */ new Map();
802
+ for (const d of i) {
803
+ const c = new Date(d.start), u = new Date(d.end), v = new Date(c);
804
+ for (v.setHours(0, 0, 0, 0); v <= u; ) {
805
+ const g = N.dayKey(v);
806
+ a.has(g) || a.set(g, []), a.get(g).push(d), v.setDate(v.getDate() + 1);
759
807
  }
760
808
  }
761
809
  const l = typeof s.dayMaxEvents == "number" ? s.dayMaxEvents : s.dayMaxEvents === !1 ? Number.POSITIVE_INFINITY : 3;
762
810
  for (const [d, c] of a) {
763
811
  const u = this.dayCells.get(d);
764
812
  if (!u) continue;
765
- const m = u.querySelector(".month-events");
766
- if (!m) continue;
767
- m.innerHTML = "";
813
+ const v = u.querySelector(".month-events");
814
+ if (!v) continue;
815
+ v.innerHTML = "";
768
816
  const g = c.slice(0, l), f = c.length - g.length;
769
- for (const v of g) {
817
+ for (const m of g) {
770
818
  const y = this.createElement("div", "scheduler-month-event");
771
- y.textContent = v.title, this.applyEventColors(y, v), y.setAttribute("role", "button"), y.setAttribute("tabindex", "0"), y.setAttribute("aria-label", $(v, null, this.state.options)), this.setData(y, { eventId: v.id }), m.appendChild(y);
819
+ y.textContent = m.title, this.applyEventColors(y, m), y.setAttribute("role", "button"), y.setAttribute("tabindex", "0"), y.setAttribute("aria-label", W(m, null, this.state.options)), y.setAttribute(
820
+ "aria-pressed",
821
+ String(this.state.selectedEvent?.id === m.id)
822
+ ), y.setAttribute("aria-describedby", "scheduler-kbd-event"), this.setData(y, { eventId: m.id }), v.appendChild(y);
772
823
  }
773
824
  if (f > 0) {
774
- const v = this.createElement("div", "scheduler-more-link");
775
- v.textContent = S(
776
- E(this.state.options.messages).moreEvents,
825
+ const m = this.createElement("div", "scheduler-more-link");
826
+ m.textContent = E(
827
+ w(this.state.options.messages).moreEvents,
777
828
  { count: f }
778
- ), v.setAttribute("role", "button"), v.setAttribute("tabindex", "0"), this.setData(v, { date: d }), m.appendChild(v);
829
+ ), m.setAttribute("role", "button"), m.setAttribute("tabindex", "0"), this.setData(m, { date: d }), v.appendChild(m);
779
830
  }
780
831
  }
781
832
  }
@@ -794,32 +845,37 @@ class z extends B {
794
845
  this.dayCells.clear(), this.clearContainer();
795
846
  }
796
847
  }
797
- function Z(p, e) {
848
+ function re(p, e) {
798
849
  const t = new Date(p.start);
799
850
  t.setHours(0, 0, 0, 0);
800
851
  const s = p.start.getTime() - t.getTime(), r = p.end.getTime() - p.start.getTime(), n = new Date(e);
801
852
  n.setHours(0, 0, 0, 0);
802
- const i = n.getTime() + s;
803
- return { start: new Date(i), end: new Date(i + r) };
853
+ const o = n.getTime() + s;
854
+ return { start: new Date(o), end: new Date(o + r) };
804
855
  }
805
- class we extends B {
856
+ class Te extends K {
806
857
  constructor() {
807
858
  super(...arguments), this.dayColumns = [], this.eventElements = /* @__PURE__ */ new Map(), this.slotElements = /* @__PURE__ */ new Map();
808
859
  }
809
860
  render() {
810
861
  this.clearContainer(), this.container.classList.add("scheduler-week-view");
811
- const { date: e, options: t } = this.state, s = h.getWeekDays(e, t.firstDayOfWeek), r = this.createElement("div", "scheduler-day-headers"), n = this.createElement("div", "scheduler-time-gutter-space");
862
+ const { date: e, options: t } = this.state, s = h.getWeekDays(e, this.firstDayOfWeek), r = this.createElement("div", "scheduler-day-headers"), n = this.createElement("div", "scheduler-time-gutter-space");
812
863
  n.style.width = "var(--scheduler-time-gutter-width)", r.appendChild(n);
813
864
  for (const d of s) {
814
865
  const c = this.createElement("div", "scheduler-day-header");
815
866
  h.isToday(d) && c.classList.add("today");
816
867
  const u = this.createElement("div", "day-name");
817
868
  u.textContent = h.getDayName(d, t.locale);
818
- const m = this.createElement("div", "day-number");
819
- m.textContent = String(d.getDate()), c.appendChild(u), c.appendChild(m), r.appendChild(c);
869
+ const v = this.createElement("div", "day-number");
870
+ v.textContent = String(d.getDate()), v.setAttribute("role", "button"), v.setAttribute("tabindex", "0"), v.setAttribute(
871
+ "aria-label",
872
+ E(w(t.messages).openDayView, {
873
+ date: h.formatDateWithWeekday(d, t.locale)
874
+ })
875
+ ), this.setData(v, { date: de(d) }), c.appendChild(u), c.appendChild(v), r.appendChild(c);
820
876
  }
821
877
  this.container.appendChild(r);
822
- const i = this.createElement("div", "scheduler-time-grid"), o = this.createElement("div", "scheduler-time-gutter"), a = h.getTimeSlots(
878
+ const o = this.createElement("div", "scheduler-time-grid"), i = this.createElement("div", "scheduler-time-gutter"), a = h.getTimeSlots(
823
879
  s[0],
824
880
  t.slotDuration,
825
881
  t.slotMinTime,
@@ -827,29 +883,41 @@ class we extends B {
827
883
  );
828
884
  for (const d of a) {
829
885
  const c = this.createElement("div", "scheduler-time-slot-label");
830
- c.textContent = h.formatTime(d.start, t.timeFormat), o.appendChild(c);
886
+ c.textContent = h.formatTime(d.start, t.timeFormat, t.locale), i.appendChild(c);
831
887
  }
832
- i.appendChild(o);
888
+ o.appendChild(i);
833
889
  const l = this.createElement("div", "scheduler-days-container");
834
890
  this.dayColumns = [];
835
891
  for (let d = 0; d < s.length; d++) {
836
892
  const c = s[d], u = this.createElement("div", "scheduler-day-column");
837
- this.setData(u, { dayIndex: d });
893
+ this.setData(u, { dayIndex: d }), u.setAttribute(
894
+ "aria-label",
895
+ h.formatDateWithWeekday(c, t.locale)
896
+ ), u.setAttribute("aria-rowindex", String(d + 2));
838
897
  for (let g = 0; g < a.length; g++) {
839
- const f = a[g], { start: v, end: y } = Z(f, c), w = this.createElement("div", "scheduler-time-slot");
840
- w.setAttribute("role", "gridcell"), w.setAttribute("tabindex", "-1"), w.setAttribute("aria-selected", "false"), w.id = `scheduler-cell-w-${d}-${g}`, this.setData(w, {
898
+ const f = a[g], { start: m, end: y } = re(f, c), b = this.createElement("div", "scheduler-time-slot");
899
+ b.setAttribute("role", "gridcell"), b.setAttribute("tabindex", "-1"), b.setAttribute("aria-selected", "false"), b.setAttribute(
900
+ "aria-label",
901
+ q({ start: m }, t)
902
+ ), b.setAttribute("aria-colindex", String(g + 2)), b.id = `scheduler-cell-w-${d}-${g}`, this.setData(b, {
841
903
  dayIndex: d,
842
904
  slotIndex: g,
843
- start: v.toISOString(),
905
+ start: m.toISOString(),
844
906
  end: y.toISOString()
845
907
  });
846
- const x = `${d}-${g}`;
847
- this.slotElements.set(x, w), u.appendChild(w);
908
+ const M = `${d}-${g}`;
909
+ this.slotElements.set(M, b), u.appendChild(b);
848
910
  }
849
- const m = this.createElement("div", "scheduler-events-container");
850
- u.appendChild(m), this.dayColumns.push(u), l.appendChild(u);
911
+ const v = this.createElement("div", "scheduler-events-container");
912
+ u.appendChild(v), this.dayColumns.push(u), l.appendChild(u);
851
913
  }
852
- i.appendChild(l), this.container.appendChild(i), this.renderEvents(), this.updateCellFocusAndSelection(), this.renderNowIndicator(s, a), this.applyGridRoles({
914
+ o.appendChild(l), this.container.appendChild(o), this.renderEvents(), this.updateCellFocusAndSelection(), this.renderNowIndicator(s, a), this.applyGridRoles({
915
+ label: E(w(this.state.options.messages).weekGridLabel, {
916
+ date: h.formatDateWithWeekday(
917
+ h.getWeekStart(this.state.date, this.firstDayOfWeek),
918
+ this.state.options.locale
919
+ )
920
+ }),
853
921
  multiselectable: !0,
854
922
  columnHeaderRow: ":scope > .scheduler-day-headers",
855
923
  columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
@@ -888,11 +956,11 @@ class we extends B {
888
956
  let t = !1, s = null;
889
957
  for (const [, r] of this.slotElements) {
890
958
  s || (s = r);
891
- const n = r.dataset.start, i = r.dataset.end;
892
- if (!n || !i) continue;
893
- const o = { start: new Date(n), end: new Date(i) }, a = !!e && o.start.getTime() === e.start.getTime();
959
+ const n = r.dataset.start, o = r.dataset.end;
960
+ if (!n || !o) continue;
961
+ const i = { start: new Date(n), end: new Date(o) }, a = !!e && i.start.getTime() === e.start.getTime();
894
962
  r.setAttribute("tabindex", a ? "0" : "-1");
895
- const l = V(o, this.state, null);
963
+ const l = Z(i, this.state, null);
896
964
  r.setAttribute("aria-selected", l ? "true" : "false"), r.classList.toggle("selected", l), a && (t = !0);
897
965
  }
898
966
  !t && s && s.setAttribute("tabindex", "0");
@@ -901,46 +969,51 @@ class we extends B {
901
969
  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;
902
970
  }
903
971
  renderEvents() {
904
- const { date: e, events: t, options: s } = this.state, r = h.getWeekDays(e, s.firstDayOfWeek), n = r[0], i = new Date(r[6]);
905
- i.setHours(23, 59, 59, 999);
906
- const o = C.filterByRange(t, n, i), a = [];
907
- for (const c of o) {
972
+ const { date: e, events: t, options: s } = this.state, r = h.getWeekDays(e, this.firstDayOfWeek), n = r[0], o = new Date(r[6]);
973
+ o.setHours(23, 59, 59, 999);
974
+ const i = C.filterByRange(t, n, o), a = [];
975
+ for (const c of i) {
908
976
  const { parts: u } = C.splitInParts(c);
909
977
  a.push(...u);
910
978
  }
911
- const l = C.filterPartsByRange(a, n, i), d = C.getTimelinedParts(l);
979
+ const l = C.filterPartsByRange(a, n, o), d = C.getTimelinedParts(l);
912
980
  this.eventElements.forEach((c) => c.remove()), this.eventElements.clear();
913
- for (const { part: c, trackIndex: u, totalTracks: m, colspan: g } of d) {
981
+ for (const { part: c, trackIndex: u, totalTracks: v, colspan: g } of d) {
914
982
  if (!c.event) continue;
915
- const f = r.findIndex((x) => h.isSameDay(x, c.start));
983
+ const f = r.findIndex((M) => h.isSameDay(M, c.start));
916
984
  if (f === -1) continue;
917
985
  const y = this.dayColumns[f].querySelector(".scheduler-events-container");
918
986
  if (!y) continue;
919
- const w = this.createEventElement(
987
+ const b = this.createEventElement(
920
988
  c,
921
989
  u,
922
- m,
990
+ v,
923
991
  g,
924
992
  s.slotDuration ?? 1800
925
993
  );
926
- y.appendChild(w), this.eventElements.set(c.id, w);
994
+ y.appendChild(b), this.eventElements.set(c.id, b);
927
995
  }
928
996
  }
929
997
  createEventElement(e, t, s, r, n) {
930
- const i = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === i.id;
931
- this.state.keyboardMoveEventId, i.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
998
+ const o = e.event, i = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === o.id;
999
+ this.state.keyboardMoveEventId, o.id, i.setAttribute("role", "button"), i.setAttribute("tabindex", "0"), i.setAttribute(
932
1000
  "aria-label",
933
- $(i, null, this.state.options)
934
- ), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
1001
+ W(o, null, this.state.options)
1002
+ ), i.setAttribute("aria-pressed", a ? "true" : "false"), i.setAttribute("aria-describedby", "scheduler-kbd-event"), a && i.classList.add("selected");
935
1003
  const l = this.partGeometry(e.start, e.end, {
936
1004
  ...this.state.options,
937
1005
  slotDuration: n
938
- }), { top: d, height: c } = l ?? { top: 0, height: 0 }, u = t / s * 100, m = r / s * 100;
939
- o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${u}%`, o.style.width = `calc(${m}% - 2px)`, this.applyEventColors(o, i), this.setData(o, { eventId: i.id });
1006
+ }), { top: d, height: c } = l ?? { top: 0, height: 0 }, u = t / s * 100, v = r / s * 100;
1007
+ i.style.top = `${d}px`, i.style.height = `${c}px`, i.style.left = `${u}%`, i.style.width = `calc(${v}% - 2px)`, this.applyEventColors(i, o), this.setData(i, { eventId: o.id });
940
1008
  const g = this.createElement("div", "event-content"), f = this.createElement("div", "event-title");
941
- f.textContent = i.title, g.appendChild(f);
942
- const v = this.createElement("div", "event-time");
943
- return v.textContent = `${h.formatTime(e.start, this.state.options.timeFormat)} - ${h.formatTime(e.end, this.state.options.timeFormat)}`, g.appendChild(v), o.appendChild(g), this.appendResizeHandles(o, e), o;
1009
+ f.textContent = o.title, g.appendChild(f);
1010
+ const m = this.createElement("div", "event-time");
1011
+ return m.textContent = h.formatTimeRange(
1012
+ e.start,
1013
+ e.end,
1014
+ this.state.options.timeFormat,
1015
+ this.state.options.locale
1016
+ ), g.appendChild(m), i.appendChild(g), this.appendResizeHandles(i, e), i;
944
1017
  }
945
1018
  /**
946
1019
  * Dashed ghost showing where the dragged/created range will land — ONE box per
@@ -949,36 +1022,36 @@ class we extends B {
949
1022
  * box hanging out of the first column for a 3-day range.
950
1023
  */
951
1024
  renderPreviewEvent() {
952
- this.container.querySelectorAll(".scheduler-event.preview").forEach((i) => i.remove());
1025
+ this.container.querySelectorAll(".scheduler-event.preview").forEach((o) => o.remove());
953
1026
  const { previewEvent: e, options: t, date: s } = this.state;
954
1027
  if (!e) return;
955
- const r = h.getWeekDays(s, t.firstDayOfWeek), { parts: n } = C.splitInParts(e);
956
- for (const i of n) {
957
- const o = r.findIndex((c) => h.isSameDay(c, i.start));
958
- if (o === -1) continue;
959
- const a = this.dayColumns[o]?.querySelector(".scheduler-events-container");
1028
+ const r = h.getWeekDays(s, this.firstDayOfWeek), { parts: n } = C.splitInParts(e);
1029
+ for (const o of n) {
1030
+ const i = r.findIndex((c) => h.isSameDay(c, o.start));
1031
+ if (i === -1) continue;
1032
+ const a = this.dayColumns[i]?.querySelector(".scheduler-events-container");
960
1033
  if (!a) continue;
961
- const l = this.partGeometry(i.start, i.end, t);
1034
+ const l = this.partGeometry(o.start, o.end, t);
962
1035
  if (!l) continue;
963
1036
  const d = this.createElement("div", "scheduler-event", "preview");
964
- 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);
1037
+ o.isStart || d.classList.add("preview-continues-before"), o.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);
965
1038
  }
966
1039
  }
967
1040
  updateGreyedSlots() {
968
1041
  const { dragState: e, previewEvent: t, options: s, date: r } = this.state;
969
- if (this.slotElements.forEach((o) => o.classList.remove("greyed")), !e || !t) return;
970
- const n = h.getWeekDays(r, s.firstDayOfWeek), i = h.getTimeSlots(
1042
+ if (this.slotElements.forEach((i) => i.classList.remove("greyed")), !e || !t) return;
1043
+ const n = h.getWeekDays(r, this.firstDayOfWeek), o = h.getTimeSlots(
971
1044
  n[0],
972
1045
  s.slotDuration,
973
1046
  s.slotMinTime,
974
1047
  s.slotMaxTime
975
1048
  );
976
- for (let o = 0; o < n.length; o++) {
977
- const a = n[o];
978
- for (let l = 0; l < i.length; l++) {
979
- const d = i[l], { start: c, end: u } = Z(d, a);
1049
+ for (let i = 0; i < n.length; i++) {
1050
+ const a = n[i];
1051
+ for (let l = 0; l < o.length; l++) {
1052
+ const d = o[l], { start: c, end: u } = re(d, a);
980
1053
  if (c < t.end && u > t.start) {
981
- const m = `${o}-${l}`, g = this.slotElements.get(m);
1054
+ const v = `${i}-${l}`, g = this.slotElements.get(v);
982
1055
  g && g.classList.add("greyed");
983
1056
  }
984
1057
  }
@@ -990,32 +1063,32 @@ class we extends B {
990
1063
  if (r === -1) return;
991
1064
  const n = this.dayColumns[r];
992
1065
  if (!n) return;
993
- const i = new Date(s);
994
- i.setHours(0, 0, 0, 0);
995
- 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");
1066
+ const o = new Date(s);
1067
+ o.setHours(0, 0, 0, 0);
1068
+ const i = (s.getTime() - o.getTime()) / (1e3 * 60), a = (this.state.options.slotDuration ?? 1800) / 60, l = i / a * 40, d = this.createElement("div", "scheduler-now-indicator");
996
1069
  d.style.top = `${l}px`, n.appendChild(d);
997
1070
  }
998
1071
  updateNowIndicator() {
999
1072
  if (!this.state.options.nowIndicator) return;
1000
- const { date: e, options: t } = this.state, s = h.getWeekDays(e, t.firstDayOfWeek), r = /* @__PURE__ */ new Date(), n = s.findIndex((u) => h.isSameDay(u, r));
1073
+ const { date: e, options: t } = this.state, s = h.getWeekDays(e, this.firstDayOfWeek), r = /* @__PURE__ */ new Date(), n = s.findIndex((u) => h.isSameDay(u, r));
1001
1074
  if (n === -1) return;
1002
- const i = this.dayColumns[n];
1003
- if (!i) return;
1004
- const o = i.querySelector(".scheduler-now-indicator"), a = new Date(r);
1075
+ const o = this.dayColumns[n];
1076
+ if (!o) return;
1077
+ const i = o.querySelector(".scheduler-now-indicator"), a = new Date(r);
1005
1078
  a.setHours(0, 0, 0, 0);
1006
1079
  const l = (r.getTime() - a.getTime()) / (1e3 * 60), d = (t.slotDuration ?? 1800) / 60, c = l / d * 40;
1007
- if (o)
1008
- o.style.top = `${c}px`;
1080
+ if (i)
1081
+ i.style.top = `${c}px`;
1009
1082
  else {
1010
1083
  const u = this.createElement("div", "scheduler-now-indicator");
1011
- u.style.top = `${c}px`, i.appendChild(u);
1084
+ u.style.top = `${c}px`, o.appendChild(u);
1012
1085
  }
1013
1086
  }
1014
1087
  destroy() {
1015
1088
  this.eventElements.clear(), this.slotElements.clear(), this.dayColumns = [], this.clearContainer();
1016
1089
  }
1017
1090
  }
1018
- class Ee extends B {
1091
+ class Ie extends K {
1019
1092
  constructor() {
1020
1093
  super(...arguments), this.eventsContainer = null, this.slotElements = /* @__PURE__ */ new Map(), this.dayColumn = null;
1021
1094
  }
@@ -1025,15 +1098,15 @@ class Ee extends B {
1025
1098
  r.style.width = "var(--scheduler-time-gutter-width)", s.appendChild(r);
1026
1099
  const n = this.createElement("div", "scheduler-day-header");
1027
1100
  h.isToday(e) && n.classList.add("today");
1028
- const i = this.createElement("div", "day-name");
1029
- i.textContent = h.getDayName(e, t.locale);
1030
- const o = this.createElement("div", "day-number");
1031
- o.textContent = String(e.getDate());
1101
+ const o = this.createElement("div", "day-name");
1102
+ o.textContent = h.getDayName(e, t.locale);
1103
+ const i = this.createElement("div", "day-number");
1104
+ i.textContent = String(e.getDate());
1032
1105
  const a = this.createElement("div", "month-year");
1033
1106
  a.textContent = h.formatDate(e, t.locale, {
1034
1107
  month: "long",
1035
1108
  year: "numeric"
1036
- }), a.style.fontSize = "12px", a.style.color = "#666", n.appendChild(i), n.appendChild(o), n.appendChild(a), s.appendChild(n), this.container.appendChild(s);
1109
+ }), a.style.fontSize = "12px", a.style.color = "#666", n.appendChild(o), n.appendChild(i), n.appendChild(a), s.appendChild(n), this.container.appendChild(s);
1037
1110
  const l = this.createElement("div", "scheduler-time-grid"), d = this.createElement("div", "scheduler-time-gutter"), c = h.getTimeSlots(
1038
1111
  e,
1039
1112
  t.slotDuration,
@@ -1042,21 +1115,24 @@ class Ee extends B {
1042
1115
  );
1043
1116
  for (const g of c) {
1044
1117
  const f = this.createElement("div", "scheduler-time-slot-label");
1045
- f.textContent = h.formatTime(g.start, t.timeFormat), d.appendChild(f);
1118
+ f.textContent = h.formatTime(g.start, t.timeFormat, t.locale), d.appendChild(f);
1046
1119
  }
1047
1120
  l.appendChild(d);
1048
1121
  const u = this.createElement("div", "scheduler-days-container");
1049
1122
  this.dayColumn = this.createElement("div", "scheduler-day-column");
1050
- const m = this.dayColumn;
1123
+ const v = this.dayColumn;
1051
1124
  for (let g = 0; g < c.length; g++) {
1052
- const f = c[g], v = this.createElement("div", "scheduler-time-slot");
1053
- v.setAttribute("role", "gridcell"), v.setAttribute("tabindex", "-1"), v.setAttribute("aria-selected", "false"), v.id = `scheduler-cell-d-${g}`, this.setData(v, {
1125
+ const f = c[g], m = this.createElement("div", "scheduler-time-slot");
1126
+ m.setAttribute("role", "gridcell"), m.setAttribute("tabindex", "-1"), m.setAttribute("aria-selected", "false"), m.setAttribute("aria-label", q(f, t)), m.id = `scheduler-cell-d-${g}`, this.setData(m, {
1054
1127
  slotIndex: g,
1055
1128
  start: f.start.toISOString(),
1056
1129
  end: f.end.toISOString()
1057
- }), this.slotElements.set(g, v), m.appendChild(v);
1130
+ }), this.slotElements.set(g, m), v.appendChild(m);
1058
1131
  }
1059
- 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({
1132
+ this.eventsContainer = this.createElement("div", "scheduler-events-container"), v.appendChild(this.eventsContainer), u.appendChild(v), l.appendChild(u), this.container.appendChild(l), this.renderEvents(), this.updateCellFocusAndSelection(), h.isToday(e) && t.nowIndicator && this.renderNowIndicator(v), this.applyGridRoles({
1133
+ label: E(w(this.state.options.messages).dayGridLabel, {
1134
+ date: h.formatDateWithWeekday(this.state.date, this.state.options.locale)
1135
+ }),
1060
1136
  multiselectable: !0,
1061
1137
  columnHeaderRow: ":scope > .scheduler-day-headers",
1062
1138
  columnHeaders: ".scheduler-day-headers > .scheduler-day-header",
@@ -1084,11 +1160,11 @@ class Ee extends B {
1084
1160
  let t = !1, s = null;
1085
1161
  for (const [, r] of this.slotElements) {
1086
1162
  s || (s = r);
1087
- const n = r.dataset.start, i = r.dataset.end;
1088
- if (!n || !i) continue;
1089
- const o = { start: new Date(n), end: new Date(i) }, a = !!e && o.start.getTime() === e.start.getTime();
1163
+ const n = r.dataset.start, o = r.dataset.end;
1164
+ if (!n || !o) continue;
1165
+ const i = { start: new Date(n), end: new Date(o) }, a = !!e && i.start.getTime() === e.start.getTime();
1090
1166
  r.setAttribute("tabindex", a ? "0" : "-1");
1091
- const l = V(o, this.state, null);
1167
+ const l = Z(i, this.state, null);
1092
1168
  r.setAttribute("aria-selected", l ? "true" : "false"), r.classList.toggle("selected", l), a && (t = !0);
1093
1169
  }
1094
1170
  !t && s && s.setAttribute("tabindex", "0");
@@ -1100,52 +1176,57 @@ class Ee extends B {
1100
1176
  r.setHours(0, 0, 0, 0);
1101
1177
  const n = new Date(e);
1102
1178
  n.setHours(23, 59, 59, 999);
1103
- const i = C.filterByRange(t, r, n), o = [];
1104
- for (const l of i) {
1179
+ const o = C.filterByRange(t, r, n), i = [];
1180
+ for (const l of o) {
1105
1181
  const { parts: d } = C.splitInParts(l), c = C.filterPartsByRange(d, r, n);
1106
- o.push(...c);
1182
+ i.push(...c);
1107
1183
  }
1108
- const a = C.getTimelinedParts(o);
1184
+ const a = C.getTimelinedParts(i);
1109
1185
  for (const { part: l, trackIndex: d, totalTracks: c, colspan: u } of a) {
1110
1186
  if (!l.event) continue;
1111
- const m = this.createEventElement(
1187
+ const v = this.createEventElement(
1112
1188
  l,
1113
1189
  d,
1114
1190
  c,
1115
1191
  u,
1116
1192
  s.slotDuration ?? 1800
1117
1193
  );
1118
- this.eventsContainer.appendChild(m);
1194
+ this.eventsContainer.appendChild(v);
1119
1195
  }
1120
1196
  }
1121
1197
  createEventElement(e, t, s, r, n) {
1122
- const i = e.event, o = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === i.id;
1123
- this.state.keyboardMoveEventId, i.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
1198
+ const o = e.event, i = this.createElement("div", "scheduler-event"), a = this.state.selectedEvent?.id === o.id;
1199
+ this.state.keyboardMoveEventId, o.id, i.setAttribute("role", "button"), i.setAttribute("tabindex", "0"), i.setAttribute(
1124
1200
  "aria-label",
1125
- $(i, null, this.state.options)
1126
- ), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
1201
+ W(o, null, this.state.options)
1202
+ ), i.setAttribute("aria-pressed", a ? "true" : "false"), i.setAttribute("aria-describedby", "scheduler-kbd-event"), a && i.classList.add("selected");
1127
1203
  const l = this.partGeometry(e.start, e.end, {
1128
1204
  ...this.state.options,
1129
1205
  slotDuration: n
1130
- }), { top: d, height: c } = l ?? { top: 0, height: 0 }, u = t / s * 100, m = r / s * 100;
1131
- o.style.top = `${d}px`, o.style.height = `${c}px`, o.style.left = `${u}%`, o.style.width = `calc(${m}% - 2px)`, this.applyEventColors(o, i), this.setData(o, { eventId: i.id });
1206
+ }), { top: d, height: c } = l ?? { top: 0, height: 0 }, u = t / s * 100, v = r / s * 100;
1207
+ i.style.top = `${d}px`, i.style.height = `${c}px`, i.style.left = `${u}%`, i.style.width = `calc(${v}% - 2px)`, this.applyEventColors(i, o), this.setData(i, { eventId: o.id });
1132
1208
  const g = this.createElement("div", "event-content"), f = this.createElement("div", "event-title");
1133
- f.textContent = i.title, g.appendChild(f);
1134
- const v = this.createElement("div", "event-time");
1135
- return v.textContent = `${h.formatTime(e.start, this.state.options.timeFormat)} - ${h.formatTime(e.end, this.state.options.timeFormat)}`, g.appendChild(v), o.appendChild(g), this.appendResizeHandles(o, e), o;
1209
+ f.textContent = o.title, g.appendChild(f);
1210
+ const m = this.createElement("div", "event-time");
1211
+ return m.textContent = h.formatTimeRange(
1212
+ e.start,
1213
+ e.end,
1214
+ this.state.options.timeFormat,
1215
+ this.state.options.locale
1216
+ ), g.appendChild(m), i.appendChild(g), this.appendResizeHandles(i, e), i;
1136
1217
  }
1137
1218
  renderNowIndicator(e) {
1138
1219
  const t = /* @__PURE__ */ new Date(), s = new Date(t);
1139
1220
  s.setHours(0, 0, 0, 0);
1140
- const r = (t.getTime() - s.getTime()) / (1e3 * 60), n = (this.state.options.slotDuration ?? 1800) / 60, i = r / n * 40, o = this.createElement("div", "scheduler-now-indicator");
1141
- o.style.top = `${i}px`, e.appendChild(o);
1221
+ const r = (t.getTime() - s.getTime()) / (1e3 * 60), n = (this.state.options.slotDuration ?? 1800) / 60, o = r / n * 40, i = this.createElement("div", "scheduler-now-indicator");
1222
+ i.style.top = `${o}px`, e.appendChild(i);
1142
1223
  }
1143
1224
  updateNowIndicator() {
1144
1225
  if (!this.dayColumn || !this.state.options.nowIndicator || !h.isToday(this.state.date)) return;
1145
1226
  const e = this.dayColumn.querySelector(".scheduler-now-indicator"), t = /* @__PURE__ */ new Date(), s = new Date(t);
1146
1227
  s.setHours(0, 0, 0, 0);
1147
- const r = (t.getTime() - s.getTime()) / (1e3 * 60), n = (this.state.options.slotDuration ?? 1800) / 60, i = r / n * 40;
1148
- e ? e.style.top = `${i}px` : this.renderNowIndicator(this.dayColumn);
1228
+ const r = (t.getTime() - s.getTime()) / (1e3 * 60), n = (this.state.options.slotDuration ?? 1800) / 60, o = r / n * 40;
1229
+ e ? e.style.top = `${o}px` : this.renderNowIndicator(this.dayColumn);
1149
1230
  }
1150
1231
  update(e) {
1151
1232
  const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options);
@@ -1160,17 +1241,17 @@ class Ee extends B {
1160
1241
  }
1161
1242
  updateGreyedSlots() {
1162
1243
  const { dragState: e, previewEvent: t, options: s, date: r } = this.state;
1163
- if (this.slotElements.forEach((i) => i.classList.remove("greyed")), !e || !t) return;
1244
+ if (this.slotElements.forEach((o) => o.classList.remove("greyed")), !e || !t) return;
1164
1245
  const n = h.getTimeSlots(
1165
1246
  r,
1166
1247
  s.slotDuration,
1167
1248
  s.slotMinTime,
1168
1249
  s.slotMaxTime
1169
1250
  );
1170
- for (let i = 0; i < n.length; i++) {
1171
- const o = n[i];
1172
- if (o.start < t.end && o.end > t.start) {
1173
- const a = this.slotElements.get(i);
1251
+ for (let o = 0; o < n.length; o++) {
1252
+ const i = n[o];
1253
+ if (i.start < t.end && i.end > t.start) {
1254
+ const a = this.slotElements.get(o);
1174
1255
  a && a.classList.add("greyed");
1175
1256
  }
1176
1257
  }
@@ -1188,17 +1269,17 @@ class Ee extends B {
1188
1269
  if (!e) return;
1189
1270
  const { parts: r } = C.splitInParts(e), n = r.find((a) => h.isSameDay(s, a.start));
1190
1271
  if (!n) return;
1191
- const i = this.partGeometry(n.start, n.end, t);
1192
- if (!i) return;
1193
- const o = this.createElement("div", "scheduler-event", "preview");
1194
- n.isStart || o.classList.add("preview-continues-before"), n.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);
1272
+ const o = this.partGeometry(n.start, n.end, t);
1273
+ if (!o) return;
1274
+ const i = this.createElement("div", "scheduler-event", "preview");
1275
+ n.isStart || i.classList.add("preview-continues-before"), n.isEnd || i.classList.add("preview-continues-after"), i.style.top = `${o.top}px`, i.style.height = `${o.height}px`, i.style.left = "0", i.style.width = "100%", this.eventsContainer.appendChild(i);
1195
1276
  }
1196
1277
  destroy() {
1197
1278
  this.eventsContainer = null, this.dayColumn = null, this.slotElements.clear(), this.clearContainer();
1198
1279
  }
1199
1280
  }
1200
- const P = "__mp-unassigned__";
1201
- class A extends B {
1281
+ const z = "__mp-unassigned__";
1282
+ class I extends K {
1202
1283
  constructor() {
1203
1284
  super(...arguments), this.rowElements = /* @__PURE__ */ new Map(), this.pendingFocusKey = null, this.columnDrag = null, this.boundColumnDragMove = (e) => this.onColumnDragMove(e), this.boundColumnDragEnd = () => this.onColumnDragEnd();
1204
1285
  }
@@ -1233,66 +1314,61 @@ class A extends B {
1233
1314
  }
1234
1315
  render() {
1235
1316
  this.captureActionFocus(), this.clearContainer(), this.container.classList.add("scheduler-timeline-view");
1236
- const { date: e, options: t, resources: s, collapsedGroups: r } = this.state, n = h.getWeekDays(e, t.firstDayOfWeek), i = R.flatten(s, r), o = this.hasUnassignedRow(this.state), a = i.filter((b) => b.visible).length + 2 + (o ? 1 : 0), l = this.createElement("div", "scheduler-timeline");
1237
- l.setAttribute("role", "grid"), l.setAttribute(
1317
+ const { date: e, options: t, resources: s, collapsedGroups: r } = this.state, n = h.getWeekDays(e, this.firstDayOfWeek), o = n.map(
1318
+ (D) => h.getTimeSlots(D, t.slotDuration, t.slotMinTime, t.slotMaxTime)
1319
+ ), i = o.reduce((D, T) => D + T.length, 0), a = O.flatten(s, r), l = this.hasUnassignedRow(this.state), d = a.filter((D) => D.visible).length + 2 + (l ? 1 : 0), c = this.createElement("div", "scheduler-timeline");
1320
+ c.setAttribute("role", "grid"), c.setAttribute(
1238
1321
  "aria-label",
1239
- S(E(t.messages).timelineGridLabel, {
1322
+ E(w(t.messages).timelineGridLabel, {
1240
1323
  date: h.formatDateWithWeekday(n[0], t.locale)
1241
1324
  })
1242
- ), l.setAttribute("aria-rowcount", String(a)), l.setAttribute("aria-describedby", "scheduler-kbd-grid"), l.setAttribute("aria-multiselectable", "true");
1243
- const d = this.createElement("div", "scheduler-timeline-header");
1244
- d.setAttribute("role", "row"), d.setAttribute("aria-rowindex", "1");
1245
- const c = this.createElement("div", "scheduler-resource-header");
1246
- c.setAttribute("role", "columnheader"), c.textContent = E(this.state.options.messages).resourcesHeader, c.appendChild(this.createColumnResizer()), d.appendChild(c);
1247
- const u = this.createElement("div", "scheduler-timeline-slots-header");
1248
- for (const b of n) {
1249
- const H = h.getTimeSlots(
1250
- b,
1251
- t.slotDuration,
1252
- t.slotMinTime,
1253
- t.slotMaxTime
1254
- ).length, k = this.createElement("div", "scheduler-timeline-slot-header");
1255
- k.setAttribute("role", "columnheader"), k.style.width = `${H * this.slotWidth}px`, k.textContent = h.formatDateWithWeekday(b, t.locale), k.style.borderBottom = "1px solid var(--scheduler-border-color)", u.appendChild(k);
1325
+ ), c.setAttribute("aria-rowcount", String(d)), c.setAttribute("aria-colcount", String(1 + i)), c.setAttribute("aria-describedby", "scheduler-kbd-grid"), c.setAttribute("aria-multiselectable", "true");
1326
+ const u = this.createElement("div", "scheduler-timeline-header");
1327
+ u.setAttribute("role", "row"), u.setAttribute("aria-rowindex", "1");
1328
+ const v = this.createElement("div", "scheduler-resource-header");
1329
+ v.setAttribute("role", "columnheader"), v.setAttribute("aria-colindex", "1"), v.textContent = w(this.state.options.messages).resourcesHeader, v.appendChild(this.createColumnResizer()), u.appendChild(v);
1330
+ const g = this.createElement("div", "scheduler-timeline-slots-header");
1331
+ g.setAttribute("role", "presentation");
1332
+ let f = 2;
1333
+ for (const [D, T] of n.entries()) {
1334
+ const V = o[D].length, P = this.createElement("div", "scheduler-timeline-slot-header", "day");
1335
+ 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`;
1336
+ const ee = this.createElement("span", "day-label");
1337
+ ee.textContent = h.formatDateWithWeekday(T, t.locale), P.appendChild(ee), P.style.borderBottom = "1px solid var(--scheduler-border-color)", g.appendChild(P);
1256
1338
  }
1257
- d.appendChild(u);
1339
+ u.appendChild(g);
1258
1340
  const m = this.createElement("div", "scheduler-timeline-head");
1259
- m.appendChild(d), l.appendChild(m);
1260
- const g = this.createElement("div", "scheduler-timeline-header");
1261
- g.setAttribute("role", "row");
1262
- const f = this.createElement("div", "scheduler-resource-header");
1263
- f.style.borderBottom = "1px solid var(--scheduler-border-color)", g.appendChild(f);
1264
- const v = this.createElement("div", "scheduler-timeline-slots-header");
1265
- v.setAttribute("role", "presentation");
1266
- for (const b of n) {
1267
- const M = h.getTimeSlots(
1268
- b,
1269
- t.slotDuration,
1270
- t.slotMinTime,
1271
- t.slotMaxTime
1272
- );
1273
- for (const H of M) {
1274
- const k = this.createElement("div", "scheduler-timeline-slot-header");
1275
- k.setAttribute("role", "columnheader"), k.style.width = `${this.slotWidth}px`, k.textContent = h.formatTime(H.start, t.timeFormat), k.style.fontSize = "10px", v.appendChild(k);
1341
+ m.appendChild(u), c.appendChild(m);
1342
+ const y = this.createElement("div", "scheduler-timeline-header");
1343
+ y.setAttribute("role", "row"), y.setAttribute("aria-rowindex", "2");
1344
+ const b = this.createElement("div", "scheduler-resource-header");
1345
+ b.setAttribute("role", "columnheader"), b.setAttribute("aria-colindex", "1"), b.style.borderBottom = "1px solid var(--scheduler-border-color)", y.appendChild(b);
1346
+ const M = this.createElement("div", "scheduler-timeline-slots-header");
1347
+ M.setAttribute("role", "presentation");
1348
+ let A = 2;
1349
+ for (const D of o)
1350
+ for (const T of D) {
1351
+ const R = this.createElement("div", "scheduler-timeline-slot-header");
1352
+ 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);
1276
1353
  }
1354
+ y.appendChild(M), m.appendChild(y);
1355
+ const x = this.createElement("div", "scheduler-timeline-body"), F = O.flatten(s, r);
1356
+ let L = 3;
1357
+ for (const D of F) {
1358
+ if (!D.visible) continue;
1359
+ const T = this.createResourceRow(D, o);
1360
+ T.setAttribute("aria-rowindex", String(L)), x.appendChild(T), L++;
1277
1361
  }
1278
- g.appendChild(v), m.appendChild(g);
1279
- const y = this.createElement("div", "scheduler-timeline-body"), w = R.flatten(s, r);
1280
- let x = 2;
1281
- for (const b of w) {
1282
- if (!b.visible) continue;
1283
- const M = this.createResourceRow(b, n);
1284
- M.setAttribute("aria-rowindex", String(x)), y.appendChild(M), x++;
1285
- }
1286
- if (o) {
1287
- const b = this.createUnassignedRow(n);
1288
- b.setAttribute("aria-rowindex", String(x)), y.appendChild(b), x++;
1362
+ if (l) {
1363
+ const D = this.createUnassignedRow(o);
1364
+ D.setAttribute("aria-rowindex", String(L)), x.appendChild(D), L++;
1289
1365
  }
1290
- if (l.appendChild(y), this.container.appendChild(l), w.length === 0 && !o) {
1291
- const b = this.createElement("div", "scheduler-timeline-empty");
1292
- b.textContent = E(t.messages).noResources, y.appendChild(b);
1366
+ if (c.appendChild(x), this.container.appendChild(c), F.length === 0 && !l) {
1367
+ const D = this.createElement("div", "scheduler-timeline-empty");
1368
+ D.textContent = w(t.messages).noResources, x.appendChild(D);
1293
1369
  }
1294
- const I = this.createAddBar();
1295
- I && this.container.appendChild(I), this.renderEvents(n), this.updateCellFocusAndSelection(), this.restoreActionFocus();
1370
+ const Q = this.createAddBar();
1371
+ Q && this.container.appendChild(Q), this.renderEvents(n), this.updateCellFocusAndSelection(), this.restoreActionFocus();
1296
1372
  }
1297
1373
  /**
1298
1374
  * Focus key of an action control: what it does plus which row it belongs to.
@@ -1300,7 +1376,15 @@ class A extends B {
1300
1376
  */
1301
1377
  actionFocusKey(e) {
1302
1378
  const t = e.dataset.action;
1303
- return t ? [t, e.dataset.parentId ?? "", e.dataset.resourceId ?? ""].join("|") : null;
1379
+ return t ? [
1380
+ t,
1381
+ e.dataset.parentId ?? "",
1382
+ e.dataset.resourceId ?? "",
1383
+ // The expand toggle identifies its row this way, and it is the control
1384
+ // most likely to be focused across a rebuild — activating it IS what
1385
+ // triggers the rebuild.
1386
+ e.dataset.groupId ?? ""
1387
+ ].join("|") : null;
1304
1388
  }
1305
1389
  /**
1306
1390
  * Remember which action control the user was on, if any, before a rebuild.
@@ -1327,57 +1411,54 @@ class A extends B {
1327
1411
  updateCellFocusAndSelection() {
1328
1412
  const e = this.state.focusedCell, t = this.state.focusedResourceId, s = this.container.querySelectorAll(".scheduler-timeline-slot");
1329
1413
  let r = !1, n = null;
1330
- s.forEach((i) => {
1331
- n || (n = i);
1332
- const o = i.dataset.start, a = i.dataset.end, l = i.dataset.resourceId ?? null;
1333
- if (!o || !a) return;
1334
- const d = { start: new Date(o), end: new Date(a) }, c = !!e && d.start.getTime() === e.start.getTime() && t === l;
1335
- i.setAttribute("tabindex", c ? "0" : "-1");
1336
- const u = V(d, this.state, l);
1337
- i.setAttribute("aria-selected", u ? "true" : "false"), i.classList.toggle("selected", u), c && (r = !0);
1414
+ s.forEach((o) => {
1415
+ n || (n = o);
1416
+ const i = o.dataset.start, a = o.dataset.end, l = o.dataset.resourceId ?? null;
1417
+ if (!i || !a) return;
1418
+ const d = { start: new Date(i), end: new Date(a) }, c = !!e && d.start.getTime() === e.start.getTime() && t === l;
1419
+ o.setAttribute("tabindex", c ? "0" : "-1");
1420
+ const u = Z(d, this.state, l);
1421
+ o.setAttribute("aria-selected", u ? "true" : "false"), o.classList.toggle("selected", u), c && (r = !0);
1338
1422
  }), !r && n && n.setAttribute("tabindex", "0");
1339
1423
  }
1340
1424
  createResourceRow(e, t) {
1341
1425
  const { options: s } = this.state, r = this.createElement("div", "scheduler-timeline-row");
1342
- r.setAttribute("role", "row"), L(e.item) && r.classList.add("group");
1426
+ r.setAttribute("role", "row"), H(e.item) && r.classList.add("group");
1343
1427
  const n = this.createElement("div", "scheduler-resource-cell");
1344
- if (n.setAttribute("role", "rowheader"), n.style.paddingLeft = `${8 + e.depth * 16}px`, L(e.item)) {
1345
- const a = this.createElement("button", "expand-toggle");
1346
- a.type = "button";
1347
- const l = this.state.collapsedGroups.has(e.item.id);
1348
- a.textContent = l ? "▶" : "▼", a.setAttribute("aria-expanded", String(!l)), a.setAttribute(
1428
+ if (n.setAttribute("role", "rowheader"), n.setAttribute("aria-colindex", "1"), n.style.paddingLeft = `${8 + e.depth * 16}px`, H(e.item)) {
1429
+ const l = this.createElement("button", "expand-toggle");
1430
+ l.type = "button";
1431
+ const d = this.state.collapsedGroups.has(e.item.id);
1432
+ l.textContent = d ? "▶" : "▼", l.setAttribute("aria-expanded", String(!d)), l.setAttribute(
1349
1433
  "aria-label",
1350
- S(
1351
- E(this.state.options.messages)[l ? "expandGroup" : "collapseGroup"],
1434
+ E(
1435
+ w(this.state.options.messages)[d ? "expandGroup" : "collapseGroup"],
1352
1436
  { title: e.item.title }
1353
1437
  )
1354
- ), this.setData(a, { groupId: e.item.id }), n.appendChild(a);
1438
+ ), this.setData(l, { action: "toggle-group", groupId: e.item.id }), n.appendChild(l);
1355
1439
  }
1356
- const i = this.createElement("span", "resource-title");
1357
- i.textContent = e.item.title, i.title = e.item.title, this.can("updateResource") && this.setData(i, { resourceId: e.item.id }), n.appendChild(i), this.appendResourceActions(n, e.item), r.appendChild(n);
1358
- const o = this.createElement("div", "scheduler-timeline-slots");
1359
- o.setAttribute("role", "presentation");
1360
- for (const a of t) {
1361
- const l = h.getTimeSlots(
1362
- a,
1363
- s.slotDuration,
1364
- s.slotMinTime,
1365
- s.slotMaxTime
1366
- );
1440
+ const o = this.createElement("span", "resource-title");
1441
+ o.textContent = e.item.title, o.title = e.item.title, this.can("updateResource") && this.setData(o, { resourceId: e.item.id }), n.appendChild(o), this.appendResourceActions(n, e.item), r.appendChild(n);
1442
+ const i = this.createElement("div", "scheduler-timeline-slots");
1443
+ i.setAttribute("role", "presentation");
1444
+ let a = 2;
1445
+ for (const l of t)
1367
1446
  for (const d of l) {
1368
1447
  const c = this.createElement("div", "scheduler-timeline-slot");
1369
- c.setAttribute("role", "gridcell"), c.setAttribute("tabindex", "-1"), c.setAttribute("aria-selected", "false"), c.id = `scheduler-cell-t-${e.item.id}-${d.start.getTime()}`, c.style.width = `${this.slotWidth}px`, this.setData(c, {
1448
+ c.setAttribute("role", "gridcell"), c.setAttribute("aria-colindex", String(a)), a++, c.setAttribute("tabindex", "-1"), c.setAttribute("aria-selected", "false"), c.setAttribute(
1449
+ "aria-label",
1450
+ q(d, this.state.options, e.item.title)
1451
+ ), c.id = `scheduler-cell-t-${e.item.id}-${d.start.getTime()}`, c.style.width = `${this.slotWidth}px`, this.setData(c, {
1370
1452
  resourceId: e.item.id,
1371
1453
  start: d.start.toISOString(),
1372
1454
  end: d.end.toISOString()
1373
- }), o.appendChild(c);
1455
+ }), i.appendChild(c);
1374
1456
  }
1457
+ if (oe(e.item)) {
1458
+ const l = this.createElement("div", "scheduler-timeline-events");
1459
+ l.setAttribute("role", "gridcell"), l.setAttribute("aria-colindex", "2"), l.setAttribute("aria-colspan", String(a - 2)), i.appendChild(l);
1375
1460
  }
1376
- if (G(e.item)) {
1377
- const a = this.createElement("div", "scheduler-timeline-events");
1378
- a.setAttribute("role", "gridcell"), o.appendChild(a);
1379
- }
1380
- return r.appendChild(o), this.rowElements.set(e.item.id, r), r;
1461
+ return r.appendChild(i), this.rowElements.set(e.item.id, r), r;
1381
1462
  }
1382
1463
  /**
1383
1464
  * Whether the synthetic bucket row renders: only when something is actually
@@ -1402,12 +1483,19 @@ class A extends B {
1402
1483
  * strips classes and ARIA, not inline style), which is what makes the
1403
1484
  * user's chosen width sticky.
1404
1485
  *
1405
- * Lives inside the corner columnheader, OUTSIDE the `role="grid"` focus
1406
- * model (same reasoning as the add bar, §11.2): a separator is not a grid
1407
- * cell, and a Tab stop inside a roving-tabindex grid is a trap.
1486
+ * On its placement (audit M11): it lives inside the corner columnheader,
1487
+ * which IS inside the `role="grid"` subtree — an earlier comment here claimed
1488
+ * the opposite. That is fine, but not for the reason the old comment gave.
1489
+ * `columnheader` places no restriction on its own descendants, so the
1490
+ * separator breaks no owned-children rule; and it is a deliberate second Tab
1491
+ * stop rather than a trap, because `getFocusedKind()` matches on the cell and
1492
+ * event classes and returns `'other'` here, so the grid's arrow handling
1493
+ * declines the key and only this element's own listener resizes. Moving it out
1494
+ * of the grid would mean rebuilding the containing block it positions against
1495
+ * — the sticky corner cell — for no accessibility gain.
1408
1496
  */
1409
1497
  createColumnResizer() {
1410
- const e = E(this.state.options.messages), t = this.createElement("div", "scheduler-column-resizer");
1498
+ const e = w(this.state.options.messages), t = this.createElement("div", "scheduler-column-resizer");
1411
1499
  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) => {
1412
1500
  s.preventDefault(), s.stopPropagation(), this.columnDrag = { startX: s.clientX, startWidth: this.currentColumnWidth() }, document.addEventListener("pointermove", this.boundColumnDragMove), document.addEventListener("pointerup", this.boundColumnDragEnd);
1413
1501
  }), t.addEventListener("keydown", (s) => {
@@ -1420,7 +1508,7 @@ class A extends B {
1420
1508
  s.preventDefault(), this.applyColumnWidth(n + 16);
1421
1509
  break;
1422
1510
  case "Home":
1423
- s.preventDefault(), this.applyColumnWidth(A.MIN_COLUMN_PX);
1511
+ s.preventDefault(), this.applyColumnWidth(I.MIN_COLUMN_PX);
1424
1512
  break;
1425
1513
  case "End":
1426
1514
  s.preventDefault(), this.applyColumnWidth(Number.MAX_SAFE_INTEGER);
@@ -1433,17 +1521,17 @@ class A extends B {
1433
1521
  }
1434
1522
  maxColumnWidth() {
1435
1523
  return Math.max(
1436
- A.MIN_COLUMN_PX,
1437
- this.container.clientWidth - A.MIN_GRID_PX
1524
+ I.MIN_COLUMN_PX,
1525
+ this.container.clientWidth - I.MIN_GRID_PX
1438
1526
  );
1439
1527
  }
1440
1528
  applyColumnWidth(e) {
1441
1529
  const t = Math.round(
1442
- Math.min(Math.max(e, A.MIN_COLUMN_PX), this.maxColumnWidth())
1530
+ Math.min(Math.max(e, I.MIN_COLUMN_PX), this.maxColumnWidth())
1443
1531
  );
1444
1532
  this.container.style.setProperty(
1445
1533
  "--scheduler-resource-column-width",
1446
- `min(${t}px, calc(100% - ${A.MIN_GRID_PX}px))`
1534
+ `min(${t}px, calc(100% - ${I.MIN_GRID_PX}px))`
1447
1535
  );
1448
1536
  const s = this.container.querySelector(".scheduler-column-resizer");
1449
1537
  s && this.updateResizerValue(s, t);
@@ -1461,7 +1549,7 @@ class A extends B {
1461
1549
  }
1462
1550
  /** True when the capability is granted for the whole scheduler. */
1463
1551
  can(e) {
1464
- return Q(e, { permissions: this.state.resolvedPermissions });
1552
+ return ie(e, { permissions: this.state.resolvedPermissions });
1465
1553
  }
1466
1554
  /**
1467
1555
  * Per-row resource actions, rendered into the pinned rowheader cell.
@@ -1478,54 +1566,43 @@ class A extends B {
1478
1566
  * it entirely — `aria-level` is invalid on these roles, so nesting is conveyed
1479
1567
  * by the name and the indent, not by an attribute axe flags.
1480
1568
  */
1481
- appendResourceActions(e, t) {
1482
- const s = E(this.state.options.messages), r = this.createElement("div", "scheduler-resource-actions");
1483
- L(t) && (this.can("createResource") && r.appendChild(
1484
- this.createResourceAction(
1485
- "add-resource",
1486
- "+",
1487
- S(s.addResourceToGroup, { title: t.title }),
1488
- { parentId: t.id }
1489
- )
1490
- ), this.can("createGroup") && r.appendChild(
1491
- this.createResourceAction(
1492
- "add-group",
1493
- "⊞",
1494
- S(s.addGroupToGroup, { title: t.title }),
1495
- { parentId: t.id }
1496
- )
1497
- )), this.can("updateResource") && r.appendChild(this.createColorSwatch(t, s.resourceColor)), this.can("deleteResource") && r.appendChild(
1498
- this.createResourceAction(
1499
- "delete-resource",
1500
- "×",
1501
- S(s.removeResource, { title: t.title }),
1502
- { resourceId: t.id }
1503
- )
1504
- ), r.childElementCount > 0 && e.appendChild(r);
1505
- }
1506
1569
  /**
1507
- * One icon button. The glyph is `aria-hidden` and the name lives on the
1508
- * button, so the accessible name is the localized sentence rather than "+".
1570
+ * Which actions this row offers. One list, consulted twice: here to decide
1571
+ * whether the row deserves a trigger at all, and by the component to build the
1572
+ * panel's contents. Keeping it in one place is what stops the button from
1573
+ * promising a menu that turns out to be empty.
1509
1574
  */
1510
- createResourceAction(e, t, s, r) {
1511
- const n = this.createElement("button", "scheduler-resource-action");
1512
- n.type = "button", n.setAttribute("aria-label", s), n.title = s, this.setData(n, { action: e, ...r });
1513
- const i = this.createElement("span", "action-glyph");
1514
- return i.setAttribute("aria-hidden", "true"), i.textContent = t, n.appendChild(i), n;
1575
+ rowActions(e) {
1576
+ const t = [];
1577
+ return this.can("updateResource") && t.push("rename-resource"), H(e) && (this.can("createResource") && t.push("add-resource"), this.can("createGroup") && t.push("add-group")), this.can("updateResource") && t.push("set-resource-color"), this.can("deleteResource") && t.push("delete-resource"), t;
1515
1578
  }
1516
1579
  /**
1517
- * Native `<input type="color">` for the resource's colour — the recolour half
1518
- * of R7. Native because it is keyboard-operable, localized and screen-reader
1519
- * labelled by the platform for free; a custom swatch grid would have to
1520
- * re-earn all three.
1580
+ * The row's actions trigger — one 24px button where four controls used to sit.
1581
+ *
1582
+ * Those four (add resource, add subgroup, a colour input, delete) took 102px of
1583
+ * a 200px column, leaving roughly 50px for the resource title: five characters,
1584
+ * silently ellipsised. #395 shipped them inline and #396's D12.1c predicted
1585
+ * this exact complaint; §11.2 named the trigger for revisiting it. The
1586
+ * behaviour is unchanged — every action keeps its `data-action`, its permission
1587
+ * gate and its emitted event — only the layout is reverted.
1521
1588
  *
1522
- * It edits whichever field actually drives the rendered events: `eventColor`
1523
- * wins over `color` in `resolveEventColor`, so writing `color` on a resource
1524
- * that has an `eventColor` would look like the control did nothing.
1589
+ * The button doubles as the row's colour chip. A group's `color` is stored and
1590
+ * editable but was painted nowhere in this column, so this is the first place
1591
+ * it becomes visible where it is set.
1592
+ *
1593
+ * `data-action` + `data-resource-id` are load-bearing, not decoration: the
1594
+ * timeline rebuilds its DOM on every state change, and
1595
+ * captureActionFocus/restoreActionFocus restores focus by exactly that key.
1596
+ * Omitting it reproduces the expand toggle's bug, where focus falls to <body>.
1525
1597
  */
1526
- createColorSwatch(e, t) {
1527
- const s = e, r = s.eventColor ? "eventColor" : "color", n = s.eventColor ?? e.color, i = this.createElement("input", "scheduler-resource-color");
1528
- return i.type = "color", i.setAttribute("aria-label", S(t, { title: e.title })), i.title = i.getAttribute("aria-label") ?? "", n && /^#[0-9a-f]{6}$/i.test(n) && (i.value = n), this.setData(i, { action: "set-resource-color", resourceId: e.id, field: r }), i;
1598
+ appendResourceActions(e, t) {
1599
+ if (this.rowActions(t).length === 0) return;
1600
+ const s = w(this.state.options.messages), r = E(s.rowMenuLabel, { title: t.title }), n = this.createElement("button", "scheduler-row-menu-button");
1601
+ n.type = "button", n.setAttribute("aria-label", r), n.title = r, n.setAttribute("aria-haspopup", "dialog"), n.setAttribute("aria-expanded", "false"), n.tabIndex = -1, this.setData(n, { action: "row-menu", resourceId: t.id });
1602
+ const i = t.eventColor ?? t.color, a = i ? ge(i) : null;
1603
+ i && a && (n.style.background = i, n.style.color = a, n.style.borderColor = i);
1604
+ const l = this.createElement("span", "action-glyph");
1605
+ l.setAttribute("aria-hidden", "true"), l.textContent = "⋯", n.appendChild(l), e.insertBefore(n, e.firstChild);
1529
1606
  }
1530
1607
  /**
1531
1608
  * Root-level "Add resource" / "Add group" bar, pinned to the bottom of the
@@ -1539,7 +1616,7 @@ class A extends B {
1539
1616
  createAddBar() {
1540
1617
  const e = this.can("createResource"), t = this.can("createGroup");
1541
1618
  if (!e && !t) return null;
1542
- const s = E(this.state.options.messages), r = this.createElement("div", "scheduler-timeline-addbar");
1619
+ const s = w(this.state.options.messages), r = this.createElement("div", "scheduler-timeline-addbar");
1543
1620
  if (r.setAttribute("role", "toolbar"), r.setAttribute("aria-label", s.addResourceBarLabel), e) {
1544
1621
  const n = this.createElement("button", "scheduler-add-button");
1545
1622
  n.type = "button", n.textContent = s.addResource, this.setData(n, { action: "add-resource" }), r.appendChild(n);
@@ -1565,29 +1642,30 @@ class A extends B {
1565
1642
  const { options: t } = this.state, s = this.createElement("div", "scheduler-timeline-row", "unassigned");
1566
1643
  s.setAttribute("role", "row");
1567
1644
  const r = this.createElement("div", "scheduler-resource-cell");
1568
- r.setAttribute("role", "rowheader"), r.style.paddingLeft = "8px";
1645
+ r.setAttribute("role", "rowheader"), r.setAttribute("aria-colindex", "1"), r.style.paddingLeft = "8px";
1569
1646
  const n = this.createElement("span", "resource-title");
1570
- n.textContent = E(t.messages).unassignedResource, n.title = n.textContent, r.appendChild(n), s.appendChild(r);
1571
- const i = this.createElement("div", "scheduler-timeline-slots");
1572
- i.setAttribute("role", "presentation");
1573
- for (const a of e) {
1574
- const l = h.getTimeSlots(
1575
- a,
1576
- t.slotDuration,
1577
- t.slotMinTime,
1578
- t.slotMaxTime
1579
- );
1647
+ n.textContent = w(t.messages).unassignedResource, n.title = n.textContent, r.appendChild(n), s.appendChild(r);
1648
+ const o = this.createElement("div", "scheduler-timeline-slots");
1649
+ o.setAttribute("role", "presentation");
1650
+ let i = 2;
1651
+ for (const l of e)
1580
1652
  for (const d of l) {
1581
1653
  const c = this.createElement("div", "scheduler-timeline-slot");
1582
- c.setAttribute("role", "gridcell"), c.setAttribute("tabindex", "-1"), c.setAttribute("aria-selected", "false"), c.id = `scheduler-cell-t-${P}-${d.start.getTime()}`, c.style.width = `${this.slotWidth}px`, this.setData(c, {
1654
+ c.setAttribute("role", "gridcell"), c.setAttribute("aria-colindex", String(i)), i++, c.setAttribute("tabindex", "-1"), c.setAttribute("aria-selected", "false"), c.setAttribute(
1655
+ "aria-label",
1656
+ q(
1657
+ d,
1658
+ this.state.options,
1659
+ w(this.state.options.messages).unassignedResource
1660
+ )
1661
+ ), c.id = `scheduler-cell-t-${z}-${d.start.getTime()}`, c.style.width = `${this.slotWidth}px`, this.setData(c, {
1583
1662
  start: d.start.toISOString(),
1584
1663
  end: d.end.toISOString(),
1585
1664
  unassigned: "true"
1586
- }), i.appendChild(c);
1665
+ }), o.appendChild(c);
1587
1666
  }
1588
- }
1589
- const o = this.createElement("div", "scheduler-timeline-events");
1590
- return o.setAttribute("role", "gridcell"), i.appendChild(o), s.appendChild(i), this.rowElements.set(P, s), s;
1667
+ const a = this.createElement("div", "scheduler-timeline-events");
1668
+ return a.setAttribute("role", "gridcell"), a.setAttribute("aria-colindex", "2"), a.setAttribute("aria-colspan", String(i - 2)), o.appendChild(a), s.appendChild(o), this.rowElements.set(z, s), s;
1591
1669
  }
1592
1670
  renderEvents(e) {
1593
1671
  const { resources: t, options: s } = this.state, r = e[0], n = new Date(e[6]);
@@ -1598,61 +1676,61 @@ class A extends B {
1598
1676
  s.slotMinTime,
1599
1677
  s.slotMaxTime
1600
1678
  ).length * 7 * this.slotWidth, l = [
1601
- ...R.getAllResources(t).map((d) => ({
1679
+ ...O.getAllResources(t).map((d) => ({
1602
1680
  resourceId: d.id,
1603
1681
  title: d.title
1604
1682
  })),
1605
- ...this.rowElements.has(P) ? [
1683
+ ...this.rowElements.has(z) ? [
1606
1684
  {
1607
1685
  resourceId: null,
1608
- title: E(s.messages).unassignedResource
1686
+ title: w(s.messages).unassignedResource
1609
1687
  }
1610
1688
  ] : []
1611
1689
  ];
1612
1690
  for (const { resourceId: d, title: c } of l) {
1613
- const u = this.rowElements.get(d ?? P);
1691
+ const u = this.rowElements.get(d ?? z);
1614
1692
  if (!u) continue;
1615
- const m = u.querySelector(".scheduler-timeline-events");
1616
- if (!m) continue;
1617
- m.innerHTML = "";
1693
+ const v = u.querySelector(".scheduler-timeline-events");
1694
+ if (!v) continue;
1695
+ v.innerHTML = "";
1618
1696
  const f = (this.state.eventsByResource.get(d) ?? []).filter(
1619
- (b) => b.start < n && b.end > r
1620
- ).map((b) => ({
1621
- id: b.id,
1622
- event: b,
1623
- start: b.start,
1624
- end: b.end,
1697
+ (x) => x.start < n && x.end > r
1698
+ ).map((x) => ({
1699
+ id: x.id,
1700
+ event: x,
1701
+ start: x.start,
1702
+ end: x.end,
1625
1703
  isStart: !0,
1626
1704
  isEnd: !0,
1627
1705
  dayIndex: 0,
1628
1706
  totalDays: 1
1629
- })), v = C.getTimelinedParts(f), y = v.reduce((b, M) => Math.max(b, M.totalTracks), 1), { height: w, gap: x, padding: I } = this.trackMetrics;
1630
- u.style.minHeight = `${y * w + (y - 1) * x + 2 * I}px`;
1631
- for (const { part: b, trackIndex: M } of v) {
1632
- if (!b.event) continue;
1633
- const H = this.createEventElement(
1634
- b.event,
1635
- M,
1707
+ })), m = C.getTimelinedParts(f), y = m.reduce((x, F) => Math.max(x, F.totalTracks), 1), { height: b, gap: M, padding: A } = this.trackMetrics;
1708
+ u.style.minHeight = `${y * b + (y - 1) * M + 2 * A}px`;
1709
+ for (const { part: x, trackIndex: F } of m) {
1710
+ if (!x.event) continue;
1711
+ const L = this.createEventElement(
1712
+ x.event,
1713
+ F,
1636
1714
  r,
1637
1715
  a,
1638
1716
  s.slotDuration ?? 1800,
1639
1717
  c
1640
1718
  );
1641
- m.appendChild(H);
1719
+ v.appendChild(L);
1642
1720
  }
1643
1721
  }
1644
1722
  }
1645
- createEventElement(e, t, s, r, n, i = null) {
1646
- const o = this.createElement("div", "scheduler-timeline-event"), a = this.state.selectedEvent?.id === e.id;
1647
- this.state.keyboardMoveEventId, e.id, o.setAttribute("role", "button"), o.setAttribute("tabindex", "0"), o.setAttribute(
1723
+ createEventElement(e, t, s, r, n, o = null) {
1724
+ const i = this.createElement("div", "scheduler-timeline-event"), a = this.state.selectedEvent?.id === e.id;
1725
+ this.state.keyboardMoveEventId, e.id, i.setAttribute("role", "button"), i.setAttribute("tabindex", "0"), i.setAttribute(
1648
1726
  "aria-label",
1649
- $(e, i, this.state.options)
1650
- ), o.setAttribute("aria-pressed", a ? "true" : "false"), o.setAttribute("aria-describedby", "scheduler-kbd-event"), a && o.classList.add("selected");
1651
- 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 * r, v = Math.max(m / g * r, 20), { height: y, gap: w, padding: x } = this.trackMetrics;
1652
- o.style.left = `${f}px`, o.style.width = `${v}px`, o.style.top = `${x + t * (y + w)}px`, o.style.height = `${y}px`, this.applyEventColors(o, e), this.setData(o, { eventId: e.id });
1653
- const I = this.createElement("div", "event-content"), b = this.createElement("div", "event-title");
1654
- return b.textContent = e.title, I.appendChild(b), o.appendChild(I), this.appendResizeHandles(
1655
- o,
1727
+ W(e, o, this.state.options)
1728
+ ), i.setAttribute("aria-pressed", a ? "true" : "false"), i.setAttribute("aria-describedby", "scheduler-kbd-event"), a && i.classList.add("selected");
1729
+ 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(), v = c - l, g = d - s.getTime(), f = u / g * r, m = Math.max(v / g * r, 20), { height: y, gap: b, padding: M } = this.trackMetrics;
1730
+ i.style.left = `${f}px`, i.style.width = `${m}px`, i.style.top = `${M + t * (y + b)}px`, i.style.height = `${y}px`, this.applyEventColors(i, e), this.setData(i, { eventId: e.id });
1731
+ const A = this.createElement("div", "event-content"), x = this.createElement("div", "event-title");
1732
+ return x.textContent = e.title, A.appendChild(x), i.appendChild(A), this.appendResizeHandles(
1733
+ i,
1656
1734
  {
1657
1735
  id: e.id,
1658
1736
  event: e,
@@ -1664,7 +1742,7 @@ class A extends B {
1664
1742
  totalDays: 1
1665
1743
  },
1666
1744
  ["left", "right"]
1667
- ), o;
1745
+ ), i;
1668
1746
  }
1669
1747
  /**
1670
1748
  * Dashed ghost showing where the event will land. Mirrors
@@ -1679,31 +1757,31 @@ class A extends B {
1679
1757
  this.container.querySelector(".scheduler-timeline-event.preview")?.remove();
1680
1758
  const { dragState: t, previewEvent: s, options: r } = this.state;
1681
1759
  if (!s) return;
1682
- const n = t?.event?.id ?? this.state.keyboardMoveEventId, i = this.previewRowKey();
1683
- if (!i) return;
1684
- const a = this.rowElements.get(i)?.querySelector(".scheduler-timeline-events");
1760
+ const n = t?.event?.id ?? this.state.keyboardMoveEventId, o = this.previewRowKey();
1761
+ if (!o) return;
1762
+ const a = this.rowElements.get(o)?.querySelector(".scheduler-timeline-events");
1685
1763
  if (!a) return;
1686
1764
  const d = h.getTimeSlots(
1687
1765
  e[0],
1688
1766
  r.slotDuration,
1689
1767
  r.slotMinTime,
1690
1768
  r.slotMaxTime
1691
- ).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");
1692
- v.style.left = `${(m - c.getTime()) / f * d}px`, v.style.width = `${Math.max((g - m) / f * d, 20)}px`;
1769
+ ).length * 7 * this.slotWidth, c = e[0], u = c.getTime() + 10080 * 60 * 1e3, v = Math.max(s.start.getTime(), c.getTime()), g = Math.min(s.end.getTime(), u), f = u - c.getTime(), m = this.createElement("div", "scheduler-timeline-event", "preview");
1770
+ m.style.left = `${(v - c.getTime()) / f * d}px`, m.style.width = `${Math.max((g - v) / f * d, 20)}px`;
1693
1771
  const y = n ? (
1694
1772
  // dataset match rather than an attribute selector: event ids are
1695
1773
  // consumer-supplied and would need CSS escaping.
1696
1774
  Array.from(
1697
1775
  a.querySelectorAll(".scheduler-timeline-event:not(.preview)")
1698
- ).find((w) => w.dataset.eventId === n)
1776
+ ).find((b) => b.dataset.eventId === n)
1699
1777
  ) : void 0;
1700
1778
  if (y)
1701
- v.style.top = y.style.top, v.style.height = y.style.height;
1779
+ m.style.top = y.style.top, m.style.height = y.style.height;
1702
1780
  else {
1703
- const { height: w, padding: x } = this.trackMetrics;
1704
- v.style.top = `${x}px`, v.style.height = `${w}px`;
1781
+ const { height: b, padding: M } = this.trackMetrics;
1782
+ m.style.top = `${M}px`, m.style.height = `${b}px`;
1705
1783
  }
1706
- a.appendChild(v);
1784
+ a.appendChild(m);
1707
1785
  }
1708
1786
  /**
1709
1787
  * Which row a drag/preview is currently addressing.
@@ -1724,9 +1802,9 @@ class A extends B {
1724
1802
  const { dragState: e, previewEvent: t } = this.state;
1725
1803
  if (!t) return;
1726
1804
  if (t.resourceId !== void 0)
1727
- return t.resourceId ?? P;
1805
+ return t.resourceId ?? z;
1728
1806
  const s = e?.event?.id ?? this.state.keyboardMoveEventId, r = s ? this.state.events.find((n) => n.id === s) : void 0;
1729
- return r ? r.resourceId ?? P : this.state.selectionResourceId ?? this.state.focusedResourceId ?? void 0;
1807
+ return r ? r.resourceId ?? z : this.state.selectionResourceId ?? this.state.focusedResourceId ?? void 0;
1730
1808
  }
1731
1809
  update(e) {
1732
1810
  const t = this.state.date.getTime() !== e.date.getTime(), s = this.optionsRequireRerender(this.state.options, e.options), r = this.state.resources !== e.resources || this.state.collapsedGroups !== e.collapsedGroups || this.state.resolvedPermissions !== e.resolvedPermissions || this.hasUnassignedRow(this.state) !== this.hasUnassignedRow(e);
@@ -1735,7 +1813,7 @@ class A extends B {
1735
1813
  return;
1736
1814
  }
1737
1815
  this.updateGreyedSlots();
1738
- const n = h.getWeekDays(e.date, e.options.firstDayOfWeek);
1816
+ const n = h.getWeekDays(e.date, this.firstDayOfWeek);
1739
1817
  this.renderEvents(n), this.renderPreviewEvent(n), this.updateCellFocusAndSelection();
1740
1818
  }
1741
1819
  optionsRequireRerender(e, t) {
@@ -1743,18 +1821,18 @@ class A extends B {
1743
1821
  }
1744
1822
  updateGreyedSlots() {
1745
1823
  const { dragState: e, previewEvent: t } = this.state;
1746
- 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;
1824
+ if (this.container.querySelectorAll(".scheduler-timeline-slot").forEach((o) => o.classList.remove("greyed")), this.container.querySelectorAll(".scheduler-timeline-row.drop-target").forEach((o) => o.classList.remove("drop-target")), !e || !t) return;
1747
1825
  const r = this.previewRowKey(), n = r ? this.rowElements.get(r) : void 0;
1748
- n && (n.classList.add("drop-target"), n.querySelectorAll(".scheduler-timeline-slot").forEach((i) => {
1749
- const o = new Date(i.dataset.start ?? ""), a = new Date(i.dataset.end ?? "");
1750
- o < t.end && a > t.start && i.classList.add("greyed");
1826
+ n && (n.classList.add("drop-target"), n.querySelectorAll(".scheduler-timeline-slot").forEach((o) => {
1827
+ const i = new Date(o.dataset.start ?? ""), a = new Date(o.dataset.end ?? "");
1828
+ i < t.end && a > t.start && o.classList.add("greyed");
1751
1829
  }));
1752
1830
  }
1753
1831
  destroy() {
1754
1832
  this.onColumnDragEnd(), this.rowElements.clear(), this.clearContainer();
1755
1833
  }
1756
1834
  }
1757
- const xe = J(`@charset "UTF-8";
1835
+ const Ae = ne(`@charset "UTF-8";
1758
1836
  /* Layering ladder. Nothing between :host and the events establishes a
1759
1837
  stacking context, so every one of these competes in ONE shared context
1760
1838
  across the whole shadow root — a selected event in one day column is
@@ -1790,8 +1868,11 @@ const xe = J(`@charset "UTF-8";
1790
1868
  --scheduler-timeline-track-gap: 2px;
1791
1869
  --scheduler-timeline-row-padding: 2px;
1792
1870
  /* Pinned resource column. Capped so it can never swallow the grid on a narrow
1793
- viewport (AG Grid applies the same guard by auto-unpinning). */
1794
- --scheduler-resource-column-width: min(200px, calc(100% - 50px));
1871
+ viewport (AG Grid applies the same guard by auto-unpinning).
1872
+ 140px, down from 200px: the four inline action controls that used to need
1873
+ 102px of it are now behind one 24px trigger, so the title gets MORE room in
1874
+ a narrower column than it had in the wide one. */
1875
+ --scheduler-resource-column-width: min(140px, calc(100% - 50px));
1795
1876
  --scheduler-resize-glyph-size: 14px;
1796
1877
  --scheduler-resize-glyph-color: var(--bs-body-color, #212529);
1797
1878
  --scheduler-resize-glyph-bg: var(--bs-body-bg, #fff);
@@ -2072,11 +2153,20 @@ const xe = J(`@charset "UTF-8";
2072
2153
  text-overflow: ellipsis;
2073
2154
  }
2074
2155
 
2075
- /* Prevent browser from handling touch gestures on events (enables drag) */
2156
+ /* Prevent browser from handling touch gestures on events (enables drag).
2157
+ The three suppression properties beneath touch-action are the same recipe
2158
+ .dock-tab uses to run an identical 600ms long-press drag: without them iOS
2159
+ raises the selection magnifier over the event partway through the hold. They
2160
+ do NOT stop the contextmenu event itself — that is arbitrated in JS, see
2161
+ MpScheduler.handleContextMenu — they stop the selection UI that would appear
2162
+ alongside it. */
2076
2163
  .scheduler-event:not(.preview),
2077
2164
  .scheduler-timeline-event:not(.preview) {
2078
2165
  touch-action: none;
2079
2166
  -ms-touch-action: none;
2167
+ user-select: none;
2168
+ -webkit-user-select: none;
2169
+ -webkit-touch-callout: none;
2080
2170
  }
2081
2171
 
2082
2172
  .scheduler-event:hover {
@@ -2787,6 +2877,34 @@ const xe = J(`@charset "UTF-8";
2787
2877
  font-size: 12px;
2788
2878
  }
2789
2879
 
2880
+ /* The DAY header row only — this class is shared with the 336 per-slot time
2881
+ labels, which must keep their centred, non-sticky behaviour. */
2882
+ .scheduler-timeline-slot-header.day {
2883
+ text-align: start;
2884
+ }
2885
+
2886
+ /* Pin the date to the left edge of the scrollport so it stays readable for the
2887
+ whole day, instead of only while the middle of a 2400px column is on screen.
2888
+
2889
+ The offset is the resource column, NOT 0: the corner cell is \`sticky; left: 0\`
2890
+ at $z-sticky-column, so a label stuck at 0 would slide underneath it and be
2891
+ invisible for the last stretch of each day. Reading the same custom property
2892
+ the column resizer writes means a user-dragged column keeps this in sync for
2893
+ free. Logical property so RTL pins to the right edge.
2894
+
2895
+ Sticky INSIDE the sticky header block is fine — that one sticks on \`top\`,
2896
+ this on the inline axis, so they do not compete. Verified in Chromium: the
2897
+ label pins at the column edge, hands off cleanly to the next day at the
2898
+ boundary, never leaves its own cell, and passes UNDER the corner column. */
2899
+ .scheduler-timeline-slot-header.day .day-label {
2900
+ position: sticky;
2901
+ inset-inline-start: var(--scheduler-resource-column-width);
2902
+ display: inline-block;
2903
+ /* Opaque so the outgoing label cannot show through the incoming one during
2904
+ the hand-off at a day boundary. */
2905
+ background: var(--scheduler-header-bg);
2906
+ }
2907
+
2790
2908
  .scheduler-timeline-body {
2791
2909
  display: flex;
2792
2910
  flex-direction: column;
@@ -2831,11 +2949,15 @@ const xe = J(`@charset "UTF-8";
2831
2949
 
2832
2950
  /* Resource-column resize separator (R15): the WAI-ARIA window splitter on the
2833
2951
  corner header's right edge. Inside the sticky corner cell, so it pins with
2834
- the column it resizes. */
2835
- .scheduler-resource-header {
2836
- position: relative;
2837
- }
2838
-
2952
+ the column it resizes.
2953
+
2954
+ NOTE: this block used to re-declare \`.scheduler-resource-header { position:
2955
+ relative }\` so the absolutely-positioned resizer below had a containing block.
2956
+ That silently un-stuck BOTH corner cells — same specificity as the sticky
2957
+ declaration above, later in the file, so \`relative\` won — and the two header
2958
+ cells scrolled away with the grid while every body row stayed pinned. It was
2959
+ never needed: \`position: sticky\` is itself a positioned value and already
2960
+ establishes the containing block the resizer wants. */
2839
2961
  .scheduler-column-resizer {
2840
2962
  position: absolute;
2841
2963
  top: 0;
@@ -2918,27 +3040,22 @@ const xe = J(`@charset "UTF-8";
2918
3040
  flex: 0 0 auto;
2919
3041
  }
2920
3042
 
2921
- /* Row actions. Hidden affordances were rejected: revealing these on hover only
2922
- would leave them undiscoverable on touch, where there is no hover. */
2923
- .scheduler-resource-actions {
2924
- display: flex;
2925
- align-items: center;
2926
- gap: 2px;
2927
- flex: 0 0 auto;
2928
- margin-left: auto;
2929
- }
2930
-
2931
- .scheduler-resource-action {
3043
+ /* The row's actions trigger. One button where four controls used to sit: they
3044
+ took 102px of a 200px column and left the title about 50px — five characters.
3045
+ Doubles as the row's colour chip, which is the first time a group's stored
3046
+ colour is painted anywhere in this column. */
3047
+ .scheduler-row-menu-button {
2932
3048
  /* 24x24 = WCAG 2.2 SC 2.5.8 minimum target size. The glyph is smaller; the
2933
3049
  button is not. */
2934
3050
  width: 24px;
2935
3051
  height: 24px;
3052
+ flex: 0 0 auto;
2936
3053
  display: flex;
2937
3054
  align-items: center;
2938
3055
  justify-content: center;
2939
3056
  padding: 0;
2940
3057
  cursor: pointer;
2941
- border: 1px solid transparent;
3058
+ border: 1px solid var(--scheduler-border-color);
2942
3059
  border-radius: 4px;
2943
3060
  background: transparent;
2944
3061
  color: inherit;
@@ -2946,18 +3063,68 @@ const xe = J(`@charset "UTF-8";
2946
3063
  line-height: 1;
2947
3064
  }
2948
3065
 
2949
- .scheduler-resource-action:hover {
2950
- background: var(--bs-secondary-bg, rgba(0, 0, 0, 0.08));
3066
+ .scheduler-row-menu-button:hover {
3067
+ filter: brightness(0.92);
2951
3068
  }
2952
3069
 
2953
- .scheduler-resource-action .action-glyph {
3070
+ .scheduler-row-menu-button .action-glyph {
2954
3071
  font-size: 14px;
2955
3072
  pointer-events: none;
2956
3073
  }
2957
3074
 
2958
- .scheduler-resource-color {
2959
- /* A native colour input is ~44px wide by default and would eat the column. */
2960
- width: 24px;
3075
+ /* Row-actions dialog. Like .scheduler-day-popover, the OverlayController writes
3076
+ \`position: fixed\` coordinates, so this must stay a top-level child of the
3077
+ shadow root — nothing above it may introduce transform/filter/contain, which
3078
+ would become its containing block and shift the panel. It is also OUTSIDE the
3079
+ grid on purpose: a dialog owned by a rowheader breaks the grid's
3080
+ owned-children contract. */
3081
+ .scheduler-row-panel {
3082
+ position: fixed;
3083
+ z-index: 21;
3084
+ min-width: 200px;
3085
+ max-width: min(280px, 90vw);
3086
+ padding: 4px;
3087
+ display: flex;
3088
+ flex-direction: column;
3089
+ gap: 2px;
3090
+ border: 1px solid var(--scheduler-border-color);
3091
+ border-radius: 6px;
3092
+ background: var(--bs-body-bg, #fff);
3093
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
3094
+ }
3095
+
3096
+ .scheduler-row-panel .row-action {
3097
+ display: flex;
3098
+ align-items: center;
3099
+ justify-content: space-between;
3100
+ gap: 8px;
3101
+ /* 32px, comfortably over the 24px minimum: these are the primary targets on a
3102
+ phone now, not a secondary affordance. */
3103
+ min-height: 32px;
3104
+ padding: 4px 8px;
3105
+ border: 1px solid transparent;
3106
+ border-radius: 4px;
3107
+ background: transparent;
3108
+ color: inherit;
3109
+ font: inherit;
3110
+ font-size: 13px;
3111
+ text-align: start;
3112
+ cursor: pointer;
3113
+ }
3114
+
3115
+ .scheduler-row-panel .row-action:hover {
3116
+ background: var(--bs-secondary-bg, rgba(0, 0, 0, 0.08));
3117
+ }
3118
+
3119
+ .scheduler-row-panel .row-action.is-destructive {
3120
+ color: var(--bs-danger, #dc3545);
3121
+ }
3122
+
3123
+ .scheduler-row-panel .row-color-input {
3124
+ /* A native colour input is ~44px wide by default. It stays native: the
3125
+ platform gives it keyboard operation, localization and an accessible name
3126
+ for free, and a dialog (unlike a menu) may legally own a form control. */
3127
+ width: 40px;
2961
3128
  height: 24px;
2962
3129
  padding: 0;
2963
3130
  border: 1px solid var(--scheduler-border-color);
@@ -3000,12 +3167,25 @@ const xe = J(`@charset "UTF-8";
3000
3167
  background: var(--bs-secondary-bg, rgba(0, 0, 0, 0.08));
3001
3168
  }
3002
3169
 
3170
+ /* Narrow mode stacks the two creation buttons instead of leaving them to wrap.
3171
+ \`flex-wrap: wrap\` only broke the row when the strings happened not to fit —
3172
+ an accident of font metrics that stopped working the moment the column
3173
+ narrowed or the labels were translated shorter. The signal is the same
3174
+ ResizeObserver that drives the header ([data-narrow] on .scheduler-container),
3175
+ keyed off COMPONENT width because the scheduler can sit in a dock pane far
3176
+ narrower than the viewport. */
3177
+ .scheduler-container[data-narrow] .scheduler-timeline-addbar {
3178
+ flex-direction: column;
3179
+ align-items: stretch;
3180
+ }
3181
+
3003
3182
  /* One focus ring for every control in the resource column. \`.expand-toggle\` had
3004
3183
  none at all — Bootstrap's focus-ring utilities do not cross the shadow
3005
3184
  boundary, so a keyboard user tabbing onto it saw nothing. */
3006
3185
  .scheduler-resource-cell .expand-toggle:focus-visible,
3007
- .scheduler-resource-action:focus-visible,
3008
- .scheduler-resource-color:focus-visible,
3186
+ .scheduler-row-menu-button:focus-visible,
3187
+ .scheduler-row-panel .row-action:focus-visible,
3188
+ .scheduler-row-panel .row-color-input:focus-visible,
3009
3189
  .scheduler-add-button:focus-visible {
3010
3190
  outline: 2px solid var(--bs-primary);
3011
3191
  outline-offset: 1px;
@@ -3228,7 +3408,7 @@ const xe = J(`@charset "UTF-8";
3228
3408
  animation: none !important;
3229
3409
  transition: none !important;
3230
3410
  }
3231
- }`), De = J(`.form-control {
3411
+ }`), Re = ne(`.form-control {
3232
3412
  display: block;
3233
3413
  width: 100%;
3234
3414
  padding: 0.375rem 0.75rem;
@@ -3375,14 +3555,14 @@ textarea.form-control-lg {
3375
3555
  }
3376
3556
  .form-control-color.form-control-lg {
3377
3557
  height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2));
3378
- }`), _ = {
3558
+ }`), J = {
3379
3559
  dragThreshold: 5,
3380
3560
  minDurationMs: 1800 * 1e3
3381
3561
  // 30 minutes
3382
3562
  };
3383
- class Se {
3563
+ class Pe {
3384
3564
  constructor(e = {}) {
3385
- this.config = { ..._, ...e };
3565
+ this.config = { ...J, ...e };
3386
3566
  }
3387
3567
  /**
3388
3568
  * Calculate the preview event position based on drag state.
@@ -3428,10 +3608,10 @@ class Se {
3428
3608
  * Preserves event duration, applies offset from drag start.
3429
3609
  */
3430
3610
  calculateMovePreview(e, t, s) {
3431
- const r = t.start.getTime() - e.start.getTime(), n = s.end.getTime() - s.start.getTime(), i = new Date(s.start.getTime() + r), o = new Date(i.getTime() + n), a = t.resourceId !== void 0 ? t.resourceId : s.resourceId;
3611
+ const r = t.start.getTime() - e.start.getTime(), n = s.end.getTime() - s.start.getTime(), o = new Date(s.start.getTime() + r), i = new Date(o.getTime() + n), a = t.resourceId !== void 0 ? t.resourceId : s.resourceId;
3432
3612
  return {
3433
- start: i,
3434
- end: o,
3613
+ start: o,
3614
+ end: i,
3435
3615
  ...a !== void 0 ? { resourceId: a } : {}
3436
3616
  };
3437
3617
  }
@@ -3458,7 +3638,7 @@ class Se {
3458
3638
  return { start: t.start, end: r };
3459
3639
  }
3460
3640
  }
3461
- function O(p) {
3641
+ function B(p) {
3462
3642
  return {
3463
3643
  pointerId: 0,
3464
3644
  pointerType: "mouse",
@@ -3469,7 +3649,7 @@ function O(p) {
3469
3649
  isPrimary: !0
3470
3650
  };
3471
3651
  }
3472
- function q(p) {
3652
+ function Y(p) {
3473
3653
  const e = p.touches[0] || p.changedTouches[0];
3474
3654
  return e ? {
3475
3655
  pointerId: e.identifier,
@@ -3481,13 +3661,13 @@ function q(p) {
3481
3661
  isPrimary: e.identifier === 0
3482
3662
  } : null;
3483
3663
  }
3484
- function se(p, e) {
3664
+ function ce(p, e) {
3485
3665
  const t = e.x - p.x, s = e.y - p.y;
3486
3666
  return Math.sqrt(t * t + s * s);
3487
3667
  }
3488
- class Ce {
3668
+ class Fe {
3489
3669
  constructor(e = {}) {
3490
- this.state = { phase: "idle" }, this.config = { ..._, ...e }, this.previewCalculator = new Se(this.config);
3670
+ this.state = { phase: "idle" }, this.config = { ...J, ...e }, this.previewCalculator = new Pe(this.config);
3491
3671
  }
3492
3672
  /**
3493
3673
  * Get current state (read-only).
@@ -3580,20 +3760,20 @@ class Ce {
3580
3760
  transitionFromIdle(e) {
3581
3761
  if (e.type !== "POINTER_DOWN")
3582
3762
  return this.state;
3583
- const { target: t, position: s, slot: r, slotElement: n, immediate: i } = e, o = this.getOperationType(t);
3584
- if (!o)
3763
+ const { target: t, position: s, slot: r, slotElement: n, immediate: o } = e, i = this.getOperationType(t);
3764
+ if (!i)
3585
3765
  return this.state;
3586
3766
  const a = t.event ?? null;
3587
3767
  if (a && a.draggable === !1)
3588
3768
  return this.state;
3589
- if (i) {
3769
+ if (o) {
3590
3770
  let l = r;
3591
3771
  if (!l && a && (l = {
3592
3772
  start: a.start,
3593
3773
  end: a.end
3594
3774
  }), l) {
3595
3775
  const d = this.previewCalculator.calculatePreview(
3596
- o,
3776
+ i,
3597
3777
  l,
3598
3778
  l,
3599
3779
  a
@@ -3601,7 +3781,7 @@ class Ce {
3601
3781
  if (d)
3602
3782
  return {
3603
3783
  phase: "active",
3604
- operationType: o,
3784
+ operationType: i,
3605
3785
  event: a,
3606
3786
  startSlot: l,
3607
3787
  currentSlot: l,
@@ -3612,7 +3792,7 @@ class Ce {
3612
3792
  }
3613
3793
  return {
3614
3794
  phase: "pending",
3615
- operationType: o,
3795
+ operationType: i,
3616
3796
  event: a,
3617
3797
  startPosition: s,
3618
3798
  startSlot: r,
@@ -3626,7 +3806,7 @@ class Ce {
3626
3806
  if (this.state.phase !== "pending") return this.state;
3627
3807
  switch (e.type) {
3628
3808
  case "POINTER_MOVE":
3629
- return se(
3809
+ return ce(
3630
3810
  this.state.startPosition,
3631
3811
  e.position
3632
3812
  ) < this.config.dragThreshold ? this.state : this.activateDrag(e.slot);
@@ -3744,9 +3924,9 @@ class Ce {
3744
3924
  } : { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date() };
3745
3925
  }
3746
3926
  }
3747
- class ke {
3927
+ class Le {
3748
3928
  constructor(e, t = {}) {
3749
- this.pendingUpdate = null, this.latestPointer = null, this.getSlotAtPosition = null, this.stateManager = e, this.config = { ..._, ...t }, this.stateMachine = new Ce(this.config);
3929
+ this.pendingUpdate = null, this.latestPointer = null, this.getSlotAtPosition = null, this.stateManager = e, this.config = { ...J, ...t }, this.stateMachine = new Fe(this.config);
3750
3930
  }
3751
3931
  /**
3752
3932
  * Set the function used to get a slot at a position.
@@ -3837,7 +4017,7 @@ class ke {
3837
4017
  */
3838
4018
  createEventFromResult(e) {
3839
4019
  return {
3840
- id: le(),
4020
+ id: fe(),
3841
4021
  title: "New Event",
3842
4022
  start: e.preview.start,
3843
4023
  end: e.preview.end,
@@ -3890,10 +4070,20 @@ class ke {
3890
4070
  this.pendingUpdate !== null && (cancelAnimationFrame(this.pendingUpdate), this.pendingUpdate = null), this.latestPointer = null;
3891
4071
  }
3892
4072
  }
3893
- const Me = 600, Te = 10;
3894
- class Ie {
4073
+ const ze = 600, $e = 10;
4074
+ class He {
3895
4075
  constructor(e, t) {
3896
- 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);
4076
+ 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);
4077
+ }
4078
+ /**
4079
+ * True when the gesture in progress came from a finger.
4080
+ *
4081
+ * The caller is `contextmenu` arbitration: on touch the browser fires that
4082
+ * event ~100ms before our 600ms hold arms, so acting on it would make
4083
+ * hold-to-drag unreachable.
4084
+ */
4085
+ isTouchGesture() {
4086
+ return this.lastPointerType === "touch";
3897
4087
  }
3898
4088
  /**
3899
4089
  * Attach all event listeners.
@@ -3925,13 +4115,13 @@ class Ie {
3925
4115
  analyzeTarget(e) {
3926
4116
  const t = e.closest(".resize-handle");
3927
4117
  if (t) {
3928
- const i = t.closest(
4118
+ const o = t.closest(
3929
4119
  ".scheduler-event, .scheduler-timeline-event"
3930
- )?.dataset.eventId, o = i ? this.config.getEventById(i) : null;
3931
- if (o)
4120
+ )?.dataset.eventId, i = o ? this.config.getEventById(o) : null;
4121
+ if (i)
3932
4122
  return {
3933
4123
  type: "resize-handle",
3934
- event: o,
4124
+ event: i,
3935
4125
  resizeHandle: t.dataset.handle
3936
4126
  };
3937
4127
  }
@@ -3939,9 +4129,9 @@ class Ie {
3939
4129
  ".scheduler-event:not(.preview), .scheduler-timeline-event:not(.preview)"
3940
4130
  );
3941
4131
  if (s) {
3942
- const n = s.dataset.eventId, i = n ? this.config.getEventById(n) : null;
3943
- if (i)
3944
- return { type: "event", event: i };
4132
+ const n = s.dataset.eventId, o = n ? this.config.getEventById(n) : null;
4133
+ if (o)
4134
+ return { type: "event", event: o };
3945
4135
  }
3946
4136
  const r = e.closest(
3947
4137
  ".scheduler-time-slot, .scheduler-timeline-slot"
@@ -3950,69 +4140,69 @@ class Ie {
3950
4140
  }
3951
4141
  // Mouse event handlers
3952
4142
  handleMouseDown(e) {
3953
- if (!this.config.isEditable()) return;
3954
- const t = O(e), s = this.analyzeTarget(t.target);
4143
+ if (this.lastPointerType = "mouse", !this.config.isEditable()) return;
4144
+ const t = B(e), s = this.analyzeTarget(t.target);
3955
4145
  s.type !== "none" && (s.type === "slot" && !this.config.isSelectable() || (e.preventDefault(), this.callbacks.onPointerDown(t, s)));
3956
4146
  }
3957
4147
  handleMouseMove(e) {
3958
- const t = O(e);
4148
+ const t = B(e);
3959
4149
  this.callbacks.onPointerMove(t);
3960
4150
  }
3961
4151
  handleMouseUp(e) {
3962
- const t = O(e);
4152
+ const t = B(e);
3963
4153
  this.callbacks.onPointerUp(t);
3964
4154
  }
3965
4155
  handleClick(e) {
3966
- const t = O(e), s = this.analyzeTarget(t.target);
4156
+ const t = B(e), s = this.analyzeTarget(t.target);
3967
4157
  s.type === "event" || s.type === "resize-handle" || this.callbacks.onClick(t, s);
3968
4158
  }
3969
4159
  handleDblClick(e) {
3970
- const t = O(e), s = this.analyzeTarget(t.target);
4160
+ const t = B(e), s = this.analyzeTarget(t.target);
3971
4161
  this.callbacks.onDoubleClick(t, s);
3972
4162
  }
3973
4163
  // Touch event handlers
3974
4164
  handleTouchStart(e) {
3975
- if (!this.config.isEditable()) return;
4165
+ if (this.lastPointerType = "touch", !this.config.isEditable()) return;
3976
4166
  if (e.touches.length !== 1) {
3977
4167
  this.cancelTouchHold();
3978
4168
  return;
3979
4169
  }
3980
- const t = q(e);
4170
+ const t = Y(e);
3981
4171
  if (!t) return;
3982
4172
  const s = this.analyzeTarget(t.target);
3983
4173
  if (s.type === "none" || s.type === "slot" && !this.config.isSelectable()) return;
3984
4174
  this.touchStartPosition = { x: t.clientX, y: t.clientY }, this.touchHoldTarget = t.target, this.touchHoldPointer = t, this.panStartedOnEvent = s.type === "event" || s.type === "resize-handle";
3985
4175
  const r = this, n = e.target;
3986
- if (n.addEventListener("touchmove", function(o) {
3987
- r.handleTouchMove(o);
3988
- }, { passive: !1 }), n.addEventListener("touchend", function(o) {
3989
- r.handleTouchEnd(o);
3990
- }), n.addEventListener("touchcancel", function(o) {
3991
- r.handleTouchCancel(o);
4176
+ if (n.addEventListener("touchmove", function(i) {
4177
+ r.handleTouchMove(i);
4178
+ }, { passive: !1 }), n.addEventListener("touchend", function(i) {
4179
+ r.handleTouchEnd(i);
4180
+ }), n.addEventListener("touchcancel", function(i) {
4181
+ r.handleTouchCancel(i);
3992
4182
  }), s.type === "resize-handle" && s.event && this.config.isEventSelected?.(s.event.id)) {
3993
4183
  this.activateTouchDragMode(t, s);
3994
4184
  return;
3995
4185
  }
3996
4186
  this.addTouchFeedback(t.target, "pending");
3997
- const i = this.config.touchHoldDuration ?? Me;
4187
+ const o = this.config.touchHoldDuration ?? ze;
3998
4188
  this.touchHoldTimer = setTimeout(() => {
3999
4189
  this.activateTouchDragMode(t, s);
4000
- }, i);
4190
+ }, o);
4001
4191
  }
4002
4192
  handleTouchMove(e) {
4003
4193
  if (e.touches.length !== 1) {
4004
4194
  this.cancelTouchHold(), this.exitPanMode();
4005
4195
  return;
4006
4196
  }
4007
- const t = q(e);
4197
+ const t = Y(e);
4008
4198
  if (t) {
4009
4199
  if (this.isPanMode) {
4010
4200
  e.preventDefault(), this.performPan(t.clientX, t.clientY);
4011
4201
  return;
4012
4202
  }
4013
4203
  if (this.touchHoldTimer && this.touchStartPosition) {
4014
- const s = this.config.touchMoveThreshold ?? Te;
4015
- if (se(this.touchStartPosition, {
4204
+ const s = this.config.touchMoveThreshold ?? $e;
4205
+ if (ce(this.touchStartPosition, {
4016
4206
  x: t.clientX,
4017
4207
  y: t.clientY
4018
4208
  }) > s) {
@@ -4026,7 +4216,7 @@ class Ie {
4026
4216
  }
4027
4217
  }
4028
4218
  handleTouchEnd(e) {
4029
- const t = q(e);
4219
+ const t = Y(e);
4030
4220
  if (this.isPanMode) {
4031
4221
  this.exitPanMode();
4032
4222
  return;
@@ -4054,7 +4244,12 @@ class Ie {
4054
4244
  }
4055
4245
  // Touch helpers
4056
4246
  activateTouchDragMode(e, t) {
4057
- 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(), this.callbacks.onTouchDragActivated?.(), this.callbacks.onPointerDown(e, t, !0);
4247
+ 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")
4248
+ try {
4249
+ navigator.vibrate(10);
4250
+ } catch {
4251
+ }
4252
+ this.callbacks.onTouchDragActivated?.(), this.callbacks.onPointerDown(e, t, !0);
4058
4253
  }
4059
4254
  cancelTouchHold() {
4060
4255
  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"));
@@ -4107,7 +4302,7 @@ class Ie {
4107
4302
  e && e.classList.remove("scroll-blocked");
4108
4303
  }
4109
4304
  }
4110
- class Ae {
4305
+ class Oe {
4111
4306
  constructor(e) {
4112
4307
  this.host = e;
4113
4308
  }
@@ -4207,10 +4402,10 @@ class Ae {
4207
4402
  this.emit({ type: "resource-delete", resource: e, originalEvent: t });
4208
4403
  }
4209
4404
  }
4210
- let Re = 0;
4211
- class F extends re {
4405
+ let Ne = 0;
4406
+ class $ extends he {
4212
4407
  constructor() {
4213
- 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 ne(this), this.popoverDate = null, this.popoverScope = "day", this.popoverAnchorId = null, this.dayPopover = new Y(this, {
4408
+ 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, {
4214
4409
  anchor: () => this.popoverAnchorCell(),
4215
4410
  // Same element as the anchor: the day cell IS the trigger. Spelling it out
4216
4411
  // means focus returns to the day even when the popover was opened without
@@ -4231,7 +4426,16 @@ class F extends re {
4231
4426
  onClose: () => {
4232
4427
  this.popoverDate = null, this.popoverAnchorId = null, this.requestUpdate();
4233
4428
  }
4234
- }), this.editorEventId = null, this.editorError = null, this.editorTitleErrorId = `mp-scheduler-${++Re}-editor-title-error`, this.eventEditorOverlay = new Y(this, {
4429
+ }), this.rowMenuResourceId = null, this.rowMenuOverlay = new _(this, {
4430
+ anchor: () => this.rowMenuTriggerById(this.rowMenuResourceId),
4431
+ trigger: () => this.rowMenuTriggerById(this.rowMenuResourceId),
4432
+ panel: () => this.shadowRoot?.querySelector(".scheduler-row-panel") ?? null,
4433
+ initialFocus: () => this.shadowRoot?.querySelector(".scheduler-row-panel .row-action") ?? null,
4434
+ modal: !1,
4435
+ onClose: () => {
4436
+ this.rowMenuResourceId = null, this.requestUpdate(), this.syncRowMenuTriggerState();
4437
+ }
4438
+ }), this.editorEventId = null, this.editorError = null, this.editorTitleErrorId = `mp-scheduler-${++Ne}-editor-title-error`, this.eventEditorOverlay = new _(this, {
4235
4439
  anchor: () => this.eventElementById(this.editorEventId),
4236
4440
  trigger: () => this.eventElementById(this.editorEventId),
4237
4441
  panel: () => this.shadowRoot?.querySelector(".scheduler-event-editor") ?? null,
@@ -4242,10 +4446,10 @@ class F extends re {
4242
4446
  onClose: () => {
4243
4447
  this.editorEventId = null, this.editorError = null, this.editorDraft = null, this.requestUpdate();
4244
4448
  }
4245
- }), this.editorDraft = null, this.headerResizeObserver = null, this.headerIsNarrow = !1, this.previousIsLoading = null, this.edgeScrollFrame = null, this.edgeScrollVector = { x: 0, y: 0 }, this.edgeScrollPointer = null, this.lastEventActivation = null, this.keyboardMove = null, this.stateManager = new pe(), this.eventEmitter = new Ae(this), this.dragManager = new ke(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));
4449
+ }), 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 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));
4246
4450
  }
4247
4451
  static {
4248
- this.styles = [De, de, xe];
4452
+ this.styles = [Re, ye, Ae];
4249
4453
  }
4250
4454
  static get observedAttributes() {
4251
4455
  return [
@@ -4281,9 +4485,7 @@ class F extends re {
4281
4485
  case "first-day-of-week":
4282
4486
  if (s) {
4283
4487
  const r = parseInt(s, 10);
4284
- r >= 0 && r <= 6 && this.stateManager.setOptions({
4285
- firstDayOfWeek: r
4286
- });
4488
+ Number.isInteger(r) && r >= 0 && r <= 7 && this.stateManager.setOptions({ firstDayOfWeek: r % 7 });
4287
4489
  }
4288
4490
  break;
4289
4491
  case "slot-duration":
@@ -4426,9 +4628,27 @@ class F extends re {
4426
4628
  * Localized string lookup: options.messages overrides merged onto the
4427
4629
  * English defaults, with {placeholder} interpolation.
4428
4630
  */
4631
+ /**
4632
+ * Which keymap the grid advertises (audit M6). The keys genuinely differ per
4633
+ * view, so the single global string was not merely vague — it was false: it
4634
+ * promised that Enter creates an event, which in year view opens the month
4635
+ * instead, and it never mentioned Space, the only way to reach the popover
4636
+ * in month or year.
4637
+ */
4638
+ gridInstructionsKey() {
4639
+ const e = this.can("createEvent") || this.can("selectRange");
4640
+ switch (this.stateManager.getState().view) {
4641
+ case "year":
4642
+ return "gridInstructionsYear";
4643
+ case "month":
4644
+ return e ? "gridInstructionsMonth" : "gridInstructionsMonthReadOnly";
4645
+ default:
4646
+ return e ? "gridInstructions" : "gridInstructionsReadOnly";
4647
+ }
4648
+ }
4429
4649
  msg(e, t) {
4430
- return S(
4431
- E(this.stateManager.getState().options.messages)[e],
4650
+ return E(
4651
+ w(this.stateManager.getState().options.messages)[e],
4432
4652
  t
4433
4653
  );
4434
4654
  }
@@ -4436,13 +4656,13 @@ class F extends re {
4436
4656
  // Rendering
4437
4657
  // ============================================
4438
4658
  render() {
4439
- return D`
4659
+ return S`
4440
4660
  <div class="scheduler-container">
4441
4661
  <header class="scheduler-header"></header>
4442
4662
  <div class="scheduler-content"></div>
4443
4663
  </div>
4444
4664
  <div id="scheduler-kbd-grid" class="visually-hidden">
4445
- ${this.msg(this.can("createEvent") || this.can("selectRange") ? "gridInstructions" : "gridInstructionsReadOnly")}
4665
+ ${this.msg(this.gridInstructionsKey())}
4446
4666
  </div>
4447
4667
  <div id="scheduler-kbd-event" class="visually-hidden">
4448
4668
  ${this.msg(
@@ -4450,6 +4670,7 @@ class F extends re {
4450
4670
  )}
4451
4671
  </div>
4452
4672
  ${this.renderDayPopover()}
4673
+ ${this.renderRowMenu()}
4453
4674
  ${this.renderEventEditor()}
4454
4675
  ${this.liveAnnouncer.template()}
4455
4676
  `;
@@ -4469,19 +4690,153 @@ class F extends re {
4469
4690
  * is `event-selected`, "New event" is `event-create`, "Show day" is the same
4470
4691
  * drill the "+N more" link used to do.
4471
4692
  */
4693
+ /**
4694
+ * The open panel's trigger, resolved by id because the timeline rebuilds its
4695
+ * DOM on every state change.
4696
+ *
4697
+ * Matched by reading `dataset` rather than by building an attribute selector:
4698
+ * a resource id is consumer data and may contain quotes or brackets, and
4699
+ * `CSS.escape` is not available everywhere (jsdom has no `CSS` global at all,
4700
+ * which threw here). Scanning a handful of buttons costs nothing.
4701
+ */
4702
+ rowMenuTriggerById(e) {
4703
+ if (!e) return null;
4704
+ const t = this.shadowRoot?.querySelectorAll(".scheduler-row-menu-button");
4705
+ if (!t) return null;
4706
+ for (const s of t)
4707
+ if (s.dataset.resourceId === e) return s;
4708
+ return null;
4709
+ }
4710
+ /**
4711
+ * `aria-expanded` belongs on the trigger and must change in the same beat as
4712
+ * the visual state. The trigger is imperative DOM (the timeline builds it), so
4713
+ * it cannot ride Lit's render — it is written here and re-asserted after every
4714
+ * rebuild.
4715
+ */
4716
+ syncRowMenuTriggerState() {
4717
+ this.shadowRoot?.querySelectorAll(".scheduler-row-menu-button").forEach((e) => {
4718
+ const t = e.dataset.resourceId === this.rowMenuResourceId;
4719
+ e.setAttribute("aria-expanded", String(t));
4720
+ });
4721
+ }
4722
+ /** Move focus from the focused cell onto its row's actions trigger. */
4723
+ focusRowTrigger() {
4724
+ const e = this.stateManager.getState().focusedResourceId;
4725
+ this.rowMenuTriggerById(e ?? null)?.focus();
4726
+ }
4727
+ /**
4728
+ * Keys while the row's trigger has focus. It sits outside the roving cell
4729
+ * model, so it needs its own small map: open, or hand focus back to the grid.
4730
+ */
4731
+ handleRowTriggerKeyDown(e, t) {
4732
+ const s = t.dataset.resourceId;
4733
+ switch (e.key) {
4734
+ case "Enter":
4735
+ case " ":
4736
+ return e.preventDefault(), s && this.openRowMenu(s), !0;
4737
+ case "ArrowRight":
4738
+ case "Escape":
4739
+ return e.preventDefault(), this.focusFocusedCell(), !0;
4740
+ default:
4741
+ return !1;
4742
+ }
4743
+ }
4744
+ /**
4745
+ * Open the actions panel for a row, or re-target it if another row's is open.
4746
+ *
4747
+ * `OverlayController.open()` is a no-op while already open, and the anchor is
4748
+ * resolved lazily by id — so simply changing the id repainted the panel's
4749
+ * CONTENTS for the new row while leaving it positioned under the previous
4750
+ * row's trigger. The outside-mousedown dismissal cannot break the tie either:
4751
+ * it ignores any press whose composed path includes the host, and every
4752
+ * trigger is inside the host. Nothing was going to close it.
4753
+ *
4754
+ * So a different row is treated as what it is — a different dialog: close,
4755
+ * then open. `close(false)` deliberately does NOT return focus, because the
4756
+ * user's focus is already on the new trigger; handing it back to the old one
4757
+ * would flicker, and would make the following `open()` capture the wrong
4758
+ * element as its Escape target.
4759
+ */
4760
+ openRowMenu(e) {
4761
+ if (this.rowMenuOverlay.isOpen && this.rowMenuResourceId === e) {
4762
+ this.closeRowMenu();
4763
+ return;
4764
+ }
4765
+ this.rowMenuOverlay.isOpen && this.rowMenuOverlay.close(!1), this.rowMenuResourceId = e, this.requestUpdate(), this.updateComplete.then(() => {
4766
+ this.syncRowMenuTriggerState(), this.rowMenuOverlay.open();
4767
+ });
4768
+ }
4769
+ closeRowMenu() {
4770
+ this.rowMenuOverlay.close();
4771
+ }
4772
+ /**
4773
+ * The row-actions panel. Built from the SAME permission list the trigger
4774
+ * consults, so a button never promises a panel that turns out to be empty.
4775
+ */
4776
+ renderRowMenu() {
4777
+ const e = this.rowMenuResourceId;
4778
+ if (!e) return k;
4779
+ const t = this.findResourceOrGroup(e), s = this.currentView;
4780
+ if (!t || !(s instanceof I)) return k;
4781
+ const r = s.rowActions(t);
4782
+ if (r.length === 0) return k;
4783
+ const n = w(this.stateManager.getState().options.messages), o = t, i = o.eventColor ? "eventColor" : "color", a = o.eventColor ?? t.color;
4784
+ return S`
4785
+ <div
4786
+ class="scheduler-row-panel"
4787
+ role="dialog"
4788
+ aria-label=${E(n.rowMenuDialogLabel, { title: t.title })}
4789
+ >
4790
+ ${r.map((l) => {
4791
+ if (l === "set-resource-color") {
4792
+ const c = E(n.resourceColor, { title: t.title });
4793
+ return S`
4794
+ <label class="row-action row-action-color">
4795
+ <span>${c}</span>
4796
+ <input
4797
+ type="color"
4798
+ class="row-color-input"
4799
+ aria-label=${c}
4800
+ .value=${a && /^#[0-9a-f]{6}$/i.test(a) ? a : "#000000"}
4801
+ data-action="set-resource-color"
4802
+ data-resource-id=${t.id}
4803
+ data-field=${i}
4804
+ />
4805
+ </label>
4806
+ `;
4807
+ }
4808
+ const d = l === "rename-resource" ? E(n.renameResource, { title: t.title }) : l === "add-resource" ? E(n.addResourceToGroup, { title: t.title }) : l === "add-group" ? E(n.addGroupToGroup, { title: t.title }) : E(n.removeResource, { title: t.title });
4809
+ return S`
4810
+ <button
4811
+ type="button"
4812
+ class="row-action ${l === "delete-resource" ? "is-destructive" : ""}"
4813
+ data-action=${l}
4814
+ data-parent-id=${l === "add-resource" || l === "add-group" ? t.id : k}
4815
+ data-resource-id=${l === "add-resource" || l === "add-group" ? k : t.id}
4816
+ @click=${() => {
4817
+ l !== "rename-resource" && this.closeRowMenu();
4818
+ }}
4819
+ >
4820
+ ${d}
4821
+ </button>
4822
+ `;
4823
+ })}
4824
+ </div>
4825
+ `;
4826
+ }
4472
4827
  renderDayPopover() {
4473
4828
  const e = this.popoverDate;
4474
- if (!e) return T;
4475
- const t = this.stateManager.getState(), { options: s } = t, r = this.popoverScope, n = r === "month" ? this.eventsInMonth(e) : this.eventsOnDay(e), i = r === "month" ? `${h.getMonthName(e, s.locale)} ${e.getFullYear()}` : h.formatDateWithWeekday(e, s.locale), o = [...t.resourceById.values()];
4476
- return D`
4829
+ if (!e) return k;
4830
+ const t = this.stateManager.getState(), { options: s } = t, r = this.popoverScope, n = r === "month" ? this.eventsInMonth(e) : this.eventsOnDay(e), o = r === "month" ? `${h.getMonthName(e, s.locale)} ${e.getFullYear()}` : h.formatDateWithWeekday(e, s.locale), i = [...t.resourceById.values()];
4831
+ return S`
4477
4832
  <div
4478
4833
  class="scheduler-day-popover"
4479
4834
  role="dialog"
4480
- aria-label=${this.msg("dayPopoverLabel", { date: i })}
4835
+ aria-label=${this.msg("dayPopoverLabel", { date: o })}
4481
4836
  >
4482
4837
  <div class="popover-head">
4483
4838
  <div>
4484
- <div class="popover-date">${i}</div>
4839
+ <div class="popover-date">${o}</div>
4485
4840
  <div class="popover-count">
4486
4841
  ${this.msg("dayPopoverCount", {
4487
4842
  count: n.length,
@@ -4498,30 +4853,33 @@ class F extends re {
4498
4853
  <span aria-hidden="true">×</span>
4499
4854
  </button>
4500
4855
  </div>
4501
- ${n.length === 0 ? D`<p class="popover-empty">${this.msg("dayPopoverEmpty")}</p>` : r === "month" ? this.renderPopoverDayGroups(n, s) : D`
4856
+ ${n.length === 0 ? S`<p class="popover-empty">${this.msg("dayPopoverEmpty")}</p>` : r === "month" ? this.renderPopoverDayGroups(n, s) : S`
4502
4857
  <ul class="popover-events">
4503
4858
  ${n.map((a) => this.renderPopoverEvent(a, s))}
4504
4859
  </ul>
4505
4860
  `}
4506
- ${this.can("createEvent") && o.length > 0 ? D`
4861
+ ${this.can("createEvent") && i.length > 0 ? S`
4507
4862
  <label class="popover-resource">
4508
4863
  <span class="popover-resource-label">${this.msg("newEventResource")}</span>
4509
- <mp-select class="popover-resource-select">
4864
+ <mp-select
4865
+ class="popover-resource-select"
4866
+ input-label=${this.msg("newEventResource")}
4867
+ >
4510
4868
  <option value="">${this.msg("unassignedResource")}</option>
4511
- ${o.map(
4512
- (a) => D`<option value=${a.id}>${a.title}</option>`
4869
+ ${i.map(
4870
+ (a) => S`<option value=${a.id}>${a.title}</option>`
4513
4871
  )}
4514
4872
  </mp-select>
4515
4873
  </label>
4516
- ` : T}
4874
+ ` : k}
4517
4875
  <div class="popover-actions">
4518
- ${this.can("createEvent") ? D`<button
4876
+ ${this.can("createEvent") ? S`<button
4519
4877
  type="button"
4520
4878
  class="popover-action primary"
4521
4879
  @click=${(a) => this.createFromPopover(a)}
4522
4880
  >
4523
4881
  ${this.msg("newEvent")}
4524
- </button>` : T}
4882
+ </button>` : k}
4525
4883
  <button
4526
4884
  type="button"
4527
4885
  class="popover-action"
@@ -4534,18 +4892,18 @@ class F extends re {
4534
4892
  `;
4535
4893
  }
4536
4894
  renderPopoverEvent(e, t) {
4537
- return D`
4895
+ return S`
4538
4896
  <li class="popover-event-row">
4539
4897
  <button
4540
4898
  type="button"
4541
4899
  class="popover-event"
4542
- aria-label=${$(e, null, t)}
4900
+ aria-label=${W(e, null, t)}
4543
4901
  @click=${(s) => this.selectFromPopover(e, s)}
4544
4902
  >
4545
4903
  <span
4546
4904
  class="popover-event-swatch"
4547
4905
  aria-hidden="true"
4548
- style=${`background:${U(
4906
+ style=${`background:${X(
4549
4907
  e,
4550
4908
  this.stateManager.getState().resourceById,
4551
4909
  t.defaultEventColor
@@ -4553,14 +4911,14 @@ class F extends re {
4553
4911
  ></span>
4554
4912
  <span class="popover-event-title">${e.title}</span>
4555
4913
  </button>
4556
- ${this.can("deleteEvent", e) ? D`<button
4914
+ ${this.can("deleteEvent", e) ? S`<button
4557
4915
  type="button"
4558
4916
  class="popover-event-delete"
4559
4917
  aria-label=${this.msg("deleteEventLabel", { title: e.title })}
4560
4918
  @click=${() => this.deleteFromPopover(e)}
4561
4919
  >
4562
4920
  <span aria-hidden="true">×</span>
4563
- </button>` : T}
4921
+ </button>` : k}
4564
4922
  </li>
4565
4923
  `;
4566
4924
  }
@@ -4582,14 +4940,14 @@ class F extends re {
4582
4940
  return;
4583
4941
  }
4584
4942
  const t = this.shadowRoot?.querySelector(".scheduler-day-popover"), r = (t ? [...t.querySelectorAll(".popover-event")] : []).findIndex(
4585
- (n) => n.getAttribute("aria-label") === $(e, null, this.stateManager.getState().options)
4943
+ (n) => n.getAttribute("aria-label") === W(e, null, this.stateManager.getState().options)
4586
4944
  );
4587
4945
  this.eventEmitter.emitEventDelete(e), this.updateComplete.then(
4588
4946
  () => requestAnimationFrame(() => {
4589
4947
  const n = this.shadowRoot?.querySelector(".scheduler-day-popover");
4590
4948
  if (!n) return;
4591
- const i = [...n.querySelectorAll(".popover-event")];
4592
- (i[Math.min(Math.max(r, 0), i.length - 1)] ?? n.querySelector(".popover-action") ?? n.querySelector(".popover-close"))?.focus();
4949
+ const o = [...n.querySelectorAll(".popover-event")];
4950
+ (o[Math.min(Math.max(r, 0), o.length - 1)] ?? n.querySelector(".popover-action") ?? n.querySelector(".popover-close"))?.focus();
4593
4951
  })
4594
4952
  );
4595
4953
  }
@@ -4599,22 +4957,22 @@ class F extends re {
4599
4957
  * running in from last month sits under the 1st rather than vanishing).
4600
4958
  */
4601
4959
  renderPopoverDayGroups(e, t) {
4602
- const s = this.popoverDate, r = new Date(s.getFullYear(), s.getMonth(), 1), n = e.reduce((i, o) => {
4603
- const a = o.start < r ? new Date(r) : new Date(o.start);
4960
+ const s = this.popoverDate, r = new Date(s.getFullYear(), s.getMonth(), 1), n = e.reduce((o, i) => {
4961
+ const a = i.start < r ? new Date(r) : new Date(i.start);
4604
4962
  a.setHours(0, 0, 0, 0);
4605
- const l = a.getTime(), d = i.get(l) ?? { day: a, events: [] };
4606
- return d.events.push(o), i.set(l, d);
4963
+ const l = a.getTime(), d = o.get(l) ?? { day: a, events: [] };
4964
+ return d.events.push(i), o.set(l, d);
4607
4965
  }, /* @__PURE__ */ new Map());
4608
- return D`
4966
+ return S`
4609
4967
  <ul class="popover-events popover-day-groups">
4610
4968
  ${[...n.values()].map(
4611
- (i) => D`
4969
+ (o) => S`
4612
4970
  <li class="popover-day-group">
4613
4971
  <div class="popover-day-label">
4614
- ${h.formatDateWithWeekday(i.day, t.locale)}
4972
+ ${h.formatDateWithWeekday(o.day, t.locale)}
4615
4973
  </div>
4616
4974
  <ul class="popover-events">
4617
- ${i.events.map((o) => this.renderPopoverEvent(o, t))}
4975
+ ${o.events.map((i) => this.renderPopoverEvent(i, t))}
4618
4976
  </ul>
4619
4977
  </li>
4620
4978
  `
@@ -4638,7 +4996,7 @@ class F extends re {
4638
4996
  * no date-keyed cell — the popover is a month/year surface only.
4639
4997
  */
4640
4998
  defaultPopoverAnchorId(e) {
4641
- return this.stateManager.getState().view === "year" ? `scheduler-cell-y-${N.monthKey(e)}` : `scheduler-cell-m-${z.dayKey(e)}`;
4999
+ return this.stateManager.getState().view === "year" ? `scheduler-cell-y-${U.monthKey(e)}` : `scheduler-cell-m-${N.dayKey(e)}`;
4642
5000
  }
4643
5001
  /** Every event overlapping the given local day, in start order. */
4644
5002
  eventsOnDay(e) {
@@ -4674,13 +5032,13 @@ class F extends re {
4674
5032
  "mp-select.popover-resource-select"
4675
5033
  )?.value || void 0, n = new Date(t);
4676
5034
  n.setHours(0, 0, 0, 0);
4677
- const i = new Date(n);
4678
- if (i.setDate(i.getDate() + 1), this.closeDayPopover(), !this.can("createEvent") || !this.allowsCreateAt({ start: n, end: i }, r)) {
5035
+ const o = new Date(n);
5036
+ if (o.setDate(o.getDate() + 1), this.closeDayPopover(), !this.can("createEvent") || !this.allowsCreateAt({ start: n, end: o }, r)) {
4679
5037
  this.announceDenied();
4680
5038
  return;
4681
5039
  }
4682
5040
  this.eventEmitter.emitEventCreate(
4683
- { start: n, end: i },
5041
+ { start: n, end: o },
4684
5042
  this.stateManager.getState().view,
4685
5043
  e,
4686
5044
  r
@@ -4763,15 +5121,79 @@ class F extends re {
4763
5121
  closeEventEditor() {
4764
5122
  this.editorDraft = null, this.contentContainer?.removeEventListener("scroll", this.boundRepositionEditor), this.eventEditorOverlay.close(), this.editorEventId = null, this.editorError = null, this.editorDraft = null, this.requestUpdate();
4765
5123
  }
4766
- /** Right-click on an event box opens the editor (D12.8b). */
5124
+ /**
5125
+ * Right-click on an event box opens the editor (D12.8b) — on a POINTING device
5126
+ * only.
5127
+ *
5128
+ * On touch the browser synthesizes `contextmenu` from a long-press at roughly
5129
+ * 500ms, which lands ~100ms before our own 600ms hold-to-drag arms. Acting on
5130
+ * it made dragging unreachable on a phone (R9): the editor opened every time
5131
+ * and the drag never started. So a touch-originated `contextmenu` is consumed
5132
+ * and discarded here, leaving the gesture to the hold timer.
5133
+ *
5134
+ * `preventDefault` on the touch path is what stops the *platform* menu from
5135
+ * appearing over an arming drag. It is called for every touch target, not just
5136
+ * events, because the hold timer arms on every target — a long-press on empty
5137
+ * grid arms drag-to-create, and used to do so underneath Android's own menu.
5138
+ */
4767
5139
  handleContextMenu(e) {
4768
- const s = (e.composedPath?.()[0] ?? e.target)?.closest?.(
5140
+ const t = e.composedPath?.()[0] ?? e.target;
5141
+ if (t?.closest?.("input, textarea, [contenteditable]")) return;
5142
+ if (this.isTouchContextMenu(e)) {
5143
+ e.preventDefault();
5144
+ return;
5145
+ }
5146
+ const s = t?.closest?.(
4769
5147
  "[data-event-id]:not(.preview)"
4770
5148
  );
4771
- if (!s) return;
5149
+ if (!s) {
5150
+ const o = t?.closest?.(".scheduler-resource-cell")?.querySelector?.(
5151
+ ".scheduler-row-menu-button"
5152
+ )?.dataset.resourceId;
5153
+ o && (e.preventDefault(), this.openRowMenu(o));
5154
+ return;
5155
+ }
4772
5156
  const r = this.getEventById(s.dataset.eventId ?? "");
4773
5157
  !r || !this.eventEditor || !this.canOpenEditor(r) || (e.preventDefault(), this.stateManager.setSelectedEvent(r), this.tryOpenEventEditor(r));
4774
5158
  }
5159
+ /**
5160
+ * Did this `contextmenu` come from a finger?
5161
+ *
5162
+ * Two signals, because no single one is portable. Chromium delivers
5163
+ * `contextmenu` as a `PointerEvent` and its `pointerType` is authoritative when
5164
+ * present; Firefox and WebKit deliver a bare `MouseEvent` with no such field,
5165
+ * so those fall back to the device recorded at `touchstart`/`mousedown`.
5166
+ *
5167
+ * Measured, not assumed — see the spike in the PRD (§14.3). The browser's
5168
+ * long-press gesture cannot be synthesized through CDP, so this decision is the
5169
+ * only part of the touch story an automated test can reach.
5170
+ */
5171
+ isTouchContextMenu(e) {
5172
+ const t = e.pointerType;
5173
+ return t ? t === "touch" : this.inputHandler?.isTouchGesture() ?? !1;
5174
+ }
5175
+ /**
5176
+ * Does the editor's time list use a 12-hour clock?
5177
+ *
5178
+ * `mp-datetime-picker.hour12` is a boolean, so an unset `timeFormat` has to be
5179
+ * resolved rather than read as false — otherwise a US user gets a 24-hour
5180
+ * picker inside a scheduler that renders 12-hour times everywhere else.
5181
+ * `detectTimeFormat` is the `Intl` probe written for this and, until now,
5182
+ * never called from the component.
5183
+ */
5184
+ /**
5185
+ * The week's first day: the consumer's choice, else the locale's convention.
5186
+ * Mirrors `BaseView.firstDayOfWeek` — resolved at the point of use so a later
5187
+ * locale change is picked up, never written back into `options`.
5188
+ */
5189
+ firstDayOfWeek() {
5190
+ const { firstDayOfWeek: e, locale: t } = this.stateManager.getState().options;
5191
+ return h.resolveFirstDayOfWeek(e, t);
5192
+ }
5193
+ resolvedHour12() {
5194
+ const { timeFormat: e, locale: t } = this.stateManager.getState().options;
5195
+ return (e ?? h.detectTimeFormat(t)) === "12h";
5196
+ }
4775
5197
  /**
4776
5198
  * Minute granularity for the editor's time lists, derived from the grid's own
4777
5199
  * `slotDuration` so the two agree — picking a time the grid cannot represent
@@ -4783,17 +5205,17 @@ class F extends re {
4783
5205
  }
4784
5206
  renderEventEditor() {
4785
5207
  const e = this.editorEventId ? this.getEventById(this.editorEventId) : null, t = this.editorDraft;
4786
- if (!e || !t) return T;
4787
- const { options: s } = this.stateManager.getState(), r = this.can("editEvent", e), n = this.editorError?.field === "title", i = this.editorError?.field === "end", o = ie(
5208
+ if (!e || !t) return k;
5209
+ const { options: s } = this.stateManager.getState(), r = this.can("editEvent", e), n = this.editorError?.field === "title", o = this.editorError?.field === "end", i = pe(
4788
5210
  this.editorTitleErrorId,
4789
5211
  this.editorError?.message ?? null,
4790
5212
  n
4791
- ), { canStart: a, canEnd: l, startIsMove: d } = this.editorTimeFields(e), c = t.color ?? U(
5213
+ ), { canStart: a, canEnd: l, startIsMove: d } = this.editorTimeFields(e), c = t.color ?? X(
4792
5214
  e,
4793
5215
  this.stateManager.getState().resourceById,
4794
5216
  this.stateManager.getState().options.defaultEventColor
4795
5217
  );
4796
- return D`
5218
+ return S`
4797
5219
  <div
4798
5220
  class="scheduler-event-editor"
4799
5221
  role="dialog"
@@ -4818,11 +5240,11 @@ class F extends re {
4818
5240
  .value=${t.title}
4819
5241
  ?disabled=${!r}
4820
5242
  aria-invalid=${n ? "true" : "false"}
4821
- aria-errormessage=${o.id}
4822
- aria-describedby=${o.id}
5243
+ aria-errormessage=${i.id}
5244
+ aria-describedby=${i.id}
4823
5245
  @input=${(u) => this.updateEditorDraft({ title: u.target.value })}
4824
5246
  />
4825
- ${o.node}
5247
+ ${i.node}
4826
5248
  </label>
4827
5249
  <label class="editor-field">
4828
5250
  <span>${this.msg("editorStartLabel")}</span>
@@ -4833,9 +5255,9 @@ class F extends re {
4833
5255
  ?disabled=${!a}
4834
5256
  @value-change=${(u) => this.onEditorStartChange(u)}
4835
5257
  input-label=${this.msg("editorStartLabel")}
4836
- locale=${s.locale ?? T}
4837
- first-day-of-week=${s.firstDayOfWeek ?? 1}
4838
- .hour12=${s.timeFormat === "12h"}
5258
+ locale=${s.locale ?? k}
5259
+ first-day-of-week=${this.firstDayOfWeek()}
5260
+ .hour12=${this.resolvedHour12()}
4839
5261
  .step=${this.pickerStep()}
4840
5262
  ></mp-datetime-picker>
4841
5263
  </label>
@@ -4846,13 +5268,13 @@ class F extends re {
4846
5268
  .value=${t.end}
4847
5269
  .min=${t.start}
4848
5270
  ?disabled=${!l}
4849
- ?invalid=${i}
4850
- error-text=${i ? this.editorError.message : T}
5271
+ ?invalid=${o}
5272
+ error-text=${o ? this.editorError.message : k}
4851
5273
  @value-change=${(u) => this.onEditorEndChange(u)}
4852
5274
  input-label=${this.msg("editorEndLabel")}
4853
- locale=${s.locale ?? T}
4854
- first-day-of-week=${s.firstDayOfWeek ?? 1}
4855
- .hour12=${s.timeFormat === "12h"}
5275
+ locale=${s.locale ?? k}
5276
+ first-day-of-week=${this.firstDayOfWeek()}
5277
+ .hour12=${this.resolvedHour12()}
4856
5278
  .step=${this.pickerStep()}
4857
5279
  ></mp-datetime-picker>
4858
5280
  </label>
@@ -4882,13 +5304,13 @@ class F extends re {
4882
5304
  >
4883
5305
  ${this.msg("editorSave")}
4884
5306
  </button>
4885
- ${this.can("deleteEvent", e) ? D`<button
5307
+ ${this.can("deleteEvent", e) ? S`<button
4886
5308
  type="button"
4887
5309
  class="editor-action danger"
4888
5310
  @click=${() => this.deleteFromEditor()}
4889
5311
  >
4890
5312
  ${this.msg("editorDelete")}
4891
- </button>` : T}
5313
+ </button>` : k}
4892
5314
  <button
4893
5315
  type="button"
4894
5316
  class="editor-action"
@@ -4953,16 +5375,16 @@ class F extends re {
4953
5375
  this.updateEditorDraft({ start: t, end: new Date(s.end.getTime() + r) });
4954
5376
  return;
4955
5377
  }
4956
- const i = new Date(s.end.getTime() - this.minutesPerSlot() * 60 * 1e3);
4957
- if (t.getTime() <= i.getTime()) {
5378
+ const o = new Date(s.end.getTime() - this.minutesPerSlot() * 60 * 1e3);
5379
+ if (t.getTime() <= o.getTime()) {
4958
5380
  this.updateEditorDraft({ start: t });
4959
5381
  return;
4960
5382
  }
4961
- this.updateEditorDraft({ start: i });
4962
- const { options: o } = this.stateManager.getState();
5383
+ this.updateEditorDraft({ start: o });
5384
+ const { options: i } = this.stateManager.getState();
4963
5385
  this.liveAnnouncer.announce(
4964
5386
  this.msg("editorStartClamped", {
4965
- start: h.formatTime(i, o.timeFormat)
5387
+ start: h.formatTime(o, i.timeFormat, i.locale)
4966
5388
  })
4967
5389
  );
4968
5390
  }
@@ -4997,7 +5419,7 @@ class F extends re {
4997
5419
  const { options: n } = this.stateManager.getState();
4998
5420
  this.liveAnnouncer.announce(
4999
5421
  this.msg("editorEndClamped", {
5000
- end: h.formatTime(r, n.timeFormat)
5422
+ end: h.formatTime(r, n.timeFormat, n.locale)
5001
5423
  })
5002
5424
  );
5003
5425
  }
@@ -5089,10 +5511,10 @@ class F extends re {
5089
5511
  "aria-label",
5090
5512
  this.msg("renameResourceLabel", { title: r })
5091
5513
  );
5092
- let i = !1;
5093
- const o = (a) => {
5094
- if (i) return;
5095
- i = !0;
5514
+ let o = !1;
5515
+ const i = (a) => {
5516
+ if (o) return;
5517
+ o = !0;
5096
5518
  const l = n.value.trim();
5097
5519
  s.textContent = a && l ? l : r, a && l && l !== r && (this.eventEmitter.emitResourceUpdate(t, { title: l }, new CustomEvent("rename")), this.liveAnnouncer.announce(
5098
5520
  this.msg("resourceRenamed", { from: r, to: l })
@@ -5103,8 +5525,8 @@ class F extends re {
5103
5525
  });
5104
5526
  };
5105
5527
  n.addEventListener("keydown", (a) => {
5106
- a.stopPropagation(), a.key === "Enter" ? (a.preventDefault(), o(!0)) : a.key === "Escape" && (a.preventDefault(), o(!1));
5107
- }), n.addEventListener("blur", () => o(!0)), n.addEventListener("pointerdown", (a) => a.stopPropagation()), s.textContent = "", s.appendChild(n), n.focus(), n.select();
5528
+ a.stopPropagation(), a.key === "Enter" ? (a.preventDefault(), i(!0)) : a.key === "Escape" && (a.preventDefault(), i(!1));
5529
+ }), n.addEventListener("blur", () => i(!0)), n.addEventListener("pointerdown", (a) => a.stopPropagation()), s.textContent = "", s.appendChild(n), n.focus(), n.select();
5108
5530
  }
5109
5531
  /** The in-grid pointer delete (D12.4b's revised home). */
5110
5532
  deleteFromEditor() {
@@ -5136,7 +5558,7 @@ class F extends re {
5136
5558
  }
5137
5559
  firstUpdated() {
5138
5560
  const e = this.shadowRoot.querySelector(".scheduler-header");
5139
- this.contentContainer = this.shadowRoot.querySelector(".scheduler-content"), this.populateHeader(e), this.observeHeaderWidth(e), this.inputHandler = new Ie(
5561
+ this.contentContainer = this.shadowRoot.querySelector(".scheduler-content"), this.populateHeader(e), this.observeHeaderWidth(e), this.inputHandler = new He(
5140
5562
  {
5141
5563
  shadowRoot: this.shadowRoot,
5142
5564
  getEventById: (t) => this.getEventById(t),
@@ -5165,49 +5587,46 @@ class F extends re {
5165
5587
  r.type = "button", r.textContent = "›", r.setAttribute("aria-label", this.msg("nextPeriod")), r.title = this.msg("nextPeriod"), r.addEventListener("click", () => this.next());
5166
5588
  const n = document.createElement("button");
5167
5589
  n.type = "button", n.textContent = this.msg("today"), n.setAttribute("aria-label", this.msg("jumpToToday")), n.addEventListener("click", () => this.today()), t.appendChild(s), t.appendChild(r), t.appendChild(n);
5168
- const i = document.createElement("div");
5169
- i.className = "scheduler-title", i.setAttribute("aria-live", "polite"), i.setAttribute("aria-atomic", "true"), this.updateTitle(i);
5170
5590
  const o = document.createElement("div");
5171
- o.className = "scheduler-view-switcher", o.setAttribute("role", "group"), o.setAttribute("aria-label", this.msg("switchView"));
5591
+ o.className = "scheduler-title", o.setAttribute("aria-live", "polite"), o.setAttribute("aria-atomic", "true"), this.updateTitle(o);
5592
+ const i = document.createElement("div");
5593
+ i.className = "scheduler-view-switcher", i.setAttribute("role", "group"), i.setAttribute("aria-label", this.msg("switchView"));
5172
5594
  const a = ["year", "month", "week", "day", "timeline"];
5173
5595
  for (const l of a) {
5174
5596
  const d = document.createElement("button");
5175
5597
  d.type = "button", d.textContent = this.viewLabel(l), d.dataset.view = l;
5176
5598
  const c = l === this.view;
5177
- d.setAttribute("aria-pressed", String(c)), c && d.classList.add("active"), d.addEventListener("click", () => this.changeView(l)), o.appendChild(d);
5599
+ d.setAttribute("aria-pressed", String(c)), c && d.classList.add("active"), d.addEventListener("click", () => this.changeView(l)), i.appendChild(d);
5178
5600
  }
5179
- e.appendChild(t), e.appendChild(i), e.appendChild(o);
5601
+ e.appendChild(t), e.appendChild(o), e.appendChild(i);
5180
5602
  }
5181
5603
  updateTitle(e) {
5182
5604
  const t = e ?? this.shadowRoot.querySelector(".scheduler-title");
5183
5605
  if (!t) return;
5184
- const s = this.stateManager.getState(), { date: r, view: n, options: i } = s;
5185
- let o = "";
5606
+ const s = this.stateManager.getState(), { date: r, view: n, options: o } = s;
5607
+ let i = "";
5186
5608
  switch (n) {
5187
5609
  case "year":
5188
- o = r.getFullYear().toString();
5610
+ i = r.getFullYear().toString();
5189
5611
  break;
5190
5612
  case "month":
5191
- o = h.formatDate(r, i.locale, {
5613
+ i = h.formatDate(r, o.locale, {
5192
5614
  month: "long",
5193
5615
  year: "numeric"
5194
5616
  });
5195
5617
  break;
5196
5618
  case "week":
5197
5619
  case "timeline": {
5198
- const a = h.getWeekStart(r, i.firstDayOfWeek), l = h.addDays(a, 6);
5199
- o = `${h.formatDate(a, i.locale, {
5200
- month: "short",
5201
- day: "numeric"
5202
- })} - ${h.formatDate(l, i.locale, {
5620
+ const a = h.getWeekStart(r, this.firstDayOfWeek()), l = h.addDays(a, 6);
5621
+ i = h.formatDateRange(a, l, o.locale, {
5203
5622
  month: "short",
5204
5623
  day: "numeric",
5205
5624
  year: "numeric"
5206
- })}`;
5625
+ });
5207
5626
  break;
5208
5627
  }
5209
5628
  case "day":
5210
- o = h.formatDate(r, i.locale, {
5629
+ i = h.formatDate(r, o.locale, {
5211
5630
  weekday: "long",
5212
5631
  month: "long",
5213
5632
  day: "numeric",
@@ -5215,7 +5634,7 @@ class F extends re {
5215
5634
  });
5216
5635
  break;
5217
5636
  }
5218
- t.textContent = o;
5637
+ t.textContent = i;
5219
5638
  }
5220
5639
  static {
5221
5640
  this.NARROW_HEADER_WIDTH = 560;
@@ -5226,53 +5645,82 @@ class F extends re {
5226
5645
  * wrapped layout off [data-narrow]; the title text swap needs JS anyway.
5227
5646
  */
5228
5647
  observeHeaderWidth(e) {
5229
- typeof ResizeObserver > "u" || (this.headerResizeObserver = new ResizeObserver((t) => {
5230
- const r = (t[0]?.contentRect.width ?? e.clientWidth) < F.NARROW_HEADER_WIDTH;
5231
- r !== this.headerIsNarrow && (this.headerIsNarrow = r, requestAnimationFrame(() => {
5232
- e.toggleAttribute("data-narrow", r);
5648
+ if (typeof ResizeObserver > "u") return;
5649
+ const t = this.shadowRoot?.querySelector(".scheduler-container");
5650
+ this.headerResizeObserver = new ResizeObserver((s) => {
5651
+ const n = (s[0]?.contentRect.width ?? e.clientWidth) < $.NARROW_HEADER_WIDTH;
5652
+ n !== this.headerIsNarrow && (this.headerIsNarrow = n, requestAnimationFrame(() => {
5653
+ e.toggleAttribute("data-narrow", n), t?.toggleAttribute("data-narrow", n);
5233
5654
  }));
5234
- }), this.headerResizeObserver.observe(e));
5655
+ }), this.headerResizeObserver.observe(e);
5235
5656
  }
5236
5657
  renderView() {
5237
5658
  if (!this.contentContainer) return;
5238
- this.currentView?.destroy();
5239
- const e = this.stateManager.getState();
5240
- switch (e.view) {
5659
+ const e = this.shadowRoot?.activeElement, t = !!e && this.contentContainer.contains(e);
5660
+ this.currentViewType !== this.stateManager.getState().view && (this.contentContainer.scrollLeft = 0, this.contentContainer.scrollTop = 0), this.currentView?.destroy();
5661
+ const s = this.stateManager.getState();
5662
+ switch (s.view) {
5241
5663
  case "year":
5242
- this.currentView = new N(this.contentContainer, e), this.currentViewType = "year";
5664
+ this.currentView = new U(this.contentContainer, s), this.currentViewType = "year";
5243
5665
  break;
5244
5666
  case "month":
5245
- this.currentView = new z(this.contentContainer, e), this.currentViewType = "month";
5667
+ this.currentView = new N(this.contentContainer, s), this.currentViewType = "month";
5246
5668
  break;
5247
5669
  case "week":
5248
- this.currentView = new we(this.contentContainer, e), this.currentViewType = "week";
5670
+ this.currentView = new Te(this.contentContainer, s), this.currentViewType = "week";
5249
5671
  break;
5250
5672
  case "day":
5251
- this.currentView = new Ee(this.contentContainer, e), this.currentViewType = "day";
5673
+ this.currentView = new Ie(this.contentContainer, s), this.currentViewType = "day";
5252
5674
  break;
5253
5675
  case "timeline":
5254
- this.currentView = new A(this.contentContainer, e), this.currentViewType = "timeline";
5676
+ this.currentView = new I(this.contentContainer, s), this.currentViewType = "timeline";
5255
5677
  break;
5256
5678
  }
5257
- this.currentView?.render();
5679
+ this.currentView?.render(), t && requestAnimationFrame(() => {
5680
+ const r = this.shadowRoot?.activeElement;
5681
+ (!r || r === this.shadowRoot?.host) && this.focusFocusedCell();
5682
+ });
5258
5683
  }
5259
5684
  // ============================================
5260
5685
  // State Change Handling
5261
5686
  // ============================================
5262
5687
  onStateChange(e) {
5263
- 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.popoverDate || this.editorEventId) && this.requestUpdate();
5688
+ 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();
5264
5689
  }
5265
5690
  detectAndEmitChanges(e) {
5266
- const t = this.previousView !== null && this.previousView !== e.view, s = this.previousDate !== null && this.previousDate.getTime() !== e.date.getTime(), r = e.selectedEvent?.id ?? null, n = W(e), i = n ? `${n.start.getTime()}-${n.end.getTime()}-${e.selectionResourceId ?? ""}` : null, o = this.previousSelectedEventId !== r || this.previousRangeKey !== i;
5267
- (t || s) && this.eventEmitter.emitViewChange(e.view, e.date), o && this.eventEmitter.emitSelectionChange(
5691
+ const t = this.previousView !== null && this.previousView !== e.view, s = this.previousDate !== null && this.previousDate.getTime() !== e.date.getTime(), r = e.selectedEvent?.id ?? null, n = G(e), o = n ? `${n.start.getTime()}-${n.end.getTime()}-${e.selectionResourceId ?? ""}` : null, i = this.previousSelectedEventId !== r || this.previousRangeKey !== o;
5692
+ (t || s) && this.eventEmitter.emitViewChange(e.view, e.date), i && this.eventEmitter.emitSelectionChange(
5268
5693
  e.selectedEvent,
5269
5694
  n,
5270
5695
  e.view,
5271
5696
  e.selectionResourceId ?? void 0
5272
- ), this.previousView = e.view, this.previousDate = new Date(e.date), this.previousSelectedEventId = r, this.previousRangeKey = i;
5697
+ ), this.previousView = e.view, this.previousDate = new Date(e.date), this.previousSelectedEventId = r, this.previousRangeKey = o;
5698
+ }
5699
+ /**
5700
+ * Re-apply the header's localized labels.
5701
+ *
5702
+ * The chrome is built imperatively once, in `firstUpdated`, so its button text
5703
+ * froze at whatever `options.messages` held at that moment. The TITLE updated
5704
+ * on every state change and the buttons did not, so switching language at
5705
+ * runtime produced a half-translated header — Dutch dates over English
5706
+ * buttons. Cheap enough to redo unconditionally: eight string assignments.
5707
+ */
5708
+ applyHeaderLabels() {
5709
+ const e = this.shadowRoot;
5710
+ if (!e) return;
5711
+ const t = e.querySelector(".scheduler-nav");
5712
+ t?.setAttribute("aria-label", this.msg("navLabel"));
5713
+ const s = t?.querySelectorAll("button"), [r, n, o] = s ? [...s] : [];
5714
+ r && (r.setAttribute("aria-label", this.msg("previousPeriod")), r.title = this.msg("previousPeriod")), n && (n.setAttribute("aria-label", this.msg("nextPeriod")), n.title = this.msg("nextPeriod")), o && (o.textContent = this.msg("today"), o.setAttribute("aria-label", this.msg("jumpToToday")));
5715
+ const i = e.querySelector(".scheduler-view-switcher");
5716
+ i?.setAttribute("aria-label", this.msg("switchView")), i?.querySelectorAll("button[data-view]").forEach((a) => {
5717
+ const l = a.dataset.view;
5718
+ l && (a.textContent = this.viewLabel(l));
5719
+ });
5273
5720
  }
5274
5721
  updateUI(e) {
5275
- this.updateTitle(), this.shadowRoot.querySelectorAll(".scheduler-view-switcher button").forEach((s) => {
5722
+ if (!this.shadowRoot) return;
5723
+ this.updateTitle(), this.applyHeaderLabels(), this.shadowRoot.querySelectorAll(".scheduler-view-switcher button").forEach((s) => {
5276
5724
  const r = s, n = r.dataset.view === e.view;
5277
5725
  r.classList.toggle("active", n), r.setAttribute("aria-pressed", String(n));
5278
5726
  }), this.currentView && (this.currentViewType !== e.view ? this.renderView() : e.dragState || e.previewEvent ? this.scheduleDragUpdate(e) : this.currentView.update(e));
@@ -5337,10 +5785,10 @@ class F extends re {
5337
5785
  this.stopEdgeScroll();
5338
5786
  return;
5339
5787
  }
5340
- const s = t.getBoundingClientRect(), r = F.EDGE_SCROLL_ZONE_PX, n = F.EDGE_SCROLL_MAX_PX, i = (o, a, l) => o < a + r ? -Math.min(1, (a + r - o) / r) * n : o > l - r ? Math.min(1, (o - (l - r)) / r) * n : 0;
5788
+ const s = t.getBoundingClientRect(), r = $.EDGE_SCROLL_ZONE_PX, n = $.EDGE_SCROLL_MAX_PX, o = (i, a, l) => i < a + r ? -Math.min(1, (a + r - i) / r) * n : i > l - r ? Math.min(1, (i - (l - r)) / r) * n : 0;
5341
5789
  if (this.edgeScrollVector = {
5342
- x: i(e.clientX, s.left, s.right),
5343
- y: i(e.clientY, s.top, s.bottom)
5790
+ x: o(e.clientX, s.left, s.right),
5791
+ y: o(e.clientY, s.top, s.bottom)
5344
5792
  }, this.edgeScrollPointer = e, this.edgeScrollVector.x === 0 && this.edgeScrollVector.y === 0) {
5345
5793
  this.stopEdgeScroll();
5346
5794
  return;
@@ -5364,7 +5812,7 @@ class F extends re {
5364
5812
  }
5365
5813
  registerEventActivation(e, t) {
5366
5814
  const s = Date.now(), r = this.lastEventActivation;
5367
- this.lastEventActivation = { eventId: e.id, time: s }, r && r.eventId === e.id && s - r.time < F.DBLCLICK_WINDOW_MS && (this.lastEventActivation = null, this.eventEmitter.emitEventDblClick(e, t), this.tryOpenEventEditor(e));
5815
+ this.lastEventActivation = { eventId: e.id, time: s }, r && r.eventId === e.id && s - r.time < $.DBLCLICK_WINDOW_MS && (this.lastEventActivation = null, this.eventEmitter.emitEventDblClick(e, t), this.tryOpenEventEditor(e));
5368
5816
  }
5369
5817
  handleDragComplete(e, t) {
5370
5818
  if (e.wasClick) {
@@ -5422,9 +5870,9 @@ class F extends re {
5422
5870
  return;
5423
5871
  }
5424
5872
  }
5425
- const i = s.closest("[data-date]");
5426
- if (i) {
5427
- const a = i.dataset.date;
5873
+ const o = s.closest("[data-date]");
5874
+ if (o) {
5875
+ const a = o.dataset.date;
5428
5876
  if (a) {
5429
5877
  const l = this.parseDayKey(a);
5430
5878
  if (this.eventEmitter.emitDateClick(l, e.originalEvent), s.closest(".day-number")) {
@@ -5438,11 +5886,11 @@ class F extends re {
5438
5886
  }
5439
5887
  }
5440
5888
  }
5441
- const o = s.closest(
5889
+ const i = s.closest(
5442
5890
  ".scheduler-year-month-header"
5443
5891
  );
5444
- if (o) {
5445
- const a = o.dataset.month;
5892
+ if (i) {
5893
+ const a = i.dataset.month;
5446
5894
  a && (this.stateManager.setDate(this.parseDayKey(a)), this.stateManager.setView("month"));
5447
5895
  }
5448
5896
  t.type === "event" && t.event && (this.stateManager.setSelectedEvent(t.event), this.registerEventActivation(t.event, e.originalEvent));
@@ -5458,14 +5906,24 @@ class F extends re {
5458
5906
  handleResourceAction(e, t) {
5459
5907
  const s = e.closest("[data-action]");
5460
5908
  if (!s) return !1;
5461
- const { action: r, parentId: n, resourceId: i } = s.dataset, o = this.stateManager.getState().view;
5909
+ const { action: r, parentId: n, resourceId: o } = s.dataset, i = this.stateManager.getState().view;
5462
5910
  switch (r) {
5911
+ // The trigger itself is not a request — it opens the panel that carries
5912
+ // them. Handled here so the click never falls through to the grid.
5913
+ case "row-menu":
5914
+ return o && this.openRowMenu(o), !0;
5915
+ // Starts the same inline edit double-click and F2 already start. The panel
5916
+ // closes WITHOUT returning focus first: `beginResourceRename` focuses the
5917
+ // input it creates, and handing focus back to the trigger on the way there
5918
+ // would be a visible detour.
5919
+ case "rename-resource":
5920
+ return o && this.can("updateResource") && (this.rowMenuOverlay.close(!1), this.beginResourceRename(o)), !0;
5463
5921
  case "add-resource":
5464
- return this.can("createResource") && this.eventEmitter.emitResourceCreate("resource", o, t, n), !0;
5922
+ return this.can("createResource") && this.eventEmitter.emitResourceCreate("resource", i, t, n), !0;
5465
5923
  case "add-group":
5466
- return this.can("createGroup") && this.eventEmitter.emitResourceCreate("group", o, t, n), !0;
5924
+ return this.can("createGroup") && this.eventEmitter.emitResourceCreate("group", i, t, n), !0;
5467
5925
  case "delete-resource": {
5468
- const a = i ? this.findResourceOrGroup(i) : null;
5926
+ const a = o ? this.findResourceOrGroup(o) : null;
5469
5927
  return a && this.can("deleteResource") && this.eventEmitter.emitResourceDelete(a, t), !0;
5470
5928
  }
5471
5929
  // The colour input reports through `change`, not `click` — a click merely
@@ -5487,16 +5945,16 @@ class F extends re {
5487
5945
  if (!t || t.dataset.action !== "set-resource-color" || !this.can("updateResource")) return;
5488
5946
  const { resourceId: s, field: r } = t.dataset, n = s ? this.findResourceOrGroup(s) : null;
5489
5947
  if (!n) return;
5490
- const i = t.value;
5948
+ const o = t.value;
5491
5949
  this.eventEmitter.emitResourceUpdate(
5492
5950
  n,
5493
- r === "eventColor" ? { eventColor: i } : { color: i },
5951
+ r === "eventColor" ? { eventColor: o } : { color: o },
5494
5952
  e
5495
5953
  );
5496
5954
  }
5497
5955
  /** Resolve a resource or group by id from the current `resources` input. */
5498
5956
  findResourceOrGroup(e) {
5499
- return R.findById(this.stateManager.getState().resources, e) ?? null;
5957
+ return O.findById(this.stateManager.getState().resources, e) ?? null;
5500
5958
  }
5501
5959
  handleDoubleClick(e, t) {
5502
5960
  t.type === "event" && t.event && (this.eventEmitter.emitEventDblClick(t.event, e.originalEvent), this.tryOpenEventEditor(t.event));
@@ -5518,18 +5976,45 @@ class F extends re {
5518
5976
  return;
5519
5977
  const n = this.getEventById(r);
5520
5978
  n && this.stateManager.getState().selectedEvent?.id !== n.id && (this.stateManager.setSelectedEvent(n), this.eventEmitter.emitEventSelected(n, e), requestAnimationFrame(() => {
5521
- const i = `[data-event-id="${this.cssEscape(n.id)}"]`;
5522
- this.shadowRoot?.querySelector(i)?.focus({ preventScroll: !0 });
5979
+ const o = `[data-event-id="${this.cssEscape(n.id)}"]`;
5980
+ this.shadowRoot?.querySelector(o)?.focus({ preventScroll: !0 });
5523
5981
  }));
5524
5982
  }
5983
+ /**
5984
+ * Is this key event coming from inside one of the open panels?
5985
+ *
5986
+ * The dialogs are deliberately NON-modal, which invites the user to Shift+Tab
5987
+ * back to the grid while one is open. The guards below used to return
5988
+ * unconditionally on `isOpen`, so every arrow, Enter and Escape in the grid
5989
+ * was swallowed and the widget read as broken (audit M12). Claiming keys only
5990
+ * when focus is actually inside the panel fixes that without weakening the
5991
+ * Escape arbitration, which is the reason the guards exist.
5992
+ */
5993
+ eventInsidePanel(e, t) {
5994
+ const s = e.composedPath?.() ?? [], r = this.shadowRoot?.querySelector(t);
5995
+ return r ? s.includes(r) : !1;
5996
+ }
5525
5997
  handleKeyDown(e) {
5998
+ if (this.rowMenuOverlay.isOpen) {
5999
+ if (e.key === "Escape" && this.rowMenuOverlay.isTopmost) {
6000
+ e.preventDefault(), e.stopPropagation(), this.closeRowMenu();
6001
+ return;
6002
+ }
6003
+ if (this.eventInsidePanel(e, ".scheduler-row-panel")) return;
6004
+ }
5526
6005
  if (this.dayPopover.isOpen) {
5527
- e.key === "Escape" && this.dayPopover.isTopmost && (e.preventDefault(), e.stopPropagation(), this.closeDayPopover());
5528
- return;
6006
+ if (e.key === "Escape" && this.dayPopover.isTopmost) {
6007
+ e.preventDefault(), e.stopPropagation(), this.closeDayPopover();
6008
+ return;
6009
+ }
6010
+ if (this.eventInsidePanel(e, ".scheduler-day-popover")) return;
5529
6011
  }
5530
6012
  if (this.eventEditorOverlay.isOpen) {
5531
- e.key === "Escape" && this.eventEditorOverlay.isTopmost && (e.preventDefault(), e.stopPropagation(), this.closeEventEditor());
5532
- return;
6013
+ if (e.key === "Escape" && this.eventEditorOverlay.isTopmost) {
6014
+ e.preventDefault(), e.stopPropagation(), this.closeEventEditor();
6015
+ return;
6016
+ }
6017
+ if (this.eventInsidePanel(e, ".scheduler-event-editor")) return;
5533
6018
  }
5534
6019
  if (this.keyboardMove) {
5535
6020
  this.handleKeyboardMove(e);
@@ -5539,14 +6024,17 @@ class F extends re {
5539
6024
  this.dragManager.cancel();
5540
6025
  return;
5541
6026
  }
5542
- if (e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey && this.handleAltShortcut(e))
6027
+ const t = e.composedPath?.()[0]?.closest?.(
6028
+ ".scheduler-row-menu-button"
6029
+ );
6030
+ if (t && this.handleRowTriggerKeyDown(e, t) || e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey && this.handleAltShortcut(e))
5543
6031
  return;
5544
6032
  if ((e.key === "Enter" || e.key === " ") && this.activateFocusedDrillControl()) {
5545
6033
  e.preventDefault();
5546
6034
  return;
5547
6035
  }
5548
- const t = this.getFocusedKind();
5549
- t === "cell" ? this.handleCellKeyDown(e) : t === "event" && this.handleEventKeyDown(e);
6036
+ const s = this.getFocusedKind();
6037
+ s === "cell" ? this.handleCellKeyDown(e) : s === "event" && this.handleEventKeyDown(e);
5550
6038
  }
5551
6039
  /** Keyboard face of the more-link / year-month-header click delegation. */
5552
6040
  activateFocusedDrillControl() {
@@ -5556,12 +6044,30 @@ class F extends re {
5556
6044
  const t = e.dataset.date;
5557
6045
  return t ? (this.handleMoreLink(t), !0) : !1;
5558
6046
  }
6047
+ if (e.classList.contains("day-number")) {
6048
+ const t = e.dataset.date;
6049
+ return t ? (this.drillTo(this.parseDayKey(t), "day"), !0) : !1;
6050
+ }
5559
6051
  if (e.classList.contains("scheduler-year-month-header")) {
5560
6052
  const t = e.dataset.month;
5561
- return t ? (this.stateManager.setDate(this.parseDayKey(t)), this.stateManager.setView("month"), !0) : !1;
6053
+ return t ? (this.drillTo(this.parseDayKey(t), "month"), !0) : !1;
5562
6054
  }
5563
6055
  return !1;
5564
6056
  }
6057
+ /**
6058
+ * Drill into `view` at `date` from a control that the resulting rebuild will
6059
+ * destroy — which is every drill-down control, by definition.
6060
+ *
6061
+ * The focus restore has to happen HERE rather than being left to the view
6062
+ * switch. `setDate` rebuilds the current view first, and that rebuild already
6063
+ * drops focus to `<body>`; by the time the switch looks for something worth
6064
+ * restoring, there is nothing focused inside the widget and it correctly
6065
+ * declines to steal focus from wherever it went. So the switch's own
6066
+ * restoration can never cover this path.
6067
+ */
6068
+ drillTo(e, t) {
6069
+ this.stateManager.setDate(e), this.stateManager.setView(t), this.focusFocusedCell();
6070
+ }
5565
6071
  getFocusedKind() {
5566
6072
  const e = this.shadowRoot?.activeElement;
5567
6073
  return e ? e.classList.contains("scheduler-time-slot") || e.classList.contains("scheduler-timeline-slot") || e.classList.contains("scheduler-month-day") || e.classList.contains("scheduler-year-month") ? "cell" : e.classList.contains("scheduler-event") || e.classList.contains("scheduler-timeline-event") || e.classList.contains("scheduler-month-event") ? "event" : "other" : "other";
@@ -5590,7 +6096,7 @@ class F extends re {
5590
6096
  */
5591
6097
  can(e, t) {
5592
6098
  const { options: s } = this.stateManager.getState();
5593
- return Q(e, {
6099
+ return ie(e, {
5594
6100
  permissions: this.effectivePermissions(s),
5595
6101
  event: t ?? null
5596
6102
  });
@@ -5602,7 +6108,7 @@ class F extends re {
5602
6108
  */
5603
6109
  canResizeEdge(e, t) {
5604
6110
  const { options: s } = this.stateManager.getState();
5605
- return K(e, {
6111
+ return j(e, {
5606
6112
  permissions: this.effectivePermissions(s),
5607
6113
  event: t ?? null
5608
6114
  });
@@ -5702,12 +6208,12 @@ class F extends re {
5702
6208
  return c !== 0 ? c : l.id.localeCompare(d.id);
5703
6209
  }), n = r.findIndex((l) => l.id === e.id);
5704
6210
  if (n < 0) return;
5705
- const i = r[n + t];
5706
- if (!i) return;
5707
- const o = this.shadowRoot;
6211
+ const o = r[n + t];
5708
6212
  if (!o) return;
5709
- o.querySelector(
5710
- `[data-event-id="${this.cssEscape(i.id)}"]`
6213
+ const i = this.shadowRoot;
6214
+ if (!i) return;
6215
+ i.querySelector(
6216
+ `[data-event-id="${this.cssEscape(o.id)}"]`
5711
6217
  )?.focus({ preventScroll: !1 });
5712
6218
  }
5713
6219
  handleCellKeyDown(e) {
@@ -5721,8 +6227,8 @@ class F extends re {
5721
6227
  return;
5722
6228
  }
5723
6229
  if (t.focusedCell || this.initFocusedCellFromActive(), e.key === "F2" && t.view === "timeline") {
5724
- const i = this.stateManager.getState().focusedResourceId;
5725
- i && (e.preventDefault(), this.beginResourceRename(i));
6230
+ const o = this.stateManager.getState().focusedResourceId;
6231
+ o && (e.preventDefault(), this.beginResourceRename(o));
5726
6232
  return;
5727
6233
  }
5728
6234
  const s = e.shiftKey, r = e.ctrlKey || e.metaKey, n = t.view === "timeline";
@@ -5733,9 +6239,17 @@ class F extends re {
5733
6239
  case "ArrowDown":
5734
6240
  e.preventDefault(), n ? this.moveCellByResource(1, s) : this.moveCellByTime(1, s);
5735
6241
  break;
5736
- case "ArrowLeft":
5737
- e.preventDefault(), n ? this.moveCellByTime(-1, s) : this.moveCellByDay(-1, s);
6242
+ case "ArrowLeft": {
6243
+ if (e.preventDefault(), !n) {
6244
+ this.moveCellByDay(-1, s);
6245
+ break;
6246
+ }
6247
+ const o = this.stateManager.getState().focusedCell?.start.getTime();
6248
+ this.moveCellByTime(-1, s);
6249
+ const i = this.stateManager.getState().focusedCell?.start.getTime();
6250
+ o !== void 0 && o === i && !s && this.focusRowTrigger();
5738
6251
  break;
6252
+ }
5739
6253
  case "ArrowRight":
5740
6254
  e.preventDefault(), n ? this.moveCellByTime(1, s) : this.moveCellByDay(1, s);
5741
6255
  break;
@@ -5792,6 +6306,14 @@ class F extends re {
5792
6306
  case "ArrowDown":
5793
6307
  e.preventDefault(), this.moveFocusedDateByDays(7);
5794
6308
  return;
6309
+ // Promised by the announced keymap, previously dead — and worse, not
6310
+ // prevented, so the page scrolled the widget out of view instead.
6311
+ case "PageUp":
6312
+ e.preventDefault(), this.moveFocusedDateByMonths(-1);
6313
+ return;
6314
+ case "PageDown":
6315
+ e.preventDefault(), this.moveFocusedDateByMonths(1);
6316
+ return;
5795
6317
  case "Enter":
5796
6318
  e.preventDefault(), this.commitFocusedDateAsCreate(e, "day");
5797
6319
  return;
@@ -5825,6 +6347,13 @@ class F extends re {
5825
6347
  case "ArrowDown":
5826
6348
  e.preventDefault(), this.moveFocusedDateByMonths(3);
5827
6349
  return;
6350
+ // A year is the period here, so Page Up/Down move by twelve months.
6351
+ case "PageUp":
6352
+ e.preventDefault(), this.moveFocusedDateByMonths(-12);
6353
+ return;
6354
+ case "PageDown":
6355
+ e.preventDefault(), this.moveFocusedDateByMonths(12);
6356
+ return;
5828
6357
  // Drill into the month, matching what clicking the month header does.
5829
6358
  // Enter used to emit a MONTH-SPANNING event-create here, which no consumer
5830
6359
  // could reasonably want from a year overview.
@@ -5886,8 +6415,8 @@ class F extends re {
5886
6415
  scrollAndFocusDateCell(e) {
5887
6416
  const t = this.stateManager.getState(), s = this.shadowRoot;
5888
6417
  if (!s) return;
5889
- const r = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, n = t.view === "year" ? `scheduler-cell-y-${r}` : `scheduler-cell-m-${r}-${String(e.getDate()).padStart(2, "0")}`, i = s.getElementById(n);
5890
- i && (i.focus({ preventScroll: !0 }), typeof i.scrollIntoView == "function" && i.scrollIntoView({ block: "nearest", inline: "nearest" }));
6418
+ const r = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, n = t.view === "year" ? `scheduler-cell-y-${r}` : `scheduler-cell-m-${r}-${String(e.getDate()).padStart(2, "0")}`, o = s.getElementById(n);
6419
+ o && (o.focus({ preventScroll: !0 }), typeof o.scrollIntoView == "function" && o.scrollIntoView({ block: "nearest", inline: "nearest" }));
5891
6420
  }
5892
6421
  /**
5893
6422
  * Emit `event-create` covering the focused day (month view) or focused
@@ -5899,13 +6428,13 @@ class F extends re {
5899
6428
  if (!r) return;
5900
6429
  const n = new Date(r);
5901
6430
  n.setHours(0, 0, 0, 0);
5902
- const i = new Date(n);
5903
- if (t === "day" ? i.setDate(i.getDate() + 1) : i.setMonth(i.getMonth() + 1), !this.can("createEvent") || !this.allowsCreateAt({ start: n, end: i })) {
6431
+ const o = new Date(n);
6432
+ if (t === "day" ? o.setDate(o.getDate() + 1) : o.setMonth(o.getMonth() + 1), !this.can("createEvent") || !this.allowsCreateAt({ start: n, end: o })) {
5904
6433
  this.announceDenied();
5905
6434
  return;
5906
6435
  }
5907
6436
  this.eventEmitter.emitEventCreate(
5908
- { start: n, end: i },
6437
+ { start: n, end: o },
5909
6438
  s.view,
5910
6439
  e
5911
6440
  );
@@ -5913,24 +6442,24 @@ class F extends re {
5913
6442
  moveCellByTime(e, t) {
5914
6443
  const s = this.stateManager.getState(), r = s.focusedCell;
5915
6444
  if (!r) return;
5916
- const n = (s.options.slotDuration ?? 1800) * 1e3, i = new Date(r.start.getTime() + e * n), o = new Date(i.getTime() + n);
5917
- this.cellIsWithinView(i, s) && this.commitFocusMove({ start: i, end: o }, s.focusedResourceId, t);
6445
+ const n = (s.options.slotDuration ?? 1800) * 1e3, o = new Date(r.start.getTime() + e * n), i = new Date(o.getTime() + n);
6446
+ this.cellIsWithinView(o, s) && this.commitFocusMove({ start: o, end: i }, s.focusedResourceId, t);
5918
6447
  }
5919
6448
  /** Week view ArrowLeft/Right: ±1 day, same time-of-day. No-op on day view. */
5920
6449
  moveCellByDay(e, t) {
5921
6450
  const s = this.stateManager.getState(), r = s.focusedCell;
5922
6451
  if (!r || s.view !== "week") return;
5923
- const n = (s.options.slotDuration ?? 1800) * 1e3, i = new Date(r.start);
5924
- i.setDate(i.getDate() + e);
5925
- const o = new Date(i.getTime() + n);
5926
- this.cellIsWithinView(i, s) && this.commitFocusMove({ start: i, end: o }, null, t);
6452
+ const n = (s.options.slotDuration ?? 1800) * 1e3, o = new Date(r.start);
6453
+ o.setDate(o.getDate() + e);
6454
+ const i = new Date(o.getTime() + n);
6455
+ this.cellIsWithinView(o, s) && this.commitFocusMove({ start: o, end: i }, null, t);
5927
6456
  }
5928
6457
  /** Timeline ArrowUp/Down: ±1 resource, same time-of-day. PRD D1: cross-resource
5929
6458
  * Shift+Arrow is intentionally ignored (resource is categorical). */
5930
6459
  moveCellByResource(e, t) {
5931
6460
  const s = this.stateManager.getState(), r = s.focusedCell;
5932
6461
  if (!r || s.view !== "timeline" || t) return;
5933
- const n = this.adjacentRow(s.focusedResourceId, e, s);
6462
+ const n = this.adjacentRow(s.focusedResourceId, e, s, !0);
5934
6463
  n !== void 0 && this.commitFocusMove(r, n, !1);
5935
6464
  }
5936
6465
  moveCellToColumnExtreme(e, t) {
@@ -5938,34 +6467,34 @@ class F extends re {
5938
6467
  if (!r) return;
5939
6468
  const n = new Date(r.start);
5940
6469
  n.setHours(0, 0, 0, 0);
5941
- const i = h.getTimeSlots(
6470
+ const o = h.getTimeSlots(
5942
6471
  n,
5943
6472
  s.options.slotDuration,
5944
6473
  s.options.slotMinTime,
5945
6474
  s.options.slotMaxTime
5946
- ), o = e === "start" ? i[0] : i[i.length - 1];
5947
- o && this.commitFocusMove(o, s.focusedResourceId, t);
6475
+ ), i = e === "start" ? o[0] : o[o.length - 1];
6476
+ i && this.commitFocusMove(i, s.focusedResourceId, t);
5948
6477
  }
5949
6478
  moveCellToViewExtreme(e, t) {
5950
6479
  const s = this.stateManager.getState();
5951
6480
  let r = null, n = s.focusedResourceId;
5952
6481
  switch (s.view) {
5953
6482
  case "day": {
5954
- const i = h.getTimeSlots(s.date, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
5955
- r = e === "start" ? i[0] : i[i.length - 1];
6483
+ const o = h.getTimeSlots(s.date, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
6484
+ r = e === "start" ? o[0] : o[o.length - 1];
5956
6485
  break;
5957
6486
  }
5958
6487
  case "week": {
5959
- const i = h.getWeekDays(s.date, s.options.firstDayOfWeek), o = e === "start" ? i[0] : i[6], a = h.getTimeSlots(o, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
6488
+ const o = h.getWeekDays(s.date, this.firstDayOfWeek()), i = e === "start" ? o[0] : o[6], a = h.getTimeSlots(i, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
5960
6489
  r = e === "start" ? a[0] : a[a.length - 1];
5961
6490
  break;
5962
6491
  }
5963
6492
  case "timeline": {
5964
- const o = R.flatten(s.resources, s.collapsedGroups).filter((c) => c.visible && G(c.item));
6493
+ const o = this.navigableRows(s, !0);
5965
6494
  if (o.length === 0) return;
5966
- n = e === "start" ? o[0].item.id : o[o.length - 1].item.id;
5967
- const a = h.getWeekDays(s.date, s.options.firstDayOfWeek), l = e === "start" ? a[0] : a[6], d = h.getTimeSlots(l, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
5968
- r = e === "start" ? d[0] : d[d.length - 1];
6495
+ n = e === "start" ? o[0] : o[o.length - 1];
6496
+ const i = h.getWeekDays(s.date, this.firstDayOfWeek()), a = e === "start" ? i[0] : i[6], l = h.getTimeSlots(a, s.options.slotDuration, s.options.slotMinTime, s.options.slotMaxTime);
6497
+ r = e === "start" ? l[0] : l[l.length - 1];
5969
6498
  break;
5970
6499
  }
5971
6500
  }
@@ -5980,14 +6509,14 @@ class F extends re {
5980
6509
  const t = this.stateManager.getState(), s = t.focusedCell, r = t.date;
5981
6510
  if (e > 0 ? this.next() : this.prev(), !s) return;
5982
6511
  const n = this.stateManager.getState();
5983
- let i;
6512
+ let o;
5984
6513
  if (n.view === "day")
5985
- i = new Date(n.date), i.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
6514
+ o = new Date(n.date), o.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
5986
6515
  else {
5987
- const l = h.getWeekDays(r, t.options.firstDayOfWeek), d = h.getWeekDays(n.date, n.options.firstDayOfWeek), c = l.findIndex((m) => h.isSameDay(m, s.start)), u = d[Math.max(0, c)] ?? d[0];
5988
- i = new Date(u), i.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
6516
+ const l = h.getWeekDays(r, this.firstDayOfWeek()), d = h.getWeekDays(n.date, this.firstDayOfWeek()), c = l.findIndex((v) => h.isSameDay(v, s.start)), u = d[Math.max(0, c)] ?? d[0];
6517
+ o = new Date(u), o.setHours(s.start.getHours(), s.start.getMinutes(), s.start.getSeconds(), 0);
5989
6518
  }
5990
- const o = (n.options.slotDuration ?? 1800) * 1e3, a = { start: i, end: new Date(i.getTime() + o) };
6519
+ const i = (n.options.slotDuration ?? 1800) * 1e3, a = { start: o, end: new Date(o.getTime() + i) };
5991
6520
  this.commitFocusMove(a, t.focusedResourceId, !1);
5992
6521
  }
5993
6522
  /**
@@ -5999,12 +6528,12 @@ class F extends re {
5999
6528
  const r = this.stateManager.getState(), n = r.options.slotDuration ?? 1800;
6000
6529
  if (s) {
6001
6530
  this.stateManager.extendSelection(e, t), this.stateManager.setFocusedCell(e, t, !1);
6002
- const i = this.stateManager.getState();
6003
- this.liveAnnouncer.announce(me(i, n));
6531
+ const o = this.stateManager.getState();
6532
+ this.liveAnnouncer.announce(De(o, n));
6004
6533
  } else {
6005
6534
  this.stateManager.setFocusedCell(e, t, !0);
6006
- const i = this.getResourceTitle(t);
6007
- this.liveAnnouncer.announce(ve(e, r.options, i));
6535
+ const o = this.getResourceTitle(t);
6536
+ this.liveAnnouncer.announce(q(e, r.options, o));
6008
6537
  }
6009
6538
  this.scrollAndFocusCell(e, t);
6010
6539
  }
@@ -6016,7 +6545,7 @@ class F extends re {
6016
6545
  }
6017
6546
  case "week":
6018
6547
  case "timeline": {
6019
- const s = h.getWeekDays(t.date, t.options.firstDayOfWeek), r = this.parseTimeOnDay(s[0], t.options.slotMinTime), n = this.parseTimeOnDay(s[6], t.options.slotMaxTime);
6548
+ const s = h.getWeekDays(t.date, this.firstDayOfWeek()), r = this.parseTimeOnDay(s[0], t.options.slotMinTime), n = this.parseTimeOnDay(s[6], t.options.slotMaxTime);
6020
6549
  return e.getTime() >= r.getTime() && e.getTime() < n.getTime();
6021
6550
  }
6022
6551
  default:
@@ -6024,8 +6553,8 @@ class F extends re {
6024
6553
  }
6025
6554
  }
6026
6555
  parseTimeOnDay(e, t) {
6027
- const [s, r, n] = (t ?? "00:00:00").split(":").map(Number), i = new Date(e);
6028
- return i.setHours(0, 0, 0, 0), i.setSeconds((s ?? 0) * 3600 + (r ?? 0) * 60 + (n ?? 0)), i;
6556
+ const [s, r, n] = (t ?? "00:00:00").split(":").map(Number), o = new Date(e);
6557
+ return o.setHours(0, 0, 0, 0), o.setSeconds((s ?? 0) * 3600 + (r ?? 0) * 60 + (n ?? 0)), o;
6029
6558
  }
6030
6559
  /**
6031
6560
  * Walk the timeline's RENDERED row order: visible leaf resources, then the
@@ -6037,20 +6566,39 @@ class F extends re {
6037
6566
  * The old version returned `null` for BOTH of the last two, which is exactly
6038
6567
  * why the bucket was unreachable by keyboard.
6039
6568
  */
6040
- adjacentRow(e, t, s) {
6041
- const n = R.flatten(s.resources, s.collapsedGroups).filter((a) => a.visible && G(a.item)).map((a) => a.item.id);
6042
- if ((s.eventsByResource.get(null) ?? []).length > 0 && n.push(null), n.length === 0) return;
6043
- const i = n.indexOf(e);
6044
- if (i < 0) return n[0];
6045
- const o = i + t;
6046
- if (!(o < 0 || o >= n.length))
6047
- return n[o];
6569
+ adjacentRow(e, t, s, r) {
6570
+ const n = this.navigableRows(s, r);
6571
+ if (n.length === 0) return;
6572
+ const o = n.indexOf(e);
6573
+ if (o < 0) return n[0];
6574
+ const i = o + t;
6575
+ if (!(i < 0 || i >= n.length))
6576
+ return n[i];
6048
6577
  }
6578
+ /**
6579
+ * The rows a keyboard user can land on, in the order the timeline draws them.
6580
+ *
6581
+ * `includeGroups` is the whole difference between navigating and moving.
6582
+ * Arrow keys navigate, and a group row is a real row with real gridcells that
6583
+ * can even hold the grid's only tab stop — skipping it is what made the first
6584
+ * arrow press teleport the user to an unrelated row (audit M10). Move-mode
6585
+ * carries an event with it, and a group row renders no events container, so a
6586
+ * group must never be offered as a destination there.
6587
+ */
6588
+ navigableRows(e, t) {
6589
+ const s = O.flatten(e.resources, e.collapsedGroups).filter((r) => r.visible && (t || oe(r.item))).map((r) => r.item.id);
6590
+ return (e.eventsByResource.get(null) ?? []).length > 0 && s.push(null), s;
6591
+ }
6592
+ /**
6593
+ * Title of any row, group rows included. `getAllResources` returns leaves
6594
+ * only by design, so while that was the lookup, arrowing onto a group row
6595
+ * announced the time with no row name at all — swapping M10's teleport for a
6596
+ * silent row rather than fixing it.
6597
+ */
6049
6598
  getResourceTitle(e) {
6050
6599
  if (!e) return null;
6051
- for (const t of R.getAllResources(this.stateManager.getState().resources))
6052
- if (t.id === e) return t.title;
6053
- return null;
6600
+ const t = this.stateManager.getState();
6601
+ return O.flatten(t.resources, t.collapsedGroups).find((r) => r.item.id === e)?.item.title ?? null;
6054
6602
  }
6055
6603
  /**
6056
6604
  * Find the cell DOM element for a (slot, resource) pair and call .focus()
@@ -6071,13 +6619,27 @@ class F extends re {
6071
6619
  timeCellElement(e, t) {
6072
6620
  const s = this.shadowRoot;
6073
6621
  if (!s) return null;
6074
- const r = e.toISOString(), i = this.stateManager.getState().view === "timeline" ? t ? `.scheduler-timeline-slot[data-resource-id="${this.cssEscape(t)}"][data-start="${r}"]` : `.scheduler-timeline-slot[data-unassigned][data-start="${r}"]` : `.scheduler-time-slot[data-start="${r}"]`;
6075
- return s.querySelector(i);
6622
+ const r = e.toISOString(), o = this.stateManager.getState().view === "timeline" ? t ? `.scheduler-timeline-slot[data-resource-id="${this.cssEscape(t)}"][data-start="${r}"]` : `.scheduler-timeline-slot[data-unassigned][data-start="${r}"]` : `.scheduler-time-slot[data-start="${r}"]`;
6623
+ return s.querySelector(o);
6076
6624
  }
6077
6625
  /** Re-focus whatever cell the keyboard model currently considers focused. */
6626
+ /**
6627
+ * Put focus back inside the grid after a rebuild or a view switch.
6628
+ *
6629
+ * The fallback is the point. `focusedCell` is null whenever the user never
6630
+ * entered the grid, and after a view switch it can name a cell the new view
6631
+ * does not render — in both cases this used to do nothing at all and focus
6632
+ * stayed on `<body>`. That is reachable from every drill-down control (the
6633
+ * week day-number, the more-link, the year month-header): activating one
6634
+ * destroys the element the user is standing on by definition, since it
6635
+ * rebuilds the view underneath them.
6636
+ *
6637
+ * Every view promotes exactly one cell to `tabindex="0"` as its roving tab
6638
+ * stop, so that cell is the correct "wherever this view considers current".
6639
+ */
6078
6640
  focusFocusedCell() {
6079
6641
  const e = this.stateManager.getState();
6080
- e.focusedCell && this.scrollAndFocusCell(e.focusedCell, e.focusedResourceId);
6642
+ e.focusedCell && this.scrollAndFocusCell(e.focusedCell, e.focusedResourceId), !this.shadowRoot?.activeElement && this.contentContainer?.querySelector('[role="gridcell"][tabindex="0"]')?.focus();
6081
6643
  }
6082
6644
  /**
6083
6645
  * Parse a `YYYY-MM-DD` day key as a LOCAL date.
@@ -6104,15 +6666,15 @@ class F extends re {
6104
6666
  * whether/when to clear the selection.
6105
6667
  */
6106
6668
  createEventFromCellOrSelection(e) {
6107
- const t = this.stateManager.getState(), s = W(t);
6108
- let r, n, i;
6669
+ const t = this.stateManager.getState(), s = G(t);
6670
+ let r, n, o;
6109
6671
  if (s)
6110
- r = s.start, n = s.end, i = t.selectionResourceId ?? void 0;
6672
+ r = s.start, n = s.end, o = t.selectionResourceId ?? void 0;
6111
6673
  else if (t.focusedCell)
6112
- r = t.focusedCell.start, n = t.focusedCell.end, i = t.focusedResourceId ?? void 0;
6674
+ r = t.focusedCell.start, n = t.focusedCell.end, o = t.focusedResourceId ?? void 0;
6113
6675
  else
6114
6676
  return;
6115
- if (!this.can("createEvent") || !this.allowsCreateAt({ start: r, end: n }, i)) {
6677
+ if (!this.can("createEvent") || !this.allowsCreateAt({ start: r, end: n }, o)) {
6116
6678
  this.announceDenied();
6117
6679
  return;
6118
6680
  }
@@ -6120,10 +6682,10 @@ class F extends re {
6120
6682
  { start: r, end: n },
6121
6683
  t.view,
6122
6684
  e,
6123
- i
6685
+ o
6124
6686
  ), this.liveAnnouncer.announce(this.msg("selectionCommitted", {
6125
- start: h.formatTime(r, t.options.timeFormat),
6126
- end: h.formatTime(n, t.options.timeFormat)
6687
+ start: h.formatTime(r, t.options.timeFormat, t.options.locale),
6688
+ end: h.formatTime(n, t.options.timeFormat, t.options.locale)
6127
6689
  }));
6128
6690
  }
6129
6691
  /**
@@ -6183,19 +6745,19 @@ class F extends re {
6183
6745
  e.preventDefault(), this.commitEventMoveMode();
6184
6746
  return;
6185
6747
  }
6186
- const t = this.stateManager.getState().view, s = t === "timeline", r = this.minutesPerSlot() * 60 * 1e3, n = e.shiftKey, i = e.altKey;
6748
+ const t = this.stateManager.getState().view, s = t === "timeline", r = this.minutesPerSlot() * 60 * 1e3, n = e.shiftKey, o = e.altKey;
6187
6749
  switch (e.key) {
6188
6750
  case "ArrowUp":
6189
- e.preventDefault(), s ? !n && !i && this.nudgeKeyboardMoveResource(-1) : n && i ? this.resizeKeyboardMoveEdge("start", -r) : n ? this.resizeKeyboardMoveEdge("end", -r) : this.nudgeKeyboardMove(-r);
6751
+ e.preventDefault(), s ? !n && !o && this.nudgeKeyboardMoveResource(-1) : n && o ? this.resizeKeyboardMoveEdge("start", -r) : n ? this.resizeKeyboardMoveEdge("end", -r) : this.nudgeKeyboardMove(-r);
6190
6752
  return;
6191
6753
  case "ArrowDown":
6192
- e.preventDefault(), s ? !n && !i && this.nudgeKeyboardMoveResource(1) : n && i ? this.resizeKeyboardMoveEdge("start", +r) : n ? this.resizeKeyboardMoveEdge("end", +r) : this.nudgeKeyboardMove(+r);
6754
+ e.preventDefault(), s ? !n && !o && this.nudgeKeyboardMoveResource(1) : n && o ? this.resizeKeyboardMoveEdge("start", +r) : n ? this.resizeKeyboardMoveEdge("end", +r) : this.nudgeKeyboardMove(+r);
6193
6755
  return;
6194
6756
  case "ArrowLeft":
6195
- e.preventDefault(), s ? n && i ? this.resizeKeyboardMoveEdge("start", -r) : n ? this.resizeKeyboardMoveEdge("end", -r) : this.nudgeKeyboardMove(-r) : t === "week" && (n && i ? this.resizeKeyboardMoveEdge("start", -864e5) : n ? this.resizeKeyboardMoveEdge("end", -864e5) : this.nudgeKeyboardMove(-864e5));
6757
+ e.preventDefault(), s ? n && o ? this.resizeKeyboardMoveEdge("start", -r) : n ? this.resizeKeyboardMoveEdge("end", -r) : this.nudgeKeyboardMove(-r) : t === "week" && (n && o ? this.resizeKeyboardMoveEdge("start", -864e5) : n ? this.resizeKeyboardMoveEdge("end", -864e5) : this.nudgeKeyboardMove(-864e5));
6196
6758
  return;
6197
6759
  case "ArrowRight":
6198
- e.preventDefault(), s ? n && i ? this.resizeKeyboardMoveEdge("start", +r) : n ? this.resizeKeyboardMoveEdge("end", +r) : this.nudgeKeyboardMove(+r) : t === "week" && (n && i ? this.resizeKeyboardMoveEdge("start", 864e5) : n ? this.resizeKeyboardMoveEdge("end", 864e5) : this.nudgeKeyboardMove(864e5));
6760
+ e.preventDefault(), s ? n && o ? this.resizeKeyboardMoveEdge("start", +r) : n ? this.resizeKeyboardMoveEdge("end", +r) : this.nudgeKeyboardMove(+r) : t === "week" && (n && o ? this.resizeKeyboardMoveEdge("start", 864e5) : n ? this.resizeKeyboardMoveEdge("end", 864e5) : this.nudgeKeyboardMove(864e5));
6199
6761
  return;
6200
6762
  }
6201
6763
  }
@@ -6207,12 +6769,17 @@ class F extends re {
6207
6769
  nudgeKeyboardMove(e) {
6208
6770
  if (!this.keyboardMove) return;
6209
6771
  const t = new Date(this.keyboardMove.workingStart.getTime() + e), s = new Date(this.keyboardMove.workingEnd.getTime() + e);
6210
- this.keyboardMove.workingStart = t, this.keyboardMove.workingEnd = s, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(ge(t, s, this.stateManager.getState().options));
6772
+ this.keyboardMove.workingStart = t, this.keyboardMove.workingEnd = s, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(Se(t, s, this.stateManager.getState().options));
6211
6773
  }
6212
6774
  /** Walk to the next/previous row (timeline only). Updates the preview's resourceId. */
6213
6775
  nudgeKeyboardMoveResource(e) {
6214
6776
  if (!this.keyboardMove) return;
6215
- const t = this.adjacentRow(this.keyboardMove.workingResourceId, e, this.stateManager.getState());
6777
+ const t = this.adjacentRow(
6778
+ this.keyboardMove.workingResourceId,
6779
+ e,
6780
+ this.stateManager.getState(),
6781
+ !1
6782
+ );
6216
6783
  if (t === void 0) return;
6217
6784
  this.keyboardMove.workingResourceId = t, this.applyKeyboardMovePreview();
6218
6785
  const s = t === null ? this.msg("unassignedResource") : this.getResourceTitle(t) ?? t;
@@ -6230,11 +6797,11 @@ class F extends re {
6230
6797
  return;
6231
6798
  }
6232
6799
  const r = this.minutesPerSlot() * 60 * 1e3;
6233
- let n = this.keyboardMove.workingStart, i = this.keyboardMove.workingEnd;
6800
+ let n = this.keyboardMove.workingStart, o = this.keyboardMove.workingEnd;
6234
6801
  if (e === "end") {
6235
- if (i = new Date(i.getTime() + t), i.getTime() - n.getTime() < r) return;
6236
- } else if (n = new Date(n.getTime() + t), i.getTime() - n.getTime() < r) return;
6237
- this.keyboardMove.workingStart = n, this.keyboardMove.workingEnd = i, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(fe(n, i, e, this.stateManager.getState().options));
6802
+ if (o = new Date(o.getTime() + t), o.getTime() - n.getTime() < r) return;
6803
+ } else if (n = new Date(n.getTime() + t), o.getTime() - n.getTime() < r) return;
6804
+ this.keyboardMove.workingStart = n, this.keyboardMove.workingEnd = o, this.applyKeyboardMovePreview(), this.liveAnnouncer.announce(ke(n, o, e, this.stateManager.getState().options));
6238
6805
  }
6239
6806
  /** Mirror keyboardMove.working* into state.previewEvent so views render the destination,
6240
6807
  * then scroll the destination into view so the sighted-keyboard user can see it (PRD D6). */
@@ -6254,8 +6821,8 @@ class F extends re {
6254
6821
  const n = this.shadowRoot;
6255
6822
  if (!n) return;
6256
6823
  n.querySelector(`[data-event-id="${this.cssEscape(e)}"]`)?.focus({ preventScroll: !0 });
6257
- const o = this.timeCellElement(t, r);
6258
- o && typeof o.scrollIntoView == "function" && o.scrollIntoView({ block: "nearest", inline: "nearest" });
6824
+ const i = this.timeCellElement(t, r);
6825
+ i && typeof i.scrollIntoView == "function" && i.scrollIntoView({ block: "nearest", inline: "nearest" });
6259
6826
  });
6260
6827
  }
6261
6828
  commitEventMoveMode() {
@@ -6312,16 +6879,16 @@ class F extends re {
6312
6879
  };
6313
6880
  }
6314
6881
  }
6315
- typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler", F);
6882
+ typeof customElements < "u" && !customElements.get("mp-scheduler") && customElements.define("mp-scheduler", $);
6316
6883
  export {
6317
- B as BaseView,
6318
- Ee as DayView,
6319
- z as MonthView,
6320
- F as MpScheduler,
6321
- pe as SchedulerStateManager,
6322
- A as TimelineView,
6323
- we as WeekView,
6324
- N as YearView,
6325
- ue as createInitialState,
6326
- xe as schedulerStyles
6884
+ K as BaseView,
6885
+ Ie as DayView,
6886
+ N as MonthView,
6887
+ $ as MpScheduler,
6888
+ xe as SchedulerStateManager,
6889
+ I as TimelineView,
6890
+ Te as WeekView,
6891
+ U as YearView,
6892
+ Ee as createInitialState,
6893
+ Ae as schedulerStyles
6327
6894
  };