likec4 1.19.2 → 1.20.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.
- package/__app__/react/likec4.tsx +16 -114
- package/__app__/src/chunks/{-index-overview-COSF42be.js → -index-overview-B8Ngh4J7.js} +20 -19
- package/__app__/src/chunks/{likec4-CusAw_j6.js → likec4-CK8zVxjc.js} +1172 -1209
- package/__app__/src/chunks/main-DwHOiMDD.js +23884 -0
- package/__app__/src/chunks/{mantine-B_6mKFFA.js → mantine-B9NZkjVg.js} +993 -981
- package/__app__/src/chunks/tanstack-router-B9I-d36d.js +3032 -0
- package/__app__/src/main.js +1 -2
- package/__app__/src/style.css +1 -1
- package/__app__/webcomponent/webcomponent.js +31795 -32402
- package/dist/chunks/prompt.cjs +1 -1
- package/dist/chunks/prompt.mjs +1 -1
- package/dist/cli/index.cjs +47 -58
- package/dist/cli/index.mjs +29 -40
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +106 -81
- package/dist/index.d.mts +106 -81
- package/dist/index.d.ts +106 -81
- package/dist/index.mjs +1 -1
- package/dist/model/index.cjs +1 -1
- package/dist/model/index.d.cts +4 -257
- package/dist/model/index.d.mts +4 -257
- package/dist/model/index.d.ts +4 -257
- package/dist/model/index.mjs +1 -1
- package/dist/shared/likec4.Buej2FfJ.mjs +1857 -0
- package/dist/shared/likec4.pZxbrzrY.cjs +1857 -0
- package/package.json +39 -39
- package/react/index.d.ts +771 -1546
- package/react/index.js +36196 -36908
- package/react/style.css +1 -1
- package/__app__/src/chunks/main-CtzxB_vG.js +0 -24136
- package/__app__/src/chunks/tanstack-router-BBWuTKWO.js +0 -2373
- package/dist/shared/likec4.-U9_Dinu.cjs +0 -1856
- package/dist/shared/likec4.CVn8U3Og.cjs +0 -9
- package/dist/shared/likec4.Cgd5VecV.mjs +0 -9
- package/dist/shared/likec4.D7BM0ZAO.mjs +0 -1856
- package/dist/shared/likec4.DJeGiAvE.d.cts +0 -1639
- package/dist/shared/likec4.DJeGiAvE.d.mts +0 -1639
- package/dist/shared/likec4.DJeGiAvE.d.ts +0 -1639
|
@@ -1,2373 +0,0 @@
|
|
|
1
|
-
import { jsxs as yt, jsx as _, Fragment as Vt } from "react/jsx-runtime";
|
|
2
|
-
import * as L from "react";
|
|
3
|
-
import { flushSync as ae } from "react-dom";
|
|
4
|
-
import { w as ce } from "./likec4-CusAw_j6.js";
|
|
5
|
-
const Nt = "pushstate", $t = "popstate", qt = "beforeunload", Xt = (t) => (t.preventDefault(), t.returnValue = ""), le = () => {
|
|
6
|
-
removeEventListener(qt, Xt, {
|
|
7
|
-
capture: !0
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
function Gt(t) {
|
|
11
|
-
let n = t.getLocation();
|
|
12
|
-
const e = /* @__PURE__ */ new Set();
|
|
13
|
-
let o = [];
|
|
14
|
-
const r = () => {
|
|
15
|
-
n = t.getLocation(), e.forEach((s) => s());
|
|
16
|
-
}, a = async (s, i) => {
|
|
17
|
-
var l;
|
|
18
|
-
if (!(i?.ignoreBlocker ?? !1) && typeof document < "u" && o.length) {
|
|
19
|
-
for (const u of o)
|
|
20
|
-
if (!await u()) {
|
|
21
|
-
(l = t.onBlocked) == null || l.call(t, r);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
s();
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
get location() {
|
|
29
|
-
return n;
|
|
30
|
-
},
|
|
31
|
-
subscribers: e,
|
|
32
|
-
subscribe: (s) => (e.add(s), () => {
|
|
33
|
-
e.delete(s);
|
|
34
|
-
}),
|
|
35
|
-
push: (s, i, l) => {
|
|
36
|
-
i = ft(i), a(() => {
|
|
37
|
-
t.pushState(s, i), r();
|
|
38
|
-
}, l);
|
|
39
|
-
},
|
|
40
|
-
replace: (s, i, l) => {
|
|
41
|
-
i = ft(i), a(() => {
|
|
42
|
-
t.replaceState(s, i), r();
|
|
43
|
-
}, l);
|
|
44
|
-
},
|
|
45
|
-
go: (s, i) => {
|
|
46
|
-
a(() => {
|
|
47
|
-
t.go(s), r();
|
|
48
|
-
}, i);
|
|
49
|
-
},
|
|
50
|
-
back: (s) => {
|
|
51
|
-
a(() => {
|
|
52
|
-
t.back(), r();
|
|
53
|
-
}, s);
|
|
54
|
-
},
|
|
55
|
-
forward: (s) => {
|
|
56
|
-
a(() => {
|
|
57
|
-
t.forward(), r();
|
|
58
|
-
}, s);
|
|
59
|
-
},
|
|
60
|
-
createHref: (s) => t.createHref(s),
|
|
61
|
-
block: (s) => (o.push(s), o.length === 1 && addEventListener(qt, Xt, {
|
|
62
|
-
capture: !0
|
|
63
|
-
}), () => {
|
|
64
|
-
o = o.filter((i) => i !== s), o.length || le();
|
|
65
|
-
}),
|
|
66
|
-
flush: () => {
|
|
67
|
-
var s;
|
|
68
|
-
return (s = t.flush) == null ? void 0 : s.call(t);
|
|
69
|
-
},
|
|
70
|
-
destroy: () => {
|
|
71
|
-
var s;
|
|
72
|
-
return (s = t.destroy) == null ? void 0 : s.call(t);
|
|
73
|
-
},
|
|
74
|
-
notify: r
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function ft(t) {
|
|
78
|
-
return t || (t = {}), {
|
|
79
|
-
...t,
|
|
80
|
-
key: Yt()
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function Jt(t) {
|
|
84
|
-
const n = t?.window ?? (typeof document < "u" ? window : void 0), e = n.history.pushState, o = n.history.replaceState, r = t?.createHref ?? ((p) => p), a = t?.parseLocation ?? (() => _t(
|
|
85
|
-
`${n.location.pathname}${n.location.search}${n.location.hash}`,
|
|
86
|
-
n.history.state
|
|
87
|
-
));
|
|
88
|
-
let s = a(), i;
|
|
89
|
-
const l = () => s;
|
|
90
|
-
let c, u;
|
|
91
|
-
const d = () => {
|
|
92
|
-
if (!c)
|
|
93
|
-
return;
|
|
94
|
-
(c.isPush ? e : o).call(n.history, c.state, "", c.href), c = void 0, u = void 0, i = void 0;
|
|
95
|
-
}, h = (p, v, S) => {
|
|
96
|
-
const b = r(v);
|
|
97
|
-
u || (i = s), s = _t(v, S), c = {
|
|
98
|
-
href: b,
|
|
99
|
-
state: S,
|
|
100
|
-
isPush: c?.isPush || p === "push"
|
|
101
|
-
}, u || (u = Promise.resolve().then(() => d()));
|
|
102
|
-
}, f = () => {
|
|
103
|
-
s = a(), m.notify();
|
|
104
|
-
}, m = Gt({
|
|
105
|
-
getLocation: l,
|
|
106
|
-
pushState: (p, v) => h("push", p, v),
|
|
107
|
-
replaceState: (p, v) => h("replace", p, v),
|
|
108
|
-
back: () => n.history.back(),
|
|
109
|
-
forward: () => n.history.forward(),
|
|
110
|
-
go: (p) => n.history.go(p),
|
|
111
|
-
createHref: (p) => r(p),
|
|
112
|
-
flush: d,
|
|
113
|
-
destroy: () => {
|
|
114
|
-
n.history.pushState = e, n.history.replaceState = o, n.removeEventListener(Nt, f), n.removeEventListener($t, f);
|
|
115
|
-
},
|
|
116
|
-
onBlocked: (p) => {
|
|
117
|
-
i && s !== i && (s = i, p());
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
return n.addEventListener(Nt, f), n.addEventListener($t, f), n.history.pushState = function(...p) {
|
|
121
|
-
const v = e.apply(n.history, p);
|
|
122
|
-
return f(), v;
|
|
123
|
-
}, n.history.replaceState = function(...p) {
|
|
124
|
-
const v = o.apply(n.history, p);
|
|
125
|
-
return f(), v;
|
|
126
|
-
}, m;
|
|
127
|
-
}
|
|
128
|
-
function co(t) {
|
|
129
|
-
const n = typeof document < "u" ? window : void 0;
|
|
130
|
-
return Jt({
|
|
131
|
-
window: n,
|
|
132
|
-
parseLocation: () => {
|
|
133
|
-
const e = n.location.hash.split("#").slice(1).join("#") ?? "/";
|
|
134
|
-
return _t(e, n.history.state);
|
|
135
|
-
},
|
|
136
|
-
createHref: (e) => `${n.location.pathname}${n.location.search}#${e}`
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
function ue(t = {
|
|
140
|
-
initialEntries: ["/"]
|
|
141
|
-
}) {
|
|
142
|
-
const n = t.initialEntries;
|
|
143
|
-
let e = t.initialIndex ?? n.length - 1, o = {
|
|
144
|
-
key: Yt()
|
|
145
|
-
};
|
|
146
|
-
return Gt({
|
|
147
|
-
getLocation: () => _t(n[e], o),
|
|
148
|
-
pushState: (a, s) => {
|
|
149
|
-
o = s, n.splice, e < n.length - 1 && n.splice(e + 1), n.push(a), e = Math.max(n.length - 1, 0);
|
|
150
|
-
},
|
|
151
|
-
replaceState: (a, s) => {
|
|
152
|
-
o = s, n[e] = a;
|
|
153
|
-
},
|
|
154
|
-
back: () => {
|
|
155
|
-
o = ft(o), e = Math.max(e - 1, 0);
|
|
156
|
-
},
|
|
157
|
-
forward: () => {
|
|
158
|
-
o = ft(o), e = Math.min(e + 1, n.length - 1);
|
|
159
|
-
},
|
|
160
|
-
go: (a) => {
|
|
161
|
-
o = ft(o), e = Math.min(Math.max(e + a, 0), n.length - 1);
|
|
162
|
-
},
|
|
163
|
-
createHref: (a) => a
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
function _t(t, n) {
|
|
167
|
-
const e = t.indexOf("#"), o = t.indexOf("?");
|
|
168
|
-
return {
|
|
169
|
-
href: t,
|
|
170
|
-
pathname: t.substring(
|
|
171
|
-
0,
|
|
172
|
-
e > 0 ? o > 0 ? Math.min(e, o) : e : o > 0 ? o : t.length
|
|
173
|
-
),
|
|
174
|
-
hash: e > -1 ? t.substring(e) : "",
|
|
175
|
-
search: o > -1 ? t.slice(o, e === -1 ? void 0 : e) : "",
|
|
176
|
-
state: n || {}
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function Yt() {
|
|
180
|
-
return (Math.random() + 1).toString(36).substring(7);
|
|
181
|
-
}
|
|
182
|
-
var de = !0, Et = "Invariant failed";
|
|
183
|
-
function H(t, n) {
|
|
184
|
-
if (!t) {
|
|
185
|
-
if (de)
|
|
186
|
-
throw new Error(Et);
|
|
187
|
-
var e = typeof n == "function" ? n() : n, o = e ? "".concat(Et, ": ").concat(e) : Et;
|
|
188
|
-
throw new Error(o);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
var he = !0;
|
|
192
|
-
function ut(t, n) {
|
|
193
|
-
if (!he) {
|
|
194
|
-
if (t)
|
|
195
|
-
return;
|
|
196
|
-
var e = "Warning: " + n;
|
|
197
|
-
typeof console < "u" && console.warn(e);
|
|
198
|
-
try {
|
|
199
|
-
throw Error(e);
|
|
200
|
-
} catch {
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
const xt = L.createContext(null);
|
|
205
|
-
function Qt() {
|
|
206
|
-
return typeof document > "u" ? xt : window.__TSR_ROUTER_CONTEXT__ ? window.__TSR_ROUTER_CONTEXT__ : (window.__TSR_ROUTER_CONTEXT__ = xt, xt);
|
|
207
|
-
}
|
|
208
|
-
function tt(t) {
|
|
209
|
-
const n = L.useContext(Qt());
|
|
210
|
-
return ut(
|
|
211
|
-
!((t?.warn ?? !0) && !n),
|
|
212
|
-
"useRouter must be used inside a <RouterProvider> component!"
|
|
213
|
-
), n;
|
|
214
|
-
}
|
|
215
|
-
class fe {
|
|
216
|
-
constructor(n, e) {
|
|
217
|
-
this.listeners = /* @__PURE__ */ new Set(), this._batching = !1, this._flushing = 0, this.subscribe = (o) => {
|
|
218
|
-
var r, a;
|
|
219
|
-
this.listeners.add(o);
|
|
220
|
-
const s = (a = (r = this.options) == null ? void 0 : r.onSubscribe) == null ? void 0 : a.call(r, o, this);
|
|
221
|
-
return () => {
|
|
222
|
-
this.listeners.delete(o), s?.();
|
|
223
|
-
};
|
|
224
|
-
}, this.setState = (o) => {
|
|
225
|
-
var r, a, s;
|
|
226
|
-
const i = this.state;
|
|
227
|
-
this.state = (r = this.options) != null && r.updateFn ? this.options.updateFn(i)(o) : o(i), (s = (a = this.options) == null ? void 0 : a.onUpdate) == null || s.call(a), this._flush();
|
|
228
|
-
}, this._flush = () => {
|
|
229
|
-
if (this._batching) return;
|
|
230
|
-
const o = ++this._flushing;
|
|
231
|
-
this.listeners.forEach((r) => {
|
|
232
|
-
this._flushing === o && r();
|
|
233
|
-
});
|
|
234
|
-
}, this.batch = (o) => {
|
|
235
|
-
if (this._batching) return o();
|
|
236
|
-
this._batching = !0, o(), this._batching = !1, this._flush();
|
|
237
|
-
}, this.state = n, this.options = e;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
function pe(t, n = (e) => e) {
|
|
241
|
-
return ce.useSyncExternalStoreWithSelector(
|
|
242
|
-
t.subscribe,
|
|
243
|
-
() => t.state,
|
|
244
|
-
() => t.state,
|
|
245
|
-
n,
|
|
246
|
-
me
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
function me(t, n) {
|
|
250
|
-
if (Object.is(t, n))
|
|
251
|
-
return !0;
|
|
252
|
-
if (typeof t != "object" || t === null || typeof n != "object" || n === null)
|
|
253
|
-
return !1;
|
|
254
|
-
const e = Object.keys(t);
|
|
255
|
-
if (e.length !== Object.keys(n).length)
|
|
256
|
-
return !1;
|
|
257
|
-
for (let o = 0; o < e.length; o++)
|
|
258
|
-
if (!Object.prototype.hasOwnProperty.call(n, e[o]) || !Object.is(t[e[o]], n[e[o]]))
|
|
259
|
-
return !1;
|
|
260
|
-
return !0;
|
|
261
|
-
}
|
|
262
|
-
const W = "__root__";
|
|
263
|
-
function ve(t, n) {
|
|
264
|
-
let e, o, r, a = "";
|
|
265
|
-
for (e in t)
|
|
266
|
-
if ((r = t[e]) !== void 0)
|
|
267
|
-
if (Array.isArray(r))
|
|
268
|
-
for (o = 0; o < r.length; o++)
|
|
269
|
-
a && (a += "&"), a += encodeURIComponent(e) + "=" + encodeURIComponent(r[o]);
|
|
270
|
-
else
|
|
271
|
-
a && (a += "&"), a += encodeURIComponent(e) + "=" + encodeURIComponent(r);
|
|
272
|
-
return "" + a;
|
|
273
|
-
}
|
|
274
|
-
function At(t) {
|
|
275
|
-
if (!t) return "";
|
|
276
|
-
const n = decodeURIComponent(t);
|
|
277
|
-
return n === "false" ? !1 : n === "true" ? !0 : +n * 0 === 0 && +n + "" === n ? +n : n;
|
|
278
|
-
}
|
|
279
|
-
function ge(t, n) {
|
|
280
|
-
let e, o;
|
|
281
|
-
const r = {}, a = t.split("&");
|
|
282
|
-
for (; e = a.shift(); ) {
|
|
283
|
-
const s = e.indexOf("=");
|
|
284
|
-
if (s !== -1) {
|
|
285
|
-
o = e.slice(0, s);
|
|
286
|
-
const i = e.slice(s + 1);
|
|
287
|
-
r[o] !== void 0 ? r[o] = [].concat(r[o], At(i)) : r[o] = At(i);
|
|
288
|
-
} else
|
|
289
|
-
o = e, r[o] = "";
|
|
290
|
-
}
|
|
291
|
-
return r;
|
|
292
|
-
}
|
|
293
|
-
const ye = Se(JSON.parse), _e = Pe(
|
|
294
|
-
JSON.stringify,
|
|
295
|
-
JSON.parse
|
|
296
|
-
);
|
|
297
|
-
function Se(t) {
|
|
298
|
-
return (n) => {
|
|
299
|
-
n.substring(0, 1) === "?" && (n = n.substring(1));
|
|
300
|
-
const e = ge(n);
|
|
301
|
-
for (const o in e) {
|
|
302
|
-
const r = e[o];
|
|
303
|
-
if (typeof r == "string")
|
|
304
|
-
try {
|
|
305
|
-
e[o] = t(r);
|
|
306
|
-
} catch {
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
return e;
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
function Pe(t, n) {
|
|
313
|
-
function e(o) {
|
|
314
|
-
if (typeof o == "object" && o !== null)
|
|
315
|
-
try {
|
|
316
|
-
return t(o);
|
|
317
|
-
} catch {
|
|
318
|
-
}
|
|
319
|
-
else if (typeof o == "string" && typeof n == "function")
|
|
320
|
-
try {
|
|
321
|
-
return n(o), t(o);
|
|
322
|
-
} catch {
|
|
323
|
-
}
|
|
324
|
-
return o;
|
|
325
|
-
}
|
|
326
|
-
return (o) => {
|
|
327
|
-
o = { ...o }, Object.keys(o).forEach((a) => {
|
|
328
|
-
const s = o[a];
|
|
329
|
-
typeof s > "u" || s === void 0 ? delete o[a] : o[a] = e(s);
|
|
330
|
-
});
|
|
331
|
-
const r = ve(o).toString();
|
|
332
|
-
return r ? `?${r}` : "";
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
function St(t) {
|
|
336
|
-
return t[t.length - 1];
|
|
337
|
-
}
|
|
338
|
-
function we(t) {
|
|
339
|
-
return typeof t == "function";
|
|
340
|
-
}
|
|
341
|
-
function it(t, n) {
|
|
342
|
-
return we(t) ? t(n) : t;
|
|
343
|
-
}
|
|
344
|
-
function pt(t, n) {
|
|
345
|
-
return n.reduce((e, o) => (e[o] = t[o], e), {});
|
|
346
|
-
}
|
|
347
|
-
function Y(t, n) {
|
|
348
|
-
if (t === n)
|
|
349
|
-
return t;
|
|
350
|
-
const e = n, o = jt(t) && jt(e);
|
|
351
|
-
if (o || Pt(t) && Pt(e)) {
|
|
352
|
-
const r = o ? t : Object.keys(t), a = r.length, s = o ? e : Object.keys(e), i = s.length, l = o ? [] : {};
|
|
353
|
-
let c = 0;
|
|
354
|
-
for (let u = 0; u < i; u++) {
|
|
355
|
-
const d = o ? u : s[u];
|
|
356
|
-
(!o && r.includes(d) || o) && t[d] === void 0 && e[d] === void 0 ? (l[d] = void 0, c++) : (l[d] = Y(t[d], e[d]), l[d] === t[d] && t[d] !== void 0 && c++);
|
|
357
|
-
}
|
|
358
|
-
return a === i && c === a ? t : l;
|
|
359
|
-
}
|
|
360
|
-
return e;
|
|
361
|
-
}
|
|
362
|
-
function Pt(t) {
|
|
363
|
-
if (!Kt(t))
|
|
364
|
-
return !1;
|
|
365
|
-
const n = t.constructor;
|
|
366
|
-
if (typeof n > "u")
|
|
367
|
-
return !0;
|
|
368
|
-
const e = n.prototype;
|
|
369
|
-
return !(!Kt(e) || !e.hasOwnProperty("isPrototypeOf"));
|
|
370
|
-
}
|
|
371
|
-
function Kt(t) {
|
|
372
|
-
return Object.prototype.toString.call(t) === "[object Object]";
|
|
373
|
-
}
|
|
374
|
-
function jt(t) {
|
|
375
|
-
return Array.isArray(t) && t.length === Object.keys(t).length;
|
|
376
|
-
}
|
|
377
|
-
function lt(t, n, e = !1) {
|
|
378
|
-
if (t === n)
|
|
379
|
-
return !0;
|
|
380
|
-
if (typeof t != typeof n)
|
|
381
|
-
return !1;
|
|
382
|
-
if (Pt(t) && Pt(n)) {
|
|
383
|
-
const o = Object.keys(t).filter((a) => t[a] !== void 0), r = Object.keys(n).filter((a) => n[a] !== void 0);
|
|
384
|
-
return !e && o.length !== r.length ? !1 : !r.some(
|
|
385
|
-
(a) => !(a in t) || !lt(t[a], n[a], e)
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
return Array.isArray(t) && Array.isArray(n) ? t.length !== n.length ? !1 : !t.some((o, r) => !lt(o, n[r], e)) : !1;
|
|
389
|
-
}
|
|
390
|
-
const It = typeof window < "u" ? L.useLayoutEffect : L.useEffect;
|
|
391
|
-
function ct(t) {
|
|
392
|
-
let n, e;
|
|
393
|
-
const o = new Promise((r, a) => {
|
|
394
|
-
n = r, e = a;
|
|
395
|
-
});
|
|
396
|
-
return o.status = "pending", o.resolve = (r) => {
|
|
397
|
-
o.status = "resolved", o.value = r, n(r), t?.(r);
|
|
398
|
-
}, o.reject = (r) => {
|
|
399
|
-
o.status = "rejected", e(r);
|
|
400
|
-
}, o;
|
|
401
|
-
}
|
|
402
|
-
function Dt(t) {
|
|
403
|
-
const n = L.useRef({
|
|
404
|
-
value: t,
|
|
405
|
-
prev: null
|
|
406
|
-
}), e = n.current.value;
|
|
407
|
-
return t !== e && (n.current = {
|
|
408
|
-
value: t,
|
|
409
|
-
prev: e
|
|
410
|
-
}), n.current.prev;
|
|
411
|
-
}
|
|
412
|
-
function nt(t) {
|
|
413
|
-
return bt(
|
|
414
|
-
t.filter((n) => n !== void 0).join("/")
|
|
415
|
-
);
|
|
416
|
-
}
|
|
417
|
-
function bt(t) {
|
|
418
|
-
return t.replace(/\/{2,}/g, "/");
|
|
419
|
-
}
|
|
420
|
-
function Ot(t) {
|
|
421
|
-
return t === "/" ? t : t.replace(/^\/{1,}/, "");
|
|
422
|
-
}
|
|
423
|
-
function at(t) {
|
|
424
|
-
return t === "/" ? t : t.replace(/\/{1,}$/, "");
|
|
425
|
-
}
|
|
426
|
-
function Re(t) {
|
|
427
|
-
return at(Ot(t));
|
|
428
|
-
}
|
|
429
|
-
function wt(t, n) {
|
|
430
|
-
return t.endsWith("/") && t !== "/" && t !== `${n}/` ? t.slice(0, -1) : t;
|
|
431
|
-
}
|
|
432
|
-
function be(t, n, e) {
|
|
433
|
-
return wt(t, e) === wt(n, e);
|
|
434
|
-
}
|
|
435
|
-
function Le({
|
|
436
|
-
basepath: t,
|
|
437
|
-
base: n,
|
|
438
|
-
to: e,
|
|
439
|
-
trailingSlash: o = "never"
|
|
440
|
-
}) {
|
|
441
|
-
var r, a;
|
|
442
|
-
n = Rt(t, n), e = Rt(t, e);
|
|
443
|
-
let s = dt(n);
|
|
444
|
-
const i = dt(e);
|
|
445
|
-
s.length > 1 && ((r = St(s)) == null ? void 0 : r.value) === "/" && s.pop(), i.forEach((c, u) => {
|
|
446
|
-
c.value === "/" ? u ? u === i.length - 1 && s.push(c) : s = [c] : c.value === ".." ? s.pop() : c.value === "." || s.push(c);
|
|
447
|
-
}), s.length > 1 && (((a = St(s)) == null ? void 0 : a.value) === "/" ? o === "never" && s.pop() : o === "always" && s.push({ type: "pathname", value: "/" }));
|
|
448
|
-
const l = nt([t, ...s.map((c) => c.value)]);
|
|
449
|
-
return bt(l);
|
|
450
|
-
}
|
|
451
|
-
function dt(t) {
|
|
452
|
-
if (!t)
|
|
453
|
-
return [];
|
|
454
|
-
t = bt(t);
|
|
455
|
-
const n = [];
|
|
456
|
-
if (t.slice(0, 1) === "/" && (t = t.substring(1), n.push({
|
|
457
|
-
type: "pathname",
|
|
458
|
-
value: "/"
|
|
459
|
-
})), !t)
|
|
460
|
-
return n;
|
|
461
|
-
const e = t.split("/").filter(Boolean);
|
|
462
|
-
return n.push(
|
|
463
|
-
...e.map((o) => o === "$" || o === "*" ? {
|
|
464
|
-
type: "wildcard",
|
|
465
|
-
value: o
|
|
466
|
-
} : o.charAt(0) === "$" ? {
|
|
467
|
-
type: "param",
|
|
468
|
-
value: o
|
|
469
|
-
} : {
|
|
470
|
-
type: "pathname",
|
|
471
|
-
value: decodeURIComponent(o)
|
|
472
|
-
})
|
|
473
|
-
), t.slice(-1) === "/" && (t = t.substring(1), n.push({
|
|
474
|
-
type: "pathname",
|
|
475
|
-
value: "/"
|
|
476
|
-
})), n;
|
|
477
|
-
}
|
|
478
|
-
function Tt({
|
|
479
|
-
path: t,
|
|
480
|
-
params: n,
|
|
481
|
-
leaveWildcards: e,
|
|
482
|
-
leaveParams: o
|
|
483
|
-
}) {
|
|
484
|
-
const r = dt(t), a = {};
|
|
485
|
-
for (const [s, i] of Object.entries(n)) {
|
|
486
|
-
const l = typeof i == "string";
|
|
487
|
-
["*", "_splat"].includes(s) ? a[s] = l ? encodeURI(i) : i : a[s] = l ? encodeURIComponent(i) : i;
|
|
488
|
-
}
|
|
489
|
-
return nt(
|
|
490
|
-
r.map((s) => {
|
|
491
|
-
if (s.type === "wildcard") {
|
|
492
|
-
const i = a._splat;
|
|
493
|
-
return e ? `${s.value}${i ?? ""}` : i;
|
|
494
|
-
}
|
|
495
|
-
if (s.type === "param") {
|
|
496
|
-
if (o) {
|
|
497
|
-
const i = a[s.value];
|
|
498
|
-
return `${s.value}${i ?? ""}`;
|
|
499
|
-
}
|
|
500
|
-
return a[s.value.substring(1)] ?? "undefined";
|
|
501
|
-
}
|
|
502
|
-
return s.value;
|
|
503
|
-
})
|
|
504
|
-
);
|
|
505
|
-
}
|
|
506
|
-
function vt(t, n, e) {
|
|
507
|
-
const o = Ce(t, n, e);
|
|
508
|
-
if (!(e.to && !o))
|
|
509
|
-
return o ?? {};
|
|
510
|
-
}
|
|
511
|
-
function Rt(t, n) {
|
|
512
|
-
switch (!0) {
|
|
513
|
-
case t === "/":
|
|
514
|
-
return n;
|
|
515
|
-
case n === t:
|
|
516
|
-
return "";
|
|
517
|
-
case n.length < t.length:
|
|
518
|
-
return n;
|
|
519
|
-
case n[t.length] !== "/":
|
|
520
|
-
return n;
|
|
521
|
-
case n.startsWith(t):
|
|
522
|
-
return n.slice(t.length);
|
|
523
|
-
default:
|
|
524
|
-
return n;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
function Ce(t, n, e) {
|
|
528
|
-
n = Rt(t, n);
|
|
529
|
-
const o = Rt(t, `${e.to ?? "$"}`), r = dt(n), a = dt(o);
|
|
530
|
-
n.startsWith("/") || r.unshift({
|
|
531
|
-
type: "pathname",
|
|
532
|
-
value: "/"
|
|
533
|
-
}), o.startsWith("/") || a.unshift({
|
|
534
|
-
type: "pathname",
|
|
535
|
-
value: "/"
|
|
536
|
-
});
|
|
537
|
-
const s = {};
|
|
538
|
-
return (() => {
|
|
539
|
-
for (let l = 0; l < Math.max(r.length, a.length); l++) {
|
|
540
|
-
const c = r[l], u = a[l], d = l >= r.length - 1, h = l >= a.length - 1;
|
|
541
|
-
if (u) {
|
|
542
|
-
if (u.type === "wildcard") {
|
|
543
|
-
if (c?.value) {
|
|
544
|
-
const f = decodeURI(
|
|
545
|
-
nt(r.slice(l).map((m) => m.value))
|
|
546
|
-
);
|
|
547
|
-
return s["*"] = f, s._splat = f, !0;
|
|
548
|
-
}
|
|
549
|
-
return !1;
|
|
550
|
-
}
|
|
551
|
-
if (u.type === "pathname") {
|
|
552
|
-
if (u.value === "/" && !c?.value)
|
|
553
|
-
return !0;
|
|
554
|
-
if (c) {
|
|
555
|
-
if (e.caseSensitive) {
|
|
556
|
-
if (u.value !== c.value)
|
|
557
|
-
return !1;
|
|
558
|
-
} else if (u.value.toLowerCase() !== c.value.toLowerCase())
|
|
559
|
-
return !1;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
if (!c)
|
|
563
|
-
return !1;
|
|
564
|
-
if (u.type === "param") {
|
|
565
|
-
if (c.value === "/")
|
|
566
|
-
return !1;
|
|
567
|
-
c.value.charAt(0) !== "$" && (s[u.value.substring(1)] = decodeURIComponent(
|
|
568
|
-
c.value
|
|
569
|
-
));
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
if (!d && h)
|
|
573
|
-
return s["**"] = nt(r.slice(l + 1).map((f) => f.value)), !!e.fuzzy && u?.value !== "/";
|
|
574
|
-
}
|
|
575
|
-
return !0;
|
|
576
|
-
})() ? s : void 0;
|
|
577
|
-
}
|
|
578
|
-
function st(t) {
|
|
579
|
-
return !!t?.isRedirect;
|
|
580
|
-
}
|
|
581
|
-
function zt(t) {
|
|
582
|
-
return !!t?.isRedirect && t.href;
|
|
583
|
-
}
|
|
584
|
-
function Bt(t) {
|
|
585
|
-
const n = t.errorComponent ?? Lt;
|
|
586
|
-
return /* @__PURE__ */ _(
|
|
587
|
-
Me,
|
|
588
|
-
{
|
|
589
|
-
getResetKey: t.getResetKey,
|
|
590
|
-
onCatch: t.onCatch,
|
|
591
|
-
children: ({ error: e, reset: o }) => e ? L.createElement(n, {
|
|
592
|
-
error: e,
|
|
593
|
-
reset: o
|
|
594
|
-
}) : t.children
|
|
595
|
-
}
|
|
596
|
-
);
|
|
597
|
-
}
|
|
598
|
-
class Me extends L.Component {
|
|
599
|
-
constructor() {
|
|
600
|
-
super(...arguments), this.state = { error: null };
|
|
601
|
-
}
|
|
602
|
-
static getDerivedStateFromProps(n) {
|
|
603
|
-
return { resetKey: n.getResetKey() };
|
|
604
|
-
}
|
|
605
|
-
static getDerivedStateFromError(n) {
|
|
606
|
-
return { error: n };
|
|
607
|
-
}
|
|
608
|
-
reset() {
|
|
609
|
-
this.setState({ error: null });
|
|
610
|
-
}
|
|
611
|
-
componentDidUpdate(n, e) {
|
|
612
|
-
e.error && e.resetKey !== this.state.resetKey && this.reset();
|
|
613
|
-
}
|
|
614
|
-
componentDidCatch(n, e) {
|
|
615
|
-
this.props.onCatch && this.props.onCatch(n, e);
|
|
616
|
-
}
|
|
617
|
-
render() {
|
|
618
|
-
return this.props.children({
|
|
619
|
-
error: this.state.resetKey !== this.props.getResetKey() ? null : this.state.error,
|
|
620
|
-
reset: () => {
|
|
621
|
-
this.reset();
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
function Lt({ error: t }) {
|
|
627
|
-
const [n, e] = L.useState(!1);
|
|
628
|
-
return /* @__PURE__ */ yt("div", { style: { padding: ".5rem", maxWidth: "100%" }, children: [
|
|
629
|
-
/* @__PURE__ */ yt("div", { style: { display: "flex", alignItems: "center", gap: ".5rem" }, children: [
|
|
630
|
-
/* @__PURE__ */ _("strong", { style: { fontSize: "1rem" }, children: "Something went wrong!" }),
|
|
631
|
-
/* @__PURE__ */ _(
|
|
632
|
-
"button",
|
|
633
|
-
{
|
|
634
|
-
style: {
|
|
635
|
-
appearance: "none",
|
|
636
|
-
fontSize: ".6em",
|
|
637
|
-
border: "1px solid currentColor",
|
|
638
|
-
padding: ".1rem .2rem",
|
|
639
|
-
fontWeight: "bold",
|
|
640
|
-
borderRadius: ".25rem"
|
|
641
|
-
},
|
|
642
|
-
onClick: () => e((o) => !o),
|
|
643
|
-
children: n ? "Hide Error" : "Show Error"
|
|
644
|
-
}
|
|
645
|
-
)
|
|
646
|
-
] }),
|
|
647
|
-
/* @__PURE__ */ _("div", { style: { height: ".25rem" } }),
|
|
648
|
-
n ? /* @__PURE__ */ _("div", { children: /* @__PURE__ */ _(
|
|
649
|
-
"pre",
|
|
650
|
-
{
|
|
651
|
-
style: {
|
|
652
|
-
fontSize: ".7em",
|
|
653
|
-
border: "1px solid red",
|
|
654
|
-
borderRadius: ".25rem",
|
|
655
|
-
padding: ".3rem",
|
|
656
|
-
color: "red",
|
|
657
|
-
overflow: "auto"
|
|
658
|
-
},
|
|
659
|
-
children: t.message ? /* @__PURE__ */ _("code", { children: t.message }) : null
|
|
660
|
-
}
|
|
661
|
-
) }) : null
|
|
662
|
-
] });
|
|
663
|
-
}
|
|
664
|
-
function D(t) {
|
|
665
|
-
const n = tt({
|
|
666
|
-
warn: t?.router === void 0
|
|
667
|
-
});
|
|
668
|
-
return pe((t?.router || n).__store, t?.select);
|
|
669
|
-
}
|
|
670
|
-
function lo(t = {}) {
|
|
671
|
-
if (t.isNotFound = !0, t.throw) throw t;
|
|
672
|
-
return t;
|
|
673
|
-
}
|
|
674
|
-
function Q(t) {
|
|
675
|
-
return !!t?.isNotFound;
|
|
676
|
-
}
|
|
677
|
-
function Ee(t) {
|
|
678
|
-
const n = D({
|
|
679
|
-
select: (e) => `not-found-${e.location.pathname}-${e.status}`
|
|
680
|
-
});
|
|
681
|
-
return /* @__PURE__ */ _(
|
|
682
|
-
Bt,
|
|
683
|
-
{
|
|
684
|
-
getResetKey: () => n,
|
|
685
|
-
onCatch: (e, o) => {
|
|
686
|
-
var r;
|
|
687
|
-
if (Q(e))
|
|
688
|
-
(r = t.onCatch) == null || r.call(t, e, o);
|
|
689
|
-
else
|
|
690
|
-
throw e;
|
|
691
|
-
},
|
|
692
|
-
errorComponent: ({ error: e }) => {
|
|
693
|
-
var o;
|
|
694
|
-
return (o = t.fallback) == null ? void 0 : o.call(t, e);
|
|
695
|
-
},
|
|
696
|
-
children: t.children
|
|
697
|
-
}
|
|
698
|
-
);
|
|
699
|
-
}
|
|
700
|
-
function xe() {
|
|
701
|
-
return /* @__PURE__ */ _("p", { children: "Not Found" });
|
|
702
|
-
}
|
|
703
|
-
const Ie = [
|
|
704
|
-
"component",
|
|
705
|
-
"errorComponent",
|
|
706
|
-
"pendingComponent",
|
|
707
|
-
"notFoundComponent"
|
|
708
|
-
];
|
|
709
|
-
function uo(t) {
|
|
710
|
-
return new Te(t);
|
|
711
|
-
}
|
|
712
|
-
class Te {
|
|
713
|
-
/**
|
|
714
|
-
* @deprecated Use the `createRouter` function instead
|
|
715
|
-
*/
|
|
716
|
-
constructor(n) {
|
|
717
|
-
this.tempLocationKey = `${Math.round(
|
|
718
|
-
Math.random() * 1e7
|
|
719
|
-
)}`, this.resetNextScroll = !0, this.shouldViewTransition = void 0, this.subscribers = /* @__PURE__ */ new Set(), this.startReactTransition = (e) => e(), this.update = (e) => {
|
|
720
|
-
e.notFoundRoute && console.warn(
|
|
721
|
-
"The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info."
|
|
722
|
-
);
|
|
723
|
-
const o = this.options;
|
|
724
|
-
this.options = {
|
|
725
|
-
...this.options,
|
|
726
|
-
...e
|
|
727
|
-
}, this.isServer = this.options.isServer ?? typeof document > "u", (!this.basepath || e.basepath && e.basepath !== o.basepath) && (e.basepath === void 0 || e.basepath === "" || e.basepath === "/" ? this.basepath = "/" : this.basepath = `/${Re(e.basepath)}`), // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
728
|
-
(!this.history || this.options.history && this.options.history !== this.history) && (this.history = this.options.history ?? (this.isServer ? ue({
|
|
729
|
-
initialEntries: [this.basepath || "/"]
|
|
730
|
-
}) : Jt()), this.latestLocation = this.parseLocation()), this.options.routeTree !== this.routeTree && (this.routeTree = this.options.routeTree, this.buildRouteTree()), this.__store || (this.__store = new fe(Oe(this.latestLocation), {
|
|
731
|
-
onUpdate: () => {
|
|
732
|
-
this.__store.state = {
|
|
733
|
-
...this.state,
|
|
734
|
-
cachedMatches: this.state.cachedMatches.filter(
|
|
735
|
-
(r) => !["redirected"].includes(r.status)
|
|
736
|
-
)
|
|
737
|
-
};
|
|
738
|
-
}
|
|
739
|
-
}));
|
|
740
|
-
}, this.buildRouteTree = () => {
|
|
741
|
-
this.routesById = {}, this.routesByPath = {};
|
|
742
|
-
const e = this.options.notFoundRoute;
|
|
743
|
-
e && (e.init({ originalIndex: 99999999999 }), this.routesById[e.id] = e);
|
|
744
|
-
const o = (s) => {
|
|
745
|
-
s.forEach((i, l) => {
|
|
746
|
-
i.init({ originalIndex: l });
|
|
747
|
-
const c = this.routesById[i.id];
|
|
748
|
-
if (H(
|
|
749
|
-
!c,
|
|
750
|
-
`Duplicate routes found with id: ${String(i.id)}`
|
|
751
|
-
), this.routesById[i.id] = i, !i.isRoot && i.path) {
|
|
752
|
-
const d = at(i.fullPath);
|
|
753
|
-
(!this.routesByPath[d] || i.fullPath.endsWith("/")) && (this.routesByPath[d] = i);
|
|
754
|
-
}
|
|
755
|
-
const u = i.children;
|
|
756
|
-
u?.length && o(u);
|
|
757
|
-
});
|
|
758
|
-
};
|
|
759
|
-
o([this.routeTree]);
|
|
760
|
-
const r = [];
|
|
761
|
-
Object.values(this.routesById).forEach((s, i) => {
|
|
762
|
-
var l;
|
|
763
|
-
if (s.isRoot || !s.path)
|
|
764
|
-
return;
|
|
765
|
-
const c = Ot(s.fullPath), u = dt(c);
|
|
766
|
-
for (; u.length > 1 && ((l = u[0]) == null ? void 0 : l.value) === "/"; )
|
|
767
|
-
u.shift();
|
|
768
|
-
const d = u.map((h) => h.value === "/" ? 0.75 : h.type === "param" ? 0.5 : h.type === "wildcard" ? 0.25 : 1);
|
|
769
|
-
r.push({ child: s, trimmed: c, parsed: u, index: i, scores: d });
|
|
770
|
-
}), this.flatRoutes = r.sort((s, i) => {
|
|
771
|
-
const l = Math.min(s.scores.length, i.scores.length);
|
|
772
|
-
for (let c = 0; c < l; c++)
|
|
773
|
-
if (s.scores[c] !== i.scores[c])
|
|
774
|
-
return i.scores[c] - s.scores[c];
|
|
775
|
-
if (s.scores.length !== i.scores.length)
|
|
776
|
-
return i.scores.length - s.scores.length;
|
|
777
|
-
for (let c = 0; c < l; c++)
|
|
778
|
-
if (s.parsed[c].value !== i.parsed[c].value)
|
|
779
|
-
return s.parsed[c].value > i.parsed[c].value ? 1 : -1;
|
|
780
|
-
return s.index - i.index;
|
|
781
|
-
}).map((s, i) => (s.child.rank = i, s.child));
|
|
782
|
-
}, this.subscribe = (e, o) => {
|
|
783
|
-
const r = {
|
|
784
|
-
eventType: e,
|
|
785
|
-
fn: o
|
|
786
|
-
};
|
|
787
|
-
return this.subscribers.add(r), () => {
|
|
788
|
-
this.subscribers.delete(r);
|
|
789
|
-
};
|
|
790
|
-
}, this.emit = (e) => {
|
|
791
|
-
this.subscribers.forEach((o) => {
|
|
792
|
-
o.eventType === e.type && o.fn(e);
|
|
793
|
-
});
|
|
794
|
-
}, this.parseLocation = (e) => {
|
|
795
|
-
const o = ({
|
|
796
|
-
pathname: i,
|
|
797
|
-
search: l,
|
|
798
|
-
hash: c,
|
|
799
|
-
state: u
|
|
800
|
-
}) => {
|
|
801
|
-
const d = this.options.parseSearch(l), h = this.options.stringifySearch(d);
|
|
802
|
-
return {
|
|
803
|
-
pathname: i,
|
|
804
|
-
searchStr: h,
|
|
805
|
-
search: Y(e?.search, d),
|
|
806
|
-
hash: c.split("#").reverse()[0] ?? "",
|
|
807
|
-
href: `${i}${h}${c}`,
|
|
808
|
-
state: Y(e?.state, u)
|
|
809
|
-
};
|
|
810
|
-
}, r = o(this.history.location), { __tempLocation: a, __tempKey: s } = r.state;
|
|
811
|
-
if (a && (!s || s === this.tempLocationKey)) {
|
|
812
|
-
const i = o(a);
|
|
813
|
-
return i.state.key = r.state.key, delete i.state.__tempLocation, {
|
|
814
|
-
...i,
|
|
815
|
-
maskedLocation: r
|
|
816
|
-
};
|
|
817
|
-
}
|
|
818
|
-
return r;
|
|
819
|
-
}, this.resolvePathWithBase = (e, o) => Le({
|
|
820
|
-
basepath: this.basepath,
|
|
821
|
-
base: e,
|
|
822
|
-
to: bt(o),
|
|
823
|
-
trailingSlash: this.options.trailingSlash
|
|
824
|
-
}), this.matchRoutes = (e, o, r) => {
|
|
825
|
-
let a = {};
|
|
826
|
-
const s = this.flatRoutes.find((f) => {
|
|
827
|
-
const m = vt(
|
|
828
|
-
this.basepath,
|
|
829
|
-
at(e),
|
|
830
|
-
{
|
|
831
|
-
to: f.fullPath,
|
|
832
|
-
caseSensitive: f.options.caseSensitive ?? this.options.caseSensitive,
|
|
833
|
-
fuzzy: !0
|
|
834
|
-
}
|
|
835
|
-
);
|
|
836
|
-
return m ? (a = m, !0) : !1;
|
|
837
|
-
});
|
|
838
|
-
let i = s || this.routesById[W];
|
|
839
|
-
const l = [i];
|
|
840
|
-
let c = !1;
|
|
841
|
-
for (// If we found a route, and it's not an index route and we have left over path
|
|
842
|
-
(s ? s.path !== "/" && a["**"] : (
|
|
843
|
-
// Or if we didn't find a route and we have left over path
|
|
844
|
-
at(e)
|
|
845
|
-
)) && (this.options.notFoundRoute ? l.push(this.options.notFoundRoute) : c = !0); i.parentRoute; )
|
|
846
|
-
i = i.parentRoute, l.unshift(i);
|
|
847
|
-
const u = (() => {
|
|
848
|
-
if (c) {
|
|
849
|
-
if (this.options.notFoundMode !== "root")
|
|
850
|
-
for (let f = l.length - 1; f >= 0; f--) {
|
|
851
|
-
const m = l[f];
|
|
852
|
-
if (m.children)
|
|
853
|
-
return m.id;
|
|
854
|
-
}
|
|
855
|
-
return W;
|
|
856
|
-
}
|
|
857
|
-
})(), d = l.map((f) => {
|
|
858
|
-
var m;
|
|
859
|
-
let p;
|
|
860
|
-
const v = ((m = f.options.params) == null ? void 0 : m.parse) ?? f.options.parseParams;
|
|
861
|
-
if (v)
|
|
862
|
-
try {
|
|
863
|
-
const S = v(a);
|
|
864
|
-
Object.assign(a, S);
|
|
865
|
-
} catch (S) {
|
|
866
|
-
if (p = new ke(S.message, {
|
|
867
|
-
cause: S
|
|
868
|
-
}), r?.throwOnError)
|
|
869
|
-
throw p;
|
|
870
|
-
return p;
|
|
871
|
-
}
|
|
872
|
-
}), h = [];
|
|
873
|
-
return l.forEach((f, m) => {
|
|
874
|
-
var p, v, S, b, g, P, M, k, w, y;
|
|
875
|
-
const N = h[m - 1], [A, B] = (() => {
|
|
876
|
-
const x = N?.search ?? o;
|
|
877
|
-
try {
|
|
878
|
-
const j = typeof f.options.validateSearch == "object" ? f.options.validateSearch.parse : f.options.validateSearch, z = j?.(x) ?? {};
|
|
879
|
-
return [
|
|
880
|
-
{
|
|
881
|
-
...x,
|
|
882
|
-
...z
|
|
883
|
-
},
|
|
884
|
-
void 0
|
|
885
|
-
];
|
|
886
|
-
} catch (j) {
|
|
887
|
-
const z = new Fe(j.message, {
|
|
888
|
-
cause: j
|
|
889
|
-
});
|
|
890
|
-
if (r?.throwOnError)
|
|
891
|
-
throw z;
|
|
892
|
-
return [x, z];
|
|
893
|
-
}
|
|
894
|
-
})(), T = ((v = (p = f.options).loaderDeps) == null ? void 0 : v.call(p, {
|
|
895
|
-
search: A
|
|
896
|
-
})) ?? "", R = T ? JSON.stringify(T) : "", O = Tt({
|
|
897
|
-
path: f.fullPath,
|
|
898
|
-
params: a
|
|
899
|
-
}), $ = Tt({
|
|
900
|
-
path: f.id,
|
|
901
|
-
params: a,
|
|
902
|
-
leaveWildcards: !0
|
|
903
|
-
}) + R, K = this.getMatch($), J = this.state.matches.find((x) => x.id === $) ? "stay" : "enter";
|
|
904
|
-
let E;
|
|
905
|
-
if (K)
|
|
906
|
-
E = {
|
|
907
|
-
...K,
|
|
908
|
-
cause: J,
|
|
909
|
-
params: a
|
|
910
|
-
};
|
|
911
|
-
else {
|
|
912
|
-
const x = f.options.loader || f.options.beforeLoad || f.lazyFn ? "pending" : "success";
|
|
913
|
-
E = {
|
|
914
|
-
id: $,
|
|
915
|
-
index: m,
|
|
916
|
-
routeId: f.id,
|
|
917
|
-
params: a,
|
|
918
|
-
pathname: nt([this.basepath, O]),
|
|
919
|
-
updatedAt: Date.now(),
|
|
920
|
-
search: {},
|
|
921
|
-
searchError: void 0,
|
|
922
|
-
status: x,
|
|
923
|
-
isFetching: !1,
|
|
924
|
-
error: void 0,
|
|
925
|
-
paramsError: d[m],
|
|
926
|
-
routeContext: void 0,
|
|
927
|
-
context: void 0,
|
|
928
|
-
abortController: new AbortController(),
|
|
929
|
-
fetchCount: 0,
|
|
930
|
-
cause: J,
|
|
931
|
-
loaderDeps: T,
|
|
932
|
-
invalid: !1,
|
|
933
|
-
preload: !1,
|
|
934
|
-
links: (b = (S = f.options).links) == null ? void 0 : b.call(S),
|
|
935
|
-
scripts: (P = (g = f.options).scripts) == null ? void 0 : P.call(g),
|
|
936
|
-
staticData: f.options.staticData || {},
|
|
937
|
-
loadPromise: ct()
|
|
938
|
-
};
|
|
939
|
-
}
|
|
940
|
-
E.status === "success" && (E.meta = (k = (M = f.options).meta) == null ? void 0 : k.call(M, {
|
|
941
|
-
matches: h,
|
|
942
|
-
match: E,
|
|
943
|
-
params: E.params,
|
|
944
|
-
loaderData: E.loaderData
|
|
945
|
-
}), E.headers = (y = (w = f.options).headers) == null ? void 0 : y.call(w, {
|
|
946
|
-
loaderData: E.loaderData
|
|
947
|
-
})), r?.preload || (E.globalNotFound = u === f.id), E.search = Y(E.search, A), E.searchError = B, h.push(E);
|
|
948
|
-
}), h;
|
|
949
|
-
}, this.cancelMatch = (e) => {
|
|
950
|
-
const o = this.getMatch(e);
|
|
951
|
-
o && (o.abortController.abort(), clearTimeout(o.pendingTimeout));
|
|
952
|
-
}, this.cancelMatches = () => {
|
|
953
|
-
var e;
|
|
954
|
-
(e = this.state.pendingMatches) == null || e.forEach((o) => {
|
|
955
|
-
this.cancelMatch(o.id);
|
|
956
|
-
});
|
|
957
|
-
}, this.buildLocation = (e) => {
|
|
958
|
-
const o = (a = {}, s) => {
|
|
959
|
-
var i, l, c;
|
|
960
|
-
const u = a._fromLocation != null ? this.matchRoutes(
|
|
961
|
-
a._fromLocation.pathname,
|
|
962
|
-
a.fromSearch || a._fromLocation.search
|
|
963
|
-
) : this.state.matches, d = a.from != null ? u.find(
|
|
964
|
-
(R) => vt(this.basepath, at(R.pathname), {
|
|
965
|
-
to: a.from,
|
|
966
|
-
caseSensitive: !1,
|
|
967
|
-
fuzzy: !1
|
|
968
|
-
})
|
|
969
|
-
) : void 0, h = d?.pathname || this.latestLocation.pathname;
|
|
970
|
-
H(
|
|
971
|
-
a.from == null || d != null,
|
|
972
|
-
"Could not find match for from: " + a.from
|
|
973
|
-
);
|
|
974
|
-
const f = ((i = St(u)) == null ? void 0 : i.search) || this.latestLocation.search, m = s?.filter(
|
|
975
|
-
(R) => u.find((O) => O.routeId === R.routeId)
|
|
976
|
-
), p = this.routesById[(l = m?.find((R) => R.pathname === h)) == null ? void 0 : l.routeId];
|
|
977
|
-
let v = a.to ? this.resolvePathWithBase(h, `${a.to}`) : this.resolvePathWithBase(
|
|
978
|
-
h,
|
|
979
|
-
p?.to ?? h
|
|
980
|
-
);
|
|
981
|
-
const S = { ...(c = St(u)) == null ? void 0 : c.params };
|
|
982
|
-
let b = (a.params ?? !0) === !0 ? S : { ...S, ...it(a.params, S) };
|
|
983
|
-
Object.keys(b).length > 0 && s?.map((R) => {
|
|
984
|
-
var O;
|
|
985
|
-
const $ = this.looseRoutesById[R.routeId];
|
|
986
|
-
return ((O = $?.options.params) == null ? void 0 : O.stringify) ?? $.options.stringifyParams;
|
|
987
|
-
}).filter(Boolean).forEach((R) => {
|
|
988
|
-
b = { ...b, ...R(b) };
|
|
989
|
-
}), v = Tt({
|
|
990
|
-
path: v,
|
|
991
|
-
params: b ?? {},
|
|
992
|
-
leaveWildcards: !1,
|
|
993
|
-
leaveParams: e.leaveParams
|
|
994
|
-
});
|
|
995
|
-
const g = m?.map(
|
|
996
|
-
(R) => this.looseRoutesById[R.routeId].options.preSearchFilters ?? []
|
|
997
|
-
).flat().filter(Boolean) ?? [], P = m?.map(
|
|
998
|
-
(R) => this.looseRoutesById[R.routeId].options.postSearchFilters ?? []
|
|
999
|
-
).flat().filter(Boolean) ?? [], M = g.length ? g.reduce((R, O) => O(R), f) : f, k = a.search === !0 ? M : a.search ? it(a.search, M) : g.length ? M : {}, w = P.length ? P.reduce((R, O) => O(R), k) : k, y = Y(f, w), N = this.options.stringifySearch(y), A = a.hash === !0 ? this.latestLocation.hash : a.hash ? it(a.hash, this.latestLocation.hash) : void 0, B = A ? `#${A}` : "";
|
|
1000
|
-
let T = a.state === !0 ? this.latestLocation.state : a.state ? it(a.state, this.latestLocation.state) : {};
|
|
1001
|
-
return T = Y(this.latestLocation.state, T), {
|
|
1002
|
-
pathname: v,
|
|
1003
|
-
search: y,
|
|
1004
|
-
searchStr: N,
|
|
1005
|
-
state: T,
|
|
1006
|
-
hash: A ?? "",
|
|
1007
|
-
href: `${v}${N}${B}`,
|
|
1008
|
-
unmaskOnReload: a.unmaskOnReload
|
|
1009
|
-
};
|
|
1010
|
-
}, r = (a = {}, s) => {
|
|
1011
|
-
var i;
|
|
1012
|
-
const l = o(a);
|
|
1013
|
-
let c = s ? o(s) : void 0;
|
|
1014
|
-
if (!c) {
|
|
1015
|
-
let m = {};
|
|
1016
|
-
const p = (i = this.options.routeMasks) == null ? void 0 : i.find((v) => {
|
|
1017
|
-
const S = vt(this.basepath, l.pathname, {
|
|
1018
|
-
to: v.from,
|
|
1019
|
-
caseSensitive: !1,
|
|
1020
|
-
fuzzy: !1
|
|
1021
|
-
});
|
|
1022
|
-
return S ? (m = S, !0) : !1;
|
|
1023
|
-
});
|
|
1024
|
-
if (p) {
|
|
1025
|
-
const { from: v, ...S } = p;
|
|
1026
|
-
s = {
|
|
1027
|
-
...pt(e, ["from"]),
|
|
1028
|
-
...S,
|
|
1029
|
-
params: m
|
|
1030
|
-
}, c = o(s);
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
const u = this.matchRoutes(l.pathname, l.search), d = c ? this.matchRoutes(c.pathname, c.search) : void 0, h = c ? o(s, d) : void 0, f = o(a, u);
|
|
1034
|
-
return h && (f.maskedLocation = h), f;
|
|
1035
|
-
};
|
|
1036
|
-
return e.mask ? r(e, {
|
|
1037
|
-
...pt(e, ["from"]),
|
|
1038
|
-
...e.mask
|
|
1039
|
-
}) : r(e);
|
|
1040
|
-
}, this.commitLocation = ({
|
|
1041
|
-
viewTransition: e,
|
|
1042
|
-
ignoreBlocker: o,
|
|
1043
|
-
...r
|
|
1044
|
-
}) => {
|
|
1045
|
-
const a = () => {
|
|
1046
|
-
r.state.key = this.latestLocation.state.key;
|
|
1047
|
-
const l = lt(r.state, this.latestLocation.state);
|
|
1048
|
-
return delete r.state.key, l;
|
|
1049
|
-
}, s = this.latestLocation.href === r.href, i = this.commitLocationPromise;
|
|
1050
|
-
if (this.commitLocationPromise = ct(() => {
|
|
1051
|
-
i?.resolve();
|
|
1052
|
-
}), s && a())
|
|
1053
|
-
this.load();
|
|
1054
|
-
else {
|
|
1055
|
-
let { maskedLocation: l, ...c } = r;
|
|
1056
|
-
l && (c = {
|
|
1057
|
-
...l,
|
|
1058
|
-
state: {
|
|
1059
|
-
...l.state,
|
|
1060
|
-
__tempKey: void 0,
|
|
1061
|
-
__tempLocation: {
|
|
1062
|
-
...c,
|
|
1063
|
-
search: c.searchStr,
|
|
1064
|
-
state: {
|
|
1065
|
-
...c.state,
|
|
1066
|
-
__tempKey: void 0,
|
|
1067
|
-
__tempLocation: void 0,
|
|
1068
|
-
key: void 0
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
}, (c.unmaskOnReload ?? this.options.unmaskOnReload ?? !1) && (c.state.__tempKey = this.tempLocationKey)), this.shouldViewTransition = e, this.history[r.replace ? "replace" : "push"](
|
|
1073
|
-
c.href,
|
|
1074
|
-
c.state,
|
|
1075
|
-
{ ignoreBlocker: o }
|
|
1076
|
-
);
|
|
1077
|
-
}
|
|
1078
|
-
return this.resetNextScroll = r.resetScroll ?? !0, this.history.subscribers.size || this.load(), this.commitLocationPromise;
|
|
1079
|
-
}, this.buildAndCommitLocation = ({
|
|
1080
|
-
replace: e,
|
|
1081
|
-
resetScroll: o,
|
|
1082
|
-
viewTransition: r,
|
|
1083
|
-
ignoreBlocker: a,
|
|
1084
|
-
...s
|
|
1085
|
-
} = {}) => {
|
|
1086
|
-
const i = this.buildLocation(s);
|
|
1087
|
-
return this.commitLocation({
|
|
1088
|
-
...i,
|
|
1089
|
-
viewTransition: r,
|
|
1090
|
-
replace: e,
|
|
1091
|
-
resetScroll: o,
|
|
1092
|
-
ignoreBlocker: a
|
|
1093
|
-
});
|
|
1094
|
-
}, this.navigate = ({ from: e, to: o, __isRedirect: r, ...a }) => {
|
|
1095
|
-
const s = String(o);
|
|
1096
|
-
let i;
|
|
1097
|
-
try {
|
|
1098
|
-
new URL(`${s}`), i = !0;
|
|
1099
|
-
} catch {
|
|
1100
|
-
}
|
|
1101
|
-
return H(
|
|
1102
|
-
!i,
|
|
1103
|
-
"Attempting to navigate to external url with router.navigate!"
|
|
1104
|
-
), this.buildAndCommitLocation({
|
|
1105
|
-
...a,
|
|
1106
|
-
from: e,
|
|
1107
|
-
to: o
|
|
1108
|
-
// to: toString,
|
|
1109
|
-
});
|
|
1110
|
-
}, this.load = async () => {
|
|
1111
|
-
this.latestLocation = this.parseLocation(this.latestLocation), this.__store.setState((a) => ({
|
|
1112
|
-
...a,
|
|
1113
|
-
loadedAt: Date.now()
|
|
1114
|
-
}));
|
|
1115
|
-
let e, o;
|
|
1116
|
-
const r = new Promise((a) => {
|
|
1117
|
-
this.startReactTransition(async () => {
|
|
1118
|
-
var s;
|
|
1119
|
-
try {
|
|
1120
|
-
const i = this.latestLocation, l = this.state.resolvedLocation, c = l.href !== i.href;
|
|
1121
|
-
this.cancelMatches();
|
|
1122
|
-
let u;
|
|
1123
|
-
this.__store.batch(() => {
|
|
1124
|
-
u = this.matchRoutes(i.pathname, i.search), this.__store.setState((d) => ({
|
|
1125
|
-
...d,
|
|
1126
|
-
status: "pending",
|
|
1127
|
-
isLoading: !0,
|
|
1128
|
-
location: i,
|
|
1129
|
-
pendingMatches: u,
|
|
1130
|
-
// If a cached moved to pendingMatches, remove it from cachedMatches
|
|
1131
|
-
cachedMatches: d.cachedMatches.filter((h) => !u.find((f) => f.id === h.id))
|
|
1132
|
-
}));
|
|
1133
|
-
}), this.state.redirect || this.emit({
|
|
1134
|
-
type: "onBeforeNavigate",
|
|
1135
|
-
fromLocation: l,
|
|
1136
|
-
toLocation: i,
|
|
1137
|
-
pathChanged: c
|
|
1138
|
-
}), this.emit({
|
|
1139
|
-
type: "onBeforeLoad",
|
|
1140
|
-
fromLocation: l,
|
|
1141
|
-
toLocation: i,
|
|
1142
|
-
pathChanged: c
|
|
1143
|
-
}), await this.loadMatches({
|
|
1144
|
-
matches: u,
|
|
1145
|
-
location: i,
|
|
1146
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
1147
|
-
onReady: async () => {
|
|
1148
|
-
this.startViewTransition(async () => {
|
|
1149
|
-
let d, h, f;
|
|
1150
|
-
this.__store.batch(() => {
|
|
1151
|
-
this.__store.setState((m) => {
|
|
1152
|
-
const p = m.matches, v = m.pendingMatches || m.matches;
|
|
1153
|
-
return d = p.filter(
|
|
1154
|
-
(S) => !v.find((b) => b.id === S.id)
|
|
1155
|
-
), h = v.filter(
|
|
1156
|
-
(S) => !p.find((b) => b.id === S.id)
|
|
1157
|
-
), f = p.filter(
|
|
1158
|
-
(S) => v.find((b) => b.id === S.id)
|
|
1159
|
-
), {
|
|
1160
|
-
...m,
|
|
1161
|
-
isLoading: !1,
|
|
1162
|
-
matches: v,
|
|
1163
|
-
pendingMatches: void 0,
|
|
1164
|
-
cachedMatches: [
|
|
1165
|
-
...m.cachedMatches,
|
|
1166
|
-
...d.filter((S) => S.status !== "error")
|
|
1167
|
-
]
|
|
1168
|
-
};
|
|
1169
|
-
}), this.cleanCache();
|
|
1170
|
-
}), [
|
|
1171
|
-
[d, "onLeave"],
|
|
1172
|
-
[h, "onEnter"],
|
|
1173
|
-
[f, "onStay"]
|
|
1174
|
-
].forEach(([m, p]) => {
|
|
1175
|
-
m.forEach((v) => {
|
|
1176
|
-
var S, b;
|
|
1177
|
-
(b = (S = this.looseRoutesById[v.routeId].options)[p]) == null || b.call(S, v);
|
|
1178
|
-
});
|
|
1179
|
-
});
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
});
|
|
1183
|
-
} catch (i) {
|
|
1184
|
-
zt(i) ? (e = i, this.isServer || this.navigate({ ...i, replace: !0, __isRedirect: !0 })) : Q(i) && (o = i), this.__store.setState((l) => ({
|
|
1185
|
-
...l,
|
|
1186
|
-
statusCode: e ? e.statusCode : o ? 404 : l.matches.some((c) => c.status === "error") ? 500 : 200,
|
|
1187
|
-
redirect: e
|
|
1188
|
-
}));
|
|
1189
|
-
}
|
|
1190
|
-
this.latestLoadPromise === r && ((s = this.commitLocationPromise) == null || s.resolve(), this.latestLoadPromise = void 0, this.commitLocationPromise = void 0), a();
|
|
1191
|
-
});
|
|
1192
|
-
});
|
|
1193
|
-
for (this.latestLoadPromise = r, await r; this.latestLoadPromise && r !== this.latestLoadPromise; )
|
|
1194
|
-
await this.latestLoadPromise;
|
|
1195
|
-
}, this.startViewTransition = (e) => {
|
|
1196
|
-
var o, r;
|
|
1197
|
-
const a = this.shouldViewTransition ?? this.options.defaultViewTransition;
|
|
1198
|
-
delete this.shouldViewTransition, (r = (o = a && typeof document < "u" ? document : void 0) == null ? void 0 : o.startViewTransition) != null && r.call(o, e) || e();
|
|
1199
|
-
}, this.updateMatch = (e, o) => {
|
|
1200
|
-
var r;
|
|
1201
|
-
let a;
|
|
1202
|
-
const s = (r = this.state.pendingMatches) == null ? void 0 : r.find((c) => c.id === e), i = this.state.matches.find((c) => c.id === e), l = s ? "pendingMatches" : i ? "matches" : "cachedMatches";
|
|
1203
|
-
return this.__store.setState((c) => {
|
|
1204
|
-
var u;
|
|
1205
|
-
return {
|
|
1206
|
-
...c,
|
|
1207
|
-
[l]: (u = c[l]) == null ? void 0 : u.map(
|
|
1208
|
-
(d) => d.id === e ? a = o(d) : d
|
|
1209
|
-
)
|
|
1210
|
-
};
|
|
1211
|
-
}), a;
|
|
1212
|
-
}, this.getMatch = (e) => [
|
|
1213
|
-
...this.state.cachedMatches,
|
|
1214
|
-
...this.state.pendingMatches ?? [],
|
|
1215
|
-
...this.state.matches
|
|
1216
|
-
].find((o) => o.id === e), this.loadMatches = async ({
|
|
1217
|
-
location: e,
|
|
1218
|
-
matches: o,
|
|
1219
|
-
preload: r,
|
|
1220
|
-
onReady: a,
|
|
1221
|
-
updateMatch: s = this.updateMatch
|
|
1222
|
-
}) => {
|
|
1223
|
-
let i, l = !1;
|
|
1224
|
-
const c = async () => {
|
|
1225
|
-
l || (l = !0, await a?.());
|
|
1226
|
-
};
|
|
1227
|
-
!this.isServer && !this.state.matches.length && c();
|
|
1228
|
-
const u = (d, h) => {
|
|
1229
|
-
var f, m, p;
|
|
1230
|
-
if (zt(h)) throw h;
|
|
1231
|
-
if (st(h) || Q(h)) {
|
|
1232
|
-
if (s(d.id, (v) => ({
|
|
1233
|
-
...v,
|
|
1234
|
-
status: st(h) ? "redirected" : Q(h) ? "notFound" : "error",
|
|
1235
|
-
isFetching: !1,
|
|
1236
|
-
error: h,
|
|
1237
|
-
beforeLoadPromise: void 0,
|
|
1238
|
-
loaderPromise: void 0
|
|
1239
|
-
})), h.routeId || (h.routeId = d.routeId), (f = d.beforeLoadPromise) == null || f.resolve(), (m = d.loaderPromise) == null || m.resolve(), (p = d.loadPromise) == null || p.resolve(), st(h))
|
|
1240
|
-
throw l = !0, h = this.resolveRedirect({ ...h, _fromLocation: e }), h;
|
|
1241
|
-
if (Q(h))
|
|
1242
|
-
throw this._handleNotFound(o, h, {
|
|
1243
|
-
updateMatch: s
|
|
1244
|
-
}), h;
|
|
1245
|
-
}
|
|
1246
|
-
};
|
|
1247
|
-
try {
|
|
1248
|
-
await new Promise((d, h) => {
|
|
1249
|
-
(async () => {
|
|
1250
|
-
var f, m, p;
|
|
1251
|
-
try {
|
|
1252
|
-
const v = (g, P, M) => {
|
|
1253
|
-
var k, w;
|
|
1254
|
-
const { id: y, routeId: N } = o[g], A = this.looseRoutesById[N];
|
|
1255
|
-
if (P instanceof Promise)
|
|
1256
|
-
throw P;
|
|
1257
|
-
P.routerCode = M, i = i ?? g, u(this.getMatch(y), P);
|
|
1258
|
-
try {
|
|
1259
|
-
(w = (k = A.options).onError) == null || w.call(k, P);
|
|
1260
|
-
} catch (B) {
|
|
1261
|
-
P = B, u(this.getMatch(y), P);
|
|
1262
|
-
}
|
|
1263
|
-
s(y, (B) => {
|
|
1264
|
-
var T;
|
|
1265
|
-
return (T = B.beforeLoadPromise) == null || T.resolve(), {
|
|
1266
|
-
...B,
|
|
1267
|
-
error: P,
|
|
1268
|
-
status: "error",
|
|
1269
|
-
isFetching: !1,
|
|
1270
|
-
updatedAt: Date.now(),
|
|
1271
|
-
abortController: new AbortController(),
|
|
1272
|
-
beforeLoadPromise: void 0
|
|
1273
|
-
};
|
|
1274
|
-
});
|
|
1275
|
-
};
|
|
1276
|
-
for (const [g, { id: P, routeId: M }] of o.entries()) {
|
|
1277
|
-
const k = this.getMatch(P);
|
|
1278
|
-
if (
|
|
1279
|
-
// If we are in the middle of a load, either of these will be present
|
|
1280
|
-
// (not to be confused with `loadPromise`, which is always defined)
|
|
1281
|
-
k.beforeLoadPromise || k.loaderPromise
|
|
1282
|
-
)
|
|
1283
|
-
await k.beforeLoadPromise;
|
|
1284
|
-
else {
|
|
1285
|
-
try {
|
|
1286
|
-
s(P, (I) => ({
|
|
1287
|
-
...I,
|
|
1288
|
-
loadPromise: ct(() => {
|
|
1289
|
-
var V;
|
|
1290
|
-
(V = I.loadPromise) == null || V.resolve();
|
|
1291
|
-
}),
|
|
1292
|
-
beforeLoadPromise: ct()
|
|
1293
|
-
}));
|
|
1294
|
-
const w = this.looseRoutesById[M], y = new AbortController(), N = (f = o[g - 1]) == null ? void 0 : f.id, A = () => N ? this.getMatch(N).context ?? this.options.context ?? {} : this.options.context ?? {}, B = w.options.pendingMs ?? this.options.defaultPendingMs, T = !!(a && !this.isServer && !r && (w.options.loader || w.options.beforeLoad) && typeof B == "number" && B !== 1 / 0 && (w.options.pendingComponent ?? this.options.defaultPendingComponent));
|
|
1295
|
-
let R;
|
|
1296
|
-
T && (R = setTimeout(() => {
|
|
1297
|
-
try {
|
|
1298
|
-
c();
|
|
1299
|
-
} catch {
|
|
1300
|
-
}
|
|
1301
|
-
}, B));
|
|
1302
|
-
const { paramsError: O, searchError: $ } = this.getMatch(P);
|
|
1303
|
-
O && v(g, O, "PARSE_PARAMS"), $ && v(g, $, "VALIDATE_SEARCH");
|
|
1304
|
-
const K = A();
|
|
1305
|
-
s(P, (I) => ({
|
|
1306
|
-
...I,
|
|
1307
|
-
isFetching: "beforeLoad",
|
|
1308
|
-
fetchCount: I.fetchCount + 1,
|
|
1309
|
-
routeContext: Y(
|
|
1310
|
-
I.routeContext,
|
|
1311
|
-
K
|
|
1312
|
-
),
|
|
1313
|
-
context: Y(I.context, K),
|
|
1314
|
-
abortController: y,
|
|
1315
|
-
pendingTimeout: R
|
|
1316
|
-
}));
|
|
1317
|
-
const { search: J, params: E, routeContext: x, cause: j } = this.getMatch(P), z = {
|
|
1318
|
-
search: J,
|
|
1319
|
-
abortController: y,
|
|
1320
|
-
params: E,
|
|
1321
|
-
preload: !!r,
|
|
1322
|
-
context: x,
|
|
1323
|
-
location: e,
|
|
1324
|
-
navigate: (I) => this.navigate({ ...I, _fromLocation: e }),
|
|
1325
|
-
buildLocation: this.buildLocation,
|
|
1326
|
-
cause: r ? "preload" : j
|
|
1327
|
-
}, U = await ((p = (m = w.options).beforeLoad) == null ? void 0 : p.call(m, z)) ?? {};
|
|
1328
|
-
(st(U) || Q(U)) && v(g, U, "BEFORE_LOAD"), s(P, (I) => {
|
|
1329
|
-
const V = {
|
|
1330
|
-
...I.routeContext,
|
|
1331
|
-
...U
|
|
1332
|
-
};
|
|
1333
|
-
return {
|
|
1334
|
-
...I,
|
|
1335
|
-
routeContext: Y(
|
|
1336
|
-
I.routeContext,
|
|
1337
|
-
V
|
|
1338
|
-
),
|
|
1339
|
-
context: Y(I.context, V),
|
|
1340
|
-
abortController: y
|
|
1341
|
-
};
|
|
1342
|
-
});
|
|
1343
|
-
} catch (w) {
|
|
1344
|
-
v(g, w, "BEFORE_LOAD");
|
|
1345
|
-
}
|
|
1346
|
-
s(P, (w) => {
|
|
1347
|
-
var y;
|
|
1348
|
-
return (y = w.beforeLoadPromise) == null || y.resolve(), {
|
|
1349
|
-
...w,
|
|
1350
|
-
beforeLoadPromise: void 0,
|
|
1351
|
-
isFetching: !1
|
|
1352
|
-
};
|
|
1353
|
-
});
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
const S = o.slice(0, i), b = [];
|
|
1357
|
-
S.forEach(({ id: g, routeId: P }, M) => {
|
|
1358
|
-
b.push(
|
|
1359
|
-
(async () => {
|
|
1360
|
-
const { loaderPromise: k } = this.getMatch(g);
|
|
1361
|
-
if (k)
|
|
1362
|
-
await k;
|
|
1363
|
-
else {
|
|
1364
|
-
const w = b[M - 1], y = this.looseRoutesById[P], N = () => {
|
|
1365
|
-
const {
|
|
1366
|
-
params: x,
|
|
1367
|
-
loaderDeps: j,
|
|
1368
|
-
abortController: z,
|
|
1369
|
-
context: U,
|
|
1370
|
-
cause: I
|
|
1371
|
-
} = this.getMatch(g);
|
|
1372
|
-
return {
|
|
1373
|
-
params: x,
|
|
1374
|
-
deps: j,
|
|
1375
|
-
preload: !!r,
|
|
1376
|
-
parentMatchPromise: w,
|
|
1377
|
-
abortController: z,
|
|
1378
|
-
context: U,
|
|
1379
|
-
location: e,
|
|
1380
|
-
navigate: (V) => this.navigate({ ...V, _fromLocation: e }),
|
|
1381
|
-
cause: r ? "preload" : I,
|
|
1382
|
-
route: y
|
|
1383
|
-
};
|
|
1384
|
-
}, A = Date.now() - this.getMatch(g).updatedAt, B = r ? y.options.preloadStaleTime ?? this.options.defaultPreloadStaleTime ?? 3e4 : y.options.staleTime ?? this.options.defaultStaleTime ?? 0, T = y.options.shouldReload, R = typeof T == "function" ? T(N()) : T;
|
|
1385
|
-
s(g, (x) => ({
|
|
1386
|
-
...x,
|
|
1387
|
-
loaderPromise: ct(),
|
|
1388
|
-
preload: !!r && !this.state.matches.find((j) => j.id === g)
|
|
1389
|
-
}));
|
|
1390
|
-
const O = async () => {
|
|
1391
|
-
var x, j, z, U, I, V, mt, et;
|
|
1392
|
-
try {
|
|
1393
|
-
const ot = async () => {
|
|
1394
|
-
const q = this.getMatch(g);
|
|
1395
|
-
q.minPendingPromise && await q.minPendingPromise;
|
|
1396
|
-
};
|
|
1397
|
-
try {
|
|
1398
|
-
y._lazyPromise = y._lazyPromise || (y.lazyFn ? y.lazyFn().then((C) => {
|
|
1399
|
-
Object.assign(
|
|
1400
|
-
y.options,
|
|
1401
|
-
C.options
|
|
1402
|
-
);
|
|
1403
|
-
}) : Promise.resolve());
|
|
1404
|
-
const q = this.getMatch(g).componentsPromise || y._lazyPromise.then(
|
|
1405
|
-
() => Promise.all(
|
|
1406
|
-
Ie.map(async (C) => {
|
|
1407
|
-
const rt = y.options[C];
|
|
1408
|
-
rt?.preload && await rt.preload();
|
|
1409
|
-
})
|
|
1410
|
-
)
|
|
1411
|
-
);
|
|
1412
|
-
s(g, (C) => ({
|
|
1413
|
-
...C,
|
|
1414
|
-
isFetching: "loader",
|
|
1415
|
-
componentsPromise: q
|
|
1416
|
-
})), await y._lazyPromise;
|
|
1417
|
-
let X = await ((j = (x = y.options).loader) == null ? void 0 : j.call(x, N()));
|
|
1418
|
-
this.serializeLoaderData && (X = this.serializeLoaderData(X, {
|
|
1419
|
-
router: this,
|
|
1420
|
-
match: this.getMatch(g)
|
|
1421
|
-
})), u(
|
|
1422
|
-
this.getMatch(g),
|
|
1423
|
-
X
|
|
1424
|
-
), await ot();
|
|
1425
|
-
const Z = (U = (z = y.options).meta) == null ? void 0 : U.call(z, {
|
|
1426
|
-
matches: o,
|
|
1427
|
-
match: this.getMatch(g),
|
|
1428
|
-
params: this.getMatch(g).params,
|
|
1429
|
-
loaderData: X
|
|
1430
|
-
}), F = (V = (I = y.options).headers) == null ? void 0 : V.call(I, {
|
|
1431
|
-
loaderData: X
|
|
1432
|
-
});
|
|
1433
|
-
s(g, (C) => ({
|
|
1434
|
-
...C,
|
|
1435
|
-
error: void 0,
|
|
1436
|
-
status: "success",
|
|
1437
|
-
isFetching: !1,
|
|
1438
|
-
updatedAt: Date.now(),
|
|
1439
|
-
loaderData: X,
|
|
1440
|
-
meta: Z,
|
|
1441
|
-
headers: F
|
|
1442
|
-
}));
|
|
1443
|
-
} catch (q) {
|
|
1444
|
-
let X = q;
|
|
1445
|
-
await ot(), u(this.getMatch(g), q);
|
|
1446
|
-
try {
|
|
1447
|
-
(et = (mt = y.options).onError) == null || et.call(mt, q);
|
|
1448
|
-
} catch (Z) {
|
|
1449
|
-
X = Z, u(
|
|
1450
|
-
this.getMatch(g),
|
|
1451
|
-
Z
|
|
1452
|
-
);
|
|
1453
|
-
}
|
|
1454
|
-
s(g, (Z) => ({
|
|
1455
|
-
...Z,
|
|
1456
|
-
error: X,
|
|
1457
|
-
status: "error",
|
|
1458
|
-
isFetching: !1
|
|
1459
|
-
}));
|
|
1460
|
-
}
|
|
1461
|
-
await this.getMatch(g).componentsPromise;
|
|
1462
|
-
} catch (ot) {
|
|
1463
|
-
u(this.getMatch(g), ot);
|
|
1464
|
-
}
|
|
1465
|
-
}, { status: $, invalid: K } = this.getMatch(g);
|
|
1466
|
-
$ === "success" && (K || (R ?? A > B)) ? (async () => {
|
|
1467
|
-
try {
|
|
1468
|
-
await O();
|
|
1469
|
-
} catch {
|
|
1470
|
-
}
|
|
1471
|
-
})() : $ !== "success" && await O();
|
|
1472
|
-
const { loaderPromise: J, loadPromise: E } = this.getMatch(g);
|
|
1473
|
-
J?.resolve(), E?.resolve();
|
|
1474
|
-
}
|
|
1475
|
-
s(g, (w) => ({
|
|
1476
|
-
...w,
|
|
1477
|
-
isFetching: !1,
|
|
1478
|
-
loaderPromise: void 0
|
|
1479
|
-
}));
|
|
1480
|
-
})()
|
|
1481
|
-
);
|
|
1482
|
-
}), await Promise.all(b), d();
|
|
1483
|
-
} catch (v) {
|
|
1484
|
-
h(v);
|
|
1485
|
-
}
|
|
1486
|
-
})();
|
|
1487
|
-
}), await c();
|
|
1488
|
-
} catch (d) {
|
|
1489
|
-
if (st(d) || Q(d))
|
|
1490
|
-
throw Q(d) && !r && await c(), d;
|
|
1491
|
-
}
|
|
1492
|
-
return o;
|
|
1493
|
-
}, this.invalidate = () => {
|
|
1494
|
-
const e = (o) => ({
|
|
1495
|
-
...o,
|
|
1496
|
-
invalid: !0,
|
|
1497
|
-
...o.status === "error" ? { status: "pending", error: void 0 } : {}
|
|
1498
|
-
});
|
|
1499
|
-
return this.__store.setState((o) => {
|
|
1500
|
-
var r;
|
|
1501
|
-
return {
|
|
1502
|
-
...o,
|
|
1503
|
-
matches: o.matches.map(e),
|
|
1504
|
-
cachedMatches: o.cachedMatches.map(e),
|
|
1505
|
-
pendingMatches: (r = o.pendingMatches) == null ? void 0 : r.map(e)
|
|
1506
|
-
};
|
|
1507
|
-
}), this.load();
|
|
1508
|
-
}, this.resolveRedirect = (e) => {
|
|
1509
|
-
const o = e;
|
|
1510
|
-
return o.href || (o.href = this.buildLocation(o).href), o;
|
|
1511
|
-
}, this.cleanCache = () => {
|
|
1512
|
-
this.__store.setState((e) => ({
|
|
1513
|
-
...e,
|
|
1514
|
-
cachedMatches: e.cachedMatches.filter((o) => {
|
|
1515
|
-
const r = this.looseRoutesById[o.routeId];
|
|
1516
|
-
if (!r.options.loader)
|
|
1517
|
-
return !1;
|
|
1518
|
-
const a = (o.preload ? r.options.preloadGcTime ?? this.options.defaultPreloadGcTime : r.options.gcTime ?? this.options.defaultGcTime) ?? 5 * 60 * 1e3;
|
|
1519
|
-
return o.status !== "error" && Date.now() - o.updatedAt < a;
|
|
1520
|
-
})
|
|
1521
|
-
}));
|
|
1522
|
-
}, this.preloadRoute = async (e) => {
|
|
1523
|
-
const o = this.buildLocation(e);
|
|
1524
|
-
let r = this.matchRoutes(o.pathname, o.search, {
|
|
1525
|
-
throwOnError: !0,
|
|
1526
|
-
preload: !0
|
|
1527
|
-
});
|
|
1528
|
-
const a = Object.fromEntries(
|
|
1529
|
-
[
|
|
1530
|
-
...this.state.matches,
|
|
1531
|
-
...this.state.pendingMatches ?? [],
|
|
1532
|
-
...this.state.cachedMatches
|
|
1533
|
-
].map((i) => [i.id, !0])
|
|
1534
|
-
);
|
|
1535
|
-
this.__store.batch(() => {
|
|
1536
|
-
r.forEach((i) => {
|
|
1537
|
-
a[i.id] || this.__store.setState((l) => ({
|
|
1538
|
-
...l,
|
|
1539
|
-
cachedMatches: [...l.cachedMatches, i]
|
|
1540
|
-
}));
|
|
1541
|
-
});
|
|
1542
|
-
});
|
|
1543
|
-
const s = new Set(
|
|
1544
|
-
[...this.state.matches, ...this.state.pendingMatches ?? []].map(
|
|
1545
|
-
(i) => i.id
|
|
1546
|
-
)
|
|
1547
|
-
);
|
|
1548
|
-
try {
|
|
1549
|
-
return r = await this.loadMatches({
|
|
1550
|
-
matches: r,
|
|
1551
|
-
location: o,
|
|
1552
|
-
preload: !0,
|
|
1553
|
-
updateMatch: (i, l) => {
|
|
1554
|
-
s.has(i) ? r = r.map((c) => c.id === i ? l(c) : c) : this.updateMatch(i, l);
|
|
1555
|
-
}
|
|
1556
|
-
}), r;
|
|
1557
|
-
} catch (i) {
|
|
1558
|
-
if (st(i))
|
|
1559
|
-
return await this.preloadRoute({
|
|
1560
|
-
...i,
|
|
1561
|
-
_fromLocation: o
|
|
1562
|
-
});
|
|
1563
|
-
console.error(i);
|
|
1564
|
-
return;
|
|
1565
|
-
}
|
|
1566
|
-
}, this.matchRoute = (e, o) => {
|
|
1567
|
-
const r = {
|
|
1568
|
-
...e,
|
|
1569
|
-
to: e.to ? this.resolvePathWithBase(e.from || "", e.to) : void 0,
|
|
1570
|
-
params: e.params || {},
|
|
1571
|
-
leaveParams: !0
|
|
1572
|
-
}, a = this.buildLocation(r);
|
|
1573
|
-
if (o?.pending && this.state.status !== "pending")
|
|
1574
|
-
return !1;
|
|
1575
|
-
const i = (o?.pending === void 0 ? !this.state.isLoading : o.pending) ? this.latestLocation : this.state.resolvedLocation, l = vt(this.basepath, i.pathname, {
|
|
1576
|
-
...o,
|
|
1577
|
-
to: a.pathname
|
|
1578
|
-
});
|
|
1579
|
-
return !l || e.params && !lt(l, e.params, !0) ? !1 : l && (o?.includeSearch ?? !0) ? lt(i.search, a.search, !0) ? l : !1 : l;
|
|
1580
|
-
}, this.dehydrate = () => {
|
|
1581
|
-
var e;
|
|
1582
|
-
const o = ((e = this.options.errorSerializer) == null ? void 0 : e.serialize) ?? Be;
|
|
1583
|
-
return {
|
|
1584
|
-
state: {
|
|
1585
|
-
dehydratedMatches: this.state.matches.map((r) => ({
|
|
1586
|
-
...pt(r, ["id", "status", "updatedAt"]),
|
|
1587
|
-
// If an error occurs server-side during SSRing,
|
|
1588
|
-
// send a small subset of the error to the client
|
|
1589
|
-
error: r.error ? {
|
|
1590
|
-
data: o(r.error),
|
|
1591
|
-
__isServerError: !0
|
|
1592
|
-
} : void 0
|
|
1593
|
-
// NOTE: We don't send the loader data here, because
|
|
1594
|
-
// there is a potential that it needs to be streamed.
|
|
1595
|
-
// Instead, we render it next to the route match in the HTML
|
|
1596
|
-
// which gives us the potential to stream it via suspense.
|
|
1597
|
-
}))
|
|
1598
|
-
},
|
|
1599
|
-
manifest: this.manifest
|
|
1600
|
-
};
|
|
1601
|
-
}, this.hydrate = () => {
|
|
1602
|
-
var e, o, r;
|
|
1603
|
-
let a;
|
|
1604
|
-
typeof document < "u" && (a = this.options.transformer.parse((e = window.__TSR__) == null ? void 0 : e.dehydrated)), H(
|
|
1605
|
-
a,
|
|
1606
|
-
"Expected to find a dehydrated data on window.__TSR__.dehydrated... but we did not. Please file an issue!"
|
|
1607
|
-
), this.dehydratedData = a.payload, (r = (o = this.options).hydrate) == null || r.call(o, a.payload);
|
|
1608
|
-
const s = a.router.state, i = this.matchRoutes(
|
|
1609
|
-
this.state.location.pathname,
|
|
1610
|
-
this.state.location.search
|
|
1611
|
-
).map((l) => {
|
|
1612
|
-
const c = s.dehydratedMatches.find(
|
|
1613
|
-
(u) => u.id === l.id
|
|
1614
|
-
);
|
|
1615
|
-
return H(
|
|
1616
|
-
c,
|
|
1617
|
-
`Could not find a client-side match for dehydrated match with id: ${l.id}!`
|
|
1618
|
-
), {
|
|
1619
|
-
...l,
|
|
1620
|
-
...c
|
|
1621
|
-
};
|
|
1622
|
-
});
|
|
1623
|
-
this.__store.setState((l) => ({
|
|
1624
|
-
...l,
|
|
1625
|
-
matches: i
|
|
1626
|
-
})), this.manifest = a.router.manifest;
|
|
1627
|
-
}, this.injectedHtml = [], this.injectHtml = (e) => {
|
|
1628
|
-
const o = () => (this.injectedHtml = this.injectedHtml.filter((r) => r !== o), e);
|
|
1629
|
-
this.injectedHtml.push(o);
|
|
1630
|
-
}, this.streamedKeys = /* @__PURE__ */ new Set(), this.getStreamedValue = (e) => {
|
|
1631
|
-
var o;
|
|
1632
|
-
if (this.isServer)
|
|
1633
|
-
return;
|
|
1634
|
-
const r = (o = window.__TSR__) == null ? void 0 : o.streamedValues[e];
|
|
1635
|
-
if (r)
|
|
1636
|
-
return r.parsed || (r.parsed = this.options.transformer.parse(r.value)), r.parsed;
|
|
1637
|
-
}, this.streamValue = (e, o) => {
|
|
1638
|
-
var r;
|
|
1639
|
-
ut(
|
|
1640
|
-
!this.streamedKeys.has(e),
|
|
1641
|
-
"Key has already been streamed: " + e
|
|
1642
|
-
), this.streamedKeys.add(e);
|
|
1643
|
-
const a = `__TSR__.streamedValues['${e}'] = { value: ${(r = this.serializer) == null ? void 0 : r.call(this, this.options.transformer.stringify(o))}}`;
|
|
1644
|
-
this.injectHtml(
|
|
1645
|
-
`<script class='tsr-once'>${a}; __TSR__.cleanScripts()<\/script>`
|
|
1646
|
-
);
|
|
1647
|
-
}, this._handleNotFound = (e, o, {
|
|
1648
|
-
updateMatch: r = this.updateMatch
|
|
1649
|
-
} = {}) => {
|
|
1650
|
-
const a = Object.fromEntries(
|
|
1651
|
-
e.map((l) => [l.routeId, l])
|
|
1652
|
-
);
|
|
1653
|
-
let s = (o.global ? this.looseRoutesById[W] : this.looseRoutesById[o.routeId]) || this.looseRoutesById[W];
|
|
1654
|
-
for (; !s.options.notFoundComponent && !this.options.defaultNotFoundComponent && s.id !== W; )
|
|
1655
|
-
s = s.parentRoute, H(
|
|
1656
|
-
s,
|
|
1657
|
-
"Found invalid route tree while trying to find not-found handler."
|
|
1658
|
-
);
|
|
1659
|
-
const i = a[s.id];
|
|
1660
|
-
H(i, "Could not find match for route: " + s.id), r(i.id, (l) => ({
|
|
1661
|
-
...l,
|
|
1662
|
-
status: "notFound",
|
|
1663
|
-
error: o,
|
|
1664
|
-
isFetching: !1
|
|
1665
|
-
})), o.routerCode === "BEFORE_LOAD" && s.parentRoute && (o.routeId = s.parentRoute.id, this._handleNotFound(e, o, {
|
|
1666
|
-
updateMatch: r
|
|
1667
|
-
}));
|
|
1668
|
-
}, this.hasNotFoundMatch = () => this.__store.state.matches.some(
|
|
1669
|
-
(e) => e.status === "notFound" || e.globalNotFound
|
|
1670
|
-
), this.update({
|
|
1671
|
-
defaultPreloadDelay: 50,
|
|
1672
|
-
defaultPendingMs: 1e3,
|
|
1673
|
-
defaultPendingMinMs: 500,
|
|
1674
|
-
context: void 0,
|
|
1675
|
-
...n,
|
|
1676
|
-
stringifySearch: n.stringifySearch ?? _e,
|
|
1677
|
-
parseSearch: n.parseSearch ?? ye
|
|
1678
|
-
}), typeof document < "u" && (window.__TSR__ROUTER__ = this);
|
|
1679
|
-
}
|
|
1680
|
-
get state() {
|
|
1681
|
-
return this.__store.state;
|
|
1682
|
-
}
|
|
1683
|
-
get looseRoutesById() {
|
|
1684
|
-
return this.routesById;
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
class Fe extends Error {
|
|
1688
|
-
}
|
|
1689
|
-
class ke extends Error {
|
|
1690
|
-
}
|
|
1691
|
-
function Oe(t) {
|
|
1692
|
-
return {
|
|
1693
|
-
loadedAt: 0,
|
|
1694
|
-
isLoading: !1,
|
|
1695
|
-
isTransitioning: !1,
|
|
1696
|
-
status: "idle",
|
|
1697
|
-
resolvedLocation: { ...t },
|
|
1698
|
-
location: t,
|
|
1699
|
-
matches: [],
|
|
1700
|
-
pendingMatches: [],
|
|
1701
|
-
cachedMatches: [],
|
|
1702
|
-
statusCode: 200
|
|
1703
|
-
};
|
|
1704
|
-
}
|
|
1705
|
-
function Be(t) {
|
|
1706
|
-
return t instanceof Error ? {
|
|
1707
|
-
name: t.name,
|
|
1708
|
-
message: t.message
|
|
1709
|
-
} : {
|
|
1710
|
-
data: t
|
|
1711
|
-
};
|
|
1712
|
-
}
|
|
1713
|
-
function Ht(t) {
|
|
1714
|
-
return !(typeof t == "object" && t && "data" in t) || !("__isServerError" in t && t.__isServerError) || !(typeof t.data == "object" && t.data) ? !1 : t.__isServerError === !0;
|
|
1715
|
-
}
|
|
1716
|
-
function Wt(t) {
|
|
1717
|
-
if ("name" in t && "message" in t) {
|
|
1718
|
-
const n = new Error(t.message);
|
|
1719
|
-
return n.name = t.name, n;
|
|
1720
|
-
}
|
|
1721
|
-
return t.data;
|
|
1722
|
-
}
|
|
1723
|
-
const Ct = L.createContext(void 0);
|
|
1724
|
-
function ht(t) {
|
|
1725
|
-
const n = L.useContext(Ct);
|
|
1726
|
-
return D({
|
|
1727
|
-
select: (o) => {
|
|
1728
|
-
const r = o.matches.find(
|
|
1729
|
-
(a) => t.from ? t.from === a.routeId : a.id === n
|
|
1730
|
-
);
|
|
1731
|
-
if (H(
|
|
1732
|
-
!((t.shouldThrow ?? !0) && !r),
|
|
1733
|
-
`Could not find ${t.from ? `an active match from "${t.from}"` : "a nearest match!"}`
|
|
1734
|
-
), r !== void 0)
|
|
1735
|
-
return t.select ? t.select(r) : r;
|
|
1736
|
-
}
|
|
1737
|
-
});
|
|
1738
|
-
}
|
|
1739
|
-
function Ne(t) {
|
|
1740
|
-
return ht({
|
|
1741
|
-
...t,
|
|
1742
|
-
select: (n) => typeof t.select == "function" ? t.select(n.loaderDeps) : n.loaderDeps
|
|
1743
|
-
});
|
|
1744
|
-
}
|
|
1745
|
-
function $e(t) {
|
|
1746
|
-
return ht({
|
|
1747
|
-
...t,
|
|
1748
|
-
select: (n) => typeof t.select == "function" ? t.select(n.loaderData) : n.loaderData
|
|
1749
|
-
});
|
|
1750
|
-
}
|
|
1751
|
-
function Ae(t) {
|
|
1752
|
-
return ht({
|
|
1753
|
-
...t,
|
|
1754
|
-
select: (n) => t.select ? t.select(n.params) : n.params
|
|
1755
|
-
});
|
|
1756
|
-
}
|
|
1757
|
-
function Ke(t) {
|
|
1758
|
-
return ht({
|
|
1759
|
-
...t,
|
|
1760
|
-
select: (n) => t.select ? t.select(n.search) : n.search
|
|
1761
|
-
});
|
|
1762
|
-
}
|
|
1763
|
-
function je(t) {
|
|
1764
|
-
const n = tt();
|
|
1765
|
-
return L.useCallback(
|
|
1766
|
-
(e) => n.navigate({
|
|
1767
|
-
...e
|
|
1768
|
-
}),
|
|
1769
|
-
[n]
|
|
1770
|
-
);
|
|
1771
|
-
}
|
|
1772
|
-
class Zt {
|
|
1773
|
-
/**
|
|
1774
|
-
* @deprecated Use the `createRoute` function instead.
|
|
1775
|
-
*/
|
|
1776
|
-
constructor(n) {
|
|
1777
|
-
this.init = (e) => {
|
|
1778
|
-
var o, r;
|
|
1779
|
-
this.originalIndex = e.originalIndex;
|
|
1780
|
-
const a = this.options, s = !a?.path && !a?.id;
|
|
1781
|
-
this.parentRoute = (r = (o = this.options) == null ? void 0 : o.getParentRoute) == null ? void 0 : r.call(o), s ? this.path = W : H(
|
|
1782
|
-
this.parentRoute,
|
|
1783
|
-
"Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance."
|
|
1784
|
-
);
|
|
1785
|
-
let i = s ? W : a.path;
|
|
1786
|
-
i && i !== "/" && (i = Ot(i));
|
|
1787
|
-
const l = a?.id || i;
|
|
1788
|
-
let c = s ? W : nt([
|
|
1789
|
-
this.parentRoute.id === W ? "" : this.parentRoute.id,
|
|
1790
|
-
l
|
|
1791
|
-
]);
|
|
1792
|
-
i === W && (i = "/"), c !== W && (c = nt(["/", c]));
|
|
1793
|
-
const u = c === W ? "/" : nt([this.parentRoute.fullPath, i]);
|
|
1794
|
-
this.path = i, this.id = c, this.fullPath = u, this.to = u;
|
|
1795
|
-
}, this.updateLoader = (e) => (Object.assign(this.options, e), this), this.update = (e) => (Object.assign(this.options, e), this), this.lazy = (e) => (this.lazyFn = e, this), this.useMatch = (e) => ht({ ...e, from: this.id }), this.useRouteContext = (e) => ht({
|
|
1796
|
-
...e,
|
|
1797
|
-
from: this.id,
|
|
1798
|
-
select: (o) => e?.select ? e.select(o.context) : o.context
|
|
1799
|
-
}), this.useSearch = (e) => Ke({ ...e, from: this.id }), this.useParams = (e) => Ae({ ...e, from: this.id }), this.useLoaderDeps = (e) => Ne({ ...e, from: this.id }), this.useLoaderData = (e) => $e({ ...e, from: this.id }), this.useNavigate = () => je({ from: this.id }), this.options = n || {}, this.isRoot = !n?.getParentRoute, H(
|
|
1800
|
-
!(n?.id && n?.path),
|
|
1801
|
-
"Route cannot have both an 'id' and a 'path' option."
|
|
1802
|
-
), this.$$typeof = Symbol.for("react.memo");
|
|
1803
|
-
}
|
|
1804
|
-
addChildren(n) {
|
|
1805
|
-
return this.children = Array.isArray(n) ? n : Object.values(n), this;
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
function De(t) {
|
|
1809
|
-
return new Zt(t);
|
|
1810
|
-
}
|
|
1811
|
-
function ho() {
|
|
1812
|
-
return (t) => He(t);
|
|
1813
|
-
}
|
|
1814
|
-
class ze extends Zt {
|
|
1815
|
-
/**
|
|
1816
|
-
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
1817
|
-
*/
|
|
1818
|
-
constructor(n) {
|
|
1819
|
-
super(n);
|
|
1820
|
-
}
|
|
1821
|
-
addChildren(n) {
|
|
1822
|
-
return super.addChildren(n);
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
function He(t) {
|
|
1826
|
-
return new ze(t);
|
|
1827
|
-
}
|
|
1828
|
-
function fo(t) {
|
|
1829
|
-
return new We(t, {
|
|
1830
|
-
silent: !0
|
|
1831
|
-
}).createRoute;
|
|
1832
|
-
}
|
|
1833
|
-
class We {
|
|
1834
|
-
constructor(n, e) {
|
|
1835
|
-
this.path = n, this.createRoute = (o) => {
|
|
1836
|
-
ut(
|
|
1837
|
-
this.silent,
|
|
1838
|
-
"FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead."
|
|
1839
|
-
);
|
|
1840
|
-
const r = De(o);
|
|
1841
|
-
return r.isRoot = !1, r;
|
|
1842
|
-
}, this.silent = e?.silent;
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
const Ue = "Error preloading route! ☝️";
|
|
1846
|
-
function Ve(t) {
|
|
1847
|
-
const n = tt(), [e, o] = L.useState(!1), {
|
|
1848
|
-
// custom props
|
|
1849
|
-
activeProps: r = () => ({ className: "active" }),
|
|
1850
|
-
inactiveProps: a = () => ({}),
|
|
1851
|
-
activeOptions: s,
|
|
1852
|
-
hash: i,
|
|
1853
|
-
search: l,
|
|
1854
|
-
params: c,
|
|
1855
|
-
to: u,
|
|
1856
|
-
state: d,
|
|
1857
|
-
mask: h,
|
|
1858
|
-
preload: f,
|
|
1859
|
-
preloadDelay: m,
|
|
1860
|
-
replace: p,
|
|
1861
|
-
startTransition: v,
|
|
1862
|
-
resetScroll: S,
|
|
1863
|
-
viewTransition: b,
|
|
1864
|
-
// element props
|
|
1865
|
-
children: g,
|
|
1866
|
-
target: P,
|
|
1867
|
-
disabled: M,
|
|
1868
|
-
style: k,
|
|
1869
|
-
className: w,
|
|
1870
|
-
onClick: y,
|
|
1871
|
-
onFocus: N,
|
|
1872
|
-
onMouseEnter: A,
|
|
1873
|
-
onMouseLeave: B,
|
|
1874
|
-
onTouchStart: T,
|
|
1875
|
-
ignoreBlocker: R,
|
|
1876
|
-
...O
|
|
1877
|
-
} = t;
|
|
1878
|
-
let $ = "internal";
|
|
1879
|
-
try {
|
|
1880
|
-
new URL(`${u}`), $ = "external";
|
|
1881
|
-
} catch {
|
|
1882
|
-
}
|
|
1883
|
-
const K = n.buildLocation(t), J = f ?? n.options.defaultPreload, E = m ?? n.options.defaultPreloadDelay ?? 0, x = D({
|
|
1884
|
-
select: (F) => {
|
|
1885
|
-
const C = wt(
|
|
1886
|
-
F.location.pathname,
|
|
1887
|
-
n.basepath
|
|
1888
|
-
).split("/"), Mt = wt(
|
|
1889
|
-
K.pathname,
|
|
1890
|
-
n.basepath
|
|
1891
|
-
).split("/").every(
|
|
1892
|
-
(se, ie) => se === C[ie]
|
|
1893
|
-
), oe = s?.exact ? be(F.location.pathname, K.pathname, n.basepath) : Mt, ne = s?.includeHash ? F.location.hash === K.hash : !0, re = s?.includeSearch ?? !0 ? lt(F.location.search, K.search, !s?.exact) : !0;
|
|
1894
|
-
return oe && ne && re;
|
|
1895
|
-
}
|
|
1896
|
-
});
|
|
1897
|
-
if ($ === "external")
|
|
1898
|
-
return {
|
|
1899
|
-
...O,
|
|
1900
|
-
type: $,
|
|
1901
|
-
href: u,
|
|
1902
|
-
...g && { children: g },
|
|
1903
|
-
...P && { target: P },
|
|
1904
|
-
...M && { disabled: M },
|
|
1905
|
-
...k && { style: k },
|
|
1906
|
-
...w && { className: w },
|
|
1907
|
-
...y && { onClick: y },
|
|
1908
|
-
...N && { onFocus: N },
|
|
1909
|
-
...A && { onMouseEnter: A },
|
|
1910
|
-
...B && { onMouseLeave: B },
|
|
1911
|
-
...T && { onTouchStart: T }
|
|
1912
|
-
};
|
|
1913
|
-
const j = (F) => {
|
|
1914
|
-
if (!M && !qe(F) && !F.defaultPrevented && (!P || P === "_self") && F.button === 0) {
|
|
1915
|
-
F.preventDefault(), ae(() => {
|
|
1916
|
-
o(!0);
|
|
1917
|
-
});
|
|
1918
|
-
const C = n.subscribe("onResolved", () => {
|
|
1919
|
-
C(), o(!1);
|
|
1920
|
-
});
|
|
1921
|
-
n.commitLocation({
|
|
1922
|
-
...K,
|
|
1923
|
-
replace: p,
|
|
1924
|
-
resetScroll: S,
|
|
1925
|
-
startTransition: v,
|
|
1926
|
-
viewTransition: b,
|
|
1927
|
-
ignoreBlocker: R
|
|
1928
|
-
});
|
|
1929
|
-
}
|
|
1930
|
-
}, z = () => {
|
|
1931
|
-
n.preloadRoute(t).catch((F) => {
|
|
1932
|
-
console.warn(F), console.warn(Ue);
|
|
1933
|
-
});
|
|
1934
|
-
}, U = (F) => {
|
|
1935
|
-
M || J && z();
|
|
1936
|
-
}, I = U, V = (F) => {
|
|
1937
|
-
if (M) return;
|
|
1938
|
-
const C = F.target || {};
|
|
1939
|
-
if (J) {
|
|
1940
|
-
if (C.preloadTimeout)
|
|
1941
|
-
return;
|
|
1942
|
-
C.preloadTimeout = setTimeout(() => {
|
|
1943
|
-
C.preloadTimeout = null, z();
|
|
1944
|
-
}, E);
|
|
1945
|
-
}
|
|
1946
|
-
}, mt = (F) => {
|
|
1947
|
-
if (M) return;
|
|
1948
|
-
const C = F.target || {};
|
|
1949
|
-
C.preloadTimeout && (clearTimeout(C.preloadTimeout), C.preloadTimeout = null);
|
|
1950
|
-
}, et = (F) => (C) => {
|
|
1951
|
-
var rt;
|
|
1952
|
-
(rt = C.persist) == null || rt.call(C), F.filter(Boolean).forEach((Mt) => {
|
|
1953
|
-
C.defaultPrevented || Mt(C);
|
|
1954
|
-
});
|
|
1955
|
-
}, ot = x ? it(r, {}) ?? {} : {}, q = x ? {} : it(a, {}), X = [
|
|
1956
|
-
w,
|
|
1957
|
-
ot.className,
|
|
1958
|
-
q.className
|
|
1959
|
-
].filter(Boolean).join(" "), Z = {
|
|
1960
|
-
...k,
|
|
1961
|
-
...ot.style,
|
|
1962
|
-
...q.style
|
|
1963
|
-
};
|
|
1964
|
-
return {
|
|
1965
|
-
...ot,
|
|
1966
|
-
...q,
|
|
1967
|
-
...O,
|
|
1968
|
-
href: M ? void 0 : K.maskedLocation ? n.history.createHref(K.maskedLocation.href) : n.history.createHref(K.href),
|
|
1969
|
-
onClick: et([y, j]),
|
|
1970
|
-
onFocus: et([N, U]),
|
|
1971
|
-
onMouseEnter: et([A, V]),
|
|
1972
|
-
onMouseLeave: et([B, mt]),
|
|
1973
|
-
onTouchStart: et([T, I]),
|
|
1974
|
-
disabled: !!M,
|
|
1975
|
-
target: P,
|
|
1976
|
-
...Object.keys(Z).length && { style: Z },
|
|
1977
|
-
...X && { className: X },
|
|
1978
|
-
...M && {
|
|
1979
|
-
role: "link",
|
|
1980
|
-
"aria-disabled": !0
|
|
1981
|
-
},
|
|
1982
|
-
...x && { "data-status": "active", "aria-current": "page" },
|
|
1983
|
-
...e && { "data-transitioning": "transitioning" }
|
|
1984
|
-
};
|
|
1985
|
-
}
|
|
1986
|
-
const po = L.forwardRef((t, n) => {
|
|
1987
|
-
const { _asChild: e, ...o } = t, { type: r, ...a } = Ve(o), s = typeof o.children == "function" ? o.children({
|
|
1988
|
-
isActive: a["data-status"] === "active"
|
|
1989
|
-
}) : o.children;
|
|
1990
|
-
return typeof e > "u" && delete a.disabled, L.createElement(
|
|
1991
|
-
e || "a",
|
|
1992
|
-
{
|
|
1993
|
-
...a,
|
|
1994
|
-
ref: n
|
|
1995
|
-
},
|
|
1996
|
-
s
|
|
1997
|
-
);
|
|
1998
|
-
});
|
|
1999
|
-
function qe(t) {
|
|
2000
|
-
return !!(t.metaKey || t.altKey || t.ctrlKey || t.shiftKey);
|
|
2001
|
-
}
|
|
2002
|
-
function Xe() {
|
|
2003
|
-
const t = tt(), n = L.useRef({ router: t, mounted: !1 }), e = D({
|
|
2004
|
-
select: (c) => pt(c, ["isLoading", "location", "resolvedLocation", "isTransitioning"])
|
|
2005
|
-
}), [o, r] = L.useTransition(), a = D({
|
|
2006
|
-
select: (c) => c.matches.some((u) => u.status === "pending")
|
|
2007
|
-
}), s = Dt(e.isLoading), i = e.isLoading || o || a, l = Dt(i);
|
|
2008
|
-
return t.isServer || (t.startReactTransition = r), L.useEffect(() => {
|
|
2009
|
-
const c = t.history.subscribe(t.load), u = t.buildLocation({
|
|
2010
|
-
to: t.latestLocation.pathname,
|
|
2011
|
-
search: !0,
|
|
2012
|
-
params: !0,
|
|
2013
|
-
hash: !0,
|
|
2014
|
-
state: !0
|
|
2015
|
-
});
|
|
2016
|
-
return at(t.latestLocation.href) !== at(u.href) && t.commitLocation({ ...u, replace: !0 }), () => {
|
|
2017
|
-
c();
|
|
2018
|
-
};
|
|
2019
|
-
}, [t, t.history]), It(() => {
|
|
2020
|
-
var c;
|
|
2021
|
-
if ((c = window.__TSR__) != null && c.dehydrated || n.current.router === t && n.current.mounted)
|
|
2022
|
-
return;
|
|
2023
|
-
n.current = { router: t, mounted: !0 }, (async () => {
|
|
2024
|
-
try {
|
|
2025
|
-
await t.load();
|
|
2026
|
-
} catch (d) {
|
|
2027
|
-
console.error(d);
|
|
2028
|
-
}
|
|
2029
|
-
})();
|
|
2030
|
-
}, [t]), It(() => {
|
|
2031
|
-
if (s && !e.isLoading) {
|
|
2032
|
-
const c = t.state.location, u = t.state.resolvedLocation, d = u.href !== c.href;
|
|
2033
|
-
t.emit({
|
|
2034
|
-
type: "onLoad",
|
|
2035
|
-
// When the new URL has committed, when the new matches have been loaded into state.matches
|
|
2036
|
-
fromLocation: u,
|
|
2037
|
-
toLocation: c,
|
|
2038
|
-
pathChanged: d
|
|
2039
|
-
});
|
|
2040
|
-
}
|
|
2041
|
-
}, [s, t, e.isLoading]), It(() => {
|
|
2042
|
-
if (l && !i) {
|
|
2043
|
-
const c = t.state.location, u = t.state.resolvedLocation, d = u.href !== c.href;
|
|
2044
|
-
if (t.emit({
|
|
2045
|
-
type: "onResolved",
|
|
2046
|
-
fromLocation: u,
|
|
2047
|
-
toLocation: c,
|
|
2048
|
-
pathChanged: d
|
|
2049
|
-
}), t.__store.setState((h) => ({
|
|
2050
|
-
...h,
|
|
2051
|
-
status: "idle",
|
|
2052
|
-
resolvedLocation: h.location
|
|
2053
|
-
})), document.querySelector && t.state.location.hash !== "") {
|
|
2054
|
-
const h = document.getElementById(t.state.location.hash);
|
|
2055
|
-
h && h.scrollIntoView();
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
}, [i, l, t]), null;
|
|
2059
|
-
}
|
|
2060
|
-
function gt(t) {
|
|
2061
|
-
return /* @__PURE__ */ _(Vt, { children: t.children });
|
|
2062
|
-
}
|
|
2063
|
-
function te(t, n, e) {
|
|
2064
|
-
return n.options.notFoundComponent ? /* @__PURE__ */ _(n.options.notFoundComponent, { data: e }) : t.options.defaultNotFoundComponent ? /* @__PURE__ */ _(t.options.defaultNotFoundComponent, { data: e }) : /* @__PURE__ */ _(xe, {});
|
|
2065
|
-
}
|
|
2066
|
-
function ee({ matchId: t }) {
|
|
2067
|
-
var n, e;
|
|
2068
|
-
const o = tt(), r = D({
|
|
2069
|
-
select: (p) => {
|
|
2070
|
-
var v;
|
|
2071
|
-
return (v = p.matches.find((S) => S.id === t)) == null ? void 0 : v.routeId;
|
|
2072
|
-
}
|
|
2073
|
-
});
|
|
2074
|
-
H(
|
|
2075
|
-
r,
|
|
2076
|
-
`Could not find routeId for matchId "${t}". Please file an issue!`
|
|
2077
|
-
);
|
|
2078
|
-
const a = o.routesById[r], s = a.options.pendingComponent ?? o.options.defaultPendingComponent, i = s ? /* @__PURE__ */ _(s, {}) : null, l = a.options.errorComponent ?? o.options.defaultErrorComponent, c = a.options.onCatch ?? o.options.defaultOnCatch, u = a.isRoot ? (
|
|
2079
|
-
// If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component
|
|
2080
|
-
a.options.notFoundComponent ?? ((n = o.options.notFoundRoute) == null ? void 0 : n.options.component)
|
|
2081
|
-
) : a.options.notFoundComponent, d = (
|
|
2082
|
-
// If we're on the root route, allow forcefully wrapping in suspense
|
|
2083
|
-
(!a.isRoot || a.options.wrapInSuspense) && (a.options.wrapInSuspense ?? s ?? ((e = a.options.errorComponent) == null ? void 0 : e.preload)) ? L.Suspense : gt
|
|
2084
|
-
), h = l ? Bt : gt, f = u ? Ee : gt, m = D({
|
|
2085
|
-
select: (p) => p.loadedAt
|
|
2086
|
-
});
|
|
2087
|
-
return /* @__PURE__ */ _(Ct.Provider, { value: t, children: /* @__PURE__ */ _(d, { fallback: i, children: /* @__PURE__ */ _(
|
|
2088
|
-
h,
|
|
2089
|
-
{
|
|
2090
|
-
getResetKey: () => m,
|
|
2091
|
-
errorComponent: l || Lt,
|
|
2092
|
-
onCatch: (p, v) => {
|
|
2093
|
-
if (Q(p)) throw p;
|
|
2094
|
-
ut(!1, `Error in route match: ${t}`), c?.(p, v);
|
|
2095
|
-
},
|
|
2096
|
-
children: /* @__PURE__ */ _(
|
|
2097
|
-
f,
|
|
2098
|
-
{
|
|
2099
|
-
fallback: (p) => {
|
|
2100
|
-
if (!u || p.routeId && p.routeId !== r || !p.routeId && !a.isRoot)
|
|
2101
|
-
throw p;
|
|
2102
|
-
return L.createElement(u, p);
|
|
2103
|
-
},
|
|
2104
|
-
children: /* @__PURE__ */ _(Ge, { matchId: t })
|
|
2105
|
-
}
|
|
2106
|
-
)
|
|
2107
|
-
}
|
|
2108
|
-
) }) });
|
|
2109
|
-
}
|
|
2110
|
-
function Ge({ matchId: t }) {
|
|
2111
|
-
var n, e;
|
|
2112
|
-
const o = tt(), r = D({
|
|
2113
|
-
select: (d) => {
|
|
2114
|
-
var h;
|
|
2115
|
-
return (h = d.matches.find((f) => f.id === t)) == null ? void 0 : h.routeId;
|
|
2116
|
-
}
|
|
2117
|
-
}), a = o.routesById[r], s = D({
|
|
2118
|
-
select: (d) => d.matches.findIndex((h) => h.id === t)
|
|
2119
|
-
}), i = D({
|
|
2120
|
-
select: (d) => {
|
|
2121
|
-
const h = d.matches[s];
|
|
2122
|
-
return pt(h, [
|
|
2123
|
-
"id",
|
|
2124
|
-
"status",
|
|
2125
|
-
"error",
|
|
2126
|
-
"loadPromise",
|
|
2127
|
-
"minPendingPromise"
|
|
2128
|
-
]);
|
|
2129
|
-
}
|
|
2130
|
-
}), l = (a.options.errorComponent ?? o.options.defaultErrorComponent) || Lt;
|
|
2131
|
-
if (i.status === "notFound") {
|
|
2132
|
-
let d;
|
|
2133
|
-
return Ht(i.error) ? d = (((n = o.options.errorSerializer) == null ? void 0 : n.deserialize) ?? Wt)(i.error.data) : d = i.error, H(Q(d), "Expected a notFound error"), te(o, a, d);
|
|
2134
|
-
}
|
|
2135
|
-
if (i.status === "redirected")
|
|
2136
|
-
throw H(st(i.error), "Expected a redirect error"), i.loadPromise;
|
|
2137
|
-
if (i.status === "error") {
|
|
2138
|
-
if (o.isServer)
|
|
2139
|
-
return /* @__PURE__ */ _(
|
|
2140
|
-
l,
|
|
2141
|
-
{
|
|
2142
|
-
error: i.error,
|
|
2143
|
-
info: {
|
|
2144
|
-
componentStack: ""
|
|
2145
|
-
}
|
|
2146
|
-
}
|
|
2147
|
-
);
|
|
2148
|
-
throw Ht(i.error) ? (((e = o.options.errorSerializer) == null ? void 0 : e.deserialize) ?? Wt)(i.error.data) : i.error;
|
|
2149
|
-
}
|
|
2150
|
-
if (i.status === "pending") {
|
|
2151
|
-
const d = a.options.pendingMinMs ?? o.options.defaultPendingMinMs;
|
|
2152
|
-
if (d && !i.minPendingPromise && !o.isServer) {
|
|
2153
|
-
const h = ct();
|
|
2154
|
-
Promise.resolve().then(() => {
|
|
2155
|
-
o.updateMatch(i.id, (f) => ({
|
|
2156
|
-
...f,
|
|
2157
|
-
minPendingPromise: h
|
|
2158
|
-
}));
|
|
2159
|
-
}), setTimeout(() => {
|
|
2160
|
-
h.resolve(), o.updateMatch(i.id, (f) => ({
|
|
2161
|
-
...f,
|
|
2162
|
-
minPendingPromise: void 0
|
|
2163
|
-
}));
|
|
2164
|
-
}, d);
|
|
2165
|
-
}
|
|
2166
|
-
throw i.loadPromise;
|
|
2167
|
-
}
|
|
2168
|
-
const c = a.options.component ?? o.options.defaultComponent;
|
|
2169
|
-
return /* @__PURE__ */ yt(Vt, { children: [
|
|
2170
|
-
c ? /* @__PURE__ */ _(c, {}) : /* @__PURE__ */ _(Je, {}),
|
|
2171
|
-
o.AfterEachMatch ? /* @__PURE__ */ _(o.AfterEachMatch, { match: i, matchIndex: s }) : null
|
|
2172
|
-
] });
|
|
2173
|
-
}
|
|
2174
|
-
const Je = L.memo(function() {
|
|
2175
|
-
const n = tt(), e = L.useContext(Ct), o = D({
|
|
2176
|
-
select: (c) => {
|
|
2177
|
-
var u;
|
|
2178
|
-
return (u = c.matches.find((d) => d.id === e)) == null ? void 0 : u.routeId;
|
|
2179
|
-
}
|
|
2180
|
-
}), r = n.routesById[o], { parentGlobalNotFound: a } = D({
|
|
2181
|
-
select: (c) => {
|
|
2182
|
-
const d = c.matches.find((h) => h.id === e);
|
|
2183
|
-
return H(
|
|
2184
|
-
d,
|
|
2185
|
-
`Could not find parent match for matchId "${e}"`
|
|
2186
|
-
), {
|
|
2187
|
-
parentGlobalNotFound: d.globalNotFound
|
|
2188
|
-
};
|
|
2189
|
-
}
|
|
2190
|
-
}), s = D({
|
|
2191
|
-
select: (c) => {
|
|
2192
|
-
var u;
|
|
2193
|
-
const d = c.matches, h = d.findIndex((f) => f.id === e);
|
|
2194
|
-
return (u = d[h + 1]) == null ? void 0 : u.id;
|
|
2195
|
-
}
|
|
2196
|
-
});
|
|
2197
|
-
if (a)
|
|
2198
|
-
return te(n, r, void 0);
|
|
2199
|
-
if (!s)
|
|
2200
|
-
return null;
|
|
2201
|
-
const i = /* @__PURE__ */ _(ee, { matchId: s }), l = n.options.defaultPendingComponent ? /* @__PURE__ */ _(n.options.defaultPendingComponent, {}) : null;
|
|
2202
|
-
return e === W ? /* @__PURE__ */ _(L.Suspense, { fallback: l, children: i }) : i;
|
|
2203
|
-
});
|
|
2204
|
-
function Ye() {
|
|
2205
|
-
const t = tt(), n = t.options.defaultPendingComponent ? /* @__PURE__ */ _(t.options.defaultPendingComponent, {}) : null, e = t.state.matches.length ? gt : L.Suspense, o = /* @__PURE__ */ yt(e, { fallback: n, children: [
|
|
2206
|
-
/* @__PURE__ */ _(Xe, {}),
|
|
2207
|
-
/* @__PURE__ */ _(Qe, {})
|
|
2208
|
-
] });
|
|
2209
|
-
return t.options.InnerWrap ? /* @__PURE__ */ _(t.options.InnerWrap, { children: o }) : o;
|
|
2210
|
-
}
|
|
2211
|
-
function Qe() {
|
|
2212
|
-
const t = D({
|
|
2213
|
-
select: (e) => {
|
|
2214
|
-
var o;
|
|
2215
|
-
return (o = e.matches[0]) == null ? void 0 : o.id;
|
|
2216
|
-
}
|
|
2217
|
-
}), n = D({
|
|
2218
|
-
select: (e) => e.loadedAt
|
|
2219
|
-
});
|
|
2220
|
-
return /* @__PURE__ */ _(Ct.Provider, { value: t, children: /* @__PURE__ */ _(
|
|
2221
|
-
Bt,
|
|
2222
|
-
{
|
|
2223
|
-
getResetKey: () => n,
|
|
2224
|
-
errorComponent: Lt,
|
|
2225
|
-
onCatch: (e) => {
|
|
2226
|
-
ut(
|
|
2227
|
-
!1,
|
|
2228
|
-
"The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"
|
|
2229
|
-
), ut(!1, e.message || e.toString());
|
|
2230
|
-
},
|
|
2231
|
-
children: t ? /* @__PURE__ */ _(ee, { matchId: t }) : null
|
|
2232
|
-
}
|
|
2233
|
-
) });
|
|
2234
|
-
}
|
|
2235
|
-
function Ze({
|
|
2236
|
-
router: t,
|
|
2237
|
-
children: n,
|
|
2238
|
-
...e
|
|
2239
|
-
}) {
|
|
2240
|
-
t.update({
|
|
2241
|
-
...t.options,
|
|
2242
|
-
...e,
|
|
2243
|
-
context: {
|
|
2244
|
-
...t.options.context,
|
|
2245
|
-
...e.context
|
|
2246
|
-
}
|
|
2247
|
-
});
|
|
2248
|
-
const o = Qt(), r = /* @__PURE__ */ _(o.Provider, { value: t, children: n });
|
|
2249
|
-
return t.options.Wrap ? /* @__PURE__ */ _(t.options.Wrap, { children: r }) : r;
|
|
2250
|
-
}
|
|
2251
|
-
function mo({ router: t, ...n }) {
|
|
2252
|
-
return /* @__PURE__ */ _(Ze, { router: t, ...n, children: /* @__PURE__ */ _(Ye, {}) });
|
|
2253
|
-
}
|
|
2254
|
-
const to = typeof window < "u" ? L.useLayoutEffect : L.useEffect, Ft = "window", Ut = "___";
|
|
2255
|
-
let kt = /* @__PURE__ */ new WeakSet();
|
|
2256
|
-
const eo = typeof window < "u" && window.sessionStorage, G = eo ? (() => {
|
|
2257
|
-
const t = "tsr-scroll-restoration-v2";
|
|
2258
|
-
return {
|
|
2259
|
-
state: JSON.parse(
|
|
2260
|
-
window.sessionStorage.getItem(t) || "null"
|
|
2261
|
-
) || { cached: {}, next: {} },
|
|
2262
|
-
set: (e) => {
|
|
2263
|
-
G.state = it(e, G.state), window.sessionStorage.setItem(t, JSON.stringify(G.state));
|
|
2264
|
-
}
|
|
2265
|
-
};
|
|
2266
|
-
})() : void 0, oo = (t) => t.state.key || t.href;
|
|
2267
|
-
function no(t) {
|
|
2268
|
-
const n = tt();
|
|
2269
|
-
to(() => {
|
|
2270
|
-
const e = t?.getKey || oo, { history: o } = window;
|
|
2271
|
-
o.scrollRestoration = "manual";
|
|
2272
|
-
const r = (i) => {
|
|
2273
|
-
if (kt.has(i.target)) return;
|
|
2274
|
-
kt.add(i.target);
|
|
2275
|
-
let l = "";
|
|
2276
|
-
if (i.target === document || i.target === window)
|
|
2277
|
-
l = Ft;
|
|
2278
|
-
else {
|
|
2279
|
-
const c = i.target.getAttribute(
|
|
2280
|
-
"data-scroll-restoration-id"
|
|
2281
|
-
);
|
|
2282
|
-
c ? l = `[data-scroll-restoration-id="${c}"]` : l = ro(i.target);
|
|
2283
|
-
}
|
|
2284
|
-
G.state.next[l] || G.set((c) => ({
|
|
2285
|
-
...c,
|
|
2286
|
-
next: {
|
|
2287
|
-
...c.next,
|
|
2288
|
-
[l]: {
|
|
2289
|
-
scrollX: NaN,
|
|
2290
|
-
scrollY: NaN
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
}));
|
|
2294
|
-
};
|
|
2295
|
-
typeof document < "u" && document.addEventListener("scroll", r, !0);
|
|
2296
|
-
const a = n.subscribe("onBeforeLoad", (i) => {
|
|
2297
|
-
if (i.pathChanged) {
|
|
2298
|
-
const l = e(i.fromLocation);
|
|
2299
|
-
for (const c in G.state.next) {
|
|
2300
|
-
const u = G.state.next[c];
|
|
2301
|
-
if (c === Ft)
|
|
2302
|
-
u.scrollX = window.scrollX || 0, u.scrollY = window.scrollY || 0;
|
|
2303
|
-
else if (c) {
|
|
2304
|
-
const d = document.querySelector(c);
|
|
2305
|
-
u.scrollX = d?.scrollLeft || 0, u.scrollY = d?.scrollTop || 0;
|
|
2306
|
-
}
|
|
2307
|
-
G.set((d) => {
|
|
2308
|
-
const h = { ...d.next };
|
|
2309
|
-
return delete h[c], {
|
|
2310
|
-
...d,
|
|
2311
|
-
next: h,
|
|
2312
|
-
cached: {
|
|
2313
|
-
...d.cached,
|
|
2314
|
-
[[l, c].join(Ut)]: u
|
|
2315
|
-
}
|
|
2316
|
-
};
|
|
2317
|
-
});
|
|
2318
|
-
}
|
|
2319
|
-
}
|
|
2320
|
-
}), s = n.subscribe("onResolved", (i) => {
|
|
2321
|
-
if (i.pathChanged) {
|
|
2322
|
-
if (!n.resetNextScroll)
|
|
2323
|
-
return;
|
|
2324
|
-
n.resetNextScroll = !0;
|
|
2325
|
-
const l = e(i.toLocation);
|
|
2326
|
-
let c = !1;
|
|
2327
|
-
for (const u in G.state.cached) {
|
|
2328
|
-
const d = G.state.cached[u], [h, f] = u.split(Ut);
|
|
2329
|
-
if (h === l) {
|
|
2330
|
-
if (f === Ft)
|
|
2331
|
-
c = !0, window.scrollTo(d.scrollX, d.scrollY);
|
|
2332
|
-
else if (f) {
|
|
2333
|
-
const m = document.querySelector(f);
|
|
2334
|
-
m && (m.scrollLeft = d.scrollX, m.scrollTop = d.scrollY);
|
|
2335
|
-
}
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2338
|
-
c || window.scrollTo(0, 0), G.set((u) => ({ ...u, next: {} })), kt = /* @__PURE__ */ new WeakSet();
|
|
2339
|
-
}
|
|
2340
|
-
});
|
|
2341
|
-
return () => {
|
|
2342
|
-
document.removeEventListener("scroll", r), a(), s();
|
|
2343
|
-
};
|
|
2344
|
-
}, [t?.getKey, n]);
|
|
2345
|
-
}
|
|
2346
|
-
function vo(t) {
|
|
2347
|
-
return no(t), null;
|
|
2348
|
-
}
|
|
2349
|
-
function ro(t) {
|
|
2350
|
-
const n = [];
|
|
2351
|
-
let e;
|
|
2352
|
-
for (; e = t.parentNode; )
|
|
2353
|
-
n.unshift(
|
|
2354
|
-
`${t.tagName}:nth-child(${[].indexOf.call(e.children, t) + 1})`
|
|
2355
|
-
), t = e;
|
|
2356
|
-
return `${n.join(" > ")}`.toLowerCase();
|
|
2357
|
-
}
|
|
2358
|
-
export {
|
|
2359
|
-
po as L,
|
|
2360
|
-
Je as O,
|
|
2361
|
-
mo as R,
|
|
2362
|
-
vo as S,
|
|
2363
|
-
fo as a,
|
|
2364
|
-
Ae as b,
|
|
2365
|
-
ho as c,
|
|
2366
|
-
D as d,
|
|
2367
|
-
uo as e,
|
|
2368
|
-
co as f,
|
|
2369
|
-
Jt as g,
|
|
2370
|
-
Q as i,
|
|
2371
|
-
lo as n,
|
|
2372
|
-
tt as u
|
|
2373
|
-
};
|