@neuctra/authix 1.1.49 → 1.1.51
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/neuctra-authix.es.js +235 -231
- package/dist/neuctra-authix.umd.js +1 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.d.ts.map +1 -1
- package/package.json +2 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Le, { forwardRef as
|
|
2
|
-
function
|
|
1
|
+
import Le, { forwardRef as Dt, createElement as Xe, useState as P, useEffect as te, useRef as xt, createContext as fr } from "react";
|
|
2
|
+
function Nt(t, e) {
|
|
3
3
|
return function() {
|
|
4
4
|
return t.apply(e, arguments);
|
|
5
5
|
};
|
|
@@ -29,11 +29,11 @@ const gr = Me("string"), re = Me("function"), Ft = Me("number"), Te = (t) => t !
|
|
|
29
29
|
} catch {
|
|
30
30
|
return !1;
|
|
31
31
|
}
|
|
32
|
-
}, br = oe("Date"), wr = oe("File"), jr = oe("Blob"), vr = oe("FileList"), Sr = (t) => Te(t) && re(t.pipe),
|
|
32
|
+
}, br = oe("Date"), wr = oe("File"), jr = oe("Blob"), vr = oe("FileList"), Sr = (t) => Te(t) && re(t.pipe), Er = (t) => {
|
|
33
33
|
let e;
|
|
34
34
|
return t && (typeof FormData == "function" && t instanceof FormData || re(t.append) && ((e = qe(t)) === "formdata" || // detect form-data instance
|
|
35
35
|
e === "object" && re(t.toString) && t.toString() === "[object FormData]"));
|
|
36
|
-
},
|
|
36
|
+
}, kr = oe("URLSearchParams"), [Cr, Tr, Rr, Ir] = ["ReadableStream", "Request", "Response", "Headers"].map(oe), Pr = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
37
37
|
function Re(t, e, { allOwnKeys: r = !1 } = {}) {
|
|
38
38
|
if (t === null || typeof t > "u")
|
|
39
39
|
return;
|
|
@@ -72,7 +72,7 @@ function Ze() {
|
|
|
72
72
|
return r;
|
|
73
73
|
}
|
|
74
74
|
const Or = (t, e, r, { allOwnKeys: s } = {}) => (Re(e, (a, i) => {
|
|
75
|
-
r && re(a) ? t[i] =
|
|
75
|
+
r && re(a) ? t[i] = Nt(a, r) : t[i] = a;
|
|
76
76
|
}, { allOwnKeys: s }), t), Ar = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), zr = (t, e, r, s) => {
|
|
77
77
|
t.prototype = Object.create(e.prototype, s), t.prototype.constructor = t, Object.defineProperty(t, "super", {
|
|
78
78
|
value: e.prototype
|
|
@@ -91,7 +91,7 @@ const Or = (t, e, r, { allOwnKeys: s } = {}) => (Re(e, (a, i) => {
|
|
|
91
91
|
t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length;
|
|
92
92
|
const s = t.indexOf(e, r);
|
|
93
93
|
return s !== -1 && s === r;
|
|
94
|
-
},
|
|
94
|
+
}, Dr = (t) => {
|
|
95
95
|
if (!t) return null;
|
|
96
96
|
if (we(t)) return t;
|
|
97
97
|
let e = t.length;
|
|
@@ -100,7 +100,7 @@ const Or = (t, e, r, { allOwnKeys: s } = {}) => (Re(e, (a, i) => {
|
|
|
100
100
|
for (; e-- > 0; )
|
|
101
101
|
r[e] = t[e];
|
|
102
102
|
return r;
|
|
103
|
-
},
|
|
103
|
+
}, Nr = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && st(Uint8Array)), Ur = (t, e) => {
|
|
104
104
|
const s = (t && t[Fe]).call(t);
|
|
105
105
|
let a;
|
|
106
106
|
for (; (a = s.next()) && !a.done; ) {
|
|
@@ -181,7 +181,7 @@ const Kr = (t) => {
|
|
|
181
181
|
isArray: we,
|
|
182
182
|
isArrayBuffer: Lt,
|
|
183
183
|
isBuffer: Ce,
|
|
184
|
-
isFormData:
|
|
184
|
+
isFormData: Er,
|
|
185
185
|
isArrayBufferView: hr,
|
|
186
186
|
isString: gr,
|
|
187
187
|
isNumber: Ft,
|
|
@@ -200,8 +200,8 @@ const Kr = (t) => {
|
|
|
200
200
|
isRegExp: Mr,
|
|
201
201
|
isFunction: re,
|
|
202
202
|
isStream: Sr,
|
|
203
|
-
isURLSearchParams:
|
|
204
|
-
isTypedArray:
|
|
203
|
+
isURLSearchParams: kr,
|
|
204
|
+
isTypedArray: Nr,
|
|
205
205
|
isFileList: vr,
|
|
206
206
|
forEach: Re,
|
|
207
207
|
merge: Ze,
|
|
@@ -213,7 +213,7 @@ const Kr = (t) => {
|
|
|
213
213
|
kindOf: qe,
|
|
214
214
|
kindOfTest: oe,
|
|
215
215
|
endsWith: _r,
|
|
216
|
-
toArray:
|
|
216
|
+
toArray: Dr,
|
|
217
217
|
forEachEntry: Ur,
|
|
218
218
|
matchAll: Lr,
|
|
219
219
|
isHTMLForm: Fr,
|
|
@@ -856,7 +856,7 @@ function Sn(t, e) {
|
|
|
856
856
|
return w ? Math.round(b * 1e3 / w) : void 0;
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
|
-
function
|
|
859
|
+
function En(t, e) {
|
|
860
860
|
let r = 0, s = 1e3 / e, a, i;
|
|
861
861
|
const o = (d, c = Date.now()) => {
|
|
862
862
|
r = c, a = null, i && (clearTimeout(i), i = null), t(...d);
|
|
@@ -871,7 +871,7 @@ function kn(t, e) {
|
|
|
871
871
|
const Ue = (t, e, r = 3) => {
|
|
872
872
|
let s = 0;
|
|
873
873
|
const a = Sn(50, 250);
|
|
874
|
-
return
|
|
874
|
+
return En((i) => {
|
|
875
875
|
const o = i.loaded, l = i.lengthComputable ? i.total : void 0, h = o - s, d = a(h), c = o <= l;
|
|
876
876
|
s = o;
|
|
877
877
|
const y = {
|
|
@@ -894,7 +894,7 @@ const Ue = (t, e, r = 3) => {
|
|
|
894
894
|
total: t,
|
|
895
895
|
loaded: s
|
|
896
896
|
}), e[1]];
|
|
897
|
-
}, jt = (t) => (...e) => p.asap(() => t(...e)),
|
|
897
|
+
}, jt = (t) => (...e) => p.asap(() => t(...e)), kn = ee.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, ee.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))(
|
|
898
898
|
new URL(ee.origin),
|
|
899
899
|
ee.navigator && /(msie|trident)/i.test(ee.navigator.userAgent)
|
|
900
900
|
) : () => !0, Cn = ee.hasStandardBrowserEnv ? (
|
|
@@ -1015,7 +1015,7 @@ const tr = (t) => {
|
|
|
1015
1015
|
});
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
1018
|
-
if (ee.hasStandardBrowserEnv && (s && p.isFunction(s) && (s = s(e)), s || s !== !1 &&
|
|
1018
|
+
if (ee.hasStandardBrowserEnv && (s && p.isFunction(s) && (s = s(e)), s || s !== !1 && kn(e.url))) {
|
|
1019
1019
|
const h = a && i && Cn.read(i);
|
|
1020
1020
|
h && o.set(a, h);
|
|
1021
1021
|
}
|
|
@@ -1158,11 +1158,11 @@ const tr = (t) => {
|
|
|
1158
1158
|
}, {
|
|
1159
1159
|
highWaterMark: 2
|
|
1160
1160
|
});
|
|
1161
|
-
},
|
|
1161
|
+
}, Et = 64 * 1024, { isFunction: Oe } = p, _n = (({ Request: t, Response: e }) => ({
|
|
1162
1162
|
Request: t,
|
|
1163
1163
|
Response: e
|
|
1164
1164
|
}))(p.global), {
|
|
1165
|
-
ReadableStream:
|
|
1165
|
+
ReadableStream: kt,
|
|
1166
1166
|
TextEncoder: Ct
|
|
1167
1167
|
} = p.global, Tt = (t, ...e) => {
|
|
1168
1168
|
try {
|
|
@@ -1170,17 +1170,17 @@ const tr = (t) => {
|
|
|
1170
1170
|
} catch {
|
|
1171
1171
|
return !1;
|
|
1172
1172
|
}
|
|
1173
|
-
},
|
|
1173
|
+
}, Dn = (t) => {
|
|
1174
1174
|
t = p.merge.call({
|
|
1175
1175
|
skipUndefined: !0
|
|
1176
1176
|
}, _n, t);
|
|
1177
1177
|
const { fetch: e, Request: r, Response: s } = t, a = e ? Oe(e) : typeof fetch == "function", i = Oe(r), o = Oe(s);
|
|
1178
1178
|
if (!a)
|
|
1179
1179
|
return !1;
|
|
1180
|
-
const l = a && Oe(
|
|
1180
|
+
const l = a && Oe(kt), h = a && (typeof Ct == "function" ? /* @__PURE__ */ ((u) => (j) => u.encode(j))(new Ct()) : async (u) => new Uint8Array(await new r(u).arrayBuffer())), d = i && l && Tt(() => {
|
|
1181
1181
|
let u = !1;
|
|
1182
1182
|
const j = new r(ee.origin, {
|
|
1183
|
-
body: new
|
|
1183
|
+
body: new kt(),
|
|
1184
1184
|
method: "POST",
|
|
1185
1185
|
get duplex() {
|
|
1186
1186
|
return u = !0, "half";
|
|
@@ -1228,7 +1228,7 @@ const tr = (t) => {
|
|
|
1228
1228
|
onUploadProgress: g,
|
|
1229
1229
|
responseType: I,
|
|
1230
1230
|
headers: v,
|
|
1231
|
-
withCredentials:
|
|
1231
|
+
withCredentials: N = "same-origin",
|
|
1232
1232
|
fetchOptions: W
|
|
1233
1233
|
} = tr(u), F = e || fetch;
|
|
1234
1234
|
I = I ? (I + "").toLowerCase() : "text";
|
|
@@ -1245,14 +1245,14 @@ const tr = (t) => {
|
|
|
1245
1245
|
duplex: "half"
|
|
1246
1246
|
}), S;
|
|
1247
1247
|
if (p.isFormData($) && (S = f.headers.get("content-type")) && v.setContentType(S), f.body) {
|
|
1248
|
-
const [x,
|
|
1248
|
+
const [x, E] = wt(
|
|
1249
1249
|
J,
|
|
1250
1250
|
Ue(jt(g))
|
|
1251
1251
|
);
|
|
1252
|
-
$ = St(f.body,
|
|
1252
|
+
$ = St(f.body, Et, x, E);
|
|
1253
1253
|
}
|
|
1254
1254
|
}
|
|
1255
|
-
p.isString(
|
|
1255
|
+
p.isString(N) || (N = N ? "include" : "omit");
|
|
1256
1256
|
const A = i && "credentials" in r.prototype, O = {
|
|
1257
1257
|
...W,
|
|
1258
1258
|
signal: V,
|
|
@@ -1260,7 +1260,7 @@ const tr = (t) => {
|
|
|
1260
1260
|
headers: v.normalize().toJSON(),
|
|
1261
1261
|
body: $,
|
|
1262
1262
|
duplex: "half",
|
|
1263
|
-
credentials: A ?
|
|
1263
|
+
credentials: A ? N : void 0
|
|
1264
1264
|
};
|
|
1265
1265
|
Z = i && new r(j, O);
|
|
1266
1266
|
let K = await (i ? F(Z, W) : F(j, O));
|
|
@@ -1270,13 +1270,13 @@ const tr = (t) => {
|
|
|
1270
1270
|
["status", "statusText", "headers"].forEach((_) => {
|
|
1271
1271
|
f[_] = K[_];
|
|
1272
1272
|
});
|
|
1273
|
-
const S = p.toFiniteNumber(K.headers.get("content-length")), [x,
|
|
1273
|
+
const S = p.toFiniteNumber(K.headers.get("content-length")), [x, E] = q && wt(
|
|
1274
1274
|
S,
|
|
1275
1275
|
Ue(jt(q), !0)
|
|
1276
1276
|
) || [];
|
|
1277
1277
|
K = new s(
|
|
1278
|
-
St(K.body,
|
|
1279
|
-
|
|
1278
|
+
St(K.body, Et, x, () => {
|
|
1279
|
+
E && E(), T && T();
|
|
1280
1280
|
}),
|
|
1281
1281
|
f
|
|
1282
1282
|
);
|
|
@@ -1302,16 +1302,16 @@ const tr = (t) => {
|
|
|
1302
1302
|
) : L.from(A, A && A.code, u, Z);
|
|
1303
1303
|
}
|
|
1304
1304
|
};
|
|
1305
|
-
},
|
|
1305
|
+
}, Nn = /* @__PURE__ */ new Map(), rr = (t) => {
|
|
1306
1306
|
let e = t ? t.env : {};
|
|
1307
1307
|
const { fetch: r, Request: s, Response: a } = e, i = [
|
|
1308
1308
|
s,
|
|
1309
1309
|
a,
|
|
1310
1310
|
r
|
|
1311
1311
|
];
|
|
1312
|
-
let o = i.length, l = o, h, d, c =
|
|
1312
|
+
let o = i.length, l = o, h, d, c = Nn;
|
|
1313
1313
|
for (; l--; )
|
|
1314
|
-
h = i[l], d = c.get(h), d === void 0 && c.set(h, d = l ? /* @__PURE__ */ new Map() :
|
|
1314
|
+
h = i[l], d = c.get(h), d === void 0 && c.set(h, d = l ? /* @__PURE__ */ new Map() : Dn(e)), c = d;
|
|
1315
1315
|
return d;
|
|
1316
1316
|
};
|
|
1317
1317
|
rr();
|
|
@@ -1707,7 +1707,7 @@ Object.entries(rt).forEach(([t, e]) => {
|
|
|
1707
1707
|
rt[e] = t;
|
|
1708
1708
|
});
|
|
1709
1709
|
function or(t) {
|
|
1710
|
-
const e = new xe(t), r =
|
|
1710
|
+
const e = new xe(t), r = Nt(xe.prototype.request, e);
|
|
1711
1711
|
return p.extend(r, xe.prototype, e, { allOwnKeys: !0 }), p.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(a) {
|
|
1712
1712
|
return or(he(t, a));
|
|
1713
1713
|
}, r;
|
|
@@ -1785,22 +1785,29 @@ class pa {
|
|
|
1785
1785
|
if (!e) throw new Error("HTTP method is required");
|
|
1786
1786
|
if (!r) throw new Error("Request path is required");
|
|
1787
1787
|
try {
|
|
1788
|
-
const i =
|
|
1789
|
-
...this.appId ? { appId: this.appId } : {},
|
|
1790
|
-
...s || {}
|
|
1791
|
-
};
|
|
1788
|
+
const i = e.toUpperCase() === "GET";
|
|
1792
1789
|
return (await this.client.request({
|
|
1793
1790
|
url: r,
|
|
1794
1791
|
method: e,
|
|
1795
|
-
|
|
1792
|
+
...i ? { params: this.appId ? { appId: this.appId } : void 0 } : {
|
|
1793
|
+
data: {
|
|
1794
|
+
...this.appId ? { appId: this.appId } : {},
|
|
1795
|
+
...s || {}
|
|
1796
|
+
}
|
|
1797
|
+
},
|
|
1796
1798
|
headers: a
|
|
1797
1799
|
})).data;
|
|
1798
1800
|
} catch (i) {
|
|
1799
|
-
if (
|
|
1800
|
-
const o = i.response?.status
|
|
1801
|
-
throw
|
|
1801
|
+
if (i?.isAxiosError) {
|
|
1802
|
+
const o = i.response?.status, l = i.response?.data?.message || i.message || "Request failed";
|
|
1803
|
+
throw console.error("[Authix Axios Error]", {
|
|
1804
|
+
method: e,
|
|
1805
|
+
path: r,
|
|
1806
|
+
status: o,
|
|
1807
|
+
message: l
|
|
1808
|
+
}), new Error(l);
|
|
1802
1809
|
}
|
|
1803
|
-
throw
|
|
1810
|
+
throw console.error("[Authix Unexpected Error]", i), new Error("Unexpected SDK error");
|
|
1804
1811
|
}
|
|
1805
1812
|
}
|
|
1806
1813
|
// ================= USERS =================
|
|
@@ -1830,22 +1837,19 @@ class pa {
|
|
|
1830
1837
|
}
|
|
1831
1838
|
/**
|
|
1832
1839
|
* 🔐 Check current authentication session (cookie-based)
|
|
1833
|
-
* Relies on HTTP-only
|
|
1840
|
+
* Relies entirely on HTTP-only cookies
|
|
1834
1841
|
*/
|
|
1835
1842
|
async checkSession() {
|
|
1836
1843
|
if (typeof window > "u")
|
|
1837
|
-
return
|
|
1844
|
+
return { authenticated: !1 };
|
|
1838
1845
|
try {
|
|
1839
1846
|
const e = await this.request(
|
|
1840
1847
|
"GET",
|
|
1841
1848
|
"/users/session"
|
|
1842
1849
|
);
|
|
1843
|
-
return
|
|
1850
|
+
return typeof e?.authenticated != "boolean" ? (console.warn("[Authix] Invalid session response:", e), { authenticated: !1 }) : e;
|
|
1844
1851
|
} catch (e) {
|
|
1845
|
-
return console.error("[Authix]
|
|
1846
|
-
message: e?.message,
|
|
1847
|
-
error: e
|
|
1848
|
-
}), { authenticated: !1 };
|
|
1852
|
+
return console.error("[Authix] checkSession failed:", e.message), { authenticated: !1 };
|
|
1849
1853
|
}
|
|
1850
1854
|
}
|
|
1851
1855
|
/**
|
|
@@ -2202,7 +2206,7 @@ class pa {
|
|
|
2202
2206
|
))?.data;
|
|
2203
2207
|
}
|
|
2204
2208
|
}
|
|
2205
|
-
var Ae = { exports: {} },
|
|
2209
|
+
var Ae = { exports: {} }, Ee = {};
|
|
2206
2210
|
/**
|
|
2207
2211
|
* @license React
|
|
2208
2212
|
* react-jsx-runtime.production.js
|
|
@@ -2214,7 +2218,7 @@ var Ae = { exports: {} }, ke = {};
|
|
|
2214
2218
|
*/
|
|
2215
2219
|
var Ot;
|
|
2216
2220
|
function Wn() {
|
|
2217
|
-
if (Ot) return
|
|
2221
|
+
if (Ot) return Ee;
|
|
2218
2222
|
Ot = 1;
|
|
2219
2223
|
var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
|
|
2220
2224
|
function r(s, a, i) {
|
|
@@ -2232,9 +2236,9 @@ function Wn() {
|
|
|
2232
2236
|
props: i
|
|
2233
2237
|
};
|
|
2234
2238
|
}
|
|
2235
|
-
return
|
|
2239
|
+
return Ee.Fragment = e, Ee.jsx = r, Ee.jsxs = r, Ee;
|
|
2236
2240
|
}
|
|
2237
|
-
var
|
|
2241
|
+
var ke = {};
|
|
2238
2242
|
/**
|
|
2239
2243
|
* @license React
|
|
2240
2244
|
* react-jsx-runtime.development.js
|
|
@@ -2281,7 +2285,7 @@ function Bn() {
|
|
|
2281
2285
|
return f = f.displayName, f || (f = S.displayName || S.name || "", f = f !== "" ? "ForwardRef(" + f + ")" : "ForwardRef"), f;
|
|
2282
2286
|
case v:
|
|
2283
2287
|
return S = f.displayName || null, S !== null ? S : t(f.type) || "Memo";
|
|
2284
|
-
case
|
|
2288
|
+
case N:
|
|
2285
2289
|
S = f._payload, f = f._init;
|
|
2286
2290
|
try {
|
|
2287
2291
|
return t(f(S));
|
|
@@ -2302,17 +2306,17 @@ function Bn() {
|
|
|
2302
2306
|
}
|
|
2303
2307
|
if (S) {
|
|
2304
2308
|
S = console;
|
|
2305
|
-
var x = S.error,
|
|
2309
|
+
var x = S.error, E = typeof Symbol == "function" && Symbol.toStringTag && f[Symbol.toStringTag] || f.constructor.name || "Object";
|
|
2306
2310
|
return x.call(
|
|
2307
2311
|
S,
|
|
2308
2312
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
2309
|
-
|
|
2313
|
+
E
|
|
2310
2314
|
), e(f);
|
|
2311
2315
|
}
|
|
2312
2316
|
}
|
|
2313
2317
|
function s(f) {
|
|
2314
2318
|
if (f === m) return "<>";
|
|
2315
|
-
if (typeof f == "object" && f !== null && f.$$typeof ===
|
|
2319
|
+
if (typeof f == "object" && f !== null && f.$$typeof === N)
|
|
2316
2320
|
return "<...>";
|
|
2317
2321
|
try {
|
|
2318
2322
|
var S = t(f);
|
|
@@ -2353,14 +2357,14 @@ function Bn() {
|
|
|
2353
2357
|
"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."
|
|
2354
2358
|
)), f = this.props.ref, f !== void 0 ? f : null;
|
|
2355
2359
|
}
|
|
2356
|
-
function d(f, S, x,
|
|
2360
|
+
function d(f, S, x, E, _, D) {
|
|
2357
2361
|
var Y = x.ref;
|
|
2358
2362
|
return f = {
|
|
2359
2363
|
$$typeof: u,
|
|
2360
2364
|
type: f,
|
|
2361
2365
|
key: S,
|
|
2362
2366
|
props: x,
|
|
2363
|
-
_owner:
|
|
2367
|
+
_owner: E
|
|
2364
2368
|
}, (Y !== void 0 ? Y : null) !== null ? Object.defineProperty(f, "ref", {
|
|
2365
2369
|
enumerable: !1,
|
|
2366
2370
|
get: h
|
|
@@ -2383,16 +2387,16 @@ function Bn() {
|
|
|
2383
2387
|
configurable: !1,
|
|
2384
2388
|
enumerable: !1,
|
|
2385
2389
|
writable: !0,
|
|
2386
|
-
value:
|
|
2390
|
+
value: D
|
|
2387
2391
|
}), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
|
|
2388
2392
|
}
|
|
2389
|
-
function c(f, S, x,
|
|
2393
|
+
function c(f, S, x, E, _, D) {
|
|
2390
2394
|
var Y = S.children;
|
|
2391
2395
|
if (Y !== void 0)
|
|
2392
|
-
if (
|
|
2396
|
+
if (E)
|
|
2393
2397
|
if (T(Y)) {
|
|
2394
|
-
for (
|
|
2395
|
-
y(Y[
|
|
2398
|
+
for (E = 0; E < Y.length; E++)
|
|
2399
|
+
y(Y[E]);
|
|
2396
2400
|
Object.freeze && Object.freeze(Y);
|
|
2397
2401
|
} else
|
|
2398
2402
|
console.error(
|
|
@@ -2404,18 +2408,18 @@ function Bn() {
|
|
|
2404
2408
|
var se = Object.keys(S).filter(function(ve) {
|
|
2405
2409
|
return ve !== "key";
|
|
2406
2410
|
});
|
|
2407
|
-
|
|
2411
|
+
E = 0 < se.length ? "{key: someKey, " + se.join(": ..., ") + ": ...}" : "{key: someKey}", G[Y + E] || (se = 0 < se.length ? "{" + se.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
2408
2412
|
`A props object containing a "key" prop is being spread into JSX:
|
|
2409
2413
|
let props = %s;
|
|
2410
2414
|
<%s {...props} />
|
|
2411
2415
|
React keys must be passed directly to JSX without using spread:
|
|
2412
2416
|
let props = %s;
|
|
2413
2417
|
<%s key={someKey} {...props} />`,
|
|
2414
|
-
|
|
2418
|
+
E,
|
|
2415
2419
|
Y,
|
|
2416
2420
|
se,
|
|
2417
2421
|
Y
|
|
2418
|
-
), G[Y +
|
|
2422
|
+
), G[Y + E] = !0);
|
|
2419
2423
|
}
|
|
2420
2424
|
if (Y = null, x !== void 0 && (r(x), Y = "" + x), o(S) && (r(S.key), Y = "" + S.key), "key" in S) {
|
|
2421
2425
|
x = {};
|
|
@@ -2431,16 +2435,16 @@ React keys must be passed directly to JSX without using spread:
|
|
|
2431
2435
|
x,
|
|
2432
2436
|
a(),
|
|
2433
2437
|
_,
|
|
2434
|
-
|
|
2438
|
+
D
|
|
2435
2439
|
);
|
|
2436
2440
|
}
|
|
2437
2441
|
function y(f) {
|
|
2438
|
-
b(f) ? f._store && (f._store.validated = 1) : typeof f == "object" && f !== null && f.$$typeof ===
|
|
2442
|
+
b(f) ? f._store && (f._store.validated = 1) : typeof f == "object" && f !== null && f.$$typeof === N && (f._payload.status === "fulfilled" ? b(f._payload.value) && f._payload.value._store && (f._payload.value._store.validated = 1) : f._store && (f._store.validated = 1));
|
|
2439
2443
|
}
|
|
2440
2444
|
function b(f) {
|
|
2441
2445
|
return typeof f == "object" && f !== null && f.$$typeof === u;
|
|
2442
2446
|
}
|
|
2443
|
-
var w = Le, u = Symbol.for("react.transitional.element"), j = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), $ = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), C = Symbol.for("react.context"), q = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), I = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"),
|
|
2447
|
+
var w = Le, u = Symbol.for("react.transitional.element"), j = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), $ = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), C = Symbol.for("react.context"), q = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), I = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), W = Symbol.for("react.activity"), F = Symbol.for("react.client.reference"), V = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Z = Object.prototype.hasOwnProperty, T = Array.isArray, J = console.createTask ? console.createTask : function() {
|
|
2444
2448
|
return null;
|
|
2445
2449
|
};
|
|
2446
2450
|
w = {
|
|
@@ -2452,28 +2456,28 @@ React keys must be passed directly to JSX without using spread:
|
|
|
2452
2456
|
w,
|
|
2453
2457
|
i
|
|
2454
2458
|
)(), Q = J(s(i)), G = {};
|
|
2455
|
-
|
|
2456
|
-
var
|
|
2459
|
+
ke.Fragment = m, ke.jsx = function(f, S, x) {
|
|
2460
|
+
var E = 1e4 > V.recentlyCreatedOwnerStacks++;
|
|
2457
2461
|
return c(
|
|
2458
2462
|
f,
|
|
2459
2463
|
S,
|
|
2460
2464
|
x,
|
|
2461
2465
|
!1,
|
|
2462
|
-
|
|
2463
|
-
|
|
2466
|
+
E ? Error("react-stack-top-frame") : K,
|
|
2467
|
+
E ? J(s(f)) : Q
|
|
2464
2468
|
);
|
|
2465
|
-
},
|
|
2466
|
-
var
|
|
2469
|
+
}, ke.jsxs = function(f, S, x) {
|
|
2470
|
+
var E = 1e4 > V.recentlyCreatedOwnerStacks++;
|
|
2467
2471
|
return c(
|
|
2468
2472
|
f,
|
|
2469
2473
|
S,
|
|
2470
2474
|
x,
|
|
2471
2475
|
!0,
|
|
2472
|
-
|
|
2473
|
-
|
|
2476
|
+
E ? Error("react-stack-top-frame") : K,
|
|
2477
|
+
E ? J(s(f)) : Q
|
|
2474
2478
|
);
|
|
2475
2479
|
};
|
|
2476
|
-
})()),
|
|
2480
|
+
})()), ke;
|
|
2477
2481
|
}
|
|
2478
2482
|
var zt;
|
|
2479
2483
|
function Hn() {
|
|
@@ -2575,7 +2579,7 @@ var Gn = {
|
|
|
2575
2579
|
* This source code is licensed under the ISC license.
|
|
2576
2580
|
* See the LICENSE file in the root directory of this source tree.
|
|
2577
2581
|
*/
|
|
2578
|
-
const Xn =
|
|
2582
|
+
const Xn = Dt(
|
|
2579
2583
|
({
|
|
2580
2584
|
color: t = "currentColor",
|
|
2581
2585
|
size: e = 24,
|
|
@@ -2611,7 +2615,7 @@ const Xn = Nt(
|
|
|
2611
2615
|
* See the LICENSE file in the root directory of this source tree.
|
|
2612
2616
|
*/
|
|
2613
2617
|
const B = (t, e) => {
|
|
2614
|
-
const r =
|
|
2618
|
+
const r = Dt(
|
|
2615
2619
|
({ className: s, ...a }, i) => Xe(Xn, {
|
|
2616
2620
|
ref: i,
|
|
2617
2621
|
iconNode: e,
|
|
@@ -2875,14 +2879,14 @@ const Ss = [
|
|
|
2875
2879
|
}
|
|
2876
2880
|
],
|
|
2877
2881
|
["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }]
|
|
2878
|
-
],
|
|
2882
|
+
], Es = B("map-pin", Ss);
|
|
2879
2883
|
/**
|
|
2880
2884
|
* @license lucide-react v0.544.0 - ISC
|
|
2881
2885
|
*
|
|
2882
2886
|
* This source code is licensed under the ISC license.
|
|
2883
2887
|
* See the LICENSE file in the root directory of this source tree.
|
|
2884
2888
|
*/
|
|
2885
|
-
const
|
|
2889
|
+
const ks = [
|
|
2886
2890
|
["path", { d: "M13 21h8", key: "1jsn5i" }],
|
|
2887
2891
|
[
|
|
2888
2892
|
"path",
|
|
@@ -2891,7 +2895,7 @@ const Es = [
|
|
|
2891
2895
|
key: "1a8usu"
|
|
2892
2896
|
}
|
|
2893
2897
|
]
|
|
2894
|
-
], Cs = B("pen-line",
|
|
2898
|
+
], Cs = B("pen-line", ks);
|
|
2895
2899
|
/**
|
|
2896
2900
|
* @license lucide-react v0.544.0 - ISC
|
|
2897
2901
|
*
|
|
@@ -2983,14 +2987,14 @@ const _s = [
|
|
|
2983
2987
|
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
2984
2988
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
2985
2989
|
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
2986
|
-
],
|
|
2990
|
+
], De = B("trash-2", _s);
|
|
2987
2991
|
/**
|
|
2988
2992
|
* @license lucide-react v0.544.0 - ISC
|
|
2989
2993
|
*
|
|
2990
2994
|
* This source code is licensed under the ISC license.
|
|
2991
2995
|
* See the LICENSE file in the root directory of this source tree.
|
|
2992
2996
|
*/
|
|
2993
|
-
const
|
|
2997
|
+
const Ds = [
|
|
2994
2998
|
[
|
|
2995
2999
|
"path",
|
|
2996
3000
|
{
|
|
@@ -3000,19 +3004,19 @@ const Ns = [
|
|
|
3000
3004
|
],
|
|
3001
3005
|
["path", { d: "M12 9v4", key: "juzpu7" }],
|
|
3002
3006
|
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
3003
|
-
], _t = B("triangle-alert",
|
|
3007
|
+
], _t = B("triangle-alert", Ds);
|
|
3004
3008
|
/**
|
|
3005
3009
|
* @license lucide-react v0.544.0 - ISC
|
|
3006
3010
|
*
|
|
3007
3011
|
* This source code is licensed under the ISC license.
|
|
3008
3012
|
* See the LICENSE file in the root directory of this source tree.
|
|
3009
3013
|
*/
|
|
3010
|
-
const
|
|
3014
|
+
const Ns = [
|
|
3011
3015
|
["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
|
|
3012
3016
|
["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
|
|
3013
3017
|
["line", { x1: "17", x2: "22", y1: "8", y2: "13", key: "3nzzx3" }],
|
|
3014
3018
|
["line", { x1: "22", x2: "17", y1: "8", y2: "13", key: "1swrse" }]
|
|
3015
|
-
], Us = B("user-x",
|
|
3019
|
+
], Us = B("user-x", Ns);
|
|
3016
3020
|
/**
|
|
3017
3021
|
* @license lucide-react v0.544.0 - ISC
|
|
3018
3022
|
*
|
|
@@ -3032,15 +3036,15 @@ const Ls = [
|
|
|
3032
3036
|
const Fs = [
|
|
3033
3037
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
3034
3038
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
3035
|
-
], Pe = B("x", Fs),
|
|
3039
|
+
], Pe = B("x", Fs), Ne = {
|
|
3036
3040
|
baseUrl: "",
|
|
3037
3041
|
apiKey: "",
|
|
3038
3042
|
appId: ""
|
|
3039
3043
|
}, fa = (t) => {
|
|
3040
3044
|
if (!t.baseUrl || !t.apiKey || !t.appId)
|
|
3041
3045
|
throw new Error("baseUrl, apiKey, and appId are required");
|
|
3042
|
-
|
|
3043
|
-
}, ge = () =>
|
|
3046
|
+
Ne.baseUrl = t.baseUrl, Ne.apiKey = t.apiKey, Ne.appId = t.appId;
|
|
3047
|
+
}, ge = () => Ne, xa = ({
|
|
3044
3048
|
logoUrl: t,
|
|
3045
3049
|
logoLinkUrl: e,
|
|
3046
3050
|
title: r = "Create Your Account",
|
|
@@ -3065,7 +3069,7 @@ const Fs = [
|
|
|
3065
3069
|
password: "",
|
|
3066
3070
|
role: d.length ? d[0] : "user",
|
|
3067
3071
|
...h && { avatarUrl: "" }
|
|
3068
|
-
}, [R, z] = P($), [C, q] = P(!1), [g, I] = P(!1), [v,
|
|
3072
|
+
}, [R, z] = P($), [C, q] = P(!1), [g, I] = P(!1), [v, N] = P(null), [W, F] = P({}), [V, Z] = P(!1), T = l ? "#ffffff" : "#111827", J = l ? "#a1a1aa" : "#6b7280", A = l ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.02)", O = l ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)";
|
|
3069
3073
|
Le.useEffect(() => {
|
|
3070
3074
|
if (typeof window < "u") {
|
|
3071
3075
|
const S = () => Z(window.innerWidth < 768);
|
|
@@ -3073,23 +3077,23 @@ const Fs = [
|
|
|
3073
3077
|
}
|
|
3074
3078
|
}, []);
|
|
3075
3079
|
const K = (S) => {
|
|
3076
|
-
const { name: x, value:
|
|
3077
|
-
z((_) => ({ ..._, [x]:
|
|
3080
|
+
const { name: x, value: E } = S.target;
|
|
3081
|
+
z((_) => ({ ..._, [x]: E })), W[x] && F((_) => ({ ..._, [x]: void 0 }));
|
|
3078
3082
|
}, Q = () => {
|
|
3079
3083
|
const S = {};
|
|
3080
3084
|
return R.name.trim() || (S.name = "Name is required"), R.email.trim() ? /\S+@\S+\.\S+/.test(R.email) || (S.email = "Invalid email address") : S.email = "Email is required", R.password ? R.password.length < 6 && (S.password = "Password must be at least 6 characters") : S.password = "Password is required", F(S), Object.keys(S).length === 0;
|
|
3081
3085
|
}, G = async (S) => {
|
|
3082
3086
|
if (S.preventDefault(), !!Q()) {
|
|
3083
|
-
I(!0),
|
|
3087
|
+
I(!0), N(null);
|
|
3084
3088
|
try {
|
|
3085
3089
|
const x = {
|
|
3086
3090
|
...R,
|
|
3087
3091
|
appId: m
|
|
3088
|
-
},
|
|
3089
|
-
|
|
3092
|
+
}, E = await Vn(x, { baseUrl: u, apiKey: j });
|
|
3093
|
+
N({ type: "success", text: "Account created successfully!" }), b && b(E);
|
|
3090
3094
|
} catch (x) {
|
|
3091
|
-
const
|
|
3092
|
-
|
|
3095
|
+
const E = x.message || "Signup failed. Please try again.";
|
|
3096
|
+
N({ type: "error", text: E }), w && w(x);
|
|
3093
3097
|
} finally {
|
|
3094
3098
|
I(!1);
|
|
3095
3099
|
}
|
|
@@ -3700,7 +3704,7 @@ const Fs = [
|
|
|
3700
3704
|
onSuccess: d,
|
|
3701
3705
|
onError: c
|
|
3702
3706
|
}) => {
|
|
3703
|
-
const { baseUrl: y, apiKey: b, appId: w } = ge(), [u, j] = P("login"), [m, $] = P(1), [R, z] = P(!1), [C, q] = P(!1), [g, I] = P(null), [v,
|
|
3707
|
+
const { baseUrl: y, apiKey: b, appId: w } = ge(), [u, j] = P("login"), [m, $] = P(1), [R, z] = P(!1), [C, q] = P(!1), [g, I] = P(null), [v, N] = P(""), [W, F] = P(""), [V, Z] = P({
|
|
3704
3708
|
email: "",
|
|
3705
3709
|
otp: "",
|
|
3706
3710
|
newPassword: "",
|
|
@@ -3715,14 +3719,14 @@ const Fs = [
|
|
|
3715
3719
|
const G = async (_) => {
|
|
3716
3720
|
_.preventDefault(), q(!0), I(null);
|
|
3717
3721
|
try {
|
|
3718
|
-
const
|
|
3722
|
+
const D = await qs(
|
|
3719
3723
|
{ email: v, password: W, appId: w },
|
|
3720
3724
|
{ baseUrl: y, apiKey: b }
|
|
3721
3725
|
);
|
|
3722
|
-
I({ type: "success", text: `Welcome ${
|
|
3723
|
-
} catch (
|
|
3724
|
-
const Y =
|
|
3725
|
-
I({ type: "error", text: Y }), c?.(
|
|
3726
|
+
I({ type: "success", text: `Welcome ${D.name}` }), d?.(D);
|
|
3727
|
+
} catch (D) {
|
|
3728
|
+
const Y = D.message || "Login failed";
|
|
3729
|
+
I({ type: "error", text: Y }), c?.(D);
|
|
3726
3730
|
} finally {
|
|
3727
3731
|
q(!1);
|
|
3728
3732
|
}
|
|
@@ -3731,7 +3735,7 @@ const Fs = [
|
|
|
3731
3735
|
}, S = async (_) => {
|
|
3732
3736
|
_.preventDefault(), q(!0), I(null);
|
|
3733
3737
|
try {
|
|
3734
|
-
const
|
|
3738
|
+
const D = await M.post(
|
|
3735
3739
|
`${y}/users/forgot-password`,
|
|
3736
3740
|
{
|
|
3737
3741
|
email: V.email,
|
|
@@ -3739,14 +3743,14 @@ const Fs = [
|
|
|
3739
3743
|
},
|
|
3740
3744
|
{ headers: { "x-api-key": b } }
|
|
3741
3745
|
);
|
|
3742
|
-
|
|
3746
|
+
D.data.success ? ($(2), I({ type: "success", text: "OTP sent to your email" })) : I({
|
|
3743
3747
|
type: "error",
|
|
3744
|
-
text:
|
|
3748
|
+
text: D.data.message || "Failed to send OTP"
|
|
3745
3749
|
});
|
|
3746
|
-
} catch (
|
|
3750
|
+
} catch (D) {
|
|
3747
3751
|
I({
|
|
3748
3752
|
type: "error",
|
|
3749
|
-
text:
|
|
3753
|
+
text: D.response?.data?.message || "Something went wrong"
|
|
3750
3754
|
});
|
|
3751
3755
|
} finally {
|
|
3752
3756
|
q(!1);
|
|
@@ -3754,21 +3758,21 @@ const Fs = [
|
|
|
3754
3758
|
}, x = async (_) => {
|
|
3755
3759
|
_.preventDefault(), q(!0), I(null);
|
|
3756
3760
|
try {
|
|
3757
|
-
const
|
|
3761
|
+
const D = await M.post(
|
|
3758
3762
|
`${y}/users/reset-password`,
|
|
3759
3763
|
V,
|
|
3760
3764
|
{ headers: { "x-api-key": b } }
|
|
3761
3765
|
);
|
|
3762
|
-
|
|
3763
|
-
} catch (
|
|
3766
|
+
D.data.success ? (I({ type: "success", text: "Password reset successfully!" }), $(1), Z({ email: "", otp: "", newPassword: "", appId: w }), j("login")) : I({ type: "error", text: D.data.message || "Reset failed" });
|
|
3767
|
+
} catch (D) {
|
|
3764
3768
|
I({
|
|
3765
3769
|
type: "error",
|
|
3766
|
-
text:
|
|
3770
|
+
text: D.response?.data?.message || "Something went wrong"
|
|
3767
3771
|
});
|
|
3768
3772
|
} finally {
|
|
3769
3773
|
q(!1);
|
|
3770
3774
|
}
|
|
3771
|
-
},
|
|
3775
|
+
}, E = {
|
|
3772
3776
|
width: "100%",
|
|
3773
3777
|
padding: T ? "10px 14px 10px 44px" : "10px 16px 10px 44px",
|
|
3774
3778
|
backgroundColor: K,
|
|
@@ -3904,8 +3908,8 @@ const Fs = [
|
|
|
3904
3908
|
type: "email",
|
|
3905
3909
|
placeholder: "Enter your email",
|
|
3906
3910
|
value: v,
|
|
3907
|
-
onChange: (_) =>
|
|
3908
|
-
style:
|
|
3911
|
+
onChange: (_) => N(_.target.value),
|
|
3912
|
+
style: E
|
|
3909
3913
|
}
|
|
3910
3914
|
)
|
|
3911
3915
|
] })
|
|
@@ -3951,7 +3955,7 @@ const Fs = [
|
|
|
3951
3955
|
placeholder: "Enter your password",
|
|
3952
3956
|
value: W,
|
|
3953
3957
|
onChange: (_) => F(_.target.value),
|
|
3954
|
-
style:
|
|
3958
|
+
style: E
|
|
3955
3959
|
}
|
|
3956
3960
|
),
|
|
3957
3961
|
/* @__PURE__ */ n.jsx(
|
|
@@ -4082,7 +4086,7 @@ const Fs = [
|
|
|
4082
4086
|
placeholder: "Enter your email",
|
|
4083
4087
|
value: V.email,
|
|
4084
4088
|
onChange: f,
|
|
4085
|
-
style:
|
|
4089
|
+
style: E
|
|
4086
4090
|
}
|
|
4087
4091
|
)
|
|
4088
4092
|
] })
|
|
@@ -4133,7 +4137,7 @@ const Fs = [
|
|
|
4133
4137
|
placeholder: "Enter OTP",
|
|
4134
4138
|
value: V.otp,
|
|
4135
4139
|
onChange: f,
|
|
4136
|
-
style:
|
|
4140
|
+
style: E
|
|
4137
4141
|
}
|
|
4138
4142
|
)
|
|
4139
4143
|
] })
|
|
@@ -4184,7 +4188,7 @@ const Fs = [
|
|
|
4184
4188
|
placeholder: "Enter new password",
|
|
4185
4189
|
value: V.newPassword,
|
|
4186
4190
|
onChange: f,
|
|
4187
|
-
style:
|
|
4191
|
+
style: E
|
|
4188
4192
|
}
|
|
4189
4193
|
)
|
|
4190
4194
|
] })
|
|
@@ -4418,7 +4422,7 @@ const Fs = [
|
|
|
4418
4422
|
color: "white",
|
|
4419
4423
|
flexShrink: 0
|
|
4420
4424
|
},
|
|
4421
|
-
children: /* @__PURE__ */ n.jsx(
|
|
4425
|
+
children: /* @__PURE__ */ n.jsx(De, { size: 20 })
|
|
4422
4426
|
}
|
|
4423
4427
|
),
|
|
4424
4428
|
/* @__PURE__ */ n.jsx("div", { children: /* @__PURE__ */ n.jsx(
|
|
@@ -4617,7 +4621,7 @@ const Fs = [
|
|
|
4617
4621
|
g.currentTarget.style.transform = "translateY(0)", g.currentTarget.style.boxShadow = "0 4px 12px rgba(239, 68, 68, 0.4)";
|
|
4618
4622
|
},
|
|
4619
4623
|
children: [
|
|
4620
|
-
/* @__PURE__ */ n.jsx(
|
|
4624
|
+
/* @__PURE__ */ n.jsx(De, { size: 16 }),
|
|
4621
4625
|
"Continue to Delete"
|
|
4622
4626
|
]
|
|
4623
4627
|
}
|
|
@@ -4807,7 +4811,7 @@ const Fs = [
|
|
|
4807
4811
|
z && !c && (g.currentTarget.style.transform = "translateY(0)", g.currentTarget.style.boxShadow = "0 4px 12px rgba(239, 68, 68, 0.4)");
|
|
4808
4812
|
},
|
|
4809
4813
|
children: [
|
|
4810
|
-
/* @__PURE__ */ n.jsx(
|
|
4814
|
+
/* @__PURE__ */ n.jsx(De, { size: 16 }),
|
|
4811
4815
|
"Yes, Delete My Account"
|
|
4812
4816
|
]
|
|
4813
4817
|
}
|
|
@@ -5675,10 +5679,10 @@ const Fs = [
|
|
|
5675
5679
|
return v(), window.addEventListener("resize", v), () => window.removeEventListener("resize", v);
|
|
5676
5680
|
}, []), !t) return null;
|
|
5677
5681
|
const z = (v) => {
|
|
5678
|
-
const { name:
|
|
5679
|
-
c((F) => ({ ...F, [
|
|
5682
|
+
const { name: N, value: W } = v.target;
|
|
5683
|
+
c((F) => ({ ...F, [N]: W })), y[N] && b((F) => ({ ...F, [N]: "" }));
|
|
5680
5684
|
}, C = (v) => {
|
|
5681
|
-
m((
|
|
5685
|
+
m((N) => ({ ...N, [v]: !N[v] }));
|
|
5682
5686
|
}, q = () => {
|
|
5683
5687
|
const v = {};
|
|
5684
5688
|
return d.currentPassword || (v.currentPassword = "Current password is required"), d.newPassword ? d.newPassword.length < 6 && (v.newPassword = "Password must be at least 6 characters") : v.newPassword = "New password is required", d.newPassword !== d.confirmPassword && (v.confirmPassword = "Passwords do not match"), b(v), Object.keys(v).length === 0;
|
|
@@ -5686,7 +5690,7 @@ const Fs = [
|
|
|
5686
5690
|
if (v.preventDefault(), !!q()) {
|
|
5687
5691
|
u(!0);
|
|
5688
5692
|
try {
|
|
5689
|
-
const { data:
|
|
5693
|
+
const { data: N } = await M.put(
|
|
5690
5694
|
`${o}/users/change-password/${a}`,
|
|
5691
5695
|
{
|
|
5692
5696
|
appId: h,
|
|
@@ -5699,13 +5703,13 @@ const Fs = [
|
|
|
5699
5703
|
}
|
|
5700
5704
|
}
|
|
5701
5705
|
);
|
|
5702
|
-
|
|
5706
|
+
N.success ? (r(N.message || "Password updated successfully"), c({
|
|
5703
5707
|
currentPassword: "",
|
|
5704
5708
|
newPassword: "",
|
|
5705
5709
|
confirmPassword: ""
|
|
5706
|
-
}), e()) : s(
|
|
5707
|
-
} catch (
|
|
5708
|
-
s(
|
|
5710
|
+
}), e()) : s(N.message || "Failed to update password");
|
|
5711
|
+
} catch (N) {
|
|
5712
|
+
s(N.response?.data?.message || "Something went wrong");
|
|
5709
5713
|
} finally {
|
|
5710
5714
|
u(!1);
|
|
5711
5715
|
}
|
|
@@ -5843,7 +5847,7 @@ const Fs = [
|
|
|
5843
5847
|
}
|
|
5844
5848
|
),
|
|
5845
5849
|
/* @__PURE__ */ n.jsxs("form", { onSubmit: g, children: [
|
|
5846
|
-
I.map(({ field: v, label:
|
|
5850
|
+
I.map(({ field: v, label: N, icon: W }) => /* @__PURE__ */ n.jsxs(
|
|
5847
5851
|
"div",
|
|
5848
5852
|
{
|
|
5849
5853
|
style: {
|
|
@@ -5863,7 +5867,7 @@ const Fs = [
|
|
|
5863
5867
|
fontWeight: 500,
|
|
5864
5868
|
lineHeight: "1.4"
|
|
5865
5869
|
},
|
|
5866
|
-
children:
|
|
5870
|
+
children: N
|
|
5867
5871
|
}
|
|
5868
5872
|
),
|
|
5869
5873
|
/* @__PURE__ */ n.jsxs("div", { style: { position: "relative" }, children: [
|
|
@@ -5887,7 +5891,7 @@ const Fs = [
|
|
|
5887
5891
|
type: j[v] ? "text" : "password",
|
|
5888
5892
|
id: v,
|
|
5889
5893
|
name: v,
|
|
5890
|
-
placeholder: `Enter ${
|
|
5894
|
+
placeholder: `Enter ${N.toLowerCase()}`,
|
|
5891
5895
|
value: d[v],
|
|
5892
5896
|
onChange: z,
|
|
5893
5897
|
style: {
|
|
@@ -6387,58 +6391,58 @@ const Fs = [
|
|
|
6387
6391
|
onVerify: i,
|
|
6388
6392
|
primaryColor: o = "#00C212"
|
|
6389
6393
|
}) => {
|
|
6390
|
-
const { baseUrl: l, apiKey: h, appId: d } = ge(), [c, y] = P(null), [b, w] = P(e), [u, j] = P(!0), [m, $] = P(!1), [R, z] = P(!1), [C, q] = P(!1), [g, I] = P(!1), [v,
|
|
6394
|
+
const { baseUrl: l, apiKey: h, appId: d } = ge(), [c, y] = P(null), [b, w] = P(e), [u, j] = P(!0), [m, $] = P(!1), [R, z] = P(!1), [C, q] = P(!1), [g, I] = P(!1), [v, N] = P(!1), [W, F] = P(!1), [V, Z] = P(!1), [T, J] = P(!1), [A, O] = P(null), [K, Q] = P(!1), [G, f] = P({
|
|
6391
6395
|
email: "",
|
|
6392
6396
|
otp: "",
|
|
6393
6397
|
appId: d
|
|
6394
|
-
}), [S, x] = P(!1), [
|
|
6398
|
+
}), [S, x] = P(!1), [E, _] = P(!1);
|
|
6395
6399
|
te(() => {
|
|
6396
6400
|
if (typeof window < "u") {
|
|
6397
|
-
const
|
|
6398
|
-
return
|
|
6401
|
+
const k = () => y(window.innerWidth);
|
|
6402
|
+
return k(), window.addEventListener("resize", k), () => window.removeEventListener("resize", k);
|
|
6399
6403
|
}
|
|
6400
6404
|
}, []);
|
|
6401
|
-
const
|
|
6402
|
-
O({ type:
|
|
6405
|
+
const D = (k, H) => {
|
|
6406
|
+
O({ type: k, message: H }), setTimeout(() => O(null), 3e3);
|
|
6403
6407
|
}, Y = () => {
|
|
6404
6408
|
J(!0);
|
|
6405
|
-
const
|
|
6409
|
+
const k = setTimeout(() => {
|
|
6406
6410
|
Z(!1), J(!1);
|
|
6407
6411
|
}, 150);
|
|
6408
|
-
return () => clearTimeout(
|
|
6412
|
+
return () => clearTimeout(k);
|
|
6409
6413
|
};
|
|
6410
6414
|
te(() => {
|
|
6411
|
-
const
|
|
6415
|
+
const k = (H) => {
|
|
6412
6416
|
const X = document.querySelector(".dropdown-container");
|
|
6413
6417
|
X && !X.contains(H.target) && Y();
|
|
6414
6418
|
};
|
|
6415
|
-
return V && document.addEventListener("mousedown",
|
|
6416
|
-
document.removeEventListener("mousedown",
|
|
6419
|
+
return V && document.addEventListener("mousedown", k), () => {
|
|
6420
|
+
document.removeEventListener("mousedown", k);
|
|
6417
6421
|
};
|
|
6418
6422
|
}, [V]);
|
|
6419
6423
|
const se = async () => {
|
|
6420
6424
|
if (!G.email || !/\S+@\S+\.\S+/.test(G.email)) {
|
|
6421
|
-
|
|
6425
|
+
D("error", "Please enter a valid email");
|
|
6422
6426
|
return;
|
|
6423
6427
|
}
|
|
6424
6428
|
try {
|
|
6425
6429
|
_(!0);
|
|
6426
|
-
const
|
|
6430
|
+
const k = await M.post(
|
|
6427
6431
|
`${l}/users/send-verify-otp/${b?.id}`,
|
|
6428
6432
|
{ email: G.email },
|
|
6429
6433
|
{
|
|
6430
6434
|
headers: { "x-api-key": h, "x-app-id": d }
|
|
6431
6435
|
}
|
|
6432
6436
|
);
|
|
6433
|
-
|
|
6434
|
-
} catch (
|
|
6435
|
-
|
|
6437
|
+
k.data.success ? (D("success", k.data.message || "OTP sent to email!"), x(!0)) : D("error", k.data.message || "Failed to send OTP");
|
|
6438
|
+
} catch (k) {
|
|
6439
|
+
D("error", k.response?.data?.message || "Server error");
|
|
6436
6440
|
} finally {
|
|
6437
6441
|
_(!1);
|
|
6438
6442
|
}
|
|
6439
|
-
}, ue = async (
|
|
6440
|
-
if (
|
|
6441
|
-
|
|
6443
|
+
}, ue = async (k) => {
|
|
6444
|
+
if (k.preventDefault(), !G.email || !G.otp) {
|
|
6445
|
+
D("error", "Please fill in all fields");
|
|
6442
6446
|
return;
|
|
6443
6447
|
}
|
|
6444
6448
|
try {
|
|
@@ -6448,7 +6452,7 @@ const Fs = [
|
|
|
6448
6452
|
G
|
|
6449
6453
|
);
|
|
6450
6454
|
if (H.data.success) {
|
|
6451
|
-
if (
|
|
6455
|
+
if (D("success", H.data.message || "Email verified!"), b) {
|
|
6452
6456
|
const X = { ...b, isVerified: !0 };
|
|
6453
6457
|
w(X), localStorage.setItem(
|
|
6454
6458
|
"userInfo",
|
|
@@ -6457,19 +6461,19 @@ const Fs = [
|
|
|
6457
6461
|
}
|
|
6458
6462
|
f({ email: "", otp: "", appId: d }), x(!1), F(!1);
|
|
6459
6463
|
} else
|
|
6460
|
-
|
|
6464
|
+
D("error", H.data.message || "Verification failed");
|
|
6461
6465
|
} catch (H) {
|
|
6462
|
-
|
|
6466
|
+
D(
|
|
6463
6467
|
"error",
|
|
6464
6468
|
H.response?.data?.message || "Something went wrong"
|
|
6465
6469
|
);
|
|
6466
6470
|
} finally {
|
|
6467
6471
|
_(!1);
|
|
6468
6472
|
}
|
|
6469
|
-
}, ve = async (
|
|
6473
|
+
}, ve = async (k) => {
|
|
6470
6474
|
if (!b) return !1;
|
|
6471
6475
|
try {
|
|
6472
|
-
const H = { ...b, avatarUrl:
|
|
6476
|
+
const H = { ...b, avatarUrl: k }, { data: X } = await M.put(
|
|
6473
6477
|
`${l}/users/update/${b.id}`,
|
|
6474
6478
|
H,
|
|
6475
6479
|
{ headers: { "x-api-key": h } }
|
|
@@ -6477,33 +6481,33 @@ const Fs = [
|
|
|
6477
6481
|
return X.success ? (w(H), localStorage.setItem(
|
|
6478
6482
|
"userInfo",
|
|
6479
6483
|
JSON.stringify({ ...H, token: t })
|
|
6480
|
-
),
|
|
6484
|
+
), D("success", "Avatar updated successfully!"), !0) : (D("error", X.message || "Failed to update avatar"), !1);
|
|
6481
6485
|
} catch (H) {
|
|
6482
|
-
return console.error("Avatar update error:", H),
|
|
6486
|
+
return console.error("Avatar update error:", H), D("error", "Failed to update avatar"), !1;
|
|
6483
6487
|
}
|
|
6484
6488
|
}, ur = async () => {
|
|
6485
6489
|
if (b) {
|
|
6486
6490
|
z(!0);
|
|
6487
6491
|
try {
|
|
6488
|
-
const { data:
|
|
6492
|
+
const { data: k } = await M.put(
|
|
6489
6493
|
`${l}/users/update/${b.id}`,
|
|
6490
6494
|
b,
|
|
6491
6495
|
{ headers: { "x-api-key": h } }
|
|
6492
6496
|
);
|
|
6493
|
-
|
|
6497
|
+
k.success ? (w(k.user), $(!1), localStorage.setItem(
|
|
6494
6498
|
"userInfo",
|
|
6495
|
-
JSON.stringify({ ...
|
|
6496
|
-
),
|
|
6497
|
-
} catch (
|
|
6498
|
-
console.error(
|
|
6499
|
+
JSON.stringify({ ...k.user, token: t })
|
|
6500
|
+
), D("success", "Profile updated successfully")) : D("error", k.message);
|
|
6501
|
+
} catch (k) {
|
|
6502
|
+
console.error(k), D("error", "Update failed");
|
|
6499
6503
|
} finally {
|
|
6500
6504
|
z(!1);
|
|
6501
6505
|
}
|
|
6502
6506
|
}
|
|
6503
|
-
}, pt = async (
|
|
6507
|
+
}, pt = async (k) => {
|
|
6504
6508
|
try {
|
|
6505
6509
|
const { data: H } = await M.get(
|
|
6506
|
-
`${l}/users/check-user/${
|
|
6510
|
+
`${l}/users/check-user/${k}?appId=${d}`,
|
|
6507
6511
|
{ headers: { "x-api-key": h } }
|
|
6508
6512
|
);
|
|
6509
6513
|
H?.success === !0 && H?.exists === !1 && (console.warn("❌ User does not exist on server. Clearing session..."), localStorage.removeItem("userInfo"), w(null));
|
|
@@ -6525,10 +6529,10 @@ const Fs = [
|
|
|
6525
6529
|
}
|
|
6526
6530
|
})();
|
|
6527
6531
|
}, [e]), te(() => {
|
|
6528
|
-
b?.email && f((
|
|
6532
|
+
b?.email && f((k) => ({ ...k, email: b.email }));
|
|
6529
6533
|
}, [b?.email]);
|
|
6530
|
-
const ft = (
|
|
6531
|
-
let X = parseInt(
|
|
6534
|
+
const ft = (k, H) => {
|
|
6535
|
+
let X = parseInt(k.replace("#", ""), 16), pe = (X >> 16) + H, He = (X >> 8 & 255) + H, Ve = (X & 255) + H;
|
|
6532
6536
|
return pe = Math.min(255, Math.max(0, pe)), He = Math.min(255, Math.max(0, He)), Ve = Math.min(255, Math.max(0, Ve)), `#${(Ve | He << 8 | pe << 16).toString(16).padStart(6, "0")}`;
|
|
6533
6537
|
}, U = r ? {
|
|
6534
6538
|
background: "#000000",
|
|
@@ -6656,7 +6660,7 @@ const Fs = [
|
|
|
6656
6660
|
value: b.address || "Not provided",
|
|
6657
6661
|
name: "address",
|
|
6658
6662
|
type: "text",
|
|
6659
|
-
icon:
|
|
6663
|
+
icon: Es
|
|
6660
6664
|
}
|
|
6661
6665
|
];
|
|
6662
6666
|
return /* @__PURE__ */ n.jsxs(
|
|
@@ -7100,8 +7104,8 @@ const Fs = [
|
|
|
7100
7104
|
gap: "8px",
|
|
7101
7105
|
textAlign: "left"
|
|
7102
7106
|
},
|
|
7103
|
-
onMouseEnter: (
|
|
7104
|
-
onMouseLeave: (
|
|
7107
|
+
onMouseEnter: (k) => k.currentTarget.style.backgroundColor = U.surfaceLight,
|
|
7108
|
+
onMouseLeave: (k) => k.currentTarget.style.backgroundColor = "transparent",
|
|
7105
7109
|
children: [
|
|
7106
7110
|
/* @__PURE__ */ n.jsx(dt, { size: 14, "aria-hidden": "true" }),
|
|
7107
7111
|
"Change Password"
|
|
@@ -7129,10 +7133,10 @@ const Fs = [
|
|
|
7129
7133
|
gap: "8px",
|
|
7130
7134
|
textAlign: "left"
|
|
7131
7135
|
},
|
|
7132
|
-
onMouseEnter: (
|
|
7133
|
-
|
|
7136
|
+
onMouseEnter: (k) => {
|
|
7137
|
+
k.currentTarget.style.backgroundColor = r ? "rgba(239, 68, 68, 0.1)" : "rgba(239, 68, 68, 0.05)";
|
|
7134
7138
|
},
|
|
7135
|
-
onMouseLeave: (
|
|
7139
|
+
onMouseLeave: (k) => k.currentTarget.style.backgroundColor = "transparent",
|
|
7136
7140
|
children: [
|
|
7137
7141
|
/* @__PURE__ */ n.jsx(ct, { size: 14, "aria-hidden": "true" }),
|
|
7138
7142
|
"Logout"
|
|
@@ -7143,7 +7147,7 @@ const Fs = [
|
|
|
7143
7147
|
"button",
|
|
7144
7148
|
{
|
|
7145
7149
|
onClick: () => {
|
|
7146
|
-
|
|
7150
|
+
N(!0), Y();
|
|
7147
7151
|
},
|
|
7148
7152
|
style: {
|
|
7149
7153
|
width: "100%",
|
|
@@ -7160,12 +7164,12 @@ const Fs = [
|
|
|
7160
7164
|
gap: "8px",
|
|
7161
7165
|
textAlign: "left"
|
|
7162
7166
|
},
|
|
7163
|
-
onMouseEnter: (
|
|
7164
|
-
|
|
7167
|
+
onMouseEnter: (k) => {
|
|
7168
|
+
k.currentTarget.style.backgroundColor = r ? "rgba(239, 68, 68, 0.1)" : "rgba(239, 68, 68, 0.05)";
|
|
7165
7169
|
},
|
|
7166
|
-
onMouseLeave: (
|
|
7170
|
+
onMouseLeave: (k) => k.currentTarget.style.backgroundColor = "transparent",
|
|
7167
7171
|
children: [
|
|
7168
|
-
/* @__PURE__ */ n.jsx(
|
|
7172
|
+
/* @__PURE__ */ n.jsx(De, { size: 14, "aria-hidden": "true" }),
|
|
7169
7173
|
"Delete Account"
|
|
7170
7174
|
]
|
|
7171
7175
|
}
|
|
@@ -7230,8 +7234,8 @@ const Fs = [
|
|
|
7230
7234
|
gap: "20px"
|
|
7231
7235
|
}
|
|
7232
7236
|
},
|
|
7233
|
-
children: pr.map((
|
|
7234
|
-
const H =
|
|
7237
|
+
children: pr.map((k) => {
|
|
7238
|
+
const H = k.icon;
|
|
7235
7239
|
return /* @__PURE__ */ n.jsxs(
|
|
7236
7240
|
"div",
|
|
7237
7241
|
{
|
|
@@ -7254,16 +7258,16 @@ const Fs = [
|
|
|
7254
7258
|
},
|
|
7255
7259
|
children: [
|
|
7256
7260
|
/* @__PURE__ */ n.jsx(H, { size: 16, "aria-hidden": "true" }),
|
|
7257
|
-
|
|
7261
|
+
k.label
|
|
7258
7262
|
]
|
|
7259
7263
|
}
|
|
7260
7264
|
),
|
|
7261
7265
|
m ? /* @__PURE__ */ n.jsx(
|
|
7262
7266
|
"input",
|
|
7263
7267
|
{
|
|
7264
|
-
type:
|
|
7265
|
-
name:
|
|
7266
|
-
value: b[
|
|
7268
|
+
type: k.type,
|
|
7269
|
+
name: k.name,
|
|
7270
|
+
value: b[k.name],
|
|
7267
7271
|
onChange: (X) => w(
|
|
7268
7272
|
(pe) => pe && { ...pe, [X.target.name]: X.target.value }
|
|
7269
7273
|
),
|
|
@@ -7280,8 +7284,8 @@ const Fs = [
|
|
|
7280
7284
|
width: "100%",
|
|
7281
7285
|
boxSizing: "border-box"
|
|
7282
7286
|
},
|
|
7283
|
-
placeholder: `Enter ${
|
|
7284
|
-
"aria-label":
|
|
7287
|
+
placeholder: `Enter ${k.label.toLowerCase()}`,
|
|
7288
|
+
"aria-label": k.label
|
|
7285
7289
|
}
|
|
7286
7290
|
) : /* @__PURE__ */ n.jsx(
|
|
7287
7291
|
"div",
|
|
@@ -7298,12 +7302,12 @@ const Fs = [
|
|
|
7298
7302
|
color: U.textPrimary,
|
|
7299
7303
|
backgroundColor: r ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.05)"
|
|
7300
7304
|
},
|
|
7301
|
-
children:
|
|
7305
|
+
children: k.value
|
|
7302
7306
|
}
|
|
7303
7307
|
)
|
|
7304
7308
|
]
|
|
7305
7309
|
},
|
|
7306
|
-
|
|
7310
|
+
k.name
|
|
7307
7311
|
);
|
|
7308
7312
|
})
|
|
7309
7313
|
}
|
|
@@ -7461,8 +7465,8 @@ const Fs = [
|
|
|
7461
7465
|
userId: b.id,
|
|
7462
7466
|
isOpen: g,
|
|
7463
7467
|
onClose: () => I(!1),
|
|
7464
|
-
onSuccess: (
|
|
7465
|
-
onError: (
|
|
7468
|
+
onSuccess: (k) => D("success", k),
|
|
7469
|
+
onError: (k) => D("error", k),
|
|
7466
7470
|
colors: U
|
|
7467
7471
|
}
|
|
7468
7472
|
),
|
|
@@ -7475,9 +7479,9 @@ const Fs = [
|
|
|
7475
7479
|
userId: b.id,
|
|
7476
7480
|
token: t,
|
|
7477
7481
|
isOpen: v,
|
|
7478
|
-
onClose: () =>
|
|
7479
|
-
onSuccess: (
|
|
7480
|
-
onError: (
|
|
7482
|
+
onClose: () => N(!1),
|
|
7483
|
+
onSuccess: (k) => D("success", k),
|
|
7484
|
+
onError: (k) => D("error", k),
|
|
7481
7485
|
colors: U
|
|
7482
7486
|
}
|
|
7483
7487
|
),
|
|
@@ -7493,7 +7497,7 @@ const Fs = [
|
|
|
7493
7497
|
verifyFormData: G,
|
|
7494
7498
|
setVerifyFormData: f,
|
|
7495
7499
|
otpSent: S,
|
|
7496
|
-
verifying:
|
|
7500
|
+
verifying: E,
|
|
7497
7501
|
user: b,
|
|
7498
7502
|
colors: U,
|
|
7499
7503
|
darkMode: r
|
|
@@ -7611,7 +7615,7 @@ const Fs = [
|
|
|
7611
7615
|
viewProfileLabel: w = "View Profile",
|
|
7612
7616
|
logoutLabel: u = "Sign Out"
|
|
7613
7617
|
}) => {
|
|
7614
|
-
const { baseUrl: j, apiKey: m, appId: $ } = ge(), [R, z] = P(!1), [C, q] = P(null), [g, I] = P(!0), [v,
|
|
7618
|
+
const { baseUrl: j, apiKey: m, appId: $ } = ge(), [R, z] = P(!1), [C, q] = P(null), [g, I] = P(!0), [v, N] = P(null), W = xt(null), F = xt(null), [V, Z] = P(!1), [T, J] = P(!1);
|
|
7615
7619
|
te(() => {
|
|
7616
7620
|
if (typeof window > "u") return;
|
|
7617
7621
|
const x = () => {
|
|
@@ -7621,24 +7625,24 @@ const Fs = [
|
|
|
7621
7625
|
}, []), te(() => {
|
|
7622
7626
|
(async () => {
|
|
7623
7627
|
try {
|
|
7624
|
-
if (I(!0),
|
|
7628
|
+
if (I(!0), N(null), a) {
|
|
7625
7629
|
if (!a.id || !a.name || !a.email)
|
|
7626
7630
|
throw new Error("Invalid user data provided");
|
|
7627
7631
|
q(a);
|
|
7628
7632
|
} else if (typeof window < "u") {
|
|
7629
|
-
const
|
|
7630
|
-
if (
|
|
7633
|
+
const E = localStorage.getItem("userInfo");
|
|
7634
|
+
if (E)
|
|
7631
7635
|
try {
|
|
7632
|
-
const _ = JSON.parse(
|
|
7636
|
+
const _ = JSON.parse(E);
|
|
7633
7637
|
if (!_.id || !_.name || !_.email)
|
|
7634
7638
|
throw new Error("Invalid stored user data");
|
|
7635
7639
|
q(_);
|
|
7636
7640
|
} catch (_) {
|
|
7637
|
-
console.error("Failed to parse stored user data:", _), localStorage.removeItem("userInfo"),
|
|
7641
|
+
console.error("Failed to parse stored user data:", _), localStorage.removeItem("userInfo"), N("Invalid user data");
|
|
7638
7642
|
}
|
|
7639
7643
|
}
|
|
7640
|
-
} catch (
|
|
7641
|
-
console.error("User initialization failed:",
|
|
7644
|
+
} catch (E) {
|
|
7645
|
+
console.error("User initialization failed:", E), N(E.message || "Failed to load user");
|
|
7642
7646
|
} finally {
|
|
7643
7647
|
I(!1);
|
|
7644
7648
|
}
|
|
@@ -7647,8 +7651,8 @@ const Fs = [
|
|
|
7647
7651
|
if (typeof window > "u") return;
|
|
7648
7652
|
const x = () => {
|
|
7649
7653
|
if (!R || !F.current) return;
|
|
7650
|
-
const
|
|
7651
|
-
|
|
7654
|
+
const E = F.current.getBoundingClientRect(), _ = window.innerWidth, D = window.innerHeight, Y = 280, se = _ - E.right, ue = E.left;
|
|
7655
|
+
D - E.bottom;
|
|
7652
7656
|
const ve = se >= Y || se > ue;
|
|
7653
7657
|
Z(ve);
|
|
7654
7658
|
};
|
|
@@ -7656,15 +7660,15 @@ const Fs = [
|
|
|
7656
7660
|
}, [R]), te(() => {
|
|
7657
7661
|
if (typeof window > "u" || typeof document > "u")
|
|
7658
7662
|
return;
|
|
7659
|
-
const x = (
|
|
7660
|
-
W.current && !W.current.contains(
|
|
7661
|
-
},
|
|
7662
|
-
|
|
7663
|
+
const x = (D) => {
|
|
7664
|
+
W.current && !W.current.contains(D.target) && !F.current?.contains(D.target) && z(!1);
|
|
7665
|
+
}, E = (D) => {
|
|
7666
|
+
D.key === "Escape" && z(!1);
|
|
7663
7667
|
}, _ = () => {
|
|
7664
7668
|
R && z(!1);
|
|
7665
7669
|
};
|
|
7666
|
-
return R && (document.addEventListener("mousedown", x), document.addEventListener("keydown",
|
|
7667
|
-
document.removeEventListener("mousedown", x), document.removeEventListener("keydown",
|
|
7670
|
+
return R && (document.addEventListener("mousedown", x), document.addEventListener("keydown", E), window.addEventListener("scroll", _)), () => {
|
|
7671
|
+
document.removeEventListener("mousedown", x), document.removeEventListener("keydown", E), window.removeEventListener("scroll", _);
|
|
7668
7672
|
};
|
|
7669
7673
|
}, [R]);
|
|
7670
7674
|
const A = t ? {
|
|
@@ -7884,20 +7888,20 @@ const Fs = [
|
|
|
7884
7888
|
transition: "background-color 0.2s ease"
|
|
7885
7889
|
}
|
|
7886
7890
|
}, K = async () => {
|
|
7887
|
-
|
|
7891
|
+
N(null), I(!0);
|
|
7888
7892
|
try {
|
|
7889
7893
|
const x = localStorage.getItem("userInfo");
|
|
7890
7894
|
if (x) {
|
|
7891
|
-
const
|
|
7892
|
-
q(
|
|
7895
|
+
const E = JSON.parse(x);
|
|
7896
|
+
q(E);
|
|
7893
7897
|
} else a && q(a);
|
|
7894
7898
|
} catch (x) {
|
|
7895
|
-
console.error("Retry failed:", x),
|
|
7899
|
+
console.error("Retry failed:", x), N("Invalid user data"), localStorage.removeItem("userInfo"), q(null);
|
|
7896
7900
|
} finally {
|
|
7897
7901
|
I(!1);
|
|
7898
7902
|
}
|
|
7899
|
-
}, Q = (x,
|
|
7900
|
-
(x.key === "Enter" || x.key === " ") && (x.preventDefault(),
|
|
7903
|
+
}, Q = (x, E) => {
|
|
7904
|
+
(x.key === "Enter" || x.key === " ") && (x.preventDefault(), E());
|
|
7901
7905
|
}, G = () => o || C?.profileUrl, f = () => {
|
|
7902
7906
|
const x = G();
|
|
7903
7907
|
x && window.open(x, "_self", "noopener,noreferrer");
|
|
@@ -7918,7 +7922,7 @@ const Fs = [
|
|
|
7918
7922
|
{
|
|
7919
7923
|
ref: F,
|
|
7920
7924
|
onClick: () => z((x) => !x),
|
|
7921
|
-
onKeyDown: (x) => Q(x, () => z((
|
|
7925
|
+
onKeyDown: (x) => Q(x, () => z((E) => !E)),
|
|
7922
7926
|
tabIndex: 0,
|
|
7923
7927
|
role: "button",
|
|
7924
7928
|
"aria-haspopup": "true",
|
|
@@ -7939,8 +7943,8 @@ const Fs = [
|
|
|
7939
7943
|
},
|
|
7940
7944
|
loading: "lazy",
|
|
7941
7945
|
onError: (x) => {
|
|
7942
|
-
const
|
|
7943
|
-
|
|
7946
|
+
const E = x.target;
|
|
7947
|
+
E.onerror = null, E.src = `https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(
|
|
7944
7948
|
C?.name || "User"
|
|
7945
7949
|
)}`;
|
|
7946
7950
|
}
|
|
@@ -7970,7 +7974,7 @@ const Fs = [
|
|
|
7970
7974
|
ref: F,
|
|
7971
7975
|
style: O.avatarButton,
|
|
7972
7976
|
onClick: () => z((x) => !x),
|
|
7973
|
-
onKeyDown: (x) => Q(x, () => z((
|
|
7977
|
+
onKeyDown: (x) => Q(x, () => z((E) => !E)),
|
|
7974
7978
|
tabIndex: 0,
|
|
7975
7979
|
role: "button",
|
|
7976
7980
|
"aria-haspopup": "true",
|
|
@@ -7994,8 +7998,8 @@ const Fs = [
|
|
|
7994
7998
|
style: O.avatarImage,
|
|
7995
7999
|
loading: "lazy",
|
|
7996
8000
|
onError: (x) => {
|
|
7997
|
-
const
|
|
7998
|
-
|
|
8001
|
+
const E = x.target;
|
|
8002
|
+
E.src = "https://api.dicebear.com/9.x/glass/svg?seed=Kingston";
|
|
7999
8003
|
}
|
|
8000
8004
|
}
|
|
8001
8005
|
) : /* @__PURE__ */ n.jsx(
|
|
@@ -8032,8 +8036,8 @@ const Fs = [
|
|
|
8032
8036
|
style: O.dropdownAvatar,
|
|
8033
8037
|
loading: "lazy",
|
|
8034
8038
|
onError: (x) => {
|
|
8035
|
-
const
|
|
8036
|
-
|
|
8039
|
+
const E = x.target;
|
|
8040
|
+
E.src = `https://api.dicebear.com/9.x/initials/svg?seed=${C.name}`;
|
|
8037
8041
|
}
|
|
8038
8042
|
}
|
|
8039
8043
|
) : /* @__PURE__ */ n.jsx(
|
|
@@ -8179,8 +8183,8 @@ const Fs = [
|
|
|
8179
8183
|
otp: "",
|
|
8180
8184
|
appId: a
|
|
8181
8185
|
}), [d, c] = P(!1), [y, b] = P(!1), [w, u] = P(null), j = (g, I) => {
|
|
8182
|
-
let v = parseInt(g.replace("#", ""), 16),
|
|
8183
|
-
return
|
|
8186
|
+
let v = parseInt(g.replace("#", ""), 16), N = (v >> 16) + I, W = (v >> 8 & 255) + I, F = (v & 255) + I;
|
|
8187
|
+
return N = Math.min(255, Math.max(0, N)), W = Math.min(255, Math.max(0, W)), F = Math.min(255, Math.max(0, F)), `#${(F | W << 8 | N << 16).toString(16).padStart(6, "0")}`;
|
|
8184
8188
|
}, m = e ? {
|
|
8185
8189
|
surface: "#09090b",
|
|
8186
8190
|
surfaceLight: "#27272a",
|