@ssgoi/core 7.3.0-beta.3 → 7.3.0-beta.4

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.
@@ -1,12 +1,12 @@
1
- var at = Object.defineProperty;
2
- var lt = (s, r, t) => r in s ? at(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t;
3
- var h = (s, r, t) => lt(s, typeof r != "symbol" ? r + "" : r, t);
4
- import { A as ht, c as U, a as ct, r as ut, i as dt, s as ft, I as pt } from "./provider-BLf6XeXT.js";
5
- const E = {
1
+ var ut = Object.defineProperty;
2
+ var dt = (s, n, t) => n in s ? ut(s, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[n] = t;
3
+ var h = (s, n, t) => dt(s, typeof n != "symbol" ? n + "" : n, t);
4
+ import { A as ft, c as U, a as pt, r as mt, i as gt, s as yt, I as vt } from "./provider-BLf6XeXT.js";
5
+ const j = {
6
6
  reason: "finished",
7
7
  owns: () => !0
8
8
  };
9
- class st extends ht {
9
+ class nt extends ft {
10
10
  constructor() {
11
11
  super(...arguments);
12
12
  h(this, "_startCondition");
@@ -60,72 +60,72 @@ class st extends ht {
60
60
  throw new Error("This animation does not support replacing its integrator");
61
61
  }
62
62
  }
63
- const L = [1, 0, 0, 1, 0, 0], it = (s, r) => [
64
- s[0] * r[0] + s[2] * r[1],
65
- s[1] * r[0] + s[3] * r[1],
66
- s[0] * r[2] + s[2] * r[3],
67
- s[1] * r[2] + s[3] * r[3],
68
- s[0] * r[4] + s[2] * r[5] + s[4],
69
- s[1] * r[4] + s[3] * r[5] + s[5]
63
+ const L = [1, 0, 0, 1, 0, 0], rt = (s, n) => [
64
+ s[0] * n[0] + s[2] * n[1],
65
+ s[1] * n[0] + s[3] * n[1],
66
+ s[0] * n[2] + s[2] * n[3],
67
+ s[1] * n[2] + s[3] * n[3],
68
+ s[0] * n[4] + s[2] * n[5] + s[4],
69
+ s[1] * n[4] + s[3] * n[5] + s[5]
70
70
  ];
71
- function Y(s) {
72
- const r = s[0] * s[3] - s[1] * s[2];
73
- return Math.abs(r) < 1e-10 ? null : [
74
- s[3] / r,
75
- -s[1] / r,
76
- -s[2] / r,
77
- s[0] / r,
78
- (s[2] * s[5] - s[3] * s[4]) / r,
79
- (s[1] * s[4] - s[0] * s[5]) / r
71
+ function J(s) {
72
+ const n = s[0] * s[3] - s[1] * s[2];
73
+ return Math.abs(n) < 1e-10 ? null : [
74
+ s[3] / n,
75
+ -s[1] / n,
76
+ -s[2] / n,
77
+ s[0] / n,
78
+ (s[2] * s[5] - s[3] * s[4]) / n,
79
+ (s[1] * s[4] - s[0] * s[5]) / n
80
80
  ];
81
81
  }
82
- const P = (s, r) => [1, 0, 0, 1, s, r], H = (s, r) => [s, 0, 0, r, 0, 0];
83
- function mt(s, r, t) {
82
+ const B = (s, n) => [1, 0, 0, 1, s, n], H = (s, n) => [s, 0, 0, n, 0, 0];
83
+ function bt(s, n, t) {
84
84
  if (!s || s === "none") return [...L];
85
85
  let e = [...L];
86
86
  const i = /([a-zA-Z][a-zA-Z0-9]*)\(([^()]*)\)/g;
87
- let o = "";
88
- for (const d of s.matchAll(i)) {
89
- o += d[0];
90
- const f = d[1].toLowerCase(), c = d[2].trim().split(/\s*,\s*|\s+/);
91
- if (c.some(
92
- (n) => !/^[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?(?:px|%|deg|rad|turn)?$/i.test(
93
- n
87
+ let l = "";
88
+ for (const c of s.matchAll(i)) {
89
+ l += c[0];
90
+ const u = c[1].toLowerCase(), d = c[2].trim().split(/\s*,\s*|\s+/);
91
+ if (d.some(
92
+ (r) => !/^[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?(?:px|%|deg|rad|turn)?$/i.test(
93
+ r
94
94
  )
95
95
  ))
96
96
  return null;
97
- const m = c.map(Number.parseFloat);
98
- if (m.some((n) => !Number.isFinite(n))) return null;
99
- const g = (n, y) => {
97
+ const m = d.map(Number.parseFloat);
98
+ if (m.some((r) => !Number.isFinite(r))) return null;
99
+ const y = (r, g) => {
100
100
  var a;
101
- return m[n] * ((a = c[n]) != null && a.endsWith("%") ? y / 100 : 1);
102
- }, u = (n) => {
103
- var y, a;
104
- return m[n] * ((y = c[n]) != null && y.endsWith("rad") ? 1 : (a = c[n]) != null && a.endsWith("turn") ? 2 * Math.PI : Math.PI / 180);
101
+ return m[r] * ((a = d[r]) != null && a.endsWith("%") ? g / 100 : 1);
102
+ }, f = (r) => {
103
+ var g, a;
104
+ return m[r] * ((g = d[r]) != null && g.endsWith("rad") ? 1 : (a = d[r]) != null && a.endsWith("turn") ? 2 * Math.PI : Math.PI / 180);
105
105
  };
106
- let l;
107
- if (f === "matrix" && m.length === 6) l = m;
108
- else if (f === "translate" || f === "translate3d") {
109
- if (f === "translate3d" && m[2] !== 0) return null;
110
- l = P(g(0, r), c[1] ? g(1, t) : 0);
111
- } else if (f === "translatex") l = P(g(0, r), 0);
112
- else if (f === "translatey") l = P(0, g(0, t));
113
- else if (f === "translatez" && m[0] === 0) l = [...L];
114
- else if (f === "scale") l = H(m[0], m[1] ?? m[0]);
115
- else if (f === "scalex") l = H(m[0], 1);
116
- else if (f === "scaley") l = H(1, m[0]);
117
- else if (f === "rotate" || f === "rotatez") {
118
- const n = u(0);
119
- l = [Math.cos(n), Math.sin(n), -Math.sin(n), Math.cos(n), 0, 0];
106
+ let o;
107
+ if (u === "matrix" && m.length === 6) o = m;
108
+ else if (u === "translate" || u === "translate3d") {
109
+ if (u === "translate3d" && m[2] !== 0) return null;
110
+ o = B(y(0, n), d[1] ? y(1, t) : 0);
111
+ } else if (u === "translatex") o = B(y(0, n), 0);
112
+ else if (u === "translatey") o = B(0, y(0, t));
113
+ else if (u === "translatez" && m[0] === 0) o = [...L];
114
+ else if (u === "scale") o = H(m[0], m[1] ?? m[0]);
115
+ else if (u === "scalex") o = H(m[0], 1);
116
+ else if (u === "scaley") o = H(1, m[0]);
117
+ else if (u === "rotate" || u === "rotatez") {
118
+ const r = f(0);
119
+ o = [Math.cos(r), Math.sin(r), -Math.sin(r), Math.cos(r), 0, 0];
120
120
  } else return null;
121
- e = it(e, l);
121
+ e = rt(e, o);
122
122
  }
123
- return o.replace(/\s/g, "") === s.replace(/\s/g, "") ? e : null;
123
+ return l.replace(/\s/g, "") === s.replace(/\s/g, "") ? e : null;
124
124
  }
125
- function G(s, r) {
126
- return { schema: s, value: r, velocity: r.map(() => 0) };
125
+ function Q(s, n) {
126
+ return { schema: s, value: n, velocity: n.map(() => 0) };
127
127
  }
128
- const J = /[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/gi, _ = (s) => [
128
+ const tt = /[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/gi, _ = (s) => [
129
129
  s[0],
130
130
  s[2],
131
131
  s[4],
@@ -136,137 +136,140 @@ const J = /[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/gi, _ = (s) => [
136
136
  0,
137
137
  1
138
138
  ];
139
- function T(s, r) {
139
+ function P(s, n) {
140
140
  return Array.from({ length: 9 }, (t, e) => {
141
- const i = Math.floor(e / 3), o = e % 3;
142
- return s[i * 3] * r[o] + s[i * 3 + 1] * r[o + 3] + s[i * 3 + 2] * r[o + 6];
141
+ const i = Math.floor(e / 3), l = e % 3;
142
+ return s[i * 3] * n[l] + s[i * 3 + 1] * n[l + 3] + s[i * 3 + 2] * n[l + 6];
143
143
  });
144
144
  }
145
- function rt(s) {
146
- return Math.abs(s[8]) < 1e-8 || !s.every(Number.isFinite) ? null : s.map((r) => r / s[8]);
145
+ function ot(s) {
146
+ return Math.abs(s[8]) < 1e-8 || !s.every(Number.isFinite) ? null : s.map((n) => n / s[8]);
147
147
  }
148
- function Q(s, r, t) {
149
- const e = mt(s, r, t);
148
+ function et(s, n, t) {
149
+ const e = bt(s, n, t);
150
150
  if (e) return _(e);
151
151
  if (typeof DOMMatrix > "u") return null;
152
152
  const i = s.replace(
153
153
  /(translate(?:3d|X|Y)?)\(([^()]*)\)/gi,
154
- (o, d, f) => {
155
- const c = f.split(/\s*,\s*|\s+/).map((m, g) => {
154
+ (l, c, u) => {
155
+ const d = u.split(/\s*,\s*|\s+/).map((m, y) => {
156
156
  if (!m.endsWith("%")) return m;
157
- const u = d.toLowerCase() === "translatey" || g === 1 ? t : r;
158
- return `${Number.parseFloat(m) * u / 100}px`;
157
+ const f = c.toLowerCase() === "translatey" || y === 1 ? t : n;
158
+ return `${Number.parseFloat(m) * f / 100}px`;
159
159
  });
160
- return `${d}(${c.join(",")})`;
160
+ return `${c}(${d.join(",")})`;
161
161
  }
162
162
  );
163
163
  try {
164
- const o = new DOMMatrix(i);
165
- return rt([
166
- o.m11,
167
- o.m21,
168
- o.m41,
169
- o.m12,
170
- o.m22,
171
- o.m42,
172
- o.m14,
173
- o.m24,
174
- o.m44
164
+ const l = new DOMMatrix(i);
165
+ return ot([
166
+ l.m11,
167
+ l.m21,
168
+ l.m41,
169
+ l.m12,
170
+ l.m22,
171
+ l.m42,
172
+ l.m14,
173
+ l.m24,
174
+ l.m44
175
175
  ]);
176
176
  } catch {
177
177
  return null;
178
178
  }
179
179
  }
180
- const tt = "viewport-plane-v1";
181
- function $(s) {
182
- var S;
183
- const r = s.offsetWidth || 1, t = s.offsetHeight || 1, e = typeof getComputedStyle == "function" ? getComputedStyle(s) : null, i = ((e == null ? void 0 : e.transformOrigin) || `${r / 2}px ${t / 2}px`).split(" "), o = Number.parseFloat(i[0]) || 0, d = Number.parseFloat(i[1]) || 0;
184
- let f = !0;
185
- if (typeof getComputedStyle == "function")
186
- for (let C = s.parentElement; C; C = C.parentElement) {
187
- const w = getComputedStyle(C);
188
- if (w.transform && w.transform !== "none" || w.perspective && w.perspective !== "none") {
189
- f = !1;
180
+ const st = "viewport-plane-v1";
181
+ function E(s, n) {
182
+ var X;
183
+ const t = s.offsetWidth || 1, e = s.offsetHeight || 1, i = typeof getComputedStyle == "function" ? getComputedStyle(s) : null, l = ((i == null ? void 0 : i.transformOrigin) || `${t / 2}px ${e / 2}px`).split(" "), c = Number.parseFloat(l[0]) || 0, u = Number.parseFloat(l[1]) || 0;
184
+ let d = !0, m = !!n && n.container !== s && n.container.contains(s) && (i == null ? void 0 : i.position) !== "fixed";
185
+ if (typeof getComputedStyle == "function") {
186
+ let S = m;
187
+ for (let w = s.parentElement; w; w = w.parentElement) {
188
+ w === (n == null ? void 0 : n.container) && (S = !1);
189
+ const C = getComputedStyle(w);
190
+ if (S && C.position === "fixed" && (m = !1), C.transform && C.transform !== "none" || C.perspective && C.perspective !== "none") {
191
+ d = !1;
190
192
  break;
191
193
  }
192
194
  }
193
- const c = (S = s.getBoundingClientRect) == null ? void 0 : S.call(s), m = Q((e == null ? void 0 : e.transform) || "", r, t) ?? _(L), g = T(
194
- T(_(P(o, d)), m),
195
- _(P(-o, -d))
196
- ), u = [
195
+ }
196
+ const y = m ? n.container.scrollLeft - n.x : 0, f = m ? n.container.scrollTop - n.y : 0, o = (X = s.getBoundingClientRect) == null ? void 0 : X.call(s), r = et((i == null ? void 0 : i.transform) || "", t, e) ?? _(L), g = P(
197
+ P(_(B(c, u)), r),
198
+ _(B(-c, -u))
199
+ ), a = [
197
200
  [0, 0],
198
- [r, 0],
199
- [0, t],
200
- [r, t]
201
- ].map(([C, w]) => {
202
- const k = g[6] * C + g[7] * w + g[8];
201
+ [t, 0],
202
+ [0, e],
203
+ [t, e]
204
+ ].map(([S, w]) => {
205
+ const C = g[6] * S + g[7] * w + g[8];
203
206
  return [
204
- (g[0] * C + g[1] * w + g[2]) / k,
205
- (g[3] * C + g[4] * w + g[5]) / k
207
+ (g[0] * S + g[1] * w + g[2]) / C,
208
+ (g[3] * S + g[4] * w + g[5]) / C
206
209
  ];
207
- }), l = ((c == null ? void 0 : c.left) ?? 0) - Math.min(...u.map((C) => C[0])), n = ((c == null ? void 0 : c.top) ?? 0) - Math.min(...u.map((C) => C[1])), y = P(l + o, n + d), a = it(P(-o, -d), H(r, t)), p = _(Y(y)), b = _(Y(a));
210
+ }), p = ((o == null ? void 0 : o.left) ?? 0) + y - Math.min(...a.map((S) => S[0])), v = ((o == null ? void 0 : o.top) ?? 0) + f - Math.min(...a.map((S) => S[1])), k = B(p + c, v + u), Z = rt(B(-c, -u), H(t, e)), ht = _(J(k)), ct = _(J(Z));
208
211
  return {
209
- frame: f ? { left: l, top: n, width: r, height: t } : void 0,
210
- read(C) {
212
+ frame: d ? { left: p, top: v, width: t, height: e } : void 0,
213
+ read(S) {
211
214
  const w = {};
212
- for (const [k, A] of Object.entries(C)) {
215
+ for (const [C, A] of Object.entries(S)) {
213
216
  const M = String(A);
214
- if (k === "transform") {
215
- if (!f) continue;
216
- const R = Q(M, r, t), x = R && rt(T(T(_(y), R), _(a)));
217
- if (x) {
218
- const [j, N, I, O, V, B, D, v] = x, q = j - I * D, z = O - B * D, Z = N - I * v, X = V - B * v, W = Math.hypot(q, z);
219
- if (W > 1e-8) {
220
- w[k] = G(tt, [
217
+ if (C === "transform") {
218
+ if (!d) continue;
219
+ const R = et(M, t, e), T = R && ot(P(P(_(k), R), _(Z)));
220
+ if (T) {
221
+ const [N, q, I, O, V, x, D, b] = T, z = N - I * D, W = O - x * D, Y = q - I * b, G = V - x * b, $ = Math.hypot(z, W);
222
+ if ($ > 1e-8) {
223
+ w[C] = Q(st, [
221
224
  I,
222
- B,
223
- Math.atan2(z, q),
224
- W,
225
- (q * X - z * Z) / W,
226
- (q * Z + z * X) / W,
225
+ x,
226
+ Math.atan2(W, z),
227
+ $,
228
+ (z * G - W * Y) / $,
229
+ (z * Y + W * G) / $,
227
230
  D,
228
- v
231
+ b
229
232
  ]);
230
233
  continue;
231
234
  }
232
235
  }
233
236
  }
234
- const F = [...M.matchAll(J)].map(
237
+ const F = [...M.matchAll(tt)].map(
235
238
  (R) => Number(R[0])
236
239
  );
237
- F.length && F.every(Number.isFinite) && (w[k] = G(
238
- `css:${M.replace(J, "#")}`,
240
+ F.length && F.every(Number.isFinite) && (w[C] = Q(
241
+ `css:${M.replace(tt, "#")}`,
239
242
  F
240
243
  ));
241
244
  }
242
245
  return w;
243
246
  },
244
- write(C) {
247
+ write(S) {
245
248
  const w = {};
246
- for (const [k, A] of Object.entries(C))
247
- if (k === "transform" && A.schema === tt) {
248
- const [M, F, R, x, j, N, I, O] = A.value, V = Math.cos(R), B = Math.sin(R), D = [
249
- V * x + M * I,
250
- V * N - B * j + M * O,
249
+ for (const [C, A] of Object.entries(S))
250
+ if (C === "transform" && A.schema === st) {
251
+ const [M, F, R, T, N, q, I, O] = A.value, V = Math.cos(R), x = Math.sin(R), D = [
252
+ V * T + M * I,
253
+ V * q - x * N + M * O,
251
254
  M,
252
- B * x + F * I,
253
- B * N + V * j + F * O,
255
+ x * T + F * I,
256
+ x * q + V * N + F * O,
254
257
  F,
255
258
  I,
256
259
  O,
257
260
  1
258
- ], v = T(T(p, D), b);
259
- Math.abs(v[6]) + Math.abs(v[7]) < 1e-10 && Math.abs(v[8] - 1) < 1e-10 ? w[k] = `matrix(${[v[0], v[3], v[1], v[4], v[2], v[5]].join(",")})` : w[k] = `matrix3d(${[v[0], v[3], 0, v[6], v[1], v[4], 0, v[7], 0, 0, 1, 0, v[2], v[5], 0, v[8]].join(",")})`;
261
+ ], b = P(P(ht, D), ct);
262
+ Math.abs(b[6]) + Math.abs(b[7]) < 1e-10 && Math.abs(b[8] - 1) < 1e-10 ? w[C] = `matrix(${[b[0], b[3], b[1], b[4], b[2], b[5]].join(",")})` : w[C] = `matrix3d(${[b[0], b[3], 0, b[6], b[1], b[4], 0, b[7], 0, 0, 1, 0, b[2], b[5], 0, b[8]].join(",")})`;
260
263
  } else if (A.schema.startsWith("css:")) {
261
264
  let M = 0;
262
- w[k] = A.schema.slice(4).replace(/#/g, () => String(A.value[M++]));
265
+ w[C] = A.schema.slice(4).replace(/#/g, () => String(A.value[M++]));
263
266
  }
264
267
  return w;
265
268
  }
266
269
  };
267
270
  }
268
- const gt = 1e3 / 60;
269
- class nt extends st {
271
+ const wt = 1e3 / 60;
272
+ class at extends nt {
270
273
  constructor(t) {
271
274
  super();
272
275
  h(this, "_element");
@@ -293,6 +296,7 @@ class nt extends st {
293
296
  h(this, "legacyCompletionCleanup");
294
297
  h(this, "motion");
295
298
  h(this, "codec");
299
+ h(this, "viewport");
296
300
  h(this, "adopted");
297
301
  h(this, "presentationFrames", []);
298
302
  h(this, "hold", null);
@@ -374,8 +378,8 @@ class nt extends st {
374
378
  }
375
379
  }
376
380
  finish() {
377
- var t, e, i, o;
378
- this.presentationTime = ((t = this.frames[this.frames.length - 1]) == null ? void 0 : t.time) ?? 0, this.solverState = void 0, (e = this.hold) == null || e.cancel(), this.hold = null, this.applyStyleAt(this.currentValue), this.clearWaapi(), (i = this.fallbackCopy) == null || i.cancel({ reason: "disposed", owns: () => !0 }), this.fallbackCopy = null, this.deferDisposal || this.disposeResources(E), (o = this.onComplete) == null || o.call(this);
381
+ var t, e, i, l;
382
+ this.presentationTime = ((t = this.frames[this.frames.length - 1]) == null ? void 0 : t.time) ?? 0, this.solverState = void 0, (e = this.hold) == null || e.cancel(), this.hold = null, this.applyStyleAt(this.currentValue), this.clearWaapi(), (i = this.fallbackCopy) == null || i.cancel({ reason: "disposed", owns: () => !0 }), this.fallbackCopy = null, this.deferDisposal || this.disposeResources(j), (l = this.onComplete) == null || l.call(this);
379
383
  }
380
384
  get motionIdentity() {
381
385
  return {
@@ -386,38 +390,51 @@ class nt extends st {
386
390
  lifetime: this.motion.lifetime
387
391
  };
388
392
  }
393
+ /**
394
+ * Read the element's rendered box while the scene is laid out for this run.
395
+ * The next navigation snapshots this track only after the framework has
396
+ * unmounted the element or an Activity hide has taken it out of flow, so a
397
+ * box measured at that point is empty or shifted and the handoff would
398
+ * decode the pose against the wrong frame. Playback never needs this; an
399
+ * uninterrupted run still decodes nothing.
400
+ */
401
+ measure(t) {
402
+ if (this.viewport = t ?? this.viewport, this.codec) return;
403
+ const e = this._element;
404
+ !e.isConnected || !(e.offsetWidth || e.offsetHeight) || (this.codec = this.motion.codec ?? E(e, this.viewport));
405
+ }
389
406
  /** Final output, including any earlier residual, is the next handoff's source. */
390
407
  getMotionSnapshot() {
391
- var o, d;
408
+ var l, c;
392
409
  this.running && this.captureLiveState();
393
410
  const t = this.samplePresentation(
394
- et(this.waapi) ?? this.presentationTime
411
+ it(this.waapi) ?? this.presentationTime
395
412
  ), e = this.paused ? 0 : this.playbackRate, i = {
396
413
  ...this.styleFn(
397
414
  this.currentValue,
398
415
  this.lowerBound + this.upperBound - this.currentValue
399
416
  ),
400
- ...(o = this.codec) == null ? void 0 : o.write(t)
417
+ ...(l = this.codec) == null ? void 0 : l.write(t)
401
418
  };
402
419
  return {
403
420
  ...this.motionIdentity,
404
421
  displayStyle: i,
405
422
  inlineStyle: this.element.style.cssText,
406
- frame: (d = this.codec) == null ? void 0 : d.frame,
423
+ frame: (c = this.codec) == null ? void 0 : c.frame,
407
424
  channels: Object.fromEntries(
408
- Object.entries(t).map(([f, c]) => [
409
- f,
425
+ Object.entries(t).map(([u, d]) => [
426
+ u,
410
427
  {
411
- ...c,
412
- velocity: c.velocity.map((m) => m * e)
428
+ ...d,
429
+ velocity: d.velocity.map((m) => m * e)
413
430
  }
414
431
  ])
415
432
  )
416
433
  };
417
434
  }
418
435
  adopt(t) {
419
- var f, c, m, g, u;
420
- this.codec ?? (this.codec = this.motion.codec ?? $(this.element)), this.adopted = t;
436
+ var u, d, m, y, f;
437
+ this.codec ?? (this.codec = this.motion.codec ?? E(this.element, this.viewport)), this.adopted = t;
421
438
  const e = this.codec.read({
422
439
  transform: "none",
423
440
  opacity: 1,
@@ -430,51 +447,51 @@ class nt extends st {
430
447
  const i = this.styleFn(
431
448
  this.currentValue,
432
449
  this.lowerBound + this.upperBound - this.currentValue
433
- ), o = t.displayStyle;
434
- for (const [l, n] of Object.entries(o ?? {}))
435
- l in i && String(n) !== String(i[l]) && (!t.channels[l] || !e[l]) && this.fallbackChannels.add(l);
436
- for (const [l, n] of Object.entries(t.channels)) {
437
- const y = e[l];
438
- y && !U(n, y) && this.fallbackChannels.add(l);
450
+ ), l = t.displayStyle;
451
+ for (const [o, r] of Object.entries(l ?? {}))
452
+ o in i && String(r) !== String(i[o]) && (!t.channels[o] || !e[o]) && this.fallbackChannels.add(o);
453
+ for (const [o, r] of Object.entries(t.channels)) {
454
+ const g = e[o];
455
+ g && !U(r, g) && this.fallbackChannels.add(o);
439
456
  }
440
457
  if (this.fallbackChannels.size && (this.fallbackMode = "finish"), this.fallbackChannels.size && this.motion.fallback !== "finish") {
441
- const l = t;
442
- if (l.frame && l.displayStyle && t.target.cloneNode && t.target.parentElement && !t.target.shadowRoot && !((c = (f = t.target).matches) != null && c.call(
443
- f,
458
+ const o = t;
459
+ if (o.frame && o.displayStyle && t.target.cloneNode && t.target.parentElement && !t.target.shadowRoot && !((d = (u = t.target).matches) != null && d.call(
460
+ u,
444
461
  "canvas, video, audio, iframe, object, embed"
445
- )) && !((g = (m = t.target).querySelector) != null && g.call(
462
+ )) && !((y = (m = t.target).querySelector) != null && y.call(
446
463
  m,
447
464
  "canvas, video, audio, iframe, object, embed"
448
465
  ))) {
449
466
  this.fallbackMode = "crossfade";
450
- const n = t.target.cloneNode(!0);
451
- n.removeAttribute("id"), n.removeAttribute("data-ssgoi-transition");
452
- for (const a of n.querySelectorAll(
467
+ const r = t.target.cloneNode(!0);
468
+ r.removeAttribute("id"), r.removeAttribute("data-ssgoi-transition");
469
+ for (const a of r.querySelectorAll(
453
470
  "[id], [data-ssgoi-transition]"
454
471
  ))
455
472
  a.removeAttribute("id"), a.removeAttribute("data-ssgoi-transition");
456
- n.style.cssText = l.inlineStyle ?? "", Object.assign(n.style, l.displayStyle, {
473
+ r.style.cssText = o.inlineStyle ?? "", Object.assign(r.style, o.displayStyle, {
457
474
  position: "fixed",
458
- left: `${l.frame.left}px`,
459
- top: `${l.frame.top}px`,
460
- width: `${l.frame.width}px`,
461
- height: `${l.frame.height}px`,
475
+ left: `${o.frame.left}px`,
476
+ top: `${o.frame.top}px`,
477
+ width: `${o.frame.width}px`,
478
+ height: `${o.frame.height}px`,
462
479
  margin: "0",
463
480
  pointerEvents: "none",
464
481
  zIndex: "2147483646"
465
- }), n.setAttribute("aria-hidden", "true"), n.inert = !0, t.target.parentElement.appendChild(n);
466
- const y = Number(l.displayStyle.opacity ?? 1);
467
- this.fallbackCopy = new nt({
468
- element: n,
482
+ }), r.setAttribute("aria-hidden", "true"), r.inert = !0, t.target.parentElement.appendChild(r);
483
+ const g = Number(o.displayStyle.opacity ?? 1);
484
+ this.fallbackCopy = new at({
485
+ element: r,
469
486
  integrator: {
470
- step: (a, p, b) => ({
471
- position: Math.min(p, a.position + b / 0.18),
487
+ step: (a, p, v) => ({
488
+ position: Math.min(p, a.position + v / 0.18),
472
489
  velocity: 0
473
490
  }),
474
491
  isSettled: (a, p) => a.position >= p
475
492
  },
476
- style: (a, p) => ({ opacity: y * p }),
477
- onDispose: () => n.remove()
493
+ style: (a, p) => ({ opacity: g * p }),
494
+ onDispose: () => r.remove()
478
495
  }), this.adopted = {
479
496
  ...t,
480
497
  channels: {
@@ -484,8 +501,8 @@ class nt extends st {
484
501
  };
485
502
  }
486
503
  }
487
- const d = this.codec.write(this.adopted.channels);
488
- (u = this.hold) == null || u.cancel(), Object.keys(d).length && (this.hold = this.element.animate([d], {
504
+ const c = this.codec.write(this.adopted.channels);
505
+ (f = this.hold) == null || f.cancel(), Object.keys(c).length && (this.hold = this.element.animate([c, c], {
489
506
  duration: 1,
490
507
  fill: "both"
491
508
  }), this.hold.pause(), this.hold.currentTime = 0);
@@ -495,7 +512,7 @@ class nt extends st {
495
512
  const e = this.presentationFrames[t];
496
513
  if (e) return e.channels;
497
514
  const i = this.frames[t];
498
- return this.codec ?? (this.codec = this.motion.codec ?? $(this.element)), this.codec.read({
515
+ return this.codec ?? (this.codec = this.motion.codec ?? E(this.element, this.viewport)), this.codec.read({
499
516
  transform: "none",
500
517
  opacity: 1,
501
518
  ...this.styleFn(
@@ -507,7 +524,7 @@ class nt extends st {
507
524
  samplePresentation(t) {
508
525
  const e = this.frames;
509
526
  if (!e.length)
510
- return this.adopted ? { ...this.adopted.channels } : (this.codec ?? (this.codec = this.motion.codec ?? $(this.element)), this.codec.read({
527
+ return this.adopted ? { ...this.adopted.channels } : (this.codec ?? (this.codec = this.motion.codec ?? E(this.element, this.viewport)), this.codec.read({
511
528
  transform: "none",
512
529
  opacity: 1,
513
530
  ...this.styleFn(
@@ -515,24 +532,24 @@ class nt extends st {
515
532
  this.lowerBound + this.upperBound - this.currentValue
516
533
  )
517
534
  }));
518
- let i = e.findIndex((n) => n.time > t);
535
+ let i = e.findIndex((r) => r.time > t);
519
536
  i < 0 && (i = e.length - 1);
520
- const o = Math.max(0, i - 1), d = e[o], f = e[i], c = this.channelsAt(o), m = o === i ? c : this.channelsAt(i), g = (f.time - d.time) / 1e3, u = g ? Math.max(0, Math.min(1, (t - d.time) / (g * 1e3))) : 0, l = {};
521
- for (const [n, y] of Object.entries(c)) {
522
- const a = m[n];
523
- if (!a || !U(y, a)) {
524
- l[n] = y;
537
+ const l = Math.max(0, i - 1), c = e[l], u = e[i], d = this.channelsAt(l), m = l === i ? d : this.channelsAt(i), y = (u.time - c.time) / 1e3, f = y ? Math.max(0, Math.min(1, (t - c.time) / (y * 1e3))) : 0, o = {};
538
+ for (const [r, g] of Object.entries(d)) {
539
+ const a = m[r];
540
+ if (!a || !U(g, a)) {
541
+ o[r] = g;
525
542
  continue;
526
543
  }
527
- l[n] = {
528
- schema: y.schema,
529
- value: y.value.map((p, b) => p + (a.value[b] - p) * u),
530
- velocity: y.value.map(
531
- (p, b) => t >= e[e.length - 1].time || !g ? 0 : (a.value[b] - p) / g
544
+ o[r] = {
545
+ schema: g.schema,
546
+ value: g.value.map((p, v) => p + (a.value[v] - p) * f),
547
+ velocity: g.value.map(
548
+ (p, v) => t >= e[e.length - 1].time || !y ? 0 : (a.value[v] - p) / y
532
549
  )
533
550
  };
534
551
  }
535
- return l;
552
+ return o;
536
553
  }
537
554
  /**
538
555
  * Drop the WAAPI forwards-fill after the run has settled, letting inline
@@ -588,12 +605,12 @@ class nt extends st {
588
605
  }
589
606
  getTimeline() {
590
607
  const t = this.frames.map((e, i) => {
591
- const o = e.position, d = this.lowerBound + this.upperBound - o;
608
+ const l = e.position, c = this.lowerBound + this.upperBound - l;
592
609
  return {
593
610
  time: e.time,
594
611
  value: e.position,
595
612
  velocity: e.velocity,
596
- style: this.renderedStyles[i] ?? this.styleFn(o, d)
613
+ style: this.renderedStyles[i] ?? this.styleFn(l, c)
597
614
  };
598
615
  });
599
616
  return [{ element: this._element, frames: t }];
@@ -604,12 +621,12 @@ class nt extends st {
604
621
  }
605
622
  /* ───────────────────────────────────────────────────────── private */
606
623
  runToward(t) {
607
- var m, g;
624
+ var m, y;
608
625
  if (this.validate(), this.running || this.paused) {
609
- const u = this.getMotionSnapshot();
610
- this.captureLiveState(), this.adopted = u;
626
+ const f = this.getMotionSnapshot();
627
+ this.captureLiveState(), this.adopted = f;
611
628
  }
612
- if (this.clearWaapi(), this.running = !1, this.paused = !1, this.settled = !1, this.disposed = !1, this.presentationTime = 0, this.presentationFrames = [], this.solverTarget = t, this.frames = ct(
629
+ if (this.clearWaapi(), this.running = !1, this.paused = !1, this.settled = !1, this.disposed = !1, this.presentationTime = 0, this.presentationFrames = [], this.solverTarget = t, this.frames = pt(
613
630
  this._integrator,
614
631
  this.currentValue,
615
632
  t,
@@ -620,19 +637,19 @@ class nt extends st {
620
637
  this.currentValue = t, this.currentVelocity = 0, this.applyStyleAt(t), this.settled = !0, this.finish();
621
638
  return;
622
639
  }
623
- const e = (u) => this.styleFn(u.position, this.lowerBound + this.upperBound - u.position), i = this.adopted ? this.bridgeKeyframes(e) : this.frames.map((u) => e(u));
640
+ const e = (f) => this.styleFn(f.position, this.lowerBound + this.upperBound - f.position), i = this.adopted ? this.bridgeKeyframes(e) : this.frames.map((f) => e(f));
624
641
  this.renderedStyles = i, this.adopted = void 0;
625
- const o = i[0], d = this.frames[this.frames.length - 1], f = d.time;
642
+ const l = i[0], c = this.frames[this.frames.length - 1], u = c.time;
626
643
  this.runId++;
627
- const c = this._element.animate(i, {
628
- duration: f,
644
+ const d = this._element.animate(i, {
645
+ duration: u,
629
646
  fill: "both",
630
647
  easing: "linear",
631
648
  composite: "replace"
632
649
  });
633
- c.playbackRate = this.playbackRate, this.waapi = c, (m = this.fallbackCopy) == null || m.play(), (g = this.hold) == null || g.cancel(), this.hold = null, this.running = !0, c.onfinish = () => {
634
- !this.running || this.waapi !== c || (this.running = !1, this.settled = !0, this.currentValue = d.position, this.currentVelocity = 0, this.finish());
635
- }, this.clearInlineStyle(o), this.beginPlayback(c, f);
650
+ d.playbackRate = this.playbackRate, this.waapi = d, (m = this.fallbackCopy) == null || m.play(), (y = this.hold) == null || y.cancel(), this.hold = null, this.running = !0, d.onfinish = () => {
651
+ !this.running || this.waapi !== d || (this.running = !1, this.settled = !0, this.currentValue = c.position, this.currentVelocity = 0, this.finish());
652
+ }, this.clearInlineStyle(l), this.beginPlayback(d, u);
636
653
  }
637
654
  /**
638
655
  * Bake the residual correction into the keyframes: each authored frame is
@@ -641,70 +658,70 @@ class nt extends st {
641
658
  * interruption samples what is actually displayed.
642
659
  */
643
660
  bridgeKeyframes(t) {
644
- var g;
645
- this.codec = this.motion.codec ?? $(this.element);
646
- const e = this.codec, i = Math.max(16, this.motion.handoffDuration ?? 280), o = this.frames[this.frames.length - 1];
647
- for (let u = o.time + 1e3 / 60; u < i + 1e3 / 60; u += 1e3 / 60)
648
- this.frames.push({ time: u, position: o.position, velocity: 0 });
649
- const d = this.frames.map(
650
- (u) => e.read({ transform: "none", opacity: 1, ...t(u) })
661
+ var y;
662
+ this.codec = this.motion.codec ?? E(this.element, this.viewport);
663
+ const e = this.codec, i = Math.max(16, this.motion.handoffDuration ?? 280), l = this.frames[this.frames.length - 1];
664
+ for (let f = l.time + 1e3 / 60; f < i + 1e3 / 60; f += 1e3 / 60)
665
+ this.frames.push({ time: f, position: l.position, velocity: 0 });
666
+ const c = this.frames.map(
667
+ (f) => e.read({ transform: "none", opacity: 1, ...t(f) })
651
668
  );
652
- for (let u = 1; u < d.length; u++) {
653
- const l = d[u - 1].transform, n = d[u].transform;
654
- if ((l == null ? void 0 : l.schema) === "viewport-plane-v1" && (n == null ? void 0 : n.schema) === l.schema) {
655
- const y = [...n.value];
656
- y[2] = l.value[2] + Math.atan2(
657
- Math.sin(y[2] - l.value[2]),
658
- Math.cos(y[2] - l.value[2])
659
- ), d[u].transform = { ...n, value: y };
669
+ for (let f = 1; f < c.length; f++) {
670
+ const o = c[f - 1].transform, r = c[f].transform;
671
+ if ((o == null ? void 0 : o.schema) === "viewport-plane-v1" && (r == null ? void 0 : r.schema) === o.schema) {
672
+ const g = [...r.value];
673
+ g[2] = o.value[2] + Math.atan2(
674
+ Math.sin(g[2] - o.value[2]),
675
+ Math.cos(g[2] - o.value[2])
676
+ ), c[f].transform = { ...r, value: g };
660
677
  }
661
678
  }
662
- const f = d[0], c = d[1] ?? f, m = {};
663
- for (const [u, l] of Object.entries(
664
- ((g = this.adopted) == null ? void 0 : g.channels) ?? {}
679
+ const u = c[0], d = c[1] ?? u, m = {};
680
+ for (const [f, o] of Object.entries(
681
+ ((y = this.adopted) == null ? void 0 : y.channels) ?? {}
665
682
  )) {
666
- let n = f[u];
667
- if (!n) {
668
- const a = u === "transform" ? { transform: "none" } : u === "opacity" ? { opacity: 1 } : {};
669
- if (n = e.read(a)[u], n)
670
- for (const p of d) p[u] = n;
683
+ let r = u[f];
684
+ if (!r) {
685
+ const a = f === "transform" ? { transform: "none" } : f === "opacity" ? { opacity: 1 } : {};
686
+ if (r = e.read(a)[f], r)
687
+ for (const p of c) p[f] = r;
671
688
  }
672
- if (!n || !U(l, n)) continue;
673
- const y = c[u] ?? n;
674
- m[u] = {
675
- offset: l.value.map((a, p) => {
676
- let b = a - n.value[p];
677
- return u === "transform" && l.schema === "viewport-plane-v1" && p === 2 && (b = Math.atan2(Math.sin(b), Math.cos(b))), b;
689
+ if (!r || !U(o, r)) continue;
690
+ const g = d[f] ?? r;
691
+ m[f] = {
692
+ offset: o.value.map((a, p) => {
693
+ let v = a - r.value[p];
694
+ return f === "transform" && o.schema === "viewport-plane-v1" && p === 2 && (v = Math.atan2(Math.sin(v), Math.cos(v))), v;
678
695
  }),
679
- velocity: l.velocity.map(
680
- (a, p) => a / Math.max(Math.abs(this.playbackRate), 1e-4) - (y.value[p] - n.value[p]) * 60
696
+ velocity: o.velocity.map(
697
+ (a, p) => a / Math.max(Math.abs(this.playbackRate), 1e-4) - (g.value[p] - r.value[p]) * 60
681
698
  )
682
699
  };
683
700
  }
684
- return this.presentationFrames = this.frames.map((u, l) => {
685
- const n = { ...d[l] };
686
- for (const [y, a] of Object.entries(m)) {
687
- const p = n[y];
688
- n[y] = {
701
+ return this.presentationFrames = this.frames.map((f, o) => {
702
+ const r = { ...c[o] };
703
+ for (const [g, a] of Object.entries(m)) {
704
+ const p = r[g];
705
+ r[g] = {
689
706
  ...p,
690
707
  value: p.value.map(
691
- (b, S) => b + ut(
692
- a.offset[S],
693
- a.velocity[S],
694
- u.time / 1e3,
708
+ (v, k) => v + mt(
709
+ a.offset[k],
710
+ a.velocity[k],
711
+ f.time / 1e3,
695
712
  i / 1e3
696
713
  ).value
697
714
  )
698
715
  };
699
716
  }
700
- return { time: u.time, channels: n };
701
- }), this.frames.map((u, l) => {
702
- const n = this.presentationFrames[l].channels;
717
+ return { time: f.time, channels: r };
718
+ }), this.frames.map((f, o) => {
719
+ const r = this.presentationFrames[o].channels;
703
720
  return {
704
- ...t(u),
721
+ ...t(f),
705
722
  ...e.write(
706
723
  Object.fromEntries(
707
- Object.keys(m).map((y) => [y, n[y]])
724
+ Object.keys(m).map((g) => [g, r[g]])
708
725
  )
709
726
  )
710
727
  };
@@ -716,11 +733,11 @@ class nt extends st {
716
733
  }
717
734
  captureLiveState() {
718
735
  if (this.frames.length === 0) return;
719
- const t = et(this.waapi);
736
+ const t = it(this.waapi);
720
737
  if (t === null) return;
721
738
  this.presentationTime = t;
722
- const { position: e, velocity: i } = dt(this.frames, t);
723
- this.currentValue = e, this.currentVelocity = i, this.solverState = ft(
739
+ const { position: e, velocity: i } = gt(this.frames, t);
740
+ this.currentValue = e, this.currentVelocity = i, this.solverState = yt(
724
741
  this.frames,
725
742
  t,
726
743
  this._integrator,
@@ -741,7 +758,7 @@ class nt extends st {
741
758
  t.play();
742
759
  return;
743
760
  }
744
- i > 0 && (t.currentTime = Math.min(e, gt * i));
761
+ i > 0 && (t.currentTime = Math.min(e, wt * i));
745
762
  }
746
763
  clearInlineStyle(t) {
747
764
  if (t)
@@ -750,28 +767,28 @@ class nt extends st {
750
767
  }
751
768
  applyStyleAt(t) {
752
769
  const e = this.lowerBound + this.upperBound - t, i = this.styleFn(t, e);
753
- for (const [o, d] of Object.entries(i))
754
- this._element.style[o] = typeof d == "number" ? String(d) : d;
770
+ for (const [l, c] of Object.entries(i))
771
+ this._element.style[l] = typeof c == "number" ? String(c) : c;
755
772
  }
756
773
  }
757
- function et(s) {
758
- const r = s == null ? void 0 : s.currentTime;
759
- return typeof r == "number" ? r : null;
774
+ function it(s) {
775
+ const n = s == null ? void 0 : s.currentTime;
776
+ return typeof n == "number" ? n : null;
760
777
  }
761
- class yt {
778
+ class Ct {
762
779
  constructor() {
763
780
  h(this, "callbacks", /* @__PURE__ */ new Set());
764
781
  h(this, "frameRequest", null);
765
782
  h(this, "tick", () => {
766
783
  this.frameRequest = null;
767
- for (const r of [...this.callbacks])
768
- this.callbacks.has(r) && r();
784
+ for (const n of [...this.callbacks])
785
+ this.callbacks.has(n) && n();
769
786
  this.requestFrame();
770
787
  });
771
788
  }
772
- subscribe(r) {
773
- return this.callbacks.add(r), this.requestFrame(), () => {
774
- this.callbacks.delete(r), this.stopIfIdle();
789
+ subscribe(n) {
790
+ return this.callbacks.add(n), this.requestFrame(), () => {
791
+ this.callbacks.delete(n), this.stopIfIdle();
775
792
  };
776
793
  }
777
794
  requestFrame() {
@@ -781,11 +798,11 @@ class yt {
781
798
  this.callbacks.size > 0 || this.frameRequest === null || (typeof cancelAnimationFrame < "u" && cancelAnimationFrame(this.frameRequest), this.frameRequest = null);
782
799
  }
783
800
  }
784
- const vt = new yt();
785
- function bt(s) {
786
- return typeof s.step == "function" ? s : pt.from(s);
801
+ const St = new Ct();
802
+ function kt(s) {
803
+ return typeof s.step == "function" ? s : vt.from(s);
787
804
  }
788
- class ot extends st {
805
+ class lt extends nt {
789
806
  constructor(t, e = {}) {
790
807
  super();
791
808
  h(this, "_children");
@@ -807,8 +824,8 @@ class ot extends st {
807
824
  ), this._children = Array.isArray(t) ? [...t] : [...this.namedChildren.values()];
808
825
  for (const i of this._children) i.deferDisposal = !0;
809
826
  this.progressChildren = this._children.filter(
810
- (i) => !(i instanceof ot) || i.progressChildren.length > 0
811
- ), (e.mode ?? "parallel") === "sequence" ? this._startAt = this._children.map((i, o) => o === 0 ? 0 : 1) : this._startAt = e.startAt ?? [];
827
+ (i) => !(i instanceof lt) || i.progressChildren.length > 0
828
+ ), (e.mode ?? "parallel") === "sequence" ? this._startAt = this._children.map((i, l) => l === 0 ? 0 : 1) : this._startAt = e.startAt ?? [];
812
829
  }
813
830
  /** Child animations in play order. */
814
831
  get children() {
@@ -844,7 +861,7 @@ class ot extends st {
844
861
  set(t, e) {
845
862
  if (typeof t == "string") {
846
863
  const i = this.select(t);
847
- return (e == null ? void 0 : e.integrator) !== void 0 && i.set({ integrator: bt(e.integrator) }), this;
864
+ return (e == null ? void 0 : e.integrator) !== void 0 && i.set({ integrator: kt(e.integrator) }), this;
848
865
  }
849
866
  return super.set(t);
850
867
  }
@@ -868,8 +885,8 @@ class ot extends st {
868
885
  this.settled = !0, this.running = !1, this.clearPendingStartObservers(), this.restoreCompletionHandlers();
869
886
  for (const e of this._children) e.complete();
870
887
  if (!this.deferDisposal) {
871
- for (const e of this._children) e.cancel(E);
872
- this.disposeResources(E);
888
+ for (const e of this._children) e.cancel(j);
889
+ this.disposeResources(j);
873
890
  }
874
891
  (t = this.onComplete) == null || t.call(this);
875
892
  }
@@ -933,66 +950,66 @@ class ot extends st {
933
950
  }
934
951
  /* ───────────────────────────────────────────────────────── private */
935
952
  startRun(t) {
936
- const e = this.buildDependencies(), i = this.pausedRun && t === this.lastMethod, o = t !== this.lastMethod, d = new Set(this.startedChildren), f = new Set(
953
+ const e = this.buildDependencies(), i = this.pausedRun && t === this.lastMethod, l = t !== this.lastMethod, c = new Set(this.startedChildren), u = new Set(
937
954
  this._children.filter((a) => a.isComplete)
938
- ), c = t === "reverse" && d.size ? this._children.filter((a) => d.has(a)) : [...this._children], m = t === "reverse" ? [...c].reverse() : c, g = /* @__PURE__ */ new Map();
955
+ ), d = t === "reverse" && c.size ? this._children.filter((a) => c.has(a)) : [...this._children], m = t === "reverse" ? [...d].reverse() : d, y = /* @__PURE__ */ new Map();
939
956
  if (t === "reverse")
940
957
  for (const [a, p] of e) {
941
- if (!c.includes(a) || !c.includes(p.after))
958
+ if (!d.includes(a) || !d.includes(p.after))
942
959
  continue;
943
- const b = g.get(p.after) ?? [];
944
- b.push({
960
+ const v = y.get(p.after) ?? [];
961
+ v.push({
945
962
  after: a,
946
963
  at: p.at === "settled" ? "settled" : 1 - p.at
947
- }), g.set(p.after, b);
964
+ }), y.set(p.after, v);
948
965
  }
949
966
  else
950
967
  for (const [a, p] of e)
951
- g.set(a, [p]);
952
- if (o || i)
953
- for (const a of d)
954
- f.has(a) || g.delete(a);
968
+ y.set(a, [p]);
969
+ if (l || i)
970
+ for (const a of c)
971
+ u.has(a) || y.delete(a);
955
972
  this.running && this.pause(), this.restoreCompletionHandlers();
956
- const u = ++this.runId;
957
- if (this.running = !0, this.pausedRun = !1, this.lastMethod = t, this.disposed = !1, this.settled = !1, this.pendingComplete = c.length, !i && !o && this.startedChildren.clear(), this.pendingComplete === 0) {
973
+ const f = ++this.runId;
974
+ if (this.running = !0, this.pausedRun = !1, this.lastMethod = t, this.disposed = !1, this.settled = !1, this.pendingComplete = d.length, !i && !l && this.startedChildren.clear(), this.pendingComplete === 0) {
958
975
  this.handleFinished();
959
976
  return;
960
977
  }
961
- const l = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
978
+ const o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
962
979
  if (i)
963
- for (const a of c)
964
- d.has(a) && f.has(a) && (n.add(a), l.add(a), this.pendingComplete--);
965
- for (const a of c) {
966
- const p = a.onComplete, b = () => {
967
- if (!(this.runId !== u || !this.running || l.has(a))) {
980
+ for (const a of d)
981
+ c.has(a) && u.has(a) && (r.add(a), o.add(a), this.pendingComplete--);
982
+ for (const a of d) {
983
+ const p = a.onComplete, v = () => {
984
+ if (!(this.runId !== f || !this.running || o.has(a))) {
968
985
  try {
969
986
  p == null || p();
970
- } catch (S) {
971
- console.error("[ssgoi] animation completion failed", S);
987
+ } catch (k) {
988
+ console.error("[ssgoi] animation completion failed", k);
972
989
  }
973
- l.add(a), --this.pendingComplete === 0 && this.handleFinished();
990
+ o.add(a), --this.pendingComplete === 0 && this.handleFinished();
974
991
  }
975
992
  };
976
- a.onComplete = b, this.restoreChildCallbacks.push(() => {
977
- a.onComplete === b && (a.onComplete = p);
993
+ a.onComplete = v, this.restoreChildCallbacks.push(() => {
994
+ a.onComplete === v && (a.onComplete = p);
978
995
  });
979
996
  }
980
- const y = () => {
997
+ const g = () => {
981
998
  let a = !0;
982
- for (; this.running && this.runId === u && a; ) {
999
+ for (; this.running && this.runId === f && a; ) {
983
1000
  a = !1;
984
1001
  for (const p of m)
985
- !this.running || n.has(p) || (g.get(p) ?? []).some(
986
- (S) => !n.has(S.after) || !this.hasReachedThreshold(
987
- S.after,
988
- S.at,
1002
+ !this.running || r.has(p) || (y.get(p) ?? []).some(
1003
+ (k) => !r.has(k.after) || !this.hasReachedThreshold(
1004
+ k.after,
1005
+ k.at,
989
1006
  t
990
1007
  )
991
- ) || (n.add(p), this.startedChildren.add(p), p[t](), a = !0);
1008
+ ) || (r.add(p), this.startedChildren.add(p), p[t](), a = !0);
992
1009
  }
993
- n.size === c.length && this.clearPendingStartObservers();
1010
+ r.size === d.length && this.clearPendingStartObservers();
994
1011
  };
995
- y(), this.pendingComplete === 0 && this.handleFinished(), this.running && n.size !== c.length && this.pendingStartObservers.push(vt.subscribe(y));
1012
+ g(), this.pendingComplete === 0 && this.handleFinished(), this.running && r.size !== d.length && this.pendingStartObservers.push(St.subscribe(g));
996
1013
  }
997
1014
  buildDependencies() {
998
1015
  const t = /* @__PURE__ */ new Map(), e = new Set(this._children);
@@ -1000,28 +1017,28 @@ class ot extends st {
1000
1017
  throw new Error(
1001
1018
  "Each child animation must occur once in a MultiAnimation"
1002
1019
  );
1003
- this._children.forEach((f, c) => {
1004
- const m = f.startCondition;
1020
+ this._children.forEach((u, d) => {
1021
+ const m = u.startCondition;
1005
1022
  if (m) {
1006
1023
  if (!e.has(m.after))
1007
1024
  throw new Error(
1008
1025
  "startAt.after must reference a sibling in the same MultiAnimation"
1009
1026
  );
1010
- t.set(f, { ...m });
1011
- } else c > 0 && this._startAt.some((g) => g > 0) && t.set(f, {
1012
- after: this._children[c - 1],
1013
- at: this._startAt[c] ?? 0
1027
+ t.set(u, { ...m });
1028
+ } else d > 0 && this._startAt.some((y) => y > 0) && t.set(u, {
1029
+ after: this._children[d - 1],
1030
+ at: this._startAt[d] ?? 0
1014
1031
  });
1015
1032
  });
1016
- const i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), d = (f) => {
1017
- if (o.has(f))
1033
+ const i = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), c = (u) => {
1034
+ if (l.has(u))
1018
1035
  throw new Error("Animation startAt dependencies form a cycle");
1019
- if (i.has(f)) return;
1020
- o.add(f);
1021
- const c = t.get(f);
1022
- c && d(c.after), o.delete(f), i.add(f);
1036
+ if (i.has(u)) return;
1037
+ l.add(u);
1038
+ const d = t.get(u);
1039
+ d && c(d.after), l.delete(u), i.add(u);
1023
1040
  };
1024
- return this._children.forEach(d), t;
1041
+ return this._children.forEach(c), t;
1025
1042
  }
1026
1043
  hasReachedThreshold(t, e, i) {
1027
1044
  return t.isComplete ? !0 : e === "settled" ? !1 : e <= 0 ? !0 : (i === "play" ? t.progress : 1 - t.progress) >= e;
@@ -1038,8 +1055,8 @@ class ot extends st {
1038
1055
  var t;
1039
1056
  if (this.running) {
1040
1057
  if (this.running = !1, this.settled = !0, this.clearPendingStartObservers(), this.restoreCompletionHandlers(), !this.deferDisposal) {
1041
- for (const e of this._children) e.cancel(E);
1042
- this.disposeResources(E);
1058
+ for (const e of this._children) e.cancel(j);
1059
+ this.disposeResources(j);
1043
1060
  }
1044
1061
  (t = this.onComplete) == null || t.call(this);
1045
1062
  }
@@ -1049,37 +1066,37 @@ class ot extends st {
1049
1066
  }
1050
1067
  }
1051
1068
  const K = /* @__PURE__ */ new WeakMap();
1052
- function St(s) {
1053
- const r = K.get(s) ?? {
1069
+ function At(s) {
1070
+ const n = K.get(s) ?? {
1054
1071
  value: s.style.getPropertyValue("opacity"),
1055
1072
  priority: s.style.getPropertyPriority("opacity"),
1056
1073
  opacity: typeof getComputedStyle == "function" ? Number.parseFloat(getComputedStyle(s).opacity) : Number.NaN,
1057
1074
  users: /* @__PURE__ */ new Set()
1058
1075
  }, t = {};
1059
- r.users.add(t), K.set(s, r);
1076
+ n.users.add(t), K.set(s, n);
1060
1077
  let e = !1;
1061
1078
  return {
1062
- opacity: Number.isFinite(r.opacity) ? r.opacity : 1,
1079
+ opacity: Number.isFinite(n.opacity) ? n.opacity : 1,
1063
1080
  set: (i) => {
1064
1081
  t.value = i, s.style.opacity = String(i);
1065
1082
  },
1066
1083
  restore: () => {
1067
1084
  if (!e) {
1068
- if (e = !0, r.users.delete(t), r.users.size > 0) {
1069
- const i = Array.from(r.users), o = i[i.length - 1];
1070
- (o == null ? void 0 : o.value) !== void 0 && (s.style.opacity = String(o.value));
1085
+ if (e = !0, n.users.delete(t), n.users.size > 0) {
1086
+ const i = Array.from(n.users), l = i[i.length - 1];
1087
+ (l == null ? void 0 : l.value) !== void 0 && (s.style.opacity = String(l.value));
1071
1088
  return;
1072
1089
  }
1073
- r.value ? s.style.setProperty("opacity", r.value, r.priority) : s.style.removeProperty("opacity"), K.delete(s);
1090
+ n.value ? s.style.setProperty("opacity", n.value, n.priority) : s.style.removeProperty("opacity"), K.delete(s);
1074
1091
  }
1075
1092
  }
1076
1093
  };
1077
1094
  }
1078
1095
  export {
1079
- st as A,
1080
- ot as M,
1081
- nt as W,
1082
- $ as c,
1083
- E as f,
1084
- St as r
1096
+ nt as A,
1097
+ lt as M,
1098
+ at as W,
1099
+ E as c,
1100
+ j as f,
1101
+ At as r
1085
1102
  };