@umriss-ui/schedule 0.41.1 → 0.43.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,19 +1,19 @@
1
1
  "use client";
2
2
  import "./schedule.css";
3
- import { localOffset as $t, toWorkingTimeClamped as G, calendarFrom as gt, toWallClock as Gt, MINUTE as q, DAY as U, timeStep as us, workingTimeTicks as fs, HOUR as Ht, LinearScale as ms, resolveColours as ps, removedIntervals as gs, subscribeTheme as ks } from "@umriss-ui/charts";
4
- import { useContext as Re, createContext as Ne, useRef as Y, useEffect as z, useId as vs, useState as rt, useLayoutEffect as ft, useImperativeHandle as ys, useSyncExternalStore as Pe, useMemo as K, createElement as ws } from "react";
5
- import { jsxs as $, Fragment as at, jsx as m } from "react/jsx-runtime";
6
- import { useFormats as Yt, useWording as kt, AngleGlyph as bs, VisuallyHidden as fe } from "@umriss-ui/core";
7
- function st(s) {
3
+ import { localOffset as Yt, toWorkingTimeClamped as H, calendarFrom as vt, toWallClock as Kt, MINUTE as q, DAY as X, timeStep as bs, workingTimeTicks as Ms, HOUR as Vt, LinearScale as Ts, resolveColours as Ss, removedIntervals as Is, subscribeTheme as Ls } from "@umriss-ui/charts";
4
+ import { useContext as $e, createContext as Ge, useRef as V, useEffect as j, useId as As, useState as dt, useLayoutEffect as at, useImperativeHandle as Cs, useSyncExternalStore as He, useMemo as W, createElement as Ds } from "react";
5
+ import { jsxs as N, Fragment as ht, jsx as m } from "react/jsx-runtime";
6
+ import { useFormats as jt, useWording as yt, Skeleton as _s, AngleGlyph as Os, VisuallyHidden as ke, createLongPress as Fs } from "@umriss-ui/core";
7
+ function it(s) {
8
8
  return { from: s.from - (s.leadIn ?? 0), to: s.to + (s.leadOut ?? 0) };
9
9
  }
10
- function Kt(s, t) {
10
+ function Wt(s, t) {
11
11
  return (s.leaves ?? "leadOut") === "main" ? t.to : t.to + (t.leadOut ?? 0);
12
12
  }
13
- function Vt(s, t) {
13
+ function zt(s, t) {
14
14
  return (s.arrives ?? "leadIn") === "main" ? t.from : t.from - (t.leadIn ?? 0);
15
15
  }
16
- function me(s, t) {
16
+ function ve(s, t) {
17
17
  if (t.kind === "place" || t.subtask !== s.id) return s;
18
18
  switch (t.kind) {
19
19
  case "move":
@@ -27,7 +27,7 @@ function me(s, t) {
27
27
  return { ...s, lane: t.lane };
28
28
  }
29
29
  }
30
- function wi(s, t) {
30
+ function xi(s, t) {
31
31
  return {
32
32
  id: t,
33
33
  task: s.task,
@@ -38,10 +38,10 @@ function wi(s, t) {
38
38
  ...s.leadOut === void 0 ? {} : { leadOut: s.leadOut }
39
39
  };
40
40
  }
41
- function Wt(s) {
41
+ function Ut(s) {
42
42
  const t = [], e = /* @__PURE__ */ new Map();
43
43
  s.forEach((n, i) => {
44
- const { from: o, to: r } = st(n);
44
+ const { from: o, to: r } = it(n);
45
45
  if (!(o < r)) return;
46
46
  const a = e.get(n.lane) ?? [];
47
47
  a.push({ subtask: n, index: i, from: o, to: r }), e.set(n.lane, a);
@@ -59,10 +59,10 @@ function Wt(s) {
59
59
  }
60
60
  return t;
61
61
  }
62
- function Ms(s) {
62
+ function Es(s) {
63
63
  const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map();
64
64
  for (const n of s) {
65
- const i = st(n), o = e.get(n.lane) ?? [];
65
+ const i = it(n), o = e.get(n.lane) ?? [];
66
66
  let r = 0;
67
67
  if (i.from < i.to) {
68
68
  for (const a of o) i.from < a.to && a.from < i.to && r++;
@@ -72,35 +72,35 @@ function Ms(s) {
72
72
  }
73
73
  return t;
74
74
  }
75
- function zt(s, t) {
75
+ function Xt(s, t) {
76
76
  const e = new Map(s.map((i) => [i.id, i])), n = [];
77
77
  for (const i of t) {
78
78
  const o = e.get(i.from), r = e.get(i.to);
79
79
  if (o === void 0 || r === void 0) continue;
80
- const a = Kt(i, o), l = Vt(i, r), d = a + i.lag - l;
80
+ const a = Wt(i, o), l = zt(i, r), d = a + i.lag - l;
81
81
  d > 0 && n.push({ dependency: i.id, departure: a, arrival: l, shortBy: d });
82
82
  }
83
83
  return n;
84
84
  }
85
- function Be(s, t) {
85
+ function Ye(s, t) {
86
86
  const e = [];
87
87
  for (const n of s) {
88
- const i = st(n);
88
+ const i = it(n);
89
89
  for (const o of t)
90
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) });
91
91
  }
92
92
  return e;
93
93
  }
94
- function bi(s, t, e = []) {
94
+ function Pi(s, t, e = []) {
95
95
  return {
96
- overlaps: Wt(s),
97
- violatedDependencies: zt(s, t),
98
- inBlockedTime: Be(s, e)
96
+ overlaps: Ut(s),
97
+ violatedDependencies: Xt(s, t),
98
+ inBlockedTime: Ye(s, e)
99
99
  };
100
100
  }
101
- function Mi(s, t, e) {
101
+ function Ri(s, t, e) {
102
102
  if (e.kind === "place") return [];
103
- const n = new Map(s.map((l) => [l.id, me(l, e)])), i = /* @__PURE__ */ new Map();
103
+ const n = new Map(s.map((l) => [l.id, ve(l, e)])), i = /* @__PURE__ */ new Map();
104
104
  for (const l of t) {
105
105
  const d = i.get(l.from) ?? [];
106
106
  d.push(l), i.set(l.from, d);
@@ -112,143 +112,154 @@ function Mi(s, t, e) {
112
112
  if (d !== void 0)
113
113
  for (const h of i.get(l) ?? []) {
114
114
  if (h.to === e.subtask) continue;
115
- const c = n.get(h.to);
116
- if (c === void 0) continue;
117
- const f = Kt(h, d) + h.lag - Vt(h, c);
115
+ const u = n.get(h.to);
116
+ if (u === void 0) continue;
117
+ const f = Wt(h, d) + h.lag - zt(h, u);
118
118
  if (!(f > 0)) continue;
119
- const p = { kind: "move", subtask: c.id, from: c.from + f, to: c.to + f };
120
- n.set(c.id, me(c, p)), o.set(c.id, p), r.push(c.id);
119
+ const g = { kind: "move", subtask: u.id, from: u.from + f, to: u.to + f };
120
+ n.set(u.id, ve(u, g)), o.set(u.id, g), r.push(u.id);
121
121
  }
122
122
  }
123
123
  return [...o.values()];
124
124
  }
125
- function Ts(s, t) {
125
+ function xs(s, t) {
126
126
  const { step: e, offset: n } = typeof t == "number" ? { step: t, offset: 0 } : t;
127
127
  if (!(e > 0) || !Number.isFinite(s)) return s;
128
- const i = $t(s) + n;
128
+ const i = Yt(s) + n;
129
129
  return i + Math.round((s - i) / e) * e;
130
130
  }
131
- function Ti(s, t, e) {
131
+ function Ni(s, t, e) {
132
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 }));
133
133
  }
134
- function vt(s) {
134
+ function wt(s) {
135
135
  let t = !1, e = !1, n = !1, i = !1;
136
136
  for (const o of s ?? [])
137
137
  o === "provisional" ? (t = !0, e = !1) : o === "fixed" ? (e = !0, t = !1) : o === "muted" ? n = !0 : o === "open" && (i = !0);
138
138
  return { dashed: t, hatched: e, muted: n, open: i };
139
139
  }
140
- const xe = /* @__PURE__ */ Ne(null), $e = /* @__PURE__ */ Ne(null);
141
- function Ge() {
142
- return Re($e);
140
+ const Ke = /* @__PURE__ */ Ge(null), Ve = /* @__PURE__ */ Ge(null);
141
+ function je() {
142
+ return $e(Ve);
143
143
  }
144
- function Ss(s) {
145
- const t = Re(xe);
144
+ function Ps(s) {
145
+ const t = $e(Ke);
146
146
  if (t === null)
147
147
  throw new Error(`@umriss-ui/schedule: <${s}> must be used inside a <Schedule>.`);
148
148
  return t;
149
149
  }
150
- function Ut(s, t, e, n, i) {
151
- const o = Ss(s), r = Y(null);
152
- z(() => (r.current = e(o, t), () => {
150
+ function qt(s, t, e, n, i) {
151
+ const o = Ps(s), r = V(null);
152
+ j(() => (r.current = e(o, t), () => {
153
153
  r.current !== null && i(o, r.current), r.current = null;
154
- }), [o]), z(() => {
154
+ }), [o]), j(() => {
155
155
  r.current !== null && n(o, r.current, t);
156
156
  });
157
157
  }
158
- function Is(s) {
159
- Ut("Lane", s, (t, e) => t.registerLane(e), (t, e, n) => t.updateLane(e, n), (t, e) => t.unregisterLane(e));
158
+ function Rs(s) {
159
+ qt("Lane", s, (t, e) => t.registerLane(e), (t, e, n) => t.updateLane(e, n), (t, e) => t.unregisterLane(e));
160
160
  }
161
- function Ls(s) {
162
- Ut("LaneGroup", s, (t, e) => t.registerGroup(e), (t, e, n) => t.updateGroup(e, n), (t, e) => t.unregisterGroup(e));
161
+ function Ns(s) {
162
+ qt("LaneGroup", s, (t, e) => t.registerGroup(e), (t, e, n) => t.updateGroup(e, n), (t, e) => t.unregisterGroup(e));
163
163
  }
164
- function yt(s, t) {
165
- Ut(s, t, (e, n) => e.registerLayer(n), (e, n, i) => e.updateLayer(n, i), (e, n) => e.unregisterLayer(n));
164
+ function bt(s, t) {
165
+ qt(s, t, (e, n) => e.registerLayer(n), (e, n, i) => e.updateLayer(n, i), (e, n) => e.unregisterLayer(n));
166
166
  }
167
- const He = 24, As = 4, Cs = 3, Dt = 4;
168
- function pe(s) {
169
- const { lanes: t, groups: e, collapsed: n, laneHeight: i, headHeight: o = He } = s, r = new Map(e.map((w) => [w.id, w])), a = (w) => w !== void 0 && r.has(w) ? w : void 0, l = /* @__PURE__ */ new Map(), d = (w) => {
170
- const M = [];
171
- let T = a(w.parent);
172
- const _ = /* @__PURE__ */ new Set();
173
- for (; T !== void 0 && !_.has(T); )
174
- _.add(T), M.unshift(T), T = a(r.get(T).parent);
175
- return M;
167
+ function Bs() {
168
+ try {
169
+ return process.env.NODE_ENV !== "production";
170
+ } catch {
171
+ return !1;
172
+ }
173
+ }
174
+ const $s = Bs(), ye = /* @__PURE__ */ new Set();
175
+ function We(s, t) {
176
+ !$s || ye.has(s) || (ye.add(s), console.warn(`@umriss-ui/schedule: ${t}`));
177
+ }
178
+ const Gs = (s, t) => We(`deprecated:${s}`, `${s} is deprecated and goes in the next minor release; use ${t}.`), ze = 24, Hs = 4, Ys = 3, Ft = 4;
179
+ function we(s) {
180
+ const { lanes: t, groups: e, collapsed: n, laneHeight: i, headHeight: o = ze } = s, r = new Map(e.map((b) => [b.id, b])), a = (b) => b !== void 0 && r.has(b) ? b : void 0, l = /* @__PURE__ */ new Map(), d = (b) => {
181
+ const T = [];
182
+ let S = a(b.parent);
183
+ const E = /* @__PURE__ */ new Set();
184
+ for (; S !== void 0 && !E.has(S); )
185
+ E.add(S), T.unshift(S), S = a(r.get(S).parent);
186
+ return T;
176
187
  }, h = /* @__PURE__ */ new Map();
177
- for (const w of t) {
178
- const M = d(w);
179
- h.set(w.id, M);
180
- for (const T of M) {
181
- const _ = l.get(T) ?? [];
182
- _.push(w.id), l.set(T, _);
188
+ for (const b of t) {
189
+ const T = d(b);
190
+ h.set(b.id, T);
191
+ for (const S of T) {
192
+ const E = l.get(S) ?? [];
193
+ E.push(b.id), l.set(S, E);
183
194
  }
184
195
  }
185
- const c = [], f = /* @__PURE__ */ new Map();
186
- let p = [], k = null, A = 0;
187
- const I = (w) => (c.push({ ...w, top: A }), A += w.height, c.length - 1), L = (w) => w.find((M) => n.has(M)), D = () => {
188
- if (k === null) return;
189
- const { row: w, lanes: M } = k, T = c[w], _ = Math.max(T.height, M.length * As + 2 * Dt);
190
- c[w] = { ...T, height: _ }, A += _ - T.height;
191
- const O = _ - 2 * Dt, V = Math.max(Cs, Math.floor(O / M.length));
192
- M.forEach((ut, nt) => {
193
- const it = h.get(ut) ?? [];
194
- f.set(ut, {
195
- top: T.top + Dt + nt * V,
196
- height: V,
196
+ const u = [], f = /* @__PURE__ */ new Map();
197
+ let g = [], v = null, D = 0;
198
+ const L = (b) => (u.push({ ...b, top: D }), D += b.height, u.length - 1), A = (b) => b.find((T) => n.has(T)), _ = () => {
199
+ if (v === null) return;
200
+ const { row: b, lanes: T } = v, S = u[b], E = Math.max(S.height, T.length * Hs + 2 * Ft);
201
+ u[b] = { ...S, height: E }, D += E - S.height;
202
+ const F = E - 2 * Ft, G = Math.max(Ys, Math.floor(F / T.length));
203
+ T.forEach((z, Z) => {
204
+ const ot = h.get(z) ?? [];
205
+ f.set(z, {
206
+ top: S.top + Ft + Z * G,
207
+ height: G,
197
208
  miniature: !0,
198
- group: it[it.length - 1]
209
+ group: ot[ot.length - 1]
199
210
  });
200
- }), k = null;
211
+ }), v = null;
201
212
  };
202
- for (const w of t) {
203
- const M = (h.get(w.id) ?? []).filter((O) => (l.get(O) ?? []).length > 0), T = L(M);
204
- if (k !== null && T === k.group) {
205
- k.lanes.push(w.id);
213
+ for (const b of t) {
214
+ const T = (h.get(b.id) ?? []).filter((F) => (l.get(F) ?? []).length > 0), S = A(T);
215
+ if (v !== null && S === v.group) {
216
+ v.lanes.push(b.id);
206
217
  continue;
207
218
  }
208
- D();
209
- const _ = M.filter((O, V) => p[V] === O).length;
210
- p = p.slice(0, _);
211
- for (const O of M.slice(_)) {
212
- if (p.push(O), O === T) break;
213
- I({
219
+ _();
220
+ const E = T.filter((F, G) => g[G] === F).length;
221
+ g = g.slice(0, E);
222
+ for (const F of T.slice(E)) {
223
+ if (g.push(F), F === S) break;
224
+ L({
214
225
  kind: "groupHead",
215
226
  lane: void 0,
216
- group: O,
217
- depth: p.length - 1,
218
- within: [...p],
219
- lanes: (l.get(O) ?? []).length,
227
+ group: F,
228
+ depth: g.length - 1,
229
+ within: [...g],
230
+ lanes: (l.get(F) ?? []).length,
220
231
  height: o
221
232
  });
222
233
  }
223
- if (T !== void 0) {
224
- const O = M.indexOf(T), V = I({
234
+ if (S !== void 0) {
235
+ const F = T.indexOf(S), G = L({
225
236
  kind: "miniature",
226
237
  lane: void 0,
227
- group: T,
228
- depth: O,
229
- within: M.slice(0, O + 1),
230
- lanes: (l.get(T) ?? []).length,
238
+ group: S,
239
+ depth: F,
240
+ within: T.slice(0, F + 1),
241
+ lanes: (l.get(S) ?? []).length,
231
242
  height: i
232
243
  });
233
- k = { group: T, row: V, lanes: [w.id] };
244
+ v = { group: S, row: G, lanes: [b.id] };
234
245
  continue;
235
246
  }
236
- I({ kind: "lane", lane: w.id, group: M[M.length - 1], depth: M.length, within: M, lanes: 1, height: i }), f.set(w.id, {
237
- top: c[c.length - 1].top,
247
+ L({ kind: "lane", lane: b.id, group: T[T.length - 1], depth: T.length, within: T, lanes: 1, height: i }), f.set(b.id, {
248
+ top: u[u.length - 1].top,
238
249
  height: i,
239
250
  miniature: !1,
240
- group: M[M.length - 1]
251
+ group: T[T.length - 1]
241
252
  });
242
253
  }
243
- return D(), { rows: c, slots: f, height: A };
254
+ return _(), { rows: u, slots: f, height: D };
244
255
  }
245
- function Ds(s, t) {
256
+ function Ks(s, t) {
246
257
  if (t.size === 0) return s;
247
258
  const e = /* @__PURE__ */ new Set();
248
259
  for (const n of s) t.has(n) || e.add(n);
249
260
  return e;
250
261
  }
251
- function et(s, t) {
262
+ function nt(s, t) {
252
263
  if (t < 0 || t >= s.height) return null;
253
264
  let e = 0, n = s.rows.length - 1;
254
265
  for (; e <= n; ) {
@@ -259,11 +270,11 @@ function et(s, t) {
259
270
  }
260
271
  return null;
261
272
  }
262
- function Xt(s, t) {
273
+ function Jt(s, t) {
263
274
  return s.slots.get(t) ?? null;
264
275
  }
265
- function _s(s, t) {
266
- const e = et(s, t);
276
+ function Vs(s, t) {
277
+ const e = nt(s, t);
267
278
  if (e === null) return null;
268
279
  if (e.kind === "lane") return e.lane ?? null;
269
280
  if (e.kind === "groupHead") return null;
@@ -271,151 +282,151 @@ function _s(s, t) {
271
282
  if (i.miniature && t >= i.top && t < i.top + i.height) return n;
272
283
  return null;
273
284
  }
274
- const Fs = 6, Ye = 3, ot = 2, ge = 3, ke = 3;
275
- function R(s, t) {
276
- return Math.round(s.scale.toPx(G(t, s.calendar)));
285
+ const js = 6, Ue = 3, lt = 2, be = 3, Me = 3;
286
+ function x(s, t) {
287
+ return Math.round(s.scale.toPx(H(t, s.calendar)));
277
288
  }
278
- function j(s, t) {
279
- const e = Xt(s.rows, t);
289
+ function J(s, t) {
290
+ const e = Jt(s.rows, t);
280
291
  return e === null ? null : { ...e, top: e.top - s.scrollY };
281
292
  }
282
- function qt(s, t) {
283
- const e = j(s, t.lane);
284
- 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)) };
293
+ function Zt(s, t) {
294
+ const e = J(s, t.lane);
295
+ return e === null ? null : { x: x(s, t.at), y: e.top + e.height / 2, half: Math.max(2, Math.min(7, e.height * 0.3)) };
285
296
  }
286
- function ve(s, t) {
287
- return _s(s.rows, t + s.scrollY);
297
+ function Te(s, t) {
298
+ return Vs(s.rows, t + s.scrollY);
288
299
  }
289
- function Ke(s, t, e, n) {
290
- const i = e.miniature ? 0 : Fs, o = e.miniature ? 0 : ke * ge, r = Math.max(e.miniature ? 1 : 4, e.height - 2 * i - o), a = e.top - s.scrollY + Math.floor((e.height - r) / 2), l = st(t);
300
+ function Xe(s, t, e, n) {
301
+ const i = e.miniature ? 0 : js, o = e.miniature ? 0 : Me * be, r = Math.max(e.miniature ? 1 : 4, e.height - 2 * i - o), a = e.top - s.scrollY + Math.floor((e.height - r) / 2), l = it(t);
291
302
  return {
292
303
  subtask: t,
293
304
  miniature: e.miniature,
294
305
  depth: n,
295
- y: a + (e.miniature ? 0 : Math.min(n, ke) * ge),
306
+ y: a + (e.miniature ? 0 : Math.min(n, Me) * be),
296
307
  height: r,
297
- outerFrom: R(s, l.from),
298
- mainFrom: R(s, t.from),
299
- mainTo: R(s, t.to),
300
- outerTo: R(s, l.to)
308
+ outerFrom: x(s, l.from),
309
+ mainFrom: x(s, t.from),
310
+ mainTo: x(s, t.to),
311
+ outerTo: x(s, l.to)
301
312
  };
302
313
  }
303
- function Ve(s, t, e) {
314
+ function qe(s, t, e) {
304
315
  if (e < s.y || e > s.y + s.height) return null;
305
316
  const n = Math.max(0, (6 - (s.outerTo - s.outerFrom)) / 2);
306
317
  return t < s.outerFrom - n || t > s.outerTo + n ? null : t < s.mainFrom ? "leadIn" : t > s.mainTo ? "leadOut" : "main";
307
318
  }
308
- function Os(s, t, e, n = 5) {
319
+ function Ws(s, t, e, n = 5) {
309
320
  if (e < s.y || e > s.y + s.height) return null;
310
321
  const i = Math.abs(t - s.mainFrom), o = Math.abs(t - s.mainTo);
311
322
  return Math.min(i, o) > n ? null : i <= o ? "from" : "to";
312
323
  }
313
- function Et(s, t, e) {
324
+ function Rt(s, t, e) {
314
325
  return s.outerTo >= 0 && s.outerFrom <= t && s.y + s.height >= 0 && s.y <= e;
315
326
  }
316
- function Es(s, t, e) {
327
+ function zs(s, t, e) {
317
328
  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
329
  for (let l = 0; l + 1 < s.points.length; l += 2)
319
330
  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
331
  return o >= -8 && i <= t + 8 && a >= -8 && r <= e + 8;
321
332
  }
322
- const Rs = 64;
323
- function Ns(s, t) {
333
+ const Us = 64;
334
+ function Xs(s, t) {
324
335
  if (s.miniature) return null;
325
- const e = vt(s.subtask.appearance).hatched ? ot + Ye + 1 : 0, n = Math.max(s.mainFrom + e, 0), i = Math.min(s.mainTo - e, t) - n;
326
- return i < Rs ? null : { x: n, width: i, y: s.y, height: s.height };
336
+ const e = wt(s.subtask.appearance).hatched ? lt + Ue + 1 : 0, n = Math.max(s.mainFrom + e, 0), i = Math.min(s.mainTo - e, t) - n;
337
+ return i < Us ? null : { x: n, width: i, y: s.y, height: s.height };
327
338
  }
328
- const Ps = 10;
329
- function ye(s, t, e) {
339
+ const qs = 10;
340
+ function Se(s, t, e) {
330
341
  const n = Math.round(t.y + t.height / 2);
331
342
  return s === "centre" || e.y === t.y ? n : Math.round(e.y > t.y ? t.y + t.height - 1 : t.y + 1);
332
343
  }
333
- function Rt(s, t, e, n, i) {
334
- const o = t.route ?? i.route, r = t.attach ?? i.attach, a = t.ends ?? i.ends, l = R(s, Kt(t, e.subtask)), d = R(s, Vt(t, n.subtask)), h = ye(r, e, n), c = ye(r, n, e);
344
+ function Nt(s, t, e, n, i) {
345
+ const o = t.route ?? i.route, r = t.attach ?? i.attach, a = t.ends ?? i.ends, l = x(s, Wt(t, e.subtask)), d = x(s, zt(t, n.subtask)), h = Se(r, e, n), u = Se(r, n, e);
335
346
  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] };
347
+ return { dependency: t, kind: o, ends: a, x1: l, y1: h, x2: d, y2: u, c1x: l, c2x: d, points: [l, h, d, u] };
337
348
  if (o === "orthogonal") {
338
- const I = l + Ps, L = h === c ? I : Math.round((I + 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, L, h, L, c, d, c] };
340
- }
341
- const f = Math.max(14, Math.abs(d - l) / 2), p = l + f, k = d - f, A = [];
342
- for (let I = 0; I <= 16; I++) {
343
- const L = I / 16, D = 1 - L;
344
- A.push(
345
- D * D * D * l + 3 * D * D * L * p + 3 * D * L * L * k + L * L * L * d,
346
- D * D * D * h + 3 * D * D * L * h + 3 * D * L * L * c + L * L * L * c
349
+ const L = l + qs, A = h === u ? L : Math.round((L + d) / 2);
350
+ return { dependency: t, kind: o, ends: a, x1: l, y1: h, x2: d, y2: u, c1x: l, c2x: d, points: h === u ? [l, h, d, u] : [l, h, A, h, A, u, d, u] };
351
+ }
352
+ const f = Math.max(14, Math.abs(d - l) / 2), g = l + f, v = d - f, D = [];
353
+ for (let L = 0; L <= 16; L++) {
354
+ const A = L / 16, _ = 1 - A;
355
+ D.push(
356
+ _ * _ * _ * l + 3 * _ * _ * A * g + 3 * _ * A * A * v + A * A * A * d,
357
+ _ * _ * _ * h + 3 * _ * _ * A * h + 3 * _ * A * A * u + A * A * A * u
347
358
  );
348
359
  }
349
- return { dependency: t, kind: "curve", ends: a, x1: l, y1: h, x2: d, y2: c, c1x: p, c2x: k, points: A };
360
+ return { dependency: t, kind: "curve", ends: a, x1: l, y1: h, x2: d, y2: u, c1x: g, c2x: v, points: D };
350
361
  }
351
- function Bs(s, t, e) {
362
+ function Js(s, t, e) {
352
363
  let n = 1 / 0;
353
364
  const i = s.points;
354
365
  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, p = 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 + p * h), e - (a + p * c)));
366
+ const r = i[o], a = i[o + 1], l = i[o + 2], d = i[o + 3], h = l - r, u = d - a, f = h * h + u * u, g = f === 0 ? 0 : Math.max(0, Math.min(1, ((t - r) * h + (e - a) * u) / f));
367
+ n = Math.min(n, Math.hypot(t - (r + g * h), e - (a + g * u)));
357
368
  }
358
369
  return n;
359
370
  }
360
- const We = [], ze = 56;
361
- function xs(s) {
371
+ const Je = [], Ze = 56;
372
+ function Zs(s) {
362
373
  return s > 16 ? s / 16 : 1;
363
374
  }
364
- function $s(s, t = ze) {
365
- return s > 0 ? Math.min(U, Math.max(15 * q, us(s * t, 1))) : 15 * q;
375
+ function Qs(s, t = Ze) {
376
+ return s > 0 ? Math.min(X, Math.max(15 * q, bs(s * t, 1))) : 15 * q;
366
377
  }
367
- function Gs(s, t, e = We) {
368
- const [n, i] = Ue(s, e);
369
- return fs(e, n, i, t, $t(n)).filter(
378
+ function tn(s, t, e = Je) {
379
+ const [n, i] = Qe(s, e);
380
+ return Ms(e, n, i, t, Yt(n)).filter(
370
381
  (o) => o.workingTime >= s[0] && o.workingTime <= s[1]
371
382
  );
372
383
  }
373
- function Hs(s, t = We) {
374
- const [e, n] = Ue(s, t), i = [], o = new Date(e);
384
+ function en(s, t = Je) {
385
+ const [e, n] = Qe(s, t), i = [], o = new Date(e);
375
386
  for (o.setHours(0, 0, 0, 0); o.getTime() < n && i.length < 400; ) {
376
387
  const r = o.getTime();
377
388
  o.setDate(o.getDate() + 1);
378
389
  const a = o.getTime();
379
390
  i.push({
380
391
  start: r,
381
- from: G(r, t),
382
- to: G(a, t)
392
+ from: H(r, t),
393
+ to: H(a, t)
383
394
  });
384
395
  }
385
396
  return i;
386
397
  }
387
- const _t = [1, 2, 7, 14, 28];
388
- function Ys(s, t) {
389
- return _t.find((e) => e * s >= t) ?? _t[_t.length - 1];
398
+ const Et = [1, 2, 7, 14, 28];
399
+ function sn(s, t) {
400
+ return Et.find((e) => e * s >= t) ?? Et[Et.length - 1];
390
401
  }
391
- function Ft(s, t) {
392
- return ((Math.round((s - $t(s)) / U) - 4) % t + t) % t === 0;
402
+ function xt(s, t) {
403
+ return ((Math.round((s - Yt(s)) / X) - 4) % t + t) % t === 0;
393
404
  }
394
- function Ks(s, t, e, n) {
405
+ function nn(s, t, e, n) {
395
406
  const i = s[1] - s[0];
396
407
  if (!(i > 0)) return [s[0], s[1]];
397
408
  const o = Math.min(n.max, Math.max(n.min, i * e)), r = (t - s[0]) / i, a = t - r * o;
398
409
  return [a, a + o];
399
410
  }
400
- function Vs(s, t) {
411
+ function on(s, t) {
401
412
  return [s[0] + t, s[1] + t];
402
413
  }
403
- function dt(s, t) {
404
- const e = gt(t);
405
- return e.intervals.length === 0 ? s : Gt(Math.max(0, Math.min(e.total, s)), e);
414
+ function ut(s, t) {
415
+ const e = vt(t);
416
+ return e.intervals.length === 0 ? s : Kt(Math.max(0, Math.min(e.total, s)), e);
406
417
  }
407
- function Ue(s, t) {
408
- return [dt(s[0], t), dt(s[1], t)];
418
+ function Qe(s, t) {
419
+ return [ut(s[0], t), ut(s[1], t)];
409
420
  }
410
- const Nt = 44;
411
- class Ws {
421
+ const Bt = 44;
422
+ class rn {
412
423
  constructor(t) {
413
424
  this.data = t;
414
425
  }
415
426
  options = {
416
- laneHeight: Nt,
427
+ laneHeight: Bt,
417
428
  calendar: [],
418
- zoomLimits: { min: Ht, max: 28 * U },
429
+ zoomLimits: { min: Vt, max: 28 * X },
419
430
  snap: "ticks",
420
431
  intents: [],
421
432
  now: null,
@@ -425,14 +436,14 @@ class Ws {
425
436
  };
426
437
  /** The root font size over 16 px, 1 at the default size and below (`fontScaleOf`). */
427
438
  fontScale = 1;
428
- domain = [0, U];
439
+ domain = [0, X];
429
440
  scrollY = 0;
430
441
  width = 0;
431
442
  height = 0;
432
443
  /* What is laid out from top to bottom (`rows.ts`). It is derived here and
433
444
  not in the data, because a row's height comes from a view option; every y
434
445
  in the package reads it. */
435
- rows = pe({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: Nt });
446
+ rows = we({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: Bt });
436
447
  /** The folded groups, as the scene holds them. */
437
448
  collapsed = /* @__PURE__ */ new Set();
438
449
  /** The groups a gesture in flight holds open. Dropped when it ends; the
@@ -468,20 +479,20 @@ class Ws {
468
479
  setOptions(t) {
469
480
  const e = t.calendar !== this.options.calendar, n = this.options.calendar;
470
481
  if (this.options = t, e) {
471
- const i = gt(n), o = (r) => {
482
+ const i = vt(n), o = (r) => {
472
483
  const a = i.intervals.length === 0 ? r : Math.max(0, Math.min(i.total, r));
473
- return G(Gt(a, i), t.calendar) + (r - a);
484
+ return H(Kt(a, i), t.calendar) + (r - a);
474
485
  };
475
486
  this.domain = [o(this.domain[0]), o(this.domain[1])];
476
487
  }
477
488
  }
478
489
  /** Puts a span of two wall-clock instants in view. */
479
490
  showWall(t) {
480
- this.domain = [G(t[0], this.options.calendar), G(t[1], this.options.calendar)];
491
+ this.domain = [H(t[0], this.options.calendar), H(t[1], this.options.calendar)];
481
492
  }
482
493
  viewport() {
483
494
  return {
484
- scale: new ms(this.domain, [0, this.width]),
495
+ scale: new Ts(this.domain, [0, this.width]),
485
496
  calendar: this.options.calendar,
486
497
  scrollY: this.scrollY,
487
498
  rows: this.rows
@@ -497,29 +508,29 @@ class Ws {
497
508
  /** The fine band's step at the current zoom. */
498
509
  step() {
499
510
  const t = this.domain[1] - this.domain[0];
500
- return $s(this.width > 0 ? t / this.width : t, ze * this.fontScale);
511
+ return Qs(this.width > 0 ? t / this.width : t, Ze * this.fontScale);
501
512
  }
502
513
  /** Lays the rows out, clamps the scroll, and lays the data out anew. */
503
514
  layout() {
504
- this.moved = !1, this.rows = pe({
515
+ this.moved = !1, this.rows = we({
505
516
  lanes: this.data.lanes,
506
517
  groups: this.data.groups,
507
- collapsed: Ds(this.collapsed, this.openForGesture),
518
+ collapsed: Ks(this.collapsed, this.openForGesture),
508
519
  laneHeight: Math.round(this.options.laneHeight * this.fontScale),
509
- headHeight: Math.round(He * this.fontScale)
520
+ headHeight: Math.round(ze * this.fontScale)
510
521
  }), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY));
511
522
  const t = this.viewport();
512
523
  this.laidBoxes = [], this.laidBoxById = /* @__PURE__ */ new Map();
513
524
  for (const e of this.data.subtasks) {
514
- const n = Xt(this.rows, e.lane);
525
+ const n = Jt(this.rows, e.lane);
515
526
  if (n === null) continue;
516
- const i = Ke(t, e, n, this.data.depth.get(e.id) ?? 0);
527
+ const i = Xe(t, e, n, this.data.depth.get(e.id) ?? 0);
517
528
  this.laidBoxes.push(i), this.laidBoxById.set(e.id, i);
518
529
  }
519
530
  this.laidPaths = [];
520
531
  for (const e of this.data.dependencies) {
521
532
  const n = this.boxById.get(e.from), i = this.boxById.get(e.to);
522
- n === void 0 || i === void 0 || this.laidPaths.push(Rt(t, e, n, i, this.options));
533
+ n === void 0 || i === void 0 || this.laidPaths.push(Nt(t, e, n, i, this.options));
523
534
  }
524
535
  }
525
536
  /** The days of the coarse band and the ticks of the fine band, in pixels. */
@@ -528,11 +539,11 @@ class Ws {
528
539
  if (this.width <= 0) return { days: [], ticks: [], step: t };
529
540
  const e = this.viewport().scale, n = this.options.calendar;
530
541
  return {
531
- days: Hs(this.domain, n).map((i) => {
542
+ days: en(this.domain, n).map((i) => {
532
543
  const o = Math.round(e.toPx(i.from));
533
544
  return { start: i.start, x: o, width: Math.round(e.toPx(i.to)) - o };
534
545
  }),
535
- ticks: Gs(this.domain, t, n).map((i) => ({ wallClock: i.wallClock, x: Math.round(e.toPx(i.workingTime)) })),
546
+ ticks: tn(this.domain, t, n).map((i) => ({ wallClock: i.wallClock, x: Math.round(e.toPx(i.workingTime)) })),
536
547
  step: t
537
548
  };
538
549
  }
@@ -540,32 +551,32 @@ class Ws {
540
551
  nowX() {
541
552
  const t = this.options.now;
542
553
  if (t === null || this.width <= 0) return null;
543
- const e = Math.round(this.viewport().scale.toPx(G(t, this.options.calendar)));
554
+ const e = Math.round(this.viewport().scale.toPx(H(t, this.options.calendar)));
544
555
  return e >= 0 && e <= this.width ? e : null;
545
556
  }
546
557
  hitAt(t, e) {
547
558
  const n = this.viewport();
548
559
  for (let a = this.data.milestones.length - 1; a >= 0; a--) {
549
- const l = this.data.milestones[a], d = qt(n, l);
560
+ const l = this.data.milestones[a], d = Zt(n, l);
550
561
  if (d !== null && Math.abs(t - d.x) + Math.abs(e - d.y) <= d.half + 2) return { kind: "milestone", milestone: l };
551
562
  }
552
563
  for (let a = this.boxes.length - 1; a >= 0; a--) {
553
- const l = this.boxes[a], d = Ve(l, t, e);
564
+ const l = this.boxes[a], d = qe(l, t, e);
554
565
  if (d !== null) return { kind: "subtask", subtask: l.subtask, part: d };
555
566
  }
556
567
  let i = null, o = 4;
557
568
  for (const a of this.paths) {
558
- const l = Bs(a, t, e);
569
+ const l = Js(a, t, e);
559
570
  l <= o && (o = l, i = a);
560
571
  }
561
572
  if (i !== null) return { kind: "dependency", dependency: i.dependency };
562
- const r = ve(this.viewport(), e);
573
+ const r = Te(this.viewport(), e);
563
574
  return r !== null ? { kind: "lane", lane: r } : { kind: "nothing" };
564
575
  }
565
576
  /** The wall-clock time at a plot x; within the calendar's extent. */
566
577
  timeAt(t) {
567
578
  const e = this.viewport().scale.fromPx(t);
568
- return dt(e, this.options.calendar);
579
+ return ut(e, this.options.calendar);
569
580
  }
570
581
  /** The lane at a y, strips included: what the pointer is ON.
571
582
 
@@ -574,7 +585,7 @@ class Ws {
574
585
  `foldedGroupAt` - and a caller that reached through `viewport()` for it
575
586
  would be depending on the layout rather than asking the view. */
576
587
  laneIdAt(t) {
577
- return ve(this.viewport(), t);
588
+ return Te(this.viewport(), t);
578
589
  }
579
590
  /** The lane a DROP at this y would land on.
580
591
 
@@ -584,19 +595,19 @@ class Ws {
584
595
  aim at. Hover, the tooltip and selection do read a strip - they cost
585
596
  nothing if they are a pixel out. */
586
597
  dropLaneIdAt(t) {
587
- const e = et(this.rows, t + this.scrollY);
598
+ const e = nt(this.rows, t + this.scrollY);
588
599
  return e === null || e.kind !== "lane" ? null : e.lane ?? null;
589
600
  }
590
601
  /** The folded group a y lies over, or null. */
591
602
  foldedGroupAt(t) {
592
- const e = et(this.rows, t + this.scrollY);
603
+ const e = nt(this.rows, t + this.scrollY);
593
604
  return e !== null && e.kind === "miniature" ? e.group ?? null : null;
594
605
  }
595
606
  /** Pans by pixels. Says what moved: the span through time, the lanes, or
596
607
  neither - a scroll through the lanes is no news about the time. */
597
608
  pan(t, e) {
598
609
  const n = this.domain[0], i = this.scrollY, o = this.domain[1] - n;
599
- this.width > 0 && t !== 0 && (this.domain = Vs(this.domain, t / this.width * o)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
610
+ this.width > 0 && t !== 0 && (this.domain = on(this.domain, t / this.width * o)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
600
611
  const r = this.domain[0] !== n;
601
612
  return { moved: r || this.scrollY !== i, time: r };
602
613
  }
@@ -604,65 +615,65 @@ class Ws {
604
615
  zoomAt(t, e) {
605
616
  if (this.width <= 0 || !Number.isFinite(e)) return !1;
606
617
  const n = this.domain, i = this.viewport().scale.fromPx(t);
607
- return this.domain = Ks(this.domain, i, e, this.options.zoomLimits), n[0] !== this.domain[0] || n[1] !== this.domain[1];
608
- }
609
- }
610
- const zs = "_root_1g7hg_4 _text_18806_22", Us = "_corner_1g7hg_19", Xs = "_dayBand_1g7hg_23", qs = "_tickBand_1g7hg_24", js = "_day_1g7hg_23", Js = "_dayLabel_1g7hg_50", Zs = "_tick_1g7hg_24", Qs = "_tickLabel_1g7hg_71", tn = "_headers_1g7hg_79", en = "_header_1g7hg_79", sn = "_headerLabel_1g7hg_97", nn = "_headerCount_1g7hg_133", on = "_chevron_1g7hg_142", rn = "_plot_1g7hg_197", an = "_focusRing_1g7hg_204", ln = "_layer_1g7hg_222", dn = "_grip_1g7hg_231", hn = "_ghostLabel_1g7hg_241", cn = "_finding_1g7hg_254", un = "_refusal_1g7hg_262", fn = "_tooltip_1g7hg_266", mn = "_tooltipHead_1g7hg_285", pn = "_tooltipTimes_1g7hg_290", gn = "_now_1g7hg_299", kn = "_barLabel_1g7hg_313", vn = "_barLabelText_1g7hg_326", g = {
611
- root: zs,
612
- corner: Us,
613
- dayBand: Xs,
614
- tickBand: qs,
615
- day: js,
616
- dayLabel: Js,
617
- tick: Zs,
618
- tickLabel: Qs,
619
- headers: tn,
620
- header: en,
621
- headerLabel: sn,
622
- headerCount: nn,
623
- chevron: on,
624
- plot: rn,
625
- focusRing: an,
626
- layer: ln,
627
- grip: dn,
628
- ghostLabel: hn,
629
- finding: cn,
630
- refusal: un,
631
- tooltip: fn,
632
- tooltipHead: mn,
633
- tooltipTimes: pn,
634
- now: gn,
635
- barLabel: kn,
636
- barLabelText: vn
618
+ return this.domain = nn(this.domain, i, e, this.options.zoomLimits), n[0] !== this.domain[0] || n[1] !== this.domain[1];
619
+ }
620
+ }
621
+ const an = "_root_mm9nj_4 _text_18806_22", ln = "_corner_mm9nj_19", dn = "_dayBand_mm9nj_23", hn = "_tickBand_mm9nj_24", cn = "_day_mm9nj_23", un = "_dayLabel_mm9nj_50", fn = "_tick_mm9nj_24", mn = "_tickLabel_mm9nj_71", pn = "_headers_mm9nj_81", gn = "_header_mm9nj_81", kn = "_headerLabel_mm9nj_100", vn = "_headerCount_mm9nj_136", yn = "_chevron_mm9nj_145", wn = "_plot_mm9nj_223", bn = "_focusRing_mm9nj_237", Mn = "_layer_mm9nj_255", Tn = "_grip_mm9nj_282", Sn = "_ghostLabel_mm9nj_292", In = "_finding_mm9nj_305", Ln = "_refusal_mm9nj_313", An = "_tooltip_mm9nj_317", Cn = "_tooltipHead_mm9nj_336", Dn = "_tooltipTimes_mm9nj_341", _n = "_now_mm9nj_350", On = "_barLabel_mm9nj_364", Fn = "_barLabelText_mm9nj_377", p = {
622
+ root: an,
623
+ corner: ln,
624
+ dayBand: dn,
625
+ tickBand: hn,
626
+ day: cn,
627
+ dayLabel: un,
628
+ tick: fn,
629
+ tickLabel: mn,
630
+ headers: pn,
631
+ header: gn,
632
+ headerLabel: kn,
633
+ headerCount: vn,
634
+ chevron: yn,
635
+ plot: wn,
636
+ focusRing: bn,
637
+ layer: Mn,
638
+ grip: Tn,
639
+ ghostLabel: Sn,
640
+ finding: In,
641
+ refusal: Ln,
642
+ tooltip: An,
643
+ tooltipHead: Cn,
644
+ tooltipTimes: Dn,
645
+ now: _n,
646
+ barLabel: On,
647
+ barLabelText: Fn
637
648
  };
638
- function Xe() {
639
- const s = kt();
649
+ function ts() {
650
+ const s = yt();
640
651
  return (t) => {
641
652
  const e = Math.round(t / q), n = Math.floor(e / 60), i = e % 60;
642
653
  return [n > 0 ? s.hoursShort(n) : "", i > 0 || n === 0 ? s.minutesShort(i) : ""].filter(Boolean).join(" ");
643
654
  };
644
655
  }
645
- function yn({ target: s, lane: t }) {
646
- const e = Yt(), n = kt(), i = Xe(), o = (c) => e.time(new Date(c), !1);
656
+ function En({ target: s, lane: t }) {
657
+ const e = jt(), n = yt(), i = ts(), o = (u) => e.time(new Date(u), !1);
647
658
  if (s.kind === "subtask") {
648
- const { subtask: c, task: f } = s, p = [
649
- f?.name ?? c.task,
650
- c.name ?? c.id,
651
- `${e.dateShort(new Date(c.from))} ${n.scheduleGhostTimes(o(c.from), o(c.to))}`,
652
- ...s.overlapping.map((k) => n.scheduleOverlapWith(k.name ?? k.id)),
653
- ...s.violatedDependencies.map((k) => n.scheduleViolatedBy(i(k.shortBy))),
654
- ...s.blocked.map((k) => n.scheduleInBlockedTime(k.label))
659
+ const { subtask: u, task: f } = s, g = [
660
+ f?.name ?? u.task,
661
+ u.name ?? u.id,
662
+ `${e.dateShort(new Date(u.from))} ${n.scheduleGhostTimes(o(u.from), o(u.to))}`,
663
+ ...s.overlapping.map((v) => n.scheduleOverlapWith(v.name ?? v.id)),
664
+ ...s.violatedDependencies.map((v) => n.scheduleViolatedBy(i(v.shortBy))),
665
+ ...s.blocked.map((v) => n.scheduleInBlockedTime(v.label))
655
666
  ];
656
- return /* @__PURE__ */ $(at, { children: [
667
+ return /* @__PURE__ */ N(ht, { children: [
657
668
  t,
658
- `, ${p.join(", ")}`
669
+ `, ${g.join(", ")}`
659
670
  ] });
660
671
  }
661
672
  if (s.kind === "milestone") {
662
- const { milestone: c } = s;
663
- return /* @__PURE__ */ $(at, { children: [
673
+ const { milestone: u } = s;
674
+ return /* @__PURE__ */ N(ht, { children: [
664
675
  t,
665
- `, ${n.scheduleMilestone(c.label ?? c.id)}, ${e.dateShort(new Date(c.at))} ${o(c.at)}`
676
+ `, ${n.scheduleMilestone(u.label ?? u.id)}, ${e.dateShort(new Date(u.at))} ${o(u.at)}`
666
677
  ] });
667
678
  }
668
679
  const { dependency: r, task: a, from: l, to: d, violated: h } = s;
@@ -673,371 +684,389 @@ function yn({ target: s, lane: t }) {
673
684
  ...h === void 0 ? [] : [n.scheduleViolatedBy(i(h.shortBy))]
674
685
  ].join(", ");
675
686
  }
676
- function wn({ target: s }) {
677
- const t = Yt(), e = kt(), n = (h) => t.time(new Date(h), !1), i = Xe();
687
+ function xn({ target: s }) {
688
+ const t = jt(), e = yt(), n = (h) => t.time(new Date(h), !1), i = ts();
678
689
  if (s.kind === "subtask") {
679
- const { subtask: h, task: c } = s;
680
- return /* @__PURE__ */ $(at, { children: [
681
- /* @__PURE__ */ m("span", { className: g.tooltipHead, children: c?.name ?? h.task }),
690
+ const { subtask: h, task: u } = s;
691
+ return /* @__PURE__ */ N(ht, { children: [
692
+ /* @__PURE__ */ m("span", { className: p.tooltipHead, children: u?.name ?? h.task }),
682
693
  /* @__PURE__ */ m("span", { children: h.name ?? h.id }),
683
- /* @__PURE__ */ m("span", { className: g.tooltipTimes, children: e.scheduleGhostTimes(n(h.from), n(h.to)) }),
694
+ /* @__PURE__ */ m("span", { className: p.tooltipTimes, children: e.scheduleGhostTimes(n(h.from), n(h.to)) }),
684
695
  (h.leadIn ?? 0) > 0 && /* @__PURE__ */ m("span", { children: `${e.scheduleLeadIn} ${i(h.leadIn)}` }),
685
696
  (h.leadOut ?? 0) > 0 && /* @__PURE__ */ m("span", { children: `${e.scheduleLeadOut} ${i(h.leadOut)}` }),
686
- s.overlapping.map((f) => /* @__PURE__ */ m("span", { className: g.finding, children: e.scheduleOverlapWith(f.name ?? f.id) }, f.id)),
687
- s.violatedDependencies.map((f) => /* @__PURE__ */ m("span", { className: g.finding, children: e.scheduleViolatedBy(i(f.shortBy)) }, f.dependency)),
688
- s.blocked.map((f) => /* @__PURE__ */ m("span", { className: g.finding, children: e.scheduleInBlockedTime(f.label) }, f.id))
697
+ s.overlapping.map((f) => /* @__PURE__ */ m("span", { className: p.finding, children: e.scheduleOverlapWith(f.name ?? f.id) }, f.id)),
698
+ s.violatedDependencies.map((f) => /* @__PURE__ */ m("span", { className: p.finding, children: e.scheduleViolatedBy(i(f.shortBy)) }, f.dependency)),
699
+ s.blocked.map((f) => /* @__PURE__ */ m("span", { className: p.finding, children: e.scheduleInBlockedTime(f.label) }, f.id))
689
700
  ] });
690
701
  }
691
702
  if (s.kind === "milestone") {
692
703
  const { milestone: h } = s;
693
- return /* @__PURE__ */ $(at, { children: [
694
- /* @__PURE__ */ m("span", { className: g.tooltipHead, children: e.scheduleMilestone(h.label ?? h.id) }),
695
- /* @__PURE__ */ m("span", { className: g.tooltipTimes, children: `${t.dateShort(new Date(h.at))} ${n(h.at)}` })
704
+ return /* @__PURE__ */ N(ht, { children: [
705
+ /* @__PURE__ */ m("span", { className: p.tooltipHead, children: e.scheduleMilestone(h.label ?? h.id) }),
706
+ /* @__PURE__ */ m("span", { className: p.tooltipTimes, children: `${t.dateShort(new Date(h.at))} ${n(h.at)}` })
696
707
  ] });
697
708
  }
698
709
  const { dependency: o, task: r, from: a, to: l, violated: d } = s;
699
- return /* @__PURE__ */ $(at, { children: [
700
- /* @__PURE__ */ m("span", { className: g.tooltipHead, children: r?.name ?? r?.id ?? o.id }),
710
+ return /* @__PURE__ */ N(ht, { children: [
711
+ /* @__PURE__ */ m("span", { className: p.tooltipHead, children: r?.name ?? r?.id ?? o.id }),
701
712
  /* @__PURE__ */ m("span", { children: e.scheduleRoute(a?.name ?? o.from, l?.name ?? o.to) }),
702
713
  /* @__PURE__ */ m("span", { children: `${e.scheduleDependency} ${i(o.lag)}` }),
703
- d !== void 0 && /* @__PURE__ */ m("span", { className: g.finding, children: e.scheduleViolatedBy(i(d.shortBy)) })
714
+ d !== void 0 && /* @__PURE__ */ m("span", { className: p.finding, children: e.scheduleViolatedBy(i(d.shortBy)) })
704
715
  ] });
705
716
  }
706
- const bn = [], we = { min: Ht, max: 28 * U }, Mn = [], be = 20, Tn = 44, Sn = 84, In = 200;
707
- function Ln(s) {
717
+ const Pn = [], Ie = { min: Vt, max: 28 * X }, Rn = [], Le = 20, Nn = 44, Bn = 84, $n = 200;
718
+ function Gn(s) {
708
719
  const {
709
720
  ref: t,
710
721
  scene: e,
711
- ariaLabel: n,
712
- height: i = 400,
713
- laneHeight: o = Nt,
714
- headerWidth: r = 160,
715
- calendar: a = Mn,
716
- zoomLimits: l,
717
- snap: d = "ticks",
718
- intents: h = bn,
719
- onIntent: c,
720
- canMoveTo: f,
721
- onInteraction: p,
722
- selectedTask: k,
723
- onSelectedTaskChange: A,
724
- placing: I,
725
- route: L = "curve",
726
- attach: D = "centre",
727
- ends: w = "dot",
728
- label: M,
729
- tooltip: T,
730
- now: _,
731
- className: O,
732
- style: V,
733
- children: ut
734
- } = s, nt = vs(), it = `${nt}-summary`, Jt = Y(null), Zt = Y(null), Qt = Y(null), te = Y(null), H = Yt(), P = kt(), ee = l?.min ?? we.min, se = l?.max ?? we.max, ne = typeof d == "object" ? d.step : null, ie = typeof d == "object" ? d.offset : null, oe = typeof d == "object" ? null : d, [ss, ns] = rt(() => Date.now());
735
- z(() => {
736
- if (_ !== !0) return;
737
- const u = setInterval(() => ns(Date.now()), q);
738
- return () => clearInterval(u);
739
- }, [_]);
740
- const re = _ === !0 ? ss : typeof _ == "number" ? _ : null;
741
- ft(() => {
742
- const u = oe ?? { step: ne ?? 0, offset: ie ?? 0 };
743
- e.setOptions({ laneHeight: o, calendar: a, zoomLimits: { min: ee, max: se }, snap: u, intents: h, now: re, route: L, attach: D, ends: w });
744
- }, [e, o, a, ee, se, oe, ne, ie, h, re, L, D, w]), z(() => {
745
- e.setHandlers({ onIntent: c, canMoveTo: f, onInteraction: p, onSelectedTaskChange: A });
746
- }, [e, c, f, p, A]), ys(
747
- t,
748
- () => ({
749
- positionAt: (u, y) => e.positionAt(u, y),
750
- clientPointOf: (u, y) => e.clientPointOf(u, y),
751
- visibleDomain: () => e.visibleDomain()
752
- }),
753
- [e]
754
- ), z(() => {
755
- e.setControlledTask(k);
756
- }, [e, k]), z(() => {
757
- e.setPlacing(I ?? null);
758
- }, [e, I]), z(() => {
759
- const u = Jt.current, y = Zt.current, S = Qt.current, E = te.current;
760
- if (!u || !y || !S || !E) return;
761
- e.bind(u, y, S, E);
762
- const C = y.getBoundingClientRect();
763
- e.resize(C.width, C.height);
764
- const F = new ResizeObserver((X) => {
765
- const Ct = X[X.length - 1]?.contentRect;
766
- Ct !== void 0 && e.resize(Ct.width, Ct.height);
722
+ "aria-label": n,
723
+ "aria-labelledby": i,
724
+ "aria-describedby": o,
725
+ ariaLabel: r,
726
+ height: a,
727
+ laneHeight: l = Bt,
728
+ headerWidth: d = 160,
729
+ calendar: h = Rn,
730
+ zoomLimits: u,
731
+ snap: f = "ticks",
732
+ intents: g = Pn,
733
+ onIntent: v,
734
+ canMoveTo: D,
735
+ onInteraction: L,
736
+ selectedTask: A,
737
+ onSelectedTaskChange: _,
738
+ placing: b,
739
+ route: T = "curve",
740
+ attach: S = "centre",
741
+ ends: E = "dot",
742
+ label: F,
743
+ tooltip: G,
744
+ now: z,
745
+ loading: Z = !1,
746
+ className: ot,
747
+ style: ls,
748
+ children: ds,
749
+ ...hs
750
+ } = s;
751
+ r !== void 0 && Gs("ariaLabel", "aria-label");
752
+ const te = { "aria-label": n ?? r, "aria-labelledby": i }, Mt = As(), Tt = `${Mt}-summary`, pt = V(null), ee = V(null), se = V(null), ne = V(null), Y = jt(), R = yt(), ie = u?.min ?? Ie.min, oe = u?.max ?? Ie.max, re = typeof f == "object" ? f.step : null, ae = typeof f == "object" ? f.offset : null, le = typeof f == "object" ? null : f, [cs, us] = dt(() => Date.now());
753
+ j(() => {
754
+ if (z !== !0) return;
755
+ const c = setInterval(() => us(Date.now()), q);
756
+ return () => clearInterval(c);
757
+ }, [z]);
758
+ const de = z === !0 ? cs : typeof z == "number" ? z : null;
759
+ at(() => {
760
+ const c = le ?? { step: re ?? 0, offset: ae ?? 0 };
761
+ e.setOptions({ laneHeight: l, calendar: h, zoomLimits: { min: ie, max: oe }, snap: c, intents: g, now: de, route: T, attach: S, ends: E });
762
+ }, [e, l, h, ie, oe, le, re, ae, g, de, T, S, E]), j(() => {
763
+ e.setHandlers({ onIntent: v, canMoveTo: D, onInteraction: L, onSelectedTaskChange: _ });
764
+ }, [e, v, D, L, _]), at(() => {
765
+ const c = pt.current;
766
+ if (!c) return;
767
+ const y = (w, C) => (...I) => (We("handle", `a ref to the schedule's handle is deprecated and goes in the next minor release; call ${w} on useSchedule's return.`), C(...I));
768
+ Object.assign(c, {
769
+ positionAt: y("positionAt", (w, C) => e.positionAt(w, C)),
770
+ clientPointOf: y("clientPointOf", (w, C) => e.clientPointOf(w, C)),
771
+ visibleDomain: y("visibleDomain", () => e.visibleDomain())
767
772
  });
768
- F.observe(y);
769
- const N = document.createElement("div");
770
- N.setAttribute("aria-hidden", "true"), N.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;width:1rem;height:0", u.appendChild(N);
771
- const B = () => e.setFontScale(xs(parseFloat(getComputedStyle(N).width)));
773
+ }, [e]), Cs(t, () => pt.current, []), j(() => {
774
+ e.setLoading(Z);
775
+ }, [e, Z]), j(() => {
776
+ e.setControlledTask(A);
777
+ }, [e, A]), j(() => {
778
+ e.setPlacing(b ?? null);
779
+ }, [e, b]), j(() => {
780
+ const c = pt.current, y = ee.current, w = se.current, C = ne.current;
781
+ if (!c || !y || !w || !C) return;
782
+ e.bind(c, y, w, C);
783
+ const I = y.getBoundingClientRect();
784
+ e.resize(I.width, I.height);
785
+ const O = new ResizeObserver((K) => {
786
+ const Ot = K[K.length - 1]?.contentRect;
787
+ Ot !== void 0 && e.resize(Ot.width, Ot.height);
788
+ });
789
+ O.observe(y);
790
+ const P = document.createElement("div");
791
+ P.setAttribute("aria-hidden", "true"), P.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;width:1rem;height:0", c.appendChild(P);
792
+ const B = () => e.setFontScale(Zs(parseFloat(getComputedStyle(P).width)));
772
793
  B();
773
- const x = new ResizeObserver(B);
774
- x.observe(N);
775
- const Q = (X) => e.wheel(X);
776
- u.addEventListener("wheel", Q, { passive: !1 });
777
- const ue = (X) => {
778
- X.key === "Escape" && e.cancelEdit() && X.preventDefault();
794
+ const $ = new ResizeObserver(B);
795
+ $.observe(P);
796
+ const et = (K) => e.wheel(K);
797
+ c.addEventListener("wheel", et, { passive: !1 });
798
+ const pe = (K) => e.touchMove(K);
799
+ c.addEventListener("touchmove", pe, { passive: !1 });
800
+ const ge = (K) => {
801
+ K.key === "Escape" && e.cancelEdit() && K.preventDefault();
779
802
  };
780
- return window.addEventListener("keydown", ue), () => {
781
- window.removeEventListener("keydown", ue), u.removeEventListener("wheel", Q), F.disconnect(), x.disconnect(), N.remove(), e.unbind();
803
+ return window.addEventListener("keydown", ge), () => {
804
+ window.removeEventListener("keydown", ge), c.removeEventListener("wheel", et), c.removeEventListener("touchmove", pe), O.disconnect(), $.disconnect(), P.remove(), e.unbind();
782
805
  };
783
806
  }, [e]);
784
- const v = Pe(e.subscribe, e.getSnapshot, e.getServerSnapshot), { fontScale: wt } = v, bt = Tn * wt, is = Sn * wt, os = In * wt, rs = (u, y) => {
785
- const S = new Date(u);
786
- return y >= os ? H.dateLong(S) : y >= is ? H.date(S) : y >= bt ? H.dateShort(S) : "";
787
- }, as = v.days.reduce((u, y) => Math.max(u, y.width), 0), J = Ys(as, bt), ae = v.step >= U ? J : 1, b = v.ghost, Z = v.spoken, Mt = v.summary, le = (u) => `${H.dateShort(new Date(u))} ${H.time(new Date(u), !1)}`, Tt = (u) => `${nt}-row-${encodeURIComponent(u.key)}`, ls = K(() => {
788
- const u = /* @__PURE__ */ new Map();
789
- for (const y of v.headers)
790
- for (const S of y.within)
791
- y.kind === "groupHead" && S === y.group || u.set(S, [...u.get(S) ?? [], Tt(y)]);
792
- return u;
793
- }, [v.headers, nt]), de = Y(null);
794
- ft(() => {
795
- const u = de.current;
796
- if (u === null) return;
807
+ const k = He(e.subscribe, e.getSnapshot, e.getServerSnapshot), { fontScale: rt } = k, St = Nn * rt, fs = Bn * rt, ms = $n * rt, ps = (c, y) => {
808
+ const w = new Date(c);
809
+ return y >= ms ? Y.dateLong(w) : y >= fs ? Y.date(w) : y >= St ? Y.dateShort(w) : "";
810
+ }, gs = k.days.reduce((c, y) => Math.max(c, y.width), 0), Q = sn(gs, St), he = k.step >= X ? Q : 1, M = k.ghost, tt = k.spoken, It = k.summary, ce = (c) => `${Y.dateShort(new Date(c))} ${Y.time(new Date(c), !1)}`, Lt = (c) => `${Mt}-row-${encodeURIComponent(c.key)}`, ks = W(() => {
811
+ const c = /* @__PURE__ */ new Map();
812
+ for (const y of k.headers)
813
+ for (const w of y.within)
814
+ y.kind === "groupHead" && w === y.group || c.set(w, [...c.get(w) ?? [], Lt(y)]);
815
+ return c;
816
+ }, [k.headers, Mt]), ue = V(null);
817
+ at(() => {
818
+ const c = ue.current;
819
+ if (c === null) return;
797
820
  let y = !0;
798
- const S = () => {
821
+ const w = () => {
799
822
  if (!y) return;
800
- const F = [...u.querySelectorAll("[data-lane-count]")];
801
- for (const B of F) B.hidden = !1;
802
- const N = F.some((B) => {
803
- const x = B.previousElementSibling;
804
- if (!(x instanceof HTMLElement)) return !1;
805
- const Q = parseFloat(getComputedStyle(x).lineHeight);
806
- return x.scrollWidth > x.clientWidth || x.clientHeight > Q * 1.5;
823
+ const O = [...c.querySelectorAll("[data-lane-count]")];
824
+ for (const B of O) B.hidden = !1;
825
+ const P = O.some((B) => {
826
+ const $ = B.previousElementSibling;
827
+ if (!($ instanceof HTMLElement)) return !1;
828
+ const et = parseFloat(getComputedStyle($).lineHeight);
829
+ return $.scrollWidth > $.clientWidth || $.clientHeight > et * 1.5;
807
830
  });
808
- for (const B of F) B.hidden = N;
831
+ for (const B of O) B.hidden = P;
809
832
  };
810
- S(), document.fonts?.ready.then(S);
811
- const E = new ResizeObserver(S);
812
- E.observe(u);
813
- const C = new MutationObserver(S);
814
- return C.observe(u, { childList: !0, characterData: !0, subtree: !0 }), () => {
815
- y = !1, E.disconnect(), C.disconnect();
833
+ w(), document.fonts?.ready.then(w);
834
+ const C = new ResizeObserver(w);
835
+ C.observe(c);
836
+ const I = new MutationObserver(w);
837
+ return I.observe(c, { childList: !0, characterData: !0, subtree: !0 }), () => {
838
+ y = !1, C.disconnect(), I.disconnect();
816
839
  };
817
840
  }, []);
818
- const ds = K(() => new Set(b?.refusedLanes ?? []), [b?.refusedLanes]), he = Y(null), [St, hs] = rt({ x: 0, y: 0, at: "" }), It = b === null ? "" : `${b.x}:${b.y}:${b.from}:${b.to}:${b.overlap}:${b.violated}:${b.refused}:${b.blocked}`;
819
- ft(() => {
820
- const u = he.current;
821
- if (b === null || u === null) return;
822
- const y = 4, S = b.y - u.offsetHeight - y, E = b.y + b.height + y, C = {
823
- x: Math.max(2, Math.min(b.x, v.width - u.offsetWidth - 2)),
824
- y: S >= 2 ? S : Math.min(E, v.height - u.offsetHeight - 2),
825
- at: It
841
+ const vs = W(() => new Set(M?.refusedLanes ?? []), [M?.refusedLanes]), fe = V(null), [At, ys] = dt({ x: 0, y: 0, at: "" }), Ct = M === null ? "" : `${M.x}:${M.y}:${M.from}:${M.to}:${M.overlap}:${M.violated}:${M.refused}:${M.blocked}`;
842
+ at(() => {
843
+ const c = fe.current;
844
+ if (M === null || c === null) return;
845
+ const y = 4, w = M.y - c.offsetHeight - y, C = M.y + M.height + y, I = {
846
+ x: Math.max(2, Math.min(M.x, k.width - c.offsetWidth - 2)),
847
+ y: w >= 2 ? w : Math.min(C, k.height - c.offsetHeight - 2),
848
+ at: Ct
826
849
  };
827
- hs((F) => F.x === C.x && F.y === C.y && F.at === C.at ? F : C);
828
- }, [b, It, v.width, v.height]);
829
- const ce = Y(null), [Lt, cs] = rt({ x: 0, y: 0, at: "" }), W = v.tooltip, At = W === null ? "" : `${W.x}:${W.y}:${W.target.kind}`;
830
- return ft(() => {
831
- const u = ce.current;
832
- if (W === null || u === null) return;
833
- const y = 12, S = (C, F, N) => {
834
- const B = C + y, x = C - y - F, Q = B + F <= N - 4 || x < 4 ? B : x;
835
- return Math.max(4, Math.min(Q, N - F - 4));
836
- }, E = {
837
- x: S(W.x, u.offsetWidth, v.width),
838
- y: S(W.y, u.offsetHeight, v.height),
839
- at: At
850
+ ys((O) => O.x === I.x && O.y === I.y && O.at === I.at ? O : I);
851
+ }, [M, Ct, k.width, k.height]);
852
+ const me = V(null), [Dt, ws] = dt({ x: 0, y: 0, at: "" }), U = k.tooltip, _t = U === null ? "" : `${U.x}:${U.y}:${U.target.kind}`;
853
+ return at(() => {
854
+ const c = me.current;
855
+ if (U === null || c === null) return;
856
+ const y = 12, w = (I, O, P) => {
857
+ const B = I + y, $ = I - y - O, et = B + O <= P - 4 || $ < 4 ? B : $;
858
+ return Math.max(4, Math.min(et, P - O - 4));
859
+ }, C = {
860
+ x: w(U.x, c.offsetWidth, k.width),
861
+ y: w(U.y, c.offsetHeight, k.height),
862
+ at: _t
840
863
  };
841
- cs((C) => C.x === E.x && C.y === E.y && C.at === E.at ? C : E);
842
- }, [W, At, v.width, v.height]), /* @__PURE__ */ $(xe, { value: e, children: [
843
- /* @__PURE__ */ $(
864
+ ws((I) => I.x === C.x && I.y === C.y && I.at === C.at ? I : C);
865
+ }, [U, _t, k.width, k.height]), /* @__PURE__ */ N(Ke, { value: e, children: [
866
+ /* @__PURE__ */ N(
844
867
  "div",
845
868
  {
846
- ref: Jt,
869
+ ...hs,
870
+ ref: pt,
847
871
  role: "figure",
848
- "aria-label": n,
849
- className: O ? `${g.root} ${O}` : g.root,
850
- style: { height: `${i}px`, gridTemplateColumns: `min(${r}px, 40%) minmax(0, 1fr)`, ...V },
872
+ ...te,
873
+ className: ot ? `${p.root} ${ot}` : p.root,
874
+ style: { ...a === void 0 ? { height: "100%", minHeight: 400 } : { height: `${a}px` }, gridTemplateColumns: `min(${d}px, 40%) minmax(0, 1fr)`, ...ls },
851
875
  children: [
852
- /* @__PURE__ */ m("div", { className: g.corner }),
853
- /* @__PURE__ */ m("div", { className: g.dayBand, "aria-hidden": "true", "data-schedule-days": "", "data-schedule-clip": "day band", children: v.days.map((u, y) => {
854
- const S = J === 1 || y === 0 || Ft(u.start, J), E = J === 1 ? u.x + u.width : v.days.slice(y + 1).find((N) => Ft(N.start, J))?.x ?? v.width, C = Math.max(0, -u.x), F = Math.min(E, v.width) - Math.max(u.x, 0);
855
- return /* @__PURE__ */ m("span", { className: g.day, style: { left: `${u.x}px`, width: `${S ? E - u.x : u.width}px` }, children: /* @__PURE__ */ m("span", { className: g.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${C}px` }, children: S ? rs(u.start, J === 1 ? F : Math.min(F, bt)) : "" }) }, u.start);
876
+ /* @__PURE__ */ m("div", { className: p.corner }),
877
+ /* @__PURE__ */ m("div", { className: p.dayBand, "aria-hidden": "true", "data-schedule-days": "", "data-schedule-clip": "day band", children: k.days.map((c, y) => {
878
+ const w = Q === 1 || y === 0 || xt(c.start, Q), C = Q === 1 ? c.x + c.width : k.days.slice(y + 1).find((P) => xt(P.start, Q))?.x ?? k.width, I = Math.max(0, -c.x), O = Math.min(C, k.width) - Math.max(c.x, 0);
879
+ return /* @__PURE__ */ m("span", { className: p.day, style: { left: `${c.x}px`, width: `${w ? C - c.x : c.width}px` }, children: /* @__PURE__ */ m("span", { className: p.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${I}px` }, children: w ? ps(c.start, Q === 1 ? O : Math.min(O, St)) : "" }) }, c.start);
856
880
  }) }),
857
- /* @__PURE__ */ m("div", { ref: de, className: g.headers, "data-schedule-headers": "", children: /* @__PURE__ */ m("div", { className: g.headerRun, style: { transform: `translateY(${-v.scrollY}px)` }, children: v.headers.map((u) => /* @__PURE__ */ $(
858
- "div",
859
- {
860
- id: Tt(u),
861
- className: g.header,
862
- style: { height: `${u.height}px`, paddingLeft: `calc(var(--u-space-3) + ${u.depth} * var(--u-space-3))` },
863
- "data-lane": u.lane,
864
- "data-group": u.group,
865
- "data-row": u.kind,
866
- "data-schedule-clip": `header ${u.kind}`,
867
- "data-refused": u.lane !== void 0 && ds.has(u.lane) ? "" : void 0,
868
- children: [
869
- u.kind !== "lane" && u.group !== void 0 && /* @__PURE__ */ m(
870
- "button",
871
- {
872
- type: "button",
873
- className: g.chevron,
874
- "data-schedule-overlay": "fold control",
875
- "aria-expanded": u.collapsed === !1,
876
- "aria-controls": (ls.get(u.group) ?? [Tt(u)]).join(" "),
877
- "aria-label": `${u.collapsed === !0 ? P.scheduleUnfoldGroup : P.scheduleFoldGroup}: ${typeof u.label == "string" ? u.label : u.group}`,
878
- onClick: () => e.toggleGroup(u.group),
879
- children: /* @__PURE__ */ m(bs, { size: 9, "data-open": u.collapsed === !1 ? "" : void 0 })
880
- }
881
- ),
882
- /* @__PURE__ */ m("span", { className: g.headerLabel, "data-schedule-overlay": "header label", children: u.label }),
883
- u.kind !== "lane" && /* @__PURE__ */ m("span", { className: g.headerCount, "data-schedule-overlay": "lane count", "data-lane-count": u.lanes, children: P.scheduleLaneCount(u.lanes) })
884
- ]
885
- },
886
- u.key
887
- )) }) }),
888
- /* @__PURE__ */ $(
881
+ /* @__PURE__ */ m("div", { ref: ue, className: p.headers, "data-schedule-headers": "", children: /* @__PURE__ */ N("div", { className: p.headerRun, style: { transform: `translateY(${-k.scrollY}px)` }, children: [
882
+ Z && k.headers.length === 0 && Array.from({ length: Math.floor(k.height / Math.round(l * rt)) }, (c, y) => /* @__PURE__ */ m("div", { className: p.header, style: { height: `${Math.round(l * rt)}px` }, children: /* @__PURE__ */ m(_s, { width: "60%" }) }, y)),
883
+ k.headers.map((c) => /* @__PURE__ */ N(
884
+ "div",
885
+ {
886
+ id: Lt(c),
887
+ className: p.header,
888
+ style: { height: `${c.height}px`, paddingLeft: `calc(var(--u-space-3) + ${c.depth} * var(--u-space-3))` },
889
+ "data-lane": c.lane,
890
+ "data-group": c.group,
891
+ "data-row": c.kind,
892
+ "data-schedule-clip": `header ${c.kind}`,
893
+ "data-refused": c.lane !== void 0 && vs.has(c.lane) ? "" : void 0,
894
+ children: [
895
+ c.kind !== "lane" && c.group !== void 0 && /* @__PURE__ */ m(
896
+ "button",
897
+ {
898
+ type: "button",
899
+ className: p.chevron,
900
+ "data-schedule-overlay": "fold control",
901
+ "aria-expanded": c.collapsed === !1,
902
+ "aria-controls": (ks.get(c.group) ?? [Lt(c)]).join(" "),
903
+ "aria-label": `${c.collapsed === !0 ? R.scheduleUnfoldGroup : R.scheduleFoldGroup}: ${typeof c.label == "string" ? c.label : c.group}`,
904
+ onClick: () => e.toggleGroup(c.group),
905
+ children: /* @__PURE__ */ m(Os, { size: 9, "data-open": c.collapsed === !1 ? "" : void 0 })
906
+ }
907
+ ),
908
+ /* @__PURE__ */ m("span", { className: p.headerLabel, "data-schedule-overlay": "header label", children: c.label }),
909
+ c.kind !== "lane" && /* @__PURE__ */ m("span", { className: p.headerCount, "data-schedule-overlay": "lane count", "data-lane-count": c.lanes, children: R.scheduleLaneCount(c.lanes) })
910
+ ]
911
+ },
912
+ c.key
913
+ ))
914
+ ] }) }),
915
+ /* @__PURE__ */ N(
889
916
  "div",
890
917
  {
891
- ref: Zt,
892
- className: g.plot,
918
+ ref: ee,
919
+ className: p.plot,
893
920
  "data-schedule-plot": "",
894
921
  "data-schedule-clip": "plot",
895
- style: { cursor: v.cursor },
922
+ style: { cursor: k.cursor },
923
+ "aria-busy": Z || void 0,
924
+ "data-stale": k.loading && k.headers.length > 0 || void 0,
896
925
  tabIndex: 0,
897
926
  role: "application",
898
- "aria-roledescription": P.scheduleRoleDescription,
899
- "aria-label": n,
900
- "aria-describedby": it,
901
- onKeyDown: (u) => {
902
- e.key(u.nativeEvent) && u.preventDefault();
927
+ "aria-roledescription": R.scheduleRoleDescription,
928
+ ...te,
929
+ "aria-describedby": o ? `${Tt} ${o}` : Tt,
930
+ onKeyDown: (c) => {
931
+ e.key(c.nativeEvent) && c.preventDefault();
903
932
  },
904
- onFocus: (u) => e.focus(An(u.currentTarget)),
933
+ onFocus: (c) => e.focus(Hn(c.currentTarget)),
905
934
  onBlur: () => e.blur(),
906
- onPointerDown: (u) => e.pointerDown(u.nativeEvent),
907
- onPointerMove: (u) => e.pointerMove(u.nativeEvent),
908
- onPointerUp: (u) => e.pointerUp(u.nativeEvent),
909
- onPointerCancel: (u) => e.pointerCancel(u.nativeEvent),
935
+ onPointerDown: (c) => e.pointerDown(c.nativeEvent),
936
+ onPointerMove: (c) => e.pointerMove(c.nativeEvent),
937
+ onPointerUp: (c) => e.pointerUp(c.nativeEvent),
938
+ onPointerCancel: (c) => e.pointerCancel(c.nativeEvent),
910
939
  onPointerLeave: () => e.pointerLeave(),
911
- onContextMenu: (u) => e.contextMenu(u.nativeEvent),
912
- onDragOver: (u) => e.dragOver(u.nativeEvent),
913
- onDrop: (u) => e.drop(u.nativeEvent),
914
- onDragLeave: (u) => {
915
- const y = u.nativeEvent.relatedTarget;
916
- (!(y instanceof Node) || !u.currentTarget.contains(y)) && e.dragLeave();
940
+ onContextMenu: (c) => e.contextMenu(c.nativeEvent),
941
+ onDragOver: (c) => e.dragOver(c.nativeEvent),
942
+ onDrop: (c) => e.drop(c.nativeEvent),
943
+ onDragLeave: (c) => {
944
+ const y = c.nativeEvent.relatedTarget;
945
+ (!(y instanceof Node) || !c.currentTarget.contains(y)) && e.dragLeave();
917
946
  },
918
947
  children: [
919
- /* @__PURE__ */ m("canvas", { ref: Qt, className: g.layer, "aria-hidden": "true" }),
920
- /* @__PURE__ */ m("canvas", { ref: te, className: g.layer, "aria-hidden": "true" }),
921
- v.grips.map((u) => /* @__PURE__ */ m(
948
+ /* @__PURE__ */ m("canvas", { ref: se, className: p.layer, "aria-hidden": "true" }),
949
+ /* @__PURE__ */ m("canvas", { ref: ne, className: p.layer, "aria-hidden": "true" }),
950
+ k.grips.map((c) => /* @__PURE__ */ m(
922
951
  "span",
923
952
  {
924
- "data-grip": u.kind,
925
- "data-schedule-overlay": `${u.kind} grip`,
953
+ "data-grip": c.kind,
954
+ "data-schedule-overlay": `${c.kind} grip`,
926
955
  "aria-hidden": "true",
927
- className: g.grip,
928
- style: { left: `${u.x}px`, top: `${u.y}px`, height: `${u.height}px` }
956
+ className: p.grip,
957
+ style: { left: `${c.x}px`, top: `${c.y}px`, height: `${c.height}px` }
929
958
  },
930
- u.kind
959
+ c.kind
931
960
  )),
932
- M !== void 0 && v.bars.map((u) => /* @__PURE__ */ m(
961
+ F !== void 0 && k.bars.map((c) => /* @__PURE__ */ m(
933
962
  "span",
934
963
  {
935
- className: g.barLabel,
936
- "data-bar-label": u.subtask.id,
964
+ className: p.barLabel,
965
+ "data-bar-label": c.subtask.id,
937
966
  "data-schedule-overlay": "bar label",
938
967
  "data-schedule-may-cover": "",
939
- "data-on": u.dark ? "dark" : "light",
940
- style: { left: `${u.x}px`, top: `${u.y}px`, width: `${u.width}px`, height: `${u.height}px` },
941
- children: /* @__PURE__ */ m("span", { className: g.barLabelText, children: M(u.subtask) })
968
+ "data-on": c.dark ? "dark" : "light",
969
+ style: { left: `${c.x}px`, top: `${c.y}px`, width: `${c.width}px`, height: `${c.height}px` },
970
+ children: /* @__PURE__ */ m("span", { className: p.barLabelText, children: F(c.subtask) })
942
971
  },
943
- u.subtask.id
972
+ c.subtask.id
944
973
  )),
945
- T !== !1 && v.tooltip !== null && /* @__PURE__ */ m(
974
+ G !== !1 && k.tooltip !== null && /* @__PURE__ */ m(
946
975
  "span",
947
976
  {
948
- ref: ce,
977
+ ref: me,
949
978
  role: "tooltip",
950
- className: g.tooltip,
979
+ className: p.tooltip,
951
980
  "data-schedule-tooltip": "",
952
981
  "data-schedule-overlay": "tooltip",
953
982
  style: {
954
- left: `${Lt.x}px`,
955
- top: `${Lt.y}px`,
956
- visibility: Lt.at === At ? void 0 : "hidden"
983
+ left: `${Dt.x}px`,
984
+ top: `${Dt.y}px`,
985
+ visibility: Dt.at === _t ? void 0 : "hidden"
957
986
  },
958
- children: typeof T == "function" ? T(v.tooltip.target) : /* @__PURE__ */ m(wn, { target: v.tooltip.target })
987
+ children: typeof G == "function" ? G(k.tooltip.target) : /* @__PURE__ */ m(xn, { target: k.tooltip.target })
959
988
  }
960
989
  ),
961
- b !== null && /* @__PURE__ */ $(
990
+ M !== null && /* @__PURE__ */ N(
962
991
  "span",
963
992
  {
964
- ref: he,
965
- className: g.ghostLabel,
993
+ ref: fe,
994
+ className: p.ghostLabel,
966
995
  "data-ghost": "",
967
996
  "data-schedule-overlay": "ghost label",
968
- "data-findings": [b.overlap ? "overlap" : "", b.violated ? "violated-dependency" : ""].filter(Boolean).join(" "),
969
- "data-refused": b.refused ? "" : void 0,
970
- "data-blocked": b.blocked ? "" : void 0,
997
+ "data-findings": [M.overlap ? "overlap" : "", M.violated ? "violated-dependency" : ""].filter(Boolean).join(" "),
998
+ "data-refused": M.refused ? "" : void 0,
999
+ "data-blocked": M.blocked ? "" : void 0,
971
1000
  style: {
972
- left: `${St.x}px`,
973
- top: `${St.y}px`,
974
- visibility: St.at === It ? void 0 : "hidden"
1001
+ left: `${At.x}px`,
1002
+ top: `${At.y}px`,
1003
+ visibility: At.at === Ct ? void 0 : "hidden"
975
1004
  },
976
1005
  children: [
977
- P.scheduleGhostTimes(H.time(new Date(b.from), !1), H.time(new Date(b.to), !1)),
978
- b.refused && /* @__PURE__ */ m("span", { className: g.refusal, children: P.scheduleLaneRefused }),
979
- b.blocked && /* @__PURE__ */ m("span", { className: g.refusal, children: P.scheduleBlockedTime }),
980
- b.overlap && /* @__PURE__ */ m("span", { className: g.finding, children: P.scheduleOverlap }),
981
- b.violated && /* @__PURE__ */ m("span", { className: g.finding, children: P.scheduleViolatedDependency })
1006
+ R.scheduleGhostTimes(Y.time(new Date(M.from), !1), Y.time(new Date(M.to), !1)),
1007
+ M.refused && /* @__PURE__ */ m("span", { className: p.refusal, children: R.scheduleLaneRefused }),
1008
+ M.blocked && /* @__PURE__ */ m("span", { className: p.refusal, children: R.scheduleBlockedTime }),
1009
+ M.overlap && /* @__PURE__ */ m("span", { className: p.finding, children: R.scheduleOverlap }),
1010
+ M.violated && /* @__PURE__ */ m("span", { className: p.finding, children: R.scheduleViolatedDependency })
982
1011
  ]
983
1012
  }
984
1013
  ),
985
- /* @__PURE__ */ m("span", { className: g.focusRing, "aria-hidden": "true" })
1014
+ /* @__PURE__ */ m("span", { className: p.focusRing, "aria-hidden": "true" })
986
1015
  ]
987
1016
  }
988
1017
  ),
989
- /* @__PURE__ */ m("div", { className: g.corner }),
990
- /* @__PURE__ */ $("div", { className: g.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
991
- v.now !== null && /* @__PURE__ */ m("span", { className: g.now, "data-now": "", "data-schedule-overlay": "now mark", style: { left: `${v.now}px` } }),
992
- v.ticks.map((u) => /* @__PURE__ */ m("span", { className: g.tick, style: { left: `${u.x}px` }, children: u.x >= be && u.x <= v.width - be && (ae === 1 || Ft(u.wallClock, ae)) && /* @__PURE__ */ m("span", { className: g.tickLabel, "data-schedule-overlay": "time label", children: v.step >= U ? H.dateShort(new Date(u.wallClock)) : H.time(new Date(u.wallClock), !1) }) }, u.wallClock))
1018
+ /* @__PURE__ */ m("div", { className: p.corner }),
1019
+ /* @__PURE__ */ N("div", { className: p.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
1020
+ k.now !== null && /* @__PURE__ */ m("span", { className: p.now, "data-now": "", "data-schedule-overlay": "now mark", style: { left: `${k.now}px` } }),
1021
+ k.ticks.map((c) => /* @__PURE__ */ m("span", { className: p.tick, style: { left: `${c.x}px` }, children: c.x >= Le && c.x <= k.width - Le && (he === 1 || xt(c.wallClock, he)) && /* @__PURE__ */ m("span", { className: p.tickLabel, "data-schedule-overlay": "time label", children: k.step >= X ? Y.dateShort(new Date(c.wallClock)) : Y.time(new Date(c.wallClock), !1) }) }, c.wallClock))
993
1022
  ] }),
994
- /* @__PURE__ */ m(fe, { "aria-live": "polite", children: Z !== null && /* @__PURE__ */ m(
995
- yn,
1023
+ /* @__PURE__ */ m(ke, { "aria-live": "polite", children: tt !== null && /* @__PURE__ */ m(
1024
+ En,
996
1025
  {
997
- target: Z.target,
998
- lane: Z.lane === null ? null : e.data.lanes.find((u) => u.id === Z.lane)?.label ?? Z.lane
1026
+ target: tt.target,
1027
+ lane: tt.lane === null ? null : e.data.lanes.find((c) => c.id === tt.lane)?.label ?? tt.lane
999
1028
  },
1000
- Z.count
1029
+ tt.count
1001
1030
  ) }),
1002
- /* @__PURE__ */ m(fe, { id: it, children: `${P.scheduleSummary({ ...Mt, from: le(Mt.from), to: le(Mt.to) })} ${P.scheduleKeyHelp}` })
1031
+ /* @__PURE__ */ m(ke, { id: Tt, children: k === e.getServerSnapshot() ? R.scheduleKeyHelp : `${R.scheduleSummary({ ...It, from: ce(It.from), to: ce(It.to) })} ${R.scheduleKeyHelp}` })
1003
1032
  ]
1004
1033
  }
1005
1034
  ),
1006
- ut
1035
+ ds
1007
1036
  ] });
1008
1037
  }
1009
- function An(s) {
1038
+ function Hn(s) {
1010
1039
  try {
1011
1040
  return s.matches(":focus-visible");
1012
1041
  } catch {
1013
1042
  return !0;
1014
1043
  }
1015
1044
  }
1016
- function Cn({ id: s, label: t }) {
1017
- const e = Ge(), n = K(() => ({ id: s, label: t ?? s, ...e === null ? {} : { parent: e } }), [s, t, e]);
1018
- return Is(n), null;
1045
+ function Yn({ id: s, label: t }) {
1046
+ const e = je(), n = W(() => ({ id: s, label: t ?? s, ...e === null ? {} : { parent: e } }), [s, t, e]);
1047
+ return Rs(n), null;
1019
1048
  }
1020
- function Dn({ id: s, label: t, children: e }) {
1021
- const n = Ge(), i = K(() => ({ id: s, label: t ?? s, ...n === null ? {} : { parent: n } }), [s, t, n]);
1022
- return Ls(i), /* @__PURE__ */ m($e, { value: s, children: e });
1049
+ function Kn({ id: s, label: t, children: e }) {
1050
+ const n = je(), i = W(() => ({ id: s, label: t ?? s, ...n === null ? {} : { parent: n } }), [s, t, n]);
1051
+ return Ns(i), /* @__PURE__ */ m(Ve, { value: s, children: e });
1023
1052
  }
1024
- function _n({ data: s, tasks: t }) {
1025
- const e = K(() => ({ kind: "subtasks", data: s, tasks: t }), [s, t]);
1026
- return yt("Subtasks", e), null;
1053
+ function Vn({ data: s, tasks: t }) {
1054
+ const e = W(() => ({ kind: "subtasks", data: s, tasks: t }), [s, t]);
1055
+ return bt("Subtasks", e), null;
1027
1056
  }
1028
- function Fn({ data: s }) {
1029
- const t = K(() => ({ kind: "dependencies", data: s }), [s]);
1030
- return yt("Dependencies", t), null;
1057
+ function jn({ data: s }) {
1058
+ const t = W(() => ({ kind: "dependencies", data: s }), [s]);
1059
+ return bt("Dependencies", t), null;
1031
1060
  }
1032
- function On({ data: s }) {
1033
- const t = K(() => ({ kind: "blocked", data: s }), [s]);
1034
- return yt("BlockedTimes", t), null;
1061
+ function Wn({ data: s }) {
1062
+ const t = W(() => ({ kind: "blocked", data: s }), [s]);
1063
+ return bt("BlockedTimes", t), null;
1035
1064
  }
1036
- function En({ data: s }) {
1037
- const t = K(() => ({ kind: "milestones", data: s }), [s]);
1038
- return yt("Milestones", t), null;
1065
+ function zn({ data: s }) {
1066
+ const t = W(() => ({ kind: "milestones", data: s }), [s]);
1067
+ return bt("Milestones", t), null;
1039
1068
  }
1040
- class Rn {
1069
+ class Un {
1041
1070
  /** `changed` is called after every registration change. */
1042
1071
  constructor(t) {
1043
1072
  this.changed = t;
@@ -1109,7 +1138,7 @@ class Rn {
1109
1138
  this.subtasks.push(...e.data);
1110
1139
  for (const n of e.tasks) this.tasks.set(n.id, n);
1111
1140
  } else e.kind === "dependencies" ? this.dependencies.push(...e.data) : e.kind === "milestones" ? this.milestones.push(...e.data) : this.blocked.push(...e.data);
1112
- return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = Wt(this.subtasks), this.violatedById = new Map(zt(this.subtasks, this.dependencies).map((e) => [e.dependency, e])), this.depth = Ms(this.subtasks), this.inBlocked = Be(this.subtasks, this.blocked), !0;
1141
+ return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = Ut(this.subtasks), this.violatedById = new Map(Xt(this.subtasks, this.dependencies).map((e) => [e.dependency, e])), this.depth = Es(this.subtasks), this.inBlocked = Ye(this.subtasks, this.blocked), !0;
1113
1142
  }
1114
1143
  /** The task a dependency belongs to: its departing subtask's. */
1115
1144
  taskOfDependency(t) {
@@ -1135,60 +1164,60 @@ class Rn {
1135
1164
  };
1136
1165
  }
1137
1166
  }
1138
- const Nn = 6;
1139
- function qe(s, t, e, n, i, o) {
1167
+ const Xn = 6;
1168
+ function es(s, t, e, n, i, o) {
1140
1169
  s.save(), s.beginPath(), s.rect(t, e, n, i), s.clip(), s.globalAlpha = 0.35, s.strokeStyle = o, s.lineWidth = 1, s.beginPath();
1141
- for (let r = t - i; r < t + n + i; r += Nn)
1170
+ for (let r = t - i; r < t + n + i; r += Xn)
1142
1171
  s.moveTo(r, e + i), s.lineTo(r + i, e);
1143
1172
  s.stroke(), s.restore();
1144
1173
  }
1145
- function Pn(s, t, e, n) {
1174
+ function qn(s, t, e, n) {
1146
1175
  if (n.size === 0) return;
1147
1176
  const { width: i, height: o } = t.view;
1148
1177
  for (const r of n) {
1149
- const a = j(e, r);
1178
+ const a = J(e, r);
1150
1179
  if (a === null) continue;
1151
1180
  const { top: l, height: d } = a;
1152
- l + d < 0 || l > o || (s.globalAlpha = 0.6, s.fillStyle = t.colours.surface, s.fillRect(0, l, i, d), s.globalAlpha = 1, qe(s, 0, l, i, d, t.colours.muted));
1181
+ l + d < 0 || l > o || (s.globalAlpha = 0.6, s.fillStyle = t.colours.surface, s.fillRect(0, l, i, d), s.globalAlpha = 1, es(s, 0, l, i, d, t.colours.muted));
1153
1182
  }
1154
1183
  }
1155
- function Bn(s, t, e) {
1184
+ function Jn(s, t, e) {
1156
1185
  const { data: n } = t;
1157
1186
  if (n.violatedById.size !== 0)
1158
1187
  for (const i of n.violatedById.values()) {
1159
- const o = n.dependencies.find((c) => c.id === i.dependency), r = o === void 0 ? void 0 : n.subtaskById.get(o.to);
1188
+ const o = n.dependencies.find((u) => u.id === i.dependency), r = o === void 0 ? void 0 : n.subtaskById.get(o.to);
1160
1189
  if (r === void 0) continue;
1161
- const a = j(e, r.lane);
1190
+ const a = J(e, r.lane);
1162
1191
  if (a === null || !a.miniature) continue;
1163
- const l = et(e.rows, a.top + e.scrollY);
1192
+ const l = nt(e.rows, a.top + e.scrollY);
1164
1193
  if (l === null) continue;
1165
- const d = R(e, i.arrival), h = Math.max(d + 2, R(e, i.arrival + i.shortBy));
1166
- Pt(s, t, d, h, l.top - e.scrollY + 1, 3);
1194
+ const d = x(e, i.arrival), h = Math.max(d + 2, x(e, i.arrival + i.shortBy));
1195
+ $t(s, t, d, h, l.top - e.scrollY + 1, 3);
1167
1196
  }
1168
1197
  }
1169
- function Pt(s, t, e, n, i, o) {
1198
+ function $t(s, t, e, n, i, o) {
1170
1199
  if (!t.colours.forced) {
1171
1200
  s.fillStyle = t.colours.alarm, s.fillRect(e, i, n - e, o);
1172
1201
  return;
1173
1202
  }
1174
1203
  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([]);
1175
1204
  }
1176
- function xn(s, t, e, n) {
1177
- const i = j(e, n.lane);
1205
+ function Zn(s, t, e, n) {
1206
+ const i = J(e, n.lane);
1178
1207
  if (i === null || i.top + i.height < 0 || i.top > t.view.height) return;
1179
- const o = Math.max(0, R(e, n.from)), r = Math.min(t.view.width, R(e, n.to));
1180
- r <= o || (s.globalAlpha = 0.1, s.fillStyle = t.colours.muted, s.fillRect(o, i.top, r - o, i.height), s.globalAlpha = 1, qe(s, o, i.top, r - o, i.height, t.colours.muted));
1208
+ const o = Math.max(0, x(e, n.from)), r = Math.min(t.view.width, x(e, n.to));
1209
+ r <= o || (s.globalAlpha = 0.1, s.fillStyle = t.colours.muted, s.fillRect(o, i.top, r - o, i.height), s.globalAlpha = 1, es(s, o, i.top, r - o, i.height, t.colours.muted));
1181
1210
  }
1182
- function Bt(s, t, e, n) {
1183
- const i = j(e, n.lane);
1211
+ function Gt(s, t, e, n) {
1212
+ const i = J(e, n.lane);
1184
1213
  if (i === null) return;
1185
- const o = R(e, n.from), r = Math.max(o + 2, R(e, n.to));
1186
- 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, Pt(s, t, o, r, i.top + 1, Math.min(3, Math.max(1, i.height - 1))), i.miniature) {
1187
- const a = et(e.rows, i.top + e.scrollY);
1188
- a !== null && Pt(s, t, o, r, a.top - e.scrollY + 1, 3);
1214
+ const o = x(e, n.from), r = Math.max(o + 2, x(e, n.to));
1215
+ 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, $t(s, t, o, r, i.top + 1, Math.min(3, Math.max(1, i.height - 1))), i.miniature) {
1216
+ const a = nt(e.rows, i.top + e.scrollY);
1217
+ a !== null && $t(s, t, o, r, a.top - e.scrollY + 1, 3);
1189
1218
  }
1190
1219
  }
1191
- const $n = {
1220
+ const Qn = {
1192
1221
  line: "var(--u-hairline)",
1193
1222
  lineStrong: "var(--u-hairline-strong)",
1194
1223
  text: "var(--u-color-text)",
@@ -1202,7 +1231,7 @@ const $n = {
1202
1231
  /* What text and marks take ON a filled bar - the same token the bar labels
1203
1232
  use in CSS, so a cap and the label beside it are one colour. */
1204
1233
  onAccent: "var(--u-color-on-accent)"
1205
- }, je = {
1234
+ }, ss = {
1206
1235
  line: "GrayText",
1207
1236
  lineStrong: "CanvasText",
1208
1237
  text: "CanvasText",
@@ -1212,11 +1241,11 @@ const $n = {
1212
1241
  active: "Highlight",
1213
1242
  now: "GrayText",
1214
1243
  onAccent: "Canvas"
1215
- }, Gn = (s) => s ? je : $n, Hn = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(forced-colors: active)").matches;
1216
- function Yn(s, t) {
1217
- const e = Hn(), n = {};
1218
- for (const r of t.tasks.values()) n[`task:${r.id}`] = e ? je.text : r.color;
1219
- const i = ps(s, { ...Gn(e), ...n }), o = /* @__PURE__ */ new Map();
1244
+ }, ti = (s) => s ? ss : Qn, ei = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(forced-colors: active)").matches;
1245
+ function si(s, t) {
1246
+ const e = ei(), n = {};
1247
+ for (const r of t.tasks.values()) n[`task:${r.id}`] = e ? ss.text : r.color;
1248
+ const i = Ss(s, { ...ti(e), ...n }), o = /* @__PURE__ */ new Map();
1220
1249
  for (const r of t.tasks.values()) o.set(r.id, i[`task:${r.id}`] ?? r.color);
1221
1250
  return {
1222
1251
  line: i.line,
@@ -1232,123 +1261,123 @@ function Yn(s, t) {
1232
1261
  forced: e
1233
1262
  };
1234
1263
  }
1235
- function ht(s) {
1264
+ function ft(s) {
1236
1265
  const t = s.match(/[\d.]+/g);
1237
1266
  return t === null || t.length < 3 ? null : [Number(t[0]), Number(t[1]), Number(t[2])];
1238
1267
  }
1239
- function Me(s) {
1240
- const t = ht(s);
1241
- return t === null ? 0 : Ze(Je(t));
1268
+ function Ae(s) {
1269
+ const t = ft(s);
1270
+ return t === null ? 0 : is(ns(t));
1242
1271
  }
1243
- function Je(s) {
1272
+ function ns(s) {
1244
1273
  return s.map((t) => {
1245
1274
  const e = t / 255;
1246
1275
  return e <= 0.04045 ? e / 12.92 : ((e + 0.055) / 1.055) ** 2.4;
1247
1276
  });
1248
1277
  }
1249
- function Ze([s, t, e]) {
1278
+ function is([s, t, e]) {
1250
1279
  return 0.2126 * s + 0.7152 * t + 0.0722 * e;
1251
1280
  }
1252
- function Te(s, t) {
1253
- const e = Me(s), n = Me(t);
1281
+ function Ce(s, t) {
1282
+ const e = Ae(s), n = Ae(t);
1254
1283
  return (Math.max(e, n) + 0.05) / (Math.min(e, n) + 0.05);
1255
1284
  }
1256
- function Se(s, t, e) {
1285
+ function De(s, t, e) {
1257
1286
  if (s === null) return null;
1258
1287
  const n = typeof window > "u" ? 1 : window.devicePixelRatio || 1, i = Math.round(t * n), o = Math.round(e * n);
1259
1288
  s.width !== i && (s.width = i), s.height !== o && (s.height = o);
1260
1289
  const r = s.getContext("2d");
1261
1290
  return r === null ? null : (r.setTransform(n, 0, 0, n, 0, 0), r.clearRect(0, 0, t, e), r);
1262
1291
  }
1263
- function Kn(s, t) {
1292
+ function ni(s, t) {
1264
1293
  const { data: e, view: n } = t, i = n.viewport();
1265
- zn(s, t, i);
1266
- for (const o of e.blocked) xn(s, t, i, o);
1267
- Un(s, t);
1294
+ ri(s, t, i);
1295
+ for (const o of e.blocked) Zn(s, t, i, o);
1296
+ ai(s, t);
1268
1297
  for (const o of e.layers) {
1269
1298
  if (o.kind === "blocked" || o.kind === "milestones") continue;
1270
1299
  const r = new Set(o.data);
1271
1300
  if (o.kind === "dependencies")
1272
- for (const a of n.paths) r.has(a.dependency) && Es(a, n.width, n.height) && xt(s, t, a, !1);
1301
+ for (const a of n.paths) r.has(a.dependency) && zs(a, n.width, n.height) && Ht(s, t, a, !1);
1273
1302
  else
1274
- for (const a of n.boxes) r.has(a.subtask) && ts(s, t, a, 1);
1303
+ for (const a of n.boxes) r.has(a.subtask) && rs(s, t, a, 1);
1275
1304
  }
1276
- for (const o of e.overlaps) Bt(s, t, i, o);
1277
- for (const o of e.inBlocked) Bt(s, t, i, o);
1278
- Bn(s, t, i);
1279
- for (const o of e.milestones) es(s, t, i, o, !1);
1280
- ei(s, t);
1305
+ for (const o of e.overlaps) Gt(s, t, i, o);
1306
+ for (const o of e.inBlocked) Gt(s, t, i, o);
1307
+ Jn(s, t, i);
1308
+ for (const o of e.milestones) as(s, t, i, o, !1);
1309
+ pi(s, t);
1281
1310
  }
1282
- function Vn(s, t) {
1311
+ function ii(s, t) {
1283
1312
  const { view: e, hover: n } = t, i = e.viewport();
1284
1313
  if (t.ghost === null) {
1285
1314
  if (n.kind === "subtask") {
1286
- const c = e.boxById.get(n.subtask.id);
1287
- c !== void 0 && Qn(s, t, c);
1315
+ const u = e.boxById.get(n.subtask.id);
1316
+ u !== void 0 && fi(s, t, u);
1288
1317
  } else if (n.kind === "dependency") {
1289
- const c = e.paths.find((f) => f.dependency === n.dependency);
1290
- c !== void 0 && xt(s, t, c, !0);
1291
- } else n.kind === "milestone" && es(s, t, i, n.milestone, !0);
1318
+ const u = e.paths.find((f) => f.dependency === n.dependency);
1319
+ u !== void 0 && Ht(s, t, u, !0);
1320
+ } else n.kind === "milestone" && as(s, t, i, n.milestone, !0);
1292
1321
  return;
1293
1322
  }
1294
1323
  const o = t.ghost, { ghost: r, overlaps: a, violated: l } = o;
1295
- Pn(s, t, i, o.refusedLanes);
1296
- const d = Qe(i, r);
1324
+ qn(s, t, i, o.refusedLanes);
1325
+ const d = os(i, r);
1297
1326
  if (d === null) return;
1298
- for (const c of a) Bt(s, t, i, c);
1299
- const h = new Set(l.map((c) => c.dependency));
1300
- for (const c of t.data.dependencies) {
1301
- if (c.from !== r.id && c.to !== r.id) continue;
1302
- const f = e.boxById.get(c.from === r.id ? c.to : c.from);
1327
+ for (const u of a) Gt(s, t, i, u);
1328
+ const h = new Set(l.map((u) => u.dependency));
1329
+ for (const u of t.data.dependencies) {
1330
+ if (u.from !== r.id && u.to !== r.id) continue;
1331
+ const f = e.boxById.get(u.from === r.id ? u.to : u.from);
1303
1332
  if (f === void 0) continue;
1304
- const p = c.from === r.id ? Rt(i, c, d, f, e.options) : Rt(i, c, f, d, e.options);
1305
- xt(s, t, p, !0, h.has(c.id));
1333
+ const g = u.from === r.id ? Nt(i, u, d, f, e.options) : Nt(i, u, f, d, e.options);
1334
+ Ht(s, t, g, !0, h.has(u.id));
1306
1335
  }
1307
- ts(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 && Wn(s, t, d, o.tether);
1336
+ rs(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 && oi(s, t, d, o.tether);
1308
1337
  }
1309
- function Wn(s, t, e, n) {
1338
+ function oi(s, t, e, n) {
1310
1339
  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));
1311
1340
  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([]));
1312
1341
  }
1313
- function Qe(s, t) {
1314
- const e = Xt(s.rows, t.lane);
1315
- return e === null ? null : Ke(s, t, e, 0);
1342
+ function os(s, t) {
1343
+ const e = Jt(s.rows, t.lane);
1344
+ return e === null ? null : Xe(s, t, e, 0);
1316
1345
  }
1317
- function zn(s, t, e) {
1346
+ function ri(s, t, e) {
1318
1347
  const { view: n, colours: i, bands: o } = t, { width: r, height: a } = n;
1319
1348
  s.lineWidth = 1, s.strokeStyle = i.line, s.beginPath();
1320
1349
  for (const h of o.ticks)
1321
1350
  s.moveTo(h.x + 0.5, 0), s.lineTo(h.x + 0.5, a);
1322
1351
  for (const h of e.rows.rows) {
1323
- const c = h.top + h.height - e.scrollY - 0.5;
1324
- c < 0 || c > a || (s.moveTo(0, c), s.lineTo(r, c));
1352
+ const u = h.top + h.height - e.scrollY - 0.5;
1353
+ u < 0 || u > a || (s.moveTo(0, u), s.lineTo(r, u));
1325
1354
  }
1326
- const l = [...e.rows.slots.values()].filter((h) => h.miniature).sort((h, c) => h.top - c.top);
1327
- l.forEach((h, c) => {
1328
- const f = l[c + 1];
1355
+ const l = [...e.rows.slots.values()].filter((h) => h.miniature).sort((h, u) => h.top - u.top);
1356
+ l.forEach((h, u) => {
1357
+ const f = l[u + 1];
1329
1358
  if (f === void 0 || f.top !== h.top + h.height || f.group === h.group) return;
1330
- const p = h.top + h.height - e.scrollY - 0.5;
1331
- p < 0 || p > a || (s.moveTo(0, p), s.lineTo(r, p));
1359
+ const g = h.top + h.height - e.scrollY - 0.5;
1360
+ g < 0 || g > a || (s.moveTo(0, g), s.lineTo(r, g));
1332
1361
  }), s.stroke(), s.strokeStyle = i.lineStrong, s.beginPath();
1333
1362
  for (const h of o.days)
1334
1363
  s.moveTo(h.x + 0.5, 0), s.lineTo(h.x + 0.5, a);
1335
1364
  s.stroke();
1336
- const d = gs(n.options.calendar);
1365
+ const d = Is(n.options.calendar);
1337
1366
  if (d.length > 0) {
1338
1367
  s.strokeStyle = i.muted, s.setLineDash([2, 3]), s.beginPath();
1339
1368
  for (const h of d) {
1340
- const c = Math.round(e.scale.toPx(h.workingTime)) + 0.5;
1341
- c < 0 || c > r || (s.moveTo(c, 0), s.lineTo(c, a));
1369
+ const u = Math.round(e.scale.toPx(h.workingTime)) + 0.5;
1370
+ u < 0 || u > r || (s.moveTo(u, 0), s.lineTo(u, a));
1342
1371
  }
1343
1372
  s.stroke(), s.setLineDash([]);
1344
1373
  }
1345
1374
  }
1346
- function Un(s, t) {
1375
+ function ai(s, t) {
1347
1376
  const e = t.view.nowX();
1348
1377
  e !== null && (s.fillStyle = t.colours.now, s.fillRect(e, 0, 2, t.view.height));
1349
1378
  }
1350
- function Xn(s, t, e, n) {
1351
- const i = ct(t.colours, t, e.subtask.task, e.subtask.id);
1379
+ function li(s, t, e, n) {
1380
+ const i = mt(t.colours, t, e.subtask.task, e.subtask.id);
1352
1381
  s.fillStyle = i;
1353
1382
  for (const [o, r] of [
1354
1383
  [e.outerFrom, e.mainFrom],
@@ -1357,101 +1386,101 @@ function Xn(s, t, e, n) {
1357
1386
  r <= o || (s.globalAlpha = 0.28 * n, s.fillRect(o, e.y, r - o, e.height));
1358
1387
  s.globalAlpha = n, s.fillRect(e.mainFrom, e.y, Math.max(1, e.mainTo - e.mainFrom), e.height), s.globalAlpha = 1;
1359
1388
  }
1360
- function jt(s, t, e) {
1389
+ function Qt(s, t, e) {
1361
1390
  if (s.dashed) return { fill: null, onDark: !1 };
1362
- const n = s.muted ? qn(t, e.surface, 0.5) : t;
1363
- return { fill: n, onDark: Te(n, e.onAccent) > Te(n, e.text) };
1391
+ const n = s.muted ? di(t, e.surface, 0.5) : t;
1392
+ return { fill: n, onDark: Ce(n, e.onAccent) > Ce(n, e.text) };
1364
1393
  }
1365
- function qn(s, t, e) {
1366
- const n = ht(s), i = ht(t);
1394
+ function di(s, t, e) {
1395
+ const n = ft(s), i = ft(t);
1367
1396
  if (n === null || i === null) return s;
1368
1397
  const o = (r) => Math.round(n[r] + (i[r] - n[r]) * e);
1369
1398
  return `rgb(${o(0)}, ${o(1)}, ${o(2)})`;
1370
1399
  }
1371
- function Ie(s, t) {
1372
- const e = ht(s);
1400
+ function _e(s, t) {
1401
+ const e = ft(s);
1373
1402
  if (e === null || t === 0) return s;
1374
- const n = Je(e), i = Ze(n), [o, r, a] = n.map((l) => {
1403
+ const n = ns(e), i = is(n), [o, r, a] = n.map((l) => {
1375
1404
  const d = l + (i - l) * t, h = d <= 31308e-7 ? d * 12.92 : 1.055 * d ** (1 / 2.4) - 0.055;
1376
1405
  return Math.round(Math.min(1, Math.max(0, h)) * 255);
1377
1406
  });
1378
1407
  return `rgb(${o}, ${r}, ${a})`;
1379
1408
  }
1380
- function ct(s, t, e, n) {
1409
+ function mt(s, t, e, n) {
1381
1410
  const i = (e === null ? void 0 : s.tasks.get(e)) ?? s.muted;
1382
- return t.selectedTask === null ? i : e !== t.selectedTask ? s.forced ? s.muted : Ie(i, 1) : s.forced || t.selectedSubtask === null || n === null || n === t.selectedSubtask ? i : Ie(i, 0.5);
1411
+ return t.selectedTask === null ? i : e !== t.selectedTask ? s.forced ? s.muted : _e(i, 1) : s.forced || t.selectedSubtask === null || n === null || n === t.selectedSubtask ? i : _e(i, 0.5);
1383
1412
  }
1384
- const jn = 2;
1385
- function ts(s, t, e, n) {
1413
+ const hi = 2;
1414
+ function rs(s, t, e, n) {
1386
1415
  const { view: i, colours: o } = t;
1387
- if (!Et(e, i.width, i.height)) return;
1416
+ if (!Rt(e, i.width, i.height)) return;
1388
1417
  if (e.miniature) {
1389
- Xn(s, t, e, n);
1418
+ li(s, t, e, n);
1390
1419
  return;
1391
1420
  }
1392
- const r = vt(e.subtask.appearance), a = ct(o, t, e.subtask.task, e.subtask.id), l = jt(r, a, o), d = e.y, h = e.height, c = Math.max(1, e.mainTo - e.mainFrom), f = l.onDark ? o.onAccent : o.text;
1421
+ const r = wt(e.subtask.appearance), a = mt(o, t, e.subtask.task, e.subtask.id), l = Qt(r, a, o), d = e.y, h = e.height, u = Math.max(1, e.mainTo - e.mainFrom), f = l.onDark ? o.onAccent : o.text;
1393
1422
  s.lineWidth = 1, s.fillStyle = a, s.strokeStyle = a;
1394
- for (const [k, A] of [
1423
+ for (const [v, D] of [
1395
1424
  [e.outerFrom, e.mainFrom],
1396
1425
  [e.mainTo, e.outerTo]
1397
1426
  ])
1398
- A <= k || (s.globalAlpha = 0.28 * n, s.fillRect(k, d, A - k, h), s.globalAlpha = n, s.strokeRect(k + 0.5, d + 0.5, A - k - 1, h - 1));
1399
- l.fill !== null && (s.globalAlpha = n, s.fillStyle = l.fill, s.fillRect(e.mainFrom, d, c, h));
1400
- const p = e.subtask.progress;
1401
- if (p !== void 0) {
1402
- const k = Math.min(4, Math.max(2, Math.round(h / 6))), A = d + h - k - jn, I = Math.round(c * Math.max(0, Math.min(1, p)));
1403
- s.fillStyle = l.fill === null ? a : f, s.globalAlpha = 0.3 * n, s.fillRect(e.mainFrom, A, c, k), s.globalAlpha = n, I > 0 && s.fillRect(e.mainFrom, A, I, k);
1427
+ D <= v || (s.globalAlpha = 0.28 * n, s.fillRect(v, d, D - v, h), s.globalAlpha = n, s.strokeRect(v + 0.5, d + 0.5, D - v - 1, h - 1));
1428
+ l.fill !== null && (s.globalAlpha = n, s.fillStyle = l.fill, s.fillRect(e.mainFrom, d, u, h));
1429
+ const g = e.subtask.progress;
1430
+ if (g !== void 0) {
1431
+ const v = Math.min(4, Math.max(2, Math.round(h / 6))), D = d + h - v - hi, L = Math.round(u * Math.max(0, Math.min(1, g)));
1432
+ s.fillStyle = l.fill === null ? a : f, s.globalAlpha = 0.3 * n, s.fillRect(e.mainFrom, D, u, v), s.globalAlpha = n, L > 0 && s.fillRect(e.mainFrom, D, L, v);
1404
1433
  }
1405
1434
  if (r.hatched) {
1406
- const k = Math.max(1, Math.min(Ye, Math.floor((c - 2 * ot) / 3))), A = c >= 4 * k ? ot : 0, I = h >= 4 * ot ? ot : 0;
1407
- s.globalAlpha = n, s.fillStyle = f, s.fillRect(e.mainFrom + A, d + I, k, h - 2 * I), s.fillRect(e.mainTo - A - k, d + I, k, h - 2 * I);
1435
+ const v = Math.max(1, Math.min(Ue, Math.floor((u - 2 * lt) / 3))), D = u >= 4 * v ? lt : 0, L = h >= 4 * lt ? lt : 0;
1436
+ s.globalAlpha = n, s.fillStyle = f, s.fillRect(e.mainFrom + D, d + L, v, h - 2 * L), s.fillRect(e.mainTo - D - v, d + L, v, h - 2 * L);
1408
1437
  }
1409
- r.open && Zn(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));
1438
+ r.open && ui(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, u - 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));
1410
1439
  }
1411
- const Jn = 16;
1412
- function Zn(s, t, e, n, i, o) {
1413
- 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(Jn, l);
1414
- r && Le(s, 0, d, e, n, i), a && Le(s, o, -d, e, n, i);
1440
+ const ci = 16;
1441
+ function ui(s, t, e, n, i, o) {
1442
+ 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(ci, l);
1443
+ r && Oe(s, 0, d, e, n, i), a && Oe(s, o, -d, e, n, i);
1415
1444
  }
1416
- function Le(s, t, e, n, i, o) {
1445
+ function Oe(s, t, e, n, i, o) {
1417
1446
  const r = s.createLinearGradient(t, 0, t + e, 0);
1418
- r.addColorStop(0, Ae(o, 1)), r.addColorStop(1, Ae(o, 0)), s.globalAlpha = 1, s.fillStyle = r, s.fillRect(Math.min(t, t + e), n, Math.abs(e), i);
1447
+ r.addColorStop(0, Fe(o, 1)), r.addColorStop(1, Fe(o, 0)), s.globalAlpha = 1, s.fillStyle = r, s.fillRect(Math.min(t, t + e), n, Math.abs(e), i);
1419
1448
  }
1420
- function Ae(s, t) {
1421
- const e = ht(s);
1449
+ function Fe(s, t) {
1450
+ const e = ft(s);
1422
1451
  return e === null ? s : `rgba(${e[0]}, ${e[1]}, ${e[2]}, ${t})`;
1423
1452
  }
1424
- function xt(s, t, e, n, i) {
1425
- 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 : ct(r, t, a, null);
1453
+ function Ht(s, t, e, n, i) {
1454
+ 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 : mt(r, t, a, null);
1426
1455
  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")
1427
1456
  s.bezierCurveTo(e.c1x, e.y1, e.c2x, e.y2, e.x2, e.y2);
1428
1457
  else
1429
- for (let c = 2; c + 1 < e.points.length; c += 2) s.lineTo(e.points[c], e.points[c + 1]);
1458
+ for (let u = 2; u + 1 < e.points.length; u += 2) s.lineTo(e.points[u], e.points[u + 1]);
1430
1459
  if (s.stroke(), s.setLineDash([]), e.ends === "dot")
1431
- for (const [c, f] of [
1460
+ for (const [u, f] of [
1432
1461
  [e.x1, e.y1],
1433
1462
  [e.x2, e.y2]
1434
1463
  ])
1435
- s.beginPath(), s.arc(c, f, l ? 3 : 2.5, 0, Math.PI * 2), s.fill();
1464
+ s.beginPath(), s.arc(u, f, l ? 3 : 2.5, 0, Math.PI * 2), s.fill();
1436
1465
  }
1437
- function es(s, t, e, n, i) {
1438
- const o = qt(e, n);
1466
+ function as(s, t, e, n, i) {
1467
+ const o = Zt(e, n);
1439
1468
  if (o === null || o.x < -o.half || o.x > t.view.width + o.half) return;
1440
1469
  const r = (a) => {
1441
1470
  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();
1442
1471
  };
1443
1472
  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();
1444
1473
  }
1445
- function Qn(s, t, e) {
1446
- const { colours: n } = t, i = vt(e.subtask.appearance), o = jt(i, ct(n, t, e.subtask.task, e.subtask.id), n);
1474
+ function fi(s, t, e) {
1475
+ const { colours: n } = t, i = wt(e.subtask.appearance), o = Qt(i, mt(n, t, e.subtask.task, e.subtask.id), n);
1447
1476
  if (n.forced) {
1448
1477
  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);
1449
1478
  return;
1450
1479
  }
1451
- s.globalAlpha = ti, 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;
1480
+ s.globalAlpha = mi, 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;
1452
1481
  }
1453
- const ti = 0.2;
1454
- function ei(s, t) {
1482
+ const mi = 0.2;
1483
+ function pi(s, t) {
1455
1484
  const e = t.selectedTask;
1456
1485
  if (e !== null) {
1457
1486
  s.strokeStyle = t.colours.text;
@@ -1464,30 +1493,30 @@ function ei(s, t) {
1464
1493
  }
1465
1494
  }
1466
1495
  }
1467
- const mt = 32, si = 18;
1468
- function Ce(s, t) {
1469
- if (!(t > 2 * mt)) return 0;
1470
- const e = mt - s, n = s - (t - mt), i = Math.max(e, n);
1496
+ const gt = 32, gi = 18;
1497
+ function Ee(s, t) {
1498
+ if (!(t > 2 * gt)) return 0;
1499
+ const e = gt - s, n = s - (t - gt), i = Math.max(e, n);
1471
1500
  if (i <= 0) return 0;
1472
- const o = Math.min(1, i / mt), r = si * o * o;
1501
+ const o = Math.min(1, i / gt), r = gi * o * o;
1473
1502
  return e > 0 ? -r : r;
1474
1503
  }
1475
- function lt(s, t, e) {
1504
+ function ct(s, t, e) {
1476
1505
  const n = (i, o) => {
1477
- const r = st(i);
1506
+ const r = it(i);
1478
1507
  return i.lane === o.lane && r.from < o.to && o.from < r.to;
1479
1508
  };
1480
1509
  return e.some((i) => n(s, i) && !(t !== null && n(t, i)));
1481
1510
  }
1482
- function ni(s, t, e, n) {
1511
+ function ki(s, t, e, n) {
1483
1512
  const i = /* @__PURE__ */ new Set();
1484
1513
  if (n === void 0) return i;
1485
1514
  for (const o of s)
1486
1515
  o !== e && (n(t, o) || i.add(o));
1487
1516
  return i;
1488
1517
  }
1489
- const De = "\0placing", _e = /* @__PURE__ */ new Set();
1490
- function Ot(s) {
1518
+ const xe = "\0placing", Pe = /* @__PURE__ */ new Set();
1519
+ function Pt(s) {
1491
1520
  switch (s.kind) {
1492
1521
  case "subtask":
1493
1522
  return `subtask:${s.subtask.id}:${s.part}`;
@@ -1501,8 +1530,8 @@ function Ot(s) {
1501
1530
  return "nothing";
1502
1531
  }
1503
1532
  }
1504
- const Fe = 3, ii = 10, oi = 600;
1505
- class ri {
1533
+ const Re = 3, vi = 10, yi = 600;
1534
+ class wi {
1506
1535
  constructor(t) {
1507
1536
  this.host = t;
1508
1537
  }
@@ -1526,6 +1555,11 @@ class ri {
1526
1555
  /** The folded group the pointer is resting over, and the timer that will
1527
1556
  open it for this gesture. */
1528
1557
  resting = null;
1558
+ /** The finger's long press, armed by a touch on a bar that may be moved.
1559
+ `armed` is whether the press may still turn into a grab - and, once it
1560
+ has, whether the `contextmenu` Android fires for it is the grab's. */
1561
+ press = Fs((t) => this.grab(t));
1562
+ armed = !1;
1529
1563
  hover = { kind: "nothing" };
1530
1564
  /** Where the pointer rests on the plot while nothing is being dragged - or,
1531
1565
  where the keyboard set the hover, the point its tooltip stands at. */
@@ -1563,9 +1597,9 @@ class ri {
1563
1597
  ghostSummary() {
1564
1598
  const t = this.gesture;
1565
1599
  if (t.kind !== "edit" && t.kind !== "place") return null;
1566
- const e = Qe(this.host.view.viewport(), t.ghost);
1600
+ const e = os(this.host.view.viewport(), t.ghost);
1567
1601
  if (e === null) return null;
1568
- const n = this.ghostFindings(t.ghost, this.ghostHome(t)), i = t.kind === "edit" && (t.mode === "leadIn" || t.mode === "leadOut"), o = i ? st(t.ghost) : t.ghost;
1602
+ const n = this.ghostFindings(t.ghost, this.ghostHome(t)), i = t.kind === "edit" && (t.mode === "leadIn" || t.mode === "leadOut"), o = i ? it(t.ghost) : t.ghost;
1569
1603
  return {
1570
1604
  refused: this.refused,
1571
1605
  refusedLanes: [...t.refused],
@@ -1590,15 +1624,19 @@ class ri {
1590
1624
  const a = this.host.view;
1591
1625
  this.host.handlers().onInteraction?.({ type: t, hit: e, clientX: n, clientY: i, time: a.timeAt(o), lane: a.laneIdAt(r) });
1592
1626
  }
1627
+ /** The plan is on its way: no drag, no hover, no placing begins. One under
1628
+ way finishes and reports as usual. */
1629
+ loading = !1;
1593
1630
  pointerDown(t) {
1631
+ if (this.loading) return;
1594
1632
  const { x: e, y: n } = this.local(t.clientX, t.clientY);
1595
1633
  if (t.pointerType === "touch" && (this.touches.set(t.pointerId, { x: e, y: n }), this.touches.size >= 2)) {
1596
- this.gesture.kind !== "pinch" && (this.cancelEdit(), this.gesture = { kind: "pinch", distance: this.touchDistance() });
1634
+ this.press.dispose(), this.armed = !1, this.gesture.kind !== "pinch" && (this.cancelEdit(), this.gesture = { kind: "pinch", distance: this.touchDistance() });
1597
1635
  return;
1598
1636
  }
1599
1637
  if (t.button !== 0) return;
1600
1638
  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;
1601
- 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);
1639
+ t.pointerType === "touch" ? (this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: n, mode: "pan", subtask: null }, this.armed = this.modeAt(e, n).mode === "move", this.press.pointerDown(t)) : (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);
1602
1640
  }
1603
1641
  /** A drag over a folded group: resting on one opens it for the GESTURE.
1604
1642
 
@@ -1613,7 +1651,7 @@ class ri {
1613
1651
  group: n,
1614
1652
  timer: setTimeout(() => {
1615
1653
  this.resting = null, e.openForGesture = /* @__PURE__ */ new Set([...e.openForGesture, n]), this.host.viewChanged();
1616
- }, oi)
1654
+ }, yi)
1617
1655
  }));
1618
1656
  }
1619
1657
  stopResting() {
@@ -1641,9 +1679,9 @@ class ri {
1641
1679
  gesture that cannot change a lane at all asks nothing: the intents the
1642
1680
  caller handles decide whether the question exists. */
1643
1681
  askRefused(t, e) {
1644
- if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return _e;
1682
+ if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return Pe;
1645
1683
  const n = this.host.data.lanes.map((i) => i.id);
1646
- return ni(n, t, e, this.host.handlers().canMoveTo);
1684
+ return ki(n, t, e, this.host.handlers().canMoveTo);
1647
1685
  }
1648
1686
  /** What a press at a point would start, given the intents the caller handles. */
1649
1687
  modeAt(t, e) {
@@ -1652,40 +1690,25 @@ class ri {
1652
1690
  for (let o = n.boxes.length - 1; o >= 0; o--) {
1653
1691
  const r = n.boxes[o];
1654
1692
  if (i.includes("stretch")) {
1655
- const a = Os(r, t, e);
1693
+ const a = Ws(r, t, e);
1656
1694
  if (a !== null) return { mode: a === "from" ? "stretch-from" : "stretch-to", subtask: r.subtask };
1657
1695
  }
1658
- if (Ve(r, t, e) !== null)
1696
+ if (qe(r, t, e) !== null)
1659
1697
  return i.includes("move") || i.includes("lane") ? { mode: "move", subtask: r.subtask } : { mode: "pan", subtask: r.subtask };
1660
1698
  }
1661
1699
  return { mode: "pan", subtask: null };
1662
1700
  }
1663
1701
  pointerMove(t) {
1664
1702
  const { x: e, y: n } = this.local(t.clientX, t.clientY);
1665
- if (t.pointerType === "touch" && this.touches.has(t.pointerId) && (this.touches.set(t.pointerId, { x: e, y: n }), this.gesture.kind === "pinch")) {
1703
+ if (t.pointerType === "touch" && this.touches.has(t.pointerId) && (this.touches.set(t.pointerId, { x: e, y: n }), this.press.pointerMove(t), this.gesture.kind === "pinch")) {
1666
1704
  const r = this.touchDistance();
1667
1705
  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 };
1668
1706
  return;
1669
1707
  }
1670
1708
  const i = this.gesture;
1671
1709
  if (i.kind === "pending" && i.pointerId === t.pointerId) {
1672
- if (Math.hypot(e - i.x0, n - i.y0) < (t.pointerType === "touch" ? ii : Fe)) return;
1673
- if (i.mode === "pan" || i.subtask === null)
1674
- this.gesture = { kind: "pan", pointerId: i.pointerId, lastX: i.x0, lastY: i.y0 }, this.setCursor("grabbing");
1675
- else {
1676
- const r = this.host.view.viewport().scale.fromPx(i.x0);
1677
- this.gesture = {
1678
- kind: "edit",
1679
- pointerId: i.pointerId,
1680
- mode: i.mode,
1681
- subtask: i.subtask,
1682
- t0: r,
1683
- ghost: i.subtask,
1684
- /* Asked here, once, and drawn from the first frame of the drag: the
1685
- lanes that are closed are marked before the pointer reaches one. */
1686
- refused: i.mode === "move" ? this.askRefused(i.subtask, i.subtask.lane) : _e
1687
- }, this.setCursor(i.mode === "move" ? "grabbing" : "ew-resize");
1688
- }
1710
+ if (Math.hypot(e - i.x0, n - i.y0) < (t.pointerType === "touch" ? vi : Re)) return;
1711
+ i.mode === "pan" || i.subtask === null ? (this.gesture = { kind: "pan", pointerId: i.pointerId, lastX: i.x0, lastY: i.y0 }, this.setCursor("grabbing")) : this.startEdit(i, i.mode, i.subtask);
1689
1712
  }
1690
1713
  const o = this.gesture;
1691
1714
  if (o.kind === "pan" && o.pointerId === t.pointerId) {
@@ -1697,10 +1720,41 @@ class ri {
1697
1720
  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();
1698
1721
  return;
1699
1722
  }
1700
- o.kind === "none" && (this.byKeyboard = !1, this.hoverAt(t.clientX, t.clientY, e, n));
1723
+ o.kind === "none" && !this.loading && (this.byKeyboard = !1, this.hoverAt(t.clientX, t.clientY, e, n));
1724
+ }
1725
+ /** The drag of `subtask` in `mode`, taking hold where the pending press
1726
+ stands. */
1727
+ startEdit(t, e, n) {
1728
+ this.gesture = {
1729
+ kind: "edit",
1730
+ pointerId: t.pointerId,
1731
+ mode: e,
1732
+ subtask: n,
1733
+ /* The working time the drag took hold at - not a pixel, because
1734
+ auto-pan moves the scale under a drag in flight. */
1735
+ t0: this.host.view.viewport().scale.fromPx(t.x0),
1736
+ ghost: n,
1737
+ /* Asked here, once, and drawn from the first frame of the drag: the
1738
+ lanes that are closed are marked before the pointer reaches one. */
1739
+ refused: e === "move" ? this.askRefused(n, n.lane) : Pe
1740
+ }, this.setCursor(e === "move" ? "grabbing" : "ew-resize");
1741
+ }
1742
+ /** The finger has been held on a bar: the bar is grabbed, unless the finger
1743
+ has become a pan or a pinch in the meantime. */
1744
+ grab(t) {
1745
+ const e = this.gesture;
1746
+ if (!this.armed || this.loading || e.kind !== "pending") return;
1747
+ const { x: n, y: i } = this.local(t.x, t.y), { mode: o, subtask: r } = this.modeAt(e.x0, e.y0);
1748
+ o !== "move" || r === null || (this.lastClient = { x: t.x, y: t.y }, this.dragPoint = { x: n, y: i }, this.startEdit(e, o, r), this.host.interactionChanged());
1749
+ }
1750
+ /** The page's own scroll, while a bar is grabbed. Registered as not passive
1751
+ by the component: a passive listener cannot cancel it. Before the grab and
1752
+ after the lift the swipe is the page's (`viewChanged`). */
1753
+ touchMove(t) {
1754
+ this.gesture.kind === "edit" && this.touches.has(this.gesture.pointerId) && t.preventDefault();
1701
1755
  }
1702
1756
  pointerUp(t) {
1703
- if (t.pointerType === "touch" && (this.touches.delete(t.pointerId), this.gesture.kind === "pinch")) {
1757
+ if (t.pointerType === "touch" && (this.press.pointerUp(), this.armed = !1, this.touches.delete(t.pointerId), this.gesture.kind === "pinch")) {
1704
1758
  const [o] = this.touches;
1705
1759
  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" });
1706
1760
  return;
@@ -1711,6 +1765,10 @@ class ri {
1711
1765
  else if (e.kind === "pan" && e.pointerId === t.pointerId)
1712
1766
  this.gesture = { kind: "none" }, this.setCursor("default"), this.hoverAt(t.clientX, t.clientY, n, i);
1713
1767
  else if (e.kind === "edit" && e.pointerId === t.pointerId) {
1768
+ if (t.pointerType === "touch" && (n < 0 || i < 0 || n > this.host.view.width || i > this.host.view.height)) {
1769
+ this.cancelEdit();
1770
+ return;
1771
+ }
1714
1772
  this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" };
1715
1773
  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(
1716
1774
  (a) => o || a.kind !== "lane"
@@ -1728,7 +1786,7 @@ class ri {
1728
1786
  this.panFrame = 0;
1729
1787
  const e = this.gesture;
1730
1788
  if (e.kind !== "edit" && e.kind !== "place") return;
1731
- const n = this.host.view, { x: i, y: o } = this.local(this.lastClient.x, this.lastClient.y), r = Ce(i, n.width), a = Ce(o, n.height);
1789
+ const n = this.host.view, { x: i, y: o } = this.local(this.lastClient.x, this.lastClient.y), r = Ee(i, n.width), a = Ee(o, n.height);
1732
1790
  if (r === 0 && a === 0) return;
1733
1791
  const l = n.pan(r, a);
1734
1792
  if (l.moved) {
@@ -1747,7 +1805,7 @@ class ri {
1747
1805
  this.panFrame !== 0 && cancelAnimationFrame(this.panFrame), this.panFrame = 0;
1748
1806
  }
1749
1807
  pointerCancel(t) {
1750
- this.touches.delete(t.pointerId), this.closeGestureFolds(), this.cancelEdit(), this.gesture = { kind: "none" }, this.setCursor("default");
1808
+ this.press.pointerCancel(), this.armed = !1, this.touches.delete(t.pointerId), this.closeGestureFolds(), this.cancelEdit(), this.gesture = { kind: "none" }, this.setCursor("default");
1751
1809
  }
1752
1810
  /** Reads the hover anew where the pointer already is - after the data
1753
1811
  changed under it. A drop that moves a subtask changes what lies under the
@@ -1756,7 +1814,7 @@ class ri {
1756
1814
  refreshHover() {
1757
1815
  if (!this.idle || this.hoverKey === "nothing" || this.byKeyboard) return;
1758
1816
  const { x: t, y: e } = this.hoverPoint, n = this.host.view.hitAt(t, e);
1759
- this.hover = n, this.hoverKey = Ot(n);
1817
+ this.hover = n, this.hoverKey = Pt(n);
1760
1818
  }
1761
1819
  pointerLeave() {
1762
1820
  this.gesture.kind !== "none" || this.byKeyboard || this.setHover({ kind: "nothing" }, "nothing");
@@ -1767,8 +1825,7 @@ class ri {
1767
1825
  return this.gesture.kind !== "edit" && this.gesture.kind !== "place" ? !1 : (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.blocked = !1, this.cursor = "default", this.host.interactionChanged(), !0);
1768
1826
  }
1769
1827
  contextMenu(t) {
1770
- if (this.host.handlers().onInteraction === void 0) return;
1771
- t.preventDefault();
1828
+ if (this.host.handlers().onInteraction === void 0 || (t.preventDefault(), this.armed || this.editing || this.loading)) return;
1772
1829
  const { x: e, y: n } = this.local(t.clientX, t.clientY);
1773
1830
  this.report("contextmenu", this.host.view.hitAt(e, n), t.clientX, t.clientY, e, n);
1774
1831
  }
@@ -1801,7 +1858,7 @@ class ri {
1801
1858
  this.host.select(r, o.kind === "subtask" ? o.subtask.id : null), this.report("click", o, t, e, n, i);
1802
1859
  }
1803
1860
  hoverAt(t, e, n, i) {
1804
- const o = this.host.view.hitAt(n, i), r = Ot(o), { mode: a } = this.modeAt(n, i);
1861
+ const o = this.host.view.hitAt(n, i), r = Pt(o), { mode: a } = this.modeAt(n, i);
1805
1862
  if (this.setCursor(a === "move" ? "grab" : a === "stretch-from" || a === "stretch-to" ? "ew-resize" : "default"), this.hoverPoint = { x: n, y: i }, r === this.hoverKey) {
1806
1863
  (o.kind === "subtask" || o.kind === "dependency" || o.kind === "milestone") && this.host.hoverChanged();
1807
1864
  return;
@@ -1812,7 +1869,7 @@ class ri {
1812
1869
  pointer's would be - and reported to nobody, since `onInteraction`
1813
1870
  speaks of pointer positions. `nothing` hands the hover back. */
1814
1871
  setKeyboardHover(t, e) {
1815
- this.byKeyboard = t.kind !== "nothing", this.hoverPoint = e, this.hover = t, this.hoverKey = Ot(t), this.host.interactionChanged();
1872
+ this.byKeyboard = t.kind !== "nothing", this.hoverPoint = e, this.hover = t, this.hoverKey = Pt(t), this.host.interactionChanged();
1816
1873
  }
1817
1874
  setHover(t, e) {
1818
1875
  e !== this.hoverKey && (this.hoverKey = e, this.hover = t, this.host.hoverChanged());
@@ -1836,7 +1893,7 @@ class ri {
1836
1893
  shows where the work would land. */
1837
1894
  dragOver(t, e) {
1838
1895
  const n = this.host.view;
1839
- if (e === null || !n.options.intents.includes("place")) return;
1896
+ if (this.loading || e === null || !n.options.intents.includes("place")) return;
1840
1897
  const { x: i, y: o } = this.local(t.clientX, t.clientY);
1841
1898
  if (n.laneIdAt(o) === null && n.foldedGroupAt(o) === null) {
1842
1899
  this.clearPlacing();
@@ -1862,8 +1919,8 @@ class ri {
1862
1919
  const o = this.onLane(n);
1863
1920
  if (o === null) return { ghost: null, refused: !1, blocked: !1 };
1864
1921
  if (i.has(o)) return { ghost: null, refused: !0, blocked: !1 };
1865
- const r = { ...this.askedFor(t, o, e), id: De };
1866
- return lt(r, null, this.host.data.blocked) ? { ghost: null, refused: !1, blocked: !0 } : { ghost: r, refused: !1, blocked: !1 };
1922
+ const r = { ...this.askedFor(t, o, e), id: xe };
1923
+ return ct(r, null, this.host.data.blocked) ? { ghost: null, refused: !1, blocked: !0 } : { ghost: r, refused: !1, blocked: !1 };
1867
1924
  }
1868
1925
  /** The dragged item as a subtask, under the caller's key for it - not the
1869
1926
  internal sentinel: the rule is asked about the thing the application says
@@ -1920,19 +1977,19 @@ class ri {
1920
1977
  blocked time takes the ghost along again. */
1921
1978
  heldGhost(t, e, n) {
1922
1979
  const i = this.ghostFor(t, e, n);
1923
- return this.blocked = lt(i, t.subtask, this.host.data.blocked), this.blocked ? t.ghost : i;
1980
+ return this.blocked = ct(i, t.subtask, this.host.data.blocked), this.blocked ? t.ghost : i;
1924
1981
  }
1925
1982
  ghostFor(t, e, n) {
1926
1983
  const i = this.host.view, o = t.subtask, r = this.snapStep(), a = i.options.intents, l = this.snapInside(i.timeAt(e), r);
1927
1984
  switch (t.mode) {
1928
1985
  case "move": {
1929
1986
  let d = o.from;
1930
- const h = i.viewport().scale, c = h.fromPx(e) - t.t0;
1931
- a.includes("move") && Math.abs(c * h.m) >= Fe && (d = this.shifted(o.from, c, r));
1987
+ const h = i.viewport().scale, u = h.fromPx(e) - t.t0;
1988
+ a.includes("move") && Math.abs(u * h.m) >= Re && (d = this.shifted(o.from, u, r));
1932
1989
  let f = t.ghost.lane;
1933
1990
  if (a.includes("lane")) {
1934
- const p = this.onLane(n) ?? f;
1935
- this.refused = t.refused.has(p), this.refused || (f = p);
1991
+ const g = this.onLane(n) ?? f;
1992
+ this.refused = t.refused.has(g), this.refused || (f = g);
1936
1993
  } else
1937
1994
  this.refused = !1;
1938
1995
  return { ...o, from: d, to: d + (o.to - o.from), lane: f };
@@ -1951,15 +2008,15 @@ class ri {
1951
2008
  a start this way, and a key by one step of the raster - one arithmetic,
1952
2009
  so a key proposes exactly what a drag of that length would. */
1953
2010
  shifted(t, e, n) {
1954
- const i = gt(this.host.view.options.calendar), o = G(t, i) + e, r = dt(o, i);
2011
+ const i = vt(this.host.view.options.calendar), o = H(t, i) + e, r = ut(o, i);
1955
2012
  return this.snapInside(r, n);
1956
2013
  }
1957
2014
  /** Snapped - and, where the raster lands in time the calendar removes, moved
1958
2015
  on to the seam, where time counts again. An intent never asks for a time
1959
2016
  nobody works. */
1960
2017
  snapInside(t, e) {
1961
- const n = Ts(t, e), i = gt(this.host.view.options.calendar);
1962
- return i.intervals.length === 0 ? n : Gt(G(n, i), i);
2018
+ const n = xs(t, e), i = vt(this.host.view.options.calendar);
2019
+ return i.intervals.length === 0 ? n : Kt(H(n, i), i);
1963
2020
  }
1964
2021
  intentsOf(t, e, n) {
1965
2022
  const i = [], o = this.host.view.options.intents, r = t.id;
@@ -1979,28 +2036,28 @@ class ri {
1979
2036
  keeps a plan of hundreds of tasks fluid while a drag runs, since this is
1980
2037
  computed on every pointer movement. */
1981
2038
  ghostFindings(t, e) {
1982
- 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 === De ? n.subtasks : n.subtasks.map((h) => h.id === t.id ? t : h);
1983
- return { overlaps: Wt(r).filter(a), violated: zt(d, l) };
2039
+ 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 === xe ? n.subtasks : n.subtasks.map((h) => h.id === t.id ? t : h);
2040
+ return { overlaps: Ut(r).filter(a), violated: Xt(d, l) };
1984
2041
  }
1985
2042
  }
1986
- function ai(s, t) {
2043
+ function bi(s, t) {
1987
2044
  const e = /* @__PURE__ */ new Map();
1988
2045
  for (const n of t) {
1989
- const i = s.slots.get(n.lane), o = i === void 0 ? null : et(s, i.top);
2046
+ const i = s.slots.get(n.lane), o = i === void 0 ? null : nt(s, i.top);
1990
2047
  if (o === null) continue;
1991
2048
  const r = s.rows.indexOf(o);
1992
2049
  e.set(r, [...e.get(r) ?? [], n]);
1993
2050
  }
1994
2051
  return [...e.entries()].sort(([n], [i]) => n - i).map(([, n]) => n.sort((i, o) => i.from - o.from || i.to - o.to));
1995
2052
  }
1996
- const Oe = (s, t) => t < s.from ? s.from - t : t > s.to ? t - s.to : 0;
1997
- function li(s, t, e, n) {
2053
+ const Ne = (s, t) => t < s.from ? s.from - t : t > s.to ? t - s.to : 0;
2054
+ function Mi(s, t, e, n) {
1998
2055
  let i = -1, o = -1;
1999
2056
  for (let d = 0; d < s.length && t !== null && i < 0; d++)
2000
2057
  o = s[d].findIndex((h) => h.id === t), o >= 0 && (i = d);
2001
2058
  if (i < 0) {
2002
2059
  for (const d of s) {
2003
- const h = d.find((c) => c.to > n[0] && c.from < n[1]);
2060
+ const h = d.find((u) => u.to > n[0] && u.from < n[1]);
2004
2061
  if (h !== void 0) return h;
2005
2062
  }
2006
2063
  return s[0]?.[0] ?? null;
@@ -2025,11 +2082,11 @@ function li(s, t, e, n) {
2025
2082
  const d = s[e === "up" ? i - 1 : i + 1];
2026
2083
  if (d === void 0) return a;
2027
2084
  const h = (a.from + a.to) / 2;
2028
- return d.reduce((c, f) => Oe(f, h) < Oe(c, h) ? f : c);
2085
+ return d.reduce((u, f) => Ne(f, h) < Ne(u, h) ? f : u);
2029
2086
  }
2030
2087
  }
2031
2088
  }
2032
- function di(s, t, e, n) {
2089
+ function Ti(s, t, e, n) {
2033
2090
  if (e.kind === "milestone") return e;
2034
2091
  if (e.kind === "dependency") {
2035
2092
  const o = s.find((a) => a.id === e.id), r = o === void 0 ? void 0 : n === "out" ? o.to : o.from;
@@ -2040,7 +2097,7 @@ function di(s, t, e, n) {
2040
2097
  );
2041
2098
  return i === void 0 ? e : { kind: "dependency", id: i.id };
2042
2099
  }
2043
- const pt = "\0milestone:", hi = 150, ci = {
2100
+ const kt = "\0milestone:", Si = 150, Ii = {
2044
2101
  ArrowRight: "next",
2045
2102
  ArrowLeft: "previous",
2046
2103
  ArrowUp: "up",
@@ -2050,7 +2107,7 @@ const pt = "\0milestone:", hi = 150, ci = {
2050
2107
  PageDown: "pageNext",
2051
2108
  PageUp: "pagePrevious"
2052
2109
  };
2053
- class ui {
2110
+ class Li {
2054
2111
  constructor(t) {
2055
2112
  this.host = t;
2056
2113
  }
@@ -2080,28 +2137,28 @@ class ui {
2080
2137
  const o = this.active();
2081
2138
  if (o === null) return !1;
2082
2139
  const r = this.host.data, a = n ? !t.shiftKey : t.key === "]";
2083
- return this.show(di(r.dependencies, r.subtaskById, o, a ? "out" : "back")), !0;
2140
+ return this.show(Ti(r.dependencies, r.subtaskById, o, a ? "out" : "back")), !0;
2084
2141
  }
2085
2142
  if (t.ctrlKey) return !1;
2086
2143
  if (t.altKey) return this.edit(t);
2087
2144
  if (t.key === "Escape")
2088
2145
  return e.byKeyboard ? (this.blur(), !0) : !1;
2089
2146
  if (t.key === "Enter" || t.key === " ") return this.select();
2090
- const i = t.shiftKey ? void 0 : ci[t.key];
2147
+ const i = t.shiftKey ? void 0 : Ii[t.key];
2091
2148
  return i === void 0 ? !1 : (this.walk(i), !0);
2092
2149
  }
2093
2150
  walk(t) {
2094
- const { data: e, view: n } = this.host, i = this.active(), o = i === null ? null : i.kind === "subtask" ? i.id : i.kind === "milestone" ? pt + i.id : e.dependencies.find((d) => d.id === i.id)?.from ?? null, r = [...e.subtasks, ...e.milestones.map((d) => ({ id: pt + d.id, lane: d.lane, from: d.at, to: d.at }))];
2095
- let a = ai(n.rows, r);
2151
+ const { data: e, view: n } = this.host, i = this.active(), o = i === null ? null : i.kind === "subtask" ? i.id : i.kind === "milestone" ? kt + i.id : e.dependencies.find((d) => d.id === i.id)?.from ?? null, r = [...e.subtasks, ...e.milestones.map((d) => ({ id: kt + d.id, lane: d.lane, from: d.at, to: d.at }))];
2152
+ let a = bi(n.rows, r);
2096
2153
  if (o === null) {
2097
2154
  const d = a.filter((h) => {
2098
- const c = j(n.viewport(), h[0].lane);
2099
- return c !== null && c.top + c.height > 0 && c.top < n.height;
2155
+ const u = J(n.viewport(), h[0].lane);
2156
+ return u !== null && u.top + u.height > 0 && u.top < n.height;
2100
2157
  });
2101
2158
  d.length > 0 && (a = d);
2102
2159
  }
2103
- const l = li(a, o, t, this.host.visibleDomain());
2104
- l !== null && this.show(l.id.startsWith(pt) ? { kind: "milestone", id: l.id.slice(pt.length) } : { kind: "subtask", id: l.id });
2160
+ const l = Mi(a, o, t, this.host.visibleDomain());
2161
+ l !== null && this.show(l.id.startsWith(kt) ? { kind: "milestone", id: l.id.slice(kt.length) } : { kind: "subtask", id: l.id });
2105
2162
  }
2106
2163
  /** Space and Enter select as a click does: the whole task, and the subtask. */
2107
2164
  select() {
@@ -2117,20 +2174,20 @@ class ui {
2117
2174
  edit(t) {
2118
2175
  const e = this.host.gestures.hover, n = t.key === "ArrowRight" ? 1 : t.key === "ArrowLeft" ? -1 : 0;
2119
2176
  if (n === 0) return !1;
2120
- if (e.kind !== "subtask") return !0;
2177
+ if (this.host.gestures.loading || e.kind !== "subtask") return !0;
2121
2178
  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;
2122
2179
  let h = null;
2123
2180
  if (!t.shiftKey && r.includes("move")) {
2124
- const c = (p) => ({ ...i, from: p, to: p + (i.to - i.from) });
2181
+ const u = (g) => ({ ...i, from: g, to: g + (i.to - i.from) });
2125
2182
  let f = i.from;
2126
- for (let p = 0; p < 1e3; p++) {
2127
- const k = o.shifted(f, n * l.step, l);
2128
- if (k === f || (f = k, !lt(c(f), i, d))) break;
2183
+ for (let g = 0; g < 1e3; g++) {
2184
+ const v = o.shifted(f, n * l.step, l);
2185
+ if (v === f || (f = v, !ct(u(f), i, d))) break;
2129
2186
  }
2130
- f !== i.from && !lt(c(f), i, d) && (h = { kind: "move", subtask: i.id, from: f, to: c(f).to });
2187
+ f !== i.from && !ct(u(f), i, d) && (h = { kind: "move", subtask: i.id, from: f, to: u(f).to });
2131
2188
  } else if (t.shiftKey && r.includes("stretch")) {
2132
- const c = Math.max(o.shifted(i.to, n * l.step, l), i.from + Math.max(l.step, q));
2133
- c !== i.to && !lt({ ...i, to: c }, i, d) && (h = { kind: "stretch", subtask: i.id, from: i.from, to: c });
2189
+ const u = Math.max(o.shifted(i.to, n * l.step, l), i.from + Math.max(l.step, q));
2190
+ u !== i.to && !ct({ ...i, to: u }, i, d) && (h = { kind: "stretch", subtask: i.id, from: i.from, to: u });
2134
2191
  }
2135
2192
  return o.byKeyboard = !0, h !== null && this.host.handlers().onIntent?.(h), this.scheduleReadout(), !0;
2136
2193
  }
@@ -2169,7 +2226,7 @@ class ui {
2169
2226
  return a === void 0 ? null : { x0: a.outerFrom, x1: a.outerTo, y0: a.y, y1: a.y + a.height };
2170
2227
  }
2171
2228
  if (t.kind === "milestone") {
2172
- const a = this.host.data.milestones.find((d) => d.id === t.id), l = a === void 0 ? null : qt(e.viewport(), a);
2229
+ const a = this.host.data.milestones.find((d) => d.id === t.id), l = a === void 0 ? null : Zt(e.viewport(), a);
2173
2230
  return l === null ? null : { x0: l.x - l.half, x1: l.x + l.half, y0: l.y - l.half, y1: l.y + l.half };
2174
2231
  }
2175
2232
  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);
@@ -2206,20 +2263,20 @@ class ui {
2206
2263
  if (!this.host.gestures.byKeyboard) return;
2207
2264
  const e = this.host.data.tooltipTargetFor(t);
2208
2265
  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());
2209
- }, hi);
2266
+ }, Si);
2210
2267
  }
2211
2268
  /** Unmount: no readout after it. */
2212
2269
  stop() {
2213
2270
  this.timer !== null && clearTimeout(this.timer), this.timer = null;
2214
2271
  }
2215
2272
  }
2216
- const tt = (s) => JSON.stringify([s.domain ?? null, [...s.folded ?? []].sort()]);
2217
- function fi(s, t) {
2273
+ const st = (s) => JSON.stringify([s.domain ?? null, [...s.folded ?? []].sort()]);
2274
+ function Ai(s, t) {
2218
2275
  if (t.size === 0 || s.folded === void 0) return s;
2219
2276
  const e = s.folded.filter((n) => t.has(n));
2220
2277
  return e.length === s.folded.length ? s : { ...s.domain ? { domain: s.domain } : {}, ...e.length ? { folded: e } : {} };
2221
2278
  }
2222
- function mi(s, t, e = (n) => n) {
2279
+ function Ci(s, t, e = (n) => n) {
2223
2280
  if (s.length === 0) return null;
2224
2281
  let n = 1 / 0, i = -1 / 0;
2225
2282
  for (const a of s)
@@ -2228,27 +2285,28 @@ function mi(s, t, e = (n) => n) {
2228
2285
  const o = Math.min(t.max, Math.max(t.min, i - n)), r = (n + i) / 2;
2229
2286
  return [r - o / 2, r + o / 2];
2230
2287
  }
2231
- const Ee = {
2288
+ const Be = {
2232
2289
  width: 0,
2233
2290
  height: 0,
2234
2291
  scrollY: 0,
2235
2292
  headers: [],
2236
2293
  days: [],
2237
2294
  ticks: [],
2238
- step: Ht,
2295
+ step: Vt,
2239
2296
  fontScale: 1,
2240
2297
  ghost: null,
2241
2298
  grips: [],
2242
2299
  cursor: "default",
2243
2300
  tooltip: null,
2301
+ loading: !1,
2244
2302
  now: null,
2245
2303
  bars: [],
2246
2304
  spoken: null,
2247
2305
  summary: { lanes: 0, subtasks: 0, from: 0, to: 0, overlaps: 0, violated: 0, blocked: 0, milestones: 0 }
2248
2306
  };
2249
- class pi {
2250
- data = new Rn(() => this.viewChanged());
2251
- view = new Ws(this.data);
2307
+ class Di {
2308
+ data = new Un(() => this.viewChanged());
2309
+ view = new rn(this.data);
2252
2310
  gestures;
2253
2311
  keys;
2254
2312
  handlersNow = {};
@@ -2289,10 +2347,10 @@ class pi {
2289
2347
  movePending = !1;
2290
2348
  domainFrame = 0;
2291
2349
  unsubscribeTheme = null;
2292
- snapshot = Ee;
2350
+ snapshot = Be;
2293
2351
  listeners = /* @__PURE__ */ new Set();
2294
2352
  constructor(t = {}) {
2295
- this.folded = t.folded ?? [], this.domainInView = t.domain ?? null, this.domainInView !== null && this.view.showWall(this.domainInView), this.viewNow = this.currentView(), this.gestures = new ri({
2353
+ this.folded = t.folded ?? [], this.domainInView = t.domain ?? null, this.domainInView !== null && this.view.showWall(this.domainInView), this.viewNow = this.currentView(), this.gestures = new wi({
2296
2354
  data: this.data,
2297
2355
  view: this.view,
2298
2356
  plotElement: () => this.plot,
@@ -2303,7 +2361,7 @@ class pi {
2303
2361
  viewMoved: (e) => this.viewMoved(e),
2304
2362
  interactionChanged: () => this.interactionChanged(),
2305
2363
  hoverChanged: () => this.hoverChanged()
2306
- }), this.keys = new ui({
2364
+ }), this.keys = new Li({
2307
2365
  data: this.data,
2308
2366
  view: this.view,
2309
2367
  gestures: this.gestures,
@@ -2335,6 +2393,11 @@ class pi {
2335
2393
  setHandlers(t) {
2336
2394
  this.handlersNow = t;
2337
2395
  }
2396
+ /** The plan is on its way: the hover ends and no new drag starts; one under
2397
+ way finishes. */
2398
+ setLoading(t) {
2399
+ t !== this.gestures.loading && (this.gestures.loading = t, t && this.gestures.pointerLeave(), this.interactionChanged());
2400
+ }
2338
2401
  /** What the application says it is dragging in, while it drags it. */
2339
2402
  setPlacing(t) {
2340
2403
  this.placing = t, t === null && this.gestures.clearPlacing();
@@ -2348,7 +2411,7 @@ class pi {
2348
2411
  getView = () => this.viewNow;
2349
2412
  /** Goes to a whole view (`setView`); what it leaves out goes back to its default. */
2350
2413
  applyView(t) {
2351
- tt(t) !== tt(this.viewNow) && (this.actedOn = !0, this.folded = t.folded ?? [], this.setDomain(t.domain ?? null));
2414
+ st(t) !== st(this.viewNow) && (this.actedOn = !0, this.folded = t.folded ?? [], this.setDomain(t.domain ?? null));
2352
2415
  }
2353
2416
  /** Puts a span of two wall-clock instants in view; null shows the
2354
2417
  subtasks' extent. */
@@ -2367,14 +2430,14 @@ class pi {
2367
2430
  this.actedOn = !0, this.folded = [], this.viewChanged();
2368
2431
  };
2369
2432
  currentView() {
2370
- return fi(
2433
+ return Ai(
2371
2434
  { ...this.domainInView === null ? {} : { domain: this.domainInView }, ...this.folded.length > 0 ? { folded: this.folded } : {} },
2372
2435
  new Set(this.data.groups.map((t) => t.id))
2373
2436
  );
2374
2437
  }
2375
2438
  publishView() {
2376
2439
  const t = this.currentView();
2377
- if (tt(t) !== tt(this.viewNow)) {
2440
+ if (st(t) !== st(this.viewNow)) {
2378
2441
  this.viewNow = t;
2379
2442
  for (const e of this.viewListeners) e();
2380
2443
  }
@@ -2382,13 +2445,13 @@ class pi {
2382
2445
  /** The subtasks' extent within the zoom limits, while the view names no
2383
2446
  span - and the local day of today while there is no work to show. */
2384
2447
  fit() {
2385
- const t = this.view.options.calendar, e = mi(this.data.subtasks, this.view.options.zoomLimits, (i) => G(i, t));
2448
+ const t = this.view.options.calendar, e = Ci(this.data.subtasks, this.view.options.zoomLimits, (i) => H(i, t));
2386
2449
  if (e !== null) {
2387
2450
  this.view.domain = e, this.fitted = !0;
2388
2451
  return;
2389
2452
  }
2390
2453
  const n = /* @__PURE__ */ new Date();
2391
- n.setHours(0, 0, 0, 0), this.view.showWall([n.getTime(), n.getTime() + U]);
2454
+ n.setHours(0, 0, 0, 0), this.view.showWall([n.getTime(), n.getTime() + X]);
2392
2455
  }
2393
2456
  /** `undefined`: the scene keeps the selection itself. */
2394
2457
  setControlledTask(t) {
@@ -2412,7 +2475,7 @@ class pi {
2412
2475
  /* DOM binding */
2413
2476
  /* ---------------------------------------------------------------- */
2414
2477
  bind(t, e, n, i) {
2415
- this.root = t, this.plot = e, this.dataCanvas = n, this.overlayCanvas = i, this.unsubscribeTheme = ks(() => {
2478
+ this.root = t, this.plot = e, this.dataCanvas = n, this.overlayCanvas = i, this.unsubscribeTheme = Ls(() => {
2416
2479
  this.colours = null, this.dataStale = !0, this.requestDraw();
2417
2480
  }), this.viewChanged();
2418
2481
  }
@@ -2427,7 +2490,7 @@ class pi {
2427
2490
  this.listeners.delete(t);
2428
2491
  });
2429
2492
  getSnapshot = () => this.snapshot;
2430
- getServerSnapshot = () => Ee;
2493
+ getServerSnapshot = () => Be;
2431
2494
  /* ---------------------------------------------------------------- */
2432
2495
  /* Changes */
2433
2496
  /* ---------------------------------------------------------------- */
@@ -2439,7 +2502,7 @@ class pi {
2439
2502
  this.dataCanvas === null || typeof requestAnimationFrame != "function" ? this.viewChanged() : (this.view.invalidate(), this.movePending = !0, this.requestDraw()), t && this.reportDomain();
2440
2503
  }
2441
2504
  viewChanged() {
2442
- 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();
2505
+ 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.plot !== null && (this.plot.style.touchAction = this.view.maxScroll() === 0 ? "pan-y" : "none"), this.moveSettled();
2443
2506
  }
2444
2507
  /** What a pan or zoom changes beyond the layout: the view's listeners, the
2445
2508
  hover and key targets read anew, the snapshot and the drawing. */
@@ -2470,6 +2533,7 @@ class pi {
2470
2533
  grips: n,
2471
2534
  cursor: this.gestures.cursor,
2472
2535
  tooltip: this.tooltip(),
2536
+ loading: this.gestures.loading,
2473
2537
  now: t.nowX(),
2474
2538
  bars: this.bars(),
2475
2539
  spoken: this.keys.spoken,
@@ -2504,12 +2568,12 @@ class pi {
2504
2568
  if (t.width <= 0) return [];
2505
2569
  const e = this.colours;
2506
2570
  return t.boxes.flatMap((n) => {
2507
- if (!Et(n, t.width, t.height)) return [];
2508
- const i = Ns(n, t.width);
2571
+ if (!Rt(n, t.width, t.height)) return [];
2572
+ const i = Xs(n, t.width);
2509
2573
  if (i === null) return [];
2510
- const o = e === null ? !0 : jt(
2511
- vt(n.subtask.appearance),
2512
- ct(e, { selectedTask: this.selectedTask, selectedSubtask: this.selectedSubtask }, n.subtask.task, n.subtask.id),
2574
+ const o = e === null ? !0 : Qt(
2575
+ wt(n.subtask.appearance),
2576
+ mt(e, { selectedTask: this.selectedTask, selectedSubtask: this.selectedSubtask }, n.subtask.task, n.subtask.id),
2513
2577
  e
2514
2578
  ).onDark;
2515
2579
  return [{ subtask: n.subtask, ...i, dark: o }];
@@ -2521,7 +2585,7 @@ class pi {
2521
2585
  const t = this.view, [e, n] = this.visibleDomain();
2522
2586
  return {
2523
2587
  lanes: this.data.lanes.length,
2524
- subtasks: t.boxes.filter((i) => Et(i, t.width, t.height)).length,
2588
+ subtasks: t.boxes.filter((i) => Rt(i, t.width, t.height)).length,
2525
2589
  from: e,
2526
2590
  to: n,
2527
2591
  overlaps: this.data.overlaps.length,
@@ -2540,7 +2604,7 @@ class pi {
2540
2604
  }
2541
2605
  /** The visible span, as two wall-clock instants. */
2542
2606
  visibleDomain() {
2543
- const t = (e) => dt(e, this.view.options.calendar);
2607
+ const t = (e) => ut(e, this.view.options.calendar);
2544
2608
  return [t(this.view.domain[0]), t(this.view.domain[1])];
2545
2609
  }
2546
2610
  /** A pan or zoom of the planner's goes into the view once per frame,
@@ -2564,8 +2628,31 @@ class pi {
2564
2628
  clientPointOf(t, e) {
2565
2629
  const n = this.plot?.getBoundingClientRect();
2566
2630
  if (n === void 0) return null;
2567
- const i = this.view.viewport(), o = e === void 0 ? null : j(i, e), r = o === null ? 0 : o.top + o.height / 2;
2568
- return { x: n.left + R(i, t), y: n.top + r };
2631
+ const i = this.view.viewport(), o = e === void 0 ? null : J(i, e), r = o === null ? 0 : o.top + o.height / 2;
2632
+ return { x: n.left + x(i, t), y: n.top + r };
2633
+ }
2634
+ /** Whether a lane has a row of its own on a mounted plot: not unknown, not
2635
+ in a folded group, whose lanes are strips and no rows. */
2636
+ hasRow(t) {
2637
+ const e = this.plot === null ? void 0 : this.view.rows.slots.get(t);
2638
+ return e !== void 0 && !e.miniature;
2639
+ }
2640
+ /** Scrolls the lanes until the lane's row is in view; false, and nothing
2641
+ moved, for a lane without a row. */
2642
+ scrollToLane(t) {
2643
+ if (!this.hasRow(t)) return !1;
2644
+ const e = this.view.rows.slots.get(t), n = e.top - this.view.scrollY, i = n < 0 ? n : n + e.height > this.view.height ? Math.min(n + e.height - this.view.height, n) : 0;
2645
+ return this.view.pan(0, i).moved && this.viewMoved(!1), !0;
2646
+ }
2647
+ /** Brings a subtask's lane and time into view, the span keeping its width;
2648
+ false, and nothing moved, for one without a row. */
2649
+ scrollToSubtask(t) {
2650
+ const e = this.data.subtaskById.get(t);
2651
+ return e === void 0 || !this.hasRow(e.lane) ? !1 : (this.keys.reveal({ kind: "subtask", id: t }), !0);
2652
+ }
2653
+ /** `scrollToSubtask`, then the subtask is the active one and the plot has the focus. */
2654
+ focusSubtask(t) {
2655
+ return this.scrollToSubtask(t) ? (this.plot.focus(), this.keys.show({ kind: "subtask", id: t }), !0) : !1;
2569
2656
  }
2570
2657
  requestDraw() {
2571
2658
  this.frame !== 0 || this.dataCanvas === null || typeof requestAnimationFrame != "function" || (this.frame = requestAnimationFrame(() => {
@@ -2574,8 +2661,8 @@ class pi {
2574
2661
  }
2575
2662
  draw() {
2576
2663
  if (this.root === null) return;
2577
- this.colours === null && (this.colours = Yn(this.root, this.data), this.publish());
2578
- const { width: t, height: e } = this.view, n = this.dataStale ? Se(this.dataCanvas, t, e) : null, i = Se(this.overlayCanvas, t, e);
2664
+ this.colours === null && (this.colours = si(this.root, this.data), this.publish());
2665
+ const { width: t, height: e } = this.view, n = this.dataStale ? De(this.dataCanvas, t, e) : null, i = De(this.overlayCanvas, t, e);
2579
2666
  if (i === null || t === 0 || this.dataStale && n === null) return;
2580
2667
  this.dataStale = !1;
2581
2668
  const o = {
@@ -2588,7 +2675,7 @@ class pi {
2588
2675
  hover: this.gestures.hover,
2589
2676
  ghost: this.gestures.ghostDrawing()
2590
2677
  };
2591
- n !== null && Kn(n, o), Vn(i, o);
2678
+ n !== null && ni(n, o), ii(i, o);
2592
2679
  }
2593
2680
  /* ---------------------------------------------------------------- */
2594
2681
  /* Gestures, as the component hands them in */
@@ -2600,6 +2687,7 @@ class pi {
2600
2687
  pointerLeave = () => this.gestures.pointerLeave();
2601
2688
  contextMenu = (t) => this.gestures.contextMenu(t);
2602
2689
  wheel = (t) => this.gestures.wheel(t);
2690
+ touchMove = (t) => this.gestures.touchMove(t);
2603
2691
  dragOver = (t) => this.gestures.dragOver(t, this.placing);
2604
2692
  drop = (t) => this.gestures.drop(t);
2605
2693
  dragLeave = () => this.gestures.clearPlacing();
@@ -2608,43 +2696,49 @@ class pi {
2608
2696
  focus = (t) => this.keys.focus(t);
2609
2697
  blur = () => this.keys.blur();
2610
2698
  }
2611
- function Si(s = {}) {
2612
- const { initialView: t, onViewChange: e } = s, [n] = rt(() => new pi(t)), i = Y(""), [o] = rt(() => {
2613
- const l = (d) => ws(Ln, { ...d, scene: n });
2699
+ function Bi(s = {}) {
2700
+ const { initialView: t, onViewChange: e } = s, [n] = dt(() => new Di(t)), i = V(""), [o] = dt(() => {
2701
+ const l = (d) => Ds(Gn, { ...d, scene: n });
2614
2702
  return l.displayName = "Schedule", {
2615
2703
  Schedule: l,
2616
- Lane: Cn,
2617
- LaneGroup: Dn,
2618
- Subtasks: _n,
2619
- Dependencies: Fn,
2620
- BlockedTimes: On,
2621
- Milestones: En,
2704
+ Lane: Yn,
2705
+ LaneGroup: Kn,
2706
+ Subtasks: Vn,
2707
+ Dependencies: jn,
2708
+ BlockedTimes: Wn,
2709
+ Milestones: zn,
2622
2710
  setView: (d) => {
2623
- n.applyView(d), i.current = tt(n.getView());
2711
+ n.applyView(d), i.current = st(n.getView());
2624
2712
  },
2625
2713
  setDomain: n.setDomain,
2714
+ positionAt: (d, h) => n.positionAt(d, h),
2715
+ clientPointOf: (d, h) => n.clientPointOf(d, h),
2716
+ visibleDomain: () => n.visibleDomain(),
2717
+ scrollToLane: (d) => n.scrollToLane(d),
2718
+ scrollToSubtask: (d) => n.scrollToSubtask(d),
2719
+ focusSubtask: (d) => n.focusSubtask(d),
2626
2720
  toggleGroup: n.toggleGroup,
2627
2721
  foldAll: n.foldAll,
2628
2722
  unfoldAll: n.unfoldAll
2629
2723
  };
2630
- }), r = Pe(n.subscribeView, n.getView, n.getView), a = tt(r);
2631
- return z(() => {
2724
+ }), r = He(n.subscribeView, n.getView, n.getView), a = st(r);
2725
+ return j(() => {
2632
2726
  i.current !== a && (i.current = a, n.acted && e?.(r));
2633
- }, [a]), K(() => ({ ...o, view: r }), [o, r]);
2727
+ }, [a]), W(() => ({ ...o, view: r }), [o, r]);
2634
2728
  }
2635
2729
  export {
2636
- me as applyIntent,
2637
- Vt as arrival,
2638
- Kt as departure,
2639
- bi as findings,
2640
- Be as inBlockedTime,
2641
- st as occupied,
2642
- Wt as overlaps,
2643
- vt as resolveAppearance,
2644
- Mi as ripple,
2645
- Ti as shiftTask,
2646
- Ts as snapTime,
2647
- wi as subtaskFromPlace,
2648
- Si as useSchedule,
2649
- zt as violatedDependencies
2730
+ ve as applyIntent,
2731
+ zt as arrival,
2732
+ Wt as departure,
2733
+ Pi as findings,
2734
+ Ye as inBlockedTime,
2735
+ it as occupied,
2736
+ Ut as overlaps,
2737
+ wt as resolveAppearance,
2738
+ Ri as ripple,
2739
+ Ni as shiftTask,
2740
+ xs as snapTime,
2741
+ xi as subtaskFromPlace,
2742
+ Bi as useSchedule,
2743
+ Xt as violatedDependencies
2650
2744
  };