@benjavicente/angular-router-experimental 1.142.11

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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/fesm2022/tanstack-angular-router-experimental-experimental.mjs +920 -0
  4. package/dist/fesm2022/tanstack-angular-router-experimental.mjs +4131 -0
  5. package/dist/types/tanstack-angular-router-experimental-experimental.d.ts +110 -0
  6. package/dist/types/tanstack-angular-router-experimental.d.ts +733 -0
  7. package/experimental/injectRouteErrorHandler.ts +51 -0
  8. package/experimental/public_api.ts +8 -0
  9. package/package.json +98 -0
  10. package/src/DefaultNotFound.ts +9 -0
  11. package/src/Link.ts +352 -0
  12. package/src/Match.ts +338 -0
  13. package/src/Matches.ts +37 -0
  14. package/src/RouterProvider.ts +162 -0
  15. package/src/document/build-match-managed-document.ts +308 -0
  16. package/src/document/document-dehydration.ts +27 -0
  17. package/src/document/document-equality.ts +29 -0
  18. package/src/document/document-router-token.ts +6 -0
  19. package/src/document/index.ts +33 -0
  20. package/src/document/install-unified-document-sync.ts +108 -0
  21. package/src/document/managed-document-types.ts +36 -0
  22. package/src/document/managed-dom.ts +307 -0
  23. package/src/document/provide-tanstack-body-managed-tags.ts +78 -0
  24. package/src/document/provide-tanstack-document-title.ts +59 -0
  25. package/src/document/provide-tanstack-document.ts +62 -0
  26. package/src/document/provide-tanstack-head-managed-tags.ts +63 -0
  27. package/src/fileRoute.ts +232 -0
  28. package/src/index.ts +173 -0
  29. package/src/injectBlocker.ts +196 -0
  30. package/src/injectCanGoBack.ts +11 -0
  31. package/src/injectErrorState.ts +21 -0
  32. package/src/injectIntersectionObserver.ts +28 -0
  33. package/src/injectLoaderData.ts +49 -0
  34. package/src/injectLoaderDeps.ts +45 -0
  35. package/src/injectLocation.ts +38 -0
  36. package/src/injectMatch.ts +122 -0
  37. package/src/injectMatchRoute.ts +58 -0
  38. package/src/injectMatches.ts +79 -0
  39. package/src/injectNavigate.ts +24 -0
  40. package/src/injectParams.ts +71 -0
  41. package/src/injectRouteContext.ts +31 -0
  42. package/src/injectRouter.ts +17 -0
  43. package/src/injectRouterState.ts +53 -0
  44. package/src/injectSearch.ts +71 -0
  45. package/src/injectStore.ts +87 -0
  46. package/src/matchInjectorToken.ts +23 -0
  47. package/src/renderer/injectIsCatchingError.ts +40 -0
  48. package/src/renderer/injectRender.ts +69 -0
  49. package/src/route.ts +641 -0
  50. package/src/router.ts +141 -0
  51. package/src/routerInjectionToken.ts +24 -0
  52. package/src/routerStores.ts +107 -0
  53. package/src/ssr-scroll-restoration.ts +48 -0
  54. package/src/transitioner.ts +255 -0
@@ -0,0 +1,4131 @@
1
+ import * as e from "@angular/core";
2
+ import { ChangeDetectionStrategy as t, DestroyRef as n, ElementRef as r, EnvironmentInjector as i, InjectionToken as a, Injector as o, Renderer2 as s, ViewContainerRef as c, afterNextRender as l, assertInInjectionContext as u, computed as d, effect as f, inject as p, input as m, inputBinding as h, isDevMode as g, linkedSignal as _, signal as v, untracked as y } from "@angular/core";
3
+ import { DOCUMENT as b } from "@angular/common";
4
+ //#region ../router-core/dist/esm/utils.js
5
+ function x(e) {
6
+ return e[e.length - 1];
7
+ }
8
+ function S(e) {
9
+ return typeof e == "function";
10
+ }
11
+ function C(e, t) {
12
+ return S(e) ? e(t) : e;
13
+ }
14
+ var w = Object.prototype.hasOwnProperty, ee = Object.prototype.propertyIsEnumerable, te = () => Object.create(null), T = (e, t) => E(e, t, te);
15
+ function E(e, t, n = () => ({}), r = 0) {
16
+ if (e === t) return e;
17
+ if (r > 500) return t;
18
+ let i = t, a = ie(e) && ie(i);
19
+ if (!a && !(D(e) && D(i))) return i;
20
+ let o = a ? e : ne(e);
21
+ if (!o) return i;
22
+ let s = a ? i : ne(i);
23
+ if (!s) return i;
24
+ let c = o.length, l = s.length, u = a ? Array(l) : n(), d = 0;
25
+ for (let t = 0; t < l; t++) {
26
+ let o = a ? t : s[t], l = e[o], f = i[o];
27
+ if (l === f) {
28
+ u[o] = l, (a ? t < c : w.call(e, o)) && d++;
29
+ continue;
30
+ }
31
+ if (l === null || f === null || typeof l != "object" || typeof f != "object") {
32
+ u[o] = f;
33
+ continue;
34
+ }
35
+ let p = E(l, f, n, r + 1);
36
+ u[o] = p, p === l && d++;
37
+ }
38
+ return c === l && d === c ? e : u;
39
+ }
40
+ function ne(e) {
41
+ let t = Object.getOwnPropertyNames(e);
42
+ for (let n of t) if (!ee.call(e, n)) return !1;
43
+ let n = Object.getOwnPropertySymbols(e);
44
+ if (n.length === 0) return t;
45
+ let r = t;
46
+ for (let t of n) {
47
+ if (!ee.call(e, t)) return !1;
48
+ r.push(t);
49
+ }
50
+ return r;
51
+ }
52
+ function D(e) {
53
+ if (!re(e)) return !1;
54
+ let t = e.constructor;
55
+ if (t === void 0) return !0;
56
+ let n = t.prototype;
57
+ return !(!re(n) || !n.hasOwnProperty("isPrototypeOf"));
58
+ }
59
+ function re(e) {
60
+ return Object.prototype.toString.call(e) === "[object Object]";
61
+ }
62
+ function ie(e) {
63
+ return Array.isArray(e) && e.length === Object.keys(e).length;
64
+ }
65
+ function O(e, t, n) {
66
+ if (e === t) return !0;
67
+ if (typeof e != typeof t) return !1;
68
+ if (Array.isArray(e) && Array.isArray(t)) {
69
+ if (e.length !== t.length) return !1;
70
+ for (let r = 0, i = e.length; r < i; r++) if (!O(e[r], t[r], n)) return !1;
71
+ return !0;
72
+ }
73
+ if (D(e) && D(t)) {
74
+ let r = n?.ignoreUndefined ?? !0;
75
+ if (n?.partial) {
76
+ for (let i in t) if ((!r || t[i] !== void 0) && !O(e[i], t[i], n)) return !1;
77
+ return !0;
78
+ }
79
+ let i = 0;
80
+ if (!r) i = Object.keys(e).length;
81
+ else for (let t in e) e[t] !== void 0 && i++;
82
+ let a = 0;
83
+ for (let o in t) if ((!r || t[o] !== void 0) && (a++, a > i || !O(e[o], t[o], n))) return !1;
84
+ return i === a;
85
+ }
86
+ return !1;
87
+ }
88
+ function k(e) {
89
+ let t, n, r = new Promise((e, r) => {
90
+ t = e, n = r;
91
+ });
92
+ return r.status = "pending", r.resolve = (n) => {
93
+ r.status = "resolved", r.value = n, t(n), e?.(n);
94
+ }, r.reject = (e) => {
95
+ r.status = "rejected", n(e);
96
+ }, r;
97
+ }
98
+ function A(e) {
99
+ return !!(e && typeof e == "object" && typeof e.then == "function");
100
+ }
101
+ function ae(e, t) {
102
+ for (let n = e.length - 1; n >= 0; n--) {
103
+ let r = e[n];
104
+ if (t(r)) return r;
105
+ }
106
+ }
107
+ function oe(e) {
108
+ return e.replace(/[\x00-\x1f\x7f]/g, "");
109
+ }
110
+ function se(e) {
111
+ let t;
112
+ try {
113
+ t = decodeURI(e);
114
+ } catch {
115
+ t = e.replaceAll(/%[0-9A-F]{2}/gi, (e) => {
116
+ try {
117
+ return decodeURI(e);
118
+ } catch {
119
+ return e;
120
+ }
121
+ });
122
+ }
123
+ return oe(t);
124
+ }
125
+ var ce = [
126
+ "http:",
127
+ "https:",
128
+ "mailto:",
129
+ "tel:"
130
+ ];
131
+ function le(e, t) {
132
+ if (!e) return !1;
133
+ try {
134
+ let n = new URL(e);
135
+ return !t.has(n.protocol);
136
+ } catch {
137
+ return !1;
138
+ }
139
+ }
140
+ var ue = {
141
+ "&": "\\u0026",
142
+ ">": "\\u003e",
143
+ "<": "\\u003c",
144
+ "\u2028": "\\u2028",
145
+ "\u2029": "\\u2029"
146
+ }, de = /[&><\u2028\u2029]/g;
147
+ function fe(e) {
148
+ return e.replace(de, (e) => ue[e]);
149
+ }
150
+ function j(e) {
151
+ if (!e || !/[%\\\x00-\x1f\x7f]/.test(e) && !e.startsWith("//")) return {
152
+ path: e,
153
+ handledProtocolRelativeURL: !1
154
+ };
155
+ let t = /%25|%5C/gi, n = 0, r = "", i;
156
+ for (; (i = t.exec(e)) !== null;) r += se(e.slice(n, i.index)) + i[0], n = t.lastIndex;
157
+ r += se(n ? e.slice(n) : e);
158
+ let a = !1;
159
+ return r.startsWith("//") && (a = !0, r = "/" + r.replace(/^\/+/, "")), {
160
+ path: r,
161
+ handledProtocolRelativeURL: a
162
+ };
163
+ }
164
+ function pe(e) {
165
+ return /\s|[^\u0000-\u007F]/.test(e) ? e.replace(/\s|[^\u0000-\u007F]/gu, encodeURIComponent) : e;
166
+ }
167
+ function me(e, t) {
168
+ if (e === t) return !0;
169
+ if (e.length !== t.length) return !1;
170
+ for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
171
+ return !0;
172
+ }
173
+ //#endregion
174
+ //#region ../router-core/dist/esm/invariant.js
175
+ function he() {
176
+ throw Error("Invariant failed");
177
+ }
178
+ //#endregion
179
+ //#region ../router-core/dist/esm/lru-cache.js
180
+ function ge(e) {
181
+ let t = /* @__PURE__ */ new Map(), n, r, i = (e) => {
182
+ e.next && (e.prev ? (e.prev.next = e.next, e.next.prev = e.prev, e.next = void 0, r && (r.next = e, e.prev = r)) : (e.next.prev = void 0, n = e.next, e.next = void 0, r && (e.prev = r, r.next = e)), r = e);
183
+ };
184
+ return {
185
+ get(e) {
186
+ let n = t.get(e);
187
+ if (n) return i(n), n.value;
188
+ },
189
+ set(a, o) {
190
+ if (t.size >= e && n) {
191
+ let e = n;
192
+ t.delete(e.key), e.next && (n = e.next, e.next.prev = void 0), e === r && (r = void 0);
193
+ }
194
+ let s = t.get(a);
195
+ if (s) s.value = o, i(s);
196
+ else {
197
+ let e = {
198
+ key: a,
199
+ value: o,
200
+ prev: r
201
+ };
202
+ r && (r.next = e), r = e, n ||= e, t.set(a, e);
203
+ }
204
+ },
205
+ clear() {
206
+ t.clear(), n = void 0, r = void 0;
207
+ }
208
+ };
209
+ }
210
+ //#endregion
211
+ //#region ../router-core/dist/esm/new-process-route-tree.js
212
+ var M = 4, _e = 5;
213
+ function ve(e) {
214
+ let t = e.indexOf("{");
215
+ if (t === -1) return null;
216
+ let n = e.indexOf("}", t);
217
+ return n === -1 || t + 1 >= e.length ? null : [t, n];
218
+ }
219
+ function ye(e, t, n = new Uint16Array(6)) {
220
+ let r = e.indexOf("/", t), i = r === -1 ? e.length : r, a = e.substring(t, i);
221
+ if (!a || !a.includes("$")) return n[0] = 0, n[1] = t, n[2] = t, n[3] = i, n[4] = i, n[5] = i, n;
222
+ if (a === "$") {
223
+ let r = e.length;
224
+ return n[0] = 2, n[1] = t, n[2] = t, n[3] = r, n[4] = r, n[5] = r, n;
225
+ }
226
+ if (a.charCodeAt(0) === 36) return n[0] = 1, n[1] = t, n[2] = t + 1, n[3] = i, n[4] = i, n[5] = i, n;
227
+ let o = ve(a);
228
+ if (o) {
229
+ let [r, s] = o, c = a.charCodeAt(r + 1);
230
+ if (c === 45) {
231
+ if (r + 2 < a.length && a.charCodeAt(r + 2) === 36) {
232
+ let e = r + 3, a = s;
233
+ if (e < a) return n[0] = 3, n[1] = t + r, n[2] = t + e, n[3] = t + a, n[4] = t + s + 1, n[5] = i, n;
234
+ }
235
+ } else if (c === 36) {
236
+ let a = r + 1, o = r + 2;
237
+ return o === s ? (n[0] = 2, n[1] = t + r, n[2] = t + a, n[3] = t + o, n[4] = t + s + 1, n[5] = e.length, n) : (n[0] = 1, n[1] = t + r, n[2] = t + o, n[3] = t + s, n[4] = t + s + 1, n[5] = i, n);
238
+ }
239
+ }
240
+ return n[0] = 0, n[1] = t, n[2] = t, n[3] = i, n[4] = i, n[5] = i, n;
241
+ }
242
+ function be(e, t, n, r, i, a, o) {
243
+ o?.(n);
244
+ let s = r;
245
+ {
246
+ let r = n.fullPath ?? n.from, o = r.length, c = n.options?.caseSensitive ?? e, l = !!(n.options?.params?.parse && n.options?.skipRouteOnParseError?.params);
247
+ for (; s < o;) {
248
+ let e = ye(r, s, t), o, u = s, d = e[5];
249
+ switch (s = d + 1, a++, e[0]) {
250
+ case 0: {
251
+ let t = r.substring(e[2], e[3]);
252
+ if (c) {
253
+ let e = i.static?.get(t);
254
+ if (e) o = e;
255
+ else {
256
+ i.static ??= /* @__PURE__ */ new Map();
257
+ let e = P(n.fullPath ?? n.from);
258
+ e.parent = i, e.depth = a, o = e, i.static.set(t, e);
259
+ }
260
+ } else {
261
+ let e = t.toLowerCase(), r = i.staticInsensitive?.get(e);
262
+ if (r) o = r;
263
+ else {
264
+ i.staticInsensitive ??= /* @__PURE__ */ new Map();
265
+ let t = P(n.fullPath ?? n.from);
266
+ t.parent = i, t.depth = a, o = t, i.staticInsensitive.set(e, t);
267
+ }
268
+ }
269
+ break;
270
+ }
271
+ case 1: {
272
+ let t = r.substring(u, e[1]), s = r.substring(e[4], d), f = c && !!(t || s), p = t ? f ? t : t.toLowerCase() : void 0, m = s ? f ? s : s.toLowerCase() : void 0, h = !l && i.dynamic?.find((e) => !e.skipOnParamError && e.caseSensitive === f && e.prefix === p && e.suffix === m);
273
+ if (h) o = h;
274
+ else {
275
+ let e = Se(1, n.fullPath ?? n.from, f, p, m);
276
+ o = e, e.depth = a, e.parent = i, i.dynamic ??= [], i.dynamic.push(e);
277
+ }
278
+ break;
279
+ }
280
+ case 3: {
281
+ let t = r.substring(u, e[1]), s = r.substring(e[4], d), f = c && !!(t || s), p = t ? f ? t : t.toLowerCase() : void 0, m = s ? f ? s : s.toLowerCase() : void 0, h = !l && i.optional?.find((e) => !e.skipOnParamError && e.caseSensitive === f && e.prefix === p && e.suffix === m);
282
+ if (h) o = h;
283
+ else {
284
+ let e = Se(3, n.fullPath ?? n.from, f, p, m);
285
+ o = e, e.parent = i, e.depth = a, i.optional ??= [], i.optional.push(e);
286
+ }
287
+ break;
288
+ }
289
+ case 2: {
290
+ let t = r.substring(u, e[1]), s = r.substring(e[4], d), l = c && !!(t || s), f = t ? l ? t : t.toLowerCase() : void 0, p = s ? l ? s : s.toLowerCase() : void 0, m = Se(2, n.fullPath ?? n.from, l, f, p);
291
+ o = m, m.parent = i, m.depth = a, i.wildcard ??= [], i.wildcard.push(m);
292
+ }
293
+ }
294
+ i = o;
295
+ }
296
+ if (l && n.children && !n.isRoot && n.id && n.id.charCodeAt(n.id.lastIndexOf("/") + 1) === 95) {
297
+ let e = P(n.fullPath ?? n.from);
298
+ e.kind = _e, e.parent = i, a++, e.depth = a, i.pathless ??= [], i.pathless.push(e), i = e;
299
+ }
300
+ let u = (n.path || !n.children) && !n.isRoot;
301
+ if (u && r.endsWith("/")) {
302
+ let e = P(n.fullPath ?? n.from);
303
+ e.kind = M, e.parent = i, a++, e.depth = a, i.index = e, i = e;
304
+ }
305
+ i.parse = n.options?.params?.parse ?? null, i.skipOnParamError = l, i.parsingPriority = n.options?.skipRouteOnParseError?.priority ?? 0, u && !i.route && (i.route = n, i.fullPath = n.fullPath ?? n.from);
306
+ }
307
+ if (n.children) for (let r of n.children) be(e, t, r, s, i, a, o);
308
+ }
309
+ function xe(e, t) {
310
+ if (e.skipOnParamError && !t.skipOnParamError) return -1;
311
+ if (!e.skipOnParamError && t.skipOnParamError) return 1;
312
+ if (e.skipOnParamError && t.skipOnParamError && (e.parsingPriority || t.parsingPriority)) return t.parsingPriority - e.parsingPriority;
313
+ if (e.prefix && t.prefix && e.prefix !== t.prefix) {
314
+ if (e.prefix.startsWith(t.prefix)) return -1;
315
+ if (t.prefix.startsWith(e.prefix)) return 1;
316
+ }
317
+ if (e.suffix && t.suffix && e.suffix !== t.suffix) {
318
+ if (e.suffix.endsWith(t.suffix)) return -1;
319
+ if (t.suffix.endsWith(e.suffix)) return 1;
320
+ }
321
+ return e.prefix && !t.prefix ? -1 : !e.prefix && t.prefix ? 1 : e.suffix && !t.suffix ? -1 : !e.suffix && t.suffix ? 1 : e.caseSensitive && !t.caseSensitive ? -1 : !e.caseSensitive && t.caseSensitive ? 1 : 0;
322
+ }
323
+ function N(e) {
324
+ if (e.pathless) for (let t of e.pathless) N(t);
325
+ if (e.static) for (let t of e.static.values()) N(t);
326
+ if (e.staticInsensitive) for (let t of e.staticInsensitive.values()) N(t);
327
+ if (e.dynamic?.length) {
328
+ e.dynamic.sort(xe);
329
+ for (let t of e.dynamic) N(t);
330
+ }
331
+ if (e.optional?.length) {
332
+ e.optional.sort(xe);
333
+ for (let t of e.optional) N(t);
334
+ }
335
+ if (e.wildcard?.length) {
336
+ e.wildcard.sort(xe);
337
+ for (let t of e.wildcard) N(t);
338
+ }
339
+ }
340
+ function P(e) {
341
+ return {
342
+ kind: 0,
343
+ depth: 0,
344
+ pathless: null,
345
+ index: null,
346
+ static: null,
347
+ staticInsensitive: null,
348
+ dynamic: null,
349
+ optional: null,
350
+ wildcard: null,
351
+ route: null,
352
+ fullPath: e,
353
+ parent: null,
354
+ parse: null,
355
+ skipOnParamError: !1,
356
+ parsingPriority: 0
357
+ };
358
+ }
359
+ function Se(e, t, n, r, i) {
360
+ return {
361
+ kind: e,
362
+ depth: 0,
363
+ pathless: null,
364
+ index: null,
365
+ static: null,
366
+ staticInsensitive: null,
367
+ dynamic: null,
368
+ optional: null,
369
+ wildcard: null,
370
+ route: null,
371
+ fullPath: t,
372
+ parent: null,
373
+ parse: null,
374
+ skipOnParamError: !1,
375
+ parsingPriority: 0,
376
+ caseSensitive: n,
377
+ prefix: r,
378
+ suffix: i
379
+ };
380
+ }
381
+ function Ce(e, t) {
382
+ let n = P("/"), r = new Uint16Array(6);
383
+ for (let t of e) be(!1, r, t, 1, n, 0);
384
+ N(n), t.masksTree = n, t.flatCache = ge(1e3);
385
+ }
386
+ function we(e, t) {
387
+ e ||= "/";
388
+ let n = t.flatCache.get(e);
389
+ if (n) return n;
390
+ let r = ke(e, t.masksTree);
391
+ return t.flatCache.set(e, r), r;
392
+ }
393
+ function Te(e, t, n, r, i) {
394
+ e ||= "/", r ||= "/";
395
+ let a = t ? `case\0${e}` : e, o = i.singleCache.get(a);
396
+ return o || (o = P("/"), be(t, new Uint16Array(6), { from: e }, 1, o, 0), i.singleCache.set(a, o)), ke(r, o, n);
397
+ }
398
+ function Ee(e, t, n = !1) {
399
+ let r = n ? e : `nofuzz\0${e}`, i = t.matchCache.get(r);
400
+ if (i !== void 0) return i;
401
+ e ||= "/";
402
+ let a;
403
+ try {
404
+ a = ke(e, t.segmentTree, n);
405
+ } catch (e) {
406
+ if (e instanceof URIError) a = null;
407
+ else throw e;
408
+ }
409
+ return a && (a.branch = je(a.route)), t.matchCache.set(r, a), a;
410
+ }
411
+ function De(e) {
412
+ return e === "/" ? e : e.replace(/\/{1,}$/, "");
413
+ }
414
+ function Oe(e, t = !1, n) {
415
+ let r = P(e.fullPath), i = new Uint16Array(6), a = {}, o = {}, s = 0;
416
+ return be(t, i, e, 1, r, 0, (e) => {
417
+ if (n?.(e, s), e.id in a) {
418
+ if (process.env.NODE_ENV !== "production") throw Error(`Invariant failed: Duplicate routes found with id: ${String(e.id)}`);
419
+ he();
420
+ }
421
+ if (a[e.id] = e, s !== 0 && e.path) {
422
+ let t = De(e.fullPath);
423
+ (!o[t] || e.fullPath.endsWith("/")) && (o[t] = e);
424
+ }
425
+ s++;
426
+ }), N(r), {
427
+ processedTree: {
428
+ segmentTree: r,
429
+ singleCache: ge(1e3),
430
+ matchCache: ge(1e3),
431
+ flatCache: null,
432
+ masksTree: null
433
+ },
434
+ routesById: a,
435
+ routesByPath: o
436
+ };
437
+ }
438
+ function ke(e, t, n = !1) {
439
+ let r = e.split("/"), i = Ne(e, r, t, n);
440
+ if (!i) return null;
441
+ let [a] = Ae(e, r, i);
442
+ return {
443
+ route: i.node.route,
444
+ rawParams: a,
445
+ parsedParams: i.parsedParams
446
+ };
447
+ }
448
+ function Ae(e, t, n) {
449
+ let r = Me(n.node), i = null, a = Object.create(null), o = n.extract?.part ?? 0, s = n.extract?.node ?? 0, c = n.extract?.path ?? 0, l = n.extract?.segment ?? 0;
450
+ for (; s < r.length; o++, s++, c++, l++) {
451
+ let u = r[s];
452
+ if (u.kind === M) break;
453
+ if (u.kind === _e) {
454
+ l--, o--, c--;
455
+ continue;
456
+ }
457
+ let d = t[o], f = c;
458
+ if (d && (c += d.length), u.kind === 1) {
459
+ i ??= n.node.fullPath.split("/");
460
+ let e = i[l], t = u.prefix?.length ?? 0;
461
+ if (e.charCodeAt(t) === 123) {
462
+ let n = u.suffix?.length ?? 0, r = e.substring(t + 2, e.length - n - 1), i = d.substring(t, d.length - n);
463
+ a[r] = decodeURIComponent(i);
464
+ } else {
465
+ let t = e.substring(1);
466
+ a[t] = decodeURIComponent(d);
467
+ }
468
+ } else if (u.kind === 3) {
469
+ if (n.skipped & 1 << s) {
470
+ o--, c = f - 1;
471
+ continue;
472
+ }
473
+ i ??= n.node.fullPath.split("/");
474
+ let e = i[l], t = u.prefix?.length ?? 0, r = u.suffix?.length ?? 0, p = e.substring(t + 3, e.length - r - 1), m = u.suffix || u.prefix ? d.substring(t, d.length - r) : d;
475
+ m && (a[p] = decodeURIComponent(m));
476
+ } else if (u.kind === 2) {
477
+ let t = u, n = e.substring(f + (t.prefix?.length ?? 0), e.length - (t.suffix?.length ?? 0)), r = decodeURIComponent(n);
478
+ a["*"] = r, a._splat = r;
479
+ break;
480
+ }
481
+ }
482
+ return n.rawParams && Object.assign(a, n.rawParams), [a, {
483
+ part: o,
484
+ node: s,
485
+ path: c,
486
+ segment: l
487
+ }];
488
+ }
489
+ function je(e) {
490
+ let t = [e];
491
+ for (; e.parentRoute;) e = e.parentRoute, t.push(e);
492
+ return t.reverse(), t;
493
+ }
494
+ function Me(e) {
495
+ let t = Array(e.depth + 1);
496
+ do
497
+ t[e.depth] = e, e = e.parent;
498
+ while (e);
499
+ return t;
500
+ }
501
+ function Ne(e, t, n, r) {
502
+ if (e === "/" && n.index) return {
503
+ node: n.index,
504
+ skipped: 0
505
+ };
506
+ let i = !x(t), a = i && e !== "/", o = t.length - (i ? 1 : 0), s = [{
507
+ node: n,
508
+ index: 1,
509
+ skipped: 0,
510
+ depth: 1,
511
+ statics: 1,
512
+ dynamics: 0,
513
+ optionals: 0
514
+ }], c = null, l = null, u = null;
515
+ for (; s.length;) {
516
+ let n = s.pop(), { node: i, index: d, skipped: f, depth: p, statics: m, dynamics: h, optionals: g } = n, { extract: _, rawParams: v, parsedParams: y } = n;
517
+ if (i.skipOnParamError) {
518
+ if (!Pe(e, t, n)) continue;
519
+ v = n.rawParams, _ = n.extract, y = n.parsedParams;
520
+ }
521
+ r && i.route && i.kind !== M && F(l, n) && (l = n);
522
+ let b = d === o;
523
+ if (b && (i.route && !a && F(u, n) && (u = n), !i.optional && !i.wildcard && !i.index && !i.pathless)) continue;
524
+ let x = b ? void 0 : t[d], S;
525
+ if (b && i.index) {
526
+ let n = {
527
+ node: i.index,
528
+ index: d,
529
+ skipped: f,
530
+ depth: p + 1,
531
+ statics: m,
532
+ dynamics: h,
533
+ optionals: g,
534
+ extract: _,
535
+ rawParams: v,
536
+ parsedParams: y
537
+ }, r = !0;
538
+ if (i.index.skipOnParamError && (Pe(e, t, n) || (r = !1)), r) {
539
+ if (m === o && !h && !g && !f) return n;
540
+ F(u, n) && (u = n);
541
+ }
542
+ }
543
+ if (i.wildcard && F(c, n)) for (let n of i.wildcard) {
544
+ let { prefix: r, suffix: i } = n;
545
+ if (r && (b || !(n.caseSensitive ? x : S ??= x.toLowerCase()).startsWith(r))) continue;
546
+ if (i) {
547
+ if (b) continue;
548
+ let e = t.slice(d).join("/").slice(-i.length);
549
+ if ((n.caseSensitive ? e : e.toLowerCase()) !== i) continue;
550
+ }
551
+ let a = {
552
+ node: n,
553
+ index: o,
554
+ skipped: f,
555
+ depth: p,
556
+ statics: m,
557
+ dynamics: h,
558
+ optionals: g,
559
+ extract: _,
560
+ rawParams: v,
561
+ parsedParams: y
562
+ };
563
+ if (!(n.skipOnParamError && !Pe(e, t, a))) {
564
+ c = a;
565
+ break;
566
+ }
567
+ }
568
+ if (i.optional) {
569
+ let e = f | 1 << p, t = p + 1;
570
+ for (let n = i.optional.length - 1; n >= 0; n--) {
571
+ let r = i.optional[n];
572
+ s.push({
573
+ node: r,
574
+ index: d,
575
+ skipped: e,
576
+ depth: t,
577
+ statics: m,
578
+ dynamics: h,
579
+ optionals: g,
580
+ extract: _,
581
+ rawParams: v,
582
+ parsedParams: y
583
+ });
584
+ }
585
+ if (!b) for (let e = i.optional.length - 1; e >= 0; e--) {
586
+ let n = i.optional[e], { prefix: r, suffix: a } = n;
587
+ if (r || a) {
588
+ let e = n.caseSensitive ? x : S ??= x.toLowerCase();
589
+ if (r && !e.startsWith(r) || a && !e.endsWith(a)) continue;
590
+ }
591
+ s.push({
592
+ node: n,
593
+ index: d + 1,
594
+ skipped: f,
595
+ depth: t,
596
+ statics: m,
597
+ dynamics: h,
598
+ optionals: g + 1,
599
+ extract: _,
600
+ rawParams: v,
601
+ parsedParams: y
602
+ });
603
+ }
604
+ }
605
+ if (!b && i.dynamic && x) for (let e = i.dynamic.length - 1; e >= 0; e--) {
606
+ let t = i.dynamic[e], { prefix: n, suffix: r } = t;
607
+ if (n || r) {
608
+ let e = t.caseSensitive ? x : S ??= x.toLowerCase();
609
+ if (n && !e.startsWith(n) || r && !e.endsWith(r)) continue;
610
+ }
611
+ s.push({
612
+ node: t,
613
+ index: d + 1,
614
+ skipped: f,
615
+ depth: p + 1,
616
+ statics: m,
617
+ dynamics: h + 1,
618
+ optionals: g,
619
+ extract: _,
620
+ rawParams: v,
621
+ parsedParams: y
622
+ });
623
+ }
624
+ if (!b && i.staticInsensitive) {
625
+ let e = i.staticInsensitive.get(S ??= x.toLowerCase());
626
+ e && s.push({
627
+ node: e,
628
+ index: d + 1,
629
+ skipped: f,
630
+ depth: p + 1,
631
+ statics: m + 1,
632
+ dynamics: h,
633
+ optionals: g,
634
+ extract: _,
635
+ rawParams: v,
636
+ parsedParams: y
637
+ });
638
+ }
639
+ if (!b && i.static) {
640
+ let e = i.static.get(x);
641
+ e && s.push({
642
+ node: e,
643
+ index: d + 1,
644
+ skipped: f,
645
+ depth: p + 1,
646
+ statics: m + 1,
647
+ dynamics: h,
648
+ optionals: g,
649
+ extract: _,
650
+ rawParams: v,
651
+ parsedParams: y
652
+ });
653
+ }
654
+ if (i.pathless) {
655
+ let e = p + 1;
656
+ for (let t = i.pathless.length - 1; t >= 0; t--) {
657
+ let n = i.pathless[t];
658
+ s.push({
659
+ node: n,
660
+ index: d,
661
+ skipped: f,
662
+ depth: e,
663
+ statics: m,
664
+ dynamics: h,
665
+ optionals: g,
666
+ extract: _,
667
+ rawParams: v,
668
+ parsedParams: y
669
+ });
670
+ }
671
+ }
672
+ }
673
+ if (u && c) return F(c, u) ? u : c;
674
+ if (u) return u;
675
+ if (c) return c;
676
+ if (r && l) {
677
+ let n = l.index;
678
+ for (let e = 0; e < l.index; e++) n += t[e].length;
679
+ let r = n === e.length ? "/" : e.slice(n);
680
+ return l.rawParams ??= Object.create(null), l.rawParams["**"] = decodeURIComponent(r), l;
681
+ }
682
+ return null;
683
+ }
684
+ function Pe(e, t, n) {
685
+ try {
686
+ let [r, i] = Ae(e, t, n);
687
+ n.rawParams = r, n.extract = i;
688
+ let a = n.node.parse(r);
689
+ return n.parsedParams = Object.assign(Object.create(null), n.parsedParams, a), !0;
690
+ } catch {
691
+ return null;
692
+ }
693
+ }
694
+ function F(e, t) {
695
+ return e ? t.statics > e.statics || t.statics === e.statics && (t.dynamics > e.dynamics || t.dynamics === e.dynamics && (t.optionals > e.optionals || t.optionals === e.optionals && ((t.node.kind === M) > (e.node.kind === M) || t.node.kind === M == (e.node.kind === M) && t.depth > e.depth))) : !0;
696
+ }
697
+ //#endregion
698
+ //#region ../router-core/dist/esm/path.js
699
+ function Fe(e) {
700
+ return Ie(e.filter((e) => e !== void 0).join("/"));
701
+ }
702
+ function Ie(e) {
703
+ return e.replace(/\/{2,}/g, "/");
704
+ }
705
+ function Le(e) {
706
+ return e === "/" ? e : e.replace(/^\/{1,}/, "");
707
+ }
708
+ function I(e) {
709
+ let t = e.length;
710
+ return t > 1 && e[t - 1] === "/" ? e.replace(/\/{1,}$/, "") : e;
711
+ }
712
+ function Re(e) {
713
+ return I(Le(e));
714
+ }
715
+ function ze(e, t) {
716
+ return e?.endsWith("/") && e !== "/" && e !== `${t}/` ? e.slice(0, -1) : e;
717
+ }
718
+ function Be(e, t, n) {
719
+ return ze(e, n) === ze(t, n);
720
+ }
721
+ function Ve({ base: e, to: t, trailingSlash: n = "never", cache: r }) {
722
+ let i = t.startsWith("/"), a = !i && t === ".", o;
723
+ if (r) {
724
+ o = i ? t : a ? e : e + "\0" + t;
725
+ let n = r.get(o);
726
+ if (n) return n;
727
+ }
728
+ let s;
729
+ if (a) s = e.split("/");
730
+ else if (i) s = t.split("/");
731
+ else {
732
+ for (s = e.split("/"); s.length > 1 && x(s) === "";) s.pop();
733
+ let n = t.split("/");
734
+ for (let e = 0, t = n.length; e < t; e++) {
735
+ let r = n[e];
736
+ r === "" ? e ? e === t - 1 && s.push(r) : s = [r] : r === ".." ? s.pop() : r === "." || s.push(r);
737
+ }
738
+ }
739
+ s.length > 1 && (x(s) === "" ? n === "never" && s.pop() : n === "always" && s.push(""));
740
+ let c, l = "";
741
+ for (let e = 0; e < s.length; e++) {
742
+ e > 0 && (l += "/");
743
+ let t = s[e];
744
+ if (!t) continue;
745
+ c = ye(t, 0, c);
746
+ let n = c[0];
747
+ if (n === 0) {
748
+ l += t;
749
+ continue;
750
+ }
751
+ let r = c[5], i = t.substring(0, c[1]), a = t.substring(c[4], r), o = t.substring(c[2], c[3]);
752
+ n === 1 ? l += i || a ? `${i}{$${o}}${a}` : `$${o}` : n === 2 ? l += i || a ? `${i}{$}${a}` : "$" : l += `${i}{-$${o}}${a}`;
753
+ }
754
+ l = Ie(l);
755
+ let u = l || "/";
756
+ return o && r && r.set(o, u), u;
757
+ }
758
+ function He(e) {
759
+ let t = new Map(e.map((e) => [encodeURIComponent(e), e])), n = Array.from(t.keys()).map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), r = new RegExp(n, "g");
760
+ return (e) => e.replace(r, (e) => t.get(e) ?? e);
761
+ }
762
+ function Ue(e, t, n) {
763
+ let r = t[e];
764
+ return typeof r == "string" ? e === "_splat" ? /^[a-zA-Z0-9\-._~!/]*$/.test(r) ? r : r.split("/").map((e) => Ge(e, n)).join("/") : Ge(r, n) : r;
765
+ }
766
+ function We({ path: e, params: t, decoder: n, ...r }) {
767
+ let i = !1, a = Object.create(null);
768
+ if (!e || e === "/") return {
769
+ interpolatedPath: "/",
770
+ usedParams: a,
771
+ isMissingParams: i
772
+ };
773
+ if (!e.includes("$")) return {
774
+ interpolatedPath: e,
775
+ usedParams: a,
776
+ isMissingParams: i
777
+ };
778
+ let o = e.length, s = 0, c, l = "";
779
+ for (; s < o;) {
780
+ let r = s;
781
+ c = ye(e, r, c);
782
+ let o = c[5];
783
+ if (s = o + 1, r === o) continue;
784
+ let u = c[0];
785
+ if (u === 0) {
786
+ l += "/" + e.substring(r, o);
787
+ continue;
788
+ }
789
+ if (u === 2) {
790
+ let s = t._splat;
791
+ a._splat = s, a["*"] = s;
792
+ let u = e.substring(r, c[1]), d = e.substring(c[4], o);
793
+ if (!s) {
794
+ i = !0, (u || d) && (l += "/" + u + d);
795
+ continue;
796
+ }
797
+ let f = Ue("_splat", t, n);
798
+ l += "/" + u + f + d;
799
+ continue;
800
+ }
801
+ if (u === 1) {
802
+ let s = e.substring(c[2], c[3]);
803
+ !i && !(s in t) && (i = !0), a[s] = t[s];
804
+ let u = e.substring(r, c[1]), d = e.substring(c[4], o), f = Ue(s, t, n) ?? "undefined";
805
+ l += "/" + u + f + d;
806
+ continue;
807
+ }
808
+ if (u === 3) {
809
+ let i = e.substring(c[2], c[3]), s = t[i];
810
+ if (s == null) continue;
811
+ a[i] = s;
812
+ let u = e.substring(r, c[1]), d = e.substring(c[4], o), f = Ue(i, t, n) ?? "";
813
+ l += "/" + u + f + d;
814
+ continue;
815
+ }
816
+ }
817
+ return e.endsWith("/") && (l += "/"), {
818
+ usedParams: a,
819
+ interpolatedPath: l || "/",
820
+ isMissingParams: i
821
+ };
822
+ }
823
+ function Ge(e, t) {
824
+ let n = encodeURIComponent(e);
825
+ return t?.(n) ?? n;
826
+ }
827
+ //#endregion
828
+ //#region ../router-core/dist/esm/not-found.js
829
+ function Ke(e = {}) {
830
+ if (e.isNotFound = !0, e.throw) throw e;
831
+ return e;
832
+ }
833
+ function L(e) {
834
+ return !!e?.isNotFound;
835
+ }
836
+ //#endregion
837
+ //#region ../router-core/dist/esm/scroll-restoration.js
838
+ function qe() {
839
+ try {
840
+ return typeof window < "u" && typeof window.sessionStorage == "object" ? window.sessionStorage : void 0;
841
+ } catch {
842
+ return;
843
+ }
844
+ }
845
+ var Je = "tsr-scroll-restoration-v1_3";
846
+ function Ye() {
847
+ let e = qe();
848
+ if (!e) return null;
849
+ let t = {};
850
+ try {
851
+ let n = JSON.parse(e.getItem("tsr-scroll-restoration-v1_3") || "{}");
852
+ D(n) && (t = n);
853
+ } catch {}
854
+ return {
855
+ get state() {
856
+ return t;
857
+ },
858
+ set: (e) => {
859
+ t = C(e, t) || t;
860
+ },
861
+ persist: () => {
862
+ try {
863
+ e.setItem(Je, JSON.stringify(t));
864
+ } catch {
865
+ process.env.NODE_ENV !== "production" && console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.");
866
+ }
867
+ }
868
+ };
869
+ }
870
+ var Xe = Ye(), Ze = (e) => e.state.__TSR_key || e.href;
871
+ function Qe(e) {
872
+ let t = [], n;
873
+ for (; n = e.parentNode;) t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children, e) + 1})`), e = n;
874
+ return `${t.reverse().join(" > ")}`.toLowerCase();
875
+ }
876
+ var $e = !1, et = "window", tt = "data-scroll-restoration-id";
877
+ function nt(e, t) {
878
+ if (!Xe) return;
879
+ let n = Xe;
880
+ if ((t ?? e.options.scrollRestoration ?? !1) && (e.isScrollRestoring = !0), e.isScrollRestorationSetup || !n) return;
881
+ e.isScrollRestorationSetup = !0, $e = !1;
882
+ let r = e.options.getScrollRestorationKey || Ze, i = /* @__PURE__ */ new Map();
883
+ window.history.scrollRestoration = "manual";
884
+ let a = (t) => {
885
+ if (!($e || !e.isScrollRestoring)) if (t.target === document || t.target === window) i.set(et, {
886
+ scrollX: window.scrollX || 0,
887
+ scrollY: window.scrollY || 0
888
+ });
889
+ else {
890
+ let e = t.target;
891
+ i.set(e, {
892
+ scrollX: e.scrollLeft || 0,
893
+ scrollY: e.scrollTop || 0
894
+ });
895
+ }
896
+ }, o = (t) => {
897
+ if (!e.isScrollRestoring || !t || i.size === 0 || !n) return;
898
+ let r = n.state[t] ||= {};
899
+ for (let [e, t] of i) {
900
+ let n;
901
+ if (e === et) n = et;
902
+ else if (e.isConnected) {
903
+ let t = e.getAttribute(tt);
904
+ n = t ? `[${tt}="${t}"]` : Qe(e);
905
+ }
906
+ n && (r[n] = t);
907
+ }
908
+ };
909
+ document.addEventListener("scroll", a, !0), e.subscribe("onBeforeLoad", (e) => {
910
+ o(e.fromLocation ? r(e.fromLocation) : void 0), i.clear();
911
+ }), window.addEventListener("pagehide", () => {
912
+ o(r(e.stores.resolvedLocation.state ?? e.stores.location.state)), n.persist();
913
+ }), e.subscribe("onRendered", (t) => {
914
+ let a = r(t.toLocation), o = e.options.scrollRestorationBehavior, s = e.options.scrollToTopSelectors;
915
+ if (i.clear(), !e.resetNextScroll) {
916
+ e.resetNextScroll = !0;
917
+ return;
918
+ }
919
+ if (!(typeof e.options.scrollRestoration == "function" && !e.options.scrollRestoration({ location: e.latestLocation }))) {
920
+ $e = !0;
921
+ try {
922
+ let t = e.isScrollRestoring ? n.state[a] : void 0, r = !1;
923
+ if (t) for (let e in t) {
924
+ let n = t[e];
925
+ if (!D(n)) continue;
926
+ let { scrollX: i, scrollY: a } = n;
927
+ if (!(!Number.isFinite(i) || !Number.isFinite(a))) {
928
+ if (e === et) window.scrollTo({
929
+ top: a,
930
+ left: i,
931
+ behavior: o
932
+ }), r = !0;
933
+ else if (e) {
934
+ let t;
935
+ try {
936
+ t = document.querySelector(e);
937
+ } catch {
938
+ continue;
939
+ }
940
+ t && (t.scrollLeft = i, t.scrollTop = a, r = !0);
941
+ }
942
+ }
943
+ }
944
+ if (!r) {
945
+ let t = e.history.location.hash.slice(1);
946
+ if (t) {
947
+ let e = window.history.state?.__hashScrollIntoViewOptions ?? !0;
948
+ if (e) {
949
+ let n = document.getElementById(t);
950
+ n && n.scrollIntoView(e);
951
+ }
952
+ } else {
953
+ let e = {
954
+ top: 0,
955
+ left: 0,
956
+ behavior: o
957
+ };
958
+ if (window.scrollTo(e), s) for (let t of s) {
959
+ if (t === et) continue;
960
+ let n = typeof t == "function" ? t() : document.querySelector(t);
961
+ n && n.scrollTo(e);
962
+ }
963
+ }
964
+ }
965
+ } finally {
966
+ $e = !1;
967
+ }
968
+ e.isScrollRestoring && n.set((e) => (e[a] ||= {}, e));
969
+ }
970
+ });
971
+ }
972
+ //#endregion
973
+ //#region ../router-core/dist/esm/qss.js
974
+ function rt(e, t = String) {
975
+ let n = new URLSearchParams();
976
+ for (let r in e) {
977
+ let i = e[r];
978
+ i !== void 0 && n.set(r, t(i));
979
+ }
980
+ return n.toString();
981
+ }
982
+ function it(e) {
983
+ return e ? e === "false" ? !1 : e === "true" ? !0 : e * 0 == 0 && +e + "" === e ? +e : e : "";
984
+ }
985
+ function at(e) {
986
+ let t = new URLSearchParams(e), n = Object.create(null);
987
+ for (let [e, r] of t.entries()) {
988
+ let t = n[e];
989
+ t == null ? n[e] = it(r) : Array.isArray(t) ? t.push(it(r)) : n[e] = [t, it(r)];
990
+ }
991
+ return n;
992
+ }
993
+ //#endregion
994
+ //#region ../router-core/dist/esm/searchParams.js
995
+ var ot = ct(JSON.parse), st = lt(JSON.stringify, JSON.parse);
996
+ function ct(e) {
997
+ return (t) => {
998
+ t[0] === "?" && (t = t.substring(1));
999
+ let n = at(t);
1000
+ for (let t in n) {
1001
+ let r = n[t];
1002
+ if (typeof r == "string") try {
1003
+ n[t] = e(r);
1004
+ } catch {}
1005
+ }
1006
+ return n;
1007
+ };
1008
+ }
1009
+ function lt(e, t) {
1010
+ let n = typeof t == "function";
1011
+ function r(r) {
1012
+ if (typeof r == "object" && r) try {
1013
+ return e(r);
1014
+ } catch {}
1015
+ else if (n && typeof r == "string") try {
1016
+ return t(r), e(r);
1017
+ } catch {}
1018
+ return r;
1019
+ }
1020
+ return (e) => {
1021
+ let t = rt(e, r);
1022
+ return t ? `?${t}` : "";
1023
+ };
1024
+ }
1025
+ //#endregion
1026
+ //#region ../router-core/dist/esm/root.js
1027
+ var R = "__root__";
1028
+ //#endregion
1029
+ //#region ../router-core/dist/esm/redirect.js
1030
+ function ut(e) {
1031
+ if (e.statusCode = e.statusCode || e.code || 307, !e._builtLocation && !e.reloadDocument && typeof e.href == "string") try {
1032
+ new URL(e.href), e.reloadDocument = !0;
1033
+ } catch {}
1034
+ let t = new Headers(e.headers);
1035
+ e.href && t.get("Location") === null && t.set("Location", e.href);
1036
+ let n = new Response(null, {
1037
+ status: e.statusCode,
1038
+ headers: t
1039
+ });
1040
+ if (n.options = e, e.throw) throw n;
1041
+ return n;
1042
+ }
1043
+ function z(e) {
1044
+ return e instanceof Response && !!e.options;
1045
+ }
1046
+ //#endregion
1047
+ //#region ../router-core/dist/esm/rewrite.js
1048
+ function dt(e) {
1049
+ return {
1050
+ input: ({ url: t }) => {
1051
+ for (let n of e) t = pt(n, t);
1052
+ return t;
1053
+ },
1054
+ output: ({ url: t }) => {
1055
+ for (let n = e.length - 1; n >= 0; n--) t = mt(e[n], t);
1056
+ return t;
1057
+ }
1058
+ };
1059
+ }
1060
+ function ft(e) {
1061
+ let t = Re(e.basepath), n = `/${t}`, r = `${n}/`, i = e.caseSensitive ? n : n.toLowerCase(), a = e.caseSensitive ? r : r.toLowerCase();
1062
+ return {
1063
+ input: ({ url: t }) => {
1064
+ let r = e.caseSensitive ? t.pathname : t.pathname.toLowerCase();
1065
+ return r === i ? t.pathname = "/" : r.startsWith(a) && (t.pathname = t.pathname.slice(n.length)), t;
1066
+ },
1067
+ output: ({ url: e }) => (e.pathname = Fe([
1068
+ "/",
1069
+ t,
1070
+ e.pathname
1071
+ ]), e)
1072
+ };
1073
+ }
1074
+ function pt(e, t) {
1075
+ let n = e?.input?.({ url: t });
1076
+ if (n) {
1077
+ if (typeof n == "string") return new URL(n);
1078
+ if (n instanceof URL) return n;
1079
+ }
1080
+ return t;
1081
+ }
1082
+ function mt(e, t) {
1083
+ let n = e?.output?.({ url: t });
1084
+ if (n) {
1085
+ if (typeof n == "string") return new URL(n);
1086
+ if (n instanceof URL) return n;
1087
+ }
1088
+ return t;
1089
+ }
1090
+ function ht(e, t) {
1091
+ let { createMutableStore: n, createReadonlyStore: r, batch: i, init: a } = t, o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = n(e.status), u = n(e.loadedAt), d = n(e.isLoading), f = n(e.isTransitioning), p = n(e.location), m = n(e.resolvedLocation), h = n(e.statusCode), g = n(e.redirect), _ = n([]), v = n([]), y = n([]), b = r(() => gt(o, _.state)), x = r(() => gt(s, v.state)), S = r(() => gt(c, y.state)), C = r(() => _.state[0]), w = r(() => _.state.some((e) => o.get(e)?.state.status === "pending")), ee = r(() => ({
1092
+ locationHref: p.state.href,
1093
+ resolvedLocationHref: m.state?.href,
1094
+ status: l.state
1095
+ })), te = r(() => ({
1096
+ status: l.state,
1097
+ loadedAt: u.state,
1098
+ isLoading: d.state,
1099
+ isTransitioning: f.state,
1100
+ matches: b.state,
1101
+ location: p.state,
1102
+ resolvedLocation: m.state,
1103
+ statusCode: h.state,
1104
+ redirect: g.state
1105
+ })), T = ge(64);
1106
+ function E(e) {
1107
+ let t = T.get(e);
1108
+ return t || (t = r(() => {
1109
+ let t = _.state;
1110
+ for (let n of t) {
1111
+ let t = o.get(n);
1112
+ if (t && t.routeId === e) return t.state;
1113
+ }
1114
+ }), T.set(e, t)), t;
1115
+ }
1116
+ let ne = {
1117
+ status: l,
1118
+ loadedAt: u,
1119
+ isLoading: d,
1120
+ isTransitioning: f,
1121
+ location: p,
1122
+ resolvedLocation: m,
1123
+ statusCode: h,
1124
+ redirect: g,
1125
+ matchesId: _,
1126
+ pendingMatchesId: v,
1127
+ cachedMatchesId: y,
1128
+ activeMatchesSnapshot: b,
1129
+ pendingMatchesSnapshot: x,
1130
+ cachedMatchesSnapshot: S,
1131
+ firstMatchId: C,
1132
+ hasPendingMatches: w,
1133
+ matchRouteReactivity: ee,
1134
+ activeMatchStoresById: o,
1135
+ pendingMatchStoresById: s,
1136
+ cachedMatchStoresById: c,
1137
+ __store: te,
1138
+ getMatchStoreByRouteId: E,
1139
+ setActiveMatches: D,
1140
+ setPendingMatches: re,
1141
+ setCachedMatches: ie
1142
+ };
1143
+ D(e.matches), a?.(ne);
1144
+ function D(e) {
1145
+ _t(e, o, _, n, i);
1146
+ }
1147
+ function re(e) {
1148
+ _t(e, s, v, n, i);
1149
+ }
1150
+ function ie(e) {
1151
+ _t(e, c, y, n, i);
1152
+ }
1153
+ return ne;
1154
+ }
1155
+ function gt(e, t) {
1156
+ let n = [];
1157
+ for (let r of t) {
1158
+ let t = e.get(r);
1159
+ t && n.push(t.state);
1160
+ }
1161
+ return n;
1162
+ }
1163
+ function _t(e, t, n, r, i) {
1164
+ let a = e.map((e) => e.id), o = new Set(a);
1165
+ i(() => {
1166
+ for (let e of t.keys()) o.has(e) || t.delete(e);
1167
+ for (let n of e) {
1168
+ let e = t.get(n.id);
1169
+ if (!e) {
1170
+ let e = r(n);
1171
+ e.routeId = n.routeId, t.set(n.id, e);
1172
+ continue;
1173
+ }
1174
+ e.routeId = n.routeId, e.state !== n && e.setState(() => n);
1175
+ }
1176
+ me(n.state, a) || n.setState(() => a);
1177
+ });
1178
+ }
1179
+ //#endregion
1180
+ //#region ../router-core/dist/esm/load-matches.js
1181
+ var vt = (e) => {
1182
+ if (!e.rendered) return e.rendered = !0, e.onReady?.();
1183
+ }, yt = (e) => e.stores.matchesId.state.some((t) => e.stores.activeMatchStoresById.get(t)?.state._forcePending), bt = (e, t) => !!(e.preload && !e.router.stores.activeMatchStoresById.has(t)), B = (e, t, n = !0) => {
1184
+ let r = { ...e.router.options.context ?? {} }, i = n ? t : t - 1;
1185
+ for (let t = 0; t <= i; t++) {
1186
+ let n = e.matches[t];
1187
+ if (!n) continue;
1188
+ let i = e.router.getMatch(n.id);
1189
+ i && Object.assign(r, i.__routeContext, i.__beforeLoadContext);
1190
+ }
1191
+ return r;
1192
+ }, xt = (e, t) => {
1193
+ if (!e.matches.length) return;
1194
+ let n = t.routeId, r = e.matches.findIndex((t) => t.routeId === e.router.routeTree.id), i = r >= 0 ? r : 0, a = n ? e.matches.findIndex((e) => e.routeId === n) : e.firstBadMatchIndex ?? e.matches.length - 1;
1195
+ a < 0 && (a = i);
1196
+ for (let t = a; t >= 0; t--) {
1197
+ let n = e.matches[t];
1198
+ if (e.router.looseRoutesById[n.routeId].options.notFoundComponent) return t;
1199
+ }
1200
+ return n ? a : i;
1201
+ }, V = (e, t, n) => {
1202
+ if (!(!z(n) && !L(n))) throw z(n) && n.redirectHandled && !n.options.reloadDocument ? n : (t && (t._nonReactive.beforeLoadPromise?.resolve(), t._nonReactive.loaderPromise?.resolve(), t._nonReactive.beforeLoadPromise = void 0, t._nonReactive.loaderPromise = void 0, t._nonReactive.error = n, e.updateMatch(t.id, (r) => ({
1203
+ ...r,
1204
+ status: z(n) ? "redirected" : r.status === "pending" ? "success" : r.status,
1205
+ context: B(e, t.index),
1206
+ isFetching: !1,
1207
+ error: n
1208
+ })), L(n) && !n.routeId && (n.routeId = t.routeId), t._nonReactive.loadPromise?.resolve()), z(n) && (e.rendered = !0, n.options._fromLocation = e.location, n.redirectHandled = !0, n = e.router.resolveRedirect(n)), n);
1209
+ }, St = (e, t) => {
1210
+ let n = e.router.getMatch(t);
1211
+ return !!(!n || n._nonReactive.dehydrated);
1212
+ }, Ct = (e, t, n) => {
1213
+ let r = B(e, n);
1214
+ e.updateMatch(t, (e) => ({
1215
+ ...e,
1216
+ context: r
1217
+ }));
1218
+ }, H = (e, t, n, r) => {
1219
+ let { id: i, routeId: a } = e.matches[t], o = e.router.looseRoutesById[a];
1220
+ if (n instanceof Promise) throw n;
1221
+ n.routerCode = r, e.firstBadMatchIndex ??= t, V(e, e.router.getMatch(i), n);
1222
+ try {
1223
+ o.options.onError?.(n);
1224
+ } catch (t) {
1225
+ n = t, V(e, e.router.getMatch(i), n);
1226
+ }
1227
+ e.updateMatch(i, (e) => (e._nonReactive.beforeLoadPromise?.resolve(), e._nonReactive.beforeLoadPromise = void 0, e._nonReactive.loadPromise?.resolve(), {
1228
+ ...e,
1229
+ error: n,
1230
+ status: "error",
1231
+ isFetching: !1,
1232
+ updatedAt: Date.now(),
1233
+ abortController: new AbortController()
1234
+ })), !e.preload && !z(n) && !L(n) && (e.serialError ??= n);
1235
+ }, wt = (e, t, n, r) => {
1236
+ if (r._nonReactive.pendingTimeout !== void 0) return;
1237
+ let i = n.options.pendingMs ?? e.router.options.defaultPendingMs;
1238
+ if (e.onReady && !bt(e, t) && (n.options.loader || n.options.beforeLoad || Pt(n)) && typeof i == "number" && i !== Infinity && (n.options.pendingComponent ?? e.router.options?.defaultPendingComponent)) {
1239
+ let t = setTimeout(() => {
1240
+ vt(e);
1241
+ }, i);
1242
+ r._nonReactive.pendingTimeout = t;
1243
+ }
1244
+ }, Tt = (e, t, n) => {
1245
+ let r = e.router.getMatch(t);
1246
+ if (!r._nonReactive.beforeLoadPromise && !r._nonReactive.loaderPromise) return;
1247
+ wt(e, t, n, r);
1248
+ let i = () => {
1249
+ let n = e.router.getMatch(t);
1250
+ n.preload && (n.status === "redirected" || n.status === "notFound") && V(e, n, n.error);
1251
+ };
1252
+ return r._nonReactive.beforeLoadPromise ? r._nonReactive.beforeLoadPromise.then(i) : i();
1253
+ }, Et = (e, t, n, r) => {
1254
+ let i = e.router.getMatch(t), a = i._nonReactive.loadPromise;
1255
+ i._nonReactive.loadPromise = k(() => {
1256
+ a?.resolve(), a = void 0;
1257
+ });
1258
+ let { paramsError: o, searchError: s } = i;
1259
+ o && H(e, n, o, "PARSE_PARAMS"), s && H(e, n, s, "VALIDATE_SEARCH"), wt(e, t, r, i);
1260
+ let c = new AbortController(), l = !1, u = () => {
1261
+ l || (l = !0, e.updateMatch(t, (e) => ({
1262
+ ...e,
1263
+ isFetching: "beforeLoad",
1264
+ fetchCount: e.fetchCount + 1,
1265
+ abortController: c
1266
+ })));
1267
+ }, d = () => {
1268
+ i._nonReactive.beforeLoadPromise?.resolve(), i._nonReactive.beforeLoadPromise = void 0, e.updateMatch(t, (e) => ({
1269
+ ...e,
1270
+ isFetching: !1
1271
+ }));
1272
+ };
1273
+ if (!r.options.beforeLoad) {
1274
+ e.router.batch(() => {
1275
+ u(), d();
1276
+ });
1277
+ return;
1278
+ }
1279
+ i._nonReactive.beforeLoadPromise = k();
1280
+ let f = {
1281
+ ...B(e, n, !1),
1282
+ ...i.__routeContext
1283
+ }, { search: p, params: m, cause: h } = i, g = bt(e, t), _ = {
1284
+ search: p,
1285
+ abortController: c,
1286
+ params: m,
1287
+ preload: g,
1288
+ context: f,
1289
+ location: e.location,
1290
+ navigate: (t) => e.router.navigate({
1291
+ ...t,
1292
+ _fromLocation: e.location
1293
+ }),
1294
+ buildLocation: e.router.buildLocation,
1295
+ cause: g ? "preload" : h,
1296
+ matches: e.matches,
1297
+ routeId: r.id,
1298
+ ...e.router.options.additionalContext
1299
+ }, v = (r) => {
1300
+ if (r === void 0) {
1301
+ e.router.batch(() => {
1302
+ u(), d();
1303
+ });
1304
+ return;
1305
+ }
1306
+ (z(r) || L(r)) && (u(), H(e, n, r, "BEFORE_LOAD")), e.router.batch(() => {
1307
+ u(), e.updateMatch(t, (e) => ({
1308
+ ...e,
1309
+ __beforeLoadContext: r
1310
+ })), d();
1311
+ });
1312
+ }, y;
1313
+ try {
1314
+ if (y = r.options.beforeLoad(_), A(y)) return u(), y.catch((t) => {
1315
+ H(e, n, t, "BEFORE_LOAD");
1316
+ }).then(v);
1317
+ } catch (t) {
1318
+ u(), H(e, n, t, "BEFORE_LOAD");
1319
+ }
1320
+ v(y);
1321
+ }, Dt = (e, t) => {
1322
+ let { id: n, routeId: r } = e.matches[t], i = e.router.looseRoutesById[r], a = () => s(), o = () => Et(e, n, t, i), s = () => {
1323
+ if (St(e, n)) return;
1324
+ let t = Tt(e, n, i);
1325
+ return A(t) ? t.then(o) : o();
1326
+ };
1327
+ return a();
1328
+ }, Ot = (e, t, n) => {
1329
+ let r = e.router.getMatch(t);
1330
+ if (!r || !n.options.head && !n.options.scripts && !n.options.headers) return;
1331
+ let i = {
1332
+ ssr: e.router.options.ssr,
1333
+ matches: e.matches,
1334
+ match: r,
1335
+ params: r.params,
1336
+ loaderData: r.loaderData
1337
+ };
1338
+ return Promise.all([
1339
+ n.options.head?.(i),
1340
+ n.options.scripts?.(i),
1341
+ n.options.headers?.(i)
1342
+ ]).then(([e, t, n]) => ({
1343
+ meta: e?.meta,
1344
+ links: e?.links,
1345
+ headScripts: e?.scripts,
1346
+ headers: n,
1347
+ scripts: t,
1348
+ styles: e?.styles
1349
+ }));
1350
+ }, kt = (e, t, n, r, i) => {
1351
+ let a = t[r - 1], { params: o, loaderDeps: s, abortController: c, cause: l } = e.router.getMatch(n), u = B(e, r), d = bt(e, n);
1352
+ return {
1353
+ params: o,
1354
+ deps: s,
1355
+ preload: !!d,
1356
+ parentMatchPromise: a,
1357
+ abortController: c,
1358
+ context: u,
1359
+ location: e.location,
1360
+ navigate: (t) => e.router.navigate({
1361
+ ...t,
1362
+ _fromLocation: e.location
1363
+ }),
1364
+ cause: d ? "preload" : l,
1365
+ route: i,
1366
+ ...e.router.options.additionalContext
1367
+ };
1368
+ }, At = async (e, t, n, r, i) => {
1369
+ try {
1370
+ let a = e.router.getMatch(n);
1371
+ try {
1372
+ U(i);
1373
+ let o = i.options.loader, s = typeof o == "function" ? o : o?.handler, c = s?.(kt(e, t, n, r, i)), l = !!s && A(c);
1374
+ if ((l || i._lazyPromise || i._componentsPromise || i.options.head || i.options.scripts || i.options.headers || a._nonReactive.minPendingPromise) && e.updateMatch(n, (e) => ({
1375
+ ...e,
1376
+ isFetching: "loader"
1377
+ })), s) {
1378
+ let t = l ? await c : c;
1379
+ V(e, e.router.getMatch(n), t), t !== void 0 && e.updateMatch(n, (e) => ({
1380
+ ...e,
1381
+ loaderData: t
1382
+ }));
1383
+ }
1384
+ i._lazyPromise && await i._lazyPromise;
1385
+ let u = a._nonReactive.minPendingPromise;
1386
+ u && await u, i._componentsPromise && await i._componentsPromise, e.updateMatch(n, (t) => ({
1387
+ ...t,
1388
+ error: void 0,
1389
+ context: B(e, r),
1390
+ status: "success",
1391
+ isFetching: !1,
1392
+ updatedAt: Date.now()
1393
+ }));
1394
+ } catch (t) {
1395
+ let o = t;
1396
+ if (o?.name === "AbortError") {
1397
+ if (a.abortController.signal.aborted) {
1398
+ a._nonReactive.loaderPromise?.resolve(), a._nonReactive.loaderPromise = void 0;
1399
+ return;
1400
+ }
1401
+ e.updateMatch(n, (t) => ({
1402
+ ...t,
1403
+ status: t.status === "pending" ? "success" : t.status,
1404
+ isFetching: !1,
1405
+ context: B(e, r)
1406
+ }));
1407
+ return;
1408
+ }
1409
+ let s = a._nonReactive.minPendingPromise;
1410
+ s && await s, L(t) && await i.options.notFoundComponent?.preload?.(), V(e, e.router.getMatch(n), t);
1411
+ try {
1412
+ i.options.onError?.(t);
1413
+ } catch (t) {
1414
+ o = t, V(e, e.router.getMatch(n), t);
1415
+ }
1416
+ !z(o) && !L(o) && await U(i, ["errorComponent"]), e.updateMatch(n, (t) => ({
1417
+ ...t,
1418
+ error: o,
1419
+ context: B(e, r),
1420
+ status: "error",
1421
+ isFetching: !1
1422
+ }));
1423
+ }
1424
+ } catch (t) {
1425
+ let r = e.router.getMatch(n);
1426
+ r && (r._nonReactive.loaderPromise = void 0), V(e, r, t);
1427
+ }
1428
+ }, jt = async (e, t, n) => {
1429
+ async function r(r, a, c, l, d) {
1430
+ let f = Date.now() - a.updatedAt, p = r ? d.options.preloadStaleTime ?? e.router.options.defaultPreloadStaleTime ?? 3e4 : d.options.staleTime ?? e.router.options.defaultStaleTime ?? 0, m = d.options.shouldReload, h = typeof m == "function" ? m(kt(e, t, i, n, d)) : m, { status: g, invalid: _ } = l, v = f >= p && (!!e.forceStaleReload || l.cause === "enter" || c !== void 0 && c !== l.id);
1431
+ o = g === "success" && (_ || (h ?? v)), r && d.options.preload === !1 || (o && !e.sync && u ? (s = !0, (async () => {
1432
+ try {
1433
+ await At(e, t, i, n, d);
1434
+ let r = e.router.getMatch(i);
1435
+ r._nonReactive.loaderPromise?.resolve(), r._nonReactive.loadPromise?.resolve(), r._nonReactive.loaderPromise = void 0, r._nonReactive.loadPromise = void 0;
1436
+ } catch (t) {
1437
+ z(t) && await e.router.navigate(t.options);
1438
+ }
1439
+ })()) : g !== "success" || o ? await At(e, t, i, n, d) : Ct(e, i, n));
1440
+ }
1441
+ let { id: i, routeId: a } = e.matches[n], o = !1, s = !1, c = e.router.looseRoutesById[a], l = c.options.loader, u = ((typeof l == "function" ? void 0 : l?.staleReloadMode) ?? e.router.options.defaultStaleReloadMode) !== "blocking";
1442
+ if (St(e, i)) {
1443
+ if (!e.router.getMatch(i)) return e.matches[n];
1444
+ Ct(e, i, n);
1445
+ } else {
1446
+ let t = e.router.getMatch(i), o = e.router.stores.matchesId.state[n], s = (o && e.router.stores.activeMatchStoresById.get(o) || null)?.routeId === a ? o : e.router.stores.activeMatchesSnapshot.state.find((e) => e.routeId === a)?.id, l = bt(e, i);
1447
+ if (t._nonReactive.loaderPromise) {
1448
+ if (t.status === "success" && !e.sync && !t.preload && u) return t;
1449
+ await t._nonReactive.loaderPromise;
1450
+ let n = e.router.getMatch(i), a = n._nonReactive.error || n.error;
1451
+ a && V(e, n, a), n.status === "pending" && await r(l, t, s, n, c);
1452
+ } else {
1453
+ let n = l && !e.router.stores.activeMatchStoresById.has(i), a = e.router.getMatch(i);
1454
+ a._nonReactive.loaderPromise = k(), n !== a.preload && e.updateMatch(i, (e) => ({
1455
+ ...e,
1456
+ preload: n
1457
+ })), await r(l, t, s, a, c);
1458
+ }
1459
+ }
1460
+ let d = e.router.getMatch(i);
1461
+ s || (d._nonReactive.loaderPromise?.resolve(), d._nonReactive.loadPromise?.resolve(), d._nonReactive.loadPromise = void 0), clearTimeout(d._nonReactive.pendingTimeout), d._nonReactive.pendingTimeout = void 0, s || (d._nonReactive.loaderPromise = void 0), d._nonReactive.dehydrated = void 0;
1462
+ let f = s ? d.isFetching : !1;
1463
+ return f !== d.isFetching || d.invalid !== !1 ? (e.updateMatch(i, (e) => ({
1464
+ ...e,
1465
+ isFetching: f,
1466
+ invalid: !1
1467
+ })), e.router.getMatch(i)) : d;
1468
+ };
1469
+ async function Mt(e) {
1470
+ let t = e, n = [];
1471
+ yt(t.router) && vt(t);
1472
+ let r;
1473
+ for (let e = 0; e < t.matches.length; e++) {
1474
+ try {
1475
+ let n = Dt(t, e);
1476
+ A(n) && await n;
1477
+ } catch (e) {
1478
+ if (z(e)) throw e;
1479
+ if (L(e)) r = e;
1480
+ else if (!t.preload) throw e;
1481
+ break;
1482
+ }
1483
+ if (t.serialError || t.firstBadMatchIndex != null) break;
1484
+ }
1485
+ let i = t.firstBadMatchIndex ?? t.matches.length, a = r && !t.preload ? xt(t, r) : void 0, o = r && t.preload ? 0 : a === void 0 ? i : Math.min(a + 1, i), s, c;
1486
+ for (let e = 0; e < o; e++) n.push(jt(t, n, e));
1487
+ try {
1488
+ await Promise.all(n);
1489
+ } catch {
1490
+ let e = await Promise.allSettled(n);
1491
+ for (let t of e) {
1492
+ if (t.status !== "rejected") continue;
1493
+ let e = t.reason;
1494
+ if (z(e)) throw e;
1495
+ L(e) ? s ??= e : c ??= e;
1496
+ }
1497
+ if (c !== void 0) throw c;
1498
+ }
1499
+ let l = s ?? (r && !t.preload ? r : void 0), u = t.firstBadMatchIndex === void 0 ? t.matches.length - 1 : t.firstBadMatchIndex;
1500
+ if (!l && r && t.preload) return t.matches;
1501
+ if (l) {
1502
+ let e = xt(t, l);
1503
+ if (e === void 0) {
1504
+ if (process.env.NODE_ENV !== "production") throw Error("Invariant failed: Could not find match for notFound boundary");
1505
+ he();
1506
+ }
1507
+ let n = t.matches[e], r = t.router.looseRoutesById[n.routeId], i = t.router.options?.defaultNotFoundComponent;
1508
+ !r.options.notFoundComponent && i && (r.options.notFoundComponent = i), l.routeId = n.routeId;
1509
+ let a = n.routeId === t.router.routeTree.id;
1510
+ t.updateMatch(n.id, (e) => ({
1511
+ ...e,
1512
+ ...a ? {
1513
+ status: "success",
1514
+ globalNotFound: !0,
1515
+ error: void 0
1516
+ } : {
1517
+ status: "notFound",
1518
+ error: l
1519
+ },
1520
+ isFetching: !1
1521
+ })), u = e, await U(r, ["notFoundComponent"]);
1522
+ } else if (!t.preload) {
1523
+ let e = t.matches[0];
1524
+ e.globalNotFound || t.router.getMatch(e.id)?.globalNotFound && t.updateMatch(e.id, (e) => ({
1525
+ ...e,
1526
+ globalNotFound: !1,
1527
+ error: void 0
1528
+ }));
1529
+ }
1530
+ if (t.serialError && t.firstBadMatchIndex !== void 0) {
1531
+ let e = t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];
1532
+ await U(e, ["errorComponent"]);
1533
+ }
1534
+ for (let e = 0; e <= u; e++) {
1535
+ let { id: n, routeId: r } = t.matches[e], i = t.router.looseRoutesById[r];
1536
+ try {
1537
+ let e = Ot(t, n, i);
1538
+ if (e) {
1539
+ let r = await e;
1540
+ t.updateMatch(n, (e) => ({
1541
+ ...e,
1542
+ ...r
1543
+ }));
1544
+ }
1545
+ } catch (e) {
1546
+ console.error(`Error executing head for route ${r}:`, e);
1547
+ }
1548
+ }
1549
+ let d = vt(t);
1550
+ if (A(d) && await d, l) throw l;
1551
+ if (t.serialError && !t.preload && !t.onReady) throw t.serialError;
1552
+ return t.matches;
1553
+ }
1554
+ function Nt(e, t) {
1555
+ let n = t.map((t) => e.options[t]?.preload?.()).filter(Boolean);
1556
+ if (n.length !== 0) return Promise.all(n);
1557
+ }
1558
+ function U(e, t = Ft) {
1559
+ !e._lazyLoaded && e._lazyPromise === void 0 && (e.lazyFn ? e._lazyPromise = e.lazyFn().then((t) => {
1560
+ let { id: n, ...r } = t.options;
1561
+ Object.assign(e.options, r), e._lazyLoaded = !0, e._lazyPromise = void 0;
1562
+ }) : e._lazyLoaded = !0);
1563
+ let n = () => e._componentsLoaded ? void 0 : t === Ft ? (() => {
1564
+ if (e._componentsPromise === void 0) {
1565
+ let t = Nt(e, Ft);
1566
+ t ? e._componentsPromise = t.then(() => {
1567
+ e._componentsLoaded = !0, e._componentsPromise = void 0;
1568
+ }) : e._componentsLoaded = !0;
1569
+ }
1570
+ return e._componentsPromise;
1571
+ })() : Nt(e, t);
1572
+ return e._lazyPromise ? e._lazyPromise.then(n) : n();
1573
+ }
1574
+ function Pt(e) {
1575
+ for (let t of Ft) if (e.options[t]?.preload) return !0;
1576
+ return !1;
1577
+ }
1578
+ var Ft = [
1579
+ "component",
1580
+ "errorComponent",
1581
+ "pendingComponent",
1582
+ "notFoundComponent"
1583
+ ], W = "__TSR_index", It = "popstate", Lt = "beforeunload";
1584
+ function Rt(e) {
1585
+ let t = e.getLocation(), n = /* @__PURE__ */ new Set(), r = (r) => {
1586
+ t = e.getLocation(), n.forEach((e) => e({
1587
+ location: t,
1588
+ action: r
1589
+ }));
1590
+ }, i = (n) => {
1591
+ e.notifyOnIndexChange ?? !0 ? r(n) : t = e.getLocation();
1592
+ }, a = async ({ task: n, navigateOpts: r, ...i }) => {
1593
+ if (r?.ignoreBlocker ?? !1) {
1594
+ n();
1595
+ return;
1596
+ }
1597
+ let a = e.getBlockers?.() ?? [], o = i.type === "PUSH" || i.type === "REPLACE";
1598
+ if (typeof document < "u" && a.length && o) for (let n of a) {
1599
+ let r = G(i.path, i.state);
1600
+ if (await n.blockerFn({
1601
+ currentLocation: t,
1602
+ nextLocation: r,
1603
+ action: i.type
1604
+ })) {
1605
+ e.onBlocked?.();
1606
+ return;
1607
+ }
1608
+ }
1609
+ n();
1610
+ };
1611
+ return {
1612
+ get location() {
1613
+ return t;
1614
+ },
1615
+ get length() {
1616
+ return e.getLength();
1617
+ },
1618
+ subscribers: n,
1619
+ subscribe: (e) => (n.add(e), () => {
1620
+ n.delete(e);
1621
+ }),
1622
+ push: (n, i, o) => {
1623
+ let s = t.state[W];
1624
+ i = zt(s + 1, i), a({
1625
+ task: () => {
1626
+ e.pushState(n, i), r({ type: "PUSH" });
1627
+ },
1628
+ navigateOpts: o,
1629
+ type: "PUSH",
1630
+ path: n,
1631
+ state: i
1632
+ });
1633
+ },
1634
+ replace: (n, i, o) => {
1635
+ let s = t.state[W];
1636
+ i = zt(s, i), a({
1637
+ task: () => {
1638
+ e.replaceState(n, i), r({ type: "REPLACE" });
1639
+ },
1640
+ navigateOpts: o,
1641
+ type: "REPLACE",
1642
+ path: n,
1643
+ state: i
1644
+ });
1645
+ },
1646
+ go: (t, n) => {
1647
+ a({
1648
+ task: () => {
1649
+ e.go(t), i({
1650
+ type: "GO",
1651
+ index: t
1652
+ });
1653
+ },
1654
+ navigateOpts: n,
1655
+ type: "GO"
1656
+ });
1657
+ },
1658
+ back: (t) => {
1659
+ a({
1660
+ task: () => {
1661
+ e.back(t?.ignoreBlocker ?? !1), i({ type: "BACK" });
1662
+ },
1663
+ navigateOpts: t,
1664
+ type: "BACK"
1665
+ });
1666
+ },
1667
+ forward: (t) => {
1668
+ a({
1669
+ task: () => {
1670
+ e.forward(t?.ignoreBlocker ?? !1), i({ type: "FORWARD" });
1671
+ },
1672
+ navigateOpts: t,
1673
+ type: "FORWARD"
1674
+ });
1675
+ },
1676
+ canGoBack: () => t.state[W] !== 0,
1677
+ createHref: (t) => e.createHref(t),
1678
+ block: (t) => {
1679
+ if (!e.setBlockers) return () => {};
1680
+ let n = e.getBlockers?.() ?? [];
1681
+ return e.setBlockers([...n, t]), () => {
1682
+ let n = e.getBlockers?.() ?? [];
1683
+ e.setBlockers?.(n.filter((e) => e !== t));
1684
+ };
1685
+ },
1686
+ flush: () => e.flush?.(),
1687
+ destroy: () => e.destroy?.(),
1688
+ notify: r
1689
+ };
1690
+ }
1691
+ function zt(e, t) {
1692
+ t ||= {};
1693
+ let n = Wt();
1694
+ return {
1695
+ ...t,
1696
+ key: n,
1697
+ __TSR_key: n,
1698
+ [W]: e
1699
+ };
1700
+ }
1701
+ function Bt(e) {
1702
+ let t = e?.window ?? (typeof window < "u" ? window : void 0), n = t.history.pushState, r = t.history.replaceState, i = [], a = () => i, o = (e) => i = e, s = e?.createHref ?? ((e) => e), c = e?.parseLocation ?? (() => G(`${t.location.pathname}${t.location.search}${t.location.hash}`, t.history.state));
1703
+ if (!t.history.state?.__TSR_key && !t.history.state?.key) {
1704
+ let e = Wt();
1705
+ t.history.replaceState({
1706
+ [W]: 0,
1707
+ key: e,
1708
+ __TSR_key: e
1709
+ }, "");
1710
+ }
1711
+ let l = c(), u, d = !1, f = !1, p = !1, m = !1, h = () => l, g, _, v = () => {
1712
+ g && (C._ignoreSubscribers = !0, (g.isPush ? t.history.pushState : t.history.replaceState)(g.state, "", g.href), C._ignoreSubscribers = !1, g = void 0, _ = void 0, u = void 0);
1713
+ }, y = (e, t, n) => {
1714
+ let r = s(t);
1715
+ _ || (u = l), l = G(t, n), g = {
1716
+ href: r,
1717
+ state: n,
1718
+ isPush: g?.isPush || e === "push"
1719
+ }, _ ||= Promise.resolve().then(() => v());
1720
+ }, b = (e) => {
1721
+ l = c(), C.notify({ type: e });
1722
+ }, x = async () => {
1723
+ if (f) {
1724
+ f = !1;
1725
+ return;
1726
+ }
1727
+ let e = c(), n = e.state[W] - l.state[W], r = n === 1, i = n === -1, o = !r && !i || d;
1728
+ d = !1;
1729
+ let s = o ? "GO" : i ? "BACK" : "FORWARD", u = o ? {
1730
+ type: "GO",
1731
+ index: n
1732
+ } : { type: i ? "BACK" : "FORWARD" };
1733
+ if (p) p = !1;
1734
+ else {
1735
+ let n = a();
1736
+ if (typeof document < "u" && n.length) {
1737
+ for (let r of n) if (await r.blockerFn({
1738
+ currentLocation: l,
1739
+ nextLocation: e,
1740
+ action: s
1741
+ })) {
1742
+ f = !0, t.history.go(1), C.notify(u);
1743
+ return;
1744
+ }
1745
+ }
1746
+ }
1747
+ l = c(), C.notify(u);
1748
+ }, S = (e) => {
1749
+ if (m) {
1750
+ m = !1;
1751
+ return;
1752
+ }
1753
+ let t = !1, n = a();
1754
+ if (typeof document < "u" && n.length) for (let e of n) {
1755
+ let n = e.enableBeforeUnload ?? !0;
1756
+ if (n === !0) {
1757
+ t = !0;
1758
+ break;
1759
+ }
1760
+ if (typeof n == "function" && n() === !0) {
1761
+ t = !0;
1762
+ break;
1763
+ }
1764
+ }
1765
+ if (t) return e.preventDefault(), e.returnValue = "";
1766
+ }, C = Rt({
1767
+ getLocation: h,
1768
+ getLength: () => t.history.length,
1769
+ pushState: (e, t) => y("push", e, t),
1770
+ replaceState: (e, t) => y("replace", e, t),
1771
+ back: (e) => (e && (p = !0), m = !0, t.history.back()),
1772
+ forward: (e) => {
1773
+ e && (p = !0), m = !0, t.history.forward();
1774
+ },
1775
+ go: (e) => {
1776
+ d = !0, t.history.go(e);
1777
+ },
1778
+ createHref: (e) => s(e),
1779
+ flush: v,
1780
+ destroy: () => {
1781
+ t.history.pushState = n, t.history.replaceState = r, t.removeEventListener(Lt, S, { capture: !0 }), t.removeEventListener(It, x);
1782
+ },
1783
+ onBlocked: () => {
1784
+ u && l !== u && (l = u);
1785
+ },
1786
+ getBlockers: a,
1787
+ setBlockers: o,
1788
+ notifyOnIndexChange: !1
1789
+ });
1790
+ return t.addEventListener(Lt, S, { capture: !0 }), t.addEventListener(It, x), t.history.pushState = function(...e) {
1791
+ let r = n.apply(t.history, e);
1792
+ return C._ignoreSubscribers || b("PUSH"), r;
1793
+ }, t.history.replaceState = function(...e) {
1794
+ let n = r.apply(t.history, e);
1795
+ return C._ignoreSubscribers || b("REPLACE"), n;
1796
+ }, C;
1797
+ }
1798
+ function Vt(e) {
1799
+ let t = e?.window ?? (typeof window < "u" ? window : void 0);
1800
+ return Bt({
1801
+ window: t,
1802
+ parseLocation: () => {
1803
+ let e = t.location.hash.split("#").slice(1), n = e[0] ?? "/", r = t.location.search, i = e.slice(1);
1804
+ return G(`${n}${r}${i.length === 0 ? "" : `#${i.join("#")}`}`, t.history.state);
1805
+ },
1806
+ createHref: (e) => `${t.location.pathname}${t.location.search}#${e}`
1807
+ });
1808
+ }
1809
+ function Ht(e = { initialEntries: ["/"] }) {
1810
+ let t = e.initialEntries, n = e.initialIndex ? Math.min(Math.max(e.initialIndex, 0), t.length - 1) : t.length - 1, r = t.map((e, t) => zt(t, void 0)), i = () => G(t[n], r[n]), a = [];
1811
+ return Rt({
1812
+ getLocation: i,
1813
+ getLength: () => t.length,
1814
+ pushState: (e, i) => {
1815
+ n < t.length - 1 && (t.splice(n + 1), r.splice(n + 1)), r.push(i), t.push(e), n = Math.max(t.length - 1, 0);
1816
+ },
1817
+ replaceState: (e, i) => {
1818
+ r[n] = i, t[n] = e;
1819
+ },
1820
+ back: () => {
1821
+ n = Math.max(n - 1, 0);
1822
+ },
1823
+ forward: () => {
1824
+ n = Math.min(n + 1, t.length - 1);
1825
+ },
1826
+ go: (e) => {
1827
+ n = Math.min(Math.max(n + e, 0), t.length - 1);
1828
+ },
1829
+ createHref: (e) => e,
1830
+ getBlockers: () => a,
1831
+ setBlockers: (e) => a = e
1832
+ });
1833
+ }
1834
+ function Ut(e) {
1835
+ let t = e.replace(/[\x00-\x1f\x7f]/g, "");
1836
+ return t.startsWith("//") && (t = "/" + t.replace(/^\/+/, "")), t;
1837
+ }
1838
+ function G(e, t) {
1839
+ let n = Ut(e), r = n.indexOf("#"), i = n.indexOf("?"), a = Wt();
1840
+ return {
1841
+ href: n,
1842
+ pathname: n.substring(0, r > 0 ? i > 0 ? Math.min(r, i) : r : i > 0 ? i : n.length),
1843
+ hash: r > -1 ? n.substring(r) : "",
1844
+ search: i > -1 ? n.slice(i, r === -1 ? void 0 : r) : "",
1845
+ state: t || {
1846
+ [W]: 0,
1847
+ key: a,
1848
+ __TSR_key: a
1849
+ }
1850
+ };
1851
+ }
1852
+ function Wt() {
1853
+ return (Math.random() + 1).toString(36).substring(7);
1854
+ }
1855
+ //#endregion
1856
+ //#region ../router-core/dist/esm/router.js
1857
+ function K(e, t) {
1858
+ let n = t, r = e;
1859
+ return {
1860
+ fromLocation: n,
1861
+ toLocation: r,
1862
+ pathChanged: n?.pathname !== r.pathname,
1863
+ hrefChanged: n?.href !== r.href,
1864
+ hashChanged: n?.hash !== r.hash
1865
+ };
1866
+ }
1867
+ var Gt = class {
1868
+ constructor(e, t) {
1869
+ this.tempLocationKey = `${Math.round(Math.random() * 1e7)}`, this.resetNextScroll = !0, this.shouldViewTransition = void 0, this.isViewTransitionTypesSupported = void 0, this.subscribers = /* @__PURE__ */ new Set(), this.isScrollRestoring = !1, this.isScrollRestorationSetup = !1, this.startTransition = (e) => e(), this.update = (e) => {
1870
+ process.env.NODE_ENV !== "production" && e.notFoundRoute && console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");
1871
+ let t = this.options, n = this.basepath ?? t?.basepath ?? "/", r = this.basepath === void 0, i = t?.rewrite;
1872
+ if (this.options = {
1873
+ ...t,
1874
+ ...e
1875
+ }, this.isServer = this.options.isServer ?? typeof document > "u", this.protocolAllowlist = new Set(this.options.protocolAllowlist), this.options.pathParamsAllowedCharacters && (this.pathParamsDecoder = He(this.options.pathParamsAllowedCharacters)), (!this.history || this.options.history && this.options.history !== this.history) && (this.options.history ? this.history = this.options.history : typeof window < "u" && (this.history = Bt())), this.origin = this.options.origin, !this.origin) {
1876
+ let e = globalThis.window;
1877
+ e && e.origin && e.origin !== "null" ? this.origin = e.origin : this.origin = "http://localhost";
1878
+ }
1879
+ if (this.history && this.updateLatestLocation(), this.options.routeTree !== this.routeTree) {
1880
+ this.routeTree = this.options.routeTree;
1881
+ let e;
1882
+ this.resolvePathCache = ge(1e3), e = this.buildRouteTree(), this.setRoutes(e);
1883
+ }
1884
+ if (!this.stores && this.latestLocation) {
1885
+ let e = this.getStoreConfig(this);
1886
+ this.batch = e.batch, this.stores = ht(Zt(this.latestLocation), e), nt(this);
1887
+ }
1888
+ let a = !1, o = this.options.basepath ?? "/", s = this.options.rewrite;
1889
+ if (r || n !== o || i !== s) {
1890
+ this.basepath = o;
1891
+ let e = [], t = Re(o);
1892
+ t && t !== "/" && e.push(ft({ basepath: o })), s && e.push(s), this.rewrite = e.length === 0 ? void 0 : e.length === 1 ? e[0] : dt(e), this.history && this.updateLatestLocation(), a = !0;
1893
+ }
1894
+ a && this.stores && this.stores.location.setState(() => this.latestLocation), typeof window < "u" && "CSS" in window && typeof window.CSS?.supports == "function" && (this.isViewTransitionTypesSupported = window.CSS.supports("selector(:active-view-transition-type(a)"));
1895
+ }, this.updateLatestLocation = () => {
1896
+ this.latestLocation = this.parseLocation(this.history.location, this.latestLocation);
1897
+ }, this.buildRouteTree = () => {
1898
+ let e = Oe(this.routeTree, this.options.caseSensitive, (e, t) => {
1899
+ e.init({ originalIndex: t });
1900
+ });
1901
+ return this.options.routeMasks && Ce(this.options.routeMasks, e.processedTree), e;
1902
+ }, this.subscribe = (e, t) => {
1903
+ let n = {
1904
+ eventType: e,
1905
+ fn: t
1906
+ };
1907
+ return this.subscribers.add(n), () => {
1908
+ this.subscribers.delete(n);
1909
+ };
1910
+ }, this.emit = (e) => {
1911
+ this.subscribers.forEach((t) => {
1912
+ t.eventType === e.type && t.fn(e);
1913
+ });
1914
+ }, this.parseLocation = (e, t) => {
1915
+ let n = ({ pathname: e, search: n, hash: r, href: i, state: a }) => {
1916
+ if (!this.rewrite && !/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)) {
1917
+ let i = this.options.parseSearch(n), o = this.options.stringifySearch(i);
1918
+ return {
1919
+ href: e + o + r,
1920
+ publicHref: e + o + r,
1921
+ pathname: j(e).path,
1922
+ external: !1,
1923
+ searchStr: o,
1924
+ search: T(t?.search, i),
1925
+ hash: j(r.slice(1)).path,
1926
+ state: E(t?.state, a)
1927
+ };
1928
+ }
1929
+ let o = new URL(i, this.origin), s = pt(this.rewrite, o), c = this.options.parseSearch(s.search), l = this.options.stringifySearch(c);
1930
+ return s.search = l, {
1931
+ href: s.href.replace(s.origin, ""),
1932
+ publicHref: i,
1933
+ pathname: j(s.pathname).path,
1934
+ external: !!this.rewrite && s.origin !== this.origin,
1935
+ searchStr: l,
1936
+ search: T(t?.search, c),
1937
+ hash: j(s.hash.slice(1)).path,
1938
+ state: E(t?.state, a)
1939
+ };
1940
+ }, r = n(e), { __tempLocation: i, __tempKey: a } = r.state;
1941
+ if (i && (!a || a === this.tempLocationKey)) {
1942
+ let e = n(i);
1943
+ return e.state.key = r.state.key, e.state.__TSR_key = r.state.__TSR_key, delete e.state.__tempLocation, {
1944
+ ...e,
1945
+ maskedLocation: r
1946
+ };
1947
+ }
1948
+ return r;
1949
+ }, this.resolvePathWithBase = (e, t) => Ve({
1950
+ base: e,
1951
+ to: Ie(t),
1952
+ trailingSlash: this.options.trailingSlash,
1953
+ cache: this.resolvePathCache
1954
+ }), this.matchRoutes = (e, t, n) => typeof e == "string" ? this.matchRoutesInternal({
1955
+ pathname: e,
1956
+ search: t
1957
+ }, n) : this.matchRoutesInternal(e, t), this.getMatchedRoutes = (e) => $t({
1958
+ pathname: e,
1959
+ routesById: this.routesById,
1960
+ processedTree: this.processedTree
1961
+ }), this.cancelMatch = (e) => {
1962
+ let t = this.getMatch(e);
1963
+ t && (t.abortController.abort(), clearTimeout(t._nonReactive.pendingTimeout), t._nonReactive.pendingTimeout = void 0);
1964
+ }, this.cancelMatches = () => {
1965
+ this.stores.pendingMatchesId.state.forEach((e) => {
1966
+ this.cancelMatch(e);
1967
+ }), this.stores.matchesId.state.forEach((e) => {
1968
+ if (this.stores.pendingMatchStoresById.has(e)) return;
1969
+ let t = this.stores.activeMatchStoresById.get(e)?.state;
1970
+ t && (t.status === "pending" || t.isFetching === "loader") && this.cancelMatch(e);
1971
+ });
1972
+ }, this.buildLocation = (e) => {
1973
+ let t = (t = {}) => {
1974
+ let n = t._fromLocation || this.pendingBuiltLocation || this.latestLocation, r = this.matchRoutesLightweight(n);
1975
+ if (t.from && process.env.NODE_ENV !== "production" && t._isNavigate) {
1976
+ let e = this.getMatchedRoutes(t.from).matchedRoutes, n = ae(r.matchedRoutes, (e) => Yt(e.fullPath, t.from)), i = ae(e, (e) => Yt(e.fullPath, r.fullPath));
1977
+ !n && !i && console.warn(`Could not find match for from: ${t.from}`);
1978
+ }
1979
+ let i = t.unsafeRelative === "path" ? n.pathname : t.from ?? r.fullPath, a = this.resolvePathWithBase(i, "."), o = r.search, s = Object.assign(Object.create(null), r.params), c = t.to ? this.resolvePathWithBase(a, `${t.to}`) : this.resolvePathWithBase(a, "."), l = t.params === !1 || t.params === null ? Object.create(null) : (t.params ?? !0) === !0 ? s : Object.assign(s, C(t.params, s)), u = this.getMatchedRoutes(c), d = u.matchedRoutes;
1980
+ if ((!u.foundRoute || u.foundRoute.path !== "/" && u.routeParams["**"]) && this.options.notFoundRoute && (d = [...d, this.options.notFoundRoute]), Object.keys(l).length > 0) for (let e of d) {
1981
+ let t = e.options.params?.stringify ?? e.options.stringifyParams;
1982
+ if (t) try {
1983
+ Object.assign(l, t(l));
1984
+ } catch {}
1985
+ }
1986
+ let f = e.leaveParams ? c : j(We({
1987
+ path: c,
1988
+ params: l,
1989
+ decoder: this.pathParamsDecoder,
1990
+ server: this.isServer
1991
+ }).interpolatedPath).path, p = o;
1992
+ if (e._includeValidateSearch && this.options.search?.strict) {
1993
+ let e = {};
1994
+ d.forEach((t) => {
1995
+ if (t.options.validateSearch) try {
1996
+ Object.assign(e, Qt(t.options.validateSearch, {
1997
+ ...e,
1998
+ ...p
1999
+ }));
2000
+ } catch {}
2001
+ }), p = e;
2002
+ }
2003
+ p = en({
2004
+ search: p,
2005
+ dest: t,
2006
+ destRoutes: d,
2007
+ _includeValidateSearch: e._includeValidateSearch
2008
+ }), p = T(o, p);
2009
+ let m = this.options.stringifySearch(p), h = t.hash === !0 ? n.hash : t.hash ? C(t.hash, n.hash) : void 0, g = h ? `#${h}` : "", _ = t.state === !0 ? n.state : t.state ? C(t.state, n.state) : {};
2010
+ _ = E(n.state, _);
2011
+ let v = `${f}${m}${g}`, y, b, x = !1;
2012
+ if (this.rewrite) {
2013
+ let e = new URL(v, this.origin), t = mt(this.rewrite, e);
2014
+ y = e.href.replace(e.origin, ""), t.origin === this.origin ? b = t.pathname + t.search + t.hash : (b = t.href, x = !0);
2015
+ } else y = pe(v), b = y;
2016
+ return {
2017
+ publicHref: b,
2018
+ href: y,
2019
+ pathname: f,
2020
+ search: p,
2021
+ searchStr: m,
2022
+ state: _,
2023
+ hash: h ?? "",
2024
+ external: x,
2025
+ unmaskOnReload: t.unmaskOnReload
2026
+ };
2027
+ }, n = (n = {}, r) => {
2028
+ let i = t(n), a = r ? t(r) : void 0;
2029
+ if (!a) {
2030
+ let n = Object.create(null);
2031
+ if (this.options.routeMasks) {
2032
+ let o = we(i.pathname, this.processedTree);
2033
+ if (o) {
2034
+ Object.assign(n, o.rawParams);
2035
+ let { from: i, params: s, ...c } = o.route, l = s === !1 || s === null ? Object.create(null) : (s ?? !0) === !0 ? n : Object.assign(n, C(s, n));
2036
+ r = {
2037
+ from: e.from,
2038
+ ...c,
2039
+ params: l
2040
+ }, a = t(r);
2041
+ }
2042
+ }
2043
+ }
2044
+ return a && (i.maskedLocation = a), i;
2045
+ };
2046
+ return e.mask ? n(e, {
2047
+ from: e.from,
2048
+ ...e.mask
2049
+ }) : n(e);
2050
+ }, this.commitLocation = async ({ viewTransition: e, ignoreBlocker: t, ...n }) => {
2051
+ let r = () => {
2052
+ let e = [
2053
+ "key",
2054
+ "__TSR_key",
2055
+ "__TSR_index",
2056
+ "__hashScrollIntoViewOptions"
2057
+ ];
2058
+ e.forEach((e) => {
2059
+ n.state[e] = this.latestLocation.state[e];
2060
+ });
2061
+ let t = O(n.state, this.latestLocation.state);
2062
+ return e.forEach((e) => {
2063
+ delete n.state[e];
2064
+ }), t;
2065
+ }, i = I(this.latestLocation.href) === I(n.href), a = this.commitLocationPromise;
2066
+ if (this.commitLocationPromise = k(() => {
2067
+ a?.resolve(), a = void 0;
2068
+ }), i && r()) this.load();
2069
+ else {
2070
+ let { maskedLocation: r, hashScrollIntoView: i, ...a } = n;
2071
+ r && (a = {
2072
+ ...r,
2073
+ state: {
2074
+ ...r.state,
2075
+ __tempKey: void 0,
2076
+ __tempLocation: {
2077
+ ...a,
2078
+ search: a.searchStr,
2079
+ state: {
2080
+ ...a.state,
2081
+ __tempKey: void 0,
2082
+ __tempLocation: void 0,
2083
+ __TSR_key: void 0,
2084
+ key: void 0
2085
+ }
2086
+ }
2087
+ }
2088
+ }, (a.unmaskOnReload ?? this.options.unmaskOnReload ?? !1) && (a.state.__tempKey = this.tempLocationKey)), a.state.__hashScrollIntoViewOptions = i ?? this.options.defaultHashScrollIntoView ?? !0, this.shouldViewTransition = e, this.history[n.replace ? "replace" : "push"](a.publicHref, a.state, { ignoreBlocker: t });
2089
+ }
2090
+ return this.resetNextScroll = n.resetScroll ?? !0, this.history.subscribers.size || this.load(), this.commitLocationPromise;
2091
+ }, this.buildAndCommitLocation = ({ replace: e, resetScroll: t, hashScrollIntoView: n, viewTransition: r, ignoreBlocker: i, href: a, ...o } = {}) => {
2092
+ if (a) {
2093
+ let t = this.history.location.state.__TSR_index, n = G(a, { __TSR_index: e ? t : t + 1 }), r = new URL(n.pathname, this.origin);
2094
+ o.to = pt(this.rewrite, r).pathname, o.search = this.options.parseSearch(n.search), o.hash = n.hash.slice(1);
2095
+ }
2096
+ let s = this.buildLocation({
2097
+ ...o,
2098
+ _includeValidateSearch: !0
2099
+ });
2100
+ this.pendingBuiltLocation = s;
2101
+ let c = this.commitLocation({
2102
+ ...s,
2103
+ viewTransition: r,
2104
+ replace: e,
2105
+ resetScroll: t,
2106
+ hashScrollIntoView: n,
2107
+ ignoreBlocker: i
2108
+ });
2109
+ return Promise.resolve().then(() => {
2110
+ this.pendingBuiltLocation === s && (this.pendingBuiltLocation = void 0);
2111
+ }), c;
2112
+ }, this.navigate = async ({ to: e, reloadDocument: t, href: n, publicHref: r, ...i }) => {
2113
+ let a = !1;
2114
+ if (n) try {
2115
+ new URL(`${n}`), a = !0;
2116
+ } catch {}
2117
+ if (a && !t && (t = !0), t) {
2118
+ if (e !== void 0 || !n) {
2119
+ let t = this.buildLocation({
2120
+ to: e,
2121
+ ...i
2122
+ });
2123
+ n ??= t.publicHref, r ??= t.publicHref;
2124
+ }
2125
+ let t = !a && r ? r : n;
2126
+ if (le(t, this.protocolAllowlist)) return process.env.NODE_ENV !== "production" && console.warn(`Blocked navigation to dangerous protocol: ${t}`), Promise.resolve();
2127
+ if (!i.ignoreBlocker) {
2128
+ let e = this.history.getBlockers?.() ?? [];
2129
+ for (let t of e) if (t?.blockerFn && await t.blockerFn({
2130
+ currentLocation: this.latestLocation,
2131
+ nextLocation: this.latestLocation,
2132
+ action: "PUSH"
2133
+ })) return Promise.resolve();
2134
+ }
2135
+ return i.replace ? window.location.replace(t) : window.location.href = t, Promise.resolve();
2136
+ }
2137
+ return this.buildAndCommitLocation({
2138
+ ...i,
2139
+ href: n,
2140
+ to: e,
2141
+ _isNavigate: !0
2142
+ });
2143
+ }, this.beforeLoad = () => {
2144
+ this.cancelMatches(), this.updateLatestLocation();
2145
+ let e = this.matchRoutes(this.latestLocation), t = this.stores.cachedMatchesSnapshot.state.filter((t) => !e.some((e) => e.id === t.id));
2146
+ this.batch(() => {
2147
+ this.stores.status.setState(() => "pending"), this.stores.statusCode.setState(() => 200), this.stores.isLoading.setState(() => !0), this.stores.location.setState(() => this.latestLocation), this.stores.setPendingMatches(e), this.stores.setCachedMatches(t);
2148
+ });
2149
+ }, this.load = async (e) => {
2150
+ let t, n, r, i = this.stores.resolvedLocation.state ?? this.stores.location.state;
2151
+ for (r = new Promise((a) => {
2152
+ this.startTransition(async () => {
2153
+ try {
2154
+ this.beforeLoad();
2155
+ let t = this.latestLocation, n = this.stores.resolvedLocation.state, r = K(t, n);
2156
+ this.stores.redirect.state || this.emit({
2157
+ type: "onBeforeNavigate",
2158
+ ...r
2159
+ }), this.emit({
2160
+ type: "onBeforeLoad",
2161
+ ...r
2162
+ }), await Mt({
2163
+ router: this,
2164
+ sync: e?.sync,
2165
+ forceStaleReload: i.href === t.href,
2166
+ matches: this.stores.pendingMatchesSnapshot.state,
2167
+ location: t,
2168
+ updateMatch: this.updateMatch,
2169
+ onReady: async () => {
2170
+ this.startTransition(() => {
2171
+ this.startViewTransition(async () => {
2172
+ let e = null, t = null, n = null, r = null;
2173
+ this.batch(() => {
2174
+ let i = this.stores.pendingMatchesSnapshot.state, a = i.length, o = this.stores.activeMatchesSnapshot.state;
2175
+ e = a ? o.filter((e) => !this.stores.pendingMatchStoresById.has(e.id)) : null;
2176
+ let s = /* @__PURE__ */ new Set();
2177
+ for (let e of this.stores.pendingMatchStoresById.values()) e.routeId && s.add(e.routeId);
2178
+ let c = /* @__PURE__ */ new Set();
2179
+ for (let e of this.stores.activeMatchStoresById.values()) e.routeId && c.add(e.routeId);
2180
+ t = a ? o.filter((e) => !s.has(e.routeId)) : null, n = a ? i.filter((e) => !c.has(e.routeId)) : null, r = a ? i.filter((e) => c.has(e.routeId)) : o, this.stores.isLoading.setState(() => !1), this.stores.loadedAt.setState(() => Date.now()), a && (this.stores.setActiveMatches(i), this.stores.setPendingMatches([]), this.stores.setCachedMatches([...this.stores.cachedMatchesSnapshot.state, ...e.filter((e) => e.status !== "error" && e.status !== "notFound" && e.status !== "redirected")]), this.clearExpiredCache());
2181
+ });
2182
+ for (let [e, i] of [
2183
+ [t, "onLeave"],
2184
+ [n, "onEnter"],
2185
+ [r, "onStay"]
2186
+ ]) if (e) for (let t of e) this.looseRoutesById[t.routeId].options[i]?.(t);
2187
+ });
2188
+ });
2189
+ }
2190
+ });
2191
+ } catch (e) {
2192
+ z(e) ? (t = e, this.navigate({
2193
+ ...t.options,
2194
+ replace: !0,
2195
+ ignoreBlocker: !0
2196
+ })) : L(e) && (n = e);
2197
+ let r = t ? t.status : n ? 404 : this.stores.activeMatchesSnapshot.state.some((e) => e.status === "error") ? 500 : 200;
2198
+ this.batch(() => {
2199
+ this.stores.statusCode.setState(() => r), this.stores.redirect.setState(() => t);
2200
+ });
2201
+ }
2202
+ this.latestLoadPromise === r && (this.commitLocationPromise?.resolve(), this.latestLoadPromise = void 0, this.commitLocationPromise = void 0), a();
2203
+ });
2204
+ }), this.latestLoadPromise = r, await r; this.latestLoadPromise && r !== this.latestLoadPromise;) await this.latestLoadPromise;
2205
+ let a;
2206
+ this.hasNotFoundMatch() ? a = 404 : this.stores.activeMatchesSnapshot.state.some((e) => e.status === "error") && (a = 500), a !== void 0 && this.stores.statusCode.setState(() => a);
2207
+ }, this.startViewTransition = (e) => {
2208
+ let t = this.shouldViewTransition ?? this.options.defaultViewTransition;
2209
+ if (this.shouldViewTransition = void 0, t && typeof document < "u" && "startViewTransition" in document && typeof document.startViewTransition == "function") {
2210
+ let n;
2211
+ if (typeof t == "object" && this.isViewTransitionTypesSupported) {
2212
+ let r = this.latestLocation, i = this.stores.resolvedLocation.state, a = typeof t.types == "function" ? t.types(K(r, i)) : t.types;
2213
+ if (a === !1) {
2214
+ e();
2215
+ return;
2216
+ }
2217
+ n = {
2218
+ update: e,
2219
+ types: a
2220
+ };
2221
+ } else n = e;
2222
+ document.startViewTransition(n);
2223
+ } else e();
2224
+ }, this.updateMatch = (e, t) => {
2225
+ this.startTransition(() => {
2226
+ let n = this.stores.pendingMatchStoresById.get(e);
2227
+ if (n) {
2228
+ n.setState(t);
2229
+ return;
2230
+ }
2231
+ let r = this.stores.activeMatchStoresById.get(e);
2232
+ if (r) {
2233
+ r.setState(t);
2234
+ return;
2235
+ }
2236
+ let i = this.stores.cachedMatchStoresById.get(e);
2237
+ if (i) {
2238
+ let n = t(i.state);
2239
+ n.status === "redirected" ? this.stores.cachedMatchStoresById.delete(e) && this.stores.cachedMatchesId.setState((t) => t.filter((t) => t !== e)) : i.setState(() => n);
2240
+ }
2241
+ });
2242
+ }, this.getMatch = (e) => this.stores.cachedMatchStoresById.get(e)?.state ?? this.stores.pendingMatchStoresById.get(e)?.state ?? this.stores.activeMatchStoresById.get(e)?.state, this.invalidate = (e) => {
2243
+ let t = (t) => e?.filter?.(t) ?? !0 ? {
2244
+ ...t,
2245
+ invalid: !0,
2246
+ ...e?.forcePending || t.status === "error" || t.status === "notFound" ? {
2247
+ status: "pending",
2248
+ error: void 0
2249
+ } : void 0
2250
+ } : t;
2251
+ return this.batch(() => {
2252
+ this.stores.setActiveMatches(this.stores.activeMatchesSnapshot.state.map(t)), this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.map(t)), this.stores.setPendingMatches(this.stores.pendingMatchesSnapshot.state.map(t));
2253
+ }), this.shouldViewTransition = !1, this.load({ sync: e?.sync });
2254
+ }, this.getParsedLocationHref = (e) => e.publicHref || "/", this.resolveRedirect = (e) => {
2255
+ let t = e.headers.get("Location");
2256
+ if (!e.options.href || e.options._builtLocation) {
2257
+ let t = e.options._builtLocation ?? this.buildLocation(e.options), n = this.getParsedLocationHref(t);
2258
+ e.options.href = n, e.headers.set("Location", n);
2259
+ } else if (t) try {
2260
+ let n = new URL(t);
2261
+ if (this.origin && n.origin === this.origin) {
2262
+ let t = n.pathname + n.search + n.hash;
2263
+ e.options.href = t, e.headers.set("Location", t);
2264
+ }
2265
+ } catch {}
2266
+ if (e.options.href && !e.options._builtLocation && le(e.options.href, this.protocolAllowlist)) throw Error(process.env.NODE_ENV === "production" ? "Redirect blocked: unsafe protocol" : `Redirect blocked: unsafe protocol in href "${e.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`);
2267
+ return e.headers.get("Location") || e.headers.set("Location", e.options.href), e;
2268
+ }, this.clearCache = (e) => {
2269
+ let t = e?.filter;
2270
+ t === void 0 ? this.stores.setCachedMatches([]) : this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.filter((e) => !t(e)));
2271
+ }, this.clearExpiredCache = () => {
2272
+ let e = Date.now();
2273
+ this.clearCache({ filter: (t) => {
2274
+ let n = this.looseRoutesById[t.routeId];
2275
+ if (!n.options.loader) return !0;
2276
+ let r = (t.preload ? n.options.preloadGcTime ?? this.options.defaultPreloadGcTime : n.options.gcTime ?? this.options.defaultGcTime) ?? 300 * 1e3;
2277
+ return t.status === "error" ? !0 : e - t.updatedAt >= r;
2278
+ } });
2279
+ }, this.loadRouteChunk = U, this.preloadRoute = async (e) => {
2280
+ let t = e._builtLocation ?? this.buildLocation(e), n = this.matchRoutes(t, {
2281
+ throwOnError: !0,
2282
+ preload: !0,
2283
+ dest: e
2284
+ }), r = new Set([...this.stores.matchesId.state, ...this.stores.pendingMatchesId.state]), i = new Set([...r, ...this.stores.cachedMatchesId.state]), a = n.filter((e) => !i.has(e.id));
2285
+ if (a.length) {
2286
+ let e = this.stores.cachedMatchesSnapshot.state;
2287
+ this.stores.setCachedMatches([...e, ...a]);
2288
+ }
2289
+ try {
2290
+ return n = await Mt({
2291
+ router: this,
2292
+ matches: n,
2293
+ location: t,
2294
+ preload: !0,
2295
+ updateMatch: (e, t) => {
2296
+ r.has(e) ? n = n.map((n) => n.id === e ? t(n) : n) : this.updateMatch(e, t);
2297
+ }
2298
+ }), n;
2299
+ } catch (e) {
2300
+ if (z(e)) return e.options.reloadDocument ? void 0 : await this.preloadRoute({
2301
+ ...e.options,
2302
+ _fromLocation: t
2303
+ });
2304
+ L(e) || console.error(e);
2305
+ return;
2306
+ }
2307
+ }, this.matchRoute = (e, t) => {
2308
+ let n = {
2309
+ ...e,
2310
+ to: e.to ? this.resolvePathWithBase(e.from || "", e.to) : void 0,
2311
+ params: e.params || {},
2312
+ leaveParams: !0
2313
+ }, r = this.buildLocation(n);
2314
+ if (t?.pending && this.stores.status.state !== "pending") return !1;
2315
+ let i = (t?.pending === void 0 ? !this.stores.isLoading.state : t.pending) ? this.latestLocation : this.stores.resolvedLocation.state || this.stores.location.state, a = Te(r.pathname, t?.caseSensitive ?? !1, t?.fuzzy ?? !1, i.pathname, this.processedTree);
2316
+ return !a || e.params && !O(a.rawParams, e.params, { partial: !0 }) ? !1 : t?.includeSearch ?? !0 ? O(i.search, r.search, { partial: !0 }) ? a.rawParams : !1 : a.rawParams;
2317
+ }, this.hasNotFoundMatch = () => this.stores.activeMatchesSnapshot.state.some((e) => e.status === "notFound" || e.globalNotFound), this.getStoreConfig = t, this.update({
2318
+ defaultPreloadDelay: 50,
2319
+ defaultPendingMs: 1e3,
2320
+ defaultPendingMinMs: 500,
2321
+ context: void 0,
2322
+ ...e,
2323
+ caseSensitive: e.caseSensitive ?? !1,
2324
+ notFoundMode: e.notFoundMode ?? "fuzzy",
2325
+ stringifySearch: e.stringifySearch ?? st,
2326
+ parseSearch: e.parseSearch ?? ot,
2327
+ protocolAllowlist: e.protocolAllowlist ?? ce
2328
+ }), typeof document < "u" && (self.__TSR_ROUTER__ = this);
2329
+ }
2330
+ isShell() {
2331
+ return !!this.options.isShell;
2332
+ }
2333
+ isPrerendering() {
2334
+ return !!this.options.isPrerendering;
2335
+ }
2336
+ get state() {
2337
+ return this.stores.__store.state;
2338
+ }
2339
+ setRoutes({ routesById: e, routesByPath: t, processedTree: n }) {
2340
+ this.routesById = e, this.routesByPath = t, this.processedTree = n;
2341
+ let r = this.options.notFoundRoute;
2342
+ r && (r.init({ originalIndex: 99999999999 }), this.routesById[r.id] = r);
2343
+ }
2344
+ get looseRoutesById() {
2345
+ return this.routesById;
2346
+ }
2347
+ getParentContext(e) {
2348
+ return e?.id ? e.context ?? this.options.context ?? void 0 : this.options.context ?? void 0;
2349
+ }
2350
+ matchRoutesInternal(e, t) {
2351
+ let n = this.getMatchedRoutes(e.pathname), { foundRoute: r, routeParams: i, parsedParams: a } = n, { matchedRoutes: o } = n, s = !1;
2352
+ (r ? r.path !== "/" && i["**"] : I(e.pathname)) && (this.options.notFoundRoute ? o = [...o, this.options.notFoundRoute] : s = !0);
2353
+ let c = s ? nn(this.options.notFoundMode, o) : void 0, l = Array(o.length), u = /* @__PURE__ */ new Map();
2354
+ for (let e of this.stores.activeMatchStoresById.values()) e.routeId && u.set(e.routeId, e.state);
2355
+ for (let n = 0; n < o.length; n++) {
2356
+ let r = o[n], s = l[n - 1], d, f, p;
2357
+ {
2358
+ let n = s?.search ?? e.search, i = s?._strictSearch ?? void 0;
2359
+ try {
2360
+ let e = Qt(r.options.validateSearch, { ...n }) ?? void 0;
2361
+ d = {
2362
+ ...n,
2363
+ ...e
2364
+ }, f = {
2365
+ ...i,
2366
+ ...e
2367
+ }, p = void 0;
2368
+ } catch (e) {
2369
+ let r = e;
2370
+ if (e instanceof Kt || (r = new Kt(e.message, { cause: e })), t?.throwOnError) throw r;
2371
+ d = n, f = {}, p = r;
2372
+ }
2373
+ }
2374
+ let m = r.options.loaderDeps?.({ search: d }) ?? "", h = m ? JSON.stringify(m) : "", { interpolatedPath: g, usedParams: _ } = We({
2375
+ path: r.fullPath,
2376
+ params: i,
2377
+ decoder: this.pathParamsDecoder,
2378
+ server: this.isServer
2379
+ }), v = r.id + g + h, y = this.getMatch(v), b = u.get(r.id), x = y?._strictParams ?? _, S;
2380
+ if (!y) try {
2381
+ rn(r, _, a, x);
2382
+ } catch (e) {
2383
+ if (S = L(e) || z(e) ? e : new qt(e.message, { cause: e }), t?.throwOnError) throw S;
2384
+ }
2385
+ Object.assign(i, x);
2386
+ let C = b ? "stay" : "enter", w;
2387
+ if (y) w = {
2388
+ ...y,
2389
+ cause: C,
2390
+ params: b?.params ?? i,
2391
+ _strictParams: x,
2392
+ search: T(b ? b.search : y.search, d),
2393
+ _strictSearch: f
2394
+ };
2395
+ else {
2396
+ let e = r.options.loader || r.options.beforeLoad || r.lazyFn || Pt(r) ? "pending" : "success";
2397
+ w = {
2398
+ id: v,
2399
+ ssr: r.options.ssr,
2400
+ index: n,
2401
+ routeId: r.id,
2402
+ params: b?.params ?? i,
2403
+ _strictParams: x,
2404
+ pathname: g,
2405
+ updatedAt: Date.now(),
2406
+ search: b ? T(b.search, d) : d,
2407
+ _strictSearch: f,
2408
+ searchError: void 0,
2409
+ status: e,
2410
+ isFetching: !1,
2411
+ error: void 0,
2412
+ paramsError: S,
2413
+ __routeContext: void 0,
2414
+ _nonReactive: { loadPromise: k() },
2415
+ __beforeLoadContext: void 0,
2416
+ context: {},
2417
+ abortController: new AbortController(),
2418
+ fetchCount: 0,
2419
+ cause: C,
2420
+ loaderDeps: b ? E(b.loaderDeps, m) : m,
2421
+ invalid: !1,
2422
+ preload: !1,
2423
+ links: void 0,
2424
+ scripts: void 0,
2425
+ headScripts: void 0,
2426
+ meta: void 0,
2427
+ staticData: r.options.staticData || {},
2428
+ fullPath: r.fullPath
2429
+ };
2430
+ }
2431
+ t?.preload || (w.globalNotFound = c === r.id), w.searchError = p;
2432
+ let ee = this.getParentContext(s);
2433
+ w.context = {
2434
+ ...ee,
2435
+ ...w.__routeContext,
2436
+ ...w.__beforeLoadContext
2437
+ }, l[n] = w;
2438
+ }
2439
+ for (let t = 0; t < l.length; t++) {
2440
+ let n = l[t], r = this.looseRoutesById[n.routeId], a = this.getMatch(n.id), o = u.get(n.routeId);
2441
+ if (n.params = o ? T(o.params, i) : i, !a) {
2442
+ let i = l[t - 1], a = this.getParentContext(i);
2443
+ if (r.options.context) {
2444
+ let t = {
2445
+ deps: n.loaderDeps,
2446
+ params: n.params,
2447
+ context: a ?? {},
2448
+ location: e,
2449
+ navigate: (t) => this.navigate({
2450
+ ...t,
2451
+ _fromLocation: e
2452
+ }),
2453
+ buildLocation: this.buildLocation,
2454
+ cause: n.cause,
2455
+ abortController: n.abortController,
2456
+ preload: !!n.preload,
2457
+ matches: l,
2458
+ routeId: r.id
2459
+ };
2460
+ n.__routeContext = r.options.context(t) ?? void 0;
2461
+ }
2462
+ n.context = {
2463
+ ...a,
2464
+ ...n.__routeContext,
2465
+ ...n.__beforeLoadContext
2466
+ };
2467
+ }
2468
+ }
2469
+ return l;
2470
+ }
2471
+ matchRoutesLightweight(e) {
2472
+ let { matchedRoutes: t, routeParams: n, parsedParams: r } = this.getMatchedRoutes(e.pathname), i = x(t), a = { ...e.search };
2473
+ for (let e of t) try {
2474
+ Object.assign(a, Qt(e.options.validateSearch, a));
2475
+ } catch {}
2476
+ let o = x(this.stores.matchesId.state), s = o && this.stores.activeMatchStoresById.get(o)?.state, c = s && s.routeId === i.id && s.pathname === e.pathname, l;
2477
+ if (c) l = s.params;
2478
+ else {
2479
+ let e = Object.assign(Object.create(null), n);
2480
+ for (let i of t) try {
2481
+ rn(i, n, r ?? {}, e);
2482
+ } catch {}
2483
+ l = e;
2484
+ }
2485
+ return {
2486
+ matchedRoutes: t,
2487
+ fullPath: i.fullPath,
2488
+ search: a,
2489
+ params: l
2490
+ };
2491
+ }
2492
+ }, Kt = class extends Error {}, qt = class extends Error {}, Jt = (e) => e.endsWith("/") && e.length > 1 ? e.slice(0, -1) : e;
2493
+ function Yt(e, t) {
2494
+ return Jt(e) === Jt(t);
2495
+ }
2496
+ function Xt(e, t) {
2497
+ return async (...n) => (await e())[t || "default"](...n);
2498
+ }
2499
+ function Zt(e) {
2500
+ return {
2501
+ loadedAt: 0,
2502
+ isLoading: !1,
2503
+ isTransitioning: !1,
2504
+ status: "idle",
2505
+ resolvedLocation: void 0,
2506
+ location: e,
2507
+ matches: [],
2508
+ statusCode: 200
2509
+ };
2510
+ }
2511
+ function Qt(e, t) {
2512
+ if (e == null) return {};
2513
+ if ("~standard" in e) {
2514
+ let n = e["~standard"].validate(t);
2515
+ if (n instanceof Promise) throw new Kt("Async validation not supported");
2516
+ if (n.issues) throw new Kt(JSON.stringify(n.issues, void 0, 2), { cause: n });
2517
+ return n.value;
2518
+ }
2519
+ return "parse" in e ? e.parse(t) : typeof e == "function" ? e(t) : {};
2520
+ }
2521
+ function $t({ pathname: e, routesById: t, processedTree: n }) {
2522
+ let r = Object.create(null), i = I(e), a, o, s = Ee(i, n, !0);
2523
+ return s && (a = s.route, Object.assign(r, s.rawParams), o = Object.assign(Object.create(null), s.parsedParams)), {
2524
+ matchedRoutes: s?.branch || [t.__root__],
2525
+ routeParams: r,
2526
+ foundRoute: a,
2527
+ parsedParams: o
2528
+ };
2529
+ }
2530
+ function en({ search: e, dest: t, destRoutes: n, _includeValidateSearch: r }) {
2531
+ return tn(n)(e, t, r ?? !1);
2532
+ }
2533
+ function tn(e) {
2534
+ let t = {
2535
+ dest: null,
2536
+ _includeValidateSearch: !1,
2537
+ middlewares: []
2538
+ };
2539
+ for (let n of e) "search" in n.options ? n.options.search?.middlewares && t.middlewares.push(...n.options.search.middlewares) : (n.options.preSearchFilters || n.options.postSearchFilters) && t.middlewares.push(({ search: e, next: t }) => {
2540
+ let r = e;
2541
+ "preSearchFilters" in n.options && n.options.preSearchFilters && (r = n.options.preSearchFilters.reduce((e, t) => t(e), e));
2542
+ let i = t(r);
2543
+ return "postSearchFilters" in n.options && n.options.postSearchFilters ? n.options.postSearchFilters.reduce((e, t) => t(e), i) : i;
2544
+ }), n.options.validateSearch && t.middlewares.push(({ search: e, next: r }) => {
2545
+ let i = r(e);
2546
+ if (!t._includeValidateSearch) return i;
2547
+ try {
2548
+ return {
2549
+ ...i,
2550
+ ...Qt(n.options.validateSearch, i) ?? void 0
2551
+ };
2552
+ } catch {
2553
+ return i;
2554
+ }
2555
+ });
2556
+ t.middlewares.push(({ search: e }) => {
2557
+ let n = t.dest;
2558
+ return n.search ? n.search === !0 ? e : C(n.search, e) : {};
2559
+ });
2560
+ let n = (e, t, r) => {
2561
+ if (e >= r.length) return t;
2562
+ let i = r[e];
2563
+ return i({
2564
+ search: t,
2565
+ next: (t) => n(e + 1, t, r)
2566
+ });
2567
+ };
2568
+ return function(e, r, i) {
2569
+ return t.dest = r, t._includeValidateSearch = i, n(0, e, t.middlewares);
2570
+ };
2571
+ }
2572
+ function nn(e, t) {
2573
+ if (e !== "root") for (let e = t.length - 1; e >= 0; e--) {
2574
+ let n = t[e];
2575
+ if (n.children) return n.id;
2576
+ }
2577
+ return R;
2578
+ }
2579
+ function rn(e, t, n, r) {
2580
+ let i = e.options.params?.parse ?? e.options.parseParams;
2581
+ if (i) if (e.options.skipRouteOnParseError) for (let e in t) e in n && (r[e] = n[e]);
2582
+ else {
2583
+ let e = i(r);
2584
+ Object.assign(r, e);
2585
+ }
2586
+ }
2587
+ //#endregion
2588
+ //#region ../router-core/dist/esm/link.js
2589
+ var an = "Error preloading route! ☝️", on = class {
2590
+ get to() {
2591
+ return this._to;
2592
+ }
2593
+ get id() {
2594
+ return this._id;
2595
+ }
2596
+ get path() {
2597
+ return this._path;
2598
+ }
2599
+ get fullPath() {
2600
+ return this._fullPath;
2601
+ }
2602
+ constructor(e) {
2603
+ if (this.init = (e) => {
2604
+ this.originalIndex = e.originalIndex;
2605
+ let t = this.options, n = !t?.path && !t?.id;
2606
+ if (this.parentRoute = this.options.getParentRoute?.(), n) this._path = R;
2607
+ else if (!this.parentRoute) {
2608
+ if (process.env.NODE_ENV !== "production") throw Error("Invariant failed: Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.");
2609
+ he();
2610
+ }
2611
+ let r = n ? R : t?.path;
2612
+ r && r !== "/" && (r = Le(r));
2613
+ let i = t?.id || r, a = n ? R : Fe([this.parentRoute.id === "__root__" ? "" : this.parentRoute.id, i]);
2614
+ r === "__root__" && (r = "/"), a !== "__root__" && (a = Fe(["/", a]));
2615
+ let o = a === "__root__" ? "/" : Fe([this.parentRoute.fullPath, r]);
2616
+ this._path = r, this._id = a, this._fullPath = o, this._to = I(o);
2617
+ }, this.addChildren = (e) => this._addFileChildren(e), this._addFileChildren = (e) => (Array.isArray(e) && (this.children = e), typeof e == "object" && e && (this.children = Object.values(e)), this), this._addFileTypes = () => this, 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.redirect = (e) => ut({
2618
+ from: this.fullPath,
2619
+ ...e
2620
+ }), this.options = e || {}, this.isRoot = !e?.getParentRoute, e?.id && e?.path) throw Error("Route cannot have both an 'id' and a 'path' option.");
2621
+ }
2622
+ }, sn = class {
2623
+ constructor({ id: e }) {
2624
+ this.notFound = (e) => Ke({
2625
+ routeId: this.id,
2626
+ ...e
2627
+ }), this.redirect = (e) => ut({
2628
+ from: this.id,
2629
+ ...e
2630
+ }), this.id = e;
2631
+ }
2632
+ }, cn = class extends on {
2633
+ constructor(e) {
2634
+ super(e);
2635
+ }
2636
+ }, ln = (e) => ({
2637
+ serializationAdapters: e.serializationAdapters,
2638
+ defaultSsr: e.defaultSsr
2639
+ });
2640
+ //#endregion
2641
+ //#region ../router-core/dist/esm/searchMiddleware.js
2642
+ function un(e) {
2643
+ return ({ search: t, next: n }) => {
2644
+ let r = n(t);
2645
+ if (e === !0) return {
2646
+ ...t,
2647
+ ...r
2648
+ };
2649
+ let i = { ...r };
2650
+ return e.forEach((e) => {
2651
+ e in i || (i[e] = t[e]);
2652
+ }), i;
2653
+ };
2654
+ }
2655
+ //#endregion
2656
+ //#region ../router-core/dist/esm/hash-scroll.js
2657
+ function dn(e) {
2658
+ if (typeof document < "u" && document.querySelector) {
2659
+ let t = e.stores.location.state, n = t.state.__hashScrollIntoViewOptions ?? !0;
2660
+ if (n && t.hash !== "") {
2661
+ let e = document.getElementById(t.hash);
2662
+ e && e.scrollIntoView(n);
2663
+ }
2664
+ }
2665
+ }
2666
+ //#endregion
2667
+ //#region src/routerStores.ts
2668
+ function fn(e, t) {
2669
+ e.childMatchIdByRouteId = t(() => {
2670
+ let t = e.matchesId.state, n = {};
2671
+ for (let r = 0; r < t.length - 1; r++) {
2672
+ let i = t[r], a = t[r + 1];
2673
+ if (i === void 0 || a === void 0) continue;
2674
+ let o = e.activeMatchStoresById.get(i);
2675
+ o?.routeId && (n[o.routeId] = a);
2676
+ }
2677
+ return n;
2678
+ }), e.pendingRouteIds = t(() => {
2679
+ let t = e.pendingMatchesId.state, n = {};
2680
+ for (let r of t) {
2681
+ let t = e.pendingMatchStoresById.get(r);
2682
+ t?.routeId && (n[t.routeId] = !0);
2683
+ }
2684
+ return n;
2685
+ });
2686
+ }
2687
+ function pn(t) {
2688
+ let n = e.signal(t);
2689
+ return {
2690
+ get state() {
2691
+ return n();
2692
+ },
2693
+ setState(e) {
2694
+ n.update(e);
2695
+ }
2696
+ };
2697
+ }
2698
+ function mn(t) {
2699
+ let n = e.computed(t);
2700
+ return { get state() {
2701
+ return n();
2702
+ } };
2703
+ }
2704
+ var hn = (e) => ({
2705
+ createMutableStore: pn,
2706
+ createReadonlyStore: mn,
2707
+ batch: (e) => e(),
2708
+ init: (e) => fn(e, mn)
2709
+ }), gn = (e) => new _n(e), _n = class extends Gt {
2710
+ constructor(e) {
2711
+ super(e, hn);
2712
+ }
2713
+ }, vn = {
2714
+ matchId: () => void 0,
2715
+ routeId: () => void 0,
2716
+ match: () => void 0,
2717
+ hasPending: () => !1
2718
+ }, q = new e.InjectionToken("MATCH_CONTEXT_INJECTOR", {
2719
+ providedIn: "root",
2720
+ factory: () => vn
2721
+ }), yn = new e.InjectionToken("ROUTER");
2722
+ function bn() {
2723
+ return typeof document > "u" ? yn : window.__TSR_ROUTER_INJECTION_KEY__ ? window.__TSR_ROUTER_INJECTION_KEY__ : (window.__TSR_ROUTER_INJECTION_KEY__ = yn, yn);
2724
+ }
2725
+ //#endregion
2726
+ //#region src/injectRouter.ts
2727
+ function J(t) {
2728
+ let n = e.inject(bn(), { optional: !0 });
2729
+ return process.env.NODE_ENV !== "production" && (t?.warn ?? !0) && !n && console.warn("Warning: injectRouter must be used inside a <router-provider> component!"), n;
2730
+ }
2731
+ //#endregion
2732
+ //#region src/injectStore.ts
2733
+ function Y(e, t = (e) => e, n = { equal: xn }) {
2734
+ u(Y);
2735
+ let r = typeof e == "function" ? e : () => e, i = _(() => t(r().state), n);
2736
+ return f(() => {
2737
+ i();
2738
+ }), i.asReadonly();
2739
+ }
2740
+ function xn(e, t) {
2741
+ if (Object.is(e, t)) return !0;
2742
+ if (typeof e != "object" || !e || typeof t != "object" || !t) return !1;
2743
+ if (e instanceof Map && t instanceof Map) {
2744
+ if (e.size !== t.size) return !1;
2745
+ for (let [n, r] of e) if (!t.has(n) || !Object.is(r, t.get(n))) return !1;
2746
+ return !0;
2747
+ }
2748
+ if (e instanceof Set && t instanceof Set) {
2749
+ if (e.size !== t.size) return !1;
2750
+ for (let n of e) if (!t.has(n)) return !1;
2751
+ return !0;
2752
+ }
2753
+ if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
2754
+ let n = Object.keys(e);
2755
+ if (n.length !== Object.keys(t).length) return !1;
2756
+ for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !Object.is(e[r], t[r])) return !1;
2757
+ return !0;
2758
+ }
2759
+ //#endregion
2760
+ //#region src/injectMatch.ts
2761
+ function X(t) {
2762
+ let n = J(), r = t.from ? void 0 : e.inject(q), i = Y(n.stores.pendingRouteIds, (e) => e), a = Y(n.stores.isTransitioning, (e) => e), o = () => t.from ? n.stores.getMatchStoreByRouteId(t.from).state : r?.match();
2763
+ return e.computed(() => {
2764
+ let e = o();
2765
+ if (e !== void 0) return t.select ? t.select(e) : e;
2766
+ if (!(t.from ? i()[t.from] : r?.hasPending() ?? !1) && !a() && (t.shouldThrow ?? !0)) {
2767
+ if (process.env.NODE_ENV !== "production") throw Error(`Invariant failed: Could not find ${t.from ? `an active match from "${t.from}"` : "a nearest match!"}`);
2768
+ he();
2769
+ }
2770
+ }, { equal: O });
2771
+ }
2772
+ //#endregion
2773
+ //#region src/injectLoaderData.ts
2774
+ function Sn(e) {
2775
+ return X({
2776
+ from: e.from,
2777
+ strict: e.strict,
2778
+ select: (t) => e.select ? e.select(t.loaderData) : t.loaderData
2779
+ });
2780
+ }
2781
+ //#endregion
2782
+ //#region src/injectLoaderDeps.ts
2783
+ function Cn(e) {
2784
+ let { select: t, ...n } = e;
2785
+ return X({
2786
+ ...n,
2787
+ select: (e) => t ? t(e.loaderDeps) : e.loaderDeps
2788
+ });
2789
+ }
2790
+ //#endregion
2791
+ //#region src/injectNavigate.ts
2792
+ function wn(e) {
2793
+ let t = J();
2794
+ return ((n) => t.navigate({
2795
+ ...n,
2796
+ from: n.from ?? e?.from
2797
+ }));
2798
+ }
2799
+ //#endregion
2800
+ //#region src/injectParams.ts
2801
+ function Tn(e) {
2802
+ return X({
2803
+ from: e.from,
2804
+ strict: e.strict,
2805
+ shouldThrow: e.shouldThrow,
2806
+ select: (t) => e.select ? e.select(t.params) : t.params
2807
+ });
2808
+ }
2809
+ //#endregion
2810
+ //#region src/injectRouteContext.ts
2811
+ function En(e) {
2812
+ return X({
2813
+ ...e,
2814
+ select: (t) => e.select ? e.select(t.context) : t.context
2815
+ });
2816
+ }
2817
+ //#endregion
2818
+ //#region src/injectSearch.ts
2819
+ function Dn(e) {
2820
+ return X({
2821
+ from: e.from,
2822
+ strict: e.strict,
2823
+ shouldThrow: e.shouldThrow,
2824
+ select: (t) => e.select ? e.select(t.search) : t.search
2825
+ });
2826
+ }
2827
+ //#endregion
2828
+ //#region src/route.ts
2829
+ function On(e) {
2830
+ return new kn({ id: e });
2831
+ }
2832
+ var kn = class extends sn {
2833
+ constructor({ id: e }) {
2834
+ super({ id: e }), this.injectMatch = (e) => X({
2835
+ select: e?.select,
2836
+ from: this.id
2837
+ }), this.injectRouteContext = (e) => En({
2838
+ ...e,
2839
+ from: this.id
2840
+ }), this.injectSearch = (e) => Dn({
2841
+ select: e?.select,
2842
+ from: this.id
2843
+ }), this.injectParams = (e) => Tn({
2844
+ select: e?.select,
2845
+ from: this.id
2846
+ }), this.injectLoaderDeps = (e) => Cn({
2847
+ ...e,
2848
+ from: this.id,
2849
+ strict: !1
2850
+ }), this.injectLoaderData = (e) => Sn({
2851
+ ...e,
2852
+ from: this.id,
2853
+ strict: !1
2854
+ }), this.injectNavigate = () => wn({ from: J().routesById[this.id].fullPath }), this.notFound = (e) => Ke({
2855
+ routeId: this.id,
2856
+ ...e
2857
+ });
2858
+ }
2859
+ }, An = class extends on {
2860
+ constructor(e) {
2861
+ super(e), this.injectMatch = (e) => X({
2862
+ select: e?.select,
2863
+ from: this.id
2864
+ }), this.injectRouteContext = (e) => X({
2865
+ ...e,
2866
+ from: this.id,
2867
+ select: (t) => e?.select ? e.select(t.context) : t.context
2868
+ }), this.injectSearch = (e) => Dn({
2869
+ select: e?.select,
2870
+ from: this.id
2871
+ }), this.injectParams = (e) => Tn({
2872
+ select: e?.select,
2873
+ from: this.id
2874
+ }), this.injectLoaderDeps = (e) => Cn({
2875
+ ...e,
2876
+ from: this.id
2877
+ }), this.injectLoaderData = (e) => Sn({
2878
+ ...e,
2879
+ from: this.id
2880
+ }), this.injectNavigate = () => wn({ from: this.fullPath });
2881
+ }
2882
+ };
2883
+ function jn(e) {
2884
+ return new An(e);
2885
+ }
2886
+ function Mn() {
2887
+ return (e) => In(e);
2888
+ }
2889
+ var Nn = class extends cn {
2890
+ constructor(e) {
2891
+ super(e), this.injectMatch = (e) => X({
2892
+ select: e?.select,
2893
+ from: this.id
2894
+ }), this.injectRouteContext = (e) => X({
2895
+ ...e,
2896
+ from: this.id,
2897
+ select: (t) => e?.select ? e.select(t.context) : t.context
2898
+ }), this.injectSearch = (e) => Dn({
2899
+ select: e?.select,
2900
+ from: this.id
2901
+ }), this.injectParams = (e) => Tn({
2902
+ select: e?.select,
2903
+ from: this.id
2904
+ }), this.injectLoaderDeps = (e) => Cn({
2905
+ ...e,
2906
+ from: this.id
2907
+ }), this.injectLoaderData = (e) => Sn({
2908
+ ...e,
2909
+ from: this.id
2910
+ }), this.injectNavigate = () => wn({ from: this.fullPath });
2911
+ }
2912
+ };
2913
+ function Pn(e) {
2914
+ return e;
2915
+ }
2916
+ var Fn = class extends An {
2917
+ constructor(e) {
2918
+ super({
2919
+ ...e,
2920
+ id: "404"
2921
+ });
2922
+ }
2923
+ };
2924
+ function In(e) {
2925
+ return new Nn(e);
2926
+ }
2927
+ //#endregion
2928
+ //#region src/fileRoute.ts
2929
+ function Ln(e) {
2930
+ return typeof e == "object" ? new Rn().createRoute(e) : new Rn().createRoute;
2931
+ }
2932
+ var Rn = class {
2933
+ constructor() {
2934
+ this.createRoute = (e) => {
2935
+ let t = jn(e);
2936
+ return t.isRoot = !1, t;
2937
+ };
2938
+ }
2939
+ }, zn = class {
2940
+ constructor(e) {
2941
+ this.injectMatch = (e) => X({
2942
+ select: e?.select,
2943
+ from: this.options.id
2944
+ }), this.injectRouteContext = (e) => En({
2945
+ ...e,
2946
+ from: this.options.id
2947
+ }), this.injectSearch = (e) => Dn({
2948
+ select: e?.select,
2949
+ from: this.options.id
2950
+ }), this.injectParams = (e) => Tn({
2951
+ select: e?.select,
2952
+ from: this.options.id
2953
+ }), this.injectLoaderDeps = (e) => Cn({
2954
+ ...e,
2955
+ from: this.options.id
2956
+ }), this.injectLoaderData = (e) => Sn({
2957
+ ...e,
2958
+ from: this.options.id
2959
+ }), this.injectNavigate = () => wn({ from: J().routesById[this.options.id].fullPath }), this.options = e;
2960
+ }
2961
+ };
2962
+ function Bn(e) {
2963
+ return (t) => new zn({
2964
+ id: e,
2965
+ ...t
2966
+ });
2967
+ }
2968
+ function Vn(e) {
2969
+ return typeof e == "object" ? new zn(e) : (t) => new zn({
2970
+ id: e,
2971
+ ...t
2972
+ });
2973
+ }
2974
+ //#endregion
2975
+ //#region src/renderer/injectRender.ts
2976
+ function Hn(e) {
2977
+ let t = p(c), r = p(o), i = [];
2978
+ f(() => {
2979
+ let n = e(), a = Un(n);
2980
+ if (Wn(i, a)) return;
2981
+ i.length > 0 && t.clear(), i = a;
2982
+ let s = n?.component;
2983
+ if (!s) return;
2984
+ let c = n.providers ?? [], l = o.create({
2985
+ providers: c,
2986
+ parent: r
2987
+ }), u = Object.entries(n.inputs ?? {}).map(([e, t]) => h(e, t));
2988
+ t.createComponent(s, {
2989
+ injector: l,
2990
+ bindings: u
2991
+ }).changeDetectorRef.markForCheck();
2992
+ }), p(n).onDestroy(() => {
2993
+ t.clear();
2994
+ });
2995
+ }
2996
+ function Un(e) {
2997
+ let t = e?.component;
2998
+ return !e || !t ? [] : [t, e.key];
2999
+ }
3000
+ function Wn(e, t) {
3001
+ if (e.length !== t.length) return !1;
3002
+ for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
3003
+ return !0;
3004
+ }
3005
+ //#endregion
3006
+ //#region src/DefaultNotFound.ts
3007
+ var Gn = class n {
3008
+ static {
3009
+ this.ɵfac = function(e) {
3010
+ return new (e || n)();
3011
+ };
3012
+ }
3013
+ static {
3014
+ this.ɵcmp = /* @__PURE__ */ e.ɵɵdefineComponent({
3015
+ type: n,
3016
+ selectors: [["tanstack-angular-router-default-no-found"]],
3017
+ hostAttrs: [
3018
+ 2,
3019
+ "display",
3020
+ "contents"
3021
+ ],
3022
+ decls: 2,
3023
+ vars: 0,
3024
+ template: function(t, n) {
3025
+ t & 1 && (e.ɵɵelementStart(0, "p"), e.ɵɵtext(1, "Not found"), e.ɵɵelementEnd());
3026
+ },
3027
+ encapsulation: 2,
3028
+ changeDetection: t.OnPush
3029
+ });
3030
+ }
3031
+ }, Kn = new e.InjectionToken("ERROR_STATE_INJECTOR_TOKEN");
3032
+ function qn() {
3033
+ let t = e.inject(Kn, { optional: !0 });
3034
+ if (!t) throw Error("injectErrorState was called outside of an error component");
3035
+ return t;
3036
+ }
3037
+ //#endregion
3038
+ //#region src/injectRouterState.ts
3039
+ function Jn(t) {
3040
+ let n = J({ warn: t?.router === void 0 }), r = Y((t?.router ?? n).stores.__store, (e) => e);
3041
+ return e.computed(() => t?.select ? t.select(r()) : r(), { equal: O });
3042
+ }
3043
+ //#endregion
3044
+ //#region src/renderer/injectIsCatchingError.ts
3045
+ function Yn({ matchId: t }) {
3046
+ let n = J(), r = Jn({ select: (e) => e.matches }), i = e.computed(() => r().findIndex((e) => e.id === t()));
3047
+ return e.computed(() => {
3048
+ if (n.options.defaultErrorComponent != null) return !1;
3049
+ let e = i();
3050
+ if (e === -1) return !1;
3051
+ let t = r();
3052
+ for (let r = e + 1; r < t.length; r++) {
3053
+ let e = t[r];
3054
+ if (n.routesById[e?.routeId].options.errorComponent != null) return !1;
3055
+ if (e?.status === "error") return !0;
3056
+ }
3057
+ return !1;
3058
+ });
3059
+ }
3060
+ //#endregion
3061
+ //#region src/Match.ts
3062
+ function Xn({ parentRouteIsRoot: e }) {
3063
+ let t = J({ warn: !1 }), r = p(i), a = p(n), o = Y(t.stores.resolvedLocation, (e) => e?.state.__TSR_key), s = Y(t.stores.loadedAt, (e) => e), c, u = 0;
3064
+ a.onDestroy(() => {
3065
+ u++;
3066
+ }), f(() => {
3067
+ if (!e()) return;
3068
+ o(), s();
3069
+ let n = ++u;
3070
+ l({ read: () => {
3071
+ if (n !== u || !e() || t.isServer) return;
3072
+ let r = t.latestLocation.href;
3073
+ c !== void 0 && c === r || (c = r, t.emit({
3074
+ type: "onRendered",
3075
+ ...K(t.stores.location.state, t.stores.resolvedLocation.state)
3076
+ }));
3077
+ } }, { injector: r });
3078
+ });
3079
+ }
3080
+ var Zn = class t {
3081
+ constructor() {
3082
+ this.matchId = m.required(), this.router = J(), this.match = d(() => {
3083
+ let e = this.matchId();
3084
+ return e ? this.router.stores.activeMatchStoresById.get(e)?.state : void 0;
3085
+ }), this.matchData = d(() => {
3086
+ let e = this.match();
3087
+ if (!e) return null;
3088
+ let t = e.routeId, n = this.router.routesById[t], r = n.parentRoute?.id ?? null, i = (n.options.remountDeps ?? this.router.options.defaultRemountDeps)?.({
3089
+ routeId: t,
3090
+ loaderDeps: e.loaderDeps,
3091
+ params: e._strictParams,
3092
+ search: e._strictSearch
3093
+ });
3094
+ return {
3095
+ key: i ? JSON.stringify(i) : void 0,
3096
+ route: n,
3097
+ match: e,
3098
+ parentRouteId: r
3099
+ };
3100
+ }), this.isFistRouteInRouteTree = d(() => this.matchData()?.parentRouteId === R), this.resolvedNoSsr = d(() => {
3101
+ let e = this.matchData()?.match;
3102
+ return e ? e.ssr === !1 || e.ssr === "data-only" : !0;
3103
+ }), this.shouldClientOnly = d(() => {
3104
+ let e = this.matchData()?.match;
3105
+ return e ? this.resolvedNoSsr() || !!e._displayPending : !0;
3106
+ }), this.parentRouteIdSignal = d(() => this.matchData()?.parentRouteId ?? ""), this.rootRouteIdSignal = d(() => R), this.hasPendingMatch = d(() => {
3107
+ let e = this.matchData()?.route.id;
3108
+ return e ? !!this.pendingRouteIds()[e] : !1;
3109
+ }), this.pendingRouteIds = Y(this.router.stores.pendingRouteIds, (e) => e), this.nearestMatchContext = {
3110
+ matchId: this.matchId,
3111
+ routeId: d(() => this.matchData()?.route.id),
3112
+ match: this.match,
3113
+ hasPending: this.hasPendingMatch
3114
+ }, this.isCatchingError = Yn({ matchId: this.matchId }), this.render = Hn(() => {
3115
+ let e = this.matchData();
3116
+ if (!e || this.shouldClientOnly() && this.router.isServer) return null;
3117
+ let { match: t, route: n } = e;
3118
+ if (t.status === "notFound") return { component: $n(this.router, n) };
3119
+ if (t.status === "error" || this.isCatchingError()) return {
3120
+ component: (Z(n.options.errorComponent) ?? Z(this.router.options.defaultErrorComponent)) || null,
3121
+ providers: [{
3122
+ provide: Kn,
3123
+ useValue: {
3124
+ error: t.error,
3125
+ reset: () => {
3126
+ this.router.invalidate();
3127
+ },
3128
+ info: { componentStack: "" }
3129
+ }
3130
+ }]
3131
+ };
3132
+ if (t.status === "redirected" || t.status === "pending") {
3133
+ let t = n.isRoot && (Z(n.options.component) ?? Z(this.router.options.defaultComponent));
3134
+ return t && t !== Qn ? {
3135
+ key: e.key,
3136
+ component: t,
3137
+ providers: [{
3138
+ provide: q,
3139
+ useValue: this.nearestMatchContext
3140
+ }]
3141
+ } : { component: Z(n.options.pendingComponent) ?? Z(this.router.options.defaultPendingComponent) };
3142
+ } else {
3143
+ let t = Z(n.options.component) ?? Z(this.router.options.defaultComponent) ?? Qn;
3144
+ return {
3145
+ key: e.key,
3146
+ component: t,
3147
+ providers: [{
3148
+ provide: q,
3149
+ useValue: this.nearestMatchContext
3150
+ }]
3151
+ };
3152
+ }
3153
+ }), this.onRendered = Xn({ parentRouteIsRoot: d(() => this.parentRouteIdSignal() === R) });
3154
+ }
3155
+ static {
3156
+ this.ɵfac = function(e) {
3157
+ return new (e || t)();
3158
+ };
3159
+ }
3160
+ static {
3161
+ this.ɵcmp = /* @__PURE__ */ e.ɵɵdefineComponent({
3162
+ type: t,
3163
+ selectors: [["router-match"], [
3164
+ "",
3165
+ "router-match",
3166
+ ""
3167
+ ]],
3168
+ hostVars: 1,
3169
+ hostBindings: function(t, n) {
3170
+ t & 2 && e.ɵɵattribute("data-matchId", n.matchId());
3171
+ },
3172
+ inputs: { matchId: [1, "matchId"] },
3173
+ decls: 0,
3174
+ vars: 0,
3175
+ template: function(e, t) {},
3176
+ encapsulation: 2
3177
+ });
3178
+ }
3179
+ }, Qn = class t {
3180
+ constructor() {
3181
+ this.router = J(), this.nearestMatch = p(q), this.currentMatch = d(() => {
3182
+ let e = this.nearestMatch.matchId();
3183
+ return e ? this.router.stores.activeMatchStoresById.get(e)?.state : void 0;
3184
+ }), this.routeId = d(() => this.currentMatch()?.routeId), this.route = d(() => this.router.routesById[this.routeId()]), this.parentGlobalNotFound = d(() => this.currentMatch()?.globalNotFound ?? !1), this.childMatchIdByRouteId = Y(this.router.stores.childMatchIdByRouteId, (e) => e), this.childMatchId = d(() => {
3185
+ let e = this.routeId();
3186
+ return e ? this.childMatchIdByRouteId()[e] ?? null : null;
3187
+ }), this.render = Hn(() => this.parentGlobalNotFound() ? { component: $n(this.router, this.route()) } : this.childMatchId() ? {
3188
+ component: Zn,
3189
+ inputs: { matchId: () => this.childMatchId() }
3190
+ } : null);
3191
+ }
3192
+ static {
3193
+ this.ɵfac = function(e) {
3194
+ return new (e || t)();
3195
+ };
3196
+ }
3197
+ static {
3198
+ this.ɵcmp = /* @__PURE__ */ e.ɵɵdefineComponent({
3199
+ type: t,
3200
+ selectors: [["outlet"], [
3201
+ "",
3202
+ "outlet",
3203
+ ""
3204
+ ]],
3205
+ decls: 0,
3206
+ vars: 0,
3207
+ template: function(e, t) {},
3208
+ encapsulation: 2
3209
+ });
3210
+ }
3211
+ };
3212
+ function Z(e) {
3213
+ return typeof e == "function" ? e() : e;
3214
+ }
3215
+ function $n(e, t) {
3216
+ return (Z(t.options.notFoundComponent) ?? Z(e.options.defaultNotFoundComponent)) || (g() && !t.options.notFoundComponent && console.warn(`A notFoundError was encountered on the route with ID "${t.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Page not found</p>)`), Gn);
3217
+ }
3218
+ //#endregion
3219
+ //#region ../router-core/dist/esm/scroll-restoration-script/client.js
3220
+ function er(e) {
3221
+ return null;
3222
+ }
3223
+ //#endregion
3224
+ //#region src/ssr-scroll-restoration.ts
3225
+ var tr = "data-tsr-scroll-restoration-inline";
3226
+ function nr() {
3227
+ let e = J(), t = p(b), n = p(i);
3228
+ e.isServer && l(() => {
3229
+ let n = e.options.scrollRestoration;
3230
+ if (!n || typeof n == "function" && !n({ location: e.latestLocation }) || t.querySelector(`script[${tr}]`)) return;
3231
+ let r = er(e);
3232
+ if (!r) return;
3233
+ let i = t.createElement("script");
3234
+ i.setAttribute(tr, ""), i.className = "$tsr", i.text = `${r};document.currentScript.remove()`;
3235
+ let a = e.options.ssr?.nonce;
3236
+ a && i.setAttribute("nonce", a), (t.head ?? t.body).appendChild(i);
3237
+ }, { injector: n });
3238
+ }
3239
+ //#endregion
3240
+ //#region src/transitioner.ts
3241
+ var rr = {
3242
+ router: null,
3243
+ mounted: !1
3244
+ };
3245
+ function ir() {
3246
+ let t = J(), n = e.inject(e.EnvironmentInjector);
3247
+ if (t.isServer) return;
3248
+ let r = e.inject(e.DestroyRef), i = !1, a = Y(t.stores.isLoading, (e) => e), o = Y(t.stores.isTransitioning, (e) => e), s = Y(t.stores.hasPendingMatches, (e) => e), c = Y(t.stores.status, (e) => e), l = Y(t.stores.location, (e) => e), u = Y(t.stores.resolvedLocation, (e) => e), d = e.computed(() => a() || o() || s()), f = e.computed(() => a() || s()), p = ar(() => a()), m = ar(() => d()), h = ar(() => f());
3249
+ t.startTransition = (r) => {
3250
+ t.stores.isTransitioning.setState(() => !0);
3251
+ let a = () => {
3252
+ i || e.afterNextRender({ read: () => {
3253
+ try {
3254
+ t.stores.isTransitioning.setState(() => !1);
3255
+ } catch {}
3256
+ } }, { injector: n });
3257
+ }, o = r();
3258
+ o instanceof Promise ? o.finally(() => a()) : a();
3259
+ };
3260
+ let g;
3261
+ e.afterNextRender(() => {
3262
+ g = t.history.subscribe(t.load);
3263
+ let e = t.buildLocation({
3264
+ to: t.latestLocation.pathname,
3265
+ search: !0,
3266
+ params: !0,
3267
+ hash: !0,
3268
+ state: !0,
3269
+ _includeValidateSearch: !0
3270
+ });
3271
+ I(t.latestLocation.href) !== I(e.href) && t.commitLocation({
3272
+ ...e,
3273
+ replace: !0
3274
+ });
3275
+ });
3276
+ let _ = e.signal(!1);
3277
+ e.afterNextRender(() => {
3278
+ _.set(!0), d() || c() === "pending" && (t.stores.status.setState(() => "idle"), t.stores.resolvedLocation.setState(() => l()));
3279
+ }), r.onDestroy(() => {
3280
+ _.set(!1), i = !0, g && g();
3281
+ }), e.afterNextRender(() => {
3282
+ typeof window < "u" && t.ssr || rr.router === t && rr.mounted || (rr = {
3283
+ router: t,
3284
+ mounted: !0
3285
+ }, (async () => {
3286
+ try {
3287
+ await t.load();
3288
+ } catch (e) {
3289
+ console.error(e);
3290
+ }
3291
+ })());
3292
+ }), e.effect(() => {
3293
+ if (_()) try {
3294
+ p() && !a() && t.emit({
3295
+ type: "onLoad",
3296
+ ...K(l(), u())
3297
+ });
3298
+ } catch {}
3299
+ }), e.effect(() => {
3300
+ if (_()) try {
3301
+ h() && !f() && t.emit({
3302
+ type: "onBeforeRouteMount",
3303
+ ...K(l(), u())
3304
+ });
3305
+ } catch {}
3306
+ }), e.effect(() => {
3307
+ if (_()) try {
3308
+ if (m() && !d() && c() === "pending" && (t.stores.status.setState(() => "idle"), t.stores.resolvedLocation.setState(() => l())), m() && !d()) {
3309
+ let e = K(l(), u());
3310
+ t.emit({
3311
+ type: "onResolved",
3312
+ ...e
3313
+ }), e.hrefChanged && dn(t);
3314
+ }
3315
+ } catch {}
3316
+ });
3317
+ }
3318
+ function ar(t) {
3319
+ let n = e.computed(t), r = null;
3320
+ return e.computed(() => {
3321
+ let e = r;
3322
+ return r = n(), e;
3323
+ });
3324
+ }
3325
+ //#endregion
3326
+ //#region src/Matches.ts
3327
+ var or = class t {
3328
+ constructor() {
3329
+ this.router = J(), this.matchId = Y(this.router.stores.firstMatchId, (e) => e), this.ssrScrollRestoration = nr(), this.transitioner = ir(), this.render = Hn(() => {
3330
+ let e = this.matchId();
3331
+ return e ? {
3332
+ component: Zn,
3333
+ inputs: { matchId: () => e }
3334
+ } : null;
3335
+ });
3336
+ }
3337
+ static {
3338
+ this.ɵfac = function(e) {
3339
+ return new (e || t)();
3340
+ };
3341
+ }
3342
+ static {
3343
+ this.ɵcmp = /* @__PURE__ */ e.ɵɵdefineComponent({
3344
+ type: t,
3345
+ selectors: [["router-matches"]],
3346
+ decls: 0,
3347
+ vars: 0,
3348
+ template: function(e, t) {},
3349
+ encapsulation: 2
3350
+ });
3351
+ }
3352
+ }, sr = new a("CONTEXT", {
3353
+ providedIn: "root",
3354
+ factory: () => ({})
3355
+ }), cr = new a("OPTIONS", {
3356
+ providedIn: "root",
3357
+ factory: () => ({})
3358
+ });
3359
+ function lr(e) {
3360
+ let t = p(i);
3361
+ return {
3362
+ inject: t.get.bind(t),
3363
+ ...e
3364
+ };
3365
+ }
3366
+ function ur({ router: e, context: t, options: n }) {
3367
+ return [
3368
+ {
3369
+ provide: bn(),
3370
+ useValue: e
3371
+ },
3372
+ {
3373
+ provide: sr,
3374
+ useFactory: () => lr(t ?? {})
3375
+ },
3376
+ {
3377
+ provide: cr,
3378
+ useValue: n ?? {}
3379
+ }
3380
+ ];
3381
+ }
3382
+ var dr = class t {
3383
+ constructor() {
3384
+ this.injectedContext = p(sr), this.injectedOptions = p(cr), this.injectedRouter = p(bn(), { optional: !0 }), this.context = m(this.injectedContext), this.options = m(this.injectedOptions), this.routerInput = m(void 0, { alias: "router" }), this.router = d(() => {
3385
+ let e = this.routerInput();
3386
+ if (e) return e;
3387
+ if (this.injectedRouter) return this.injectedRouter;
3388
+ throw Error("No router provided to <router-provider>. Provide a router with provideTanstackRouter or the router input");
3389
+ }), this.updateRouter = f(() => {
3390
+ let e = this.router(), t = this.context(), n = this.options();
3391
+ e.update({
3392
+ ...e.options,
3393
+ ...n,
3394
+ context: {
3395
+ ...e.options.context,
3396
+ ...t
3397
+ }
3398
+ });
3399
+ }), this.render = Hn(() => {
3400
+ let e = y(this.router);
3401
+ return {
3402
+ component: or,
3403
+ providers: [{
3404
+ provide: bn(),
3405
+ useValue: e
3406
+ }]
3407
+ };
3408
+ });
3409
+ }
3410
+ static {
3411
+ this.ɵfac = function(e) {
3412
+ return new (e || t)();
3413
+ };
3414
+ }
3415
+ static {
3416
+ this.ɵcmp = /* @__PURE__ */ e.ɵɵdefineComponent({
3417
+ type: t,
3418
+ selectors: [["router-provider"], [
3419
+ "",
3420
+ "router-provider",
3421
+ ""
3422
+ ]],
3423
+ inputs: {
3424
+ context: [1, "context"],
3425
+ options: [1, "options"],
3426
+ routerInput: [
3427
+ 1,
3428
+ "router",
3429
+ "routerInput"
3430
+ ]
3431
+ },
3432
+ decls: 0,
3433
+ vars: 0,
3434
+ template: function(e, t) {},
3435
+ encapsulation: 2
3436
+ });
3437
+ }
3438
+ }, Q = new e.InjectionToken("TANSTACK_DOCUMENT_ROUTER"), fr = "data-tsr-managed", pr = "data-tsr-id";
3439
+ //#endregion
3440
+ //#region src/document/managed-dom.ts
3441
+ function mr(e) {
3442
+ if (!e || e.tag === "title" || e.tag === "script" && !e.attrs?.src && typeof e.children != "string") return [];
3443
+ let t = {
3444
+ ...e,
3445
+ attrs: hr(e.attrs)
3446
+ };
3447
+ return [{
3448
+ ...t,
3449
+ id: _r(t)
3450
+ }];
3451
+ }
3452
+ function hr(e) {
3453
+ if (!e) return {};
3454
+ let t = {};
3455
+ for (let n of Object.keys(e).sort()) {
3456
+ let r = e[n];
3457
+ if (r == null || r === !1 || n === "suppressHydrationWarning") continue;
3458
+ let i = n === "className" ? "class" : n;
3459
+ t[i] = r;
3460
+ }
3461
+ return t;
3462
+ }
3463
+ function gr(e) {
3464
+ let t = /* @__PURE__ */ new Set();
3465
+ return e.filter((e) => t.has(e.id) ? !1 : (t.add(e.id), !0));
3466
+ }
3467
+ function _r(e) {
3468
+ let t = JSON.stringify(e), n = 2166136261;
3469
+ for (let e = 0; e < t.length; e++) n ^= t.charCodeAt(e), n = Math.imul(n, 16777619);
3470
+ return `tsr-${(n >>> 0).toString(36)}`;
3471
+ }
3472
+ function vr({ root: e, bucket: t, renderer: n }) {
3473
+ let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = [];
3474
+ return {
3475
+ mount(n = yr(e, t)) {
3476
+ r.clear(), i.clear(), a = [], n.forEach((e) => {
3477
+ let t = e.getAttribute(pr);
3478
+ t && (r.set(t, e), a.push(t));
3479
+ });
3480
+ },
3481
+ sync(o) {
3482
+ let s = o.map((e) => e.id);
3483
+ if (Er(a, s)) return;
3484
+ let c = new Map(o.map((e) => [e.id, {
3485
+ id: e.id,
3486
+ tag: e
3487
+ }]));
3488
+ for (let t of a) {
3489
+ if (c.has(t)) continue;
3490
+ let a = r.get(t);
3491
+ a && (Tr(a, e, n), r.delete(t), i.delete(t));
3492
+ }
3493
+ let l = e.firstChild;
3494
+ for (let a of o) {
3495
+ let o = r.get(a.id);
3496
+ o || (o = br(a, t, e.ownerDocument, n), r.set(a.id, o)), o !== l && wr(e, o, l, n), i.set(a.id, {
3497
+ id: a.id,
3498
+ tag: a
3499
+ }), l = o.nextSibling;
3500
+ }
3501
+ a = s;
3502
+ },
3503
+ destroy() {
3504
+ r.forEach((e) => {
3505
+ e.parentNode?.removeChild(e);
3506
+ }), r.clear(), i.clear(), a = [];
3507
+ }
3508
+ };
3509
+ }
3510
+ function yr(e, t) {
3511
+ return Array.from(e.querySelectorAll(`[${fr}="${t}"]`));
3512
+ }
3513
+ function br(e, t, n, r) {
3514
+ let i = xr(n, e.tag, r);
3515
+ Sr(i, fr, t, r), Sr(i, pr, e.id, r);
3516
+ for (let [t, n] of Object.entries(e.attrs ?? {})) t !== "suppressHydrationWarning" && (n == null || n === !1 || Sr(i, t === "className" ? "class" : t, typeof n == "boolean" ? "" : String(n), r));
3517
+ return "children" in e && typeof e.children == "string" && Cr(i, e.children, r), i;
3518
+ }
3519
+ function xr(e, t, n) {
3520
+ return n ? n.createElement(t) : e.createElement(t);
3521
+ }
3522
+ function Sr(e, t, n, r) {
3523
+ if (r) {
3524
+ r.setAttribute(e, t, n);
3525
+ return;
3526
+ }
3527
+ e.setAttribute(t, n);
3528
+ }
3529
+ function Cr(e, t, n) {
3530
+ if (n) {
3531
+ n.setProperty(e, "textContent", t);
3532
+ return;
3533
+ }
3534
+ e.textContent = t;
3535
+ }
3536
+ function wr(e, t, n, r) {
3537
+ if (!(t.parentNode === e && t.nextSibling === n)) {
3538
+ if (r) {
3539
+ r.insertBefore(e, t, n);
3540
+ return;
3541
+ }
3542
+ e.insertBefore(t, n);
3543
+ }
3544
+ }
3545
+ function Tr(e, t, n) {
3546
+ if (n) {
3547
+ n.removeChild(t, e);
3548
+ return;
3549
+ }
3550
+ t.removeChild(e);
3551
+ }
3552
+ function Er(e, t) {
3553
+ if (e.length !== t.length) return !1;
3554
+ for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
3555
+ return !0;
3556
+ }
3557
+ //#endregion
3558
+ //#region src/document/document-dehydration.ts
3559
+ function Dr(e) {
3560
+ return e.serverSsr ? gr(mr(e.serverSsr.takeBufferedScripts())) : [];
3561
+ }
3562
+ function Or(e, t) {
3563
+ return t.length === 0 ? e : {
3564
+ ...e,
3565
+ body: gr([...t, ...e.body])
3566
+ };
3567
+ }
3568
+ //#endregion
3569
+ //#region src/document/build-match-managed-document.ts
3570
+ function $(e) {
3571
+ let t = e.options.ssr?.nonce, n = e.stores.activeMatchesSnapshot.state, r = Ar(n), i = jr(n, t), a = Mr(n, t), o = Nr(e, n, t), s = Pr(e, n, t), c = Fr(n, t), l = Ir(n, t), u = Lr(n, t), d = Rr(e, n, t);
3572
+ return {
3573
+ title: r,
3574
+ head: gr([
3575
+ ...i,
3576
+ ...s,
3577
+ ...a,
3578
+ ...o,
3579
+ ...c,
3580
+ ...l
3581
+ ].flatMap((e) => mr(e))),
3582
+ body: gr([...u, ...d].flatMap((e) => mr(e)))
3583
+ };
3584
+ }
3585
+ function kr(e) {
3586
+ return Or($(e), Dr(e));
3587
+ }
3588
+ function Ar(e) {
3589
+ let t = zr(e);
3590
+ for (let e = t.length - 1; e >= 0; e--) {
3591
+ let n = t[e];
3592
+ for (let e = n.length - 1; e >= 0; e--) {
3593
+ let t = n[e];
3594
+ if (t?.title) return t.title;
3595
+ }
3596
+ }
3597
+ }
3598
+ function jr(e, t) {
3599
+ let n = zr(e), r = [], i = {};
3600
+ for (let e = n.length - 1; e >= 0; e--) {
3601
+ let a = n[e];
3602
+ for (let e = a.length - 1; e >= 0; e--) {
3603
+ let n = a[e];
3604
+ if (!n || n.title) continue;
3605
+ if ("script:ld+json" in n && n["script:ld+json"] !== void 0) {
3606
+ try {
3607
+ let e = JSON.stringify(n["script:ld+json"]);
3608
+ r.push({
3609
+ tag: "script",
3610
+ attrs: {
3611
+ type: "application/ld+json",
3612
+ nonce: t
3613
+ },
3614
+ children: fe(e)
3615
+ });
3616
+ } catch {}
3617
+ continue;
3618
+ }
3619
+ let o = n.name ?? n.property;
3620
+ if (o) {
3621
+ if (i[o]) continue;
3622
+ i[o] = !0;
3623
+ }
3624
+ r.push({
3625
+ tag: "meta",
3626
+ attrs: {
3627
+ ...n,
3628
+ nonce: t
3629
+ }
3630
+ });
3631
+ }
3632
+ }
3633
+ return t && r.push({
3634
+ tag: "meta",
3635
+ attrs: {
3636
+ property: "csp-nonce",
3637
+ content: t
3638
+ }
3639
+ }), r.reverse(), r;
3640
+ }
3641
+ function Mr(e, t) {
3642
+ return e.map((e) => e.links).filter(Boolean).flat(1).map((e) => ({
3643
+ tag: "link",
3644
+ attrs: {
3645
+ ...e,
3646
+ nonce: t
3647
+ }
3648
+ }));
3649
+ }
3650
+ function Nr(e, t, n) {
3651
+ return t.map((t) => e.ssr?.manifest?.routes[t.routeId]?.assets ?? []).filter(Boolean).flat(1).filter((e) => e.tag === "link").map((e) => ({
3652
+ tag: "link",
3653
+ attrs: {
3654
+ ...e.attrs,
3655
+ suppressHydrationWarning: !0,
3656
+ nonce: n
3657
+ }
3658
+ }));
3659
+ }
3660
+ function Pr(e, t, n) {
3661
+ let r = [];
3662
+ return t.map((t) => e.looseRoutesById[t.routeId]).forEach((t) => e.ssr?.manifest?.routes[t.id]?.preloads?.filter(Boolean).forEach((e) => {
3663
+ r.push({
3664
+ tag: "link",
3665
+ attrs: {
3666
+ rel: "modulepreload",
3667
+ href: e,
3668
+ nonce: n
3669
+ }
3670
+ });
3671
+ })), r;
3672
+ }
3673
+ function Fr(e, t) {
3674
+ return e.map((e) => e.styles).flat(1).filter(Boolean).map(({ children: e, ...n }) => ({
3675
+ tag: "style",
3676
+ attrs: {
3677
+ ...n,
3678
+ nonce: t
3679
+ },
3680
+ children: typeof e == "string" ? e : void 0
3681
+ }));
3682
+ }
3683
+ function Ir(e, t) {
3684
+ return e.map((e) => e.headScripts).flat(1).filter(Boolean).map(({ children: e, ...n }) => ({
3685
+ tag: "script",
3686
+ attrs: {
3687
+ ...n,
3688
+ nonce: t
3689
+ },
3690
+ children: typeof e == "string" ? e : void 0
3691
+ }));
3692
+ }
3693
+ function Lr(e, t) {
3694
+ return e.map((e) => e.scripts).flat(1).filter(Boolean).map(({ children: e, ...n }) => ({
3695
+ tag: "script",
3696
+ attrs: {
3697
+ ...n,
3698
+ suppressHydrationWarning: !0,
3699
+ nonce: t
3700
+ },
3701
+ children: typeof e == "string" ? e : void 0
3702
+ }));
3703
+ }
3704
+ function Rr(e, t, n) {
3705
+ return t.map((t) => e.looseRoutesById[t.routeId]).flatMap((t) => e.ssr?.manifest?.routes[t.id]?.assets?.filter((e) => e.tag === "script").map((e) => ({
3706
+ tag: "script",
3707
+ attrs: {
3708
+ ...e.attrs,
3709
+ nonce: n
3710
+ },
3711
+ children: e.children
3712
+ })) ?? []);
3713
+ }
3714
+ function zr(e) {
3715
+ return e.reduce((e, t) => (t.meta && e.push(t.meta), e), []);
3716
+ }
3717
+ //#endregion
3718
+ //#region src/document/document-equality.ts
3719
+ function Br(e, t) {
3720
+ return e.title === t.title && Vr(e.head, t.head) && Vr(e.body, t.body);
3721
+ }
3722
+ function Vr(e, t) {
3723
+ if (e.length !== t.length) return !1;
3724
+ for (let n = 0; n < e.length; n++) if (e[n]?.id !== t[n]?.id) return !1;
3725
+ return !0;
3726
+ }
3727
+ //#endregion
3728
+ //#region src/document/install-unified-document-sync.ts
3729
+ function Hr({ document: e, initialTitle: t, headCollection: n, bodyCollection: r, nextContent: i }) {
3730
+ i.title === void 0 ? e.title = t : e.title = i.title, n.sync(i.head), r.sync(i.body);
3731
+ }
3732
+ function Ur(t) {
3733
+ let n = e.inject(b), r = e.inject(e.RendererFactory2, { optional: !0 }), i = e.inject(e.DestroyRef), a = Y(t.stores.activeMatchesSnapshot, (e) => e), o = r?.createRenderer(null, null) ?? null, s = n.title, c = vr({
3734
+ root: n.head,
3735
+ bucket: "head",
3736
+ renderer: o
3737
+ }), l = vr({
3738
+ root: n.body,
3739
+ bucket: "body",
3740
+ renderer: o
3741
+ }), u = Dr(t), d = () => Or($(t), u);
3742
+ c.mount(), l.mount();
3743
+ let f = d();
3744
+ Hr({
3745
+ document: n,
3746
+ initialTitle: s,
3747
+ headCollection: c,
3748
+ bodyCollection: l,
3749
+ nextContent: f
3750
+ });
3751
+ let p = e.effect(() => {
3752
+ a();
3753
+ let e = d();
3754
+ Br(f, e) || (f = e, Hr({
3755
+ document: n,
3756
+ initialTitle: s,
3757
+ headCollection: c,
3758
+ bodyCollection: l,
3759
+ nextContent: e
3760
+ }));
3761
+ });
3762
+ i.onDestroy(() => {
3763
+ p.destroy(), c.destroy(), l.destroy(), n.title = s;
3764
+ });
3765
+ }
3766
+ //#endregion
3767
+ //#region src/document/provide-tanstack-body-managed-tags.ts
3768
+ function Wr(t) {
3769
+ let n = e.inject(b), r = e.inject(e.RendererFactory2, { optional: !0 }), i = e.inject(e.DestroyRef), a = Y(t.stores.activeMatchesSnapshot, (e) => e), o = Dr(t), s = () => o.length === 0 ? $(t).body : gr([...o, ...$(t).body]), c = r?.createRenderer(null, null) ?? null, l = vr({
3770
+ root: n.body,
3771
+ bucket: "body",
3772
+ renderer: c
3773
+ });
3774
+ l.mount();
3775
+ let u = s();
3776
+ l.sync(u);
3777
+ let d = e.effect(() => {
3778
+ a();
3779
+ let e = s();
3780
+ Vr(u, e) || (u = e, l.sync(e));
3781
+ });
3782
+ i.onDestroy(() => {
3783
+ d.destroy(), l.destroy();
3784
+ });
3785
+ }
3786
+ function Gr() {
3787
+ Wr(e.inject(Q));
3788
+ }
3789
+ function Kr(t) {
3790
+ return e.makeEnvironmentProviders([{
3791
+ provide: Q,
3792
+ useValue: t
3793
+ }, e.provideEnvironmentInitializer(Gr)]);
3794
+ }
3795
+ //#endregion
3796
+ //#region src/document/provide-tanstack-document-title.ts
3797
+ function qr(t) {
3798
+ let n = e.inject(b), r = e.inject(e.DestroyRef), i = Y(t.stores.activeMatchesSnapshot, (e) => e), a = n.title, o = $(t).title, s = (e) => {
3799
+ e === void 0 ? n.title = a : n.title = e;
3800
+ };
3801
+ s(o);
3802
+ let c = e.effect(() => {
3803
+ i();
3804
+ let e = $(t).title;
3805
+ e !== o && (o = e, s(e));
3806
+ });
3807
+ r.onDestroy(() => {
3808
+ c.destroy(), n.title = a;
3809
+ });
3810
+ }
3811
+ function Jr() {
3812
+ qr(e.inject(Q));
3813
+ }
3814
+ function Yr(t) {
3815
+ return e.makeEnvironmentProviders([{
3816
+ provide: Q,
3817
+ useValue: t
3818
+ }, e.provideEnvironmentInitializer(Jr)]);
3819
+ }
3820
+ //#endregion
3821
+ //#region src/document/provide-tanstack-head-managed-tags.ts
3822
+ function Xr(t) {
3823
+ let n = e.inject(b), r = e.inject(e.RendererFactory2, { optional: !0 }), i = e.inject(e.DestroyRef), a = Y(t.stores.activeMatchesSnapshot, (e) => e), o = r?.createRenderer(null, null) ?? null, s = vr({
3824
+ root: n.head,
3825
+ bucket: "head",
3826
+ renderer: o
3827
+ });
3828
+ s.mount();
3829
+ let c = $(t).head;
3830
+ s.sync(c);
3831
+ let l = e.effect(() => {
3832
+ a();
3833
+ let e = $(t).head;
3834
+ Vr(c, e) || (c = e, s.sync(e));
3835
+ });
3836
+ i.onDestroy(() => {
3837
+ l.destroy(), s.destroy();
3838
+ });
3839
+ }
3840
+ function Zr() {
3841
+ Xr(e.inject(Q));
3842
+ }
3843
+ function Qr(t) {
3844
+ return e.makeEnvironmentProviders([{
3845
+ provide: Q,
3846
+ useValue: t
3847
+ }, e.provideEnvironmentInitializer(Zr)]);
3848
+ }
3849
+ //#endregion
3850
+ //#region src/document/provide-tanstack-document.ts
3851
+ var $r = {
3852
+ title: !0,
3853
+ headTags: !0,
3854
+ bodyScripts: !0
3855
+ };
3856
+ function ei(t, n = {}) {
3857
+ let r = {
3858
+ ...$r,
3859
+ ...n
3860
+ }, i = r.title && r.headTags && r.bodyScripts;
3861
+ return e.makeEnvironmentProviders([{
3862
+ provide: Q,
3863
+ useValue: t
3864
+ }, e.provideEnvironmentInitializer(() => {
3865
+ if (i) {
3866
+ Ur(t);
3867
+ return;
3868
+ }
3869
+ r.title && qr(t), r.headTags && Xr(t), r.bodyScripts && Wr(t);
3870
+ })]);
3871
+ }
3872
+ function ti(e) {
3873
+ return ei(e);
3874
+ }
3875
+ //#endregion
3876
+ //#region src/injectMatches.ts
3877
+ function ni(t) {
3878
+ let n = Y(J().stores.activeMatchesSnapshot, (e) => e);
3879
+ return e.computed(() => {
3880
+ let e = n();
3881
+ return t?.select ? t.select(e) : e;
3882
+ }, { equal: O });
3883
+ }
3884
+ function ri(t) {
3885
+ let n = e.inject(q);
3886
+ return ni({ select: (e) => {
3887
+ let r = e.slice(0, e.findIndex((e) => e.id === n.matchId()));
3888
+ return t?.select ? t.select(r) : r;
3889
+ } });
3890
+ }
3891
+ function ii(t) {
3892
+ let n = e.inject(q);
3893
+ return ni({ select: (e) => {
3894
+ let r = e.slice(e.findIndex((e) => e.id === n.matchId()) + 1);
3895
+ return t?.select ? t.select(r) : r;
3896
+ } });
3897
+ }
3898
+ //#endregion
3899
+ //#region src/injectMatchRoute.ts
3900
+ function ai() {
3901
+ let t = J(), n = Y(t.stores.matchRouteReactivity, (e) => e);
3902
+ return (r) => e.computed(() => {
3903
+ n();
3904
+ let { pending: e, caseSensitive: i, fuzzy: a, includeSearch: o, ...s } = r;
3905
+ return t.matchRoute(s, {
3906
+ pending: e,
3907
+ caseSensitive: i,
3908
+ fuzzy: a,
3909
+ includeSearch: o
3910
+ });
3911
+ });
3912
+ }
3913
+ //#endregion
3914
+ //#region src/injectLocation.ts
3915
+ function oi(e) {
3916
+ return Y(J().stores.location, (t) => e?.select ? e.select(t) : t, { equal: O });
3917
+ }
3918
+ //#endregion
3919
+ //#region src/injectBlocker.ts
3920
+ function si(t) {
3921
+ let { shouldBlockFn: n, enableBeforeUnload: r = !0, disabled: i = !1, withResolver: a = !1 } = t, o = J(), { history: s } = o, c = e.signal({
3922
+ status: "idle",
3923
+ current: void 0,
3924
+ next: void 0,
3925
+ action: void 0,
3926
+ proceed: void 0,
3927
+ reset: void 0
3928
+ });
3929
+ return e.effect((e) => {
3930
+ let t = (typeof i == "function" ? i() : i) ? void 0 : s.block({
3931
+ blockerFn: async (e) => {
3932
+ function t(e) {
3933
+ let t = o.parseLocation(e), n = o.getMatchedRoutes(t.pathname);
3934
+ return n.foundRoute === void 0 ? {
3935
+ routeId: "__notFound__",
3936
+ fullPath: t.pathname,
3937
+ pathname: t.pathname,
3938
+ params: n.routeParams,
3939
+ search: t.search
3940
+ } : {
3941
+ routeId: n.foundRoute.id,
3942
+ fullPath: n.foundRoute.fullPath,
3943
+ pathname: t.pathname,
3944
+ params: n.routeParams,
3945
+ search: t.search
3946
+ };
3947
+ }
3948
+ let r = t(e.currentLocation), i = t(e.nextLocation);
3949
+ if (r.routeId === "__notFound__" && i.routeId !== "__notFound__") return !1;
3950
+ let s = await n({
3951
+ action: e.action,
3952
+ current: r,
3953
+ next: i
3954
+ });
3955
+ if (!a) return s;
3956
+ if (!s) return !1;
3957
+ let l = await new Promise((t) => {
3958
+ c.set({
3959
+ status: "blocked",
3960
+ current: r,
3961
+ next: i,
3962
+ action: e.action,
3963
+ proceed: () => t(!1),
3964
+ reset: () => t(!0)
3965
+ });
3966
+ });
3967
+ return c.set({
3968
+ status: "idle",
3969
+ current: void 0,
3970
+ next: void 0,
3971
+ action: void 0,
3972
+ proceed: void 0,
3973
+ reset: void 0
3974
+ }), l;
3975
+ },
3976
+ enableBeforeUnload: r
3977
+ });
3978
+ e(() => t?.());
3979
+ }), c.asReadonly();
3980
+ }
3981
+ //#endregion
3982
+ //#region src/injectCanGoBack.ts
3983
+ function ci() {
3984
+ return Y(J().stores.location, (e) => e.state.__TSR_index !== 0);
3985
+ }
3986
+ //#endregion
3987
+ //#region src/injectIntersectionObserver.ts
3988
+ function li(t, n, r) {
3989
+ let i = e.inject(e.ElementRef);
3990
+ e.afterRenderEffect((e) => {
3991
+ let a = typeof IntersectionObserver == "function", o = i.nativeElement;
3992
+ if (!o || !a || r()) return;
3993
+ let s = new IntersectionObserver(([e]) => t(e), n);
3994
+ s.observe(o), e(() => {
3995
+ s.disconnect();
3996
+ });
3997
+ });
3998
+ }
3999
+ //#endregion
4000
+ //#region src/Link.ts
4001
+ var ui = class t {
4002
+ constructor() {
4003
+ this.passiveEvents = fi(() => ({ touchstart: this.handleTouchStart })), this.options = m.required({ alias: "link" }), this.router = J(), this.isTransitioning = v(!1), this.from = d(() => y(() => this.options().from)), this.disabled = d(() => this._options().disabled ?? !1), this.target = d(() => this._options().target), this._options = d(() => ({
4004
+ ...this.options(),
4005
+ from: this.from()
4006
+ })), this.nextLocation = d(() => {
4007
+ let e = this.location();
4008
+ return this.router.buildLocation({
4009
+ _fromLocation: e,
4010
+ ...this._options()
4011
+ });
4012
+ }), this.hrefOption = d(() => {
4013
+ if (this._options().disabled) return;
4014
+ let e = this.nextLocation().maskedLocation ?? this.nextLocation(), t = e.external;
4015
+ return {
4016
+ href: t ? e.publicHref : this.router.history.createHref(e.publicHref) || "/",
4017
+ external: t
4018
+ };
4019
+ }), this.externalLink = d(() => {
4020
+ let e = this.hrefOption();
4021
+ if (e?.external) return e.href;
4022
+ try {
4023
+ return new URL(this.options().to), this.options().to;
4024
+ } catch {}
4025
+ }), this.preload = d(() => this.options().reloadDocument ? !1 : this.options().preload ?? this.router.options.defaultPreload), this.preloadDelay = d(() => this.options().preloadDelay ?? this.router.options.defaultPreloadDelay ?? 0), this.location = oi(), this.isActiveProps = d(() => {
4026
+ let e = this.options(), t = this.isActive() ? e.activeProps : e.inactiveProps;
4027
+ if (!(!t || typeof t != "object")) return t;
4028
+ }), this.isActive = d(() => {
4029
+ if (this.externalLink()) return !1;
4030
+ let e = this.options().activeOptions;
4031
+ if (e?.exact) {
4032
+ if (!Be(this.location().pathname, this.nextLocation().pathname, this.router.basepath)) return !1;
4033
+ } else {
4034
+ let e = ze(this.location().pathname, this.router.basepath), t = ze(this.nextLocation().pathname, this.router.basepath);
4035
+ if (!(e.startsWith(t) && (e.length === t.length || e[t.length] === "/"))) return !1;
4036
+ }
4037
+ return (e?.includeSearch ?? !0) && !O(this.location().search, this.nextLocation().search, {
4038
+ partial: !e?.exact,
4039
+ ignoreUndefined: !e?.explicitUndefined
4040
+ }) ? !1 : e?.includeHash ? this.location().hash === this.nextLocation().hash : !0;
4041
+ }), this.doPreload = () => {
4042
+ this.router.preloadRoute(this.options()).catch((e) => {
4043
+ console.warn(e), console.warn(an);
4044
+ });
4045
+ }, this.preloadViewportIoCallback = (e) => {
4046
+ e?.isIntersecting && this.doPreload();
4047
+ }, this.viewportPreloader = li(this.preloadViewportIoCallback, { rootMargin: "100px" }, () => !!this._options().disabled || this.preload() !== "viewport"), this.hasRenderFetched = !1, this.rendererPreloader = f(() => {
4048
+ this.hasRenderFetched || !this._options().disabled && this.preload() === "render" && (this.doPreload(), this.hasRenderFetched = !0);
4049
+ }), this.handleClick = (e) => {
4050
+ let t = e.currentTarget.getAttribute("target"), n = this._options().target, r = n === void 0 ? t : n;
4051
+ if (!this._options().disabled && !di(e) && !e.defaultPrevented && (!r || r === "_self") && e.button === 0) {
4052
+ e.preventDefault(), this.isTransitioning.set(!0);
4053
+ let t = this.router.subscribe("onResolved", () => {
4054
+ t(), this.isTransitioning.set(!1);
4055
+ });
4056
+ this.router.navigate(this._options());
4057
+ }
4058
+ }, this.handleFocus = () => {
4059
+ this._options().disabled || this.preload() && this.doPreload();
4060
+ }, this.handleTouchStart = () => {
4061
+ this._options().disabled || this.preload() && this.doPreload();
4062
+ }, this.handleEnter = (e) => {
4063
+ if (this._options().disabled) return;
4064
+ let t = e.currentTarget || {};
4065
+ if (this.preload()) {
4066
+ if (t.preloadTimeout) return;
4067
+ t.preloadTimeout = setTimeout(() => {
4068
+ t.preloadTimeout = null, this.doPreload();
4069
+ }, this.preloadDelay());
4070
+ }
4071
+ }, this.handleLeave = (e) => {
4072
+ if (this._options().disabled) return;
4073
+ let t = e.currentTarget || {};
4074
+ t.preloadTimeout &&= (clearTimeout(t.preloadTimeout), null);
4075
+ };
4076
+ }
4077
+ static {
4078
+ this.ɵfac = function(e) {
4079
+ return new (e || t)();
4080
+ };
4081
+ }
4082
+ static {
4083
+ this.ɵdir = /* @__PURE__ */ e.ɵɵdefineDirective({
4084
+ type: t,
4085
+ selectors: [[
4086
+ "a",
4087
+ "link",
4088
+ ""
4089
+ ]],
4090
+ hostVars: 11,
4091
+ hostBindings: function(t, n) {
4092
+ if (t & 1 && e.ɵɵlistener("click", function(e) {
4093
+ return n.handleClick(e);
4094
+ })("focus", function() {
4095
+ return n.handleFocus();
4096
+ })("mouseenter", function(e) {
4097
+ return n.handleEnter(e);
4098
+ })("mouseover", function(e) {
4099
+ return n.handleEnter(e);
4100
+ })("mouseleave", function(e) {
4101
+ return n.handleLeave(e);
4102
+ }), t & 2) {
4103
+ let t, r, i;
4104
+ e.ɵɵdomProperty("href", (t = n.hrefOption()) == null ? null : t.href), e.ɵɵattribute("target", n.target())("role", n.disabled() ? "link" : void 0)("aria-disabled", n.disabled())("data-status", n.isActive() ? "active" : void 0)("aria-current", n.isActive() ? "page" : void 0)("data-transitioning", n.isTransitioning() ? "transitioning" : void 0), e.ɵɵstyleMap((r = n.isActiveProps()) == null ? null : r.style), e.ɵɵclassMap((i = n.isActiveProps()) == null ? null : i.class);
4105
+ }
4106
+ },
4107
+ inputs: { options: [
4108
+ 1,
4109
+ "link",
4110
+ "options"
4111
+ ] },
4112
+ exportAs: ["link"]
4113
+ });
4114
+ }
4115
+ };
4116
+ function di(e) {
4117
+ return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
4118
+ }
4119
+ function fi(e) {
4120
+ let t = p(r).nativeElement, i = p(n), a = p(s), o = [];
4121
+ l(() => {
4122
+ for (let [n, r] of Object.entries(e())) {
4123
+ let e = a.listen(t, n, r, { passive: !0 });
4124
+ o.push(e);
4125
+ }
4126
+ }), i.onDestroy(() => {
4127
+ for (; o.length;) o.pop()?.();
4128
+ });
4129
+ }
4130
+ //#endregion
4131
+ export { zn as LazyRoute, ui as Link, or as Matches, Fn as NotFoundRoute, Qn as Outlet, Nn as RootRoute, An as Route, kn as RouteApi, Zn as RouteMatch, _n as Router, dr as RouterProvider, kr as buildManagedDocumentContent, $ as buildMatchManagedDocumentContent, Bt as createBrowserHistory, Ln as createFileRoute, Vt as createHashHistory, Rt as createHistory, Vn as createLazyFileRoute, Bn as createLazyRoute, Ht as createMemoryHistory, In as createRootRoute, Mn as createRootRouteWithContext, jn as createRoute, Pn as createRouteMask, gn as createRouter, ln as createRouterConfig, On as getRouteApi, si as injectBlocker, ci as injectCanGoBack, ii as injectChildMatches, qn as injectErrorState, Sn as injectLoaderData, Cn as injectLoaderDeps, oi as injectLocation, X as injectMatch, ai as injectMatchRoute, ni as injectMatches, wn as injectNavigate, Tn as injectParams, ri as injectParentMatches, En as injectRouteContext, J as injectRouter, Jn as injectRouterState, Dn as injectSearch, nr as injectSsrScrollRestorationScript, Y as injectStore, z as isRedirect, Xt as lazyFn, Ke as notFound, ti as provideHeadContent, Kr as provideTanstackBodyManagedTags, ei as provideTanstackDocument, Yr as provideTanstackDocumentTitle, Qr as provideTanstackHeadManagedTags, ur as provideTanstackRouter, ut as redirect, un as retainSearchParams };