@ssgoi/core 6.6.0 → 6.6.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.
package/dist/internal.js CHANGED
@@ -1,31 +1,31 @@
1
- var xt = Object.defineProperty;
2
- var Lt = (t, s, e) => s in t ? xt(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
- var F = (t, s, e) => Lt(t, typeof s != "symbol" ? s + "" : s, e);
4
- import { A as Ot } from "./multi-animation-Ch5rI3rB.js";
5
- import { M as ue, W as fe } from "./multi-animation-Ch5rI3rB.js";
6
- class _t extends Ot {
1
+ var _t = Object.defineProperty;
2
+ var Dt = (t, s, e) => s in t ? _t(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
+ var z = (t, s, e) => Dt(t, typeof s != "symbol" ? s + "" : s, e);
4
+ import { A as Nt } from "./multi-animation-Ch5rI3rB.js";
5
+ import { M as be, W as Se } from "./multi-animation-Ch5rI3rB.js";
6
+ class kt extends Nt {
7
7
  constructor() {
8
8
  super(...arguments);
9
- F(this, "child", null);
10
- F(this, "_state", "idle");
11
- F(this, "_settled", !1);
12
- F(this, "listeners", /* @__PURE__ */ new Set());
9
+ z(this, "child", null);
10
+ z(this, "_state", "idle");
11
+ z(this, "_settled", !1);
12
+ z(this, "listeners", /* @__PURE__ */ new Set());
13
13
  }
14
14
  attach(e) {
15
15
  const n = this.child;
16
16
  if (this.child = e, this._settled = !1, n) {
17
- const a = n.getPose();
18
- n.complete(), e.matchInto(a);
17
+ const l = n.getPose();
18
+ n.complete(), e.matchInto(l);
19
19
  }
20
20
  e.playbackRate = this.playbackRate;
21
- const l = e.onComplete;
21
+ const r = e.onComplete;
22
22
  e.onComplete = () => {
23
- l == null || l(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
23
+ r == null || r(), this.child === e && (this.child = null, this._state = "idle", this._settled = !0), this.notify();
24
24
  };
25
- const y = e.onUpdate;
26
- e.onUpdate = (a) => {
27
- var m;
28
- y == null || y(a), (m = this.onUpdate) == null || m.call(this, a), this.notify();
25
+ const u = e.onUpdate;
26
+ e.onUpdate = (l) => {
27
+ var d;
28
+ u == null || u(l), (d = this.onUpdate) == null || d.call(this, l), this.notify();
29
29
  }, this._state === "paused" ? e.pause() : this._state === "reversing" ? e.reverse() : (this._state = "playing", e.play()), this.notify();
30
30
  }
31
31
  play() {
@@ -98,19 +98,19 @@ class _t extends Ot {
98
98
  for (const e of this.listeners) e();
99
99
  }
100
100
  }
101
- const kt = (t, s) => {
101
+ const It = (t, s) => {
102
102
  var e;
103
103
  t.style.position = "absolute", t.style.width = "100%", t.style.top = `${-1 * (((e = s == null ? void 0 : s.scrollOffset) == null ? void 0 : e.y) ?? 0)}px`, t.style.left = "0";
104
- }, ht = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), Dt = (t) => {
104
+ }, yt = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), Ht = (t) => {
105
105
  let s = t.parentElement;
106
106
  for (; s && s !== document.body; ) {
107
107
  const e = window.getComputedStyle(s);
108
- if (ht.has(e.overflowY) || ht.has(e.overflowX))
108
+ if (yt.has(e.overflowY) || yt.has(e.overflowX))
109
109
  return s;
110
110
  s = s.parentElement;
111
111
  }
112
112
  return document.documentElement;
113
- }, Ht = (t) => {
113
+ }, Wt = (t) => {
114
114
  let s = t.parentElement;
115
115
  for (; s && s !== document.body; ) {
116
116
  const e = window.getComputedStyle(s).position;
@@ -120,16 +120,16 @@ const kt = (t, s) => {
120
120
  }
121
121
  return document.body;
122
122
  };
123
- function It(t) {
123
+ function zt(t) {
124
124
  const s = Object.keys(t);
125
125
  return Promise.all(s.map((e) => t[e])).then((e) => {
126
126
  const n = {};
127
- return s.forEach((l, y) => {
128
- n[l] = e[y];
127
+ return s.forEach((r, u) => {
128
+ n[r] = e[u];
129
129
  }), n;
130
130
  });
131
131
  }
132
- function Nt(t) {
132
+ function Bt(t) {
133
133
  const s = t.filter((e) => e.symmetric).map((e) => ({
134
134
  from: e.to,
135
135
  to: e.from,
@@ -137,203 +137,260 @@ function Nt(t) {
137
137
  }));
138
138
  return [...t, ...s];
139
139
  }
140
- function K(t, s) {
141
- if (s === "*")
142
- return !0;
143
- if (s.endsWith("/*")) {
144
- const e = s.slice(0, -1);
145
- return t.startsWith(e) && t.length > e.length;
140
+ const Ft = 1e6, mt = 100, Kt = 10;
141
+ function Xt(t) {
142
+ const s = t.trim(), e = s.indexOf("#"), n = s.indexOf("?"), r = [e, n].filter((u) => u >= 0).reduce((u, l) => Math.min(u, l), s.length);
143
+ return s.slice(0, r);
144
+ }
145
+ function lt(t) {
146
+ const s = Xt(t);
147
+ try {
148
+ if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(s))
149
+ return lt(new URL(s).pathname);
150
+ } catch {
146
151
  }
147
- return t === s;
152
+ const n = (s.startsWith("/") ? s : `/${s}`).replace(/\/+/g, "/");
153
+ return (n.length > 1 ? n.replace(/\/+$/g, "") : n) || "/";
154
+ }
155
+ function $t(t) {
156
+ const s = t.trim();
157
+ return s === "*" ? "*" : lt(s);
158
+ }
159
+ function it(t) {
160
+ return t === "/" ? [] : t.slice(1).split("/");
148
161
  }
149
- function Wt(t, s, e) {
150
- for (const n of e)
151
- if (K(t, n.from) && K(s, n.to))
152
- return n.transition;
153
- for (const n of e)
154
- if ((n.from === "*" || K(t, n.from)) && (n.to === "*" || K(s, n.to)))
155
- return n.transition;
156
- return null;
162
+ function Ut(t) {
163
+ return t.startsWith(":") || t.startsWith("[") && t.endsWith("]") || t.startsWith("{") && t.endsWith("}");
157
164
  }
158
- const Ft = 768, Kt = 10, Bt = 10;
159
- function Xt(t = {}) {
160
- const { preserveScroll: s = (u) => u } = t, e = typeof s == "function" ? s : () => s;
161
- let n = null, l = !1, y = !1;
162
- const a = () => {
163
- const u = (n == null ? void 0 : n.clientWidth) ?? 0, c = u > 0 ? u : typeof window < "u" ? window.innerWidth : 0;
164
- return c > 0 && c < Ft;
165
- }, m = () => (y || (l = a(), y = !0), l), v = (u) => {
166
- var E;
167
- const c = e(m());
168
- if (c === !1)
169
- return { preserves: !1, shared: !1, storageKey: `path:${u}` };
170
- if (c === !0)
171
- return { preserves: !0, shared: !1, storageKey: `path:${u}` };
172
- const g = ((E = c.exclude) == null ? void 0 : E.some((T) => K(u, T))) ?? !1, S = !g && !!c.key;
165
+ function ot(t, s) {
166
+ const e = lt(t), n = $t(s);
167
+ if (n === "*")
168
+ return { matched: !0, specificity: 0 };
169
+ if (e === n)
173
170
  return {
174
- preserves: !g,
175
- shared: S,
176
- storageKey: S ? `shared:${c.key}` : `path:${u}`
171
+ matched: !0,
172
+ specificity: Ft + it(n).length * mt
177
173
  };
178
- }, C = (u) => v(u).preserves;
179
- let x = null;
174
+ const r = it(e), u = it(n);
175
+ let l = 0;
176
+ for (let d = 0; d < u.length; d++) {
177
+ const y = u[d], R = r[d], A = d === u.length - 1;
178
+ if (y === void 0)
179
+ return { matched: !1, specificity: 0 };
180
+ if ((y === "*" || y === "**") && A)
181
+ return {
182
+ matched: y === "**" ? r.length >= d : r.length > d,
183
+ specificity: l
184
+ };
185
+ if (R === void 0)
186
+ return { matched: !1, specificity: 0 };
187
+ if (y === "*" || Ut(y)) {
188
+ l += Kt;
189
+ continue;
190
+ }
191
+ if (y !== R)
192
+ return { matched: !1, specificity: 0 };
193
+ l += mt;
194
+ }
195
+ return {
196
+ matched: r.length === u.length,
197
+ specificity: l
198
+ };
199
+ }
200
+ function qt(t, s) {
201
+ return ot(t, s).matched;
202
+ }
203
+ function Vt(t, s, e) {
204
+ let n;
205
+ for (const r of e) {
206
+ const u = ot(t, r.from);
207
+ if (!u.matched) continue;
208
+ const l = ot(s, r.to);
209
+ if (!l.matched) continue;
210
+ const d = u.specificity + l.specificity;
211
+ (!n || d > n.specificity) && (n = { transition: r.transition, specificity: d });
212
+ }
213
+ return (n == null ? void 0 : n.transition) ?? null;
214
+ }
215
+ const Gt = 768, Yt = 10, Zt = 10;
216
+ function Qt(t = {}) {
217
+ const { preserveScroll: s = (f) => f } = t, e = typeof s == "function" ? s : () => s;
218
+ let n = null, r = !1, u = !1;
219
+ const l = () => {
220
+ const f = (n == null ? void 0 : n.clientWidth) ?? 0, a = f > 0 ? f : typeof window < "u" ? window.innerWidth : 0;
221
+ return a > 0 && a < Gt;
222
+ }, d = () => (u || (r = l(), u = !0), r), y = (f) => {
223
+ var S;
224
+ const a = e(d());
225
+ if (a === !1)
226
+ return { preserves: !1, shared: !1, storageKey: `path:${f}` };
227
+ if (a === !0)
228
+ return { preserves: !0, shared: !1, storageKey: `path:${f}` };
229
+ const v = ((S = a.exclude) == null ? void 0 : S.some((T) => qt(f, T))) ?? !1, w = !v && !!a.key;
230
+ return {
231
+ preserves: !v,
232
+ shared: w,
233
+ storageKey: w ? `shared:${a.key}` : `path:${f}`
234
+ };
235
+ }, R = (f) => y(f).preserves;
236
+ let A = null;
180
237
  const b = /* @__PURE__ */ new Map();
181
- let M = null, L = !1, I = 0;
182
- const N = () => {
183
- n && M && !L && b.set(v(M).storageKey, {
238
+ let x = null, L = !1, I = 0;
239
+ const H = () => {
240
+ n && x && !L && b.set(y(x).storageKey, {
184
241
  x: n.scrollLeft,
185
242
  y: n.scrollTop
186
243
  });
187
- }, z = (u) => {
244
+ }, K = (f) => {
188
245
  if (!n) return;
189
- const c = v(u);
190
- if (c.preserves && c.shared && !b.has(c.storageKey))
246
+ const a = y(f);
247
+ if (a.preserves && a.shared && !b.has(a.storageKey))
191
248
  return;
192
- const g = c.preserves && b.has(c.storageKey) ? b.get(c.storageKey) : { x: 0, y: 0 };
193
- let S = 0;
194
- const E = () => {
249
+ const v = a.preserves && b.has(a.storageKey) ? b.get(a.storageKey) : { x: 0, y: 0 };
250
+ let w = 0;
251
+ const S = () => {
195
252
  if (!n) return;
196
253
  n.scrollTo({
197
- top: g.y,
198
- left: g.x
199
- }), !(Math.abs(n.scrollTop - g.y) < 1 && Math.abs(n.scrollLeft - g.x) < 1) && S < Kt && (S++, requestAnimationFrame(E));
254
+ top: v.y,
255
+ left: v.x
256
+ }), !(Math.abs(n.scrollTop - v.y) < 1 && Math.abs(n.scrollLeft - v.x) < 1) && w < Yt && (w++, requestAnimationFrame(S));
200
257
  };
201
- requestAnimationFrame(E);
258
+ requestAnimationFrame(S);
202
259
  };
203
260
  return {
204
- initializeContext: (u, c) => {
261
+ initializeContext: (f, a) => {
205
262
  L = !0;
206
- const g = ++I;
207
- x = u, n || (n = Dt(u), l = a(), y = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
208
- l = a();
209
- }).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll", N, {
263
+ const v = ++I;
264
+ A = f, n || (n = Ht(f), r = l(), u = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
265
+ r = l();
266
+ }).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll", H, {
210
267
  passive: !0
211
- })), M = c, z(c);
212
- let S = 0;
213
- const E = () => {
214
- g === I && (S++, S >= Bt ? L = !1 : requestAnimationFrame(E));
268
+ })), x = a, K(a);
269
+ let w = 0;
270
+ const S = () => {
271
+ v === I && (w++, w >= Zt ? L = !1 : requestAnimationFrame(S));
215
272
  };
216
- requestAnimationFrame(E);
273
+ requestAnimationFrame(S);
217
274
  },
218
- calculateScrollOffset: (u, c) => {
219
- const g = u ? v(u).storageKey : null, S = g && b.has(g) ? b.get(g) : { x: 0, y: 0 }, E = c ? v(c) : null, T = E != null && E.preserves ? E.storageKey : null, H = T && b.has(T) ? b.get(T) : { x: 0, y: 0 };
275
+ calculateScrollOffset: (f, a) => {
276
+ const v = f ? y(f).storageKey : null, w = v && b.has(v) ? b.get(v) : { x: 0, y: 0 }, S = a ? y(a) : null, T = S != null && S.preserves ? S.storageKey : null, k = T && b.has(T) ? b.get(T) : { x: 0, y: 0 };
220
277
  return {
221
- x: -H.x + S.x,
222
- y: -H.y + S.y
278
+ x: -k.x + w.x,
279
+ y: -k.y + w.y
223
280
  };
224
281
  },
225
- evictScrollPosition: (u) => {
226
- b.delete(v(u).storageKey);
282
+ evictScrollPosition: (f) => {
283
+ b.delete(y(f).storageKey);
227
284
  },
228
- shouldPreserve: C,
285
+ shouldPreserve: R,
229
286
  getScrollContainer: () => n,
230
- getPositionedParentElement: () => x ? Ht(x) : document.body,
231
- getScrollPosition: (u) => {
232
- const c = u ? v(u).storageKey : null;
233
- return c && b.has(c) ? b.get(c) : { x: 0, y: 0 };
287
+ getPositionedParentElement: () => A ? Wt(A) : document.body,
288
+ getScrollPosition: (f) => {
289
+ const a = f ? y(f).storageKey : null;
290
+ return a && b.has(a) ? b.get(a) : { x: 0, y: 0 };
234
291
  },
235
292
  // Same measurement that drives `preserveScroll`'s `isMobile`, exposed so a
236
293
  // functional `transitions` config can branch on it too.
237
- getIsMobile: m
294
+ getIsMobile: d
238
295
  };
239
296
  }
240
- const yt = 30, pt = 8, mt = 1.2, gt = 30, zt = 600;
241
- function $t() {
242
- let t = null, s = !1, e = !1, n = null, l = null, y = !1;
243
- const a = (f, d) => {
244
- for (let h = 0; h < f.length; h++) {
245
- const w = f.item(h);
246
- if (w && w.identifier === d) return w;
297
+ const gt = 30, vt = 8, bt = 1.2, St = 30, jt = 600;
298
+ function Jt() {
299
+ let t = null, s = !1, e = !1, n = null, r = null, u = !1;
300
+ const l = (h, p) => {
301
+ for (let m = 0; m < h.length; m++) {
302
+ const E = h.item(m);
303
+ if (E && E.identifier === p) return E;
247
304
  }
248
305
  return null;
249
- }, m = () => {
306
+ }, d = () => {
250
307
  n !== null && (clearTimeout(n), n = null);
251
- }, v = () => {
252
- l !== null && (clearTimeout(l), l = null);
253
- }, C = () => {
254
- s = !0, e = !0, m(), v(), n = setTimeout(() => {
308
+ }, y = () => {
309
+ r !== null && (clearTimeout(r), r = null);
310
+ }, R = () => {
311
+ s = !0, e = !0, d(), y(), n = setTimeout(() => {
255
312
  s = !1, e = !1, n = null;
256
- }, zt);
257
- }, x = (f) => {
258
- if (f.touches.length !== 1) {
313
+ }, jt);
314
+ }, A = (h) => {
315
+ if (h.touches.length !== 1) {
259
316
  t = null;
260
317
  return;
261
318
  }
262
- const d = f.touches.item(0);
263
- if (!d) {
319
+ const p = h.touches.item(0);
320
+ if (!p) {
264
321
  t = null;
265
322
  return;
266
323
  }
267
- const h = window.innerWidth, w = d.clientX <= yt, O = d.clientX >= h - yt;
268
- if (!w && !O) {
324
+ const m = window.innerWidth, E = p.clientX <= gt, O = p.clientX >= m - gt;
325
+ if (!E && !O) {
269
326
  t = null;
270
327
  return;
271
328
  }
272
329
  t = {
273
- identifier: d.identifier,
274
- startX: d.clientX,
275
- startY: d.clientY,
276
- fromLeftEdge: w,
330
+ identifier: p.identifier,
331
+ startX: p.clientX,
332
+ startY: p.clientY,
333
+ fromLeftEdge: E,
277
334
  moved: !1
278
335
  };
279
- }, b = (f) => {
336
+ }, b = (h) => {
280
337
  if (!t) return;
281
- if (f.touches.length !== 1) {
338
+ if (h.touches.length !== 1) {
282
339
  t = null;
283
340
  return;
284
341
  }
285
- const d = a(f.touches, t.identifier);
286
- if (!d) {
342
+ const p = l(h.touches, t.identifier);
343
+ if (!p) {
287
344
  t = null;
288
345
  return;
289
346
  }
290
- const h = d.clientX - t.startX, w = d.clientY - t.startY, O = Math.abs(h), u = Math.abs(w);
291
- if (u > pt && u > O * mt) {
347
+ const m = p.clientX - t.startX, E = p.clientY - t.startY, O = Math.abs(m), f = Math.abs(E);
348
+ if (f > vt && f > O * bt) {
292
349
  t = null;
293
350
  return;
294
351
  }
295
- const c = t.fromLeftEdge ? h > 0 : h < 0;
296
- O > pt && O > u * mt && c && (t.moved = !0);
297
- }, M = (f) => {
352
+ const a = t.fromLeftEdge ? m > 0 : m < 0;
353
+ O > vt && O > f * bt && a && (t.moved = !0);
354
+ }, x = (h) => {
298
355
  if (!t) return;
299
- const d = a(f.changedTouches, t.identifier);
300
- if (!d) {
356
+ const p = l(h.changedTouches, t.identifier);
357
+ if (!p) {
301
358
  t = null;
302
359
  return;
303
360
  }
304
- const h = d.clientX - t.startX, w = t.fromLeftEdge ? h > 0 : h < 0;
305
- if (t.moved && w && Math.abs(h) >= gt) {
306
- C(), t = null;
361
+ const m = p.clientX - t.startX, E = t.fromLeftEdge ? m > 0 : m < 0;
362
+ if (t.moved && E && Math.abs(m) >= St) {
363
+ R(), t = null;
307
364
  return;
308
365
  }
309
- t.moved && Math.abs(h) >= gt && C(), t = null;
366
+ t.moved && Math.abs(m) >= St && R(), t = null;
310
367
  }, L = () => {
311
- t && (t.moved && C(), t = null);
368
+ t && (t.moved && R(), t = null);
312
369
  };
313
370
  return { initialize: () => {
314
- if (typeof window > "u" || y) return;
315
- y = !0;
316
- const f = { passive: !0, capture: !0 };
317
- window.addEventListener("touchstart", x, f), window.addEventListener("touchmove", b, f), window.addEventListener("touchend", M, f), window.addEventListener("touchcancel", L, f);
371
+ if (typeof window > "u" || u) return;
372
+ u = !0;
373
+ const h = { passive: !0, capture: !0 };
374
+ window.addEventListener("touchstart", A, h), window.addEventListener("touchmove", b, h), window.addEventListener("touchend", x, h), window.addEventListener("touchcancel", L, h);
318
375
  }, destroy: () => {
319
- if (typeof window > "u" || !y) return;
320
- y = !1;
321
- const f = { capture: !0 };
322
- window.removeEventListener("touchstart", x, f), window.removeEventListener("touchmove", b, f), window.removeEventListener("touchend", M, f), window.removeEventListener("touchcancel", L, f), m(), v(), t = null, s = !1, e = !1;
376
+ if (typeof window > "u" || !u) return;
377
+ u = !1;
378
+ const h = { capture: !0 };
379
+ window.removeEventListener("touchstart", A, h), window.removeEventListener("touchmove", b, h), window.removeEventListener("touchend", x, h), window.removeEventListener("touchcancel", L, h), d(), y(), t = null, s = !1, e = !1;
323
380
  }, isSwipeBack: () => {
324
- const f = s || e;
325
- return f && m(), f;
381
+ const h = s || e;
382
+ return h && d(), h;
326
383
  }, onPageEnter: () => {
327
- s = !1, m(), v(), l = setTimeout(() => {
328
- e = !1, l = null;
384
+ s = !1, d(), y(), r = setTimeout(() => {
385
+ e = !1, r = null;
329
386
  }, 0);
330
387
  } };
331
388
  }
332
- function Vt() {
389
+ function te() {
333
390
  let t = null;
334
391
  function s() {
335
- var n, l;
336
- t && ((n = t.outResolve) == null || n.call(t, null), (l = t.inResolve) == null || l.call(t, null), t = null);
392
+ var n, r;
393
+ t && ((n = t.outResolve) == null || n.call(t, null), (r = t.inResolve) == null || r.call(t, null), t = null);
337
394
  }
338
395
  function e() {
339
396
  if (t != null && t.from && (t != null && t.to) && (t != null && t.outResolve) && (t != null && t.inResolve)) {
@@ -346,151 +403,156 @@ function Vt() {
346
403
  }
347
404
  }
348
405
  return {
349
- trigger(n, l) {
350
- var a;
351
- l === "out" && (t == null ? void 0 : t.to) === n && !t.from && ((a = t.inResolve) == null || a.call(t, null), t = {}), t && (l === "out" && t.from && t.from !== n || l === "in" && t.to && t.to !== n) && s(), t || (t = {}), l === "out" ? t.from = n : t.to = n;
406
+ trigger(n, r) {
407
+ var l;
408
+ r === "out" && (t == null ? void 0 : t.to) === n && !t.from && ((l = t.inResolve) == null || l.call(t, null), t = {}), t && (r === "out" && t.from && t.from !== n || r === "in" && t.to && t.to !== n) && s(), t || (t = {}), r === "out" ? t.from = n : t.to = n;
352
409
  },
353
410
  get(n) {
354
- return new Promise((l) => {
355
- t || (t = {}), n === "out" ? t.outResolve = l : t.inResolve = l, e();
411
+ return new Promise((r) => {
412
+ t || (t = {}), n === "out" ? t.outResolve = r : t.inResolve = r, e();
356
413
  });
357
414
  }
358
415
  };
359
416
  }
360
- const X = /* @__PURE__ */ new Map();
361
- let G = null, vt = !1;
362
- function Et(t) {
363
- if (t instanceof HTMLElement && X.has(t) && !t.isConnected) {
364
- const s = X.get(t);
365
- X.delete(t), queueMicrotask(s);
417
+ const F = /* @__PURE__ */ new Map();
418
+ let G = null, Et = !1;
419
+ function Tt(t, s) {
420
+ if (t instanceof HTMLElement && F.has(t) && !t.isConnected) {
421
+ const e = F.get(t);
422
+ F.delete(t), queueMicrotask(() => e(s));
366
423
  }
367
- for (const s of Array.from(t.childNodes))
368
- Et(s);
424
+ for (const e of Array.from(t.childNodes))
425
+ Tt(e, s);
369
426
  }
370
- function qt() {
371
- if (vt || typeof document > "u") return;
372
- vt = !0, G = new MutationObserver((s) => {
373
- for (const e of s)
374
- for (const n of Array.from(e.removedNodes))
375
- Et(n);
427
+ function ee() {
428
+ if (Et || typeof document > "u") return;
429
+ Et = !0, G = new MutationObserver((s) => {
430
+ for (const e of s) {
431
+ const n = {
432
+ parent: e.target,
433
+ nextSibling: e.nextSibling
434
+ };
435
+ for (const r of Array.from(e.removedNodes))
436
+ Tt(r, n);
437
+ }
376
438
  });
377
439
  const t = () => {
378
440
  G == null || G.observe(document.body, { childList: !0, subtree: !0 });
379
441
  };
380
442
  document.body ? t() : document.addEventListener("DOMContentLoaded", t, { once: !0 });
381
443
  }
382
- function Ut(t, s) {
383
- return qt(), X.set(t, s), () => {
384
- X.delete(t);
444
+ function ne(t, s) {
445
+ return ee(), F.set(t, s), () => {
446
+ F.delete(t);
385
447
  };
386
448
  }
387
- const it = /* @__PURE__ */ new WeakMap();
388
- let Z = null;
389
- const j = "none !important";
449
+ const rt = /* @__PURE__ */ new WeakMap();
450
+ let Y = null;
451
+ const Z = "none !important";
390
452
  function B(t) {
391
453
  const s = t.style.getPropertyValue("display");
392
454
  return t.style.getPropertyPriority("display") ? `${s} !important` : s;
393
455
  }
394
- function Yt() {
395
- return Z || (Z = new MutationObserver((t) => {
456
+ function se() {
457
+ return Y || (Y = new MutationObserver((t) => {
396
458
  for (const s of t) {
397
- const e = s.target, n = it.get(e);
459
+ const e = s.target, n = rt.get(e);
398
460
  if (!n) continue;
399
- const l = B(e);
400
- l !== n.accounted && (n.accounted = l, l === j ? (n.reactHidden = !0, n.onHide()) : l !== "none" && n.reactHidden && (n.reactHidden = !1, n.onShow()));
461
+ const r = B(e);
462
+ r !== n.accounted && (n.accounted = r, r === Z ? (n.reactHidden = !0, n.onHide()) : r !== "none" && n.reactHidden && (n.reactHidden = !1, n.onShow()));
401
463
  }
402
- }), Z);
464
+ }), Y);
403
465
  }
404
- function Gt(t, s) {
466
+ function ie(t, s) {
405
467
  const e = B(t), n = {
406
468
  accounted: e,
407
- reactHidden: e === j,
469
+ reactHidden: e === Z,
408
470
  onHide: s.onHide,
409
471
  onShow: s.onShow
410
472
  };
411
- return it.set(t, n), Yt().observe(t, {
473
+ return rt.set(t, n), se().observe(t, {
412
474
  attributes: !0,
413
475
  attributeFilter: ["style"]
414
476
  }), {
415
477
  get isHidden() {
416
- return B(t) === j;
478
+ return B(t) === Z;
417
479
  },
418
- setDisplay(l, y = !1) {
419
- l === null ? t.style.removeProperty("display") : t.style.setProperty(
480
+ setDisplay(r, u = !1) {
481
+ r === null ? t.style.removeProperty("display") : t.style.setProperty(
420
482
  "display",
421
- l,
422
- y ? "important" : ""
483
+ r,
484
+ u ? "important" : ""
423
485
  ), n.accounted = B(t);
424
486
  },
425
487
  sync() {
426
- n.accounted = B(t), n.reactHidden = n.accounted === j;
488
+ n.accounted = B(t), n.reactHidden = n.accounted === Z;
427
489
  },
428
490
  stop() {
429
- it.delete(t);
491
+ rt.delete(t);
430
492
  }
431
493
  };
432
494
  }
433
- function Zt(t) {
495
+ function oe(t) {
434
496
  return Array.isArray(t);
435
497
  }
436
- function wt(t) {
498
+ function Pt(t) {
437
499
  const s = [];
438
500
  for (const e of t)
439
- Zt(e) ? s.push(...wt(e)) : s.push(e);
501
+ oe(e) ? s.push(...Pt(e)) : s.push(e);
440
502
  return s;
441
503
  }
442
- function re(t, s = {}) {
504
+ function ye(t, s = {}) {
443
505
  const {
444
506
  transitions: e = [],
445
- middleware: n = (o, i) => ({ from: o, to: i }),
446
- preserveScroll: l = (o) => o
447
- } = t, y = s.host ?? new _t(), a = Vt(), m = typeof e == "function" ? e : () => e, v = $t();
448
- v.initialize();
507
+ middleware: n = (i, o) => ({ from: i, to: o }),
508
+ preserveScroll: r = (i) => i
509
+ } = t, u = s.host ?? new kt(), l = te(), d = typeof e == "function" ? e : () => e, y = Jt();
510
+ y.initialize();
449
511
  const {
450
- initializeContext: C,
451
- calculateScrollOffset: x,
512
+ initializeContext: R,
513
+ calculateScrollOffset: A,
452
514
  evictScrollPosition: b,
453
- shouldPreserve: M,
515
+ shouldPreserve: x,
454
516
  getScrollContainer: L,
455
517
  getPositionedParentElement: I,
456
- getScrollPosition: N,
457
- getIsMobile: z
458
- } = Xt({ preserveScroll: l }), $ = /* @__PURE__ */ new Map(), f = () => {
459
- const o = z();
460
- let i = $.get(o);
461
- return i || (i = Nt(
462
- wt(m({ isMobile: o }))
463
- ), $.set(o, i)), i;
518
+ getScrollPosition: H,
519
+ getIsMobile: K
520
+ } = Qt({ preserveScroll: r }), X = /* @__PURE__ */ new Map(), h = () => {
521
+ const i = K();
522
+ let o = X.get(i);
523
+ return o || (o = Bt(
524
+ Pt(d({ isMobile: i }))
525
+ ), X.set(i, o)), o;
464
526
  };
465
- let d = null, h = null;
466
- const w = /* @__PURE__ */ new WeakMap(), O = (o) => {
467
- w.set(o, {
468
- parent: o.parentElement,
469
- nextSibling: o.nextElementSibling
527
+ let p = null, m = null;
528
+ const E = /* @__PURE__ */ new WeakMap(), O = (i) => {
529
+ E.set(i, {
530
+ parent: i.parentNode,
531
+ nextSibling: i.nextSibling
470
532
  });
471
- }, u = (o) => {
472
- const i = w.get(o);
473
- return i || {
474
- parent: o.parentElement,
475
- nextSibling: o.nextElementSibling
533
+ }, f = (i) => {
534
+ const o = E.get(i);
535
+ return o || {
536
+ parent: i.parentNode,
537
+ nextSibling: i.nextSibling
476
538
  };
477
- }, c = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap();
478
- let S = 0;
479
- const E = (o) => {
480
- const i = typeof getComputedStyle < "u" ? getComputedStyle(o).display : "";
481
- return i && i !== "none" ? i : "block";
482
- }, T = (o, i) => {
483
- i.visibleDisplay = o.style.getPropertyValue("display"), i.computedDisplay = E(o);
484
- }, H = (o, i) => {
485
- if (g.get(o) !== i) return;
486
- g.delete(o);
487
- const r = c.get(o);
488
- r && (r.savedCss !== null && (o.style.cssText = r.savedCss, r.savedCss = null), r.intent === "hidden" ? r.vis.setDisplay("none", !0) : r.visibleDisplay ? (r.vis.setDisplay(r.visibleDisplay, !1), T(o, r)) : (r.vis.setDisplay(null), T(o, r)));
489
- }, Tt = (o, i, r, p, A) => {
490
- const P = p.element, _ = A.element, k = (p.mode ?? "unmount") === "hidden", { parent: q, nextSibling: Q } = p.parent ? { parent: p.parent, nextSibling: p.nextSibling } : u(P), U = x(i, r), tt = {
491
- scrollOffset: U,
492
- from: { scroll: N(i) },
493
- to: { scroll: N(r) },
539
+ }, a = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap();
540
+ let w = 0;
541
+ const S = (i) => {
542
+ const o = typeof getComputedStyle < "u" ? getComputedStyle(i).display : "";
543
+ return o && o !== "none" ? o : "block";
544
+ }, T = (i, o) => {
545
+ o.visibleDisplay = i.style.getPropertyValue("display"), o.computedDisplay = S(i);
546
+ }, k = (i, o) => {
547
+ if (v.get(i) !== o) return;
548
+ v.delete(i);
549
+ const c = a.get(i);
550
+ c && (c.savedCss !== null && (i.style.cssText = c.savedCss, c.savedCss = null), c.intent === "hidden" ? c.vis.setDisplay("none", !0) : c.visibleDisplay ? (c.vis.setDisplay(c.visibleDisplay, !1), T(i, c)) : (c.vis.setDisplay(null), T(i, c)));
551
+ }, Rt = (i, o, c, g, P) => {
552
+ const M = g.element, _ = P.element, D = (g.mode ?? "unmount") === "hidden", { parent: U, nextSibling: j } = g.parent ? { parent: g.parent, nextSibling: g.nextSibling } : f(M), q = A(o, c), J = {
553
+ scrollOffset: q,
554
+ from: { scroll: H(o) },
555
+ to: { scroll: H(c) },
494
556
  get scrollingElement() {
495
557
  return L() || document.documentElement;
496
558
  },
@@ -498,176 +560,176 @@ function re(t, s = {}) {
498
560
  return I();
499
561
  }
500
562
  };
501
- let R;
502
- if (k) {
503
- R = P, R.style.top = `${-1 * ((U == null ? void 0 : U.y) ?? 0)}px`;
504
- const D = c.get(_);
505
- D && D.savedCss === null && (D.savedCss = _.style.cssText);
563
+ let C;
564
+ if (D) {
565
+ C = M, C.style.top = `${-1 * ((q == null ? void 0 : q.y) ?? 0)}px`;
566
+ const N = a.get(_);
567
+ N && N.savedCss === null && (N.savedCss = _.style.cssText);
506
568
  } else
507
- R = P.cloneNode(!0), R.setAttribute("data-ssgoi-clone", ""), kt(R, tt);
508
- M(i) || b(i);
509
- const Y = k ? ++S : 0;
510
- k && (g.set(_, Y), g.set(P, Y));
511
- const ut = Promise.resolve(R), ft = Promise.resolve(_), dt = [], At = {
512
- from: ut,
513
- to: ft,
514
- context: tt,
515
- createElement: ((D, et = "div") => {
516
- const W = document.createElement(et);
517
- return W.setAttribute("data-ssgoi-id", D), dt.push(W), W;
569
+ C = M, It(C, J);
570
+ x(o) || b(o);
571
+ const V = D ? ++w : 0;
572
+ D && (v.set(_, V), v.set(M, V));
573
+ const ft = Promise.resolve(C), ht = Promise.resolve(_), pt = [], Lt = {
574
+ from: ft,
575
+ to: ht,
576
+ context: J,
577
+ createElement: ((N, tt = "div") => {
578
+ const W = document.createElement(tt);
579
+ return W.setAttribute("data-ssgoi-id", N), pt.push(W), W;
518
580
  })
519
- }, Ct = Promise.resolve(
520
- o.prepare ? o.prepare(At) : {}
581
+ }, Ot = Promise.resolve(
582
+ i.prepare ? i.prepare(Lt) : {}
521
583
  );
522
- It({
523
- from: ut,
524
- to: ft,
525
- extras: Ct
526
- }).then(({ from: D, to: et, extras: W }) => {
527
- !k && q && (Q && q.contains(Q) ? q.insertBefore(R, Q) : q.appendChild(R));
528
- const nt = o.animation({
529
- from: D,
530
- to: et,
531
- context: tt,
584
+ zt({
585
+ from: ft,
586
+ to: ht,
587
+ extras: Ot
588
+ }).then(({ from: N, to: tt, extras: W }) => {
589
+ !D && U && (j && U.contains(j) ? U.insertBefore(C, j) : U.appendChild(C));
590
+ const et = i.animation({
591
+ from: N,
592
+ to: tt,
593
+ context: J,
532
594
  ...W
533
- }), st = nt.onComplete;
534
- nt.onComplete = () => {
535
- st == null || st(), k ? (H(P, Y), H(_, Y)) : R.parentElement && R.parentElement.removeChild(R);
536
- for (const ot of dt)
537
- ot.parentElement && ot.parentElement.removeChild(ot);
538
- }, y.attach(nt);
595
+ }), nt = et.onComplete;
596
+ et.onComplete = () => {
597
+ nt == null || nt(), D ? (k(M, V), k(_, V)) : C.parentNode && C.parentNode.removeChild(C);
598
+ for (const st of pt)
599
+ st.parentNode && st.parentNode.removeChild(st);
600
+ }, u.attach(et);
539
601
  });
540
- }, V = (o, i) => {
541
- const r = v.isSwipeBack();
542
- a.trigger(o, i), a.get(i).then((p) => {
543
- if (i === "in" && v.onPageEnter(), !p) return;
544
- if (r) {
545
- i === "out" && p.from && !M(p.from) && b(p.from), d = null, h = null;
602
+ }, $ = (i, o) => {
603
+ const c = y.isSwipeBack();
604
+ l.trigger(i, o), l.get(o).then((g) => {
605
+ if (o === "in" && y.onPageEnter(), !g) return;
606
+ if (c) {
607
+ o === "out" && g.from && !x(g.from) && b(g.from), p = null, m = null;
546
608
  return;
547
609
  }
548
- if (i !== "in") return;
549
- const { from: A, to: P } = n(
550
- p.from,
551
- p.to
552
- ), _ = Wt(
553
- A,
610
+ if (o !== "in") return;
611
+ const { from: P, to: M } = n(
612
+ g.from,
613
+ g.to
614
+ ), _ = Vt(
554
615
  P,
555
- f()
556
- ), J = d, k = h;
557
- d = null, h = null, !(!_ || !J || !k) && Tt(_, A, P, J, k);
616
+ M,
617
+ h()
618
+ ), Q = p, D = m;
619
+ p = null, m = null, !(!_ || !Q || !D) && Rt(_, P, M, Q, D);
558
620
  });
559
- }, Rt = (o, i) => {
560
- const r = c.get(o);
561
- if (!r) return;
562
- const p = r.intent === "hidden";
563
- if (r.intent = "hidden", r.savedCss === null && (r.savedCss = o.style.cssText), r.vis.setDisplay(r.computedDisplay || "block", !0), o.style.position = "absolute", o.style.width = "100%", o.style.left = "0", p) return;
564
- const A = u(o);
565
- d = {
566
- element: o,
567
- parent: A.parent,
568
- nextSibling: A.nextSibling,
621
+ }, At = (i, o) => {
622
+ const c = a.get(i);
623
+ if (!c) return;
624
+ const g = c.intent === "hidden";
625
+ if (c.intent = "hidden", c.savedCss === null && (c.savedCss = i.style.cssText), c.vis.setDisplay(c.computedDisplay || "block", !0), i.style.position = "absolute", i.style.width = "100%", i.style.left = "0", g) return;
626
+ const P = f(i);
627
+ p = {
628
+ element: i,
629
+ parent: P.parent,
630
+ nextSibling: P.nextSibling,
569
631
  mode: "hidden"
570
632
  };
571
- const P = o.getAttribute("data-ssgoi-transition") ?? i;
572
- V(P, "out");
573
- }, Pt = (o, i) => {
574
- const r = c.get(o);
575
- if (!r || r.intent === "visible") return;
576
- r.intent = "visible", T(o, r), r.savedCss !== null && (o.style.cssText = r.savedCss, r.visibleDisplay ? r.vis.setDisplay(r.visibleDisplay, !1) : r.vis.setDisplay(null)), C(o, i), h = {
577
- element: o,
578
- parent: o.parentElement,
579
- nextSibling: o.nextElementSibling
633
+ const M = i.getAttribute("data-ssgoi-transition") ?? o;
634
+ $(M, "out");
635
+ }, Ct = (i, o) => {
636
+ const c = a.get(i);
637
+ if (!c || c.intent === "visible") return;
638
+ c.intent = "visible", T(i, c), c.savedCss !== null && (i.style.cssText = c.savedCss, c.visibleDisplay ? c.vis.setDisplay(c.visibleDisplay, !1) : c.vis.setDisplay(null)), R(i, o), m = {
639
+ element: i,
640
+ parent: i.parentElement,
641
+ nextSibling: i.nextElementSibling
580
642
  };
581
- const p = o.getAttribute("data-ssgoi-transition") ?? i;
582
- V(p, "in");
583
- }, Mt = (o, i) => {
584
- const r = c.get(o);
585
- if (r && (r.vis.stop(), c.delete(o), g.delete(o), r.intent === "hidden")) {
586
- (d == null ? void 0 : d.element) === o && (d = null), (h == null ? void 0 : h.element) === o && (h = null);
643
+ const g = i.getAttribute("data-ssgoi-transition") ?? o;
644
+ $(g, "in");
645
+ }, xt = (i, o, c) => {
646
+ const g = a.get(i);
647
+ if (g && (g.vis.stop(), a.delete(i), v.delete(i), g.intent === "hidden")) {
648
+ (p == null ? void 0 : p.element) === i && (p = null), (m == null ? void 0 : m.element) === i && (m = null);
587
649
  return;
588
650
  }
589
- const p = u(o);
590
- d = {
591
- element: o,
592
- parent: p.parent,
593
- nextSibling: p.nextSibling,
651
+ const P = c ?? f(i);
652
+ p = {
653
+ element: i,
654
+ parent: P.parent,
655
+ nextSibling: P.nextSibling,
594
656
  mode: "unmount"
595
657
  };
596
- const A = o.getAttribute("data-ssgoi-transition") ?? i;
597
- V(A, "out");
598
- }, lt = /* @__PURE__ */ new WeakSet(), ct = (o, i) => {
599
- if (lt.has(i)) return;
600
- lt.add(i), O(i);
601
- const r = Gt(i, {
602
- onHide: () => Rt(i, o),
603
- onShow: () => Pt(i, o)
604
- }), p = {
605
- vis: r,
658
+ const M = i.getAttribute("data-ssgoi-transition") ?? o;
659
+ $(M, "out");
660
+ }, at = /* @__PURE__ */ new WeakSet(), ut = (i, o) => {
661
+ if (at.has(o)) return;
662
+ at.add(o), O(o);
663
+ const c = ie(o, {
664
+ onHide: () => At(o, i),
665
+ onShow: () => Ct(o, i)
666
+ }), g = {
667
+ vis: c,
606
668
  savedCss: null,
607
- intent: r.isHidden ? "hidden" : "visible",
669
+ intent: c.isHidden ? "hidden" : "visible",
608
670
  visibleDisplay: "",
609
671
  computedDisplay: "block"
610
672
  };
611
- c.set(i, p), r.isHidden || (T(i, p), C(i, o), h = {
612
- element: i,
613
- parent: i.parentElement,
614
- nextSibling: i.nextElementSibling
615
- }, V(o, "in")), Ut(i, () => Mt(i, o));
616
- }, at = /* @__PURE__ */ new Map();
617
- return { register: ct, refFor: (o) => {
618
- let i = at.get(o);
619
- return i || (i = (r) => {
620
- r && ct(o, r);
621
- }, at.set(o, i)), i;
673
+ a.set(o, g), c.isHidden || (T(o, g), R(o, i), m = {
674
+ element: o,
675
+ parent: o.parentElement,
676
+ nextSibling: o.nextElementSibling
677
+ }, $(i, "in")), ne(o, (P) => xt(o, i, P));
678
+ }, dt = /* @__PURE__ */ new Map();
679
+ return { register: ut, refFor: (i) => {
680
+ let o = dt.get(i);
681
+ return o || (o = (c) => {
682
+ c && ut(i, c);
683
+ }, dt.set(i, o)), o;
622
684
  } };
623
685
  }
624
- const St = "data-ssgoi-root", jt = `[${St}]`, rt = "data-ssgoi-transition", bt = `[${rt}]`, Jt = "[data-ssgoi-clone]";
625
- function Qt() {
686
+ const Mt = "data-ssgoi-root", re = `[${Mt}]`, ct = "data-ssgoi-transition", wt = `[${ct}]`, ce = "[data-ssgoi-clone]";
687
+ function le() {
626
688
  return typeof MutationObserver < "u" && typeof HTMLElement < "u" && typeof Node < "u";
627
689
  }
628
- function te(t) {
690
+ function ae(t) {
629
691
  return t.nodeType === Node.ELEMENT_NODE;
630
692
  }
631
- function ee(t) {
693
+ function ue(t) {
632
694
  return t instanceof HTMLElement;
633
695
  }
634
- function le(t, s) {
635
- if (!Qt()) return () => {
696
+ function me(t, s) {
697
+ if (!le()) return () => {
636
698
  };
637
- t.setAttribute(St, "");
638
- const e = (a) => a.closest(jt) === t, n = (a) => {
639
- if (!ee(a) || !e(a) || a.closest(Jt))
699
+ t.setAttribute(Mt, "");
700
+ const e = (l) => l.closest(re) === t, n = (l) => {
701
+ if (!ue(l) || !e(l) || l.closest(ce))
640
702
  return;
641
- const m = a.getAttribute(rt);
642
- m !== null && s.register(m, a);
643
- }, l = (a) => {
644
- if (te(a)) {
645
- a.matches(bt) && n(a);
646
- for (const m of a.querySelectorAll(bt))
647
- n(m);
703
+ const d = l.getAttribute(ct);
704
+ d !== null && s.register(d, l);
705
+ }, r = (l) => {
706
+ if (ae(l)) {
707
+ l.matches(wt) && n(l);
708
+ for (const d of l.querySelectorAll(wt))
709
+ n(d);
648
710
  }
649
- }, y = new MutationObserver((a) => {
650
- for (const m of a) {
651
- if (m.type === "attributes") {
652
- n(m.target);
711
+ }, u = new MutationObserver((l) => {
712
+ for (const d of l) {
713
+ if (d.type === "attributes") {
714
+ n(d.target);
653
715
  continue;
654
716
  }
655
- for (const v of m.addedNodes)
656
- l(v);
717
+ for (const y of d.addedNodes)
718
+ r(y);
657
719
  }
658
720
  });
659
- return y.observe(t, {
721
+ return u.observe(t, {
660
722
  childList: !0,
661
723
  subtree: !0,
662
724
  attributes: !0,
663
- attributeFilter: [rt]
664
- }), l(t), () => y.disconnect();
725
+ attributeFilter: [ct]
726
+ }), r(t), () => u.disconnect();
665
727
  }
666
728
  export {
667
- Ot as Animation,
668
- _t as HostAnimation,
669
- ue as MultiAnimation,
670
- fe as WebAnimation,
671
- re as createSggoiTransitionContext,
672
- le as observeSsgoiTransitions
729
+ Nt as Animation,
730
+ kt as HostAnimation,
731
+ be as MultiAnimation,
732
+ Se as WebAnimation,
733
+ ye as createSggoiTransitionContext,
734
+ me as observeSsgoiTransitions
673
735
  };