@umriss-ui/schedule 0.7.1 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/schedule.js CHANGED
@@ -1,22 +1,19 @@
1
1
  "use client";
2
2
  import "./schedule.css";
3
- var hn = Object.defineProperty;
4
- var cn = (s, t, e) => t in s ? hn(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
5
- var f = (s, t, e) => cn(s, typeof t != "symbol" ? t + "" : t, e);
6
- import { localOffset as Bt, toWorkingTimeClamped as Y, DAY as X, MINUTE as q, timeStep as un, workingTimeTicks as fn, calendarFrom as nt, toWallClock as j, HOUR as xt, LinearScale as mn, resolveColours as pn, removedIntervals as gn, subscribeTheme as kn, Echoes as yn } from "@umriss-ui/charts";
7
- import { createContext as Ee, useContext as Ne, useRef as G, useEffect as U, forwardRef as Re, useId as vn, useState as et, useLayoutEffect as rt, useImperativeHandle as wn, useSyncExternalStore as Pe, useMemo as V, createElement as bn } from "react";
8
- import { jsxs as H, Fragment as lt, jsx as g } from "react/jsx-runtime";
9
- import { useFormats as Ht, useWording as kt, AngleGlyph as Mn, VisuallyHidden as ue } from "@umriss-ui/core";
10
- function ot(s) {
3
+ import { localOffset as Bt, toWorkingTimeClamped as R, calendarFrom as ft, toWallClock as Nt, MINUTE as X, DAY as z, timeStep as is, workingTimeTicks as os, HOUR as xt, LinearScale as rs, resolveColours as as, removedIntervals as ls, subscribeTheme as ds } from "@umriss-ui/charts";
4
+ import { useContext as _e, createContext as Fe, useRef as Y, useEffect as W, useId as hs, useState as nt, useLayoutEffect as ht, useImperativeHandle as us, useSyncExternalStore as Oe, useMemo as K, createElement as cs } from "react";
5
+ import { jsxs as x, Fragment as it, jsx as m } from "react/jsx-runtime";
6
+ import { useFormats as Rt, useWording as mt, AngleGlyph as fs, VisuallyHidden as de } from "@umriss-ui/core";
7
+ function et(s) {
11
8
  return { from: s.from - (s.leadIn ?? 0), to: s.to + (s.leadOut ?? 0) };
12
9
  }
13
- function Gt(s, t) {
10
+ function $t(s, t) {
14
11
  return (s.leaves ?? "leadOut") === "main" ? t.to : t.to + (t.leadOut ?? 0);
15
12
  }
16
- function Yt(s, t) {
13
+ function Gt(s, t) {
17
14
  return (s.arrives ?? "leadIn") === "main" ? t.from : t.from - (t.leadIn ?? 0);
18
15
  }
19
- function fe(s, t) {
16
+ function he(s, t) {
20
17
  if (t.kind === "place" || t.subtask !== s.id) return s;
21
18
  switch (t.kind) {
22
19
  case "move":
@@ -30,7 +27,7 @@ function fe(s, t) {
30
27
  return { ...s, lane: t.lane };
31
28
  }
32
29
  }
33
- function yo(s, t) {
30
+ function hi(s, t) {
34
31
  return {
35
32
  id: t,
36
33
  task: s.task,
@@ -41,20 +38,20 @@ function yo(s, t) {
41
38
  ...s.leadOut === void 0 ? {} : { leadOut: s.leadOut }
42
39
  };
43
40
  }
44
- function zt(s) {
41
+ function Ht(s) {
45
42
  const t = [], e = /* @__PURE__ */ new Map();
46
- s.forEach((n, o) => {
47
- const { from: i, to: r } = ot(n);
48
- if (!(i < r)) return;
43
+ s.forEach((n, i) => {
44
+ const { from: o, to: r } = et(n);
45
+ if (!(o < r)) return;
49
46
  const a = e.get(n.lane) ?? [];
50
- a.push({ subtask: n, index: o, from: i, to: r }), e.set(n.lane, a);
47
+ a.push({ subtask: n, index: i, from: o, to: r }), e.set(n.lane, a);
51
48
  });
52
- for (const [n, o] of e) {
53
- o.sort((i, r) => i.from - r.from || i.index - r.index);
54
- for (let i = 0; i < o.length; i++) {
55
- const r = o[i];
56
- for (let a = i + 1; a < o.length; a++) {
57
- const l = o[a];
49
+ for (const [n, i] of e) {
50
+ i.sort((o, r) => o.from - r.from || o.index - r.index);
51
+ for (let o = 0; o < i.length; o++) {
52
+ const r = i[o];
53
+ for (let a = o + 1; a < i.length; a++) {
54
+ const l = i[a];
58
55
  if (l.from >= r.to) break;
59
56
  t.push({ lane: n, first: r.subtask.id, second: l.subtask.id, from: l.from, to: Math.min(r.to, l.to) });
60
57
  }
@@ -62,398 +59,421 @@ function zt(s) {
62
59
  }
63
60
  return t;
64
61
  }
65
- function Tn(s) {
62
+ function ms(s) {
66
63
  const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map();
67
64
  for (const n of s) {
68
- const o = ot(n), i = e.get(n.lane) ?? [];
65
+ const i = et(n), o = e.get(n.lane) ?? [];
69
66
  let r = 0;
70
- if (o.from < o.to) {
71
- for (const a of i) o.from < a.to && a.from < o.to && r++;
72
- i.push(o);
67
+ if (i.from < i.to) {
68
+ for (const a of o) i.from < a.to && a.from < i.to && r++;
69
+ o.push(i);
73
70
  }
74
- e.set(n.lane, i), t.set(n.id, r);
71
+ e.set(n.lane, o), t.set(n.id, r);
75
72
  }
76
73
  return t;
77
74
  }
78
- function Kt(s, t) {
79
- const e = new Map(s.map((o) => [o.id, o])), n = [];
80
- for (const o of t) {
81
- const i = e.get(o.from), r = e.get(o.to);
82
- if (i === void 0 || r === void 0) continue;
83
- const a = Gt(o, i), l = Yt(o, r), h = a + o.lag - l;
84
- h > 0 && n.push({ dependency: o.id, departure: a, arrival: l, shortBy: h });
75
+ function Yt(s, t) {
76
+ const e = new Map(s.map((i) => [i.id, i])), n = [];
77
+ for (const i of t) {
78
+ const o = e.get(i.from), r = e.get(i.to);
79
+ if (o === void 0 || r === void 0) continue;
80
+ const a = $t(i, o), l = Gt(i, r), d = a + i.lag - l;
81
+ d > 0 && n.push({ dependency: i.id, departure: a, arrival: l, shortBy: d });
85
82
  }
86
83
  return n;
87
84
  }
88
- function $e(s, t) {
85
+ function Ee(s, t) {
89
86
  const e = [];
90
87
  for (const n of s) {
91
- const o = ot(n);
92
- for (const i of t)
93
- i.lane !== n.lane || !(o.from < i.to && i.from < o.to) || e.push({ subtask: n.id, blocked: i.id, lane: i.lane, from: Math.max(o.from, i.from), to: Math.min(o.to, i.to) });
88
+ const i = et(n);
89
+ for (const o of t)
90
+ o.lane !== n.lane || !(i.from < o.to && o.from < i.to) || e.push({ subtask: n.id, blocked: o.id, lane: o.lane, from: Math.max(i.from, o.from), to: Math.min(i.to, o.to) });
94
91
  }
95
92
  return e;
96
93
  }
97
- function vo(s, t, e = []) {
94
+ function ui(s, t, e = []) {
98
95
  return {
99
- overlaps: zt(s),
100
- violatedDependencies: Kt(s, t),
101
- inBlockedTime: $e(s, e)
96
+ overlaps: Ht(s),
97
+ violatedDependencies: Yt(s, t),
98
+ inBlockedTime: Ee(s, e)
102
99
  };
103
100
  }
104
- function wo(s, t, e) {
101
+ function ci(s, t, e) {
105
102
  if (e.kind === "place") return [];
106
- const n = new Map(s.map((l) => [l.id, fe(l, e)])), o = /* @__PURE__ */ new Map();
103
+ const n = new Map(s.map((l) => [l.id, he(l, e)])), i = /* @__PURE__ */ new Map();
107
104
  for (const l of t) {
108
- const h = o.get(l.from) ?? [];
109
- h.push(l), o.set(l.from, h);
105
+ const d = i.get(l.from) ?? [];
106
+ d.push(l), i.set(l.from, d);
110
107
  }
111
- const i = /* @__PURE__ */ new Map(), r = [e.subtask];
108
+ const o = /* @__PURE__ */ new Map(), r = [e.subtask];
112
109
  let a = (s.length + 1) * (t.length + 1);
113
110
  for (; r.length > 0 && a-- > 0; ) {
114
- const l = r.shift(), h = n.get(l);
115
- if (h !== void 0)
116
- for (const d of o.get(l) ?? []) {
117
- if (d.to === e.subtask) continue;
118
- const c = n.get(d.to);
111
+ const l = r.shift(), d = n.get(l);
112
+ if (d !== void 0)
113
+ for (const h of i.get(l) ?? []) {
114
+ if (h.to === e.subtask) continue;
115
+ const c = n.get(h.to);
119
116
  if (c === void 0) continue;
120
- const m = Gt(d, h) + d.lag - Yt(d, c);
121
- if (!(m > 0)) continue;
122
- const p = { kind: "move", subtask: c.id, from: c.from + m, to: c.to + m };
123
- n.set(c.id, fe(c, p)), i.set(c.id, p), r.push(c.id);
117
+ const f = $t(h, d) + h.lag - Gt(h, c);
118
+ if (!(f > 0)) continue;
119
+ const g = { kind: "move", subtask: c.id, from: c.from + f, to: c.to + f };
120
+ n.set(c.id, he(c, g)), o.set(c.id, g), r.push(c.id);
124
121
  }
125
122
  }
126
- return [...i.values()];
123
+ return [...o.values()];
127
124
  }
128
- function In(s, t) {
125
+ function ps(s, t) {
129
126
  const { step: e, offset: n } = typeof t == "number" ? { step: t, offset: 0 } : t;
130
127
  if (!(e > 0) || !Number.isFinite(s)) return s;
131
- const o = Bt(s) + n;
132
- return o + Math.round((s - o) / e) * e;
128
+ const i = Bt(s) + n;
129
+ return i + Math.round((s - i) / e) * e;
133
130
  }
134
- function bo(s, t, e) {
131
+ function fi(s, t, e) {
135
132
  return e === 0 || !Number.isFinite(e) ? [] : s.filter((n) => n.task === t).map((n) => ({ kind: "move", subtask: n.id, from: n.from + e, to: n.to + e }));
136
133
  }
137
- function yt(s) {
138
- let t = !1, e = !1, n = !1, o = !1;
139
- for (const i of s ?? [])
140
- i === "provisional" ? (t = !0, e = !1) : i === "fixed" ? (e = !0, t = !1) : i === "muted" ? n = !0 : i === "open" && (o = !0);
141
- return { dashed: t, hatched: e, muted: n, open: o };
134
+ function pt(s) {
135
+ let t = !1, e = !1, n = !1, i = !1;
136
+ for (const o of s ?? [])
137
+ o === "provisional" ? (t = !0, e = !1) : o === "fixed" ? (e = !0, t = !1) : o === "muted" ? n = !0 : o === "open" && (i = !0);
138
+ return { dashed: t, hatched: e, muted: n, open: i };
142
139
  }
143
- const Be = Ee(null), xe = Ee(null);
144
- function He() {
145
- return Ne(xe);
140
+ const Pe = /* @__PURE__ */ Fe(null), Be = /* @__PURE__ */ Fe(null);
141
+ function Ne() {
142
+ return _e(Be);
146
143
  }
147
- function Sn(s) {
148
- const t = Ne(Be);
144
+ function gs(s) {
145
+ const t = _e(Pe);
149
146
  if (t === null)
150
147
  throw new Error(`@umriss-ui/schedule: <${s}> must be used inside a <Schedule>.`);
151
148
  return t;
152
149
  }
153
- function Vt(s, t, e, n, o) {
154
- const i = Sn(s), r = G(null);
155
- U(() => (r.current = e(i, t), () => {
156
- r.current !== null && o(i, r.current), r.current = null;
157
- }), [i]), U(() => {
158
- r.current !== null && n(i, r.current, t);
150
+ function Kt(s, t, e, n, i) {
151
+ const o = gs(s), r = Y(null);
152
+ W(() => (r.current = e(o, t), () => {
153
+ r.current !== null && i(o, r.current), r.current = null;
154
+ }), [o]), W(() => {
155
+ r.current !== null && n(o, r.current, t);
159
156
  });
160
157
  }
161
- function Ln(s) {
162
- Vt("Lane", s, (t, e) => t.registerLane(e), (t, e, n) => t.updateLane(e, n), (t, e) => t.unregisterLane(e));
163
- }
164
- function An(s) {
165
- Vt("LaneGroup", s, (t, e) => t.registerGroup(e), (t, e, n) => t.updateGroup(e, n), (t, e) => t.unregisterGroup(e));
166
- }
167
- function vt(s, t) {
168
- Vt(s, t, (e, n) => e.registerLayer(n), (e, n, o) => e.updateLayer(n, o), (e, n) => e.unregisterLayer(n));
169
- }
170
- const Cn = 24, Dn = 4, _n = 3, Ct = 4;
171
- function me(s) {
172
- const { lanes: t, groups: e, collapsed: n, laneHeight: o } = s, i = new Map(e.map((k) => [k.id, k])), r = (k) => k !== void 0 && i.has(k) ? k : void 0, a = /* @__PURE__ */ new Map(), l = (k) => {
173
- const T = [];
174
- let S = r(k.parent);
175
- const E = /* @__PURE__ */ new Set();
176
- for (; S !== void 0 && !E.has(S); )
177
- E.add(S), T.unshift(S), S = r(i.get(S).parent);
178
- return T;
179
- }, h = /* @__PURE__ */ new Map();
180
- for (const k of t) {
181
- const T = l(k);
182
- h.set(k.id, T);
183
- for (const S of T) {
184
- const E = a.get(S) ?? [];
185
- E.push(k.id), a.set(S, E);
158
+ function ks(s) {
159
+ Kt("Lane", s, (t, e) => t.registerLane(e), (t, e, n) => t.updateLane(e, n), (t, e) => t.unregisterLane(e));
160
+ }
161
+ function vs(s) {
162
+ Kt("LaneGroup", s, (t, e) => t.registerGroup(e), (t, e, n) => t.updateGroup(e, n), (t, e) => t.unregisterGroup(e));
163
+ }
164
+ function gt(s, t) {
165
+ Kt(s, t, (e, n) => e.registerLayer(n), (e, n, i) => e.updateLayer(n, i), (e, n) => e.unregisterLayer(n));
166
+ }
167
+ const ys = 24, ws = 4, bs = 3, It = 4;
168
+ function ue(s) {
169
+ const { lanes: t, groups: e, collapsed: n, laneHeight: i } = s, o = new Map(e.map((p) => [p.id, p])), r = (p) => p !== void 0 && o.has(p) ? p : void 0, a = /* @__PURE__ */ new Map(), l = (p) => {
170
+ const M = [];
171
+ let T = r(p.parent);
172
+ const F = /* @__PURE__ */ new Set();
173
+ for (; T !== void 0 && !F.has(T); )
174
+ F.add(T), M.unshift(T), T = r(o.get(T).parent);
175
+ return M;
176
+ }, d = /* @__PURE__ */ new Map();
177
+ for (const p of t) {
178
+ const M = l(p);
179
+ d.set(p.id, M);
180
+ for (const T of M) {
181
+ const F = a.get(T) ?? [];
182
+ F.push(p.id), a.set(T, F);
186
183
  }
187
184
  }
188
- const d = [], c = /* @__PURE__ */ new Map();
189
- let m = [], p = null, y = 0;
190
- const I = (k) => (d.push({ ...k, top: y }), y += k.height, d.length - 1), A = (k) => k.find((T) => n.has(T)), C = () => {
191
- if (p === null) return;
192
- const { row: k, lanes: T } = p, S = d[k], E = Math.max(S.height, T.length * Dn + 2 * Ct);
193
- d[k] = { ...S, height: E }, y += E - S.height;
194
- const _ = E - 2 * Ct, P = Math.max(_n, Math.floor(_ / T.length));
195
- T.forEach((it, wt) => {
196
- const ut = h.get(it) ?? [];
197
- c.set(it, {
198
- top: S.top + Ct + wt * P,
199
- height: P,
185
+ const h = [], c = /* @__PURE__ */ new Map();
186
+ let f = [], g = null, v = 0;
187
+ const A = (p) => (h.push({ ...p, top: v }), v += p.height, h.length - 1), C = (p) => p.find((M) => n.has(M)), S = () => {
188
+ if (g === null) return;
189
+ const { row: p, lanes: M } = g, T = h[p], F = Math.max(T.height, M.length * ws + 2 * It);
190
+ h[p] = { ...T, height: F }, v += F - T.height;
191
+ const D = F - 2 * It, $ = Math.max(bs, Math.floor(D / M.length));
192
+ M.forEach((dt, kt) => {
193
+ const j = d.get(dt) ?? [];
194
+ c.set(dt, {
195
+ top: T.top + It + kt * $,
196
+ height: $,
200
197
  miniature: !0,
201
- group: ut[ut.length - 1]
198
+ group: j[j.length - 1]
202
199
  });
203
- }), p = null;
200
+ }), g = null;
204
201
  };
205
- for (const k of t) {
206
- const T = (h.get(k.id) ?? []).filter((_) => (a.get(_) ?? []).length > 0), S = A(T);
207
- if (p !== null && S === p.group) {
208
- p.lanes.push(k.id);
202
+ for (const p of t) {
203
+ const M = (d.get(p.id) ?? []).filter((D) => (a.get(D) ?? []).length > 0), T = C(M);
204
+ if (g !== null && T === g.group) {
205
+ g.lanes.push(p.id);
209
206
  continue;
210
207
  }
211
- C();
212
- const E = T.filter((_, P) => m[P] === _).length;
213
- m = m.slice(0, E);
214
- for (const _ of T.slice(E)) {
215
- if (m.push(_), _ === S) break;
216
- I({
208
+ S();
209
+ const F = M.filter((D, $) => f[$] === D).length;
210
+ f = f.slice(0, F);
211
+ for (const D of M.slice(F)) {
212
+ if (f.push(D), D === T) break;
213
+ A({
217
214
  kind: "groupHead",
218
215
  lane: void 0,
219
- group: _,
220
- depth: m.length - 1,
221
- within: [...m],
222
- lanes: (a.get(_) ?? []).length,
223
- height: Cn
216
+ group: D,
217
+ depth: f.length - 1,
218
+ within: [...f],
219
+ lanes: (a.get(D) ?? []).length,
220
+ height: ys
224
221
  });
225
222
  }
226
- if (S !== void 0) {
227
- const _ = T.indexOf(S), P = I({
223
+ if (T !== void 0) {
224
+ const D = M.indexOf(T), $ = A({
228
225
  kind: "miniature",
229
226
  lane: void 0,
230
- group: S,
231
- depth: _,
232
- within: T.slice(0, _ + 1),
233
- lanes: (a.get(S) ?? []).length,
234
- height: o
227
+ group: T,
228
+ depth: D,
229
+ within: M.slice(0, D + 1),
230
+ lanes: (a.get(T) ?? []).length,
231
+ height: i
235
232
  });
236
- p = { group: S, row: P, lanes: [k.id] };
233
+ g = { group: T, row: $, lanes: [p.id] };
237
234
  continue;
238
235
  }
239
- I({ kind: "lane", lane: k.id, group: T[T.length - 1], depth: T.length, within: T, lanes: 1, height: o }), c.set(k.id, {
240
- top: d[d.length - 1].top,
241
- height: o,
236
+ A({ kind: "lane", lane: p.id, group: M[M.length - 1], depth: M.length, within: M, lanes: 1, height: i }), c.set(p.id, {
237
+ top: h[h.length - 1].top,
238
+ height: i,
242
239
  miniature: !1,
243
- group: T[T.length - 1]
240
+ group: M[M.length - 1]
244
241
  });
245
242
  }
246
- return C(), { rows: d, slots: c, height: y };
243
+ return S(), { rows: h, slots: c, height: v };
247
244
  }
248
- function Fn(s, t) {
245
+ function Ms(s, t) {
249
246
  if (t.size === 0) return s;
250
247
  const e = /* @__PURE__ */ new Set();
251
248
  for (const n of s) t.has(n) || e.add(n);
252
249
  return e;
253
250
  }
254
- function st(s, t) {
251
+ function tt(s, t) {
255
252
  if (t < 0 || t >= s.height) return null;
256
253
  let e = 0, n = s.rows.length - 1;
257
254
  for (; e <= n; ) {
258
- const o = e + n >> 1, i = s.rows[o];
259
- if (t < i.top) n = o - 1;
260
- else if (t >= i.top + i.height) e = o + 1;
261
- else return i;
255
+ const i = e + n >> 1, o = s.rows[i];
256
+ if (t < o.top) n = i - 1;
257
+ else if (t >= o.top + o.height) e = i + 1;
258
+ else return o;
262
259
  }
263
260
  return null;
264
261
  }
265
- function Wt(s, t) {
262
+ function Vt(s, t) {
266
263
  return s.slots.get(t) ?? null;
267
264
  }
268
- function On(s, t) {
269
- const e = st(s, t);
265
+ function Ts(s, t) {
266
+ const e = tt(s, t);
270
267
  if (e === null) return null;
271
268
  if (e.kind === "lane") return e.lane ?? null;
272
269
  if (e.kind === "groupHead") return null;
273
- for (const [n, o] of s.slots)
274
- if (o.miniature && t >= o.top && t < o.top + o.height) return n;
270
+ for (const [n, i] of s.slots)
271
+ if (i.miniature && t >= i.top && t < i.top + i.height) return n;
275
272
  return null;
276
273
  }
277
- const En = 6, Ge = 3, at = 2, pe = 3, ge = 3;
278
- function R(s, t) {
279
- return Math.round(s.scale.toPx(Y(t, s.calendar)));
274
+ const Is = 6, xe = 3, st = 2, ce = 3, fe = 3;
275
+ function P(s, t) {
276
+ return Math.round(s.scale.toPx(R(t, s.calendar)));
280
277
  }
281
- function J(s, t) {
282
- const e = Wt(s.rows, t);
278
+ function q(s, t) {
279
+ const e = Vt(s.rows, t);
283
280
  return e === null ? null : { ...e, top: e.top - s.scrollY };
284
281
  }
285
- function Ut(s, t) {
286
- const e = J(s, t.lane);
287
- return e === null ? null : { x: R(s, t.at), y: e.top + e.height / 2, half: Math.max(2, Math.min(7, e.height * 0.3)) };
282
+ function Wt(s, t) {
283
+ const e = q(s, t.lane);
284
+ return e === null ? null : { x: P(s, t.at), y: e.top + e.height / 2, half: Math.max(2, Math.min(7, e.height * 0.3)) };
288
285
  }
289
- function ke(s, t) {
290
- return On(s.rows, t + s.scrollY);
286
+ function me(s, t) {
287
+ return Ts(s.rows, t + s.scrollY);
291
288
  }
292
- function Ye(s, t, e, n, o) {
293
- const i = n.miniature ? 0 : En, r = n.miniature ? 0 : ge * pe, a = Math.max(n.miniature ? 1 : 4, n.height - 2 * i - r), l = n.top - s.scrollY + Math.floor((n.height - a) / 2), h = ot(t);
289
+ function Re(s, t, e, n) {
290
+ const i = e.miniature ? 0 : Is, o = e.miniature ? 0 : fe * ce, r = Math.max(e.miniature ? 1 : 4, e.height - 2 * i - o), a = e.top - s.scrollY + Math.floor((e.height - r) / 2), l = et(t);
294
291
  return {
295
292
  subtask: t,
296
- lane: e,
297
- miniature: n.miniature,
298
- depth: o,
299
- y: l + (n.miniature ? 0 : Math.min(o, ge) * pe),
300
- height: a,
301
- outerFrom: R(s, h.from),
302
- mainFrom: R(s, t.from),
303
- mainTo: R(s, t.to),
304
- outerTo: R(s, h.to)
293
+ miniature: e.miniature,
294
+ depth: n,
295
+ y: a + (e.miniature ? 0 : Math.min(n, fe) * ce),
296
+ height: r,
297
+ outerFrom: P(s, l.from),
298
+ mainFrom: P(s, t.from),
299
+ mainTo: P(s, t.to),
300
+ outerTo: P(s, l.to)
305
301
  };
306
302
  }
307
- function ze(s, t, e) {
303
+ function $e(s, t, e) {
308
304
  if (e < s.y || e > s.y + s.height) return null;
309
305
  const n = Math.max(0, (6 - (s.outerTo - s.outerFrom)) / 2);
310
306
  return t < s.outerFrom - n || t > s.outerTo + n ? null : t < s.mainFrom ? "leadIn" : t > s.mainTo ? "leadOut" : "main";
311
307
  }
312
- function Nn(s, t, e, n = 5) {
308
+ function Ss(s, t, e, n = 5) {
313
309
  if (e < s.y || e > s.y + s.height) return null;
314
- const o = Math.abs(t - s.mainFrom), i = Math.abs(t - s.mainTo);
315
- return Math.min(o, i) > n ? null : o <= i ? "from" : "to";
310
+ const i = Math.abs(t - s.mainFrom), o = Math.abs(t - s.mainTo);
311
+ return Math.min(i, o) > n ? null : i <= o ? "from" : "to";
316
312
  }
317
- function Et(s, t, e) {
313
+ function Dt(s, t, e) {
318
314
  return s.outerTo >= 0 && s.outerFrom <= t && s.y + s.height >= 0 && s.y <= e;
319
315
  }
320
- const Rn = 64;
321
- function Pn(s, t) {
316
+ function Ls(s, t, e) {
317
+ let i = Math.min(s.x1, s.x2, s.c1x, s.c2x), o = Math.max(s.x1, s.x2, s.c1x, s.c2x), r = Math.min(s.y1, s.y2), a = Math.max(s.y1, s.y2);
318
+ for (let l = 0; l + 1 < s.points.length; l += 2)
319
+ i = Math.min(i, s.points[l]), o = Math.max(o, s.points[l]), r = Math.min(r, s.points[l + 1]), a = Math.max(a, s.points[l + 1]);
320
+ return o >= -8 && i <= t + 8 && a >= -8 && r <= e + 8;
321
+ }
322
+ const As = 64;
323
+ function Cs(s, t) {
322
324
  if (s.miniature) return null;
323
- const e = yt(s.subtask.appearance).hatched ? at + Ge + 1 : 0, n = Math.max(s.mainFrom + e, 0), o = Math.min(s.mainTo - e, t) - n;
324
- return o < Rn ? null : { x: n, width: o, y: s.y, height: s.height };
325
+ const e = pt(s.subtask.appearance).hatched ? st + xe + 1 : 0, n = Math.max(s.mainFrom + e, 0), i = Math.min(s.mainTo - e, t) - n;
326
+ return i < As ? null : { x: n, width: i, y: s.y, height: s.height };
325
327
  }
326
- const $n = 10;
327
- function ye(s, t, e) {
328
+ const Ds = 10;
329
+ function pe(s, t, e) {
328
330
  const n = Math.round(t.y + t.height / 2);
329
331
  return s === "centre" || e.y === t.y ? n : Math.round(e.y > t.y ? t.y + t.height - 1 : t.y + 1);
330
332
  }
331
- function Nt(s, t, e, n, o) {
332
- const i = t.route ?? o.route, r = t.attach ?? o.attach, a = t.ends ?? o.ends, l = R(s, Gt(t, e.subtask)), h = R(s, Yt(t, n.subtask)), d = ye(r, e, n), c = ye(r, n, e);
333
- if (i === "straight")
334
- return { dependency: t, kind: i, ends: a, x1: l, y1: d, x2: h, y2: c, c1x: l, c2x: h, points: [l, d, h, c] };
335
- if (i === "orthogonal") {
336
- const A = l + $n, C = d === c ? A : Math.round((A + h) / 2);
337
- return { dependency: t, kind: i, ends: a, x1: l, y1: d, x2: h, y2: c, c1x: l, c2x: h, points: d === c ? [l, d, h, c] : [l, d, C, d, C, c, h, c] };
338
- }
339
- const m = Math.max(14, Math.abs(h - l) / 2), p = l + m, y = h - m, I = [];
340
- for (let A = 0; A <= 16; A++) {
341
- const C = A / 16, k = 1 - C;
342
- I.push(
343
- k * k * k * l + 3 * k * k * C * p + 3 * k * C * C * y + C * C * C * h,
344
- k * k * k * d + 3 * k * k * C * d + 3 * k * C * C * c + C * C * C * c
333
+ function _t(s, t, e, n, i) {
334
+ const o = t.route ?? i.route, r = t.attach ?? i.attach, a = t.ends ?? i.ends, l = P(s, $t(t, e.subtask)), d = P(s, Gt(t, n.subtask)), h = pe(r, e, n), c = pe(r, n, e);
335
+ if (o === "straight")
336
+ return { dependency: t, kind: o, ends: a, x1: l, y1: h, x2: d, y2: c, c1x: l, c2x: d, points: [l, h, d, c] };
337
+ if (o === "orthogonal") {
338
+ const C = l + Ds, S = h === c ? C : Math.round((C + d) / 2);
339
+ return { dependency: t, kind: o, ends: a, x1: l, y1: h, x2: d, y2: c, c1x: l, c2x: d, points: h === c ? [l, h, d, c] : [l, h, S, h, S, c, d, c] };
340
+ }
341
+ const f = Math.max(14, Math.abs(d - l) / 2), g = l + f, v = d - f, A = [];
342
+ for (let C = 0; C <= 16; C++) {
343
+ const S = C / 16, p = 1 - S;
344
+ A.push(
345
+ p * p * p * l + 3 * p * p * S * g + 3 * p * S * S * v + S * S * S * d,
346
+ p * p * p * h + 3 * p * p * S * h + 3 * p * S * S * c + S * S * S * c
345
347
  );
346
348
  }
347
- return { dependency: t, kind: "curve", ends: a, x1: l, y1: d, x2: h, y2: c, c1x: p, c2x: y, points: I };
349
+ return { dependency: t, kind: "curve", ends: a, x1: l, y1: h, x2: d, y2: c, c1x: g, c2x: v, points: A };
348
350
  }
349
- function Bn(s, t, e) {
351
+ function _s(s, t, e) {
350
352
  let n = 1 / 0;
351
- const o = s.points;
352
- for (let i = 0; i + 3 < o.length; i += 2) {
353
- const r = o[i], a = o[i + 1], l = o[i + 2], h = o[i + 3], d = l - r, c = h - a, m = d * d + c * c, p = m === 0 ? 0 : Math.max(0, Math.min(1, ((t - r) * d + (e - a) * c) / m));
354
- n = Math.min(n, Math.hypot(t - (r + p * d), e - (a + p * c)));
353
+ const i = s.points;
354
+ for (let o = 0; o + 3 < i.length; o += 2) {
355
+ const r = i[o], a = i[o + 1], l = i[o + 2], d = i[o + 3], h = l - r, c = d - a, f = h * h + c * c, g = f === 0 ? 0 : Math.max(0, Math.min(1, ((t - r) * h + (e - a) * c) / f));
356
+ n = Math.min(n, Math.hypot(t - (r + g * h), e - (a + g * c)));
355
357
  }
356
358
  return n;
357
359
  }
358
- const Ke = [], xn = 56;
359
- function Hn(s, t = xn) {
360
- return s > 0 ? Math.min(X, Math.max(15 * q, un(s * t, 1))) : 15 * q;
360
+ const Ge = [], Fs = 56;
361
+ function Os(s, t = Fs) {
362
+ return s > 0 ? Math.min(z, Math.max(15 * X, is(s * t, 1))) : 15 * X;
361
363
  }
362
- function Gn(s, t, e = Ke) {
363
- const [n, o] = Ve(s, e);
364
- return fn(e, n, o, t, Bt(n)).filter(
365
- (i) => i.workingTime >= s[0] && i.workingTime <= s[1]
364
+ function Es(s, t, e = Ge) {
365
+ const [n, i] = He(s, e);
366
+ return os(e, n, i, t, Bt(n)).filter(
367
+ (o) => o.workingTime >= s[0] && o.workingTime <= s[1]
366
368
  );
367
369
  }
368
- function Yn(s, t = Ke) {
369
- const [e, n] = Ve(s, t), o = [], i = new Date(e);
370
- for (i.setHours(0, 0, 0, 0); i.getTime() < n && o.length < 400; ) {
371
- const r = i.getTime();
372
- i.setDate(i.getDate() + 1);
373
- const a = i.getTime();
374
- o.push({
370
+ function Ps(s, t = Ge) {
371
+ const [e, n] = He(s, t), i = [], o = new Date(e);
372
+ for (o.setHours(0, 0, 0, 0); o.getTime() < n && i.length < 400; ) {
373
+ const r = o.getTime();
374
+ o.setDate(o.getDate() + 1);
375
+ const a = o.getTime();
376
+ i.push({
375
377
  start: r,
376
- end: a,
377
- from: Y(r, t),
378
- to: Y(a, t)
378
+ from: R(r, t),
379
+ to: R(a, t)
379
380
  });
380
381
  }
381
- return o;
382
+ return i;
382
383
  }
383
- const Dt = [1, 2, 7, 14, 28];
384
- function zn(s, t) {
385
- return Dt.find((e) => e * s >= t) ?? Dt[Dt.length - 1];
384
+ const St = [1, 2, 7, 14, 28];
385
+ function Bs(s, t) {
386
+ return St.find((e) => e * s >= t) ?? St[St.length - 1];
386
387
  }
387
- function _t(s, t) {
388
- return ((Math.round((s - Bt(s)) / X) - 4) % t + t) % t === 0;
388
+ function Lt(s, t) {
389
+ return ((Math.round((s - Bt(s)) / z) - 4) % t + t) % t === 0;
389
390
  }
390
- function Kn(s, t, e, n) {
391
- const o = s[1] - s[0];
392
- if (!(o > 0)) return [s[0], s[1]];
393
- const i = Math.min(n.max, Math.max(n.min, o * e)), r = (t - s[0]) / o, a = t - r * i;
394
- return [a, a + i];
391
+ function Ns(s, t, e, n) {
392
+ const i = s[1] - s[0];
393
+ if (!(i > 0)) return [s[0], s[1]];
394
+ const o = Math.min(n.max, Math.max(n.min, i * e)), r = (t - s[0]) / i, a = t - r * o;
395
+ return [a, a + o];
395
396
  }
396
- function Vn(s, t) {
397
+ function xs(s, t) {
397
398
  return [s[0] + t, s[1] + t];
398
399
  }
399
- function Ve(s, t) {
400
- const e = nt(t);
401
- if (e.intervals.length === 0) return [s[0], s[1]];
402
- const n = (o) => Math.max(0, Math.min(e.total, o));
403
- return [j(n(s[0]), e), j(n(s[1]), e)];
400
+ function rt(s, t) {
401
+ const e = ft(t);
402
+ return e.intervals.length === 0 ? s : Nt(Math.max(0, Math.min(e.total, s)), e);
403
+ }
404
+ function He(s, t) {
405
+ return [rt(s[0], t), rt(s[1], t)];
404
406
  }
405
- const gt = 44;
406
- class Wn {
407
+ const Ft = 44;
408
+ class Rs {
407
409
  constructor(t) {
408
- f(this, "options", {
409
- laneHeight: gt,
410
- calendar: [],
411
- zoomLimits: { min: xt, max: 28 * X },
412
- snap: "ticks",
413
- intents: [],
414
- now: null,
415
- route: "curve",
416
- attach: "centre",
417
- ends: "dot"
418
- });
419
- f(this, "domain", [0, X]);
420
- f(this, "scrollY", 0);
421
- f(this, "width", 0);
422
- f(this, "height", 0);
423
- /* What is laid out from top to bottom (`rows.ts`). It is derived here and
424
- not in the data, because a row's height comes from a view option; every y
425
- in the package reads it. */
426
- f(this, "rows", me({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: gt }));
427
- /** The folded groups, as the scene holds them. */
428
- f(this, "collapsed", /* @__PURE__ */ new Set());
429
- /** The groups a gesture in flight holds open. Dropped when it ends; the
430
- caller's list never learns of it. */
431
- f(this, "openForGesture", /* @__PURE__ */ new Set());
432
- f(this, "boxes", []);
433
- f(this, "boxById", /* @__PURE__ */ new Map());
434
- f(this, "paths", []);
435
410
  this.data = t;
436
411
  }
412
+ options = {
413
+ laneHeight: Ft,
414
+ calendar: [],
415
+ zoomLimits: { min: xt, max: 28 * z },
416
+ snap: "ticks",
417
+ intents: [],
418
+ now: null,
419
+ route: "curve",
420
+ attach: "centre",
421
+ ends: "dot"
422
+ };
423
+ domain = [0, z];
424
+ scrollY = 0;
425
+ width = 0;
426
+ height = 0;
427
+ /* What is laid out from top to bottom (`rows.ts`). It is derived here and
428
+ not in the data, because a row's height comes from a view option; every y
429
+ in the package reads it. */
430
+ rows = ue({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: Ft });
431
+ /** The folded groups, as the scene holds them. */
432
+ collapsed = /* @__PURE__ */ new Set();
433
+ /** The groups a gesture in flight holds open. Dropped when it ends; the
434
+ caller's list never learns of it. */
435
+ openForGesture = /* @__PURE__ */ new Set();
436
+ laidBoxes = [];
437
+ laidBoxById = /* @__PURE__ */ new Map();
438
+ laidPaths = [];
439
+ /** Whether the domain or the scroll moved since the layout; the layout is
440
+ then made when it is read and not once per event. */
441
+ moved = !1;
442
+ get boxes() {
443
+ return this.current(), this.laidBoxes;
444
+ }
445
+ get boxById() {
446
+ return this.current(), this.laidBoxById;
447
+ }
448
+ get paths() {
449
+ return this.current(), this.laidPaths;
450
+ }
451
+ /** Says the domain or the scroll moved: the next read of the layout makes it. */
452
+ invalidate() {
453
+ this.moved = !0;
454
+ }
455
+ current() {
456
+ this.moved && this.layout();
457
+ }
437
458
  /** Takes new options; a new calendar keeps the wall-clock span in view. */
438
459
  setOptions(t) {
439
460
  const e = t.calendar !== this.options.calendar, n = this.options.calendar;
440
461
  if (this.options = t, e) {
441
- const o = nt(n), i = (r) => {
442
- const a = o.intervals.length === 0 ? r : Math.max(0, Math.min(o.total, r));
443
- return Y(j(a, o), t.calendar) + (r - a);
462
+ const i = ft(n), o = (r) => {
463
+ const a = i.intervals.length === 0 ? r : Math.max(0, Math.min(i.total, r));
464
+ return R(Nt(a, i), t.calendar) + (r - a);
444
465
  };
445
- this.domain = [i(this.domain[0]), i(this.domain[1])];
466
+ this.domain = [o(this.domain[0]), o(this.domain[1])];
446
467
  }
447
468
  }
448
469
  /** Puts a span of two wall-clock instants in view. */
449
470
  showWall(t) {
450
- this.domain = [Y(t[0], this.options.calendar), Y(t[1], this.options.calendar)];
471
+ this.domain = [R(t[0], this.options.calendar), R(t[1], this.options.calendar)];
451
472
  }
452
473
  viewport() {
453
474
  return {
454
- scale: new mn(this.domain, [0, this.width]),
475
+ scale: new rs(this.domain, [0, this.width]),
455
476
  calendar: this.options.calendar,
456
- laneHeight: this.options.laneHeight,
457
477
  scrollY: this.scrollY,
458
478
  rows: this.rows
459
479
  };
@@ -468,28 +488,28 @@ class Wn {
468
488
  /** The fine band's step at the current zoom. */
469
489
  step() {
470
490
  const t = this.domain[1] - this.domain[0];
471
- return Hn(this.width > 0 ? t / this.width : t);
491
+ return Os(this.width > 0 ? t / this.width : t);
472
492
  }
473
493
  /** Lays the rows out, clamps the scroll, and lays the data out anew. */
474
494
  layout() {
475
- this.rows = me({
495
+ this.moved = !1, this.rows = ue({
476
496
  lanes: this.data.lanes,
477
497
  groups: this.data.groups,
478
- collapsed: Fn(this.collapsed, this.openForGesture),
498
+ collapsed: Ms(this.collapsed, this.openForGesture),
479
499
  laneHeight: this.options.laneHeight
480
500
  }), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY));
481
501
  const t = this.viewport();
482
- this.boxes = [], this.boxById = /* @__PURE__ */ new Map();
502
+ this.laidBoxes = [], this.laidBoxById = /* @__PURE__ */ new Map();
483
503
  for (const e of this.data.subtasks) {
484
- const n = Wt(this.rows, e.lane);
504
+ const n = Vt(this.rows, e.lane);
485
505
  if (n === null) continue;
486
- const o = Ye(t, e, e.lane, n, this.data.depth.get(e.id) ?? 0);
487
- this.boxes.push(o), this.boxById.set(e.id, o);
506
+ const i = Re(t, e, n, this.data.depth.get(e.id) ?? 0);
507
+ this.laidBoxes.push(i), this.laidBoxById.set(e.id, i);
488
508
  }
489
- this.paths = [];
509
+ this.laidPaths = [];
490
510
  for (const e of this.data.dependencies) {
491
- const n = this.boxById.get(e.from), o = this.boxById.get(e.to);
492
- n === void 0 || o === void 0 || this.paths.push(Nt(t, e, n, o, this.options));
511
+ const n = this.boxById.get(e.from), i = this.boxById.get(e.to);
512
+ n === void 0 || i === void 0 || this.laidPaths.push(_t(t, e, n, i, this.options));
493
513
  }
494
514
  }
495
515
  /** The days of the coarse band and the ticks of the fine band, in pixels. */
@@ -498,11 +518,11 @@ class Wn {
498
518
  if (this.width <= 0) return { days: [], ticks: [], step: t };
499
519
  const e = this.viewport().scale, n = this.options.calendar;
500
520
  return {
501
- days: Yn(this.domain, n).map((o) => {
502
- const i = Math.round(e.toPx(o.from));
503
- return { start: o.start, x: i, width: Math.round(e.toPx(o.to)) - i };
521
+ days: Ps(this.domain, n).map((i) => {
522
+ const o = Math.round(e.toPx(i.from));
523
+ return { start: i.start, x: o, width: Math.round(e.toPx(i.to)) - o };
504
524
  }),
505
- ticks: Gn(this.domain, t, n).map((o) => ({ wallClock: o.wallClock, x: Math.round(e.toPx(o.workingTime)) })),
525
+ ticks: Es(this.domain, t, n).map((i) => ({ wallClock: i.wallClock, x: Math.round(e.toPx(i.workingTime)) })),
506
526
  step: t
507
527
  };
508
528
  }
@@ -510,32 +530,32 @@ class Wn {
510
530
  nowX() {
511
531
  const t = this.options.now;
512
532
  if (t === null || this.width <= 0) return null;
513
- const e = Math.round(this.viewport().scale.toPx(Y(t, this.options.calendar)));
533
+ const e = Math.round(this.viewport().scale.toPx(R(t, this.options.calendar)));
514
534
  return e >= 0 && e <= this.width ? e : null;
515
535
  }
516
536
  hitAt(t, e) {
517
537
  const n = this.viewport();
518
538
  for (let a = this.data.milestones.length - 1; a >= 0; a--) {
519
- const l = this.data.milestones[a], h = Ut(n, l);
520
- if (h !== null && Math.abs(t - h.x) + Math.abs(e - h.y) <= h.half + 2) return { kind: "milestone", milestone: l };
539
+ const l = this.data.milestones[a], d = Wt(n, l);
540
+ if (d !== null && Math.abs(t - d.x) + Math.abs(e - d.y) <= d.half + 2) return { kind: "milestone", milestone: l };
521
541
  }
522
542
  for (let a = this.boxes.length - 1; a >= 0; a--) {
523
- const l = this.boxes[a], h = ze(l, t, e);
524
- if (h !== null) return { kind: "subtask", subtask: l.subtask, part: h };
543
+ const l = this.boxes[a], d = $e(l, t, e);
544
+ if (d !== null) return { kind: "subtask", subtask: l.subtask, part: d };
525
545
  }
526
- let o = null, i = 4;
546
+ let i = null, o = 4;
527
547
  for (const a of this.paths) {
528
- const l = Bn(a, t, e);
529
- l <= i && (i = l, o = a);
548
+ const l = _s(a, t, e);
549
+ l <= o && (o = l, i = a);
530
550
  }
531
- if (o !== null) return { kind: "dependency", dependency: o.dependency };
532
- const r = ke(this.viewport(), e);
551
+ if (i !== null) return { kind: "dependency", dependency: i.dependency };
552
+ const r = me(this.viewport(), e);
533
553
  return r !== null ? { kind: "lane", lane: r } : { kind: "nothing" };
534
554
  }
535
555
  /** The wall-clock time at a plot x; within the calendar's extent. */
536
556
  timeAt(t) {
537
- const e = this.viewport().scale.fromPx(t), n = nt(this.options.calendar);
538
- return n.intervals.length === 0 ? e : j(Math.max(0, Math.min(n.total, e)), n);
557
+ const e = this.viewport().scale.fromPx(t);
558
+ return rt(e, this.options.calendar);
539
559
  }
540
560
  /** The lane at a y, strips included: what the pointer is ON.
541
561
 
@@ -544,7 +564,7 @@ class Wn {
544
564
  `foldedGroupAt` - and a caller that reached through `viewport()` for it
545
565
  would be depending on the layout rather than asking the view. */
546
566
  laneIdAt(t) {
547
- return ke(this.viewport(), t);
567
+ return me(this.viewport(), t);
548
568
  }
549
569
  /** The lane a DROP at this y would land on.
550
570
 
@@ -554,483 +574,480 @@ class Wn {
554
574
  aim at. Hover, the tooltip and selection do read a strip - they cost
555
575
  nothing if they are a pixel out. */
556
576
  dropLaneIdAt(t) {
557
- const e = st(this.rows, t + this.scrollY);
577
+ const e = tt(this.rows, t + this.scrollY);
558
578
  return e === null || e.kind !== "lane" ? null : e.lane ?? null;
559
579
  }
560
580
  /** The folded group a y lies over, or null. */
561
581
  foldedGroupAt(t) {
562
- const e = st(this.rows, t + this.scrollY);
582
+ const e = tt(this.rows, t + this.scrollY);
563
583
  return e !== null && e.kind === "miniature" ? e.group ?? null : null;
564
584
  }
565
585
  /** Pans by pixels. Says what moved: the span through time, the lanes, or
566
586
  neither - a scroll through the lanes is no news about the time. */
567
587
  pan(t, e) {
568
- const n = this.domain[0], o = this.scrollY, i = this.domain[1] - n;
569
- this.width > 0 && t !== 0 && (this.domain = Vn(this.domain, t / this.width * i)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
588
+ const n = this.domain[0], i = this.scrollY, o = this.domain[1] - n;
589
+ this.width > 0 && t !== 0 && (this.domain = xs(this.domain, t / this.width * o)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
570
590
  const r = this.domain[0] !== n;
571
- return { moved: r || this.scrollY !== o, time: r };
591
+ return { moved: r || this.scrollY !== i, time: r };
572
592
  }
573
593
  /** Zooms around a plot x; says whether the span changed. */
574
594
  zoomAt(t, e) {
575
595
  if (this.width <= 0 || !Number.isFinite(e)) return !1;
576
- const n = this.domain, o = this.viewport().scale.fromPx(t);
577
- return this.domain = Kn(this.domain, o, e, this.options.zoomLimits), n[0] !== this.domain[0] || n[1] !== this.domain[1];
578
- }
579
- }
580
- const Un = "_root_1892z_4 _text_1krlf_23", Xn = "_corner_1892z_19", qn = "_dayBand_1892z_23", jn = "_tickBand_1892z_24", Jn = "_day_1892z_23", Zn = "_dayLabel_1892z_50", Qn = "_tick_1892z_24", ts = "_tickLabel_1892z_71", es = "_headers_1892z_79", ns = "_header_1892z_79", ss = "_headerLabel_1892z_97", os = "_headerCount_1892z_134", is = "_chevron_1892z_143", rs = "_plot_1892z_201", as = "_focusRing_1892z_208", ls = "_layer_1892z_226", ds = "_grip_1892z_235", hs = "_ghostLabel_1892z_245", cs = "_finding_1892z_258", us = "_refusal_1892z_266", fs = "_tooltip_1892z_270", ms = "_tooltipHead_1892z_289", ps = "_tooltipTimes_1892z_294", gs = "_now_1892z_303", ks = "_barLabel_1892z_317", ys = "_barLabelText_1892z_330", v = {
581
- root: Un,
582
- corner: Xn,
583
- dayBand: qn,
584
- tickBand: jn,
585
- day: Jn,
586
- dayLabel: Zn,
587
- tick: Qn,
588
- tickLabel: ts,
589
- headers: es,
590
- header: ns,
591
- headerLabel: ss,
592
- headerCount: os,
593
- chevron: is,
594
- plot: rs,
595
- focusRing: as,
596
- layer: ls,
597
- grip: ds,
598
- ghostLabel: hs,
599
- finding: cs,
600
- refusal: us,
601
- tooltip: fs,
602
- tooltipHead: ms,
603
- tooltipTimes: ps,
604
- now: gs,
605
- barLabel: ks,
606
- barLabelText: ys
596
+ const n = this.domain, i = this.viewport().scale.fromPx(t);
597
+ return this.domain = Ns(this.domain, i, e, this.options.zoomLimits), n[0] !== this.domain[0] || n[1] !== this.domain[1];
598
+ }
599
+ }
600
+ const $s = "_root_1g7hg_4 _text_18806_22", Gs = "_corner_1g7hg_19", Hs = "_dayBand_1g7hg_23", Ys = "_tickBand_1g7hg_24", Ks = "_day_1g7hg_23", Vs = "_dayLabel_1g7hg_50", Ws = "_tick_1g7hg_24", zs = "_tickLabel_1g7hg_71", Us = "_headers_1g7hg_79", Xs = "_header_1g7hg_79", qs = "_headerLabel_1g7hg_97", js = "_headerCount_1g7hg_133", Js = "_chevron_1g7hg_142", Zs = "_plot_1g7hg_197", Qs = "_focusRing_1g7hg_204", tn = "_layer_1g7hg_222", en = "_grip_1g7hg_231", sn = "_ghostLabel_1g7hg_241", nn = "_finding_1g7hg_254", on = "_refusal_1g7hg_262", rn = "_tooltip_1g7hg_266", an = "_tooltipHead_1g7hg_285", ln = "_tooltipTimes_1g7hg_290", dn = "_now_1g7hg_299", hn = "_barLabel_1g7hg_313", un = "_barLabelText_1g7hg_326", k = {
601
+ root: $s,
602
+ corner: Gs,
603
+ dayBand: Hs,
604
+ tickBand: Ys,
605
+ day: Ks,
606
+ dayLabel: Vs,
607
+ tick: Ws,
608
+ tickLabel: zs,
609
+ headers: Us,
610
+ header: Xs,
611
+ headerLabel: qs,
612
+ headerCount: js,
613
+ chevron: Js,
614
+ plot: Zs,
615
+ focusRing: Qs,
616
+ layer: tn,
617
+ grip: en,
618
+ ghostLabel: sn,
619
+ finding: nn,
620
+ refusal: on,
621
+ tooltip: rn,
622
+ tooltipHead: an,
623
+ tooltipTimes: ln,
624
+ now: dn,
625
+ barLabel: hn,
626
+ barLabelText: un
607
627
  };
608
- function We() {
609
- const s = kt();
628
+ function Ye() {
629
+ const s = mt();
610
630
  return (t) => {
611
- const e = Math.round(t / q), n = Math.floor(e / 60), o = e % 60;
612
- return [n > 0 ? s.hoursShort(n) : "", o > 0 || n === 0 ? s.minutesShort(o) : ""].filter(Boolean).join(" ");
631
+ const e = Math.round(t / X), n = Math.floor(e / 60), i = e % 60;
632
+ return [n > 0 ? s.hoursShort(n) : "", i > 0 || n === 0 ? s.minutesShort(i) : ""].filter(Boolean).join(" ");
613
633
  };
614
634
  }
615
- function vs({ target: s, lane: t }) {
616
- const e = Ht(), n = kt(), o = We(), i = (c) => e.time(new Date(c), !1);
635
+ function cn({ target: s, lane: t }) {
636
+ const e = Rt(), n = mt(), i = Ye(), o = (c) => e.time(new Date(c), !1);
617
637
  if (s.kind === "subtask") {
618
- const { subtask: c, task: m } = s, p = [
619
- (m == null ? void 0 : m.name) ?? c.task,
638
+ const { subtask: c, task: f } = s, g = [
639
+ f?.name ?? c.task,
620
640
  c.name ?? c.id,
621
- `${e.dateShort(new Date(c.from))} ${n.scheduleGhostTimes(i(c.from), i(c.to))}`,
622
- ...s.overlapping.map((y) => n.scheduleOverlapWith(y.name ?? y.id)),
623
- ...s.violatedDependencies.map((y) => n.scheduleViolatedBy(o(y.shortBy))),
624
- ...s.blocked.map((y) => n.scheduleInBlockedTime(y.label))
641
+ `${e.dateShort(new Date(c.from))} ${n.scheduleGhostTimes(o(c.from), o(c.to))}`,
642
+ ...s.overlapping.map((v) => n.scheduleOverlapWith(v.name ?? v.id)),
643
+ ...s.violatedDependencies.map((v) => n.scheduleViolatedBy(i(v.shortBy))),
644
+ ...s.blocked.map((v) => n.scheduleInBlockedTime(v.label))
625
645
  ];
626
- return /* @__PURE__ */ H(lt, { children: [
646
+ return /* @__PURE__ */ x(it, { children: [
627
647
  t,
628
- `, ${p.join(", ")}`
648
+ `, ${g.join(", ")}`
629
649
  ] });
630
650
  }
631
651
  if (s.kind === "milestone") {
632
652
  const { milestone: c } = s;
633
- return /* @__PURE__ */ H(lt, { children: [
653
+ return /* @__PURE__ */ x(it, { children: [
634
654
  t,
635
- `, ${n.scheduleMilestone(c.label ?? c.id)}, ${e.dateShort(new Date(c.at))} ${i(c.at)}`
655
+ `, ${n.scheduleMilestone(c.label ?? c.id)}, ${e.dateShort(new Date(c.at))} ${o(c.at)}`
636
656
  ] });
637
657
  }
638
- const { dependency: r, task: a, from: l, to: h, violated: d } = s;
658
+ const { dependency: r, task: a, from: l, to: d, violated: h } = s;
639
659
  return [
640
- (a == null ? void 0 : a.name) ?? (a == null ? void 0 : a.id) ?? r.id,
641
- `${n.scheduleDependency} ${o(r.lag)}`,
642
- n.scheduleRoute((l == null ? void 0 : l.name) ?? r.from, (h == null ? void 0 : h.name) ?? r.to),
643
- ...d === void 0 ? [] : [n.scheduleViolatedBy(o(d.shortBy))]
660
+ a?.name ?? a?.id ?? r.id,
661
+ `${n.scheduleDependency} ${i(r.lag)}`,
662
+ n.scheduleRoute(l?.name ?? r.from, d?.name ?? r.to),
663
+ ...h === void 0 ? [] : [n.scheduleViolatedBy(i(h.shortBy))]
644
664
  ].join(", ");
645
665
  }
646
- function ws({ target: s }) {
647
- const t = Ht(), e = kt(), n = (d) => t.time(new Date(d), !1), o = We();
666
+ function fn({ target: s }) {
667
+ const t = Rt(), e = mt(), n = (h) => t.time(new Date(h), !1), i = Ye();
648
668
  if (s.kind === "subtask") {
649
- const { subtask: d, task: c } = s;
650
- return /* @__PURE__ */ H(lt, { children: [
651
- /* @__PURE__ */ g("span", { className: v.tooltipHead, children: (c == null ? void 0 : c.name) ?? d.task }),
652
- /* @__PURE__ */ g("span", { children: d.name ?? d.id }),
653
- /* @__PURE__ */ g("span", { className: v.tooltipTimes, children: e.scheduleGhostTimes(n(d.from), n(d.to)) }),
654
- (d.leadIn ?? 0) > 0 && /* @__PURE__ */ g("span", { children: `${e.scheduleLeadIn} ${o(d.leadIn)}` }),
655
- (d.leadOut ?? 0) > 0 && /* @__PURE__ */ g("span", { children: `${e.scheduleLeadOut} ${o(d.leadOut)}` }),
656
- s.overlapping.map((m) => /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleOverlapWith(m.name ?? m.id) }, m.id)),
657
- s.violatedDependencies.map((m) => /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleViolatedBy(o(m.shortBy)) }, m.dependency)),
658
- s.blocked.map((m) => /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleInBlockedTime(m.label) }, m.id))
669
+ const { subtask: h, task: c } = s;
670
+ return /* @__PURE__ */ x(it, { children: [
671
+ /* @__PURE__ */ m("span", { className: k.tooltipHead, children: c?.name ?? h.task }),
672
+ /* @__PURE__ */ m("span", { children: h.name ?? h.id }),
673
+ /* @__PURE__ */ m("span", { className: k.tooltipTimes, children: e.scheduleGhostTimes(n(h.from), n(h.to)) }),
674
+ (h.leadIn ?? 0) > 0 && /* @__PURE__ */ m("span", { children: `${e.scheduleLeadIn} ${i(h.leadIn)}` }),
675
+ (h.leadOut ?? 0) > 0 && /* @__PURE__ */ m("span", { children: `${e.scheduleLeadOut} ${i(h.leadOut)}` }),
676
+ s.overlapping.map((f) => /* @__PURE__ */ m("span", { className: k.finding, children: e.scheduleOverlapWith(f.name ?? f.id) }, f.id)),
677
+ s.violatedDependencies.map((f) => /* @__PURE__ */ m("span", { className: k.finding, children: e.scheduleViolatedBy(i(f.shortBy)) }, f.dependency)),
678
+ s.blocked.map((f) => /* @__PURE__ */ m("span", { className: k.finding, children: e.scheduleInBlockedTime(f.label) }, f.id))
659
679
  ] });
660
680
  }
661
681
  if (s.kind === "milestone") {
662
- const { milestone: d } = s;
663
- return /* @__PURE__ */ H(lt, { children: [
664
- /* @__PURE__ */ g("span", { className: v.tooltipHead, children: e.scheduleMilestone(d.label ?? d.id) }),
665
- /* @__PURE__ */ g("span", { className: v.tooltipTimes, children: `${t.dateShort(new Date(d.at))} ${n(d.at)}` })
682
+ const { milestone: h } = s;
683
+ return /* @__PURE__ */ x(it, { children: [
684
+ /* @__PURE__ */ m("span", { className: k.tooltipHead, children: e.scheduleMilestone(h.label ?? h.id) }),
685
+ /* @__PURE__ */ m("span", { className: k.tooltipTimes, children: `${t.dateShort(new Date(h.at))} ${n(h.at)}` })
666
686
  ] });
667
687
  }
668
- const { dependency: i, task: r, from: a, to: l, violated: h } = s;
669
- return /* @__PURE__ */ H(lt, { children: [
670
- /* @__PURE__ */ g("span", { className: v.tooltipHead, children: (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.id) ?? i.id }),
671
- /* @__PURE__ */ g("span", { children: e.scheduleRoute((a == null ? void 0 : a.name) ?? i.from, (l == null ? void 0 : l.name) ?? i.to) }),
672
- /* @__PURE__ */ g("span", { children: `${e.scheduleDependency} ${o(i.lag)}` }),
673
- h !== void 0 && /* @__PURE__ */ g("span", { className: v.finding, children: e.scheduleViolatedBy(o(h.shortBy)) })
688
+ const { dependency: o, task: r, from: a, to: l, violated: d } = s;
689
+ return /* @__PURE__ */ x(it, { children: [
690
+ /* @__PURE__ */ m("span", { className: k.tooltipHead, children: r?.name ?? r?.id ?? o.id }),
691
+ /* @__PURE__ */ m("span", { children: e.scheduleRoute(a?.name ?? o.from, l?.name ?? o.to) }),
692
+ /* @__PURE__ */ m("span", { children: `${e.scheduleDependency} ${i(o.lag)}` }),
693
+ d !== void 0 && /* @__PURE__ */ m("span", { className: k.finding, children: e.scheduleViolatedBy(i(d.shortBy)) })
674
694
  ] });
675
695
  }
676
- const bs = [], ve = { min: xt, max: 28 * X }, Ms = [], we = 20, Ft = 44, Ts = Re(function(t, e) {
677
- var ce;
696
+ const mn = [], ge = { min: xt, max: 28 * z }, pn = [], ke = 20, At = 44;
697
+ function gn(s) {
678
698
  const {
679
- scene: n,
680
- ariaLabel: o,
699
+ ref: t,
700
+ scene: e,
701
+ ariaLabel: n,
681
702
  height: i = 400,
682
- laneHeight: r = gt,
683
- headerWidth: a = 160,
684
- calendar: l = Ms,
685
- zoomLimits: h,
703
+ laneHeight: o = Ft,
704
+ headerWidth: r = 160,
705
+ calendar: a = pn,
706
+ zoomLimits: l,
686
707
  snap: d = "ticks",
687
- intents: c = bs,
688
- onIntent: m,
689
- canMoveTo: p,
690
- onInteraction: y,
691
- selectedTask: I,
708
+ intents: h = mn,
709
+ onIntent: c,
710
+ canMoveTo: f,
711
+ onInteraction: g,
712
+ selectedTask: v,
692
713
  onSelectedTaskChange: A,
693
714
  placing: C,
694
- route: k = "curve",
695
- attach: T = "centre",
696
- ends: S = "dot",
697
- label: E,
698
- tooltip: _,
699
- now: P,
700
- className: it,
701
- style: wt,
702
- children: ut
703
- } = t, bt = vn(), qt = `${bt}-summary`, jt = G(null), Jt = G(null), Zt = G(null), Qt = G(null), z = Ht(), B = kt(), te = (h == null ? void 0 : h.min) ?? ve.min, ee = (h == null ? void 0 : h.max) ?? ve.max, ne = typeof d == "object" ? d.step : null, se = typeof d == "object" ? d.offset : null, oe = typeof d == "object" ? null : d, [en, nn] = et(() => Date.now());
704
- U(() => {
705
- if (P !== !0) return;
706
- const u = setInterval(() => nn(Date.now()), q);
715
+ route: S = "curve",
716
+ attach: p = "centre",
717
+ ends: M = "dot",
718
+ label: T,
719
+ tooltip: F,
720
+ now: D,
721
+ className: $,
722
+ style: dt,
723
+ children: kt
724
+ } = s, j = hs(), Ut = `${j}-summary`, Xt = Y(null), qt = Y(null), jt = Y(null), Jt = Y(null), G = Rt(), B = mt(), Zt = l?.min ?? ge.min, Qt = l?.max ?? ge.max, te = typeof d == "object" ? d.step : null, ee = typeof d == "object" ? d.offset : null, se = typeof d == "object" ? null : d, [je, Je] = nt(() => Date.now());
725
+ W(() => {
726
+ if (D !== !0) return;
727
+ const u = setInterval(() => Je(Date.now()), X);
707
728
  return () => clearInterval(u);
708
- }, [P]);
709
- const ie = P === !0 ? en : typeof P == "number" ? P : null;
710
- rt(() => {
711
- const u = oe ?? { step: ne ?? 0, offset: se ?? 0 };
712
- n.setOptions({ laneHeight: r, calendar: l, zoomLimits: { min: te, max: ee }, snap: u, intents: c, now: ie, route: k, attach: T, ends: S });
713
- }, [n, r, l, te, ee, oe, ne, se, c, ie, k, T, S]), U(() => {
714
- n.setHandlers({ onIntent: m, canMoveTo: p, onInteraction: y, onSelectedTaskChange: A });
715
- }, [n, m, p, y, A]), wn(
716
- e,
729
+ }, [D]);
730
+ const ne = D === !0 ? je : typeof D == "number" ? D : null;
731
+ ht(() => {
732
+ const u = se ?? { step: te ?? 0, offset: ee ?? 0 };
733
+ e.setOptions({ laneHeight: o, calendar: a, zoomLimits: { min: Zt, max: Qt }, snap: u, intents: h, now: ne, route: S, attach: p, ends: M });
734
+ }, [e, o, a, Zt, Qt, se, te, ee, h, ne, S, p, M]), W(() => {
735
+ e.setHandlers({ onIntent: c, canMoveTo: f, onInteraction: g, onSelectedTaskChange: A });
736
+ }, [e, c, f, g, A]), us(
737
+ t,
717
738
  () => ({
718
- positionAt: (u, w) => n.positionAt(u, w),
719
- clientPointOf: (u, w) => n.clientPointOf(u, w),
720
- visibleDomain: () => n.visibleDomain()
739
+ positionAt: (u, y) => e.positionAt(u, y),
740
+ clientPointOf: (u, y) => e.clientPointOf(u, y),
741
+ visibleDomain: () => e.visibleDomain()
721
742
  }),
722
- [n]
723
- ), U(() => {
724
- n.setControlledTask(I);
725
- }, [n, I]), U(() => {
726
- n.setPlacing(C ?? null);
727
- }, [n, C]), U(() => {
728
- const u = jt.current, w = Jt.current, L = Zt.current, N = Qt.current;
729
- if (!u || !w || !L || !N) return;
730
- n.bind(u, w, L, N);
731
- const D = w.getBoundingClientRect();
732
- n.resize(D.width, D.height);
733
- const F = new ResizeObserver((O) => {
734
- var ft;
735
- const x = (ft = O[O.length - 1]) == null ? void 0 : ft.contentRect;
736
- x !== void 0 && n.resize(x.width, x.height);
743
+ [e]
744
+ ), W(() => {
745
+ e.setControlledTask(v);
746
+ }, [e, v]), W(() => {
747
+ e.setPlacing(C ?? null);
748
+ }, [e, C]), W(() => {
749
+ const u = Xt.current, y = qt.current, I = jt.current, E = Jt.current;
750
+ if (!u || !y || !I || !E) return;
751
+ e.bind(u, y, I, E);
752
+ const L = y.getBoundingClientRect();
753
+ e.resize(L.width, L.height);
754
+ const _ = new ResizeObserver((O) => {
755
+ const U = O[O.length - 1]?.contentRect;
756
+ U !== void 0 && e.resize(U.width, U.height);
737
757
  });
738
- F.observe(w);
739
- const $ = (O) => n.wheel(O);
740
- u.addEventListener("wheel", $, { passive: !1 });
741
- const K = (O) => {
742
- O.key === "Escape" && n.cancelEdit() && O.preventDefault();
758
+ _.observe(y);
759
+ const H = (O) => e.wheel(O);
760
+ u.addEventListener("wheel", H, { passive: !1 });
761
+ const N = (O) => {
762
+ O.key === "Escape" && e.cancelEdit() && O.preventDefault();
743
763
  };
744
- return window.addEventListener("keydown", K), () => {
745
- window.removeEventListener("keydown", K), u.removeEventListener("wheel", $), F.disconnect(), n.unbind();
764
+ return window.addEventListener("keydown", N), () => {
765
+ window.removeEventListener("keydown", N), u.removeEventListener("wheel", H), _.disconnect(), e.unbind();
746
766
  };
747
- }, [n]);
748
- const b = Pe(n.subscribe, n.getSnapshot, n.getServerSnapshot), sn = (u, w) => {
749
- const L = new Date(u);
750
- return w >= 200 ? z.dateLong(L) : w >= 84 ? z.date(L) : w >= Ft ? z.dateShort(L) : "";
751
- }, on = b.days.reduce((u, w) => Math.max(u, w.width), 0), Z = zn(on, Ft), re = b.step >= X ? Z : 1, M = b.ghost, Q = b.spoken, Mt = b.summary, ae = (u) => `${z.dateShort(new Date(u))} ${z.time(new Date(u), !1)}`, Tt = (u) => `${bt}-row-${encodeURIComponent(u.key)}`, rn = V(() => {
767
+ }, [e]);
768
+ const w = Oe(e.subscribe, e.getSnapshot, e.getServerSnapshot), Ze = (u, y) => {
769
+ const I = new Date(u);
770
+ return y >= 200 ? G.dateLong(I) : y >= 84 ? G.date(I) : y >= At ? G.dateShort(I) : "";
771
+ }, Qe = w.days.reduce((u, y) => Math.max(u, y.width), 0), J = Bs(Qe, At), ie = w.step >= z ? J : 1, b = w.ghost, Z = w.spoken, vt = w.summary, oe = (u) => `${G.dateShort(new Date(u))} ${G.time(new Date(u), !1)}`, yt = (u) => `${j}-row-${encodeURIComponent(u.key)}`, ts = K(() => {
752
772
  const u = /* @__PURE__ */ new Map();
753
- for (const w of b.headers)
754
- for (const L of w.within)
755
- w.kind === "groupHead" && L === w.group || u.set(L, [...u.get(L) ?? [], Tt(w)]);
773
+ for (const y of w.headers)
774
+ for (const I of y.within)
775
+ y.kind === "groupHead" && I === y.group || u.set(I, [...u.get(I) ?? [], yt(y)]);
756
776
  return u;
757
- }, [b.headers, bt]), le = G(null);
758
- rt(() => {
759
- var F;
760
- const u = le.current;
777
+ }, [w.headers, j]), re = Y(null);
778
+ ht(() => {
779
+ const u = re.current;
761
780
  if (u === null) return;
762
- let w = !0;
763
- const L = () => {
764
- if (!w) return;
765
- const $ = [...u.querySelectorAll("[data-lane-count]")];
766
- for (const O of $) O.hidden = !1;
767
- const K = $.some((O) => {
768
- const x = O.previousElementSibling;
769
- if (!(x instanceof HTMLElement)) return !1;
770
- const ft = parseFloat(getComputedStyle(x).lineHeight);
771
- return x.scrollWidth > x.clientWidth || x.clientHeight > ft * 1.5;
781
+ let y = !0;
782
+ const I = () => {
783
+ if (!y) return;
784
+ const _ = [...u.querySelectorAll("[data-lane-count]")];
785
+ for (const N of _) N.hidden = !1;
786
+ const H = _.some((N) => {
787
+ const O = N.previousElementSibling;
788
+ if (!(O instanceof HTMLElement)) return !1;
789
+ const U = parseFloat(getComputedStyle(O).lineHeight);
790
+ return O.scrollWidth > O.clientWidth || O.clientHeight > U * 1.5;
772
791
  });
773
- for (const O of $) O.hidden = K;
792
+ for (const N of _) N.hidden = H;
774
793
  };
775
- L(), (F = document.fonts) == null || F.ready.then(L);
776
- const N = new ResizeObserver(L);
777
- N.observe(u);
778
- const D = new MutationObserver(L);
779
- return D.observe(u, { childList: !0, characterData: !0, subtree: !0 }), () => {
780
- w = !1, N.disconnect(), D.disconnect();
794
+ I(), document.fonts?.ready.then(I);
795
+ const E = new ResizeObserver(I);
796
+ E.observe(u);
797
+ const L = new MutationObserver(I);
798
+ return L.observe(u, { childList: !0, characterData: !0, subtree: !0 }), () => {
799
+ y = !1, E.disconnect(), L.disconnect();
781
800
  };
782
801
  }, []);
783
- const an = V(() => new Set((M == null ? void 0 : M.refusedLanes) ?? []), [M == null ? void 0 : M.refusedLanes]), de = G(null), [It, ln] = et({ x: 0, y: 0, at: "" }), St = M === null ? "" : `${M.x}:${M.y}:${M.from}:${M.to}:${M.overlap}:${M.violated}:${M.refused}:${M.blocked}`;
784
- rt(() => {
785
- const u = de.current;
786
- if (M === null || u === null) return;
787
- const w = 4, L = M.y - u.offsetHeight - w, N = M.y + M.height + w, D = {
788
- x: Math.max(2, Math.min(M.x, b.width - u.offsetWidth - 2)),
789
- y: L >= 2 ? L : Math.min(N, b.height - u.offsetHeight - 2),
790
- at: St
802
+ const es = K(() => new Set(b?.refusedLanes ?? []), [b?.refusedLanes]), ae = Y(null), [wt, ss] = nt({ x: 0, y: 0, at: "" }), bt = b === null ? "" : `${b.x}:${b.y}:${b.from}:${b.to}:${b.overlap}:${b.violated}:${b.refused}:${b.blocked}`;
803
+ ht(() => {
804
+ const u = ae.current;
805
+ if (b === null || u === null) return;
806
+ const y = 4, I = b.y - u.offsetHeight - y, E = b.y + b.height + y, L = {
807
+ x: Math.max(2, Math.min(b.x, w.width - u.offsetWidth - 2)),
808
+ y: I >= 2 ? I : Math.min(E, w.height - u.offsetHeight - 2),
809
+ at: bt
791
810
  };
792
- ln((F) => F.x === D.x && F.y === D.y && F.at === D.at ? F : D);
793
- }, [M, St, b.width, b.height]);
794
- const he = G(null), [Lt, dn] = et({ x: 0, y: 0, at: "" }), W = b.tooltip, At = W === null ? "" : `${W.x}:${W.y}:${W.target.kind}`;
795
- return rt(() => {
796
- const u = he.current;
797
- if (W === null || u === null) return;
798
- const w = 12, L = (D, F, $) => {
799
- const K = D + w, O = D - w - F, x = K + F <= $ - 4 || O < 4 ? K : O;
800
- return Math.max(4, Math.min(x, $ - F - 4));
801
- }, N = {
802
- x: L(W.x, u.offsetWidth, b.width),
803
- y: L(W.y, u.offsetHeight, b.height),
804
- at: At
811
+ ss((_) => _.x === L.x && _.y === L.y && _.at === L.at ? _ : L);
812
+ }, [b, bt, w.width, w.height]);
813
+ const le = Y(null), [Mt, ns] = nt({ x: 0, y: 0, at: "" }), V = w.tooltip, Tt = V === null ? "" : `${V.x}:${V.y}:${V.target.kind}`;
814
+ return ht(() => {
815
+ const u = le.current;
816
+ if (V === null || u === null) return;
817
+ const y = 12, I = (L, _, H) => {
818
+ const N = L + y, O = L - y - _, U = N + _ <= H - 4 || O < 4 ? N : O;
819
+ return Math.max(4, Math.min(U, H - _ - 4));
820
+ }, E = {
821
+ x: I(V.x, u.offsetWidth, w.width),
822
+ y: I(V.y, u.offsetHeight, w.height),
823
+ at: Tt
805
824
  };
806
- dn((D) => D.x === N.x && D.y === N.y && D.at === N.at ? D : N);
807
- }, [W, At, b.width, b.height]), /* @__PURE__ */ H(Be.Provider, { value: n, children: [
808
- /* @__PURE__ */ H(
825
+ ns((L) => L.x === E.x && L.y === E.y && L.at === E.at ? L : E);
826
+ }, [V, Tt, w.width, w.height]), /* @__PURE__ */ x(Pe, { value: e, children: [
827
+ /* @__PURE__ */ x(
809
828
  "div",
810
829
  {
811
- ref: jt,
830
+ ref: Xt,
812
831
  role: "figure",
813
- "aria-label": o,
814
- className: it ? `${v.root} ${it}` : v.root,
815
- style: { height: `${i}px`, gridTemplateColumns: `min(${a}px, 40%) minmax(0, 1fr)`, ...wt },
832
+ "aria-label": n,
833
+ className: $ ? `${k.root} ${$}` : k.root,
834
+ style: { height: `${i}px`, gridTemplateColumns: `min(${r}px, 40%) minmax(0, 1fr)`, ...dt },
816
835
  children: [
817
- /* @__PURE__ */ g("div", { className: v.corner }),
818
- /* @__PURE__ */ g("div", { className: v.dayBand, "aria-hidden": "true", "data-schedule-days": "", "data-schedule-clip": "day band", children: b.days.map((u, w) => {
819
- var $;
820
- const L = Z === 1 || w === 0 || _t(u.start, Z), N = Z === 1 ? u.x + u.width : (($ = b.days.slice(w + 1).find((K) => _t(K.start, Z))) == null ? void 0 : $.x) ?? b.width, D = Math.max(0, -u.x), F = Math.min(N, b.width) - Math.max(u.x, 0);
821
- return /* @__PURE__ */ g("span", { className: v.day, style: { left: `${u.x}px`, width: `${L ? N - u.x : u.width}px` }, children: /* @__PURE__ */ g("span", { className: v.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${D}px` }, children: L ? sn(u.start, Z === 1 ? F : Math.min(F, Ft)) : "" }) }, u.start);
836
+ /* @__PURE__ */ m("div", { className: k.corner }),
837
+ /* @__PURE__ */ m("div", { className: k.dayBand, "aria-hidden": "true", "data-schedule-days": "", "data-schedule-clip": "day band", children: w.days.map((u, y) => {
838
+ const I = J === 1 || y === 0 || Lt(u.start, J), E = J === 1 ? u.x + u.width : w.days.slice(y + 1).find((H) => Lt(H.start, J))?.x ?? w.width, L = Math.max(0, -u.x), _ = Math.min(E, w.width) - Math.max(u.x, 0);
839
+ return /* @__PURE__ */ m("span", { className: k.day, style: { left: `${u.x}px`, width: `${I ? E - u.x : u.width}px` }, children: /* @__PURE__ */ m("span", { className: k.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${L}px` }, children: I ? Ze(u.start, J === 1 ? _ : Math.min(_, At)) : "" }) }, u.start);
822
840
  }) }),
823
- /* @__PURE__ */ g("div", { ref: le, className: v.headers, "data-schedule-headers": "", children: /* @__PURE__ */ g("div", { className: v.headerRun, style: { transform: `translateY(${-b.scrollY}px)` }, children: b.headers.map((u) => /* @__PURE__ */ H(
841
+ /* @__PURE__ */ m("div", { ref: re, className: k.headers, "data-schedule-headers": "", children: /* @__PURE__ */ m("div", { className: k.headerRun, style: { transform: `translateY(${-w.scrollY}px)` }, children: w.headers.map((u) => /* @__PURE__ */ x(
824
842
  "div",
825
843
  {
826
- id: Tt(u),
827
- className: v.header,
844
+ id: yt(u),
845
+ className: k.header,
828
846
  style: { height: `${u.height}px`, paddingLeft: `calc(var(--u-space-3) + ${u.depth} * var(--u-space-3))` },
829
847
  "data-lane": u.lane,
830
848
  "data-group": u.group,
831
849
  "data-row": u.kind,
832
850
  "data-schedule-clip": `header ${u.kind}`,
833
- "data-refused": u.lane !== void 0 && an.has(u.lane) ? "" : void 0,
851
+ "data-refused": u.lane !== void 0 && es.has(u.lane) ? "" : void 0,
834
852
  children: [
835
- u.kind !== "lane" && u.group !== void 0 && /* @__PURE__ */ g(
853
+ u.kind !== "lane" && u.group !== void 0 && /* @__PURE__ */ m(
836
854
  "button",
837
855
  {
838
856
  type: "button",
839
- className: v.chevron,
857
+ className: k.chevron,
840
858
  "data-schedule-overlay": "fold control",
841
859
  "aria-expanded": u.collapsed === !1,
842
- "aria-controls": (rn.get(u.group) ?? [Tt(u)]).join(" "),
860
+ "aria-controls": (ts.get(u.group) ?? [yt(u)]).join(" "),
843
861
  "aria-label": `${u.collapsed === !0 ? B.scheduleUnfoldGroup : B.scheduleFoldGroup}: ${typeof u.label == "string" ? u.label : u.group}`,
844
- onClick: () => n.toggleGroup(u.group),
845
- children: /* @__PURE__ */ g(Mn, { size: 9, "data-open": u.collapsed === !1 ? "" : void 0 })
862
+ onClick: () => e.toggleGroup(u.group),
863
+ children: /* @__PURE__ */ m(fs, { size: 9, "data-open": u.collapsed === !1 ? "" : void 0 })
846
864
  }
847
865
  ),
848
- /* @__PURE__ */ g("span", { className: v.headerLabel, "data-schedule-overlay": "header label", children: u.label }),
849
- u.kind !== "lane" && /* @__PURE__ */ g("span", { className: v.headerCount, "data-schedule-overlay": "lane count", "data-lane-count": u.lanes, children: B.scheduleLaneCount(u.lanes) })
866
+ /* @__PURE__ */ m("span", { className: k.headerLabel, "data-schedule-overlay": "header label", children: u.label }),
867
+ u.kind !== "lane" && /* @__PURE__ */ m("span", { className: k.headerCount, "data-schedule-overlay": "lane count", "data-lane-count": u.lanes, children: B.scheduleLaneCount(u.lanes) })
850
868
  ]
851
869
  },
852
870
  u.key
853
871
  )) }) }),
854
- /* @__PURE__ */ H(
872
+ /* @__PURE__ */ x(
855
873
  "div",
856
874
  {
857
- ref: Jt,
858
- className: v.plot,
875
+ ref: qt,
876
+ className: k.plot,
859
877
  "data-schedule-plot": "",
860
878
  "data-schedule-clip": "plot",
861
- style: { cursor: b.cursor },
879
+ style: { cursor: w.cursor },
862
880
  tabIndex: 0,
863
881
  role: "application",
864
882
  "aria-roledescription": B.scheduleRoleDescription,
865
- "aria-label": o,
866
- "aria-describedby": qt,
883
+ "aria-label": n,
884
+ "aria-describedby": Ut,
867
885
  onKeyDown: (u) => {
868
- n.key(u.nativeEvent) && u.preventDefault();
886
+ e.key(u.nativeEvent) && u.preventDefault();
869
887
  },
870
- onFocus: (u) => n.focus(Is(u.currentTarget)),
871
- onBlur: () => n.blur(),
872
- onPointerDown: (u) => n.pointerDown(u.nativeEvent),
873
- onPointerMove: (u) => n.pointerMove(u.nativeEvent),
874
- onPointerUp: (u) => n.pointerUp(u.nativeEvent),
875
- onPointerCancel: (u) => n.pointerCancel(u.nativeEvent),
876
- onPointerLeave: () => n.pointerLeave(),
877
- onContextMenu: (u) => n.contextMenu(u.nativeEvent),
878
- onDragOver: (u) => n.dragOver(u.nativeEvent),
879
- onDrop: (u) => n.drop(u.nativeEvent),
888
+ onFocus: (u) => e.focus(kn(u.currentTarget)),
889
+ onBlur: () => e.blur(),
890
+ onPointerDown: (u) => e.pointerDown(u.nativeEvent),
891
+ onPointerMove: (u) => e.pointerMove(u.nativeEvent),
892
+ onPointerUp: (u) => e.pointerUp(u.nativeEvent),
893
+ onPointerCancel: (u) => e.pointerCancel(u.nativeEvent),
894
+ onPointerLeave: () => e.pointerLeave(),
895
+ onContextMenu: (u) => e.contextMenu(u.nativeEvent),
896
+ onDragOver: (u) => e.dragOver(u.nativeEvent),
897
+ onDrop: (u) => e.drop(u.nativeEvent),
880
898
  onDragLeave: (u) => {
881
- const w = u.nativeEvent.relatedTarget;
882
- (!(w instanceof Node) || !u.currentTarget.contains(w)) && n.dragLeave();
899
+ const y = u.nativeEvent.relatedTarget;
900
+ (!(y instanceof Node) || !u.currentTarget.contains(y)) && e.dragLeave();
883
901
  },
884
902
  children: [
885
- /* @__PURE__ */ g("canvas", { ref: Zt, className: v.layer, "aria-hidden": "true" }),
886
- /* @__PURE__ */ g("canvas", { ref: Qt, className: v.layer, "aria-hidden": "true" }),
887
- b.grips.map((u) => /* @__PURE__ */ g(
903
+ /* @__PURE__ */ m("canvas", { ref: jt, className: k.layer, "aria-hidden": "true" }),
904
+ /* @__PURE__ */ m("canvas", { ref: Jt, className: k.layer, "aria-hidden": "true" }),
905
+ w.grips.map((u) => /* @__PURE__ */ m(
888
906
  "span",
889
907
  {
890
908
  "data-grip": u.kind,
891
909
  "data-schedule-overlay": `${u.kind} grip`,
892
910
  "aria-hidden": "true",
893
- className: v.grip,
911
+ className: k.grip,
894
912
  style: { left: `${u.x}px`, top: `${u.y}px`, height: `${u.height}px` }
895
913
  },
896
914
  u.kind
897
915
  )),
898
- E !== void 0 && b.bars.map((u) => /* @__PURE__ */ g(
916
+ T !== void 0 && w.bars.map((u) => /* @__PURE__ */ m(
899
917
  "span",
900
918
  {
901
- className: v.barLabel,
919
+ className: k.barLabel,
902
920
  "data-bar-label": u.subtask.id,
903
921
  "data-schedule-overlay": "bar label",
904
922
  "data-schedule-may-cover": "",
905
923
  "data-on": u.dark ? "dark" : "light",
906
924
  style: { left: `${u.x}px`, top: `${u.y}px`, width: `${u.width}px`, height: `${u.height}px` },
907
- children: /* @__PURE__ */ g("span", { className: v.barLabelText, children: E(u.subtask) })
925
+ children: /* @__PURE__ */ m("span", { className: k.barLabelText, children: T(u.subtask) })
908
926
  },
909
927
  u.subtask.id
910
928
  )),
911
- _ !== !1 && b.tooltip !== null && /* @__PURE__ */ g(
929
+ F !== !1 && w.tooltip !== null && /* @__PURE__ */ m(
912
930
  "span",
913
931
  {
914
- ref: he,
932
+ ref: le,
915
933
  role: "tooltip",
916
- className: v.tooltip,
934
+ className: k.tooltip,
917
935
  "data-schedule-tooltip": "",
918
936
  "data-schedule-overlay": "tooltip",
919
937
  style: {
920
- left: `${Lt.x}px`,
921
- top: `${Lt.y}px`,
922
- visibility: Lt.at === At ? void 0 : "hidden"
938
+ left: `${Mt.x}px`,
939
+ top: `${Mt.y}px`,
940
+ visibility: Mt.at === Tt ? void 0 : "hidden"
923
941
  },
924
- children: typeof _ == "function" ? _(b.tooltip.target) : /* @__PURE__ */ g(ws, { target: b.tooltip.target })
942
+ children: typeof F == "function" ? F(w.tooltip.target) : /* @__PURE__ */ m(fn, { target: w.tooltip.target })
925
943
  }
926
944
  ),
927
- M !== null && /* @__PURE__ */ H(
945
+ b !== null && /* @__PURE__ */ x(
928
946
  "span",
929
947
  {
930
- ref: de,
931
- className: v.ghostLabel,
948
+ ref: ae,
949
+ className: k.ghostLabel,
932
950
  "data-ghost": "",
933
951
  "data-schedule-overlay": "ghost label",
934
- "data-findings": [M.overlap ? "overlap" : "", M.violated ? "violated-dependency" : ""].filter(Boolean).join(" "),
935
- "data-refused": M.refused ? "" : void 0,
936
- "data-blocked": M.blocked ? "" : void 0,
952
+ "data-findings": [b.overlap ? "overlap" : "", b.violated ? "violated-dependency" : ""].filter(Boolean).join(" "),
953
+ "data-refused": b.refused ? "" : void 0,
954
+ "data-blocked": b.blocked ? "" : void 0,
937
955
  style: {
938
- left: `${It.x}px`,
939
- top: `${It.y}px`,
940
- visibility: It.at === St ? void 0 : "hidden"
956
+ left: `${wt.x}px`,
957
+ top: `${wt.y}px`,
958
+ visibility: wt.at === bt ? void 0 : "hidden"
941
959
  },
942
960
  children: [
943
- B.scheduleGhostTimes(z.time(new Date(M.from), !1), z.time(new Date(M.to), !1)),
944
- M.refused && /* @__PURE__ */ g("span", { className: v.refusal, children: B.scheduleLaneRefused }),
945
- M.blocked && /* @__PURE__ */ g("span", { className: v.refusal, children: B.scheduleBlockedTime }),
946
- M.overlap && /* @__PURE__ */ g("span", { className: v.finding, children: B.scheduleOverlap }),
947
- M.violated && /* @__PURE__ */ g("span", { className: v.finding, children: B.scheduleViolatedDependency })
961
+ B.scheduleGhostTimes(G.time(new Date(b.from), !1), G.time(new Date(b.to), !1)),
962
+ b.refused && /* @__PURE__ */ m("span", { className: k.refusal, children: B.scheduleLaneRefused }),
963
+ b.blocked && /* @__PURE__ */ m("span", { className: k.refusal, children: B.scheduleBlockedTime }),
964
+ b.overlap && /* @__PURE__ */ m("span", { className: k.finding, children: B.scheduleOverlap }),
965
+ b.violated && /* @__PURE__ */ m("span", { className: k.finding, children: B.scheduleViolatedDependency })
948
966
  ]
949
967
  }
950
968
  ),
951
- /* @__PURE__ */ g("span", { className: v.focusRing, "aria-hidden": "true" })
969
+ /* @__PURE__ */ m("span", { className: k.focusRing, "aria-hidden": "true" })
952
970
  ]
953
971
  }
954
972
  ),
955
- /* @__PURE__ */ g("div", { className: v.corner }),
956
- /* @__PURE__ */ H("div", { className: v.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
957
- b.now !== null && /* @__PURE__ */ g("span", { className: v.now, "data-now": "", "data-schedule-overlay": "now mark", style: { left: `${b.now}px` } }),
958
- b.ticks.map((u) => /* @__PURE__ */ g("span", { className: v.tick, style: { left: `${u.x}px` }, children: u.x >= we && u.x <= b.width - we && (re === 1 || _t(u.wallClock, re)) && /* @__PURE__ */ g("span", { className: v.tickLabel, "data-schedule-overlay": "time label", children: b.step >= X ? z.dateShort(new Date(u.wallClock)) : z.time(new Date(u.wallClock), !1) }) }, u.wallClock))
973
+ /* @__PURE__ */ m("div", { className: k.corner }),
974
+ /* @__PURE__ */ x("div", { className: k.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
975
+ w.now !== null && /* @__PURE__ */ m("span", { className: k.now, "data-now": "", "data-schedule-overlay": "now mark", style: { left: `${w.now}px` } }),
976
+ w.ticks.map((u) => /* @__PURE__ */ m("span", { className: k.tick, style: { left: `${u.x}px` }, children: u.x >= ke && u.x <= w.width - ke && (ie === 1 || Lt(u.wallClock, ie)) && /* @__PURE__ */ m("span", { className: k.tickLabel, "data-schedule-overlay": "time label", children: w.step >= z ? G.dateShort(new Date(u.wallClock)) : G.time(new Date(u.wallClock), !1) }) }, u.wallClock))
959
977
  ] }),
960
- /* @__PURE__ */ g(ue, { "aria-live": "polite", children: Q !== null && /* @__PURE__ */ g(
961
- vs,
978
+ /* @__PURE__ */ m(de, { "aria-live": "polite", children: Z !== null && /* @__PURE__ */ m(
979
+ cn,
962
980
  {
963
- target: Q.target,
964
- lane: Q.lane === null ? null : ((ce = n.data.lanes.find((u) => u.id === Q.lane)) == null ? void 0 : ce.label) ?? Q.lane
981
+ target: Z.target,
982
+ lane: Z.lane === null ? null : e.data.lanes.find((u) => u.id === Z.lane)?.label ?? Z.lane
965
983
  },
966
- Q.count
984
+ Z.count
967
985
  ) }),
968
- /* @__PURE__ */ g(ue, { id: qt, children: `${B.scheduleSummary({ ...Mt, from: ae(Mt.from), to: ae(Mt.to) })} ${B.scheduleKeyHelp}` })
986
+ /* @__PURE__ */ m(de, { id: Ut, children: `${B.scheduleSummary({ ...vt, from: oe(vt.from), to: oe(vt.to) })} ${B.scheduleKeyHelp}` })
969
987
  ]
970
988
  }
971
989
  ),
972
- ut
990
+ kt
973
991
  ] });
974
- });
975
- function Is(s) {
992
+ }
993
+ function kn(s) {
976
994
  try {
977
995
  return s.matches(":focus-visible");
978
996
  } catch {
979
997
  return !0;
980
998
  }
981
999
  }
982
- function Ss({ id: s, label: t }) {
983
- const e = He(), n = V(() => ({ id: s, label: t ?? s, ...e === null ? {} : { parent: e } }), [s, t, e]);
984
- return Ln(n), null;
1000
+ function vn({ id: s, label: t }) {
1001
+ const e = Ne(), n = K(() => ({ id: s, label: t ?? s, ...e === null ? {} : { parent: e } }), [s, t, e]);
1002
+ return ks(n), null;
985
1003
  }
986
- function Ls({ id: s, label: t, children: e }) {
987
- const n = He(), o = V(() => ({ id: s, label: t ?? s, ...n === null ? {} : { parent: n } }), [s, t, n]);
988
- return An(o), /* @__PURE__ */ g(xe.Provider, { value: s, children: e });
1004
+ function yn({ id: s, label: t, children: e }) {
1005
+ const n = Ne(), i = K(() => ({ id: s, label: t ?? s, ...n === null ? {} : { parent: n } }), [s, t, n]);
1006
+ return vs(i), /* @__PURE__ */ m(Be, { value: s, children: e });
989
1007
  }
990
- function As({ data: s, tasks: t }) {
991
- const e = V(() => ({ kind: "subtasks", data: s, tasks: t }), [s, t]);
992
- return vt("Subtasks", e), null;
1008
+ function wn({ data: s, tasks: t }) {
1009
+ const e = K(() => ({ kind: "subtasks", data: s, tasks: t }), [s, t]);
1010
+ return gt("Subtasks", e), null;
993
1011
  }
994
- function Cs({ data: s }) {
995
- const t = V(() => ({ kind: "dependencies", data: s }), [s]);
996
- return vt("Dependencies", t), null;
1012
+ function bn({ data: s }) {
1013
+ const t = K(() => ({ kind: "dependencies", data: s }), [s]);
1014
+ return gt("Dependencies", t), null;
997
1015
  }
998
- function Ds({ data: s }) {
999
- const t = V(() => ({ kind: "blocked", data: s }), [s]);
1000
- return vt("BlockedTimes", t), null;
1016
+ function Mn({ data: s }) {
1017
+ const t = K(() => ({ kind: "blocked", data: s }), [s]);
1018
+ return gt("BlockedTimes", t), null;
1001
1019
  }
1002
- function _s({ data: s }) {
1003
- const t = V(() => ({ kind: "milestones", data: s }), [s]);
1004
- return vt("Milestones", t), null;
1020
+ function Tn({ data: s }) {
1021
+ const t = K(() => ({ kind: "milestones", data: s }), [s]);
1022
+ return gt("Milestones", t), null;
1005
1023
  }
1006
- class Fs {
1024
+ class In {
1007
1025
  /** `changed` is called after every registration change. */
1008
1026
  constructor(t) {
1009
- f(this, "nextId", 1);
1010
- f(this, "laneEntries", /* @__PURE__ */ new Map());
1011
- f(this, "groupEntries", /* @__PURE__ */ new Map());
1012
- f(this, "layerEntries", /* @__PURE__ */ new Map());
1013
- f(this, "dirty", !0);
1014
- f(this, "lanes", []);
1015
- /** The groups in registration order. */
1016
- f(this, "groups", []);
1017
- f(this, "laneIndex", /* @__PURE__ */ new Map());
1018
- /** The layers in registration order - the drawing order. */
1019
- f(this, "layers", []);
1020
- f(this, "subtasks", []);
1021
- f(this, "subtaskById", /* @__PURE__ */ new Map());
1022
- f(this, "dependencies", []);
1023
- /** Every blocked time, whichever layer declared it. */
1024
- f(this, "blocked", []);
1025
- /** Every milestone, whichever layer declared it. */
1026
- f(this, "milestones", []);
1027
- f(this, "tasks", /* @__PURE__ */ new Map());
1028
- f(this, "overlaps", []);
1029
- f(this, "violatedById", /* @__PURE__ */ new Map());
1030
- f(this, "depth", /* @__PURE__ */ new Map());
1031
- f(this, "inBlocked", []);
1032
1027
  this.changed = t;
1033
1028
  }
1029
+ nextId = 1;
1030
+ laneEntries = /* @__PURE__ */ new Map();
1031
+ groupEntries = /* @__PURE__ */ new Map();
1032
+ layerEntries = /* @__PURE__ */ new Map();
1033
+ dirty = !0;
1034
+ lanes = [];
1035
+ /** The groups in registration order. */
1036
+ groups = [];
1037
+ /** The layers in registration order - the drawing order. */
1038
+ layers = [];
1039
+ subtasks = [];
1040
+ subtaskById = /* @__PURE__ */ new Map();
1041
+ dependencies = [];
1042
+ /** Every blocked time, whichever layer declared it. */
1043
+ blocked = [];
1044
+ /** Every milestone, whichever layer declared it. */
1045
+ milestones = [];
1046
+ tasks = /* @__PURE__ */ new Map();
1047
+ overlaps = [];
1048
+ violatedById = /* @__PURE__ */ new Map();
1049
+ depth = /* @__PURE__ */ new Map();
1050
+ inBlocked = [];
1034
1051
  registerLane(t) {
1035
1052
  const e = this.nextId++;
1036
1053
  return this.laneEntries.set(e, t), this.touch(), e;
@@ -1069,26 +1086,25 @@ class Fs {
1069
1086
  rebuild() {
1070
1087
  if (!this.dirty) return !1;
1071
1088
  this.dirty = !1;
1072
- const t = (e) => [...e.keys()].sort((n, o) => n - o).map((n) => e.get(n));
1073
- this.lanes = t(this.laneEntries), this.groups = t(this.groupEntries), this.laneIndex = new Map(this.lanes.map((e, n) => [e.id, n])), this.layers = t(this.layerEntries), this.subtasks = [], this.dependencies = [], this.blocked = [], this.milestones = [], this.tasks = /* @__PURE__ */ new Map();
1089
+ const t = (e) => [...e.keys()].sort((n, i) => n - i).map((n) => e.get(n));
1090
+ this.lanes = t(this.laneEntries), this.groups = t(this.groupEntries), this.layers = t(this.layerEntries), this.subtasks = [], this.dependencies = [], this.blocked = [], this.milestones = [], this.tasks = /* @__PURE__ */ new Map();
1074
1091
  for (const e of this.layers)
1075
1092
  if (e.kind === "subtasks") {
1076
1093
  this.subtasks.push(...e.data);
1077
1094
  for (const n of e.tasks) this.tasks.set(n.id, n);
1078
1095
  } else e.kind === "dependencies" ? this.dependencies.push(...e.data) : e.kind === "milestones" ? this.milestones.push(...e.data) : this.blocked.push(...e.data);
1079
- return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = zt(this.subtasks), this.violatedById = new Map(Kt(this.subtasks, this.dependencies).map((e) => [e.dependency, e])), this.depth = Tn(this.subtasks), this.inBlocked = $e(this.subtasks, this.blocked), !0;
1096
+ return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = Ht(this.subtasks), this.violatedById = new Map(Yt(this.subtasks, this.dependencies).map((e) => [e.dependency, e])), this.depth = ms(this.subtasks), this.inBlocked = Ee(this.subtasks, this.blocked), !0;
1080
1097
  }
1081
1098
  /** The task a dependency belongs to: its departing subtask's. */
1082
1099
  taskOfDependency(t) {
1083
- var e;
1084
- return ((e = this.subtaskById.get(t.from)) == null ? void 0 : e.task) ?? null;
1100
+ return this.subtaskById.get(t.from)?.task ?? null;
1085
1101
  }
1086
1102
  /** What a tooltip is about: the hovered subtask or dependency with what this
1087
1103
  data knows about it - its task, and the findings it stands in. */
1088
1104
  tooltipTargetFor(t) {
1089
1105
  if (t.kind === "subtask") {
1090
- const o = t.subtask.id, i = this.overlaps.filter((l) => l.first === o || l.second === o).map((l) => this.subtaskById.get(l.first === o ? l.second : l.first)).filter((l) => l !== void 0), r = this.dependencies.filter((l) => l.from === o || l.to === o).map((l) => this.violatedById.get(l.id)).filter((l) => l !== void 0), a = this.inBlocked.filter((l) => l.subtask === o).map((l) => this.blocked.find((h) => h.id === l.blocked)).filter((l) => l !== void 0);
1091
- return { kind: "subtask", subtask: t.subtask, task: this.tasks.get(t.subtask.task), overlapping: i, violatedDependencies: r, blocked: a };
1106
+ const i = t.subtask.id, o = this.overlaps.filter((l) => l.first === i || l.second === i).map((l) => this.subtaskById.get(l.first === i ? l.second : l.first)).filter((l) => l !== void 0), r = this.dependencies.filter((l) => l.from === i || l.to === i).map((l) => this.violatedById.get(l.id)).filter((l) => l !== void 0), a = this.inBlocked.filter((l) => l.subtask === i).map((l) => this.blocked.find((d) => d.id === l.blocked)).filter((l) => l !== void 0);
1107
+ return { kind: "subtask", subtask: t.subtask, task: this.tasks.get(t.subtask.task), overlapping: o, violatedDependencies: r, blocked: a };
1092
1108
  }
1093
1109
  if (t.kind === "milestone") return { kind: "milestone", milestone: t.milestone };
1094
1110
  if (t.kind !== "dependency") return null;
@@ -1103,7 +1119,60 @@ class Fs {
1103
1119
  };
1104
1120
  }
1105
1121
  }
1106
- const Os = {
1122
+ const Sn = 6;
1123
+ function Ke(s, t, e, n, i, o) {
1124
+ s.save(), s.beginPath(), s.rect(t, e, n, i), s.clip(), s.globalAlpha = 0.35, s.strokeStyle = o, s.lineWidth = 1, s.beginPath();
1125
+ for (let r = t - i; r < t + n + i; r += Sn)
1126
+ s.moveTo(r, e + i), s.lineTo(r + i, e);
1127
+ s.stroke(), s.restore();
1128
+ }
1129
+ function Ln(s, t, e, n) {
1130
+ if (n.size === 0) return;
1131
+ const { width: i, height: o } = t.view;
1132
+ for (const r of n) {
1133
+ const a = q(e, r);
1134
+ if (a === null) continue;
1135
+ const { top: l, height: d } = a;
1136
+ l + d < 0 || l > o || (s.globalAlpha = 0.6, s.fillStyle = t.colours.surface, s.fillRect(0, l, i, d), s.globalAlpha = 1, Ke(s, 0, l, i, d, t.colours.muted));
1137
+ }
1138
+ }
1139
+ function An(s, t, e) {
1140
+ const { data: n } = t;
1141
+ if (n.violatedById.size !== 0)
1142
+ for (const i of n.violatedById.values()) {
1143
+ const o = n.dependencies.find((c) => c.id === i.dependency), r = o === void 0 ? void 0 : n.subtaskById.get(o.to);
1144
+ if (r === void 0) continue;
1145
+ const a = q(e, r.lane);
1146
+ if (a === null || !a.miniature) continue;
1147
+ const l = tt(e.rows, a.top + e.scrollY);
1148
+ if (l === null) continue;
1149
+ const d = P(e, i.arrival), h = Math.max(d + 2, P(e, i.arrival + i.shortBy));
1150
+ Ot(s, t, d, h, l.top - e.scrollY + 1, 3);
1151
+ }
1152
+ }
1153
+ function Ot(s, t, e, n, i, o) {
1154
+ if (!t.colours.forced) {
1155
+ s.fillStyle = t.colours.alarm, s.fillRect(e, i, n - e, o);
1156
+ return;
1157
+ }
1158
+ s.strokeStyle = t.colours.alarm, s.lineWidth = o, s.setLineDash([4, 3]), s.beginPath(), s.moveTo(e, i + o / 2), s.lineTo(n, i + o / 2), s.stroke(), s.setLineDash([]);
1159
+ }
1160
+ function Cn(s, t, e, n) {
1161
+ const i = q(e, n.lane);
1162
+ if (i === null || i.top + i.height < 0 || i.top > t.view.height) return;
1163
+ const o = Math.max(0, P(e, n.from)), r = Math.min(t.view.width, P(e, n.to));
1164
+ r <= o || (s.globalAlpha = 0.1, s.fillStyle = t.colours.muted, s.fillRect(o, i.top, r - o, i.height), s.globalAlpha = 1, Ke(s, o, i.top, r - o, i.height, t.colours.muted));
1165
+ }
1166
+ function Et(s, t, e, n) {
1167
+ const i = q(e, n.lane);
1168
+ if (i === null) return;
1169
+ const o = P(e, n.from), r = Math.max(o + 2, P(e, n.to));
1170
+ if (s.fillStyle = t.colours.alarm, s.globalAlpha = 0.14, s.fillRect(o, i.top + 1, r - o, Math.max(1, i.height - 2)), s.globalAlpha = 1, Ot(s, t, o, r, i.top + 1, Math.min(3, Math.max(1, i.height - 1))), i.miniature) {
1171
+ const a = tt(e.rows, i.top + e.scrollY);
1172
+ a !== null && Ot(s, t, o, r, a.top - e.scrollY + 1, 3);
1173
+ }
1174
+ }
1175
+ const Dn = {
1107
1176
  line: "var(--u-hairline)",
1108
1177
  lineStrong: "var(--u-hairline-strong)",
1109
1178
  text: "var(--u-color-text)",
@@ -1117,7 +1186,7 @@ const Os = {
1117
1186
  /* What text and marks take ON a filled bar - the same token the bar labels
1118
1187
  use in CSS, so a cap and the label beside it are one colour. */
1119
1188
  onAccent: "var(--u-color-on-accent)"
1120
- }, Ue = {
1189
+ }, Ve = {
1121
1190
  line: "GrayText",
1122
1191
  lineStrong: "CanvasText",
1123
1192
  text: "CanvasText",
@@ -1127,334 +1196,282 @@ const Os = {
1127
1196
  active: "Highlight",
1128
1197
  now: "GrayText",
1129
1198
  onAccent: "Canvas"
1130
- }, Es = (s) => s ? Ue : Os, Ns = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(forced-colors: active)").matches;
1131
- function Rs(s, t) {
1132
- const e = Ns(), n = {};
1133
- for (const r of t.tasks.values()) n[`task:${r.id}`] = e ? Ue.text : r.color;
1134
- const o = pn(s, { ...Es(e), ...n }), i = /* @__PURE__ */ new Map();
1135
- for (const r of t.tasks.values()) i.set(r.id, o[`task:${r.id}`] ?? r.color);
1199
+ }, _n = (s) => s ? Ve : Dn, Fn = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(forced-colors: active)").matches;
1200
+ function On(s, t) {
1201
+ const e = Fn(), n = {};
1202
+ for (const r of t.tasks.values()) n[`task:${r.id}`] = e ? Ve.text : r.color;
1203
+ const i = as(s, { ..._n(e), ...n }), o = /* @__PURE__ */ new Map();
1204
+ for (const r of t.tasks.values()) o.set(r.id, i[`task:${r.id}`] ?? r.color);
1136
1205
  return {
1137
- line: o.line,
1138
- lineStrong: o.lineStrong,
1139
- text: o.text,
1140
- muted: o.muted,
1141
- alarm: o.alarm,
1142
- surface: o.surface,
1143
- active: o.active,
1144
- now: o.now,
1145
- onAccent: o.onAccent,
1146
- tasks: i,
1206
+ line: i.line,
1207
+ lineStrong: i.lineStrong,
1208
+ text: i.text,
1209
+ muted: i.muted,
1210
+ alarm: i.alarm,
1211
+ surface: i.surface,
1212
+ active: i.active,
1213
+ now: i.now,
1214
+ onAccent: i.onAccent,
1215
+ tasks: o,
1147
1216
  forced: e
1148
1217
  };
1149
1218
  }
1150
- function ht(s) {
1219
+ function at(s) {
1151
1220
  const t = s.match(/[\d.]+/g);
1152
1221
  return t === null || t.length < 3 ? null : [Number(t[0]), Number(t[1]), Number(t[2])];
1153
1222
  }
1154
- function be(s) {
1155
- const t = ht(s);
1156
- return t === null ? 0 : qe(Xe(t));
1223
+ function ve(s) {
1224
+ const t = at(s);
1225
+ return t === null ? 0 : ze(We(t));
1157
1226
  }
1158
- function Xe(s) {
1227
+ function We(s) {
1159
1228
  return s.map((t) => {
1160
1229
  const e = t / 255;
1161
1230
  return e <= 0.04045 ? e / 12.92 : ((e + 0.055) / 1.055) ** 2.4;
1162
1231
  });
1163
1232
  }
1164
- function qe([s, t, e]) {
1233
+ function ze([s, t, e]) {
1165
1234
  return 0.2126 * s + 0.7152 * t + 0.0722 * e;
1166
1235
  }
1167
- function Me(s, t) {
1168
- const e = be(s), n = be(t);
1236
+ function ye(s, t) {
1237
+ const e = ve(s), n = ve(t);
1169
1238
  return (Math.max(e, n) + 0.05) / (Math.min(e, n) + 0.05);
1170
1239
  }
1171
- function Te(s, t, e) {
1240
+ function we(s, t, e) {
1172
1241
  if (s === null) return null;
1173
- const n = typeof window > "u" ? 1 : window.devicePixelRatio || 1, o = Math.round(t * n), i = Math.round(e * n);
1174
- s.width !== o && (s.width = o), s.height !== i && (s.height = i);
1242
+ const n = typeof window > "u" ? 1 : window.devicePixelRatio || 1, i = Math.round(t * n), o = Math.round(e * n);
1243
+ s.width !== i && (s.width = i), s.height !== o && (s.height = o);
1175
1244
  const r = s.getContext("2d");
1176
1245
  return r === null ? null : (r.setTransform(n, 0, 0, n, 0, 0), r.clearRect(0, 0, t, e), r);
1177
1246
  }
1178
- function Ps(s, t) {
1179
- const { data: e, view: n } = t, o = n.viewport();
1180
- Hs(s, t, o);
1181
- for (const i of e.blocked) Xs(s, t, o, i);
1182
- Gs(s, t);
1183
- for (const i of e.layers) {
1184
- if (i.kind === "blocked" || i.kind === "milestones") continue;
1185
- const r = new Set(i.data);
1186
- if (i.kind === "dependencies")
1187
- for (const a of n.paths) r.has(a.dependency) && Rt(s, t, a, !1);
1247
+ function En(s, t) {
1248
+ const { data: e, view: n } = t, i = n.viewport();
1249
+ Nn(s, t, i);
1250
+ for (const o of e.blocked) Cn(s, t, i, o);
1251
+ xn(s, t);
1252
+ for (const o of e.layers) {
1253
+ if (o.kind === "blocked" || o.kind === "milestones") continue;
1254
+ const r = new Set(o.data);
1255
+ if (o.kind === "dependencies")
1256
+ for (const a of n.paths) r.has(a.dependency) && Ls(a, n.width, n.height) && Pt(s, t, a, !1);
1188
1257
  else
1189
- for (const a of n.boxes) r.has(a.subtask) && Je(s, t, a, 1);
1258
+ for (const a of n.boxes) r.has(a.subtask) && Xe(s, t, a, 1);
1190
1259
  }
1191
- for (const i of e.overlaps) $t(s, t, o, i);
1192
- for (const i of e.inBlocked) $t(s, t, o, i);
1193
- Us(s, t, o);
1194
- for (const i of e.milestones) tn(s, t, o, i, !1);
1195
- Js(s, t);
1260
+ for (const o of e.overlaps) Et(s, t, i, o);
1261
+ for (const o of e.inBlocked) Et(s, t, i, o);
1262
+ An(s, t, i);
1263
+ for (const o of e.milestones) qe(s, t, i, o, !1);
1264
+ Wn(s, t);
1196
1265
  }
1197
- function $s(s, t) {
1198
- const { view: e, hover: n } = t, o = e.viewport();
1266
+ function Pn(s, t) {
1267
+ const { view: e, hover: n } = t, i = e.viewport();
1199
1268
  if (t.ghost === null) {
1200
1269
  if (n.kind === "subtask") {
1201
1270
  const c = e.boxById.get(n.subtask.id);
1202
- c !== void 0 && qs(s, t, c);
1271
+ c !== void 0 && Kn(s, t, c);
1203
1272
  } else if (n.kind === "dependency") {
1204
- const c = e.paths.find((m) => m.dependency === n.dependency);
1205
- c !== void 0 && Rt(s, t, c, !0);
1206
- } else n.kind === "milestone" && tn(s, t, o, n.milestone, !0);
1273
+ const c = e.paths.find((f) => f.dependency === n.dependency);
1274
+ c !== void 0 && Pt(s, t, c, !0);
1275
+ } else n.kind === "milestone" && qe(s, t, i, n.milestone, !0);
1207
1276
  return;
1208
1277
  }
1209
- const i = t.ghost, { ghost: r, overlaps: a, violated: l } = i;
1210
- Bs(s, t, o, i.refusedLanes);
1211
- const h = je(o, r);
1212
- if (h === null) return;
1213
- for (const c of a) $t(s, t, o, c);
1214
- const d = new Set(l.map((c) => c.dependency));
1278
+ const o = t.ghost, { ghost: r, overlaps: a, violated: l } = o;
1279
+ Ln(s, t, i, o.refusedLanes);
1280
+ const d = Ue(i, r);
1281
+ if (d === null) return;
1282
+ for (const c of a) Et(s, t, i, c);
1283
+ const h = new Set(l.map((c) => c.dependency));
1215
1284
  for (const c of t.data.dependencies) {
1216
1285
  if (c.from !== r.id && c.to !== r.id) continue;
1217
- const m = e.boxById.get(c.from === r.id ? c.to : c.from);
1218
- if (m === void 0) continue;
1219
- const p = c.from === r.id ? Nt(o, c, h, m, e.options) : Nt(o, c, m, h, e.options);
1220
- Rt(s, t, p, !0, d.has(c.id));
1221
- }
1222
- Je(s, { ...t, selectedTask: null }, h, 0.55), s.strokeStyle = t.colours.text, s.lineWidth = 1, s.setLineDash([3, 2]), s.strokeRect(h.outerFrom + 0.5, h.y + 0.5, Math.max(1, h.outerTo - h.outerFrom - 1), h.height - 1), s.setLineDash([]), i.tether !== null && xs(s, t, h, i.tether);
1223
- }
1224
- function Bs(s, t, e, n) {
1225
- if (n.size === 0) return;
1226
- const { width: o, height: i } = t.view;
1227
- for (const r of n) {
1228
- const a = J(e, r);
1229
- if (a === null) continue;
1230
- const { top: l, height: h } = a;
1231
- l + h < 0 || l > i || (s.globalAlpha = 0.6, s.fillStyle = t.colours.surface, s.fillRect(0, l, o, h), s.globalAlpha = 1, Qe(s, 0, l, o, h, t.colours.muted, 0.7, Ze, 1));
1232
- }
1233
- }
1234
- function xs(s, t, e, n) {
1235
- const o = Math.max(e.outerFrom, Math.min(e.outerTo, n.x)), i = Math.max(e.y, Math.min(e.y + e.height, n.y));
1236
- Math.hypot(n.x - o, n.y - i) < 2 || (s.strokeStyle = t.colours.text, s.lineWidth = 1, s.setLineDash([2, 3]), s.beginPath(), s.moveTo(o + 0.5, i + 0.5), s.lineTo(n.x + 0.5, n.y + 0.5), s.stroke(), s.setLineDash([]));
1237
- }
1238
- function je(s, t) {
1239
- const e = Wt(s.rows, t.lane);
1240
- return e === null ? null : Ye(s, t, t.lane, e, 0);
1241
- }
1242
- function Hs(s, t, e) {
1243
- const { view: n, colours: o, bands: i } = t, { width: r, height: a } = n;
1244
- s.lineWidth = 1, s.strokeStyle = o.line, s.beginPath();
1245
- for (const d of i.ticks)
1246
- s.moveTo(d.x + 0.5, 0), s.lineTo(d.x + 0.5, a);
1247
- for (const d of e.rows.rows) {
1248
- const c = d.top + d.height - e.scrollY - 0.5;
1286
+ const f = e.boxById.get(c.from === r.id ? c.to : c.from);
1287
+ if (f === void 0) continue;
1288
+ const g = c.from === r.id ? _t(i, c, d, f, e.options) : _t(i, c, f, d, e.options);
1289
+ Pt(s, t, g, !0, h.has(c.id));
1290
+ }
1291
+ Xe(s, { ...t, selectedTask: null }, d, 0.55), s.strokeStyle = t.colours.text, s.lineWidth = 1, s.setLineDash([3, 2]), s.strokeRect(d.outerFrom + 0.5, d.y + 0.5, Math.max(1, d.outerTo - d.outerFrom - 1), d.height - 1), s.setLineDash([]), o.tether !== null && Bn(s, t, d, o.tether);
1292
+ }
1293
+ function Bn(s, t, e, n) {
1294
+ const i = Math.max(e.outerFrom, Math.min(e.outerTo, n.x)), o = Math.max(e.y, Math.min(e.y + e.height, n.y));
1295
+ Math.hypot(n.x - i, n.y - o) < 2 || (s.strokeStyle = t.colours.text, s.lineWidth = 1, s.setLineDash([2, 3]), s.beginPath(), s.moveTo(i + 0.5, o + 0.5), s.lineTo(n.x + 0.5, n.y + 0.5), s.stroke(), s.setLineDash([]));
1296
+ }
1297
+ function Ue(s, t) {
1298
+ const e = Vt(s.rows, t.lane);
1299
+ return e === null ? null : Re(s, t, e, 0);
1300
+ }
1301
+ function Nn(s, t, e) {
1302
+ const { view: n, colours: i, bands: o } = t, { width: r, height: a } = n;
1303
+ s.lineWidth = 1, s.strokeStyle = i.line, s.beginPath();
1304
+ for (const h of o.ticks)
1305
+ s.moveTo(h.x + 0.5, 0), s.lineTo(h.x + 0.5, a);
1306
+ for (const h of e.rows.rows) {
1307
+ const c = h.top + h.height - e.scrollY - 0.5;
1249
1308
  c < 0 || c > a || (s.moveTo(0, c), s.lineTo(r, c));
1250
1309
  }
1251
- const l = [...e.rows.slots.values()].filter((d) => d.miniature).sort((d, c) => d.top - c.top);
1252
- l.forEach((d, c) => {
1253
- const m = l[c + 1];
1254
- if (m === void 0 || m.top !== d.top + d.height || m.group === d.group) return;
1255
- const p = d.top + d.height - e.scrollY - 0.5;
1256
- p < 0 || p > a || (s.moveTo(0, p), s.lineTo(r, p));
1257
- }), s.stroke(), s.strokeStyle = o.lineStrong, s.beginPath();
1258
- for (const d of i.days)
1259
- s.moveTo(d.x + 0.5, 0), s.lineTo(d.x + 0.5, a);
1310
+ const l = [...e.rows.slots.values()].filter((h) => h.miniature).sort((h, c) => h.top - c.top);
1311
+ l.forEach((h, c) => {
1312
+ const f = l[c + 1];
1313
+ if (f === void 0 || f.top !== h.top + h.height || f.group === h.group) return;
1314
+ const g = h.top + h.height - e.scrollY - 0.5;
1315
+ g < 0 || g > a || (s.moveTo(0, g), s.lineTo(r, g));
1316
+ }), s.stroke(), s.strokeStyle = i.lineStrong, s.beginPath();
1317
+ for (const h of o.days)
1318
+ s.moveTo(h.x + 0.5, 0), s.lineTo(h.x + 0.5, a);
1260
1319
  s.stroke();
1261
- const h = gn(n.options.calendar);
1262
- if (h.length > 0) {
1263
- s.strokeStyle = o.muted, s.setLineDash([2, 3]), s.beginPath();
1264
- for (const d of h) {
1265
- const c = Math.round(e.scale.toPx(d.workingTime)) + 0.5;
1320
+ const d = ls(n.options.calendar);
1321
+ if (d.length > 0) {
1322
+ s.strokeStyle = i.muted, s.setLineDash([2, 3]), s.beginPath();
1323
+ for (const h of d) {
1324
+ const c = Math.round(e.scale.toPx(h.workingTime)) + 0.5;
1266
1325
  c < 0 || c > r || (s.moveTo(c, 0), s.lineTo(c, a));
1267
1326
  }
1268
1327
  s.stroke(), s.setLineDash([]);
1269
1328
  }
1270
1329
  }
1271
- function Gs(s, t) {
1330
+ function xn(s, t) {
1272
1331
  const e = t.view.nowX();
1273
1332
  e !== null && (s.fillStyle = t.colours.now, s.fillRect(e, 0, 2, t.view.height));
1274
1333
  }
1275
- function Ys(s, t, e, n) {
1276
- const o = ct(t.colours, t, e.subtask.task, e.subtask.id);
1277
- s.fillStyle = o;
1278
- for (const [i, r] of [
1334
+ function Rn(s, t, e, n) {
1335
+ const i = lt(t.colours, t, e.subtask.task, e.subtask.id);
1336
+ s.fillStyle = i;
1337
+ for (const [o, r] of [
1279
1338
  [e.outerFrom, e.mainFrom],
1280
1339
  [e.mainTo, e.outerTo]
1281
1340
  ])
1282
- r <= i || (s.globalAlpha = 0.28 * n, s.fillRect(i, e.y, r - i, e.height));
1341
+ r <= o || (s.globalAlpha = 0.28 * n, s.fillRect(o, e.y, r - o, e.height));
1283
1342
  s.globalAlpha = n, s.fillRect(e.mainFrom, e.y, Math.max(1, e.mainTo - e.mainFrom), e.height), s.globalAlpha = 1;
1284
1343
  }
1285
- function Xt(s, t, e) {
1344
+ function zt(s, t, e) {
1286
1345
  if (s.dashed) return { fill: null, onDark: !1 };
1287
- const n = s.muted ? zs(t, e.surface, 0.5) : t;
1288
- return { fill: n, onDark: Me(n, e.onAccent) > Me(n, e.text) };
1346
+ const n = s.muted ? $n(t, e.surface, 0.5) : t;
1347
+ return { fill: n, onDark: ye(n, e.onAccent) > ye(n, e.text) };
1289
1348
  }
1290
- function zs(s, t, e) {
1291
- const n = ht(s), o = ht(t);
1292
- if (n === null || o === null) return s;
1293
- const i = (r) => Math.round(n[r] + (o[r] - n[r]) * e);
1294
- return `rgb(${i(0)}, ${i(1)}, ${i(2)})`;
1349
+ function $n(s, t, e) {
1350
+ const n = at(s), i = at(t);
1351
+ if (n === null || i === null) return s;
1352
+ const o = (r) => Math.round(n[r] + (i[r] - n[r]) * e);
1353
+ return `rgb(${o(0)}, ${o(1)}, ${o(2)})`;
1295
1354
  }
1296
- function Ie(s, t) {
1297
- const e = ht(s);
1355
+ function be(s, t) {
1356
+ const e = at(s);
1298
1357
  if (e === null || t === 0) return s;
1299
- const n = Xe(e), o = qe(n), [i, r, a] = n.map((l) => {
1300
- const h = l + (o - l) * t, d = h <= 31308e-7 ? h * 12.92 : 1.055 * h ** (1 / 2.4) - 0.055;
1301
- return Math.round(Math.min(1, Math.max(0, d)) * 255);
1358
+ const n = We(e), i = ze(n), [o, r, a] = n.map((l) => {
1359
+ const d = l + (i - l) * t, h = d <= 31308e-7 ? d * 12.92 : 1.055 * d ** (1 / 2.4) - 0.055;
1360
+ return Math.round(Math.min(1, Math.max(0, h)) * 255);
1302
1361
  });
1303
- return `rgb(${i}, ${r}, ${a})`;
1362
+ return `rgb(${o}, ${r}, ${a})`;
1304
1363
  }
1305
- function ct(s, t, e, n) {
1306
- const o = (e === null ? void 0 : s.tasks.get(e)) ?? s.muted;
1307
- return t.selectedTask === null ? o : e !== t.selectedTask ? s.forced ? s.muted : Ie(o, 1) : s.forced || t.selectedSubtask === null || n === null || n === t.selectedSubtask ? o : Ie(o, 0.5);
1364
+ function lt(s, t, e, n) {
1365
+ const i = (e === null ? void 0 : s.tasks.get(e)) ?? s.muted;
1366
+ return t.selectedTask === null ? i : e !== t.selectedTask ? s.forced ? s.muted : be(i, 1) : s.forced || t.selectedSubtask === null || n === null || n === t.selectedSubtask ? i : be(i, 0.5);
1308
1367
  }
1309
- const Ks = 2;
1310
- function Je(s, t, e, n) {
1311
- const { view: o, colours: i } = t;
1312
- if (!Et(e, o.width, o.height)) return;
1368
+ const Gn = 2;
1369
+ function Xe(s, t, e, n) {
1370
+ const { view: i, colours: o } = t;
1371
+ if (!Dt(e, i.width, i.height)) return;
1313
1372
  if (e.miniature) {
1314
- Ys(s, t, e, n);
1373
+ Rn(s, t, e, n);
1315
1374
  return;
1316
1375
  }
1317
- const r = yt(e.subtask.appearance), a = ct(i, t, e.subtask.task, e.subtask.id), l = Xt(r, a, i), h = e.y, d = e.height, c = Math.max(1, e.mainTo - e.mainFrom), m = l.onDark ? i.onAccent : i.text;
1376
+ const r = pt(e.subtask.appearance), a = lt(o, t, e.subtask.task, e.subtask.id), l = zt(r, a, o), d = e.y, h = e.height, c = Math.max(1, e.mainTo - e.mainFrom), f = l.onDark ? o.onAccent : o.text;
1318
1377
  s.lineWidth = 1, s.fillStyle = a, s.strokeStyle = a;
1319
- for (const [y, I] of [
1378
+ for (const [v, A] of [
1320
1379
  [e.outerFrom, e.mainFrom],
1321
1380
  [e.mainTo, e.outerTo]
1322
1381
  ])
1323
- I <= y || (s.globalAlpha = 0.28 * n, s.fillRect(y, h, I - y, d), s.globalAlpha = n, s.strokeRect(y + 0.5, h + 0.5, I - y - 1, d - 1));
1324
- l.fill !== null && (s.globalAlpha = n, s.fillStyle = l.fill, s.fillRect(e.mainFrom, h, c, d));
1325
- const p = e.subtask.progress;
1326
- if (p !== void 0) {
1327
- const y = Math.min(4, Math.max(2, Math.round(d / 6))), I = h + d - y - Ks, A = Math.round(c * Math.max(0, Math.min(1, p)));
1328
- s.fillStyle = l.fill === null ? a : m, s.globalAlpha = 0.3 * n, s.fillRect(e.mainFrom, I, c, y), s.globalAlpha = n, A > 0 && s.fillRect(e.mainFrom, I, A, y);
1382
+ A <= v || (s.globalAlpha = 0.28 * n, s.fillRect(v, d, A - v, h), s.globalAlpha = n, s.strokeRect(v + 0.5, d + 0.5, A - v - 1, h - 1));
1383
+ l.fill !== null && (s.globalAlpha = n, s.fillStyle = l.fill, s.fillRect(e.mainFrom, d, c, h));
1384
+ const g = e.subtask.progress;
1385
+ if (g !== void 0) {
1386
+ const v = Math.min(4, Math.max(2, Math.round(h / 6))), A = d + h - v - Gn, C = Math.round(c * Math.max(0, Math.min(1, g)));
1387
+ s.fillStyle = l.fill === null ? a : f, s.globalAlpha = 0.3 * n, s.fillRect(e.mainFrom, A, c, v), s.globalAlpha = n, C > 0 && s.fillRect(e.mainFrom, A, C, v);
1329
1388
  }
1330
1389
  if (r.hatched) {
1331
- const y = Math.max(1, Math.min(Ge, Math.floor((c - 2 * at) / 3))), I = c >= 4 * y ? at : 0, A = d >= 4 * at ? at : 0;
1332
- s.globalAlpha = n, s.fillStyle = m, s.fillRect(e.mainFrom + I, h + A, y, d - 2 * A), s.fillRect(e.mainTo - I - y, h + A, y, d - 2 * A);
1390
+ const v = Math.max(1, Math.min(xe, Math.floor((c - 2 * st) / 3))), A = c >= 4 * v ? st : 0, C = h >= 4 * st ? st : 0;
1391
+ s.globalAlpha = n, s.fillStyle = f, s.fillRect(e.mainFrom + A, d + C, v, h - 2 * C), s.fillRect(e.mainTo - A - v, d + C, v, h - 2 * C);
1333
1392
  }
1334
- r.open && Ws(s, e, h, d, i.surface, o.width), r.dashed && (s.globalAlpha = n, s.strokeStyle = a, s.setLineDash([4, 3]), s.strokeRect(e.mainFrom + 0.5, h + 0.5, c - 1, d - 1), s.setLineDash([])), s.globalAlpha = 1, e.depth > 0 && n === 1 && (s.strokeStyle = i.surface, s.strokeRect(e.outerFrom - 0.5, h - 0.5, e.outerTo - e.outerFrom + 1, d + 1));
1335
- }
1336
- const Ze = 6, Vs = 16;
1337
- function Qe(s, t, e, n, o, i, r, a, l) {
1338
- s.save(), s.beginPath(), s.rect(t, e, n, o), s.clip(), s.globalAlpha = 0.5 * r, s.strokeStyle = i, s.lineWidth = l, s.beginPath();
1339
- for (let h = t - o; h < t + n + o; h += a)
1340
- s.moveTo(h, e + o), s.lineTo(h + o, e);
1341
- s.stroke(), s.restore();
1393
+ r.open && Yn(s, e, d, h, o.surface, i.width), r.dashed && (s.globalAlpha = n, s.strokeStyle = a, s.setLineDash([4, 3]), s.strokeRect(e.mainFrom + 0.5, d + 0.5, c - 1, h - 1), s.setLineDash([])), s.globalAlpha = 1, e.depth > 0 && n === 1 && (s.strokeStyle = o.surface, s.strokeRect(e.outerFrom - 0.5, d - 0.5, e.outerTo - e.outerFrom + 1, h + 1));
1342
1394
  }
1343
- function Ws(s, t, e, n, o, i) {
1344
- const r = t.mainFrom < 0, a = t.mainTo > i, l = Math.max(1, Math.min(t.mainTo, i) - Math.max(t.mainFrom, 0)), h = Math.min(Vs, l);
1345
- r && Se(s, 0, h, e, n, o, 1), a && Se(s, i, -h, e, n, o, 1);
1395
+ const Hn = 16;
1396
+ function Yn(s, t, e, n, i, o) {
1397
+ const r = t.mainFrom < 0, a = t.mainTo > o, l = Math.max(1, Math.min(t.mainTo, o) - Math.max(t.mainFrom, 0)), d = Math.min(Hn, l);
1398
+ r && Me(s, 0, d, e, n, i), a && Me(s, o, -d, e, n, i);
1346
1399
  }
1347
- function Se(s, t, e, n, o, i, r) {
1348
- const a = s.createLinearGradient(t, 0, t + e, 0);
1349
- a.addColorStop(0, Le(i, r)), a.addColorStop(1, Le(i, 0)), s.globalAlpha = 1, s.fillStyle = a, s.fillRect(Math.min(t, t + e), n, Math.abs(e), o);
1400
+ function Me(s, t, e, n, i, o) {
1401
+ const r = s.createLinearGradient(t, 0, t + e, 0);
1402
+ r.addColorStop(0, Te(o, 1)), r.addColorStop(1, Te(o, 0)), s.globalAlpha = 1, s.fillStyle = r, s.fillRect(Math.min(t, t + e), n, Math.abs(e), i);
1350
1403
  }
1351
- function Le(s, t) {
1352
- const e = ht(s);
1404
+ function Te(s, t) {
1405
+ const e = at(s);
1353
1406
  return e === null ? s : `rgba(${e[0]}, ${e[1]}, ${e[2]}, ${t})`;
1354
1407
  }
1355
- function Rt(s, t, e, n, o) {
1356
- const { data: i, colours: r } = t, a = i.taskOfDependency(e.dependency), l = o ?? i.violatedById.has(e.dependency.id), h = a !== null && a === t.selectedTask, d = l ? r.alarm : ct(r, t, a, null);
1357
- if (s.strokeStyle = d, s.fillStyle = d, s.lineWidth = n || h ? 2 : 1.25, s.setLineDash(l ? [4, 3] : []), s.beginPath(), s.moveTo(e.x1, e.y1), e.kind === "curve")
1408
+ function Pt(s, t, e, n, i) {
1409
+ const { data: o, colours: r } = t, a = o.taskOfDependency(e.dependency), l = i ?? o.violatedById.has(e.dependency.id), d = a !== null && a === t.selectedTask, h = l ? r.alarm : lt(r, t, a, null);
1410
+ if (s.strokeStyle = h, s.fillStyle = h, s.lineWidth = n || d ? 2 : 1.25, s.setLineDash(l ? [4, 3] : []), s.beginPath(), s.moveTo(e.x1, e.y1), e.kind === "curve")
1358
1411
  s.bezierCurveTo(e.c1x, e.y1, e.c2x, e.y2, e.x2, e.y2);
1359
1412
  else
1360
1413
  for (let c = 2; c + 1 < e.points.length; c += 2) s.lineTo(e.points[c], e.points[c + 1]);
1361
1414
  if (s.stroke(), s.setLineDash([]), e.ends === "dot")
1362
- for (const [c, m] of [
1415
+ for (const [c, f] of [
1363
1416
  [e.x1, e.y1],
1364
1417
  [e.x2, e.y2]
1365
1418
  ])
1366
- s.beginPath(), s.arc(c, m, l ? 3 : 2.5, 0, Math.PI * 2), s.fill();
1419
+ s.beginPath(), s.arc(c, f, l ? 3 : 2.5, 0, Math.PI * 2), s.fill();
1367
1420
  }
1368
- function Us(s, t, e) {
1369
- const { data: n } = t;
1370
- if (n.violatedById.size !== 0)
1371
- for (const o of n.violatedById.values()) {
1372
- const i = n.dependencies.find((c) => c.id === o.dependency), r = i === void 0 ? void 0 : n.subtaskById.get(i.to);
1373
- if (r === void 0) continue;
1374
- const a = J(e, r.lane);
1375
- if (a === null || !a.miniature) continue;
1376
- const l = st(e.rows, a.top + e.scrollY);
1377
- if (l === null) continue;
1378
- const h = R(e, o.arrival), d = Math.max(h + 2, R(e, o.arrival + o.shortBy));
1379
- Pt(s, t, h, d, l.top - e.scrollY + 1, 3);
1380
- }
1381
- }
1382
- function Pt(s, t, e, n, o, i) {
1383
- if (!t.colours.forced) {
1384
- s.fillStyle = t.colours.alarm, s.fillRect(e, o, n - e, i);
1385
- return;
1386
- }
1387
- s.strokeStyle = t.colours.alarm, s.lineWidth = i, s.setLineDash([4, 3]), s.beginPath(), s.moveTo(e, o + i / 2), s.lineTo(n, o + i / 2), s.stroke(), s.setLineDash([]);
1388
- }
1389
- function Xs(s, t, e, n) {
1390
- const o = J(e, n.lane);
1391
- if (o === null || o.top + o.height < 0 || o.top > t.view.height) return;
1392
- const i = Math.max(0, R(e, n.from)), r = Math.min(t.view.width, R(e, n.to));
1393
- r <= i || (s.globalAlpha = 0.1, s.fillStyle = t.colours.muted, s.fillRect(i, o.top, r - i, o.height), s.globalAlpha = 1, Qe(s, i, o.top, r - i, o.height, t.colours.muted, 0.7, Ze, 1));
1394
- }
1395
- function tn(s, t, e, n, o) {
1396
- const i = Ut(e, n);
1397
- if (i === null || i.x < -i.half || i.x > t.view.width + i.half) return;
1421
+ function qe(s, t, e, n, i) {
1422
+ const o = Wt(e, n);
1423
+ if (o === null || o.x < -o.half || o.x > t.view.width + o.half) return;
1398
1424
  const r = (a) => {
1399
- s.beginPath(), s.moveTo(i.x, i.y - a), s.lineTo(i.x + a, i.y), s.lineTo(i.x, i.y + a), s.lineTo(i.x - a, i.y), s.closePath();
1425
+ s.beginPath(), s.moveTo(o.x, o.y - a), s.lineTo(o.x + a, o.y), s.lineTo(o.x, o.y + a), s.lineTo(o.x - a, o.y), s.closePath();
1400
1426
  };
1401
- o && (r(i.half + 3), s.fillStyle = t.colours.active, s.fill()), r(i.half + 1), s.fillStyle = t.colours.surface, s.fill(), r(i.half), s.fillStyle = t.colours.text, s.fill();
1427
+ i && (r(o.half + 3), s.fillStyle = t.colours.active, s.fill()), r(o.half + 1), s.fillStyle = t.colours.surface, s.fill(), r(o.half), s.fillStyle = t.colours.text, s.fill();
1402
1428
  }
1403
- function $t(s, t, e, n) {
1404
- const o = J(e, n.lane);
1405
- if (o === null) return;
1406
- const i = R(e, n.from), r = Math.max(i + 2, R(e, n.to));
1407
- if (s.fillStyle = t.colours.alarm, s.globalAlpha = 0.14, s.fillRect(i, o.top + 1, r - i, Math.max(1, o.height - 2)), s.globalAlpha = 1, Pt(s, t, i, r, o.top + 1, Math.min(3, Math.max(1, o.height - 1))), o.miniature) {
1408
- const a = st(e.rows, o.top + e.scrollY);
1409
- a !== null && Pt(s, t, i, r, a.top - e.scrollY + 1, 3);
1410
- }
1411
- }
1412
- function qs(s, t, e) {
1413
- const { colours: n } = t, o = yt(e.subtask.appearance), i = Xt(o, ct(n, t, e.subtask.task, e.subtask.id), n);
1429
+ function Kn(s, t, e) {
1430
+ const { colours: n } = t, i = pt(e.subtask.appearance), o = zt(i, lt(n, t, e.subtask.task, e.subtask.id), n);
1414
1431
  if (n.forced) {
1415
1432
  s.strokeStyle = n.active, s.lineWidth = 2, s.strokeRect(e.outerFrom - 2, e.y - 2, Math.max(1, e.outerTo - e.outerFrom) + 4, e.height + 4);
1416
1433
  return;
1417
1434
  }
1418
- s.globalAlpha = js, s.fillStyle = i.onDark ? n.onAccent : n.text, s.fillRect(e.outerFrom, e.y, Math.max(1, e.outerTo - e.outerFrom), e.height), s.globalAlpha = 1;
1435
+ s.globalAlpha = Vn, s.fillStyle = o.onDark ? n.onAccent : n.text, s.fillRect(e.outerFrom, e.y, Math.max(1, e.outerTo - e.outerFrom), e.height), s.globalAlpha = 1;
1419
1436
  }
1420
- const js = 0.2;
1421
- function Js(s, t) {
1437
+ const Vn = 0.2;
1438
+ function Wn(s, t) {
1422
1439
  const e = t.selectedTask;
1423
1440
  if (e !== null) {
1424
1441
  s.strokeStyle = t.colours.text;
1425
1442
  for (const n of t.view.boxes) {
1426
1443
  if (n.subtask.task !== e) continue;
1427
- const o = n.subtask.id === t.selectedSubtask;
1428
- s.lineWidth = o ? 2 : 1;
1429
- const i = o ? 1 : 0.5;
1430
- s.strokeRect(n.outerFrom - i, n.y - i, n.outerTo - n.outerFrom + 2 * i, n.height + 2 * i);
1444
+ const i = n.subtask.id === t.selectedSubtask;
1445
+ s.lineWidth = i ? 2 : 1;
1446
+ const o = i ? 1 : 0.5;
1447
+ s.strokeRect(n.outerFrom - o, n.y - o, n.outerTo - n.outerFrom + 2 * o, n.height + 2 * o);
1431
1448
  }
1432
1449
  }
1433
1450
  }
1434
- const mt = 32, Zs = 18;
1435
- function Ae(s, t) {
1436
- if (!(t > 2 * mt)) return 0;
1437
- const e = mt - s, n = s - (t - mt), o = Math.max(e, n);
1438
- if (o <= 0) return 0;
1439
- const i = Math.min(1, o / mt), r = Zs * i * i;
1451
+ const ut = 32, zn = 18;
1452
+ function Ie(s, t) {
1453
+ if (!(t > 2 * ut)) return 0;
1454
+ const e = ut - s, n = s - (t - ut), i = Math.max(e, n);
1455
+ if (i <= 0) return 0;
1456
+ const o = Math.min(1, i / ut), r = zn * o * o;
1440
1457
  return e > 0 ? -r : r;
1441
1458
  }
1442
- function dt(s, t, e) {
1443
- const n = (o, i) => {
1444
- const r = ot(o);
1445
- return o.lane === i.lane && r.from < i.to && i.from < r.to;
1459
+ function ot(s, t, e) {
1460
+ const n = (i, o) => {
1461
+ const r = et(i);
1462
+ return i.lane === o.lane && r.from < o.to && o.from < r.to;
1446
1463
  };
1447
- return e.some((o) => n(s, o) && !(t !== null && n(t, o)));
1464
+ return e.some((i) => n(s, i) && !(t !== null && n(t, i)));
1448
1465
  }
1449
- function Qs(s, t, e, n) {
1450
- const o = /* @__PURE__ */ new Set();
1451
- if (n === void 0) return o;
1452
- for (const i of s)
1453
- i !== e && (n(t, i) || o.add(i));
1454
- return o;
1466
+ function Un(s, t, e, n) {
1467
+ const i = /* @__PURE__ */ new Set();
1468
+ if (n === void 0) return i;
1469
+ for (const o of s)
1470
+ o !== e && (n(t, o) || i.add(o));
1471
+ return i;
1455
1472
  }
1456
- const Ce = "\0placing", De = /* @__PURE__ */ new Set();
1457
- function Ot(s) {
1473
+ const Se = "\0placing", Le = /* @__PURE__ */ new Set();
1474
+ function Ct(s) {
1458
1475
  switch (s.kind) {
1459
1476
  case "subtask":
1460
1477
  return `subtask:${s.subtask.id}:${s.part}`;
@@ -1468,40 +1485,40 @@ function Ot(s) {
1468
1485
  return "nothing";
1469
1486
  }
1470
1487
  }
1471
- const _e = 3, to = 10, eo = 600;
1472
- class no {
1488
+ const Ae = 3, Xn = 10, qn = 600;
1489
+ class jn {
1473
1490
  constructor(t) {
1474
- f(this, "gesture", { kind: "none" });
1475
- f(this, "touches", /* @__PURE__ */ new Map());
1476
- f(this, "hoverKey", "nothing");
1477
- /** The last pointer of a drag, in client coordinates, and the frame that
1478
- pans along while it is near an edge. */
1479
- f(this, "lastClient", { x: 0, y: 0 });
1480
- f(this, "panFrame", 0);
1481
- /** Whether the pointer last stood over a lane the dragged work may not go
1482
- to. It is a fact about the pointer and not about the ghost, which stayed
1483
- where it was allowed. */
1484
- f(this, "refused", !1);
1485
- /** Whether the pointer last stood where the dragged work would cover blocked
1486
- time - as `refused`, a fact about the pointer and not about the ghost. */
1487
- f(this, "blocked", !1);
1488
- /** Where the pointer stands on the plot while a drag is in flight - what the
1489
- tether is drawn to, since the ghost is not following it. */
1490
- f(this, "dragPoint", { x: 0, y: 0 });
1491
- /** The folded group the pointer is resting over, and the timer that will
1492
- open it for this gesture. */
1493
- f(this, "resting", null);
1494
- f(this, "hover", { kind: "nothing" });
1495
- /** Where the pointer rests on the plot while nothing is being dragged - or,
1496
- where the keyboard set the hover, the point its tooltip stands at. */
1497
- f(this, "hoverPoint", { x: 0, y: 0 });
1498
- /** Whether the keyboard set the hover (ADR-0030): pointer and keys share one
1499
- **Active subtask**, and the last input wins. The keys' hover stays when
1500
- the pointer leaves, and the pointer takes it over by moving. */
1501
- f(this, "byKeyboard", !1);
1502
- f(this, "cursor", "default");
1503
1491
  this.host = t;
1504
1492
  }
1493
+ gesture = { kind: "none" };
1494
+ touches = /* @__PURE__ */ new Map();
1495
+ hoverKey = "nothing";
1496
+ /** The last pointer of a drag, in client coordinates, and the frame that
1497
+ pans along while it is near an edge. */
1498
+ lastClient = { x: 0, y: 0 };
1499
+ panFrame = 0;
1500
+ /** Whether the pointer last stood over a lane the dragged work may not go
1501
+ to. It is a fact about the pointer and not about the ghost, which stayed
1502
+ where it was allowed. */
1503
+ refused = !1;
1504
+ /** Whether the pointer last stood where the dragged work would cover blocked
1505
+ time - as `refused`, a fact about the pointer and not about the ghost. */
1506
+ blocked = !1;
1507
+ /** Where the pointer stands on the plot while a drag is in flight - what the
1508
+ tether is drawn to, since the ghost is not following it. */
1509
+ dragPoint = { x: 0, y: 0 };
1510
+ /** The folded group the pointer is resting over, and the timer that will
1511
+ open it for this gesture. */
1512
+ resting = null;
1513
+ hover = { kind: "nothing" };
1514
+ /** Where the pointer rests on the plot while nothing is being dragged - or,
1515
+ where the keyboard set the hover, the point its tooltip stands at. */
1516
+ hoverPoint = { x: 0, y: 0 };
1517
+ /** Whether the keyboard set the hover (ADR-0030): pointer and keys share one
1518
+ **Active subtask**, and the last input wins. The keys' hover stays when
1519
+ the pointer leaves, and the pointer takes it over by moving. */
1520
+ byKeyboard = !1;
1521
+ cursor = "default";
1505
1522
  /* ---------------------------------------------------------------- */
1506
1523
  /* What the scene reads */
1507
1524
  /* ---------------------------------------------------------------- */
@@ -1530,18 +1547,18 @@ class no {
1530
1547
  ghostSummary() {
1531
1548
  const t = this.gesture;
1532
1549
  if (t.kind !== "edit" && t.kind !== "place") return null;
1533
- const e = je(this.host.view.viewport(), t.ghost);
1550
+ const e = Ue(this.host.view.viewport(), t.ghost);
1534
1551
  if (e === null) return null;
1535
- const n = this.ghostFindings(t.ghost, this.ghostHome(t)), o = t.kind === "edit" && (t.mode === "leadIn" || t.mode === "leadOut"), i = o ? ot(t.ghost) : t.ghost;
1552
+ const n = this.ghostFindings(t.ghost, this.ghostHome(t)), i = t.kind === "edit" && (t.mode === "leadIn" || t.mode === "leadOut"), o = i ? et(t.ghost) : t.ghost;
1536
1553
  return {
1537
1554
  refused: this.refused,
1538
1555
  refusedLanes: [...t.refused],
1539
1556
  blocked: this.blocked,
1540
- x: o ? e.outerFrom : e.mainFrom,
1557
+ x: i ? e.outerFrom : e.mainFrom,
1541
1558
  y: e.y,
1542
1559
  height: e.height,
1543
- from: i.from,
1544
- to: i.to,
1560
+ from: o.from,
1561
+ to: o.to,
1545
1562
  overlap: n.overlaps.length > 0,
1546
1563
  violated: n.violated.length > 0
1547
1564
  };
@@ -1550,25 +1567,22 @@ class no {
1550
1567
  /* Pointer */
1551
1568
  /* ---------------------------------------------------------------- */
1552
1569
  local(t, e) {
1553
- var o;
1554
- const n = (o = this.host.plotElement()) == null ? void 0 : o.getBoundingClientRect();
1555
- return { x: t - ((n == null ? void 0 : n.left) ?? 0), y: e - ((n == null ? void 0 : n.top) ?? 0) };
1570
+ const n = this.host.plotElement()?.getBoundingClientRect();
1571
+ return { x: t - (n?.left ?? 0), y: e - (n?.top ?? 0) };
1556
1572
  }
1557
- report(t, e, n, o, i, r) {
1558
- var l, h;
1573
+ report(t, e, n, i, o, r) {
1559
1574
  const a = this.host.view;
1560
- (h = (l = this.host.handlers()).onInteraction) == null || h.call(l, { type: t, hit: e, clientX: n, clientY: o, time: a.timeAt(i), lane: a.laneIdAt(r) });
1575
+ this.host.handlers().onInteraction?.({ type: t, hit: e, clientX: n, clientY: i, time: a.timeAt(o), lane: a.laneIdAt(r) });
1561
1576
  }
1562
1577
  pointerDown(t) {
1563
- var a, l, h, d, c;
1564
1578
  const { x: e, y: n } = this.local(t.clientX, t.clientY);
1565
1579
  if (t.pointerType === "touch" && (this.touches.set(t.pointerId, { x: e, y: n }), this.touches.size >= 2)) {
1566
1580
  this.gesture.kind !== "pinch" && (this.cancelEdit(), this.gesture = { kind: "pinch", distance: this.touchDistance() });
1567
1581
  return;
1568
1582
  }
1569
1583
  if (t.button !== 0) return;
1570
- const o = (h = (l = (a = t.target) == null ? void 0 : a.closest) == null ? void 0 : l.call(a, "[data-grip]")) == null ? void 0 : h.getAttribute("data-grip"), i = this.host.selectedSubtask(), r = i !== null ? this.host.data.subtaskById.get(i) ?? null : null;
1571
- t.pointerType === "touch" ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: n, mode: "pan", subtask: null } : (o === "leadIn" || o === "leadOut") && r !== null ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: n, mode: o, subtask: r } : this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: n, ...this.modeAt(e, n) }, (c = (d = this.host.plotElement()) == null ? void 0 : d.setPointerCapture) == null || c.call(d, t.pointerId);
1584
+ const i = t.target?.closest?.("[data-grip]")?.getAttribute("data-grip"), o = this.host.selectedSubtask(), r = o !== null ? this.host.data.subtaskById.get(o) ?? null : null;
1585
+ t.pointerType === "touch" ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: n, mode: "pan", subtask: null } : (i === "leadIn" || i === "leadOut") && r !== null ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: n, mode: i, subtask: r } : this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: n, ...this.modeAt(e, n) }, this.host.plotElement()?.setPointerCapture?.(t.pointerId);
1572
1586
  }
1573
1587
  /** A drag over a folded group: resting on one opens it for the GESTURE.
1574
1588
 
@@ -1578,13 +1592,12 @@ class no {
1578
1592
  never written to and no change is reported, because the application did
1579
1593
  not fold anything (ADR-0025). */
1580
1594
  restOver(t) {
1581
- var o;
1582
1595
  const e = this.host.view, n = e.foldedGroupAt(t);
1583
- n !== ((o = this.resting) == null ? void 0 : o.group) && (this.stopResting(), n !== null && (this.resting = {
1596
+ n !== this.resting?.group && (this.stopResting(), n !== null && (this.resting = {
1584
1597
  group: n,
1585
1598
  timer: setTimeout(() => {
1586
1599
  this.resting = null, e.openForGesture = /* @__PURE__ */ new Set([...e.openForGesture, n]), this.host.viewChanged();
1587
- }, eo)
1600
+ }, qn)
1588
1601
  }));
1589
1602
  }
1590
1603
  stopResting() {
@@ -1606,29 +1619,28 @@ class no {
1606
1619
  lane is open. Asked at a drop, where the answer has to be current; while
1607
1620
  a drag runs, the held set answers instead. */
1608
1621
  allowed(t, e) {
1609
- var n, o;
1610
- return ((o = (n = this.host.handlers()).canMoveTo) == null ? void 0 : o.call(n, t, e)) ?? !0;
1622
+ return this.host.handlers().canMoveTo?.(t, e) ?? !0;
1611
1623
  }
1612
1624
  /** The lanes this work may not go to, for the gesture that is beginning. A
1613
1625
  gesture that cannot change a lane at all asks nothing: the intents the
1614
1626
  caller handles decide whether the question exists. */
1615
1627
  askRefused(t, e) {
1616
- if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return De;
1617
- const n = this.host.data.lanes.map((o) => o.id);
1618
- return Qs(n, t, e, this.host.handlers().canMoveTo);
1628
+ if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return Le;
1629
+ const n = this.host.data.lanes.map((i) => i.id);
1630
+ return Un(n, t, e, this.host.handlers().canMoveTo);
1619
1631
  }
1620
1632
  /** What a press at a point would start, given the intents the caller handles. */
1621
1633
  modeAt(t, e) {
1622
- const n = this.host.view, o = n.options.intents;
1634
+ const n = this.host.view, i = n.options.intents;
1623
1635
  if (n.hitAt(t, e).kind === "milestone") return { mode: "pan", subtask: null };
1624
- for (let i = n.boxes.length - 1; i >= 0; i--) {
1625
- const r = n.boxes[i];
1626
- if (o.includes("stretch")) {
1627
- const a = Nn(r, t, e);
1636
+ for (let o = n.boxes.length - 1; o >= 0; o--) {
1637
+ const r = n.boxes[o];
1638
+ if (i.includes("stretch")) {
1639
+ const a = Ss(r, t, e);
1628
1640
  if (a !== null) return { mode: a === "from" ? "stretch-from" : "stretch-to", subtask: r.subtask };
1629
1641
  }
1630
- if (ze(r, t, e) !== null)
1631
- return o.includes("move") || o.includes("lane") ? { mode: "move", subtask: r.subtask } : { mode: "pan", subtask: r.subtask };
1642
+ if ($e(r, t, e) !== null)
1643
+ return i.includes("move") || i.includes("lane") ? { mode: "move", subtask: r.subtask } : { mode: "pan", subtask: r.subtask };
1632
1644
  }
1633
1645
  return { mode: "pan", subtask: null };
1634
1646
  }
@@ -1639,57 +1651,56 @@ class no {
1639
1651
  r > 0 && this.gesture.distance > 0 && this.host.view.zoomAt(this.touchCentre(), this.gesture.distance / r) && this.host.viewMoved(!0), this.gesture = { kind: "pinch", distance: r };
1640
1652
  return;
1641
1653
  }
1642
- const o = this.gesture;
1643
- if (o.kind === "pending" && o.pointerId === t.pointerId) {
1644
- if (Math.hypot(e - o.x0, n - o.y0) < (t.pointerType === "touch" ? to : _e)) return;
1645
- if (o.mode === "pan" || o.subtask === null)
1646
- this.gesture = { kind: "pan", pointerId: o.pointerId, lastX: o.x0, lastY: o.y0 }, this.setCursor("grabbing");
1654
+ const i = this.gesture;
1655
+ if (i.kind === "pending" && i.pointerId === t.pointerId) {
1656
+ if (Math.hypot(e - i.x0, n - i.y0) < (t.pointerType === "touch" ? Xn : Ae)) return;
1657
+ if (i.mode === "pan" || i.subtask === null)
1658
+ this.gesture = { kind: "pan", pointerId: i.pointerId, lastX: i.x0, lastY: i.y0 }, this.setCursor("grabbing");
1647
1659
  else {
1648
- const r = this.host.view.viewport().scale.fromPx(o.x0);
1660
+ const r = this.host.view.viewport().scale.fromPx(i.x0);
1649
1661
  this.gesture = {
1650
1662
  kind: "edit",
1651
- pointerId: o.pointerId,
1652
- mode: o.mode,
1653
- subtask: o.subtask,
1663
+ pointerId: i.pointerId,
1664
+ mode: i.mode,
1665
+ subtask: i.subtask,
1654
1666
  t0: r,
1655
- ghost: o.subtask,
1667
+ ghost: i.subtask,
1656
1668
  /* Asked here, once, and drawn from the first frame of the drag: the
1657
1669
  lanes that are closed are marked before the pointer reaches one. */
1658
- refused: o.mode === "move" ? this.askRefused(o.subtask, o.subtask.lane) : De
1659
- }, this.setCursor(o.mode === "move" ? "grabbing" : "ew-resize");
1670
+ refused: i.mode === "move" ? this.askRefused(i.subtask, i.subtask.lane) : Le
1671
+ }, this.setCursor(i.mode === "move" ? "grabbing" : "ew-resize");
1660
1672
  }
1661
1673
  }
1662
- const i = this.gesture;
1663
- if (i.kind === "pan" && i.pointerId === t.pointerId) {
1664
- const r = this.host.view.pan(i.lastX - e, i.lastY - n);
1665
- r.moved && this.host.viewMoved(r.time), this.gesture = { ...i, lastX: e, lastY: n };
1674
+ const o = this.gesture;
1675
+ if (o.kind === "pan" && o.pointerId === t.pointerId) {
1676
+ const r = this.host.view.pan(o.lastX - e, o.lastY - n);
1677
+ r.moved && this.host.viewMoved(r.time), this.gesture = { ...o, lastX: e, lastY: n };
1666
1678
  return;
1667
1679
  }
1668
- if (i.kind === "edit" && i.pointerId === t.pointerId) {
1669
- this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: e, y: n }, this.restOver(n), this.gesture = { ...i, ghost: this.heldGhost(i, e, n) }, this.setCursor(this.refused || this.blocked ? "not-allowed" : i.mode === "move" ? "grabbing" : "ew-resize"), this.host.interactionChanged(), this.autoPan();
1680
+ if (o.kind === "edit" && o.pointerId === t.pointerId) {
1681
+ this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: e, y: n }, this.restOver(n), this.gesture = { ...o, ghost: this.heldGhost(o, e, n) }, this.setCursor(this.refused || this.blocked ? "not-allowed" : o.mode === "move" ? "grabbing" : "ew-resize"), this.host.interactionChanged(), this.autoPan();
1670
1682
  return;
1671
1683
  }
1672
- i.kind === "none" && (this.byKeyboard = !1, this.hoverAt(t.clientX, t.clientY, e, n));
1684
+ o.kind === "none" && (this.byKeyboard = !1, this.hoverAt(t.clientX, t.clientY, e, n));
1673
1685
  }
1674
1686
  pointerUp(t) {
1675
- var i, r;
1676
1687
  if (t.pointerType === "touch" && (this.touches.delete(t.pointerId), this.gesture.kind === "pinch")) {
1677
- const [a] = this.touches;
1678
- this.touches.size === 1 && a !== void 0 ? this.gesture = { kind: "pan", pointerId: a[0], lastX: a[1].x, lastY: a[1].y } : this.touches.size === 0 && (this.gesture = { kind: "none" });
1688
+ const [o] = this.touches;
1689
+ this.touches.size === 1 && o !== void 0 ? this.gesture = { kind: "pan", pointerId: o[0], lastX: o[1].x, lastY: o[1].y } : this.touches.size === 0 && (this.gesture = { kind: "none" });
1679
1690
  return;
1680
1691
  }
1681
- const e = this.gesture, { x: n, y: o } = this.local(t.clientX, t.clientY);
1692
+ const e = this.gesture, { x: n, y: i } = this.local(t.clientX, t.clientY);
1682
1693
  if (e.kind === "pending" && e.pointerId === t.pointerId)
1683
- this.gesture = { kind: "none" }, this.click(t.clientX, t.clientY, n, o);
1694
+ this.gesture = { kind: "none" }, this.click(t.clientX, t.clientY, n, i);
1684
1695
  else if (e.kind === "pan" && e.pointerId === t.pointerId)
1685
- this.gesture = { kind: "none" }, this.setCursor("default"), this.hoverAt(t.clientX, t.clientY, n, o);
1696
+ this.gesture = { kind: "none" }, this.setCursor("default"), this.hoverAt(t.clientX, t.clientY, n, i);
1686
1697
  else if (e.kind === "edit" && e.pointerId === t.pointerId) {
1687
1698
  this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" };
1688
- const a = e.ghost.lane === e.subtask.lane || this.allowed(e.subtask, e.ghost.lane), l = this.intentsOf(e.subtask, e.ghost, e.mode).filter(
1689
- (h) => a || h.kind !== "lane"
1699
+ const o = e.ghost.lane === e.subtask.lane || this.allowed(e.subtask, e.ghost.lane), r = this.intentsOf(e.subtask, e.ghost, e.mode).filter(
1700
+ (a) => o || a.kind !== "lane"
1690
1701
  );
1691
1702
  this.refused = !1, this.blocked = !1, this.cursor = "default", this.host.interactionChanged();
1692
- for (const h of l) (r = (i = this.host.handlers()).onIntent) == null || r.call(i, h);
1703
+ for (const a of r) this.host.handlers().onIntent?.(a);
1693
1704
  }
1694
1705
  }
1695
1706
  /** While a drag is in flight near an edge, pans along once per frame and
@@ -1701,15 +1712,15 @@ class no {
1701
1712
  this.panFrame = 0;
1702
1713
  const e = this.gesture;
1703
1714
  if (e.kind !== "edit" && e.kind !== "place") return;
1704
- const n = this.host.view, { x: o, y: i } = this.local(this.lastClient.x, this.lastClient.y), r = Ae(o, n.width), a = Ae(i, n.height);
1715
+ const n = this.host.view, { x: i, y: o } = this.local(this.lastClient.x, this.lastClient.y), r = Ie(i, n.width), a = Ie(o, n.height);
1705
1716
  if (r === 0 && a === 0) return;
1706
1717
  const l = n.pan(r, a);
1707
1718
  if (l.moved) {
1708
- if (this.dragPoint = { x: o, y: i }, e.kind === "edit")
1709
- this.gesture = { ...e, ghost: this.heldGhost(e, o, i) };
1719
+ if (this.dragPoint = { x: i, y: o }, e.kind === "edit")
1720
+ this.gesture = { ...e, ghost: this.heldGhost(e, i, o) };
1710
1721
  else {
1711
- const h = this.placeGhost(e.item, o, i, e.refused);
1712
- this.refused = h.refused, this.blocked = h.blocked, this.gesture = { ...e, ghost: h.ghost ?? e.ghost };
1722
+ const d = this.placeGhost(e.item, i, o, e.refused);
1723
+ this.refused = d.refused, this.blocked = d.blocked, this.gesture = { ...e, ghost: d.ghost ?? e.ghost };
1713
1724
  }
1714
1725
  this.host.viewMoved(l.time), this.panFrame = requestAnimationFrame(t);
1715
1726
  }
@@ -1729,7 +1740,7 @@ class no {
1729
1740
  refreshHover() {
1730
1741
  if (!this.idle || this.hoverKey === "nothing" || this.byKeyboard) return;
1731
1742
  const { x: t, y: e } = this.hoverPoint, n = this.host.view.hitAt(t, e);
1732
- this.hover = n, this.hoverKey = Ot(n);
1743
+ this.hover = n, this.hoverKey = Ct(n);
1733
1744
  }
1734
1745
  pointerLeave() {
1735
1746
  this.gesture.kind !== "none" || this.byKeyboard || this.setHover({ kind: "nothing" }, "nothing");
@@ -1745,22 +1756,22 @@ class no {
1745
1756
  const { x: e, y: n } = this.local(t.clientX, t.clientY);
1746
1757
  this.report("contextmenu", this.host.view.hitAt(e, n), t.clientX, t.clientY, e, n);
1747
1758
  }
1748
- /** The wheel, as every scrolling area has it (schedule-refinement 02):
1759
+ /** The wheel, as every scrolling area has it:
1749
1760
  vertical scrolls the lanes, and lets the page scroll on once they are at
1750
1761
  their end; Ctrl or ⌘ zooms - a trackpad pinch arrives as a wheel with
1751
1762
  Ctrl -; horizontal or Shift pans through time. */
1752
1763
  wheel(t) {
1753
- const e = this.host.view, n = Math.max(0, Math.min(e.width, this.local(t.clientX, t.clientY).x)), o = t.deltaMode === 1 ? 16 : t.deltaMode === 2 ? e.height : 1, i = t.deltaX * o, r = t.deltaY * o;
1764
+ const e = this.host.view, n = Math.max(0, Math.min(e.width, this.local(t.clientX, t.clientY).x)), i = t.deltaMode === 1 ? 16 : t.deltaMode === 2 ? e.height : 1, o = t.deltaX * i, r = t.deltaY * i;
1754
1765
  if (t.ctrlKey || t.metaKey) {
1755
1766
  t.preventDefault();
1756
- const h = Math.abs(r) < 50 ? 0.01 : 15e-4;
1757
- e.zoomAt(n, Math.exp(r * h)) && this.host.viewMoved(!0);
1767
+ const d = Math.abs(r) < 50 ? 0.01 : 15e-4;
1768
+ e.zoomAt(n, Math.exp(r * d)) && this.host.viewMoved(!0);
1758
1769
  return;
1759
1770
  }
1760
- if (Math.abs(i) > Math.abs(r) || t.shiftKey) {
1771
+ if (Math.abs(o) > Math.abs(r) || t.shiftKey) {
1761
1772
  t.preventDefault();
1762
- const h = e.pan(t.shiftKey && i === 0 ? r : i, 0);
1763
- h.moved && this.host.viewMoved(h.time);
1773
+ const d = e.pan(t.shiftKey && o === 0 ? r : o, 0);
1774
+ d.moved && this.host.viewMoved(d.time);
1764
1775
  return;
1765
1776
  }
1766
1777
  const a = r > 0 ? e.maxScroll() - e.scrollY : e.scrollY;
@@ -1769,26 +1780,26 @@ class no {
1769
1780
  const l = e.pan(0, r);
1770
1781
  l.moved && this.host.viewMoved(l.time);
1771
1782
  }
1772
- click(t, e, n, o) {
1773
- const i = this.host.view.hitAt(n, o), r = i.kind === "subtask" ? i.subtask.task : i.kind === "dependency" ? this.host.data.taskOfDependency(i.dependency) : null;
1774
- this.host.select(r, i.kind === "subtask" ? i.subtask.id : null), this.report("click", i, t, e, n, o);
1783
+ click(t, e, n, i) {
1784
+ const o = this.host.view.hitAt(n, i), r = o.kind === "subtask" ? o.subtask.task : o.kind === "dependency" ? this.host.data.taskOfDependency(o.dependency) : null;
1785
+ this.host.select(r, o.kind === "subtask" ? o.subtask.id : null), this.report("click", o, t, e, n, i);
1775
1786
  }
1776
- hoverAt(t, e, n, o) {
1777
- const i = this.host.view.hitAt(n, o), r = Ot(i), { mode: a } = this.modeAt(n, o);
1778
- if (this.setCursor(a === "move" ? "grab" : a === "stretch-from" || a === "stretch-to" ? "ew-resize" : "default"), this.hoverPoint = { x: n, y: o }, r === this.hoverKey) {
1779
- (i.kind === "subtask" || i.kind === "dependency" || i.kind === "milestone") && this.host.interactionChanged();
1787
+ hoverAt(t, e, n, i) {
1788
+ const o = this.host.view.hitAt(n, i), r = Ct(o), { mode: a } = this.modeAt(n, i);
1789
+ if (this.setCursor(a === "move" ? "grab" : a === "stretch-from" || a === "stretch-to" ? "ew-resize" : "default"), this.hoverPoint = { x: n, y: i }, r === this.hoverKey) {
1790
+ (o.kind === "subtask" || o.kind === "dependency" || o.kind === "milestone") && this.host.hoverChanged();
1780
1791
  return;
1781
1792
  }
1782
- this.setHover(i, r), this.report("hover", i, t, e, n, o);
1793
+ this.setHover(o, r), this.report("hover", o, t, e, n, i);
1783
1794
  }
1784
1795
  /** The keyboard sets the hover: drawn, and its tooltip shown, as the
1785
1796
  pointer's would be - and reported to nobody, since `onInteraction`
1786
1797
  speaks of pointer positions. `nothing` hands the hover back. */
1787
1798
  setKeyboardHover(t, e) {
1788
- this.byKeyboard = t.kind !== "nothing", this.hoverPoint = e, this.hover = t, this.hoverKey = Ot(t), this.host.interactionChanged();
1799
+ this.byKeyboard = t.kind !== "nothing", this.hoverPoint = e, this.hover = t, this.hoverKey = Ct(t), this.host.interactionChanged();
1789
1800
  }
1790
1801
  setHover(t, e) {
1791
- e !== this.hoverKey && (this.hoverKey = e, this.hover = t, this.host.interactionChanged());
1802
+ e !== this.hoverKey && (this.hoverKey = e, this.hover = t, this.host.hoverChanged());
1792
1803
  }
1793
1804
  setCursor(t) {
1794
1805
  t !== this.cursor && (this.cursor = t, this.host.interactionChanged());
@@ -1810,45 +1821,45 @@ class no {
1810
1821
  dragOver(t, e) {
1811
1822
  const n = this.host.view;
1812
1823
  if (e === null || !n.options.intents.includes("place")) return;
1813
- const { x: o, y: i } = this.local(t.clientX, t.clientY);
1814
- if (n.laneIdAt(i) === null && n.foldedGroupAt(i) === null) {
1824
+ const { x: i, y: o } = this.local(t.clientX, t.clientY);
1825
+ if (n.laneIdAt(o) === null && n.foldedGroupAt(o) === null) {
1815
1826
  this.clearPlacing();
1816
1827
  return;
1817
1828
  }
1818
- t.preventDefault(), this.restOver(i);
1829
+ t.preventDefault(), this.restOver(o);
1819
1830
  const r = this.gesture.kind === "place" ? this.gesture.refused : (
1820
1831
  /* Work dragged in sits on no lane until it is dropped. Where the
1821
1832
  pointer is not over one either, the rule is asked about an item
1822
1833
  whose own lane is empty - which is the truth of it: `canMoveTo`
1823
1834
  is asked ABOUT a lane, and the one this item is on is none. */
1824
- this.askRefused(this.askedFor(e, this.onLane(i) ?? "", o), null)
1825
- ), a = this.placeGhost(e, o, i, r);
1835
+ this.askRefused(this.askedFor(e, this.onLane(o) ?? "", i), null)
1836
+ ), a = this.placeGhost(e, i, o, r);
1826
1837
  this.refused = a.refused, this.blocked = a.blocked, this.setCursor(a.refused || a.blocked ? "not-allowed" : "default");
1827
- const l = this.gesture.kind === "place" ? this.gesture.ghost : null, h = a.ghost ?? (a.refused || a.blocked ? l : null);
1828
- t.dataTransfer !== null && (t.dataTransfer.dropEffect = h === null ? "none" : "copy"), h !== null && (this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: o, y: i }, this.gesture = { kind: "place", ghost: h, item: e, refused: r }, this.host.interactionChanged(), this.autoPan());
1838
+ const l = this.gesture.kind === "place" ? this.gesture.ghost : null, d = a.ghost ?? (a.refused || a.blocked ? l : null);
1839
+ t.dataTransfer !== null && (t.dataTransfer.dropEffect = d === null ? "none" : "copy"), d !== null && (this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: i, y: o }, this.gesture = { kind: "place", ghost: d, item: e, refused: r }, this.host.interactionChanged(), this.autoPan());
1829
1840
  }
1830
1841
  /** The ghost of a drag from outside at a point on the plot: none off the
1831
1842
  lanes, none where the caller refuses that lane and none where it would
1832
1843
  cover blocked time - which the answer says apart, because they mean
1833
1844
  different things to the drag. */
1834
- placeGhost(t, e, n, o) {
1835
- const i = this.onLane(n);
1836
- if (i === null) return { ghost: null, refused: !1, blocked: !1 };
1837
- if (o.has(i)) return { ghost: null, refused: !0, blocked: !1 };
1838
- const r = { ...this.askedFor(t, i, e), id: Ce };
1839
- return dt(r, null, this.host.data.blocked) ? { ghost: null, refused: !1, blocked: !0 } : { ghost: r, refused: !1, blocked: !1 };
1845
+ placeGhost(t, e, n, i) {
1846
+ const o = this.onLane(n);
1847
+ if (o === null) return { ghost: null, refused: !1, blocked: !1 };
1848
+ if (i.has(o)) return { ghost: null, refused: !0, blocked: !1 };
1849
+ const r = { ...this.askedFor(t, o, e), id: Se };
1850
+ return ot(r, null, this.host.data.blocked) ? { ghost: null, refused: !1, blocked: !0 } : { ghost: r, refused: !1, blocked: !1 };
1840
1851
  }
1841
1852
  /** The dragged item as a subtask, under the caller's key for it - not the
1842
1853
  internal sentinel: the rule is asked about the thing the application says
1843
1854
  it is dragging, and the ghost only afterwards takes the sentinel. */
1844
1855
  askedFor(t, e, n) {
1845
- const o = this.snapInside(this.host.view.timeAt(n), this.snapStep());
1856
+ const i = this.snapInside(this.host.view.timeAt(n), this.snapStep());
1846
1857
  return {
1847
1858
  id: t.item,
1848
1859
  task: t.task,
1849
1860
  lane: e,
1850
- from: o,
1851
- to: o + t.duration,
1861
+ from: i,
1862
+ to: i + t.duration,
1852
1863
  ...t.leadIn === void 0 ? {} : { leadIn: t.leadIn },
1853
1864
  ...t.leadOut === void 0 ? {} : { leadOut: t.leadOut }
1854
1865
  };
@@ -1856,15 +1867,14 @@ class no {
1856
1867
  /** The drop: the place intent, and the ghost goes. Off every lane, or with
1857
1868
  nothing declared, nothing is reported. */
1858
1869
  drop(t) {
1859
- var r, a;
1860
1870
  const e = this.gesture;
1861
1871
  if (e.kind !== "place") return;
1862
1872
  t.preventDefault();
1863
- const { ghost: n, item: o } = e;
1864
- if (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.blocked = !1, this.cursor = "default", this.host.interactionChanged(), !this.allowed({ ...n, id: o.item }, n.lane)) return;
1865
- const i = {
1873
+ const { ghost: n, item: i } = e;
1874
+ if (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.blocked = !1, this.cursor = "default", this.host.interactionChanged(), !this.allowed({ ...n, id: i.item }, n.lane)) return;
1875
+ const o = {
1866
1876
  kind: "place",
1867
- item: o.item,
1877
+ item: i.item,
1868
1878
  task: n.task,
1869
1879
  lane: n.lane,
1870
1880
  from: n.from,
@@ -1872,7 +1882,7 @@ class no {
1872
1882
  ...n.leadIn === void 0 ? {} : { leadIn: n.leadIn },
1873
1883
  ...n.leadOut === void 0 ? {} : { leadOut: n.leadOut }
1874
1884
  };
1875
- (a = (r = this.host.handlers()).onIntent) == null || a.call(r, i);
1885
+ this.host.handlers().onIntent?.(o);
1876
1886
  }
1877
1887
  /** The drag left the plot, or the application stopped dragging - which is
1878
1888
  also how Escape arrives: the browser ends its own drag and sends a leave
@@ -1893,51 +1903,51 @@ class no {
1893
1903
  it last stood. It is held, not clamped: a pointer carried on past the
1894
1904
  blocked time takes the ghost along again. */
1895
1905
  heldGhost(t, e, n) {
1896
- const o = this.ghostFor(t, e, n);
1897
- return this.blocked = dt(o, t.subtask, this.host.data.blocked), this.blocked ? t.ghost : o;
1906
+ const i = this.ghostFor(t, e, n);
1907
+ return this.blocked = ot(i, t.subtask, this.host.data.blocked), this.blocked ? t.ghost : i;
1898
1908
  }
1899
1909
  ghostFor(t, e, n) {
1900
- const o = this.host.view, i = t.subtask, r = this.snapStep(), a = o.options.intents, l = this.snapInside(o.timeAt(e), r);
1910
+ const i = this.host.view, o = t.subtask, r = this.snapStep(), a = i.options.intents, l = this.snapInside(i.timeAt(e), r);
1901
1911
  switch (t.mode) {
1902
1912
  case "move": {
1903
- let h = i.from;
1904
- const d = o.viewport().scale, c = d.fromPx(e) - t.t0;
1905
- a.includes("move") && Math.abs(c * d.m) >= _e && (h = this.shifted(i.from, c, r));
1906
- let m = t.ghost.lane;
1913
+ let d = o.from;
1914
+ const h = i.viewport().scale, c = h.fromPx(e) - t.t0;
1915
+ a.includes("move") && Math.abs(c * h.m) >= Ae && (d = this.shifted(o.from, c, r));
1916
+ let f = t.ghost.lane;
1907
1917
  if (a.includes("lane")) {
1908
- const p = this.onLane(n) ?? m;
1909
- this.refused = t.refused.has(p), this.refused || (m = p);
1918
+ const g = this.onLane(n) ?? f;
1919
+ this.refused = t.refused.has(g), this.refused || (f = g);
1910
1920
  } else
1911
1921
  this.refused = !1;
1912
- return { ...i, from: h, to: h + (i.to - i.from), lane: m };
1922
+ return { ...o, from: d, to: d + (o.to - o.from), lane: f };
1913
1923
  }
1914
1924
  case "stretch-from":
1915
- return { ...i, from: Math.min(l, i.to - Math.max(r.step, q)) };
1925
+ return { ...o, from: Math.min(l, o.to - Math.max(r.step, X)) };
1916
1926
  case "stretch-to":
1917
- return { ...i, to: Math.max(l, i.from + Math.max(r.step, q)) };
1927
+ return { ...o, to: Math.max(l, o.from + Math.max(r.step, X)) };
1918
1928
  case "leadIn":
1919
- return { ...i, leadIn: Math.max(0, i.from - l) };
1929
+ return { ...o, leadIn: Math.max(0, o.from - l) };
1920
1930
  case "leadOut":
1921
- return { ...i, leadOut: Math.max(0, l - i.to) };
1931
+ return { ...o, leadOut: Math.max(0, l - o.to) };
1922
1932
  }
1923
1933
  }
1924
1934
  /** A time moved by an amount of WORKING time and snapped: a drag moves
1925
1935
  a start this way, and a key by one step of the raster - one arithmetic,
1926
1936
  so a key proposes exactly what a drag of that length would. */
1927
1937
  shifted(t, e, n) {
1928
- const o = nt(this.host.view.options.calendar), i = Y(t, o) + e, r = o.intervals.length === 0 ? i : j(Math.max(0, Math.min(o.total, i)), o);
1938
+ const i = ft(this.host.view.options.calendar), o = R(t, i) + e, r = rt(o, i);
1929
1939
  return this.snapInside(r, n);
1930
1940
  }
1931
1941
  /** Snapped - and, where the raster lands in time the calendar removes, moved
1932
1942
  on to the seam, where time counts again. An intent never asks for a time
1933
1943
  nobody works. */
1934
1944
  snapInside(t, e) {
1935
- const n = In(t, e), o = nt(this.host.view.options.calendar);
1936
- return o.intervals.length === 0 ? n : j(Y(n, o), o);
1945
+ const n = ps(t, e), i = ft(this.host.view.options.calendar);
1946
+ return i.intervals.length === 0 ? n : Nt(R(n, i), i);
1937
1947
  }
1938
1948
  intentsOf(t, e, n) {
1939
- const o = [], i = this.host.view.options.intents, r = t.id;
1940
- return n === "move" ? (e.from !== t.from && i.includes("move") && o.push({ kind: "move", subtask: r, from: e.from, to: e.to }), e.lane !== t.lane && i.includes("lane") && o.push({ kind: "lane", subtask: r, lane: e.lane })) : n === "stretch-from" || n === "stretch-to" ? (e.from !== t.from || e.to !== t.to) && o.push({ kind: "stretch", subtask: r, from: e.from, to: e.to }) : n === "leadIn" ? (e.leadIn ?? 0) !== (t.leadIn ?? 0) && o.push({ kind: "leadIn", subtask: r, leadIn: e.leadIn ?? 0 }) : (e.leadOut ?? 0) !== (t.leadOut ?? 0) && o.push({ kind: "leadOut", subtask: r, leadOut: e.leadOut ?? 0 }), o;
1949
+ const i = [], o = this.host.view.options.intents, r = t.id;
1950
+ return n === "move" ? (e.from !== t.from && o.includes("move") && i.push({ kind: "move", subtask: r, from: e.from, to: e.to }), e.lane !== t.lane && o.includes("lane") && i.push({ kind: "lane", subtask: r, lane: e.lane })) : n === "stretch-from" || n === "stretch-to" ? (e.from !== t.from || e.to !== t.to) && i.push({ kind: "stretch", subtask: r, from: e.from, to: e.to }) : n === "leadIn" ? (e.leadIn ?? 0) !== (t.leadIn ?? 0) && i.push({ kind: "leadIn", subtask: r, leadIn: e.leadIn ?? 0 }) : (e.leadOut ?? 0) !== (t.leadOut ?? 0) && i.push({ kind: "leadOut", subtask: r, leadOut: e.leadOut ?? 0 }), i;
1941
1951
  }
1942
1952
  /** The lane the ghost came from - the only other lane a drag can touch. */
1943
1953
  ghostHome(t) {
@@ -1953,69 +1963,68 @@ class no {
1953
1963
  keeps a plan of hundreds of tasks fluid while a drag runs, since this is
1954
1964
  computed on every pointer movement. */
1955
1965
  ghostFindings(t, e) {
1956
- const n = this.host.data, o = (d) => d.lane === t.lane || d.lane === e, r = [...n.subtasks.filter((d) => d.id !== t.id && o(d)), t], a = (d) => d.first === t.id || d.second === t.id, l = n.dependencies.filter((d) => d.from === t.id || d.to === t.id), h = t.id === Ce ? n.subtasks : n.subtasks.map((d) => d.id === t.id ? t : d);
1957
- return { overlaps: zt(r).filter(a), violated: Kt(h, l) };
1966
+ const n = this.host.data, i = (h) => h.lane === t.lane || h.lane === e, r = [...n.subtasks.filter((h) => h.id !== t.id && i(h)), t], a = (h) => h.first === t.id || h.second === t.id, l = n.dependencies.filter((h) => h.from === t.id || h.to === t.id), d = t.id === Se ? n.subtasks : n.subtasks.map((h) => h.id === t.id ? t : h);
1967
+ return { overlaps: Ht(r).filter(a), violated: Yt(d, l) };
1958
1968
  }
1959
1969
  }
1960
- function so(s, t) {
1970
+ function Jn(s, t) {
1961
1971
  const e = /* @__PURE__ */ new Map();
1962
1972
  for (const n of t) {
1963
- const o = s.slots.get(n.lane), i = o === void 0 ? null : st(s, o.top);
1964
- if (i === null) continue;
1965
- const r = s.rows.indexOf(i);
1973
+ const i = s.slots.get(n.lane), o = i === void 0 ? null : tt(s, i.top);
1974
+ if (o === null) continue;
1975
+ const r = s.rows.indexOf(o);
1966
1976
  e.set(r, [...e.get(r) ?? [], n]);
1967
1977
  }
1968
- return [...e.entries()].sort(([n], [o]) => n - o).map(([, n]) => n.sort((o, i) => o.from - i.from || o.to - i.to));
1978
+ return [...e.entries()].sort(([n], [i]) => n - i).map(([, n]) => n.sort((i, o) => i.from - o.from || i.to - o.to));
1969
1979
  }
1970
- const Fe = (s, t) => t < s.from ? s.from - t : t > s.to ? t - s.to : 0;
1971
- function oo(s, t, e, n) {
1972
- var h;
1973
- let o = -1, i = -1;
1974
- for (let d = 0; d < s.length && t !== null && o < 0; d++)
1975
- i = s[d].findIndex((c) => c.id === t), i >= 0 && (o = d);
1976
- if (o < 0) {
1980
+ const Ce = (s, t) => t < s.from ? s.from - t : t > s.to ? t - s.to : 0;
1981
+ function Zn(s, t, e, n) {
1982
+ let i = -1, o = -1;
1983
+ for (let d = 0; d < s.length && t !== null && i < 0; d++)
1984
+ o = s[d].findIndex((h) => h.id === t), o >= 0 && (i = d);
1985
+ if (i < 0) {
1977
1986
  for (const d of s) {
1978
- const c = d.find((m) => m.to > n[0] && m.from < n[1]);
1979
- if (c !== void 0) return c;
1987
+ const h = d.find((c) => c.to > n[0] && c.from < n[1]);
1988
+ if (h !== void 0) return h;
1980
1989
  }
1981
- return ((h = s[0]) == null ? void 0 : h[0]) ?? null;
1990
+ return s[0]?.[0] ?? null;
1982
1991
  }
1983
- const r = s[o], a = r[i], l = (n[1] - n[0]) / 10;
1992
+ const r = s[i], a = r[o], l = (n[1] - n[0]) / 10;
1984
1993
  switch (e) {
1985
1994
  case "next":
1986
- return r[i + 1] ?? a;
1995
+ return r[o + 1] ?? a;
1987
1996
  case "previous":
1988
- return r[i - 1] ?? a;
1997
+ return r[o - 1] ?? a;
1989
1998
  case "first":
1990
1999
  return r[0];
1991
2000
  case "last":
1992
2001
  return r[r.length - 1];
1993
2002
  case "pageNext":
1994
- return r.find((d, c) => c > i && d.from >= a.from + l) ?? r[r.length - 1];
2003
+ return r.find((d, h) => h > o && d.from >= a.from + l) ?? r[r.length - 1];
1995
2004
  case "pagePrevious":
1996
- for (let d = i - 1; d >= 0; d--) if (r[d].from <= a.from - l) return r[d];
2005
+ for (let d = o - 1; d >= 0; d--) if (r[d].from <= a.from - l) return r[d];
1997
2006
  return r[0];
1998
2007
  case "up":
1999
2008
  case "down": {
2000
- const d = s[e === "up" ? o - 1 : o + 1];
2009
+ const d = s[e === "up" ? i - 1 : i + 1];
2001
2010
  if (d === void 0) return a;
2002
- const c = (a.from + a.to) / 2;
2003
- return d.reduce((m, p) => Fe(p, c) < Fe(m, c) ? p : m);
2011
+ const h = (a.from + a.to) / 2;
2012
+ return d.reduce((c, f) => Ce(f, h) < Ce(c, h) ? f : c);
2004
2013
  }
2005
2014
  }
2006
2015
  }
2007
- function io(s, t, e, n) {
2016
+ function Qn(s, t, e, n) {
2008
2017
  if (e.kind === "milestone") return e;
2009
2018
  if (e.kind === "dependency") {
2010
- const i = s.find((a) => a.id === e.id), r = i === void 0 ? void 0 : n === "out" ? i.to : i.from;
2019
+ const o = s.find((a) => a.id === e.id), r = o === void 0 ? void 0 : n === "out" ? o.to : o.from;
2011
2020
  return r !== void 0 && t.has(r) ? { kind: "subtask", id: r } : e;
2012
2021
  }
2013
- const o = s.find(
2014
- (i) => (n === "out" ? i.from : i.to) === e.id && t.has(n === "out" ? i.to : i.from)
2022
+ const i = s.find(
2023
+ (o) => (n === "out" ? o.from : o.to) === e.id && t.has(n === "out" ? o.to : o.from)
2015
2024
  );
2016
- return o === void 0 ? e : { kind: "dependency", id: o.id };
2025
+ return i === void 0 ? e : { kind: "dependency", id: i.id };
2017
2026
  }
2018
- const pt = "\0milestone:", ro = 150, ao = {
2027
+ const ct = "\0milestone:", ti = 150, ei = {
2019
2028
  ArrowRight: "next",
2020
2029
  ArrowLeft: "previous",
2021
2030
  ArrowUp: "up",
@@ -2025,12 +2034,12 @@ const pt = "\0milestone:", ro = 150, ao = {
2025
2034
  PageDown: "pageNext",
2026
2035
  PageUp: "pagePrevious"
2027
2036
  };
2028
- class lo {
2037
+ class si {
2029
2038
  constructor(t) {
2030
- f(this, "spoken", null);
2031
- f(this, "timer", null);
2032
2039
  this.host = t;
2033
2040
  }
2041
+ spoken = null;
2042
+ timer = null;
2034
2043
  /** Where the keys stand: the hover, whoever set it. */
2035
2044
  active() {
2036
2045
  const t = this.host.gestures.hover;
@@ -2052,32 +2061,31 @@ class lo {
2052
2061
  if (t.metaKey || !e.idle) return !1;
2053
2062
  const n = t.key.toLowerCase() === "t" && !t.ctrlKey && !t.altKey;
2054
2063
  if (t.key === "]" || t.key === "[" || n) {
2055
- const i = this.active();
2056
- if (i === null) return !1;
2064
+ const o = this.active();
2065
+ if (o === null) return !1;
2057
2066
  const r = this.host.data, a = n ? !t.shiftKey : t.key === "]";
2058
- return this.show(io(r.dependencies, r.subtaskById, i, a ? "out" : "back")), !0;
2067
+ return this.show(Qn(r.dependencies, r.subtaskById, o, a ? "out" : "back")), !0;
2059
2068
  }
2060
2069
  if (t.ctrlKey) return !1;
2061
2070
  if (t.altKey) return this.edit(t);
2062
2071
  if (t.key === "Escape")
2063
2072
  return e.byKeyboard ? (this.blur(), !0) : !1;
2064
2073
  if (t.key === "Enter" || t.key === " ") return this.select();
2065
- const o = t.shiftKey ? void 0 : ao[t.key];
2066
- return o === void 0 ? !1 : (this.walk(o), !0);
2074
+ const i = t.shiftKey ? void 0 : ei[t.key];
2075
+ return i === void 0 ? !1 : (this.walk(i), !0);
2067
2076
  }
2068
2077
  walk(t) {
2069
- var h;
2070
- const { data: e, view: n } = this.host, o = this.active(), i = o === null ? null : o.kind === "subtask" ? o.id : o.kind === "milestone" ? pt + o.id : ((h = e.dependencies.find((d) => d.id === o.id)) == null ? void 0 : h.from) ?? null, r = [...e.subtasks, ...e.milestones.map((d) => ({ id: pt + d.id, lane: d.lane, from: d.at, to: d.at }))];
2071
- let a = so(n.rows, r);
2072
- if (i === null) {
2073
- const d = a.filter((c) => {
2074
- const m = J(n.viewport(), c[0].lane);
2075
- return m !== null && m.top + m.height > 0 && m.top < n.height;
2078
+ const { data: e, view: n } = this.host, i = this.active(), o = i === null ? null : i.kind === "subtask" ? i.id : i.kind === "milestone" ? ct + i.id : e.dependencies.find((d) => d.id === i.id)?.from ?? null, r = [...e.subtasks, ...e.milestones.map((d) => ({ id: ct + d.id, lane: d.lane, from: d.at, to: d.at }))];
2079
+ let a = Jn(n.rows, r);
2080
+ if (o === null) {
2081
+ const d = a.filter((h) => {
2082
+ const c = q(n.viewport(), h[0].lane);
2083
+ return c !== null && c.top + c.height > 0 && c.top < n.height;
2076
2084
  });
2077
2085
  d.length > 0 && (a = d);
2078
2086
  }
2079
- const l = oo(a, i, t, this.host.visibleDomain());
2080
- l !== null && this.show(l.id.startsWith(pt) ? { kind: "milestone", id: l.id.slice(pt.length) } : { kind: "subtask", id: l.id });
2087
+ const l = Zn(a, o, t, this.host.visibleDomain());
2088
+ l !== null && this.show(l.id.startsWith(ct) ? { kind: "milestone", id: l.id.slice(ct.length) } : { kind: "subtask", id: l.id });
2081
2089
  }
2082
2090
  /** Space and Enter select as a click does: the whole task, and the subtask. */
2083
2091
  select() {
@@ -2091,50 +2099,49 @@ class lo {
2091
2099
  end - the intents a drag of that length reports (ADR-0023), and only
2092
2100
  where the caller handles them. Nothing is applied here. */
2093
2101
  edit(t) {
2094
- var c, m;
2095
2102
  const e = this.host.gestures.hover, n = t.key === "ArrowRight" ? 1 : t.key === "ArrowLeft" ? -1 : 0;
2096
2103
  if (n === 0) return !1;
2097
2104
  if (e.kind !== "subtask") return !0;
2098
- const o = e.subtask, i = this.host.gestures, r = this.host.view.options.intents, a = i.snapStep(), l = a.step > 0 ? a : { step: this.host.view.step(), offset: 0 }, h = this.host.data.blocked;
2099
- let d = null;
2105
+ const i = e.subtask, o = this.host.gestures, r = this.host.view.options.intents, a = o.snapStep(), l = a.step > 0 ? a : { step: this.host.view.step(), offset: 0 }, d = this.host.data.blocked;
2106
+ let h = null;
2100
2107
  if (!t.shiftKey && r.includes("move")) {
2101
- const p = (I) => ({ ...o, from: I, to: I + (o.to - o.from) });
2102
- let y = o.from;
2103
- for (let I = 0; I < 1e3; I++) {
2104
- const A = i.shifted(y, n * l.step, l);
2105
- if (A === y || (y = A, !dt(p(y), o, h))) break;
2108
+ const c = (g) => ({ ...i, from: g, to: g + (i.to - i.from) });
2109
+ let f = i.from;
2110
+ for (let g = 0; g < 1e3; g++) {
2111
+ const v = o.shifted(f, n * l.step, l);
2112
+ if (v === f || (f = v, !ot(c(f), i, d))) break;
2106
2113
  }
2107
- y !== o.from && !dt(p(y), o, h) && (d = { kind: "move", subtask: o.id, from: y, to: p(y).to });
2114
+ f !== i.from && !ot(c(f), i, d) && (h = { kind: "move", subtask: i.id, from: f, to: c(f).to });
2108
2115
  } else if (t.shiftKey && r.includes("stretch")) {
2109
- const p = Math.max(i.shifted(o.to, n * l.step, l), o.from + Math.max(l.step, q));
2110
- p !== o.to && !dt({ ...o, to: p }, o, h) && (d = { kind: "stretch", subtask: o.id, from: o.from, to: p });
2116
+ const c = Math.max(o.shifted(i.to, n * l.step, l), i.from + Math.max(l.step, X));
2117
+ c !== i.to && !ot({ ...i, to: c }, i, d) && (h = { kind: "stretch", subtask: i.id, from: i.from, to: c });
2111
2118
  }
2112
- return i.byKeyboard = !0, d !== null && ((m = (c = this.host.handlers()).onIntent) == null || m.call(c, d)), this.scheduleReadout(), !0;
2119
+ return o.byKeyboard = !0, h !== null && this.host.handlers().onIntent?.(h), this.scheduleReadout(), !0;
2113
2120
  }
2114
2121
  /** The keys stand on this target: brought into view, drawn as the hover. */
2115
2122
  show(t, e = !0) {
2116
2123
  const n = this.hitOf(t);
2117
2124
  if (n === null) return;
2118
2125
  e && this.reveal(t);
2119
- const o = this.bounds(t);
2120
- if (o === null) return;
2121
- const { view: i } = this.host, r = (a, l) => Math.max(0, Math.min(l, a));
2126
+ const i = this.bounds(t);
2127
+ if (i === null) return;
2128
+ const { view: o } = this.host, r = (a, l) => Math.max(0, Math.min(l, a));
2122
2129
  this.host.gestures.setKeyboardHover(n, {
2123
- x: (r(o.x0, i.width) + r(o.x1, i.width)) / 2,
2124
- y: (r(o.y0, i.height) + r(o.y1, i.height)) / 2
2130
+ x: (r(i.x0, o.width) + r(i.x1, o.width)) / 2,
2131
+ y: (r(i.y0, o.height) + r(i.y1, o.height)) / 2
2125
2132
  }), e && this.scheduleReadout();
2126
2133
  }
2127
2134
  hitOf(t) {
2128
2135
  const e = this.host.data;
2129
2136
  if (t.kind === "subtask") {
2130
- const o = e.subtaskById.get(t.id);
2131
- return o === void 0 ? null : { kind: "subtask", subtask: o, part: "main" };
2137
+ const i = e.subtaskById.get(t.id);
2138
+ return i === void 0 ? null : { kind: "subtask", subtask: i, part: "main" };
2132
2139
  }
2133
2140
  if (t.kind === "milestone") {
2134
- const o = e.milestones.find((i) => i.id === t.id);
2135
- return o === void 0 ? null : { kind: "milestone", milestone: o };
2141
+ const i = e.milestones.find((o) => o.id === t.id);
2142
+ return i === void 0 ? null : { kind: "milestone", milestone: i };
2136
2143
  }
2137
- const n = e.dependencies.find((o) => o.id === t.id);
2144
+ const n = e.dependencies.find((i) => i.id === t.id);
2138
2145
  return n === void 0 ? null : { kind: "dependency", dependency: n };
2139
2146
  }
2140
2147
  /** Where a target lies on the plot: a subtask's bar, or the span between
@@ -2146,15 +2153,15 @@ class lo {
2146
2153
  return a === void 0 ? null : { x0: a.outerFrom, x1: a.outerTo, y0: a.y, y1: a.y + a.height };
2147
2154
  }
2148
2155
  if (t.kind === "milestone") {
2149
- const a = this.host.data.milestones.find((h) => h.id === t.id), l = a === void 0 ? null : Ut(e.viewport(), a);
2156
+ const a = this.host.data.milestones.find((d) => d.id === t.id), l = a === void 0 ? null : Wt(e.viewport(), a);
2150
2157
  return l === null ? null : { x0: l.x - l.half, x1: l.x + l.half, y0: l.y - l.half, y1: l.y + l.half };
2151
2158
  }
2152
- const o = this.host.data.dependencies.find((a) => a.id === t.id), i = o === void 0 ? void 0 : n(o.from), r = o === void 0 ? void 0 : n(o.to);
2153
- return i === void 0 || r === void 0 ? null : {
2154
- x0: Math.min(i.mainTo, r.mainFrom),
2155
- x1: Math.max(i.mainTo, r.mainFrom),
2156
- y0: Math.min(i.y, r.y),
2157
- y1: Math.max(i.y + i.height, r.y + r.height)
2159
+ const i = this.host.data.dependencies.find((a) => a.id === t.id), o = i === void 0 ? void 0 : n(i.from), r = i === void 0 ? void 0 : n(i.to);
2160
+ return o === void 0 || r === void 0 ? null : {
2161
+ x0: Math.min(o.mainTo, r.mainFrom),
2162
+ x1: Math.max(o.mainTo, r.mainFrom),
2163
+ y0: Math.min(o.y, r.y),
2164
+ y1: Math.max(o.y + o.height, r.y + r.height)
2158
2165
  };
2159
2166
  }
2160
2167
  /** Pans and scrolls just enough to bring a target into view, with a margin
@@ -2163,9 +2170,9 @@ class lo {
2163
2170
  reveal(t) {
2164
2171
  const e = this.bounds(t), n = this.host.view;
2165
2172
  if (e === null || n.width <= 0) return;
2166
- const o = Math.min(24, n.width / 10), i = e.x0 < 0 ? e.x0 - o : e.x1 > n.width ? Math.max(0, Math.min(e.x1 - n.width + o, e.x0 - o)) : 0, r = e.y0 < 0 ? e.y0 : e.y1 > n.height ? Math.min(e.y1 - n.height, e.y0) : 0;
2167
- if (i === 0 && r === 0) return;
2168
- const a = n.pan(i, r);
2173
+ const i = Math.min(24, n.width / 10), o = e.x0 < 0 ? e.x0 - i : e.x1 > n.width ? Math.max(0, Math.min(e.x1 - n.width + i, e.x0 - i)) : 0, r = e.y0 < 0 ? e.y0 : e.y1 > n.height ? Math.min(e.y1 - n.height, e.y0) : 0;
2174
+ if (o === 0 && r === 0) return;
2175
+ const a = n.pan(o, r);
2169
2176
  a.moved && this.host.viewMoved(a.time);
2170
2177
  }
2171
2178
  /** After the data or the view changed: the keys' target is read anew by its
@@ -2178,38 +2185,36 @@ class lo {
2178
2185
  the hover: a pointer that took it over in the pause is not spoken for. */
2179
2186
  scheduleReadout() {
2180
2187
  this.timer !== null && clearTimeout(this.timer), this.timer = setTimeout(() => {
2181
- var n;
2182
2188
  this.timer = null;
2183
2189
  const t = this.host.gestures.hover;
2184
2190
  if (!this.host.gestures.byKeyboard) return;
2185
2191
  const e = this.host.data.tooltipTargetFor(t);
2186
- e !== null && (this.spoken = { target: e, lane: t.kind === "subtask" ? t.subtask.lane : t.kind === "milestone" ? t.milestone.lane : null, count: (((n = this.spoken) == null ? void 0 : n.count) ?? 0) + 1 }, this.host.spokenChanged());
2187
- }, ro);
2192
+ e !== null && (this.spoken = { target: e, lane: t.kind === "subtask" ? t.subtask.lane : t.kind === "milestone" ? t.milestone.lane : null, count: (this.spoken?.count ?? 0) + 1 }, this.host.spokenChanged());
2193
+ }, ti);
2188
2194
  }
2189
2195
  /** Unmount: no readout after it. */
2190
2196
  stop() {
2191
2197
  this.timer !== null && clearTimeout(this.timer), this.timer = null;
2192
2198
  }
2193
2199
  }
2194
- const tt = (s) => JSON.stringify([s.domain ?? null, [...s.folded ?? []].sort()]);
2195
- function ho(s, t) {
2200
+ const Q = (s) => JSON.stringify([s.domain ?? null, [...s.folded ?? []].sort()]);
2201
+ function ni(s, t) {
2196
2202
  if (t.size === 0 || s.folded === void 0) return s;
2197
2203
  const e = s.folded.filter((n) => t.has(n));
2198
2204
  return e.length === s.folded.length ? s : { ...s.domain ? { domain: s.domain } : {}, ...e.length ? { folded: e } : {} };
2199
2205
  }
2200
- function co(s, t, e = (n) => n) {
2206
+ function ii(s, t, e = (n) => n) {
2201
2207
  if (s.length === 0) return null;
2202
- let n = 1 / 0, o = -1 / 0;
2208
+ let n = 1 / 0, i = -1 / 0;
2203
2209
  for (const a of s)
2204
- n = Math.min(n, a.from - (a.leadIn ?? 0)), o = Math.max(o, a.to + (a.leadOut ?? 0));
2205
- n = e(n), o = e(o);
2206
- const i = Math.min(t.max, Math.max(t.min, o - n)), r = (n + o) / 2;
2207
- return [r - i / 2, r + i / 2];
2210
+ n = Math.min(n, a.from - (a.leadIn ?? 0)), i = Math.max(i, a.to + (a.leadOut ?? 0));
2211
+ n = e(n), i = e(i);
2212
+ const o = Math.min(t.max, Math.max(t.min, i - n)), r = (n + i) / 2;
2213
+ return [r - o / 2, r + o / 2];
2208
2214
  }
2209
- const Oe = {
2215
+ const De = {
2210
2216
  width: 0,
2211
2217
  height: 0,
2212
- laneHeight: gt,
2213
2218
  scrollY: 0,
2214
2219
  headers: [],
2215
2220
  days: [],
@@ -2224,103 +2229,53 @@ const Oe = {
2224
2229
  spoken: null,
2225
2230
  summary: { lanes: 0, subtasks: 0, from: 0, to: 0, overlaps: 0, violated: 0, blocked: 0, milestones: 0 }
2226
2231
  };
2227
- class uo {
2232
+ class oi {
2233
+ data = new In(() => this.viewChanged());
2234
+ view = new Rs(this.data);
2235
+ gestures;
2236
+ keys;
2237
+ handlersNow = {};
2238
+ placing = null;
2239
+ controlledTask = void 0;
2240
+ ownTask = null;
2241
+ selected = null;
2242
+ /** Which **Lane group**s are folded. Folding changes the view and not the
2243
+ plan, so it is no **Intent** (ADR-0025). */
2244
+ folded;
2245
+ /** The span the view names, in wall-clock time - null while it names none
2246
+ and the schedule shows the subtasks' extent. */
2247
+ domainInView;
2248
+ /** Whether the extent has been put in view since the view stopped naming a
2249
+ span. Once, and not after every change of the data: a bar the planner
2250
+ dragged past the end must not make the whole plan jump. */
2251
+ fitted = !1;
2252
+ /** The view as `useSchedule` reads it - a new object only when its content
2253
+ changed. */
2254
+ viewNow;
2255
+ viewListeners = /* @__PURE__ */ new Set();
2256
+ /** Whether the planner, a setter or `setView` has changed the view
2257
+ yet. Until then a change is the start losing the groups no LaneGroup
2258
+ declares - where the schedule starts, not a change to report. */
2259
+ actedOn = !1;
2260
+ get acted() {
2261
+ return this.actedOn;
2262
+ }
2263
+ root = null;
2264
+ plot = null;
2265
+ dataCanvas = null;
2266
+ overlayCanvas = null;
2267
+ colours = null;
2268
+ frame = 0;
2269
+ /** Whether the data canvas is out of date; a hover alone leaves it be. */
2270
+ dataStale = !0;
2271
+ /** A pan or zoom whose consequences wait for the frame. */
2272
+ movePending = !1;
2273
+ domainFrame = 0;
2274
+ unsubscribeTheme = null;
2275
+ snapshot = De;
2276
+ listeners = /* @__PURE__ */ new Set();
2228
2277
  constructor(t = {}) {
2229
- f(this, "data", new Fs(() => this.viewChanged()));
2230
- f(this, "view", new Wn(this.data));
2231
- f(this, "gestures");
2232
- f(this, "keys");
2233
- f(this, "handlersNow", {});
2234
- f(this, "placing", null);
2235
- f(this, "controlledTask");
2236
- f(this, "ownTask", null);
2237
- f(this, "selected", null);
2238
- /** Which **Lane group**s are folded. Folding changes the view and not the
2239
- plan, so it is no **Intent** (ADR-0025). */
2240
- f(this, "folded");
2241
- /** The span the view names, in wall-clock time - null while it names none
2242
- and the schedule shows the subtasks' extent. */
2243
- f(this, "domainInView");
2244
- /** Whether the extent has been put in view since the view stopped naming a
2245
- span. Once, and not after every change of the data: a bar the planner
2246
- dragged past the end must not make the whole plan jump. */
2247
- f(this, "fitted", !1);
2248
- /** The view as `useSchedule` reads it - a new object only when its content
2249
- changed. */
2250
- f(this, "viewNow");
2251
- f(this, "viewListeners", /* @__PURE__ */ new Set());
2252
- /** Whether the planner, a setter or a view handed in has changed the view
2253
- yet. Until then a change is the start losing the groups no LaneGroup
2254
- declares - where the schedule starts, not a change to report. */
2255
- f(this, "actedOn", !1);
2256
- f(this, "root", null);
2257
- f(this, "plot", null);
2258
- f(this, "dataCanvas", null);
2259
- f(this, "overlayCanvas", null);
2260
- f(this, "colours", null);
2261
- f(this, "frame", 0);
2262
- f(this, "domainFrame", 0);
2263
- f(this, "unsubscribeTheme", null);
2264
- f(this, "snapshot", Oe);
2265
- f(this, "listeners", /* @__PURE__ */ new Set());
2266
- /* ---------------------------------------------------------------- */
2267
- /* Registration and options */
2268
- /* ---------------------------------------------------------------- */
2269
- f(this, "registerLane", (t) => this.data.registerLane(t));
2270
- f(this, "updateLane", (t, e) => this.data.updateLane(t, e));
2271
- f(this, "unregisterLane", (t) => this.data.unregisterLane(t));
2272
- f(this, "registerGroup", (t) => this.data.registerGroup(t));
2273
- f(this, "updateGroup", (t, e) => this.data.updateGroup(t, e));
2274
- f(this, "unregisterGroup", (t) => this.data.unregisterGroup(t));
2275
- f(this, "registerLayer", (t) => this.data.registerLayer(t));
2276
- f(this, "updateLayer", (t, e) => this.data.updateLayer(t, e));
2277
- f(this, "unregisterLayer", (t) => this.data.unregisterLayer(t));
2278
- /* ---------------------------------------------------------------- */
2279
- /* The view (ADR-0047) */
2280
- /* ---------------------------------------------------------------- */
2281
- f(this, "subscribeView", (t) => (this.viewListeners.add(t), () => {
2282
- this.viewListeners.delete(t);
2283
- }));
2284
- f(this, "getView", () => this.viewNow);
2285
- /** Puts a span of two wall-clock instants in view; null shows the
2286
- subtasks' extent. */
2287
- f(this, "setDomain", (t) => {
2288
- this.domainFrame !== 0 && cancelAnimationFrame(this.domainFrame), this.domainFrame = 0, this.actedOn = !0, this.domainInView = t === null ? null : [t[0], t[1]], t === null ? this.fitted = !1 : this.view.showWall(t), this.viewChanged();
2289
- });
2290
- /** Folds or unfolds one group. */
2291
- f(this, "toggleGroup", (t) => {
2292
- const e = this.viewNow.folded ?? [];
2293
- this.actedOn = !0, this.folded = e.includes(t) ? e.filter((n) => n !== t) : [...e, t], this.viewChanged();
2294
- });
2295
- f(this, "foldAll", () => {
2296
- this.actedOn = !0, this.folded = this.data.groups.map((t) => t.id), this.viewChanged();
2297
- });
2298
- f(this, "unfoldAll", () => {
2299
- this.actedOn = !0, this.folded = [], this.viewChanged();
2300
- });
2301
- f(this, "subscribe", (t) => (this.listeners.add(t), () => {
2302
- this.listeners.delete(t);
2303
- }));
2304
- f(this, "getSnapshot", () => this.snapshot);
2305
- f(this, "getServerSnapshot", () => Oe);
2306
- /* ---------------------------------------------------------------- */
2307
- /* Gestures, as the component hands them in */
2308
- /* ---------------------------------------------------------------- */
2309
- f(this, "pointerDown", (t) => this.gestures.pointerDown(t));
2310
- f(this, "pointerMove", (t) => this.gestures.pointerMove(t));
2311
- f(this, "pointerUp", (t) => this.gestures.pointerUp(t));
2312
- f(this, "pointerCancel", (t) => this.gestures.pointerCancel(t));
2313
- f(this, "pointerLeave", () => this.gestures.pointerLeave());
2314
- f(this, "contextMenu", (t) => this.gestures.contextMenu(t));
2315
- f(this, "wheel", (t) => this.gestures.wheel(t));
2316
- f(this, "dragOver", (t) => this.gestures.dragOver(t, this.placing));
2317
- f(this, "drop", (t) => this.gestures.drop(t));
2318
- f(this, "dragLeave", () => this.gestures.clearPlacing());
2319
- f(this, "cancelEdit", () => this.gestures.cancelEdit());
2320
- f(this, "key", (t) => this.keys.key(t));
2321
- f(this, "focus", (t) => this.keys.focus(t));
2322
- f(this, "blur", () => this.keys.blur());
2323
- this.folded = t.folded ?? [], this.domainInView = t.domain ?? null, this.domainInView !== null && this.view.showWall(this.domainInView), this.viewNow = this.currentView(), this.gestures = new no({
2278
+ this.folded = t.folded ?? [], this.domainInView = t.domain ?? null, this.domainInView !== null && this.view.showWall(this.domainInView), this.viewNow = this.currentView(), this.gestures = new jn({
2324
2279
  data: this.data,
2325
2280
  view: this.view,
2326
2281
  plotElement: () => this.plot,
@@ -2328,26 +2283,32 @@ class uo {
2328
2283
  selectedSubtask: () => this.selected,
2329
2284
  select: (e, n) => this.select(e, n),
2330
2285
  viewChanged: () => this.viewChanged(),
2331
- viewMoved: (e) => {
2332
- this.viewChanged(), e && this.reportDomain();
2333
- },
2334
- interactionChanged: () => this.interactionChanged()
2335
- }), this.keys = new lo({
2286
+ viewMoved: (e) => this.viewMoved(e),
2287
+ interactionChanged: () => this.interactionChanged(),
2288
+ hoverChanged: () => this.hoverChanged()
2289
+ }), this.keys = new si({
2336
2290
  data: this.data,
2337
2291
  view: this.view,
2338
2292
  gestures: this.gestures,
2339
2293
  handlers: () => this.handlersNow,
2340
2294
  visibleDomain: () => this.visibleDomain(),
2341
2295
  select: (e, n) => this.select(e, n),
2342
- viewMoved: (e) => {
2343
- this.viewChanged(), e && this.reportDomain();
2344
- },
2296
+ viewMoved: (e) => this.viewMoved(e),
2345
2297
  spokenChanged: () => this.publish()
2346
2298
  });
2347
2299
  }
2348
- get acted() {
2349
- return this.actedOn;
2350
- }
2300
+ /* ---------------------------------------------------------------- */
2301
+ /* Registration and options */
2302
+ /* ---------------------------------------------------------------- */
2303
+ registerLane = (t) => this.data.registerLane(t);
2304
+ updateLane = (t, e) => this.data.updateLane(t, e);
2305
+ unregisterLane = (t) => this.data.unregisterLane(t);
2306
+ registerGroup = (t) => this.data.registerGroup(t);
2307
+ updateGroup = (t, e) => this.data.updateGroup(t, e);
2308
+ unregisterGroup = (t) => this.data.unregisterGroup(t);
2309
+ registerLayer = (t) => this.data.registerLayer(t);
2310
+ updateLayer = (t, e) => this.data.updateLayer(t, e);
2311
+ unregisterLayer = (t) => this.data.unregisterLayer(t);
2351
2312
  setOptions(t) {
2352
2313
  this.view.setOptions(t), this.viewChanged();
2353
2314
  }
@@ -2358,19 +2319,42 @@ class uo {
2358
2319
  setPlacing(t) {
2359
2320
  this.placing = t, t === null && this.gestures.clearPlacing();
2360
2321
  }
2361
- /** Goes to a view handed in; what it leaves out goes back to its default. */
2322
+ /* ---------------------------------------------------------------- */
2323
+ /* The view (ADR-0047) */
2324
+ /* ---------------------------------------------------------------- */
2325
+ subscribeView = (t) => (this.viewListeners.add(t), () => {
2326
+ this.viewListeners.delete(t);
2327
+ });
2328
+ getView = () => this.viewNow;
2329
+ /** Goes to a whole view (`setView`); what it leaves out goes back to its default. */
2362
2330
  applyView(t) {
2363
- tt(t) !== tt(this.viewNow) && (this.actedOn = !0, this.folded = t.folded ?? [], this.setDomain(t.domain ?? null));
2331
+ Q(t) !== Q(this.viewNow) && (this.actedOn = !0, this.folded = t.folded ?? [], this.setDomain(t.domain ?? null));
2364
2332
  }
2333
+ /** Puts a span of two wall-clock instants in view; null shows the
2334
+ subtasks' extent. */
2335
+ setDomain = (t) => {
2336
+ this.domainFrame !== 0 && cancelAnimationFrame(this.domainFrame), this.domainFrame = 0, this.actedOn = !0, this.domainInView = t === null ? null : [t[0], t[1]], t === null ? this.fitted = !1 : this.view.showWall(t), this.viewChanged();
2337
+ };
2338
+ /** Folds or unfolds one group. */
2339
+ toggleGroup = (t) => {
2340
+ const e = this.viewNow.folded ?? [];
2341
+ this.actedOn = !0, this.folded = e.includes(t) ? e.filter((n) => n !== t) : [...e, t], this.viewChanged();
2342
+ };
2343
+ foldAll = () => {
2344
+ this.actedOn = !0, this.folded = this.data.groups.map((t) => t.id), this.viewChanged();
2345
+ };
2346
+ unfoldAll = () => {
2347
+ this.actedOn = !0, this.folded = [], this.viewChanged();
2348
+ };
2365
2349
  currentView() {
2366
- return ho(
2350
+ return ni(
2367
2351
  { ...this.domainInView === null ? {} : { domain: this.domainInView }, ...this.folded.length > 0 ? { folded: this.folded } : {} },
2368
2352
  new Set(this.data.groups.map((t) => t.id))
2369
2353
  );
2370
2354
  }
2371
2355
  publishView() {
2372
2356
  const t = this.currentView();
2373
- if (tt(t) !== tt(this.viewNow)) {
2357
+ if (Q(t) !== Q(this.viewNow)) {
2374
2358
  this.viewNow = t;
2375
2359
  for (const e of this.viewListeners) e();
2376
2360
  }
@@ -2378,13 +2362,13 @@ class uo {
2378
2362
  /** The subtasks' extent within the zoom limits, while the view names no
2379
2363
  span - and the local day of today while there is no work to show. */
2380
2364
  fit() {
2381
- const t = this.view.options.calendar, e = co(this.data.subtasks, this.view.options.zoomLimits, (o) => Y(o, t));
2365
+ const t = this.view.options.calendar, e = ii(this.data.subtasks, this.view.options.zoomLimits, (i) => R(i, t));
2382
2366
  if (e !== null) {
2383
2367
  this.view.domain = e, this.fitted = !0;
2384
2368
  return;
2385
2369
  }
2386
2370
  const n = /* @__PURE__ */ new Date();
2387
- n.setHours(0, 0, 0, 0), this.view.showWall([n.getTime(), n.getTime() + X]);
2371
+ n.setHours(0, 0, 0, 0), this.view.showWall([n.getTime(), n.getTime() + z]);
2388
2372
  }
2389
2373
  /** `undefined`: the scene keeps the selection itself. */
2390
2374
  setControlledTask(t) {
@@ -2401,41 +2385,63 @@ class uo {
2401
2385
  return t !== void 0 && t.task === this.selectedTask ? t.id : null;
2402
2386
  }
2403
2387
  select(t, e) {
2404
- var o, i;
2405
2388
  const n = t !== this.selectedTask || e !== this.selected;
2406
- this.selected = e, t !== this.selectedTask && this.controlledTask === void 0 && (this.ownTask = t), n && ((i = (o = this.handlersNow).onSelectedTaskChange) == null || i.call(o, t, e)), this.interactionChanged();
2389
+ this.selected = e, t !== this.selectedTask && this.controlledTask === void 0 && (this.ownTask = t), n && this.handlersNow.onSelectedTaskChange?.(t, e), this.interactionChanged();
2407
2390
  }
2408
2391
  /* ---------------------------------------------------------------- */
2409
2392
  /* DOM binding */
2410
2393
  /* ---------------------------------------------------------------- */
2411
- bind(t, e, n, o) {
2412
- this.root = t, this.plot = e, this.dataCanvas = n, this.overlayCanvas = o, this.unsubscribeTheme = kn(() => {
2413
- this.colours = null, this.requestDraw();
2394
+ bind(t, e, n, i) {
2395
+ this.root = t, this.plot = e, this.dataCanvas = n, this.overlayCanvas = i, this.unsubscribeTheme = ds(() => {
2396
+ this.colours = null, this.dataStale = !0, this.requestDraw();
2414
2397
  }), this.viewChanged();
2415
2398
  }
2416
2399
  unbind() {
2417
- var t;
2418
- this.gestures.cancelEdit(), this.keys.stop(), (t = this.unsubscribeTheme) == null || t.call(this), this.unsubscribeTheme = null, this.frame !== 0 && cancelAnimationFrame(this.frame), this.domainFrame !== 0 && cancelAnimationFrame(this.domainFrame), this.frame = this.domainFrame = 0, this.root = this.plot = this.dataCanvas = this.overlayCanvas = null;
2400
+ this.gestures.cancelEdit(), this.keys.stop(), this.unsubscribeTheme?.(), this.unsubscribeTheme = null, this.frame !== 0 && cancelAnimationFrame(this.frame), this.domainFrame !== 0 && cancelAnimationFrame(this.domainFrame), this.frame = this.domainFrame = 0, this.movePending = !1, this.root = this.plot = this.dataCanvas = this.overlayCanvas = null;
2419
2401
  }
2420
2402
  resize(t, e) {
2421
- const n = Math.max(0, Math.round(t)), o = Math.max(0, Math.round(e));
2422
- n === this.view.width && o === this.view.height || (this.view.width = n, this.view.height = o, this.viewChanged());
2403
+ const n = Math.max(0, Math.round(t)), i = Math.max(0, Math.round(e));
2404
+ n === this.view.width && i === this.view.height || (this.view.width = n, this.view.height = i, this.viewChanged());
2423
2405
  }
2406
+ subscribe = (t) => (this.listeners.add(t), () => {
2407
+ this.listeners.delete(t);
2408
+ });
2409
+ getSnapshot = () => this.snapshot;
2410
+ getServerSnapshot = () => De;
2424
2411
  /* ---------------------------------------------------------------- */
2425
2412
  /* Changes */
2426
2413
  /* ---------------------------------------------------------------- */
2414
+ /** The span or the scroll moved. The layout is made when something reads
2415
+ it (`SceneView.boxes`), so a hit, a key or a report sees the current
2416
+ view; the rest of `viewChanged` - the hover and key targets, the
2417
+ snapshot, the drawing - runs once in the frame, however many events came. */
2418
+ viewMoved(t) {
2419
+ this.dataCanvas === null || typeof requestAnimationFrame != "function" ? this.viewChanged() : (this.view.invalidate(), this.movePending = !0, this.requestDraw()), t && this.reportDomain();
2420
+ }
2427
2421
  viewChanged() {
2428
- this.view.collapsed = new Set(this.folded), this.data.rebuild() && (this.colours = null, this.selected !== null && !this.data.subtaskById.has(this.selected) && (this.selected = null)), this.domainInView === null && !this.fitted && this.fit(), this.publishView(), this.view.layout(), this.gestures.refreshHover(), this.keys.refresh(), this.interactionChanged();
2422
+ this.view.collapsed = new Set(this.folded), this.data.rebuild() && (this.colours = null, this.selected !== null && !this.data.subtaskById.has(this.selected) && (this.selected = null)), this.domainInView === null && !this.fitted && this.fit(), this.view.layout(), this.moveSettled();
2423
+ }
2424
+ /** What a pan or zoom changes beyond the layout: the view's listeners, the
2425
+ hover and key targets read anew, the snapshot and the drawing. */
2426
+ moveSettled() {
2427
+ this.movePending = !1, this.publishView(), this.gestures.refreshHover(), this.keys.refresh(), this.interactionChanged();
2429
2428
  }
2430
2429
  interactionChanged() {
2431
- this.publish(), this.requestDraw();
2430
+ this.dataStale = !0, this.publish(), this.requestDraw();
2431
+ }
2432
+ /** A hover moved along its hit or on to another: the tooltip and the cursor
2433
+ are republished into the snapshot as it stands, whose headers, bars and
2434
+ summary do not depend on the pointer, and only the overlay is drawn. */
2435
+ hoverChanged() {
2436
+ this.snapshot = { ...this.snapshot, cursor: this.gestures.cursor, tooltip: this.tooltip() };
2437
+ for (const t of this.listeners) t();
2438
+ this.requestDraw();
2432
2439
  }
2433
2440
  publish() {
2434
2441
  const t = this.view, e = this.selected !== null ? t.boxById.get(this.selected) : void 0, n = [];
2435
2442
  e !== void 0 && !e.miniature && !this.gestures.editing && e.subtask.task === this.selectedTask && (t.options.intents.includes("leadIn") && n.push({ kind: "leadIn", x: e.outerFrom, y: e.y, height: e.height }), t.options.intents.includes("leadOut") && n.push({ kind: "leadOut", x: e.outerTo, y: e.y, height: e.height })), this.snapshot = {
2436
2443
  width: t.width,
2437
2444
  height: t.height,
2438
- laneHeight: t.options.laneHeight,
2439
2445
  scrollY: t.scrollY,
2440
2446
  headers: this.headers(),
2441
2447
  ...t.bands(),
@@ -2448,25 +2454,25 @@ class uo {
2448
2454
  spoken: this.keys.spoken,
2449
2455
  summary: this.summary()
2450
2456
  };
2451
- for (const o of this.listeners) o();
2457
+ for (const i of this.listeners) i();
2452
2458
  }
2453
2459
  /** One header per row, with what it says and where it sits. The scroll is
2454
2460
  not taken off here: the header column is moved as a whole, as it always
2455
2461
  was, so that a header and its row cannot drift apart by a rounding. */
2456
2462
  headers() {
2457
- const t = new Map(this.data.lanes.map((o) => [o.id, o.label])), e = new Map(this.data.groups.map((o) => [o.id, o.label])), n = new Set(this.folded);
2458
- return this.view.rows.rows.map((o) => ({
2459
- key: o.lane ?? o.group ?? "",
2460
- kind: o.kind,
2461
- lane: o.lane,
2462
- group: o.group,
2463
- label: (o.lane !== void 0 ? t.get(o.lane) : e.get(o.group ?? "")) ?? o.lane ?? o.group ?? "",
2464
- depth: o.depth,
2465
- within: o.within,
2466
- lanes: o.lanes,
2467
- collapsed: o.group === void 0 ? void 0 : n.has(o.group),
2468
- top: o.top,
2469
- height: o.height
2463
+ const t = new Map(this.data.lanes.map((i) => [i.id, i.label])), e = new Map(this.data.groups.map((i) => [i.id, i.label])), n = new Set(this.folded);
2464
+ return this.view.rows.rows.map((i) => ({
2465
+ key: i.lane ?? i.group ?? "",
2466
+ kind: i.kind,
2467
+ lane: i.lane,
2468
+ group: i.group,
2469
+ label: (i.lane !== void 0 ? t.get(i.lane) : e.get(i.group ?? "")) ?? i.lane ?? i.group ?? "",
2470
+ depth: i.depth,
2471
+ within: i.within,
2472
+ lanes: i.lanes,
2473
+ collapsed: i.group === void 0 ? void 0 : n.has(i.group),
2474
+ top: i.top,
2475
+ height: i.height
2470
2476
  }));
2471
2477
  }
2472
2478
  /** The bars a label could stand in: the visible part of every main time,
@@ -2477,15 +2483,15 @@ class uo {
2477
2483
  if (t.width <= 0) return [];
2478
2484
  const e = this.colours;
2479
2485
  return t.boxes.flatMap((n) => {
2480
- if (!Et(n, t.width, t.height)) return [];
2481
- const o = Pn(n, t.width);
2482
- if (o === null) return [];
2483
- const i = e === null ? !0 : Xt(
2484
- yt(n.subtask.appearance),
2485
- ct(e, { selectedTask: this.selectedTask, selectedSubtask: this.selectedSubtask }, n.subtask.task, n.subtask.id),
2486
+ if (!Dt(n, t.width, t.height)) return [];
2487
+ const i = Cs(n, t.width);
2488
+ if (i === null) return [];
2489
+ const o = e === null ? !0 : zt(
2490
+ pt(n.subtask.appearance),
2491
+ lt(e, { selectedTask: this.selectedTask, selectedSubtask: this.selectedSubtask }, n.subtask.task, n.subtask.id),
2486
2492
  e
2487
2493
  ).onDark;
2488
- return [{ subtask: n.subtask, ...o, dark: i }];
2494
+ return [{ subtask: n.subtask, ...i, dark: o }];
2489
2495
  });
2490
2496
  }
2491
2497
  /** The findings count the whole plan - an overlap out of view is still one
@@ -2494,7 +2500,7 @@ class uo {
2494
2500
  const t = this.view, [e, n] = this.visibleDomain();
2495
2501
  return {
2496
2502
  lanes: this.data.lanes.length,
2497
- subtasks: t.boxes.filter((o) => Et(o, t.width, t.height)).length,
2503
+ subtasks: t.boxes.filter((i) => Dt(i, t.width, t.height)).length,
2498
2504
  from: e,
2499
2505
  to: n,
2500
2506
  overlaps: this.data.overlaps.length,
@@ -2508,13 +2514,13 @@ class uo {
2508
2514
  if (!this.gestures.idle) return null;
2509
2515
  const e = this.data.tooltipTargetFor(t);
2510
2516
  if (e === null) return null;
2511
- const { x: n, y: o } = this.gestures.hoverPoint;
2512
- return { target: e, x: n, y: o };
2517
+ const { x: n, y: i } = this.gestures.hoverPoint;
2518
+ return { target: e, x: n, y: i };
2513
2519
  }
2514
2520
  /** The visible span, as two wall-clock instants. */
2515
2521
  visibleDomain() {
2516
- const t = nt(this.view.options.calendar), e = (n) => t.intervals.length === 0 ? n : j(Math.max(0, Math.min(t.total, n)), t);
2517
- return [e(this.view.domain[0]), e(this.view.domain[1])];
2522
+ const t = (e) => rt(e, this.view.options.calendar);
2523
+ return [t(this.view.domain[0]), t(this.view.domain[1])];
2518
2524
  }
2519
2525
  /** A pan or zoom of the planner's goes into the view once per frame,
2520
2526
  however many wheel steps they turn. */
@@ -2527,32 +2533,31 @@ class uo {
2527
2533
  }
2528
2534
  /** The time and the lane at a client point, or null outside the plot. */
2529
2535
  positionAt(t, e) {
2530
- var r;
2531
- const n = (r = this.plot) == null ? void 0 : r.getBoundingClientRect();
2536
+ const n = this.plot?.getBoundingClientRect();
2532
2537
  if (n === void 0) return null;
2533
- const o = t - n.left, i = e - n.top;
2534
- return o < 0 || i < 0 || o > n.width || i > n.height ? null : { time: this.view.timeAt(o), lane: this.view.laneIdAt(i) };
2538
+ const i = t - n.left, o = e - n.top;
2539
+ return i < 0 || o < 0 || i > n.width || o > n.height ? null : { time: this.view.timeAt(i), lane: this.view.laneIdAt(o) };
2535
2540
  }
2536
2541
  /** The client point of a time, on a lane's middle where one is named, or
2537
2542
  null while the schedule is not on screen. */
2538
2543
  clientPointOf(t, e) {
2539
- var a;
2540
- const n = (a = this.plot) == null ? void 0 : a.getBoundingClientRect();
2544
+ const n = this.plot?.getBoundingClientRect();
2541
2545
  if (n === void 0) return null;
2542
- const o = this.view.viewport(), i = e === void 0 ? null : J(o, e), r = i === null ? 0 : i.top + i.height / 2;
2543
- return { x: n.left + R(o, t), y: n.top + r };
2546
+ const i = this.view.viewport(), o = e === void 0 ? null : q(i, e), r = o === null ? 0 : o.top + o.height / 2;
2547
+ return { x: n.left + P(i, t), y: n.top + r };
2544
2548
  }
2545
2549
  requestDraw() {
2546
2550
  this.frame !== 0 || this.dataCanvas === null || typeof requestAnimationFrame != "function" || (this.frame = requestAnimationFrame(() => {
2547
- this.frame = 0, this.draw();
2551
+ this.movePending && this.moveSettled(), this.frame = 0, this.draw();
2548
2552
  }));
2549
2553
  }
2550
2554
  draw() {
2551
2555
  if (this.root === null) return;
2552
- this.colours === null && (this.colours = Rs(this.root, this.data), this.publish());
2553
- const { width: t, height: e } = this.view, n = Te(this.dataCanvas, t, e), o = Te(this.overlayCanvas, t, e);
2554
- if (n === null || o === null || t === 0) return;
2555
- const i = {
2556
+ this.colours === null && (this.colours = On(this.root, this.data), this.publish());
2557
+ const { width: t, height: e } = this.view, n = this.dataStale ? we(this.dataCanvas, t, e) : null, i = we(this.overlayCanvas, t, e);
2558
+ if (i === null || t === 0 || this.dataStale && n === null) return;
2559
+ this.dataStale = !1;
2560
+ const o = {
2556
2561
  data: this.data,
2557
2562
  view: this.view,
2558
2563
  colours: this.colours,
@@ -2562,50 +2567,63 @@ class uo {
2562
2567
  hover: this.gestures.hover,
2563
2568
  ghost: this.gestures.ghostDrawing()
2564
2569
  };
2565
- Ps(n, i), $s(o, i);
2566
- }
2567
- }
2568
- function Mo(s = {}) {
2569
- const { initialView: t, onViewChange: e } = s, [n] = et(() => new uo(t)), [o] = et(() => new yn()), [i] = et(() => {
2570
- const c = Re((m, p) => bn(Ts, { ...m, scene: n, ref: p }));
2571
- return c.displayName = "Schedule", {
2572
- Schedule: c,
2573
- Lane: Ss,
2574
- LaneGroup: Ls,
2575
- Subtasks: As,
2576
- Dependencies: Cs,
2577
- BlockedTimes: Ds,
2578
- Milestones: _s,
2570
+ n !== null && En(n, o), Pn(i, o);
2571
+ }
2572
+ /* ---------------------------------------------------------------- */
2573
+ /* Gestures, as the component hands them in */
2574
+ /* ---------------------------------------------------------------- */
2575
+ pointerDown = (t) => this.gestures.pointerDown(t);
2576
+ pointerMove = (t) => this.gestures.pointerMove(t);
2577
+ pointerUp = (t) => this.gestures.pointerUp(t);
2578
+ pointerCancel = (t) => this.gestures.pointerCancel(t);
2579
+ pointerLeave = () => this.gestures.pointerLeave();
2580
+ contextMenu = (t) => this.gestures.contextMenu(t);
2581
+ wheel = (t) => this.gestures.wheel(t);
2582
+ dragOver = (t) => this.gestures.dragOver(t, this.placing);
2583
+ drop = (t) => this.gestures.drop(t);
2584
+ dragLeave = () => this.gestures.clearPlacing();
2585
+ cancelEdit = () => this.gestures.cancelEdit();
2586
+ key = (t) => this.keys.key(t);
2587
+ focus = (t) => this.keys.focus(t);
2588
+ blur = () => this.keys.blur();
2589
+ }
2590
+ function mi(s = {}) {
2591
+ const { initialView: t, onViewChange: e } = s, [n] = nt(() => new oi(t)), i = Y(""), [o] = nt(() => {
2592
+ const l = (d) => cs(gn, { ...d, scene: n });
2593
+ return l.displayName = "Schedule", {
2594
+ Schedule: l,
2595
+ Lane: vn,
2596
+ LaneGroup: yn,
2597
+ Subtasks: wn,
2598
+ Dependencies: bn,
2599
+ BlockedTimes: Mn,
2600
+ Milestones: Tn,
2601
+ setView: (d) => {
2602
+ n.applyView(d), i.current = Q(n.getView());
2603
+ },
2579
2604
  setDomain: n.setDomain,
2580
2605
  toggleGroup: n.toggleGroup,
2581
2606
  foldAll: n.foldAll,
2582
2607
  unfoldAll: n.unfoldAll
2583
2608
  };
2584
- }), r = Pe(n.subscribeView, n.getView, n.getView), a = t === void 0 ? null : tt(t), l = G(a);
2585
- rt(() => {
2586
- if (t === void 0 || a === null || a === l.current) return;
2587
- l.current = a;
2588
- const c = o.has(a);
2589
- o.handed(a), c || n.applyView(t);
2590
- }, [a]);
2591
- const h = tt(r), d = G(h);
2592
- return U(() => {
2593
- d.current !== h && (d.current = h, n.acted && (o.reported(h), e == null || e(r)));
2594
- }, [h]), V(() => ({ ...i, view: r }), [i, r]);
2609
+ }), r = Oe(n.subscribeView, n.getView, n.getView), a = Q(r);
2610
+ return W(() => {
2611
+ i.current !== a && (i.current = a, n.acted && e?.(r));
2612
+ }, [a]), K(() => ({ ...o, view: r }), [o, r]);
2595
2613
  }
2596
2614
  export {
2597
- fe as applyIntent,
2598
- Yt as arrival,
2599
- Gt as departure,
2600
- vo as findings,
2601
- $e as inBlockedTime,
2602
- ot as occupied,
2603
- zt as overlaps,
2604
- yt as resolveAppearance,
2605
- wo as ripple,
2606
- bo as shiftTask,
2607
- In as snapTime,
2608
- yo as subtaskFromPlace,
2609
- Mo as useSchedule,
2610
- Kt as violatedDependencies
2615
+ he as applyIntent,
2616
+ Gt as arrival,
2617
+ $t as departure,
2618
+ ui as findings,
2619
+ Ee as inBlockedTime,
2620
+ et as occupied,
2621
+ Ht as overlaps,
2622
+ pt as resolveAppearance,
2623
+ ci as ripple,
2624
+ fi as shiftTask,
2625
+ ps as snapTime,
2626
+ hi as subtaskFromPlace,
2627
+ mi as useSchedule,
2628
+ Yt as violatedDependencies
2611
2629
  };