authifyer-sdk 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authifyer-sdk.es.js +113 -100
- package/dist/authifyer-sdk.umd.js +9 -9
- package/package.json +2 -2
- package/src/core/api.ts +1 -1
- package/src/core/client.ts +21 -19
- package/src/core/types.ts +1 -1
package/dist/authifyer-sdk.es.js
CHANGED
|
@@ -59,7 +59,7 @@ function zt() {
|
|
|
59
59
|
return "Profiler";
|
|
60
60
|
case S:
|
|
61
61
|
return "StrictMode";
|
|
62
|
-
case
|
|
62
|
+
case M:
|
|
63
63
|
return "Suspense";
|
|
64
64
|
case v:
|
|
65
65
|
return "SuspenseList";
|
|
@@ -74,7 +74,7 @@ function zt() {
|
|
|
74
74
|
return "Portal";
|
|
75
75
|
case C:
|
|
76
76
|
return l.displayName || "Context";
|
|
77
|
-
case
|
|
77
|
+
case O:
|
|
78
78
|
return (l._context.displayName || "Context") + ".Consumer";
|
|
79
79
|
case U:
|
|
80
80
|
var w = l.render;
|
|
@@ -154,14 +154,14 @@ function zt() {
|
|
|
154
154
|
)), l = this.props.ref, l !== void 0 ? l : null;
|
|
155
155
|
}
|
|
156
156
|
function d(l, w, T, A, J, Ne) {
|
|
157
|
-
var
|
|
157
|
+
var _ = T.ref;
|
|
158
158
|
return l = {
|
|
159
159
|
$$typeof: f,
|
|
160
160
|
type: l,
|
|
161
161
|
key: w,
|
|
162
162
|
props: T,
|
|
163
163
|
_owner: A
|
|
164
|
-
}, (
|
|
164
|
+
}, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(l, "ref", {
|
|
165
165
|
enumerable: !1,
|
|
166
166
|
get: p
|
|
167
167
|
}) : Object.defineProperty(l, "ref", { enumerable: !1, value: null }), l._store = {}, Object.defineProperty(l._store, "validated", {
|
|
@@ -187,24 +187,24 @@ function zt() {
|
|
|
187
187
|
}), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l;
|
|
188
188
|
}
|
|
189
189
|
function u(l, w, T, A, J, Ne) {
|
|
190
|
-
var
|
|
191
|
-
if (
|
|
190
|
+
var _ = w.children;
|
|
191
|
+
if (_ !== void 0)
|
|
192
192
|
if (A)
|
|
193
|
-
if (
|
|
194
|
-
for (A = 0; A <
|
|
195
|
-
m(
|
|
196
|
-
Object.freeze && Object.freeze(
|
|
193
|
+
if (H(_)) {
|
|
194
|
+
for (A = 0; A < _.length; A++)
|
|
195
|
+
m(_[A]);
|
|
196
|
+
Object.freeze && Object.freeze(_);
|
|
197
197
|
} else
|
|
198
198
|
console.error(
|
|
199
199
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
200
200
|
);
|
|
201
|
-
else m(
|
|
201
|
+
else m(_);
|
|
202
202
|
if (W.call(w, "key")) {
|
|
203
|
-
|
|
203
|
+
_ = t(l);
|
|
204
204
|
var Q = Object.keys(w).filter(function(Ut) {
|
|
205
205
|
return Ut !== "key";
|
|
206
206
|
});
|
|
207
|
-
A = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", ye[
|
|
207
|
+
A = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", ye[_ + A] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
208
208
|
`A props object containing a "key" prop is being spread into JSX:
|
|
209
209
|
let props = %s;
|
|
210
210
|
<%s {...props} />
|
|
@@ -212,22 +212,22 @@ React keys must be passed directly to JSX without using spread:
|
|
|
212
212
|
let props = %s;
|
|
213
213
|
<%s key={someKey} {...props} />`,
|
|
214
214
|
A,
|
|
215
|
-
|
|
215
|
+
_,
|
|
216
216
|
Q,
|
|
217
|
-
|
|
218
|
-
), ye[
|
|
217
|
+
_
|
|
218
|
+
), ye[_ + A] = !0);
|
|
219
219
|
}
|
|
220
|
-
if (
|
|
220
|
+
if (_ = null, T !== void 0 && (r(T), _ = "" + T), i(w) && (r(w.key), _ = "" + w.key), "key" in w) {
|
|
221
221
|
T = {};
|
|
222
222
|
for (var Ce in w)
|
|
223
223
|
Ce !== "key" && (T[Ce] = w[Ce]);
|
|
224
224
|
} else T = w;
|
|
225
|
-
return
|
|
225
|
+
return _ && c(
|
|
226
226
|
T,
|
|
227
227
|
typeof l == "function" ? l.displayName || l.name || "Unknown" : l
|
|
228
228
|
), d(
|
|
229
229
|
l,
|
|
230
|
-
|
|
230
|
+
_,
|
|
231
231
|
T,
|
|
232
232
|
s(),
|
|
233
233
|
J,
|
|
@@ -240,7 +240,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
240
240
|
function E(l) {
|
|
241
241
|
return typeof l == "object" && l !== null && l.$$typeof === f;
|
|
242
242
|
}
|
|
243
|
-
var R = Bt, f = Symbol.for("react.transitional.element"), y = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), S = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"),
|
|
243
|
+
var R = Bt, f = Symbol.for("react.transitional.element"), y = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), S = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), O = Symbol.for("react.consumer"), C = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), M = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), te = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), pe = Symbol.for("react.activity"), me = Symbol.for("react.client.reference"), z = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, W = Object.prototype.hasOwnProperty, H = Array.isArray, G = console.createTask ? console.createTask : function() {
|
|
244
244
|
return null;
|
|
245
245
|
};
|
|
246
246
|
R = {
|
|
@@ -297,7 +297,7 @@ function Vt(t) {
|
|
|
297
297
|
let e;
|
|
298
298
|
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && pt(t.buffer), e;
|
|
299
299
|
}
|
|
300
|
-
const
|
|
300
|
+
const Kt = xe("string"), k = xe("function"), mt = xe("number"), le = (t) => t !== null && typeof t == "object", Yt = (t) => t === !0 || t === !1, we = (t) => {
|
|
301
301
|
if (Ae(t) !== "object")
|
|
302
302
|
return !1;
|
|
303
303
|
const e = qe(t);
|
|
@@ -347,7 +347,7 @@ function yt(t, e) {
|
|
|
347
347
|
return s;
|
|
348
348
|
return null;
|
|
349
349
|
}
|
|
350
|
-
const
|
|
350
|
+
const K = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, bt = (t) => !Z(t) && t !== K;
|
|
351
351
|
function Le() {
|
|
352
352
|
const { caseless: t, skipUndefined: e } = bt(this) && this || {}, r = {}, n = (s, o) => {
|
|
353
353
|
if (o === "__proto__" || o === "constructor" || o === "prototype")
|
|
@@ -425,7 +425,7 @@ const lr = (t, e, r, { allOwnKeys: n } = {}) => (ue(
|
|
|
425
425
|
return n;
|
|
426
426
|
}, gr = D("HTMLFormElement"), wr = (t) => t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function(r, n, s) {
|
|
427
427
|
return n.toUpperCase() + s;
|
|
428
|
-
}),
|
|
428
|
+
}), Ke = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), Er = D("RegExp"), gt = (t, e) => {
|
|
429
429
|
const r = Object.getOwnPropertyDescriptors(t), n = {};
|
|
430
430
|
ue(r, (s, o) => {
|
|
431
431
|
let i;
|
|
@@ -458,7 +458,7 @@ const lr = (t, e, r, { allOwnKeys: n } = {}) => (ue(
|
|
|
458
458
|
function xr(t) {
|
|
459
459
|
return !!(t && k(t.append) && t[ht] === "FormData" && t[Te]);
|
|
460
460
|
}
|
|
461
|
-
const
|
|
461
|
+
const Or = (t) => {
|
|
462
462
|
const e = new Array(10), r = (n, s) => {
|
|
463
463
|
if (le(n)) {
|
|
464
464
|
if (e.indexOf(n) >= 0)
|
|
@@ -477,23 +477,23 @@ const _r = (t) => {
|
|
|
477
477
|
return n;
|
|
478
478
|
};
|
|
479
479
|
return r(t, 0);
|
|
480
|
-
},
|
|
480
|
+
}, _r = D("AsyncFunction"), Nr = (t) => t && (le(t) || k(t)) && k(t.then) && k(t.catch), wt = ((t, e) => t ? setImmediate : e ? ((r, n) => (K.addEventListener(
|
|
481
481
|
"message",
|
|
482
482
|
({ source: s, data: o }) => {
|
|
483
|
-
s ===
|
|
483
|
+
s === K && o === r && n.length && n.shift()();
|
|
484
484
|
},
|
|
485
485
|
!1
|
|
486
486
|
), (s) => {
|
|
487
|
-
n.push(s),
|
|
488
|
-
}))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(typeof setImmediate == "function", k(
|
|
487
|
+
n.push(s), K.postMessage(r, "*");
|
|
488
|
+
}))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(typeof setImmediate == "function", k(K.postMessage)), Cr = typeof queueMicrotask < "u" ? queueMicrotask.bind(K) : typeof process < "u" && process.nextTick || wt, Pr = (t) => t != null && k(t[Te]), a = {
|
|
489
489
|
isArray: ee,
|
|
490
490
|
isArrayBuffer: pt,
|
|
491
491
|
isBuffer: ce,
|
|
492
492
|
isFormData: rr,
|
|
493
493
|
isArrayBufferView: Vt,
|
|
494
|
-
isString:
|
|
494
|
+
isString: Kt,
|
|
495
495
|
isNumber: mt,
|
|
496
|
-
isBoolean:
|
|
496
|
+
isBoolean: Yt,
|
|
497
497
|
isObject: le,
|
|
498
498
|
isPlainObject: we,
|
|
499
499
|
isEmptyObject: Xt,
|
|
@@ -525,8 +525,8 @@ const _r = (t) => {
|
|
|
525
525
|
forEachEntry: yr,
|
|
526
526
|
matchAll: br,
|
|
527
527
|
isHTMLForm: gr,
|
|
528
|
-
hasOwnProperty:
|
|
529
|
-
hasOwnProp:
|
|
528
|
+
hasOwnProperty: Ke,
|
|
529
|
+
hasOwnProp: Ke,
|
|
530
530
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
531
531
|
reduceDescriptors: gt,
|
|
532
532
|
freezeMethods: Rr,
|
|
@@ -535,11 +535,11 @@ const _r = (t) => {
|
|
|
535
535
|
noop: Tr,
|
|
536
536
|
toFiniteNumber: Ar,
|
|
537
537
|
findKey: yt,
|
|
538
|
-
global:
|
|
538
|
+
global: K,
|
|
539
539
|
isContextDefined: bt,
|
|
540
540
|
isSpecCompliantForm: xr,
|
|
541
|
-
toJSONObject:
|
|
542
|
-
isAsyncFn:
|
|
541
|
+
toJSONObject: Or,
|
|
542
|
+
isAsyncFn: _r,
|
|
543
543
|
isThenable: Nr,
|
|
544
544
|
setImmediate: wt,
|
|
545
545
|
asap: Cr,
|
|
@@ -603,7 +603,7 @@ function Ue(t) {
|
|
|
603
603
|
function Rt(t) {
|
|
604
604
|
return a.endsWith(t, "[]") ? t.slice(0, -2) : t;
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function Ye(t, e, r) {
|
|
607
607
|
return t ? t.concat(e).map(function(s, o) {
|
|
608
608
|
return s = Rt(s), !r && o ? "[" + s + "]" : s;
|
|
609
609
|
}).join(r ? "." : "") : e;
|
|
@@ -614,7 +614,7 @@ function vr(t) {
|
|
|
614
614
|
const kr = a.toFlatObject(a, {}, null, function(e) {
|
|
615
615
|
return /^is[A-Z]/.test(e);
|
|
616
616
|
});
|
|
617
|
-
function
|
|
617
|
+
function Oe(t, e, r) {
|
|
618
618
|
if (!a.isObject(t))
|
|
619
619
|
throw new TypeError("target must be an object");
|
|
620
620
|
e = e || new FormData(), r = a.toFlatObject(r, {
|
|
@@ -643,15 +643,15 @@ function _e(t, e, r) {
|
|
|
643
643
|
if (a.endsWith(y, "{}"))
|
|
644
644
|
y = n ? y : y.slice(0, -2), f = JSON.stringify(f);
|
|
645
645
|
else if (a.isArray(f) && vr(f) || (a.isFileList(f) || a.endsWith(y, "[]")) && (S = a.toArray(f)))
|
|
646
|
-
return y = Rt(y), S.forEach(function(
|
|
647
|
-
!(a.isUndefined(
|
|
646
|
+
return y = Rt(y), S.forEach(function(O, C) {
|
|
647
|
+
!(a.isUndefined(O) || O === null) && e.append(
|
|
648
648
|
// eslint-disable-next-line no-nested-ternary
|
|
649
|
-
i === !0 ?
|
|
650
|
-
d(
|
|
649
|
+
i === !0 ? Ye([y], C, o) : i === null ? y : y + "[]",
|
|
650
|
+
d(O)
|
|
651
651
|
);
|
|
652
652
|
}), !1;
|
|
653
653
|
}
|
|
654
|
-
return Ue(f) ? !0 : (e.append(
|
|
654
|
+
return Ue(f) ? !0 : (e.append(Ye(h, y, o), d(f)), !1);
|
|
655
655
|
}
|
|
656
656
|
const m = [], E = Object.assign(kr, {
|
|
657
657
|
defaultVisitor: u,
|
|
@@ -692,7 +692,7 @@ function Xe(t) {
|
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
694
|
function Me(t, e) {
|
|
695
|
-
this._pairs = [], t &&
|
|
695
|
+
this._pairs = [], t && Oe(t, this, e);
|
|
696
696
|
}
|
|
697
697
|
const St = Me.prototype;
|
|
698
698
|
St.append = function(e, r) {
|
|
@@ -803,7 +803,7 @@ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Mr
|
|
|
803
803
|
...Br
|
|
804
804
|
};
|
|
805
805
|
function $r(t, e) {
|
|
806
|
-
return
|
|
806
|
+
return Oe(t, new P.classes.URLSearchParams(), {
|
|
807
807
|
visitor: function(r, n, s, o) {
|
|
808
808
|
return P.isNode && a.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
|
|
809
809
|
},
|
|
@@ -866,7 +866,7 @@ const fe = {
|
|
|
866
866
|
return $r(e, this.formSerializer).toString();
|
|
867
867
|
if ((c = a.isFileList(e)) || n.indexOf("multipart/form-data") > -1) {
|
|
868
868
|
const p = this.env && this.env.FormData;
|
|
869
|
-
return
|
|
869
|
+
return Oe(
|
|
870
870
|
c ? { "files[]": e } : e,
|
|
871
871
|
p && new p(),
|
|
872
872
|
this.formSerializer
|
|
@@ -934,7 +934,7 @@ const Vr = a.toObjectSet([
|
|
|
934
934
|
"referer",
|
|
935
935
|
"retry-after",
|
|
936
936
|
"user-agent"
|
|
937
|
-
]),
|
|
937
|
+
]), Kr = (t) => {
|
|
938
938
|
const e = {};
|
|
939
939
|
let r, n, s;
|
|
940
940
|
return t && t.split(`
|
|
@@ -948,7 +948,7 @@ function ie(t) {
|
|
|
948
948
|
function Ee(t) {
|
|
949
949
|
return t === !1 || t == null ? t : a.isArray(t) ? t.map(Ee) : String(t);
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function Yr(t) {
|
|
952
952
|
const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
953
953
|
let n;
|
|
954
954
|
for (; n = r.exec(t); )
|
|
@@ -997,7 +997,7 @@ let L = class {
|
|
|
997
997
|
if (a.isPlainObject(e) || e instanceof this.constructor)
|
|
998
998
|
i(e, r);
|
|
999
999
|
else if (a.isString(e) && (e = e.trim()) && !Xr(e))
|
|
1000
|
-
i(
|
|
1000
|
+
i(Kr(e), r);
|
|
1001
1001
|
else if (a.isObject(e) && a.isIterable(e)) {
|
|
1002
1002
|
let c = {}, p, d;
|
|
1003
1003
|
for (const u of e) {
|
|
@@ -1018,7 +1018,7 @@ let L = class {
|
|
|
1018
1018
|
if (!r)
|
|
1019
1019
|
return s;
|
|
1020
1020
|
if (r === !0)
|
|
1021
|
-
return
|
|
1021
|
+
return Yr(s);
|
|
1022
1022
|
if (a.isFunction(r))
|
|
1023
1023
|
return r.call(this, s, n);
|
|
1024
1024
|
if (a.isRegExp(r))
|
|
@@ -1141,7 +1141,7 @@ let de = class extends g {
|
|
|
1141
1141
|
super(e ?? "canceled", g.ERR_CANCELED, r, n), this.name = "CanceledError", this.__CANCEL__ = !0;
|
|
1142
1142
|
}
|
|
1143
1143
|
};
|
|
1144
|
-
function
|
|
1144
|
+
function Ot(t, e, r) {
|
|
1145
1145
|
const n = r.config.validateStatus;
|
|
1146
1146
|
!r.status || !n || n(r.status) ? t(r) : e(new g(
|
|
1147
1147
|
"Request failed with status code " + r.status,
|
|
@@ -1247,7 +1247,7 @@ function sn(t) {
|
|
|
1247
1247
|
function on(t, e) {
|
|
1248
1248
|
return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
|
|
1249
1249
|
}
|
|
1250
|
-
function
|
|
1250
|
+
function _t(t, e, r) {
|
|
1251
1251
|
let n = !sn(e);
|
|
1252
1252
|
return t && (n || r == !1) ? on(t, e) : e;
|
|
1253
1253
|
}
|
|
@@ -1324,7 +1324,7 @@ function X(t, e) {
|
|
|
1324
1324
|
const Nt = (t) => {
|
|
1325
1325
|
const e = X({}, t);
|
|
1326
1326
|
let { data: r, withXSRFToken: n, xsrfHeaderName: s, xsrfCookieName: o, headers: i, auth: c } = e;
|
|
1327
|
-
if (e.headers = i = L.from(i), e.url = Tt(
|
|
1327
|
+
if (e.headers = i = L.from(i), e.url = Tt(_t(e.baseURL, e.url, e.allowAbsoluteUrls), t.params, t.paramsSerializer), c && i.set(
|
|
1328
1328
|
"Authorization",
|
|
1329
1329
|
"Basic " + btoa((c.username || "") + ":" + (c.password ? unescape(encodeURIComponent(c.password)) : ""))
|
|
1330
1330
|
), a.isFormData(r)) {
|
|
@@ -1356,17 +1356,17 @@ const Nt = (t) => {
|
|
|
1356
1356
|
function S() {
|
|
1357
1357
|
if (!h)
|
|
1358
1358
|
return;
|
|
1359
|
-
const
|
|
1359
|
+
const O = L.from(
|
|
1360
1360
|
"getAllResponseHeaders" in h && h.getAllResponseHeaders()
|
|
1361
1361
|
), U = {
|
|
1362
1362
|
data: !c || c === "text" || c === "json" ? h.responseText : h.response,
|
|
1363
1363
|
status: h.status,
|
|
1364
1364
|
statusText: h.statusText,
|
|
1365
|
-
headers:
|
|
1365
|
+
headers: O,
|
|
1366
1366
|
config: t,
|
|
1367
1367
|
request: h
|
|
1368
1368
|
};
|
|
1369
|
-
|
|
1369
|
+
Ot(function(v) {
|
|
1370
1370
|
r(v), y();
|
|
1371
1371
|
}, function(v) {
|
|
1372
1372
|
n(v), y();
|
|
@@ -1377,8 +1377,8 @@ const Nt = (t) => {
|
|
|
1377
1377
|
}, h.onabort = function() {
|
|
1378
1378
|
h && (n(new g("Request aborted", g.ECONNABORTED, t, h)), h = null);
|
|
1379
1379
|
}, h.onerror = function(C) {
|
|
1380
|
-
const U = C && C.message ? C.message : "Network Error",
|
|
1381
|
-
|
|
1380
|
+
const U = C && C.message ? C.message : "Network Error", M = new g(U, g.ERR_NETWORK, t, h);
|
|
1381
|
+
M.event = C || null, n(M), h = null;
|
|
1382
1382
|
}, h.ontimeout = function() {
|
|
1383
1383
|
let C = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
|
|
1384
1384
|
const U = s.transitional || He;
|
|
@@ -1390,8 +1390,8 @@ const Nt = (t) => {
|
|
|
1390
1390
|
)), h = null;
|
|
1391
1391
|
}, o === void 0 && i.setContentType(null), "setRequestHeader" in h && a.forEach(i.toJSON(), function(C, U) {
|
|
1392
1392
|
h.setRequestHeader(U, C);
|
|
1393
|
-
}), a.isUndefined(s.withCredentials) || (h.withCredentials = !!s.withCredentials), c && c !== "json" && (h.responseType = s.responseType), d && ([E, f] = Se(d, !0), h.addEventListener("progress", E)), p && h.upload && ([m, R] = Se(p), h.upload.addEventListener("progress", m), h.upload.addEventListener("loadend", R)), (s.cancelToken || s.signal) && (u = (
|
|
1394
|
-
h && (n(!
|
|
1393
|
+
}), a.isUndefined(s.withCredentials) || (h.withCredentials = !!s.withCredentials), c && c !== "json" && (h.responseType = s.responseType), d && ([E, f] = Se(d, !0), h.addEventListener("progress", E)), p && h.upload && ([m, R] = Se(p), h.upload.addEventListener("progress", m), h.upload.addEventListener("loadend", R)), (s.cancelToken || s.signal) && (u = (O) => {
|
|
1394
|
+
h && (n(!O || O.type ? new de(null, t, h) : O), h.abort(), h = null);
|
|
1395
1395
|
}, s.cancelToken && s.cancelToken.subscribe(u), s.signal && (s.signal.aborted ? u() : s.signal.addEventListener("abort", u)));
|
|
1396
1396
|
const j = Zr(s.url);
|
|
1397
1397
|
if (j && P.protocols.indexOf(j) === -1) {
|
|
@@ -1544,23 +1544,23 @@ const Nt = (t) => {
|
|
|
1544
1544
|
method: h,
|
|
1545
1545
|
data: S,
|
|
1546
1546
|
signal: j,
|
|
1547
|
-
cancelToken:
|
|
1547
|
+
cancelToken: O,
|
|
1548
1548
|
timeout: C,
|
|
1549
1549
|
onDownloadProgress: U,
|
|
1550
|
-
onUploadProgress:
|
|
1550
|
+
onUploadProgress: M,
|
|
1551
1551
|
responseType: v,
|
|
1552
1552
|
headers: te,
|
|
1553
1553
|
withCredentials: $ = "same-origin",
|
|
1554
1554
|
fetchOptions: pe
|
|
1555
1555
|
} = Nt(f), me = e || fetch;
|
|
1556
1556
|
v = v ? (v + "").toLowerCase() : "text";
|
|
1557
|
-
let z = ln([j,
|
|
1558
|
-
const
|
|
1557
|
+
let z = ln([j, O && O.toAbortSignal()], C), W = null;
|
|
1558
|
+
const H = z && z.unsubscribe && (() => {
|
|
1559
1559
|
z.unsubscribe();
|
|
1560
1560
|
});
|
|
1561
1561
|
let G;
|
|
1562
1562
|
try {
|
|
1563
|
-
if (
|
|
1563
|
+
if (M && d && h !== "get" && h !== "head" && (G = await R(te, S)) !== 0) {
|
|
1564
1564
|
let l = new r(y, {
|
|
1565
1565
|
method: "POST",
|
|
1566
1566
|
body: S,
|
|
@@ -1569,7 +1569,7 @@ const Nt = (t) => {
|
|
|
1569
1569
|
if (a.isFormData(S) && (w = l.headers.get("content-type")) && te.setContentType(w), l.body) {
|
|
1570
1570
|
const [T, A] = Ze(
|
|
1571
1571
|
G,
|
|
1572
|
-
Se(et(
|
|
1572
|
+
Se(et(M))
|
|
1573
1573
|
);
|
|
1574
1574
|
S = rt(l.body, nt, T, A);
|
|
1575
1575
|
}
|
|
@@ -1587,7 +1587,7 @@ const Nt = (t) => {
|
|
|
1587
1587
|
W = o && new r(y, re);
|
|
1588
1588
|
let B = await (o ? me(W, pe) : me(y, re));
|
|
1589
1589
|
const ne = u && (v === "stream" || v === "response");
|
|
1590
|
-
if (u && (U || ne &&
|
|
1590
|
+
if (u && (U || ne && H)) {
|
|
1591
1591
|
const l = {};
|
|
1592
1592
|
["status", "statusText", "headers"].forEach((J) => {
|
|
1593
1593
|
l[J] = B[J];
|
|
@@ -1598,15 +1598,15 @@ const Nt = (t) => {
|
|
|
1598
1598
|
) || [];
|
|
1599
1599
|
B = new n(
|
|
1600
1600
|
rt(B.body, nt, T, () => {
|
|
1601
|
-
A && A(),
|
|
1601
|
+
A && A(), H && H();
|
|
1602
1602
|
}),
|
|
1603
1603
|
l
|
|
1604
1604
|
);
|
|
1605
1605
|
}
|
|
1606
1606
|
v = v || "text";
|
|
1607
1607
|
let ye = await m[a.findKey(m, v) || "text"](B, f);
|
|
1608
|
-
return !ne &&
|
|
1609
|
-
|
|
1608
|
+
return !ne && H && H(), await new Promise((l, w) => {
|
|
1609
|
+
Ot(l, w, {
|
|
1610
1610
|
data: ye,
|
|
1611
1611
|
headers: L.from(B.headers),
|
|
1612
1612
|
status: B.status,
|
|
@@ -1616,7 +1616,7 @@ const Nt = (t) => {
|
|
|
1616
1616
|
});
|
|
1617
1617
|
});
|
|
1618
1618
|
} catch (N) {
|
|
1619
|
-
throw
|
|
1619
|
+
throw H && H(), N && N.name === "TypeError" && /Load failed|fetch/i.test(N.message) ? Object.assign(
|
|
1620
1620
|
new g("Network Error", g.ERR_NETWORK, f, W, N && N.response),
|
|
1621
1621
|
{
|
|
1622
1622
|
cause: N.cause || N
|
|
@@ -1716,14 +1716,14 @@ function ct(t) {
|
|
|
1716
1716
|
), n.response.headers = L.from(n.response.headers))), Promise.reject(n);
|
|
1717
1717
|
});
|
|
1718
1718
|
}
|
|
1719
|
-
const jt = "1.13.5",
|
|
1719
|
+
const jt = "1.13.5", _e = {};
|
|
1720
1720
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
|
|
1721
|
-
|
|
1721
|
+
_e[t] = function(n) {
|
|
1722
1722
|
return typeof n === t || "a" + (e < 1 ? "n " : " ") + t;
|
|
1723
1723
|
};
|
|
1724
1724
|
});
|
|
1725
1725
|
const lt = {};
|
|
1726
|
-
|
|
1726
|
+
_e.transitional = function(e, r, n) {
|
|
1727
1727
|
function s(o, i) {
|
|
1728
1728
|
return "[Axios v" + jt + "] Transitional option '" + o + "'" + i + (n ? ". " + n : "");
|
|
1729
1729
|
}
|
|
@@ -1741,7 +1741,7 @@ Oe.transitional = function(e, r, n) {
|
|
|
1741
1741
|
)), e ? e(o, i, c) : !0;
|
|
1742
1742
|
};
|
|
1743
1743
|
};
|
|
1744
|
-
|
|
1744
|
+
_e.spelling = function(e) {
|
|
1745
1745
|
return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0);
|
|
1746
1746
|
};
|
|
1747
1747
|
function gn(t, e, r) {
|
|
@@ -1763,9 +1763,9 @@ function gn(t, e, r) {
|
|
|
1763
1763
|
}
|
|
1764
1764
|
const Re = {
|
|
1765
1765
|
assertOptions: gn,
|
|
1766
|
-
validators:
|
|
1766
|
+
validators: _e
|
|
1767
1767
|
}, I = Re.validators;
|
|
1768
|
-
let
|
|
1768
|
+
let Y = class {
|
|
1769
1769
|
constructor(e) {
|
|
1770
1770
|
this.defaults = e || {}, this.interceptors = {
|
|
1771
1771
|
request: new Ge(),
|
|
@@ -1866,12 +1866,12 @@ let K = class {
|
|
|
1866
1866
|
}
|
|
1867
1867
|
getUri(e) {
|
|
1868
1868
|
e = X(this.defaults, e);
|
|
1869
|
-
const r =
|
|
1869
|
+
const r = _t(e.baseURL, e.url, e.allowAbsoluteUrls);
|
|
1870
1870
|
return Tt(r, e.params, e.paramsSerializer);
|
|
1871
1871
|
}
|
|
1872
1872
|
};
|
|
1873
1873
|
a.forEach(["delete", "get", "head", "options"], function(e) {
|
|
1874
|
-
|
|
1874
|
+
Y.prototype[e] = function(r, n) {
|
|
1875
1875
|
return this.request(X(n || {}, {
|
|
1876
1876
|
method: e,
|
|
1877
1877
|
url: r,
|
|
@@ -1892,7 +1892,7 @@ a.forEach(["post", "put", "patch"], function(e) {
|
|
|
1892
1892
|
}));
|
|
1893
1893
|
};
|
|
1894
1894
|
}
|
|
1895
|
-
|
|
1895
|
+
Y.prototype[e] = r(), Y.prototype[e + "Form"] = r(!0);
|
|
1896
1896
|
});
|
|
1897
1897
|
let wn = class vt {
|
|
1898
1898
|
constructor(e) {
|
|
@@ -2050,18 +2050,18 @@ Object.entries(Ie).forEach(([t, e]) => {
|
|
|
2050
2050
|
Ie[e] = t;
|
|
2051
2051
|
});
|
|
2052
2052
|
function kt(t) {
|
|
2053
|
-
const e = new
|
|
2054
|
-
return a.extend(r,
|
|
2053
|
+
const e = new Y(t), r = dt(Y.prototype.request, e);
|
|
2054
|
+
return a.extend(r, Y.prototype, e, { allOwnKeys: !0 }), a.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(s) {
|
|
2055
2055
|
return kt(X(t, s));
|
|
2056
2056
|
}, r;
|
|
2057
2057
|
}
|
|
2058
2058
|
const x = kt(fe);
|
|
2059
|
-
x.Axios =
|
|
2059
|
+
x.Axios = Y;
|
|
2060
2060
|
x.CanceledError = de;
|
|
2061
2061
|
x.CancelToken = wn;
|
|
2062
2062
|
x.isCancel = xt;
|
|
2063
2063
|
x.VERSION = jt;
|
|
2064
|
-
x.toFormData =
|
|
2064
|
+
x.toFormData = Oe;
|
|
2065
2065
|
x.AxiosError = g;
|
|
2066
2066
|
x.Cancel = x.CanceledError;
|
|
2067
2067
|
x.all = function(e) {
|
|
@@ -2091,8 +2091,8 @@ const {
|
|
|
2091
2091
|
HttpStatusCode: Wn,
|
|
2092
2092
|
formToJSON: Jn,
|
|
2093
2093
|
getAdapter: Vn,
|
|
2094
|
-
mergeConfig:
|
|
2095
|
-
} = x, Sn = "https://
|
|
2094
|
+
mergeConfig: Kn
|
|
2095
|
+
} = x, Sn = "https://authifyer-backend.onrender.com", q = x.create({
|
|
2096
2096
|
baseURL: Sn,
|
|
2097
2097
|
withCredentials: !0,
|
|
2098
2098
|
// Kept for legacy compatibility if cookies are ever used
|
|
@@ -2100,7 +2100,7 @@ const {
|
|
|
2100
2100
|
"Content-Type": "application/json"
|
|
2101
2101
|
}
|
|
2102
2102
|
}), ut = (t) => {
|
|
2103
|
-
t ?
|
|
2103
|
+
t ? q.defaults.headers.common.Authorization = `Bearer ${t}` : delete q.defaults.headers.common.Authorization;
|
|
2104
2104
|
}, Be = "authifyer_refresh_token", ke = (t) => {
|
|
2105
2105
|
try {
|
|
2106
2106
|
t ? localStorage.setItem(Be, t) : localStorage.removeItem(Be);
|
|
@@ -2162,7 +2162,7 @@ function xn(t, e) {
|
|
|
2162
2162
|
throw new ae(`Invalid token specified: invalid json for part #${r + 1} (${o.message})`);
|
|
2163
2163
|
}
|
|
2164
2164
|
}
|
|
2165
|
-
const
|
|
2165
|
+
const On = (t) => {
|
|
2166
2166
|
try {
|
|
2167
2167
|
const e = xn(t), r = Date.now() / 1e3;
|
|
2168
2168
|
if (e.exp < r)
|
|
@@ -2187,7 +2187,7 @@ const _n = (t) => {
|
|
|
2187
2187
|
return console.error("Invalid token", e), null;
|
|
2188
2188
|
}
|
|
2189
2189
|
};
|
|
2190
|
-
class
|
|
2190
|
+
class _n {
|
|
2191
2191
|
constructor(e, r) {
|
|
2192
2192
|
V(this, "publishableKey");
|
|
2193
2193
|
V(this, "refreshTimer", null);
|
|
@@ -2196,12 +2196,25 @@ class On {
|
|
|
2196
2196
|
V(this, "config", null);
|
|
2197
2197
|
V(this, "isLoading", !0);
|
|
2198
2198
|
V(this, "listeners", []);
|
|
2199
|
-
this.publishableKey = e, r != null && r.backendUrl && (
|
|
2199
|
+
this.publishableKey = e, r != null && r.backendUrl && (q.defaults.baseURL = r.backendUrl);
|
|
2200
2200
|
}
|
|
2201
2201
|
// --- API Methods ---
|
|
2202
2202
|
async load() {
|
|
2203
2203
|
try {
|
|
2204
|
-
this.isLoading = !0, this.notifyListeners()
|
|
2204
|
+
this.isLoading = !0, this.notifyListeners();
|
|
2205
|
+
try {
|
|
2206
|
+
const r = (await q.get(`/public/config/${this.publishableKey}`)).data, n = [];
|
|
2207
|
+
r.isGoogleOauthEnabled && n.push("google"), r.isGithubOauthEnabled && n.push("github"), this.config = {
|
|
2208
|
+
emailPasswordEnabled: r.isEmailPassEnabled,
|
|
2209
|
+
oauthProviders: n
|
|
2210
|
+
};
|
|
2211
|
+
} catch (e) {
|
|
2212
|
+
console.warn("Authifyer: Failed to fetch public project configuration. Using default defaults.", e), this.config = {
|
|
2213
|
+
emailPasswordEnabled: !0,
|
|
2214
|
+
oauthProviders: ["google", "github"]
|
|
2215
|
+
};
|
|
2216
|
+
}
|
|
2217
|
+
await this.refreshSession();
|
|
2205
2218
|
} catch (e) {
|
|
2206
2219
|
console.error("Failed to load Authifyer client", e);
|
|
2207
2220
|
} finally {
|
|
@@ -2211,7 +2224,7 @@ class On {
|
|
|
2211
2224
|
// --- Auth Actions ---
|
|
2212
2225
|
async signInWithEmail(e, r) {
|
|
2213
2226
|
try {
|
|
2214
|
-
const n = await
|
|
2227
|
+
const n = await q.post("/authifyer/project/login/email", {
|
|
2215
2228
|
email: e,
|
|
2216
2229
|
password: r,
|
|
2217
2230
|
publicProjectId: this.publishableKey
|
|
@@ -2224,7 +2237,7 @@ class On {
|
|
|
2224
2237
|
}
|
|
2225
2238
|
async signUpWithEmail(e, r) {
|
|
2226
2239
|
try {
|
|
2227
|
-
const n = await
|
|
2240
|
+
const n = await q.post("/authifyer/project/register/email", {
|
|
2228
2241
|
email: e,
|
|
2229
2242
|
password: r,
|
|
2230
2243
|
publicProjectId: this.publishableKey
|
|
@@ -2236,7 +2249,7 @@ class On {
|
|
|
2236
2249
|
}
|
|
2237
2250
|
async signOut() {
|
|
2238
2251
|
try {
|
|
2239
|
-
await
|
|
2252
|
+
await q.post("/authifyer/session/logout");
|
|
2240
2253
|
} catch (e) {
|
|
2241
2254
|
console.warn("Logout failed", e);
|
|
2242
2255
|
} finally {
|
|
@@ -2244,13 +2257,13 @@ class On {
|
|
|
2244
2257
|
}
|
|
2245
2258
|
}
|
|
2246
2259
|
signInWithOAuth(e) {
|
|
2247
|
-
const r = window.location.origin, n = `${
|
|
2260
|
+
const r = window.location.origin, n = `${q.defaults.baseURL}/oauth2/authorization/${e}?publishable_key=${this.publishableKey}&redirect_uri=${r}`;
|
|
2248
2261
|
window.location.href = n;
|
|
2249
2262
|
}
|
|
2250
2263
|
// --- Session Management ---
|
|
2251
2264
|
async refreshSession() {
|
|
2252
2265
|
try {
|
|
2253
|
-
const e = ft(), r = await
|
|
2266
|
+
const e = ft(), r = await q.post("/authifyer/jwt/refresh-jwt", {
|
|
2254
2267
|
refresh_token: e || void 0
|
|
2255
2268
|
}), { access_token: n, refresh_token: s } = r.data;
|
|
2256
2269
|
if (n) {
|
|
@@ -2270,7 +2283,7 @@ class On {
|
|
|
2270
2283
|
async rotateSession() {
|
|
2271
2284
|
try {
|
|
2272
2285
|
const e = ft();
|
|
2273
|
-
await
|
|
2286
|
+
await q.post("/authifyer/session/refresh", {
|
|
2274
2287
|
refresh_token: e || void 0
|
|
2275
2288
|
}), await this.refreshSession();
|
|
2276
2289
|
} catch (e) {
|
|
@@ -2281,7 +2294,7 @@ class On {
|
|
|
2281
2294
|
e.accessToken && this.setSession(e.accessToken), (e.refreshToken || e.refresh_token) && ke(e.refreshToken || e.refresh_token);
|
|
2282
2295
|
}
|
|
2283
2296
|
setSession(e) {
|
|
2284
|
-
const r =
|
|
2297
|
+
const r = On(e);
|
|
2285
2298
|
r && (this.session = r, ut(e), this.startRefreshTimer(), this.notifyListeners());
|
|
2286
2299
|
}
|
|
2287
2300
|
clearSession() {
|
|
@@ -2306,7 +2319,7 @@ class On {
|
|
|
2306
2319
|
this.listeners.forEach((e) => e(this));
|
|
2307
2320
|
}
|
|
2308
2321
|
}
|
|
2309
|
-
const Lt = Dt(void 0),
|
|
2322
|
+
const Lt = Dt(void 0), Yn = ({
|
|
2310
2323
|
publishableKey: t,
|
|
2311
2324
|
backendUrl: e,
|
|
2312
2325
|
config: r,
|
|
@@ -2320,7 +2333,7 @@ const Lt = Dt(void 0), Kn = ({
|
|
|
2320
2333
|
typeof process < "u" && process.env && (process.env.NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY || process.env.REACT_APP_AUTHIFYER_PUBLISHABLE_KEY)
|
|
2321
2334
|
), h = t || y;
|
|
2322
2335
|
h || console.error("AuthifyerProvider requires a publishableKey either passed as a prop or set as an environment variable (e.g. VITE_AUTHIFYER_PUBLISHABLE_KEY, NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY, REACT_APP_AUTHIFYER_PUBLISHABLE_KEY).");
|
|
2323
|
-
const S = new
|
|
2336
|
+
const S = new _n(h || "", { backendUrl: e });
|
|
2324
2337
|
return r && (S.config = r), S;
|
|
2325
2338
|
}, [t, e, r]), [o, i] = F(((f = s.session) == null ? void 0 : f.user) || null), [c, p] = F(s.session), [d, u] = F(s.config), [m, E] = F(s.isLoading);
|
|
2326
2339
|
Mt(() => {
|
|
@@ -2521,7 +2534,7 @@ const Lt = Dt(void 0), Kn = ({
|
|
|
2521
2534
|
] });
|
|
2522
2535
|
};
|
|
2523
2536
|
export {
|
|
2524
|
-
|
|
2537
|
+
Yn as AuthifyerProvider,
|
|
2525
2538
|
Zn as SignIn,
|
|
2526
2539
|
es as SignUp,
|
|
2527
2540
|
he as useAuth,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(N,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],S):(N=typeof globalThis<"u"?globalThis:N||self,S(N.AuthifyerSDK={},N.React))})(this,(function(N,S){"use strict";var Rn=Object.defineProperty;var Sn=(N,S,
|
|
1
|
+
(function(N,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],S):(N=typeof globalThis<"u"?globalThis:N||self,S(N.AuthifyerSDK={},N.React))})(this,(function(N,S){"use strict";var Rn=Object.defineProperty;var Sn=(N,S,q)=>S in N?Rn(N,S,{enumerable:!0,configurable:!0,writable:!0,value:q}):N[S]=q;var Q=(N,S,q)=>Sn(N,typeof S!="symbol"?S+"":S,q);var q={exports:{}},se={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ve;function
|
|
9
|
+
*/var Ve;function Ft(){if(Ve)return se;Ve=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:t,type:n,key:i,ref:s!==void 0?s:null,props:o}}return se.Fragment=e,se.jsx=r,se.jsxs=r,se}var oe={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var $e;function
|
|
17
|
+
*/var $e;function It(){return $e||($e=1,process.env.NODE_ENV!=="production"&&(function(){function t(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===xe?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case h:return"Fragment";case U:return"Profiler";case T:return"StrictMode";case z:return"Suspense";case F:return"SuspenseList";case _e:return"Activity"}if(typeof l=="object")switch(typeof l.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),l.$$typeof){case b:return"Portal";case v:return l.displayName||"Context";case x:return(l._context.displayName||"Context")+".Consumer";case I:var E=l.render;return l=l.displayName,l||(l=E.displayName||E.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case he:return E=l.displayName||null,E!==null?E:t(l.type)||"Memo";case J:E=l._payload,l=l._init;try{return t(l(E))}catch{}}return null}function e(l){return""+l}function r(l){try{e(l);var E=!1}catch{E=!0}if(E){E=console;var A=E.error,O=typeof Symbol=="function"&&Symbol.toStringTag&&l[Symbol.toStringTag]||l.constructor.name||"Object";return A.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",O),e(l)}}function n(l){if(l===h)return"<>";if(typeof l=="object"&&l!==null&&l.$$typeof===J)return"<...>";try{var E=t(l);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function s(){var l=V.A;return l===null?null:l.getOwner()}function o(){return Error("react-stack-top-frame")}function i(l){if($.call(l,"key")){var E=Object.getOwnPropertyDescriptor(l,"key").get;if(E&&E.isReactWarning)return!1}return l.key!==void 0}function c(l,E){function A(){P||(P=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",E))}A.isReactWarning=!0,Object.defineProperty(l,"key",{get:A,configurable:!0})}function p(){var l=t(this.type);return pe[l]||(pe[l]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),l=this.props.ref,l!==void 0?l:null}function d(l,E,A,O,G,We){var C=A.ref;return l={$$typeof:f,type:l,key:E,props:A,_owner:O},(C!==void 0?C:null)!==null?Object.defineProperty(l,"ref",{enumerable:!1,get:p}):Object.defineProperty(l,"ref",{enumerable:!1,value:null}),l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(l,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(l,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(l,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:We}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}function u(l,E,A,O,G,We){var C=E.children;if(C!==void 0)if(O)if(W(C)){for(O=0;O<C.length;O++)m(C[O]);Object.freeze&&Object.freeze(C)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(C);if($.call(E,"key")){C=t(l);var ne=Object.keys(E).filter(function(wn){return wn!=="key"});O=0<ne.length?"{key: someKey, "+ne.join(": ..., ")+": ...}":"{key: someKey}",Ne[C+O]||(ne=0<ne.length?"{"+ne.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,_,C,ne,C),Ne[C+_]=!0)}if(C=null,A!==void 0&&(r(A),C=""+A),i(w)&&(r(w.key),C=""+w.key),"key"in w){A={};for(var Je in w)Je!=="key"&&(A[Je]=w[Je])}else A=w;return C&&c(A,typeof l=="function"?l.displayName||l.name||"Unknown":l),d(l,C,A,s(),G,We)}function m(l){E(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===J&&(l._payload.status==="fulfilled"?E(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function E(l){return typeof l=="object"&&l!==null&&l.$$typeof===f}var R=S,f=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),v=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),xe=Symbol.for("react.activity"),Oe=Symbol.for("react.client.reference"),V=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,W=Array.isArray,re=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(l){return l()}};var P,pe={},M=R.react_stack_bottom_frame.bind(R,o)(),me=re(n(o)),Ne={};oe.Fragment=h,oe.jsx=function(l,w,A){var _=1e4>V.recentlyCreatedOwnerStacks++;return u(l,w,A,!1,_?Error("react-stack-top-frame"):M,_?re(n(l)):me)},oe.jsxs=function(l,w,A){var _=1e4>V.recentlyCreatedOwnerStacks++;return u(l,w,A,!0,_?Error("react-stack-top-frame"):M,_?re(n(l)):me)}})()),oe}var Ke;function Bt(){return Ke||(Ke=1,process.env.NODE_ENV==="production"?H.exports=It():H.exports=Ft()),H.exports}var y=Bt();function Ye(t,e){return function(){return t.apply(e,arguments)}}const{toString:Dt}=Object.prototype,{getPrototypeOf:Ce}=Object,{iterator:ye,toStringTag:Xe}=Symbol,be=(t=>e=>{const r=Dt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),D=t=>(t=t.toLowerCase(),e=>be(e)===t),ge=t=>e=>typeof e===t,{isArray:Z}=Array,ee=ge("undefined");function ie(t){return t!==null&&!ee(t)&&t.constructor!==null&&!ee(t.constructor)&&k(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ge=D("ArrayBuffer");function Mt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ge(t.buffer),e}const Ht=ge("string"),k=ge("function"),Qe=ge("number"),ae=t=>t!==null&&typeof t=="object",qt=t=>t===!0||t===!1,we=t=>{if(be(t)!=="object")return!1;const e=Ce(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Xe in t)&&!(ye in t)},zt=t=>{if(!ae(t)||ie(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Wt=D("Date"),Jt=D("File"),Vt=D("Blob"),$t=D("FileList"),Kt=t=>ae(t)&&k(t.pipe),Yt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||k(t.append)&&((e=be(t))==="formdata"||e==="object"&&k(t.toString)&&t.toString()==="[object FormData]"))},Xt=D("URLSearchParams"),[Gt,Qt,Zt,er]=["ReadableStream","Request","Response","Headers"].map(D),tr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ce(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),Z(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(ie(t))return;const o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let c;for(n=0;n<i;n++)c=o[n],e.call(null,t[c],c,t)}}function Ze(t,e){if(ie(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,et=t=>!ee(t)&&t!==K;function Pe(){const{caseless:t,skipUndefined:e}=et(this)&&this||{},r={},n=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&Ze(r,o)||o;we(r[i])&&we(s)?r[i]=Pe(r[i],s):we(s)?r[i]=Pe({},s):Z(s)?r[i]=s.slice():(!e||!ee(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ce(arguments[s],n);return r}const rr=(t,e,r,{allOwnKeys:n}={})=>(ce(e,(s,o)=>{r&&k(s)?Object.defineProperty(t,o,{value:Ye(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),nr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),sr=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},or=(t,e,r,n)=>{let s,o,i;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!n||n(i,t,e))&&!c[i]&&(e[i]=t[i],c[i]=!0);t=r!==!1&&Ce(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},ir=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},ar=t=>{if(!t)return null;if(Z(t))return t;let e=t.length;if(!Qe(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},cr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Ce(Uint8Array)),lr=(t,e)=>{const n=(t&&t[ye]).call(t);let s;for(;(s=n.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},ur=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},fr=D("HTMLFormElement"),dr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),tt=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),hr=D("RegExp"),rt=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ce(r,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(n[o]=i||s)}),Object.defineProperties(t,n)},pr=t=>{rt(t,(e,r)=>{if(k(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(k(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},mr=(t,e)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return Z(t)?n(t):n(String(t).split(e)),r},yr=()=>{},br=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function gr(t){return!!(t&&k(t.append)&&t[Xe]==="FormData"&&t[ye])}const wr=t=>{const e=new Array(10),r=(n,s)=>{if(ae(n)){if(e.indexOf(n)>=0)return;if(ie(n))return n;if(!("toJSON"in n)){e[s]=n;const o=Z(n)?[]:{};return ce(n,(i,c)=>{const p=r(i,s+1);!ee(p)&&(o[c]=p)}),e[s]=void 0,o}}return n};return r(t,0)},Er=D("AsyncFunction"),Rr=t=>t&&(ae(t)||k(t))&&k(t.then)&&k(t.catch),nt=((t,e)=>t?setImmediate:e?((r,n)=>(K.addEventListener("message",({source:s,data:o})=>{s===K&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),K.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",k(K.postMessage)),Sr=typeof queueMicrotask<"u"?queueMicrotask.bind(K):typeof process<"u"&&process.nextTick||nt,a={isArray:Z,isArrayBuffer:Ge,isBuffer:ie,isFormData:Yt,isArrayBufferView:Mt,isString:Ht,isNumber:Qe,isBoolean:qt,isObject:ae,isPlainObject:we,isEmptyObject:zt,isReadableStream:Gt,isRequest:Qt,isResponse:Zt,isHeaders:er,isUndefined:ee,isDate:Wt,isFile:Jt,isBlob:Vt,isRegExp:hr,isFunction:k,isStream:Kt,isURLSearchParams:Xt,isTypedArray:cr,isFileList:$t,forEach:ce,merge:Pe,extend:rr,trim:tr,stripBOM:nr,inherits:sr,toFlatObject:or,kindOf:be,kindOfTest:D,endsWith:ir,toArray:ar,forEachEntry:lr,matchAll:ur,isHTMLForm:fr,hasOwnProperty:tt,hasOwnProp:tt,reduceDescriptors:rt,freezeMethods:pr,toObjectSet:mr,toCamelCase:dr,noop:yr,toFiniteNumber:br,findKey:Ze,global:K,isContextDefined:et,isSpecCompliantForm:gr,toJSONObject:wr,isAsyncFn:Er,isThenable:Rr,setImmediate:nt,asap:Sr,isIterable:t=>t!=null&&k(t[ye])};let g=class Lt extends Error{static from(e,r,n,s,o,i){const c=new Lt(e.message,r||e.code,n,s,o);return c.cause=e,c.name=e.name,i&&Object.assign(c,i),c}constructor(e,r,n,s,o){super(e),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}};g.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",g.ERR_BAD_OPTION="ERR_BAD_OPTION",g.ECONNABORTED="ECONNABORTED",g.ETIMEDOUT="ETIMEDOUT",g.ERR_NETWORK="ERR_NETWORK",g.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",g.ERR_DEPRECATED="ERR_DEPRECATED",g.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",g.ERR_BAD_REQUEST="ERR_BAD_REQUEST",g.ERR_CANCELED="ERR_CANCELED",g.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",g.ERR_INVALID_URL="ERR_INVALID_URL";const Tr=null;function je(t){return a.isPlainObject(t)||a.isArray(t)}function st(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function ot(t,e,r){return t?t.concat(e).map(function(s,o){return s=st(s),!r&&o?"["+s+"]":s}).join(r?".":""):e}function Ar(t){return a.isArray(t)&&!t.some(je)}const _r=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function Ee(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,h){return!a.isUndefined(h[b])});const n=r.metaTokens,s=r.visitor||u,o=r.dots,i=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!p&&a.isBlob(f))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,b,h){let T=f;if(f&&!h&&typeof f=="object"){if(a.endsWith(b,"{}"))b=n?b:b.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Ar(f)||(a.isFileList(f)||a.endsWith(b,"[]"))&&(T=a.toArray(f)))return b=st(b),T.forEach(function(O,v){!(a.isUndefined(O)||O===null)&&e.append(i===!0?ot([b],v,o):i===null?b:b+"[]",d(O))}),!1}return je(f)?!0:(e.append(ot(h,b,o),d(f)),!1)}const m=[],E=Object.assign(_r,{defaultVisitor:u,convertValue:d,isVisitable:je});function R(f,b){if(!a.isUndefined(f)){if(m.indexOf(f)!==-1)throw Error("Circular reference detected in "+b.join("."));m.push(f),a.forEach(f,function(T,U){(!(a.isUndefined(T)||T===null)&&s.call(e,T,a.isString(U)?U.trim():U,b,E))===!0&&R(T,b?b.concat(U):[U])}),m.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return R(t),e}function it(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function ve(t,e){this._pairs=[],t&&Ee(t,this,e)}const at=ve.prototype;at.append=function(e,r){this._pairs.push([e,r])},at.toString=function(e){const r=e?function(n){return e.call(this,n,it)}:it;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function xr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ct(t,e,r){if(!e)return t;const n=r&&r.encode||xr,s=a.isFunction(r)?{serialize:r}:r,o=s&&s.serialize;let i;if(o?i=o(e,s):i=a.isURLSearchParams(e)?e.toString():new ve(e,s).toString(n),i){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class lt{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}}const ke={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Or={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ve,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Le=typeof window<"u"&&typeof document<"u",Ue=typeof navigator=="object"&&navigator||void 0,Nr=Le&&(!Ue||["ReactNative","NativeScript","NS"].indexOf(Ue.product)<0),Cr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pr=Le&&window.location.href||"http://localhost",j={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Le,hasStandardBrowserEnv:Nr,hasStandardBrowserWebWorkerEnv:Cr,navigator:Ue,origin:Pr},Symbol.toStringTag,{value:"Module"})),...Or};function jr(t,e){return Ee(t,new j.classes.URLSearchParams,{visitor:function(r,n,s,o){return j.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function vr(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function kr(t){const e={},r=Object.keys(t);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],e[o]=t[o];return e}function ut(t){function e(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),p=o>=r.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),e(r,n,s[i],o)&&a.isArray(s[i])&&(s[i]=kr(s[i])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){const r={};return a.forEachEntry(t,(n,s)=>{e(vr(n),s,r,0)}),r}return null}function Lr(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const le={transitional:ke,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=a.isObject(e);if(o&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(ut(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return jr(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return Ee(c?{"files[]":e}:e,p&&new p,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Lr(e)):e}],transformResponse:[function(e){const r=this.transitional||le.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:j.classes.FormData,Blob:j.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{le.headers[t]={}});const Ur=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ir=t=>{const e={};let r,n,s;return t&&t.split(`
|
|
23
|
-
`).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||e[r]&&Ur[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},ft=Symbol("internals");function ue(t){return t&&String(t).trim().toLowerCase()}function Re(t){return t===!1||t==null?t:a.isArray(t)?t.map(Re):String(t)}function
|
|
24
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[ft]=this[ft]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=ue(i);n[c]||(Mr(s,i),n[c]=!0)}return a.isArray(e)?e.forEach(o):o(e),this}};L.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(L.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),a.freezeMethods(L);function Fe(t,e){const r=this||le,n=e||r,s=L.from(n.headers);let o=n.data;return a.forEach(t,function(c){o=c.call(r,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function dt(t){return!!(t&&t.__CANCEL__)}let fe=class extends g{constructor(e,r,n){super(e??"canceled",g.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function ht(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Hr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function qr(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(p){const d=Date.now(),u=n[o];i||(i=d),r[s]=p,n[s]=d;let m=o,E=0;for(;m!==s;)E+=r[m++],m=m%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),d-i<e)return;const R=u&&d-u;return R?Math.round(E*1e3/R):void 0}}function zr(t,e){let r=0,n=1e3/e,s,o;const i=(d,u=Date.now())=>{r=u,s=null,o&&(clearTimeout(o),o=null),t(...d)};return[(...d)=>{const u=Date.now(),m=u-r;m>=n?i(d,u):(s=d,o||(o=setTimeout(()=>{o=null,i(s)},n-m)))},()=>s&&i(s)]}const Se=(t,e,r=3)=>{let n=0;const s=qr(50,250);return zr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,p=i-n,d=s(p),u=i<=c;n=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:p,rate:d||void 0,estimated:d&&c&&u?(c-i)/d:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(m)},r)},pt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},mt=t=>(...e)=>a.asap(()=>t(...e)),Wr=j.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,j.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,Jr=j.hasStandardBrowserEnv?{write(t,e,r,n,s,o,i){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Vr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function $r(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function yt(t,e,r){let n=!Vr(e);return t&&(n||r==!1)?$r(t,e):e}const bt=t=>t instanceof L?{...t}:t;function Y(t,e){e=e||{};const r={};function n(d,u,m,E){return a.isPlainObject(d)&&a.isPlainObject(u)?a.merge.call({caseless:E},d,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(d,u,m,E){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d,m,E)}else return n(d,u,m,E)}function o(d,u){if(!a.isUndefined(u))return n(void 0,u)}function i(d,u){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d)}else return n(void 0,u)}function c(d,u,m){if(m in e)return n(d,u);if(m in t)return n(void 0,d)}const p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(d,u,m)=>s(bt(d),bt(u),m,!0)};return a.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=a.hasOwnProp(p,u)?p[u]:s,E=m(t[u],e[u],u);a.isUndefined(E)&&m!==c||(r[u]=E)}),r}const gt=t=>{const e=Y({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=e;if(e.headers=i=L.from(i),e.url=ct(yt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const p=r.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([u,m])=>{d.includes(u.toLowerCase())&&i.set(u,m)})}}if(j.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&Wr(e.url))){const p=s&&o&&Jr.read(o);p&&i.set(s,p)}return e},Kr=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=gt(t);let o=s.data;const i=L.from(s.headers).normalize();let{responseType:c,onUploadProgress:p,onDownloadProgress:d}=s,u,m,E,R,f;function b(){R&&R(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function T(){if(!h)return;const O=L.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),F={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:O,config:t,request:h};ht(function(I){r(I),b()},function(I){n(I),b()},F),h=null}"onloadend"in h?h.onloadend=T:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(T)},h.onabort=function(){h&&(n(new g("Request aborted",g.ECONNABORTED,t,h)),h=null)},h.onerror=function(v){const F=v&&v.message?v.message:"Network Error",z=new g(F,g.ERR_NETWORK,t,h);z.event=v||null,n(z),h=null},h.ontimeout=function(){let v=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const F=s.transitional||ke;s.timeoutErrorMessage&&(v=s.timeoutErrorMessage),n(new g(v,F.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(v,F){h.setRequestHeader(F,v)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),d&&([E,f]=Se(d,!0),h.addEventListener("progress",E)),p&&h.upload&&([m,R]=Se(p),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(u=O=>{h&&(n(!O||O.type?new fe(null,t,h):O),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const U=Hr(s.url);if(U&&j.protocols.indexOf(U)===-1){n(new g("Unsupported protocol "+U+":",g.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Yr=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const o=function(d){if(!s){s=!0,c();const u=d instanceof Error?d:this.reason;n.abort(u instanceof g?u:new fe(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{i=null,o(new g(`timeout of ${e}ms exceeded`,g.ETIMEDOUT))},e);const c=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(o):d.removeEventListener("abort",o)}),t=null)};t.forEach(d=>d.addEventListener("abort",o));const{signal:p}=n;return p.unsubscribe=()=>a.asap(c),p}},Xr=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},Gr=async function*(t,e){for await(const r of Qr(t))yield*Xr(r,e)},Qr=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},wt=(t,e,r,n)=>{const s=Gr(t,e);let o=0,i,c=p=>{i||(i=!0,n&&n(p))};return new ReadableStream({async pull(p){try{const{done:d,value:u}=await s.next();if(d){c(),p.close();return}let m=u.byteLength;if(r){let E=o+=m;r(E)}p.enqueue(new Uint8Array(u))}catch(d){throw c(d),d}},cancel(p){return c(p),s.return()}},{highWaterMark:2})},Et=64*1024,{isFunction:Te}=a,Zr=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Rt,TextEncoder:St}=a.global,Tt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},en=t=>{t=a.merge.call({skipUndefined:!0},Zr,t);const{fetch:e,Request:r,Response:n}=t,s=e?Te(e):typeof fetch=="function",o=Te(r),i=Te(n);if(!s)return!1;const c=s&&Te(Rt),p=s&&(typeof St=="function"?(f=>b=>f.encode(b))(new St):async f=>new Uint8Array(await new r(f).arrayBuffer())),d=o&&c&&Tt(()=>{let f=!1;const b=new r(j.origin,{body:new Rt,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!b}),u=i&&c&&Tt(()=>a.isReadableStream(new n("").body)),m={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!m[f]&&(m[f]=(b,h)=>{let T=b&&b[f];if(T)return T.call(b);throw new g(`Response type '${f}' is not supported`,g.ERR_NOT_SUPPORT,h)})});const E=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new r(j.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await p(f)).byteLength},R=async(f,b)=>{const h=a.toFiniteNumber(f.getContentLength());return h??E(b)};return async f=>{let{url:b,method:h,data:T,signal:U,cancelToken:O,timeout:v,onDownloadProgress:F,onUploadProgress:z,responseType:I,headers:he,withCredentials:J="same-origin",fetchOptions:xe}=gt(f),Oe=e||fetch;I=I?(I+"").toLowerCase():"text";let V=Yr([U,O&&O.toAbortSignal()],v),$=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let re;try{if(z&&d&&h!=="get"&&h!=="head"&&(re=await R(he,T))!==0){let l=new r(b,{method:"POST",body:T,duplex:"half"}),w;if(a.isFormData(T)&&(w=l.headers.get("content-type"))&&he.setContentType(w),l.body){const[A,_]=pt(re,Se(mt(z)));T=wt(l.body,Et,A,_)}}a.isString(J)||(J=J?"include":"omit");const P=o&&"credentials"in r.prototype,pe={...xe,signal:V,method:h.toUpperCase(),headers:he.normalize().toJSON(),body:T,duplex:"half",credentials:P?J:void 0};$=o&&new r(b,pe);let M=await(o?Oe($,xe):Oe(b,pe));const me=u&&(I==="stream"||I==="response");if(u&&(F||me&&W)){const l={};["status","statusText","headers"].forEach(G=>{l[G]=M[G]});const w=a.toFiniteNumber(M.headers.get("content-length")),[A,_]=F&&pt(w,Se(mt(F),!0))||[];M=new n(wt(M.body,Et,A,()=>{_&&_(),W&&W()}),l)}I=I||"text";let Ne=await m[a.findKey(m,I)||"text"](M,f);return!me&&W&&W(),await new Promise((l,w)=>{ht(l,w,{data:Ne,headers:L.from(M.headers),status:M.status,statusText:M.statusText,config:f,request:$})})}catch(P){throw W&&W(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,$,P&&P.response),{cause:P.cause||P}):g.from(P,P&&P.code,f,$,P&&P.response)}}},tn=new Map,At=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:s}=e,o=[n,s,r];let i=o.length,c=i,p,d,u=tn;for(;c--;)p=o[c],d=u.get(p),d===void 0&&u.set(p,d=c?new Map:en(e)),u=d;return d};At();const Be={http:Tr,xhr:Kr,fetch:{get:At}};a.forEach(Be,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const _t=t=>`- ${t}`,rn=t=>a.isFunction(t)||t===null||t===!1;function nn(t,e){t=a.isArray(t)?t:[t];const{length:r}=t;let n,s;const o={};for(let i=0;i<r;i++){n=t[i];let c;if(s=n,!rn(n)&&(s=Be[(c=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
|
|
25
|
-
`+i.map(
|
|
26
|
-
`):" "+
|
|
27
|
-
`+o):n.stack=o}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Y(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&_e.assertOptions(n,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean),legacyInterceptorReqResOrdering:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:_e.assertOptions(s,{encode:B.function,serialize:B.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),_e.assertOptions(r,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),r.headers=L.concat(i,o);const c=[];let p=!0;this.interceptors.request.forEach(function(b){if(typeof b.runWhen=="function"&&b.runWhen(r)===!1)return;p=p&&b.synchronous;const h=r.transitional||ke;h&&h.legacyInterceptorReqResOrdering?c.unshift(b.fulfilled,b.rejected):c.push(b.fulfilled,b.rejected)});const d=[];this.interceptors.response.forEach(function(b){d.push(b.fulfilled,b.rejected)});let u,m=0,E;if(!p){const f=[Ot.bind(this),void 0];for(f.unshift(...c),f.push(...d),E=f.length,u=Promise.resolve(r);m<E;)u=u.then(f[m++],f[m++]);return u}E=c.length;let R=r;for(;m<E;){const f=c[m++],b=c[m++];try{R=f(R)}catch(h){b.call(this,h);break}}try{u=Ot.call(this,R)}catch(f){return Promise.reject(f)}for(m=0,E=d.length;m<E;)u=u.then(d[m++],d[m++]);return u}getUri(e){e=Y(this.defaults,e);const r=yt(e.baseURL,e.url,e.allowAbsoluteUrls);return ct(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){X.prototype[e]=function(r,n){return this.request(Y(n||{},{method:e,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function r(n){return function(o,i,c){return this.request(Y(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}X.prototype[e]=r(),X.prototype[e+"Form"]=r(!0)});let on=class Ut{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{n.subscribe(c),o=c}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},e(function(o,i,c){n.reason||(n.reason=new fe(o,i,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Ut(function(s){e=s}),cancel:e}}};function an(t){return function(r){return t.apply(null,r)}}function cn(t){return a.isObject(t)&&t.isAxiosError===!0}const Me={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Me).forEach(([t,e])=>{Me[e]=t});function Pt(t){const e=new X(t),r=Ye(X.prototype.request,e);return a.extend(r,X.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return Pt(Y(t,s))},r}const x=Pt(le);x.Axios=X,x.CanceledError=fe,x.CancelToken=on,x.isCancel=dt,x.VERSION=Nt,x.toFormData=Ee,x.AxiosError=g,x.Cancel=x.CanceledError,x.all=function(e){return Promise.all(e)},x.spread=an,x.isAxiosError=cn,x.mergeConfig=Y,x.AxiosHeaders=L,x.formToJSON=t=>ut(a.isHTMLForm(t)?new FormData(t):t),x.getAdapter=xt.getAdapter,x.HttpStatusCode=Me,x.default=x;const{Axios:Cn,AxiosError:Pn,CanceledError:jn,isCancel:vn,CancelToken:kn,VERSION:Ln,all:Un,Cancel:In,isAxiosError:Fn,spread:Bn,toFormData:Dn,AxiosHeaders:Mn,HttpStatusCode:Hn,formToJSON:qn,getAdapter:zn,mergeConfig:Wn}=x,q=x.create({baseURL:"https://api.authifyer.com",withCredentials:!0,headers:{"Content-Type":"application/json"}}),jt=t=>{t?q.defaults.headers.common.Authorization=`Bearer ${t}`:delete q.defaults.headers.common.Authorization},He="authifyer_refresh_token",qe=t=>{try{t?localStorage.setItem(He,t):localStorage.removeItem(He)}catch(e){console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",e),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error"))}},vt=()=>{try{return localStorage.getItem(He)}catch(t){return console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",t),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error")),null}};class de extends Error{}de.prototype.name="InvalidTokenError";function ln(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function un(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ln(e)}catch{return atob(e)}}function fn(t,e){if(typeof t!="string")throw new de("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new de(`Invalid token specified: missing part #${r+1}`);let s;try{s=un(n)}catch(o){throw new de(`Invalid token specified: invalid base64 for part #${r+1} (${o.message})`)}try{return JSON.parse(s)}catch(o){throw new de(`Invalid token specified: invalid json for part #${r+1} (${o.message})`)}}const dn=t=>{try{const e=fn(t),r=Date.now()/1e3;if(e.exp<r)return null;const n={authifyerId:e.sub,name:e.name,email:e.email,emailVerified:!1,isActive:!0,provider:"email"};return{token:t,sessionId:e.sid,expireAt:e.exp,user:n}}catch(e){return console.error("Invalid token",e),null}};class hn{constructor(e,r){Q(this,"publishableKey");Q(this,"refreshTimer",null);Q(this,"session",null);Q(this,"config",null);Q(this,"isLoading",!0);Q(this,"listeners",[]);this.publishableKey=e,r!=null&&r.backendUrl&&(q.defaults.baseURL=r.backendUrl)}async load(){try{this.isLoading=!0,this.notifyListeners(),await this.refreshSession()}catch(e){console.error("Failed to load Authifyer client",e)}finally{this.isLoading=!1,this.notifyListeners()}}async signInWithEmail(e,r){try{const n=await q.post("/authifyer/project/login/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signUpWithEmail(e,r){try{const n=await q.post("/authifyer/project/register/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signOut(){try{await q.post("/authifyer/session/logout")}catch(e){console.warn("Logout failed",e)}finally{this.clearSession()}}signInWithOAuth(e){const r=window.location.origin,n=`${q.defaults.baseURL}/oauth2/authorization/${e}?publishable_key=${this.publishableKey}&redirect_uri=${r}`;window.location.href=n}async refreshSession(){try{const e=vt(),r=await q.post("/authifyer/jwt/refresh-jwt",{refresh_token:e||void 0}),{access_token:n,refresh_token:s}=r.data;if(n){const o=n.accessToken||n;this.setSession(o)}s&&qe(s)}catch{this.clearSession()}}async rotateSession(){try{const e=vt();await q.post("/authifyer/session/refresh",{refresh_token:e||void 0}),await this.refreshSession()}catch(e){console.warn("Session rotation failed",e),this.clearSession()}}handleAuthResponse(e){e.accessToken&&this.setSession(e.accessToken),(e.refreshToken||e.refresh_token)&&qe(e.refreshToken||e.refresh_token)}setSession(e){const r=dn(e);r&&(this.session=r,jt(e),this.startRefreshTimer(),this.notifyListeners())}clearSession(){this.session=null,jt(null),qe(null),this.stopRefreshTimer(),this.notifyListeners()}startRefreshTimer(){this.stopRefreshTimer(),this.refreshTimer=setInterval(()=>{this.refreshSession()},270*1e3)}stopRefreshTimer(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null)}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(r=>r!==e)}}notifyListeners(){this.listeners.forEach(e=>e(this))}}const kt=S.createContext(void 0),pn=({publishableKey:t,backendUrl:e,config:r,children:n})=>{var f;const s=S.useMemo(()=>{const b=typeof process<"u"&&process.env&&(process.env.NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY||process.env.REACT_APP_AUTHIFYER_PUBLISHABLE_KEY),h=t||b;h||console.error("AuthifyerProvider requires a publishableKey either passed as a prop or set as an environment variable (e.g. VITE_AUTHIFYER_PUBLISHABLE_KEY, NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY, REACT_APP_AUTHIFYER_PUBLISHABLE_KEY).");const T=new hn(h||"",{backendUrl:e});return r&&(T.config=r),T},[t,e,r]),[o,i]=S.useState(((f=s.session)==null?void 0:f.user)||null),[c,p]=S.useState(s.session),[d,u]=S.useState(s.config),[m,E]=S.useState(s.isLoading);S.useEffect(()=>{const b=s.subscribe(h=>{var T;i(((T=h.session)==null?void 0:T.user)||null),p(h.session),r||u(h.config),E(h.isLoading)});return s.load(),()=>{b()}},[s,r]);const R={client:s,user:o,session:c,config:r||d,isLoading:m};return y.jsx(kt.Provider,{value:R,children:n})},te=()=>{const t=S.useContext(kt);if(t===void 0)throw new Error("useAuth must be used within an AuthifyerProvider");return t},mn=()=>{const{user:t,isLoading:e}=te();return{user:t,isLoading:e,isSignedIn:!!t}},yn=()=>{const{session:t,isLoading:e}=te();return{session:t,isLoading:e,isSignedIn:!!t}},bn=()=>{const{client:t}=te();return t},ze=({title:t,subtitle:e,children:r})=>y.jsx("div",{className:"authifyer-root",children:y.jsxs("div",{className:"authifyer-card",children:[y.jsxs("div",{className:"authifyer-card-header",children:[y.jsx("h2",{className:"authifyer-card-title",children:t}),e&&y.jsx("p",{className:"authifyer-card-subtitle",children:e})]}),y.jsx("div",{className:"authifyer-card-content",children:r}),y.jsxs("div",{className:"authifyer-footer",children:[y.jsx("span",{className:"authifyer-secured-text",children:"Secured by"}),y.jsxs("span",{className:"authifyer-brand",children:[y.jsx("svg",{className:"authifyer-logo-icon",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})}),"Authifyer"]})]})]})}),gn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),u=(e==null?void 0:e.emailPasswordEnabled)??!0,m=(e==null?void 0:e.oauthProviders)??["google","github"],E=async R=>{R.preventDefault(),d(!0),c("");try{await t.signInWithEmail(r,s)}catch{c("Invalid credentials")}finally{d(!1)}};return y.jsxs(ze,{title:"Sign in",subtitle:"to continue to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(m.includes("google")||m.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[m.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),m.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(m.includes("google")||m.includes("github"))&&u&&y.jsx("div",{className:"authifyer-divider",children:"or"}),u&&y.jsxs("form",{onSubmit:E,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:R=>n(R.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:R=>o(R.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing In...":"Continue"})]})]})},wn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),[u,m]=S.useState(!1),E=(e==null?void 0:e.emailPasswordEnabled)??!0,R=(e==null?void 0:e.oauthProviders)??["google","github"],f=async b=>{b.preventDefault(),d(!0),c("");try{await t.signUpWithEmail(r,s),m(!0)}catch{c("Registration failed. User might already exist.")}finally{d(!1)}};return u?y.jsx(ze,{title:"Welcome!",children:y.jsxs("div",{className:"authifyer-success",children:[y.jsx("svg",{className:"authifyer-success-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),y.jsxs("div",{children:[y.jsx("h3",{className:"authifyer-success-title",children:"Success"}),y.jsx("p",{className:"authifyer-success-text",children:"Registration completed. Please verify your email."})]})]})}):y.jsxs(ze,{title:"Create your account",subtitle:"Welcome to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(R.includes("google")||R.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[R.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),R.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(R.includes("google")||R.includes("github"))&&E&&y.jsx("div",{className:"authifyer-divider",children:"or"}),E&&y.jsxs("form",{onSubmit:f,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:b=>n(b.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:b=>o(b.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing Up...":"Continue"})]})]})};N.AuthifyerProvider=pn,N.SignIn=gn,N.SignUp=wn,N.useAuth=te,N.useAuthifyer=bn,N.useSession=yn,N.useUser=mn,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));
|
|
22
|
+
<%s key={someKey} {...props} />`,O,C,ne,C),Ne[C+O]=!0)}if(C=null,A!==void 0&&(r(A),C=""+A),i(E)&&(r(E.key),C=""+E.key),"key"in E){A={};for(var Je in E)Je!=="key"&&(A[Je]=E[Je])}else A=E;return C&&c(A,typeof l=="function"?l.displayName||l.name||"Unknown":l),d(l,C,A,s(),G,We)}function m(l){w(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===J&&(l._payload.status==="fulfilled"?w(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function w(l){return typeof l=="object"&&l!==null&&l.$$typeof===f}var R=S,f=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),v=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),_e=Symbol.for("react.activity"),xe=Symbol.for("react.client.reference"),V=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,W=Array.isArray,re=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(l){return l()}};var P,pe={},M=R.react_stack_bottom_frame.bind(R,o)(),me=re(n(o)),Ne={};oe.Fragment=h,oe.jsx=function(l,E,A){var O=1e4>V.recentlyCreatedOwnerStacks++;return u(l,E,A,!1,O?Error("react-stack-top-frame"):M,O?re(n(l)):me)},oe.jsxs=function(l,E,A){var O=1e4>V.recentlyCreatedOwnerStacks++;return u(l,E,A,!0,O?Error("react-stack-top-frame"):M,O?re(n(l)):me)}})()),oe}var Ke;function Bt(){return Ke||(Ke=1,process.env.NODE_ENV==="production"?q.exports=Ft():q.exports=It()),q.exports}var y=Bt();function Ye(t,e){return function(){return t.apply(e,arguments)}}const{toString:Dt}=Object.prototype,{getPrototypeOf:Ce}=Object,{iterator:ye,toStringTag:Xe}=Symbol,be=(t=>e=>{const r=Dt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),D=t=>(t=t.toLowerCase(),e=>be(e)===t),ge=t=>e=>typeof e===t,{isArray:Z}=Array,ee=ge("undefined");function ie(t){return t!==null&&!ee(t)&&t.constructor!==null&&!ee(t.constructor)&&k(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ge=D("ArrayBuffer");function Mt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ge(t.buffer),e}const Ht=ge("string"),k=ge("function"),Qe=ge("number"),ae=t=>t!==null&&typeof t=="object",qt=t=>t===!0||t===!1,Ee=t=>{if(be(t)!=="object")return!1;const e=Ce(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Xe in t)&&!(ye in t)},zt=t=>{if(!ae(t)||ie(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Wt=D("Date"),Jt=D("File"),Vt=D("Blob"),$t=D("FileList"),Kt=t=>ae(t)&&k(t.pipe),Yt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||k(t.append)&&((e=be(t))==="formdata"||e==="object"&&k(t.toString)&&t.toString()==="[object FormData]"))},Xt=D("URLSearchParams"),[Gt,Qt,Zt,er]=["ReadableStream","Request","Response","Headers"].map(D),tr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ce(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),Z(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(ie(t))return;const o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let c;for(n=0;n<i;n++)c=o[n],e.call(null,t[c],c,t)}}function Ze(t,e){if(ie(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,et=t=>!ee(t)&&t!==K;function Pe(){const{caseless:t,skipUndefined:e}=et(this)&&this||{},r={},n=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&Ze(r,o)||o;Ee(r[i])&&Ee(s)?r[i]=Pe(r[i],s):Ee(s)?r[i]=Pe({},s):Z(s)?r[i]=s.slice():(!e||!ee(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ce(arguments[s],n);return r}const rr=(t,e,r,{allOwnKeys:n}={})=>(ce(e,(s,o)=>{r&&k(s)?Object.defineProperty(t,o,{value:Ye(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),nr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),sr=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},or=(t,e,r,n)=>{let s,o,i;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!n||n(i,t,e))&&!c[i]&&(e[i]=t[i],c[i]=!0);t=r!==!1&&Ce(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},ir=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},ar=t=>{if(!t)return null;if(Z(t))return t;let e=t.length;if(!Qe(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},cr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Ce(Uint8Array)),lr=(t,e)=>{const n=(t&&t[ye]).call(t);let s;for(;(s=n.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},ur=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},fr=D("HTMLFormElement"),dr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),tt=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),hr=D("RegExp"),rt=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ce(r,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(n[o]=i||s)}),Object.defineProperties(t,n)},pr=t=>{rt(t,(e,r)=>{if(k(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(k(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},mr=(t,e)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return Z(t)?n(t):n(String(t).split(e)),r},yr=()=>{},br=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function gr(t){return!!(t&&k(t.append)&&t[Xe]==="FormData"&&t[ye])}const Er=t=>{const e=new Array(10),r=(n,s)=>{if(ae(n)){if(e.indexOf(n)>=0)return;if(ie(n))return n;if(!("toJSON"in n)){e[s]=n;const o=Z(n)?[]:{};return ce(n,(i,c)=>{const p=r(i,s+1);!ee(p)&&(o[c]=p)}),e[s]=void 0,o}}return n};return r(t,0)},wr=D("AsyncFunction"),Rr=t=>t&&(ae(t)||k(t))&&k(t.then)&&k(t.catch),nt=((t,e)=>t?setImmediate:e?((r,n)=>(K.addEventListener("message",({source:s,data:o})=>{s===K&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),K.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",k(K.postMessage)),Sr=typeof queueMicrotask<"u"?queueMicrotask.bind(K):typeof process<"u"&&process.nextTick||nt,a={isArray:Z,isArrayBuffer:Ge,isBuffer:ie,isFormData:Yt,isArrayBufferView:Mt,isString:Ht,isNumber:Qe,isBoolean:qt,isObject:ae,isPlainObject:Ee,isEmptyObject:zt,isReadableStream:Gt,isRequest:Qt,isResponse:Zt,isHeaders:er,isUndefined:ee,isDate:Wt,isFile:Jt,isBlob:Vt,isRegExp:hr,isFunction:k,isStream:Kt,isURLSearchParams:Xt,isTypedArray:cr,isFileList:$t,forEach:ce,merge:Pe,extend:rr,trim:tr,stripBOM:nr,inherits:sr,toFlatObject:or,kindOf:be,kindOfTest:D,endsWith:ir,toArray:ar,forEachEntry:lr,matchAll:ur,isHTMLForm:fr,hasOwnProperty:tt,hasOwnProp:tt,reduceDescriptors:rt,freezeMethods:pr,toObjectSet:mr,toCamelCase:dr,noop:yr,toFiniteNumber:br,findKey:Ze,global:K,isContextDefined:et,isSpecCompliantForm:gr,toJSONObject:Er,isAsyncFn:wr,isThenable:Rr,setImmediate:nt,asap:Sr,isIterable:t=>t!=null&&k(t[ye])};let g=class Lt extends Error{static from(e,r,n,s,o,i){const c=new Lt(e.message,r||e.code,n,s,o);return c.cause=e,c.name=e.name,i&&Object.assign(c,i),c}constructor(e,r,n,s,o){super(e),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}};g.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",g.ERR_BAD_OPTION="ERR_BAD_OPTION",g.ECONNABORTED="ECONNABORTED",g.ETIMEDOUT="ETIMEDOUT",g.ERR_NETWORK="ERR_NETWORK",g.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",g.ERR_DEPRECATED="ERR_DEPRECATED",g.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",g.ERR_BAD_REQUEST="ERR_BAD_REQUEST",g.ERR_CANCELED="ERR_CANCELED",g.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",g.ERR_INVALID_URL="ERR_INVALID_URL";const Tr=null;function je(t){return a.isPlainObject(t)||a.isArray(t)}function st(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function ot(t,e,r){return t?t.concat(e).map(function(s,o){return s=st(s),!r&&o?"["+s+"]":s}).join(r?".":""):e}function Ar(t){return a.isArray(t)&&!t.some(je)}const Or=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function we(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,h){return!a.isUndefined(h[b])});const n=r.metaTokens,s=r.visitor||u,o=r.dots,i=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!p&&a.isBlob(f))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,b,h){let T=f;if(f&&!h&&typeof f=="object"){if(a.endsWith(b,"{}"))b=n?b:b.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Ar(f)||(a.isFileList(f)||a.endsWith(b,"[]"))&&(T=a.toArray(f)))return b=st(b),T.forEach(function(x,v){!(a.isUndefined(x)||x===null)&&e.append(i===!0?ot([b],v,o):i===null?b:b+"[]",d(x))}),!1}return je(f)?!0:(e.append(ot(h,b,o),d(f)),!1)}const m=[],w=Object.assign(Or,{defaultVisitor:u,convertValue:d,isVisitable:je});function R(f,b){if(!a.isUndefined(f)){if(m.indexOf(f)!==-1)throw Error("Circular reference detected in "+b.join("."));m.push(f),a.forEach(f,function(T,U){(!(a.isUndefined(T)||T===null)&&s.call(e,T,a.isString(U)?U.trim():U,b,w))===!0&&R(T,b?b.concat(U):[U])}),m.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return R(t),e}function it(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function ve(t,e){this._pairs=[],t&&we(t,this,e)}const at=ve.prototype;at.append=function(e,r){this._pairs.push([e,r])},at.toString=function(e){const r=e?function(n){return e.call(this,n,it)}:it;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function _r(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ct(t,e,r){if(!e)return t;const n=r&&r.encode||_r,s=a.isFunction(r)?{serialize:r}:r,o=s&&s.serialize;let i;if(o?i=o(e,s):i=a.isURLSearchParams(e)?e.toString():new ve(e,s).toString(n),i){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class lt{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}}const ke={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},xr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ve,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Le=typeof window<"u"&&typeof document<"u",Ue=typeof navigator=="object"&&navigator||void 0,Nr=Le&&(!Ue||["ReactNative","NativeScript","NS"].indexOf(Ue.product)<0),Cr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pr=Le&&window.location.href||"http://localhost",j={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Le,hasStandardBrowserEnv:Nr,hasStandardBrowserWebWorkerEnv:Cr,navigator:Ue,origin:Pr},Symbol.toStringTag,{value:"Module"})),...xr};function jr(t,e){return we(t,new j.classes.URLSearchParams,{visitor:function(r,n,s,o){return j.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function vr(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function kr(t){const e={},r=Object.keys(t);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],e[o]=t[o];return e}function ut(t){function e(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),p=o>=r.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),e(r,n,s[i],o)&&a.isArray(s[i])&&(s[i]=kr(s[i])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){const r={};return a.forEachEntry(t,(n,s)=>{e(vr(n),s,r,0)}),r}return null}function Lr(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const le={transitional:ke,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=a.isObject(e);if(o&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(ut(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return jr(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return we(c?{"files[]":e}:e,p&&new p,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Lr(e)):e}],transformResponse:[function(e){const r=this.transitional||le.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:j.classes.FormData,Blob:j.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{le.headers[t]={}});const Ur=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Fr=t=>{const e={};let r,n,s;return t&&t.split(`
|
|
23
|
+
`).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||e[r]&&Ur[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},ft=Symbol("internals");function ue(t){return t&&String(t).trim().toLowerCase()}function Re(t){return t===!1||t==null?t:a.isArray(t)?t.map(Re):String(t)}function Ir(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const Br=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Fe(t,e,r,n,s){if(a.isFunction(n))return n.call(this,e,r);if(s&&(e=r),!!a.isString(e)){if(a.isString(n))return e.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(e)}}function Dr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Mr(t,e){const r=a.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(s,o,i){return this[n].call(this,e,s,o,i)},configurable:!0})})}let L=class{constructor(e){e&&this.set(e)}set(e,r,n){const s=this;function o(c,p,d){const u=ue(p);if(!u)throw new Error("header name must be a non-empty string");const m=a.findKey(s,u);(!m||s[m]===void 0||d===!0||d===void 0&&s[m]!==!1)&&(s[m||p]=Re(c))}const i=(c,p)=>a.forEach(c,(d,u)=>o(d,u,p));if(a.isPlainObject(e)||e instanceof this.constructor)i(e,r);else if(a.isString(e)&&(e=e.trim())&&!Br(e))i(Fr(e),r);else if(a.isObject(e)&&a.isIterable(e)){let c={},p,d;for(const u of e){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[d=u[0]]=(p=c[d])?a.isArray(p)?[...p,u[1]]:[p,u[1]]:u[1]}i(c,r)}else e!=null&&o(r,e,n);return this}get(e,r){if(e=ue(e),e){const n=a.findKey(this,e);if(n){const s=this[n];if(!r)return s;if(r===!0)return Ir(s);if(a.isFunction(r))return r.call(this,s,n);if(a.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ue(e),e){const n=a.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Fe(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let s=!1;function o(i){if(i=ue(i),i){const c=a.findKey(n,i);c&&(!r||Fe(n,n[c],c,r))&&(delete n[c],s=!0)}}return a.isArray(e)?e.forEach(o):o(e),s}clear(e){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const o=r[n];(!e||Fe(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){const r=this,n={};return a.forEach(this,(s,o)=>{const i=a.findKey(n,o);if(i){r[i]=Re(s),delete r[o];return}const c=e?Dr(o):String(o).trim();c!==o&&delete r[o],r[c]=Re(s),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return a.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=e&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
|
|
24
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[ft]=this[ft]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=ue(i);n[c]||(Mr(s,i),n[c]=!0)}return a.isArray(e)?e.forEach(o):o(e),this}};L.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(L.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),a.freezeMethods(L);function Ie(t,e){const r=this||le,n=e||r,s=L.from(n.headers);let o=n.data;return a.forEach(t,function(c){o=c.call(r,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function dt(t){return!!(t&&t.__CANCEL__)}let fe=class extends g{constructor(e,r,n){super(e??"canceled",g.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function ht(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Hr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function qr(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(p){const d=Date.now(),u=n[o];i||(i=d),r[s]=p,n[s]=d;let m=o,w=0;for(;m!==s;)w+=r[m++],m=m%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),d-i<e)return;const R=u&&d-u;return R?Math.round(w*1e3/R):void 0}}function zr(t,e){let r=0,n=1e3/e,s,o;const i=(d,u=Date.now())=>{r=u,s=null,o&&(clearTimeout(o),o=null),t(...d)};return[(...d)=>{const u=Date.now(),m=u-r;m>=n?i(d,u):(s=d,o||(o=setTimeout(()=>{o=null,i(s)},n-m)))},()=>s&&i(s)]}const Se=(t,e,r=3)=>{let n=0;const s=qr(50,250);return zr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,p=i-n,d=s(p),u=i<=c;n=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:p,rate:d||void 0,estimated:d&&c&&u?(c-i)/d:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(m)},r)},pt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},mt=t=>(...e)=>a.asap(()=>t(...e)),Wr=j.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,j.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,Jr=j.hasStandardBrowserEnv?{write(t,e,r,n,s,o,i){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Vr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function $r(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function yt(t,e,r){let n=!Vr(e);return t&&(n||r==!1)?$r(t,e):e}const bt=t=>t instanceof L?{...t}:t;function Y(t,e){e=e||{};const r={};function n(d,u,m,w){return a.isPlainObject(d)&&a.isPlainObject(u)?a.merge.call({caseless:w},d,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(d,u,m,w){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d,m,w)}else return n(d,u,m,w)}function o(d,u){if(!a.isUndefined(u))return n(void 0,u)}function i(d,u){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d)}else return n(void 0,u)}function c(d,u,m){if(m in e)return n(d,u);if(m in t)return n(void 0,d)}const p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(d,u,m)=>s(bt(d),bt(u),m,!0)};return a.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=a.hasOwnProp(p,u)?p[u]:s,w=m(t[u],e[u],u);a.isUndefined(w)&&m!==c||(r[u]=w)}),r}const gt=t=>{const e=Y({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=e;if(e.headers=i=L.from(i),e.url=ct(yt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const p=r.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([u,m])=>{d.includes(u.toLowerCase())&&i.set(u,m)})}}if(j.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&Wr(e.url))){const p=s&&o&&Jr.read(o);p&&i.set(s,p)}return e},Kr=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=gt(t);let o=s.data;const i=L.from(s.headers).normalize();let{responseType:c,onUploadProgress:p,onDownloadProgress:d}=s,u,m,w,R,f;function b(){R&&R(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function T(){if(!h)return;const x=L.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),I={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:x,config:t,request:h};ht(function(F){r(F),b()},function(F){n(F),b()},I),h=null}"onloadend"in h?h.onloadend=T:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(T)},h.onabort=function(){h&&(n(new g("Request aborted",g.ECONNABORTED,t,h)),h=null)},h.onerror=function(v){const I=v&&v.message?v.message:"Network Error",z=new g(I,g.ERR_NETWORK,t,h);z.event=v||null,n(z),h=null},h.ontimeout=function(){let v=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const I=s.transitional||ke;s.timeoutErrorMessage&&(v=s.timeoutErrorMessage),n(new g(v,I.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(v,I){h.setRequestHeader(I,v)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),d&&([w,f]=Se(d,!0),h.addEventListener("progress",w)),p&&h.upload&&([m,R]=Se(p),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(u=x=>{h&&(n(!x||x.type?new fe(null,t,h):x),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const U=Hr(s.url);if(U&&j.protocols.indexOf(U)===-1){n(new g("Unsupported protocol "+U+":",g.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Yr=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const o=function(d){if(!s){s=!0,c();const u=d instanceof Error?d:this.reason;n.abort(u instanceof g?u:new fe(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{i=null,o(new g(`timeout of ${e}ms exceeded`,g.ETIMEDOUT))},e);const c=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(o):d.removeEventListener("abort",o)}),t=null)};t.forEach(d=>d.addEventListener("abort",o));const{signal:p}=n;return p.unsubscribe=()=>a.asap(c),p}},Xr=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},Gr=async function*(t,e){for await(const r of Qr(t))yield*Xr(r,e)},Qr=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Et=(t,e,r,n)=>{const s=Gr(t,e);let o=0,i,c=p=>{i||(i=!0,n&&n(p))};return new ReadableStream({async pull(p){try{const{done:d,value:u}=await s.next();if(d){c(),p.close();return}let m=u.byteLength;if(r){let w=o+=m;r(w)}p.enqueue(new Uint8Array(u))}catch(d){throw c(d),d}},cancel(p){return c(p),s.return()}},{highWaterMark:2})},wt=64*1024,{isFunction:Te}=a,Zr=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Rt,TextEncoder:St}=a.global,Tt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},en=t=>{t=a.merge.call({skipUndefined:!0},Zr,t);const{fetch:e,Request:r,Response:n}=t,s=e?Te(e):typeof fetch=="function",o=Te(r),i=Te(n);if(!s)return!1;const c=s&&Te(Rt),p=s&&(typeof St=="function"?(f=>b=>f.encode(b))(new St):async f=>new Uint8Array(await new r(f).arrayBuffer())),d=o&&c&&Tt(()=>{let f=!1;const b=new r(j.origin,{body:new Rt,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!b}),u=i&&c&&Tt(()=>a.isReadableStream(new n("").body)),m={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!m[f]&&(m[f]=(b,h)=>{let T=b&&b[f];if(T)return T.call(b);throw new g(`Response type '${f}' is not supported`,g.ERR_NOT_SUPPORT,h)})});const w=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new r(j.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await p(f)).byteLength},R=async(f,b)=>{const h=a.toFiniteNumber(f.getContentLength());return h??w(b)};return async f=>{let{url:b,method:h,data:T,signal:U,cancelToken:x,timeout:v,onDownloadProgress:I,onUploadProgress:z,responseType:F,headers:he,withCredentials:J="same-origin",fetchOptions:_e}=gt(f),xe=e||fetch;F=F?(F+"").toLowerCase():"text";let V=Yr([U,x&&x.toAbortSignal()],v),$=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let re;try{if(z&&d&&h!=="get"&&h!=="head"&&(re=await R(he,T))!==0){let l=new r(b,{method:"POST",body:T,duplex:"half"}),E;if(a.isFormData(T)&&(E=l.headers.get("content-type"))&&he.setContentType(E),l.body){const[A,O]=pt(re,Se(mt(z)));T=Et(l.body,wt,A,O)}}a.isString(J)||(J=J?"include":"omit");const P=o&&"credentials"in r.prototype,pe={..._e,signal:V,method:h.toUpperCase(),headers:he.normalize().toJSON(),body:T,duplex:"half",credentials:P?J:void 0};$=o&&new r(b,pe);let M=await(o?xe($,_e):xe(b,pe));const me=u&&(F==="stream"||F==="response");if(u&&(I||me&&W)){const l={};["status","statusText","headers"].forEach(G=>{l[G]=M[G]});const E=a.toFiniteNumber(M.headers.get("content-length")),[A,O]=I&&pt(E,Se(mt(I),!0))||[];M=new n(Et(M.body,wt,A,()=>{O&&O(),W&&W()}),l)}F=F||"text";let Ne=await m[a.findKey(m,F)||"text"](M,f);return!me&&W&&W(),await new Promise((l,E)=>{ht(l,E,{data:Ne,headers:L.from(M.headers),status:M.status,statusText:M.statusText,config:f,request:$})})}catch(P){throw W&&W(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,$,P&&P.response),{cause:P.cause||P}):g.from(P,P&&P.code,f,$,P&&P.response)}}},tn=new Map,At=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:s}=e,o=[n,s,r];let i=o.length,c=i,p,d,u=tn;for(;c--;)p=o[c],d=u.get(p),d===void 0&&u.set(p,d=c?new Map:en(e)),u=d;return d};At();const Be={http:Tr,xhr:Kr,fetch:{get:At}};a.forEach(Be,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Ot=t=>`- ${t}`,rn=t=>a.isFunction(t)||t===null||t===!1;function nn(t,e){t=a.isArray(t)?t:[t];const{length:r}=t;let n,s;const o={};for(let i=0;i<r;i++){n=t[i];let c;if(s=n,!rn(n)&&(s=Be[(c=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
|
|
25
|
+
`+i.map(Ot).join(`
|
|
26
|
+
`):" "+Ot(i[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const _t={getAdapter:nn,adapters:Be};function De(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new fe(null,t)}function xt(t){return De(t),t.headers=L.from(t.headers),t.data=Ie.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),_t.getAdapter(t.adapter||le.adapter,t)(t).then(function(n){return De(t),n.data=Ie.call(t,t.transformResponse,n),n.headers=L.from(n.headers),n},function(n){return dt(n)||(De(t),n&&n.response&&(n.response.data=Ie.call(t,t.transformResponse,n.response),n.response.headers=L.from(n.response.headers))),Promise.reject(n)})}const Nt="1.13.5",Ae={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ae[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const Ct={};Ae.transitional=function(e,r,n){function s(o,i){return"[Axios v"+Nt+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,c)=>{if(e===!1)throw new g(s(i," has been removed"+(r?" in "+r:"")),g.ERR_DEPRECATED);return r&&!Ct[i]&&(Ct[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,i,c):!0}},Ae.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function sn(t,e,r){if(typeof t!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let s=n.length;for(;s-- >0;){const o=n[s],i=e[o];if(i){const c=t[o],p=c===void 0||i(c,o,t);if(p!==!0)throw new g("option "+o+" must be "+p,g.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new g("Unknown option "+o,g.ERR_BAD_OPTION)}}const Oe={assertOptions:sn,validators:Ae},B=Oe.validators;let X=class{constructor(e){this.defaults=e||{},this.interceptors={request:new lt,response:new lt}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
27
|
+
`+o):n.stack=o}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Y(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&Oe.assertOptions(n,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean),legacyInterceptorReqResOrdering:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:Oe.assertOptions(s,{encode:B.function,serialize:B.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Oe.assertOptions(r,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),r.headers=L.concat(i,o);const c=[];let p=!0;this.interceptors.request.forEach(function(b){if(typeof b.runWhen=="function"&&b.runWhen(r)===!1)return;p=p&&b.synchronous;const h=r.transitional||ke;h&&h.legacyInterceptorReqResOrdering?c.unshift(b.fulfilled,b.rejected):c.push(b.fulfilled,b.rejected)});const d=[];this.interceptors.response.forEach(function(b){d.push(b.fulfilled,b.rejected)});let u,m=0,w;if(!p){const f=[xt.bind(this),void 0];for(f.unshift(...c),f.push(...d),w=f.length,u=Promise.resolve(r);m<w;)u=u.then(f[m++],f[m++]);return u}w=c.length;let R=r;for(;m<w;){const f=c[m++],b=c[m++];try{R=f(R)}catch(h){b.call(this,h);break}}try{u=xt.call(this,R)}catch(f){return Promise.reject(f)}for(m=0,w=d.length;m<w;)u=u.then(d[m++],d[m++]);return u}getUri(e){e=Y(this.defaults,e);const r=yt(e.baseURL,e.url,e.allowAbsoluteUrls);return ct(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){X.prototype[e]=function(r,n){return this.request(Y(n||{},{method:e,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function r(n){return function(o,i,c){return this.request(Y(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}X.prototype[e]=r(),X.prototype[e+"Form"]=r(!0)});let on=class Ut{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{n.subscribe(c),o=c}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},e(function(o,i,c){n.reason||(n.reason=new fe(o,i,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Ut(function(s){e=s}),cancel:e}}};function an(t){return function(r){return t.apply(null,r)}}function cn(t){return a.isObject(t)&&t.isAxiosError===!0}const Me={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Me).forEach(([t,e])=>{Me[e]=t});function Pt(t){const e=new X(t),r=Ye(X.prototype.request,e);return a.extend(r,X.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return Pt(Y(t,s))},r}const _=Pt(le);_.Axios=X,_.CanceledError=fe,_.CancelToken=on,_.isCancel=dt,_.VERSION=Nt,_.toFormData=we,_.AxiosError=g,_.Cancel=_.CanceledError,_.all=function(e){return Promise.all(e)},_.spread=an,_.isAxiosError=cn,_.mergeConfig=Y,_.AxiosHeaders=L,_.formToJSON=t=>ut(a.isHTMLForm(t)?new FormData(t):t),_.getAdapter=_t.getAdapter,_.HttpStatusCode=Me,_.default=_;const{Axios:Cn,AxiosError:Pn,CanceledError:jn,isCancel:vn,CancelToken:kn,VERSION:Ln,all:Un,Cancel:Fn,isAxiosError:In,spread:Bn,toFormData:Dn,AxiosHeaders:Mn,HttpStatusCode:Hn,formToJSON:qn,getAdapter:zn,mergeConfig:Wn}=_,H=_.create({baseURL:"https://authifyer-backend.onrender.com",withCredentials:!0,headers:{"Content-Type":"application/json"}}),jt=t=>{t?H.defaults.headers.common.Authorization=`Bearer ${t}`:delete H.defaults.headers.common.Authorization},He="authifyer_refresh_token",qe=t=>{try{t?localStorage.setItem(He,t):localStorage.removeItem(He)}catch(e){console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",e),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error"))}},vt=()=>{try{return localStorage.getItem(He)}catch(t){return console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",t),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error")),null}};class de extends Error{}de.prototype.name="InvalidTokenError";function ln(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function un(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ln(e)}catch{return atob(e)}}function fn(t,e){if(typeof t!="string")throw new de("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new de(`Invalid token specified: missing part #${r+1}`);let s;try{s=un(n)}catch(o){throw new de(`Invalid token specified: invalid base64 for part #${r+1} (${o.message})`)}try{return JSON.parse(s)}catch(o){throw new de(`Invalid token specified: invalid json for part #${r+1} (${o.message})`)}}const dn=t=>{try{const e=fn(t),r=Date.now()/1e3;if(e.exp<r)return null;const n={authifyerId:e.sub,name:e.name,email:e.email,emailVerified:!1,isActive:!0,provider:"email"};return{token:t,sessionId:e.sid,expireAt:e.exp,user:n}}catch(e){return console.error("Invalid token",e),null}};class hn{constructor(e,r){Q(this,"publishableKey");Q(this,"refreshTimer",null);Q(this,"session",null);Q(this,"config",null);Q(this,"isLoading",!0);Q(this,"listeners",[]);this.publishableKey=e,r!=null&&r.backendUrl&&(H.defaults.baseURL=r.backendUrl)}async load(){try{this.isLoading=!0,this.notifyListeners();try{const r=(await H.get(`/public/config/${this.publishableKey}`)).data,n=[];r.isGoogleOauthEnabled&&n.push("google"),r.isGithubOauthEnabled&&n.push("github"),this.config={emailPasswordEnabled:r.isEmailPassEnabled,oauthProviders:n}}catch(e){console.warn("Authifyer: Failed to fetch public project configuration. Using default defaults.",e),this.config={emailPasswordEnabled:!0,oauthProviders:["google","github"]}}await this.refreshSession()}catch(e){console.error("Failed to load Authifyer client",e)}finally{this.isLoading=!1,this.notifyListeners()}}async signInWithEmail(e,r){try{const n=await H.post("/authifyer/project/login/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signUpWithEmail(e,r){try{const n=await H.post("/authifyer/project/register/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signOut(){try{await H.post("/authifyer/session/logout")}catch(e){console.warn("Logout failed",e)}finally{this.clearSession()}}signInWithOAuth(e){const r=window.location.origin,n=`${H.defaults.baseURL}/oauth2/authorization/${e}?publishable_key=${this.publishableKey}&redirect_uri=${r}`;window.location.href=n}async refreshSession(){try{const e=vt(),r=await H.post("/authifyer/jwt/refresh-jwt",{refresh_token:e||void 0}),{access_token:n,refresh_token:s}=r.data;if(n){const o=n.accessToken||n;this.setSession(o)}s&&qe(s)}catch{this.clearSession()}}async rotateSession(){try{const e=vt();await H.post("/authifyer/session/refresh",{refresh_token:e||void 0}),await this.refreshSession()}catch(e){console.warn("Session rotation failed",e),this.clearSession()}}handleAuthResponse(e){e.accessToken&&this.setSession(e.accessToken),(e.refreshToken||e.refresh_token)&&qe(e.refreshToken||e.refresh_token)}setSession(e){const r=dn(e);r&&(this.session=r,jt(e),this.startRefreshTimer(),this.notifyListeners())}clearSession(){this.session=null,jt(null),qe(null),this.stopRefreshTimer(),this.notifyListeners()}startRefreshTimer(){this.stopRefreshTimer(),this.refreshTimer=setInterval(()=>{this.refreshSession()},270*1e3)}stopRefreshTimer(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null)}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(r=>r!==e)}}notifyListeners(){this.listeners.forEach(e=>e(this))}}const kt=S.createContext(void 0),pn=({publishableKey:t,backendUrl:e,config:r,children:n})=>{var f;const s=S.useMemo(()=>{const b=typeof process<"u"&&process.env&&(process.env.NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY||process.env.REACT_APP_AUTHIFYER_PUBLISHABLE_KEY),h=t||b;h||console.error("AuthifyerProvider requires a publishableKey either passed as a prop or set as an environment variable (e.g. VITE_AUTHIFYER_PUBLISHABLE_KEY, NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY, REACT_APP_AUTHIFYER_PUBLISHABLE_KEY).");const T=new hn(h||"",{backendUrl:e});return r&&(T.config=r),T},[t,e,r]),[o,i]=S.useState(((f=s.session)==null?void 0:f.user)||null),[c,p]=S.useState(s.session),[d,u]=S.useState(s.config),[m,w]=S.useState(s.isLoading);S.useEffect(()=>{const b=s.subscribe(h=>{var T;i(((T=h.session)==null?void 0:T.user)||null),p(h.session),r||u(h.config),w(h.isLoading)});return s.load(),()=>{b()}},[s,r]);const R={client:s,user:o,session:c,config:r||d,isLoading:m};return y.jsx(kt.Provider,{value:R,children:n})},te=()=>{const t=S.useContext(kt);if(t===void 0)throw new Error("useAuth must be used within an AuthifyerProvider");return t},mn=()=>{const{user:t,isLoading:e}=te();return{user:t,isLoading:e,isSignedIn:!!t}},yn=()=>{const{session:t,isLoading:e}=te();return{session:t,isLoading:e,isSignedIn:!!t}},bn=()=>{const{client:t}=te();return t},ze=({title:t,subtitle:e,children:r})=>y.jsx("div",{className:"authifyer-root",children:y.jsxs("div",{className:"authifyer-card",children:[y.jsxs("div",{className:"authifyer-card-header",children:[y.jsx("h2",{className:"authifyer-card-title",children:t}),e&&y.jsx("p",{className:"authifyer-card-subtitle",children:e})]}),y.jsx("div",{className:"authifyer-card-content",children:r}),y.jsxs("div",{className:"authifyer-footer",children:[y.jsx("span",{className:"authifyer-secured-text",children:"Secured by"}),y.jsxs("span",{className:"authifyer-brand",children:[y.jsx("svg",{className:"authifyer-logo-icon",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})}),"Authifyer"]})]})]})}),gn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),u=(e==null?void 0:e.emailPasswordEnabled)??!0,m=(e==null?void 0:e.oauthProviders)??["google","github"],w=async R=>{R.preventDefault(),d(!0),c("");try{await t.signInWithEmail(r,s)}catch{c("Invalid credentials")}finally{d(!1)}};return y.jsxs(ze,{title:"Sign in",subtitle:"to continue to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(m.includes("google")||m.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[m.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),m.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(m.includes("google")||m.includes("github"))&&u&&y.jsx("div",{className:"authifyer-divider",children:"or"}),u&&y.jsxs("form",{onSubmit:w,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:R=>n(R.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:R=>o(R.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing In...":"Continue"})]})]})},En=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),[u,m]=S.useState(!1),w=(e==null?void 0:e.emailPasswordEnabled)??!0,R=(e==null?void 0:e.oauthProviders)??["google","github"],f=async b=>{b.preventDefault(),d(!0),c("");try{await t.signUpWithEmail(r,s),m(!0)}catch{c("Registration failed. User might already exist.")}finally{d(!1)}};return u?y.jsx(ze,{title:"Welcome!",children:y.jsxs("div",{className:"authifyer-success",children:[y.jsx("svg",{className:"authifyer-success-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),y.jsxs("div",{children:[y.jsx("h3",{className:"authifyer-success-title",children:"Success"}),y.jsx("p",{className:"authifyer-success-text",children:"Registration completed. Please verify your email."})]})]})}):y.jsxs(ze,{title:"Create your account",subtitle:"Welcome to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(R.includes("google")||R.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[R.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),R.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(R.includes("google")||R.includes("github"))&&w&&y.jsx("div",{className:"authifyer-divider",children:"or"}),w&&y.jsxs("form",{onSubmit:f,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:b=>n(b.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:b=>o(b.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing Up...":"Continue"})]})]})};N.AuthifyerProvider=pn,N.SignIn=gn,N.SignUp=En,N.useAuth=te,N.useAuthifyer=bn,N.useSession=yn,N.useUser=mn,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authifyer-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"main": "dist/authifyer-sdk.umd.js",
|
|
5
5
|
"module": "dist/authifyer-sdk.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
"@vitejs/plugin-react": "^4.7.0",
|
|
28
28
|
"vite": "^6.4.1"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|
package/src/core/api.ts
CHANGED
|
@@ -2,7 +2,7 @@ import axios from 'axios';
|
|
|
2
2
|
|
|
3
3
|
// Default to the production Authifyer backend.
|
|
4
4
|
// Developers can override this via AuthifyerProvider's backendUrl prop if they are self-hosting.
|
|
5
|
-
const BASE_URL = 'https://
|
|
5
|
+
const BASE_URL = 'https://authifyer-backend.onrender.com'; // Default production backend URL
|
|
6
6
|
|
|
7
7
|
export const api = axios.create({
|
|
8
8
|
baseURL: BASE_URL,
|
package/src/core/client.ts
CHANGED
|
@@ -27,28 +27,30 @@ export class AuthifyerClient {
|
|
|
27
27
|
this.notifyListeners();
|
|
28
28
|
|
|
29
29
|
// 1. Fetch Project Config
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
try {
|
|
31
|
+
const configResponse = await api.get(`/public/config/${this.publishableKey}`);
|
|
32
|
+
const data = configResponse.data;
|
|
33
|
+
const oauthProviders: ('google' | 'github')[] = [];
|
|
34
|
+
|
|
35
|
+
if (data.isGoogleOauthEnabled) oauthProviders.push('google');
|
|
36
|
+
if (data.isGithubOauthEnabled) oauthProviders.push('github');
|
|
37
|
+
|
|
38
|
+
this.config = {
|
|
39
|
+
emailPasswordEnabled: data.isEmailPassEnabled,
|
|
40
|
+
oauthProviders
|
|
41
|
+
};
|
|
42
|
+
} catch (configError) {
|
|
43
|
+
console.warn("Authifyer: Failed to fetch public project configuration. Using default defaults.", configError);
|
|
44
|
+
// Fallback config if endpoint fails or key is invalid at this stage
|
|
45
|
+
this.config = {
|
|
46
|
+
emailPasswordEnabled: true,
|
|
47
|
+
oauthProviders: ['google', 'github']
|
|
48
|
+
};
|
|
49
|
+
}
|
|
36
50
|
|
|
51
|
+
// 2. Refresh Session
|
|
37
52
|
await this.refreshSession();
|
|
38
53
|
|
|
39
|
-
// If we have a session, we can fetch project details?
|
|
40
|
-
// Or maybe we don't need full config yet, just the enabled providers.
|
|
41
|
-
// The requirement says "ui should change as per project settings".
|
|
42
|
-
// I might need to ask the user to add a public config endpoint or I can try to find one.
|
|
43
|
-
// Looking at `ProjectController`:
|
|
44
|
-
// `getProject(@AuthenticationPrincipal AuthPrincipal principal, @PathVariable String publicId)`
|
|
45
|
-
// This requires auth.
|
|
46
|
-
// I will implement a basic version and maybe we need to update the backend later.
|
|
47
|
-
// For now, I will hardcode enabled providers or try to get them from a public endpoint if it exists.
|
|
48
|
-
// Checks `SecurityConfig`: `/authifyer/global` is public? No, `serverApi` is limited.
|
|
49
|
-
|
|
50
|
-
// Workaround: I'll assume for now we just try to get the session.
|
|
51
|
-
|
|
52
54
|
} catch (error) {
|
|
53
55
|
console.error("Failed to load Authifyer client", error);
|
|
54
56
|
} finally {
|