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