@cyca/react-timeline-editor 0.2.1-alpha.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.
@@ -0,0 +1,3031 @@
1
+ import * as React$1 from "react";
2
+ import React, { useCallback, useEffect, useEffectEvent, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
3
+ import { flushSync } from "react-dom";
4
+ var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __commonJSMin = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), __copyProps = (e, t, n, r) => {
5
+ if (t && typeof t == "object" || typeof t == "function") for (var i = __getOwnPropNames(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !__hasOwnProp.call(e, s) && s !== n && __defProp(e, s, {
6
+ get: ((e) => t[e]).bind(null, s),
7
+ enumerable: !(r = __getOwnPropDesc(t, s)) || r.enumerable
8
+ });
9
+ return e;
10
+ }, __toESM = (e, t, n) => (n = e == null ? {} : __create(__getProtoOf(e)), __copyProps(t || !e || !e.__esModule ? __defProp(n, "default", {
11
+ value: e,
12
+ enumerable: !0
13
+ }) : n, e)), __require = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
14
+ if (typeof require < "u") return require.apply(this, arguments);
15
+ throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function.");
16
+ });
17
+ const PREFIX = "timeline-editor";
18
+ var LEVEL_TO_NUM = {
19
+ trace: 0,
20
+ debug: 1,
21
+ info: 2,
22
+ warn: 3,
23
+ error: 4,
24
+ silent: 5
25
+ }, M = [
26
+ "trace",
27
+ "debug",
28
+ "info",
29
+ "warn",
30
+ "error"
31
+ ], Logger = class e {
32
+ s;
33
+ ls = /* @__PURE__ */ new Map();
34
+ lvl;
35
+ def;
36
+ n;
37
+ r;
38
+ c = console;
39
+ e;
40
+ trace;
41
+ debug;
42
+ info;
43
+ warn;
44
+ error;
45
+ constructor(e, t, n, r) {
46
+ this.s = e, this.e = t, this.n = n, this.r = r, this.bindMethods();
47
+ }
48
+ noop = () => {};
49
+ bindMethods() {
50
+ M.forEach((e) => {
51
+ let t = this.e.bind(this.c, e, this.n);
52
+ Object.defineProperty(this, e, {
53
+ get: () => LEVEL_TO_NUM[e] >= LEVEL_TO_NUM[this.currentLevel()] ? t : this.noop,
54
+ configurable: !0
55
+ });
56
+ });
57
+ }
58
+ storageKey() {
59
+ return this.n ? `loglevel:${String(this.n)}` : "loglevel";
60
+ }
61
+ currentLevel() {
62
+ if (this.lvl) return this.lvl;
63
+ let e = this.s.get(this.storageKey());
64
+ return e && e in LEVEL_TO_NUM ? (this.lvl = e, this.lvl) : this.def ? this.def : this.r ? this.r.currentLevel() : "trace";
65
+ }
66
+ setLevel(e) {
67
+ return this.lvl = e, this.s.set(this.storageKey(), e), this;
68
+ }
69
+ setDefaultLevel(e) {
70
+ return this.s.get(this.storageKey()) || (this.def = e), this;
71
+ }
72
+ resetLevel() {
73
+ return this.lvl = void 0, this.s.del(this.storageKey()), this;
74
+ }
75
+ getLogger(t) {
76
+ if (!t) throw Error("Logger name required");
77
+ if (!this.ls.has(t)) {
78
+ let n = new e(this.s, this.e, t, this.r || this);
79
+ this.ls.set(t, createProxy(n));
80
+ }
81
+ return this.ls.get(t);
82
+ }
83
+ getLoggers() {
84
+ let e = {};
85
+ return this.ls.forEach((t, n) => {
86
+ e[String(n)] = t;
87
+ }), e;
88
+ }
89
+ use(e) {
90
+ this.c = e, this.bindMethods();
91
+ }
92
+ };
93
+ function createProxy(e) {
94
+ return new Proxy(e, { get(e, t, n) {
95
+ if (t in e) return Reflect.get(e, t, n);
96
+ let r = e.c[t];
97
+ return typeof r == "function" ? r.bind(e.c) : r;
98
+ } });
99
+ }
100
+ var LSStorage = class {
101
+ get(e) {
102
+ return localStorage.getItem(e);
103
+ }
104
+ set(e, t) {
105
+ localStorage.setItem(e, t);
106
+ }
107
+ del(e) {
108
+ localStorage.removeItem(e);
109
+ }
110
+ }, colors = {
111
+ trace: "#95bdb7",
112
+ debug: "#ad95b8",
113
+ info: "#b6bd73",
114
+ warn: "#88a1bb",
115
+ error: "#bf6c69"
116
+ }, symbols = {
117
+ info: "⚡️",
118
+ success: "✔",
119
+ warn: "▲",
120
+ error: "✖",
121
+ log: "●",
122
+ trace: "◔",
123
+ debug: "◌"
124
+ }, log = createProxy(new Logger(new LSStorage(), { bind(e, t, n) {
125
+ let r = n ? `${symbols[t]} ${String(n)}:` : `${symbols[t]}`;
126
+ return (e[t] || e.log).bind(e, `%c${r}%c`, `color: ${colors[t]}; font-weight: bold;`, "color: inherit");
127
+ } }));
128
+ function checkProps(e) {
129
+ let { editorData: t = [], effects: n = {}, scrollTop: r = 0, scale: i = 1, scaleSplitCount: a = 10, scaleWidth: o = 160, startLeft: s = 20, minScaleCount: c = 20, maxScaleCount: l = Infinity, rowHeight: u = 32 } = e;
130
+ i <= 0 && (log.error("Error: scale must be greater than 0!"), i = 1), r < 0 && (log.warn("Warning: scrollTop cannot be less than 0!"), r = 0), a <= 0 && (log.warn("Warning: scaleSplitCount cannot be less than 1!"), a = 1), o <= 0 && (log.warn("Warning: scaleWidth must be greater than 0!"), o = 160), s < 0 && (log.warn("Warning: startLeft cannot be less than 0!"), s = 0), c < 1 && (log.warn("Warning: minScaleCount must be greater than 1!"), c = 20), c = parseInt(c + ""), l < c && (log.warn("Warning: maxScaleCount cannot be less than minScaleCount!"), l = c), l = l === Infinity ? Infinity : parseInt(l + ""), u <= 0 && (log.warn("Warning: rowHeight must be greater than 0!"), u = 32);
131
+ let d = { ...e };
132
+ return delete d.style, {
133
+ ...d,
134
+ editorData: t,
135
+ effects: n,
136
+ scrollTop: r,
137
+ scale: i,
138
+ scaleSplitCount: a,
139
+ scaleWidth: o,
140
+ startLeft: s,
141
+ minScaleCount: c,
142
+ maxScaleCount: l,
143
+ rowHeight: u
144
+ };
145
+ }
146
+ function parserTimeToPixel(e, t) {
147
+ let { startLeft: n, scale: r, scaleWidth: i } = t;
148
+ return n + e / r * i;
149
+ }
150
+ function parserPixelToTime(e, t) {
151
+ let { startLeft: n, scale: r, scaleWidth: i } = t;
152
+ return (e - n) / i * r;
153
+ }
154
+ function parserTransformToTime(e, t) {
155
+ let { left: n, width: r } = e, i = parserPixelToTime(n, t), a = parserPixelToTime(n + r, t);
156
+ return {
157
+ start: i,
158
+ end: a
159
+ };
160
+ }
161
+ function parserTimeToTransform(e, t) {
162
+ let { start: n, end: r } = e, i = parserTimeToPixel(n, t), a = parserTimeToPixel(r, t) - i;
163
+ return {
164
+ left: i,
165
+ width: a
166
+ };
167
+ }
168
+ function getScaleCountByRows(e, t) {
169
+ let n = 0;
170
+ return e.forEach((e) => {
171
+ e.actions.forEach((e) => {
172
+ n = Math.max(n, e.end);
173
+ });
174
+ }), Math.ceil(n / t.scale) + 5;
175
+ }
176
+ function getScaleCountByPixel(e, t) {
177
+ let { startLeft: n, scaleWidth: r } = t, i = Math.ceil((e - n) / r);
178
+ return Math.max(i + 5, t.scaleCount);
179
+ }
180
+ function parserActionsToPositions(e, t) {
181
+ let n = [];
182
+ return e.forEach((e) => {
183
+ n.push(parserTimeToPixel(e.start, t)), n.push(parserTimeToPixel(e.end, t));
184
+ }), n;
185
+ }
186
+ var require_react_compiler_runtime_production = /* @__PURE__ */ __commonJSMin(((e) => {
187
+ var t = __require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
188
+ e.c = function(e) {
189
+ return t.H.useMemoCache(e);
190
+ };
191
+ })), require_react_compiler_runtime_development = /* @__PURE__ */ __commonJSMin(((e) => {
192
+ process.env.NODE_ENV !== "production" && (function() {
193
+ var t = __require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
194
+ e.c = function(e) {
195
+ var n = t.H;
196
+ return n === null && console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."), n.useMemoCache(e);
197
+ };
198
+ })();
199
+ })), require_compiler_runtime = /* @__PURE__ */ __commonJSMin(((e, t) => {
200
+ process.env.NODE_ENV === "production" ? t.exports = require_react_compiler_runtime_production() : t.exports = require_react_compiler_runtime_development();
201
+ })), import_compiler_runtime$7 = /* @__PURE__ */ __toESM(require_compiler_runtime());
202
+ function prefixNames(e) {
203
+ return [...arguments].slice(1).map(function(t) {
204
+ return t.split(" ").map(function(t) {
205
+ return t ? "" + e + t : "";
206
+ }).join(" ");
207
+ }).join(" ");
208
+ }
209
+ function prefix(...e) {
210
+ return prefixNames(`${PREFIX}-`, ...e);
211
+ }
212
+ var DEFAULT_SPEED = 1, MAX_SPEED = 3, CRITICAL_SIZE = 10;
213
+ function useAutoScroll(e) {
214
+ let t = (0, import_compiler_runtime$7.c)(7), n = useRef(-(2 ** 53 - 1)), r = useRef(2 ** 53 - 1), i = useRef(DEFAULT_SPEED), a = useRef(void 0), o;
215
+ t[0] === e ? o = t[1] : (o = () => {
216
+ if (e?.current) {
217
+ let { left: t, width: i } = e.current.getBoundingClientRect();
218
+ n.current = t, r.current = t + i;
219
+ }
220
+ }, t[0] = e, t[1] = o);
221
+ let c = o, l;
222
+ t[2] === Symbol.for("react.memo_cache_sentinel") ? (l = (e, t) => {
223
+ if (e.clientX >= r.current || e.clientX <= n.current) {
224
+ a.current !== void 0 && cancelAnimationFrame(a.current);
225
+ let o = Math.abs(e.clientX >= r.current ? e.clientX - r.current : e.clientX - n.current);
226
+ i.current = Math.min(Number((o / CRITICAL_SIZE).toFixed(0)) * DEFAULT_SPEED, MAX_SPEED);
227
+ let s = (e.clientX >= r.current ? 1 : -1) * i.current, c = () => {
228
+ t && t(s), a.current = requestAnimationFrame(c);
229
+ };
230
+ return a.current = requestAnimationFrame(c), !1;
231
+ } else a.current !== void 0 && cancelAnimationFrame(a.current);
232
+ return !0;
233
+ }, t[2] = l) : l = t[2];
234
+ let u = l, d;
235
+ t[3] === Symbol.for("react.memo_cache_sentinel") ? (d = (e, t, o) => {
236
+ if (e.clientX >= r.current || e.clientX < n.current) {
237
+ a.current !== void 0 && cancelAnimationFrame(a.current);
238
+ let t = Math.abs(e.clientX >= r.current ? e.clientX - r.current : e.clientX - n.current);
239
+ i.current = Math.min(Number((t / CRITICAL_SIZE).toFixed(0)) * DEFAULT_SPEED, MAX_SPEED);
240
+ let s = (e.clientX >= r.current ? 1 : -1) * i.current, c = () => {
241
+ o && o(s), a.current = requestAnimationFrame(c);
242
+ };
243
+ return a.current = requestAnimationFrame(c), !1;
244
+ } else a.current !== void 0 && cancelAnimationFrame(a.current);
245
+ return !0;
246
+ }, t[3] = d) : d = t[3];
247
+ let f = d, p;
248
+ t[4] === Symbol.for("react.memo_cache_sentinel") ? (p = () => {
249
+ n.current = -(2 ** 53 - 1), r.current = 2 ** 53 - 1, i.current = DEFAULT_SPEED, a.current !== void 0 && cancelAnimationFrame(a.current);
250
+ }, t[4] = p) : p = t[4];
251
+ let m = p, h;
252
+ return t[5] === c ? h = t[6] : (h = {
253
+ initAutoScroll: c,
254
+ dealDragAutoScroll: u,
255
+ dealResizeAutoScroll: f,
256
+ stopAutoScroll: m
257
+ }, t[5] = c, t[6] = h), h;
258
+ }
259
+ function clamp(e, t, n) {
260
+ return Math.max(t, Math.min(e, n));
261
+ }
262
+ var V = {
263
+ toVector(e, t) {
264
+ return e === void 0 && (e = t), Array.isArray(e) ? e : [e, e];
265
+ },
266
+ add(e, t) {
267
+ return [e[0] + t[0], e[1] + t[1]];
268
+ },
269
+ sub(e, t) {
270
+ return [e[0] - t[0], e[1] - t[1]];
271
+ },
272
+ addTo(e, t) {
273
+ e[0] += t[0], e[1] += t[1];
274
+ },
275
+ subTo(e, t) {
276
+ e[0] -= t[0], e[1] -= t[1];
277
+ }
278
+ };
279
+ function rubberband(e, t, n) {
280
+ return t === 0 || Math.abs(t) === Infinity ? e ** (n * 5) : e * t * n / (t + n * e);
281
+ }
282
+ function rubberbandIfOutOfBounds(e, t, n, r = .15) {
283
+ return r === 0 ? clamp(e, t, n) : e < t ? -rubberband(t - e, n - t, r) + t : e > n ? +rubberband(e - n, n - t, r) + n : e;
284
+ }
285
+ function computeRubberband(e, [t, n], [r, i]) {
286
+ let [[a, o], [s, c]] = e;
287
+ return [rubberbandIfOutOfBounds(t, a, o, r), rubberbandIfOutOfBounds(n, s, c, i)];
288
+ }
289
+ function _toPrimitive$1(e, t) {
290
+ if (typeof e != "object" || !e) return e;
291
+ var n = e[Symbol.toPrimitive];
292
+ if (n !== void 0) {
293
+ var r = n.call(e, t || "default");
294
+ if (typeof r != "object") return r;
295
+ throw TypeError("@@toPrimitive must return a primitive value.");
296
+ }
297
+ return (t === "string" ? String : Number)(e);
298
+ }
299
+ function _toPropertyKey$1(e) {
300
+ var t = _toPrimitive$1(e, "string");
301
+ return typeof t == "symbol" ? t : String(t);
302
+ }
303
+ function _defineProperty$1(e, t, n) {
304
+ return t = _toPropertyKey$1(t), t in e ? Object.defineProperty(e, t, {
305
+ value: n,
306
+ enumerable: !0,
307
+ configurable: !0,
308
+ writable: !0
309
+ }) : e[t] = n, e;
310
+ }
311
+ function ownKeys$1(e, t) {
312
+ var n = Object.keys(e);
313
+ if (Object.getOwnPropertySymbols) {
314
+ var r = Object.getOwnPropertySymbols(e);
315
+ t && (r = r.filter(function(t) {
316
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
317
+ })), n.push.apply(n, r);
318
+ }
319
+ return n;
320
+ }
321
+ function _objectSpread2$1(e) {
322
+ for (var t = 1; t < arguments.length; t++) {
323
+ var n = arguments[t] == null ? {} : arguments[t];
324
+ t % 2 ? ownKeys$1(Object(n), !0).forEach(function(t) {
325
+ _defineProperty$1(e, t, n[t]);
326
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys$1(Object(n)).forEach(function(t) {
327
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
328
+ });
329
+ }
330
+ return e;
331
+ }
332
+ var EVENT_TYPE_MAP = {
333
+ pointer: {
334
+ start: "down",
335
+ change: "move",
336
+ end: "up"
337
+ },
338
+ mouse: {
339
+ start: "down",
340
+ change: "move",
341
+ end: "up"
342
+ },
343
+ touch: {
344
+ start: "start",
345
+ change: "move",
346
+ end: "end"
347
+ },
348
+ gesture: {
349
+ start: "start",
350
+ change: "change",
351
+ end: "end"
352
+ }
353
+ };
354
+ function capitalize(e) {
355
+ return e ? e[0].toUpperCase() + e.slice(1) : "";
356
+ }
357
+ var actionsWithoutCaptureSupported = ["enter", "leave"];
358
+ function hasCapture(e = !1, t) {
359
+ return e && !actionsWithoutCaptureSupported.includes(t);
360
+ }
361
+ function toHandlerProp(e, t = "", n = !1) {
362
+ let r = EVENT_TYPE_MAP[e], i = r && r[t] || t;
363
+ return "on" + capitalize(e) + capitalize(i) + (hasCapture(n, i) ? "Capture" : "");
364
+ }
365
+ var pointerCaptureEvents = ["gotpointercapture", "lostpointercapture"];
366
+ function parseProp(e) {
367
+ let t = e.substring(2).toLowerCase(), n = !!~t.indexOf("passive");
368
+ n && (t = t.replace("passive", ""));
369
+ let r = pointerCaptureEvents.includes(t) ? "capturecapture" : "capture", i = !!~t.indexOf(r);
370
+ return i && (t = t.replace("capture", "")), {
371
+ device: t,
372
+ capture: i,
373
+ passive: n
374
+ };
375
+ }
376
+ function toDomEventType(e, t = "") {
377
+ let n = EVENT_TYPE_MAP[e], r = n && n[t] || t;
378
+ return e + r;
379
+ }
380
+ function isTouch(e) {
381
+ return "touches" in e;
382
+ }
383
+ function getPointerType(e) {
384
+ return isTouch(e) ? "touch" : "pointerType" in e ? e.pointerType : "mouse";
385
+ }
386
+ function getCurrentTargetTouchList(e) {
387
+ return Array.from(e.touches).filter((t) => {
388
+ var n, r;
389
+ return t.target === e.currentTarget || ((n = e.currentTarget) == null || (r = n.contains) == null ? void 0 : r.call(n, t.target));
390
+ });
391
+ }
392
+ function getTouchList(e) {
393
+ return e.type === "touchend" || e.type === "touchcancel" ? e.changedTouches : e.targetTouches;
394
+ }
395
+ function getValueEvent(e) {
396
+ return isTouch(e) ? getTouchList(e)[0] : e;
397
+ }
398
+ function touchIds(e) {
399
+ return getCurrentTargetTouchList(e).map((e) => e.identifier);
400
+ }
401
+ function pointerId(e) {
402
+ let t = getValueEvent(e);
403
+ return isTouch(e) ? t.identifier : t.pointerId;
404
+ }
405
+ function pointerValues(e) {
406
+ let t = getValueEvent(e);
407
+ return [t.clientX, t.clientY];
408
+ }
409
+ function getEventDetails(e) {
410
+ let t = {};
411
+ if ("buttons" in e && (t.buttons = e.buttons), "shiftKey" in e) {
412
+ let { shiftKey: n, altKey: r, metaKey: i, ctrlKey: a } = e;
413
+ Object.assign(t, {
414
+ shiftKey: n,
415
+ altKey: r,
416
+ metaKey: i,
417
+ ctrlKey: a
418
+ });
419
+ }
420
+ return t;
421
+ }
422
+ function call(e, ...t) {
423
+ return typeof e == "function" ? e(...t) : e;
424
+ }
425
+ function noop() {}
426
+ function chain(...e) {
427
+ return e.length === 0 ? noop : e.length === 1 ? e[0] : function() {
428
+ let t;
429
+ for (let n of e) t = n.apply(this, arguments) || t;
430
+ return t;
431
+ };
432
+ }
433
+ function assignDefault(e, t) {
434
+ return Object.assign({}, t, e || {});
435
+ }
436
+ var BEFORE_LAST_KINEMATICS_DELAY = 32, Engine = class {
437
+ constructor(e, t, n) {
438
+ this.ctrl = e, this.args = t, this.key = n, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
439
+ }
440
+ get state() {
441
+ return this.ctrl.state[this.key];
442
+ }
443
+ set state(e) {
444
+ this.ctrl.state[this.key] = e;
445
+ }
446
+ get shared() {
447
+ return this.ctrl.state.shared;
448
+ }
449
+ get eventStore() {
450
+ return this.ctrl.gestureEventStores[this.key];
451
+ }
452
+ get timeoutStore() {
453
+ return this.ctrl.gestureTimeoutStores[this.key];
454
+ }
455
+ get config() {
456
+ return this.ctrl.config[this.key];
457
+ }
458
+ get sharedConfig() {
459
+ return this.ctrl.config.shared;
460
+ }
461
+ get handler() {
462
+ return this.ctrl.handlers[this.key];
463
+ }
464
+ reset() {
465
+ let { state: e, shared: t, ingKey: n, args: r } = this;
466
+ t[n] = e._active = e.active = e._blocked = e._force = !1, e._step = [!1, !1], e.intentional = !1, e._movement = [0, 0], e._distance = [0, 0], e._direction = [0, 0], e._delta = [0, 0], e._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]], e.args = r, e.axis = void 0, e.memo = void 0, e.elapsedTime = e.timeDelta = 0, e.direction = [0, 0], e.distance = [0, 0], e.overflow = [0, 0], e._movementBound = [!1, !1], e.velocity = [0, 0], e.movement = [0, 0], e.delta = [0, 0], e.timeStamp = 0;
467
+ }
468
+ start(e) {
469
+ let t = this.state, n = this.config;
470
+ t._active || (this.reset(), this.computeInitial(), t._active = !0, t.target = e.target, t.currentTarget = e.currentTarget, t.lastOffset = n.from ? call(n.from, t) : t.offset, t.offset = t.lastOffset, t.startTime = t.timeStamp = e.timeStamp);
471
+ }
472
+ computeValues(e) {
473
+ let t = this.state;
474
+ t._values = e, t.values = this.config.transform(e);
475
+ }
476
+ computeInitial() {
477
+ let e = this.state;
478
+ e._initial = e._values, e.initial = e.values;
479
+ }
480
+ compute(e) {
481
+ let { state: t, config: n, shared: r } = this;
482
+ t.args = this.args;
483
+ let i = 0;
484
+ if (e && (t.event = e, n.preventDefault && e.cancelable && t.event.preventDefault(), t.type = e.type, r.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, r.locked = !!document.pointerLockElement, Object.assign(r, getEventDetails(e)), r.down = r.pressed = r.buttons % 2 == 1 || r.touches > 0, i = e.timeStamp - t.timeStamp, t.timeStamp = e.timeStamp, t.elapsedTime = t.timeStamp - t.startTime), t._active) {
485
+ let e = t._delta.map(Math.abs);
486
+ V.addTo(t._distance, e);
487
+ }
488
+ this.axisIntent && this.axisIntent(e);
489
+ let [a, o] = t._movement, [s, c] = n.threshold, { _step: l, values: u } = t;
490
+ if (n.hasCustomTransform ? (l[0] === !1 && (l[0] = Math.abs(a) >= s && u[0]), l[1] === !1 && (l[1] = Math.abs(o) >= c && u[1])) : (l[0] === !1 && (l[0] = Math.abs(a) >= s && Math.sign(a) * s), l[1] === !1 && (l[1] = Math.abs(o) >= c && Math.sign(o) * c)), t.intentional = l[0] !== !1 || l[1] !== !1, !t.intentional) return;
491
+ let d = [0, 0];
492
+ if (n.hasCustomTransform) {
493
+ let [e, t] = u;
494
+ d[0] = l[0] === !1 ? 0 : e - l[0], d[1] = l[1] === !1 ? 0 : t - l[1];
495
+ } else d[0] = l[0] === !1 ? 0 : a - l[0], d[1] = l[1] === !1 ? 0 : o - l[1];
496
+ this.restrictToAxis && !t._blocked && this.restrictToAxis(d);
497
+ let f = t.offset, p = t._active && !t._blocked || t.active;
498
+ p && (t.first = t._active && !t.active, t.last = !t._active && t.active, t.active = r[this.ingKey] = t._active, e && (t.first && ("bounds" in n && (t._bounds = call(n.bounds, t)), this.setup && this.setup()), t.movement = d, this.computeOffset()));
499
+ let [m, h] = t.offset, [[g, _], [v, y]] = t._bounds;
500
+ t.overflow = [m < g ? -1 : m > _ ? 1 : 0, h < v ? -1 : h > y ? 1 : 0], t._movementBound[0] = t.overflow[0] ? t._movementBound[0] === !1 ? t._movement[0] : t._movementBound[0] : !1, t._movementBound[1] = t.overflow[1] ? t._movementBound[1] === !1 ? t._movement[1] : t._movementBound[1] : !1;
501
+ let b = t._active && n.rubberband || [0, 0];
502
+ if (t.offset = computeRubberband(t._bounds, t.offset, b), t.delta = V.sub(t.offset, f), this.computeMovement(), p && (!t.last || i > BEFORE_LAST_KINEMATICS_DELAY)) {
503
+ t.delta = V.sub(t.offset, f);
504
+ let e = t.delta.map(Math.abs);
505
+ V.addTo(t.distance, e), t.direction = t.delta.map(Math.sign), t._direction = t._delta.map(Math.sign), !t.first && i > 0 && (t.velocity = [e[0] / i, e[1] / i], t.timeDelta = i);
506
+ }
507
+ }
508
+ emit() {
509
+ let e = this.state, t = this.shared, n = this.config;
510
+ if (e._active || this.clean(), (e._blocked || !e.intentional) && !e._force && !n.triggerAllEvents) return;
511
+ let r = this.handler(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, t), e), {}, { [this.aliasKey]: e.values }));
512
+ r !== void 0 && (e.memo = r);
513
+ }
514
+ clean() {
515
+ this.eventStore.clean(), this.timeoutStore.clean();
516
+ }
517
+ };
518
+ function selectAxis([e, t], n) {
519
+ let r = Math.abs(e), i = Math.abs(t);
520
+ if (r > i && r > n) return "x";
521
+ if (i > r && i > n) return "y";
522
+ }
523
+ var CoordinatesEngine = class extends Engine {
524
+ constructor(...e) {
525
+ super(...e), _defineProperty$1(this, "aliasKey", "xy");
526
+ }
527
+ reset() {
528
+ super.reset(), this.state.axis = void 0;
529
+ }
530
+ init() {
531
+ this.state.offset = [0, 0], this.state.lastOffset = [0, 0];
532
+ }
533
+ computeOffset() {
534
+ this.state.offset = V.add(this.state.lastOffset, this.state.movement);
535
+ }
536
+ computeMovement() {
537
+ this.state.movement = V.sub(this.state.offset, this.state.lastOffset);
538
+ }
539
+ axisIntent(e) {
540
+ let t = this.state, n = this.config;
541
+ if (!t.axis && e) {
542
+ let r = typeof n.axisThreshold == "object" ? n.axisThreshold[getPointerType(e)] : n.axisThreshold;
543
+ t.axis = selectAxis(t._movement, r);
544
+ }
545
+ t._blocked = (n.lockDirection || !!n.axis) && !t.axis || !!n.axis && n.axis !== t.axis;
546
+ }
547
+ restrictToAxis(e) {
548
+ if (this.config.axis || this.config.lockDirection) switch (this.state.axis) {
549
+ case "x":
550
+ e[1] = 0;
551
+ break;
552
+ case "y":
553
+ e[0] = 0;
554
+ break;
555
+ }
556
+ }
557
+ }, identity = (e) => e, DEFAULT_RUBBERBAND = .15, commonConfigResolver = {
558
+ enabled(e = !0) {
559
+ return e;
560
+ },
561
+ eventOptions(e, t, n) {
562
+ return _objectSpread2$1(_objectSpread2$1({}, n.shared.eventOptions), e);
563
+ },
564
+ preventDefault(e = !1) {
565
+ return e;
566
+ },
567
+ triggerAllEvents(e = !1) {
568
+ return e;
569
+ },
570
+ rubberband(e = 0) {
571
+ switch (e) {
572
+ case !0: return [DEFAULT_RUBBERBAND, DEFAULT_RUBBERBAND];
573
+ case !1: return [0, 0];
574
+ default: return V.toVector(e);
575
+ }
576
+ },
577
+ from(e) {
578
+ if (typeof e == "function") return e;
579
+ if (e != null) return V.toVector(e);
580
+ },
581
+ transform(e, t, n) {
582
+ let r = e || n.shared.transform;
583
+ if (this.hasCustomTransform = !!r, process.env.NODE_ENV === "development") {
584
+ let e = r || identity;
585
+ return (t) => {
586
+ let n = e(t);
587
+ return (!isFinite(n[0]) || !isFinite(n[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${n[0]},1]`), n;
588
+ };
589
+ }
590
+ return r || identity;
591
+ },
592
+ threshold(e) {
593
+ return V.toVector(e, 0);
594
+ }
595
+ };
596
+ process.env.NODE_ENV === "development" && Object.assign(commonConfigResolver, {
597
+ domTarget(e) {
598
+ if (e !== void 0) throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
599
+ return NaN;
600
+ },
601
+ lockDirection(e) {
602
+ if (e !== void 0) throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");
603
+ return NaN;
604
+ },
605
+ initial(e) {
606
+ if (e !== void 0) throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");
607
+ return NaN;
608
+ }
609
+ });
610
+ var DEFAULT_AXIS_THRESHOLD = 0, coordinatesConfigResolver = _objectSpread2$1(_objectSpread2$1({}, commonConfigResolver), {}, {
611
+ axis(e, t, { axis: n }) {
612
+ if (this.lockDirection = n === "lock", !this.lockDirection) return n;
613
+ },
614
+ axisThreshold(e = DEFAULT_AXIS_THRESHOLD) {
615
+ return e;
616
+ },
617
+ bounds(e = {}) {
618
+ if (typeof e == "function") return (t) => coordinatesConfigResolver.bounds(e(t));
619
+ if ("current" in e) return () => e.current;
620
+ if (typeof HTMLElement == "function" && e instanceof HTMLElement) return e;
621
+ let { left: t = -Infinity, right: n = Infinity, top: r = -Infinity, bottom: i = Infinity } = e;
622
+ return [[t, n], [r, i]];
623
+ }
624
+ }), KEYS_DELTA_MAP = {
625
+ ArrowRight: (e, t = 1) => [e * t, 0],
626
+ ArrowLeft: (e, t = 1) => [-1 * e * t, 0],
627
+ ArrowUp: (e, t = 1) => [0, -1 * e * t],
628
+ ArrowDown: (e, t = 1) => [0, e * t]
629
+ }, DragEngine = class extends CoordinatesEngine {
630
+ constructor(...e) {
631
+ super(...e), _defineProperty$1(this, "ingKey", "dragging");
632
+ }
633
+ reset() {
634
+ super.reset();
635
+ let e = this.state;
636
+ e._pointerId = void 0, e._pointerActive = !1, e._keyboardActive = !1, e._preventScroll = !1, e._delayed = !1, e.swipe = [0, 0], e.tap = !1, e.canceled = !1, e.cancel = this.cancel.bind(this);
637
+ }
638
+ setup() {
639
+ let e = this.state;
640
+ if (e._bounds instanceof HTMLElement) {
641
+ let t = e._bounds.getBoundingClientRect(), n = e.currentTarget.getBoundingClientRect(), r = {
642
+ left: t.left - n.left + e.offset[0],
643
+ right: t.right - n.right + e.offset[0],
644
+ top: t.top - n.top + e.offset[1],
645
+ bottom: t.bottom - n.bottom + e.offset[1]
646
+ };
647
+ e._bounds = coordinatesConfigResolver.bounds(r);
648
+ }
649
+ }
650
+ cancel() {
651
+ let e = this.state;
652
+ e.canceled || (e.canceled = !0, e._active = !1, setTimeout(() => {
653
+ this.compute(), this.emit();
654
+ }, 0));
655
+ }
656
+ setActive() {
657
+ this.state._active = this.state._pointerActive || this.state._keyboardActive;
658
+ }
659
+ clean() {
660
+ this.pointerClean(), this.state._pointerActive = !1, this.state._keyboardActive = !1, super.clean();
661
+ }
662
+ pointerDown(e) {
663
+ let t = this.config, n = this.state;
664
+ if (e.buttons != null && (Array.isArray(t.pointerButtons) ? !t.pointerButtons.includes(e.buttons) : t.pointerButtons !== -1 && t.pointerButtons !== e.buttons)) return;
665
+ let r = this.ctrl.setEventIds(e);
666
+ t.pointerCapture && e.target.setPointerCapture(e.pointerId), !(r && r.size > 1 && n._pointerActive) && (this.start(e), this.setupPointer(e), n._pointerId = pointerId(e), n._pointerActive = !0, this.computeValues(pointerValues(e)), this.computeInitial(), t.preventScrollAxis && getPointerType(e) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(e)) : t.delay > 0 ? (this.setupDelayTrigger(e), t.triggerAllEvents && (this.compute(e), this.emit())) : this.startPointerDrag(e));
667
+ }
668
+ startPointerDrag(e) {
669
+ let t = this.state;
670
+ t._active = !0, t._preventScroll = !0, t._delayed = !1, this.compute(e), this.emit();
671
+ }
672
+ pointerMove(e) {
673
+ let t = this.state, n = this.config;
674
+ if (!t._pointerActive) return;
675
+ let r = pointerId(e);
676
+ if (t._pointerId !== void 0 && r !== t._pointerId) return;
677
+ let i = pointerValues(e);
678
+ if (document.pointerLockElement === e.target ? t._delta = [e.movementX, e.movementY] : (t._delta = V.sub(i, t._values), this.computeValues(i)), V.addTo(t._movement, t._delta), this.compute(e), t._delayed && t.intentional) {
679
+ this.timeoutStore.remove("dragDelay"), t.active = !1, this.startPointerDrag(e);
680
+ return;
681
+ }
682
+ if (n.preventScrollAxis && !t._preventScroll) if (t.axis) if (t.axis === n.preventScrollAxis || n.preventScrollAxis === "xy") {
683
+ t._active = !1, this.clean();
684
+ return;
685
+ } else {
686
+ this.timeoutStore.remove("startPointerDrag"), this.startPointerDrag(e);
687
+ return;
688
+ }
689
+ else return;
690
+ this.emit();
691
+ }
692
+ pointerUp(e) {
693
+ this.ctrl.setEventIds(e);
694
+ try {
695
+ this.config.pointerCapture && e.target.hasPointerCapture(e.pointerId) && e.target.releasePointerCapture(e.pointerId);
696
+ } catch {
697
+ process.env.NODE_ENV === "development" && console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.");
698
+ }
699
+ let t = this.state, n = this.config;
700
+ if (!t._active || !t._pointerActive) return;
701
+ let r = pointerId(e);
702
+ if (t._pointerId !== void 0 && r !== t._pointerId) return;
703
+ this.state._pointerActive = !1, this.setActive(), this.compute(e);
704
+ let [i, a] = t._distance;
705
+ if (t.tap = i <= n.tapsThreshold && a <= n.tapsThreshold, t.tap && n.filterTaps) t._force = !0;
706
+ else {
707
+ let [e, r] = t._delta, [i, a] = t._movement, [o, s] = n.swipe.velocity, [c, l] = n.swipe.distance, u = n.swipe.duration;
708
+ if (t.elapsedTime < u) {
709
+ let n = Math.abs(e / t.timeDelta), u = Math.abs(r / t.timeDelta);
710
+ n > o && Math.abs(i) > c && (t.swipe[0] = Math.sign(e)), u > s && Math.abs(a) > l && (t.swipe[1] = Math.sign(r));
711
+ }
712
+ }
713
+ this.emit();
714
+ }
715
+ pointerClick(e) {
716
+ !this.state.tap && e.detail > 0 && (e.preventDefault(), e.stopPropagation());
717
+ }
718
+ setupPointer(e) {
719
+ let t = this.config, n = t.device;
720
+ if (process.env.NODE_ENV === "development") try {
721
+ if (n === "pointer" && t.preventScrollDelay === void 0) {
722
+ let t = "uv" in e ? e.sourceEvent.currentTarget : e.currentTarget;
723
+ window.getComputedStyle(t).touchAction === "auto" && console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.", t);
724
+ }
725
+ } catch {}
726
+ t.pointerLock && e.currentTarget.requestPointerLock(), t.pointerCapture || (this.eventStore.add(this.sharedConfig.window, n, "change", this.pointerMove.bind(this)), this.eventStore.add(this.sharedConfig.window, n, "end", this.pointerUp.bind(this)), this.eventStore.add(this.sharedConfig.window, n, "cancel", this.pointerUp.bind(this)));
727
+ }
728
+ pointerClean() {
729
+ this.config.pointerLock && document.pointerLockElement === this.state.currentTarget && document.exitPointerLock();
730
+ }
731
+ preventScroll(e) {
732
+ this.state._preventScroll && e.cancelable && e.preventDefault();
733
+ }
734
+ setupScrollPrevention(e) {
735
+ this.state._preventScroll = !1, persistEvent(e);
736
+ let t = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), { passive: !1 });
737
+ this.eventStore.add(this.sharedConfig.window, "touch", "end", t), this.eventStore.add(this.sharedConfig.window, "touch", "cancel", t), this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay, e);
738
+ }
739
+ setupDelayTrigger(e) {
740
+ this.state._delayed = !0, this.timeoutStore.add("dragDelay", () => {
741
+ this.state._step = [0, 0], this.startPointerDrag(e);
742
+ }, this.config.delay);
743
+ }
744
+ keyDown(e) {
745
+ let t = KEYS_DELTA_MAP[e.key];
746
+ if (t) {
747
+ let n = this.state, r = e.shiftKey ? 10 : e.altKey ? .1 : 1;
748
+ this.start(e), n._delta = t(this.config.keyboardDisplacement, r), n._keyboardActive = !0, V.addTo(n._movement, n._delta), this.compute(e), this.emit();
749
+ }
750
+ }
751
+ keyUp(e) {
752
+ e.key in KEYS_DELTA_MAP && (this.state._keyboardActive = !1, this.setActive(), this.compute(e), this.emit());
753
+ }
754
+ bind(e) {
755
+ let t = this.config.device;
756
+ e(t, "start", this.pointerDown.bind(this)), this.config.pointerCapture && (e(t, "change", this.pointerMove.bind(this)), e(t, "end", this.pointerUp.bind(this)), e(t, "cancel", this.pointerUp.bind(this)), e("lostPointerCapture", "", this.pointerUp.bind(this))), this.config.keys && (e("key", "down", this.keyDown.bind(this)), e("key", "up", this.keyUp.bind(this))), this.config.filterTaps && e("click", "", this.pointerClick.bind(this), {
757
+ capture: !0,
758
+ passive: !1
759
+ });
760
+ }
761
+ };
762
+ function persistEvent(e) {
763
+ "persist" in e && typeof e.persist == "function" && e.persist();
764
+ }
765
+ var isBrowser = typeof window < "u" && window.document && window.document.createElement;
766
+ function supportsTouchEvents() {
767
+ return isBrowser && "ontouchstart" in window;
768
+ }
769
+ function isTouchScreen() {
770
+ return supportsTouchEvents() || isBrowser && window.navigator.maxTouchPoints > 1;
771
+ }
772
+ function supportsPointerEvents() {
773
+ return isBrowser && "onpointerdown" in window;
774
+ }
775
+ function supportsPointerLock() {
776
+ return isBrowser && "exitPointerLock" in window.document;
777
+ }
778
+ function supportsGestureEvents() {
779
+ try {
780
+ return "constructor" in GestureEvent;
781
+ } catch {
782
+ return !1;
783
+ }
784
+ }
785
+ var SUPPORT = {
786
+ isBrowser,
787
+ gesture: supportsGestureEvents(),
788
+ touch: supportsTouchEvents(),
789
+ touchscreen: isTouchScreen(),
790
+ pointer: supportsPointerEvents(),
791
+ pointerLock: supportsPointerLock()
792
+ }, DEFAULT_PREVENT_SCROLL_DELAY = 250, DEFAULT_DRAG_DELAY = 180, DEFAULT_SWIPE_VELOCITY = .5, DEFAULT_SWIPE_DISTANCE = 50, DEFAULT_SWIPE_DURATION = 250, DEFAULT_KEYBOARD_DISPLACEMENT = 10, DEFAULT_DRAG_AXIS_THRESHOLD = {
793
+ mouse: 0,
794
+ touch: 0,
795
+ pen: 8
796
+ }, dragConfigResolver = _objectSpread2$1(_objectSpread2$1({}, coordinatesConfigResolver), {}, {
797
+ device(e, t, { pointer: { touch: n = !1, lock: r = !1, mouse: i = !1 } = {} }) {
798
+ return this.pointerLock = r && SUPPORT.pointerLock, SUPPORT.touch && n ? "touch" : this.pointerLock ? "mouse" : SUPPORT.pointer && !i ? "pointer" : SUPPORT.touch ? "touch" : "mouse";
799
+ },
800
+ preventScrollAxis(e, t, { preventScroll: n }) {
801
+ if (this.preventScrollDelay = typeof n == "number" ? n : n || n === void 0 && e ? DEFAULT_PREVENT_SCROLL_DELAY : void 0, !(!SUPPORT.touchscreen || n === !1)) return e || (n === void 0 ? void 0 : "y");
802
+ },
803
+ pointerCapture(e, t, { pointer: { capture: n = !0, buttons: r = 1, keys: i = !0 } = {} }) {
804
+ return this.pointerButtons = r, this.keys = i, !this.pointerLock && this.device === "pointer" && n;
805
+ },
806
+ threshold(e, t, { filterTaps: n = !1, tapsThreshold: r = 3, axis: i = void 0 }) {
807
+ let a = V.toVector(e, n ? r : i ? 1 : 0);
808
+ return this.filterTaps = n, this.tapsThreshold = r, a;
809
+ },
810
+ swipe({ velocity: e = DEFAULT_SWIPE_VELOCITY, distance: t = DEFAULT_SWIPE_DISTANCE, duration: n = DEFAULT_SWIPE_DURATION } = {}) {
811
+ return {
812
+ velocity: this.transform(V.toVector(e)),
813
+ distance: this.transform(V.toVector(t)),
814
+ duration: n
815
+ };
816
+ },
817
+ delay(e = 0) {
818
+ switch (e) {
819
+ case !0: return DEFAULT_DRAG_DELAY;
820
+ case !1: return 0;
821
+ default: return e;
822
+ }
823
+ },
824
+ axisThreshold(e) {
825
+ return e ? _objectSpread2$1(_objectSpread2$1({}, DEFAULT_DRAG_AXIS_THRESHOLD), e) : DEFAULT_DRAG_AXIS_THRESHOLD;
826
+ },
827
+ keyboardDisplacement(e = DEFAULT_KEYBOARD_DISPLACEMENT) {
828
+ return e;
829
+ }
830
+ });
831
+ process.env.NODE_ENV === "development" && Object.assign(dragConfigResolver, {
832
+ useTouch(e) {
833
+ if (e !== void 0) throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");
834
+ return NaN;
835
+ },
836
+ experimental_preventWindowScrollY(e) {
837
+ if (e !== void 0) throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");
838
+ return NaN;
839
+ },
840
+ swipeVelocity(e) {
841
+ if (e !== void 0) throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");
842
+ return NaN;
843
+ },
844
+ swipeDistance(e) {
845
+ if (e !== void 0) throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");
846
+ return NaN;
847
+ },
848
+ swipeDuration(e) {
849
+ if (e !== void 0) throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");
850
+ return NaN;
851
+ }
852
+ }), _objectSpread2$1(_objectSpread2$1({}, commonConfigResolver), {}, {
853
+ device(e, t, { shared: n, pointer: { touch: r = !1 } = {} }) {
854
+ if (n.target && !SUPPORT.touch && SUPPORT.gesture) return "gesture";
855
+ if (SUPPORT.touch && r) return "touch";
856
+ if (SUPPORT.touchscreen) {
857
+ if (SUPPORT.pointer) return "pointer";
858
+ if (SUPPORT.touch) return "touch";
859
+ }
860
+ },
861
+ bounds(e, t, { scaleBounds: n = {}, angleBounds: r = {} }) {
862
+ let i = (e) => {
863
+ let t = assignDefault(call(n, e), {
864
+ min: -Infinity,
865
+ max: Infinity
866
+ });
867
+ return [t.min, t.max];
868
+ }, a = (e) => {
869
+ let t = assignDefault(call(r, e), {
870
+ min: -Infinity,
871
+ max: Infinity
872
+ });
873
+ return [t.min, t.max];
874
+ };
875
+ return typeof n != "function" && typeof r != "function" ? [i(), a()] : (e) => [i(e), a(e)];
876
+ },
877
+ threshold(e, t, n) {
878
+ return this.lockDirection = n.axis === "lock", V.toVector(e, this.lockDirection ? [.1, 3] : 0);
879
+ },
880
+ modifierKey(e) {
881
+ return e === void 0 ? "ctrlKey" : e;
882
+ },
883
+ pinchOnWheel(e = !0) {
884
+ return e;
885
+ }
886
+ }), _objectSpread2$1(_objectSpread2$1({}, coordinatesConfigResolver), {}, { mouseOnly: (e = !0) => e }), _objectSpread2$1(_objectSpread2$1({}, coordinatesConfigResolver), {}, { mouseOnly: (e = !0) => e });
887
+ var EngineMap = /* @__PURE__ */ new Map(), ConfigResolverMap = /* @__PURE__ */ new Map();
888
+ function registerAction(e) {
889
+ EngineMap.set(e.key, e.engine), ConfigResolverMap.set(e.key, e.resolver);
890
+ }
891
+ var dragAction = {
892
+ key: "drag",
893
+ engine: DragEngine,
894
+ resolver: dragConfigResolver
895
+ };
896
+ function _objectWithoutPropertiesLoose(e, t) {
897
+ if (e == null) return {};
898
+ var n = {}, r = Object.keys(e), i, a;
899
+ for (a = 0; a < r.length; a++) i = r[a], !(t.indexOf(i) >= 0) && (n[i] = e[i]);
900
+ return n;
901
+ }
902
+ function _objectWithoutProperties(e, t) {
903
+ if (e == null) return {};
904
+ var n = _objectWithoutPropertiesLoose(e, t), r, i;
905
+ if (Object.getOwnPropertySymbols) {
906
+ var a = Object.getOwnPropertySymbols(e);
907
+ for (i = 0; i < a.length; i++) r = a[i], !(t.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(e, r) && (n[r] = e[r]);
908
+ }
909
+ return n;
910
+ }
911
+ var sharedConfigResolver = {
912
+ target(e) {
913
+ if (e) return () => "current" in e ? e.current : e;
914
+ },
915
+ enabled(e = !0) {
916
+ return e;
917
+ },
918
+ window(e = SUPPORT.isBrowser ? window : void 0) {
919
+ return e;
920
+ },
921
+ eventOptions({ passive: e = !0, capture: t = !1 } = {}) {
922
+ return {
923
+ passive: e,
924
+ capture: t
925
+ };
926
+ },
927
+ transform(e) {
928
+ return e;
929
+ }
930
+ }, _excluded = [
931
+ "target",
932
+ "eventOptions",
933
+ "window",
934
+ "enabled",
935
+ "transform"
936
+ ];
937
+ function resolveWith(e = {}, t) {
938
+ let n = {};
939
+ for (let [r, i] of Object.entries(t)) switch (typeof i) {
940
+ case "function":
941
+ if (process.env.NODE_ENV === "development") {
942
+ let t = i.call(n, e[r], r, e);
943
+ Number.isNaN(t) || (n[r] = t);
944
+ } else n[r] = i.call(n, e[r], r, e);
945
+ break;
946
+ case "object":
947
+ n[r] = resolveWith(e[r], i);
948
+ break;
949
+ case "boolean":
950
+ i && (n[r] = e[r]);
951
+ break;
952
+ }
953
+ return n;
954
+ }
955
+ function parse(e, t, n = {}) {
956
+ let r = e, { target: i, eventOptions: a, window: o, enabled: s, transform: c } = r, l = _objectWithoutProperties(r, _excluded);
957
+ if (n.shared = resolveWith({
958
+ target: i,
959
+ eventOptions: a,
960
+ window: o,
961
+ enabled: s,
962
+ transform: c
963
+ }, sharedConfigResolver), t) {
964
+ let e = ConfigResolverMap.get(t);
965
+ n[t] = resolveWith(_objectSpread2$1({ shared: n.shared }, l), e);
966
+ } else for (let e in l) {
967
+ let t = ConfigResolverMap.get(e);
968
+ if (t) n[e] = resolveWith(_objectSpread2$1({ shared: n.shared }, l[e]), t);
969
+ else if (process.env.NODE_ENV === "development" && ![
970
+ "drag",
971
+ "pinch",
972
+ "scroll",
973
+ "wheel",
974
+ "move",
975
+ "hover"
976
+ ].includes(e)) {
977
+ if (e === "domTarget") throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
978
+ console.warn(`[@use-gesture]: Unknown config key \`${e}\` was used. Please read the documentation for further information.`);
979
+ }
980
+ }
981
+ return n;
982
+ }
983
+ var EventStore = class {
984
+ constructor(e, t) {
985
+ _defineProperty$1(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = e, this._gestureKey = t;
986
+ }
987
+ add(e, t, n, r, i) {
988
+ let a = this._listeners, o = toDomEventType(t, n), s = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, c = _objectSpread2$1(_objectSpread2$1({}, s), i);
989
+ e.addEventListener(o, r, c);
990
+ let l = () => {
991
+ e.removeEventListener(o, r, c), a.delete(l);
992
+ };
993
+ return a.add(l), l;
994
+ }
995
+ clean() {
996
+ this._listeners.forEach((e) => e()), this._listeners.clear();
997
+ }
998
+ }, TimeoutStore = class {
999
+ constructor() {
1000
+ _defineProperty$1(this, "_timeouts", /* @__PURE__ */ new Map());
1001
+ }
1002
+ add(e, t, n = 140, ...r) {
1003
+ this.remove(e), this._timeouts.set(e, window.setTimeout(t, n, ...r));
1004
+ }
1005
+ remove(e) {
1006
+ let t = this._timeouts.get(e);
1007
+ t && window.clearTimeout(t);
1008
+ }
1009
+ clean() {
1010
+ this._timeouts.forEach((e) => void window.clearTimeout(e)), this._timeouts.clear();
1011
+ }
1012
+ }, Controller = class {
1013
+ constructor(e) {
1014
+ _defineProperty$1(this, "gestures", /* @__PURE__ */ new Set()), _defineProperty$1(this, "_targetEventStore", new EventStore(this)), _defineProperty$1(this, "gestureEventStores", {}), _defineProperty$1(this, "gestureTimeoutStores", {}), _defineProperty$1(this, "handlers", {}), _defineProperty$1(this, "config", {}), _defineProperty$1(this, "pointerIds", /* @__PURE__ */ new Set()), _defineProperty$1(this, "touchIds", /* @__PURE__ */ new Set()), _defineProperty$1(this, "state", { shared: {
1015
+ shiftKey: !1,
1016
+ metaKey: !1,
1017
+ ctrlKey: !1,
1018
+ altKey: !1
1019
+ } }), resolveGestures(this, e);
1020
+ }
1021
+ setEventIds(e) {
1022
+ if (isTouch(e)) return this.touchIds = new Set(touchIds(e)), this.touchIds;
1023
+ if ("pointerId" in e) return e.type === "pointerup" || e.type === "pointercancel" ? this.pointerIds.delete(e.pointerId) : e.type === "pointerdown" && this.pointerIds.add(e.pointerId), this.pointerIds;
1024
+ }
1025
+ applyHandlers(e, t) {
1026
+ this.handlers = e, this.nativeHandlers = t;
1027
+ }
1028
+ applyConfig(e, t) {
1029
+ this.config = parse(e, t, this.config);
1030
+ }
1031
+ clean() {
1032
+ this._targetEventStore.clean();
1033
+ for (let e of this.gestures) this.gestureEventStores[e].clean(), this.gestureTimeoutStores[e].clean();
1034
+ }
1035
+ effect() {
1036
+ return this.config.shared.target && this.bind(), () => this._targetEventStore.clean();
1037
+ }
1038
+ bind(...e) {
1039
+ let t = this.config.shared, n = {}, r;
1040
+ if (!(t.target && (r = t.target(), !r))) {
1041
+ if (t.enabled) {
1042
+ for (let t of this.gestures) {
1043
+ let i = this.config[t], a = bindToProps(n, i.eventOptions, !!r);
1044
+ i.enabled && new (EngineMap.get(t))(this, e, t).bind(a);
1045
+ }
1046
+ let i = bindToProps(n, t.eventOptions, !!r);
1047
+ for (let t in this.nativeHandlers) i(t, "", (n) => this.nativeHandlers[t](_objectSpread2$1(_objectSpread2$1({}, this.state.shared), {}, {
1048
+ event: n,
1049
+ args: e
1050
+ })), void 0, !0);
1051
+ }
1052
+ for (let e in n) n[e] = chain(...n[e]);
1053
+ if (!r) return n;
1054
+ for (let e in n) {
1055
+ let { device: t, capture: i, passive: a } = parseProp(e);
1056
+ this._targetEventStore.add(r, t, "", n[e], {
1057
+ capture: i,
1058
+ passive: a
1059
+ });
1060
+ }
1061
+ }
1062
+ }
1063
+ };
1064
+ function setupGesture(e, t) {
1065
+ e.gestures.add(t), e.gestureEventStores[t] = new EventStore(e, t), e.gestureTimeoutStores[t] = new TimeoutStore();
1066
+ }
1067
+ function resolveGestures(e, t) {
1068
+ t.drag && setupGesture(e, "drag"), t.wheel && setupGesture(e, "wheel"), t.scroll && setupGesture(e, "scroll"), t.move && setupGesture(e, "move"), t.pinch && setupGesture(e, "pinch"), t.hover && setupGesture(e, "hover");
1069
+ }
1070
+ var bindToProps = (e, t, n) => (r, i, a, o = {}, s = !1) => {
1071
+ let c = o.capture ?? t.capture, l = o.passive ?? t.passive, u = s ? r : toHandlerProp(r, i, c);
1072
+ n && l && (u += "Passive"), e[u] = e[u] || [], e[u].push(a);
1073
+ };
1074
+ function _toPrimitive(e, t) {
1075
+ if (typeof e != "object" || !e) return e;
1076
+ var n = e[Symbol.toPrimitive];
1077
+ if (n !== void 0) {
1078
+ var r = n.call(e, t || "default");
1079
+ if (typeof r != "object") return r;
1080
+ throw TypeError("@@toPrimitive must return a primitive value.");
1081
+ }
1082
+ return (t === "string" ? String : Number)(e);
1083
+ }
1084
+ function _toPropertyKey(e) {
1085
+ var t = _toPrimitive(e, "string");
1086
+ return typeof t == "symbol" ? t : String(t);
1087
+ }
1088
+ function _defineProperty(e, t, n) {
1089
+ return t = _toPropertyKey(t), t in e ? Object.defineProperty(e, t, {
1090
+ value: n,
1091
+ enumerable: !0,
1092
+ configurable: !0,
1093
+ writable: !0
1094
+ }) : e[t] = n, e;
1095
+ }
1096
+ function ownKeys(e, t) {
1097
+ var n = Object.keys(e);
1098
+ if (Object.getOwnPropertySymbols) {
1099
+ var r = Object.getOwnPropertySymbols(e);
1100
+ t && (r = r.filter(function(t) {
1101
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
1102
+ })), n.push.apply(n, r);
1103
+ }
1104
+ return n;
1105
+ }
1106
+ function _objectSpread2(e) {
1107
+ for (var t = 1; t < arguments.length; t++) {
1108
+ var n = arguments[t] == null ? {} : arguments[t];
1109
+ t % 2 ? ownKeys(Object(n), !0).forEach(function(t) {
1110
+ _defineProperty(e, t, n[t]);
1111
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ownKeys(Object(n)).forEach(function(t) {
1112
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
1113
+ });
1114
+ }
1115
+ return e;
1116
+ }
1117
+ var Recognizer = class {
1118
+ constructor(e, t, n, r, i) {
1119
+ this._target = e, this._gestureKey = r, this._ctrl = new Controller(t), this._ctrl.applyHandlers(t, i), this._ctrl.applyConfig(_objectSpread2(_objectSpread2({}, n), {}, { target: e }), r), this._ctrl.effect();
1120
+ }
1121
+ destroy() {
1122
+ this._ctrl.clean();
1123
+ }
1124
+ setConfig(e) {
1125
+ this._ctrl.clean(), this._ctrl.applyConfig(_objectSpread2(_objectSpread2({}, e), {}, { target: this._target }), this._gestureKey), this._ctrl.effect();
1126
+ }
1127
+ }, DragGesture = function(e, t, n) {
1128
+ return registerAction(dragAction), new Recognizer(e, { drag: t }, n || {}, "drag");
1129
+ };
1130
+ function mergeRefs(...e) {
1131
+ let t = e.filter(Boolean);
1132
+ return t.length <= 1 ? t[0] || null : function(e) {
1133
+ for (let n of t) typeof n == "function" ? n(e) : n && (n.current = e);
1134
+ };
1135
+ }
1136
+ var slot = ({ children: e,...n }) => {
1137
+ let r = React.Children.only(e), i = getElementRef(r), a = r.props || {}, o = a.style || {}, s = {
1138
+ ...n,
1139
+ ...a,
1140
+ style: {
1141
+ ...n.style ?? {},
1142
+ ...o
1143
+ },
1144
+ ref: mergeRefs(i, n.ref)
1145
+ };
1146
+ return React.cloneElement(r, s);
1147
+ };
1148
+ function getElementRef(e) {
1149
+ let t = Object.getOwnPropertyDescriptor(e, "ref")?.get;
1150
+ return t && "isReactWarning" in t && t.isReactWarning ? e.props.ref : e.props.ref || e.ref;
1151
+ }
1152
+ const InteractComp = ({ children: e, interactRef: t, draggable: n, resizable: a, draggableOptions: o, resizableOptions: c }) => {
1153
+ let l = useRef(null), u = useRef(void 0), d = useRef(void 0), f = useRef(void 0), p = useRef(void 0), m = useRef(void 0), h = useRef(null), g = useRef(null);
1154
+ useEffect(() => {
1155
+ u.current = o, d.current = c;
1156
+ }, [o, c]);
1157
+ let _ = useEffectEvent(() => {
1158
+ l.current && (n && u.current && (f.current = new DragGesture(l.current, (e) => {
1159
+ let { active: t, delta: n, xy: r, event: i, first: a, last: o } = e, s = i?.target;
1160
+ if (s && (s === h.current || s === g.current || h.current && h.current.contains(s) || g.current && g.current.contains(s))) return;
1161
+ let c = {
1162
+ target: l.current,
1163
+ dx: n[0],
1164
+ dy: n[1],
1165
+ clientX: r[0],
1166
+ clientY: r[1]
1167
+ };
1168
+ a ? u.current?.onstart?.(c) : o ? u.current?.onend?.(c) : t && u.current?.onmove?.(c);
1169
+ }, {
1170
+ axis: u.current?.lockAxis === "x" ? "x" : void 0,
1171
+ pointer: { capture: !0 }
1172
+ })), a && d.current?.edges && (d.current.edges.left && (h.current ||= l.current.querySelector(d.current.edges.left), p.current = new DragGesture(h.current, (e) => {
1173
+ let { active: t, delta: n, xy: r, first: i, last: a } = e, o = {
1174
+ target: l.current,
1175
+ dx: n[0],
1176
+ dy: 0,
1177
+ clientX: r[0],
1178
+ clientY: r[1],
1179
+ edges: { left: !0 },
1180
+ deltaRect: { left: n[0] }
1181
+ };
1182
+ a ? d.current?.onend?.(o) : i ? d.current?.onstart?.(o) : t && d.current?.onmove?.(o);
1183
+ }, { pointer: { capture: !0 } })), d.current.edges.right && (g.current ||= l.current.querySelector(d.current.edges.right), m.current = new DragGesture(g.current, (e) => {
1184
+ let { active: t, delta: n, xy: r, first: i, last: a } = e, o = {
1185
+ target: l.current,
1186
+ dx: n[0],
1187
+ dy: 0,
1188
+ clientX: r[0],
1189
+ clientY: r[1],
1190
+ edges: { right: !0 },
1191
+ deltaRect: { right: n[0] }
1192
+ };
1193
+ a ? d.current?.onend?.(o) : i ? d.current?.onstart?.(o) : t && d.current?.onmove?.(o);
1194
+ }, { pointer: { capture: !0 } }))));
1195
+ });
1196
+ return useEffect(() => {
1197
+ if (!l.current) return;
1198
+ f.current?.destroy(), p.current?.destroy(), m.current?.destroy();
1199
+ let e = {
1200
+ target: l.current,
1201
+ unset: () => {
1202
+ f.current?.destroy(), p.current?.destroy(), m.current?.destroy();
1203
+ }
1204
+ };
1205
+ t && (t.current = e), _();
1206
+ }, [
1207
+ n,
1208
+ a,
1209
+ t
1210
+ ]), slot({
1211
+ children: e,
1212
+ ref: l,
1213
+ draggable: !1,
1214
+ style: { ...n && { touchAction: "none" } }
1215
+ });
1216
+ };
1217
+ var require_react_jsx_runtime_production = /* @__PURE__ */ __commonJSMin(((e) => {
1218
+ var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
1219
+ function r(e, n, r) {
1220
+ var i = null;
1221
+ if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
1222
+ else r = n;
1223
+ return n = r.ref, {
1224
+ $$typeof: t,
1225
+ type: e,
1226
+ key: i,
1227
+ ref: n === void 0 ? null : n,
1228
+ props: r
1229
+ };
1230
+ }
1231
+ e.Fragment = n, e.jsx = r, e.jsxs = r;
1232
+ })), require_react_jsx_runtime_development = /* @__PURE__ */ __commonJSMin(((e) => {
1233
+ process.env.NODE_ENV !== "production" && (function() {
1234
+ function t(e) {
1235
+ if (e == null) return null;
1236
+ if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
1237
+ if (typeof e == "string") return e;
1238
+ switch (e) {
1239
+ case _: return "Fragment";
1240
+ case b: return "Profiler";
1241
+ case v: return "StrictMode";
1242
+ case w: return "Suspense";
1243
+ case T: return "SuspenseList";
1244
+ case O: return "Activity";
1245
+ }
1246
+ if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
1247
+ case g: return "Portal";
1248
+ case S: return e.displayName || "Context";
1249
+ case x: return (e._context.displayName || "Context") + ".Consumer";
1250
+ case C:
1251
+ var n = e.render;
1252
+ return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
1253
+ case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
1254
+ case D:
1255
+ n = e._payload, e = e._init;
1256
+ try {
1257
+ return t(e(n));
1258
+ } catch {}
1259
+ }
1260
+ return null;
1261
+ }
1262
+ function n(e) {
1263
+ return "" + e;
1264
+ }
1265
+ function r(e) {
1266
+ try {
1267
+ n(e);
1268
+ var t = !1;
1269
+ } catch {
1270
+ t = !0;
1271
+ }
1272
+ if (t) {
1273
+ t = console;
1274
+ var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
1275
+ return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
1276
+ }
1277
+ }
1278
+ function i(e) {
1279
+ if (e === _) return "<>";
1280
+ if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
1281
+ try {
1282
+ var n = t(e);
1283
+ return n ? "<" + n + ">" : "<...>";
1284
+ } catch {
1285
+ return "<...>";
1286
+ }
1287
+ }
1288
+ function a() {
1289
+ var e = Et.A;
1290
+ return e === null ? null : e.getOwner();
1291
+ }
1292
+ function o() {
1293
+ return Error("react-stack-top-frame");
1294
+ }
1295
+ function s(e) {
1296
+ if (A.call(e, "key")) {
1297
+ var t = Object.getOwnPropertyDescriptor(e, "key").get;
1298
+ if (t && t.isReactWarning) return !1;
1299
+ }
1300
+ return e.key !== void 0;
1301
+ }
1302
+ function c(e, t) {
1303
+ function n() {
1304
+ P || (P = !0, console.error("%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)", t));
1305
+ }
1306
+ n.isReactWarning = !0, Object.defineProperty(e, "key", {
1307
+ get: n,
1308
+ configurable: !0
1309
+ });
1310
+ }
1311
+ function l() {
1312
+ var e = t(this.type);
1313
+ return F[e] || (F[e] = !0, console.error("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.")), e = this.props.ref, e === void 0 ? null : e;
1314
+ }
1315
+ function u(e, t, n, r, i, a) {
1316
+ var o = n.ref;
1317
+ return e = {
1318
+ $$typeof: h,
1319
+ type: e,
1320
+ key: t,
1321
+ props: n,
1322
+ _owner: r
1323
+ }, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
1324
+ enumerable: !1,
1325
+ value: null
1326
+ }) : Object.defineProperty(e, "ref", {
1327
+ enumerable: !1,
1328
+ get: l
1329
+ }), e._store = {}, Object.defineProperty(e._store, "validated", {
1330
+ configurable: !1,
1331
+ enumerable: !1,
1332
+ writable: !0,
1333
+ value: 0
1334
+ }), Object.defineProperty(e, "_debugInfo", {
1335
+ configurable: !1,
1336
+ enumerable: !1,
1337
+ writable: !0,
1338
+ value: null
1339
+ }), Object.defineProperty(e, "_debugStack", {
1340
+ configurable: !1,
1341
+ enumerable: !1,
1342
+ writable: !0,
1343
+ value: i
1344
+ }), Object.defineProperty(e, "_debugTask", {
1345
+ configurable: !1,
1346
+ enumerable: !1,
1347
+ writable: !0,
1348
+ value: a
1349
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
1350
+ }
1351
+ function d(e, n, i, o, l, d) {
1352
+ var p = n.children;
1353
+ if (p !== void 0) if (o) if (j(p)) {
1354
+ for (o = 0; o < p.length; o++) f(p[o]);
1355
+ Object.freeze && Object.freeze(p);
1356
+ } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
1357
+ else f(p);
1358
+ if (A.call(n, "key")) {
1359
+ p = t(e);
1360
+ var m = Object.keys(n).filter(function(e) {
1361
+ return e !== "key";
1362
+ });
1363
+ o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), R[p + o] = !0);
1364
+ }
1365
+ if (p = null, i !== void 0 && (r(i), p = "" + i), s(n) && (r(n.key), p = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
1366
+ else i = n;
1367
+ return p && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), u(e, p, i, a(), l, d);
1368
+ }
1369
+ function f(e) {
1370
+ p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
1371
+ }
1372
+ function p(e) {
1373
+ return typeof e == "object" && !!e && e.$$typeof === h;
1374
+ }
1375
+ var m = __require("react"), h = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), Et = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, j = Array.isArray, N = console.createTask ? console.createTask : function() {
1376
+ return null;
1377
+ };
1378
+ m = { react_stack_bottom_frame: function(e) {
1379
+ return e();
1380
+ } };
1381
+ var P, F = {}, I = m.react_stack_bottom_frame.bind(m, o)(), L = N(i(o)), R = {};
1382
+ e.Fragment = _, e.jsx = function(e, t, n) {
1383
+ var r = 1e4 > Et.recentlyCreatedOwnerStacks++;
1384
+ return d(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
1385
+ }, e.jsxs = function(e, t, n) {
1386
+ var r = 1e4 > Et.recentlyCreatedOwnerStacks++;
1387
+ return d(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
1388
+ };
1389
+ })();
1390
+ })), require_jsx_runtime = /* @__PURE__ */ __commonJSMin(((e, t) => {
1391
+ process.env.NODE_ENV === "production" ? t.exports = require_react_jsx_runtime_production() : t.exports = require_react_jsx_runtime_development();
1392
+ })), import_compiler_runtime$6 = /* @__PURE__ */ __toESM(require_compiler_runtime()), import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime());
1393
+ const RowDnd = React.forwardRef((e, t) => {
1394
+ let n = (0, import_compiler_runtime$6.c)(72), { children: i, edges: o, left: c, width: l, start: u, grid: d, bounds: f, enableResizing: p, enableDragging: m, adsorptionDistance: h, adsorptionPositions: g, onResizeStart: _, onResize: v, onResizeEnd: y, onDragStart: b, onDragEnd: x, onDrag: S, parentRef: C, deltaScrollLeft: w } = e, T = u === void 0 ? 20 : u, E = d === void 0 ? 1 : d, D;
1395
+ n[0] === f ? D = n[1] : (D = f === void 0 ? {
1396
+ left: -(2 ** 53 - 1),
1397
+ right: 2 ** 53 - 1
1398
+ } : f, n[0] = f, n[1] = D);
1399
+ let O = D, k = p === void 0 ? !0 : p, Et = m === void 0 ? !0 : m, A = h === void 0 ? 8 : h, j;
1400
+ n[2] === g ? j = n[3] : (j = g === void 0 ? [] : g, n[2] = g, n[3] = j);
1401
+ let N = j, P = useRef(void 0), F = useRef(0), I = useRef(!1), { initAutoScroll: L, dealDragAutoScroll: R, dealResizeAutoScroll: Dt, stopAutoScroll: z } = useAutoScroll(C), Ot, kt;
1402
+ n[4] === Symbol.for("react.memo_cache_sentinel") ? (Ot = () => {
1403
+ let e = P.current;
1404
+ return () => {
1405
+ e?.unset();
1406
+ };
1407
+ }, kt = [], n[4] = Ot, n[5] = kt) : (Ot = n[4], kt = n[5]), useEffect(Ot, kt);
1408
+ let At;
1409
+ n[6] === Symbol.for("react.memo_cache_sentinel") ? (At = (e, t) => {
1410
+ let n = t === void 0 ? !0 : t;
1411
+ if (!P.current || !P.current.target) return;
1412
+ n && (F.current = 0);
1413
+ let r = P.current.target;
1414
+ r.style.left = `${e}px`, Object.assign(r.dataset, { left: e });
1415
+ }, n[6] = At) : At = n[6];
1416
+ let jt = At, Mt;
1417
+ n[7] === Symbol.for("react.memo_cache_sentinel") ? (Mt = (e, t) => {
1418
+ let n = t === void 0 ? !0 : t;
1419
+ if (!P.current || !P.current.target) return;
1420
+ n && (F.current = 0);
1421
+ let r = P.current.target;
1422
+ r.style.width = `${e}px`, Object.assign(r.dataset, { width: e });
1423
+ }, n[7] = Mt) : Mt = n[7];
1424
+ let Pt = Mt, Ft;
1425
+ n[8] === Symbol.for("react.memo_cache_sentinel") ? (Ft = () => {
1426
+ if (!P.current?.target) return 0;
1427
+ let e = P.current.target;
1428
+ return parseFloat(e?.dataset?.left || "0");
1429
+ }, n[8] = Ft) : Ft = n[8];
1430
+ let It = Ft, B;
1431
+ n[9] === Symbol.for("react.memo_cache_sentinel") ? (B = () => {
1432
+ if (!P.current?.target) return 0;
1433
+ let e = P.current.target;
1434
+ return parseFloat(e?.dataset?.width || "0");
1435
+ }, n[9] = B) : B = n[9];
1436
+ let H = B, U, W;
1437
+ n[10] === l ? (U = n[11], W = n[12]) : (U = () => {
1438
+ if (!P.current?.target) return;
1439
+ let e = P.current.target;
1440
+ Pt(l === void 0 ? e.offsetWidth : l, !1);
1441
+ }, W = [l], n[10] = l, n[11] = U, n[12] = W), useEffect(U, W);
1442
+ let G, Lt;
1443
+ n[13] === c ? (G = n[14], Lt = n[15]) : (G = () => {
1444
+ jt(c || 0, !1);
1445
+ }, Lt = [c], n[13] = c, n[14] = G, n[15] = Lt), useEffect(G, Lt);
1446
+ let Rt;
1447
+ n[16] === Symbol.for("react.memo_cache_sentinel") ? (Rt = () => ({
1448
+ updateLeft: (e) => jt(e || 0, !1),
1449
+ updateWidth: (e) => Pt(e, !1),
1450
+ getLeft: It,
1451
+ getWidth: H
1452
+ }), n[16] = Rt) : Rt = n[16], useImperativeHandle(t, Rt);
1453
+ let K;
1454
+ n[17] !== L || n[18] !== b ? (K = () => {
1455
+ F.current = 0, I.current = !1, L(), b && b();
1456
+ }, n[17] = L, n[18] = b, n[19] = K) : K = n[19];
1457
+ let zt = K, q;
1458
+ n[20] !== A || n[21] !== N || n[22] !== O || n[23] !== E || n[24] !== S || n[25] !== T ? (q = (e) => {
1459
+ let { preLeft: t, preWidth: n, scrollDelta: r } = e, i = I.current ? A : E;
1460
+ if (Math.abs(F.current) >= i) {
1461
+ let e = parseInt(F.current / i + ""), a = t + e * i, o = a, s = 2 ** 53 - 1;
1462
+ if (N.forEach((e) => {
1463
+ let t = Math.abs(e - a);
1464
+ t < A && t < s && (o = e);
1465
+ let r = Math.abs(e - (a + n));
1466
+ r < A && r < s && (o = e - n);
1467
+ }), o === a ? ((a - T) % E !== 0 && (a = T + E * Math.round((a - T) / E)), I.current = !1) : (I.current = !0, a = o), F.current %= i, a < O.left ? a = O.left : a + n > O.right && (a = O.right - n), S && S({
1468
+ lastLeft: t,
1469
+ left: a,
1470
+ lastWidth: n,
1471
+ width: n
1472
+ }, r) === !1) return;
1473
+ jt(a, !1);
1474
+ }
1475
+ }, n[20] = A, n[21] = N, n[22] = O, n[23] = E, n[24] = S, n[25] = T, n[26] = q) : q = n[26];
1476
+ let Bt = q, J;
1477
+ n[27] !== R || n[28] !== w || n[29] !== Bt || n[30] !== C ? (J = (e) => {
1478
+ let t = e.target;
1479
+ if (w && C?.current && !R(e, (e) => {
1480
+ w(e);
1481
+ let { left: n, width: r } = t.dataset, i = parseFloat(n || "0"), a = parseFloat(r || "0");
1482
+ F.current += e, Bt({
1483
+ preLeft: i,
1484
+ preWidth: a,
1485
+ scrollDelta: e
1486
+ });
1487
+ })) return;
1488
+ let { left: n, width: r } = t.dataset, i = parseFloat(n || "0"), a = parseFloat(r || "0");
1489
+ F.current += e.dx, Bt({
1490
+ preLeft: i,
1491
+ preWidth: a
1492
+ });
1493
+ }, n[27] = R, n[28] = w, n[29] = Bt, n[30] = C, n[31] = J) : J = n[31];
1494
+ let Vt = J, Ht;
1495
+ n[32] !== x || n[33] !== z ? (Ht = (e) => {
1496
+ F.current = 0, I.current = !1, z();
1497
+ let { left: t, width: n } = e.target.dataset;
1498
+ x && x({
1499
+ left: parseFloat(t || "0"),
1500
+ width: parseFloat(n || "0")
1501
+ });
1502
+ }, n[32] = x, n[33] = z, n[34] = Ht) : Ht = n[34];
1503
+ let Ut = Ht, Wt;
1504
+ n[35] !== L || n[36] !== _ ? (Wt = (e) => {
1505
+ F.current = 0, I.current = !1, L();
1506
+ let t = e.edges?.right ? "right" : "left";
1507
+ _ && _(t);
1508
+ }, n[35] = L, n[36] = _, n[37] = Wt) : Wt = n[37];
1509
+ let Gt = Wt, Y;
1510
+ n[38] !== A || n[39] !== N || n[40] !== O || n[41] !== E || n[42] !== v || n[43] !== T ? (Y = (e) => {
1511
+ let { dir: t, preWidth: n, preLeft: r } = e, i = I.current ? A : E;
1512
+ if (t === "left") {
1513
+ if (Math.abs(F.current) >= i) {
1514
+ let e = parseInt(F.current / i + ""), t = r + e * i, a = t, o = 2 ** 53 - 1;
1515
+ N.forEach((e) => {
1516
+ let n = Math.abs(e - t);
1517
+ n < A && n < o && (a = e);
1518
+ }), a === t ? ((t - T) % E !== 0 && (t = T + E * Math.round((t - T) / E)), I.current = !1) : (I.current = !0, t = a), F.current %= i;
1519
+ let s = r + n;
1520
+ t < O.left && (t = O.left);
1521
+ let c = s - t;
1522
+ if (v && v("left", {
1523
+ lastLeft: r,
1524
+ lastWidth: n,
1525
+ left: t,
1526
+ width: c
1527
+ }) === !1) return;
1528
+ jt(t, !1), Pt(c, !1);
1529
+ }
1530
+ } else if (t === "right" && Math.abs(F.current) >= i) {
1531
+ let e = parseInt(F.current / E + ""), t = n + e * E, a = r + t, o = 2 ** 53 - 1;
1532
+ if (N.forEach((e) => {
1533
+ let n = Math.abs(e - (r + t));
1534
+ n < A && n < o && (a = e);
1535
+ }), a !== r + t) I.current = !0, t = a - r;
1536
+ else {
1537
+ let e = r + t;
1538
+ (e - T) % E !== 0 && (e = T + E * Math.round((e - T) / E), t = e - r), I.current = !1;
1539
+ }
1540
+ if (F.current %= i, r + t > O.right && (t = O.right - r), v && v("right", {
1541
+ lastLeft: r,
1542
+ lastWidth: n,
1543
+ left: r,
1544
+ width: t
1545
+ }) === !1) return;
1546
+ Pt(t, !1);
1547
+ }
1548
+ }, n[38] = A, n[39] = N, n[40] = O, n[41] = E, n[42] = v, n[43] = T, n[44] = Y) : Y = n[44];
1549
+ let Kt = Y, X;
1550
+ n[45] !== Dt || n[46] !== w || n[47] !== C || n[48] !== Kt ? (X = (e) => {
1551
+ let t = e.target, n = e.edges?.left ? "left" : "right";
1552
+ if (w && C?.current && !Dt(e, n, (e) => {
1553
+ w(e);
1554
+ let { left: r, width: i } = t.dataset, a = parseFloat(r || "0"), o = parseFloat(i || "0");
1555
+ F.current += e, Kt({
1556
+ preLeft: a,
1557
+ preWidth: o,
1558
+ dir: n
1559
+ });
1560
+ })) return;
1561
+ let { left: r, width: i } = t.dataset, a = parseFloat(r || "0"), o = parseFloat(i || "0");
1562
+ F.current += n === "left" ? e.deltaRect?.left || 0 : e.deltaRect?.right || 0, Kt({
1563
+ preLeft: a,
1564
+ preWidth: o,
1565
+ dir: n
1566
+ });
1567
+ }, n[45] = Dt, n[46] = w, n[47] = C, n[48] = Kt, n[49] = X) : X = n[49];
1568
+ let qt = X, Z;
1569
+ n[50] !== y || n[51] !== z ? (Z = (e) => {
1570
+ F.current = 0, I.current = !1, z();
1571
+ let { left: t, width: n } = e.target.dataset, r = e.edges?.right ? "right" : "left";
1572
+ y && y(r, {
1573
+ left: parseFloat(t || "0"),
1574
+ width: parseFloat(n || "0")
1575
+ });
1576
+ }, n[50] = y, n[51] = z, n[52] = Z) : Z = n[52];
1577
+ let Jt = Z, Yt;
1578
+ n[53] !== Vt || n[54] !== zt || n[55] !== Ut ? (Yt = {
1579
+ lockAxis: "x",
1580
+ onmove: Vt,
1581
+ onstart: zt,
1582
+ onend: Ut,
1583
+ cursorChecker: _temp$1
1584
+ }, n[53] = Vt, n[54] = zt, n[55] = Ut, n[56] = Yt) : Yt = n[56];
1585
+ let Q;
1586
+ n[57] !== o || n[58] !== qt || n[59] !== Gt || n[60] !== Jt ? (Q = {
1587
+ axis: "x",
1588
+ invert: "none",
1589
+ edges: o,
1590
+ onmove: qt,
1591
+ onstart: Gt,
1592
+ onend: Jt
1593
+ }, n[57] = o, n[58] = qt, n[59] = Gt, n[60] = Jt, n[61] = Q) : Q = n[61];
1594
+ let Xt = i, $;
1595
+ n[62] !== c || n[63] !== Xt || n[64] !== l ? ($ = slot({
1596
+ children: Xt,
1597
+ style: {
1598
+ left: c,
1599
+ width: l
1600
+ }
1601
+ }), n[62] = c, n[63] = Xt, n[64] = l, n[65] = $) : $ = n[65];
1602
+ let Zt;
1603
+ return n[66] !== Et || n[67] !== k || n[68] !== Yt || n[69] !== Q || n[70] !== $ ? (Zt = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InteractComp, {
1604
+ interactRef: P,
1605
+ draggable: Et,
1606
+ resizable: k,
1607
+ draggableOptions: Yt,
1608
+ resizableOptions: Q,
1609
+ children: $
1610
+ }), n[66] = Et, n[67] = k, n[68] = Yt, n[69] = Q, n[70] = $, n[71] = Zt) : Zt = n[71], Zt;
1611
+ });
1612
+ function _temp$1() {
1613
+ return "";
1614
+ }
1615
+ var import_compiler_runtime$5 = /* @__PURE__ */ __toESM(require_compiler_runtime());
1616
+ const Cursor = (e) => {
1617
+ let t = (0, import_compiler_runtime$5.c)(42), { disableDrag: n, cursorTime: i, setCursor: a, startLeft: o, timelineWidth: c, scaleWidth: l, scale: u, scrollLeft: d, scrollSync: f, areaRef: p, maxScaleCount: m, deltaScrollLeft: h, onCursorDragStart: g, onCursorDrag: _, onCursorDragEnd: v } = e, y = useRef(null), b = useRef(void 0), x, S;
1618
+ t[0] !== i || t[1] !== u || t[2] !== l || t[3] !== d || t[4] !== o ? (x = () => {
1619
+ if (b.current === void 0 && y.current) {
1620
+ let e = o ?? 20, t = l ?? 160, n = u ?? 1;
1621
+ y.current.updateLeft(parserTimeToPixel(i, {
1622
+ startLeft: e,
1623
+ scaleWidth: t,
1624
+ scale: n
1625
+ }) - d);
1626
+ }
1627
+ }, S = [
1628
+ i,
1629
+ o,
1630
+ l,
1631
+ u,
1632
+ d
1633
+ ], t[0] = i, t[1] = u, t[2] = l, t[3] = d, t[4] = o, t[5] = x, t[6] = S) : (x = t[5], S = t[6]), useEffect(x, S);
1634
+ let C = o ?? 20, w = l ?? 160, T = u ?? 1, E = m ?? Infinity, D = Math.min(c, E * w + C - d), O;
1635
+ t[7] === D ? O = t[8] : (O = {
1636
+ left: 0,
1637
+ right: D
1638
+ }, t[7] = D, t[8] = O);
1639
+ let k = !n, j;
1640
+ t[9] !== i || t[10] !== C || t[11] !== g || t[12] !== T || t[13] !== d || t[14] !== w ? (j = () => {
1641
+ g && g(i), b.current = parserTimeToPixel(i, {
1642
+ startLeft: C,
1643
+ scaleWidth: w,
1644
+ scale: T
1645
+ }) - d, y.current?.updateLeft(b.current);
1646
+ }, t[9] = i, t[10] = C, t[11] = g, t[12] = T, t[13] = d, t[14] = w, t[15] = j) : j = t[15];
1647
+ let N;
1648
+ t[16] !== C || t[17] !== v || t[18] !== T || t[19] !== d || t[20] !== a || t[21] !== w ? (N = () => {
1649
+ if (b.current !== void 0) {
1650
+ let e = parserPixelToTime(b.current + d, {
1651
+ startLeft: C,
1652
+ scale: T,
1653
+ scaleWidth: w
1654
+ });
1655
+ a({ time: e }), v && v(e);
1656
+ }
1657
+ b.current = void 0;
1658
+ }, t[16] = C, t[17] = v, t[18] = T, t[19] = d, t[20] = a, t[21] = w, t[22] = N) : N = t[22];
1659
+ let P;
1660
+ t[23] !== C || t[24] !== _ || t[25] !== T || t[26] !== f.current || t[27] !== a || t[28] !== w ? (P = (e, t) => {
1661
+ let { left: n } = e, r = t === void 0 ? 0 : t;
1662
+ if (!f.current?.state) return !1;
1663
+ let i = f.current.state.scrollLeft;
1664
+ if (!r || i === 0 ? n < C - i ? b.current = C - i : b.current = n : b.current !== void 0 && b.current < C - i - r && (b.current = C - i - r), b.current !== void 0) {
1665
+ y.current?.updateLeft(b.current);
1666
+ let e = parserPixelToTime(b.current + i, {
1667
+ startLeft: C,
1668
+ scale: T,
1669
+ scaleWidth: w
1670
+ });
1671
+ a({ time: e }), _ && _(e);
1672
+ }
1673
+ return !1;
1674
+ }, t[23] = C, t[24] = _, t[25] = T, t[26] = f.current, t[27] = a, t[28] = w, t[29] = P) : P = t[29];
1675
+ let F, I;
1676
+ t[30] === Symbol.for("react.memo_cache_sentinel") ? (I = prefix("cursor"), F = prefix("cursor-top"), t[30] = F, t[31] = I) : (F = t[30], I = t[31]);
1677
+ let L;
1678
+ t[32] === Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1679
+ className: I,
1680
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
1681
+ className: F,
1682
+ width: "8",
1683
+ height: "12",
1684
+ viewBox: "0 0 8 12",
1685
+ fill: "none",
1686
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
1687
+ d: "M0 1C0 0.447715 0.447715 0 1 0H7C7.55228 0 8 0.447715 8 1V9.38197C8 9.76074 7.786 10.107 7.44721 10.2764L4.44721 11.7764C4.16569 11.9172 3.83431 11.9172 3.55279 11.7764L0.552786 10.2764C0.214002 10.107 0 9.76074 0 9.38197V1Z",
1688
+ fill: "#5297FF"
1689
+ })
1690
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: prefix("cursor-area") })]
1691
+ }), t[32] = L) : L = t[32];
1692
+ let R;
1693
+ return t[33] !== p || t[34] !== h || t[35] !== C || t[36] !== O || t[37] !== k || t[38] !== j || t[39] !== N || t[40] !== P ? (R = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowDnd, {
1694
+ start: C,
1695
+ ref: y,
1696
+ parentRef: p,
1697
+ bounds: O,
1698
+ deltaScrollLeft: h,
1699
+ enableDragging: k,
1700
+ enableResizing: !1,
1701
+ onDragStart: j,
1702
+ onDragEnd: N,
1703
+ onDrag: P,
1704
+ children: L
1705
+ }), t[33] = p, t[34] = h, t[35] = C, t[36] = O, t[37] = k, t[38] = j, t[39] = N, t[40] = P, t[41] = R) : R = t[41], R;
1706
+ };
1707
+ function memo(e, t, n) {
1708
+ let r = n.initialDeps ?? [], i;
1709
+ function a() {
1710
+ var a;
1711
+ let o;
1712
+ n.key && n.debug?.call(n) && (o = Date.now());
1713
+ let s = e();
1714
+ if (!(s.length !== r.length || s.some((e, t) => r[t] !== e))) return i;
1715
+ r = s;
1716
+ let c;
1717
+ if (n.key && n.debug?.call(n) && (c = Date.now()), i = t(...s), n.key && n.debug?.call(n)) {
1718
+ let e = Math.round((Date.now() - o) * 100) / 100, t = Math.round((Date.now() - c) * 100) / 100, r = t / 16, i = (e, t) => {
1719
+ for (e = String(e); e.length < t;) e = " " + e;
1720
+ return e;
1721
+ };
1722
+ console.info(`%c⏱ ${i(t, 5)} /${i(e, 5)} ms`, `
1723
+ font-size: .6rem;
1724
+ font-weight: bold;
1725
+ color: hsl(${Math.max(0, Math.min(120 - 120 * r, 120))}deg 100% 31%);`, n?.key);
1726
+ }
1727
+ return (a = n?.onChange) == null || a.call(n, i), i;
1728
+ }
1729
+ return a.updateDeps = (e) => {
1730
+ r = e;
1731
+ }, a;
1732
+ }
1733
+ function notUndefined(e, t) {
1734
+ if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
1735
+ return e;
1736
+ }
1737
+ var approxEqual = (e, t) => Math.abs(e - t) < 1.01, debounce = (e, t, n) => {
1738
+ let r;
1739
+ return function(...i) {
1740
+ e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
1741
+ };
1742
+ }, getRect = (e) => {
1743
+ let { offsetWidth: t, offsetHeight: n } = e;
1744
+ return {
1745
+ width: t,
1746
+ height: n
1747
+ };
1748
+ }, defaultKeyExtractor = (e) => e, defaultRangeExtractor = (e) => {
1749
+ let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1), r = [];
1750
+ for (let e = t; e <= n; e++) r.push(e);
1751
+ return r;
1752
+ }, observeElementRect = (e, t) => {
1753
+ let n = e.scrollElement;
1754
+ if (!n) return;
1755
+ let r = e.targetWindow;
1756
+ if (!r) return;
1757
+ let i = (e) => {
1758
+ let { width: n, height: r } = e;
1759
+ t({
1760
+ width: Math.round(n),
1761
+ height: Math.round(r)
1762
+ });
1763
+ };
1764
+ if (i(getRect(n)), !r.ResizeObserver) return () => {};
1765
+ let a = new r.ResizeObserver((t) => {
1766
+ let r = () => {
1767
+ let e = t[0];
1768
+ if (e?.borderBoxSize) {
1769
+ let t = e.borderBoxSize[0];
1770
+ if (t) {
1771
+ i({
1772
+ width: t.inlineSize,
1773
+ height: t.blockSize
1774
+ });
1775
+ return;
1776
+ }
1777
+ }
1778
+ i(getRect(n));
1779
+ };
1780
+ e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
1781
+ });
1782
+ return a.observe(n, { box: "border-box" }), () => {
1783
+ a.unobserve(n);
1784
+ };
1785
+ }, addEventListenerOptions = { passive: !0 }, supportsScrollend = typeof window > "u" ? !0 : "onscrollend" in window, observeElementOffset = (e, t) => {
1786
+ let n = e.scrollElement;
1787
+ if (!n) return;
1788
+ let r = e.targetWindow;
1789
+ if (!r) return;
1790
+ let i = 0, a = e.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce(r, () => {
1791
+ t(i, !1);
1792
+ }, e.options.isScrollingResetDelay), o = (r) => () => {
1793
+ let { horizontal: o, isRtl: s } = e.options;
1794
+ i = o ? n.scrollLeft * (s && -1 || 1) : n.scrollTop, a(), t(i, r);
1795
+ }, s = o(!0), c = o(!1);
1796
+ c(), n.addEventListener("scroll", s, addEventListenerOptions);
1797
+ let l = e.options.useScrollendEvent && supportsScrollend;
1798
+ return l && n.addEventListener("scrollend", c, addEventListenerOptions), () => {
1799
+ n.removeEventListener("scroll", s), l && n.removeEventListener("scrollend", c);
1800
+ };
1801
+ }, measureElement = (e, t, n) => {
1802
+ if (t?.borderBoxSize) {
1803
+ let e = t.borderBoxSize[0];
1804
+ if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"]);
1805
+ }
1806
+ return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
1807
+ }, elementScroll = (e, { adjustments: t = 0, behavior: n }, r) => {
1808
+ var i, a;
1809
+ let o = e + t;
1810
+ (a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
1811
+ [r.options.horizontal ? "left" : "top"]: o,
1812
+ behavior: n
1813
+ });
1814
+ }, Virtualizer = class {
1815
+ constructor(e) {
1816
+ this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
1817
+ let e = null, t = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((e) => {
1818
+ e.forEach((e) => {
1819
+ let t = () => {
1820
+ this._measureElement(e.target, e);
1821
+ };
1822
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(t) : t();
1823
+ });
1824
+ }));
1825
+ return {
1826
+ disconnect: () => {
1827
+ var n;
1828
+ (n = t()) == null || n.disconnect(), e = null;
1829
+ },
1830
+ observe: (e) => t()?.observe(e, { box: "border-box" }),
1831
+ unobserve: (e) => t()?.unobserve(e)
1832
+ };
1833
+ })(), this.range = null, this.setOptions = (e) => {
1834
+ Object.entries(e).forEach(([t, n]) => {
1835
+ n === void 0 && delete e[t];
1836
+ }), this.options = {
1837
+ debug: !1,
1838
+ initialOffset: 0,
1839
+ overscan: 1,
1840
+ paddingStart: 0,
1841
+ paddingEnd: 0,
1842
+ scrollPaddingStart: 0,
1843
+ scrollPaddingEnd: 0,
1844
+ horizontal: !1,
1845
+ getItemKey: defaultKeyExtractor,
1846
+ rangeExtractor: defaultRangeExtractor,
1847
+ onChange: () => {},
1848
+ measureElement,
1849
+ initialRect: {
1850
+ width: 0,
1851
+ height: 0
1852
+ },
1853
+ scrollMargin: 0,
1854
+ gap: 0,
1855
+ indexAttribute: "data-index",
1856
+ initialMeasurementsCache: [],
1857
+ lanes: 1,
1858
+ isScrollingResetDelay: 150,
1859
+ enabled: !0,
1860
+ isRtl: !1,
1861
+ useScrollendEvent: !1,
1862
+ useAnimationFrameWithResizeObserver: !1,
1863
+ ...e
1864
+ };
1865
+ }, this.notify = (e) => {
1866
+ var t, n;
1867
+ (n = (t = this.options).onChange) == null || n.call(t, this, e);
1868
+ }, this.maybeNotify = memo(() => (this.calculateRange(), [
1869
+ this.isScrolling,
1870
+ this.range ? this.range.startIndex : null,
1871
+ this.range ? this.range.endIndex : null
1872
+ ]), (e) => {
1873
+ this.notify(e);
1874
+ }, {
1875
+ key: process.env.NODE_ENV !== "production" && "maybeNotify",
1876
+ debug: () => this.options.debug,
1877
+ initialDeps: [
1878
+ this.isScrolling,
1879
+ this.range ? this.range.startIndex : null,
1880
+ this.range ? this.range.endIndex : null
1881
+ ]
1882
+ }), this.cleanup = () => {
1883
+ this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.scrollElement = null, this.targetWindow = null;
1884
+ }, this._didMount = () => () => {
1885
+ this.cleanup();
1886
+ }, this._willUpdate = () => {
1887
+ let e = this.options.enabled ? this.options.getScrollElement() : null;
1888
+ if (this.scrollElement !== e) {
1889
+ if (this.cleanup(), !e) {
1890
+ this.maybeNotify();
1891
+ return;
1892
+ }
1893
+ this.scrollElement = e, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = this.scrollElement?.window ?? null, this.elementsCache.forEach((e) => {
1894
+ this.observer.observe(e);
1895
+ }), this._scrollToOffset(this.getScrollOffset(), {
1896
+ adjustments: void 0,
1897
+ behavior: void 0
1898
+ }), this.unsubs.push(this.options.observeElementRect(this, (e) => {
1899
+ this.scrollRect = e, this.maybeNotify();
1900
+ })), this.unsubs.push(this.options.observeElementOffset(this, (e, t) => {
1901
+ this.scrollAdjustments = 0, this.scrollDirection = t ? this.getScrollOffset() < e ? "forward" : "backward" : null, this.scrollOffset = e, this.isScrolling = t, this.maybeNotify();
1902
+ }));
1903
+ }
1904
+ }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, t) => {
1905
+ let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
1906
+ for (let i = t - 1; i >= 0; i--) {
1907
+ let t = e[i];
1908
+ if (n.has(t.lane)) continue;
1909
+ let a = r.get(t.lane);
1910
+ if (a == null || t.end > a.end ? r.set(t.lane, t) : t.end < a.end && n.set(t.lane, !0), n.size === this.options.lanes) break;
1911
+ }
1912
+ return r.size === this.options.lanes ? Array.from(r.values()).sort((e, t) => e.end === t.end ? e.index - t.index : e.end - t.end)[0] : void 0;
1913
+ }, this.getMeasurementOptions = memo(() => [
1914
+ this.options.count,
1915
+ this.options.paddingStart,
1916
+ this.options.scrollMargin,
1917
+ this.options.getItemKey,
1918
+ this.options.enabled
1919
+ ], (e, t, n, r, i) => (this.pendingMeasuredCacheIndexes = [], {
1920
+ count: e,
1921
+ paddingStart: t,
1922
+ scrollMargin: n,
1923
+ getItemKey: r,
1924
+ enabled: i
1925
+ }), { key: !1 }), this.getMeasurements = memo(() => [this.getMeasurementOptions(), this.itemSizeCache], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i }, a) => {
1926
+ if (!i) return this.measurementsCache = [], this.itemSizeCache.clear(), [];
1927
+ this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((e) => {
1928
+ this.itemSizeCache.set(e.key, e.size);
1929
+ }));
1930
+ let o = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
1931
+ this.pendingMeasuredCacheIndexes = [];
1932
+ let s = this.measurementsCache.slice(0, o);
1933
+ for (let i = o; i < e; i++) {
1934
+ let e = r(i), o = this.options.lanes === 1 ? s[i - 1] : this.getFurthestMeasurement(s, i), c = o ? o.end + this.options.gap : t + n, l = a.get(e), u = typeof l == "number" ? l : this.options.estimateSize(i), d = c + u, f = o ? o.lane : i % this.options.lanes;
1935
+ s[i] = {
1936
+ index: i,
1937
+ start: c,
1938
+ size: u,
1939
+ end: d,
1940
+ key: e,
1941
+ lane: f
1942
+ };
1943
+ }
1944
+ return this.measurementsCache = s, s;
1945
+ }, {
1946
+ key: process.env.NODE_ENV !== "production" && "getMeasurements",
1947
+ debug: () => this.options.debug
1948
+ }), this.calculateRange = memo(() => [
1949
+ this.getMeasurements(),
1950
+ this.getSize(),
1951
+ this.getScrollOffset(),
1952
+ this.options.lanes
1953
+ ], (e, t, n, r) => this.range = e.length > 0 && t > 0 ? calculateRange({
1954
+ measurements: e,
1955
+ outerSize: t,
1956
+ scrollOffset: n,
1957
+ lanes: r
1958
+ }) : null, {
1959
+ key: process.env.NODE_ENV !== "production" && "calculateRange",
1960
+ debug: () => this.options.debug
1961
+ }), this.getVirtualIndexes = memo(() => {
1962
+ let e = null, t = null, n = this.calculateRange();
1963
+ return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
1964
+ this.isScrolling,
1965
+ e,
1966
+ t
1967
+ ]), [
1968
+ this.options.rangeExtractor,
1969
+ this.options.overscan,
1970
+ this.options.count,
1971
+ e,
1972
+ t
1973
+ ];
1974
+ }, (e, t, n, r, i) => r === null || i === null ? [] : e({
1975
+ startIndex: r,
1976
+ endIndex: i,
1977
+ overscan: t,
1978
+ count: n
1979
+ }), {
1980
+ key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
1981
+ debug: () => this.options.debug
1982
+ }), this.indexFromElement = (e) => {
1983
+ let t = this.options.indexAttribute, n = e.getAttribute(t);
1984
+ return n ? parseInt(n, 10) : (console.warn(`Missing attribute name '${t}={index}' on measured element.`), -1);
1985
+ }, this._measureElement = (e, t) => {
1986
+ let n = this.indexFromElement(e), r = this.measurementsCache[n];
1987
+ if (!r) return;
1988
+ let i = r.key, a = this.elementsCache.get(i);
1989
+ a !== e && (a && this.observer.unobserve(a), this.observer.observe(e), this.elementsCache.set(i, e)), e.isConnected && this.resizeItem(n, this.options.measureElement(e, t, this));
1990
+ }, this.resizeItem = (e, t) => {
1991
+ let n = this.measurementsCache[e];
1992
+ if (!n) return;
1993
+ let r = this.itemSizeCache.get(n.key) ?? n.size, i = t - r;
1994
+ i !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange === void 0 ? n.start < this.getScrollOffset() + this.scrollAdjustments : this.shouldAdjustScrollPositionOnItemSizeChange(n, i, this)) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", i), this._scrollToOffset(this.getScrollOffset(), {
1995
+ adjustments: this.scrollAdjustments += i,
1996
+ behavior: void 0
1997
+ })), this.pendingMeasuredCacheIndexes.push(n.index), this.itemSizeCache = new Map(this.itemSizeCache.set(n.key, t)), this.notify(!1));
1998
+ }, this.measureElement = (e) => {
1999
+ if (!e) {
2000
+ this.elementsCache.forEach((e, t) => {
2001
+ e.isConnected || (this.observer.unobserve(e), this.elementsCache.delete(t));
2002
+ });
2003
+ return;
2004
+ }
2005
+ this._measureElement(e, void 0);
2006
+ }, this.getVirtualItems = memo(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
2007
+ let n = [];
2008
+ for (let r = 0, i = e.length; r < i; r++) {
2009
+ let i = e[r], a = t[i];
2010
+ n.push(a);
2011
+ }
2012
+ return n;
2013
+ }, {
2014
+ key: process.env.NODE_ENV !== "production" && "getVirtualItems",
2015
+ debug: () => this.options.debug
2016
+ }), this.getVirtualItemForOffset = (e) => {
2017
+ let t = this.getMeasurements();
2018
+ if (t.length !== 0) return notUndefined(t[findNearestBinarySearch(0, t.length - 1, (e) => notUndefined(t[e]).start, e)]);
2019
+ }, this.getOffsetForAlignment = (e, t, n = 0) => {
2020
+ let r = this.getSize(), i = this.getScrollOffset();
2021
+ t === "auto" && (t = e >= i + r ? "end" : "start"), t === "center" ? e += (n - r) / 2 : t === "end" && (e -= r);
2022
+ let a = this.getTotalSize() + this.options.scrollMargin - r;
2023
+ return Math.max(Math.min(a, e), 0);
2024
+ }, this.getOffsetForIndex = (e, t = "auto") => {
2025
+ e = Math.max(0, Math.min(e, this.options.count - 1));
2026
+ let n = this.measurementsCache[e];
2027
+ if (!n) return;
2028
+ let r = this.getSize(), i = this.getScrollOffset();
2029
+ if (t === "auto") if (n.end >= i + r - this.options.scrollPaddingEnd) t = "end";
2030
+ else if (n.start <= i + this.options.scrollPaddingStart) t = "start";
2031
+ else return [i, t];
2032
+ let a = t === "end" ? n.end + this.options.scrollPaddingEnd : n.start - this.options.scrollPaddingStart;
2033
+ return [this.getOffsetForAlignment(a, t, n.size), t];
2034
+ }, this.isDynamicMode = () => this.elementsCache.size > 0, this.scrollToOffset = (e, { align: t = "start", behavior: n } = {}) => {
2035
+ n === "smooth" && this.isDynamicMode() && console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."), this._scrollToOffset(this.getOffsetForAlignment(e, t), {
2036
+ adjustments: void 0,
2037
+ behavior: n
2038
+ });
2039
+ }, this.scrollToIndex = (e, { align: t = "auto", behavior: n } = {}) => {
2040
+ n === "smooth" && this.isDynamicMode() && console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."), e = Math.max(0, Math.min(e, this.options.count - 1));
2041
+ let r = 0, i = (t) => {
2042
+ if (!this.targetWindow) return;
2043
+ let r = this.getOffsetForIndex(e, t);
2044
+ if (!r) {
2045
+ console.warn("Failed to get offset for index:", e);
2046
+ return;
2047
+ }
2048
+ let [i, o] = r;
2049
+ this._scrollToOffset(i, {
2050
+ adjustments: void 0,
2051
+ behavior: n
2052
+ }), this.targetWindow.requestAnimationFrame(() => {
2053
+ let t = this.getScrollOffset(), n = this.getOffsetForIndex(e, o);
2054
+ if (!n) {
2055
+ console.warn("Failed to get offset for index:", e);
2056
+ return;
2057
+ }
2058
+ approxEqual(n[0], t) || a(o);
2059
+ });
2060
+ }, a = (t) => {
2061
+ this.targetWindow && (r++, r < 10 ? (process.env.NODE_ENV !== "production" && this.options.debug && console.info("Schedule retry", r, 10), this.targetWindow.requestAnimationFrame(() => i(t))) : console.warn(`Failed to scroll to index ${e} after 10 attempts.`));
2062
+ };
2063
+ i(t);
2064
+ }, this.scrollBy = (e, { behavior: t } = {}) => {
2065
+ t === "smooth" && this.isDynamicMode() && console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."), this._scrollToOffset(this.getScrollOffset() + e, {
2066
+ adjustments: void 0,
2067
+ behavior: t
2068
+ });
2069
+ }, this.getTotalSize = () => {
2070
+ let e = this.getMeasurements(), t;
2071
+ if (e.length === 0) t = this.options.paddingStart;
2072
+ else if (this.options.lanes === 1) t = e[e.length - 1]?.end ?? 0;
2073
+ else {
2074
+ let n = Array(this.options.lanes).fill(null), r = e.length - 1;
2075
+ for (; r >= 0 && n.some((e) => e === null);) {
2076
+ let t = e[r];
2077
+ n[t.lane] === null && (n[t.lane] = t.end), r--;
2078
+ }
2079
+ t = Math.max(...n.filter((e) => e !== null));
2080
+ }
2081
+ return Math.max(t - this.options.scrollMargin + this.options.paddingEnd, 0);
2082
+ }, this._scrollToOffset = (e, { adjustments: t, behavior: n }) => {
2083
+ this.options.scrollToFn(e, {
2084
+ behavior: n,
2085
+ adjustments: t
2086
+ }, this);
2087
+ }, this.measure = () => {
2088
+ this.itemSizeCache = /* @__PURE__ */ new Map(), this.notify(!1);
2089
+ }, this.setOptions(e);
2090
+ }
2091
+ }, findNearestBinarySearch = (e, t, n, r) => {
2092
+ for (; e <= t;) {
2093
+ let i = (e + t) / 2 | 0, a = n(i);
2094
+ if (a < r) e = i + 1;
2095
+ else if (a > r) t = i - 1;
2096
+ else return i;
2097
+ }
2098
+ return e > 0 ? e - 1 : 0;
2099
+ };
2100
+ function calculateRange({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
2101
+ let i = e.length - 1, a = (t) => e[t].start;
2102
+ if (e.length <= r) return {
2103
+ startIndex: 0,
2104
+ endIndex: i
2105
+ };
2106
+ let o = findNearestBinarySearch(0, i, a, n), s = o;
2107
+ if (r === 1) for (; s < i && e[s].end < n + t;) s++;
2108
+ else if (r > 1) {
2109
+ let a = Array(r).fill(0);
2110
+ for (; s < i && a.some((e) => e < n + t);) {
2111
+ let t = e[s];
2112
+ a[t.lane] = t.end, s++;
2113
+ }
2114
+ let c = Array(r).fill(n + t);
2115
+ for (; o >= 0 && c.some((e) => e >= n);) {
2116
+ let t = e[o];
2117
+ c[t.lane] = t.start, o--;
2118
+ }
2119
+ o = Math.max(0, o - o % r), s = Math.min(i, s + (r - 1 - s % r));
2120
+ }
2121
+ return {
2122
+ startIndex: o,
2123
+ endIndex: s
2124
+ };
2125
+ }
2126
+ var useIsomorphicLayoutEffect = typeof document < "u" ? React$1.useLayoutEffect : React$1.useEffect;
2127
+ function useVirtualizerBase(t) {
2128
+ let n = React$1.useReducer(() => ({}), {})[1], r = {
2129
+ ...t,
2130
+ onChange: (e, r) => {
2131
+ var i;
2132
+ r ? flushSync(n) : n(), (i = t.onChange) == null || i.call(t, e, r);
2133
+ }
2134
+ }, [i] = React$1.useState(() => new Virtualizer(r));
2135
+ return i.setOptions(r), useIsomorphicLayoutEffect(() => i._didMount(), []), useIsomorphicLayoutEffect(() => i._willUpdate()), i;
2136
+ }
2137
+ function useVirtualizer(e) {
2138
+ return useVirtualizerBase({
2139
+ observeElementRect,
2140
+ observeElementOffset,
2141
+ scrollToFn: elementScroll,
2142
+ ...e
2143
+ });
2144
+ }
2145
+ var import_compiler_runtime$4 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2146
+ const DragLines = (e) => {
2147
+ let t = (0, import_compiler_runtime$4.c)(12), { isMoving: n, movePositions: r, assistPositions: i, scrollLeft: a } = e, o, s;
2148
+ if (t[0] !== n || t[1] !== a || t[2] !== r || t[3] !== i) {
2149
+ let e = r === void 0 ? [] : r, c;
2150
+ t[6] === i ? c = t[7] : (c = i === void 0 ? [] : i, t[6] = i, t[7] = c);
2151
+ let l = c;
2152
+ t[8] === Symbol.for("react.memo_cache_sentinel") ? (o = prefix("drag-line-container"), t[8] = o) : o = t[8], s = n && e.filter((e) => l.includes(e)).map((e, t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2153
+ className: prefix("drag-line"),
2154
+ style: { left: e - a }
2155
+ }, t)), t[0] = n, t[1] = a, t[2] = r, t[3] = i, t[4] = o, t[5] = s;
2156
+ } else o = t[4], s = t[5];
2157
+ let c;
2158
+ return t[9] !== o || t[10] !== s ? (c = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2159
+ className: o,
2160
+ children: s
2161
+ }), t[9] = o, t[10] = s, t[11] = c) : c = t[11], c;
2162
+ };
2163
+ var import_compiler_runtime$3 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2164
+ const EditAction = (e) => {
2165
+ let t = (0, import_compiler_runtime$3.c)(198), { editorData: n, row: r, action: i, effects: a, rowHeight: o, scale: l, scaleWidth: u, scaleSplitCount: d, startLeft: f, gridSnap: p, disableDrag: m, scaleCount: h, maxScaleCount: g, setScaleCount: _, onActionMoveStart: v, onActionMoving: y, onActionMoveEnd: b, onActionResizeStart: x, onActionResizeEnd: S, onActionResizing: C, dragLineData: w, setEditorData: T, onClickAction: E, onClickActionOnly: D, onDoubleClickAction: O, onContextMenuAction: k, getActionRender: A, handleTime: P, areaRef: I, deltaScrollLeft: L } = e, R = useRef(null), Dt = useRef(!1), { id: z, maxEnd: Ot, minStart: At, end: jt, start: Mt, selected: Nt, flexible: Pt, movable: Ft, effectId: It } = i, B = Pt === void 0 ? !0 : Pt, H = Ft === void 0 ? !0 : Ft, U = l ?? 1, W = u ?? 160, G = f ?? 20, Lt = d ?? 10, Rt = g ?? 2 ** 53 - 1, K = At || 0, zt;
2166
+ t[0] !== U || t[1] !== W || t[2] !== G || t[3] !== K ? (zt = parserTimeToPixel(K, {
2167
+ startLeft: G,
2168
+ scale: U,
2169
+ scaleWidth: W
2170
+ }), t[0] = U, t[1] = W, t[2] = G, t[3] = K, t[4] = zt) : zt = t[4];
2171
+ let q = zt, Bt = Ot || Number.MAX_VALUE, J;
2172
+ t[5] !== U || t[6] !== W || t[7] !== G || t[8] !== Bt ? (J = parserTimeToPixel(Bt, {
2173
+ startLeft: G,
2174
+ scale: U,
2175
+ scaleWidth: W
2176
+ }), t[5] = U, t[6] = W, t[7] = G, t[8] = Bt, t[9] = J) : J = t[9];
2177
+ let Vt = Math.min(Rt * W + G, J), Ht;
2178
+ t[10] !== jt || t[11] !== U || t[12] !== W || t[13] !== G || t[14] !== Mt ? (Ht = parserTimeToTransform({
2179
+ start: Mt,
2180
+ end: jt
2181
+ }, {
2182
+ startLeft: G,
2183
+ scale: U,
2184
+ scaleWidth: W
2185
+ }), t[10] = jt, t[11] = U, t[12] = W, t[13] = G, t[14] = Mt, t[15] = Ht) : Ht = t[15];
2186
+ let Ut = Ht, [Wt, Gt] = useState(null), Y = Wt ?? Ut, Kt = W / Lt, X;
2187
+ t[16] !== It || t[17] !== a || t[18] !== B || t[19] !== H || t[20] !== Nt ? (X = ["action"], H && X.push("action-movable"), Nt && X.push("action-selected"), B && X.push("action-flexible"), a[It] && X.push(`action-effect-${It}`), t[16] = It, t[17] = a, t[18] = B, t[19] = H, t[20] = Nt, t[21] = X) : X = t[21];
2188
+ let qt;
2189
+ t[22] !== W || t[23] !== G || t[24] !== h || t[25] !== _ ? (qt = (e, t) => {
2190
+ let n = getScaleCountByPixel(e + t, {
2191
+ startLeft: G,
2192
+ scaleCount: h,
2193
+ scaleWidth: W
2194
+ });
2195
+ n !== h && _(n);
2196
+ }, t[22] = W, t[23] = G, t[24] = h, t[25] = _, t[26] = qt) : qt = t[26];
2197
+ let Z = qt, Jt;
2198
+ t[27] !== i || t[28] !== v || t[29] !== r ? (Jt = () => {
2199
+ v && v({
2200
+ action: i,
2201
+ row: r
2202
+ });
2203
+ }, t[27] = i, t[28] = v, t[29] = r, t[30] = Jt) : Jt = t[30];
2204
+ let Yt = Jt, Q;
2205
+ t[31] !== i || t[32] !== Z || t[33] !== y || t[34] !== r || t[35] !== U || t[36] !== W || t[37] !== G ? (Q = (e) => {
2206
+ let { left: t, width: n } = e;
2207
+ if (Dt.current = !0, y) {
2208
+ let { start: e, end: a } = parserTransformToTime({
2209
+ left: t,
2210
+ width: n
2211
+ }, {
2212
+ scaleWidth: W,
2213
+ scale: U,
2214
+ startLeft: G
2215
+ });
2216
+ if (y({
2217
+ action: i,
2218
+ row: r,
2219
+ start: e,
2220
+ end: a
2221
+ }) === !1) return !1;
2222
+ }
2223
+ Gt({
2224
+ left: t,
2225
+ width: n
2226
+ }), Z(t, n);
2227
+ }, t[31] = i, t[32] = Z, t[33] = y, t[34] = r, t[35] = U, t[36] = W, t[37] = G, t[38] = Q) : Q = t[38];
2228
+ let Xt = Q, $;
2229
+ t[39] !== n || t[40] !== z || t[41] !== b || t[42] !== r || t[43] !== U || t[44] !== W || t[45] !== G || t[46] !== T ? ($ = (e) => {
2230
+ let { left: t, width: i } = e, { start: a, end: o } = parserTransformToTime({
2231
+ left: t,
2232
+ width: i
2233
+ }, {
2234
+ scaleWidth: W,
2235
+ scale: U,
2236
+ startLeft: G
2237
+ }), s = n.find((e) => e.id === r.id);
2238
+ if (!s) return;
2239
+ let c = s.actions.find((e) => e.id === z);
2240
+ c && (c.start = a, c.end = o, T(n), b && b({
2241
+ action: c,
2242
+ row: r,
2243
+ start: a,
2244
+ end: o
2245
+ }), Gt(null));
2246
+ }, t[39] = n, t[40] = z, t[41] = b, t[42] = r, t[43] = U, t[44] = W, t[45] = G, t[46] = T, t[47] = $) : $ = t[47];
2247
+ let Zt = $, Qt;
2248
+ t[48] !== i || t[49] !== x || t[50] !== r ? (Qt = (e) => {
2249
+ x && x({
2250
+ action: i,
2251
+ row: r,
2252
+ dir: e
2253
+ });
2254
+ }, t[48] = i, t[49] = x, t[50] = r, t[51] = Qt) : Qt = t[51];
2255
+ let $t = Qt, en;
2256
+ t[52] !== i || t[53] !== Z || t[54] !== C || t[55] !== r || t[56] !== U || t[57] !== W || t[58] !== G ? (en = (e, t) => {
2257
+ let { left: n, width: a } = t;
2258
+ if (Dt.current = !0, C) {
2259
+ let { start: t, end: o } = parserTransformToTime({
2260
+ left: n,
2261
+ width: a
2262
+ }, {
2263
+ scaleWidth: W,
2264
+ scale: U,
2265
+ startLeft: G
2266
+ });
2267
+ if (C({
2268
+ action: i,
2269
+ row: r,
2270
+ start: t,
2271
+ end: o,
2272
+ dir: e
2273
+ }) === !1) return !1;
2274
+ }
2275
+ Gt({
2276
+ left: n,
2277
+ width: a
2278
+ }), Z(n, a);
2279
+ }, t[52] = i, t[53] = Z, t[54] = C, t[55] = r, t[56] = U, t[57] = W, t[58] = G, t[59] = en) : en = t[59];
2280
+ let tn = en, nn;
2281
+ t[60] !== n || t[61] !== z || t[62] !== S || t[63] !== r || t[64] !== U || t[65] !== W || t[66] !== G || t[67] !== T ? (nn = (e, t) => {
2282
+ let { left: i, width: a } = t, { start: o, end: s } = parserTransformToTime({
2283
+ left: i,
2284
+ width: a
2285
+ }, {
2286
+ scaleWidth: W,
2287
+ scale: U,
2288
+ startLeft: G
2289
+ }), c = n.find((e) => e.id === r.id);
2290
+ if (!c) return;
2291
+ let l = c.actions.find((e) => e.id === z);
2292
+ l && (l.start = o, l.end = s, T(n), S && S({
2293
+ action: l,
2294
+ row: r,
2295
+ start: o,
2296
+ end: s,
2297
+ dir: e
2298
+ }), Gt(null));
2299
+ }, t[60] = n, t[61] = z, t[62] = S, t[63] = r, t[64] = U, t[65] = W, t[66] = G, t[67] = T, t[68] = nn) : nn = t[68];
2300
+ let rn = nn, an, on, sn, cn, ln, un, dn, fn, pn, mn, hn, gn, _n, vn, yn, bn, xn, Sn, Cn, wn, Tn, En, Dn, On, kn, An, jn;
2301
+ if (t[69] !== i || t[70] !== I || t[71] !== X || t[72] !== L || t[73] !== m || t[74] !== w.assistPositions || t[75] !== B || t[76] !== A || t[77] !== Kt || t[78] !== p || t[79] !== Xt || t[80] !== Zt || t[81] !== Yt || t[82] !== rn || t[83] !== $t || t[84] !== tn || t[85] !== P || t[86] !== q || t[87] !== H || t[88] !== E || t[89] !== D || t[90] !== k || t[91] !== O || t[92] !== Vt || t[93] !== r || t[94] !== o || t[95] !== U || t[96] !== W || t[97] !== G || t[98] !== Y.left || t[99] !== Y.width) {
2302
+ let e = {
2303
+ ...i,
2304
+ ...parserTransformToTime({
2305
+ left: Y.left,
2306
+ width: Y.width
2307
+ }, {
2308
+ startLeft: G,
2309
+ scaleWidth: W,
2310
+ scale: U
2311
+ })
2312
+ }, n = {
2313
+ ...r,
2314
+ actions: [...r.actions]
2315
+ };
2316
+ r.actions.includes(i) && (n.actions[r.actions.indexOf(i)] = e), an = RowDnd, pn = R, mn = I, hn = G, gn = Y.left, _n = Y.width, vn = p && Kt || 1, yn = p ? Math.max((Kt || 1) / 2, 8) : 8, bn = w.assistPositions, t[127] !== q || t[128] !== Vt ? (xn = {
2317
+ left: q,
2318
+ right: Vt
2319
+ }, t[127] = q, t[128] = Vt, t[129] = xn) : xn = t[129];
2320
+ let a;
2321
+ t[130] !== m || t[131] !== B ? (a = !m && B && `.${prefix("action-left-stretch")}`, t[130] = m, t[131] = B, t[132] = a) : a = t[132];
2322
+ let s;
2323
+ t[133] !== m || t[134] !== B ? (s = !m && B && `.${prefix("action-right-stretch")}`, t[133] = m, t[134] = B, t[135] = s) : s = t[135], t[136] !== a || t[137] !== s ? (Sn = {
2324
+ left: a,
2325
+ right: s
2326
+ }, t[136] = a, t[137] = s, t[138] = Sn) : Sn = t[138], Cn = !m && H, wn = !m && B, Tn = Yt, En = Xt, Dn = Zt, On = $t, kn = tn, An = rn, jn = L, t[139] === Symbol.for("react.memo_cache_sentinel") ? (on = () => {
2327
+ Dt.current = !1;
2328
+ }, t[139] = on) : on = t[139], t[140] !== i || t[141] !== P || t[142] !== E || t[143] !== D || t[144] !== r ? (sn = (e) => {
2329
+ let t;
2330
+ E && (t = P(e), E(e, {
2331
+ row: r,
2332
+ action: i,
2333
+ time: t
2334
+ })), !Dt.current && D && (t === void 0 && (t = P(e)), D(e, {
2335
+ row: r,
2336
+ action: i,
2337
+ time: t
2338
+ }));
2339
+ }, t[140] = i, t[141] = P, t[142] = E, t[143] = D, t[144] = r, t[145] = sn) : sn = t[145], t[146] !== i || t[147] !== P || t[148] !== O || t[149] !== r ? (cn = (e) => {
2340
+ if (O) {
2341
+ let t = P(e);
2342
+ O(e, {
2343
+ row: r,
2344
+ action: i,
2345
+ time: t
2346
+ });
2347
+ }
2348
+ }, t[146] = i, t[147] = P, t[148] = O, t[149] = r, t[150] = cn) : cn = t[150], t[151] !== i || t[152] !== P || t[153] !== k || t[154] !== r ? (ln = (e) => {
2349
+ if (k) {
2350
+ let t = P(e);
2351
+ k(e, {
2352
+ row: r,
2353
+ action: i,
2354
+ time: t
2355
+ });
2356
+ }
2357
+ }, t[151] = i, t[152] = P, t[153] = k, t[154] = r, t[155] = ln) : ln = t[155];
2358
+ let c;
2359
+ t[156] === X ? c = t[157] : (c = X || [], t[156] = X, t[157] = c);
2360
+ let l = c.join(" ");
2361
+ t[158] === l ? un = t[159] : (un = prefix(l), t[158] = l, t[159] = un), t[160] === o ? dn = t[161] : (dn = { height: o }, t[160] = o, t[161] = dn), fn = A && A(e, n), t[69] = i, t[70] = I, t[71] = X, t[72] = L, t[73] = m, t[74] = w.assistPositions, t[75] = B, t[76] = A, t[77] = Kt, t[78] = p, t[79] = Xt, t[80] = Zt, t[81] = Yt, t[82] = rn, t[83] = $t, t[84] = tn, t[85] = P, t[86] = q, t[87] = H, t[88] = E, t[89] = D, t[90] = k, t[91] = O, t[92] = Vt, t[93] = r, t[94] = o, t[95] = U, t[96] = W, t[97] = G, t[98] = Y.left, t[99] = Y.width, t[100] = an, t[101] = on, t[102] = sn, t[103] = cn, t[104] = ln, t[105] = un, t[106] = dn, t[107] = fn, t[108] = pn, t[109] = mn, t[110] = hn, t[111] = gn, t[112] = _n, t[113] = vn, t[114] = yn, t[115] = bn, t[116] = xn, t[117] = Sn, t[118] = Cn, t[119] = wn, t[120] = Tn, t[121] = En, t[122] = Dn, t[123] = On, t[124] = kn, t[125] = An, t[126] = jn;
2362
+ } else an = t[100], on = t[101], sn = t[102], cn = t[103], ln = t[104], un = t[105], dn = t[106], fn = t[107], pn = t[108], mn = t[109], hn = t[110], gn = t[111], _n = t[112], vn = t[113], yn = t[114], bn = t[115], xn = t[116], Sn = t[117], Cn = t[118], wn = t[119], Tn = t[120], En = t[121], Dn = t[122], On = t[123], kn = t[124], An = t[125], jn = t[126];
2363
+ let Mn;
2364
+ t[162] === B ? Mn = t[163] : (Mn = B && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2365
+ className: prefix("action-left-stretch"),
2366
+ style: { touchAction: "none" }
2367
+ }), t[162] = B, t[163] = Mn);
2368
+ let Nn;
2369
+ t[164] === B ? Nn = t[165] : (Nn = B && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2370
+ className: prefix("action-right-stretch"),
2371
+ style: { touchAction: "none" }
2372
+ }), t[164] = B, t[165] = Nn);
2373
+ let Pn;
2374
+ t[166] !== on || t[167] !== sn || t[168] !== cn || t[169] !== ln || t[170] !== un || t[171] !== dn || t[172] !== fn || t[173] !== Mn || t[174] !== Nn ? (Pn = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2375
+ onMouseDown: on,
2376
+ onClick: sn,
2377
+ onDoubleClick: cn,
2378
+ onContextMenu: ln,
2379
+ className: un,
2380
+ style: dn,
2381
+ children: [
2382
+ fn,
2383
+ Mn,
2384
+ Nn
2385
+ ]
2386
+ }), t[166] = on, t[167] = sn, t[168] = cn, t[169] = ln, t[170] = un, t[171] = dn, t[172] = fn, t[173] = Mn, t[174] = Nn, t[175] = Pn) : Pn = t[175];
2387
+ let Fn;
2388
+ return t[176] !== an || t[177] !== pn || t[178] !== mn || t[179] !== hn || t[180] !== gn || t[181] !== _n || t[182] !== vn || t[183] !== yn || t[184] !== bn || t[185] !== xn || t[186] !== Sn || t[187] !== Cn || t[188] !== wn || t[189] !== Tn || t[190] !== En || t[191] !== Dn || t[192] !== On || t[193] !== kn || t[194] !== An || t[195] !== jn || t[196] !== Pn ? (Fn = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(an, {
2389
+ ref: pn,
2390
+ parentRef: mn,
2391
+ start: hn,
2392
+ left: gn,
2393
+ width: _n,
2394
+ grid: vn,
2395
+ adsorptionDistance: yn,
2396
+ adsorptionPositions: bn,
2397
+ bounds: xn,
2398
+ edges: Sn,
2399
+ enableDragging: Cn,
2400
+ enableResizing: wn,
2401
+ onDragStart: Tn,
2402
+ onDrag: En,
2403
+ onDragEnd: Dn,
2404
+ onResizeStart: On,
2405
+ onResize: kn,
2406
+ onResizeEnd: An,
2407
+ deltaScrollLeft: jn,
2408
+ children: Pn
2409
+ }), t[176] = an, t[177] = pn, t[178] = mn, t[179] = hn, t[180] = gn, t[181] = _n, t[182] = vn, t[183] = yn, t[184] = bn, t[185] = xn, t[186] = Sn, t[187] = Cn, t[188] = wn, t[189] = Tn, t[190] = En, t[191] = Dn, t[192] = On, t[193] = kn, t[194] = An, t[195] = jn, t[196] = Pn, t[197] = Fn) : Fn = t[197], Fn;
2410
+ };
2411
+ var import_compiler_runtime$2 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2412
+ const EditRow = (e) => {
2413
+ let t = (0, import_compiler_runtime$2.c)(43), { rowData: n, style: r, onClickRow: i, onDoubleClickRow: a, onContextMenuRow: o, areaRef: s, scrollLeft: c, startLeft: l, scale: u, scaleWidth: d } = e, f;
2414
+ t[0] === r ? f = t[1] : (f = r === void 0 ? {} : r, t[0] = r, t[1] = f);
2415
+ let p = f, m, h;
2416
+ if (t[2] !== s || t[3] !== n?.selected || t[4] !== u || t[5] !== d || t[6] !== c || t[7] !== l) {
2417
+ let e = ["edit-row"];
2418
+ n?.selected && e.push("edit-row-selected");
2419
+ let r = u ?? 1, i = d ?? 160, a = l ?? 20, o;
2420
+ t[10] !== s || t[11] !== r || t[12] !== i || t[13] !== a || t[14] !== c ? (o = (e) => {
2421
+ if (!s.current) return 0;
2422
+ let t = s.current.getBoundingClientRect(), n = e.clientX - t.x + c;
2423
+ return parserPixelToTime(n, {
2424
+ startLeft: a,
2425
+ scale: r,
2426
+ scaleWidth: i
2427
+ });
2428
+ }, t[10] = s, t[11] = r, t[12] = i, t[13] = a, t[14] = c, t[15] = o) : o = t[15], m = o, h = prefix(...e), t[2] = s, t[3] = n?.selected, t[4] = u, t[5] = d, t[6] = c, t[7] = l, t[8] = m, t[9] = h;
2429
+ } else m = t[8], h = t[9];
2430
+ let g;
2431
+ t[16] === n?.classNames ? g = t[17] : (g = n?.classNames || [], t[16] = n?.classNames, t[17] = g);
2432
+ let _;
2433
+ t[18] === g ? _ = t[19] : (_ = g.join(" "), t[18] = g, t[19] = _);
2434
+ let v = `${h} ${_}`, y;
2435
+ t[20] !== m || t[21] !== i || t[22] !== n ? (y = (e) => {
2436
+ if (n && i) {
2437
+ let t = m(e);
2438
+ i(e, {
2439
+ row: n,
2440
+ time: t
2441
+ });
2442
+ }
2443
+ }, t[20] = m, t[21] = i, t[22] = n, t[23] = y) : y = t[23];
2444
+ let b;
2445
+ t[24] !== m || t[25] !== a || t[26] !== n ? (b = (e) => {
2446
+ if (n && a) {
2447
+ let t = m(e);
2448
+ a(e, {
2449
+ row: n,
2450
+ time: t
2451
+ });
2452
+ }
2453
+ }, t[24] = m, t[25] = a, t[26] = n, t[27] = b) : b = t[27];
2454
+ let x;
2455
+ t[28] !== m || t[29] !== o || t[30] !== n ? (x = (e) => {
2456
+ if (n && o) {
2457
+ let t = m(e);
2458
+ o(e, {
2459
+ row: n,
2460
+ time: t
2461
+ });
2462
+ }
2463
+ }, t[28] = m, t[29] = o, t[30] = n, t[31] = x) : x = t[31];
2464
+ let S;
2465
+ t[32] !== m || t[33] !== e || t[34] !== n ? (S = n && (n.actions || []).map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditAction, {
2466
+ ...e,
2467
+ handleTime: m,
2468
+ row: n,
2469
+ action: t
2470
+ }, t.id)), t[32] = m, t[33] = e, t[34] = n, t[35] = S) : S = t[35];
2471
+ let C;
2472
+ return t[36] !== p || t[37] !== v || t[38] !== y || t[39] !== b || t[40] !== x || t[41] !== S ? (C = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2473
+ className: v,
2474
+ style: p,
2475
+ onClick: y,
2476
+ onDoubleClick: b,
2477
+ onContextMenu: x,
2478
+ children: S
2479
+ }), t[36] = p, t[37] = v, t[38] = y, t[39] = b, t[40] = x, t[41] = S, t[42] = C) : C = t[42], C;
2480
+ };
2481
+ var import_compiler_runtime$1 = /* @__PURE__ */ __toESM(require_compiler_runtime());
2482
+ function useDragLine() {
2483
+ let e = (0, import_compiler_runtime$1.c)(6), t;
2484
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = {
2485
+ isMoving: !1,
2486
+ movePositions: [],
2487
+ assistPositions: []
2488
+ }, e[0] = t) : t = e[0];
2489
+ let [n, r] = useState(t), i = _temp, a = _temp2, o;
2490
+ e[1] === Symbol.for("react.memo_cache_sentinel") ? (o = (e) => {
2491
+ let { movePositions: t, assistPositions: n } = e;
2492
+ r({
2493
+ isMoving: !0,
2494
+ movePositions: t || [],
2495
+ assistPositions: n || []
2496
+ });
2497
+ }, e[1] = o) : o = e[1];
2498
+ let s = o, l;
2499
+ e[2] === Symbol.for("react.memo_cache_sentinel") ? (l = (e) => {
2500
+ let { movePositions: t, assistPositions: n } = e;
2501
+ r((e) => ({
2502
+ ...e,
2503
+ movePositions: t || e.movePositions,
2504
+ assistPositions: n || e.assistPositions
2505
+ }));
2506
+ }, e[2] = l) : l = e[2];
2507
+ let u = l, d;
2508
+ e[3] === Symbol.for("react.memo_cache_sentinel") ? (d = () => {
2509
+ r({
2510
+ isMoving: !1,
2511
+ movePositions: [],
2512
+ assistPositions: []
2513
+ });
2514
+ }, e[3] = d) : d = e[3];
2515
+ let f = d, p;
2516
+ return e[4] === n ? p = e[5] : (p = {
2517
+ initDragLine: s,
2518
+ updateDragLine: u,
2519
+ disposeDragLine: f,
2520
+ dragLineData: n,
2521
+ defaultGetAssistPosition: i,
2522
+ defaultGetMovePosition: a
2523
+ }, e[4] = n, e[5] = p), p;
2524
+ }
2525
+ function _temp2(e) {
2526
+ let { start: t, end: n, dir: r, scale: i, scaleWidth: a, startLeft: o } = e, { left: s, width: c } = parserTimeToTransform({
2527
+ start: t,
2528
+ end: n
2529
+ }, {
2530
+ startLeft: o,
2531
+ scaleWidth: a,
2532
+ scale: i
2533
+ });
2534
+ return r ? r === "right" ? [s + c] : [s] : [s, s + c];
2535
+ }
2536
+ function _temp(e) {
2537
+ let { editorData: t, assistActionIds: n, action: r, row: i, scale: a, scaleWidth: o, startLeft: s, cursorLeft: c, hideCursor: l } = e, u = [];
2538
+ n ? t.forEach((e) => {
2539
+ e.actions.forEach((e) => {
2540
+ n.includes(e.id) && u.push(e);
2541
+ });
2542
+ }) : t.forEach((e) => {
2543
+ e.id === i.id ? e.actions.forEach((e) => {
2544
+ e.id !== r.id && u.push(e);
2545
+ }) : u.push(...e.actions);
2546
+ });
2547
+ let d = parserActionsToPositions(u, {
2548
+ startLeft: s,
2549
+ scale: a,
2550
+ scaleWidth: o
2551
+ });
2552
+ return l || d.push(c), d;
2553
+ }
2554
+ function isObject(e) {
2555
+ return typeof e == "object" && !!e;
2556
+ }
2557
+ function resolveElements(e, t, n) {
2558
+ if (e instanceof EventTarget) return [e];
2559
+ if (typeof e == "string") {
2560
+ let r = document;
2561
+ t && (r = t.current);
2562
+ let i = n?.[e] ?? r.querySelectorAll(e);
2563
+ return i ? Array.from(i) : [];
2564
+ }
2565
+ return Array.from(e);
2566
+ }
2567
+ function isSVGElement(e) {
2568
+ return isObject(e) && "ownerSVGElement" in e;
2569
+ }
2570
+ var resizeHandlers = /* @__PURE__ */ new WeakMap(), observer, getSize = (e, t, n) => (r, i) => i && i[0] ? i[0][e + "Size"] : isSVGElement(r) && "getBBox" in r ? r.getBBox()[t] : r[n], getWidth = /* @__PURE__ */ getSize("inline", "width", "offsetWidth"), getHeight = /* @__PURE__ */ getSize("block", "height", "offsetHeight");
2571
+ function notifyTarget({ target: e, borderBoxSize: t }) {
2572
+ resizeHandlers.get(e)?.forEach((n) => {
2573
+ n(e, {
2574
+ get width() {
2575
+ return getWidth(e, t);
2576
+ },
2577
+ get height() {
2578
+ return getHeight(e, t);
2579
+ }
2580
+ });
2581
+ });
2582
+ }
2583
+ function notifyAll(e) {
2584
+ e.forEach(notifyTarget);
2585
+ }
2586
+ function createResizeObserver() {
2587
+ typeof ResizeObserver > "u" || (observer = new ResizeObserver(notifyAll));
2588
+ }
2589
+ function resizeElement(e, t) {
2590
+ observer || createResizeObserver();
2591
+ let n = resolveElements(e);
2592
+ return n.forEach((e) => {
2593
+ let n = resizeHandlers.get(e);
2594
+ n || (n = /* @__PURE__ */ new Set(), resizeHandlers.set(e, n)), n.add(t), observer?.observe(e);
2595
+ }), () => {
2596
+ n.forEach((e) => {
2597
+ let n = resizeHandlers.get(e);
2598
+ n?.delete(t), n?.size || observer?.unobserve(e);
2599
+ });
2600
+ };
2601
+ }
2602
+ var windowCallbacks = /* @__PURE__ */ new Set(), windowResizeHandler;
2603
+ function createWindowResizeHandler() {
2604
+ windowResizeHandler = () => {
2605
+ let e = {
2606
+ get width() {
2607
+ return window.innerWidth;
2608
+ },
2609
+ get height() {
2610
+ return window.innerHeight;
2611
+ }
2612
+ };
2613
+ windowCallbacks.forEach((t) => t(e));
2614
+ }, window.addEventListener("resize", windowResizeHandler);
2615
+ }
2616
+ function resizeWindow(e) {
2617
+ return windowCallbacks.add(e), windowResizeHandler || createWindowResizeHandler(), () => {
2618
+ windowCallbacks.delete(e), !windowCallbacks.size && typeof windowResizeHandler == "function" && (window.removeEventListener("resize", windowResizeHandler), windowResizeHandler = void 0);
2619
+ };
2620
+ }
2621
+ function resize(e, t) {
2622
+ return typeof e == "function" ? resizeWindow(e) : resizeElement(e, t);
2623
+ }
2624
+ var import_compiler_runtime = /* @__PURE__ */ __toESM(require_compiler_runtime());
2625
+ function Measured(e) {
2626
+ let t = (0, import_compiler_runtime.c)(16), n, r, i;
2627
+ t[0] === e ? (n = t[1], r = t[2], i = t[3]) : ({render: i, ref: r, ...n} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = i);
2628
+ let a;
2629
+ t[4] === Symbol.for("react.memo_cache_sentinel") ? (a = {
2630
+ width: 0,
2631
+ height: 0
2632
+ }, t[4] = a) : a = t[4];
2633
+ let [l, u] = useState(a), d = useRef(null), f, p;
2634
+ t[5] === Symbol.for("react.memo_cache_sentinel") ? (f = () => {
2635
+ d.current && resize(d.current, (e, t) => {
2636
+ u({
2637
+ width: t.width,
2638
+ height: t.height
2639
+ });
2640
+ });
2641
+ }, p = [], t[5] = f, t[6] = p) : (f = t[5], p = t[6]), useLayoutEffect(f, p);
2642
+ let m;
2643
+ t[7] === r ? m = t[8] : (m = mergeRefs(d, r), t[7] = r, t[8] = m);
2644
+ let h;
2645
+ t[9] !== i || t[10] !== l ? (h = i(l), t[9] = i, t[10] = l, t[11] = h) : h = t[11];
2646
+ let g;
2647
+ return t[12] !== n || t[13] !== m || t[14] !== h ? (g = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2648
+ ref: m,
2649
+ ...n,
2650
+ children: h
2651
+ }), t[12] = n, t[13] = m, t[14] = h, t[15] = g) : g = t[15], g;
2652
+ }
2653
+ var EditAreaContent = ({ width: e, height: t, editAreaRef: n, editorData: i, rowHeight: a, scaleWidth: c, scaleCount: l, setScaleCount: u, startLeft: d, scrollLeft: f, scrollTop: p, scale: m, dragLine: h, getAssistDragLineActionIds: g, onActionMoveEnd: _, onActionMoveStart: v, onActionMoving: y, onActionResizeEnd: b, onActionResizeStart: x, onActionResizing: S, onScroll: C, cursorTime: w, hideCursor: T, setEditorData: E, deltaScrollLeft: D, timelineWidth: O, getActionRender: k, getScaleRender: A, onClickRow: j, onDoubleClickRow: N, onContextMenuRow: P, onClickAction: F, onClickActionOnly: I, onDoubleClickAction: L, onContextMenuAction: R, onCursorDragStart: Dt, onCursorDragEnd: z, onCursorDrag: Ot, onClickTimeArea: kt, gridSnap: At, effects: jt }) => {
2654
+ let { dragLineData: Mt, initDragLine: Nt, updateDragLine: Pt, disposeDragLine: Ft, defaultGetAssistPosition: It, defaultGetMovePosition: B } = useDragLine(), H = useRef(null), U = useRef(-1), W = (e) => {
2655
+ if (h) {
2656
+ let t = g && g({
2657
+ action: e.action,
2658
+ row: e.row,
2659
+ editorData: i
2660
+ }), n = c ?? 160, r = m ?? 1, a = d ?? 20, o = T ?? !1, s = parserTimeToPixel(w, {
2661
+ scaleWidth: n,
2662
+ scale: r,
2663
+ startLeft: a
2664
+ }), l = It({
2665
+ editorData: i,
2666
+ assistActionIds: t,
2667
+ action: e.action,
2668
+ row: e.row,
2669
+ scale: r,
2670
+ scaleWidth: n,
2671
+ startLeft: a,
2672
+ hideCursor: o,
2673
+ cursorLeft: s
2674
+ });
2675
+ Nt({ assistPositions: l });
2676
+ }
2677
+ }, G = (e) => {
2678
+ if (h) {
2679
+ let t = c ?? 160, n = m ?? 1, r = d ?? 20, i = B({
2680
+ ...e,
2681
+ startLeft: r,
2682
+ scaleWidth: t,
2683
+ scale: n
2684
+ });
2685
+ Pt({ movePositions: i });
2686
+ }
2687
+ }, Lt = 0, Rt = a ?? 32, K = i.map((e) => {
2688
+ let t = e.rowHeight || Rt;
2689
+ return Lt += t, t;
2690
+ });
2691
+ Lt < t && (K.push(t - Lt), U.current !== t && U.current >= 0 && setTimeout(() => {
2692
+ J.measure();
2693
+ })), U.current = t;
2694
+ let zt = c ?? 160, q = d ?? 20, Bt = Math.max(l * zt + q, e), J = useVirtualizer({
2695
+ count: K.length,
2696
+ getScrollElement: () => H.current,
2697
+ estimateSize: (e) => K[e] ?? Rt,
2698
+ overscan: 10
2699
+ });
2700
+ return useLayoutEffect(() => {
2701
+ H.current && (p !== void 0 && (H.current.scrollTop = p), f !== void 0 && (H.current.scrollLeft = f));
2702
+ }, [p, f]), useEffect(() => {
2703
+ J.measure();
2704
+ }, [i, J]), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2705
+ ref: H,
2706
+ style: {
2707
+ width: e,
2708
+ height: t,
2709
+ overflow: "auto"
2710
+ },
2711
+ onScroll: (e) => {
2712
+ let t = e.currentTarget;
2713
+ C({
2714
+ clientHeight: t.clientHeight,
2715
+ clientWidth: t.clientWidth,
2716
+ scrollHeight: t.scrollHeight,
2717
+ scrollLeft: t.scrollLeft,
2718
+ scrollTop: t.scrollTop,
2719
+ scrollWidth: t.scrollWidth
2720
+ });
2721
+ },
2722
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2723
+ style: {
2724
+ height: `${J.getTotalSize()}px`,
2725
+ width: Bt,
2726
+ position: "relative"
2727
+ },
2728
+ children: J.getVirtualItems().map((e) => {
2729
+ let t = i[e.index];
2730
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditRow, {
2731
+ scaleCount: l,
2732
+ setScaleCount: u,
2733
+ cursorTime: w,
2734
+ editorData: i,
2735
+ rowHeight: a,
2736
+ scaleWidth: c,
2737
+ startLeft: d,
2738
+ scale: m,
2739
+ hideCursor: T,
2740
+ timelineWidth: O,
2741
+ getActionRender: k,
2742
+ getScaleRender: A,
2743
+ onClickRow: j,
2744
+ onDoubleClickRow: N,
2745
+ onContextMenuRow: P,
2746
+ onClickAction: F,
2747
+ onClickActionOnly: I,
2748
+ onDoubleClickAction: L,
2749
+ onContextMenuAction: R,
2750
+ onCursorDragStart: Dt,
2751
+ onCursorDragEnd: z,
2752
+ onCursorDrag: Ot,
2753
+ onClickTimeArea: kt,
2754
+ gridSnap: At,
2755
+ effects: jt,
2756
+ setEditorData: E,
2757
+ deltaScrollLeft: D,
2758
+ style: {
2759
+ position: "absolute",
2760
+ top: 0,
2761
+ left: 0,
2762
+ width: Bt,
2763
+ height: `${e.size}px`,
2764
+ transform: `translateY(${e.start}px)`,
2765
+ backgroundPositionX: `0, ${d ?? 20}px`,
2766
+ backgroundSize: `${d ?? 20}px, ${c ?? 160}px`
2767
+ },
2768
+ areaRef: n,
2769
+ rowData: t,
2770
+ dragLineData: Mt,
2771
+ onActionMoveStart: (e) => (W(e), v && v(e)),
2772
+ onActionResizeStart: (e) => (W(e), x && x(e)),
2773
+ onActionMoving: (e) => (G(e), y && y(e)),
2774
+ onActionResizing: (e) => (G(e), S && S(e)),
2775
+ onActionResizeEnd: (e) => (Ft(), b && b(e)),
2776
+ onActionMoveEnd: (e) => (Ft(), _ && _(e)),
2777
+ scrollLeft: f
2778
+ }, e.key);
2779
+ })
2780
+ })
2781
+ }), h && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DragLines, {
2782
+ scrollLeft: f,
2783
+ ...Mt
2784
+ })] });
2785
+ };
2786
+ const EditArea = React.forwardRef((e, t) => {
2787
+ let n = useRef(null);
2788
+ return useImperativeHandle(t, () => ({ get domRef() {
2789
+ return n;
2790
+ } })), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Measured, {
2791
+ ref: n,
2792
+ className: prefix("edit-area"),
2793
+ render: ({ width: t, height: r }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditAreaContent, {
2794
+ ...e,
2795
+ width: t,
2796
+ height: r,
2797
+ editAreaRef: n
2798
+ })
2799
+ });
2800
+ }), TimeArea = ({ setCursor: e, maxScaleCount: t, hideCursor: n, scale: i, scaleWidth: a, scaleCount: c, scaleSplitCount: l, startLeft: u, scrollLeft: d, onClickTimeArea: f, getScaleRender: p }) => {
2801
+ let m = useRef(null), h = (l ?? 0) > 0, g = (e) => {
2802
+ let t = l ?? 1, n = a ?? 160, r = u ?? 20;
2803
+ switch (e) {
2804
+ case 0: return r;
2805
+ default: return h ? n / t : n;
2806
+ }
2807
+ }, _ = h ? c * (l ?? 1) + 1 : c, v = useVirtualizer({
2808
+ horizontal: !0,
2809
+ count: _,
2810
+ getScrollElement: () => m.current,
2811
+ estimateSize: g,
2812
+ overscan: 10
2813
+ });
2814
+ return useLayoutEffect(() => {
2815
+ m.current && d !== void 0 && (m.current.scrollLeft = d);
2816
+ }, [d]), useEffect(() => {
2817
+ v.measure();
2818
+ }, [
2819
+ a,
2820
+ u,
2821
+ v
2822
+ ]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Measured, {
2823
+ className: prefix("time-area"),
2824
+ render: ({ width: r, height: o }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2825
+ className: prefix("time-area-virtual"),
2826
+ ref: m,
2827
+ style: {
2828
+ width: r,
2829
+ height: o,
2830
+ overflowX: "hidden",
2831
+ overflowY: "hidden"
2832
+ },
2833
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2834
+ style: {
2835
+ width: `${v.getTotalSize()}px`,
2836
+ height: "100%",
2837
+ position: "relative"
2838
+ },
2839
+ children: v.getVirtualItems().map((e) => {
2840
+ let t = e.index, n = l ?? 1, r = i ?? 1, a = h ? t % n === 0 : !0, o = ["time-unit"];
2841
+ a && o.push("time-unit-big");
2842
+ let s = (h ? t / n : t) * r;
2843
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2844
+ "data-index": e.index,
2845
+ style: {
2846
+ position: "absolute",
2847
+ top: 0,
2848
+ left: 0,
2849
+ height: "100%",
2850
+ width: `${e.size}px`,
2851
+ transform: `translateX(${e.start}px)`
2852
+ },
2853
+ className: prefix(...o),
2854
+ children: a && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2855
+ className: prefix("time-unit-scale"),
2856
+ children: p ? p(s) : s
2857
+ })
2858
+ }, e.key);
2859
+ })
2860
+ })
2861
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2862
+ style: {
2863
+ width: r,
2864
+ height: o
2865
+ },
2866
+ onClick: (r) => {
2867
+ if (n) return;
2868
+ let o = u ?? 20, s = a ?? 160, c = i ?? 1, l = t ?? Infinity, p = r.currentTarget.getBoundingClientRect(), m = r.clientX - p.x, h = Math.max(m + d, o);
2869
+ if (h > l * s + o - d) return;
2870
+ let g = parserPixelToTime(h, {
2871
+ startLeft: o,
2872
+ scale: c,
2873
+ scaleWidth: s
2874
+ });
2875
+ (f && f(g, r)) !== !1 && e({ time: g });
2876
+ },
2877
+ className: prefix("time-area-interact")
2878
+ })] })
2879
+ });
2880
+ };
2881
+ var ScrollSync = React$1.forwardRef(({ children: t }, n) => {
2882
+ let [r, i] = React$1.useState({
2883
+ clientHeight: 0,
2884
+ clientWidth: 0,
2885
+ scrollHeight: 0,
2886
+ scrollLeft: 0,
2887
+ scrollTop: 0,
2888
+ scrollWidth: 0
2889
+ }), a = React$1.useCallback((e) => {
2890
+ i((t) => ({
2891
+ ...t,
2892
+ ...e
2893
+ }));
2894
+ }, []);
2895
+ return React$1.useImperativeHandle(n, () => ({
2896
+ get state() {
2897
+ return r;
2898
+ },
2899
+ setScrollState: i,
2900
+ handleScroll: a
2901
+ })), t({
2902
+ ...r,
2903
+ onScroll: a
2904
+ });
2905
+ });
2906
+ ScrollSync.displayName = "ScrollSync";
2907
+ var scroll_sync_default = ScrollSync;
2908
+ const Timeline = React.forwardRef((e, t) => {
2909
+ let i = checkProps(e), { style: l } = e, { editorData: u, scrollTop: d, autoScroll: f, hideCursor: p, disableDrag: m, scale: h = 1, scaleWidth: g = 160, startLeft: _ = 20, minScaleCount: v = 20, maxScaleCount: y = Infinity, onChange: x, onScroll: S } = i, C = useRef(null), w = useRef(null), T = useRef(null), [E, D] = useState(u), [O, j] = useState(20), [N, F] = useState(0), [I, L] = useState(2 ** 53 - 1), R = useCallback((e) => {
2910
+ j(Math.min(y, Math.max(v, e)));
2911
+ }, [y, v]);
2912
+ useLayoutEffect(() => {
2913
+ R(getScaleCountByRows(u, { scale: h })), D(u);
2914
+ }, [
2915
+ u,
2916
+ v,
2917
+ y,
2918
+ h,
2919
+ R
2920
+ ]), useEffect(() => {
2921
+ d !== void 0 && T.current?.setScrollState((e) => ({
2922
+ ...e,
2923
+ scrollTop: d
2924
+ }));
2925
+ }, [d]);
2926
+ let Dt = (e) => {
2927
+ x?.(e);
2928
+ }, z = (e) => {
2929
+ let { left: t, time: n } = e;
2930
+ return t === void 0 && n === void 0 ? !0 : (n === void 0 && (t = parserTimeToPixel(n ?? 0, {
2931
+ startLeft: _,
2932
+ scale: h,
2933
+ scaleWidth: g
2934
+ }), n = parserPixelToTime(t, {
2935
+ startLeft: _,
2936
+ scale: h,
2937
+ scaleWidth: g
2938
+ })), F(n), !0);
2939
+ }, Ot = (e) => {
2940
+ T.current?.state && (T.current.state.scrollLeft + e > O * (g - 1) + _ - I || T.current && T.current.setScrollState((t) => ({
2941
+ ...t,
2942
+ scrollLeft: Math.max(t.scrollLeft + e, 0)
2943
+ })));
2944
+ };
2945
+ return useImperativeHandle(t, () => ({
2946
+ get target() {
2947
+ return C.current;
2948
+ },
2949
+ set time(e) {
2950
+ z({ time: e });
2951
+ },
2952
+ get time() {
2953
+ return N;
2954
+ },
2955
+ setScrollLeft: (e) => {
2956
+ T.current && T.current.setScrollState((t) => ({
2957
+ ...t,
2958
+ scrollLeft: Math.max(e, 0)
2959
+ }));
2960
+ },
2961
+ setScrollTop: (e) => {
2962
+ T.current && T.current.setScrollState((t) => ({
2963
+ ...t,
2964
+ scrollTop: Math.max(e, 0)
2965
+ }));
2966
+ }
2967
+ })), useEffect(() => {
2968
+ if (w.current) {
2969
+ let e = new ResizeObserver(() => {
2970
+ w.current && L(w.current.getBoundingClientRect().width);
2971
+ });
2972
+ return e.observe(w.current), () => {
2973
+ e && e.disconnect();
2974
+ };
2975
+ }
2976
+ }, []), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2977
+ ref: C,
2978
+ style: l,
2979
+ className: `${PREFIX} ${m ? PREFIX + "-disable" : ""}`,
2980
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(scroll_sync_default, {
2981
+ ref: T,
2982
+ children: ({ scrollLeft: e, scrollTop: t, onScroll: n }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
2983
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimeArea, {
2984
+ ...i,
2985
+ timelineWidth: I,
2986
+ disableDrag: m,
2987
+ setCursor: z,
2988
+ cursorTime: N,
2989
+ editorData: E,
2990
+ scaleCount: O,
2991
+ setScaleCount: R,
2992
+ onScroll: n,
2993
+ scrollLeft: e
2994
+ }),
2995
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditArea, {
2996
+ ...i,
2997
+ timelineWidth: I,
2998
+ ref: (e) => {
2999
+ e?.domRef.current && (w.current = e.domRef.current);
3000
+ },
3001
+ disableDrag: m,
3002
+ editorData: E,
3003
+ cursorTime: N,
3004
+ scaleCount: O,
3005
+ setScaleCount: R,
3006
+ scrollTop: t,
3007
+ scrollLeft: e,
3008
+ setEditorData: Dt,
3009
+ deltaScrollLeft: f ? Ot : void 0,
3010
+ onScroll: (e) => {
3011
+ n(e), S?.(e);
3012
+ }
3013
+ }),
3014
+ !p && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Cursor, {
3015
+ ...i,
3016
+ timelineWidth: I,
3017
+ scrollLeft: e,
3018
+ scaleCount: O,
3019
+ setScaleCount: R,
3020
+ setCursor: z,
3021
+ cursorTime: N,
3022
+ editorData: E,
3023
+ areaRef: w,
3024
+ scrollSync: T,
3025
+ deltaScrollLeft: f ? Ot : void 0
3026
+ })
3027
+ ] })
3028
+ })
3029
+ });
3030
+ });
3031
+ export { Timeline };