alex-evo-sh-auth 0.0.13 → 0.0.15
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 +341 -692
- package/dist/alex-evo-sh-auth.umd.js +2 -10
- package/package.json +9 -9
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Outlet as
|
|
3
|
-
async function
|
|
4
|
-
const
|
|
1
|
+
import fe, { createContext as de, useState as I, useMemo as me, useCallback as j, useEffect as C, useContext as B } from "react";
|
|
2
|
+
import { Outlet as H } from "react-router-dom";
|
|
3
|
+
async function he(r) {
|
|
4
|
+
const t = await fetch(`${r.authServer}/refresh`, {
|
|
5
5
|
method: "POST",
|
|
6
6
|
headers: {
|
|
7
7
|
"Content-Type": "application/json"
|
|
8
8
|
},
|
|
9
9
|
body: JSON.stringify({
|
|
10
10
|
grant_type: "refresh_token",
|
|
11
|
-
client_id:
|
|
11
|
+
client_id: r.clientId
|
|
12
12
|
})
|
|
13
13
|
});
|
|
14
|
-
if (
|
|
15
|
-
return localStorage.removeItem(
|
|
16
|
-
const
|
|
17
|
-
return localStorage.setItem(
|
|
14
|
+
if (t.status === 401)
|
|
15
|
+
return localStorage.removeItem(r.baseKey + "_access"), null;
|
|
16
|
+
const o = await t.json();
|
|
17
|
+
return localStorage.setItem(r.baseKey + "_access", o.access), o.access;
|
|
18
18
|
}
|
|
19
|
-
class
|
|
20
|
-
constructor(
|
|
21
|
-
this.onAuthFail =
|
|
19
|
+
class ge {
|
|
20
|
+
constructor(t, o) {
|
|
21
|
+
this.onAuthFail = o, this.config = t;
|
|
22
22
|
}
|
|
23
23
|
refreshPromise = null;
|
|
24
24
|
config;
|
|
25
25
|
getToken() {
|
|
26
26
|
return localStorage.getItem(this.config.baseKey + "_access");
|
|
27
27
|
}
|
|
28
|
-
setToken(
|
|
29
|
-
|
|
28
|
+
setToken(t) {
|
|
29
|
+
t ? localStorage.setItem(this.config.baseKey + "_access", t) : localStorage.removeItem(this.config.baseKey + "_access");
|
|
30
30
|
}
|
|
31
31
|
async getValidToken() {
|
|
32
|
-
let
|
|
33
|
-
return
|
|
32
|
+
let t = this.getToken();
|
|
33
|
+
return t || (this.refreshPromise || (this.refreshPromise = he(this.config).then((o) => (this.setToken(o), o)).finally(() => {
|
|
34
34
|
this.refreshPromise = null;
|
|
35
|
-
})),
|
|
35
|
+
})), t = await this.refreshPromise, !t && this.onAuthFail && this.onAuthFail(), t);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
class
|
|
38
|
+
class we {
|
|
39
39
|
authServer;
|
|
40
40
|
clientId;
|
|
41
41
|
redirectUri;
|
|
42
42
|
homePage;
|
|
43
43
|
baseKey;
|
|
44
|
-
constructor(
|
|
45
|
-
this.authServer =
|
|
44
|
+
constructor(t, o, s, a, c) {
|
|
45
|
+
this.authServer = t, this.clientId = o, this.redirectUri = s, this.homePage = a, this.baseKey = c;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
async function
|
|
49
|
-
let
|
|
50
|
-
const
|
|
51
|
-
...
|
|
48
|
+
async function X(r, t, o = {}, s) {
|
|
49
|
+
let a = r.getToken();
|
|
50
|
+
const c = (d) => fetch(t, {
|
|
51
|
+
...o,
|
|
52
52
|
headers: {
|
|
53
|
-
...
|
|
54
|
-
Authorization:
|
|
53
|
+
...o.headers,
|
|
54
|
+
Authorization: d ? `Bearer ${d}` : ""
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
|
-
let
|
|
58
|
-
return
|
|
57
|
+
let l = await c(a);
|
|
58
|
+
return l.status !== 401 ? l : (r.setToken(null), a = await r.getValidToken(), a ? c(a) : (s?.(), l));
|
|
59
59
|
}
|
|
60
|
-
async function
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
63
|
-
if (!
|
|
60
|
+
async function z(r) {
|
|
61
|
+
const t = new URLSearchParams(window.location.search), o = t.get("code"), s = sessionStorage.getItem("oauth_state"), a = t.get("state");
|
|
62
|
+
if (!o) return;
|
|
63
|
+
if (!a || a !== s)
|
|
64
64
|
throw new Error("Invalid OAuth state");
|
|
65
|
-
const
|
|
65
|
+
const c = sessionStorage.getItem("pkce_verifier"), d = await (await fetch(`${r.config.authServer}/token`, {
|
|
66
66
|
method: "POST",
|
|
67
67
|
headers: {
|
|
68
68
|
"Content-Type": "application/json"
|
|
69
69
|
},
|
|
70
70
|
body: JSON.stringify({
|
|
71
|
-
client_id:
|
|
72
|
-
code:
|
|
73
|
-
code_verifier:
|
|
71
|
+
client_id: r.config.clientId,
|
|
72
|
+
code: o,
|
|
73
|
+
code_verifier: c
|
|
74
74
|
})
|
|
75
75
|
})).json();
|
|
76
|
-
localStorage.setItem(
|
|
76
|
+
localStorage.setItem(r.config.baseKey + "_access", d.access), window.history.replaceState({}, document.title, r.config.homePage), window.location.href = r.config.homePage;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
const
|
|
80
|
-
let
|
|
81
|
-
const
|
|
82
|
-
crypto.getRandomValues(
|
|
83
|
-
for (let
|
|
84
|
-
|
|
85
|
-
return
|
|
78
|
+
function _e(r = 64) {
|
|
79
|
+
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
80
|
+
let o = "";
|
|
81
|
+
const s = new Uint8Array(r);
|
|
82
|
+
crypto.getRandomValues(s);
|
|
83
|
+
for (let a = 0; a < s.length; a++)
|
|
84
|
+
o += t[s[a] % t.length];
|
|
85
|
+
return o;
|
|
86
86
|
}
|
|
87
|
-
async function
|
|
88
|
-
const
|
|
89
|
-
return new Uint8Array(
|
|
87
|
+
async function pe(r) {
|
|
88
|
+
const o = new TextEncoder().encode(r), s = await crypto.subtle.digest("SHA-256", o);
|
|
89
|
+
return new Uint8Array(s);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
return btoa(String.fromCharCode(...Array.from(
|
|
91
|
+
function ve(r) {
|
|
92
|
+
return btoa(String.fromCharCode(...Array.from(r))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
93
93
|
}
|
|
94
|
-
async function
|
|
95
|
-
const
|
|
96
|
-
sessionStorage.setItem("pkce_verifier",
|
|
97
|
-
const
|
|
98
|
-
sessionStorage.setItem("oauth_state",
|
|
99
|
-
const
|
|
94
|
+
async function N(r) {
|
|
95
|
+
const t = _e(64), o = ve(await pe(t));
|
|
96
|
+
sessionStorage.setItem("pkce_verifier", t);
|
|
97
|
+
const s = crypto.randomUUID();
|
|
98
|
+
sessionStorage.setItem("oauth_state", s);
|
|
99
|
+
const a = new URLSearchParams({
|
|
100
100
|
response_type: "code",
|
|
101
|
-
client_id:
|
|
102
|
-
redirect_uri:
|
|
103
|
-
code_challenge:
|
|
101
|
+
client_id: r.config.clientId,
|
|
102
|
+
redirect_uri: r.config.redirectUri,
|
|
103
|
+
code_challenge: o,
|
|
104
104
|
code_challenge_method: "S256",
|
|
105
|
-
state:
|
|
105
|
+
state: s
|
|
106
106
|
});
|
|
107
|
-
window.location.href = `${
|
|
107
|
+
window.location.href = `${r.config.authServer}/authorize?${a}`;
|
|
108
108
|
}
|
|
109
|
-
async function
|
|
109
|
+
async function M(r) {
|
|
110
110
|
try {
|
|
111
|
-
await
|
|
111
|
+
await X(r, `${r.config.authServer}/logout`, {
|
|
112
112
|
method: "POST",
|
|
113
113
|
headers: {
|
|
114
114
|
"Content-Type": "application/json"
|
|
115
115
|
},
|
|
116
116
|
body: JSON.stringify({
|
|
117
|
-
client_id:
|
|
117
|
+
client_id: r.config.clientId
|
|
118
118
|
})
|
|
119
|
-
}), localStorage.removeItem(
|
|
120
|
-
} catch (
|
|
121
|
-
console.error(
|
|
119
|
+
}), localStorage.removeItem(r.config.baseKey + "_access"), await N(r);
|
|
120
|
+
} catch (t) {
|
|
121
|
+
console.error(t);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
const
|
|
124
|
+
const $ = de({
|
|
125
125
|
login: () => {
|
|
126
126
|
},
|
|
127
127
|
logout: () => {
|
|
@@ -132,690 +132,339 @@ const te = Rr({
|
|
|
132
132
|
user: null,
|
|
133
133
|
loading: !1
|
|
134
134
|
});
|
|
135
|
-
var
|
|
136
|
-
var
|
|
137
|
-
function
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
135
|
+
var T = { exports: {} }, b = {};
|
|
136
|
+
var q;
|
|
137
|
+
function be() {
|
|
138
|
+
if (q) return b;
|
|
139
|
+
q = 1;
|
|
140
|
+
var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
141
|
+
function o(s, a, c) {
|
|
142
|
+
var l = null;
|
|
143
|
+
if (c !== void 0 && (l = "" + c), a.key !== void 0 && (l = "" + a.key), "key" in a) {
|
|
144
|
+
c = {};
|
|
145
|
+
for (var d in a)
|
|
146
|
+
d !== "key" && (c[d] = a[d]);
|
|
147
|
+
} else c = a;
|
|
148
|
+
return a = c.ref, {
|
|
149
|
+
$$typeof: r,
|
|
150
|
+
type: s,
|
|
151
|
+
key: l,
|
|
152
|
+
ref: a !== void 0 ? a : null,
|
|
153
|
+
props: c
|
|
154
|
+
};
|
|
147
155
|
}
|
|
148
|
-
return
|
|
156
|
+
return b.Fragment = t, b.jsx = o, b.jsxs = o, b;
|
|
149
157
|
}
|
|
150
|
-
var
|
|
151
|
-
var
|
|
152
|
-
function
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (
|
|
157
|
-
return null;
|
|
158
|
-
|
|
159
|
-
return typeof r == "function" ? r : null;
|
|
160
|
-
}
|
|
161
|
-
var x = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
162
|
-
function b(e) {
|
|
163
|
-
{
|
|
164
|
-
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++)
|
|
165
|
-
t[o - 1] = arguments[o];
|
|
166
|
-
Ve("error", e, t);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
function Ve(e, r, t) {
|
|
170
|
-
{
|
|
171
|
-
var o = x.ReactDebugCurrentFrame, l = o.getStackAddendum();
|
|
172
|
-
l !== "" && (r += "%s", t = t.concat([l]));
|
|
173
|
-
var f = t.map(function(s) {
|
|
174
|
-
return String(s);
|
|
175
|
-
});
|
|
176
|
-
f.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, f);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
var Ke = !1, Ne = !1, Je = !1, Me = !1, Be = !1, oe;
|
|
180
|
-
oe = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
181
|
-
function qe(e) {
|
|
182
|
-
return !!(typeof e == "string" || typeof e == "function" || e === c || e === p || Be || e === d || e === P || e === _ || Me || e === j || Ke || Ne || Je || typeof e == "object" && e !== null && (e.$$typeof === w || e.$$typeof === S || e.$$typeof === g || e.$$typeof === m || e.$$typeof === y || // This needs to include all possible module reference object
|
|
183
|
-
// types supported by any Flight configuration anywhere since
|
|
184
|
-
// we don't know which Flight build this will end up being used
|
|
185
|
-
// with.
|
|
186
|
-
e.$$typeof === oe || e.getModuleId !== void 0));
|
|
187
|
-
}
|
|
188
|
-
function ze(e, r, t) {
|
|
189
|
-
var o = e.displayName;
|
|
190
|
-
if (o)
|
|
191
|
-
return o;
|
|
192
|
-
var l = r.displayName || r.name || "";
|
|
193
|
-
return l !== "" ? t + "(" + l + ")" : t;
|
|
194
|
-
}
|
|
195
|
-
function ie(e) {
|
|
196
|
-
return e.displayName || "Context";
|
|
197
|
-
}
|
|
198
|
-
function O(e) {
|
|
199
|
-
if (e == null)
|
|
200
|
-
return null;
|
|
201
|
-
if (typeof e.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
202
|
-
return e.displayName || e.name || null;
|
|
203
|
-
if (typeof e == "string")
|
|
204
|
-
return e;
|
|
158
|
+
var E = {};
|
|
159
|
+
var G;
|
|
160
|
+
function Ee() {
|
|
161
|
+
return G || (G = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
162
|
+
function r(e) {
|
|
163
|
+
if (e == null) return null;
|
|
164
|
+
if (typeof e == "function")
|
|
165
|
+
return e.$$typeof === ie ? null : e.displayName || e.name || null;
|
|
166
|
+
if (typeof e == "string") return e;
|
|
205
167
|
switch (e) {
|
|
206
|
-
case
|
|
168
|
+
case w:
|
|
207
169
|
return "Fragment";
|
|
208
|
-
case
|
|
209
|
-
return "Portal";
|
|
210
|
-
case p:
|
|
170
|
+
case ee:
|
|
211
171
|
return "Profiler";
|
|
212
|
-
case
|
|
172
|
+
case Q:
|
|
213
173
|
return "StrictMode";
|
|
214
|
-
case
|
|
174
|
+
case oe:
|
|
215
175
|
return "Suspense";
|
|
216
|
-
case
|
|
176
|
+
case ae:
|
|
217
177
|
return "SuspenseList";
|
|
178
|
+
case ce:
|
|
179
|
+
return "Activity";
|
|
218
180
|
}
|
|
219
181
|
if (typeof e == "object")
|
|
220
|
-
switch (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return
|
|
227
|
-
case
|
|
228
|
-
return
|
|
229
|
-
case
|
|
230
|
-
var
|
|
231
|
-
return
|
|
232
|
-
case
|
|
233
|
-
|
|
182
|
+
switch (typeof e.tag == "number" && console.error(
|
|
183
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
184
|
+
), e.$$typeof) {
|
|
185
|
+
case Z:
|
|
186
|
+
return "Portal";
|
|
187
|
+
case te:
|
|
188
|
+
return e.displayName || "Context";
|
|
189
|
+
case re:
|
|
190
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
191
|
+
case ne:
|
|
192
|
+
var n = e.render;
|
|
193
|
+
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
194
|
+
case se:
|
|
195
|
+
return n = e.displayName || null, n !== null ? n : r(e.type) || "Memo";
|
|
196
|
+
case k:
|
|
197
|
+
n = e._payload, e = e._init;
|
|
234
198
|
try {
|
|
235
|
-
return
|
|
199
|
+
return r(e(n));
|
|
236
200
|
} catch {
|
|
237
|
-
return null;
|
|
238
201
|
}
|
|
239
|
-
}
|
|
240
202
|
}
|
|
241
203
|
return null;
|
|
242
204
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
ge.__reactDisabledLog = !0;
|
|
247
|
-
function Ge() {
|
|
248
|
-
{
|
|
249
|
-
if (D === 0) {
|
|
250
|
-
se = console.log, ue = console.info, ce = console.warn, le = console.error, fe = console.group, de = console.groupCollapsed, ve = console.groupEnd;
|
|
251
|
-
var e = {
|
|
252
|
-
configurable: !0,
|
|
253
|
-
enumerable: !0,
|
|
254
|
-
value: ge,
|
|
255
|
-
writable: !0
|
|
256
|
-
};
|
|
257
|
-
Object.defineProperties(console, {
|
|
258
|
-
info: e,
|
|
259
|
-
log: e,
|
|
260
|
-
warn: e,
|
|
261
|
-
error: e,
|
|
262
|
-
group: e,
|
|
263
|
-
groupCollapsed: e,
|
|
264
|
-
groupEnd: e
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
D++;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
function He() {
|
|
271
|
-
{
|
|
272
|
-
if (D--, D === 0) {
|
|
273
|
-
var e = {
|
|
274
|
-
configurable: !0,
|
|
275
|
-
enumerable: !0,
|
|
276
|
-
writable: !0
|
|
277
|
-
};
|
|
278
|
-
Object.defineProperties(console, {
|
|
279
|
-
log: C({}, e, {
|
|
280
|
-
value: se
|
|
281
|
-
}),
|
|
282
|
-
info: C({}, e, {
|
|
283
|
-
value: ue
|
|
284
|
-
}),
|
|
285
|
-
warn: C({}, e, {
|
|
286
|
-
value: ce
|
|
287
|
-
}),
|
|
288
|
-
error: C({}, e, {
|
|
289
|
-
value: le
|
|
290
|
-
}),
|
|
291
|
-
group: C({}, e, {
|
|
292
|
-
value: fe
|
|
293
|
-
}),
|
|
294
|
-
groupCollapsed: C({}, e, {
|
|
295
|
-
value: de
|
|
296
|
-
}),
|
|
297
|
-
groupEnd: C({}, e, {
|
|
298
|
-
value: ve
|
|
299
|
-
})
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
D < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
var J = x.ReactCurrentDispatcher, M;
|
|
306
|
-
function Y(e, r, t) {
|
|
307
|
-
{
|
|
308
|
-
if (M === void 0)
|
|
309
|
-
try {
|
|
310
|
-
throw Error();
|
|
311
|
-
} catch (l) {
|
|
312
|
-
var o = l.stack.trim().match(/\n( *(at )?)/);
|
|
313
|
-
M = o && o[1] || "";
|
|
314
|
-
}
|
|
315
|
-
return `
|
|
316
|
-
` + M + e;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
var B = !1, L;
|
|
320
|
-
{
|
|
321
|
-
var Xe = typeof WeakMap == "function" ? WeakMap : Map;
|
|
322
|
-
L = new Xe();
|
|
205
|
+
function t(e) {
|
|
206
|
+
return "" + e;
|
|
323
207
|
}
|
|
324
|
-
function
|
|
325
|
-
if (!e || B)
|
|
326
|
-
return "";
|
|
327
|
-
{
|
|
328
|
-
var t = L.get(e);
|
|
329
|
-
if (t !== void 0)
|
|
330
|
-
return t;
|
|
331
|
-
}
|
|
332
|
-
var o;
|
|
333
|
-
B = !0;
|
|
334
|
-
var l = Error.prepareStackTrace;
|
|
335
|
-
Error.prepareStackTrace = void 0;
|
|
336
|
-
var f;
|
|
337
|
-
f = J.current, J.current = null, Ge();
|
|
208
|
+
function o(e) {
|
|
338
209
|
try {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
if (Object.defineProperty(s.prototype, "props", {
|
|
344
|
-
set: function() {
|
|
345
|
-
throw Error();
|
|
346
|
-
}
|
|
347
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
348
|
-
try {
|
|
349
|
-
Reflect.construct(s, []);
|
|
350
|
-
} catch (R) {
|
|
351
|
-
o = R;
|
|
352
|
-
}
|
|
353
|
-
Reflect.construct(e, [], s);
|
|
354
|
-
} else {
|
|
355
|
-
try {
|
|
356
|
-
s.call();
|
|
357
|
-
} catch (R) {
|
|
358
|
-
o = R;
|
|
359
|
-
}
|
|
360
|
-
e.call(s.prototype);
|
|
361
|
-
}
|
|
362
|
-
} else {
|
|
363
|
-
try {
|
|
364
|
-
throw Error();
|
|
365
|
-
} catch (R) {
|
|
366
|
-
o = R;
|
|
367
|
-
}
|
|
368
|
-
e();
|
|
369
|
-
}
|
|
370
|
-
} catch (R) {
|
|
371
|
-
if (R && o && typeof R.stack == "string") {
|
|
372
|
-
for (var i = R.stack.split(`
|
|
373
|
-
`), E = o.stack.split(`
|
|
374
|
-
`), v = i.length - 1, h = E.length - 1; v >= 1 && h >= 0 && i[v] !== E[h]; )
|
|
375
|
-
h--;
|
|
376
|
-
for (; v >= 1 && h >= 0; v--, h--)
|
|
377
|
-
if (i[v] !== E[h]) {
|
|
378
|
-
if (v !== 1 || h !== 1)
|
|
379
|
-
do
|
|
380
|
-
if (v--, h--, h < 0 || i[v] !== E[h]) {
|
|
381
|
-
var T = `
|
|
382
|
-
` + i[v].replace(" at new ", " at ");
|
|
383
|
-
return e.displayName && T.includes("<anonymous>") && (T = T.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, T), T;
|
|
384
|
-
}
|
|
385
|
-
while (v >= 1 && h >= 0);
|
|
386
|
-
break;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
} finally {
|
|
390
|
-
B = !1, J.current = f, He(), Error.prepareStackTrace = l;
|
|
391
|
-
}
|
|
392
|
-
var I = e ? e.displayName || e.name : "", k = I ? Y(I) : "";
|
|
393
|
-
return typeof e == "function" && L.set(e, k), k;
|
|
394
|
-
}
|
|
395
|
-
function Ze(e, r, t) {
|
|
396
|
-
return he(e, !1);
|
|
397
|
-
}
|
|
398
|
-
function Qe(e) {
|
|
399
|
-
var r = e.prototype;
|
|
400
|
-
return !!(r && r.isReactComponent);
|
|
401
|
-
}
|
|
402
|
-
function V(e, r, t) {
|
|
403
|
-
if (e == null)
|
|
404
|
-
return "";
|
|
405
|
-
if (typeof e == "function")
|
|
406
|
-
return he(e, Qe(e));
|
|
407
|
-
if (typeof e == "string")
|
|
408
|
-
return Y(e);
|
|
409
|
-
switch (e) {
|
|
410
|
-
case P:
|
|
411
|
-
return Y("Suspense");
|
|
412
|
-
case _:
|
|
413
|
-
return Y("SuspenseList");
|
|
414
|
-
}
|
|
415
|
-
if (typeof e == "object")
|
|
416
|
-
switch (e.$$typeof) {
|
|
417
|
-
case y:
|
|
418
|
-
return Ze(e.render);
|
|
419
|
-
case S:
|
|
420
|
-
return V(e.type, r, t);
|
|
421
|
-
case w: {
|
|
422
|
-
var o = e, l = o._payload, f = o._init;
|
|
423
|
-
try {
|
|
424
|
-
return V(f(l), r, t);
|
|
425
|
-
} catch {
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
return "";
|
|
430
|
-
}
|
|
431
|
-
var $ = Object.prototype.hasOwnProperty, pe = {}, ye = x.ReactDebugCurrentFrame;
|
|
432
|
-
function K(e) {
|
|
433
|
-
if (e) {
|
|
434
|
-
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
435
|
-
ye.setExtraStackFrame(t);
|
|
436
|
-
} else
|
|
437
|
-
ye.setExtraStackFrame(null);
|
|
438
|
-
}
|
|
439
|
-
function er(e, r, t, o, l) {
|
|
440
|
-
{
|
|
441
|
-
var f = Function.call.bind($);
|
|
442
|
-
for (var s in e)
|
|
443
|
-
if (f(e, s)) {
|
|
444
|
-
var i = void 0;
|
|
445
|
-
try {
|
|
446
|
-
if (typeof e[s] != "function") {
|
|
447
|
-
var E = Error((o || "React class") + ": " + t + " type `" + s + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[s] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
448
|
-
throw E.name = "Invariant Violation", E;
|
|
449
|
-
}
|
|
450
|
-
i = e[s](r, s, o, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
451
|
-
} catch (v) {
|
|
452
|
-
i = v;
|
|
453
|
-
}
|
|
454
|
-
i && !(i instanceof Error) && (K(l), b("%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).", o || "React class", t, s, typeof i), K(null)), i instanceof Error && !(i.message in pe) && (pe[i.message] = !0, K(l), b("Failed %s type: %s", t, i.message), K(null));
|
|
455
|
-
}
|
|
210
|
+
t(e);
|
|
211
|
+
var n = !1;
|
|
212
|
+
} catch {
|
|
213
|
+
n = !0;
|
|
456
214
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
return t;
|
|
215
|
+
if (n) {
|
|
216
|
+
n = console;
|
|
217
|
+
var i = n.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
218
|
+
return i.call(
|
|
219
|
+
n,
|
|
220
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
221
|
+
u
|
|
222
|
+
), t(e);
|
|
466
223
|
}
|
|
467
224
|
}
|
|
468
|
-
function
|
|
225
|
+
function s(e) {
|
|
226
|
+
if (e === w) return "<>";
|
|
227
|
+
if (typeof e == "object" && e !== null && e.$$typeof === k)
|
|
228
|
+
return "<...>";
|
|
469
229
|
try {
|
|
470
|
-
|
|
230
|
+
var n = r(e);
|
|
231
|
+
return n ? "<" + n + ">" : "<...>";
|
|
471
232
|
} catch {
|
|
472
|
-
return
|
|
233
|
+
return "<...>";
|
|
473
234
|
}
|
|
474
235
|
}
|
|
475
|
-
function
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
function _e(e) {
|
|
479
|
-
if (nr(e))
|
|
480
|
-
return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", tr(e)), me(e);
|
|
236
|
+
function a() {
|
|
237
|
+
var e = P.A;
|
|
238
|
+
return e === null ? null : e.getOwner();
|
|
481
239
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
ref: !0,
|
|
485
|
-
__self: !0,
|
|
486
|
-
__source: !0
|
|
487
|
-
}, Ee, Re;
|
|
488
|
-
function or(e) {
|
|
489
|
-
if ($.call(e, "ref")) {
|
|
490
|
-
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
491
|
-
if (r && r.isReactWarning)
|
|
492
|
-
return !1;
|
|
493
|
-
}
|
|
494
|
-
return e.ref !== void 0;
|
|
240
|
+
function c() {
|
|
241
|
+
return Error("react-stack-top-frame");
|
|
495
242
|
}
|
|
496
|
-
function
|
|
497
|
-
if (
|
|
498
|
-
var
|
|
499
|
-
if (
|
|
500
|
-
return !1;
|
|
243
|
+
function l(e) {
|
|
244
|
+
if (F.call(e, "key")) {
|
|
245
|
+
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
246
|
+
if (n && n.isReactWarning) return !1;
|
|
501
247
|
}
|
|
502
248
|
return e.key !== void 0;
|
|
503
249
|
}
|
|
504
|
-
function
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
Ee || (Ee = !0, b("%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)", r));
|
|
511
|
-
};
|
|
512
|
-
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
513
|
-
get: t,
|
|
514
|
-
configurable: !0
|
|
515
|
-
});
|
|
250
|
+
function d(e, n) {
|
|
251
|
+
function i() {
|
|
252
|
+
L || (L = !0, console.error(
|
|
253
|
+
"%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://react.dev/link/special-props)",
|
|
254
|
+
n
|
|
255
|
+
));
|
|
516
256
|
}
|
|
257
|
+
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
258
|
+
get: i,
|
|
259
|
+
configurable: !0
|
|
260
|
+
});
|
|
517
261
|
}
|
|
518
|
-
function
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
524
|
-
get: t,
|
|
525
|
-
configurable: !0
|
|
526
|
-
});
|
|
527
|
-
}
|
|
262
|
+
function S() {
|
|
263
|
+
var e = r(this.type);
|
|
264
|
+
return D[e] || (D[e] = !0, console.error(
|
|
265
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
266
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
528
267
|
}
|
|
529
|
-
|
|
530
|
-
var
|
|
531
|
-
|
|
532
|
-
$$typeof:
|
|
533
|
-
// Built-in properties that belong on the element
|
|
268
|
+
function R(e, n, i, u, y, O) {
|
|
269
|
+
var f = i.ref;
|
|
270
|
+
return e = {
|
|
271
|
+
$$typeof: Y,
|
|
534
272
|
type: e,
|
|
535
|
-
key:
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
273
|
+
key: n,
|
|
274
|
+
props: i,
|
|
275
|
+
_owner: u
|
|
276
|
+
}, (f !== void 0 ? f : null) !== null ? Object.defineProperty(e, "ref", {
|
|
277
|
+
enumerable: !1,
|
|
278
|
+
get: S
|
|
279
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
542
280
|
configurable: !1,
|
|
543
281
|
enumerable: !1,
|
|
544
282
|
writable: !0,
|
|
545
|
-
value:
|
|
546
|
-
}), Object.defineProperty(
|
|
283
|
+
value: 0
|
|
284
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
547
285
|
configurable: !1,
|
|
548
286
|
enumerable: !1,
|
|
549
|
-
writable: !
|
|
550
|
-
value:
|
|
551
|
-
}), Object.defineProperty(
|
|
287
|
+
writable: !0,
|
|
288
|
+
value: null
|
|
289
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
552
290
|
configurable: !1,
|
|
553
291
|
enumerable: !1,
|
|
554
|
-
writable: !
|
|
555
|
-
value:
|
|
556
|
-
}), Object.
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}
|
|
584
|
-
var G;
|
|
585
|
-
G = !1;
|
|
586
|
-
function H(e) {
|
|
587
|
-
return typeof e == "object" && e !== null && e.$$typeof === a;
|
|
588
|
-
}
|
|
589
|
-
function we() {
|
|
590
|
-
{
|
|
591
|
-
if (z.current) {
|
|
592
|
-
var e = O(z.current.type);
|
|
593
|
-
if (e)
|
|
594
|
-
return `
|
|
595
|
-
|
|
596
|
-
Check the render method of \`` + e + "`.";
|
|
597
|
-
}
|
|
598
|
-
return "";
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
function dr(e) {
|
|
602
|
-
return "";
|
|
603
|
-
}
|
|
604
|
-
var Te = {};
|
|
605
|
-
function vr(e) {
|
|
606
|
-
{
|
|
607
|
-
var r = we();
|
|
608
|
-
if (!r) {
|
|
609
|
-
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
610
|
-
t && (r = `
|
|
611
|
-
|
|
612
|
-
Check the top-level render call using <` + t + ">.");
|
|
613
|
-
}
|
|
614
|
-
return r;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
function Pe(e, r) {
|
|
618
|
-
{
|
|
619
|
-
if (!e._store || e._store.validated || e.key != null)
|
|
620
|
-
return;
|
|
621
|
-
e._store.validated = !0;
|
|
622
|
-
var t = vr(r);
|
|
623
|
-
if (Te[t])
|
|
624
|
-
return;
|
|
625
|
-
Te[t] = !0;
|
|
626
|
-
var o = "";
|
|
627
|
-
e && e._owner && e._owner !== z.current && (o = " It was passed a child from " + O(e._owner.type) + "."), A(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, o), A(null);
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
function Oe(e, r) {
|
|
631
|
-
{
|
|
632
|
-
if (typeof e != "object")
|
|
633
|
-
return;
|
|
634
|
-
if (q(e))
|
|
635
|
-
for (var t = 0; t < e.length; t++) {
|
|
636
|
-
var o = e[t];
|
|
637
|
-
H(o) && Pe(o, r);
|
|
638
|
-
}
|
|
639
|
-
else if (H(e))
|
|
640
|
-
e._store && (e._store.validated = !0);
|
|
641
|
-
else if (e) {
|
|
642
|
-
var l = Le(e);
|
|
643
|
-
if (typeof l == "function" && l !== e.entries)
|
|
644
|
-
for (var f = l.call(e), s; !(s = f.next()).done; )
|
|
645
|
-
H(s.value) && Pe(s.value, r);
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
function gr(e) {
|
|
650
|
-
{
|
|
651
|
-
var r = e.type;
|
|
652
|
-
if (r == null || typeof r == "string")
|
|
653
|
-
return;
|
|
654
|
-
var t;
|
|
655
|
-
if (typeof r == "function")
|
|
656
|
-
t = r.propTypes;
|
|
657
|
-
else if (typeof r == "object" && (r.$$typeof === y || // Note: Memo only checks outer props here.
|
|
658
|
-
// Inner props are checked in the reconciler.
|
|
659
|
-
r.$$typeof === S))
|
|
660
|
-
t = r.propTypes;
|
|
661
|
-
else
|
|
662
|
-
return;
|
|
663
|
-
if (t) {
|
|
664
|
-
var o = O(r);
|
|
665
|
-
er(t, e.props, "prop", o, e);
|
|
666
|
-
} else if (r.PropTypes !== void 0 && !G) {
|
|
667
|
-
G = !0;
|
|
668
|
-
var l = O(r);
|
|
669
|
-
b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", l || "Unknown");
|
|
670
|
-
}
|
|
671
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
function hr(e) {
|
|
675
|
-
{
|
|
676
|
-
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
677
|
-
var o = r[t];
|
|
678
|
-
if (o !== "children" && o !== "key") {
|
|
679
|
-
A(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", o), A(null);
|
|
680
|
-
break;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
e.ref !== null && (A(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), A(null));
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
var Ce = {};
|
|
687
|
-
function ke(e, r, t, o, l, f) {
|
|
688
|
-
{
|
|
689
|
-
var s = qe(e);
|
|
690
|
-
if (!s) {
|
|
691
|
-
var i = "";
|
|
692
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (i += " 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 E = dr();
|
|
694
|
-
E ? i += E : i += we();
|
|
695
|
-
var v;
|
|
696
|
-
e === null ? v = "null" : q(e) ? v = "array" : e !== void 0 && e.$$typeof === a ? (v = "<" + (O(e.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : v = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", v, i);
|
|
697
|
-
}
|
|
698
|
-
var h = fr(e, r, t, l, f);
|
|
699
|
-
if (h == null)
|
|
700
|
-
return h;
|
|
701
|
-
if (s) {
|
|
702
|
-
var T = r.children;
|
|
703
|
-
if (T !== void 0)
|
|
704
|
-
if (o)
|
|
705
|
-
if (q(T)) {
|
|
706
|
-
for (var I = 0; I < T.length; I++)
|
|
707
|
-
Oe(T[I], e);
|
|
708
|
-
Object.freeze && Object.freeze(T);
|
|
709
|
-
} else
|
|
710
|
-
b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
711
|
-
else
|
|
712
|
-
Oe(T, e);
|
|
713
|
-
}
|
|
714
|
-
if ($.call(r, "key")) {
|
|
715
|
-
var k = O(e), R = Object.keys(r).filter(function(Er) {
|
|
716
|
-
return Er !== "key";
|
|
717
|
-
}), X = R.length > 0 ? "{key: someKey, " + R.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
718
|
-
if (!Ce[k + X]) {
|
|
719
|
-
var br = R.length > 0 ? "{" + R.join(": ..., ") + ": ...}" : "{}";
|
|
720
|
-
b(`A props object containing a "key" prop is being spread into JSX:
|
|
292
|
+
writable: !0,
|
|
293
|
+
value: y
|
|
294
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
295
|
+
configurable: !1,
|
|
296
|
+
enumerable: !1,
|
|
297
|
+
writable: !0,
|
|
298
|
+
value: O
|
|
299
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
300
|
+
}
|
|
301
|
+
function p(e, n, i, u, y, O) {
|
|
302
|
+
var f = n.children;
|
|
303
|
+
if (f !== void 0)
|
|
304
|
+
if (u)
|
|
305
|
+
if (le(f)) {
|
|
306
|
+
for (u = 0; u < f.length; u++)
|
|
307
|
+
v(f[u]);
|
|
308
|
+
Object.freeze && Object.freeze(f);
|
|
309
|
+
} else
|
|
310
|
+
console.error(
|
|
311
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
312
|
+
);
|
|
313
|
+
else v(f);
|
|
314
|
+
if (F.call(n, "key")) {
|
|
315
|
+
f = r(e);
|
|
316
|
+
var g = Object.keys(n).filter(function(ue) {
|
|
317
|
+
return ue !== "key";
|
|
318
|
+
});
|
|
319
|
+
u = 0 < g.length ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}", W[f + u] || (g = 0 < g.length ? "{" + g.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
320
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
721
321
|
let props = %s;
|
|
722
322
|
<%s {...props} />
|
|
723
323
|
React keys must be passed directly to JSX without using spread:
|
|
724
324
|
let props = %s;
|
|
725
|
-
<%s key={someKey} {...props} />`,
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
325
|
+
<%s key={someKey} {...props} />`,
|
|
326
|
+
u,
|
|
327
|
+
f,
|
|
328
|
+
g,
|
|
329
|
+
f
|
|
330
|
+
), W[f + u] = !0);
|
|
729
331
|
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
return
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
332
|
+
if (f = null, i !== void 0 && (o(i), f = "" + i), l(n) && (o(n.key), f = "" + n.key), "key" in n) {
|
|
333
|
+
i = {};
|
|
334
|
+
for (var x in n)
|
|
335
|
+
x !== "key" && (i[x] = n[x]);
|
|
336
|
+
} else i = n;
|
|
337
|
+
return f && d(
|
|
338
|
+
i,
|
|
339
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
340
|
+
), R(
|
|
341
|
+
e,
|
|
342
|
+
f,
|
|
343
|
+
i,
|
|
344
|
+
a(),
|
|
345
|
+
y,
|
|
346
|
+
O
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
function v(e) {
|
|
350
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === k && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
351
|
+
}
|
|
352
|
+
function m(e) {
|
|
353
|
+
return typeof e == "object" && e !== null && e.$$typeof === Y;
|
|
354
|
+
}
|
|
355
|
+
var h = fe, Y = /* @__PURE__ */ Symbol.for("react.transitional.element"), Z = /* @__PURE__ */ Symbol.for("react.portal"), w = /* @__PURE__ */ Symbol.for("react.fragment"), Q = /* @__PURE__ */ Symbol.for("react.strict_mode"), ee = /* @__PURE__ */ Symbol.for("react.profiler"), re = /* @__PURE__ */ Symbol.for("react.consumer"), te = /* @__PURE__ */ Symbol.for("react.context"), ne = /* @__PURE__ */ Symbol.for("react.forward_ref"), oe = /* @__PURE__ */ Symbol.for("react.suspense"), ae = /* @__PURE__ */ Symbol.for("react.suspense_list"), se = /* @__PURE__ */ Symbol.for("react.memo"), k = /* @__PURE__ */ Symbol.for("react.lazy"), ce = /* @__PURE__ */ Symbol.for("react.activity"), ie = /* @__PURE__ */ Symbol.for("react.client.reference"), P = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, F = Object.prototype.hasOwnProperty, le = Array.isArray, A = console.createTask ? console.createTask : function() {
|
|
356
|
+
return null;
|
|
357
|
+
};
|
|
358
|
+
h = {
|
|
359
|
+
react_stack_bottom_frame: function(e) {
|
|
360
|
+
return e();
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
var L, D = {}, J = h.react_stack_bottom_frame.bind(
|
|
364
|
+
h,
|
|
365
|
+
c
|
|
366
|
+
)(), V = A(s(c)), W = {};
|
|
367
|
+
E.Fragment = w, E.jsx = function(e, n, i) {
|
|
368
|
+
var u = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
369
|
+
return p(
|
|
370
|
+
e,
|
|
371
|
+
n,
|
|
372
|
+
i,
|
|
373
|
+
!1,
|
|
374
|
+
u ? Error("react-stack-top-frame") : J,
|
|
375
|
+
u ? A(s(e)) : V
|
|
376
|
+
);
|
|
377
|
+
}, E.jsxs = function(e, n, i) {
|
|
378
|
+
var u = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
379
|
+
return p(
|
|
380
|
+
e,
|
|
381
|
+
n,
|
|
382
|
+
i,
|
|
383
|
+
!0,
|
|
384
|
+
u ? Error("react-stack-top-frame") : J,
|
|
385
|
+
u ? A(s(e)) : V
|
|
386
|
+
);
|
|
387
|
+
};
|
|
388
|
+
})()), E;
|
|
740
389
|
}
|
|
741
|
-
var
|
|
742
|
-
function
|
|
743
|
-
return
|
|
390
|
+
var K;
|
|
391
|
+
function ye() {
|
|
392
|
+
return K || (K = 1, process.env.NODE_ENV === "production" ? T.exports = be() : T.exports = Ee()), T.exports;
|
|
744
393
|
}
|
|
745
|
-
var
|
|
746
|
-
const
|
|
747
|
-
const [
|
|
748
|
-
|
|
749
|
-
const
|
|
750
|
-
if (!
|
|
751
|
-
|
|
394
|
+
var _ = ye();
|
|
395
|
+
const ke = ({ children: r, authConfig: t }) => {
|
|
396
|
+
const [o, s] = I(null), [a, c] = I(!0), l = me(() => new ge(t), [t]), d = j(async () => {
|
|
397
|
+
c(!0);
|
|
398
|
+
const p = localStorage.getItem(l.config.baseKey + "_access");
|
|
399
|
+
if (!p) {
|
|
400
|
+
s(null), c(!1);
|
|
752
401
|
return;
|
|
753
402
|
}
|
|
754
403
|
try {
|
|
755
|
-
const
|
|
404
|
+
const v = await X(l, `${l.config.authServer}/me`, {
|
|
756
405
|
headers: {
|
|
757
|
-
Authorization: `Bearer ${
|
|
406
|
+
Authorization: `Bearer ${p}`
|
|
758
407
|
}
|
|
759
408
|
});
|
|
760
|
-
if (!
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
role:
|
|
764
|
-
userId:
|
|
765
|
-
userName:
|
|
766
|
-
privileges:
|
|
409
|
+
if (!v.ok) throw new Error("not found");
|
|
410
|
+
const m = await v.json();
|
|
411
|
+
s({
|
|
412
|
+
role: m.role.role_name,
|
|
413
|
+
userId: m.user_id,
|
|
414
|
+
userName: m.user_name,
|
|
415
|
+
privileges: m.role.privileges.map((h) => h.privilege.trim())
|
|
767
416
|
});
|
|
768
417
|
} catch {
|
|
769
|
-
|
|
418
|
+
s(null);
|
|
770
419
|
}
|
|
771
|
-
|
|
420
|
+
c(!1);
|
|
772
421
|
}, []);
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}, [
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
}, [
|
|
779
|
-
|
|
780
|
-
}, [
|
|
781
|
-
return /* @__PURE__ */
|
|
782
|
-
},
|
|
783
|
-
const { authManager:
|
|
784
|
-
return
|
|
785
|
-
|
|
786
|
-
}, [
|
|
787
|
-
},
|
|
788
|
-
const
|
|
789
|
-
if (!
|
|
790
|
-
return
|
|
791
|
-
},
|
|
792
|
-
const { user:
|
|
793
|
-
return !!
|
|
422
|
+
C(() => {
|
|
423
|
+
d();
|
|
424
|
+
}, [d]);
|
|
425
|
+
const S = j(() => {
|
|
426
|
+
N(l);
|
|
427
|
+
}, [N, l]), R = j(() => {
|
|
428
|
+
M(l), s(null);
|
|
429
|
+
}, [M, l]);
|
|
430
|
+
return /* @__PURE__ */ _.jsx($.Provider, { value: { loadMe: d, loading: a, user: o, login: S, authManager: l, logout: R }, children: r });
|
|
431
|
+
}, Pe = () => {
|
|
432
|
+
const { authManager: r, loadMe: t } = B($);
|
|
433
|
+
return C(() => {
|
|
434
|
+
r && (z(r), t());
|
|
435
|
+
}, [z, r, t]), /* @__PURE__ */ _.jsx("div", {});
|
|
436
|
+
}, U = () => {
|
|
437
|
+
const r = B($);
|
|
438
|
+
if (!r || !r.authManager) throw new Error("AuthContext not found");
|
|
439
|
+
return r;
|
|
440
|
+
}, Te = (r) => {
|
|
441
|
+
const { user: t } = U();
|
|
442
|
+
return !!t?.privileges?.includes(r);
|
|
794
443
|
};
|
|
795
|
-
function
|
|
796
|
-
const { loading:
|
|
797
|
-
return
|
|
444
|
+
function Ae({ privilege: r, invalidPage: t, loadingPage: o }) {
|
|
445
|
+
const { loading: s } = U(), a = Te(r);
|
|
446
|
+
return s ? o : a ? /* @__PURE__ */ _.jsx(H, {}) : t;
|
|
798
447
|
}
|
|
799
|
-
function
|
|
800
|
-
const { authManager:
|
|
801
|
-
return
|
|
802
|
-
if (!
|
|
803
|
-
|
|
804
|
-
}, [
|
|
448
|
+
function Oe({ loadingPage: r }) {
|
|
449
|
+
const { authManager: t, login: o, user: s } = U(), [a, c] = I(!0);
|
|
450
|
+
return C(() => {
|
|
451
|
+
if (!t) return;
|
|
452
|
+
t.getToken() ? c(!1) : o();
|
|
453
|
+
}, [t, s]), t ? a ? r ?? /* @__PURE__ */ _.jsx("div", { children: "Loading..." }) : /* @__PURE__ */ _.jsx(H, {}) : /* @__PURE__ */ _.jsx("p", { children: "invalud config" });
|
|
805
454
|
}
|
|
806
455
|
export {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
456
|
+
$ as AuthContext,
|
|
457
|
+
ge as AuthManager,
|
|
458
|
+
ke as AuthProvider,
|
|
459
|
+
Pe as CallbackPage,
|
|
460
|
+
we as Config,
|
|
461
|
+
Ae as PrivilegeGate,
|
|
462
|
+
Oe as ProtectGate,
|
|
463
|
+
X as apiFetch,
|
|
464
|
+
z as handleCallback,
|
|
465
|
+
N as login,
|
|
466
|
+
M as logout,
|
|
467
|
+
he as refreshToken,
|
|
468
|
+
U as useAuth,
|
|
469
|
+
Te as usePrivilege
|
|
821
470
|
};
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`+q+e}}var ee=!1,G;{var cr=typeof WeakMap=="function"?WeakMap:Map;G=new cr}function we(e,r){if(!e||ee)return"";{var t=G.get(e);if(t!==void 0)return t}var o;ee=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var f;f=Q.current,Q.current=null,ir();try{if(r){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(w){o=w}Reflect.construct(e,[],s)}else{try{s.call()}catch(w){o=w}e.call(s.prototype)}}else{try{throw Error()}catch(w){o=w}e()}}catch(w){if(w&&o&&typeof w.stack=="string"){for(var i=w.stack.split(`
|
|
3
|
-
`),S=o.stack.split(`
|
|
4
|
-
`),h=i.length-1,p=S.length-1;h>=1&&p>=0&&i[h]!==S[p];)p--;for(;h>=1&&p>=0;h--,p--)if(i[h]!==S[p]){if(h!==1||p!==1)do if(h--,p--,p<0||i[h]!==S[p]){var O=`
|
|
5
|
-
`+i[h].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&G.set(e,O),O}while(h>=1&&p>=0);break}}}finally{ee=!1,Q.current=f,sr(),Error.prepareStackTrace=l}var U=e?e.displayName||e.name:"",x=U?B(U):"";return typeof e=="function"&&G.set(e,x),x}function ur(e,r,t){return we(e,!1)}function lr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function z(e,r,t){if(e==null)return"";if(typeof e=="function")return we(e,lr(e));if(typeof e=="string")return B(e);switch(e){case C:return B("Suspense");case E:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case _:return ur(e.render);case T:return z(e.type,r,t);case P:{var o=e,l=o._payload,f=o._init;try{return z(f(l),r,t)}catch{}}}return""}var V=Object.prototype.hasOwnProperty,Te={},Pe=F.ReactDebugCurrentFrame;function H(e){if(e){var r=e._owner,t=z(e.type,e._source,r?r.type:null);Pe.setExtraStackFrame(t)}else Pe.setExtraStackFrame(null)}function fr(e,r,t,o,l){{var f=Function.call.bind(V);for(var s in e)if(f(e,s)){var i=void 0;try{if(typeof e[s]!="function"){var S=Error((o||"React class")+": "+t+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}i=e[s](r,s,o,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(h){i=h}i&&!(i instanceof Error)&&(H(l),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).",o||"React class",t,s,typeof i),H(null)),i instanceof Error&&!(i.message in Te)&&(Te[i.message]=!0,H(l),R("Failed %s type: %s",t,i.message),H(null))}}}var dr=Array.isArray;function re(e){return dr(e)}function vr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function hr(e){try{return Oe(e),!1}catch{return!0}}function Oe(e){return""+e}function Ce(e){if(hr(e))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",vr(e)),Oe(e)}var ke=F.ReactCurrentOwner,gr={key:!0,ref:!0,__self:!0,__source:!0},je,xe;function pr(e){if(V.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function yr(e){if(V.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function mr(e,r){typeof e.ref=="string"&&ke.current}function _r(e,r){{var t=function(){je||(je=!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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function br(e,r){{var t=function(){xe||(xe=!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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var Er=function(e,r,t,o,l,f,s){var i={$$typeof:a,type:e,key:r,ref:t,props:s,_owner:f};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function Rr(e,r,t,o,l){{var f,s={},i=null,S=null;t!==void 0&&(Ce(t),i=""+t),yr(r)&&(Ce(r.key),i=""+r.key),pr(r)&&(S=r.ref,mr(r,l));for(f in r)V.call(r,f)&&!gr.hasOwnProperty(f)&&(s[f]=r[f]);if(e&&e.defaultProps){var h=e.defaultProps;for(f in h)s[f]===void 0&&(s[f]=h[f])}if(i||S){var p=typeof e=="function"?e.displayName||e.name||"Unknown":e;i&&_r(s,p),S&&br(s,p)}return Er(e,i,S,l,o,ke.current,s)}}var te=F.ReactCurrentOwner,Ae=F.ReactDebugCurrentFrame;function D(e){if(e){var r=e._owner,t=z(e.type,e._source,r?r.type:null);Ae.setExtraStackFrame(t)}else Ae.setExtraStackFrame(null)}var ne;ne=!1;function ae(e){return typeof e=="object"&&e!==null&&e.$$typeof===a}function Ie(){{if(te.current){var e=k(te.current.type);if(e)return`
|
|
6
|
-
|
|
7
|
-
Check the render method of \``+e+"`."}return""}}function Sr(e){return""}var Fe={};function wr(e){{var r=Ie();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
8
|
-
|
|
9
|
-
Check the top-level render call using <`+t+">.")}return r}}function De(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=wr(r);if(Fe[t])return;Fe[t]=!0;var o="";e&&e._owner&&e._owner!==te.current&&(o=" It was passed a child from "+k(e._owner.type)+"."),D(e),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,o),D(null)}}function Ue(e,r){{if(typeof e!="object")return;if(re(e))for(var t=0;t<e.length;t++){var o=e[t];ae(o)&&De(o,r)}else if(ae(e))e._store&&(e._store.validated=!0);else if(e){var l=Ze(e);if(typeof l=="function"&&l!==e.entries)for(var f=l.call(e),s;!(s=f.next()).done;)ae(s.value)&&De(s.value,r)}}}function Tr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===_||r.$$typeof===T))t=r.propTypes;else return;if(t){var o=k(r);fr(t,e.props,"prop",o,e)}else if(r.PropTypes!==void 0&&!ne){ne=!0;var l=k(r);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",l||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Pr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var o=r[t];if(o!=="children"&&o!=="key"){D(e),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),D(null);break}}e.ref!==null&&(D(e),R("Invalid attribute `ref` supplied to `React.Fragment`."),D(null))}}var We={};function Ye(e,r,t,o,l,f){{var s=ar(e);if(!s){var i="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(i+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var S=Sr();S?i+=S:i+=Ie();var h;e===null?h="null":re(e)?h="array":e!==void 0&&e.$$typeof===a?(h="<"+(k(e.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):h=typeof e,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",h,i)}var p=Rr(e,r,t,l,f);if(p==null)return p;if(s){var O=r.children;if(O!==void 0)if(o)if(re(O)){for(var U=0;U<O.length;U++)Ue(O[U],e);Object.freeze&&Object.freeze(O)}else 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.");else Ue(O,e)}if(V.call(r,"key")){var x=k(e),w=Object.keys(r).filter(function(Ar){return Ar!=="key"}),oe=w.length>0?"{key: someKey, "+w.join(": ..., ")+": ...}":"{key: someKey}";if(!We[x+oe]){var xr=w.length>0?"{"+w.join(": ..., ")+": ...}":"{}";R(`A props object containing a "key" prop is being spread into JSX:
|
|
1
|
+
(function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-router-dom"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l["alex-evo-sh-auth"]={},l.React,l.ReactRouterDOM))})(this,(function(l,m,D){"use strict";async function M(t){const r=await fetch(`${t.authServer}/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",client_id:t.clientId})});if(r.status===401)return localStorage.removeItem(t.baseKey+"_access"),null;const o=await r.json();return localStorage.setItem(t.baseKey+"_access",o.access),o.access}class J{constructor(r,o){this.onAuthFail=o,this.config=r}refreshPromise=null;config;getToken(){return localStorage.getItem(this.config.baseKey+"_access")}setToken(r){r?localStorage.setItem(this.config.baseKey+"_access",r):localStorage.removeItem(this.config.baseKey+"_access")}async getValidToken(){let r=this.getToken();return r||(this.refreshPromise||(this.refreshPromise=M(this.config).then(o=>(this.setToken(o),o)).finally(()=>{this.refreshPromise=null})),r=await this.refreshPromise,!r&&this.onAuthFail&&this.onAuthFail(),r)}}class q{authServer;clientId;redirectUri;homePage;baseKey;constructor(r,o,s,a,c){this.authServer=r,this.clientId=o,this.redirectUri=s,this.homePage=a,this.baseKey=c}}async function A(t,r,o={},s){let a=t.getToken();const c=h=>fetch(r,{...o,headers:{...o.headers,Authorization:h?`Bearer ${h}`:""}});let u=await c(a);return u.status!==401?u:(t.setToken(null),a=await t.getValidToken(),a?c(a):(s?.(),u))}async function O(t){const r=new URLSearchParams(window.location.search),o=r.get("code"),s=sessionStorage.getItem("oauth_state"),a=r.get("state");if(!o)return;if(!a||a!==s)throw new Error("Invalid OAuth state");const c=sessionStorage.getItem("pkce_verifier"),h=await(await fetch(`${t.config.authServer}/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t.config.clientId,code:o,code_verifier:c})})).json();localStorage.setItem(t.config.baseKey+"_access",h.access),window.history.replaceState({},document.title,t.config.homePage),window.location.href=t.config.homePage}function ee(t=64){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let o="";const s=new Uint8Array(t);crypto.getRandomValues(s);for(let a=0;a<s.length;a++)o+=r[s[a]%r.length];return o}async function te(t){const o=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",o);return new Uint8Array(s)}function re(t){return btoa(String.fromCharCode(...Array.from(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function S(t){const r=ee(64),o=re(await te(r));sessionStorage.setItem("pkce_verifier",r);const s=crypto.randomUUID();sessionStorage.setItem("oauth_state",s);const a=new URLSearchParams({response_type:"code",client_id:t.config.clientId,redirect_uri:t.config.redirectUri,code_challenge:o,code_challenge_method:"S256",state:s});window.location.href=`${t.config.authServer}/authorize?${a}`}async function j(t){try{await A(t,`${t.config.authServer}/logout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t.config.clientId})}),localStorage.removeItem(t.config.baseKey+"_access"),await S(t)}catch(r){console.error(r)}}const k=m.createContext({login:()=>{},logout:()=>{},loadMe:()=>{},authManager:null,user:null,loading:!1});var R={exports:{}},p={};var V;function ne(){if(V)return p;V=1;var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function o(s,a,c){var u=null;if(c!==void 0&&(u=""+c),a.key!==void 0&&(u=""+a.key),"key"in a){c={};for(var h in a)h!=="key"&&(c[h]=a[h])}else c=a;return a=c.ref,{$$typeof:t,type:s,key:u,ref:a!==void 0?a:null,props:c}}return p.Fragment=r,p.jsx=o,p.jsxs=o,p}var E={};var W;function oe(){return W||(W=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case I:return"Fragment";case de:return"Profiler";case fe:return"StrictMode";case _e:return"Suspense";case ve:return"SuspenseList";case pe:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case ue:return"Portal";case he:return e.displayName||"Context";case me:return(e._context.displayName||"Context")+".Consumer";case ge:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case be:return n=e.displayName||null,n!==null?n:t(e.type)||"Memo";case N:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function r(e){return""+e}function o(e){try{r(e);var n=!1}catch{n=!0}if(n){n=console;var i=n.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),r(e)}}function s(e){if(e===I)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===N)return"<...>";try{var n=t(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function a(){var e=F.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function u(e){if(B.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function h(e,n){function i(){H||(H=!0,console.error("%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://react.dev/link/special-props)",n))}i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function C(){var e=t(this.type);return X[e]||(X[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function x(e,n,i,f,P,Y){var d=i.ref;return e={$$typeof:K,type:e,key:n,props:i,_owner:f},(d!==void 0?d:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:C}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:P}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function y(e,n,i,f,P,Y){var d=n.children;if(d!==void 0)if(f)if(ye(d)){for(f=0;f<d.length;f++)T(d[f]);Object.freeze&&Object.freeze(d)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else T(d);if(B.call(n,"key")){d=t(e);var b=Object.keys(n).filter(function(Te){return Te!=="key"});f=0<b.length?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}",$[d+f]||(b=0<b.length?"{"+b.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
10
2
|
let props = %s;
|
|
11
3
|
<%s {...props} />
|
|
12
4
|
React keys must be passed directly to JSX without using spread:
|
|
13
5
|
let props = %s;
|
|
14
|
-
<%s key={someKey} {...props} />`,
|
|
6
|
+
<%s key={someKey} {...props} />`,f,d,b,d),$[d+f]=!0)}if(d=null,i!==void 0&&(o(i),d=""+i),u(n)&&(o(n.key),d=""+n.key),"key"in n){i={};for(var L in n)L!=="key"&&(i[L]=n[L])}else i=n;return d&&h(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),x(e,d,i,a(),P,Y)}function T(e){g(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===N&&(e._payload.status==="fulfilled"?g(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function g(e){return typeof e=="object"&&e!==null&&e.$$typeof===K}var v=m,K=Symbol.for("react.transitional.element"),ue=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),fe=Symbol.for("react.strict_mode"),de=Symbol.for("react.profiler"),me=Symbol.for("react.consumer"),he=Symbol.for("react.context"),ge=Symbol.for("react.forward_ref"),_e=Symbol.for("react.suspense"),ve=Symbol.for("react.suspense_list"),be=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),pe=Symbol.for("react.activity"),Ee=Symbol.for("react.client.reference"),F=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=Object.prototype.hasOwnProperty,ye=Array.isArray,U=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(e){return e()}};var H,X={},Z=v.react_stack_bottom_frame.bind(v,c)(),Q=U(s(c)),$={};E.Fragment=I,E.jsx=function(e,n,i){var f=1e4>F.recentlyCreatedOwnerStacks++;return y(e,n,i,!1,f?Error("react-stack-top-frame"):Z,f?U(s(e)):Q)},E.jsxs=function(e,n,i){var f=1e4>F.recentlyCreatedOwnerStacks++;return y(e,n,i,!0,f?Error("react-stack-top-frame"):Z,f?U(s(e)):Q)}})()),E}var z;function ae(){return z||(z=1,process.env.NODE_ENV==="production"?R.exports=ne():R.exports=oe()),R.exports}var _=ae();const se=({children:t,authConfig:r})=>{const[o,s]=m.useState(null),[a,c]=m.useState(!0),u=m.useMemo(()=>new J(r),[r]),h=m.useCallback(async()=>{c(!0);const y=localStorage.getItem(u.config.baseKey+"_access");if(!y){s(null),c(!1);return}try{const T=await A(u,`${u.config.authServer}/me`,{headers:{Authorization:`Bearer ${y}`}});if(!T.ok)throw new Error("not found");const g=await T.json();s({role:g.role.role_name,userId:g.user_id,userName:g.user_name,privileges:g.role.privileges.map(v=>v.privilege.trim())})}catch{s(null)}c(!1)},[]);m.useEffect(()=>{h()},[h]);const C=m.useCallback(()=>{S(u)},[S,u]),x=m.useCallback(()=>{j(u),s(null)},[j,u]);return _.jsx(k.Provider,{value:{loadMe:h,loading:a,user:o,login:C,authManager:u,logout:x},children:t})},ce=()=>{const{authManager:t,loadMe:r}=m.useContext(k);return m.useEffect(()=>{t&&(O(t),r())},[O,t,r]),_.jsx("div",{})},w=()=>{const t=m.useContext(k);if(!t||!t.authManager)throw new Error("AuthContext not found");return t},G=t=>{const{user:r}=w();return!!r?.privileges?.includes(t)};function ie({privilege:t,invalidPage:r,loadingPage:o}){const{loading:s}=w(),a=G(t);return s?o:a?_.jsx(D.Outlet,{}):r}function le({loadingPage:t}){const{authManager:r,login:o,user:s}=w(),[a,c]=m.useState(!0);return m.useEffect(()=>{if(!r)return;r.getToken()?c(!1):o()},[r,s]),r?a?t??_.jsx("div",{children:"Loading..."}):_.jsx(D.Outlet,{}):_.jsx("p",{children:"invalud config"})}l.AuthContext=k,l.AuthManager=J,l.AuthProvider=se,l.CallbackPage=ce,l.Config=q,l.PrivilegeGate=ie,l.ProtectGate=le,l.apiFetch=A,l.handleCallback=O,l.login=S,l.logout=j,l.refreshToken=M,l.useAuth=w,l.usePrivilege=G,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alex-evo-sh-auth",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/alex-evo-sh-auth.umd.js",
|
|
6
6
|
"module": "./dist/alex-evo-sh-auth.es.js",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"pub": "npm run build && npm version patch && npm publish"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"react": "
|
|
31
|
-
"react-dom": "
|
|
32
|
-
"react-router-dom": "
|
|
30
|
+
"react": "*",
|
|
31
|
+
"react-dom": "*",
|
|
32
|
+
"react-router-dom": "*"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"react": "^
|
|
36
|
-
"react-dom": "^
|
|
37
|
-
"react-router-dom": "^
|
|
38
|
-
"@types/react": "^
|
|
39
|
-
"@types/react-dom": "^
|
|
35
|
+
"react": "^19.2.4",
|
|
36
|
+
"react-dom": "^19.2.4",
|
|
37
|
+
"react-router-dom": "^7.8.2",
|
|
38
|
+
"@types/react": "^19.2.14",
|
|
39
|
+
"@types/react-dom": "^19.2.3",
|
|
40
40
|
"@types/react-router-dom": "^5.3.3",
|
|
41
41
|
"@eslint/js": "^9.39.1",
|
|
42
42
|
"@types/node": "^24.10.1",
|