@taskctrl/canvas-timeline 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import { jsx as le, jsxs as Ve, Fragment as ti } from "react/jsx-runtime";
2
- import me, { useRef as U, useMemo as ee, useCallback as oe, useEffect as ce, forwardRef as Hi, useState as Ze, useImperativeHandle as Di } from "react";
3
- import { flushSync as Ii } from "react-dom";
4
- import We from "dayjs";
5
- const He = {
1
+ import { jsx as re, jsxs as Ve, Fragment as li } from "react/jsx-runtime";
2
+ import ce, { useRef as A, useMemo as J, useCallback as te, useEffect as ae, forwardRef as Fi, useState as Ue, useImperativeHandle as _i } from "react";
3
+ import { flushSync as Wi } from "react-dom";
4
+ import Me from "dayjs";
5
+ const Ee = {
6
6
  primary: "#269bf7",
7
7
  trainColors: {},
8
8
  status: { red: "#EF5350", yellow: "#FBBF24", green: "#31c48d" },
@@ -12,7 +12,7 @@ const He = {
12
12
  sidebar: { bg: "#F9FAFB", border: "#E5E7EB", text: "#6c737f" },
13
13
  header: { bg: "#F9FAFB", border: "#E5E7EB", text: "#6c737f" }
14
14
  };
15
- class yt {
15
+ class wt {
16
16
  constructor(e) {
17
17
  Object.defineProperty(this, "visibleTimeStart", {
18
18
  enumerable: !0,
@@ -85,12 +85,12 @@ class yt {
85
85
  e.visibleTimeStart !== void 0 && (this.visibleTimeStart = e.visibleTimeStart), e.visibleTimeEnd !== void 0 && (this.visibleTimeEnd = e.visibleTimeEnd), e.canvasWidth !== void 0 && (this.canvasWidth = e.canvasWidth), e.canvasHeight !== void 0 && (this.canvasHeight = e.canvasHeight), e.sidebarWidth !== void 0 && (this.sidebarWidth = e.sidebarWidth), e.lineHeight !== void 0 && (this.lineHeight = e.lineHeight), e.groupCount !== void 0 && (this.groupCount = e.groupCount), e.buffer !== void 0 && (this.buffer = e.buffer), e.scrollTop !== void 0 && (this.scrollTop = e.scrollTop), e.groupHeights !== void 0 && (this.groupHeights = e.groupHeights ?? null), this.visibleDuration = this.visibleTimeEnd - this.visibleTimeStart, this.pixelsPerMs = this.canvasWidth / this.visibleDuration, this.recomputeGroupYOffsets();
86
86
  }
87
87
  recomputeGroupYOffsets() {
88
- var t;
88
+ var i;
89
89
  const e = new Array(this.groupCount + 1);
90
90
  e[0] = 0;
91
91
  for (let n = 0; n < this.groupCount; n++) {
92
- const o = ((t = this.groupHeights) == null ? void 0 : t[n]) ?? this.lineHeight;
93
- e[n + 1] = e[n] + o;
92
+ const r = ((i = this.groupHeights) == null ? void 0 : i[n]) ?? this.lineHeight;
93
+ e[n + 1] = e[n] + r;
94
94
  }
95
95
  this.groupYOffsets = e;
96
96
  }
@@ -103,15 +103,15 @@ class yt {
103
103
  yToGroupIndex(e) {
104
104
  if (this.groupCount === 0)
105
105
  return 0;
106
- const t = e + this.scrollTop;
107
- if (t <= 0)
106
+ const i = e + this.scrollTop;
107
+ if (i <= 0)
108
108
  return 0;
109
- if (t >= this.groupYOffsets[this.groupCount])
109
+ if (i >= this.groupYOffsets[this.groupCount])
110
110
  return this.groupCount - 1;
111
- let n = 0, o = this.groupCount - 1;
112
- for (; n < o; ) {
113
- const d = n + o >>> 1;
114
- this.groupYOffsets[d + 1] > t ? o = d : n = d + 1;
111
+ let n = 0, r = this.groupCount - 1;
112
+ for (; n < r; ) {
113
+ const u = n + r >>> 1;
114
+ this.groupYOffsets[u + 1] > i ? r = u : n = u + 1;
115
115
  }
116
116
  return n;
117
117
  }
@@ -119,8 +119,8 @@ class yt {
119
119
  return e < 0 ? -this.scrollTop : e >= this.groupCount ? (this.groupYOffsets[this.groupCount] ?? 0) - this.scrollTop : this.groupYOffsets[e] - this.scrollTop;
120
120
  }
121
121
  groupIndexToHeight(e) {
122
- var t;
123
- return e < 0 || e >= this.groupCount ? this.lineHeight : ((t = this.groupHeights) == null ? void 0 : t[e]) ?? this.lineHeight;
122
+ var i;
123
+ return e < 0 || e >= this.groupCount ? this.lineHeight : ((i = this.groupHeights) == null ? void 0 : i[e]) ?? this.lineHeight;
124
124
  }
125
125
  getBufferBounds() {
126
126
  const e = this.visibleDuration * 1.5;
@@ -132,18 +132,18 @@ class yt {
132
132
  getVisibleGroupRange() {
133
133
  if (this.groupCount === 0)
134
134
  return { firstVisible: 0, lastVisible: -1 };
135
- const e = this.yToGroupIndex(0), t = this.yToGroupIndex(this.canvasHeight);
136
- return { firstVisible: e, lastVisible: t };
135
+ const e = this.yToGroupIndex(0), i = this.yToGroupIndex(this.canvasHeight);
136
+ return { firstVisible: e, lastVisible: i };
137
137
  }
138
138
  isScrollInBuffer(e) {
139
- const t = this.visibleDuration * 1.5 * this.pixelsPerMs;
140
- return Math.abs(e) < t;
139
+ const i = this.visibleDuration * 1.5 * this.pixelsPerMs;
140
+ return Math.abs(e) < i;
141
141
  }
142
142
  getTotalHeight() {
143
143
  return this.groupYOffsets[this.groupCount] ?? 0;
144
144
  }
145
145
  }
146
- class Ri {
146
+ class Bi {
147
147
  constructor() {
148
148
  Object.defineProperty(this, "root", {
149
149
  enumerable: !0,
@@ -152,44 +152,44 @@ class Ri {
152
152
  value: null
153
153
  });
154
154
  }
155
- buildFromItems(e, t, n) {
156
- const o = e.map((d) => ({
157
- item: d,
158
- start: t(d),
159
- end: n(d)
155
+ buildFromItems(e, i, n) {
156
+ const r = e.map((u) => ({
157
+ item: u,
158
+ start: i(u),
159
+ end: n(u)
160
160
  }));
161
- this.root = this.buildNode(o);
161
+ this.root = this.buildNode(r);
162
162
  }
163
163
  buildNode(e) {
164
164
  if (e.length === 0)
165
165
  return null;
166
- let t = 1 / 0, n = -1 / 0;
167
- for (const a of e)
168
- a.start < t && (t = a.start), a.end > n && (n = a.end);
169
- const o = (t + n) / 2, d = [], s = [], c = [];
170
- for (const a of e)
171
- a.end < o ? d.push(a) : a.start > o ? s.push(a) : c.push(a);
166
+ let i = 1 / 0, n = -1 / 0;
167
+ for (const s of e)
168
+ s.start < i && (i = s.start), s.end > n && (n = s.end);
169
+ const r = (i + n) / 2, u = [], o = [], c = [];
170
+ for (const s of e)
171
+ s.end < r ? u.push(s) : s.start > r ? o.push(s) : c.push(s);
172
172
  return {
173
- center: o,
174
- left: this.buildNode(d),
175
- right: this.buildNode(s),
173
+ center: r,
174
+ left: this.buildNode(u),
175
+ right: this.buildNode(o),
176
176
  overlapping: c
177
177
  };
178
178
  }
179
- query(e, t) {
179
+ query(e, i) {
180
180
  const n = [];
181
- return this.queryNode(this.root, e, t, n), n;
181
+ return this.queryNode(this.root, e, i, n), n;
182
182
  }
183
- queryNode(e, t, n, o) {
183
+ queryNode(e, i, n, r) {
184
184
  if (e !== null) {
185
- for (const d of e.overlapping)
186
- d.start <= n && d.end >= t && o.push(d.item);
187
- t <= e.center && e.left !== null && this.queryNode(e.left, t, n, o), n >= e.center && e.right !== null && this.queryNode(e.right, t, n, o);
185
+ for (const u of e.overlapping)
186
+ u.start <= n && u.end >= i && r.push(u.item);
187
+ i <= e.center && e.left !== null && this.queryNode(e.left, i, n, r), n >= e.center && e.right !== null && this.queryNode(e.right, i, n, r);
188
188
  }
189
189
  }
190
190
  }
191
- class Oi {
192
- constructor(e, t) {
191
+ class zi {
192
+ constructor(e, i) {
193
193
  Object.defineProperty(this, "lineHeight", {
194
194
  enumerable: !0,
195
195
  configurable: !0,
@@ -210,69 +210,69 @@ class Oi {
210
210
  configurable: !0,
211
211
  writable: !0,
212
212
  value: /* @__PURE__ */ new Map()
213
- }), this.lineHeight = e, this.itemHeightRatio = t;
213
+ }), this.lineHeight = e, this.itemHeightRatio = i;
214
214
  }
215
- computeLayout(e, t, n) {
215
+ computeLayout(e, i, n) {
216
216
  this.layoutCache = /* @__PURE__ */ new Map(), this.groupMaxStack = /* @__PURE__ */ new Map();
217
- const o = this.lineHeight * this.itemHeightRatio, d = o * 0.6;
218
- if (!t) {
217
+ const r = this.lineHeight * this.itemHeightRatio, u = r * 0.6;
218
+ if (!i) {
219
219
  for (const c of e) {
220
- const a = (n == null ? void 0 : n.isParent(c.id)) ?? !1;
221
- this.layoutCache.set(c.id, { stackLevel: 0, itemHeight: a ? d : o }), this.groupMaxStack.set(c.group, 0);
220
+ const s = (n == null ? void 0 : n.isParent(c.id)) ?? !1;
221
+ this.layoutCache.set(c.id, { stackLevel: 0, itemHeight: s ? u : r }), this.groupMaxStack.set(c.group, 0);
222
222
  }
223
223
  return this.layoutCache;
224
224
  }
225
- const s = /* @__PURE__ */ new Map();
225
+ const o = /* @__PURE__ */ new Map();
226
226
  for (const c of e) {
227
- let a = s.get(c.group);
228
- a || (a = [], s.set(c.group, a)), a.push(c);
227
+ let s = o.get(c.group);
228
+ s || (s = [], o.set(c.group, s)), s.push(c);
229
229
  }
230
- for (const [c, a] of s)
231
- n ? this.computeHierarchyLayout(a, n, o, d, c) : this.computeFlatLayout(a, o, c);
230
+ for (const [c, s] of o)
231
+ n ? this.computeHierarchyLayout(s, n, r, u, c) : this.computeFlatLayout(s, r, c);
232
232
  return this.layoutCache;
233
233
  }
234
- computeFlatLayout(e, t, n) {
235
- e.sort((s, c) => {
236
- const a = s.start_time - c.start_time;
237
- return a !== 0 ? a : c.end_time - c.start_time - (s.end_time - s.start_time);
234
+ computeFlatLayout(e, i, n) {
235
+ e.sort((o, c) => {
236
+ const s = o.start_time - c.start_time;
237
+ return s !== 0 ? s : c.end_time - c.start_time - (o.end_time - o.start_time);
238
238
  });
239
- const o = [];
240
- let d = 0;
241
- for (const s of e) {
239
+ const r = [];
240
+ let u = 0;
241
+ for (const o of e) {
242
242
  let c = -1;
243
- for (let a = 0; a < o.length; a++)
244
- if (o[a] <= s.start_time) {
245
- c = a;
243
+ for (let s = 0; s < r.length; s++)
244
+ if (r[s] <= o.start_time) {
245
+ c = s;
246
246
  break;
247
247
  }
248
- c === -1 ? (c = o.length, o.push(s.end_time)) : o[c] = s.end_time, c > d && (d = c), this.layoutCache.set(s.id, { stackLevel: c, itemHeight: t });
248
+ c === -1 ? (c = r.length, r.push(o.end_time)) : r[c] = o.end_time, c > u && (u = c), this.layoutCache.set(o.id, { stackLevel: c, itemHeight: i });
249
249
  }
250
- this.groupMaxStack.set(n, d);
251
- }
252
- computeHierarchyLayout(e, t, n, o, d) {
253
- const s = [], c = [];
254
- for (const p of e)
255
- t.isParent(p.id) ? c.push(p) : s.push(p);
256
- s.sort((p, f) => {
257
- const w = p.start_time - f.start_time;
258
- return w !== 0 ? w : f.end_time - f.start_time - (p.end_time - p.start_time);
250
+ this.groupMaxStack.set(n, u);
251
+ }
252
+ computeHierarchyLayout(e, i, n, r, u) {
253
+ const o = [], c = [];
254
+ for (const h of e)
255
+ i.isParent(h.id) ? c.push(h) : o.push(h);
256
+ o.sort((h, f) => {
257
+ const S = h.start_time - f.start_time;
258
+ return S !== 0 ? S : f.end_time - f.start_time - (h.end_time - h.start_time);
259
259
  });
260
- const a = [];
261
- let b = 0;
262
- for (const p of s) {
260
+ const s = [];
261
+ let p = 0;
262
+ for (const h of o) {
263
263
  let f = -1;
264
- for (let w = 0; w < a.length; w++)
265
- if (a[w] <= p.start_time) {
266
- f = w;
264
+ for (let S = 0; S < s.length; S++)
265
+ if (s[S] <= h.start_time) {
266
+ f = S;
267
267
  break;
268
268
  }
269
- f === -1 ? (f = a.length, a.push(p.end_time)) : a[f] = p.end_time, f > b && (b = f), this.layoutCache.set(p.id, { stackLevel: f, itemHeight: n });
269
+ f === -1 ? (f = s.length, s.push(h.end_time)) : s[f] = h.end_time, f > p && (p = f), this.layoutCache.set(h.id, { stackLevel: f, itemHeight: n });
270
270
  }
271
- c.sort((p, f) => t.getNestingDepth(f.id) - t.getNestingDepth(p.id));
272
- let H = s.length > 0 ? b + 1 : 0;
273
- for (const p of c)
274
- this.layoutCache.set(p.id, { stackLevel: H, itemHeight: o }), H > b && (b = H), H++;
275
- this.groupMaxStack.set(d, b);
271
+ c.sort((h, f) => i.getNestingDepth(f.id) - i.getNestingDepth(h.id));
272
+ let k = o.length > 0 ? p + 1 : 0;
273
+ for (const h of c)
274
+ this.layoutCache.set(h.id, { stackLevel: k, itemHeight: r }), k > p && (p = k), k++;
275
+ this.groupMaxStack.set(u, p);
276
276
  }
277
277
  getLayout(e) {
278
278
  return this.layoutCache.get(e);
@@ -281,7 +281,7 @@ class Oi {
281
281
  return ((this.groupMaxStack.get(e) ?? 0) + 1) * this.lineHeight;
282
282
  }
283
283
  }
284
- class Pi {
284
+ class Li {
285
285
  constructor() {
286
286
  Object.defineProperty(this, "parentToChildren", {
287
287
  enumerable: !0,
@@ -307,35 +307,35 @@ class Pi {
307
307
  }
308
308
  rebuild(e) {
309
309
  this.parentToChildren = /* @__PURE__ */ new Map(), this.childToParent = /* @__PURE__ */ new Map(), this.itemMap = /* @__PURE__ */ new Map(), this.depthCache = /* @__PURE__ */ new Map();
310
- for (const t of e)
311
- this.itemMap.set(t.id, t);
312
- for (const t of e)
313
- if (t.parentId !== void 0 && this.itemMap.has(t.parentId)) {
314
- this.childToParent.set(t.id, t.parentId);
315
- let n = this.parentToChildren.get(t.parentId);
316
- n || (n = [], this.parentToChildren.set(t.parentId, n)), n.push(t.id);
310
+ for (const i of e)
311
+ this.itemMap.set(i.id, i);
312
+ for (const i of e)
313
+ if (i.parentId !== void 0 && this.itemMap.has(i.parentId)) {
314
+ this.childToParent.set(i.id, i.parentId);
315
+ let n = this.parentToChildren.get(i.parentId);
316
+ n || (n = [], this.parentToChildren.set(i.parentId, n)), n.push(i.id);
317
317
  }
318
- for (const t of this.childToParent.keys()) {
318
+ for (const i of this.childToParent.keys()) {
319
319
  const n = /* @__PURE__ */ new Set();
320
- let o = t;
321
- for (; o !== void 0; ) {
322
- if (n.has(o)) {
323
- const d = this.childToParent.get(t);
324
- this.childToParent.delete(t);
325
- const s = this.parentToChildren.get(d);
326
- if (s) {
327
- const c = s.indexOf(t);
328
- c !== -1 && s.splice(c, 1), s.length === 0 && this.parentToChildren.delete(d);
320
+ let r = i;
321
+ for (; r !== void 0; ) {
322
+ if (n.has(r)) {
323
+ const u = this.childToParent.get(i);
324
+ this.childToParent.delete(i);
325
+ const o = this.parentToChildren.get(u);
326
+ if (o) {
327
+ const c = o.indexOf(i);
328
+ c !== -1 && o.splice(c, 1), o.length === 0 && this.parentToChildren.delete(u);
329
329
  }
330
330
  break;
331
331
  }
332
- n.add(o), o = this.childToParent.get(o);
332
+ n.add(r), r = this.childToParent.get(r);
333
333
  }
334
334
  }
335
335
  }
336
336
  isParent(e) {
337
- const t = this.parentToChildren.get(e);
338
- return t !== void 0 && t.length > 0;
337
+ const i = this.parentToChildren.get(e);
338
+ return i !== void 0 && i.length > 0;
339
339
  }
340
340
  getParent(e) {
341
341
  return this.childToParent.get(e);
@@ -344,129 +344,133 @@ class Pi {
344
344
  return this.parentToChildren.get(e) ?? [];
345
345
  }
346
346
  getDescendants(e) {
347
- const t = [], n = [...this.getChildren(e)];
347
+ const i = [], n = [...this.getChildren(e)];
348
348
  for (; n.length > 0; ) {
349
- const o = n.pop();
350
- t.push(o);
351
- const d = this.parentToChildren.get(o);
352
- d && n.push(...d);
349
+ const r = n.pop();
350
+ i.push(r);
351
+ const u = this.parentToChildren.get(r);
352
+ u && n.push(...u);
353
353
  }
354
- return t;
354
+ return i;
355
355
  }
356
356
  getEffectiveSpan(e) {
357
- const t = this.itemMap.get(e);
358
- if (!t)
357
+ const i = this.itemMap.get(e);
358
+ if (!i)
359
359
  return { start: 0, end: 0 };
360
- let n = t.start_time, o = t.end_time;
361
- const d = this.getDescendants(e);
362
- for (const s of d) {
363
- const c = this.itemMap.get(s);
364
- c && (c.start_time < n && (n = c.start_time), c.end_time > o && (o = c.end_time));
360
+ let n = i.start_time, r = i.end_time;
361
+ const u = this.getDescendants(e);
362
+ for (const o of u) {
363
+ const c = this.itemMap.get(o);
364
+ c && (c.start_time < n && (n = c.start_time), c.end_time > r && (r = c.end_time));
365
365
  }
366
- return { start: n, end: o };
366
+ return { start: n, end: r };
367
367
  }
368
368
  getNestingDepth(e) {
369
- const t = this.depthCache.get(e);
370
- if (t !== void 0)
371
- return t;
372
- let n = 0, o = this.childToParent.get(e);
373
- for (; o !== void 0; )
374
- n++, o = this.childToParent.get(o);
369
+ const i = this.depthCache.get(e);
370
+ if (i !== void 0)
371
+ return i;
372
+ let n = 0, r = this.childToParent.get(e);
373
+ for (; r !== void 0; )
374
+ n++, r = this.childToParent.get(r);
375
375
  return this.depthCache.set(e, n), n;
376
376
  }
377
- getMoveDelta(e, t) {
377
+ getMoveDelta(e, i) {
378
378
  const n = this.itemMap.get(e);
379
379
  if (!n)
380
380
  return [];
381
- const o = t - n.start_time;
382
- return this.getDescendants(e).map((s) => {
383
- const c = this.itemMap.get(s);
384
- return { itemId: s, newStart: c.start_time + o };
381
+ const r = i - n.start_time;
382
+ return this.getDescendants(e).map((o) => {
383
+ const c = this.itemMap.get(o);
384
+ return { itemId: o, newStart: c.start_time + r };
385
385
  });
386
386
  }
387
- getResizeConstraint(e, t) {
387
+ getResizeConstraint(e, i) {
388
388
  const n = this.getDescendants(e);
389
389
  if (n.length === 0)
390
- return t === "left" ? { min: -1 / 0, max: 1 / 0 } : { min: -1 / 0, max: 1 / 0 };
391
- if (t === "left") {
392
- let o = 1 / 0;
393
- for (const d of n) {
394
- const s = this.itemMap.get(d);
395
- s && s.start_time < o && (o = s.start_time);
390
+ return i === "left" ? { min: -1 / 0, max: 1 / 0 } : { min: -1 / 0, max: 1 / 0 };
391
+ if (i === "left") {
392
+ let r = 1 / 0;
393
+ for (const u of n) {
394
+ const o = this.itemMap.get(u);
395
+ o && o.start_time < r && (r = o.start_time);
396
396
  }
397
- return { min: -1 / 0, max: o };
397
+ return { min: -1 / 0, max: r };
398
398
  } else {
399
- let o = -1 / 0;
400
- for (const d of n) {
401
- const s = this.itemMap.get(d);
402
- s && s.end_time > o && (o = s.end_time);
399
+ let r = -1 / 0;
400
+ for (const u of n) {
401
+ const o = this.itemMap.get(u);
402
+ o && o.end_time > r && (r = o.end_time);
403
403
  }
404
- return { min: o, max: 1 / 0 };
404
+ return { min: r, max: 1 / 0 };
405
405
  }
406
406
  }
407
407
  }
408
- function Xi(i, e, t, n, o, d) {
409
- const { x: s, y: c, width: a, height: b } = t, H = d.primary;
410
- i.globalAlpha = 0.15, i.fillStyle = H, i.fillRect(s, c, a, b), i.globalAlpha = 1, i.strokeStyle = H, i.lineWidth = 1.5, i.strokeRect(s, c, a, b);
411
- const p = Math.min(b * 0.5, 6), f = c + b / 2;
412
- i.fillStyle = H, i.beginPath(), i.moveTo(s, f), i.lineTo(s + p, f - p), i.lineTo(s + p * 2, f), i.lineTo(s + p, f + p), i.closePath(), i.fill(), i.beginPath(), i.moveTo(s + a, f), i.lineTo(s + a - p, f - p), i.lineTo(s + a - p * 2, f), i.lineTo(s + a - p, f + p), i.closePath(), i.fill();
413
- const w = e.title;
414
- if (w && a > 30) {
415
- i.fillStyle = d.item.text, i.font = '500 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', i.textBaseline = "middle";
416
- const T = i.measureText(w).width, h = a - p * 4 - 4;
417
- if (h > 20) {
418
- const E = T > h ? w.slice(0, Math.floor(w.length * h / T)) + "..." : w;
419
- i.fillText(E, s + a / 2 - Math.min(T, h) / 2, f);
408
+ function xi(t, e, i, n, r, u) {
409
+ const { x: o, y: c, width: s, height: p } = i, k = u.primary;
410
+ t.globalAlpha = 0.15, t.fillStyle = k, t.fillRect(o, c, s, p), t.globalAlpha = 1, t.strokeStyle = k, t.lineWidth = 1.5, t.strokeRect(o, c, s, p);
411
+ const h = Math.min(p * 0.5, 6), f = c + p / 2;
412
+ t.fillStyle = k, t.beginPath(), t.moveTo(o, f), t.lineTo(o + h, f - h), t.lineTo(o + h * 2, f), t.lineTo(o + h, f + h), t.closePath(), t.fill(), t.beginPath(), t.moveTo(o + s, f), t.lineTo(o + s - h, f - h), t.lineTo(o + s - h * 2, f), t.lineTo(o + s - h, f + h), t.closePath(), t.fill();
413
+ const S = e.title;
414
+ if (S && s > 30) {
415
+ t.fillStyle = u.item.text, t.font = '500 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', t.textBaseline = "middle";
416
+ const y = t.measureText(S).width, m = s - h * 4 - 4;
417
+ if (m > 20) {
418
+ const E = y > m ? S.slice(0, Math.floor(S.length * m / y)) + "..." : S;
419
+ t.fillText(E, o + s / 2 - Math.min(y, m) / 2, f);
420
420
  }
421
421
  }
422
- n.selected && (i.strokeStyle = d.item.selectedRing, i.lineWidth = 2, i.strokeRect(s - 1, c - 1, a + 2, b + 2));
422
+ n.selected && (t.strokeStyle = u.item.selectedRing, t.lineWidth = 2, t.strokeRect(o - 1, c - 1, s + 2, p + 2));
423
423
  }
424
- function Ue(i, e, t, n, o, d) {
425
- const s = t.xToTime(i), c = /* @__PURE__ */ new Map();
426
- for (let p = 0; p < d.length; p++)
427
- c.set(d[p].id, p);
428
- const a = n.query(s, s);
429
- let b = null, H = -1 / 0;
430
- for (const p of a) {
431
- const f = c.get(p.group);
424
+ function Ze(t, e, i, n, r, u) {
425
+ const o = i.xToTime(t), c = /* @__PURE__ */ new Map();
426
+ for (let h = 0; h < u.length; h++)
427
+ c.set(u[h].id, h);
428
+ const s = n.query(o, o);
429
+ let p = null, k = -1 / 0;
430
+ for (const h of s) {
431
+ const f = c.get(h.group);
432
432
  if (f === void 0)
433
433
  continue;
434
- const w = o.getLayout(p.id);
435
- if (!w)
434
+ const S = r.getLayout(h.id);
435
+ if (!S)
436
436
  continue;
437
- const T = t.timeToX(p.start_time), h = t.timeToX(p.end_time) - T;
438
- if (i < T || i > T + h)
437
+ const y = i.timeToX(h.start_time), m = i.timeToX(h.end_time) - y;
438
+ if (t < y || t > y + m)
439
439
  continue;
440
- const P = t.groupIndexToY(f) + w.stackLevel * t.lineHeight + (t.lineHeight - w.itemHeight) / 2, W = w.itemHeight;
441
- e < P || e > P + W || P > H && (H = P, b = p);
440
+ const P = i.groupIndexToY(f) + S.stackLevel * i.lineHeight + (i.lineHeight - S.itemHeight) / 2, W = S.itemHeight;
441
+ e < P || e > P + W || P > k && (k = P, p = h);
442
442
  }
443
- return b;
443
+ return p;
444
+ }
445
+ function kt(t, e, i) {
446
+ const n = e.yToGroupIndex(t);
447
+ return i[n] ?? null;
444
448
  }
445
- function Tt(i, e, t) {
446
- const n = e.yToGroupIndex(i);
447
- return t[n] ?? null;
449
+ function Jt(t, e, i, n = 6) {
450
+ const r = i.timeToX(e.start_time), u = i.timeToX(e.end_time);
451
+ return t - r <= n ? "left" : u - t <= n ? "right" : "body";
448
452
  }
449
- function Gt(i, e, t, n = 6) {
450
- const o = t.timeToX(e.start_time), d = t.timeToX(e.end_time);
451
- return i - o <= n ? "left" : d - i <= n ? "right" : "body";
453
+ function Ai(t, e) {
454
+ return t.canResize ?? e;
452
455
  }
453
- function Nt(i, e) {
454
- return i.canResize ?? e;
456
+ function Ni(t, e) {
457
+ return t.canMove ?? e;
455
458
  }
456
- function Zt(i, e) {
457
- return i.canMove ?? e;
459
+ function Qt(t, e, i, n) {
460
+ const r = Ai(t, i);
461
+ return e === "left" && (r === "left" || r === "both") ? "resize-left" : e === "right" && (r === "right" || r === "both") ? "resize-right" : t.canResize === !1 && e !== "body" ? null : Ni(t, n) ? "move" : null;
458
462
  }
459
- function St(i, e, t) {
460
- const n = window.devicePixelRatio || 1, o = Math.round(e * n), d = Math.round(t * n);
461
- (i.width !== o || i.height !== d) && (i.width = o, i.height = d, i.style.width = `${e}px`, i.style.height = `${t}px`);
462
- const s = i.getContext("2d");
463
- return s.setTransform(n, 0, 0, n, 0, 0), s;
463
+ function Ct(t, e, i) {
464
+ const n = window.devicePixelRatio || 1, r = Math.round(e * n), u = Math.round(i * n);
465
+ (t.width !== r || t.height !== u) && (t.width = r, t.height = u, t.style.width = `${e}px`, t.style.height = `${i}px`);
466
+ const o = t.getContext("2d");
467
+ return o.setTransform(n, 0, 0, n, 0, 0), o;
464
468
  }
465
- function Mt(i, e) {
466
- const t = window.devicePixelRatio || 1;
467
- i.clearRect(0, 0, e.width / t, e.height / t);
469
+ function Et(t, e) {
470
+ const i = window.devicePixelRatio || 1;
471
+ t.clearRect(0, 0, e.width / i, e.height / i);
468
472
  }
469
- class $i {
473
+ class ji {
470
474
  constructor(e) {
471
475
  Object.defineProperty(this, "dirty", {
472
476
  enumerable: !0,
@@ -502,379 +506,379 @@ class $i {
502
506
  }));
503
507
  }
504
508
  }
505
- var lt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
506
- function at(i) {
507
- return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
509
+ var ct = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
510
+ function dt(t) {
511
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
508
512
  }
509
- var ii = { exports: {} };
510
- (function(i, e) {
511
- (function(t, n) {
512
- i.exports = n();
513
- })(lt, function() {
514
- var t = "minute", n = /[+-]\d\d(?::?\d\d)?/g, o = /([+-]|\d\d)/g;
515
- return function(d, s, c) {
516
- var a = s.prototype;
517
- c.utc = function(h) {
518
- var E = { date: h, utc: !0, args: arguments };
519
- return new s(E);
520
- }, a.utc = function(h) {
513
+ var ui = { exports: {} };
514
+ (function(t, e) {
515
+ (function(i, n) {
516
+ t.exports = n();
517
+ })(ct, function() {
518
+ var i = "minute", n = /[+-]\d\d(?::?\d\d)?/g, r = /([+-]|\d\d)/g;
519
+ return function(u, o, c) {
520
+ var s = o.prototype;
521
+ c.utc = function(m) {
522
+ var E = { date: m, utc: !0, args: arguments };
523
+ return new o(E);
524
+ }, s.utc = function(m) {
521
525
  var E = c(this.toDate(), { locale: this.$L, utc: !0 });
522
- return h ? E.add(this.utcOffset(), t) : E;
523
- }, a.local = function() {
526
+ return m ? E.add(this.utcOffset(), i) : E;
527
+ }, s.local = function() {
524
528
  return c(this.toDate(), { locale: this.$L, utc: !1 });
525
529
  };
526
- var b = a.parse;
527
- a.parse = function(h) {
528
- h.utc && (this.$u = !0), this.$utils().u(h.$offset) || (this.$offset = h.$offset), b.call(this, h);
530
+ var p = s.parse;
531
+ s.parse = function(m) {
532
+ m.utc && (this.$u = !0), this.$utils().u(m.$offset) || (this.$offset = m.$offset), p.call(this, m);
529
533
  };
530
- var H = a.init;
531
- a.init = function() {
534
+ var k = s.init;
535
+ s.init = function() {
532
536
  if (this.$u) {
533
- var h = this.$d;
534
- this.$y = h.getUTCFullYear(), this.$M = h.getUTCMonth(), this.$D = h.getUTCDate(), this.$W = h.getUTCDay(), this.$H = h.getUTCHours(), this.$m = h.getUTCMinutes(), this.$s = h.getUTCSeconds(), this.$ms = h.getUTCMilliseconds();
535
- } else H.call(this);
537
+ var m = this.$d;
538
+ this.$y = m.getUTCFullYear(), this.$M = m.getUTCMonth(), this.$D = m.getUTCDate(), this.$W = m.getUTCDay(), this.$H = m.getUTCHours(), this.$m = m.getUTCMinutes(), this.$s = m.getUTCSeconds(), this.$ms = m.getUTCMilliseconds();
539
+ } else k.call(this);
536
540
  };
537
- var p = a.utcOffset;
538
- a.utcOffset = function(h, E) {
541
+ var h = s.utcOffset;
542
+ s.utcOffset = function(m, E) {
539
543
  var P = this.$utils().u;
540
- if (P(h)) return this.$u ? 0 : P(this.$offset) ? p.call(this) : this.$offset;
541
- if (typeof h == "string" && (h = function(k) {
542
- k === void 0 && (k = "");
543
- var $ = k.match(n);
544
- if (!$) return null;
545
- var B = ("" + $[0]).match(o) || ["-", 0, 0], I = B[0], A = 60 * +B[1] + +B[2];
546
- return A === 0 ? 0 : I === "+" ? A : -A;
547
- }(h), h === null)) return this;
548
- var W = Math.abs(h) <= 16 ? 60 * h : h;
544
+ if (P(m)) return this.$u ? 0 : P(this.$offset) ? h.call(this) : this.$offset;
545
+ if (typeof m == "string" && (m = function(w) {
546
+ w === void 0 && (w = "");
547
+ var X = w.match(n);
548
+ if (!X) return null;
549
+ var B = ("" + X[0]).match(r) || ["-", 0, 0], I = B[0], x = 60 * +B[1] + +B[2];
550
+ return x === 0 ? 0 : I === "+" ? x : -x;
551
+ }(m), m === null)) return this;
552
+ var W = Math.abs(m) <= 16 ? 60 * m : m;
549
553
  if (W === 0) return this.utc(E);
550
- var y = this.clone();
551
- if (E) return y.$offset = W, y.$u = !1, y;
552
- var D = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
553
- return (y = this.local().add(W + D, t)).$offset = W, y.$x.$localOffset = D, y;
554
+ var T = this.clone();
555
+ if (E) return T.$offset = W, T.$u = !1, T;
556
+ var H = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
557
+ return (T = this.local().add(W + H, i)).$offset = W, T.$x.$localOffset = H, T;
554
558
  };
555
- var f = a.format;
556
- a.format = function(h) {
557
- var E = h || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
559
+ var f = s.format;
560
+ s.format = function(m) {
561
+ var E = m || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
558
562
  return f.call(this, E);
559
- }, a.valueOf = function() {
560
- var h = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
561
- return this.$d.valueOf() - 6e4 * h;
562
- }, a.isUTC = function() {
563
+ }, s.valueOf = function() {
564
+ var m = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
565
+ return this.$d.valueOf() - 6e4 * m;
566
+ }, s.isUTC = function() {
563
567
  return !!this.$u;
564
- }, a.toISOString = function() {
568
+ }, s.toISOString = function() {
565
569
  return this.toDate().toISOString();
566
- }, a.toString = function() {
570
+ }, s.toString = function() {
567
571
  return this.toDate().toUTCString();
568
572
  };
569
- var w = a.toDate;
570
- a.toDate = function(h) {
571
- return h === "s" && this.$offset ? c(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : w.call(this);
573
+ var S = s.toDate;
574
+ s.toDate = function(m) {
575
+ return m === "s" && this.$offset ? c(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : S.call(this);
572
576
  };
573
- var T = a.diff;
574
- a.diff = function(h, E, P) {
575
- if (h && this.$u === h.$u) return T.call(this, h, E, P);
576
- var W = this.local(), y = c(h).local();
577
- return T.call(W, y, E, P);
577
+ var y = s.diff;
578
+ s.diff = function(m, E, P) {
579
+ if (m && this.$u === m.$u) return y.call(this, m, E, P);
580
+ var W = this.local(), T = c(m).local();
581
+ return y.call(W, T, E, P);
578
582
  };
579
583
  };
580
584
  });
581
- })(ii);
582
- var Fi = ii.exports;
583
- const Yi = /* @__PURE__ */ at(Fi);
584
- var ni = { exports: {} };
585
- (function(i, e) {
586
- (function(t, n) {
587
- i.exports = n();
588
- })(lt, function() {
589
- var t = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, n = {};
590
- return function(o, d, s) {
591
- var c, a = function(f, w, T) {
592
- T === void 0 && (T = {});
593
- var h = new Date(f), E = function(P, W) {
585
+ })(ui);
586
+ var Gi = ui.exports;
587
+ const Ui = /* @__PURE__ */ dt(Gi);
588
+ var ci = { exports: {} };
589
+ (function(t, e) {
590
+ (function(i, n) {
591
+ t.exports = n();
592
+ })(ct, function() {
593
+ var i = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, n = {};
594
+ return function(r, u, o) {
595
+ var c, s = function(f, S, y) {
596
+ y === void 0 && (y = {});
597
+ var m = new Date(f), E = function(P, W) {
594
598
  W === void 0 && (W = {});
595
- var y = W.timeZoneName || "short", D = P + "|" + y, k = n[D];
596
- return k || (k = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: P, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: y }), n[D] = k), k;
597
- }(w, T);
598
- return E.formatToParts(h);
599
- }, b = function(f, w) {
600
- for (var T = a(f, w), h = [], E = 0; E < T.length; E += 1) {
601
- var P = T[E], W = P.type, y = P.value, D = t[W];
602
- D >= 0 && (h[D] = parseInt(y, 10));
599
+ var T = W.timeZoneName || "short", H = P + "|" + T, w = n[H];
600
+ return w || (w = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: P, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: T }), n[H] = w), w;
601
+ }(S, y);
602
+ return E.formatToParts(m);
603
+ }, p = function(f, S) {
604
+ for (var y = s(f, S), m = [], E = 0; E < y.length; E += 1) {
605
+ var P = y[E], W = P.type, T = P.value, H = i[W];
606
+ H >= 0 && (m[H] = parseInt(T, 10));
603
607
  }
604
- var k = h[3], $ = k === 24 ? 0 : k, B = h[0] + "-" + h[1] + "-" + h[2] + " " + $ + ":" + h[4] + ":" + h[5] + ":000", I = +f;
605
- return (s.utc(B).valueOf() - (I -= I % 1e3)) / 6e4;
606
- }, H = d.prototype;
607
- H.tz = function(f, w) {
608
+ var w = m[3], X = w === 24 ? 0 : w, B = m[0] + "-" + m[1] + "-" + m[2] + " " + X + ":" + m[4] + ":" + m[5] + ":000", I = +f;
609
+ return (o.utc(B).valueOf() - (I -= I % 1e3)) / 6e4;
610
+ }, k = u.prototype;
611
+ k.tz = function(f, S) {
608
612
  f === void 0 && (f = c);
609
- var T, h = this.utcOffset(), E = this.toDate(), P = E.toLocaleString("en-US", { timeZone: f }), W = Math.round((E - new Date(P)) / 1e3 / 60), y = 15 * -Math.round(E.getTimezoneOffset() / 15) - W;
610
- if (!Number(y)) T = this.utcOffset(0, w);
611
- else if (T = s(P, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(y, !0), w) {
612
- var D = T.utcOffset();
613
- T = T.add(h - D, "minute");
613
+ var y, m = this.utcOffset(), E = this.toDate(), P = E.toLocaleString("en-US", { timeZone: f }), W = Math.round((E - new Date(P)) / 1e3 / 60), T = 15 * -Math.round(E.getTimezoneOffset() / 15) - W;
614
+ if (!Number(T)) y = this.utcOffset(0, S);
615
+ else if (y = o(P, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(T, !0), S) {
616
+ var H = y.utcOffset();
617
+ y = y.add(m - H, "minute");
614
618
  }
615
- return T.$x.$timezone = f, T;
616
- }, H.offsetName = function(f) {
617
- var w = this.$x.$timezone || s.tz.guess(), T = a(this.valueOf(), w, { timeZoneName: f }).find(function(h) {
618
- return h.type.toLowerCase() === "timezonename";
619
+ return y.$x.$timezone = f, y;
620
+ }, k.offsetName = function(f) {
621
+ var S = this.$x.$timezone || o.tz.guess(), y = s(this.valueOf(), S, { timeZoneName: f }).find(function(m) {
622
+ return m.type.toLowerCase() === "timezonename";
619
623
  });
620
- return T && T.value;
624
+ return y && y.value;
621
625
  };
622
- var p = H.startOf;
623
- H.startOf = function(f, w) {
624
- if (!this.$x || !this.$x.$timezone) return p.call(this, f, w);
625
- var T = s(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
626
- return p.call(T, f, w).tz(this.$x.$timezone, !0);
627
- }, s.tz = function(f, w, T) {
628
- var h = T && w, E = T || w || c, P = b(+s(), E);
629
- if (typeof f != "string") return s(f).tz(E);
630
- var W = function($, B, I) {
631
- var A = $ - 60 * B * 1e3, F = b(A, I);
632
- if (B === F) return [A, B];
633
- var se = b(A -= 60 * (F - B) * 1e3, I);
634
- return F === se ? [A, F] : [$ - 60 * Math.min(F, se) * 1e3, Math.max(F, se)];
635
- }(s.utc(f, h).valueOf(), P, E), y = W[0], D = W[1], k = s(y).utcOffset(D);
636
- return k.$x.$timezone = E, k;
637
- }, s.tz.guess = function() {
626
+ var h = k.startOf;
627
+ k.startOf = function(f, S) {
628
+ if (!this.$x || !this.$x.$timezone) return h.call(this, f, S);
629
+ var y = o(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
630
+ return h.call(y, f, S).tz(this.$x.$timezone, !0);
631
+ }, o.tz = function(f, S, y) {
632
+ var m = y && S, E = y || S || c, P = p(+o(), E);
633
+ if (typeof f != "string") return o(f).tz(E);
634
+ var W = function(X, B, I) {
635
+ var x = X - 60 * B * 1e3, F = p(x, I);
636
+ if (B === F) return [x, B];
637
+ var ie = p(x -= 60 * (F - B) * 1e3, I);
638
+ return F === ie ? [x, F] : [X - 60 * Math.min(F, ie) * 1e3, Math.max(F, ie)];
639
+ }(o.utc(f, m).valueOf(), P, E), T = W[0], H = W[1], w = o(T).utcOffset(H);
640
+ return w.$x.$timezone = E, w;
641
+ }, o.tz.guess = function() {
638
642
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
639
- }, s.tz.setDefault = function(f) {
643
+ }, o.tz.setDefault = function(f) {
640
644
  c = f;
641
645
  };
642
646
  };
643
647
  });
644
- })(ni);
645
- var _i = ni.exports;
646
- const Wi = /* @__PURE__ */ at(_i);
647
- We.extend(Yi);
648
- We.extend(Wi);
649
- function Te(i, e) {
650
- return e ? We(i).tz(e) : We(i);
648
+ })(ci);
649
+ var Zi = ci.exports;
650
+ const Vi = /* @__PURE__ */ dt(Zi);
651
+ Me.extend(Ui);
652
+ Me.extend(Vi);
653
+ function he(t, e) {
654
+ return e ? Me(t).tz(e) : Me(t);
651
655
  }
652
- class Bi {
653
- draw(e, t, n, o, d, s, c, a) {
654
- const { firstVisible: b, lastVisible: H } = t.getVisibleGroupRange();
655
- for (let y = b; y <= H; y++) {
656
- const D = t.groupIndexToY(y), k = t.groupIndexToHeight(y), $ = n[y];
657
- if (!$)
656
+ class qi {
657
+ draw(e, i, n, r, u, o, c, s) {
658
+ const { firstVisible: p, lastVisible: k } = i.getVisibleGroupRange();
659
+ for (let T = p; T <= k; T++) {
660
+ const H = i.groupIndexToY(T), w = i.groupIndexToHeight(T), X = n[T];
661
+ if (!X)
658
662
  continue;
659
663
  let B;
660
- const I = s == null ? void 0 : s($);
661
- I != null && I.backgroundColor ? B = I.backgroundColor : B = y % 2 === 0 ? "#FFFFFF" : o.grid.rowAlt, e.fillStyle = B, e.fillRect(0, D, t.canvasWidth, k), e.strokeStyle = (I == null ? void 0 : I.borderBottomColor) ?? o.grid.line, e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, D + k), e.lineTo(t.canvasWidth, D + k), e.stroke();
664
+ const I = o == null ? void 0 : o(X);
665
+ I != null && I.backgroundColor ? B = I.backgroundColor : B = T % 2 === 0 ? "#FFFFFF" : r.grid.rowAlt, e.fillStyle = B, e.fillRect(0, H, i.canvasWidth, w), e.strokeStyle = (I == null ? void 0 : I.borderBottomColor) ?? r.grid.line, e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, H + w), e.lineTo(i.canvasWidth, H + w), e.stroke();
662
666
  }
663
667
  if (c && c.length > 0)
664
- for (const y of c) {
665
- const D = t.timeToX(y.start), k = t.timeToX(y.end);
666
- if (k < 0 || D > t.canvasWidth)
668
+ for (const T of c) {
669
+ const H = i.timeToX(T.start), w = i.timeToX(T.end);
670
+ if (w < 0 || H > i.canvasWidth)
667
671
  continue;
668
- const $ = Math.max(0, D), B = Math.min(t.canvasWidth, k) - $, I = y.opacity ?? 0.12, A = parseInt(y.color.slice(1, 3), 16), F = parseInt(y.color.slice(3, 5), 16), se = parseInt(y.color.slice(5, 7), 16);
669
- e.fillStyle = `rgb(${Math.round(A * I + 255 * (1 - I))},${Math.round(F * I + 255 * (1 - I))},${Math.round(se * I + 255 * (1 - I))})`, e.fillRect($, 0, B, t.canvasHeight);
672
+ const X = Math.max(0, H), B = Math.min(i.canvasWidth, w) - X, I = T.opacity ?? 0.12, x = parseInt(T.color.slice(1, 3), 16), F = parseInt(T.color.slice(3, 5), 16), ie = parseInt(T.color.slice(5, 7), 16);
673
+ e.fillStyle = `rgb(${Math.round(x * I + 255 * (1 - I))},${Math.round(F * I + 255 * (1 - I))},${Math.round(ie * I + 255 * (1 - I))})`, e.fillRect(X, 0, B, i.canvasHeight);
670
674
  }
671
- const p = t.visibleTimeStart, f = t.visibleTimeEnd, h = 864e5 / (f - p) * t.canvasWidth;
675
+ const h = i.visibleTimeStart, f = i.visibleTimeEnd, m = 864e5 / (f - h) * i.canvasWidth;
672
676
  let E = "day";
673
- h < 2 ? E = "month" : h < 8 && (E = "week");
677
+ m < 2 ? E = "month" : m < 8 && (E = "week");
674
678
  {
675
- let y = Te(p, a).startOf("day");
676
- const D = Te(f, a).endOf("day");
677
- let k = null, $ = 1, B = 0;
678
- const I = [], A = (F) => {
679
- k !== null && (e.fillStyle = k, $ !== 1 && (e.globalAlpha = $), e.fillRect(B, 0, F - B, t.canvasHeight), $ !== 1 && (e.globalAlpha = 1), k = null, $ = 1);
679
+ let T = he(h, s).startOf("day");
680
+ const H = he(f, s).endOf("day");
681
+ let w = null, X = 1, B = 0;
682
+ const I = [], x = (F) => {
683
+ w !== null && (e.fillStyle = w, X !== 1 && (e.globalAlpha = X), e.fillRect(B, 0, F - B, i.canvasHeight), X !== 1 && (e.globalAlpha = 1), w = null, X = 1);
680
684
  };
681
- for (; y.isBefore(D); ) {
682
- const F = t.timeToX(y.valueOf()), se = y.toDate(), K = d == null ? void 0 : d(se);
683
- let te = null, be = 1;
684
- if (K != null && K.backgroundColor)
685
- te = K.backgroundColor, be = K.opacity ?? 1;
685
+ for (; T.isBefore(H); ) {
686
+ const F = i.timeToX(T.valueOf()), ie = T.toDate(), U = u == null ? void 0 : u(ie);
687
+ let Q = null, me = 1;
688
+ if (U != null && U.backgroundColor)
689
+ Q = U.backgroundColor, me = U.opacity ?? 1;
686
690
  else {
687
- const Se = y.day();
688
- (Se === 0 || Se === 6) && (te = o.grid.weekend);
691
+ const ve = T.day();
692
+ (ve === 0 || ve === 6) && (Q = r.grid.weekend);
689
693
  }
690
- K != null && K.borderColor && I.push({ x: F, color: K.borderColor }), te === k && be === $ || (A(F), te !== null && (k = te, $ = be, B = F)), y = y.add(1, "day");
694
+ U != null && U.borderColor && I.push({ x: F, color: U.borderColor }), Q === w && me === X || (x(F), Q !== null && (w = Q, X = me, B = F)), T = T.add(1, "day");
691
695
  }
692
- k !== null && A(t.timeToX(y.valueOf()));
696
+ w !== null && x(i.timeToX(T.valueOf()));
693
697
  for (const F of I)
694
- e.strokeStyle = F.color, e.lineWidth = 0.5, e.beginPath(), e.moveTo(F.x, 0), e.lineTo(F.x, t.canvasHeight), e.stroke();
698
+ e.strokeStyle = F.color, e.lineWidth = 0.5, e.beginPath(), e.moveTo(F.x, 0), e.lineTo(F.x, i.canvasHeight), e.stroke();
695
699
  }
696
- let P = Te(p, a).startOf(E);
697
- const W = Te(f, a).add(1, E);
698
- for (e.strokeStyle = o.grid.line, e.lineWidth = 0.5, e.beginPath(); P.isBefore(W); ) {
699
- const y = t.timeToX(P.valueOf());
700
- e.moveTo(y, 0), e.lineTo(y, t.canvasHeight), P = P.add(1, E);
700
+ let P = he(h, s).startOf(E);
701
+ const W = he(f, s).add(1, E);
702
+ for (e.strokeStyle = r.grid.line, e.lineWidth = 0.5, e.beginPath(); P.isBefore(W); ) {
703
+ const T = i.timeToX(P.valueOf());
704
+ e.moveTo(T, 0), e.lineTo(T, i.canvasHeight), P = P.add(1, E);
701
705
  }
702
706
  if (e.stroke(), c && c.length > 0)
703
- for (const y of c) {
704
- const D = t.timeToX(y.start), k = t.timeToX(y.end);
705
- if (!(k < 0 || D > t.canvasWidth) && (e.strokeStyle = y.color, e.globalAlpha = 0.4, e.lineWidth = 1, e.beginPath(), D >= 0 && D <= t.canvasWidth && (e.moveTo(D, 0), e.lineTo(D, t.canvasHeight)), k >= 0 && k <= t.canvasWidth && (e.moveTo(k, 0), e.lineTo(k, t.canvasHeight)), e.stroke(), e.globalAlpha = 1, y.label)) {
706
- const $ = Math.max(0, D), B = Math.min(t.canvasWidth, k) - $;
707
+ for (const T of c) {
708
+ const H = i.timeToX(T.start), w = i.timeToX(T.end);
709
+ if (!(w < 0 || H > i.canvasWidth) && (e.strokeStyle = T.color, e.globalAlpha = 0.4, e.lineWidth = 1, e.beginPath(), H >= 0 && H <= i.canvasWidth && (e.moveTo(H, 0), e.lineTo(H, i.canvasHeight)), w >= 0 && w <= i.canvasWidth && (e.moveTo(w, 0), e.lineTo(w, i.canvasHeight)), e.stroke(), e.globalAlpha = 1, T.label)) {
710
+ const X = Math.max(0, H), B = Math.min(i.canvasWidth, w) - X;
707
711
  e.save(), e.font = '600 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
708
- const I = e.measureText(y.label).width, A = 6, F = I + A * 2, se = 18, K = $ + (B - F) / 2, te = 4;
709
- e.fillStyle = y.color, e.globalAlpha = 0.9, e.beginPath(), e.roundRect(K, te, F, se, 3), e.fill(), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.fillText(y.label, K + A, te + se / 2), e.restore();
712
+ const I = e.measureText(T.label).width, x = 6, F = I + x * 2, ie = 18, U = X + (B - F) / 2, Q = 4;
713
+ e.fillStyle = T.color, e.globalAlpha = 0.9, e.beginPath(), e.roundRect(U, Q, F, ie, 3), e.fill(), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.fillText(T.label, U + x, Q + ie / 2), e.restore();
710
714
  }
711
715
  }
712
716
  }
713
717
  }
714
- const Ut = '500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
715
- function ri(i, e) {
718
+ const ei = '500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
719
+ function di(t, e) {
716
720
  return {
717
721
  /**
718
722
  * Draws a filled rounded rectangle.
719
723
  * Default corner radius is 3px.
720
724
  */
721
- roundRect(t, n, o, d, s = 3) {
722
- i.beginPath(), i.roundRect(t, n, o, d, s), i.fill();
725
+ roundRect(i, n, r, u, o = 3) {
726
+ t.beginPath(), t.roundRect(i, n, r, u, o), t.fill();
723
727
  },
724
728
  /**
725
729
  * Draws text at (x, y) using the standard item font.
726
730
  * If maxWidth is provided and the text is too wide, binary-search truncates it
727
731
  * and appends '...' so it fits within maxWidth.
728
732
  */
729
- fillText(t, n, o, d) {
730
- if (i.font = Ut, d !== void 0 && i.measureText(t).width > d) {
731
- let s = 0, c = t.length;
732
- for (; s < c; ) {
733
- const a = Math.ceil((s + c) / 2), b = t.slice(0, a) + "...";
734
- i.measureText(b).width <= d ? s = a : c = a - 1;
733
+ fillText(i, n, r, u) {
734
+ if (t.font = ei, u !== void 0 && t.measureText(i).width > u) {
735
+ let o = 0, c = i.length;
736
+ for (; o < c; ) {
737
+ const s = Math.ceil((o + c) / 2), p = i.slice(0, s) + "...";
738
+ t.measureText(p).width <= u ? o = s : c = s - 1;
735
739
  }
736
- i.fillText(t.slice(0, s) + "...", n, o);
740
+ t.fillText(i.slice(0, o) + "...", n, r);
737
741
  } else
738
- i.fillText(t, n, o);
742
+ t.fillText(i, n, r);
739
743
  },
740
744
  /**
741
745
  * Creates a 50/50 linear gradient from color1 (0%–50%) to color2 (50%–100%)
742
746
  * spanning the given x position and width.
743
747
  */
744
- gradient(t, n, o, d) {
745
- const s = i.createLinearGradient(t, 0, t + n, 0);
746
- return s.addColorStop(0, o), s.addColorStop(0.5, o), s.addColorStop(0.5, d), s.addColorStop(1, d), s;
748
+ gradient(i, n, r, u) {
749
+ const o = t.createLinearGradient(i, 0, i + n, 0);
750
+ return o.addColorStop(0, r), o.addColorStop(0.5, r), o.addColorStop(0.5, u), o.addColorStop(1, u), o;
747
751
  },
748
752
  /**
749
753
  * Draws a vertical colored bar on the left edge of the item bounds.
750
754
  * Does nothing if no bounds were provided.
751
755
  */
752
- leftBar(t, n = 3) {
753
- e && (i.save(), i.fillStyle = t, i.fillRect(e.x, e.y, n, e.height), i.restore());
756
+ leftBar(i, n = 3) {
757
+ e && (t.save(), t.fillStyle = i, t.fillRect(e.x, e.y, n, e.height), t.restore());
754
758
  },
755
759
  /**
756
760
  * Draws a vector icon centered at (x, y).
757
761
  * Supported types: 'check', 'danger-red', 'danger-yellow'.
758
762
  * Default size is 14px.
759
763
  */
760
- icon(t, n, o, d = 14) {
761
- i.save();
762
- const s = d / 2;
763
- if (t === "check") {
764
- i.fillStyle = "#31c48d", i.beginPath(), i.arc(n + s, o + s, s, 0, Math.PI * 2), i.fill(), i.strokeStyle = "#ffffff", i.lineWidth = d * 0.12, i.beginPath();
765
- const c = n + s, a = o + s;
766
- i.moveTo(c - s * 0.45, a), i.lineTo(c - s * 0.1, a + s * 0.42), i.lineTo(c + s * 0.45, a - s * 0.35), i.stroke();
767
- } else if (t === "danger-red" || t === "danger-yellow") {
768
- const c = t === "danger-red" ? "#EF5350" : "#FBBF24";
769
- i.fillStyle = c, i.beginPath(), i.moveTo(n + s, o), i.lineTo(n + d, o + d), i.lineTo(n, o + d), i.closePath(), i.fill(), i.fillStyle = "#ffffff";
770
- const a = d * 0.12, b = n + s - a / 2;
771
- i.fillRect(b, o + d * 0.35, a, d * 0.35), i.beginPath(), i.arc(n + s, o + d * 0.82, a * 0.7, 0, Math.PI * 2), i.fill();
764
+ icon(i, n, r, u = 14) {
765
+ t.save();
766
+ const o = u / 2;
767
+ if (i === "check") {
768
+ t.fillStyle = "#31c48d", t.beginPath(), t.arc(n + o, r + o, o, 0, Math.PI * 2), t.fill(), t.strokeStyle = "#ffffff", t.lineWidth = u * 0.12, t.beginPath();
769
+ const c = n + o, s = r + o;
770
+ t.moveTo(c - o * 0.45, s), t.lineTo(c - o * 0.1, s + o * 0.42), t.lineTo(c + o * 0.45, s - o * 0.35), t.stroke();
771
+ } else if (i === "danger-red" || i === "danger-yellow") {
772
+ const c = i === "danger-red" ? "#EF5350" : "#FBBF24";
773
+ t.fillStyle = c, t.beginPath(), t.moveTo(n + o, r), t.lineTo(n + u, r + u), t.lineTo(n, r + u), t.closePath(), t.fill(), t.fillStyle = "#ffffff";
774
+ const s = u * 0.12, p = n + o - s / 2;
775
+ t.fillRect(p, r + u * 0.35, s, u * 0.35), t.beginPath(), t.arc(n + o, r + u * 0.82, s * 0.7, 0, Math.PI * 2), t.fill();
772
776
  }
773
- i.restore();
777
+ t.restore();
774
778
  },
775
779
  /**
776
780
  * Draws a pill-shaped badge with centered white text on a colored background.
777
781
  */
778
- badge(t, n, o, d) {
779
- i.save(), i.font = Ut;
780
- const c = i.measureText(t).width, a = 8, H = 12 + 3 * 2, p = c + a * 2, f = H / 2;
781
- i.fillStyle = d, i.beginPath(), i.roundRect(n, o, p, H, f), i.fill(), i.fillStyle = "#ffffff", i.textAlign = "center", i.textBaseline = "middle", i.fillText(t, n + p / 2, o + H / 2), i.restore();
782
+ badge(i, n, r, u) {
783
+ t.save(), t.font = ei;
784
+ const c = t.measureText(i).width, s = 8, k = 12 + 3 * 2, h = c + s * 2, f = k / 2;
785
+ t.fillStyle = u, t.beginPath(), t.roundRect(n, r, h, k, f), t.fill(), t.fillStyle = "#ffffff", t.textAlign = "center", t.textBaseline = "middle", t.fillText(i, n + h / 2, r + k / 2), t.restore();
782
786
  }
783
787
  };
784
788
  }
785
- class Li {
786
- draw(e, t, n, o, d, s, c, a, b, H, p, f, w, T) {
787
- const h = (t.visibleTimeEnd - t.visibleTimeStart) * 0.1, E = t.visibleTimeStart - h, P = t.visibleTimeEnd + h, W = d.query(E, P), y = /* @__PURE__ */ new Map();
789
+ class Ki {
790
+ draw(e, i, n, r, u, o, c, s, p, k, h, f, S, y) {
791
+ const m = (i.visibleTimeEnd - i.visibleTimeStart) * 0.1, E = i.visibleTimeStart - m, P = i.visibleTimeEnd + m, W = u.query(E, P), T = /* @__PURE__ */ new Map();
788
792
  for (let I = 0; I < n.length; I++)
789
- y.set(n[I].id, I);
790
- const D = new Set(H), k = /* @__PURE__ */ new Map(), $ = -t.lineHeight, B = t.canvasHeight + t.lineHeight;
793
+ T.set(n[I].id, I);
794
+ const H = new Set(k), w = /* @__PURE__ */ new Map(), X = -i.lineHeight, B = i.canvasHeight + i.lineHeight;
791
795
  for (const I of W) {
792
- const A = y.get(I.group);
793
- if (A === void 0)
796
+ const x = T.get(I.group);
797
+ if (x === void 0)
794
798
  continue;
795
- const F = s.getLayout(I.id);
799
+ const F = o.getLayout(I.id);
796
800
  if (!F)
797
801
  continue;
798
- const K = t.groupIndexToY(A) + F.stackLevel * t.lineHeight + (t.lineHeight - F.itemHeight) / 2, te = F.itemHeight;
799
- if (K + te < $ || K > B)
802
+ const U = i.groupIndexToY(x) + F.stackLevel * i.lineHeight + (i.lineHeight - F.itemHeight) / 2, Q = F.itemHeight;
803
+ if (U + Q < X || U > B)
800
804
  continue;
801
- const be = t.timeToX(I.start_time), Se = t.timeToX(I.end_time) - be, Me = { x: be, y: K, width: Se, height: te };
802
- k.set(I.id, Me);
803
- const Xe = {
804
- selected: D.has(I.id),
805
- hovered: p === I.id,
805
+ const me = i.timeToX(I.start_time), ve = i.timeToX(I.end_time) - me, be = { x: me, y: U, width: ve, height: Q };
806
+ w.set(I.id, be);
807
+ const Ye = {
808
+ selected: H.has(I.id),
809
+ hovered: h === I.id,
806
810
  dragging: !1,
807
811
  filtered: I.filtered !== !1
808
812
  };
809
813
  e.save();
810
- const qe = ri(e, Me);
811
- let De;
812
- w && (T != null && T.isParent(I.id)) ? De = w : a && (I.type === "control_area_group" || I.type === "construction_train") ? De = a : De = c, De(e, I, Me, Xe, qe), e.restore();
814
+ const Je = di(e, be);
815
+ let He;
816
+ S && (y != null && y.isParent(I.id)) ? He = S : s && (I.type === "control_area_group" || I.type === "construction_train") ? He = s : He = c, He(e, I, be, Ye, Je), e.restore();
813
817
  }
814
818
  if (f && f.length > 0) {
815
819
  const I = /* @__PURE__ */ new Set();
816
- for (const A of f)
817
- k.has(A.fromItemId) || I.add(A.fromItemId), k.has(A.toItemId) || I.add(A.toItemId);
820
+ for (const x of f)
821
+ w.has(x.fromItemId) || I.add(x.fromItemId), w.has(x.toItemId) || I.add(x.toItemId);
818
822
  if (I.size > 0) {
819
- const A = /* @__PURE__ */ new Map();
820
- for (const F of o)
821
- I.has(F.id) && A.set(F.id, F);
822
- for (const [F, se] of A) {
823
- const K = y.get(se.group);
824
- if (K === void 0)
823
+ const x = /* @__PURE__ */ new Map();
824
+ for (const F of r)
825
+ I.has(F.id) && x.set(F.id, F);
826
+ for (const [F, ie] of x) {
827
+ const U = T.get(ie.group);
828
+ if (U === void 0)
825
829
  continue;
826
- const te = s.getLayout(F);
827
- if (!te)
830
+ const Q = o.getLayout(F);
831
+ if (!Q)
828
832
  continue;
829
- const Se = t.groupIndexToY(K) + te.stackLevel * t.lineHeight + (t.lineHeight - te.itemHeight) / 2, Me = t.timeToX(se.start_time), Xe = t.timeToX(se.end_time) - Me;
830
- k.set(F, { x: Me, y: Se, width: Xe, height: te.itemHeight });
833
+ const ve = i.groupIndexToY(U) + Q.stackLevel * i.lineHeight + (i.lineHeight - Q.itemHeight) / 2, be = i.timeToX(ie.start_time), Ye = i.timeToX(ie.end_time) - be;
834
+ w.set(F, { x: be, y: ve, width: Ye, height: Q.itemHeight });
831
835
  }
832
836
  }
833
- this.drawDependencies(e, f, k, p, b);
837
+ this.drawDependencies(e, f, w, h, p);
834
838
  }
835
839
  }
836
- drawDependencies(e, t, n, o, d) {
837
- for (const s of t) {
838
- const c = n.get(s.fromItemId), a = n.get(s.toItemId);
839
- if (!c || !a)
840
+ drawDependencies(e, i, n, r, u) {
841
+ for (const o of i) {
842
+ const c = n.get(o.fromItemId), s = n.get(o.toItemId);
843
+ if (!c || !s)
840
844
  continue;
841
- const b = o === s.fromItemId || o === s.toItemId;
842
- e.strokeStyle = b ? d.primary : s.color ?? "#94A3B8", e.lineWidth = b ? 2 : 1.5, e.setLineDash([]);
843
- const H = c.x + c.width, p = c.y + c.height / 2, f = a.x, w = a.y + a.height / 2, T = Math.abs(f - H), h = Math.max(T * 0.4, 30);
844
- e.beginPath(), e.moveTo(H, p), e.bezierCurveTo(H + h, p, f - h, w, f, w), e.stroke();
845
+ const p = r === o.fromItemId || r === o.toItemId;
846
+ e.strokeStyle = p ? u.primary : o.color ?? "#94A3B8", e.lineWidth = p ? 2 : 1.5, e.setLineDash([]);
847
+ const k = c.x + c.width, h = c.y + c.height / 2, f = s.x, S = s.y + s.height / 2, y = Math.abs(f - k), m = Math.max(y * 0.4, 30);
848
+ e.beginPath(), e.moveTo(k, h), e.bezierCurveTo(k + m, h, f - m, S, f, S), e.stroke();
845
849
  const E = 6;
846
- e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(f, w), e.lineTo(f - E, w - E / 2), e.lineTo(f - E, w + E / 2), e.closePath(), e.fill();
850
+ e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(f, S), e.lineTo(f - E, S - E / 2), e.lineTo(f - E, S + E / 2), e.closePath(), e.fill();
847
851
  }
848
852
  }
849
853
  }
850
- class zi {
851
- draw(e, t, n, o) {
852
- const { cursorX: d, snapX: s, markers: c, interaction: a } = o;
854
+ class Ji {
855
+ draw(e, i, n, r) {
856
+ const { cursorX: u, snapX: o, markers: c, interaction: s } = r;
853
857
  if (c)
854
- for (const b of c) {
855
- const H = t.timeToX(b.date);
856
- if (e.fillStyle = b.color, e.fillRect(H - b.width / 2, 0, b.width, t.canvasHeight), b.label) {
858
+ for (const p of c) {
859
+ const k = i.timeToX(p.date);
860
+ if (e.fillStyle = p.color, e.fillRect(k - p.width / 2, 0, p.width, i.canvasHeight), p.label) {
857
861
  e.save(), e.font = '500 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
858
- const p = e.measureText(b.label).width, f = 8, w = 200, T = Math.min(p + f * 2, w), h = 20, E = H - T / 2, P = 4;
859
- e.fillStyle = b.color, e.beginPath(), e.roundRect(E, P, T, h, 3), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle";
860
- const W = w - f * 2, y = p > W ? b.label.slice(0, Math.floor(b.label.length * W / p)) + "…" : b.label;
861
- e.fillText(y, E + f, P + h / 2), e.restore();
862
+ const h = e.measureText(p.label).width, f = 8, S = 200, y = Math.min(h + f * 2, S), m = 20, E = k - y / 2, P = 4;
863
+ e.fillStyle = p.color, e.beginPath(), e.roundRect(E, P, y, m, 3), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle";
864
+ const W = S - f * 2, T = h > W ? p.label.slice(0, Math.floor(p.label.length * W / h)) + "…" : p.label;
865
+ e.fillText(T, E + f, P + m / 2), e.restore();
862
866
  }
863
867
  }
864
- if (d != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(d, 0), e.lineTo(d, t.canvasHeight), e.stroke()), s != null && (e.strokeStyle = n.primary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(s, 0), e.lineTo(s, t.canvasHeight), e.stroke(), e.setLineDash([])), a) {
865
- a.groupChanged && a.targetGroupY !== void 0 && (e.fillStyle = "rgba(59, 130, 246, 0.08)", e.fillRect(0, a.targetGroupY, t.canvasWidth, t.lineHeight)), e.save(), e.globalAlpha = 0.5;
866
- const b = ri(e, a.bounds);
867
- a.renderer(e, a.item, a.bounds, { selected: !1, hovered: !1, dragging: !0, filtered: !0 }, b), e.restore();
868
+ if (u != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(u, 0), e.lineTo(u, i.canvasHeight), e.stroke()), o != null && (e.strokeStyle = n.primary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(o, 0), e.lineTo(o, i.canvasHeight), e.stroke(), e.setLineDash([])), s) {
869
+ s.groupChanged && s.targetGroupY !== void 0 && (e.fillStyle = "rgba(59, 130, 246, 0.08)", e.fillRect(0, s.targetGroupY, i.canvasWidth, i.lineHeight)), e.save(), e.globalAlpha = 0.5;
870
+ const p = di(e, s.bounds);
871
+ s.renderer(e, s.item, s.bounds, { selected: !1, hovered: !1, dragging: !0, filtered: !0 }, p), e.restore();
868
872
  }
869
873
  }
870
874
  }
871
- const Vt = 120;
872
- function xi(i) {
873
- let e = i.deltaY || i.deltaX;
874
- return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-Vt, Math.min(Vt, e));
875
+ const ti = 120;
876
+ function Qi(t) {
877
+ let e = t.deltaY || t.deltaX;
878
+ return t.deltaMode === 1 ? e *= 15 : t.deltaMode === 2 && (e *= 800), Math.max(-ti, Math.min(ti, e));
875
879
  }
876
- class Ai {
877
- constructor(e, t, n, o, d) {
880
+ class en {
881
+ constructor(e, i, n, r, u) {
878
882
  Object.defineProperty(this, "onZoom", {
879
883
  enumerable: !0,
880
884
  configurable: !0,
@@ -900,21 +904,46 @@ class Ai {
900
904
  configurable: !0,
901
905
  writable: !0,
902
906
  value: void 0
903
- }), this.onZoom = e, this.visibleTimeStart = t, this.visibleTimeEnd = n, this.minZoom = o, this.maxZoom = d;
907
+ }), this.onZoom = e, this.visibleTimeStart = i, this.visibleTimeEnd = n, this.minZoom = r, this.maxZoom = u;
904
908
  }
905
- updateBounds(e, t) {
906
- this.visibleTimeStart = e, this.visibleTimeEnd = t;
909
+ updateBounds(e, i) {
910
+ this.visibleTimeStart = e, this.visibleTimeEnd = i;
907
911
  }
908
- handleWheelZoom(e, t) {
909
- const n = xi(e), o = e.ctrlKey ? 10 : e.metaKey ? 3 : 1, d = n > 0 ? 1 + o * n / 500 : 1 / (1 + o * -n / 500), s = this.visibleTimeEnd - this.visibleTimeStart;
910
- let c = Math.round(s * d);
912
+ handleWheelZoom(e, i) {
913
+ const n = Qi(e), r = e.ctrlKey ? 10 : e.metaKey ? 3 : 1, u = n > 0 ? 1 + r * n / 500 : 1 / (1 + r * -n / 500), o = this.visibleTimeEnd - this.visibleTimeStart;
914
+ let c = Math.round(o * u);
911
915
  c = Math.max(this.minZoom, Math.min(this.maxZoom, c));
912
- const a = Math.round(this.visibleTimeStart + (s - c) * t), b = a + c;
913
- this.onZoom(a, b);
916
+ const s = Math.round(this.visibleTimeStart + (o - c) * i), p = s + c;
917
+ this.onZoom(s, p);
918
+ }
919
+ }
920
+ const lt = 864e5;
921
+ let ii = !1;
922
+ function Ht(t) {
923
+ return ii || (ii = !0, console.warn(`[canvas-timeline] dragSnap function returned ${t}; falling back to no snap. This warning is shown once per session.`)), 1;
924
+ }
925
+ function qe(t, e, i) {
926
+ if (t === void 0)
927
+ return 1;
928
+ if (typeof t != "function")
929
+ return t;
930
+ const n = t(e, i);
931
+ return typeof n == "number" ? !Number.isFinite(n) || n <= 0 ? Ht(`an invalid interval (${n})`) : n : !Number.isFinite(n.interval) || n.interval <= 0 ? Ht(`an invalid interval (${n.interval})`) : Number.isFinite(n.anchor) ? n : Ht(`a non-finite anchor (${n.anchor})`);
932
+ }
933
+ function Ke(t, e, i) {
934
+ if (typeof e != "number") {
935
+ const { interval: r, anchor: u } = e;
936
+ return !Number.isFinite(r) || r <= 0 || !Number.isFinite(u) ? t : Math.round((t - u) / r) * r + u;
937
+ }
938
+ const n = e;
939
+ if (i && n % lt === 0) {
940
+ const r = n / lt, u = he(t, i), o = u.startOf("day"), c = o.add(1, "day").valueOf() - o.valueOf(), s = (t - o.valueOf()) / c, p = Math.round(Me.utc(u.format("YYYY-MM-DD")).valueOf() / lt), k = Math.round((p + s) / r) * r, h = Me.utc(k * lt).format("YYYY-MM-DD");
941
+ return Me.tz(h, i).valueOf();
914
942
  }
943
+ return Math.round(t / n) * n;
915
944
  }
916
- const ji = 4;
917
- class Gi {
945
+ const tn = 4;
946
+ class nn {
918
947
  constructor(e) {
919
948
  Object.defineProperty(this, "state", {
920
949
  enumerable: !0,
@@ -933,21 +962,21 @@ class Gi {
933
962
  value: !1
934
963
  }), this.dragSnap = e;
935
964
  }
936
- startInteraction(e, t, n, o) {
965
+ startInteraction(e, i, n, r) {
937
966
  this.state = {
938
967
  item: e,
939
- mode: t,
968
+ mode: i,
940
969
  startX: n,
941
- startY: o,
970
+ startY: r,
942
971
  currentX: n,
943
- currentY: o,
972
+ currentY: r,
944
973
  deltaX: 0,
945
974
  originalGroup: e.group,
946
975
  currentGroup: e.group
947
976
  }, this.activated = !1;
948
977
  }
949
- update(e, t) {
950
- this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >= ji && (this.activated = !0));
978
+ update(e, i) {
979
+ this.state && (this.state.currentX = e, this.state.currentY = i, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >= tn && (this.activated = !0));
951
980
  }
952
981
  setCurrentGroup(e) {
953
982
  this.state && (this.state.currentGroup = e);
@@ -955,14 +984,14 @@ class Gi {
955
984
  endMove(e) {
956
985
  if (!this.state)
957
986
  return null;
958
- const t = this.state.deltaX / e, n = this.state.item.start_time + t, o = Math.round(n / this.dragSnap) * this.dragSnap, d = this.state.currentGroup;
959
- return this.state = null, this.activated = !1, { newStartTime: o, newGroupId: d };
987
+ const i = this.state.deltaX / e, n = this.state.item.start_time + i, r = Ke(n, qe(this.dragSnap, this.state.item)), u = this.state.currentGroup;
988
+ return this.state = null, this.activated = !1, { newStartTime: r, newGroupId: u };
960
989
  }
961
990
  endResize(e) {
962
991
  if (!this.state)
963
992
  return null;
964
- const t = this.state.deltaX / e, n = this.state.mode === "resize-left" ? "left" : "right", d = (n === "left" ? this.state.item.start_time : this.state.item.end_time) + t, s = Math.round(d / this.dragSnap) * this.dragSnap;
965
- return this.state = null, this.activated = !1, { newTime: s, edge: n };
993
+ const i = this.state.deltaX / e, n = this.state.mode === "resize-left" ? "left" : "right", u = (n === "left" ? this.state.item.start_time : this.state.item.end_time) + i, o = Ke(u, qe(this.dragSnap, this.state.item, n));
994
+ return this.state = null, this.activated = !1, { newTime: o, edge: n };
966
995
  }
967
996
  cancel() {
968
997
  this.state = null, this.activated = !1;
@@ -981,705 +1010,712 @@ class Gi {
981
1010
  return this.state !== null;
982
1011
  }
983
1012
  }
984
- function wt(i, e, t) {
1013
+ function It(t, e, i) {
985
1014
  const n = [];
986
- for (const o of i)
987
- o.id !== e && (n.push(t(o.start_time)), n.push(t(o.end_time)));
1015
+ for (const r of t)
1016
+ r.id !== e && (n.push(i(r.start_time)), n.push(i(r.end_time)));
988
1017
  return n;
989
1018
  }
990
- function st(i, e, t, n, o) {
1019
+ function ut(t, e, i, n, r) {
991
1020
  if (e.length === 0)
992
1021
  return null;
993
- let d = e[0], s = Math.abs(i - d);
1022
+ let u = e[0], o = Math.abs(t - u);
994
1023
  for (let c = 1; c < e.length; c++) {
995
- const a = Math.abs(i - e[c]);
996
- a < s && (s = a, d = e[c]);
1024
+ const s = Math.abs(t - e[c]);
1025
+ s < o && (o = s, u = e[c]);
1026
+ }
1027
+ return o <= i ? u : null;
1028
+ }
1029
+ function fi(t, e, i) {
1030
+ const n = i.canvasWidth / (e.visibleTimeEnd - e.visibleTimeStart), r = t.deltaX / n, u = t.item.start_time + r, o = qe(i.dragSnap, t.item), c = (e.visibleTimeEnd - e.visibleTimeStart) * 0.1, s = i.intervalTree.query(e.visibleTimeStart - c, e.visibleTimeEnd + c), p = It(s, t.item.id, (f) => e.timeToX(f)), k = ut(e.timeToX(u), p, 8);
1031
+ if (k !== null)
1032
+ return e.xToTime(k);
1033
+ const h = ut(e.timeToX(t.item.end_time + r), p, 8);
1034
+ return h !== null ? e.xToTime(h) - (t.item.end_time - t.item.start_time) : Ke(u, o, i.timezone);
1035
+ }
1036
+ function hi(t, e, i) {
1037
+ const n = i.canvasWidth / (e.visibleTimeEnd - e.visibleTimeStart), r = t.deltaX / n, u = t.mode === "resize-left" ? "left" : "right", o = (u === "left" ? t.item.start_time : t.item.end_time) + r, c = qe(i.dragSnap, t.item, u), s = (e.visibleTimeEnd - e.visibleTimeStart) * 0.1, p = i.intervalTree.query(e.visibleTimeStart - s, e.visibleTimeEnd + s), k = It(p, t.item.id, (y) => e.timeToX(y)), h = ut(e.timeToX(o), k, 8);
1038
+ let f = h !== null ? e.xToTime(h) : Ke(o, c, i.timezone);
1039
+ const S = i.hierarchyEngine.getResizeConstraint(t.item.id, u);
1040
+ return u === "left" && f > S.max ? f = S.max : u === "right" && f < S.min && (f = S.min), { edge: u, time: f };
1041
+ }
1042
+ function rn(t, e, i, n) {
1043
+ if (t.mode === "move") {
1044
+ const s = fi(t, e, i), p = t.item.end_time - t.item.start_time;
1045
+ return { itemId: t.item.id, mode: "move", time: s, startTime: s, endTime: s + p, pointerX: n.x, pointerY: n.y };
997
1046
  }
998
- return s <= t ? d : null;
1047
+ const { edge: r, time: u } = hi(t, e, i), o = r === "left" ? u : t.item.start_time, c = r === "right" ? u : t.item.end_time;
1048
+ return { itemId: t.item.id, mode: t.mode, edge: r, time: u, startTime: o, endTime: c, pointerX: n.x, pointerY: n.y };
999
1049
  }
1000
- var oi = { exports: {} };
1001
- (function(i, e) {
1002
- (function(t, n) {
1003
- i.exports = n();
1004
- })(lt, function() {
1005
- var t = "day";
1006
- return function(n, o, d) {
1007
- var s = function(b) {
1008
- return b.add(4 - b.isoWeekday(), t);
1009
- }, c = o.prototype;
1050
+ var mi = { exports: {} };
1051
+ (function(t, e) {
1052
+ (function(i, n) {
1053
+ t.exports = n();
1054
+ })(ct, function() {
1055
+ var i = "day";
1056
+ return function(n, r, u) {
1057
+ var o = function(p) {
1058
+ return p.add(4 - p.isoWeekday(), i);
1059
+ }, c = r.prototype;
1010
1060
  c.isoWeekYear = function() {
1011
- return s(this).year();
1012
- }, c.isoWeek = function(b) {
1013
- if (!this.$utils().u(b)) return this.add(7 * (b - this.isoWeek()), t);
1014
- var H, p, f, w, T = s(this), h = (H = this.isoWeekYear(), p = this.$u, f = (p ? d.utc : d)().year(H).startOf("year"), w = 4 - f.isoWeekday(), f.isoWeekday() > 4 && (w += 7), f.add(w, t));
1015
- return T.diff(h, "week") + 1;
1016
- }, c.isoWeekday = function(b) {
1017
- return this.$utils().u(b) ? this.day() || 7 : this.day(this.day() % 7 ? b : b - 7);
1061
+ return o(this).year();
1062
+ }, c.isoWeek = function(p) {
1063
+ if (!this.$utils().u(p)) return this.add(7 * (p - this.isoWeek()), i);
1064
+ var k, h, f, S, y = o(this), m = (k = this.isoWeekYear(), h = this.$u, f = (h ? u.utc : u)().year(k).startOf("year"), S = 4 - f.isoWeekday(), f.isoWeekday() > 4 && (S += 7), f.add(S, i));
1065
+ return y.diff(m, "week") + 1;
1066
+ }, c.isoWeekday = function(p) {
1067
+ return this.$utils().u(p) ? this.day() || 7 : this.day(this.day() % 7 ? p : p - 7);
1018
1068
  };
1019
- var a = c.startOf;
1020
- c.startOf = function(b, H) {
1021
- var p = this.$utils(), f = !!p.u(H) || H;
1022
- return p.p(b) === "isoweek" ? f ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : a.bind(this)(b, H);
1069
+ var s = c.startOf;
1070
+ c.startOf = function(p, k) {
1071
+ var h = this.$utils(), f = !!h.u(k) || k;
1072
+ return h.p(p) === "isoweek" ? f ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : s.bind(this)(p, k);
1023
1073
  };
1024
1074
  };
1025
1075
  });
1026
- })(oi);
1027
- var Ni = oi.exports;
1028
- const Zi = /* @__PURE__ */ at(Ni), qt = 200;
1029
- function Kt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o, canvasHeight: d, theme: s, groupRenderer: c, onScroll: a }) {
1030
- var y;
1031
- const b = U(null), H = U(!1), p = ee(() => {
1032
- const D = new Array(i.length + 1);
1033
- D[0] = 0;
1034
- for (let k = 0; k < i.length; k++)
1035
- D[k + 1] = D[k] + ((n == null ? void 0 : n[k]) ?? t);
1036
- return D;
1037
- }, [i.length, n, t]), f = p[i.length] ?? 0, w = d, T = oe((D) => {
1038
- if (i.length === 0 || D <= 0)
1076
+ })(mi);
1077
+ var on = mi.exports;
1078
+ const sn = /* @__PURE__ */ dt(on), ni = 200;
1079
+ function ri({ groups: t, width: e, lineHeight: i, groupHeights: n, scrollTop: r, canvasHeight: u, theme: o, groupRenderer: c, onScroll: s }) {
1080
+ var T;
1081
+ const p = A(null), k = A(!1), h = J(() => {
1082
+ const H = new Array(t.length + 1);
1083
+ H[0] = 0;
1084
+ for (let w = 0; w < t.length; w++)
1085
+ H[w + 1] = H[w] + ((n == null ? void 0 : n[w]) ?? i);
1086
+ return H;
1087
+ }, [t.length, n, i]), f = h[t.length] ?? 0, S = u, y = te((H) => {
1088
+ if (t.length === 0 || H <= 0)
1039
1089
  return 0;
1040
- if (D >= f)
1041
- return i.length - 1;
1042
- let k = 0, $ = i.length - 1;
1043
- for (; k < $; ) {
1044
- const B = k + $ >>> 1;
1045
- p[B + 1] > D ? $ = B : k = B + 1;
1090
+ if (H >= f)
1091
+ return t.length - 1;
1092
+ let w = 0, X = t.length - 1;
1093
+ for (; w < X; ) {
1094
+ const B = w + X >>> 1;
1095
+ h[B + 1] > H ? X = B : w = B + 1;
1046
1096
  }
1047
- return k;
1048
- }, [i.length, p, f]), h = T(o - qt), E = T(o + d + qt), P = oe((D) => {
1049
- H.current || a(D.currentTarget.scrollTop);
1050
- }, [a]);
1051
- ce(() => {
1052
- b.current && (H.current = !0, b.current.scrollTop = o, requestAnimationFrame(() => {
1053
- H.current = !1;
1097
+ return w;
1098
+ }, [t.length, h, f]), m = y(r - ni), E = y(r + u + ni), P = te((H) => {
1099
+ k.current || s(H.currentTarget.scrollTop);
1100
+ }, [s]);
1101
+ ae(() => {
1102
+ p.current && (k.current = !0, p.current.scrollTop = r, requestAnimationFrame(() => {
1103
+ k.current = !1;
1054
1104
  }));
1055
- }, [o]);
1105
+ }, [r]);
1056
1106
  const W = [];
1057
- for (let D = h; D <= E; D++) {
1058
- const k = i[D];
1059
- if (!k)
1107
+ for (let H = m; H <= E; H++) {
1108
+ const w = t[H];
1109
+ if (!w)
1060
1110
  continue;
1061
- const $ = p[D], B = p[D + 1] - $;
1062
- W.push(le("div", { style: {
1111
+ const X = h[H], B = h[H + 1] - X;
1112
+ W.push(re("div", { style: {
1063
1113
  position: "absolute",
1064
- top: $,
1114
+ top: X,
1065
1115
  height: B,
1066
1116
  width: "100%",
1067
1117
  overflow: "hidden",
1068
1118
  display: "flex",
1069
1119
  alignItems: "stretch",
1070
- borderBottom: `1px solid ${((y = s.grid) == null ? void 0 : y.line) ?? "#E5E5E5"}`,
1120
+ borderBottom: `1px solid ${((T = o.grid) == null ? void 0 : T.line) ?? "#E5E5E5"}`,
1071
1121
  boxSizing: "border-box"
1072
- }, children: c(k) }, k.id));
1122
+ }, children: c(w) }, w.id));
1073
1123
  }
1074
- return le("div", { ref: b, onScroll: P, style: {
1124
+ return re("div", { ref: p, onScroll: P, style: {
1075
1125
  width: e,
1076
- height: w,
1077
- overflowY: f > d ? "auto" : "hidden",
1126
+ height: S,
1127
+ overflowY: f > u ? "auto" : "hidden",
1078
1128
  overflowX: "hidden",
1079
1129
  position: "relative",
1080
- borderRight: `1px solid ${s.sidebar.border}`,
1081
- backgroundColor: s.sidebar.bg
1082
- }, children: le("div", { style: { height: f, position: "relative" }, children: W }) });
1130
+ borderRight: `1px solid ${o.sidebar.border}`,
1131
+ backgroundColor: o.sidebar.bg
1132
+ }, children: re("div", { style: { height: f, position: "relative" }, children: W }) });
1083
1133
  }
1084
- function Ui(i) {
1134
+ function an(t) {
1085
1135
  return null;
1086
1136
  }
1087
- Ui.displayName = "TodayMarker";
1088
- function Jt(i) {
1089
- return { date: Math.floor(Date.now() / 6e4) * 6e4, color: i.color ?? "#FD7171", width: i.width ?? 6, label: i.label };
1137
+ an.displayName = "TodayMarker";
1138
+ function oi(t) {
1139
+ return { date: Math.floor(Date.now() / 6e4) * 6e4, color: t.color ?? "#FD7171", width: t.width ?? 6, label: t.label };
1090
1140
  }
1091
- function Vi(i) {
1092
- return i.interval ?? 1e4;
1141
+ function ln(t) {
1142
+ return t.interval ?? 1e4;
1093
1143
  }
1094
- function qi(i) {
1144
+ function un(t) {
1095
1145
  return null;
1096
1146
  }
1097
- qi.displayName = "CustomMarker";
1098
- function Qt(i) {
1147
+ un.displayName = "CustomMarker";
1148
+ function si(t) {
1099
1149
  return {
1100
- date: i.date,
1101
- color: i.color ?? "#3B82F6",
1102
- width: i.width ?? 4,
1103
- label: i.label
1150
+ date: t.date,
1151
+ color: t.color ?? "#3B82F6",
1152
+ width: t.width ?? 4,
1153
+ label: t.label
1104
1154
  };
1105
1155
  }
1106
- We.extend(Zi);
1107
- function Ki(i) {
1108
- return i ? {
1109
- ...He,
1110
- ...i,
1111
- status: { ...He.status, ...i.status },
1112
- grid: { ...He.grid, ...i.grid },
1113
- item: { ...He.item, ...i.item },
1114
- marker: { ...He.marker, ...i.marker },
1115
- sidebar: { ...He.sidebar, ...i.sidebar },
1116
- header: { ...He.header, ...i.header }
1117
- } : He;
1156
+ Me.extend(sn);
1157
+ function cn(t) {
1158
+ return t ? {
1159
+ ...Ee,
1160
+ ...t,
1161
+ status: { ...Ee.status, ...t.status },
1162
+ grid: { ...Ee.grid, ...t.grid },
1163
+ item: { ...Ee.item, ...t.item },
1164
+ marker: { ...Ee.marker, ...t.marker },
1165
+ sidebar: { ...Ee.sidebar, ...t.sidebar },
1166
+ header: { ...Ee.header, ...t.header }
1167
+ } : Ee;
1118
1168
  }
1119
- const ei = 32, fn = me.memo(Hi(function(e, t) {
1120
- const { groups: n, items: o, defaultTimeStart: d, defaultTimeEnd: s, sidebarWidth: c, lineHeight: a, itemHeightRatio: b, stackItems: H, canMove: p, canChangeGroup: f, canResize: w, dragSnap: T, minZoom: h, maxZoom: E, theme: P, dayStyle: W, rowStyle: y, showCursorLine: D, itemRenderer: k, groupRenderer: $, sidebarGroupRenderer: B, dependencies: I, highlights: A, onItemClick: F, onItemDoubleClick: se, onItemContextMenu: K, onItemMove: te, onItemResize: be, moveResizeValidator: Se, onItemHover: Me, onCanvasDoubleClick: Xe, onCanvasContextMenu: qe, onTimeChange: De, onZoom: kt, selected: Ct = [], rightSidebarWidth: ut, rightSidebarGroupRenderer: Et, onReady: Ke, maxHeight: Be, timezone: Je, devBadge: li, children: ke } = e, we = ee(() => Ki(P), [P]), Ht = oe((r, l) => {
1121
- for (let m = 0; m < l.length; m++)
1122
- if (l[m].id === r)
1123
- return m;
1169
+ const ai = 32, kn = ce.memo(Fi(function(e, i) {
1170
+ const { groups: n, items: r, defaultTimeStart: u, defaultTimeEnd: o, sidebarWidth: c, lineHeight: s, itemHeightRatio: p, stackItems: k, canMove: h, canChangeGroup: f, canResize: S, dragSnap: y, minZoom: m, maxZoom: E, theme: P, dayStyle: W, rowStyle: T, showCursorLine: H, itemRenderer: w, groupRenderer: X, sidebarGroupRenderer: B, dependencies: I, highlights: x, onItemClick: F, onItemDoubleClick: ie, onItemContextMenu: U, onItemMove: Q, onItemResize: me, moveResizeValidator: ve, onItemHover: be, onInteractionUpdate: Ye, onCanvasDoubleClick: Je, onCanvasContextMenu: He, onTimeChange: Dt, onZoom: Rt, selected: Ot = [], rightSidebarWidth: ft, rightSidebarGroupRenderer: Pt, onReady: Qe, maxHeight: Be, timezone: et, devBadge: pi, children: we } = e, ye = J(() => cn(P), [P]), Yt = te((a, l) => {
1171
+ for (let g = 0; g < l.length; g++)
1172
+ if (l[g].id === a)
1173
+ return g;
1124
1174
  return 0;
1125
- }, []), ai = Ct.join(","), ct = ee(() => Ct, [ai]), Dt = U(null), It = U(null), Rt = U(null), Le = U(null), Ot = U(null), Pt = U(null), [ui, ci] = Ze(800), [di, fi] = Ze(null);
1126
- ce(() => {
1127
- const r = Ot.current;
1128
- if (!r)
1175
+ }, []), vi = Ot.join(","), ht = J(() => Ot, [vi]), $t = A(null), Xt = A(null), Ft = A(null), ze = A(null), _t = A(null), Wt = A(null), [bi, yi] = Ue(800), [Ti, Si] = Ue(null);
1176
+ ae(() => {
1177
+ const a = _t.current;
1178
+ if (!a)
1129
1179
  return;
1130
- const l = new ResizeObserver((m) => {
1131
- const g = m[0];
1132
- g && ci(g.contentRect.width);
1180
+ const l = new ResizeObserver((g) => {
1181
+ const v = g[0];
1182
+ v && yi(v.contentRect.width);
1133
1183
  });
1134
- return l.observe(r), () => l.disconnect();
1135
- }, []), ce(() => {
1136
- const r = Pt.current;
1137
- if (!r || !Be)
1184
+ return l.observe(a), () => l.disconnect();
1185
+ }, []), ae(() => {
1186
+ const a = Wt.current;
1187
+ if (!a || !Be)
1138
1188
  return;
1139
- const l = new ResizeObserver((m) => {
1140
- const g = m[0];
1141
- g && fi(g.contentRect.height);
1189
+ const l = new ResizeObserver((g) => {
1190
+ const v = g[0];
1191
+ v && Si(v.contentRect.height);
1142
1192
  });
1143
- return l.observe(r), () => l.disconnect();
1193
+ return l.observe(a), () => l.disconnect();
1144
1194
  }, [Be]);
1145
- const Ce = Math.max(0, ui - c - (ut ?? 0)), Ie = ee(() => {
1146
- const r = new Pi();
1147
- return r.rebuild(o), r;
1148
- }, [o]), dt = ee(() => {
1149
- const r = new Ri();
1150
- return r.buildFromItems(o, (l) => Ie.getEffectiveSpan(l.id).start, (l) => Ie.getEffectiveSpan(l.id).end), r;
1151
- }, [o, Ie]), ze = ee(() => {
1152
- const r = new Oi(a, b);
1153
- return r.computeLayout(o, H, Ie), r;
1154
- }, [o, a, b, H, Ie]), Re = ee(() => n.map((r) => ze.getGroupHeight(r.id)), [n, ze]), Qe = ee(() => Re.reduce((r, l) => r + l, 0), [Re]), Xt = typeof Be == "number" ? Be : di, ye = Xt ? Math.min(Qe, Xt) : Qe, L = U(new yt({
1155
- visibleTimeStart: e.visibleTimeStart ?? d,
1156
- visibleTimeEnd: e.visibleTimeEnd ?? s,
1157
- canvasWidth: Ce,
1158
- canvasHeight: ye,
1195
+ const ke = Math.max(0, bi - c - (ft ?? 0)), Ie = J(() => {
1196
+ const a = new Li();
1197
+ return a.rebuild(r), a;
1198
+ }, [r]), mt = J(() => {
1199
+ const a = new Bi();
1200
+ return a.buildFromItems(r, (l) => Ie.getEffectiveSpan(l.id).start, (l) => Ie.getEffectiveSpan(l.id).end), a;
1201
+ }, [r, Ie]), Le = J(() => {
1202
+ const a = new zi(s, p);
1203
+ return a.computeLayout(r, k, Ie), a;
1204
+ }, [r, s, p, k, Ie]), De = J(() => n.map((a) => Le.getGroupHeight(a.id)), [n, Le]), tt = J(() => De.reduce((a, l) => a + l, 0), [De]), Bt = typeof Be == "number" ? Be : Ti, ge = Bt ? Math.min(tt, Bt) : tt, L = A(new wt({
1205
+ visibleTimeStart: e.visibleTimeStart ?? u,
1206
+ visibleTimeEnd: e.visibleTimeEnd ?? o,
1207
+ canvasWidth: ke,
1208
+ canvasHeight: ge,
1159
1209
  sidebarWidth: c,
1160
- lineHeight: a,
1210
+ lineHeight: s,
1161
1211
  groupCount: n.length,
1162
1212
  buffer: e.buffer ?? 3,
1163
1213
  scrollTop: 0,
1164
- groupHeights: Re
1165
- })), ft = U(null), xe = U(void 0), ve = U(null), Oe = U(!1), $t = 4, [Ft, hi] = Ze(e.visibleTimeStart ?? d), [Yt, mi] = Ze(e.visibleTimeEnd ?? s), [_t, et] = Ze(0), Ae = U(null), $e = oe(() => {
1166
- const r = L.current;
1167
- hi(r.visibleTimeStart), mi(r.visibleTimeEnd), et(r.scrollTop), Ae.current = null;
1168
- }, []), ht = oe(() => {
1169
- Ae.current === null && (Ae.current = setTimeout($e, ei));
1214
+ groupHeights: De
1215
+ })), gt = A(null), xe = A(void 0), zt = A({ x: 0, y: 0 }), pt = A(!1), de = A(null), Re = A(!1), Lt = 4, [xt, Mi] = Ue(e.visibleTimeStart ?? u), [At, wi] = Ue(e.visibleTimeEnd ?? o), [Nt, it] = Ue(0), Ae = A(null), $e = te(() => {
1216
+ const a = L.current;
1217
+ Mi(a.visibleTimeStart), wi(a.visibleTimeEnd), it(a.scrollTop), Ae.current = null;
1218
+ }, []), vt = te(() => {
1219
+ Ae.current === null && (Ae.current = setTimeout($e, ai));
1170
1220
  }, [$e]);
1171
- ce(() => () => {
1221
+ ae(() => () => {
1172
1222
  Ae.current !== null && clearTimeout(Ae.current);
1173
1223
  }, []);
1174
- const Wt = ee(() => e.summaryRenderer ? e.summaryRenderer : (r, l, m, g, u) => {
1175
- Xi(r, l, m, g, u, we);
1176
- }, [e.summaryRenderer, we]), Fe = ee(() => new Bi(), []), Ye = ee(() => new Li(), []), _e = ee(() => new zi(), []), ie = ee(() => new Gi(T), [T]), tt = ee(() => {
1177
- const r = [];
1178
- return me.Children.forEach(ke, (l) => {
1179
- var g;
1180
- if (!me.isValidElement(l))
1224
+ const jt = J(() => e.summaryRenderer ? e.summaryRenderer : (a, l, g, v, d) => {
1225
+ xi(a, l, g, v, d, ye);
1226
+ }, [e.summaryRenderer, ye]), Xe = J(() => new qi(), []), Fe = J(() => new Ki(), []), _e = J(() => new Ji(), []), ne = J(() => new nn(y), [y]), nt = J(() => {
1227
+ const a = [];
1228
+ return ce.Children.forEach(we, (l) => {
1229
+ var v;
1230
+ if (!ce.isValidElement(l))
1181
1231
  return;
1182
- const m = (g = l.type) == null ? void 0 : g.displayName;
1183
- m === "TodayMarker" ? r.push(Jt(l.props)) : m === "CustomMarker" && r.push(Qt(l.props));
1184
- }), r;
1185
- }, [ke]), it = ee(() => tt.map((r) => `${r.date}|${r.color}|${r.width}|${r.label ?? ""}`).join(";"), [tt]), je = U(tt);
1186
- je.current = tt;
1187
- const mt = ee(() => {
1188
- let r = 0;
1189
- return me.Children.forEach(ke, (l) => {
1190
- var g;
1191
- if (!me.isValidElement(l))
1232
+ const g = (v = l.type) == null ? void 0 : v.displayName;
1233
+ g === "TodayMarker" ? a.push(oi(l.props)) : g === "CustomMarker" && a.push(si(l.props));
1234
+ }), a;
1235
+ }, [we]), rt = J(() => nt.map((a) => `${a.date}|${a.color}|${a.width}|${a.label ?? ""}`).join(";"), [nt]), Ne = A(nt);
1236
+ Ne.current = nt;
1237
+ const bt = J(() => {
1238
+ let a = 0;
1239
+ return ce.Children.forEach(we, (l) => {
1240
+ var v;
1241
+ if (!ce.isValidElement(l))
1192
1242
  return;
1193
- ((g = l.type) == null ? void 0 : g.displayName) === "TodayMarker" && (r = Vi(l.props));
1194
- }), r;
1195
- }, [ke]), x = U({
1243
+ ((v = l.type) == null ? void 0 : v.displayName) === "TodayMarker" && (a = ln(l.props));
1244
+ }), a;
1245
+ }, [we]), N = A({
1196
1246
  groups: n,
1197
- items: o,
1198
- intervalTree: dt,
1199
- layoutEngine: ze,
1200
- itemRenderer: k,
1201
- groupRenderer: $,
1202
- theme: we,
1203
- selected: ct,
1247
+ items: r,
1248
+ intervalTree: mt,
1249
+ layoutEngine: Le,
1250
+ itemRenderer: w,
1251
+ groupRenderer: X,
1252
+ theme: ye,
1253
+ selected: ht,
1204
1254
  dependencies: I,
1205
- highlights: A,
1255
+ highlights: x,
1206
1256
  dayStyle: W,
1207
- rowStyle: y,
1208
- showCursorLine: D,
1209
- canvasWidth: Ce,
1210
- canvasHeight: ye,
1211
- lineHeight: a,
1212
- itemHeightRatio: b,
1213
- onTimeChange: De,
1214
- onZoom: kt,
1215
- onItemHover: Me,
1257
+ rowStyle: T,
1258
+ showCursorLine: H,
1259
+ canvasWidth: ke,
1260
+ canvasHeight: ge,
1261
+ lineHeight: s,
1262
+ itemHeightRatio: p,
1263
+ onTimeChange: Dt,
1264
+ onZoom: Rt,
1265
+ onItemHover: be,
1216
1266
  onItemClick: F,
1217
- onItemDoubleClick: se,
1218
- onItemContextMenu: K,
1219
- onItemMove: te,
1220
- onItemResize: be,
1221
- onCanvasDoubleClick: Xe,
1222
- onCanvasContextMenu: qe,
1223
- canMove: p,
1224
- canResize: w,
1267
+ onItemDoubleClick: ie,
1268
+ onItemContextMenu: U,
1269
+ onItemMove: Q,
1270
+ onItemResize: me,
1271
+ onInteractionUpdate: Ye,
1272
+ onCanvasDoubleClick: Je,
1273
+ onCanvasContextMenu: He,
1274
+ canMove: h,
1275
+ canResize: S,
1225
1276
  canChangeGroup: f,
1226
- dragSnap: T,
1277
+ dragSnap: y,
1227
1278
  sidebarWidth: c,
1228
- moveResizeValidator: Se,
1229
- summaryRenderer: Wt,
1279
+ moveResizeValidator: ve,
1280
+ summaryRenderer: jt,
1230
1281
  hierarchyEngine: Ie,
1231
- timezone: Je
1282
+ timezone: et
1232
1283
  });
1233
- x.current = {
1284
+ N.current = {
1234
1285
  groups: n,
1235
- items: o,
1236
- intervalTree: dt,
1237
- layoutEngine: ze,
1238
- itemRenderer: k,
1239
- groupRenderer: $,
1240
- theme: we,
1241
- selected: ct,
1286
+ items: r,
1287
+ intervalTree: mt,
1288
+ layoutEngine: Le,
1289
+ itemRenderer: w,
1290
+ groupRenderer: X,
1291
+ theme: ye,
1292
+ selected: ht,
1242
1293
  dependencies: I,
1243
- highlights: A,
1294
+ highlights: x,
1244
1295
  dayStyle: W,
1245
- rowStyle: y,
1246
- showCursorLine: D,
1247
- canvasWidth: Ce,
1248
- canvasHeight: ye,
1249
- lineHeight: a,
1250
- itemHeightRatio: b,
1251
- onTimeChange: De,
1252
- onZoom: kt,
1253
- onItemHover: Me,
1296
+ rowStyle: T,
1297
+ showCursorLine: H,
1298
+ canvasWidth: ke,
1299
+ canvasHeight: ge,
1300
+ lineHeight: s,
1301
+ itemHeightRatio: p,
1302
+ onTimeChange: Dt,
1303
+ onZoom: Rt,
1304
+ onItemHover: be,
1254
1305
  onItemClick: F,
1255
- onItemDoubleClick: se,
1256
- onItemContextMenu: K,
1257
- onItemMove: te,
1258
- onItemResize: be,
1259
- onCanvasDoubleClick: Xe,
1260
- onCanvasContextMenu: qe,
1261
- canMove: p,
1262
- canResize: w,
1306
+ onItemDoubleClick: ie,
1307
+ onItemContextMenu: U,
1308
+ onItemMove: Q,
1309
+ onItemResize: me,
1310
+ onInteractionUpdate: Ye,
1311
+ onCanvasDoubleClick: Je,
1312
+ onCanvasContextMenu: He,
1313
+ canMove: h,
1314
+ canResize: S,
1263
1315
  canChangeGroup: f,
1264
- dragSnap: T,
1316
+ dragSnap: y,
1265
1317
  sidebarWidth: c,
1266
- moveResizeValidator: Se,
1267
- summaryRenderer: Wt,
1318
+ moveResizeValidator: ve,
1319
+ summaryRenderer: jt,
1268
1320
  hierarchyEngine: Ie,
1269
- timezone: Je
1321
+ timezone: et
1270
1322
  };
1271
- const gi = oe(() => {
1272
- const r = Dt.current;
1273
- if (!r)
1323
+ const ki = te(() => {
1324
+ const a = $t.current;
1325
+ if (!a)
1274
1326
  return;
1275
- const l = x.current, m = St(r, l.canvasWidth, l.canvasHeight);
1276
- Mt(m, r), Fe.draw(m, L.current, l.groups, l.theme, l.dayStyle, l.rowStyle, l.highlights, l.timezone);
1277
- }, [Fe]), pi = oe(() => {
1278
- const r = It.current;
1279
- if (!r)
1327
+ const l = N.current, g = Ct(a, l.canvasWidth, l.canvasHeight);
1328
+ Et(g, a), Xe.draw(g, L.current, l.groups, l.theme, l.dayStyle, l.rowStyle, l.highlights, l.timezone);
1329
+ }, [Xe]), Ci = te(() => {
1330
+ const a = Xt.current;
1331
+ if (!a)
1280
1332
  return;
1281
- const l = x.current, m = St(r, l.canvasWidth, l.canvasHeight);
1282
- Mt(m, r), Ye.draw(m, L.current, l.groups, l.items, l.intervalTree, l.layoutEngine, l.itemRenderer, l.groupRenderer, l.theme, l.selected, xe.current, l.dependencies, l.summaryRenderer, l.hierarchyEngine);
1283
- }, [Ye]), Bt = oe((r, l, m) => {
1284
- const g = L.current, u = x.current, v = u.canvasWidth / (g.visibleTimeEnd - g.visibleTimeStart), M = l / v, R = [];
1285
- m === "move" ? (R.push(g.timeToX(r.start_time + M)), R.push(g.timeToX(r.end_time + M))) : m === "resize-left" ? R.push(g.timeToX(r.start_time + M)) : R.push(g.timeToX(r.end_time + M));
1286
- const X = (g.visibleTimeEnd - g.visibleTimeStart) * 0.1, Y = u.intervalTree.query(g.visibleTimeStart - X, g.visibleTimeEnd + X), N = wt(Y, r.id, (J) => g.timeToX(J));
1287
- for (const J of R) {
1288
- const q = st(J, N, 8, v, u.dragSnap);
1289
- if (q !== null)
1290
- return q;
1333
+ const l = N.current, g = Ct(a, l.canvasWidth, l.canvasHeight);
1334
+ Et(g, a), Fe.draw(g, L.current, l.groups, l.items, l.intervalTree, l.layoutEngine, l.itemRenderer, l.groupRenderer, l.theme, l.selected, xe.current, l.dependencies, l.summaryRenderer, l.hierarchyEngine);
1335
+ }, [Fe]), Gt = te((a, l, g) => {
1336
+ const v = L.current, d = N.current, b = d.canvasWidth / (v.visibleTimeEnd - v.visibleTimeStart), C = l / b, D = g === "resize-left" ? "left" : g === "resize-right" ? "right" : void 0, Y = qe(d.dragSnap, a, D), $ = [];
1337
+ g === "move" ? ($.push(v.timeToX(a.start_time + C)), $.push(v.timeToX(a.end_time + C))) : g === "resize-left" ? $.push(v.timeToX(a.start_time + C)) : $.push(v.timeToX(a.end_time + C));
1338
+ const _ = (v.visibleTimeEnd - v.visibleTimeStart) * 0.1, Z = d.intervalTree.query(v.visibleTimeStart - _, v.visibleTimeEnd + _), se = It(Z, a.id, (ee) => v.timeToX(ee));
1339
+ for (const ee of $) {
1340
+ const V = ut(ee, se, 8);
1341
+ if (V !== null)
1342
+ return V;
1291
1343
  }
1292
- const ne = m === "resize-right" ? r.end_time + M : r.start_time + M, z = Math.round(ne / u.dragSnap) * u.dragSnap;
1293
- return g.timeToX(z);
1294
- }, []), vi = oe(() => {
1295
- const r = Rt.current;
1296
- if (!r)
1344
+ const q = g === "resize-right" ? a.end_time + C : a.start_time + C, G = Ke(q, Y, d.timezone);
1345
+ return v.timeToX(G);
1346
+ }, []), Ei = te(() => {
1347
+ const a = Ft.current;
1348
+ if (!a)
1297
1349
  return;
1298
- const l = x.current, m = St(r, l.canvasWidth, l.canvasHeight);
1299
- Mt(m, r);
1300
- const g = L.current, u = ie.getState();
1301
- let v = null;
1302
- if (u) {
1303
- const M = g.timeToX(u.item.start_time), R = g.timeToX(u.item.end_time) - M;
1304
- let X, Y;
1305
- u.mode === "resize-left" ? (X = M + u.deltaX, Y = R - u.deltaX) : u.mode === "resize-right" ? (X = M, Y = R + u.deltaX) : (X = M + u.deltaX, Y = R);
1306
- const N = Ht(u.currentGroup, l.groups), ne = g.groupIndexToY(N), z = u.currentGroup !== u.originalGroup;
1307
- v = {
1308
- item: u.item,
1309
- mode: u.mode,
1310
- bounds: { x: X, y: ne + (l.lineHeight - l.lineHeight * l.itemHeightRatio) / 2, width: Y, height: l.lineHeight * l.itemHeightRatio },
1350
+ const l = N.current, g = Ct(a, l.canvasWidth, l.canvasHeight);
1351
+ Et(g, a);
1352
+ const v = L.current, d = ne.getState();
1353
+ let b = null;
1354
+ if (d) {
1355
+ const C = v.timeToX(d.item.start_time), D = v.timeToX(d.item.end_time) - C;
1356
+ let Y, $;
1357
+ d.mode === "resize-left" ? (Y = C + d.deltaX, $ = D - d.deltaX) : d.mode === "resize-right" ? (Y = C, $ = D + d.deltaX) : (Y = C + d.deltaX, $ = D);
1358
+ const _ = Yt(d.currentGroup, l.groups), Z = v.groupIndexToY(_), se = d.currentGroup !== d.originalGroup;
1359
+ b = {
1360
+ item: d.item,
1361
+ mode: d.mode,
1362
+ bounds: { x: Y, y: Z + (l.lineHeight - l.lineHeight * l.itemHeightRatio) / 2, width: $, height: l.lineHeight * l.itemHeightRatio },
1311
1363
  renderer: l.itemRenderer,
1312
- targetGroupY: ne,
1313
- groupChanged: z
1364
+ targetGroupY: Z,
1365
+ groupChanged: se
1314
1366
  };
1315
1367
  }
1316
- _e.draw(m, g, l.theme, {
1317
- cursorX: l.showCursorLine ? ft.current : null,
1318
- snapX: u ? Bt(u.item, u.deltaX, u.mode) : null,
1319
- markers: je.current,
1320
- interaction: v
1321
- });
1322
- }, [_e, ie, Bt, Ht]), gt = U(null);
1323
- gt.current || (gt.current = new $i((r) => {
1324
- r.grid && gi(), r.items && pi(), r.overlay && vi();
1368
+ _e.draw(g, v, l.theme, {
1369
+ cursorX: l.showCursorLine ? gt.current : null,
1370
+ snapX: d ? Gt(d.item, d.deltaX, d.mode) : null,
1371
+ markers: Ne.current,
1372
+ interaction: b
1373
+ }), l.onInteractionUpdate && (d ? (l.onInteractionUpdate(rn(d, v, l, zt.current)), pt.current = !0) : pt.current && (pt.current = !1, l.onInteractionUpdate(null)));
1374
+ }, [_e, ne, Gt, Yt]), yt = A(null);
1375
+ yt.current || (yt.current = new ji((a) => {
1376
+ a.grid && ki(), a.items && Ci(), a.overlay && Ei();
1325
1377
  }));
1326
- const O = gt.current;
1327
- ce(() => () => O.dispose(), [O]), ce(() => {
1328
- if (!mt)
1378
+ const R = yt.current;
1379
+ ae(() => () => R.dispose(), [R]), ae(() => {
1380
+ if (!bt)
1329
1381
  return;
1330
- const r = setInterval(() => {
1382
+ const a = setInterval(() => {
1331
1383
  const l = [];
1332
- me.Children.forEach(ke, (m) => {
1333
- var u;
1334
- if (!me.isValidElement(m))
1384
+ ce.Children.forEach(we, (g) => {
1385
+ var d;
1386
+ if (!ce.isValidElement(g))
1335
1387
  return;
1336
- const g = (u = m.type) == null ? void 0 : u.displayName;
1337
- g === "TodayMarker" ? l.push(Jt(m.props)) : g === "CustomMarker" && l.push(Qt(m.props));
1338
- }), je.current = l, O.markDirty("overlay");
1339
- }, mt);
1340
- return () => clearInterval(r);
1341
- }, [mt, ke, O]), ce(() => {
1388
+ const v = (d = g.type) == null ? void 0 : d.displayName;
1389
+ v === "TodayMarker" ? l.push(oi(g.props)) : v === "CustomMarker" && l.push(si(g.props));
1390
+ }), Ne.current = l, R.markDirty("overlay");
1391
+ }, bt);
1392
+ return () => clearInterval(a);
1393
+ }, [bt, we, R]), ae(() => {
1342
1394
  L.current.update({
1343
- canvasWidth: Ce,
1344
- canvasHeight: ye,
1395
+ canvasWidth: ke,
1396
+ canvasHeight: ge,
1345
1397
  sidebarWidth: c,
1346
- lineHeight: a,
1398
+ lineHeight: s,
1347
1399
  groupCount: n.length,
1348
- groupHeights: Re
1349
- }), O.markAllDirty();
1350
- }, [Ce, ye, c, a, n.length, Re, O]), ce(() => {
1351
- O.markDirty("grid"), O.markDirty("items");
1352
- }, [o, n, ct, we, W, y, dt, ze, O]);
1353
- const nt = ee(() => {
1354
- var r;
1355
- return ((r = e.highlights) == null ? void 0 : r.map((l) => `${l.start}|${l.end}|${l.color}|${l.label ?? ""}|${l.opacity ?? ""}`).join(";")) ?? "";
1356
- }, [e.highlights]), Lt = U(nt);
1357
- ce(() => {
1358
- nt !== Lt.current && (Lt.current = nt, O.markDirty("grid"));
1359
- }, [nt, O]);
1360
- const zt = U(it);
1361
- ce(() => {
1362
- it !== zt.current && (zt.current = it, O.markDirty("overlay"));
1363
- }, [it, O]);
1364
- const xt = U(e.visibleTimeStart), At = U(e.visibleTimeEnd);
1365
- e.visibleTimeStart !== void 0 && e.visibleTimeStart !== xt.current && (xt.current = e.visibleTimeStart, L.current.update({ visibleTimeStart: e.visibleTimeStart }), O.markAllDirty()), e.visibleTimeEnd !== void 0 && e.visibleTimeEnd !== At.current && (At.current = e.visibleTimeEnd, L.current.update({ visibleTimeEnd: e.visibleTimeEnd }), O.markAllDirty());
1366
- const Ge = U(null), pt = oe((r) => {
1367
- Ge.current === null && (Ge.current = setTimeout(() => {
1368
- var g, u;
1369
- Ge.current = null;
1370
- const l = L.current, m = x.current;
1371
- r === "zoom" ? (g = m.onZoom) == null || g.call(m, l.visibleTimeStart, l.visibleTimeEnd) : (u = m.onTimeChange) == null || u.call(m, l.visibleTimeStart, l.visibleTimeEnd);
1372
- }, ei));
1400
+ groupHeights: De
1401
+ }), R.markAllDirty();
1402
+ }, [ke, ge, c, s, n.length, De, R]), ae(() => {
1403
+ R.markDirty("grid"), R.markDirty("items");
1404
+ }, [r, n, ht, ye, W, T, mt, Le, R]);
1405
+ const ot = J(() => {
1406
+ var a;
1407
+ return ((a = e.highlights) == null ? void 0 : a.map((l) => `${l.start}|${l.end}|${l.color}|${l.label ?? ""}|${l.opacity ?? ""}`).join(";")) ?? "";
1408
+ }, [e.highlights]), Ut = A(ot);
1409
+ ae(() => {
1410
+ ot !== Ut.current && (Ut.current = ot, R.markDirty("grid"));
1411
+ }, [ot, R]);
1412
+ const Zt = A(rt);
1413
+ ae(() => {
1414
+ rt !== Zt.current && (Zt.current = rt, R.markDirty("overlay"));
1415
+ }, [rt, R]);
1416
+ const Vt = A(e.visibleTimeStart), qt = A(e.visibleTimeEnd);
1417
+ e.visibleTimeStart !== void 0 && e.visibleTimeStart !== Vt.current && (Vt.current = e.visibleTimeStart, L.current.update({ visibleTimeStart: e.visibleTimeStart }), R.markAllDirty()), e.visibleTimeEnd !== void 0 && e.visibleTimeEnd !== qt.current && (qt.current = e.visibleTimeEnd, L.current.update({ visibleTimeEnd: e.visibleTimeEnd }), R.markAllDirty());
1418
+ const je = A(null), Tt = te((a) => {
1419
+ je.current === null && (je.current = setTimeout(() => {
1420
+ var v, d;
1421
+ je.current = null;
1422
+ const l = L.current, g = N.current;
1423
+ a === "zoom" ? (v = g.onZoom) == null || v.call(g, l.visibleTimeStart, l.visibleTimeEnd) : (d = g.onTimeChange) == null || d.call(g, l.visibleTimeStart, l.visibleTimeEnd);
1424
+ }, ai));
1373
1425
  }, []);
1374
- ce(() => () => {
1375
- Ge.current !== null && clearTimeout(Ge.current);
1426
+ ae(() => () => {
1427
+ je.current !== null && clearTimeout(je.current);
1376
1428
  }, []);
1377
- const rt = U(null), vt = ee(() => new Ai((r, l) => {
1378
- var m;
1379
- L.current.update({ visibleTimeStart: r, visibleTimeEnd: l }), (m = rt.current) == null || m.updateBounds(r, l), O.markAllDirty(), ht(), pt("zoom");
1380
- }, d, s, h, E), []);
1381
- rt.current = vt;
1382
- const ot = oe((r) => {
1383
- const l = L.current, m = l.getTotalHeight(), g = Math.max(0, m - l.canvasHeight), u = Math.max(0, Math.min(g, l.scrollTop + r));
1384
- u !== l.scrollTop && (l.update({ scrollTop: u }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(u));
1385
- }, [O]), Ne = oe((r) => {
1386
- var M, R, X;
1387
- const l = L.current, m = l.canvasWidth / (l.visibleTimeEnd - l.visibleTimeStart), g = r / m, u = l.visibleTimeStart + g, v = l.visibleTimeEnd + g;
1388
- l.update({ visibleTimeStart: u, visibleTimeEnd: v }), (M = rt.current) == null || M.updateBounds(u, v), O.markAllDirty(), Ii(() => $e()), (X = (R = x.current).onTimeChange) == null || X.call(R, u, v);
1389
- }, [O, $e]);
1390
- ce(() => {
1391
- const r = Le.current;
1392
- if (!r)
1429
+ const st = A(null), St = J(() => new en((a, l) => {
1430
+ var g;
1431
+ L.current.update({ visibleTimeStart: a, visibleTimeEnd: l }), (g = st.current) == null || g.updateBounds(a, l), R.markAllDirty(), vt(), Tt("zoom");
1432
+ }, u, o, m, E), []);
1433
+ st.current = St;
1434
+ const at = te((a) => {
1435
+ const l = L.current, g = l.getTotalHeight(), v = Math.max(0, g - l.canvasHeight), d = Math.max(0, Math.min(v, l.scrollTop + a));
1436
+ d !== l.scrollTop && (l.update({ scrollTop: d }), R.markDirty("grid"), R.markDirty("items"), R.markDirty("overlay"), it(d));
1437
+ }, [R]), Ge = te((a) => {
1438
+ var C, D, Y;
1439
+ const l = L.current, g = l.canvasWidth / (l.visibleTimeEnd - l.visibleTimeStart), v = a / g, d = l.visibleTimeStart + v, b = l.visibleTimeEnd + v;
1440
+ l.update({ visibleTimeStart: d, visibleTimeEnd: b }), (C = st.current) == null || C.updateBounds(d, b), R.markAllDirty(), Wi(() => $e()), (Y = (D = N.current).onTimeChange) == null || Y.call(D, d, b);
1441
+ }, [R, $e]);
1442
+ ae(() => {
1443
+ const a = ze.current;
1444
+ if (!a)
1393
1445
  return;
1394
- const l = (m) => {
1395
- if (m.ctrlKey || m.metaKey || m.altKey) {
1396
- m.preventDefault();
1397
- const g = r.getBoundingClientRect(), u = (m.clientX - g.left) / g.width;
1398
- vt.handleWheelZoom(m, u);
1399
- } else if (m.shiftKey)
1400
- m.preventDefault(), Ne(m.deltaY || m.deltaX);
1446
+ const l = (g) => {
1447
+ if (g.ctrlKey || g.metaKey || g.altKey) {
1448
+ g.preventDefault();
1449
+ const v = a.getBoundingClientRect(), d = (g.clientX - v.left) / v.width;
1450
+ St.handleWheelZoom(g, d);
1451
+ } else if (g.shiftKey)
1452
+ g.preventDefault(), Ge(g.deltaY || g.deltaX);
1401
1453
  else {
1402
- const g = m.deltaX;
1403
- g !== 0 && Math.abs(g) > Math.abs(m.deltaY) ? (m.preventDefault(), Ne(g)) : m.deltaY !== 0 && (Qe > ye && m.preventDefault(), ot(m.deltaY));
1454
+ const v = g.deltaX;
1455
+ v !== 0 && Math.abs(v) > Math.abs(g.deltaY) ? (g.preventDefault(), Ge(v)) : g.deltaY !== 0 && (tt > ge && g.preventDefault(), at(g.deltaY));
1404
1456
  }
1405
1457
  };
1406
- return r.addEventListener("wheel", l, { passive: !1 }), () => r.removeEventListener("wheel", l);
1407
- }, [vt, ot, Ne, Qe, ye]);
1408
- const Ee = U({ lastDistance: null, lastCenter: null });
1409
- ce(() => {
1410
- const r = Le.current;
1411
- if (!r)
1458
+ return a.addEventListener("wheel", l, { passive: !1 }), () => a.removeEventListener("wheel", l);
1459
+ }, [St, at, Ge, tt, ge]);
1460
+ const Ce = A({ lastDistance: null, lastCenter: null });
1461
+ ae(() => {
1462
+ const a = ze.current;
1463
+ if (!a)
1412
1464
  return;
1413
- const l = (M, R) => Math.abs(M.clientX - R.clientX), m = (M, R, X) => (M.clientX + R.clientX) / 2 - X.left, g = (M) => {
1414
- M.touches.length === 2 && (M.preventDefault(), Ee.current.lastDistance = l(M.touches[0], M.touches[1]), Ee.current.lastCenter = null);
1415
- }, u = (M) => {
1416
- var R;
1417
- if (M.touches.length === 2 && Ee.current.lastDistance !== null) {
1418
- M.preventDefault();
1419
- const X = l(M.touches[0], M.touches[1]), Y = r.getBoundingClientRect(), ne = m(M.touches[0], M.touches[1], Y) / Y.width;
1420
- if (X !== 0 && Ee.current.lastDistance !== 0) {
1421
- const z = Ee.current.lastDistance / X, J = L.current, q = J.visibleTimeEnd - J.visibleTimeStart;
1422
- let de = q * z;
1423
- de = Math.max(h, Math.min(E, de));
1424
- const Z = J.visibleTimeStart + q * ne, C = Z - de * ne, S = Z + de * (1 - ne);
1425
- J.update({ visibleTimeStart: C, visibleTimeEnd: S }), (R = rt.current) == null || R.updateBounds(C, S), O.markAllDirty(), ht(), pt("zoom");
1465
+ const l = (C, D) => Math.abs(C.clientX - D.clientX), g = (C, D, Y) => (C.clientX + D.clientX) / 2 - Y.left, v = (C) => {
1466
+ C.touches.length === 2 && (C.preventDefault(), Ce.current.lastDistance = l(C.touches[0], C.touches[1]), Ce.current.lastCenter = null);
1467
+ }, d = (C) => {
1468
+ var D;
1469
+ if (C.touches.length === 2 && Ce.current.lastDistance !== null) {
1470
+ C.preventDefault();
1471
+ const Y = l(C.touches[0], C.touches[1]), $ = a.getBoundingClientRect(), Z = g(C.touches[0], C.touches[1], $) / $.width;
1472
+ if (Y !== 0 && Ce.current.lastDistance !== 0) {
1473
+ const se = Ce.current.lastDistance / Y, q = L.current, G = q.visibleTimeEnd - q.visibleTimeStart;
1474
+ let ee = G * se;
1475
+ ee = Math.max(m, Math.min(E, ee));
1476
+ const V = q.visibleTimeStart + G * Z, O = V - ee * Z, M = V + ee * (1 - Z);
1477
+ q.update({ visibleTimeStart: O, visibleTimeEnd: M }), (D = st.current) == null || D.updateBounds(O, M), R.markAllDirty(), vt(), Tt("zoom");
1426
1478
  }
1427
- Ee.current.lastDistance = X;
1479
+ Ce.current.lastDistance = Y;
1428
1480
  }
1429
- }, v = () => {
1430
- Ee.current.lastDistance = null, Ee.current.lastCenter = null;
1481
+ }, b = () => {
1482
+ Ce.current.lastDistance = null, Ce.current.lastCenter = null;
1431
1483
  };
1432
- return r.addEventListener("touchstart", g, { passive: !1 }), r.addEventListener("touchmove", u, { passive: !1 }), r.addEventListener("touchend", v), () => {
1433
- r.removeEventListener("touchstart", g), r.removeEventListener("touchmove", u), r.removeEventListener("touchend", v);
1484
+ return a.addEventListener("touchstart", v, { passive: !1 }), a.addEventListener("touchmove", d, { passive: !1 }), a.addEventListener("touchend", b), () => {
1485
+ a.removeEventListener("touchstart", v), a.removeEventListener("touchmove", d), a.removeEventListener("touchend", b);
1434
1486
  };
1435
- }, [O, ht, pt]);
1436
- const bi = oe((r) => {
1437
- var X;
1438
- const l = r.currentTarget, m = l.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top;
1439
- if (ft.current = g, ve.current) {
1440
- const Y = r.clientX - ve.current.startX, N = r.clientY - ve.current.startY;
1441
- if (!Oe.current && (Math.abs(Y) >= $t || Math.abs(N) >= $t) && (Oe.current = !0, l.style.cursor = "grabbing", l.setPointerCapture(r.pointerId)), Oe.current) {
1442
- const ne = r.clientX - ve.current.lastX, z = r.clientY - ve.current.lastY;
1443
- ve.current.lastX = r.clientX, ve.current.lastY = r.clientY, Math.abs(ne) > 0 && Ne(-ne), Math.abs(z) > 0 && ot(-z);
1487
+ }, [R, vt, Tt]);
1488
+ const Hi = te((a) => {
1489
+ var Y;
1490
+ const l = a.currentTarget, g = l.getBoundingClientRect(), v = a.clientX - g.left, d = a.clientY - g.top;
1491
+ if (gt.current = v, zt.current = { x: a.clientX, y: a.clientY }, de.current) {
1492
+ const $ = a.clientX - de.current.startX, _ = a.clientY - de.current.startY;
1493
+ if (!Re.current && (Math.abs($) >= Lt || Math.abs(_) >= Lt) && (Re.current = !0, l.style.cursor = "grabbing", l.setPointerCapture(a.pointerId)), Re.current) {
1494
+ const Z = a.clientX - de.current.lastX, se = a.clientY - de.current.lastY;
1495
+ de.current.lastX = a.clientX, de.current.lastY = a.clientY, Math.abs(Z) > 0 && Ge(-Z), Math.abs(se) > 0 && at(-se);
1444
1496
  }
1445
1497
  return;
1446
1498
  }
1447
- if (ie.isPending()) {
1448
- if (ie.update(g, u), ie.isActive()) {
1449
- const Y = ie.getState();
1450
- if (Y && Y.mode === "move" && x.current.canChangeGroup) {
1451
- const N = Tt(u, L.current, x.current.groups);
1452
- N && ie.setCurrentGroup(N.id);
1499
+ if (ne.isPending()) {
1500
+ if (ne.update(v, d), ne.isActive()) {
1501
+ const $ = ne.getState();
1502
+ if ($ && $.mode === "move" && N.current.canChangeGroup) {
1503
+ const _ = kt(d, L.current, N.current.groups);
1504
+ _ && ne.setCurrentGroup(_.id);
1453
1505
  }
1454
- O.markDirty("overlay");
1506
+ R.markDirty("overlay");
1455
1507
  }
1456
1508
  return;
1457
1509
  }
1458
- x.current.showCursorLine && O.markDirty("overlay");
1459
- const v = x.current, M = Ue(g, u, L.current, v.intervalTree, v.layoutEngine, v.groups), R = M == null ? void 0 : M.id;
1460
- if (R !== xe.current && (xe.current = R, O.markDirty("items"), (X = v.onItemHover) == null || X.call(v, R ?? null, r.nativeEvent)), M) {
1461
- const Y = Gt(g, M, L.current), N = Nt(M, v.canResize);
1462
- Y === "left" && (N === "left" || N === "both") || Y === "right" && (N === "right" || N === "both") ? l.style.cursor = "col-resize" : Zt(M, v.canMove) ? l.style.cursor = "grab" : l.style.cursor = "default";
1510
+ N.current.showCursorLine && R.markDirty("overlay");
1511
+ const b = N.current, C = Ze(v, d, L.current, b.intervalTree, b.layoutEngine, b.groups), D = C == null ? void 0 : C.id;
1512
+ if (D !== xe.current && (xe.current = D, R.markDirty("items"), (Y = b.onItemHover) == null || Y.call(b, D ?? null, a.nativeEvent)), C) {
1513
+ const $ = Jt(v, C, L.current), _ = Qt(C, $, b.canResize, b.canMove);
1514
+ l.style.cursor = _ === "resize-left" || _ === "resize-right" ? "col-resize" : _ === "move" ? "grab" : "default";
1463
1515
  } else
1464
1516
  l.style.cursor = "default";
1465
- }, [ie, O, Ne, ot]), yi = oe((r) => {
1466
- const l = x.current, m = r.currentTarget.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top, v = Ue(g, u, L.current, l.intervalTree, l.layoutEngine, l.groups);
1467
- if (!v) {
1468
- ve.current = { startX: r.clientX, startY: r.clientY, lastX: r.clientX, lastY: r.clientY }, Oe.current = !1;
1517
+ }, [ne, R, Ge, at]), Ii = te((a) => {
1518
+ const l = N.current, g = a.currentTarget.getBoundingClientRect(), v = a.clientX - g.left, d = a.clientY - g.top, b = Ze(v, d, L.current, l.intervalTree, l.layoutEngine, l.groups);
1519
+ if (!b) {
1520
+ de.current = { startX: a.clientX, startY: a.clientY, lastX: a.clientX, lastY: a.clientY }, Re.current = !1;
1469
1521
  return;
1470
1522
  }
1471
- const M = Gt(g, v, L.current), R = Nt(v, l.canResize);
1472
- M === "left" && (R === "left" || R === "both") ? ie.startInteraction(v, "resize-left", g, u) : M === "right" && (R === "right" || R === "both") ? ie.startInteraction(v, "resize-right", g, u) : Zt(v, l.canMove) && ie.startInteraction(v, "move", g, u);
1473
- }, [ie]), Ti = oe((r) => {
1474
- var M, R, X, Y, N, ne;
1475
- const l = r.currentTarget;
1476
- if (ve.current) {
1477
- const z = Oe.current;
1478
- if (ve.current = null, Oe.current = !1, l.style.cursor = "default", z)
1523
+ const C = Jt(v, b, L.current), D = Qt(b, C, l.canResize, l.canMove);
1524
+ D && ne.startInteraction(b, D, v, d);
1525
+ }, [ne]), Di = te((a) => {
1526
+ var C, D, Y, $;
1527
+ const l = a.currentTarget;
1528
+ if (de.current) {
1529
+ const _ = Re.current;
1530
+ if (de.current = null, Re.current = !1, l.style.cursor = "default", _)
1479
1531
  return;
1480
1532
  }
1481
- if (ie.isActive()) {
1482
- const z = ie.getState(), J = L.current, q = J.canvasWidth / (J.visibleTimeEnd - J.visibleTimeStart);
1483
- if (z) {
1484
- const de = x.current.moveResizeValidator;
1485
- if (z.mode === "move") {
1486
- const Z = ie.endMove(q);
1487
- if (Z) {
1488
- const C = L.current, S = x.current, ge = z.deltaX / q, j = C.timeToX(z.item.start_time + ge), he = C.timeToX(z.item.end_time + ge), ue = (C.visibleTimeEnd - C.visibleTimeStart) * 0.1, _ = S.intervalTree.query(C.visibleTimeStart - ue, C.visibleTimeEnd + ue), re = wt(_, z.item.id, (fe) => C.timeToX(fe));
1489
- let V = Z.newStartTime;
1490
- const G = st(j, re, 8, q, S.dragSnap);
1491
- if (G !== null)
1492
- V = C.xToTime(G);
1493
- else {
1494
- const fe = st(he, re, 8, q, S.dragSnap);
1495
- if (fe !== null) {
1496
- const pe = z.item.end_time - z.item.start_time;
1497
- V = C.xToTime(fe) - pe;
1498
- }
1499
- }
1500
- const Q = de ? de("move", z.item.id, V) : V, ae = x.current.hierarchyEngine.getMoveDelta(z.item.id, Q);
1501
- (R = (M = x.current).onItemMove) == null || R.call(M, z.item.id, Q, Z.newGroupId, ae.length > 0 ? ae : void 0);
1533
+ if (ne.isActive()) {
1534
+ const _ = ne.getState(), Z = L.current, se = Z.canvasWidth / (Z.visibleTimeEnd - Z.visibleTimeStart);
1535
+ if (_) {
1536
+ const q = N.current.moveResizeValidator, G = N.current;
1537
+ if (_.mode === "move") {
1538
+ const ee = fi(_, Z, G), V = ne.endMove(se);
1539
+ if (V) {
1540
+ const O = q ? q("move", _.item.id, ee) : ee, M = G.hierarchyEngine.getMoveDelta(_.item.id, O);
1541
+ (C = G.onItemMove) == null || C.call(G, _.item.id, O, V.newGroupId, M.length > 0 ? M : void 0);
1502
1542
  }
1503
1543
  } else {
1504
- const Z = ie.endResize(q);
1505
- if (Z) {
1506
- const C = L.current, S = x.current, ge = z.deltaX / q, j = Z.edge === "left" ? z.item.start_time + ge : z.item.end_time + ge, he = C.timeToX(j), ue = (C.visibleTimeEnd - C.visibleTimeStart) * 0.1, _ = S.intervalTree.query(C.visibleTimeStart - ue, C.visibleTimeEnd + ue), re = wt(_, z.item.id, (fe) => C.timeToX(fe)), V = st(he, re, 8, q, S.dragSnap);
1507
- let G = V !== null ? C.xToTime(V) : Z.newTime;
1508
- const Q = x.current.hierarchyEngine.getResizeConstraint(z.item.id, Z.edge);
1509
- Z.edge === "left" && G > Q.max ? G = Q.max : Z.edge === "right" && G < Q.min && (G = Q.min);
1510
- const ae = de ? de("resize", z.item.id, G, Z.edge) : G;
1511
- (Y = (X = x.current).onItemResize) == null || Y.call(X, z.item.id, ae, Z.edge);
1544
+ const { edge: ee, time: V } = hi(_, Z, G);
1545
+ if (ne.endResize(se)) {
1546
+ const M = q ? q("resize", _.item.id, V, ee) : V;
1547
+ (D = G.onItemResize) == null || D.call(G, _.item.id, M, ee);
1512
1548
  }
1513
1549
  }
1514
1550
  }
1515
- l.style.cursor = "default", O.markDirty("overlay");
1551
+ l.style.cursor = "default", R.markDirty("overlay");
1516
1552
  return;
1517
1553
  }
1518
- ie.isPending() && ie.cancel();
1519
- const m = l.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top, v = Ue(g, u, L.current, x.current.intervalTree, x.current.layoutEngine, x.current.groups);
1520
- v && ((ne = (N = x.current).onItemClick) == null || ne.call(N, v.id, r.nativeEvent));
1521
- }, [ie, O]), Si = oe((r) => {
1522
- var M, R;
1523
- const l = r.currentTarget.getBoundingClientRect(), m = r.clientX - l.left, g = r.clientY - l.top, u = x.current, v = Ue(m, g, L.current, u.intervalTree, u.layoutEngine, u.groups);
1524
- if (v)
1525
- (M = u.onItemDoubleClick) == null || M.call(u, v.id, r.nativeEvent);
1554
+ ne.isPending() && ne.cancel();
1555
+ const g = l.getBoundingClientRect(), v = a.clientX - g.left, d = a.clientY - g.top, b = Ze(v, d, L.current, N.current.intervalTree, N.current.layoutEngine, N.current.groups);
1556
+ b && (($ = (Y = N.current).onItemClick) == null || $.call(Y, b.id, a.nativeEvent));
1557
+ }, [ne, R]), Ri = te((a) => {
1558
+ var C, D;
1559
+ const l = a.currentTarget.getBoundingClientRect(), g = a.clientX - l.left, v = a.clientY - l.top, d = N.current, b = Ze(g, v, L.current, d.intervalTree, d.layoutEngine, d.groups);
1560
+ if (b)
1561
+ (C = d.onItemDoubleClick) == null || C.call(d, b.id, a.nativeEvent);
1526
1562
  else {
1527
- const X = Tt(g, L.current, u.groups), Y = L.current.xToTime(m);
1528
- X && ((R = u.onCanvasDoubleClick) == null || R.call(u, X.id, Y));
1563
+ const Y = kt(v, L.current, d.groups), $ = L.current.xToTime(g);
1564
+ Y && ((D = d.onCanvasDoubleClick) == null || D.call(d, Y.id, $));
1529
1565
  }
1530
- }, []), Mi = oe((r) => {
1531
- var M, R;
1532
- r.preventDefault();
1533
- const l = r.currentTarget.getBoundingClientRect(), m = r.clientX - l.left, g = r.clientY - l.top, u = x.current, v = Ue(m, g, L.current, u.intervalTree, u.layoutEngine, u.groups);
1534
- if (v)
1535
- (M = u.onItemContextMenu) == null || M.call(u, v.id, r.nativeEvent);
1566
+ }, []), Oi = te((a) => {
1567
+ var C, D;
1568
+ a.preventDefault();
1569
+ const l = a.currentTarget.getBoundingClientRect(), g = a.clientX - l.left, v = a.clientY - l.top, d = N.current, b = Ze(g, v, L.current, d.intervalTree, d.layoutEngine, d.groups);
1570
+ if (b)
1571
+ (C = d.onItemContextMenu) == null || C.call(d, b.id, a.nativeEvent);
1536
1572
  else {
1537
- const X = Tt(g, L.current, u.groups), Y = L.current.xToTime(m);
1538
- X && ((R = u.onCanvasContextMenu) == null || R.call(u, X.id, Y, r.nativeEvent));
1573
+ const Y = kt(v, L.current, d.groups), $ = L.current.xToTime(g);
1574
+ Y && ((D = d.onCanvasContextMenu) == null || D.call(d, Y.id, $, a.nativeEvent));
1539
1575
  }
1540
- }, []), wi = oe(() => {
1541
- var r, l;
1542
- ve.current = null, Oe.current = !1, ft.current = null, Le.current && (Le.current.style.cursor = "default"), xe.current !== void 0 && (xe.current = void 0, O.markDirty("items"), (l = (r = x.current).onItemHover) == null || l.call(r, null, new PointerEvent("pointerleave"))), x.current.showCursorLine && O.markDirty("overlay");
1543
- }, [O]), ki = ee(() => {
1544
- const r = [];
1545
- return me.Children.forEach(ke, (l) => {
1546
- var g;
1547
- if (!me.isValidElement(l))
1576
+ }, []), Pi = te(() => {
1577
+ var a, l;
1578
+ de.current = null, Re.current = !1, gt.current = null, ze.current && (ze.current.style.cursor = "default"), xe.current !== void 0 && (xe.current = void 0, R.markDirty("items"), (l = (a = N.current).onItemHover) == null || l.call(a, null, new PointerEvent("pointerleave"))), N.current.showCursorLine && R.markDirty("overlay");
1579
+ }, [R]), Yi = J(() => {
1580
+ const a = [];
1581
+ return ce.Children.forEach(we, (l) => {
1582
+ var v;
1583
+ if (!ce.isValidElement(l))
1548
1584
  return;
1549
- if (((g = l.type) == null ? void 0 : g.displayName) === "TimelineHeaders") {
1550
- const u = l.props;
1551
- r.push(me.cloneElement(l, {
1552
- visibleTimeStart: u.visibleTimeStart ?? Ft,
1553
- visibleTimeEnd: u.visibleTimeEnd ?? Yt,
1554
- canvasWidth: u.canvasWidth ?? Ce,
1555
- sidebarWidth: u.sidebarWidth ?? c,
1556
- theme: u.theme ?? we,
1557
- timezone: u.timezone ?? Je,
1558
- onZoomToInterval: u.onZoomToInterval ?? ((v, M) => {
1559
- var R, X, Y, N;
1560
- L.current.update({ visibleTimeStart: v, visibleTimeEnd: M }), O.markAllDirty(), $e(), (X = (R = x.current).onTimeChange) == null || X.call(R, v, M), (N = (Y = x.current).onZoom) == null || N.call(Y, v, M);
1585
+ if (((v = l.type) == null ? void 0 : v.displayName) === "TimelineHeaders") {
1586
+ const d = l.props;
1587
+ a.push(ce.cloneElement(l, {
1588
+ visibleTimeStart: d.visibleTimeStart ?? xt,
1589
+ visibleTimeEnd: d.visibleTimeEnd ?? At,
1590
+ canvasWidth: d.canvasWidth ?? ke,
1591
+ sidebarWidth: d.sidebarWidth ?? c,
1592
+ theme: d.theme ?? ye,
1593
+ timezone: d.timezone ?? et,
1594
+ onZoomToInterval: d.onZoomToInterval ?? ((b, C) => {
1595
+ var D, Y, $, _;
1596
+ L.current.update({ visibleTimeStart: b, visibleTimeEnd: C }), R.markAllDirty(), $e(), (Y = (D = N.current).onTimeChange) == null || Y.call(D, b, C), (_ = ($ = N.current).onZoom) == null || _.call($, b, C);
1561
1597
  })
1562
1598
  }));
1563
1599
  }
1564
- }), r;
1565
- }, [ke, Ft, Yt, Ce, c, we, Je, O, $e]), jt = U(!1);
1566
- ce(() => {
1567
- jt.current || (jt.current = !0, O.markAllDirty());
1568
- }, [O]), Di(t, () => ({
1569
- captureToCanvas({ timeStart: r, timeEnd: l, scale: m, sidebarWidth: g }) {
1570
- const u = x.current, v = 28, M = v * 3, R = u.groups.map((j) => u.layoutEngine.getGroupHeight(j.id)), X = [0];
1571
- for (let j = 0; j < R.length; j++)
1572
- X.push(X[j] + R[j]);
1573
- const Y = X[R.length], N = L.current, ne = u.canvasWidth / (N.visibleTimeEnd - N.visibleTimeStart), z = l - r, J = Math.max(u.canvasWidth, Math.round(z * ne)), q = (g + J) * m, de = (M + Y) * m, Z = document.createElement("canvas");
1574
- Z.width = q, Z.height = de;
1575
- const C = Z.getContext("2d");
1576
- C.scale(m, m);
1577
- for (let j = 0; j < u.groups.length; j++) {
1578
- const he = u.groups[j], ue = R[j], _ = M + X[j];
1579
- if (u.rowStyle) {
1580
- const Q = u.rowStyle(he);
1581
- Q != null && Q.backgroundColor && (C.fillStyle = Q.backgroundColor, C.fillRect(0, _, g, ue));
1600
+ }), a;
1601
+ }, [we, xt, At, ke, c, ye, et, R, $e]), Kt = A(!1);
1602
+ ae(() => {
1603
+ Kt.current || (Kt.current = !0, R.markAllDirty());
1604
+ }, [R]), _i(i, () => ({
1605
+ captureToCanvas({ timeStart: a, timeEnd: l, scale: g, sidebarWidth: v }) {
1606
+ const d = N.current, b = 28, C = b * 3, D = d.groups.map((j) => d.layoutEngine.getGroupHeight(j.id)), Y = [0];
1607
+ for (let j = 0; j < D.length; j++)
1608
+ Y.push(Y[j] + D[j]);
1609
+ const $ = Y[D.length], _ = L.current, Z = d.canvasWidth / (_.visibleTimeEnd - _.visibleTimeStart), se = l - a, q = Math.max(d.canvasWidth, Math.round(se * Z)), G = (v + q) * g, ee = (C + $) * g, V = document.createElement("canvas");
1610
+ V.width = G, V.height = ee;
1611
+ const O = V.getContext("2d");
1612
+ O.scale(g, g);
1613
+ for (let j = 0; j < d.groups.length; j++) {
1614
+ const Te = d.groups[j], Se = D[j], z = C + Y[j];
1615
+ if (d.rowStyle) {
1616
+ const ue = d.rowStyle(Te);
1617
+ ue != null && ue.backgroundColor && (O.fillStyle = ue.backgroundColor, O.fillRect(0, z, v, Se));
1582
1618
  }
1583
- const re = he.type;
1584
- let V = "400", G = 8;
1585
- re === "project" ? V = "700" : re === "CAG" ? V = "600" : re === "CA" && (V = "400", G = 24), C.fillStyle = "#111", C.font = `${V} 12px sans-serif`, C.textBaseline = "middle", C.fillText(he.title, G, _ + ue / 2, g - G - 4);
1619
+ const le = Te.type;
1620
+ let oe = "400", K = 8;
1621
+ le === "project" ? oe = "700" : le === "CAG" ? oe = "600" : le === "CA" && (oe = "400", K = 24), O.fillStyle = "#111", O.font = `${oe} 12px sans-serif`, O.textBaseline = "middle", O.fillText(Te.title, K, z + Se / 2, v - K - 4);
1586
1622
  }
1587
- const S = (j, he, ue) => {
1588
- var V, G;
1589
- C.fillStyle = ((V = u.theme.header) == null ? void 0 : V.bg) ?? "#f5f5f5", C.fillRect(g, j, J, v), C.strokeStyle = ((G = u.theme.grid) == null ? void 0 : G.line) ?? "#e0e0e0", C.lineWidth = 1, C.strokeRect(g, j, J, v);
1590
- let _ = Te(r, u.timezone).startOf(ue);
1591
- _.valueOf() < r && (_ = _.add(1, ue));
1592
- const re = J / (l - r);
1593
- for (; _.valueOf() < l; ) {
1594
- const Q = _.add(1, ue), ae = g + (_.valueOf() - r) * re, pe = g + (Math.min(Q.valueOf(), l) - r) * re - ae;
1595
- C.beginPath(), C.moveTo(ae, j), C.lineTo(ae, j + v), C.stroke(), C.fillStyle = "#333", C.font = "600 11px sans-serif", C.textBaseline = "middle", C.textAlign = "center", C.fillText(he(_), ae + pe / 2, j + v / 2, pe - 4), _ = Q;
1623
+ const M = (j, Te, Se) => {
1624
+ var oe, K;
1625
+ O.fillStyle = ((oe = d.theme.header) == null ? void 0 : oe.bg) ?? "#f5f5f5", O.fillRect(v, j, q, b), O.strokeStyle = ((K = d.theme.grid) == null ? void 0 : K.line) ?? "#e0e0e0", O.lineWidth = 1, O.strokeRect(v, j, q, b);
1626
+ let z = he(a, d.timezone).startOf(Se);
1627
+ z.valueOf() < a && (z = z.add(1, Se));
1628
+ const le = q / (l - a);
1629
+ for (; z.valueOf() < l; ) {
1630
+ const ue = z.add(1, Se), fe = v + (z.valueOf() - a) * le, pe = v + (Math.min(ue.valueOf(), l) - a) * le - fe;
1631
+ O.beginPath(), O.moveTo(fe, j), O.lineTo(fe, j + b), O.stroke(), O.fillStyle = "#333", O.font = "600 11px sans-serif", O.textBaseline = "middle", O.textAlign = "center", O.fillText(Te(z), fe + pe / 2, j + b / 2, pe - 4), z = ue;
1596
1632
  }
1597
- C.textAlign = "start";
1633
+ O.textAlign = "start";
1598
1634
  };
1599
- S(0, (j) => j.format("YYYY"), "year"), S(v, (j) => j.format("MM"), "month"), S(v * 2, (j) => String(j.isoWeek()), "week");
1600
- const ge = new yt({
1601
- visibleTimeStart: r,
1635
+ M(0, (j) => j.format("YYYY"), "year"), M(b, (j) => j.format("MM"), "month"), M(b * 2, (j) => String(j.isoWeek()), "week");
1636
+ const We = new wt({
1637
+ visibleTimeStart: a,
1602
1638
  visibleTimeEnd: l,
1603
- canvasWidth: J,
1604
- canvasHeight: Y,
1639
+ canvasWidth: q,
1640
+ canvasHeight: $,
1605
1641
  sidebarWidth: 0,
1606
- lineHeight: u.lineHeight,
1607
- groupCount: u.groups.length,
1642
+ lineHeight: d.lineHeight,
1643
+ groupCount: d.groups.length,
1608
1644
  buffer: 1,
1609
1645
  scrollTop: 0,
1610
- groupHeights: R
1646
+ groupHeights: D
1611
1647
  });
1612
- return C.save(), C.translate(g, M), C.beginPath(), C.rect(0, 0, J, Y), C.clip(), Fe.draw(C, ge, u.groups, u.theme, u.dayStyle, u.rowStyle, u.highlights, u.timezone), Ye.draw(C, ge, u.groups, u.items, u.intervalTree, u.layoutEngine, u.itemRenderer, u.groupRenderer, u.theme, u.selected, void 0, u.dependencies, u.summaryRenderer, u.hierarchyEngine), _e.draw(C, ge, u.theme, {
1648
+ return O.save(), O.translate(v, C), O.beginPath(), O.rect(0, 0, q, $), O.clip(), Xe.draw(O, We, d.groups, d.theme, d.dayStyle, d.rowStyle, d.highlights, d.timezone), Fe.draw(O, We, d.groups, d.items, d.intervalTree, d.layoutEngine, d.itemRenderer, d.groupRenderer, d.theme, d.selected, void 0, d.dependencies, d.summaryRenderer, d.hierarchyEngine), _e.draw(O, We, d.theme, {
1613
1649
  cursorX: null,
1614
1650
  snapX: null,
1615
- markers: je.current,
1651
+ markers: Ne.current,
1616
1652
  interaction: null
1617
- }), C.restore(), Z;
1653
+ }), O.restore(), V;
1618
1654
  }
1619
- }), [Fe, Ye, _e]), ce(() => {
1620
- const r = {
1621
- captureToCanvas({ timeStart: l, timeEnd: m, scale: g, sidebarWidth: u }) {
1622
- var ue;
1623
- const v = x.current, M = 28, R = M * 3, X = v.groups.map((_) => v.layoutEngine.getGroupHeight(_.id)), Y = [0];
1624
- for (let _ = 0; _ < X.length; _++)
1625
- Y.push(Y[_] + X[_]);
1626
- const N = Y[X.length], ne = L.current, z = v.canvasWidth / (ne.visibleTimeEnd - ne.visibleTimeStart), J = m - l, q = Math.max(v.canvasWidth, Math.round(J * z)), de = u + q, Z = R + N, C = document.createElement("canvas");
1627
- C.width = de * g, C.height = Z * g;
1628
- const S = C.getContext("2d");
1629
- S.scale(g, g), S.fillStyle = "#FFFFFF", S.fillRect(0, 0, de, Z), S.save(), S.beginPath(), S.rect(0, 0, u, Z), S.clip(), S.fillStyle = "#F9FAFB", S.fillRect(0, 0, u, R), S.strokeStyle = "#E5E7EB", S.lineWidth = 1, S.strokeRect(0, 0, u, R);
1630
- for (let _ = 0; _ < v.groups.length; _++) {
1631
- const re = v.groups[_], V = X[_], G = R + Y[_], Q = (ue = v.rowStyle) == null ? void 0 : ue.call(v, re);
1632
- S.fillStyle = (Q == null ? void 0 : Q.backgroundColor) ?? (_ % 2 === 0 ? "#FFFFFF" : "#F7F7F7"), S.fillRect(0, G, u, V), S.strokeStyle = "#E5E5E5", S.lineWidth = 0.5, S.beginPath(), S.moveTo(0, G + V), S.lineTo(u, G + V), S.stroke();
1633
- const ae = re.type ?? "";
1634
- let fe = 8, pe = "400", Pe = 11;
1635
- ae === "project" ? (pe = "700", Pe = 12) : ae === "control_area_group" ? pe = "600" : ae === "control_area" && (fe = 24), S.fillStyle = "#374151", S.font = `${pe} ${Pe}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, S.textBaseline = "middle";
1636
- const Ei = typeof re.title == "string" ? re.title : String(re.title);
1637
- S.fillText(Ei, fe, G + V / 2, u - fe - 8);
1655
+ }), [Xe, Fe, _e]), ae(() => {
1656
+ const a = {
1657
+ captureToCanvas({ timeStart: l, timeEnd: g, scale: v, sidebarWidth: d }) {
1658
+ var Se;
1659
+ const b = N.current, C = 28, D = C * 3, Y = b.groups.map((z) => b.layoutEngine.getGroupHeight(z.id)), $ = [0];
1660
+ for (let z = 0; z < Y.length; z++)
1661
+ $.push($[z] + Y[z]);
1662
+ const _ = $[Y.length], Z = L.current, se = b.canvasWidth / (Z.visibleTimeEnd - Z.visibleTimeStart), q = g - l, G = Math.max(b.canvasWidth, Math.round(q * se)), ee = d + G, V = D + _, O = document.createElement("canvas");
1663
+ O.width = ee * v, O.height = V * v;
1664
+ const M = O.getContext("2d");
1665
+ M.scale(v, v), M.fillStyle = "#FFFFFF", M.fillRect(0, 0, ee, V), M.save(), M.beginPath(), M.rect(0, 0, d, V), M.clip(), M.fillStyle = "#F9FAFB", M.fillRect(0, 0, d, D), M.strokeStyle = "#E5E7EB", M.lineWidth = 1, M.strokeRect(0, 0, d, D);
1666
+ for (let z = 0; z < b.groups.length; z++) {
1667
+ const le = b.groups[z], oe = Y[z], K = D + $[z], ue = (Se = b.rowStyle) == null ? void 0 : Se.call(b, le);
1668
+ M.fillStyle = (ue == null ? void 0 : ue.backgroundColor) ?? (z % 2 === 0 ? "#FFFFFF" : "#F7F7F7"), M.fillRect(0, K, d, oe), M.strokeStyle = "#E5E5E5", M.lineWidth = 0.5, M.beginPath(), M.moveTo(0, K + oe), M.lineTo(d, K + oe), M.stroke();
1669
+ const fe = le.type ?? "";
1670
+ let Oe = 8, pe = "400", Pe = 11;
1671
+ fe === "project" ? (pe = "700", Pe = 12) : fe === "control_area_group" ? pe = "600" : fe === "control_area" && (Oe = 24), M.fillStyle = "#374151", M.font = `${pe} ${Pe}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, M.textBaseline = "middle";
1672
+ const Xi = typeof le.title == "string" ? le.title : String(le.title);
1673
+ M.fillText(Xi, Oe, K + oe / 2, d - Oe - 8);
1638
1674
  }
1639
- S.strokeStyle = "#E5E7EB", S.lineWidth = 1, S.beginPath(), S.moveTo(u, 0), S.lineTo(u, Z), S.stroke(), S.restore(), S.save(), S.beginPath(), S.rect(u, 0, q, R), S.clip();
1640
- const ge = m - l, j = [
1675
+ M.strokeStyle = "#E5E7EB", M.lineWidth = 1, M.beginPath(), M.moveTo(d, 0), M.lineTo(d, V), M.stroke(), M.restore(), M.save(), M.beginPath(), M.rect(d, 0, G, D), M.clip();
1676
+ const We = g - l, j = [
1641
1677
  { unit: "year", row: 0 },
1642
1678
  { unit: "month", row: 1 },
1643
1679
  { unit: "week", row: 2 }
1644
1680
  ];
1645
- for (const { unit: _, row: re } of j) {
1646
- const V = re * M;
1647
- S.fillStyle = "#F9FAFB", S.fillRect(u, V, q, M);
1648
- let G = Te(l, v.timezone).startOf(_);
1649
- const Q = Te(m, v.timezone).add(1, _);
1650
- for (; G.isBefore(Q); ) {
1651
- const ae = G.add(1, _), fe = u + (G.valueOf() - l) / ge * q, pe = (ae.valueOf() - G.valueOf()) / ge * q;
1652
- S.strokeStyle = "#E5E7EB", S.lineWidth = 0.5, S.strokeRect(fe, V, pe, M);
1681
+ for (const { unit: z, row: le } of j) {
1682
+ const oe = le * C;
1683
+ M.fillStyle = "#F9FAFB", M.fillRect(d, oe, G, C);
1684
+ let K = he(l, b.timezone).startOf(z);
1685
+ const ue = he(g, b.timezone).add(1, z);
1686
+ for (; K.isBefore(ue); ) {
1687
+ const fe = K.add(1, z), Oe = d + (K.valueOf() - l) / We * G, pe = (fe.valueOf() - K.valueOf()) / We * G;
1688
+ M.strokeStyle = "#E5E7EB", M.lineWidth = 0.5, M.strokeRect(Oe, oe, pe, C);
1653
1689
  let Pe;
1654
- _ === "year" ? Pe = G.format("YYYY") : _ === "month" ? Pe = G.format("MM") : Pe = `${G.week()}`, S.fillStyle = "#6c737f", S.font = _ === "year" ? '600 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' : '400 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', S.textBaseline = "middle", S.textAlign = "center", pe > 20 && S.fillText(Pe, fe + pe / 2, V + M / 2), G = ae;
1690
+ z === "year" ? Pe = K.format("YYYY") : z === "month" ? Pe = K.format("MM") : Pe = `${K.week()}`, M.fillStyle = "#6c737f", M.font = z === "year" ? '600 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' : '400 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', M.textBaseline = "middle", M.textAlign = "center", pe > 20 && M.fillText(Pe, Oe + pe / 2, oe + C / 2), K = fe;
1655
1691
  }
1656
1692
  }
1657
- S.textAlign = "start", S.restore(), S.save(), S.beginPath(), S.rect(u, R, q, N), S.clip(), S.translate(u, R);
1658
- const he = new yt({
1693
+ M.textAlign = "start", M.restore(), M.save(), M.beginPath(), M.rect(d, D, G, _), M.clip(), M.translate(d, D);
1694
+ const Te = new wt({
1659
1695
  visibleTimeStart: l,
1660
- visibleTimeEnd: m,
1661
- canvasWidth: q,
1662
- canvasHeight: N,
1696
+ visibleTimeEnd: g,
1697
+ canvasWidth: G,
1698
+ canvasHeight: _,
1663
1699
  sidebarWidth: 0,
1664
- lineHeight: v.lineHeight,
1665
- groupCount: v.groups.length,
1700
+ lineHeight: b.lineHeight,
1701
+ groupCount: b.groups.length,
1666
1702
  buffer: 1,
1667
1703
  scrollTop: 0,
1668
- groupHeights: X
1704
+ groupHeights: Y
1669
1705
  });
1670
- return Fe.draw(S, he, v.groups, v.theme, v.dayStyle, v.rowStyle, v.highlights, v.timezone), Ye.draw(S, he, v.groups, v.items, v.intervalTree, v.layoutEngine, v.itemRenderer, v.groupRenderer, v.theme, v.selected, void 0, v.dependencies, v.summaryRenderer, v.hierarchyEngine), _e.draw(S, he, v.theme, { cursorX: null, markers: je.current }), S.restore(), C;
1706
+ return Xe.draw(M, Te, b.groups, b.theme, b.dayStyle, b.rowStyle, b.highlights, b.timezone), Fe.draw(M, Te, b.groups, b.items, b.intervalTree, b.layoutEngine, b.itemRenderer, b.groupRenderer, b.theme, b.selected, void 0, b.dependencies, b.summaryRenderer, b.hierarchyEngine), _e.draw(M, Te, b.theme, { cursorX: null, markers: Ne.current }), M.restore(), O;
1671
1707
  }
1672
1708
  };
1673
- Ke == null || Ke(r);
1674
- }, [Ke, Fe, Ye, _e]);
1675
- const Ci = {
1709
+ Qe == null || Qe(a);
1710
+ }, [Qe, Xe, Fe, _e]);
1711
+ const $i = {
1676
1712
  position: "relative",
1677
- width: Ce,
1678
- height: ye,
1713
+ width: ke,
1714
+ height: ge,
1679
1715
  overflow: "hidden",
1680
1716
  cursor: "default"
1681
- }, bt = { position: "absolute", top: 0, left: 0 };
1682
- return Ve("div", { ref: Ot, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [li ? Ve("div", { style: {
1717
+ }, Mt = { position: "absolute", top: 0, left: 0 };
1718
+ return Ve("div", { ref: _t, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [pi ? Ve("div", { style: {
1683
1719
  position: "absolute",
1684
1720
  top: 0,
1685
1721
  left: 0,
@@ -1693,31 +1729,31 @@ const ei = 32, fn = me.memo(Hi(function(e, t) {
1693
1729
  borderBottomRightRadius: 4,
1694
1730
  pointerEvents: "none",
1695
1731
  userSelect: "none"
1696
- }, children: ["v", "0.8.0", " · ", "08:36:05"] }) : null, ki, Ve("div", { ref: Pt, style: { display: "flex", overflow: "hidden", maxHeight: Be ?? void 0 }, children: [le(Kt, { groups: n, width: c, lineHeight: a, groupHeights: Re, scrollTop: _t, canvasHeight: ye, theme: we, groupRenderer: B, onScroll: (r) => {
1697
- L.current.update({ scrollTop: r }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(r);
1698
- } }), Ve("div", { ref: Le, style: Ci, onPointerMove: bi, onPointerDown: yi, onPointerUp: Ti, onDoubleClick: Si, onContextMenu: Mi, onPointerLeave: wi, children: [le("canvas", { ref: Dt, style: { ...bt, zIndex: 0 } }), le("canvas", { ref: It, style: { ...bt, zIndex: 1 } }), le("canvas", { ref: Rt, style: { ...bt, zIndex: 2 } })] }), ut && Et ? le(Kt, { groups: n, width: ut, lineHeight: a, groupHeights: Re, scrollTop: _t, canvasHeight: ye, theme: we, groupRenderer: Et, onScroll: (r) => {
1699
- L.current.update({ scrollTop: r }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(r);
1732
+ }, children: ["v", "0.10.0", " · ", "13:15:17"] }) : null, Yi, Ve("div", { ref: Wt, style: { display: "flex", overflow: "hidden", maxHeight: Be ?? void 0 }, children: [re(ri, { groups: n, width: c, lineHeight: s, groupHeights: De, scrollTop: Nt, canvasHeight: ge, theme: ye, groupRenderer: B, onScroll: (a) => {
1733
+ L.current.update({ scrollTop: a }), R.markDirty("grid"), R.markDirty("items"), R.markDirty("overlay"), it(a);
1734
+ } }), Ve("div", { ref: ze, style: $i, onPointerMove: Hi, onPointerDown: Ii, onPointerUp: Di, onDoubleClick: Ri, onContextMenu: Oi, onPointerLeave: Pi, children: [re("canvas", { ref: $t, style: { ...Mt, zIndex: 0 } }), re("canvas", { ref: Xt, style: { ...Mt, zIndex: 1 } }), re("canvas", { ref: Ft, style: { ...Mt, zIndex: 2 } })] }), ft && Pt ? re(ri, { groups: n, width: ft, lineHeight: s, groupHeights: De, scrollTop: Nt, canvasHeight: ge, theme: ye, groupRenderer: Pt, onScroll: (a) => {
1735
+ L.current.update({ scrollTop: a }), R.markDirty("grid"), R.markDirty("items"), R.markDirty("overlay"), it(a);
1700
1736
  } }) : null] })] });
1701
1737
  }));
1702
- function Ji({ children: i, theme: e, className: t, classNames: n, style: o, visibleTimeStart: d, visibleTimeEnd: s, canvasWidth: c, sidebarWidth: a = 0, onZoomToInterval: b, timezone: H }) {
1703
- const p = me.Children.map(i, (f) => {
1704
- var T;
1705
- if (!me.isValidElement(f))
1738
+ function dn({ children: t, theme: e, className: i, classNames: n, style: r, visibleTimeStart: u, visibleTimeEnd: o, canvasWidth: c, sidebarWidth: s = 0, onZoomToInterval: p, timezone: k }) {
1739
+ const h = ce.Children.map(t, (f) => {
1740
+ var y;
1741
+ if (!ce.isValidElement(f))
1706
1742
  return f;
1707
- if (((T = f.type) == null ? void 0 : T.displayName) === "DateHeader") {
1708
- const h = f.props, E = me.cloneElement(f, {
1709
- visibleTimeStart: h.visibleTimeStart ?? d,
1710
- visibleTimeEnd: h.visibleTimeEnd ?? s,
1711
- canvasWidth: h.canvasWidth ?? c,
1712
- theme: h.theme ?? e,
1713
- onZoomToInterval: h.onIntervalClick ?? h.onZoomToInterval ?? b,
1714
- timezone: h.timezone ?? H
1743
+ if (((y = f.type) == null ? void 0 : y.displayName) === "DateHeader") {
1744
+ const m = f.props, E = ce.cloneElement(f, {
1745
+ visibleTimeStart: m.visibleTimeStart ?? u,
1746
+ visibleTimeEnd: m.visibleTimeEnd ?? o,
1747
+ canvasWidth: m.canvasWidth ?? c,
1748
+ theme: m.theme ?? e,
1749
+ onZoomToInterval: m.onIntervalClick ?? m.onZoomToInterval ?? p,
1750
+ timezone: m.timezone ?? k
1715
1751
  });
1716
- return Ve("div", { style: { display: "flex" }, children: [le("div", { style: { width: a, flexShrink: 0 } }), le("div", { style: { flex: 1, overflow: "hidden" }, children: E })] });
1752
+ return Ve("div", { style: { display: "flex" }, children: [re("div", { style: { width: s, flexShrink: 0 } }), re("div", { style: { flex: 1, overflow: "hidden" }, children: E })] });
1717
1753
  }
1718
1754
  return f;
1719
1755
  });
1720
- return le("div", { className: t, style: {
1756
+ return re("div", { className: i, style: {
1721
1757
  position: "sticky",
1722
1758
  top: 0,
1723
1759
  zIndex: 20,
@@ -1726,121 +1762,121 @@ function Ji({ children: i, theme: e, className: t, classNames: n, style: o, visi
1726
1762
  backgroundColor: (e == null ? void 0 : e.header.bg) ?? "#F9FAFB",
1727
1763
  borderTop: `1px solid ${(e == null ? void 0 : e.header.border) ?? "#E5E7EB"}`,
1728
1764
  borderBottom: `1px solid ${(e == null ? void 0 : e.header.border) ?? "#E5E7EB"}`,
1729
- ...o
1730
- }, children: p });
1765
+ ...r
1766
+ }, children: h });
1731
1767
  }
1732
- Ji.displayName = "TimelineHeaders";
1733
- var si = { exports: {} };
1734
- (function(i, e) {
1735
- (function(t, n) {
1736
- i.exports = n();
1737
- })(lt, function() {
1738
- var t = "week", n = "year";
1739
- return function(o, d, s) {
1740
- var c = d.prototype;
1741
- c.week = function(a) {
1742
- if (a === void 0 && (a = null), a !== null) return this.add(7 * (a - this.week()), "day");
1743
- var b = this.$locale().yearStart || 1;
1768
+ dn.displayName = "TimelineHeaders";
1769
+ var gi = { exports: {} };
1770
+ (function(t, e) {
1771
+ (function(i, n) {
1772
+ t.exports = n();
1773
+ })(ct, function() {
1774
+ var i = "week", n = "year";
1775
+ return function(r, u, o) {
1776
+ var c = u.prototype;
1777
+ c.week = function(s) {
1778
+ if (s === void 0 && (s = null), s !== null) return this.add(7 * (s - this.week()), "day");
1779
+ var p = this.$locale().yearStart || 1;
1744
1780
  if (this.month() === 11 && this.date() > 25) {
1745
- var H = s(this).startOf(n).add(1, n).date(b), p = s(this).endOf(t);
1746
- if (H.isBefore(p)) return 1;
1781
+ var k = o(this).startOf(n).add(1, n).date(p), h = o(this).endOf(i);
1782
+ if (k.isBefore(h)) return 1;
1747
1783
  }
1748
- var f = s(this).startOf(n).date(b).startOf(t).subtract(1, "millisecond"), w = this.diff(f, t, !0);
1749
- return w < 0 ? s(this).startOf("week").week() : Math.ceil(w);
1750
- }, c.weeks = function(a) {
1751
- return a === void 0 && (a = null), this.week(a);
1784
+ var f = o(this).startOf(n).date(p).startOf(i).subtract(1, "millisecond"), S = this.diff(f, i, !0);
1785
+ return S < 0 ? o(this).startOf("week").week() : Math.ceil(S);
1786
+ }, c.weeks = function(s) {
1787
+ return s === void 0 && (s = null), this.week(s);
1752
1788
  };
1753
1789
  };
1754
1790
  });
1755
- })(si);
1756
- var Qi = si.exports;
1757
- const en = /* @__PURE__ */ at(Qi);
1758
- We.extend(en);
1759
- const tn = {
1791
+ })(gi);
1792
+ var fn = gi.exports;
1793
+ const hn = /* @__PURE__ */ dt(fn);
1794
+ Me.extend(hn);
1795
+ const mn = {
1760
1796
  year: 30,
1761
1797
  month: 30,
1762
1798
  week: 20,
1763
1799
  day: 15,
1764
1800
  hour: 30
1765
1801
  };
1766
- function nn({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWidth: n = 0, theme: o, height: d = 28, className: s, labelFormat: c, onIntervalClick: a, minCellWidth: b, onZoomToInterval: H, timezone: p }) {
1767
- const f = ee(() => {
1768
- if (!e || !t || !n)
1802
+ function gn({ unit: t, visibleTimeStart: e = 0, visibleTimeEnd: i = 0, canvasWidth: n = 0, theme: r, height: u = 28, className: o, labelFormat: c, onIntervalClick: s, minCellWidth: p, onZoomToInterval: k, timezone: h }) {
1803
+ const f = J(() => {
1804
+ if (!e || !i || !n)
1769
1805
  return [];
1770
- const T = t - e, h = b ?? tn[i];
1771
- if (h > 0) {
1772
- const y = Te(e, p).startOf(i);
1773
- if ((y.add(1, i).valueOf() - y.valueOf()) / T * n < h)
1806
+ const y = i - e, m = p ?? mn[t];
1807
+ if (m > 0) {
1808
+ const T = he(e, h).startOf(t);
1809
+ if ((T.add(1, t).valueOf() - T.valueOf()) / y * n < m)
1774
1810
  return [];
1775
1811
  }
1776
1812
  const E = [];
1777
- let P = Te(e, p).startOf(i).subtract(1, i);
1778
- const W = Te(t, p).add(2, i).valueOf();
1813
+ let P = he(e, h).startOf(t).subtract(1, t);
1814
+ const W = he(i, h).add(2, t).valueOf();
1779
1815
  for (; P.valueOf() < W; ) {
1780
- const y = P.add(1, i), D = P.valueOf(), k = y.valueOf(), $ = (D - e) / T * n, B = (k - D) / T * n, I = rn(P, y, i, c);
1781
- E.push({ start: D, end: k, label: I, left: $, width: B }), P = y;
1816
+ const T = P.add(1, t), H = P.valueOf(), w = T.valueOf(), X = (H - e) / y * n, B = (w - H) / y * n, I = pn(P, T, t, c);
1817
+ E.push({ start: H, end: w, label: I, left: X, width: B }), P = T;
1782
1818
  }
1783
1819
  return E;
1784
- }, [e, t, n, i, c, b, p]), w = oe((T, h) => {
1785
- a ? a(T, h) : H && H(T, h);
1786
- }, [a, H]);
1787
- return f.length === 0 ? null : le("div", { style: { display: "flex", position: "relative", height: d, overflow: "hidden" }, children: f.map((T) => le("div", { className: s, onClick: () => w(T.start, T.end), style: {
1820
+ }, [e, i, n, t, c, p, h]), S = te((y, m) => {
1821
+ s ? s(y, m) : k && k(y, m);
1822
+ }, [s, k]);
1823
+ return f.length === 0 ? null : re("div", { style: { display: "flex", position: "relative", height: u, overflow: "hidden" }, children: f.map((y) => re("div", { className: o, onClick: () => S(y.start, y.end), style: {
1788
1824
  position: "absolute",
1789
- left: T.left,
1790
- width: T.width,
1825
+ left: y.left,
1826
+ width: y.width,
1791
1827
  height: "100%",
1792
1828
  display: "flex",
1793
1829
  alignItems: "center",
1794
1830
  justifyContent: "center",
1795
- borderRight: `1px solid ${(o == null ? void 0 : o.header.border) ?? "#E5E7EB"}`,
1796
- borderBottom: `1px solid ${(o == null ? void 0 : o.header.border) ?? "#E5E7EB"}`,
1831
+ borderRight: `1px solid ${(r == null ? void 0 : r.header.border) ?? "#E5E7EB"}`,
1832
+ borderBottom: `1px solid ${(r == null ? void 0 : r.header.border) ?? "#E5E7EB"}`,
1797
1833
  fontSize: 12,
1798
- color: (o == null ? void 0 : o.header.text) ?? "#6c737f",
1799
- backgroundColor: (o == null ? void 0 : o.header.bg) ?? "#F9FAFB",
1834
+ color: (r == null ? void 0 : r.header.text) ?? "#6c737f",
1835
+ backgroundColor: (r == null ? void 0 : r.header.bg) ?? "#F9FAFB",
1800
1836
  overflow: "hidden",
1801
1837
  whiteSpace: "nowrap",
1802
1838
  cursor: "pointer",
1803
1839
  userSelect: "none",
1804
1840
  padding: "0 4px",
1805
1841
  boxSizing: "border-box"
1806
- }, children: le("span", { children: T.label }) }, T.start)) });
1842
+ }, children: re("span", { children: y.label }) }, y.start)) });
1807
1843
  }
1808
- nn.displayName = "DateHeader";
1809
- function rn(i, e, t, n, o) {
1810
- return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) : on(i, t);
1844
+ gn.displayName = "DateHeader";
1845
+ function pn(t, e, i, n, r) {
1846
+ return typeof n == "function" ? n(t.toDate(), e.toDate(), i) : typeof n == "string" ? t.format(n) : vn(t, i);
1811
1847
  }
1812
- function on(i, e) {
1848
+ function vn(t, e) {
1813
1849
  switch (e) {
1814
1850
  case "year":
1815
- return i.format("YYYY");
1851
+ return t.format("YYYY");
1816
1852
  case "month":
1817
- return i.format("MM");
1853
+ return t.format("MM");
1818
1854
  case "week":
1819
- return `${i.week()}`;
1855
+ return `${t.week()}`;
1820
1856
  case "day":
1821
- return i.format("D");
1857
+ return t.format("D");
1822
1858
  case "hour":
1823
- return i.format("HH:mm");
1859
+ return t.format("HH:mm");
1824
1860
  }
1825
1861
  }
1826
- function sn({ width: i, children: e, style: t }) {
1827
- const n = () => ({ style: { width: i, ...t } });
1828
- return e ? le(ti, { children: e({ getRootProps: n }) }) : le("div", { style: { width: i } });
1862
+ function bn({ width: t, children: e, style: i }) {
1863
+ const n = () => ({ style: { width: t, ...i } });
1864
+ return e ? re(li, { children: e({ getRootProps: n }) }) : re("div", { style: { width: t } });
1829
1865
  }
1830
- sn.displayName = "SidebarHeader";
1831
- function ln({ children: i }) {
1832
- return le(ti, { children: i });
1866
+ bn.displayName = "SidebarHeader";
1867
+ function yn({ children: t }) {
1868
+ return re(li, { children: t });
1833
1869
  }
1834
- ln.displayName = "CustomHeader";
1870
+ yn.displayName = "CustomHeader";
1835
1871
  export {
1836
- fn as CanvasTimeline,
1837
- ln as CustomHeader,
1838
- qi as CustomMarker,
1839
- He as DEFAULT_THEME,
1840
- nn as DateHeader,
1841
- Pi as HierarchyEngine,
1842
- sn as SidebarHeader,
1843
- Ji as TimelineHeaders,
1844
- Ui as TodayMarker
1872
+ kn as CanvasTimeline,
1873
+ yn as CustomHeader,
1874
+ un as CustomMarker,
1875
+ Ee as DEFAULT_THEME,
1876
+ gn as DateHeader,
1877
+ Li as HierarchyEngine,
1878
+ bn as SidebarHeader,
1879
+ dn as TimelineHeaders,
1880
+ an as TodayMarker
1845
1881
  };
1846
1882
  //# sourceMappingURL=canvas-timeline.es.js.map