@kitbag/router 0.10.1 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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);
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);
749
+ if (!t)
750
+ throw new St();
751
+ return t;
752
+ }
753
+ const Ae = Symbol();
754
+ function jt() {
755
+ const t = it(Ae);
756
756
  if (!t)
757
- throw new Ht();
757
+ throw new St();
758
758
  return t;
759
759
  }
760
- const Pe = Symbol("isRouterRouteSymbol");
761
- function Un(t) {
762
- return typeof t == "object" && t !== null && Pe in t;
760
+ const xe = Symbol("isRouterRouteSymbol");
761
+ function jn(t) {
762
+ return typeof t == "object" && t !== null && xe in t;
763
763
  }
764
- function Cn(t, e) {
765
- function n(i, v, m) {
766
- if (typeof i == "object") {
767
- const P = {
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,22 @@ 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
+ n.replace(c, f.state);
850
+ return;
851
+ }
852
+ n.push(c, f == null ? void 0 : f.state);
850
853
  }, o = () => {
851
- const u = K(n.location);
852
- return n.replace(u);
854
+ const c = K(n.location);
855
+ n.replace(c);
853
856
  };
854
857
  let a;
855
858
  return {
@@ -864,154 +867,154 @@ function On({ mode: t, listener: e }) {
864
867
  }
865
868
  };
866
869
  }
867
- function _n(t = "auto") {
870
+ function Tn(t = "auto") {
868
871
  switch (t) {
869
872
  case "auto":
870
- return de() ? Qt() : Gt();
873
+ return ye() ? Yt() : Xt();
871
874
  case "browser":
872
- return Qt();
875
+ return Yt();
873
876
  case "memory":
874
- return Gt();
877
+ return Xt();
875
878
  case "hash":
876
- return Ln();
879
+ return $n();
877
880
  default:
878
881
  const e = t;
879
882
  throw new Error(`Switch is not exhaustive for mode: ${e}`);
880
883
  }
881
884
  }
882
- class Rt {
885
+ class vt {
883
886
  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());
887
+ M(this, "onBeforeRouteEnter", /* @__PURE__ */ new Set());
888
+ M(this, "onBeforeRouteUpdate", /* @__PURE__ */ new Set());
889
+ M(this, "onBeforeRouteLeave", /* @__PURE__ */ new Set());
890
+ M(this, "onAfterRouteEnter", /* @__PURE__ */ new Set());
891
+ M(this, "onAfterRouteUpdate", /* @__PURE__ */ new Set());
892
+ M(this, "onAfterRouteLeave", /* @__PURE__ */ new Set());
890
893
  }
891
894
  }
892
- class zt extends Error {
895
+ class te extends Error {
893
896
  }
894
897
  class rt extends Error {
895
898
  constructor(n) {
896
899
  super("Error occurred during a router push operation.");
897
- V(this, "to");
900
+ M(this, "to");
898
901
  this.to = n;
899
902
  }
900
903
  }
901
- class Bt extends Error {
904
+ class Lt extends Error {
902
905
  constructor(n) {
903
906
  super(`Routing action rejected: ${n}`);
904
- V(this, "type");
907
+ M(this, "type");
905
908
  this.type = n;
906
909
  }
907
910
  }
908
- function qn(t, e) {
909
- const n = new Rt();
911
+ function In(t, e) {
912
+ const n = new vt();
910
913
  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));
914
+ 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
915
  }), e.matches.forEach((r, o) => {
913
- r.onBeforeRouteLeave && Ot(t, e, o) && Y(r.onBeforeRouteLeave).forEach((a) => n.onBeforeRouteLeave.add(a));
916
+ r.onBeforeRouteLeave && _t(t, e, o) && Y(r.onBeforeRouteLeave).forEach((a) => n.onBeforeRouteLeave.add(a));
914
917
  }), n;
915
918
  }
916
- function Wn(t, e) {
917
- const n = new Rt();
919
+ function Fn(t, e) {
920
+ const n = new vt();
918
921
  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));
922
+ 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
923
  }), e.matches.forEach((r, o) => {
921
- r.onAfterRouteLeave && Ot(t, e, o) && Y(r.onAfterRouteLeave).forEach((a) => n.onAfterRouteLeave.add(a));
924
+ r.onAfterRouteLeave && _t(t, e, o) && Y(r.onAfterRouteLeave).forEach((a) => n.onAfterRouteLeave.add(a));
922
925
  }), n;
923
926
  }
924
- function D(t) {
927
+ function W(t) {
925
928
  return typeof t != "string" ? !1 : /^(https?:\/\/|\/).*/g.test(t);
926
929
  }
927
- function Dn() {
930
+ function Jn() {
928
931
  const t = (s) => {
929
- throw new Bt(s);
932
+ throw new Lt(s);
930
933
  }, e = (...s) => {
931
934
  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 }]);
935
+ }, n = (s, u, c) => {
936
+ if (W(s)) {
937
+ const h = u ?? {};
938
+ throw new rt([s, { ...h, replace: !0 }]);
936
939
  }
937
- const l = c, h = u ?? {};
938
- throw new rt([s, l, { ...h, replace: !0 }]);
940
+ const f = u, i = c ?? {};
941
+ throw new rt([s, f, { ...i, replace: !0 }]);
939
942
  }, r = () => {
940
- throw new zt();
943
+ throw new te();
941
944
  };
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,
945
+ async function o({ to: s, from: u, hooks: c }) {
946
+ const { global: f, component: i } = c, h = In(s, u), y = [
947
+ ...f.onBeforeRouteEnter,
948
+ ...h.onBeforeRouteEnter,
949
+ ...f.onBeforeRouteUpdate,
948
950
  ...h.onBeforeRouteUpdate,
949
- ...l.onBeforeRouteLeave,
950
- ...i.onBeforeRouteLeave,
951
- ...h.onBeforeRouteLeave
951
+ ...i.onBeforeRouteUpdate,
952
+ ...f.onBeforeRouteLeave,
953
+ ...h.onBeforeRouteLeave,
954
+ ...i.onBeforeRouteLeave
952
955
  ];
953
956
  try {
954
- const m = v.map((A) => A(s, {
955
- from: c,
957
+ const p = y.map((S) => S(s, {
958
+ from: u,
956
959
  reject: t,
957
960
  push: e,
958
961
  replace: n,
959
962
  abort: r
960
963
  }));
961
- await Promise.all(m);
962
- } catch (m) {
963
- if (m instanceof rt)
964
+ await Promise.all(p);
965
+ } catch (p) {
966
+ if (p instanceof rt)
964
967
  return {
965
968
  status: "PUSH",
966
- to: m.to
969
+ to: p.to
967
970
  };
968
- if (m instanceof Bt)
971
+ if (p instanceof Lt)
969
972
  return {
970
973
  status: "REJECT",
971
- type: m.type
974
+ type: p.type
972
975
  };
973
- if (m instanceof zt)
976
+ if (p instanceof te)
974
977
  return {
975
978
  status: "ABORT"
976
979
  };
977
- throw m;
980
+ throw p;
978
981
  }
979
982
  return {
980
983
  status: "SUCCESS"
981
984
  };
982
985
  }
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,
986
+ async function a({ to: s, from: u, hooks: c }) {
987
+ const { global: f, component: i } = c, h = Fn(s, u), y = [
986
988
  ...i.onAfterRouteLeave,
987
- ...l.onAfterRouteLeave,
988
- ...h.onAfterRouteUpdate,
989
+ ...h.onAfterRouteLeave,
990
+ ...f.onAfterRouteLeave,
989
991
  ...i.onAfterRouteUpdate,
990
- ...l.onAfterRouteUpdate,
991
- ...h.onAfterRouteEnter,
992
+ ...h.onAfterRouteUpdate,
993
+ ...f.onAfterRouteUpdate,
992
994
  ...i.onAfterRouteEnter,
993
- ...l.onAfterRouteEnter
995
+ ...h.onAfterRouteEnter,
996
+ ...f.onAfterRouteEnter
994
997
  ];
995
998
  try {
996
- const m = v.map((A) => A(s, {
997
- from: c,
999
+ const p = y.map((S) => S(s, {
1000
+ from: u,
998
1001
  reject: t,
999
1002
  push: e,
1000
1003
  replace: n
1001
1004
  }));
1002
- await Promise.all(m);
1003
- } catch (m) {
1004
- if (m instanceof rt)
1005
+ await Promise.all(p);
1006
+ } catch (p) {
1007
+ if (p instanceof rt)
1005
1008
  return {
1006
1009
  status: "PUSH",
1007
- to: m.to
1010
+ to: p.to
1008
1011
  };
1009
- if (m instanceof Bt)
1012
+ if (p instanceof Lt)
1010
1013
  return {
1011
1014
  status: "REJECT",
1012
- type: m.type
1015
+ type: p.type
1013
1016
  };
1014
- throw m;
1017
+ throw p;
1015
1018
  }
1016
1019
  return {
1017
1020
  status: "SUCCESS"
@@ -1022,97 +1025,105 @@ function Dn() {
1022
1025
  runAfterRouteHooks: a
1023
1026
  };
1024
1027
  }
1025
- const jt = (t, e, n) => {
1028
+ const Ot = (t, e, n) => {
1026
1029
  const r = t.matches, o = (e == null ? void 0 : e.matches) ?? [];
1027
1030
  return r.length < n || r[n] !== o[n];
1028
- }, Ot = (t, e, n) => {
1031
+ }, _t = (t, e, n) => {
1029
1032
  const r = t.matches, o = (e == null ? void 0 : e.matches) ?? [];
1030
1033
  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) {
1034
+ }, qt = (t, e, n) => t.matches[n] === (e == null ? void 0 : e.matches[n]);
1035
+ function ee(t) {
1033
1036
  switch (t) {
1034
1037
  case "onBeforeRouteEnter":
1035
1038
  case "onAfterRouteEnter":
1036
- return jt;
1039
+ return Ot;
1037
1040
  case "onBeforeRouteUpdate":
1038
1041
  case "onAfterRouteUpdate":
1039
- return _t;
1042
+ return qt;
1040
1043
  case "onBeforeRouteLeave":
1041
1044
  case "onAfterRouteLeave":
1042
- return Ot;
1045
+ return _t;
1043
1046
  default:
1044
1047
  throw new Error(`Switch is not exhaustive for lifecycle: ${t}`);
1045
1048
  }
1046
1049
  }
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);
1050
+ function Qn() {
1051
+ const t = {
1052
+ global: new vt(),
1053
+ component: new vt()
1054
+ };
1055
+ function e({ lifecycle: r, timing: o, depth: a, hook: s }) {
1056
+ const u = ee(r), c = t[o][r], f = (i, h) => {
1057
+ if (u(i, h.from, a))
1058
+ return s(i, h);
1056
1059
  };
1057
- return s.add(c), () => s.delete(c);
1060
+ return c.add(f), () => c.delete(f);
1058
1061
  }
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);
1062
+ function n({ lifecycle: r, timing: o, depth: a, hook: s }) {
1063
+ const u = ee(r), c = t[o][r], f = (i, h) => {
1064
+ if (u(i, h.from, a))
1065
+ return s(i, h);
1063
1066
  };
1064
- return s.add(c), () => s.delete(c);
1067
+ return c.add(f), () => c.delete(f);
1065
1068
  }
1069
+ return { ...t, addBeforeRouteHook: e, addAfterRouteHook: n };
1066
1070
  }
1067
- const be = Symbol();
1068
- function Tn() {
1069
- const t = new Mn();
1071
+ const Be = Symbol();
1072
+ function Gn() {
1073
+ const t = Qn();
1070
1074
  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 }),
1075
+ onBeforeRouteEnter: (u) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteEnter", hook: u, timing: "global", depth: 0 }),
1076
+ onBeforeRouteUpdate: (u) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteUpdate", hook: u, timing: "global", depth: 0 }),
1077
+ onBeforeRouteLeave: (u) => t.addBeforeRouteHook({ lifecycle: "onBeforeRouteLeave", hook: u, timing: "global", depth: 0 }),
1078
+ onAfterRouteEnter: (u) => t.addAfterRouteHook({ lifecycle: "onAfterRouteEnter", hook: u, timing: "global", depth: 0 }),
1079
+ onAfterRouteUpdate: (u) => t.addAfterRouteHook({ lifecycle: "onAfterRouteUpdate", hook: u, timing: "global", depth: 0 }),
1080
+ onAfterRouteLeave: (u) => t.addAfterRouteHook({ lifecycle: "onAfterRouteLeave", hook: u, timing: "global", depth: 0 }),
1077
1081
  hooks: t
1078
1082
  };
1079
1083
  }
1080
- function In(t) {
1081
- return ct(() => () => ft("h1", t), {
1084
+ function Kn(t) {
1085
+ return ut(() => () => pt("h1", t), {
1082
1086
  name: t,
1083
1087
  props: []
1084
1088
  });
1085
1089
  }
1086
- function Ae(t) {
1090
+ function Le(t) {
1087
1091
  const e = new URLSearchParams(t);
1088
1092
  return {
1089
1093
  get: (n) => e.get(n),
1090
1094
  getAll: (n) => e.getAll(n)
1091
1095
  };
1092
1096
  }
1093
- function Fn({
1097
+ function zn() {
1098
+ let t = 0;
1099
+ return () => (++t).toString();
1100
+ }
1101
+ const Mt = zn();
1102
+ function Yn({
1094
1103
  rejections: t
1095
1104
  }) {
1096
1105
  const e = (a) => {
1097
1106
  const s = {
1098
1107
  ...t
1099
1108
  };
1100
- return lt(s[a] ?? In(a));
1109
+ return dt(s[a] ?? Kn(a));
1101
1110
  }, n = (a) => {
1102
- const s = lt(e(a)), c = {
1111
+ const s = dt(e(a)), u = {
1112
+ id: Mt(),
1103
1113
  name: a,
1104
1114
  component: s,
1105
1115
  meta: {},
1106
1116
  state: {}
1107
1117
  };
1108
1118
  return {
1109
- matched: c,
1110
- matches: [c],
1119
+ id: u.id,
1120
+ matched: u,
1121
+ matches: [u],
1111
1122
  name: a,
1112
- query: Ae(""),
1123
+ query: Le(""),
1113
1124
  params: {},
1114
1125
  state: {},
1115
- [Se]: !0
1126
+ [ke]: !0
1116
1127
  };
1117
1128
  }, r = (a) => {
1118
1129
  if (!a) {
@@ -1121,102 +1132,102 @@ function Fn({
1121
1132
  }
1122
1133
  const s = e(a);
1123
1134
  o.value = { type: a, component: s };
1124
- }, o = Ge(null);
1135
+ }, o = ie(null);
1125
1136
  return {
1126
1137
  setRejection: r,
1127
1138
  rejection: o,
1128
1139
  getRejectionRoute: n
1129
1140
  };
1130
1141
  }
1131
- class Jn extends Error {
1142
+ class Xn extends Error {
1132
1143
  constructor(e) {
1133
1144
  super(`Route not found: "${e}"`);
1134
1145
  }
1135
1146
  }
1136
- function qt(t) {
1147
+ function Wt(t) {
1137
1148
  return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1138
1149
  }
1139
- function Qn(t, e) {
1150
+ function Zn(t, e) {
1140
1151
  const n = Array.from(t.matchAll(e));
1141
1152
  if (n.length === 0)
1142
1153
  return [t];
1143
1154
  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;
1155
+ const o = n.reduce((s, u) => {
1156
+ const c = Wt(t.slice(r, u.index));
1157
+ c.length && s.push(c);
1158
+ const [f] = u;
1159
+ return s.push(f), r = u.index + f.length, s;
1149
1160
  }, []), a = t.slice(r);
1150
1161
  return a && o.push(a), o;
1151
1162
  }
1152
- function Gn(t) {
1153
- const e = xe(t.path.toString());
1163
+ function tr(t) {
1164
+ const e = Ne(t.path.toString());
1154
1165
  return new RegExp(`^${e}$`, "i");
1155
1166
  }
1156
- function Kn(t) {
1167
+ function er(t) {
1157
1168
  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");
1169
+ return Array.from(e.entries()).filter(([, n]) => !Ct(n)).map(([n, r]) => {
1170
+ const o = Ne(r);
1171
+ return new RegExp(`${Wt(n)}=${o}(&|$)`, "i");
1161
1172
  });
1162
1173
  }
1163
- function xe(t) {
1164
- return Qn(t, new RegExp(zn, "g")).map((e) => e.startsWith(T) ? ke(e) : qt(e)).join("");
1174
+ function Ne(t) {
1175
+ return Zn(t, new RegExp(nr, "g")).map((e) => e.startsWith(T) ? Ue(e) : Wt(e)).join("");
1165
1176
  }
1166
- function ke(t) {
1177
+ function Ue(t) {
1167
1178
  return [
1168
- Yn,
1169
- Xn
1179
+ rr,
1180
+ or
1170
1181
  ].reduce((e, n) => n(e), t);
1171
1182
  }
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"), ".*");
1183
+ const nr = `\\${T}\\??([\\w-_]+)\\${Q}`, Dt = `\\${T}\\?([\\w-_]+)\\${Q}`, Ce = `\\${T}([\\w-_]+)\\${Q}`;
1184
+ function rr(t) {
1185
+ return t.replace(new RegExp(Dt, "g"), ".*");
1175
1186
  }
1176
- function $t(t) {
1177
- return new RegExp(Wt, "g").test(t);
1187
+ function Ct(t) {
1188
+ return new RegExp(Dt, "g").test(t);
1178
1189
  }
1179
- function Xn(t) {
1180
- return t.replace(new RegExp(Be, "g"), ".+");
1190
+ function or(t) {
1191
+ return t.replace(new RegExp(Ce, "g"), ".+");
1181
1192
  }
1182
- function St(t) {
1183
- const [e] = yt(t, new RegExp(Wt, "g")), [n] = yt(t, new RegExp(Be, "g"));
1193
+ function At(t) {
1194
+ const [e] = wt(t, new RegExp(Dt, "g")), [n] = wt(t, new RegExp(Ce, "g"));
1184
1195
  return e ?? n;
1185
1196
  }
1186
- function yt(t, e) {
1187
- return Array.from(t.matchAll(e)).flatMap(([, ...r]) => r.map((o) => it(o) ? o : ""));
1197
+ function wt(t, e) {
1198
+ return Array.from(t.matchAll(e)).flatMap(([, ...r]) => r.map((o) => lt(o) ? o : ""));
1188
1199
  }
1189
- function Le(t, e, n) {
1190
- const r = Ue(e, n), [o] = yt(t, r);
1200
+ function $e(t, e, n) {
1201
+ const r = Ve(e, n), [o] = wt(t, r);
1191
1202
  return o;
1192
1203
  }
1193
- function Ne(t, e) {
1204
+ function He(t, e) {
1194
1205
  if (!e)
1195
1206
  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);
1207
+ const { name: n, param: r, value: o } = e, a = Ve(t, n);
1208
+ return wt(t, a).reduce((u, c) => c === void 0 ? u : u.replace(c, () => st(o, r, n.startsWith("?"))), t);
1198
1209
  }
1199
- function Ue(t, e) {
1210
+ function Ve(t, e) {
1200
1211
  const n = [
1201
- Zn,
1202
- tr,
1203
- ke
1212
+ ar,
1213
+ sr,
1214
+ Ue
1204
1215
  ].reduce((r, o) => o(r, e), t);
1205
1216
  return new RegExp(n, "g");
1206
1217
  }
1207
- function Zn(t, e) {
1218
+ function ar(t, e) {
1208
1219
  if (!e.startsWith("?"))
1209
1220
  return t;
1210
1221
  const n = new RegExp(`\\${T}\\${e}\\${Q}`, "g");
1211
1222
  return t.replace(n, "(.*)");
1212
1223
  }
1213
- function tr(t, e) {
1224
+ function sr(t, e) {
1214
1225
  if (e.startsWith("?"))
1215
1226
  return t;
1216
1227
  const n = new RegExp(`\\${T}${e}\\${Q}`, "g");
1217
1228
  return t.replace(n, "(.+)");
1218
1229
  }
1219
- function Ce(t, ...e) {
1230
+ function je(t, ...e) {
1220
1231
  return e.reduce((n, r) => {
1221
1232
  if (!r)
1222
1233
  return n;
@@ -1224,259 +1235,255 @@ function Ce(t, ...e) {
1224
1235
  return Object.keys(o).length === 0 ? n : n.includes("?") ? `${n}&${o}` : `${n}?${o}`;
1225
1236
  }, t);
1226
1237
  }
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}`;
1238
+ function cr(t, e = {}) {
1239
+ 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();
1240
+ return `${u}${c}`;
1230
1241
  }
1231
- function nr(t, e) {
1242
+ function ur(t, e) {
1232
1243
  const n = t.toString();
1233
1244
  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;
1245
+ const s = At(`${T}${o}${Q}`);
1246
+ return s ? He(r, { name: o, param: a, value: e[s] }) : r;
1236
1247
  }, n);
1237
1248
  }
1238
- function rr(t, e) {
1249
+ function ir(t, e) {
1239
1250
  const n = t.toString();
1240
1251
  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;
1252
+ const s = At(`${T}${o}${Q}`);
1253
+ return s ? He(r, { name: o, param: a, value: e[s] }) : r;
1243
1254
  }, n);
1244
1255
  }
1245
- function or(t, e) {
1256
+ function fr(t, e) {
1246
1257
  const n = t.toString();
1247
1258
  if (!n)
1248
1259
  return {};
1249
1260
  const r = new URLSearchParams(n);
1250
1261
  return Array.from(r.entries()).reduce((o, [a, s]) => {
1251
- const c = St(s);
1252
- if (!c)
1262
+ const u = At(s);
1263
+ if (!u)
1253
1264
  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 };
1265
+ const f = st(e[u], t.params[u], Ct(s)), i = e[u] === void 0 && f === "";
1266
+ return Ct(s) && i ? o : { ...o, [a]: f };
1256
1267
  }, {});
1257
1268
  }
1258
- function ar(t) {
1269
+ function lr(t) {
1259
1270
  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);
1271
+ if (W(e))
1272
+ return je(e, (n ?? {}).query);
1273
+ const o = n ?? {}, a = r ?? {}, s = t.find((c) => c.name === e);
1263
1274
  if (!s)
1264
- throw new Jn(String(e));
1265
- return er(s, {
1275
+ throw new Xn(String(e));
1276
+ return cr(s, {
1266
1277
  params: o,
1267
1278
  query: a.query,
1268
1279
  hash: a.hash
1269
1280
  });
1270
1281
  };
1271
1282
  }
1272
- class sr extends Error {
1283
+ class hr extends Error {
1273
1284
  constructor() {
1274
1285
  super("initialUrl must be set if window.location is unavailable");
1275
1286
  }
1276
1287
  }
1277
- function cr(t) {
1288
+ function pr(t) {
1278
1289
  if (t)
1279
1290
  return t;
1280
- if (de())
1291
+ if (ye())
1281
1292
  return window.location.toString();
1282
- throw new sr();
1293
+ throw new hr();
1283
1294
  }
1284
- const ur = (t, e) => {
1295
+ const dr = (t, e) => {
1285
1296
  try {
1286
- $e(t, e);
1297
+ Oe(t, e);
1287
1298
  } catch {
1288
1299
  return !1;
1289
1300
  }
1290
1301
  return !0;
1291
- }, $e = (t, e) => {
1292
- const { pathname: n, search: r } = M(e);
1302
+ }, Oe = (t, e) => {
1303
+ const { pathname: n, search: r } = D(e);
1293
1304
  return {
1294
- ...ir(t.path, n),
1295
- ...fr(t.query, r)
1305
+ ...mr(t.path, n),
1306
+ ...gr(t.query, r)
1296
1307
  };
1297
1308
  };
1298
- function ir(t, e) {
1309
+ function mr(t, e) {
1299
1310
  const n = {}, r = decodeURIComponent(e);
1300
1311
  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;
1312
+ const s = o.startsWith("?"), u = s ? o.slice(1) : o, c = $e(r, t.toString(), o), f = at(c, a, s);
1313
+ n[u] = f;
1303
1314
  }
1304
1315
  return n;
1305
1316
  }
1306
- function fr(t, e) {
1317
+ function gr(t, e) {
1307
1318
  const n = {}, r = new URLSearchParams(e);
1308
1319
  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;
1320
+ const s = o.startsWith("?"), u = s ? o.slice(1) : o, c = r.get(u) ?? void 0, f = at(c, a, s);
1321
+ n[u] = f;
1311
1322
  }
1312
1323
  return n;
1313
1324
  }
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();
1325
+ const Rr = (t) => "name" in t.matched && !!t.matched.name, yr = (t, e) => {
1326
+ const { pathname: n } = D(e);
1327
+ return tr(t).test(n);
1328
+ }, vr = (t, e) => {
1329
+ const { search: n } = D(e);
1330
+ return er(t).every((o) => o.test(n));
1331
+ }, wr = (t, e) => {
1332
+ const { hash: n } = D(e), r = t.hash.toString();
1322
1333
  return !t.hash.hasValue() || r.toLowerCase() === n.toLowerCase();
1323
1334
  };
1324
- function dr(t) {
1325
- const { searchParams: e, pathname: n } = M(t), r = -1, o = 1;
1335
+ function Pr(t) {
1336
+ const { searchParams: e, pathname: n } = D(t), r = -1, o = 1;
1326
1337
  return (a, s) => {
1327
- const c = Zt(a, e), u = Xt(a, n), l = Zt(s, e), h = Xt(s, n);
1338
+ const u = re(a, e), c = ne(a, n), f = re(s, e), i = ne(s, n);
1328
1339
  if (a.depth > s.depth)
1329
1340
  return r;
1330
1341
  if (a.depth < s.depth)
1331
1342
  return o;
1332
- if (c + u > l + h)
1343
+ if (u + c > f + i)
1333
1344
  return r;
1334
- if (c + u < l + h)
1345
+ if (u + c < f + i)
1335
1346
  return o;
1336
- const { hash: i } = M(t);
1337
- return a.hash.toString() === i ? r : s.hash.toString() === i ? o : 0;
1347
+ const { hash: h } = D(t);
1348
+ return a.hash.toString() === h ? r : s.hash.toString() === h ? o : 0;
1338
1349
  };
1339
1350
  }
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);
1351
+ function ne(t, e) {
1352
+ 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
1353
  return n.length - r.length;
1343
1354
  }
1344
- function Zt(t, e) {
1355
+ function re(t, e) {
1345
1356
  const n = new URLSearchParams(t.query.toString()), r = Array.from(n.keys()), o = r.filter((a) => !e.has(a));
1346
1357
  return r.length - o.length;
1347
1358
  }
1348
- function He(t) {
1359
+ function _e(t) {
1349
1360
  return !!t && typeof t == "object";
1350
1361
  }
1351
- const vt = !0;
1352
- function gr(t, e, n) {
1353
- if (He(t) && e in t) {
1362
+ const Pt = !0;
1363
+ function Er(t, e, n) {
1364
+ if (_e(t) && e in t) {
1354
1365
  const r = t[e];
1355
1366
  if (typeof r == "string")
1356
- return ot(r, n, vt);
1367
+ return at(r, n, Pt);
1357
1368
  }
1358
- return ot(void 0, n, vt);
1369
+ return at(void 0, n, Pt);
1359
1370
  }
1360
- function Rr(t, e) {
1371
+ function Sr(t, e) {
1361
1372
  const n = {};
1362
1373
  for (const [r, o] of Object.entries(t)) {
1363
- const a = gr(e, r, o);
1374
+ const a = Er(e, r, o);
1364
1375
  n[r] = a;
1365
1376
  }
1366
1377
  return n;
1367
1378
  }
1368
- function yr(t, e, n) {
1369
- if (He(t) && e in t) {
1379
+ function br(t, e, n) {
1380
+ if (_e(t) && e in t) {
1370
1381
  const r = t[e];
1371
- return at(r, n, vt);
1382
+ return st(r, n, Pt);
1372
1383
  }
1373
- return at(void 0, n, vt);
1384
+ return st(void 0, n, Pt);
1374
1385
  }
1375
- const te = (t, e) => {
1386
+ const oe = (t, e) => {
1376
1387
  const n = {};
1377
1388
  for (const [r, o] of Object.entries(t)) {
1378
- const a = yr(e, r, o);
1389
+ const a = br(e, r, o);
1379
1390
  n[r] = a;
1380
1391
  }
1381
1392
  return n;
1382
- }, vr = [
1383
- lr,
1384
- hr,
1385
- pr,
1386
- mr,
1387
- ur
1393
+ }, Ar = [
1394
+ Rr,
1395
+ yr,
1396
+ vr,
1397
+ wr,
1398
+ dr
1388
1399
  ];
1389
- function Lt(t, e, n) {
1390
- const r = dr(e), o = t.filter((u) => vr.every((l) => l(u, e))).sort(r);
1400
+ function Nt(t, e, n) {
1401
+ const r = Pr(e), o = t.filter((c) => Ar.every((f) => f(c, e))).sort(r);
1391
1402
  if (o.length === 0)
1392
1403
  return;
1393
- const [a] = o, { search: s, hash: c } = M(e);
1404
+ const [a] = o, { search: s, hash: u } = D(e);
1394
1405
  return {
1406
+ id: a.id,
1395
1407
  matched: a.matched,
1396
1408
  matches: a.matches,
1397
1409
  name: a.name,
1398
- query: Ae(s),
1399
- params: $e(a, e),
1400
- state: Rr(a.state, n),
1401
- hash: c
1410
+ query: Le(s),
1411
+ params: Oe(a, e),
1412
+ state: Sr(a.state, n),
1413
+ hash: u
1402
1414
  };
1403
1415
  }
1404
- function wr() {
1405
- let t = 0;
1406
- return () => (++t).toString();
1407
- }
1408
- const Ve = wr();
1409
- function Dt(t, e) {
1416
+ function Tt(t, e) {
1410
1417
  const n = new RegExp(`\\${T}(\\??[\\w-_]+)\\${Q}`, "g");
1411
1418
  return Array.from(t.matchAll(n)).reduce((o, [a, s]) => {
1412
- const c = St(a);
1413
- if (!c)
1419
+ const u = At(a);
1420
+ if (!u)
1414
1421
  return o;
1415
- const u = An(e, c);
1416
- return et([c], o), o[s] = u, o;
1422
+ const c = Ln(e, u);
1423
+ return et([u], o), o[s] = c, o;
1417
1424
  }, {});
1418
1425
  }
1419
- function je(t, e) {
1426
+ function qe(t, e) {
1420
1427
  return {
1421
1428
  value: t,
1422
- params: Dt(t, e),
1429
+ params: Tt(t, e),
1423
1430
  toString: () => t
1424
1431
  };
1425
1432
  }
1426
- function Er(t) {
1427
- return ut(t) && typeof t.hash == "string";
1433
+ function xr(t) {
1434
+ return ft(t) && typeof t.hash == "string";
1428
1435
  }
1429
- function Oe(t) {
1430
- return t === void 0 ? pt() : Er(t) ? t : pt(t);
1436
+ function Me(t) {
1437
+ return t === void 0 ? mt() : xr(t) ? t : mt(t);
1431
1438
  }
1432
- function Mt(t) {
1439
+ function It(t) {
1433
1440
  return t === void 0 ? "" : t;
1434
1441
  }
1435
- function ee(t, e) {
1442
+ function ae(t, e) {
1436
1443
  return {
1437
1444
  value: t,
1438
- params: Dt(t, e),
1445
+ params: Tt(t, e),
1439
1446
  toString: () => t
1440
1447
  };
1441
1448
  }
1442
- function Pr(t) {
1443
- return ut(t) && typeof t.value == "string";
1449
+ function kr(t) {
1450
+ return ft(t) && typeof t.value == "string";
1444
1451
  }
1445
- function _e(t) {
1446
- return t === void 0 ? ee("", {}) : Pr(t) ? t : ee(t, {});
1452
+ function We(t) {
1453
+ return t === void 0 ? ae("", {}) : kr(t) ? t : ae(t, {});
1447
1454
  }
1448
- function ne(t, e) {
1455
+ function se(t, e) {
1449
1456
  return {
1450
1457
  value: t,
1451
- params: Dt(t, e),
1458
+ params: Tt(t, e),
1452
1459
  toString: () => t
1453
1460
  };
1454
1461
  }
1455
- function Sr(t) {
1456
- return ut(t) && typeof t.value == "string";
1462
+ function Br(t) {
1463
+ return ft(t) && typeof t.value == "string";
1457
1464
  }
1458
- function qe(t) {
1459
- return t === void 0 ? ne("", {}) : Sr(t) ? t : ne(t, {});
1465
+ function De(t) {
1466
+ return t === void 0 ? se("", {}) : Br(t) ? t : se(t, {});
1460
1467
  }
1461
1468
  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 = {
1469
+ 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
1470
  id: e,
1464
- matched: u,
1465
- matches: [u],
1471
+ matched: c,
1472
+ matches: [c],
1466
1473
  name: n,
1467
1474
  path: r,
1468
1475
  query: o,
1469
1476
  hash: a,
1470
1477
  meta: s,
1471
- state: c,
1478
+ state: u,
1472
1479
  depth: 1,
1473
- host: je("", {}),
1480
+ host: qe("", {}),
1474
1481
  prefetch: t.prefetch
1475
- }, h = pe(t) ? me(t.parent, l) : l;
1476
- return et(h.path.params, h.query.params), h;
1482
+ }, i = ge(t) ? Re(t.parent, f) : f;
1483
+ return et(i.path.params, i.query.params), i;
1477
1484
  }
1478
- function br(t, e) {
1479
- if (!it(e))
1485
+ function Lr(t, e) {
1486
+ if (!lt(e))
1480
1487
  return t;
1481
1488
  const n = J({ path: e });
1482
1489
  return t.map((r) => J({
@@ -1484,7 +1491,7 @@ function br(t, e) {
1484
1491
  ...r
1485
1492
  }));
1486
1493
  }
1487
- class Ar extends Error {
1494
+ class Nr extends Error {
1488
1495
  /**
1489
1496
  * Constructs a new DuplicateNamesError instance with a message indicating the problematic name.
1490
1497
  * @param name - The name of the name that was duplicated.
@@ -1493,244 +1500,313 @@ class Ar extends Error {
1493
1500
  super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`);
1494
1501
  }
1495
1502
  }
1496
- function xr(t) {
1503
+ function Ur(t) {
1497
1504
  const e = t.map(({ name: n }) => n);
1498
1505
  for (const n of e)
1499
- if (he(e, n) > 1)
1500
- throw new Ar(n);
1506
+ if (me(e, n) > 1)
1507
+ throw new Nr(n);
1501
1508
  }
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({
1509
+ function Kr(t, e) {
1510
+ const n = hn(t) ? t.flat() : t, r = Lr(n, e == null ? void 0 : e.base);
1511
+ Ur(r);
1512
+ const o = Vr(), a = lr(r), s = Dn({
1506
1513
  mode: e == null ? void 0 : e.historyMode,
1507
- listener: ({ location: y }) => {
1508
- const B = K(y);
1509
- P(B, { state: y.state });
1514
+ listener: ({ location: R }) => {
1515
+ const L = K(R);
1516
+ A(L, { state: R.state });
1510
1517
  }
1511
- }), { runBeforeRouteHooks: s, runAfterRouteHooks: c } = Dn(), {
1512
- hooks: u,
1513
- onBeforeRouteEnter: l,
1518
+ }), { runBeforeRouteHooks: u, runAfterRouteHooks: c } = Jn(), {
1519
+ hooks: f,
1520
+ onBeforeRouteEnter: i,
1514
1521
  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 });
1522
+ onBeforeRouteLeave: y,
1523
+ onAfterRouteEnter: p,
1524
+ onBeforeRouteUpdate: S,
1525
+ onAfterRouteLeave: E
1526
+ } = Gn();
1527
+ async function A(R, L = {}) {
1528
+ if (s.stopListening(), C(R)) {
1529
+ s.update(R, L);
1530
+ return;
1531
+ }
1532
+ const O = Nt(r, R, L.state) ?? m("NotFound"), _ = { ...d }, z = await u({ to: O, from: _, hooks: f });
1524
1533
  switch (z.status) {
1525
1534
  case "ABORT":
1526
1535
  return;
1527
1536
  case "PUSH":
1528
- a.update(y, B), await k(...z.to);
1537
+ s.update(R, L), await k(...z.to);
1529
1538
  return;
1530
1539
  case "REJECT":
1531
- a.update(y, B), R(z.type), w(_);
1540
+ s.update(R, L), b(z.type);
1532
1541
  break;
1533
1542
  case "SUCCESS":
1534
- a.update(y, B), R(null), w(_);
1543
+ s.update(R, L), b(null);
1535
1544
  break;
1536
1545
  default:
1537
1546
  throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(z)}`);
1538
1547
  }
1539
- const I = await c({ to: _, from: q, hooks: u });
1548
+ o.setProps(O), P(O);
1549
+ const I = await c({ to: O, from: _, hooks: f });
1540
1550
  switch (I.status) {
1541
1551
  case "PUSH":
1542
1552
  await k(...I.to);
1543
1553
  break;
1544
1554
  case "REJECT":
1545
- R(I.type);
1555
+ b(I.type);
1546
1556
  break;
1547
1557
  case "SUCCESS":
1548
1558
  break;
1549
1559
  default:
1550
- const W = I;
1551
- throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(W)}`);
1560
+ const q = I;
1561
+ throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(q)}`);
1552
1562
  }
1553
- a.startListening();
1563
+ s.startListening();
1554
1564
  }
1555
- const k = (y, B, _) => {
1556
- if (D(y)) {
1557
- const nt = { ...B }, xt = o(y, nt);
1558
- return P(xt, nt);
1565
+ const k = (R, L, O) => {
1566
+ if (W(R)) {
1567
+ const nt = { ...L }, Bt = a(R, nt);
1568
+ return A(Bt, nt);
1559
1569
  }
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);
1570
+ const _ = { ...O }, I = a(R, L ?? {}, _), q = Kt(R), kt = oe((q == null ? void 0 : q.state) ?? {}, _.state);
1571
+ return A(I, { ..._, state: kt });
1572
+ }, j = (R, L, O) => {
1573
+ if (W(R)) {
1574
+ const nt = { ...L, replace: !0 }, Bt = a(R, nt);
1575
+ return A(Bt, nt);
1566
1576
  }
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, _);
1577
+ const _ = { ...O, replace: !0 }, I = a(R, L ?? {}, _), q = Kt(R), kt = oe((q == null ? void 0 : q.state) ?? {}, _.state);
1578
+ return A(I, { ..._, state: kt });
1579
+ }, g = (R) => {
1580
+ b(R);
1581
+ }, v = (R, L = {}) => {
1582
+ if (!W(R)) {
1583
+ const O = a(R, L);
1584
+ return Nt(r, O);
1573
1585
  }
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,
1586
+ if (!C(R))
1587
+ return Nt(r, R);
1588
+ }, { setRejection: b, rejection: x, getRejectionRoute: m } = Yn(e ?? {}), l = m("NotFound"), { currentRoute: d, routerRoute: w, updateRoute: P } = _n(l, k);
1589
+ s.startListening();
1590
+ const B = pr(e == null ? void 0 : e.initialUrl), N = s.location.state, { host: $ } = D(B), C = Wn($);
1591
+ let xt = !1;
1592
+ async function Gt() {
1593
+ xt || (await A(B, { replace: !0, state: N }), xt = !0);
1594
+ }
1595
+ function Kt(R) {
1596
+ return r.find((L) => L.name === R);
1597
+ }
1598
+ function ze(R) {
1599
+ 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();
1600
+ }
1601
+ const zt = {
1602
+ route: w,
1603
+ resolve: a,
1588
1604
  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,
1605
+ replace: j,
1606
+ reject: g,
1607
+ find: v,
1608
+ refresh: s.refresh,
1609
+ forward: s.forward,
1610
+ back: s.back,
1611
+ go: s.go,
1612
+ install: ze,
1613
+ isExternal: C,
1614
+ onBeforeRouteEnter: i,
1600
1615
  onAfterRouteUpdate: h,
1601
- onBeforeRouteLeave: i,
1602
- onAfterRouteEnter: v,
1603
- onBeforeRouteUpdate: m,
1604
- onAfterRouteLeave: A,
1605
- prefetch: e == null ? void 0 : e.prefetch
1616
+ onBeforeRouteLeave: y,
1617
+ onAfterRouteEnter: p,
1618
+ onBeforeRouteUpdate: S,
1619
+ onAfterRouteLeave: E,
1620
+ prefetch: e == null ? void 0 : e.prefetch,
1621
+ start: Gt
1606
1622
  };
1607
- return Jt;
1623
+ return zt;
1608
1624
  }
1609
- const wt = { template: "<div>This is component</div>" }, Tt = J({
1625
+ const Et = { template: "<div>This is component</div>" }, Ft = J({
1610
1626
  name: "parentA",
1611
1627
  path: "/parentA/[paramA]"
1612
- }), We = J({
1613
- parent: Tt,
1628
+ }), Te = J({
1629
+ parent: Ft,
1614
1630
  name: "parentA.childA",
1615
1631
  path: "/[?paramB]"
1616
- }), kr = J({
1617
- parent: Tt,
1632
+ }), Cr = J({
1633
+ parent: Ft,
1618
1634
  name: "parentA.childB",
1619
1635
  path: "/[paramD]",
1620
- component: wt
1621
- }), Br = J({
1622
- parent: We,
1636
+ component: Et
1637
+ }), $r = J({
1638
+ parent: Te,
1623
1639
  name: "parentA.childA.grandChildA",
1624
1640
  path: "/[paramC]",
1625
- component: wt
1641
+ component: Et
1626
1642
  });
1627
1643
  J({
1628
1644
  name: "parentB",
1629
1645
  path: "/parentB",
1630
- component: wt
1646
+ component: Et
1631
1647
  }), J({
1632
1648
  name: "parentC",
1633
1649
  path: "/",
1634
- component: wt
1650
+ component: Et
1635
1651
  });
1636
- const Lr = {
1637
- components: !0
1652
+ const Hr = {
1653
+ components: !0,
1654
+ props: !1
1638
1655
  };
1639
- function Nr({ routerPrefetch: t, routePrefetch: e, linkPrefetch: n }, r) {
1640
- return Nt(n, r) ?? Nt(e, r) ?? Nt(t, r) ?? Lr[r];
1656
+ function Ie({ routerPrefetch: t, routePrefetch: e, linkPrefetch: n }, r) {
1657
+ return Ut(n, r) ?? Ut(e, r) ?? Ut(t, r) ?? Hr[r];
1658
+ }
1659
+ function Ut(t, e) {
1660
+ return ft(t) ? t[e] : t;
1661
+ }
1662
+ const Fe = Symbol();
1663
+ function Vr() {
1664
+ 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 }) => {
1665
+ const S = a(h, y, c);
1666
+ return i[S] = p == null ? void 0 : p(c.params), i;
1667
+ }, {}), n = (c) => {
1668
+ Object.entries(c).forEach(([f, i]) => {
1669
+ t.set(f, i);
1670
+ });
1671
+ }, r = (c) => {
1672
+ const i = c.matches.flatMap(s).reduce((h, { id: y, name: p, props: S }) => {
1673
+ const E = a(y, p, c);
1674
+ if (!S || t.has(E))
1675
+ return h;
1676
+ const A = S(c.params);
1677
+ return t.set(E, A), h.push(E), h;
1678
+ }, []);
1679
+ u(i);
1680
+ }, o = (c, f, i) => {
1681
+ const h = a(c, f, i);
1682
+ return t.get(h);
1683
+ };
1684
+ function a(c, f, i) {
1685
+ return [c, f, i.id, JSON.stringify(i.params)].join("-");
1686
+ }
1687
+ function s(c) {
1688
+ return Vt(c) ? Object.entries(c.props ?? {}).map(([f, i]) => ({ id: c.id, name: f, props: i })) : Ht(c) ? [
1689
+ {
1690
+ id: c.id,
1691
+ name: "default",
1692
+ props: c.props
1693
+ }
1694
+ ] : [];
1695
+ }
1696
+ function u(c) {
1697
+ for (const f in t.keys())
1698
+ c.includes(f) || t.delete(f);
1699
+ }
1700
+ return {
1701
+ getPrefetchProps: e,
1702
+ setPrefetchProps: n,
1703
+ getProps: o,
1704
+ setProps: r
1705
+ };
1641
1706
  }
1642
- function Nt(t, e) {
1643
- return ut(t) ? t[e] : t;
1707
+ function Je() {
1708
+ const t = it(Fe);
1709
+ if (!t)
1710
+ throw new St();
1711
+ return t;
1644
1712
  }
1645
- const Ur = Ke(() => new Promise((t) => {
1646
- t({ default: { template: "" } });
1713
+ const jr = tn(() => new Promise((t) => {
1714
+ t({ default: { template: "foo" } });
1647
1715
  }));
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
- });
1716
+ function ce(t) {
1717
+ return t.name === jr.name && "setup" in t;
1718
+ }
1719
+ function Or(t) {
1720
+ let e = {};
1721
+ const { getPrefetchProps: n, setPrefetchProps: r } = Je();
1722
+ return fe(() => ht(t), ({ route: a, ...s }) => {
1723
+ a && (_r(a, s), e = n(a, s));
1669
1724
  }, { 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 })
1725
+ commit: () => {
1726
+ r(e);
1727
+ }
1676
1728
  };
1677
1729
  }
1678
- function $r(t, { routerPrefetch: e, linkPrefetch: n }) {
1730
+ function _r(t, { routerPrefetch: e, linkPrefetch: n }) {
1679
1731
  t.matches.forEach((r) => {
1680
- Nr({
1732
+ Ie({
1681
1733
  routePrefetch: r.prefetch,
1682
1734
  routerPrefetch: e,
1683
1735
  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();
1736
+ }, "components") && (Ht(r) && ce(r.component) && r.component.setup(), Vt(r) && Object.values(r.components).forEach((a) => {
1737
+ ce(a) && a.setup();
1686
1738
  }));
1687
1739
  });
1688
1740
  }
1689
- function Hr(t, e, { exact: n } = {}) {
1690
- if (!Un(t))
1741
+ function qr(t, e = {}, n = {}) {
1742
+ const r = jt(), o = en(t), a = V(() => W(o.value) ? {} : ht(e)), s = V(() => W(o.value) ? ht(e) : ht(n)), u = V(() => {
1743
+ if (W(o.value))
1744
+ return o.value;
1745
+ try {
1746
+ return r.resolve(o.value, a.value, s.value);
1747
+ } catch (E) {
1748
+ throw E instanceof X && console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`, E), E;
1749
+ }
1750
+ }), 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(() => ({
1751
+ route: c.value,
1752
+ routerPrefetch: r.prefetch,
1753
+ linkPrefetch: s.value.prefetch
1754
+ })), p = (E) => (y(), r.push(u.value, { ...s.value, ...E }));
1755
+ return {
1756
+ route: c,
1757
+ href: u,
1758
+ isMatch: f,
1759
+ isExactMatch: i,
1760
+ isExternal: h,
1761
+ push: p,
1762
+ replace: (E) => p(E)
1763
+ };
1764
+ }
1765
+ function Mr(t, e, { exact: n } = {}) {
1766
+ if (!jn(t))
1691
1767
  return !1;
1692
1768
  if (e === void 0)
1693
1769
  return !0;
1694
- const r = t.matches.map((o) => Mt(o.name));
1770
+ const r = t.matches.map((o) => It(o.name));
1695
1771
  if (n) {
1696
1772
  const o = r.at(-1);
1697
1773
  return e === o;
1698
1774
  }
1699
1775
  return r.includes(e);
1700
1776
  }
1701
- function Vr(t, e) {
1702
- const n = Vt();
1777
+ function Wr(t, e) {
1778
+ const n = jt();
1703
1779
  function r() {
1704
1780
  if (!t)
1705
1781
  return;
1706
- if (!Hr(n.route, t, e))
1707
- throw new cn(t, n.route.name);
1782
+ if (!Mr(n.route, t, e))
1783
+ throw new Hn(t, n.route.name);
1708
1784
  }
1709
- return se(n.route, r, { immediate: !0, deep: !0 }), n.route;
1785
+ return fe(n.route, r, { immediate: !0, deep: !0 }), n.route;
1710
1786
  }
1711
- const De = Symbol();
1712
- function It() {
1713
- return Et(De, 0);
1787
+ const Qe = Symbol();
1788
+ function Jt() {
1789
+ return it(Qe, 0);
1714
1790
  }
1715
- function Me() {
1716
- const t = Et(be);
1791
+ function Ge() {
1792
+ const t = it(Be);
1717
1793
  if (!t)
1718
- throw new Ht();
1794
+ throw new St();
1719
1795
  return t;
1720
1796
  }
1721
- function Te(t) {
1797
+ function Ke(t) {
1722
1798
  return (e) => {
1723
- const n = It(), o = Me().addBeforeRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
1724
- return ce(o), o;
1799
+ const n = Jt(), o = Ge().addBeforeRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
1800
+ return le(o), o;
1725
1801
  };
1726
1802
  }
1727
- function Ft(t) {
1803
+ function Qt(t) {
1728
1804
  return (e) => {
1729
- const n = It(), o = Me().addAfterRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
1730
- return ce(o), o;
1805
+ const n = Jt(), o = Ge().addAfterRouteHook({ lifecycle: t, hook: e, depth: n, timing: "component" });
1806
+ return le(o), o;
1731
1807
  };
1732
1808
  }
1733
- const Ir = Te("onBeforeRouteUpdate"), Fr = Te("onBeforeRouteLeave"), Jr = Ft("onAfterRouteEnter"), Qr = Ft("onAfterRouteUpdate"), Gr = Ft("onAfterRouteLeave"), jr = ["href"], Or = /* @__PURE__ */ ct({
1809
+ const zr = Ke("onBeforeRouteUpdate"), Yr = Ke("onBeforeRouteLeave"), Xr = Qt("onAfterRouteEnter"), Zr = Qt("onAfterRouteUpdate"), to = Qt("onAfterRouteLeave"), Dr = ["href"], Tr = /* @__PURE__ */ ut({
1734
1810
  __name: "routerLink",
1735
1811
  props: {
1736
1812
  to: {},
@@ -1741,105 +1817,100 @@ const Ir = Te("onBeforeRouteUpdate"), Fr = Te("onBeforeRouteLeave"), Jr = Ft("on
1741
1817
  state: {}
1742
1818
  },
1743
1819
  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);
1820
+ const e = t, n = jt(), r = V(() => W(e.to) ? e.to : e.to(n.resolve)), o = V(() => {
1821
+ const { to: h, ...y } = e;
1822
+ return y;
1823
+ }), { isMatch: a, isExactMatch: s, isExternal: u, push: c } = qr(r, o), f = V(() => ({
1824
+ "router-link--match": a.value,
1825
+ "router-link--exact-match": s.value
1826
+ }));
1827
+ function i(h) {
1828
+ h.preventDefault(), c();
1753
1829
  }
1754
- return (i, v) => (ue(), Ye("a", {
1830
+ return (h, y) => (he(), nn("a", {
1755
1831
  href: r.value,
1756
- class: Xe(["router-link", u.value]),
1757
- onClick: h
1832
+ class: rn(["router-link", f.value]),
1833
+ onClick: i
1758
1834
  }, [
1759
- ie(i.$slots, "default", fe(Ze({ resolved: r.value, isMatch: ht(s), isExactMatch: ht(c), isExternal: l.value })))
1760
- ], 10, jr));
1835
+ pe(h.$slots, "default", de(on({ resolved: r.value, isMatch: ot(a), isExactMatch: ot(s), isExternal: ot(u) })))
1836
+ ], 10, Dr));
1761
1837
  }
1762
- }), _r = /* @__PURE__ */ ct({
1838
+ }), Ir = /* @__PURE__ */ ut({
1763
1839
  __name: "routerView",
1764
1840
  props: {
1765
1841
  name: {}
1766
1842
  },
1767
1843
  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(() => {
1844
+ const { name: e = "default" } = t, n = Wr(), r = Vn(), o = Jt(), { getProps: a } = Je(), s = an("RouterView", !0);
1845
+ sn(Qe, o + 1);
1846
+ const u = V(() => {
1771
1847
  if (r.value)
1772
1848
  return r.value.component;
1773
1849
  const i = n.matches.at(o);
1774
1850
  if (!i)
1775
1851
  return null;
1776
- const v = c(i), m = l(i);
1777
- return v ? m ? (n.params, wn(v, () => m(n.params))) : v : null;
1852
+ const h = c(i), y = a(i.id, e, n);
1853
+ return h ? y ? bn(h, () => y) : h : null;
1778
1854
  });
1779
1855
  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];
1856
+ return f(i)[e];
1787
1857
  }
1788
- function h(i) {
1789
- return Ct(i) ? i.props ?? {} : Ut(i) ? { default: i.props } : {};
1858
+ function f(i) {
1859
+ return Vt(i) ? i.components : Ht(i) ? { default: i.component } : typeof s == "string" ? {} : { default: s };
1790
1860
  }
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);
1861
+ return (i, h) => u.value ? pe(i.$slots, "default", de(cn({ key: 0 }, { route: ot(n), component: u.value, rejection: ot(r) })), () => [
1862
+ (he(), un(fn(u.value)))
1863
+ ]) : ln("", !0);
1794
1864
  }
1795
1865
  });
1796
- function qr(t) {
1797
- return ut(t) && typeof t.value == "string";
1866
+ function Fr(t) {
1867
+ return ft(t) && typeof t.value == "string";
1798
1868
  }
1799
- function oe(t) {
1800
- return qr(t) ? t : je(t, {});
1869
+ function ue(t) {
1870
+ return Fr(t) ? t : qe(t, {});
1801
1871
  }
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 = {
1872
+ function eo(t) {
1873
+ 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
1874
  id: e,
1805
- matched: u,
1806
- matches: [u],
1875
+ matched: c,
1876
+ matches: [c],
1807
1877
  name: n,
1808
- host: c,
1878
+ host: u,
1809
1879
  path: r,
1810
1880
  query: o,
1811
1881
  hash: a,
1812
1882
  meta: s,
1813
1883
  depth: 1,
1814
1884
  state: {}
1815
- }, h = pe(t) ? me(t.parent, l) : l;
1816
- return et(h.path.params, h.query.params, h.host.params), h;
1885
+ }, i = ge(t) ? Re(t.parent, f) : f;
1886
+ return et(i.path.params, i.query.params, i.host.params), i;
1817
1887
  }
1818
1888
  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,
1889
+ Rn as DuplicateParamsError,
1890
+ Tr as RouterLink,
1891
+ St as RouterNotInstalledError,
1892
+ Ir as RouterView,
1893
+ Hn as UseRouteInvalidError,
1894
+ bn as component,
1895
+ eo as createExternalRoute,
1896
+ Un as createParam,
1827
1897
  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
1898
+ Kr as createRouter,
1899
+ Bn as isParamWithDefault,
1900
+ Mr as isRoute,
1901
+ W as isUrl,
1902
+ Xr as onAfterRouteEnter,
1903
+ Zr as onAfterRouteLeave,
1904
+ to as onAfterRouteUpdate,
1905
+ zr as onBeforeRouteLeave,
1906
+ Yr as onBeforeRouteUpdate,
1907
+ ae as path,
1908
+ se as query,
1909
+ Ae as routerInjectionKey,
1910
+ be as routerRejectionKey,
1911
+ qr as useLink,
1912
+ Vn as useRejection,
1913
+ Wr as useRoute,
1914
+ jt as useRouter,
1915
+ Gr as withDefault
1845
1916
  };