alex-evo-sh-auth 0.0.7 → 0.0.9

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