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