@cedros/login-react 0.0.35 → 0.0.36
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/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +487 -481
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2410,41 +2410,41 @@ function Pc({
|
|
|
2410
2410
|
);
|
|
2411
2411
|
_(() => {
|
|
2412
2412
|
if (!f) return;
|
|
2413
|
-
const
|
|
2413
|
+
const v = (L) => {
|
|
2414
2414
|
h.current && !h.current.contains(L.target) && (g(!1), p(-1));
|
|
2415
|
-
},
|
|
2415
|
+
}, S = (L) => {
|
|
2416
2416
|
L.key === "Escape" && (g(!1), p(-1), y.current?.focus());
|
|
2417
2417
|
};
|
|
2418
|
-
return document.addEventListener("mousedown",
|
|
2419
|
-
document.removeEventListener("mousedown",
|
|
2418
|
+
return document.addEventListener("mousedown", v), document.addEventListener("keydown", S), () => {
|
|
2419
|
+
document.removeEventListener("mousedown", v), document.removeEventListener("keydown", S);
|
|
2420
2420
|
};
|
|
2421
2421
|
}, [f]);
|
|
2422
|
-
const
|
|
2423
|
-
(
|
|
2422
|
+
const A = x(
|
|
2423
|
+
(v) => {
|
|
2424
2424
|
if (!(!f || b.length === 0))
|
|
2425
|
-
switch (
|
|
2425
|
+
switch (v.key) {
|
|
2426
2426
|
case "ArrowDown":
|
|
2427
|
-
|
|
2427
|
+
v.preventDefault(), p((S) => (S + 1) % b.length);
|
|
2428
2428
|
break;
|
|
2429
2429
|
case "ArrowUp":
|
|
2430
|
-
|
|
2430
|
+
v.preventDefault(), p((S) => (S - 1 + b.length) % b.length);
|
|
2431
2431
|
break;
|
|
2432
2432
|
case "Home":
|
|
2433
|
-
|
|
2433
|
+
v.preventDefault(), p(0);
|
|
2434
2434
|
break;
|
|
2435
2435
|
case "End":
|
|
2436
|
-
|
|
2436
|
+
v.preventDefault(), p(b.length - 1);
|
|
2437
2437
|
break;
|
|
2438
2438
|
case "Enter":
|
|
2439
2439
|
case " ":
|
|
2440
|
-
w >= 0 && (
|
|
2440
|
+
w >= 0 && (v.preventDefault(), b[w].onClick(), g(!1), p(-1));
|
|
2441
2441
|
break;
|
|
2442
2442
|
}
|
|
2443
2443
|
},
|
|
2444
2444
|
[f, w, b]
|
|
2445
2445
|
), N = x(() => {
|
|
2446
|
-
b.length !== 0 && (g((
|
|
2447
|
-
}, [b.length]),
|
|
2446
|
+
b.length !== 0 && (g((v) => !v), p(-1));
|
|
2447
|
+
}, [b.length]), E = {
|
|
2448
2448
|
sm: "cedros-button-sm",
|
|
2449
2449
|
md: "cedros-button-md",
|
|
2450
2450
|
lg: "cedros-button-lg"
|
|
@@ -2458,38 +2458,38 @@ function Pc({
|
|
|
2458
2458
|
"button",
|
|
2459
2459
|
{
|
|
2460
2460
|
type: "button",
|
|
2461
|
-
className: `cedros-button ${P[r]} ${
|
|
2461
|
+
className: `cedros-button ${P[r]} ${E[o]} ${t}`,
|
|
2462
2462
|
disabled: !0,
|
|
2463
2463
|
children: /* @__PURE__ */ e(j, { size: "sm" })
|
|
2464
2464
|
}
|
|
2465
2465
|
);
|
|
2466
2466
|
if (c && l) {
|
|
2467
|
-
const
|
|
2467
|
+
const v = l.name || l.email || "User", S = Gr(l.picture);
|
|
2468
2468
|
return (
|
|
2469
2469
|
// L-08: Added keyboard handler and ref for accessibility
|
|
2470
|
-
/* @__PURE__ */ i("div", { className: "cedros-user-menu", ref: h, onKeyDown:
|
|
2470
|
+
/* @__PURE__ */ i("div", { className: "cedros-user-menu", ref: h, onKeyDown: A, children: [
|
|
2471
2471
|
/* @__PURE__ */ i(
|
|
2472
2472
|
"button",
|
|
2473
2473
|
{
|
|
2474
2474
|
ref: y,
|
|
2475
2475
|
type: "button",
|
|
2476
|
-
className: `cedros-button cedros-user-button ${
|
|
2476
|
+
className: `cedros-button cedros-user-button ${E[o]} ${t}`,
|
|
2477
2477
|
"aria-haspopup": "menu",
|
|
2478
2478
|
"aria-expanded": f,
|
|
2479
|
-
"aria-label": `User menu for ${
|
|
2479
|
+
"aria-label": `User menu for ${v}`,
|
|
2480
2480
|
onClick: N,
|
|
2481
2481
|
children: [
|
|
2482
|
-
|
|
2482
|
+
S ? /* @__PURE__ */ e(
|
|
2483
2483
|
"img",
|
|
2484
2484
|
{
|
|
2485
|
-
src:
|
|
2486
|
-
alt:
|
|
2485
|
+
src: S,
|
|
2486
|
+
alt: v,
|
|
2487
2487
|
className: "cedros-user-avatar",
|
|
2488
2488
|
referrerPolicy: "no-referrer",
|
|
2489
2489
|
crossOrigin: "anonymous"
|
|
2490
2490
|
}
|
|
2491
|
-
) : /* @__PURE__ */ e("div", { className: "cedros-user-avatar-placeholder", children: (
|
|
2492
|
-
/* @__PURE__ */ e("span", { className: "cedros-user-name", children:
|
|
2491
|
+
) : /* @__PURE__ */ e("div", { className: "cedros-user-avatar-placeholder", children: (v[0] || "?").toUpperCase() }),
|
|
2492
|
+
/* @__PURE__ */ e("span", { className: "cedros-user-name", children: v })
|
|
2493
2493
|
]
|
|
2494
2494
|
}
|
|
2495
2495
|
),
|
|
@@ -2533,7 +2533,7 @@ function Pc({
|
|
|
2533
2533
|
"button",
|
|
2534
2534
|
{
|
|
2535
2535
|
type: "button",
|
|
2536
|
-
className: `cedros-button ${P[r]} ${
|
|
2536
|
+
className: `cedros-button ${P[r]} ${E[o]} ${t}`,
|
|
2537
2537
|
onClick: u,
|
|
2538
2538
|
children: a || "Sign in"
|
|
2539
2539
|
}
|
|
@@ -2905,11 +2905,11 @@ function bn() {
|
|
|
2905
2905
|
const y = await window.AppleID.auth.signIn();
|
|
2906
2906
|
if (h = y.authorization?.id_token, !h)
|
|
2907
2907
|
throw new Error("No ID token received from Apple");
|
|
2908
|
-
const b = y.user?.name ? `${y.user.name.firstName || ""} ${y.user.name.lastName || ""}`.trim() : void 0,
|
|
2908
|
+
const b = y.user?.name ? `${y.user.name.firstName || ""} ${y.user.name.lastName || ""}`.trim() : void 0, A = await f.post("/apple", {
|
|
2909
2909
|
idToken: h,
|
|
2910
2910
|
name: b || void 0
|
|
2911
2911
|
});
|
|
2912
|
-
return m.current.callbacks?.onLoginSuccess?.(
|
|
2912
|
+
return m.current.callbacks?.onLoginSuccess?.(A.user, "apple"), r?.handleLoginSuccess(A.user, A.tokens), a(!1), A;
|
|
2913
2913
|
} catch (y) {
|
|
2914
2914
|
if (y.error === "popup_closed_by_user") {
|
|
2915
2915
|
const N = {
|
|
@@ -2918,8 +2918,8 @@ function bn() {
|
|
|
2918
2918
|
};
|
|
2919
2919
|
throw c(N), a(!1), N;
|
|
2920
2920
|
}
|
|
2921
|
-
const
|
|
2922
|
-
throw
|
|
2921
|
+
const A = W(y, "Unable to sign in with Apple. Please try again.");
|
|
2922
|
+
throw A.code === "ACCOUNT_LINK_REQUIRED" && h && u(h), c(A), a(!1), A;
|
|
2923
2923
|
}
|
|
2924
2924
|
}, [t.appleClientId, s, f, r]), w = x(() => c(null), []), p = x(() => u(null), []);
|
|
2925
2925
|
return {
|
|
@@ -3238,28 +3238,34 @@ function fs() {
|
|
|
3238
3238
|
});
|
|
3239
3239
|
return t.callbacks?.onLoginSuccess?.(y.user, "webauthn"), r?.handleLoginSuccess(y.user, y.tokens), y;
|
|
3240
3240
|
} catch (w) {
|
|
3241
|
-
|
|
3242
|
-
if (p || h)
|
|
3241
|
+
if (w instanceof Error && (w.name === "NotAllowedError" || w.name === "InvalidStateError"))
|
|
3243
3242
|
try {
|
|
3244
|
-
const
|
|
3243
|
+
const A = await l.post(
|
|
3245
3244
|
"/webauthn/signup/options",
|
|
3246
3245
|
{}
|
|
3247
|
-
),
|
|
3248
|
-
publicKey:
|
|
3246
|
+
), N = ut(A.options), E = await navigator.credentials.create({
|
|
3247
|
+
publicKey: N
|
|
3249
3248
|
});
|
|
3250
|
-
if (!
|
|
3249
|
+
if (!E)
|
|
3251
3250
|
throw new Error("Passkey signup returned no credential");
|
|
3252
|
-
const
|
|
3253
|
-
challengeId:
|
|
3254
|
-
credential: Te(
|
|
3251
|
+
const P = await l.post("/webauthn/signup/verify", {
|
|
3252
|
+
challengeId: A.challengeId,
|
|
3253
|
+
credential: Te(E)
|
|
3255
3254
|
});
|
|
3256
|
-
return t.callbacks?.onLoginSuccess?.(
|
|
3257
|
-
} catch (
|
|
3258
|
-
const
|
|
3259
|
-
throw n(
|
|
3260
|
-
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3255
|
+
return t.callbacks?.onLoginSuccess?.(P.user, "webauthn"), r?.handleLoginSuccess(P.user, P.tokens), P;
|
|
3256
|
+
} catch (A) {
|
|
3257
|
+
const E = Be(A) ?? W(A, "Unable to create passkey. Please try again.");
|
|
3258
|
+
throw n(E), E;
|
|
3259
|
+
}
|
|
3260
|
+
if (typeof w == "object" && w !== null && "isApiError" in w && w.data?.code === "INVALID_CREDENTIALS") {
|
|
3261
|
+
const A = {
|
|
3262
|
+
code: "INVALID_CREDENTIALS",
|
|
3263
|
+
message: "This passkey is not recognized. Please remove old passkeys for this site and try again, or sign in another way."
|
|
3264
|
+
};
|
|
3265
|
+
throw n(A), A;
|
|
3266
|
+
}
|
|
3267
|
+
const b = Be(w) ?? W(w, "Unable to sign in with passkey. Please try again.");
|
|
3268
|
+
throw n(b), b;
|
|
3263
3269
|
} finally {
|
|
3264
3270
|
a(!1);
|
|
3265
3271
|
}
|
|
@@ -3339,28 +3345,28 @@ function Kt({ onSuccess: t, className: r = "", defaultTab: o = "login" }) {
|
|
|
3339
3345
|
}, []);
|
|
3340
3346
|
const g = a.forms?.forgotPassword?.mode ?? (a.features?.instantLink ? "instantLink" : "reset"), w = x(
|
|
3341
3347
|
(P) => {
|
|
3342
|
-
const
|
|
3343
|
-
let
|
|
3348
|
+
const v = Re.indexOf(n);
|
|
3349
|
+
let S = v;
|
|
3344
3350
|
switch (P.key) {
|
|
3345
3351
|
case "ArrowLeft":
|
|
3346
3352
|
case "ArrowUp":
|
|
3347
|
-
|
|
3353
|
+
S = v === 0 ? Re.length - 1 : v - 1;
|
|
3348
3354
|
break;
|
|
3349
3355
|
case "ArrowRight":
|
|
3350
3356
|
case "ArrowDown":
|
|
3351
|
-
|
|
3357
|
+
S = v === Re.length - 1 ? 0 : v + 1;
|
|
3352
3358
|
break;
|
|
3353
3359
|
case "Home":
|
|
3354
|
-
|
|
3360
|
+
S = 0;
|
|
3355
3361
|
break;
|
|
3356
3362
|
case "End":
|
|
3357
|
-
|
|
3363
|
+
S = Re.length - 1;
|
|
3358
3364
|
break;
|
|
3359
3365
|
default:
|
|
3360
3366
|
return;
|
|
3361
3367
|
}
|
|
3362
3368
|
P.preventDefault();
|
|
3363
|
-
const L = Re[
|
|
3369
|
+
const L = Re[S];
|
|
3364
3370
|
l(L), document.getElementById(`cedros-tab-${L}`)?.focus();
|
|
3365
3371
|
},
|
|
3366
3372
|
[n]
|
|
@@ -3370,21 +3376,21 @@ function Kt({ onSuccess: t, className: r = "", defaultTab: o = "login" }) {
|
|
|
3370
3376
|
apple: !0,
|
|
3371
3377
|
solana: !0,
|
|
3372
3378
|
webauthn: !0
|
|
3373
|
-
}, h = p.email !== !1, y = p.google !== !1 && a.googleClientId, b = p.apple !== !1 && a.appleClientId && f,
|
|
3379
|
+
}, h = p.email !== !1, y = p.google !== !1 && a.googleClientId, b = p.apple !== !1 && a.appleClientId && f, A = p.solana !== !1 && u, N = p.webauthn !== !1, E = h && (y || b || A || N);
|
|
3374
3380
|
return c === "forgotPassword" ? /* @__PURE__ */ e("div", { className: `cedros-login-form ${r}`, children: /* @__PURE__ */ e(wn, { mode: g, onCancel: () => d("form") }) }) : /* @__PURE__ */ i("div", { className: `cedros-login-form ${r}`, children: [
|
|
3375
|
-
(N || y || b ||
|
|
3381
|
+
(N || y || b || A) && (() => {
|
|
3376
3382
|
const P = {
|
|
3377
3383
|
webauthn: N ? /* @__PURE__ */ e(Nn, { onSuccess: t }) : null,
|
|
3378
3384
|
google: y ? /* @__PURE__ */ e(co, { onSuccess: t }) : null,
|
|
3379
3385
|
apple: b ? /* @__PURE__ */ e(An, { onSuccess: t }) : null,
|
|
3380
|
-
solana:
|
|
3386
|
+
solana: A ? /* @__PURE__ */ e(lo, { onSuccess: t }) : null
|
|
3381
3387
|
};
|
|
3382
|
-
return /* @__PURE__ */ e("div", { className: "cedros-social-buttons", children: (s ?? ["webauthn", "google", "apple", "solana"]).map((
|
|
3383
|
-
const L = P[
|
|
3384
|
-
return L ? /* @__PURE__ */ e(ro, { children: L },
|
|
3388
|
+
return /* @__PURE__ */ e("div", { className: "cedros-social-buttons", children: (s ?? ["webauthn", "google", "apple", "solana"]).map((S) => {
|
|
3389
|
+
const L = P[S];
|
|
3390
|
+
return L ? /* @__PURE__ */ e(ro, { children: L }, S) : null;
|
|
3385
3391
|
}) });
|
|
3386
3392
|
})(),
|
|
3387
|
-
|
|
3393
|
+
E && /* @__PURE__ */ e("div", { className: "cedros-divider", children: /* @__PURE__ */ e("span", { children: "Or continue with" }) }),
|
|
3388
3394
|
h && /* @__PURE__ */ i($, { children: [
|
|
3389
3395
|
/* @__PURE__ */ i("div", { className: "cedros-tabs", role: "tablist", "aria-label": "Authentication method", children: [
|
|
3390
3396
|
/* @__PURE__ */ e(
|
|
@@ -3582,8 +3588,8 @@ function Mc({
|
|
|
3582
3588
|
onLoginClick: o,
|
|
3583
3589
|
className: a = ""
|
|
3584
3590
|
}) {
|
|
3585
|
-
const [s, n] = k(""), [l, c] = k(""), [d, u] = k(null), { resetPassword: m, isLoading: f, isSuccess: g, error: w, clearError: p } = Qt(), h = s === l, y = d?.isValid && h && s.length > 0, b = async (
|
|
3586
|
-
if (
|
|
3591
|
+
const [s, n] = k(""), [l, c] = k(""), [d, u] = k(null), { resetPassword: m, isLoading: f, isSuccess: g, error: w, clearError: p } = Qt(), h = s === l, y = d?.isValid && h && s.length > 0, b = async (A) => {
|
|
3592
|
+
if (A.preventDefault(), !!y)
|
|
3587
3593
|
try {
|
|
3588
3594
|
await m(t, s), r?.();
|
|
3589
3595
|
} catch {
|
|
@@ -3636,8 +3642,8 @@ function Mc({
|
|
|
3636
3642
|
{
|
|
3637
3643
|
label: "New password",
|
|
3638
3644
|
value: s,
|
|
3639
|
-
onChange: (
|
|
3640
|
-
n(
|
|
3645
|
+
onChange: (A) => {
|
|
3646
|
+
n(A.target.value), u(rt(A.target.value));
|
|
3641
3647
|
},
|
|
3642
3648
|
showStrengthMeter: !0,
|
|
3643
3649
|
onValidationChange: u,
|
|
@@ -3651,7 +3657,7 @@ function Mc({
|
|
|
3651
3657
|
{
|
|
3652
3658
|
label: "Confirm password",
|
|
3653
3659
|
value: l,
|
|
3654
|
-
onChange: (
|
|
3660
|
+
onChange: (A) => c(A.target.value),
|
|
3655
3661
|
disabled: f,
|
|
3656
3662
|
autoComplete: "new-password",
|
|
3657
3663
|
error: l && !h ? "Passwords do not match" : void 0
|
|
@@ -4084,8 +4090,8 @@ function In({
|
|
|
4084
4090
|
if (y.key === "Tab" && m.current) {
|
|
4085
4091
|
const b = m.current.querySelectorAll(
|
|
4086
4092
|
'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
4087
|
-
),
|
|
4088
|
-
y.shiftKey ? document.activeElement ===
|
|
4093
|
+
), A = b[0], N = b[b.length - 1];
|
|
4094
|
+
y.shiftKey ? document.activeElement === A && (y.preventDefault(), N?.focus()) : document.activeElement === N && (y.preventDefault(), A?.focus());
|
|
4089
4095
|
}
|
|
4090
4096
|
};
|
|
4091
4097
|
return document.addEventListener("keydown", h), () => document.removeEventListener("keydown", h);
|
|
@@ -4400,23 +4406,23 @@ function zn({
|
|
|
4400
4406
|
className: s = ""
|
|
4401
4407
|
}) {
|
|
4402
4408
|
const [n, l] = k(Array(le).fill("")), [c, d] = k(null), [u, m] = k([]), [f, g] = k(null), w = Yr(), p = J(null), h = x(
|
|
4403
|
-
(
|
|
4409
|
+
(v, S) => {
|
|
4404
4410
|
const L = [...n];
|
|
4405
|
-
if (L[
|
|
4406
|
-
const C = un(
|
|
4411
|
+
if (L[v] = S.toLowerCase().trim(), l(L), S.length > 0) {
|
|
4412
|
+
const C = un(S, 5);
|
|
4407
4413
|
m(C);
|
|
4408
4414
|
} else
|
|
4409
4415
|
m([]);
|
|
4410
4416
|
g(null);
|
|
4411
4417
|
},
|
|
4412
4418
|
[n]
|
|
4413
|
-
), y = x((
|
|
4414
|
-
d(
|
|
4419
|
+
), y = x((v) => {
|
|
4420
|
+
d(v), m([]);
|
|
4415
4421
|
}, []), b = x(
|
|
4416
|
-
(
|
|
4417
|
-
const
|
|
4418
|
-
|
|
4419
|
-
c ===
|
|
4422
|
+
(v) => {
|
|
4423
|
+
const S = n[v];
|
|
4424
|
+
S && !qe(S) && g(`Word ${v + 1} is not in the wordlist`), p.current !== null && window.clearTimeout(p.current), p.current = window.setTimeout(() => {
|
|
4425
|
+
c === v && m([]);
|
|
4420
4426
|
}, 200);
|
|
4421
4427
|
},
|
|
4422
4428
|
[n, c]
|
|
@@ -4424,22 +4430,22 @@ function zn({
|
|
|
4424
4430
|
_(() => () => {
|
|
4425
4431
|
p.current !== null && (window.clearTimeout(p.current), p.current = null);
|
|
4426
4432
|
}, []);
|
|
4427
|
-
const
|
|
4428
|
-
(
|
|
4433
|
+
const A = x(
|
|
4434
|
+
(v) => {
|
|
4429
4435
|
if (c !== null) {
|
|
4430
|
-
const
|
|
4431
|
-
|
|
4436
|
+
const S = [...n];
|
|
4437
|
+
S[c] = v, l(S), m([]), document.querySelector(
|
|
4432
4438
|
`[data-word-index="${c + 1}"]`
|
|
4433
4439
|
)?.focus();
|
|
4434
4440
|
}
|
|
4435
4441
|
},
|
|
4436
4442
|
[c, n]
|
|
4437
|
-
), N = x((
|
|
4438
|
-
const
|
|
4439
|
-
L.length === le && (
|
|
4440
|
-
}, []),
|
|
4441
|
-
(
|
|
4442
|
-
if (
|
|
4443
|
+
), N = x((v) => {
|
|
4444
|
+
const S = v.clipboardData.getData("text"), L = pn(S);
|
|
4445
|
+
L.length === le && (v.preventDefault(), l(L), g(null));
|
|
4446
|
+
}, []), E = x(
|
|
4447
|
+
(v) => {
|
|
4448
|
+
if (v.preventDefault(), n.filter((C) => !C).length > 0) {
|
|
4443
4449
|
g(`Please enter all ${le} words`);
|
|
4444
4450
|
return;
|
|
4445
4451
|
}
|
|
@@ -4460,46 +4466,46 @@ function zn({
|
|
|
4460
4466
|
"form",
|
|
4461
4467
|
{
|
|
4462
4468
|
className: `cedros-recovery-phrase-input ${s}`,
|
|
4463
|
-
onSubmit:
|
|
4469
|
+
onSubmit: E,
|
|
4464
4470
|
onPaste: N,
|
|
4465
4471
|
children: [
|
|
4466
4472
|
/* @__PURE__ */ i("div", { className: "cedros-recovery-input-header", children: [
|
|
4467
4473
|
/* @__PURE__ */ e("h3", { className: "cedros-recovery-input-title", children: "Enter Recovery Phrase" }),
|
|
4468
4474
|
/* @__PURE__ */ e("p", { className: "cedros-recovery-input-description", children: "Enter your 12-word recovery phrase. You can paste the entire phrase at once." })
|
|
4469
4475
|
] }),
|
|
4470
|
-
/* @__PURE__ */ e("div", { className: "cedros-word-inputs", children: Array.from({ length: le }, (
|
|
4476
|
+
/* @__PURE__ */ e("div", { className: "cedros-word-inputs", children: Array.from({ length: le }, (v, S) => /* @__PURE__ */ i("div", { className: "cedros-word-input-wrapper", children: [
|
|
4471
4477
|
/* @__PURE__ */ i("label", { className: "cedros-word-label", children: [
|
|
4472
|
-
|
|
4478
|
+
S + 1,
|
|
4473
4479
|
"."
|
|
4474
4480
|
] }),
|
|
4475
4481
|
/* @__PURE__ */ e(
|
|
4476
4482
|
"input",
|
|
4477
4483
|
{
|
|
4478
4484
|
type: "text",
|
|
4479
|
-
className: `cedros-word-input ${n[
|
|
4480
|
-
value: n[
|
|
4481
|
-
onChange: (L) => h(
|
|
4482
|
-
onFocus: () => y(
|
|
4483
|
-
onBlur: () => b(
|
|
4484
|
-
"data-word-index":
|
|
4485
|
+
className: `cedros-word-input ${n[S] && !qe(n[S]) ? "cedros-word-invalid" : n[S] && qe(n[S]) ? "cedros-word-valid" : ""}`,
|
|
4486
|
+
value: n[S],
|
|
4487
|
+
onChange: (L) => h(S, L.target.value),
|
|
4488
|
+
onFocus: () => y(S),
|
|
4489
|
+
onBlur: () => b(S),
|
|
4490
|
+
"data-word-index": S,
|
|
4485
4491
|
autoComplete: "off",
|
|
4486
4492
|
autoCapitalize: "none",
|
|
4487
4493
|
spellCheck: !1,
|
|
4488
4494
|
disabled: o,
|
|
4489
|
-
"aria-label": `Word ${
|
|
4495
|
+
"aria-label": `Word ${S + 1}`
|
|
4490
4496
|
}
|
|
4491
4497
|
)
|
|
4492
|
-
] },
|
|
4493
|
-
c !== null && u.length > 0 && /* @__PURE__ */ e("div", { className: "cedros-suggestions", role: "listbox", id: `${w}-suggestions`, children: u.map((
|
|
4498
|
+
] }, S)) }),
|
|
4499
|
+
c !== null && u.length > 0 && /* @__PURE__ */ e("div", { className: "cedros-suggestions", role: "listbox", id: `${w}-suggestions`, children: u.map((v) => /* @__PURE__ */ e(
|
|
4494
4500
|
"button",
|
|
4495
4501
|
{
|
|
4496
4502
|
type: "button",
|
|
4497
4503
|
className: "cedros-suggestion",
|
|
4498
|
-
onClick: () => v
|
|
4504
|
+
onClick: () => A(v),
|
|
4499
4505
|
role: "option",
|
|
4500
|
-
children:
|
|
4506
|
+
children: v
|
|
4501
4507
|
},
|
|
4502
|
-
|
|
4508
|
+
v
|
|
4503
4509
|
)) }),
|
|
4504
4510
|
P && /* @__PURE__ */ e("p", { className: "cedros-input-error", role: "alert", children: P }),
|
|
4505
4511
|
/* @__PURE__ */ i("div", { className: "cedros-recovery-input-actions", children: [
|
|
@@ -4669,19 +4675,19 @@ function Kn() {
|
|
|
4669
4675
|
const u = x(
|
|
4670
4676
|
async (p, h, y, b) => {
|
|
4671
4677
|
s({ step: "generating_seed" });
|
|
4672
|
-
const
|
|
4673
|
-
c.current.push(
|
|
4674
|
-
const { shareA: N, shareB:
|
|
4675
|
-
c.current.push(N,
|
|
4676
|
-
const
|
|
4678
|
+
const A = Zs();
|
|
4679
|
+
c.current.push(A), s({ step: "splitting_shares" });
|
|
4680
|
+
const { shareA: N, shareB: E, shareC: P } = rs(A);
|
|
4681
|
+
c.current.push(N, E, P), s({ step: "encrypting_shares" });
|
|
4682
|
+
const v = await jr(N, zr(h)), S = ss(A), L = os(S);
|
|
4677
4683
|
s({ step: "uploading" });
|
|
4678
4684
|
const C = {
|
|
4679
4685
|
solanaPubkey: L,
|
|
4680
4686
|
shareAAuthMethod: p,
|
|
4681
|
-
shareACiphertext:
|
|
4682
|
-
shareANonce:
|
|
4687
|
+
shareACiphertext: v.ciphertext,
|
|
4688
|
+
shareANonce: v.nonce,
|
|
4683
4689
|
// Share B is now plaintext (SSS math protects it)
|
|
4684
|
-
shareB: we(
|
|
4690
|
+
shareB: we(E)
|
|
4685
4691
|
};
|
|
4686
4692
|
if (p === "password") {
|
|
4687
4693
|
if (!y) throw new Error("KDF salt required for password method");
|
|
@@ -4693,7 +4699,7 @@ function Kn() {
|
|
|
4693
4699
|
solanaPubkey: L
|
|
4694
4700
|
});
|
|
4695
4701
|
else {
|
|
4696
|
-
const B = o === "full_seed" ? ln(
|
|
4702
|
+
const B = o === "full_seed" ? ln(A) : an(He(P));
|
|
4697
4703
|
s({
|
|
4698
4704
|
step: "showing_recovery",
|
|
4699
4705
|
recoveryPhrase: B,
|
|
@@ -4733,16 +4739,16 @@ function Kn() {
|
|
|
4733
4739
|
s({ step: "registering_passkey" });
|
|
4734
4740
|
let y;
|
|
4735
4741
|
try {
|
|
4736
|
-
const
|
|
4742
|
+
const A = new TextEncoder().encode(t.id), N = t.name ?? t.email ?? "User", E = t.email ?? t.id;
|
|
4737
4743
|
y = (await eo(
|
|
4738
|
-
|
|
4739
|
-
|
|
4744
|
+
A,
|
|
4745
|
+
E,
|
|
4740
4746
|
N,
|
|
4741
4747
|
p
|
|
4742
4748
|
)).prfOutput;
|
|
4743
|
-
} catch (
|
|
4744
|
-
if (
|
|
4745
|
-
throw
|
|
4749
|
+
} catch (A) {
|
|
4750
|
+
if (A?.name !== "InvalidStateError")
|
|
4751
|
+
throw A;
|
|
4746
4752
|
y = (await zt(h)).prfOutput;
|
|
4747
4753
|
}
|
|
4748
4754
|
c.current.push(y);
|
|
@@ -4787,11 +4793,11 @@ function Yn({
|
|
|
4787
4793
|
confirmRecoveryPhrase: d,
|
|
4788
4794
|
cancel: u,
|
|
4789
4795
|
isEnrolling: m
|
|
4790
|
-
} = Kn(), f = () => a || "password", [g, w] = k(f), [p, h] = k(""), [y, b] = k(""), [
|
|
4796
|
+
} = Kn(), f = () => a || "password", [g, w] = k(f), [p, h] = k(""), [y, b] = k(""), [A, N] = k(null);
|
|
4791
4797
|
_(() => {
|
|
4792
4798
|
w(f());
|
|
4793
4799
|
}, [s?.id, a]);
|
|
4794
|
-
const
|
|
4800
|
+
const E = x(
|
|
4795
4801
|
async (L) => {
|
|
4796
4802
|
if (L.preventDefault(), p !== y) {
|
|
4797
4803
|
N("Passwords do not match");
|
|
@@ -4808,9 +4814,9 @@ function Yn({
|
|
|
4808
4814
|
[p, y, l]
|
|
4809
4815
|
), P = x(async () => {
|
|
4810
4816
|
await c();
|
|
4811
|
-
}, [c]),
|
|
4817
|
+
}, [c]), v = x(() => {
|
|
4812
4818
|
d(), n.solanaPubkey && t?.(n.solanaPubkey);
|
|
4813
|
-
}, [d, n.solanaPubkey, t]),
|
|
4819
|
+
}, [d, n.solanaPubkey, t]), S = x(() => {
|
|
4814
4820
|
u(), r?.();
|
|
4815
4821
|
}, [u, r]);
|
|
4816
4822
|
return n.step === "generating_seed" || n.step === "splitting_shares" ? /* @__PURE__ */ e("div", { className: `cedros-wallet-enrollment ${o}`, "aria-busy": "true", children: /* @__PURE__ */ i("div", { className: "cedros-enrollment-progress", role: "status", "aria-live": "polite", children: [
|
|
@@ -4852,7 +4858,7 @@ function Yn({
|
|
|
4852
4858
|
] }) }) }) : n.step === "uploading" ? /* @__PURE__ */ e("div", { className: `cedros-wallet-enrollment ${o}`, "aria-busy": "true", children: /* @__PURE__ */ i("div", { className: "cedros-enrollment-progress", role: "status", "aria-live": "polite", children: [
|
|
4853
4859
|
/* @__PURE__ */ e("div", { className: "cedros-spinner", "aria-hidden": "true" }),
|
|
4854
4860
|
/* @__PURE__ */ e("p", { children: "Saving wallet..." })
|
|
4855
|
-
] }) }) : n.step === "showing_recovery" && n.recoveryPhrase ? /* @__PURE__ */ e("div", { className: `cedros-wallet-enrollment ${o}`, children: /* @__PURE__ */ e(jn, { words: n.recoveryPhrase, onConfirm:
|
|
4861
|
+
] }) }) : n.step === "showing_recovery" && n.recoveryPhrase ? /* @__PURE__ */ e("div", { className: `cedros-wallet-enrollment ${o}`, children: /* @__PURE__ */ e(jn, { words: n.recoveryPhrase, onConfirm: v }) }) : n.step === "complete" ? /* @__PURE__ */ e("div", { className: `cedros-wallet-enrollment ${o}`, children: /* @__PURE__ */ i("div", { className: "cedros-enrollment-complete", children: [
|
|
4856
4862
|
/* @__PURE__ */ i(
|
|
4857
4863
|
"svg",
|
|
4858
4864
|
{
|
|
@@ -4916,7 +4922,7 @@ function Yn({
|
|
|
4916
4922
|
{
|
|
4917
4923
|
type: "button",
|
|
4918
4924
|
className: "cedros-button cedros-button-secondary",
|
|
4919
|
-
onClick:
|
|
4925
|
+
onClick: S,
|
|
4920
4926
|
children: "Cancel"
|
|
4921
4927
|
}
|
|
4922
4928
|
),
|
|
@@ -4969,7 +4975,7 @@ function Yn({
|
|
|
4969
4975
|
/* @__PURE__ */ e("span", { children: "Passkey" })
|
|
4970
4976
|
] })
|
|
4971
4977
|
] }),
|
|
4972
|
-
g === "password" && /* @__PURE__ */ i("form", { onSubmit:
|
|
4978
|
+
g === "password" && /* @__PURE__ */ i("form", { onSubmit: E, className: "cedros-enrollment-form", children: [
|
|
4973
4979
|
/* @__PURE__ */ e(
|
|
4974
4980
|
he,
|
|
4975
4981
|
{
|
|
@@ -4989,7 +4995,7 @@ function Yn({
|
|
|
4989
4995
|
label: "Confirm Password",
|
|
4990
4996
|
value: y,
|
|
4991
4997
|
onChange: (L) => b(L.target.value),
|
|
4992
|
-
error:
|
|
4998
|
+
error: A ?? void 0,
|
|
4993
4999
|
disabled: m,
|
|
4994
5000
|
required: !0,
|
|
4995
5001
|
minLength: 8,
|
|
@@ -5003,7 +5009,7 @@ function Yn({
|
|
|
5003
5009
|
{
|
|
5004
5010
|
type: "button",
|
|
5005
5011
|
className: "cedros-button cedros-button-secondary",
|
|
5006
|
-
onClick:
|
|
5012
|
+
onClick: S,
|
|
5007
5013
|
disabled: m,
|
|
5008
5014
|
children: "Cancel"
|
|
5009
5015
|
}
|
|
@@ -5057,7 +5063,7 @@ function Yn({
|
|
|
5057
5063
|
{
|
|
5058
5064
|
type: "button",
|
|
5059
5065
|
className: "cedros-button cedros-button-secondary",
|
|
5060
|
-
onClick:
|
|
5066
|
+
onClick: S,
|
|
5061
5067
|
disabled: m,
|
|
5062
5068
|
children: "Cancel"
|
|
5063
5069
|
}
|
|
@@ -5272,7 +5278,7 @@ function ta({
|
|
|
5272
5278
|
_(() => {
|
|
5273
5279
|
a !== void 0 && w(a);
|
|
5274
5280
|
}, [a]);
|
|
5275
|
-
const
|
|
5281
|
+
const A = g === "password", N = g === "passkey", E = x(async () => {
|
|
5276
5282
|
if (f("credential"), b(null), !g)
|
|
5277
5283
|
try {
|
|
5278
5284
|
const T = await l();
|
|
@@ -5285,7 +5291,7 @@ function ta({
|
|
|
5285
5291
|
T.preventDefault(), b(null), f("unlocking");
|
|
5286
5292
|
try {
|
|
5287
5293
|
let M;
|
|
5288
|
-
if (
|
|
5294
|
+
if (A)
|
|
5289
5295
|
M = { type: "password", password: p };
|
|
5290
5296
|
else
|
|
5291
5297
|
throw new Error("Invalid auth method");
|
|
@@ -5294,8 +5300,8 @@ function ta({
|
|
|
5294
5300
|
b(M instanceof Error ? M.message : "Failed to unlock wallet"), f("error");
|
|
5295
5301
|
}
|
|
5296
5302
|
},
|
|
5297
|
-
[
|
|
5298
|
-
),
|
|
5303
|
+
[A, p, n, t]
|
|
5304
|
+
), v = x(async () => {
|
|
5299
5305
|
b(null), f("unlocking");
|
|
5300
5306
|
try {
|
|
5301
5307
|
const T = await d();
|
|
@@ -5307,7 +5313,7 @@ function ta({
|
|
|
5307
5313
|
} catch (T) {
|
|
5308
5314
|
b(T instanceof Error ? T.message : "Failed to unlock wallet"), f("error");
|
|
5309
5315
|
}
|
|
5310
|
-
}, [d, n, t]),
|
|
5316
|
+
}, [d, n, t]), S = x(() => {
|
|
5311
5317
|
h(""), f("idle"), b(null), r?.();
|
|
5312
5318
|
}, [r]), L = x(() => {
|
|
5313
5319
|
h(""), f("credential"), b(null);
|
|
@@ -5323,13 +5329,13 @@ function ta({
|
|
|
5323
5329
|
{
|
|
5324
5330
|
type: "button",
|
|
5325
5331
|
className: "cedros-button cedros-button-primary",
|
|
5326
|
-
onClick:
|
|
5332
|
+
onClick: E,
|
|
5327
5333
|
children: "Unlock Wallet"
|
|
5328
5334
|
}
|
|
5329
5335
|
)
|
|
5330
5336
|
] });
|
|
5331
5337
|
case "credential":
|
|
5332
|
-
return
|
|
5338
|
+
return A ? /* @__PURE__ */ i("form", { className: "cedros-wallet-unlock-form", onSubmit: P, children: [
|
|
5333
5339
|
/* @__PURE__ */ e("h3", { className: "cedros-wallet-unlock-title", children: "Enter Password" }),
|
|
5334
5340
|
/* @__PURE__ */ e("p", { className: "cedros-wallet-unlock-description", children: "Enter your wallet password to unlock." }),
|
|
5335
5341
|
/* @__PURE__ */ e(
|
|
@@ -5358,7 +5364,7 @@ function ta({
|
|
|
5358
5364
|
{
|
|
5359
5365
|
type: "button",
|
|
5360
5366
|
className: "cedros-button cedros-button-secondary",
|
|
5361
|
-
onClick:
|
|
5367
|
+
onClick: S,
|
|
5362
5368
|
disabled: C,
|
|
5363
5369
|
children: "Cancel"
|
|
5364
5370
|
}
|
|
@@ -5373,9 +5379,9 @@ function ta({
|
|
|
5373
5379
|
mode: "authenticate",
|
|
5374
5380
|
isLoading: C,
|
|
5375
5381
|
error: y ?? void 0,
|
|
5376
|
-
onPrompt:
|
|
5377
|
-
onRetry:
|
|
5378
|
-
onCancel: o ?
|
|
5382
|
+
onPrompt: v,
|
|
5383
|
+
onRetry: v,
|
|
5384
|
+
onCancel: o ? S : void 0
|
|
5379
5385
|
}
|
|
5380
5386
|
)
|
|
5381
5387
|
] }) : /* @__PURE__ */ i("div", { className: "cedros-wallet-unlock-loading", children: [
|
|
@@ -5414,7 +5420,7 @@ function ta({
|
|
|
5414
5420
|
{
|
|
5415
5421
|
type: "button",
|
|
5416
5422
|
className: "cedros-button cedros-button-secondary",
|
|
5417
|
-
onClick:
|
|
5423
|
+
onClick: S,
|
|
5418
5424
|
children: "Cancel"
|
|
5419
5425
|
}
|
|
5420
5426
|
)
|
|
@@ -5514,26 +5520,26 @@ function na() {
|
|
|
5514
5520
|
c.current.push(T), p = Ho(He(T), He(L)), c.current.push(p);
|
|
5515
5521
|
} else
|
|
5516
5522
|
p = dn(f), c.current.push(p);
|
|
5517
|
-
const h = ss(p), y = os(h), { shareA: b, shareB:
|
|
5518
|
-
c.current.push(b,
|
|
5519
|
-
let N,
|
|
5523
|
+
const h = ss(p), y = os(h), { shareA: b, shareB: A } = rs(p);
|
|
5524
|
+
c.current.push(b, A), s({ step: "encrypting" });
|
|
5525
|
+
let N, E, P;
|
|
5520
5526
|
if (g === "passkey") {
|
|
5521
5527
|
const L = Hr();
|
|
5522
5528
|
P = we(L);
|
|
5523
5529
|
const C = await zt(P);
|
|
5524
5530
|
c.current.push(C.prfOutput), N = await Qr(C.prfOutput, L), c.current.push(N);
|
|
5525
5531
|
} else
|
|
5526
|
-
|
|
5527
|
-
const
|
|
5532
|
+
E = Vr(), N = await ns(w, E, Qe), c.current.push(N);
|
|
5533
|
+
const v = await jr(b, zr(N));
|
|
5528
5534
|
s({ step: "uploading" });
|
|
5529
|
-
const
|
|
5535
|
+
const S = {
|
|
5530
5536
|
solanaPubkey: y,
|
|
5531
5537
|
shareAAuthMethod: g,
|
|
5532
|
-
shareACiphertext:
|
|
5533
|
-
shareANonce:
|
|
5534
|
-
shareB: we(
|
|
5538
|
+
shareACiphertext: v.ciphertext,
|
|
5539
|
+
shareANonce: v.nonce,
|
|
5540
|
+
shareB: we(A)
|
|
5535
5541
|
};
|
|
5536
|
-
g === "password" && (
|
|
5542
|
+
g === "password" && (S.shareAKdfSalt = we(E), S.shareAKdfParams = Qe), g === "passkey" && (S.prfSalt = P), await t(S), d(), s({ step: "complete" });
|
|
5537
5543
|
} catch (p) {
|
|
5538
5544
|
d(), s({
|
|
5539
5545
|
step: "error",
|
|
@@ -5560,7 +5566,7 @@ function aa({
|
|
|
5560
5566
|
className: o = "",
|
|
5561
5567
|
defaultAuthMethod: a = "password"
|
|
5562
5568
|
}) {
|
|
5563
|
-
const { state: s, startRecovery: n, cancel: l, isRecovering: c } = na(), [d, u] = k([]), [m, f] = k(!1), [g, w] = k(a), [p, h] = k(""), [y, b] = k(""), [
|
|
5569
|
+
const { state: s, startRecovery: n, cancel: l, isRecovering: c } = na(), [d, u] = k([]), [m, f] = k(!1), [g, w] = k(a), [p, h] = k(""), [y, b] = k(""), [A, N] = k(null), E = x((C) => {
|
|
5564
5570
|
u(C), f(!0);
|
|
5565
5571
|
}, []), P = x(
|
|
5566
5572
|
async (C) => {
|
|
@@ -5577,9 +5583,9 @@ function aa({
|
|
|
5577
5583
|
await n(d, g, p);
|
|
5578
5584
|
},
|
|
5579
5585
|
[d, g, p, y, n]
|
|
5580
|
-
),
|
|
5586
|
+
), v = x(() => {
|
|
5581
5587
|
l(), u([]), f(!1), h(""), b(""), r?.();
|
|
5582
|
-
}, [l, r]),
|
|
5588
|
+
}, [l, r]), S = x(() => {
|
|
5583
5589
|
f(!1), h(""), b("");
|
|
5584
5590
|
}, []), L = x(() => {
|
|
5585
5591
|
t?.();
|
|
@@ -5623,7 +5629,7 @@ function aa({
|
|
|
5623
5629
|
{
|
|
5624
5630
|
type: "button",
|
|
5625
5631
|
className: "cedros-button cedros-button-primary",
|
|
5626
|
-
onClick:
|
|
5632
|
+
onClick: v,
|
|
5627
5633
|
children: "Start Over"
|
|
5628
5634
|
}
|
|
5629
5635
|
) })
|
|
@@ -5690,11 +5696,11 @@ function aa({
|
|
|
5690
5696
|
value: y,
|
|
5691
5697
|
onChange: (C) => b(C.target.value),
|
|
5692
5698
|
disabled: c,
|
|
5693
|
-
"aria-invalid":
|
|
5699
|
+
"aria-invalid": A ? "true" : void 0,
|
|
5694
5700
|
placeholder: "Confirm your password"
|
|
5695
5701
|
}
|
|
5696
5702
|
),
|
|
5697
|
-
|
|
5703
|
+
A && /* @__PURE__ */ e("p", { className: "cedros-input-error", role: "alert", children: A })
|
|
5698
5704
|
] })
|
|
5699
5705
|
] }),
|
|
5700
5706
|
g === "passkey" && /* @__PURE__ */ i("div", { className: "cedros-passkey-info", children: [
|
|
@@ -5707,7 +5713,7 @@ function aa({
|
|
|
5707
5713
|
{
|
|
5708
5714
|
type: "button",
|
|
5709
5715
|
className: "cedros-button cedros-button-secondary",
|
|
5710
|
-
onClick:
|
|
5716
|
+
onClick: S,
|
|
5711
5717
|
disabled: c,
|
|
5712
5718
|
children: "Back"
|
|
5713
5719
|
}
|
|
@@ -5730,8 +5736,8 @@ function aa({
|
|
|
5730
5736
|
/* @__PURE__ */ e(
|
|
5731
5737
|
zn,
|
|
5732
5738
|
{
|
|
5733
|
-
onSubmit:
|
|
5734
|
-
onCancel:
|
|
5739
|
+
onSubmit: E,
|
|
5740
|
+
onCancel: v,
|
|
5735
5741
|
isSubmitting: !1
|
|
5736
5742
|
}
|
|
5737
5743
|
)
|
|
@@ -5852,7 +5858,7 @@ function ua({
|
|
|
5852
5858
|
const l = ve(), [c, d] = k(!1), [u, m] = k(null), [f, g] = k(!1), w = J(null), p = l?.config.solana?.network ?? "mainnet-beta", h = q(() => {
|
|
5853
5859
|
const N = `https://explorer.solana.com/address/${t}`;
|
|
5854
5860
|
return p === "mainnet-beta" ? N : `${N}?cluster=${encodeURIComponent(p)}`;
|
|
5855
|
-
}, [t, p]), y = s && t.length > 18, b = q(() => !y || f ? t : `${t.slice(0, 8)}...${t.slice(-8)}`, [t, y, f]),
|
|
5861
|
+
}, [t, p]), y = s && t.length > 18, b = q(() => !y || f ? t : `${t.slice(0, 8)}...${t.slice(-8)}`, [t, y, f]), A = x(async () => {
|
|
5856
5862
|
try {
|
|
5857
5863
|
m(null), await navigator.clipboard.writeText(t), d(!0), w.current !== null && window.clearTimeout(w.current), w.current = window.setTimeout(() => {
|
|
5858
5864
|
d(!1), w.current = null;
|
|
@@ -5954,7 +5960,7 @@ function ua({
|
|
|
5954
5960
|
{
|
|
5955
5961
|
type: "button",
|
|
5956
5962
|
className: "cedros-button cedros-button-sm cedros-button-outline",
|
|
5957
|
-
onClick:
|
|
5963
|
+
onClick: A,
|
|
5958
5964
|
"aria-label": "Copy wallet address",
|
|
5959
5965
|
children: c ? "Copied" : "Copy"
|
|
5960
5966
|
}
|
|
@@ -6305,22 +6311,22 @@ function Dc({
|
|
|
6305
6311
|
return () => clearTimeout(P);
|
|
6306
6312
|
}
|
|
6307
6313
|
}, [w]);
|
|
6308
|
-
const h = x((P,
|
|
6309
|
-
m((
|
|
6314
|
+
const h = x((P, v) => {
|
|
6315
|
+
m((S) => ({ ...S, [P]: v })), g(null), p(!1);
|
|
6310
6316
|
}, []), y = x(async () => {
|
|
6311
|
-
const P = Object.entries(u).map(([
|
|
6312
|
-
key:
|
|
6313
|
-
value:
|
|
6317
|
+
const P = Object.entries(u).map(([v, S]) => ({
|
|
6318
|
+
key: v,
|
|
6319
|
+
value: S
|
|
6314
6320
|
}));
|
|
6315
6321
|
if (P.length !== 0)
|
|
6316
6322
|
try {
|
|
6317
6323
|
await d(P), m({}), g(null), p(!0), o?.();
|
|
6318
|
-
} catch (
|
|
6319
|
-
g(
|
|
6324
|
+
} catch (v) {
|
|
6325
|
+
g(v instanceof Error ? v.message : "Failed to save settings");
|
|
6320
6326
|
}
|
|
6321
6327
|
}, [u, d, o]), b = x(() => {
|
|
6322
6328
|
m({}), g(null), p(!1);
|
|
6323
|
-
}, []),
|
|
6329
|
+
}, []), A = Object.keys(u).length > 0, N = Object.keys(u).length;
|
|
6324
6330
|
if (s && Object.keys(a).length === 0)
|
|
6325
6331
|
return /* @__PURE__ */ i("div", { className: `cedros-system-settings cedros-system-settings-loading ${r}`, children: [
|
|
6326
6332
|
/* @__PURE__ */ e(j, {}),
|
|
@@ -6328,11 +6334,11 @@ function Dc({
|
|
|
6328
6334
|
] });
|
|
6329
6335
|
if (l)
|
|
6330
6336
|
return /* @__PURE__ */ e("div", { className: `cedros-system-settings ${r}`, children: /* @__PURE__ */ e(X, { error: l.message }) });
|
|
6331
|
-
const
|
|
6332
|
-
return
|
|
6337
|
+
const E = Object.keys(a).sort();
|
|
6338
|
+
return E.length === 0 ? /* @__PURE__ */ e("div", { className: `cedros-system-settings cedros-system-settings-empty ${r}`, children: /* @__PURE__ */ e("p", { children: "No system settings found." }) }) : /* @__PURE__ */ i("div", { className: `cedros-system-settings ${r}`, children: [
|
|
6333
6339
|
f && /* @__PURE__ */ e(X, { error: f }),
|
|
6334
6340
|
w && /* @__PURE__ */ e("div", { className: "cedros-settings-success", children: "Settings saved successfully." }),
|
|
6335
|
-
|
|
6341
|
+
E.map((P) => /* @__PURE__ */ e(
|
|
6336
6342
|
ga,
|
|
6337
6343
|
{
|
|
6338
6344
|
category: P,
|
|
@@ -6344,7 +6350,7 @@ function Dc({
|
|
|
6344
6350
|
P
|
|
6345
6351
|
)),
|
|
6346
6352
|
/* @__PURE__ */ i("div", { className: "cedros-system-settings-actions", children: [
|
|
6347
|
-
|
|
6353
|
+
A && /* @__PURE__ */ i("span", { className: "cedros-settings-change-count", children: [
|
|
6348
6354
|
N,
|
|
6349
6355
|
" unsaved change",
|
|
6350
6356
|
N !== 1 ? "s" : ""
|
|
@@ -6355,7 +6361,7 @@ function Dc({
|
|
|
6355
6361
|
type: "button",
|
|
6356
6362
|
className: "cedros-button cedros-button-secondary",
|
|
6357
6363
|
onClick: b,
|
|
6358
|
-
disabled: !
|
|
6364
|
+
disabled: !A || n,
|
|
6359
6365
|
children: "Reset"
|
|
6360
6366
|
}
|
|
6361
6367
|
),
|
|
@@ -6365,7 +6371,7 @@ function Dc({
|
|
|
6365
6371
|
type: "button",
|
|
6366
6372
|
className: "cedros-button cedros-button-primary",
|
|
6367
6373
|
onClick: y,
|
|
6368
|
-
disabled: !
|
|
6374
|
+
disabled: !A || n,
|
|
6369
6375
|
children: n ? /* @__PURE__ */ e(j, { size: "sm" }) : "Save Changes"
|
|
6370
6376
|
}
|
|
6371
6377
|
)
|
|
@@ -6488,7 +6494,7 @@ function Aa({ onComplete: t, className: r = "" }) {
|
|
|
6488
6494
|
}, [l]);
|
|
6489
6495
|
const p = x(
|
|
6490
6496
|
(y) => (b) => {
|
|
6491
|
-
u((
|
|
6497
|
+
u((A) => ({ ...A, [y]: b.target.value })), f((A) => ({ ...A, [y]: void 0 }));
|
|
6492
6498
|
},
|
|
6493
6499
|
[]
|
|
6494
6500
|
), h = x(
|
|
@@ -6715,15 +6721,15 @@ function ka({ className: t }) {
|
|
|
6715
6721
|
_(() => {
|
|
6716
6722
|
c();
|
|
6717
6723
|
}, [c]);
|
|
6718
|
-
const g = lr.find((
|
|
6719
|
-
const
|
|
6720
|
-
if (m !== "email") return
|
|
6724
|
+
const g = lr.find((E) => E.id === m), w = g?.category ?? "", h = (u("email_provider") || "custom") === "custom", y = u("email_smtp_host"), b = !h || y != null && y !== "", A = q(() => {
|
|
6725
|
+
const E = r[w] ?? [];
|
|
6726
|
+
if (m !== "email") return E;
|
|
6721
6727
|
const P = h ? _o : Wo;
|
|
6722
|
-
return
|
|
6723
|
-
}, [r, w, m, h]), N = (
|
|
6724
|
-
if (d(
|
|
6725
|
-
const
|
|
6726
|
-
|
|
6728
|
+
return E.filter((v) => P.includes(v.key)).sort((v, S) => P.indexOf(v.key) - P.indexOf(S.key));
|
|
6729
|
+
}, [r, w, m, h]), N = (E, P) => {
|
|
6730
|
+
if (d(E, P), E === "email_provider" && P !== "custom") {
|
|
6731
|
+
const v = Oo[P];
|
|
6732
|
+
v && (d("email_smtp_host", v), d("email_smtp_port", "587"), d("email_smtp_tls", "true"));
|
|
6727
6733
|
}
|
|
6728
6734
|
};
|
|
6729
6735
|
return a && Object.keys(r).length === 0 ? /* @__PURE__ */ i("div", { className: `cedros-system-settings cedros-system-settings-loading ${t ?? ""}`, children: [
|
|
@@ -6738,26 +6744,26 @@ function ka({ className: t }) {
|
|
|
6738
6744
|
/* @__PURE__ */ e(No, { status: s, error: n })
|
|
6739
6745
|
] }),
|
|
6740
6746
|
m === "email" && !b && /* @__PURE__ */ e("div", { className: "cedros-settings-warning-banner", children: "Email features (verification, password reset, instant link) are disabled until SMTP is configured. Select a provider or enter custom SMTP settings below." }),
|
|
6741
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-tabs cedros-admin-tabs--line", children: lr.map((
|
|
6747
|
+
/* @__PURE__ */ e("div", { className: "cedros-admin-tabs cedros-admin-tabs--line", children: lr.map((E) => /* @__PURE__ */ e(
|
|
6742
6748
|
"button",
|
|
6743
6749
|
{
|
|
6744
6750
|
type: "button",
|
|
6745
|
-
className: `cedros-admin-tab ${m ===
|
|
6746
|
-
onClick: () => f(
|
|
6747
|
-
"aria-selected": m ===
|
|
6751
|
+
className: `cedros-admin-tab ${m === E.id ? "cedros-admin-tab-active" : ""}`,
|
|
6752
|
+
onClick: () => f(E.id),
|
|
6753
|
+
"aria-selected": m === E.id,
|
|
6748
6754
|
role: "tab",
|
|
6749
|
-
children:
|
|
6755
|
+
children: E.label
|
|
6750
6756
|
},
|
|
6751
|
-
|
|
6757
|
+
E.id
|
|
6752
6758
|
)) }),
|
|
6753
|
-
/* @__PURE__ */ e("div", { className: "cedros-admin-tab-content", role: "tabpanel", children:
|
|
6759
|
+
/* @__PURE__ */ e("div", { className: "cedros-admin-tab-content", role: "tabpanel", children: A.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-system-settings-empty", children: /* @__PURE__ */ i("p", { children: [
|
|
6754
6760
|
"No settings found for ",
|
|
6755
6761
|
g?.label ?? "this section",
|
|
6756
6762
|
"."
|
|
6757
6763
|
] }) }) : /* @__PURE__ */ e(
|
|
6758
6764
|
es,
|
|
6759
6765
|
{
|
|
6760
|
-
settings:
|
|
6766
|
+
settings: A,
|
|
6761
6767
|
edits: o,
|
|
6762
6768
|
onChange: m === "email" ? N : d
|
|
6763
6769
|
}
|
|
@@ -6988,17 +6994,17 @@ function Fc({
|
|
|
6988
6994
|
onLogoutClick: c,
|
|
6989
6995
|
className: d = ""
|
|
6990
6996
|
}) {
|
|
6991
|
-
const [u, m] = k(o), [f, g] = k(!0), { user: w, logout: p } = te(), { activeOrg: h, role: y, isLoading: b, fetchOrgs:
|
|
6997
|
+
const [u, m] = k(o), [f, g] = k(!0), { user: w, logout: p } = te(), { activeOrg: h, role: y, isLoading: b, fetchOrgs: A, hasPermission: N } = Co(), { status: E, isLoading: P, checkStatus: v } = ws(), { features: S, isLoading: L } = uo(), { canAccess: C } = ho(), B = x(
|
|
6992
6998
|
(U) => {
|
|
6993
6999
|
m(U), n?.(U);
|
|
6994
7000
|
},
|
|
6995
7001
|
[n]
|
|
6996
|
-
), T = Na.filter((U) => !(!r.includes(U.id) || U.requiredFeature && !
|
|
7002
|
+
), T = Na.filter((U) => !(!r.includes(U.id) || U.requiredFeature && !S[U.requiredFeature] || !C(U.id))), M = T.find((U) => U.id === u), R = !M && !L;
|
|
6997
7003
|
return _(() => {
|
|
6998
|
-
|
|
6999
|
-
}, [
|
|
7004
|
+
A(), v();
|
|
7005
|
+
}, [A, v]), _(() => {
|
|
7000
7006
|
R && T.length > 0 && m("users");
|
|
7001
|
-
}, [R, T.length]), !P &&
|
|
7007
|
+
}, [R, T.length]), !P && E?.needsSetup ? /* @__PURE__ */ e("div", { className: `cedros-admin cedros-dashboard cedros-dashboard--setup ${d}`, children: /* @__PURE__ */ e(Aa, { onComplete: () => v() }) }) : (b || P || L) && !h ? /* @__PURE__ */ i("div", { className: `cedros-admin cedros-dashboard cedros-dashboard--loading ${d}`, children: [
|
|
7002
7008
|
/* @__PURE__ */ e(j, {}),
|
|
7003
7009
|
/* @__PURE__ */ e("span", { className: "cedros-dashboard__loading-text", children: "Loading..." })
|
|
7004
7010
|
] }) : u === "team" && !h ? /* @__PURE__ */ e("div", { className: `cedros-admin cedros-dashboard ${d}`, children: /* @__PURE__ */ e(X, { error: "No organization selected. Please select an organization first." }) }) : /* @__PURE__ */ i("div", { className: `cedros-admin cedros-dashboard ${d}`, children: [
|
|
@@ -7137,21 +7143,21 @@ function Ea({ orgId: t, currentUserId: r, hasPermission: o, role: a }) {
|
|
|
7137
7143
|
fetchInvites: h,
|
|
7138
7144
|
createInvite: y,
|
|
7139
7145
|
cancelInvite: b,
|
|
7140
|
-
resendInvite:
|
|
7146
|
+
resendInvite: A
|
|
7141
7147
|
} = mo(t);
|
|
7142
7148
|
_(() => {
|
|
7143
7149
|
u(), h();
|
|
7144
7150
|
}, [u, h]);
|
|
7145
|
-
const N = o("invite:create"),
|
|
7151
|
+
const N = o("invite:create"), E = o("invite:cancel"), P = g.length, v = l.reduce(
|
|
7146
7152
|
(B, T) => (B[T.role] = (B[T.role] ?? 0) + 1, B),
|
|
7147
7153
|
{}
|
|
7148
|
-
),
|
|
7154
|
+
), S = v.owner ?? 0, L = v.admin ?? 0, C = v.member ?? 0;
|
|
7149
7155
|
return /* @__PURE__ */ i("div", { className: "cedros-dashboard__team", children: [
|
|
7150
7156
|
/* @__PURE__ */ e(
|
|
7151
7157
|
ts,
|
|
7152
7158
|
{
|
|
7153
7159
|
stats: [
|
|
7154
|
-
{ label: "Owners", value:
|
|
7160
|
+
{ label: "Owners", value: S },
|
|
7155
7161
|
{ label: "Admins", value: L },
|
|
7156
7162
|
{ label: "Members", value: C },
|
|
7157
7163
|
{ label: "Pending Invites", value: P }
|
|
@@ -7228,9 +7234,9 @@ function Ea({ orgId: t, currentUserId: r, hasPermission: o, role: a }) {
|
|
|
7228
7234
|
invites: g,
|
|
7229
7235
|
isLoading: w,
|
|
7230
7236
|
error: p?.message,
|
|
7231
|
-
canManage:
|
|
7232
|
-
onCancel:
|
|
7233
|
-
onResend: N ?
|
|
7237
|
+
canManage: E || N,
|
|
7238
|
+
onCancel: E ? b : void 0,
|
|
7239
|
+
onResend: N ? A : void 0
|
|
7234
7240
|
}
|
|
7235
7241
|
) })
|
|
7236
7242
|
] }),
|
|
@@ -8127,9 +8133,9 @@ function Fa() {
|
|
|
8127
8133
|
if (!n.isValid(w))
|
|
8128
8134
|
throw new Error("Invalid QR Code version");
|
|
8129
8135
|
typeof h > "u" && (h = s.BYTE);
|
|
8130
|
-
const y = r.getSymbolTotalCodewords(w), b = o.getTotalCodewordsCount(w, p),
|
|
8131
|
-
if (h === s.MIXED) return
|
|
8132
|
-
const N =
|
|
8136
|
+
const y = r.getSymbolTotalCodewords(w), b = o.getTotalCodewordsCount(w, p), A = (y - b) * 8;
|
|
8137
|
+
if (h === s.MIXED) return A;
|
|
8138
|
+
const N = A - u(h, w);
|
|
8133
8139
|
switch (h) {
|
|
8134
8140
|
case s.NUMERIC:
|
|
8135
8141
|
return Math.floor(N / 10 * 3);
|
|
@@ -8392,33 +8398,33 @@ function Va() {
|
|
|
8392
8398
|
function u(b) {
|
|
8393
8399
|
return unescape(encodeURIComponent(b)).length;
|
|
8394
8400
|
}
|
|
8395
|
-
function m(b,
|
|
8396
|
-
const
|
|
8401
|
+
function m(b, A, N) {
|
|
8402
|
+
const E = [];
|
|
8397
8403
|
let P;
|
|
8398
8404
|
for (; (P = b.exec(N)) !== null; )
|
|
8399
|
-
|
|
8405
|
+
E.push({
|
|
8400
8406
|
data: P[0],
|
|
8401
8407
|
index: P.index,
|
|
8402
|
-
mode:
|
|
8408
|
+
mode: A,
|
|
8403
8409
|
length: P[0].length
|
|
8404
8410
|
});
|
|
8405
|
-
return
|
|
8411
|
+
return E;
|
|
8406
8412
|
}
|
|
8407
8413
|
function f(b) {
|
|
8408
|
-
const
|
|
8409
|
-
let
|
|
8410
|
-
return c.isKanjiModeEnabled() ? (
|
|
8411
|
-
return
|
|
8412
|
-
}).map(function(
|
|
8414
|
+
const A = m(l.NUMERIC, r.NUMERIC, b), N = m(l.ALPHANUMERIC, r.ALPHANUMERIC, b);
|
|
8415
|
+
let E, P;
|
|
8416
|
+
return c.isKanjiModeEnabled() ? (E = m(l.BYTE, r.BYTE, b), P = m(l.KANJI, r.KANJI, b)) : (E = m(l.BYTE_KANJI, r.BYTE, b), P = []), A.concat(N, E, P).sort(function(S, L) {
|
|
8417
|
+
return S.index - L.index;
|
|
8418
|
+
}).map(function(S) {
|
|
8413
8419
|
return {
|
|
8414
|
-
data:
|
|
8415
|
-
mode:
|
|
8416
|
-
length:
|
|
8420
|
+
data: S.data,
|
|
8421
|
+
mode: S.mode,
|
|
8422
|
+
length: S.length
|
|
8417
8423
|
};
|
|
8418
8424
|
});
|
|
8419
8425
|
}
|
|
8420
|
-
function g(b,
|
|
8421
|
-
switch (
|
|
8426
|
+
function g(b, A) {
|
|
8427
|
+
switch (A) {
|
|
8422
8428
|
case r.NUMERIC:
|
|
8423
8429
|
return o.getBitsLength(b);
|
|
8424
8430
|
case r.ALPHANUMERIC:
|
|
@@ -8430,68 +8436,68 @@ function Va() {
|
|
|
8430
8436
|
}
|
|
8431
8437
|
}
|
|
8432
8438
|
function w(b) {
|
|
8433
|
-
return b.reduce(function(
|
|
8434
|
-
const
|
|
8435
|
-
return
|
|
8439
|
+
return b.reduce(function(A, N) {
|
|
8440
|
+
const E = A.length - 1 >= 0 ? A[A.length - 1] : null;
|
|
8441
|
+
return E && E.mode === N.mode ? (A[A.length - 1].data += N.data, A) : (A.push(N), A);
|
|
8436
8442
|
}, []);
|
|
8437
8443
|
}
|
|
8438
8444
|
function p(b) {
|
|
8439
|
-
const
|
|
8445
|
+
const A = [];
|
|
8440
8446
|
for (let N = 0; N < b.length; N++) {
|
|
8441
|
-
const
|
|
8442
|
-
switch (
|
|
8447
|
+
const E = b[N];
|
|
8448
|
+
switch (E.mode) {
|
|
8443
8449
|
case r.NUMERIC:
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
{ data:
|
|
8447
|
-
{ data:
|
|
8450
|
+
A.push([
|
|
8451
|
+
E,
|
|
8452
|
+
{ data: E.data, mode: r.ALPHANUMERIC, length: E.length },
|
|
8453
|
+
{ data: E.data, mode: r.BYTE, length: E.length }
|
|
8448
8454
|
]);
|
|
8449
8455
|
break;
|
|
8450
8456
|
case r.ALPHANUMERIC:
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
{ data:
|
|
8457
|
+
A.push([
|
|
8458
|
+
E,
|
|
8459
|
+
{ data: E.data, mode: r.BYTE, length: E.length }
|
|
8454
8460
|
]);
|
|
8455
8461
|
break;
|
|
8456
8462
|
case r.KANJI:
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
{ data:
|
|
8463
|
+
A.push([
|
|
8464
|
+
E,
|
|
8465
|
+
{ data: E.data, mode: r.BYTE, length: u(E.data) }
|
|
8460
8466
|
]);
|
|
8461
8467
|
break;
|
|
8462
8468
|
case r.BYTE:
|
|
8463
|
-
|
|
8464
|
-
{ data:
|
|
8469
|
+
A.push([
|
|
8470
|
+
{ data: E.data, mode: r.BYTE, length: u(E.data) }
|
|
8465
8471
|
]);
|
|
8466
8472
|
}
|
|
8467
8473
|
}
|
|
8468
|
-
return
|
|
8474
|
+
return A;
|
|
8469
8475
|
}
|
|
8470
|
-
function h(b,
|
|
8471
|
-
const N = {},
|
|
8476
|
+
function h(b, A) {
|
|
8477
|
+
const N = {}, E = { start: {} };
|
|
8472
8478
|
let P = ["start"];
|
|
8473
|
-
for (let
|
|
8474
|
-
const
|
|
8475
|
-
for (let C = 0; C <
|
|
8476
|
-
const B =
|
|
8477
|
-
L.push(T), N[T] = { node: B, lastCount: 0 },
|
|
8479
|
+
for (let v = 0; v < b.length; v++) {
|
|
8480
|
+
const S = b[v], L = [];
|
|
8481
|
+
for (let C = 0; C < S.length; C++) {
|
|
8482
|
+
const B = S[C], T = "" + v + C;
|
|
8483
|
+
L.push(T), N[T] = { node: B, lastCount: 0 }, E[T] = {};
|
|
8478
8484
|
for (let M = 0; M < P.length; M++) {
|
|
8479
8485
|
const R = P[M];
|
|
8480
|
-
N[R] && N[R].node.mode === B.mode ? (
|
|
8486
|
+
N[R] && N[R].node.mode === B.mode ? (E[R][T] = g(N[R].lastCount + B.length, B.mode) - g(N[R].lastCount, B.mode), N[R].lastCount += B.length) : (N[R] && (N[R].lastCount = B.length), E[R][T] = g(B.length, B.mode) + 4 + r.getCharCountIndicator(B.mode, A));
|
|
8481
8487
|
}
|
|
8482
8488
|
}
|
|
8483
8489
|
P = L;
|
|
8484
8490
|
}
|
|
8485
|
-
for (let
|
|
8486
|
-
|
|
8487
|
-
return { map:
|
|
8491
|
+
for (let v = 0; v < P.length; v++)
|
|
8492
|
+
E[P[v]].end = 0;
|
|
8493
|
+
return { map: E, table: N };
|
|
8488
8494
|
}
|
|
8489
|
-
function y(b,
|
|
8495
|
+
function y(b, A) {
|
|
8490
8496
|
let N;
|
|
8491
|
-
const
|
|
8492
|
-
if (N = r.from(
|
|
8497
|
+
const E = r.getBestModeForData(b);
|
|
8498
|
+
if (N = r.from(A, E), N !== r.BYTE && N.bit < E.bit)
|
|
8493
8499
|
throw new Error('"' + b + '" cannot be encoded with mode ' + r.toString(N) + `.
|
|
8494
|
-
Suggested mode is: ` + r.toString(
|
|
8500
|
+
Suggested mode is: ` + r.toString(E));
|
|
8495
8501
|
switch (N === r.KANJI && !c.isKanjiModeEnabled() && (N = r.BYTE), N) {
|
|
8496
8502
|
case r.NUMERIC:
|
|
8497
8503
|
return new o(b);
|
|
@@ -8503,18 +8509,18 @@ function Va() {
|
|
|
8503
8509
|
return new s(b);
|
|
8504
8510
|
}
|
|
8505
8511
|
}
|
|
8506
|
-
t.fromArray = function(
|
|
8507
|
-
return
|
|
8508
|
-
return typeof
|
|
8512
|
+
t.fromArray = function(A) {
|
|
8513
|
+
return A.reduce(function(N, E) {
|
|
8514
|
+
return typeof E == "string" ? N.push(y(E, null)) : E.data && N.push(y(E.data, E.mode)), N;
|
|
8509
8515
|
}, []);
|
|
8510
|
-
}, t.fromString = function(
|
|
8511
|
-
const
|
|
8512
|
-
for (let C = 1; C <
|
|
8513
|
-
L.push(
|
|
8516
|
+
}, t.fromString = function(A, N) {
|
|
8517
|
+
const E = f(A, c.isKanjiModeEnabled()), P = p(E), v = h(P, N), S = d.find_path(v.map, "start", "end"), L = [];
|
|
8518
|
+
for (let C = 1; C < S.length - 1; C++)
|
|
8519
|
+
L.push(v.table[S[C]].node);
|
|
8514
8520
|
return t.fromArray(w(L));
|
|
8515
|
-
}, t.rawSplit = function(
|
|
8521
|
+
}, t.rawSplit = function(A) {
|
|
8516
8522
|
return t.fromArray(
|
|
8517
|
-
f(
|
|
8523
|
+
f(A, c.isKanjiModeEnabled())
|
|
8518
8524
|
);
|
|
8519
8525
|
};
|
|
8520
8526
|
})(St)), St;
|
|
@@ -8524,54 +8530,54 @@ function Ha() {
|
|
|
8524
8530
|
if (Rr) return pt;
|
|
8525
8531
|
Rr = 1;
|
|
8526
8532
|
const t = ke(), r = Yt(), o = La(), a = Ma(), s = Ta(), n = Ba(), l = Ra(), c = ys(), d = Ua(), u = Fa(), m = _a(), f = Ne(), g = Va();
|
|
8527
|
-
function w(
|
|
8528
|
-
const L =
|
|
8533
|
+
function w(v, S) {
|
|
8534
|
+
const L = v.size, C = n.getPositions(S);
|
|
8529
8535
|
for (let B = 0; B < C.length; B++) {
|
|
8530
8536
|
const T = C[B][0], M = C[B][1];
|
|
8531
8537
|
for (let R = -1; R <= 7; R++)
|
|
8532
8538
|
if (!(T + R <= -1 || L <= T + R))
|
|
8533
8539
|
for (let I = -1; I <= 7; I++)
|
|
8534
|
-
M + I <= -1 || L <= M + I || (R >= 0 && R <= 6 && (I === 0 || I === 6) || I >= 0 && I <= 6 && (R === 0 || R === 6) || R >= 2 && R <= 4 && I >= 2 && I <= 4 ?
|
|
8540
|
+
M + I <= -1 || L <= M + I || (R >= 0 && R <= 6 && (I === 0 || I === 6) || I >= 0 && I <= 6 && (R === 0 || R === 6) || R >= 2 && R <= 4 && I >= 2 && I <= 4 ? v.set(T + R, M + I, !0, !0) : v.set(T + R, M + I, !1, !0));
|
|
8535
8541
|
}
|
|
8536
8542
|
}
|
|
8537
|
-
function p(
|
|
8538
|
-
const
|
|
8539
|
-
for (let L = 8; L <
|
|
8543
|
+
function p(v) {
|
|
8544
|
+
const S = v.size;
|
|
8545
|
+
for (let L = 8; L < S - 8; L++) {
|
|
8540
8546
|
const C = L % 2 === 0;
|
|
8541
|
-
|
|
8547
|
+
v.set(L, 6, C, !0), v.set(6, L, C, !0);
|
|
8542
8548
|
}
|
|
8543
8549
|
}
|
|
8544
|
-
function h(
|
|
8545
|
-
const L = s.getPositions(
|
|
8550
|
+
function h(v, S) {
|
|
8551
|
+
const L = s.getPositions(S);
|
|
8546
8552
|
for (let C = 0; C < L.length; C++) {
|
|
8547
8553
|
const B = L[C][0], T = L[C][1];
|
|
8548
8554
|
for (let M = -2; M <= 2; M++)
|
|
8549
8555
|
for (let R = -2; R <= 2; R++)
|
|
8550
|
-
M === -2 || M === 2 || R === -2 || R === 2 || M === 0 && R === 0 ?
|
|
8556
|
+
M === -2 || M === 2 || R === -2 || R === 2 || M === 0 && R === 0 ? v.set(B + M, T + R, !0, !0) : v.set(B + M, T + R, !1, !0);
|
|
8551
8557
|
}
|
|
8552
8558
|
}
|
|
8553
|
-
function y(
|
|
8554
|
-
const L =
|
|
8559
|
+
function y(v, S) {
|
|
8560
|
+
const L = v.size, C = u.getEncodedBits(S);
|
|
8555
8561
|
let B, T, M;
|
|
8556
8562
|
for (let R = 0; R < 18; R++)
|
|
8557
|
-
B = Math.floor(R / 3), T = R % 3 + L - 8 - 3, M = (C >> R & 1) === 1,
|
|
8563
|
+
B = Math.floor(R / 3), T = R % 3 + L - 8 - 3, M = (C >> R & 1) === 1, v.set(B, T, M, !0), v.set(T, B, M, !0);
|
|
8558
8564
|
}
|
|
8559
|
-
function b(
|
|
8560
|
-
const C =
|
|
8565
|
+
function b(v, S, L) {
|
|
8566
|
+
const C = v.size, B = m.getEncodedBits(S, L);
|
|
8561
8567
|
let T, M;
|
|
8562
8568
|
for (T = 0; T < 15; T++)
|
|
8563
|
-
M = (B >> T & 1) === 1, T < 6 ?
|
|
8564
|
-
|
|
8569
|
+
M = (B >> T & 1) === 1, T < 6 ? v.set(T, 8, M, !0) : T < 8 ? v.set(T + 1, 8, M, !0) : v.set(C - 15 + T, 8, M, !0), T < 8 ? v.set(8, C - T - 1, M, !0) : T < 9 ? v.set(8, 15 - T - 1 + 1, M, !0) : v.set(8, 15 - T - 1, M, !0);
|
|
8570
|
+
v.set(C - 8, 8, 1, !0);
|
|
8565
8571
|
}
|
|
8566
|
-
function v
|
|
8567
|
-
const L =
|
|
8572
|
+
function A(v, S) {
|
|
8573
|
+
const L = v.size;
|
|
8568
8574
|
let C = -1, B = L - 1, T = 7, M = 0;
|
|
8569
8575
|
for (let R = L - 1; R > 0; R -= 2)
|
|
8570
8576
|
for (R === 6 && R--; ; ) {
|
|
8571
8577
|
for (let I = 0; I < 2; I++)
|
|
8572
|
-
if (!
|
|
8578
|
+
if (!v.isReserved(B, R - I)) {
|
|
8573
8579
|
let U = !1;
|
|
8574
|
-
M <
|
|
8580
|
+
M < S.length && (U = (S[M] >>> T & 1) === 1), v.set(B, R - I, U), T--, T === -1 && (M++, T = 7);
|
|
8575
8581
|
}
|
|
8576
8582
|
if (B += C, B < 0 || L <= B) {
|
|
8577
8583
|
B -= C, C = -C;
|
|
@@ -8579,25 +8585,25 @@ function Ha() {
|
|
|
8579
8585
|
}
|
|
8580
8586
|
}
|
|
8581
8587
|
}
|
|
8582
|
-
function N(
|
|
8588
|
+
function N(v, S, L) {
|
|
8583
8589
|
const C = new o();
|
|
8584
8590
|
L.forEach(function(I) {
|
|
8585
|
-
C.put(I.mode.bit, 4), C.put(I.getLength(), f.getCharCountIndicator(I.mode,
|
|
8591
|
+
C.put(I.mode.bit, 4), C.put(I.getLength(), f.getCharCountIndicator(I.mode, v)), I.write(C);
|
|
8586
8592
|
});
|
|
8587
|
-
const B = t.getSymbolTotalCodewords(
|
|
8593
|
+
const B = t.getSymbolTotalCodewords(v), T = c.getTotalCodewordsCount(v, S), M = (B - T) * 8;
|
|
8588
8594
|
for (C.getLengthInBits() + 4 <= M && C.put(0, 4); C.getLengthInBits() % 8 !== 0; )
|
|
8589
8595
|
C.putBit(0);
|
|
8590
8596
|
const R = (M - C.getLengthInBits()) / 8;
|
|
8591
8597
|
for (let I = 0; I < R; I++)
|
|
8592
8598
|
C.put(I % 2 ? 17 : 236, 8);
|
|
8593
|
-
return
|
|
8599
|
+
return E(C, v, S);
|
|
8594
8600
|
}
|
|
8595
|
-
function
|
|
8596
|
-
const C = t.getSymbolTotalCodewords(
|
|
8601
|
+
function E(v, S, L) {
|
|
8602
|
+
const C = t.getSymbolTotalCodewords(S), B = c.getTotalCodewordsCount(S, L), T = C - B, M = c.getBlocksCount(S, L), R = C % M, I = M - R, U = Math.floor(C / M), ee = Math.floor(T / M), pe = ee + 1, re = U - ee, Q = new d(re);
|
|
8597
8603
|
let D = 0;
|
|
8598
8604
|
const F = new Array(M), K = new Array(M);
|
|
8599
8605
|
let se = 0;
|
|
8600
|
-
const ne = new Uint8Array(
|
|
8606
|
+
const ne = new Uint8Array(v.buffer);
|
|
8601
8607
|
for (let G = 0; G < M; G++) {
|
|
8602
8608
|
const de = G < I ? ee : pe;
|
|
8603
8609
|
F[G] = ne.slice(D, D + de), K[G] = Q.encode(F[G]), D += de, se = Math.max(se, de);
|
|
@@ -8612,48 +8618,48 @@ function Ha() {
|
|
|
8612
8618
|
ge[me++] = K[z][V];
|
|
8613
8619
|
return ge;
|
|
8614
8620
|
}
|
|
8615
|
-
function P(
|
|
8621
|
+
function P(v, S, L, C) {
|
|
8616
8622
|
let B;
|
|
8617
|
-
if (Array.isArray(
|
|
8618
|
-
B = g.fromArray(
|
|
8619
|
-
else if (typeof
|
|
8620
|
-
let U =
|
|
8623
|
+
if (Array.isArray(v))
|
|
8624
|
+
B = g.fromArray(v);
|
|
8625
|
+
else if (typeof v == "string") {
|
|
8626
|
+
let U = S;
|
|
8621
8627
|
if (!U) {
|
|
8622
|
-
const ee = g.rawSplit(
|
|
8628
|
+
const ee = g.rawSplit(v);
|
|
8623
8629
|
U = u.getBestVersionForData(ee, L);
|
|
8624
8630
|
}
|
|
8625
|
-
B = g.fromString(
|
|
8631
|
+
B = g.fromString(v, U || 40);
|
|
8626
8632
|
} else
|
|
8627
8633
|
throw new Error("Invalid data");
|
|
8628
8634
|
const T = u.getBestVersionForData(B, L);
|
|
8629
8635
|
if (!T)
|
|
8630
8636
|
throw new Error("The amount of data is too big to be stored in a QR Code");
|
|
8631
|
-
if (!
|
|
8632
|
-
|
|
8633
|
-
else if (
|
|
8637
|
+
if (!S)
|
|
8638
|
+
S = T;
|
|
8639
|
+
else if (S < T)
|
|
8634
8640
|
throw new Error(
|
|
8635
8641
|
`
|
|
8636
8642
|
The chosen QR Code version cannot contain this amount of data.
|
|
8637
8643
|
Minimum version required to store current data is: ` + T + `.
|
|
8638
8644
|
`
|
|
8639
8645
|
);
|
|
8640
|
-
const M = N(
|
|
8641
|
-
return w(I,
|
|
8646
|
+
const M = N(S, L, B), R = t.getSymbolSize(S), I = new a(R);
|
|
8647
|
+
return w(I, S), p(I), h(I, S), b(I, L, 0), S >= 7 && y(I, S), A(I, M), isNaN(C) && (C = l.getBestMask(
|
|
8642
8648
|
I,
|
|
8643
8649
|
b.bind(null, I, L)
|
|
8644
8650
|
)), l.applyMask(C, I), b(I, L, C), {
|
|
8645
8651
|
modules: I,
|
|
8646
|
-
version:
|
|
8652
|
+
version: S,
|
|
8647
8653
|
errorCorrectionLevel: L,
|
|
8648
8654
|
maskPattern: C,
|
|
8649
8655
|
segments: B
|
|
8650
8656
|
};
|
|
8651
8657
|
}
|
|
8652
|
-
return pt.create = function(
|
|
8653
|
-
if (typeof
|
|
8658
|
+
return pt.create = function(S, L) {
|
|
8659
|
+
if (typeof S > "u" || S === "")
|
|
8654
8660
|
throw new Error("No input text");
|
|
8655
8661
|
let C = r.M, B, T;
|
|
8656
|
-
return typeof L < "u" && (C = r.from(L.errorCorrectionLevel, r.M), B = u.from(L.version), T = l.from(L.maskPattern), L.toSJISFunc && t.setToSJISFunction(L.toSJISFunc)), P(
|
|
8662
|
+
return typeof L < "u" && (C = r.from(L.errorCorrectionLevel, r.M), B = u.from(L.version), T = l.from(L.maskPattern), L.toSJISFunc && t.setToSJISFunction(L.toSJISFunc)), P(S, B, C, T);
|
|
8657
8663
|
}, pt;
|
|
8658
8664
|
}
|
|
8659
8665
|
var Bt = {}, Rt = {}, Ir;
|
|
@@ -8850,10 +8856,10 @@ function ks() {
|
|
|
8850
8856
|
), w = x(async () => {
|
|
8851
8857
|
u(!0), f(null);
|
|
8852
8858
|
try {
|
|
8853
|
-
const
|
|
8854
|
-
return a(
|
|
8855
|
-
} catch (
|
|
8856
|
-
const P = W(
|
|
8859
|
+
const E = await g.get("/mfa/status");
|
|
8860
|
+
return a(E), E;
|
|
8861
|
+
} catch (E) {
|
|
8862
|
+
const P = W(E, "Unable to load two-factor authentication status. Please try again.");
|
|
8857
8863
|
throw f(P), P;
|
|
8858
8864
|
} finally {
|
|
8859
8865
|
u(!1);
|
|
@@ -8861,17 +8867,17 @@ function ks() {
|
|
|
8861
8867
|
}, [g]), p = x(async () => {
|
|
8862
8868
|
u(!0), f(null), n("loading");
|
|
8863
8869
|
try {
|
|
8864
|
-
const
|
|
8865
|
-
return c(
|
|
8866
|
-
} catch (
|
|
8867
|
-
const P = W(
|
|
8870
|
+
const E = await g.post("/mfa/setup", {});
|
|
8871
|
+
return c(E), n("setup"), E;
|
|
8872
|
+
} catch (E) {
|
|
8873
|
+
const P = W(E, "Unable to start two-factor setup. Please try again.");
|
|
8868
8874
|
throw f(P), n("error"), P;
|
|
8869
8875
|
} finally {
|
|
8870
8876
|
u(!1);
|
|
8871
8877
|
}
|
|
8872
8878
|
}, [g]), h = x(
|
|
8873
|
-
async (
|
|
8874
|
-
if (!/^\d{6}$/.test(
|
|
8879
|
+
async (E) => {
|
|
8880
|
+
if (!/^\d{6}$/.test(E)) {
|
|
8875
8881
|
const P = {
|
|
8876
8882
|
code: "VALIDATION_ERROR",
|
|
8877
8883
|
message: "Please enter a 6-digit code"
|
|
@@ -8880,7 +8886,7 @@ function ks() {
|
|
|
8880
8886
|
}
|
|
8881
8887
|
u(!0), f(null), n("verifying");
|
|
8882
8888
|
try {
|
|
8883
|
-
await g.post("/mfa/enable", { code:
|
|
8889
|
+
await g.post("/mfa/enable", { code: E }), n("success");
|
|
8884
8890
|
try {
|
|
8885
8891
|
const P = await g.get("/mfa/status");
|
|
8886
8892
|
a(P);
|
|
@@ -8888,16 +8894,16 @@ function ks() {
|
|
|
8888
8894
|
a({ enabled: !0, recoveryCodesRemaining: 0 });
|
|
8889
8895
|
}
|
|
8890
8896
|
} catch (P) {
|
|
8891
|
-
const
|
|
8892
|
-
throw f(
|
|
8897
|
+
const v = W(P, "Incorrect verification code. Please check and try again.");
|
|
8898
|
+
throw f(v), n("error"), v;
|
|
8893
8899
|
} finally {
|
|
8894
8900
|
u(!1);
|
|
8895
8901
|
}
|
|
8896
8902
|
},
|
|
8897
8903
|
[g]
|
|
8898
8904
|
), y = x(
|
|
8899
|
-
async (
|
|
8900
|
-
if (!
|
|
8905
|
+
async (E) => {
|
|
8906
|
+
if (!E) {
|
|
8901
8907
|
const P = {
|
|
8902
8908
|
code: "VALIDATION_ERROR",
|
|
8903
8909
|
message: "Please enter your password"
|
|
@@ -8906,18 +8912,18 @@ function ks() {
|
|
|
8906
8912
|
}
|
|
8907
8913
|
u(!0), f(null);
|
|
8908
8914
|
try {
|
|
8909
|
-
await g.post("/mfa/disable", { password:
|
|
8915
|
+
await g.post("/mfa/disable", { password: E }), a({ enabled: !1, recoveryCodesRemaining: 0 }), c(null), n("idle");
|
|
8910
8916
|
} catch (P) {
|
|
8911
|
-
const
|
|
8912
|
-
throw f(
|
|
8917
|
+
const v = W(P, "Unable to disable two-factor authentication. Please try again.");
|
|
8918
|
+
throw f(v), v;
|
|
8913
8919
|
} finally {
|
|
8914
8920
|
u(!1);
|
|
8915
8921
|
}
|
|
8916
8922
|
},
|
|
8917
8923
|
[g]
|
|
8918
8924
|
), b = x(
|
|
8919
|
-
async (
|
|
8920
|
-
if (!/^\d{6}$/.test(
|
|
8925
|
+
async (E) => {
|
|
8926
|
+
if (!/^\d{6}$/.test(E)) {
|
|
8921
8927
|
const P = {
|
|
8922
8928
|
code: "VALIDATION_ERROR",
|
|
8923
8929
|
message: "Please enter a 6-digit code"
|
|
@@ -8928,17 +8934,17 @@ function ks() {
|
|
|
8928
8934
|
try {
|
|
8929
8935
|
return await g.post(
|
|
8930
8936
|
"/mfa/recovery-codes/regenerate",
|
|
8931
|
-
{ code:
|
|
8937
|
+
{ code: E }
|
|
8932
8938
|
);
|
|
8933
8939
|
} catch (P) {
|
|
8934
|
-
const
|
|
8935
|
-
throw f(
|
|
8940
|
+
const v = W(P, "Unable to regenerate recovery codes. Please try again.");
|
|
8941
|
+
throw f(v), v;
|
|
8936
8942
|
} finally {
|
|
8937
8943
|
u(!1);
|
|
8938
8944
|
}
|
|
8939
8945
|
},
|
|
8940
8946
|
[g]
|
|
8941
|
-
),
|
|
8947
|
+
), A = x(() => f(null), []), N = x(() => {
|
|
8942
8948
|
f(null), c(null), n("idle"), u(!1);
|
|
8943
8949
|
}, []);
|
|
8944
8950
|
return {
|
|
@@ -8952,19 +8958,19 @@ function ks() {
|
|
|
8952
8958
|
enableTotp: h,
|
|
8953
8959
|
disableTotp: y,
|
|
8954
8960
|
regenerateBackupCodes: b,
|
|
8955
|
-
clearError:
|
|
8961
|
+
clearError: A,
|
|
8956
8962
|
reset: N
|
|
8957
8963
|
};
|
|
8958
8964
|
}
|
|
8959
8965
|
function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
8960
|
-
const { setupState: a, setupData: s, isLoading: n, error: l, beginSetup: c, enableTotp: d, clearError: u, reset: m } = ks(), [f, g] = k("qr"), [w, p] = k(""), [h, y] = k(!1), [b,
|
|
8966
|
+
const { setupState: a, setupData: s, isLoading: n, error: l, beginSetup: c, enableTotp: d, clearError: u, reset: m } = ks(), [f, g] = k("qr"), [w, p] = k(""), [h, y] = k(!1), [b, A] = k(!1), N = J(null);
|
|
8961
8967
|
_(() => {
|
|
8962
8968
|
a === "idle" && c().catch(() => {
|
|
8963
8969
|
});
|
|
8964
8970
|
}, [a, c]), _(() => {
|
|
8965
8971
|
a === "success" && t?.();
|
|
8966
8972
|
}, [a, t]);
|
|
8967
|
-
const
|
|
8973
|
+
const E = async () => {
|
|
8968
8974
|
s?.secret && (await navigator.clipboard.writeText(s.secret), y(!0), N.current !== null && window.clearTimeout(N.current), N.current = window.setTimeout(() => y(!1), 2e3));
|
|
8969
8975
|
}, P = async () => {
|
|
8970
8976
|
if (s?.recoveryCodes) {
|
|
@@ -8972,13 +8978,13 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
8972
8978
|
`);
|
|
8973
8979
|
await navigator.clipboard.writeText(L);
|
|
8974
8980
|
}
|
|
8975
|
-
},
|
|
8981
|
+
}, v = async () => {
|
|
8976
8982
|
try {
|
|
8977
8983
|
await d(w);
|
|
8978
8984
|
} catch {
|
|
8979
8985
|
p("");
|
|
8980
8986
|
}
|
|
8981
|
-
},
|
|
8987
|
+
}, S = () => {
|
|
8982
8988
|
m(), r?.();
|
|
8983
8989
|
};
|
|
8984
8990
|
return _(() => () => {
|
|
@@ -8991,7 +8997,7 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
8991
8997
|
{
|
|
8992
8998
|
type: "button",
|
|
8993
8999
|
className: "cedros-button cedros-button-outline cedros-button-md",
|
|
8994
|
-
onClick:
|
|
9000
|
+
onClick: S,
|
|
8995
9001
|
children: "Cancel"
|
|
8996
9002
|
}
|
|
8997
9003
|
),
|
|
@@ -9046,7 +9052,7 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9046
9052
|
{
|
|
9047
9053
|
type: "button",
|
|
9048
9054
|
className: "cedros-button cedros-button-ghost cedros-button-sm",
|
|
9049
|
-
onClick:
|
|
9055
|
+
onClick: E,
|
|
9050
9056
|
"aria-label": "Copy secret",
|
|
9051
9057
|
children: h ? "Copied!" : "Copy"
|
|
9052
9058
|
}
|
|
@@ -9059,7 +9065,7 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9059
9065
|
{
|
|
9060
9066
|
type: "button",
|
|
9061
9067
|
className: "cedros-button cedros-button-outline cedros-button-md",
|
|
9062
|
-
onClick:
|
|
9068
|
+
onClick: S,
|
|
9063
9069
|
children: "Cancel"
|
|
9064
9070
|
}
|
|
9065
9071
|
),
|
|
@@ -9094,7 +9100,7 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9094
9100
|
type: "checkbox",
|
|
9095
9101
|
className: "cedros-checkbox",
|
|
9096
9102
|
checked: b,
|
|
9097
|
-
onChange: (L) =>
|
|
9103
|
+
onChange: (L) => A(L.target.checked)
|
|
9098
9104
|
}
|
|
9099
9105
|
),
|
|
9100
9106
|
/* @__PURE__ */ e("span", { className: "cedros-checkbox-text", children: "I have saved these recovery codes" })
|
|
@@ -9129,7 +9135,7 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9129
9135
|
{
|
|
9130
9136
|
value: w,
|
|
9131
9137
|
onChange: p,
|
|
9132
|
-
onComplete:
|
|
9138
|
+
onComplete: v,
|
|
9133
9139
|
disabled: n,
|
|
9134
9140
|
error: l?.message,
|
|
9135
9141
|
autoFocus: !0
|
|
@@ -9151,7 +9157,7 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9151
9157
|
{
|
|
9152
9158
|
type: "button",
|
|
9153
9159
|
className: "cedros-button cedros-button-primary cedros-button-md",
|
|
9154
|
-
onClick:
|
|
9160
|
+
onClick: v,
|
|
9155
9161
|
disabled: n || w.length !== 6,
|
|
9156
9162
|
children: n ? /* @__PURE__ */ i($, { children: [
|
|
9157
9163
|
/* @__PURE__ */ e(j, { size: "sm" }),
|
|
@@ -9164,31 +9170,31 @@ function Ns({ onSuccess: t, onCancel: r, className: o = "" }) {
|
|
|
9164
9170
|
] }) : null;
|
|
9165
9171
|
}
|
|
9166
9172
|
function Xa({ onStatusChange: t, className: r = "" }) {
|
|
9167
|
-
const { status: o, isLoading: a, error: s, getStatus: n, disableTotp: l, regenerateBackupCodes: c, clearError: d } = ks(), [u, m] = k("status"), [f, g] = k(""), [w, p] = k(""), [h, y] = k(null), [b,
|
|
9173
|
+
const { status: o, isLoading: a, error: s, getStatus: n, disableTotp: l, regenerateBackupCodes: c, clearError: d } = ks(), [u, m] = k("status"), [f, g] = k(""), [w, p] = k(""), [h, y] = k(null), [b, A] = k(!1), [N, E] = k(null);
|
|
9168
9174
|
_(() => {
|
|
9169
9175
|
n().catch(() => {
|
|
9170
9176
|
});
|
|
9171
9177
|
}, [n]);
|
|
9172
9178
|
const P = x(() => {
|
|
9173
9179
|
m("status"), t?.(!0);
|
|
9174
|
-
}, [t]),
|
|
9175
|
-
|
|
9180
|
+
}, [t]), v = async () => {
|
|
9181
|
+
A(!0), E(null);
|
|
9176
9182
|
try {
|
|
9177
9183
|
await l(f), m("status"), g(""), t?.(!1);
|
|
9178
9184
|
} catch (C) {
|
|
9179
|
-
|
|
9185
|
+
E(C instanceof Error ? C.message : "Failed to disable 2FA"), g("");
|
|
9180
9186
|
} finally {
|
|
9181
|
-
|
|
9187
|
+
A(!1);
|
|
9182
9188
|
}
|
|
9183
|
-
},
|
|
9184
|
-
|
|
9189
|
+
}, S = async () => {
|
|
9190
|
+
A(!0), E(null);
|
|
9185
9191
|
try {
|
|
9186
9192
|
const C = await c(w);
|
|
9187
9193
|
y(C.recoveryCodes), p("");
|
|
9188
9194
|
} catch (C) {
|
|
9189
|
-
|
|
9195
|
+
E(C instanceof Error ? C.message : "Failed to regenerate codes"), p("");
|
|
9190
9196
|
} finally {
|
|
9191
|
-
|
|
9197
|
+
A(!1);
|
|
9192
9198
|
}
|
|
9193
9199
|
}, L = async () => {
|
|
9194
9200
|
h && await navigator.clipboard.writeText(h.join(`
|
|
@@ -9212,7 +9218,7 @@ function Xa({ onStatusChange: t, className: r = "" }) {
|
|
|
9212
9218
|
X,
|
|
9213
9219
|
{
|
|
9214
9220
|
error: { code: "UNKNOWN_ERROR", message: N },
|
|
9215
|
-
onDismiss: () =>
|
|
9221
|
+
onDismiss: () => E(null)
|
|
9216
9222
|
}
|
|
9217
9223
|
) }),
|
|
9218
9224
|
/* @__PURE__ */ e("div", { className: "cedros-totp-verify-input", children: /* @__PURE__ */ e(
|
|
@@ -9233,7 +9239,7 @@ function Xa({ onStatusChange: t, className: r = "" }) {
|
|
|
9233
9239
|
type: "button",
|
|
9234
9240
|
className: "cedros-button cedros-button-outline cedros-button-md",
|
|
9235
9241
|
onClick: () => {
|
|
9236
|
-
m("status"), g(""),
|
|
9242
|
+
m("status"), g(""), E(null);
|
|
9237
9243
|
},
|
|
9238
9244
|
disabled: b,
|
|
9239
9245
|
children: "Cancel"
|
|
@@ -9244,7 +9250,7 @@ function Xa({ onStatusChange: t, className: r = "" }) {
|
|
|
9244
9250
|
{
|
|
9245
9251
|
type: "button",
|
|
9246
9252
|
className: "cedros-button cedros-button-destructive cedros-button-md",
|
|
9247
|
-
onClick:
|
|
9253
|
+
onClick: v,
|
|
9248
9254
|
disabled: b || f.length === 0,
|
|
9249
9255
|
children: b ? /* @__PURE__ */ i($, { children: [
|
|
9250
9256
|
/* @__PURE__ */ e(j, { size: "sm" }),
|
|
@@ -9284,7 +9290,7 @@ function Xa({ onStatusChange: t, className: r = "" }) {
|
|
|
9284
9290
|
X,
|
|
9285
9291
|
{
|
|
9286
9292
|
error: { code: "UNKNOWN_ERROR", message: N },
|
|
9287
|
-
onDismiss: () =>
|
|
9293
|
+
onDismiss: () => E(null)
|
|
9288
9294
|
}
|
|
9289
9295
|
) }),
|
|
9290
9296
|
/* @__PURE__ */ e("div", { className: "cedros-totp-verify-input", children: /* @__PURE__ */ e(
|
|
@@ -9292,7 +9298,7 @@ function Xa({ onStatusChange: t, className: r = "" }) {
|
|
|
9292
9298
|
{
|
|
9293
9299
|
value: w,
|
|
9294
9300
|
onChange: p,
|
|
9295
|
-
onComplete:
|
|
9301
|
+
onComplete: S,
|
|
9296
9302
|
disabled: b,
|
|
9297
9303
|
autoFocus: !0
|
|
9298
9304
|
}
|
|
@@ -9304,7 +9310,7 @@ function Xa({ onStatusChange: t, className: r = "" }) {
|
|
|
9304
9310
|
type: "button",
|
|
9305
9311
|
className: "cedros-button cedros-button-outline cedros-button-md",
|
|
9306
9312
|
onClick: () => {
|
|
9307
|
-
m("status"), p(""),
|
|
9313
|
+
m("status"), p(""), E(null);
|
|
9308
9314
|
},
|
|
9309
9315
|
disabled: b,
|
|
9310
9316
|
children: "Cancel"
|
|
@@ -9315,7 +9321,7 @@ function Xa({ onStatusChange: t, className: r = "" }) {
|
|
|
9315
9321
|
{
|
|
9316
9322
|
type: "button",
|
|
9317
9323
|
className: "cedros-button cedros-button-primary cedros-button-md",
|
|
9318
|
-
onClick:
|
|
9324
|
+
onClick: S,
|
|
9319
9325
|
disabled: b || w.length !== 6,
|
|
9320
9326
|
children: b ? /* @__PURE__ */ i($, { children: [
|
|
9321
9327
|
/* @__PURE__ */ e(j, { size: "sm" }),
|
|
@@ -9459,8 +9465,8 @@ function _c({
|
|
|
9459
9465
|
onClose: r,
|
|
9460
9466
|
className: o = ""
|
|
9461
9467
|
}) {
|
|
9462
|
-
const { user: a } = et(), { isLoading: s, error: n, changePassword: l, clearError: c } = st(), [d, u] = k("main"), [m, f] = k(""), [g, w] = k(""), [p, h] = k(""), [y, b] = k(null), [
|
|
9463
|
-
if (
|
|
9468
|
+
const { user: a } = et(), { isLoading: s, error: n, changePassword: l, clearError: c } = st(), [d, u] = k("main"), [m, f] = k(""), [g, w] = k(""), [p, h] = k(""), [y, b] = k(null), [A, N] = k(null), E = rt(g), P = g === p, v = m.length > 0 && g.length > 0 && p.length > 0 && E.isValid && P, S = x(async () => {
|
|
9469
|
+
if (v) {
|
|
9464
9470
|
b(null), N(null);
|
|
9465
9471
|
try {
|
|
9466
9472
|
await l({
|
|
@@ -9473,7 +9479,7 @@ function _c({
|
|
|
9473
9479
|
b(B instanceof Error ? B.message : "Failed to change password");
|
|
9474
9480
|
}
|
|
9475
9481
|
}
|
|
9476
|
-
}, [
|
|
9482
|
+
}, [v, m, g, l, t]), L = x(() => {
|
|
9477
9483
|
u("main"), f(""), w(""), h(""), b(null), c();
|
|
9478
9484
|
}, [c]), C = () => a?.name ? a.name.split(" ").map((B) => B[0]).join("").toUpperCase().slice(0, 2) : a?.email ? a.email[0].toUpperCase() : "?";
|
|
9479
9485
|
return d === "change-password" ? /* @__PURE__ */ e("div", { className: `cedros-profile-settings ${o}`, children: /* @__PURE__ */ i("div", { className: "cedros-profile-panel", children: [
|
|
@@ -9488,9 +9494,9 @@ function _c({
|
|
|
9488
9494
|
}
|
|
9489
9495
|
}
|
|
9490
9496
|
) }),
|
|
9491
|
-
|
|
9497
|
+
A && /* @__PURE__ */ i("div", { className: "cedros-profile-success", children: [
|
|
9492
9498
|
/* @__PURE__ */ e("span", { className: "cedros-profile-success-icon", children: "✓" }),
|
|
9493
|
-
|
|
9499
|
+
A
|
|
9494
9500
|
] }),
|
|
9495
9501
|
/* @__PURE__ */ i("div", { className: "cedros-profile-form", children: [
|
|
9496
9502
|
/* @__PURE__ */ e("div", { className: "cedros-profile-field", children: /* @__PURE__ */ e(
|
|
@@ -9543,8 +9549,8 @@ function _c({
|
|
|
9543
9549
|
{
|
|
9544
9550
|
type: "button",
|
|
9545
9551
|
className: "cedros-button cedros-button-primary cedros-button-md",
|
|
9546
|
-
onClick:
|
|
9547
|
-
disabled: s || !
|
|
9552
|
+
onClick: S,
|
|
9553
|
+
disabled: s || !v,
|
|
9548
9554
|
children: s ? /* @__PURE__ */ i($, { children: [
|
|
9549
9555
|
/* @__PURE__ */ e(j, { size: "sm" }),
|
|
9550
9556
|
/* @__PURE__ */ e("span", { children: "Changing..." })
|
|
@@ -9683,13 +9689,13 @@ function ti({
|
|
|
9683
9689
|
onCancel: r,
|
|
9684
9690
|
className: o = ""
|
|
9685
9691
|
}) {
|
|
9686
|
-
const { isLoading: a, error: s, changePassword: n, clearError: l } = st(), [c, d] = k(""), [u, m] = k(""), [f, g] = k(""), [w, p] = k(null), [h, y] = k(null), b = rt(u),
|
|
9692
|
+
const { isLoading: a, error: s, changePassword: n, clearError: l } = st(), [c, d] = k(""), [u, m] = k(""), [f, g] = k(""), [w, p] = k(null), [h, y] = k(null), b = rt(u), A = u === f, N = c.length > 0 && u.length > 0 && f.length > 0 && b.isValid && A, E = x(async () => {
|
|
9687
9693
|
if (N) {
|
|
9688
9694
|
p(null), y(null);
|
|
9689
9695
|
try {
|
|
9690
9696
|
await n({ currentPassword: c, newPassword: u }), d(""), m(""), g(""), y("Password changed successfully. Other sessions have been logged out."), t?.(), setTimeout(() => r(), 2e3);
|
|
9691
|
-
} catch (
|
|
9692
|
-
p(
|
|
9697
|
+
} catch (v) {
|
|
9698
|
+
p(v instanceof Error ? v.message : "Failed to change password");
|
|
9693
9699
|
}
|
|
9694
9700
|
}
|
|
9695
9701
|
}, [N, c, u, n, t, r]), P = x(() => {
|
|
@@ -9718,7 +9724,7 @@ function ti({
|
|
|
9718
9724
|
label: "Current password",
|
|
9719
9725
|
placeholder: "Enter your current password",
|
|
9720
9726
|
value: c,
|
|
9721
|
-
onChange: (
|
|
9727
|
+
onChange: (v) => d(v.target.value),
|
|
9722
9728
|
disabled: a,
|
|
9723
9729
|
autoFocus: !0
|
|
9724
9730
|
}
|
|
@@ -9729,7 +9735,7 @@ function ti({
|
|
|
9729
9735
|
label: "New password",
|
|
9730
9736
|
placeholder: "Enter new password",
|
|
9731
9737
|
value: u,
|
|
9732
|
-
onChange: (
|
|
9738
|
+
onChange: (v) => m(v.target.value),
|
|
9733
9739
|
disabled: a,
|
|
9734
9740
|
showStrengthMeter: !0
|
|
9735
9741
|
}
|
|
@@ -9740,9 +9746,9 @@ function ti({
|
|
|
9740
9746
|
label: "Confirm new password",
|
|
9741
9747
|
placeholder: "Confirm new password",
|
|
9742
9748
|
value: f,
|
|
9743
|
-
onChange: (
|
|
9749
|
+
onChange: (v) => g(v.target.value),
|
|
9744
9750
|
disabled: a,
|
|
9745
|
-
error: f.length > 0 && !
|
|
9751
|
+
error: f.length > 0 && !A ? "Passwords do not match" : void 0
|
|
9746
9752
|
}
|
|
9747
9753
|
) })
|
|
9748
9754
|
] }),
|
|
@@ -9762,7 +9768,7 @@ function ti({
|
|
|
9762
9768
|
{
|
|
9763
9769
|
type: "button",
|
|
9764
9770
|
className: "cedros-button cedros-button-primary cedros-button-md",
|
|
9765
|
-
onClick:
|
|
9771
|
+
onClick: E,
|
|
9766
9772
|
disabled: a || !N,
|
|
9767
9773
|
children: a ? /* @__PURE__ */ i($, { children: [
|
|
9768
9774
|
/* @__PURE__ */ e(j, { size: "sm" }),
|
|
@@ -9779,9 +9785,9 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9779
9785
|
isLoading: m,
|
|
9780
9786
|
isSuccess: f,
|
|
9781
9787
|
reset: g
|
|
9782
|
-
} = Qt(), w = d.some((C) => C.credentialType === "password"), [p, h] = k("view"), [y, b] = k(""), [
|
|
9788
|
+
} = Qt(), w = d.some((C) => C.credentialType === "password"), [p, h] = k("view"), [y, b] = k(""), [A, N] = k(null), E = () => o?.name ? o.name.split(" ").map((C) => C[0]).join("").toUpperCase().slice(0, 2) : o?.email ? o.email[0].toUpperCase() : "?", P = x(() => {
|
|
9783
9789
|
b(o?.name || ""), h("edit"), N(null);
|
|
9784
|
-
}, [o?.name]),
|
|
9790
|
+
}, [o?.name]), v = x(async () => {
|
|
9785
9791
|
const C = y.trim();
|
|
9786
9792
|
if (C) {
|
|
9787
9793
|
N(null);
|
|
@@ -9791,7 +9797,7 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9791
9797
|
N(B instanceof Error ? B.message : "Failed to update name");
|
|
9792
9798
|
}
|
|
9793
9799
|
}
|
|
9794
|
-
}, [y, l, a]),
|
|
9800
|
+
}, [y, l, a]), S = x(() => {
|
|
9795
9801
|
h("view"), b(""), N(null), c();
|
|
9796
9802
|
}, [c]), L = x(async () => {
|
|
9797
9803
|
if (o?.email) {
|
|
@@ -9819,7 +9825,7 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9819
9825
|
alt: o.name || "Profile",
|
|
9820
9826
|
className: "cedros-profile-avatar"
|
|
9821
9827
|
}
|
|
9822
|
-
) : /* @__PURE__ */ e("div", { className: "cedros-profile-avatar cedros-profile-avatar-fallback", children:
|
|
9828
|
+
) : /* @__PURE__ */ e("div", { className: "cedros-profile-avatar cedros-profile-avatar-fallback", children: E() }) }),
|
|
9823
9829
|
/* @__PURE__ */ i("div", { className: "cedros-profile-info", children: [
|
|
9824
9830
|
p === "edit" ? /* @__PURE__ */ i("div", { className: "cedros-profile-name-edit", children: [
|
|
9825
9831
|
/* @__PURE__ */ e(
|
|
@@ -9832,7 +9838,7 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9832
9838
|
disabled: s,
|
|
9833
9839
|
autoFocus: !0,
|
|
9834
9840
|
onKeyDown: (C) => {
|
|
9835
|
-
C.key === "Enter" &&
|
|
9841
|
+
C.key === "Enter" && v(), C.key === "Escape" && S();
|
|
9836
9842
|
}
|
|
9837
9843
|
}
|
|
9838
9844
|
),
|
|
@@ -9842,7 +9848,7 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9842
9848
|
{
|
|
9843
9849
|
type: "button",
|
|
9844
9850
|
className: "cedros-button cedros-button-primary cedros-button-sm",
|
|
9845
|
-
onClick:
|
|
9851
|
+
onClick: v,
|
|
9846
9852
|
disabled: s || !y.trim(),
|
|
9847
9853
|
children: s ? /* @__PURE__ */ e(j, { size: "sm" }) : "Save"
|
|
9848
9854
|
}
|
|
@@ -9852,7 +9858,7 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9852
9858
|
{
|
|
9853
9859
|
type: "button",
|
|
9854
9860
|
className: "cedros-button cedros-button-outline cedros-button-sm",
|
|
9855
|
-
onClick:
|
|
9861
|
+
onClick: S,
|
|
9856
9862
|
disabled: s,
|
|
9857
9863
|
children: "Cancel"
|
|
9858
9864
|
}
|
|
@@ -9875,10 +9881,10 @@ function ri({ onPasswordChange: t, className: r = "" }) {
|
|
|
9875
9881
|
/* @__PURE__ */ e("p", { className: "cedros-profile-email", children: o?.email })
|
|
9876
9882
|
] })
|
|
9877
9883
|
] }),
|
|
9878
|
-
(
|
|
9884
|
+
(A || n) && /* @__PURE__ */ e("div", { className: "cedros-profile-error", children: /* @__PURE__ */ e(
|
|
9879
9885
|
X,
|
|
9880
9886
|
{
|
|
9881
|
-
error: { code: "UNKNOWN_ERROR", message:
|
|
9887
|
+
error: { code: "UNKNOWN_ERROR", message: A || n?.message || "" },
|
|
9882
9888
|
onDismiss: () => {
|
|
9883
9889
|
N(null), c();
|
|
9884
9890
|
}
|
|
@@ -9984,7 +9990,7 @@ function oi({
|
|
|
9984
9990
|
} finally {
|
|
9985
9991
|
y(!1);
|
|
9986
9992
|
}
|
|
9987
|
-
}, [o, f, m]),
|
|
9993
|
+
}, [o, f, m]), A = x(
|
|
9988
9994
|
async (C) => {
|
|
9989
9995
|
const B = C.label || Es[C.credentialType];
|
|
9990
9996
|
if (window.confirm(
|
|
@@ -10000,7 +10006,7 @@ function oi({
|
|
|
10000
10006
|
}
|
|
10001
10007
|
},
|
|
10002
10008
|
[d]
|
|
10003
|
-
), N = new Set(n.map((C) => C.credentialType)),
|
|
10009
|
+
), N = new Set(n.map((C) => C.credentialType)), E = t && !N.has("oauth_google"), P = r && !N.has("oauth_apple"), v = (o || g) && !N.has("webauthn_passkey"), S = a && !N.has("solana"), L = E || P || v || S;
|
|
10004
10010
|
return l && n.length === 0 ? /* @__PURE__ */ i("div", { className: `cedros-linked-accounts ${s}`, children: [
|
|
10005
10011
|
/* @__PURE__ */ e(j, {}),
|
|
10006
10012
|
/* @__PURE__ */ e("span", { children: "Loading linked accounts..." })
|
|
@@ -10018,14 +10024,14 @@ function oi({
|
|
|
10018
10024
|
{
|
|
10019
10025
|
credential: C,
|
|
10020
10026
|
isUnlinking: w === C.id,
|
|
10021
|
-
onUnlink:
|
|
10027
|
+
onUnlink: A
|
|
10022
10028
|
},
|
|
10023
10029
|
C.id
|
|
10024
10030
|
)) }),
|
|
10025
10031
|
L && /* @__PURE__ */ i("div", { className: "cedros-linked-add", children: [
|
|
10026
10032
|
/* @__PURE__ */ e("p", { className: "cedros-linked-add-label", children: "Link a new sign-in method" }),
|
|
10027
10033
|
/* @__PURE__ */ i("div", { className: "cedros-linked-add-buttons", children: [
|
|
10028
|
-
|
|
10034
|
+
E && /* @__PURE__ */ i(
|
|
10029
10035
|
"button",
|
|
10030
10036
|
{
|
|
10031
10037
|
type: "button",
|
|
@@ -10049,7 +10055,7 @@ function oi({
|
|
|
10049
10055
|
]
|
|
10050
10056
|
}
|
|
10051
10057
|
),
|
|
10052
|
-
|
|
10058
|
+
v && /* @__PURE__ */ e(
|
|
10053
10059
|
"button",
|
|
10054
10060
|
{
|
|
10055
10061
|
type: "button",
|
|
@@ -10062,7 +10068,7 @@ function oi({
|
|
|
10062
10068
|
] })
|
|
10063
10069
|
}
|
|
10064
10070
|
),
|
|
10065
|
-
|
|
10071
|
+
S && /* @__PURE__ */ i(
|
|
10066
10072
|
"button",
|
|
10067
10073
|
{
|
|
10068
10074
|
type: "button",
|
|
@@ -10558,32 +10564,32 @@ function Ls({
|
|
|
10558
10564
|
}) {
|
|
10559
10565
|
const [d, u] = k(!1), [m, f] = k(""), g = J(null), w = J(null), p = q(() => {
|
|
10560
10566
|
if (!m.trim()) return t;
|
|
10561
|
-
const
|
|
10567
|
+
const A = m.toLowerCase();
|
|
10562
10568
|
return t.filter(
|
|
10563
|
-
(N) => N.symbol.toLowerCase().includes(
|
|
10569
|
+
(N) => N.symbol.toLowerCase().includes(A) || N.name.toLowerCase().includes(A) || N.mint.toLowerCase().includes(A)
|
|
10564
10570
|
);
|
|
10565
10571
|
}, [t, m]);
|
|
10566
10572
|
_(() => {
|
|
10567
|
-
const
|
|
10573
|
+
const A = (N) => {
|
|
10568
10574
|
g.current && !g.current.contains(N.target) && (u(!1), f(""));
|
|
10569
10575
|
};
|
|
10570
10576
|
if (d)
|
|
10571
|
-
return document.addEventListener("mousedown",
|
|
10577
|
+
return document.addEventListener("mousedown", A), () => document.removeEventListener("mousedown", A);
|
|
10572
10578
|
}, [d]), _(() => {
|
|
10573
10579
|
d && c && w.current && w.current.focus();
|
|
10574
10580
|
}, [d, c]), _(() => {
|
|
10575
10581
|
a === void 0 || n || (u(!0), f(""));
|
|
10576
10582
|
}, [a, n]);
|
|
10577
10583
|
const h = x(() => {
|
|
10578
|
-
n || (u((
|
|
10584
|
+
n || (u((A) => !A), d && f(""));
|
|
10579
10585
|
}, [n, d]), y = x(
|
|
10580
|
-
(
|
|
10581
|
-
o(
|
|
10586
|
+
(A) => {
|
|
10587
|
+
o(A), u(!1), f("");
|
|
10582
10588
|
},
|
|
10583
10589
|
[o]
|
|
10584
10590
|
), b = x(
|
|
10585
|
-
(
|
|
10586
|
-
|
|
10591
|
+
(A) => {
|
|
10592
|
+
A.key === "Escape" ? (u(!1), f("")) : A.key === "Enter" && p.length === 1 && y(p[0]);
|
|
10587
10593
|
},
|
|
10588
10594
|
[p, y]
|
|
10589
10595
|
);
|
|
@@ -10611,8 +10617,8 @@ function Ls({
|
|
|
10611
10617
|
src: r.logoUrl,
|
|
10612
10618
|
alt: r.symbol,
|
|
10613
10619
|
className: "cedros-token-icon",
|
|
10614
|
-
onError: (
|
|
10615
|
-
|
|
10620
|
+
onError: (A) => {
|
|
10621
|
+
A.target.style.display = "none";
|
|
10616
10622
|
}
|
|
10617
10623
|
}
|
|
10618
10624
|
),
|
|
@@ -10629,25 +10635,25 @@ function Ls({
|
|
|
10629
10635
|
ref: w,
|
|
10630
10636
|
type: "text",
|
|
10631
10637
|
value: m,
|
|
10632
|
-
onChange: (
|
|
10638
|
+
onChange: (A) => f(A.target.value),
|
|
10633
10639
|
placeholder: "Search tokens...",
|
|
10634
10640
|
className: "cedros-token-search-input"
|
|
10635
10641
|
}
|
|
10636
10642
|
) }),
|
|
10637
|
-
/* @__PURE__ */ e("div", { className: "cedros-token-list", children: p.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-token-empty", children: "No tokens found" }) : /* @__PURE__ */ e($, { children: p.map((
|
|
10643
|
+
/* @__PURE__ */ e("div", { className: "cedros-token-list", children: p.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-token-empty", children: "No tokens found" }) : /* @__PURE__ */ e($, { children: p.map((A) => /* @__PURE__ */ i(
|
|
10638
10644
|
"button",
|
|
10639
10645
|
{
|
|
10640
10646
|
type: "button",
|
|
10641
|
-
className: `cedros-token-option ${r?.mint ===
|
|
10642
|
-
onClick: () => y(
|
|
10647
|
+
className: `cedros-token-option ${r?.mint === A.mint ? "cedros-token-option-selected" : ""}`,
|
|
10648
|
+
onClick: () => y(A),
|
|
10643
10649
|
role: "option",
|
|
10644
|
-
"aria-selected": r?.mint ===
|
|
10650
|
+
"aria-selected": r?.mint === A.mint,
|
|
10645
10651
|
children: [
|
|
10646
|
-
|
|
10652
|
+
A.logoUrl && /* @__PURE__ */ e(
|
|
10647
10653
|
"img",
|
|
10648
10654
|
{
|
|
10649
|
-
src:
|
|
10650
|
-
alt:
|
|
10655
|
+
src: A.logoUrl,
|
|
10656
|
+
alt: A.symbol,
|
|
10651
10657
|
className: "cedros-token-icon",
|
|
10652
10658
|
onError: (N) => {
|
|
10653
10659
|
N.target.style.display = "none";
|
|
@@ -10655,13 +10661,13 @@ function Ls({
|
|
|
10655
10661
|
}
|
|
10656
10662
|
),
|
|
10657
10663
|
/* @__PURE__ */ i("span", { className: "cedros-token-info", children: [
|
|
10658
|
-
/* @__PURE__ */ e("span", { className: "cedros-token-symbol", children:
|
|
10659
|
-
/* @__PURE__ */ e("span", { className: "cedros-token-name", children:
|
|
10664
|
+
/* @__PURE__ */ e("span", { className: "cedros-token-symbol", children: A.symbol }),
|
|
10665
|
+
/* @__PURE__ */ e("span", { className: "cedros-token-name", children: A.name })
|
|
10660
10666
|
] }),
|
|
10661
|
-
r?.mint ===
|
|
10667
|
+
r?.mint === A.mint && /* @__PURE__ */ e("span", { className: "cedros-token-check", children: "✓" })
|
|
10662
10668
|
]
|
|
10663
10669
|
},
|
|
10664
|
-
|
|
10670
|
+
A.mint
|
|
10665
10671
|
)) }) })
|
|
10666
10672
|
] })
|
|
10667
10673
|
]
|
|
@@ -10816,8 +10822,8 @@ function Is(t, r, o) {
|
|
|
10816
10822
|
if (a.length === 0)
|
|
10817
10823
|
return `Total: $${s.toFixed(2)}`;
|
|
10818
10824
|
const n = a.reduce((p, h) => p + h.solAmount, 0), l = a.reduce((p, h) => p + h.percent, 0), c = { fee: 7, sol: 8, rate: 7, usd: 8 }, d = (p) => {
|
|
10819
|
-
const h = p.label.padEnd(c.fee), y = p.solAmount.toFixed(4).padStart(6).padEnd(c.sol), b = (p.percent.toFixed(2) + "%").padStart(5).padEnd(c.rate),
|
|
10820
|
-
return `${h} │ ${y} │ ${b} │ ${
|
|
10825
|
+
const h = p.label.padEnd(c.fee), y = p.solAmount.toFixed(4).padStart(6).padEnd(c.sol), b = (p.percent.toFixed(2) + "%").padStart(5).padEnd(c.rate), A = ("$" + Math.max(p.usdAmount, 0.01).toFixed(2)).padEnd(c.usd);
|
|
10826
|
+
return `${h} │ ${y} │ ${b} │ ${A}`;
|
|
10821
10827
|
}, u = `${"Fee".padEnd(c.fee)} │ ${"SOL".padEnd(c.sol)} │ ${"+ Rate".padEnd(c.rate)} │ ${"= Total".padEnd(c.usd)}`, m = `${"─".repeat(c.fee)}─┼─${"─".repeat(c.sol)}─┼─${"─".repeat(c.rate)}─┼─${"─".repeat(c.usd)}`, f = ("$" + s.toFixed(2)).padEnd(c.usd), g = `${"TOTAL".padEnd(c.fee)} │ ${n.toFixed(4).padStart(6).padEnd(c.sol)} │ ${(l.toFixed(2) + "%").padStart(5).padEnd(c.rate)} │ ${f}`;
|
|
10822
10828
|
return [u, m, ...a.map(d), m, g].join(`
|
|
10823
10829
|
`);
|
|
@@ -10872,11 +10878,11 @@ function jc({
|
|
|
10872
10878
|
demoMode: h = !1,
|
|
10873
10879
|
demoAutoConfirmMs: y,
|
|
10874
10880
|
tokenPriceUsd: b,
|
|
10875
|
-
showExplainer:
|
|
10881
|
+
showExplainer: A = !1,
|
|
10876
10882
|
siteName: N,
|
|
10877
|
-
explainerConfig:
|
|
10883
|
+
explainerConfig: E
|
|
10878
10884
|
}) {
|
|
10879
|
-
const { deposit: P, getStatus:
|
|
10885
|
+
const { deposit: P, getStatus: v, error: S, clearError: L } = fi(), C = tt(), B = Or(t.quickActionTokens), T = Or(t.customTokenSymbols), M = q(() => {
|
|
10880
10886
|
const O = t.customTokens ?? [];
|
|
10881
10887
|
if (O.length === 0) return a;
|
|
10882
10888
|
const H = new Set(a.map((Z) => Z.symbol)), Y = [...a];
|
|
@@ -10894,7 +10900,7 @@ function jc({
|
|
|
10894
10900
|
if (T.length === 0) return M;
|
|
10895
10901
|
const O = M.filter((H) => T.includes(H.symbol));
|
|
10896
10902
|
return O.length > 0 ? O : M;
|
|
10897
|
-
}, [M, T]), I = t.privateDepositsEnabled, U = o ? o === "sign" && !I ? "receive" : o : I && C.hasExternalWallet ? "sign" : "receive", ee = B[0] ? M.find((O) => O.symbol === B[0]) : void 0, pe = r === "sol" ? Se : r === "single-token" ? ee ?? M.find((O) => O.symbol === "USDC") ?? M[0] ?? Se : s ?? ee ?? M.find((O) => O.symbol === "USDC") ?? M.find((O) => O.symbol !== "SOL") ?? M[0] ?? Se, re = x(() =>
|
|
10903
|
+
}, [M, T]), I = t.privateDepositsEnabled, U = o ? o === "sign" && !I ? "receive" : o : I && C.hasExternalWallet ? "sign" : "receive", ee = B[0] ? M.find((O) => O.symbol === B[0]) : void 0, pe = r === "sol" ? Se : r === "single-token" ? ee ?? M.find((O) => O.symbol === "USDC") ?? M[0] ?? Se : s ?? ee ?? M.find((O) => O.symbol === "USDC") ?? M.find((O) => O.symbol !== "SOL") ?? M[0] ?? Se, re = x(() => A ? "explainer" : "unlock", [A]), [Q, D] = k(re), [F, K] = k(pe), [se, ne] = k(""), [ge, me] = k(null), [V, z] = k(null), [G, de] = k(null), [be, Zt] = k(null), [nt, Me] = k(!1), [js, at] = k(!1), [De, er] = k(null);
|
|
10898
10904
|
_(() => {
|
|
10899
10905
|
D(re()), K(pe), ne(""), me(null), z(null), de(null), Zt(null), Me(!1), at(!1), er(null), L();
|
|
10900
10906
|
}, [r, U, pe, L, re]);
|
|
@@ -10910,8 +10916,8 @@ function jc({
|
|
|
10910
10916
|
{ key: "waiting", label: "Confirming" },
|
|
10911
10917
|
{ key: "success", label: "Complete" }
|
|
10912
10918
|
];
|
|
10913
|
-
return
|
|
10914
|
-
}, [U,
|
|
10919
|
+
return A && (Y = [{ key: "explainer", label: "Info" }, ...Y]), Y;
|
|
10920
|
+
}, [U, A])(), Hs = rr.findIndex((O) => O.key === Q), sr = x((O) => {
|
|
10915
10921
|
K(O);
|
|
10916
10922
|
}, []), Qs = x(
|
|
10917
10923
|
async (O) => {
|
|
@@ -11015,7 +11021,7 @@ function jc({
|
|
|
11015
11021
|
if (!(H || Y >= Z)) {
|
|
11016
11022
|
Y++;
|
|
11017
11023
|
try {
|
|
11018
|
-
const ie = await
|
|
11024
|
+
const ie = await v(G);
|
|
11019
11025
|
if (ie.status === "completed" || ie.status === "detected") {
|
|
11020
11026
|
const Fe = ie.amountLamports ? ie.amountLamports / Math.pow(10, F.decimals) : 0, _e = ie.amountLamports || 0, We = {
|
|
11021
11027
|
token: r === "sol" ? null : F,
|
|
@@ -11042,7 +11048,7 @@ function jc({
|
|
|
11042
11048
|
Q,
|
|
11043
11049
|
G,
|
|
11044
11050
|
h,
|
|
11045
|
-
|
|
11051
|
+
v,
|
|
11046
11052
|
F,
|
|
11047
11053
|
r,
|
|
11048
11054
|
C.solanaPubkey,
|
|
@@ -11112,7 +11118,7 @@ function jc({
|
|
|
11112
11118
|
Si,
|
|
11113
11119
|
{
|
|
11114
11120
|
siteName: N,
|
|
11115
|
-
config:
|
|
11121
|
+
config: E,
|
|
11116
11122
|
depositConfig: t,
|
|
11117
11123
|
currencyMode: r,
|
|
11118
11124
|
token: F,
|
|
@@ -11131,7 +11137,7 @@ function jc({
|
|
|
11131
11137
|
isAuthorizing: js,
|
|
11132
11138
|
error: V,
|
|
11133
11139
|
onAuthorize: Qs,
|
|
11134
|
-
onBack:
|
|
11140
|
+
onBack: A ? () => D("explainer") : void 0,
|
|
11135
11141
|
onCancel: u
|
|
11136
11142
|
}
|
|
11137
11143
|
),
|
|
@@ -11195,7 +11201,7 @@ function jc({
|
|
|
11195
11201
|
Q === "error" && /* @__PURE__ */ e(
|
|
11196
11202
|
Ri,
|
|
11197
11203
|
{
|
|
11198
|
-
error: V ||
|
|
11204
|
+
error: V || S || "An error occurred",
|
|
11199
11205
|
onRetry: () => D("confirm"),
|
|
11200
11206
|
onCancel: u
|
|
11201
11207
|
}
|
|
@@ -11349,10 +11355,10 @@ function Pi({
|
|
|
11349
11355
|
onConfirm: y,
|
|
11350
11356
|
onBack: b
|
|
11351
11357
|
}) {
|
|
11352
|
-
const [
|
|
11358
|
+
const [A, N] = k(g.privateMinUsd), [E, P] = k(!1), [v, S] = k(!1), [L, C] = k(0), [B, T] = k(null), R = $t(A, g) === "sol_micro", I = t.symbol === xe.symbol, U = q(() => {
|
|
11353
11359
|
const V = a.length === 0 ? r : r.filter((de) => a.includes(de.symbol)), z = V.length > 0 ? V : r;
|
|
11354
11360
|
return z.some((de) => de.symbol === xe.symbol) ? z : [...z, xe];
|
|
11355
|
-
}, [r, a]), ee = ot(g,
|
|
11361
|
+
}, [r, a]), ee = ot(g, A), pe = ee < 0.01 ? 0.01 : ee, re = I ? "Fees: calculated after deposit" : `Fees: $${pe.toFixed(2)} total`, Q = I ? "" : Is(g, A, ee), D = Fs(R ? Se : t, g), F = D ? A / D : t.symbol === "SOL" && g.solPriceUsd > 0 ? A / g.solPriceUsd : A, K = F ? _s(F, R ? "SOL" : t.symbol) : null, ne = A - ee <= 0 && A > 0, ge = !I && A > 0 && !ne && F >= n && F <= l;
|
|
11356
11362
|
_(() => {
|
|
11357
11363
|
if (s === "multi-token")
|
|
11358
11364
|
if (R && t.symbol !== "SOL") {
|
|
@@ -11400,7 +11406,7 @@ function Pi({
|
|
|
11400
11406
|
"button",
|
|
11401
11407
|
{
|
|
11402
11408
|
type: "button",
|
|
11403
|
-
className: `cedros-deposit-flow-token-quick-btn ${
|
|
11409
|
+
className: `cedros-deposit-flow-token-quick-btn ${E ? "is-active" : ""}`,
|
|
11404
11410
|
onClick: () => {
|
|
11405
11411
|
P(!0), C((V) => V + 1);
|
|
11406
11412
|
},
|
|
@@ -11408,7 +11414,7 @@ function Pi({
|
|
|
11408
11414
|
}
|
|
11409
11415
|
)
|
|
11410
11416
|
] }),
|
|
11411
|
-
|
|
11417
|
+
E && /* @__PURE__ */ e("div", { className: "cedros-deposit-flow-token-custom", children: /* @__PURE__ */ e(
|
|
11412
11418
|
Ls,
|
|
11413
11419
|
{
|
|
11414
11420
|
tokens: U,
|
|
@@ -11422,7 +11428,7 @@ function Pi({
|
|
|
11422
11428
|
Bs,
|
|
11423
11429
|
{
|
|
11424
11430
|
config: g,
|
|
11425
|
-
valueUsd:
|
|
11431
|
+
valueUsd: A,
|
|
11426
11432
|
onChange: N,
|
|
11427
11433
|
maxUsd: Rs
|
|
11428
11434
|
}
|
|
@@ -11472,17 +11478,17 @@ function Pi({
|
|
|
11472
11478
|
"button",
|
|
11473
11479
|
{
|
|
11474
11480
|
type: "button",
|
|
11475
|
-
className: `cedros-deposit-flow-fee-info ${
|
|
11481
|
+
className: `cedros-deposit-flow-fee-info ${v ? "is-open" : ""}`,
|
|
11476
11482
|
"data-tooltip": Q,
|
|
11477
11483
|
"aria-label": `Fee breakdown: ${Q.replaceAll(`
|
|
11478
11484
|
`, ", ")}`,
|
|
11479
|
-
"aria-expanded":
|
|
11485
|
+
"aria-expanded": v,
|
|
11480
11486
|
onClick: (V) => {
|
|
11481
|
-
V.stopPropagation(),
|
|
11487
|
+
V.stopPropagation(), S((z) => !z);
|
|
11482
11488
|
},
|
|
11483
|
-
onBlur: () =>
|
|
11489
|
+
onBlur: () => S(!1),
|
|
11484
11490
|
onKeyDown: (V) => {
|
|
11485
|
-
V.key === "Escape" &&
|
|
11491
|
+
V.key === "Escape" && S(!1);
|
|
11486
11492
|
},
|
|
11487
11493
|
children: "i"
|
|
11488
11494
|
}
|
|
@@ -11563,7 +11569,7 @@ function Mi({
|
|
|
11563
11569
|
onSent: w,
|
|
11564
11570
|
onBack: p
|
|
11565
11571
|
}) {
|
|
11566
|
-
const [h, y] = k(u.privateMinUsd), [b,
|
|
11572
|
+
const [h, y] = k(u.privateMinUsd), [b, A] = k(!1), [N, E] = k(!1), [P, v] = k(0), [S, L] = k(null), B = $t(h, u) === "sol_micro", T = t.symbol === xe.symbol, M = q(() => {
|
|
11567
11573
|
const F = a.length === 0 ? r : r.filter((ne) => a.includes(ne.symbol)), K = F.length > 0 ? F : r;
|
|
11568
11574
|
return K.some((ne) => ne.symbol === xe.symbol) ? K : [...K, xe];
|
|
11569
11575
|
}, [r, a]), R = ot(u, h), I = R < 0.01 ? 0.01 : R, U = T ? "Fees: calculated after deposit" : `Fees: $${I.toFixed(2)} total`, ee = T ? "" : Is(u, h, R), pe = T || h > 0, re = Fs(B ? Se : t, u, s), Q = re ? h / re : null, D = Q ? _s(Q, t.symbol) : null;
|
|
@@ -11573,8 +11579,8 @@ function Mi({
|
|
|
11573
11579
|
L(t);
|
|
11574
11580
|
const F = r.find((K) => K.symbol === "SOL");
|
|
11575
11581
|
F && f(F);
|
|
11576
|
-
} else !B &&
|
|
11577
|
-
}, [B, t.symbol, n, r, f,
|
|
11582
|
+
} else !B && S && t.symbol === "SOL" && (f(S), L(null));
|
|
11583
|
+
}, [B, t.symbol, n, r, f, S, t]), _(() => {
|
|
11578
11584
|
g(h);
|
|
11579
11585
|
}, [h, g]), l ? /* @__PURE__ */ i("div", { className: "cedros-deposit-flow-step", children: [
|
|
11580
11586
|
/* @__PURE__ */ e("h4", { className: "cedros-deposit-flow-step-title", children: "Send Deposit" }),
|
|
@@ -11590,7 +11596,7 @@ function Mi({
|
|
|
11590
11596
|
type: "button",
|
|
11591
11597
|
className: `cedros-deposit-flow-token-quick-btn ${se ? "is-active" : ""}`,
|
|
11592
11598
|
onClick: () => {
|
|
11593
|
-
K && (
|
|
11599
|
+
K && (A(!1), f(K));
|
|
11594
11600
|
},
|
|
11595
11601
|
disabled: !K,
|
|
11596
11602
|
children: [
|
|
@@ -11614,7 +11620,7 @@ function Mi({
|
|
|
11614
11620
|
type: "button",
|
|
11615
11621
|
className: `cedros-deposit-flow-token-quick-btn ${b ? "is-active" : ""}`,
|
|
11616
11622
|
onClick: () => {
|
|
11617
|
-
|
|
11623
|
+
A(!0), v((F) => F + 1);
|
|
11618
11624
|
},
|
|
11619
11625
|
children: "Custom"
|
|
11620
11626
|
}
|
|
@@ -11679,11 +11685,11 @@ function Mi({
|
|
|
11679
11685
|
`, ", ")}`,
|
|
11680
11686
|
"aria-expanded": N,
|
|
11681
11687
|
onClick: (F) => {
|
|
11682
|
-
F.stopPropagation(),
|
|
11688
|
+
F.stopPropagation(), E((K) => !K);
|
|
11683
11689
|
},
|
|
11684
|
-
onBlur: () =>
|
|
11690
|
+
onBlur: () => E(!1),
|
|
11685
11691
|
onKeyDown: (F) => {
|
|
11686
|
-
F.key === "Escape" &&
|
|
11692
|
+
F.key === "Escape" && E(!1);
|
|
11687
11693
|
},
|
|
11688
11694
|
children: "i"
|
|
11689
11695
|
}
|
|
@@ -12158,10 +12164,10 @@ function Vc({
|
|
|
12158
12164
|
onLoad: s,
|
|
12159
12165
|
onTransactionClick: n
|
|
12160
12166
|
}) {
|
|
12161
|
-
const { getHistory: l, isLoading: c, error: d, clearError: u } = Ws(), [m, f] = k(t), [g, w] = k([]), [p, h] = k(0), [y, b] = k(0), [
|
|
12167
|
+
const { getHistory: l, isLoading: c, error: d, clearError: u } = Ws(), [m, f] = k(t), [g, w] = k([]), [p, h] = k(0), [y, b] = k(0), [A, N] = k(null), E = Dt.find((M) => M.key === m) || Dt[0], P = q(() => E.txTypes === null ? g : g.filter((M) => {
|
|
12162
12168
|
const R = M.txType || "";
|
|
12163
|
-
return
|
|
12164
|
-
}), [g,
|
|
12169
|
+
return E.txTypes.some((I) => R.toLowerCase().includes(I.toLowerCase()));
|
|
12170
|
+
}), [g, E.txTypes]), v = x(async () => {
|
|
12165
12171
|
try {
|
|
12166
12172
|
const M = await l({ limit: r * 3, offset: y });
|
|
12167
12173
|
w(M.transactions), h(M.total), s?.(M), N(null);
|
|
@@ -12172,28 +12178,28 @@ function Vc({
|
|
|
12172
12178
|
_(() => {
|
|
12173
12179
|
b(0);
|
|
12174
12180
|
}, [m]), _(() => {
|
|
12175
|
-
|
|
12176
|
-
}, [
|
|
12181
|
+
v();
|
|
12182
|
+
}, [v]), _(() => {
|
|
12177
12183
|
if (o <= 0) return;
|
|
12178
|
-
const M = setInterval(
|
|
12184
|
+
const M = setInterval(v, o);
|
|
12179
12185
|
return () => clearInterval(M);
|
|
12180
|
-
}, [o,
|
|
12181
|
-
const
|
|
12186
|
+
}, [o, v]);
|
|
12187
|
+
const S = Math.ceil(p / r), L = Math.floor(y / r) + 1, C = (M) => {
|
|
12182
12188
|
const R = (M - 1) * r;
|
|
12183
12189
|
b(Math.max(0, Math.min(R, Math.max(0, p - 1))));
|
|
12184
12190
|
}, B = (M) => {
|
|
12185
12191
|
f(M);
|
|
12186
12192
|
};
|
|
12187
|
-
if (
|
|
12193
|
+
if (A || d)
|
|
12188
12194
|
return /* @__PURE__ */ i("div", { className: `cedros-tx-history cedros-tx-history-error ${a}`, children: [
|
|
12189
|
-
/* @__PURE__ */ e("p", { className: "cedros-tx-error", children:
|
|
12195
|
+
/* @__PURE__ */ e("p", { className: "cedros-tx-error", children: A || d }),
|
|
12190
12196
|
/* @__PURE__ */ e(
|
|
12191
12197
|
"button",
|
|
12192
12198
|
{
|
|
12193
12199
|
type: "button",
|
|
12194
12200
|
className: "cedros-tx-retry",
|
|
12195
12201
|
onClick: () => {
|
|
12196
|
-
u(), N(null),
|
|
12202
|
+
u(), N(null), v();
|
|
12197
12203
|
},
|
|
12198
12204
|
children: "Retry"
|
|
12199
12205
|
}
|
|
@@ -12216,7 +12222,7 @@ function Vc({
|
|
|
12216
12222
|
{
|
|
12217
12223
|
type: "button",
|
|
12218
12224
|
className: "cedros-tx-refresh",
|
|
12219
|
-
onClick:
|
|
12225
|
+
onClick: v,
|
|
12220
12226
|
disabled: c,
|
|
12221
12227
|
title: "Refresh",
|
|
12222
12228
|
children: c ? "..." : "↻"
|
|
@@ -12240,7 +12246,7 @@ function Vc({
|
|
|
12240
12246
|
);
|
|
12241
12247
|
}) }),
|
|
12242
12248
|
P.length === 0 ? /* @__PURE__ */ i("div", { className: "cedros-tx-empty", children: [
|
|
12243
|
-
/* @__PURE__ */ e("p", { className: "cedros-tx-empty-message", children: m === "all" ? "No transactions yet." : `No ${
|
|
12249
|
+
/* @__PURE__ */ e("p", { className: "cedros-tx-empty-message", children: m === "all" ? "No transactions yet." : `No ${E.label.toLowerCase()} found.` }),
|
|
12244
12250
|
m === "all" && /* @__PURE__ */ e("p", { className: "cedros-tx-empty-hint", children: "Make a deposit to get started." })
|
|
12245
12251
|
] }) : /* @__PURE__ */ i($, { children: [
|
|
12246
12252
|
/* @__PURE__ */ e("div", { className: "cedros-tx-list", children: P.slice(0, r).map((M) => {
|
|
@@ -12284,7 +12290,7 @@ function Vc({
|
|
|
12284
12290
|
M.id
|
|
12285
12291
|
);
|
|
12286
12292
|
}) }),
|
|
12287
|
-
|
|
12293
|
+
S > 1 && /* @__PURE__ */ i("div", { className: "cedros-tx-pagination", children: [
|
|
12288
12294
|
/* @__PURE__ */ e(
|
|
12289
12295
|
"button",
|
|
12290
12296
|
{
|
|
@@ -12299,7 +12305,7 @@ function Vc({
|
|
|
12299
12305
|
"Page ",
|
|
12300
12306
|
L,
|
|
12301
12307
|
" of ",
|
|
12302
|
-
|
|
12308
|
+
S
|
|
12303
12309
|
] }),
|
|
12304
12310
|
/* @__PURE__ */ e(
|
|
12305
12311
|
"button",
|
|
@@ -12307,7 +12313,7 @@ function Vc({
|
|
|
12307
12313
|
type: "button",
|
|
12308
12314
|
className: "cedros-tx-page-btn",
|
|
12309
12315
|
onClick: () => C(L + 1),
|
|
12310
|
-
disabled: L >=
|
|
12316
|
+
disabled: L >= S,
|
|
12311
12317
|
children: "Next"
|
|
12312
12318
|
}
|
|
12313
12319
|
)
|
|
@@ -12430,7 +12436,7 @@ function Hc({
|
|
|
12430
12436
|
onCancel: o,
|
|
12431
12437
|
className: a = ""
|
|
12432
12438
|
}) {
|
|
12433
|
-
const s = ve(), { withdrawSol: n, withdrawSpl: l, getBalances: c, isSubmitting: d, error: u, clearError: m } = Os(), [f, g] = k("loading"), [w, p] = k([]), [h, y] = k(null), [b,
|
|
12439
|
+
const s = ve(), { withdrawSol: n, withdrawSpl: l, getBalances: c, isSubmitting: d, error: u, clearError: m } = Os(), [f, g] = k("loading"), [w, p] = k([]), [h, y] = k(null), [b, A] = k(""), [N, E] = k(""), [P, v] = k(null), [S, L] = k(null), [C, B] = k(null), T = s?.config.solana?.network ?? "mainnet-beta", M = q(() => {
|
|
12434
12440
|
if (!P?.txSignature) return "";
|
|
12435
12441
|
const D = `https://explorer.solana.com/tx/${P.txSignature}`;
|
|
12436
12442
|
return T === "mainnet-beta" ? D : `${D}?cluster=${encodeURIComponent(T)}`;
|
|
@@ -12474,13 +12480,13 @@ function Hc({
|
|
|
12474
12480
|
}, [s, c]);
|
|
12475
12481
|
const I = x(
|
|
12476
12482
|
(D) => {
|
|
12477
|
-
y(D), g("form"), m(), L(null),
|
|
12483
|
+
y(D), g("form"), m(), L(null), E("");
|
|
12478
12484
|
},
|
|
12479
12485
|
[m]
|
|
12480
12486
|
), U = x(() => {
|
|
12481
12487
|
if (!h) return;
|
|
12482
12488
|
const D = Number(h.rawBalance) / Math.pow(10, h.decimals);
|
|
12483
|
-
h.mint === Ut ?
|
|
12489
|
+
h.mint === Ut ? E(String(Math.max(0, D - 0.01))) : E(String(D));
|
|
12484
12490
|
}, [h]), ee = x(() => {
|
|
12485
12491
|
if (L(null), !b.trim()) {
|
|
12486
12492
|
L("Destination address is required");
|
|
@@ -12504,7 +12510,7 @@ function Hc({
|
|
|
12504
12510
|
g("processing"), m();
|
|
12505
12511
|
try {
|
|
12506
12512
|
let D;
|
|
12507
|
-
h.mint === Ut ? D = await n(b.trim(), Number(R)) : D = await l(b.trim(), h.mint, R),
|
|
12513
|
+
h.mint === Ut ? D = await n(b.trim(), Number(R)) : D = await l(b.trim(), h.mint, R), v(D), g("success"), t?.(D);
|
|
12508
12514
|
} catch (D) {
|
|
12509
12515
|
g("confirm"), r?.(D instanceof Error ? D : new Error(String(D)));
|
|
12510
12516
|
}
|
|
@@ -12519,9 +12525,9 @@ function Hc({
|
|
|
12519
12525
|
t,
|
|
12520
12526
|
r
|
|
12521
12527
|
]), re = x(() => {
|
|
12522
|
-
m(), L(null), f === "form" ? (g("select"), y(null),
|
|
12528
|
+
m(), L(null), f === "form" ? (g("select"), y(null), E(""), A("")) : f === "confirm" && g("form");
|
|
12523
12529
|
}, [f, m]), Q = x(() => {
|
|
12524
|
-
g("select"), y(null),
|
|
12530
|
+
g("select"), y(null), A(""), E(""), v(null), m(), L(null);
|
|
12525
12531
|
}, [m]);
|
|
12526
12532
|
return s ? /* @__PURE__ */ i("div", { className: `cedros-withdrawal ${a}`, children: [
|
|
12527
12533
|
f === "loading" && /* @__PURE__ */ i("div", { className: "cedros-withdrawal-processing", children: [
|
|
@@ -12590,7 +12596,7 @@ function Hc({
|
|
|
12590
12596
|
className: "cedros-input",
|
|
12591
12597
|
placeholder: "Solana address (base58)",
|
|
12592
12598
|
value: b,
|
|
12593
|
-
onChange: (D) =>
|
|
12599
|
+
onChange: (D) => A(D.target.value),
|
|
12594
12600
|
autoComplete: "off",
|
|
12595
12601
|
spellCheck: !1
|
|
12596
12602
|
}
|
|
@@ -12611,7 +12617,7 @@ function Hc({
|
|
|
12611
12617
|
className: "cedros-input",
|
|
12612
12618
|
placeholder: "0.00",
|
|
12613
12619
|
value: N,
|
|
12614
|
-
onChange: (D) =>
|
|
12620
|
+
onChange: (D) => E(D.target.value),
|
|
12615
12621
|
min: "0",
|
|
12616
12622
|
step: "any"
|
|
12617
12623
|
}
|
|
@@ -12627,7 +12633,7 @@ function Hc({
|
|
|
12627
12633
|
)
|
|
12628
12634
|
] })
|
|
12629
12635
|
] }),
|
|
12630
|
-
(
|
|
12636
|
+
(S || u) && /* @__PURE__ */ e(X, { error: S || u || "" }),
|
|
12631
12637
|
/* @__PURE__ */ e(
|
|
12632
12638
|
"button",
|
|
12633
12639
|
{
|
|
@@ -12786,9 +12792,9 @@ function Qc({
|
|
|
12786
12792
|
_(() => {
|
|
12787
12793
|
b();
|
|
12788
12794
|
}, [b]);
|
|
12789
|
-
const
|
|
12790
|
-
const
|
|
12791
|
-
g(Math.max(0, Math.min(
|
|
12795
|
+
const A = Math.ceil(u / t), N = Math.floor(f / t) + 1, E = (P) => {
|
|
12796
|
+
const v = (P - 1) * t;
|
|
12797
|
+
g(Math.max(0, Math.min(v, Math.max(0, u - 1))));
|
|
12792
12798
|
};
|
|
12793
12799
|
return h || n ? /* @__PURE__ */ i("div", { className: `cedros-withdrawal-history cedros-withdrawal-history-error ${r}`, children: [
|
|
12794
12800
|
/* @__PURE__ */ e("p", { className: "cedros-withdrawal-error", children: h || n }),
|
|
@@ -12823,14 +12829,14 @@ function Qc({
|
|
|
12823
12829
|
] }),
|
|
12824
12830
|
c.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-tx-empty", children: /* @__PURE__ */ e("p", { className: "cedros-tx-empty-message", children: "No withdrawal history yet." }) }) : /* @__PURE__ */ i($, { children: [
|
|
12825
12831
|
/* @__PURE__ */ e("div", { className: "cedros-tx-list", children: c.map((P) => {
|
|
12826
|
-
const
|
|
12832
|
+
const v = Gi(P.tokenType, P.tokenMint);
|
|
12827
12833
|
return /* @__PURE__ */ i(
|
|
12828
12834
|
"div",
|
|
12829
12835
|
{
|
|
12830
12836
|
className: "cedros-tx-item cedros-tx-item-negative",
|
|
12831
12837
|
onClick: () => o?.(P),
|
|
12832
|
-
onKeyDown: (
|
|
12833
|
-
(
|
|
12838
|
+
onKeyDown: (S) => {
|
|
12839
|
+
(S.key === "Enter" || S.key === " ") && (S.preventDefault(), o?.(P));
|
|
12834
12840
|
},
|
|
12835
12841
|
role: o ? "button" : void 0,
|
|
12836
12842
|
tabIndex: o ? 0 : void 0,
|
|
@@ -12839,13 +12845,13 @@ function Qc({
|
|
|
12839
12845
|
/* @__PURE__ */ i("div", { className: "cedros-tx-content", children: [
|
|
12840
12846
|
/* @__PURE__ */ i("div", { className: "cedros-tx-row-main", children: [
|
|
12841
12847
|
/* @__PURE__ */ i("span", { className: "cedros-tx-type", children: [
|
|
12842
|
-
|
|
12848
|
+
v,
|
|
12843
12849
|
" Withdrawal"
|
|
12844
12850
|
] }),
|
|
12845
12851
|
/* @__PURE__ */ i("span", { className: "cedros-tx-amount cedros-tx-amount-negative", children: [
|
|
12846
12852
|
P.amount,
|
|
12847
12853
|
" ",
|
|
12848
|
-
|
|
12854
|
+
v === "SOL" ? "lamports" : ""
|
|
12849
12855
|
] })
|
|
12850
12856
|
] }),
|
|
12851
12857
|
/* @__PURE__ */ i("div", { className: "cedros-tx-row-details", children: [
|
|
@@ -12858,7 +12864,7 @@ function Qc({
|
|
|
12858
12864
|
href: `${a}/account/${P.destination}`,
|
|
12859
12865
|
target: "_blank",
|
|
12860
12866
|
rel: "noopener noreferrer",
|
|
12861
|
-
onClick: (
|
|
12867
|
+
onClick: (S) => S.stopPropagation(),
|
|
12862
12868
|
children: Ji(P.destination)
|
|
12863
12869
|
}
|
|
12864
12870
|
),
|
|
@@ -12869,7 +12875,7 @@ function Qc({
|
|
|
12869
12875
|
href: `${a}/tx/${P.txSignature}`,
|
|
12870
12876
|
target: "_blank",
|
|
12871
12877
|
rel: "noopener noreferrer",
|
|
12872
|
-
onClick: (
|
|
12878
|
+
onClick: (S) => S.stopPropagation(),
|
|
12873
12879
|
children: "tx"
|
|
12874
12880
|
}
|
|
12875
12881
|
)
|
|
@@ -12882,13 +12888,13 @@ function Qc({
|
|
|
12882
12888
|
P.id
|
|
12883
12889
|
);
|
|
12884
12890
|
}) }),
|
|
12885
|
-
|
|
12891
|
+
A > 1 && /* @__PURE__ */ i("div", { className: "cedros-tx-pagination", children: [
|
|
12886
12892
|
/* @__PURE__ */ e(
|
|
12887
12893
|
"button",
|
|
12888
12894
|
{
|
|
12889
12895
|
type: "button",
|
|
12890
12896
|
className: "cedros-tx-page-btn",
|
|
12891
|
-
onClick: () =>
|
|
12897
|
+
onClick: () => E(N - 1),
|
|
12892
12898
|
disabled: N <= 1,
|
|
12893
12899
|
children: "Previous"
|
|
12894
12900
|
}
|
|
@@ -12897,15 +12903,15 @@ function Qc({
|
|
|
12897
12903
|
"Page ",
|
|
12898
12904
|
N,
|
|
12899
12905
|
" of ",
|
|
12900
|
-
|
|
12906
|
+
A
|
|
12901
12907
|
] }),
|
|
12902
12908
|
/* @__PURE__ */ e(
|
|
12903
12909
|
"button",
|
|
12904
12910
|
{
|
|
12905
12911
|
type: "button",
|
|
12906
12912
|
className: "cedros-tx-page-btn",
|
|
12907
|
-
onClick: () =>
|
|
12908
|
-
disabled: N >=
|
|
12913
|
+
onClick: () => E(N + 1),
|
|
12914
|
+
disabled: N >= A,
|
|
12909
12915
|
children: "Next"
|
|
12910
12916
|
}
|
|
12911
12917
|
)
|