@kitbag/router 0.7.2 → 0.8.0

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