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