@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.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +402 -129
- package/dist/client.mjs.map +1 -1
- package/dist/page.cjs +1 -1
- package/dist/page.cjs.map +1 -1
- package/dist/page.mjs +3 -41
- package/dist/page.mjs.map +1 -1
- package/dist/page.svelte-C4chAYK2.js +137 -0
- package/dist/page.svelte-C4chAYK2.js.map +1 -0
- package/dist/page.svelte-Dvj7306U.cjs +2 -0
- package/dist/page.svelte-Dvj7306U.cjs.map +1 -0
- package/dist/shared.cjs +1 -1
- package/dist/shared.mjs +2 -2
- package/dist-ssr/path-CyGuWUeq.cjs +68 -0
- package/dist-ssr/path-CyGuWUeq.cjs.map +1 -0
- package/dist-ssr/path-ODk1FhWY.js +69 -0
- package/dist-ssr/path-ODk1FhWY.js.map +1 -0
- package/dist-ssr/server.cjs +3 -66
- package/dist-ssr/server.cjs.map +1 -1
- package/dist-ssr/server.js +1 -64
- package/dist-ssr/server.js.map +1 -1
- package/dist-ssr/shared.cjs +28 -5
- package/dist-ssr/shared.cjs.map +1 -1
- package/dist-ssr/shared.js +27 -1
- package/dist-ssr/shared.js.map +1 -1
- package/package.json +1 -1
- package/dist/index-D3Pt-y7F.cjs +0 -2
- package/dist/index-D3Pt-y7F.cjs.map +0 -1
- package/dist/index-DFgPI13E.js +0 -96
- package/dist/index-DFgPI13E.js.map +0 -1
package/dist/client.mjs
CHANGED
|
@@ -1,185 +1,458 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
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", (
|
|
24
|
-
var
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
let
|
|
28
|
-
if (
|
|
29
|
-
|
|
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 (
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
const d =
|
|
37
|
-
|
|
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:",
|
|
312
|
+
console.log("No matching route found for URL:", e, "- using fallback navigation");
|
|
40
313
|
}
|
|
41
314
|
}
|
|
42
|
-
}), window.addEventListener("popstate", (
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
Object.assign(
|
|
49
|
-
const d = { ...
|
|
50
|
-
|
|
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:",
|
|
325
|
+
console.log("No matching route found for popstate navigation to:", i, "- using fallback navigation"), window.location.href = i;
|
|
53
326
|
}), function() {
|
|
54
|
-
const
|
|
55
|
-
history.pushState = function(...
|
|
56
|
-
const
|
|
57
|
-
return
|
|
58
|
-
}, history.replaceState = function(...
|
|
59
|
-
const
|
|
60
|
-
if ((
|
|
61
|
-
const
|
|
62
|
-
|
|
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
|
|
337
|
+
return c;
|
|
65
338
|
};
|
|
66
|
-
}(), window.addEventListener("pushstate", (
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const d = { ...
|
|
72
|
-
|
|
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:",
|
|
75
|
-
}), window.addEventListener("replacestate", (
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
81
|
-
|
|
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:",
|
|
356
|
+
console.log("No matching route found for replacestate to:", s, "- using fallback navigation"), window.location.href = s;
|
|
84
357
|
});
|
|
85
358
|
}
|
|
86
|
-
const
|
|
87
|
-
let
|
|
88
|
-
function
|
|
359
|
+
const V = Symbol("forge-load-function");
|
|
360
|
+
let q = [], $ = null;
|
|
361
|
+
function ct(t) {
|
|
89
362
|
try {
|
|
90
|
-
const
|
|
91
|
-
return
|
|
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 !
|
|
366
|
+
return !t.startsWith("/api/");
|
|
94
367
|
}
|
|
95
368
|
}
|
|
96
|
-
function
|
|
97
|
-
typeof window < "u" &&
|
|
98
|
-
console.log("🔵 Enhanced fetch called for:",
|
|
99
|
-
const
|
|
100
|
-
console.log("🟡 Headers before middleware:",
|
|
101
|
-
for (const
|
|
102
|
-
|
|
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
|
-
|
|
105
|
-
|
|
377
|
+
r(n, (u) => {
|
|
378
|
+
u ? l(u) : e();
|
|
106
379
|
});
|
|
107
|
-
} catch (
|
|
108
|
-
|
|
380
|
+
} catch (u) {
|
|
381
|
+
l(u);
|
|
109
382
|
}
|
|
110
|
-
}) : await
|
|
111
|
-
console.log("🟢 Headers after middleware:",
|
|
112
|
-
const
|
|
113
|
-
Object.entries(
|
|
114
|
-
|
|
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
|
|
117
|
-
...
|
|
118
|
-
headers:
|
|
389
|
+
const s = {
|
|
390
|
+
...a,
|
|
391
|
+
headers: i
|
|
119
392
|
};
|
|
120
|
-
console.log("🔴 Final requestInit:",
|
|
121
|
-
const
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
return window.location.href =
|
|
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
|
|
400
|
+
return c;
|
|
128
401
|
});
|
|
129
402
|
}
|
|
130
|
-
|
|
131
|
-
const
|
|
403
|
+
lt();
|
|
404
|
+
const ht = {
|
|
132
405
|
/**
|
|
133
406
|
* Add middleware to the fetch pipeline
|
|
134
407
|
*/
|
|
135
|
-
configUpdate(
|
|
136
|
-
if (typeof
|
|
408
|
+
configUpdate(t) {
|
|
409
|
+
if (typeof t != "function")
|
|
137
410
|
throw new Error("Middleware must be a function");
|
|
138
|
-
|
|
411
|
+
q.push(t);
|
|
139
412
|
},
|
|
140
413
|
/**
|
|
141
414
|
* Reset all middleware
|
|
142
415
|
*/
|
|
143
416
|
reset() {
|
|
144
|
-
|
|
417
|
+
q.length = 0;
|
|
145
418
|
},
|
|
146
419
|
/**
|
|
147
420
|
* Get current middleware count (for debugging)
|
|
148
421
|
*/
|
|
149
422
|
getMiddlewareCount() {
|
|
150
|
-
return
|
|
423
|
+
return q.length;
|
|
151
424
|
}
|
|
152
425
|
};
|
|
153
|
-
let
|
|
154
|
-
async function
|
|
155
|
-
let
|
|
156
|
-
if (!
|
|
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
|
|
159
|
-
if (
|
|
160
|
-
const
|
|
161
|
-
console.log(`Current pathname: ${
|
|
162
|
-
const
|
|
163
|
-
let
|
|
164
|
-
if (
|
|
165
|
-
console.log("Found route:",
|
|
166
|
-
const
|
|
167
|
-
|
|
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 =
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|