@weasel-js/ui 1.4.4 → 1.5.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.
Files changed (161) hide show
  1. package/dist/chunks/{BandEditor-CUlbOlJi.js → BandEditor-BeWO56_w.js} +1 -1
  2. package/dist/chunks/{BandEditor-CUlbOlJi.js.map → BandEditor-BeWO56_w.js.map} +1 -1
  3. package/dist/chunks/{Callout-Dvt6lqVn.js → Callout-BPIA2is-.js} +1 -1
  4. package/dist/chunks/{Callout-Dvt6lqVn.js.map → Callout-BPIA2is-.js.map} +1 -1
  5. package/dist/chunks/ComboBox-CPES6Y1i.js +138 -0
  6. package/dist/chunks/ComboBox-CPES6Y1i.js.map +1 -0
  7. package/dist/chunks/CurveEditor-Cj0lLiyR.js +533 -0
  8. package/dist/chunks/CurveEditor-Cj0lLiyR.js.map +1 -0
  9. package/dist/chunks/{DetentSlider-BpD7bgjN.js → DetentSlider-CYicfnKr.js} +2 -2
  10. package/dist/chunks/{DetentSlider-BpD7bgjN.js.map → DetentSlider-CYicfnKr.js.map} +1 -1
  11. package/dist/chunks/{GradientEditor-BLpAtMDK.js → GradientEditor-dBprHbS0.js} +2 -2
  12. package/dist/chunks/{GradientEditor-BLpAtMDK.js.map → GradientEditor-dBprHbS0.js.map} +1 -1
  13. package/dist/chunks/MenuButton-Do8fFUx1.js +60 -0
  14. package/dist/chunks/MenuButton-Do8fFUx1.js.map +1 -0
  15. package/dist/chunks/NumberField-BWzhqS19.js +112 -0
  16. package/dist/chunks/NumberField-BWzhqS19.js.map +1 -0
  17. package/dist/chunks/{PaintInput-B7AScmHN.js → PaintInput-DAevU7fd.js} +2 -2
  18. package/dist/chunks/{PaintInput-B7AScmHN.js.map → PaintInput-DAevU7fd.js.map} +1 -1
  19. package/dist/chunks/Plot2D-CVZwQpWJ.js +292 -0
  20. package/dist/chunks/Plot2D-CVZwQpWJ.js.map +1 -0
  21. package/dist/chunks/{PointPlotter-CbDKVggs.js → PointPlotter-anTHwz8f.js} +2 -2
  22. package/dist/chunks/PointPlotter-anTHwz8f.js.map +1 -0
  23. package/dist/chunks/Prefs-CzIn-hlq.js +302 -0
  24. package/dist/chunks/Prefs-CzIn-hlq.js.map +1 -0
  25. package/dist/chunks/Properties-DJaDEJkT.js +765 -0
  26. package/dist/chunks/Properties-DJaDEJkT.js.map +1 -0
  27. package/dist/chunks/{ResizeHandle-BrCO0JrH.js → ResizeHandle-CiExUWP-.js} +1 -1
  28. package/dist/chunks/{ResizeHandle-BrCO0JrH.js.map → ResizeHandle-CiExUWP-.js.map} +1 -1
  29. package/dist/chunks/{SelectionPanel-C59wavdA.js → SelectionPanel-CbyUT3Dh.js} +204 -194
  30. package/dist/chunks/SelectionPanel-CbyUT3Dh.js.map +1 -0
  31. package/dist/chunks/{Sidebar-BvwjZiFm.js → Sidebar-Cqcfx3_s.js} +1 -1
  32. package/dist/chunks/{Sidebar-BvwjZiFm.js.map → Sidebar-Cqcfx3_s.js.map} +1 -1
  33. package/dist/chunks/{SidebarPanel-D5Ua2vyP.js → SidebarPanel-BLzBo0S2.js} +1 -1
  34. package/dist/chunks/{SidebarPanel-D5Ua2vyP.js.map → SidebarPanel-BLzBo0S2.js.map} +1 -1
  35. package/dist/chunks/{Slider-Bs-KSYgQ.js → Slider--DFRC_hc.js} +2 -2
  36. package/dist/chunks/{Slider-Bs-KSYgQ.js.map → Slider--DFRC_hc.js.map} +1 -1
  37. package/dist/chunks/{StatusBar-Bqv4D0dW.js → StatusBar-B9NQ8atD.js} +1 -1
  38. package/dist/chunks/{StatusBar-Bqv4D0dW.js.map → StatusBar-B9NQ8atD.js.map} +1 -1
  39. package/dist/chunks/{Tabs-BT3CDkoQ.js → Tabs-9sODd2Ut.js} +1 -1
  40. package/dist/chunks/{Tabs-BT3CDkoQ.js.map → Tabs-9sODd2Ut.js.map} +1 -1
  41. package/dist/chunks/Timeline-DOZgb1CG.js +915 -0
  42. package/dist/chunks/Timeline-DOZgb1CG.js.map +1 -0
  43. package/dist/chunks/{Toast-B7ylq7fz.js → Toast-LpN1WK8E.js} +1 -1
  44. package/dist/chunks/{Toast-B7ylq7fz.js.map → Toast-LpN1WK8E.js.map} +1 -1
  45. package/dist/chunks/{ToolButton-CtDkqUIc.js → ToolButton-B81YjdwO.js} +1 -1
  46. package/dist/chunks/{ToolButton-CtDkqUIc.js.map → ToolButton-B81YjdwO.js.map} +1 -1
  47. package/dist/chunks/{ToolGroup-zDtqt0QJ.js → ToolGroup-D7juDOC_.js} +1 -1
  48. package/dist/chunks/{ToolGroup-zDtqt0QJ.js.map → ToolGroup-D7juDOC_.js.map} +1 -1
  49. package/dist/chunks/{ToolPalette-BbrMHfQ9.js → ToolPalette-BSzmRJS7.js} +3 -3
  50. package/dist/chunks/{ToolPalette-BbrMHfQ9.js.map → ToolPalette-BSzmRJS7.js.map} +1 -1
  51. package/dist/chunks/createKeyframeLayer-AL4jP0EX.js +694 -0
  52. package/dist/chunks/createKeyframeLayer-AL4jP0EX.js.map +1 -0
  53. package/dist/chunks/number-f6PydOZK.js +52 -0
  54. package/dist/chunks/number-f6PydOZK.js.map +1 -0
  55. package/dist/chunks/{schema-CtWwGbqJ.js → schema-CPdFNeP6.js} +15 -9
  56. package/dist/chunks/schema-CPdFNeP6.js.map +1 -0
  57. package/dist/components/BandEditor/index.js +1 -1
  58. package/dist/components/Callout/index.js +1 -1
  59. package/dist/components/ComboBox/ComboBox.d.ts +36 -0
  60. package/dist/components/ComboBox/ComboBox.d.ts.map +1 -1
  61. package/dist/components/ComboBox/index.d.ts +1 -1
  62. package/dist/components/ComboBox/index.d.ts.map +1 -1
  63. package/dist/components/ComboBox/index.js +1 -1
  64. package/dist/components/CurveEditor/CurveEditor.d.ts +4 -2
  65. package/dist/components/CurveEditor/CurveEditor.d.ts.map +1 -1
  66. package/dist/components/CurveEditor/LayeredCurveEditor.d.ts +8 -1
  67. package/dist/components/CurveEditor/LayeredCurveEditor.d.ts.map +1 -1
  68. package/dist/components/CurveEditor/createFunctionLayer.d.ts +2 -0
  69. package/dist/components/CurveEditor/createFunctionLayer.d.ts.map +1 -1
  70. package/dist/components/CurveEditor/createKeyframeLayer.d.ts +70 -0
  71. package/dist/components/CurveEditor/createKeyframeLayer.d.ts.map +1 -0
  72. package/dist/components/CurveEditor/index.d.ts +3 -1
  73. package/dist/components/CurveEditor/index.d.ts.map +1 -1
  74. package/dist/components/CurveEditor/index.js +3 -2
  75. package/dist/components/CurveEditor/layerTypes.d.ts +8 -3
  76. package/dist/components/CurveEditor/layerTypes.d.ts.map +1 -1
  77. package/dist/components/CurveEditor/snap.d.ts +3 -0
  78. package/dist/components/CurveEditor/snap.d.ts.map +1 -0
  79. package/dist/components/DetentSlider/index.js +1 -1
  80. package/dist/components/GradientEditor/index.js +1 -1
  81. package/dist/components/MenuButton/MenuButton.d.ts +29 -0
  82. package/dist/components/MenuButton/MenuButton.d.ts.map +1 -0
  83. package/dist/components/MenuButton/index.d.ts +3 -0
  84. package/dist/components/MenuButton/index.d.ts.map +1 -0
  85. package/dist/components/MenuButton/index.js +2 -0
  86. package/dist/components/NumberField/UnitField.d.ts +30 -0
  87. package/dist/components/NumberField/UnitField.d.ts.map +1 -0
  88. package/dist/components/NumberField/index.d.ts +2 -0
  89. package/dist/components/NumberField/index.d.ts.map +1 -1
  90. package/dist/components/NumberField/index.js +2 -2
  91. package/dist/components/PaintInput/index.js +1 -1
  92. package/dist/components/Plot2D/Plot2D.d.ts +38 -2
  93. package/dist/components/Plot2D/Plot2D.d.ts.map +1 -1
  94. package/dist/components/Plot2D/index.d.ts +2 -1
  95. package/dist/components/Plot2D/index.d.ts.map +1 -1
  96. package/dist/components/Plot2D/index.js +2 -2
  97. package/dist/components/Plot2D/ticks.d.ts +43 -0
  98. package/dist/components/Plot2D/ticks.d.ts.map +1 -0
  99. package/dist/components/PointPlotter/PointPlotter.d.ts +3 -1
  100. package/dist/components/PointPlotter/PointPlotter.d.ts.map +1 -1
  101. package/dist/components/PointPlotter/index.js +1 -1
  102. package/dist/components/Prefs/PrefsForm.d.ts.map +1 -1
  103. package/dist/components/Prefs/index.d.ts +1 -1
  104. package/dist/components/Prefs/index.d.ts.map +1 -1
  105. package/dist/components/Prefs/index.js +3 -3
  106. package/dist/components/Prefs/schema.d.ts +5 -2
  107. package/dist/components/Prefs/schema.d.ts.map +1 -1
  108. package/dist/components/Properties/PropertyPanel.d.ts +15 -6
  109. package/dist/components/Properties/PropertyPanel.d.ts.map +1 -1
  110. package/dist/components/Properties/index.js +1 -1
  111. package/dist/components/ResizeHandle/index.js +1 -1
  112. package/dist/components/SelectionPanel/index.js +1 -1
  113. package/dist/components/Sidebar/index.js +1 -1
  114. package/dist/components/SidebarPanel/index.js +1 -1
  115. package/dist/components/Slider/index.js +1 -1
  116. package/dist/components/StatusBar/index.js +1 -1
  117. package/dist/components/Tabs/index.js +1 -1
  118. package/dist/components/Timeline/Lane.d.ts +9 -7
  119. package/dist/components/Timeline/Lane.d.ts.map +1 -1
  120. package/dist/components/Timeline/LaneGraph.d.ts +24 -0
  121. package/dist/components/Timeline/LaneGraph.d.ts.map +1 -0
  122. package/dist/components/Timeline/Ruler.d.ts.map +1 -1
  123. package/dist/components/Timeline/Timeline.d.ts.map +1 -1
  124. package/dist/components/Timeline/index.js +1 -1
  125. package/dist/components/Timeline/keys.d.ts +4 -3
  126. package/dist/components/Timeline/keys.d.ts.map +1 -1
  127. package/dist/components/Timeline/timeScale.d.ts +2 -0
  128. package/dist/components/Timeline/timeScale.d.ts.map +1 -1
  129. package/dist/components/Toast/index.js +1 -1
  130. package/dist/components/ToolButton/index.js +1 -1
  131. package/dist/components/ToolGroup/index.js +1 -1
  132. package/dist/components/ToolPalette/index.js +1 -1
  133. package/dist/format/number.d.ts +16 -0
  134. package/dist/format/number.d.ts.map +1 -1
  135. package/dist/index.d.ts +4 -1
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +99 -64
  138. package/dist/index.js.map +1 -1
  139. package/dist/style.css +1 -1
  140. package/dist/useAsyncOptions.d.ts +38 -0
  141. package/dist/useAsyncOptions.d.ts.map +1 -0
  142. package/package.json +7 -6
  143. package/dist/chunks/ComboBox-BBRRWvdc.js +0 -107
  144. package/dist/chunks/ComboBox-BBRRWvdc.js.map +0 -1
  145. package/dist/chunks/CurveEditor-DtjdpJVB.js +0 -784
  146. package/dist/chunks/CurveEditor-DtjdpJVB.js.map +0 -1
  147. package/dist/chunks/NumberField-DBowmOfe.js +0 -62
  148. package/dist/chunks/NumberField-DBowmOfe.js.map +0 -1
  149. package/dist/chunks/Plot2D-C97pO13t.js +0 -134
  150. package/dist/chunks/Plot2D-C97pO13t.js.map +0 -1
  151. package/dist/chunks/PointPlotter-CbDKVggs.js.map +0 -1
  152. package/dist/chunks/Prefs-4JSEtuU-.js +0 -294
  153. package/dist/chunks/Prefs-4JSEtuU-.js.map +0 -1
  154. package/dist/chunks/Properties-BpUYKi7-.js +0 -758
  155. package/dist/chunks/Properties-BpUYKi7-.js.map +0 -1
  156. package/dist/chunks/SelectionPanel-C59wavdA.js.map +0 -1
  157. package/dist/chunks/Timeline-Bz806JbE.js +0 -908
  158. package/dist/chunks/Timeline-Bz806JbE.js.map +0 -1
  159. package/dist/chunks/number-Bv1nbhOJ.js +0 -18
  160. package/dist/chunks/number-Bv1nbhOJ.js.map +0 -1
  161. package/dist/chunks/schema-CtWwGbqJ.js.map +0 -1
@@ -0,0 +1,915 @@
1
+ import { H as e, R as t, i as n } from "./icons-BV27dhKB.js";
2
+ import { r } from "./Plot2D-CVZwQpWJ.js";
3
+ import { a as i, i as a, n as o, t as s } from "./createKeyframeLayer-AL4jP0EX.js";
4
+ import { t as c } from "./DetentSlider-CYicfnKr.js";
5
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
6
+ import { EASINGS as f, openPointerSession as p, resolveEasing as m, sampleTrack as h, useVisibleRaf as g } from "@weasel-js/core";
7
+ import { useCallback as _, useEffect as v, useLayoutEffect as y, useMemo as b, useReducer as x, useRef as S, useState as C } from "react";
8
+ var w = {
9
+ ruler: "_ruler_1s0c6_1",
10
+ tick: "_tick_1s0c6_11",
11
+ playhead: "_playhead_1s0c6_29",
12
+ lane: "_lane_1s0c6_38",
13
+ laneLabel: "_laneLabel_1s0c6_45",
14
+ disclosure: "_disclosure_1s0c6_65",
15
+ disclosureIcon: "_disclosureIcon_1s0c6_66",
16
+ disclosureCollapsed: "_disclosureCollapsed_1s0c6_67",
17
+ laneTrack: "_laneTrack_1s0c6_69",
18
+ key: "_key_1s0c6_76",
19
+ eventMark: "_eventMark_1s0c6_76",
20
+ keyGhost: "_keyGhost_1s0c6_96",
21
+ eventGhost: "_eventGhost_1s0c6_96",
22
+ graphHost: "_graphHost_1s0c6_113",
23
+ graph: "_graph_1s0c6_113",
24
+ nestedBar: "_nestedBar_1s0c6_132",
25
+ transport: "_transport_1s0c6_141",
26
+ transportButton: "_transportButton_1s0c6_150",
27
+ transportRow: "_transportRow_1s0c6_176",
28
+ time: "_time_1s0c6_191",
29
+ rate: "_rate_1s0c6_192",
30
+ rateSlider: "_rateSlider_1s0c6_193",
31
+ rateReadout: "_rateReadout_1s0c6_197",
32
+ root: "_root_1s0c6_203",
33
+ label: "_label_1s0c6_218",
34
+ body: "_body_1s0c6_220",
35
+ gutter: "_gutter_1s0c6_46",
36
+ rulerWrap: "_rulerWrap_1s0c6_222",
37
+ lanes: "_lanes_1s0c6_224",
38
+ inspector: "_inspector_1s0c6_231",
39
+ segment: "_segment_1s0c6_240",
40
+ easingPicker: "_easingPicker_1s0c6_250",
41
+ easingLabel: "_easingLabel_1s0c6_251",
42
+ easingPreview: "_easingPreview_1s0c6_253"
43
+ };
44
+ //#endregion
45
+ //#region src/components/Timeline/easingSpec.ts
46
+ function T(e) {
47
+ return typeof e == "object" && e && "bezier" in e ? e.bezier : null;
48
+ }
49
+ function E(e) {
50
+ return e === void 0 ? null : T(e);
51
+ }
52
+ function D(e) {
53
+ if (e === void 0) return "linear";
54
+ if (typeof e == "string") return e;
55
+ let t = T(e);
56
+ if (t) return `cubic-bezier(${t.join(", ")})`;
57
+ for (let [t, n] of Object.entries(f)) if (n === e) return t;
58
+ return "custom";
59
+ }
60
+ function O(e, t) {
61
+ let n = m(e), r = Array(t), i = t - 1;
62
+ for (let e = 0; e < t; e++) r[e] = n(i === 0 ? 0 : e / i);
63
+ return r;
64
+ }
65
+ var k = Object.keys(f), A = 24, j = {
66
+ linear: [
67
+ 0,
68
+ 0,
69
+ 1,
70
+ 1
71
+ ],
72
+ easeInQuad: [
73
+ .11,
74
+ 0,
75
+ .5,
76
+ 0
77
+ ],
78
+ easeOutQuad: [
79
+ .5,
80
+ 1,
81
+ .89,
82
+ 1
83
+ ],
84
+ easeInOutQuad: [
85
+ .45,
86
+ 0,
87
+ .55,
88
+ 1
89
+ ],
90
+ easeInCubic: [
91
+ .32,
92
+ 0,
93
+ .67,
94
+ 0
95
+ ],
96
+ easeOutCubic: [
97
+ .33,
98
+ 1,
99
+ .68,
100
+ 1
101
+ ],
102
+ easeInOutCubic: [
103
+ .65,
104
+ 0,
105
+ .35,
106
+ 1
107
+ ],
108
+ easeInSine: [
109
+ .12,
110
+ 0,
111
+ .39,
112
+ 0
113
+ ],
114
+ easeOutSine: [
115
+ .61,
116
+ 1,
117
+ .88,
118
+ 1
119
+ ],
120
+ easeInOutSine: [
121
+ .37,
122
+ 0,
123
+ .63,
124
+ 1
125
+ ]
126
+ }, M = [
127
+ .25,
128
+ .1,
129
+ .25,
130
+ 1
131
+ ];
132
+ function N(e) {
133
+ let { value: t, onChange: n } = e, r = E(t), i = D(t), a = r === null && k.includes(i), o = r === null ? a ? i : "linear" : "custom", s = O(t, A).map((e, t) => `${t / (A - 1) * 100},${100 - e * 100}`).join(" ");
134
+ return /* @__PURE__ */ d("div", {
135
+ className: w.easingPicker,
136
+ children: [
137
+ /* @__PURE__ */ d("label", { children: ["Easing", /* @__PURE__ */ d("select", {
138
+ value: o,
139
+ onChange: (e) => n(e.target.value === "linear" ? void 0 : e.target.value),
140
+ children: [
141
+ /* @__PURE__ */ u("option", {
142
+ value: "linear",
143
+ children: "linear"
144
+ }),
145
+ k.filter((e) => e !== "linear").map((e) => /* @__PURE__ */ u("option", {
146
+ value: e,
147
+ children: e
148
+ }, e)),
149
+ r === null ? null : /* @__PURE__ */ u("option", {
150
+ value: "custom",
151
+ children: "custom"
152
+ })
153
+ ]
154
+ })] }),
155
+ r === null ? /* @__PURE__ */ u("button", {
156
+ type: "button",
157
+ className: w.transportButton,
158
+ onClick: () => n({ bezier: j[o] ?? M }),
159
+ children: "Convert to bezier"
160
+ }) : /* @__PURE__ */ u("span", {
161
+ className: w.easingLabel,
162
+ children: i
163
+ }),
164
+ /* @__PURE__ */ u("svg", {
165
+ className: w.easingPreview,
166
+ "data-testid": "easing-preview",
167
+ viewBox: "0 0 100 100",
168
+ preserveAspectRatio: "none",
169
+ children: /* @__PURE__ */ u("polyline", {
170
+ points: s,
171
+ vectorEffect: "non-scaling-stroke"
172
+ })
173
+ })
174
+ ]
175
+ });
176
+ }
177
+ //#endregion
178
+ //#region src/components/Timeline/timeScale.ts
179
+ var P = 1;
180
+ function F(e, t) {
181
+ let n = e.to - e.from, r = n === 0 ? 0 : t / n, i = t === 0 ? 0 : n / t;
182
+ return {
183
+ window: e,
184
+ widthPx: t,
185
+ toPx: (t) => (t - e.from) * r,
186
+ toMs: (t) => e.from + t * i
187
+ };
188
+ }
189
+ function I(e, t) {
190
+ let n = e.to - e.from;
191
+ return n === 0 ? 0 : (t - e.from) / n;
192
+ }
193
+ function L(e, t) {
194
+ return `${I(e, t) * 100}%`;
195
+ }
196
+ function R(e, t) {
197
+ let n = e.to - e.from;
198
+ return n === 0 ? 0 : t / n;
199
+ }
200
+ function z(e, t) {
201
+ return `${R(e, t) * 100}%`;
202
+ }
203
+ function B(e, t) {
204
+ let n = Math.min(e.to - e.from, t.to - t.from), r = e.from;
205
+ return r < t.from && (r = t.from), r + n > t.to && (r = t.to - n), {
206
+ from: r,
207
+ to: r + n
208
+ };
209
+ }
210
+ function ee(e, t, n, r) {
211
+ let i = e.to - e.from, a = r.to - r.from, o = Math.min(a, Math.max(P, i * n)), s = i === 0 ? .5 : (t - e.from) / i;
212
+ return B({
213
+ from: t - s * o,
214
+ to: t + (1 - s) * o
215
+ }, r);
216
+ }
217
+ function te(e, t, n) {
218
+ return B({
219
+ from: e.from + t,
220
+ to: e.to + t
221
+ }, n);
222
+ }
223
+ function V(e, t, n) {
224
+ let i = e.to - e.from;
225
+ if (t <= 0 || i <= 0) return [];
226
+ let a = r(n / t * i), o = [];
227
+ for (let t = Math.ceil(e.from / a) * a; t <= e.to + 1e-9; t += a) o.push(Math.round(t / a) * a);
228
+ return o;
229
+ }
230
+ //#endregion
231
+ //#region src/components/Timeline/lanes.ts
232
+ function ne(e) {
233
+ if (e.kind !== "sampled") return !1;
234
+ let t = e.keys;
235
+ return t.length > 0 && t.every((e) => typeof e.value == "number");
236
+ }
237
+ function re(e, t) {
238
+ let n = [], r = (e, i, a, o) => {
239
+ e.forEach((e, s) => {
240
+ let c = [...i, s], l = c.join(".");
241
+ n.push({
242
+ key: l,
243
+ path: c,
244
+ track: e,
245
+ label: e.label ?? `${e.kind} ${s}`,
246
+ depth: a,
247
+ offset: o,
248
+ kind: e.kind,
249
+ numeric: ne(e)
250
+ }), e.kind === "timeline" && t.has(l) && r(e.timeline.tracks, c, a + 1, o + e.at);
251
+ });
252
+ };
253
+ return r(e, [], 0, 0), n;
254
+ }
255
+ function H(e, t) {
256
+ let n = e, r;
257
+ for (let e of t) {
258
+ if (r = n[e], !r) return;
259
+ n = r.kind === "timeline" ? r.timeline.tracks : [];
260
+ }
261
+ return r;
262
+ }
263
+ //#endregion
264
+ //#region src/components/Timeline/keys.ts
265
+ function U(e, t) {
266
+ return e.length === t.length && e.every((e, n) => e === t[n]);
267
+ }
268
+ function W(e, t) {
269
+ return {
270
+ ...e,
271
+ keys: t
272
+ };
273
+ }
274
+ function ie(e, t) {
275
+ return {
276
+ ...e,
277
+ events: t
278
+ };
279
+ }
280
+ function G(e, t, n) {
281
+ let r = e.slice(), [i, ...a] = t;
282
+ if (a.length === 0) return r[i] = n, r;
283
+ let o = r[i];
284
+ if (o?.kind !== "timeline") return r;
285
+ let s = o;
286
+ return r[i] = {
287
+ ...s,
288
+ timeline: {
289
+ ...s.timeline,
290
+ tracks: G(s.timeline.tracks, a, n)
291
+ }
292
+ }, r;
293
+ }
294
+ function K(e, t, n) {
295
+ let r = H(e, t.trackPath), i = Math.max(0, n);
296
+ if (r?.kind === "sampled") {
297
+ let n = r, a = {
298
+ ...n.keys[t.keyIndex],
299
+ t: i
300
+ }, o = n.keys.filter((e, n) => n !== t.keyIndex), s = o.findIndex((e) => e.t > i), c = s === -1 ? o.length : s;
301
+ return o.splice(c, 0, a), {
302
+ tracks: G(e, t.trackPath, W(r, o)),
303
+ selection: {
304
+ trackPath: t.trackPath,
305
+ keyIndex: c
306
+ }
307
+ };
308
+ }
309
+ if (r?.kind === "event") {
310
+ let n = r, a = {
311
+ ...n.events[t.keyIndex],
312
+ t: i
313
+ }, o = n.events.filter((e, n) => n !== t.keyIndex), s = o.findIndex((e) => e.t > i), c = s === -1 ? o.length : s;
314
+ return o.splice(c, 0, a), {
315
+ tracks: G(e, t.trackPath, ie(r, o)),
316
+ selection: {
317
+ trackPath: t.trackPath,
318
+ keyIndex: c
319
+ }
320
+ };
321
+ }
322
+ return {
323
+ tracks: e.slice(),
324
+ selection: t
325
+ };
326
+ }
327
+ function ae(e, t, n) {
328
+ let r = H(e, t);
329
+ if (r?.kind !== "sampled") return {
330
+ tracks: e.slice(),
331
+ selection: null
332
+ };
333
+ let i = r, a = Math.max(0, n), o = i.keys.length === 0 ? 0 : h(i, a), s = i.keys.slice(), c = s.findIndex((e) => e.t > a), l = c === -1 ? s.length : c;
334
+ return s.splice(l, 0, {
335
+ t: a,
336
+ value: o
337
+ }), {
338
+ tracks: G(e, t, W(r, s)),
339
+ selection: {
340
+ trackPath: t,
341
+ keyIndex: l
342
+ }
343
+ };
344
+ }
345
+ function oe(e, t) {
346
+ let n = H(e, t.trackPath);
347
+ if (n?.kind !== "sampled") return {
348
+ tracks: e.slice(),
349
+ selection: t
350
+ };
351
+ let r = n.keys.filter((e, n) => n !== t.keyIndex);
352
+ return {
353
+ tracks: G(e, t.trackPath, W(n, r)),
354
+ selection: r.length === 0 ? null : {
355
+ trackPath: t.trackPath,
356
+ keyIndex: Math.max(0, t.keyIndex - 1)
357
+ }
358
+ };
359
+ }
360
+ function q(e, t, n) {
361
+ let r = H(e, t.trackPath);
362
+ if (r?.kind !== "sampled") return e.slice();
363
+ let i = r.keys.slice(), { easing: a, ...o } = i[t.keyIndex];
364
+ return i[t.keyIndex] = n === void 0 ? o : {
365
+ ...o,
366
+ easing: n
367
+ }, G(e, t.trackPath, W(r, i));
368
+ }
369
+ function J(e, t, n) {
370
+ let r = H(e, t);
371
+ return r?.kind === "sampled" ? G(e, t, W(r, n.slice())) : e.slice();
372
+ }
373
+ function se(e, t, n) {
374
+ let r = H(e, t.trackPath);
375
+ if (r?.kind !== "sampled") return e.slice();
376
+ let i = r.keys.slice();
377
+ return i[t.keyIndex] = {
378
+ ...i[t.keyIndex],
379
+ value: n
380
+ }, G(e, t.trackPath, W(r, i));
381
+ }
382
+ //#endregion
383
+ //#region src/components/Timeline/LaneGraph.tsx
384
+ var Y = 8, ce = 10;
385
+ function le(e) {
386
+ let t = e.map((e) => e.value), n = Math.min(...t), r = Math.max(...t) - n || 1, i = r * Y / (100 - 2 * Y);
387
+ return [n - i, n + r + i];
388
+ }
389
+ function ue(e) {
390
+ let { keys: t, label: n, window: r, offset: a, snapTimes: c, selection: l, selectedSegment: d, onSelect: f, onSelectSegment: p, onKeysInput: m, onKeysCommit: h } = e, g = S(null), [_, v] = C({
391
+ width: 0,
392
+ height: 0
393
+ });
394
+ y(() => {
395
+ let e = g.current;
396
+ if (!e) return;
397
+ let t = () => {
398
+ let t = e.getBoundingClientRect();
399
+ v((e) => e.width === t.width && e.height === t.height ? e : {
400
+ width: t.width,
401
+ height: t.height
402
+ });
403
+ };
404
+ if (t(), typeof ResizeObserver > "u") return;
405
+ let n = new ResizeObserver(t);
406
+ return n.observe(e), () => n.disconnect();
407
+ }, []);
408
+ let x = b(() => o({
409
+ id: "keys",
410
+ label: n,
411
+ formatX: (e) => `${Math.round(e)} ms`,
412
+ snapX: c.map((e) => e - a),
413
+ xClamp: [0, Infinity],
414
+ step: { x: ce }
415
+ }), [
416
+ n,
417
+ c,
418
+ a
419
+ ]), T = b(() => ({
420
+ keys: t,
421
+ selectedKey: l,
422
+ selectedSegment: d,
423
+ drag: null
424
+ }), [
425
+ t,
426
+ l,
427
+ d
428
+ ]), [E, D] = C(null), O = E ?? T, k = S(O);
429
+ k.current = O;
430
+ let A = b(() => [{
431
+ layer: x,
432
+ state: O
433
+ }], [x, O]), j = (e, t) => {
434
+ let n = t, r = k.current;
435
+ if (n.selectedKey !== null && n.selectedKey !== r.selectedKey && f(n.selectedKey), n.selectedSegment !== null && n.selectedSegment !== r.selectedSegment && p?.(n.selectedSegment), !n.drag) {
436
+ D(null);
437
+ return;
438
+ }
439
+ if (D(n), n.drag.kind !== "key") return;
440
+ let i = s(n).keys;
441
+ i !== n.keys && m?.(i);
442
+ }, M = (e, t, n) => {
443
+ D(null);
444
+ let r = t;
445
+ r.keys !== n.keys && h(r.keys);
446
+ }, [N, P] = le(O.keys), F = _.width > 0 ? V(r, _.width, 64) : [];
447
+ return /* @__PURE__ */ u("div", {
448
+ ref: g,
449
+ className: w.graphHost,
450
+ children: _.width > 0 && _.height > 0 ? /* @__PURE__ */ u(i, {
451
+ className: w.graph,
452
+ "aria-label": `${n} graph`,
453
+ layers: A,
454
+ onLayerChange: j,
455
+ onLayerCommit: M,
456
+ width: _.width,
457
+ height: _.height,
458
+ xRange: [r.from - a, r.to - a],
459
+ yRange: [N, P],
460
+ grid: !1,
461
+ axes: !1,
462
+ xTicks: {
463
+ values: F.map((e) => e - a),
464
+ labels: !1
465
+ },
466
+ yTicks: {
467
+ labels: "outside",
468
+ gap: 10
469
+ },
470
+ history: !1
471
+ }) : null
472
+ });
473
+ }
474
+ //#endregion
475
+ //#region src/components/Timeline/Lane.tsx
476
+ var de = 6, fe = 10;
477
+ function pe(e) {
478
+ return e.kind === "sampled" ? e.track.keys.map((e) => e.t) : e.kind === "event" ? e.track.events.map((e) => e.t) : [];
479
+ }
480
+ function me(e) {
481
+ let { row: t, window: r, mode: i, selection: o, onSelect: s, onKeyInput: c, onKeyCommit: f, onInsert: m, onToggleExpand: h, expanded: g, snapTimes: _, selectedSegment: y = null, onSelectSegment: b, onKeysInput: x, onKeysCommit: T } = e, E = S(null), D = S(null);
482
+ v(() => () => {
483
+ D.current?.cancel();
484
+ }, []);
485
+ let [O, k] = C(null), A = (e) => L(r, e + t.offset), j = (e) => {
486
+ let n = E.current?.getBoundingClientRect();
487
+ return n ? F(r, n.width).toMs(e - n.left) - t.offset : r.from;
488
+ }, M = () => {
489
+ let e = F(r, E.current?.getBoundingClientRect().width ?? 0);
490
+ return e.toMs(de) - e.toMs(0);
491
+ }, N = i === "graph" && t.numeric, P = t.kind === "sampled" ? t.track.keys : [], I = (e) => (n) => {
492
+ if (n.button !== 0) return;
493
+ n.stopPropagation(), s(e);
494
+ let r = (e) => {
495
+ let n = Math.max(0, j(e.clientX));
496
+ return e.altKey ? n : a(n + t.offset, _, M()) - t.offset;
497
+ };
498
+ k({
499
+ keyIndex: e,
500
+ t: B[e]
501
+ });
502
+ let i = () => {
503
+ k(null), D.current = null;
504
+ };
505
+ D.current?.cancel(), D.current = p(n.currentTarget, n, {
506
+ onMove: (t) => {
507
+ k({
508
+ keyIndex: e,
509
+ t: r(t)
510
+ }), c(e, r(t));
511
+ },
512
+ onEnd: (t) => {
513
+ f(e, r(t)), i();
514
+ },
515
+ onCancel: i
516
+ }, { capture: !1 });
517
+ }, R = (e, t) => (n) => {
518
+ let r = fe * (n.shiftKey ? 10 : 1);
519
+ n.key === "ArrowRight" && (n.preventDefault(), f(e, t + r)), n.key === "ArrowLeft" && (n.preventDefault(), f(e, Math.max(0, t - r)));
520
+ }, B = pe(t);
521
+ return /* @__PURE__ */ d("div", {
522
+ className: w.lane,
523
+ "data-depth": t.depth,
524
+ "data-mode": i,
525
+ "data-graph": N ? "true" : void 0,
526
+ children: [/* @__PURE__ */ d("div", {
527
+ className: w.laneLabel,
528
+ children: [t.kind === "timeline" ? /* @__PURE__ */ u("span", {
529
+ role: "button",
530
+ tabIndex: 0,
531
+ "aria-expanded": g,
532
+ "data-testid": "timeline-disclosure",
533
+ className: w.disclosure,
534
+ onClick: h,
535
+ onKeyDown: (e) => {
536
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
537
+ },
538
+ children: /* @__PURE__ */ u(n, {
539
+ size: 14,
540
+ className: [w.disclosureIcon, !g && w.disclosureCollapsed].filter(Boolean).join(" ")
541
+ })
542
+ }) : null, t.label]
543
+ }), /* @__PURE__ */ u("div", {
544
+ className: w.laneTrack,
545
+ ref: E,
546
+ "data-testid": "timeline-lane-track",
547
+ onDoubleClick: (e) => {
548
+ t.kind === "sampled" && m(Math.max(0, j(e.clientX)));
549
+ },
550
+ children: N ? /* @__PURE__ */ u(ue, {
551
+ keys: P,
552
+ label: t.label,
553
+ window: r,
554
+ offset: t.offset,
555
+ snapTimes: _,
556
+ selection: o,
557
+ selectedSegment: y,
558
+ onSelect: s,
559
+ onSelectSegment: b,
560
+ onKeysInput: x,
561
+ onKeysCommit: (e) => T?.(e)
562
+ }) : /* @__PURE__ */ d(l, { children: [
563
+ t.kind === "timeline" ? /* @__PURE__ */ u("div", {
564
+ className: w.nestedBar,
565
+ "data-testid": "timeline-nested",
566
+ style: {
567
+ left: A(0),
568
+ width: z(r, t.track.timeline.duration ?? 0)
569
+ }
570
+ }) : null,
571
+ t.kind === "sampled" ? P.slice(1).map((e, n) => {
572
+ let i = n + 1;
573
+ return /* @__PURE__ */ u("div", {
574
+ role: "button",
575
+ tabIndex: 0,
576
+ "aria-label": `${t.label} segment into ${Math.round(e.t)} ms`,
577
+ "aria-current": y === i ? "true" : void 0,
578
+ "data-testid": "timeline-segment",
579
+ className: w.segment,
580
+ style: {
581
+ left: A(P[i - 1].t),
582
+ width: z(r, e.t - P[i - 1].t)
583
+ },
584
+ onClick: () => b?.(i),
585
+ onKeyDown: (e) => {
586
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), b?.(i));
587
+ }
588
+ }, `seg-${i}`);
589
+ }) : null,
590
+ B.map((e, n) => /* @__PURE__ */ u("div", {
591
+ role: "button",
592
+ tabIndex: 0,
593
+ "aria-label": `${t.label} key at ${Math.round(e)} ms`,
594
+ "aria-current": o === n ? "true" : void 0,
595
+ "data-testid": t.kind === "event" ? "timeline-event" : "timeline-key",
596
+ "data-dragging": O?.keyIndex === n ? "true" : void 0,
597
+ className: t.kind === "event" ? w.eventMark : w.key,
598
+ style: { left: A(e) },
599
+ onPointerDown: I(n),
600
+ onKeyDown: R(n, e)
601
+ }, n)),
602
+ O ? /* @__PURE__ */ u("div", {
603
+ "aria-hidden": "true",
604
+ "data-testid": "timeline-key-ghost",
605
+ className: t.kind === "event" ? w.eventGhost : w.keyGhost,
606
+ style: { left: A(O.t) }
607
+ }) : null
608
+ ] })
609
+ })]
610
+ });
611
+ }
612
+ //#endregion
613
+ //#region src/components/Timeline/Ruler.tsx
614
+ var he = .0015;
615
+ function ge(e) {
616
+ return e >= 1e3 ? `${(e / 1e3).toFixed(e % 1e3 == 0 ? 0 : 2)}s` : `${Math.round(e)}ms`;
617
+ }
618
+ function _e(e) {
619
+ let { window: t, bounds: n, playhead: r, onScrub: i, onWindowChange: a } = e, o = S(null), s = S(null);
620
+ v(() => () => {
621
+ s.current?.cancel();
622
+ }, []);
623
+ let [c, l] = C(0);
624
+ y(() => {
625
+ let e = o.current;
626
+ if (!e) return;
627
+ let t = () => l(e.getBoundingClientRect().width);
628
+ if (t(), typeof ResizeObserver > "u") return;
629
+ let n = new ResizeObserver(t);
630
+ return n.observe(e), () => n.disconnect();
631
+ }, []);
632
+ let f = () => o.current?.getBoundingClientRect().width ?? 0, m = (e) => {
633
+ let n = o.current?.getBoundingClientRect();
634
+ if (!n) return t.from;
635
+ let r = F(t, n.width).toMs(e - n.left);
636
+ return Math.min(t.to, Math.max(t.from, r));
637
+ }, h = (e) => {
638
+ if (e.button !== 0) return;
639
+ i(m(e.clientX)), s.current?.cancel();
640
+ let t = () => {
641
+ s.current = null;
642
+ };
643
+ s.current = p(e.currentTarget, e, {
644
+ onMove: (e) => {
645
+ i(m(e.clientX));
646
+ },
647
+ onEnd: t,
648
+ onCancel: t
649
+ }, { capture: !1 });
650
+ }, g = (e) => {
651
+ if (e.ctrlKey) a(ee(t, m(e.clientX), Math.exp(e.deltaY * he), n));
652
+ else {
653
+ let r = f(), i = r === 0 ? 0 : (t.to - t.from) / r;
654
+ a(te(t, e.deltaY * i, n));
655
+ }
656
+ }, _ = V(t, c, 64), b = (e) => L(t, e);
657
+ return /* @__PURE__ */ d("div", {
658
+ className: w.ruler,
659
+ ref: o,
660
+ "data-testid": "timeline-ruler",
661
+ onPointerDown: h,
662
+ onWheel: g,
663
+ children: [_.map((e) => /* @__PURE__ */ u("span", {
664
+ className: w.tick,
665
+ "data-testid": "timeline-tick",
666
+ style: { left: b(e) },
667
+ children: ge(e)
668
+ }, e)), /* @__PURE__ */ u("div", {
669
+ className: w.playhead,
670
+ "data-testid": "timeline-playhead",
671
+ style: { left: b(r) }
672
+ })]
673
+ });
674
+ }
675
+ //#endregion
676
+ //#region src/components/Timeline/Transport.tsx
677
+ var X = [
678
+ .25,
679
+ .5,
680
+ 1,
681
+ 2,
682
+ 4
683
+ ], Z = (e) => `${(e / 1e3).toFixed(2)}s`;
684
+ function Q(n) {
685
+ let { paused: r, loop: i, rate: a, playhead: o, duration: s, onPlay: l, onPause: f, onLoopChange: p, onRateChange: m } = n, h = i !== !1 && i !== 0, g = X.includes(a) ? X : [...X, a].sort((e, t) => e - t);
686
+ return /* @__PURE__ */ d("div", {
687
+ className: w.transport,
688
+ children: [
689
+ /* @__PURE__ */ u("button", {
690
+ type: "button",
691
+ className: w.transportButton,
692
+ "aria-label": r ? "Play" : "Pause",
693
+ onClick: r ? l : f,
694
+ children: u(r ? e : t, { size: 14 })
695
+ }),
696
+ /* @__PURE__ */ d("span", {
697
+ className: w.time,
698
+ "data-testid": "timeline-time",
699
+ children: [
700
+ Z(o),
701
+ " / ",
702
+ Z(s)
703
+ ]
704
+ }),
705
+ /* @__PURE__ */ u("button", {
706
+ type: "button",
707
+ role: "switch",
708
+ "aria-checked": h,
709
+ "aria-label": "Loop",
710
+ className: w.transportButton,
711
+ onClick: () => p(!h),
712
+ children: "⟲"
713
+ }),
714
+ /* @__PURE__ */ d("div", {
715
+ className: w.rate,
716
+ children: [
717
+ "Rate",
718
+ /* @__PURE__ */ u(c, {
719
+ ariaLabel: "Rate",
720
+ items: g,
721
+ value: a,
722
+ onChange: m,
723
+ formatLabel: (e) => `${e}x`,
724
+ labels: "none",
725
+ className: w.rateSlider
726
+ }),
727
+ /* @__PURE__ */ d("span", {
728
+ className: w.rateReadout,
729
+ children: [a, "x"]
730
+ })
731
+ ]
732
+ })
733
+ ]
734
+ });
735
+ }
736
+ //#endregion
737
+ //#region src/components/Timeline/Timeline.tsx
738
+ function $(e) {
739
+ let { tracks: t, duration: n, playhead: r, onInput: i, onChange: a, onScrub: o, renderKeyEditor: s, label: c, className: l } = e, [f, p] = C(() => /* @__PURE__ */ new Set()), [m, h] = C({
740
+ from: 0,
741
+ to: n
742
+ }), [g, _] = C(null), [v, y] = C(null), x = e.window ?? m, S = e.onWindowChange ?? h, T = e.selection === void 0 ? g : e.selection, E = e.onSelect ?? _, D = {
743
+ from: 0,
744
+ to: n
745
+ }, O = b(() => re(t, f), [t, f]), k = b(() => {
746
+ let e = new Set([0, n]);
747
+ for (let t of O) if (t.kind === "sampled") for (let n of t.track.keys) e.add(n.t + t.offset);
748
+ return [...e];
749
+ }, [O, n]), A = (e) => {
750
+ p((t) => {
751
+ let n = new Set(t);
752
+ return n.has(e) ? n.delete(e) : n.add(e), n;
753
+ });
754
+ }, j = (e) => {
755
+ if ((e.key === "Delete" || e.key === "Backspace") && T) {
756
+ e.preventDefault();
757
+ let n = oe(t, T);
758
+ a(n.tracks), E(n.selection);
759
+ }
760
+ }, M = T ? H(t, T.trackPath) : void 0, P = M?.kind === "sampled" ? M.keys[T.keyIndex] : void 0, F = v ? H(t, v.trackPath) : void 0, I = F?.kind === "sampled" ? F.keys[v.keyIndex] : void 0;
761
+ return /* @__PURE__ */ d("div", {
762
+ className: [w.root, l].filter(Boolean).join(" "),
763
+ "data-testid": "timeline-root",
764
+ tabIndex: -1,
765
+ onKeyDown: j,
766
+ children: [
767
+ c ? /* @__PURE__ */ u("div", {
768
+ className: w.label,
769
+ children: c
770
+ }) : null,
771
+ e.transport === !1 ? null : /* @__PURE__ */ d("div", {
772
+ className: w.transportRow,
773
+ children: [/* @__PURE__ */ u(Q, {
774
+ ...e.transport ?? {
775
+ paused: !0,
776
+ loop: !1,
777
+ rate: 1,
778
+ onPlay: () => {},
779
+ onPause: () => {},
780
+ onLoopChange: () => {},
781
+ onRateChange: () => {}
782
+ },
783
+ playhead: r,
784
+ duration: n
785
+ }), /* @__PURE__ */ u("button", {
786
+ type: "button",
787
+ role: "switch",
788
+ "aria-checked": (e.mode ?? "dope") === "graph",
789
+ "aria-label": "Graph mode",
790
+ className: w.transportButton,
791
+ onClick: () => e.onModeChange?.((e.mode ?? "dope") === "graph" ? "dope" : "graph"),
792
+ children: "Graph"
793
+ })]
794
+ }),
795
+ /* @__PURE__ */ d("div", {
796
+ className: w.body,
797
+ children: [/* @__PURE__ */ u("div", { className: w.gutter }), /* @__PURE__ */ u("div", {
798
+ className: w.rulerWrap,
799
+ children: /* @__PURE__ */ u(_e, {
800
+ window: x,
801
+ bounds: D,
802
+ playhead: r,
803
+ onScrub: o,
804
+ onWindowChange: S
805
+ })
806
+ })]
807
+ }),
808
+ /* @__PURE__ */ u("div", {
809
+ className: w.lanes,
810
+ children: O.map((n) => {
811
+ let r = n.path;
812
+ return /* @__PURE__ */ u(me, {
813
+ row: n,
814
+ window: x,
815
+ mode: e.mode ?? "dope",
816
+ selection: T && U(T.trackPath, r) ? T.keyIndex : null,
817
+ expanded: f.has(n.key),
818
+ snapTimes: k,
819
+ onToggleExpand: () => A(n.key),
820
+ onSelect: (e) => E({
821
+ trackPath: r,
822
+ keyIndex: e
823
+ }),
824
+ onKeyInput: (e, n) => {
825
+ i?.(K(t, {
826
+ trackPath: r,
827
+ keyIndex: e
828
+ }, n).tracks);
829
+ },
830
+ onKeyCommit: (e, n) => {
831
+ let i = K(t, {
832
+ trackPath: r,
833
+ keyIndex: e
834
+ }, n);
835
+ a(i.tracks), E(i.selection);
836
+ },
837
+ onKeysInput: (e) => i?.(J(t, r, e)),
838
+ onKeysCommit: (e) => a(J(t, r, e)),
839
+ onInsert: (e) => {
840
+ let n = ae(t, r, e);
841
+ a(n.tracks), E(n.selection);
842
+ },
843
+ selectedSegment: v && U(v.trackPath, r) ? v.keyIndex : null,
844
+ onSelectSegment: (e) => y({
845
+ trackPath: r,
846
+ keyIndex: e
847
+ })
848
+ }, n.key);
849
+ })
850
+ }),
851
+ s && T && P && M?.kind === "sampled" ? /* @__PURE__ */ u("div", {
852
+ className: w.inspector,
853
+ children: s({
854
+ key: P,
855
+ track: M,
856
+ selection: T,
857
+ commit: (e) => a(se(t, T, e.value)),
858
+ setEasing: (e) => a(q(t, T, e))
859
+ })
860
+ }) : null,
861
+ v && I ? /* @__PURE__ */ u("div", {
862
+ className: w.inspector,
863
+ children: /* @__PURE__ */ u(N, {
864
+ value: I.easing,
865
+ onChange: (e) => a(q(t, v, e))
866
+ })
867
+ }) : null
868
+ ]
869
+ });
870
+ }
871
+ //#endregion
872
+ //#region src/components/Timeline/AnimatedTimeline.tsx
873
+ function ve(e) {
874
+ let { handle: t, ...n } = e, [, r] = x((e) => e + 1, 0);
875
+ v(() => t.subscribe(r), [t]);
876
+ let i = S(null), a = g(() => {
877
+ r(), t.isPaused() || i.current?.request();
878
+ });
879
+ i.current = a, v(() => (t.isPaused() || a.request(), () => a.cancel()), [t, a]);
880
+ let o = _((e) => {
881
+ t.edit(() => {
882
+ let n = t.tracks();
883
+ n.splice(0, n.length, ...e);
884
+ });
885
+ }, [t]), s = t.time(), c = t.duration();
886
+ return /* @__PURE__ */ u($, {
887
+ ...n,
888
+ tracks: t.tracks(),
889
+ duration: c,
890
+ playhead: s,
891
+ onChange: o,
892
+ onScrub: t.seek,
893
+ transport: e.transport === !1 ? !1 : {
894
+ paused: t.isPaused(),
895
+ loop: t.loop(),
896
+ rate: t.timeScale(),
897
+ onPlay: () => {
898
+ t.time() >= c && t.seek(0), t.resume(), a.request(), r();
899
+ },
900
+ onPause: () => {
901
+ t.pause(), r();
902
+ },
903
+ onLoopChange: (e) => {
904
+ t.setLoop(e), r();
905
+ },
906
+ onRateChange: (e) => {
907
+ t.setTimeScale(e), r();
908
+ }
909
+ }
910
+ });
911
+ }
912
+ //#endregion
913
+ export { N as a, D as c, U as i, O as l, $ as n, k as o, Q as r, E as s, ve as t };
914
+
915
+ //# sourceMappingURL=Timeline-DOZgb1CG.js.map