@algorisys/tinyfly 0.64.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.
- package/LICENSE +21 -0
- package/README.md +672 -0
- package/bin/tinyfly.mjs +59 -0
- package/lib/addons/adapters.js +756 -0
- package/lib/addons/dom-adapter-ChrbtkLC.js +243 -0
- package/lib/addons/drivers.js +72 -0
- package/lib/addons/export.js +1169 -0
- package/lib/addons/gsap-compat.js +2576 -0
- package/lib/addons/interaction.js +225 -0
- package/lib/addons/smooth-scroll-DaSacemU.js +671 -0
- package/lib/addons/teach.js +215 -0
- package/lib/browser/tinyfly.iife.js +2 -0
- package/lib/browser/tinyfly.js +6372 -0
- package/lib/browser/tinyfly.umd.js +2 -0
- package/lib/cli/tools.js +2325 -0
- package/lib/embed/tinyfly-embed.iife.js +18 -0
- package/lib/embed/tinyfly-embed.js +2316 -0
- package/lib/engine/tinyfly-engine.js +1972 -0
- package/lib/engine/tinyfly-engine.umd.cjs +2 -0
- package/lib/frameworks/react.js +32 -0
- package/lib/frameworks/solid.js +27 -0
- package/lib/frameworks/svelte.js +15 -0
- package/lib/frameworks/vue.js +29 -0
- package/lib/player/tinyfly-player.es.js +2306 -0
- package/lib/player/tinyfly-player.iife.js +2 -0
- package/lib/player/tinyfly-player.umd.js +2 -0
- package/lib/types/adapters/canvas/canvas-adapter.d.ts +238 -0
- package/lib/types/adapters/canvas/index.d.ts +1 -0
- package/lib/types/adapters/dom/dom-adapter.d.ts +50 -0
- package/lib/types/adapters/dom/flip.d.ts +60 -0
- package/lib/types/adapters/dom/index.d.ts +2 -0
- package/lib/types/adapters/filter-utils.d.ts +32 -0
- package/lib/types/adapters/index.d.ts +5 -0
- package/lib/types/adapters/shine-utils.d.ts +26 -0
- package/lib/types/adapters/svg/index.d.ts +1 -0
- package/lib/types/adapters/svg/svg-adapter.d.ts +47 -0
- package/lib/types/adapters/svg-transform-box.d.ts +13 -0
- package/lib/types/adapters/text-content.d.ts +11 -0
- package/lib/types/adapters/webgl/index.d.ts +1 -0
- package/lib/types/adapters/webgl/webgl-adapter.d.ts +69 -0
- package/lib/types/browser/index.d.ts +41 -0
- package/lib/types/compat/gsap/custom-eases.d.ts +28 -0
- package/lib/types/compat/gsap/defaults.d.ts +19 -0
- package/lib/types/compat/gsap/draw-svg-vars.d.ts +36 -0
- package/lib/types/compat/gsap/ease-map.d.ts +51 -0
- package/lib/types/compat/gsap/image-sequence.d.ts +61 -0
- package/lib/types/compat/gsap/index.d.ts +65 -0
- package/lib/types/compat/gsap/inertia-vars.d.ts +39 -0
- package/lib/types/compat/gsap/keyframes-vars.d.ts +8 -0
- package/lib/types/compat/gsap/layout.d.ts +6 -0
- package/lib/types/compat/gsap/live-context.d.ts +87 -0
- package/lib/types/compat/gsap/live-draggable.d.ts +75 -0
- package/lib/types/compat/gsap/live-flip.d.ts +73 -0
- package/lib/types/compat/gsap/live-morph.d.ts +18 -0
- package/lib/types/compat/gsap/live-motion-path.d.ts +33 -0
- package/lib/types/compat/gsap/live-scroll-to.d.ts +52 -0
- package/lib/types/compat/gsap/live-scroll.d.ts +108 -0
- package/lib/types/compat/gsap/live-transition.d.ts +40 -0
- package/lib/types/compat/gsap/live.d.ts +341 -0
- package/lib/types/compat/gsap/morph-vars.d.ts +21 -0
- package/lib/types/compat/gsap/motion-path-vars.d.ts +38 -0
- package/lib/types/compat/gsap/playhead-crossings.d.ts +47 -0
- package/lib/types/compat/gsap/position.d.ts +37 -0
- package/lib/types/compat/gsap/quick-play.d.ts +38 -0
- package/lib/types/compat/gsap/split-text.d.ts +66 -0
- package/lib/types/compat/gsap/spring-vars.d.ts +34 -0
- package/lib/types/compat/gsap/stage.d.ts +182 -0
- package/lib/types/compat/gsap/stagger-grid.d.ts +30 -0
- package/lib/types/compat/gsap/text-vars.d.ts +39 -0
- package/lib/types/compat/gsap/timeline.d.ts +161 -0
- package/lib/types/compat/gsap/utils.d.ts +60 -0
- package/lib/types/compat/gsap/vars.d.ts +79 -0
- package/lib/types/drivers/index.d.ts +8 -0
- package/lib/types/drivers/scroll-driver.d.ts +218 -0
- package/lib/types/drivers/scroll-markers.d.ts +41 -0
- package/lib/types/drivers/scroll-math.d.ts +87 -0
- package/lib/types/drivers/scroll-pin.d.ts +45 -0
- package/lib/types/drivers/scroll-snap.d.ts +47 -0
- package/lib/types/drivers/smooth-scroll.d.ts +118 -0
- package/lib/types/drivers/types.d.ts +23 -0
- package/lib/types/drivers/visibility-driver.d.ts +56 -0
- package/lib/types/embed/controls.d.ts +46 -0
- package/lib/types/embed/index.d.ts +17 -0
- package/lib/types/embed/mount.d.ts +41 -0
- package/lib/types/embed/tools.d.ts +33 -0
- package/lib/types/engine/authoring/custom-ease.d.ts +49 -0
- package/lib/types/engine/authoring/index.d.ts +3 -0
- package/lib/types/engine/authoring/random.d.ts +38 -0
- package/lib/types/engine/authoring/resolve-values.d.ts +57 -0
- package/lib/types/engine/core/bake.d.ts +66 -0
- package/lib/types/engine/core/clock.d.ts +44 -0
- package/lib/types/engine/core/index.d.ts +8 -0
- package/lib/types/engine/core/inertia.d.ts +30 -0
- package/lib/types/engine/core/playhead-crossings.d.ts +47 -0
- package/lib/types/engine/core/spring.d.ts +132 -0
- package/lib/types/engine/core/stagger.d.ts +40 -0
- package/lib/types/engine/core/timeline.d.ts +203 -0
- package/lib/types/engine/core/track.d.ts +90 -0
- package/lib/types/engine/export/byte-writer.d.ts +36 -0
- package/lib/types/engine/export/css.d.ts +31 -0
- package/lib/types/engine/export/gif-decode.test-helper.d.ts +24 -0
- package/lib/types/engine/export/gif.d.ts +134 -0
- package/lib/types/engine/export/index.d.ts +9 -0
- package/lib/types/engine/export/lottie.d.ts +104 -0
- package/lib/types/engine/export/mp4.d.ts +64 -0
- package/lib/types/engine/export/quantize.d.ts +56 -0
- package/lib/types/engine/export/sprite-sheet.d.ts +46 -0
- package/lib/types/engine/export/video.d.ts +99 -0
- package/lib/types/engine/export/webp.d.ts +82 -0
- package/lib/types/engine/index.d.ts +7 -0
- package/lib/types/engine/interpolation/easing.d.ts +65 -0
- package/lib/types/engine/interpolation/index.d.ts +2 -0
- package/lib/types/engine/interpolation/interpolators.d.ts +25 -0
- package/lib/types/engine/path/index.d.ts +11 -0
- package/lib/types/engine/path/motion-path.d.ts +24 -0
- package/lib/types/engine/path/path-builders.d.ts +38 -0
- package/lib/types/engine/path/path-morph.d.ts +47 -0
- package/lib/types/engine/path/path-utils.d.ts +73 -0
- package/lib/types/engine/serialization/index.d.ts +1 -0
- package/lib/types/engine/serialization/json.d.ts +30 -0
- package/lib/types/engine/text/index.d.ts +2 -0
- package/lib/types/engine/text/text-value.d.ts +16 -0
- package/lib/types/engine/types.d.ts +401 -0
- package/lib/types/frameworks/react.d.ts +35 -0
- package/lib/types/frameworks/solid.d.ts +16 -0
- package/lib/types/frameworks/svelte.d.ts +19 -0
- package/lib/types/frameworks/vue.d.ts +27 -0
- package/lib/types/interaction/draggable.d.ts +133 -0
- package/lib/types/interaction/index.d.ts +3 -0
- package/lib/types/interaction/observer.d.ts +80 -0
- package/lib/types/interaction/snap.d.ts +30 -0
- package/lib/types/player/index.d.ts +7 -0
- package/lib/types/player/media-sync.d.ts +60 -0
- package/lib/types/player/player.d.ts +238 -0
- package/lib/types/player/sequence-types.d.ts +68 -0
- package/lib/types/player/sequencer.d.ts +91 -0
- package/lib/types/teach/diagrams.d.ts +137 -0
- package/lib/types/teach/index.d.ts +11 -0
- package/lib/types/teach/lesson.d.ts +55 -0
- package/package.json +170 -0
|
@@ -0,0 +1,1972 @@
|
|
|
1
|
+
function de(t) {
|
|
2
|
+
return typeof t == "object" && t !== null && t.type === "cubic-bezier";
|
|
3
|
+
}
|
|
4
|
+
function _t(t) {
|
|
5
|
+
return typeof t == "object" && t !== null && t.type !== "cubic-bezier";
|
|
6
|
+
}
|
|
7
|
+
const rt = 1;
|
|
8
|
+
function xt(t) {
|
|
9
|
+
return t.property === "text" && "textConfig" in t;
|
|
10
|
+
}
|
|
11
|
+
function V(t) {
|
|
12
|
+
return t.kind === "inertia" && "inertia" in t;
|
|
13
|
+
}
|
|
14
|
+
function H(t) {
|
|
15
|
+
return t.kind === "spring" && "spring" in t;
|
|
16
|
+
}
|
|
17
|
+
function Ut(t) {
|
|
18
|
+
return t.property === "motionPath" && "motionPathConfig" in t;
|
|
19
|
+
}
|
|
20
|
+
function Dn(t) {
|
|
21
|
+
return typeof t == "object" && t !== null && "x" in t && "y" in t && "angle" in t;
|
|
22
|
+
}
|
|
23
|
+
function ge(t) {
|
|
24
|
+
return "keyframes" in t;
|
|
25
|
+
}
|
|
26
|
+
class En {
|
|
27
|
+
_currentTime = 0;
|
|
28
|
+
_isRunning = !1;
|
|
29
|
+
onTick = null;
|
|
30
|
+
get currentTime() {
|
|
31
|
+
return this._currentTime;
|
|
32
|
+
}
|
|
33
|
+
get isRunning() {
|
|
34
|
+
return this._isRunning;
|
|
35
|
+
}
|
|
36
|
+
start() {
|
|
37
|
+
this._isRunning = !0;
|
|
38
|
+
}
|
|
39
|
+
stop() {
|
|
40
|
+
this._isRunning = !1;
|
|
41
|
+
}
|
|
42
|
+
tick(e) {
|
|
43
|
+
this._currentTime += e, this.onTick?.(e, this._currentTime);
|
|
44
|
+
}
|
|
45
|
+
reset() {
|
|
46
|
+
this._currentTime = 0;
|
|
47
|
+
}
|
|
48
|
+
seek(e) {
|
|
49
|
+
this._currentTime = e;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
class Ln {
|
|
53
|
+
_currentTime = 0;
|
|
54
|
+
_isRunning = !1;
|
|
55
|
+
_lastFrameTime = null;
|
|
56
|
+
_rafId = null;
|
|
57
|
+
_speed;
|
|
58
|
+
onTick = null;
|
|
59
|
+
constructor(e = {}) {
|
|
60
|
+
this._speed = e.speed ?? 1;
|
|
61
|
+
}
|
|
62
|
+
get currentTime() {
|
|
63
|
+
return this._currentTime;
|
|
64
|
+
}
|
|
65
|
+
get isRunning() {
|
|
66
|
+
return this._isRunning;
|
|
67
|
+
}
|
|
68
|
+
get speed() {
|
|
69
|
+
return this._speed;
|
|
70
|
+
}
|
|
71
|
+
set speed(e) {
|
|
72
|
+
this._speed = e;
|
|
73
|
+
}
|
|
74
|
+
start() {
|
|
75
|
+
this._isRunning || (this._isRunning = !0, this._lastFrameTime = null, this._scheduleFrame());
|
|
76
|
+
}
|
|
77
|
+
stop() {
|
|
78
|
+
this._isRunning = !1, this._rafId !== null && (cancelAnimationFrame(this._rafId), this._rafId = null);
|
|
79
|
+
}
|
|
80
|
+
reset() {
|
|
81
|
+
this._currentTime = 0, this._lastFrameTime = null;
|
|
82
|
+
}
|
|
83
|
+
seek(e) {
|
|
84
|
+
this._currentTime = e;
|
|
85
|
+
}
|
|
86
|
+
_scheduleFrame() {
|
|
87
|
+
this._rafId = requestAnimationFrame(this._onFrame.bind(this));
|
|
88
|
+
}
|
|
89
|
+
_onFrame(e) {
|
|
90
|
+
if (this._isRunning) {
|
|
91
|
+
if (this._lastFrameTime !== null) {
|
|
92
|
+
const s = (e - this._lastFrameTime) * this._speed;
|
|
93
|
+
this._currentTime += s, this.onTick?.(s, this._currentTime);
|
|
94
|
+
}
|
|
95
|
+
this._lastFrameTime = e, this._scheduleFrame();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function zt(t, e, n = "start") {
|
|
100
|
+
if (e <= 1) return 0;
|
|
101
|
+
if (typeof n == "number") {
|
|
102
|
+
const s = Math.max(0, Math.min(e - 1, n));
|
|
103
|
+
return Math.abs(t - s);
|
|
104
|
+
}
|
|
105
|
+
switch (n) {
|
|
106
|
+
case "end":
|
|
107
|
+
return e - 1 - t;
|
|
108
|
+
case "center":
|
|
109
|
+
return Math.abs(t - (e - 1) / 2);
|
|
110
|
+
case "edges":
|
|
111
|
+
return (e - 1) / 2 - Math.abs(t - (e - 1) / 2);
|
|
112
|
+
default:
|
|
113
|
+
return t;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function me(t, e = "start") {
|
|
117
|
+
if (t <= 1) return 0;
|
|
118
|
+
let n = 0;
|
|
119
|
+
for (let s = 0; s < t; s++)
|
|
120
|
+
n = Math.max(n, zt(s, t, e));
|
|
121
|
+
return n;
|
|
122
|
+
}
|
|
123
|
+
function qt(t, e, n) {
|
|
124
|
+
if (n.offsets) return n.offsets[t] ?? 0;
|
|
125
|
+
const s = n.from ?? "start", r = zt(t, e, s);
|
|
126
|
+
if (n.amount !== void 0) {
|
|
127
|
+
const i = me(e, s);
|
|
128
|
+
return i === 0 ? 0 : n.amount * r / i;
|
|
129
|
+
}
|
|
130
|
+
return n.each !== void 0 ? n.each * r : 0;
|
|
131
|
+
}
|
|
132
|
+
function ye(t, e) {
|
|
133
|
+
return Array.from({ length: t }, (n, s) => qt(s, t, e));
|
|
134
|
+
}
|
|
135
|
+
function kt(t, e) {
|
|
136
|
+
return t <= 1 ? 0 : Math.max(...ye(t, e));
|
|
137
|
+
}
|
|
138
|
+
const B = 1, Wt = 6e4, et = Wt / B, $ = {
|
|
139
|
+
stiffness: 180,
|
|
140
|
+
damping: 12,
|
|
141
|
+
mass: 1,
|
|
142
|
+
velocity: 0,
|
|
143
|
+
restDelta: 0.01,
|
|
144
|
+
restSpeed: 0.1
|
|
145
|
+
}, Fn = {
|
|
146
|
+
gentle: { stiffness: 120, damping: 18, mass: 1 },
|
|
147
|
+
default: { stiffness: 180, damping: 12, mass: 1 },
|
|
148
|
+
snappy: { stiffness: 280, damping: 20, mass: 1 },
|
|
149
|
+
bouncy: { stiffness: 220, damping: 8, mass: 1 },
|
|
150
|
+
wobbly: { stiffness: 180, damping: 5, mass: 1 },
|
|
151
|
+
stiff: { stiffness: 400, damping: 30, mass: 1 }
|
|
152
|
+
};
|
|
153
|
+
class it {
|
|
154
|
+
from;
|
|
155
|
+
to;
|
|
156
|
+
stiffness;
|
|
157
|
+
damping;
|
|
158
|
+
mass;
|
|
159
|
+
restDelta;
|
|
160
|
+
restSpeed;
|
|
161
|
+
/** value[i] is the spring's position at time i * SPRING_STEP_MS */
|
|
162
|
+
/**
|
|
163
|
+
* Travel distance, used to scale the rest thresholds.
|
|
164
|
+
*
|
|
165
|
+
* Without this the thresholds are absolute, and a spring animating `scale`
|
|
166
|
+
* from 0 to 1 hits them ~100x sooner than one animating `x` from 0 to 100 —
|
|
167
|
+
* so the small one is declared "settled" at its first pass through the
|
|
168
|
+
* target and never shows the overshoot at all. Scaling by travel makes
|
|
169
|
+
* settling depend on the spring's parameters, not on the units of whatever
|
|
170
|
+
* property it happens to drive.
|
|
171
|
+
*/
|
|
172
|
+
distance;
|
|
173
|
+
samples;
|
|
174
|
+
velocity;
|
|
175
|
+
/** Once at rest we stop simulating; every later time returns `to`. */
|
|
176
|
+
settledStep = null;
|
|
177
|
+
constructor(e) {
|
|
178
|
+
this.from = e.from, this.to = e.to, this.stiffness = e.stiffness ?? $.stiffness, this.damping = e.damping ?? $.damping, this.mass = e.mass ?? $.mass, this.restDelta = e.restDelta ?? $.restDelta, this.restSpeed = e.restSpeed ?? $.restSpeed, this.distance = Math.abs(this.to - this.from) || 1, this.samples = [this.from], this.velocity = e.velocity ?? $.velocity, this.isAtRest(this.from) && (this.settledStep = 0);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Whether a position/velocity pair counts as settled.
|
|
182
|
+
*
|
|
183
|
+
* Both thresholds are fractions of the spring's travel distance:
|
|
184
|
+
* `restDelta` as a fraction of the distance, and `restSpeed` as a fraction
|
|
185
|
+
* of the distance per second. That keeps settling scale-invariant.
|
|
186
|
+
*/
|
|
187
|
+
isAtRest(e) {
|
|
188
|
+
return Math.abs(e - this.to) < this.restDelta * this.distance && Math.abs(this.velocity) < this.restSpeed * this.distance;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Position at `timeMs`. Times before 0 clamp to the start value; times past
|
|
192
|
+
* settling return the target exactly.
|
|
193
|
+
*/
|
|
194
|
+
valueAt(e) {
|
|
195
|
+
if (e <= 0) return this.from;
|
|
196
|
+
const n = Math.floor(e / B);
|
|
197
|
+
if (this.simulateTo(n + 1), this.settledStep !== null && n >= this.settledStep)
|
|
198
|
+
return this.to;
|
|
199
|
+
const s = this.samples[Math.min(n, this.samples.length - 1)], r = this.samples[Math.min(n + 1, this.samples.length - 1)], i = e / B - n;
|
|
200
|
+
return s + (r - s) * i;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* How long the spring takes to settle, in milliseconds — the natural duration
|
|
204
|
+
* of a spring track. Runs the simulation to completion once.
|
|
205
|
+
*/
|
|
206
|
+
settleTime() {
|
|
207
|
+
return this.simulateTo(et + 1), this.settledStep !== null ? this.settledStep * B : Wt;
|
|
208
|
+
}
|
|
209
|
+
/** Advance the cached simulation until it holds at least `steps` samples. */
|
|
210
|
+
simulateTo(e) {
|
|
211
|
+
if (this.settledStep !== null) return;
|
|
212
|
+
const n = Math.min(e, et + 1), s = B / 1e3;
|
|
213
|
+
for (; this.samples.length < n; ) {
|
|
214
|
+
const r = this.samples[this.samples.length - 1], i = r - this.to, a = -this.stiffness * i, o = -this.damping * this.velocity, c = (a + o) / this.mass;
|
|
215
|
+
this.velocity += c * s;
|
|
216
|
+
const u = r + this.velocity * s;
|
|
217
|
+
if (this.samples.push(u), this.isAtRest(u)) {
|
|
218
|
+
this.settledStep = this.samples.length - 1;
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
this.samples.length > et && (this.settledStep = et);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function On(t, e) {
|
|
226
|
+
return new it(t).valueAt(e);
|
|
227
|
+
}
|
|
228
|
+
function Nn(t) {
|
|
229
|
+
return new it(t).settleTime();
|
|
230
|
+
}
|
|
231
|
+
function Xn(t) {
|
|
232
|
+
const e = t.stiffness ?? $.stiffness, n = t.damping ?? $.damping, s = t.mass ?? $.mass;
|
|
233
|
+
return n < 2 * Math.sqrt(e * s);
|
|
234
|
+
}
|
|
235
|
+
function Yn(t) {
|
|
236
|
+
const e = t.stiffness ?? $.stiffness, n = t.mass ?? $.mass;
|
|
237
|
+
return 2 * Math.sqrt(e * n);
|
|
238
|
+
}
|
|
239
|
+
const wt = 4, _e = 2e-3, Me = 1e-4, Te = 6e4;
|
|
240
|
+
function at(t) {
|
|
241
|
+
const e = t.friction ?? wt;
|
|
242
|
+
return e > 0 ? e : wt;
|
|
243
|
+
}
|
|
244
|
+
function be(t) {
|
|
245
|
+
return t.from + t.velocity / at(t);
|
|
246
|
+
}
|
|
247
|
+
function xe(t, e) {
|
|
248
|
+
if (e === void 0) return t;
|
|
249
|
+
if (typeof e == "number")
|
|
250
|
+
return e > 0 ? Math.round(t / e) * e : t;
|
|
251
|
+
if (e.length === 0) return t;
|
|
252
|
+
let n = e[0];
|
|
253
|
+
for (const s of e)
|
|
254
|
+
Math.abs(s - t) < Math.abs(n - t) && (n = s);
|
|
255
|
+
return n;
|
|
256
|
+
}
|
|
257
|
+
function ot(t) {
|
|
258
|
+
let e = xe(be(t), t.end);
|
|
259
|
+
return t.min !== void 0 && (e = Math.max(t.min, e)), t.max !== void 0 && (e = Math.min(t.max, e)), e;
|
|
260
|
+
}
|
|
261
|
+
function ct(t) {
|
|
262
|
+
const e = Math.abs(ot(t) - t.from);
|
|
263
|
+
if (e === 0) return 0;
|
|
264
|
+
const n = t.restDelta ?? Math.max(Me, e * _e);
|
|
265
|
+
if (n >= e) return 0;
|
|
266
|
+
const s = Math.log(e / n) / at(t);
|
|
267
|
+
return Math.min(Te, s * 1e3);
|
|
268
|
+
}
|
|
269
|
+
function Mt(t, e) {
|
|
270
|
+
if (e <= 0) return t.from;
|
|
271
|
+
const n = ot(t);
|
|
272
|
+
if (e >= ct(t)) return n;
|
|
273
|
+
const s = at(t);
|
|
274
|
+
return t.from + (n - t.from) * (1 - Math.exp(-s * e / 1e3));
|
|
275
|
+
}
|
|
276
|
+
function Vn(t, e) {
|
|
277
|
+
const n = at(t), s = ot(t);
|
|
278
|
+
return e >= ct(t) ? 0 : (s - t.from) * n * Math.exp(-n * Math.max(0, e) / 1e3);
|
|
279
|
+
}
|
|
280
|
+
const Tt = (t) => t, ke = (t) => t * t, ve = (t) => 1 - (1 - t) * (1 - t), Se = (t) => t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2, Kt = (t) => t * t * t, Qt = (t) => 1 - Math.pow(1 - t, 3), jt = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, Ae = Kt, we = Qt, Pe = jt, Re = {
|
|
281
|
+
linear: Tt,
|
|
282
|
+
"ease-in": Ae,
|
|
283
|
+
"ease-out": we,
|
|
284
|
+
"ease-in-out": Pe,
|
|
285
|
+
"ease-in-quad": ke,
|
|
286
|
+
"ease-out-quad": ve,
|
|
287
|
+
"ease-in-out-quad": Se,
|
|
288
|
+
"ease-in-cubic": Kt,
|
|
289
|
+
"ease-out-cubic": Qt,
|
|
290
|
+
"ease-in-out-cubic": jt
|
|
291
|
+
};
|
|
292
|
+
function Ce(t) {
|
|
293
|
+
const [e, n, s, r] = t, i = 3 * e, a = 3 * (s - e) - i, o = 1 - i - a, c = 3 * n, u = 3 * (r - n) - c, l = 1 - c - u, h = (p) => ((o * p + a) * p + i) * p, d = (p) => ((l * p + u) * p + c) * p, f = (p) => (3 * o * p + 2 * a) * p + i, M = (p) => {
|
|
294
|
+
let g = p;
|
|
295
|
+
for (let T = 0; T < 8; T++) {
|
|
296
|
+
const x = h(g) - p;
|
|
297
|
+
if (Math.abs(x) < 1e-7)
|
|
298
|
+
return g;
|
|
299
|
+
const m = f(g);
|
|
300
|
+
if (Math.abs(m) < 1e-7)
|
|
301
|
+
break;
|
|
302
|
+
g -= x / m;
|
|
303
|
+
}
|
|
304
|
+
let y = 0, _ = 1;
|
|
305
|
+
for (g = p; y < _; ) {
|
|
306
|
+
const T = h(g);
|
|
307
|
+
if (Math.abs(T - p) < 1e-7)
|
|
308
|
+
return g;
|
|
309
|
+
p > T ? y = g : _ = g, g = (y + _) / 2;
|
|
310
|
+
}
|
|
311
|
+
return g;
|
|
312
|
+
};
|
|
313
|
+
return (p) => {
|
|
314
|
+
if (p <= 0) return 0;
|
|
315
|
+
if (p >= 1) return 1;
|
|
316
|
+
const g = M(p);
|
|
317
|
+
return d(g);
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function ht(t, e = "out") {
|
|
321
|
+
if (e === "out") return t;
|
|
322
|
+
const n = (s) => 1 - t(1 - s);
|
|
323
|
+
return e === "in" ? n : (s) => s < 0.5 ? n(s * 2) / 2 : t(s * 2 - 1) / 2 + 0.5;
|
|
324
|
+
}
|
|
325
|
+
function Ie(t = 1, e = 0.3) {
|
|
326
|
+
const n = Math.max(1, t), s = e / (2 * Math.PI) * Math.asin(1 / n);
|
|
327
|
+
return (r) => r <= 0 ? 0 : r >= 1 ? 1 : n * Math.pow(2, -10 * r) * Math.sin((r - s) * (2 * Math.PI) / e) + 1;
|
|
328
|
+
}
|
|
329
|
+
const $e = (t) => {
|
|
330
|
+
if (t <= 0) return 0;
|
|
331
|
+
if (t >= 1) return 1;
|
|
332
|
+
if (t < 1 / 2.75) return 7.5625 * t * t;
|
|
333
|
+
if (t < 2 / 2.75) {
|
|
334
|
+
const r = t - 0.5454545454545454;
|
|
335
|
+
return 7.5625 * r * r + 0.75;
|
|
336
|
+
}
|
|
337
|
+
if (t < 2.5 / 2.75) {
|
|
338
|
+
const r = t - 0.8181818181818182;
|
|
339
|
+
return 7.5625 * r * r + 0.9375;
|
|
340
|
+
}
|
|
341
|
+
const s = t - 2.625 / 2.75;
|
|
342
|
+
return 7.5625 * s * s + 0.984375;
|
|
343
|
+
};
|
|
344
|
+
function De(t = 1.70158) {
|
|
345
|
+
return (e) => {
|
|
346
|
+
if (e <= 0) return 0;
|
|
347
|
+
if (e >= 1) return 1;
|
|
348
|
+
const n = e - 1;
|
|
349
|
+
return n * n * ((t + 1) * n + t) + 1;
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function Ee(t, e = "end") {
|
|
353
|
+
const n = Math.max(1, Math.floor(t));
|
|
354
|
+
return (s) => {
|
|
355
|
+
if (s >= 1) return 1;
|
|
356
|
+
if (s <= 0) return e === "start" || e === "both" ? e === "start" ? 1 / n : 1 / (n + 1) : 0;
|
|
357
|
+
const r = Math.floor(s * n);
|
|
358
|
+
switch (e) {
|
|
359
|
+
case "start":
|
|
360
|
+
return Math.min(1, (r + 1) / n);
|
|
361
|
+
case "both":
|
|
362
|
+
return (r + 1) / (n + 1);
|
|
363
|
+
case "none":
|
|
364
|
+
return n === 1 ? 0 : Math.min(1, r / (n - 1));
|
|
365
|
+
default:
|
|
366
|
+
return r / n;
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function Le(t) {
|
|
371
|
+
switch (t.type) {
|
|
372
|
+
case "steps":
|
|
373
|
+
return Ee(t.count, t.position);
|
|
374
|
+
case "elastic":
|
|
375
|
+
return ht(Ie(t.amplitude, t.period), t.mode);
|
|
376
|
+
case "bounce":
|
|
377
|
+
return ht($e, t.mode);
|
|
378
|
+
case "back":
|
|
379
|
+
return ht(De(t.overshoot), t.mode);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function Bt(t) {
|
|
383
|
+
return t === void 0 ? Tt : de(t) ? Ce(t.points) : _t(t) ? Le(t) : Re[t] ?? Tt;
|
|
384
|
+
}
|
|
385
|
+
const Pt = 32, Fe = 256, z = /* @__PURE__ */ new Map(), Oe = /[MmLlHhVvCcSsQqTtAaZz]/, Ne = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, Xe = {
|
|
386
|
+
M: 2,
|
|
387
|
+
L: 2,
|
|
388
|
+
H: 1,
|
|
389
|
+
V: 1,
|
|
390
|
+
C: 6,
|
|
391
|
+
S: 4,
|
|
392
|
+
Q: 4,
|
|
393
|
+
T: 2,
|
|
394
|
+
A: 7,
|
|
395
|
+
Z: 0
|
|
396
|
+
};
|
|
397
|
+
function Ye(t) {
|
|
398
|
+
const e = [];
|
|
399
|
+
let n = 0, s = null;
|
|
400
|
+
const r = () => {
|
|
401
|
+
for (; n < t.length && /[\s,]/.test(t[n]); ) n++;
|
|
402
|
+
};
|
|
403
|
+
for (; n < t.length && (r(), !(n >= t.length)); ) {
|
|
404
|
+
const i = t[n];
|
|
405
|
+
if (Oe.test(i)) {
|
|
406
|
+
s = { type: i, args: [] }, e.push(s), n++;
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
if (!s) break;
|
|
410
|
+
const a = s.type === "A" || s.type === "a", o = s.args.length % 7;
|
|
411
|
+
if (a && (o === 3 || o === 4)) {
|
|
412
|
+
if (i !== "0" && i !== "1") break;
|
|
413
|
+
s.args.push(i === "1" ? 1 : 0), n++;
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
const c = Ne.exec(t.slice(n));
|
|
417
|
+
if (!c) break;
|
|
418
|
+
s.args.push(parseFloat(c[0])), n += c[0].length;
|
|
419
|
+
}
|
|
420
|
+
return e;
|
|
421
|
+
}
|
|
422
|
+
function Ve(t, e, n, s, r, i, a, o, c) {
|
|
423
|
+
if (t === o && e === c) return [];
|
|
424
|
+
let u = Math.abs(n), l = Math.abs(s);
|
|
425
|
+
if (u === 0 || l === 0) return [[t, e, o, c, o, c]];
|
|
426
|
+
const h = r * Math.PI / 180, d = Math.cos(h), f = Math.sin(h), M = (t - o) / 2, p = (e - c) / 2, g = d * M + f * p, y = -f * M + d * p, _ = g * g / (u * u) + y * y / (l * l);
|
|
427
|
+
if (_ > 1) {
|
|
428
|
+
const S = Math.sqrt(_);
|
|
429
|
+
u *= S, l *= S;
|
|
430
|
+
}
|
|
431
|
+
const T = i === a ? -1 : 1, x = u * u * l * l - u * u * y * y - l * l * g * g, m = u * u * y * y + l * l * g * g, k = T * Math.sqrt(Math.max(0, x / m)), b = k * u * y / l, L = -k * l * g / u, Z = d * b - f * L + (t + o) / 2, v = f * b + d * L + (e + c) / 2, C = (S, R, I, U) => {
|
|
432
|
+
const lt = S * I + R * U, tt = Math.sqrt((S * S + R * R) * (I * I + U * U)), K = Math.acos(Math.max(-1, Math.min(1, lt / tt)));
|
|
433
|
+
return S * U - R * I < 0 ? -K : K;
|
|
434
|
+
}, w = C(1, 0, (g - b) / u, (y - L) / l);
|
|
435
|
+
let P = C((g - b) / u, (y - L) / l, (-g - b) / u, (-y - L) / l);
|
|
436
|
+
!a && P > 0 && (P -= 2 * Math.PI), a && P < 0 && (P += 2 * Math.PI);
|
|
437
|
+
const X = Math.max(1, Math.ceil(Math.abs(P) / (Math.PI / 2))), ut = P / X, J = 4 / 3 * Math.tan(ut / 4), vt = (S) => {
|
|
438
|
+
const R = u * Math.cos(S), I = l * Math.sin(S);
|
|
439
|
+
return [d * R - f * I + Z, f * R + d * I + v];
|
|
440
|
+
}, St = (S) => {
|
|
441
|
+
const R = -u * Math.sin(S), I = l * Math.cos(S);
|
|
442
|
+
return [d * R - f * I, f * R + d * I];
|
|
443
|
+
}, At = [];
|
|
444
|
+
for (let S = 0; S < X; S++) {
|
|
445
|
+
const R = w + S * ut, I = R + ut, [U, lt] = vt(R), [tt, K] = S === X - 1 ? [o, c] : vt(I), [le, he] = St(R), [fe, pe] = St(I);
|
|
446
|
+
At.push([U + J * le, lt + J * he, tt - J * fe, K - J * pe, tt, K]);
|
|
447
|
+
}
|
|
448
|
+
return At;
|
|
449
|
+
}
|
|
450
|
+
function N(t, e, n, s, r) {
|
|
451
|
+
const i = 1 - r;
|
|
452
|
+
return i * i * i * t + 3 * i * i * r * e + 3 * i * r * r * n + r * r * r * s;
|
|
453
|
+
}
|
|
454
|
+
function Rt(t, e, n, s, r) {
|
|
455
|
+
const i = 1 - r;
|
|
456
|
+
return 3 * i * i * (e - t) + 6 * i * r * (n - e) + 3 * r * r * (s - n);
|
|
457
|
+
}
|
|
458
|
+
function Q(t, e, n, s) {
|
|
459
|
+
return {
|
|
460
|
+
subpath: 0,
|
|
461
|
+
type: "L",
|
|
462
|
+
points: [n, s],
|
|
463
|
+
startX: t,
|
|
464
|
+
startY: e,
|
|
465
|
+
endX: n,
|
|
466
|
+
endY: s,
|
|
467
|
+
length: Math.hypot(n - t, s - e)
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function nt(t, e, n) {
|
|
471
|
+
const [s, r, i, a, o, c] = n, u = [0];
|
|
472
|
+
let l = t, h = e, d = 0;
|
|
473
|
+
for (let f = 1; f <= Pt; f++) {
|
|
474
|
+
const M = f / Pt, p = N(t, s, i, o, M), g = N(e, r, a, c, M);
|
|
475
|
+
d += Math.hypot(p - l, g - h), u.push(d), l = p, h = g;
|
|
476
|
+
}
|
|
477
|
+
return {
|
|
478
|
+
subpath: 0,
|
|
479
|
+
type: "C",
|
|
480
|
+
points: [s, r, i, a, o, c],
|
|
481
|
+
startX: t,
|
|
482
|
+
startY: e,
|
|
483
|
+
endX: o,
|
|
484
|
+
endY: c,
|
|
485
|
+
length: d,
|
|
486
|
+
lengths: u
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
function q(t) {
|
|
490
|
+
const e = z.get(t);
|
|
491
|
+
if (e) return e;
|
|
492
|
+
const n = [];
|
|
493
|
+
let s = 0, r = 0, i = 0, a = 0, o = null, c = null, u = -1;
|
|
494
|
+
const l = /* @__PURE__ */ new Set(), h = (p) => {
|
|
495
|
+
u < 0 && (u = 0), p.subpath = u, n.push(p);
|
|
496
|
+
};
|
|
497
|
+
for (const { type: p, args: g } of Ye(t)) {
|
|
498
|
+
const y = p.toUpperCase(), _ = p !== y, T = Xe[y];
|
|
499
|
+
if (y === "Z") {
|
|
500
|
+
(s !== i || r !== a) && h(Q(s, r, i, a)), u >= 0 && l.add(u), s = i, r = a, o = c = null;
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
for (let x = 0; x + T <= g.length; x += T) {
|
|
504
|
+
const m = g.slice(x, x + T), k = _ ? s : 0, b = _ ? r : 0;
|
|
505
|
+
let L = null, Z = null;
|
|
506
|
+
switch (y) {
|
|
507
|
+
case "M":
|
|
508
|
+
x === 0 ? (s = m[0] + k, r = m[1] + b, i = s, a = r, (u < 0 || n[n.length - 1]?.subpath === u) && u++) : (h(Q(s, r, m[0] + k, m[1] + b)), s = m[0] + k, r = m[1] + b);
|
|
509
|
+
break;
|
|
510
|
+
case "L":
|
|
511
|
+
h(Q(s, r, m[0] + k, m[1] + b)), s = m[0] + k, r = m[1] + b;
|
|
512
|
+
break;
|
|
513
|
+
case "H":
|
|
514
|
+
h(Q(s, r, m[0] + k, r)), s = m[0] + k;
|
|
515
|
+
break;
|
|
516
|
+
case "V":
|
|
517
|
+
h(Q(s, r, s, m[0] + b)), r = m[0] + b;
|
|
518
|
+
break;
|
|
519
|
+
case "C": {
|
|
520
|
+
const v = [m[0] + k, m[1] + b, m[2] + k, m[3] + b, m[4] + k, m[5] + b];
|
|
521
|
+
h(nt(s, r, v)), L = [v[2], v[3]], s = v[4], r = v[5];
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
524
|
+
case "S": {
|
|
525
|
+
const [v, C] = o ? [2 * s - o[0], 2 * r - o[1]] : [s, r], w = [v, C, m[0] + k, m[1] + b, m[2] + k, m[3] + b];
|
|
526
|
+
h(nt(s, r, w)), L = [w[2], w[3]], s = w[4], r = w[5];
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
529
|
+
case "Q":
|
|
530
|
+
case "T": {
|
|
531
|
+
let v = s, C = r;
|
|
532
|
+
y === "Q" ? (v = m[0] + k, C = m[1] + b) : c && (v = 2 * s - c[0], C = 2 * r - c[1]);
|
|
533
|
+
const w = y === "Q" ? m[2] + k : m[0] + k, P = y === "Q" ? m[3] + b : m[1] + b;
|
|
534
|
+
h(
|
|
535
|
+
nt(s, r, [
|
|
536
|
+
s + 2 / 3 * (v - s),
|
|
537
|
+
r + 2 / 3 * (C - r),
|
|
538
|
+
w + 2 / 3 * (v - w),
|
|
539
|
+
P + 2 / 3 * (C - P),
|
|
540
|
+
w,
|
|
541
|
+
P
|
|
542
|
+
])
|
|
543
|
+
), Z = [v, C], s = w, r = P;
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
case "A": {
|
|
547
|
+
const v = m[5] + k, C = m[6] + b;
|
|
548
|
+
let w = s, P = r;
|
|
549
|
+
for (const X of Ve(s, r, m[0], m[1], m[2], m[3], m[4], v, C))
|
|
550
|
+
h(nt(w, P, X)), w = X[4], P = X[5];
|
|
551
|
+
s = v, r = C;
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
o = L, c = Z;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
const d = n.reduce((p, g) => p + g.length, 0), f = [];
|
|
559
|
+
for (let p = 0; p < n.length; ) {
|
|
560
|
+
const g = n[p].subpath;
|
|
561
|
+
let y = p, _ = 0;
|
|
562
|
+
for (; y < n.length && n[y].subpath === g; ) _ += n[y++].length;
|
|
563
|
+
const T = n[p], x = n[y - 1], m = l.has(g) || Math.abs(x.endX - T.startX) < 1e-9 && Math.abs(x.endY - T.startY) < 1e-9;
|
|
564
|
+
f.push({ start: p, end: y, length: _, closed: m }), p = y;
|
|
565
|
+
}
|
|
566
|
+
const M = { segments: n, totalLength: d, subpaths: f };
|
|
567
|
+
return z.size >= Fe && z.delete(z.keys().next().value), z.set(t, M), M;
|
|
568
|
+
}
|
|
569
|
+
function He(t, e) {
|
|
570
|
+
const n = t.lengths;
|
|
571
|
+
if (e <= 0) return 0;
|
|
572
|
+
if (e >= t.length) return 1;
|
|
573
|
+
let s = 0, r = n.length - 1;
|
|
574
|
+
for (; s < r - 1; ) {
|
|
575
|
+
const o = s + r >> 1;
|
|
576
|
+
n[o] < e ? s = o : r = o;
|
|
577
|
+
}
|
|
578
|
+
const i = n[r] - n[s], a = i > 0 ? (e - n[s]) / i : 0;
|
|
579
|
+
return (s + a) / (n.length - 1);
|
|
580
|
+
}
|
|
581
|
+
function Ue(t, e) {
|
|
582
|
+
if (t.type === "L") {
|
|
583
|
+
const h = t.length > 0 ? Math.max(0, Math.min(1, e / t.length)) : 0;
|
|
584
|
+
return {
|
|
585
|
+
x: t.startX + (t.endX - t.startX) * h,
|
|
586
|
+
y: t.startY + (t.endY - t.startY) * h,
|
|
587
|
+
angle: Math.atan2(t.endY - t.startY, t.endX - t.startX) * 180 / Math.PI
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
const [n, s, r, i, a, o] = t.points, c = He(t, e);
|
|
591
|
+
let u = Rt(t.startX, n, r, a, c), l = Rt(t.startY, s, i, o, c);
|
|
592
|
+
if (Math.hypot(u, l) < 1e-9) {
|
|
593
|
+
const h = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), d = N(t.startX, n, r, a, h), f = N(t.startY, s, i, o, h), M = N(t.startX, n, r, a, c), p = N(t.startY, s, i, o, c);
|
|
594
|
+
u = c < 0.5 ? d - M : M - d, l = c < 0.5 ? f - p : p - f;
|
|
595
|
+
}
|
|
596
|
+
return {
|
|
597
|
+
x: N(t.startX, n, r, a, c),
|
|
598
|
+
y: N(t.startY, s, i, o, c),
|
|
599
|
+
angle: Math.atan2(l, u) * 180 / Math.PI
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
function Gt(t, e, n = 0, s = t.length) {
|
|
603
|
+
if (s <= n) return { x: 0, y: 0, angle: 0 };
|
|
604
|
+
let r = 0;
|
|
605
|
+
for (let i = n; i < s; i++) {
|
|
606
|
+
const a = t[i];
|
|
607
|
+
if (r + a.length >= e || i === s - 1)
|
|
608
|
+
return Ue(a, e - r);
|
|
609
|
+
r += a.length;
|
|
610
|
+
}
|
|
611
|
+
return { x: 0, y: 0, angle: 0 };
|
|
612
|
+
}
|
|
613
|
+
function ze(t, e) {
|
|
614
|
+
const { segments: n, totalLength: s } = q(t);
|
|
615
|
+
return Gt(n, Math.max(0, Math.min(1, e)) * s);
|
|
616
|
+
}
|
|
617
|
+
function Hn() {
|
|
618
|
+
z.clear();
|
|
619
|
+
}
|
|
620
|
+
function Un(t) {
|
|
621
|
+
return q(t).totalLength;
|
|
622
|
+
}
|
|
623
|
+
const qe = 24, We = 320, Ke = 2.5, j = 72, zn = 64, Qe = 0.2, je = 128, G = /* @__PURE__ */ new Map();
|
|
624
|
+
let st = 0, O;
|
|
625
|
+
const Ct = (t) => Math.round(t * 100) / 100;
|
|
626
|
+
function It(t, e) {
|
|
627
|
+
const { segments: n, subpaths: s, totalLength: r } = q(t);
|
|
628
|
+
if (n.length === 0) return [];
|
|
629
|
+
if (e) {
|
|
630
|
+
const i = s.every((a) => a.closed);
|
|
631
|
+
return [{ segments: n, start: 0, end: n.length, length: r, closed: i }];
|
|
632
|
+
}
|
|
633
|
+
return s.filter((i) => i.length > 0).map((i) => ({ segments: n, start: i.start, end: i.end, length: i.length, closed: i.closed }));
|
|
634
|
+
}
|
|
635
|
+
function bt(t, e) {
|
|
636
|
+
const n = t.closed ? (e % 1 + 1) % 1 : Math.max(0, Math.min(1, e)), s = Gt(t.segments, n * t.length, t.start, t.end);
|
|
637
|
+
return [s.x, s.y];
|
|
638
|
+
}
|
|
639
|
+
function $t(t) {
|
|
640
|
+
const e = [];
|
|
641
|
+
let n = 0;
|
|
642
|
+
for (let s = t.start; s < t.end; s++)
|
|
643
|
+
n += t.segments[s].length, t.length > 0 && e.push(n / t.length);
|
|
644
|
+
return e;
|
|
645
|
+
}
|
|
646
|
+
function Dt(t, e) {
|
|
647
|
+
const n = [];
|
|
648
|
+
for (let s = 0; s < e; s++)
|
|
649
|
+
n.push(bt(t, t.closed ? s / e : s / (e - 1)));
|
|
650
|
+
return n;
|
|
651
|
+
}
|
|
652
|
+
function Et(t) {
|
|
653
|
+
let e = 0, n = 0;
|
|
654
|
+
for (const [s, r] of t)
|
|
655
|
+
e += s, n += r;
|
|
656
|
+
return e /= t.length, n /= t.length, t.map(([s, r]) => [s - e, r - n]);
|
|
657
|
+
}
|
|
658
|
+
function Be(t, e, n) {
|
|
659
|
+
const s = t.closed && e.closed;
|
|
660
|
+
if (n !== void 0)
|
|
661
|
+
return { offset: s ? Math.abs(n) % j / j : 0, reversed: n < 0 };
|
|
662
|
+
const r = Et(Dt(t, j)), i = Et(Dt(e, j)), a = j;
|
|
663
|
+
let o = { offset: 0, reversed: !1 }, c = 1 / 0;
|
|
664
|
+
for (const u of [!1, !0]) {
|
|
665
|
+
const l = s ? a : 1;
|
|
666
|
+
for (let h = 0; h < l; h++) {
|
|
667
|
+
let d = 0;
|
|
668
|
+
for (let f = 0; f < a && d < c; f++) {
|
|
669
|
+
const M = s ? u ? (h - f + a) % a : (f + h) % a : u ? a - 1 - f : f, p = r[f][0] - i[M][0], g = r[f][1] - i[M][1];
|
|
670
|
+
d += p * p + g * g;
|
|
671
|
+
}
|
|
672
|
+
d < c && (c = d, o = { offset: s ? h / a : 0, reversed: u });
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return o;
|
|
676
|
+
}
|
|
677
|
+
function Ge(t, e, n) {
|
|
678
|
+
return n ? ((e.reversed ? e.offset - t : t + e.offset) % 1 + 1) % 1 : e.reversed ? 1 - t : t;
|
|
679
|
+
}
|
|
680
|
+
function Ze(t, e, n) {
|
|
681
|
+
return n ? ((e.reversed ? e.offset - t : t - e.offset) % 1 + 1) % 1 : e.reversed ? 1 - t : t;
|
|
682
|
+
}
|
|
683
|
+
function Je(t, e, n) {
|
|
684
|
+
const s = t.closed && e.closed, r = Be(t, e, n.shapeIndex), i = Math.max(
|
|
685
|
+
qe,
|
|
686
|
+
Math.min(We, Math.ceil(Math.max(t.length, e.length) / Ke))
|
|
687
|
+
), a = /* @__PURE__ */ new Set(), o = (h) => a.add(Math.round(h * 1e7) / 1e7);
|
|
688
|
+
for (let h = 0; h <= i; h++) o(h / i);
|
|
689
|
+
for (const h of $t(t)) o(h);
|
|
690
|
+
for (const h of $t(e)) o(Ze(h, r, s));
|
|
691
|
+
let c = [...a].sort((h, d) => h - d);
|
|
692
|
+
s && (c = c.filter((h) => h < 1));
|
|
693
|
+
const u = [], l = [];
|
|
694
|
+
for (const h of c)
|
|
695
|
+
u.push(...bt(t, h)), l.push(...bt(e, Ge(h, r, s)));
|
|
696
|
+
return tn({ from: u, to: l, closed: s });
|
|
697
|
+
}
|
|
698
|
+
function tn(t) {
|
|
699
|
+
const e = t.from.length / 2;
|
|
700
|
+
if (e <= 3) return t;
|
|
701
|
+
const n = new Uint8Array(e);
|
|
702
|
+
n[0] = 1, n[e - 1] = 1;
|
|
703
|
+
const s = [[0, e - 1]];
|
|
704
|
+
for (; s.length > 0; ) {
|
|
705
|
+
const [a, o] = s.pop();
|
|
706
|
+
let c = -1, u = Qe;
|
|
707
|
+
for (let l = a + 1; l < o; l++) {
|
|
708
|
+
const h = Math.max(Lt(t.from, a, o, l), Lt(t.to, a, o, l));
|
|
709
|
+
h > u && (u = h, c = l);
|
|
710
|
+
}
|
|
711
|
+
c !== -1 && (n[c] = 1, s.push([a, c], [c, o]));
|
|
712
|
+
}
|
|
713
|
+
const r = [], i = [];
|
|
714
|
+
for (let a = 0; a < e; a++)
|
|
715
|
+
n[a] && (r.push(t.from[a * 2], t.from[a * 2 + 1]), i.push(t.to[a * 2], t.to[a * 2 + 1]));
|
|
716
|
+
return { from: r, to: i, closed: t.closed };
|
|
717
|
+
}
|
|
718
|
+
function Lt(t, e, n, s) {
|
|
719
|
+
const r = t[e * 2], i = t[e * 2 + 1], a = t[n * 2] - r, o = t[n * 2 + 1] - i, c = t[s * 2] - r, u = t[s * 2 + 1] - i, l = a * a + o * o, h = l === 0 ? 0 : Math.max(0, Math.min(1, (c * a + u * o) / l));
|
|
720
|
+
return Math.hypot(c - h * a, u - h * o);
|
|
721
|
+
}
|
|
722
|
+
function en(t, e, n) {
|
|
723
|
+
const s = n.shapeIndex;
|
|
724
|
+
if (O && O.from === t && O.to === e && O.shapeIndex === s) return O.plan;
|
|
725
|
+
const i = G.get(String(s ?? "auto"))?.get(t)?.get(e);
|
|
726
|
+
if (i)
|
|
727
|
+
return O = { from: t, to: e, shapeIndex: s, plan: i }, i;
|
|
728
|
+
const a = q(t).subpaths.filter((f) => f.length > 0).length === q(e).subpaths.filter((f) => f.length > 0).length, o = It(t, !a), c = It(e, !a), u = {
|
|
729
|
+
pairs: o.map((f, M) => Je(f, c[M], n))
|
|
730
|
+
};
|
|
731
|
+
st >= je && (G.clear(), st = 0);
|
|
732
|
+
const l = String(s ?? "auto"), h = G.get(l) ?? /* @__PURE__ */ new Map();
|
|
733
|
+
G.set(l, h);
|
|
734
|
+
const d = h.get(t) ?? /* @__PURE__ */ new Map();
|
|
735
|
+
return h.set(t, d), d.set(e, u), st++, O = { from: t, to: e, shapeIndex: s, plan: u }, u;
|
|
736
|
+
}
|
|
737
|
+
function nn(t, e, n, s = {}) {
|
|
738
|
+
if (!t) return e;
|
|
739
|
+
if (!e) return t;
|
|
740
|
+
const r = Math.max(0, Math.min(1, n));
|
|
741
|
+
if (r === 0) return t;
|
|
742
|
+
if (r === 1) return e;
|
|
743
|
+
const i = en(t, e, s);
|
|
744
|
+
if (i.pairs.length === 0) return r < 0.5 ? t : e;
|
|
745
|
+
let a = "";
|
|
746
|
+
for (const o of i.pairs) {
|
|
747
|
+
for (let c = 0; c < o.from.length; c += 2) {
|
|
748
|
+
const u = Ct(o.from[c] + (o.to[c] - o.from[c]) * r), l = Ct(o.from[c + 1] + (o.to[c + 1] - o.from[c + 1]) * r);
|
|
749
|
+
a += `${c === 0 ? a ? " M" : "M" : " L"}${u} ${l}`;
|
|
750
|
+
}
|
|
751
|
+
o.closed && (a += " Z");
|
|
752
|
+
}
|
|
753
|
+
return a;
|
|
754
|
+
}
|
|
755
|
+
function qn() {
|
|
756
|
+
G.clear(), st = 0, O = void 0;
|
|
757
|
+
}
|
|
758
|
+
function sn(t) {
|
|
759
|
+
return /^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(t);
|
|
760
|
+
}
|
|
761
|
+
const F = (t, e, n) => t + (e - t) * n, Zt = 512, ft = /* @__PURE__ */ new Map(), pt = /* @__PURE__ */ new Map();
|
|
762
|
+
function Ft(t) {
|
|
763
|
+
const e = ft.get(t);
|
|
764
|
+
if (e) return e;
|
|
765
|
+
const n = t.replace("#", ""), s = [
|
|
766
|
+
parseInt(n.slice(0, 2), 16),
|
|
767
|
+
parseInt(n.slice(2, 4), 16),
|
|
768
|
+
parseInt(n.slice(4, 6), 16)
|
|
769
|
+
];
|
|
770
|
+
return ft.size < Zt && ft.set(t, s), s;
|
|
771
|
+
}
|
|
772
|
+
const Ot = (t) => t.charCodeAt(0) === 35, Nt = (t) => t.startsWith("rgb"), Xt = (t) => t.startsWith("rgba"), rn = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, dt = (t) => Math.round(t).toString(16).padStart(2, "0");
|
|
773
|
+
function an(t, e, n) {
|
|
774
|
+
return `#${dt(t)}${dt(e)}${dt(n)}`;
|
|
775
|
+
}
|
|
776
|
+
function Yt(t) {
|
|
777
|
+
const e = pt.get(t);
|
|
778
|
+
if (e) return e;
|
|
779
|
+
const n = t.match(rn);
|
|
780
|
+
if (!n)
|
|
781
|
+
throw new Error(`Invalid rgb color: ${t}`);
|
|
782
|
+
const s = parseInt(n[1], 10), r = parseInt(n[2], 10), i = parseInt(n[3], 10), a = n[4] !== void 0 ? [s, r, i, parseFloat(n[4])] : [s, r, i];
|
|
783
|
+
return pt.size < Zt && pt.set(t, a), a;
|
|
784
|
+
}
|
|
785
|
+
const on = (t, e, n) => {
|
|
786
|
+
if (Ot(t) && Ot(e)) {
|
|
787
|
+
const [s, r, i] = Ft(t), [a, o, c] = Ft(e), u = F(s, a, n), l = F(r, o, n), h = F(i, c, n);
|
|
788
|
+
return an(u, l, h);
|
|
789
|
+
}
|
|
790
|
+
if ((Nt(t) || Xt(t)) && (Nt(e) || Xt(e))) {
|
|
791
|
+
const s = Yt(t), r = Yt(e), i = Math.round(F(s[0], r[0], n)), a = Math.round(F(s[1], r[1], n)), o = Math.round(F(s[2], r[2], n));
|
|
792
|
+
if (s.length === 4 || r.length === 4) {
|
|
793
|
+
const c = s[3] ?? 1, u = r[3] ?? 1, l = F(c, u, n);
|
|
794
|
+
return `rgba(${i}, ${a}, ${o}, ${l})`;
|
|
795
|
+
}
|
|
796
|
+
return `rgb(${i}, ${a}, ${o})`;
|
|
797
|
+
}
|
|
798
|
+
return n < 1 ? t : e;
|
|
799
|
+
}, cn = (t, e, n) => {
|
|
800
|
+
const s = Math.min(t.length, e.length), r = [];
|
|
801
|
+
for (let i = 0; i < s; i++)
|
|
802
|
+
r.push(F(t[i], e[i], n));
|
|
803
|
+
return r;
|
|
804
|
+
}, Vt = (t, e, n) => n < 1 ? t : e, un = (t, e, n) => nn(t, e, n);
|
|
805
|
+
function Jt(t) {
|
|
806
|
+
return typeof t == "number" ? F : Array.isArray(t) ? cn : typeof t == "string" ? t.startsWith("#") || t.startsWith("rgb") ? on : sn(t) ? un : Vt : Vt;
|
|
807
|
+
}
|
|
808
|
+
const te = 1e3 / 60;
|
|
809
|
+
function ee(t, e = {}) {
|
|
810
|
+
if (!H(t))
|
|
811
|
+
throw new Error(`bakeSpringTrack: track "${t.id}" is not a spring track`);
|
|
812
|
+
const n = new it(t.spring);
|
|
813
|
+
return se(t, (s) => n.valueAt(s), n.settleTime(), t.spring.from, t.spring.to, e);
|
|
814
|
+
}
|
|
815
|
+
function ne(t, e = {}) {
|
|
816
|
+
if (!V(t))
|
|
817
|
+
throw new Error(`bakeInertiaTrack: track "${t.id}" is not an inertia track`);
|
|
818
|
+
const n = t.inertia;
|
|
819
|
+
return se(
|
|
820
|
+
t,
|
|
821
|
+
(s) => Mt(n, s),
|
|
822
|
+
ct(n),
|
|
823
|
+
n.from,
|
|
824
|
+
ot(n),
|
|
825
|
+
e
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
function se(t, e, n, s, r, i) {
|
|
829
|
+
const a = i.intervalMs ?? te, o = i.tolerance ?? 0.01, c = t.delay ?? 0, u = [];
|
|
830
|
+
for (let h = 0; h <= n; h += a)
|
|
831
|
+
u.push({ time: h + c, value: e(h), easing: "linear" });
|
|
832
|
+
const l = u[u.length - 1];
|
|
833
|
+
return !l || l.time < n + c ? u.push({ time: n + c, value: r, easing: "linear" }) : l.value = r, c > 0 && u.unshift({ time: 0, value: s, easing: "linear" }), {
|
|
834
|
+
id: t.id,
|
|
835
|
+
target: t.target,
|
|
836
|
+
property: t.property,
|
|
837
|
+
keyframes: o > 0 ? fn(u, o) : u,
|
|
838
|
+
...t.targets && { targets: [...t.targets] },
|
|
839
|
+
...t.stagger && { stagger: { ...t.stagger } }
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
function ln(t, e, n, s = {}) {
|
|
843
|
+
const r = s.intervalMs ?? te, i = typeof n == "function" ? n : Bt(n), a = Jt(t.value), o = e.time - t.time;
|
|
844
|
+
if (o <= 0) return [e];
|
|
845
|
+
const c = [];
|
|
846
|
+
for (let l = r; l < o; l += r) {
|
|
847
|
+
const h = l / o;
|
|
848
|
+
c.push({
|
|
849
|
+
time: t.time + l,
|
|
850
|
+
value: a(t.value, e.value, i(h)),
|
|
851
|
+
easing: "linear"
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
const u = i(1);
|
|
855
|
+
return c.push({ ...e, ...u !== 1 && { value: a(t.value, e.value, u) }, easing: "linear" }), c;
|
|
856
|
+
}
|
|
857
|
+
function Wn(t, e) {
|
|
858
|
+
return H(t) ? ee(t, e) : V(t) ? ne(t, e) : t;
|
|
859
|
+
}
|
|
860
|
+
function hn(t, e = {}) {
|
|
861
|
+
const n = t.keyframes;
|
|
862
|
+
if (!n.some((r) => _t(r.easing))) return t;
|
|
863
|
+
const s = n.length > 0 ? [n[0]] : [];
|
|
864
|
+
for (let r = 1; r < n.length; r++) {
|
|
865
|
+
const i = n[r];
|
|
866
|
+
_t(i.easing) ? s.push(...ln(n[r - 1], i, i.easing, e)) : s.push(i);
|
|
867
|
+
}
|
|
868
|
+
return { ...t, keyframes: s };
|
|
869
|
+
}
|
|
870
|
+
function Kn(t, e) {
|
|
871
|
+
return t.filter(ge).map((n) => hn(n, e)).concat(
|
|
872
|
+
t.filter(H).map((n) => ee(n, e)),
|
|
873
|
+
t.filter(V).map((n) => ne(n, e))
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
function fn(t, e) {
|
|
877
|
+
if (t.length <= 2) return t;
|
|
878
|
+
const n = [t[0]];
|
|
879
|
+
for (let s = 1; s < t.length - 1; s++) {
|
|
880
|
+
const r = n[n.length - 1], i = t[s], a = t[s + 1], o = a.time - r.time;
|
|
881
|
+
if (o <= 0) continue;
|
|
882
|
+
const c = (i.time - r.time) / o, u = r.value + (a.value - r.value) * c;
|
|
883
|
+
Math.abs(i.value - u) > e && n.push(i);
|
|
884
|
+
}
|
|
885
|
+
return n.push(t[t.length - 1]), n;
|
|
886
|
+
}
|
|
887
|
+
function pn(t) {
|
|
888
|
+
const e = [...t.keyframes].sort((n, s) => n.time - s.time);
|
|
889
|
+
return {
|
|
890
|
+
...t,
|
|
891
|
+
keyframes: e
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
function Y(t) {
|
|
895
|
+
return t.targets && t.targets.length > 0 ? t.targets : [t.target];
|
|
896
|
+
}
|
|
897
|
+
function W(t, e, n, s) {
|
|
898
|
+
const r = n ?? 0;
|
|
899
|
+
return !s || e <= 1 ? r : r + qt(t, e, s);
|
|
900
|
+
}
|
|
901
|
+
class gt {
|
|
902
|
+
track;
|
|
903
|
+
targets;
|
|
904
|
+
constructor(e) {
|
|
905
|
+
this.track = e, this.targets = Y(e);
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Get the interpolated value at a specific time.
|
|
909
|
+
*
|
|
910
|
+
* For a multi-target track this returns the *first* target's value; callers
|
|
911
|
+
* that need every target should use `getTargetValues`.
|
|
912
|
+
*/
|
|
913
|
+
getValueAtTime(e) {
|
|
914
|
+
return this.valueForOffset(e - W(0, this.targets.length, this.track.delay, this.track.stagger));
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Every target's value at a specific time, in target order.
|
|
918
|
+
*
|
|
919
|
+
* Single-target tracks yield one entry; staggered tracks yield one per target,
|
|
920
|
+
* each sampled at its own offset time.
|
|
921
|
+
*/
|
|
922
|
+
getTargetValues(e) {
|
|
923
|
+
const n = this.targets.length, s = [];
|
|
924
|
+
for (let r = 0; r < n; r++) {
|
|
925
|
+
const i = W(r, n, this.track.delay, this.track.stagger), a = this.valueForOffset(e - i);
|
|
926
|
+
a !== void 0 && s.push({ target: this.targets[r], value: a, start: i + this.track.keyframes[0].time });
|
|
927
|
+
}
|
|
928
|
+
return s;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Get the duration of this track — the last keyframe, plus any delay, the
|
|
932
|
+
* widest stagger offset, and any trailing hold.
|
|
933
|
+
*/
|
|
934
|
+
getDuration() {
|
|
935
|
+
const { keyframes: e } = this.track;
|
|
936
|
+
if (e.length === 0)
|
|
937
|
+
return 0;
|
|
938
|
+
const n = e[e.length - 1].time, s = this.track.stagger ? kt(this.targets.length, this.track.stagger) : 0;
|
|
939
|
+
return n + (this.track.delay ?? 0) + s + (this.track.endDelay ?? 0);
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Get the track metadata.
|
|
943
|
+
*/
|
|
944
|
+
getTrack() {
|
|
945
|
+
return this.track;
|
|
946
|
+
}
|
|
947
|
+
/** Interpolated value at a time already shifted into the track's own frame. */
|
|
948
|
+
valueForOffset(e) {
|
|
949
|
+
const { keyframes: n } = this.track;
|
|
950
|
+
if (n.length === 0)
|
|
951
|
+
return;
|
|
952
|
+
if (n.length === 1 || e <= n[0].time)
|
|
953
|
+
return n[0].value;
|
|
954
|
+
if (e >= n[n.length - 1].time)
|
|
955
|
+
return n[n.length - 1].value;
|
|
956
|
+
const { from: s, to: r } = this.findSurroundingKeyframes(e);
|
|
957
|
+
if (!s || !r)
|
|
958
|
+
return;
|
|
959
|
+
if (s.time === e)
|
|
960
|
+
return s.value;
|
|
961
|
+
const i = r.time - s.time, a = (e - s.time) / i, c = Bt(r.easing)(a);
|
|
962
|
+
return Jt(s.value)(s.value, r.value, c);
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Find the keyframes surrounding a given time.
|
|
966
|
+
*/
|
|
967
|
+
findSurroundingKeyframes(e) {
|
|
968
|
+
const { keyframes: n } = this.track;
|
|
969
|
+
for (let s = 0; s < n.length - 1; s++)
|
|
970
|
+
if (e >= n[s].time && e <= n[s + 1].time)
|
|
971
|
+
return { from: n[s], to: n[s + 1] };
|
|
972
|
+
return { from: null, to: null };
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
class dn {
|
|
976
|
+
track;
|
|
977
|
+
targets;
|
|
978
|
+
sampler;
|
|
979
|
+
constructor(e) {
|
|
980
|
+
this.track = e, this.targets = Y(e), this.sampler = new it(e.spring);
|
|
981
|
+
}
|
|
982
|
+
getValueAtTime(e) {
|
|
983
|
+
return this.sampler.valueAt(e - W(0, this.targets.length, this.track.delay, this.track.stagger));
|
|
984
|
+
}
|
|
985
|
+
getTargetValues(e) {
|
|
986
|
+
const n = this.targets.length, s = [];
|
|
987
|
+
for (let r = 0; r < n; r++) {
|
|
988
|
+
const i = W(r, n, this.track.delay, this.track.stagger);
|
|
989
|
+
s.push({ target: this.targets[r], value: this.sampler.valueAt(e - i), start: i });
|
|
990
|
+
}
|
|
991
|
+
return s;
|
|
992
|
+
}
|
|
993
|
+
/** Settle time plus delay and the widest stagger offset. */
|
|
994
|
+
getDuration() {
|
|
995
|
+
const e = this.track.stagger ? kt(this.targets.length, this.track.stagger) : 0;
|
|
996
|
+
return this.sampler.settleTime() + (this.track.delay ?? 0) + e;
|
|
997
|
+
}
|
|
998
|
+
getTrack() {
|
|
999
|
+
return this.track;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
class gn {
|
|
1003
|
+
track;
|
|
1004
|
+
targets;
|
|
1005
|
+
duration;
|
|
1006
|
+
constructor(e) {
|
|
1007
|
+
this.track = e, this.targets = Y(e), this.duration = ct(e.inertia);
|
|
1008
|
+
}
|
|
1009
|
+
getValueAtTime(e) {
|
|
1010
|
+
return Mt(this.track.inertia, e - W(0, this.targets.length, this.track.delay, this.track.stagger));
|
|
1011
|
+
}
|
|
1012
|
+
getTargetValues(e) {
|
|
1013
|
+
const n = this.targets.length, s = [];
|
|
1014
|
+
for (let r = 0; r < n; r++) {
|
|
1015
|
+
const i = W(r, n, this.track.delay, this.track.stagger);
|
|
1016
|
+
s.push({ target: this.targets[r], value: Mt(this.track.inertia, e - i), start: i });
|
|
1017
|
+
}
|
|
1018
|
+
return s;
|
|
1019
|
+
}
|
|
1020
|
+
/** Settle time plus delay and the widest stagger offset. */
|
|
1021
|
+
getDuration() {
|
|
1022
|
+
const e = this.track.stagger ? kt(this.targets.length, this.track.stagger) : 0;
|
|
1023
|
+
return this.duration + (this.track.delay ?? 0) + e;
|
|
1024
|
+
}
|
|
1025
|
+
getTrack() {
|
|
1026
|
+
return this.track;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
function re(t, e) {
|
|
1030
|
+
const n = { ...ze(t.pathData, e) };
|
|
1031
|
+
if (t.matrix) {
|
|
1032
|
+
const [s, r, i, a, o, c] = t.matrix, { x: u, y: l } = n;
|
|
1033
|
+
n.x = s * u + i * l + o, n.y = r * u + a * l + c;
|
|
1034
|
+
const h = n.angle * Math.PI / 180, d = Math.cos(h), f = Math.sin(h);
|
|
1035
|
+
n.angle = Math.atan2(r * d + a * f, s * d + i * f) * 180 / Math.PI;
|
|
1036
|
+
}
|
|
1037
|
+
return t.autoRotate && t.rotateOffset && (n.angle += t.rotateOffset), n;
|
|
1038
|
+
}
|
|
1039
|
+
function Qn(t, e, n, s) {
|
|
1040
|
+
const r = e + (n - e) * s;
|
|
1041
|
+
return re(t, r);
|
|
1042
|
+
}
|
|
1043
|
+
const mt = {
|
|
1044
|
+
upperCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
1045
|
+
lowerCase: "abcdefghijklmnopqrstuvwxyz",
|
|
1046
|
+
upperAndLowerCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
1047
|
+
numbers: "0123456789"
|
|
1048
|
+
}, mn = 20;
|
|
1049
|
+
function yn(t) {
|
|
1050
|
+
const e = mt[t ?? "upperCase"] ?? t ?? mt.upperCase, n = Array.from(e);
|
|
1051
|
+
return n.length > 0 ? n : Array.from(mt.upperCase);
|
|
1052
|
+
}
|
|
1053
|
+
function _n(t, e, n) {
|
|
1054
|
+
let s = (t | 0) ^ Math.imul(e + 1, 2654435761) ^ Math.imul(n + 1, 2246822507);
|
|
1055
|
+
return s = Math.imul(s ^ s >>> 16, 2146121005), s = Math.imul(s ^ s >>> 15, 2221713035), (s ^ s >>> 16) >>> 0;
|
|
1056
|
+
}
|
|
1057
|
+
function Mn(t, e, n = 0) {
|
|
1058
|
+
const s = t.from ?? "", r = t.to, i = Math.max(0, Math.min(1, e));
|
|
1059
|
+
if (i <= 0) return s;
|
|
1060
|
+
if (i >= 1) return r;
|
|
1061
|
+
const a = Array.from(s), o = Array.from(r), c = t.rightToLeft ?? !1;
|
|
1062
|
+
if (t.mode === "type") {
|
|
1063
|
+
const _ = Math.round(i * Math.max(a.length, o.length));
|
|
1064
|
+
return c ? a.slice(0, Math.max(0, a.length - _)).join("") + o.slice(Math.max(0, o.length - _)).join("") : o.slice(0, _).join("") + a.slice(_).join("");
|
|
1065
|
+
}
|
|
1066
|
+
const u = Math.max(0, Math.min(0.999, t.revealDelay ?? 0)), l = Math.max(0, (i - u) / (1 - u)), h = Math.floor(l * o.length), d = t.tweenLength === !1 ? o.length : Math.round(a.length + (o.length - a.length) * i), f = yn(t.chars), M = t.refreshRate ?? mn, p = M > 0 ? Math.floor(n * M / 1e3) : 0, g = t.seed ?? 1;
|
|
1067
|
+
let y = "";
|
|
1068
|
+
for (let _ = 0; _ < d; _++) {
|
|
1069
|
+
const T = c ? _ >= d - h : _ < h, x = c ? o[o.length - (d - _)] : o[_];
|
|
1070
|
+
T && x !== void 0 || x === " " || x === `
|
|
1071
|
+
` ? y += x : y += f[_n(g, _, p) % f.length];
|
|
1072
|
+
}
|
|
1073
|
+
return y;
|
|
1074
|
+
}
|
|
1075
|
+
class Tn {
|
|
1076
|
+
id;
|
|
1077
|
+
name;
|
|
1078
|
+
/** Caption text per language, per marker id */
|
|
1079
|
+
captions;
|
|
1080
|
+
_tracks = [];
|
|
1081
|
+
_trackPlayers = /* @__PURE__ */ new Map();
|
|
1082
|
+
_motionPathTracks = /* @__PURE__ */ new Map();
|
|
1083
|
+
_springTracks = /* @__PURE__ */ new Map();
|
|
1084
|
+
_textTracks = /* @__PURE__ */ new Map();
|
|
1085
|
+
_config;
|
|
1086
|
+
_currentTime = 0;
|
|
1087
|
+
_playbackState = "idle";
|
|
1088
|
+
_direction = "forward";
|
|
1089
|
+
_loopIteration = 0;
|
|
1090
|
+
_explicitDuration;
|
|
1091
|
+
/** Milliseconds still to wait at a loop boundary before the next iteration */
|
|
1092
|
+
_repeatDelayRemaining = 0;
|
|
1093
|
+
/**
|
|
1094
|
+
* A forward loop reached its end with a repeat delay armed: the playhead
|
|
1095
|
+
* holds on the last frame for the delay, then returns to the start.
|
|
1096
|
+
*/
|
|
1097
|
+
_wrapAfterDelay = !1;
|
|
1098
|
+
onUpdate = null;
|
|
1099
|
+
onComplete = null;
|
|
1100
|
+
constructor(e) {
|
|
1101
|
+
if (this.id = e.id, this.name = e.name, this.captions = e.captions, this._config = e.config ?? {}, this._explicitDuration = e.config?.duration, e.tracks)
|
|
1102
|
+
for (const n of e.tracks)
|
|
1103
|
+
this.addTrack(n);
|
|
1104
|
+
}
|
|
1105
|
+
get tracks() {
|
|
1106
|
+
return [...this._tracks];
|
|
1107
|
+
}
|
|
1108
|
+
get duration() {
|
|
1109
|
+
return this._explicitDuration !== void 0 ? this._explicitDuration : this._calculateDuration();
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Set an explicit timeline duration (ms). Pass `undefined` to fall back to the
|
|
1113
|
+
* duration calculated from the last keyframe across all tracks.
|
|
1114
|
+
*/
|
|
1115
|
+
setDuration(e) {
|
|
1116
|
+
if (this._explicitDuration = e, e !== void 0)
|
|
1117
|
+
this._config = { ...this._config, duration: e };
|
|
1118
|
+
else if (this._config.duration !== void 0) {
|
|
1119
|
+
const n = { ...this._config };
|
|
1120
|
+
delete n.duration, this._config = n;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
get currentTime() {
|
|
1124
|
+
return this._currentTime;
|
|
1125
|
+
}
|
|
1126
|
+
get playbackState() {
|
|
1127
|
+
return this._playbackState;
|
|
1128
|
+
}
|
|
1129
|
+
get direction() {
|
|
1130
|
+
return this._direction;
|
|
1131
|
+
}
|
|
1132
|
+
get loopIteration() {
|
|
1133
|
+
return this._loopIteration;
|
|
1134
|
+
}
|
|
1135
|
+
/** Milliseconds of `repeatDelay` still to wait at a loop boundary (0 when not waiting). */
|
|
1136
|
+
get repeatDelayRemaining() {
|
|
1137
|
+
return this._repeatDelayRemaining;
|
|
1138
|
+
}
|
|
1139
|
+
get speed() {
|
|
1140
|
+
return this._config.speed ?? 1;
|
|
1141
|
+
}
|
|
1142
|
+
set speed(e) {
|
|
1143
|
+
this._config.speed = e;
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Start or resume playback.
|
|
1147
|
+
* If at the end and direction is forward, reset to beginning.
|
|
1148
|
+
* If at the beginning and direction is reverse, reset to end.
|
|
1149
|
+
*/
|
|
1150
|
+
play() {
|
|
1151
|
+
const e = this.duration;
|
|
1152
|
+
this._direction === "forward" && this._currentTime >= e && e > 0 ? (this._currentTime = 0, this._loopIteration = 0) : this._direction === "reverse" && this._currentTime <= 0 && e > 0 && (this._currentTime = e, this._loopIteration = 0), this._playbackState = "playing";
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Pause playback at current position.
|
|
1156
|
+
*/
|
|
1157
|
+
pause() {
|
|
1158
|
+
this._playbackState = "paused";
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Stop playback and reset to beginning.
|
|
1162
|
+
*/
|
|
1163
|
+
stop() {
|
|
1164
|
+
this._playbackState = "idle", this._repeatDelayRemaining = 0, this._wrapAfterDelay = !1, this._currentTime = 0, this._loopIteration = 0, this._direction = "forward";
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Seek to a specific time.
|
|
1168
|
+
*/
|
|
1169
|
+
seek(e) {
|
|
1170
|
+
const n = this.duration > 0 ? this.duration : 1 / 0;
|
|
1171
|
+
this._currentTime = Math.max(0, Math.min(e, n)), this._repeatDelayRemaining = 0, this._wrapAfterDelay = !1;
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Toggle or set playback direction.
|
|
1175
|
+
*/
|
|
1176
|
+
reverse() {
|
|
1177
|
+
this._direction = this._direction === "forward" ? "reverse" : "forward";
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Advance the timeline by delta milliseconds.
|
|
1181
|
+
* Call this from your animation loop or clock.
|
|
1182
|
+
*/
|
|
1183
|
+
tick(e) {
|
|
1184
|
+
if (this._playbackState !== "playing")
|
|
1185
|
+
return;
|
|
1186
|
+
const n = this.duration;
|
|
1187
|
+
if (n <= 0)
|
|
1188
|
+
return;
|
|
1189
|
+
let r = e * this.speed;
|
|
1190
|
+
if (this._repeatDelayRemaining > 0) {
|
|
1191
|
+
const o = Math.min(this._repeatDelayRemaining, r);
|
|
1192
|
+
if (this._repeatDelayRemaining -= o, r -= o, this._repeatDelayRemaining > 0) {
|
|
1193
|
+
this.onUpdate?.(this.getStateAtTime(this._currentTime));
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
this._wrapAfterDelay && (this._wrapAfterDelay = !1, this._currentTime = 0);
|
|
1197
|
+
}
|
|
1198
|
+
const i = 1e3;
|
|
1199
|
+
for (let o = 0; o < i && r > 0 && this._playbackState === "playing"; o++)
|
|
1200
|
+
if (this._direction === "forward") {
|
|
1201
|
+
const c = n - this._currentTime;
|
|
1202
|
+
if (r >= c) {
|
|
1203
|
+
if (r -= c, this._currentTime = n, !this._handleEndReached())
|
|
1204
|
+
break;
|
|
1205
|
+
} else
|
|
1206
|
+
this._currentTime += r, r = 0;
|
|
1207
|
+
} else {
|
|
1208
|
+
const c = this._currentTime;
|
|
1209
|
+
if (r >= c) {
|
|
1210
|
+
if (r -= c, this._currentTime = 0, !this._handleStartReached())
|
|
1211
|
+
break;
|
|
1212
|
+
} else
|
|
1213
|
+
this._currentTime -= r, r = 0;
|
|
1214
|
+
}
|
|
1215
|
+
const a = this.getStateAtTime(this._currentTime);
|
|
1216
|
+
this.onUpdate?.(a);
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Get the animation state at a specific time.
|
|
1220
|
+
*/
|
|
1221
|
+
getStateAtTime(e) {
|
|
1222
|
+
const n = /* @__PURE__ */ new Map();
|
|
1223
|
+
if (this._hasSharedWrites())
|
|
1224
|
+
this._resolveShared(e, n);
|
|
1225
|
+
else
|
|
1226
|
+
for (const [s, r] of this._trackPlayers) {
|
|
1227
|
+
const i = r.getTrack().property;
|
|
1228
|
+
for (const { target: a, value: o, start: c } of r.getTargetValues(e))
|
|
1229
|
+
this._write(n, s, a, i, o, e - c);
|
|
1230
|
+
}
|
|
1231
|
+
return {
|
|
1232
|
+
values: n,
|
|
1233
|
+
currentTime: this._currentTime,
|
|
1234
|
+
playbackState: this._playbackState,
|
|
1235
|
+
direction: this._direction,
|
|
1236
|
+
loopIteration: this._loopIteration
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Several tracks drive the same target+property. Which one applies at `time`:
|
|
1241
|
+
*
|
|
1242
|
+
* 1. Of the tracks that have started (their first keyframe, plus delay and
|
|
1243
|
+
* stagger, is at or before `time`), the one that started LAST.
|
|
1244
|
+
* 2. If none has started yet, the one that starts FIRST — so the value before
|
|
1245
|
+
* anything plays is the first animation's starting value.
|
|
1246
|
+
* 3. Ties on start time go to the track added LAST.
|
|
1247
|
+
*
|
|
1248
|
+
* This is what makes a sequence of tweens on one property play as a sequence:
|
|
1249
|
+
* a later tween holds its starting value, but does not apply it until its
|
|
1250
|
+
* turn. `findConflicts()` reports overlaps by the same rule.
|
|
1251
|
+
*/
|
|
1252
|
+
_resolveShared(e, n) {
|
|
1253
|
+
const s = /* @__PURE__ */ new Map();
|
|
1254
|
+
for (const [r, i] of this._trackPlayers) {
|
|
1255
|
+
const a = i.getTrack().property;
|
|
1256
|
+
for (const { target: o, value: c, start: u } of i.getTargetValues(e)) {
|
|
1257
|
+
const l = `${o}\0${a}`, h = u <= e, d = s.get(l);
|
|
1258
|
+
(!d || (h !== d.started ? h : h ? u >= d.start : u <= d.start)) && s.set(l, { trackId: r, target: o, property: a, value: c, start: u, started: h });
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
for (const { trackId: r, target: i, property: a, value: o, start: c } of s.values())
|
|
1262
|
+
this._write(n, r, i, a, o, e - c);
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Write one track's value for a target, expanding the progress of motion paths
|
|
1266
|
+
* (into x/y/rotation) and text tracks (into the string). `elapsed` is the time
|
|
1267
|
+
* since this target's animation on the track started.
|
|
1268
|
+
*/
|
|
1269
|
+
_write(e, n, s, r, i, a) {
|
|
1270
|
+
if (i === void 0) return;
|
|
1271
|
+
let o = e.get(s);
|
|
1272
|
+
o || (o = /* @__PURE__ */ new Map(), e.set(s, o));
|
|
1273
|
+
const c = this._textTracks.get(n);
|
|
1274
|
+
if (c && typeof i == "number") {
|
|
1275
|
+
o.set("text", Mn(c.textConfig, i, Math.max(0, a)));
|
|
1276
|
+
return;
|
|
1277
|
+
}
|
|
1278
|
+
const u = this._motionPathTracks.get(n);
|
|
1279
|
+
if (u && typeof i == "number") {
|
|
1280
|
+
const l = re(u.motionPathConfig, i);
|
|
1281
|
+
o.set("motionPathX", l.x), o.set("motionPathY", l.y), u.motionPathConfig.autoRotate && o.set("motionPathRotate", l.angle);
|
|
1282
|
+
} else
|
|
1283
|
+
o.set(r, i);
|
|
1284
|
+
}
|
|
1285
|
+
/** Cached: does any target+property have more than one track? */
|
|
1286
|
+
_sharedWrites = null;
|
|
1287
|
+
_hasSharedWrites() {
|
|
1288
|
+
if (this._sharedWrites === null) {
|
|
1289
|
+
const e = /* @__PURE__ */ new Set();
|
|
1290
|
+
this._sharedWrites = !1;
|
|
1291
|
+
t: for (const n of this._tracks)
|
|
1292
|
+
for (const s of Y(n)) {
|
|
1293
|
+
const r = `${s}\0${n.property}`;
|
|
1294
|
+
if (e.has(r)) {
|
|
1295
|
+
this._sharedWrites = !0;
|
|
1296
|
+
break t;
|
|
1297
|
+
}
|
|
1298
|
+
e.add(r);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
return this._sharedWrites;
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Add a track to the timeline.
|
|
1305
|
+
*/
|
|
1306
|
+
addTrack(e) {
|
|
1307
|
+
if (this._tracks.push(e), this._sharedWrites = null, V(e)) {
|
|
1308
|
+
this._trackPlayers.set(e.id, new gn(e));
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
if (H(e)) {
|
|
1312
|
+
this._trackPlayers.set(e.id, new dn(e)), this._springTracks.set(e.id, e);
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
if (xt(e))
|
|
1316
|
+
this._trackPlayers.set(e.id, new gt(e)), this._textTracks.set(e.id, e);
|
|
1317
|
+
else if (Ut(e)) {
|
|
1318
|
+
const n = {
|
|
1319
|
+
id: e.id,
|
|
1320
|
+
target: e.target,
|
|
1321
|
+
property: e.property,
|
|
1322
|
+
keyframes: e.keyframes,
|
|
1323
|
+
delay: e.delay,
|
|
1324
|
+
endDelay: e.endDelay,
|
|
1325
|
+
targets: e.targets,
|
|
1326
|
+
stagger: e.stagger
|
|
1327
|
+
};
|
|
1328
|
+
this._trackPlayers.set(e.id, new gt(n)), this._motionPathTracks.set(e.id, e);
|
|
1329
|
+
} else
|
|
1330
|
+
this._trackPlayers.set(e.id, new gt(e));
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Replace a track with a new version, keeping its place in the track order
|
|
1334
|
+
* (which decides ties when tracks overlap). The new track may have a
|
|
1335
|
+
* different id. Does nothing if no track has `trackId`.
|
|
1336
|
+
*/
|
|
1337
|
+
replaceTrack(e, n) {
|
|
1338
|
+
const s = this._tracks.findIndex((i) => i.id === e);
|
|
1339
|
+
if (s < 0) return;
|
|
1340
|
+
const r = this._tracks.slice(s + 1);
|
|
1341
|
+
this.removeTrack(e);
|
|
1342
|
+
for (const i of r) this.removeTrack(i.id);
|
|
1343
|
+
this.addTrack(n);
|
|
1344
|
+
for (const i of r) this.addTrack(i);
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Remove a track by its ID.
|
|
1348
|
+
*/
|
|
1349
|
+
removeTrack(e) {
|
|
1350
|
+
this._tracks = this._tracks.filter((n) => n.id !== e), this._sharedWrites = null, this._trackPlayers.delete(e), this._motionPathTracks.delete(e), this._springTracks.delete(e), this._textTracks.delete(e);
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Tracks matching a filter. All provided fields must match (AND).
|
|
1354
|
+
*
|
|
1355
|
+
* This is the closest principled equivalent to GSAP's per-tween handle: we
|
|
1356
|
+
* have no live tween objects to hold, so a "tween" is addressed by describing
|
|
1357
|
+
* the tracks it produced.
|
|
1358
|
+
*/
|
|
1359
|
+
getTracks(e = {}) {
|
|
1360
|
+
return this._tracks.filter((n) => this._matches(n, e));
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* Remove every track matching a filter. Returns the ids removed.
|
|
1364
|
+
*
|
|
1365
|
+
* `timeline.removeTracks({ target: 'box' })` is the equivalent of killing all
|
|
1366
|
+
* tweens on an element.
|
|
1367
|
+
*/
|
|
1368
|
+
removeTracks(e = {}) {
|
|
1369
|
+
const n = this.getTracks(e).map((s) => s.id);
|
|
1370
|
+
for (const s of n)
|
|
1371
|
+
this.removeTrack(s);
|
|
1372
|
+
return n;
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* The time span a track is active over: [start, end] in milliseconds.
|
|
1376
|
+
*/
|
|
1377
|
+
getTrackSpan(e) {
|
|
1378
|
+
const n = this._trackPlayers.get(e);
|
|
1379
|
+
if (!n) return;
|
|
1380
|
+
const s = n.getTrack(), r = s.delay ?? 0;
|
|
1381
|
+
if (H(s) || V(s))
|
|
1382
|
+
return { from: r, to: n.getDuration() };
|
|
1383
|
+
const i = s.keyframes;
|
|
1384
|
+
if (!(!i || i.length === 0))
|
|
1385
|
+
return { from: i[0].time + r, to: n.getDuration() };
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Overlapping writes to the same target+property.
|
|
1389
|
+
*
|
|
1390
|
+
* Where two spans overlap, the track that starts later wins from the moment it
|
|
1391
|
+
* starts (ties: the one added later) — see `_resolveShared`. That is
|
|
1392
|
+
* predictable but silent, so an authoring tool should call this and warn,
|
|
1393
|
+
* because a silently discarded stretch of a track looks like a bug.
|
|
1394
|
+
*/
|
|
1395
|
+
findConflicts() {
|
|
1396
|
+
const e = [];
|
|
1397
|
+
for (let n = 0; n < this._tracks.length; n++) {
|
|
1398
|
+
const s = this._tracks[n], r = this.getTrackSpan(s.id);
|
|
1399
|
+
if (r)
|
|
1400
|
+
for (let i = 0; i < n; i++) {
|
|
1401
|
+
const a = this._tracks[i];
|
|
1402
|
+
if (a.property !== s.property) continue;
|
|
1403
|
+
const o = Y(a).filter((h) => Y(s).includes(h));
|
|
1404
|
+
if (o.length === 0) continue;
|
|
1405
|
+
const c = this.getTrackSpan(a.id);
|
|
1406
|
+
if (!c || !(c.from <= r.to && r.from <= c.to)) continue;
|
|
1407
|
+
const l = r.from >= c.from;
|
|
1408
|
+
for (const h of o)
|
|
1409
|
+
e.push({
|
|
1410
|
+
target: h,
|
|
1411
|
+
property: s.property,
|
|
1412
|
+
losingTrackId: l ? a.id : s.id,
|
|
1413
|
+
winningTrackId: l ? s.id : a.id
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
return e;
|
|
1418
|
+
}
|
|
1419
|
+
_matches(e, n) {
|
|
1420
|
+
if (n.id !== void 0 && e.id !== n.id || n.property !== void 0 && e.property !== n.property || n.target !== void 0 && !Y(e).includes(n.target)) return !1;
|
|
1421
|
+
if (n.timeRange) {
|
|
1422
|
+
const s = this.getTrackSpan(e.id);
|
|
1423
|
+
if (!s || s.to < n.timeRange.from || s.from > n.timeRange.to) return !1;
|
|
1424
|
+
}
|
|
1425
|
+
return !0;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Export timeline as a serializable definition.
|
|
1429
|
+
*/
|
|
1430
|
+
toDefinition() {
|
|
1431
|
+
return {
|
|
1432
|
+
formatVersion: rt,
|
|
1433
|
+
id: this.id,
|
|
1434
|
+
name: this.name,
|
|
1435
|
+
config: { ...this._config },
|
|
1436
|
+
tracks: [...this._tracks],
|
|
1437
|
+
...this.captions && { captions: this.captions }
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
/** The playback configuration, as loaded (read-only). */
|
|
1441
|
+
get config() {
|
|
1442
|
+
return this._config;
|
|
1443
|
+
}
|
|
1444
|
+
/** The timeline's markers, in time order (empty when it has none). */
|
|
1445
|
+
get markers() {
|
|
1446
|
+
return [...this._config.markers ?? []].sort((e, n) => e.time - n.time);
|
|
1447
|
+
}
|
|
1448
|
+
/** Start the between-iterations pause, if the timeline configures one. */
|
|
1449
|
+
_armRepeatDelay() {
|
|
1450
|
+
this._repeatDelayRemaining = this._config.repeatDelay ?? 0;
|
|
1451
|
+
}
|
|
1452
|
+
_calculateDuration() {
|
|
1453
|
+
let e = 0;
|
|
1454
|
+
for (const [, n] of this._trackPlayers)
|
|
1455
|
+
e = Math.max(e, n.getDuration());
|
|
1456
|
+
return e;
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Handle reaching the end of the timeline.
|
|
1460
|
+
* Returns true if we looped and should continue, false if we stopped.
|
|
1461
|
+
*/
|
|
1462
|
+
_handleEndReached() {
|
|
1463
|
+
const e = this._config.loop ?? 0;
|
|
1464
|
+
return e === -1 || this._loopIteration < e ? (this._loopIteration++, this._armRepeatDelay(), this._config.alternate ? this._direction = "reverse" : this._repeatDelayRemaining > 0 ? this._wrapAfterDelay = !0 : this._currentTime = 0, this._repeatDelayRemaining === 0) : (this._playbackState = "idle", this.onComplete?.(), !1);
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* Handle reaching the start of the timeline (in reverse).
|
|
1468
|
+
* Returns true if we looped and should continue, false if we stopped.
|
|
1469
|
+
*/
|
|
1470
|
+
_handleStartReached() {
|
|
1471
|
+
const e = this._config.loop ?? 0;
|
|
1472
|
+
return this._config.alternate && (e === -1 || this._loopIteration < e) ? (this._loopIteration++, this._armRepeatDelay(), this._direction = "forward", this._repeatDelayRemaining === 0) : (this._playbackState = "idle", this.onComplete?.(), !1);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
const bn = 100;
|
|
1476
|
+
function jn(t, e, n, s) {
|
|
1477
|
+
const r = [], i = [], { duration: a, alternate: o } = s, c = (f, M, p, g) => {
|
|
1478
|
+
i.push([f, M]);
|
|
1479
|
+
const y = [];
|
|
1480
|
+
t.forEach((_, T) => {
|
|
1481
|
+
(p === "forward" ? (g ? _ >= f : _ > f) && _ <= M : (g ? _ <= f : _ < f) && _ >= M) && y.push(T);
|
|
1482
|
+
}), y.sort((_, T) => (p === "forward" ? t[_] - t[T] : t[T] - t[_]) || _ - T);
|
|
1483
|
+
for (const _ of y) r.push({ kind: "event", index: _, direction: p });
|
|
1484
|
+
};
|
|
1485
|
+
let u = e.time, l = e.direction, h = e.fresh === !0;
|
|
1486
|
+
const d = Math.min(bn, Math.max(0, n.iteration - e.iteration));
|
|
1487
|
+
for (let f = 0; f < d; f++) {
|
|
1488
|
+
const M = l === "forward" ? a : 0;
|
|
1489
|
+
c(u, M, l, h), r.push({ kind: "repeat" }), o ? (l = l === "forward" ? "reverse" : "forward", u = M, h = !1) : (u = l === "forward" ? 0 : a, h = !0);
|
|
1490
|
+
}
|
|
1491
|
+
return d > 0 && s.holding && !o ? { crossings: r, passes: i } : (c(u, n.time, l, h), { crossings: r, passes: i });
|
|
1492
|
+
}
|
|
1493
|
+
function xn(t) {
|
|
1494
|
+
return V(t) ? {
|
|
1495
|
+
id: t.id,
|
|
1496
|
+
target: t.target,
|
|
1497
|
+
property: t.property,
|
|
1498
|
+
kind: "inertia",
|
|
1499
|
+
inertia: ie(t.inertia),
|
|
1500
|
+
...E(t)
|
|
1501
|
+
} : H(t) ? {
|
|
1502
|
+
id: t.id,
|
|
1503
|
+
target: t.target,
|
|
1504
|
+
property: t.property,
|
|
1505
|
+
kind: "spring",
|
|
1506
|
+
spring: { ...t.spring },
|
|
1507
|
+
...E(t)
|
|
1508
|
+
} : xt(t) ? {
|
|
1509
|
+
id: t.id,
|
|
1510
|
+
target: t.target,
|
|
1511
|
+
property: "text",
|
|
1512
|
+
textConfig: { ...t.textConfig },
|
|
1513
|
+
keyframes: t.keyframes.map(yt),
|
|
1514
|
+
...E(t)
|
|
1515
|
+
} : Ut(t) ? {
|
|
1516
|
+
id: t.id,
|
|
1517
|
+
target: t.target,
|
|
1518
|
+
property: "motionPath",
|
|
1519
|
+
motionPathConfig: { ...t.motionPathConfig },
|
|
1520
|
+
keyframes: t.keyframes.map(yt),
|
|
1521
|
+
...E(t)
|
|
1522
|
+
} : {
|
|
1523
|
+
id: t.id,
|
|
1524
|
+
target: t.target,
|
|
1525
|
+
property: t.property,
|
|
1526
|
+
keyframes: t.keyframes.map(yt),
|
|
1527
|
+
...E(t)
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
function ie(t) {
|
|
1531
|
+
return { ...t, ...Array.isArray(t.end) && { end: [...t.end] } };
|
|
1532
|
+
}
|
|
1533
|
+
function yt(t) {
|
|
1534
|
+
return {
|
|
1535
|
+
time: t.time,
|
|
1536
|
+
value: t.value,
|
|
1537
|
+
...t.easing && { easing: t.easing }
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
function E(t) {
|
|
1541
|
+
const e = t.endDelay;
|
|
1542
|
+
return {
|
|
1543
|
+
...t.delay !== void 0 && { delay: t.delay },
|
|
1544
|
+
...e !== void 0 && { endDelay: e },
|
|
1545
|
+
...t.targets !== void 0 && { targets: [...t.targets] },
|
|
1546
|
+
...t.stagger !== void 0 && { stagger: { ...t.stagger } }
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
function kn(t) {
|
|
1550
|
+
if (V(t)) {
|
|
1551
|
+
const e = t;
|
|
1552
|
+
return {
|
|
1553
|
+
id: e.id,
|
|
1554
|
+
target: e.target,
|
|
1555
|
+
property: e.property,
|
|
1556
|
+
kind: "inertia",
|
|
1557
|
+
inertia: ie(e.inertia),
|
|
1558
|
+
...E(e)
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
if (H(t)) {
|
|
1562
|
+
const e = t;
|
|
1563
|
+
return {
|
|
1564
|
+
id: e.id,
|
|
1565
|
+
target: e.target,
|
|
1566
|
+
property: e.property,
|
|
1567
|
+
kind: "spring",
|
|
1568
|
+
spring: { ...e.spring },
|
|
1569
|
+
...E(e)
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
if (xt(t)) {
|
|
1573
|
+
const e = t;
|
|
1574
|
+
return {
|
|
1575
|
+
id: e.id,
|
|
1576
|
+
target: e.target,
|
|
1577
|
+
property: "text",
|
|
1578
|
+
textConfig: { ...e.textConfig },
|
|
1579
|
+
keyframes: [...e.keyframes].sort((n, s) => n.time - s.time),
|
|
1580
|
+
...E(e)
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
if (t.property === "motionPath" && "motionPathConfig" in t) {
|
|
1584
|
+
const e = t, n = [...e.keyframes].sort((s, r) => s.time - r.time);
|
|
1585
|
+
return {
|
|
1586
|
+
id: e.id,
|
|
1587
|
+
target: e.target,
|
|
1588
|
+
property: "motionPath",
|
|
1589
|
+
motionPathConfig: { ...e.motionPathConfig },
|
|
1590
|
+
keyframes: n,
|
|
1591
|
+
...E(e)
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
return pn({
|
|
1595
|
+
id: t.id,
|
|
1596
|
+
target: t.target,
|
|
1597
|
+
property: t.property,
|
|
1598
|
+
keyframes: t.keyframes,
|
|
1599
|
+
...E(t)
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
function vn(t) {
|
|
1603
|
+
const e = t._config.markers;
|
|
1604
|
+
return {
|
|
1605
|
+
formatVersion: rt,
|
|
1606
|
+
id: t.id,
|
|
1607
|
+
name: t.name,
|
|
1608
|
+
config: {
|
|
1609
|
+
duration: t.duration > 0 ? t.duration : void 0,
|
|
1610
|
+
loop: t._config.loop,
|
|
1611
|
+
speed: t._config.speed,
|
|
1612
|
+
alternate: t._config.alternate,
|
|
1613
|
+
repeatDelay: t._config.repeatDelay,
|
|
1614
|
+
...e && { markers: e.map((n) => ({ ...n })) }
|
|
1615
|
+
},
|
|
1616
|
+
tracks: t.tracks.map(xn),
|
|
1617
|
+
...t.captions && { captions: t.captions }
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
function Sn(t) {
|
|
1621
|
+
const e = t.formatVersion ?? 1;
|
|
1622
|
+
if (e > rt)
|
|
1623
|
+
throw new Error(
|
|
1624
|
+
`tinyfly: this animation uses format version ${e}, but this tinyfly reads up to version ${rt}. Update tinyfly to play it.`
|
|
1625
|
+
);
|
|
1626
|
+
return new Tn({
|
|
1627
|
+
id: t.id,
|
|
1628
|
+
name: t.name,
|
|
1629
|
+
config: t.config,
|
|
1630
|
+
tracks: t.tracks.map(kn),
|
|
1631
|
+
captions: t.captions
|
|
1632
|
+
});
|
|
1633
|
+
}
|
|
1634
|
+
function Bn(t) {
|
|
1635
|
+
return JSON.stringify(vn(t));
|
|
1636
|
+
}
|
|
1637
|
+
function Gn(t) {
|
|
1638
|
+
const e = JSON.parse(t);
|
|
1639
|
+
return Sn(e);
|
|
1640
|
+
}
|
|
1641
|
+
function Zn(t) {
|
|
1642
|
+
let e = 2166136261;
|
|
1643
|
+
for (let n = 0; n < t.length; n++)
|
|
1644
|
+
e ^= t.charCodeAt(n), e = Math.imul(e, 16777619);
|
|
1645
|
+
return e >>> 0;
|
|
1646
|
+
}
|
|
1647
|
+
function An(t) {
|
|
1648
|
+
let e = t >>> 0 || 2654435769;
|
|
1649
|
+
return {
|
|
1650
|
+
seed: t >>> 0,
|
|
1651
|
+
next() {
|
|
1652
|
+
return e ^= e << 13, e >>>= 0, e ^= e >> 17, e ^= e << 5, e >>>= 0, e / 4294967296;
|
|
1653
|
+
}
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
function ae(t, e, n) {
|
|
1657
|
+
return e + t.next() * (n - e);
|
|
1658
|
+
}
|
|
1659
|
+
function wn(t, e, n, s) {
|
|
1660
|
+
if (s <= 0) return ae(t, e, n);
|
|
1661
|
+
const r = Math.floor((n - e) / s), i = Math.round(t.next() * r);
|
|
1662
|
+
return e + i * s;
|
|
1663
|
+
}
|
|
1664
|
+
function Jn(t, e) {
|
|
1665
|
+
if (e.length !== 0)
|
|
1666
|
+
return e[Math.floor(t.next() * e.length)];
|
|
1667
|
+
}
|
|
1668
|
+
const oe = /^([+\-*/])=\s*(-?[\d.]+)$/, ce = /^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;
|
|
1669
|
+
function ts(t) {
|
|
1670
|
+
return typeof t != "string" ? !1 : oe.test(t.trim()) || ce.test(t.trim());
|
|
1671
|
+
}
|
|
1672
|
+
function ue(t, e = {}) {
|
|
1673
|
+
if (typeof t != "string") return t;
|
|
1674
|
+
const n = t.trim(), s = oe.exec(n);
|
|
1675
|
+
if (s) {
|
|
1676
|
+
const [, i, a] = s, o = e.base ?? 0, c = Number.parseFloat(a);
|
|
1677
|
+
switch (i) {
|
|
1678
|
+
case "+":
|
|
1679
|
+
return o + c;
|
|
1680
|
+
case "-":
|
|
1681
|
+
return o - c;
|
|
1682
|
+
case "*":
|
|
1683
|
+
return o * c;
|
|
1684
|
+
case "/":
|
|
1685
|
+
return c === 0 ? o : o / c;
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
const r = ce.exec(n);
|
|
1689
|
+
if (r) {
|
|
1690
|
+
if (!e.random)
|
|
1691
|
+
throw new Error(
|
|
1692
|
+
`resolveValue: "${n}" needs a random source — pass one via context.random`
|
|
1693
|
+
);
|
|
1694
|
+
const i = Number.parseFloat(r[1]), a = Number.parseFloat(r[2]), o = r[3] !== void 0 ? Number.parseFloat(r[3]) : void 0;
|
|
1695
|
+
return o !== void 0 ? wn(e.random, i, a, o) : ae(e.random, i, a);
|
|
1696
|
+
}
|
|
1697
|
+
return t;
|
|
1698
|
+
}
|
|
1699
|
+
function Pn(t, e = 0, n) {
|
|
1700
|
+
const s = [];
|
|
1701
|
+
let r = e;
|
|
1702
|
+
for (const i of t) {
|
|
1703
|
+
const a = ue(i, { base: r, random: n });
|
|
1704
|
+
s.push(a), typeof a == "number" && (r = a);
|
|
1705
|
+
}
|
|
1706
|
+
return s;
|
|
1707
|
+
}
|
|
1708
|
+
class es {
|
|
1709
|
+
random;
|
|
1710
|
+
constructor(e) {
|
|
1711
|
+
this.random = An(e);
|
|
1712
|
+
}
|
|
1713
|
+
/** The seed, to be stored alongside the timeline so this can be reproduced. */
|
|
1714
|
+
get seed() {
|
|
1715
|
+
return this.random.seed;
|
|
1716
|
+
}
|
|
1717
|
+
resolve(e, n = 0) {
|
|
1718
|
+
return ue(e, { base: n, random: this.random });
|
|
1719
|
+
}
|
|
1720
|
+
resolveSequence(e, n = 0) {
|
|
1721
|
+
return Pn(e, n, this.random);
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
const Rn = 600;
|
|
1725
|
+
function ns(t) {
|
|
1726
|
+
if (Array.isArray(t)) {
|
|
1727
|
+
const [d, f, M, p] = t;
|
|
1728
|
+
return { fn: Ht(d, f, M, p), bezier: [d, f, M, p] };
|
|
1729
|
+
}
|
|
1730
|
+
const { segments: e } = q(t);
|
|
1731
|
+
if (e.length === 0) throw new Error(`customEase: no curve in "${t}"`);
|
|
1732
|
+
const n = e[0].startX, s = e[0].startY, r = e[e.length - 1], i = r.endX - n, a = r.endY - s;
|
|
1733
|
+
if (i === 0 || a === 0) throw new Error(`customEase: "${t}" must move along both axes`);
|
|
1734
|
+
const o = (d) => (d - n) / i, c = (d) => (d - s) / a;
|
|
1735
|
+
if (e.length === 1 && r.type === "C") {
|
|
1736
|
+
const [d, f, M, p] = r.points, g = [o(d), c(f), o(M), c(p)];
|
|
1737
|
+
return { fn: Ht(...g), bezier: g };
|
|
1738
|
+
}
|
|
1739
|
+
const u = [], l = [], h = Math.max(8, Math.ceil(Rn / e.length));
|
|
1740
|
+
for (const d of e)
|
|
1741
|
+
for (let f = u.length === 0 ? 0 : 1; f <= h; f++) {
|
|
1742
|
+
const [M, p] = Cn(d, f / h);
|
|
1743
|
+
u.push(o(M)), l.push(c(p));
|
|
1744
|
+
}
|
|
1745
|
+
return { fn: In(u, l) };
|
|
1746
|
+
}
|
|
1747
|
+
function ss(t = {}) {
|
|
1748
|
+
const n = 0.1 + Math.max(0, Math.min(1, t.strength ?? 0.7)) * 0.7, s = [1];
|
|
1749
|
+
for (let i = n; i > 2e-3; i *= n) s.push(2 * Math.sqrt(i));
|
|
1750
|
+
const r = s.reduce((i, a) => i + a, 0);
|
|
1751
|
+
return (i) => {
|
|
1752
|
+
if (i <= 0) return 0;
|
|
1753
|
+
if (i >= 1) return 1;
|
|
1754
|
+
let a = i * r;
|
|
1755
|
+
for (let o = 0; o < s.length; o++) {
|
|
1756
|
+
if (a <= s[o]) {
|
|
1757
|
+
if (o === 0) return (a / s[0]) ** 2;
|
|
1758
|
+
const c = s[o] / 2, u = c * c, l = a - c;
|
|
1759
|
+
return 1 - (u - l * l);
|
|
1760
|
+
}
|
|
1761
|
+
a -= s[o];
|
|
1762
|
+
}
|
|
1763
|
+
return 1;
|
|
1764
|
+
};
|
|
1765
|
+
}
|
|
1766
|
+
function rs(t = {}) {
|
|
1767
|
+
const e = Math.max(1, t.wiggles ?? 10), n = t.type ?? "easeOut", s = (r) => n === "uniform" ? 1 : n === "easeInOut" ? Math.sin(Math.PI * r) : (1 - r) ** 2;
|
|
1768
|
+
return (r) => r <= 0 || r >= 1 ? 0 : Math.sin(r * e * Math.PI * 2) * s(r);
|
|
1769
|
+
}
|
|
1770
|
+
function Cn(t, e) {
|
|
1771
|
+
if (t.type === "L") {
|
|
1772
|
+
const [u, l] = t.points;
|
|
1773
|
+
return [t.startX + (u - t.startX) * e, t.startY + (l - t.startY) * e];
|
|
1774
|
+
}
|
|
1775
|
+
const [n, s, r, i, a, o] = t.points, c = 1 - e;
|
|
1776
|
+
return [
|
|
1777
|
+
c * c * c * t.startX + 3 * c * c * e * n + 3 * c * e * e * r + e * e * e * a,
|
|
1778
|
+
c * c * c * t.startY + 3 * c * c * e * s + 3 * c * e * e * i + e * e * e * o
|
|
1779
|
+
];
|
|
1780
|
+
}
|
|
1781
|
+
function In(t, e) {
|
|
1782
|
+
return (n) => {
|
|
1783
|
+
if (n <= t[0]) return e[0];
|
|
1784
|
+
if (n >= t[t.length - 1]) return e[e.length - 1];
|
|
1785
|
+
let s = 0, r = t.length - 1;
|
|
1786
|
+
for (; r - s > 1; ) {
|
|
1787
|
+
const a = s + r >> 1;
|
|
1788
|
+
t[a] <= n ? s = a : r = a;
|
|
1789
|
+
}
|
|
1790
|
+
const i = t[r] - t[s];
|
|
1791
|
+
return i === 0 ? e[r] : e[s] + (n - t[s]) / i * (e[r] - e[s]);
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
function Ht(t, e, n, s) {
|
|
1795
|
+
const r = (a, o, c) => 3 * (1 - a) * (1 - a) * a * o + 3 * (1 - a) * a * a * c + a * a * a, i = (a, o, c) => 3 * (1 - a) * (1 - a) * o + 6 * (1 - a) * a * (c - o) + 3 * a * a * (1 - c);
|
|
1796
|
+
return (a) => {
|
|
1797
|
+
if (a <= 0) return 0;
|
|
1798
|
+
if (a >= 1) return 1;
|
|
1799
|
+
let o = a;
|
|
1800
|
+
for (let l = 0; l < 8; l++) {
|
|
1801
|
+
const h = r(o, t, n) - a, d = i(o, t, n);
|
|
1802
|
+
if (Math.abs(h) < 1e-6) return r(o, e, s);
|
|
1803
|
+
if (Math.abs(d) < 1e-6) break;
|
|
1804
|
+
o -= h / d;
|
|
1805
|
+
}
|
|
1806
|
+
let c = 0, u = 1;
|
|
1807
|
+
o = a;
|
|
1808
|
+
for (let l = 0; l < 40; l++)
|
|
1809
|
+
r(o, t, n) < a ? c = o : u = o, o = (c + u) / 2;
|
|
1810
|
+
return r(o, e, s);
|
|
1811
|
+
};
|
|
1812
|
+
}
|
|
1813
|
+
const D = (t) => Math.round(t * 1e3) / 1e3;
|
|
1814
|
+
function is(t, e = {}) {
|
|
1815
|
+
if (t.length === 0) return "";
|
|
1816
|
+
const n = e.curviness ?? 1, s = e.closed ?? !1, r = t.length;
|
|
1817
|
+
let i = `M${D(t[0].x)} ${D(t[0].y)}`;
|
|
1818
|
+
if (r === 1) return i;
|
|
1819
|
+
const a = (c) => s ? t[(c % r + r) % r] : t[Math.max(0, Math.min(r - 1, c))], o = s ? r : r - 1;
|
|
1820
|
+
for (let c = 0; c < o; c++) {
|
|
1821
|
+
const u = a(c - 1), l = a(c), h = a(c + 1), d = a(c + 2);
|
|
1822
|
+
if (n === 0) {
|
|
1823
|
+
i += ` L${D(h.x)} ${D(h.y)}`;
|
|
1824
|
+
continue;
|
|
1825
|
+
}
|
|
1826
|
+
const f = n / 6, M = l.x + (h.x - u.x) * f, p = l.y + (h.y - u.y) * f, g = h.x - (d.x - l.x) * f, y = h.y - (d.y - l.y) * f;
|
|
1827
|
+
i += ` C${D(M)} ${D(p)} ${D(g)} ${D(y)} ${D(h.x)} ${D(h.y)}`;
|
|
1828
|
+
}
|
|
1829
|
+
return s ? `${i} Z` : i;
|
|
1830
|
+
}
|
|
1831
|
+
const A = (t, e = 0) => {
|
|
1832
|
+
const n = parseFloat(t ?? "");
|
|
1833
|
+
return Number.isFinite(n) ? n : e;
|
|
1834
|
+
};
|
|
1835
|
+
function $n(t) {
|
|
1836
|
+
const e = (t ?? "").trim().split(/[\s,]+/).filter(Boolean).map(Number), n = [];
|
|
1837
|
+
for (let s = 0; s + 1 < e.length; s += 2) n.push({ x: e[s], y: e[s + 1] });
|
|
1838
|
+
return n;
|
|
1839
|
+
}
|
|
1840
|
+
function as(t) {
|
|
1841
|
+
const e = t.attributes;
|
|
1842
|
+
switch (t.tag.toLowerCase()) {
|
|
1843
|
+
case "path":
|
|
1844
|
+
return e.d ?? null;
|
|
1845
|
+
case "circle":
|
|
1846
|
+
case "ellipse": {
|
|
1847
|
+
const n = A(e.cx), s = A(e.cy), r = t.tag.toLowerCase() === "circle" ? A(e.r) : A(e.rx), i = t.tag.toLowerCase() === "circle" ? A(e.r) : A(e.ry);
|
|
1848
|
+
return `M${n + r} ${s} A${r} ${i} 0 1 1 ${n - r} ${s} A${r} ${i} 0 1 1 ${n + r} ${s} Z`;
|
|
1849
|
+
}
|
|
1850
|
+
case "rect": {
|
|
1851
|
+
const n = A(e.x), s = A(e.y), r = A(e.width), i = A(e.height);
|
|
1852
|
+
let a = e.rx != null ? A(e.rx) : e.ry != null ? A(e.ry) : 0, o = e.ry != null ? A(e.ry) : a;
|
|
1853
|
+
return a = Math.min(a, r / 2), o = Math.min(o, i / 2), a === 0 || o === 0 ? `M${n} ${s} H${n + r} V${s + i} H${n} Z` : `M${n + a} ${s} H${n + r - a} A${a} ${o} 0 0 1 ${n + r} ${s + o} V${s + i - o} A${a} ${o} 0 0 1 ${n + r - a} ${s + i} H${n + a} A${a} ${o} 0 0 1 ${n} ${s + i - o} V${s + o} A${a} ${o} 0 0 1 ${n + a} ${s} Z`;
|
|
1854
|
+
}
|
|
1855
|
+
case "line":
|
|
1856
|
+
return `M${A(e.x1)} ${A(e.y1)} L${A(e.x2)} ${A(e.y2)}`;
|
|
1857
|
+
case "polyline":
|
|
1858
|
+
case "polygon": {
|
|
1859
|
+
const n = $n(e.points);
|
|
1860
|
+
if (n.length === 0) return null;
|
|
1861
|
+
const s = n.map((r, i) => `${i === 0 ? "M" : "L"}${r.x} ${r.y}`).join(" ");
|
|
1862
|
+
return t.tag.toLowerCase() === "polygon" ? `${s} Z` : s;
|
|
1863
|
+
}
|
|
1864
|
+
default:
|
|
1865
|
+
return null;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
export {
|
|
1869
|
+
Ln as Clock,
|
|
1870
|
+
te as DEFAULT_BAKE_INTERVAL_MS,
|
|
1871
|
+
wt as DEFAULT_INERTIA_FRICTION,
|
|
1872
|
+
$ as DEFAULT_SPRING,
|
|
1873
|
+
rt as FORMAT_VERSION,
|
|
1874
|
+
Te as INERTIA_MAX_DURATION_MS,
|
|
1875
|
+
gn as InertiaTrackPlayer,
|
|
1876
|
+
zn as MORPH_SAMPLES,
|
|
1877
|
+
En as ManualClock,
|
|
1878
|
+
Wt as SPRING_MAX_DURATION_MS,
|
|
1879
|
+
Fn as SPRING_PRESETS,
|
|
1880
|
+
B as SPRING_STEP_MS,
|
|
1881
|
+
it as SpringSampler,
|
|
1882
|
+
dn as SpringTrackPlayer,
|
|
1883
|
+
Tn as Timeline,
|
|
1884
|
+
gt as TrackPlayer,
|
|
1885
|
+
es as ValueResolver,
|
|
1886
|
+
De as backOut,
|
|
1887
|
+
ln as bakeEasing,
|
|
1888
|
+
ne as bakeInertiaTrack,
|
|
1889
|
+
ee as bakeSpringTrack,
|
|
1890
|
+
$e as bounceOut,
|
|
1891
|
+
yn as charactersFor,
|
|
1892
|
+
qn as clearMorphCache,
|
|
1893
|
+
Hn as clearPathCache,
|
|
1894
|
+
Ce as createCubicBezier,
|
|
1895
|
+
An as createRandom,
|
|
1896
|
+
pn as createTrack,
|
|
1897
|
+
Yn as criticalDamping,
|
|
1898
|
+
ss as customBounce,
|
|
1899
|
+
ns as customEase,
|
|
1900
|
+
rs as customWiggle,
|
|
1901
|
+
Sn as deserializeTimeline,
|
|
1902
|
+
kn as deserializeTrack,
|
|
1903
|
+
Ae as easeIn,
|
|
1904
|
+
Kt as easeInCubic,
|
|
1905
|
+
Pe as easeInOut,
|
|
1906
|
+
jt as easeInOutCubic,
|
|
1907
|
+
Se as easeInOutQuad,
|
|
1908
|
+
ke as easeInQuad,
|
|
1909
|
+
we as easeOut,
|
|
1910
|
+
Qt as easeOutCubic,
|
|
1911
|
+
ve as easeOutQuad,
|
|
1912
|
+
Ie as elasticOut,
|
|
1913
|
+
hn as expandParametricEasings,
|
|
1914
|
+
Gn as fromJSON,
|
|
1915
|
+
Bt as getEasingFunction,
|
|
1916
|
+
Jt as getInterpolator,
|
|
1917
|
+
re as getMotionPathPoint,
|
|
1918
|
+
Un as getPathLength,
|
|
1919
|
+
ze as getPointAtProgress,
|
|
1920
|
+
ge as hasKeyframes,
|
|
1921
|
+
Zn as hashSeed,
|
|
1922
|
+
ct as inertiaDuration,
|
|
1923
|
+
ot as inertiaRest,
|
|
1924
|
+
Mt as inertiaValueAt,
|
|
1925
|
+
Vn as inertiaVelocityAt,
|
|
1926
|
+
cn as interpolateArray,
|
|
1927
|
+
on as interpolateColor,
|
|
1928
|
+
Qn as interpolateMotionPath,
|
|
1929
|
+
F as interpolateNumber,
|
|
1930
|
+
un as interpolatePathString,
|
|
1931
|
+
Vt as interpolateString,
|
|
1932
|
+
de as isCubicBezierEasing,
|
|
1933
|
+
V as isInertiaTrack,
|
|
1934
|
+
Dn as isMotionPathPoint,
|
|
1935
|
+
Ut as isMotionPathTrack,
|
|
1936
|
+
_t as isParametricEasing,
|
|
1937
|
+
sn as isPathData,
|
|
1938
|
+
H as isSpringTrack,
|
|
1939
|
+
xt as isTextTrack,
|
|
1940
|
+
Xn as isUnderdamped,
|
|
1941
|
+
ts as isUnresolved,
|
|
1942
|
+
Tt as linear,
|
|
1943
|
+
me as maxStaggerDistance,
|
|
1944
|
+
nn as morphPath,
|
|
1945
|
+
be as naturalRest,
|
|
1946
|
+
Le as parametricEasing,
|
|
1947
|
+
q as parsePath,
|
|
1948
|
+
jn as playheadCrossings,
|
|
1949
|
+
Gt as pointAtDistance,
|
|
1950
|
+
is as pointsToPath,
|
|
1951
|
+
ae as randomBetween,
|
|
1952
|
+
Jn as randomChoice,
|
|
1953
|
+
wn as randomSnapped,
|
|
1954
|
+
Pn as resolveSequence,
|
|
1955
|
+
ue as resolveValue,
|
|
1956
|
+
vn as serializeTimeline,
|
|
1957
|
+
xn as serializeTrack,
|
|
1958
|
+
as as shapeToPathData,
|
|
1959
|
+
fn as simplifyKeyframes,
|
|
1960
|
+
Nn as springDuration,
|
|
1961
|
+
On as springValueAt,
|
|
1962
|
+
zt as staggerDistance,
|
|
1963
|
+
qt as staggerOffset,
|
|
1964
|
+
ye as staggerOffsets,
|
|
1965
|
+
kt as staggerSpan,
|
|
1966
|
+
Ee as stepsEasing,
|
|
1967
|
+
Mn as textAt,
|
|
1968
|
+
Bn as toJSON,
|
|
1969
|
+
Wn as toKeyframedTrack,
|
|
1970
|
+
Kn as toKeyframedTracks,
|
|
1971
|
+
Y as trackTargets
|
|
1972
|
+
};
|