@kitbag/router 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,52 +1,23 @@
1
- var Fe = Object.defineProperty;
2
- var Je = (t, e, n) => e in t ? Fe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var V = (t, e, n) => (Je(t, typeof e != "symbol" ? e + "" : e, n), n);
4
- import { inject as Et, defineComponent as ct, h as ft, toRefs as Qe, reactive as ae, ref as Ge, markRaw as lt, defineAsyncComponent as Ke, toRef as ze, computed as j, toValue as kt, watch as se, onUnmounted as ce, openBlock as ue, createElementBlock as Ye, normalizeClass as Xe, renderSlot as ie, normalizeProps as fe, guardReactiveProps as Ze, unref as ht, resolveComponent as tn, provide as en, mergeProps as nn, createBlock as rn, resolveDynamicComponent as on, createCommentVNode as an } from "vue";
5
- class sn extends Error {
6
- /**
7
- * Constructs a new DuplicateParamsError instance with a message indicating the problematic parameter.
8
- * @param paramName - The name of the parameter that was duplicated.
9
- */
10
- constructor(e) {
11
- super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`);
12
- }
13
- }
14
- class Ht extends Error {
1
+ var Ye = Object.defineProperty;
2
+ var Xe = (t, e, n) => e in t ? Ye(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var M = (t, e, n) => (Xe(t, typeof e != "symbol" ? e + "" : e, n), n);
4
+ import { defineComponent as ut, h as pt, ref as ie, inject as it, toRefs as Ze, reactive as $t, markRaw as dt, defineAsyncComponent as tn, watch as fe, toValue as ht, toRef as en, computed as V, onUnmounted as le, openBlock as he, createElementBlock as nn, normalizeClass as rn, renderSlot as pe, normalizeProps as de, guardReactiveProps as on, unref as ot, resolveComponent as an, provide as sn, mergeProps as cn, createBlock as un, resolveDynamicComponent as fn, createCommentVNode as ln } from "vue";
5
+ class St extends Error {
15
6
  constructor() {
16
7
  super("Router not installed");
17
8
  }
18
9
  }
19
- class cn extends Error {
20
- /**
21
- * Constructs a new UseRouteInvalidError instance with a message that specifies both the given and expected route names.
22
- * This detailed error message aids in quickly identifying and resolving mismatches in route usage.
23
- * @param routeName - The route name that was incorrectly used.
24
- * @param actualRouteName - The expected route name that should have been used.
25
- */
26
- constructor(e, n) {
27
- super(`useRoute called with incorrect route. Given ${e}, expected ${n}`);
28
- }
29
- }
30
- const le = Symbol();
31
- function Vt() {
32
- const t = Et(le);
33
- if (!t)
34
- throw new Ht();
35
- return t;
36
- }
37
- class X extends Error {
38
- }
39
- function ut(t) {
10
+ function ft(t) {
40
11
  return typeof t == "object" && t !== null && !Array.isArray(t);
41
12
  }
42
- function un(t) {
13
+ function hn(t) {
43
14
  return t.every((e) => Array.isArray(e));
44
15
  }
45
- function it(t) {
16
+ function lt(t) {
46
17
  return typeof t == "string" && t.length > 0;
47
18
  }
48
- function pt(t) {
49
- const e = it(t) ? t.replace(/^#/, "") : void 0;
19
+ function mt(t) {
20
+ const e = lt(t) ? t.replace(/^#/, "") : void 0;
50
21
  function n() {
51
22
  return e !== void 0;
52
23
  }
@@ -59,38 +30,47 @@ function pt(t) {
59
30
  toString: r
60
31
  };
61
32
  }
62
- function fn(t, e) {
63
- return pt(`${t.value ?? ""}${e.value ?? ""}`);
33
+ function pn(t, e) {
34
+ return mt(`${t.value ?? ""}${e.value ?? ""}`);
64
35
  }
65
- class ln extends Error {
36
+ class dn extends Error {
66
37
  constructor(e) {
67
38
  super(`Child property on meta for ${e} conflicts with the parent meta.`);
68
39
  }
69
40
  }
70
- function hn(t, e) {
71
- return pn(t, e), { ...t, ...e };
41
+ function mn(t, e) {
42
+ return gn(t, e), { ...t, ...e };
72
43
  }
73
- function pn(t, e) {
44
+ function gn(t, e) {
74
45
  const n = Object.keys(t).find((r) => r in e && typeof e[r] != typeof t[r]);
75
46
  if (n)
76
- throw new ln(n);
47
+ throw new dn(n);
48
+ }
49
+ class Rn extends Error {
50
+ /**
51
+ * Constructs a new DuplicateParamsError instance with a message indicating the problematic parameter.
52
+ * @param paramName - The name of the parameter that was duplicated.
53
+ */
54
+ constructor(e) {
55
+ super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`);
56
+ }
77
57
  }
78
58
  function Y(t) {
79
59
  return Array.isArray(t) ? t : [t];
80
60
  }
81
- function he(t, e) {
61
+ function me(t, e) {
82
62
  return t.filter((n) => e === n).length;
83
63
  }
84
64
  function et(...t) {
85
- const e = t.flatMap((n) => Array.isArray(n) ? n : Object.keys(n).map(mn));
65
+ const e = t.flatMap((n) => Array.isArray(n) ? n : Object.keys(n).map(yn));
86
66
  for (const n of e)
87
- if (he(e, n) > 1)
88
- throw new sn(n);
67
+ if (me(e, n) > 1)
68
+ throw new Rn(n);
89
69
  }
90
- function mn(t) {
70
+ function yn(t) {
91
71
  return t.startsWith("?") ? t.slice(1) : t;
92
72
  }
93
- function dn(t, e) {
73
+ function vn(t, e) {
94
74
  et(t.params, e.params);
95
75
  const n = `${t.value}${e.value}`;
96
76
  return {
@@ -99,100 +79,102 @@ function dn(t, e) {
99
79
  toString: () => n
100
80
  };
101
81
  }
102
- function gn(t, e) {
82
+ function wn(t, e) {
103
83
  et(t.params, e.params);
104
- const n = [t.value, e.value].filter(it).join("&");
84
+ const n = [t.value, e.value].filter(lt).join("&");
105
85
  return {
106
86
  value: n,
107
87
  params: { ...t.params, ...e.params },
108
88
  toString: () => n
109
89
  };
110
90
  }
111
- function Rn(t, e) {
91
+ function Pn(t, e) {
112
92
  return et(t, e), { ...t, ...e };
113
93
  }
114
- function yn(t) {
94
+ function En(t) {
115
95
  return "host" in t && !!t.host;
116
96
  }
117
- function pe(t) {
97
+ function ge(t) {
118
98
  return "parent" in t && !!t.parent;
119
99
  }
120
- function Ut(t) {
100
+ function Ht(t) {
121
101
  return "component" in t && !!t.component;
122
102
  }
123
- function Ct(t) {
103
+ function Vt(t) {
124
104
  return "components" in t && !!t.components;
125
105
  }
126
- function vn(t) {
106
+ function Sn(t) {
127
107
  return "state" in t && !!t.state;
128
108
  }
129
- function me(t, e) {
109
+ function Re(t, e) {
130
110
  return {
131
111
  ...e,
132
- path: dn(t.path, e.path),
133
- query: gn(t.query, e.query),
134
- meta: hn(t.meta, e.meta),
135
- state: Rn(t.state, e.state),
136
- hash: fn(t.hash, e.hash),
112
+ path: vn(t.path, e.path),
113
+ query: wn(t.query, e.query),
114
+ meta: mn(t.meta, e.meta),
115
+ state: Pn(t.state, e.state),
116
+ hash: pn(t.hash, e.hash),
137
117
  matches: [...t.matches, e.matched],
138
118
  host: t.host,
139
119
  depth: t.depth + 1
140
120
  };
141
121
  }
142
- function de() {
122
+ function ye() {
143
123
  return typeof window < "u" && typeof window.document < "u";
144
124
  }
145
- function wn(t, e) {
146
- return ct({
125
+ function bn(t, e) {
126
+ return ut({
147
127
  name: "PropsWrapper",
148
128
  expose: [],
149
129
  setup() {
150
130
  const n = e();
151
- return "then" in n ? () => ft(En(t, n)) : () => ft(t, n);
131
+ return "then" in n ? () => pt(An(t, n)) : () => pt(t, n);
152
132
  }
153
133
  });
154
134
  }
155
- function En(t, e) {
156
- return ct({
135
+ function An(t, e) {
136
+ return ut({
157
137
  name: "AsyncPropsWrapper",
158
138
  expose: [],
159
- async setup() {
160
- const n = await e;
161
- return () => ft(t, n);
139
+ setup() {
140
+ const n = ie();
141
+ return (async () => n.value = await e)(), () => n.value ? pt(t, n.value) : "";
162
142
  }
163
143
  });
164
144
  }
145
+ class X extends Error {
146
+ }
165
147
  const T = "[", Q = "]";
166
- function Pn(t) {
148
+ function xn(t) {
167
149
  return t !== String && t !== Boolean && t !== Number && t !== Date;
168
150
  }
169
- function Sn(t) {
170
- return typeof t == "function" && Pn(t);
151
+ function kn(t) {
152
+ return typeof t == "function" && xn(t);
171
153
  }
172
- function Pt(t) {
154
+ function bt(t) {
173
155
  return typeof t == "object" && "get" in t && typeof t.get == "function" && "set" in t && typeof t.set == "function";
174
156
  }
175
- function bn(t) {
176
- return Pt(t) && t.defaultValue !== void 0;
157
+ function Bn(t) {
158
+ return bt(t) && t.defaultValue !== void 0;
177
159
  }
178
- function Mr(t, e) {
179
- return kn(t, e);
160
+ function Gr(t, e) {
161
+ return Un(t, e);
180
162
  }
181
- function An(t, e) {
163
+ function Ln(t, e) {
182
164
  return t[e] ?? String;
183
165
  }
184
- const $ = {
166
+ const H = {
185
167
  invalid: (t) => {
186
168
  throw new X(t);
187
169
  }
188
- }, xn = {
170
+ }, Nn = {
189
171
  get: (t) => t,
190
172
  set: (t, { invalid: e }) => {
191
173
  if (typeof t != "string")
192
174
  throw e();
193
175
  return t;
194
176
  }
195
- }, ge = {
177
+ }, ve = {
196
178
  get: (t, { invalid: e }) => {
197
179
  if (t === "true")
198
180
  return !0;
@@ -205,7 +187,7 @@ const $ = {
205
187
  throw e();
206
188
  return t.toString();
207
189
  }
208
- }, Re = {
190
+ }, we = {
209
191
  get: (t, { invalid: e }) => {
210
192
  const n = Number(t);
211
193
  if (isNaN(n))
@@ -217,7 +199,7 @@ const $ = {
217
199
  throw e();
218
200
  return t.toString();
219
201
  }
220
- }, ye = {
202
+ }, Pe = {
221
203
  get: (t, { invalid: e }) => {
222
204
  const n = new Date(t);
223
205
  if (isNaN(n.getTime()))
@@ -229,7 +211,7 @@ const $ = {
229
211
  throw e();
230
212
  return t.toISOString();
231
213
  }
232
- }, ve = {
214
+ }, Ee = {
233
215
  get: (t, { invalid: e }) => {
234
216
  try {
235
217
  return JSON.parse(t);
@@ -245,28 +227,28 @@ const $ = {
245
227
  }
246
228
  }
247
229
  };
248
- function ot(t, e, n = !1) {
249
- if (t === void 0 || !it(t)) {
250
- if (bn(e))
230
+ function at(t, e, n = !1) {
231
+ if (t === void 0 || !lt(t)) {
232
+ if (Bn(e))
251
233
  return e.defaultValue;
252
234
  if (n)
253
235
  return;
254
236
  throw new X();
255
237
  }
256
238
  if (e === String)
257
- return xn.get(t, $);
239
+ return Nn.get(t, H);
258
240
  if (e === Boolean)
259
- return ge.get(t, $);
241
+ return ve.get(t, H);
260
242
  if (e === Number)
261
- return Re.get(t, $);
243
+ return we.get(t, H);
262
244
  if (e === Date)
263
- return ye.get(t, $);
245
+ return Pe.get(t, H);
264
246
  if (e === JSON)
265
- return ve.get(t, $);
266
- if (Sn(e))
267
- return e(t, $);
268
- if (Pt(e))
269
- return e.get(t, $);
247
+ return Ee.get(t, H);
248
+ if (kn(e))
249
+ return e(t, H);
250
+ if (bt(e))
251
+ return e.get(t, H);
270
252
  if (e instanceof RegExp) {
271
253
  if (e.test(t))
272
254
  return t;
@@ -274,32 +256,32 @@ function ot(t, e, n = !1) {
274
256
  }
275
257
  return t;
276
258
  }
277
- function at(t, e, n = !1) {
259
+ function st(t, e, n = !1) {
278
260
  if (t === void 0) {
279
261
  if (n)
280
262
  return "";
281
263
  throw new X();
282
264
  }
283
265
  if (e === Boolean)
284
- return ge.set(t, $);
266
+ return ve.set(t, H);
285
267
  if (e === Number)
286
- return Re.set(t, $);
268
+ return we.set(t, H);
287
269
  if (e === Date)
288
- return ye.set(t, $);
270
+ return Pe.set(t, H);
289
271
  if (e === JSON)
290
- return ve.set(t, $);
291
- if (Pt(e))
292
- return e.set(t, $);
272
+ return Ee.set(t, H);
273
+ if (bt(e))
274
+ return e.set(t, H);
293
275
  try {
294
276
  return t.toString();
295
277
  } catch {
296
278
  throw new X();
297
279
  }
298
280
  }
299
- function kn(t, e) {
300
- return Pt(t) ? { ...t, defaultValue: e ?? t.defaultValue } : {
301
- get: (n) => ot(n, t),
302
- set: (n) => at(n, t),
281
+ function Un(t, e) {
282
+ return bt(t) ? { ...t, defaultValue: e ?? t.defaultValue } : {
283
+ get: (n) => at(n, t),
284
+ set: (n) => st(n, t),
303
285
  defaultValue: e
304
286
  };
305
287
  }
@@ -331,36 +313,36 @@ function G(t, e) {
331
313
  }
332
314
  }
333
315
  }
334
- var mt = "beforeunload", Bn = "hashchange", we = "popstate";
335
- function Qt(t) {
316
+ var gt = "beforeunload", Cn = "hashchange", Se = "popstate";
317
+ function Yt(t) {
336
318
  t === void 0 && (t = {});
337
319
  var e = t, n = e.window, r = n === void 0 ? document.defaultView : n, o = r.history;
338
320
  function a() {
339
- var d = r.location, f = d.pathname, p = d.search, w = d.hash, E = o.state || {};
340
- return [E.idx, Z({
341
- pathname: f,
342
- search: p,
321
+ var m = r.location, l = m.pathname, d = m.search, w = m.hash, P = o.state || {};
322
+ return [P.idx, Z({
323
+ pathname: l,
324
+ search: d,
343
325
  hash: w,
344
- state: E.usr || null,
345
- key: E.key || "default"
326
+ state: P.usr || null,
327
+ key: P.key || "default"
346
328
  })];
347
329
  }
348
330
  var s = null;
349
- function c() {
331
+ function u() {
350
332
  if (s)
351
- m.call(s), s = null;
333
+ p.call(s), s = null;
352
334
  else {
353
- var d = U.Pop, f = a(), p = f[0], w = f[1];
354
- if (m.length)
355
- if (p != null) {
356
- var E = h - p;
357
- E && (s = {
358
- action: d,
335
+ var m = U.Pop, l = a(), d = l[0], w = l[1];
336
+ if (p.length)
337
+ if (d != null) {
338
+ var P = i - d;
339
+ P && (s = {
340
+ action: m,
359
341
  location: w,
360
342
  retry: function() {
361
- S(E * -1);
343
+ b(P * -1);
362
344
  }
363
- }, S(E));
345
+ }, b(P));
364
346
  } else
365
347
  process.env.NODE_ENV !== "production" && G(
366
348
  !1,
@@ -370,135 +352,135 @@ function Qt(t) {
370
352
  "You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
371
353
  );
372
354
  else
373
- O(d);
355
+ j(m);
374
356
  }
375
357
  }
376
- r.addEventListener(we, c);
377
- var u = U.Pop, l = a(), h = l[0], i = l[1], v = tt(), m = tt();
378
- h == null && (h = 0, o.replaceState(F({}, o.state, {
379
- idx: h
358
+ r.addEventListener(Se, u);
359
+ var c = U.Pop, f = a(), i = f[0], h = f[1], y = tt(), p = tt();
360
+ i == null && (i = 0, o.replaceState(F({}, o.state, {
361
+ idx: i
380
362
  }), ""));
381
- function A(d) {
382
- return typeof d == "string" ? d : K(d);
363
+ function S(m) {
364
+ return typeof m == "string" ? m : K(m);
383
365
  }
384
- function P(d, f) {
385
- return f === void 0 && (f = null), Z(F({
386
- pathname: i.pathname,
366
+ function E(m, l) {
367
+ return l === void 0 && (l = null), Z(F({
368
+ pathname: h.pathname,
387
369
  hash: "",
388
370
  search: ""
389
- }, typeof d == "string" ? st(d) : d, {
390
- state: f,
391
- key: gt()
371
+ }, typeof m == "string" ? ct(m) : m, {
372
+ state: l,
373
+ key: yt()
392
374
  }));
393
375
  }
394
- function k(d, f) {
376
+ function A(m, l) {
395
377
  return [{
396
- usr: d.state,
397
- key: d.key,
398
- idx: f
399
- }, A(d)];
400
- }
401
- function C(d, f, p) {
402
- return !m.length || (m.call({
403
- action: d,
404
- location: f,
405
- retry: p
378
+ usr: m.state,
379
+ key: m.key,
380
+ idx: l
381
+ }, S(m)];
382
+ }
383
+ function k(m, l, d) {
384
+ return !p.length || (p.call({
385
+ action: m,
386
+ location: l,
387
+ retry: d
406
388
  }), !1);
407
389
  }
408
- function O(d) {
409
- u = d;
410
- var f = a();
411
- h = f[0], i = f[1], v.call({
412
- action: u,
413
- location: i
390
+ function j(m) {
391
+ c = m;
392
+ var l = a();
393
+ i = l[0], h = l[1], y.call({
394
+ action: c,
395
+ location: h
414
396
  });
415
397
  }
416
- function g(d, f) {
417
- var p = U.Push, w = P(d, f);
418
- function E() {
419
- g(d, f);
398
+ function g(m, l) {
399
+ var d = U.Push, w = E(m, l);
400
+ function P() {
401
+ g(m, l);
420
402
  }
421
- if (C(p, w, E)) {
422
- var x = k(w, h + 1), L = x[0], N = x[1];
403
+ if (k(d, w, P)) {
404
+ var B = A(w, i + 1), N = B[0], $ = B[1];
423
405
  try {
424
- o.pushState(L, "", N);
406
+ o.pushState(N, "", $);
425
407
  } catch {
426
- r.location.assign(N);
408
+ r.location.assign($);
427
409
  }
428
- O(p);
410
+ j(d);
429
411
  }
430
412
  }
431
- function R(d, f) {
432
- var p = U.Replace, w = P(d, f);
433
- function E() {
434
- R(d, f);
413
+ function v(m, l) {
414
+ var d = U.Replace, w = E(m, l);
415
+ function P() {
416
+ v(m, l);
435
417
  }
436
- if (C(p, w, E)) {
437
- var x = k(w, h), L = x[0], N = x[1];
438
- o.replaceState(L, "", N), O(p);
418
+ if (k(d, w, P)) {
419
+ var B = A(w, i), N = B[0], $ = B[1];
420
+ o.replaceState(N, "", $), j(d);
439
421
  }
440
422
  }
441
- function S(d) {
442
- o.go(d);
423
+ function b(m) {
424
+ o.go(m);
443
425
  }
444
- var b = {
426
+ var x = {
445
427
  get action() {
446
- return u;
428
+ return c;
447
429
  },
448
430
  get location() {
449
- return i;
431
+ return h;
450
432
  },
451
- createHref: A,
433
+ createHref: S,
452
434
  push: g,
453
- replace: R,
454
- go: S,
435
+ replace: v,
436
+ go: b,
455
437
  back: function() {
456
- S(-1);
438
+ b(-1);
457
439
  },
458
440
  forward: function() {
459
- S(1);
441
+ b(1);
460
442
  },
461
- listen: function(f) {
462
- return v.push(f);
443
+ listen: function(l) {
444
+ return y.push(l);
463
445
  },
464
- block: function(f) {
465
- var p = m.push(f);
466
- return m.length === 1 && r.addEventListener(mt, dt), function() {
467
- p(), m.length || r.removeEventListener(mt, dt);
446
+ block: function(l) {
447
+ var d = p.push(l);
448
+ return p.length === 1 && r.addEventListener(gt, Rt), function() {
449
+ d(), p.length || r.removeEventListener(gt, Rt);
468
450
  };
469
451
  }
470
452
  };
471
- return b;
453
+ return x;
472
454
  }
473
- function Ln(t) {
455
+ function $n(t) {
474
456
  t === void 0 && (t = {});
475
457
  var e = t, n = e.window, r = n === void 0 ? document.defaultView : n, o = r.history;
476
458
  function a() {
477
- var f = st(r.location.hash.substr(1)), p = f.pathname, w = p === void 0 ? "/" : p, E = f.search, x = E === void 0 ? "" : E, L = f.hash, N = L === void 0 ? "" : L, H = o.state || {};
478
- return [H.idx, Z({
459
+ var l = ct(r.location.hash.substr(1)), d = l.pathname, w = d === void 0 ? "/" : d, P = l.search, B = P === void 0 ? "" : P, N = l.hash, $ = N === void 0 ? "" : N, C = o.state || {};
460
+ return [C.idx, Z({
479
461
  pathname: w,
480
- search: x,
481
- hash: N,
482
- state: H.usr || null,
483
- key: H.key || "default"
462
+ search: B,
463
+ hash: $,
464
+ state: C.usr || null,
465
+ key: C.key || "default"
484
466
  })];
485
467
  }
486
468
  var s = null;
487
- function c() {
469
+ function u() {
488
470
  if (s)
489
- m.call(s), s = null;
471
+ p.call(s), s = null;
490
472
  else {
491
- var f = U.Pop, p = a(), w = p[0], E = p[1];
492
- if (m.length)
473
+ var l = U.Pop, d = a(), w = d[0], P = d[1];
474
+ if (p.length)
493
475
  if (w != null) {
494
- var x = h - w;
495
- x && (s = {
496
- action: f,
497
- location: E,
476
+ var B = i - w;
477
+ B && (s = {
478
+ action: l,
479
+ location: P,
498
480
  retry: function() {
499
- b(x * -1);
481
+ x(B * -1);
500
482
  }
501
- }, b(x));
483
+ }, x(B));
502
484
  } else
503
485
  process.env.NODE_ENV !== "production" && G(
504
486
  !1,
@@ -508,209 +490,209 @@ function Ln(t) {
508
490
  "You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
509
491
  );
510
492
  else
511
- g(f);
493
+ g(l);
512
494
  }
513
495
  }
514
- r.addEventListener(we, c), r.addEventListener(Bn, function() {
515
- var f = a(), p = f[1];
516
- K(p) !== K(i) && c();
496
+ r.addEventListener(Se, u), r.addEventListener(Cn, function() {
497
+ var l = a(), d = l[1];
498
+ K(d) !== K(h) && u();
517
499
  });
518
- var u = U.Pop, l = a(), h = l[0], i = l[1], v = tt(), m = tt();
519
- h == null && (h = 0, o.replaceState(F({}, o.state, {
520
- idx: h
500
+ var c = U.Pop, f = a(), i = f[0], h = f[1], y = tt(), p = tt();
501
+ i == null && (i = 0, o.replaceState(F({}, o.state, {
502
+ idx: i
521
503
  }), ""));
522
- function A() {
523
- var f = document.querySelector("base"), p = "";
524
- if (f && f.getAttribute("href")) {
525
- var w = r.location.href, E = w.indexOf("#");
526
- p = E === -1 ? w : w.slice(0, E);
504
+ function S() {
505
+ var l = document.querySelector("base"), d = "";
506
+ if (l && l.getAttribute("href")) {
507
+ var w = r.location.href, P = w.indexOf("#");
508
+ d = P === -1 ? w : w.slice(0, P);
527
509
  }
528
- return p;
510
+ return d;
529
511
  }
530
- function P(f) {
531
- return A() + "#" + (typeof f == "string" ? f : K(f));
512
+ function E(l) {
513
+ return S() + "#" + (typeof l == "string" ? l : K(l));
532
514
  }
533
- function k(f, p) {
534
- return p === void 0 && (p = null), Z(F({
535
- pathname: i.pathname,
515
+ function A(l, d) {
516
+ return d === void 0 && (d = null), Z(F({
517
+ pathname: h.pathname,
536
518
  hash: "",
537
519
  search: ""
538
- }, typeof f == "string" ? st(f) : f, {
539
- state: p,
540
- key: gt()
520
+ }, typeof l == "string" ? ct(l) : l, {
521
+ state: d,
522
+ key: yt()
541
523
  }));
542
524
  }
543
- function C(f, p) {
525
+ function k(l, d) {
544
526
  return [{
545
- usr: f.state,
546
- key: f.key,
547
- idx: p
548
- }, P(f)];
549
- }
550
- function O(f, p, w) {
551
- return !m.length || (m.call({
552
- action: f,
553
- location: p,
527
+ usr: l.state,
528
+ key: l.key,
529
+ idx: d
530
+ }, E(l)];
531
+ }
532
+ function j(l, d, w) {
533
+ return !p.length || (p.call({
534
+ action: l,
535
+ location: d,
554
536
  retry: w
555
537
  }), !1);
556
538
  }
557
- function g(f) {
558
- u = f;
559
- var p = a();
560
- h = p[0], i = p[1], v.call({
561
- action: u,
562
- location: i
539
+ function g(l) {
540
+ c = l;
541
+ var d = a();
542
+ i = d[0], h = d[1], y.call({
543
+ action: c,
544
+ location: h
563
545
  });
564
546
  }
565
- function R(f, p) {
566
- var w = U.Push, E = k(f, p);
567
- function x() {
568
- R(f, p);
547
+ function v(l, d) {
548
+ var w = U.Push, P = A(l, d);
549
+ function B() {
550
+ v(l, d);
569
551
  }
570
- if (process.env.NODE_ENV !== "production" && G(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(f) + ")"), O(w, E, x)) {
571
- var L = C(E, h + 1), N = L[0], H = L[1];
552
+ if (process.env.NODE_ENV !== "production" && G(P.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(l) + ")"), j(w, P, B)) {
553
+ var N = k(P, i + 1), $ = N[0], C = N[1];
572
554
  try {
573
- o.pushState(N, "", H);
555
+ o.pushState($, "", C);
574
556
  } catch {
575
- r.location.assign(H);
557
+ r.location.assign(C);
576
558
  }
577
559
  g(w);
578
560
  }
579
561
  }
580
- function S(f, p) {
581
- var w = U.Replace, E = k(f, p);
582
- function x() {
583
- S(f, p);
562
+ function b(l, d) {
563
+ var w = U.Replace, P = A(l, d);
564
+ function B() {
565
+ b(l, d);
584
566
  }
585
- if (process.env.NODE_ENV !== "production" && G(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(f) + ")"), O(w, E, x)) {
586
- var L = C(E, h), N = L[0], H = L[1];
587
- o.replaceState(N, "", H), g(w);
567
+ if (process.env.NODE_ENV !== "production" && G(P.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(l) + ")"), j(w, P, B)) {
568
+ var N = k(P, i), $ = N[0], C = N[1];
569
+ o.replaceState($, "", C), g(w);
588
570
  }
589
571
  }
590
- function b(f) {
591
- o.go(f);
572
+ function x(l) {
573
+ o.go(l);
592
574
  }
593
- var d = {
575
+ var m = {
594
576
  get action() {
595
- return u;
577
+ return c;
596
578
  },
597
579
  get location() {
598
- return i;
580
+ return h;
599
581
  },
600
- createHref: P,
601
- push: R,
602
- replace: S,
603
- go: b,
582
+ createHref: E,
583
+ push: v,
584
+ replace: b,
585
+ go: x,
604
586
  back: function() {
605
- b(-1);
587
+ x(-1);
606
588
  },
607
589
  forward: function() {
608
- b(1);
590
+ x(1);
609
591
  },
610
- listen: function(p) {
611
- return v.push(p);
592
+ listen: function(d) {
593
+ return y.push(d);
612
594
  },
613
- block: function(p) {
614
- var w = m.push(p);
615
- return m.length === 1 && r.addEventListener(mt, dt), function() {
616
- w(), m.length || r.removeEventListener(mt, dt);
595
+ block: function(d) {
596
+ var w = p.push(d);
597
+ return p.length === 1 && r.addEventListener(gt, Rt), function() {
598
+ w(), p.length || r.removeEventListener(gt, Rt);
617
599
  };
618
600
  }
619
601
  };
620
- return d;
602
+ return m;
621
603
  }
622
- function Gt(t) {
604
+ function Xt(t) {
623
605
  t === void 0 && (t = {});
624
606
  var e = t, n = e.initialEntries, r = n === void 0 ? ["/"] : n, o = e.initialIndex, a = r.map(function(g) {
625
- var R = Z(F({
607
+ var v = Z(F({
626
608
  pathname: "/",
627
609
  search: "",
628
610
  hash: "",
629
611
  state: null,
630
- key: gt()
631
- }, typeof g == "string" ? st(g) : g));
632
- return process.env.NODE_ENV !== "production" && G(R.pathname.charAt(0) === "/", "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(g) + ")"), R;
633
- }), s = Kt(o ?? a.length - 1, 0, a.length - 1), c = U.Pop, u = a[s], l = tt(), h = tt();
634
- function i(g) {
612
+ key: yt()
613
+ }, typeof g == "string" ? ct(g) : g));
614
+ return process.env.NODE_ENV !== "production" && G(v.pathname.charAt(0) === "/", "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(g) + ")"), v;
615
+ }), s = Zt(o ?? a.length - 1, 0, a.length - 1), u = U.Pop, c = a[s], f = tt(), i = tt();
616
+ function h(g) {
635
617
  return typeof g == "string" ? g : K(g);
636
618
  }
637
- function v(g, R) {
638
- return R === void 0 && (R = null), Z(F({
639
- pathname: u.pathname,
619
+ function y(g, v) {
620
+ return v === void 0 && (v = null), Z(F({
621
+ pathname: c.pathname,
640
622
  search: "",
641
623
  hash: ""
642
- }, typeof g == "string" ? st(g) : g, {
643
- state: R,
644
- key: gt()
624
+ }, typeof g == "string" ? ct(g) : g, {
625
+ state: v,
626
+ key: yt()
645
627
  }));
646
628
  }
647
- function m(g, R, S) {
648
- return !h.length || (h.call({
629
+ function p(g, v, b) {
630
+ return !i.length || (i.call({
649
631
  action: g,
650
- location: R,
651
- retry: S
632
+ location: v,
633
+ retry: b
652
634
  }), !1);
653
635
  }
654
- function A(g, R) {
655
- c = g, u = R, l.call({
656
- action: c,
657
- location: u
636
+ function S(g, v) {
637
+ u = g, c = v, f.call({
638
+ action: u,
639
+ location: c
658
640
  });
659
641
  }
660
- function P(g, R) {
661
- var S = U.Push, b = v(g, R);
662
- function d() {
663
- P(g, R);
642
+ function E(g, v) {
643
+ var b = U.Push, x = y(g, v);
644
+ function m() {
645
+ E(g, v);
664
646
  }
665
- process.env.NODE_ENV !== "production" && G(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(g) + ")"), m(S, b, d) && (s += 1, a.splice(s, a.length, b), A(S, b));
647
+ process.env.NODE_ENV !== "production" && G(c.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(g) + ")"), p(b, x, m) && (s += 1, a.splice(s, a.length, x), S(b, x));
666
648
  }
667
- function k(g, R) {
668
- var S = U.Replace, b = v(g, R);
669
- function d() {
670
- k(g, R);
649
+ function A(g, v) {
650
+ var b = U.Replace, x = y(g, v);
651
+ function m() {
652
+ A(g, v);
671
653
  }
672
- process.env.NODE_ENV !== "production" && G(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(g) + ")"), m(S, b, d) && (a[s] = b, A(S, b));
654
+ process.env.NODE_ENV !== "production" && G(c.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(g) + ")"), p(b, x, m) && (a[s] = x, S(b, x));
673
655
  }
674
- function C(g) {
675
- var R = Kt(s + g, 0, a.length - 1), S = U.Pop, b = a[R];
676
- function d() {
677
- C(g);
656
+ function k(g) {
657
+ var v = Zt(s + g, 0, a.length - 1), b = U.Pop, x = a[v];
658
+ function m() {
659
+ k(g);
678
660
  }
679
- m(S, b, d) && (s = R, A(S, b));
661
+ p(b, x, m) && (s = v, S(b, x));
680
662
  }
681
- var O = {
663
+ var j = {
682
664
  get index() {
683
665
  return s;
684
666
  },
685
667
  get action() {
686
- return c;
668
+ return u;
687
669
  },
688
670
  get location() {
689
- return u;
671
+ return c;
690
672
  },
691
- createHref: i,
692
- push: P,
693
- replace: k,
694
- go: C,
673
+ createHref: h,
674
+ push: E,
675
+ replace: A,
676
+ go: k,
695
677
  back: function() {
696
- C(-1);
678
+ k(-1);
697
679
  },
698
680
  forward: function() {
699
- C(1);
681
+ k(1);
700
682
  },
701
- listen: function(R) {
702
- return l.push(R);
683
+ listen: function(v) {
684
+ return f.push(v);
703
685
  },
704
- block: function(R) {
705
- return h.push(R);
686
+ block: function(v) {
687
+ return i.push(v);
706
688
  }
707
689
  };
708
- return O;
690
+ return j;
709
691
  }
710
- function Kt(t, e, n) {
692
+ function Zt(t, e, n) {
711
693
  return Math.min(Math.max(t, e), n);
712
694
  }
713
- function dt(t) {
695
+ function Rt(t) {
714
696
  t.preventDefault(), t.returnValue = "";
715
697
  }
716
698
  function tt() {
@@ -733,14 +715,14 @@ function tt() {
733
715
  }
734
716
  };
735
717
  }
736
- function gt() {
718
+ function yt() {
737
719
  return Math.random().toString(36).substr(2, 8);
738
720
  }
739
721
  function K(t) {
740
722
  var e = t.pathname, n = e === void 0 ? "/" : e, r = t.search, o = r === void 0 ? "" : r, a = t.hash, s = a === void 0 ? "" : a;
741
723
  return o && o !== "?" && (n += o.charAt(0) === "?" ? o : "?" + o), s && s !== "#" && (n += s.charAt(0) === "#" ? s : "#" + s), n;
742
724
  }
743
- function st(t) {
725
+ function ct(t) {
744
726
  var e = {};
745
727
  if (t) {
746
728
  var n = t.indexOf("#");
@@ -750,73 +732,92 @@ function st(t) {
750
732
  }
751
733
  return e;
752
734
  }
753
- const Ee = Symbol();
754
- function Nn() {
755
- const t = Et(Ee);
735
+ class Hn extends Error {
736
+ /**
737
+ * Constructs a new UseRouteInvalidError instance with a message that specifies both the given and expected route names.
738
+ * This detailed error message aids in quickly identifying and resolving mismatches in route usage.
739
+ * @param routeName - The route name that was incorrectly used.
740
+ * @param actualRouteName - The expected route name that should have been used.
741
+ */
742
+ constructor(e, n) {
743
+ super(`useRoute called with incorrect route. Given ${e}, expected ${n}`);
744
+ }
745
+ }
746
+ const be = Symbol();
747
+ function Vn() {
748
+ const t = it(be);
756
749
  if (!t)
757
- throw new Ht();
750
+ throw new St();
758
751
  return t;
759
752
  }
760
- const Pe = Symbol("isRouterRouteSymbol");
761
- function Un(t) {
762
- return typeof t == "object" && t !== null && Pe in t;
753
+ const Ae = Symbol();
754
+ function jt() {
755
+ const t = it(Ae);
756
+ if (!t)
757
+ throw new St();
758
+ return t;
763
759
  }
764
- function Cn(t, e) {
765
- function n(i, v, m) {
766
- if (typeof i == "object") {
767
- const P = {
760
+ const xe = Symbol("isRouterRouteSymbol");
761
+ function jn(t) {
762
+ return typeof t == "object" && t !== null && xe in t;
763
+ }
764
+ function On(t, e) {
765
+ function n(y, p, S) {
766
+ if (typeof y == "object") {
767
+ const A = {
768
768
  ...t.params,
769
- ...i
769
+ ...y
770
770
  };
771
- return e(t.name, P, v);
771
+ return e(t.name, A, p);
772
772
  }
773
- const A = {
773
+ const E = {
774
774
  ...t.params,
775
- [i]: v
775
+ [y]: p
776
776
  };
777
- return e(t.name, A, m);
778
- }
779
- const { matched: r, matches: o, name: a, query: s, params: c, state: u, hash: l } = Qe(t), h = ae({
780
- matched: r,
781
- matches: o,
782
- state: u,
783
- query: s,
784
- hash: l,
777
+ return e(t.name, E, S);
778
+ }
779
+ const { id: r, matched: o, matches: a, name: s, query: u, params: c, state: f, hash: i } = Ze(t), h = $t({
780
+ id: r,
781
+ matched: o,
782
+ matches: a,
783
+ state: f,
784
+ query: u,
785
+ hash: i,
785
786
  params: c,
786
- name: a,
787
+ name: s,
787
788
  update: n,
788
- [Pe]: !0
789
+ [xe]: !0
789
790
  });
790
791
  return new Proxy(h, {
791
- get: (i, v, m) => v === "params" ? new Proxy(t.params, {
792
- set(A, P, k) {
793
- return n(P, k), !0;
792
+ get: (y, p, S) => p === "params" ? new Proxy(t.params, {
793
+ set(E, A, k) {
794
+ return n(A, k), !0;
794
795
  }
795
- }) : v === "state" ? new Proxy(t.state, {
796
- set(A, P, k) {
797
- return n({}, { state: { ...t.state, [P]: k } }), !0;
796
+ }) : p === "state" ? new Proxy(t.state, {
797
+ set(E, A, k) {
798
+ return n({}, { state: { ...t.state, [A]: k } }), !0;
798
799
  }
799
- }) : Reflect.get(i, v, m)
800
+ }) : Reflect.get(y, p, S)
800
801
  });
801
802
  }
802
- const Se = Symbol();
803
- function $n(t, e) {
804
- const n = ae({ ...t }), r = (s) => {
803
+ const ke = Symbol();
804
+ function _n(t, e) {
805
+ const n = $t({ ...t }), r = (s) => {
805
806
  Object.assign(n, {
806
- [Se]: !1,
807
+ [ke]: !1,
807
808
  ...s
808
809
  });
809
- }, o = n, a = Cn(o, e);
810
+ }, o = n, a = On(o, e);
810
811
  return {
811
812
  currentRoute: o,
812
813
  routerRoute: a,
813
814
  updateRoute: r
814
815
  };
815
816
  }
816
- function M(t) {
817
- return !t.startsWith("http") ? Vn(t) : Hn(t);
817
+ function D(t) {
818
+ return !t.startsWith("http") ? Mn(t) : qn(t);
818
819
  }
819
- function Hn(t) {
820
+ function qn(t) {
820
821
  const { protocol: e, host: n, pathname: r, search: o, searchParams: a, hash: s } = new URL(t, t);
821
822
  return {
822
823
  protocol: e,
@@ -827,7 +828,7 @@ function Hn(t) {
827
828
  hash: s
828
829
  };
829
830
  }
830
- function Vn(t) {
831
+ function Mn(t) {
831
832
  const { pathname: e, search: n, searchParams: r, hash: o } = new URL(t, "https://localhost");
832
833
  return {
833
834
  pathname: e,
@@ -836,20 +837,20 @@ function Vn(t) {
836
837
  hash: o
837
838
  };
838
839
  }
839
- function jn(t) {
840
+ function Wn(t) {
840
841
  return (e) => {
841
- const { host: n } = M(e);
842
+ const { host: n } = D(e);
842
843
  return !(n === void 0 || n === t);
843
844
  };
844
845
  }
845
- function On({ mode: t, listener: e }) {
846
- const n = _n(t), r = (u, l) => {
847
- if (l != null && l.replace)
848
- return n.replace(u, l.state);
849
- n.push(u, l == null ? void 0 : l.state);
846
+ function Dn({ mode: t, listener: e }) {
847
+ const n = Tn(t), r = (c, f) => {
848
+ if (f != null && f.replace)
849
+ return n.replace(c, f.state);
850
+ n.push(c, f == null ? void 0 : f.state);
850
851
  }, o = () => {
851
- const u = K(n.location);
852
- return n.replace(u);
852
+ const c = K(n.location);
853
+ return n.replace(c);
853
854
  };
854
855
  let a;
855
856
  return {
@@ -864,154 +865,154 @@ function On({ mode: t, listener: e }) {
864
865
  }
865
866
  };
866
867
  }
867
- function _n(t = "auto") {
868
+ function Tn(t = "auto") {
868
869
  switch (t) {
869
870
  case "auto":
870
- return de() ? Qt() : Gt();
871
+ return ye() ? Yt() : Xt();
871
872
  case "browser":
872
- return Qt();
873
+ return Yt();
873
874
  case "memory":
874
- return Gt();
875
+ return Xt();
875
876
  case "hash":
876
- return Ln();
877
+ return $n();
877
878
  default:
878
879
  const e = t;
879
880
  throw new Error(`Switch is not exhaustive for mode: ${e}`);
880
881
  }
881
882
  }
882
- class Rt {
883
+ class vt {
883
884
  constructor() {
884
- V(this, "onBeforeRouteEnter", /* @__PURE__ */ new Set());
885
- V(this, "onBeforeRouteUpdate", /* @__PURE__ */ new Set());
886
- V(this, "onBeforeRouteLeave", /* @__PURE__ */ new Set());
887
- V(this, "onAfterRouteEnter", /* @__PURE__ */ new Set());
888
- V(this, "onAfterRouteUpdate", /* @__PURE__ */ new Set());
889
- V(this, "onAfterRouteLeave", /* @__PURE__ */ new Set());
885
+ M(this, "onBeforeRouteEnter", /* @__PURE__ */ new Set());
886
+ M(this, "onBeforeRouteUpdate", /* @__PURE__ */ new Set());
887
+ M(this, "onBeforeRouteLeave", /* @__PURE__ */ new Set());
888
+ M(this, "onAfterRouteEnter", /* @__PURE__ */ new Set());
889
+ M(this, "onAfterRouteUpdate", /* @__PURE__ */ new Set());
890
+ M(this, "onAfterRouteLeave", /* @__PURE__ */ new Set());
890
891
  }
891
892
  }
892
- class zt extends Error {
893
+ class te extends Error {
893
894
  }
894
895
  class rt extends Error {
895
896
  constructor(n) {
896
897
  super("Error occurred during a router push operation.");
897
- V(this, "to");
898
+ M(this, "to");
898
899
  this.to = n;
899
900
  }
900
901
  }
901
- class Bt extends Error {
902
+ class Lt extends Error {
902
903
  constructor(n) {
903
904
  super(`Routing action rejected: ${n}`);
904
- V(this, "type");
905
+ M(this, "type");
905
906
  this.type = n;
906
907
  }
907
908
  }
908
- function qn(t, e) {
909
- const n = new Rt();
909
+ function In(t, e) {
910
+ const n = new vt();
910
911
  return t.matches.forEach((r, o) => {
911
- r.onBeforeRouteEnter && jt(t, e, o) && Y(r.onBeforeRouteEnter).forEach((a) => n.onBeforeRouteEnter.add(a)), r.onBeforeRouteUpdate && _t(t, e, o) && Y(r.onBeforeRouteUpdate).forEach((a) => n.onBeforeRouteUpdate.add(a));
912
+ r.onBeforeRouteEnter && Ot(t, e, o) && Y(r.onBeforeRouteEnter).forEach((a) => n.onBeforeRouteEnter.add(a)), r.onBeforeRouteUpdate && qt(t, e, o) && Y(r.onBeforeRouteUpdate).forEach((a) => n.onBeforeRouteUpdate.add(a));
912
913
  }), e.matches.forEach((r, o) => {
913
- r.onBeforeRouteLeave && Ot(t, e, o) && Y(r.onBeforeRouteLeave).forEach((a) => n.onBeforeRouteLeave.add(a));
914
+ r.onBeforeRouteLeave && _t(t, e, o) && Y(r.onBeforeRouteLeave).forEach((a) => n.onBeforeRouteLeave.add(a));
914
915
  }), n;
915
916
  }
916
- function Wn(t, e) {
917
- const n = new Rt();
917
+ function Fn(t, e) {
918
+ const n = new vt();
918
919
  return t.matches.forEach((r, o) => {
919
- r.onAfterRouteEnter && jt(t, e, o) && Y(r.onAfterRouteEnter).forEach((a) => n.onAfterRouteEnter.add(a)), r.onAfterRouteUpdate && _t(t, e, o) && Y(r.onAfterRouteUpdate).forEach((a) => n.onAfterRouteUpdate.add(a));
920
+ r.onAfterRouteEnter && Ot(t, e, o) && Y(r.onAfterRouteEnter).forEach((a) => n.onAfterRouteEnter.add(a)), r.onAfterRouteUpdate && qt(t, e, o) && Y(r.onAfterRouteUpdate).forEach((a) => n.onAfterRouteUpdate.add(a));
920
921
  }), e.matches.forEach((r, o) => {
921
- r.onAfterRouteLeave && Ot(t, e, o) && Y(r.onAfterRouteLeave).forEach((a) => n.onAfterRouteLeave.add(a));
922
+ r.onAfterRouteLeave && _t(t, e, o) && Y(r.onAfterRouteLeave).forEach((a) => n.onAfterRouteLeave.add(a));
922
923
  }), n;
923
924
  }
924
- function D(t) {
925
+ function W(t) {
925
926
  return typeof t != "string" ? !1 : /^(https?:\/\/|\/).*/g.test(t);
926
927
  }
927
- function Dn() {
928
+ function Jn() {
928
929
  const t = (s) => {
929
- throw new Bt(s);
930
+ throw new Lt(s);
930
931
  }, e = (...s) => {
931
932
  throw new rt(s);
932
- }, n = (s, c, u) => {
933
- if (D(s)) {
934
- const i = c ?? {};
935
- throw new rt([s, { ...i, replace: !0 }]);
933
+ }, n = (s, u, c) => {
934
+ if (W(s)) {
935
+ const h = u ?? {};
936
+ throw new rt([s, { ...h, replace: !0 }]);
936
937
  }
937
- const l = c, h = u ?? {};
938
- throw new rt([s, l, { ...h, replace: !0 }]);
938
+ const f = u, i = c ?? {};
939
+ throw new rt([s, f, { ...i, replace: !0 }]);
939
940
  }, r = () => {
940
- throw new zt();
941
+ throw new te();
941
942
  };
942
- async function o({ to: s, from: c, hooks: u }) {
943
- const { global: l, component: h } = u, i = qn(s, c), v = [
944
- ...l.onBeforeRouteEnter,
945
- ...i.onBeforeRouteEnter,
946
- ...l.onBeforeRouteUpdate,
947
- ...i.onBeforeRouteUpdate,
943
+ async function o({ to: s, from: u, hooks: c }) {
944
+ const { global: f, component: i } = c, h = In(s, u), y = [
945
+ ...f.onBeforeRouteEnter,
946
+ ...h.onBeforeRouteEnter,
947
+ ...f.onBeforeRouteUpdate,
948
948
  ...h.onBeforeRouteUpdate,
949
- ...l.onBeforeRouteLeave,
950
- ...i.onBeforeRouteLeave,
951
- ...h.onBeforeRouteLeave
949
+ ...i.onBeforeRouteUpdate,
950
+ ...f.onBeforeRouteLeave,
951
+ ...h.onBeforeRouteLeave,
952
+ ...i.onBeforeRouteLeave
952
953
  ];
953
954
  try {
954
- const m = v.map((A) => A(s, {
955
- from: c,
955
+ const p = y.map((S) => S(s, {
956
+ from: u,
956
957
  reject: t,
957
958
  push: e,
958
959
  replace: n,
959
960
  abort: r
960
961
  }));
961
- await Promise.all(m);
962
- } catch (m) {
963
- if (m instanceof rt)
962
+ await Promise.all(p);
963
+ } catch (p) {
964
+ if (p instanceof rt)
964
965
  return {
965
966
  status: "PUSH",
966
- to: m.to
967
+ to: p.to
967
968
  };
968
- if (m instanceof Bt)
969
+ if (p instanceof Lt)
969
970
  return {
970
971
  status: "REJECT",
971
- type: m.type
972
+ type: p.type
972
973
  };
973
- if (m instanceof zt)
974
+ if (p instanceof te)
974
975
  return {
975
976
  status: "ABORT"
976
977
  };
977
- throw m;
978
+ throw p;
978
979
  }
979
980
  return {
980
981
  status: "SUCCESS"
981
982
  };
982
983
  }
983
- async function a({ to: s, from: c, hooks: u }) {
984
- const { global: l, component: h } = u, i = Wn(s, c), v = [
985
- ...h.onAfterRouteLeave,
984
+ async function a({ to: s, from: u, hooks: c }) {
985
+ const { global: f, component: i } = c, h = Fn(s, u), y = [
986
986
  ...i.onAfterRouteLeave,
987
- ...l.onAfterRouteLeave,
988
- ...h.onAfterRouteUpdate,
987
+ ...h.onAfterRouteLeave,
988
+ ...f.onAfterRouteLeave,
989
989
  ...i.onAfterRouteUpdate,
990
- ...l.onAfterRouteUpdate,
991
- ...h.onAfterRouteEnter,
990
+ ...h.onAfterRouteUpdate,
991
+ ...f.onAfterRouteUpdate,
992
992
  ...i.onAfterRouteEnter,
993
- ...l.onAfterRouteEnter
993
+ ...h.onAfterRouteEnter,
994
+ ...f.onAfterRouteEnter
994
995
  ];
995
996
  try {
996
- const m = v.map((A) => A(s, {
997
- from: c,
997
+ const p = y.map((S) => S(s, {
998
+ from: u,
998
999
  reject: t,
999
1000
  push: e,
1000
1001
  replace: n
1001
1002
  }));
1002
- await Promise.all(m);
1003
- } catch (m) {
1004
- if (m instanceof rt)
1003
+ await Promise.all(p);
1004
+ } catch (p) {
1005
+ if (p instanceof rt)
1005
1006
  return {
1006
1007
  status: "PUSH",
1007
- to: m.to
1008
+ to: p.to
1008
1009
  };
1009
- if (m instanceof Bt)
1010
+ if (p instanceof Lt)
1010
1011
  return {
1011
1012
  status: "REJECT",
1012
- type: m.type
1013
+ type: p.type
1013
1014
  };
1014
- throw m;
1015
+ throw p;
1015
1016
  }
1016
1017
  return {
1017
1018
  status: "SUCCESS"
@@ -1022,97 +1023,105 @@ function Dn() {
1022
1023
  runAfterRouteHooks: a
1023
1024
  };
1024
1025
  }
1025
- const jt = (t, e, n) => {
1026
+ const Ot = (t, e, n) => {
1026
1027
  const r = t.matches, o = (e == null ? void 0 : e.matches) ?? [];
1027
1028
  return r.length < n || r[n] !== o[n];
1028
- }, Ot = (t, e, n) => {
1029
+ }, _t = (t, e, n) => {
1029
1030
  const r = t.matches, o = (e == null ? void 0 : e.matches) ?? [];
1030
1031
  return r.length < n || r[n] !== o[n];
1031
- }, _t = (t, e, n) => t.matches[n] === (e == null ? void 0 : e.matches[n]);
1032
- function Yt(t) {
1032
+ }, qt = (t, e, n) => t.matches[n] === (e == null ? void 0 : e.matches[n]);
1033
+ function ee(t) {
1033
1034
  switch (t) {
1034
1035
  case "onBeforeRouteEnter":
1035
1036
  case "onAfterRouteEnter":
1036
- return jt;
1037
+ return Ot;
1037
1038
  case "onBeforeRouteUpdate":
1038
1039
  case "onAfterRouteUpdate":
1039
- return _t;
1040
+ return qt;
1040
1041
  case "onBeforeRouteLeave":
1041
1042
  case "onAfterRouteLeave":
1042
- return Ot;
1043
+ return _t;
1043
1044
  default:
1044
1045
  throw new Error(`Switch is not exhaustive for lifecycle: ${t}`);
1045
1046
  }
1046
1047
  }
1047
- class Mn {
1048
- constructor() {
1049
- V(this, "global", new Rt());
1050
- V(this, "component", new Rt());
1051
- }
1052
- addBeforeRouteHook({ lifecycle: e, timing: n, depth: r, hook: o }) {
1053
- const a = Yt(e), s = this[n][e], c = (u, l) => {
1054
- if (a(u, l.from, r))
1055
- return o(u, l);
1048
+ function Qn() {
1049
+ const t = {
1050
+ global: new vt(),
1051
+ component: new vt()
1052
+ };
1053
+ function e({ lifecycle: r, timing: o, depth: a, hook: s }) {
1054
+ const u = ee(r), c = t[o][r], f = (i, h) => {
1055
+ if (u(i, h.from, a))
1056
+ return s(i, h);
1056
1057
  };
1057
- return s.add(c), () => s.delete(c);
1058
+ return c.add(f), () => c.delete(f);
1058
1059
  }
1059
- addAfterRouteHook({ lifecycle: e, timing: n, depth: r, hook: o }) {
1060
- const a = Yt(e), s = this[n][e], c = (u, l) => {
1061
- if (a(u, l.from, r))
1062
- return o(u, l);
1060
+ function n({ lifecycle: r, timing: o, depth: a, hook: s }) {
1061
+ const u = ee(r), c = t[o][r], f = (i, h) => {
1062
+ if (u(i, h.from, a))
1063
+ return s(i, h);
1063
1064
  };
1064
- return s.add(c), () => s.delete(c);
1065
+ return c.add(f), () => c.delete(f);
1065
1066
  }
1067
+ return { ...t, addBeforeRouteHook: e, addAfterRouteHook: n };
1066
1068
  }
1067
- const be = Symbol();
1068
- function Tn() {
1069
- const t = new Mn();
1069
+ const Be = Symbol();
1070
+ function Gn() {
1071
+ const t = Qn();
1070
1072
  return {
1071
- onBeforeRouteEnter: (c) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteEnter", hook: c, timing: "global", depth: 0 }),
1072
- onBeforeRouteUpdate: (c) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteUpdate", hook: c, timing: "global", depth: 0 }),
1073
- onBeforeRouteLeave: (c) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteLeave", hook: c, timing: "global", depth: 0 }),
1074
- onAfterRouteEnter: (c) => t.addAfterRouteHook({ lifecycle: "onAfterRouteEnter", hook: c, timing: "global", depth: 0 }),
1075
- onAfterRouteUpdate: (c) => t.addAfterRouteHook({ lifecycle: "onAfterRouteUpdate", hook: c, timing: "global", depth: 0 }),
1076
- onAfterRouteLeave: (c) => t.addAfterRouteHook({ lifecycle: "onAfterRouteLeave", hook: c, timing: "global", depth: 0 }),
1073
+ onBeforeRouteEnter: (u) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteEnter", hook: u, timing: "global", depth: 0 }),
1074
+ onBeforeRouteUpdate: (u) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteUpdate", hook: u, timing: "global", depth: 0 }),
1075
+ onBeforeRouteLeave: (u) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteLeave", hook: u, timing: "global", depth: 0 }),
1076
+ onAfterRouteEnter: (u) => t.addAfterRouteHook({ lifecycle: "onAfterRouteEnter", hook: u, timing: "global", depth: 0 }),
1077
+ onAfterRouteUpdate: (u) => t.addAfterRouteHook({ lifecycle: "onAfterRouteUpdate", hook: u, timing: "global", depth: 0 }),
1078
+ onAfterRouteLeave: (u) => t.addAfterRouteHook({ lifecycle: "onAfterRouteLeave", hook: u, timing: "global", depth: 0 }),
1077
1079
  hooks: t
1078
1080
  };
1079
1081
  }
1080
- function In(t) {
1081
- return ct(() => () => ft("h1", t), {
1082
+ function Kn(t) {
1083
+ return ut(() => () => pt("h1", t), {
1082
1084
  name: t,
1083
1085
  props: []
1084
1086
  });
1085
1087
  }
1086
- function Ae(t) {
1088
+ function Le(t) {
1087
1089
  const e = new URLSearchParams(t);
1088
1090
  return {
1089
1091
  get: (n) => e.get(n),
1090
1092
  getAll: (n) => e.getAll(n)
1091
1093
  };
1092
1094
  }
1093
- function Fn({
1095
+ function zn() {
1096
+ let t = 0;
1097
+ return () => (++t).toString();
1098
+ }
1099
+ const Mt = zn();
1100
+ function Yn({
1094
1101
  rejections: t
1095
1102
  }) {
1096
1103
  const e = (a) => {
1097
1104
  const s = {
1098
1105
  ...t
1099
1106
  };
1100
- return lt(s[a] ?? In(a));
1107
+ return dt(s[a] ?? Kn(a));
1101
1108
  }, n = (a) => {
1102
- const s = lt(e(a)), c = {
1109
+ const s = dt(e(a)), u = {
1110
+ id: Mt(),
1103
1111
  name: a,
1104
1112
  component: s,
1105
1113
  meta: {},
1106
1114
  state: {}
1107
1115
  };
1108
1116
  return {
1109
- matched: c,
1110
- matches: [c],
1117
+ id: u.id,
1118
+ matched: u,
1119
+ matches: [u],
1111
1120
  name: a,
1112
- query: Ae(""),
1121
+ query: Le(""),
1113
1122
  params: {},
1114
1123
  state: {},
1115
- [Se]: !0
1124
+ [ke]: !0
1116
1125
  };
1117
1126
  }, r = (a) => {
1118
1127
  if (!a) {
@@ -1121,102 +1130,102 @@ function Fn({
1121
1130
  }
1122
1131
  const s = e(a);
1123
1132
  o.value = { type: a, component: s };
1124
- }, o = Ge(null);
1133
+ }, o = ie(null);
1125
1134
  return {
1126
1135
  setRejection: r,
1127
1136
  rejection: o,
1128
1137
  getRejectionRoute: n
1129
1138
  };
1130
1139
  }
1131
- class Jn extends Error {
1140
+ class Xn extends Error {
1132
1141
  constructor(e) {
1133
1142
  super(`Route not found: "${e}"`);
1134
1143
  }
1135
1144
  }
1136
- function qt(t) {
1145
+ function Wt(t) {
1137
1146
  return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1138
1147
  }
1139
- function Qn(t, e) {
1148
+ function Zn(t, e) {
1140
1149
  const n = Array.from(t.matchAll(e));
1141
1150
  if (n.length === 0)
1142
1151
  return [t];
1143
1152
  let r = 0;
1144
- const o = n.reduce((s, c) => {
1145
- const u = qt(t.slice(r, c.index));
1146
- u.length && s.push(u);
1147
- const [l] = c;
1148
- return s.push(l), r = c.index + l.length, s;
1153
+ const o = n.reduce((s, u) => {
1154
+ const c = Wt(t.slice(r, u.index));
1155
+ c.length && s.push(c);
1156
+ const [f] = u;
1157
+ return s.push(f), r = u.index + f.length, s;
1149
1158
  }, []), a = t.slice(r);
1150
1159
  return a && o.push(a), o;
1151
1160
  }
1152
- function Gn(t) {
1153
- const e = xe(t.path.toString());
1161
+ function tr(t) {
1162
+ const e = Ne(t.path.toString());
1154
1163
  return new RegExp(`^${e}$`, "i");
1155
1164
  }
1156
- function Kn(t) {
1165
+ function er(t) {
1157
1166
  const e = new URLSearchParams(t.query.toString());
1158
- return Array.from(e.entries()).filter(([, n]) => !$t(n)).map(([n, r]) => {
1159
- const o = xe(r);
1160
- return new RegExp(`${qt(n)}=${o}(&|$)`, "i");
1167
+ return Array.from(e.entries()).filter(([, n]) => !Ct(n)).map(([n, r]) => {
1168
+ const o = Ne(r);
1169
+ return new RegExp(`${Wt(n)}=${o}(&|$)`, "i");
1161
1170
  });
1162
1171
  }
1163
- function xe(t) {
1164
- return Qn(t, new RegExp(zn, "g")).map((e) => e.startsWith(T) ? ke(e) : qt(e)).join("");
1172
+ function Ne(t) {
1173
+ return Zn(t, new RegExp(nr, "g")).map((e) => e.startsWith(T) ? Ue(e) : Wt(e)).join("");
1165
1174
  }
1166
- function ke(t) {
1175
+ function Ue(t) {
1167
1176
  return [
1168
- Yn,
1169
- Xn
1177
+ rr,
1178
+ or
1170
1179
  ].reduce((e, n) => n(e), t);
1171
1180
  }
1172
- const zn = `\\${T}\\??([\\w-_]+)\\${Q}`, Wt = `\\${T}\\?([\\w-_]+)\\${Q}`, Be = `\\${T}([\\w-_]+)\\${Q}`;
1173
- function Yn(t) {
1174
- return t.replace(new RegExp(Wt, "g"), ".*");
1181
+ const nr = `\\${T}\\??([\\w-_]+)\\${Q}`, Dt = `\\${T}\\?([\\w-_]+)\\${Q}`, Ce = `\\${T}([\\w-_]+)\\${Q}`;
1182
+ function rr(t) {
1183
+ return t.replace(new RegExp(Dt, "g"), ".*");
1175
1184
  }
1176
- function $t(t) {
1177
- return new RegExp(Wt, "g").test(t);
1185
+ function Ct(t) {
1186
+ return new RegExp(Dt, "g").test(t);
1178
1187
  }
1179
- function Xn(t) {
1180
- return t.replace(new RegExp(Be, "g"), ".+");
1188
+ function or(t) {
1189
+ return t.replace(new RegExp(Ce, "g"), ".+");
1181
1190
  }
1182
- function St(t) {
1183
- const [e] = yt(t, new RegExp(Wt, "g")), [n] = yt(t, new RegExp(Be, "g"));
1191
+ function At(t) {
1192
+ const [e] = wt(t, new RegExp(Dt, "g")), [n] = wt(t, new RegExp(Ce, "g"));
1184
1193
  return e ?? n;
1185
1194
  }
1186
- function yt(t, e) {
1187
- return Array.from(t.matchAll(e)).flatMap(([, ...r]) => r.map((o) => it(o) ? o : ""));
1195
+ function wt(t, e) {
1196
+ return Array.from(t.matchAll(e)).flatMap(([, ...r]) => r.map((o) => lt(o) ? o : ""));
1188
1197
  }
1189
- function Le(t, e, n) {
1190
- const r = Ue(e, n), [o] = yt(t, r);
1198
+ function $e(t, e, n) {
1199
+ const r = Ve(e, n), [o] = wt(t, r);
1191
1200
  return o;
1192
1201
  }
1193
- function Ne(t, e) {
1202
+ function He(t, e) {
1194
1203
  if (!e)
1195
1204
  return t;
1196
- const { name: n, param: r, value: o } = e, a = Ue(t, n);
1197
- return yt(t, a).reduce((c, u) => u === void 0 ? c : c.replace(u, () => at(o, r, n.startsWith("?"))), t);
1205
+ const { name: n, param: r, value: o } = e, a = Ve(t, n);
1206
+ return wt(t, a).reduce((u, c) => c === void 0 ? u : u.replace(c, () => st(o, r, n.startsWith("?"))), t);
1198
1207
  }
1199
- function Ue(t, e) {
1208
+ function Ve(t, e) {
1200
1209
  const n = [
1201
- Zn,
1202
- tr,
1203
- ke
1210
+ ar,
1211
+ sr,
1212
+ Ue
1204
1213
  ].reduce((r, o) => o(r, e), t);
1205
1214
  return new RegExp(n, "g");
1206
1215
  }
1207
- function Zn(t, e) {
1216
+ function ar(t, e) {
1208
1217
  if (!e.startsWith("?"))
1209
1218
  return t;
1210
1219
  const n = new RegExp(`\\${T}\\${e}\\${Q}`, "g");
1211
1220
  return t.replace(n, "(.*)");
1212
1221
  }
1213
- function tr(t, e) {
1222
+ function sr(t, e) {
1214
1223
  if (e.startsWith("?"))
1215
1224
  return t;
1216
1225
  const n = new RegExp(`\\${T}${e}\\${Q}`, "g");
1217
1226
  return t.replace(n, "(.+)");
1218
1227
  }
1219
- function Ce(t, ...e) {
1228
+ function je(t, ...e) {
1220
1229
  return e.reduce((n, r) => {
1221
1230
  if (!r)
1222
1231
  return n;
@@ -1224,259 +1233,255 @@ function Ce(t, ...e) {
1224
1233
  return Object.keys(o).length === 0 ? n : n.includes("?") ? `${n}&${o}` : `${n}?${o}`;
1225
1234
  }, t);
1226
1235
  }
1227
- function er(t, e = {}) {
1228
- const { params: n = {}, query: r } = e, o = nr(t.host, n), a = rr(t.path, n), s = or(t.query, n), c = Ce(`${o}${a}`, s, r), u = pt(t.hash.value ?? e.hash).toString();
1229
- return `${c}${u}`;
1236
+ function cr(t, e = {}) {
1237
+ const { params: n = {}, query: r } = e, o = ur(t.host, n), a = ir(t.path, n), s = fr(t.query, n), u = je(`${o}${a}`, s, r), c = mt(t.hash.value ?? e.hash).toString();
1238
+ return `${u}${c}`;
1230
1239
  }
1231
- function nr(t, e) {
1240
+ function ur(t, e) {
1232
1241
  const n = t.toString();
1233
1242
  return Object.entries(t.params).reduce((r, [o, a]) => {
1234
- const s = St(`${T}${o}${Q}`);
1235
- return s ? Ne(r, { name: o, param: a, value: e[s] }) : r;
1243
+ const s = At(`${T}${o}${Q}`);
1244
+ return s ? He(r, { name: o, param: a, value: e[s] }) : r;
1236
1245
  }, n);
1237
1246
  }
1238
- function rr(t, e) {
1247
+ function ir(t, e) {
1239
1248
  const n = t.toString();
1240
1249
  return Object.entries(t.params).reduce((r, [o, a]) => {
1241
- const s = St(`${T}${o}${Q}`);
1242
- return s ? Ne(r, { name: o, param: a, value: e[s] }) : r;
1250
+ const s = At(`${T}${o}${Q}`);
1251
+ return s ? He(r, { name: o, param: a, value: e[s] }) : r;
1243
1252
  }, n);
1244
1253
  }
1245
- function or(t, e) {
1254
+ function fr(t, e) {
1246
1255
  const n = t.toString();
1247
1256
  if (!n)
1248
1257
  return {};
1249
1258
  const r = new URLSearchParams(n);
1250
1259
  return Array.from(r.entries()).reduce((o, [a, s]) => {
1251
- const c = St(s);
1252
- if (!c)
1260
+ const u = At(s);
1261
+ if (!u)
1253
1262
  return { ...o, [a]: s };
1254
- const l = at(e[c], t.params[c], $t(s)), h = e[c] === void 0 && l === "";
1255
- return $t(s) && h ? o : { ...o, [a]: l };
1263
+ const f = st(e[u], t.params[u], Ct(s)), i = e[u] === void 0 && f === "";
1264
+ return Ct(s) && i ? o : { ...o, [a]: f };
1256
1265
  }, {});
1257
1266
  }
1258
- function ar(t) {
1267
+ function lr(t) {
1259
1268
  return (e, n, r) => {
1260
- if (D(e))
1261
- return Ce(e, (n ?? {}).query);
1262
- const o = n ?? {}, a = r ?? {}, s = t.find((u) => u.name === e);
1269
+ if (W(e))
1270
+ return je(e, (n ?? {}).query);
1271
+ const o = n ?? {}, a = r ?? {}, s = t.find((c) => c.name === e);
1263
1272
  if (!s)
1264
- throw new Jn(String(e));
1265
- return er(s, {
1273
+ throw new Xn(String(e));
1274
+ return cr(s, {
1266
1275
  params: o,
1267
1276
  query: a.query,
1268
1277
  hash: a.hash
1269
1278
  });
1270
1279
  };
1271
1280
  }
1272
- class sr extends Error {
1281
+ class hr extends Error {
1273
1282
  constructor() {
1274
1283
  super("initialUrl must be set if window.location is unavailable");
1275
1284
  }
1276
1285
  }
1277
- function cr(t) {
1286
+ function pr(t) {
1278
1287
  if (t)
1279
1288
  return t;
1280
- if (de())
1289
+ if (ye())
1281
1290
  return window.location.toString();
1282
- throw new sr();
1291
+ throw new hr();
1283
1292
  }
1284
- const ur = (t, e) => {
1293
+ const dr = (t, e) => {
1285
1294
  try {
1286
- $e(t, e);
1295
+ Oe(t, e);
1287
1296
  } catch {
1288
1297
  return !1;
1289
1298
  }
1290
1299
  return !0;
1291
- }, $e = (t, e) => {
1292
- const { pathname: n, search: r } = M(e);
1300
+ }, Oe = (t, e) => {
1301
+ const { pathname: n, search: r } = D(e);
1293
1302
  return {
1294
- ...ir(t.path, n),
1295
- ...fr(t.query, r)
1303
+ ...mr(t.path, n),
1304
+ ...gr(t.query, r)
1296
1305
  };
1297
1306
  };
1298
- function ir(t, e) {
1307
+ function mr(t, e) {
1299
1308
  const n = {}, r = decodeURIComponent(e);
1300
1309
  for (const [o, a] of Object.entries(t.params)) {
1301
- const s = o.startsWith("?"), c = s ? o.slice(1) : o, u = Le(r, t.toString(), o), l = ot(u, a, s);
1302
- n[c] = l;
1310
+ const s = o.startsWith("?"), u = s ? o.slice(1) : o, c = $e(r, t.toString(), o), f = at(c, a, s);
1311
+ n[u] = f;
1303
1312
  }
1304
1313
  return n;
1305
1314
  }
1306
- function fr(t, e) {
1315
+ function gr(t, e) {
1307
1316
  const n = {}, r = new URLSearchParams(e);
1308
1317
  for (const [o, a] of Object.entries(t.params)) {
1309
- const s = o.startsWith("?"), c = s ? o.slice(1) : o, u = r.get(c) ?? void 0, l = ot(u, a, s);
1310
- n[c] = l;
1318
+ const s = o.startsWith("?"), u = s ? o.slice(1) : o, c = r.get(u) ?? void 0, f = at(c, a, s);
1319
+ n[u] = f;
1311
1320
  }
1312
1321
  return n;
1313
1322
  }
1314
- const lr = (t) => "name" in t.matched && !!t.matched.name, hr = (t, e) => {
1315
- const { pathname: n } = M(e);
1316
- return Gn(t).test(n);
1317
- }, pr = (t, e) => {
1318
- const { search: n } = M(e);
1319
- return Kn(t).every((o) => o.test(n));
1320
- }, mr = (t, e) => {
1321
- const { hash: n } = M(e), r = t.hash.toString();
1323
+ const Rr = (t) => "name" in t.matched && !!t.matched.name, yr = (t, e) => {
1324
+ const { pathname: n } = D(e);
1325
+ return tr(t).test(n);
1326
+ }, vr = (t, e) => {
1327
+ const { search: n } = D(e);
1328
+ return er(t).every((o) => o.test(n));
1329
+ }, wr = (t, e) => {
1330
+ const { hash: n } = D(e), r = t.hash.toString();
1322
1331
  return !t.hash.hasValue() || r.toLowerCase() === n.toLowerCase();
1323
1332
  };
1324
- function dr(t) {
1325
- const { searchParams: e, pathname: n } = M(t), r = -1, o = 1;
1333
+ function Pr(t) {
1334
+ const { searchParams: e, pathname: n } = D(t), r = -1, o = 1;
1326
1335
  return (a, s) => {
1327
- const c = Zt(a, e), u = Xt(a, n), l = Zt(s, e), h = Xt(s, n);
1336
+ const u = re(a, e), c = ne(a, n), f = re(s, e), i = ne(s, n);
1328
1337
  if (a.depth > s.depth)
1329
1338
  return r;
1330
1339
  if (a.depth < s.depth)
1331
1340
  return o;
1332
- if (c + u > l + h)
1341
+ if (u + c > f + i)
1333
1342
  return r;
1334
- if (c + u < l + h)
1343
+ if (u + c < f + i)
1335
1344
  return o;
1336
- const { hash: i } = M(t);
1337
- return a.hash.toString() === i ? r : s.hash.toString() === i ? o : 0;
1345
+ const { hash: h } = D(t);
1346
+ return a.hash.toString() === h ? r : s.hash.toString() === h ? o : 0;
1338
1347
  };
1339
1348
  }
1340
- function Xt(t, e) {
1341
- const n = Object.keys(t.path.params).filter((o) => o.startsWith("?")).map((o) => o), r = n.filter((o) => Le(e, t.path.toString(), o) === void 0);
1349
+ function ne(t, e) {
1350
+ const n = Object.keys(t.path.params).filter((o) => o.startsWith("?")).map((o) => o), r = n.filter((o) => $e(e, t.path.toString(), o) === void 0);
1342
1351
  return n.length - r.length;
1343
1352
  }
1344
- function Zt(t, e) {
1353
+ function re(t, e) {
1345
1354
  const n = new URLSearchParams(t.query.toString()), r = Array.from(n.keys()), o = r.filter((a) => !e.has(a));
1346
1355
  return r.length - o.length;
1347
1356
  }
1348
- function He(t) {
1357
+ function _e(t) {
1349
1358
  return !!t && typeof t == "object";
1350
1359
  }
1351
- const vt = !0;
1352
- function gr(t, e, n) {
1353
- if (He(t) && e in t) {
1360
+ const Pt = !0;
1361
+ function Er(t, e, n) {
1362
+ if (_e(t) && e in t) {
1354
1363
  const r = t[e];
1355
1364
  if (typeof r == "string")
1356
- return ot(r, n, vt);
1365
+ return at(r, n, Pt);
1357
1366
  }
1358
- return ot(void 0, n, vt);
1367
+ return at(void 0, n, Pt);
1359
1368
  }
1360
- function Rr(t, e) {
1369
+ function Sr(t, e) {
1361
1370
  const n = {};
1362
1371
  for (const [r, o] of Object.entries(t)) {
1363
- const a = gr(e, r, o);
1372
+ const a = Er(e, r, o);
1364
1373
  n[r] = a;
1365
1374
  }
1366
1375
  return n;
1367
1376
  }
1368
- function yr(t, e, n) {
1369
- if (He(t) && e in t) {
1377
+ function br(t, e, n) {
1378
+ if (_e(t) && e in t) {
1370
1379
  const r = t[e];
1371
- return at(r, n, vt);
1380
+ return st(r, n, Pt);
1372
1381
  }
1373
- return at(void 0, n, vt);
1382
+ return st(void 0, n, Pt);
1374
1383
  }
1375
- const te = (t, e) => {
1384
+ const oe = (t, e) => {
1376
1385
  const n = {};
1377
1386
  for (const [r, o] of Object.entries(t)) {
1378
- const a = yr(e, r, o);
1387
+ const a = br(e, r, o);
1379
1388
  n[r] = a;
1380
1389
  }
1381
1390
  return n;
1382
- }, vr = [
1383
- lr,
1384
- hr,
1385
- pr,
1386
- mr,
1387
- ur
1391
+ }, Ar = [
1392
+ Rr,
1393
+ yr,
1394
+ vr,
1395
+ wr,
1396
+ dr
1388
1397
  ];
1389
- function Lt(t, e, n) {
1390
- const r = dr(e), o = t.filter((u) => vr.every((l) => l(u, e))).sort(r);
1398
+ function Nt(t, e, n) {
1399
+ const r = Pr(e), o = t.filter((c) => Ar.every((f) => f(c, e))).sort(r);
1391
1400
  if (o.length === 0)
1392
1401
  return;
1393
- const [a] = o, { search: s, hash: c } = M(e);
1402
+ const [a] = o, { search: s, hash: u } = D(e);
1394
1403
  return {
1404
+ id: a.id,
1395
1405
  matched: a.matched,
1396
1406
  matches: a.matches,
1397
1407
  name: a.name,
1398
- query: Ae(s),
1399
- params: $e(a, e),
1400
- state: Rr(a.state, n),
1401
- hash: c
1408
+ query: Le(s),
1409
+ params: Oe(a, e),
1410
+ state: Sr(a.state, n),
1411
+ hash: u
1402
1412
  };
1403
1413
  }
1404
- function wr() {
1405
- let t = 0;
1406
- return () => (++t).toString();
1407
- }
1408
- const Ve = wr();
1409
- function Dt(t, e) {
1414
+ function Tt(t, e) {
1410
1415
  const n = new RegExp(`\\${T}(\\??[\\w-_]+)\\${Q}`, "g");
1411
1416
  return Array.from(t.matchAll(n)).reduce((o, [a, s]) => {
1412
- const c = St(a);
1413
- if (!c)
1417
+ const u = At(a);
1418
+ if (!u)
1414
1419
  return o;
1415
- const u = An(e, c);
1416
- return et([c], o), o[s] = u, o;
1420
+ const c = Ln(e, u);
1421
+ return et([u], o), o[s] = c, o;
1417
1422
  }, {});
1418
1423
  }
1419
- function je(t, e) {
1424
+ function qe(t, e) {
1420
1425
  return {
1421
1426
  value: t,
1422
- params: Dt(t, e),
1427
+ params: Tt(t, e),
1423
1428
  toString: () => t
1424
1429
  };
1425
1430
  }
1426
- function Er(t) {
1427
- return ut(t) && typeof t.hash == "string";
1431
+ function xr(t) {
1432
+ return ft(t) && typeof t.hash == "string";
1428
1433
  }
1429
- function Oe(t) {
1430
- return t === void 0 ? pt() : Er(t) ? t : pt(t);
1434
+ function Me(t) {
1435
+ return t === void 0 ? mt() : xr(t) ? t : mt(t);
1431
1436
  }
1432
- function Mt(t) {
1437
+ function It(t) {
1433
1438
  return t === void 0 ? "" : t;
1434
1439
  }
1435
- function ee(t, e) {
1440
+ function ae(t, e) {
1436
1441
  return {
1437
1442
  value: t,
1438
- params: Dt(t, e),
1443
+ params: Tt(t, e),
1439
1444
  toString: () => t
1440
1445
  };
1441
1446
  }
1442
- function Pr(t) {
1443
- return ut(t) && typeof t.value == "string";
1447
+ function kr(t) {
1448
+ return ft(t) && typeof t.value == "string";
1444
1449
  }
1445
- function _e(t) {
1446
- return t === void 0 ? ee("", {}) : Pr(t) ? t : ee(t, {});
1450
+ function We(t) {
1451
+ return t === void 0 ? ae("", {}) : kr(t) ? t : ae(t, {});
1447
1452
  }
1448
- function ne(t, e) {
1453
+ function se(t, e) {
1449
1454
  return {
1450
1455
  value: t,
1451
- params: Dt(t, e),
1456
+ params: Tt(t, e),
1452
1457
  toString: () => t
1453
1458
  };
1454
1459
  }
1455
- function Sr(t) {
1456
- return ut(t) && typeof t.value == "string";
1460
+ function Br(t) {
1461
+ return ft(t) && typeof t.value == "string";
1457
1462
  }
1458
- function qe(t) {
1459
- return t === void 0 ? ne("", {}) : Sr(t) ? t : ne(t, {});
1463
+ function De(t) {
1464
+ return t === void 0 ? se("", {}) : Br(t) ? t : se(t, {});
1460
1465
  }
1461
1466
  function J(t) {
1462
- const e = Ve(), n = Mt(t.name), r = _e(t.path), o = qe(t.query), a = Oe(t.hash), s = t.meta ?? {}, c = vn(t) ? t.state : {}, u = lt({ meta: {}, state: {}, ...t }), l = {
1467
+ const e = Mt(), n = It(t.name), r = We(t.path), o = De(t.query), a = Me(t.hash), s = t.meta ?? {}, u = Sn(t) ? t.state : {}, c = dt({ id: e, meta: {}, state: {}, ...t }), f = {
1463
1468
  id: e,
1464
- matched: u,
1465
- matches: [u],
1469
+ matched: c,
1470
+ matches: [c],
1466
1471
  name: n,
1467
1472
  path: r,
1468
1473
  query: o,
1469
1474
  hash: a,
1470
1475
  meta: s,
1471
- state: c,
1476
+ state: u,
1472
1477
  depth: 1,
1473
- host: je("", {}),
1478
+ host: qe("", {}),
1474
1479
  prefetch: t.prefetch
1475
- }, h = pe(t) ? me(t.parent, l) : l;
1476
- return et(h.path.params, h.query.params), h;
1480
+ }, i = ge(t) ? Re(t.parent, f) : f;
1481
+ return et(i.path.params, i.query.params), i;
1477
1482
  }
1478
- function br(t, e) {
1479
- if (!it(e))
1483
+ function Lr(t, e) {
1484
+ if (!lt(e))
1480
1485
  return t;
1481
1486
  const n = J({ path: e });
1482
1487
  return t.map((r) => J({
@@ -1484,7 +1489,7 @@ function br(t, e) {
1484
1489
  ...r
1485
1490
  }));
1486
1491
  }
1487
- class Ar extends Error {
1492
+ class Nr extends Error {
1488
1493
  /**
1489
1494
  * Constructs a new DuplicateNamesError instance with a message indicating the problematic name.
1490
1495
  * @param name - The name of the name that was duplicated.
@@ -1493,244 +1498,309 @@ class Ar extends Error {
1493
1498
  super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`);
1494
1499
  }
1495
1500
  }
1496
- function xr(t) {
1501
+ function Ur(t) {
1497
1502
  const e = t.map(({ name: n }) => n);
1498
1503
  for (const n of e)
1499
- if (he(e, n) > 1)
1500
- throw new Ar(n);
1504
+ if (me(e, n) > 1)
1505
+ throw new Nr(n);
1501
1506
  }
1502
- function Tr(t, e) {
1503
- const n = un(t) ? t.flat() : t, r = br(n, e == null ? void 0 : e.base);
1504
- xr(r);
1505
- const o = ar(r), a = On({
1507
+ function Kr(t, e) {
1508
+ const n = hn(t) ? t.flat() : t, r = Lr(n, e == null ? void 0 : e.base);
1509
+ Ur(r);
1510
+ const o = Vr(), a = lr(r), s = Dn({
1506
1511
  mode: e == null ? void 0 : e.historyMode,
1507
- listener: ({ location: y }) => {
1508
- const B = K(y);
1509
- P(B, { state: y.state });
1512
+ listener: ({ location: R }) => {
1513
+ const L = K(R);
1514
+ A(L, { state: R.state });
1510
1515
  }
1511
- }), { runBeforeRouteHooks: s, runAfterRouteHooks: c } = Dn(), {
1512
- hooks: u,
1513
- onBeforeRouteEnter: l,
1516
+ }), { runBeforeRouteHooks: u, runAfterRouteHooks: c } = Jn(), {
1517
+ hooks: f,
1518
+ onBeforeRouteEnter: i,
1514
1519
  onAfterRouteUpdate: h,
1515
- onBeforeRouteLeave: i,
1516
- onAfterRouteEnter: v,
1517
- onBeforeRouteUpdate: m,
1518
- onAfterRouteLeave: A
1519
- } = Tn();
1520
- async function P(y, B = {}) {
1521
- if (a.stopListening(), N(y))
1522
- return a.update(y, B);
1523
- const _ = Lt(r, y, B.state) ?? b("NotFound"), q = { ...f }, z = await s({ to: _, from: q, hooks: u });
1520
+ onBeforeRouteLeave: y,
1521
+ onAfterRouteEnter: p,
1522
+ onBeforeRouteUpdate: S,
1523
+ onAfterRouteLeave: E
1524
+ } = Gn();
1525
+ async function A(R, L = {}) {
1526
+ if (s.stopListening(), C(R))
1527
+ return s.update(R, L);
1528
+ const O = Nt(r, R, L.state) ?? m("NotFound"), _ = { ...d }, z = await u({ to: O, from: _, hooks: f });
1524
1529
  switch (z.status) {
1525
1530
  case "ABORT":
1526
1531
  return;
1527
1532
  case "PUSH":
1528
- a.update(y, B), await k(...z.to);
1533
+ s.update(R, L), await k(...z.to);
1529
1534
  return;
1530
1535
  case "REJECT":
1531
- a.update(y, B), R(z.type), w(_);
1536
+ s.update(R, L), b(z.type);
1532
1537
  break;
1533
1538
  case "SUCCESS":
1534
- a.update(y, B), R(null), w(_);
1539
+ s.update(R, L), b(null);
1535
1540
  break;
1536
1541
  default:
1537
1542
  throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(z)}`);
1538
1543
  }
1539
- const I = await c({ to: _, from: q, hooks: u });
1544
+ o.setProps(O), P(O);
1545
+ const I = await c({ to: O, from: _, hooks: f });
1540
1546
  switch (I.status) {
1541
1547
  case "PUSH":
1542
1548
  await k(...I.to);
1543
1549
  break;
1544
1550
  case "REJECT":
1545
- R(I.type);
1551
+ b(I.type);
1546
1552
  break;
1547
1553
  case "SUCCESS":
1548
1554
  break;
1549
1555
  default:
1550
- const W = I;
1551
- throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(W)}`);
1556
+ const q = I;
1557
+ throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(q)}`);
1552
1558
  }
1553
- a.startListening();
1559
+ s.startListening();
1554
1560
  }
1555
- const k = (y, B, _) => {
1556
- if (D(y)) {
1557
- const nt = { ...B }, xt = o(y, nt);
1558
- return P(xt, nt);
1561
+ const k = (R, L, O) => {
1562
+ if (W(R)) {
1563
+ const nt = { ...L }, Bt = a(R, nt);
1564
+ return A(Bt, nt);
1559
1565
  }
1560
- const q = { ..._ }, I = o(y, B ?? {}, q), W = bt(y), At = te((W == null ? void 0 : W.state) ?? {}, q.state);
1561
- return P(I, { ...q, state: At });
1562
- }, C = (y, B, _) => {
1563
- if (D(y)) {
1564
- const nt = { ...B, replace: !0 }, xt = o(y, nt);
1565
- return P(xt, nt);
1566
+ const _ = { ...O }, I = a(R, L ?? {}, _), q = Kt(R), kt = oe((q == null ? void 0 : q.state) ?? {}, _.state);
1567
+ return A(I, { ..._, state: kt });
1568
+ }, j = (R, L, O) => {
1569
+ if (W(R)) {
1570
+ const nt = { ...L, replace: !0 }, Bt = a(R, nt);
1571
+ return A(Bt, nt);
1566
1572
  }
1567
- const q = { ..._, replace: !0 }, I = o(y, B ?? {}, q), W = bt(y), At = te((W == null ? void 0 : W.state) ?? {}, q.state);
1568
- return P(I, { ...q, state: At });
1569
- }, O = (y) => R(y), g = (y, B = {}) => {
1570
- if (!D(y)) {
1571
- const _ = o(y, B);
1572
- return Lt(r, _);
1573
+ const _ = { ...O, replace: !0 }, I = a(R, L ?? {}, _), q = Kt(R), kt = oe((q == null ? void 0 : q.state) ?? {}, _.state);
1574
+ return A(I, { ..._, state: kt });
1575
+ }, g = (R) => b(R), v = (R, L = {}) => {
1576
+ if (!W(R)) {
1577
+ const O = a(R, L);
1578
+ return Nt(r, O);
1573
1579
  }
1574
- if (!N(y))
1575
- return Lt(r, y);
1576
- }, { setRejection: R, rejection: S, getRejectionRoute: b } = Fn(e ?? {}), d = b("NotFound"), { currentRoute: f, routerRoute: p, updateRoute: w } = $n(d, k);
1577
- a.startListening();
1578
- const E = cr(e == null ? void 0 : e.initialUrl), x = a.location.state, { host: L } = M(E), N = jn(L), H = P(E, { replace: !0, state: x });
1579
- function bt(y) {
1580
- return r.find((B) => B.name === y);
1581
- }
1582
- function Ie(y) {
1583
- y.component("RouterView", _r), y.component("RouterLink", Or), y.provide(Ee, S), y.provide(be, u), y.provide(le, Jt);
1584
- }
1585
- const Jt = {
1586
- route: p,
1587
- resolve: o,
1580
+ if (!C(R))
1581
+ return Nt(r, R);
1582
+ }, { setRejection: b, rejection: x, getRejectionRoute: m } = Yn(e ?? {}), l = m("NotFound"), { currentRoute: d, routerRoute: w, updateRoute: P } = _n(l, k);
1583
+ s.startListening();
1584
+ const B = pr(e == null ? void 0 : e.initialUrl), N = s.location.state, { host: $ } = D(B), C = Wn($);
1585
+ let xt = !1;
1586
+ async function Gt() {
1587
+ xt || (await A(B, { replace: !0, state: N }), xt = !0);
1588
+ }
1589
+ function Kt(R) {
1590
+ return r.find((L) => L.name === R);
1591
+ }
1592
+ function ze(R) {
1593
+ R.component("RouterView", Ir), R.component("RouterLink", Tr), R.provide(be, x), R.provide(Be, f), R.provide(Fe, o), R.provide(Ae, zt), Gt();
1594
+ }
1595
+ const zt = {
1596
+ route: w,
1597
+ resolve: a,
1588
1598
  push: k,
1589
- replace: C,
1590
- reject: O,
1591
- find: g,
1592
- refresh: a.refresh,
1593
- forward: a.forward,
1594
- back: a.back,
1595
- go: a.go,
1596
- install: Ie,
1597
- initialized: H,
1598
- isExternal: N,
1599
- onBeforeRouteEnter: l,
1599
+ replace: j,
1600
+ reject: g,
1601
+ find: v,
1602
+ refresh: s.refresh,
1603
+ forward: s.forward,
1604
+ back: s.back,
1605
+ go: s.go,
1606
+ install: ze,
1607
+ isExternal: C,
1608
+ onBeforeRouteEnter: i,
1600
1609
  onAfterRouteUpdate: h,
1601
- onBeforeRouteLeave: i,
1602
- onAfterRouteEnter: v,
1603
- onBeforeRouteUpdate: m,
1604
- onAfterRouteLeave: A,
1605
- prefetch: e == null ? void 0 : e.prefetch
1610
+ onBeforeRouteLeave: y,
1611
+ onAfterRouteEnter: p,
1612
+ onBeforeRouteUpdate: S,
1613
+ onAfterRouteLeave: E,
1614
+ prefetch: e == null ? void 0 : e.prefetch,
1615
+ start: Gt
1606
1616
  };
1607
- return Jt;
1617
+ return zt;
1608
1618
  }
1609
- const wt = { template: "<div>This is component</div>" }, Tt = J({
1619
+ const Et = { template: "<div>This is component</div>" }, Ft = J({
1610
1620
  name: "parentA",
1611
1621
  path: "/parentA/[paramA]"
1612
- }), We = J({
1613
- parent: Tt,
1622
+ }), Te = J({
1623
+ parent: Ft,
1614
1624
  name: "parentA.childA",
1615
1625
  path: "/[?paramB]"
1616
- }), kr = J({
1617
- parent: Tt,
1626
+ }), Cr = J({
1627
+ parent: Ft,
1618
1628
  name: "parentA.childB",
1619
1629
  path: "/[paramD]",
1620
- component: wt
1621
- }), Br = J({
1622
- parent: We,
1630
+ component: Et
1631
+ }), $r = J({
1632
+ parent: Te,
1623
1633
  name: "parentA.childA.grandChildA",
1624
1634
  path: "/[paramC]",
1625
- component: wt
1635
+ component: Et
1626
1636
  });
1627
1637
  J({
1628
1638
  name: "parentB",
1629
1639
  path: "/parentB",
1630
- component: wt
1640
+ component: Et
1631
1641
  }), J({
1632
1642
  name: "parentC",
1633
1643
  path: "/",
1634
- component: wt
1644
+ component: Et
1635
1645
  });
1636
- const Lr = {
1637
- components: !0
1646
+ const Hr = {
1647
+ components: !0,
1648
+ props: !1
1638
1649
  };
1639
- function Nr({ routerPrefetch: t, routePrefetch: e, linkPrefetch: n }, r) {
1640
- return Nt(n, r) ?? Nt(e, r) ?? Nt(t, r) ?? Lr[r];
1650
+ function Ie({ routerPrefetch: t, routePrefetch: e, linkPrefetch: n }, r) {
1651
+ return Ut(n, r) ?? Ut(e, r) ?? Ut(t, r) ?? Hr[r];
1652
+ }
1653
+ function Ut(t, e) {
1654
+ return ft(t) ? t[e] : t;
1655
+ }
1656
+ const Fe = Symbol();
1657
+ function Vr() {
1658
+ const t = $t(/* @__PURE__ */ new Map()), e = (c, f) => c.matches.filter((i) => Ie({ ...f, routePrefetch: i.prefetch }, "props")).flatMap((i) => s(i)).reduce((i, { id: h, name: y, props: p }) => {
1659
+ const S = a(h, y, c);
1660
+ return i[S] = p == null ? void 0 : p(c.params), i;
1661
+ }, {}), n = (c) => {
1662
+ Object.entries(c).forEach(([f, i]) => {
1663
+ t.set(f, i);
1664
+ });
1665
+ }, r = (c) => {
1666
+ const i = c.matches.flatMap(s).reduce((h, { id: y, name: p, props: S }) => {
1667
+ const E = a(y, p, c);
1668
+ if (!S || t.has(E))
1669
+ return h;
1670
+ const A = S(c.params);
1671
+ return t.set(E, A), h.push(E), h;
1672
+ }, []);
1673
+ u(i);
1674
+ }, o = (c, f, i) => {
1675
+ const h = a(c, f, i);
1676
+ return t.get(h);
1677
+ };
1678
+ function a(c, f, i) {
1679
+ return [c, f, i.id, JSON.stringify(i.params)].join("-");
1680
+ }
1681
+ function s(c) {
1682
+ return Vt(c) ? Object.entries(c.props ?? {}).map(([f, i]) => ({ id: c.id, name: f, props: i })) : Ht(c) ? [
1683
+ {
1684
+ id: c.id,
1685
+ name: "default",
1686
+ props: c.props
1687
+ }
1688
+ ] : [];
1689
+ }
1690
+ function u(c) {
1691
+ for (const f in t.keys())
1692
+ c.includes(f) || t.delete(f);
1693
+ }
1694
+ return {
1695
+ getPrefetchProps: e,
1696
+ setPrefetchProps: n,
1697
+ getProps: o,
1698
+ setProps: r
1699
+ };
1641
1700
  }
1642
- function Nt(t, e) {
1643
- return ut(t) ? t[e] : t;
1701
+ function Je() {
1702
+ const t = it(Fe);
1703
+ if (!t)
1704
+ throw new St();
1705
+ return t;
1644
1706
  }
1645
- const Ur = Ke(() => new Promise((t) => {
1646
- t({ default: { template: "" } });
1707
+ const jr = tn(() => new Promise((t) => {
1708
+ t({ default: { template: "foo" } });
1647
1709
  }));
1648
- function re(t) {
1649
- return t.name === Ur.name && "setup" in t;
1650
- }
1651
- function Cr(t, e = {}, n = {}) {
1652
- const r = Vt(), o = ze(t), a = j(() => D(o.value) ? {} : kt(e)), s = j(() => D(o.value) ? kt(e) : kt(n)), c = j(() => {
1653
- if (D(o.value))
1654
- return o.value;
1655
- try {
1656
- return r.resolve(o.value, a.value, s.value);
1657
- } catch (i) {
1658
- throw i instanceof X && console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`, i), i;
1659
- }
1660
- }), u = j(() => r.find(c.value, s.value)), l = j(() => !!u.value && r.route.matches.includes(u.value.matched)), h = j(() => !!u.value && r.route.matched === u.value.matched);
1661
- return se(u, (i) => {
1662
- if (!i)
1663
- return;
1664
- const { prefetch: v } = r, { prefetch: m } = s.value;
1665
- $r(i, {
1666
- routerPrefetch: v,
1667
- linkPrefetch: m
1668
- });
1710
+ function ce(t) {
1711
+ return t.name === jr.name && "setup" in t;
1712
+ }
1713
+ function Or(t) {
1714
+ let e = {};
1715
+ const { getPrefetchProps: n, setPrefetchProps: r } = Je();
1716
+ return fe(() => ht(t), ({ route: a, ...s }) => {
1717
+ a && (_r(a, s), e = n(a, s));
1669
1718
  }, { immediate: !0 }), {
1670
- route: u,
1671
- href: c,
1672
- isMatch: l,
1673
- isExactMatch: h,
1674
- push: (i) => r.push(c.value, {}, { ...s.value, ...i }),
1675
- replace: (i) => r.replace(c.value, {}, { ...s.value, ...i })
1719
+ commit: () => {
1720
+ r(e);
1721
+ }
1676
1722
  };
1677
1723
  }
1678
- function $r(t, { routerPrefetch: e, linkPrefetch: n }) {
1724
+ function _r(t, { routerPrefetch: e, linkPrefetch: n }) {
1679
1725
  t.matches.forEach((r) => {
1680
- Nr({
1726
+ Ie({
1681
1727
  routePrefetch: r.prefetch,
1682
1728
  routerPrefetch: e,
1683
1729
  linkPrefetch: n
1684
- }, "components") && (Ut(r) && re(r.component) && r.component.setup(), Ct(r) && Object.values(r.components).forEach((a) => {
1685
- re(a) && a.setup();
1730
+ }, "components") && (Ht(r) && ce(r.component) && r.component.setup(), Vt(r) && Object.values(r.components).forEach((a) => {
1731
+ ce(a) && a.setup();
1686
1732
  }));
1687
1733
  });
1688
1734
  }
1689
- function Hr(t, e, { exact: n } = {}) {
1690
- if (!Un(t))
1735
+ function qr(t, e = {}, n = {}) {
1736
+ const r = jt(), o = en(t), a = V(() => W(o.value) ? {} : ht(e)), s = V(() => W(o.value) ? ht(e) : ht(n)), u = V(() => {
1737
+ if (W(o.value))
1738
+ return o.value;
1739
+ try {
1740
+ return r.resolve(o.value, a.value, s.value);
1741
+ } catch (E) {
1742
+ throw E instanceof X && console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`, E), E;
1743
+ }
1744
+ }), c = V(() => r.find(u.value, s.value)), f = V(() => !!c.value && r.route.matches.includes(c.value.matched)), i = V(() => !!c.value && r.route.matched === c.value.matched), h = V(() => r.isExternal(u.value)), { commit: y } = Or(() => ({
1745
+ route: c.value,
1746
+ routerPrefetch: r.prefetch,
1747
+ linkPrefetch: s.value.prefetch
1748
+ })), p = (E) => (y(), r.push(u.value, { ...s.value, ...E }));
1749
+ return {
1750
+ route: c,
1751
+ href: u,
1752
+ isMatch: f,
1753
+ isExactMatch: i,
1754
+ isExternal: h,
1755
+ push: p,
1756
+ replace: (E) => p(E)
1757
+ };
1758
+ }
1759
+ function Mr(t, e, { exact: n } = {}) {
1760
+ if (!jn(t))
1691
1761
  return !1;
1692
1762
  if (e === void 0)
1693
1763
  return !0;
1694
- const r = t.matches.map((o) => Mt(o.name));
1764
+ const r = t.matches.map((o) => It(o.name));
1695
1765
  if (n) {
1696
1766
  const o = r.at(-1);
1697
1767
  return e === o;
1698
1768
  }
1699
1769
  return r.includes(e);
1700
1770
  }
1701
- function Vr(t, e) {
1702
- const n = Vt();
1771
+ function Wr(t, e) {
1772
+ const n = jt();
1703
1773
  function r() {
1704
1774
  if (!t)
1705
1775
  return;
1706
- if (!Hr(n.route, t, e))
1707
- throw new cn(t, n.route.name);
1776
+ if (!Mr(n.route, t, e))
1777
+ throw new Hn(t, n.route.name);
1708
1778
  }
1709
- return se(n.route, r, { immediate: !0, deep: !0 }), n.route;
1779
+ return fe(n.route, r, { immediate: !0, deep: !0 }), n.route;
1710
1780
  }
1711
- const De = Symbol();
1712
- function It() {
1713
- return Et(De, 0);
1781
+ const Qe = Symbol();
1782
+ function Jt() {
1783
+ return it(Qe, 0);
1714
1784
  }
1715
- function Me() {
1716
- const t = Et(be);
1785
+ function Ge() {
1786
+ const t = it(Be);
1717
1787
  if (!t)
1718
- throw new Ht();
1788
+ throw new St();
1719
1789
  return t;
1720
1790
  }
1721
- function Te(t) {
1791
+ function Ke(t) {
1722
1792
  return (e) => {
1723
- const n = It(), o = Me().addBeforeRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
1724
- return ce(o), o;
1793
+ const n = Jt(), o = Ge().addBeforeRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
1794
+ return le(o), o;
1725
1795
  };
1726
1796
  }
1727
- function Ft(t) {
1797
+ function Qt(t) {
1728
1798
  return (e) => {
1729
- const n = It(), o = Me().addAfterRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
1730
- return ce(o), o;
1799
+ const n = Jt(), o = Ge().addAfterRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
1800
+ return le(o), o;
1731
1801
  };
1732
1802
  }
1733
- const Ir = Te("onBeforeRouteUpdate"), Fr = Te("onBeforeRouteLeave"), Jr = Ft("onAfterRouteEnter"), Qr = Ft("onAfterRouteUpdate"), Gr = Ft("onAfterRouteLeave"), jr = ["href"], Or = /* @__PURE__ */ ct({
1803
+ const zr = Ke("onBeforeRouteUpdate"), Yr = Ke("onBeforeRouteLeave"), Xr = Qt("onAfterRouteEnter"), Zr = Qt("onAfterRouteUpdate"), to = Qt("onAfterRouteLeave"), Dr = ["href"], Tr = /* @__PURE__ */ ut({
1734
1804
  __name: "routerLink",
1735
1805
  props: {
1736
1806
  to: {},
@@ -1741,105 +1811,99 @@ const Ir = Te("onBeforeRouteUpdate"), Fr = Te("onBeforeRouteLeave"), Jr = Ft("on
1741
1811
  state: {}
1742
1812
  },
1743
1813
  setup(t) {
1744
- const e = t, n = Vt(), r = j(() => D(e.to) ? e.to : e.to(n.resolve)), o = j(() => {
1745
- const { to: i, ...v } = e;
1746
- return v;
1747
- }), { href: a, isMatch: s, isExactMatch: c } = Cr(r, o), u = j(() => ({
1748
- "router-link--match": s.value,
1749
- "router-link--exact-match": c.value
1750
- })), l = j(() => n.isExternal(r.value));
1751
- function h(i) {
1752
- i.preventDefault(), n.push(a.value, o.value);
1814
+ const e = t, n = jt(), r = V(() => W(e.to) ? e.to : e.to(n.resolve)), o = V(() => {
1815
+ const { to: h, ...y } = e;
1816
+ return y;
1817
+ }), { isMatch: a, isExactMatch: s, isExternal: u, push: c } = qr(r, o), f = V(() => ({
1818
+ "router-link--match": a.value,
1819
+ "router-link--exact-match": s.value
1820
+ }));
1821
+ function i(h) {
1822
+ h.preventDefault(), c();
1753
1823
  }
1754
- return (i, v) => (ue(), Ye("a", {
1824
+ return (h, y) => (he(), nn("a", {
1755
1825
  href: r.value,
1756
- class: Xe(["router-link", u.value]),
1757
- onClick: h
1826
+ class: rn(["router-link", f.value]),
1827
+ onClick: i
1758
1828
  }, [
1759
- ie(i.$slots, "default", fe(Ze({ resolved: r.value, isMatch: ht(s), isExactMatch: ht(c), isExternal: l.value })))
1760
- ], 10, jr));
1829
+ pe(h.$slots, "default", de(on({ resolved: r.value, isMatch: ot(a), isExactMatch: ot(s), isExternal: ot(u) })))
1830
+ ], 10, Dr));
1761
1831
  }
1762
- }), _r = /* @__PURE__ */ ct({
1832
+ }), Ir = /* @__PURE__ */ ut({
1763
1833
  __name: "routerView",
1764
1834
  props: {
1765
1835
  name: {}
1766
1836
  },
1767
1837
  setup(t) {
1768
- const { name: e = "default" } = t, n = Vr(), r = Nn(), o = It(), a = tn("RouterView", !0);
1769
- en(De, o + 1);
1770
- const s = j(() => {
1838
+ const { name: e = "default" } = t, n = Wr(), r = Vn(), o = Jt(), { getProps: a } = Je(), s = an("RouterView", !0);
1839
+ sn(Qe, o + 1);
1840
+ const u = V(() => {
1771
1841
  if (r.value)
1772
1842
  return r.value.component;
1773
1843
  const i = n.matches.at(o);
1774
1844
  if (!i)
1775
1845
  return null;
1776
- const v = c(i), m = l(i);
1777
- return v ? m ? (n.params, wn(v, () => m(n.params))) : v : null;
1846
+ const h = c(i), y = a(i.id, e, n);
1847
+ return h ? y ? bn(h, () => y) : h : null;
1778
1848
  });
1779
1849
  function c(i) {
1780
- return u(i)[e];
1781
- }
1782
- function u(i) {
1783
- return Ct(i) ? i.components : Ut(i) ? { default: i.component } : typeof a == "string" ? {} : { default: a };
1784
- }
1785
- function l(i) {
1786
- return h(i)[e];
1850
+ return f(i)[e];
1787
1851
  }
1788
- function h(i) {
1789
- return Ct(i) ? i.props ?? {} : Ut(i) ? { default: i.props } : {};
1852
+ function f(i) {
1853
+ return Vt(i) ? i.components : Ht(i) ? { default: i.component } : typeof s == "string" ? {} : { default: s };
1790
1854
  }
1791
- return (i, v) => s.value ? ie(i.$slots, "default", fe(nn({ key: 0 }, { route: ht(n), component: s.value, rejection: ht(r) })), () => [
1792
- (ue(), rn(on(s.value)))
1793
- ]) : an("", !0);
1855
+ return (i, h) => u.value ? pe(i.$slots, "default", de(cn({ key: 0 }, { route: ot(n), component: u.value, rejection: ot(r) })), () => [
1856
+ (he(), un(fn(u.value)))
1857
+ ]) : ln("", !0);
1794
1858
  }
1795
1859
  });
1796
- function qr(t) {
1797
- return ut(t) && typeof t.value == "string";
1860
+ function Fr(t) {
1861
+ return ft(t) && typeof t.value == "string";
1798
1862
  }
1799
- function oe(t) {
1800
- return qr(t) ? t : je(t, {});
1863
+ function ue(t) {
1864
+ return Fr(t) ? t : qe(t, {});
1801
1865
  }
1802
- function Kr(t) {
1803
- const e = Ve(), n = Mt(t.name), r = _e(t.path), o = qe(t.query), a = Oe(t.hash), s = t.meta ?? {}, c = yn(t) ? oe(t.host) : oe(""), u = lt({ meta: {}, state: {}, ...t }), l = {
1866
+ function eo(t) {
1867
+ const e = Mt(), n = It(t.name), r = We(t.path), o = De(t.query), a = Me(t.hash), s = t.meta ?? {}, u = En(t) ? ue(t.host) : ue(""), c = dt({ id: e, meta: {}, state: {}, ...t }), f = {
1804
1868
  id: e,
1805
- matched: u,
1806
- matches: [u],
1869
+ matched: c,
1870
+ matches: [c],
1807
1871
  name: n,
1808
- host: c,
1872
+ host: u,
1809
1873
  path: r,
1810
1874
  query: o,
1811
1875
  hash: a,
1812
1876
  meta: s,
1813
1877
  depth: 1,
1814
1878
  state: {}
1815
- }, h = pe(t) ? me(t.parent, l) : l;
1816
- return et(h.path.params, h.query.params, h.host.params), h;
1879
+ }, i = ge(t) ? Re(t.parent, f) : f;
1880
+ return et(i.path.params, i.query.params, i.host.params), i;
1817
1881
  }
1818
1882
  export {
1819
- sn as DuplicateParamsError,
1820
- Or as RouterLink,
1821
- Ht as RouterNotInstalledError,
1822
- _r as RouterView,
1823
- cn as UseRouteInvalidError,
1824
- wn as component,
1825
- Kr as createExternalRoute,
1826
- kn as createParam,
1883
+ Rn as DuplicateParamsError,
1884
+ Tr as RouterLink,
1885
+ St as RouterNotInstalledError,
1886
+ Ir as RouterView,
1887
+ Hn as UseRouteInvalidError,
1888
+ bn as component,
1889
+ eo as createExternalRoute,
1890
+ Un as createParam,
1827
1891
  J as createRoute,
1828
- Tr as createRouter,
1829
- bn as isParamWithDefault,
1830
- Hr as isRoute,
1831
- Jr as onAfterRouteEnter,
1832
- Qr as onAfterRouteLeave,
1833
- Gr as onAfterRouteUpdate,
1834
- Ir as onBeforeRouteLeave,
1835
- Fr as onBeforeRouteUpdate,
1836
- ee as path,
1837
- ne as query,
1838
- le as routerInjectionKey,
1839
- Ee as routerRejectionKey,
1840
- Cr as useLink,
1841
- Nn as useRejection,
1842
- Vr as useRoute,
1843
- Vt as useRouter,
1844
- Mr as withDefault
1892
+ Kr as createRouter,
1893
+ Bn as isParamWithDefault,
1894
+ Mr as isRoute,
1895
+ Xr as onAfterRouteEnter,
1896
+ Zr as onAfterRouteLeave,
1897
+ to as onAfterRouteUpdate,
1898
+ zr as onBeforeRouteLeave,
1899
+ Yr as onBeforeRouteUpdate,
1900
+ ae as path,
1901
+ se as query,
1902
+ Ae as routerInjectionKey,
1903
+ be as routerRejectionKey,
1904
+ qr as useLink,
1905
+ Vn as useRejection,
1906
+ Wr as useRoute,
1907
+ jt as useRouter,
1908
+ Gr as withDefault
1845
1909
  };