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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- var ht = Object.defineProperty;
2
- var ct = (s, r, t) => r in s ? ht(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t;
3
- var h = (s, r, t) => ct(s, typeof r != "symbol" ? r + "" : r, t);
4
- import { A as ut, c as K, a as dt, r as pt, i as ft, s as mt, I as gt } from "./provider-BLf6XeXT.js";
5
- const j = {
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 = {
6
6
  reason: "finished",
7
7
  owns: () => !0
8
8
  };
9
- class st extends ut {
9
+ class st extends ht {
10
10
  constructor() {
11
11
  super(...arguments);
12
12
  h(this, "_startCondition");
@@ -60,7 +60,7 @@ class st extends ut {
60
60
  throw new Error("This animation does not support replacing its integrator");
61
61
  }
62
62
  }
63
- const H = [1, 0, 0, 1, 0, 0], it = (s, r) => [
63
+ const L = [1, 0, 0, 1, 0, 0], it = (s, r) => [
64
64
  s[0] * r[0] + s[2] * r[1],
65
65
  s[1] * r[0] + s[3] * r[1],
66
66
  s[0] * r[2] + s[2] * r[3],
@@ -68,7 +68,7 @@ const H = [1, 0, 0, 1, 0, 0], it = (s, r) => [
68
68
  s[0] * r[4] + s[2] * r[5] + s[4],
69
69
  s[1] * r[4] + s[3] * r[5] + s[5]
70
70
  ];
71
- function G(s) {
71
+ function Y(s) {
72
72
  const r = s[0] * s[3] - s[1] * s[2];
73
73
  return Math.abs(r) < 1e-10 ? null : [
74
74
  s[3] / r,
@@ -79,53 +79,53 @@ function G(s) {
79
79
  (s[1] * s[4] - s[0] * s[5]) / r
80
80
  ];
81
81
  }
82
- const I = (s, r) => [1, 0, 0, 1, s, r], U = (s, r) => [s, 0, 0, r, 0, 0];
83
- function yt(s, r, t) {
84
- if (!s || s === "none") return [...H];
85
- let e = [...H];
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) {
84
+ if (!s || s === "none") return [...L];
85
+ let e = [...L];
86
86
  const i = /([a-zA-Z][a-zA-Z0-9]*)\(([^()]*)\)/g;
87
- let a = "";
88
- for (const c of s.matchAll(i)) {
89
- a += c[0];
90
- const d = c[1].toLowerCase(), u = c[2].trim().split(/\s*,\s*|\s+/);
91
- if (u.some(
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
92
  (n) => !/^[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?(?:px|%|deg|rad|turn)?$/i.test(
93
93
  n
94
94
  )
95
95
  ))
96
96
  return null;
97
- const m = u.map(Number.parseFloat);
97
+ const m = c.map(Number.parseFloat);
98
98
  if (m.some((n) => !Number.isFinite(n))) return null;
99
99
  const g = (n, y) => {
100
- var o;
101
- return m[n] * ((o = u[n]) != null && o.endsWith("%") ? y / 100 : 1);
102
- }, p = (n) => {
103
- var y, o;
104
- return m[n] * ((y = u[n]) != null && y.endsWith("rad") ? 1 : (o = u[n]) != null && o.endsWith("turn") ? 2 * Math.PI : Math.PI / 180);
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);
105
105
  };
106
106
  let l;
107
- if (d === "matrix" && m.length === 6) l = m;
108
- else if (d === "translate" || d === "translate3d") {
109
- if (d === "translate3d" && m[2] !== 0) return null;
110
- l = I(g(0, r), u[1] ? g(1, t) : 0);
111
- } else if (d === "translatex") l = I(g(0, r), 0);
112
- else if (d === "translatey") l = I(0, g(0, t));
113
- else if (d === "translatez" && m[0] === 0) l = [...H];
114
- else if (d === "scale") l = U(m[0], m[1] ?? m[0]);
115
- else if (d === "scalex") l = U(m[0], 1);
116
- else if (d === "scaley") l = U(1, m[0]);
117
- else if (d === "rotate" || d === "rotatez") {
118
- const n = p(0);
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
119
  l = [Math.cos(n), Math.sin(n), -Math.sin(n), Math.cos(n), 0, 0];
120
120
  } else return null;
121
121
  e = it(e, l);
122
122
  }
123
- return a.replace(/\s/g, "") === s.replace(/\s/g, "") ? e : null;
123
+ return o.replace(/\s/g, "") === s.replace(/\s/g, "") ? e : null;
124
124
  }
125
- function J(s, r) {
125
+ function G(s, r) {
126
126
  return { schema: s, value: r, velocity: r.map(() => 0) };
127
127
  }
128
- const Q = /[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/gi, M = (s) => [
128
+ const J = /[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/gi, _ = (s) => [
129
129
  s[0],
130
130
  s[2],
131
131
  s[4],
@@ -136,175 +136,137 @@ const Q = /[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/gi, M = (s) => [
136
136
  0,
137
137
  1
138
138
  ];
139
- function B(s, r) {
139
+ function T(s, r) {
140
140
  return Array.from({ length: 9 }, (t, e) => {
141
- const i = Math.floor(e / 3), a = e % 3;
142
- return s[i * 3] * r[a] + s[i * 3 + 1] * r[a + 3] + s[i * 3 + 2] * r[a + 6];
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];
143
143
  });
144
144
  }
145
145
  function rt(s) {
146
146
  return Math.abs(s[8]) < 1e-8 || !s.every(Number.isFinite) ? null : s.map((r) => r / s[8]);
147
147
  }
148
- function tt(s, r, t) {
149
- const e = yt(s, r, t);
150
- if (e) return M(e);
148
+ function Q(s, r, t) {
149
+ const e = mt(s, r, t);
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
- (a, c, d) => {
155
- const u = d.split(/\s*,\s*|\s+/).map((m, g) => {
154
+ (o, d, f) => {
155
+ const c = f.split(/\s*,\s*|\s+/).map((m, g) => {
156
156
  if (!m.endsWith("%")) return m;
157
- const p = c.toLowerCase() === "translatey" || g === 1 ? t : r;
158
- return `${Number.parseFloat(m) * p / 100}px`;
157
+ const u = d.toLowerCase() === "translatey" || g === 1 ? t : r;
158
+ return `${Number.parseFloat(m) * u / 100}px`;
159
159
  });
160
- return `${c}(${u.join(",")})`;
160
+ return `${d}(${c.join(",")})`;
161
161
  }
162
162
  );
163
163
  try {
164
- const a = new DOMMatrix(i);
164
+ const o = new DOMMatrix(i);
165
165
  return rt([
166
- a.m11,
167
- a.m21,
168
- a.m41,
169
- a.m12,
170
- a.m22,
171
- a.m42,
172
- a.m14,
173
- a.m24,
174
- a.m44
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
175
175
  ]);
176
176
  } catch {
177
177
  return null;
178
178
  }
179
179
  }
180
- const et = "viewport-plane-v1";
180
+ const tt = "viewport-plane-v1";
181
181
  function $(s) {
182
- var w;
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(" "), a = Number.parseFloat(i[0]) || 0, c = Number.parseFloat(i[1]) || 0;
184
- let d = !0;
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
185
  if (typeof getComputedStyle == "function")
186
186
  for (let C = s.parentElement; C; C = C.parentElement) {
187
- const S = getComputedStyle(C);
188
- if (S.transform && S.transform !== "none" || S.perspective && S.perspective !== "none") {
189
- d = !1;
187
+ const w = getComputedStyle(C);
188
+ if (w.transform && w.transform !== "none" || w.perspective && w.perspective !== "none") {
189
+ f = !1;
190
190
  break;
191
191
  }
192
192
  }
193
- const u = (w = s.getBoundingClientRect) == null ? void 0 : w.call(s), m = tt((e == null ? void 0 : e.transform) || "", r, t) ?? M(H), g = B(
194
- B(M(I(a, c)), m),
195
- M(I(-a, -c))
196
- ), p = [
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 = [
197
197
  [0, 0],
198
198
  [r, 0],
199
199
  [0, t],
200
200
  [r, t]
201
- ].map(([C, S]) => {
202
- const F = g[6] * C + g[7] * S + g[8];
201
+ ].map(([C, w]) => {
202
+ const k = g[6] * C + g[7] * w + g[8];
203
203
  return [
204
- (g[0] * C + g[1] * S + g[2]) / F,
205
- (g[3] * C + g[4] * S + g[5]) / F
204
+ (g[0] * C + g[1] * w + g[2]) / k,
205
+ (g[3] * C + g[4] * w + g[5]) / k
206
206
  ];
207
- }), l = ((u == null ? void 0 : u.left) ?? 0) - Math.min(...p.map((C) => C[0])), n = ((u == null ? void 0 : u.top) ?? 0) - Math.min(...p.map((C) => C[1])), y = I(l + a, n + c), o = it(I(-a, -c), U(r, t)), f = M(G(y)), b = M(G(o));
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));
208
208
  return {
209
- frame: d ? { left: l, top: n, width: r, height: t } : void 0,
209
+ frame: f ? { left: l, top: n, width: r, height: t } : void 0,
210
210
  read(C) {
211
- const S = {};
212
- for (const [F, A] of Object.entries(C)) {
213
- const k = String(A);
214
- if (F === "transform") {
215
- if (!d) continue;
216
- const R = tt(k, r, t), x = R && rt(B(B(M(y), R), M(o)));
211
+ const w = {};
212
+ for (const [k, A] of Object.entries(C)) {
213
+ 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
217
  if (x) {
218
- const [q, N, T, O, V, P, E, v] = x, W = q - T * E, z = O - P * E, Z = N - T * v, Y = V - P * v, L = Math.hypot(W, z);
219
- if (L > 1e-8) {
220
- S[F] = J(et, [
221
- T,
222
- P,
223
- Math.atan2(z, W),
224
- L,
225
- (W * Y - z * Z) / L,
226
- (W * Z + z * Y) / L,
227
- E,
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, [
221
+ I,
222
+ B,
223
+ Math.atan2(z, q),
224
+ W,
225
+ (q * X - z * Z) / W,
226
+ (q * Z + z * X) / W,
227
+ D,
228
228
  v
229
229
  ]);
230
230
  continue;
231
231
  }
232
232
  }
233
233
  }
234
- const _ = [...k.matchAll(Q)].map(
234
+ const F = [...M.matchAll(J)].map(
235
235
  (R) => Number(R[0])
236
236
  );
237
- _.length && _.every(Number.isFinite) && (S[F] = J(
238
- `css:${k.replace(Q, "#")}`,
239
- _
237
+ F.length && F.every(Number.isFinite) && (w[k] = G(
238
+ `css:${M.replace(J, "#")}`,
239
+ F
240
240
  ));
241
241
  }
242
- return S;
242
+ return w;
243
243
  },
244
244
  write(C) {
245
- const S = {};
246
- for (const [F, A] of Object.entries(C))
247
- if (F === "transform" && A.schema === et) {
248
- const [k, _, R, x, q, N, T, O] = A.value, V = Math.cos(R), P = Math.sin(R), E = [
249
- V * x + k * T,
250
- V * N - P * q + k * O,
251
- k,
252
- P * x + _ * T,
253
- P * N + V * q + _ * O,
254
- _,
255
- T,
245
+ 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,
251
+ M,
252
+ B * x + F * I,
253
+ B * N + V * j + F * O,
254
+ F,
255
+ I,
256
256
  O,
257
257
  1
258
- ], v = B(B(f, E), b);
259
- Math.abs(v[6]) + Math.abs(v[7]) < 1e-10 && Math.abs(v[8] - 1) < 1e-10 ? S[F] = `matrix(${[v[0], v[3], v[1], v[4], v[2], v[5]].join(",")})` : S[F] = `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(",")})`;
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(",")})`;
260
260
  } else if (A.schema.startsWith("css:")) {
261
- let k = 0;
262
- S[F] = A.schema.slice(4).replace(/#/g, () => String(A.value[k++]));
261
+ let M = 0;
262
+ w[k] = A.schema.slice(4).replace(/#/g, () => String(A.value[M++]));
263
263
  }
264
- return S;
264
+ return w;
265
265
  }
266
266
  };
267
267
  }
268
- const vt = 1e3 / 60, nt = 1e3 / 30, bt = nt + 1;
269
- class St {
270
- constructor() {
271
- h(this, "drivers", /* @__PURE__ */ new Set());
272
- h(this, "observers", /* @__PURE__ */ new Set());
273
- h(this, "frameRequest", null);
274
- h(this, "previousTimestamp", null);
275
- h(this, "tick", (r) => {
276
- this.frameRequest = null;
277
- const t = this.previousTimestamp === null ? vt : Math.max(0, r - this.previousTimestamp);
278
- this.previousTimestamp = r;
279
- const e = {
280
- delta: Math.min(t, nt),
281
- rawDelta: t
282
- };
283
- this.runPhase(this.drivers, e), this.runPhase(this.observers, e), this.hasCallbacks() ? this.requestFrame() : this.previousTimestamp = null;
284
- });
285
- }
286
- subscribe(r, t = "drive") {
287
- const e = t === "drive" ? this.drivers : this.observers;
288
- return e.add(r), this.requestFrame(), () => {
289
- e.delete(r), this.stopIfIdle();
290
- };
291
- }
292
- requestFrame() {
293
- this.frameRequest !== null || !this.hasCallbacks() || (this.frameRequest = requestAnimationFrame(this.tick));
294
- }
295
- runPhase(r, t) {
296
- for (const e of [...r])
297
- r.has(e) && e(t);
298
- }
299
- hasCallbacks() {
300
- return this.drivers.size > 0 || this.observers.size > 0;
301
- }
302
- stopIfIdle() {
303
- this.hasCallbacks() || (this.frameRequest !== null && typeof cancelAnimationFrame < "u" && cancelAnimationFrame(this.frameRequest), this.frameRequest = null, this.previousTimestamp = null);
304
- }
305
- }
306
- const at = new St(), Ct = 2;
307
- class ot extends st {
268
+ const gt = 1e3 / 60;
269
+ class nt extends st {
308
270
  constructor(t) {
309
271
  super();
310
272
  h(this, "_element");
@@ -323,11 +285,6 @@ class ot extends st {
323
285
  h(this, "frames", []);
324
286
  h(this, "waapi", null);
325
287
  h(this, "runId", 0);
326
- h(this, "waitingForStart", !1);
327
- h(this, "startReady", !1);
328
- h(this, "pendingFirstFrame");
329
- h(this, "stopStartupClock", null);
330
- h(this, "startupStableFrames", 0);
331
288
  h(this, "running", !1);
332
289
  h(this, "paused", !1);
333
290
  h(this, "settled", !1);
@@ -372,11 +329,7 @@ class ot extends st {
372
329
  var e;
373
330
  const t = this.reversing;
374
331
  if (this.reversing = !1, this.paused && this.waapi && !t) {
375
- if (this.paused = !1, this.running = !0, this.waitingForStart) {
376
- this.startReady && this.startFramePacedPlayback(this.waapi);
377
- return;
378
- }
379
- this.waapi.play(), (e = this.fallbackCopy) == null || e.play();
332
+ this.paused = !1, this.running = !0, this.waapi.play(), (e = this.fallbackCopy) == null || e.play();
380
333
  return;
381
334
  }
382
335
  this.runToward(this.upperBound);
@@ -385,8 +338,8 @@ class ot extends st {
385
338
  this.reversing = !0, this.runToward(this.lowerBound);
386
339
  }
387
340
  pause() {
388
- var t, e, i;
389
- this.running && (this.captureLiveState(), (t = this.waapi) == null || t.pause(), (e = this.fallbackCopy) == null || e.pause(), (i = this.stopStartupClock) == null || i.call(this), this.stopStartupClock = null, this.running = !1, this.paused = !0);
341
+ var t, e;
342
+ this.running && (this.captureLiveState(), (t = this.waapi) == null || t.pause(), (e = this.fallbackCopy) == null || e.pause(), this.running = !1, this.paused = !0);
390
343
  }
391
344
  complete() {
392
345
  this.settled || (this.clearWaapi(), this.running = !1, this.paused = !1, this.currentValue = this.upperBound, this.currentVelocity = 0, this.applyStyleAt(this.currentValue), this.settled = !0, this.finish());
@@ -421,8 +374,8 @@ class ot extends st {
421
374
  }
422
375
  }
423
376
  finish() {
424
- var t, e, i, a;
425
- 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), (a = this.onComplete) == null || a.call(this);
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);
426
379
  }
427
380
  get motionIdentity() {
428
381
  return {
@@ -435,35 +388,35 @@ class ot extends st {
435
388
  }
436
389
  /** Final output, including any earlier residual, is the next handoff's source. */
437
390
  getMotionSnapshot() {
438
- var a, c;
391
+ var o, d;
439
392
  this.running && this.captureLiveState();
440
393
  const t = this.samplePresentation(
441
- D(this.waapi) ?? this.presentationTime
442
- ), e = this.paused || this.waitingForStart && !D(this.waapi) ? 0 : this.playbackRate, i = {
394
+ et(this.waapi) ?? this.presentationTime
395
+ ), e = this.paused ? 0 : this.playbackRate, i = {
443
396
  ...this.styleFn(
444
397
  this.currentValue,
445
398
  this.lowerBound + this.upperBound - this.currentValue
446
399
  ),
447
- ...(a = this.codec) == null ? void 0 : a.write(t)
400
+ ...(o = this.codec) == null ? void 0 : o.write(t)
448
401
  };
449
402
  return {
450
403
  ...this.motionIdentity,
451
404
  displayStyle: i,
452
405
  inlineStyle: this.element.style.cssText,
453
- frame: (c = this.codec) == null ? void 0 : c.frame,
406
+ frame: (d = this.codec) == null ? void 0 : d.frame,
454
407
  channels: Object.fromEntries(
455
- Object.entries(t).map(([d, u]) => [
456
- d,
408
+ Object.entries(t).map(([f, c]) => [
409
+ f,
457
410
  {
458
- ...u,
459
- velocity: u.velocity.map((m) => m * e)
411
+ ...c,
412
+ velocity: c.velocity.map((m) => m * e)
460
413
  }
461
414
  ])
462
415
  )
463
416
  };
464
417
  }
465
418
  adopt(t) {
466
- var d, u, m, g, p;
419
+ var f, c, m, g, u;
467
420
  this.codec ?? (this.codec = this.motion.codec ?? $(this.element)), this.adopted = t;
468
421
  const e = this.codec.read({
469
422
  transform: "none",
@@ -477,17 +430,17 @@ class ot extends st {
477
430
  const i = this.styleFn(
478
431
  this.currentValue,
479
432
  this.lowerBound + this.upperBound - this.currentValue
480
- ), a = t.displayStyle;
481
- for (const [l, n] of Object.entries(a ?? {}))
433
+ ), o = t.displayStyle;
434
+ for (const [l, n] of Object.entries(o ?? {}))
482
435
  l in i && String(n) !== String(i[l]) && (!t.channels[l] || !e[l]) && this.fallbackChannels.add(l);
483
436
  for (const [l, n] of Object.entries(t.channels)) {
484
437
  const y = e[l];
485
- y && !K(n, y) && this.fallbackChannels.add(l);
438
+ y && !U(n, y) && this.fallbackChannels.add(l);
486
439
  }
487
440
  if (this.fallbackChannels.size && (this.fallbackMode = "finish"), this.fallbackChannels.size && this.motion.fallback !== "finish") {
488
441
  const l = t;
489
- if (l.frame && l.displayStyle && t.target.cloneNode && t.target.parentElement && !t.target.shadowRoot && !((u = (d = t.target).matches) != null && u.call(
490
- d,
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,
491
444
  "canvas, video, audio, iframe, object, embed"
492
445
  )) && !((g = (m = t.target).querySelector) != null && g.call(
493
446
  m,
@@ -496,10 +449,10 @@ class ot extends st {
496
449
  this.fallbackMode = "crossfade";
497
450
  const n = t.target.cloneNode(!0);
498
451
  n.removeAttribute("id"), n.removeAttribute("data-ssgoi-transition");
499
- for (const o of n.querySelectorAll(
452
+ for (const a of n.querySelectorAll(
500
453
  "[id], [data-ssgoi-transition]"
501
454
  ))
502
- o.removeAttribute("id"), o.removeAttribute("data-ssgoi-transition");
455
+ a.removeAttribute("id"), a.removeAttribute("data-ssgoi-transition");
503
456
  n.style.cssText = l.inlineStyle ?? "", Object.assign(n.style, l.displayStyle, {
504
457
  position: "fixed",
505
458
  left: `${l.frame.left}px`,
@@ -511,16 +464,16 @@ class ot extends st {
511
464
  zIndex: "2147483646"
512
465
  }), n.setAttribute("aria-hidden", "true"), n.inert = !0, t.target.parentElement.appendChild(n);
513
466
  const y = Number(l.displayStyle.opacity ?? 1);
514
- this.fallbackCopy = new ot({
467
+ this.fallbackCopy = new nt({
515
468
  element: n,
516
469
  integrator: {
517
- step: (o, f, b) => ({
518
- position: Math.min(f, o.position + b / 0.18),
470
+ step: (a, p, b) => ({
471
+ position: Math.min(p, a.position + b / 0.18),
519
472
  velocity: 0
520
473
  }),
521
- isSettled: (o, f) => o.position >= f
474
+ isSettled: (a, p) => a.position >= p
522
475
  },
523
- style: (o, f) => ({ opacity: y * f }),
476
+ style: (a, p) => ({ opacity: y * p }),
524
477
  onDispose: () => n.remove()
525
478
  }), this.adopted = {
526
479
  ...t,
@@ -531,8 +484,8 @@ class ot extends st {
531
484
  };
532
485
  }
533
486
  }
534
- const c = this.codec.write(this.adopted.channels);
535
- (p = this.hold) == null || p.cancel(), Object.keys(c).length && (this.hold = this.element.animate([c], {
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], {
536
489
  duration: 1,
537
490
  fill: "both"
538
491
  }), this.hold.pause(), this.hold.currentTime = 0);
@@ -564,18 +517,18 @@ class ot extends st {
564
517
  }));
565
518
  let i = e.findIndex((n) => n.time > t);
566
519
  i < 0 && (i = e.length - 1);
567
- const a = Math.max(0, i - 1), c = e[a], d = e[i], u = this.channelsAt(a), m = a === i ? u : this.channelsAt(i), g = (d.time - c.time) / 1e3, p = g ? Math.max(0, Math.min(1, (t - c.time) / (g * 1e3))) : 0, l = {};
568
- for (const [n, y] of Object.entries(u)) {
569
- const o = m[n];
570
- if (!o || !K(y, o)) {
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)) {
571
524
  l[n] = y;
572
525
  continue;
573
526
  }
574
527
  l[n] = {
575
528
  schema: y.schema,
576
- value: y.value.map((f, b) => f + (o.value[b] - f) * p),
529
+ value: y.value.map((p, b) => p + (a.value[b] - p) * u),
577
530
  velocity: y.value.map(
578
- (f, b) => t >= e[e.length - 1].time || !g ? 0 : (o.value[b] - f) / g
531
+ (p, b) => t >= e[e.length - 1].time || !g ? 0 : (a.value[b] - p) / g
579
532
  )
580
533
  };
581
534
  }
@@ -635,12 +588,12 @@ class ot extends st {
635
588
  }
636
589
  getTimeline() {
637
590
  const t = this.frames.map((e, i) => {
638
- const a = e.position, c = this.lowerBound + this.upperBound - a;
591
+ const o = e.position, d = this.lowerBound + this.upperBound - o;
639
592
  return {
640
593
  time: e.time,
641
594
  value: e.position,
642
595
  velocity: e.velocity,
643
- style: this.renderedStyles[i] ?? this.styleFn(a, c)
596
+ style: this.renderedStyles[i] ?? this.styleFn(o, d)
644
597
  };
645
598
  });
646
599
  return [{ element: this._element, frames: t }];
@@ -653,10 +606,10 @@ class ot extends st {
653
606
  runToward(t) {
654
607
  var m, g;
655
608
  if (this.validate(), this.running || this.paused) {
656
- const p = this.getMotionSnapshot();
657
- this.captureLiveState(), this.adopted = p;
609
+ const u = this.getMotionSnapshot();
610
+ this.captureLiveState(), this.adopted = u;
658
611
  }
659
- 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 = dt(
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(
660
613
  this._integrator,
661
614
  this.currentValue,
662
615
  t,
@@ -667,19 +620,19 @@ class ot extends st {
667
620
  this.currentValue = t, this.currentVelocity = 0, this.applyStyleAt(t), this.settled = !0, this.finish();
668
621
  return;
669
622
  }
670
- const e = (p) => this.styleFn(p.position, this.lowerBound + this.upperBound - p.position), i = this.adopted ? this.bridgeKeyframes(e) : this.frames.map((p) => e(p));
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));
671
624
  this.renderedStyles = i, this.adopted = void 0;
672
- const a = i[0], c = this.frames[this.frames.length - 1], d = c.time;
625
+ const o = i[0], d = this.frames[this.frames.length - 1], f = d.time;
673
626
  this.runId++;
674
- const u = this._element.animate(i, {
675
- duration: d,
627
+ const c = this._element.animate(i, {
628
+ duration: f,
676
629
  fill: "both",
677
630
  easing: "linear",
678
631
  composite: "replace"
679
632
  });
680
- u.playbackRate = this.playbackRate, u.currentTime = 0, u.pause(), this.waapi = u, (m = this.fallbackCopy) == null || m.play(), (g = this.hold) == null || g.cancel(), this.hold = null, this.waitingForStart = !0, this.startReady = !0, this.pendingFirstFrame = a, this.running = !0, u.onfinish = () => {
681
- !this.running || this.waapi !== u || (this.running = !1, this.settled = !0, this.currentValue = c.position, this.currentVelocity = 0, this.finish());
682
- }, this.startFramePacedPlayback(u);
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);
683
636
  }
684
637
  /**
685
638
  * Bake the residual correction into the keyframes: each authored frame is
@@ -690,65 +643,65 @@ class ot extends st {
690
643
  bridgeKeyframes(t) {
691
644
  var g;
692
645
  this.codec = this.motion.codec ?? $(this.element);
693
- const e = this.codec, i = Math.max(16, this.motion.handoffDuration ?? 280), a = this.frames[this.frames.length - 1];
694
- for (let p = a.time + 1e3 / 60; p < i + 1e3 / 60; p += 1e3 / 60)
695
- this.frames.push({ time: p, position: a.position, velocity: 0 });
696
- const c = this.frames.map(
697
- (p) => e.read({ transform: "none", opacity: 1, ...t(p) })
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) })
698
651
  );
699
- for (let p = 1; p < c.length; p++) {
700
- const l = c[p - 1].transform, n = c[p].transform;
652
+ for (let u = 1; u < d.length; u++) {
653
+ const l = d[u - 1].transform, n = d[u].transform;
701
654
  if ((l == null ? void 0 : l.schema) === "viewport-plane-v1" && (n == null ? void 0 : n.schema) === l.schema) {
702
655
  const y = [...n.value];
703
656
  y[2] = l.value[2] + Math.atan2(
704
657
  Math.sin(y[2] - l.value[2]),
705
658
  Math.cos(y[2] - l.value[2])
706
- ), c[p].transform = { ...n, value: y };
659
+ ), d[u].transform = { ...n, value: y };
707
660
  }
708
661
  }
709
- const d = c[0], u = c[1] ?? d, m = {};
710
- for (const [p, l] of Object.entries(
662
+ const f = d[0], c = d[1] ?? f, m = {};
663
+ for (const [u, l] of Object.entries(
711
664
  ((g = this.adopted) == null ? void 0 : g.channels) ?? {}
712
665
  )) {
713
- let n = d[p];
666
+ let n = f[u];
714
667
  if (!n) {
715
- const o = p === "transform" ? { transform: "none" } : p === "opacity" ? { opacity: 1 } : {};
716
- if (n = e.read(o)[p], n)
717
- for (const f of c) f[p] = 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;
718
671
  }
719
- if (!n || !K(l, n)) continue;
720
- const y = u[p] ?? n;
721
- m[p] = {
722
- offset: l.value.map((o, f) => {
723
- let b = o - n.value[f];
724
- return p === "transform" && l.schema === "viewport-plane-v1" && f === 2 && (b = Math.atan2(Math.sin(b), Math.cos(b))), b;
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;
725
678
  }),
726
679
  velocity: l.velocity.map(
727
- (o, f) => o / Math.max(Math.abs(this.playbackRate), 1e-4) - (y.value[f] - n.value[f]) * 60
680
+ (a, p) => a / Math.max(Math.abs(this.playbackRate), 1e-4) - (y.value[p] - n.value[p]) * 60
728
681
  )
729
682
  };
730
683
  }
731
- return this.presentationFrames = this.frames.map((p, l) => {
732
- const n = { ...c[l] };
733
- for (const [y, o] of Object.entries(m)) {
734
- const f = n[y];
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];
735
688
  n[y] = {
736
- ...f,
737
- value: f.value.map(
738
- (b, w) => b + pt(
739
- o.offset[w],
740
- o.velocity[w],
741
- p.time / 1e3,
689
+ ...p,
690
+ value: p.value.map(
691
+ (b, S) => b + ut(
692
+ a.offset[S],
693
+ a.velocity[S],
694
+ u.time / 1e3,
742
695
  i / 1e3
743
696
  ).value
744
697
  )
745
698
  };
746
699
  }
747
- return { time: p.time, channels: n };
748
- }), this.frames.map((p, l) => {
700
+ return { time: u.time, channels: n };
701
+ }), this.frames.map((u, l) => {
749
702
  const n = this.presentationFrames[l].channels;
750
703
  return {
751
- ...t(p),
704
+ ...t(u),
752
705
  ...e.write(
753
706
  Object.fromEntries(
754
707
  Object.keys(m).map((y) => [y, n[y]])
@@ -758,89 +711,81 @@ class ot extends st {
758
711
  });
759
712
  }
760
713
  clearWaapi() {
761
- var t, e;
762
- this.runId++, (t = this.waapi) == null || t.cancel(), this.waapi = null, this.waitingForStart = !1, this.startReady = !1, this.pendingFirstFrame = void 0, (e = this.stopStartupClock) == null || e.call(this), this.stopStartupClock = null, this.startupStableFrames = 0;
714
+ var t;
715
+ this.runId++, (t = this.waapi) == null || t.cancel(), this.waapi = null;
763
716
  }
764
717
  captureLiveState() {
765
718
  if (this.frames.length === 0) return;
766
- const t = D(this.waapi);
719
+ const t = et(this.waapi);
767
720
  if (t === null) return;
768
721
  this.presentationTime = t;
769
- const { position: e, velocity: i } = ft(this.frames, t);
770
- this.currentValue = e, this.currentVelocity = i, this.solverState = mt(
722
+ const { position: e, velocity: i } = dt(this.frames, t);
723
+ this.currentValue = e, this.currentVelocity = i, this.solverState = ft(
771
724
  this.frames,
772
725
  t,
773
726
  this._integrator,
774
727
  this.solverTarget
775
728
  );
776
729
  }
777
- startFramePacedPlayback(t) {
778
- if (!(this.waapi !== t || !this.waitingForStart || !this.startReady || this.stopStartupClock)) {
779
- if (typeof requestAnimationFrame > "u" || this.playbackRate < 0) {
780
- this.clearStartStyles(), this.handOffToWaapi(t);
781
- return;
782
- }
783
- this.startupStableFrames = 0, this.stopStartupClock = at.subscribe((e) => {
784
- this.advanceFramePacedStartup(t, e);
785
- });
786
- }
787
- }
788
730
  /**
789
- * Inline start styles are cleared in the same rendering update as the first
790
- * seek, after the paused 0 ms WAAPI frame has had its own frame. Clearing
791
- * earlier can expose the underlying, unanimated style while the animation is
792
- * still pending.
731
+ * `Element.animate()` auto-plays with a pending start time that the browser
732
+ * resolves at its next rendering update, after whatever the current task
733
+ * still has to do. The run is seeked one nominal frame in while pending, so
734
+ * its first painted frame follows the frame that showed its first keyframe.
735
+ * A negative rate takes WAAPI's own auto-rewind: `play()` seeks to the end
736
+ * and runs the baked path backwards.
793
737
  */
794
- clearStartStyles() {
795
- if (this.pendingFirstFrame)
796
- for (const t of Object.keys(this.pendingFirstFrame))
797
- this._element.style[t] = "";
798
- this.pendingFirstFrame = void 0;
799
- }
800
- advanceFramePacedStartup(t, e) {
801
- if (this.waapi !== t || !this.running || this.paused || !this.waitingForStart)
802
- return;
803
- const i = this.frames[this.frames.length - 1];
804
- if (!i) return;
805
- const a = D(t) ?? 0, c = Math.min(
806
- i.time,
807
- a + e.delta * Math.max(0, this.playbackRate)
808
- );
809
- if (t.currentTime = c, this.clearStartStyles(), this.captureLiveState(), c >= i.time) {
810
- this.finishFramePacedRun(t, i);
738
+ beginPlayback(t, e) {
739
+ const i = this.playbackRate;
740
+ if (i < 0) {
741
+ t.play();
811
742
  return;
812
743
  }
813
- e.rawDelta <= bt ? this.startupStableFrames++ : this.startupStableFrames = 0, !(this.startupStableFrames < Ct) && this.handOffToWaapi(t);
814
- }
815
- handOffToWaapi(t) {
816
- var c, d;
817
- if (this.waapi !== t || !this.running || this.paused) return;
818
- (c = this.stopStartupClock) == null || c.call(this), this.stopStartupClock = null, this.waitingForStart = !1, this.startReady = !1, this.startupStableFrames = 0;
819
- const e = (d = t.timeline) == null ? void 0 : d.currentTime, i = D(t), a = this.playbackRate;
820
- if (typeof e == "number" && i !== null && a !== 0) {
821
- t.startTime = e - i / a;
822
- return;
823
- }
824
- t.play();
744
+ i > 0 && (t.currentTime = Math.min(e, gt * i));
825
745
  }
826
- finishFramePacedRun(t, e) {
827
- var i;
828
- this.waapi !== t || !this.running || ((i = this.stopStartupClock) == null || i.call(this), this.stopStartupClock = null, this.waitingForStart = !1, this.startReady = !1, this.startupStableFrames = 0, this.running = !1, this.settled = !0, this.currentValue = e.position, this.currentVelocity = 0, this.finish());
746
+ clearInlineStyle(t) {
747
+ if (t)
748
+ for (const e of Object.keys(t))
749
+ this._element.style[e] = "";
829
750
  }
830
751
  applyStyleAt(t) {
831
752
  const e = this.lowerBound + this.upperBound - t, i = this.styleFn(t, e);
832
- for (const [a, c] of Object.entries(i))
833
- this._element.style[a] = typeof c == "number" ? String(c) : c;
753
+ for (const [o, d] of Object.entries(i))
754
+ this._element.style[o] = typeof d == "number" ? String(d) : d;
834
755
  }
835
756
  }
836
- function D(s) {
757
+ function et(s) {
837
758
  const r = s == null ? void 0 : s.currentTime;
838
759
  return typeof r == "number" ? r : null;
839
760
  }
840
- function wt(s) {
841
- return typeof s.step == "function" ? s : gt.from(s);
761
+ class yt {
762
+ constructor() {
763
+ h(this, "callbacks", /* @__PURE__ */ new Set());
764
+ h(this, "frameRequest", null);
765
+ h(this, "tick", () => {
766
+ this.frameRequest = null;
767
+ for (const r of [...this.callbacks])
768
+ this.callbacks.has(r) && r();
769
+ this.requestFrame();
770
+ });
771
+ }
772
+ subscribe(r) {
773
+ return this.callbacks.add(r), this.requestFrame(), () => {
774
+ this.callbacks.delete(r), this.stopIfIdle();
775
+ };
776
+ }
777
+ requestFrame() {
778
+ this.frameRequest !== null || this.callbacks.size === 0 || (this.frameRequest = requestAnimationFrame(this.tick));
779
+ }
780
+ stopIfIdle() {
781
+ this.callbacks.size > 0 || this.frameRequest === null || (typeof cancelAnimationFrame < "u" && cancelAnimationFrame(this.frameRequest), this.frameRequest = null);
782
+ }
783
+ }
784
+ const vt = new yt();
785
+ function bt(s) {
786
+ return typeof s.step == "function" ? s : pt.from(s);
842
787
  }
843
- class lt extends st {
788
+ class ot extends st {
844
789
  constructor(t, e = {}) {
845
790
  super();
846
791
  h(this, "_children");
@@ -862,8 +807,8 @@ class lt extends st {
862
807
  ), this._children = Array.isArray(t) ? [...t] : [...this.namedChildren.values()];
863
808
  for (const i of this._children) i.deferDisposal = !0;
864
809
  this.progressChildren = this._children.filter(
865
- (i) => !(i instanceof lt) || i.progressChildren.length > 0
866
- ), (e.mode ?? "parallel") === "sequence" ? this._startAt = this._children.map((i, a) => a === 0 ? 0 : 1) : this._startAt = e.startAt ?? [];
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 ?? [];
867
812
  }
868
813
  /** Child animations in play order. */
869
814
  get children() {
@@ -899,7 +844,7 @@ class lt extends st {
899
844
  set(t, e) {
900
845
  if (typeof t == "string") {
901
846
  const i = this.select(t);
902
- return (e == null ? void 0 : e.integrator) !== void 0 && i.set({ integrator: wt(e.integrator) }), this;
847
+ return (e == null ? void 0 : e.integrator) !== void 0 && i.set({ integrator: bt(e.integrator) }), this;
903
848
  }
904
849
  return super.set(t);
905
850
  }
@@ -923,8 +868,8 @@ class lt extends st {
923
868
  this.settled = !0, this.running = !1, this.clearPendingStartObservers(), this.restoreCompletionHandlers();
924
869
  for (const e of this._children) e.complete();
925
870
  if (!this.deferDisposal) {
926
- for (const e of this._children) e.cancel(j);
927
- this.disposeResources(j);
871
+ for (const e of this._children) e.cancel(E);
872
+ this.disposeResources(E);
928
873
  }
929
874
  (t = this.onComplete) == null || t.call(this);
930
875
  }
@@ -988,68 +933,66 @@ class lt extends st {
988
933
  }
989
934
  /* ───────────────────────────────────────────────────────── private */
990
935
  startRun(t) {
991
- const e = this.buildDependencies(), i = this.pausedRun && t === this.lastMethod, a = t !== this.lastMethod, c = new Set(this.startedChildren), d = new Set(
992
- this._children.filter((o) => o.isComplete)
993
- ), u = t === "reverse" && c.size ? this._children.filter((o) => c.has(o)) : [...this._children], m = t === "reverse" ? [...u].reverse() : u, g = /* @__PURE__ */ new Map();
936
+ const e = this.buildDependencies(), i = this.pausedRun && t === this.lastMethod, o = t !== this.lastMethod, d = new Set(this.startedChildren), f = new Set(
937
+ 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();
994
939
  if (t === "reverse")
995
- for (const [o, f] of e) {
996
- if (!u.includes(o) || !u.includes(f.after))
940
+ for (const [a, p] of e) {
941
+ if (!c.includes(a) || !c.includes(p.after))
997
942
  continue;
998
- const b = g.get(f.after) ?? [];
943
+ const b = g.get(p.after) ?? [];
999
944
  b.push({
1000
- after: o,
1001
- at: f.at === "settled" ? "settled" : 1 - f.at
1002
- }), g.set(f.after, b);
945
+ after: a,
946
+ at: p.at === "settled" ? "settled" : 1 - p.at
947
+ }), g.set(p.after, b);
1003
948
  }
1004
949
  else
1005
- for (const [o, f] of e)
1006
- g.set(o, [f]);
1007
- if (a || i)
1008
- for (const o of c)
1009
- d.has(o) || g.delete(o);
950
+ 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);
1010
955
  this.running && this.pause(), this.restoreCompletionHandlers();
1011
- const p = ++this.runId;
1012
- if (this.running = !0, this.pausedRun = !1, this.lastMethod = t, this.disposed = !1, this.settled = !1, this.pendingComplete = u.length, !i && !a && this.startedChildren.clear(), this.pendingComplete === 0) {
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) {
1013
958
  this.handleFinished();
1014
959
  return;
1015
960
  }
1016
961
  const l = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
1017
962
  if (i)
1018
- for (const o of u)
1019
- c.has(o) && d.has(o) && (n.add(o), l.add(o), this.pendingComplete--);
1020
- for (const o of u) {
1021
- const f = o.onComplete, b = () => {
1022
- if (!(this.runId !== p || !this.running || l.has(o))) {
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))) {
1023
968
  try {
1024
- f == null || f();
1025
- } catch (w) {
1026
- console.error("[ssgoi] animation completion failed", w);
969
+ p == null || p();
970
+ } catch (S) {
971
+ console.error("[ssgoi] animation completion failed", S);
1027
972
  }
1028
- l.add(o), --this.pendingComplete === 0 && this.handleFinished();
973
+ l.add(a), --this.pendingComplete === 0 && this.handleFinished();
1029
974
  }
1030
975
  };
1031
- o.onComplete = b, this.restoreChildCallbacks.push(() => {
1032
- o.onComplete === b && (o.onComplete = f);
976
+ a.onComplete = b, this.restoreChildCallbacks.push(() => {
977
+ a.onComplete === b && (a.onComplete = p);
1033
978
  });
1034
979
  }
1035
980
  const y = () => {
1036
- let o = !0;
1037
- for (; this.running && this.runId === p && o; ) {
1038
- o = !1;
1039
- for (const f of m)
1040
- !this.running || n.has(f) || (g.get(f) ?? []).some(
1041
- (w) => !n.has(w.after) || !this.hasReachedThreshold(
1042
- w.after,
1043
- w.at,
981
+ let a = !0;
982
+ for (; this.running && this.runId === u && a; ) {
983
+ a = !1;
984
+ 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,
1044
989
  t
1045
990
  )
1046
- ) || (n.add(f), this.startedChildren.add(f), f[t](), o = !0);
991
+ ) || (n.add(p), this.startedChildren.add(p), p[t](), a = !0);
1047
992
  }
1048
- n.size === u.length && this.clearPendingStartObservers();
993
+ n.size === c.length && this.clearPendingStartObservers();
1049
994
  };
1050
- y(), this.pendingComplete === 0 && this.handleFinished(), this.running && n.size !== u.length && this.pendingStartObservers.push(
1051
- at.subscribe(y, "observe")
1052
- );
995
+ y(), this.pendingComplete === 0 && this.handleFinished(), this.running && n.size !== c.length && this.pendingStartObservers.push(vt.subscribe(y));
1053
996
  }
1054
997
  buildDependencies() {
1055
998
  const t = /* @__PURE__ */ new Map(), e = new Set(this._children);
@@ -1057,28 +1000,28 @@ class lt extends st {
1057
1000
  throw new Error(
1058
1001
  "Each child animation must occur once in a MultiAnimation"
1059
1002
  );
1060
- this._children.forEach((d, u) => {
1061
- const m = d.startCondition;
1003
+ this._children.forEach((f, c) => {
1004
+ const m = f.startCondition;
1062
1005
  if (m) {
1063
1006
  if (!e.has(m.after))
1064
1007
  throw new Error(
1065
1008
  "startAt.after must reference a sibling in the same MultiAnimation"
1066
1009
  );
1067
- t.set(d, { ...m });
1068
- } else u > 0 && this._startAt.some((g) => g > 0) && t.set(d, {
1069
- after: this._children[u - 1],
1070
- at: this._startAt[u] ?? 0
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
1071
1014
  });
1072
1015
  });
1073
- const i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), c = (d) => {
1074
- if (a.has(d))
1016
+ const i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), d = (f) => {
1017
+ if (o.has(f))
1075
1018
  throw new Error("Animation startAt dependencies form a cycle");
1076
- if (i.has(d)) return;
1077
- a.add(d);
1078
- const u = t.get(d);
1079
- u && c(u.after), a.delete(d), i.add(d);
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);
1080
1023
  };
1081
- return this._children.forEach(c), t;
1024
+ return this._children.forEach(d), t;
1082
1025
  }
1083
1026
  hasReachedThreshold(t, e, i) {
1084
1027
  return t.isComplete ? !0 : e === "settled" ? !1 : e <= 0 ? !0 : (i === "play" ? t.progress : 1 - t.progress) >= e;
@@ -1095,8 +1038,8 @@ class lt extends st {
1095
1038
  var t;
1096
1039
  if (this.running) {
1097
1040
  if (this.running = !1, this.settled = !0, this.clearPendingStartObservers(), this.restoreCompletionHandlers(), !this.deferDisposal) {
1098
- for (const e of this._children) e.cancel(j);
1099
- this.disposeResources(j);
1041
+ for (const e of this._children) e.cancel(E);
1042
+ this.disposeResources(E);
1100
1043
  }
1101
1044
  (t = this.onComplete) == null || t.call(this);
1102
1045
  }
@@ -1105,15 +1048,15 @@ class lt extends st {
1105
1048
  return null;
1106
1049
  }
1107
1050
  }
1108
- const X = /* @__PURE__ */ new WeakMap();
1109
- function Mt(s) {
1110
- const r = X.get(s) ?? {
1051
+ const K = /* @__PURE__ */ new WeakMap();
1052
+ function St(s) {
1053
+ const r = K.get(s) ?? {
1111
1054
  value: s.style.getPropertyValue("opacity"),
1112
1055
  priority: s.style.getPropertyPriority("opacity"),
1113
1056
  opacity: typeof getComputedStyle == "function" ? Number.parseFloat(getComputedStyle(s).opacity) : Number.NaN,
1114
1057
  users: /* @__PURE__ */ new Set()
1115
1058
  }, t = {};
1116
- r.users.add(t), X.set(s, r);
1059
+ r.users.add(t), K.set(s, r);
1117
1060
  let e = !1;
1118
1061
  return {
1119
1062
  opacity: Number.isFinite(r.opacity) ? r.opacity : 1,
@@ -1123,20 +1066,20 @@ function Mt(s) {
1123
1066
  restore: () => {
1124
1067
  if (!e) {
1125
1068
  if (e = !0, r.users.delete(t), r.users.size > 0) {
1126
- const i = Array.from(r.users), a = i[i.length - 1];
1127
- (a == null ? void 0 : a.value) !== void 0 && (s.style.opacity = String(a.value));
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));
1128
1071
  return;
1129
1072
  }
1130
- r.value ? s.style.setProperty("opacity", r.value, r.priority) : s.style.removeProperty("opacity"), X.delete(s);
1073
+ r.value ? s.style.setProperty("opacity", r.value, r.priority) : s.style.removeProperty("opacity"), K.delete(s);
1131
1074
  }
1132
1075
  }
1133
1076
  };
1134
1077
  }
1135
1078
  export {
1136
1079
  st as A,
1137
- lt as M,
1138
- ot as W,
1080
+ ot as M,
1081
+ nt as W,
1139
1082
  $ as c,
1140
- j as f,
1141
- Mt as r
1083
+ E as f,
1084
+ St as r
1142
1085
  };