@kteneyck/cesium-timeline-react 0.8.0 → 0.10.0

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