@taskctrl/canvas-timeline 0.8.1 → 0.10.1

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