@noego/forge 0.0.4 → 0.0.6

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/client.mjs CHANGED
@@ -1,185 +1,458 @@
1
- import { p as S } from "./index-DFgPI13E.js";
2
- import { updateRoute as m, loadRoute as L } from "../src/client/navigation.svelte";
3
- import { loadRoute as W, updateRoute as z } from "../src/client/navigation.svelte";
4
- import { MANIFEST_STORE as g, updateManifestStore as R } from "../src/routing/manifest/store.svelte";
5
- import { MANIFEST_STORE as B, updateManifestStore as Y } from "../src/routing/manifest/store.svelte";
6
- import { page as h } from "../src/client/page.svelte";
7
- import { page as J, shadowUrl as K } from "../src/client/page.svelte";
8
- function U(c) {
9
- const l = new S(c);
10
- return (i) => l.match(i) || null;
11
- }
12
- function q(c) {
13
- return c.map((l) => {
14
- const i = l.path, r = U(i);
15
- return { pattern: i, parser: r };
1
+ import { p as G, a as y } from "./page.svelte-C4chAYK2.js";
2
+ import { s as vt } from "./page.svelte-C4chAYK2.js";
3
+ import * as B from "svelte/internal/client";
4
+ import { hydrate as Y } from "svelte";
5
+ import J from "../src/components/RecursiveRender.svelte";
6
+ function K(t) {
7
+ const a = new G(t);
8
+ return (o) => a.match(o) || null;
9
+ }
10
+ function Q(t) {
11
+ return t.map((a) => {
12
+ const o = a.path, n = K(o);
13
+ return { pattern: o, parser: n };
16
14
  });
17
15
  }
18
- function j(c, l, i) {
16
+ function A() {
17
+ return A = Object.assign ? Object.assign.bind() : function(t) {
18
+ for (var a = 1; a < arguments.length; a++) {
19
+ var o = arguments[a];
20
+ for (var n in o) ({}).hasOwnProperty.call(o, n) && (t[n] = o[n]);
21
+ }
22
+ return t;
23
+ }, A.apply(null, arguments);
24
+ }
25
+ var O;
26
+ (function(t) {
27
+ t.Pop = "POP", t.Push = "PUSH", t.Replace = "REPLACE";
28
+ })(O || (O = {}));
29
+ var F = process.env.NODE_ENV !== "production" ? function(t) {
30
+ return Object.freeze(t);
31
+ } : function(t) {
32
+ return t;
33
+ };
34
+ function X(t, a) {
35
+ {
36
+ typeof console < "u" && console.warn(a);
37
+ try {
38
+ throw new Error(a);
39
+ } catch {
40
+ }
41
+ }
42
+ }
43
+ var I = "beforeunload", Z = "popstate";
44
+ function tt(t) {
45
+ t === void 0 && (t = {});
46
+ var a = t, o = a.window, n = o === void 0 ? document.defaultView : o, i = n.history;
47
+ function s() {
48
+ var f = n.location, h = f.pathname, g = f.search, P = f.hash, b = i.state || {};
49
+ return [b.idx, F({
50
+ pathname: h,
51
+ search: g,
52
+ hash: P,
53
+ state: b.usr || null,
54
+ key: b.key || "default"
55
+ })];
56
+ }
57
+ var c = null;
58
+ function r() {
59
+ if (c)
60
+ p.call(c), c = null;
61
+ else {
62
+ var f = O.Pop, h = s(), g = h[0], P = h[1];
63
+ if (p.length)
64
+ if (g != null) {
65
+ var b = u - g;
66
+ b && (c = {
67
+ action: f,
68
+ location: P,
69
+ retry: function() {
70
+ L(b * -1);
71
+ }
72
+ }, L(b));
73
+ } else
74
+ process.env.NODE_ENV !== "production" && X(
75
+ !1,
76
+ // TODO: Write up a doc that explains our blocking strategy in
77
+ // detail and link to it here so people can understand better what
78
+ // is going on and how to avoid it.
79
+ "You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
80
+ );
81
+ else
82
+ E(f);
83
+ }
84
+ }
85
+ n.addEventListener(Z, r);
86
+ var e = O.Pop, l = s(), u = l[0], w = l[1], d = W(), p = W();
87
+ u == null && (u = 0, i.replaceState(A({}, i.state, {
88
+ idx: u
89
+ }), ""));
90
+ function v(f) {
91
+ return typeof f == "string" ? f : nt(f);
92
+ }
93
+ function S(f, h) {
94
+ return h === void 0 && (h = null), F(A({
95
+ pathname: w.pathname,
96
+ hash: "",
97
+ search: ""
98
+ }, typeof f == "string" ? ot(f) : f, {
99
+ state: h,
100
+ key: et()
101
+ }));
102
+ }
103
+ function R(f, h) {
104
+ return [{
105
+ usr: f.state,
106
+ key: f.key,
107
+ idx: h
108
+ }, v(f)];
109
+ }
110
+ function j(f, h, g) {
111
+ return !p.length || (p.call({
112
+ action: f,
113
+ location: h,
114
+ retry: g
115
+ }), !1);
116
+ }
117
+ function E(f) {
118
+ e = f;
119
+ var h = s();
120
+ u = h[0], w = h[1], d.call({
121
+ action: e,
122
+ location: w
123
+ });
124
+ }
125
+ function H(f, h) {
126
+ var g = O.Push, P = S(f, h);
127
+ function b() {
128
+ H(f, h);
129
+ }
130
+ if (j(g, P, b)) {
131
+ var _ = R(P, u + 1), x = _[0], U = _[1];
132
+ try {
133
+ i.pushState(x, "", U);
134
+ } catch {
135
+ n.location.assign(U);
136
+ }
137
+ E(g);
138
+ }
139
+ }
140
+ function D(f, h) {
141
+ var g = O.Replace, P = S(f, h);
142
+ function b() {
143
+ D(f, h);
144
+ }
145
+ if (j(g, P, b)) {
146
+ var _ = R(P, u), x = _[0], U = _[1];
147
+ i.replaceState(x, "", U), E(g);
148
+ }
149
+ }
150
+ function L(f) {
151
+ i.go(f);
152
+ }
153
+ var z = {
154
+ get action() {
155
+ return e;
156
+ },
157
+ get location() {
158
+ return w;
159
+ },
160
+ createHref: v,
161
+ push: H,
162
+ replace: D,
163
+ go: L,
164
+ back: function() {
165
+ L(-1);
166
+ },
167
+ forward: function() {
168
+ L(1);
169
+ },
170
+ listen: function(h) {
171
+ return d.push(h);
172
+ },
173
+ block: function(h) {
174
+ var g = p.push(h);
175
+ return p.length === 1 && n.addEventListener(I, M), function() {
176
+ g(), p.length || n.removeEventListener(I, M);
177
+ };
178
+ }
179
+ };
180
+ return z;
181
+ }
182
+ function M(t) {
183
+ t.preventDefault(), t.returnValue = "";
184
+ }
185
+ function W() {
186
+ var t = [];
187
+ return {
188
+ get length() {
189
+ return t.length;
190
+ },
191
+ push: function(o) {
192
+ return t.push(o), function() {
193
+ t = t.filter(function(n) {
194
+ return n !== o;
195
+ });
196
+ };
197
+ },
198
+ call: function(o) {
199
+ t.forEach(function(n) {
200
+ return n && n(o);
201
+ });
202
+ }
203
+ };
204
+ }
205
+ function et() {
206
+ return Math.random().toString(36).substr(2, 8);
207
+ }
208
+ function nt(t) {
209
+ var a = t.pathname, o = a === void 0 ? "/" : a, n = t.search, i = n === void 0 ? "" : n, s = t.hash, c = s === void 0 ? "" : s;
210
+ return i && i !== "?" && (o += i.charAt(0) === "?" ? i : "?" + i), c && c !== "#" && (o += c.charAt(0) === "#" ? c : "#" + c), o;
211
+ }
212
+ function ot(t) {
213
+ var a = {};
214
+ if (t) {
215
+ var o = t.indexOf("#");
216
+ o >= 0 && (a.hash = t.substr(o), t = t.substr(0, o));
217
+ var n = t.indexOf("?");
218
+ n >= 0 && (a.search = t.substr(n), t = t.substr(0, n)), t && (a.pathname = t);
219
+ }
220
+ return a;
221
+ }
222
+ const rt = tt(), m = B.proxy({
223
+ layouts: [],
224
+ view: null,
225
+ data: null,
226
+ params: null,
227
+ urlParams: null,
228
+ query: null,
229
+ page: y
230
+ });
231
+ function T(...t) {
232
+ let a = t.map((o, n) => n === 0 ? o.replace(/\/+$/, "") : o.replace(/^\/+|\/+$/g, "")).join("/");
233
+ return a.startsWith("/") || (a = "/" + a), a.split("?")[0];
234
+ }
235
+ async function at(t, a, o, n, i, s) {
236
+ try {
237
+ const c = (o.layout || []).map((u) => T(a, u).toString());
238
+ let r = T(a, o.view).toString();
239
+ console.log({ layouts_paths: c, view_path: r });
240
+ const e = await Promise.all(c.map((u) => import(
241
+ /* @vite-ignore */
242
+ u
243
+ ).then((w) => w.default)));
244
+ r.startsWith("/") || (r = "/" + r);
245
+ const l = await import(
246
+ /* @vite-ignore */
247
+ r
248
+ ).then((u) => u.default);
249
+ m.layouts = e, m.view = l, m.params = n, m.data = window.__INITIAL_DATA__, m.urlParams = i, m.query = s, Y(J, { target: t, props: m });
250
+ } catch (c) {
251
+ console.log("Client-side route loading failed - falling back to SSR navigation"), console.error("Route loading error:", c);
252
+ const r = window.location.pathname || "/";
253
+ window.location.href = r;
254
+ }
255
+ }
256
+ async function N(t, a, o, n, i, s, c = !1, r = !0) {
257
+ try {
258
+ const e = (o.layout || []).map((d) => T(a, d).toString()), l = T(a, o.view).toString(), u = await Promise.all(e.map((d) => import(
259
+ /* @vite-ignore */
260
+ d
261
+ ).then((p) => p.default))), w = await import(
262
+ /* @vite-ignore */
263
+ l
264
+ ).then((d) => d.default);
265
+ if (c) {
266
+ const d = {
267
+ method: o.method,
268
+ headers: {
269
+ "Content-Type": "application/json",
270
+ Accept: "application/json"
271
+ }
272
+ };
273
+ d[V] = !0, await fetch(t, d).then((p) => {
274
+ if (p.ok)
275
+ return p.json();
276
+ throw new Error("Network response was not ok");
277
+ }).then((p) => {
278
+ console.log("Server data", p), m.data = p, m.params = n, m.layouts = u, m.view = w, m.urlParams = i, m.query = s;
279
+ });
280
+ } else
281
+ m.data = { layout: [], view: {} }, m.params = n, m.layouts = u, m.view = w, m.urlParams = i, m.query = s;
282
+ window && window.scroll(0, 0), r && rt.push(t);
283
+ } catch (e) {
284
+ console.log("Client-side navigation failed for URL:", t, "- falling back to SSR navigation"), console.error("Navigation error:", e), window.location.href = t;
285
+ }
286
+ }
287
+ const k = B.proxy({});
288
+ async function it() {
289
+ Object.assign(k, window.__MANIFEST__);
290
+ }
291
+ function st(t, a, o) {
19
292
  if (!document) {
20
293
  console.error("Document not found");
21
294
  return;
22
295
  }
23
- document.addEventListener("click", (r) => {
24
- var s, e;
25
- const a = window.location.pathname, n = ((s = r.target) == null ? void 0 : s.tagName) === "A" ? r.target : (e = r.target) == null ? void 0 : e.closest("A");
26
- if (n) {
27
- let t = n.getAttribute("href");
28
- if (a === t) {
29
- r.preventDefault();
296
+ document.addEventListener("click", (n) => {
297
+ var c, r;
298
+ const i = window.location.pathname, s = ((c = n.target) == null ? void 0 : c.tagName) === "A" ? n.target : (r = n.target) == null ? void 0 : r.closest("A");
299
+ if (s) {
300
+ let e = s.getAttribute("href");
301
+ if (i === e) {
302
+ n.preventDefault();
30
303
  return;
31
304
  }
32
- if (t && t.startsWith("/") || t.startsWith(".")) {
33
- const o = t.split("?")[0], p = n.getAttribute("method") || "get", u = l.find((d) => d.method.toLowerCase() === p && i.find((f) => f.parser(o) && f.pattern === d.path));
34
- if (u) {
35
- r.preventDefault();
36
- const d = i.find((_) => _.parser(o) && _.pattern === u.path), f = (d == null ? void 0 : d.parser(o)) || {}, w = new URLSearchParams(t.split("?")[1] || ""), E = Object.fromEntries(w.entries()) || {}, v = { ...f, ...E }, O = g[d == null ? void 0 : d.pattern];
37
- m(t, c, u, v, f, E, O);
305
+ if (e && e.startsWith("/") || e.startsWith(".")) {
306
+ const l = e.split("?")[0], u = s.getAttribute("method") || "get", w = a.find((d) => d.method.toLowerCase() === u && o.find((p) => p.parser(l) && p.pattern === d.path));
307
+ if (w) {
308
+ n.preventDefault();
309
+ const d = o.find((E) => E.parser(l) && E.pattern === w.path), p = (d == null ? void 0 : d.parser(l)) || {}, v = new URLSearchParams(e.split("?")[1] || ""), S = Object.fromEntries(v.entries()) || {}, R = { ...p, ...S }, j = k[d == null ? void 0 : d.pattern];
310
+ N(e, t, w, R, p, S, j);
38
311
  } else
39
- console.log("No matching route found for URL:", t, "- using fallback navigation");
312
+ console.log("No matching route found for URL:", e, "- using fallback navigation");
40
313
  }
41
314
  }
42
- }), window.addEventListener("popstate", (r) => {
43
- const a = window.location.pathname, n = window.location.pathname + window.location.search;
44
- h.url = n, h.pathname = window.location.pathname;
45
- const s = "get", e = l.find((t) => t.method.toLowerCase() === s && i.find((o) => o.parser(a) && o.pattern === t.path));
46
- if (e) {
47
- const t = i.find((w) => w.parser(a) && w.pattern === e.path), o = (t == null ? void 0 : t.parser(a)) || {}, p = new URLSearchParams(window.location.search), u = Object.fromEntries(p.entries()) || {};
48
- Object.assign(h.params, o), Object.assign(h.query, u);
49
- const d = { ...o, ...u }, f = g[t == null ? void 0 : t.pattern];
50
- m(n, c, e, d, o, u, f, !1);
315
+ }), window.addEventListener("popstate", (n) => {
316
+ const i = window.location.pathname, s = window.location.pathname + window.location.search;
317
+ y.url = s, y.pathname = window.location.pathname;
318
+ const c = "get", r = a.find((e) => e.method.toLowerCase() === c && o.find((l) => l.parser(i) && l.pattern === e.path));
319
+ if (r) {
320
+ const e = o.find((v) => v.parser(i) && v.pattern === r.path), l = (e == null ? void 0 : e.parser(i)) || {}, u = new URLSearchParams(window.location.search), w = Object.fromEntries(u.entries()) || {};
321
+ Object.assign(y.params, l), Object.assign(y.query, w);
322
+ const d = { ...l, ...w }, p = k[e == null ? void 0 : e.pattern];
323
+ N(s, t, r, d, l, w, p, !1);
51
324
  } else
52
- console.log("No matching route found for popstate navigation to:", a, "- using fallback navigation"), window.location.href = a;
325
+ console.log("No matching route found for popstate navigation to:", i, "- using fallback navigation"), window.location.href = i;
53
326
  }), function() {
54
- const r = history.pushState, a = history.replaceState;
55
- history.pushState = function(...n) {
56
- const s = r.apply(this, n), e = new Event("pushstate");
57
- return e.state = n[0], e.url = n[2], window.dispatchEvent(e), s;
58
- }, history.replaceState = function(...n) {
59
- const s = a.apply(this, n), e = n[2], t = window.location.pathname;
60
- if ((e ? new URL(e, window.location.origin).pathname : t) !== t) {
61
- const p = new Event("replacestate");
62
- p.state = n[0], p.url = n[2], window.dispatchEvent(p);
327
+ const n = history.pushState, i = history.replaceState;
328
+ history.pushState = function(...s) {
329
+ const c = n.apply(this, s), r = new Event("pushstate");
330
+ return r.state = s[0], r.url = s[2], window.dispatchEvent(r), c;
331
+ }, history.replaceState = function(...s) {
332
+ const c = i.apply(this, s), r = s[2], e = window.location.pathname;
333
+ if ((r ? new URL(r, window.location.origin).pathname : e) !== e) {
334
+ const u = new Event("replacestate");
335
+ u.state = s[0], u.url = s[2], window.dispatchEvent(u);
63
336
  }
64
- return s;
337
+ return c;
65
338
  };
66
- }(), window.addEventListener("pushstate", (r) => {
67
- const a = r.url || window.location.pathname + window.location.search, n = a.split("?")[0], s = "get", e = l.find((t) => t.method.toLowerCase() === s && i.find((o) => o.parser(n) && o.pattern === t.path));
68
- if (e) {
69
- const t = i.find((w) => w.parser(n) && w.pattern === e.path), o = t == null ? void 0 : t.parser(n), p = new URLSearchParams(a.split("?")[1] || ""), u = Object.fromEntries(p.entries());
70
- h.url = a, h.pathname = window.location.pathname, Object.assign(h.params, o), Object.assign(h.query, u);
71
- const d = { ...o, ...u }, f = g[t == null ? void 0 : t.pattern];
72
- m(a, c, e, d, o, u, f, !1);
339
+ }(), window.addEventListener("pushstate", (n) => {
340
+ const i = n.url || window.location.pathname + window.location.search, s = i.split("?")[0], c = "get", r = a.find((e) => e.method.toLowerCase() === c && o.find((l) => l.parser(s) && l.pattern === e.path));
341
+ if (r) {
342
+ const e = o.find((v) => v.parser(s) && v.pattern === r.path), l = e == null ? void 0 : e.parser(s), u = new URLSearchParams(i.split("?")[1] || ""), w = Object.fromEntries(u.entries());
343
+ y.url = i, y.pathname = window.location.pathname, Object.assign(y.params, l), Object.assign(y.query, w);
344
+ const d = { ...l, ...w }, p = k[e == null ? void 0 : e.pattern];
345
+ N(i, t, r, d, l, w, p, !1);
73
346
  } else
74
- console.log("No matching route found for pushstate to:", n, "- using fallback navigation"), window.location.href = n;
75
- }), window.addEventListener("replacestate", (r) => {
76
- const a = r.url || window.location.pathname + window.location.search, n = a.split("?")[0];
77
- h.url = a, h.pathname = window.location.pathname, h.query = Object.fromEntries(new URLSearchParams(a.split("?")[1] || ""));
78
- const s = "get", e = l.find((t) => t.method.toLowerCase() === s && i.find((o) => o.parser(n) && o.pattern === t.path));
79
- if (e) {
80
- const t = i.find((w) => w.parser(n) && w.pattern === e.path), o = (t == null ? void 0 : t.parser(n)) || {}, p = new URLSearchParams(a.split("?")[1] || ""), u = Object.fromEntries(p.entries()) || {}, d = { ...o, ...u }, f = g[t == null ? void 0 : t.pattern];
81
- m(a, c, e, d, o, u, f, !1);
347
+ console.log("No matching route found for pushstate to:", s, "- using fallback navigation"), window.location.href = s;
348
+ }), window.addEventListener("replacestate", (n) => {
349
+ const i = n.url || window.location.pathname + window.location.search, s = i.split("?")[0];
350
+ y.url = i, y.pathname = window.location.pathname, y.query = Object.fromEntries(new URLSearchParams(i.split("?")[1] || ""));
351
+ const c = "get", r = a.find((e) => e.method.toLowerCase() === c && o.find((l) => l.parser(s) && l.pattern === e.path));
352
+ if (r) {
353
+ const e = o.find((v) => v.parser(s) && v.pattern === r.path), l = (e == null ? void 0 : e.parser(s)) || {}, u = new URLSearchParams(i.split("?")[1] || ""), w = Object.fromEntries(u.entries()) || {}, d = { ...l, ...w }, p = k[e == null ? void 0 : e.pattern];
354
+ N(i, t, r, d, l, w, p, !1);
82
355
  } else
83
- console.log("No matching route found for replacestate to:", n, "- using fallback navigation"), window.location.href = n;
356
+ console.log("No matching route found for replacestate to:", s, "- using fallback navigation"), window.location.href = s;
84
357
  });
85
358
  }
86
- const N = Symbol("forge-load-function");
87
- let P = [], b = null;
88
- function A(c) {
359
+ const V = Symbol("forge-load-function");
360
+ let q = [], $ = null;
361
+ function ct(t) {
89
362
  try {
90
- const l = new URL(c, window.location.origin);
91
- return l.origin === window.location.origin && !l.pathname.startsWith("/api/");
363
+ const a = new URL(t, window.location.origin);
364
+ return a.origin === window.location.origin && !a.pathname.startsWith("/api/");
92
365
  } catch {
93
- return !c.startsWith("/api/");
366
+ return !t.startsWith("/api/");
94
367
  }
95
368
  }
96
- function k() {
97
- typeof window < "u" && !b && (b = window.fetch, window.fetch = async function(c, l = {}) {
98
- console.log("🔵 Enhanced fetch called for:", c), console.log("🔵 Initial headers:", l.headers);
99
- const i = new Headers(l.headers), r = Object.fromEntries(i.entries());
100
- console.log("🟡 Headers before middleware:", r);
101
- for (const e of P)
102
- e.length === 2 ? await new Promise((t, o) => {
369
+ function lt() {
370
+ typeof window < "u" && !$ && ($ = window.fetch, window.fetch = async function(t, a = {}) {
371
+ console.log("🔵 Enhanced fetch called for:", t), console.log("🔵 Initial headers:", a.headers);
372
+ const o = new Headers(a.headers), n = Object.fromEntries(o.entries());
373
+ console.log("🟡 Headers before middleware:", n);
374
+ for (const r of q)
375
+ r.length === 2 ? await new Promise((e, l) => {
103
376
  try {
104
- e(r, (p) => {
105
- p ? o(p) : t();
377
+ r(n, (u) => {
378
+ u ? l(u) : e();
106
379
  });
107
- } catch (p) {
108
- o(p);
380
+ } catch (u) {
381
+ l(u);
109
382
  }
110
- }) : await e(r);
111
- console.log("🟢 Headers after middleware:", r);
112
- const a = new Headers();
113
- Object.entries(r).forEach(([e, t]) => {
114
- t !== void 0 && a.set(e, t);
383
+ }) : await r(n);
384
+ console.log("🟢 Headers after middleware:", n);
385
+ const i = new Headers();
386
+ Object.entries(n).forEach(([r, e]) => {
387
+ e !== void 0 && i.set(r, e);
115
388
  });
116
- const n = {
117
- ...l,
118
- headers: a
389
+ const s = {
390
+ ...a,
391
+ headers: i
119
392
  };
120
- console.log("🔴 Final requestInit:", n), console.log("🔴 Headers entries:", Array.from(a.entries()));
121
- const s = await b(c, n);
122
- if (s.status >= 300 && s.status < 400 && l[N]) {
123
- const e = s.headers.get("location");
124
- if (e && A(e))
125
- return window.location.href = e, s;
393
+ console.log("🔴 Final requestInit:", s), console.log("🔴 Headers entries:", Array.from(i.entries()));
394
+ const c = await $(t, s);
395
+ if (c.status >= 300 && c.status < 400 && a[V]) {
396
+ const r = c.headers.get("location");
397
+ if (r && ct(r))
398
+ return window.location.href = r, c;
126
399
  }
127
- return s;
400
+ return c;
128
401
  });
129
402
  }
130
- k();
131
- const H = {
403
+ lt();
404
+ const ht = {
132
405
  /**
133
406
  * Add middleware to the fetch pipeline
134
407
  */
135
- configUpdate(c) {
136
- if (typeof c != "function")
408
+ configUpdate(t) {
409
+ if (typeof t != "function")
137
410
  throw new Error("Middleware must be a function");
138
- P.push(c);
411
+ q.push(t);
139
412
  },
140
413
  /**
141
414
  * Reset all middleware
142
415
  */
143
416
  reset() {
144
- P.length = 0;
417
+ q.length = 0;
145
418
  },
146
419
  /**
147
420
  * Get current middleware count (for debugging)
148
421
  */
149
422
  getMiddlewareCount() {
150
- return P.length;
423
+ return q.length;
151
424
  }
152
425
  };
153
- let y;
154
- async function x(c, l) {
155
- let i = l.component_dir;
156
- if (!i && typeof i != "string")
426
+ let C;
427
+ async function wt(t, a) {
428
+ let o = a.component_dir;
429
+ if (!o && typeof o != "string")
157
430
  throw new Error("No component directory provided");
158
- let r = window.__ROUTING__;
159
- if (y = q(r), window && window.location) {
160
- const a = (window.location.pathname || "/").split("?")[0];
161
- console.log(`Current pathname: ${a}`);
162
- const n = y.find((e) => e.parser(a));
163
- let s = n ? r.find((e) => e.path === n.pattern) : null;
164
- if (n && s) {
165
- console.log("Found route:", s);
166
- const e = n.parser(a) || {}, t = new URLSearchParams(window.location.search), o = Object.fromEntries(t.entries()) || {}, p = { ...e, ...o };
167
- R(), L(c, i, s, p, e, o), j(i, r, y);
431
+ let n = window.__ROUTING__;
432
+ if (C = Q(n), window && window.location) {
433
+ const i = (window.location.pathname || "/").split("?")[0];
434
+ console.log(`Current pathname: ${i}`);
435
+ const s = C.find((r) => r.parser(i));
436
+ let c = s ? n.find((r) => r.path === s.pattern) : null;
437
+ if (s && c) {
438
+ console.log("Found route:", c);
439
+ const r = s.parser(i) || {}, e = new URLSearchParams(window.location.search), l = Object.fromEntries(e.entries()) || {}, u = { ...r, ...l };
440
+ it(), at(t, o, c, u, r, l), st(o, n, C);
168
441
  } else {
169
- console.log("No matching route found, using fallback navigation"), window.location.href = a;
442
+ console.log("No matching route found, using fallback navigation"), window.location.href = i;
170
443
  return;
171
444
  }
172
445
  }
173
446
  }
174
447
  export {
175
- B as MANIFEST_STORE,
176
- j as bootstrap_events,
177
- x as createApp,
178
- H as fetch,
179
- W as loadRoute,
180
- J as page,
181
- K as shadowUrl,
182
- Y as updateManifestStore,
183
- z as updateRoute
448
+ k as MANIFEST_STORE,
449
+ st as bootstrap_events,
450
+ wt as createApp,
451
+ ht as fetch,
452
+ at as loadRoute,
453
+ y as page,
454
+ vt as shadowUrl,
455
+ it as updateManifestStore,
456
+ N as updateRoute
184
457
  };
185
458
  //# sourceMappingURL=client.mjs.map