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