@ssgoi/core 7.2.0 → 7.3.0-beta.2

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.
Files changed (61) hide show
  1. package/dist/animation/animation.d.ts +21 -0
  2. package/dist/animation/animation.d.ts.map +1 -1
  3. package/dist/animation/host-animation.d.ts +28 -19
  4. package/dist/animation/host-animation.d.ts.map +1 -1
  5. package/dist/animation/multi-animation.d.ts +13 -2
  6. package/dist/animation/multi-animation.d.ts.map +1 -1
  7. package/dist/animation/web-animation.d.ts +76 -4
  8. package/dist/animation/web-animation.d.ts.map +1 -1
  9. package/dist/animation/web-presentation.d.ts +25 -0
  10. package/dist/animation/web-presentation.d.ts.map +1 -0
  11. package/dist/index.cjs +3 -3
  12. package/dist/index.d.ts +4 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1206 -1184
  15. package/dist/internal.cjs +1 -1
  16. package/dist/internal.js +924 -631
  17. package/dist/{page-motion-MEazegOU.js → page-motion-CoPTk-Gd.js} +1 -1
  18. package/dist/{page-motion-DF3fFkOw.cjs → page-motion-Dhj3UfzO.cjs} +1 -1
  19. package/dist/provider-BLf6XeXT.js +291 -0
  20. package/dist/provider-JDtJ5Jzf.cjs +1 -0
  21. package/dist/retain-opacity-C5ajTKSI.cjs +1 -0
  22. package/dist/retain-opacity-ChyA_fg_.js +1142 -0
  23. package/dist/runtime/index.d.ts +1 -0
  24. package/dist/runtime/index.d.ts.map +1 -1
  25. package/dist/runtime/motion-matching.d.ts +31 -0
  26. package/dist/runtime/motion-matching.d.ts.map +1 -0
  27. package/dist/runtime/timeline.d.ts +6 -2
  28. package/dist/runtime/timeline.d.ts.map +1 -1
  29. package/dist/runtime.cjs +1 -1
  30. package/dist/runtime.js +29 -25
  31. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
  32. package/dist/transitions/blind/transition.d.ts.map +1 -1
  33. package/dist/transitions/crossfade.d.ts +1 -6
  34. package/dist/transitions/crossfade.d.ts.map +1 -1
  35. package/dist/transitions/film/transition.d.ts.map +1 -1
  36. package/dist/transitions/hero/in-place.d.ts +5 -2
  37. package/dist/transitions/hero/in-place.d.ts.map +1 -1
  38. package/dist/transitions/hero/provider/chrome/fade.d.ts.map +1 -1
  39. package/dist/transitions/hero/provider/chrome/static.d.ts.map +1 -1
  40. package/dist/transitions/hero/transition.d.ts.map +1 -1
  41. package/dist/transitions/hero/types.d.ts +2 -1
  42. package/dist/transitions/hero/types.d.ts.map +1 -1
  43. package/dist/transitions/shared-visibility.d.ts +2 -0
  44. package/dist/transitions/shared-visibility.d.ts.map +1 -0
  45. package/dist/transitions/sheet/transition.d.ts.map +1 -1
  46. package/dist/transitions/zoom/crossfade.d.ts.map +1 -1
  47. package/dist/transitions/zoom/provider/blur.d.ts.map +1 -1
  48. package/dist/transitions/zoom/transition.d.ts.map +1 -1
  49. package/dist/transitions/zoom/types.d.ts +2 -1
  50. package/dist/transitions/zoom/types.d.ts.map +1 -1
  51. package/dist/types/index.d.ts +4 -0
  52. package/dist/types/index.d.ts.map +1 -1
  53. package/dist/utils/index.d.ts +1 -0
  54. package/dist/utils/index.d.ts.map +1 -1
  55. package/dist/utils/retain-opacity.d.ts +7 -0
  56. package/dist/utils/retain-opacity.d.ts.map +1 -0
  57. package/package.json +1 -1
  58. package/dist/multi-animation-Du9W3ZS_.js +0 -503
  59. package/dist/multi-animation-hDUcfD7W.cjs +0 -1
  60. package/dist/provider-Cea0Pfm1.js +0 -232
  61. package/dist/provider-D9Q2URox.cjs +0 -1
package/dist/internal.js CHANGED
@@ -1,38 +1,258 @@
1
- var Ze = Object.defineProperty;
2
- var Je = (t, n, e) => n in t ? Ze(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
- var J = (t, n, e) => Je(t, typeof n != "symbol" ? n + "" : n, e);
4
- import { n as Ae, r as Qe } from "./resolve-transition-rule-DbkMu0rm.js";
5
- import { A as et } from "./multi-animation-Du9W3ZS_.js";
6
- import { M as Bt, W as Ft } from "./multi-animation-Du9W3ZS_.js";
7
- import { s as Kt } from "./provider-Cea0Pfm1.js";
8
- class tt extends et {
1
+ var kt = Object.defineProperty;
2
+ var Tt = (t, n, e) => n in t ? kt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
+ var G = (t, n, e) => Tt(t, typeof n != "symbol" ? n + "" : n, e);
4
+ import { n as Je, r as Pt } from "./resolve-transition-rule-DbkMu0rm.js";
5
+ import { A as Rt, W as Qe, M as et, r as xt, c as tt, f as Mt } from "./retain-opacity-ChyA_fg_.js";
6
+ import { S as Ct, m as At } from "./provider-BLf6XeXT.js";
7
+ import { a as gn } from "./provider-BLf6XeXT.js";
8
+ function se(t) {
9
+ return [...t.getMotionTracks()];
10
+ }
11
+ class Ot extends Rt {
9
12
  constructor() {
10
13
  super(...arguments);
11
- J(this, "child", null);
12
- J(this, "_state", "idle");
13
- J(this, "_settled", !1);
14
- J(this, "listeners", /* @__PURE__ */ new Set());
14
+ G(this, "child", null);
15
+ G(this, "run", null);
16
+ G(this, "retiring", []);
17
+ G(this, "owners", /* @__PURE__ */ new WeakMap());
18
+ G(this, "epoch", 0);
19
+ G(this, "prepared", null);
20
+ G(this, "_state", "idle");
21
+ G(this, "_settled", !1);
22
+ G(this, "listeners", /* @__PURE__ */ new Set());
23
+ G(this, "onHandoff");
24
+ }
25
+ /** Called before effect prepare mutates reused elements or measures anchors. */
26
+ prepareHandoff() {
27
+ var e;
28
+ if (!this.prepared) {
29
+ this.prepared = this.sceneSnapshots(), (e = this.child) == null || e.pause();
30
+ for (const s of this.retiring)
31
+ for (const l of s.releases) l.pause();
32
+ }
15
33
  }
16
- attach(e) {
17
- const o = this.child;
18
- if (this.child = e, this._settled = !1, o) {
19
- const u = o.getPose();
20
- o.complete(), e.matchInto(u);
34
+ attach(e, s = {}) {
35
+ var L;
36
+ if (this.child === e) return;
37
+ e.validate();
38
+ const l = this.run, r = this.prepared ?? this.sceneSnapshots();
39
+ this.prepared = null;
40
+ const h = ++this.epoch, a = se(e), v = r.filter(
41
+ (u) => u.lifetime !== "temporary" && !a.some((o) => o.element === u.target) && (s.targets ?? []).some(
42
+ (o) => {
43
+ var c;
44
+ return o === u.target || ((c = o.contains) == null ? void 0 : c.call(o, u.target));
45
+ }
46
+ ) && // Only channels with a known base presentation can be restored.
47
+ // Anything else (clip, filter, color) is returned by the previous
48
+ // effect's own cleanup, which keeps ownership of that target.
49
+ ("transform" in u.channels || "opacity" in u.channels)
50
+ ).map((u) => {
51
+ const o = u.target, c = {
52
+ transform: o.style.transform,
53
+ opacity: o.style.opacity
54
+ }, w = o.style.opacity || 1;
55
+ return new Qe({
56
+ element: o,
57
+ integrator: new Ct({ stiffness: 200, damping: 24 }),
58
+ style: () => ({ transform: "none", opacity: w }),
59
+ motion: { key: u.key, role: u.role, space: u.space },
60
+ // A restoration writes its resting frame inline when it settles.
61
+ // Leave no trace where nothing was set before, so the element's
62
+ // stylesheet values govern again.
63
+ onDispose: () => {
64
+ !c.transform && o.style.transform === "none" && (o.style.transform = ""), !c.opacity && String(o.style.opacity) === String(w) && (o.style.opacity = "");
65
+ }
66
+ });
67
+ });
68
+ if (v.length) {
69
+ const u = e.onDispose;
70
+ e.onDispose = void 0, e = new et({
71
+ effect: e,
72
+ restore: new et(v)
73
+ }), e.onDispose = u;
74
+ }
75
+ const g = se(e), m = /* @__PURE__ */ new Set([
76
+ ...s.targets ?? [],
77
+ ...g.map((u) => u.element)
78
+ ]);
79
+ for (const u of s.targets ?? []) this.owners.set(u, h);
80
+ for (const u of a) this.owners.set(u.element, h);
81
+ this.child = e;
82
+ const d = { animation: e, epoch: h, targets: m, hidden: [] };
83
+ this.run = d, this._settled = !1;
84
+ const y = [];
85
+ if (e.supportsInterruption && (!l || l.animation.supportsInterruption)) {
86
+ const u = At(
87
+ r,
88
+ g.map((o) => o.motionIdentity)
89
+ );
90
+ u.forEach((o, c) => {
91
+ y.push({
92
+ kind: o.reason,
93
+ target: o.next.target,
94
+ key: o.next.key
95
+ }), o.previous && g[c].adopt(o.previous), g[c].handoffFallbacks.length && y.push({
96
+ kind: "fallback",
97
+ target: o.next.target,
98
+ channels: g[c].handoffFallbacks,
99
+ fallback: g[c].handoffFallbackMode
100
+ });
101
+ });
102
+ for (const o of u) {
103
+ if (!o.previous || o.previous.target === o.next.target)
104
+ continue;
105
+ if (o.previous.lifetime === "temporary") {
106
+ o.previous.target.remove();
107
+ continue;
108
+ }
109
+ const c = xt(o.previous.target);
110
+ c.set(0), d.hidden.push(c.restore);
111
+ }
112
+ for (const o of [...this.retiring]) {
113
+ for (const c of o.releases)
114
+ (m.has(c.element) || u.some((C) => {
115
+ var W;
116
+ return ((W = C.previous) == null ? void 0 : W.target) === c.element;
117
+ })) && c.cancel({ reason: "interrupted", owns: () => !1 });
118
+ o.releases = o.releases.filter((c) => c.isAnimating || c.isPaused), o.releases.length || this.disposeRetiring(o);
119
+ }
120
+ l && this.retire(
121
+ l,
122
+ r,
123
+ /* @__PURE__ */ new Set([
124
+ ...m,
125
+ ...u.flatMap((o) => o.previous ? [o.previous.target] : [])
126
+ ]),
127
+ y
128
+ );
129
+ } else if (l) {
130
+ y.push({ kind: "fallback" });
131
+ const u = [...m].map(
132
+ (o) => [o, o.style.cssText]
133
+ );
134
+ l.animation.complete();
135
+ for (const [o, c] of u) o.style.cssText = c;
21
136
  }
22
137
  e.playbackRate = this.playbackRate;
23
- const c = e.onComplete;
138
+ const E = e.onDispose;
139
+ e.onDispose = (u) => {
140
+ try {
141
+ E == null || E(u);
142
+ } finally {
143
+ for (const o of d.hidden.splice(0)) o();
144
+ }
145
+ };
146
+ const O = e.onComplete;
24
147
  e.onComplete = () => {
25
- c == null || c(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
148
+ O == null || O(), this.child === e && (this.child = null, this.run = null, this._state = "idle", this._settled = this.retiring.length === 0), this.notify();
26
149
  };
27
- const s = e.onUpdate;
150
+ const x = e.onUpdate;
28
151
  e.onUpdate = (u) => {
29
- var i;
30
- s == null || s(u), (i = this.onUpdate) == null || i.call(this, u), this.notify();
31
- }, this._state === "paused" ? e.pause() : this._state === "reversing" ? e.reverse() : (this._state = "playing", e.play()), this.notify();
152
+ var o;
153
+ x == null || x(u), this.child === e && ((o = this.onUpdate) == null || o.call(this, u), this.notify());
154
+ }, this._state === "paused" ? e.pause() : (this._state = "playing", e.play());
155
+ for (const u of this.retiring)
156
+ for (const o of u.releases)
157
+ this._state !== "paused" && o.isPaused && o.play();
158
+ (L = this.onHandoff) == null || L.call(this, y), this.notify();
159
+ }
160
+ sceneSnapshots() {
161
+ return [
162
+ ...this.child ? se(this.child).map((e) => e.getMotionSnapshot()) : [],
163
+ ...this.run ? [...this.run.targets].filter(
164
+ (e) => !se(this.run.animation).some((s) => s.element === e)
165
+ ).map((e) => ({
166
+ target: e,
167
+ channels: tt(e).read({
168
+ transform: typeof getComputedStyle == "function" && getComputedStyle(e).transform || "none",
169
+ opacity: typeof getComputedStyle == "function" && getComputedStyle(e).opacity || "1"
170
+ })
171
+ })) : [],
172
+ ...this.retiring.flatMap(
173
+ (e) => e.releases.map((s) => s.getMotionSnapshot())
174
+ )
175
+ ];
176
+ }
177
+ disposal(e) {
178
+ return {
179
+ reason: "interrupted",
180
+ owns: (s) => !this.owners.has(s) || this.owners.get(s) === e.epoch
181
+ };
182
+ }
183
+ retire(e, s, l, r) {
184
+ var g, m, d;
185
+ e.animation.stop();
186
+ const h = se(e.animation), a = { ...e, releases: [] }, v = /* @__PURE__ */ new Set([...e.targets, ...l]);
187
+ for (const y of e.targets) {
188
+ if (l.has(y) || [...v].some(
189
+ (c) => {
190
+ var w;
191
+ return c !== y && ((w = c.contains) == null ? void 0 : w.call(c, y));
192
+ }
193
+ ))
194
+ continue;
195
+ const E = s.find((c) => c.target === y);
196
+ if (!E || ((g = h.find((c) => c.element === y)) == null ? void 0 : g.motion.release) === "remove")
197
+ continue;
198
+ const O = (m = h.find((c) => c.element === y)) == null ? void 0 : m.motion.release;
199
+ if (typeof O == "function")
200
+ try {
201
+ const c = O(E);
202
+ if (c.element !== y)
203
+ throw new Error("Release must own the retiring target");
204
+ c.validate();
205
+ const w = c.onComplete;
206
+ c.onComplete = () => {
207
+ w == null || w(), a.releases.every((C) => C.isComplete) && this.disposeRetiring(a);
208
+ }, c.adopt(E), c.playbackRate = this.playbackRate, a.releases.push(c), r.push({ kind: "release", target: y });
209
+ continue;
210
+ } catch (c) {
211
+ console.error("[ssgoi] invalid release; using fade", c), r.push({ kind: "fallback", target: y });
212
+ }
213
+ const L = tt(y).write(E.channels), u = Number(L.opacity ?? 1), o = new Qe({
214
+ element: y,
215
+ integrator: {
216
+ step: (c, w, C) => ({
217
+ position: Math.min(w, c.position + C / 0.18),
218
+ velocity: c.position >= w ? 0 : 1 / 0.18
219
+ }),
220
+ isSettled: (c, w) => c.position >= w
221
+ },
222
+ style: (c, w) => ({ ...L, opacity: u * w }),
223
+ motion: {
224
+ ...(d = h.find((c) => c.element === y)) == null ? void 0 : d.motion,
225
+ handoffDuration: 180
226
+ },
227
+ onComplete: () => {
228
+ a.releases.every((c) => c.isComplete) && this.disposeRetiring(a);
229
+ }
230
+ });
231
+ o.adopt(E), o.playbackRate = this.playbackRate, a.releases.push(o), r.push({ kind: "release", target: y });
232
+ }
233
+ if (!a.releases.length) {
234
+ e.animation.cancel(this.disposal(e));
235
+ return;
236
+ }
237
+ this.retiring.push(a);
238
+ for (const y of a.releases)
239
+ y.play(), this._state === "paused" && y.pause();
240
+ for (; this.retiring.length > 8; ) this.disposeRetiring(this.retiring[0]);
241
+ }
242
+ disposeRetiring(e) {
243
+ if (this.retiring.includes(e)) {
244
+ this.retiring = this.retiring.filter((s) => s !== e);
245
+ for (const s of e.releases)
246
+ s.cancel({ reason: "disposed", owns: () => !1 });
247
+ e.animation.cancel(this.disposal(e)), !this.child && !this.retiring.length && (this._settled = !0), this.notify();
248
+ }
32
249
  }
33
250
  play() {
34
251
  var e;
35
- this._state = "playing", this._settled = !1, (e = this.child) == null || e.play(), this.notify();
252
+ this._state = "playing", this._settled = !1, (e = this.child) == null || e.play();
253
+ for (const s of this.retiring)
254
+ for (const l of s.releases) l.play();
255
+ this.notify();
36
256
  }
37
257
  reverse() {
38
258
  var e;
@@ -40,21 +260,33 @@ class tt extends et {
40
260
  }
41
261
  pause() {
42
262
  var e;
43
- this._state = "paused", (e = this.child) == null || e.pause(), this.notify();
263
+ this._state = "paused", (e = this.child) == null || e.pause();
264
+ for (const s of this.retiring)
265
+ for (const l of s.releases) l.pause();
266
+ this.notify();
44
267
  }
45
268
  complete() {
46
269
  var e;
47
- (e = this.child) == null || e.complete(), this.notify();
270
+ this.prepared = null, (e = this.child) == null || e.complete();
271
+ for (const s of [...this.retiring]) this.disposeRetiring(s);
272
+ this.notify();
273
+ }
274
+ cancel(e) {
275
+ this.prepared = null;
276
+ const s = this.child;
277
+ this.child = null, this.run = null, this._state = "idle", s == null || s.cancel(e);
278
+ for (const l of [...this.retiring]) this.disposeRetiring(l);
279
+ this._settled = !0, this.notify();
48
280
  }
49
281
  get isAnimating() {
50
282
  var e;
51
- return ((e = this.child) == null ? void 0 : e.isAnimating) ?? !1;
283
+ return !!((e = this.child) != null && e.isAnimating) || this.retiring.some((s) => s.releases.some((l) => l.isAnimating));
52
284
  }
53
285
  get isPaused() {
54
286
  return this._state === "paused";
55
287
  }
56
288
  get isComplete() {
57
- return this._settled && !this.child;
289
+ return this._settled && !this.child && !this.retiring.length;
58
290
  }
59
291
  get isReversing() {
60
292
  var e;
@@ -65,14 +297,17 @@ class tt extends et {
65
297
  return ((e = this.child) == null ? void 0 : e.progress) ?? 0;
66
298
  }
67
299
  findTimeForProgress(e) {
68
- var o;
69
- return ((o = this.child) == null ? void 0 : o.findTimeForProgress(e)) ?? null;
300
+ var s;
301
+ return ((s = this.child) == null ? void 0 : s.findTimeForProgress(e)) ?? null;
70
302
  }
71
303
  get playbackRate() {
72
304
  return super.playbackRate;
73
305
  }
74
306
  set playbackRate(e) {
75
- super.playbackRate = e, this.child && (this.child.playbackRate = e), this.notify();
307
+ super.playbackRate = e, this.child && (this.child.playbackRate = e);
308
+ for (const s of this.retiring)
309
+ for (const l of s.releases) l.playbackRate = e;
310
+ this.notify();
76
311
  }
77
312
  getPose() {
78
313
  var e;
@@ -83,14 +318,15 @@ class tt extends et {
83
318
  return ((e = this.child) == null ? void 0 : e.getTimeline()) ?? [];
84
319
  }
85
320
  matchInto(e) {
86
- var o;
87
- (o = this.child) == null || o.matchInto(e);
321
+ var s;
322
+ (s = this.child) == null || s.matchInto(e);
88
323
  }
89
- /** Currently attached child, or null when nothing is playing. */
90
324
  get activeChild() {
91
325
  return this.child;
92
326
  }
93
- /** Subscribe to host state changes. Returns an unsubscribe fn. */
327
+ get retiringCount() {
328
+ return this.retiring.length;
329
+ }
94
330
  subscribe(e) {
95
331
  return this.listeners.add(e), () => {
96
332
  this.listeners.delete(e);
@@ -100,19 +336,19 @@ class tt extends et {
100
336
  for (const e of this.listeners) e();
101
337
  }
102
338
  }
103
- const nt = (t, n) => {
339
+ const Dt = (t, n) => {
104
340
  var e;
105
341
  t.style.position = "absolute", t.style.width = "100%", t.style.top = `${-1 * (((e = n == null ? void 0 : n.scrollOffset) == null ? void 0 : e.y) ?? 0)}px`, t.style.left = "0";
106
- }, Le = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), ot = (t) => {
342
+ }, nt = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), Lt = (t) => {
107
343
  let n = t.parentElement;
108
344
  for (; n && n !== document.body; ) {
109
345
  const e = window.getComputedStyle(n);
110
- if (Le.has(e.overflowY) || Le.has(e.overflowX))
346
+ if (nt.has(e.overflowY) || nt.has(e.overflowX))
111
347
  return n;
112
348
  n = n.parentElement;
113
349
  }
114
350
  return document.documentElement;
115
- }, rt = (t) => {
351
+ }, _t = (t) => {
116
352
  let n = t.parentElement;
117
353
  for (; n && n !== document.body; ) {
118
354
  const e = window.getComputedStyle(n).position;
@@ -122,24 +358,24 @@ const nt = (t, n) => {
122
358
  }
123
359
  return document.body;
124
360
  };
125
- function st(t) {
361
+ function Ht(t) {
126
362
  const n = Object.keys(t);
127
363
  return Promise.all(n.map((e) => t[e])).then((e) => {
128
- const o = {};
129
- return n.forEach((c, s) => {
130
- o[c] = e[s];
131
- }), o;
364
+ const s = {};
365
+ return n.forEach((l, r) => {
366
+ s[l] = e[r];
367
+ }), s;
132
368
  });
133
369
  }
134
- const we = /* @__PURE__ */ new WeakMap();
135
- function it(t) {
136
- let n = we.get(t);
370
+ const Ae = /* @__PURE__ */ new WeakMap();
371
+ function It(t) {
372
+ let n = Ae.get(t);
137
373
  if (!n) {
138
- const o = t.ownerDocument, s = t === o.documentElement || t === o.scrollingElement ? o : t, u = (f) => {
139
- f.type === "wheel" && f.ctrlKey || f.type === "touchmove" && f.touches.length > 1 || f.cancelable && f.preventDefault();
140
- }, i = { passive: !1, capture: !0 };
141
- s.addEventListener("wheel", u, i), s.addEventListener("touchmove", u, i);
142
- const y = /* @__PURE__ */ new Set([
374
+ const s = t.ownerDocument, r = t === s.documentElement || t === s.scrollingElement ? s : t, h = (m) => {
375
+ m.type === "wheel" && m.ctrlKey || m.type === "touchmove" && m.touches.length > 1 || m.cancelable && m.preventDefault();
376
+ }, a = { passive: !1, capture: !0 };
377
+ r.addEventListener("wheel", h, a), r.addEventListener("touchmove", h, a);
378
+ const v = /* @__PURE__ */ new Set([
143
379
  "ArrowUp",
144
380
  "ArrowDown",
145
381
  "ArrowLeft",
@@ -149,315 +385,315 @@ function it(t) {
149
385
  "Home",
150
386
  "End",
151
387
  " "
152
- ]), h = (f) => {
153
- var g, R;
154
- const d = f;
155
- if (!(d.defaultPrevented || d.altKey || !y.has(d.key))) {
156
- for (const I of d.composedPath()) {
157
- const x = I;
158
- if (x.isContentEditable || (g = x.matches) != null && g.call(
388
+ ]), g = (m) => {
389
+ var y, E;
390
+ const d = m;
391
+ if (!(d.defaultPrevented || d.altKey || !v.has(d.key))) {
392
+ for (const O of d.composedPath()) {
393
+ const x = O;
394
+ if (x.isContentEditable || (y = x.matches) != null && y.call(
159
395
  x,
160
396
  "input, textarea, select, [role=slider], [role=spinbutton], [role=listbox], [role=menu], [role=tablist]"
161
- ) || d.key === " " && ((R = x.matches) != null && R.call(x, "button, [role=button]"))) return;
397
+ ) || d.key === " " && ((E = x.matches) != null && E.call(x, "button, [role=button]"))) return;
162
398
  }
163
399
  d.cancelable && d.preventDefault();
164
400
  }
165
401
  };
166
- s.addEventListener("keydown", h, { capture: !0 }), n = {
402
+ r.addEventListener("keydown", g, { capture: !0 }), n = {
167
403
  owners: 0,
168
404
  restore() {
169
- s.removeEventListener("wheel", u, { capture: !0 }), s.removeEventListener("touchmove", u, {
405
+ r.removeEventListener("wheel", h, { capture: !0 }), r.removeEventListener("touchmove", h, {
170
406
  capture: !0
171
- }), s.removeEventListener("keydown", h, {
407
+ }), r.removeEventListener("keydown", g, {
172
408
  capture: !0
173
409
  });
174
410
  }
175
- }, we.set(t, n);
411
+ }, Ae.set(t, n);
176
412
  }
177
413
  n.owners++;
178
414
  let e = !1;
179
415
  return () => {
180
- e || (e = !0, --n.owners === 0 && (we.delete(t), n.restore()));
416
+ e || (e = !0, --n.owners === 0 && (Ae.delete(t), n.restore()));
181
417
  };
182
418
  }
183
- const lt = 768, ct = 10, at = 10;
184
- function ut(t = {}) {
185
- const { resolvePath: n = (m) => m } = t;
186
- let e = null, o = null;
187
- const c = /* @__PURE__ */ new Set(), s = (m) => {
188
- const S = m && e ? it(e) : () => {
189
- }, O = () => {
190
- c.delete(O) && S();
419
+ const Nt = 768, Wt = 10, Ft = 10;
420
+ function Bt(t = {}) {
421
+ const { resolvePath: n = (b) => b } = t;
422
+ let e = null, s = null;
423
+ const l = /* @__PURE__ */ new Set(), r = (b) => {
424
+ const k = b && e ? It(e) : () => {
425
+ }, _ = () => {
426
+ l.delete(_) && k();
191
427
  };
192
- return c.add(O), O;
428
+ return l.add(_), _;
193
429
  };
194
- let u = !1, i = !1;
195
- const y = () => {
196
- const m = (e == null ? void 0 : e.clientWidth) ?? 0, S = m > 0 ? m : typeof window < "u" ? window.innerWidth : 0;
197
- return S > 0 && S < lt;
198
- }, h = () => (i || (u = y(), i = !0), u), f = (m) => `path:${n(m)}`;
430
+ let h = !1, a = !1;
431
+ const v = () => {
432
+ const b = (e == null ? void 0 : e.clientWidth) ?? 0, k = b > 0 ? b : typeof window < "u" ? window.innerWidth : 0;
433
+ return k > 0 && k < Nt;
434
+ }, g = () => (a || (h = v(), a = !0), h), m = (b) => `path:${n(b)}`;
199
435
  let d = null;
200
- const g = /* @__PURE__ */ new Map();
201
- let R = null, I = !1, x = 0, B = 0, w = 0;
202
- const p = () => {
203
- e && R && !I && !c.size && g.set(f(R), {
436
+ const y = /* @__PURE__ */ new Map();
437
+ let E = null, O = !1, x = 0, L = 0, u = 0;
438
+ const o = () => {
439
+ e && E && !O && !l.size && y.set(m(E), {
204
440
  x: e.scrollLeft,
205
441
  y: e.scrollTop
206
442
  });
207
- }, b = (m, S, O) => {
443
+ }, c = (b, k, _) => {
208
444
  if (!e) return;
209
- const D = ++B, N = f(m), L = S && g.has(N) ? g.get(N) : { x: 0, y: 0 };
445
+ const D = ++L, N = m(b), A = k && y.has(N) ? y.get(N) : { x: 0, y: 0 };
210
446
  let H = 0;
211
- const K = () => {
212
- if (!e || O !== x || D !== B)
447
+ const B = () => {
448
+ if (!e || _ !== x || D !== L)
213
449
  return;
214
- S || g.set(N, L), e.scrollTo({
215
- top: L.y,
216
- left: L.x,
450
+ k || y.set(N, A), e.scrollTo({
451
+ top: A.y,
452
+ left: A.x,
217
453
  behavior: "instant"
218
- }), !(Math.abs(e.scrollTop - L.y) < 1 && Math.abs(e.scrollLeft - L.x) < 1) && H < ct && (H++, requestAnimationFrame(K));
454
+ }), !(Math.abs(e.scrollTop - A.y) < 1 && Math.abs(e.scrollLeft - A.x) < 1) && H < Wt && (H++, requestAnimationFrame(B));
219
455
  };
220
- requestAnimationFrame(K);
456
+ requestAnimationFrame(B);
221
457
  };
222
458
  return {
223
- beginTransition: s,
459
+ beginTransition: r,
224
460
  disconnect() {
225
- ++x, ++B;
226
- for (const m of c) m();
227
- e && (e === document.documentElement ? window : e).removeEventListener("scroll", p), o == null || o.disconnect(), o = null, e = null, d = null, R = null, i = !1;
461
+ ++x, ++L;
462
+ for (const b of l) b();
463
+ e && (e === document.documentElement ? window : e).removeEventListener("scroll", o), s == null || s.disconnect(), s = null, e = null, d = null, E = null, a = !1;
228
464
  },
229
- initializeContext: (m, S, O) => {
230
- I = !0;
231
- const D = R === S ? x : ++x;
232
- d = m, e || (e = ot(m), u = y(), i = !0, typeof ResizeObserver < "u" && (o = new ResizeObserver(() => {
233
- u = y();
234
- }), o.observe(e)), (e === document.documentElement ? window : e).addEventListener("scroll", p, {
465
+ initializeContext: (b, k, _) => {
466
+ O = !0;
467
+ const D = E === k ? x : ++x;
468
+ d = b, e || (e = Lt(b), h = v(), a = !0, typeof ResizeObserver < "u" && (s = new ResizeObserver(() => {
469
+ h = v();
470
+ }), s.observe(e)), (e === document.documentElement ? window : e).addEventListener("scroll", o, {
235
471
  passive: !0
236
- })), R = S;
237
- const N = f(S), L = g.get(N), H = (U) => {
238
- D === x && (w = D, U && L && g.set(N, L), b(S, U, D));
472
+ })), E = k;
473
+ const N = m(k), A = y.get(N), H = (Q) => {
474
+ D === x && (u = D, Q && A && y.set(N, A), c(k, Q, D));
239
475
  };
240
- O !== void 0 ? H(O) : requestAnimationFrame(() => {
241
- w !== D && D === x && H(!1);
476
+ _ !== void 0 ? H(_) : requestAnimationFrame(() => {
477
+ u !== D && D === x && H(!1);
242
478
  });
243
- let K = 0;
244
- const M = () => {
245
- D === x && (K++, K >= at ? I = !1 : requestAnimationFrame(M));
479
+ let B = 0;
480
+ const q = () => {
481
+ D === x && (B++, B >= Ft ? O = !1 : requestAnimationFrame(q));
246
482
  };
247
- return requestAnimationFrame(M), H;
483
+ return requestAnimationFrame(q), H;
248
484
  },
249
- calculateScrollOffset: (m, S, O = !1) => {
250
- const D = m ? f(m) : null, N = D && g.has(D) ? g.get(D) : { x: 0, y: 0 }, L = S && O ? f(S) : null, H = L && g.has(L) ? g.get(L) : { x: 0, y: 0 };
485
+ calculateScrollOffset: (b, k, _ = !1) => {
486
+ const D = b ? m(b) : null, N = D && y.has(D) ? y.get(D) : { x: 0, y: 0 }, A = k && _ ? m(k) : null, H = A && y.has(A) ? y.get(A) : { x: 0, y: 0 };
251
487
  return {
252
488
  x: -H.x + N.x,
253
489
  y: -H.y + N.y
254
490
  };
255
491
  },
256
- evictScrollPosition: (m) => {
257
- g.delete(f(m));
492
+ evictScrollPosition: (b) => {
493
+ y.delete(m(b));
258
494
  },
259
495
  getScrollContainer: () => e,
260
- getPositionedParentElement: () => d ? rt(d) : document.body,
261
- getScrollPosition: (m, S = !0) => {
262
- if (!S) return { x: 0, y: 0 };
263
- const O = m ? f(m) : null;
264
- return O && g.has(O) ? g.get(O) : { x: 0, y: 0 };
496
+ getPositionedParentElement: () => d ? _t(d) : document.body,
497
+ getScrollPosition: (b, k = !0) => {
498
+ if (!k) return { x: 0, y: 0 };
499
+ const _ = b ? m(b) : null;
500
+ return _ && y.has(_) ? y.get(_) : { x: 0, y: 0 };
265
501
  },
266
502
  // Exposed so a functional `transitions` config can branch on device class.
267
- getIsMobile: h
503
+ getIsMobile: g
268
504
  };
269
505
  }
270
- const Ce = 30, _e = 8, De = 1.2, Ne = 30, dt = 600;
271
- function ft() {
272
- let t = null, n = !1, e = !1, o = null, c = null, s = !1;
273
- const u = (p, b) => {
274
- for (let k = 0; k < p.length; k++) {
275
- const A = p.item(k);
276
- if (A && A.identifier === b) return A;
506
+ const st = 30, ot = 8, rt = 1.2, it = 30, zt = 600;
507
+ function Gt() {
508
+ let t = null, n = !1, e = !1, s = null, l = null, r = !1;
509
+ const h = (o, c) => {
510
+ for (let w = 0; w < o.length; w++) {
511
+ const C = o.item(w);
512
+ if (C && C.identifier === c) return C;
277
513
  }
278
514
  return null;
279
- }, i = () => {
280
- o !== null && (clearTimeout(o), o = null);
281
- }, y = () => {
282
- c !== null && (clearTimeout(c), c = null);
283
- }, h = () => {
284
- n = !0, e = !0, i(), y(), o = setTimeout(() => {
285
- n = !1, e = !1, o = null;
286
- }, dt);
287
- }, f = (p) => {
288
- if (p.touches.length !== 1) {
515
+ }, a = () => {
516
+ s !== null && (clearTimeout(s), s = null);
517
+ }, v = () => {
518
+ l !== null && (clearTimeout(l), l = null);
519
+ }, g = () => {
520
+ n = !0, e = !0, a(), v(), s = setTimeout(() => {
521
+ n = !1, e = !1, s = null;
522
+ }, zt);
523
+ }, m = (o) => {
524
+ if (o.touches.length !== 1) {
289
525
  t = null;
290
526
  return;
291
527
  }
292
- const b = p.touches.item(0);
293
- if (!b) {
528
+ const c = o.touches.item(0);
529
+ if (!c) {
294
530
  t = null;
295
531
  return;
296
532
  }
297
- const k = window.innerWidth, A = b.clientX <= Ce, F = b.clientX >= k - Ce;
298
- if (!A && !F) {
533
+ const w = window.innerWidth, C = c.clientX <= st, W = c.clientX >= w - st;
534
+ if (!C && !W) {
299
535
  t = null;
300
536
  return;
301
537
  }
302
538
  t = {
303
- identifier: b.identifier,
304
- startX: b.clientX,
305
- startY: b.clientY,
306
- fromLeftEdge: A,
539
+ identifier: c.identifier,
540
+ startX: c.clientX,
541
+ startY: c.clientY,
542
+ fromLeftEdge: C,
307
543
  moved: !1
308
544
  };
309
- }, d = (p) => {
545
+ }, d = (o) => {
310
546
  if (!t) return;
311
- if (p.touches.length !== 1) {
547
+ if (o.touches.length !== 1) {
312
548
  t = null;
313
549
  return;
314
550
  }
315
- const b = u(p.touches, t.identifier);
316
- if (!b) {
551
+ const c = h(o.touches, t.identifier);
552
+ if (!c) {
317
553
  t = null;
318
554
  return;
319
555
  }
320
- const k = b.clientX - t.startX, A = b.clientY - t.startY, F = Math.abs(k), G = Math.abs(A);
321
- if (G > _e && G > F * De) {
556
+ const w = c.clientX - t.startX, C = c.clientY - t.startY, W = Math.abs(w), V = Math.abs(C);
557
+ if (V > ot && V > W * rt) {
322
558
  t = null;
323
559
  return;
324
560
  }
325
- const ee = t.fromLeftEdge ? k > 0 : k < 0;
326
- F > _e && F > G * De && ee && (t.moved = !0);
327
- }, g = (p) => {
561
+ const re = t.fromLeftEdge ? w > 0 : w < 0;
562
+ W > ot && W > V * rt && re && (t.moved = !0);
563
+ }, y = (o) => {
328
564
  if (!t) return;
329
- const b = u(p.changedTouches, t.identifier);
330
- if (!b) {
565
+ const c = h(o.changedTouches, t.identifier);
566
+ if (!c) {
331
567
  t = null;
332
568
  return;
333
569
  }
334
- const k = b.clientX - t.startX, A = t.fromLeftEdge ? k > 0 : k < 0;
335
- if (t.moved && A && Math.abs(k) >= Ne) {
336
- h(), t = null;
570
+ const w = c.clientX - t.startX, C = t.fromLeftEdge ? w > 0 : w < 0;
571
+ if (t.moved && C && Math.abs(w) >= it) {
572
+ g(), t = null;
337
573
  return;
338
574
  }
339
- t.moved && Math.abs(k) >= Ne && h(), t = null;
340
- }, R = () => {
341
- t && (t.moved && h(), t = null);
575
+ t.moved && Math.abs(w) >= it && g(), t = null;
576
+ }, E = () => {
577
+ t && (t.moved && g(), t = null);
342
578
  };
343
579
  return { initialize: () => {
344
- if (typeof window > "u" || s) return;
345
- s = !0;
346
- const p = { passive: !0, capture: !0 };
347
- window.addEventListener("touchstart", f, p), window.addEventListener("touchmove", d, p), window.addEventListener("touchend", g, p), window.addEventListener("touchcancel", R, p);
580
+ if (typeof window > "u" || r) return;
581
+ r = !0;
582
+ const o = { passive: !0, capture: !0 };
583
+ window.addEventListener("touchstart", m, o), window.addEventListener("touchmove", d, o), window.addEventListener("touchend", y, o), window.addEventListener("touchcancel", E, o);
348
584
  }, destroy: () => {
349
- if (typeof window > "u" || !s) return;
350
- s = !1;
351
- const p = { capture: !0 };
352
- window.removeEventListener("touchstart", f, p), window.removeEventListener("touchmove", d, p), window.removeEventListener("touchend", g, p), window.removeEventListener("touchcancel", R, p), i(), y(), t = null, n = !1, e = !1;
585
+ if (typeof window > "u" || !r) return;
586
+ r = !1;
587
+ const o = { capture: !0 };
588
+ window.removeEventListener("touchstart", m, o), window.removeEventListener("touchmove", d, o), window.removeEventListener("touchend", y, o), window.removeEventListener("touchcancel", E, o), a(), v(), t = null, n = !1, e = !1;
353
589
  }, isSwipeBack: () => {
354
- const p = n || e;
355
- return p && i(), p;
590
+ const o = n || e;
591
+ return o && a(), o;
356
592
  }, onPageEnter: () => {
357
- n = !1, i(), y(), c = setTimeout(() => {
358
- e = !1, c = null;
593
+ n = !1, a(), v(), l = setTimeout(() => {
594
+ e = !1, l = null;
359
595
  }, 0);
360
596
  } };
361
597
  }
362
- const He = "__ssgoi_entry_v1", be = /* @__PURE__ */ new WeakMap(), Ke = {
598
+ const lt = "__ssgoi_entry_v1", Oe = /* @__PURE__ */ new WeakMap(), pt = {
363
599
  read: () => null,
364
600
  previous: () => null,
365
601
  dispose() {
366
602
  }
367
603
  };
368
- function pt() {
369
- if (typeof window > "u") return Ke;
604
+ function Kt() {
605
+ if (typeof window > "u") return pt;
370
606
  const t = window.navigation, n = window;
371
- let e = be.get(n);
372
- e || (e = ht(n, t), be.set(n, e)), e.users++;
373
- const o = e;
374
- let c = !1;
607
+ let e = Oe.get(n);
608
+ e || (e = Ut(n, t), Oe.set(n, e)), e.users++;
609
+ const s = e;
610
+ let l = !1;
375
611
  return {
376
- read: o.read,
377
- previous: o.previous,
612
+ read: s.read,
613
+ previous: s.previous,
378
614
  dispose() {
379
- c || (c = !0, --o.users === 0 && (o.dispose(), be.delete(n)));
615
+ l || (l = !0, --s.users === 0 && (s.dispose(), Oe.delete(n)));
380
616
  }
381
617
  };
382
618
  }
383
- function Ie(t) {
619
+ function ct(t) {
384
620
  return t && typeof t.key == "string" && typeof t.url == "string" && Number.isSafeInteger(t.index) && t.index >= 0 ? { key: t.key, index: t.index, url: t.url } : null;
385
621
  }
386
- function Ee(t) {
622
+ function De(t) {
387
623
  return t !== null && typeof t == "object" && Object.getPrototypeOf(t) === Object.prototype;
388
624
  }
389
- function ht(t, n) {
390
- var B;
391
- const e = t.history, o = e.pushState, c = e.replaceState, s = `${Date.now()}-${Math.random().toString(36).slice(2)}-`;
392
- let u = 0, i = !0, y = null, h = null;
393
- const f = () => {
394
- const w = Ie(n == null ? void 0 : n.currentEntry);
395
- return (w == null ? void 0 : w.url) === t.location.href ? w : null;
625
+ function Ut(t, n) {
626
+ var L;
627
+ const e = t.history, s = e.pushState, l = e.replaceState, r = `${Date.now()}-${Math.random().toString(36).slice(2)}-`;
628
+ let h = 0, a = !0, v = null, g = null;
629
+ const m = () => {
630
+ const u = ct(n == null ? void 0 : n.currentEntry);
631
+ return (u == null ? void 0 : u.url) === t.location.href ? u : null;
396
632
  }, d = () => {
397
- const w = e.state, p = Ee(w) ? w[He] : null;
398
- return !Ee(p) || typeof p.key != "string" || !p.key.startsWith(s) || !Number.isSafeInteger(p.index) ? f() : {
399
- key: p.key,
400
- index: p.index,
633
+ const u = e.state, o = De(u) ? u[lt] : null;
634
+ return !De(o) || typeof o.key != "string" || !o.key.startsWith(r) || !Number.isSafeInteger(o.index) ? m() : {
635
+ key: o.key,
636
+ index: o.index,
401
637
  url: t.location.href
402
638
  };
403
- }, g = (w, p) => w !== null && !Ee(w) ? w : { ...w, [He]: p }, R = (w) => ({ key: `${s}${++u}`, index: w });
639
+ }, y = (u, o) => u !== null && !De(u) ? u : { ...u, [lt]: o }, E = (u) => ({ key: `${r}${++h}`, index: u });
404
640
  try {
405
- c.call(
641
+ l.call(
406
642
  e,
407
- g(e.state, R(((B = f()) == null ? void 0 : B.index) ?? 0)),
643
+ y(e.state, E(((L = m()) == null ? void 0 : L.index) ?? 0)),
408
644
  ""
409
645
  );
410
646
  } catch {
411
- return { ...Ke, read: f, users: 0 };
647
+ return { ...pt, read: m, users: 0 };
412
648
  }
413
- const I = function(w, p, b) {
414
- var F;
415
- if (!i) return o.call(this, w, p, b);
416
- const k = d(), A = R(((k == null ? void 0 : k.index) ?? 0) + 1);
417
- o.call(this, g(w, A), p, b), y = k, h = ((F = d()) == null ? void 0 : F.key) ?? null;
418
- }, x = function(w, p, b) {
419
- if (!i) return c.call(this, w, p, b);
420
- const k = d();
421
- c.call(this, g(w, k ?? R(0)), p, b);
649
+ const O = function(u, o, c) {
650
+ var W;
651
+ if (!a) return s.call(this, u, o, c);
652
+ const w = d(), C = E(((w == null ? void 0 : w.index) ?? 0) + 1);
653
+ s.call(this, y(u, C), o, c), v = w, g = ((W = d()) == null ? void 0 : W.key) ?? null;
654
+ }, x = function(u, o, c) {
655
+ if (!a) return l.call(this, u, o, c);
656
+ const w = d();
657
+ l.call(this, y(u, w ?? E(0)), o, c);
422
658
  };
423
- return e.pushState = I, e.replaceState = x, {
659
+ return e.pushState = O, e.replaceState = x, {
424
660
  users: 0,
425
661
  read: d,
426
662
  previous: () => {
427
- var p;
428
- if (((p = d()) == null ? void 0 : p.key) === h) return y;
429
- const w = f();
430
- return w ? Ie(
431
- n == null ? void 0 : n.entries().find((b) => b.index === w.index - 1)
663
+ var o;
664
+ if (((o = d()) == null ? void 0 : o.key) === g) return v;
665
+ const u = m();
666
+ return u ? ct(
667
+ n == null ? void 0 : n.entries().find((c) => c.index === u.index - 1)
432
668
  ) : null;
433
669
  },
434
670
  dispose() {
435
- i = !1, e.pushState === I && (e.pushState = o), e.replaceState === x && (e.replaceState = c);
671
+ a = !1, e.pushState === O && (e.pushState = s), e.replaceState === x && (e.replaceState = l);
436
672
  }
437
673
  };
438
674
  }
439
- function yt() {
675
+ function Xt() {
440
676
  let t = null, n = null;
441
- const e = /* @__PURE__ */ new Set(), o = (s) => {
442
- s && e.add(s.key), e.size > 200 && e.delete(e.values().next().value);
443
- }, c = () => {
444
- t || (t = pt(), n = t.read(), o(n));
677
+ const e = /* @__PURE__ */ new Set(), s = (r) => {
678
+ r && e.add(r.key), e.size > 200 && e.delete(e.values().next().value);
679
+ }, l = () => {
680
+ t || (t = Kt(), n = t.read(), s(n));
445
681
  };
446
682
  return {
447
- connect: c,
448
- resolve(s, u) {
449
- c();
450
- const i = t.read();
451
- let y = n, h = "unknown";
452
- if (y && i && (i.key === y.key || i.index === y.index ? h = "replace" : i.index < y.index ? h = "back" : h = e.has(i.key) ? "forward" : "push"), h === "push") {
453
- const f = t.previous();
454
- f && f.index === i.index - 1 && Ae(new URL(f.url).pathname) === Ae(s) && (y = f);
683
+ connect: l,
684
+ resolve(r, h) {
685
+ l();
686
+ const a = t.read();
687
+ let v = n, g = "unknown";
688
+ if (v && a && (a.key === v.key || a.index === v.index ? g = "replace" : a.index < v.index ? g = "back" : g = e.has(a.key) ? "forward" : "push"), g === "push") {
689
+ const m = t.previous();
690
+ m && m.index === a.index - 1 && Je(new URL(m.url).pathname) === Je(r) && (v = m);
455
691
  }
456
- return n = i, o(y), o(i), {
457
- kind: h,
458
- direction: h === "back" ? "backward" : "forward",
459
- from: y,
460
- to: i
692
+ return n = a, s(v), s(a), {
693
+ kind: g,
694
+ direction: g === "back" ? "backward" : "forward",
695
+ from: v,
696
+ to: a
461
697
  };
462
698
  },
463
699
  dispose() {
@@ -465,16 +701,16 @@ function yt() {
465
701
  }
466
702
  };
467
703
  }
468
- function mt() {
469
- const t = yt(), n = /* @__PURE__ */ new Map();
704
+ function $t() {
705
+ const t = Xt(), n = /* @__PURE__ */ new Map();
470
706
  return {
471
707
  connect: t.connect,
472
- resolve(e, o, c) {
473
- var h, f;
474
- const s = t.resolve(e, o), u = (h = s.from) == null ? void 0 : h.key, i = (f = s.to) == null ? void 0 : f.key;
475
- if (s.kind === "back" && u && i) {
476
- const d = n.get(u);
477
- if ((d == null ? void 0 : d.source) === i && d.from === o && d.to === e)
708
+ resolve(e, s, l) {
709
+ var g, m;
710
+ const r = t.resolve(e, s), h = (g = r.from) == null ? void 0 : g.key, a = (m = r.to) == null ? void 0 : m.key;
711
+ if (r.kind === "back" && h && a) {
712
+ const d = n.get(h);
713
+ if ((d == null ? void 0 : d.source) === a && d.from === s && d.to === e)
478
714
  return d.rule ? {
479
715
  ...d.rule,
480
716
  direction: d.rule.direction === "forward" ? "backward" : "forward",
@@ -484,573 +720,630 @@ function mt() {
484
720
  }
485
721
  } : null;
486
722
  }
487
- if (s.kind === "forward" && u && i) {
488
- const d = n.get(i);
489
- if ((d == null ? void 0 : d.source) === u && d.from === e && d.to === o)
723
+ if (r.kind === "forward" && h && a) {
724
+ const d = n.get(a);
725
+ if ((d == null ? void 0 : d.source) === h && d.from === e && d.to === s)
490
726
  return d.rule;
491
727
  }
492
- const y = c(s.direction);
493
- if (i && s.kind === "replace" && n.delete(i), i && u && s.kind === "push") {
494
- for (const [d, g] of n)
495
- g.index >= s.to.index && n.delete(d);
496
- n.set(i, {
497
- source: u,
498
- index: s.to.index,
728
+ const v = l(r.direction);
729
+ if (a && r.kind === "replace" && n.delete(a), a && h && r.kind === "push") {
730
+ for (const [d, y] of n)
731
+ y.index >= r.to.index && n.delete(d);
732
+ n.set(a, {
733
+ source: h,
734
+ index: r.to.index,
499
735
  from: e,
500
- to: o,
501
- rule: y ? { ...y, preserveScroll: { ...y.preserveScroll } } : null
736
+ to: s,
737
+ rule: v ? { ...v, preserveScroll: { ...v.preserveScroll } } : null
502
738
  }), n.size > 100 && n.delete(n.keys().next().value);
503
739
  }
504
- return y;
740
+ return v;
505
741
  },
506
742
  dispose() {
507
743
  t.dispose(), n.clear();
508
744
  }
509
745
  };
510
746
  }
511
- function vt(t = {}) {
747
+ function qt(t = {}) {
512
748
  let n = null, e = null;
513
- function o() {
514
- var s, u;
515
- n && ((s = n.out) == null || s.resolve(null), (u = n.in) == null || u.resolve(null), n = null);
749
+ function s() {
750
+ var r, h;
751
+ n && ((r = n.out) == null || r.resolve(null), (h = n.in) == null || h.resolve(null), n = null);
516
752
  }
517
- function c() {
753
+ function l() {
518
754
  if (n != null && n.out && n.in) {
519
755
  if (n.out.path === n.in.path) {
520
- o();
756
+ s();
521
757
  return;
522
758
  }
523
- const s = {
759
+ const r = {
524
760
  from: n.out.path,
525
761
  to: n.in.path,
526
762
  out: n.out.payload,
527
763
  in: n.in.payload
528
764
  };
529
- e = s, n.out.resolve(s), n.in.resolve(s), n = null;
765
+ e = r, n.out.resolve(r), n.in.resolve(r), n = null;
530
766
  }
531
767
  }
532
768
  return {
533
- arrive(s, u, i) {
534
- return new Promise((y) => {
535
- var g, R;
536
- const h = e === null ? null : u === "out" ? { path: e.from, payload: e.out } : { path: e.to, payload: e.in };
537
- if ((h == null ? void 0 : h.path) === s) {
538
- y(null);
769
+ arrive(r, h, a) {
770
+ return new Promise((v) => {
771
+ var y, E;
772
+ const g = e === null ? null : h === "out" ? { path: e.from, payload: e.out } : { path: e.to, payload: e.in };
773
+ if ((g == null ? void 0 : g.path) === r) {
774
+ v(null);
539
775
  return;
540
776
  }
541
- u === "out" && ((g = n == null ? void 0 : n.in) == null ? void 0 : g.path) === s && !n.out && (n.in.resolve(null), n.in = void 0);
542
- const f = n == null ? void 0 : n[u];
543
- f && f.path !== s && o(), n || (n = {});
544
- const d = n[u];
777
+ h === "out" && ((y = n == null ? void 0 : n.in) == null ? void 0 : y.path) === r && !n.out && (n.in.resolve(null), n.in = void 0);
778
+ const m = n == null ? void 0 : n[h];
779
+ m && m.path !== r && s(), n || (n = {});
780
+ const d = n[h];
545
781
  if (d) {
546
- if (((R = t.keepCurrent) == null ? void 0 : R.call(t, {
547
- type: u,
548
- path: s,
782
+ if (((E = t.keepCurrent) == null ? void 0 : E.call(t, {
783
+ type: h,
784
+ path: r,
549
785
  current: d.payload,
550
- next: i
786
+ next: a
551
787
  })) ?? !1) {
552
- y(null);
788
+ v(null);
553
789
  return;
554
790
  }
555
791
  d.resolve(null);
556
792
  }
557
- n[u] = { path: s, payload: i, resolve: y }, c();
793
+ n[h] = { path: r, payload: a, resolve: v }, l();
558
794
  });
559
795
  },
560
- cancel(s) {
561
- (n != null && n.out && s(n.out.payload) || n != null && n.in && s(n.in.payload)) && o(), (e && s(e.out) || e && s(e.in)) && (e = null);
796
+ cancel(r) {
797
+ (n != null && n.out && r(n.out.payload) || n != null && n.in && r(n.in.payload)) && s(), (e && r(e.out) || e && r(e.in)) && (e = null);
562
798
  }
563
799
  };
564
800
  }
565
- const gt = {}, j = /* @__PURE__ */ new Map();
566
- let le = null, We = !1;
567
- function Ue(t, n, e) {
568
- t instanceof HTMLElement && j.has(t) && !t.isConnected && e.set(t, { entry: j.get(t), anchor: n });
569
- for (const o of Array.from(t.childNodes))
570
- Ue(o, n, e);
801
+ const Vt = {}, J = /* @__PURE__ */ new Map();
802
+ let ve = null, at = !1;
803
+ function ht(t, n, e) {
804
+ t instanceof HTMLElement && J.has(t) && !t.isConnected && e.set(t, { entry: J.get(t), anchor: n });
805
+ for (const s of Array.from(t.childNodes))
806
+ ht(s, n, e);
571
807
  }
572
- function wt(t) {
808
+ function Yt(t) {
573
809
  const n = new Set(
574
810
  Array.from(t.values(), ({ entry: e }) => e)
575
811
  );
576
- for (const [e, { entry: o, anchor: c }] of t) {
577
- j.delete(e);
578
- let s = o.parent, u = !1;
579
- for (; s; ) {
580
- if (s.group === o.group && n.has(s)) {
581
- u = !0;
812
+ for (const [e, { entry: s, anchor: l }] of t) {
813
+ J.delete(e);
814
+ let r = s.parent, h = !1;
815
+ for (; r; ) {
816
+ if (r.group === s.group && n.has(r)) {
817
+ h = !0;
582
818
  break;
583
819
  }
584
- s = s.parent;
820
+ r = r.parent;
585
821
  }
586
- queueMicrotask(() => o.callback(c, { emit: !u }));
822
+ queueMicrotask(() => s.callback(l, { emit: !h }));
587
823
  }
588
824
  }
589
- function bt() {
590
- if (We || typeof document > "u") return;
591
- We = !0, le = new MutationObserver((n) => {
825
+ function jt() {
826
+ if (at || typeof document > "u") return;
827
+ at = !0, ve = new MutationObserver((n) => {
592
828
  const e = /* @__PURE__ */ new Map();
593
- for (const o of n) {
594
- const c = {
595
- parent: o.target,
596
- nextSibling: o.nextSibling
829
+ for (const s of n) {
830
+ const l = {
831
+ parent: s.target,
832
+ nextSibling: s.nextSibling
597
833
  };
598
- for (const s of Array.from(o.removedNodes))
599
- Ue(s, c, e);
834
+ for (const r of Array.from(s.removedNodes))
835
+ ht(r, l, e);
600
836
  }
601
- wt(e);
837
+ Yt(e);
602
838
  });
603
839
  const t = () => {
604
- le == null || le.observe(document.body, { childList: !0, subtree: !0 });
840
+ ve == null || ve.observe(document.body, { childList: !0, subtree: !0 });
605
841
  };
606
842
  document.body ? t() : document.addEventListener("DOMContentLoaded", t, { once: !0 });
607
843
  }
608
- function Et(t, n, e = gt) {
609
- bt();
610
- let o = t.parentElement, c = null;
611
- for (; o; ) {
612
- const s = j.get(o);
613
- if ((s == null ? void 0 : s.group) === e) {
614
- c = s;
844
+ function Zt(t, n, e = Vt) {
845
+ jt();
846
+ let s = t.parentElement, l = null;
847
+ for (; s; ) {
848
+ const r = J.get(s);
849
+ if ((r == null ? void 0 : r.group) === e) {
850
+ l = r;
615
851
  break;
616
852
  }
617
- o = o.parentElement;
853
+ s = s.parentElement;
618
854
  }
619
- return j.set(t, {
855
+ return J.set(t, {
620
856
  element: t,
621
857
  callback: n,
622
858
  group: e,
623
- parent: c
859
+ parent: l
624
860
  }), () => {
625
- j.delete(t);
861
+ J.delete(t);
626
862
  };
627
863
  }
628
- const Se = /* @__PURE__ */ new WeakMap();
629
- let ce = null;
630
- const ae = "none !important";
631
- function Q(t) {
864
+ const Le = /* @__PURE__ */ new WeakMap();
865
+ let we = null;
866
+ const be = "none !important";
867
+ function oe(t) {
632
868
  const n = t.style.getPropertyValue("display");
633
869
  return t.style.getPropertyPriority("display") ? `${n} !important` : n;
634
870
  }
635
- function St() {
636
- return ce || (ce = new MutationObserver((t) => {
871
+ function Jt() {
872
+ return we || (we = new MutationObserver((t) => {
637
873
  for (const n of t) {
638
- const e = n.target, o = Se.get(e);
639
- if (!o) continue;
640
- const c = Q(e);
641
- c !== o.accounted && (o.accounted = c, c === ae ? (o.reactHidden = !0, o.onHide()) : c !== "none" && o.reactHidden && (o.reactHidden = !1, o.onShow()));
874
+ const e = n.target, s = Le.get(e);
875
+ if (!s) continue;
876
+ const l = oe(e);
877
+ l !== s.accounted && (s.accounted = l, l === be ? (s.reactHidden = !0, s.onHide()) : l !== "none" && s.reactHidden && (s.reactHidden = !1, s.onShow()));
642
878
  }
643
- }), ce);
879
+ }), we);
644
880
  }
645
- function kt(t, n) {
646
- const e = Q(t), o = {
881
+ function Qt(t, n) {
882
+ const e = oe(t), s = {
647
883
  accounted: e,
648
- reactHidden: e === ae,
884
+ reactHidden: e === be,
649
885
  onHide: n.onHide,
650
886
  onShow: n.onShow
651
887
  };
652
- return Se.set(t, o), St().observe(t, {
888
+ return Le.set(t, s), Jt().observe(t, {
653
889
  attributes: !0,
654
890
  attributeFilter: ["style"]
655
891
  }), {
656
892
  get isHidden() {
657
- return Q(t) === ae;
893
+ return oe(t) === be;
658
894
  },
659
- setDisplay(c, s = !1) {
660
- c === null ? t.style.removeProperty("display") : t.style.setProperty(
895
+ setDisplay(l, r = !1) {
896
+ l === null ? t.style.removeProperty("display") : t.style.setProperty(
661
897
  "display",
662
- c,
663
- s ? "important" : ""
664
- ), o.accounted = Q(t);
898
+ l,
899
+ r ? "important" : ""
900
+ ), s.accounted = oe(t);
665
901
  },
666
902
  sync() {
667
- o.accounted = Q(t), o.reactHidden = o.accounted === ae;
903
+ s.accounted = oe(t), s.reactHidden = s.accounted === be;
668
904
  },
669
905
  stop() {
670
- Se.delete(t);
906
+ Le.delete(t);
671
907
  }
672
908
  };
673
909
  }
674
- const Tt = 5e3;
675
- function Nt(t, n = {}) {
676
- const { transitions: e = [], middleware: o = (r, l) => ({ from: r, to: l }) } = t, c = n.host ?? new tt(), s = {}, u = vt({
910
+ const en = 5e3;
911
+ function pn(t, n = {}) {
912
+ const { transitions: e = [], middleware: s = (i, f) => ({ from: i, to: f }) } = t, l = n.host ?? new Ot(), r = {}, h = qt({
677
913
  // Nested boundaries can be discovered in separate MutationObserver
678
914
  // batches (notably when Suspense reveals a child later). When the same
679
915
  // side/path repeats before pairing, the outermost DOM boundary owns it.
680
- keepCurrent: ({ current: r, next: l }) => r.element.contains(l.element)
681
- }), i = mt(), y = typeof e == "function" ? e : () => e, h = ft();
682
- h.initialize();
683
- const f = /* @__PURE__ */ new Map(), d = (r) => {
684
- let l = f.get(r);
685
- return l === void 0 && (l = o(r, r).from, f.set(r, l)), l;
916
+ keepCurrent: ({ current: i, next: f }) => i.element.contains(f.element)
917
+ }), a = $t(), v = typeof e == "function" ? e : () => e, g = Gt();
918
+ g.initialize();
919
+ const m = /* @__PURE__ */ new Map(), d = (i) => {
920
+ let f = m.get(i);
921
+ return f === void 0 && (f = s(i, i).from, m.set(i, f)), f;
686
922
  }, {
687
- initializeContext: g,
688
- beginTransition: R,
689
- disconnect: I,
923
+ initializeContext: y,
924
+ beginTransition: E,
925
+ disconnect: O,
690
926
  calculateScrollOffset: x,
691
- evictScrollPosition: B,
692
- getScrollContainer: w,
693
- getPositionedParentElement: p,
694
- getScrollPosition: b,
695
- getIsMobile: k
696
- } = ut({ resolvePath: d }), A = /* @__PURE__ */ new Map(), F = () => {
697
- const r = k();
698
- let l = A.get(r);
699
- return l || (l = y({ isMobile: r }), A.set(r, l)), l;
700
- }, G = /* @__PURE__ */ new WeakMap(), ee = (r) => {
701
- G.set(r, {
702
- parent: r.parentNode,
703
- nextSibling: r.nextSibling
927
+ evictScrollPosition: L,
928
+ getScrollContainer: u,
929
+ getPositionedParentElement: o,
930
+ getScrollPosition: c,
931
+ getIsMobile: w
932
+ } = Bt({ resolvePath: d }), C = /* @__PURE__ */ new Map(), W = () => {
933
+ const i = w();
934
+ let f = C.get(i);
935
+ return f || (f = v({ isMobile: i }), C.set(i, f)), f;
936
+ }, V = /* @__PURE__ */ new WeakMap(), re = (i) => {
937
+ V.set(i, {
938
+ parent: i.parentNode,
939
+ nextSibling: i.nextSibling
704
940
  });
705
- }, te = (r) => {
706
- const l = G.get(r);
707
- return l || {
708
- parent: r.parentNode,
709
- nextSibling: r.nextSibling
941
+ }, ie = (i) => {
942
+ const f = V.get(i);
943
+ return f || {
944
+ parent: i.parentNode,
945
+ nextSibling: i.nextSibling
710
946
  };
711
- }, m = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap();
712
- let O = 0;
713
- const D = (r) => {
714
- const l = typeof getComputedStyle < "u" ? getComputedStyle(r).display : "";
715
- return l && l !== "none" ? l : "block";
716
- }, N = (r, l) => {
717
- l.visibleDisplay = r.style.getPropertyValue("display"), l.computedDisplay = D(r);
718
- }, L = (r, l) => {
719
- if (S.get(r) !== l) return;
720
- S.delete(r);
721
- const a = m.get(r);
722
- a && (a.savedCss !== null && (r.style.cssText = a.savedCss, a.savedCss = null), a.intent === "hidden" ? a.vis.setDisplay("none", !0) : a.visibleDisplay ? (a.vis.setDisplay(a.visibleDisplay, !1), N(r, a)) : (a.vis.setDisplay(null), N(r, a)));
723
- }, H = (r, l) => {
724
- if (r.mode !== "hidden") return;
725
- const a = Array.from(
726
- new Set([r.element, l == null ? void 0 : l.element].filter(Boolean))
727
- ), C = ++O;
728
- for (const v of a) S.set(v, C);
729
- c.complete();
730
- for (const v of a) L(v, C);
731
- }, K = /* @__PURE__ */ new Set();
732
- let M, U = 0, ne = !1;
733
- const Ge = (r, l, a, C, v, E, W) => {
734
- const T = v.element, P = E.element, X = (v.mode ?? "unmount") === "hidden", { parent: $, nextSibling: V } = v.parent ? { parent: v.parent, nextSibling: v.nextSibling } : te(T), Y = x(
735
- a,
736
- C,
737
- W.to
738
- ), pe = {
739
- direction: l,
740
- scrollOffset: Y,
741
- from: { scroll: b(a) },
947
+ }, b = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap();
948
+ let _ = 0, D = 0, N = null, A = null, H = !1;
949
+ const B = /* @__PURE__ */ new WeakMap(), q = () => {
950
+ D++, N == null || N.abort(), A == null || A(), A = null;
951
+ }, Q = (i) => {
952
+ const f = typeof getComputedStyle < "u" ? getComputedStyle(i).display : "";
953
+ return f && f !== "none" ? f : "block";
954
+ }, le = (i, f) => {
955
+ f.visibleDisplay = i.style.getPropertyValue("display"), f.computedDisplay = Q(i);
956
+ }, Ee = (i, f) => {
957
+ if (k.get(i) !== f) return;
958
+ k.delete(i);
959
+ const p = b.get(i);
960
+ p && (p.savedCss !== null && (i.style.cssText = p.savedCss, p.savedCss = null), p.intent === "hidden" ? p.vis.setDisplay("none", !0) : p.visibleDisplay ? (p.vis.setDisplay(p.visibleDisplay, !1), le(i, p)) : (p.vis.setDisplay(null), le(i, p)));
961
+ }, ke = (i, f) => {
962
+ if (i.mode !== "hidden") return;
963
+ const p = Array.from(
964
+ new Set([i.element, f == null ? void 0 : f.element].filter(Boolean))
965
+ ), I = ++_;
966
+ for (const S of p) k.set(S, I);
967
+ l.complete();
968
+ for (const S of p) Ee(S, I);
969
+ };
970
+ let ee = 0;
971
+ const yt = (i, f, p, I, S, T, z) => {
972
+ var Ue;
973
+ const P = S.element, M = T.element, $ = ++_;
974
+ k.set(M, $), k.set(P, $);
975
+ const fe = E(t.scrollLock !== !1);
976
+ q();
977
+ const Z = D;
978
+ N = new AbortController();
979
+ const Y = N.signal;
980
+ l.prepareHandoff();
981
+ for (const R of [P, M])
982
+ B.has(R) || B.set(
983
+ R,
984
+ ((Ue = b.get(R)) == null ? void 0 : Ue.savedCss) ?? R.style.cssText
985
+ );
986
+ const de = (S.mode ?? "unmount") === "hidden", { parent: pe, nextSibling: Pe } = S.parent ? { parent: S.parent, nextSibling: S.nextSibling } : ie(P), he = x(
987
+ p,
988
+ I,
989
+ z.to
990
+ ), me = {
991
+ direction: f,
992
+ scrollOffset: he,
993
+ from: { scroll: c(p) },
742
994
  to: {
743
- scroll: b(C, W.to)
995
+ scroll: c(I, z.to)
744
996
  },
745
997
  get scrollingElement() {
746
- return w() || document.documentElement;
998
+ return u() || document.documentElement;
747
999
  },
748
1000
  get positionedParent() {
749
- return p();
1001
+ return o();
750
1002
  }
751
1003
  };
752
- let z;
753
- if (X) {
754
- z = T, z.style.top = `${-1 * ((Y == null ? void 0 : Y.y) ?? 0)}px`;
755
- const _ = m.get(P);
756
- _ && _.savedCss === null && (_.savedCss = P.style.cssText);
1004
+ let F;
1005
+ if (de) {
1006
+ F = P, F.style.top = `${-1 * ((he == null ? void 0 : he.y) ?? 0)}px`;
1007
+ const R = b.get(M);
1008
+ R && R.savedCss === null && (R.savedCss = M.style.cssText);
757
1009
  } else
758
- z = T, nt(z, pe);
759
- W.from || B(a);
760
- const ie = X ? ++O : 0;
761
- X && (S.set(P, ie), S.set(T, ie));
762
- const Pe = Promise.resolve(z), xe = Promise.resolve(P), Re = [], Ye = {
763
- from: Pe,
764
- to: xe,
765
- context: pe,
766
- createElement: ((_, me = "div") => {
767
- const Z = document.createElement(me);
768
- return Z.setAttribute("data-ssgoi-id", _), Re.push(Z), Z;
769
- })
770
- }, je = R(t.scrollLock !== !1);
771
- let he = !1;
772
- const q = () => {
773
- if (!he) {
774
- he = !0, clearTimeout(Me), K.delete(q), M === q && (M = void 0);
775
- try {
776
- X ? (L(T, ie), L(P, ie)) : z.parentNode && z.parentNode.removeChild(z);
777
- for (const _ of Re)
778
- _.parentNode && _.parentNode.removeChild(_);
779
- } finally {
780
- je();
781
- }
1010
+ F = P, Dt(F, me);
1011
+ z.from || L(p);
1012
+ const Ne = Promise.resolve(F), We = Promise.resolve(M), Re = [], Fe = [];
1013
+ let xe = !1;
1014
+ const ye = () => {
1015
+ if (!xe) {
1016
+ xe = !0;
1017
+ for (const R of Fe)
1018
+ try {
1019
+ R();
1020
+ } catch (K) {
1021
+ console.error("[ssgoi] prepare cleanup", K);
1022
+ }
1023
+ for (const R of Re) R.remove();
1024
+ }
1025
+ }, bt = {
1026
+ from: Ne,
1027
+ to: We,
1028
+ context: me,
1029
+ createElement: ((R, K = "div") => {
1030
+ const ne = document.createElement(K);
1031
+ return ne.setAttribute("data-ssgoi-id", R), Re.push(ne), ne;
1032
+ }),
1033
+ signal: Y,
1034
+ onCleanup: (R) => {
1035
+ xe ? R() : Fe.push(R);
782
1036
  }
783
1037
  };
784
- K.add(q), M == null || M(), M = q;
785
- const ye = (_) => {
786
- q(), console.error("[SSGOI] Page transition failed", _);
787
- }, Me = setTimeout(() => {
788
- ye(new Error("Page transition preparation timed out"));
789
- }, Tt);
790
- let Oe;
791
- try {
792
- Oe = Promise.resolve(
793
- r.prepare ? r.prepare(Ye) : {}
794
- );
795
- } catch (_) {
796
- ye(_);
797
- return;
798
- }
799
- st({
800
- from: Pe,
801
- to: xe,
802
- extras: Oe
803
- }).then(({ from: _, to: me, extras: Z }) => {
804
- if (he) return;
805
- clearTimeout(Me), M === q && (M = void 0), !X && $ && (V && $.contains(V) ? $.insertBefore(z, V) : $.appendChild(z));
806
- const ve = r.animation({
807
- from: _,
808
- to: me,
809
- context: pe,
810
- ...Z
811
- }), ge = ve.onComplete;
812
- ve.onComplete = () => {
1038
+ let Be = !1, te = !1;
1039
+ const ge = () => {
1040
+ te || (te = !0, clearTimeout(Ke), ye(), fe());
1041
+ }, ze = () => {
1042
+ for (const R of [P, M]) {
1043
+ if (k.get(R) !== $) continue;
1044
+ const K = B.get(R);
1045
+ K !== void 0 && (R.style.cssText = K), B.delete(R), Ee(R, $);
1046
+ }
1047
+ };
1048
+ A = () => {
1049
+ ye(), ze(), ge();
1050
+ };
1051
+ const Ge = (R) => {
1052
+ ye();
1053
+ const K = te || Y.aborted || H || Z !== D;
1054
+ if (A && Z === D && (A = null), K) {
1055
+ ge();
1056
+ return;
1057
+ }
1058
+ l.cancel({ reason: "disposed", owns: () => !0 }), ze(), de || F.remove(), ge(), console.error("[SSGOI] Page transition failed", R);
1059
+ }, Ke = setTimeout(() => {
1060
+ Be || te || Ge(new Error("Page transition preparation timed out"));
1061
+ }, en), St = Promise.resolve().then(() => Y.aborted ? {} : i.prepare ? i.prepare(bt) : {});
1062
+ Ht({
1063
+ from: Ne,
1064
+ to: We,
1065
+ extras: St
1066
+ }).then(({ from: R, to: K, extras: ne }) => {
1067
+ var qe, Ve, Ye, je;
1068
+ if (te || Y.aborted || H || Z !== D) {
1069
+ ye();
1070
+ return;
1071
+ }
1072
+ Be = !0, clearTimeout(Ke), A = null, !de && pe && (Pe && pe.contains(Pe) ? pe.insertBefore(F, Pe) : pe.appendChild(F));
1073
+ const j = i.animation({
1074
+ from: R,
1075
+ to: K,
1076
+ context: me,
1077
+ ...ne
1078
+ }), Et = j.getMotionTracks();
1079
+ for (const U of Et)
1080
+ Re.includes(U.element) && ((qe = U.motion).lifetime ?? (qe.lifetime = "temporary"), (Ve = U.motion).role ?? (Ve.role = "overlay"), (Ye = U.motion).key ?? (Ye.key = U.element.getAttribute("data-ssgoi-id") ?? void 0), (je = U.motion).space ?? (je.space = me.positionedParent));
1081
+ const Me = j.onDispose;
1082
+ let Xe = !1;
1083
+ const $e = (U) => {
1084
+ if (!Xe) {
1085
+ Xe = !0;
1086
+ try {
1087
+ Me == null || Me(U);
1088
+ } catch (X) {
1089
+ console.error("[ssgoi] effect cleanup failed", X);
1090
+ }
1091
+ try {
1092
+ for (const X of [P, M]) {
1093
+ if (k.get(X) !== $ || !U.owns(X))
1094
+ continue;
1095
+ const Ze = B.get(X);
1096
+ Ze !== void 0 && (X.style.cssText = Ze), B.delete(X), b.has(X) ? Ee(X, $) : k.delete(X);
1097
+ }
1098
+ !de && U.owns(F) && F.parentNode && !k.has(F) && F.parentNode.removeChild(F);
1099
+ } finally {
1100
+ ge();
1101
+ }
1102
+ }
1103
+ };
1104
+ j.onDispose = $e;
1105
+ const Ce = j.onComplete;
1106
+ j.onComplete = () => {
813
1107
  try {
814
- ge == null || ge();
1108
+ Ce == null || Ce();
815
1109
  } finally {
816
- q();
1110
+ j.supportsInterruption || $e(Mt);
817
1111
  }
818
- }, c.attach(ve);
819
- }).catch(ye);
820
- }, oe = (r, l, a) => {
821
- if (ne) return;
822
- const C = U, v = h.isSwipeBack();
823
- u.arrive(r, l, a).then((E) => {
824
- var fe, X, $, V;
825
- if (ne || C !== U) return;
826
- if (l === "in" && h.onPageEnter(), !E) {
827
- l === "out" && H(a);
1112
+ }, l.attach(j, { targets: [P, M] });
1113
+ }).catch(Ge);
1114
+ }, ce = (i, f, p) => {
1115
+ if (H) return;
1116
+ const I = ee, S = g.isSwipeBack();
1117
+ h.arrive(i, f, p).then((T) => {
1118
+ var $, fe, Z, Y;
1119
+ if (H || I !== ee) return;
1120
+ if (f === "in" && g.onPageEnter(), !T) {
1121
+ f === "out" && ke(p);
828
1122
  return;
829
1123
  }
830
- if (l !== "in") return;
831
- const { from: W, to: T } = o(
832
- E.from,
833
- E.to
834
- ), P = i.resolve(
835
- E.from,
836
- E.to,
837
- (Y) => Qe(
838
- W,
839
- T,
840
- F(),
841
- Y
1124
+ if (f !== "in") return;
1125
+ const { from: z, to: P } = s(
1126
+ T.from,
1127
+ T.to
1128
+ ), M = a.resolve(
1129
+ T.from,
1130
+ T.to,
1131
+ (Ie) => Pt(
1132
+ z,
1133
+ P,
1134
+ W(),
1135
+ Ie
842
1136
  )
843
1137
  );
844
- if (!P) {
845
- (X = (fe = E.in).applyScrollPolicy) == null || X.call(fe, !1), B(E.from), H(E.out, E.in), M == null || M(), c.complete();
1138
+ if (!M) {
1139
+ (fe = ($ = T.in).applyScrollPolicy) == null || fe.call($, !1), L(T.from), q(), ke(T.out, T.in), l.complete();
846
1140
  return;
847
1141
  }
848
- if ((V = ($ = E.in).applyScrollPolicy) == null || V.call($, P.preserveScroll.to), v) {
849
- P.preserveScroll.from || B(E.from), H(E.out, E.in), M == null || M(), c.complete();
1142
+ if ((Y = (Z = T.in).applyScrollPolicy) == null || Y.call(Z, M.preserveScroll.to), S) {
1143
+ M.preserveScroll.from || L(T.from), q(), ke(T.out, T.in), l.complete();
850
1144
  return;
851
1145
  }
852
- Ge(
853
- P.transition,
854
- P.direction,
855
- E.from,
856
- E.to,
857
- E.out,
858
- E.in,
859
- P.preserveScroll
1146
+ yt(
1147
+ M.transition,
1148
+ M.direction,
1149
+ T.from,
1150
+ T.to,
1151
+ T.out,
1152
+ T.in,
1153
+ M.preserveScroll
860
1154
  );
861
1155
  });
862
- }, $e = (r, l) => {
863
- const a = m.get(r);
864
- if (!a) return;
865
- const C = a.intent === "hidden";
866
- if (a.intent = "hidden", a.savedCss === null && (a.savedCss = r.style.cssText), a.vis.setDisplay(a.computedDisplay || "block", !0), r.style.position = "absolute", r.style.width = "100%", r.style.left = "0", C) return;
867
- const v = te(r), E = {
868
- element: r,
869
- parent: v.parent,
870
- nextSibling: v.nextSibling,
1156
+ }, gt = (i, f) => {
1157
+ const p = b.get(i);
1158
+ if (!p) return;
1159
+ const I = p.intent === "hidden";
1160
+ if (p.intent = "hidden", p.savedCss === null && (p.savedCss = i.style.cssText), p.vis.setDisplay(p.computedDisplay || "block", !0), i.style.position = "absolute", i.style.width = "100%", i.style.left = "0", I) return;
1161
+ const S = ie(i), T = {
1162
+ element: i,
1163
+ parent: S.parent,
1164
+ nextSibling: S.nextSibling,
871
1165
  mode: "hidden"
872
- }, W = a.pendingOutPath ?? a.currentPath ?? l;
873
- a.pendingOutPath = null, oe(W, "out", E);
874
- }, qe = (r, l) => {
875
- const a = m.get(r);
876
- if (!a || a.intent === "visible") return;
877
- a.intent = "visible", a.currentPath = r.getAttribute("data-ssgoi-transition") ?? a.currentPath ?? l, a.pendingOutPath = null, a.pathRevision++, N(r, a), a.savedCss !== null && (r.style.cssText = a.savedCss, a.visibleDisplay ? a.vis.setDisplay(a.visibleDisplay, !1) : a.vis.setDisplay(null));
878
- const C = a.currentPath, v = g(r, C), E = {
879
- element: r,
880
- parent: r.parentElement,
881
- nextSibling: r.nextElementSibling,
882
- applyScrollPolicy: v
1166
+ }, z = p.pendingOutPath ?? p.currentPath ?? f;
1167
+ p.pendingOutPath = null, ce(z, "out", T);
1168
+ }, vt = (i, f) => {
1169
+ const p = b.get(i);
1170
+ if (!p || p.intent === "visible") return;
1171
+ p.intent = "visible", p.currentPath = i.getAttribute("data-ssgoi-transition") ?? p.currentPath ?? f, p.pendingOutPath = null, p.pathRevision++, le(i, p), p.savedCss !== null && (i.style.cssText = p.savedCss, p.visibleDisplay ? p.vis.setDisplay(p.visibleDisplay, !1) : p.vis.setDisplay(null));
1172
+ const I = p.currentPath, S = y(i, I), T = {
1173
+ element: i,
1174
+ parent: i.parentElement,
1175
+ nextSibling: i.nextElementSibling,
1176
+ applyScrollPolicy: S
883
1177
  };
884
- oe(C, "in", E);
885
- }, Ve = (r, l, a, C = !0) => {
886
- const v = m.get(r);
887
- se.delete(r);
888
- const E = (v == null ? void 0 : v.pendingOutPath) ?? (v == null ? void 0 : v.currentPath) ?? l;
889
- if (v && (v.vis.stop(), re.delete(v.vis), m.delete(r), S.delete(r), v.intent === "hidden")) {
890
- u.cancel((P) => P.element === r);
1178
+ ce(I, "in", T);
1179
+ }, wt = (i, f, p, I = !0) => {
1180
+ const S = b.get(i);
1181
+ ue.delete(i);
1182
+ const T = (S == null ? void 0 : S.pendingOutPath) ?? (S == null ? void 0 : S.currentPath) ?? f;
1183
+ if (S && (S.vis.stop(), ae.delete(S.vis), b.delete(i), k.delete(i), S.intent === "hidden")) {
1184
+ h.cancel((M) => M.element === i);
891
1185
  return;
892
1186
  }
893
- if (!C) return;
894
- const W = a ?? te(r), T = {
895
- element: r,
896
- parent: W.parent,
897
- nextSibling: W.nextSibling,
1187
+ if (!I) return;
1188
+ const z = p ?? ie(i), P = {
1189
+ element: i,
1190
+ parent: z.parent,
1191
+ nextSibling: z.nextSibling,
898
1192
  mode: "unmount"
899
1193
  };
900
- oe(E, "out", T);
1194
+ ce(T, "out", P);
901
1195
  };
902
- let de = /* @__PURE__ */ new WeakSet();
903
- const re = /* @__PURE__ */ new Set(), se = /* @__PURE__ */ new Map(), ke = (r, l, { enter: a = !0 } = {}) => {
904
- if (ne = !1, i.connect(), h.initialize(), de.has(l)) {
905
- const T = m.get(l);
906
- if (T && T.currentPath !== r) {
907
- T.intent === "visible" && T.pendingOutPath === null && (T.pendingOutPath = T.currentPath), T.currentPath = r;
908
- const P = ++T.pathRevision;
1196
+ let Te = /* @__PURE__ */ new WeakSet();
1197
+ const ae = /* @__PURE__ */ new Set(), ue = /* @__PURE__ */ new Map(), _e = (i, f, { enter: p = !0 } = {}) => {
1198
+ if (H = !1, a.connect(), g.initialize(), Te.has(f)) {
1199
+ const P = b.get(f);
1200
+ if (P && P.currentPath !== i) {
1201
+ P.intent === "visible" && P.pendingOutPath === null && (P.pendingOutPath = P.currentPath), P.currentPath = i;
1202
+ const M = ++P.pathRevision;
909
1203
  queueMicrotask(() => {
910
- T.pathRevision === P && (T.pendingOutPath = null);
1204
+ P.pathRevision === M && (P.pendingOutPath = null);
911
1205
  });
912
1206
  }
913
1207
  return;
914
1208
  }
915
- de.add(l);
916
- const C = U;
917
- ee(l);
918
- const v = kt(l, {
919
- onHide: () => $e(l, r),
920
- onShow: () => qe(l, r)
1209
+ Te.add(f);
1210
+ const I = ee;
1211
+ re(f);
1212
+ const S = Qt(f, {
1213
+ onHide: () => gt(f, i),
1214
+ onShow: () => vt(f, i)
921
1215
  });
922
- re.add(v);
923
- const E = {
924
- vis: v,
1216
+ ae.add(S);
1217
+ const T = {
1218
+ vis: S,
925
1219
  savedCss: null,
926
- intent: v.isHidden ? "hidden" : "visible",
1220
+ intent: S.isHidden ? "hidden" : "visible",
927
1221
  visibleDisplay: "",
928
1222
  computedDisplay: "block",
929
- currentPath: r,
1223
+ currentPath: i,
930
1224
  pendingOutPath: null,
931
1225
  pathRevision: 0
932
1226
  };
933
- if (m.set(l, E), !v.isHidden && (N(l, E), a)) {
934
- const T = g(l, r), P = {
935
- element: l,
936
- parent: l.parentElement,
937
- nextSibling: l.nextElementSibling,
938
- applyScrollPolicy: T
1227
+ if (b.set(f, T), !S.isHidden && (le(f, T), p)) {
1228
+ const P = y(f, i), M = {
1229
+ element: f,
1230
+ parent: f.parentElement,
1231
+ nextSibling: f.nextElementSibling,
1232
+ applyScrollPolicy: P
939
1233
  };
940
- oe(r, "in", P);
1234
+ ce(i, "in", M);
941
1235
  }
942
- const W = Et(
943
- l,
944
- (T, P) => {
945
- C === U && Ve(l, r, T, (P == null ? void 0 : P.emit) ?? !0);
1236
+ const z = Zt(
1237
+ f,
1238
+ (P, M) => {
1239
+ I === ee && wt(f, i, P, (M == null ? void 0 : M.emit) ?? !0);
946
1240
  },
947
- s
1241
+ r
948
1242
  );
949
- se.set(l, W);
950
- }, Te = /* @__PURE__ */ new Map();
1243
+ ue.set(f, z);
1244
+ }, He = /* @__PURE__ */ new Map();
951
1245
  return {
952
- register: ke,
953
- refFor: (r) => {
954
- let l = Te.get(r);
955
- return l || (l = (a) => {
956
- a && ke(r, a);
957
- }, Te.set(r, l)), l;
1246
+ register: _e,
1247
+ refFor: (i) => {
1248
+ let f = He.get(i);
1249
+ return f || (f = (p) => {
1250
+ p && _e(i, p);
1251
+ }, He.set(i, f)), f;
958
1252
  },
959
1253
  disconnect() {
960
- ne = !0, U++, u.cancel(() => !0);
1254
+ H = !0, ee++, h.cancel(() => !0), q();
961
1255
  try {
962
- c.complete();
1256
+ l.cancel({ reason: "disposed", owns: () => !0 });
963
1257
  } finally {
964
- for (const r of K) r();
965
- for (const r of re) r.stop();
966
- re.clear();
967
- for (const r of se.values()) r();
968
- se.clear(), de = /* @__PURE__ */ new WeakSet(), I(), h.destroy(), i.dispose();
1258
+ for (const i of ae) i.stop();
1259
+ ae.clear();
1260
+ for (const i of ue.values()) i();
1261
+ ue.clear(), Te = /* @__PURE__ */ new WeakSet(), O(), g.destroy(), a.dispose();
969
1262
  }
970
1263
  }
971
1264
  };
972
1265
  }
973
- const Xe = "data-ssgoi-root", Pt = `[${Xe}]`, ue = "data-ssgoi-transition", Be = `[${ue}]`, xt = "[data-ssgoi-clone]";
974
- function Rt() {
1266
+ const mt = "data-ssgoi-root", tn = `[${mt}]`, Se = "data-ssgoi-transition", ut = `[${Se}]`, nn = "[data-ssgoi-clone]";
1267
+ function sn() {
975
1268
  return typeof MutationObserver < "u" && typeof HTMLElement < "u" && typeof Node < "u";
976
1269
  }
977
- function Mt(t) {
1270
+ function on(t) {
978
1271
  return t.nodeType === Node.ELEMENT_NODE;
979
1272
  }
980
- function Ot(t) {
1273
+ function rn(t) {
981
1274
  return t instanceof HTMLElement;
982
1275
  }
983
- function Fe(t) {
1276
+ function ft(t) {
984
1277
  let n = 0, e = t.parentElement;
985
1278
  for (; e; )
986
1279
  n++, e = e.parentElement;
987
1280
  return n;
988
1281
  }
989
- function ze(t, n, e = t) {
990
- const o = Array.from(t).sort(
991
- (c, s) => Fe(c) - Fe(s)
1282
+ function dt(t, n, e = t) {
1283
+ const s = Array.from(t).sort(
1284
+ (l, r) => ft(l) - ft(r)
992
1285
  );
993
- for (const c of o) {
994
- const s = c.getAttribute(ue);
995
- if (s === null) continue;
996
- let u = c.parentElement, i = !1;
997
- for (; u; ) {
998
- if (e.has(u)) {
999
- i = !0;
1286
+ for (const l of s) {
1287
+ const r = l.getAttribute(Se);
1288
+ if (r === null) continue;
1289
+ let h = l.parentElement, a = !1;
1290
+ for (; h; ) {
1291
+ if (e.has(h)) {
1292
+ a = !0;
1000
1293
  break;
1001
1294
  }
1002
- u = u.parentElement;
1295
+ h = h.parentElement;
1003
1296
  }
1004
- n.register(s, c, { enter: !i });
1297
+ n.register(r, l, { enter: !a });
1005
1298
  }
1006
1299
  }
1007
- function Ht(t, n) {
1008
- if (!Rt()) return () => {
1300
+ function hn(t, n) {
1301
+ if (!sn()) return () => {
1009
1302
  };
1010
- t.setAttribute(Xe, "");
1011
- const e = (i) => i.closest(Pt) === t, o = (i) => !Ot(i) || !e(i) || i.closest(xt) || i.getAttribute(ue) === null ? null : i, c = (i, y) => {
1012
- if (Mt(i)) {
1013
- if (i.matches(Be)) {
1014
- const h = o(i);
1015
- h && y.add(h);
1303
+ t.setAttribute(mt, "");
1304
+ const e = (a) => a.closest(tn) === t, s = (a) => !rn(a) || !e(a) || a.closest(nn) || a.getAttribute(Se) === null ? null : a, l = (a, v) => {
1305
+ if (on(a)) {
1306
+ if (a.matches(ut)) {
1307
+ const g = s(a);
1308
+ g && v.add(g);
1016
1309
  }
1017
- for (const h of i.querySelectorAll(Be)) {
1018
- const f = o(h);
1019
- f && y.add(f);
1310
+ for (const g of a.querySelectorAll(ut)) {
1311
+ const m = s(g);
1312
+ m && v.add(m);
1020
1313
  }
1021
1314
  }
1022
- }, s = new MutationObserver((i) => {
1023
- const y = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
1024
- for (const f of i) {
1025
- if (f.type === "attributes") {
1026
- const d = o(f.target);
1027
- d && y.add(d);
1315
+ }, r = new MutationObserver((a) => {
1316
+ const v = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set();
1317
+ for (const m of a) {
1318
+ if (m.type === "attributes") {
1319
+ const d = s(m.target);
1320
+ d && v.add(d);
1028
1321
  continue;
1029
1322
  }
1030
- for (const d of f.addedNodes)
1031
- c(d, h);
1323
+ for (const d of m.addedNodes)
1324
+ l(d, g);
1032
1325
  }
1033
- for (const f of h) y.add(f);
1034
- ze(y, n, h);
1326
+ for (const m of g) v.add(m);
1327
+ dt(v, n, g);
1035
1328
  });
1036
- s.observe(t, {
1329
+ r.observe(t, {
1037
1330
  childList: !0,
1038
1331
  subtree: !0,
1039
1332
  attributes: !0,
1040
- attributeFilter: [ue]
1333
+ attributeFilter: [Se]
1041
1334
  });
1042
- const u = /* @__PURE__ */ new Set();
1043
- return c(t, u), ze(u, n), () => {
1044
- var i;
1045
- s.disconnect(), (i = n.disconnect) == null || i.call(n);
1335
+ const h = /* @__PURE__ */ new Set();
1336
+ return l(t, h), dt(h, n), () => {
1337
+ var a;
1338
+ r.disconnect(), (a = n.disconnect) == null || a.call(n);
1046
1339
  };
1047
1340
  }
1048
1341
  export {
1049
- et as Animation,
1050
- tt as HostAnimation,
1051
- Bt as MultiAnimation,
1052
- Ft as WebAnimation,
1053
- Nt as createSggoiTransitionContext,
1054
- Ht as observeSsgoiTransitions,
1055
- Kt as simulate
1342
+ Rt as Animation,
1343
+ Ot as HostAnimation,
1344
+ et as MultiAnimation,
1345
+ Qe as WebAnimation,
1346
+ pn as createSggoiTransitionContext,
1347
+ hn as observeSsgoiTransitions,
1348
+ gn as simulate
1056
1349
  };