@rendiv/core 0.1.2 → 0.1.3
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.
- package/dist/components/Loop.d.ts.map +1 -1
- package/dist/components/Sequence.d.ts +2 -0
- package/dist/components/Sequence.d.ts.map +1 -1
- package/dist/components/Series.d.ts +2 -0
- package/dist/components/Series.d.ts.map +1 -1
- package/dist/context/SequenceContext.d.ts +1 -0
- package/dist/context/SequenceContext.d.ts.map +1 -1
- package/dist/context/TimelineRegistryContext.d.ts +1 -0
- package/dist/context/TimelineRegistryContext.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +383 -369
- package/dist/types/timeline-override.d.ts +6 -0
- package/dist/types/timeline-override.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import G, { createContext as O, useContext as
|
|
2
|
-
import { jsx as
|
|
3
|
-
const
|
|
1
|
+
import G, { createContext as O, useContext as y, useEffect as N, forwardRef as ce, useId as se, useMemo as H, Children as J, useRef as x, useCallback as T, useState as ne } from "react";
|
|
2
|
+
import { jsx as S, Fragment as le } from "react/jsx-runtime";
|
|
3
|
+
const $ = O({
|
|
4
4
|
frame: 0,
|
|
5
5
|
playing: !1,
|
|
6
6
|
playingRef: { current: !1 }
|
|
7
|
-
}),
|
|
7
|
+
}), P = O({
|
|
8
8
|
id: null,
|
|
9
|
+
namePath: "",
|
|
9
10
|
from: 0,
|
|
10
11
|
durationInFrames: 1 / 0,
|
|
11
12
|
parentOffset: 0,
|
|
12
13
|
accumulatedOffset: 0,
|
|
13
14
|
localOffset: 0
|
|
14
15
|
});
|
|
15
|
-
function
|
|
16
|
-
const e =
|
|
16
|
+
function Ne() {
|
|
17
|
+
const e = y($), n = y(P);
|
|
17
18
|
return e.frame - n.accumulatedOffset;
|
|
18
19
|
}
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
-
const e =
|
|
20
|
+
const q = O(null);
|
|
21
|
+
function xe() {
|
|
22
|
+
const e = y(q);
|
|
22
23
|
if (!e)
|
|
23
24
|
throw new Error(
|
|
24
25
|
"useCompositionConfig() must be called inside a <Composition>, <Player>, or during rendering."
|
|
@@ -26,7 +27,7 @@ function Fe() {
|
|
|
26
27
|
return e;
|
|
27
28
|
}
|
|
28
29
|
const X = () => {
|
|
29
|
-
},
|
|
30
|
+
}, te = O({
|
|
30
31
|
compositions: [],
|
|
31
32
|
registerComposition: X,
|
|
32
33
|
unregisterComposition: X,
|
|
@@ -34,9 +35,9 @@ const X = () => {
|
|
|
34
35
|
setCurrentCompositionId: X,
|
|
35
36
|
inputProps: {}
|
|
36
37
|
}), j = O(null);
|
|
37
|
-
function
|
|
38
|
-
const { registerComposition: n, unregisterComposition: t } =
|
|
39
|
-
return
|
|
38
|
+
function Re(e) {
|
|
39
|
+
const { registerComposition: n, unregisterComposition: t } = y(te), o = y(j);
|
|
40
|
+
return N(() => (n({
|
|
40
41
|
id: e.id,
|
|
41
42
|
component: e.component,
|
|
42
43
|
durationInFrames: e.durationInFrames,
|
|
@@ -59,8 +60,8 @@ const ue = {
|
|
|
59
60
|
height: "100%",
|
|
60
61
|
display: "flex",
|
|
61
62
|
flexDirection: "column"
|
|
62
|
-
},
|
|
63
|
-
({ style: e, ...n }, t) => /* @__PURE__ */
|
|
63
|
+
}, Y = ce(
|
|
64
|
+
({ style: e, ...n }, t) => /* @__PURE__ */ S(
|
|
64
65
|
"div",
|
|
65
66
|
{
|
|
66
67
|
ref: t,
|
|
@@ -69,44 +70,54 @@ const ue = {
|
|
|
69
70
|
}
|
|
70
71
|
)
|
|
71
72
|
);
|
|
72
|
-
|
|
73
|
-
const
|
|
73
|
+
Y.displayName = "Fill";
|
|
74
|
+
const re = ({
|
|
74
75
|
from: e = 0,
|
|
75
76
|
durationInFrames: n = 1 / 0,
|
|
76
77
|
name: t,
|
|
77
78
|
layout: o = "absolute-fill",
|
|
78
79
|
style: r,
|
|
79
|
-
|
|
80
|
+
trackIndex: a = 0,
|
|
81
|
+
children: c
|
|
80
82
|
}) => {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
+
const i = y(P), d = y($), u = y(q), m = se(), h = t ?? "Sequence", b = `${h}[${e}]`, w = u ? `${u.id}/` : "", f = i.namePath ? `${i.namePath}/${b}` : `${w}${b}`;
|
|
84
|
+
let s = i.accumulatedOffset + e, g = n, I = a;
|
|
85
|
+
if (typeof window < "u") {
|
|
86
|
+
const v = window.__RENDIV_TIMELINE_OVERRIDES__, F = v == null ? void 0 : v.get(f);
|
|
87
|
+
F && (s = F.from, g = F.durationInFrames, F.trackIndex !== void 0 && (I = F.trackIndex));
|
|
88
|
+
}
|
|
89
|
+
const _ = I !== void 0 ? 1e4 - I : void 0, E = d.frame;
|
|
90
|
+
N(() => {
|
|
83
91
|
if (typeof window > "u") return;
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
return
|
|
88
|
-
|
|
92
|
+
const p = window;
|
|
93
|
+
p.__RENDIV_TIMELINE_ENTRIES__ || (p.__RENDIV_TIMELINE_ENTRIES__ = /* @__PURE__ */ new Map());
|
|
94
|
+
const v = p.__RENDIV_TIMELINE_ENTRIES__, F = i.id, A = { id: m, name: h, namePath: f, from: s, durationInFrames: g, parentId: F };
|
|
95
|
+
return v.set(m, A), document.dispatchEvent(new CustomEvent("rendiv:timeline-sync")), () => {
|
|
96
|
+
v.delete(m), document.dispatchEvent(new CustomEvent("rendiv:timeline-sync"));
|
|
89
97
|
};
|
|
90
|
-
}, [
|
|
91
|
-
const
|
|
98
|
+
}, [m, h, f, s, g]);
|
|
99
|
+
const C = H(
|
|
92
100
|
() => ({
|
|
93
|
-
id:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
101
|
+
id: m,
|
|
102
|
+
namePath: f,
|
|
103
|
+
from: s,
|
|
104
|
+
durationInFrames: g,
|
|
105
|
+
parentOffset: i.accumulatedOffset,
|
|
106
|
+
accumulatedOffset: s,
|
|
98
107
|
localOffset: e
|
|
99
108
|
}),
|
|
100
|
-
[
|
|
109
|
+
[m, f, s, g, i.accumulatedOffset, e]
|
|
101
110
|
);
|
|
102
|
-
if (
|
|
103
|
-
const
|
|
104
|
-
|
|
111
|
+
if (E < s || E >= s + g) return null;
|
|
112
|
+
const R = /* @__PURE__ */ S(P.Provider, { value: C, children: c });
|
|
113
|
+
if (o === "none") return R;
|
|
114
|
+
const k = _ !== void 0 ? { ...r, zIndex: _ } : r;
|
|
115
|
+
return /* @__PURE__ */ S(Y, { style: k, children: R });
|
|
105
116
|
};
|
|
106
|
-
|
|
117
|
+
re.displayName = "Sequence";
|
|
107
118
|
function $e(e) {
|
|
108
|
-
const { registerComposition: n, unregisterComposition: t } =
|
|
109
|
-
return
|
|
119
|
+
const { registerComposition: n, unregisterComposition: t } = y(te), o = y(j);
|
|
120
|
+
return N(() => (n({
|
|
110
121
|
id: e.id,
|
|
111
122
|
component: e.component,
|
|
112
123
|
durationInFrames: 1,
|
|
@@ -119,65 +130,67 @@ function $e(e) {
|
|
|
119
130
|
}), () => t(e.id)), [e.id]), null;
|
|
120
131
|
}
|
|
121
132
|
const fe = ({ name: e, children: n }) => {
|
|
122
|
-
const t =
|
|
123
|
-
return /* @__PURE__ */
|
|
133
|
+
const t = y(j), o = t ? `${t}/${e}` : e;
|
|
134
|
+
return /* @__PURE__ */ S(j.Provider, { value: o, children: n });
|
|
124
135
|
};
|
|
125
136
|
fe.displayName = "Folder";
|
|
126
|
-
function
|
|
137
|
+
function Z(e) {
|
|
127
138
|
throw new Error(
|
|
128
139
|
"<Series.Sequence> can only be used as a direct child of <Series>."
|
|
129
140
|
);
|
|
130
141
|
}
|
|
131
|
-
|
|
132
|
-
function
|
|
142
|
+
Z.displayName = "Series.Sequence";
|
|
143
|
+
function oe({ children: e }) {
|
|
133
144
|
const n = J.toArray(e);
|
|
134
145
|
let t = 0;
|
|
135
146
|
const o = [];
|
|
136
147
|
for (const r of n) {
|
|
137
148
|
if (!G.isValidElement(r)) continue;
|
|
138
|
-
if (r.type !==
|
|
149
|
+
if (r.type !== Z)
|
|
139
150
|
throw new Error(
|
|
140
151
|
"Only <Series.Sequence> elements are allowed as children of <Series>."
|
|
141
152
|
);
|
|
142
153
|
const {
|
|
143
|
-
durationInFrames:
|
|
154
|
+
durationInFrames: a,
|
|
144
155
|
offset: c = 0,
|
|
145
|
-
name:
|
|
146
|
-
layout:
|
|
147
|
-
style:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
name: i,
|
|
157
|
+
layout: d,
|
|
158
|
+
style: u,
|
|
159
|
+
trackIndex: m,
|
|
160
|
+
children: h
|
|
161
|
+
} = r.props, b = t + c;
|
|
162
|
+
let w = i;
|
|
163
|
+
if (!w) {
|
|
164
|
+
const f = J.toArray(h);
|
|
165
|
+
if (f.length > 0) {
|
|
166
|
+
const l = f[0];
|
|
167
|
+
if (G.isValidElement(l) && typeof l.type != "string") {
|
|
168
|
+
const s = l.type;
|
|
169
|
+
w = s.displayName || s.name;
|
|
158
170
|
}
|
|
159
171
|
}
|
|
160
172
|
}
|
|
161
173
|
o.push(
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
|
|
174
|
+
/* @__PURE__ */ S(
|
|
175
|
+
re,
|
|
164
176
|
{
|
|
165
|
-
from:
|
|
166
|
-
durationInFrames:
|
|
167
|
-
name:
|
|
168
|
-
layout:
|
|
169
|
-
style:
|
|
170
|
-
|
|
177
|
+
from: b,
|
|
178
|
+
durationInFrames: a,
|
|
179
|
+
name: w,
|
|
180
|
+
layout: d,
|
|
181
|
+
style: u,
|
|
182
|
+
trackIndex: m,
|
|
183
|
+
children: h
|
|
171
184
|
},
|
|
172
185
|
r.key ?? o.length
|
|
173
186
|
)
|
|
174
|
-
), t =
|
|
187
|
+
), t = b + a;
|
|
175
188
|
}
|
|
176
|
-
return /* @__PURE__ */
|
|
189
|
+
return /* @__PURE__ */ S(le, { children: o });
|
|
177
190
|
}
|
|
178
|
-
|
|
179
|
-
const Pe = Object.assign(
|
|
180
|
-
Sequence:
|
|
191
|
+
oe.displayName = "Series";
|
|
192
|
+
const Pe = Object.assign(oe, {
|
|
193
|
+
Sequence: Z
|
|
181
194
|
});
|
|
182
195
|
function de({
|
|
183
196
|
durationInFrames: e,
|
|
@@ -186,31 +199,32 @@ function de({
|
|
|
186
199
|
style: o,
|
|
187
200
|
children: r
|
|
188
201
|
}) {
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
const
|
|
202
|
+
const a = y($), c = y(P), i = a.frame - c.accumulatedOffset;
|
|
203
|
+
if (i < 0 || n !== 1 / 0 && i >= e * n) return null;
|
|
204
|
+
const d = i % e, u = H(
|
|
192
205
|
() => ({
|
|
193
|
-
frame:
|
|
194
|
-
playing:
|
|
195
|
-
playingRef:
|
|
206
|
+
frame: d + c.accumulatedOffset,
|
|
207
|
+
playing: a.playing,
|
|
208
|
+
playingRef: a.playingRef
|
|
196
209
|
}),
|
|
197
|
-
[
|
|
210
|
+
[d, c.accumulatedOffset, a.playing, a.playingRef]
|
|
198
211
|
), m = H(
|
|
199
212
|
() => ({
|
|
200
213
|
id: null,
|
|
214
|
+
namePath: c.namePath,
|
|
201
215
|
from: c.accumulatedOffset,
|
|
202
216
|
durationInFrames: e,
|
|
203
217
|
parentOffset: c.accumulatedOffset,
|
|
204
218
|
accumulatedOffset: c.accumulatedOffset,
|
|
205
219
|
localOffset: 0
|
|
206
220
|
}),
|
|
207
|
-
[c.accumulatedOffset, e]
|
|
208
|
-
), h = /* @__PURE__ */
|
|
209
|
-
return t === "none" ? h : /* @__PURE__ */
|
|
221
|
+
[c.namePath, c.accumulatedOffset, e]
|
|
222
|
+
), h = /* @__PURE__ */ S($.Provider, { value: u, children: /* @__PURE__ */ S(P.Provider, { value: m, children: r }) });
|
|
223
|
+
return t === "none" ? h : /* @__PURE__ */ S(Y, { style: o, children: h });
|
|
210
224
|
}
|
|
211
225
|
de.displayName = "Loop";
|
|
212
226
|
function me({ frame: e, children: n }) {
|
|
213
|
-
const t =
|
|
227
|
+
const t = y($), o = H(
|
|
214
228
|
() => ({
|
|
215
229
|
frame: e,
|
|
216
230
|
playing: t.playing,
|
|
@@ -218,22 +232,22 @@ function me({ frame: e, children: n }) {
|
|
|
218
232
|
}),
|
|
219
233
|
[e, t.playing, t.playingRef]
|
|
220
234
|
);
|
|
221
|
-
return /* @__PURE__ */
|
|
235
|
+
return /* @__PURE__ */ S($.Provider, { value: o, children: n });
|
|
222
236
|
}
|
|
223
237
|
me.displayName = "Freeze";
|
|
224
238
|
let he = 0;
|
|
225
239
|
const L = /* @__PURE__ */ new Map();
|
|
226
|
-
function
|
|
240
|
+
function V(e, n) {
|
|
227
241
|
const t = ++he, o = e ?? `Handle ${t}`, { timeoutInMilliseconds: r } = n ?? {};
|
|
228
|
-
let
|
|
229
|
-
return r !== void 0 && r > 0 && (
|
|
242
|
+
let a = null;
|
|
243
|
+
return r !== void 0 && r > 0 && (a = setTimeout(() => {
|
|
230
244
|
if (L.has(t))
|
|
231
245
|
throw L.delete(t), new Error(
|
|
232
246
|
`holdRender() timed out after ${r}ms (label: "${o}"). You can increase the timeout by passing a larger timeoutInMilliseconds to holdRender().`
|
|
233
247
|
);
|
|
234
|
-
}, r)), L.set(t, { label: o, timeoutId:
|
|
248
|
+
}, r)), L.set(t, { label: o, timeoutId: a }), t;
|
|
235
249
|
}
|
|
236
|
-
function
|
|
250
|
+
function M(e) {
|
|
237
251
|
const n = L.get(e);
|
|
238
252
|
if (!n)
|
|
239
253
|
throw new Error(
|
|
@@ -241,13 +255,13 @@ function S(e) {
|
|
|
241
255
|
);
|
|
242
256
|
n.timeoutId !== null && clearTimeout(n.timeoutId), L.delete(e);
|
|
243
257
|
}
|
|
244
|
-
function
|
|
258
|
+
function ke(e) {
|
|
245
259
|
throw new Error(`Render cancelled: ${e}`);
|
|
246
260
|
}
|
|
247
|
-
function
|
|
261
|
+
function Te() {
|
|
248
262
|
return L.size;
|
|
249
263
|
}
|
|
250
|
-
function
|
|
264
|
+
function Le() {
|
|
251
265
|
return Array.from(L.values()).map((e) => e.label);
|
|
252
266
|
}
|
|
253
267
|
function ge({
|
|
@@ -256,32 +270,32 @@ function ge({
|
|
|
256
270
|
onError: t,
|
|
257
271
|
...o
|
|
258
272
|
}) {
|
|
259
|
-
const r =
|
|
260
|
-
|
|
261
|
-
const
|
|
273
|
+
const r = x(null);
|
|
274
|
+
N(() => {
|
|
275
|
+
const i = V(
|
|
262
276
|
`Loading <Img> with src="${o.src}"`,
|
|
263
277
|
{ timeoutInMilliseconds: e }
|
|
264
278
|
);
|
|
265
|
-
return r.current =
|
|
266
|
-
r.current !== null && (
|
|
279
|
+
return r.current = i, () => {
|
|
280
|
+
r.current !== null && (M(r.current), r.current = null);
|
|
267
281
|
};
|
|
268
282
|
}, [o.src, e]);
|
|
269
|
-
const
|
|
270
|
-
(
|
|
271
|
-
r.current !== null && (
|
|
283
|
+
const a = T(
|
|
284
|
+
(i) => {
|
|
285
|
+
r.current !== null && (M(r.current), r.current = null), n == null || n(i);
|
|
272
286
|
},
|
|
273
287
|
[n]
|
|
274
|
-
), c =
|
|
275
|
-
(
|
|
276
|
-
r.current !== null && (
|
|
288
|
+
), c = T(
|
|
289
|
+
(i) => {
|
|
290
|
+
r.current !== null && (M(r.current), r.current = null), t == null || t(i);
|
|
277
291
|
},
|
|
278
292
|
[t]
|
|
279
293
|
);
|
|
280
|
-
return /* @__PURE__ */
|
|
294
|
+
return /* @__PURE__ */ S(
|
|
281
295
|
"img",
|
|
282
296
|
{
|
|
283
297
|
...o,
|
|
284
|
-
onLoad:
|
|
298
|
+
onLoad: a,
|
|
285
299
|
onError: c
|
|
286
300
|
}
|
|
287
301
|
);
|
|
@@ -290,62 +304,62 @@ ge.displayName = "Img";
|
|
|
290
304
|
const z = O({
|
|
291
305
|
environment: "studio"
|
|
292
306
|
});
|
|
293
|
-
function
|
|
307
|
+
function ie({
|
|
294
308
|
src: e,
|
|
295
309
|
startFrom: n = 0,
|
|
296
310
|
endAt: t,
|
|
297
311
|
volume: o = 1,
|
|
298
312
|
playbackRate: r = 1,
|
|
299
|
-
muted:
|
|
313
|
+
muted: a = !1,
|
|
300
314
|
style: c,
|
|
301
|
-
className:
|
|
302
|
-
holdRenderTimeout:
|
|
303
|
-
...
|
|
315
|
+
className: i,
|
|
316
|
+
holdRenderTimeout: d = 3e4,
|
|
317
|
+
...u
|
|
304
318
|
}) {
|
|
305
|
-
const m =
|
|
306
|
-
|
|
307
|
-
const
|
|
319
|
+
const m = x(null), h = y($), b = y(P), w = y(q), { environment: f } = y(z), l = x(null), s = x(null), g = f === "rendering", I = (w == null ? void 0 : w.fps) ?? 30, _ = h.frame - b.accumulatedOffset, E = _ + n, C = E / I;
|
|
320
|
+
N(() => {
|
|
321
|
+
const p = V(
|
|
308
322
|
`Loading <Video> metadata for src="${e}"`,
|
|
309
|
-
{ timeoutInMilliseconds:
|
|
323
|
+
{ timeoutInMilliseconds: d }
|
|
310
324
|
);
|
|
311
|
-
return
|
|
312
|
-
|
|
325
|
+
return l.current = p, () => {
|
|
326
|
+
l.current !== null && (M(l.current), l.current = null);
|
|
313
327
|
};
|
|
314
|
-
}, [e,
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
}, []),
|
|
318
|
-
|
|
328
|
+
}, [e, d]);
|
|
329
|
+
const R = T(() => {
|
|
330
|
+
l.current !== null && (M(l.current), l.current = null);
|
|
331
|
+
}, []), k = T(() => {
|
|
332
|
+
l.current !== null && (M(l.current), l.current = null);
|
|
319
333
|
}, []);
|
|
320
|
-
return
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
}, [o,
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
}, [r]),
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
329
|
-
if (t !== void 0 &&
|
|
330
|
-
|
|
334
|
+
return N(() => {
|
|
335
|
+
const p = m.current;
|
|
336
|
+
p && (p.volume = o, p.muted = a);
|
|
337
|
+
}, [o, a]), N(() => {
|
|
338
|
+
const p = m.current;
|
|
339
|
+
p && (p.playbackRate = r);
|
|
340
|
+
}, [r]), N(() => {
|
|
341
|
+
const p = m.current;
|
|
342
|
+
if (p) {
|
|
343
|
+
if (t !== void 0 && E >= t) {
|
|
344
|
+
p.pause();
|
|
331
345
|
return;
|
|
332
346
|
}
|
|
333
|
-
if (
|
|
334
|
-
if (
|
|
335
|
-
|
|
336
|
-
const
|
|
337
|
-
`Seeking <Video> to ${
|
|
338
|
-
{ timeoutInMilliseconds:
|
|
339
|
-
),
|
|
340
|
-
|
|
347
|
+
if (g) {
|
|
348
|
+
if (p.pause(), s.current !== C) {
|
|
349
|
+
s.current = C;
|
|
350
|
+
const v = V(
|
|
351
|
+
`Seeking <Video> to ${C.toFixed(3)}s`,
|
|
352
|
+
{ timeoutInMilliseconds: d }
|
|
353
|
+
), F = () => {
|
|
354
|
+
M(v), p.removeEventListener("seeked", F);
|
|
341
355
|
};
|
|
342
|
-
|
|
356
|
+
p.addEventListener("seeked", F), p.currentTime = C;
|
|
343
357
|
}
|
|
344
358
|
} else
|
|
345
|
-
Math.abs(
|
|
346
|
-
}) : !h.playing && !
|
|
359
|
+
Math.abs(p.currentTime - C) > 0.1 && (p.currentTime = C), h.playing && p.paused ? p.play().catch(() => {
|
|
360
|
+
}) : !h.playing && !p.paused && p.pause();
|
|
347
361
|
}
|
|
348
|
-
}, [_,
|
|
362
|
+
}, [_, g, C, h.playing, t, E, d]), /* @__PURE__ */ S(
|
|
349
363
|
"video",
|
|
350
364
|
{
|
|
351
365
|
ref: m,
|
|
@@ -353,34 +367,34 @@ function oe({
|
|
|
353
367
|
preload: "auto",
|
|
354
368
|
playsInline: !0,
|
|
355
369
|
style: c,
|
|
356
|
-
className:
|
|
357
|
-
onLoadedMetadata:
|
|
358
|
-
onError:
|
|
359
|
-
...
|
|
370
|
+
className: i,
|
|
371
|
+
onLoadedMetadata: R,
|
|
372
|
+
onError: k,
|
|
373
|
+
...u
|
|
360
374
|
}
|
|
361
375
|
);
|
|
362
376
|
}
|
|
363
|
-
|
|
377
|
+
ie.displayName = "Video";
|
|
364
378
|
function pe({
|
|
365
379
|
src: e,
|
|
366
380
|
startFrom: n = 0,
|
|
367
381
|
endAt: t,
|
|
368
382
|
volume: o = 1,
|
|
369
383
|
playbackRate: r = 1,
|
|
370
|
-
muted:
|
|
384
|
+
muted: a = !1
|
|
371
385
|
}) {
|
|
372
|
-
const c =
|
|
373
|
-
return
|
|
386
|
+
const c = x(null), i = y($), d = y(P), u = y(q), { environment: m } = y(z), h = m === "rendering", b = (u == null ? void 0 : u.fps) ?? 30, w = i.frame - d.accumulatedOffset, f = w + n, l = f / b;
|
|
387
|
+
return N(() => {
|
|
374
388
|
if (h) return;
|
|
375
|
-
const
|
|
376
|
-
if (!
|
|
377
|
-
if (
|
|
378
|
-
|
|
389
|
+
const s = c.current;
|
|
390
|
+
if (!s) return;
|
|
391
|
+
if (s.volume = o, s.muted = a, s.playbackRate = r, t !== void 0 && f >= t) {
|
|
392
|
+
s.pause();
|
|
379
393
|
return;
|
|
380
394
|
}
|
|
381
|
-
Math.abs(
|
|
382
|
-
}) : !
|
|
383
|
-
}, [w, h,
|
|
395
|
+
Math.abs(s.currentTime - l) > 0.1 && (s.currentTime = l), i.playing && s.paused ? s.play().catch(() => {
|
|
396
|
+
}) : !i.playing && !s.paused && s.pause();
|
|
397
|
+
}, [w, h, l, i.playing, o, a, r, t, f]), h ? null : /* @__PURE__ */ S(
|
|
384
398
|
"audio",
|
|
385
399
|
{
|
|
386
400
|
ref: c,
|
|
@@ -396,67 +410,67 @@ function ye({
|
|
|
396
410
|
height: t,
|
|
397
411
|
style: o,
|
|
398
412
|
className: r,
|
|
399
|
-
holdRenderTimeout:
|
|
413
|
+
holdRenderTimeout: a = 3e4
|
|
400
414
|
}) {
|
|
401
|
-
const c =
|
|
402
|
-
return
|
|
403
|
-
const
|
|
415
|
+
const c = x(null), i = y($), d = y(P), u = y(q), m = x([]), h = x(null), [b, w] = ne(!1), f = (u == null ? void 0 : u.fps) ?? 30, l = i.frame - d.accumulatedOffset;
|
|
416
|
+
return N(() => {
|
|
417
|
+
const s = V(
|
|
404
418
|
`Loading <AnimatedImage> frames from "${e}"`,
|
|
405
|
-
{ timeoutInMilliseconds:
|
|
419
|
+
{ timeoutInMilliseconds: a }
|
|
406
420
|
);
|
|
407
|
-
h.current =
|
|
408
|
-
let
|
|
409
|
-
async function
|
|
421
|
+
h.current = s;
|
|
422
|
+
let g = !1;
|
|
423
|
+
async function I() {
|
|
410
424
|
try {
|
|
411
|
-
const
|
|
425
|
+
const E = await (await fetch(e)).blob();
|
|
412
426
|
if (typeof ImageDecoder < "u") {
|
|
413
|
-
const
|
|
414
|
-
data: await
|
|
415
|
-
type:
|
|
427
|
+
const C = new ImageDecoder({
|
|
428
|
+
data: await E.arrayBuffer(),
|
|
429
|
+
type: E.type
|
|
416
430
|
});
|
|
417
|
-
await
|
|
418
|
-
const
|
|
419
|
-
if (!
|
|
420
|
-
const
|
|
421
|
-
for (let
|
|
422
|
-
const
|
|
423
|
-
|
|
431
|
+
await C.tracks.ready;
|
|
432
|
+
const R = C.tracks.selectedTrack;
|
|
433
|
+
if (!R) throw new Error("No image track found");
|
|
434
|
+
const k = R.frameCount, p = [];
|
|
435
|
+
for (let v = 0; v < k; v++) {
|
|
436
|
+
const F = await C.decode({ frameIndex: v }), A = await createImageBitmap(F.image), ae = (F.image.duration ?? 1e5) / 1e3;
|
|
437
|
+
p.push({ image: A, duration: ae }), F.image.close();
|
|
424
438
|
}
|
|
425
|
-
|
|
439
|
+
C.close(), g || (m.current = p, w(!0));
|
|
426
440
|
} else {
|
|
427
|
-
const
|
|
428
|
-
|
|
441
|
+
const C = await createImageBitmap(E);
|
|
442
|
+
g || (m.current = [{ image: C, duration: 1 / 0 }], w(!0));
|
|
429
443
|
}
|
|
430
444
|
} catch (_) {
|
|
431
445
|
console.error("AnimatedImage: failed to decode frames", _);
|
|
432
446
|
} finally {
|
|
433
|
-
h.current !== null && (
|
|
447
|
+
h.current !== null && (M(h.current), h.current = null);
|
|
434
448
|
}
|
|
435
449
|
}
|
|
436
|
-
return
|
|
437
|
-
|
|
450
|
+
return I(), () => {
|
|
451
|
+
g = !0, h.current !== null && (M(h.current), h.current = null);
|
|
438
452
|
};
|
|
439
|
-
}, [e,
|
|
453
|
+
}, [e, a]), N(() => {
|
|
440
454
|
if (!b || m.current.length === 0) return;
|
|
441
|
-
const
|
|
442
|
-
if (!
|
|
443
|
-
const
|
|
444
|
-
if (!
|
|
445
|
-
const
|
|
446
|
-
let
|
|
447
|
-
for (const
|
|
448
|
-
|
|
449
|
-
if (
|
|
450
|
-
const
|
|
451
|
-
let
|
|
452
|
-
for (let
|
|
453
|
-
if (
|
|
454
|
-
|
|
455
|
+
const s = c.current;
|
|
456
|
+
if (!s) return;
|
|
457
|
+
const g = s.getContext("2d");
|
|
458
|
+
if (!g) return;
|
|
459
|
+
const I = m.current, _ = l / f * 1e3;
|
|
460
|
+
let E = 0;
|
|
461
|
+
for (const v of I)
|
|
462
|
+
E += v.duration;
|
|
463
|
+
if (E <= 0) return;
|
|
464
|
+
const C = (_ % E + E) % E;
|
|
465
|
+
let R = 0, k = 0;
|
|
466
|
+
for (let v = 0; v < I.length; v++)
|
|
467
|
+
if (R += I[v].duration, C < R) {
|
|
468
|
+
k = v;
|
|
455
469
|
break;
|
|
456
470
|
}
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
}, [
|
|
471
|
+
const p = I[k];
|
|
472
|
+
p && (s.width = n ?? p.image.width, s.height = t ?? p.image.height, g.clearRect(0, 0, s.width, s.height), g.drawImage(p.image, 0, 0, s.width, s.height));
|
|
473
|
+
}, [l, f, b, n, t]), /* @__PURE__ */ S(
|
|
460
474
|
"canvas",
|
|
461
475
|
{
|
|
462
476
|
ref: c,
|
|
@@ -474,141 +488,141 @@ function we({
|
|
|
474
488
|
onError: t,
|
|
475
489
|
...o
|
|
476
490
|
}) {
|
|
477
|
-
const r =
|
|
478
|
-
|
|
479
|
-
const
|
|
491
|
+
const r = x(null);
|
|
492
|
+
N(() => {
|
|
493
|
+
const i = V(
|
|
480
494
|
`Loading <IFrame> with src="${o.src}"`,
|
|
481
495
|
{ timeoutInMilliseconds: e }
|
|
482
496
|
);
|
|
483
|
-
return r.current =
|
|
484
|
-
r.current !== null && (
|
|
497
|
+
return r.current = i, () => {
|
|
498
|
+
r.current !== null && (M(r.current), r.current = null);
|
|
485
499
|
};
|
|
486
500
|
}, [o.src, e]);
|
|
487
|
-
const
|
|
488
|
-
(
|
|
489
|
-
r.current !== null && (
|
|
501
|
+
const a = T(
|
|
502
|
+
(i) => {
|
|
503
|
+
r.current !== null && (M(r.current), r.current = null), n == null || n(i);
|
|
490
504
|
},
|
|
491
505
|
[n]
|
|
492
|
-
), c =
|
|
493
|
-
(
|
|
494
|
-
r.current !== null && (
|
|
506
|
+
), c = T(
|
|
507
|
+
(i) => {
|
|
508
|
+
r.current !== null && (M(r.current), r.current = null), t == null || t(i);
|
|
495
509
|
},
|
|
496
510
|
[t]
|
|
497
511
|
);
|
|
498
|
-
return /* @__PURE__ */
|
|
512
|
+
return /* @__PURE__ */ S(
|
|
499
513
|
"iframe",
|
|
500
514
|
{
|
|
501
515
|
...o,
|
|
502
|
-
onLoad:
|
|
516
|
+
onLoad: a,
|
|
503
517
|
onError: c
|
|
504
518
|
}
|
|
505
519
|
);
|
|
506
520
|
}
|
|
507
521
|
we.displayName = "IFrame";
|
|
508
|
-
function
|
|
522
|
+
function Ie({
|
|
509
523
|
src: e,
|
|
510
524
|
startFrom: n = 0,
|
|
511
525
|
endAt: t,
|
|
512
526
|
volume: o = 1,
|
|
513
527
|
playbackRate: r = 1,
|
|
514
|
-
muted:
|
|
528
|
+
muted: a = !1,
|
|
515
529
|
style: c,
|
|
516
|
-
className:
|
|
517
|
-
holdRenderTimeout:
|
|
530
|
+
className: i,
|
|
531
|
+
holdRenderTimeout: d = 3e4
|
|
518
532
|
}) {
|
|
519
|
-
const
|
|
520
|
-
return w ? /* @__PURE__ */
|
|
521
|
-
|
|
533
|
+
const u = y($), m = y(P), h = y(q), { environment: b } = y(z), w = b === "rendering", f = (h == null ? void 0 : h.fps) ?? 30, s = u.frame - m.accumulatedOffset + n, g = s / f;
|
|
534
|
+
return w ? /* @__PURE__ */ S(
|
|
535
|
+
be,
|
|
522
536
|
{
|
|
523
537
|
src: e,
|
|
524
|
-
currentTime:
|
|
525
|
-
videoFrame:
|
|
538
|
+
currentTime: g,
|
|
539
|
+
videoFrame: s,
|
|
526
540
|
endAt: t,
|
|
527
541
|
style: c,
|
|
528
|
-
className:
|
|
529
|
-
holdRenderTimeout:
|
|
542
|
+
className: i,
|
|
543
|
+
holdRenderTimeout: d
|
|
530
544
|
}
|
|
531
|
-
) : /* @__PURE__ */
|
|
532
|
-
|
|
545
|
+
) : /* @__PURE__ */ S(
|
|
546
|
+
ie,
|
|
533
547
|
{
|
|
534
548
|
src: e,
|
|
535
549
|
startFrom: n,
|
|
536
550
|
endAt: t,
|
|
537
551
|
volume: o,
|
|
538
552
|
playbackRate: r,
|
|
539
|
-
muted:
|
|
553
|
+
muted: a,
|
|
540
554
|
style: c,
|
|
541
|
-
className:
|
|
542
|
-
holdRenderTimeout:
|
|
555
|
+
className: i,
|
|
556
|
+
holdRenderTimeout: d
|
|
543
557
|
}
|
|
544
558
|
);
|
|
545
559
|
}
|
|
546
|
-
|
|
547
|
-
function
|
|
560
|
+
Ie.displayName = "OffthreadVideo";
|
|
561
|
+
function be({
|
|
548
562
|
src: e,
|
|
549
563
|
currentTime: n,
|
|
550
564
|
videoFrame: t,
|
|
551
565
|
endAt: o,
|
|
552
566
|
style: r,
|
|
553
|
-
className:
|
|
567
|
+
className: a,
|
|
554
568
|
holdRenderTimeout: c
|
|
555
569
|
}) {
|
|
556
|
-
const [
|
|
570
|
+
const [i, d] = ne(null), u = x(null), m = x(null);
|
|
557
571
|
if (o !== void 0 && t >= o)
|
|
558
572
|
return null;
|
|
559
|
-
|
|
560
|
-
const w =
|
|
573
|
+
N(() => {
|
|
574
|
+
const w = V(
|
|
561
575
|
`Extracting <OffthreadVideo> frame at ${n.toFixed(3)}s from "${e}"`,
|
|
562
576
|
{ timeoutInMilliseconds: c }
|
|
563
577
|
);
|
|
564
|
-
|
|
578
|
+
u.current = w;
|
|
565
579
|
const f = new URLSearchParams({
|
|
566
580
|
src: e,
|
|
567
581
|
time: String(n)
|
|
568
|
-
}),
|
|
569
|
-
let
|
|
570
|
-
return fetch(
|
|
571
|
-
if (!
|
|
572
|
-
throw new Error(`OffthreadVideo: Failed to extract frame (HTTP ${
|
|
573
|
-
return
|
|
574
|
-
}).then((
|
|
575
|
-
if (
|
|
582
|
+
}), l = `${window.location.origin}/__offthread_video__?${f.toString()}`;
|
|
583
|
+
let s = !1;
|
|
584
|
+
return fetch(l).then((g) => {
|
|
585
|
+
if (!g.ok)
|
|
586
|
+
throw new Error(`OffthreadVideo: Failed to extract frame (HTTP ${g.status})`);
|
|
587
|
+
return g.blob();
|
|
588
|
+
}).then((g) => {
|
|
589
|
+
if (s) return;
|
|
576
590
|
m.current && URL.revokeObjectURL(m.current);
|
|
577
|
-
const
|
|
578
|
-
m.current =
|
|
579
|
-
}).catch((
|
|
580
|
-
console.error("OffthreadVideo frame extraction error:",
|
|
591
|
+
const I = URL.createObjectURL(g);
|
|
592
|
+
m.current = I, d(I);
|
|
593
|
+
}).catch((g) => {
|
|
594
|
+
console.error("OffthreadVideo frame extraction error:", g), u.current !== null && (M(u.current), u.current = null);
|
|
581
595
|
}), () => {
|
|
582
|
-
|
|
596
|
+
s = !0, u.current !== null && (M(u.current), u.current = null);
|
|
583
597
|
};
|
|
584
|
-
}, [n, e, c]),
|
|
598
|
+
}, [n, e, c]), N(() => () => {
|
|
585
599
|
m.current && (URL.revokeObjectURL(m.current), m.current = null);
|
|
586
600
|
}, []);
|
|
587
|
-
const h =
|
|
588
|
-
|
|
589
|
-
}, []), b =
|
|
590
|
-
|
|
601
|
+
const h = T(() => {
|
|
602
|
+
u.current !== null && (M(u.current), u.current = null);
|
|
603
|
+
}, []), b = T(() => {
|
|
604
|
+
u.current !== null && (M(u.current), u.current = null);
|
|
591
605
|
}, []);
|
|
592
|
-
return
|
|
606
|
+
return i ? /* @__PURE__ */ S(
|
|
593
607
|
"img",
|
|
594
608
|
{
|
|
595
|
-
src:
|
|
609
|
+
src: i,
|
|
596
610
|
style: r,
|
|
597
|
-
className:
|
|
611
|
+
className: a,
|
|
598
612
|
onLoad: h,
|
|
599
613
|
onError: b,
|
|
600
614
|
alt: ""
|
|
601
615
|
}
|
|
602
616
|
) : null;
|
|
603
617
|
}
|
|
604
|
-
function
|
|
618
|
+
function ve(e, n) {
|
|
605
619
|
for (let t = 1; t < n.length; t++)
|
|
606
620
|
if (e <= n[t]) return t - 1;
|
|
607
621
|
return n.length - 2;
|
|
608
622
|
}
|
|
609
|
-
function
|
|
623
|
+
function B(e, n, t, o, r, a) {
|
|
610
624
|
let c;
|
|
611
|
-
return n === t ? c = 0 : c = (e - n) / (t - n),
|
|
625
|
+
return n === t ? c = 0 : c = (e - n) / (t - n), a && (c = a(c)), o + c * (r - o);
|
|
612
626
|
}
|
|
613
627
|
function U(e, n, t, o) {
|
|
614
628
|
if (n.length !== t.length)
|
|
@@ -617,16 +631,16 @@ function U(e, n, t, o) {
|
|
|
617
631
|
);
|
|
618
632
|
if (n.length < 2)
|
|
619
633
|
throw new Error("inputRange and outputRange must have at least 2 elements.");
|
|
620
|
-
for (let
|
|
621
|
-
if (n[
|
|
634
|
+
for (let d = 1; d < n.length; d++)
|
|
635
|
+
if (n[d] < n[d - 1])
|
|
622
636
|
throw new Error("inputRange must be monotonically non-decreasing.");
|
|
623
637
|
const {
|
|
624
638
|
easing: r,
|
|
625
|
-
extrapolateLeft:
|
|
639
|
+
extrapolateLeft: a = "extend",
|
|
626
640
|
extrapolateRight: c = "extend"
|
|
627
641
|
} = o ?? {};
|
|
628
642
|
if (e < n[0])
|
|
629
|
-
return
|
|
643
|
+
return a === "clamp" ? t[0] : a === "identity" ? e : B(
|
|
630
644
|
e,
|
|
631
645
|
n[0],
|
|
632
646
|
n[1],
|
|
@@ -639,119 +653,119 @@ function U(e, n, t, o) {
|
|
|
639
653
|
return t[t.length - 1];
|
|
640
654
|
if (c === "identity")
|
|
641
655
|
return e;
|
|
642
|
-
const
|
|
643
|
-
return
|
|
656
|
+
const d = n.length - 1;
|
|
657
|
+
return B(
|
|
644
658
|
e,
|
|
645
|
-
n[
|
|
646
|
-
n[
|
|
647
|
-
t[
|
|
648
|
-
t[
|
|
659
|
+
n[d - 1],
|
|
660
|
+
n[d],
|
|
661
|
+
t[d - 1],
|
|
662
|
+
t[d],
|
|
649
663
|
r
|
|
650
664
|
);
|
|
651
665
|
}
|
|
652
|
-
const
|
|
653
|
-
return
|
|
666
|
+
const i = ve(e, n);
|
|
667
|
+
return B(
|
|
654
668
|
e,
|
|
655
|
-
n[
|
|
656
|
-
n[
|
|
657
|
-
t[
|
|
658
|
-
t[
|
|
669
|
+
n[i],
|
|
670
|
+
n[i + 1],
|
|
671
|
+
t[i],
|
|
672
|
+
t[i + 1],
|
|
659
673
|
r
|
|
660
674
|
);
|
|
661
675
|
}
|
|
662
|
-
function
|
|
663
|
-
const
|
|
676
|
+
function Ee(e, n, t, o, r, a, c) {
|
|
677
|
+
const i = -o * (e - t), d = -r * n, u = (i + d) / a, m = n + u * c;
|
|
664
678
|
return { position: e + m * c, velocity: m };
|
|
665
679
|
}
|
|
666
|
-
function
|
|
680
|
+
function Ce(e) {
|
|
667
681
|
const {
|
|
668
682
|
frame: n,
|
|
669
683
|
fps: t,
|
|
670
684
|
config: o = {},
|
|
671
685
|
from: r = 0,
|
|
672
|
-
to:
|
|
686
|
+
to: a = 1,
|
|
673
687
|
durationInFrames: c,
|
|
674
|
-
durationRestThreshold:
|
|
688
|
+
durationRestThreshold: i = 5e-3
|
|
675
689
|
} = e, {
|
|
676
|
-
damping:
|
|
677
|
-
mass:
|
|
690
|
+
damping: d = 10,
|
|
691
|
+
mass: u = 1,
|
|
678
692
|
stiffness: m = 100,
|
|
679
693
|
clampOvershoot: h = !1
|
|
680
694
|
} = o;
|
|
681
695
|
if (n < 0) return r;
|
|
682
696
|
if (c !== void 0 && n >= c)
|
|
683
|
-
return
|
|
697
|
+
return a;
|
|
684
698
|
const b = 1 / t, w = 4, f = b / w;
|
|
685
|
-
let
|
|
686
|
-
for (let
|
|
687
|
-
for (let
|
|
688
|
-
const _ =
|
|
689
|
-
|
|
699
|
+
let l = r, s = 0;
|
|
700
|
+
for (let g = 0; g < n; g++) {
|
|
701
|
+
for (let I = 0; I < w; I++) {
|
|
702
|
+
const _ = Ee(l, s, a, m, d, u, f);
|
|
703
|
+
l = _.position, s = _.velocity;
|
|
690
704
|
}
|
|
691
|
-
if (h && (r <
|
|
692
|
-
return
|
|
705
|
+
if (h && (r < a ? l = Math.min(l, a) : l = Math.max(l, a), l === a && (s = 0)), Math.abs(l - a) < i && Math.abs(s) < i)
|
|
706
|
+
return a;
|
|
693
707
|
}
|
|
694
|
-
return
|
|
708
|
+
return l;
|
|
695
709
|
}
|
|
696
|
-
function
|
|
710
|
+
function Oe(e) {
|
|
697
711
|
const {
|
|
698
712
|
fps: n,
|
|
699
713
|
config: t,
|
|
700
714
|
from: o = 0,
|
|
701
715
|
to: r = 1,
|
|
702
|
-
threshold:
|
|
716
|
+
threshold: a = 5e-3
|
|
703
717
|
} = e, c = n * 60;
|
|
704
|
-
for (let
|
|
705
|
-
const
|
|
706
|
-
frame:
|
|
718
|
+
for (let i = 0; i < c; i++) {
|
|
719
|
+
const d = Ce({
|
|
720
|
+
frame: i,
|
|
707
721
|
fps: n,
|
|
708
722
|
config: t,
|
|
709
723
|
from: o,
|
|
710
724
|
to: r,
|
|
711
|
-
durationRestThreshold:
|
|
725
|
+
durationRestThreshold: a
|
|
712
726
|
});
|
|
713
|
-
if (Math.abs(
|
|
714
|
-
return
|
|
727
|
+
if (Math.abs(d - r) < a)
|
|
728
|
+
return i;
|
|
715
729
|
}
|
|
716
730
|
return c;
|
|
717
731
|
}
|
|
718
|
-
function
|
|
719
|
-
const r = 3 * e,
|
|
732
|
+
function D(e, n, t, o) {
|
|
733
|
+
const r = 3 * e, a = 3 * (t - e) - r, c = 1 - r - a, i = 3 * n, d = 3 * (o - n) - i, u = 1 - i - d;
|
|
720
734
|
function m(f) {
|
|
721
|
-
return ((c * f +
|
|
735
|
+
return ((c * f + a) * f + r) * f;
|
|
722
736
|
}
|
|
723
737
|
function h(f) {
|
|
724
|
-
return ((
|
|
738
|
+
return ((u * f + d) * f + i) * f;
|
|
725
739
|
}
|
|
726
740
|
function b(f) {
|
|
727
|
-
return (3 * c * f + 2 *
|
|
741
|
+
return (3 * c * f + 2 * a) * f + r;
|
|
728
742
|
}
|
|
729
743
|
function w(f) {
|
|
730
|
-
let
|
|
731
|
-
for (let
|
|
732
|
-
const _ = m(
|
|
733
|
-
if (Math.abs(_) < 1e-7) return
|
|
734
|
-
const
|
|
735
|
-
if (Math.abs(
|
|
736
|
-
|
|
744
|
+
let l = f;
|
|
745
|
+
for (let I = 0; I < 8; I++) {
|
|
746
|
+
const _ = m(l) - f;
|
|
747
|
+
if (Math.abs(_) < 1e-7) return l;
|
|
748
|
+
const E = b(l);
|
|
749
|
+
if (Math.abs(E) < 1e-7) break;
|
|
750
|
+
l -= _ / E;
|
|
737
751
|
}
|
|
738
|
-
let
|
|
739
|
-
for (
|
|
740
|
-
const
|
|
741
|
-
if (Math.abs(
|
|
742
|
-
f >
|
|
752
|
+
let s = 0, g = 1;
|
|
753
|
+
for (l = f; s < g; ) {
|
|
754
|
+
const I = m(l);
|
|
755
|
+
if (Math.abs(I - f) < 1e-7) return l;
|
|
756
|
+
f > I ? s = l : g = l, l = (s + g) / 2;
|
|
743
757
|
}
|
|
744
|
-
return
|
|
758
|
+
return l;
|
|
745
759
|
}
|
|
746
760
|
return (f) => f <= 0 ? 0 : f >= 1 ? 1 : h(w(f));
|
|
747
761
|
}
|
|
748
|
-
const
|
|
762
|
+
const Ve = {
|
|
749
763
|
linear: ((e) => e),
|
|
750
|
-
ease:
|
|
751
|
-
easeIn:
|
|
752
|
-
easeOut:
|
|
753
|
-
easeInOut:
|
|
754
|
-
bezier:
|
|
764
|
+
ease: D(0.25, 0.1, 0.25, 1),
|
|
765
|
+
easeIn: D(0.42, 0, 1, 1),
|
|
766
|
+
easeOut: D(0, 0, 0.58, 1),
|
|
767
|
+
easeInOut: D(0.42, 0, 0.58, 1),
|
|
768
|
+
bezier: D,
|
|
755
769
|
bounce: ((e) => e < 1 / 2.75 ? 7.5625 * e * e : e < 2 / 2.75 ? 7.5625 * (e -= 1.5 / 2.75) * e + 0.75 : e < 2.5 / 2.75 ? 7.5625 * (e -= 2.25 / 2.75) * e + 0.9375 : 7.5625 * (e -= 2.625 / 2.75) * e + 0.984375),
|
|
756
770
|
elastic: (e = 1) => {
|
|
757
771
|
const n = 0.3 / Math.max(e, 1e-3);
|
|
@@ -785,7 +799,7 @@ function Q(e) {
|
|
|
785
799
|
];
|
|
786
800
|
throw new Error(`Cannot parse color: ${e}`);
|
|
787
801
|
}
|
|
788
|
-
const
|
|
802
|
+
const ee = {
|
|
789
803
|
black: "#000000",
|
|
790
804
|
white: "#ffffff",
|
|
791
805
|
red: "#ff0000",
|
|
@@ -803,8 +817,8 @@ const Z = {
|
|
|
803
817
|
};
|
|
804
818
|
function Se(e) {
|
|
805
819
|
const n = e.trim().toLowerCase();
|
|
806
|
-
if (
|
|
807
|
-
const t =
|
|
820
|
+
if (ee[n]) {
|
|
821
|
+
const t = ee[n];
|
|
808
822
|
return t.startsWith("#") ? K(t) : Q(t);
|
|
809
823
|
}
|
|
810
824
|
if (n.startsWith("#"))
|
|
@@ -813,49 +827,49 @@ function Se(e) {
|
|
|
813
827
|
return Q(n);
|
|
814
828
|
throw new Error(`Unsupported color format: ${e}`);
|
|
815
829
|
}
|
|
816
|
-
function
|
|
830
|
+
function _e(e) {
|
|
817
831
|
const [n, t, o, r] = e;
|
|
818
832
|
return r === 1 ? `rgb(${Math.round(n)}, ${Math.round(t)}, ${Math.round(o)})` : `rgba(${Math.round(n)}, ${Math.round(t)}, ${Math.round(o)}, ${Number(r.toFixed(3))})`;
|
|
819
833
|
}
|
|
820
834
|
function qe(e, n, t, o) {
|
|
821
835
|
if (n.length !== t.length)
|
|
822
836
|
throw new Error("inputRange and outputRange must have the same length.");
|
|
823
|
-
const r = t.map(Se),
|
|
837
|
+
const r = t.map(Se), a = U(
|
|
824
838
|
e,
|
|
825
839
|
n,
|
|
826
|
-
r.map((
|
|
840
|
+
r.map((u) => u[0]),
|
|
827
841
|
o
|
|
828
842
|
), c = U(
|
|
829
843
|
e,
|
|
830
844
|
n,
|
|
831
|
-
r.map((
|
|
845
|
+
r.map((u) => u[1]),
|
|
832
846
|
o
|
|
833
|
-
),
|
|
847
|
+
), i = U(
|
|
834
848
|
e,
|
|
835
849
|
n,
|
|
836
|
-
r.map((
|
|
850
|
+
r.map((u) => u[2]),
|
|
837
851
|
o
|
|
838
|
-
),
|
|
852
|
+
), d = U(
|
|
839
853
|
e,
|
|
840
854
|
n,
|
|
841
|
-
r.map((
|
|
855
|
+
r.map((u) => u[3]),
|
|
842
856
|
o
|
|
843
857
|
);
|
|
844
|
-
return
|
|
845
|
-
Math.max(0, Math.min(255,
|
|
858
|
+
return _e([
|
|
859
|
+
Math.max(0, Math.min(255, a)),
|
|
846
860
|
Math.max(0, Math.min(255, c)),
|
|
847
|
-
Math.max(0, Math.min(255,
|
|
848
|
-
Math.max(0, Math.min(1,
|
|
861
|
+
Math.max(0, Math.min(255, i)),
|
|
862
|
+
Math.max(0, Math.min(1, d))
|
|
849
863
|
]);
|
|
850
864
|
}
|
|
851
|
-
let
|
|
865
|
+
let W = null;
|
|
852
866
|
function De(e) {
|
|
853
|
-
if (
|
|
867
|
+
if (W !== null)
|
|
854
868
|
throw new Error("setRootComponent() can only be called once.");
|
|
855
|
-
|
|
869
|
+
W = e;
|
|
856
870
|
}
|
|
857
871
|
function Ue() {
|
|
858
|
-
return
|
|
872
|
+
return W;
|
|
859
873
|
}
|
|
860
874
|
function He(e) {
|
|
861
875
|
return `/${e.startsWith("/") ? e.slice(1) : e}`;
|
|
@@ -864,14 +878,14 @@ function je() {
|
|
|
864
878
|
return typeof window < "u" && window.__RENDIV_INPUT_PROPS__ ? window.__RENDIV_INPUT_PROPS__ : {};
|
|
865
879
|
}
|
|
866
880
|
function ze() {
|
|
867
|
-
const { environment: e } =
|
|
881
|
+
const { environment: e } = y(z);
|
|
868
882
|
return {
|
|
869
883
|
isStudio: e === "studio",
|
|
870
884
|
isRendering: e === "rendering",
|
|
871
885
|
isPlayer: e === "player"
|
|
872
886
|
};
|
|
873
887
|
}
|
|
874
|
-
function
|
|
888
|
+
function Ae() {
|
|
875
889
|
if (typeof window < "u") {
|
|
876
890
|
const e = window.__RENDIV_ENVIRONMENT__;
|
|
877
891
|
return {
|
|
@@ -882,45 +896,45 @@ function Xe() {
|
|
|
882
896
|
}
|
|
883
897
|
return { isStudio: !1, isRendering: !1, isPlayer: !1 };
|
|
884
898
|
}
|
|
885
|
-
const
|
|
899
|
+
const Xe = O(null);
|
|
886
900
|
export {
|
|
887
901
|
ye as AnimatedImage,
|
|
888
902
|
pe as Audio,
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
903
|
+
Re as Composition,
|
|
904
|
+
q as CompositionContext,
|
|
905
|
+
te as CompositionManagerContext,
|
|
906
|
+
Ve as Easing,
|
|
907
|
+
Y as Fill,
|
|
894
908
|
fe as Folder,
|
|
895
909
|
j as FolderContext,
|
|
896
910
|
me as Freeze,
|
|
897
911
|
we as IFrame,
|
|
898
912
|
ge as Img,
|
|
899
913
|
de as Loop,
|
|
900
|
-
|
|
914
|
+
Ie as OffthreadVideo,
|
|
901
915
|
z as RendivEnvironmentContext,
|
|
902
|
-
|
|
903
|
-
|
|
916
|
+
re as Sequence,
|
|
917
|
+
P as SequenceContext,
|
|
904
918
|
Pe as Series,
|
|
905
919
|
$e as Still,
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
920
|
+
$ as TimelineContext,
|
|
921
|
+
Xe as TimelineRegistryContext,
|
|
922
|
+
ie as Video,
|
|
923
|
+
ke as abortRender,
|
|
910
924
|
qe as blendColors,
|
|
911
925
|
je as getInputProps,
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
926
|
+
Te as getPendingHoldCount,
|
|
927
|
+
Le as getPendingHoldLabels,
|
|
928
|
+
Ae as getRendivEnvironment,
|
|
915
929
|
Ue as getRootComponent,
|
|
916
|
-
|
|
917
|
-
|
|
930
|
+
Oe as getSpringDuration,
|
|
931
|
+
V as holdRender,
|
|
918
932
|
U as interpolate,
|
|
919
|
-
|
|
933
|
+
M as releaseRender,
|
|
920
934
|
De as setRootComponent,
|
|
921
|
-
|
|
935
|
+
Ce as spring,
|
|
922
936
|
He as staticFile,
|
|
923
|
-
|
|
924
|
-
|
|
937
|
+
xe as useCompositionConfig,
|
|
938
|
+
Ne as useFrame,
|
|
925
939
|
ze as useRendivEnvironment
|
|
926
940
|
};
|