dopesheet 0.0.0-stage → 0.1.0-beta.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 +78 -2
- package/bin/dopesheet.mjs +50 -0
- package/dist/browser/client.js +9 -0
- package/dist/browser/client.js.map +1 -0
- package/dist/browser/runtime.js +1 -0
- package/dist/browser/src-C-7lxf9e.js +2735 -0
- package/dist/browser/src-C-7lxf9e.js.map +1 -0
- package/dist/browser/src-D2ttZ_j7.js +7089 -0
- package/dist/browser/src-D2ttZ_j7.js.map +1 -0
- package/dist/browser/ui.js +1 -0
- package/dist/index.js +11 -0
- package/dist/loader.cjs +24 -0
- package/dist/next.js +81 -0
- package/dist/shared-CdhNdlQj.js +47 -0
- package/dist/shared-DpUIelWp.js +1454 -0
- package/dist/shared-E9l6ZbF6.js +102 -0
- package/dist/transform.js +2 -0
- package/dist/vite.js +16 -0
- package/docs/agents.md +38 -0
- package/package.json +90 -3
- package/types/next.d.ts +10 -0
- package/types/vite.d.ts +11 -0
- package/types/webpack.d.ts +14 -0
|
@@ -0,0 +1,2735 @@
|
|
|
1
|
+
// ../protocol/src/index.ts
|
|
2
|
+
var e = "@position", t = {
|
|
3
|
+
to: 2,
|
|
4
|
+
from: 2,
|
|
5
|
+
set: 2,
|
|
6
|
+
fromTo: 3,
|
|
7
|
+
add: 1,
|
|
8
|
+
addLabel: 1,
|
|
9
|
+
call: 2,
|
|
10
|
+
addPause: 0
|
|
11
|
+
}, n = "/__dopesheet/save", r = "/__dopesheet/relocate", i = "/__dopesheet/dock";
|
|
12
|
+
function a(e) {
|
|
13
|
+
let t = e.lastIndexOf("#");
|
|
14
|
+
if (t < 0) return null;
|
|
15
|
+
let n = Number(e.slice(t + 1));
|
|
16
|
+
return !Number.isInteger(n) || n < 0 ? null : {
|
|
17
|
+
file: e.slice(0, t),
|
|
18
|
+
ordinal: n
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
// ../runtime/src/position.ts
|
|
22
|
+
function o(e, t) {
|
|
23
|
+
if (e == null) return { form: "default" };
|
|
24
|
+
if (typeof e == "number") return {
|
|
25
|
+
form: "absolute",
|
|
26
|
+
asString: !1
|
|
27
|
+
};
|
|
28
|
+
if (typeof e != "string") return null;
|
|
29
|
+
let n = e.trim();
|
|
30
|
+
if (!isNaN(Number(n)) && !(n in t)) return {
|
|
31
|
+
form: "absolute",
|
|
32
|
+
asString: !0
|
|
33
|
+
};
|
|
34
|
+
let r = n.endsWith("%"), i = n[0], a = n.indexOf("=");
|
|
35
|
+
return i === "<" || i === ">" ? {
|
|
36
|
+
form: "prev",
|
|
37
|
+
anchor: i,
|
|
38
|
+
eq: a >= 0,
|
|
39
|
+
percent: r
|
|
40
|
+
} : a < 0 ? {
|
|
41
|
+
form: "label",
|
|
42
|
+
label: n,
|
|
43
|
+
percent: !1
|
|
44
|
+
} : a === 1 ? {
|
|
45
|
+
form: "end",
|
|
46
|
+
percent: r
|
|
47
|
+
} : {
|
|
48
|
+
form: "label",
|
|
49
|
+
label: n.slice(0, a - 1),
|
|
50
|
+
percent: r
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
var s = (e, t) => {
|
|
54
|
+
let n = Math.round(e * 10 ** t) / 10 ** t;
|
|
55
|
+
return Object.is(n, -0) ? 0 : n;
|
|
56
|
+
};
|
|
57
|
+
function c(e, t, n = "") {
|
|
58
|
+
if (e === 0) return "";
|
|
59
|
+
let r = e < 0 ? "-" : "+";
|
|
60
|
+
return `${t ? r + "=" : r === "-" ? "-" : ""}${Math.abs(e)}${n}`;
|
|
61
|
+
}
|
|
62
|
+
function l(e, t, n, r) {
|
|
63
|
+
let i = o(e, t.labels);
|
|
64
|
+
if (!i) throw Error("Unsupported position");
|
|
65
|
+
let a = (e, t) => t > 0 ? s(e / t * 100, 1) : 0;
|
|
66
|
+
switch (i.form) {
|
|
67
|
+
case "default": {
|
|
68
|
+
let e = s(n - t.end, 3);
|
|
69
|
+
return e === 0 ? void 0 : `${e < 0 ? "-" : "+"}=${Math.abs(e)}`;
|
|
70
|
+
}
|
|
71
|
+
case "absolute": {
|
|
72
|
+
let e = s(Math.max(0, n), 3);
|
|
73
|
+
return i.asString ? String(e) : e;
|
|
74
|
+
}
|
|
75
|
+
case "end": {
|
|
76
|
+
let e = n - t.end;
|
|
77
|
+
if (i.percent) {
|
|
78
|
+
let t = a(e, r);
|
|
79
|
+
return `${t < 0 ? "-" : "+"}=${Math.abs(t)}%`;
|
|
80
|
+
}
|
|
81
|
+
let o = s(e, 3);
|
|
82
|
+
return `${o < 0 ? "-" : "+"}=${Math.abs(o)}`;
|
|
83
|
+
}
|
|
84
|
+
case "prev": {
|
|
85
|
+
let e = n - (i.anchor === "<" ? t.prevStart : t.prevEnd);
|
|
86
|
+
if (i.percent) {
|
|
87
|
+
let n = a(e, i.eq ? r : t.prevDuration);
|
|
88
|
+
return `${i.anchor}${c(n, i.eq, "%")}` || i.anchor;
|
|
89
|
+
}
|
|
90
|
+
return `${i.anchor}${c(s(e, 3), i.eq)}`;
|
|
91
|
+
}
|
|
92
|
+
case "label": {
|
|
93
|
+
let e = n - (t.labels[i.label] ?? t.end);
|
|
94
|
+
if (i.percent) {
|
|
95
|
+
let t = a(e, r);
|
|
96
|
+
return t === 0 ? i.label : `${i.label}${c(t, !0, "%")}`;
|
|
97
|
+
}
|
|
98
|
+
return `${i.label}${c(s(e, 3), !0)}`;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// ../runtime/src/keyframes.ts
|
|
103
|
+
var u = /* @__PURE__ */ new Set([
|
|
104
|
+
"duration",
|
|
105
|
+
"delay",
|
|
106
|
+
"ease",
|
|
107
|
+
"easeEach",
|
|
108
|
+
"stagger",
|
|
109
|
+
"repeat",
|
|
110
|
+
"repeatDelay",
|
|
111
|
+
"yoyo",
|
|
112
|
+
"id",
|
|
113
|
+
"overwrite",
|
|
114
|
+
"immediateRender"
|
|
115
|
+
]), d = (e) => !u.has(e) && !/^on[A-Z]/.test(e), f = (e) => !!e && typeof e == "object" && !Array.isArray(e), p = /^-?\d*\.?\d+%$/, m = (e) => Number(e.toFixed(3)), h = (e) => JSON.parse(JSON.stringify(e));
|
|
116
|
+
function g(e) {
|
|
117
|
+
if (Array.isArray(e)) return e.length && e.every(f) ? "array" : null;
|
|
118
|
+
if (!f(e)) return null;
|
|
119
|
+
let t = Object.keys(e).filter((e) => e !== "ease" && e !== "easeEach");
|
|
120
|
+
return t.length ? t.every((t) => p.test(t) && f(e[t])) ? "percent" : t.every((t) => Array.isArray(e[t])) ? "values" : null : null;
|
|
121
|
+
}
|
|
122
|
+
function _(e) {
|
|
123
|
+
let t = {};
|
|
124
|
+
for (let [n, r] of Object.entries(e)) d(n) && (t[n] = r);
|
|
125
|
+
return t;
|
|
126
|
+
}
|
|
127
|
+
function v(e, t) {
|
|
128
|
+
let n = 0;
|
|
129
|
+
return e.map((e) => {
|
|
130
|
+
let r = typeof e.duration == "number" ? e.duration : t.defaultDuration, i = typeof e.delay == "number" ? e.delay : 0, a = n + i;
|
|
131
|
+
return n = a + r, {
|
|
132
|
+
start: a,
|
|
133
|
+
end: n,
|
|
134
|
+
duration: r,
|
|
135
|
+
delay: i
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function y(e, t) {
|
|
140
|
+
let n = g(e);
|
|
141
|
+
if (!n) return null;
|
|
142
|
+
let r = [], i = (e) => Object.keys(e).forEach((e) => r.includes(e) || r.push(e)), a = [];
|
|
143
|
+
if (n === "array") {
|
|
144
|
+
let n = e, r = v(n, t), o = r[r.length - 1].end || 1;
|
|
145
|
+
n.forEach((e, t) => {
|
|
146
|
+
let n = _(e);
|
|
147
|
+
i(n), a.push({
|
|
148
|
+
id: String(t),
|
|
149
|
+
t: r[t].end / o,
|
|
150
|
+
props: n,
|
|
151
|
+
..."ease" in e ? { ease: e.ease } : {}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
} else if (n === "percent") {
|
|
155
|
+
let t = e;
|
|
156
|
+
for (let e of Object.keys(t).filter((e) => p.test(e)).sort((e, t) => parseFloat(e) - parseFloat(t))) {
|
|
157
|
+
let n = _(t[e]);
|
|
158
|
+
i(n), a.push({
|
|
159
|
+
id: e,
|
|
160
|
+
t: parseFloat(e) / 100,
|
|
161
|
+
props: n,
|
|
162
|
+
..."ease" in t[e] ? { ease: t[e].ease } : {}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
let t = e;
|
|
167
|
+
for (let [e, n] of Object.entries(t)) Array.isArray(n) && (i({ [e]: 0 }), n.forEach((t, r) => a.push({
|
|
168
|
+
id: `${e}.${r}`,
|
|
169
|
+
t: n.length > 1 ? r / (n.length - 1) : 0,
|
|
170
|
+
props: { [e]: t }
|
|
171
|
+
})));
|
|
172
|
+
a.sort((e, t) => e.t - t.t);
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
form: n,
|
|
176
|
+
stops: a,
|
|
177
|
+
props: r
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function b(e, t, n) {
|
|
181
|
+
let r = g(e);
|
|
182
|
+
return r === "values" ? "Per-property value arrays are spread evenly; convert to percent keyframes to time them" : r === "array" && Number(t) === e.length - 1 && n.tweenDuration !== void 0 ? "The last keyframe ends with the tween; drag the bar's end to change its duration" : null;
|
|
183
|
+
}
|
|
184
|
+
function x(e, t, n, r) {
|
|
185
|
+
if (b(e, t, r)) return null;
|
|
186
|
+
let i = g(e);
|
|
187
|
+
if (i === "array") {
|
|
188
|
+
let i = h(e), a = Number(t), o = v(i, r), s = n * o[o.length - 1].end, c = o[a + 1], l = s - o[a].end;
|
|
189
|
+
return l = Math.max(l, .01 - o[a].duration), c && (l = Math.min(l, c.duration - .01)), i[a].duration = m(o[a].duration + l), c && (i[a + 1].duration = m(c.duration - l)), i;
|
|
190
|
+
}
|
|
191
|
+
if (i === "percent") {
|
|
192
|
+
let r = e, i = Object.keys(r), a = i.filter((e) => p.test(e)).map((e) => parseFloat(e)).sort((e, t) => e - t), o = parseFloat(t), s = a.indexOf(o), c = s > 0 ? a[s - 1] + .1 : 0, l = s < a.length - 1 ? a[s + 1] - .1 : 100, u = `${Math.round(Math.min(Math.max(n * 100, c), l) * 10) / 10}%`;
|
|
193
|
+
if (u === t) return h(r);
|
|
194
|
+
let d = {};
|
|
195
|
+
for (let e of i) d[e === t ? u : e] = h(r[e]);
|
|
196
|
+
return d;
|
|
197
|
+
}
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
function S(e, t, n, r) {
|
|
201
|
+
let i = g(e);
|
|
202
|
+
if (i === "array") {
|
|
203
|
+
let i = h(e), a = v(i, r), o = t * a[a.length - 1].end, s = a.findIndex((e) => o > e.start + .005 && o < e.end - .005);
|
|
204
|
+
if (s < 0) return null;
|
|
205
|
+
let c = Object.keys(_(i[s])), l = {};
|
|
206
|
+
for (let e of c) e in n && (l[e] = n[e]);
|
|
207
|
+
return "ease" in i[s] && (l.ease = i[s].ease), l.duration = m(o - a[s].start), i[s].duration = m(a[s].end - o), "delay" in i[s] && (l.delay = i[s].delay, delete i[s].delay), i.splice(s, 0, l), {
|
|
208
|
+
value: i,
|
|
209
|
+
id: String(s)
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
if (i === "percent") {
|
|
213
|
+
let i = e, a = Math.round(t * 1e3) / 10, o = `${a}%`;
|
|
214
|
+
if (o in i) return null;
|
|
215
|
+
let s = {}, c = y(e, r).props;
|
|
216
|
+
for (let e of c) e in n && (s[e] = n[e]);
|
|
217
|
+
let l = {}, u = !1;
|
|
218
|
+
for (let e of Object.keys(i)) !u && p.test(e) && parseFloat(e) > a && (l[o] = s, u = !0), l[e] = h(i[e]);
|
|
219
|
+
return u || (l[o] = s), {
|
|
220
|
+
value: l,
|
|
221
|
+
id: o
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
function C(e, t, n) {
|
|
227
|
+
let r = g(e);
|
|
228
|
+
if (r === "array") {
|
|
229
|
+
let r = h(e);
|
|
230
|
+
if (r.length < 2) return null;
|
|
231
|
+
let i = Number(t), a = v(r, n), o = r[i + 1];
|
|
232
|
+
return o && (o.duration = m(a[i + 1].duration + a[i].duration + a[i].delay)), r.splice(i, 1), r;
|
|
233
|
+
}
|
|
234
|
+
if (r === "percent") {
|
|
235
|
+
let n = h(e);
|
|
236
|
+
return Object.keys(n).filter((e) => p.test(e)).length < 2 ? null : (delete n[t], n);
|
|
237
|
+
}
|
|
238
|
+
if (r === "values") {
|
|
239
|
+
let n = h(e), [r, i] = T(t);
|
|
240
|
+
return !Array.isArray(n[r]) || n[r].length < 3 ? null : (n[r].splice(i, 1), n);
|
|
241
|
+
}
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
function w(e, t, n, r) {
|
|
245
|
+
let i = g(e);
|
|
246
|
+
if (i === "array") {
|
|
247
|
+
let i = h(e), a = i[Number(t)];
|
|
248
|
+
return a ? (a[n] = r, i) : null;
|
|
249
|
+
}
|
|
250
|
+
if (i === "percent") {
|
|
251
|
+
let i = h(e);
|
|
252
|
+
return i[t] ? (i[t][n] = r, i) : null;
|
|
253
|
+
}
|
|
254
|
+
if (i === "values") {
|
|
255
|
+
let i = h(e), [a, o] = T(t);
|
|
256
|
+
return n !== a || !Array.isArray(i[a]) ? null : (i[a][o] = r, i);
|
|
257
|
+
}
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
function T(e) {
|
|
261
|
+
let t = e.lastIndexOf(".");
|
|
262
|
+
return [e.slice(0, t), Number(e.slice(t + 1))];
|
|
263
|
+
}
|
|
264
|
+
// ../runtime/src/scroll.ts
|
|
265
|
+
var E = {
|
|
266
|
+
top: 0,
|
|
267
|
+
left: 0,
|
|
268
|
+
center: .5,
|
|
269
|
+
bottom: 1,
|
|
270
|
+
right: 1
|
|
271
|
+
}, ee = /^(top|center|bottom|left|right|-?\d*\.?\d+)(%|px)?(?:([+-])=(-?\d*\.?\d+)(%|px)?)?$/, te = /^-?\d*\.?\d+$/;
|
|
272
|
+
function D(e) {
|
|
273
|
+
let t = ee.exec(e);
|
|
274
|
+
if (!t) return null;
|
|
275
|
+
let n = t[1] in E ? t[1] : Number(t[1]);
|
|
276
|
+
if (typeof n == "string" && t[2]) return null;
|
|
277
|
+
let r = {
|
|
278
|
+
base: n,
|
|
279
|
+
unit: typeof n == "number" ? t[2] ?? "" : ""
|
|
280
|
+
};
|
|
281
|
+
return t[3] && (r.offset = {
|
|
282
|
+
n: (t[3] === "-" ? -1 : 1) * Number(t[4]),
|
|
283
|
+
unit: t[5] ?? ""
|
|
284
|
+
}), r;
|
|
285
|
+
}
|
|
286
|
+
function ne(e) {
|
|
287
|
+
if (typeof e == "number") return Number.isFinite(e) ? {
|
|
288
|
+
kind: "absolute",
|
|
289
|
+
px: e
|
|
290
|
+
} : null;
|
|
291
|
+
if (typeof e != "string") return null;
|
|
292
|
+
let t = e.trim();
|
|
293
|
+
if (te.test(t)) return {
|
|
294
|
+
kind: "absolute",
|
|
295
|
+
px: Number(t)
|
|
296
|
+
};
|
|
297
|
+
if (t.startsWith("+=")) {
|
|
298
|
+
let e = /^\+=(-?\d*\.?\d+)(%|px)?$/.exec(t);
|
|
299
|
+
return e ? {
|
|
300
|
+
kind: "relative",
|
|
301
|
+
n: Number(e[1]),
|
|
302
|
+
unit: e[2] ?? ""
|
|
303
|
+
} : null;
|
|
304
|
+
}
|
|
305
|
+
let n = !1, r = /^clamp\((.*)\)$/.exec(t);
|
|
306
|
+
r && (n = !0, t = r[1].trim());
|
|
307
|
+
let i = t.split(/\s+/);
|
|
308
|
+
if (i.length > 2 || !i[0]) return null;
|
|
309
|
+
let a = D(i[0]), o = i[1] === void 0 ? void 0 : D(i[1]);
|
|
310
|
+
return !a || o === null ? null : {
|
|
311
|
+
kind: "pair",
|
|
312
|
+
el: a,
|
|
313
|
+
...o ? { vp: o } : {},
|
|
314
|
+
clamp: n
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
var O = (e) => String(Math.round(e * 100) / 100);
|
|
318
|
+
function k(e) {
|
|
319
|
+
let t = typeof e.base == "string" ? e.base : `${O(e.base)}${e.unit}`;
|
|
320
|
+
return !e.offset || e.offset.n === 0 ? t : `${t}${e.offset.n < 0 ? "-" : "+"}=${O(Math.abs(e.offset.n))}${e.offset.unit}`;
|
|
321
|
+
}
|
|
322
|
+
function A(e) {
|
|
323
|
+
if (e.kind === "absolute") return Math.round(e.px);
|
|
324
|
+
if (e.kind === "relative") return `+=${O(e.n)}${e.unit}`;
|
|
325
|
+
let t = e.vp ? `${k(e.el)} ${k(e.vp)}` : k(e.el);
|
|
326
|
+
return e.clamp ? `clamp(${t})` : t;
|
|
327
|
+
}
|
|
328
|
+
var j = (e, t, n) => t === "%" ? e * n / 100 : e;
|
|
329
|
+
function M(e, t) {
|
|
330
|
+
return (typeof e.base == "string" ? E[e.base] * t : j(e.base, e.unit, t)) + (e.offset ? j(e.offset.n, e.offset.unit, t) : 0);
|
|
331
|
+
}
|
|
332
|
+
function N(e, t, n = 0) {
|
|
333
|
+
if (e.kind === "absolute") return e.px;
|
|
334
|
+
if (e.kind === "relative") return n + j(e.n, e.unit, t.vpSize);
|
|
335
|
+
let r = t.elStart + M(e.el, t.elSize) - (e.vp ? M(e.vp, t.vpSize) : 0);
|
|
336
|
+
return e.clamp ? Math.min(Math.max(r, 0), t.max ?? 1e400) : r;
|
|
337
|
+
}
|
|
338
|
+
function P(e, t, n, r = "y") {
|
|
339
|
+
if (e.offset) {
|
|
340
|
+
let r = t - M({
|
|
341
|
+
base: e.base,
|
|
342
|
+
unit: e.unit
|
|
343
|
+
}, n), i = e.offset.unit === "%" ? r / (n || 1) * 100 : r;
|
|
344
|
+
return {
|
|
345
|
+
...e,
|
|
346
|
+
offset: {
|
|
347
|
+
n: Math.round(i),
|
|
348
|
+
unit: e.offset.unit
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
if (typeof e.base == "string" || e.unit === "%") {
|
|
353
|
+
let i = n ? t / n : 0;
|
|
354
|
+
if (typeof e.base == "string") {
|
|
355
|
+
let t = (e.base === "left" || e.base === "right" || e.base === "center" && r === "x" ? [
|
|
356
|
+
"left",
|
|
357
|
+
"center",
|
|
358
|
+
"right"
|
|
359
|
+
] : [
|
|
360
|
+
"top",
|
|
361
|
+
"center",
|
|
362
|
+
"bottom"
|
|
363
|
+
]).find((e) => Math.abs(E[e] - i) < .02);
|
|
364
|
+
if (t) return {
|
|
365
|
+
base: t,
|
|
366
|
+
unit: ""
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
return {
|
|
370
|
+
base: Math.round(i * 100),
|
|
371
|
+
unit: "%"
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
base: Math.round(t),
|
|
376
|
+
unit: e.unit
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function re(e, t) {
|
|
380
|
+
return e === "start" ? t ? "top top" : "top bottom" : "bottom top";
|
|
381
|
+
}
|
|
382
|
+
// ../runtime/src/plugins.ts
|
|
383
|
+
var F = {
|
|
384
|
+
motionPath: {
|
|
385
|
+
key: "motionPath",
|
|
386
|
+
plugin: "MotionPathPlugin",
|
|
387
|
+
title: "MotionPath",
|
|
388
|
+
level: "edit",
|
|
389
|
+
main: "path",
|
|
390
|
+
fields: [
|
|
391
|
+
{
|
|
392
|
+
key: "path",
|
|
393
|
+
hint: "Points, SVG path data, or a <path> element"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
key: "align",
|
|
397
|
+
hint: "Moves the path onto an element (usually the <path> itself)"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
key: "alignOrigin",
|
|
401
|
+
default: void 0,
|
|
402
|
+
hint: "The point of the target that rides the path, e.g. [0.5, 0.5]"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
key: "autoRotate",
|
|
406
|
+
default: !1,
|
|
407
|
+
hint: "Turn with the path (true, or an offset in degrees)"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
key: "start",
|
|
411
|
+
default: 0,
|
|
412
|
+
hint: "Where on the path the motion starts (0 to 1)"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
key: "end",
|
|
416
|
+
default: 1,
|
|
417
|
+
hint: "Where it ends (0 to 1; more than 1 laps a closed path)"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
key: "curviness",
|
|
421
|
+
default: 1,
|
|
422
|
+
hint: "How round the curve through points is (0 = straight lines)"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
key: "offsetX",
|
|
426
|
+
default: 0
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
key: "offsetY",
|
|
430
|
+
default: 0
|
|
431
|
+
}
|
|
432
|
+
]
|
|
433
|
+
},
|
|
434
|
+
morphSVG: {
|
|
435
|
+
key: "morphSVG",
|
|
436
|
+
plugin: "MorphSVGPlugin",
|
|
437
|
+
title: "MorphSVG",
|
|
438
|
+
level: "edit",
|
|
439
|
+
main: "shape",
|
|
440
|
+
fields: [
|
|
441
|
+
{
|
|
442
|
+
key: "shape",
|
|
443
|
+
hint: "The shape to morph into: a selector, an element or path data"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
key: "type",
|
|
447
|
+
default: "linear",
|
|
448
|
+
options: ["linear", "rotational"]
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
key: "shapeIndex",
|
|
452
|
+
default: "auto",
|
|
453
|
+
hint: "Which point of the start shape maps to the end shape's first point"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
key: "map",
|
|
457
|
+
default: "size",
|
|
458
|
+
options: [
|
|
459
|
+
"size",
|
|
460
|
+
"position",
|
|
461
|
+
"complexity"
|
|
462
|
+
]
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
key: "origin",
|
|
466
|
+
default: "50% 50%",
|
|
467
|
+
hint: "Rotational morphs turn around this point"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
key: "precision",
|
|
471
|
+
default: 2
|
|
472
|
+
}
|
|
473
|
+
],
|
|
474
|
+
note: "The shapes themselves live in your SVG markup; the editor edits how the morph runs."
|
|
475
|
+
},
|
|
476
|
+
text: {
|
|
477
|
+
key: "text",
|
|
478
|
+
plugin: "TextPlugin",
|
|
479
|
+
title: "Text",
|
|
480
|
+
level: "edit",
|
|
481
|
+
main: "value",
|
|
482
|
+
fields: [
|
|
483
|
+
{
|
|
484
|
+
key: "value",
|
|
485
|
+
hint: "The text it types out"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
key: "delimiter",
|
|
489
|
+
default: "",
|
|
490
|
+
hint: "Split by characters (\"\") or words (\" \")"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
key: "speed",
|
|
494
|
+
hint: "Sets the duration from the text's length (1 to 20)"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
key: "type",
|
|
498
|
+
default: "",
|
|
499
|
+
options: ["", "diff"],
|
|
500
|
+
hint: "diff: only the characters that differ change"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
key: "newClass",
|
|
504
|
+
hint: "A class for the new text"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
key: "oldClass",
|
|
508
|
+
hint: "A class for the old text"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
key: "padSpace",
|
|
512
|
+
default: !1
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
key: "rtl",
|
|
516
|
+
default: !1
|
|
517
|
+
}
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
scrambleText: {
|
|
521
|
+
key: "scrambleText",
|
|
522
|
+
plugin: "ScrambleTextPlugin",
|
|
523
|
+
title: "ScrambleText",
|
|
524
|
+
level: "edit",
|
|
525
|
+
main: "text",
|
|
526
|
+
fields: [
|
|
527
|
+
{
|
|
528
|
+
key: "text",
|
|
529
|
+
hint: "The text it settles on"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
key: "chars",
|
|
533
|
+
default: "upperCase",
|
|
534
|
+
options: [
|
|
535
|
+
"upperCase",
|
|
536
|
+
"lowerCase",
|
|
537
|
+
"upperAndLowerCase"
|
|
538
|
+
],
|
|
539
|
+
hint: "Characters to scramble with (or your own string)"
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
key: "revealDelay",
|
|
543
|
+
default: 0,
|
|
544
|
+
hint: "Seconds of pure scramble before the text shows"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
key: "speed",
|
|
548
|
+
default: 1,
|
|
549
|
+
hint: "How often the scramble changes"
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
key: "delimiter",
|
|
553
|
+
default: ""
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
key: "tweenLength",
|
|
557
|
+
default: !0
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
key: "rightToLeft",
|
|
561
|
+
default: !1
|
|
562
|
+
},
|
|
563
|
+
{ key: "newClass" },
|
|
564
|
+
{ key: "oldClass" }
|
|
565
|
+
]
|
|
566
|
+
},
|
|
567
|
+
physics2D: {
|
|
568
|
+
key: "physics2D",
|
|
569
|
+
plugin: "Physics2DPlugin",
|
|
570
|
+
title: "Physics2D",
|
|
571
|
+
level: "inspect",
|
|
572
|
+
fields: [
|
|
573
|
+
{ key: "velocity" },
|
|
574
|
+
{ key: "angle" },
|
|
575
|
+
{ key: "acceleration" },
|
|
576
|
+
{ key: "accelerationAngle" },
|
|
577
|
+
{ key: "gravity" },
|
|
578
|
+
{ key: "friction" }
|
|
579
|
+
],
|
|
580
|
+
note: "Physics settings are shown read-only. The motion scrubs (GSAP replays it from the start), so edit the values in code."
|
|
581
|
+
},
|
|
582
|
+
physicsProps: {
|
|
583
|
+
key: "physicsProps",
|
|
584
|
+
plugin: "PhysicsPropsPlugin",
|
|
585
|
+
title: "PhysicsProps",
|
|
586
|
+
level: "inspect",
|
|
587
|
+
fields: [],
|
|
588
|
+
note: "Physics settings are shown read-only. The motion scrubs (GSAP replays it from the start), so edit the values in code."
|
|
589
|
+
},
|
|
590
|
+
pixi: {
|
|
591
|
+
key: "pixi",
|
|
592
|
+
plugin: "PixiPlugin",
|
|
593
|
+
title: "Pixi",
|
|
594
|
+
level: "inspect",
|
|
595
|
+
fields: [],
|
|
596
|
+
note: "Pixi properties are shown read-only."
|
|
597
|
+
},
|
|
598
|
+
easel: {
|
|
599
|
+
key: "easel",
|
|
600
|
+
plugin: "EaselPlugin",
|
|
601
|
+
title: "Easel",
|
|
602
|
+
level: "inspect",
|
|
603
|
+
fields: [],
|
|
604
|
+
note: "EaselJS properties are shown read-only."
|
|
605
|
+
},
|
|
606
|
+
inertia: {
|
|
607
|
+
key: "inertia",
|
|
608
|
+
plugin: "InertiaPlugin",
|
|
609
|
+
title: "Inertia",
|
|
610
|
+
level: "live",
|
|
611
|
+
fields: [],
|
|
612
|
+
note: "Inertia follows the velocity the page tracked (a flick or a drag), so it plays live when the page runs it."
|
|
613
|
+
}
|
|
614
|
+
}, I = "drawSVG";
|
|
615
|
+
function L(e) {
|
|
616
|
+
if (typeof e != "function") return null;
|
|
617
|
+
let t = e;
|
|
618
|
+
return typeof t.getState == "function" && typeof t.from == "function" && typeof t.fit == "function" ? "Flip" : typeof t.create == "function" && typeof t.hitTest == "function" && typeof t.get == "function" ? "Draggable" : typeof t.create == "function" && t.prototype && typeof t.prototype.split == "function" && typeof t.prototype.revert == "function" ? "SplitText" : typeof t.create == "function" && typeof t.getAll == "function" && typeof t.getById == "function" && typeof t.refresh != "function" ? "Observer" : null;
|
|
619
|
+
}
|
|
620
|
+
var R = /^(-?\d*\.?\d+(?:e-?\d+)?)(%|px)?$/i;
|
|
621
|
+
function ie(e) {
|
|
622
|
+
if (typeof e != "string") return null;
|
|
623
|
+
let t = e.trim(), n = /\s+live$/i.test(t);
|
|
624
|
+
n && (t = t.replace(/\s+live$/i, ""));
|
|
625
|
+
let r = t.split(/\s+/);
|
|
626
|
+
if (!r.length || r.length > 2) return null;
|
|
627
|
+
let i = r.map((e) => R.exec(e));
|
|
628
|
+
if (i.some((e) => !e)) return null;
|
|
629
|
+
let a = (e) => ({
|
|
630
|
+
n: Number(e[1]),
|
|
631
|
+
unit: e[2] ?? ""
|
|
632
|
+
});
|
|
633
|
+
return i.length === 1 ? {
|
|
634
|
+
start: {
|
|
635
|
+
n: 0,
|
|
636
|
+
unit: i[0][2] ?? ""
|
|
637
|
+
},
|
|
638
|
+
end: a(i[0]),
|
|
639
|
+
single: !0,
|
|
640
|
+
live: n
|
|
641
|
+
} : {
|
|
642
|
+
start: a(i[0]),
|
|
643
|
+
end: a(i[1]),
|
|
644
|
+
single: !1,
|
|
645
|
+
live: n
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
function ae(e) {
|
|
649
|
+
let t = (e) => String(Number(e.toFixed(2))), n = `${t(e.end.n)}${e.end.unit}`, r = e.single && e.start.n === 0 ? n : `${t(e.start.n)}${e.start.unit} ${n}`;
|
|
650
|
+
return e.live ? `${r} live` : r;
|
|
651
|
+
}
|
|
652
|
+
// ../runtime/src/index.ts
|
|
653
|
+
var z = /* @__PURE__ */ new Set([
|
|
654
|
+
"attr",
|
|
655
|
+
"css",
|
|
656
|
+
"defaults"
|
|
657
|
+
]), oe = /* @__PURE__ */ new Set([
|
|
658
|
+
"to",
|
|
659
|
+
"from",
|
|
660
|
+
"fromTo",
|
|
661
|
+
"set"
|
|
662
|
+
]), se = /* @__PURE__ */ new Set([
|
|
663
|
+
"add",
|
|
664
|
+
"addLabel",
|
|
665
|
+
"call",
|
|
666
|
+
"addPause"
|
|
667
|
+
]), B = [
|
|
668
|
+
"to",
|
|
669
|
+
"from",
|
|
670
|
+
"fromTo",
|
|
671
|
+
"set",
|
|
672
|
+
"add",
|
|
673
|
+
"addLabel",
|
|
674
|
+
"call",
|
|
675
|
+
"addPause",
|
|
676
|
+
"remove",
|
|
677
|
+
"removeLabel",
|
|
678
|
+
"removePause",
|
|
679
|
+
"shiftChildren"
|
|
680
|
+
], V = 1e8;
|
|
681
|
+
function H(e, t) {
|
|
682
|
+
if (e.length !== t.length) return !1;
|
|
683
|
+
let n = (e) => `${e.site}|${e.role}|${e.key}|${e.mode ?? ""}|${String(e.value)}`, r = new Set(e.map(n));
|
|
684
|
+
return t.every((e) => r.has(n(e)));
|
|
685
|
+
}
|
|
686
|
+
function U(e) {
|
|
687
|
+
let t = globalThis.__DOPESHEET_SERVER__;
|
|
688
|
+
return typeof t == "string" && t ? t.replace(/\/$/, "") + e : e;
|
|
689
|
+
}
|
|
690
|
+
function W(e) {
|
|
691
|
+
try {
|
|
692
|
+
return JSON.parse(String(e));
|
|
693
|
+
} catch {
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
var G = (e) => !!e && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype;
|
|
698
|
+
function K(e) {
|
|
699
|
+
let t = { ...e ?? {} };
|
|
700
|
+
return G(t.scrollTrigger) && (t.scrollTrigger = { ...t.scrollTrigger }), t;
|
|
701
|
+
}
|
|
702
|
+
function q(e) {
|
|
703
|
+
return G(e) ? JSON.stringify(e, (e, t) => typeof t == "function" ? `fn:${String(t)}` : t && typeof t == "object" && t.nodeType ? "node" : t) : String(e);
|
|
704
|
+
}
|
|
705
|
+
function ce(e) {
|
|
706
|
+
let t = e?.split("\n").filter((e) => /:\d+:\d+\)?\s*$/.test(e))[1], n = t && /([^/\\\s()@]+?)(?:\?[^:\s()]*)?:(\d+):\d+\)?\s*$/.exec(t);
|
|
707
|
+
return n ? `${n[1]}:${n[2]}` : void 0;
|
|
708
|
+
}
|
|
709
|
+
function J(e) {
|
|
710
|
+
if (!e || typeof e != "object") return String(e);
|
|
711
|
+
if (e.window === e) return "window";
|
|
712
|
+
let t = e;
|
|
713
|
+
if (t.nodeType === 9) return "document";
|
|
714
|
+
if (t.nodeType !== 1) return "object";
|
|
715
|
+
let n = typeof t.className == "string" ? t.className.trim().split(/\s+/).filter(Boolean).slice(0, 2) : [];
|
|
716
|
+
return `${t.tagName.toLowerCase()}${t.id ? `#${t.id}` : ""}${n.map((e) => `.${e}`).join("")}`;
|
|
717
|
+
}
|
|
718
|
+
function Y(e) {
|
|
719
|
+
let t = e.indexOf(".");
|
|
720
|
+
return t > 0 ? [e.slice(0, t), e.slice(t + 1)] : null;
|
|
721
|
+
}
|
|
722
|
+
var le = "dopesheet:edits:", X = 200, ue = 800, Z = (e, t, n) => `${e}|${t}|${n}`, de = /* @__PURE__ */ new Set([
|
|
723
|
+
"cursor",
|
|
724
|
+
"userSelect",
|
|
725
|
+
"touchAction",
|
|
726
|
+
"lazy",
|
|
727
|
+
"clearProps",
|
|
728
|
+
"transformOrigin"
|
|
729
|
+
]), Q = /* @__PURE__ */ new Set([
|
|
730
|
+
"duration",
|
|
731
|
+
"delay",
|
|
732
|
+
"ease",
|
|
733
|
+
"repeat",
|
|
734
|
+
"repeatDelay",
|
|
735
|
+
"repeatRefresh",
|
|
736
|
+
"yoyo",
|
|
737
|
+
"yoyoEase",
|
|
738
|
+
"stagger",
|
|
739
|
+
"id",
|
|
740
|
+
"paused",
|
|
741
|
+
"overwrite",
|
|
742
|
+
"immediateRender",
|
|
743
|
+
"lazy",
|
|
744
|
+
"inherit",
|
|
745
|
+
"data",
|
|
746
|
+
"callbackScope",
|
|
747
|
+
"runBackwards",
|
|
748
|
+
"startAt",
|
|
749
|
+
"keyframes",
|
|
750
|
+
"easeEach",
|
|
751
|
+
"reversed",
|
|
752
|
+
"onStart",
|
|
753
|
+
"onUpdate",
|
|
754
|
+
"onComplete",
|
|
755
|
+
"onRepeat",
|
|
756
|
+
"onReverseComplete",
|
|
757
|
+
"onInterrupt",
|
|
758
|
+
"onStartParams",
|
|
759
|
+
"onUpdateParams",
|
|
760
|
+
"onCompleteParams",
|
|
761
|
+
"onRepeatParams",
|
|
762
|
+
"onReverseCompleteParams",
|
|
763
|
+
"scrollTrigger",
|
|
764
|
+
"defaults",
|
|
765
|
+
"smoothChildTiming",
|
|
766
|
+
"autoRemoveChildren",
|
|
767
|
+
"parent",
|
|
768
|
+
"clearProps",
|
|
769
|
+
e
|
|
770
|
+
]), $ = class {
|
|
771
|
+
gsap;
|
|
772
|
+
original;
|
|
773
|
+
proto = {};
|
|
774
|
+
tags = /* @__PURE__ */ new WeakMap();
|
|
775
|
+
timelines = /* @__PURE__ */ new WeakMap();
|
|
776
|
+
editorPaused = /* @__PURE__ */ new WeakSet();
|
|
777
|
+
media = [];
|
|
778
|
+
branch;
|
|
779
|
+
effectFns = /* @__PURE__ */ new Map();
|
|
780
|
+
effectDefaults = /* @__PURE__ */ new Map();
|
|
781
|
+
byAnim = /* @__PURE__ */ new WeakMap();
|
|
782
|
+
listeners = {
|
|
783
|
+
change: /* @__PURE__ */ new Set(),
|
|
784
|
+
time: /* @__PURE__ */ new Set()
|
|
785
|
+
};
|
|
786
|
+
pendingMark;
|
|
787
|
+
sites = /* @__PURE__ */ new Map();
|
|
788
|
+
markers = /* @__PURE__ */ new Map();
|
|
789
|
+
edits = /* @__PURE__ */ new Map();
|
|
790
|
+
saveErrors = /* @__PURE__ */ new Map();
|
|
791
|
+
saveState = { status: "idle" };
|
|
792
|
+
versions = [];
|
|
793
|
+
activeVersion = null;
|
|
794
|
+
stats = {
|
|
795
|
+
rebuildMs: 0,
|
|
796
|
+
saveMs: 0,
|
|
797
|
+
rebuilds: 0
|
|
798
|
+
};
|
|
799
|
+
notice = null;
|
|
800
|
+
undoStack = [];
|
|
801
|
+
redoStack = [];
|
|
802
|
+
groupDepth = 0;
|
|
803
|
+
lastChange = null;
|
|
804
|
+
restored = [];
|
|
805
|
+
checkedFiles = /* @__PURE__ */ new Set();
|
|
806
|
+
storeKey = le + (typeof location < "u" ? location.pathname : "/");
|
|
807
|
+
persistTimer;
|
|
808
|
+
active = !1;
|
|
809
|
+
time = 0;
|
|
810
|
+
playing = !1;
|
|
811
|
+
loop = !0;
|
|
812
|
+
speed = 1;
|
|
813
|
+
fireCallbacks = !1;
|
|
814
|
+
tick = 0;
|
|
815
|
+
tickOpen = !1;
|
|
816
|
+
internal = !1;
|
|
817
|
+
creating;
|
|
818
|
+
overwritten = /* @__PURE__ */ new Map();
|
|
819
|
+
anonCount = 0;
|
|
820
|
+
order = 0;
|
|
821
|
+
seq = 0;
|
|
822
|
+
raf = 0;
|
|
823
|
+
lastFrame = 0;
|
|
824
|
+
detachedSt = /* @__PURE__ */ new Set();
|
|
825
|
+
scrollLive = !1;
|
|
826
|
+
hooked = /* @__PURE__ */ new WeakSet();
|
|
827
|
+
pluginClasses = {};
|
|
828
|
+
draggables = [];
|
|
829
|
+
splitPieces = /* @__PURE__ */ new WeakMap();
|
|
830
|
+
constructor(e) {
|
|
831
|
+
this.gsap = e, this.original = {
|
|
832
|
+
to: e.to,
|
|
833
|
+
from: e.from,
|
|
834
|
+
fromTo: e.fromTo,
|
|
835
|
+
set: e.set,
|
|
836
|
+
timeline: e.timeline
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
install() {
|
|
840
|
+
this.loadPersisted(), typeof addEventListener == "function" && addEventListener("pagehide", () => this.persistNow());
|
|
841
|
+
let e = globalThis;
|
|
842
|
+
e.__dopesheet = (e, t) => (e && typeof e == "object" && this.tags.set(e, t), e), e.__dopesheetMark = (e, t) => (this.pendingMark = e, queueMicrotask(() => this.pendingMark === e && (this.pendingMark = void 0)), t), e.__DOPESHEET__ = this;
|
|
843
|
+
let t = this, n = this.gsap;
|
|
844
|
+
for (let e of [
|
|
845
|
+
"to",
|
|
846
|
+
"from",
|
|
847
|
+
"set"
|
|
848
|
+
]) {
|
|
849
|
+
let r = this.original[e];
|
|
850
|
+
n[e] = function(n, i) {
|
|
851
|
+
if (t.internal || !i || typeof i != "object") return r(n, i);
|
|
852
|
+
let a = t.tags.get(i);
|
|
853
|
+
if (!a && t.foreign(n, i)) return r(n, i);
|
|
854
|
+
t.beforeCreate(a);
|
|
855
|
+
let o = K(i), s = r(n, i);
|
|
856
|
+
return t.register(e, s, a, void 0, o, void 0), s;
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
let r = this.original.fromTo;
|
|
860
|
+
n.fromTo = function(e, n, i) {
|
|
861
|
+
if (t.internal || !n || !i) return r(e, n, i);
|
|
862
|
+
let a = t.tags.get(i), o = t.tags.get(n);
|
|
863
|
+
if (!a && !o && t.foreign(e, i)) return r(e, n, i);
|
|
864
|
+
t.beforeCreate(a ?? o);
|
|
865
|
+
let s = K(i), c = { ...n }, l = r(e, n, i);
|
|
866
|
+
return t.register("fromTo", l, a, o, s, c), l;
|
|
867
|
+
};
|
|
868
|
+
let i = this.original.timeline;
|
|
869
|
+
n.timeline = function(e) {
|
|
870
|
+
if (t.internal) return i.call(n, e);
|
|
871
|
+
let r = (e && typeof e == "object" ? t.tags.get(e) : void 0) ?? t.consumeMark("timeline");
|
|
872
|
+
t.beforeCreate(r);
|
|
873
|
+
let a = K(e), o = i.call(n, e), s = {
|
|
874
|
+
tl: o,
|
|
875
|
+
log: [],
|
|
876
|
+
busy: !1,
|
|
877
|
+
stSig: a.scrollTrigger === void 0 ? void 0 : q(a.scrollTrigger)
|
|
878
|
+
};
|
|
879
|
+
return t.timelines.set(o, s), t.register("timeline", o, r, void 0, a, void 0, { timeline: s }), o;
|
|
880
|
+
};
|
|
881
|
+
let a = n.globalTimeline, o = a.killTweensOf;
|
|
882
|
+
typeof o == "function" && typeof a.getTweensOf == "function" && (a.killTweensOf = function(e, n, r) {
|
|
883
|
+
if (!t.internal) try {
|
|
884
|
+
for (let i of a.getTweensOf(e, r)) {
|
|
885
|
+
let e = t.findInstance(i);
|
|
886
|
+
if (!e || e.inst.editorMade || e.site.id === t.creating?.id) continue;
|
|
887
|
+
let r = n && typeof n == "object" ? Object.keys(n) : void 0, a = t.overwritten.get(e.site.id);
|
|
888
|
+
t.overwritten.set(e.site.id, {
|
|
889
|
+
by: t.creating?.id ?? a?.by,
|
|
890
|
+
...r ? { props: [.../* @__PURE__ */ new Set([...a?.props ?? [], ...r])] } : {}
|
|
891
|
+
}), t.scheduleChange();
|
|
892
|
+
}
|
|
893
|
+
} catch {}
|
|
894
|
+
return o.call(this, e, n, r);
|
|
895
|
+
});
|
|
896
|
+
let s = 0, c = n.registerPlugin;
|
|
897
|
+
typeof c == "function" && (n.registerPlugin = function(...e) {
|
|
898
|
+
s++;
|
|
899
|
+
try {
|
|
900
|
+
return c.apply(this, e);
|
|
901
|
+
} finally {
|
|
902
|
+
s--, t.hookPlugins(e);
|
|
903
|
+
}
|
|
904
|
+
}), this.hookPlugins(Object.values(n.core.globals?.() ?? {}));
|
|
905
|
+
let l = n, u = l.quickTo;
|
|
906
|
+
typeof u == "function" && (l.quickTo = function(...e) {
|
|
907
|
+
let n = t.internal;
|
|
908
|
+
t.internal = !0;
|
|
909
|
+
try {
|
|
910
|
+
return u.apply(this, e);
|
|
911
|
+
} finally {
|
|
912
|
+
t.internal = n;
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
let d = n.matchMedia;
|
|
916
|
+
if (typeof d == "function") {
|
|
917
|
+
let e = !1, r = 0;
|
|
918
|
+
n.matchMedia = function(i) {
|
|
919
|
+
let a = d.call(n, i);
|
|
920
|
+
if (s) return a.__dsPlugin = !0, a;
|
|
921
|
+
if (a.__dsN = r++, a.__dsBranches = [], !e && a && typeof a.add == "function") {
|
|
922
|
+
e = !0;
|
|
923
|
+
let n = Object.getPrototypeOf(a), r = n.add;
|
|
924
|
+
n.add = function(e, n, i) {
|
|
925
|
+
if (this.__dsPlugin) return r.call(this, e, n, i);
|
|
926
|
+
let a = e && typeof e == "object" ? { ...e } : { matches: String(e) }, o = this.__dsBranches ??= [], s = t.addBranch(a, o.length);
|
|
927
|
+
o.push(s);
|
|
928
|
+
let c = typeof n == "function" ? function(...e) {
|
|
929
|
+
let r = t.branch;
|
|
930
|
+
t.branch = s;
|
|
931
|
+
try {
|
|
932
|
+
return n.apply(this, e);
|
|
933
|
+
} finally {
|
|
934
|
+
t.branch = r, t.scheduleChange();
|
|
935
|
+
}
|
|
936
|
+
} : n;
|
|
937
|
+
return r.call(this, e, c, i);
|
|
938
|
+
};
|
|
939
|
+
for (let e of ["revert", "kill"]) {
|
|
940
|
+
let r = n[e];
|
|
941
|
+
typeof r == "function" && (n[e] = function(...e) {
|
|
942
|
+
let n = r.apply(this, e);
|
|
943
|
+
for (let e of this.__dsBranches ?? []) e.gone = !0;
|
|
944
|
+
return t.scheduleChange(), n;
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
return a;
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
let f = (e) => {
|
|
952
|
+
let r = n.effects?.[e];
|
|
953
|
+
if (typeof r != "function" || r.__ds) return;
|
|
954
|
+
t.effectFns.set(e, r);
|
|
955
|
+
let i = function(n, i, a) {
|
|
956
|
+
if (t.internal) return r(n, i, a);
|
|
957
|
+
let o = (i && typeof i == "object" ? t.tags.get(i) : void 0) ?? t.consumeMark("effect");
|
|
958
|
+
t.beforeCreate(o);
|
|
959
|
+
let s = K(i);
|
|
960
|
+
t.internal = !0;
|
|
961
|
+
let c;
|
|
962
|
+
try {
|
|
963
|
+
c = r(n, i, a);
|
|
964
|
+
} finally {
|
|
965
|
+
t.internal = !1;
|
|
966
|
+
}
|
|
967
|
+
let l = c;
|
|
968
|
+
if (l && typeof l == "object" && typeof l.totalTime == "function") {
|
|
969
|
+
let r = t.toArray(n);
|
|
970
|
+
t.register("effect", l, o, void 0, s, void 0, {
|
|
971
|
+
effect: e,
|
|
972
|
+
targets: r
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
return c;
|
|
976
|
+
};
|
|
977
|
+
i.__ds = !0, n.effects[e] = i;
|
|
978
|
+
};
|
|
979
|
+
if (n.effects) for (let e of Object.keys(n.effects)) f(e);
|
|
980
|
+
let p = n.registerEffect;
|
|
981
|
+
typeof p == "function" && (n.registerEffect = function(e) {
|
|
982
|
+
p.call(n, e), e?.name && (t.effectDefaults.set(e.name, { ...e.defaults ?? {} }), f(e.name));
|
|
983
|
+
});
|
|
984
|
+
for (let e of [n.core.Animation, n.core.Tween]) {
|
|
985
|
+
let n = e?.prototype, r = n?.kill;
|
|
986
|
+
n && typeof r == "function" && !Object.prototype.hasOwnProperty.call(n, "__dsKill") && (n.__dsKill = !0, n.kill = function(...e) {
|
|
987
|
+
let n = !e[0] && (!e[1] || e[1] === "all"), i = r.apply(this, e);
|
|
988
|
+
return n && !t.internal && t.onPageKill(this), i;
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
let m = n.core.Timeline.prototype;
|
|
992
|
+
for (let e of B) {
|
|
993
|
+
let n = m[e];
|
|
994
|
+
typeof n == "function" && (this.proto[e] = n, m[e] = function(...r) {
|
|
995
|
+
let i = t.timelines.get(this);
|
|
996
|
+
if (!i || t.internal || i.busy) return n.apply(this, r);
|
|
997
|
+
i.busy = !0;
|
|
998
|
+
try {
|
|
999
|
+
return t.recordOp(i, e, r, n);
|
|
1000
|
+
} finally {
|
|
1001
|
+
i.busy = !1;
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
return this;
|
|
1006
|
+
}
|
|
1007
|
+
consumeMark(e) {
|
|
1008
|
+
let t = this.pendingMark;
|
|
1009
|
+
return this.pendingMark = void 0, t?.method === e ? t : void 0;
|
|
1010
|
+
}
|
|
1011
|
+
hookPlugins(e) {
|
|
1012
|
+
for (let t of e) {
|
|
1013
|
+
let e = L(t);
|
|
1014
|
+
if (!e || this.hooked.has(t)) continue;
|
|
1015
|
+
this.hooked.add(t);
|
|
1016
|
+
let n = t;
|
|
1017
|
+
this.pluginClasses[e] = n;
|
|
1018
|
+
try {
|
|
1019
|
+
e === "Flip" ? this.hookFlip(n) : e === "Draggable" ? this.hookDraggable(n) : e === "SplitText" && this.hookSplitText(n);
|
|
1020
|
+
} catch {}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
hookFlip(e) {
|
|
1024
|
+
let t = this;
|
|
1025
|
+
for (let n of [
|
|
1026
|
+
"from",
|
|
1027
|
+
"to",
|
|
1028
|
+
"fromTo",
|
|
1029
|
+
"fit"
|
|
1030
|
+
]) {
|
|
1031
|
+
let r = e[n];
|
|
1032
|
+
typeof r == "function" && (e[n] = function(...e) {
|
|
1033
|
+
if (t.internal) return r.apply(this, e);
|
|
1034
|
+
let i = ce((/* @__PURE__ */ Error()).stack);
|
|
1035
|
+
t.internal = !0;
|
|
1036
|
+
let a;
|
|
1037
|
+
try {
|
|
1038
|
+
a = r.apply(this, e);
|
|
1039
|
+
} finally {
|
|
1040
|
+
t.internal = !1;
|
|
1041
|
+
}
|
|
1042
|
+
let o = a;
|
|
1043
|
+
if (o && typeof o == "object" && typeof o.totalTime == "function") {
|
|
1044
|
+
let r = e[n === "fromTo" ? 2 : 1];
|
|
1045
|
+
try {
|
|
1046
|
+
t.register("flip", o, void 0, void 0, G(r) ? { ...r } : {}, void 0, {
|
|
1047
|
+
flip: n,
|
|
1048
|
+
at: i,
|
|
1049
|
+
id: `flip:${n}@${i ?? "page"}`
|
|
1050
|
+
});
|
|
1051
|
+
} catch {}
|
|
1052
|
+
}
|
|
1053
|
+
return a;
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
hookDraggable(e) {
|
|
1058
|
+
let t = this, n = e.create;
|
|
1059
|
+
typeof n == "function" && (e.create = function(e, r) {
|
|
1060
|
+
let i = t.internal;
|
|
1061
|
+
t.internal = !0;
|
|
1062
|
+
let a;
|
|
1063
|
+
try {
|
|
1064
|
+
a = n.call(this, e, r);
|
|
1065
|
+
} finally {
|
|
1066
|
+
t.internal = i;
|
|
1067
|
+
}
|
|
1068
|
+
for (let e of Array.isArray(a) ? a : [a]) e && typeof e == "object" && t.draggables.push({
|
|
1069
|
+
instance: e,
|
|
1070
|
+
target: e.target,
|
|
1071
|
+
vars: G(r) ? { ...r } : {}
|
|
1072
|
+
});
|
|
1073
|
+
return t.scheduleChange(), a;
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
hookSplitText(e) {
|
|
1077
|
+
let t = this, n = e.prototype, r = n.split;
|
|
1078
|
+
typeof r == "function" && (n.split = function(...e) {
|
|
1079
|
+
let n = r.apply(this, e);
|
|
1080
|
+
try {
|
|
1081
|
+
t.noteSplit(this);
|
|
1082
|
+
} catch {}
|
|
1083
|
+
return n;
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
noteSplit(e) {
|
|
1087
|
+
for (let t of [
|
|
1088
|
+
"chars",
|
|
1089
|
+
"words",
|
|
1090
|
+
"lines"
|
|
1091
|
+
]) for (let n of e[t] ?? []) n && typeof n == "object" && this.splitPieces.set(n, {
|
|
1092
|
+
split: e,
|
|
1093
|
+
kind: t
|
|
1094
|
+
});
|
|
1095
|
+
this.scheduleChange();
|
|
1096
|
+
}
|
|
1097
|
+
splitOf(e) {
|
|
1098
|
+
let t = e.instances[0]?.targets ?? [], n = t[0], r = n && typeof n == "object" ? this.splitPieces.get(n) : void 0;
|
|
1099
|
+
if (!r) return null;
|
|
1100
|
+
let { split: i, kind: a } = r, o = i.vars ?? {}, s = !n.isConnected;
|
|
1101
|
+
return {
|
|
1102
|
+
kind: a,
|
|
1103
|
+
count: t.length,
|
|
1104
|
+
total: s ? t.length : i[a]?.length ?? t.length,
|
|
1105
|
+
source: (i.elements ?? []).slice(0, 2).map(J).join(", ") + ((i.elements?.length ?? 0) > 2 ? ` +${i.elements.length - 2}` : ""),
|
|
1106
|
+
type: typeof o.type == "string" ? o.type : "chars,words,lines",
|
|
1107
|
+
autoSplit: !!o.autoSplit,
|
|
1108
|
+
mask: typeof o.mask == "string" ? o.mask : null,
|
|
1109
|
+
stale: s
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
liveTargets(e) {
|
|
1113
|
+
if (!e.length) return e;
|
|
1114
|
+
let t = e[0], n = t && typeof t == "object" ? this.splitPieces.get(t) : void 0;
|
|
1115
|
+
if (!n || t.isConnected !== !1 || !n.split.isSplit || !e.every((e) => e && typeof e == "object" && this.splitPieces.get(e)?.split === n.split && e.isConnected === !1)) return e;
|
|
1116
|
+
let r = n.split[n.kind] ?? [];
|
|
1117
|
+
return r.length ? [...r] : e;
|
|
1118
|
+
}
|
|
1119
|
+
interactives() {
|
|
1120
|
+
let e = [], t = this.pluginClasses.Draggable;
|
|
1121
|
+
for (let n of this.draggables) {
|
|
1122
|
+
try {
|
|
1123
|
+
if (t?.get && t.get(n.target) !== n.instance) continue;
|
|
1124
|
+
} catch {
|
|
1125
|
+
continue;
|
|
1126
|
+
}
|
|
1127
|
+
let r = n.vars, i = [typeof r.type == "string" ? r.type : "x,y"];
|
|
1128
|
+
r.inertia && i.push("inertia"), r.bounds && i.push("bounds"), (r.snap || r.liveSnap) && i.push("snap"), e.push({
|
|
1129
|
+
kind: "Draggable",
|
|
1130
|
+
target: J(n.target),
|
|
1131
|
+
detail: i.join(" · ")
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
let n = this.pluginClasses.Observer;
|
|
1135
|
+
try {
|
|
1136
|
+
for (let t of n?.getAll?.() ?? []) {
|
|
1137
|
+
let n = t.vars ?? {}, r = [typeof n.type == "string" ? n.type : "wheel,touch,pointer"];
|
|
1138
|
+
t.isEnabled === !1 && r.push("disabled"), e.push({
|
|
1139
|
+
kind: "Observer",
|
|
1140
|
+
target: J(t.target ?? n.target),
|
|
1141
|
+
detail: r.join(" · ")
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
} catch {}
|
|
1145
|
+
return e;
|
|
1146
|
+
}
|
|
1147
|
+
pluginSpecs(e) {
|
|
1148
|
+
if (e.method === "timeline" || e.method === "flip") return [];
|
|
1149
|
+
let t = [];
|
|
1150
|
+
for (let n of ["fromVars", "vars"]) {
|
|
1151
|
+
let r = e.meta[n]?.vars, i = (n === "vars" ? e.vars : e.fromVars) ?? {};
|
|
1152
|
+
for (let e of [...r?.order ?? [], ...Object.keys(i)]) F[e] && !t.includes(e) && t.push(e);
|
|
1153
|
+
}
|
|
1154
|
+
return t.map((e) => F[e]);
|
|
1155
|
+
}
|
|
1156
|
+
pluginMissing(e) {
|
|
1157
|
+
let t = this.gsap.plugins;
|
|
1158
|
+
return !!F[e] && !!t && !t[e];
|
|
1159
|
+
}
|
|
1160
|
+
motionPath(e) {
|
|
1161
|
+
if (e.method === "timeline" || e.method === "effect" || e.method === "flip") return null;
|
|
1162
|
+
let t = e.instances[0], n = this.effectiveVars(e, "vars")?.motionPath;
|
|
1163
|
+
if (!t || n == null) return null;
|
|
1164
|
+
let r = G(n) && !("style" in n), i = r ? "motionPath.path" : "motionPath", a = r ? n.path : n, o = r ? n : {}, s = this.sampleTrail(t), c = e.anonymous ? "This call wasn't tagged by the build transform" : this.structuredBlocker(e, "vars", i), l, u = [], d;
|
|
1165
|
+
if (Array.isArray(a) && (a.length === 0 || typeof a[0] == "object")) l = "points", u = a.map((e) => ({
|
|
1166
|
+
x: Number(e?.x) || 0,
|
|
1167
|
+
y: Number(e?.y) || 0
|
|
1168
|
+
})), d = `${a.length} point${a.length === 1 ? "" : "s"}`, a.some((e) => !G(e) || !("x" in e) || !("y" in e)) && (c ??= "Only points written as { x, y } can be dragged"), o.relative && (c ??= "Points are relative (relative: true); edit them in the inspector");
|
|
1169
|
+
else if (typeof a == "string" && /^\s*m/i.test(a)) {
|
|
1170
|
+
l = "data", d = "SVG path data";
|
|
1171
|
+
let e = this.pathAnchors(a);
|
|
1172
|
+
u = e ?? [], e || (c ??= "MotionPathPlugin isn't registered on the page");
|
|
1173
|
+
} else l = "element", d = typeof a == "string" ? a : J(a), c = "The path is an element in your SVG markup: edit it there";
|
|
1174
|
+
if (l !== "element" && o.align && o.align !== "self" && (c ??= `The path is aligned to ${String(o.align)}, so its points sit somewhere else`), l !== "element" && (o.align === "self" || typeof o.offsetX == "number" || typeof o.offsetY == "number")) {
|
|
1175
|
+
let e = this.pathOffset(l, u, s, o);
|
|
1176
|
+
e ? u = u.map((t) => ({
|
|
1177
|
+
x: t.x + e.x,
|
|
1178
|
+
y: t.y + e.y
|
|
1179
|
+
})) : c ??= "This path is shifted (align: \"self\" with a start other than 0)";
|
|
1180
|
+
}
|
|
1181
|
+
return {
|
|
1182
|
+
key: i,
|
|
1183
|
+
form: l,
|
|
1184
|
+
points: u,
|
|
1185
|
+
trail: s,
|
|
1186
|
+
blocker: c,
|
|
1187
|
+
source: d
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
pathOffset(e, t, n, r) {
|
|
1191
|
+
let i = Number(r.offsetX) || 0, a = Number(r.offsetY) || 0;
|
|
1192
|
+
if (r.align === "self") {
|
|
1193
|
+
let o = Number(r.start ?? 0);
|
|
1194
|
+
if (e !== "data" || o !== 0 || !t.length || !n.length) return null;
|
|
1195
|
+
i = n[0].x - t[0].x, a = n[0].y - t[0].y;
|
|
1196
|
+
}
|
|
1197
|
+
return {
|
|
1198
|
+
x: i,
|
|
1199
|
+
y: a
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
pathAnchors(e) {
|
|
1203
|
+
let t = this.motionPlugin();
|
|
1204
|
+
if (!t?.stringToRawPath) return null;
|
|
1205
|
+
let n = [];
|
|
1206
|
+
for (let r of t.stringToRawPath(e)) for (let e = 0; e + 1 < r.length; e += 6) n.push({
|
|
1207
|
+
x: r[e],
|
|
1208
|
+
y: r[e + 1]
|
|
1209
|
+
});
|
|
1210
|
+
return n;
|
|
1211
|
+
}
|
|
1212
|
+
motionPlugin() {
|
|
1213
|
+
return this.gsap.core.globals?.().MotionPathPlugin;
|
|
1214
|
+
}
|
|
1215
|
+
sampleTrail(e, t = 72) {
|
|
1216
|
+
let n = e.tween, r = e.targets[0];
|
|
1217
|
+
if (!r || typeof r != "object") return [];
|
|
1218
|
+
let i = n.duration(), a = n.totalTime(), o = [], s = this.internal;
|
|
1219
|
+
this.internal = !0;
|
|
1220
|
+
try {
|
|
1221
|
+
for (let e = 0; e <= t; e++) n.totalTime(i * e / t, !0), o.push({
|
|
1222
|
+
x: Number(this.gsap.getProperty(r, "x")) || 0,
|
|
1223
|
+
y: Number(this.gsap.getProperty(r, "y")) || 0
|
|
1224
|
+
});
|
|
1225
|
+
} catch {
|
|
1226
|
+
return [];
|
|
1227
|
+
} finally {
|
|
1228
|
+
try {
|
|
1229
|
+
n.totalTime(a, !0);
|
|
1230
|
+
} catch {}
|
|
1231
|
+
this.internal = s;
|
|
1232
|
+
}
|
|
1233
|
+
return o;
|
|
1234
|
+
}
|
|
1235
|
+
moveMotionPoint(e, t, n, r) {
|
|
1236
|
+
let i = this.sites.get(e), a = i && this.motionPath(i);
|
|
1237
|
+
if (!i || !a || a.blocker || !a.points[t]) return !1;
|
|
1238
|
+
let o = {
|
|
1239
|
+
x: a.points[t].x,
|
|
1240
|
+
y: a.points[t].y
|
|
1241
|
+
}, s = Math.round(n) - o.x, c = Math.round(r) - o.y;
|
|
1242
|
+
if (!s && !c) return !0;
|
|
1243
|
+
let l = this.structured(i, "vars", a.key);
|
|
1244
|
+
if (a.form === "points" && Array.isArray(l)) {
|
|
1245
|
+
let n = l.map((e, n) => n === t ? {
|
|
1246
|
+
...e,
|
|
1247
|
+
x: Number(e.x) + s,
|
|
1248
|
+
y: Number(e.y) + c
|
|
1249
|
+
} : e);
|
|
1250
|
+
return this.setStructured(e, "vars", a.key, n), !0;
|
|
1251
|
+
}
|
|
1252
|
+
if (a.form === "data" && typeof l == "string") {
|
|
1253
|
+
let n = this.motionPlugin();
|
|
1254
|
+
if (!n?.stringToRawPath || !n.rawPathToString) return !1;
|
|
1255
|
+
let r = n.stringToRawPath(l), i = 0;
|
|
1256
|
+
for (let e of r) for (let n = 0; n + 1 < e.length; n += 6, i++) if (i === t) for (let t of [
|
|
1257
|
+
n - 2,
|
|
1258
|
+
n,
|
|
1259
|
+
n + 2
|
|
1260
|
+
]) t < 0 || t + 1 >= e.length || (e[t] = Math.round((e[t] + s) * 100) / 100, e[t + 1] = Math.round((e[t + 1] + c) * 100) / 100);
|
|
1261
|
+
return this.setValue(e, "vars", a.key, n.rawPathToString(r).trim()), !0;
|
|
1262
|
+
}
|
|
1263
|
+
return !1;
|
|
1264
|
+
}
|
|
1265
|
+
addMotionPoint(e, t, n, r) {
|
|
1266
|
+
let i = this.sites.get(e), a = i && this.motionPath(i), o = i && a ? this.structured(i, "vars", a.key) : void 0;
|
|
1267
|
+
if (!i || !a || a.blocker || a.form !== "points" || !Array.isArray(o)) return !1;
|
|
1268
|
+
let s = [...o];
|
|
1269
|
+
return s.splice(Math.max(0, Math.min(t, s.length)), 0, {
|
|
1270
|
+
x: Math.round(n),
|
|
1271
|
+
y: Math.round(r)
|
|
1272
|
+
}), this.setStructured(e, "vars", a.key, s), !0;
|
|
1273
|
+
}
|
|
1274
|
+
removeMotionPoint(e, t) {
|
|
1275
|
+
let n = this.sites.get(e), r = n && this.motionPath(n), i = n && r ? this.structured(n, "vars", r.key) : void 0;
|
|
1276
|
+
return !n || !r || r.blocker || r.form !== "points" || !Array.isArray(i) || i.length <= 1 || !i[t] ? !1 : (this.setStructured(e, "vars", r.key, i.filter((e, n) => n !== t)), !0);
|
|
1277
|
+
}
|
|
1278
|
+
on(e, t) {
|
|
1279
|
+
return this.listeners[e].add(t), () => this.listeners[e].delete(t);
|
|
1280
|
+
}
|
|
1281
|
+
emit(e) {
|
|
1282
|
+
for (let t of this.listeners[e]) t();
|
|
1283
|
+
}
|
|
1284
|
+
currentTick() {
|
|
1285
|
+
return this.tickOpen || (this.tickOpen = !0, this.tick++, queueMicrotask(() => this.tickOpen = !1)), this.tick;
|
|
1286
|
+
}
|
|
1287
|
+
beforeCreate(e) {
|
|
1288
|
+
if (this.creating = e, !e) return;
|
|
1289
|
+
let t = this.sites.get(e.id);
|
|
1290
|
+
if (t && t.tick !== this.currentTick()) {
|
|
1291
|
+
this.internal = !0;
|
|
1292
|
+
try {
|
|
1293
|
+
for (let e of t.instances) e.editorMade && !e.entry && e.tween.revert();
|
|
1294
|
+
} finally {
|
|
1295
|
+
this.internal = !1;
|
|
1296
|
+
}
|
|
1297
|
+
t.instances = [];
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
onPageKill(e) {
|
|
1301
|
+
let t = this.byAnim.get(e);
|
|
1302
|
+
if (!t || t.inst.dead) return;
|
|
1303
|
+
let { inst: n } = t;
|
|
1304
|
+
if (n.entry || n.timeline?.addedBy) return;
|
|
1305
|
+
this.internal = !0;
|
|
1306
|
+
try {
|
|
1307
|
+
n.timeline ? this.wasRebuilt(n.timeline) && this.revertTimeline(n.timeline) : n.editorMade && n.tween !== e && n.tween.revert();
|
|
1308
|
+
} catch {} finally {
|
|
1309
|
+
this.internal = !1;
|
|
1310
|
+
}
|
|
1311
|
+
let r = /* @__PURE__ */ new Set([n]), i = (e) => {
|
|
1312
|
+
for (let t of e.log) if (t.inst && r.add(t.inst), t.childTimeline) {
|
|
1313
|
+
for (let e of t.childTimeline.site.instances) e.timeline === t.childTimeline && r.add(e);
|
|
1314
|
+
i(t.childTimeline);
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
n.timeline && i(n.timeline);
|
|
1318
|
+
for (let e of r) e.dead = !0;
|
|
1319
|
+
for (let e of this.sites.values()) e.instances.some((e) => e.dead) && (e.instances = e.instances.filter((e) => !e.dead));
|
|
1320
|
+
this.scheduleChange();
|
|
1321
|
+
}
|
|
1322
|
+
wasRebuilt(e) {
|
|
1323
|
+
return e.log.some((e) => e.inst?.editorMade || e.childTimeline && this.wasRebuilt(e.childTimeline));
|
|
1324
|
+
}
|
|
1325
|
+
register(e, t, n, r, i, a, o = {}) {
|
|
1326
|
+
this.creating = void 0;
|
|
1327
|
+
let s = this.currentTick(), c = n?.id ?? r?.id ?? o.id ?? `anonymous#${this.anonCount++}`, l = this.sites.get(c);
|
|
1328
|
+
l || (l = {
|
|
1329
|
+
id: c,
|
|
1330
|
+
method: e,
|
|
1331
|
+
anonymous: !n && !r,
|
|
1332
|
+
meta: {},
|
|
1333
|
+
vars: i,
|
|
1334
|
+
fromVars: a,
|
|
1335
|
+
instances: [],
|
|
1336
|
+
tick: s,
|
|
1337
|
+
order: this.order++
|
|
1338
|
+
}, this.sites.set(c, l)), l.tick !== s && (l.instances = []), l.tick = s, l.vars = i, l.fromVars = a, n && (l.meta.vars = n), r && (l.meta.fromVars = r), (n ?? r) && this.checkFile(n ?? r), o.effect && (l.effect = o.effect), o.flip && (l.flip = o.flip, l.at = o.at), this.branch && this.branch.sites.add(l.id);
|
|
1339
|
+
let u = o.targets ?? (typeof t.targets == "function" ? t.targets() : o.flip ? this.flipTargets(t) : []), d = {
|
|
1340
|
+
tween: t,
|
|
1341
|
+
targets: u,
|
|
1342
|
+
editorMade: !1,
|
|
1343
|
+
seq: this.seq++,
|
|
1344
|
+
entry: o.entry,
|
|
1345
|
+
timeline: o.timeline
|
|
1346
|
+
}, f = o.entry ? null : o.flip ? "flip" : this.liveReason(u, i);
|
|
1347
|
+
return f && (l.live = d.live = !0, l.liveReason = f), l.instances.push(d), this.byAnim.set(t, {
|
|
1348
|
+
site: l,
|
|
1349
|
+
inst: d
|
|
1350
|
+
}), o.timeline && (o.timeline.site = l), i?.overwrite === "auto" && this.noteAutoOverwrite(l, d, i), o.entry || this.detach(t), o.entry ? this.hasEdits(l.id) ? this.scheduleRebuild(this.rootOf(o.entry.owner)) : this.active && this.scheduleSeek() : o.timeline ? (this.active && this.pauseRoot(t), this.hasEdits(l.id) ? this.scheduleRebuild(o.timeline) : this.active && this.scheduleSeek()) : d.live || (this.hasEdits(l.id) ? o.effect ? queueMicrotask(() => !d.entry && !d.dead && !d.editorMade && this.rebuildUnits([{
|
|
1351
|
+
seq: d.seq,
|
|
1352
|
+
standalone: {
|
|
1353
|
+
site: l,
|
|
1354
|
+
inst: d
|
|
1355
|
+
}
|
|
1356
|
+
}])) : this.rebuildUnits([{
|
|
1357
|
+
seq: d.seq,
|
|
1358
|
+
standalone: {
|
|
1359
|
+
site: l,
|
|
1360
|
+
inst: d
|
|
1361
|
+
}
|
|
1362
|
+
}]) : this.active && (this.pauseRoot(t), this.seekInstance(d))), this.scheduleChange(), {
|
|
1363
|
+
site: l,
|
|
1364
|
+
inst: d
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
recordOp(e, n, r, i) {
|
|
1368
|
+
let a = e.tl, o = {
|
|
1369
|
+
method: n,
|
|
1370
|
+
args: [...r],
|
|
1371
|
+
kind: "other",
|
|
1372
|
+
owner: e,
|
|
1373
|
+
ctx: this.capture(a)
|
|
1374
|
+
}, s = n === "fromTo" ? 2 : 1, c = r[s];
|
|
1375
|
+
if (oe.has(n) && c && typeof c == "object" && !Array.isArray(c)) {
|
|
1376
|
+
let l = n === "fromTo" ? r[1] : void 0, u = this.tags.get(c), d = l && typeof l == "object" ? this.tags.get(l) : void 0;
|
|
1377
|
+
this.beforeCreate(u ?? d);
|
|
1378
|
+
let f = { ...c }, p = l ? { ...l } : void 0;
|
|
1379
|
+
o.args[s] = f, p && (o.args[1] = p), o.kind = "tween", o.positionIndex = t[n], o.meta = u ?? d;
|
|
1380
|
+
let m = i.apply(a, r);
|
|
1381
|
+
o.child = a.recent(), e.log.push(o);
|
|
1382
|
+
let { site: h, inst: g } = this.register(n, o.child, u, d, f, p, { entry: o });
|
|
1383
|
+
return o.site = h, o.inst = g, o.id = h.id, m;
|
|
1384
|
+
}
|
|
1385
|
+
if (se.has(n)) {
|
|
1386
|
+
o.meta = this.consumeMark(n), o.id = o.meta?.id, o.positionIndex = t[n];
|
|
1387
|
+
let e = r[0];
|
|
1388
|
+
if (n === "addLabel") o.kind = "label", o.label = String(e);
|
|
1389
|
+
else if (n === "call") o.kind = "call";
|
|
1390
|
+
else if (n === "addPause") o.kind = "pause";
|
|
1391
|
+
else if (typeof e == "string") o.kind = "label", o.label = e;
|
|
1392
|
+
else if (typeof e == "function") o.kind = "call";
|
|
1393
|
+
else if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
1394
|
+
let t = e, n = this.timelines.get(t), r = this.findInstance(t);
|
|
1395
|
+
n ? (o.kind = "timeline", o.childTimeline = n, n.addedBy = o) : r && (o.kind = "tween", o.site = r.site, o.inst = r.inst, r.inst.entry = o, r.site.method === "effect" && !o.id && (o.id = r.site.id)), o.child = t, this.editorPaused.has(t) && (this.editorPaused.delete(t), t.paused(!1));
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
let l = i.apply(a, r);
|
|
1399
|
+
return (o.kind === "call" || o.kind === "pause") && (o.child = a.recent()), e.log.push(o), o.kind !== "other" && o.kind !== "tween" && this.addMarker(o), o.id && this.hasEdits(o.id) || o.site && this.hasEdits(o.site.id) ? this.scheduleRebuild(this.rootOf(e)) : this.active && this.scheduleSeek(), this.scheduleChange(), l;
|
|
1400
|
+
}
|
|
1401
|
+
addMarker(e) {
|
|
1402
|
+
e.meta && this.checkFile(e.meta);
|
|
1403
|
+
let t = this.currentTick(), n = e.id ?? `anonymous-op#${this.anonCount++}`;
|
|
1404
|
+
e.id = n;
|
|
1405
|
+
let r = this.markers.get(n);
|
|
1406
|
+
if (!r) {
|
|
1407
|
+
let i = e.kind === "label" ? e.label ?? "label" : e.kind === "pause" ? "pause" : e.kind === "call" ? "call()" : e.meta?.target ?? "timeline";
|
|
1408
|
+
r = {
|
|
1409
|
+
id: n,
|
|
1410
|
+
kind: e.kind,
|
|
1411
|
+
name: i,
|
|
1412
|
+
anonymous: !e.meta,
|
|
1413
|
+
meta: e.meta ? { vars: e.meta } : {},
|
|
1414
|
+
entries: [],
|
|
1415
|
+
tick: t
|
|
1416
|
+
}, this.markers.set(n, r);
|
|
1417
|
+
}
|
|
1418
|
+
r.tick !== t && (r.entries = []), r.tick = t, r.entries.push(e);
|
|
1419
|
+
}
|
|
1420
|
+
findInstance(e) {
|
|
1421
|
+
let t = this.byAnim.get(e);
|
|
1422
|
+
return t && !t.inst.dead && t.inst.tween === e ? t : void 0;
|
|
1423
|
+
}
|
|
1424
|
+
capture(e) {
|
|
1425
|
+
let t = e.recent(), n = e.duration(), r = e._dur ?? n;
|
|
1426
|
+
return {
|
|
1427
|
+
end: n >= V && t ? t.endTime(!1) : r,
|
|
1428
|
+
prevStart: t ? t.startTime() : 0,
|
|
1429
|
+
prevEnd: t ? t.endTime(t.repeat() >= 0) : 0,
|
|
1430
|
+
prevDuration: t ? t.totalDuration() : 0,
|
|
1431
|
+
labels: { ...e.labels }
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
changeQueued = !1;
|
|
1435
|
+
scheduleChange() {
|
|
1436
|
+
this.changeQueued || (this.changeQueued = !0, queueMicrotask(() => {
|
|
1437
|
+
this.changeQueued = !1, this.emit("change");
|
|
1438
|
+
}));
|
|
1439
|
+
}
|
|
1440
|
+
seekQueued = !1;
|
|
1441
|
+
scheduleSeek() {
|
|
1442
|
+
this.seekQueued || (this.seekQueued = !0, queueMicrotask(() => {
|
|
1443
|
+
this.seekQueued = !1, this.active && this.seek(this.time);
|
|
1444
|
+
}));
|
|
1445
|
+
}
|
|
1446
|
+
rebuildQueue = /* @__PURE__ */ new Set();
|
|
1447
|
+
scheduleRebuild(e) {
|
|
1448
|
+
this.rebuildQueue.has(e) || (this.rebuildQueue.add(e), this.rebuildQueue.size > 1 || queueMicrotask(() => {
|
|
1449
|
+
let e = [...this.rebuildQueue];
|
|
1450
|
+
this.rebuildQueue.clear(), this.rebuildUnits(e.map((e) => ({
|
|
1451
|
+
seq: this.seqOf(e),
|
|
1452
|
+
timeline: e
|
|
1453
|
+
}))), this.emit("change");
|
|
1454
|
+
}));
|
|
1455
|
+
}
|
|
1456
|
+
list() {
|
|
1457
|
+
return [...this.sites.values()].filter((e) => e.instances.length).sort((e, t) => e.order - t.order);
|
|
1458
|
+
}
|
|
1459
|
+
isChild(e) {
|
|
1460
|
+
return !!e.parent && e.parent !== this.gsap.globalTimeline;
|
|
1461
|
+
}
|
|
1462
|
+
parentOf(e) {
|
|
1463
|
+
let t = e.instances[0];
|
|
1464
|
+
if (t) return t.timeline ? t.timeline.addedBy?.owner : t.entry?.owner;
|
|
1465
|
+
}
|
|
1466
|
+
timelineOf(e) {
|
|
1467
|
+
return e.instances[0]?.timeline;
|
|
1468
|
+
}
|
|
1469
|
+
rootOf(e) {
|
|
1470
|
+
let t = e;
|
|
1471
|
+
for (; t.addedBy && this.isChild(t.tl);) t = t.addedBy.owner;
|
|
1472
|
+
return t;
|
|
1473
|
+
}
|
|
1474
|
+
seqOf(e) {
|
|
1475
|
+
return e.site.instances.find((t) => t.timeline === e)?.seq ?? 0;
|
|
1476
|
+
}
|
|
1477
|
+
tree() {
|
|
1478
|
+
let e = [], t = (n, r, i) => {
|
|
1479
|
+
e.push({
|
|
1480
|
+
kind: "timeline",
|
|
1481
|
+
site: n.site,
|
|
1482
|
+
rec: n,
|
|
1483
|
+
depth: r,
|
|
1484
|
+
parent: i
|
|
1485
|
+
});
|
|
1486
|
+
let a = /* @__PURE__ */ new Set();
|
|
1487
|
+
for (let i of n.log) i.kind === "tween" && i.site && !a.has(i.site) ? (a.add(i.site), e.push({
|
|
1488
|
+
kind: "tween",
|
|
1489
|
+
site: i.site,
|
|
1490
|
+
depth: r + 1,
|
|
1491
|
+
parent: n
|
|
1492
|
+
})) : i.kind === "timeline" && i.childTimeline && t(i.childTimeline, r + 1, n);
|
|
1493
|
+
};
|
|
1494
|
+
for (let n of this.list()) {
|
|
1495
|
+
let r = n.instances[0];
|
|
1496
|
+
this.isChild(r.tween) || (r.timeline ? t(r.timeline, 0) : r.entry || e.push({
|
|
1497
|
+
kind: "tween",
|
|
1498
|
+
site: n,
|
|
1499
|
+
depth: 0
|
|
1500
|
+
}));
|
|
1501
|
+
}
|
|
1502
|
+
return e;
|
|
1503
|
+
}
|
|
1504
|
+
markersOf(e) {
|
|
1505
|
+
let t = [];
|
|
1506
|
+
for (let n of e.log) {
|
|
1507
|
+
if (n.kind !== "label" && n.kind !== "call" && n.kind !== "pause") continue;
|
|
1508
|
+
let e = n.id ? this.markers.get(n.id) : void 0;
|
|
1509
|
+
e && !t.includes(e) && t.push(e);
|
|
1510
|
+
}
|
|
1511
|
+
return t;
|
|
1512
|
+
}
|
|
1513
|
+
markerTime(e, t) {
|
|
1514
|
+
let n = e.entries.find((e) => e.owner === t) ?? e.entries[0];
|
|
1515
|
+
if (!n) return 0;
|
|
1516
|
+
let r = n.kind === "label" ? t.tl.labels[n.label ?? ""] ?? 0 : n.child?.startTime() ?? 0;
|
|
1517
|
+
return this.globalStart(t.tl) + r / this.scaleOf(t.tl);
|
|
1518
|
+
}
|
|
1519
|
+
addBranch(e, t) {
|
|
1520
|
+
let n = `${t}:${JSON.stringify(e)}`, r = this.media.find((e) => e.id === n);
|
|
1521
|
+
if (r) return r.gone = !1, r.queries = e, r;
|
|
1522
|
+
let i = {
|
|
1523
|
+
id: n,
|
|
1524
|
+
queries: e,
|
|
1525
|
+
sites: /* @__PURE__ */ new Set()
|
|
1526
|
+
};
|
|
1527
|
+
return this.media.push(i), i;
|
|
1528
|
+
}
|
|
1529
|
+
branches(e = globalThis) {
|
|
1530
|
+
return this.media.filter((e) => !e.gone).map((t) => ({
|
|
1531
|
+
branch: t,
|
|
1532
|
+
active: Object.values(t.queries).some((t) => t === "all" || !!e.matchMedia?.(t).matches)
|
|
1533
|
+
}));
|
|
1534
|
+
}
|
|
1535
|
+
branchOf(e) {
|
|
1536
|
+
return this.media.find((t) => t.sites.has(e.id));
|
|
1537
|
+
}
|
|
1538
|
+
methodName(e) {
|
|
1539
|
+
return e.method === "flip" ? `Flip.${e.flip ?? "from"}` : e.method === "effect" ? e.effect ?? e.meta.vars?.effect ?? "effect" : e.method;
|
|
1540
|
+
}
|
|
1541
|
+
toArray(e) {
|
|
1542
|
+
let t = this.gsap.utils;
|
|
1543
|
+
try {
|
|
1544
|
+
return t?.toArray ? t.toArray(e) : Array.isArray(e) ? e : [e];
|
|
1545
|
+
} catch {
|
|
1546
|
+
return [];
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
label(e) {
|
|
1550
|
+
let t = e.meta.vars?.vars.keys.id?.value ?? e.vars.id;
|
|
1551
|
+
if (typeof t == "string" && t) return t;
|
|
1552
|
+
if (e.method === "timeline") return e.meta.vars?.name ?? "timeline";
|
|
1553
|
+
if (e.method === "flip") {
|
|
1554
|
+
let t = e.instances[0]?.targets ?? [];
|
|
1555
|
+
return t.length ? `${J(t[0])}${t.length > 1 ? ` +${t.length - 1}` : ""}` : `Flip.${e.flip ?? "from"}()`;
|
|
1556
|
+
}
|
|
1557
|
+
let n = e.meta.vars?.target ?? e.meta.fromVars?.target;
|
|
1558
|
+
return n ? n.replace(/^["'`]|["'`]$/g, "") : `${e.method}()`;
|
|
1559
|
+
}
|
|
1560
|
+
scaleOf(e) {
|
|
1561
|
+
let t = e.timeScale() || 1, n = e.parent;
|
|
1562
|
+
for (; n && n !== this.gsap.globalTimeline;) t *= n.timeScale() || 1, n = n.parent;
|
|
1563
|
+
return t;
|
|
1564
|
+
}
|
|
1565
|
+
noteAutoOverwrite(e, t, n) {
|
|
1566
|
+
try {
|
|
1567
|
+
let r = Object.keys(n).filter((e) => !Q.has(e) && !z.has(e));
|
|
1568
|
+
if (!r.length || !t.targets.length) return;
|
|
1569
|
+
let i = this.globalStart(t.tween);
|
|
1570
|
+
for (let n of this.sites.values()) if (n !== e) for (let a of n.instances) {
|
|
1571
|
+
if (a.editorMade || !a.targets.some((e) => t.targets.includes(e))) continue;
|
|
1572
|
+
let o = this.globalStart(a.tween);
|
|
1573
|
+
if (!(o <= i && i < o + a.tween.totalDuration())) continue;
|
|
1574
|
+
let s = r.filter((e) => e in (n.vars ?? {}));
|
|
1575
|
+
if (!s.length) continue;
|
|
1576
|
+
let c = this.overwritten.get(n.id);
|
|
1577
|
+
this.overwritten.set(n.id, {
|
|
1578
|
+
by: e.id,
|
|
1579
|
+
props: [.../* @__PURE__ */ new Set([...c?.props ?? [], ...s])]
|
|
1580
|
+
}), this.scheduleChange();
|
|
1581
|
+
}
|
|
1582
|
+
} catch {}
|
|
1583
|
+
}
|
|
1584
|
+
globalStart(e) {
|
|
1585
|
+
if (!this.isChild(e)) return e.delay();
|
|
1586
|
+
let t = e.parent;
|
|
1587
|
+
return this.globalStart(t) + e.startTime() / this.scaleOf(t);
|
|
1588
|
+
}
|
|
1589
|
+
timingOf(e) {
|
|
1590
|
+
let t = this.scaleOf(e), n = this.globalStart(e), r = e.duration() / t, i = e.repeat(), a = e.repeatDelay() / t, o = i < 0, s = o ? 2 : i + 1;
|
|
1591
|
+
return {
|
|
1592
|
+
start: n,
|
|
1593
|
+
iteration: r,
|
|
1594
|
+
repeat: i,
|
|
1595
|
+
repeatDelay: a,
|
|
1596
|
+
yoyo: e.yoyo(),
|
|
1597
|
+
infinite: o,
|
|
1598
|
+
cycles: s,
|
|
1599
|
+
end: n + s * r + (s - 1) * a
|
|
1600
|
+
};
|
|
1601
|
+
}
|
|
1602
|
+
timing(e) {
|
|
1603
|
+
let t = e.instances[0]?.tween;
|
|
1604
|
+
return t ? this.timingOf(t) : {
|
|
1605
|
+
start: 0,
|
|
1606
|
+
iteration: 0,
|
|
1607
|
+
repeat: 0,
|
|
1608
|
+
repeatDelay: 0,
|
|
1609
|
+
yoyo: !1,
|
|
1610
|
+
infinite: !1,
|
|
1611
|
+
cycles: 1,
|
|
1612
|
+
end: 0
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
span(e) {
|
|
1616
|
+
let t = this.timing(e);
|
|
1617
|
+
return {
|
|
1618
|
+
start: t.start,
|
|
1619
|
+
end: t.end
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
stagger(e) {
|
|
1623
|
+
let t = this.structured(e, "vars", "stagger"), n = e.instances[0]?.targets ?? [], r = n.length;
|
|
1624
|
+
if (r < 2 || t == null) return null;
|
|
1625
|
+
let i;
|
|
1626
|
+
if (typeof t == "number") i = n.map((e, n) => n * t);
|
|
1627
|
+
else if (typeof t == "object" && !Array.isArray(t) && this.gsap.utils) try {
|
|
1628
|
+
let e = this.gsap.utils.distribute({ ...t });
|
|
1629
|
+
i = n.map((t, r) => Number(e(r, t, n)) || 0);
|
|
1630
|
+
} catch {
|
|
1631
|
+
return null;
|
|
1632
|
+
}
|
|
1633
|
+
else return null;
|
|
1634
|
+
let a = Math.min(...i);
|
|
1635
|
+
i = i.map((e) => e - a);
|
|
1636
|
+
let o = this.value(e, "vars", "duration"), s = this.inherited(e, "duration")?.value, c = typeof o == "number" ? o : typeof s == "number" ? s : Number(this.gsap.defaults().duration ?? .5);
|
|
1637
|
+
return {
|
|
1638
|
+
each: Math.max(...i) / (r - 1),
|
|
1639
|
+
count: r,
|
|
1640
|
+
duration: c,
|
|
1641
|
+
delays: i
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
propertyKeys(e, t) {
|
|
1645
|
+
if (e.method === "timeline" || e.method === "effect" || e.method === "flip") return [];
|
|
1646
|
+
let n = e.meta[t]?.vars, r = (t === "vars" ? e.vars : e.fromVars) ?? {}, i = [], a = (e) => {
|
|
1647
|
+
i.includes(e) || i.push(e);
|
|
1648
|
+
};
|
|
1649
|
+
for (let e of [...n?.order ?? [], ...Object.keys(r)]) {
|
|
1650
|
+
if (Q.has(e) || /^on[A-Z]/.test(e)) continue;
|
|
1651
|
+
let t = n?.keys[e]?.children, i = r[e];
|
|
1652
|
+
if (z.has(e) && (t || i && typeof i == "object")) for (let n of t?.order ?? Object.keys(i)) a(`${e}.${n}`);
|
|
1653
|
+
else a(e);
|
|
1654
|
+
}
|
|
1655
|
+
for (let n of this.edits.values()) n.site === e.id && n.role === t && !Q.has(n.key) && !Q.has(n.key.split(".")[0]) && a(n.key);
|
|
1656
|
+
return i;
|
|
1657
|
+
}
|
|
1658
|
+
inherited(e, t) {
|
|
1659
|
+
if (e.vars.inherit === !1) return;
|
|
1660
|
+
let n = this.parentOf(e);
|
|
1661
|
+
for (; n;) {
|
|
1662
|
+
let e = this.value(n.site, "vars", `defaults.${t}`);
|
|
1663
|
+
if (e !== void 0) return {
|
|
1664
|
+
value: e,
|
|
1665
|
+
from: n.site
|
|
1666
|
+
};
|
|
1667
|
+
n = n.addedBy?.owner;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
duration() {
|
|
1671
|
+
let e = 0;
|
|
1672
|
+
for (let t of this.list()) for (let n of t.instances) !this.isChild(n.tween) && !n.live && (e = Math.max(e, this.timingOf(n.tween).end));
|
|
1673
|
+
return e;
|
|
1674
|
+
}
|
|
1675
|
+
callOnUpdate(e) {
|
|
1676
|
+
let t = e.vars;
|
|
1677
|
+
if (typeof t?.onUpdate == "function") try {
|
|
1678
|
+
t.onUpdate.apply(t.callbackScope ?? e, t.onUpdateParams ?? []);
|
|
1679
|
+
} catch (e) {
|
|
1680
|
+
console.error("[dopesheet] onUpdate threw while scrubbing", e);
|
|
1681
|
+
}
|
|
1682
|
+
let n = this.timelines.get(e);
|
|
1683
|
+
if (n) for (let e of n.log) e.child && (e.kind === "tween" || e.kind === "timeline") && this.callOnUpdate(e.child);
|
|
1684
|
+
}
|
|
1685
|
+
seekInstance(e, t = !0) {
|
|
1686
|
+
let { tween: n } = e;
|
|
1687
|
+
if (this.free(n)) return;
|
|
1688
|
+
let r = this.timingOf(n), i = Math.min(Math.max(this.time - r.start, 0), r.end - r.start) * (n.timeScale() || 1);
|
|
1689
|
+
n.totalTime(i, t), t && this.callOnUpdate(n);
|
|
1690
|
+
}
|
|
1691
|
+
*roots() {
|
|
1692
|
+
for (let e of this.sites.values()) for (let t of e.instances) this.isChild(t.tween) || (yield t);
|
|
1693
|
+
}
|
|
1694
|
+
pauseRoot(e) {
|
|
1695
|
+
e.paused() || this.free(e) || (e.pause(), this.editorPaused.add(e));
|
|
1696
|
+
}
|
|
1697
|
+
seek(e, t = !0) {
|
|
1698
|
+
if (this.time = Math.max(0, e), this.active) for (let e of this.roots()) this.seekInstance(e, t);
|
|
1699
|
+
this.emit("time");
|
|
1700
|
+
}
|
|
1701
|
+
activate() {
|
|
1702
|
+
if (!this.active) {
|
|
1703
|
+
this.active = !0;
|
|
1704
|
+
for (let e of this.roots()) this.pauseRoot(e.tween), this.detach(e.tween);
|
|
1705
|
+
this.seek(this.time), this.emit("change");
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
deactivate() {
|
|
1709
|
+
if (this.active) {
|
|
1710
|
+
this.pause(), this.active = !1;
|
|
1711
|
+
for (let e of this.roots()) this.editorPaused.has(e.tween) && (this.editorPaused.delete(e.tween), e.tween.resume());
|
|
1712
|
+
this.attachAll(), this.emit("change");
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
stClass() {
|
|
1716
|
+
return this.gsap.core.globals?.().ScrollTrigger ?? void 0;
|
|
1717
|
+
}
|
|
1718
|
+
stOf(e) {
|
|
1719
|
+
let t = e?.scrollTrigger;
|
|
1720
|
+
return t && typeof t == "object" && typeof t.disable == "function" ? t : null;
|
|
1721
|
+
}
|
|
1722
|
+
free(e) {
|
|
1723
|
+
return this.byAnim.get(e)?.inst.live ? !0 : this.scrollLive && !!this.stOf(e);
|
|
1724
|
+
}
|
|
1725
|
+
detach(e) {
|
|
1726
|
+
if (!this.active || this.scrollLive) return;
|
|
1727
|
+
let t = this.stOf(e);
|
|
1728
|
+
if (t && t.enabled !== !1) try {
|
|
1729
|
+
t.disable(!0, !1), this.detachedSt.add(t);
|
|
1730
|
+
} catch {}
|
|
1731
|
+
}
|
|
1732
|
+
attachAll() {
|
|
1733
|
+
let e = [...this.detachedSt];
|
|
1734
|
+
if (this.detachedSt.clear(), !e.length) return;
|
|
1735
|
+
let t = this.stClass()?.getAll?.(), n = t ? new Set(t) : null;
|
|
1736
|
+
for (let t of e) if (!n || n.has(t)) try {
|
|
1737
|
+
t.enable(!1, !0);
|
|
1738
|
+
} catch {}
|
|
1739
|
+
this.refreshScroll();
|
|
1740
|
+
}
|
|
1741
|
+
refreshQueued = !1;
|
|
1742
|
+
refreshScroll() {
|
|
1743
|
+
if (this.refreshQueued) return;
|
|
1744
|
+
this.refreshQueued = !0;
|
|
1745
|
+
let e = () => {
|
|
1746
|
+
this.refreshQueued = !1;
|
|
1747
|
+
try {
|
|
1748
|
+
this.stClass()?.refresh?.();
|
|
1749
|
+
} catch {}
|
|
1750
|
+
};
|
|
1751
|
+
typeof requestAnimationFrame == "function" ? requestAnimationFrame(e) : queueMicrotask(e);
|
|
1752
|
+
}
|
|
1753
|
+
setScrollLive(e) {
|
|
1754
|
+
if (this.scrollLive !== e) {
|
|
1755
|
+
if (this.scrollLive = e, this.active) {
|
|
1756
|
+
if (e) this.attachAll();
|
|
1757
|
+
else {
|
|
1758
|
+
for (let e of this.roots()) this.stOf(e.tween) && (this.pauseRoot(e.tween), this.detach(e.tween));
|
|
1759
|
+
this.seek(this.time);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
this.emit("change");
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
foreign(e, t) {
|
|
1766
|
+
if (t.data === "ScrollSmoother" || t.data === "_draggable" || t.data === "isFlip") return !0;
|
|
1767
|
+
let n = Object.keys(t);
|
|
1768
|
+
if (n.length && n.every((e) => de.has(e))) return !0;
|
|
1769
|
+
let r = Object.keys(t).filter((e) => !Q.has(e) && !/^on[A-Z]/.test(e));
|
|
1770
|
+
return Object.keys(t).length && Object.keys(t).every((e) => e === "force3D") || r.length && r.every((e) => t[e] === "+=0") ? !0 : (Array.isArray(e) ? e : [e]).some((e) => {
|
|
1771
|
+
if (!e || typeof e != "object") return !1;
|
|
1772
|
+
if (typeof e.totalTime == "function" || typeof window < "u" && e.window === e) return !0;
|
|
1773
|
+
let t = e;
|
|
1774
|
+
if (t.nodeType === 9) return !0;
|
|
1775
|
+
if (t.nodeType === 1) {
|
|
1776
|
+
let e = t.tagName;
|
|
1777
|
+
return e === "HTML" || e === "BODY" || t.id === "smooth-wrapper" || t.id === "smooth-content" || t.hasAttribute?.("data-lag") || /\bgsap-marker/.test(String(t.className));
|
|
1778
|
+
}
|
|
1779
|
+
return typeof e.smooth == "function" && typeof e.content == "function";
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
liveReason(e, t) {
|
|
1783
|
+
return t && "scrollTo" in t ? "scroll" : t && "inertia" in t ? "inertia" : e.some((e) => !!e && typeof e == "object" && (e.window === e || e.nodeType === 9)) ? "scroll" : null;
|
|
1784
|
+
}
|
|
1785
|
+
flipTargets(e) {
|
|
1786
|
+
let t = e, n = /* @__PURE__ */ new Set();
|
|
1787
|
+
try {
|
|
1788
|
+
for (let e of t.getChildren?.(!0, !0, !1) ?? []) for (let t of e.targets?.() ?? []) t && typeof t == "object" && t.nodeType === 1 && n.add(t);
|
|
1789
|
+
} catch {}
|
|
1790
|
+
return [...n];
|
|
1791
|
+
}
|
|
1792
|
+
scrollVars(e) {
|
|
1793
|
+
let t = this.effectiveVars(e, "vars")?.scrollTrigger;
|
|
1794
|
+
return G(t) ? t : null;
|
|
1795
|
+
}
|
|
1796
|
+
hasScroll(e) {
|
|
1797
|
+
return !!e.vars?.scrollTrigger && !!e.instances[0] && !e.instances[0].entry;
|
|
1798
|
+
}
|
|
1799
|
+
scrollInfo(e) {
|
|
1800
|
+
let t = e.instances[0];
|
|
1801
|
+
if (!t || t.entry || !e.vars?.scrollTrigger) return null;
|
|
1802
|
+
let n = this.stOf(t.tween), r = this.scrollVars(e) ?? (typeof e.vars.scrollTrigger == "object" ? {} : { trigger: e.vars.scrollTrigger }), i = (e) => {
|
|
1803
|
+
if (e && typeof e == "object" && e.nodeType === 1) return e;
|
|
1804
|
+
if (typeof e == "string" && typeof document < "u") try {
|
|
1805
|
+
return (t.targets.find((e) => e?.ownerDocument)?.ownerDocument ?? document).querySelector(e);
|
|
1806
|
+
} catch {
|
|
1807
|
+
return null;
|
|
1808
|
+
}
|
|
1809
|
+
return null;
|
|
1810
|
+
}, a = n?.trigger ?? i(r.trigger) ?? null, o = a?.ownerDocument ?? (typeof document < "u" ? document : null), s = o?.defaultView ?? null, c = n?.pin ?? (r.pin === !0 ? a : i(r.pin)), l = !!r.horizontal, u = n?.scroller ?? i(r.scroller) ?? s, d = !u || u === s || u === o?.body || u === o?.documentElement, f = 0, p = 0, m = 0, h = 1e400;
|
|
1811
|
+
if (s) {
|
|
1812
|
+
if (d) {
|
|
1813
|
+
f = l ? s.innerWidth : s.innerHeight, m = n?.scroll?.() ?? (l ? s.scrollX : s.scrollY);
|
|
1814
|
+
let e = o.documentElement;
|
|
1815
|
+
h = l ? e.scrollWidth - s.innerWidth : e.scrollHeight - s.innerHeight;
|
|
1816
|
+
} else {
|
|
1817
|
+
let e = u, t = e.getBoundingClientRect();
|
|
1818
|
+
f = l ? e.clientWidth : e.clientHeight, p = l ? t.left : t.top, m = n?.scroll?.() ?? (l ? e.scrollLeft : e.scrollTop), h = l ? e.scrollWidth - e.clientWidth : e.scrollHeight - e.clientHeight;
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
let g = (e) => {
|
|
1822
|
+
if (!e) return null;
|
|
1823
|
+
let t = e.getBoundingClientRect();
|
|
1824
|
+
return {
|
|
1825
|
+
client: l ? t.left : t.top,
|
|
1826
|
+
size: l ? t.width : t.height
|
|
1827
|
+
};
|
|
1828
|
+
}, _ = g(a), v = r.endTrigger ? i(r.endTrigger) : null, y = (e) => e ? {
|
|
1829
|
+
elStart: e.client - p + m,
|
|
1830
|
+
elSize: e.size,
|
|
1831
|
+
vpSize: f,
|
|
1832
|
+
max: h
|
|
1833
|
+
} : null, b = !!r.pin, x = (t, i) => {
|
|
1834
|
+
let o = r[t], s = n?.[t] ?? 0;
|
|
1835
|
+
if (typeof o == "function") return {
|
|
1836
|
+
value: o,
|
|
1837
|
+
pos: null,
|
|
1838
|
+
px: s,
|
|
1839
|
+
elLine: null,
|
|
1840
|
+
vpLine: null,
|
|
1841
|
+
blocker: "Computed by a function in code",
|
|
1842
|
+
vpLocked: !1
|
|
1843
|
+
};
|
|
1844
|
+
let c = o === void 0 ? a ? re(t, b) : t === "start" ? 0 : void 0 : o, l = c === void 0 ? null : ne(c);
|
|
1845
|
+
if (!l) return {
|
|
1846
|
+
value: o,
|
|
1847
|
+
pos: null,
|
|
1848
|
+
px: t === "end" && c === void 0 ? h : s,
|
|
1849
|
+
elLine: null,
|
|
1850
|
+
vpLine: null,
|
|
1851
|
+
blocker: c === void 0 ? "Ends at the bottom of the page" : `"${String(c)}" isn't a position the editor can read`,
|
|
1852
|
+
vpLocked: !1
|
|
1853
|
+
};
|
|
1854
|
+
let u = e.anonymous ? "This call wasn't tagged by the build transform" : null;
|
|
1855
|
+
if (l.kind === "absolute") return {
|
|
1856
|
+
value: o,
|
|
1857
|
+
pos: l,
|
|
1858
|
+
px: l.px,
|
|
1859
|
+
elLine: p + l.px - m,
|
|
1860
|
+
vpLine: p,
|
|
1861
|
+
blocker: u,
|
|
1862
|
+
vpLocked: !0
|
|
1863
|
+
};
|
|
1864
|
+
if (l.kind === "relative") {
|
|
1865
|
+
let e = i?.px ?? 0, t = N(l, {
|
|
1866
|
+
elStart: 0,
|
|
1867
|
+
elSize: 0,
|
|
1868
|
+
vpSize: f,
|
|
1869
|
+
max: h
|
|
1870
|
+
}, e);
|
|
1871
|
+
return {
|
|
1872
|
+
value: o,
|
|
1873
|
+
pos: l,
|
|
1874
|
+
px: t,
|
|
1875
|
+
elLine: i?.elLine == null ? null : i.elLine + (t - e),
|
|
1876
|
+
vpLine: i?.vpLine ?? null,
|
|
1877
|
+
blocker: u,
|
|
1878
|
+
vpLocked: !0
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
let d = t === "end" && v ? g(v) : _, x = y(d);
|
|
1882
|
+
return !x || !d ? {
|
|
1883
|
+
value: o,
|
|
1884
|
+
pos: l,
|
|
1885
|
+
px: s,
|
|
1886
|
+
elLine: null,
|
|
1887
|
+
vpLine: null,
|
|
1888
|
+
blocker: "No trigger element on the page",
|
|
1889
|
+
vpLocked: !1
|
|
1890
|
+
} : {
|
|
1891
|
+
value: o,
|
|
1892
|
+
pos: l,
|
|
1893
|
+
px: N(l, x, 0),
|
|
1894
|
+
elLine: d.client + M(l.el, d.size),
|
|
1895
|
+
vpLine: p + (l.vp ? M(l.vp, f) : 0),
|
|
1896
|
+
blocker: u,
|
|
1897
|
+
vpLocked: !1
|
|
1898
|
+
};
|
|
1899
|
+
}, S = x("start"), C = x("end", S), w = r.scrub;
|
|
1900
|
+
return {
|
|
1901
|
+
st: n,
|
|
1902
|
+
vars: r,
|
|
1903
|
+
trigger: a,
|
|
1904
|
+
endTrigger: v,
|
|
1905
|
+
pin: c ?? null,
|
|
1906
|
+
horizontal: l,
|
|
1907
|
+
scroller: d ? null : u,
|
|
1908
|
+
vpSize: f,
|
|
1909
|
+
vpTop: p,
|
|
1910
|
+
scroll: m,
|
|
1911
|
+
start: S,
|
|
1912
|
+
end: C,
|
|
1913
|
+
scrub: typeof w == "number" ? w : w === !0 || w === "true",
|
|
1914
|
+
win: s
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
dragScroll(e, t, n, r) {
|
|
1918
|
+
let i = this.sites.get(e), a = i && this.scrollInfo(i);
|
|
1919
|
+
if (!i || !a) return !1;
|
|
1920
|
+
let o = a[t];
|
|
1921
|
+
if (o.blocker || !o.pos || n === "viewport" && o.vpLocked) return !1;
|
|
1922
|
+
let s = a.horizontal ? "x" : "y", c = null;
|
|
1923
|
+
if (o.pos.kind === "absolute") c = {
|
|
1924
|
+
kind: "absolute",
|
|
1925
|
+
px: Math.max(0, r - a.vpTop + a.scroll)
|
|
1926
|
+
};
|
|
1927
|
+
else if (o.pos.kind === "relative") {
|
|
1928
|
+
if (n !== "element" || a.start.elLine == null) return !1;
|
|
1929
|
+
let e = r - a.start.elLine;
|
|
1930
|
+
c = {
|
|
1931
|
+
kind: "relative",
|
|
1932
|
+
n: o.pos.unit === "%" ? Math.round(e / (a.vpSize || 1) * 100) : Math.round(e),
|
|
1933
|
+
unit: o.pos.unit
|
|
1934
|
+
};
|
|
1935
|
+
} else if (o.pos.kind === "pair") {
|
|
1936
|
+
if (n === "element") {
|
|
1937
|
+
let e = (t === "end" && a.endTrigger || a.trigger)?.getBoundingClientRect();
|
|
1938
|
+
if (!e) return !1;
|
|
1939
|
+
c = a.horizontal ? {
|
|
1940
|
+
...o.pos,
|
|
1941
|
+
el: P(o.pos.el, r - e.left, e.width, s)
|
|
1942
|
+
} : {
|
|
1943
|
+
...o.pos,
|
|
1944
|
+
el: P(o.pos.el, r - e.top, e.height, s)
|
|
1945
|
+
};
|
|
1946
|
+
} else {
|
|
1947
|
+
let e = o.pos.vp ?? {
|
|
1948
|
+
base: a.horizontal ? "left" : "top",
|
|
1949
|
+
unit: ""
|
|
1950
|
+
};
|
|
1951
|
+
c = {
|
|
1952
|
+
...o.pos,
|
|
1953
|
+
vp: P(e, r - a.vpTop, a.vpSize, s)
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
if (!c) return !1;
|
|
1958
|
+
let l = A(c);
|
|
1959
|
+
return typeof l == "number" && typeof o.value == "string" && (l = String(l)), l === o.value || this.setValue(e, "vars", `scrollTrigger.${t}`, l), !0;
|
|
1960
|
+
}
|
|
1961
|
+
scrollAt(e, t) {
|
|
1962
|
+
let n = this.scrollInfo(e);
|
|
1963
|
+
if (!n) return null;
|
|
1964
|
+
let r = this.timing(e), i = r.end - r.start, a = i > 0 ? Math.min(Math.max((t - r.start) / i, 0), 1) : 0;
|
|
1965
|
+
return n.start.px + a * (n.end.px - n.start.px);
|
|
1966
|
+
}
|
|
1967
|
+
smoother() {
|
|
1968
|
+
let e = (this.gsap.core.globals?.().ScrollSmoother)?.get?.();
|
|
1969
|
+
if (!e) return null;
|
|
1970
|
+
try {
|
|
1971
|
+
return {
|
|
1972
|
+
smooth: Number(e.smooth?.() ?? 0),
|
|
1973
|
+
effects: (e.effects?.() ?? []).length
|
|
1974
|
+
};
|
|
1975
|
+
} catch {
|
|
1976
|
+
return {
|
|
1977
|
+
smooth: 0,
|
|
1978
|
+
effects: 0
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
play() {
|
|
1983
|
+
this.active || this.activate(), this.time >= this.duration() - 1e-6 && (this.time = 0), this.playing = !0, this.lastFrame = performance.now(), cancelAnimationFrame(this.raf), this.raf = requestAnimationFrame(this.frame), this.emit("time");
|
|
1984
|
+
}
|
|
1985
|
+
pause() {
|
|
1986
|
+
this.playing = !1, cancelAnimationFrame(this.raf), this.emit("time");
|
|
1987
|
+
}
|
|
1988
|
+
toggle() {
|
|
1989
|
+
this.playing ? this.pause() : this.play();
|
|
1990
|
+
}
|
|
1991
|
+
pauseTimes() {
|
|
1992
|
+
let e = [];
|
|
1993
|
+
for (let t of this.markers.values()) if (t.kind === "pause") for (let n of t.entries) n.child && !this.isDead(n.owner) && e.push(this.markerTime(t, n.owner));
|
|
1994
|
+
return e;
|
|
1995
|
+
}
|
|
1996
|
+
isDead(e) {
|
|
1997
|
+
let t = this.rootOf(e);
|
|
1998
|
+
return !t.site.instances.some((e) => e.timeline === t);
|
|
1999
|
+
}
|
|
2000
|
+
frame = (e) => {
|
|
2001
|
+
if (!this.playing) return;
|
|
2002
|
+
let t = Math.min((e - this.lastFrame) / 1e3, .1);
|
|
2003
|
+
this.lastFrame = e;
|
|
2004
|
+
let n = this.duration(), r = this.time, i = r + t * this.speed, a = this.pauseTimes().find((e) => e > r + 1e-6 && e <= i);
|
|
2005
|
+
a === void 0 ? i >= n && (this.loop && n > 0 ? i %= n : (i = n, this.playing = !1)) : (i = a, this.playing = !1), this.seek(i, !this.fireCallbacks), this.playing && (this.raf = requestAnimationFrame(this.frame));
|
|
2006
|
+
};
|
|
2007
|
+
hasEdits(e) {
|
|
2008
|
+
if (!e) return this.edits.size > 0;
|
|
2009
|
+
for (let t of this.edits.values()) if (t.site === e) return !0;
|
|
2010
|
+
return !1;
|
|
2011
|
+
}
|
|
2012
|
+
getEdit(e, t, n) {
|
|
2013
|
+
return this.edits.get(Z(e, t, n));
|
|
2014
|
+
}
|
|
2015
|
+
entriesOf(e) {
|
|
2016
|
+
let t = this.sites.get(e);
|
|
2017
|
+
if (t) {
|
|
2018
|
+
let e = [];
|
|
2019
|
+
for (let n of t.instances) n.entry ? e.push(n.entry) : n.timeline?.addedBy && e.push(n.timeline.addedBy);
|
|
2020
|
+
return e;
|
|
2021
|
+
}
|
|
2022
|
+
return this.markers.get(e)?.entries ?? [];
|
|
2023
|
+
}
|
|
2024
|
+
value(e, t, n) {
|
|
2025
|
+
let r = this.getEdit(e.id, t, n);
|
|
2026
|
+
if (r) return r.mode === "remove" ? void 0 : r.value;
|
|
2027
|
+
let i = this.authored(e, t, n);
|
|
2028
|
+
if (i?.binding) {
|
|
2029
|
+
let t = this.bindingEdit(e, i.binding);
|
|
2030
|
+
if (t) return t.value;
|
|
2031
|
+
}
|
|
2032
|
+
if (i && "value" in i) return i.value;
|
|
2033
|
+
if (n === "@position") {
|
|
2034
|
+
let t = this.entriesOf(e.id)[0];
|
|
2035
|
+
return t?.positionIndex === void 0 ? void 0 : t.args[t.positionIndex];
|
|
2036
|
+
}
|
|
2037
|
+
if (!("vars" in e) || !e.vars) return;
|
|
2038
|
+
let a = t === "vars" ? e.vars : e.fromVars, o = Y(n);
|
|
2039
|
+
return o && !(n in (a ?? {})) ? a?.[o[0]]?.[o[1]] : a?.[n];
|
|
2040
|
+
}
|
|
2041
|
+
authored(e, t, n) {
|
|
2042
|
+
let r = e.meta[t];
|
|
2043
|
+
if (n === "@position") return (e.meta.vars ?? e.meta.fromVars)?.position;
|
|
2044
|
+
let i = r?.vars;
|
|
2045
|
+
if (!i) return;
|
|
2046
|
+
if (i.keys[n]) return i.keys[n];
|
|
2047
|
+
if (i.fromSpread?.[n]) return i.fromSpread[n];
|
|
2048
|
+
let a = Y(n);
|
|
2049
|
+
return a ? i.keys[a[0]]?.children?.keys[a[1]] : void 0;
|
|
2050
|
+
}
|
|
2051
|
+
isRemoved(e, t, n) {
|
|
2052
|
+
return this.getEdit(e, t, n)?.mode === "remove";
|
|
2053
|
+
}
|
|
2054
|
+
target(e) {
|
|
2055
|
+
return this.sites.get(e) ?? this.markers.get(e);
|
|
2056
|
+
}
|
|
2057
|
+
fileOf(e) {
|
|
2058
|
+
return (e.meta.vars ?? e.meta.fromVars)?.file;
|
|
2059
|
+
}
|
|
2060
|
+
bindingKey(e, t) {
|
|
2061
|
+
return `${this.fileOf(e)}|${t.name}|${t.path ?? ""}`;
|
|
2062
|
+
}
|
|
2063
|
+
bindingEdit(e, t) {
|
|
2064
|
+
let n = this.bindingKey(e, t);
|
|
2065
|
+
for (let e of this.edits.values()) {
|
|
2066
|
+
if (e.mode !== "binding") continue;
|
|
2067
|
+
let t = this.target(e.site);
|
|
2068
|
+
if (!t) continue;
|
|
2069
|
+
let r = this.authored(t, e.role, e.key);
|
|
2070
|
+
if (r?.binding && this.bindingKey(t, r.binding) === n) return e;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
bindingUses(e, t) {
|
|
2074
|
+
let n = this.bindingKey(e, t), r = [];
|
|
2075
|
+
for (let e of this.sites.values()) for (let t of ["vars", "fromVars"]) {
|
|
2076
|
+
let i = e.meta[t]?.vars;
|
|
2077
|
+
if (i) for (let [a, o] of [...Object.entries(i.keys), ...Object.entries(i.fromSpread ?? {})]) o.binding && this.bindingKey(e, o.binding) === n && r.push({
|
|
2078
|
+
site: e,
|
|
2079
|
+
role: t,
|
|
2080
|
+
key: a
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
2083
|
+
return r;
|
|
2084
|
+
}
|
|
2085
|
+
hashOf(e) {
|
|
2086
|
+
return (e.meta.vars ?? e.meta.fromVars)?.hash;
|
|
2087
|
+
}
|
|
2088
|
+
setValue(e, t, n, r, i = "value") {
|
|
2089
|
+
let a = this.target(e);
|
|
2090
|
+
if (!a || a.anonymous) return;
|
|
2091
|
+
this.record(`set|${e}|${t}|${n}|${i}`);
|
|
2092
|
+
let o = Z(e, t, n), s = this.authored(a, t, n), c = /* @__PURE__ */ new Set([e]);
|
|
2093
|
+
if (i === "binding" && s?.binding) {
|
|
2094
|
+
let l = this.bindingEdit(a, s.binding);
|
|
2095
|
+
l && this.edits.delete(Z(l.site, l.role, l.key));
|
|
2096
|
+
for (let e of this.bindingUses(a, s.binding)) c.add(e.site.id);
|
|
2097
|
+
s.binding.value === r ? this.edits.delete(o) : this.edits.set(o, {
|
|
2098
|
+
site: e,
|
|
2099
|
+
role: t,
|
|
2100
|
+
key: n,
|
|
2101
|
+
value: r,
|
|
2102
|
+
mode: i,
|
|
2103
|
+
hash: this.hashOf(a)
|
|
2104
|
+
});
|
|
2105
|
+
} else s && s.editable && "value" in s && s.value === r || i === "json" && s && (s.json ?? (s.editable && "value" in s ? JSON.stringify(s.value) : void 0)) === r ? this.edits.delete(o) : this.edits.set(o, {
|
|
2106
|
+
site: e,
|
|
2107
|
+
role: t,
|
|
2108
|
+
key: n,
|
|
2109
|
+
value: r,
|
|
2110
|
+
...i === "value" ? {} : { mode: i },
|
|
2111
|
+
hash: this.hashOf(a)
|
|
2112
|
+
});
|
|
2113
|
+
this.saveErrors.delete(o), this.saveState.status !== "saving" && (this.saveState = { status: "idle" }), this.afterEdit(c);
|
|
2114
|
+
}
|
|
2115
|
+
removeKey(e, t, n) {
|
|
2116
|
+
let r = this.target(e);
|
|
2117
|
+
if (!r || r.anonymous) return;
|
|
2118
|
+
let i = Z(e, t, n);
|
|
2119
|
+
if (!this.authored(r, t, n)) return this.clearEdit(e, t, n);
|
|
2120
|
+
this.record(`remove|${i}`), this.edits.set(i, {
|
|
2121
|
+
site: e,
|
|
2122
|
+
role: t,
|
|
2123
|
+
key: n,
|
|
2124
|
+
value: 0,
|
|
2125
|
+
mode: "remove",
|
|
2126
|
+
hash: this.hashOf(r)
|
|
2127
|
+
}), this.saveErrors.delete(i), this.afterEdit(/* @__PURE__ */ new Set([e]));
|
|
2128
|
+
}
|
|
2129
|
+
structured(e, t, n) {
|
|
2130
|
+
let r = this.getEdit(e.id, t, n);
|
|
2131
|
+
if (r?.mode === "json") return W(r.value);
|
|
2132
|
+
if (r?.mode === "remove") return;
|
|
2133
|
+
let i = this.authored(e, t, n);
|
|
2134
|
+
if (i?.json !== void 0) return W(i.json);
|
|
2135
|
+
if (i && "value" in i) return i.value;
|
|
2136
|
+
let a = t === "vars" ? e.vars : e.fromVars, o = Y(n);
|
|
2137
|
+
if (o && a && !(n in a)) {
|
|
2138
|
+
let n = this.getEdit(e.id, t, o[0]), r = n?.mode === "json" ? W(n.value) : a[o[0]];
|
|
2139
|
+
return G(r) ? r[o[1]] : void 0;
|
|
2140
|
+
}
|
|
2141
|
+
return a?.[n];
|
|
2142
|
+
}
|
|
2143
|
+
structuredBlocker(e, t, n) {
|
|
2144
|
+
if (e.anonymous) return "This call wasn't tagged by the build transform";
|
|
2145
|
+
let r = this.authored(e, t, n);
|
|
2146
|
+
return !r || r.json !== void 0 || r.editable && "value" in r ? null : r.reason ?? "Computed in code";
|
|
2147
|
+
}
|
|
2148
|
+
setStructured(e, t, n, r) {
|
|
2149
|
+
this.setValue(e, t, n, JSON.stringify(r), "json");
|
|
2150
|
+
}
|
|
2151
|
+
keyframeContext(e) {
|
|
2152
|
+
let t = this.getEdit(e.id, "vars", "duration")?.value ?? e.vars.duration;
|
|
2153
|
+
return {
|
|
2154
|
+
tweenDuration: typeof t == "number" ? t : void 0,
|
|
2155
|
+
defaultDuration: Number(this.gsap.defaults().duration ?? .5)
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
keyframes(e) {
|
|
2159
|
+
if (e.method === "timeline") return null;
|
|
2160
|
+
let t = y(this.structured(e, "vars", "keyframes"), this.keyframeContext(e));
|
|
2161
|
+
return t && {
|
|
2162
|
+
...t,
|
|
2163
|
+
blocker: this.structuredBlocker(e, "vars", "keyframes")
|
|
2164
|
+
};
|
|
2165
|
+
}
|
|
2166
|
+
keyframeMoveBlocker(e, t) {
|
|
2167
|
+
return this.structuredBlocker(e, "vars", "keyframes") ?? b(this.structured(e, "vars", "keyframes"), t, this.keyframeContext(e));
|
|
2168
|
+
}
|
|
2169
|
+
moveKeyframe(e, t, n) {
|
|
2170
|
+
let r = this.sites.get(e);
|
|
2171
|
+
if (!r || this.keyframeMoveBlocker(r, t)) return null;
|
|
2172
|
+
let i = this.structured(r, "vars", "keyframes"), a = x(i, t, n, this.keyframeContext(r));
|
|
2173
|
+
if (a === null) return null;
|
|
2174
|
+
if (this.setStructured(e, "vars", "keyframes", a), Array.isArray(a)) return t;
|
|
2175
|
+
let o = new Set(Object.keys(i));
|
|
2176
|
+
return Object.keys(a).find((e) => !o.has(e)) ?? t;
|
|
2177
|
+
}
|
|
2178
|
+
addKeyframe(e, t) {
|
|
2179
|
+
let n = this.sites.get(e);
|
|
2180
|
+
if (!n || this.structuredBlocker(n, "vars", "keyframes")) return null;
|
|
2181
|
+
let r = this.structured(n, "vars", "keyframes"), i = this.keyframeContext(n), a = y(r, i), o = n.instances[0];
|
|
2182
|
+
if (!a || !o) return null;
|
|
2183
|
+
let s = S(r, t, this.sampleAt(o, t, a.props), i);
|
|
2184
|
+
return s ? (this.setStructured(e, "vars", "keyframes", s.value), s.id) : null;
|
|
2185
|
+
}
|
|
2186
|
+
removeKeyframe(e, t) {
|
|
2187
|
+
let n = this.sites.get(e);
|
|
2188
|
+
if (!n || this.structuredBlocker(n, "vars", "keyframes")) return !1;
|
|
2189
|
+
let r = C(this.structured(n, "vars", "keyframes"), t, this.keyframeContext(n));
|
|
2190
|
+
return r !== null && (this.setStructured(e, "vars", "keyframes", r), !0);
|
|
2191
|
+
}
|
|
2192
|
+
setKeyframeValue(e, t, n, r) {
|
|
2193
|
+
let i = this.sites.get(e);
|
|
2194
|
+
if (!i || this.structuredBlocker(i, "vars", "keyframes")) return !1;
|
|
2195
|
+
let a = w(this.structured(i, "vars", "keyframes"), t, n, r);
|
|
2196
|
+
return a !== null && (this.setStructured(e, "vars", "keyframes", a), !0);
|
|
2197
|
+
}
|
|
2198
|
+
sampleAt(e, t, n) {
|
|
2199
|
+
let r = e.tween, i = e.targets[0], a = r.time();
|
|
2200
|
+
r.time(t * r.duration(), !0);
|
|
2201
|
+
let o = {};
|
|
2202
|
+
for (let e of n) {
|
|
2203
|
+
let t = this.gsap.getProperty(i, e);
|
|
2204
|
+
o[e] = typeof t == "number" ? Number(t.toFixed(3)) : t;
|
|
2205
|
+
}
|
|
2206
|
+
return r.time(a, !0), o;
|
|
2207
|
+
}
|
|
2208
|
+
clearEdit(e, t, n) {
|
|
2209
|
+
let r = Z(e, t, n), i = this.edits.get(r);
|
|
2210
|
+
i && (this.record(`clear|${r}`), this.edits.delete(r), this.saveErrors.delete(r), this.afterEdit(this.affected([i])));
|
|
2211
|
+
}
|
|
2212
|
+
saveError(e, t, n) {
|
|
2213
|
+
return this.saveErrors.get(Z(e, t, n));
|
|
2214
|
+
}
|
|
2215
|
+
revertSite(e) {
|
|
2216
|
+
let t = [...this.edits.values()].filter((t) => t.site === e);
|
|
2217
|
+
if (t.length) {
|
|
2218
|
+
this.record(`revert|${e}`);
|
|
2219
|
+
for (let e of t) this.edits.delete(Z(e.site, e.role, e.key));
|
|
2220
|
+
this.afterEdit(this.affected(t));
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
revertAll() {
|
|
2224
|
+
if (!this.edits.size) return;
|
|
2225
|
+
this.record("revert-all");
|
|
2226
|
+
let e = [...this.edits.values()];
|
|
2227
|
+
this.edits.clear(), this.saveErrors.clear(), this.saveState = { status: "idle" }, this.afterEdit(this.affected(e));
|
|
2228
|
+
}
|
|
2229
|
+
affected(e) {
|
|
2230
|
+
let t = /* @__PURE__ */ new Set();
|
|
2231
|
+
for (let n of e) {
|
|
2232
|
+
if (t.add(n.site), n.mode !== "binding") continue;
|
|
2233
|
+
let e = this.target(n.site);
|
|
2234
|
+
if (!e) continue;
|
|
2235
|
+
let r = this.authored(e, n.role, n.key);
|
|
2236
|
+
if (r?.binding) for (let n of this.bindingUses(e, r.binding)) t.add(n.site.id);
|
|
2237
|
+
}
|
|
2238
|
+
return t;
|
|
2239
|
+
}
|
|
2240
|
+
afterEdit(e) {
|
|
2241
|
+
this.syncVersion();
|
|
2242
|
+
for (let t of e) this.rebuild(t);
|
|
2243
|
+
this.persist(), this.emit("change");
|
|
2244
|
+
}
|
|
2245
|
+
record(e) {
|
|
2246
|
+
if (this.groupDepth > 0) return;
|
|
2247
|
+
let t = Date.now();
|
|
2248
|
+
this.lastChange && this.lastChange.key === e && t - this.lastChange.at < ue ? this.lastChange.at = t : (this.lastChange = {
|
|
2249
|
+
key: e,
|
|
2250
|
+
at: t
|
|
2251
|
+
}, this.pushUndo());
|
|
2252
|
+
}
|
|
2253
|
+
snapshot() {
|
|
2254
|
+
return {
|
|
2255
|
+
edits: [...this.edits.values()].map((e) => ({ ...e })),
|
|
2256
|
+
active: this.activeVersion
|
|
2257
|
+
};
|
|
2258
|
+
}
|
|
2259
|
+
pushUndo() {
|
|
2260
|
+
this.undoStack.push(this.snapshot()), this.undoStack.length > X && this.undoStack.shift(), this.redoStack = [];
|
|
2261
|
+
}
|
|
2262
|
+
batch(e, t) {
|
|
2263
|
+
this.record(e), this.groupDepth++;
|
|
2264
|
+
try {
|
|
2265
|
+
t();
|
|
2266
|
+
} finally {
|
|
2267
|
+
this.groupDepth--;
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
beginGroup() {
|
|
2271
|
+
this.groupDepth++ === 0 && (this.lastChange = null, this.pushUndo());
|
|
2272
|
+
}
|
|
2273
|
+
endGroup() {
|
|
2274
|
+
if (this.groupDepth !== 0 && --this.groupDepth === 0) {
|
|
2275
|
+
let e = this.undoStack[this.undoStack.length - 1];
|
|
2276
|
+
e && H(e.edits, [...this.edits.values()]) && e.active === this.activeVersion && this.undoStack.pop(), this.persist(), this.emit("change");
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
get canUndo() {
|
|
2280
|
+
return this.undoStack.length > 0;
|
|
2281
|
+
}
|
|
2282
|
+
get canRedo() {
|
|
2283
|
+
return this.redoStack.length > 0;
|
|
2284
|
+
}
|
|
2285
|
+
undo() {
|
|
2286
|
+
let e = this.undoStack.pop();
|
|
2287
|
+
e && (this.redoStack.push(this.snapshot()), this.restore(e));
|
|
2288
|
+
}
|
|
2289
|
+
redo() {
|
|
2290
|
+
let e = this.redoStack.pop();
|
|
2291
|
+
e && (this.undoStack.push(this.snapshot()), this.restore(e));
|
|
2292
|
+
}
|
|
2293
|
+
restore(e) {
|
|
2294
|
+
let t = [...this.edits.values()];
|
|
2295
|
+
this.syncVersion(), this.edits.clear();
|
|
2296
|
+
for (let t of e.edits) this.edits.set(Z(t.site, t.role, t.key), { ...t });
|
|
2297
|
+
this.activeVersion = e.active, e.active !== null && !this.versions.some((t) => t.id === e.active) && this.versions.push({
|
|
2298
|
+
id: e.active,
|
|
2299
|
+
name: e.active,
|
|
2300
|
+
edits: []
|
|
2301
|
+
}), this.saveErrors.clear(), this.lastChange = null, this.afterEdit(this.affected([...t, ...e.edits]));
|
|
2302
|
+
}
|
|
2303
|
+
syncVersion() {
|
|
2304
|
+
if (this.activeVersion === null) {
|
|
2305
|
+
if (!this.edits.size) return;
|
|
2306
|
+
this.activeVersion = this.nextVersionId(), this.versions.push({
|
|
2307
|
+
id: this.activeVersion,
|
|
2308
|
+
name: this.activeVersion,
|
|
2309
|
+
edits: []
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2312
|
+
let e = this.versions.find((e) => e.id === this.activeVersion);
|
|
2313
|
+
e && (e.edits = [...this.edits.values()].map((e) => ({ ...e })));
|
|
2314
|
+
}
|
|
2315
|
+
nextVersionId() {
|
|
2316
|
+
let e = 1;
|
|
2317
|
+
for (; this.versions.some((t) => t.id === `V${e}`);) e++;
|
|
2318
|
+
return `V${e}`;
|
|
2319
|
+
}
|
|
2320
|
+
switchVersion(e) {
|
|
2321
|
+
if (e === this.activeVersion) return;
|
|
2322
|
+
let t = e === null ? null : this.versions.find((t) => t.id === e);
|
|
2323
|
+
if (e !== null && !t) return;
|
|
2324
|
+
this.syncVersion(), this.pushUndo(), this.lastChange = null;
|
|
2325
|
+
let n = [...this.edits.values()];
|
|
2326
|
+
this.edits.clear();
|
|
2327
|
+
for (let e of t?.edits ?? []) this.edits.set(Z(e.site, e.role, e.key), { ...e });
|
|
2328
|
+
this.activeVersion = e, this.saveErrors.clear(), this.afterEdit(this.affected([...n, ...this.edits.values()]));
|
|
2329
|
+
}
|
|
2330
|
+
newVersion() {
|
|
2331
|
+
this.syncVersion(), this.pushUndo();
|
|
2332
|
+
let e = this.nextVersionId();
|
|
2333
|
+
return this.versions.push({
|
|
2334
|
+
id: e,
|
|
2335
|
+
name: e,
|
|
2336
|
+
edits: [...this.edits.values()].map((e) => ({ ...e }))
|
|
2337
|
+
}), this.activeVersion = e, this.persist(), this.emit("change"), e;
|
|
2338
|
+
}
|
|
2339
|
+
deleteVersion(e) {
|
|
2340
|
+
let t = this.versions.findIndex((t) => t.id === e);
|
|
2341
|
+
if (!(t < 0)) {
|
|
2342
|
+
if (this.activeVersion === e) {
|
|
2343
|
+
let e = this.versions[t - 1] ?? this.versions[t + 1];
|
|
2344
|
+
this.switchVersion(e ? e.id : null);
|
|
2345
|
+
}
|
|
2346
|
+
this.versions = this.versions.filter((t) => t.id !== e), this.persist(), this.emit("change");
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
storage() {
|
|
2350
|
+
try {
|
|
2351
|
+
return typeof sessionStorage < "u" ? sessionStorage : void 0;
|
|
2352
|
+
} catch {
|
|
2353
|
+
return;
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
persist() {
|
|
2357
|
+
clearTimeout(this.persistTimer), this.persistTimer = setTimeout(() => this.persistNow(), 150);
|
|
2358
|
+
}
|
|
2359
|
+
persistNow() {
|
|
2360
|
+
clearTimeout(this.persistTimer);
|
|
2361
|
+
let e = this.storage();
|
|
2362
|
+
if (!e) return;
|
|
2363
|
+
this.syncVersion();
|
|
2364
|
+
let t = {
|
|
2365
|
+
edits: [...this.edits.values(), ...this.restored],
|
|
2366
|
+
versions: this.versions,
|
|
2367
|
+
active: this.activeVersion,
|
|
2368
|
+
undo: this.undoStack,
|
|
2369
|
+
redo: this.redoStack
|
|
2370
|
+
};
|
|
2371
|
+
try {
|
|
2372
|
+
e.setItem(this.storeKey, JSON.stringify(t));
|
|
2373
|
+
} catch {}
|
|
2374
|
+
}
|
|
2375
|
+
loadPersisted() {
|
|
2376
|
+
let e = this.storage()?.getItem(this.storeKey);
|
|
2377
|
+
if (e) try {
|
|
2378
|
+
let t = JSON.parse(e);
|
|
2379
|
+
this.restored = t.edits ?? [], this.versions = t.versions ?? [], this.activeVersion = t.active ?? null, this.undoStack = t.undo ?? [], this.redoStack = t.redo ?? [];
|
|
2380
|
+
} catch {}
|
|
2381
|
+
}
|
|
2382
|
+
checkFile(e) {
|
|
2383
|
+
let t = e.file;
|
|
2384
|
+
if (this.checkedFiles.has(t)) return;
|
|
2385
|
+
this.checkedFiles.add(t);
|
|
2386
|
+
let n = (e) => a(e.site)?.file === t, i = [
|
|
2387
|
+
...this.restored,
|
|
2388
|
+
...this.versions.flatMap((e) => e.edits),
|
|
2389
|
+
...this.undoStack.flatMap((e) => e.edits),
|
|
2390
|
+
...this.redoStack.flatMap((e) => e.edits)
|
|
2391
|
+
].filter(n).filter((t) => t.hash && t.hash !== e.hash), o = () => {
|
|
2392
|
+
let e = this.restored.filter(n);
|
|
2393
|
+
this.restored = this.restored.filter((e) => !n(e));
|
|
2394
|
+
for (let t of e) {
|
|
2395
|
+
let e = Z(t.site, t.role, t.key);
|
|
2396
|
+
this.edits.set(e, t), t.conflict && this.saveErrors.set(e, {
|
|
2397
|
+
message: t.conflict,
|
|
2398
|
+
code: "conflict"
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
return e;
|
|
2402
|
+
};
|
|
2403
|
+
if (!i.length) {
|
|
2404
|
+
o();
|
|
2405
|
+
return;
|
|
2406
|
+
}
|
|
2407
|
+
let s = /* @__PURE__ */ new Map();
|
|
2408
|
+
for (let e of i) {
|
|
2409
|
+
let t = s.get(`${e.site}|${e.hash}`) ?? {
|
|
2410
|
+
site: e.site,
|
|
2411
|
+
hash: e.hash,
|
|
2412
|
+
keys: []
|
|
2413
|
+
};
|
|
2414
|
+
t.keys.some((t) => t.role === e.role && t.key === e.key) || t.keys.push({
|
|
2415
|
+
role: e.role,
|
|
2416
|
+
key: e.key
|
|
2417
|
+
}), s.set(`${e.site}|${e.hash}`, t);
|
|
2418
|
+
}
|
|
2419
|
+
fetch(U(r), {
|
|
2420
|
+
method: "POST",
|
|
2421
|
+
headers: { "content-type": "application/json" },
|
|
2422
|
+
body: JSON.stringify({ sites: [...s.values()] })
|
|
2423
|
+
}).then((e) => e.ok ? e.json() : { moved: {} }).catch(() => ({ moved: {} })).then(({ moved: r, conflicts: i = {} }) => {
|
|
2424
|
+
let a = 0, s = (t) => t.flatMap((t) => {
|
|
2425
|
+
if (!n(t) || !t.hash || t.hash === e.hash) return [t];
|
|
2426
|
+
let o = r[t.site];
|
|
2427
|
+
if (!o) return a++, [];
|
|
2428
|
+
let s = i[`${t.site}|${t.role}|${t.key}`];
|
|
2429
|
+
return [{
|
|
2430
|
+
...t,
|
|
2431
|
+
site: o,
|
|
2432
|
+
hash: e.hash,
|
|
2433
|
+
...s ? { conflict: s } : {}
|
|
2434
|
+
}];
|
|
2435
|
+
});
|
|
2436
|
+
this.restored = s(this.restored);
|
|
2437
|
+
let c = a;
|
|
2438
|
+
for (let e of this.versions) e.edits = s(e.edits);
|
|
2439
|
+
for (let e of [...this.undoStack, ...this.redoStack]) e.edits = s(e.edits);
|
|
2440
|
+
let l = o();
|
|
2441
|
+
c && (this.notice = `${c} unsaved change(s) in ${t} no longer match the code (it changed outside the editor) and were dropped.`), this.syncVersion();
|
|
2442
|
+
for (let e of new Set(l.map((e) => e.site))) this.rebuild(e);
|
|
2443
|
+
this.persist(), this.emit("change");
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
effectiveVars(e, t) {
|
|
2447
|
+
let n = t === "vars" ? e.vars : e.fromVars;
|
|
2448
|
+
if (!n) return;
|
|
2449
|
+
let r = { ...n }, i = e.meta[t]?.vars;
|
|
2450
|
+
if (i) for (let [t, n] of [...Object.entries(i.keys), ...Object.entries(i.fromSpread ?? {})]) {
|
|
2451
|
+
if (!n.binding) continue;
|
|
2452
|
+
let i = this.bindingEdit(e, n.binding);
|
|
2453
|
+
i && (r[t] = i.value);
|
|
2454
|
+
}
|
|
2455
|
+
for (let i of this.edits.values()) {
|
|
2456
|
+
if (i.site !== e.id || i.role !== t || i.key === "@position") continue;
|
|
2457
|
+
let a = Y(i.key), o = a && !(i.key in n) && (z.has(a[0]) || typeof n[a[0]] == "object");
|
|
2458
|
+
if (i.mode === "json") {
|
|
2459
|
+
let e = W(i.value);
|
|
2460
|
+
o ? r[a[0]] = {
|
|
2461
|
+
...r[a[0]],
|
|
2462
|
+
[a[1]]: e
|
|
2463
|
+
} : r[i.key] = e;
|
|
2464
|
+
} else if (i.mode === "remove") {
|
|
2465
|
+
if (o) {
|
|
2466
|
+
let e = { ...r[a[0]] };
|
|
2467
|
+
delete e[a[1]], r[a[0]] = e;
|
|
2468
|
+
} else delete r[i.key];
|
|
2469
|
+
} else o ? r[a[0]] = {
|
|
2470
|
+
...r[a[0]],
|
|
2471
|
+
[a[1]]: i.value
|
|
2472
|
+
} : r[i.key] = i.value;
|
|
2473
|
+
}
|
|
2474
|
+
return r;
|
|
2475
|
+
}
|
|
2476
|
+
moveBlocker(t) {
|
|
2477
|
+
let n = this.target(t);
|
|
2478
|
+
if (!n) return "Unknown";
|
|
2479
|
+
let r = this.entriesOf(t)[0];
|
|
2480
|
+
if (!r || r.positionIndex === void 0) return "Not in a timeline";
|
|
2481
|
+
if (n.anonymous || !(n.meta.vars ?? n.meta.fromVars)) return "This call was not tagged by the build transform";
|
|
2482
|
+
let i = this.authored(n, "vars", e);
|
|
2483
|
+
return i && !i.editable ? `Position is computed in code (${i.raw})` : null;
|
|
2484
|
+
}
|
|
2485
|
+
beginMove(t) {
|
|
2486
|
+
if (this.moveBlocker(t)) return null;
|
|
2487
|
+
let n = this.entriesOf(t)[0], r = n.owner.tl, i = n.child && n.kind !== "call" && n.kind !== "pause" ? n.child.delay() : 0, a = n.kind === "label" ? r.labels[n.label ?? ""] ?? 0 : (n.child?.startTime() ?? 0) - i;
|
|
2488
|
+
return {
|
|
2489
|
+
id: t,
|
|
2490
|
+
entry: n,
|
|
2491
|
+
raw: this.value(this.target(t), "vars", e),
|
|
2492
|
+
pos0: a,
|
|
2493
|
+
delay: i,
|
|
2494
|
+
own: n.child?.totalDuration() ?? 0,
|
|
2495
|
+
scale: this.scaleOf(r)
|
|
2496
|
+
};
|
|
2497
|
+
}
|
|
2498
|
+
applyMove(t, n) {
|
|
2499
|
+
let r = Math.max(0, t.pos0 + n * t.scale), i = l(t.raw, t.entry.ctx, r, t.own), a = this.authored(this.target(t.id), "vars", e);
|
|
2500
|
+
i === void 0 ? a || this.clearEdit(t.id, "vars", e) : this.setValue(t.id, "vars", e, i);
|
|
2501
|
+
}
|
|
2502
|
+
rebuild(e) {
|
|
2503
|
+
let t = /* @__PURE__ */ new Map(), n = (e, n) => {
|
|
2504
|
+
let r = n.timeline ?? n.entry?.owner;
|
|
2505
|
+
if (r) {
|
|
2506
|
+
let e = this.rootOf(r);
|
|
2507
|
+
t.has(e) || t.set(e, {
|
|
2508
|
+
seq: this.seqOf(e),
|
|
2509
|
+
timeline: e
|
|
2510
|
+
});
|
|
2511
|
+
} else t.set(n, {
|
|
2512
|
+
seq: n.seq,
|
|
2513
|
+
standalone: {
|
|
2514
|
+
site: e,
|
|
2515
|
+
inst: n
|
|
2516
|
+
}
|
|
2517
|
+
});
|
|
2518
|
+
}, r = this.sites.get(e);
|
|
2519
|
+
if (r) {
|
|
2520
|
+
for (let e of r.instances) n(r, e);
|
|
2521
|
+
let e = Math.min(...r.instances.map((e) => e.seq)), t = new Set(r.instances.flatMap((e) => e.targets));
|
|
2522
|
+
if (t.size) for (let r of this.sites.values()) for (let i of r.instances) i.seq > e && !i.timeline && !i.live && i.targets.some((e) => t.has(e)) && n(r, i);
|
|
2523
|
+
} else for (let n of this.markers.get(e)?.entries ?? []) {
|
|
2524
|
+
let e = this.rootOf(n.owner);
|
|
2525
|
+
t.set(e, {
|
|
2526
|
+
seq: this.seqOf(e),
|
|
2527
|
+
timeline: e
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2530
|
+
this.rebuildUnits([...t.values()]);
|
|
2531
|
+
}
|
|
2532
|
+
rebuildUnits(e) {
|
|
2533
|
+
let t = performance.now();
|
|
2534
|
+
try {
|
|
2535
|
+
this.rebuildUnitsNow(e);
|
|
2536
|
+
} finally {
|
|
2537
|
+
this.stats.rebuildMs = performance.now() - t, this.stats.rebuilds++;
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
rebuildUnitsNow(e) {
|
|
2541
|
+
e.sort((e, t) => e.seq - t.seq);
|
|
2542
|
+
let t = /* @__PURE__ */ new Map(), n = !1;
|
|
2543
|
+
this.internal = !0;
|
|
2544
|
+
try {
|
|
2545
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
2546
|
+
let i = e[r];
|
|
2547
|
+
if (i.standalone) n ||= !!this.stOf(i.standalone.inst.tween), i.standalone.inst.tween.revert();
|
|
2548
|
+
else if (i.timeline) {
|
|
2549
|
+
let e = this.stOf(i.timeline.tl);
|
|
2550
|
+
n ||= !!e;
|
|
2551
|
+
let r = this.scrollVars(i.timeline.site);
|
|
2552
|
+
r && q(r) !== i.timeline.stSig && (t.set(i.timeline, r), this.detachedSt.delete(e), e?.kill(!0, !0)), this.revertTimeline(i.timeline);
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
for (let n of e) if (n.standalone) this.recreate(n.standalone.site, n.standalone.inst);
|
|
2556
|
+
else if (n.timeline) {
|
|
2557
|
+
this.replayTimeline(n.timeline);
|
|
2558
|
+
let e = t.get(n.timeline), r = this.stClass();
|
|
2559
|
+
e && r?.create && (r.create({
|
|
2560
|
+
...e,
|
|
2561
|
+
animation: n.timeline.tl
|
|
2562
|
+
}), n.timeline.stSig = q(e), this.detach(n.timeline.tl));
|
|
2563
|
+
}
|
|
2564
|
+
} finally {
|
|
2565
|
+
this.internal = !1;
|
|
2566
|
+
}
|
|
2567
|
+
if (this.active) {
|
|
2568
|
+
for (let t of e) t.timeline && this.pauseRoot(t.timeline.tl);
|
|
2569
|
+
this.seek(this.time);
|
|
2570
|
+
}
|
|
2571
|
+
n && (!this.active || this.scrollLive) && this.refreshScroll();
|
|
2572
|
+
}
|
|
2573
|
+
revertTimeline(e) {
|
|
2574
|
+
for (let t = e.log.length - 1; t >= 0; t--) {
|
|
2575
|
+
let n = e.log[t];
|
|
2576
|
+
n.kind === "tween" ? n.child?.revert() : n.kind === "timeline" && n.childTimeline && this.revertTimeline(n.childTimeline);
|
|
2577
|
+
}
|
|
2578
|
+
e.tl.clear(!0);
|
|
2579
|
+
}
|
|
2580
|
+
replayTimeline(t) {
|
|
2581
|
+
let n = t.tl, r = this.effectiveVars(t.site, "vars") ?? {};
|
|
2582
|
+
r.defaults && typeof r.defaults == "object" && (n.vars.defaults = { ...r.defaults }), typeof r.repeat == "number" && n.repeat(r.repeat), typeof r.repeatDelay == "number" && n.repeatDelay(r.repeatDelay), typeof r.yoyo == "boolean" && n.yoyo(r.yoyo), typeof r.delay == "number" && n.delay(r.delay);
|
|
2583
|
+
for (let r of t.log) {
|
|
2584
|
+
let t = [...r.args], i = r.id === void 0 ? void 0 : this.getEdit(r.id, "vars", e);
|
|
2585
|
+
if (i && r.positionIndex !== void 0) {
|
|
2586
|
+
for (; t.length < r.positionIndex;) t.push(void 0);
|
|
2587
|
+
t[r.positionIndex] = i.value;
|
|
2588
|
+
}
|
|
2589
|
+
r.ctx = this.capture(n);
|
|
2590
|
+
let a = this.proto[r.method];
|
|
2591
|
+
if (r.kind === "tween" && r.site && r.inst) {
|
|
2592
|
+
if (r.inst.targets = this.liveTargets(r.inst.targets), r.method === "add") {
|
|
2593
|
+
let e = this.createTween(r.site, r.inst.targets);
|
|
2594
|
+
t[0] = e, a.apply(n, t), r.child = e;
|
|
2595
|
+
} else {
|
|
2596
|
+
let e = r.method === "fromTo" ? 2 : 1;
|
|
2597
|
+
Array.isArray(t[0]) && t[0] !== r.inst.targets && (t[0] = this.liveTargets(t[0])), t[e] = this.forEditor(this.effectiveVars(r.site, "vars")), r.method === "fromTo" && (t[1] = this.effectiveVars(r.site, "fromVars") ?? {}), a.apply(n, t), r.child = n.recent();
|
|
2598
|
+
}
|
|
2599
|
+
r.inst.tween = r.child, r.inst.editorMade = !0, this.byAnim.set(r.child, {
|
|
2600
|
+
site: r.site,
|
|
2601
|
+
inst: r.inst
|
|
2602
|
+
});
|
|
2603
|
+
} else r.kind === "timeline" && r.childTimeline ? (this.replayTimeline(r.childTimeline), r.childTimeline.tl.paused(!1), a.apply(n, t)) : (a.apply(n, t), (r.kind === "call" || r.kind === "pause") && (r.child = n.recent()));
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
forEditor(e) {
|
|
2607
|
+
if (!e) return e;
|
|
2608
|
+
let t = e.overwrite ? {
|
|
2609
|
+
...e,
|
|
2610
|
+
overwrite: !1
|
|
2611
|
+
} : { ...e };
|
|
2612
|
+
return G(t.scrollTrigger) && (t.scrollTrigger = { ...t.scrollTrigger }), t;
|
|
2613
|
+
}
|
|
2614
|
+
createTween(e, t) {
|
|
2615
|
+
let n = this.forEditor(this.effectiveVars(e, "vars"));
|
|
2616
|
+
if (e.method === "effect") {
|
|
2617
|
+
let r = this.effectFns.get(e.effect ?? "")?.(t, { ...n });
|
|
2618
|
+
return r && typeof r.totalTime == "function" ? r : this.original.set(t, {});
|
|
2619
|
+
}
|
|
2620
|
+
let r = e.method;
|
|
2621
|
+
return r === "fromTo" ? this.original.fromTo(t, this.effectiveVars(e, "fromVars") ?? {}, n) : this.original[r](t, n);
|
|
2622
|
+
}
|
|
2623
|
+
recreate(e, t) {
|
|
2624
|
+
t.targets = this.liveTargets(t.targets), t.tween = this.createTween(e, t.targets), t.editorMade = !0, this.byAnim.set(t.tween, {
|
|
2625
|
+
site: e,
|
|
2626
|
+
inst: t
|
|
2627
|
+
}), this.detach(t.tween), this.active && !this.free(t.tween) && (t.tween.pause(), this.editorPaused.add(t.tween), this.seekInstance(t));
|
|
2628
|
+
}
|
|
2629
|
+
async save() {
|
|
2630
|
+
if (!this.edits.size || this.saveState.status === "saving") return;
|
|
2631
|
+
let e = [...this.edits.values()].filter((e) => e.conflict), t = [...this.edits.values()].filter((e) => !e.conflict);
|
|
2632
|
+
if (!t.length) {
|
|
2633
|
+
for (let t of e) this.saveErrors.set(Z(t.site, t.role, t.key), {
|
|
2634
|
+
message: t.conflict,
|
|
2635
|
+
code: "conflict"
|
|
2636
|
+
});
|
|
2637
|
+
this.saveState = {
|
|
2638
|
+
status: "error",
|
|
2639
|
+
message: `${e.length} change(s) conflict with the code`
|
|
2640
|
+
}, this.emit("change");
|
|
2641
|
+
return;
|
|
2642
|
+
}
|
|
2643
|
+
let r = new Map(t.map((e) => [Z(e.site, e.role, e.key), this.codeValue(e)]));
|
|
2644
|
+
this.saveState = { status: "saving" }, this.emit("change");
|
|
2645
|
+
let i = performance.now();
|
|
2646
|
+
try {
|
|
2647
|
+
let i = await fetch(U(n), {
|
|
2648
|
+
method: "POST",
|
|
2649
|
+
headers: { "content-type": "application/json" },
|
|
2650
|
+
body: JSON.stringify({ edits: t })
|
|
2651
|
+
});
|
|
2652
|
+
if (i.status === 404) {
|
|
2653
|
+
this.saveState = { status: "offline" }, this.emit("change");
|
|
2654
|
+
return;
|
|
2655
|
+
}
|
|
2656
|
+
let a = await i.json();
|
|
2657
|
+
this.saveErrors.clear();
|
|
2658
|
+
let o = [];
|
|
2659
|
+
for (let e of a.results) {
|
|
2660
|
+
let t = Z(e.site, e.role, e.key), n = this.edits.get(t);
|
|
2661
|
+
e.ok ? (n && o.push(n), this.edits.delete(t)) : this.saveErrors.set(t, {
|
|
2662
|
+
message: e.error ?? "Save failed",
|
|
2663
|
+
code: e.code ?? "structure"
|
|
2664
|
+
});
|
|
2665
|
+
}
|
|
2666
|
+
for (let t of e) this.saveErrors.set(Z(t.site, t.role, t.key), {
|
|
2667
|
+
message: t.conflict,
|
|
2668
|
+
code: "conflict"
|
|
2669
|
+
});
|
|
2670
|
+
this.rebaseAfterSave(o, r, a);
|
|
2671
|
+
let s = t.length + e.length;
|
|
2672
|
+
this.saveState = a.ok && !e.length ? {
|
|
2673
|
+
status: "saved",
|
|
2674
|
+
files: a.files
|
|
2675
|
+
} : {
|
|
2676
|
+
status: "error",
|
|
2677
|
+
message: `Saved ${o.length} of ${s}`
|
|
2678
|
+
};
|
|
2679
|
+
} catch (e) {
|
|
2680
|
+
this.saveState = {
|
|
2681
|
+
status: "error",
|
|
2682
|
+
message: e.message
|
|
2683
|
+
};
|
|
2684
|
+
}
|
|
2685
|
+
this.stats.saveMs = performance.now() - i, this.syncVersion(), this.persistNow(), this.emit("change");
|
|
2686
|
+
}
|
|
2687
|
+
codeValue(e) {
|
|
2688
|
+
let t = this.target(e.site), n = t ? this.authored(t, e.role, e.key) : void 0;
|
|
2689
|
+
return n ? e.mode === "binding" || e.mode === "override" ? n.binding ? {
|
|
2690
|
+
kind: "literal",
|
|
2691
|
+
value: n.binding.value
|
|
2692
|
+
} : { kind: "unknown" } : e.mode === "json" ? n.json === void 0 ? { kind: "unknown" } : {
|
|
2693
|
+
kind: "literal",
|
|
2694
|
+
value: n.json
|
|
2695
|
+
} : "value" in n && n.value !== void 0 ? {
|
|
2696
|
+
kind: "literal",
|
|
2697
|
+
value: n.value
|
|
2698
|
+
} : { kind: "unknown" } : { kind: "absent" };
|
|
2699
|
+
}
|
|
2700
|
+
rebaseAfterSave(e, t, n) {
|
|
2701
|
+
let r = (n) => {
|
|
2702
|
+
let r = new Map(n.map((e) => [Z(e.site, e.role, e.key), e]));
|
|
2703
|
+
for (let n of e) {
|
|
2704
|
+
let e = Z(n.site, n.role, n.key), i = r.get(e), a = t.get(e);
|
|
2705
|
+
i ? (i.mode ?? "value") === (n.mode ?? "value") && i.value === n.value && r.delete(e) : n.key !== "@position" && a && a.kind !== "unknown" && (a.kind === "absent" ? r.set(e, {
|
|
2706
|
+
...n,
|
|
2707
|
+
mode: "remove",
|
|
2708
|
+
value: 0
|
|
2709
|
+
}) : r.set(e, {
|
|
2710
|
+
...n,
|
|
2711
|
+
mode: n.mode === "binding" || n.mode === "json" ? n.mode : "value",
|
|
2712
|
+
value: a.value
|
|
2713
|
+
}));
|
|
2714
|
+
}
|
|
2715
|
+
return [...r.values()];
|
|
2716
|
+
};
|
|
2717
|
+
for (let e of [...this.undoStack, ...this.redoStack]) e.edits = r(e.edits);
|
|
2718
|
+
for (let e of this.versions) e.id !== this.activeVersion && (e.edits = r(e.edits));
|
|
2719
|
+
let i = new Set(n.results.filter((e) => e.movedTo).map((e) => a(e.site)?.file)), o = n.hashes ?? {}, s = (e) => {
|
|
2720
|
+
let t = a(e.site)?.file;
|
|
2721
|
+
t && o[t] && !i.has(t) && (e.hash = o[t]);
|
|
2722
|
+
};
|
|
2723
|
+
for (let e of this.edits.values()) s(e);
|
|
2724
|
+
for (let e of this.restored) s(e);
|
|
2725
|
+
for (let e of this.versions) e.edits.forEach(s);
|
|
2726
|
+
for (let e of [...this.undoStack, ...this.redoStack]) e.edits.forEach(s);
|
|
2727
|
+
}
|
|
2728
|
+
};
|
|
2729
|
+
function fe(e) {
|
|
2730
|
+
let t = globalThis.__DOPESHEET__;
|
|
2731
|
+
return t instanceof $ ? t : new $(e).install();
|
|
2732
|
+
}
|
|
2733
|
+
export { ae as a, e as c, F as i, fe as n, ie as o, I as r, i as s, Q as t };
|
|
2734
|
+
|
|
2735
|
+
//# sourceMappingURL=src-C-7lxf9e.js.map
|