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