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