@umriss-ui/schedule 0.3.15 → 0.4.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,82 +1,82 @@
1
1
  import "./schedule.css";
2
- var fs = Object.defineProperty;
3
- var ps = (o, t, e) => t in o ? fs(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
4
- var f = (o, t, e) => ps(o, typeof t != "symbol" ? t + "" : t, e);
5
- import { jsxs as z, Fragment as Ot, jsx as k } from "react/jsx-runtime";
6
- import { useContext as Be, createContext as Ne, useRef as G, useEffect as K, forwardRef as ms, useState as ut, useId as gs, useLayoutEffect as ft, useImperativeHandle as ks, useSyncExternalStore as ys, useMemo as X } from "react";
7
- import { toWorkingTimeClamped as U, resolveColours as vs, removedIntervals as ws, localOffset as $t, MINUTE as V, calendarFrom as tt, toWallClock as j, DAY as q, timeStep as bs, workingTimeTicks as Ms, HOUR as xt, LinearScale as Ts, subscribeTheme as Is } from "@umriss-ui/charts";
8
- import { useFormats as Gt, useWording as gt, AngleGlyph as Cs, VisuallyHidden as me } from "@umriss-ui/core";
9
- const $e = Ne(null), xe = Ne(null);
2
+ var us = Object.defineProperty;
3
+ var fs = (o, t, e) => t in o ? us(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
4
+ var f = (o, t, e) => fs(o, typeof t != "symbol" ? t + "" : t, e);
5
+ import { jsxs as U, Fragment as Et, jsx as k } from "react/jsx-runtime";
6
+ import { useContext as Be, createContext as Ne, useRef as G, useEffect as K, forwardRef as ps, useState as ft, useId as ms, useLayoutEffect as pt, useImperativeHandle as gs, useSyncExternalStore as ks, useMemo as V } from "react";
7
+ import { toWorkingTimeClamped as W, resolveColours as ys, removedIntervals as vs, localOffset as $t, MINUTE as q, calendarFrom as et, toWallClock as j, DAY as Z, timeStep as ws, workingTimeTicks as bs, HOUR as Gt, LinearScale as Ms, subscribeTheme as Ts } from "@umriss-ui/charts";
8
+ import { useFormats as Ht, useWording as kt, AngleGlyph as Is, VisuallyHidden as me } from "@umriss-ui/core";
9
+ const xe = Ne(null), $e = Ne(null);
10
10
  function Ge() {
11
- return Be(xe);
11
+ return Be($e);
12
12
  }
13
- function Ss(o) {
14
- const t = Be($e);
13
+ function Cs(o) {
14
+ const t = Be(xe);
15
15
  if (t === null)
16
16
  throw new Error(`@umriss-ui/schedule: <${o}> must be used inside a <Schedule>.`);
17
17
  return t;
18
18
  }
19
- function Ht(o, t, e, n, s) {
20
- const i = Ss(o), r = G(null);
19
+ function Yt(o, t, e, n, s) {
20
+ const i = Cs(o), r = G(null);
21
21
  K(() => (r.current = e(i, t), () => {
22
22
  r.current !== null && s(i, r.current), r.current = null;
23
23
  }), [i]), K(() => {
24
24
  r.current !== null && n(i, r.current, t);
25
25
  });
26
26
  }
27
- function Ls(o) {
28
- Ht("Lane", o, (t, e) => t.registerLane(e), (t, e, n) => t.updateLane(e, n), (t, e) => t.unregisterLane(e));
27
+ function Ss(o) {
28
+ Yt("Lane", o, (t, e) => t.registerLane(e), (t, e, n) => t.updateLane(e, n), (t, e) => t.unregisterLane(e));
29
29
  }
30
- function As(o) {
31
- Ht("LaneGroup", o, (t, e) => t.registerGroup(e), (t, e, n) => t.updateGroup(e, n), (t, e) => t.unregisterGroup(e));
30
+ function Ls(o) {
31
+ Yt("LaneGroup", o, (t, e) => t.registerGroup(e), (t, e, n) => t.updateGroup(e, n), (t, e) => t.unregisterGroup(e));
32
32
  }
33
- function Yt(o, t) {
34
- Ht(o, t, (e, n) => e.registerLayer(n), (e, n, s) => e.updateLayer(n, s), (e, n) => e.unregisterLayer(n));
33
+ function zt(o, t) {
34
+ Yt(o, t, (e, n) => e.registerLayer(n), (e, n, s) => e.updateLayer(n, s), (e, n) => e.unregisterLayer(n));
35
35
  }
36
- function kt(o) {
36
+ function yt(o) {
37
37
  let t = !1, e = !1, n = !1, s = !1;
38
38
  for (const i of o ?? [])
39
39
  i === "provisional" ? (t = !0, e = !1) : i === "fixed" ? (e = !0, t = !1) : i === "muted" ? n = !0 : i === "open" && (s = !0);
40
40
  return { dashed: t, hatched: e, muted: n, open: s };
41
41
  }
42
- const Ds = 24, _s = 4, Fs = 3, Lt = 4;
42
+ const As = 24, Ds = 4, _s = 3, At = 4;
43
43
  function ge(o) {
44
44
  const { lanes: t, groups: e, collapsed: n, laneHeight: s } = o, i = new Map(e.map((g) => [g.id, g])), r = (g) => g !== void 0 && i.has(g) ? g : void 0, a = /* @__PURE__ */ new Map(), l = (g) => {
45
45
  const I = [];
46
- let S = r(g.parent);
46
+ let L = r(g.parent);
47
47
  const R = /* @__PURE__ */ new Set();
48
- for (; S !== void 0 && !R.has(S); )
49
- R.add(S), I.unshift(S), S = r(i.get(S).parent);
48
+ for (; L !== void 0 && !R.has(L); )
49
+ R.add(L), I.unshift(L), L = r(i.get(L).parent);
50
50
  return I;
51
51
  }, h = /* @__PURE__ */ new Map();
52
52
  for (const g of t) {
53
53
  const I = l(g);
54
54
  h.set(g.id, I);
55
- for (const S of I) {
56
- const R = a.get(S) ?? [];
57
- R.push(g.id), a.set(S, R);
55
+ for (const L of I) {
56
+ const R = a.get(L) ?? [];
57
+ R.push(g.id), a.set(L, R);
58
58
  }
59
59
  }
60
60
  const d = [], u = /* @__PURE__ */ new Map();
61
61
  let p = [], m = null, y = 0;
62
- const C = (g) => (d.push({ ...g, top: y }), y += g.height, d.length - 1), A = (g) => g.find((I) => n.has(I)), D = () => {
62
+ const S = (g) => (d.push({ ...g, top: y }), y += g.height, d.length - 1), A = (g) => g.find((I) => n.has(I)), D = () => {
63
63
  if (m === null) return;
64
- const { row: g, lanes: I } = m, S = d[g], R = Math.max(S.height, I.length * _s + 2 * Lt);
65
- d[g] = { ...S, height: R }, y += R - S.height;
66
- const O = R - 2 * Lt, H = Math.max(Fs, Math.floor(O / I.length));
67
- I.forEach((nt, ct) => {
68
- const Z = h.get(nt) ?? [];
69
- u.set(nt, {
70
- top: S.top + Lt + ct * H,
64
+ const { row: g, lanes: I } = m, L = d[g], R = Math.max(L.height, I.length * Ds + 2 * At);
65
+ d[g] = { ...L, height: R }, y += R - L.height;
66
+ const O = R - 2 * At, H = Math.max(_s, Math.floor(O / I.length));
67
+ I.forEach((ot, ct) => {
68
+ const J = h.get(ot) ?? [];
69
+ u.set(ot, {
70
+ top: L.top + At + ct * H,
71
71
  height: H,
72
72
  miniature: !0,
73
- group: Z[Z.length - 1]
73
+ group: J[J.length - 1]
74
74
  });
75
75
  }), m = null;
76
76
  };
77
77
  for (const g of t) {
78
- const I = (h.get(g.id) ?? []).filter((O) => (a.get(O) ?? []).length > 0), S = A(I);
79
- if (m !== null && S === m.group) {
78
+ const I = (h.get(g.id) ?? []).filter((O) => (a.get(O) ?? []).length > 0), L = A(I);
79
+ if (m !== null && L === m.group) {
80
80
  m.lanes.push(g.id);
81
81
  continue;
82
82
  }
@@ -84,31 +84,31 @@ function ge(o) {
84
84
  const R = I.filter((O, H) => p[H] === O).length;
85
85
  p = p.slice(0, R);
86
86
  for (const O of I.slice(R)) {
87
- if (p.push(O), O === S) break;
88
- C({
87
+ if (p.push(O), O === L) break;
88
+ S({
89
89
  kind: "groupHead",
90
90
  lane: void 0,
91
91
  group: O,
92
92
  depth: p.length - 1,
93
93
  within: [...p],
94
94
  lanes: (a.get(O) ?? []).length,
95
- height: Ds
95
+ height: As
96
96
  });
97
97
  }
98
- if (S !== void 0) {
99
- const O = I.indexOf(S), H = C({
98
+ if (L !== void 0) {
99
+ const O = I.indexOf(L), H = S({
100
100
  kind: "miniature",
101
101
  lane: void 0,
102
- group: S,
102
+ group: L,
103
103
  depth: O,
104
104
  within: I.slice(0, O + 1),
105
- lanes: (a.get(S) ?? []).length,
105
+ lanes: (a.get(L) ?? []).length,
106
106
  height: s
107
107
  });
108
- m = { group: S, row: H, lanes: [g.id] };
108
+ m = { group: L, row: H, lanes: [g.id] };
109
109
  continue;
110
110
  }
111
- C({ kind: "lane", lane: g.id, group: I[I.length - 1], depth: I.length, within: I, lanes: 1, height: s }), u.set(g.id, {
111
+ S({ kind: "lane", lane: g.id, group: I[I.length - 1], depth: I.length, within: I, lanes: 1, height: s }), u.set(g.id, {
112
112
  top: d[d.length - 1].top,
113
113
  height: s,
114
114
  miniature: !1,
@@ -117,13 +117,13 @@ function ge(o) {
117
117
  }
118
118
  return D(), { rows: d, slots: u, height: y };
119
119
  }
120
- function Os(o, t) {
120
+ function Fs(o, t) {
121
121
  if (t.size === 0) return o;
122
122
  const e = /* @__PURE__ */ new Set();
123
123
  for (const n of o) t.has(n) || e.add(n);
124
124
  return e;
125
125
  }
126
- function et(o, t) {
126
+ function st(o, t) {
127
127
  if (t < 0 || t >= o.height) return null;
128
128
  let e = 0, n = o.rows.length - 1;
129
129
  for (; e <= n; ) {
@@ -137,8 +137,8 @@ function et(o, t) {
137
137
  function Kt(o, t) {
138
138
  return o.slots.get(t) ?? null;
139
139
  }
140
- function Es(o, t) {
141
- const e = et(o, t);
140
+ function Os(o, t) {
141
+ const e = st(o, t);
142
142
  if (e === null) return null;
143
143
  if (e.kind === "lane") return e.lane ?? null;
144
144
  if (e.kind === "groupHead") return null;
@@ -146,13 +146,13 @@ function Es(o, t) {
146
146
  if (s.miniature && t >= s.top && t < s.top + s.height) return n;
147
147
  return null;
148
148
  }
149
- function st(o) {
149
+ function nt(o) {
150
150
  return { from: o.from - (o.leadIn ?? 0), to: o.to + (o.leadOut ?? 0) };
151
151
  }
152
- function zt(o, t) {
152
+ function Ut(o, t) {
153
153
  return (o.leaves ?? "leadOut") === "main" ? t.to : t.to + (t.leadOut ?? 0);
154
154
  }
155
- function Ut(o, t) {
155
+ function Wt(o, t) {
156
156
  return (o.arrives ?? "leadIn") === "main" ? t.from : t.from - (t.leadIn ?? 0);
157
157
  }
158
158
  function ke(o, t) {
@@ -169,7 +169,7 @@ function ke(o, t) {
169
169
  return { ...o, lane: t.lane };
170
170
  }
171
171
  }
172
- function fo(o, t) {
172
+ function uo(o, t) {
173
173
  return {
174
174
  id: t,
175
175
  task: o.task,
@@ -180,19 +180,19 @@ function fo(o, t) {
180
180
  ...o.leadOut === void 0 ? {} : { leadOut: o.leadOut }
181
181
  };
182
182
  }
183
- const Rs = 6, He = 3, rt = 2, ye = 3, ve = 3;
184
- function N(o, t) {
185
- return Math.round(o.scale.toPx(U(t, o.calendar)));
183
+ const Es = 6, He = 3, rt = 2, ye = 3, ve = 3;
184
+ function B(o, t) {
185
+ return Math.round(o.scale.toPx(W(t, o.calendar)));
186
186
  }
187
187
  function dt(o, t) {
188
188
  const e = Kt(o.rows, t);
189
189
  return e === null ? null : { ...e, top: e.top - o.scrollY };
190
190
  }
191
191
  function we(o, t) {
192
- return Es(o.rows, t + o.scrollY);
192
+ return Os(o.rows, t + o.scrollY);
193
193
  }
194
194
  function Ye(o, t, e, n, s) {
195
- const i = n.miniature ? 0 : Rs, r = n.miniature ? 0 : ve * ye, a = Math.max(n.miniature ? 1 : 4, n.height - 2 * i - r), l = n.top - o.scrollY + Math.floor((n.height - a) / 2), h = st(t);
195
+ const i = n.miniature ? 0 : Es, r = n.miniature ? 0 : ve * ye, a = Math.max(n.miniature ? 1 : 4, n.height - 2 * i - r), l = n.top - o.scrollY + Math.floor((n.height - a) / 2), h = nt(t);
196
196
  return {
197
197
  subtask: t,
198
198
  lane: e,
@@ -200,53 +200,53 @@ function Ye(o, t, e, n, s) {
200
200
  depth: s,
201
201
  y: l + (n.miniature ? 0 : Math.min(s, ve) * ye),
202
202
  height: a,
203
- outerFrom: N(o, h.from),
204
- mainFrom: N(o, t.from),
205
- mainTo: N(o, t.to),
206
- outerTo: N(o, h.to)
203
+ outerFrom: B(o, h.from),
204
+ mainFrom: B(o, t.from),
205
+ mainTo: B(o, t.to),
206
+ outerTo: B(o, h.to)
207
207
  };
208
208
  }
209
- function Ke(o, t, e) {
209
+ function ze(o, t, e) {
210
210
  if (e < o.y || e > o.y + o.height) return null;
211
211
  const n = Math.max(0, (6 - (o.outerTo - o.outerFrom)) / 2);
212
212
  return t < o.outerFrom - n || t > o.outerTo + n ? null : t < o.mainFrom ? "leadIn" : t > o.mainTo ? "leadOut" : "main";
213
213
  }
214
- function Ps(o, t, e, n = 5) {
214
+ function Rs(o, t, e, n = 5) {
215
215
  if (e < o.y || e > o.y + o.height) return null;
216
216
  const s = Math.abs(t - o.mainFrom), i = Math.abs(t - o.mainTo);
217
217
  return Math.min(s, i) > n ? null : s <= i ? "from" : "to";
218
218
  }
219
- function Et(o, t, e) {
219
+ function Rt(o, t, e) {
220
220
  return o.outerTo >= 0 && o.outerFrom <= t && o.y + o.height >= 0 && o.y <= e;
221
221
  }
222
- const Bs = 64;
223
- function Ns(o, t) {
222
+ const Ps = 64;
223
+ function Bs(o, t) {
224
224
  if (o.miniature) return null;
225
- const e = kt(o.subtask.appearance).hatched ? rt + He + 1 : 0, n = Math.max(o.mainFrom + e, 0), s = Math.min(o.mainTo - e, t) - n;
226
- return s < Bs ? null : { x: n, width: s, y: o.y, height: o.height };
225
+ const e = yt(o.subtask.appearance).hatched ? rt + He + 1 : 0, n = Math.max(o.mainFrom + e, 0), s = Math.min(o.mainTo - e, t) - n;
226
+ return s < Ps ? null : { x: n, width: s, y: o.y, height: o.height };
227
227
  }
228
- const $s = 10;
228
+ const Ns = 10;
229
229
  function be(o, t, e) {
230
230
  const n = Math.round(t.y + t.height / 2);
231
231
  return o === "centre" || e.y === t.y ? n : Math.round(e.y > t.y ? t.y + t.height - 1 : t.y + 1);
232
232
  }
233
- function Rt(o, t, e, n, s) {
234
- const i = t.route ?? s.route, r = t.attach ?? s.attach, a = t.ends ?? s.ends, l = N(o, zt(t, e.subtask)), h = N(o, Ut(t, n.subtask)), d = be(r, e, n), u = be(r, n, e);
233
+ function Pt(o, t, e, n, s) {
234
+ const i = t.route ?? s.route, r = t.attach ?? s.attach, a = t.ends ?? s.ends, l = B(o, Ut(t, e.subtask)), h = B(o, Wt(t, n.subtask)), d = be(r, e, n), u = be(r, n, e);
235
235
  if (i === "straight")
236
236
  return { dependency: t, kind: i, ends: a, x1: l, y1: d, x2: h, y2: u, c1x: l, c2x: h, points: [l, d, h, u] };
237
237
  if (i === "orthogonal") {
238
- const A = l + $s, D = d === u ? A : Math.round((A + h) / 2);
238
+ const A = l + Ns, D = d === u ? A : Math.round((A + h) / 2);
239
239
  return { dependency: t, kind: i, ends: a, x1: l, y1: d, x2: h, y2: u, c1x: l, c2x: h, points: d === u ? [l, d, h, u] : [l, d, D, d, D, u, h, u] };
240
240
  }
241
- const p = Math.max(14, Math.abs(h - l) / 2), m = l + p, y = h - p, C = [];
241
+ const p = Math.max(14, Math.abs(h - l) / 2), m = l + p, y = h - p, S = [];
242
242
  for (let A = 0; A <= 16; A++) {
243
243
  const D = A / 16, g = 1 - D;
244
- C.push(
244
+ S.push(
245
245
  g * g * g * l + 3 * g * g * D * m + 3 * g * D * D * y + D * D * D * h,
246
246
  g * g * g * d + 3 * g * g * D * d + 3 * g * D * D * u + D * D * D * u
247
247
  );
248
248
  }
249
- return { dependency: t, kind: "curve", ends: a, x1: l, y1: d, x2: h, y2: u, c1x: m, c2x: y, points: C };
249
+ return { dependency: t, kind: "curve", ends: a, x1: l, y1: d, x2: h, y2: u, c1x: m, c2x: y, points: S };
250
250
  }
251
251
  function xs(o, t, e) {
252
252
  let n = 1 / 0;
@@ -257,10 +257,10 @@ function xs(o, t, e) {
257
257
  }
258
258
  return n;
259
259
  }
260
- function Wt(o) {
260
+ function Xt(o) {
261
261
  const t = [], e = /* @__PURE__ */ new Map();
262
262
  o.forEach((n, s) => {
263
- const { from: i, to: r } = st(n);
263
+ const { from: i, to: r } = nt(n);
264
264
  if (!(i < r)) return;
265
265
  const a = e.get(n.lane) ?? [];
266
266
  a.push({ subtask: n, index: s, from: i, to: r }), e.set(n.lane, a);
@@ -278,10 +278,10 @@ function Wt(o) {
278
278
  }
279
279
  return t;
280
280
  }
281
- function Gs(o) {
281
+ function $s(o) {
282
282
  const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map();
283
283
  for (const n of o) {
284
- const s = st(n), i = e.get(n.lane) ?? [];
284
+ const s = nt(n), i = e.get(n.lane) ?? [];
285
285
  let r = 0;
286
286
  if (s.from < s.to) {
287
287
  for (const a of i) s.from < a.to && a.from < s.to && r++;
@@ -291,33 +291,33 @@ function Gs(o) {
291
291
  }
292
292
  return t;
293
293
  }
294
- function Xt(o, t) {
294
+ function Vt(o, t) {
295
295
  const e = new Map(o.map((s) => [s.id, s])), n = [];
296
296
  for (const s of t) {
297
297
  const i = e.get(s.from), r = e.get(s.to);
298
298
  if (i === void 0 || r === void 0) continue;
299
- const a = zt(s, i), l = Ut(s, r), h = a + s.lag - l;
299
+ const a = Ut(s, i), l = Wt(s, r), h = a + s.lag - l;
300
300
  h > 0 && n.push({ dependency: s.id, departure: a, arrival: l, shortBy: h });
301
301
  }
302
302
  return n;
303
303
  }
304
- function ze(o, t) {
304
+ function Ke(o, t) {
305
305
  const e = [];
306
306
  for (const n of o) {
307
- const s = st(n);
307
+ const s = nt(n);
308
308
  for (const i of t)
309
309
  i.lane !== n.lane || !(s.from < i.to && i.from < s.to) || e.push({ subtask: n.id, blocked: i.id, lane: i.lane, from: Math.max(s.from, i.from), to: Math.min(s.to, i.to) });
310
310
  }
311
311
  return e;
312
312
  }
313
- function po(o, t, e = []) {
313
+ function fo(o, t, e = []) {
314
314
  return {
315
- overlaps: Wt(o),
316
- violatedDependencies: Xt(o, t),
317
- inBlockedTime: ze(o, e)
315
+ overlaps: Xt(o),
316
+ violatedDependencies: Vt(o, t),
317
+ inBlockedTime: Ke(o, e)
318
318
  };
319
319
  }
320
- class Hs {
320
+ class Gs {
321
321
  /** `changed` is called after every registration change. */
322
322
  constructor(t) {
323
323
  f(this, "nextId", 1);
@@ -388,7 +388,7 @@ class Hs {
388
388
  this.subtasks.push(...e.data);
389
389
  for (const n of e.tasks) this.tasks.set(n.id, n);
390
390
  } else e.kind === "dependencies" ? this.dependencies.push(...e.data) : this.blocked.push(...e.data);
391
- return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = Wt(this.subtasks), this.violatedById = new Map(Xt(this.subtasks, this.dependencies).map((e) => [e.dependency, e])), this.depth = Gs(this.subtasks), this.inBlocked = ze(this.subtasks, this.blocked), !0;
391
+ return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = Xt(this.subtasks), this.violatedById = new Map(Vt(this.subtasks, this.dependencies).map((e) => [e.dependency, e])), this.depth = $s(this.subtasks), this.inBlocked = Ke(this.subtasks, this.blocked), !0;
392
392
  }
393
393
  /** The task a dependency belongs to: its departing subtask's. */
394
394
  taskOfDependency(t) {
@@ -414,7 +414,7 @@ class Hs {
414
414
  };
415
415
  }
416
416
  }
417
- const Ys = {
417
+ const Hs = {
418
418
  line: "var(--u-hairline)",
419
419
  lineStrong: "var(--u-hairline-strong)",
420
420
  text: "var(--u-color-text)",
@@ -438,11 +438,11 @@ const Ys = {
438
438
  active: "Highlight",
439
439
  now: "GrayText",
440
440
  onAccent: "Canvas"
441
- }, Ks = (o) => o ? Ue : Ys, zs = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(forced-colors: active)").matches;
442
- function Us(o, t) {
441
+ }, Ys = (o) => o ? Ue : Hs, zs = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(forced-colors: active)").matches;
442
+ function Ks(o, t) {
443
443
  const e = zs(), n = {};
444
444
  for (const r of t.tasks.values()) n[`task:${r.id}`] = e ? Ue.text : r.color;
445
- const s = vs(o, { ...Ks(e), ...n }), i = /* @__PURE__ */ new Map();
445
+ const s = ys(o, { ...Ys(e), ...n }), i = /* @__PURE__ */ new Map();
446
446
  for (const r of t.tasks.values()) i.set(r.id, s[`task:${r.id}`] ?? r.color);
447
447
  return {
448
448
  line: s.line,
@@ -486,61 +486,61 @@ function Ie(o, t, e) {
486
486
  const r = o.getContext("2d");
487
487
  return r === null ? null : (r.setTransform(n, 0, 0, n, 0, 0), r.clearRect(0, 0, t, e), r);
488
488
  }
489
- function Ws(o, t) {
489
+ function Us(o, t) {
490
490
  const { data: e, view: n } = t, s = n.viewport();
491
491
  qs(o, t, s);
492
- for (const i of e.blocked) on(o, t, s, i);
493
- Zs(o, t);
492
+ for (const i of e.blocked) nn(o, t, s, i);
493
+ js(o, t);
494
494
  for (const i of e.layers) {
495
495
  if (i.kind === "blocked") continue;
496
496
  const r = new Set(i.data);
497
497
  if (i.kind === "dependencies")
498
- for (const a of n.paths) r.has(a.dependency) && Pt(o, t, a, !1);
498
+ for (const a of n.paths) r.has(a.dependency) && Bt(o, t, a, !1);
499
499
  else
500
- for (const a of n.boxes) r.has(a.subtask) && je(o, t, a, 1);
500
+ for (const a of n.boxes) r.has(a.subtask) && qe(o, t, a, 1);
501
501
  }
502
- for (const i of e.overlaps) Nt(o, t, s, i);
503
- for (const i of e.inBlocked) Nt(o, t, s, i);
504
- nn(o, t, s), ln(o, t);
502
+ for (const i of e.overlaps) xt(o, t, s, i);
503
+ for (const i of e.inBlocked) xt(o, t, s, i);
504
+ sn(o, t, s), an(o, t);
505
505
  }
506
- function Xs(o, t) {
506
+ function Ws(o, t) {
507
507
  const { view: e, hover: n } = t, s = e.viewport();
508
508
  if (t.ghost === null) {
509
509
  if (n.kind === "subtask") {
510
510
  const u = e.boxById.get(n.subtask.id);
511
- u !== void 0 && rn(o, t, u);
511
+ u !== void 0 && on(o, t, u);
512
512
  } else if (n.kind === "dependency") {
513
513
  const u = e.paths.find((p) => p.dependency === n.dependency);
514
- u !== void 0 && Pt(o, t, u, !0);
514
+ u !== void 0 && Bt(o, t, u, !0);
515
515
  }
516
516
  return;
517
517
  }
518
518
  const i = t.ghost, { ghost: r, overlaps: a, violated: l } = i;
519
- Vs(o, t, s, i.refusedLanes);
519
+ Xs(o, t, s, i.refusedLanes);
520
520
  const h = Ve(s, r);
521
521
  if (h === null) return;
522
- for (const u of a) Nt(o, t, s, u);
522
+ for (const u of a) xt(o, t, s, u);
523
523
  const d = new Set(l.map((u) => u.dependency));
524
524
  for (const u of t.data.dependencies) {
525
525
  if (u.from !== r.id && u.to !== r.id) continue;
526
526
  const p = e.boxById.get(u.from === r.id ? u.to : u.from);
527
527
  if (p === void 0) continue;
528
- const m = u.from === r.id ? Rt(s, u, h, p, e.options) : Rt(s, u, p, h, e.options);
529
- Pt(o, t, m, !0, d.has(u.id));
528
+ const m = u.from === r.id ? Pt(s, u, h, p, e.options) : Pt(s, u, p, h, e.options);
529
+ Bt(o, t, m, !0, d.has(u.id));
530
530
  }
531
- je(o, { ...t, selectedTask: null }, h, 0.55), o.strokeStyle = t.colours.text, o.lineWidth = 1, o.setLineDash([3, 2]), o.strokeRect(h.outerFrom + 0.5, h.y + 0.5, Math.max(1, h.outerTo - h.outerFrom - 1), h.height - 1), o.setLineDash([]), i.tether !== null && js(o, t, h, i.tether);
531
+ qe(o, { ...t, selectedTask: null }, h, 0.55), o.strokeStyle = t.colours.text, o.lineWidth = 1, o.setLineDash([3, 2]), o.strokeRect(h.outerFrom + 0.5, h.y + 0.5, Math.max(1, h.outerTo - h.outerFrom - 1), h.height - 1), o.setLineDash([]), i.tether !== null && Vs(o, t, h, i.tether);
532
532
  }
533
- function Vs(o, t, e, n) {
533
+ function Xs(o, t, e, n) {
534
534
  if (n.size === 0) return;
535
535
  const { width: s, height: i } = t.view;
536
536
  for (const r of n) {
537
537
  const a = dt(e, r);
538
538
  if (a === null) continue;
539
539
  const { top: l, height: h } = a;
540
- l + h < 0 || l > i || (o.globalAlpha = 0.6, o.fillStyle = t.colours.surface, o.fillRect(0, l, s, h), o.globalAlpha = 1, Ze(o, 0, l, s, h, t.colours.muted, 0.7, qe, 1));
540
+ l + h < 0 || l > i || (o.globalAlpha = 0.6, o.fillStyle = t.colours.surface, o.fillRect(0, l, s, h), o.globalAlpha = 1, Ze(o, 0, l, s, h, t.colours.muted, 0.7, je, 1));
541
541
  }
542
542
  }
543
- function js(o, t, e, n) {
543
+ function Vs(o, t, e, n) {
544
544
  const s = Math.max(e.outerFrom, Math.min(e.outerTo, n.x)), i = Math.max(e.y, Math.min(e.y + e.height, n.y));
545
545
  Math.hypot(n.x - s, n.y - i) < 2 || (o.strokeStyle = t.colours.text, o.lineWidth = 1, o.setLineDash([2, 3]), o.beginPath(), o.moveTo(s + 0.5, i + 0.5), o.lineTo(n.x + 0.5, n.y + 0.5), o.stroke(), o.setLineDash([]));
546
546
  }
@@ -567,7 +567,7 @@ function qs(o, t, e) {
567
567
  for (const d of i.days)
568
568
  o.moveTo(d.x + 0.5, 0), o.lineTo(d.x + 0.5, a);
569
569
  o.stroke();
570
- const h = ws(n.options.calendar);
570
+ const h = vs(n.options.calendar);
571
571
  if (h.length > 0) {
572
572
  o.strokeStyle = s.muted, o.setLineDash([2, 3]), o.beginPath();
573
573
  for (const d of h) {
@@ -577,11 +577,11 @@ function qs(o, t, e) {
577
577
  o.stroke(), o.setLineDash([]);
578
578
  }
579
579
  }
580
- function Zs(o, t) {
580
+ function js(o, t) {
581
581
  const e = t.view.nowX();
582
582
  e !== null && (o.fillStyle = t.colours.now, o.fillRect(e, 0, 2, t.view.height));
583
583
  }
584
- function Js(o, t, e, n) {
584
+ function Zs(o, t, e, n) {
585
585
  const s = ht(t.colours, t, e.subtask.task, e.subtask.id);
586
586
  o.fillStyle = s;
587
587
  for (const [i, r] of [
@@ -591,12 +591,12 @@ function Js(o, t, e, n) {
591
591
  r <= i || (o.globalAlpha = 0.28 * n, o.fillRect(i, e.y, r - i, e.height));
592
592
  o.globalAlpha = n, o.fillRect(e.mainFrom, e.y, Math.max(1, e.mainTo - e.mainFrom), e.height), o.globalAlpha = 1;
593
593
  }
594
- function Vt(o, t, e) {
594
+ function qt(o, t, e) {
595
595
  if (o.dashed) return { fill: null, onDark: !1 };
596
- const n = o.muted ? Qs(t, e.surface, 0.5) : t;
596
+ const n = o.muted ? Js(t, e.surface, 0.5) : t;
597
597
  return { fill: n, onDark: Te(n, e.onAccent) > Te(n, e.text) };
598
598
  }
599
- function Qs(o, t, e) {
599
+ function Js(o, t, e) {
600
600
  const n = lt(o), s = lt(t);
601
601
  if (n === null || s === null) return o;
602
602
  const i = (r) => Math.round(n[r] + (s[r] - n[r]) * e);
@@ -615,42 +615,42 @@ function ht(o, t, e, n) {
615
615
  const s = (e === null ? void 0 : o.tasks.get(e)) ?? o.muted;
616
616
  return t.selectedTask === null ? s : e !== t.selectedTask ? o.forced ? o.muted : Ce(s, 1) : o.forced || t.selectedSubtask === null || n === null || n === t.selectedSubtask ? s : Ce(s, 0.5);
617
617
  }
618
- const tn = 2;
619
- function je(o, t, e, n) {
618
+ const Qs = 2;
619
+ function qe(o, t, e, n) {
620
620
  const { view: s, colours: i } = t;
621
- if (!Et(e, s.width, s.height)) return;
621
+ if (!Rt(e, s.width, s.height)) return;
622
622
  if (e.miniature) {
623
- Js(o, t, e, n);
623
+ Zs(o, t, e, n);
624
624
  return;
625
625
  }
626
- const r = kt(e.subtask.appearance), a = ht(i, t, e.subtask.task, e.subtask.id), l = Vt(r, a, i), h = e.y, d = e.height, u = Math.max(1, e.mainTo - e.mainFrom), p = l.onDark ? i.onAccent : i.text;
626
+ const r = yt(e.subtask.appearance), a = ht(i, t, e.subtask.task, e.subtask.id), l = qt(r, a, i), h = e.y, d = e.height, u = Math.max(1, e.mainTo - e.mainFrom), p = l.onDark ? i.onAccent : i.text;
627
627
  o.lineWidth = 1, o.fillStyle = a, o.strokeStyle = a;
628
- for (const [y, C] of [
628
+ for (const [y, S] of [
629
629
  [e.outerFrom, e.mainFrom],
630
630
  [e.mainTo, e.outerTo]
631
631
  ])
632
- C <= y || (o.globalAlpha = 0.28 * n, o.fillRect(y, h, C - y, d), o.globalAlpha = n, o.strokeRect(y + 0.5, h + 0.5, C - y - 1, d - 1));
632
+ S <= y || (o.globalAlpha = 0.28 * n, o.fillRect(y, h, S - y, d), o.globalAlpha = n, o.strokeRect(y + 0.5, h + 0.5, S - y - 1, d - 1));
633
633
  l.fill !== null && (o.globalAlpha = n, o.fillStyle = l.fill, o.fillRect(e.mainFrom, h, u, d));
634
634
  const m = e.subtask.progress;
635
635
  if (m !== void 0) {
636
- const y = Math.min(4, Math.max(2, Math.round(d / 6))), C = h + d - y - tn, A = Math.round(u * Math.max(0, Math.min(1, m)));
637
- o.fillStyle = l.fill === null ? a : p, o.globalAlpha = 0.3 * n, o.fillRect(e.mainFrom, C, u, y), o.globalAlpha = n, A > 0 && o.fillRect(e.mainFrom, C, A, y);
636
+ const y = Math.min(4, Math.max(2, Math.round(d / 6))), S = h + d - y - Qs, A = Math.round(u * Math.max(0, Math.min(1, m)));
637
+ o.fillStyle = l.fill === null ? a : p, o.globalAlpha = 0.3 * n, o.fillRect(e.mainFrom, S, u, y), o.globalAlpha = n, A > 0 && o.fillRect(e.mainFrom, S, A, y);
638
638
  }
639
639
  if (r.hatched) {
640
- const y = Math.max(1, Math.min(He, Math.floor((u - 2 * rt) / 3))), C = u >= 4 * y ? rt : 0, A = d >= 4 * rt ? rt : 0;
641
- o.globalAlpha = n, o.fillStyle = p, o.fillRect(e.mainFrom + C, h + A, y, d - 2 * A), o.fillRect(e.mainTo - C - y, h + A, y, d - 2 * A);
640
+ const y = Math.max(1, Math.min(He, Math.floor((u - 2 * rt) / 3))), S = u >= 4 * y ? rt : 0, A = d >= 4 * rt ? rt : 0;
641
+ o.globalAlpha = n, o.fillStyle = p, o.fillRect(e.mainFrom + S, h + A, y, d - 2 * A), o.fillRect(e.mainTo - S - y, h + A, y, d - 2 * A);
642
642
  }
643
- r.open && sn(o, e, h, d, i.surface, s.width), r.dashed && (o.globalAlpha = n, o.strokeStyle = a, o.setLineDash([4, 3]), o.strokeRect(e.mainFrom + 0.5, h + 0.5, u - 1, d - 1), o.setLineDash([])), o.globalAlpha = 1, e.depth > 0 && n === 1 && (o.strokeStyle = i.surface, o.strokeRect(e.outerFrom - 0.5, h - 0.5, e.outerTo - e.outerFrom + 1, d + 1));
643
+ r.open && en(o, e, h, d, i.surface, s.width), r.dashed && (o.globalAlpha = n, o.strokeStyle = a, o.setLineDash([4, 3]), o.strokeRect(e.mainFrom + 0.5, h + 0.5, u - 1, d - 1), o.setLineDash([])), o.globalAlpha = 1, e.depth > 0 && n === 1 && (o.strokeStyle = i.surface, o.strokeRect(e.outerFrom - 0.5, h - 0.5, e.outerTo - e.outerFrom + 1, d + 1));
644
644
  }
645
- const qe = 6, en = 16;
645
+ const je = 6, tn = 16;
646
646
  function Ze(o, t, e, n, s, i, r, a, l) {
647
647
  o.save(), o.beginPath(), o.rect(t, e, n, s), o.clip(), o.globalAlpha = 0.5 * r, o.strokeStyle = i, o.lineWidth = l, o.beginPath();
648
648
  for (let h = t - s; h < t + n + s; h += a)
649
649
  o.moveTo(h, e + s), o.lineTo(h + s, e);
650
650
  o.stroke(), o.restore();
651
651
  }
652
- function sn(o, t, e, n, s, i) {
653
- const r = t.mainFrom < 0, a = t.mainTo > i, l = Math.max(1, Math.min(t.mainTo, i) - Math.max(t.mainFrom, 0)), h = Math.min(en, l);
652
+ function en(o, t, e, n, s, i) {
653
+ const r = t.mainFrom < 0, a = t.mainTo > i, l = Math.max(1, Math.min(t.mainTo, i) - Math.max(t.mainFrom, 0)), h = Math.min(tn, l);
654
654
  r && Se(o, 0, h, e, n, s, 1), a && Se(o, i, -h, e, n, s, 1);
655
655
  }
656
656
  function Se(o, t, e, n, s, i, r) {
@@ -661,7 +661,7 @@ function Le(o, t) {
661
661
  const e = lt(o);
662
662
  return e === null ? o : `rgba(${e[0]}, ${e[1]}, ${e[2]}, ${t})`;
663
663
  }
664
- function Pt(o, t, e, n, s) {
664
+ function Bt(o, t, e, n, s) {
665
665
  const { data: i, colours: r } = t, a = i.taskOfDependency(e.dependency), l = s ?? i.violatedById.has(e.dependency.id), h = a !== null && a === t.selectedTask, d = l ? r.alarm : ht(r, t, a, null);
666
666
  if (o.strokeStyle = d, o.fillStyle = d, o.lineWidth = n || h ? 2 : 1.25, o.setLineDash(l ? [4, 3] : []), o.beginPath(), o.moveTo(e.x1, e.y1), e.kind === "curve")
667
667
  o.bezierCurveTo(e.c1x, e.y1, e.c2x, e.y2, e.x2, e.y2);
@@ -674,7 +674,7 @@ function Pt(o, t, e, n, s) {
674
674
  ])
675
675
  o.beginPath(), o.arc(u, p, l ? 3 : 2.5, 0, Math.PI * 2), o.fill();
676
676
  }
677
- function nn(o, t, e) {
677
+ function sn(o, t, e) {
678
678
  const { data: n } = t;
679
679
  if (n.violatedById.size !== 0)
680
680
  for (const s of n.violatedById.values()) {
@@ -682,44 +682,44 @@ function nn(o, t, e) {
682
682
  if (r === void 0) continue;
683
683
  const a = dt(e, r.lane);
684
684
  if (a === null || !a.miniature) continue;
685
- const l = et(e.rows, a.top + e.scrollY);
685
+ const l = st(e.rows, a.top + e.scrollY);
686
686
  if (l === null) continue;
687
- const h = N(e, s.arrival), d = Math.max(h + 2, N(e, s.arrival + s.shortBy));
688
- Bt(o, t, h, d, l.top - e.scrollY + 1, 3);
687
+ const h = B(e, s.arrival), d = Math.max(h + 2, B(e, s.arrival + s.shortBy));
688
+ Nt(o, t, h, d, l.top - e.scrollY + 1, 3);
689
689
  }
690
690
  }
691
- function Bt(o, t, e, n, s, i) {
691
+ function Nt(o, t, e, n, s, i) {
692
692
  if (!t.colours.forced) {
693
693
  o.fillStyle = t.colours.alarm, o.fillRect(e, s, n - e, i);
694
694
  return;
695
695
  }
696
696
  o.strokeStyle = t.colours.alarm, o.lineWidth = i, o.setLineDash([4, 3]), o.beginPath(), o.moveTo(e, s + i / 2), o.lineTo(n, s + i / 2), o.stroke(), o.setLineDash([]);
697
697
  }
698
- function on(o, t, e, n) {
698
+ function nn(o, t, e, n) {
699
699
  const s = dt(e, n.lane);
700
700
  if (s === null || s.top + s.height < 0 || s.top > t.view.height) return;
701
- const i = Math.max(0, N(e, n.from)), r = Math.min(t.view.width, N(e, n.to));
702
- r <= i || (o.globalAlpha = 0.1, o.fillStyle = t.colours.muted, o.fillRect(i, s.top, r - i, s.height), o.globalAlpha = 1, Ze(o, i, s.top, r - i, s.height, t.colours.muted, 0.7, qe, 1));
701
+ const i = Math.max(0, B(e, n.from)), r = Math.min(t.view.width, B(e, n.to));
702
+ r <= i || (o.globalAlpha = 0.1, o.fillStyle = t.colours.muted, o.fillRect(i, s.top, r - i, s.height), o.globalAlpha = 1, Ze(o, i, s.top, r - i, s.height, t.colours.muted, 0.7, je, 1));
703
703
  }
704
- function Nt(o, t, e, n) {
704
+ function xt(o, t, e, n) {
705
705
  const s = dt(e, n.lane);
706
706
  if (s === null) return;
707
- const i = N(e, n.from), r = Math.max(i + 2, N(e, n.to));
708
- if (o.fillStyle = t.colours.alarm, o.globalAlpha = 0.14, o.fillRect(i, s.top + 1, r - i, Math.max(1, s.height - 2)), o.globalAlpha = 1, Bt(o, t, i, r, s.top + 1, Math.min(3, Math.max(1, s.height - 1))), s.miniature) {
709
- const a = et(e.rows, s.top + e.scrollY);
710
- a !== null && Bt(o, t, i, r, a.top - e.scrollY + 1, 3);
707
+ const i = B(e, n.from), r = Math.max(i + 2, B(e, n.to));
708
+ if (o.fillStyle = t.colours.alarm, o.globalAlpha = 0.14, o.fillRect(i, s.top + 1, r - i, Math.max(1, s.height - 2)), o.globalAlpha = 1, Nt(o, t, i, r, s.top + 1, Math.min(3, Math.max(1, s.height - 1))), s.miniature) {
709
+ const a = st(e.rows, s.top + e.scrollY);
710
+ a !== null && Nt(o, t, i, r, a.top - e.scrollY + 1, 3);
711
711
  }
712
712
  }
713
- function rn(o, t, e) {
714
- const { colours: n } = t, s = kt(e.subtask.appearance), i = Vt(s, ht(n, t, e.subtask.task, e.subtask.id), n);
713
+ function on(o, t, e) {
714
+ const { colours: n } = t, s = yt(e.subtask.appearance), i = qt(s, ht(n, t, e.subtask.task, e.subtask.id), n);
715
715
  if (n.forced) {
716
716
  o.strokeStyle = n.active, o.lineWidth = 2, o.strokeRect(e.outerFrom - 2, e.y - 2, Math.max(1, e.outerTo - e.outerFrom) + 4, e.height + 4);
717
717
  return;
718
718
  }
719
- o.globalAlpha = an, o.fillStyle = i.onDark ? n.onAccent : n.text, o.fillRect(e.outerFrom, e.y, Math.max(1, e.outerTo - e.outerFrom), e.height), o.globalAlpha = 1;
719
+ o.globalAlpha = rn, o.fillStyle = i.onDark ? n.onAccent : n.text, o.fillRect(e.outerFrom, e.y, Math.max(1, e.outerTo - e.outerFrom), e.height), o.globalAlpha = 1;
720
720
  }
721
- const an = 0.2;
722
- function ln(o, t) {
721
+ const rn = 0.2;
722
+ function an(o, t) {
723
723
  const e = t.selectedTask;
724
724
  if (e !== null) {
725
725
  o.strokeStyle = t.colours.text;
@@ -732,36 +732,36 @@ function ln(o, t) {
732
732
  }
733
733
  }
734
734
  }
735
- const pt = 32, dn = 18;
735
+ const mt = 32, ln = 18;
736
736
  function Ae(o, t) {
737
- if (!(t > 2 * pt)) return 0;
738
- const e = pt - o, n = o - (t - pt), s = Math.max(e, n);
737
+ if (!(t > 2 * mt)) return 0;
738
+ const e = mt - o, n = o - (t - mt), s = Math.max(e, n);
739
739
  if (s <= 0) return 0;
740
- const i = Math.min(1, s / pt), r = dn * i * i;
740
+ const i = Math.min(1, s / mt), r = ln * i * i;
741
741
  return e > 0 ? -r : r;
742
742
  }
743
743
  function at(o, t, e) {
744
744
  const n = (s, i) => {
745
- const r = st(s);
745
+ const r = nt(s);
746
746
  return s.lane === i.lane && r.from < i.to && i.from < r.to;
747
747
  };
748
748
  return e.some((s) => n(o, s) && !(t !== null && n(t, s)));
749
749
  }
750
- function hn(o, t, e, n) {
750
+ function dn(o, t, e, n) {
751
751
  const s = /* @__PURE__ */ new Set();
752
752
  if (n === void 0) return s;
753
753
  for (const i of o)
754
754
  i !== e && (n(t, i) || s.add(i));
755
755
  return s;
756
756
  }
757
- function cn(o, t) {
757
+ function hn(o, t) {
758
758
  const { step: e, offset: n } = typeof t == "number" ? { step: t, offset: 0 } : t;
759
759
  if (!(e > 0) || !Number.isFinite(o)) return o;
760
760
  const s = $t(o) + n;
761
761
  return s + Math.round((o - s) / e) * e;
762
762
  }
763
763
  const De = "\0placing", _e = /* @__PURE__ */ new Set();
764
- function At(o) {
764
+ function Dt(o) {
765
765
  switch (o.kind) {
766
766
  case "subtask":
767
767
  return `subtask:${o.subtask.id}:${o.part}`;
@@ -773,8 +773,8 @@ function At(o) {
773
773
  return "nothing";
774
774
  }
775
775
  }
776
- const Fe = 3, un = 10, fn = 600;
777
- class pn {
776
+ const Fe = 3, cn = 10, un = 600;
777
+ class fn {
778
778
  constructor(t) {
779
779
  f(this, "gesture", { kind: "none" });
780
780
  f(this, "touches", /* @__PURE__ */ new Map());
@@ -837,7 +837,7 @@ class pn {
837
837
  if (t.kind !== "edit" && t.kind !== "place") return null;
838
838
  const e = Ve(this.host.view.viewport(), t.ghost);
839
839
  if (e === null) return null;
840
- const n = this.ghostFindings(t.ghost, this.ghostHome(t)), s = t.kind === "edit" && (t.mode === "leadIn" || t.mode === "leadOut"), i = s ? st(t.ghost) : t.ghost;
840
+ const n = this.ghostFindings(t.ghost, this.ghostHome(t)), s = t.kind === "edit" && (t.mode === "leadIn" || t.mode === "leadOut"), i = s ? nt(t.ghost) : t.ghost;
841
841
  return {
842
842
  refused: this.refused,
843
843
  refusedLanes: [...t.refused],
@@ -889,7 +889,7 @@ class pn {
889
889
  group: n,
890
890
  timer: setTimeout(() => {
891
891
  this.resting = null, e.openForGesture = /* @__PURE__ */ new Set([...e.openForGesture, n]), this.host.viewChanged();
892
- }, fn)
892
+ }, un)
893
893
  }));
894
894
  }
895
895
  stopResting() {
@@ -920,7 +920,7 @@ class pn {
920
920
  askRefused(t, e) {
921
921
  if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return _e;
922
922
  const n = this.host.data.lanes.map((s) => s.id);
923
- return hn(n, t, e, this.host.handlers().canMoveTo);
923
+ return dn(n, t, e, this.host.handlers().canMoveTo);
924
924
  }
925
925
  /** What a press at a point would start, given the intents the caller handles. */
926
926
  modeAt(t, e) {
@@ -928,10 +928,10 @@ class pn {
928
928
  for (let i = n.boxes.length - 1; i >= 0; i--) {
929
929
  const r = n.boxes[i];
930
930
  if (s.includes("stretch")) {
931
- const a = Ps(r, t, e);
931
+ const a = Rs(r, t, e);
932
932
  if (a !== null) return { mode: a === "from" ? "stretch-from" : "stretch-to", subtask: r.subtask };
933
933
  }
934
- if (Ke(r, t, e) !== null)
934
+ if (ze(r, t, e) !== null)
935
935
  return s.includes("move") || s.includes("lane") ? { mode: "move", subtask: r.subtask } : { mode: "pan", subtask: r.subtask };
936
936
  }
937
937
  return { mode: "pan", subtask: null };
@@ -945,7 +945,7 @@ class pn {
945
945
  }
946
946
  const s = this.gesture;
947
947
  if (s.kind === "pending" && s.pointerId === t.pointerId) {
948
- if (Math.hypot(e - s.x0, n - s.y0) < (t.pointerType === "touch" ? un : Fe)) return;
948
+ if (Math.hypot(e - s.x0, n - s.y0) < (t.pointerType === "touch" ? cn : Fe)) return;
949
949
  if (s.mode === "pan" || s.subtask === null)
950
950
  this.gesture = { kind: "pan", pointerId: s.pointerId, lastX: s.x0, lastY: s.y0 }, this.setCursor("grabbing");
951
951
  else {
@@ -1033,7 +1033,7 @@ class pn {
1033
1033
  refreshHover() {
1034
1034
  if (!this.idle || this.hoverKey === "nothing" || this.byKeyboard) return;
1035
1035
  const { x: t, y: e } = this.hoverPoint, n = this.host.view.hitAt(t, e);
1036
- this.hover = n, this.hoverKey = At(n);
1036
+ this.hover = n, this.hoverKey = Dt(n);
1037
1037
  }
1038
1038
  pointerLeave() {
1039
1039
  this.gesture.kind !== "none" || this.byKeyboard || this.setHover({ kind: "nothing" }, "nothing");
@@ -1078,7 +1078,7 @@ class pn {
1078
1078
  this.host.select(r, i.kind === "subtask" ? i.subtask.id : null), this.report("click", i, t, e, n, s);
1079
1079
  }
1080
1080
  hoverAt(t, e, n, s) {
1081
- const i = this.host.view.hitAt(n, s), r = At(i), { mode: a } = this.modeAt(n, s);
1081
+ const i = this.host.view.hitAt(n, s), r = Dt(i), { mode: a } = this.modeAt(n, s);
1082
1082
  if (this.setCursor(a === "move" ? "grab" : a === "stretch-from" || a === "stretch-to" ? "ew-resize" : "default"), this.hoverPoint = { x: n, y: s }, r === this.hoverKey) {
1083
1083
  (i.kind === "subtask" || i.kind === "dependency") && this.host.interactionChanged();
1084
1084
  return;
@@ -1089,7 +1089,7 @@ class pn {
1089
1089
  pointer's would be - and reported to nobody, since `onInteraction`
1090
1090
  speaks of pointer positions. `nothing` hands the hover back. */
1091
1091
  setKeyboardHover(t, e) {
1092
- this.byKeyboard = t.kind !== "nothing", this.hoverPoint = e, this.hover = t, this.hoverKey = At(t), this.host.interactionChanged();
1092
+ this.byKeyboard = t.kind !== "nothing", this.hoverPoint = e, this.hover = t, this.hoverKey = Dt(t), this.host.interactionChanged();
1093
1093
  }
1094
1094
  setHover(t, e) {
1095
1095
  e !== this.hoverKey && (this.hoverKey = e, this.hover = t, this.host.interactionChanged());
@@ -1216,9 +1216,9 @@ class pn {
1216
1216
  return { ...i, from: h, to: h + (i.to - i.from), lane: p };
1217
1217
  }
1218
1218
  case "stretch-from":
1219
- return { ...i, from: Math.min(l, i.to - Math.max(r.step, V)) };
1219
+ return { ...i, from: Math.min(l, i.to - Math.max(r.step, q)) };
1220
1220
  case "stretch-to":
1221
- return { ...i, to: Math.max(l, i.from + Math.max(r.step, V)) };
1221
+ return { ...i, to: Math.max(l, i.from + Math.max(r.step, q)) };
1222
1222
  case "leadIn":
1223
1223
  return { ...i, leadIn: Math.max(0, i.from - l) };
1224
1224
  case "leadOut":
@@ -1229,15 +1229,15 @@ class pn {
1229
1229
  a start this way, and a key by one step of the raster - one arithmetic,
1230
1230
  so a key proposes exactly what a drag of that length would. */
1231
1231
  shifted(t, e, n) {
1232
- const s = tt(this.host.view.options.calendar), i = U(t, s) + e, r = s.intervals.length === 0 ? i : j(Math.max(0, Math.min(s.total, i)), s);
1232
+ const s = et(this.host.view.options.calendar), i = W(t, s) + e, r = s.intervals.length === 0 ? i : j(Math.max(0, Math.min(s.total, i)), s);
1233
1233
  return this.snapInside(r, n);
1234
1234
  }
1235
1235
  /** Snapped - and, where the raster lands in time the calendar removes, moved
1236
1236
  on to the seam, where time counts again. An intent never asks for a time
1237
1237
  nobody works. */
1238
1238
  snapInside(t, e) {
1239
- const n = cn(t, e), s = tt(this.host.view.options.calendar);
1240
- return s.intervals.length === 0 ? n : j(U(n, s), s);
1239
+ const n = hn(t, e), s = et(this.host.view.options.calendar);
1240
+ return s.intervals.length === 0 ? n : j(W(n, s), s);
1241
1241
  }
1242
1242
  intentsOf(t, e, n) {
1243
1243
  const s = [], i = this.host.view.options.intents, r = t.id;
@@ -1258,13 +1258,13 @@ class pn {
1258
1258
  computed on every pointer movement. */
1259
1259
  ghostFindings(t, e) {
1260
1260
  const n = this.host.data, s = (d) => d.lane === t.lane || d.lane === e, r = [...n.subtasks.filter((d) => d.id !== t.id && s(d)), t], a = (d) => d.first === t.id || d.second === t.id, l = n.dependencies.filter((d) => d.from === t.id || d.to === t.id), h = t.id === De ? n.subtasks : n.subtasks.map((d) => d.id === t.id ? t : d);
1261
- return { overlaps: Wt(r).filter(a), violated: Xt(h, l) };
1261
+ return { overlaps: Xt(r).filter(a), violated: Vt(h, l) };
1262
1262
  }
1263
1263
  }
1264
- function mn(o, t) {
1264
+ function pn(o, t) {
1265
1265
  const e = /* @__PURE__ */ new Map();
1266
1266
  for (const n of t) {
1267
- const s = o.slots.get(n.lane), i = s === void 0 ? null : et(o, s.top);
1267
+ const s = o.slots.get(n.lane), i = s === void 0 ? null : st(o, s.top);
1268
1268
  if (i === null) continue;
1269
1269
  const r = o.rows.indexOf(i);
1270
1270
  e.set(r, [...e.get(r) ?? [], n]);
@@ -1272,7 +1272,7 @@ function mn(o, t) {
1272
1272
  return [...e.entries()].sort(([n], [s]) => n - s).map(([, n]) => n.sort((s, i) => s.from - i.from || s.to - i.to));
1273
1273
  }
1274
1274
  const Oe = (o, t) => t < o.from ? o.from - t : t > o.to ? t - o.to : 0;
1275
- function gn(o, t, e, n) {
1275
+ function mn(o, t, e, n) {
1276
1276
  var h;
1277
1277
  let s = -1, i = -1;
1278
1278
  for (let d = 0; d < o.length && t !== null && s < 0; d++)
@@ -1308,7 +1308,7 @@ function gn(o, t, e, n) {
1308
1308
  }
1309
1309
  }
1310
1310
  }
1311
- function kn(o, t, e, n) {
1311
+ function gn(o, t, e, n) {
1312
1312
  if (e.kind === "dependency") {
1313
1313
  const i = o.find((a) => a.id === e.id), r = i === void 0 ? void 0 : n === "out" ? i.to : i.from;
1314
1314
  return r !== void 0 && t.has(r) ? { kind: "subtask", id: r } : e;
@@ -1318,7 +1318,7 @@ function kn(o, t, e, n) {
1318
1318
  );
1319
1319
  return s === void 0 ? e : { kind: "dependency", id: s.id };
1320
1320
  }
1321
- const yn = 150, vn = {
1321
+ const kn = 150, yn = {
1322
1322
  ArrowRight: "next",
1323
1323
  ArrowLeft: "previous",
1324
1324
  ArrowUp: "up",
@@ -1328,7 +1328,7 @@ const yn = 150, vn = {
1328
1328
  PageDown: "pageNext",
1329
1329
  PageUp: "pagePrevious"
1330
1330
  };
1331
- class wn {
1331
+ class vn {
1332
1332
  constructor(t) {
1333
1333
  f(this, "spoken", null);
1334
1334
  f(this, "timer", null);
@@ -1358,20 +1358,20 @@ class wn {
1358
1358
  const i = this.active();
1359
1359
  if (i === null) return !1;
1360
1360
  const r = this.host.data, a = n ? !t.shiftKey : t.key === "]";
1361
- return this.show(kn(r.dependencies, r.subtaskById, i, a ? "out" : "back")), !0;
1361
+ return this.show(gn(r.dependencies, r.subtaskById, i, a ? "out" : "back")), !0;
1362
1362
  }
1363
1363
  if (t.ctrlKey) return !1;
1364
1364
  if (t.altKey) return this.edit(t);
1365
1365
  if (t.key === "Escape")
1366
1366
  return e.byKeyboard ? (this.blur(), !0) : !1;
1367
1367
  if (t.key === "Enter" || t.key === " ") return this.select();
1368
- const s = t.shiftKey ? void 0 : vn[t.key];
1368
+ const s = t.shiftKey ? void 0 : yn[t.key];
1369
1369
  return s === void 0 ? !1 : (this.walk(s), !0);
1370
1370
  }
1371
1371
  walk(t) {
1372
1372
  var l;
1373
1373
  const { data: e, view: n } = this.host, s = this.active(), i = s === null ? null : s.kind === "subtask" ? s.id : ((l = e.dependencies.find((h) => h.id === s.id)) == null ? void 0 : l.from) ?? null;
1374
- let r = mn(n.rows, e.subtasks);
1374
+ let r = pn(n.rows, e.subtasks);
1375
1375
  if (i === null) {
1376
1376
  const h = r.filter((d) => {
1377
1377
  const u = n.boxById.get(d[0].id);
@@ -1379,7 +1379,7 @@ class wn {
1379
1379
  });
1380
1380
  h.length > 0 && (r = h);
1381
1381
  }
1382
- const a = gn(r, i, t, this.host.visibleDomain());
1382
+ const a = mn(r, i, t, this.host.visibleDomain());
1383
1383
  a !== null && this.show({ kind: "subtask", id: a.id });
1384
1384
  }
1385
1385
  /** Space and Enter select as a click does: the whole task, and the subtask. */
@@ -1401,15 +1401,15 @@ class wn {
1401
1401
  const s = e.subtask, i = this.host.gestures, r = this.host.view.options.intents, a = i.snapStep(), l = a.step > 0 ? a : { step: this.host.view.step(), offset: 0 }, h = this.host.data.blocked;
1402
1402
  let d = null;
1403
1403
  if (!t.shiftKey && r.includes("move")) {
1404
- const m = (C) => ({ ...s, from: C, to: C + (s.to - s.from) });
1404
+ const m = (S) => ({ ...s, from: S, to: S + (s.to - s.from) });
1405
1405
  let y = s.from;
1406
- for (let C = 0; C < 1e3; C++) {
1406
+ for (let S = 0; S < 1e3; S++) {
1407
1407
  const A = i.shifted(y, n * l.step, l);
1408
1408
  if (A === y || (y = A, !at(m(y), s, h))) break;
1409
1409
  }
1410
1410
  y !== s.from && !at(m(y), s, h) && (d = { kind: "move", subtask: s.id, from: y, to: m(y).to });
1411
1411
  } else if (t.shiftKey && r.includes("stretch")) {
1412
- const m = Math.max(i.shifted(s.to, n * l.step, l), s.from + Math.max(l.step, V));
1412
+ const m = Math.max(i.shifted(s.to, n * l.step, l), s.from + Math.max(l.step, q));
1413
1413
  m !== s.to && !at({ ...s, to: m }, s, h) && (d = { kind: "stretch", subtask: s.id, from: s.from, to: m });
1414
1414
  }
1415
1415
  return i.byKeyboard = !0, d !== null && ((p = (u = this.host.handlers()).onIntent) == null || p.call(u, d)), this.scheduleReadout(), !0;
@@ -1479,24 +1479,24 @@ class wn {
1479
1479
  if (!this.host.gestures.byKeyboard) return;
1480
1480
  const e = this.host.data.tooltipTargetFor(t);
1481
1481
  e !== null && (this.spoken = { target: e, lane: t.kind === "subtask" ? t.subtask.lane : null, count: (((n = this.spoken) == null ? void 0 : n.count) ?? 0) + 1 }, this.host.spokenChanged());
1482
- }, yn);
1482
+ }, kn);
1483
1483
  }
1484
1484
  /** Unmount: no readout after it. */
1485
1485
  stop() {
1486
1486
  this.timer !== null && clearTimeout(this.timer), this.timer = null;
1487
1487
  }
1488
1488
  }
1489
- const Je = [], bn = 56;
1490
- function Mn(o, t = bn) {
1491
- return o > 0 ? Math.min(q, Math.max(15 * V, bs(o * t, 1))) : 15 * V;
1489
+ const Je = [], wn = 56;
1490
+ function bn(o, t = wn) {
1491
+ return o > 0 ? Math.min(Z, Math.max(15 * q, ws(o * t, 1))) : 15 * q;
1492
1492
  }
1493
- function Tn(o, t, e = Je) {
1493
+ function Mn(o, t, e = Je) {
1494
1494
  const [n, s] = Qe(o, e);
1495
- return Ms(e, n, s, t, $t(n)).filter(
1495
+ return bs(e, n, s, t, $t(n)).filter(
1496
1496
  (i) => i.workingTime >= o[0] && i.workingTime <= o[1]
1497
1497
  );
1498
1498
  }
1499
- function In(o, t = Je) {
1499
+ function Tn(o, t = Je) {
1500
1500
  const [e, n] = Qe(o, t), s = [], i = new Date(e);
1501
1501
  for (i.setHours(0, 0, 0, 0); i.getTime() < n && s.length < 400; ) {
1502
1502
  const r = i.getTime();
@@ -1505,41 +1505,41 @@ function In(o, t = Je) {
1505
1505
  s.push({
1506
1506
  start: r,
1507
1507
  end: a,
1508
- from: U(r, t),
1509
- to: U(a, t)
1508
+ from: W(r, t),
1509
+ to: W(a, t)
1510
1510
  });
1511
1511
  }
1512
1512
  return s;
1513
1513
  }
1514
- const Dt = [1, 2, 7, 14, 28];
1515
- function Cn(o, t) {
1516
- return Dt.find((e) => e * o >= t) ?? Dt[Dt.length - 1];
1514
+ const _t = [1, 2, 7, 14, 28];
1515
+ function In(o, t) {
1516
+ return _t.find((e) => e * o >= t) ?? _t[_t.length - 1];
1517
1517
  }
1518
- function _t(o, t) {
1519
- return ((Math.round((o - $t(o)) / q) - 4) % t + t) % t === 0;
1518
+ function Ft(o, t) {
1519
+ return ((Math.round((o - $t(o)) / Z) - 4) % t + t) % t === 0;
1520
1520
  }
1521
- function Sn(o, t, e, n) {
1521
+ function Cn(o, t, e, n) {
1522
1522
  const s = o[1] - o[0];
1523
1523
  if (!(s > 0)) return [o[0], o[1]];
1524
1524
  const i = Math.min(n.max, Math.max(n.min, s * e)), r = (t - o[0]) / s, a = t - r * i;
1525
1525
  return [a, a + i];
1526
1526
  }
1527
- function Ln(o, t) {
1527
+ function Sn(o, t) {
1528
1528
  return [o[0] + t, o[1] + t];
1529
1529
  }
1530
1530
  function Qe(o, t) {
1531
- const e = tt(t);
1531
+ const e = et(t);
1532
1532
  if (e.intervals.length === 0) return [o[0], o[1]];
1533
1533
  const n = (s) => Math.max(0, Math.min(e.total, s));
1534
1534
  return [j(n(o[0]), e), j(n(o[1]), e)];
1535
1535
  }
1536
- const mt = 44;
1537
- class An {
1536
+ const gt = 44;
1537
+ class Ln {
1538
1538
  constructor(t) {
1539
1539
  f(this, "options", {
1540
- laneHeight: mt,
1540
+ laneHeight: gt,
1541
1541
  calendar: [],
1542
- zoomLimits: { min: xt, max: 28 * q },
1542
+ zoomLimits: { min: Gt, max: 28 * Z },
1543
1543
  snap: "ticks",
1544
1544
  intents: [],
1545
1545
  now: null,
@@ -1547,14 +1547,14 @@ class An {
1547
1547
  attach: "centre",
1548
1548
  ends: "dot"
1549
1549
  });
1550
- f(this, "domain", [0, q]);
1550
+ f(this, "domain", [0, Z]);
1551
1551
  f(this, "scrollY", 0);
1552
1552
  f(this, "width", 0);
1553
1553
  f(this, "height", 0);
1554
1554
  /* What is laid out from top to bottom (`rows.ts`). It is derived here and
1555
1555
  not in the data, because a row's height comes from a view option; every y
1556
1556
  in the package reads it. */
1557
- f(this, "rows", ge({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: mt }));
1557
+ f(this, "rows", ge({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: gt }));
1558
1558
  /** The folded groups, as the scene holds them. */
1559
1559
  f(this, "collapsed", /* @__PURE__ */ new Set());
1560
1560
  /** The groups a gesture in flight holds open. Dropped when it ends; the
@@ -1570,18 +1570,18 @@ class An {
1570
1570
  setOptions(t, e) {
1571
1571
  const n = t.calendar !== this.options.calendar, s = this.options.calendar;
1572
1572
  if (this.options = t, e !== null)
1573
- this.domain = [U(e[0], t.calendar), U(e[1], t.calendar)];
1573
+ this.domain = [W(e[0], t.calendar), W(e[1], t.calendar)];
1574
1574
  else if (n) {
1575
- const i = tt(s), r = (a) => {
1575
+ const i = et(s), r = (a) => {
1576
1576
  const l = i.intervals.length === 0 ? a : Math.max(0, Math.min(i.total, a));
1577
- return U(j(l, i), t.calendar) + (a - l);
1577
+ return W(j(l, i), t.calendar) + (a - l);
1578
1578
  };
1579
1579
  this.domain = [r(this.domain[0]), r(this.domain[1])];
1580
1580
  }
1581
1581
  }
1582
1582
  viewport() {
1583
1583
  return {
1584
- scale: new Ts(this.domain, [0, this.width]),
1584
+ scale: new Ms(this.domain, [0, this.width]),
1585
1585
  calendar: this.options.calendar,
1586
1586
  laneHeight: this.options.laneHeight,
1587
1587
  scrollY: this.scrollY,
@@ -1598,14 +1598,14 @@ class An {
1598
1598
  /** The fine band's step at the current zoom. */
1599
1599
  step() {
1600
1600
  const t = this.domain[1] - this.domain[0];
1601
- return Mn(this.width > 0 ? t / this.width : t);
1601
+ return bn(this.width > 0 ? t / this.width : t);
1602
1602
  }
1603
1603
  /** Lays the rows out, clamps the scroll, and lays the data out anew. */
1604
1604
  layout() {
1605
1605
  this.rows = ge({
1606
1606
  lanes: this.data.lanes,
1607
1607
  groups: this.data.groups,
1608
- collapsed: Os(this.collapsed, this.openForGesture),
1608
+ collapsed: Fs(this.collapsed, this.openForGesture),
1609
1609
  laneHeight: this.options.laneHeight
1610
1610
  }), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY));
1611
1611
  const t = this.viewport();
@@ -1619,7 +1619,7 @@ class An {
1619
1619
  this.paths = [];
1620
1620
  for (const e of this.data.dependencies) {
1621
1621
  const n = this.boxById.get(e.from), s = this.boxById.get(e.to);
1622
- n === void 0 || s === void 0 || this.paths.push(Rt(t, e, n, s, this.options));
1622
+ n === void 0 || s === void 0 || this.paths.push(Pt(t, e, n, s, this.options));
1623
1623
  }
1624
1624
  }
1625
1625
  /** The days of the coarse band and the ticks of the fine band, in pixels. */
@@ -1628,11 +1628,11 @@ class An {
1628
1628
  if (this.width <= 0) return { days: [], ticks: [], step: t };
1629
1629
  const e = this.viewport().scale, n = this.options.calendar;
1630
1630
  return {
1631
- days: In(this.domain, n).map((s) => {
1631
+ days: Tn(this.domain, n).map((s) => {
1632
1632
  const i = Math.round(e.toPx(s.from));
1633
1633
  return { start: s.start, x: i, width: Math.round(e.toPx(s.to)) - i };
1634
1634
  }),
1635
- ticks: Tn(this.domain, t, n).map((s) => ({ wallClock: s.wallClock, x: Math.round(e.toPx(s.workingTime)) })),
1635
+ ticks: Mn(this.domain, t, n).map((s) => ({ wallClock: s.wallClock, x: Math.round(e.toPx(s.workingTime)) })),
1636
1636
  step: t
1637
1637
  };
1638
1638
  }
@@ -1640,12 +1640,12 @@ class An {
1640
1640
  nowX() {
1641
1641
  const t = this.options.now;
1642
1642
  if (t === null || this.width <= 0) return null;
1643
- const e = Math.round(this.viewport().scale.toPx(U(t, this.options.calendar)));
1643
+ const e = Math.round(this.viewport().scale.toPx(W(t, this.options.calendar)));
1644
1644
  return e >= 0 && e <= this.width ? e : null;
1645
1645
  }
1646
1646
  hitAt(t, e) {
1647
1647
  for (let r = this.boxes.length - 1; r >= 0; r--) {
1648
- const a = this.boxes[r], l = Ke(a, t, e);
1648
+ const a = this.boxes[r], l = ze(a, t, e);
1649
1649
  if (l !== null) return { kind: "subtask", subtask: a.subtask, part: l };
1650
1650
  }
1651
1651
  let n = null, s = 4;
@@ -1659,7 +1659,7 @@ class An {
1659
1659
  }
1660
1660
  /** The wall-clock time at a plot x; within the calendar's extent. */
1661
1661
  timeAt(t) {
1662
- const e = this.viewport().scale.fromPx(t), n = tt(this.options.calendar);
1662
+ const e = this.viewport().scale.fromPx(t), n = et(this.options.calendar);
1663
1663
  return n.intervals.length === 0 ? e : j(Math.max(0, Math.min(n.total, e)), n);
1664
1664
  }
1665
1665
  /** The lane at a y, strips included: what the pointer is ON.
@@ -1679,19 +1679,19 @@ class An {
1679
1679
  aim at. Hover, the tooltip and selection do read a strip - they cost
1680
1680
  nothing if they are a pixel out. */
1681
1681
  dropLaneIdAt(t) {
1682
- const e = et(this.rows, t + this.scrollY);
1682
+ const e = st(this.rows, t + this.scrollY);
1683
1683
  return e === null || e.kind !== "lane" ? null : e.lane ?? null;
1684
1684
  }
1685
1685
  /** The folded group a y lies over, or null. */
1686
1686
  foldedGroupAt(t) {
1687
- const e = et(this.rows, t + this.scrollY);
1687
+ const e = st(this.rows, t + this.scrollY);
1688
1688
  return e !== null && e.kind === "miniature" ? e.group ?? null : null;
1689
1689
  }
1690
1690
  /** Pans by pixels. Says what moved: the span through time, the lanes, or
1691
1691
  neither - a scroll through the lanes is no news about the time. */
1692
1692
  pan(t, e) {
1693
1693
  const n = this.domain[0], s = this.scrollY, i = this.domain[1] - n;
1694
- this.width > 0 && t !== 0 && (this.domain = Ln(this.domain, t / this.width * i)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
1694
+ this.width > 0 && t !== 0 && (this.domain = Sn(this.domain, t / this.width * i)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
1695
1695
  const r = this.domain[0] !== n;
1696
1696
  return { moved: r || this.scrollY !== s, time: r };
1697
1697
  }
@@ -1699,18 +1699,18 @@ class An {
1699
1699
  zoomAt(t, e) {
1700
1700
  if (this.width <= 0 || !Number.isFinite(e)) return !1;
1701
1701
  const n = this.domain, s = this.viewport().scale.fromPx(t);
1702
- return this.domain = Sn(this.domain, s, e, this.options.zoomLimits), n[0] !== this.domain[0] || n[1] !== this.domain[1];
1702
+ return this.domain = Cn(this.domain, s, e, this.options.zoomLimits), n[0] !== this.domain[0] || n[1] !== this.domain[1];
1703
1703
  }
1704
1704
  }
1705
1705
  const Ee = {
1706
1706
  width: 0,
1707
1707
  height: 0,
1708
- laneHeight: mt,
1708
+ laneHeight: gt,
1709
1709
  scrollY: 0,
1710
1710
  headers: [],
1711
1711
  days: [],
1712
1712
  ticks: [],
1713
- step: xt,
1713
+ step: Gt,
1714
1714
  ghost: null,
1715
1715
  grips: [],
1716
1716
  cursor: "default",
@@ -1720,10 +1720,10 @@ const Ee = {
1720
1720
  spoken: null,
1721
1721
  summary: { lanes: 0, subtasks: 0, from: 0, to: 0, overlaps: 0, violated: 0, blocked: 0 }
1722
1722
  };
1723
- class Dn {
1723
+ class An {
1724
1724
  constructor() {
1725
- f(this, "data", new Hs(() => this.viewChanged()));
1726
- f(this, "view", new An(this.data));
1725
+ f(this, "data", new Gs(() => this.viewChanged()));
1726
+ f(this, "view", new Ln(this.data));
1727
1727
  f(this, "gestures");
1728
1728
  f(this, "keys");
1729
1729
  f(this, "handlersNow", {});
@@ -1780,7 +1780,7 @@ class Dn {
1780
1780
  f(this, "key", (t) => this.keys.key(t));
1781
1781
  f(this, "focus", (t) => this.keys.focus(t));
1782
1782
  f(this, "blur", () => this.keys.blur());
1783
- this.gestures = new pn({
1783
+ this.gestures = new fn({
1784
1784
  data: this.data,
1785
1785
  view: this.view,
1786
1786
  plotElement: () => this.plot,
@@ -1792,7 +1792,7 @@ class Dn {
1792
1792
  this.viewChanged(), t && this.reportDomain();
1793
1793
  },
1794
1794
  interactionChanged: () => this.interactionChanged()
1795
- }), this.keys = new wn({
1795
+ }), this.keys = new vn({
1796
1796
  data: this.data,
1797
1797
  view: this.view,
1798
1798
  gestures: this.gestures,
@@ -1856,7 +1856,7 @@ class Dn {
1856
1856
  /* DOM binding */
1857
1857
  /* ---------------------------------------------------------------- */
1858
1858
  bind(t, e, n, s) {
1859
- this.root = t, this.plot = e, this.dataCanvas = n, this.overlayCanvas = s, this.unsubscribeTheme = Is(() => {
1859
+ this.root = t, this.plot = e, this.dataCanvas = n, this.overlayCanvas = s, this.unsubscribeTheme = Ts(() => {
1860
1860
  this.colours = null, this.requestDraw();
1861
1861
  }), this.viewChanged();
1862
1862
  }
@@ -1924,11 +1924,11 @@ class Dn {
1924
1924
  if (t.width <= 0) return [];
1925
1925
  const e = this.colours;
1926
1926
  return t.boxes.flatMap((n) => {
1927
- if (!Et(n, t.width, t.height)) return [];
1928
- const s = Ns(n, t.width);
1927
+ if (!Rt(n, t.width, t.height)) return [];
1928
+ const s = Bs(n, t.width);
1929
1929
  if (s === null) return [];
1930
- const i = e === null ? !0 : Vt(
1931
- kt(n.subtask.appearance),
1930
+ const i = e === null ? !0 : qt(
1931
+ yt(n.subtask.appearance),
1932
1932
  ht(e, { selectedTask: this.selectedTask, selectedSubtask: this.selectedSubtask }, n.subtask.task, n.subtask.id),
1933
1933
  e
1934
1934
  ).onDark;
@@ -1941,7 +1941,7 @@ class Dn {
1941
1941
  const t = this.view, [e, n] = this.visibleDomain();
1942
1942
  return {
1943
1943
  lanes: this.data.lanes.length,
1944
- subtasks: t.boxes.filter((s) => Et(s, t.width, t.height)).length,
1944
+ subtasks: t.boxes.filter((s) => Rt(s, t.width, t.height)).length,
1945
1945
  from: e,
1946
1946
  to: n,
1947
1947
  overlaps: this.data.overlaps.length,
@@ -1959,7 +1959,7 @@ class Dn {
1959
1959
  }
1960
1960
  /** The visible span, as two wall-clock instants. */
1961
1961
  visibleDomain() {
1962
- const t = tt(this.view.options.calendar), e = (n) => t.intervals.length === 0 ? n : j(Math.max(0, Math.min(t.total, n)), t);
1962
+ const t = et(this.view.options.calendar), e = (n) => t.intervals.length === 0 ? n : j(Math.max(0, Math.min(t.total, n)), t);
1963
1963
  return [e(this.view.domain[0]), e(this.view.domain[1])];
1964
1964
  }
1965
1965
  /** Reported once per frame, however many wheel steps a planner turns - and
@@ -1992,7 +1992,7 @@ class Dn {
1992
1992
  const n = (a = this.plot) == null ? void 0 : a.getBoundingClientRect();
1993
1993
  if (n === void 0) return null;
1994
1994
  const s = this.view.viewport(), i = e === void 0 ? null : dt(s, e), r = i === null ? 0 : i.top + i.height / 2;
1995
- return { x: n.left + N(s, t), y: n.top + r };
1995
+ return { x: n.left + B(s, t), y: n.top + r };
1996
1996
  }
1997
1997
  requestDraw() {
1998
1998
  this.frame !== 0 || this.dataCanvas === null || typeof requestAnimationFrame != "function" || (this.frame = requestAnimationFrame(() => {
@@ -2001,7 +2001,7 @@ class Dn {
2001
2001
  }
2002
2002
  draw() {
2003
2003
  if (this.root === null) return;
2004
- this.colours === null && (this.colours = Us(this.root, this.data), this.publish());
2004
+ this.colours === null && (this.colours = Ks(this.root, this.data), this.publish());
2005
2005
  const { width: t, height: e } = this.view, n = Ie(this.dataCanvas, t, e), s = Ie(this.overlayCanvas, t, e);
2006
2006
  if (n === null || s === null || t === 0) return;
2007
2007
  const i = {
@@ -2014,46 +2014,46 @@ class Dn {
2014
2014
  hover: this.gestures.hover,
2015
2015
  ghost: this.gestures.ghostDrawing()
2016
2016
  };
2017
- Ws(n, i), Xs(s, i);
2018
- }
2019
- }
2020
- const _n = "_root_1892z_4 _text_r8i8z_23", Fn = "_corner_1892z_19", On = "_dayBand_1892z_23", En = "_tickBand_1892z_24", Rn = "_day_1892z_23", Pn = "_dayLabel_1892z_50", Bn = "_tick_1892z_24", Nn = "_tickLabel_1892z_71", $n = "_headers_1892z_79", xn = "_header_1892z_79", Gn = "_headerLabel_1892z_97", Hn = "_headerCount_1892z_134", Yn = "_chevron_1892z_143", Kn = "_plot_1892z_201", zn = "_focusRing_1892z_208", Un = "_layer_1892z_226", Wn = "_grip_1892z_235", Xn = "_ghostLabel_1892z_245", Vn = "_finding_1892z_258", jn = "_refusal_1892z_266", qn = "_tooltip_1892z_270", Zn = "_tooltipHead_1892z_289", Jn = "_tooltipTimes_1892z_294", Qn = "_now_1892z_303", to = "_barLabel_1892z_317", eo = "_barLabelText_1892z_330", w = {
2021
- root: _n,
2022
- corner: Fn,
2023
- dayBand: On,
2024
- tickBand: En,
2025
- day: Rn,
2026
- dayLabel: Pn,
2027
- tick: Bn,
2028
- tickLabel: Nn,
2029
- headers: $n,
2017
+ Us(n, i), Ws(s, i);
2018
+ }
2019
+ }
2020
+ const Dn = "_root_1892z_4 _text_r8i8z_23", _n = "_corner_1892z_19", Fn = "_dayBand_1892z_23", On = "_tickBand_1892z_24", En = "_day_1892z_23", Rn = "_dayLabel_1892z_50", Pn = "_tick_1892z_24", Bn = "_tickLabel_1892z_71", Nn = "_headers_1892z_79", xn = "_header_1892z_79", $n = "_headerLabel_1892z_97", Gn = "_headerCount_1892z_134", Hn = "_chevron_1892z_143", Yn = "_plot_1892z_201", zn = "_focusRing_1892z_208", Kn = "_layer_1892z_226", Un = "_grip_1892z_235", Wn = "_ghostLabel_1892z_245", Xn = "_finding_1892z_258", Vn = "_refusal_1892z_266", qn = "_tooltip_1892z_270", jn = "_tooltipHead_1892z_289", Zn = "_tooltipTimes_1892z_294", Jn = "_now_1892z_303", Qn = "_barLabel_1892z_317", to = "_barLabelText_1892z_330", w = {
2021
+ root: Dn,
2022
+ corner: _n,
2023
+ dayBand: Fn,
2024
+ tickBand: On,
2025
+ day: En,
2026
+ dayLabel: Rn,
2027
+ tick: Pn,
2028
+ tickLabel: Bn,
2029
+ headers: Nn,
2030
2030
  header: xn,
2031
- headerLabel: Gn,
2032
- headerCount: Hn,
2033
- chevron: Yn,
2034
- plot: Kn,
2031
+ headerLabel: $n,
2032
+ headerCount: Gn,
2033
+ chevron: Hn,
2034
+ plot: Yn,
2035
2035
  focusRing: zn,
2036
- layer: Un,
2037
- grip: Wn,
2038
- ghostLabel: Xn,
2039
- finding: Vn,
2040
- refusal: jn,
2036
+ layer: Kn,
2037
+ grip: Un,
2038
+ ghostLabel: Wn,
2039
+ finding: Xn,
2040
+ refusal: Vn,
2041
2041
  tooltip: qn,
2042
- tooltipHead: Zn,
2043
- tooltipTimes: Jn,
2044
- now: Qn,
2045
- barLabel: to,
2046
- barLabelText: eo
2042
+ tooltipHead: jn,
2043
+ tooltipTimes: Zn,
2044
+ now: Jn,
2045
+ barLabel: Qn,
2046
+ barLabelText: to
2047
2047
  };
2048
2048
  function ts() {
2049
- const o = gt();
2049
+ const o = kt();
2050
2050
  return (t) => {
2051
- const e = Math.round(t / V), n = Math.floor(e / 60), s = e % 60;
2051
+ const e = Math.round(t / q), n = Math.floor(e / 60), s = e % 60;
2052
2052
  return [n > 0 ? o.hoursShort(n) : "", s > 0 || n === 0 ? o.minutesShort(s) : ""].filter(Boolean).join(" ");
2053
2053
  };
2054
2054
  }
2055
- function so({ target: o, lane: t }) {
2056
- const e = Gt(), n = gt(), s = ts(), i = (u) => e.time(new Date(u), !1);
2055
+ function eo({ target: o, lane: t }) {
2056
+ const e = Ht(), n = kt(), s = ts(), i = (u) => e.time(new Date(u), !1);
2057
2057
  if (o.kind === "subtask") {
2058
2058
  const { subtask: u, task: p } = o, m = [
2059
2059
  (p == null ? void 0 : p.name) ?? u.task,
@@ -2063,7 +2063,7 @@ function so({ target: o, lane: t }) {
2063
2063
  ...o.violatedDependencies.map((y) => n.scheduleViolatedBy(s(y.shortBy))),
2064
2064
  ...o.blocked.map((y) => n.scheduleInBlockedTime(y.label))
2065
2065
  ];
2066
- return /* @__PURE__ */ z(Ot, { children: [
2066
+ return /* @__PURE__ */ U(Et, { children: [
2067
2067
  t,
2068
2068
  `, ${m.join(", ")}`
2069
2069
  ] });
@@ -2076,11 +2076,11 @@ function so({ target: o, lane: t }) {
2076
2076
  ...d === void 0 ? [] : [n.scheduleViolatedBy(s(d.shortBy))]
2077
2077
  ].join(", ");
2078
2078
  }
2079
- function no({ target: o }) {
2080
- const t = Gt(), e = gt(), n = (d) => t.time(new Date(d), !1), s = ts();
2079
+ function so({ target: o }) {
2080
+ const t = Ht(), e = kt(), n = (d) => t.time(new Date(d), !1), s = ts();
2081
2081
  if (o.kind === "subtask") {
2082
2082
  const { subtask: d, task: u } = o;
2083
- return /* @__PURE__ */ z(Ot, { children: [
2083
+ return /* @__PURE__ */ U(Et, { children: [
2084
2084
  /* @__PURE__ */ k("span", { className: w.tooltipHead, children: (u == null ? void 0 : u.name) ?? d.task }),
2085
2085
  /* @__PURE__ */ k("span", { children: d.name ?? d.id }),
2086
2086
  /* @__PURE__ */ k("span", { className: w.tooltipTimes, children: e.scheduleGhostTimes(n(d.from), n(d.to)) }),
@@ -2092,69 +2092,69 @@ function no({ target: o }) {
2092
2092
  ] });
2093
2093
  }
2094
2094
  const { dependency: i, task: r, from: a, to: l, violated: h } = o;
2095
- return /* @__PURE__ */ z(Ot, { children: [
2095
+ return /* @__PURE__ */ U(Et, { children: [
2096
2096
  /* @__PURE__ */ k("span", { className: w.tooltipHead, children: (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.id) ?? i.id }),
2097
2097
  /* @__PURE__ */ k("span", { children: e.scheduleRoute((a == null ? void 0 : a.name) ?? i.from, (l == null ? void 0 : l.name) ?? i.to) }),
2098
2098
  /* @__PURE__ */ k("span", { children: `${e.scheduleDependency} ${s(i.lag)}` }),
2099
2099
  h !== void 0 && /* @__PURE__ */ k("span", { className: w.finding, children: e.scheduleViolatedBy(s(h.shortBy)) })
2100
2100
  ] });
2101
2101
  }
2102
- const oo = [], Re = { min: xt, max: 28 * q }, io = [], Pe = 20, Ft = 44, mo = ms(function(t, e) {
2103
- var fe;
2102
+ const no = [], Re = { min: Gt, max: 28 * Z }, oo = [], Pe = 20, Ot = 44, po = ps(function(t, e) {
2103
+ var pe;
2104
2104
  const {
2105
2105
  ariaLabel: n,
2106
2106
  initialDomain: s,
2107
2107
  height: i = 400,
2108
- laneHeight: r = mt,
2108
+ laneHeight: r = gt,
2109
2109
  headerWidth: a = 160,
2110
- calendar: l = io,
2110
+ calendar: l = oo,
2111
2111
  zoomLimits: h,
2112
2112
  snap: d = "ticks",
2113
- intents: u = oo,
2113
+ intents: u = no,
2114
2114
  onIntent: p,
2115
2115
  canMoveTo: m,
2116
2116
  onInteraction: y,
2117
- selectedTask: C,
2117
+ selectedTask: S,
2118
2118
  onSelectedTaskChange: A,
2119
2119
  collapsedGroups: D,
2120
2120
  defaultCollapsedGroups: g,
2121
2121
  onCollapsedGroupsChange: I,
2122
- onDomainChange: S,
2122
+ onDomainChange: L,
2123
2123
  placing: R,
2124
2124
  route: O = "curve",
2125
2125
  attach: H = "centre",
2126
- ends: nt = "dot",
2126
+ ends: ot = "dot",
2127
2127
  label: ct,
2128
- tooltip: Z,
2129
- now: ot,
2128
+ tooltip: J,
2129
+ now: it,
2130
2130
  className: jt,
2131
2131
  style: es,
2132
2132
  children: ss
2133
- } = t, [v] = ut(() => new Dn()), yt = gs(), qt = `${yt}-summary`, Zt = G(null), Jt = G(null), Qt = G(null), te = G(null), Y = Gt(), x = gt(), [vt, wt] = s, ee = (h == null ? void 0 : h.min) ?? Re.min, se = (h == null ? void 0 : h.max) ?? Re.max, ne = G(null), oe = typeof d == "object" ? d.step : null, ie = typeof d == "object" ? d.offset : null, re = typeof d == "object" ? null : d, [ns, os] = ut(() => Date.now());
2133
+ } = t, [v] = ft(() => new An()), vt = ms(), Zt = `${vt}-summary`, Jt = G(null), Qt = G(null), te = G(null), ee = G(null), Y = Ht(), x = kt(), [wt, bt] = s, se = (h == null ? void 0 : h.min) ?? Re.min, ne = (h == null ? void 0 : h.max) ?? Re.max, oe = G(null), ie = typeof d == "object" ? d.step : null, re = typeof d == "object" ? d.offset : null, ae = typeof d == "object" ? null : d, [ns, os] = ft(() => Date.now());
2134
2134
  K(() => {
2135
- if (ot !== !0) return;
2136
- const c = setInterval(() => os(Date.now()), V);
2135
+ if (it !== !0) return;
2136
+ const c = setInterval(() => os(Date.now()), q);
2137
2137
  return () => clearInterval(c);
2138
- }, [ot]);
2139
- const ae = ot === !0 ? ns : typeof ot == "number" ? ot : null;
2140
- ft(() => {
2141
- const c = `${vt}|${wt}`, b = ne.current !== c;
2142
- ne.current = c;
2143
- const L = re ?? { step: oe ?? 0, offset: ie ?? 0 };
2138
+ }, [it]);
2139
+ const le = it === !0 ? ns : typeof it == "number" ? it : null;
2140
+ pt(() => {
2141
+ const c = `${wt}|${bt}`, b = oe.current !== c;
2142
+ oe.current = c;
2143
+ const C = ae ?? { step: ie ?? 0, offset: re ?? 0 };
2144
2144
  v.setOptions(
2145
- { laneHeight: r, calendar: l, zoomLimits: { min: ee, max: se }, snap: L, intents: u, now: ae, route: O, attach: H, ends: nt },
2146
- b ? [vt, wt] : null
2145
+ { laneHeight: r, calendar: l, zoomLimits: { min: se, max: ne }, snap: C, intents: u, now: le, route: O, attach: H, ends: ot },
2146
+ b ? [wt, bt] : null
2147
2147
  );
2148
- }, [v, vt, wt, r, l, ee, se, re, oe, ie, u, ae, O, H, nt]), K(() => {
2149
- v.setHandlers({ onIntent: p, canMoveTo: m, onInteraction: y, onSelectedTaskChange: A, onCollapsedGroupsChange: I, onDomainChange: S });
2150
- }, [v, p, m, y, A, I, S]);
2148
+ }, [v, wt, bt, r, l, se, ne, ae, ie, re, u, le, O, H, ot]), K(() => {
2149
+ v.setHandlers({ onIntent: p, canMoveTo: m, onInteraction: y, onSelectedTaskChange: A, onCollapsedGroupsChange: I, onDomainChange: L });
2150
+ }, [v, p, m, y, A, I, L]);
2151
2151
  const is = G(g);
2152
2152
  K(() => {
2153
2153
  const c = is.current;
2154
2154
  c !== void 0 && v.setDefaultCollapsedGroups(c);
2155
2155
  }, [v]), K(() => {
2156
2156
  v.setCollapsedGroups(D);
2157
- }, [v, D]), ks(
2157
+ }, [v, D]), gs(
2158
2158
  e,
2159
2159
  () => ({
2160
2160
  positionAt: (c, b) => v.positionAt(c, b),
@@ -2163,89 +2163,94 @@ const oo = [], Re = { min: xt, max: 28 * q }, io = [], Pe = 20, Ft = 44, mo = ms
2163
2163
  }),
2164
2164
  [v]
2165
2165
  ), K(() => {
2166
- v.setControlledTask(C);
2167
- }, [v, C]), K(() => {
2166
+ v.setControlledTask(S);
2167
+ }, [v, S]), K(() => {
2168
2168
  v.setPlacing(R ?? null);
2169
2169
  }, [v, R]), K(() => {
2170
- const c = Zt.current, b = Jt.current, L = Qt.current, E = te.current;
2171
- if (!c || !b || !L || !E) return;
2172
- v.bind(c, b, L, E);
2170
+ const c = Jt.current, b = Qt.current, C = te.current, P = ee.current;
2171
+ if (!c || !b || !C || !P) return;
2172
+ v.bind(c, b, C, P);
2173
2173
  const _ = b.getBoundingClientRect();
2174
2174
  v.resize(_.width, _.height);
2175
- const F = new ResizeObserver(($) => {
2176
- var pe;
2177
- const it = (pe = $[$.length - 1]) == null ? void 0 : pe.contentRect;
2178
- it !== void 0 && v.resize(it.width, it.height);
2175
+ const F = new ResizeObserver((E) => {
2176
+ var ut;
2177
+ const $ = (ut = E[E.length - 1]) == null ? void 0 : ut.contentRect;
2178
+ $ !== void 0 && v.resize($.width, $.height);
2179
2179
  });
2180
2180
  F.observe(b);
2181
- const P = ($) => v.wheel($);
2182
- c.addEventListener("wheel", P, { passive: !1 });
2183
- const B = ($) => {
2184
- $.key === "Escape" && v.cancelEdit() && $.preventDefault();
2181
+ const N = (E) => v.wheel(E);
2182
+ c.addEventListener("wheel", N, { passive: !1 });
2183
+ const z = (E) => {
2184
+ E.key === "Escape" && v.cancelEdit() && E.preventDefault();
2185
2185
  };
2186
- return window.addEventListener("keydown", B), () => {
2187
- window.removeEventListener("keydown", B), c.removeEventListener("wheel", P), F.disconnect(), v.unbind();
2186
+ return window.addEventListener("keydown", z), () => {
2187
+ window.removeEventListener("keydown", z), c.removeEventListener("wheel", N), F.disconnect(), v.unbind();
2188
2188
  };
2189
2189
  }, [v]);
2190
- const M = ys(v.subscribe, v.getSnapshot, v.getServerSnapshot), rs = (c, b) => {
2191
- const L = new Date(c);
2192
- return b >= 200 ? Y.dateLong(L) : b >= 84 ? Y.date(L) : b >= Ft ? Y.dateShort(L) : "";
2193
- }, as = M.days.reduce((c, b) => Math.max(c, b.width), 0), J = Cn(as, Ft), le = M.step >= q ? J : 1, T = M.ghost, Q = M.spoken, bt = M.summary, de = (c) => `${Y.dateShort(new Date(c))} ${Y.time(new Date(c), !1)}`, Mt = (c) => `${yt}-row-${encodeURIComponent(c.key)}`, ls = X(() => {
2190
+ const M = ks(v.subscribe, v.getSnapshot, v.getServerSnapshot), rs = (c, b) => {
2191
+ const C = new Date(c);
2192
+ return b >= 200 ? Y.dateLong(C) : b >= 84 ? Y.date(C) : b >= Ot ? Y.dateShort(C) : "";
2193
+ }, as = M.days.reduce((c, b) => Math.max(c, b.width), 0), Q = In(as, Ot), de = M.step >= Z ? Q : 1, T = M.ghost, tt = M.spoken, Mt = M.summary, he = (c) => `${Y.dateShort(new Date(c))} ${Y.time(new Date(c), !1)}`, Tt = (c) => `${vt}-row-${encodeURIComponent(c.key)}`, ls = V(() => {
2194
2194
  const c = /* @__PURE__ */ new Map();
2195
2195
  for (const b of M.headers)
2196
- for (const L of b.within)
2197
- b.kind === "groupHead" && L === b.group || c.set(L, [...c.get(L) ?? [], Mt(b)]);
2196
+ for (const C of b.within)
2197
+ b.kind === "groupHead" && C === b.group || c.set(C, [...c.get(C) ?? [], Tt(b)]);
2198
2198
  return c;
2199
- }, [M.headers, yt]), he = G(null), ds = `${M.width}|${M.headers.map((c) => `${c.key}:${c.kind}:${typeof c.label == "string" ? c.label : ""}`).join("|")}`;
2200
- ft(() => {
2201
- var L;
2202
- let c = !0;
2203
- const b = () => {
2204
- var F;
2205
- if (!c) return;
2206
- const E = [...((F = he.current) == null ? void 0 : F.querySelectorAll("[data-lane-count]")) ?? []];
2207
- for (const P of E) P.hidden = !1;
2208
- const _ = E.some((P) => {
2209
- const B = P.previousElementSibling;
2210
- if (!(B instanceof HTMLElement)) return !1;
2211
- const $ = parseFloat(getComputedStyle(B).lineHeight);
2212
- return B.scrollWidth > B.clientWidth || B.clientHeight > $ * 1.5;
2199
+ }, [M.headers, vt]), ce = G(null);
2200
+ pt(() => {
2201
+ var F;
2202
+ const c = ce.current;
2203
+ if (c === null) return;
2204
+ let b = !0;
2205
+ const C = () => {
2206
+ if (!b) return;
2207
+ const N = [...c.querySelectorAll("[data-lane-count]")];
2208
+ for (const E of N) E.hidden = !1;
2209
+ const z = N.some((E) => {
2210
+ const $ = E.previousElementSibling;
2211
+ if (!($ instanceof HTMLElement)) return !1;
2212
+ const ut = parseFloat(getComputedStyle($).lineHeight);
2213
+ return $.scrollWidth > $.clientWidth || $.clientHeight > ut * 1.5;
2213
2214
  });
2214
- for (const P of E) P.hidden = _;
2215
+ for (const E of N) E.hidden = z;
2215
2216
  };
2216
- return b(), (L = document.fonts) == null || L.ready.then(b), () => {
2217
- c = !1;
2217
+ C(), (F = document.fonts) == null || F.ready.then(C);
2218
+ const P = new ResizeObserver(C);
2219
+ P.observe(c);
2220
+ const _ = new MutationObserver(C);
2221
+ return _.observe(c, { childList: !0, characterData: !0, subtree: !0 }), () => {
2222
+ b = !1, P.disconnect(), _.disconnect();
2218
2223
  };
2219
- }, [ds]);
2220
- const hs = X(() => new Set((T == null ? void 0 : T.refusedLanes) ?? []), [T == null ? void 0 : T.refusedLanes]), ce = G(null), [Tt, cs] = ut({ x: 0, y: 0, at: "" }), It = T === null ? "" : `${T.x}:${T.y}:${T.from}:${T.to}:${T.overlap}:${T.violated}:${T.refused}:${T.blocked}`;
2221
- ft(() => {
2222
- const c = ce.current;
2224
+ }, []);
2225
+ const ds = V(() => new Set((T == null ? void 0 : T.refusedLanes) ?? []), [T == null ? void 0 : T.refusedLanes]), ue = G(null), [It, hs] = ft({ x: 0, y: 0, at: "" }), Ct = T === null ? "" : `${T.x}:${T.y}:${T.from}:${T.to}:${T.overlap}:${T.violated}:${T.refused}:${T.blocked}`;
2226
+ pt(() => {
2227
+ const c = ue.current;
2223
2228
  if (T === null || c === null) return;
2224
- const b = 4, L = T.y - c.offsetHeight - b, E = T.y + T.height + b, _ = {
2229
+ const b = 4, C = T.y - c.offsetHeight - b, P = T.y + T.height + b, _ = {
2225
2230
  x: Math.max(2, Math.min(T.x, M.width - c.offsetWidth - 2)),
2226
- y: L >= 2 ? L : Math.min(E, M.height - c.offsetHeight - 2),
2227
- at: It
2231
+ y: C >= 2 ? C : Math.min(P, M.height - c.offsetHeight - 2),
2232
+ at: Ct
2228
2233
  };
2229
- cs((F) => F.x === _.x && F.y === _.y && F.at === _.at ? F : _);
2230
- }, [T, It, M.width, M.height]);
2231
- const ue = G(null), [Ct, us] = ut({ x: 0, y: 0, at: "" }), W = M.tooltip, St = W === null ? "" : `${W.x}:${W.y}:${W.target.kind}`;
2232
- return ft(() => {
2233
- const c = ue.current;
2234
- if (W === null || c === null) return;
2235
- const b = 12, L = (_, F, P) => {
2236
- const B = _ + b, $ = _ - b - F, it = B + F <= P - 4 || $ < 4 ? B : $;
2237
- return Math.max(4, Math.min(it, P - F - 4));
2238
- }, E = {
2239
- x: L(W.x, c.offsetWidth, M.width),
2240
- y: L(W.y, c.offsetHeight, M.height),
2241
- at: St
2234
+ hs((F) => F.x === _.x && F.y === _.y && F.at === _.at ? F : _);
2235
+ }, [T, Ct, M.width, M.height]);
2236
+ const fe = G(null), [St, cs] = ft({ x: 0, y: 0, at: "" }), X = M.tooltip, Lt = X === null ? "" : `${X.x}:${X.y}:${X.target.kind}`;
2237
+ return pt(() => {
2238
+ const c = fe.current;
2239
+ if (X === null || c === null) return;
2240
+ const b = 12, C = (_, F, N) => {
2241
+ const z = _ + b, E = _ - b - F, $ = z + F <= N - 4 || E < 4 ? z : E;
2242
+ return Math.max(4, Math.min($, N - F - 4));
2243
+ }, P = {
2244
+ x: C(X.x, c.offsetWidth, M.width),
2245
+ y: C(X.y, c.offsetHeight, M.height),
2246
+ at: Lt
2242
2247
  };
2243
- us((_) => _.x === E.x && _.y === E.y && _.at === E.at ? _ : E);
2244
- }, [W, St, M.width, M.height]), /* @__PURE__ */ z($e.Provider, { value: v, children: [
2245
- /* @__PURE__ */ z(
2248
+ cs((_) => _.x === P.x && _.y === P.y && _.at === P.at ? _ : P);
2249
+ }, [X, Lt, M.width, M.height]), /* @__PURE__ */ U(xe.Provider, { value: v, children: [
2250
+ /* @__PURE__ */ U(
2246
2251
  "div",
2247
2252
  {
2248
- ref: Zt,
2253
+ ref: Jt,
2249
2254
  role: "figure",
2250
2255
  "aria-label": n,
2251
2256
  className: jt ? `${w.root} ${jt}` : w.root,
@@ -2253,21 +2258,21 @@ const oo = [], Re = { min: xt, max: 28 * q }, io = [], Pe = 20, Ft = 44, mo = ms
2253
2258
  children: [
2254
2259
  /* @__PURE__ */ k("div", { className: w.corner }),
2255
2260
  /* @__PURE__ */ k("div", { className: w.dayBand, "aria-hidden": "true", "data-schedule-days": "", "data-schedule-clip": "day band", children: M.days.map((c, b) => {
2256
- var P;
2257
- const L = J === 1 || b === 0 || _t(c.start, J), E = J === 1 ? c.x + c.width : ((P = M.days.slice(b + 1).find((B) => _t(B.start, J))) == null ? void 0 : P.x) ?? M.width, _ = Math.max(0, -c.x), F = Math.min(E, M.width) - Math.max(c.x, 0);
2258
- return /* @__PURE__ */ k("span", { className: w.day, style: { left: `${c.x}px`, width: `${L ? E - c.x : c.width}px` }, children: /* @__PURE__ */ k("span", { className: w.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${_}px` }, children: L ? rs(c.start, J === 1 ? F : Math.min(F, Ft)) : "" }) }, c.start);
2261
+ var N;
2262
+ const C = Q === 1 || b === 0 || Ft(c.start, Q), P = Q === 1 ? c.x + c.width : ((N = M.days.slice(b + 1).find((z) => Ft(z.start, Q))) == null ? void 0 : N.x) ?? M.width, _ = Math.max(0, -c.x), F = Math.min(P, M.width) - Math.max(c.x, 0);
2263
+ return /* @__PURE__ */ k("span", { className: w.day, style: { left: `${c.x}px`, width: `${C ? P - c.x : c.width}px` }, children: /* @__PURE__ */ k("span", { className: w.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${_}px` }, children: C ? rs(c.start, Q === 1 ? F : Math.min(F, Ot)) : "" }) }, c.start);
2259
2264
  }) }),
2260
- /* @__PURE__ */ k("div", { ref: he, className: w.headers, "data-schedule-headers": "", children: /* @__PURE__ */ k("div", { className: w.headerRun, style: { transform: `translateY(${-M.scrollY}px)` }, children: M.headers.map((c) => /* @__PURE__ */ z(
2265
+ /* @__PURE__ */ k("div", { ref: ce, className: w.headers, "data-schedule-headers": "", children: /* @__PURE__ */ k("div", { className: w.headerRun, style: { transform: `translateY(${-M.scrollY}px)` }, children: M.headers.map((c) => /* @__PURE__ */ U(
2261
2266
  "div",
2262
2267
  {
2263
- id: Mt(c),
2268
+ id: Tt(c),
2264
2269
  className: w.header,
2265
2270
  style: { height: `${c.height}px`, paddingLeft: `calc(var(--u-space-3) + ${c.depth} * var(--u-space-3))` },
2266
2271
  "data-lane": c.lane,
2267
2272
  "data-group": c.group,
2268
2273
  "data-row": c.kind,
2269
2274
  "data-schedule-clip": `header ${c.kind}`,
2270
- "data-refused": c.lane !== void 0 && hs.has(c.lane) ? "" : void 0,
2275
+ "data-refused": c.lane !== void 0 && ds.has(c.lane) ? "" : void 0,
2271
2276
  children: [
2272
2277
  c.kind !== "lane" && c.group !== void 0 && /* @__PURE__ */ k(
2273
2278
  "button",
@@ -2276,10 +2281,10 @@ const oo = [], Re = { min: xt, max: 28 * q }, io = [], Pe = 20, Ft = 44, mo = ms
2276
2281
  className: w.chevron,
2277
2282
  "data-schedule-overlay": "fold control",
2278
2283
  "aria-expanded": c.collapsed === !1,
2279
- "aria-controls": (ls.get(c.group) ?? [Mt(c)]).join(" "),
2284
+ "aria-controls": (ls.get(c.group) ?? [Tt(c)]).join(" "),
2280
2285
  "aria-label": `${c.collapsed === !0 ? x.scheduleUnfoldGroup : x.scheduleFoldGroup}: ${typeof c.label == "string" ? c.label : c.group}`,
2281
2286
  onClick: () => v.toggleGroup(c.group),
2282
- children: /* @__PURE__ */ k(Cs, { size: 9, "data-open": c.collapsed === !1 ? "" : void 0 })
2287
+ children: /* @__PURE__ */ k(Is, { size: 9, "data-open": c.collapsed === !1 ? "" : void 0 })
2283
2288
  }
2284
2289
  ),
2285
2290
  /* @__PURE__ */ k("span", { className: w.headerLabel, "data-schedule-overlay": "header label", children: c.label }),
@@ -2288,10 +2293,10 @@ const oo = [], Re = { min: xt, max: 28 * q }, io = [], Pe = 20, Ft = 44, mo = ms
2288
2293
  },
2289
2294
  c.key
2290
2295
  )) }) }),
2291
- /* @__PURE__ */ z(
2296
+ /* @__PURE__ */ U(
2292
2297
  "div",
2293
2298
  {
2294
- ref: Jt,
2299
+ ref: Qt,
2295
2300
  className: w.plot,
2296
2301
  "data-schedule-plot": "",
2297
2302
  "data-schedule-clip": "plot",
@@ -2300,11 +2305,11 @@ const oo = [], Re = { min: xt, max: 28 * q }, io = [], Pe = 20, Ft = 44, mo = ms
2300
2305
  role: "application",
2301
2306
  "aria-roledescription": x.scheduleRoleDescription,
2302
2307
  "aria-label": n,
2303
- "aria-describedby": qt,
2308
+ "aria-describedby": Zt,
2304
2309
  onKeyDown: (c) => {
2305
2310
  v.key(c.nativeEvent) && c.preventDefault();
2306
2311
  },
2307
- onFocus: (c) => v.focus(ro(c.currentTarget)),
2312
+ onFocus: (c) => v.focus(io(c.currentTarget)),
2308
2313
  onBlur: () => v.blur(),
2309
2314
  onPointerDown: (c) => v.pointerDown(c.nativeEvent),
2310
2315
  onPointerMove: (c) => v.pointerMove(c.nativeEvent),
@@ -2319,8 +2324,8 @@ const oo = [], Re = { min: xt, max: 28 * q }, io = [], Pe = 20, Ft = 44, mo = ms
2319
2324
  (!(b instanceof Node) || !c.currentTarget.contains(b)) && v.dragLeave();
2320
2325
  },
2321
2326
  children: [
2322
- /* @__PURE__ */ k("canvas", { ref: Qt, className: w.layer, "aria-hidden": "true" }),
2323
2327
  /* @__PURE__ */ k("canvas", { ref: te, className: w.layer, "aria-hidden": "true" }),
2328
+ /* @__PURE__ */ k("canvas", { ref: ee, className: w.layer, "aria-hidden": "true" }),
2324
2329
  M.grips.map((c) => /* @__PURE__ */ k(
2325
2330
  "span",
2326
2331
  {
@@ -2345,26 +2350,26 @@ const oo = [], Re = { min: xt, max: 28 * q }, io = [], Pe = 20, Ft = 44, mo = ms
2345
2350
  },
2346
2351
  c.subtask.id
2347
2352
  )),
2348
- Z !== !1 && M.tooltip !== null && /* @__PURE__ */ k(
2353
+ J !== !1 && M.tooltip !== null && /* @__PURE__ */ k(
2349
2354
  "span",
2350
2355
  {
2351
- ref: ue,
2356
+ ref: fe,
2352
2357
  role: "tooltip",
2353
2358
  className: w.tooltip,
2354
2359
  "data-schedule-tooltip": "",
2355
2360
  "data-schedule-overlay": "tooltip",
2356
2361
  style: {
2357
- left: `${Ct.x}px`,
2358
- top: `${Ct.y}px`,
2359
- visibility: Ct.at === St ? void 0 : "hidden"
2362
+ left: `${St.x}px`,
2363
+ top: `${St.y}px`,
2364
+ visibility: St.at === Lt ? void 0 : "hidden"
2360
2365
  },
2361
- children: typeof Z == "function" ? Z(M.tooltip.target) : /* @__PURE__ */ k(no, { target: M.tooltip.target })
2366
+ children: typeof J == "function" ? J(M.tooltip.target) : /* @__PURE__ */ k(so, { target: M.tooltip.target })
2362
2367
  }
2363
2368
  ),
2364
- T !== null && /* @__PURE__ */ z(
2369
+ T !== null && /* @__PURE__ */ U(
2365
2370
  "span",
2366
2371
  {
2367
- ref: ce,
2372
+ ref: ue,
2368
2373
  className: w.ghostLabel,
2369
2374
  "data-ghost": "",
2370
2375
  "data-schedule-overlay": "ghost label",
@@ -2372,9 +2377,9 @@ const oo = [], Re = { min: xt, max: 28 * q }, io = [], Pe = 20, Ft = 44, mo = ms
2372
2377
  "data-refused": T.refused ? "" : void 0,
2373
2378
  "data-blocked": T.blocked ? "" : void 0,
2374
2379
  style: {
2375
- left: `${Tt.x}px`,
2376
- top: `${Tt.y}px`,
2377
- visibility: Tt.at === It ? void 0 : "hidden"
2380
+ left: `${It.x}px`,
2381
+ top: `${It.y}px`,
2382
+ visibility: It.at === Ct ? void 0 : "hidden"
2378
2383
  },
2379
2384
  children: [
2380
2385
  x.scheduleGhostTimes(Y.time(new Date(T.from), !1), Y.time(new Date(T.to), !1)),
@@ -2390,53 +2395,53 @@ const oo = [], Re = { min: xt, max: 28 * q }, io = [], Pe = 20, Ft = 44, mo = ms
2390
2395
  }
2391
2396
  ),
2392
2397
  /* @__PURE__ */ k("div", { className: w.corner }),
2393
- /* @__PURE__ */ z("div", { className: w.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
2398
+ /* @__PURE__ */ U("div", { className: w.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
2394
2399
  M.now !== null && /* @__PURE__ */ k("span", { className: w.now, "data-now": "", "data-schedule-overlay": "now mark", style: { left: `${M.now}px` } }),
2395
- M.ticks.map((c) => /* @__PURE__ */ k("span", { className: w.tick, style: { left: `${c.x}px` }, children: c.x >= Pe && c.x <= M.width - Pe && (le === 1 || _t(c.wallClock, le)) && /* @__PURE__ */ k("span", { className: w.tickLabel, "data-schedule-overlay": "time label", children: M.step >= q ? Y.dateShort(new Date(c.wallClock)) : Y.time(new Date(c.wallClock), !1) }) }, c.wallClock))
2400
+ M.ticks.map((c) => /* @__PURE__ */ k("span", { className: w.tick, style: { left: `${c.x}px` }, children: c.x >= Pe && c.x <= M.width - Pe && (de === 1 || Ft(c.wallClock, de)) && /* @__PURE__ */ k("span", { className: w.tickLabel, "data-schedule-overlay": "time label", children: M.step >= Z ? Y.dateShort(new Date(c.wallClock)) : Y.time(new Date(c.wallClock), !1) }) }, c.wallClock))
2396
2401
  ] }),
2397
- /* @__PURE__ */ k(me, { "aria-live": "polite", children: Q !== null && /* @__PURE__ */ k(
2398
- so,
2402
+ /* @__PURE__ */ k(me, { "aria-live": "polite", children: tt !== null && /* @__PURE__ */ k(
2403
+ eo,
2399
2404
  {
2400
- target: Q.target,
2401
- lane: Q.lane === null ? null : ((fe = v.data.lanes.find((c) => c.id === Q.lane)) == null ? void 0 : fe.label) ?? Q.lane
2405
+ target: tt.target,
2406
+ lane: tt.lane === null ? null : ((pe = v.data.lanes.find((c) => c.id === tt.lane)) == null ? void 0 : pe.label) ?? tt.lane
2402
2407
  },
2403
- Q.count
2408
+ tt.count
2404
2409
  ) }),
2405
- /* @__PURE__ */ k(me, { id: qt, children: `${x.scheduleSummary({ ...bt, from: de(bt.from), to: de(bt.to) })} ${x.scheduleKeyHelp}` })
2410
+ /* @__PURE__ */ k(me, { id: Zt, children: `${x.scheduleSummary({ ...Mt, from: he(Mt.from), to: he(Mt.to) })} ${x.scheduleKeyHelp}` })
2406
2411
  ]
2407
2412
  }
2408
2413
  ),
2409
2414
  ss
2410
2415
  ] });
2411
2416
  });
2412
- function ro(o) {
2417
+ function io(o) {
2413
2418
  try {
2414
2419
  return o.matches(":focus-visible");
2415
2420
  } catch {
2416
2421
  return !0;
2417
2422
  }
2418
2423
  }
2419
- function go({ id: o, label: t }) {
2420
- const e = Ge(), n = X(() => ({ id: o, label: t ?? o, ...e === null ? {} : { parent: e } }), [o, t, e]);
2421
- return Ls(n), null;
2424
+ function mo({ id: o, label: t }) {
2425
+ const e = Ge(), n = V(() => ({ id: o, label: t ?? o, ...e === null ? {} : { parent: e } }), [o, t, e]);
2426
+ return Ss(n), null;
2422
2427
  }
2423
- function ko({ id: o, label: t, children: e }) {
2424
- const n = Ge(), s = X(() => ({ id: o, label: t ?? o, ...n === null ? {} : { parent: n } }), [o, t, n]);
2425
- return As(s), /* @__PURE__ */ k(xe.Provider, { value: o, children: e });
2428
+ function go({ id: o, label: t, children: e }) {
2429
+ const n = Ge(), s = V(() => ({ id: o, label: t ?? o, ...n === null ? {} : { parent: n } }), [o, t, n]);
2430
+ return Ls(s), /* @__PURE__ */ k($e.Provider, { value: o, children: e });
2426
2431
  }
2427
- function yo({ data: o, tasks: t }) {
2428
- const e = X(() => ({ kind: "subtasks", data: o, tasks: t }), [o, t]);
2429
- return Yt("Subtasks", e), null;
2432
+ function ko({ data: o, tasks: t }) {
2433
+ const e = V(() => ({ kind: "subtasks", data: o, tasks: t }), [o, t]);
2434
+ return zt("Subtasks", e), null;
2430
2435
  }
2431
- function vo({ data: o }) {
2432
- const t = X(() => ({ kind: "dependencies", data: o }), [o]);
2433
- return Yt("Dependencies", t), null;
2436
+ function yo({ data: o }) {
2437
+ const t = V(() => ({ kind: "dependencies", data: o }), [o]);
2438
+ return zt("Dependencies", t), null;
2434
2439
  }
2435
- function wo({ data: o }) {
2436
- const t = X(() => ({ kind: "blocked", data: o }), [o]);
2437
- return Yt("BlockedTimes", t), null;
2440
+ function vo({ data: o }) {
2441
+ const t = V(() => ({ kind: "blocked", data: o }), [o]);
2442
+ return zt("BlockedTimes", t), null;
2438
2443
  }
2439
- function bo(o, t, e) {
2444
+ function wo(o, t, e) {
2440
2445
  if (e.kind === "place") return [];
2441
2446
  const n = new Map(o.map((l) => [l.id, ke(l, e)])), s = /* @__PURE__ */ new Map();
2442
2447
  for (const l of t) {
@@ -2452,7 +2457,7 @@ function bo(o, t, e) {
2452
2457
  if (d.to === e.subtask) continue;
2453
2458
  const u = n.get(d.to);
2454
2459
  if (u === void 0) continue;
2455
- const p = zt(d, h) + d.lag - Ut(d, u);
2460
+ const p = Ut(d, h) + d.lag - Wt(d, u);
2456
2461
  if (!(p > 0)) continue;
2457
2462
  const m = { kind: "move", subtask: u.id, from: u.from + p, to: u.to + p };
2458
2463
  n.set(u.id, ke(u, m)), i.set(u.id, m), r.push(u.id);
@@ -2460,27 +2465,27 @@ function bo(o, t, e) {
2460
2465
  }
2461
2466
  return [...i.values()];
2462
2467
  }
2463
- function Mo(o, t, e) {
2468
+ function bo(o, t, e) {
2464
2469
  return e === 0 || !Number.isFinite(e) ? [] : o.filter((n) => n.task === t).map((n) => ({ kind: "move", subtask: n.id, from: n.from + e, to: n.to + e }));
2465
2470
  }
2466
2471
  export {
2467
- wo as BlockedTimes,
2468
- vo as Dependencies,
2469
- go as Lane,
2470
- ko as LaneGroup,
2471
- mo as Schedule,
2472
- yo as Subtasks,
2472
+ vo as BlockedTimes,
2473
+ yo as Dependencies,
2474
+ mo as Lane,
2475
+ go as LaneGroup,
2476
+ po as Schedule,
2477
+ ko as Subtasks,
2473
2478
  ke as applyIntent,
2474
- Ut as arrival,
2475
- zt as departure,
2476
- po as findings,
2477
- ze as inBlockedTime,
2478
- st as occupied,
2479
- Wt as overlaps,
2480
- kt as resolveAppearance,
2481
- bo as ripple,
2482
- Mo as shiftTask,
2483
- cn as snapTime,
2484
- fo as subtaskFromPlace,
2485
- Xt as violatedDependencies
2479
+ Wt as arrival,
2480
+ Ut as departure,
2481
+ fo as findings,
2482
+ Ke as inBlockedTime,
2483
+ nt as occupied,
2484
+ Xt as overlaps,
2485
+ yt as resolveAppearance,
2486
+ wo as ripple,
2487
+ bo as shiftTask,
2488
+ hn as snapTime,
2489
+ uo as subtaskFromPlace,
2490
+ Vt as violatedDependencies
2486
2491
  };