@kteneyck/cesium-timeline-react 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- import ct, { useMemo as Ne, useRef as x, useState as Ae, useEffect as z, forwardRef as st, useCallback as ae, useImperativeHandle as it, useLayoutEffect as ut } from "react";
2
- import * as D from "cesium";
3
- import { DEFAULT_LABELS as lt, splitForDisplay as at, getTimezoneAbbr as dt, formatDateTime as We, resolveLabel as Be, drawTimeline as ft, hitTestSwimLane as pt, hitTestLaneLabel as mt, isInSwimLaneRegion as ht, TICK_AREA_HEIGHT as Oe, zoomRange as gt, DEFAULT_LANE_HEIGHT as $e, LANE_GAP as He, SWIM_LANE_SCROLL_SPEED as xt, MIN_SPAN_MS as vt, MAX_SPAN_MS as bt, zoomAroundMs as Tt, toJulianDate as De, defaultTheme as wt, generateTicks as Mt, timeToPosition as yt, snapToTick as Et } from "@kteneyck/cesium-timeline-core";
1
+ import lt, { useMemo as We, useRef as x, useState as Se, useEffect as I, forwardRef as dt, useCallback as he, useImperativeHandle as ft, useLayoutEffect as ht } from "react";
2
+ import * as A from "cesium";
3
+ import { DEFAULT_LABELS as pt, splitForDisplay as mt, getTimezoneAbbr as gt, formatDateTime as Ue, resolveLabel as qe, drawTimeline as xt, hitTestSwimLane as vt, hitTestLaneLabel as bt, isInSwimLaneRegion as wt, TICK_AREA_HEIGHT as Ye, zoomRange as Tt, DEFAULT_LANE_HEIGHT as Ge, LANE_GAP as Ve, SWIM_LANE_SCROLL_SPEED as Mt, MIN_SPAN_MS as yt, MAX_SPAN_MS as Et, zoomAroundMs as Rt, toJulianDate as _e, defaultTheme as Dt, generateTicks as At, timeToPosition as Ct, snapToTick as _t } from "@kteneyck/cesium-timeline-core";
4
4
  export * from "@kteneyck/cesium-timeline-core";
5
- import { TICK_AREA_HEIGHT as Ot } from "@kteneyck/cesium-timeline-core";
6
- var Xe = { exports: {} }, Se = {};
5
+ import { TICK_AREA_HEIGHT as Wt } from "@kteneyck/cesium-timeline-core";
6
+ var ze = { exports: {} }, Fe = {};
7
7
  /**
8
8
  * @license React
9
9
  * react-jsx-runtime.production.js
@@ -13,29 +13,29 @@ var Xe = { exports: {} }, Se = {};
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
15
  */
16
- var Ue;
17
- function Rt() {
18
- if (Ue) return Se;
19
- Ue = 1;
20
- var F = Symbol.for("react.transitional.element"), X = Symbol.for("react.fragment");
21
- function K(d, _, S) {
22
- var W = null;
23
- if (S !== void 0 && (W = "" + S), _.key !== void 0 && (W = "" + _.key), "key" in _) {
24
- S = {};
25
- for (var $ in _)
26
- $ !== "key" && (S[$] = _[$]);
27
- } else S = _;
28
- return _ = S.ref, {
29
- $$typeof: F,
30
- type: d,
31
- key: W,
32
- ref: _ !== void 0 ? _ : null,
33
- props: S
16
+ var Ze;
17
+ function St() {
18
+ if (Ze) return Fe;
19
+ Ze = 1;
20
+ var j = Symbol.for("react.transitional.element"), X = Symbol.for("react.fragment");
21
+ function H(h, C, _) {
22
+ var O = null;
23
+ if (_ !== void 0 && (O = "" + _), C.key !== void 0 && (O = "" + C.key), "key" in C) {
24
+ _ = {};
25
+ for (var J in C)
26
+ J !== "key" && (_[J] = C[J]);
27
+ } else _ = C;
28
+ return C = _.ref, {
29
+ $$typeof: j,
30
+ type: h,
31
+ key: O,
32
+ ref: C !== void 0 ? C : null,
33
+ props: _
34
34
  };
35
35
  }
36
- return Se.Fragment = X, Se.jsx = K, Se.jsxs = K, Se;
36
+ return Fe.Fragment = X, Fe.jsx = H, Fe.jsxs = H, Fe;
37
37
  }
38
- var Le = {};
38
+ var Ie = {};
39
39
  /**
40
40
  * @license React
41
41
  * react-jsx-runtime.development.js
@@ -45,282 +45,289 @@ var Le = {};
45
45
  * This source code is licensed under the MIT license found in the
46
46
  * LICENSE file in the root directory of this source tree.
47
47
  */
48
- var qe;
49
- function Dt() {
50
- return qe || (qe = 1, process.env.NODE_ENV !== "production" && (function() {
51
- function F(t) {
52
- if (t == null) return null;
53
- if (typeof t == "function")
54
- return t.$$typeof === p ? null : t.displayName || t.name || null;
55
- if (typeof t == "string") return t;
56
- switch (t) {
57
- case te:
48
+ var Ke;
49
+ function jt() {
50
+ return Ke || (Ke = 1, process.env.NODE_ENV !== "production" && (function() {
51
+ function j(e) {
52
+ if (e == null) return null;
53
+ if (typeof e == "function")
54
+ return e.$$typeof === Te ? null : e.displayName || e.name || null;
55
+ if (typeof e == "string") return e;
56
+ switch (e) {
57
+ case V:
58
58
  return "Fragment";
59
- case w:
59
+ case y:
60
60
  return "Profiler";
61
- case ue:
61
+ case de:
62
62
  return "StrictMode";
63
- case B:
63
+ case Z:
64
64
  return "Suspense";
65
- case oe:
65
+ case D:
66
66
  return "SuspenseList";
67
- case A:
67
+ case me:
68
68
  return "Activity";
69
69
  }
70
- if (typeof t == "object")
71
- switch (typeof t.tag == "number" && console.error(
70
+ if (typeof e == "object")
71
+ switch (typeof e.tag == "number" && console.error(
72
72
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
73
- ), t.$$typeof) {
74
- case ie:
73
+ ), e.$$typeof) {
74
+ case le:
75
75
  return "Portal";
76
- case Q:
77
- return t.displayName || "Context";
78
- case v:
79
- return (t._context.displayName || "Context") + ".Consumer";
80
- case M:
81
- var f = t.render;
82
- return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
83
- case ge:
84
- return f = t.displayName || null, f !== null ? f : F(t.type) || "Memo";
85
- case ce:
86
- f = t._payload, t = t._init;
76
+ case q:
77
+ return e.displayName || "Context";
78
+ case T:
79
+ return (e._context.displayName || "Context") + ".Consumer";
80
+ case ne:
81
+ var a = e.render;
82
+ return e = e.displayName, e || (e = a.displayName || a.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
83
+ case S:
84
+ return a = e.displayName || null, a !== null ? a : j(e.type) || "Memo";
85
+ case re:
86
+ a = e._payload, e = e._init;
87
87
  try {
88
- return F(t(f));
88
+ return j(e(a));
89
89
  } catch {
90
90
  }
91
91
  }
92
92
  return null;
93
93
  }
94
- function X(t) {
95
- return "" + t;
94
+ function X(e) {
95
+ return "" + e;
96
96
  }
97
- function K(t) {
97
+ function H(e) {
98
98
  try {
99
- X(t);
100
- var f = !1;
99
+ X(e);
100
+ var a = !1;
101
101
  } catch {
102
- f = !0;
102
+ a = !0;
103
103
  }
104
- if (f) {
105
- f = console;
106
- var b = f.error, y = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
107
- return b.call(
108
- f,
104
+ if (a) {
105
+ a = console;
106
+ var s = a.error, p = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
107
+ return s.call(
108
+ a,
109
109
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
110
- y
111
- ), X(t);
110
+ p
111
+ ), X(e);
112
112
  }
113
113
  }
114
- function d(t) {
115
- if (t === te) return "<>";
116
- if (typeof t == "object" && t !== null && t.$$typeof === ce)
114
+ function h(e) {
115
+ if (e === V) return "<>";
116
+ if (typeof e == "object" && e !== null && e.$$typeof === re)
117
117
  return "<...>";
118
118
  try {
119
- var f = F(t);
120
- return f ? "<" + f + ">" : "<...>";
119
+ var a = j(e);
120
+ return a ? "<" + a + ">" : "<...>";
121
121
  } catch {
122
122
  return "<...>";
123
123
  }
124
124
  }
125
- function _() {
126
- var t = g.A;
127
- return t === null ? null : t.getOwner();
125
+ function C() {
126
+ var e = oe.A;
127
+ return e === null ? null : e.getOwner();
128
128
  }
129
- function S() {
129
+ function _() {
130
130
  return Error("react-stack-top-frame");
131
131
  }
132
- function W(t) {
133
- if (L.call(t, "key")) {
134
- var f = Object.getOwnPropertyDescriptor(t, "key").get;
135
- if (f && f.isReactWarning) return !1;
132
+ function O(e) {
133
+ if (o.call(e, "key")) {
134
+ var a = Object.getOwnPropertyDescriptor(e, "key").get;
135
+ if (a && a.isReactWarning) return !1;
136
136
  }
137
- return t.key !== void 0;
137
+ return e.key !== void 0;
138
138
  }
139
- function $(t, f) {
140
- function b() {
141
- O || (O = !0, console.error(
139
+ function J(e, a) {
140
+ function s() {
141
+ ie || (ie = !0, console.error(
142
142
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
143
- f
143
+ a
144
144
  ));
145
145
  }
146
- b.isReactWarning = !0, Object.defineProperty(t, "key", {
147
- get: b,
146
+ s.isReactWarning = !0, Object.defineProperty(e, "key", {
147
+ get: s,
148
148
  configurable: !0
149
149
  });
150
150
  }
151
- function de() {
152
- var t = F(this.type);
153
- return j[t] || (j[t] = !0, console.error(
151
+ function pe() {
152
+ var e = j(this.type);
153
+ return K[e] || (K[e] = !0, console.error(
154
154
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
155
- )), t = this.props.ref, t !== void 0 ? t : null;
155
+ )), e = this.props.ref, e !== void 0 ? e : null;
156
156
  }
157
- function H(t, f, b, y, re, he) {
158
- var J = b.ref;
159
- return t = {
160
- $$typeof: Z,
161
- type: t,
162
- key: f,
163
- props: b,
164
- _owner: y
165
- }, (J !== void 0 ? J : null) !== null ? Object.defineProperty(t, "ref", {
157
+ function N(e, a, s, p, ue, ge) {
158
+ var R = s.ref;
159
+ return e = {
160
+ $$typeof: U,
161
+ type: e,
162
+ key: a,
163
+ props: s,
164
+ _owner: p
165
+ }, (R !== void 0 ? R : null) !== null ? Object.defineProperty(e, "ref", {
166
166
  enumerable: !1,
167
- get: de
168
- }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
167
+ get: pe
168
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
169
169
  configurable: !1,
170
170
  enumerable: !1,
171
171
  writable: !0,
172
172
  value: 0
173
- }), Object.defineProperty(t, "_debugInfo", {
173
+ }), Object.defineProperty(e, "_debugInfo", {
174
174
  configurable: !1,
175
175
  enumerable: !1,
176
176
  writable: !0,
177
177
  value: null
178
- }), Object.defineProperty(t, "_debugStack", {
178
+ }), Object.defineProperty(e, "_debugStack", {
179
179
  configurable: !1,
180
180
  enumerable: !1,
181
181
  writable: !0,
182
- value: re
183
- }), Object.defineProperty(t, "_debugTask", {
182
+ value: ue
183
+ }), Object.defineProperty(e, "_debugTask", {
184
184
  configurable: !1,
185
185
  enumerable: !1,
186
186
  writable: !0,
187
- value: he
188
- }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
187
+ value: ge
188
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
189
189
  }
190
- function G(t, f, b, y, re, he) {
191
- var J = f.children;
192
- if (J !== void 0)
193
- if (y)
194
- if (C(J)) {
195
- for (y = 0; y < J.length; y++)
196
- U(J[y]);
197
- Object.freeze && Object.freeze(J);
190
+ function z(e, a, s, p, ue, ge) {
191
+ var R = a.children;
192
+ if (R !== void 0)
193
+ if (p)
194
+ if (v(R)) {
195
+ for (p = 0; p < R.length; p++)
196
+ Y(R[p]);
197
+ Object.freeze && Object.freeze(R);
198
198
  } else
199
199
  console.error(
200
200
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
201
201
  );
202
- else U(J);
203
- if (L.call(f, "key")) {
204
- J = F(t);
205
- var E = Object.keys(f).filter(function(Te) {
206
- return Te !== "key";
202
+ else Y(R);
203
+ if (o.call(a, "key")) {
204
+ R = j(e);
205
+ var ee = Object.keys(a).filter(function(Me) {
206
+ return Me !== "key";
207
207
  });
208
- y = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", k[J + y] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
208
+ p = 0 < ee.length ? "{key: someKey, " + ee.join(": ..., ") + ": ...}" : "{key: someKey}", W[R + p] || (ee = 0 < ee.length ? "{" + ee.join(": ..., ") + ": ...}" : "{}", console.error(
209
209
  `A props object containing a "key" prop is being spread into JSX:
210
210
  let props = %s;
211
211
  <%s {...props} />
212
212
  React keys must be passed directly to JSX without using spread:
213
213
  let props = %s;
214
214
  <%s key={someKey} {...props} />`,
215
- y,
216
- J,
217
- E,
218
- J
219
- ), k[J + y] = !0);
215
+ p,
216
+ R,
217
+ ee,
218
+ R
219
+ ), W[R + p] = !0);
220
220
  }
221
- if (J = null, b !== void 0 && (K(b), J = "" + b), W(f) && (K(f.key), J = "" + f.key), "key" in f) {
222
- b = {};
223
- for (var fe in f)
224
- fe !== "key" && (b[fe] = f[fe]);
225
- } else b = f;
226
- return J && $(
227
- b,
228
- typeof t == "function" ? t.displayName || t.name || "Unknown" : t
229
- ), H(
230
- t,
231
- J,
232
- b,
233
- _(),
234
- re,
235
- he
221
+ if (R = null, s !== void 0 && (H(s), R = "" + s), O(a) && (H(a.key), R = "" + a.key), "key" in a) {
222
+ s = {};
223
+ for (var ce in a)
224
+ ce !== "key" && (s[ce] = a[ce]);
225
+ } else s = a;
226
+ return R && J(
227
+ s,
228
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
229
+ ), N(
230
+ e,
231
+ R,
232
+ s,
233
+ C(),
234
+ ue,
235
+ ge
236
236
  );
237
237
  }
238
- function U(t) {
239
- I(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === ce && (t._payload.status === "fulfilled" ? I(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
238
+ function Y(e) {
239
+ k(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === re && (e._payload.status === "fulfilled" ? k(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
240
240
  }
241
- function I(t) {
242
- return typeof t == "object" && t !== null && t.$$typeof === Z;
241
+ function k(e) {
242
+ return typeof e == "object" && e !== null && e.$$typeof === U;
243
243
  }
244
- var se = ct, Z = Symbol.for("react.transitional.element"), ie = Symbol.for("react.portal"), te = Symbol.for("react.fragment"), ue = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), v = Symbol.for("react.consumer"), Q = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), B = Symbol.for("react.suspense"), oe = Symbol.for("react.suspense_list"), ge = Symbol.for("react.memo"), ce = Symbol.for("react.lazy"), A = Symbol.for("react.activity"), p = Symbol.for("react.client.reference"), g = se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, C = Array.isArray, ee = console.createTask ? console.createTask : function() {
244
+ var se = lt, U = Symbol.for("react.transitional.element"), le = Symbol.for("react.portal"), V = Symbol.for("react.fragment"), de = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), T = Symbol.for("react.consumer"), q = Symbol.for("react.context"), ne = Symbol.for("react.forward_ref"), Z = Symbol.for("react.suspense"), D = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), re = Symbol.for("react.lazy"), me = Symbol.for("react.activity"), Te = Symbol.for("react.client.reference"), oe = se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, o = Object.prototype.hasOwnProperty, v = Array.isArray, b = console.createTask ? console.createTask : function() {
245
245
  return null;
246
246
  };
247
247
  se = {
248
- react_stack_bottom_frame: function(t) {
249
- return t();
248
+ react_stack_bottom_frame: function(e) {
249
+ return e();
250
250
  }
251
251
  };
252
- var O, j = {}, s = se.react_stack_bottom_frame.bind(
252
+ var ie, K = {}, E = se.react_stack_bottom_frame.bind(
253
253
  se,
254
- S
255
- )(), V = ee(d(S)), k = {};
256
- Le.Fragment = te, Le.jsx = function(t, f, b) {
257
- var y = 1e4 > g.recentlyCreatedOwnerStacks++;
258
- return G(
259
- t,
260
- f,
261
- b,
254
+ _
255
+ )(), Q = b(h(_)), W = {};
256
+ Ie.Fragment = V, Ie.jsx = function(e, a, s) {
257
+ var p = 1e4 > oe.recentlyCreatedOwnerStacks++;
258
+ return z(
259
+ e,
260
+ a,
261
+ s,
262
262
  !1,
263
- y ? Error("react-stack-top-frame") : s,
264
- y ? ee(d(t)) : V
263
+ p ? Error("react-stack-top-frame") : E,
264
+ p ? b(h(e)) : Q
265
265
  );
266
- }, Le.jsxs = function(t, f, b) {
267
- var y = 1e4 > g.recentlyCreatedOwnerStacks++;
268
- return G(
269
- t,
270
- f,
271
- b,
266
+ }, Ie.jsxs = function(e, a, s) {
267
+ var p = 1e4 > oe.recentlyCreatedOwnerStacks++;
268
+ return z(
269
+ e,
270
+ a,
271
+ s,
272
272
  !0,
273
- y ? Error("react-stack-top-frame") : s,
274
- y ? ee(d(t)) : V
273
+ p ? Error("react-stack-top-frame") : E,
274
+ p ? b(h(e)) : Q
275
275
  );
276
276
  };
277
- })()), Le;
277
+ })()), Ie;
278
278
  }
279
- var Ge;
280
- function At() {
281
- return Ge || (Ge = 1, process.env.NODE_ENV === "production" ? Xe.exports = Rt() : Xe.exports = Dt()), Xe.exports;
279
+ var Qe;
280
+ function Lt() {
281
+ return Qe || (Qe = 1, process.env.NODE_ENV === "production" ? ze.exports = St() : ze.exports = jt()), ze.exports;
282
282
  }
283
- var u = At();
284
- const Ct = 520, _t = () => /* @__PURE__ */ u.jsxs("svg", { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: [
283
+ var u = Lt();
284
+ const kt = 520, Ft = () => /* @__PURE__ */ u.jsxs("svg", { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: [
285
285
  /* @__PURE__ */ u.jsx("rect", { x: "1", y: "0", width: "4", height: "16", rx: "1" }),
286
286
  /* @__PURE__ */ u.jsx("rect", { x: "9", y: "0", width: "4", height: "16", rx: "1" })
287
- ] }), Ve = () => /* @__PURE__ */ u.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ u.jsx("polyline", { points: "3,5 7,9 11,5" }) }), Ke = () => /* @__PURE__ */ u.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ u.jsx("polyline", { points: "3,9 7,5 11,9" }) }), jt = ({
288
- currentTime: F,
287
+ ] }), et = () => /* @__PURE__ */ u.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ u.jsx("polyline", { points: "3,5 7,9 11,5" }) }), tt = () => /* @__PURE__ */ u.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ u.jsx("polyline", { points: "3,9 7,5 11,9" }) }), It = {
288
+ sm: { width: 44, height: 18, fontSize: "10px", dot: 5, borderRadius: "3px" },
289
+ md: { width: 56, height: 22, fontSize: "11px", dot: 6, borderRadius: "3px" },
290
+ lg: { width: 72, height: 30, fontSize: "13px", dot: 8, borderRadius: "4px" }
291
+ }, Xt = ({
292
+ currentTime: j,
289
293
  isPlaying: X,
290
- multiplier: K,
291
- dateTimeFormat: d,
292
- timezone: _,
293
- isLive: S,
294
- hasStartTime: W,
295
- hasEndTime: $,
296
- showJumpToStart: de = !0,
297
- showJumpToEnd: H = !0,
298
- onPlayPause: G,
299
- onJumpToStart: U,
300
- onRewind: I,
294
+ multiplier: H,
295
+ dateTimeFormat: h,
296
+ timezone: C,
297
+ isLive: _,
298
+ hasStartTime: O,
299
+ hasEndTime: J,
300
+ showJumpToStart: pe = !0,
301
+ showJumpToEnd: N = !0,
302
+ onPlayPause: z,
303
+ onJumpToStart: Y,
304
+ onRewind: k,
301
305
  onFastForward: se,
302
- onJumpToEnd: Z,
303
- onJumpToLive: ie,
304
- onResetSpeed: te,
305
- onDateTimeClick: ue,
306
- theme: w,
307
- swimLanesVisible: v,
308
- onToggleSwimLanes: Q,
309
- labels: M
306
+ onJumpToEnd: U,
307
+ onJumpToLive: le,
308
+ onResetSpeed: V,
309
+ onDateTimeClick: de,
310
+ theme: y,
311
+ swimLanesVisible: T,
312
+ onToggleSwimLanes: q,
313
+ labels: ne,
314
+ liveButtonSize: Z = "md",
315
+ liveButtonPosition: D = "left",
316
+ live: S = !1
310
317
  }) => {
311
- const B = K < 0, oe = K > 1, ge = K === 1, ce = Math.abs(K), A = Ne(
312
- () => ({ ...lt, ...M }),
313
- [M]
314
- ), p = x(null), [g, L] = Ae(!1);
315
- z(() => {
316
- const s = p.current;
318
+ const re = H < 0, me = H > 1, Te = H === 1, oe = Math.abs(H), o = We(
319
+ () => ({ ...pt, ...ne }),
320
+ [ne]
321
+ ), v = x(null), [b, ie] = Se(!1);
322
+ I(() => {
323
+ const s = v.current;
317
324
  if (!s) return;
318
- const V = new ResizeObserver(([k]) => {
319
- L(k.contentRect.width < Ct);
325
+ const p = new ResizeObserver(([ue]) => {
326
+ ie(ue.contentRect.width < kt);
320
327
  });
321
- return V.observe(s), () => V.disconnect();
328
+ return p.observe(s), () => p.disconnect();
322
329
  }, []);
323
- const C = {
330
+ const K = {
324
331
  background: "none",
325
332
  border: "1px solid transparent",
326
333
  cursor: "pointer",
@@ -337,26 +344,86 @@ const Ct = 520, _t = () => /* @__PURE__ */ u.jsxs("svg", { width: "14", height:
337
344
  fontFamily: "system-ui, -apple-system, sans-serif",
338
345
  flexShrink: 0,
339
346
  lineHeight: 1
340
- }, ee = (s) => ({
341
- ...C,
342
- color: s ? w.buttonActiveColor : w.buttonColor,
343
- borderColor: s ? `${w.buttonActiveColor}33` : "transparent"
344
- }), O = (s, V) => {
345
- s.currentTarget.style.backgroundColor = V ? `${w.buttonActiveColor}22` : w.buttonHoverColor + "44";
346
- }, j = (s) => {
347
+ }, E = (s) => ({
348
+ ...K,
349
+ color: s ? y.buttonActiveColor : y.buttonColor,
350
+ borderColor: s ? `${y.buttonActiveColor}33` : "transparent"
351
+ }), Q = (s, p) => {
352
+ s.currentTarget.style.backgroundColor = p ? `${y.buttonActiveColor}22` : y.buttonHoverColor + "44";
353
+ }, W = (s) => {
347
354
  s.currentTarget.style.backgroundColor = "transparent";
348
- };
355
+ }, e = It[Z], a = /* @__PURE__ */ u.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
356
+ /* @__PURE__ */ u.jsxs(
357
+ "button",
358
+ {
359
+ onClick: S ? void 0 : le,
360
+ style: {
361
+ ...K,
362
+ fontSize: e.fontSize,
363
+ fontWeight: "bold",
364
+ letterSpacing: "0.05em",
365
+ width: `${e.width}px`,
366
+ minWidth: `${e.width}px`,
367
+ height: `${e.height}px`,
368
+ borderRadius: e.borderRadius,
369
+ color: S || _ ? y.controlBarBackground : y.buttonActiveColor,
370
+ backgroundColor: S || _ ? y.buttonActiveColor : "transparent",
371
+ borderColor: y.buttonActiveColor,
372
+ opacity: 1,
373
+ gap: "4px",
374
+ cursor: S ? "default" : "pointer"
375
+ },
376
+ onMouseEnter: S ? void 0 : ((s) => {
377
+ s.currentTarget.style.opacity = "1";
378
+ }),
379
+ onMouseLeave: S ? void 0 : ((s) => {
380
+ s.currentTarget.style.opacity = _ ? "1" : "0.55";
381
+ }),
382
+ title: S || _ ? o.liveActiveTooltip : o.liveTooltip,
383
+ children: [
384
+ (S || _) && /* @__PURE__ */ u.jsx("span", { style: {
385
+ width: `${e.dot}px`,
386
+ height: `${e.dot}px`,
387
+ borderRadius: "50%",
388
+ backgroundColor: y.liveDotColor,
389
+ display: "inline-block",
390
+ flexShrink: 0
391
+ } }),
392
+ S || _ ? o.liveActiveLabel : o.liveLabel
393
+ ]
394
+ }
395
+ ),
396
+ !Te && !S && /* @__PURE__ */ u.jsx(
397
+ "button",
398
+ {
399
+ onClick: () => V(),
400
+ style: {
401
+ ...K,
402
+ fontSize: "11px",
403
+ color: y.buttonActiveColor,
404
+ borderColor: `${y.buttonActiveColor}44`,
405
+ width: `${e.width}px`,
406
+ minWidth: `${e.width}px`,
407
+ height: `${e.height}px`
408
+ },
409
+ onMouseEnter: (s) => Q(s, !0),
410
+ onMouseLeave: W,
411
+ title: o.resetSpeedTooltip,
412
+ children: re ? `◀ ${oe}×` : `${oe}× ▶`
413
+ }
414
+ )
415
+ ] });
349
416
  return /* @__PURE__ */ u.jsxs(
350
417
  "div",
351
418
  {
352
- ref: p,
419
+ ref: v,
353
420
  style: {
354
- display: g ? "flex" : "grid",
355
- gridTemplateColumns: g ? void 0 : "1fr auto 1fr",
421
+ display: b ? "flex" : "grid",
422
+ gridTemplateColumns: b ? void 0 : "1fr auto 1fr",
356
423
  alignItems: "center",
357
424
  padding: "6px 16px",
358
- backgroundColor: w.controlBarBackground,
359
- borderBottom: `1px solid ${w.controlBarBorder}`,
425
+ backgroundColor: y.controlBarBackground,
426
+ borderBottom: `1px solid ${y.controlBarBorder}`,
360
427
  fontFamily: "system-ui, -apple-system, sans-serif"
361
428
  },
362
429
  children: [
@@ -364,916 +431,909 @@ const Ct = 520, _t = () => /* @__PURE__ */ u.jsxs("svg", { width: "14", height:
364
431
  /* @__PURE__ */ u.jsx(
365
432
  "div",
366
433
  {
367
- onClick: ue,
368
- title: ue ? A.dateTimeClickTooltip : void 0,
434
+ onClick: S ? void 0 : de,
435
+ title: !S && de ? o.dateTimeClickTooltip : void 0,
369
436
  style: {
370
- color: w.labelColor,
437
+ color: y.labelColor,
371
438
  fontFamily: "monospace",
372
439
  lineHeight: 1.15,
373
- cursor: ue ? "pointer" : "default",
440
+ cursor: !S && de ? "pointer" : "default",
374
441
  borderRadius: "4px",
375
442
  padding: "2px 4px",
376
443
  transition: "background 0.15s"
377
444
  },
378
445
  onMouseEnter: (s) => {
379
- ue && (s.currentTarget.style.background = w.buttonHoverColor + "44");
446
+ !S && de && (s.currentTarget.style.background = y.buttonHoverColor + "44");
380
447
  },
381
448
  onMouseLeave: (s) => s.currentTarget.style.background = "transparent",
382
449
  children: (() => {
383
- const { timeFormat: s, dateFormat: V } = at(d), k = dt(F, _);
450
+ const { timeFormat: s, dateFormat: p } = mt(h), ue = gt(j, C);
384
451
  return /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
385
- s && /* @__PURE__ */ u.jsx("div", { style: { fontSize: "2em", fontWeight: "bold", letterSpacing: "0.02em" }, children: We(F, s, _) }),
386
- V && /* @__PURE__ */ u.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
387
- /* @__PURE__ */ u.jsx("span", { style: { fontSize: "1.15em", letterSpacing: "0.03em", color: w.buttonActiveColor }, children: We(F, V, _) }),
388
- k && /* @__PURE__ */ u.jsx("span", { style: {
452
+ s && /* @__PURE__ */ u.jsx("div", { style: { fontSize: "2em", fontWeight: "bold", letterSpacing: "0.02em" }, children: Ue(j, s, C) }),
453
+ p && /* @__PURE__ */ u.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
454
+ /* @__PURE__ */ u.jsx("span", { style: { fontSize: "1.15em", letterSpacing: "0.03em", color: y.buttonActiveColor }, children: Ue(j, p, C) }),
455
+ ue && /* @__PURE__ */ u.jsx("span", { style: {
389
456
  fontSize: "0.9em",
390
- color: w.labelColor,
457
+ color: y.labelColor,
391
458
  opacity: 0.7,
392
459
  fontWeight: "bold",
393
460
  letterSpacing: "0.04em"
394
- }, children: k })
461
+ }, children: ue })
395
462
  ] })
396
463
  ] });
397
464
  })()
398
465
  }
399
466
  ),
400
- /* @__PURE__ */ u.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px", justifyContent: "center" }, children: [
401
- /* @__PURE__ */ u.jsx(
402
- "button",
403
- {
404
- onClick: ie,
405
- style: {
406
- ...C,
407
- fontSize: "11px",
408
- fontWeight: "bold",
409
- letterSpacing: "0.05em",
410
- width: "52px",
411
- minWidth: "52px",
412
- height: "20px",
413
- borderRadius: "3px",
414
- color: S ? w.controlBarBackground : w.buttonActiveColor,
415
- backgroundColor: S ? w.buttonActiveColor : "transparent",
416
- borderColor: w.buttonActiveColor,
417
- opacity: S ? 1 : 0.55
418
- },
419
- onMouseEnter: (s) => {
420
- s.currentTarget.style.opacity = "1";
421
- },
422
- onMouseLeave: (s) => {
423
- s.currentTarget.style.opacity = S ? "1" : "0.55";
424
- },
425
- title: S ? A.liveActiveTooltip : A.liveTooltip,
426
- children: S ? A.liveActiveLabel : A.liveLabel
427
- }
428
- ),
429
- /* @__PURE__ */ u.jsx("div", { style: { height: "20px", display: "flex", alignItems: "center" }, children: !ge && /* @__PURE__ */ u.jsx(
430
- "button",
431
- {
432
- onClick: () => te(),
433
- style: {
434
- ...C,
435
- fontSize: "11px",
436
- color: w.buttonActiveColor,
437
- borderColor: `${w.buttonActiveColor}44`,
438
- width: "52px",
439
- minWidth: "52px",
440
- height: "20px"
441
- },
442
- onMouseEnter: (s) => O(s, !0),
443
- onMouseLeave: j,
444
- title: A.resetSpeedTooltip,
445
- children: B ? `◀ ${ce}×` : `${ce}× ▶`
446
- }
447
- ) })
448
- ] })
467
+ D === "left" && a
449
468
  ] }),
450
- /* @__PURE__ */ u.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "2px", ...g ? { flex: 1, justifyContent: "center" } : {} }, children: [
451
- de && /* @__PURE__ */ u.jsx(
469
+ /* @__PURE__ */ u.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "2px", ...b ? { flex: 1, justifyContent: "center" } : {} }, children: [
470
+ !S && pe && /* @__PURE__ */ u.jsx(
452
471
  "button",
453
472
  {
454
- onClick: W ? U : void 0,
455
- disabled: !W,
456
- style: { ...ee(!1), opacity: W ? 1 : 0.3, cursor: W ? "pointer" : "default" },
457
- onMouseEnter: W ? (s) => O(s, !1) : void 0,
458
- onMouseLeave: W ? j : void 0,
459
- title: W ? A.jumpToStartTooltip : A.noStartTimeTooltip,
473
+ onClick: O ? Y : void 0,
474
+ disabled: !O,
475
+ style: { ...E(!1), opacity: O ? 1 : 0.3, cursor: O ? "pointer" : "default" },
476
+ onMouseEnter: O ? (s) => Q(s, !1) : void 0,
477
+ onMouseLeave: O ? W : void 0,
478
+ title: O ? o.jumpToStartTooltip : o.noStartTimeTooltip,
460
479
  children: "⏮"
461
480
  }
462
481
  ),
463
- /* @__PURE__ */ u.jsx(
482
+ !S && /* @__PURE__ */ u.jsx(
464
483
  "button",
465
484
  {
466
- onClick: I,
467
- style: { ...ee(B), width: "64px", minWidth: "64px", gap: "3px" },
468
- onMouseEnter: (s) => O(s, B),
469
- onMouseLeave: j,
470
- title: B ? Be(A.rewindActiveTooltip, ce) : A.rewindTooltip,
471
- children: B ? /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
485
+ onClick: k,
486
+ style: { ...E(re), width: "64px", minWidth: "64px", gap: "3px" },
487
+ onMouseEnter: (s) => Q(s, re),
488
+ onMouseLeave: W,
489
+ title: re ? qe(o.rewindActiveTooltip, oe) : o.rewindTooltip,
490
+ children: re ? /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
472
491
  /* @__PURE__ */ u.jsxs("span", { style: { fontSize: "11px", fontWeight: "bold" }, children: [
473
- ce,
492
+ oe,
474
493
  "×"
475
494
  ] }),
476
495
  "◀◀"
477
496
  ] }) : "◀◀"
478
497
  }
479
498
  ),
480
- /* @__PURE__ */ u.jsx(
499
+ !S && /* @__PURE__ */ u.jsx(
481
500
  "button",
482
501
  {
483
- onClick: () => G(!X),
502
+ onClick: () => z(!X),
484
503
  style: {
485
- ...C,
486
- color: w.buttonActiveColor,
504
+ ...K,
505
+ color: y.buttonActiveColor,
487
506
  fontSize: "18px",
488
507
  width: "40px",
489
508
  minWidth: "40px",
490
509
  height: "40px",
491
- borderColor: `${w.buttonActiveColor}55`,
510
+ borderColor: `${y.buttonActiveColor}55`,
492
511
  borderRadius: "50%",
493
512
  paddingLeft: X ? "0" : "2px"
494
513
  },
495
- onMouseEnter: (s) => O(s, !0),
496
- onMouseLeave: j,
497
- title: X ? A.pauseTooltip : B ? A.playFromRewindTooltip : A.playTooltip,
498
- children: X ? /* @__PURE__ */ u.jsx(_t, {}) : "▶"
514
+ onMouseEnter: (s) => Q(s, !0),
515
+ onMouseLeave: W,
516
+ title: X ? o.pauseTooltip : re ? o.playFromRewindTooltip : o.playTooltip,
517
+ children: X ? /* @__PURE__ */ u.jsx(Ft, {}) : "▶"
499
518
  }
500
519
  ),
501
- /* @__PURE__ */ u.jsx(
520
+ !S && /* @__PURE__ */ u.jsx(
502
521
  "button",
503
522
  {
504
523
  onClick: se,
505
- style: { ...ee(oe), width: "64px", minWidth: "64px", gap: "3px" },
506
- onMouseEnter: (s) => O(s, oe),
507
- onMouseLeave: j,
508
- title: oe ? Be(A.fastForwardActiveTooltip, ce) : A.fastForwardTooltip,
509
- children: oe ? /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
524
+ style: { ...E(me), width: "64px", minWidth: "64px", gap: "3px" },
525
+ onMouseEnter: (s) => Q(s, me),
526
+ onMouseLeave: W,
527
+ title: me ? qe(o.fastForwardActiveTooltip, oe) : o.fastForwardTooltip,
528
+ children: me ? /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
510
529
  "▶▶",
511
530
  /* @__PURE__ */ u.jsxs("span", { style: { fontSize: "11px", fontWeight: "bold" }, children: [
512
- ce,
531
+ oe,
513
532
  "×"
514
533
  ] })
515
534
  ] }) : "▶▶"
516
535
  }
517
536
  ),
518
- H && /* @__PURE__ */ u.jsx(
537
+ !S && N && /* @__PURE__ */ u.jsx(
519
538
  "button",
520
539
  {
521
- onClick: $ ? Z : void 0,
522
- disabled: !$,
523
- style: { ...ee(!1), opacity: $ ? 1 : 0.3, cursor: $ ? "pointer" : "default" },
524
- onMouseEnter: $ ? (s) => O(s, !1) : void 0,
525
- onMouseLeave: $ ? j : void 0,
526
- title: $ ? A.jumpToEndTooltip : A.noEndTimeTooltip,
540
+ onClick: J ? U : void 0,
541
+ disabled: !J,
542
+ style: { ...E(!1), opacity: J ? 1 : 0.3, cursor: J ? "pointer" : "default" },
543
+ onMouseEnter: J ? (s) => Q(s, !1) : void 0,
544
+ onMouseLeave: J ? W : void 0,
545
+ title: J ? o.jumpToEndTooltip : o.noEndTimeTooltip,
527
546
  children: "⏭"
528
547
  }
529
548
  )
530
549
  ] }),
531
- !g && /* @__PURE__ */ u.jsx("div", { style: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: Q != null && v != null && /* @__PURE__ */ u.jsx(
532
- "button",
533
- {
534
- onClick: Q,
535
- style: {
536
- ...C,
537
- color: w.buttonActiveColor,
538
- borderColor: `${w.buttonActiveColor}33`
539
- },
540
- onMouseEnter: (s) => O(s, v),
541
- onMouseLeave: j,
542
- title: v ? A.collapseSwimLanesTooltip : A.expandSwimLanesTooltip,
543
- children: v ? /* @__PURE__ */ u.jsx(Ve, {}) : /* @__PURE__ */ u.jsx(Ke, {})
544
- }
545
- ) }),
546
- g && Q != null && v != null && /* @__PURE__ */ u.jsx(
550
+ !b && /* @__PURE__ */ u.jsxs("div", { style: { display: "flex", justifyContent: "flex-end", alignItems: "center", gap: "8px" }, children: [
551
+ D === "right" && a,
552
+ q != null && T != null && /* @__PURE__ */ u.jsx(
553
+ "button",
554
+ {
555
+ onClick: q,
556
+ style: {
557
+ ...K,
558
+ color: y.buttonActiveColor,
559
+ borderColor: `${y.buttonActiveColor}33`
560
+ },
561
+ onMouseEnter: (s) => Q(s, T),
562
+ onMouseLeave: W,
563
+ title: T ? o.collapseSwimLanesTooltip : o.expandSwimLanesTooltip,
564
+ children: T ? /* @__PURE__ */ u.jsx(et, {}) : /* @__PURE__ */ u.jsx(tt, {})
565
+ }
566
+ )
567
+ ] }),
568
+ b && q != null && T != null && /* @__PURE__ */ u.jsx(
547
569
  "button",
548
570
  {
549
- onClick: Q,
571
+ onClick: q,
550
572
  style: {
551
- ...C,
552
- color: w.buttonActiveColor,
553
- borderColor: `${w.buttonActiveColor}33`,
573
+ ...K,
574
+ color: y.buttonActiveColor,
575
+ borderColor: `${y.buttonActiveColor}33`,
554
576
  marginLeft: "4px"
555
577
  },
556
- onMouseEnter: (s) => O(s, v),
557
- onMouseLeave: j,
558
- title: v ? A.collapseSwimLanesTooltip : A.expandSwimLanesTooltip,
559
- children: v ? /* @__PURE__ */ u.jsx(Ve, {}) : /* @__PURE__ */ u.jsx(Ke, {})
578
+ onMouseEnter: (s) => Q(s, T),
579
+ onMouseLeave: W,
580
+ title: T ? o.collapseSwimLanesTooltip : o.expandSwimLanesTooltip,
581
+ children: T ? /* @__PURE__ */ u.jsx(et, {}) : /* @__PURE__ */ u.jsx(tt, {})
560
582
  }
561
583
  )
562
584
  ]
563
585
  }
564
586
  );
565
- }, et = st(
566
- (F, X) => {
587
+ }, ot = dt(
588
+ (j, X) => {
567
589
  const {
568
- currentTime: K,
569
- defaultStartMs: d,
570
- defaultEndMs: _,
571
- theme: S,
572
- maxTicks: W,
573
- timezone: $,
574
- dateTimeFormat: de,
575
- months: H,
576
- onTimeChange: G,
577
- onDragStart: U,
578
- onDragEnd: I,
590
+ currentTime: H,
591
+ defaultStartMs: h,
592
+ defaultEndMs: C,
593
+ theme: _,
594
+ maxTicks: O,
595
+ timezone: J,
596
+ dateTimeFormat: pe,
597
+ months: N,
598
+ onTimeChange: z,
599
+ onDragStart: Y,
600
+ onDragEnd: k,
579
601
  onRangeSelect: se,
580
- swimLanes: Z,
581
- showSwimLanes: ie,
582
- onSwimLaneItemClick: te,
583
- onSwimLaneItemHover: ue,
584
- onSwimLaneItemDoubleClick: w,
585
- onSwimLaneItemContextMenu: v,
586
- onSwimLaneReorder: Q
587
- } = F, M = x(null), B = x(S), oe = x(W), ge = x($), ce = x(de), A = x(H), p = x(d), g = x(_), L = x(D.JulianDate.toDate(K).getTime());
588
- z(() => {
589
- B.current = S;
590
- }, [S]), z(() => {
591
- oe.current = W;
592
- }, [W]), z(() => {
593
- ge.current = $, m();
594
- }, [$]), z(() => {
595
- ce.current = de, m();
596
- }, [de]), z(() => {
597
- A.current = H, m();
598
- }, [H]);
599
- const C = x(Z ?? []), ee = x(ie ?? (Z != null && Z.length > 0)), O = x(0), j = x(null), s = x(null), V = x(te), k = x(ue), t = x(w), f = x(v), b = x(Q);
600
- z(() => {
601
- V.current = te;
602
- }, [te]), z(() => {
603
- k.current = ue;
604
- }, [ue]), z(() => {
605
- t.current = w;
606
- }, [w]), z(() => {
607
- f.current = v;
608
- }, [v]), z(() => {
609
- b.current = Q;
610
- }, [Q]), z(() => {
611
- C.current = Z ?? [], m();
612
- }, [Z]), z(() => {
613
- ee.current = ie ?? (Z != null && Z.length > 0), m();
614
- }, [ie, Z]);
615
- const y = x(null), re = x(null), he = x(!1), J = x(0), E = x("none"), fe = x(0), Te = x(0), ke = x(0), Ce = x(0), Fe = x(0), xe = x(null), q = x(se);
616
- z(() => {
617
- q.current = se;
602
+ swimLanes: U,
603
+ showSwimLanes: le,
604
+ onSwimLaneItemClick: V,
605
+ onSwimLaneItemHover: de,
606
+ onSwimLaneItemDoubleClick: y,
607
+ onSwimLaneItemContextMenu: T,
608
+ onSwimLaneReorder: q,
609
+ disableNeedleDrag: ne,
610
+ invertScrollZoom: Z
611
+ } = j, D = x(null), S = x(_), re = x(O), me = x(J), Te = x(pe), oe = x(N), o = x(h), v = x(C), b = x(A.JulianDate.toDate(H).getTime());
612
+ I(() => {
613
+ S.current = _;
614
+ }, [_]), I(() => {
615
+ re.current = O;
616
+ }, [O]), I(() => {
617
+ me.current = J, g();
618
+ }, [J]), I(() => {
619
+ Te.current = pe, g();
620
+ }, [pe]), I(() => {
621
+ oe.current = N, g();
622
+ }, [N]);
623
+ const ie = x(ne ?? !1);
624
+ I(() => {
625
+ ie.current = ne ?? !1;
626
+ }, [ne]);
627
+ const K = x(Z ?? !1);
628
+ I(() => {
629
+ K.current = Z ?? !1;
630
+ }, [Z]);
631
+ const E = x(U ?? []), Q = x(le ?? (U != null && U.length > 0)), W = x(0), e = x(null), a = x(null), s = x(V), p = x(de), ue = x(y), ge = x(T), R = x(q);
632
+ I(() => {
633
+ s.current = V;
634
+ }, [V]), I(() => {
635
+ p.current = de;
636
+ }, [de]), I(() => {
637
+ ue.current = y;
638
+ }, [y]), I(() => {
639
+ ge.current = T;
640
+ }, [T]), I(() => {
641
+ R.current = q;
642
+ }, [q]), I(() => {
643
+ E.current = U ?? [], g();
644
+ }, [U]), I(() => {
645
+ Q.current = le ?? (U != null && U.length > 0), g();
646
+ }, [le, U]);
647
+ const ee = x(null), ce = x(null), Me = x(!1), Xe = x(0), F = x("none"), xe = x(0), De = x(0), Pe = x(0), je = x(0), Oe = x(0), ve = x(null), $ = x(se);
648
+ I(() => {
649
+ $.current = se;
618
650
  }, [se]);
619
- const pe = x("none"), ve = x(0), ye = x(0), _e = x(0), je = x(0), Ie = (e, n) => Math.hypot(n.clientX - e.clientX, n.clientY - e.clientY), be = ae(() => ({
620
- startMs: p.current,
621
- endMs: g.current,
622
- currentMs: L.current,
623
- theme: B.current,
624
- maxTicks: oe.current,
625
- timezone: ge.current,
626
- use12h: /h/.test(ce.current ?? ""),
627
- months: A.current,
628
- swimLanes: C.current,
629
- showSwimLanes: ee.current,
630
- scrollTop: O.current,
631
- reorderState: s.current,
632
- rangeSelection: xe.current
651
+ const be = x(null), ae = x("none"), Ee = x(0), Ae = x(0), Le = x(0), ke = x(0), Je = (t, n) => Math.hypot(n.clientX - t.clientX, n.clientY - t.clientY), we = he(() => ({
652
+ startMs: o.current,
653
+ endMs: v.current,
654
+ currentMs: b.current,
655
+ theme: S.current,
656
+ maxTicks: re.current,
657
+ timezone: me.current,
658
+ use12h: /h/.test(Te.current ?? ""),
659
+ months: oe.current,
660
+ swimLanes: E.current,
661
+ showSwimLanes: Q.current,
662
+ scrollTop: W.current,
663
+ reorderState: a.current,
664
+ rangeSelection: ve.current,
665
+ hoverMs: be.current
633
666
  }), []);
634
- it(X, () => ({
635
- zoomTo(e, n, r) {
636
- const a = Math.max(vt, Math.min(bt, n - e)), o = (e + n) / 2;
637
- p.current = o - a / 2, g.current = o + a / 2, r !== void 0 && (L.current = r), m();
667
+ ft(X, () => ({
668
+ zoomTo(t, n, r) {
669
+ const f = Math.max(yt, Math.min(Et, n - t)), c = (t + n) / 2;
670
+ o.current = c - f / 2, v.current = c + f / 2, r !== void 0 && (b.current = r), g();
638
671
  },
639
672
  getVisibleRange() {
640
- return { startMs: p.current, endMs: g.current };
673
+ return { startMs: o.current, endMs: v.current };
641
674
  },
642
- startFollow(e) {
643
- if (J.current = e, re.current !== null) return;
644
- he.current = !0;
675
+ startFollow(t) {
676
+ if (Xe.current = t, ce.current !== null) return;
677
+ Me.current = !0;
645
678
  let n = performance.now();
646
679
  const r = () => {
647
- const a = performance.now(), o = a - n;
648
- n = a;
649
- const c = o * J.current;
650
- p.current += c, g.current += c, L.current += c, m(), re.current = requestAnimationFrame(r);
680
+ const f = performance.now(), c = f - n;
681
+ n = f;
682
+ const i = c * Xe.current;
683
+ o.current += i, v.current += i, b.current += i, g(), ce.current = requestAnimationFrame(r);
651
684
  };
652
- re.current = requestAnimationFrame(r);
685
+ ce.current = requestAnimationFrame(r);
653
686
  },
654
687
  stopFollow() {
655
- he.current = !1, re.current !== null && (cancelAnimationFrame(re.current), re.current = null);
688
+ Me.current = !1, ce.current !== null && (cancelAnimationFrame(ce.current), ce.current = null);
656
689
  },
657
- correctFollow(e) {
658
- if (!he.current) return;
659
- const n = e - L.current;
660
- L.current = e, p.current += n, g.current += n;
690
+ correctFollow(t) {
691
+ if (!Me.current) return;
692
+ const n = t - b.current;
693
+ b.current = t, o.current += n, v.current += n;
661
694
  },
662
695
  // ── Swim lane CRUD ──────────────────────────────────────────────
663
- appendSwimLane(e) {
664
- C.current = [...C.current, e], m();
696
+ appendSwimLane(t) {
697
+ E.current = [...E.current, t], g();
665
698
  },
666
- updateSwimLane(e, n) {
667
- C.current = C.current.map(
668
- (r) => r.id === e ? { ...r, ...n, id: r.id } : r
669
- ), m();
699
+ updateSwimLane(t, n) {
700
+ E.current = E.current.map(
701
+ (r) => r.id === t ? { ...r, ...n, id: r.id } : r
702
+ ), g();
670
703
  },
671
- removeSwimLane(e) {
672
- C.current = C.current.filter((n) => n.id !== e), m();
704
+ removeSwimLane(t) {
705
+ E.current = E.current.filter((n) => n.id !== t), g();
673
706
  },
674
- reorderSwimLanes(e) {
675
- const n = new Map(C.current.map((a) => [a.id, a])), r = [];
676
- for (const a of e) {
677
- const o = n.get(a);
678
- o && r.push(o);
707
+ reorderSwimLanes(t) {
708
+ const n = new Map(E.current.map((f) => [f.id, f])), r = [];
709
+ for (const f of t) {
710
+ const c = n.get(f);
711
+ c && r.push(c);
679
712
  }
680
- C.current = r, m();
713
+ E.current = r, g();
681
714
  }
682
715
  }));
683
- const m = ae(() => {
684
- const e = M.current;
685
- if (!e) return;
686
- const n = e.getContext("2d");
716
+ const g = he(() => {
717
+ const t = D.current;
718
+ if (!t) return;
719
+ const n = t.getContext("2d");
687
720
  if (!n) return;
688
- const r = e.getBoundingClientRect(), a = r.width, o = r.height;
689
- if (a === 0 || o === 0) return;
690
- const c = window.devicePixelRatio || 1, h = Math.round(a * c), l = Math.round(o * c);
691
- (e.width !== h || e.height !== l) && (e.width = h, e.height = l), n.save(), n.scale(c, c);
692
- const T = ft(n, a, o, be());
693
- T !== O.current && (O.current = T), n.restore();
694
- }, [be]);
695
- ut(() => {
696
- m();
697
- const e = M.current;
698
- if (!e) return;
699
- const n = new ResizeObserver(() => m());
700
- return n.observe(e), () => n.disconnect();
701
- }, [m]), z(() => {
702
- if (he.current) return;
703
- const e = D.JulianDate.toDate(K).getTime();
704
- L.current !== e && (L.current = e, m());
705
- }, [K, m]);
706
- const we = ae((e) => {
707
- if (y.current !== null) return;
721
+ const r = t.getBoundingClientRect(), f = r.width, c = r.height;
722
+ if (f === 0 || c === 0) return;
723
+ const i = window.devicePixelRatio || 1, m = Math.round(f * i), l = Math.round(c * i);
724
+ (t.width !== m || t.height !== l) && (t.width = m, t.height = l), n.save(), n.scale(i, i);
725
+ const M = xt(n, f, c, we());
726
+ M !== W.current && (W.current = M), n.restore();
727
+ }, [we]);
728
+ ht(() => {
729
+ g();
730
+ const t = D.current;
731
+ if (!t) return;
732
+ const n = new ResizeObserver(() => g());
733
+ return n.observe(t), () => n.disconnect();
734
+ }, [g]), I(() => {
735
+ if (Me.current) return;
736
+ const t = A.JulianDate.toDate(H).getTime();
737
+ b.current !== t && (b.current = t, g());
738
+ }, [H, g]);
739
+ const Re = he((t) => {
740
+ if (ee.current !== null) return;
708
741
  const n = () => {
709
- const r = M.current, a = g.current - p.current, o = e * a * 0.01;
710
- if (p.current += o, g.current += o, r) {
711
- const c = r.getBoundingClientRect(), h = Math.max(0, Math.min(c.width, Te.current - c.left)), l = p.current + h / c.width * (g.current - p.current);
712
- L.current = l, G(D.JulianDate.fromDate(new Date(l)));
742
+ const r = D.current, f = v.current - o.current, c = t * f * 0.01;
743
+ if (o.current += c, v.current += c, r) {
744
+ const i = r.getBoundingClientRect(), m = Math.max(0, Math.min(i.width, De.current - i.left)), l = o.current + m / i.width * (v.current - o.current);
745
+ b.current = l, z(A.JulianDate.fromDate(new Date(l)));
713
746
  }
714
- m(), y.current = requestAnimationFrame(n);
747
+ g(), ee.current = requestAnimationFrame(n);
715
748
  };
716
- y.current = requestAnimationFrame(n);
717
- }, [m, G]), Me = ae(() => {
718
- y.current !== null && (cancelAnimationFrame(y.current), y.current = null);
719
- }, []), i = ae((e, n, r, a) => pt(e, n, r, a, be()), [be]), R = ae((e, n, r) => mt(e, n, r, be()), [be]), P = ae((e, n) => ht(e, n, be()), [be]), le = ae((e) => {
720
- e.preventDefault();
721
- const n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, a = e.clientY - n.top;
722
- if (e.button === 0 && b.current) {
723
- const o = R(r, a, n.height);
724
- if (o) {
725
- const h = C.current.findIndex((l) => l.id === o.id);
726
- s.current = {
749
+ ee.current = requestAnimationFrame(n);
750
+ }, [g, z]), d = he(() => {
751
+ ee.current !== null && (cancelAnimationFrame(ee.current), ee.current = null);
752
+ }, []), w = he((t, n, r, f) => vt(t, n, r, f, we()), [we]), P = he((t, n, r) => bt(t, n, r, we()), [we]), te = he((t, n) => wt(t, n, we()), [we]), B = he((t) => {
753
+ t.preventDefault();
754
+ const n = t.currentTarget.getBoundingClientRect(), r = t.clientX - n.left, f = t.clientY - n.top;
755
+ if (t.button === 0 && R.current) {
756
+ const c = P(r, f, n.height);
757
+ if (c) {
758
+ const m = E.current.findIndex((l) => l.id === c.id);
759
+ a.current = {
727
760
  dragging: !0,
728
- dragLaneId: o.id,
729
- dragStartY: e.clientY,
730
- currentY: e.clientY,
731
- insertIndex: h
732
- }, e.currentTarget.style.cursor = "grabbing";
761
+ dragLaneId: c.id,
762
+ dragStartY: t.clientY,
763
+ currentY: t.clientY,
764
+ insertIndex: m
765
+ }, t.currentTarget.style.cursor = "grabbing";
733
766
  return;
734
767
  }
735
768
  }
736
- if (e.button === 0 && P(a, n.height)) {
737
- const o = (L.current - p.current) / (g.current - p.current) * n.width;
738
- if (!(Math.abs(r - o) <= 10) && i(r, a, n.width, n.height)) {
739
- ke.current = performance.now();
769
+ if (t.button === 0 && te(f, n.height)) {
770
+ const c = (b.current - o.current) / (v.current - o.current) * n.width;
771
+ if (!(Math.abs(r - c) <= 10) && w(r, f, n.width, n.height)) {
772
+ Pe.current = performance.now();
740
773
  return;
741
774
  }
742
775
  }
743
- if (e.button === 0) {
744
- const o = (L.current - p.current) / (g.current - p.current) * n.width, c = Math.abs(r - o) <= 10, h = a >= n.height - Oe;
745
- if (!c && h)
746
- E.current = "rangeSelectPending", Fe.current = r, Ce.current = p.current + r / n.width * (g.current - p.current), e.currentTarget.style.cursor = "crosshair", U == null || U();
776
+ if (t.button === 0) {
777
+ if (ie.current) {
778
+ F.current = "slide", xe.current = t.clientX;
779
+ return;
780
+ }
781
+ const c = (b.current - o.current) / (v.current - o.current) * n.width, i = Math.abs(r - c) <= 10, m = f >= n.height - Ye;
782
+ if (!i && m)
783
+ F.current = "rangeSelectPending", Oe.current = r, je.current = o.current + r / n.width * (v.current - o.current), t.currentTarget.style.cursor = "crosshair", Y == null || Y();
747
784
  else {
748
- E.current = "scrub", Te.current = e.clientX, e.currentTarget.style.cursor = "grabbing", U == null || U();
749
- const l = p.current + r / n.width * (g.current - p.current);
750
- L.current = l, m(), G(D.JulianDate.fromDate(new Date(l)));
785
+ F.current = "scrub", De.current = t.clientX, t.currentTarget.style.cursor = "grabbing", Y == null || Y();
786
+ const l = o.current + r / n.width * (v.current - o.current);
787
+ b.current = l, g(), z(A.JulianDate.fromDate(new Date(l)));
751
788
  }
752
- } else if (e.button === 1)
753
- E.current = "slide", fe.current = e.clientX;
754
- else if (e.button === 2) {
755
- if (f.current && P(a, n.height))
789
+ } else if (t.button === 1)
790
+ F.current = "slide", xe.current = t.clientX;
791
+ else if (t.button === 2) {
792
+ if (ge.current && te(f, n.height))
756
793
  return;
757
- E.current = "zoom", fe.current = e.clientX;
794
+ F.current = "zoom", xe.current = t.clientX;
758
795
  }
759
- }, [m, G, U, R, P, i]);
760
- z(() => {
761
- const e = (r) => {
762
- const a = s.current;
763
- if (a && a.dragging) {
764
- a.currentY = r.clientY;
765
- const l = M.current;
796
+ }, [g, z, Y, P, te, w]);
797
+ I(() => {
798
+ const t = (r) => {
799
+ const f = a.current;
800
+ if (f && f.dragging) {
801
+ f.currentY = r.clientY;
802
+ const l = D.current;
766
803
  if (l) {
767
- const T = l.getBoundingClientRect(), Y = r.clientY - T.top;
768
- let Re = -O.current;
769
- const Je = C.current;
770
- let Ye = Je.length;
771
- for (let Pe = 0; Pe < Je.length; Pe++) {
772
- const ze = Je[Pe].height ?? $e, ot = Re + ze / 2;
773
- if (Y < ot) {
774
- Ye = Pe;
804
+ const M = l.getBoundingClientRect(), L = r.clientY - M.top;
805
+ let Ce = -W.current;
806
+ const $e = E.current;
807
+ let Be = $e.length;
808
+ for (let Ne = 0; Ne < $e.length; Ne++) {
809
+ const He = $e[Ne].height ?? Ge, at = Ce + He / 2;
810
+ if (L < at) {
811
+ Be = Ne;
775
812
  break;
776
813
  }
777
- Re += ze + He;
814
+ Ce += He + Ve;
778
815
  }
779
- a.insertIndex = Ye;
816
+ f.insertIndex = Be;
780
817
  }
781
- m();
818
+ g();
782
819
  return;
783
820
  }
784
- if (E.current === "none") return;
785
- const o = M.current;
786
- if (!o) return;
787
- const c = o.getBoundingClientRect(), h = c.width;
788
- if (E.current === "scrub") {
789
- Te.current = r.clientX;
790
- const l = r.clientX - c.left, T = h * 0.08;
791
- l < T ? we(-1) : l > h - T ? we(1) : Me();
792
- const Y = Math.max(0, Math.min(h, l)), me = p.current + Y / h * (g.current - p.current);
793
- L.current = me, m(), G(D.JulianDate.fromDate(new Date(me)));
794
- } else if (E.current === "rangeSelectPending" || E.current === "rangeSelect") {
795
- const l = r.clientX - c.left, T = Math.abs(l - Fe.current);
796
- if (E.current === "rangeSelectPending" && T >= 3 && (E.current = "rangeSelect"), E.current === "rangeSelect") {
797
- const Y = Math.max(0, Math.min(h, l)), me = p.current + Y / h * (g.current - p.current);
798
- xe.current = {
799
- startMs: Ce.current,
800
- endMs: me
801
- }, m();
821
+ if (F.current === "none") return;
822
+ const c = D.current;
823
+ if (!c) return;
824
+ const i = c.getBoundingClientRect(), m = i.width;
825
+ if (F.current === "scrub") {
826
+ De.current = r.clientX;
827
+ const l = r.clientX - i.left, M = m * 0.08;
828
+ l < M ? Re(-1) : l > m - M ? Re(1) : d();
829
+ const L = Math.max(0, Math.min(m, l)), fe = o.current + L / m * (v.current - o.current);
830
+ b.current = fe, g(), z(A.JulianDate.fromDate(new Date(fe)));
831
+ } else if (F.current === "rangeSelectPending" || F.current === "rangeSelect") {
832
+ const l = r.clientX - i.left, M = Math.abs(l - Oe.current);
833
+ if (F.current === "rangeSelectPending" && M >= 3 && (F.current = "rangeSelect"), F.current === "rangeSelect") {
834
+ const L = Math.max(0, Math.min(m, l)), fe = o.current + L / m * (v.current - o.current);
835
+ ve.current = {
836
+ startMs: je.current,
837
+ endMs: fe
838
+ }, g();
802
839
  }
803
- } else if (E.current === "slide") {
804
- const l = fe.current - r.clientX;
805
- if (fe.current = r.clientX, l !== 0) {
806
- const T = l / h * (g.current - p.current);
807
- p.current += T, g.current += T, m();
840
+ } else if (F.current === "slide") {
841
+ const l = xe.current - r.clientX;
842
+ if (xe.current = r.clientX, l !== 0) {
843
+ const M = l / m * (v.current - o.current);
844
+ o.current += M, v.current += M, g();
808
845
  }
809
- } else if (E.current === "zoom") {
810
- const l = fe.current - r.clientX;
811
- fe.current = r.clientX, l !== 0 && N(Math.pow(1.01, l));
846
+ } else if (F.current === "zoom") {
847
+ const l = xe.current - r.clientX;
848
+ xe.current = r.clientX, l !== 0 && G(Math.pow(1.01, l));
812
849
  }
813
850
  }, n = () => {
814
- var a, o;
815
- const r = s.current;
851
+ var f, c;
852
+ const r = a.current;
816
853
  if (r && r.dragging) {
817
- const c = Math.abs(r.currentY - r.dragStartY), h = C.current, l = h.findIndex((T) => T.id === r.dragLaneId);
818
- if (c > 5 && l >= 0 && r.insertIndex !== l && r.insertIndex !== l + 1) {
819
- const T = [...h], [Y] = T.splice(l, 1), me = r.insertIndex > l ? r.insertIndex - 1 : r.insertIndex;
820
- T.splice(me, 0, Y), C.current = T, (a = b.current) == null || a.call(b, T.map((Re) => Re.id));
854
+ const i = Math.abs(r.currentY - r.dragStartY), m = E.current, l = m.findIndex((M) => M.id === r.dragLaneId);
855
+ if (i > 5 && l >= 0 && r.insertIndex !== l && r.insertIndex !== l + 1) {
856
+ const M = [...m], [L] = M.splice(l, 1), fe = r.insertIndex > l ? r.insertIndex - 1 : r.insertIndex;
857
+ M.splice(fe, 0, L), E.current = M, (f = R.current) == null || f.call(R, M.map((Ce) => Ce.id));
821
858
  }
822
- s.current = null, M.current && (M.current.style.cursor = "default"), m();
859
+ a.current = null, D.current && (D.current.style.cursor = "default"), g();
823
860
  return;
824
861
  }
825
- if (Me(), E.current === "rangeSelectPending") {
826
- L.current = Ce.current, xe.current = null, E.current = "none", M.current && (M.current.style.cursor = "default"), m(), G(D.JulianDate.fromDate(new Date(Ce.current))), I == null || I();
862
+ if (d(), F.current === "rangeSelectPending") {
863
+ b.current = je.current, ve.current = null, F.current = "none", D.current && (D.current.style.cursor = "default"), g(), z(A.JulianDate.fromDate(new Date(je.current))), k == null || k();
827
864
  return;
828
865
  }
829
- if (E.current === "rangeSelect") {
830
- const c = xe.current;
831
- if (xe.current = null, c) {
832
- const h = Math.min(c.startMs, c.endMs), l = Math.max(c.startMs, c.endMs);
833
- p.current = h, g.current = l;
834
- const T = D.JulianDate.fromDate(new Date(h)), Y = D.JulianDate.fromDate(new Date(l));
835
- (o = q.current) == null || o.call(q, T, Y);
866
+ if (F.current === "rangeSelect") {
867
+ const i = ve.current;
868
+ if (ve.current = null, i) {
869
+ const m = Math.min(i.startMs, i.endMs), l = Math.max(i.startMs, i.endMs);
870
+ o.current = m, v.current = l;
871
+ const M = Math.max(m, Math.min(l, b.current));
872
+ M !== b.current && (b.current = M, z(A.JulianDate.fromDate(new Date(M))));
873
+ const L = A.JulianDate.fromDate(new Date(m)), fe = A.JulianDate.fromDate(new Date(l));
874
+ (c = $.current) == null || c.call($, L, fe);
836
875
  }
837
- E.current = "none", M.current && (M.current.style.cursor = "default"), m(), I == null || I();
876
+ F.current = "none", D.current && (D.current.style.cursor = "default"), g(), k == null || k();
838
877
  return;
839
878
  }
840
- E.current = "none", M.current && (M.current.style.cursor = "default"), I == null || I();
879
+ F.current = "none", D.current && (D.current.style.cursor = "default"), k == null || k();
841
880
  };
842
- return document.addEventListener("mousemove", e), document.addEventListener("mouseup", n), () => {
843
- document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", n);
881
+ return document.addEventListener("mousemove", t), document.addEventListener("mouseup", n), () => {
882
+ document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
844
883
  };
845
- }, [m, G, I, we, Me]);
846
- const N = ae((e) => {
847
- const n = gt(p.current, g.current, e);
848
- p.current = n.startMs, g.current = n.endMs, m();
849
- }, [m]), ne = ae((e) => {
850
- e.preventDefault();
851
- const n = M.current;
884
+ }, [g, z, k, Re, d]);
885
+ const G = he((t) => {
886
+ const n = Tt(o.current, v.current, t);
887
+ o.current = n.startMs, v.current = n.endMs, g();
888
+ }, [g]), ye = he((t) => {
889
+ t.preventDefault();
890
+ const n = D.current;
852
891
  if (!n) return;
853
- const r = n.getBoundingClientRect(), a = e.clientY - r.top, o = ee.current, c = C.current;
854
- if (o && c.length > 0) {
855
- const h = Math.max(0, r.height - Oe);
856
- if (a >= 0 && a < h) {
892
+ const r = n.getBoundingClientRect(), f = t.clientY - r.top, c = Q.current, i = E.current;
893
+ if (c && i.length > 0) {
894
+ const m = Math.max(0, r.height - Ye);
895
+ if (f >= 0 && f < m) {
857
896
  let l = 0;
858
- for (const Y of c) l += (Y.height ?? $e) + He;
859
- const T = Math.max(0, l - h);
860
- if (T > 0) {
861
- O.current = Math.max(0, Math.min(T, O.current + e.deltaY * xt)), m();
897
+ for (const L of i) l += (L.height ?? Ge) + Ve;
898
+ const M = Math.max(0, l - m);
899
+ if (M > 0) {
900
+ W.current = Math.max(0, Math.min(M, W.current + t.deltaY * Mt)), g();
862
901
  return;
863
902
  }
864
903
  }
865
904
  }
866
- N(Math.pow(1.05, e.deltaY > 0 ? -1 : 1));
867
- }, [N, m]);
868
- z(() => {
869
- const e = M.current;
870
- if (e)
871
- return e.addEventListener("wheel", ne, { passive: !1 }), () => e.removeEventListener("wheel", ne);
872
- }, [ne]), z(() => {
873
- const e = M.current;
874
- if (!e) return;
875
- const n = (o) => {
876
- o.preventDefault();
877
- const c = e.getBoundingClientRect();
878
- if (o.touches.length === 1) {
879
- const h = o.touches[0].clientX - c.left, l = Math.max(0, Math.min(c.width, h)), T = p.current + l / c.width * (g.current - p.current);
880
- je.current = L.current, pe.current = "scrub", ve.current = o.touches[0].clientX, Te.current = o.touches[0].clientX, L.current = T, m(), U == null || U(), G(D.JulianDate.fromDate(new Date(T)));
881
- } else o.touches.length >= 2 && (pe.current === "scrub" && (L.current = je.current, m(), G(D.JulianDate.fromDate(new Date(je.current)))), pe.current = "pinch", ye.current = Ie(o.touches[0], o.touches[1]), _e.current = (o.touches[0].clientX + o.touches[1].clientX) / 2 - c.left);
882
- }, r = (o) => {
883
- o.preventDefault();
884
- const c = e.getBoundingClientRect();
885
- if (pe.current === "scrub" && o.touches.length >= 1) {
886
- const h = o.touches[0].clientX - c.left, l = c.width * 0.08;
887
- if (Te.current = o.touches[0].clientX, h < l) we(-1);
888
- else if (h > c.width - l) we(1);
905
+ G(Math.pow(1.05, t.deltaY > 0 === K.current ? -1 : 1));
906
+ }, [G, g]);
907
+ I(() => {
908
+ const t = D.current;
909
+ if (t)
910
+ return t.addEventListener("wheel", ye, { passive: !1 }), () => t.removeEventListener("wheel", ye);
911
+ }, [ye]), I(() => {
912
+ const t = D.current;
913
+ if (!t) return;
914
+ const n = (c) => {
915
+ c.preventDefault();
916
+ const i = t.getBoundingClientRect();
917
+ if (c.touches.length === 1) {
918
+ const m = c.touches[0].clientX - i.left, l = Math.max(0, Math.min(i.width, m)), M = o.current + l / i.width * (v.current - o.current);
919
+ ke.current = b.current, ie.current ? (ae.current = "slide", Ee.current = c.touches[0].clientX) : (ae.current = "scrub", Ee.current = c.touches[0].clientX, De.current = c.touches[0].clientX, b.current = M, g(), Y == null || Y(), z(A.JulianDate.fromDate(new Date(M))));
920
+ } else c.touches.length >= 2 && (ae.current === "scrub" && (b.current = ke.current, g(), z(A.JulianDate.fromDate(new Date(ke.current)))), ae.current = "pinch", Ae.current = Je(c.touches[0], c.touches[1]), Le.current = (c.touches[0].clientX + c.touches[1].clientX) / 2 - i.left);
921
+ }, r = (c) => {
922
+ c.preventDefault();
923
+ const i = t.getBoundingClientRect();
924
+ if (ae.current === "scrub" && c.touches.length >= 1) {
925
+ const m = c.touches[0].clientX - i.left, l = i.width * 0.08;
926
+ if (De.current = c.touches[0].clientX, m < l) Re(-1);
927
+ else if (m > i.width - l) Re(1);
889
928
  else {
890
- Me();
891
- const T = Math.max(0, Math.min(c.width, h)), Y = p.current + T / c.width * (g.current - p.current);
892
- L.current = Y, m(), G(D.JulianDate.fromDate(new Date(Y)));
929
+ d();
930
+ const M = Math.max(0, Math.min(i.width, m)), L = o.current + M / i.width * (v.current - o.current);
931
+ b.current = L, g(), z(A.JulianDate.fromDate(new Date(L)));
893
932
  }
894
- } else if (pe.current === "slide" && o.touches.length >= 1) {
895
- const h = ve.current - o.touches[0].clientX;
896
- if (ve.current = o.touches[0].clientX, h !== 0) {
897
- const l = h / c.width * (g.current - p.current);
898
- p.current += l, g.current += l, m();
933
+ } else if (ae.current === "slide" && c.touches.length >= 1) {
934
+ const m = Ee.current - c.touches[0].clientX;
935
+ if (Ee.current = c.touches[0].clientX, m !== 0) {
936
+ const l = m / i.width * (v.current - o.current);
937
+ o.current += l, v.current += l, g();
899
938
  }
900
- } else if (pe.current === "pinch" && o.touches.length >= 2) {
901
- const h = Ie(o.touches[0], o.touches[1]), l = (o.touches[0].clientX + o.touches[1].clientX) / 2 - c.left;
902
- if (h > 0 && ye.current > 0) {
903
- const T = p.current + _e.current / c.width * (g.current - p.current), Y = Tt(p.current, g.current, ye.current / h, T);
904
- p.current = Y.startMs, g.current = Y.endMs, m();
939
+ } else if (ae.current === "pinch" && c.touches.length >= 2) {
940
+ const m = Je(c.touches[0], c.touches[1]), l = (c.touches[0].clientX + c.touches[1].clientX) / 2 - i.left;
941
+ if (m > 0 && Ae.current > 0) {
942
+ const M = o.current + Le.current / i.width * (v.current - o.current), L = Rt(o.current, v.current, Ae.current / m, M);
943
+ o.current = L.startMs, v.current = L.endMs, g();
905
944
  }
906
- ye.current = h, _e.current = l;
945
+ Ae.current = m, Le.current = l;
907
946
  }
908
- }, a = (o) => {
909
- Me(), pe.current === "scrub" && (I == null || I()), o.touches.length === 0 ? pe.current = "none" : o.touches.length === 1 && (pe.current = "slide", ve.current = o.touches[0].clientX);
947
+ }, f = (c) => {
948
+ d(), ae.current === "scrub" && (k == null || k()), c.touches.length === 0 ? ae.current = "none" : c.touches.length === 1 && (ae.current = "slide", Ee.current = c.touches[0].clientX);
910
949
  };
911
- return e.addEventListener("touchstart", n, { passive: !1 }), e.addEventListener("touchmove", r, { passive: !1 }), e.addEventListener("touchend", a, { passive: !1 }), () => {
912
- e.removeEventListener("touchstart", n), e.removeEventListener("touchmove", r), e.removeEventListener("touchend", a);
950
+ return t.addEventListener("touchstart", n, { passive: !1 }), t.addEventListener("touchmove", r, { passive: !1 }), t.addEventListener("touchend", f, { passive: !1 }), () => {
951
+ t.removeEventListener("touchstart", n), t.removeEventListener("touchmove", r), t.removeEventListener("touchend", f);
913
952
  };
914
- }, [m, U, I, G, N, we, Me]);
915
- const Ee = ae((e) => {
916
- var h, l, T;
917
- if (E.current !== "none") return;
918
- const n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, a = e.clientY - n.top, o = (L.current - p.current) / (g.current - p.current) * n.width, c = Math.abs(r - o) <= 10;
919
- if (P(a, n.height)) {
920
- const Y = i(r, a, n.width, n.height), me = j.current;
921
- if (Y)
922
- e.currentTarget.style.cursor = c ? "grab" : "pointer", (!me || me.item.id !== Y.item.id || me.lane.id !== Y.lane.id) && (j.current = Y, (h = k.current) == null || h.call(k, { laneId: Y.lane.id, item: Y.item, originalEvent: e.nativeEvent }), m());
923
- else if (me && (j.current = null, (l = k.current) == null || l.call(k, null), m()), c)
924
- e.currentTarget.style.cursor = "grab";
953
+ }, [g, Y, k, z, G, Re, d]);
954
+ const ct = he((t) => {
955
+ var m, l, M;
956
+ const n = t.currentTarget.getBoundingClientRect(), r = t.clientX - n.left, f = t.clientY - n.top;
957
+ if (F.current === "none")
958
+ if (ie.current)
959
+ be.current !== null && (be.current = null);
960
+ else {
961
+ const L = o.current + Math.max(0, Math.min(n.width, r)) / n.width * (v.current - o.current);
962
+ be.current !== L && (be.current = L);
963
+ }
964
+ if (F.current !== "none") {
965
+ be.current = null;
966
+ return;
967
+ }
968
+ const c = (b.current - o.current) / (v.current - o.current) * n.width, i = !ie.current && Math.abs(r - c) <= 10;
969
+ if (te(f, n.height)) {
970
+ const L = w(r, f, n.width, n.height), fe = e.current;
971
+ if (L)
972
+ t.currentTarget.style.cursor = i ? "grab" : "pointer", (!fe || fe.item.id !== L.item.id || fe.lane.id !== L.lane.id) && (e.current = L, (m = p.current) == null || m.call(p, { laneId: L.lane.id, item: L.item, originalEvent: t.nativeEvent }));
973
+ else if (fe && (e.current = null, (l = p.current) == null || l.call(p, null)), i)
974
+ t.currentTarget.style.cursor = "grab";
925
975
  else {
926
- const Re = R(r, a, n.height);
927
- e.currentTarget.style.cursor = Re && b.current ? "grab" : "default";
976
+ const Ce = P(r, f, n.height);
977
+ t.currentTarget.style.cursor = Ce && R.current ? "grab" : "default";
928
978
  }
979
+ g();
929
980
  return;
930
981
  }
931
- j.current && (j.current = null, (T = k.current) == null || T.call(k, null), m()), c ? e.currentTarget.style.cursor = "grab" : a >= n.height - Oe ? e.currentTarget.style.cursor = "crosshair" : e.currentTarget.style.cursor = "default";
932
- }, [m, i, P, R]), tt = ae((e) => {
933
- var h;
934
- if (performance.now() - ke.current > 300) return;
935
- const r = e.currentTarget.getBoundingClientRect(), a = e.clientX - r.left, o = e.clientY - r.top, c = i(a, o, r.width, r.height);
936
- c && ((h = V.current) == null || h.call(V, { laneId: c.lane.id, item: c.item, originalEvent: e.nativeEvent }));
937
- }, [i]), nt = ae((e) => {
938
- var c;
939
- const n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, a = e.clientY - n.top, o = i(r, a, n.width, n.height);
940
- o && ((c = t.current) == null || c.call(t, { laneId: o.lane.id, item: o.item, originalEvent: e.nativeEvent }));
941
- }, [i]), rt = ae((e) => {
942
- const n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, a = e.clientY - n.top, o = i(r, a, n.width, n.height);
943
- o && f.current ? (e.preventDefault(), f.current({ laneId: o.lane.id, item: o.item, originalEvent: e.nativeEvent })) : e.preventDefault();
944
- }, [i]);
945
- return z(() => () => {
946
- y.current !== null && cancelAnimationFrame(y.current), re.current !== null && cancelAnimationFrame(re.current);
982
+ e.current && (e.current = null, (M = p.current) == null || M.call(p, null)), i ? t.currentTarget.style.cursor = "grab" : !ie.current && f >= n.height - Ye ? t.currentTarget.style.cursor = "crosshair" : t.currentTarget.style.cursor = "default", g();
983
+ }, [g, w, te, P]), st = he((t) => {
984
+ var m;
985
+ if (performance.now() - Pe.current > 300) return;
986
+ const r = t.currentTarget.getBoundingClientRect(), f = t.clientX - r.left, c = t.clientY - r.top, i = w(f, c, r.width, r.height);
987
+ i && ((m = s.current) == null || m.call(s, { laneId: i.lane.id, item: i.item, originalEvent: t.nativeEvent }));
988
+ }, [w]), it = he((t) => {
989
+ var i;
990
+ const n = t.currentTarget.getBoundingClientRect(), r = t.clientX - n.left, f = t.clientY - n.top, c = w(r, f, n.width, n.height);
991
+ c && ((i = ue.current) == null || i.call(ue, { laneId: c.lane.id, item: c.item, originalEvent: t.nativeEvent }));
992
+ }, [w]), ut = he((t) => {
993
+ const n = t.currentTarget.getBoundingClientRect(), r = t.clientX - n.left, f = t.clientY - n.top, c = w(r, f, n.width, n.height);
994
+ c && ge.current ? (t.preventDefault(), ge.current({ laneId: c.lane.id, item: c.item, originalEvent: t.nativeEvent })) : t.preventDefault();
995
+ }, [w]);
996
+ return I(() => () => {
997
+ ee.current !== null && cancelAnimationFrame(ee.current), ce.current !== null && cancelAnimationFrame(ce.current);
947
998
  }, []), /* @__PURE__ */ u.jsx(
948
999
  "canvas",
949
1000
  {
950
- ref: M,
1001
+ ref: D,
951
1002
  style: { width: "100%", flex: 1, minHeight: 0, display: "block", cursor: "default" },
952
- onMouseDown: le,
953
- onMouseMove: Ee,
954
- onClick: tt,
955
- onDoubleClick: nt,
1003
+ onMouseDown: B,
1004
+ onMouseMove: ct,
1005
+ onClick: st,
1006
+ onDoubleClick: it,
956
1007
  onMouseLeave: () => {
957
- var e;
958
- j.current && (j.current = null, (e = k.current) == null || e.call(k, null), m()), E.current === "none" && M.current && (M.current.style.cursor = "default");
1008
+ var t;
1009
+ e.current && (e.current = null, (t = p.current) == null || t.call(p, null)), be.current = null, F.current === "none" && D.current && (D.current.style.cursor = "default"), g();
959
1010
  },
960
- onContextMenu: rt
1011
+ onContextMenu: ut
961
1012
  }
962
1013
  );
963
1014
  }
964
1015
  );
965
- et.displayName = "TimelineCanvas";
966
- const Ze = [2, 4, 8, 16, 32, 100, 1], Qe = [1, 2, 4, 8, 16, 32, 100], kt = ({
967
- startTime: F,
1016
+ ot.displayName = "TimelineCanvas";
1017
+ const nt = [2, 4, 8, 16, 32, 100, 1], rt = [1, 2, 4, 8, 16, 32, 100], Jt = ({
1018
+ startTime: j,
968
1019
  endTime: X,
969
- currentTime: K,
970
- clock: d,
971
- onTimeChange: _,
972
- onPlayPause: S,
973
- onMultiplierChange: W,
974
- height: $,
975
- showControls: de = !0,
976
- showJumpToStart: H,
977
- showJumpToEnd: G,
978
- enableDrag: U = !0,
979
- dateTimeFormat: I,
1020
+ currentTime: H,
1021
+ clock: h,
1022
+ onTimeChange: C,
1023
+ onPlayPause: _,
1024
+ onMultiplierChange: O,
1025
+ height: J,
1026
+ showControls: pe = !0,
1027
+ showJumpToStart: N,
1028
+ showJumpToEnd: z,
1029
+ enableDrag: Y = !0,
1030
+ dateTimeFormat: k,
980
1031
  onDateTimeClick: se,
981
- jumpToTime: Z,
982
- maxTicks: ie,
983
- ffSpeeds: te = Ze,
984
- rwSpeeds: ue = Qe,
985
- theme: w,
986
- className: v,
987
- timezone: Q,
988
- swimLanes: M,
989
- showSwimLanes: B,
990
- onShowSwimLanesChange: oe,
991
- swimLaneTransition: ge = "animated",
992
- onSwimLaneItemClick: ce,
993
- onSwimLaneItemHover: A,
994
- onSwimLaneItemDoubleClick: p,
995
- onSwimLaneItemContextMenu: g,
996
- onSwimLaneReorder: L,
997
- onRangeSelect: C,
998
- labels: ee
1032
+ jumpToTime: U,
1033
+ maxTicks: le,
1034
+ ffSpeeds: V = nt,
1035
+ rwSpeeds: de = rt,
1036
+ theme: y,
1037
+ className: T,
1038
+ timezone: q,
1039
+ swimLanes: ne,
1040
+ showSwimLanes: Z,
1041
+ onShowSwimLanesChange: D,
1042
+ swimLaneTransition: S = "animated",
1043
+ onSwimLaneItemClick: re,
1044
+ onSwimLaneItemHover: me,
1045
+ onSwimLaneItemDoubleClick: Te,
1046
+ onSwimLaneItemContextMenu: oe,
1047
+ onSwimLaneReorder: o,
1048
+ onRangeSelect: v,
1049
+ labels: b,
1050
+ liveButtonSize: ie,
1051
+ liveButtonPosition: K,
1052
+ live: E,
1053
+ invertScrollZoom: Q
999
1054
  }) => {
1000
- const O = () => Date.now(), j = F ? D.JulianDate.toDate(De(F)).getTime() : O() - 432e5, s = X ? D.JulianDate.toDate(De(X)).getTime() : O() + 12 * 3600 * 1e3, [V, k] = Ae(
1001
- () => De(K ?? F ?? D.JulianDate.fromDate(/* @__PURE__ */ new Date()))
1002
- ), [t, f] = Ae((d == null ? void 0 : d.shouldAnimate) ?? !1), [b, y] = Ae((d == null ? void 0 : d.multiplier) ?? 1), [re, he] = Ae(B ?? !0);
1003
- z(() => {
1004
- B != null && he(B);
1005
- }, [B]);
1006
- const J = () => {
1007
- const i = !re;
1008
- he(i), oe == null || oe(i);
1009
- }, E = M != null && M.length > 0, fe = x(null), [Te, ke] = Ae(0);
1010
- z(() => {
1011
- const i = fe.current;
1012
- if (!i) return;
1013
- const R = new ResizeObserver(([P]) => ke(P.borderBoxSize[0].blockSize));
1014
- return R.observe(i), () => R.disconnect();
1015
- }, [de]);
1016
- const Fe = E && !re ? `${Te + Oe}px` : $ != null ? `${$}px` : "100%", xe = x(!1), q = x(null), pe = { ...wt, ...w };
1017
- z(() => {
1055
+ const W = () => Date.now(), e = j ? A.JulianDate.toDate(_e(j)).getTime() : W() - 432e5, a = X ? A.JulianDate.toDate(_e(X)).getTime() : W() + 12 * 3600 * 1e3, [s, p] = Se(
1056
+ () => _e(H ?? j ?? A.JulianDate.fromDate(/* @__PURE__ */ new Date()))
1057
+ ), [ue, ge] = Se((h == null ? void 0 : h.shouldAnimate) ?? !1), [R, ee] = Se((h == null ? void 0 : h.multiplier) ?? 1), [ce, Me] = Se(Z ?? !0);
1058
+ I(() => {
1059
+ Z != null && Me(Z);
1060
+ }, [Z]);
1061
+ const Xe = () => {
1062
+ const d = !ce;
1063
+ Me(d), D == null || D(d);
1064
+ }, F = ne != null && ne.length > 0, xe = x(null), [De, Pe] = Se(0);
1065
+ I(() => {
1066
+ const d = xe.current;
1018
1067
  if (!d) return;
1019
- const i = () => {
1020
- if (!xe.current) {
1021
- const R = D.JulianDate.clone(d.currentTime);
1022
- if (k(R), f(d.shouldAnimate), y(d.multiplier), q.current) {
1023
- const { startMs: P, endMs: le } = q.current.getVisibleRange(), N = le - P, ne = D.JulianDate.toDate(R).getTime(), Ee = ne - P;
1024
- Ee <= N * 0.1 ? q.current.zoomTo(ne - N * 0.1, ne + N * 0.9, ne) : Ee >= N * 0.9 && q.current.zoomTo(ne - N * 0.9, ne + N * 0.1, ne);
1068
+ const w = new ResizeObserver(([P]) => Pe(P.borderBoxSize[0].blockSize));
1069
+ return w.observe(d), () => w.disconnect();
1070
+ }, [pe]);
1071
+ const Oe = F && !ce ? `${De + Ye}px` : J != null ? `${J}px` : "100%", ve = x(!1), $ = x(null), be = { ...Dt, ...y };
1072
+ I(() => {
1073
+ if (!h) return;
1074
+ const d = () => {
1075
+ if (!ve.current) {
1076
+ const w = A.JulianDate.clone(h.currentTime);
1077
+ if (p(w), ge(h.shouldAnimate), ee(h.multiplier), $.current) {
1078
+ const { startMs: P, endMs: te } = $.current.getVisibleRange(), B = te - P, G = A.JulianDate.toDate(w).getTime(), ye = G - P;
1079
+ ye <= B * 0.1 ? $.current.zoomTo(G - B * 0.1, G + B * 0.9, G) : ye >= B * 0.9 && $.current.zoomTo(G - B * 0.9, G + B * 0.1, G);
1025
1080
  }
1026
1081
  }
1027
1082
  };
1028
- return d.onTick.addEventListener(i), () => {
1029
- d.onTick.removeEventListener(i);
1083
+ return h.onTick.addEventListener(d), () => {
1084
+ h.onTick.removeEventListener(d);
1030
1085
  };
1031
- }, [d]), z(() => {
1032
- if (d) return;
1033
- const i = setInterval(() => {
1034
- if (xe.current) return;
1035
- const R = D.JulianDate.fromDate(/* @__PURE__ */ new Date());
1036
- if (k(R), q.current) {
1037
- const { startMs: P, endMs: le } = q.current.getVisibleRange(), N = le - P, ne = D.JulianDate.toDate(R).getTime(), Ee = ne - P;
1038
- Ee <= N * 0.1 ? q.current.zoomTo(ne - N * 0.1, ne + N * 0.9, ne) : Ee >= N * 0.9 && q.current.zoomTo(ne - N * 0.9, ne + N * 0.1, ne);
1086
+ }, [h]), I(() => {
1087
+ if (h) return;
1088
+ const d = setInterval(() => {
1089
+ if (ve.current) return;
1090
+ const w = A.JulianDate.fromDate(/* @__PURE__ */ new Date());
1091
+ if (p(w), $.current) {
1092
+ const { startMs: P, endMs: te } = $.current.getVisibleRange(), B = te - P, G = A.JulianDate.toDate(w).getTime(), ye = G - P;
1093
+ ye <= B * 0.1 ? $.current.zoomTo(G - B * 0.1, G + B * 0.9, G) : ye >= B * 0.9 && $.current.zoomTo(G - B * 0.9, G + B * 0.1, G);
1039
1094
  }
1040
1095
  }, 1e3);
1041
- return () => clearInterval(i);
1042
- }, [d]), z(() => {
1043
- if (!Z) return;
1044
- const i = De(Z);
1045
- if (ye(i), q.current) {
1046
- const { startMs: R, endMs: P } = q.current.getVisibleRange(), le = P - R, N = D.JulianDate.toDate(i).getTime();
1047
- q.current.zoomTo(N - le / 2, N + le / 2);
1096
+ return () => clearInterval(d);
1097
+ }, [h]), I(() => {
1098
+ if (!U || E) return;
1099
+ const d = _e(U);
1100
+ if (Ee(d), $.current) {
1101
+ const { startMs: w, endMs: P } = $.current.getVisibleRange(), te = P - w, B = A.JulianDate.toDate(d).getTime();
1102
+ $.current.zoomTo(B - te / 2, B + te / 2);
1048
1103
  }
1049
- }, [Z]);
1050
- const ve = (i, R = !0) => {
1051
- d && (d.multiplier = i, R && (d.shouldAnimate = !0)), y(i), R && f(!0), W == null || W(i);
1052
- }, ye = (i) => {
1053
- k(i), d && (d.currentTime = D.JulianDate.clone(i)), _ == null || _(i);
1054
- }, _e = (i) => {
1055
- i && b < 0 && ve(1, !1), d && (d.shouldAnimate = i), f(i), S == null || S(i);
1056
- }, je = () => {
1057
- const i = te.length > 0 ? te : Ze, R = b > 1 ? b : 1, P = i.indexOf(R), le = i[P < 0 || P === i.length - 1 ? 0 : P + 1];
1058
- ve(le);
1059
- }, Ie = () => {
1060
- const i = ue.length > 0 ? ue : Qe, R = b < 0 ? Math.abs(b) : 0, P = i.indexOf(R), le = -i[P < 0 || P === i.length - 1 ? 0 : P + 1];
1061
- ve(le);
1062
- }, be = () => {
1063
- var R;
1064
- const i = De(F ?? D.JulianDate.fromDate(new Date(j)));
1065
- d && (d.currentTime = D.JulianDate.clone(i)), k(i), (R = q.current) == null || R.zoomTo(j, s);
1066
- }, m = () => {
1067
- var R;
1068
- const i = De(X ?? D.JulianDate.fromDate(new Date(s)));
1069
- d && (d.currentTime = D.JulianDate.clone(i)), k(i), (R = q.current) == null || R.zoomTo(j, s);
1104
+ }, [U]);
1105
+ const ae = (d, w = !0) => {
1106
+ h && (h.multiplier = d, w && (h.shouldAnimate = !0)), ee(d), w && ge(!0), O == null || O(d);
1107
+ }, Ee = (d) => {
1108
+ p(d), h && (h.currentTime = A.JulianDate.clone(d)), C == null || C(d);
1109
+ }, Ae = (d) => {
1110
+ d && R < 0 && ae(1, !1), h && (h.shouldAnimate = d), ge(d), _ == null || _(d);
1111
+ }, Le = () => {
1112
+ const d = V.length > 0 ? V : nt, w = R > 1 ? R : 1, P = d.indexOf(w), te = d[P < 0 || P === d.length - 1 ? 0 : P + 1];
1113
+ ae(te);
1114
+ }, ke = () => {
1115
+ const d = de.length > 0 ? de : rt, w = R < 0 ? Math.abs(R) : 0, P = d.indexOf(w), te = -d[P < 0 || P === d.length - 1 ? 0 : P + 1];
1116
+ ae(te);
1117
+ }, Je = () => {
1118
+ var w;
1119
+ const d = _e(j ?? A.JulianDate.fromDate(new Date(e)));
1120
+ h && (h.currentTime = A.JulianDate.clone(d)), p(d), (w = $.current) == null || w.zoomTo(e, a);
1070
1121
  }, we = () => {
1071
- const i = D.JulianDate.fromDate(/* @__PURE__ */ new Date());
1072
- d && (d.currentTime = D.JulianDate.clone(i)), k(i), ve(1);
1073
- const R = Date.now();
1074
- if (q.current) {
1075
- const { startMs: P, endMs: le } = q.current.getVisibleRange(), N = le - P;
1076
- q.current.zoomTo(R - N / 2, R + N / 2);
1122
+ var w;
1123
+ const d = _e(X ?? A.JulianDate.fromDate(new Date(a)));
1124
+ h && (h.currentTime = A.JulianDate.clone(d)), p(d), (w = $.current) == null || w.zoomTo(e, a);
1125
+ }, g = () => {
1126
+ const d = A.JulianDate.fromDate(/* @__PURE__ */ new Date());
1127
+ h && (h.currentTime = A.JulianDate.clone(d)), p(d), ae(1);
1128
+ const w = Date.now();
1129
+ if ($.current) {
1130
+ const { startMs: P, endMs: te } = $.current.getVisibleRange(), B = te - P;
1131
+ $.current.zoomTo(w - B / 2, w + B / 2);
1077
1132
  }
1078
- }, Me = Math.abs(D.JulianDate.toDate(V).getTime() - Date.now()) < 1e4;
1133
+ }, Re = Math.abs(A.JulianDate.toDate(s).getTime() - Date.now()) < 2e3;
1079
1134
  return /* @__PURE__ */ u.jsxs(
1080
1135
  "div",
1081
1136
  {
1082
- className: v,
1137
+ className: T,
1083
1138
  style: {
1084
1139
  width: "100%",
1085
- height: Fe,
1140
+ height: Oe,
1086
1141
  overflow: "hidden",
1087
1142
  display: "flex",
1088
1143
  flexDirection: "column",
1089
1144
  fontFamily: "system-ui, -apple-system, sans-serif",
1090
- transition: ge === "animated" ? "height 0.2s ease" : void 0
1145
+ transition: S === "animated" ? "height 0.2s ease" : void 0
1091
1146
  },
1092
1147
  children: [
1093
- de && /* @__PURE__ */ u.jsx("div", { ref: fe, children: /* @__PURE__ */ u.jsx(
1094
- jt,
1148
+ pe && /* @__PURE__ */ u.jsx("div", { ref: xe, children: /* @__PURE__ */ u.jsx(
1149
+ Xt,
1095
1150
  {
1096
- currentTime: V,
1097
- isPlaying: t,
1098
- multiplier: b,
1099
- isLive: Me,
1100
- hasStartTime: F != null,
1151
+ currentTime: s,
1152
+ isPlaying: ue,
1153
+ multiplier: R,
1154
+ isLive: Re,
1155
+ hasStartTime: j != null,
1101
1156
  hasEndTime: X != null,
1102
- showJumpToStart: H,
1103
- showJumpToEnd: G,
1104
- onPlayPause: _e,
1105
- onJumpToStart: be,
1106
- onRewind: Ie,
1107
- onFastForward: je,
1108
- onJumpToEnd: m,
1109
- onJumpToLive: we,
1110
- onResetSpeed: () => ve(1),
1157
+ showJumpToStart: N,
1158
+ showJumpToEnd: z,
1159
+ onPlayPause: Ae,
1160
+ onJumpToStart: Je,
1161
+ onRewind: ke,
1162
+ onFastForward: Le,
1163
+ onJumpToEnd: we,
1164
+ onJumpToLive: g,
1165
+ onResetSpeed: () => ae(1),
1111
1166
  onDateTimeClick: se,
1112
- dateTimeFormat: I,
1113
- timezone: Q,
1114
- theme: pe,
1115
- swimLanesVisible: E ? re : void 0,
1116
- onToggleSwimLanes: E ? J : void 0,
1117
- labels: ee
1167
+ dateTimeFormat: k,
1168
+ timezone: q,
1169
+ theme: be,
1170
+ swimLanesVisible: F ? ce : void 0,
1171
+ onToggleSwimLanes: F ? Xe : void 0,
1172
+ labels: b,
1173
+ liveButtonSize: ie,
1174
+ liveButtonPosition: K,
1175
+ live: E
1118
1176
  }
1119
1177
  ) }),
1120
- U !== !1 && /* @__PURE__ */ u.jsx(
1121
- et,
1178
+ (Y !== !1 || E) && /* @__PURE__ */ u.jsx(
1179
+ ot,
1122
1180
  {
1123
- ref: q,
1124
- currentTime: V,
1125
- defaultStartMs: j,
1126
- defaultEndMs: s,
1127
- theme: pe,
1128
- maxTicks: ie,
1129
- timezone: Q,
1130
- dateTimeFormat: I,
1131
- months: ee == null ? void 0 : ee.months,
1132
- onTimeChange: ye,
1181
+ ref: $,
1182
+ currentTime: s,
1183
+ defaultStartMs: e,
1184
+ defaultEndMs: a,
1185
+ theme: be,
1186
+ maxTicks: le,
1187
+ timezone: q,
1188
+ dateTimeFormat: k,
1189
+ months: b == null ? void 0 : b.months,
1190
+ onTimeChange: Ee,
1133
1191
  onDragStart: () => {
1134
- xe.current = !0;
1192
+ ve.current = !0;
1135
1193
  },
1136
1194
  onDragEnd: () => {
1137
- xe.current = !1;
1195
+ ve.current = !1;
1138
1196
  },
1139
- swimLanes: M,
1140
- showSwimLanes: re,
1141
- onSwimLaneItemClick: ce,
1142
- onSwimLaneItemHover: A,
1143
- onSwimLaneItemDoubleClick: p,
1144
- onSwimLaneItemContextMenu: g,
1145
- onSwimLaneReorder: L,
1146
- onRangeSelect: C
1197
+ disableNeedleDrag: !!E,
1198
+ invertScrollZoom: Q,
1199
+ swimLanes: ne,
1200
+ showSwimLanes: ce,
1201
+ onSwimLaneItemClick: re,
1202
+ onSwimLaneItemHover: me,
1203
+ onSwimLaneItemDoubleClick: Te,
1204
+ onSwimLaneItemContextMenu: oe,
1205
+ onSwimLaneReorder: o,
1206
+ onRangeSelect: v
1147
1207
  }
1148
1208
  )
1149
1209
  ]
1150
1210
  }
1151
1211
  );
1152
- }, Ft = ({
1153
- startTime: F,
1212
+ }, Nt = ({
1213
+ startTime: j,
1154
1214
  endTime: X,
1155
- currentTime: K,
1156
- width: d,
1157
- height: _,
1158
- tickInterval: S,
1159
- showLabels: W,
1160
- snapToTicks: $,
1161
- enableDrag: de,
1162
- theme: H,
1163
- onTimeChange: G,
1164
- onVisibleRangeChange: U,
1165
- onDragStart: I,
1215
+ currentTime: H,
1216
+ width: h,
1217
+ height: C,
1218
+ tickInterval: _,
1219
+ showLabels: O,
1220
+ snapToTicks: J,
1221
+ enableDrag: pe,
1222
+ theme: N,
1223
+ onTimeChange: z,
1224
+ onVisibleRangeChange: Y,
1225
+ onDragStart: k,
1166
1226
  onDragEnd: se
1167
1227
  }) => {
1168
- const Z = Ne(
1169
- () => Mt(F, X, S, d),
1170
- [F, X, S, d]
1171
- ), ie = Ne(
1172
- () => yt(K, F, X, d),
1173
- [K, F, X, d]
1174
- ), te = x(null), ue = (v) => {
1175
- if (!de) return;
1176
- const Q = v.currentTarget.getBoundingClientRect(), M = v.clientX - Q.left, B = Math.max(0, Math.min(d, M));
1177
- if (!(Math.abs(B - ie) <= 10)) {
1178
- let j = B;
1179
- $ && (j = Et(B, Z, 10));
1180
- const s = new Date(F).getTime(), V = new Date(X).getTime();
1181
- G(D.JulianDate.fromDate(new Date(s + j / d * (V - s))));
1228
+ const U = We(
1229
+ () => At(j, X, _, h),
1230
+ [j, X, _, h]
1231
+ ), le = We(
1232
+ () => Ct(H, j, X, h),
1233
+ [H, j, X, h]
1234
+ ), V = x(null), de = (T) => {
1235
+ if (!pe) return;
1236
+ const q = T.currentTarget.getBoundingClientRect(), ne = T.clientX - q.left, Z = Math.max(0, Math.min(h, ne));
1237
+ if (!(Math.abs(Z - le) <= 10)) {
1238
+ let K = Z;
1239
+ J && (K = _t(Z, U, 10));
1240
+ const E = new Date(j).getTime(), Q = new Date(X).getTime();
1241
+ z(A.JulianDate.fromDate(new Date(E + K / h * (Q - E))));
1182
1242
  return;
1183
1243
  }
1184
- I == null || I();
1185
- const ge = v.clientX, ce = new Date(K).getTime(), A = new Date(F).getTime(), g = (new Date(X).getTime() - A) / d;
1186
- let L = 0, C = !1;
1187
- const ee = (j) => {
1188
- L = j.clientX - ge, C = !0, te.current || (te.current = requestAnimationFrame(() => {
1189
- if (C) {
1190
- const s = ce + L * g;
1191
- G(D.JulianDate.fromDate(new Date(s))), C = !1;
1244
+ k == null || k();
1245
+ const S = T.clientX, re = new Date(H).getTime(), me = new Date(j).getTime(), oe = (new Date(X).getTime() - me) / h;
1246
+ let o = 0, v = !1;
1247
+ const b = (K) => {
1248
+ o = K.clientX - S, v = !0, V.current || (V.current = requestAnimationFrame(() => {
1249
+ if (v) {
1250
+ const E = re + o * oe;
1251
+ z(A.JulianDate.fromDate(new Date(E))), v = !1;
1192
1252
  }
1193
- te.current = null;
1253
+ V.current = null;
1194
1254
  }));
1195
- }, O = () => {
1196
- document.removeEventListener("mousemove", ee), document.removeEventListener("mouseup", O), te.current !== null && (cancelAnimationFrame(te.current), te.current = null), se == null || se();
1255
+ }, ie = () => {
1256
+ document.removeEventListener("mousemove", b), document.removeEventListener("mouseup", ie), V.current !== null && (cancelAnimationFrame(V.current), V.current = null), se == null || se();
1197
1257
  };
1198
- document.addEventListener("mousemove", ee), document.addEventListener("mouseup", O);
1199
- }, w = (v) => {
1200
- v.preventDefault();
1201
- const Q = v.shiftKey ? v.deltaY : v.deltaX !== 0 ? v.deltaX : v.deltaY;
1202
- if (Math.abs(Q) < 1) return;
1203
- const M = new Date(F).getTime(), B = new Date(X).getTime(), oe = Q / d * (B - M) * 0.5;
1204
- U == null || U(
1205
- D.JulianDate.fromDate(new Date(M + oe)),
1206
- D.JulianDate.fromDate(new Date(B + oe))
1258
+ document.addEventListener("mousemove", b), document.addEventListener("mouseup", ie);
1259
+ }, y = (T) => {
1260
+ T.preventDefault();
1261
+ const q = T.shiftKey ? T.deltaY : T.deltaX !== 0 ? T.deltaX : T.deltaY;
1262
+ if (Math.abs(q) < 1) return;
1263
+ const ne = new Date(j).getTime(), Z = new Date(X).getTime(), D = q / h * (Z - ne) * 0.5;
1264
+ Y == null || Y(
1265
+ A.JulianDate.fromDate(new Date(ne + D)),
1266
+ A.JulianDate.fromDate(new Date(Z + D))
1207
1267
  );
1208
1268
  };
1209
1269
  return /* @__PURE__ */ u.jsxs(
1210
1270
  "svg",
1211
1271
  {
1212
1272
  width: "100%",
1213
- height: _,
1214
- style: { backgroundColor: H.backgroundColor, display: "block", cursor: "default" },
1215
- onMouseDown: ue,
1216
- onWheel: w,
1273
+ height: C,
1274
+ style: { backgroundColor: N.backgroundColor, display: "block", cursor: "default" },
1275
+ onMouseDown: de,
1276
+ onWheel: y,
1217
1277
  children: [
1218
- /* @__PURE__ */ u.jsx("rect", { width: d, height: _, fill: H.backgroundColor }),
1219
- Z.map((v, Q) => /* @__PURE__ */ u.jsxs("g", { children: [
1278
+ /* @__PURE__ */ u.jsx("rect", { width: h, height: C, fill: N.backgroundColor }),
1279
+ U.map((T, q) => /* @__PURE__ */ u.jsxs("g", { children: [
1220
1280
  /* @__PURE__ */ u.jsx(
1221
1281
  "line",
1222
1282
  {
1223
- x1: v.position,
1224
- y1: _ - (v.isMajor ? H.majorTickHeight : H.minorTickHeight),
1225
- x2: v.position,
1226
- y2: _,
1227
- stroke: v.isMajor ? H.majorTickColor : H.tickColor,
1283
+ x1: T.position,
1284
+ y1: C - (T.isMajor ? N.majorTickHeight : N.minorTickHeight),
1285
+ x2: T.position,
1286
+ y2: C,
1287
+ stroke: T.isMajor ? N.majorTickColor : N.tickColor,
1228
1288
  strokeWidth: "1"
1229
1289
  }
1230
1290
  ),
1231
- W && v.isMajor && v.label && /* @__PURE__ */ u.jsx(
1291
+ O && T.isMajor && T.label && /* @__PURE__ */ u.jsx(
1232
1292
  "text",
1233
1293
  {
1234
- x: v.position,
1235
- y: _ - H.majorTickHeight - 5,
1294
+ x: T.position,
1295
+ y: C - N.majorTickHeight - 5,
1236
1296
  textAnchor: "middle",
1237
- fill: H.labelColor,
1238
- fontSize: H.fontSize,
1297
+ fill: N.labelColor,
1298
+ fontSize: N.fontSize,
1239
1299
  fontFamily: "monospace",
1240
- children: v.label
1300
+ children: T.label
1241
1301
  }
1242
1302
  )
1243
- ] }, Q)),
1303
+ ] }, q)),
1244
1304
  /* @__PURE__ */ u.jsx(
1245
1305
  "line",
1246
1306
  {
1247
- x1: ie,
1307
+ x1: le,
1248
1308
  y1: 0,
1249
- x2: ie,
1250
- y2: _,
1251
- stroke: H.indicatorColor,
1252
- strokeWidth: H.indicatorLineWidth,
1309
+ x2: le,
1310
+ y2: C,
1311
+ stroke: N.indicatorColor,
1312
+ strokeWidth: N.indicatorLineWidth,
1253
1313
  pointerEvents: "none"
1254
1314
  }
1255
1315
  ),
1256
- de && /* @__PURE__ */ u.jsx(
1316
+ pe && /* @__PURE__ */ u.jsx(
1257
1317
  "rect",
1258
1318
  {
1259
- x: Math.max(0, ie - 10),
1319
+ x: Math.max(0, le - 10),
1260
1320
  y: 0,
1261
1321
  width: 20,
1262
- height: _,
1322
+ height: C,
1263
1323
  fill: "transparent",
1264
1324
  style: { cursor: "ew-resize" },
1265
1325
  pointerEvents: "visiblePainted"
1266
1326
  }
1267
1327
  ),
1268
- /* @__PURE__ */ u.jsx("circle", { cx: ie, cy: 5, r: 4, fill: H.indicatorColor, pointerEvents: "none" })
1328
+ /* @__PURE__ */ u.jsx("circle", { cx: le, cy: 5, r: 4, fill: N.indicatorColor, pointerEvents: "none" })
1269
1329
  ]
1270
1330
  }
1271
1331
  );
1272
1332
  };
1273
1333
  export {
1274
- Ot as TICK_AREA_HEIGHT,
1275
- kt as Timeline,
1276
- et as TimelineCanvas,
1277
- jt as TimelineControls,
1278
- Ft as TimelineSVG
1334
+ Wt as TICK_AREA_HEIGHT,
1335
+ Jt as Timeline,
1336
+ ot as TimelineCanvas,
1337
+ Xt as TimelineControls,
1338
+ Nt as TimelineSVG
1279
1339
  };