aptechka 0.64.9 → 0.65.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,33 @@
1
- var Pt = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), At = (n) => {
2
- throw TypeError(n);
1
+ var Ct = (a, t) => (t = Symbol[a]) ? t : Symbol.for("Symbol." + a), Tt = (a) => {
2
+ throw TypeError(a);
3
3
  };
4
- var ut = (n, t, s) => t.has(n) || At("Cannot " + s);
5
- var e = (n, t, s) => (ut(n, t, "read from private field"), s ? s.call(n) : t.get(n)), a = (n, t, s) => t.has(n) ? At("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), o = (n, t, s, i) => (ut(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), m = (n, t, s) => (ut(n, t, "access private method"), s);
6
- var z = (n, t, s) => new Promise((i, d) => {
7
- var v = (E) => {
4
+ var ft = (a, t, s) => t.has(a) || Tt("Cannot " + s);
5
+ var e = (a, t, s) => (ft(a, t, "read from private field"), s ? s.call(a) : t.get(a)), o = (a, t, s) => t.has(a) ? Tt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, s), n = (a, t, s, i) => (ft(a, t, "write to private field"), i ? i.call(a, s) : t.set(a, s), s), m = (a, t, s) => (ft(a, t, "access private method"), s);
6
+ var z = (a, t, s) => new Promise((i, h) => {
7
+ var w = (E) => {
8
8
  try {
9
9
  S(s.next(E));
10
10
  } catch (R) {
11
- d(R);
11
+ h(R);
12
12
  }
13
- }, L = (E) => {
13
+ }, b = (E) => {
14
14
  try {
15
15
  S(s.throw(E));
16
16
  } catch (R) {
17
- d(R);
17
+ h(R);
18
18
  }
19
- }, S = (E) => E.done ? i(E.value) : Promise.resolve(E.value).then(v, L);
20
- S((s = s.apply(n, t)).next());
19
+ }, S = (E) => E.done ? i(E.value) : Promise.resolve(E.value).then(w, b);
20
+ S((s = s.apply(a, t)).next());
21
21
  });
22
- var kt = (n, t, s) => (t = n[Pt("asyncIterator")]) ? t.call(n) : (n = n[Pt("iterator")](), t = {}, s = (i, d) => (d = n[i]) && (t[i] = (v) => new Promise((L, S, E) => (v = d.call(n, v), E = v.done, Promise.resolve(v.value).then((R) => L({ value: R, done: E }), S)))), s("next"), s("return"), t);
23
- import { i as Ht } from "../index-Bv9zgfdb.js";
24
- import { d as j } from "../events-CsVF98U6.js";
25
- import { r as Ft } from "../polyfills-DJrTJQky.js";
26
- import { w as Ot, s as Bt } from "../scroll-BWF48oHS.js";
22
+ var xt = (a, t, s) => (t = a[Ct("asyncIterator")]) ? t.call(a) : (a = a[Ct("iterator")](), t = {}, s = (i, h) => (h = a[i]) && (t[i] = (w) => new Promise((b, S, E) => (w = h.call(a, w), E = w.done, Promise.resolve(w.value).then((R) => b({ value: R, done: E }), S)))), s("next"), s("return"), t);
23
+ import { i as Dt } from "../index-Bv9zgfdb.js";
24
+ import { d as I } from "../events-CsVF98U6.js";
25
+ import { r as Wt } from "../polyfills-DJrTJQky.js";
26
+ import { w as Bt, s as Yt } from "../scroll-DNGJVxa2.js";
27
27
  import "construct-style-sheets-polyfill";
28
- import { n as Vt, c as Ct, s as Wt } from "../url-Cc-RVfii.js";
29
- import { cssValueParser as Ut } from "../css-value-parser/index.js";
30
- class Nt extends HTMLElement {
28
+ import { n as Xt, c as Mt, s as Ut } from "../url-Cc-RVfii.js";
29
+ import { cssValueParser as $t } from "../css-value-parser/index.js";
30
+ class Rt extends HTMLElement {
31
31
  connectedCallback() {
32
32
  const t = {
33
33
  "aria-live": "assertive",
@@ -38,192 +38,207 @@ class Nt extends HTMLElement {
38
38
  this.setAttribute(s, i);
39
39
  }
40
40
  }
41
- Ht && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Nt);
42
- var k, l, I, _, K;
43
- class dt {
41
+ Dt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Rt);
42
+ var C, l, V, et, $;
43
+ class pt {
44
44
  constructor(t, s) {
45
- a(this, k);
46
- a(this, l);
47
- a(this, I);
48
- a(this, _, (t) => {
45
+ o(this, C);
46
+ o(this, l);
47
+ o(this, V);
48
+ o(this, et, (t) => {
49
49
  var i;
50
- if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this, k).previousPathname)
50
+ if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this, C).previousPathname)
51
51
  history.back();
52
52
  else {
53
- const d = e(this, l).getAttribute(
53
+ const h = e(this, l).getAttribute(
54
54
  "data-history-action"
55
- ) || "push", v = e(this, l).hasAttribute("data-center-scroll"), L = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), S = L ? Ut.parse(L) : void 0, E = e(this, l).hasAttribute("data-revalidate"), R = e(this, l).hasAttribute(
55
+ ) || "push", w = e(this, l).hasAttribute("data-center-scroll"), b = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), S = b ? $t.parse(b) : void 0, E = e(this, l).hasAttribute("data-revalidate"), R = e(this, l).hasAttribute(
56
56
  "data-keep-search-parameters"
57
- ), ot = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((W) => W.trim()), f = e(this, l).hasAttribute("data-clear-state");
58
- e(this, k).navigate(e(this, I), {
59
- historyAction: d,
60
- centerScroll: v,
57
+ ), ht = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((Y) => Y.trim()), f = e(this, l).hasAttribute("data-clear-state");
58
+ e(this, C).navigate(e(this, V), {
59
+ historyAction: h,
60
+ centerScroll: w,
61
61
  offsetScroll: S,
62
62
  revalidate: E,
63
63
  keepSearchParameters: R,
64
- submorph: ot,
64
+ submorph: ht,
65
65
  clearState: f
66
66
  });
67
67
  }
68
68
  });
69
- a(this, K, () => {
69
+ o(this, $, () => {
70
70
  const t = e(this, l).hasAttribute("data-revalidate");
71
- e(this, k).prefetch(e(this, I), t), e(this, l).removeEventListener("pointerenter", e(this, K));
71
+ e(this, C).prefetch(e(this, V), t), e(this, l).removeEventListener("pointerenter", e(this, $));
72
72
  });
73
- o(this, k, s), o(this, l, t), o(this, I, e(this, l).getAttribute("href") || "/"), e(this, l).addEventListener("click", e(this, _)), this.checkCurrent(location.pathname), e(this, l).hasAttribute("data-prefetch") && e(this, l).addEventListener("pointerenter", e(this, K));
73
+ n(this, C, s), n(this, l, t), n(this, V, e(this, l).getAttribute("href") || "/"), e(this, l).addEventListener("click", e(this, et)), this.checkCurrent(location.pathname), e(this, l).hasAttribute("data-prefetch") && e(this, l).addEventListener("pointerenter", e(this, $));
74
74
  }
75
75
  get element() {
76
76
  return e(this, l);
77
77
  }
78
78
  checkCurrent(t) {
79
- const s = e(this, k).normalizePath(t), i = e(this, k).normalizePath(e(this, I));
79
+ const s = e(this, C).normalizePath(t), i = e(this, C).normalizePath(e(this, V));
80
80
  e(this, l).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? e(this, l).classList.add("current") : i.pathname === s.pathname ? e(this, l).classList.add("current") : e(this, l).classList.remove("current");
81
81
  }
82
82
  destroy() {
83
- e(this, l).removeEventListener("click", e(this, _)), e(this, l).removeEventListener("pointerenter", e(this, K)), e(this, l).classList.remove("current");
83
+ e(this, l).removeEventListener("click", e(this, et)), e(this, l).removeEventListener("pointerenter", e(this, $)), e(this, l).classList.remove("current");
84
84
  }
85
85
  }
86
- k = new WeakMap(), l = new WeakMap(), I = new WeakMap(), _ = new WeakMap(), K = new WeakMap();
87
- var H, Y, w, F, O, N, G;
88
- class Tt {
86
+ C = new WeakMap(), l = new WeakMap(), V = new WeakMap(), et = new WeakMap(), $ = new WeakMap();
87
+ var M, j, L, F, O, H, K;
88
+ class Ht {
89
89
  constructor(t, s, i) {
90
- a(this, H);
91
- a(this, Y);
92
- a(this, w, { x: 0, y: 0 });
93
- a(this, F);
94
- a(this, O, null);
95
- a(this, N, null);
96
- a(this, G, null);
97
- o(this, H, t), o(this, Y, s), o(this, F, i.cloneNode(!0));
90
+ o(this, M);
91
+ o(this, j);
92
+ o(this, L, { x: 0, y: 0 });
93
+ o(this, F);
94
+ o(this, O, null);
95
+ o(this, H, null);
96
+ o(this, K, null);
97
+ n(this, M, t), n(this, j, s), n(this, F, i.cloneNode(!0));
98
98
  }
99
99
  get pathname() {
100
- return e(this, Y);
100
+ return e(this, j);
101
101
  }
102
102
  get scrollState() {
103
- return e(this, w);
103
+ return e(this, L);
104
104
  }
105
105
  get document() {
106
- return e(this, N);
106
+ return e(this, H);
107
107
  }
108
108
  cloneDocument() {
109
- o(this, N, (e(this, O) || e(this, F)).cloneNode(!0));
109
+ n(this, H, (e(this, O) || e(this, F)).cloneNode(!0));
110
110
  }
111
111
  get title() {
112
112
  let t = "";
113
- if (e(this, N).title)
114
- t = e(this, N).title;
113
+ if (e(this, H).title)
114
+ t = e(this, H).title;
115
115
  else {
116
- const s = e(this, N).querySelector("h1");
117
- t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, Y);
116
+ const s = e(this, H).querySelector("h1");
117
+ t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, j);
118
118
  }
119
119
  return t;
120
120
  }
121
121
  clearScrollState() {
122
- e(this, w).x = 0, e(this, w).y = 0;
122
+ e(this, L).x = 0, e(this, L).y = 0;
123
123
  }
124
124
  clearDocumentState() {
125
- o(this, O, null);
125
+ n(this, O, null);
126
126
  }
127
127
  saveScrollState() {
128
128
  e(this, F).documentElement.hasAttribute(
129
129
  "data-no-scroll-restoration"
130
- ) ? (e(this, w).x = 0, e(this, w).y = 0) : (e(this, w).x = e(this, H).scrollElement.scrollLeft, e(this, w).y = e(this, H).scrollElement.scrollTop);
130
+ ) ? (e(this, L).x = 0, e(this, L).y = 0) : (e(this, L).x = e(this, M).scrollValue.left, e(this, L).y = e(this, M).scrollValue.top);
131
131
  }
132
132
  restoreScrollPosition() {
133
- e(this, H).scrollElement.scroll({
134
- top: e(this, w).y,
135
- left: e(this, w).x,
133
+ e(this, M).scrollElement.scroll({
134
+ top: e(this, L).y,
135
+ left: e(this, L).x,
136
136
  behavior: "instant"
137
137
  });
138
138
  }
139
139
  saveDocumentState() {
140
140
  e(this, F).documentElement.hasAttribute(
141
141
  "data-no-page-restoration"
142
- ) ? o(this, O, null) : o(this, O, document.cloneNode(!0));
142
+ ) ? n(this, O, null) : n(this, O, document.cloneNode(!0));
143
143
  }
144
144
  renewScrollPosition() {
145
- e(this, H).scrollElement.scroll({
145
+ e(this, M).scrollElement.scroll({
146
146
  top: 0,
147
147
  left: 0,
148
148
  behavior: "instant"
149
149
  });
150
150
  }
151
151
  saveState(t) {
152
- o(this, G, t);
152
+ n(this, K, t);
153
153
  }
154
154
  clearState() {
155
- const t = e(this, G);
156
- return o(this, G, null), t;
155
+ const t = e(this, K);
156
+ return n(this, K, null), t;
157
157
  }
158
158
  }
159
- H = new WeakMap(), Y = new WeakMap(), w = new WeakMap(), F = new WeakMap(), O = new WeakMap(), N = new WeakMap(), G = new WeakMap();
160
- var C, J, p, nt, x, u, tt, B, T, P, D, V, et, h, rt, xt, mt, Dt, ft, pt, Et, gt, at, Q;
161
- const Z = class Z {
159
+ M = new WeakMap(), j = new WeakMap(), L = new WeakMap(), F = new WeakMap(), O = new WeakMap(), H = new WeakMap(), K = new WeakMap();
160
+ var k, G, p, lt, N, d, st, W, T, P, it, D, B, J, Q, rt, c, ot, qt, Et, zt, gt, St, wt, vt, ct, Z;
161
+ const tt = class tt {
162
162
  constructor(t) {
163
- a(this, h);
164
- a(this, C, null);
165
- a(this, J, null);
166
- a(this, p, []);
167
- a(this, nt, new DOMParser());
168
- a(this, x);
169
- a(this, u, null);
170
- a(this, tt);
171
- a(this, B, []);
172
- a(this, T, !1);
173
- a(this, P, null);
174
- a(this, D, /* @__PURE__ */ new Map());
175
- a(this, V, null);
176
- a(this, et, (t) => {
163
+ o(this, c);
164
+ o(this, k, null);
165
+ o(this, G, null);
166
+ o(this, p, []);
167
+ o(this, lt, new DOMParser());
168
+ o(this, N);
169
+ o(this, d, null);
170
+ o(this, st);
171
+ o(this, W, []);
172
+ o(this, T, !1);
173
+ o(this, P, null);
174
+ o(this, it, !1);
175
+ o(this, D, /* @__PURE__ */ new Map());
176
+ o(this, B, null);
177
+ o(this, J, 0);
178
+ o(this, Q, 0);
179
+ o(this, rt, (t) => {
177
180
  var s;
178
181
  return ((s = t.getAttribute("href")) == null ? void 0 : s.startsWith("/")) && !t.hasAttribute("download") && !t.hasAttribute("data-morph-skip") && !t.closest("[data-morph-skip]") && t.getAttribute("target") !== "_blank";
179
182
  });
180
- a(this, at, (t) => z(this, null, function* () {
183
+ o(this, ct, (t) => z(this, null, function* () {
181
184
  var s;
182
- (s = t.state) != null && s.path && (t.preventDefault(), o(this, T, !0), yield this.navigate(t.state.path, { historyAction: "none" }), o(this, T, !1));
185
+ (s = t.state) != null && s.path && (t.preventDefault(), n(this, T, !0), yield this.navigate(t.state.path, { historyAction: "none" }), n(this, T, !1));
183
186
  }));
184
- a(this, Q, () => {
185
- const t = e(this, P).scrollTop, s = e(this, P).scrollLeft;
186
- document.documentElement.classList.toggle("top-scrolled", t > 0), document.documentElement.classList.toggle("left-scrolled", s > 0), j(document, "morphScroll", {
187
+ o(this, Z, () => {
188
+ const { left: t, top: s } = this.scrollValue, i = s - e(this, Q), h = t - e(this, J);
189
+ n(this, Q, s), n(this, J, t), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", t > 0), document.documentElement.classList.toggle(
190
+ "scroll-y-forward",
191
+ i > 0
192
+ ), document.documentElement.classList.toggle(
193
+ "scroll-y-backward",
194
+ i < 0
195
+ ), document.documentElement.classList.toggle(
196
+ "scroll-x-forward",
197
+ h > 0
198
+ ), document.documentElement.classList.toggle(
199
+ "scroll-x-backward",
200
+ h < 0
201
+ ), I(document, "morphScroll", {
187
202
  detail: {
188
- left: s,
189
- top: t
203
+ left: t,
204
+ top: s
190
205
  }
191
206
  });
192
207
  });
193
- if (Ht && !Z.instance) {
194
- Z.instance = this, o(this, C, {
195
- base: Vt(t == null ? void 0 : t.base),
208
+ if (Dt && !tt.instance) {
209
+ tt.instance = this, n(this, k, {
210
+ base: Xt(t == null ? void 0 : t.base),
196
211
  waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
197
212
  cachePages: (t == null ? void 0 : t.cachePages) !== !1,
198
213
  trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
199
- scrollSelector: (t == null ? void 0 : t.scrollSelector) || "body",
214
+ scrollSelector: t == null ? void 0 : t.scrollSelector,
200
215
  morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
201
- }), o(this, J, m(this, h, mt).call(this, document.body));
216
+ }), n(this, G, m(this, c, Et).call(this, document.body));
202
217
  const s = this.normalizePath(
203
218
  location.pathname + location.hash
204
219
  );
205
- o(this, u, s.pathname), e(this, D).set(
206
- e(this, u),
207
- new Tt(this, e(this, u), document)
220
+ n(this, d, s.pathname), e(this, D).set(
221
+ e(this, d),
222
+ new Ht(this, e(this, d), document)
208
223
  ), document.documentElement.setAttribute(
209
224
  "data-current-pathname",
210
- e(this, u)
225
+ e(this, d)
211
226
  ), document.documentElement.setAttribute(
212
227
  "data-current-leaf",
213
228
  s.leaf
214
- ), this.findLinks(), addEventListener("popstate", e(this, at)), Ct({
229
+ ), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, ct)), Mt({
215
230
  action: "replace",
216
- pathname: e(this, u),
231
+ pathname: e(this, d),
217
232
  searchParameters: s.parameters || location.search,
218
233
  hash: s.hash
219
- }), o(this, V, new Nt()), m(this, h, Et).call(this, document);
234
+ }), n(this, B, new Rt()), m(this, c, wt).call(this, document);
220
235
  }
221
236
  }
222
237
  get currentPathname() {
223
- return e(this, u);
238
+ return e(this, d);
224
239
  }
225
240
  get previousPathname() {
226
- return e(this, tt);
241
+ return e(this, st);
227
242
  }
228
243
  get links() {
229
244
  return e(this, p);
@@ -234,24 +249,28 @@ const Z = class Z {
234
249
  get isPopstateNavigation() {
235
250
  return e(this, T);
236
251
  }
252
+ get scrollValue() {
253
+ let t = 0, s = 0;
254
+ return e(this, it) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, P).scrollTop, s = e(this, P).scrollLeft), { top: t, left: s };
255
+ }
237
256
  saveState(t) {
238
- const s = e(this, D).get(e(this, u));
257
+ const s = e(this, D).get(e(this, d));
239
258
  s && s.saveState(t);
240
259
  }
241
260
  getState() {
242
- const t = e(this, D).get(e(this, u));
261
+ const t = e(this, D).get(e(this, d));
243
262
  return t == null ? void 0 : t.clearState();
244
263
  }
245
264
  normalizePath(t) {
246
- return Wt(t, {
247
- base: e(this, C).base,
248
- trailingSlash: e(this, C).trailingSlash
265
+ return Ut(t, {
266
+ base: e(this, k).base,
267
+ trailingSlash: e(this, k).trailingSlash
249
268
  });
250
269
  }
251
270
  prefetch(t, s) {
252
271
  return z(this, null, function* () {
253
272
  const i = this.normalizePath(t);
254
- m(this, h, rt).call(this, i.pathname, {
273
+ m(this, c, ot).call(this, i.pathname, {
255
274
  searchParameters: i.parameters,
256
275
  revalidate: s
257
276
  });
@@ -261,30 +280,30 @@ const Z = class Z {
261
280
  return z(this, arguments, function* (t, {
262
281
  historyAction: s = "push",
263
282
  centerScroll: i,
264
- offsetScroll: d,
265
- revalidate: v,
266
- keepSearchParameters: L,
283
+ offsetScroll: h,
284
+ revalidate: w,
285
+ keepSearchParameters: b,
267
286
  submorph: S,
268
287
  clearState: E
269
288
  } = {}) {
270
- var vt;
271
- if (e(this, B).length)
289
+ var Lt;
290
+ if (e(this, W).length)
272
291
  return;
273
- const ot = this.normalizePath(((vt = this.pathnameModifier) == null ? void 0 : vt.call(this, t)) || t);
274
- let { pathname: f, hash: W, parameters: St, leaf: Rt } = ot;
275
- if (e(this, x) === f || e(this, u) === f) {
276
- e(this, T) || m(this, h, gt).call(this, W || 0, {
292
+ const ht = this.normalizePath(((Lt = this.pathnameModifier) == null ? void 0 : Lt.call(this, t)) || t);
293
+ let { pathname: f, hash: Y, parameters: yt, leaf: It } = ht;
294
+ if (e(this, N) === f || e(this, d) === f) {
295
+ e(this, T) || m(this, c, vt).call(this, Y || 0, {
277
296
  centerScroll: i,
278
- offsetScroll: d,
297
+ offsetScroll: h,
279
298
  behavior: "smooth"
280
299
  });
281
300
  return;
282
301
  }
283
- o(this, x, f), e(this, p).forEach((U) => {
284
- U.checkCurrent(f);
302
+ n(this, N, f), e(this, p).forEach((X) => {
303
+ X.checkCurrent(f);
285
304
  });
286
305
  try {
287
- let U = !0;
306
+ let X = !0;
288
307
  if (this.preprocessor)
289
308
  try {
290
309
  yield new Promise((r, A) => {
@@ -297,140 +316,142 @@ const Z = class Z {
297
316
  });
298
317
  });
299
318
  } catch (r) {
300
- r ? console.error(r) : console.log("Route change canceled"), U = !1;
319
+ r ? console.error(r) : console.log("Route change canceled"), X = !1;
301
320
  }
302
- if (!U || e(this, x) !== f) {
321
+ if (!X || e(this, N) !== f) {
303
322
  e(this, p).forEach((r) => {
304
- r.checkCurrent(e(this, u));
323
+ r.checkCurrent(e(this, d));
305
324
  });
306
325
  return;
307
326
  }
308
- const lt = {
327
+ const ut = {
309
328
  pathname: f,
310
329
  submorph: S
311
330
  };
312
- j(document, "morphNavigation", {
313
- detail: lt
331
+ I(document, "morphNavigation", {
332
+ detail: ut
314
333
  });
315
- const ht = yield m(this, h, rt).call(this, e(this, u)), b = yield m(this, h, rt).call(this, f, {
316
- searchParameters: St,
317
- revalidate: v
334
+ const dt = yield m(this, c, ot).call(this, e(this, d)), v = yield m(this, c, ot).call(this, f, {
335
+ searchParameters: yt,
336
+ revalidate: w
318
337
  });
319
- if (e(this, x) !== f) {
338
+ if (e(this, N) !== f) {
320
339
  e(this, p).forEach((r) => {
321
- r.checkCurrent(e(this, u));
340
+ r.checkCurrent(e(this, d));
322
341
  });
323
342
  return;
324
343
  }
325
- ht.clearState(), ht.saveScrollState(), ht.saveDocumentState(), e(this, T) || (b.clearScrollState(), b.clearDocumentState()), E && b.clearState(), b.cloneDocument(), e(this, V).textContent = b.title, document.body.appendChild(e(this, V)), j(document, "morphStart", {
326
- detail: lt
344
+ dt.clearState(), dt.saveScrollState(), dt.saveDocumentState(), e(this, T) || (v.clearScrollState(), v.clearDocumentState()), E && v.clearState(), v.cloneDocument(), e(this, B).textContent = v.title, document.body.appendChild(e(this, B)), I(document, "morphStart", {
345
+ detail: ut
327
346
  });
328
- const yt = Array.from(document.head.children), wt = Array.from(b.document.head.children), Lt = m(this, h, Dt).call(this, yt, wt), qt = m(this, h, ft).call(this, yt, Lt), st = m(this, h, ft).call(this, wt, Lt);
329
- st.forEach((r, A) => {
347
+ const bt = Array.from(document.head.children), Pt = Array.from(v.document.head.children), kt = m(this, c, zt).call(this, bt, Pt), Vt = m(this, c, gt).call(this, bt, kt), nt = m(this, c, gt).call(this, Pt, kt);
348
+ nt.forEach((r, A) => {
330
349
  if (r.tagName === "SCRIPT" && r.getAttribute("src")) {
331
350
  const y = document.createElement("script");
332
- y.type = "module", y.src = r.getAttribute("src"), st[A] = y;
351
+ y.type = "module", y.src = r.getAttribute("src"), nt[A] = y;
333
352
  }
334
- }), st.forEach((r) => {
353
+ }), nt.forEach((r) => {
335
354
  document.head.appendChild(r);
336
355
  });
337
- const ct = st.filter((r) => {
356
+ const mt = nt.filter((r) => {
338
357
  if (r.hasAttribute("data-no-waiting"))
339
358
  return !1;
340
- if (m(this, h, pt).call(this, r))
359
+ if (m(this, c, St).call(this, r))
341
360
  return !0;
342
361
  });
343
- e(this, C).waitForHeadToLoad && ct.length && (yield new Promise((r) => z(this, null, function* () {
362
+ e(this, k).waitForHeadToLoad && mt.length && (yield new Promise((r) => z(this, null, function* () {
344
363
  let A = 0;
345
364
  try {
346
- for (var y = kt(ct), X, q, $; X = !(q = yield y.next()).done; X = !1) {
347
- const it = q.value;
348
- it.onload = () => {
349
- A++, A === ct.length && r();
365
+ for (var y = xt(mt), _, q, U; _ = !(q = yield y.next()).done; _ = !1) {
366
+ const at = q.value;
367
+ at.onload = () => {
368
+ A++, A === mt.length && r();
350
369
  };
351
370
  }
352
371
  } catch (q) {
353
- $ = [q];
372
+ U = [q];
354
373
  } finally {
355
374
  try {
356
- X && (q = y.return) && (yield q.call(y));
375
+ _ && (q = y.return) && (yield q.call(y));
357
376
  } finally {
358
- if ($)
359
- throw $[0];
377
+ if (U)
378
+ throw U[0];
360
379
  }
361
380
  }
362
- }))), yield Ot(10);
363
- const bt = [];
364
- qt.forEach((r) => {
365
- r.hasAttribute("data-permanent") || (m(this, h, pt).call(this, r) ? bt.push(r) : r.remove());
381
+ }))), yield Bt(10);
382
+ const At = [];
383
+ Vt.forEach((r) => {
384
+ r.hasAttribute("data-permanent") || (m(this, c, St).call(this, r) ? At.push(r) : r.remove());
366
385
  });
367
- const zt = m(this, h, mt).call(this, b.document.body);
368
- e(this, C).morphInsideScrollContainer || m(this, h, Et).call(this, b.document), document.documentElement.setAttribute("data-current-pathname", f), document.documentElement.setAttribute("data-current-leaf", Rt), Ct({
386
+ const Ft = m(this, c, Et).call(this, v.document.body);
387
+ e(this, k).morphInsideScrollContainer || m(this, c, wt).call(this, v.document), document.documentElement.setAttribute("data-current-pathname", f), document.documentElement.setAttribute("data-current-leaf", It), Mt({
369
388
  action: s,
370
389
  pathname: f,
371
- searchParameters: St || (L ? location.search : ""),
372
- hash: W
373
- }), e(this, V).remove(), o(this, tt, e(this, u)), o(this, u, f), e(this, J).forEach((r, A) => {
374
- const y = zt[A], X = getComputedStyle(r).getPropertyValue("--morph-duration");
375
- let q = [], $ = [];
376
- S ? S.forEach((c) => {
377
- const g = r.querySelector(c), M = y.querySelector(c);
378
- g && M && ($.push(g), q.push(M));
379
- }) : (q.push(...y.childNodes), $.push(...r.childNodes)), $.forEach((c) => {
380
- c instanceof HTMLElement && (this.destroyOldLinks(c), c.classList.add("old"));
381
- }), q.forEach((c) => {
382
- c instanceof HTMLElement && (this.findNewLinks(c), c.classList.add("new"));
383
- }), S ? q.forEach((c, g) => {
384
- var M;
385
- (M = $[g].parentElement) == null || M.insertBefore(
386
- c,
387
- $[g]
390
+ searchParameters: yt || (b ? location.search : ""),
391
+ hash: Y
392
+ }), e(this, B).remove(), n(this, st, e(this, d)), n(this, d, f), e(this, G).forEach((r, A) => {
393
+ const y = Ft[A], _ = getComputedStyle(r).getPropertyValue("--morph-duration");
394
+ let q = [], U = [];
395
+ S ? S.forEach((u) => {
396
+ const g = r.querySelector(u), x = y.querySelector(u);
397
+ g && x && (U.push(g), q.push(x));
398
+ }) : (q.push(...y.childNodes), U.push(...r.childNodes)), U.forEach((u) => {
399
+ u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
400
+ }), q.forEach((u) => {
401
+ u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
402
+ }), S ? q.forEach((u, g) => {
403
+ var x;
404
+ (x = U[g].parentElement) == null || x.insertBefore(
405
+ u,
406
+ U[g]
388
407
  );
389
- }) : r.prepend(...q), Ft(() => {
390
- q.forEach((c) => {
408
+ }) : r.prepend(...q), Wt(() => {
409
+ q.forEach((u) => {
391
410
  var g;
392
- c instanceof HTMLElement && ((g = c.parentElement) == null || g.style.setProperty(
411
+ u instanceof HTMLElement && ((g = u.parentElement) == null || g.style.setProperty(
393
412
  "--new-content-height",
394
- c.offsetHeight + "px"
395
- ), c.classList.add("in"));
413
+ u.offsetHeight + "px"
414
+ ), u.classList.add("in"));
396
415
  });
397
416
  });
398
- const it = {
417
+ const at = {
399
418
  morphElement: r,
400
419
  pathname: f
401
420
  };
402
- j(document, "morphNewChildrenAdded", {
403
- detail: it
421
+ I(document, "morphNewChildrenAdded", {
422
+ detail: at
404
423
  });
405
- const It = new Promise((c) => {
424
+ const Ot = new Promise((u) => {
406
425
  setTimeout(() => {
407
- $.forEach((g) => g.remove()), q.forEach((g) => {
408
- var M;
409
- g instanceof HTMLElement && ((M = g.parentElement) == null || M.style.removeProperty(
426
+ U.forEach((g) => g.remove()), q.forEach((g) => {
427
+ var x;
428
+ g instanceof HTMLElement && ((x = g.parentElement) == null || x.style.removeProperty(
410
429
  "--new-content-height"
411
430
  ), g.classList.remove("in", "new"));
412
- }), j(document, "morphOldChildrenRemoved", {
413
- detail: it
414
- }), c();
415
- }, (parseFloat(X) || 0) * 1e3 + 10);
431
+ }), I(document, "morphOldChildrenRemoved", {
432
+ detail: at
433
+ }), u();
434
+ }, (parseFloat(_) || 0) * 1e3 + 10);
416
435
  });
417
- e(this, B).push(It);
418
- }), W ? (b.clearScrollState(), m(this, h, gt).call(this, W, { centerScroll: i, offsetScroll: d })) : e(this, T) ? b.restoreScrollPosition() : b.renewScrollPosition(), yield Promise.all(e(this, B)), bt.forEach((r) => r.remove()), o(this, B, []), e(this, J).forEach((r) => {
436
+ e(this, W).push(Ot);
437
+ }), Y ? (v.clearScrollState(), m(this, c, vt).call(this, Y, { centerScroll: i, offsetScroll: h })) : e(this, T) ? v.restoreScrollPosition() : v.renewScrollPosition(), I(document, "morphNavigationScroll", {
438
+ detail: v.scrollState
439
+ }), yield Promise.all(e(this, W)), At.forEach((r) => r.remove()), n(this, W, []), e(this, G).forEach((r) => {
419
440
  r.querySelectorAll("script").forEach((y) => {
420
- const X = document.createElement("script");
421
- X.type = "module", X.src = y.getAttribute("src"), y.replaceWith(X);
441
+ const _ = document.createElement("script");
442
+ _.type = "module", _.src = y.getAttribute("src"), y.replaceWith(_);
422
443
  });
423
- }), j(document, "morphComplete", {
424
- detail: lt
444
+ }), I(document, "morphComplete", {
445
+ detail: ut
425
446
  }), window.dispatchEvent(new Event("resize"));
426
- } catch (U) {
427
- console.error(U);
447
+ } catch (X) {
448
+ console.error(X);
428
449
  }
429
- o(this, x, void 0);
450
+ n(this, N, void 0);
430
451
  });
431
452
  }
432
453
  addLink(t) {
433
- e(this, p).push(new dt(t, this));
454
+ e(this, p).push(new pt(t, this));
434
455
  }
435
456
  addLinks(t) {
436
457
  t.forEach((s) => {
@@ -438,71 +459,71 @@ const Z = class Z {
438
459
  });
439
460
  }
440
461
  removeLink(t) {
441
- o(this, p, e(this, p).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
462
+ n(this, p, e(this, p).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
442
463
  }
443
464
  destroyOldLinks(t) {
444
- o(this, p, e(this, p).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
465
+ n(this, p, e(this, p).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
445
466
  }
446
467
  findNewLinks(t) {
447
468
  const s = [...t.querySelectorAll("a")].filter(
448
- e(this, et)
469
+ e(this, rt)
449
470
  );
450
471
  e(this, p).push(
451
- ...s.map((i) => new dt(i, this))
472
+ ...s.map((i) => new pt(i, this))
452
473
  );
453
474
  }
454
475
  findLinks() {
455
476
  const t = [
456
477
  ...document.documentElement.querySelectorAll("a")
457
- ].filter(e(this, et));
458
- e(this, p).forEach((s) => s.destroy()), o(this, p, t.map((s) => new dt(s, this)));
478
+ ].filter(e(this, rt));
479
+ e(this, p).forEach((s) => s.destroy()), n(this, p, t.map((s) => new pt(s, this)));
459
480
  }
460
481
  };
461
- C = new WeakMap(), J = new WeakMap(), p = new WeakMap(), nt = new WeakMap(), x = new WeakMap(), u = new WeakMap(), tt = new WeakMap(), B = new WeakMap(), T = new WeakMap(), P = new WeakMap(), D = new WeakMap(), V = new WeakMap(), et = new WeakMap(), h = new WeakSet(), rt = function(t, s) {
482
+ k = new WeakMap(), G = new WeakMap(), p = new WeakMap(), lt = new WeakMap(), N = new WeakMap(), d = new WeakMap(), st = new WeakMap(), W = new WeakMap(), T = new WeakMap(), P = new WeakMap(), it = new WeakMap(), D = new WeakMap(), B = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), rt = new WeakMap(), c = new WeakSet(), ot = function(t, s) {
462
483
  return z(this, null, function* () {
463
484
  let i = e(this, D).get(t);
464
- return (!i || s != null && s.revalidate) && (i = yield m(this, h, xt).call(this, t, s == null ? void 0 : s.searchParameters)), i;
485
+ return (!i || s != null && s.revalidate) && (i = yield m(this, c, qt).call(this, t, s == null ? void 0 : s.searchParameters)), i;
465
486
  });
466
- }, xt = function(t, s) {
487
+ }, qt = function(t, s) {
467
488
  return z(this, null, function* () {
468
- const d = yield (yield fetch(
489
+ const h = yield (yield fetch(
469
490
  `${t}${s ? "?" + s : ""}`
470
- )).text(), v = e(this, nt).parseFromString(d, "text/html"), L = new Tt(this, t, v);
471
- return e(this, D).set(t, L), L;
491
+ )).text(), w = e(this, lt).parseFromString(h, "text/html"), b = new Ht(this, t, w);
492
+ return e(this, D).set(t, b), b;
472
493
  });
473
- }, mt = function(t) {
494
+ }, Et = function(t) {
474
495
  const s = [...t.querySelectorAll("[data-morph]")];
475
496
  return s.length ? s : [t];
476
- }, Dt = function(t, s) {
497
+ }, zt = function(t, s) {
477
498
  return t.filter(
478
499
  (i) => s.find(
479
- (d) => d.outerHTML === i.outerHTML
500
+ (h) => h.outerHTML === i.outerHTML
480
501
  )
481
502
  );
482
- }, ft = function(t, s) {
503
+ }, gt = function(t, s) {
483
504
  return t.filter(
484
505
  (i) => !s.find(
485
- (d) => d.outerHTML === i.outerHTML
506
+ (h) => h.outerHTML === i.outerHTML
486
507
  )
487
508
  );
488
- }, pt = function(t) {
509
+ }, St = function(t) {
489
510
  return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
490
- }, Et = function(t) {
511
+ }, wt = function(t) {
491
512
  var s, i;
492
513
  (s = e(this, P)) == null || s.removeEventListener(
493
514
  "scroll",
494
- e(this, Q)
495
- ), o(this, P, t.querySelector(e(this, C).scrollSelector) || t.documentElement), (i = e(this, P)) == null || i.addEventListener("scroll", e(this, Q)), e(this, Q).call(this);
496
- }, gt = function(t, s) {
515
+ e(this, Z)
516
+ ), n(this, Q, 0), n(this, J, 0), n(this, P, e(this, k).scrollSelector && t.querySelector(e(this, k).scrollSelector) || window), n(this, it, e(this, P) === window), (i = e(this, P)) == null || i.addEventListener("scroll", e(this, Z)), e(this, Z).call(this);
517
+ }, vt = function(t, s) {
497
518
  const i = typeof t == "string" ? document.getElementById(t) : t;
498
- (typeof i == "number" || i) && Bt(i, {
519
+ (typeof i == "number" || i) && Yt(i, {
499
520
  scrollElement: e(this, P),
500
521
  behavior: (s == null ? void 0 : s.behavior) || "instant",
501
522
  center: s == null ? void 0 : s.centerScroll,
502
523
  offset: s == null ? void 0 : s.offsetScroll
503
524
  });
504
- }, at = new WeakMap(), Q = new WeakMap(), Z.instance = null;
505
- let Mt = Z;
525
+ }, ct = new WeakMap(), Z = new WeakMap(), tt.instance = null;
526
+ let Nt = tt;
506
527
  export {
507
- Mt as Morph
528
+ Nt as Morph
508
529
  };