alex-evo-sh-auth 0.0.5 → 0.0.7
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/alex-evo-sh-auth.es.js +2001 -446
- package/dist/alex-evo-sh-auth.umd.js +10 -8
- package/dist/index.d.ts +12 -7
- package/dist/lib/helpers/PKCE.d.ts +3 -0
- package/dist/lib/helpers/authManager.d.ts +10 -0
- package/dist/lib/helpers/config.d.ts +8 -0
- package/dist/lib/helpers/fatch.d.ts +2 -0
- package/dist/lib/helpers/handleCallback.d.ts +2 -0
- package/dist/lib/helpers/login.d.ts +3 -0
- package/dist/lib/helpers/refresh.d.ts +2 -0
- package/dist/lib/react/AuthContext.d.ts +12 -0
- package/dist/lib/react/AuthProvider.d.ts +7 -0
- package/dist/lib/react/CallBackPage.d.ts +1 -0
- package/dist/lib/react/PrivilegeGate.d.ts +6 -0
- package/dist/lib/react/ProtectGate.d.ts +5 -0
- package/dist/lib/react/auth.hook.d.ts +9 -0
- package/dist/lib/types.d.ts +9 -8
- package/package.json +5 -4
- package/dist/lib/AuthContext.d.ts +0 -7
- package/dist/lib/AuthGuard.d.ts +0 -4
- package/dist/lib/AuthProvider.d.ts +0 -6
- package/dist/lib/authFetch.d.ts +0 -1
- package/dist/lib/useAuth.d.ts +0 -1
- package/dist/lib/useHasPrivilege.d.ts +0 -1
|
@@ -1,115 +1,238 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
import Ct, { createContext as Er, useState as Ie, useMemo as wr, useCallback as ke, useEffect as Ae, useContext as _t } from "react";
|
|
3
|
+
async function br(e) {
|
|
4
|
+
const t = await fetch(`${e.authServer}/refresh`, {
|
|
5
|
+
method: "POST",
|
|
6
|
+
headers: {
|
|
7
|
+
"Content-Type": "application/json"
|
|
8
|
+
},
|
|
9
|
+
body: JSON.stringify({
|
|
10
|
+
grant_type: "refresh_token",
|
|
11
|
+
client_id: e.clientId
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
if (t.status === 401)
|
|
15
|
+
return localStorage.removeItem(e.baseKey + "_access"), null;
|
|
16
|
+
const r = await t.json();
|
|
17
|
+
return localStorage.setItem(e.baseKey + "_access", r.access), r.access;
|
|
18
|
+
}
|
|
19
|
+
class Sr {
|
|
20
|
+
constructor(t, r) {
|
|
21
|
+
this.onAuthFail = r, this.config = t;
|
|
22
|
+
}
|
|
23
|
+
refreshPromise = null;
|
|
24
|
+
config;
|
|
25
|
+
getToken() {
|
|
26
|
+
return localStorage.getItem(this.config.baseKey + "_access");
|
|
27
|
+
}
|
|
28
|
+
setToken(t) {
|
|
29
|
+
t ? localStorage.setItem(this.config.baseKey + "_access", t) : localStorage.removeItem(this.config.baseKey + "_access");
|
|
30
|
+
}
|
|
31
|
+
async getValidToken() {
|
|
32
|
+
let t = this.getToken();
|
|
33
|
+
return t || (this.refreshPromise || (this.refreshPromise = br(this.config).then((r) => (this.setToken(r), r)).finally(() => {
|
|
34
|
+
this.refreshPromise = null;
|
|
35
|
+
})), t = await this.refreshPromise, !t && this.onAuthFail && this.onAuthFail(), t);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class oa {
|
|
39
|
+
authServer;
|
|
40
|
+
clientId;
|
|
41
|
+
redirectUri;
|
|
42
|
+
homePage;
|
|
43
|
+
baseKey;
|
|
44
|
+
constructor(t, r, a, o, i) {
|
|
45
|
+
this.authServer = t, this.clientId = r, this.redirectUri = a, this.homePage = o, this.baseKey = i;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function Pt(e, t, r = {}) {
|
|
49
|
+
let a = e.getToken();
|
|
50
|
+
const o = (l) => fetch(t, {
|
|
51
|
+
...r,
|
|
52
|
+
headers: {
|
|
53
|
+
...r.headers,
|
|
54
|
+
Authorization: l ? `Bearer ${l}` : ""
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
let i = await o(a);
|
|
58
|
+
return i.status !== 401 || (e.setToken(null), a = await e.getValidToken(), !a) ? i : o(a);
|
|
59
|
+
}
|
|
60
|
+
async function vt(e) {
|
|
61
|
+
const t = new URLSearchParams(window.location.search), r = t.get("code"), a = sessionStorage.getItem("oauth_state"), o = t.get("state");
|
|
62
|
+
if (!r) return;
|
|
63
|
+
if (!o || o !== a)
|
|
64
|
+
throw new Error("Invalid OAuth state");
|
|
65
|
+
const i = sessionStorage.getItem("pkce_verifier"), f = await (await fetch(`${e.config.authServer}/token`, {
|
|
66
|
+
method: "POST",
|
|
67
|
+
headers: {
|
|
68
|
+
"Content-Type": "application/json"
|
|
69
|
+
},
|
|
70
|
+
body: JSON.stringify({
|
|
71
|
+
client_id: e.config.clientId,
|
|
72
|
+
code: r,
|
|
73
|
+
code_verifier: i
|
|
74
|
+
})
|
|
75
|
+
})).json();
|
|
76
|
+
localStorage.setItem(e.config.baseKey + "_access", f.access), window.history.replaceState({}, document.title, e.config.homePage), window.location.href = e.config.homePage;
|
|
77
|
+
}
|
|
78
|
+
function xr(e = 64) {
|
|
79
|
+
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
80
|
+
let r = "";
|
|
81
|
+
const a = new Uint8Array(e);
|
|
82
|
+
crypto.getRandomValues(a);
|
|
83
|
+
for (let o = 0; o < a.length; o++)
|
|
84
|
+
r += t[a[o] % t.length];
|
|
85
|
+
return r;
|
|
86
|
+
}
|
|
87
|
+
async function Cr(e) {
|
|
88
|
+
const r = new TextEncoder().encode(e), a = await crypto.subtle.digest("SHA-256", r);
|
|
89
|
+
return new Uint8Array(a);
|
|
90
|
+
}
|
|
91
|
+
function _r(e) {
|
|
92
|
+
return btoa(String.fromCharCode(...Array.from(e))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
93
|
+
}
|
|
94
|
+
async function De(e) {
|
|
95
|
+
const t = xr(64), r = _r(await Cr(t));
|
|
96
|
+
sessionStorage.setItem("pkce_verifier", t);
|
|
97
|
+
const a = crypto.randomUUID();
|
|
98
|
+
sessionStorage.setItem("oauth_state", a);
|
|
99
|
+
const o = new URLSearchParams({
|
|
100
|
+
response_type: "code",
|
|
101
|
+
client_id: e.config.clientId,
|
|
102
|
+
redirect_uri: e.config.redirectUri,
|
|
103
|
+
code_challenge: r,
|
|
104
|
+
code_challenge_method: "S256",
|
|
105
|
+
state: a
|
|
106
|
+
});
|
|
107
|
+
window.location.href = `${e.config.authServer}/authorize?${o}`;
|
|
108
|
+
}
|
|
109
|
+
async function gt(e) {
|
|
110
|
+
try {
|
|
111
|
+
await Pt(e, `${e.config.authServer}/logout`, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
headers: {
|
|
114
|
+
"Content-Type": "application/json"
|
|
115
|
+
},
|
|
116
|
+
body: JSON.stringify({
|
|
117
|
+
client_id: e.config.clientId
|
|
118
|
+
})
|
|
119
|
+
}), localStorage.removeItem(e.config.baseKey + "_access"), await De(e);
|
|
120
|
+
} catch (t) {
|
|
121
|
+
console.error(t);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const je = Er({
|
|
125
|
+
login: () => {
|
|
126
|
+
},
|
|
127
|
+
logout: () => {
|
|
128
|
+
},
|
|
129
|
+
loadMe: () => {
|
|
130
|
+
},
|
|
131
|
+
authManager: null,
|
|
132
|
+
user: null,
|
|
133
|
+
loading: !1
|
|
134
|
+
});
|
|
135
|
+
var de = { exports: {} }, ne = {};
|
|
136
|
+
var yt;
|
|
137
|
+
function Pr() {
|
|
138
|
+
if (yt) return ne;
|
|
139
|
+
yt = 1;
|
|
140
|
+
var e = Ct, t = /* @__PURE__ */ Symbol.for("react.element"), r = /* @__PURE__ */ Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
141
|
+
function l(f, u, m) {
|
|
142
|
+
var h, c = {}, v = null, E = null;
|
|
143
|
+
m !== void 0 && (v = "" + m), u.key !== void 0 && (v = "" + u.key), u.ref !== void 0 && (E = u.ref);
|
|
144
|
+
for (h in u) a.call(u, h) && !i.hasOwnProperty(h) && (c[h] = u[h]);
|
|
145
|
+
if (f && f.defaultProps) for (h in u = f.defaultProps, u) c[h] === void 0 && (c[h] = u[h]);
|
|
146
|
+
return { $$typeof: t, type: f, key: v, ref: E, props: c, _owner: o.current };
|
|
24
147
|
}
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
function
|
|
30
|
-
return
|
|
31
|
-
var
|
|
32
|
-
function
|
|
33
|
-
if (
|
|
148
|
+
return ne.Fragment = r, ne.jsx = l, ne.jsxs = l, ne;
|
|
149
|
+
}
|
|
150
|
+
var ae = {};
|
|
151
|
+
var Rt;
|
|
152
|
+
function Tr() {
|
|
153
|
+
return Rt || (Rt = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
154
|
+
var e = Ct, t = /* @__PURE__ */ Symbol.for("react.element"), r = /* @__PURE__ */ Symbol.for("react.portal"), a = /* @__PURE__ */ Symbol.for("react.fragment"), o = /* @__PURE__ */ Symbol.for("react.strict_mode"), i = /* @__PURE__ */ Symbol.for("react.profiler"), l = /* @__PURE__ */ Symbol.for("react.provider"), f = /* @__PURE__ */ Symbol.for("react.context"), u = /* @__PURE__ */ Symbol.for("react.forward_ref"), m = /* @__PURE__ */ Symbol.for("react.suspense"), h = /* @__PURE__ */ Symbol.for("react.suspense_list"), c = /* @__PURE__ */ Symbol.for("react.memo"), v = /* @__PURE__ */ Symbol.for("react.lazy"), E = /* @__PURE__ */ Symbol.for("react.offscreen"), w = Symbol.iterator, x = "@@iterator";
|
|
155
|
+
function y(n) {
|
|
156
|
+
if (n === null || typeof n != "object")
|
|
34
157
|
return null;
|
|
35
|
-
var
|
|
36
|
-
return typeof
|
|
158
|
+
var d = w && n[w] || n[x];
|
|
159
|
+
return typeof d == "function" ? d : null;
|
|
37
160
|
}
|
|
38
|
-
var
|
|
39
|
-
function
|
|
161
|
+
var C = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
162
|
+
function R(n) {
|
|
40
163
|
{
|
|
41
|
-
for (var
|
|
42
|
-
|
|
43
|
-
|
|
164
|
+
for (var d = arguments.length, p = new Array(d > 1 ? d - 1 : 0), g = 1; g < d; g++)
|
|
165
|
+
p[g - 1] = arguments[g];
|
|
166
|
+
P("error", n, p);
|
|
44
167
|
}
|
|
45
168
|
}
|
|
46
|
-
function
|
|
169
|
+
function P(n, d, p) {
|
|
47
170
|
{
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
return String(
|
|
171
|
+
var g = C.ReactDebugCurrentFrame, _ = g.getStackAddendum();
|
|
172
|
+
_ !== "" && (d += "%s", p = p.concat([_]));
|
|
173
|
+
var T = p.map(function(S) {
|
|
174
|
+
return String(S);
|
|
52
175
|
});
|
|
53
|
-
|
|
176
|
+
T.unshift("Warning: " + d), Function.prototype.apply.call(console[n], console, T);
|
|
54
177
|
}
|
|
55
178
|
}
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
function
|
|
59
|
-
return !!(typeof
|
|
179
|
+
var j = !1, I = !1, M = !1, W = !1, K = !1, J;
|
|
180
|
+
J = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
181
|
+
function te(n) {
|
|
182
|
+
return !!(typeof n == "string" || typeof n == "function" || n === a || n === i || K || n === o || n === m || n === h || W || n === E || j || I || M || typeof n == "object" && n !== null && (n.$$typeof === v || n.$$typeof === c || n.$$typeof === l || n.$$typeof === f || n.$$typeof === u || // This needs to include all possible module reference object
|
|
60
183
|
// types supported by any Flight configuration anywhere since
|
|
61
184
|
// we don't know which Flight build this will end up being used
|
|
62
185
|
// with.
|
|
63
|
-
|
|
186
|
+
n.$$typeof === J || n.getModuleId !== void 0));
|
|
64
187
|
}
|
|
65
|
-
function
|
|
66
|
-
var
|
|
67
|
-
if (
|
|
68
|
-
return
|
|
69
|
-
var
|
|
70
|
-
return
|
|
188
|
+
function Ee(n, d, p) {
|
|
189
|
+
var g = n.displayName;
|
|
190
|
+
if (g)
|
|
191
|
+
return g;
|
|
192
|
+
var _ = d.displayName || d.name || "";
|
|
193
|
+
return _ !== "" ? p + "(" + _ + ")" : p;
|
|
71
194
|
}
|
|
72
|
-
function
|
|
73
|
-
return
|
|
195
|
+
function le(n) {
|
|
196
|
+
return n.displayName || "Context";
|
|
74
197
|
}
|
|
75
|
-
function
|
|
76
|
-
if (
|
|
198
|
+
function N(n) {
|
|
199
|
+
if (n == null)
|
|
77
200
|
return null;
|
|
78
|
-
if (typeof
|
|
79
|
-
return
|
|
80
|
-
if (typeof
|
|
81
|
-
return
|
|
82
|
-
switch (
|
|
83
|
-
case
|
|
201
|
+
if (typeof n.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof n == "function")
|
|
202
|
+
return n.displayName || n.name || null;
|
|
203
|
+
if (typeof n == "string")
|
|
204
|
+
return n;
|
|
205
|
+
switch (n) {
|
|
206
|
+
case a:
|
|
84
207
|
return "Fragment";
|
|
85
|
-
case
|
|
208
|
+
case r:
|
|
86
209
|
return "Portal";
|
|
87
|
-
case
|
|
210
|
+
case i:
|
|
88
211
|
return "Profiler";
|
|
89
|
-
case
|
|
212
|
+
case o:
|
|
90
213
|
return "StrictMode";
|
|
91
|
-
case
|
|
214
|
+
case m:
|
|
92
215
|
return "Suspense";
|
|
93
|
-
case
|
|
216
|
+
case h:
|
|
94
217
|
return "SuspenseList";
|
|
95
218
|
}
|
|
96
|
-
if (typeof
|
|
97
|
-
switch (
|
|
98
|
-
case
|
|
99
|
-
var
|
|
100
|
-
return
|
|
101
|
-
case
|
|
102
|
-
var
|
|
103
|
-
return
|
|
219
|
+
if (typeof n == "object")
|
|
220
|
+
switch (n.$$typeof) {
|
|
221
|
+
case f:
|
|
222
|
+
var d = n;
|
|
223
|
+
return le(d) + ".Consumer";
|
|
224
|
+
case l:
|
|
225
|
+
var p = n;
|
|
226
|
+
return le(p._context) + ".Provider";
|
|
227
|
+
case u:
|
|
228
|
+
return Ee(n, n.render, "ForwardRef");
|
|
104
229
|
case c:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
case O: {
|
|
110
|
-
var i = e, u = i._payload, o = i._init;
|
|
230
|
+
var g = n.displayName || null;
|
|
231
|
+
return g !== null ? g : N(n.type) || "Memo";
|
|
232
|
+
case v: {
|
|
233
|
+
var _ = n, T = _._payload, S = _._init;
|
|
111
234
|
try {
|
|
112
|
-
return
|
|
235
|
+
return N(S(T));
|
|
113
236
|
} catch {
|
|
114
237
|
return null;
|
|
115
238
|
}
|
|
@@ -117,580 +240,2012 @@ function Er() {
|
|
|
117
240
|
}
|
|
118
241
|
return null;
|
|
119
242
|
}
|
|
120
|
-
var
|
|
121
|
-
function
|
|
243
|
+
var B = Object.assign, D = 0, Je, ze, qe, Ge, Xe, Ze, Qe;
|
|
244
|
+
function et() {
|
|
122
245
|
}
|
|
123
|
-
|
|
124
|
-
function
|
|
246
|
+
et.__reactDisabledLog = !0;
|
|
247
|
+
function Jt() {
|
|
125
248
|
{
|
|
126
249
|
if (D === 0) {
|
|
127
|
-
|
|
128
|
-
var
|
|
250
|
+
Je = console.log, ze = console.info, qe = console.warn, Ge = console.error, Xe = console.group, Ze = console.groupCollapsed, Qe = console.groupEnd;
|
|
251
|
+
var n = {
|
|
129
252
|
configurable: !0,
|
|
130
253
|
enumerable: !0,
|
|
131
|
-
value:
|
|
254
|
+
value: et,
|
|
132
255
|
writable: !0
|
|
133
256
|
};
|
|
134
257
|
Object.defineProperties(console, {
|
|
135
|
-
info:
|
|
136
|
-
log:
|
|
137
|
-
warn:
|
|
138
|
-
error:
|
|
139
|
-
group:
|
|
140
|
-
groupCollapsed:
|
|
141
|
-
groupEnd:
|
|
258
|
+
info: n,
|
|
259
|
+
log: n,
|
|
260
|
+
warn: n,
|
|
261
|
+
error: n,
|
|
262
|
+
group: n,
|
|
263
|
+
groupCollapsed: n,
|
|
264
|
+
groupEnd: n
|
|
142
265
|
});
|
|
143
266
|
}
|
|
144
267
|
D++;
|
|
145
268
|
}
|
|
146
269
|
}
|
|
147
|
-
function
|
|
270
|
+
function zt() {
|
|
148
271
|
{
|
|
149
272
|
if (D--, D === 0) {
|
|
150
|
-
var
|
|
273
|
+
var n = {
|
|
151
274
|
configurable: !0,
|
|
152
275
|
enumerable: !0,
|
|
153
276
|
writable: !0
|
|
154
277
|
};
|
|
155
278
|
Object.defineProperties(console, {
|
|
156
|
-
log:
|
|
157
|
-
value:
|
|
279
|
+
log: B({}, n, {
|
|
280
|
+
value: Je
|
|
158
281
|
}),
|
|
159
|
-
info:
|
|
160
|
-
value:
|
|
282
|
+
info: B({}, n, {
|
|
283
|
+
value: ze
|
|
161
284
|
}),
|
|
162
|
-
warn:
|
|
163
|
-
value:
|
|
285
|
+
warn: B({}, n, {
|
|
286
|
+
value: qe
|
|
164
287
|
}),
|
|
165
|
-
error:
|
|
166
|
-
value:
|
|
288
|
+
error: B({}, n, {
|
|
289
|
+
value: Ge
|
|
167
290
|
}),
|
|
168
|
-
group:
|
|
169
|
-
value:
|
|
291
|
+
group: B({}, n, {
|
|
292
|
+
value: Xe
|
|
170
293
|
}),
|
|
171
|
-
groupCollapsed:
|
|
172
|
-
value:
|
|
294
|
+
groupCollapsed: B({}, n, {
|
|
295
|
+
value: Ze
|
|
173
296
|
}),
|
|
174
|
-
groupEnd:
|
|
175
|
-
value:
|
|
297
|
+
groupEnd: B({}, n, {
|
|
298
|
+
value: Qe
|
|
176
299
|
})
|
|
177
300
|
});
|
|
178
301
|
}
|
|
179
|
-
D < 0 &&
|
|
302
|
+
D < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
180
303
|
}
|
|
181
304
|
}
|
|
182
|
-
var
|
|
183
|
-
function
|
|
305
|
+
var we = C.ReactCurrentDispatcher, be;
|
|
306
|
+
function se(n, d, p) {
|
|
184
307
|
{
|
|
185
|
-
if (
|
|
308
|
+
if (be === void 0)
|
|
186
309
|
try {
|
|
187
310
|
throw Error();
|
|
188
|
-
} catch (
|
|
189
|
-
var
|
|
190
|
-
|
|
311
|
+
} catch (_) {
|
|
312
|
+
var g = _.stack.trim().match(/\n( *(at )?)/);
|
|
313
|
+
be = g && g[1] || "";
|
|
191
314
|
}
|
|
192
315
|
return `
|
|
193
|
-
` +
|
|
316
|
+
` + be + n;
|
|
194
317
|
}
|
|
195
318
|
}
|
|
196
|
-
var
|
|
319
|
+
var Se = !1, ue;
|
|
197
320
|
{
|
|
198
|
-
var
|
|
199
|
-
|
|
321
|
+
var qt = typeof WeakMap == "function" ? WeakMap : Map;
|
|
322
|
+
ue = new qt();
|
|
200
323
|
}
|
|
201
|
-
function
|
|
202
|
-
if (!
|
|
324
|
+
function tt(n, d) {
|
|
325
|
+
if (!n || Se)
|
|
203
326
|
return "";
|
|
204
327
|
{
|
|
205
|
-
var
|
|
206
|
-
if (
|
|
207
|
-
return
|
|
328
|
+
var p = ue.get(n);
|
|
329
|
+
if (p !== void 0)
|
|
330
|
+
return p;
|
|
208
331
|
}
|
|
209
|
-
var
|
|
210
|
-
|
|
211
|
-
var
|
|
332
|
+
var g;
|
|
333
|
+
Se = !0;
|
|
334
|
+
var _ = Error.prepareStackTrace;
|
|
212
335
|
Error.prepareStackTrace = void 0;
|
|
213
|
-
var
|
|
214
|
-
|
|
336
|
+
var T;
|
|
337
|
+
T = we.current, we.current = null, Jt();
|
|
215
338
|
try {
|
|
216
|
-
if (
|
|
217
|
-
var
|
|
339
|
+
if (d) {
|
|
340
|
+
var S = function() {
|
|
218
341
|
throw Error();
|
|
219
342
|
};
|
|
220
|
-
if (Object.defineProperty(
|
|
343
|
+
if (Object.defineProperty(S.prototype, "props", {
|
|
221
344
|
set: function() {
|
|
222
345
|
throw Error();
|
|
223
346
|
}
|
|
224
347
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
225
348
|
try {
|
|
226
|
-
Reflect.construct(
|
|
227
|
-
} catch (
|
|
228
|
-
|
|
349
|
+
Reflect.construct(S, []);
|
|
350
|
+
} catch (F) {
|
|
351
|
+
g = F;
|
|
229
352
|
}
|
|
230
|
-
Reflect.construct(
|
|
353
|
+
Reflect.construct(n, [], S);
|
|
231
354
|
} else {
|
|
232
355
|
try {
|
|
233
|
-
|
|
234
|
-
} catch (
|
|
235
|
-
|
|
356
|
+
S.call();
|
|
357
|
+
} catch (F) {
|
|
358
|
+
g = F;
|
|
236
359
|
}
|
|
237
|
-
|
|
360
|
+
n.call(S.prototype);
|
|
238
361
|
}
|
|
239
362
|
} else {
|
|
240
363
|
try {
|
|
241
364
|
throw Error();
|
|
242
|
-
} catch (
|
|
243
|
-
|
|
365
|
+
} catch (F) {
|
|
366
|
+
g = F;
|
|
244
367
|
}
|
|
245
|
-
|
|
368
|
+
n();
|
|
246
369
|
}
|
|
247
|
-
} catch (
|
|
248
|
-
if (
|
|
249
|
-
for (var
|
|
250
|
-
`),
|
|
251
|
-
`),
|
|
252
|
-
|
|
253
|
-
for (;
|
|
254
|
-
if (
|
|
255
|
-
if (
|
|
370
|
+
} catch (F) {
|
|
371
|
+
if (F && g && typeof F.stack == "string") {
|
|
372
|
+
for (var b = F.stack.split(`
|
|
373
|
+
`), L = g.stack.split(`
|
|
374
|
+
`), k = b.length - 1, O = L.length - 1; k >= 1 && O >= 0 && b[k] !== L[O]; )
|
|
375
|
+
O--;
|
|
376
|
+
for (; k >= 1 && O >= 0; k--, O--)
|
|
377
|
+
if (b[k] !== L[O]) {
|
|
378
|
+
if (k !== 1 || O !== 1)
|
|
256
379
|
do
|
|
257
|
-
if (
|
|
258
|
-
var
|
|
259
|
-
` +
|
|
260
|
-
return
|
|
380
|
+
if (k--, O--, O < 0 || b[k] !== L[O]) {
|
|
381
|
+
var A = `
|
|
382
|
+
` + b[k].replace(" at new ", " at ");
|
|
383
|
+
return n.displayName && A.includes("<anonymous>") && (A = A.replace("<anonymous>", n.displayName)), typeof n == "function" && ue.set(n, A), A;
|
|
261
384
|
}
|
|
262
|
-
while (
|
|
385
|
+
while (k >= 1 && O >= 0);
|
|
263
386
|
break;
|
|
264
387
|
}
|
|
265
388
|
}
|
|
266
389
|
} finally {
|
|
267
|
-
|
|
390
|
+
Se = !1, we.current = T, zt(), Error.prepareStackTrace = _;
|
|
268
391
|
}
|
|
269
|
-
var
|
|
270
|
-
return typeof
|
|
392
|
+
var Z = n ? n.displayName || n.name : "", G = Z ? se(Z) : "";
|
|
393
|
+
return typeof n == "function" && ue.set(n, G), G;
|
|
271
394
|
}
|
|
272
|
-
function
|
|
273
|
-
return
|
|
395
|
+
function Gt(n, d, p) {
|
|
396
|
+
return tt(n, !1);
|
|
274
397
|
}
|
|
275
|
-
function
|
|
276
|
-
var
|
|
277
|
-
return !!(
|
|
398
|
+
function Xt(n) {
|
|
399
|
+
var d = n.prototype;
|
|
400
|
+
return !!(d && d.isReactComponent);
|
|
278
401
|
}
|
|
279
|
-
function
|
|
280
|
-
if (
|
|
402
|
+
function ce(n, d, p) {
|
|
403
|
+
if (n == null)
|
|
281
404
|
return "";
|
|
282
|
-
if (typeof
|
|
283
|
-
return
|
|
284
|
-
if (typeof
|
|
285
|
-
return
|
|
286
|
-
switch (
|
|
287
|
-
case
|
|
288
|
-
return
|
|
289
|
-
case
|
|
290
|
-
return
|
|
291
|
-
}
|
|
292
|
-
if (typeof
|
|
293
|
-
switch (
|
|
405
|
+
if (typeof n == "function")
|
|
406
|
+
return tt(n, Xt(n));
|
|
407
|
+
if (typeof n == "string")
|
|
408
|
+
return se(n);
|
|
409
|
+
switch (n) {
|
|
410
|
+
case m:
|
|
411
|
+
return se("Suspense");
|
|
412
|
+
case h:
|
|
413
|
+
return se("SuspenseList");
|
|
414
|
+
}
|
|
415
|
+
if (typeof n == "object")
|
|
416
|
+
switch (n.$$typeof) {
|
|
417
|
+
case u:
|
|
418
|
+
return Gt(n.render);
|
|
294
419
|
case c:
|
|
295
|
-
return
|
|
296
|
-
case
|
|
297
|
-
|
|
298
|
-
case O: {
|
|
299
|
-
var n = e, i = n._payload, u = n._init;
|
|
420
|
+
return ce(n.type, d, p);
|
|
421
|
+
case v: {
|
|
422
|
+
var g = n, _ = g._payload, T = g._init;
|
|
300
423
|
try {
|
|
301
|
-
return
|
|
424
|
+
return ce(T(_), d, p);
|
|
302
425
|
} catch {
|
|
303
426
|
}
|
|
304
427
|
}
|
|
305
428
|
}
|
|
306
429
|
return "";
|
|
307
430
|
}
|
|
308
|
-
var
|
|
309
|
-
function
|
|
310
|
-
if (
|
|
311
|
-
var
|
|
312
|
-
|
|
431
|
+
var re = Object.prototype.hasOwnProperty, rt = {}, nt = C.ReactDebugCurrentFrame;
|
|
432
|
+
function fe(n) {
|
|
433
|
+
if (n) {
|
|
434
|
+
var d = n._owner, p = ce(n.type, n._source, d ? d.type : null);
|
|
435
|
+
nt.setExtraStackFrame(p);
|
|
313
436
|
} else
|
|
314
|
-
|
|
437
|
+
nt.setExtraStackFrame(null);
|
|
315
438
|
}
|
|
316
|
-
function
|
|
439
|
+
function Zt(n, d, p, g, _) {
|
|
317
440
|
{
|
|
318
|
-
var
|
|
319
|
-
for (var
|
|
320
|
-
if (
|
|
321
|
-
var
|
|
441
|
+
var T = Function.call.bind(re);
|
|
442
|
+
for (var S in n)
|
|
443
|
+
if (T(n, S)) {
|
|
444
|
+
var b = void 0;
|
|
322
445
|
try {
|
|
323
|
-
if (typeof
|
|
324
|
-
var
|
|
325
|
-
throw
|
|
446
|
+
if (typeof n[S] != "function") {
|
|
447
|
+
var L = Error((g || "React class") + ": " + p + " type `" + S + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof n[S] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
448
|
+
throw L.name = "Invariant Violation", L;
|
|
326
449
|
}
|
|
327
|
-
|
|
328
|
-
} catch (
|
|
329
|
-
|
|
450
|
+
b = n[S](d, S, g, p, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
451
|
+
} catch (k) {
|
|
452
|
+
b = k;
|
|
330
453
|
}
|
|
331
|
-
|
|
454
|
+
b && !(b instanceof Error) && (fe(_), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", g || "React class", p, S, typeof b), fe(null)), b instanceof Error && !(b.message in rt) && (rt[b.message] = !0, fe(_), R("Failed %s type: %s", p, b.message), fe(null));
|
|
332
455
|
}
|
|
333
456
|
}
|
|
334
457
|
}
|
|
335
|
-
var
|
|
336
|
-
function
|
|
337
|
-
return
|
|
458
|
+
var Qt = Array.isArray;
|
|
459
|
+
function xe(n) {
|
|
460
|
+
return Qt(n);
|
|
338
461
|
}
|
|
339
|
-
function
|
|
462
|
+
function er(n) {
|
|
340
463
|
{
|
|
341
|
-
var
|
|
342
|
-
return
|
|
464
|
+
var d = typeof Symbol == "function" && Symbol.toStringTag, p = d && n[Symbol.toStringTag] || n.constructor.name || "Object";
|
|
465
|
+
return p;
|
|
343
466
|
}
|
|
344
467
|
}
|
|
345
|
-
function
|
|
468
|
+
function tr(n) {
|
|
346
469
|
try {
|
|
347
|
-
return
|
|
470
|
+
return at(n), !1;
|
|
348
471
|
} catch {
|
|
349
472
|
return !0;
|
|
350
473
|
}
|
|
351
474
|
}
|
|
352
|
-
function
|
|
353
|
-
return "" +
|
|
475
|
+
function at(n) {
|
|
476
|
+
return "" + n;
|
|
354
477
|
}
|
|
355
|
-
function
|
|
356
|
-
if (
|
|
357
|
-
return
|
|
478
|
+
function ot(n) {
|
|
479
|
+
if (tr(n))
|
|
480
|
+
return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", er(n)), at(n);
|
|
358
481
|
}
|
|
359
|
-
var
|
|
482
|
+
var it = C.ReactCurrentOwner, rr = {
|
|
360
483
|
key: !0,
|
|
361
484
|
ref: !0,
|
|
362
485
|
__self: !0,
|
|
363
486
|
__source: !0
|
|
364
|
-
},
|
|
365
|
-
function
|
|
366
|
-
if (
|
|
367
|
-
var
|
|
368
|
-
if (
|
|
487
|
+
}, lt, st;
|
|
488
|
+
function nr(n) {
|
|
489
|
+
if (re.call(n, "ref")) {
|
|
490
|
+
var d = Object.getOwnPropertyDescriptor(n, "ref").get;
|
|
491
|
+
if (d && d.isReactWarning)
|
|
369
492
|
return !1;
|
|
370
493
|
}
|
|
371
|
-
return
|
|
494
|
+
return n.ref !== void 0;
|
|
372
495
|
}
|
|
373
|
-
function
|
|
374
|
-
if (
|
|
375
|
-
var
|
|
376
|
-
if (
|
|
496
|
+
function ar(n) {
|
|
497
|
+
if (re.call(n, "key")) {
|
|
498
|
+
var d = Object.getOwnPropertyDescriptor(n, "key").get;
|
|
499
|
+
if (d && d.isReactWarning)
|
|
377
500
|
return !1;
|
|
378
501
|
}
|
|
379
|
-
return
|
|
502
|
+
return n.key !== void 0;
|
|
380
503
|
}
|
|
381
|
-
function
|
|
382
|
-
typeof
|
|
504
|
+
function or(n, d) {
|
|
505
|
+
typeof n.ref == "string" && it.current;
|
|
383
506
|
}
|
|
384
|
-
function
|
|
507
|
+
function ir(n, d) {
|
|
385
508
|
{
|
|
386
|
-
var
|
|
387
|
-
|
|
509
|
+
var p = function() {
|
|
510
|
+
lt || (lt = !0, R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", d));
|
|
388
511
|
};
|
|
389
|
-
|
|
390
|
-
get:
|
|
512
|
+
p.isReactWarning = !0, Object.defineProperty(n, "key", {
|
|
513
|
+
get: p,
|
|
391
514
|
configurable: !0
|
|
392
515
|
});
|
|
393
516
|
}
|
|
394
517
|
}
|
|
395
|
-
function
|
|
518
|
+
function lr(n, d) {
|
|
396
519
|
{
|
|
397
|
-
var
|
|
398
|
-
|
|
520
|
+
var p = function() {
|
|
521
|
+
st || (st = !0, R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", d));
|
|
399
522
|
};
|
|
400
|
-
|
|
401
|
-
get:
|
|
523
|
+
p.isReactWarning = !0, Object.defineProperty(n, "ref", {
|
|
524
|
+
get: p,
|
|
402
525
|
configurable: !0
|
|
403
526
|
});
|
|
404
527
|
}
|
|
405
528
|
}
|
|
406
|
-
var
|
|
407
|
-
var
|
|
529
|
+
var sr = function(n, d, p, g, _, T, S) {
|
|
530
|
+
var b = {
|
|
408
531
|
// This tag allows us to uniquely identify this as a React Element
|
|
409
|
-
$$typeof:
|
|
532
|
+
$$typeof: t,
|
|
410
533
|
// Built-in properties that belong on the element
|
|
411
|
-
type:
|
|
412
|
-
key:
|
|
413
|
-
ref:
|
|
414
|
-
props:
|
|
534
|
+
type: n,
|
|
535
|
+
key: d,
|
|
536
|
+
ref: p,
|
|
537
|
+
props: S,
|
|
415
538
|
// Record the component responsible for creating this element.
|
|
416
|
-
_owner:
|
|
539
|
+
_owner: T
|
|
417
540
|
};
|
|
418
|
-
return
|
|
541
|
+
return b._store = {}, Object.defineProperty(b._store, "validated", {
|
|
419
542
|
configurable: !1,
|
|
420
543
|
enumerable: !1,
|
|
421
544
|
writable: !0,
|
|
422
545
|
value: !1
|
|
423
|
-
}), Object.defineProperty(
|
|
546
|
+
}), Object.defineProperty(b, "_self", {
|
|
424
547
|
configurable: !1,
|
|
425
548
|
enumerable: !1,
|
|
426
549
|
writable: !1,
|
|
427
|
-
value:
|
|
428
|
-
}), Object.defineProperty(
|
|
550
|
+
value: g
|
|
551
|
+
}), Object.defineProperty(b, "_source", {
|
|
429
552
|
configurable: !1,
|
|
430
553
|
enumerable: !1,
|
|
431
554
|
writable: !1,
|
|
432
|
-
value:
|
|
433
|
-
}), Object.freeze && (Object.freeze(
|
|
555
|
+
value: _
|
|
556
|
+
}), Object.freeze && (Object.freeze(b.props), Object.freeze(b)), b;
|
|
434
557
|
};
|
|
435
|
-
function
|
|
558
|
+
function ur(n, d, p, g, _) {
|
|
436
559
|
{
|
|
437
|
-
var
|
|
438
|
-
|
|
439
|
-
for (
|
|
440
|
-
|
|
441
|
-
if (
|
|
442
|
-
var
|
|
443
|
-
for (
|
|
444
|
-
|
|
560
|
+
var T, S = {}, b = null, L = null;
|
|
561
|
+
p !== void 0 && (ot(p), b = "" + p), ar(d) && (ot(d.key), b = "" + d.key), nr(d) && (L = d.ref, or(d, _));
|
|
562
|
+
for (T in d)
|
|
563
|
+
re.call(d, T) && !rr.hasOwnProperty(T) && (S[T] = d[T]);
|
|
564
|
+
if (n && n.defaultProps) {
|
|
565
|
+
var k = n.defaultProps;
|
|
566
|
+
for (T in k)
|
|
567
|
+
S[T] === void 0 && (S[T] = k[T]);
|
|
445
568
|
}
|
|
446
|
-
if (
|
|
447
|
-
var
|
|
448
|
-
|
|
569
|
+
if (b || L) {
|
|
570
|
+
var O = typeof n == "function" ? n.displayName || n.name || "Unknown" : n;
|
|
571
|
+
b && ir(S, O), L && lr(S, O);
|
|
449
572
|
}
|
|
450
|
-
return
|
|
573
|
+
return sr(n, b, L, _, g, it.current, S);
|
|
451
574
|
}
|
|
452
575
|
}
|
|
453
|
-
var
|
|
454
|
-
function
|
|
455
|
-
if (
|
|
456
|
-
var
|
|
457
|
-
|
|
576
|
+
var Ce = C.ReactCurrentOwner, ut = C.ReactDebugCurrentFrame;
|
|
577
|
+
function X(n) {
|
|
578
|
+
if (n) {
|
|
579
|
+
var d = n._owner, p = ce(n.type, n._source, d ? d.type : null);
|
|
580
|
+
ut.setExtraStackFrame(p);
|
|
458
581
|
} else
|
|
459
|
-
|
|
582
|
+
ut.setExtraStackFrame(null);
|
|
460
583
|
}
|
|
461
|
-
var
|
|
462
|
-
|
|
463
|
-
function
|
|
464
|
-
return typeof
|
|
584
|
+
var _e;
|
|
585
|
+
_e = !1;
|
|
586
|
+
function Pe(n) {
|
|
587
|
+
return typeof n == "object" && n !== null && n.$$typeof === t;
|
|
465
588
|
}
|
|
466
|
-
function
|
|
589
|
+
function ct() {
|
|
467
590
|
{
|
|
468
|
-
if (
|
|
469
|
-
var
|
|
470
|
-
if (
|
|
591
|
+
if (Ce.current) {
|
|
592
|
+
var n = N(Ce.current.type);
|
|
593
|
+
if (n)
|
|
471
594
|
return `
|
|
472
595
|
|
|
473
|
-
Check the render method of \`` +
|
|
596
|
+
Check the render method of \`` + n + "`.";
|
|
474
597
|
}
|
|
475
598
|
return "";
|
|
476
599
|
}
|
|
477
600
|
}
|
|
478
|
-
function
|
|
601
|
+
function cr(n) {
|
|
479
602
|
return "";
|
|
480
603
|
}
|
|
481
|
-
var
|
|
482
|
-
function
|
|
604
|
+
var ft = {};
|
|
605
|
+
function fr(n) {
|
|
483
606
|
{
|
|
484
|
-
var
|
|
485
|
-
if (!
|
|
486
|
-
var
|
|
487
|
-
|
|
607
|
+
var d = ct();
|
|
608
|
+
if (!d) {
|
|
609
|
+
var p = typeof n == "string" ? n : n.displayName || n.name;
|
|
610
|
+
p && (d = `
|
|
488
611
|
|
|
489
|
-
Check the top-level render call using <` +
|
|
612
|
+
Check the top-level render call using <` + p + ">.");
|
|
490
613
|
}
|
|
491
|
-
return
|
|
614
|
+
return d;
|
|
492
615
|
}
|
|
493
616
|
}
|
|
494
|
-
function
|
|
617
|
+
function dt(n, d) {
|
|
495
618
|
{
|
|
496
|
-
if (!
|
|
619
|
+
if (!n._store || n._store.validated || n.key != null)
|
|
497
620
|
return;
|
|
498
|
-
|
|
499
|
-
var
|
|
500
|
-
if (
|
|
621
|
+
n._store.validated = !0;
|
|
622
|
+
var p = fr(d);
|
|
623
|
+
if (ft[p])
|
|
501
624
|
return;
|
|
502
|
-
|
|
503
|
-
var
|
|
504
|
-
|
|
625
|
+
ft[p] = !0;
|
|
626
|
+
var g = "";
|
|
627
|
+
n && n._owner && n._owner !== Ce.current && (g = " It was passed a child from " + N(n._owner.type) + "."), X(n), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', p, g), X(null);
|
|
505
628
|
}
|
|
506
629
|
}
|
|
507
|
-
function
|
|
630
|
+
function ht(n, d) {
|
|
508
631
|
{
|
|
509
|
-
if (typeof
|
|
632
|
+
if (typeof n != "object")
|
|
510
633
|
return;
|
|
511
|
-
if (
|
|
512
|
-
for (var
|
|
513
|
-
var
|
|
514
|
-
|
|
634
|
+
if (xe(n))
|
|
635
|
+
for (var p = 0; p < n.length; p++) {
|
|
636
|
+
var g = n[p];
|
|
637
|
+
Pe(g) && dt(g, d);
|
|
515
638
|
}
|
|
516
|
-
else if (
|
|
517
|
-
|
|
518
|
-
else if (
|
|
519
|
-
var
|
|
520
|
-
if (typeof
|
|
521
|
-
for (var
|
|
522
|
-
|
|
639
|
+
else if (Pe(n))
|
|
640
|
+
n._store && (n._store.validated = !0);
|
|
641
|
+
else if (n) {
|
|
642
|
+
var _ = y(n);
|
|
643
|
+
if (typeof _ == "function" && _ !== n.entries)
|
|
644
|
+
for (var T = _.call(n), S; !(S = T.next()).done; )
|
|
645
|
+
Pe(S.value) && dt(S.value, d);
|
|
523
646
|
}
|
|
524
647
|
}
|
|
525
648
|
}
|
|
526
|
-
function
|
|
649
|
+
function dr(n) {
|
|
527
650
|
{
|
|
528
|
-
var
|
|
529
|
-
if (
|
|
651
|
+
var d = n.type;
|
|
652
|
+
if (d == null || typeof d == "string")
|
|
530
653
|
return;
|
|
531
|
-
var
|
|
532
|
-
if (typeof
|
|
533
|
-
|
|
534
|
-
else if (typeof
|
|
654
|
+
var p;
|
|
655
|
+
if (typeof d == "function")
|
|
656
|
+
p = d.propTypes;
|
|
657
|
+
else if (typeof d == "object" && (d.$$typeof === u || // Note: Memo only checks outer props here.
|
|
535
658
|
// Inner props are checked in the reconciler.
|
|
536
|
-
|
|
537
|
-
|
|
659
|
+
d.$$typeof === c))
|
|
660
|
+
p = d.propTypes;
|
|
538
661
|
else
|
|
539
662
|
return;
|
|
540
|
-
if (
|
|
541
|
-
var
|
|
542
|
-
|
|
543
|
-
} else if (
|
|
544
|
-
|
|
545
|
-
var
|
|
546
|
-
|
|
663
|
+
if (p) {
|
|
664
|
+
var g = N(d);
|
|
665
|
+
Zt(p, n.props, "prop", g, n);
|
|
666
|
+
} else if (d.PropTypes !== void 0 && !_e) {
|
|
667
|
+
_e = !0;
|
|
668
|
+
var _ = N(d);
|
|
669
|
+
R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _ || "Unknown");
|
|
547
670
|
}
|
|
548
|
-
typeof
|
|
671
|
+
typeof d.getDefaultProps == "function" && !d.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
549
672
|
}
|
|
550
673
|
}
|
|
551
|
-
function
|
|
674
|
+
function hr(n) {
|
|
552
675
|
{
|
|
553
|
-
for (var
|
|
554
|
-
var
|
|
555
|
-
if (
|
|
556
|
-
|
|
676
|
+
for (var d = Object.keys(n.props), p = 0; p < d.length; p++) {
|
|
677
|
+
var g = d[p];
|
|
678
|
+
if (g !== "children" && g !== "key") {
|
|
679
|
+
X(n), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", g), X(null);
|
|
557
680
|
break;
|
|
558
681
|
}
|
|
559
682
|
}
|
|
560
|
-
|
|
683
|
+
n.ref !== null && (X(n), R("Invalid attribute `ref` supplied to `React.Fragment`."), X(null));
|
|
561
684
|
}
|
|
562
685
|
}
|
|
563
|
-
var
|
|
564
|
-
function
|
|
686
|
+
var mt = {};
|
|
687
|
+
function pt(n, d, p, g, _, T) {
|
|
565
688
|
{
|
|
566
|
-
var
|
|
567
|
-
if (!
|
|
568
|
-
var
|
|
569
|
-
(
|
|
570
|
-
var
|
|
571
|
-
|
|
572
|
-
var
|
|
573
|
-
|
|
689
|
+
var S = te(n);
|
|
690
|
+
if (!S) {
|
|
691
|
+
var b = "";
|
|
692
|
+
(n === void 0 || typeof n == "object" && n !== null && Object.keys(n).length === 0) && (b += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
693
|
+
var L = cr();
|
|
694
|
+
L ? b += L : b += ct();
|
|
695
|
+
var k;
|
|
696
|
+
n === null ? k = "null" : xe(n) ? k = "array" : n !== void 0 && n.$$typeof === t ? (k = "<" + (N(n.type) || "Unknown") + " />", b = " Did you accidentally export a JSX literal instead of a component?") : k = typeof n, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", k, b);
|
|
574
697
|
}
|
|
575
|
-
var
|
|
576
|
-
if (
|
|
577
|
-
return
|
|
578
|
-
if (
|
|
579
|
-
var
|
|
580
|
-
if (
|
|
581
|
-
if (
|
|
582
|
-
if (
|
|
583
|
-
for (var
|
|
584
|
-
|
|
585
|
-
Object.freeze && Object.freeze(
|
|
698
|
+
var O = ur(n, d, p, _, T);
|
|
699
|
+
if (O == null)
|
|
700
|
+
return O;
|
|
701
|
+
if (S) {
|
|
702
|
+
var A = d.children;
|
|
703
|
+
if (A !== void 0)
|
|
704
|
+
if (g)
|
|
705
|
+
if (xe(A)) {
|
|
706
|
+
for (var Z = 0; Z < A.length; Z++)
|
|
707
|
+
ht(A[Z], n);
|
|
708
|
+
Object.freeze && Object.freeze(A);
|
|
586
709
|
} else
|
|
587
|
-
|
|
710
|
+
R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
588
711
|
else
|
|
589
|
-
|
|
712
|
+
ht(A, n);
|
|
590
713
|
}
|
|
591
|
-
if (
|
|
592
|
-
var
|
|
593
|
-
return
|
|
594
|
-
}),
|
|
595
|
-
if (!
|
|
596
|
-
var
|
|
597
|
-
|
|
714
|
+
if (re.call(d, "key")) {
|
|
715
|
+
var G = N(n), F = Object.keys(d).filter(function(Rr) {
|
|
716
|
+
return Rr !== "key";
|
|
717
|
+
}), Te = F.length > 0 ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
718
|
+
if (!mt[G + Te]) {
|
|
719
|
+
var yr = F.length > 0 ? "{" + F.join(": ..., ") + ": ...}" : "{}";
|
|
720
|
+
R(`A props object containing a "key" prop is being spread into JSX:
|
|
598
721
|
let props = %s;
|
|
599
722
|
<%s {...props} />
|
|
600
723
|
React keys must be passed directly to JSX without using spread:
|
|
601
724
|
let props = %s;
|
|
602
|
-
<%s key={someKey} {...props} />`,
|
|
725
|
+
<%s key={someKey} {...props} />`, Te, G, yr, G), mt[G + Te] = !0;
|
|
603
726
|
}
|
|
604
727
|
}
|
|
605
|
-
return
|
|
728
|
+
return n === a ? hr(O) : dr(O), O;
|
|
606
729
|
}
|
|
607
730
|
}
|
|
608
|
-
function
|
|
609
|
-
return
|
|
731
|
+
function mr(n, d, p) {
|
|
732
|
+
return pt(n, d, p, !0);
|
|
610
733
|
}
|
|
611
|
-
function
|
|
612
|
-
return
|
|
734
|
+
function pr(n, d, p) {
|
|
735
|
+
return pt(n, d, p, !1);
|
|
613
736
|
}
|
|
614
|
-
var
|
|
615
|
-
|
|
616
|
-
})()),
|
|
737
|
+
var vr = pr, gr = mr;
|
|
738
|
+
ae.Fragment = a, ae.jsx = vr, ae.jsxs = gr;
|
|
739
|
+
})()), ae;
|
|
617
740
|
}
|
|
618
|
-
var
|
|
619
|
-
function
|
|
620
|
-
return
|
|
741
|
+
var Et;
|
|
742
|
+
function kr() {
|
|
743
|
+
return Et || (Et = 1, process.env.NODE_ENV === "production" ? de.exports = Pr() : de.exports = Tr()), de.exports;
|
|
621
744
|
}
|
|
622
|
-
var
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
isAuthenticated: !1,
|
|
632
|
-
user: null
|
|
633
|
-
}), w = () => {
|
|
634
|
-
const b = encodeURIComponent(window.location.href);
|
|
635
|
-
let f = `${y}/login?next=${b}`;
|
|
636
|
-
_ && (f += `&app=${_}`), window.location.href = f;
|
|
637
|
-
}, R = hr(async () => {
|
|
745
|
+
var Q = kr();
|
|
746
|
+
const ia = ({ children: e, authConfig: t }) => {
|
|
747
|
+
const [r, a] = Ie(null), [o, i] = Ie(!0), l = wr(() => new Sr(t), [t]), f = ke(async () => {
|
|
748
|
+
i(!0);
|
|
749
|
+
const h = localStorage.getItem(l.config.baseKey + "_access");
|
|
750
|
+
if (!h) {
|
|
751
|
+
a(null), i(!1);
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
638
754
|
try {
|
|
639
|
-
const
|
|
640
|
-
|
|
755
|
+
const c = await Pt(l, `${l.config.authServer}/me`, {
|
|
756
|
+
headers: {
|
|
757
|
+
Authorization: `Bearer ${h}`
|
|
758
|
+
}
|
|
641
759
|
});
|
|
642
|
-
if (!
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
760
|
+
if (!c.ok) throw new Error("not found");
|
|
761
|
+
const v = await c.json();
|
|
762
|
+
a({
|
|
763
|
+
role: v.role.role_name,
|
|
764
|
+
userId: v.user_id,
|
|
765
|
+
userName: v.user_name,
|
|
766
|
+
privileges: v.role.privileges.map((E) => E.privilege.trim())
|
|
648
767
|
});
|
|
649
768
|
} catch {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
}, [
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
769
|
+
a(null);
|
|
770
|
+
}
|
|
771
|
+
i(!1);
|
|
772
|
+
}, []);
|
|
773
|
+
Ae(() => {
|
|
774
|
+
f();
|
|
775
|
+
}, [f]);
|
|
776
|
+
const u = ke(() => {
|
|
777
|
+
De(l);
|
|
778
|
+
}, [De, l]), m = ke(() => {
|
|
779
|
+
gt(l), a(null);
|
|
780
|
+
}, [gt, l]);
|
|
781
|
+
return /* @__PURE__ */ Q.jsx(je.Provider, { value: { loadMe: f, loading: o, user: r, login: u, authManager: l, logout: m }, children: e });
|
|
782
|
+
}, la = () => {
|
|
783
|
+
const { authManager: e, loadMe: t } = _t(je);
|
|
784
|
+
return Ae(() => {
|
|
785
|
+
e && (vt(e), t());
|
|
786
|
+
}, [vt, e, t]), /* @__PURE__ */ Q.jsx("div", {});
|
|
787
|
+
};
|
|
788
|
+
function $(e, t) {
|
|
789
|
+
if (e === !1 || e === null || typeof e > "u")
|
|
790
|
+
throw new Error(t);
|
|
791
|
+
}
|
|
792
|
+
function Y(e, t) {
|
|
793
|
+
if (!e) {
|
|
794
|
+
typeof console < "u" && console.warn(t);
|
|
795
|
+
try {
|
|
796
|
+
throw new Error(t);
|
|
797
|
+
} catch {
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
function Fe({
|
|
802
|
+
pathname: e = "/",
|
|
803
|
+
search: t = "",
|
|
804
|
+
hash: r = ""
|
|
805
|
+
}) {
|
|
806
|
+
return t && t !== "?" && (e += t.charAt(0) === "?" ? t : "?" + t), r && r !== "#" && (e += r.charAt(0) === "#" ? r : "#" + r), e;
|
|
807
|
+
}
|
|
808
|
+
function Ne(e) {
|
|
809
|
+
let t = {};
|
|
810
|
+
if (e) {
|
|
811
|
+
let r = e.indexOf("#");
|
|
812
|
+
r >= 0 && (t.hash = e.substring(r), e = e.substring(0, r));
|
|
813
|
+
let a = e.indexOf("?");
|
|
814
|
+
a >= 0 && (t.search = e.substring(a), e = e.substring(0, a)), e && (t.pathname = e);
|
|
815
|
+
}
|
|
816
|
+
return t;
|
|
817
|
+
}
|
|
818
|
+
function Tt(e, t, r = "/") {
|
|
819
|
+
return Or(e, t, r, !1);
|
|
820
|
+
}
|
|
821
|
+
function Or(e, t, r, a) {
|
|
822
|
+
let o = typeof t == "string" ? Ne(t) : t, i = z(o.pathname || "/", r);
|
|
823
|
+
if (i == null)
|
|
824
|
+
return null;
|
|
825
|
+
let l = kt(e);
|
|
826
|
+
$r(l);
|
|
827
|
+
let f = null;
|
|
828
|
+
for (let u = 0; f == null && u < l.length; ++u) {
|
|
829
|
+
let m = Br(i);
|
|
830
|
+
f = Mr(
|
|
831
|
+
l[u],
|
|
832
|
+
m,
|
|
833
|
+
a
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
return f;
|
|
837
|
+
}
|
|
838
|
+
function kt(e, t = [], r = [], a = "", o = !1) {
|
|
839
|
+
let i = (l, f, u = o, m) => {
|
|
840
|
+
let h = {
|
|
841
|
+
relativePath: m === void 0 ? l.path || "" : m,
|
|
842
|
+
caseSensitive: l.caseSensitive === !0,
|
|
843
|
+
childrenIndex: f,
|
|
844
|
+
route: l
|
|
845
|
+
};
|
|
846
|
+
if (h.relativePath.startsWith("/")) {
|
|
847
|
+
if (!h.relativePath.startsWith(a) && u)
|
|
848
|
+
return;
|
|
849
|
+
$(
|
|
850
|
+
h.relativePath.startsWith(a),
|
|
851
|
+
`Absolute route path "${h.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
|
|
852
|
+
), h.relativePath = h.relativePath.slice(a.length);
|
|
853
|
+
}
|
|
854
|
+
let c = H([a, h.relativePath]), v = r.concat(h);
|
|
855
|
+
l.children && l.children.length > 0 && ($(
|
|
856
|
+
// Our types know better, but runtime JS may not!
|
|
857
|
+
// @ts-expect-error
|
|
858
|
+
l.index !== !0,
|
|
859
|
+
`Index routes must not have child routes. Please remove all child routes from route path "${c}".`
|
|
860
|
+
), kt(
|
|
861
|
+
l.children,
|
|
862
|
+
t,
|
|
863
|
+
v,
|
|
864
|
+
c,
|
|
865
|
+
u
|
|
866
|
+
)), !(l.path == null && !l.index) && t.push({
|
|
867
|
+
path: c,
|
|
868
|
+
score: Nr(c, l.index),
|
|
869
|
+
routesMeta: v
|
|
870
|
+
});
|
|
871
|
+
};
|
|
872
|
+
return e.forEach((l, f) => {
|
|
873
|
+
if (l.path === "" || !l.path?.includes("?"))
|
|
874
|
+
i(l, f);
|
|
875
|
+
else
|
|
876
|
+
for (let u of Ot(l.path))
|
|
877
|
+
i(l, f, !0, u);
|
|
878
|
+
}), t;
|
|
879
|
+
}
|
|
880
|
+
function Ot(e) {
|
|
881
|
+
let t = e.split("/");
|
|
882
|
+
if (t.length === 0) return [];
|
|
883
|
+
let [r, ...a] = t, o = r.endsWith("?"), i = r.replace(/\?$/, "");
|
|
884
|
+
if (a.length === 0)
|
|
885
|
+
return o ? [i, ""] : [i];
|
|
886
|
+
let l = Ot(a.join("/")), f = [];
|
|
887
|
+
return f.push(
|
|
888
|
+
...l.map(
|
|
889
|
+
(u) => u === "" ? i : [i, u].join("/")
|
|
890
|
+
)
|
|
891
|
+
), o && f.push(...l), f.map(
|
|
892
|
+
(u) => e.startsWith("/") && u === "" ? "/" : u
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
function $r(e) {
|
|
896
|
+
e.sort(
|
|
897
|
+
(t, r) => t.score !== r.score ? r.score - t.score : Ur(
|
|
898
|
+
t.routesMeta.map((a) => a.childrenIndex),
|
|
899
|
+
r.routesMeta.map((a) => a.childrenIndex)
|
|
900
|
+
)
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
var Lr = /^:[\w-]+$/, Ir = 3, Dr = 2, Fr = 1, Ar = 10, jr = -2, wt = (e) => e === "*";
|
|
904
|
+
function Nr(e, t) {
|
|
905
|
+
let r = e.split("/"), a = r.length;
|
|
906
|
+
return r.some(wt) && (a += jr), t && (a += Dr), r.filter((o) => !wt(o)).reduce(
|
|
907
|
+
(o, i) => o + (Lr.test(i) ? Ir : i === "" ? Fr : Ar),
|
|
908
|
+
a
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
function Ur(e, t) {
|
|
912
|
+
return e.length === t.length && e.slice(0, -1).every((a, o) => a === t[o]) ? (
|
|
913
|
+
// If two routes are siblings, we should try to match the earlier sibling
|
|
914
|
+
// first. This allows people to have fine-grained control over the matching
|
|
915
|
+
// behavior by simply putting routes with identical paths in the order they
|
|
916
|
+
// want them tried.
|
|
917
|
+
e[e.length - 1] - t[t.length - 1]
|
|
918
|
+
) : (
|
|
919
|
+
// Otherwise, it doesn't really make sense to rank non-siblings by index,
|
|
920
|
+
// so they sort equally.
|
|
921
|
+
0
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
function Mr(e, t, r = !1) {
|
|
925
|
+
let { routesMeta: a } = e, o = {}, i = "/", l = [];
|
|
926
|
+
for (let f = 0; f < a.length; ++f) {
|
|
927
|
+
let u = a[f], m = f === a.length - 1, h = i === "/" ? t : t.slice(i.length) || "/", c = ve(
|
|
928
|
+
{ path: u.relativePath, caseSensitive: u.caseSensitive, end: m },
|
|
929
|
+
h
|
|
930
|
+
), v = u.route;
|
|
931
|
+
if (!c && m && r && !a[a.length - 1].route.index && (c = ve(
|
|
932
|
+
{
|
|
933
|
+
path: u.relativePath,
|
|
934
|
+
caseSensitive: u.caseSensitive,
|
|
935
|
+
end: !1
|
|
936
|
+
},
|
|
937
|
+
h
|
|
938
|
+
)), !c)
|
|
939
|
+
return null;
|
|
940
|
+
Object.assign(o, c.params), l.push({
|
|
941
|
+
// TODO: Can this as be avoided?
|
|
942
|
+
params: o,
|
|
943
|
+
pathname: H([i, c.pathname]),
|
|
944
|
+
pathnameBase: Kr(
|
|
945
|
+
H([i, c.pathnameBase])
|
|
946
|
+
),
|
|
947
|
+
route: v
|
|
948
|
+
}), c.pathnameBase !== "/" && (i = H([i, c.pathnameBase]));
|
|
949
|
+
}
|
|
950
|
+
return l;
|
|
951
|
+
}
|
|
952
|
+
function ve(e, t) {
|
|
953
|
+
typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
|
|
954
|
+
let [r, a] = Wr(
|
|
955
|
+
e.path,
|
|
956
|
+
e.caseSensitive,
|
|
957
|
+
e.end
|
|
958
|
+
), o = t.match(r);
|
|
959
|
+
if (!o) return null;
|
|
960
|
+
let i = o[0], l = i.replace(/(.)\/+$/, "$1"), f = o.slice(1);
|
|
961
|
+
return {
|
|
962
|
+
params: a.reduce(
|
|
963
|
+
(m, { paramName: h, isOptional: c }, v) => {
|
|
964
|
+
if (h === "*") {
|
|
965
|
+
let w = f[v] || "";
|
|
966
|
+
l = i.slice(0, i.length - w.length).replace(/(.)\/+$/, "$1");
|
|
967
|
+
}
|
|
968
|
+
const E = f[v];
|
|
969
|
+
return c && !E ? m[h] = void 0 : m[h] = (E || "").replace(/%2F/g, "/"), m;
|
|
970
|
+
},
|
|
971
|
+
{}
|
|
972
|
+
),
|
|
973
|
+
pathname: i,
|
|
974
|
+
pathnameBase: l,
|
|
975
|
+
pattern: e
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
function Wr(e, t = !1, r = !0) {
|
|
979
|
+
Y(
|
|
980
|
+
e === "*" || !e.endsWith("*") || e.endsWith("/*"),
|
|
981
|
+
`Route path "${e}" will be treated as if it were "${e.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/, "/*")}".`
|
|
982
|
+
);
|
|
983
|
+
let a = [], o = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
|
|
984
|
+
/\/:([\w-]+)(\?)?/g,
|
|
985
|
+
(l, f, u, m, h) => {
|
|
986
|
+
if (a.push({ paramName: f, isOptional: u != null }), u) {
|
|
987
|
+
let c = h.charAt(m + l.length);
|
|
988
|
+
return c && c !== "/" ? "/([^\\/]*)" : "(?:/([^\\/]*))?";
|
|
989
|
+
}
|
|
990
|
+
return "/([^\\/]+)";
|
|
991
|
+
}
|
|
992
|
+
).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
|
|
993
|
+
return e.endsWith("*") ? (a.push({ paramName: "*" }), o += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : r ? o += "\\/*$" : e !== "" && e !== "/" && (o += "(?:(?=\\/|$))"), [new RegExp(o, t ? void 0 : "i"), a];
|
|
994
|
+
}
|
|
995
|
+
function Br(e) {
|
|
996
|
+
try {
|
|
997
|
+
return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
|
|
998
|
+
} catch (t) {
|
|
999
|
+
return Y(
|
|
1000
|
+
!1,
|
|
1001
|
+
`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`
|
|
1002
|
+
), e;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
function z(e, t) {
|
|
1006
|
+
if (t === "/") return e;
|
|
1007
|
+
if (!e.toLowerCase().startsWith(t.toLowerCase()))
|
|
1008
|
+
return null;
|
|
1009
|
+
let r = t.endsWith("/") ? t.length - 1 : t.length, a = e.charAt(r);
|
|
1010
|
+
return a && a !== "/" ? null : e.slice(r) || "/";
|
|
1011
|
+
}
|
|
1012
|
+
var Hr = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
1013
|
+
function Vr(e, t = "/") {
|
|
1014
|
+
let {
|
|
1015
|
+
pathname: r,
|
|
1016
|
+
search: a = "",
|
|
1017
|
+
hash: o = ""
|
|
1018
|
+
} = typeof e == "string" ? Ne(e) : e, i;
|
|
1019
|
+
return r ? (r = r.replace(/\/\/+/g, "/"), r.startsWith("/") ? i = bt(r.substring(1), "/") : i = bt(r, t)) : i = t, {
|
|
1020
|
+
pathname: i,
|
|
1021
|
+
search: Jr(a),
|
|
1022
|
+
hash: zr(o)
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
function bt(e, t) {
|
|
1026
|
+
let r = t.replace(/\/+$/, "").split("/");
|
|
1027
|
+
return e.split("/").forEach((o) => {
|
|
1028
|
+
o === ".." ? r.length > 1 && r.pop() : o !== "." && r.push(o);
|
|
1029
|
+
}), r.length > 1 ? r.join("/") : "/";
|
|
1030
|
+
}
|
|
1031
|
+
function Oe(e, t, r, a) {
|
|
1032
|
+
return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
|
|
1033
|
+
a
|
|
1034
|
+
)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
|
|
1035
|
+
}
|
|
1036
|
+
function Yr(e) {
|
|
1037
|
+
return e.filter(
|
|
1038
|
+
(t, r) => r === 0 || t.route.path && t.route.path.length > 0
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
function $t(e) {
|
|
1042
|
+
let t = Yr(e);
|
|
1043
|
+
return t.map(
|
|
1044
|
+
(r, a) => a === t.length - 1 ? r.pathname : r.pathnameBase
|
|
1045
|
+
);
|
|
1046
|
+
}
|
|
1047
|
+
function Ue(e, t, r, a = !1) {
|
|
1048
|
+
let o;
|
|
1049
|
+
typeof e == "string" ? o = Ne(e) : (o = { ...e }, $(
|
|
1050
|
+
!o.pathname || !o.pathname.includes("?"),
|
|
1051
|
+
Oe("?", "pathname", "search", o)
|
|
1052
|
+
), $(
|
|
1053
|
+
!o.pathname || !o.pathname.includes("#"),
|
|
1054
|
+
Oe("#", "pathname", "hash", o)
|
|
1055
|
+
), $(
|
|
1056
|
+
!o.search || !o.search.includes("#"),
|
|
1057
|
+
Oe("#", "search", "hash", o)
|
|
1058
|
+
));
|
|
1059
|
+
let i = e === "" || o.pathname === "", l = i ? "/" : o.pathname, f;
|
|
1060
|
+
if (l == null)
|
|
1061
|
+
f = r;
|
|
1062
|
+
else {
|
|
1063
|
+
let c = t.length - 1;
|
|
1064
|
+
if (!a && l.startsWith("..")) {
|
|
1065
|
+
let v = l.split("/");
|
|
1066
|
+
for (; v[0] === ".."; )
|
|
1067
|
+
v.shift(), c -= 1;
|
|
1068
|
+
o.pathname = v.join("/");
|
|
1069
|
+
}
|
|
1070
|
+
f = c >= 0 ? t[c] : "/";
|
|
1071
|
+
}
|
|
1072
|
+
let u = Vr(o, f), m = l && l !== "/" && l.endsWith("/"), h = (i || l === ".") && r.endsWith("/");
|
|
1073
|
+
return !u.pathname.endsWith("/") && (m || h) && (u.pathname += "/"), u;
|
|
1074
|
+
}
|
|
1075
|
+
var H = (e) => e.join("/").replace(/\/\/+/g, "/"), Kr = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), Jr = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, zr = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e, qr = class {
|
|
1076
|
+
constructor(e, t, r, a = !1) {
|
|
1077
|
+
this.status = e, this.statusText = t || "", this.internal = a, r instanceof Error ? (this.data = r.toString(), this.error = r) : this.data = r;
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
function Gr(e) {
|
|
1081
|
+
return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
|
|
1082
|
+
}
|
|
1083
|
+
function Xr(e) {
|
|
1084
|
+
return e.map((t) => t.route.path).filter(Boolean).join("/").replace(/\/\/*/g, "/") || "/";
|
|
1085
|
+
}
|
|
1086
|
+
var Lt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
|
|
1087
|
+
function It(e, t) {
|
|
1088
|
+
let r = e;
|
|
1089
|
+
if (typeof r != "string" || !Hr.test(r))
|
|
1090
|
+
return {
|
|
1091
|
+
absoluteURL: void 0,
|
|
1092
|
+
isExternal: !1,
|
|
1093
|
+
to: r
|
|
1094
|
+
};
|
|
1095
|
+
let a = r, o = !1;
|
|
1096
|
+
if (Lt)
|
|
1097
|
+
try {
|
|
1098
|
+
let i = new URL(window.location.href), l = r.startsWith("//") ? new URL(i.protocol + r) : new URL(r), f = z(l.pathname, t);
|
|
1099
|
+
l.origin === i.origin && f != null ? r = f + l.search + l.hash : o = !0;
|
|
1100
|
+
} catch {
|
|
1101
|
+
Y(
|
|
1102
|
+
!1,
|
|
1103
|
+
`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
1104
|
+
);
|
|
1105
|
+
}
|
|
1106
|
+
return {
|
|
1107
|
+
absoluteURL: a,
|
|
1108
|
+
isExternal: o,
|
|
1109
|
+
to: r
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
1113
|
+
var Dt = [
|
|
1114
|
+
"POST",
|
|
1115
|
+
"PUT",
|
|
1116
|
+
"PATCH",
|
|
1117
|
+
"DELETE"
|
|
1118
|
+
];
|
|
1119
|
+
new Set(
|
|
1120
|
+
Dt
|
|
1121
|
+
);
|
|
1122
|
+
var Zr = [
|
|
1123
|
+
"GET",
|
|
1124
|
+
...Dt
|
|
1125
|
+
];
|
|
1126
|
+
new Set(Zr);
|
|
1127
|
+
var ee = s.createContext(null);
|
|
1128
|
+
ee.displayName = "DataRouter";
|
|
1129
|
+
var ge = s.createContext(null);
|
|
1130
|
+
ge.displayName = "DataRouterState";
|
|
1131
|
+
var Qr = s.createContext(!1), Ft = s.createContext({
|
|
1132
|
+
isTransitioning: !1
|
|
1133
|
+
});
|
|
1134
|
+
Ft.displayName = "ViewTransition";
|
|
1135
|
+
var en = s.createContext(
|
|
1136
|
+
/* @__PURE__ */ new Map()
|
|
1137
|
+
);
|
|
1138
|
+
en.displayName = "Fetchers";
|
|
1139
|
+
var tn = s.createContext(null);
|
|
1140
|
+
tn.displayName = "Await";
|
|
1141
|
+
var U = s.createContext(
|
|
1142
|
+
null
|
|
1143
|
+
);
|
|
1144
|
+
U.displayName = "Navigation";
|
|
1145
|
+
var Me = s.createContext(
|
|
1146
|
+
null
|
|
1147
|
+
);
|
|
1148
|
+
Me.displayName = "Location";
|
|
1149
|
+
var V = s.createContext({
|
|
1150
|
+
outlet: null,
|
|
1151
|
+
matches: [],
|
|
1152
|
+
isDataRoute: !1
|
|
1153
|
+
});
|
|
1154
|
+
V.displayName = "Route";
|
|
1155
|
+
var We = s.createContext(null);
|
|
1156
|
+
We.displayName = "RouteError";
|
|
1157
|
+
var At = "REACT_ROUTER_ERROR", rn = "REDIRECT", nn = "ROUTE_ERROR_RESPONSE";
|
|
1158
|
+
function an(e) {
|
|
1159
|
+
if (e.startsWith(`${At}:${rn}:{`))
|
|
1160
|
+
try {
|
|
1161
|
+
let t = JSON.parse(e.slice(28));
|
|
1162
|
+
if (typeof t == "object" && t && typeof t.status == "number" && typeof t.statusText == "string" && typeof t.location == "string" && typeof t.reloadDocument == "boolean" && typeof t.replace == "boolean")
|
|
1163
|
+
return t;
|
|
1164
|
+
} catch {
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
function on(e) {
|
|
1168
|
+
if (e.startsWith(
|
|
1169
|
+
`${At}:${nn}:{`
|
|
1170
|
+
))
|
|
1171
|
+
try {
|
|
1172
|
+
let t = JSON.parse(e.slice(40));
|
|
1173
|
+
if (typeof t == "object" && t && typeof t.status == "number" && typeof t.statusText == "string")
|
|
1174
|
+
return new qr(
|
|
1175
|
+
t.status,
|
|
1176
|
+
t.statusText,
|
|
1177
|
+
t.data
|
|
1178
|
+
);
|
|
1179
|
+
} catch {
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
function ln(e, { relative: t } = {}) {
|
|
1183
|
+
$(
|
|
1184
|
+
ye(),
|
|
1185
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1186
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1187
|
+
"useHref() may be used only in the context of a <Router> component."
|
|
1188
|
+
);
|
|
1189
|
+
let { basename: r, navigator: a } = s.useContext(U), { hash: o, pathname: i, search: l } = ie(e, { relative: t }), f = i;
|
|
1190
|
+
return r !== "/" && (f = i === "/" ? r : H([r, i])), a.createHref({ pathname: f, search: l, hash: o });
|
|
1191
|
+
}
|
|
1192
|
+
function ye() {
|
|
1193
|
+
return s.useContext(Me) != null;
|
|
1194
|
+
}
|
|
1195
|
+
function q() {
|
|
1196
|
+
return $(
|
|
1197
|
+
ye(),
|
|
1198
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1199
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1200
|
+
"useLocation() may be used only in the context of a <Router> component."
|
|
1201
|
+
), s.useContext(Me).location;
|
|
1202
|
+
}
|
|
1203
|
+
var jt = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
|
|
1204
|
+
function Nt(e) {
|
|
1205
|
+
s.useContext(U).static || s.useLayoutEffect(e);
|
|
1206
|
+
}
|
|
1207
|
+
function sn() {
|
|
1208
|
+
let { isDataRoute: e } = s.useContext(V);
|
|
1209
|
+
return e ? Sn() : un();
|
|
1210
|
+
}
|
|
1211
|
+
function un() {
|
|
1212
|
+
$(
|
|
1213
|
+
ye(),
|
|
1214
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1215
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1216
|
+
"useNavigate() may be used only in the context of a <Router> component."
|
|
1217
|
+
);
|
|
1218
|
+
let e = s.useContext(ee), { basename: t, navigator: r } = s.useContext(U), { matches: a } = s.useContext(V), { pathname: o } = q(), i = JSON.stringify($t(a)), l = s.useRef(!1);
|
|
1219
|
+
return Nt(() => {
|
|
1220
|
+
l.current = !0;
|
|
1221
|
+
}), s.useCallback(
|
|
1222
|
+
(u, m = {}) => {
|
|
1223
|
+
if (Y(l.current, jt), !l.current) return;
|
|
1224
|
+
if (typeof u == "number") {
|
|
1225
|
+
r.go(u);
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1228
|
+
let h = Ue(
|
|
1229
|
+
u,
|
|
1230
|
+
JSON.parse(i),
|
|
1231
|
+
o,
|
|
1232
|
+
m.relative === "path"
|
|
1233
|
+
);
|
|
1234
|
+
e == null && t !== "/" && (h.pathname = h.pathname === "/" ? t : H([t, h.pathname])), (m.replace ? r.replace : r.push)(
|
|
1235
|
+
h,
|
|
1236
|
+
m.state,
|
|
1237
|
+
m
|
|
1238
|
+
);
|
|
1239
|
+
},
|
|
1240
|
+
[
|
|
1241
|
+
t,
|
|
1242
|
+
r,
|
|
1243
|
+
i,
|
|
1244
|
+
o,
|
|
1245
|
+
e
|
|
1246
|
+
]
|
|
1247
|
+
);
|
|
1248
|
+
}
|
|
1249
|
+
var cn = s.createContext(null);
|
|
1250
|
+
function fn(e) {
|
|
1251
|
+
let t = s.useContext(V).outlet;
|
|
1252
|
+
return s.useMemo(
|
|
1253
|
+
() => t && /* @__PURE__ */ s.createElement(cn.Provider, { value: e }, t),
|
|
1254
|
+
[t, e]
|
|
1255
|
+
);
|
|
1256
|
+
}
|
|
1257
|
+
function ie(e, { relative: t } = {}) {
|
|
1258
|
+
let { matches: r } = s.useContext(V), { pathname: a } = q(), o = JSON.stringify($t(r));
|
|
1259
|
+
return s.useMemo(
|
|
1260
|
+
() => Ue(
|
|
1261
|
+
e,
|
|
1262
|
+
JSON.parse(o),
|
|
1263
|
+
a,
|
|
1264
|
+
t === "path"
|
|
1265
|
+
),
|
|
1266
|
+
[e, o, a, t]
|
|
1267
|
+
);
|
|
1268
|
+
}
|
|
1269
|
+
function dn(e, t, r) {
|
|
1270
|
+
$(
|
|
1271
|
+
ye(),
|
|
1272
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1273
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1274
|
+
"useRoutes() may be used only in the context of a <Router> component."
|
|
1275
|
+
);
|
|
1276
|
+
let { navigator: a } = s.useContext(U), { matches: o } = s.useContext(V), i = o[o.length - 1], l = i ? i.params : {}, f = i ? i.pathname : "/", u = i ? i.pathnameBase : "/", m = i && i.route;
|
|
1277
|
+
{
|
|
1278
|
+
let y = m && m.path || "";
|
|
1279
|
+
Mt(
|
|
1280
|
+
f,
|
|
1281
|
+
!m || y.endsWith("*") || y.endsWith("*?"),
|
|
1282
|
+
`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${y}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
1283
|
+
|
|
1284
|
+
Please change the parent <Route path="${y}"> to <Route path="${y === "/" ? "*" : `${y}/*`}">.`
|
|
1285
|
+
);
|
|
1286
|
+
}
|
|
1287
|
+
let h = q(), c;
|
|
1288
|
+
c = h;
|
|
1289
|
+
let v = c.pathname || "/", E = v;
|
|
1290
|
+
if (u !== "/") {
|
|
1291
|
+
let y = u.replace(/^\//, "").split("/");
|
|
1292
|
+
E = "/" + v.replace(/^\//, "").split("/").slice(y.length).join("/");
|
|
1293
|
+
}
|
|
1294
|
+
let w = Tt(e, { pathname: E });
|
|
1295
|
+
return Y(
|
|
1296
|
+
m || w != null,
|
|
1297
|
+
`No routes matched location "${c.pathname}${c.search}${c.hash}" `
|
|
1298
|
+
), Y(
|
|
1299
|
+
w == null || w[w.length - 1].route.element !== void 0 || w[w.length - 1].route.Component !== void 0 || w[w.length - 1].route.lazy !== void 0,
|
|
1300
|
+
`Matched leaf route at location "${c.pathname}${c.search}${c.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
|
|
1301
|
+
), gn(
|
|
1302
|
+
w && w.map(
|
|
1303
|
+
(y) => Object.assign({}, y, {
|
|
1304
|
+
params: Object.assign({}, l, y.params),
|
|
1305
|
+
pathname: H([
|
|
1306
|
+
u,
|
|
1307
|
+
// Re-encode pathnames that were decoded inside matchRoutes.
|
|
1308
|
+
// Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
|
|
1309
|
+
// `new URL()` internally and we need to prevent it from treating
|
|
1310
|
+
// them as separators
|
|
1311
|
+
a.encodeLocation ? a.encodeLocation(
|
|
1312
|
+
y.pathname.replace(/\?/g, "%3F").replace(/#/g, "%23")
|
|
1313
|
+
).pathname : y.pathname
|
|
1314
|
+
]),
|
|
1315
|
+
pathnameBase: y.pathnameBase === "/" ? u : H([
|
|
1316
|
+
u,
|
|
1317
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
1318
|
+
// Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
|
|
1319
|
+
// `new URL()` internally and we need to prevent it from treating
|
|
1320
|
+
// them as separators
|
|
1321
|
+
a.encodeLocation ? a.encodeLocation(
|
|
1322
|
+
y.pathnameBase.replace(/\?/g, "%3F").replace(/#/g, "%23")
|
|
1323
|
+
).pathname : y.pathnameBase
|
|
1324
|
+
])
|
|
1325
|
+
})
|
|
1326
|
+
),
|
|
1327
|
+
o,
|
|
1328
|
+
r
|
|
1329
|
+
);
|
|
1330
|
+
}
|
|
1331
|
+
function hn() {
|
|
1332
|
+
let e = bn(), t = Gr(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), r = e instanceof Error ? e.stack : null, a = "rgba(200,200,200, 0.5)", o = { padding: "0.5rem", backgroundColor: a }, i = { padding: "2px 4px", backgroundColor: a }, l = null;
|
|
1333
|
+
return console.error(
|
|
1334
|
+
"Error handled by React Router default ErrorBoundary:",
|
|
1335
|
+
e
|
|
1336
|
+
), l = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ s.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ s.createElement("code", { style: i }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ s.createElement("code", { style: i }, "errorElement"), " prop on your route.")), /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ s.createElement("h3", { style: { fontStyle: "italic" } }, t), r ? /* @__PURE__ */ s.createElement("pre", { style: o }, r) : null, l);
|
|
1337
|
+
}
|
|
1338
|
+
var mn = /* @__PURE__ */ s.createElement(hn, null), Ut = class extends s.Component {
|
|
1339
|
+
constructor(e) {
|
|
1340
|
+
super(e), this.state = {
|
|
1341
|
+
location: e.location,
|
|
1342
|
+
revalidation: e.revalidation,
|
|
1343
|
+
error: e.error
|
|
1344
|
+
};
|
|
1345
|
+
}
|
|
1346
|
+
static getDerivedStateFromError(e) {
|
|
1347
|
+
return { error: e };
|
|
1348
|
+
}
|
|
1349
|
+
static getDerivedStateFromProps(e, t) {
|
|
1350
|
+
return t.location !== e.location || t.revalidation !== "idle" && e.revalidation === "idle" ? {
|
|
1351
|
+
error: e.error,
|
|
1352
|
+
location: e.location,
|
|
1353
|
+
revalidation: e.revalidation
|
|
1354
|
+
} : {
|
|
1355
|
+
error: e.error !== void 0 ? e.error : t.error,
|
|
1356
|
+
location: t.location,
|
|
1357
|
+
revalidation: e.revalidation || t.revalidation
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
componentDidCatch(e, t) {
|
|
1361
|
+
this.props.onError ? this.props.onError(e, t) : console.error(
|
|
1362
|
+
"React Router caught the following error during render",
|
|
1363
|
+
e
|
|
1364
|
+
);
|
|
1365
|
+
}
|
|
1366
|
+
render() {
|
|
1367
|
+
let e = this.state.error;
|
|
1368
|
+
if (this.context && typeof e == "object" && e && "digest" in e && typeof e.digest == "string") {
|
|
1369
|
+
const r = on(e.digest);
|
|
1370
|
+
r && (e = r);
|
|
1371
|
+
}
|
|
1372
|
+
let t = e !== void 0 ? /* @__PURE__ */ s.createElement(V.Provider, { value: this.props.routeContext }, /* @__PURE__ */ s.createElement(
|
|
1373
|
+
We.Provider,
|
|
1374
|
+
{
|
|
1375
|
+
value: e,
|
|
1376
|
+
children: this.props.component
|
|
1377
|
+
}
|
|
1378
|
+
)) : this.props.children;
|
|
1379
|
+
return this.context ? /* @__PURE__ */ s.createElement(pn, { error: e }, t) : t;
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1382
|
+
Ut.contextType = Qr;
|
|
1383
|
+
var $e = /* @__PURE__ */ new WeakMap();
|
|
1384
|
+
function pn({
|
|
1385
|
+
children: e,
|
|
1386
|
+
error: t
|
|
1387
|
+
}) {
|
|
1388
|
+
let { basename: r } = s.useContext(U);
|
|
1389
|
+
if (typeof t == "object" && t && "digest" in t && typeof t.digest == "string") {
|
|
1390
|
+
let a = an(t.digest);
|
|
1391
|
+
if (a) {
|
|
1392
|
+
let o = $e.get(t);
|
|
1393
|
+
if (o) throw o;
|
|
1394
|
+
let i = It(a.location, r);
|
|
1395
|
+
if (Lt && !$e.get(t))
|
|
1396
|
+
if (i.isExternal || a.reloadDocument)
|
|
1397
|
+
window.location.href = i.absoluteURL || i.to;
|
|
1398
|
+
else {
|
|
1399
|
+
const l = Promise.resolve().then(
|
|
1400
|
+
() => window.__reactRouterDataRouter.navigate(i.to, {
|
|
1401
|
+
replace: a.replace
|
|
1402
|
+
})
|
|
1403
|
+
);
|
|
1404
|
+
throw $e.set(t, l), l;
|
|
1405
|
+
}
|
|
1406
|
+
return /* @__PURE__ */ s.createElement(
|
|
1407
|
+
"meta",
|
|
1408
|
+
{
|
|
1409
|
+
httpEquiv: "refresh",
|
|
1410
|
+
content: `0;url=${i.absoluteURL || i.to}`
|
|
1411
|
+
}
|
|
1412
|
+
);
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
return e;
|
|
1416
|
+
}
|
|
1417
|
+
function vn({ routeContext: e, match: t, children: r }) {
|
|
1418
|
+
let a = s.useContext(ee);
|
|
1419
|
+
return a && a.static && a.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (a.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ s.createElement(V.Provider, { value: e }, r);
|
|
1420
|
+
}
|
|
1421
|
+
function gn(e, t = [], r) {
|
|
1422
|
+
let a = r?.state;
|
|
1423
|
+
if (e == null) {
|
|
1424
|
+
if (!a)
|
|
1425
|
+
return null;
|
|
1426
|
+
if (a.errors)
|
|
1427
|
+
e = a.matches;
|
|
1428
|
+
else if (t.length === 0 && !a.initialized && a.matches.length > 0)
|
|
1429
|
+
e = a.matches;
|
|
1430
|
+
else
|
|
1431
|
+
return null;
|
|
1432
|
+
}
|
|
1433
|
+
let o = e, i = a?.errors;
|
|
1434
|
+
if (i != null) {
|
|
1435
|
+
let h = o.findIndex(
|
|
1436
|
+
(c) => c.route.id && i?.[c.route.id] !== void 0
|
|
1437
|
+
);
|
|
1438
|
+
$(
|
|
1439
|
+
h >= 0,
|
|
1440
|
+
`Could not find a matching route for errors on route IDs: ${Object.keys(
|
|
1441
|
+
i
|
|
1442
|
+
).join(",")}`
|
|
1443
|
+
), o = o.slice(
|
|
1444
|
+
0,
|
|
1445
|
+
Math.min(o.length, h + 1)
|
|
1446
|
+
);
|
|
1447
|
+
}
|
|
1448
|
+
let l = !1, f = -1;
|
|
1449
|
+
if (r && a) {
|
|
1450
|
+
l = a.renderFallback;
|
|
1451
|
+
for (let h = 0; h < o.length; h++) {
|
|
1452
|
+
let c = o[h];
|
|
1453
|
+
if ((c.route.HydrateFallback || c.route.hydrateFallbackElement) && (f = h), c.route.id) {
|
|
1454
|
+
let { loaderData: v, errors: E } = a, w = c.route.loader && !v.hasOwnProperty(c.route.id) && (!E || E[c.route.id] === void 0);
|
|
1455
|
+
if (c.route.lazy || w) {
|
|
1456
|
+
r.isStatic && (l = !0), f >= 0 ? o = o.slice(0, f + 1) : o = [o[0]];
|
|
1457
|
+
break;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
let u = r?.onError, m = a && u ? (h, c) => {
|
|
1463
|
+
u(h, {
|
|
1464
|
+
location: a.location,
|
|
1465
|
+
params: a.matches?.[0]?.params ?? {},
|
|
1466
|
+
unstable_pattern: Xr(a.matches),
|
|
1467
|
+
errorInfo: c
|
|
1468
|
+
});
|
|
1469
|
+
} : void 0;
|
|
1470
|
+
return o.reduceRight(
|
|
1471
|
+
(h, c, v) => {
|
|
1472
|
+
let E, w = !1, x = null, y = null;
|
|
1473
|
+
a && (E = i && c.route.id ? i[c.route.id] : void 0, x = c.route.errorElement || mn, l && (f < 0 && v === 0 ? (Mt(
|
|
1474
|
+
"route-fallback",
|
|
1475
|
+
!1,
|
|
1476
|
+
"No `HydrateFallback` element provided to render during initial hydration"
|
|
1477
|
+
), w = !0, y = null) : f === v && (w = !0, y = c.route.hydrateFallbackElement || null)));
|
|
1478
|
+
let C = t.concat(o.slice(0, v + 1)), R = () => {
|
|
1479
|
+
let P;
|
|
1480
|
+
return E ? P = x : w ? P = y : c.route.Component ? P = /* @__PURE__ */ s.createElement(c.route.Component, null) : c.route.element ? P = c.route.element : P = h, /* @__PURE__ */ s.createElement(
|
|
1481
|
+
vn,
|
|
1482
|
+
{
|
|
1483
|
+
match: c,
|
|
1484
|
+
routeContext: {
|
|
1485
|
+
outlet: h,
|
|
1486
|
+
matches: C,
|
|
1487
|
+
isDataRoute: a != null
|
|
1488
|
+
},
|
|
1489
|
+
children: P
|
|
1490
|
+
}
|
|
1491
|
+
);
|
|
1492
|
+
};
|
|
1493
|
+
return a && (c.route.ErrorBoundary || c.route.errorElement || v === 0) ? /* @__PURE__ */ s.createElement(
|
|
1494
|
+
Ut,
|
|
1495
|
+
{
|
|
1496
|
+
location: a.location,
|
|
1497
|
+
revalidation: a.revalidation,
|
|
1498
|
+
component: x,
|
|
1499
|
+
error: E,
|
|
1500
|
+
children: R(),
|
|
1501
|
+
routeContext: { outlet: null, matches: C, isDataRoute: !0 },
|
|
1502
|
+
onError: m
|
|
1503
|
+
}
|
|
1504
|
+
) : R();
|
|
1505
|
+
},
|
|
1506
|
+
null
|
|
1507
|
+
);
|
|
1508
|
+
}
|
|
1509
|
+
function Be(e) {
|
|
1510
|
+
return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
1511
|
+
}
|
|
1512
|
+
function yn(e) {
|
|
1513
|
+
let t = s.useContext(ee);
|
|
1514
|
+
return $(t, Be(e)), t;
|
|
1515
|
+
}
|
|
1516
|
+
function Rn(e) {
|
|
1517
|
+
let t = s.useContext(ge);
|
|
1518
|
+
return $(t, Be(e)), t;
|
|
1519
|
+
}
|
|
1520
|
+
function En(e) {
|
|
1521
|
+
let t = s.useContext(V);
|
|
1522
|
+
return $(t, Be(e)), t;
|
|
1523
|
+
}
|
|
1524
|
+
function He(e) {
|
|
1525
|
+
let t = En(e), r = t.matches[t.matches.length - 1];
|
|
1526
|
+
return $(
|
|
1527
|
+
r.route.id,
|
|
1528
|
+
`${e} can only be used on routes that contain a unique "id"`
|
|
1529
|
+
), r.route.id;
|
|
1530
|
+
}
|
|
1531
|
+
function wn() {
|
|
1532
|
+
return He(
|
|
1533
|
+
"useRouteId"
|
|
1534
|
+
/* UseRouteId */
|
|
1535
|
+
);
|
|
1536
|
+
}
|
|
1537
|
+
function bn() {
|
|
1538
|
+
let e = s.useContext(We), t = Rn(
|
|
1539
|
+
"useRouteError"
|
|
1540
|
+
/* UseRouteError */
|
|
1541
|
+
), r = He(
|
|
1542
|
+
"useRouteError"
|
|
1543
|
+
/* UseRouteError */
|
|
1544
|
+
);
|
|
1545
|
+
return e !== void 0 ? e : t.errors?.[r];
|
|
1546
|
+
}
|
|
1547
|
+
function Sn() {
|
|
1548
|
+
let { router: e } = yn(
|
|
1549
|
+
"useNavigate"
|
|
1550
|
+
/* UseNavigateStable */
|
|
1551
|
+
), t = He(
|
|
1552
|
+
"useNavigate"
|
|
1553
|
+
/* UseNavigateStable */
|
|
1554
|
+
), r = s.useRef(!1);
|
|
1555
|
+
return Nt(() => {
|
|
1556
|
+
r.current = !0;
|
|
1557
|
+
}), s.useCallback(
|
|
1558
|
+
async (o, i = {}) => {
|
|
1559
|
+
Y(r.current, jt), r.current && (typeof o == "number" ? await e.navigate(o) : await e.navigate(o, { fromRouteId: t, ...i }));
|
|
1560
|
+
},
|
|
1561
|
+
[e, t]
|
|
1562
|
+
);
|
|
1563
|
+
}
|
|
1564
|
+
var St = {};
|
|
1565
|
+
function Mt(e, t, r) {
|
|
1566
|
+
!t && !St[e] && (St[e] = !0, Y(!1, r));
|
|
1567
|
+
}
|
|
1568
|
+
s.memo(xn);
|
|
1569
|
+
function xn({
|
|
1570
|
+
routes: e,
|
|
1571
|
+
future: t,
|
|
1572
|
+
state: r,
|
|
1573
|
+
isStatic: a,
|
|
1574
|
+
onError: o
|
|
1575
|
+
}) {
|
|
1576
|
+
return dn(e, void 0, { state: r, isStatic: a, onError: o });
|
|
1577
|
+
}
|
|
1578
|
+
function Wt(e) {
|
|
1579
|
+
return fn(e.context);
|
|
1580
|
+
}
|
|
1581
|
+
var me = "get", pe = "application/x-www-form-urlencoded";
|
|
1582
|
+
function Re(e) {
|
|
1583
|
+
return typeof HTMLElement < "u" && e instanceof HTMLElement;
|
|
1584
|
+
}
|
|
1585
|
+
function Cn(e) {
|
|
1586
|
+
return Re(e) && e.tagName.toLowerCase() === "button";
|
|
1587
|
+
}
|
|
1588
|
+
function _n(e) {
|
|
1589
|
+
return Re(e) && e.tagName.toLowerCase() === "form";
|
|
1590
|
+
}
|
|
1591
|
+
function Pn(e) {
|
|
1592
|
+
return Re(e) && e.tagName.toLowerCase() === "input";
|
|
1593
|
+
}
|
|
1594
|
+
function Tn(e) {
|
|
1595
|
+
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
1596
|
+
}
|
|
1597
|
+
function kn(e, t) {
|
|
1598
|
+
return e.button === 0 && // Ignore everything but left clicks
|
|
1599
|
+
(!t || t === "_self") && // Let browser handle "target=_blank" etc.
|
|
1600
|
+
!Tn(e);
|
|
1601
|
+
}
|
|
1602
|
+
var he = null;
|
|
1603
|
+
function On() {
|
|
1604
|
+
if (he === null)
|
|
1605
|
+
try {
|
|
1606
|
+
new FormData(
|
|
1607
|
+
document.createElement("form"),
|
|
1608
|
+
// @ts-expect-error if FormData supports the submitter parameter, this will throw
|
|
1609
|
+
0
|
|
1610
|
+
), he = !1;
|
|
1611
|
+
} catch {
|
|
1612
|
+
he = !0;
|
|
1613
|
+
}
|
|
1614
|
+
return he;
|
|
1615
|
+
}
|
|
1616
|
+
var $n = /* @__PURE__ */ new Set([
|
|
1617
|
+
"application/x-www-form-urlencoded",
|
|
1618
|
+
"multipart/form-data",
|
|
1619
|
+
"text/plain"
|
|
1620
|
+
]);
|
|
1621
|
+
function Le(e) {
|
|
1622
|
+
return e != null && !$n.has(e) ? (Y(
|
|
1623
|
+
!1,
|
|
1624
|
+
`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${pe}"`
|
|
1625
|
+
), null) : e;
|
|
1626
|
+
}
|
|
1627
|
+
function Ln(e, t) {
|
|
1628
|
+
let r, a, o, i, l;
|
|
1629
|
+
if (_n(e)) {
|
|
1630
|
+
let f = e.getAttribute("action");
|
|
1631
|
+
a = f ? z(f, t) : null, r = e.getAttribute("method") || me, o = Le(e.getAttribute("enctype")) || pe, i = new FormData(e);
|
|
1632
|
+
} else if (Cn(e) || Pn(e) && (e.type === "submit" || e.type === "image")) {
|
|
1633
|
+
let f = e.form;
|
|
1634
|
+
if (f == null)
|
|
1635
|
+
throw new Error(
|
|
1636
|
+
'Cannot submit a <button> or <input type="submit"> without a <form>'
|
|
1637
|
+
);
|
|
1638
|
+
let u = e.getAttribute("formaction") || f.getAttribute("action");
|
|
1639
|
+
if (a = u ? z(u, t) : null, r = e.getAttribute("formmethod") || f.getAttribute("method") || me, o = Le(e.getAttribute("formenctype")) || Le(f.getAttribute("enctype")) || pe, i = new FormData(f, e), !On()) {
|
|
1640
|
+
let { name: m, type: h, value: c } = e;
|
|
1641
|
+
if (h === "image") {
|
|
1642
|
+
let v = m ? `${m}.` : "";
|
|
1643
|
+
i.append(`${v}x`, "0"), i.append(`${v}y`, "0");
|
|
1644
|
+
} else m && i.append(m, c);
|
|
1645
|
+
}
|
|
1646
|
+
} else {
|
|
1647
|
+
if (Re(e))
|
|
1648
|
+
throw new Error(
|
|
1649
|
+
'Cannot submit element that is not <form>, <button>, or <input type="submit|image">'
|
|
1650
|
+
);
|
|
1651
|
+
r = me, a = null, o = pe, l = e;
|
|
1652
|
+
}
|
|
1653
|
+
return i && o === "text/plain" && (l = i, i = void 0), { action: a, method: r.toLowerCase(), encType: o, formData: i, body: l };
|
|
1654
|
+
}
|
|
1655
|
+
Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
1656
|
+
function Ve(e, t) {
|
|
1657
|
+
if (e === !1 || e === null || typeof e > "u")
|
|
1658
|
+
throw new Error(t);
|
|
1659
|
+
}
|
|
1660
|
+
function In(e, t, r, a) {
|
|
1661
|
+
let o = typeof e == "string" ? new URL(
|
|
1662
|
+
e,
|
|
1663
|
+
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
1664
|
+
// don't assume window is available
|
|
1665
|
+
typeof window > "u" ? "server://singlefetch/" : window.location.origin
|
|
1666
|
+
) : e;
|
|
1667
|
+
return r ? o.pathname.endsWith("/") ? o.pathname = `${o.pathname}_.${a}` : o.pathname = `${o.pathname}.${a}` : o.pathname === "/" ? o.pathname = `_root.${a}` : t && z(o.pathname, t) === "/" ? o.pathname = `${t.replace(/\/$/, "")}/_root.${a}` : o.pathname = `${o.pathname.replace(/\/$/, "")}.${a}`, o;
|
|
1668
|
+
}
|
|
1669
|
+
async function Dn(e, t) {
|
|
1670
|
+
if (e.id in t)
|
|
1671
|
+
return t[e.id];
|
|
1672
|
+
try {
|
|
1673
|
+
let r = await import(
|
|
1674
|
+
/* @vite-ignore */
|
|
1675
|
+
/* webpackIgnore: true */
|
|
1676
|
+
e.module
|
|
1677
|
+
);
|
|
1678
|
+
return t[e.id] = r, r;
|
|
1679
|
+
} catch (r) {
|
|
1680
|
+
return console.error(
|
|
1681
|
+
`Error loading route module \`${e.module}\`, reloading page...`
|
|
1682
|
+
), console.error(r), window.__reactRouterContext && window.__reactRouterContext.isSpaMode, window.location.reload(), new Promise(() => {
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
function Fn(e) {
|
|
1687
|
+
return e == null ? !1 : e.href == null ? e.rel === "preload" && typeof e.imageSrcSet == "string" && typeof e.imageSizes == "string" : typeof e.rel == "string" && typeof e.href == "string";
|
|
1688
|
+
}
|
|
1689
|
+
async function An(e, t, r) {
|
|
1690
|
+
let a = await Promise.all(
|
|
1691
|
+
e.map(async (o) => {
|
|
1692
|
+
let i = t.routes[o.route.id];
|
|
1693
|
+
if (i) {
|
|
1694
|
+
let l = await Dn(i, r);
|
|
1695
|
+
return l.links ? l.links() : [];
|
|
1696
|
+
}
|
|
1697
|
+
return [];
|
|
1698
|
+
})
|
|
1699
|
+
);
|
|
1700
|
+
return Mn(
|
|
1701
|
+
a.flat(1).filter(Fn).filter((o) => o.rel === "stylesheet" || o.rel === "preload").map(
|
|
1702
|
+
(o) => o.rel === "stylesheet" ? { ...o, rel: "prefetch", as: "style" } : { ...o, rel: "prefetch" }
|
|
1703
|
+
)
|
|
1704
|
+
);
|
|
1705
|
+
}
|
|
1706
|
+
function xt(e, t, r, a, o, i) {
|
|
1707
|
+
let l = (u, m) => r[m] ? u.route.id !== r[m].route.id : !0, f = (u, m) => (
|
|
1708
|
+
// param change, /users/123 -> /users/456
|
|
1709
|
+
r[m].pathname !== u.pathname || // splat param changed, which is not present in match.path
|
|
1710
|
+
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
1711
|
+
r[m].route.path?.endsWith("*") && r[m].params["*"] !== u.params["*"]
|
|
1712
|
+
);
|
|
1713
|
+
return i === "assets" ? t.filter(
|
|
1714
|
+
(u, m) => l(u, m) || f(u, m)
|
|
1715
|
+
) : i === "data" ? t.filter((u, m) => {
|
|
1716
|
+
let h = a.routes[u.route.id];
|
|
1717
|
+
if (!h || !h.hasLoader)
|
|
1718
|
+
return !1;
|
|
1719
|
+
if (l(u, m) || f(u, m))
|
|
1720
|
+
return !0;
|
|
1721
|
+
if (u.route.shouldRevalidate) {
|
|
1722
|
+
let c = u.route.shouldRevalidate({
|
|
1723
|
+
currentUrl: new URL(
|
|
1724
|
+
o.pathname + o.search + o.hash,
|
|
1725
|
+
window.origin
|
|
1726
|
+
),
|
|
1727
|
+
currentParams: r[0]?.params || {},
|
|
1728
|
+
nextUrl: new URL(e, window.origin),
|
|
1729
|
+
nextParams: u.params,
|
|
1730
|
+
defaultShouldRevalidate: !0
|
|
1731
|
+
});
|
|
1732
|
+
if (typeof c == "boolean")
|
|
1733
|
+
return c;
|
|
1734
|
+
}
|
|
1735
|
+
return !0;
|
|
1736
|
+
}) : [];
|
|
1737
|
+
}
|
|
1738
|
+
function jn(e, t, { includeHydrateFallback: r } = {}) {
|
|
1739
|
+
return Nn(
|
|
1740
|
+
e.map((a) => {
|
|
1741
|
+
let o = t.routes[a.route.id];
|
|
1742
|
+
if (!o) return [];
|
|
1743
|
+
let i = [o.module];
|
|
1744
|
+
return o.clientActionModule && (i = i.concat(o.clientActionModule)), o.clientLoaderModule && (i = i.concat(o.clientLoaderModule)), r && o.hydrateFallbackModule && (i = i.concat(o.hydrateFallbackModule)), o.imports && (i = i.concat(o.imports)), i;
|
|
1745
|
+
}).flat(1)
|
|
1746
|
+
);
|
|
1747
|
+
}
|
|
1748
|
+
function Nn(e) {
|
|
1749
|
+
return [...new Set(e)];
|
|
1750
|
+
}
|
|
1751
|
+
function Un(e) {
|
|
1752
|
+
let t = {}, r = Object.keys(e).sort();
|
|
1753
|
+
for (let a of r)
|
|
1754
|
+
t[a] = e[a];
|
|
1755
|
+
return t;
|
|
1756
|
+
}
|
|
1757
|
+
function Mn(e, t) {
|
|
1758
|
+
let r = /* @__PURE__ */ new Set();
|
|
1759
|
+
return new Set(t), e.reduce((a, o) => {
|
|
1760
|
+
let i = JSON.stringify(Un(o));
|
|
1761
|
+
return r.has(i) || (r.add(i), a.push({ key: i, link: o })), a;
|
|
1762
|
+
}, []);
|
|
1763
|
+
}
|
|
1764
|
+
function Bt() {
|
|
1765
|
+
let e = s.useContext(ee);
|
|
1766
|
+
return Ve(
|
|
1767
|
+
e,
|
|
1768
|
+
"You must render this element inside a <DataRouterContext.Provider> element"
|
|
1769
|
+
), e;
|
|
1770
|
+
}
|
|
1771
|
+
function Wn() {
|
|
1772
|
+
let e = s.useContext(ge);
|
|
1773
|
+
return Ve(
|
|
1774
|
+
e,
|
|
1775
|
+
"You must render this element inside a <DataRouterStateContext.Provider> element"
|
|
1776
|
+
), e;
|
|
1777
|
+
}
|
|
1778
|
+
var Ye = s.createContext(void 0);
|
|
1779
|
+
Ye.displayName = "FrameworkContext";
|
|
1780
|
+
function Ht() {
|
|
1781
|
+
let e = s.useContext(Ye);
|
|
1782
|
+
return Ve(
|
|
1783
|
+
e,
|
|
1784
|
+
"You must render this element inside a <HydratedRouter> element"
|
|
1785
|
+
), e;
|
|
1786
|
+
}
|
|
1787
|
+
function Bn(e, t) {
|
|
1788
|
+
let r = s.useContext(Ye), [a, o] = s.useState(!1), [i, l] = s.useState(!1), { onFocus: f, onBlur: u, onMouseEnter: m, onMouseLeave: h, onTouchStart: c } = t, v = s.useRef(null);
|
|
1789
|
+
s.useEffect(() => {
|
|
1790
|
+
if (e === "render" && l(!0), e === "viewport") {
|
|
1791
|
+
let x = (C) => {
|
|
1792
|
+
C.forEach((R) => {
|
|
1793
|
+
l(R.isIntersecting);
|
|
1794
|
+
});
|
|
1795
|
+
}, y = new IntersectionObserver(x, { threshold: 0.5 });
|
|
1796
|
+
return v.current && y.observe(v.current), () => {
|
|
1797
|
+
y.disconnect();
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
}, [e]), s.useEffect(() => {
|
|
1801
|
+
if (a) {
|
|
1802
|
+
let x = setTimeout(() => {
|
|
1803
|
+
l(!0);
|
|
1804
|
+
}, 100);
|
|
1805
|
+
return () => {
|
|
1806
|
+
clearTimeout(x);
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
}, [a]);
|
|
1810
|
+
let E = () => {
|
|
1811
|
+
o(!0);
|
|
1812
|
+
}, w = () => {
|
|
1813
|
+
o(!1), l(!1);
|
|
660
1814
|
};
|
|
661
|
-
return
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
Pe.Provider,
|
|
1815
|
+
return r ? e !== "intent" ? [i, v, {}] : [
|
|
1816
|
+
i,
|
|
1817
|
+
v,
|
|
665
1818
|
{
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
1819
|
+
onFocus: oe(f, E),
|
|
1820
|
+
onBlur: oe(u, w),
|
|
1821
|
+
onMouseEnter: oe(m, E),
|
|
1822
|
+
onMouseLeave: oe(h, w),
|
|
1823
|
+
onTouchStart: oe(c, E)
|
|
1824
|
+
}
|
|
1825
|
+
] : [!1, v, {}];
|
|
1826
|
+
}
|
|
1827
|
+
function oe(e, t) {
|
|
1828
|
+
return (r) => {
|
|
1829
|
+
e && e(r), r.defaultPrevented || t(r);
|
|
1830
|
+
};
|
|
1831
|
+
}
|
|
1832
|
+
function Hn({ page: e, ...t }) {
|
|
1833
|
+
let { router: r } = Bt(), a = s.useMemo(
|
|
1834
|
+
() => Tt(r.routes, e, r.basename),
|
|
1835
|
+
[r.routes, e, r.basename]
|
|
1836
|
+
);
|
|
1837
|
+
return a ? /* @__PURE__ */ s.createElement(Yn, { page: e, matches: a, ...t }) : null;
|
|
1838
|
+
}
|
|
1839
|
+
function Vn(e) {
|
|
1840
|
+
let { manifest: t, routeModules: r } = Ht(), [a, o] = s.useState([]);
|
|
1841
|
+
return s.useEffect(() => {
|
|
1842
|
+
let i = !1;
|
|
1843
|
+
return An(e, t, r).then(
|
|
1844
|
+
(l) => {
|
|
1845
|
+
i || o(l);
|
|
1846
|
+
}
|
|
1847
|
+
), () => {
|
|
1848
|
+
i = !0;
|
|
1849
|
+
};
|
|
1850
|
+
}, [e, t, r]), a;
|
|
1851
|
+
}
|
|
1852
|
+
function Yn({
|
|
1853
|
+
page: e,
|
|
1854
|
+
matches: t,
|
|
1855
|
+
...r
|
|
1856
|
+
}) {
|
|
1857
|
+
let a = q(), { future: o, manifest: i, routeModules: l } = Ht(), { basename: f } = Bt(), { loaderData: u, matches: m } = Wn(), h = s.useMemo(
|
|
1858
|
+
() => xt(
|
|
1859
|
+
e,
|
|
1860
|
+
t,
|
|
1861
|
+
m,
|
|
1862
|
+
i,
|
|
1863
|
+
a,
|
|
1864
|
+
"data"
|
|
1865
|
+
),
|
|
1866
|
+
[e, t, m, i, a]
|
|
1867
|
+
), c = s.useMemo(
|
|
1868
|
+
() => xt(
|
|
1869
|
+
e,
|
|
1870
|
+
t,
|
|
1871
|
+
m,
|
|
1872
|
+
i,
|
|
1873
|
+
a,
|
|
1874
|
+
"assets"
|
|
1875
|
+
),
|
|
1876
|
+
[e, t, m, i, a]
|
|
1877
|
+
), v = s.useMemo(() => {
|
|
1878
|
+
if (e === a.pathname + a.search + a.hash)
|
|
1879
|
+
return [];
|
|
1880
|
+
let x = /* @__PURE__ */ new Set(), y = !1;
|
|
1881
|
+
if (t.forEach((R) => {
|
|
1882
|
+
let P = i.routes[R.route.id];
|
|
1883
|
+
!P || !P.hasLoader || (!h.some((j) => j.route.id === R.route.id) && R.route.id in u && l[R.route.id]?.shouldRevalidate || P.hasClientLoader ? y = !0 : x.add(R.route.id));
|
|
1884
|
+
}), x.size === 0)
|
|
1885
|
+
return [];
|
|
1886
|
+
let C = In(
|
|
1887
|
+
e,
|
|
1888
|
+
f,
|
|
1889
|
+
o.unstable_trailingSlashAwareDataRequests,
|
|
1890
|
+
"data"
|
|
1891
|
+
);
|
|
1892
|
+
return y && x.size > 0 && C.searchParams.set(
|
|
1893
|
+
"_routes",
|
|
1894
|
+
t.filter((R) => x.has(R.route.id)).map((R) => R.route.id).join(",")
|
|
1895
|
+
), [C.pathname + C.search];
|
|
1896
|
+
}, [
|
|
1897
|
+
f,
|
|
1898
|
+
o.unstable_trailingSlashAwareDataRequests,
|
|
1899
|
+
u,
|
|
1900
|
+
a,
|
|
1901
|
+
i,
|
|
1902
|
+
h,
|
|
1903
|
+
t,
|
|
1904
|
+
e,
|
|
1905
|
+
l
|
|
1906
|
+
]), E = s.useMemo(
|
|
1907
|
+
() => jn(c, i),
|
|
1908
|
+
[c, i]
|
|
1909
|
+
), w = Vn(c);
|
|
1910
|
+
return /* @__PURE__ */ s.createElement(s.Fragment, null, v.map((x) => /* @__PURE__ */ s.createElement("link", { key: x, rel: "prefetch", as: "fetch", href: x, ...r })), E.map((x) => /* @__PURE__ */ s.createElement("link", { key: x, rel: "modulepreload", href: x, ...r })), w.map(({ key: x, link: y }) => (
|
|
1911
|
+
// these don't spread `linkProps` because they are full link descriptors
|
|
1912
|
+
// already with their own props
|
|
1913
|
+
/* @__PURE__ */ s.createElement(
|
|
1914
|
+
"link",
|
|
1915
|
+
{
|
|
1916
|
+
key: x,
|
|
1917
|
+
nonce: r.nonce,
|
|
1918
|
+
...y,
|
|
1919
|
+
crossOrigin: y.crossOrigin ?? r.crossOrigin
|
|
1920
|
+
}
|
|
1921
|
+
)
|
|
1922
|
+
)));
|
|
1923
|
+
}
|
|
1924
|
+
function Kn(...e) {
|
|
1925
|
+
return (t) => {
|
|
1926
|
+
e.forEach((r) => {
|
|
1927
|
+
typeof r == "function" ? r(t) : r != null && (r.current = t);
|
|
1928
|
+
});
|
|
1929
|
+
};
|
|
1930
|
+
}
|
|
1931
|
+
var Jn = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
|
|
1932
|
+
try {
|
|
1933
|
+
Jn && (window.__reactRouterVersion = // @ts-expect-error
|
|
1934
|
+
"7.13.1");
|
|
1935
|
+
} catch {
|
|
1936
|
+
}
|
|
1937
|
+
var Vt = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, Yt = s.forwardRef(
|
|
1938
|
+
function({
|
|
1939
|
+
onClick: t,
|
|
1940
|
+
discover: r = "render",
|
|
1941
|
+
prefetch: a = "none",
|
|
1942
|
+
relative: o,
|
|
1943
|
+
reloadDocument: i,
|
|
1944
|
+
replace: l,
|
|
1945
|
+
unstable_mask: f,
|
|
1946
|
+
state: u,
|
|
1947
|
+
target: m,
|
|
1948
|
+
to: h,
|
|
1949
|
+
preventScrollReset: c,
|
|
1950
|
+
viewTransition: v,
|
|
1951
|
+
unstable_defaultShouldRevalidate: E,
|
|
1952
|
+
...w
|
|
1953
|
+
}, x) {
|
|
1954
|
+
let { basename: y, navigator: C, unstable_useTransitions: R } = s.useContext(U), P = typeof h == "string" && Vt.test(h), j = It(h, y);
|
|
1955
|
+
h = j.to;
|
|
1956
|
+
let I = ln(h, { relative: o }), M = q(), W = null;
|
|
1957
|
+
if (f) {
|
|
1958
|
+
let D = Ue(
|
|
1959
|
+
f,
|
|
1960
|
+
[],
|
|
1961
|
+
M.unstable_mask ? M.unstable_mask.pathname : "/",
|
|
1962
|
+
!0
|
|
1963
|
+
);
|
|
1964
|
+
y !== "/" && (D.pathname = D.pathname === "/" ? y : H([y, D.pathname])), W = C.createHref(D);
|
|
1965
|
+
}
|
|
1966
|
+
let [K, J, te] = Bn(
|
|
1967
|
+
a,
|
|
1968
|
+
w
|
|
1969
|
+
), Ee = Xn(h, {
|
|
1970
|
+
replace: l,
|
|
1971
|
+
unstable_mask: f,
|
|
1972
|
+
state: u,
|
|
1973
|
+
target: m,
|
|
1974
|
+
preventScrollReset: c,
|
|
1975
|
+
relative: o,
|
|
1976
|
+
viewTransition: v,
|
|
1977
|
+
unstable_defaultShouldRevalidate: E,
|
|
1978
|
+
unstable_useTransitions: R
|
|
1979
|
+
});
|
|
1980
|
+
function le(D) {
|
|
1981
|
+
t && t(D), D.defaultPrevented || Ee(D);
|
|
1982
|
+
}
|
|
1983
|
+
let N = !(j.isExternal || i), B = (
|
|
1984
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
1985
|
+
/* @__PURE__ */ s.createElement(
|
|
1986
|
+
"a",
|
|
1987
|
+
{
|
|
1988
|
+
...w,
|
|
1989
|
+
...te,
|
|
1990
|
+
href: (N ? W : void 0) || j.absoluteURL || I,
|
|
1991
|
+
onClick: N ? le : t,
|
|
1992
|
+
ref: Kn(x, J),
|
|
1993
|
+
target: m,
|
|
1994
|
+
"data-discover": !P && r === "render" ? "true" : void 0
|
|
1995
|
+
}
|
|
1996
|
+
)
|
|
1997
|
+
);
|
|
1998
|
+
return K && !P ? /* @__PURE__ */ s.createElement(s.Fragment, null, B, /* @__PURE__ */ s.createElement(Hn, { page: I })) : B;
|
|
1999
|
+
}
|
|
2000
|
+
);
|
|
2001
|
+
Yt.displayName = "Link";
|
|
2002
|
+
var zn = s.forwardRef(
|
|
2003
|
+
function({
|
|
2004
|
+
"aria-current": t = "page",
|
|
2005
|
+
caseSensitive: r = !1,
|
|
2006
|
+
className: a = "",
|
|
2007
|
+
end: o = !1,
|
|
2008
|
+
style: i,
|
|
2009
|
+
to: l,
|
|
2010
|
+
viewTransition: f,
|
|
2011
|
+
children: u,
|
|
2012
|
+
...m
|
|
2013
|
+
}, h) {
|
|
2014
|
+
let c = ie(l, { relative: m.relative }), v = q(), E = s.useContext(ge), { navigator: w, basename: x } = s.useContext(U), y = E != null && // Conditional usage is OK here because the usage of a data router is static
|
|
2015
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
2016
|
+
ra(c) && f === !0, C = w.encodeLocation ? w.encodeLocation(c).pathname : c.pathname, R = v.pathname, P = E && E.navigation && E.navigation.location ? E.navigation.location.pathname : null;
|
|
2017
|
+
r || (R = R.toLowerCase(), P = P ? P.toLowerCase() : null, C = C.toLowerCase()), P && x && (P = z(P, x) || P);
|
|
2018
|
+
const j = C !== "/" && C.endsWith("/") ? C.length - 1 : C.length;
|
|
2019
|
+
let I = R === C || !o && R.startsWith(C) && R.charAt(j) === "/", M = P != null && (P === C || !o && P.startsWith(C) && P.charAt(C.length) === "/"), W = {
|
|
2020
|
+
isActive: I,
|
|
2021
|
+
isPending: M,
|
|
2022
|
+
isTransitioning: y
|
|
2023
|
+
}, K = I ? t : void 0, J;
|
|
2024
|
+
typeof a == "function" ? J = a(W) : J = [
|
|
2025
|
+
a,
|
|
2026
|
+
I ? "active" : null,
|
|
2027
|
+
M ? "pending" : null,
|
|
2028
|
+
y ? "transitioning" : null
|
|
2029
|
+
].filter(Boolean).join(" ");
|
|
2030
|
+
let te = typeof i == "function" ? i(W) : i;
|
|
2031
|
+
return /* @__PURE__ */ s.createElement(
|
|
2032
|
+
Yt,
|
|
2033
|
+
{
|
|
2034
|
+
...m,
|
|
2035
|
+
"aria-current": K,
|
|
2036
|
+
className: J,
|
|
2037
|
+
ref: h,
|
|
2038
|
+
style: te,
|
|
2039
|
+
to: l,
|
|
2040
|
+
viewTransition: f
|
|
671
2041
|
},
|
|
672
|
-
|
|
2042
|
+
typeof u == "function" ? u(W) : u
|
|
2043
|
+
);
|
|
2044
|
+
}
|
|
2045
|
+
);
|
|
2046
|
+
zn.displayName = "NavLink";
|
|
2047
|
+
var qn = s.forwardRef(
|
|
2048
|
+
({
|
|
2049
|
+
discover: e = "render",
|
|
2050
|
+
fetcherKey: t,
|
|
2051
|
+
navigate: r,
|
|
2052
|
+
reloadDocument: a,
|
|
2053
|
+
replace: o,
|
|
2054
|
+
state: i,
|
|
2055
|
+
method: l = me,
|
|
2056
|
+
action: f,
|
|
2057
|
+
onSubmit: u,
|
|
2058
|
+
relative: m,
|
|
2059
|
+
preventScrollReset: h,
|
|
2060
|
+
viewTransition: c,
|
|
2061
|
+
unstable_defaultShouldRevalidate: v,
|
|
2062
|
+
...E
|
|
2063
|
+
}, w) => {
|
|
2064
|
+
let { unstable_useTransitions: x } = s.useContext(U), y = ea(), C = ta(f, { relative: m }), R = l.toLowerCase() === "get" ? "get" : "post", P = typeof f == "string" && Vt.test(f), j = (I) => {
|
|
2065
|
+
if (u && u(I), I.defaultPrevented) return;
|
|
2066
|
+
I.preventDefault();
|
|
2067
|
+
let M = I.nativeEvent.submitter, W = M?.getAttribute("formmethod") || l, K = () => y(M || I.currentTarget, {
|
|
2068
|
+
fetcherKey: t,
|
|
2069
|
+
method: W,
|
|
2070
|
+
navigate: r,
|
|
2071
|
+
replace: o,
|
|
2072
|
+
state: i,
|
|
2073
|
+
relative: m,
|
|
2074
|
+
preventScrollReset: h,
|
|
2075
|
+
viewTransition: c,
|
|
2076
|
+
unstable_defaultShouldRevalidate: v
|
|
2077
|
+
});
|
|
2078
|
+
x && r !== !1 ? s.startTransition(() => K()) : K();
|
|
2079
|
+
};
|
|
2080
|
+
return /* @__PURE__ */ s.createElement(
|
|
2081
|
+
"form",
|
|
2082
|
+
{
|
|
2083
|
+
ref: w,
|
|
2084
|
+
method: R,
|
|
2085
|
+
action: C,
|
|
2086
|
+
onSubmit: a ? u : j,
|
|
2087
|
+
...E,
|
|
2088
|
+
"data-discover": !P && e === "render" ? "true" : void 0
|
|
2089
|
+
}
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
);
|
|
2093
|
+
qn.displayName = "Form";
|
|
2094
|
+
function Gn(e) {
|
|
2095
|
+
return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
2096
|
+
}
|
|
2097
|
+
function Kt(e) {
|
|
2098
|
+
let t = s.useContext(ee);
|
|
2099
|
+
return $(t, Gn(e)), t;
|
|
2100
|
+
}
|
|
2101
|
+
function Xn(e, {
|
|
2102
|
+
target: t,
|
|
2103
|
+
replace: r,
|
|
2104
|
+
unstable_mask: a,
|
|
2105
|
+
state: o,
|
|
2106
|
+
preventScrollReset: i,
|
|
2107
|
+
relative: l,
|
|
2108
|
+
viewTransition: f,
|
|
2109
|
+
unstable_defaultShouldRevalidate: u,
|
|
2110
|
+
unstable_useTransitions: m
|
|
2111
|
+
} = {}) {
|
|
2112
|
+
let h = sn(), c = q(), v = ie(e, { relative: l });
|
|
2113
|
+
return s.useCallback(
|
|
2114
|
+
(E) => {
|
|
2115
|
+
if (kn(E, t)) {
|
|
2116
|
+
E.preventDefault();
|
|
2117
|
+
let w = r !== void 0 ? r : Fe(c) === Fe(v), x = () => h(e, {
|
|
2118
|
+
replace: w,
|
|
2119
|
+
unstable_mask: a,
|
|
2120
|
+
state: o,
|
|
2121
|
+
preventScrollReset: i,
|
|
2122
|
+
relative: l,
|
|
2123
|
+
viewTransition: f,
|
|
2124
|
+
unstable_defaultShouldRevalidate: u
|
|
2125
|
+
});
|
|
2126
|
+
m ? s.startTransition(() => x()) : x();
|
|
2127
|
+
}
|
|
2128
|
+
},
|
|
2129
|
+
[
|
|
2130
|
+
c,
|
|
2131
|
+
h,
|
|
2132
|
+
v,
|
|
2133
|
+
r,
|
|
2134
|
+
a,
|
|
2135
|
+
o,
|
|
2136
|
+
t,
|
|
2137
|
+
e,
|
|
2138
|
+
i,
|
|
2139
|
+
l,
|
|
2140
|
+
f,
|
|
2141
|
+
u,
|
|
2142
|
+
m
|
|
2143
|
+
]
|
|
2144
|
+
);
|
|
2145
|
+
}
|
|
2146
|
+
var Zn = 0, Qn = () => `__${String(++Zn)}__`;
|
|
2147
|
+
function ea() {
|
|
2148
|
+
let { router: e } = Kt(
|
|
2149
|
+
"useSubmit"
|
|
2150
|
+
/* UseSubmit */
|
|
2151
|
+
), { basename: t } = s.useContext(U), r = wn(), a = e.fetch, o = e.navigate;
|
|
2152
|
+
return s.useCallback(
|
|
2153
|
+
async (i, l = {}) => {
|
|
2154
|
+
let { action: f, method: u, encType: m, formData: h, body: c } = Ln(
|
|
2155
|
+
i,
|
|
2156
|
+
t
|
|
2157
|
+
);
|
|
2158
|
+
if (l.navigate === !1) {
|
|
2159
|
+
let v = l.fetcherKey || Qn();
|
|
2160
|
+
await a(v, r, l.action || f, {
|
|
2161
|
+
unstable_defaultShouldRevalidate: l.unstable_defaultShouldRevalidate,
|
|
2162
|
+
preventScrollReset: l.preventScrollReset,
|
|
2163
|
+
formData: h,
|
|
2164
|
+
body: c,
|
|
2165
|
+
formMethod: l.method || u,
|
|
2166
|
+
formEncType: l.encType || m,
|
|
2167
|
+
flushSync: l.flushSync
|
|
2168
|
+
});
|
|
2169
|
+
} else
|
|
2170
|
+
await o(l.action || f, {
|
|
2171
|
+
unstable_defaultShouldRevalidate: l.unstable_defaultShouldRevalidate,
|
|
2172
|
+
preventScrollReset: l.preventScrollReset,
|
|
2173
|
+
formData: h,
|
|
2174
|
+
body: c,
|
|
2175
|
+
formMethod: l.method || u,
|
|
2176
|
+
formEncType: l.encType || m,
|
|
2177
|
+
replace: l.replace,
|
|
2178
|
+
state: l.state,
|
|
2179
|
+
fromRouteId: r,
|
|
2180
|
+
flushSync: l.flushSync,
|
|
2181
|
+
viewTransition: l.viewTransition
|
|
2182
|
+
});
|
|
2183
|
+
},
|
|
2184
|
+
[a, o, t, r]
|
|
2185
|
+
);
|
|
2186
|
+
}
|
|
2187
|
+
function ta(e, { relative: t } = {}) {
|
|
2188
|
+
let { basename: r } = s.useContext(U), a = s.useContext(V);
|
|
2189
|
+
$(a, "useFormAction must be used inside a RouteContext");
|
|
2190
|
+
let [o] = a.matches.slice(-1), i = { ...ie(e || ".", { relative: t }) }, l = q();
|
|
2191
|
+
if (e == null) {
|
|
2192
|
+
i.search = l.search;
|
|
2193
|
+
let f = new URLSearchParams(i.search), u = f.getAll("index");
|
|
2194
|
+
if (u.some((h) => h === "")) {
|
|
2195
|
+
f.delete("index"), u.filter((c) => c).forEach((c) => f.append("index", c));
|
|
2196
|
+
let h = f.toString();
|
|
2197
|
+
i.search = h ? `?${h}` : "";
|
|
673
2198
|
}
|
|
2199
|
+
}
|
|
2200
|
+
return (!e || e === ".") && o.route.index && (i.search = i.search ? i.search.replace(/^\?/, "?index&") : "?index"), r !== "/" && (i.pathname = i.pathname === "/" ? r : H([r, i.pathname])), Fe(i);
|
|
2201
|
+
}
|
|
2202
|
+
function ra(e, { relative: t } = {}) {
|
|
2203
|
+
let r = s.useContext(Ft);
|
|
2204
|
+
$(
|
|
2205
|
+
r != null,
|
|
2206
|
+
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
674
2207
|
);
|
|
2208
|
+
let { basename: a } = Kt(
|
|
2209
|
+
"useViewTransitionState"
|
|
2210
|
+
/* useViewTransitionState */
|
|
2211
|
+
), o = ie(e, { relative: t });
|
|
2212
|
+
if (!r.isTransitioning)
|
|
2213
|
+
return !1;
|
|
2214
|
+
let i = z(r.currentLocation.pathname, a) || r.currentLocation.pathname, l = z(r.nextLocation.pathname, a) || r.nextLocation.pathname;
|
|
2215
|
+
return ve(o.pathname, l) != null || ve(o.pathname, i) != null;
|
|
675
2216
|
}
|
|
676
|
-
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
2217
|
+
const Ke = () => {
|
|
2218
|
+
const e = _t(je);
|
|
2219
|
+
if (!e || !e.authManager) throw new Error("AuthContext not found");
|
|
2220
|
+
return e;
|
|
2221
|
+
}, na = (e) => {
|
|
2222
|
+
const { user: t } = Ke();
|
|
2223
|
+
return !!t?.privileges?.includes(e);
|
|
2224
|
+
};
|
|
2225
|
+
function sa({ privilege: e, invalidPage: t, loadingPage: r }) {
|
|
2226
|
+
const { loading: a } = Ke(), o = na(e);
|
|
2227
|
+
return a ? r : o ? /* @__PURE__ */ Q.jsx(Wt, {}) : t;
|
|
682
2228
|
}
|
|
683
|
-
function
|
|
684
|
-
const { user:
|
|
685
|
-
return
|
|
686
|
-
(
|
|
687
|
-
|
|
2229
|
+
function ua({ loadingPage: e }) {
|
|
2230
|
+
const { authManager: t, login: r, user: a } = Ke(), [o, i] = Ie(!0);
|
|
2231
|
+
return Ae(() => {
|
|
2232
|
+
if (!t) return;
|
|
2233
|
+
t.getToken() ? i(!1) : r();
|
|
2234
|
+
}, [t, a]), t ? o ? e ?? /* @__PURE__ */ Q.jsx("div", { children: "Loading..." }) : /* @__PURE__ */ Q.jsx(Wt, {}) : /* @__PURE__ */ Q.jsx("p", { children: "invalud config" });
|
|
688
2235
|
}
|
|
689
2236
|
export {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
2237
|
+
je as AuthContext,
|
|
2238
|
+
Sr as AuthManager,
|
|
2239
|
+
ia as AuthProvider,
|
|
2240
|
+
la as CallbackPage,
|
|
2241
|
+
oa as Config,
|
|
2242
|
+
sa as PrivilegeGate,
|
|
2243
|
+
ua as ProtectGate,
|
|
2244
|
+
Pt as apiFetch,
|
|
2245
|
+
vt as handleCallback,
|
|
2246
|
+
De as login,
|
|
2247
|
+
gt as logout,
|
|
2248
|
+
br as refreshToken,
|
|
2249
|
+
Ke as useAuth,
|
|
2250
|
+
na as usePrivilege
|
|
696
2251
|
};
|