@cedros/login-react 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1183 -0
- package/dist/EmailRegisterForm-D_uCEdX9.cjs +1 -0
- package/dist/EmailRegisterForm-D_uCEdX9.cjs.map +1 -0
- package/dist/EmailRegisterForm-m3rX3A6X.js +2923 -0
- package/dist/EmailRegisterForm-m3rX3A6X.js.map +1 -0
- package/dist/ErrorMessage-Bm1j5mBT.js +2042 -0
- package/dist/ErrorMessage-Bm1j5mBT.js.map +1 -0
- package/dist/ErrorMessage-CntMyn93.cjs +1 -0
- package/dist/ErrorMessage-CntMyn93.cjs.map +1 -0
- package/dist/GoogleLoginButton-CJNJ-THo.cjs +1 -0
- package/dist/GoogleLoginButton-CJNJ-THo.cjs.map +1 -0
- package/dist/GoogleLoginButton-CvDoOc-0.js +227 -0
- package/dist/GoogleLoginButton-CvDoOc-0.js.map +1 -0
- package/dist/SolanaLoginButton-BlSgPW50.cjs +1 -0
- package/dist/SolanaLoginButton-BlSgPW50.cjs.map +1 -0
- package/dist/SolanaLoginButton-h32xN2PQ.js +261 -0
- package/dist/SolanaLoginButton-h32xN2PQ.js.map +1 -0
- package/dist/assets/argon2Worker-Bi5TuQvD.js +1 -0
- package/dist/assets/argon2Worker-Bi5TuQvD.js.map +1 -0
- package/dist/components/LoginButton.d.ts +23 -0
- package/dist/components/LoginForm.d.ts +9 -0
- package/dist/components/LoginModal.d.ts +9 -0
- package/dist/components/admin/AdminUserDetail.d.ts +21 -0
- package/dist/components/admin/AdminUserList.d.ts +25 -0
- package/dist/components/admin/CedrosAdminDashboard.d.ts +48 -0
- package/dist/components/admin/SystemSettings.d.ts +19 -0
- package/dist/components/apple/AppleLoginButton.d.ts +29 -0
- package/dist/components/deposit/CreditBalance.d.ts +19 -0
- package/dist/components/deposit/DepositFlow.d.ts +118 -0
- package/dist/components/deposit/FeeConfigDisplay.d.ts +15 -0
- package/dist/components/deposit/History.d.ts +21 -0
- package/dist/components/deposit/TieredAmountSlider.d.ts +19 -0
- package/dist/components/deposit/TokenSelector.d.ts +23 -0
- package/dist/components/deposit/admin/AdminDepositList.d.ts +21 -0
- package/dist/components/deposit/admin/AdminDepositStats.d.ts +15 -0
- package/dist/components/deposit/admin/AdminPrivacyPeriodDeposits.d.ts +19 -0
- package/dist/components/deposit/admin/AdminWithdrawalHistory.d.ts +19 -0
- package/dist/components/deposit/admin/AdminWithdrawalQueue.d.ts +23 -0
- package/dist/components/deposit/admin/PrivacySystemStatus.d.ts +15 -0
- package/dist/components/deposit/admin/index.d.ts +17 -0
- package/dist/components/deposit/index.d.ts +12 -0
- package/dist/components/deposit/tierUtils.d.ts +8 -0
- package/dist/components/deposit/tokens.d.ts +19 -0
- package/dist/components/email/EmailLoginForm.d.ts +11 -0
- package/dist/components/email/EmailRegisterForm.d.ts +14 -0
- package/dist/components/email/ForgotPasswordForm.d.ts +17 -0
- package/dist/components/email/PasswordInput.d.ts +14 -0
- package/dist/components/email/ResetPasswordForm.d.ts +22 -0
- package/dist/components/google/GoogleLoginButton.d.ts +12 -0
- package/dist/components/invites/InviteForm.d.ts +38 -0
- package/dist/components/invites/InviteList.d.ts +40 -0
- package/dist/components/members/MemberList.d.ts +47 -0
- package/dist/components/org/CreateOrgForm.d.ts +7 -0
- package/dist/components/org/OrgAvatar.d.ts +7 -0
- package/dist/components/org/OrgListView.d.ts +9 -0
- package/dist/components/org/OrgSelector.d.ts +51 -0
- package/dist/components/org/OrgSwitcher.d.ts +47 -0
- package/dist/components/org/icons.d.ts +8 -0
- package/dist/components/sessions/SessionList.d.ts +33 -0
- package/dist/components/shared/ErrorBoundary.d.ts +38 -0
- package/dist/components/shared/ErrorMessage.d.ts +14 -0
- package/dist/components/shared/LoadingSpinner.d.ts +16 -0
- package/dist/components/solana/SolanaLoginButton.d.ts +49 -0
- package/dist/components/templates/FullPageLayout.d.ts +40 -0
- package/dist/components/templates/SplitPageLayout.d.ts +44 -0
- package/dist/components/templates/index.d.ts +4 -0
- package/dist/components/totp/OtpInput.d.ts +32 -0
- package/dist/components/totp/QrCode.d.ts +21 -0
- package/dist/components/totp/TotpSettings.d.ts +38 -0
- package/dist/components/totp/TotpSetup.d.ts +23 -0
- package/dist/components/totp/TotpVerify.d.ts +25 -0
- package/dist/components/totp/index.d.ts +10 -0
- package/dist/components/wallet/CapabilityWarning.d.ts +11 -0
- package/dist/components/wallet/PasskeyPrompt.d.ts +34 -0
- package/dist/components/wallet/RecoveryPhraseDisplay.d.ts +18 -0
- package/dist/components/wallet/RecoveryPhraseInput.d.ts +21 -0
- package/dist/components/wallet/WalletAddressRow.d.ts +10 -0
- package/dist/components/wallet/WalletEnrollment.d.ts +15 -0
- package/dist/components/wallet/WalletManager.d.ts +9 -0
- package/dist/components/wallet/WalletRecovery.d.ts +19 -0
- package/dist/components/wallet/WalletStatus.d.ts +28 -0
- package/dist/components/wallet/WalletUnlock.d.ts +23 -0
- package/dist/components/wallet/index.d.ts +23 -0
- package/dist/components/webauthn/PasskeyLoginButton.d.ts +8 -0
- package/dist/context/CedrosLoginContext.d.ts +24 -0
- package/dist/context/CedrosLoginProvider.d.ts +17 -0
- package/dist/context/EmbeddedWalletExposure.d.ts +19 -0
- package/dist/context/useCedrosLogin.d.ts +12 -0
- package/dist/crypto/aesGcm.d.ts +89 -0
- package/dist/crypto/argon2.d.ts +65 -0
- package/dist/crypto/argon2Worker.d.ts +1 -0
- package/dist/crypto/argon2WorkerClient.d.ts +28 -0
- package/dist/crypto/bip39.d.ts +106 -0
- package/dist/crypto/capabilities.d.ts +35 -0
- package/dist/crypto/entropy.d.ts +56 -0
- package/dist/crypto/hkdf.d.ts +38 -0
- package/dist/crypto/index.d.ts +30 -0
- package/dist/crypto/secureWipe.d.ts +90 -0
- package/dist/crypto/shamir.d.ts +52 -0
- package/dist/crypto/solanaKeypair.d.ts +63 -0
- package/dist/crypto/types.d.ts +134 -0
- package/dist/crypto/webauthnPrf.d.ts +118 -0
- package/dist/email-only.cjs +1 -0
- package/dist/email-only.cjs.map +1 -0
- package/dist/email-only.d.ts +16 -0
- package/dist/email-only.js +15 -0
- package/dist/email-only.js.map +1 -0
- package/dist/google-only.cjs +1 -0
- package/dist/google-only.cjs.map +1 -0
- package/dist/google-only.d.ts +13 -0
- package/dist/google-only.js +11 -0
- package/dist/google-only.js.map +1 -0
- package/dist/hooks/useAdminDeposits.d.ts +10 -0
- package/dist/hooks/useAdminUsers.d.ts +28 -0
- package/dist/hooks/useAppleAuth.d.ts +52 -0
- package/dist/hooks/useAuth.d.ts +34 -0
- package/dist/hooks/useAuthSession.d.ts +19 -0
- package/dist/hooks/useAuthorize.d.ts +62 -0
- package/dist/hooks/useCredits.d.ts +11 -0
- package/dist/hooks/useDeposit.d.ts +16 -0
- package/dist/hooks/useEmailAuth.d.ts +60 -0
- package/dist/hooks/useGoogleAuth.d.ts +67 -0
- package/dist/hooks/useInstantLink.d.ts +42 -0
- package/dist/hooks/useInvites.d.ts +57 -0
- package/dist/hooks/useMembers.d.ts +52 -0
- package/dist/hooks/useOrgs.d.ts +49 -0
- package/dist/hooks/usePasswordReset.d.ts +32 -0
- package/dist/hooks/usePendingRecovery.d.ts +34 -0
- package/dist/hooks/useRateLimiter.d.ts +58 -0
- package/dist/hooks/useSessions.d.ts +45 -0
- package/dist/hooks/useSolanaAuth.d.ts +30 -0
- package/dist/hooks/useSystemSettings.d.ts +47 -0
- package/dist/hooks/useThemeManager.d.ts +11 -0
- package/dist/hooks/useTotp.d.ts +52 -0
- package/dist/hooks/useTotpVerify.d.ts +38 -0
- package/dist/hooks/useTransactionSigning.d.ts +45 -0
- package/dist/hooks/useWallet.d.ts +10 -0
- package/dist/hooks/useWalletDiscovery.d.ts +24 -0
- package/dist/hooks/useWalletEnrollment.d.ts +9 -0
- package/dist/hooks/useWalletMaterial.d.ts +10 -0
- package/dist/hooks/useWalletRecovery.d.ts +9 -0
- package/dist/hooks/useWalletSigning.d.ts +31 -0
- package/dist/hooks/useWebAuthn.d.ts +25 -0
- package/dist/i18n/I18nProvider.d.ts +16 -0
- package/dist/i18n/context.d.ts +6 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/translations.d.ts +66 -0
- package/dist/i18n/useI18n.d.ts +9 -0
- package/dist/index.cjs +2061 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.js +14910 -0
- package/dist/index.js.map +1 -0
- package/dist/login-react.css +1 -0
- package/dist/solana-only.cjs +1 -0
- package/dist/solana-only.cjs.map +1 -0
- package/dist/solana-only.d.ts +13 -0
- package/dist/solana-only.js +11 -0
- package/dist/solana-only.js.map +1 -0
- package/dist/style.cjs +1 -0
- package/dist/style.cjs.map +1 -0
- package/dist/style.js +1 -0
- package/dist/style.js.map +1 -0
- package/dist/types/adminUser.d.ts +112 -0
- package/dist/types/auth.d.ts +122 -0
- package/dist/types/config.d.ts +266 -0
- package/dist/types/deposit.d.ts +488 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/invite.d.ts +71 -0
- package/dist/types/member.d.ts +45 -0
- package/dist/types/org.d.ts +101 -0
- package/dist/types/session.d.ts +28 -0
- package/dist/types/systemSettings.d.ts +81 -0
- package/dist/types/totp.d.ts +52 -0
- package/dist/types/wallet.d.ts +309 -0
- package/dist/utils/adminUserApi.d.ts +51 -0
- package/dist/utils/apiClient.d.ts +78 -0
- package/dist/utils/cryptoShim.d.ts +17 -0
- package/dist/utils/csrf.d.ts +1 -0
- package/dist/utils/deviceDetection.d.ts +17 -0
- package/dist/utils/embeddedWallet.d.ts +75 -0
- package/dist/utils/inviteApi.d.ts +31 -0
- package/dist/utils/memberApi.d.ts +23 -0
- package/dist/utils/orgApi.d.ts +36 -0
- package/dist/utils/sanitization.d.ts +66 -0
- package/dist/utils/sessionApi.d.ts +16 -0
- package/dist/utils/silentWalletEnroll.d.ts +41 -0
- package/dist/utils/systemSettingsApi.d.ts +18 -0
- package/dist/utils/tabSync.d.ts +46 -0
- package/dist/utils/tokenManager.d.ts +107 -0
- package/dist/utils/unlockCredential.d.ts +5 -0
- package/dist/utils/validation.d.ts +48 -0
- package/dist/utils/walletDetection.d.ts +23 -0
- package/dist/utils/webauthnJson.d.ts +21 -0
- package/dist/validation-BeXIfuHB.cjs +1 -0
- package/dist/validation-BeXIfuHB.cjs.map +1 -0
- package/dist/validation-BebL7hMF.js +56 -0
- package/dist/validation-BebL7hMF.js.map +1 -0
- package/package.json +109 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2061 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./ErrorMessage-CntMyn93.cjs"),e=require("react/jsx-runtime"),l=require("react"),O=require("./EmailRegisterForm-D_uCEdX9.cjs"),_e=require("./validation-BeXIfuHB.cjs"),Cs=require("./GoogleLoginButton-CJNJ-THo.cjs"),je=require("./SolanaLoginButton-BlSgPW50.cjs");function De(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function Pt(s,t){return Array.isArray(t)?t.length===0?!0:s?t.every(r=>typeof r=="string"):t.every(r=>Number.isSafeInteger(r)):!1}function Vr(s){if(typeof s!="function")throw new Error("function expected");return!0}function Be(s,t){if(typeof t!="string")throw new Error(`${s}: string expected`);return!0}function be(s){if(!Number.isSafeInteger(s))throw new Error(`invalid integer: ${s}`)}function Fe(s){if(!Array.isArray(s))throw new Error("array expected")}function Ue(s,t){if(!Pt(!0,t))throw new Error(`${s}: array of strings expected`)}function Lt(s,t){if(!Pt(!1,t))throw new Error(`${s}: array of numbers expected`)}function Qr(...s){const t=a=>a,r=(a,c)=>i=>a(c(i)),o=s.map(a=>a.encode).reduceRight(r,t),n=s.map(a=>a.decode).reduce(r,t);return{encode:o,decode:n}}function Hr(s){const t=typeof s=="string"?s.split(""):s,r=t.length;Ue("alphabet",t);const o=new Map(t.map((n,a)=>[n,a]));return{encode:n=>(Fe(n),n.map(a=>{if(!Number.isSafeInteger(a)||a<0||a>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${a}". Allowed: ${s}`);return t[a]})),decode:n=>(Fe(n),n.map(a=>{Be("alphabet.decode",a);const c=o.get(a);if(c===void 0)throw new Error(`Unknown letter: "${a}". Allowed: ${s}`);return c}))}}function Kr(s=""){return Be("join",s),{encode:t=>(Ue("join.decode",t),t.join(s)),decode:t=>(Be("join.decode",t),t.split(s))}}function Yr(s,t="="){return be(s),Be("padding",t),{encode(r){for(Ue("padding.encode",r);r.length*s%8;)r.push(t);return r},decode(r){Ue("padding.decode",r);let o=r.length;if(o*s%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;o>0&&r[o-1]===t;o--)if((o-1)*s%8===0)throw new Error("padding: invalid, string has too much padding");return r.slice(0,o)}}}function js(s,t,r){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: invalid to=${r}, base cannot be less than 2`);if(Fe(s),!s.length)return[];let o=0;const n=[],a=Array.from(s,i=>{if(be(i),i<0||i>=t)throw new Error(`invalid integer: ${i}`);return i}),c=a.length;for(;;){let i=0,d=!0;for(let u=o;u<c;u++){const p=a[u],f=t*i,h=f+p;if(!Number.isSafeInteger(h)||f/t!==i||h-p!==f)throw new Error("convertRadix: carry overflow");const w=h/r;i=h%r;const m=Math.floor(w);if(a[u]=m,!Number.isSafeInteger(m)||m*r+i!==h)throw new Error("convertRadix: carry overflow");if(d)m?d=!1:o=u;else continue}if(n.push(i),d)break}for(let i=0;i<s.length-1&&s[i]===0;i++)n.push(0);return n.reverse()}const Tt=(s,t)=>t===0?s:Tt(t,s%t),Ie=(s,t)=>s+(t-Tt(s,t)),Je=(()=>{let s=[];for(let t=0;t<40;t++)s.push(2**t);return s})();function Ns(s,t,r,o){if(Fe(s),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(Ie(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${Ie(t,r)}`);let n=0,a=0;const c=Je[t],i=Je[r]-1,d=[];for(const u of s){if(be(u),u>=c)throw new Error(`convertRadix2: invalid data word=${u} from=${t}`);if(n=n<<t|u,a+t>32)throw new Error(`convertRadix2: carry overflow pos=${a} from=${t}`);for(a+=t;a>=r;a-=r)d.push((n>>a-r&i)>>>0);const p=Je[a];if(p===void 0)throw new Error("invalid carry");n&=p-1}if(n=n<<r-a&i,!o&&a>=t)throw new Error("Excess padding");if(!o&&n>0)throw new Error(`Non-zero padding: ${n}`);return o&&a>0&&d.push(n>>>0),d}function Gr(s){be(s);const t=2**8;return{encode:r=>{if(!De(r))throw new Error("radix.encode input should be Uint8Array");return js(Array.from(r),t,s)},decode:r=>(Lt("radix.decode",r),Uint8Array.from(js(r,s,t)))}}function Jr(s,t=!1){if(be(s),s<=0||s>32)throw new Error("radix2: bits should be in (0..32]");if(Ie(8,s)>32||Ie(s,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!De(r))throw new Error("radix2.encode input should be Uint8Array");return Ns(Array.from(r),8,s,!t)},decode:r=>(Lt("radix2.decode",r),Uint8Array.from(Ns(r,s,8,t)))}}function Xr(s,t){return be(s),Vr(t),{encode(r){if(!De(r))throw new Error("checksum.encode: input should be Uint8Array");const o=t(r).slice(0,s),n=new Uint8Array(r.length+s);return n.set(r),n.set(o,r.length),n},decode(r){if(!De(r))throw new Error("checksum.decode: input should be Uint8Array");const o=r.slice(0,-s),n=r.slice(-s),a=t(o).slice(0,s);for(let c=0;c<s;c++)if(a[c]!==n[c])throw new Error("Invalid checksum");return o}}}const Le={alphabet:Hr,chain:Qr,checksum:Xr,convertRadix:js,convertRadix2:Ns,radix:Gr,radix2:Jr,join:Kr,padding:Yr};const Zr=s=>s[0]==="あいこくしん";function en(s){if(typeof s!="string")throw new TypeError("invalid mnemonic type: "+typeof s);return s.normalize("NFKD")}function sn(s){const t=en(s),r=t.split(" ");if(![12,15,18,21,24].includes(r.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:r}}function Mt(s){O.abytes(s,16,20,24,28,32)}const tn=s=>{const t=8-s.length/4;return new Uint8Array([O.sha256(s)[0]>>t<<t])};function Rt(s){if(!Array.isArray(s)||s.length!==2048||typeof s[0]!="string")throw new Error("Wordlist: expected array of 2048 strings");return s.forEach(t=>{if(typeof t!="string")throw new Error("wordlist: non-string element: "+t)}),Le.chain(Le.checksum(1,tn),Le.radix2(11,!0),Le.alphabet(s))}function Ss(s,t){const{words:r}=sn(s),o=Rt(t).decode(r);return Mt(o),o}function Dt(s,t){return Mt(s),Rt(t).encode(s).join(Zr(t)?" ":" ")}function Es(s,t){try{Ss(s,t)}catch{return!1}return!0}const ce=`abandon
|
|
2
|
+
ability
|
|
3
|
+
able
|
|
4
|
+
about
|
|
5
|
+
above
|
|
6
|
+
absent
|
|
7
|
+
absorb
|
|
8
|
+
abstract
|
|
9
|
+
absurd
|
|
10
|
+
abuse
|
|
11
|
+
access
|
|
12
|
+
accident
|
|
13
|
+
account
|
|
14
|
+
accuse
|
|
15
|
+
achieve
|
|
16
|
+
acid
|
|
17
|
+
acoustic
|
|
18
|
+
acquire
|
|
19
|
+
across
|
|
20
|
+
act
|
|
21
|
+
action
|
|
22
|
+
actor
|
|
23
|
+
actress
|
|
24
|
+
actual
|
|
25
|
+
adapt
|
|
26
|
+
add
|
|
27
|
+
addict
|
|
28
|
+
address
|
|
29
|
+
adjust
|
|
30
|
+
admit
|
|
31
|
+
adult
|
|
32
|
+
advance
|
|
33
|
+
advice
|
|
34
|
+
aerobic
|
|
35
|
+
affair
|
|
36
|
+
afford
|
|
37
|
+
afraid
|
|
38
|
+
again
|
|
39
|
+
age
|
|
40
|
+
agent
|
|
41
|
+
agree
|
|
42
|
+
ahead
|
|
43
|
+
aim
|
|
44
|
+
air
|
|
45
|
+
airport
|
|
46
|
+
aisle
|
|
47
|
+
alarm
|
|
48
|
+
album
|
|
49
|
+
alcohol
|
|
50
|
+
alert
|
|
51
|
+
alien
|
|
52
|
+
all
|
|
53
|
+
alley
|
|
54
|
+
allow
|
|
55
|
+
almost
|
|
56
|
+
alone
|
|
57
|
+
alpha
|
|
58
|
+
already
|
|
59
|
+
also
|
|
60
|
+
alter
|
|
61
|
+
always
|
|
62
|
+
amateur
|
|
63
|
+
amazing
|
|
64
|
+
among
|
|
65
|
+
amount
|
|
66
|
+
amused
|
|
67
|
+
analyst
|
|
68
|
+
anchor
|
|
69
|
+
ancient
|
|
70
|
+
anger
|
|
71
|
+
angle
|
|
72
|
+
angry
|
|
73
|
+
animal
|
|
74
|
+
ankle
|
|
75
|
+
announce
|
|
76
|
+
annual
|
|
77
|
+
another
|
|
78
|
+
answer
|
|
79
|
+
antenna
|
|
80
|
+
antique
|
|
81
|
+
anxiety
|
|
82
|
+
any
|
|
83
|
+
apart
|
|
84
|
+
apology
|
|
85
|
+
appear
|
|
86
|
+
apple
|
|
87
|
+
approve
|
|
88
|
+
april
|
|
89
|
+
arch
|
|
90
|
+
arctic
|
|
91
|
+
area
|
|
92
|
+
arena
|
|
93
|
+
argue
|
|
94
|
+
arm
|
|
95
|
+
armed
|
|
96
|
+
armor
|
|
97
|
+
army
|
|
98
|
+
around
|
|
99
|
+
arrange
|
|
100
|
+
arrest
|
|
101
|
+
arrive
|
|
102
|
+
arrow
|
|
103
|
+
art
|
|
104
|
+
artefact
|
|
105
|
+
artist
|
|
106
|
+
artwork
|
|
107
|
+
ask
|
|
108
|
+
aspect
|
|
109
|
+
assault
|
|
110
|
+
asset
|
|
111
|
+
assist
|
|
112
|
+
assume
|
|
113
|
+
asthma
|
|
114
|
+
athlete
|
|
115
|
+
atom
|
|
116
|
+
attack
|
|
117
|
+
attend
|
|
118
|
+
attitude
|
|
119
|
+
attract
|
|
120
|
+
auction
|
|
121
|
+
audit
|
|
122
|
+
august
|
|
123
|
+
aunt
|
|
124
|
+
author
|
|
125
|
+
auto
|
|
126
|
+
autumn
|
|
127
|
+
average
|
|
128
|
+
avocado
|
|
129
|
+
avoid
|
|
130
|
+
awake
|
|
131
|
+
aware
|
|
132
|
+
away
|
|
133
|
+
awesome
|
|
134
|
+
awful
|
|
135
|
+
awkward
|
|
136
|
+
axis
|
|
137
|
+
baby
|
|
138
|
+
bachelor
|
|
139
|
+
bacon
|
|
140
|
+
badge
|
|
141
|
+
bag
|
|
142
|
+
balance
|
|
143
|
+
balcony
|
|
144
|
+
ball
|
|
145
|
+
bamboo
|
|
146
|
+
banana
|
|
147
|
+
banner
|
|
148
|
+
bar
|
|
149
|
+
barely
|
|
150
|
+
bargain
|
|
151
|
+
barrel
|
|
152
|
+
base
|
|
153
|
+
basic
|
|
154
|
+
basket
|
|
155
|
+
battle
|
|
156
|
+
beach
|
|
157
|
+
bean
|
|
158
|
+
beauty
|
|
159
|
+
because
|
|
160
|
+
become
|
|
161
|
+
beef
|
|
162
|
+
before
|
|
163
|
+
begin
|
|
164
|
+
behave
|
|
165
|
+
behind
|
|
166
|
+
believe
|
|
167
|
+
below
|
|
168
|
+
belt
|
|
169
|
+
bench
|
|
170
|
+
benefit
|
|
171
|
+
best
|
|
172
|
+
betray
|
|
173
|
+
better
|
|
174
|
+
between
|
|
175
|
+
beyond
|
|
176
|
+
bicycle
|
|
177
|
+
bid
|
|
178
|
+
bike
|
|
179
|
+
bind
|
|
180
|
+
biology
|
|
181
|
+
bird
|
|
182
|
+
birth
|
|
183
|
+
bitter
|
|
184
|
+
black
|
|
185
|
+
blade
|
|
186
|
+
blame
|
|
187
|
+
blanket
|
|
188
|
+
blast
|
|
189
|
+
bleak
|
|
190
|
+
bless
|
|
191
|
+
blind
|
|
192
|
+
blood
|
|
193
|
+
blossom
|
|
194
|
+
blouse
|
|
195
|
+
blue
|
|
196
|
+
blur
|
|
197
|
+
blush
|
|
198
|
+
board
|
|
199
|
+
boat
|
|
200
|
+
body
|
|
201
|
+
boil
|
|
202
|
+
bomb
|
|
203
|
+
bone
|
|
204
|
+
bonus
|
|
205
|
+
book
|
|
206
|
+
boost
|
|
207
|
+
border
|
|
208
|
+
boring
|
|
209
|
+
borrow
|
|
210
|
+
boss
|
|
211
|
+
bottom
|
|
212
|
+
bounce
|
|
213
|
+
box
|
|
214
|
+
boy
|
|
215
|
+
bracket
|
|
216
|
+
brain
|
|
217
|
+
brand
|
|
218
|
+
brass
|
|
219
|
+
brave
|
|
220
|
+
bread
|
|
221
|
+
breeze
|
|
222
|
+
brick
|
|
223
|
+
bridge
|
|
224
|
+
brief
|
|
225
|
+
bright
|
|
226
|
+
bring
|
|
227
|
+
brisk
|
|
228
|
+
broccoli
|
|
229
|
+
broken
|
|
230
|
+
bronze
|
|
231
|
+
broom
|
|
232
|
+
brother
|
|
233
|
+
brown
|
|
234
|
+
brush
|
|
235
|
+
bubble
|
|
236
|
+
buddy
|
|
237
|
+
budget
|
|
238
|
+
buffalo
|
|
239
|
+
build
|
|
240
|
+
bulb
|
|
241
|
+
bulk
|
|
242
|
+
bullet
|
|
243
|
+
bundle
|
|
244
|
+
bunker
|
|
245
|
+
burden
|
|
246
|
+
burger
|
|
247
|
+
burst
|
|
248
|
+
bus
|
|
249
|
+
business
|
|
250
|
+
busy
|
|
251
|
+
butter
|
|
252
|
+
buyer
|
|
253
|
+
buzz
|
|
254
|
+
cabbage
|
|
255
|
+
cabin
|
|
256
|
+
cable
|
|
257
|
+
cactus
|
|
258
|
+
cage
|
|
259
|
+
cake
|
|
260
|
+
call
|
|
261
|
+
calm
|
|
262
|
+
camera
|
|
263
|
+
camp
|
|
264
|
+
can
|
|
265
|
+
canal
|
|
266
|
+
cancel
|
|
267
|
+
candy
|
|
268
|
+
cannon
|
|
269
|
+
canoe
|
|
270
|
+
canvas
|
|
271
|
+
canyon
|
|
272
|
+
capable
|
|
273
|
+
capital
|
|
274
|
+
captain
|
|
275
|
+
car
|
|
276
|
+
carbon
|
|
277
|
+
card
|
|
278
|
+
cargo
|
|
279
|
+
carpet
|
|
280
|
+
carry
|
|
281
|
+
cart
|
|
282
|
+
case
|
|
283
|
+
cash
|
|
284
|
+
casino
|
|
285
|
+
castle
|
|
286
|
+
casual
|
|
287
|
+
cat
|
|
288
|
+
catalog
|
|
289
|
+
catch
|
|
290
|
+
category
|
|
291
|
+
cattle
|
|
292
|
+
caught
|
|
293
|
+
cause
|
|
294
|
+
caution
|
|
295
|
+
cave
|
|
296
|
+
ceiling
|
|
297
|
+
celery
|
|
298
|
+
cement
|
|
299
|
+
census
|
|
300
|
+
century
|
|
301
|
+
cereal
|
|
302
|
+
certain
|
|
303
|
+
chair
|
|
304
|
+
chalk
|
|
305
|
+
champion
|
|
306
|
+
change
|
|
307
|
+
chaos
|
|
308
|
+
chapter
|
|
309
|
+
charge
|
|
310
|
+
chase
|
|
311
|
+
chat
|
|
312
|
+
cheap
|
|
313
|
+
check
|
|
314
|
+
cheese
|
|
315
|
+
chef
|
|
316
|
+
cherry
|
|
317
|
+
chest
|
|
318
|
+
chicken
|
|
319
|
+
chief
|
|
320
|
+
child
|
|
321
|
+
chimney
|
|
322
|
+
choice
|
|
323
|
+
choose
|
|
324
|
+
chronic
|
|
325
|
+
chuckle
|
|
326
|
+
chunk
|
|
327
|
+
churn
|
|
328
|
+
cigar
|
|
329
|
+
cinnamon
|
|
330
|
+
circle
|
|
331
|
+
citizen
|
|
332
|
+
city
|
|
333
|
+
civil
|
|
334
|
+
claim
|
|
335
|
+
clap
|
|
336
|
+
clarify
|
|
337
|
+
claw
|
|
338
|
+
clay
|
|
339
|
+
clean
|
|
340
|
+
clerk
|
|
341
|
+
clever
|
|
342
|
+
click
|
|
343
|
+
client
|
|
344
|
+
cliff
|
|
345
|
+
climb
|
|
346
|
+
clinic
|
|
347
|
+
clip
|
|
348
|
+
clock
|
|
349
|
+
clog
|
|
350
|
+
close
|
|
351
|
+
cloth
|
|
352
|
+
cloud
|
|
353
|
+
clown
|
|
354
|
+
club
|
|
355
|
+
clump
|
|
356
|
+
cluster
|
|
357
|
+
clutch
|
|
358
|
+
coach
|
|
359
|
+
coast
|
|
360
|
+
coconut
|
|
361
|
+
code
|
|
362
|
+
coffee
|
|
363
|
+
coil
|
|
364
|
+
coin
|
|
365
|
+
collect
|
|
366
|
+
color
|
|
367
|
+
column
|
|
368
|
+
combine
|
|
369
|
+
come
|
|
370
|
+
comfort
|
|
371
|
+
comic
|
|
372
|
+
common
|
|
373
|
+
company
|
|
374
|
+
concert
|
|
375
|
+
conduct
|
|
376
|
+
confirm
|
|
377
|
+
congress
|
|
378
|
+
connect
|
|
379
|
+
consider
|
|
380
|
+
control
|
|
381
|
+
convince
|
|
382
|
+
cook
|
|
383
|
+
cool
|
|
384
|
+
copper
|
|
385
|
+
copy
|
|
386
|
+
coral
|
|
387
|
+
core
|
|
388
|
+
corn
|
|
389
|
+
correct
|
|
390
|
+
cost
|
|
391
|
+
cotton
|
|
392
|
+
couch
|
|
393
|
+
country
|
|
394
|
+
couple
|
|
395
|
+
course
|
|
396
|
+
cousin
|
|
397
|
+
cover
|
|
398
|
+
coyote
|
|
399
|
+
crack
|
|
400
|
+
cradle
|
|
401
|
+
craft
|
|
402
|
+
cram
|
|
403
|
+
crane
|
|
404
|
+
crash
|
|
405
|
+
crater
|
|
406
|
+
crawl
|
|
407
|
+
crazy
|
|
408
|
+
cream
|
|
409
|
+
credit
|
|
410
|
+
creek
|
|
411
|
+
crew
|
|
412
|
+
cricket
|
|
413
|
+
crime
|
|
414
|
+
crisp
|
|
415
|
+
critic
|
|
416
|
+
crop
|
|
417
|
+
cross
|
|
418
|
+
crouch
|
|
419
|
+
crowd
|
|
420
|
+
crucial
|
|
421
|
+
cruel
|
|
422
|
+
cruise
|
|
423
|
+
crumble
|
|
424
|
+
crunch
|
|
425
|
+
crush
|
|
426
|
+
cry
|
|
427
|
+
crystal
|
|
428
|
+
cube
|
|
429
|
+
culture
|
|
430
|
+
cup
|
|
431
|
+
cupboard
|
|
432
|
+
curious
|
|
433
|
+
current
|
|
434
|
+
curtain
|
|
435
|
+
curve
|
|
436
|
+
cushion
|
|
437
|
+
custom
|
|
438
|
+
cute
|
|
439
|
+
cycle
|
|
440
|
+
dad
|
|
441
|
+
damage
|
|
442
|
+
damp
|
|
443
|
+
dance
|
|
444
|
+
danger
|
|
445
|
+
daring
|
|
446
|
+
dash
|
|
447
|
+
daughter
|
|
448
|
+
dawn
|
|
449
|
+
day
|
|
450
|
+
deal
|
|
451
|
+
debate
|
|
452
|
+
debris
|
|
453
|
+
decade
|
|
454
|
+
december
|
|
455
|
+
decide
|
|
456
|
+
decline
|
|
457
|
+
decorate
|
|
458
|
+
decrease
|
|
459
|
+
deer
|
|
460
|
+
defense
|
|
461
|
+
define
|
|
462
|
+
defy
|
|
463
|
+
degree
|
|
464
|
+
delay
|
|
465
|
+
deliver
|
|
466
|
+
demand
|
|
467
|
+
demise
|
|
468
|
+
denial
|
|
469
|
+
dentist
|
|
470
|
+
deny
|
|
471
|
+
depart
|
|
472
|
+
depend
|
|
473
|
+
deposit
|
|
474
|
+
depth
|
|
475
|
+
deputy
|
|
476
|
+
derive
|
|
477
|
+
describe
|
|
478
|
+
desert
|
|
479
|
+
design
|
|
480
|
+
desk
|
|
481
|
+
despair
|
|
482
|
+
destroy
|
|
483
|
+
detail
|
|
484
|
+
detect
|
|
485
|
+
develop
|
|
486
|
+
device
|
|
487
|
+
devote
|
|
488
|
+
diagram
|
|
489
|
+
dial
|
|
490
|
+
diamond
|
|
491
|
+
diary
|
|
492
|
+
dice
|
|
493
|
+
diesel
|
|
494
|
+
diet
|
|
495
|
+
differ
|
|
496
|
+
digital
|
|
497
|
+
dignity
|
|
498
|
+
dilemma
|
|
499
|
+
dinner
|
|
500
|
+
dinosaur
|
|
501
|
+
direct
|
|
502
|
+
dirt
|
|
503
|
+
disagree
|
|
504
|
+
discover
|
|
505
|
+
disease
|
|
506
|
+
dish
|
|
507
|
+
dismiss
|
|
508
|
+
disorder
|
|
509
|
+
display
|
|
510
|
+
distance
|
|
511
|
+
divert
|
|
512
|
+
divide
|
|
513
|
+
divorce
|
|
514
|
+
dizzy
|
|
515
|
+
doctor
|
|
516
|
+
document
|
|
517
|
+
dog
|
|
518
|
+
doll
|
|
519
|
+
dolphin
|
|
520
|
+
domain
|
|
521
|
+
donate
|
|
522
|
+
donkey
|
|
523
|
+
donor
|
|
524
|
+
door
|
|
525
|
+
dose
|
|
526
|
+
double
|
|
527
|
+
dove
|
|
528
|
+
draft
|
|
529
|
+
dragon
|
|
530
|
+
drama
|
|
531
|
+
drastic
|
|
532
|
+
draw
|
|
533
|
+
dream
|
|
534
|
+
dress
|
|
535
|
+
drift
|
|
536
|
+
drill
|
|
537
|
+
drink
|
|
538
|
+
drip
|
|
539
|
+
drive
|
|
540
|
+
drop
|
|
541
|
+
drum
|
|
542
|
+
dry
|
|
543
|
+
duck
|
|
544
|
+
dumb
|
|
545
|
+
dune
|
|
546
|
+
during
|
|
547
|
+
dust
|
|
548
|
+
dutch
|
|
549
|
+
duty
|
|
550
|
+
dwarf
|
|
551
|
+
dynamic
|
|
552
|
+
eager
|
|
553
|
+
eagle
|
|
554
|
+
early
|
|
555
|
+
earn
|
|
556
|
+
earth
|
|
557
|
+
easily
|
|
558
|
+
east
|
|
559
|
+
easy
|
|
560
|
+
echo
|
|
561
|
+
ecology
|
|
562
|
+
economy
|
|
563
|
+
edge
|
|
564
|
+
edit
|
|
565
|
+
educate
|
|
566
|
+
effort
|
|
567
|
+
egg
|
|
568
|
+
eight
|
|
569
|
+
either
|
|
570
|
+
elbow
|
|
571
|
+
elder
|
|
572
|
+
electric
|
|
573
|
+
elegant
|
|
574
|
+
element
|
|
575
|
+
elephant
|
|
576
|
+
elevator
|
|
577
|
+
elite
|
|
578
|
+
else
|
|
579
|
+
embark
|
|
580
|
+
embody
|
|
581
|
+
embrace
|
|
582
|
+
emerge
|
|
583
|
+
emotion
|
|
584
|
+
employ
|
|
585
|
+
empower
|
|
586
|
+
empty
|
|
587
|
+
enable
|
|
588
|
+
enact
|
|
589
|
+
end
|
|
590
|
+
endless
|
|
591
|
+
endorse
|
|
592
|
+
enemy
|
|
593
|
+
energy
|
|
594
|
+
enforce
|
|
595
|
+
engage
|
|
596
|
+
engine
|
|
597
|
+
enhance
|
|
598
|
+
enjoy
|
|
599
|
+
enlist
|
|
600
|
+
enough
|
|
601
|
+
enrich
|
|
602
|
+
enroll
|
|
603
|
+
ensure
|
|
604
|
+
enter
|
|
605
|
+
entire
|
|
606
|
+
entry
|
|
607
|
+
envelope
|
|
608
|
+
episode
|
|
609
|
+
equal
|
|
610
|
+
equip
|
|
611
|
+
era
|
|
612
|
+
erase
|
|
613
|
+
erode
|
|
614
|
+
erosion
|
|
615
|
+
error
|
|
616
|
+
erupt
|
|
617
|
+
escape
|
|
618
|
+
essay
|
|
619
|
+
essence
|
|
620
|
+
estate
|
|
621
|
+
eternal
|
|
622
|
+
ethics
|
|
623
|
+
evidence
|
|
624
|
+
evil
|
|
625
|
+
evoke
|
|
626
|
+
evolve
|
|
627
|
+
exact
|
|
628
|
+
example
|
|
629
|
+
excess
|
|
630
|
+
exchange
|
|
631
|
+
excite
|
|
632
|
+
exclude
|
|
633
|
+
excuse
|
|
634
|
+
execute
|
|
635
|
+
exercise
|
|
636
|
+
exhaust
|
|
637
|
+
exhibit
|
|
638
|
+
exile
|
|
639
|
+
exist
|
|
640
|
+
exit
|
|
641
|
+
exotic
|
|
642
|
+
expand
|
|
643
|
+
expect
|
|
644
|
+
expire
|
|
645
|
+
explain
|
|
646
|
+
expose
|
|
647
|
+
express
|
|
648
|
+
extend
|
|
649
|
+
extra
|
|
650
|
+
eye
|
|
651
|
+
eyebrow
|
|
652
|
+
fabric
|
|
653
|
+
face
|
|
654
|
+
faculty
|
|
655
|
+
fade
|
|
656
|
+
faint
|
|
657
|
+
faith
|
|
658
|
+
fall
|
|
659
|
+
false
|
|
660
|
+
fame
|
|
661
|
+
family
|
|
662
|
+
famous
|
|
663
|
+
fan
|
|
664
|
+
fancy
|
|
665
|
+
fantasy
|
|
666
|
+
farm
|
|
667
|
+
fashion
|
|
668
|
+
fat
|
|
669
|
+
fatal
|
|
670
|
+
father
|
|
671
|
+
fatigue
|
|
672
|
+
fault
|
|
673
|
+
favorite
|
|
674
|
+
feature
|
|
675
|
+
february
|
|
676
|
+
federal
|
|
677
|
+
fee
|
|
678
|
+
feed
|
|
679
|
+
feel
|
|
680
|
+
female
|
|
681
|
+
fence
|
|
682
|
+
festival
|
|
683
|
+
fetch
|
|
684
|
+
fever
|
|
685
|
+
few
|
|
686
|
+
fiber
|
|
687
|
+
fiction
|
|
688
|
+
field
|
|
689
|
+
figure
|
|
690
|
+
file
|
|
691
|
+
film
|
|
692
|
+
filter
|
|
693
|
+
final
|
|
694
|
+
find
|
|
695
|
+
fine
|
|
696
|
+
finger
|
|
697
|
+
finish
|
|
698
|
+
fire
|
|
699
|
+
firm
|
|
700
|
+
first
|
|
701
|
+
fiscal
|
|
702
|
+
fish
|
|
703
|
+
fit
|
|
704
|
+
fitness
|
|
705
|
+
fix
|
|
706
|
+
flag
|
|
707
|
+
flame
|
|
708
|
+
flash
|
|
709
|
+
flat
|
|
710
|
+
flavor
|
|
711
|
+
flee
|
|
712
|
+
flight
|
|
713
|
+
flip
|
|
714
|
+
float
|
|
715
|
+
flock
|
|
716
|
+
floor
|
|
717
|
+
flower
|
|
718
|
+
fluid
|
|
719
|
+
flush
|
|
720
|
+
fly
|
|
721
|
+
foam
|
|
722
|
+
focus
|
|
723
|
+
fog
|
|
724
|
+
foil
|
|
725
|
+
fold
|
|
726
|
+
follow
|
|
727
|
+
food
|
|
728
|
+
foot
|
|
729
|
+
force
|
|
730
|
+
forest
|
|
731
|
+
forget
|
|
732
|
+
fork
|
|
733
|
+
fortune
|
|
734
|
+
forum
|
|
735
|
+
forward
|
|
736
|
+
fossil
|
|
737
|
+
foster
|
|
738
|
+
found
|
|
739
|
+
fox
|
|
740
|
+
fragile
|
|
741
|
+
frame
|
|
742
|
+
frequent
|
|
743
|
+
fresh
|
|
744
|
+
friend
|
|
745
|
+
fringe
|
|
746
|
+
frog
|
|
747
|
+
front
|
|
748
|
+
frost
|
|
749
|
+
frown
|
|
750
|
+
frozen
|
|
751
|
+
fruit
|
|
752
|
+
fuel
|
|
753
|
+
fun
|
|
754
|
+
funny
|
|
755
|
+
furnace
|
|
756
|
+
fury
|
|
757
|
+
future
|
|
758
|
+
gadget
|
|
759
|
+
gain
|
|
760
|
+
galaxy
|
|
761
|
+
gallery
|
|
762
|
+
game
|
|
763
|
+
gap
|
|
764
|
+
garage
|
|
765
|
+
garbage
|
|
766
|
+
garden
|
|
767
|
+
garlic
|
|
768
|
+
garment
|
|
769
|
+
gas
|
|
770
|
+
gasp
|
|
771
|
+
gate
|
|
772
|
+
gather
|
|
773
|
+
gauge
|
|
774
|
+
gaze
|
|
775
|
+
general
|
|
776
|
+
genius
|
|
777
|
+
genre
|
|
778
|
+
gentle
|
|
779
|
+
genuine
|
|
780
|
+
gesture
|
|
781
|
+
ghost
|
|
782
|
+
giant
|
|
783
|
+
gift
|
|
784
|
+
giggle
|
|
785
|
+
ginger
|
|
786
|
+
giraffe
|
|
787
|
+
girl
|
|
788
|
+
give
|
|
789
|
+
glad
|
|
790
|
+
glance
|
|
791
|
+
glare
|
|
792
|
+
glass
|
|
793
|
+
glide
|
|
794
|
+
glimpse
|
|
795
|
+
globe
|
|
796
|
+
gloom
|
|
797
|
+
glory
|
|
798
|
+
glove
|
|
799
|
+
glow
|
|
800
|
+
glue
|
|
801
|
+
goat
|
|
802
|
+
goddess
|
|
803
|
+
gold
|
|
804
|
+
good
|
|
805
|
+
goose
|
|
806
|
+
gorilla
|
|
807
|
+
gospel
|
|
808
|
+
gossip
|
|
809
|
+
govern
|
|
810
|
+
gown
|
|
811
|
+
grab
|
|
812
|
+
grace
|
|
813
|
+
grain
|
|
814
|
+
grant
|
|
815
|
+
grape
|
|
816
|
+
grass
|
|
817
|
+
gravity
|
|
818
|
+
great
|
|
819
|
+
green
|
|
820
|
+
grid
|
|
821
|
+
grief
|
|
822
|
+
grit
|
|
823
|
+
grocery
|
|
824
|
+
group
|
|
825
|
+
grow
|
|
826
|
+
grunt
|
|
827
|
+
guard
|
|
828
|
+
guess
|
|
829
|
+
guide
|
|
830
|
+
guilt
|
|
831
|
+
guitar
|
|
832
|
+
gun
|
|
833
|
+
gym
|
|
834
|
+
habit
|
|
835
|
+
hair
|
|
836
|
+
half
|
|
837
|
+
hammer
|
|
838
|
+
hamster
|
|
839
|
+
hand
|
|
840
|
+
happy
|
|
841
|
+
harbor
|
|
842
|
+
hard
|
|
843
|
+
harsh
|
|
844
|
+
harvest
|
|
845
|
+
hat
|
|
846
|
+
have
|
|
847
|
+
hawk
|
|
848
|
+
hazard
|
|
849
|
+
head
|
|
850
|
+
health
|
|
851
|
+
heart
|
|
852
|
+
heavy
|
|
853
|
+
hedgehog
|
|
854
|
+
height
|
|
855
|
+
hello
|
|
856
|
+
helmet
|
|
857
|
+
help
|
|
858
|
+
hen
|
|
859
|
+
hero
|
|
860
|
+
hidden
|
|
861
|
+
high
|
|
862
|
+
hill
|
|
863
|
+
hint
|
|
864
|
+
hip
|
|
865
|
+
hire
|
|
866
|
+
history
|
|
867
|
+
hobby
|
|
868
|
+
hockey
|
|
869
|
+
hold
|
|
870
|
+
hole
|
|
871
|
+
holiday
|
|
872
|
+
hollow
|
|
873
|
+
home
|
|
874
|
+
honey
|
|
875
|
+
hood
|
|
876
|
+
hope
|
|
877
|
+
horn
|
|
878
|
+
horror
|
|
879
|
+
horse
|
|
880
|
+
hospital
|
|
881
|
+
host
|
|
882
|
+
hotel
|
|
883
|
+
hour
|
|
884
|
+
hover
|
|
885
|
+
hub
|
|
886
|
+
huge
|
|
887
|
+
human
|
|
888
|
+
humble
|
|
889
|
+
humor
|
|
890
|
+
hundred
|
|
891
|
+
hungry
|
|
892
|
+
hunt
|
|
893
|
+
hurdle
|
|
894
|
+
hurry
|
|
895
|
+
hurt
|
|
896
|
+
husband
|
|
897
|
+
hybrid
|
|
898
|
+
ice
|
|
899
|
+
icon
|
|
900
|
+
idea
|
|
901
|
+
identify
|
|
902
|
+
idle
|
|
903
|
+
ignore
|
|
904
|
+
ill
|
|
905
|
+
illegal
|
|
906
|
+
illness
|
|
907
|
+
image
|
|
908
|
+
imitate
|
|
909
|
+
immense
|
|
910
|
+
immune
|
|
911
|
+
impact
|
|
912
|
+
impose
|
|
913
|
+
improve
|
|
914
|
+
impulse
|
|
915
|
+
inch
|
|
916
|
+
include
|
|
917
|
+
income
|
|
918
|
+
increase
|
|
919
|
+
index
|
|
920
|
+
indicate
|
|
921
|
+
indoor
|
|
922
|
+
industry
|
|
923
|
+
infant
|
|
924
|
+
inflict
|
|
925
|
+
inform
|
|
926
|
+
inhale
|
|
927
|
+
inherit
|
|
928
|
+
initial
|
|
929
|
+
inject
|
|
930
|
+
injury
|
|
931
|
+
inmate
|
|
932
|
+
inner
|
|
933
|
+
innocent
|
|
934
|
+
input
|
|
935
|
+
inquiry
|
|
936
|
+
insane
|
|
937
|
+
insect
|
|
938
|
+
inside
|
|
939
|
+
inspire
|
|
940
|
+
install
|
|
941
|
+
intact
|
|
942
|
+
interest
|
|
943
|
+
into
|
|
944
|
+
invest
|
|
945
|
+
invite
|
|
946
|
+
involve
|
|
947
|
+
iron
|
|
948
|
+
island
|
|
949
|
+
isolate
|
|
950
|
+
issue
|
|
951
|
+
item
|
|
952
|
+
ivory
|
|
953
|
+
jacket
|
|
954
|
+
jaguar
|
|
955
|
+
jar
|
|
956
|
+
jazz
|
|
957
|
+
jealous
|
|
958
|
+
jeans
|
|
959
|
+
jelly
|
|
960
|
+
jewel
|
|
961
|
+
job
|
|
962
|
+
join
|
|
963
|
+
joke
|
|
964
|
+
journey
|
|
965
|
+
joy
|
|
966
|
+
judge
|
|
967
|
+
juice
|
|
968
|
+
jump
|
|
969
|
+
jungle
|
|
970
|
+
junior
|
|
971
|
+
junk
|
|
972
|
+
just
|
|
973
|
+
kangaroo
|
|
974
|
+
keen
|
|
975
|
+
keep
|
|
976
|
+
ketchup
|
|
977
|
+
key
|
|
978
|
+
kick
|
|
979
|
+
kid
|
|
980
|
+
kidney
|
|
981
|
+
kind
|
|
982
|
+
kingdom
|
|
983
|
+
kiss
|
|
984
|
+
kit
|
|
985
|
+
kitchen
|
|
986
|
+
kite
|
|
987
|
+
kitten
|
|
988
|
+
kiwi
|
|
989
|
+
knee
|
|
990
|
+
knife
|
|
991
|
+
knock
|
|
992
|
+
know
|
|
993
|
+
lab
|
|
994
|
+
label
|
|
995
|
+
labor
|
|
996
|
+
ladder
|
|
997
|
+
lady
|
|
998
|
+
lake
|
|
999
|
+
lamp
|
|
1000
|
+
language
|
|
1001
|
+
laptop
|
|
1002
|
+
large
|
|
1003
|
+
later
|
|
1004
|
+
latin
|
|
1005
|
+
laugh
|
|
1006
|
+
laundry
|
|
1007
|
+
lava
|
|
1008
|
+
law
|
|
1009
|
+
lawn
|
|
1010
|
+
lawsuit
|
|
1011
|
+
layer
|
|
1012
|
+
lazy
|
|
1013
|
+
leader
|
|
1014
|
+
leaf
|
|
1015
|
+
learn
|
|
1016
|
+
leave
|
|
1017
|
+
lecture
|
|
1018
|
+
left
|
|
1019
|
+
leg
|
|
1020
|
+
legal
|
|
1021
|
+
legend
|
|
1022
|
+
leisure
|
|
1023
|
+
lemon
|
|
1024
|
+
lend
|
|
1025
|
+
length
|
|
1026
|
+
lens
|
|
1027
|
+
leopard
|
|
1028
|
+
lesson
|
|
1029
|
+
letter
|
|
1030
|
+
level
|
|
1031
|
+
liar
|
|
1032
|
+
liberty
|
|
1033
|
+
library
|
|
1034
|
+
license
|
|
1035
|
+
life
|
|
1036
|
+
lift
|
|
1037
|
+
light
|
|
1038
|
+
like
|
|
1039
|
+
limb
|
|
1040
|
+
limit
|
|
1041
|
+
link
|
|
1042
|
+
lion
|
|
1043
|
+
liquid
|
|
1044
|
+
list
|
|
1045
|
+
little
|
|
1046
|
+
live
|
|
1047
|
+
lizard
|
|
1048
|
+
load
|
|
1049
|
+
loan
|
|
1050
|
+
lobster
|
|
1051
|
+
local
|
|
1052
|
+
lock
|
|
1053
|
+
logic
|
|
1054
|
+
lonely
|
|
1055
|
+
long
|
|
1056
|
+
loop
|
|
1057
|
+
lottery
|
|
1058
|
+
loud
|
|
1059
|
+
lounge
|
|
1060
|
+
love
|
|
1061
|
+
loyal
|
|
1062
|
+
lucky
|
|
1063
|
+
luggage
|
|
1064
|
+
lumber
|
|
1065
|
+
lunar
|
|
1066
|
+
lunch
|
|
1067
|
+
luxury
|
|
1068
|
+
lyrics
|
|
1069
|
+
machine
|
|
1070
|
+
mad
|
|
1071
|
+
magic
|
|
1072
|
+
magnet
|
|
1073
|
+
maid
|
|
1074
|
+
mail
|
|
1075
|
+
main
|
|
1076
|
+
major
|
|
1077
|
+
make
|
|
1078
|
+
mammal
|
|
1079
|
+
man
|
|
1080
|
+
manage
|
|
1081
|
+
mandate
|
|
1082
|
+
mango
|
|
1083
|
+
mansion
|
|
1084
|
+
manual
|
|
1085
|
+
maple
|
|
1086
|
+
marble
|
|
1087
|
+
march
|
|
1088
|
+
margin
|
|
1089
|
+
marine
|
|
1090
|
+
market
|
|
1091
|
+
marriage
|
|
1092
|
+
mask
|
|
1093
|
+
mass
|
|
1094
|
+
master
|
|
1095
|
+
match
|
|
1096
|
+
material
|
|
1097
|
+
math
|
|
1098
|
+
matrix
|
|
1099
|
+
matter
|
|
1100
|
+
maximum
|
|
1101
|
+
maze
|
|
1102
|
+
meadow
|
|
1103
|
+
mean
|
|
1104
|
+
measure
|
|
1105
|
+
meat
|
|
1106
|
+
mechanic
|
|
1107
|
+
medal
|
|
1108
|
+
media
|
|
1109
|
+
melody
|
|
1110
|
+
melt
|
|
1111
|
+
member
|
|
1112
|
+
memory
|
|
1113
|
+
mention
|
|
1114
|
+
menu
|
|
1115
|
+
mercy
|
|
1116
|
+
merge
|
|
1117
|
+
merit
|
|
1118
|
+
merry
|
|
1119
|
+
mesh
|
|
1120
|
+
message
|
|
1121
|
+
metal
|
|
1122
|
+
method
|
|
1123
|
+
middle
|
|
1124
|
+
midnight
|
|
1125
|
+
milk
|
|
1126
|
+
million
|
|
1127
|
+
mimic
|
|
1128
|
+
mind
|
|
1129
|
+
minimum
|
|
1130
|
+
minor
|
|
1131
|
+
minute
|
|
1132
|
+
miracle
|
|
1133
|
+
mirror
|
|
1134
|
+
misery
|
|
1135
|
+
miss
|
|
1136
|
+
mistake
|
|
1137
|
+
mix
|
|
1138
|
+
mixed
|
|
1139
|
+
mixture
|
|
1140
|
+
mobile
|
|
1141
|
+
model
|
|
1142
|
+
modify
|
|
1143
|
+
mom
|
|
1144
|
+
moment
|
|
1145
|
+
monitor
|
|
1146
|
+
monkey
|
|
1147
|
+
monster
|
|
1148
|
+
month
|
|
1149
|
+
moon
|
|
1150
|
+
moral
|
|
1151
|
+
more
|
|
1152
|
+
morning
|
|
1153
|
+
mosquito
|
|
1154
|
+
mother
|
|
1155
|
+
motion
|
|
1156
|
+
motor
|
|
1157
|
+
mountain
|
|
1158
|
+
mouse
|
|
1159
|
+
move
|
|
1160
|
+
movie
|
|
1161
|
+
much
|
|
1162
|
+
muffin
|
|
1163
|
+
mule
|
|
1164
|
+
multiply
|
|
1165
|
+
muscle
|
|
1166
|
+
museum
|
|
1167
|
+
mushroom
|
|
1168
|
+
music
|
|
1169
|
+
must
|
|
1170
|
+
mutual
|
|
1171
|
+
myself
|
|
1172
|
+
mystery
|
|
1173
|
+
myth
|
|
1174
|
+
naive
|
|
1175
|
+
name
|
|
1176
|
+
napkin
|
|
1177
|
+
narrow
|
|
1178
|
+
nasty
|
|
1179
|
+
nation
|
|
1180
|
+
nature
|
|
1181
|
+
near
|
|
1182
|
+
neck
|
|
1183
|
+
need
|
|
1184
|
+
negative
|
|
1185
|
+
neglect
|
|
1186
|
+
neither
|
|
1187
|
+
nephew
|
|
1188
|
+
nerve
|
|
1189
|
+
nest
|
|
1190
|
+
net
|
|
1191
|
+
network
|
|
1192
|
+
neutral
|
|
1193
|
+
never
|
|
1194
|
+
news
|
|
1195
|
+
next
|
|
1196
|
+
nice
|
|
1197
|
+
night
|
|
1198
|
+
noble
|
|
1199
|
+
noise
|
|
1200
|
+
nominee
|
|
1201
|
+
noodle
|
|
1202
|
+
normal
|
|
1203
|
+
north
|
|
1204
|
+
nose
|
|
1205
|
+
notable
|
|
1206
|
+
note
|
|
1207
|
+
nothing
|
|
1208
|
+
notice
|
|
1209
|
+
novel
|
|
1210
|
+
now
|
|
1211
|
+
nuclear
|
|
1212
|
+
number
|
|
1213
|
+
nurse
|
|
1214
|
+
nut
|
|
1215
|
+
oak
|
|
1216
|
+
obey
|
|
1217
|
+
object
|
|
1218
|
+
oblige
|
|
1219
|
+
obscure
|
|
1220
|
+
observe
|
|
1221
|
+
obtain
|
|
1222
|
+
obvious
|
|
1223
|
+
occur
|
|
1224
|
+
ocean
|
|
1225
|
+
october
|
|
1226
|
+
odor
|
|
1227
|
+
off
|
|
1228
|
+
offer
|
|
1229
|
+
office
|
|
1230
|
+
often
|
|
1231
|
+
oil
|
|
1232
|
+
okay
|
|
1233
|
+
old
|
|
1234
|
+
olive
|
|
1235
|
+
olympic
|
|
1236
|
+
omit
|
|
1237
|
+
once
|
|
1238
|
+
one
|
|
1239
|
+
onion
|
|
1240
|
+
online
|
|
1241
|
+
only
|
|
1242
|
+
open
|
|
1243
|
+
opera
|
|
1244
|
+
opinion
|
|
1245
|
+
oppose
|
|
1246
|
+
option
|
|
1247
|
+
orange
|
|
1248
|
+
orbit
|
|
1249
|
+
orchard
|
|
1250
|
+
order
|
|
1251
|
+
ordinary
|
|
1252
|
+
organ
|
|
1253
|
+
orient
|
|
1254
|
+
original
|
|
1255
|
+
orphan
|
|
1256
|
+
ostrich
|
|
1257
|
+
other
|
|
1258
|
+
outdoor
|
|
1259
|
+
outer
|
|
1260
|
+
output
|
|
1261
|
+
outside
|
|
1262
|
+
oval
|
|
1263
|
+
oven
|
|
1264
|
+
over
|
|
1265
|
+
own
|
|
1266
|
+
owner
|
|
1267
|
+
oxygen
|
|
1268
|
+
oyster
|
|
1269
|
+
ozone
|
|
1270
|
+
pact
|
|
1271
|
+
paddle
|
|
1272
|
+
page
|
|
1273
|
+
pair
|
|
1274
|
+
palace
|
|
1275
|
+
palm
|
|
1276
|
+
panda
|
|
1277
|
+
panel
|
|
1278
|
+
panic
|
|
1279
|
+
panther
|
|
1280
|
+
paper
|
|
1281
|
+
parade
|
|
1282
|
+
parent
|
|
1283
|
+
park
|
|
1284
|
+
parrot
|
|
1285
|
+
party
|
|
1286
|
+
pass
|
|
1287
|
+
patch
|
|
1288
|
+
path
|
|
1289
|
+
patient
|
|
1290
|
+
patrol
|
|
1291
|
+
pattern
|
|
1292
|
+
pause
|
|
1293
|
+
pave
|
|
1294
|
+
payment
|
|
1295
|
+
peace
|
|
1296
|
+
peanut
|
|
1297
|
+
pear
|
|
1298
|
+
peasant
|
|
1299
|
+
pelican
|
|
1300
|
+
pen
|
|
1301
|
+
penalty
|
|
1302
|
+
pencil
|
|
1303
|
+
people
|
|
1304
|
+
pepper
|
|
1305
|
+
perfect
|
|
1306
|
+
permit
|
|
1307
|
+
person
|
|
1308
|
+
pet
|
|
1309
|
+
phone
|
|
1310
|
+
photo
|
|
1311
|
+
phrase
|
|
1312
|
+
physical
|
|
1313
|
+
piano
|
|
1314
|
+
picnic
|
|
1315
|
+
picture
|
|
1316
|
+
piece
|
|
1317
|
+
pig
|
|
1318
|
+
pigeon
|
|
1319
|
+
pill
|
|
1320
|
+
pilot
|
|
1321
|
+
pink
|
|
1322
|
+
pioneer
|
|
1323
|
+
pipe
|
|
1324
|
+
pistol
|
|
1325
|
+
pitch
|
|
1326
|
+
pizza
|
|
1327
|
+
place
|
|
1328
|
+
planet
|
|
1329
|
+
plastic
|
|
1330
|
+
plate
|
|
1331
|
+
play
|
|
1332
|
+
please
|
|
1333
|
+
pledge
|
|
1334
|
+
pluck
|
|
1335
|
+
plug
|
|
1336
|
+
plunge
|
|
1337
|
+
poem
|
|
1338
|
+
poet
|
|
1339
|
+
point
|
|
1340
|
+
polar
|
|
1341
|
+
pole
|
|
1342
|
+
police
|
|
1343
|
+
pond
|
|
1344
|
+
pony
|
|
1345
|
+
pool
|
|
1346
|
+
popular
|
|
1347
|
+
portion
|
|
1348
|
+
position
|
|
1349
|
+
possible
|
|
1350
|
+
post
|
|
1351
|
+
potato
|
|
1352
|
+
pottery
|
|
1353
|
+
poverty
|
|
1354
|
+
powder
|
|
1355
|
+
power
|
|
1356
|
+
practice
|
|
1357
|
+
praise
|
|
1358
|
+
predict
|
|
1359
|
+
prefer
|
|
1360
|
+
prepare
|
|
1361
|
+
present
|
|
1362
|
+
pretty
|
|
1363
|
+
prevent
|
|
1364
|
+
price
|
|
1365
|
+
pride
|
|
1366
|
+
primary
|
|
1367
|
+
print
|
|
1368
|
+
priority
|
|
1369
|
+
prison
|
|
1370
|
+
private
|
|
1371
|
+
prize
|
|
1372
|
+
problem
|
|
1373
|
+
process
|
|
1374
|
+
produce
|
|
1375
|
+
profit
|
|
1376
|
+
program
|
|
1377
|
+
project
|
|
1378
|
+
promote
|
|
1379
|
+
proof
|
|
1380
|
+
property
|
|
1381
|
+
prosper
|
|
1382
|
+
protect
|
|
1383
|
+
proud
|
|
1384
|
+
provide
|
|
1385
|
+
public
|
|
1386
|
+
pudding
|
|
1387
|
+
pull
|
|
1388
|
+
pulp
|
|
1389
|
+
pulse
|
|
1390
|
+
pumpkin
|
|
1391
|
+
punch
|
|
1392
|
+
pupil
|
|
1393
|
+
puppy
|
|
1394
|
+
purchase
|
|
1395
|
+
purity
|
|
1396
|
+
purpose
|
|
1397
|
+
purse
|
|
1398
|
+
push
|
|
1399
|
+
put
|
|
1400
|
+
puzzle
|
|
1401
|
+
pyramid
|
|
1402
|
+
quality
|
|
1403
|
+
quantum
|
|
1404
|
+
quarter
|
|
1405
|
+
question
|
|
1406
|
+
quick
|
|
1407
|
+
quit
|
|
1408
|
+
quiz
|
|
1409
|
+
quote
|
|
1410
|
+
rabbit
|
|
1411
|
+
raccoon
|
|
1412
|
+
race
|
|
1413
|
+
rack
|
|
1414
|
+
radar
|
|
1415
|
+
radio
|
|
1416
|
+
rail
|
|
1417
|
+
rain
|
|
1418
|
+
raise
|
|
1419
|
+
rally
|
|
1420
|
+
ramp
|
|
1421
|
+
ranch
|
|
1422
|
+
random
|
|
1423
|
+
range
|
|
1424
|
+
rapid
|
|
1425
|
+
rare
|
|
1426
|
+
rate
|
|
1427
|
+
rather
|
|
1428
|
+
raven
|
|
1429
|
+
raw
|
|
1430
|
+
razor
|
|
1431
|
+
ready
|
|
1432
|
+
real
|
|
1433
|
+
reason
|
|
1434
|
+
rebel
|
|
1435
|
+
rebuild
|
|
1436
|
+
recall
|
|
1437
|
+
receive
|
|
1438
|
+
recipe
|
|
1439
|
+
record
|
|
1440
|
+
recycle
|
|
1441
|
+
reduce
|
|
1442
|
+
reflect
|
|
1443
|
+
reform
|
|
1444
|
+
refuse
|
|
1445
|
+
region
|
|
1446
|
+
regret
|
|
1447
|
+
regular
|
|
1448
|
+
reject
|
|
1449
|
+
relax
|
|
1450
|
+
release
|
|
1451
|
+
relief
|
|
1452
|
+
rely
|
|
1453
|
+
remain
|
|
1454
|
+
remember
|
|
1455
|
+
remind
|
|
1456
|
+
remove
|
|
1457
|
+
render
|
|
1458
|
+
renew
|
|
1459
|
+
rent
|
|
1460
|
+
reopen
|
|
1461
|
+
repair
|
|
1462
|
+
repeat
|
|
1463
|
+
replace
|
|
1464
|
+
report
|
|
1465
|
+
require
|
|
1466
|
+
rescue
|
|
1467
|
+
resemble
|
|
1468
|
+
resist
|
|
1469
|
+
resource
|
|
1470
|
+
response
|
|
1471
|
+
result
|
|
1472
|
+
retire
|
|
1473
|
+
retreat
|
|
1474
|
+
return
|
|
1475
|
+
reunion
|
|
1476
|
+
reveal
|
|
1477
|
+
review
|
|
1478
|
+
reward
|
|
1479
|
+
rhythm
|
|
1480
|
+
rib
|
|
1481
|
+
ribbon
|
|
1482
|
+
rice
|
|
1483
|
+
rich
|
|
1484
|
+
ride
|
|
1485
|
+
ridge
|
|
1486
|
+
rifle
|
|
1487
|
+
right
|
|
1488
|
+
rigid
|
|
1489
|
+
ring
|
|
1490
|
+
riot
|
|
1491
|
+
ripple
|
|
1492
|
+
risk
|
|
1493
|
+
ritual
|
|
1494
|
+
rival
|
|
1495
|
+
river
|
|
1496
|
+
road
|
|
1497
|
+
roast
|
|
1498
|
+
robot
|
|
1499
|
+
robust
|
|
1500
|
+
rocket
|
|
1501
|
+
romance
|
|
1502
|
+
roof
|
|
1503
|
+
rookie
|
|
1504
|
+
room
|
|
1505
|
+
rose
|
|
1506
|
+
rotate
|
|
1507
|
+
rough
|
|
1508
|
+
round
|
|
1509
|
+
route
|
|
1510
|
+
royal
|
|
1511
|
+
rubber
|
|
1512
|
+
rude
|
|
1513
|
+
rug
|
|
1514
|
+
rule
|
|
1515
|
+
run
|
|
1516
|
+
runway
|
|
1517
|
+
rural
|
|
1518
|
+
sad
|
|
1519
|
+
saddle
|
|
1520
|
+
sadness
|
|
1521
|
+
safe
|
|
1522
|
+
sail
|
|
1523
|
+
salad
|
|
1524
|
+
salmon
|
|
1525
|
+
salon
|
|
1526
|
+
salt
|
|
1527
|
+
salute
|
|
1528
|
+
same
|
|
1529
|
+
sample
|
|
1530
|
+
sand
|
|
1531
|
+
satisfy
|
|
1532
|
+
satoshi
|
|
1533
|
+
sauce
|
|
1534
|
+
sausage
|
|
1535
|
+
save
|
|
1536
|
+
say
|
|
1537
|
+
scale
|
|
1538
|
+
scan
|
|
1539
|
+
scare
|
|
1540
|
+
scatter
|
|
1541
|
+
scene
|
|
1542
|
+
scheme
|
|
1543
|
+
school
|
|
1544
|
+
science
|
|
1545
|
+
scissors
|
|
1546
|
+
scorpion
|
|
1547
|
+
scout
|
|
1548
|
+
scrap
|
|
1549
|
+
screen
|
|
1550
|
+
script
|
|
1551
|
+
scrub
|
|
1552
|
+
sea
|
|
1553
|
+
search
|
|
1554
|
+
season
|
|
1555
|
+
seat
|
|
1556
|
+
second
|
|
1557
|
+
secret
|
|
1558
|
+
section
|
|
1559
|
+
security
|
|
1560
|
+
seed
|
|
1561
|
+
seek
|
|
1562
|
+
segment
|
|
1563
|
+
select
|
|
1564
|
+
sell
|
|
1565
|
+
seminar
|
|
1566
|
+
senior
|
|
1567
|
+
sense
|
|
1568
|
+
sentence
|
|
1569
|
+
series
|
|
1570
|
+
service
|
|
1571
|
+
session
|
|
1572
|
+
settle
|
|
1573
|
+
setup
|
|
1574
|
+
seven
|
|
1575
|
+
shadow
|
|
1576
|
+
shaft
|
|
1577
|
+
shallow
|
|
1578
|
+
share
|
|
1579
|
+
shed
|
|
1580
|
+
shell
|
|
1581
|
+
sheriff
|
|
1582
|
+
shield
|
|
1583
|
+
shift
|
|
1584
|
+
shine
|
|
1585
|
+
ship
|
|
1586
|
+
shiver
|
|
1587
|
+
shock
|
|
1588
|
+
shoe
|
|
1589
|
+
shoot
|
|
1590
|
+
shop
|
|
1591
|
+
short
|
|
1592
|
+
shoulder
|
|
1593
|
+
shove
|
|
1594
|
+
shrimp
|
|
1595
|
+
shrug
|
|
1596
|
+
shuffle
|
|
1597
|
+
shy
|
|
1598
|
+
sibling
|
|
1599
|
+
sick
|
|
1600
|
+
side
|
|
1601
|
+
siege
|
|
1602
|
+
sight
|
|
1603
|
+
sign
|
|
1604
|
+
silent
|
|
1605
|
+
silk
|
|
1606
|
+
silly
|
|
1607
|
+
silver
|
|
1608
|
+
similar
|
|
1609
|
+
simple
|
|
1610
|
+
since
|
|
1611
|
+
sing
|
|
1612
|
+
siren
|
|
1613
|
+
sister
|
|
1614
|
+
situate
|
|
1615
|
+
six
|
|
1616
|
+
size
|
|
1617
|
+
skate
|
|
1618
|
+
sketch
|
|
1619
|
+
ski
|
|
1620
|
+
skill
|
|
1621
|
+
skin
|
|
1622
|
+
skirt
|
|
1623
|
+
skull
|
|
1624
|
+
slab
|
|
1625
|
+
slam
|
|
1626
|
+
sleep
|
|
1627
|
+
slender
|
|
1628
|
+
slice
|
|
1629
|
+
slide
|
|
1630
|
+
slight
|
|
1631
|
+
slim
|
|
1632
|
+
slogan
|
|
1633
|
+
slot
|
|
1634
|
+
slow
|
|
1635
|
+
slush
|
|
1636
|
+
small
|
|
1637
|
+
smart
|
|
1638
|
+
smile
|
|
1639
|
+
smoke
|
|
1640
|
+
smooth
|
|
1641
|
+
snack
|
|
1642
|
+
snake
|
|
1643
|
+
snap
|
|
1644
|
+
sniff
|
|
1645
|
+
snow
|
|
1646
|
+
soap
|
|
1647
|
+
soccer
|
|
1648
|
+
social
|
|
1649
|
+
sock
|
|
1650
|
+
soda
|
|
1651
|
+
soft
|
|
1652
|
+
solar
|
|
1653
|
+
soldier
|
|
1654
|
+
solid
|
|
1655
|
+
solution
|
|
1656
|
+
solve
|
|
1657
|
+
someone
|
|
1658
|
+
song
|
|
1659
|
+
soon
|
|
1660
|
+
sorry
|
|
1661
|
+
sort
|
|
1662
|
+
soul
|
|
1663
|
+
sound
|
|
1664
|
+
soup
|
|
1665
|
+
source
|
|
1666
|
+
south
|
|
1667
|
+
space
|
|
1668
|
+
spare
|
|
1669
|
+
spatial
|
|
1670
|
+
spawn
|
|
1671
|
+
speak
|
|
1672
|
+
special
|
|
1673
|
+
speed
|
|
1674
|
+
spell
|
|
1675
|
+
spend
|
|
1676
|
+
sphere
|
|
1677
|
+
spice
|
|
1678
|
+
spider
|
|
1679
|
+
spike
|
|
1680
|
+
spin
|
|
1681
|
+
spirit
|
|
1682
|
+
split
|
|
1683
|
+
spoil
|
|
1684
|
+
sponsor
|
|
1685
|
+
spoon
|
|
1686
|
+
sport
|
|
1687
|
+
spot
|
|
1688
|
+
spray
|
|
1689
|
+
spread
|
|
1690
|
+
spring
|
|
1691
|
+
spy
|
|
1692
|
+
square
|
|
1693
|
+
squeeze
|
|
1694
|
+
squirrel
|
|
1695
|
+
stable
|
|
1696
|
+
stadium
|
|
1697
|
+
staff
|
|
1698
|
+
stage
|
|
1699
|
+
stairs
|
|
1700
|
+
stamp
|
|
1701
|
+
stand
|
|
1702
|
+
start
|
|
1703
|
+
state
|
|
1704
|
+
stay
|
|
1705
|
+
steak
|
|
1706
|
+
steel
|
|
1707
|
+
stem
|
|
1708
|
+
step
|
|
1709
|
+
stereo
|
|
1710
|
+
stick
|
|
1711
|
+
still
|
|
1712
|
+
sting
|
|
1713
|
+
stock
|
|
1714
|
+
stomach
|
|
1715
|
+
stone
|
|
1716
|
+
stool
|
|
1717
|
+
story
|
|
1718
|
+
stove
|
|
1719
|
+
strategy
|
|
1720
|
+
street
|
|
1721
|
+
strike
|
|
1722
|
+
strong
|
|
1723
|
+
struggle
|
|
1724
|
+
student
|
|
1725
|
+
stuff
|
|
1726
|
+
stumble
|
|
1727
|
+
style
|
|
1728
|
+
subject
|
|
1729
|
+
submit
|
|
1730
|
+
subway
|
|
1731
|
+
success
|
|
1732
|
+
such
|
|
1733
|
+
sudden
|
|
1734
|
+
suffer
|
|
1735
|
+
sugar
|
|
1736
|
+
suggest
|
|
1737
|
+
suit
|
|
1738
|
+
summer
|
|
1739
|
+
sun
|
|
1740
|
+
sunny
|
|
1741
|
+
sunset
|
|
1742
|
+
super
|
|
1743
|
+
supply
|
|
1744
|
+
supreme
|
|
1745
|
+
sure
|
|
1746
|
+
surface
|
|
1747
|
+
surge
|
|
1748
|
+
surprise
|
|
1749
|
+
surround
|
|
1750
|
+
survey
|
|
1751
|
+
suspect
|
|
1752
|
+
sustain
|
|
1753
|
+
swallow
|
|
1754
|
+
swamp
|
|
1755
|
+
swap
|
|
1756
|
+
swarm
|
|
1757
|
+
swear
|
|
1758
|
+
sweet
|
|
1759
|
+
swift
|
|
1760
|
+
swim
|
|
1761
|
+
swing
|
|
1762
|
+
switch
|
|
1763
|
+
sword
|
|
1764
|
+
symbol
|
|
1765
|
+
symptom
|
|
1766
|
+
syrup
|
|
1767
|
+
system
|
|
1768
|
+
table
|
|
1769
|
+
tackle
|
|
1770
|
+
tag
|
|
1771
|
+
tail
|
|
1772
|
+
talent
|
|
1773
|
+
talk
|
|
1774
|
+
tank
|
|
1775
|
+
tape
|
|
1776
|
+
target
|
|
1777
|
+
task
|
|
1778
|
+
taste
|
|
1779
|
+
tattoo
|
|
1780
|
+
taxi
|
|
1781
|
+
teach
|
|
1782
|
+
team
|
|
1783
|
+
tell
|
|
1784
|
+
ten
|
|
1785
|
+
tenant
|
|
1786
|
+
tennis
|
|
1787
|
+
tent
|
|
1788
|
+
term
|
|
1789
|
+
test
|
|
1790
|
+
text
|
|
1791
|
+
thank
|
|
1792
|
+
that
|
|
1793
|
+
theme
|
|
1794
|
+
then
|
|
1795
|
+
theory
|
|
1796
|
+
there
|
|
1797
|
+
they
|
|
1798
|
+
thing
|
|
1799
|
+
this
|
|
1800
|
+
thought
|
|
1801
|
+
three
|
|
1802
|
+
thrive
|
|
1803
|
+
throw
|
|
1804
|
+
thumb
|
|
1805
|
+
thunder
|
|
1806
|
+
ticket
|
|
1807
|
+
tide
|
|
1808
|
+
tiger
|
|
1809
|
+
tilt
|
|
1810
|
+
timber
|
|
1811
|
+
time
|
|
1812
|
+
tiny
|
|
1813
|
+
tip
|
|
1814
|
+
tired
|
|
1815
|
+
tissue
|
|
1816
|
+
title
|
|
1817
|
+
toast
|
|
1818
|
+
tobacco
|
|
1819
|
+
today
|
|
1820
|
+
toddler
|
|
1821
|
+
toe
|
|
1822
|
+
together
|
|
1823
|
+
toilet
|
|
1824
|
+
token
|
|
1825
|
+
tomato
|
|
1826
|
+
tomorrow
|
|
1827
|
+
tone
|
|
1828
|
+
tongue
|
|
1829
|
+
tonight
|
|
1830
|
+
tool
|
|
1831
|
+
tooth
|
|
1832
|
+
top
|
|
1833
|
+
topic
|
|
1834
|
+
topple
|
|
1835
|
+
torch
|
|
1836
|
+
tornado
|
|
1837
|
+
tortoise
|
|
1838
|
+
toss
|
|
1839
|
+
total
|
|
1840
|
+
tourist
|
|
1841
|
+
toward
|
|
1842
|
+
tower
|
|
1843
|
+
town
|
|
1844
|
+
toy
|
|
1845
|
+
track
|
|
1846
|
+
trade
|
|
1847
|
+
traffic
|
|
1848
|
+
tragic
|
|
1849
|
+
train
|
|
1850
|
+
transfer
|
|
1851
|
+
trap
|
|
1852
|
+
trash
|
|
1853
|
+
travel
|
|
1854
|
+
tray
|
|
1855
|
+
treat
|
|
1856
|
+
tree
|
|
1857
|
+
trend
|
|
1858
|
+
trial
|
|
1859
|
+
tribe
|
|
1860
|
+
trick
|
|
1861
|
+
trigger
|
|
1862
|
+
trim
|
|
1863
|
+
trip
|
|
1864
|
+
trophy
|
|
1865
|
+
trouble
|
|
1866
|
+
truck
|
|
1867
|
+
true
|
|
1868
|
+
truly
|
|
1869
|
+
trumpet
|
|
1870
|
+
trust
|
|
1871
|
+
truth
|
|
1872
|
+
try
|
|
1873
|
+
tube
|
|
1874
|
+
tuition
|
|
1875
|
+
tumble
|
|
1876
|
+
tuna
|
|
1877
|
+
tunnel
|
|
1878
|
+
turkey
|
|
1879
|
+
turn
|
|
1880
|
+
turtle
|
|
1881
|
+
twelve
|
|
1882
|
+
twenty
|
|
1883
|
+
twice
|
|
1884
|
+
twin
|
|
1885
|
+
twist
|
|
1886
|
+
two
|
|
1887
|
+
type
|
|
1888
|
+
typical
|
|
1889
|
+
ugly
|
|
1890
|
+
umbrella
|
|
1891
|
+
unable
|
|
1892
|
+
unaware
|
|
1893
|
+
uncle
|
|
1894
|
+
uncover
|
|
1895
|
+
under
|
|
1896
|
+
undo
|
|
1897
|
+
unfair
|
|
1898
|
+
unfold
|
|
1899
|
+
unhappy
|
|
1900
|
+
uniform
|
|
1901
|
+
unique
|
|
1902
|
+
unit
|
|
1903
|
+
universe
|
|
1904
|
+
unknown
|
|
1905
|
+
unlock
|
|
1906
|
+
until
|
|
1907
|
+
unusual
|
|
1908
|
+
unveil
|
|
1909
|
+
update
|
|
1910
|
+
upgrade
|
|
1911
|
+
uphold
|
|
1912
|
+
upon
|
|
1913
|
+
upper
|
|
1914
|
+
upset
|
|
1915
|
+
urban
|
|
1916
|
+
urge
|
|
1917
|
+
usage
|
|
1918
|
+
use
|
|
1919
|
+
used
|
|
1920
|
+
useful
|
|
1921
|
+
useless
|
|
1922
|
+
usual
|
|
1923
|
+
utility
|
|
1924
|
+
vacant
|
|
1925
|
+
vacuum
|
|
1926
|
+
vague
|
|
1927
|
+
valid
|
|
1928
|
+
valley
|
|
1929
|
+
valve
|
|
1930
|
+
van
|
|
1931
|
+
vanish
|
|
1932
|
+
vapor
|
|
1933
|
+
various
|
|
1934
|
+
vast
|
|
1935
|
+
vault
|
|
1936
|
+
vehicle
|
|
1937
|
+
velvet
|
|
1938
|
+
vendor
|
|
1939
|
+
venture
|
|
1940
|
+
venue
|
|
1941
|
+
verb
|
|
1942
|
+
verify
|
|
1943
|
+
version
|
|
1944
|
+
very
|
|
1945
|
+
vessel
|
|
1946
|
+
veteran
|
|
1947
|
+
viable
|
|
1948
|
+
vibrant
|
|
1949
|
+
vicious
|
|
1950
|
+
victory
|
|
1951
|
+
video
|
|
1952
|
+
view
|
|
1953
|
+
village
|
|
1954
|
+
vintage
|
|
1955
|
+
violin
|
|
1956
|
+
virtual
|
|
1957
|
+
virus
|
|
1958
|
+
visa
|
|
1959
|
+
visit
|
|
1960
|
+
visual
|
|
1961
|
+
vital
|
|
1962
|
+
vivid
|
|
1963
|
+
vocal
|
|
1964
|
+
voice
|
|
1965
|
+
void
|
|
1966
|
+
volcano
|
|
1967
|
+
volume
|
|
1968
|
+
vote
|
|
1969
|
+
voyage
|
|
1970
|
+
wage
|
|
1971
|
+
wagon
|
|
1972
|
+
wait
|
|
1973
|
+
walk
|
|
1974
|
+
wall
|
|
1975
|
+
walnut
|
|
1976
|
+
want
|
|
1977
|
+
warfare
|
|
1978
|
+
warm
|
|
1979
|
+
warrior
|
|
1980
|
+
wash
|
|
1981
|
+
wasp
|
|
1982
|
+
waste
|
|
1983
|
+
water
|
|
1984
|
+
wave
|
|
1985
|
+
way
|
|
1986
|
+
wealth
|
|
1987
|
+
weapon
|
|
1988
|
+
wear
|
|
1989
|
+
weasel
|
|
1990
|
+
weather
|
|
1991
|
+
web
|
|
1992
|
+
wedding
|
|
1993
|
+
weekend
|
|
1994
|
+
weird
|
|
1995
|
+
welcome
|
|
1996
|
+
west
|
|
1997
|
+
wet
|
|
1998
|
+
whale
|
|
1999
|
+
what
|
|
2000
|
+
wheat
|
|
2001
|
+
wheel
|
|
2002
|
+
when
|
|
2003
|
+
where
|
|
2004
|
+
whip
|
|
2005
|
+
whisper
|
|
2006
|
+
wide
|
|
2007
|
+
width
|
|
2008
|
+
wife
|
|
2009
|
+
wild
|
|
2010
|
+
will
|
|
2011
|
+
win
|
|
2012
|
+
window
|
|
2013
|
+
wine
|
|
2014
|
+
wing
|
|
2015
|
+
wink
|
|
2016
|
+
winner
|
|
2017
|
+
winter
|
|
2018
|
+
wire
|
|
2019
|
+
wisdom
|
|
2020
|
+
wise
|
|
2021
|
+
wish
|
|
2022
|
+
witness
|
|
2023
|
+
wolf
|
|
2024
|
+
woman
|
|
2025
|
+
wonder
|
|
2026
|
+
wood
|
|
2027
|
+
wool
|
|
2028
|
+
word
|
|
2029
|
+
work
|
|
2030
|
+
world
|
|
2031
|
+
worry
|
|
2032
|
+
worth
|
|
2033
|
+
wrap
|
|
2034
|
+
wreck
|
|
2035
|
+
wrestle
|
|
2036
|
+
wrist
|
|
2037
|
+
write
|
|
2038
|
+
wrong
|
|
2039
|
+
yard
|
|
2040
|
+
year
|
|
2041
|
+
yellow
|
|
2042
|
+
you
|
|
2043
|
+
young
|
|
2044
|
+
youth
|
|
2045
|
+
zebra
|
|
2046
|
+
zero
|
|
2047
|
+
zone
|
|
2048
|
+
zoo`.split(`
|
|
2049
|
+
`),re=12;function rn(s){if(s.length!==16)throw new Error(`Invalid share length: expected 16, got ${s.length}`);const r=Dt(s,ce).split(" ");if(r.length!==re)throw new Error(`Unexpected word count: expected ${re}, got ${r.length}`);return r}function nn(s){if(s.length!==re)throw new Error(`Invalid word count: expected ${re}, got ${s.length}`);const t=s.join(" ").toLowerCase().trim();if(!Es(t,ce))throw new Error("Invalid recovery phrase: checksum mismatch");const r=Ss(t,ce);if(r.length!==16)throw new Error(`Invalid entropy length: expected 16, got ${r.length}`);return A.toShamirShare(r)}function an(s){if(s.length!==16)throw new Error(`Invalid seed length: expected 16, got ${s.length}`);const r=Dt(s,ce).split(" ");if(r.length!==re)throw new Error(`Unexpected word count: expected ${re}, got ${r.length}`);return r}function on(s){if(s.length!==re)throw new Error(`Invalid word count: expected ${re}, got ${s.length}`);const t=s.join(" ").toLowerCase().trim();if(!Es(t,ce))throw new Error("Invalid recovery phrase: checksum mismatch");const r=Ss(t,ce);if(r.length!==16)throw new Error(`Invalid entropy length: expected 16, got ${r.length}`);return A.toSeed(r)}function Bt(s){if(s.length!==re)return!1;const t=s.join(" ").toLowerCase().trim();return Es(t,ce)}function Te(s){return ce.includes(s.toLowerCase().trim())}function ln(s,t=5){const r=s.toLowerCase().trim();return r.length===0?[]:ce.filter(o=>o.startsWith(r)).slice(0,t)}function cn(s){const t=[];for(let r=0;r<s.length;r+=4)t.push(s.slice(r,r+4));return t}function dn(s){return s.toLowerCase().replace(/[,\n\r\t]+/g," ").split(/\s+/).map(t=>t.trim()).filter(t=>t.length>0)}function un({className:s="",variant:t="default",size:r="md",children:o,menuItems:n=[],hideSignOut:a=!1}){const{user:c,isAuthenticated:i,isLoading:d,openLoginModal:u,logout:p}=A.useAuth(),[f,h]=l.useState(!1),[w,m]=l.useState(-1),g=l.useRef(null),y=l.useRef(null),v=l.useMemo(()=>[...n,...a?[]:[{label:"Sign out",onClick:p}]],[n,a,p]);l.useEffect(()=>{if(!f)return;const b=T=>{g.current&&!g.current.contains(T.target)&&(h(!1),m(-1))},S=T=>{T.key==="Escape"&&(h(!1),m(-1),y.current?.focus())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",S)}},[f]);const x=l.useCallback(b=>{if(!(!f||v.length===0))switch(b.key){case"ArrowDown":b.preventDefault(),m(S=>(S+1)%v.length);break;case"ArrowUp":b.preventDefault(),m(S=>(S-1+v.length)%v.length);break;case"Home":b.preventDefault(),m(0);break;case"End":b.preventDefault(),m(v.length-1);break;case"Enter":case" ":w>=0&&(b.preventDefault(),v[w].onClick(),h(!1),m(-1));break}},[f,w,v]),j=l.useCallback(()=>{v.length!==0&&(h(b=>!b),m(-1))},[v.length]),C={sm:"cedros-button-sm",md:"cedros-button-md",lg:"cedros-button-lg"},k={default:"cedros-button-primary",outline:"cedros-button-outline",ghost:"cedros-button-ghost"};if(d)return e.jsx("button",{type:"button",className:`cedros-button ${k[t]} ${C[r]} ${s}`,disabled:!0,children:e.jsx(A.LoadingSpinner,{size:"sm"})});if(i&&c){const b=c.name||c.email||"User",S=O.sanitizeImageUrl(c.picture);return e.jsxs("div",{className:"cedros-user-menu",ref:g,onKeyDown:x,children:[e.jsxs("button",{ref:y,type:"button",className:`cedros-button cedros-user-button ${C[r]} ${s}`,"aria-haspopup":"menu","aria-expanded":f,"aria-label":`User menu for ${b}`,onClick:j,children:[S?e.jsx("img",{src:S,alt:b,className:"cedros-user-avatar",referrerPolicy:"no-referrer",crossOrigin:"anonymous"}):e.jsx("div",{className:"cedros-user-avatar-placeholder",children:(b[0]||"?").toUpperCase()}),e.jsx("span",{className:"cedros-user-name",children:b})]}),f&&e.jsxs("div",{className:"cedros-dropdown cedros-dropdown-open",role:"menu",children:[n.map((T,N)=>e.jsxs("button",{type:"button",className:`cedros-dropdown-item ${w===N?"cedros-dropdown-item-focused":""}`,role:"menuitem",tabIndex:w===N?0:-1,onClick:()=>{T.onClick(),h(!1)},children:[T.icon&&e.jsx("span",{className:"cedros-dropdown-icon",children:T.icon}),T.label]},N)),n.length>0&&!a&&e.jsx("div",{className:"cedros-dropdown-divider",role:"separator"}),!a&&e.jsx("button",{type:"button",className:`cedros-dropdown-item cedros-dropdown-item-danger ${w===n.length?"cedros-dropdown-item-focused":""}`,role:"menuitem",tabIndex:w===n.length?0:-1,onClick:()=>{p(),h(!1)},children:"Sign out"})]})]})}return e.jsx("button",{type:"button",className:`cedros-button ${k[t]} ${C[r]} ${s}`,onClick:u,children:o||"Sign in"})}function Ps(){const{config:s}=A.useCedrosLogin(),[t,r]=l.useState(!1),[o,n]=l.useState(!1),[a,c]=l.useState(null),i=l.useMemo(()=>new A.ApiClient({baseUrl:s.serverUrl,timeoutMs:s.requestTimeout,retryAttempts:s.retryAttempts}),[s.serverUrl,s.requestTimeout,s.retryAttempts]),{checkLimit:d,getRemainingAttempts:u}=O.useRateLimiter({maxAttempts:3,windowMs:3e5}),p=l.useCallback(async m=>{if(!_e.validateEmail(m)){const g={code:"VALIDATION_ERROR",message:"Please enter a valid email address"};throw c(g),g}try{d()}catch(g){const y={code:"RATE_LIMITED",message:g instanceof Error?g.message:"Too many attempts"};throw c(y),y}r(!0),c(null),n(!1);try{await i.post("/forgot-password",{email:m}),n(!0)}catch(g){const y=A.handleApiError(g,"Failed to send reset email");throw c(y),y}finally{r(!1)}},[i,d]),f=l.useCallback(async(m,g)=>{r(!0),c(null),n(!1);try{await i.post("/reset-password",{token:m,newPassword:g}),n(!0)}catch(y){const v=A.handleApiError(y,"Failed to reset password");throw c(v),v}finally{r(!1)}},[i]),h=l.useCallback(()=>c(null),[]),w=l.useCallback(()=>{c(null),n(!1),r(!1)},[]);return{forgotPassword:p,resetPassword:f,isLoading:t,isSuccess:o,error:a,clearError:h,reset:w,remainingAttempts:u()}}function Ft({onSuccess:s,onCancel:t,className:r=""}){const[o,n]=l.useState(""),{forgotPassword:a,isLoading:c,isSuccess:i,error:d,clearError:u}=Ps(),p=l.useId(),f=async h=>{h.preventDefault();try{await a(o),s?.()}catch{}};return i?e.jsxs("div",{className:`cedros-forgot-password-success ${r}`,children:[e.jsxs("svg",{className:"cedros-success-icon",width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"24",cy:"24",r:"22",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M14 24l7 7 13-13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsx("h3",{className:"cedros-success-title",children:"Check your email"}),e.jsxs("p",{className:"cedros-success-message",children:["If an account exists for ",e.jsx("strong",{children:o}),", you will receive a password reset link shortly."]}),t&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-md cedros-button-outline",onClick:t,children:"Back to login"})]}):e.jsxs("form",{className:`cedros-forgot-password-form ${r}`,onSubmit:f,children:[e.jsxs("div",{className:"cedros-form-header",children:[e.jsx("h3",{className:"cedros-form-title",children:"Forgot password?"}),e.jsx("p",{className:"cedros-form-subtitle",children:"Enter your email address and we'll send you a link to reset your password."})]}),e.jsx(A.ErrorMessage,{error:d,onDismiss:u}),e.jsxs("div",{className:"cedros-form-field",children:[e.jsx("label",{htmlFor:p,className:"cedros-label",children:"Email address"}),e.jsx("input",{id:p,type:"email",className:"cedros-input",value:o,onChange:h=>n(h.target.value),placeholder:"you@example.com",required:!0,autoComplete:"email",disabled:c})]}),e.jsxs("div",{className:"cedros-form-actions",children:[e.jsx("button",{type:"submit",className:"cedros-button cedros-button-md cedros-button-primary cedros-button-full",disabled:c||!o,children:c?e.jsxs(e.Fragment,{children:[e.jsx(A.LoadingSpinner,{size:"sm"}),"Sending..."]}):"Send reset link"}),t&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-md cedros-button-ghost cedros-button-full",onClick:t,disabled:c,children:"Back to login"})]})]})}const hn={loading:!1,loaded:!1,error:null,callbacks:[],load(){return this.loaded?Promise.resolve():this.loading?new Promise((s,t)=>{this.callbacks.push({resolve:s,reject:t})}):(this.loading=!0,new Promise((s,t)=>{this.callbacks.push({resolve:s,reject:t});const r=document.getElementById("apple-signin-script");if(r){window.AppleID?(this.loaded=!0,this.loading=!1,this.callbacks.forEach(n=>n.resolve()),this.callbacks=[]):r.addEventListener("load",()=>{this.loaded=!0,this.loading=!1,this.callbacks.forEach(n=>n.resolve()),this.callbacks=[]});return}const o=document.createElement("script");o.src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",o.async=!0,o.defer=!0,o.id="apple-signin-script",o.onload=()=>{this.loaded=!0,this.loading=!1,this.callbacks.forEach(n=>n.resolve()),this.callbacks=[]},o.onerror=()=>{this.loading=!1,o.remove();const n=new Error("Failed to load Apple Sign In script");this.callbacks.forEach(a=>a.reject(n)),this.callbacks=[]},document.head.appendChild(o)}))}};function Ut(){const{config:s,_internal:t}=A.useCedrosLogin(),[r,o]=l.useState(!1),[n,a]=l.useState(!1),[c,i]=l.useState(null),d=l.useRef(s),u=l.useMemo(()=>new A.ApiClient({baseUrl:s.serverUrl,timeoutMs:s.requestTimeout,retryAttempts:s.retryAttempts}),[s.serverUrl,s.requestTimeout,s.retryAttempts]);l.useEffect(()=>{d.current=s},[s]),l.useEffect(()=>{if(!s.appleClientId)return;let h=!0;const w=()=>{if(h)try{window.AppleID?.auth?.init({clientId:s.appleClientId,scope:"name email",redirectURI:window.location.origin,usePopup:!0}),h&&a(!0)}catch{h&&i({code:"SERVER_ERROR",message:"Failed to initialize Apple Sign In"})}};return hn.load().then(()=>{h&&w()}).catch(()=>{h&&i({code:"SERVER_ERROR",message:"Failed to load Apple Sign In"})}),()=>{h=!1}},[s.appleClientId]);const p=l.useCallback(async()=>{if(!s.appleClientId){const h={code:"VALIDATION_ERROR",message:"Apple Client ID not configured"};throw i(h),h}if(!n){const h={code:"VALIDATION_ERROR",message:"Apple Sign In not initialized"};throw i(h),h}o(!0),i(null);try{const h=await window.AppleID.auth.signIn(),w=h.authorization?.id_token;if(!w)throw new Error("No ID token received from Apple");const m=h.user?.name?`${h.user.name.firstName||""} ${h.user.name.lastName||""}`.trim():void 0,g=await u.post("/apple",{idToken:w,name:m||void 0});return d.current.callbacks?.onLoginSuccess?.(g.user,"apple"),t?.handleLoginSuccess(g.user,g.tokens),o(!1),g}catch(h){if(h.error==="popup_closed_by_user"){const g={code:"SERVER_ERROR",message:"Apple Sign In was cancelled"};throw i(g),o(!1),g}const m=A.handleApiError(h,"Apple sign-in failed");throw i(m),o(!1),m}},[s.appleClientId,n,u,t]),f=l.useCallback(()=>i(null),[]);return{signIn:p,isLoading:r,isInitialized:n,error:c,clearError:f}}function It(){if(typeof window>"u"||typeof navigator>"u")return!1;const s=navigator.userAgent.toLowerCase(),t=(navigator.platform||"").toLowerCase();return!!(/iphone|ipad|ipod/.test(s)||t.includes("mac")||/macintosh/.test(s)||t==="macintel"&&navigator.maxTouchPoints>1)}function Wt({onSuccess:s,onError:t,className:r="",variant:o="default",size:n="md",disabled:a=!1,hideOnNonApple:c=!0}){const{signIn:i,isLoading:d,isInitialized:u}=Ut(),[p]=l.useState(()=>It());if(c&&!p)return null;const f=async()=>{try{await i(),s?.()}catch(m){const g=m instanceof Error?m:new Error(String(m));t?.(g)}},h={sm:"cedros-button-sm",md:"cedros-button-md",lg:"cedros-button-lg"},w={default:"cedros-button-apple",outline:"cedros-button-apple-outline"};return e.jsxs("button",{type:"button",className:`cedros-button ${w[o]} ${h[n]} ${r}`,onClick:f,disabled:a||!u||d,"aria-label":"Sign in with Apple",children:[d?e.jsx(A.LoadingSpinner,{size:"sm"}):e.jsx("svg",{className:"cedros-button-icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z"})}),e.jsx("span",{children:"Continue with Apple"})]})}function J(s,t){if(!s)throw new Error(t)}function mn(s){return s.replace(/-/g,"+").replace(/_/g,"/")}function We(s){J(typeof s=="string"&&s.length>0,"Expected base64url string");const t=mn(s),r=t+"=".repeat((4-t.length%4)%4),o=atob(r),n=new Uint8Array(o.length);for(let a=0;a<o.length;a++)n[a]=o.charCodeAt(a);return n.buffer}function fe(s){const t=new Uint8Array(s);let r="";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function Ot(s){J(typeof s=="object"&&s!==null,"Invalid credential descriptor");const t=s;return J(typeof t.type=="string","Invalid credential descriptor type"),J(typeof t.id=="string","Invalid credential descriptor id"),{type:t.type,id:We(t.id),transports:Array.isArray(t.transports)?t.transports:void 0}}function pn(s){J(s&&typeof s=="object","Missing creation options");const t=s.publicKey;J(t&&typeof t=="object","Missing creation options.publicKey"),J(typeof t.challenge=="string","Missing creation challenge"),J(typeof t.rp=="object"&&t.rp!==null,"Missing rp"),J(typeof t.user=="object"&&t.user!==null,"Missing user");const r=t.rp,o=t.user;J(typeof r.name=="string","Missing rp.name"),J(typeof o.id=="string","Missing user.id"),J(typeof o.name=="string","Missing user.name"),J(typeof o.displayName=="string","Missing user.displayName");const n=Array.isArray(t.excludeCredentials)?t.excludeCredentials.map(Ot):void 0,a=Array.isArray(t.pubKeyCredParams)?t.pubKeyCredParams.map(c=>({type:c.type,alg:c.alg})):[];return{challenge:We(t.challenge),rp:{name:r.name,id:typeof r.id=="string"?r.id:void 0},user:{id:We(o.id),name:o.name,displayName:o.displayName},pubKeyCredParams:a,timeout:typeof t.timeout=="number"?t.timeout:void 0,attestation:typeof t.attestation=="string"?t.attestation:void 0,authenticatorSelection:typeof t.authenticatorSelection=="object"&&t.authenticatorSelection!==null?t.authenticatorSelection:void 0,excludeCredentials:n,extensions:typeof t.extensions=="object"&&t.extensions!==null?t.extensions:void 0}}function fn(s){J(s&&typeof s=="object","Missing request options");const t=s.publicKey;J(t&&typeof t=="object","Missing request options.publicKey"),J(typeof t.challenge=="string","Missing request challenge");const r=Array.isArray(t.allowCredentials)?t.allowCredentials.map(Ot):void 0;return{challenge:We(t.challenge),rpId:typeof t.rpId=="string"?t.rpId:void 0,timeout:typeof t.timeout=="number"?t.timeout:void 0,userVerification:typeof t.userVerification=="string"?t.userVerification:void 0,allowCredentials:r,extensions:typeof t.extensions=="object"&&t.extensions!==null?t.extensions:void 0}}function $s(s){const t=fe(s.rawId),r=s.response,n={...{clientDataJSON:fe(r.clientDataJSON)}};if("attestationObject"in r){const a=r;if(n.attestationObject=fe(a.attestationObject),typeof a.getTransports=="function")try{n.transports=a.getTransports()}catch{}}if("authenticatorData"in r){const a=r;n.authenticatorData=fe(a.authenticatorData),n.signature=fe(a.signature),a.userHandle&&(n.userHandle=fe(a.userHandle))}return{id:s.id,rawId:t,type:s.type,authenticatorAttachment:s.authenticatorAttachment??void 0,clientExtensionResults:s.getClientExtensionResults?.()??{},response:n}}function gn(){if(typeof window<"u"){const s=window.location?.hostname,t=s==="localhost"||s==="127.0.0.1"||s?.endsWith(".localhost");if(!(window.isSecureContext===!0)&&!t)return!1}return typeof window<"u"&&typeof window.PublicKeyCredential<"u"&&typeof navigator<"u"&&typeof navigator.credentials<"u"}function zs(s){if(!(s instanceof Error))return null;const t=s.name;return t==="NotAllowedError"?{code:"SERVER_ERROR",message:"Passkey operation was cancelled or timed out"}:t==="InvalidStateError"?{code:"VALIDATION_ERROR",message:"Passkey is not available for this operation"}:t==="SecurityError"?{code:"VALIDATION_ERROR",message:"Passkeys require HTTPS and a correctly configured relying party (WEBAUTHN_RP_ID / WEBAUTHN_RP_ORIGIN)"}:null}function qt(){const{config:s,_internal:t}=A.useCedrosLogin(),[r,o]=l.useState(!1),[n,a]=l.useState(null),c=l.useMemo(()=>new A.ApiClient({baseUrl:s.serverUrl,timeoutMs:s.requestTimeout,retryAttempts:s.retryAttempts,getAccessToken:t?.getAccessToken}),[t?.getAccessToken,s.serverUrl,s.requestTimeout,s.retryAttempts]),i=l.useCallback(()=>a(null),[]),d=gn(),u=l.useCallback(async f=>{if(!d){const h={code:"VALIDATION_ERROR",message:"Passkeys are not supported in this browser"};throw a(h),h}o(!0),a(null);try{const h=await c.post("/webauthn/auth/options",{email:f?.email}),w=fn(h.options),m=await navigator.credentials.get({publicKey:w});if(!m)throw new Error("Passkey authentication returned no credential");const g=await c.post("/webauthn/auth/verify",{challengeId:h.challengeId,credential:$s(m)});return s.callbacks?.onLoginSuccess?.(g.user,"webauthn"),t?.handleLoginSuccess(g.user,g.tokens),g}catch(h){const m=zs(h)??A.handleApiError(h,"Passkey sign-in failed");throw a(m),m}finally{o(!1)}},[c,s.callbacks,t,d]),p=l.useCallback(async f=>{if(!d){const h={code:"VALIDATION_ERROR",message:"Passkeys are not supported in this browser"};throw a(h),h}o(!0),a(null);try{const h=await c.post("/webauthn/register/options",{}),w=pn(h.options),m=await navigator.credentials.create({publicKey:w});if(!m)throw new Error("Passkey registration returned no credential");const g=await c.post("/webauthn/register/verify",{challengeId:h.challengeId,credential:$s(m),label:f?.label});if(!g.success)throw new Error("Passkey registration failed");return{credentialId:g.credentialId,label:g.label}}catch(h){const m=zs(h)??A.handleApiError(h,"Passkey registration failed");throw a(m),m}finally{o(!1)}},[c,d]);return{isSupported:d,isLoading:r,error:n,clearError:i,authenticatePasskey:u,registerPasskey:p}}function _t({onSuccess:s,className:t="",children:r,disabled:o}){const{authenticatePasskey:n,isLoading:a,isSupported:c}=qt(),i=o||!c||a;return e.jsxs("button",{type:"button",className:`cedros-button cedros-button-social ${t}`,onClick:async()=>{await n(),s?.()},disabled:i,"aria-disabled":i,children:[e.jsx("span",{className:"cedros-social-icon","aria-hidden":"true",children:e.jsx(wn,{})}),e.jsx("span",{children:r??(a?"Continuing...":"Continue with Passkey")})]})}function wn(){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"}),e.jsx("path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88"}),e.jsx("path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02"}),e.jsx("path",{d:"M2 12a10 10 0 0 1 18-6"}),e.jsx("path",{d:"M2 16h.01"}),e.jsx("path",{d:"M21.8 16c.2-2 .131-5.354 0-6"}),e.jsx("path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2"}),e.jsx("path",{d:"M8.65 22c.21-.66.45-1.32.57-2"}),e.jsx("path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2"})]})}const ve=["login","register"];function $e({onSuccess:s,className:t="",defaultTab:r="login"}){const{config:o}=A.useCedrosLogin(),[n,a]=l.useState(r),[c,i]=l.useState("form"),[d,u]=l.useState(()=>je.detectSolanaWallets()),[p]=l.useState(()=>It());l.useEffect(()=>{const C=()=>u(je.detectSolanaWallets());return C(),window.addEventListener("load",C),window.addEventListener("focus",C),()=>{window.removeEventListener("load",C),window.removeEventListener("focus",C)}},[]);const f=o.forms?.forgotPassword?.mode??"reset",h=l.useCallback(C=>{const k=ve.indexOf(n);let b=k;switch(C.key){case"ArrowLeft":case"ArrowUp":b=k===0?ve.length-1:k-1;break;case"ArrowRight":case"ArrowDown":b=k===ve.length-1?0:k+1;break;case"Home":b=0;break;case"End":b=ve.length-1;break;default:return}C.preventDefault();const S=ve[b];a(S),document.getElementById(`cedros-tab-${S}`)?.focus()},[n]),w=o.features??{email:!0,google:!0,apple:!0,solana:!0,webauthn:!0},m=w.email!==!1,g=w.google!==!1&&o.googleClientId,y=w.apple!==!1&&o.appleClientId&&p,v=w.solana!==!1&&d,x=w.webauthn!==!1,j=m&&(g||y||v||x);return c==="forgotPassword"?e.jsx("div",{className:`cedros-login-form ${t}`,children:e.jsx(Ft,{onCancel:()=>i("form")})}):e.jsxs("div",{className:`cedros-login-form ${t}`,children:[(x||g||y||v)&&e.jsxs("div",{className:"cedros-social-buttons",children:[x&&e.jsx(_t,{onSuccess:s}),g&&e.jsx(Cs.GoogleLoginButton,{onSuccess:s}),y&&e.jsx(Wt,{onSuccess:s}),v&&e.jsx(je.SolanaLoginButton,{onSuccess:s})]}),j&&e.jsx("div",{className:"cedros-divider",children:e.jsx("span",{children:"Or continue with"})}),m&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-tabs",role:"tablist","aria-label":"Authentication method",children:[e.jsx("button",{type:"button",role:"tab",id:"cedros-tab-login",className:`cedros-tab ${n==="login"?"cedros-tab-active":""}`,onClick:()=>a("login"),onKeyDown:h,"aria-selected":n==="login","aria-controls":"cedros-tabpanel-login",tabIndex:n==="login"?0:-1,children:"Sign in"}),e.jsx("button",{type:"button",role:"tab",id:"cedros-tab-register",className:`cedros-tab ${n==="register"?"cedros-tab-active":""}`,onClick:()=>a("register"),onKeyDown:h,"aria-selected":n==="register","aria-controls":"cedros-tabpanel-register",tabIndex:n==="register"?0:-1,children:"Sign up"})]}),e.jsx("div",{role:"tabpanel",id:`cedros-tabpanel-${n}`,"aria-labelledby":`cedros-tab-${n}`,children:n==="login"?e.jsx(O.EmailLoginForm,{onSuccess:s,onSwitchToRegister:()=>a("register"),onForgotPassword:f==="reset"?()=>i("forgotPassword"):void 0}):e.jsx(O.EmailRegisterForm,{onSuccess:s,onSwitchToLogin:()=>a("login")})})]})]})}class $t extends l.Component{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){this.setState({errorInfo:r}),process.env.NODE_ENV==="development"&&(console.error("[Cedros Login] Error caught by ErrorBoundary:",t),console.error("[Cedros Login] Component stack:",r.componentStack)),this.props.onError?.(t,r)}handleRetry=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){const{hasError:t,error:r,errorInfo:o}=this.state,{children:n,fallback:a,showDetails:c=!1}=this.props;return t?a||e.jsx("div",{className:"cedros-error-boundary",role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"cedros-error-boundary-content",children:[e.jsxs("svg",{className:"cedros-error-boundary-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),e.jsx("h2",{className:"cedros-error-boundary-title",children:"Something went wrong"}),e.jsx("p",{className:"cedros-error-boundary-message",children:"We encountered an unexpected error. Please try again."}),c&&r&&e.jsxs("details",{className:"cedros-error-boundary-details",children:[e.jsx("summary",{children:"Error details"}),e.jsxs("pre",{children:[r.toString(),o?.componentStack]})]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:this.handleRetry,children:"Try again"})]})}):n}}function yn({className:s="",title:t="Sign in to your account"}){const{isModalOpen:r,closeModal:o}=A.useCedrosLogin(),n=l.useRef(null),a=l.useRef(null),c=l.useRef(o);if(l.useEffect(()=>{c.current=o},[o]),l.useEffect(()=>{if(!r)return;a.current=document.activeElement,n.current?.focus();const d=p=>{if(p.key==="Escape"&&c.current(),p.key==="Tab"&&n.current){const f=n.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),h=f[0],w=f[f.length-1];p.shiftKey&&document.activeElement===h?(p.preventDefault(),w?.focus()):!p.shiftKey&&document.activeElement===w&&(p.preventDefault(),h?.focus())}};document.addEventListener("keydown",d);const u=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",d),document.body.style.overflow=u,a.current instanceof HTMLElement&&a.current.focus()}},[r]),!r)return null;const i=d=>{d.target===d.currentTarget&&o()};return e.jsx("div",{className:`cedros-modal-backdrop ${s}`,onClick:i,role:"presentation",children:e.jsxs("div",{ref:n,className:"cedros-modal",role:"dialog","aria-modal":"true","aria-labelledby":"cedros-modal-title",tabIndex:-1,children:[e.jsxs("div",{className:"cedros-modal-header",children:[e.jsx("h2",{id:"cedros-modal-title",className:"cedros-modal-title",children:t}),e.jsx("button",{type:"button",className:"cedros-modal-close",onClick:o,"aria-label":"Close",children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),e.jsx("div",{className:"cedros-modal-content",children:e.jsx($t,{children:e.jsx($e,{onSuccess:o})})})]})})}function bn({token:s,onSuccess:t,onLoginClick:r,className:o=""}){const[n,a]=l.useState(""),[c,i]=l.useState(""),[d,u]=l.useState(null),{resetPassword:p,isLoading:f,isSuccess:h,error:w,clearError:m}=Ps(),g=n===c,y=d?.isValid&&g&&n.length>0,v=async x=>{if(x.preventDefault(),!!y)try{await p(s,n),t?.()}catch{}};return h?e.jsxs("div",{className:`cedros-reset-password-success ${o}`,children:[e.jsxs("svg",{className:"cedros-success-icon",width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"24",cy:"24",r:"22",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M14 24l7 7 13-13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsx("h3",{className:"cedros-success-title",children:"Password reset successful"}),e.jsx("p",{className:"cedros-success-message",children:"Your password has been reset. You can now log in with your new password."}),r&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-md cedros-button-primary",onClick:r,children:"Go to login"})]}):e.jsxs("form",{className:`cedros-reset-password-form ${o}`,onSubmit:v,children:[e.jsxs("div",{className:"cedros-form-header",children:[e.jsx("h3",{className:"cedros-form-title",children:"Reset your password"}),e.jsx("p",{className:"cedros-form-subtitle",children:"Enter your new password below."})]}),e.jsx(A.ErrorMessage,{error:w,onDismiss:m}),e.jsx("div",{className:"cedros-form-field",children:e.jsx(O.PasswordInput,{label:"New password",value:n,onChange:x=>{a(x.target.value),u(_e.validatePassword(x.target.value))},showStrengthMeter:!0,onValidationChange:u,disabled:f,autoComplete:"new-password",error:d&&!d.isValid?Object.values(d.errors).find(Boolean):void 0})}),e.jsx("div",{className:"cedros-form-field",children:e.jsx(O.PasswordInput,{label:"Confirm password",value:c,onChange:x=>i(x.target.value),disabled:f,autoComplete:"new-password",error:c&&!g?"Passwords do not match":void 0})}),e.jsxs("div",{className:"cedros-form-actions",children:[e.jsx("button",{type:"submit",className:"cedros-button cedros-button-md cedros-button-primary cedros-button-full",disabled:f||!y,children:f?e.jsxs(e.Fragment,{children:[e.jsx(A.LoadingSpinner,{size:"sm"}),"Resetting..."]}):"Reset password"}),r&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-md cedros-button-ghost cedros-button-full",onClick:r,disabled:f,children:"Back to login"})]})]})}function ks({org:s,size:t="lg",className:r=""}){const o=O.sanitizeImageUrl(s.logoUrl),n=t==="lg"?"cedros-org-avatar-lg":"",a=["cedros-org-avatar",n,r].filter(Boolean).join(" "),c=["cedros-org-avatar-placeholder",n,r].filter(Boolean).join(" ");return o?e.jsx("img",{src:o,alt:s.name,className:a,referrerPolicy:"no-referrer"}):e.jsx("div",{className:c,children:s.name[0]?.toUpperCase()||"?"})}function xn({orgs:s,activeOrg:t,isLoading:r=!1,onSelect:o,onCreateClick:n,className:a="",placeholder:c="Select organization"}){const[i,d]=l.useState(!1),u=l.useRef(null);l.useEffect(()=>{const w=m=>{u.current&&!u.current.contains(m.target)&&d(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]),l.useEffect(()=>{const w=m=>{m.key==="Escape"&&d(!1)};if(i)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]);const p=l.useCallback(w=>{o(w),d(!1)},[o]),f=l.useCallback(()=>{d(!1),n?.()},[n]),h=l.useCallback(()=>{d(w=>!w)},[]);return r?e.jsxs("div",{className:`cedros-org-selector cedros-org-selector-loading ${a}`,"aria-busy":"true","aria-live":"polite",children:[e.jsx(A.LoadingSpinner,{size:"sm"}),e.jsx("span",{children:"Loading..."})]}):e.jsxs("div",{ref:u,className:`cedros-org-selector ${a}`,children:[e.jsxs("button",{type:"button",className:"cedros-org-selector-trigger",onClick:h,"aria-haspopup":"listbox","aria-expanded":i,children:[t?e.jsxs(e.Fragment,{children:[e.jsx(ks,{org:t,size:"sm"}),e.jsx("span",{className:"cedros-org-selector-name",children:t.name}),e.jsx(Vs,{role:t.membership.role})]}):e.jsx("span",{className:"cedros-org-selector-placeholder",children:c}),e.jsx(vn,{isOpen:i})]}),i&&e.jsxs("div",{className:"cedros-org-selector-dropdown",role:"listbox",children:[s.length===0?e.jsx("div",{className:"cedros-org-selector-empty",children:"No organizations"}):e.jsx("ul",{className:"cedros-org-selector-list",children:s.map(w=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:`cedros-org-selector-item ${w.id===t?.id?"cedros-org-selector-item-active":""}`,onClick:()=>p(w.id),role:"option","aria-selected":w.id===t?.id,children:[e.jsx(ks,{org:w,size:"sm"}),e.jsx("span",{className:"cedros-org-selector-item-name",children:w.name}),e.jsx(Vs,{role:w.membership.role}),w.id===t?.id&&e.jsx(An,{})]})},w.id))}),n&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"cedros-org-selector-divider"}),e.jsxs("button",{type:"button",className:"cedros-org-selector-create",onClick:f,children:[e.jsx(jn,{}),e.jsx("span",{children:"Create organization"})]})]})]})]})}function Vs({role:s}){return e.jsx("span",{className:`cedros-org-role cedros-org-role-${s}`,children:s})}function vn({isOpen:s}){return e.jsx("svg",{className:`cedros-org-chevron ${s?"cedros-org-chevron-open":""}`,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function An(){return e.jsx("svg",{className:"cedros-org-check",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M3 8L6 11L13 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function jn(){return e.jsx("svg",{className:"cedros-org-plus",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8 3V13M3 8H13",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Nn(){return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M5 5L15 15M15 5L5 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function kn(){return e.jsx("svg",{className:"cedros-org-check",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M4 10L8 14L16 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Cn(){return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M10 4V16M4 10H16",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Sn({orgs:s,activeOrg:t,isLoading:r,onSelect:o,onCreateClick:n}){return r?e.jsxs("div",{className:"cedros-org-switcher-loading",children:[e.jsx(A.LoadingSpinner,{}),e.jsx("span",{children:"Loading organizations..."})]}):e.jsxs(e.Fragment,{children:[s.length===0?e.jsx("div",{className:"cedros-org-switcher-empty",children:e.jsx("p",{children:"You don't belong to any organizations yet."})}):e.jsx("ul",{className:"cedros-org-switcher-list",children:s.map(a=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:`cedros-org-switcher-item ${a.id===t?.id?"cedros-org-switcher-item-active":""}`,onClick:()=>o(a.id),children:[e.jsx(ks,{org:a}),e.jsxs("div",{className:"cedros-org-switcher-item-content",children:[e.jsx("span",{className:"cedros-org-switcher-item-name",children:a.name}),e.jsxs("span",{className:"cedros-org-switcher-item-slug",children:["@",a.slug]})]}),e.jsxs("div",{className:"cedros-org-switcher-item-meta",children:[e.jsx("span",{className:`cedros-org-role cedros-org-role-${a.membership.role}`,children:a.membership.role}),a.isPersonal&&e.jsx("span",{className:"cedros-org-personal-badge",children:"Personal"})]}),a.id===t?.id&&e.jsx(kn,{})]})},a.id))}),n&&e.jsxs("button",{type:"button",className:"cedros-org-switcher-create",onClick:n,children:[e.jsx(Cn,{}),e.jsx("span",{children:"Create new organization"})]})]})}function En({isLoading:s,onSubmit:t,onCancel:r}){const[o,n]=l.useState(""),[a,c]=l.useState(""),[i,d]=l.useState(null),u=l.useCallback(f=>{n(f);const h=f.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").substring(0,50);c(h)},[]),p=l.useCallback(async f=>{if(f.preventDefault(),d(null),!o.trim()){d("Organization name is required");return}if(!a.trim()){d("Organization slug is required");return}try{await t({name:o.trim(),slug:a.trim()})}catch(h){d(h.message||"Failed to create organization")}},[o,a,t]);return e.jsxs("form",{className:"cedros-org-create-form",onSubmit:p,children:[i&&e.jsx(A.ErrorMessage,{error:i}),e.jsxs("div",{className:"cedros-form-group",children:[e.jsx("label",{htmlFor:"org-name",className:"cedros-form-label",children:"Organization Name"}),e.jsx("input",{id:"org-name",type:"text",className:"cedros-form-input",value:o,onChange:f=>u(f.target.value),placeholder:"My Organization",maxLength:255,disabled:s,autoFocus:!0})]}),e.jsxs("div",{className:"cedros-form-group",children:[e.jsx("label",{htmlFor:"org-slug",className:"cedros-form-label",children:"URL Slug"}),e.jsxs("div",{className:"cedros-form-input-prefix",children:[e.jsx("span",{className:"cedros-form-prefix",children:"@"}),e.jsx("input",{id:"org-slug",type:"text",className:"cedros-form-input",value:a,onChange:f=>c(f.target.value.toLowerCase()),placeholder:"my-organization",maxLength:100,pattern:"[a-z0-9-]+",disabled:s})]}),e.jsx("span",{className:"cedros-form-hint",children:"Only lowercase letters, numbers, and hyphens"})]}),e.jsxs("div",{className:"cedros-form-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:r,disabled:s,children:"Cancel"}),e.jsx("button",{type:"submit",className:"cedros-button cedros-button-primary",disabled:s||!o.trim()||!a.trim(),children:s?e.jsx(A.LoadingSpinner,{size:"sm"}):"Create Organization"})]})]})}function Pn({isOpen:s,onClose:t,orgs:r,activeOrg:o,isLoading:n=!1,error:a,onSelect:c,onCreate:i,className:d=""}){return s?e.jsx(Ln,{onClose:t,orgs:r,activeOrg:o,isLoading:n,error:a,onSelect:c,onCreate:i,className:d}):null}function Ln({onClose:s,orgs:t,activeOrg:r,isLoading:o=!1,error:n,onSelect:a,onCreate:c,className:i}){const[d,u]=l.useState("list"),p=l.useRef(null),f=l.useRef(null);l.useEffect(()=>(f.current=document.activeElement,p.current?.querySelector(".cedros-modal-close")?.focus(),()=>{f.current?.focus()}),[]),l.useEffect(()=>{const g=y=>{if(y.key==="Escape"){s();return}if(y.key==="Tab"&&p.current){const v=p.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),x=v[0],j=v[v.length-1];y.shiftKey?document.activeElement===x&&(y.preventDefault(),j?.focus()):document.activeElement===j&&(y.preventDefault(),x?.focus())}};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s]);const h=l.useCallback(g=>{g.target===g.currentTarget&&s()},[s]),w=l.useCallback(g=>{a(g),s()},[a,s]),m=l.useCallback(async g=>{await c?.(g),s()},[c,s]);return e.jsx("div",{className:"cedros-modal-backdrop",onClick:h,children:e.jsxs("div",{ref:p,className:`cedros-modal cedros-org-switcher ${i}`,role:"dialog","aria-modal":"true","aria-labelledby":"org-switcher-title",children:[e.jsxs("div",{className:"cedros-modal-header",children:[e.jsx("h2",{id:"org-switcher-title",className:"cedros-modal-title",children:d==="list"?"Switch Organization":"Create Organization"}),e.jsx("button",{type:"button",className:"cedros-modal-close",onClick:s,"aria-label":"Close",children:e.jsx(Nn,{})})]}),e.jsxs("div",{className:"cedros-modal-body",children:[n&&e.jsx(A.ErrorMessage,{error:n}),d==="list"?e.jsx(Sn,{orgs:t,activeOrg:r,isLoading:o,onSelect:w,onCreateClick:c?()=>u("create"):void 0}):e.jsx(En,{isLoading:o,onSubmit:m,onCancel:()=>u("list")})]})]})})}const Tn=["owner","admin","member","viewer"];function zt({members:s,currentUserId:t,isLoading:r=!1,error:o,canManage:n=!1,canChangeRoles:a=!1,onUpdateRole:c,onRemove:i,className:d=""}){return r&&s.length===0?e.jsxs("div",{className:`cedros-member-list cedros-member-list-loading ${d}`,children:[e.jsx(A.LoadingSpinner,{}),e.jsx("span",{children:"Loading members..."})]}):o?e.jsx("div",{className:`cedros-member-list ${d}`,children:e.jsx(A.ErrorMessage,{error:o})}):s.length===0?e.jsx("div",{className:`cedros-member-list cedros-member-list-empty ${d}`,children:e.jsx("p",{children:"No members found."})}):e.jsx("div",{className:`cedros-member-list ${d}`,children:e.jsxs("table",{className:"cedros-member-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Member"}),e.jsx("th",{children:"Role"}),e.jsx("th",{children:"Joined"}),(n||a)&&e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:s.map(u=>e.jsx(Mn,{member:u,isCurrentUser:u.userId===t,canManage:n,canChangeRoles:a,onUpdateRole:c,onRemove:i},u.id))})]})})}function Mn({member:s,isCurrentUser:t,canManage:r,canChangeRoles:o,onUpdateRole:n,onRemove:a}){const[c,i]=l.useState(!1),[d,u]=l.useState(s.role),p=l.useCallback(async m=>{if(!(!n||m===s.role)){i(!0);try{await n(s.userId,m),u(m)}catch{u(s.role)}finally{i(!1)}}},[s.userId,s.role,n]),f=l.useCallback(async()=>{if(!(!a||!window.confirm(`Are you sure you want to remove ${s.user.name||s.user.email} from this organization?`))){i(!0);try{await a(s.userId)}finally{i(!1)}}},[s.userId,s.user.name,s.user.email,a]),h=s.role==="owner",w=!t&&!h;return e.jsxs("tr",{className:`cedros-member-row ${t?"cedros-member-row-current":""}`,children:[e.jsxs("td",{className:"cedros-member-info",children:[e.jsx(Rn,{user:s.user}),e.jsxs("div",{className:"cedros-member-details",children:[e.jsxs("span",{className:"cedros-member-name",children:[s.user.name||"Unknown",t&&e.jsx("span",{className:"cedros-member-you",children:"(you)"})]}),e.jsx("span",{className:"cedros-member-email",children:s.user.email})]})]}),e.jsx("td",{className:"cedros-member-role",children:o&&w&&n?e.jsx("select",{value:d,onChange:m=>p(m.target.value),disabled:c,className:"cedros-role-select",children:Tn.map(m=>e.jsx("option",{value:m,children:m.charAt(0).toUpperCase()+m.slice(1)},m))}):e.jsx("span",{className:`cedros-role-badge cedros-role-badge-${s.role}`,children:s.role.charAt(0).toUpperCase()+s.role.slice(1)})}),e.jsx("td",{className:"cedros-member-joined",children:Dn(s.joinedAt)}),(r||o)&&e.jsx("td",{className:"cedros-member-actions",children:r&&w&&a&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-danger cedros-button-sm",onClick:f,disabled:c,"aria-label":`Remove ${s.user.name||s.user.email}`,children:c?e.jsx(A.LoadingSpinner,{size:"sm"}):"Remove"})})]})}function Rn({user:s}){const t=O.sanitizeImageUrl(s.picture);if(t)return e.jsx("img",{src:t,alt:s.name||s.email||"Member",className:"cedros-member-avatar",referrerPolicy:"no-referrer"});const r=(s.name?.[0]||s.email?.[0]||"?").toUpperCase();return e.jsx("div",{className:"cedros-member-avatar-placeholder",children:r})}function Dn(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}const Bn=["admin","member","viewer"];function Vt({onSubmit:s,isLoading:t=!1,error:r,availableRoles:o=Bn,defaultRole:n="member",className:a=""}){const[c,i]=l.useState(""),[d,u]=l.useState(n),[p,f]=l.useState(null),[h,w]=l.useState(!1),m=l.useRef(null),g=l.useRef(!0);l.useEffect(()=>(g.current=!0,()=>{g.current=!1,m.current!==null&&(window.clearTimeout(m.current),m.current=null)}),[]);const y=l.useCallback(async v=>{v.preventDefault(),f(null),w(!1);const x=c.trim();if(!x){f("Email is required");return}if(!_e.validateEmail(x)){f("Please enter a valid email address");return}try{await s(x,d),i(""),u(n),w(!0),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>{g.current&&w(!1),m.current=null},3e3)}catch{}},[c,d,n,s]);return e.jsxs("form",{className:`cedros-invite-form ${a}`,onSubmit:y,children:[(r||p)&&e.jsx(A.ErrorMessage,{error:p??r??null}),h&&e.jsxs("div",{className:"cedros-invite-success",role:"status",children:[e.jsx(Fn,{}),e.jsx("span",{children:"Invitation sent successfully!"})]}),e.jsxs("div",{className:"cedros-invite-form-row",children:[e.jsxs("div",{className:"cedros-form-group cedros-invite-email-group",children:[e.jsx("label",{htmlFor:"invite-email",className:"cedros-form-label",children:"Email Address"}),e.jsx("input",{id:"invite-email",type:"email",className:"cedros-form-input",value:c,onChange:v=>i(v.target.value),placeholder:"colleague@example.com",disabled:t,autoComplete:"email"})]}),e.jsxs("div",{className:"cedros-form-group cedros-invite-role-group",children:[e.jsx("label",{htmlFor:"invite-role",className:"cedros-form-label",children:"Role"}),e.jsx("select",{id:"invite-role",className:"cedros-form-select",value:d,onChange:v=>u(v.target.value),disabled:t,children:o.map(v=>e.jsx("option",{value:v,children:v.charAt(0).toUpperCase()+v.slice(1)},v))})]}),e.jsx("button",{type:"submit",className:"cedros-button cedros-button-primary cedros-invite-submit",disabled:t||!c.trim(),children:t?e.jsx(A.LoadingSpinner,{size:"sm"}):"Send Invite"})]}),e.jsx("p",{className:"cedros-form-hint",children:"The invited user will receive an email with a link to join your organization."})]})}function Fn(){return e.jsx("svg",{className:"cedros-invite-check",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M3 8L6 11L13 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Qt({invites:s,isLoading:t=!1,error:r,canManage:o=!1,onCancel:n,onResend:a,className:c=""}){return t&&s.length===0?e.jsxs("div",{className:`cedros-invite-list cedros-invite-list-loading ${c}`,children:[e.jsx(A.LoadingSpinner,{}),e.jsx("span",{children:"Loading invites..."})]}):r?e.jsx("div",{className:`cedros-invite-list ${c}`,children:e.jsx(A.ErrorMessage,{error:r})}):s.length===0?e.jsx("div",{className:`cedros-invite-list cedros-invite-list-empty ${c}`,children:e.jsx("p",{children:"No pending invites."})}):e.jsx("div",{className:`cedros-invite-list ${c}`,children:e.jsx("ul",{className:"cedros-invite-items",children:s.map(i=>e.jsx(Un,{invite:i,canManage:o,onCancel:n,onResend:a},i.id))})})}function Un({invite:s,canManage:t,onCancel:r,onResend:o}){const[n,a]=l.useState(!1),[c,i]=l.useState(!1),d=l.useRef(null),u=new Date(s.expiresAt)<new Date,p=l.useCallback(async()=>{if(!(!r||!window.confirm(`Are you sure you want to cancel the invite for ${s.email}?`))){a(!0);try{await r(s.id)}finally{a(!1)}}},[s.id,s.email,r]),f=l.useCallback(async()=>{if(o){a(!0),i(!1);try{await o(s.id),i(!0),d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{i(!1),d.current=null},3e3)}finally{a(!1)}}},[s.id,o]);return l.useEffect(()=>()=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),e.jsxs("li",{className:`cedros-invite-item ${u?"cedros-invite-item-expired":""}`,children:[e.jsxs("div",{className:"cedros-invite-item-info",children:[e.jsxs("div",{className:"cedros-invite-item-main",children:[e.jsx("span",{className:"cedros-invite-item-email",children:s.email}),e.jsx("span",{className:`cedros-role-badge cedros-role-badge-${s.role}`,children:s.role.charAt(0).toUpperCase()+s.role.slice(1)}),u&&e.jsx("span",{className:"cedros-invite-expired-badge",children:"Expired"})]}),e.jsxs("div",{className:"cedros-invite-item-meta",children:[e.jsxs("span",{className:"cedros-invite-item-date",children:["Invited ",Ht(s.createdAt)]}),!u&&e.jsxs("span",{className:"cedros-invite-item-expires",children:["Expires ",In(s.expiresAt)]})]})]}),t&&e.jsxs("div",{className:"cedros-invite-item-actions",children:[c&&e.jsx("span",{className:"cedros-invite-resend-success",children:"Sent!"}),o&&!u&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:f,disabled:n,"aria-label":`Resend invite to ${s.email}`,children:n?e.jsx(A.LoadingSpinner,{size:"sm"}):"Resend"}),r&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-danger cedros-button-sm",onClick:p,disabled:n,"aria-label":`Cancel invite for ${s.email}`,children:"Cancel"})]})]})}function Ht(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function In(s){const t=new Date(s),r=new Date,o=t.getTime()-r.getTime(),n=Math.ceil(o/(1e3*60*60*24));return n<0?"expired":n===0?"today":n===1?"tomorrow":n<7?`in ${n} days`:Ht(s)}function Wn({sessions:s,isLoading:t=!1,error:r,onRevokeAll:o,className:n=""}){const[a,c]=l.useState(!1),[i,d]=l.useState(!1),u=l.useRef(null),p=l.useMemo(()=>s.filter(h=>!h.isCurrent).length,[s]),f=l.useCallback(async()=>{if(!o)return;const h=s.filter(m=>!m.isCurrent).length;if(!(h===0||!window.confirm(`Are you sure you want to sign out of ${h} other device(s)? This will log you out everywhere except this browser.`))){c(!0),d(!1);try{await o(),d(!0),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{d(!1),u.current=null},3e3)}finally{c(!1)}}},[o,s]);return l.useEffect(()=>()=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null)},[]),t&&s.length===0?e.jsxs("div",{className:`cedros-session-list cedros-session-list-loading ${n}`,children:[e.jsx(A.LoadingSpinner,{}),e.jsx("span",{children:"Loading sessions..."})]}):r?e.jsx("div",{className:`cedros-session-list ${n}`,children:e.jsx(A.ErrorMessage,{error:r})}):s.length===0?e.jsx("div",{className:`cedros-session-list cedros-session-list-empty ${n}`,children:e.jsx("p",{children:"No active sessions found."})}):e.jsxs("div",{className:`cedros-session-list ${n}`,children:[i&&e.jsxs("div",{className:"cedros-session-success",role:"status",children:[e.jsx(Vn,{}),e.jsx("span",{children:"All other sessions have been revoked."})]}),e.jsx("ul",{className:"cedros-session-items",children:s.map(h=>e.jsx(On,{session:h},h.id))}),o&&p>0&&e.jsx("div",{className:"cedros-session-actions",children:e.jsx("button",{type:"button",className:"cedros-button cedros-button-danger",onClick:f,disabled:a,children:a?e.jsxs(e.Fragment,{children:[e.jsx(A.LoadingSpinner,{size:"sm"}),e.jsx("span",{children:"Signing out..."})]}):`Sign out of ${p} other device${p>1?"s":""}`})})]})}function On({session:s}){const t=qn(s.userAgent),r=$n(s.expiresAt);return e.jsxs("li",{className:`cedros-session-item ${s.isCurrent?"cedros-session-item-current":""}`,children:[e.jsx("div",{className:"cedros-session-item-icon",children:e.jsx(zn,{userAgent:s.userAgent})}),e.jsxs("div",{className:"cedros-session-item-info",children:[e.jsxs("div",{className:"cedros-session-item-main",children:[e.jsxs("span",{className:"cedros-session-item-device",children:[t.browser," on ",t.os]}),s.isCurrent&&e.jsx("span",{className:"cedros-session-current-badge",children:"Current session"})]}),e.jsxs("div",{className:"cedros-session-item-meta",children:[s.ipAddress&&e.jsxs("span",{className:"cedros-session-item-ip",children:["IP: ",s.ipAddress]}),e.jsxs("span",{className:"cedros-session-item-created",children:["Started ",_n(s.createdAt)]}),r&&e.jsx("span",{className:"cedros-session-expiring",children:"Expires soon"})]})]})]})}function qn(s){if(!s)return{browser:"Unknown browser",os:"Unknown device"};let t="Unknown browser";s.includes("Chrome")&&!s.includes("Edg")?t="Chrome":s.includes("Safari")&&!s.includes("Chrome")?t="Safari":s.includes("Firefox")?t="Firefox":s.includes("Edg")&&(t="Edge");let r="Unknown device";return s.includes("Windows")?r="Windows":s.includes("Mac")?r="macOS":s.includes("Linux")?r="Linux":s.includes("iPhone")||s.includes("iPad")?r="iOS":s.includes("Android")&&(r="Android"),{browser:t,os:r}}function _n(s){const t=new Date(s),o=new Date().getTime()-t.getTime(),n=Math.floor(o/(1e3*60)),a=Math.floor(o/(1e3*60*60)),c=Math.floor(o/(1e3*60*60*24));return n<1?"just now":n<60?`${n} minute${n>1?"s":""} ago`:a<24?`${a} hour${a>1?"s":""} ago`:c<7?`${c} day${c>1?"s":""} ago`:t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function $n(s){const t=new Date(s),r=new Date,o=3600*1e3;return t.getTime()-r.getTime()<o}function zn({userAgent:s}){return s?.includes("iPhone")||s?.includes("iPad")||s?.includes("Android")?e.jsxs("svg",{className:"cedros-session-device-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("circle",{cx:"12",cy:"18",r:"1",fill:"currentColor"})]}):e.jsxs("svg",{className:"cedros-session-device-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("path",{d:"M8 21H16",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M12 18V21",stroke:"currentColor",strokeWidth:"1.5"})]})}function Vn(){return e.jsx("svg",{className:"cedros-session-check",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M3 8L6 11L13 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Kt({words:s,onConfirm:t,className:r=""}){const[o,n]=l.useState(!1),[a,c]=l.useState(!1),i=l.useRef(null),d=cn(s),u=l.useCallback(async()=>{try{await navigator.clipboard.writeText(s.join(" ")),n(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>n(!1),2e3)}catch{}},[s]);l.useEffect(()=>()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null)},[]);const p=l.useCallback(()=>{a&&t()},[a,t]);return e.jsxs("div",{className:`cedros-recovery-phrase-display ${r}`,children:[e.jsxs("div",{className:"cedros-recovery-header",children:[e.jsx("h3",{className:"cedros-recovery-title",children:"Recovery Phrase"}),e.jsx("p",{className:"cedros-recovery-warning",children:"Write down these 12 words in order and store them securely. This is the only way to recover your wallet if you lose access."})]}),e.jsx("div",{className:"cedros-recovery-grid",children:d.map((f,h)=>e.jsx("div",{className:"cedros-word-group",children:f.map((w,m)=>{const g=h*4+m+1;return e.jsxs("div",{className:"cedros-word-item",children:[e.jsxs("span",{className:"cedros-word-number",children:[g,"."]}),e.jsx("span",{className:"cedros-word-text",children:w})]},g)})},h))}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary cedros-copy-btn",onClick:u,children:o?"Copied!":"Copy to Clipboard"}),e.jsx("div",{className:"cedros-recovery-security",children:e.jsxs("div",{className:"cedros-warning-box",children:[e.jsx("svg",{className:"cedros-warning-icon",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M10 6v4m0 4h.01M19 10a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),e.jsxs("div",{className:"cedros-warning-content",children:[e.jsx("strong",{children:"Security Warning"}),e.jsxs("ul",{children:[e.jsx("li",{children:"Never share this phrase with anyone"}),e.jsx("li",{children:"Store it offline in a secure location"}),e.jsx("li",{children:"Anyone with this phrase can access your wallet"}),e.jsx("li",{children:"Cedros cannot recover this phrase for you"})]})]})]})}),e.jsxs("div",{className:"cedros-recovery-confirm",children:[e.jsxs("label",{className:"cedros-checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:a,onChange:f=>c(f.target.checked),className:"cedros-checkbox"}),e.jsx("span",{children:"I have written down and securely stored my recovery phrase"})]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:p,disabled:!a,children:"Continue"})]})]})}function Yt({onSubmit:s,onCancel:t,isSubmitting:r=!1,error:o,className:n=""}){const[a,c]=l.useState(Array(re).fill("")),[i,d]=l.useState(null),[u,p]=l.useState([]),[f,h]=l.useState(null),w=l.useId(),m=l.useRef(null),g=l.useCallback((b,S)=>{const T=[...a];if(T[b]=S.toLowerCase().trim(),c(T),S.length>0){const N=ln(S,5);p(N)}else p([]);h(null)},[a]),y=l.useCallback(b=>{d(b),p([])},[]),v=l.useCallback(b=>{const S=a[b];S&&!Te(S)&&h(`Word ${b+1} is not in the wordlist`),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>{i===b&&p([])},200)},[a,i]);l.useEffect(()=>()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]);const x=l.useCallback(b=>{if(i!==null){const S=[...a];S[i]=b,c(S),p([]),document.querySelector(`[data-word-index="${i+1}"]`)?.focus()}},[i,a]),j=l.useCallback(b=>{const S=b.clipboardData.getData("text"),T=dn(S);T.length===re&&(b.preventDefault(),c(T),h(null))},[]),C=l.useCallback(b=>{if(b.preventDefault(),a.filter(N=>!N).length>0){h(`Please enter all ${re} words`);return}const T=a.map((N,L)=>({word:N,index:L+1})).filter(({word:N})=>!Te(N));if(T.length>0){h(`Invalid words: ${T.map(N=>`#${N.index}`).join(", ")}`);return}if(!Bt(a)){h("Invalid recovery phrase - please check your words");return}s(a)},[a,s]),k=o||f;return e.jsxs("form",{className:`cedros-recovery-phrase-input ${n}`,onSubmit:C,onPaste:j,children:[e.jsxs("div",{className:"cedros-recovery-input-header",children:[e.jsx("h3",{className:"cedros-recovery-input-title",children:"Enter Recovery Phrase"}),e.jsx("p",{className:"cedros-recovery-input-description",children:"Enter your 12-word recovery phrase. You can paste the entire phrase at once."})]}),e.jsx("div",{className:"cedros-word-inputs",children:Array.from({length:re},(b,S)=>e.jsxs("div",{className:"cedros-word-input-wrapper",children:[e.jsxs("label",{className:"cedros-word-label",children:[S+1,"."]}),e.jsx("input",{type:"text",className:`cedros-word-input ${a[S]&&!Te(a[S])?"cedros-word-invalid":a[S]&&Te(a[S])?"cedros-word-valid":""}`,value:a[S],onChange:T=>g(S,T.target.value),onFocus:()=>y(S),onBlur:()=>v(S),"data-word-index":S,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,disabled:r,"aria-label":`Word ${S+1}`})]},S))}),i!==null&&u.length>0&&e.jsx("div",{className:"cedros-suggestions",role:"listbox",id:`${w}-suggestions`,children:u.map(b=>e.jsx("button",{type:"button",className:"cedros-suggestion",onClick:()=>x(b),role:"option",children:b},b))}),k&&e.jsx("p",{className:"cedros-input-error",role:"alert",children:k}),e.jsxs("div",{className:"cedros-recovery-input-actions",children:[t&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:t,disabled:r,children:"Cancel"}),e.jsx("button",{type:"submit",className:"cedros-button cedros-button-primary",disabled:r,children:r?"Recovering...":"Recover Wallet"})]})]})}function Qn({capabilities:s,className:t=""}){if(s.allSupported)return null;const r=A.getMissingCapabilitiesMessage(s),o=A.getBrowserSupportInfo();return e.jsxs("div",{className:`cedros-capability-warning ${t}`,role:"alert",children:[e.jsxs("div",{className:"cedros-warning-header",children:[e.jsx("svg",{className:"cedros-warning-icon",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M12 9v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),e.jsx("h3",{className:"cedros-warning-title",children:"Wallet Feature Unavailable"})]}),e.jsx("p",{className:"cedros-warning-message",children:r}),e.jsxs("div",{className:"cedros-capability-details",children:[e.jsx("h4",{children:"Browser Compatibility"}),e.jsxs("p",{children:["Detected: ",o.browser," ",o.version,o.likelySupported?" (likely supported)":" (may not be supported)"]}),e.jsx("h4",{children:"Required Features"}),e.jsxs("ul",{className:"cedros-capability-list",children:[e.jsxs("li",{className:s.webCrypto?"cedros-cap-ok":"cedros-cap-missing",children:["Web Crypto API: ",s.webCrypto?"Available":"Missing"]}),e.jsxs("li",{className:s.aesGcm?"cedros-cap-ok":"cedros-cap-missing",children:["AES-GCM Encryption: ",s.aesGcm?"Available":"Missing"]}),e.jsxs("li",{className:s.hkdf?"cedros-cap-ok":"cedros-cap-missing",children:["HKDF Key Derivation: ",s.hkdf?"Available":"Missing"]}),e.jsxs("li",{className:s.webAuthn?"cedros-cap-ok":"cedros-cap-missing",children:["WebAuthn/Passkeys: ",s.webAuthn?"Available":"Missing"]}),e.jsxs("li",{className:s.webAuthnPrf?"cedros-cap-ok":"cedros-cap-missing",children:["WebAuthn PRF Extension: ",s.webAuthnPrf?"Available":"Missing"]}),e.jsxs("li",{className:s.argon2?"cedros-cap-ok":"cedros-cap-missing",children:["Argon2 Password Hashing: ",s.argon2?"Available":"Missing"]})]})]}),e.jsxs("div",{className:"cedros-capability-help",children:[e.jsx("h4",{children:"Recommended Browsers"}),e.jsxs("ul",{children:[e.jsx("li",{children:"Chrome 116+ on Windows, macOS, or Android"}),e.jsx("li",{children:"Safari 17+ on macOS or iOS"}),e.jsx("li",{children:"Edge 116+ on Windows"})]}),e.jsx("p",{className:"cedros-capability-note",children:"A platform authenticator (Touch ID, Face ID, or Windows Hello) is required."})]})]})}const Hn=["share_c_only","full_seed","none"];function Kn(s){return s&&Hn.includes(s)?s:"share_c_only"}const Yn={walletEnabled:!1,recoveryMode:"share_c_only",unlockTtlSeconds:900,isLoading:!1,error:null,refetch:async()=>{}};function Gt(){const s=A.useCedrosLoginOptional(),[t,r]=l.useState(null),[o,n]=l.useState(!!s),[a,c]=l.useState(null),i=l.useMemo(()=>s?new A.ApiClient({baseUrl:s.config.serverUrl,timeoutMs:s.config.requestTimeout,retryAttempts:s.config.retryAttempts}):null,[s]),d=l.useCallback(async()=>{if(i){n(!0),c(null);try{const u=await i.get("/discovery");u.wallet?r({enabled:u.wallet.enabled,recoveryMode:Kn(u.wallet.recoveryMode),unlockTtlSeconds:u.wallet.unlockTtlSeconds}):r({enabled:!1,recoveryMode:"share_c_only",unlockTtlSeconds:900})}catch(u){const p=u instanceof Error?u.message:"Failed to fetch wallet config";c(p),r({enabled:!1,recoveryMode:"share_c_only",unlockTtlSeconds:900})}finally{n(!1)}}},[i]);return l.useEffect(()=>{i&&d()},[i,d]),s?{walletEnabled:t?.enabled??!1,recoveryMode:t?.recoveryMode??"share_c_only",unlockTtlSeconds:t?.unlockTtlSeconds??900,isLoading:o,error:a,refetch:d}:Yn}function Jt(){const{user:s}=A.useCedrosLogin(),{enroll:t}=A.useWalletMaterial(),{recoveryMode:r}=Gt(),[o,n]=l.useState({step:"idle"}),[a,c]=l.useState(!1),i=l.useRef([]),d=l.useCallback(()=>{A.wipeAll(...i.current),i.current=[]},[]);l.useEffect(()=>()=>{d()},[d]);const u=l.useCallback(async(m,g,y,v)=>{n({step:"generating_seed"});const x=A.generateSeed();i.current.push(x),n({step:"splitting_shares"});const{shareA:j,shareB:C,shareC:k}=O.splitSecret(x);i.current.push(j,C,k),n({step:"encrypting_shares"});const b=await A.aesGcmEncryptToBase64(j,A.toEncryptionKey(g)),S=O.getPublicKeyFromSeed(x),T=O.publicKeyToBase58(S);n({step:"uploading"});const N={solanaPubkey:T,shareAAuthMethod:m,shareACiphertext:b.ciphertext,shareANonce:b.nonce,shareB:A.uint8ArrayToBase64(C)};if(m==="password"){if(!y)throw new Error("KDF salt required for password method");N.shareAKdfSalt=A.uint8ArrayToBase64(y),N.shareAKdfParams=A.DEFAULT_KDF_PARAMS}if(m==="passkey"&&v&&(N.prfSalt=v),await t(N),r==="none")d(),n({step:"complete",solanaPubkey:T});else{const L=r==="full_seed"?an(x):rn(A.toShamirShare(k));n({step:"showing_recovery",recoveryPhrase:L,solanaPubkey:T})}},[t,r,d]),p=l.useCallback(async m=>{if(!s){n({step:"error",error:"User not authenticated"});return}c(!0),d();try{const g=A.generateArgon2Salt(),y=await O.argon2DeriveInWorker(m,g,A.DEFAULT_KDF_PARAMS);i.current.push(y),await u("password",y,g)}catch(g){n({step:"error",error:g instanceof Error?g.message:"Enrollment failed"})}finally{c(!1)}},[s,d,u]),f=l.useCallback(async()=>{if(!s){n({step:"error",error:"User not authenticated"});return}c(!0),d();try{const m=A.generatePrfSalt(),g=A.uint8ArrayToBase64(m);n({step:"registering_passkey"});let y;try{const x=new TextEncoder().encode(s.id),j=s.name??s.email??"User",C=s.email??s.id;y=(await A.registerPasskeyWithPrf(x,C,j,m)).prfOutput}catch(x){if(x?.name!=="InvalidStateError")throw x;y=(await A.authenticateWithDiscoverablePrf(g)).prfOutput}i.current.push(y);const v=await A.deriveKeyFromPrf(y,m);i.current.push(v),await u("passkey",v,void 0,g)}catch(m){n({step:"error",error:m instanceof Error?m.message:"Enrollment failed"})}finally{c(!1)}},[s,d,u]),h=l.useCallback(()=>{const m=o.solanaPubkey;d(),n({step:"complete",solanaPubkey:m})},[o.solanaPubkey,d]),w=l.useCallback(()=>{d(),n({step:"idle"}),c(!1)},[d]);return{state:o,startEnrollmentWithPassword:p,startEnrollmentWithPasskey:f,confirmRecoveryPhrase:h,cancel:w,isEnrolling:a}}function Xt({onComplete:s,onCancel:t,className:r="",forceAuthMethod:o}){const{user:n}=A.useCedrosLogin(),{state:a,startEnrollmentWithPassword:c,startEnrollmentWithPasskey:i,confirmRecoveryPhrase:d,cancel:u,isEnrolling:p}=Jt(),f=()=>o||"password",[h,w]=l.useState(f),[m,g]=l.useState(""),[y,v]=l.useState(""),[x,j]=l.useState(null);l.useEffect(()=>{w(f())},[n?.id,o]);const C=l.useCallback(async T=>{if(T.preventDefault(),m!==y){j("Passwords do not match");return}if(m.length<8){j("Password must be at least 8 characters");return}j(null),await c(m)},[m,y,c]),k=l.useCallback(async()=>{await i()},[i]),b=l.useCallback(()=>{d(),a.solanaPubkey&&s?.(a.solanaPubkey)},[d,a.solanaPubkey,s]),S=l.useCallback(()=>{u(),t?.()},[u,t]);return a.step==="generating_seed"||a.step==="splitting_shares"?e.jsx("div",{className:`cedros-wallet-enrollment ${r}`,"aria-busy":"true",children:e.jsxs("div",{className:"cedros-enrollment-progress",role:"status","aria-live":"polite",children:[e.jsx("div",{className:"cedros-spinner","aria-hidden":"true"}),e.jsx("p",{children:"Generating secure wallet..."})]})}):a.step==="encrypting_shares"?e.jsx("div",{className:`cedros-wallet-enrollment ${r}`,"aria-busy":"true",children:e.jsxs("div",{className:"cedros-enrollment-progress",role:"status","aria-live":"polite",children:[e.jsx("div",{className:"cedros-spinner","aria-hidden":"true"}),e.jsx("p",{children:"Encrypting wallet shares..."})]})}):a.step==="registering_passkey"?e.jsx("div",{className:`cedros-wallet-enrollment ${r}`,"aria-busy":"true",children:e.jsx("div",{className:"cedros-enrollment-progress",role:"status","aria-live":"polite",children:e.jsxs("div",{className:"cedros-passkey-prompt",children:[e.jsxs("svg",{className:"cedros-passkey-icon",width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("rect",{x:"8",y:"16",width:"32",height:"24",rx:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("circle",{cx:"24",cy:"28",r:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M24 32v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),e.jsx("h3",{children:"Authenticate with Passkey"}),e.jsx("p",{children:"Follow your browser's prompt to use your passkey."})]})})}):a.step==="uploading"?e.jsx("div",{className:`cedros-wallet-enrollment ${r}`,"aria-busy":"true",children:e.jsxs("div",{className:"cedros-enrollment-progress",role:"status","aria-live":"polite",children:[e.jsx("div",{className:"cedros-spinner","aria-hidden":"true"}),e.jsx("p",{children:"Saving wallet..."})]})}):a.step==="showing_recovery"&&a.recoveryPhrase?e.jsx("div",{className:`cedros-wallet-enrollment ${r}`,children:e.jsx(Kt,{words:a.recoveryPhrase,onConfirm:b})}):a.step==="complete"?e.jsx("div",{className:`cedros-wallet-enrollment ${r}`,children:e.jsxs("div",{className:"cedros-enrollment-complete",children:[e.jsxs("svg",{className:"cedros-success-icon",width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M16 24l6 6 12-12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsx("h3",{children:"Wallet Created!"}),e.jsxs("p",{className:"cedros-pubkey",children:[e.jsx("strong",{children:"Address:"})," ",a.solanaPubkey]}),e.jsx("p",{children:"Your non-custodial Solana wallet is ready to use."})]})}):a.step==="error"?e.jsx("div",{className:`cedros-wallet-enrollment ${r}`,children:e.jsxs("div",{className:"cedros-enrollment-error",children:[e.jsxs("svg",{className:"cedros-error-icon",width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M24 16v12m0 6h.01",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),e.jsx("h3",{children:"Enrollment Failed"}),e.jsx("p",{className:"cedros-error-message",children:a.error}),e.jsxs("div",{className:"cedros-error-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:S,children:"Cancel"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:()=>u(),children:"Try Again"})]})]})}):e.jsxs("div",{className:`cedros-wallet-enrollment ${r}`,children:[e.jsxs("div",{className:"cedros-enrollment-header",children:[e.jsx("h2",{children:"Create Wallet"}),e.jsxs("p",{children:["Secure your wallet with a ",h==="passkey"?"passkey":"password","."]})]}),!o&&e.jsxs("div",{className:"cedros-auth-method-selector",children:[e.jsxs("label",{className:"cedros-radio-label",children:[e.jsx("input",{type:"radio",name:"authMethod",value:"password",checked:h==="password",onChange:()=>w("password"),disabled:p}),e.jsx("span",{children:"Password"})]}),e.jsxs("label",{className:"cedros-radio-label",children:[e.jsx("input",{type:"radio",name:"authMethod",value:"passkey",checked:h==="passkey",onChange:()=>w("passkey"),disabled:p}),e.jsx("span",{children:"Passkey"})]})]}),h==="password"&&e.jsxs("form",{onSubmit:C,className:"cedros-enrollment-form",children:[e.jsx(O.PasswordInput,{label:"Password",value:m,onChange:T=>g(T.target.value),showStrengthMeter:!0,disabled:p,required:!0,minLength:8,placeholder:"Enter a strong password"}),e.jsx(O.PasswordInput,{label:"Confirm Password",value:y,onChange:T=>v(T.target.value),error:x??void 0,disabled:p,required:!0,minLength:8,placeholder:"Confirm your password"}),e.jsx("div",{className:"cedros-password-info",children:e.jsx("p",{children:"This password will be used to sign transactions."})}),e.jsxs("div",{className:"cedros-enrollment-actions",children:[t&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:S,disabled:p,children:"Cancel"}),e.jsx("button",{type:"submit",className:"cedros-button cedros-button-primary",disabled:p||!m||!y,children:p?"Creating...":"Continue"})]})]}),h==="passkey"&&e.jsxs("div",{className:"cedros-enrollment-form",children:[e.jsxs("div",{className:"cedros-passkey-info",children:[e.jsxs("svg",{className:"cedros-passkey-icon",width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("rect",{x:"8",y:"16",width:"32",height:"24",rx:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("circle",{cx:"24",cy:"28",r:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M24 32v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),e.jsx("p",{children:"Use your passkey (Touch ID, Face ID, or Windows Hello) to secure your wallet."}),e.jsx("p",{children:"You'll use the same passkey to sign transactions."})]}),e.jsxs("div",{className:"cedros-enrollment-actions",children:[t&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:S,disabled:p,children:"Cancel"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:k,disabled:p,children:p?"Creating...":"Use Passkey"})]})]})]})}function Zt(){const{user:s}=A.useCedrosLogin(),{signTransaction:t}=A.useWalletMaterial(),[r,o]=l.useState(!1),[n,a]=l.useState(null),c=l.useCallback(async(d,u)=>{if(!s){const p="User not authenticated";throw a(p),new Error(p)}o(!0),a(null);try{const p={transaction:A.uint8ArrayToBase64(d),...u?{credential:A.toCredentialRequest(u)}:{}},f=await t(p);return A.base64ToUint8Array(f.signature)}catch(p){const f=p instanceof Error?p.message:"Signing failed";throw a(f),p}finally{o(!1)}},[s,t]),i=l.useCallback(()=>a(null),[]);return{signTransaction:c,isSigning:r,error:n,clearError:i}}function er(){const{getMaterial:s}=A.useWalletMaterial(),[t,r]=l.useState(!1),[o,n]=l.useState(null),a=l.useCallback(async()=>{r(!0),n(null);try{const i=await s();if(!i)throw new Error("No wallet enrolled");if(i.shareAAuthMethod!=="passkey")throw new Error("Wallet is not configured for passkey authentication");if(!i.prfSalt)throw new Error("No PRF salt configured for wallet");const d=await A.authenticateWithDiscoverablePrf(i.prfSalt);return{type:"prfOutput",prfOutput:A.uint8ArrayToBase64(d.prfOutput)}}catch(i){const d=i instanceof Error?i.message:"Passkey authentication failed";return n(d),null}finally{r(!1)}},[s]),c=l.useCallback(()=>n(null),[]);return{getPasskeyCredential:a,isAuthenticating:t,error:o,clearError:c}}function sr({mode:s,isLoading:t=!1,error:r,onPrompt:o,onRetry:n,onCancel:a,title:c,description:i,className:d=""}){const u=l.useCallback(()=>{t||o?.()},[t,o]),p=l.useCallback(()=>{n?.()},[n]),f=s==="register"?"Set Up Passkey":"Verify with Passkey",h=s==="register"?"Create a passkey to securely encrypt your wallet on this device. You will use your fingerprint, face, or device PIN.":"Use your passkey to unlock your wallet. You will be prompted for biometric verification.";return e.jsxs("div",{className:`cedros-passkey-prompt ${d}`,children:[e.jsx("div",{className:"cedros-passkey-icon",children:t?e.jsx(Jn,{}):r?e.jsx(Xn,{}):e.jsx(Gn,{})}),e.jsx("h3",{className:"cedros-passkey-title",children:c??f}),e.jsx("p",{className:"cedros-passkey-description",children:i??h}),r&&e.jsx("div",{className:"cedros-passkey-error",role:"alert",children:e.jsx("p",{children:r})}),e.jsx("div",{className:"cedros-passkey-actions",children:r?e.jsxs(e.Fragment,{children:[n&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:p,children:"Try Again"}),a&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:a,children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:u,disabled:t,children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"cedros-button-spinner","aria-hidden":"true"}),"Waiting for passkey..."]}):s==="register"?"Create Passkey":"Use Passkey"}),a&&!t&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:a,children:"Cancel"})]})}),t&&e.jsxs("p",{className:"cedros-passkey-hint",children:["Follow the prompts on your device to ",s==="register"?"create":"verify"," your passkey."]})]})}function Gn(){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"}),e.jsx("path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88"}),e.jsx("path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02"}),e.jsx("path",{d:"M2 12a10 10 0 0 1 18-6"}),e.jsx("path",{d:"M2 16h.01"}),e.jsx("path",{d:"M21.8 16c.2-2 .131-5.354 0-6"}),e.jsx("path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2"}),e.jsx("path",{d:"M8.65 22c.21-.66.45-1.32.57-2"}),e.jsx("path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2"})]})}function Jn(){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"cedros-spinner",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2",opacity:"0.25"}),e.jsx("path",{d:"M12 3a9 9 0 0 1 9 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function Xn(){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 8v4M12 16h.01"})]})}function tr({onUnlock:s,onCancel:t,showCancel:r=!0,authMethod:o,className:n=""}){A.useCedrosLogin();const{unlock:a,getMaterial:c,isLoading:i}=A.useWalletMaterial(),{getPasskeyCredential:d,isAuthenticating:u}=er(),[p,f]=l.useState("idle"),[h,w]=l.useState(o??null),[m,g]=l.useState(""),[y,v]=l.useState(null);l.useEffect(()=>{o!==void 0&&w(o)},[o]);const x=h==="password",j=h==="passkey",C=l.useCallback(async()=>{if(f("credential"),v(null),!h)try{const E=await c();E?w(E.shareAAuthMethod):(v("No wallet enrolled"),f("error"))}catch(E){v(E instanceof Error?E.message:"Failed to get wallet info"),f("error")}},[h,c]),k=l.useCallback(async E=>{E.preventDefault(),v(null),f("unlocking");try{let P;if(x)P={type:"password",password:m};else throw new Error("Invalid auth method");await a(P),f("unlocked"),s?.()}catch(P){v(P instanceof Error?P.message:"Failed to unlock wallet"),f("error")}},[x,m,a,s]),b=l.useCallback(async()=>{v(null),f("unlocking");try{const E=await d();if(!E){f("credential");return}await a(E),f("unlocked"),s?.()}catch(E){v(E instanceof Error?E.message:"Failed to unlock wallet"),f("error")}},[d,a,s]),S=l.useCallback(()=>{g(""),f("idle"),v(null),t?.()},[t]),T=l.useCallback(()=>{g(""),f("credential"),v(null)},[]),N=i||u,L=()=>{switch(p){case"idle":return e.jsxs("div",{className:"cedros-wallet-unlock-idle",children:[e.jsx("div",{className:"cedros-wallet-unlock-icon",children:e.jsx(Zn,{})}),e.jsx("h3",{className:"cedros-wallet-unlock-title",children:"Wallet Locked"}),e.jsx("p",{className:"cedros-wallet-unlock-description",children:"Unlock your wallet to sign transactions."}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:C,children:"Unlock Wallet"})]});case"credential":return x?e.jsxs("form",{className:"cedros-wallet-unlock-form",onSubmit:k,children:[e.jsx("h3",{className:"cedros-wallet-unlock-title",children:"Enter Password"}),e.jsx("p",{className:"cedros-wallet-unlock-description",children:"Enter your wallet password to unlock."}),e.jsx(O.PasswordInput,{label:"Password",value:m,onChange:E=>g(E.target.value),disabled:N,autoComplete:"current-password",error:y??void 0}),e.jsxs("div",{className:"cedros-wallet-unlock-actions",children:[e.jsx("button",{type:"submit",className:"cedros-button cedros-button-primary",disabled:N||m.length===0,children:N?"Unlocking...":"Unlock"}),r&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:S,disabled:N,children:"Cancel"})]})]}):j?e.jsxs("div",{className:"cedros-wallet-unlock-passkey",children:[e.jsx("h3",{className:"cedros-wallet-unlock-title",children:"Verify with Passkey"}),e.jsx("p",{className:"cedros-wallet-unlock-description",children:"Use your passkey to unlock your wallet."}),e.jsx(sr,{mode:"authenticate",isLoading:N,error:y??void 0,onPrompt:b,onRetry:b,onCancel:r?S:void 0})]}):e.jsxs("div",{className:"cedros-wallet-unlock-loading",children:[e.jsx(A.LoadingSpinner,{size:"xl"}),e.jsx("p",{children:"Loading wallet info..."})]});case"unlocking":return e.jsxs("div",{className:"cedros-wallet-unlock-progress",children:[e.jsx("div",{className:"cedros-wallet-unlock-icon",children:e.jsx(A.LoadingSpinner,{size:"xl"})}),e.jsx("h3",{className:"cedros-wallet-unlock-title",children:"Unlocking Wallet"}),e.jsx("p",{className:"cedros-wallet-unlock-description",children:"Verifying your credentials..."})]});case"unlocked":return e.jsxs("div",{className:"cedros-wallet-unlock-success",children:[e.jsx("div",{className:"cedros-wallet-unlock-icon",children:e.jsx(ea,{})}),e.jsx("h3",{className:"cedros-wallet-unlock-title",children:"Wallet Unlocked"}),e.jsx("p",{className:"cedros-wallet-unlock-description",children:"Your wallet is ready to sign transactions."})]});case"error":return e.jsxs("div",{className:"cedros-wallet-unlock-error",children:[e.jsx("div",{className:"cedros-wallet-unlock-icon",children:e.jsx(sa,{})}),e.jsx("h3",{className:"cedros-wallet-unlock-title",children:"Unlock Failed"}),e.jsx("p",{className:"cedros-wallet-unlock-description",children:y??"Failed to unlock wallet. Please try again."}),e.jsxs("div",{className:"cedros-wallet-unlock-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:T,children:"Try Again"}),r&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:S,children:"Cancel"})]})]})}};return e.jsx("div",{className:`cedros-wallet-unlock ${n}`,children:L()})}function Zn(){return e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("rect",{x:"10",y:"22",width:"28",height:"20",rx:"4",stroke:"currentColor",strokeWidth:"2",fill:"var(--cedros-muted, #f3f4f6)"}),e.jsx("path",{d:"M16 22V16a8 8 0 1 1 16 0v6",stroke:"currentColor",strokeWidth:"2",fill:"none"}),e.jsx("circle",{cx:"24",cy:"32",r:"3",fill:"currentColor"})]})}function ea(){return e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"var(--cedros-success, #22c55e)",strokeWidth:"2",fill:"var(--cedros-success-light, #dcfce7)"}),e.jsx("path",{d:"M16 24l6 6 10-10",stroke:"var(--cedros-success, #22c55e)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}function sa(){return e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"var(--cedros-destructive, #ef4444)",strokeWidth:"2",fill:"var(--cedros-destructive-light, #fee2e2)"}),e.jsx("path",{d:"M24 16v10M24 30v2",stroke:"var(--cedros-destructive, #ef4444)",strokeWidth:"3",strokeLinecap:"round"})]})}function rr(){const{recover:s,getShareBForRecovery:t}=A.useWalletMaterial(),{recoveryMode:r}=Gt(),[o,n]=l.useState({step:"idle"}),[a,c]=l.useState(!1),i=l.useRef([]),d=l.useCallback(()=>{A.wipeAll(...i.current),i.current=[]},[]);l.useEffect(()=>()=>{d()},[d]);const u=l.useCallback(async(f,h,w)=>{c(!0),d();try{if(n({step:"validating"}),!Bt(f))throw new Error("Invalid recovery phrase. Please check your words.");let m;if(r==="share_c_only"){const T=nn(f);i.current.push(T);const N=A.uint8ArrayToBase64(T),L=await t({shareC:N}),E=A.base64ToUint8Array(L.shareB);i.current.push(E),m=O.combineShares(A.toShamirShare(E),A.toShamirShare(T)),i.current.push(m)}else m=on(f),i.current.push(m);const g=O.getPublicKeyFromSeed(m),y=O.publicKeyToBase58(g),{shareA:v,shareB:x}=O.splitSecret(m);i.current.push(v,x),n({step:"encrypting"});let j,C,k;if(h==="passkey"){const T=A.generatePrfSalt();k=A.uint8ArrayToBase64(T);const N=await A.authenticateWithDiscoverablePrf(k);i.current.push(N.prfOutput),j=await A.deriveKeyFromPrf(N.prfOutput,T),i.current.push(j)}else C=A.generateArgon2Salt(),j=await O.argon2DeriveInWorker(w,C,A.DEFAULT_KDF_PARAMS),i.current.push(j);const b=await A.aesGcmEncryptToBase64(v,A.toEncryptionKey(j));n({step:"uploading"});const S={solanaPubkey:y,shareAAuthMethod:h,shareACiphertext:b.ciphertext,shareANonce:b.nonce,shareB:A.uint8ArrayToBase64(x)};h==="password"&&(S.shareAKdfSalt=A.uint8ArrayToBase64(C),S.shareAKdfParams=A.DEFAULT_KDF_PARAMS),h==="passkey"&&(S.prfSalt=k),await s(S),d(),n({step:"complete"})}catch(m){d(),n({step:"error",error:m instanceof Error?m.message:"Recovery failed"})}finally{c(!1)}},[s,t,r,d]),p=l.useCallback(()=>{d(),n({step:"idle"}),c(!1)},[d]);return{state:o,startRecovery:u,cancel:p,isRecovering:a}}function nr({onComplete:s,onCancel:t,className:r="",defaultAuthMethod:o="password"}){const{state:n,startRecovery:a,cancel:c,isRecovering:i}=rr(),[d,u]=l.useState([]),[p,f]=l.useState(!1),[h,w]=l.useState(o),[m,g]=l.useState(""),[y,v]=l.useState(""),[x,j]=l.useState(null),C=l.useCallback(N=>{u(N),f(!0)},[]),k=l.useCallback(async N=>{if(N.preventDefault(),j(null),h!=="passkey"){if(m!==y){j("Passwords do not match");return}if(h==="password"&&m.length<8){j("Password must be at least 8 characters");return}}await a(d,h,m)},[d,h,m,y,a]),b=l.useCallback(()=>{c(),u([]),f(!1),g(""),v(""),t?.()},[c,t]),S=l.useCallback(()=>{f(!1),g(""),v("")},[]),T=l.useCallback(()=>{s?.()},[s]);return n.step==="validating"||n.step==="encrypting"||n.step==="uploading"?e.jsx("div",{className:`cedros-wallet-recovery ${r}`,children:e.jsxs("div",{className:"cedros-wallet-recovery-progress",children:[e.jsx("div",{className:"cedros-wallet-recovery-icon",children:e.jsx(ta,{})}),e.jsxs("h3",{className:"cedros-wallet-recovery-title",children:[n.step==="validating"&&"Validating Recovery Phrase",n.step==="encrypting"&&"Encrypting Wallet",n.step==="uploading"&&"Saving to Server"]}),e.jsxs("p",{className:"cedros-wallet-recovery-description",children:[n.step==="validating"&&"Checking your recovery phrase...",n.step==="encrypting"&&"Securing your wallet with new encryption...",n.step==="uploading"&&"Uploading encrypted wallet data..."]})]})}):n.step==="complete"?e.jsx("div",{className:`cedros-wallet-recovery ${r}`,children:e.jsxs("div",{className:"cedros-wallet-recovery-success",children:[e.jsx("div",{className:"cedros-wallet-recovery-icon",children:e.jsx(ra,{})}),e.jsx("h3",{className:"cedros-wallet-recovery-title",children:"Wallet Recovered"}),e.jsxs("p",{className:"cedros-wallet-recovery-description",children:["Your wallet has been successfully recovered and secured with your new"," ",h==="passkey"?"passkey":"password","."]}),e.jsx("div",{className:"cedros-wallet-recovery-actions",children:e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:T,children:"Done"})})]})}):n.step==="error"?e.jsx("div",{className:`cedros-wallet-recovery ${r}`,children:e.jsxs("div",{className:"cedros-wallet-recovery-error",children:[e.jsx("div",{className:"cedros-wallet-recovery-icon",children:e.jsx(na,{})}),e.jsx("h3",{className:"cedros-wallet-recovery-title",children:"Recovery Failed"}),e.jsx("p",{className:"cedros-wallet-recovery-description",children:n.error??"An error occurred during recovery. Please try again."}),e.jsx("div",{className:"cedros-wallet-recovery-actions",children:e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:b,children:"Start Over"})})]})}):p?e.jsx("div",{className:`cedros-wallet-recovery ${r}`,children:e.jsxs("form",{className:"cedros-wallet-recovery-credential",onSubmit:k,children:[e.jsxs("div",{className:"cedros-wallet-recovery-header",children:[e.jsx("h3",{className:"cedros-wallet-recovery-title",children:"Set New Security"}),e.jsx("p",{className:"cedros-wallet-recovery-description",children:"Choose how to secure your recovered wallet."})]}),e.jsxs("div",{className:"cedros-auth-method-selector",children:[e.jsxs("label",{className:"cedros-radio-label",children:[e.jsx("input",{type:"radio",name:"authMethod",value:"password",checked:h==="password",onChange:()=>w("password"),disabled:i}),e.jsx("span",{children:"Password"})]}),e.jsxs("label",{className:"cedros-radio-label",children:[e.jsx("input",{type:"radio",name:"authMethod",value:"passkey",checked:h==="passkey",onChange:()=>w("passkey"),disabled:i}),e.jsx("span",{children:"Passkey"})]})]}),h==="password"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-password-input",children:[e.jsx("label",{htmlFor:"recovery-password",className:"cedros-label",children:"New Password"}),e.jsx("input",{id:"recovery-password",type:"password",className:"cedros-input",value:m,onChange:N=>g(N.target.value),disabled:i,minLength:8,placeholder:"Enter a strong password"})]}),e.jsxs("div",{className:"cedros-password-input",children:[e.jsx("label",{htmlFor:"recovery-password-confirm",className:"cedros-label",children:"Confirm Password"}),e.jsx("input",{id:"recovery-password-confirm",type:"password",className:"cedros-input",value:y,onChange:N=>v(N.target.value),disabled:i,"aria-invalid":x?"true":void 0,placeholder:"Confirm your password"}),x&&e.jsx("p",{className:"cedros-input-error",role:"alert",children:x})]})]}),h==="passkey"&&e.jsxs("div",{className:"cedros-passkey-info",children:[e.jsx(aa,{}),e.jsx("p",{children:"Use your passkey (Touch ID, Face ID, or Windows Hello) to secure your wallet."})]}),e.jsxs("div",{className:"cedros-wallet-recovery-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:S,disabled:i,children:"Back"}),e.jsx("button",{type:"submit",className:"cedros-button cedros-button-primary",disabled:i||h!=="passkey"&&(m.length===0||y.length===0),children:i?"Recovering...":"Recover Wallet"})]})]})}):e.jsx("div",{className:`cedros-wallet-recovery ${r}`,children:e.jsxs("div",{className:"cedros-wallet-recovery-phrase",children:[e.jsxs("div",{className:"cedros-wallet-recovery-header",children:[e.jsx("h3",{className:"cedros-wallet-recovery-title",children:"Recover Your Wallet"}),e.jsx("p",{className:"cedros-wallet-recovery-description",children:"Enter your 12-word recovery phrase to restore your wallet."})]}),e.jsx(Yt,{onSubmit:C,onCancel:b,isSubmitting:!1})]})})}function ta(){return e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",className:"cedros-spinner",children:[e.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"var(--cedros-muted, #e5e7eb)",strokeWidth:"3",fill:"none"}),e.jsx("path",{d:"M24 4a20 20 0 0 1 20 20",stroke:"var(--cedros-primary, #6366f1)",strokeWidth:"3",strokeLinecap:"round",fill:"none"})]})}function ra(){return e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"var(--cedros-success, #22c55e)",strokeWidth:"2",fill:"var(--cedros-success-light, #dcfce7)"}),e.jsx("path",{d:"M16 24l6 6 10-10",stroke:"var(--cedros-success, #22c55e)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}function na(){return e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"var(--cedros-destructive, #ef4444)",strokeWidth:"2",fill:"var(--cedros-destructive-light, #fee2e2)"}),e.jsx("path",{d:"M24 16v10M24 30v2",stroke:"var(--cedros-destructive, #ef4444)",strokeWidth:"3",strokeLinecap:"round"})]})}function aa(){return e.jsxs("svg",{className:"cedros-passkey-icon",width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("rect",{x:"8",y:"16",width:"32",height:"24",rx:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("circle",{cx:"24",cy:"28",r:"4",stroke:"currentColor",strokeWidth:"2"}),e.jsx("path",{d:"M24 32v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function ar({address:s,label:t="Wallet Address",showCopy:r=!0,showExplorerLink:o=!0,allowReveal:n=!0,className:a=""}){const c=A.useCedrosLoginOptional(),[i,d]=l.useState(!1),[u,p]=l.useState(null),[f,h]=l.useState(!1),w=l.useRef(null),m=c?.config.solana?.network??"mainnet-beta",g=l.useMemo(()=>{const j=`https://explorer.solana.com/address/${s}`;return m==="mainnet-beta"?j:`${j}?cluster=${encodeURIComponent(m)}`},[s,m]),y=n&&s.length>18,v=l.useMemo(()=>!y||f?s:`${s.slice(0,8)}...${s.slice(-8)}`,[s,y,f]),x=l.useCallback(async()=>{try{p(null),await navigator.clipboard.writeText(s),d(!0),w.current!==null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{d(!1),w.current=null},2e3)}catch(j){d(!1),p(j instanceof Error?j.message:"Copy failed")}},[s]);return l.useEffect(()=>()=>{w.current!==null&&(window.clearTimeout(w.current),w.current=null)},[]),e.jsxs("div",{className:`cedros-wallet-address-row ${a}`,children:[e.jsxs("div",{className:"cedros-wallet-address-row-header",children:[e.jsx("span",{className:"cedros-wallet-status-pubkey-label",children:t}),e.jsxs("div",{className:"cedros-wallet-address-row-actions",children:[y&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-sm cedros-button-ghost",onClick:()=>h(j=>!j),"aria-label":f?"Hide full wallet address":"Show full wallet address",children:f?e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M3 3l18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M10.7 10.7a3 3 0 0 0 4.24 4.24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M9.88 5.09A10.94 10.94 0 0 1 12 5c5 0 9.27 3.11 11 7-0.55 1.23-1.32 2.33-2.27 3.25",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M6.61 6.61C4.4 7.9 2.74 9.8 1 12c1.73 3.89 6 7 11 7 1.14 0 2.25-0.16 3.3-0.46",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),o&&e.jsx("a",{className:"cedros-button cedros-button-sm cedros-button-ghost",href:g,target:"_blank",rel:"noreferrer",children:"Explorer"}),r&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-sm cedros-button-outline",onClick:x,"aria-label":"Copy wallet address",children:i?"Copied":"Copy"})]})]}),e.jsx("code",{className:"cedros-wallet-status-pubkey-value",title:s,children:v}),u&&e.jsx("p",{className:"cedros-input-hint",role:"status",children:u})]})}function or({status:s,publicKey:t,onLock:r,onEnroll:o,onUnlock:n,onRecover:a,showActions:c=!0,compact:i=!1,className:d=""}){const u=s!==void 0,p=A.useWallet(),f=u?s:p.status,h=u?t??null:p.solanaPubkey,w=u?null:p.error,m=u?()=>{}:p.refresh,g=u?()=>{}:p.clearError,y=oa(f,w);return i?e.jsxs("div",{className:`cedros-wallet-status cedros-wallet-status-compact ${d}`,children:[e.jsx("span",{className:`cedros-wallet-status-dot cedros-wallet-status-${y.color}`,title:y.label}),e.jsx("span",{className:"cedros-wallet-status-label",children:y.label}),h&&e.jsx("span",{className:"cedros-wallet-status-pubkey",title:h,children:ia(h)})]}):e.jsxs("div",{className:`cedros-wallet-status ${d}`,children:[e.jsxs("div",{className:"cedros-wallet-status-header",children:[e.jsx("div",{className:`cedros-wallet-status-icon cedros-wallet-status-icon-${y.color}`,children:e.jsx(la,{status:f})}),e.jsxs("div",{className:"cedros-wallet-status-info",children:[e.jsx("h4",{className:"cedros-wallet-status-title",children:y.title}),e.jsx("p",{className:"cedros-wallet-status-description",children:y.description})]})]}),h&&e.jsx("div",{className:"cedros-wallet-status-pubkey-full",children:e.jsx(ar,{address:h})}),w&&e.jsxs("div",{className:"cedros-wallet-status-error-box",role:"alert",children:[e.jsx("p",{children:w}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-sm cedros-button-secondary",onClick:g,children:"Dismiss"})]}),c&&e.jsxs("div",{className:"cedros-wallet-status-actions",children:[f==="not_enrolled"&&o&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-sm",onClick:o,children:"Create Wallet"}),f==="enrolled_locked"&&n&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-sm",onClick:n,children:"Unlock Wallet"}),(f==="not_enrolled"||f==="error")&&a&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:a,children:"Recover Wallet"}),f==="error"&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:m,children:"Retry"})]})]})}function oa(s,t){switch(s){case"loading":return{label:"Loading",title:"Checking Wallet",description:"Verifying wallet status...",color:"loading"};case"not_enrolled":return{label:"Not Set Up",title:"No Wallet",description:"Create a wallet to start using Solana.",color:"muted"};case"enrolled_locked":return{label:"Locked",title:"Wallet Locked",description:"Unlock your wallet to sign transactions.",color:"warning"};case"enrolled_unlocked":case"unlocked":return{label:"Ready",title:"Wallet Ready",description:"Your wallet is unlocked and ready to use.",color:"success"};case"error":default:return{label:"Error",title:"Wallet Error",description:t??"An error occurred with your wallet.",color:"error"}}}function ia(s){return s.length<=12?s:`${s.slice(0,4)}...${s.slice(-4)}`}function la({status:s}){switch(s){case"loading":return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"cedros-spinner",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2",opacity:"0.25"}),e.jsx("path",{d:"M12 3a9 9 0 0 1 9 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]});case"not_enrolled":return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M8 12h8M12 8v8"})]});case"enrolled_locked":return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]});case"enrolled_unlocked":case"unlocked":return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})});case"error":return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),e.jsx("path",{d:"M12 9v4M12 17h.01"})]});default:return null}}function ca({className:s="",showActions:t=!0}){const r=A.useWallet(),[o,n]=l.useState("status"),a=l.useMemo(()=>{switch(o){case"enroll":return{title:"Create Wallet",description:"Set up your embedded wallet."};case"unlock":return{title:"Unlock Wallet",description:"Unlock to sign transactions."};case"recover_intro":case"recover":return{title:"Recover Wallet",description:"Restore access using your recovery phrase."};case"status":default:return null}},[o]),c=l.useCallback(()=>n("status"),[]),i=l.useCallback(async()=>{n("status"),await r.refresh()},[r]),d=l.useCallback(async()=>{n("status"),await r.refresh()},[r]),u=l.useCallback(async()=>{n("status"),await r.refresh()},[r]);return e.jsxs("div",{className:`cedros-wallet-manager ${s}`,children:[o!=="status"&&a&&e.jsxs("div",{className:"cedros-wallet-manager-header",children:[e.jsxs("div",{className:"cedros-wallet-manager-header-text",children:[e.jsx("h3",{className:"cedros-wallet-manager-title",children:a.title}),e.jsx("p",{className:"cedros-wallet-manager-subtitle",children:a.description})]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-sm cedros-button-ghost",onClick:c,children:"Back"})]}),o==="status"&&e.jsx(or,{onEnroll:()=>n("enroll"),onUnlock:()=>n("unlock"),onRecover:()=>n("recover_intro"),showActions:t}),o==="enroll"&&e.jsx(Xt,{onComplete:()=>{i()},onCancel:c}),o==="unlock"&&e.jsx(tr,{onUnlock:()=>{d()},onCancel:c}),o==="recover_intro"&&e.jsx("div",{className:"cedros-wallet-manager-intro",children:e.jsxs("div",{className:"cedros-wallet-manager-intro-card",children:[e.jsx("h4",{className:"cedros-wallet-manager-intro-title",children:"Before you start"}),e.jsxs("ul",{className:"cedros-wallet-manager-intro-list",children:[e.jsx("li",{children:"You’ll need your 12-word recovery phrase."}),e.jsx("li",{children:"You’ll set a new password or passkey for this wallet."}),e.jsx("li",{children:"If you’re on a shared device, avoid copying the phrase into other apps."})]}),e.jsxs("div",{className:"cedros-wallet-manager-intro-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:()=>n("recover"),children:"Start recovery"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:c,children:"Cancel"})]})]})}),o==="recover"&&e.jsx(nr,{onComplete:()=>{u()},onCancel:c})]})}class da{client;constructor(t,r,o,n){this.client=new A.ApiClient({baseUrl:t,timeoutMs:r,retryAttempts:o,getAccessToken:n})}async getSettings(){try{return await this.client.get("/admin/settings")}catch(t){throw A.handleApiError(t,"Failed to fetch system settings")}}async updateSettings(t){try{return await this.client.patch("/admin/settings",{settings:t})}catch(r){throw A.handleApiError(r,"Failed to update system settings")}}}function ir(){const{config:s,authState:t,_internal:r}=A.useCedrosLogin(),[o,n]=l.useState({}),[a,c]=l.useState(!1),[i,d]=l.useState(!1),[u,p]=l.useState(null),f=l.useRef(0),h=l.useMemo(()=>new da(s.serverUrl,s.requestTimeout,s.retryAttempts,r?.getAccessToken),[s.serverUrl,s.requestTimeout,s.retryAttempts,r]),w=l.useRef(h);w.current=h;const m=l.useCallback(async()=>{if(t!=="authenticated"){n({});return}c(!0),p(null);const v=++f.current;try{const x=await w.current.getSettings();if(v!==f.current)return;n(x.settings)}catch(x){if(v!==f.current)return;p(x instanceof Error?x:new Error("Failed to fetch settings"))}finally{v===f.current&&c(!1)}},[t]),g=l.useCallback(async v=>{if(t!=="authenticated")throw new Error("Not authenticated");d(!0),p(null);try{await w.current.updateSettings(v),await m()}catch(x){const j=x instanceof Error?x:new Error("Failed to update settings");throw p(j),j}finally{d(!1)}},[t,m]),y=l.useCallback(v=>{for(const x of Object.values(o)){const j=x.find(C=>C.key===v);if(j)return j.value}},[o]);return{settings:o,isLoading:a,isUpdating:i,error:u,fetchSettings:m,updateSettings:g,getValue:y}}function ua(s){const t=Math.floor(s/86400),r=Math.floor(s%86400/3600),o=Math.floor(s%3600/60),n=s%60;return{days:t,hours:r,minutes:o,seconds:n}}function ha(s){const{days:t,hours:r,minutes:o}=ua(s),n=[];return t>0&&n.push(`${t}d`),r>0&&n.push(`${r}h`),o>0&&n.push(`${o}m`),n.length===0&&n.push(`${s}s`),n.join(" ")}const ma={privacy_period_secs:{key:"privacy_period_secs",label:"Privacy Period",description:"How long deposits are held before withdrawal to provide timing privacy. Longer periods provide better privacy but delay user access to funds.",inputType:"duration",min:0,presets:[{label:"Disabled",value:"0"},{label:"1 hour",value:"3600"},{label:"6 hours",value:"21600"},{label:"24 hours",value:"86400"},{label:"7 days",value:"604800"},{label:"14 days",value:"1209600"},{label:"30 days",value:"2592000"}],warningThreshold:{below:3600,message:"Very short privacy periods may not provide adequate timing protection."}},withdrawal_poll_interval_secs:{key:"withdrawal_poll_interval_secs",label:"Worker Poll Interval",description:"How often the withdrawal worker checks for deposits ready to process. Lower values process faster but increase server load.",inputType:"duration",min:60,presets:[{label:"1 minute",value:"60"},{label:"5 minutes",value:"300"},{label:"15 minutes",value:"900"},{label:"1 hour",value:"3600"},{label:"6 hours",value:"21600"}],warningThreshold:{below:60,message:"Polling more than once per minute may cause excessive load."}},withdrawal_batch_size:{key:"withdrawal_batch_size",label:"Batch Size",description:"Maximum number of withdrawals to process in a single batch. Higher values improve throughput but may cause timeouts.",inputType:"select",min:1,max:100,presets:[{label:"1 (Sequential)",value:"1"},{label:"5",value:"5"},{label:"10 (Recommended)",value:"10"},{label:"25",value:"25"},{label:"50",value:"50"},{label:"100 (Max)",value:"100"}]},withdrawal_timeout_secs:{key:"withdrawal_timeout_secs",label:"Transaction Timeout",description:"How long to wait for a withdrawal transaction to confirm before considering it failed.",inputType:"duration",min:30,presets:[{label:"30 seconds",value:"30"},{label:"1 minute",value:"60"},{label:"2 minutes",value:"120"},{label:"5 minutes",value:"300"}],warningThreshold:{below:30,message:"Very short timeouts may cause premature failure on slow networks."}},withdrawal_max_retries:{key:"withdrawal_max_retries",label:"Max Retries",description:"Number of times to retry a failed withdrawal before marking it as permanently failed.",inputType:"select",min:0,max:10,presets:[{label:"0 (No retries)",value:"0"},{label:"1",value:"1"},{label:"3 (Recommended)",value:"3"},{label:"5",value:"5"},{label:"10",value:"10"}]},withdrawal_percentage:{key:"withdrawal_percentage",label:"Withdrawal Percentage",description:"Percentage of ready funds to withdraw each cycle. Lower values spread withdrawals over time for better privacy.",inputType:"percentage",min:1,max:100,step:5,presets:[{label:"25%",value:"25"},{label:"50%",value:"50"},{label:"75%",value:"75"},{label:"100% (All at once)",value:"100"}],warningThreshold:{above:75,message:"High percentages may reduce timing privacy by processing most withdrawals together."}},partial_withdrawal_count:{key:"partial_withdrawal_count",label:"Partial Withdrawals",description:"Maximum partial withdrawals per batch. Partial withdrawals add noise to timing analysis. Set to 0 to disable.",inputType:"select",min:0,presets:[{label:"Disabled",value:"0"},{label:"1",value:"1"},{label:"3",value:"3"},{label:"5",value:"5"},{label:"10",value:"10"}]},partial_withdrawal_min_lamports:{key:"partial_withdrawal_min_lamports",label:"Min Balance for Partial",description:"Minimum account balance (in lamports) required before partial withdrawals are considered. 1 SOL = 1,000,000,000 lamports.",inputType:"select",min:0,presets:[{label:"0.1 SOL",value:"100000000"},{label:"0.5 SOL",value:"500000000"},{label:"1 SOL",value:"1000000000"},{label:"5 SOL",value:"5000000000"},{label:"10 SOL",value:"10000000000"}]},rate_limit_auth:{key:"rate_limit_auth",label:"Auth Request Limit",description:"Maximum authentication attempts (login, register, password reset) per IP per window. Protects against brute force attacks.",inputType:"select",min:1,unit:"requests",presets:[{label:"5 (Strict)",value:"5"},{label:"10 (Recommended)",value:"10"},{label:"20",value:"20"},{label:"50 (Permissive)",value:"50"}],warningThreshold:{above:20,message:"High auth limits may allow brute force attempts."}},rate_limit_general:{key:"rate_limit_general",label:"General Request Limit",description:"Maximum general API requests per IP per window. Affects all non-auth endpoints.",inputType:"select",min:1,unit:"requests",presets:[{label:"30",value:"30"},{label:"60 (Recommended)",value:"60"},{label:"120",value:"120"},{label:"300",value:"300"}]},rate_limit_credit:{key:"rate_limit_credit",label:"Credit Request Limit",description:"Maximum credit/balance check requests per IP per window. Higher for apps that poll balance frequently.",inputType:"select",min:1,unit:"requests",presets:[{label:"10",value:"10"},{label:"30 (Recommended)",value:"30"},{label:"60",value:"60"},{label:"120",value:"120"}]},rate_limit_window:{key:"rate_limit_window",label:"Rate Limit Window",description:'Time window for rate limiting. All limits above are "per window". Shorter windows are stricter.',inputType:"duration",min:1,presets:[{label:"30 seconds",value:"30"},{label:"1 minute",value:"60"},{label:"5 minutes",value:"300"},{label:"15 minutes",value:"900"}]},deposit_quick_action_tokens:{key:"deposit_quick_action_tokens",label:"Quick Action Tokens",description:"Comma-separated token symbols shown as quick action buttons. First token is the default.",inputType:"tokenSymbolList"},deposit_custom_tokens:{key:"deposit_custom_tokens",label:"Custom Dropdown Tokens",description:'Comma-separated token symbols shown in the "Custom" dropdown. Leave empty to show all.',inputType:"tokenSymbolList"},deposit_custom_tokens_json:{key:"deposit_custom_tokens_json",label:"Custom Token Definitions",description:"Add tokens beyond the built-in list. Define symbol, mint address, decimals, and logo URL.",inputType:"tokenList"}},pa={privacy:{label:"Privacy Settings",description:"Control the privacy period for deposits. Longer periods provide better timing privacy but delay fund availability.",icon:"🔒"},withdrawal:{label:"Withdrawal Worker",description:"Configure how the automated withdrawal processor handles pending withdrawals. These settings affect throughput and privacy.",icon:"⚙️"},rate_limit:{label:"Rate Limiting",description:"Protect the system from abuse by limiting request rates. Balance security with user experience.",icon:"🛡️"},deposit:{label:"Deposit Settings",description:"Configure token lists and deposit flow display options.",icon:"💳"}};function lr({showDescriptions:s=!0,className:t="",onSave:r}){const{settings:o,isLoading:n,isUpdating:a,error:c,fetchSettings:i,updateSettings:d}=ir(),[u,p]=l.useState({}),[f,h]=l.useState(null),[w,m]=l.useState(!1);l.useEffect(()=>{i()},[i]),l.useEffect(()=>{if(w){const k=setTimeout(()=>m(!1),3e3);return()=>clearTimeout(k)}},[w]);const g=l.useCallback((k,b)=>{p(S=>({...S,[k]:b})),h(null),m(!1)},[]),y=l.useCallback(async()=>{const k=Object.entries(u).map(([b,S])=>({key:b,value:S}));if(k.length!==0)try{await d(k),p({}),h(null),m(!0),r?.()}catch(b){h(b instanceof Error?b.message:"Failed to save settings")}},[u,d,r]),v=l.useCallback(()=>{p({}),h(null),m(!1)},[]),x=Object.keys(u).length>0,j=Object.keys(u).length;if(n&&Object.keys(o).length===0)return e.jsxs("div",{className:`cedros-system-settings cedros-system-settings-loading ${t}`,children:[e.jsx(A.LoadingSpinner,{}),e.jsx("span",{children:"Loading settings..."})]});if(c)return e.jsx("div",{className:`cedros-system-settings ${t}`,children:e.jsx(A.ErrorMessage,{error:c.message})});const C=Object.keys(o).sort();return C.length===0?e.jsx("div",{className:`cedros-system-settings cedros-system-settings-empty ${t}`,children:e.jsx("p",{children:"No system settings found."})}):e.jsxs("div",{className:`cedros-system-settings ${t}`,children:[f&&e.jsx(A.ErrorMessage,{error:f}),w&&e.jsx("div",{className:"cedros-settings-success",children:"Settings saved successfully."}),C.map(k=>e.jsx(fa,{category:k,settings:o[k],edits:u,showDescription:s,onChange:g},k)),e.jsxs("div",{className:"cedros-system-settings-actions",children:[x&&e.jsxs("span",{className:"cedros-settings-change-count",children:[j," unsaved change",j!==1?"s":""]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-secondary",onClick:v,disabled:!x||a,children:"Reset"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary",onClick:y,disabled:!x||a,children:a?e.jsx(A.LoadingSpinner,{size:"sm"}):"Save Changes"})]})]})}function fa({category:s,settings:t,edits:r,showDescription:o,onChange:n}){const a=pa[s]||{label:s,description:"",icon:"⚙️"};return e.jsxs("section",{className:"cedros-settings-section",children:[e.jsxs("div",{className:"cedros-settings-section-header",children:[e.jsx("span",{className:"cedros-settings-section-icon",children:a.icon}),e.jsxs("div",{children:[e.jsx("h3",{className:"cedros-settings-section-title",children:a.label}),o&&a.description&&e.jsx("p",{className:"cedros-settings-section-description",children:a.description})]})]}),e.jsx("div",{className:"cedros-settings-grid",children:t.map(c=>e.jsx(ga,{setting:c,editValue:r[c.key],onChange:n},c.key))})]})}function ga({setting:s,editValue:t,onChange:r}){const o=ma[s.key],n=t??s.value,a=t!==void 0&&t!==s.value,c=l.useMemo(()=>{if(!o?.warningThreshold)return null;const i=parseInt(n,10);if(isNaN(i))return null;const{above:d,below:u,message:p}=o.warningThreshold;return d!==void 0&&i>d||u!==void 0&&i<u?p:null},[n,o?.warningThreshold]);return o?e.jsxs("div",{className:`cedros-setting-row ${a?"cedros-setting-row-changed":""} ${c?"cedros-setting-row-warning":""}`,children:[e.jsxs("div",{className:"cedros-setting-label",children:[e.jsx("span",{className:"cedros-setting-name",children:o.label}),e.jsx("span",{className:"cedros-setting-description",children:o.description})]}),e.jsxs("div",{className:"cedros-setting-control",children:[o.inputType==="duration"&&e.jsx(wa,{value:n,onChange:i=>r(s.key,i),presets:o.presets,min:o.min}),o.inputType==="percentage"&&e.jsx(ya,{value:n,onChange:i=>r(s.key,i),min:o.min??1,max:o.max??100,step:o.step??5,presets:o.presets}),o.inputType==="select"&&e.jsx(ba,{value:n,onChange:i=>r(s.key,i),presets:o.presets??[],unit:o.unit}),o.inputType==="number"&&e.jsx(xa,{value:n,onChange:i=>r(s.key,i),min:o.min,max:o.max,unit:o.unit}),o.inputType==="tokenList"&&e.jsx(va,{value:n,onChange:i=>r(s.key,i)}),o.inputType==="text"&&e.jsx("input",{type:"text",value:n,onChange:i=>r(s.key,i.target.value),className:"cedros-setting-input",placeholder:o.label}),o.inputType==="tokenSymbolList"&&e.jsx(Aa,{value:n,onChange:i=>r(s.key,i)}),c&&e.jsx("div",{className:"cedros-setting-warning",children:c})]})]}):e.jsxs("div",{className:`cedros-setting-row ${a?"cedros-setting-row-changed":""}`,children:[e.jsxs("div",{className:"cedros-setting-label",children:[e.jsx("span",{className:"cedros-setting-name",children:s.key}),s.description&&e.jsx("span",{className:"cedros-setting-description",children:s.description})]}),e.jsx("div",{className:"cedros-setting-input-wrapper",children:e.jsx("input",{type:"text",value:n,onChange:i=>r(s.key,i.target.value),className:"cedros-setting-input"})})]})}function wa({value:s,onChange:t,presets:r,min:o=0}){const n=parseInt(s,10)||0,a=ha(n),c=l.useCallback(d=>{d.target.value&&t(d.target.value)},[t]),i=l.useCallback(d=>{const u=Math.max(o,parseInt(d.target.value,10)||0);t(String(u))},[t,o]);return e.jsxs("div",{className:"cedros-duration-input",children:[r&&r.length>0&&e.jsxs("select",{value:r.find(d=>d.value===s)?.value??"",onChange:c,className:"cedros-setting-select",children:[e.jsx("option",{value:"",children:"Custom..."}),r.map(d=>e.jsx("option",{value:d.value,children:d.label},d.value))]}),e.jsxs("div",{className:"cedros-duration-custom",children:[e.jsx("input",{type:"number",value:n,onChange:i,min:o,className:"cedros-setting-input cedros-setting-input-sm"}),e.jsx("span",{className:"cedros-setting-unit",children:"seconds"}),e.jsxs("span",{className:"cedros-duration-display",children:["= ",a]})]})]})}function ya({value:s,onChange:t,min:r,max:o,step:n,presets:a}){const c=parseInt(s,10)||r,i=l.useCallback(u=>{t(u.target.value)},[t]),d=l.useCallback(u=>{t(u)},[t]);return e.jsxs("div",{className:"cedros-percentage-input",children:[e.jsxs("div",{className:"cedros-percentage-slider-row",children:[e.jsx("input",{type:"range",value:c,onChange:i,min:r,max:o,step:n,className:"cedros-percentage-slider"}),e.jsxs("span",{className:"cedros-percentage-value",children:[c,"%"]})]}),a&&a.length>0&&e.jsx("div",{className:"cedros-preset-buttons",children:a.map(u=>e.jsx("button",{type:"button",className:`cedros-preset-button ${u.value===s?"cedros-preset-button-active":""}`,onClick:()=>d(u.value),children:u.label},u.value))})]})}function ba({value:s,onChange:t,presets:r,unit:o}){const n=!r.some(i=>i.value===s),a=l.useCallback(i=>{i.target.value!=="__custom__"&&t(i.target.value)},[t]),c=l.useCallback(i=>{t(i.target.value)},[t]);return e.jsxs("div",{className:"cedros-select-input",children:[e.jsxs("select",{value:n?"__custom__":s,onChange:a,className:"cedros-setting-select",children:[r.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value)),e.jsx("option",{value:"__custom__",children:"Custom..."})]}),n&&e.jsxs("div",{className:"cedros-select-custom",children:[e.jsx("input",{type:"number",value:s,onChange:c,className:"cedros-setting-input cedros-setting-input-sm"}),o&&e.jsx("span",{className:"cedros-setting-unit",children:o})]})]})}function xa({value:s,onChange:t,min:r,max:o,unit:n}){const a=l.useCallback(c=>{t(c.target.value)},[t]);return e.jsxs("div",{className:"cedros-number-input",children:[e.jsx("input",{type:"number",value:s,onChange:a,min:r,max:o,className:"cedros-setting-input"}),n&&e.jsx("span",{className:"cedros-setting-unit",children:n})]})}const cr=["SOL","USDC","USDT","EURC","USD1","PYUSD","USDH","CASH","BONK","ORE"];function va({value:s,onChange:t}){const r=l.useMemo(()=>{try{return JSON.parse(s||"[]")}catch{return[]}},[s]),o=l.useCallback(i=>{t(JSON.stringify(i))},[t]),n=l.useCallback(()=>{o([...r,{symbol:"",mint:"",decimals:6}])},[r,o]),a=l.useCallback((i,d,u)=>{const p=[...r];p[i]={...p[i],[d]:u},o(p)},[r,o]),c=l.useCallback(i=>{o(r.filter((d,u)=>u!==i))},[r,o]);return e.jsxs("div",{className:"cedros-token-list-input",children:[e.jsxs("div",{className:"cedros-token-presets",children:[e.jsx("span",{className:"cedros-token-presets-label",children:"Built-in tokens:"}),e.jsx("div",{className:"cedros-token-presets-list",children:cr.map(i=>e.jsx("span",{className:"cedros-token-preset-chip",children:i},i))})]}),r.length===0&&e.jsx("p",{className:"cedros-token-list-empty",children:"No custom tokens added. Use the built-in tokens above or add your own."}),r.map((i,d)=>e.jsxs("div",{className:"cedros-token-row",children:[e.jsxs("div",{className:"cedros-token-row-fields",children:[e.jsx("input",{type:"text",placeholder:"Symbol",value:i.symbol,onChange:u=>a(d,"symbol",u.target.value.toUpperCase()),className:"cedros-setting-input cedros-token-input-symbol",maxLength:10}),e.jsx("input",{type:"text",placeholder:"Mint address",value:i.mint,onChange:u=>a(d,"mint",u.target.value),className:"cedros-setting-input cedros-token-input-mint"}),e.jsx("input",{type:"number",placeholder:"Decimals",value:i.decimals,onChange:u=>a(d,"decimals",parseInt(u.target.value,10)||0),className:"cedros-setting-input cedros-token-input-decimals",min:0,max:18}),e.jsx("input",{type:"text",placeholder:"Logo URL (optional)",value:i.logoUrl||"",onChange:u=>a(d,"logoUrl",u.target.value||void 0),className:"cedros-setting-input cedros-token-input-logo"})]}),e.jsx("button",{type:"button",className:"cedros-token-remove-btn",onClick:()=>c(d),title:"Remove token",children:"×"})]},d)),e.jsx("button",{type:"button",className:"cedros-token-add-btn",onClick:n,children:"+ Add Token"})]})}function Aa({value:s,onChange:t}){const r=l.useMemo(()=>s.split(",").map(a=>a.trim()).filter(Boolean),[s]),o=l.useCallback(a=>{if(!a||r.includes(a))return;const c=[...r,a].join(", ");t(c)},[r,t]),n=l.useCallback(a=>{const c=r.filter(i=>i!==a).join(", ");t(c)},[r,t]);return e.jsxs("div",{className:"cedros-token-symbol-list-input",children:[e.jsxs("div",{className:"cedros-token-presets",children:[e.jsx("span",{className:"cedros-token-presets-label",children:"Click to add:"}),e.jsx("div",{className:"cedros-token-presets-list",children:cr.map(a=>{const c=r.includes(a);return e.jsxs("button",{type:"button",className:`cedros-token-preset-chip ${c?"cedros-token-preset-chip-selected":""}`,onClick:()=>c?n(a):o(a),title:c?`Remove ${a}`:`Add ${a}`,children:[a,c&&e.jsx("span",{className:"cedros-token-chip-check",children:"✓"})]},a)})})]}),e.jsx("input",{type:"text",value:s,onChange:a=>t(a.target.value),className:"cedros-setting-input",placeholder:"USDC, SOL, BONK..."})]})}class dr{client;constructor(t,r,o,n){this.client=new A.ApiClient({baseUrl:t,timeoutMs:r,retryAttempts:o,getAccessToken:n})}async listOrgs(){try{return(await this.client.get("/orgs")).orgs.map(r=>({...r,membership:{orgId:r.id,role:r.role}}))}catch(t){throw A.handleApiError(t,"Failed to list organizations")}}async getOrg(t){try{return await this.client.get(`/orgs/${t}`)}catch(r){throw A.handleApiError(r,"Failed to get organization")}}async createOrg(t){try{return await this.client.post("/orgs",t)}catch(r){throw A.handleApiError(r,"Failed to create organization")}}async updateOrg(t,r){try{return await this.client.patch(`/orgs/${t}`,r)}catch(o){throw A.handleApiError(o,"Failed to update organization")}}async deleteOrg(t){try{await this.client.delete(`/orgs/${t}`)}catch(r){throw A.handleApiError(r,"Failed to delete organization")}}async authorize(t){try{return await this.client.post("/authorize",t)}catch(r){throw A.handleApiError(r,"Failed to check authorization")}}async getPermissions(t){try{return await this.client.post("/permissions",{orgId:t})}catch(r){throw A.handleApiError(r,"Failed to get permissions")}}}const Xe="cedros_active_org";function ja(s){try{return localStorage.getItem(s)}catch{return null}}function Qs(s,t){try{localStorage.setItem(s,t)}catch{}}function ur(){const{config:s,user:t,authState:r,_internal:o}=A.useCedrosLogin(),n=typeof window<"u"&&!!window.localStorage,[a,c]=l.useState([]),[i,d]=l.useState(null),[u,p]=l.useState([]),[f,h]=l.useState(null),[w,m]=l.useState(!1),[g,y]=l.useState(null),v=l.useMemo(()=>new dr(s.serverUrl,s.requestTimeout,s.retryAttempts,o?.getAccessToken),[s.serverUrl,s.requestTimeout,s.retryAttempts,o]),x=l.useRef(v);l.useEffect(()=>{x.current=v},[v]);const j=l.useCallback(async L=>{try{const E=await x.current.getPermissions(L);p(E.permissions),h(E.role)}catch{p([]),h(null)}},[]),C=l.useCallback(async()=>{if(r!=="authenticated"||!t){c([]),d(null),p([]),h(null);return}m(!0),y(null);try{const L=await x.current.listOrgs();c(L);const E=n?ja(Xe):null;let P=L.find(M=>M.id===E);!P&&L.length>0&&(P=L.find(M=>M.isPersonal)||L[0]),P?(d(P),n&&Qs(Xe,P.id),await j(P.id)):(d(null),p([]),h(null))}catch(L){y(L)}finally{m(!1)}},[r,t,j,n]),k=l.useCallback(async L=>{const E=a.find(P=>P.id===L);if(!E){y({code:"UNKNOWN_ERROR",message:"Organization not found"});return}d(E),n&&Qs(Xe,L),await j(L)},[a,j,n]),b=l.useCallback(async L=>{m(!0),y(null);try{const E=await x.current.createOrg(L);return await C(),E}catch(E){throw y(E),E}finally{m(!1)}},[C]),S=l.useCallback(async(L,E)=>{m(!0),y(null);try{const P=await x.current.updateOrg(L,E);return await C(),P}catch(P){throw y(P),P}finally{m(!1)}},[C]),T=l.useCallback(async L=>{m(!0),y(null);try{await x.current.deleteOrg(L),await C()}catch(E){throw y(E),E}finally{m(!1)}},[C]),N=l.useCallback(L=>u.includes(L),[u]);return{orgs:a,activeOrg:i,permissions:u,role:f,isLoading:w,error:g,fetchOrgs:C,switchOrg:k,createOrg:b,updateOrg:S,deleteOrg:T,hasPermission:N}}class Na{client;constructor(t,r,o,n){this.client=new A.ApiClient({baseUrl:t,timeoutMs:r,retryAttempts:o,getAccessToken:n})}async listMembers(t,r=50,o=0){try{const n=await this.client.get(`/orgs/${t}/members?limit=${r}&offset=${o}`);return{members:n.members.map(a=>({id:a.id,userId:a.userId,orgId:t,role:a.role,joinedAt:a.joinedAt,user:{id:a.userId,email:a.email,name:a.name}})),total:n.total}}catch(n){throw A.handleApiError(n,"Failed to list members")}}async updateMemberRole(t,r,o){try{return await this.client.patch(`/orgs/${t}/members/${r}`,o)}catch(n){throw A.handleApiError(n,"Failed to update member role")}}async removeMember(t,r){try{await this.client.delete(`/orgs/${t}/members/${r}`)}catch(o){throw A.handleApiError(o,"Failed to remove member")}}}function hr(s){const{config:t,authState:r,_internal:o}=A.useCedrosLogin(),[n,a]=l.useState([]),[c,i]=l.useState(0),[d,u]=l.useState(!1),[p,f]=l.useState(null),h=l.useRef(void 0),w=l.useRef(0),m=l.useMemo(()=>new Na(t.serverUrl,t.requestTimeout,t.retryAttempts,o?.getAccessToken),[t.serverUrl,t.requestTimeout,t.retryAttempts,o]),g=l.useRef(m);g.current=m;const y=l.useCallback(async j=>{if(!s||r!=="authenticated"){a([]),i(0);return}u(!0),f(null);const C=++w.current;try{const{limit:k=50,offset:b=0}=j??{},S=await g.current.listMembers(s,k,b);if(C!==w.current)return;a(S.members),i(S.total)}catch(k){if(C!==w.current)return;f(k)}finally{C===w.current&&u(!1)}},[s,r]);l.useEffect(()=>{if(r!=="authenticated"){h.current=void 0;return}s!==h.current&&(h.current=s,y())},[s,r,y]);const v=l.useCallback(async(j,C)=>{if(!s)throw new Error("No organization selected");u(!0),f(null);try{await g.current.updateMemberRole(s,j,{role:C}),await y()}catch(k){throw f(k),k}finally{u(!1)}},[s,y]),x=l.useCallback(async j=>{if(!s)throw new Error("No organization selected");u(!0),f(null);try{await g.current.removeMember(s,j),await y()}catch(C){throw f(C),C}finally{u(!1)}},[s,y]);return{members:n,total:c,isLoading:d,error:p,fetchMembers:y,updateMemberRole:v,removeMember:x}}class ka{client;constructor(t,r,o,n){this.client=new A.ApiClient({baseUrl:t,timeoutMs:r,retryAttempts:o,getAccessToken:n})}async listInvites(t,r=50,o=0){try{const n=await this.client.get(`/orgs/${t}/invites?limit=${r}&offset=${o}`);return{invites:n.invites.map(a=>({id:a.id,orgId:a.orgId,email:a.email,role:a.role,invitedBy:a.invitedBy,createdAt:a.createdAt,expiresAt:a.expiresAt})),total:n.total}}catch(n){throw A.handleApiError(n,"Failed to list invites")}}async createInvite(t,r){try{return await this.client.post(`/orgs/${t}/invites`,r)}catch(o){throw A.handleApiError(o,"Failed to create invite")}}async cancelInvite(t,r){try{await this.client.delete(`/orgs/${t}/invites/${r}`)}catch(o){throw A.handleApiError(o,"Failed to cancel invite")}}async resendInvite(t,r){try{await this.client.post(`/orgs/${t}/invites/${r}/resend`,{})}catch(o){throw A.handleApiError(o,"Failed to resend invite")}}async acceptInvite(t){try{return await this.client.post("/invites/accept",t)}catch(r){throw A.handleApiError(r,"Failed to accept invite")}}}function mr(s){const{config:t,authState:r,_internal:o}=A.useCedrosLogin(),[n,a]=l.useState([]),[c,i]=l.useState(0),[d,u]=l.useState(!1),[p,f]=l.useState(null),h=l.useRef(void 0),w=l.useRef(0),m=l.useMemo(()=>new ka(t.serverUrl,t.requestTimeout,t.retryAttempts,o?.getAccessToken),[t.serverUrl,t.requestTimeout,t.retryAttempts,o]),g=l.useRef(m);g.current=m;const y=l.useCallback(async k=>{if(!s||r!=="authenticated"){a([]),i(0);return}u(!0),f(null);const b=++w.current;try{const{limit:S=50,offset:T=0}=k??{},N=await g.current.listInvites(s,S,T);if(b!==w.current)return;a(N.invites),i(N.total)}catch(S){if(b!==w.current)return;f(S)}finally{b===w.current&&u(!1)}},[s,r]);l.useEffect(()=>{if(r!=="authenticated"){h.current=void 0;return}s!==h.current&&(h.current=s,y())},[s,r,y]);const v=l.useCallback(async(k,b="member")=>{if(!s)throw new Error("No organization selected");u(!0),f(null);try{await g.current.createInvite(s,{email:k,role:b}),await y()}catch(S){throw f(S),S}finally{u(!1)}},[s,y]),x=l.useCallback(async k=>{if(!s)throw new Error("No organization selected");u(!0),f(null);try{await g.current.cancelInvite(s,k),await y()}catch(b){throw f(b),b}finally{u(!1)}},[s,y]),j=l.useCallback(async k=>{if(!s)throw new Error("No organization selected");u(!0),f(null);try{await g.current.resendInvite(s,k)}catch(b){throw f(b),b}finally{u(!1)}},[s]),C=l.useCallback(async k=>{u(!0),f(null);try{return await g.current.acceptInvite({token:k})}catch(b){throw f(b),b}finally{u(!1)}},[]);return{invites:n,total:c,isLoading:d,error:p,fetchInvites:y,createInvite:v,cancelInvite:x,resendInvite:j,acceptInvite:C}}function ze(){const s=A.useCedrosLoginOptional(),[t,r]=l.useState(!1),[o,n]=l.useState(null),a=l.useMemo(()=>s?new A.ApiClient({baseUrl:s.config.serverUrl,timeoutMs:s.config.requestTimeout,retryAttempts:s.config.retryAttempts,getAccessToken:s._internal?.getAccessToken}):null,[s]),c=l.useCallback(()=>{n(null)},[]),i=l.useCallback(async()=>{if(!a)throw new Error("useCredits must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.get("/credits/balance/sol")}catch(p){const f=A.handleApiError(p,"Failed to fetch credit balance");throw n(f.message),f}finally{r(!1)}},[a]),d=l.useCallback(async()=>{if(!a)throw new Error("useCredits must be used within a CedrosLoginProvider");r(!0),n(null);try{return(await a.get("/credits/balance")).balances}catch(p){const f=A.handleApiError(p,"Failed to fetch credit balances");throw n(f.message),f}finally{r(!1)}},[a]),u=l.useCallback(async p=>{if(!a)throw new Error("useCredits must be used within a CedrosLoginProvider");r(!0),n(null);try{const f=new URLSearchParams;p?.currency&&f.set("currency",p.currency),p?.limit&&f.set("limit",p.limit.toString()),p?.offset&&f.set("offset",p.offset.toString());const h=f.toString(),w=h?`/credits/history?${h}`:"/credits/history";return await a.get(w)}catch(f){const h=A.handleApiError(f,"Failed to fetch transaction history");throw n(h.message),h}finally{r(!1)}},[a]);return{getBalance:i,getAllBalances:d,getHistory:u,isLoading:t,error:o,clearError:c}}function he(){const s=A.useCedrosLoginOptional(),[t,r]=l.useState(!1),[o,n]=l.useState(null),a=l.useMemo(()=>s?new A.ApiClient({baseUrl:s.config.serverUrl,timeoutMs:s.config.requestTimeout,retryAttempts:s.config.retryAttempts,getAccessToken:s._internal?.getAccessToken}):null,[s]),c=l.useCallback(()=>{n(null)},[]),i=l.useCallback(async g=>{if(!a)throw new Error("useAdminDeposits must be used within a CedrosLoginProvider");r(!0),n(null);try{const y=new URLSearchParams;g?.status&&y.set("status",g.status),g?.limit!==void 0&&y.set("limit",String(g.limit)),g?.offset!==void 0&&y.set("offset",String(g.offset));const v=y.toString(),x=v?`/admin/deposits?${v}`:"/admin/deposits";return await a.get(x)}catch(y){const v=A.handleApiError(y,"Failed to list deposits");throw n(v.message),v}finally{r(!1)}},[a]),d=l.useCallback(async()=>{if(!a)throw new Error("useAdminDeposits must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.get("/admin/deposits/stats")}catch(g){const y=A.handleApiError(g,"Failed to get deposit stats");throw n(y.message),y}finally{r(!1)}},[a]),u=l.useCallback(async g=>{if(!a)throw new Error("useAdminDeposits must be used within a CedrosLoginProvider");r(!0),n(null);try{const y=new URLSearchParams;g?.limit!==void 0&&y.set("limit",String(g.limit)),g?.offset!==void 0&&y.set("offset",String(g.offset));const v=y.toString(),x=v?`/admin/deposits/in-privacy-period?${v}`:"/admin/deposits/in-privacy-period";return await a.get(x)}catch(y){const v=A.handleApiError(y,"Failed to list deposits in privacy period");throw n(v.message),v}finally{r(!1)}},[a]),p=l.useCallback(async g=>{if(!a)throw new Error("useAdminDeposits must be used within a CedrosLoginProvider");r(!0),n(null);try{const y=new URLSearchParams;g?.limit!==void 0&&y.set("limit",String(g.limit)),g?.offset!==void 0&&y.set("offset",String(g.offset));const v=y.toString(),x=v?`/admin/withdrawals/pending?${v}`:"/admin/withdrawals/pending";return await a.get(x)}catch(y){const v=A.handleApiError(y,"Failed to list pending withdrawals");throw n(v.message),v}finally{r(!1)}},[a]),f=l.useCallback(async(g,y)=>{if(!a)throw new Error("useAdminDeposits must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.post(`/admin/withdrawals/${g}/process`,y??{})}catch(v){const x=A.handleApiError(v,"Failed to process withdrawal");throw n(x.message),x}finally{r(!1)}},[a]),h=l.useCallback(async()=>{if(!a)throw new Error("useAdminDeposits must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.post("/admin/withdrawals/process-all",{})}catch(g){const y=A.handleApiError(g,"Failed to process withdrawals");throw n(y.message),y}finally{r(!1)}},[a]),w=l.useCallback(async()=>{if(!a)throw new Error("useAdminDeposits must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.get("/admin/privacy/status")}catch(g){const y=A.handleApiError(g,"Failed to get privacy status");throw n(y.message),y}finally{r(!1)}},[a]),m=l.useCallback(async()=>{if(!a)throw new Error("useAdminDeposits must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.get("/admin/credits/stats")}catch(g){const y=A.handleApiError(g,"Failed to get credit stats");throw n(y.message),y}finally{r(!1)}},[a]);return{listDeposits:i,getStats:d,listInPrivacyPeriod:u,listPendingWithdrawals:p,processWithdrawal:f,processAllWithdrawals:h,getPrivacyStatus:w,getCreditStats:m,isLoading:t,error:o,clearError:c}}function Ls({refreshInterval:s=0,className:t="",onLoad:r}){const{getStats:o,isLoading:n,error:a,clearError:c}=he(),[i,d]=l.useState(null),[u,p]=l.useState(null),f=l.useCallback(async()=>{try{const h=await o();d(h),r?.(h),p(null)}catch(h){p(h instanceof Error?h.message:"Failed to load stats")}},[o,r]);return l.useEffect(()=>{f()},[f]),l.useEffect(()=>{if(s<=0)return;const h=setInterval(f,s);return()=>clearInterval(h)},[s,f]),u||a?e.jsxs("div",{className:`cedros-admin-stats cedros-admin-stats-error ${t}`,children:[e.jsx("p",{className:"cedros-admin-error",children:u||a}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{c(),p(null),f()},children:"Retry"})]}):n&&!i?e.jsxs("div",{className:`cedros-admin-stats cedros-admin-stats-loading ${t}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading statistics..."})]}):i?e.jsxs("div",{className:`cedros-admin-stats ${t}`,children:[e.jsxs("div",{className:"cedros-admin-stats-header",children:[e.jsx("h4",{className:"cedros-admin-stats-title",children:"Deposit Statistics"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm cedros-admin-icon-button",onClick:f,disabled:n,title:"Refresh stats","aria-label":"Refresh stats",children:n?"...":"↻"})]}),e.jsxs("div",{className:"cedros-admin-stats-grid",children:[e.jsxs("div",{className:"cedros-admin-stat-card",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Total Deposits"}),e.jsx("span",{className:"cedros-admin-stat-value",children:i.totalDeposits}),e.jsxs("span",{className:"cedros-admin-stat-sub",children:[i.totalDepositedSol.toFixed(4)," SOL"]})]}),e.jsxs("div",{className:"cedros-admin-stat-card cedros-admin-stat-pending",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Pending Withdrawal"}),e.jsx("span",{className:"cedros-admin-stat-value",children:i.pendingWithdrawalCount}),e.jsxs("span",{className:"cedros-admin-stat-sub",children:[i.pendingWithdrawalSol.toFixed(4)," SOL"]})]}),e.jsxs("div",{className:"cedros-admin-stat-card cedros-admin-stat-success",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Withdrawn"}),e.jsx("span",{className:"cedros-admin-stat-value",children:i.totalWithdrawnCount}),e.jsxs("span",{className:"cedros-admin-stat-sub",children:[i.totalWithdrawnSol.toFixed(4)," SOL"]})]}),e.jsxs("div",{className:"cedros-admin-stat-card cedros-admin-stat-error",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Failed"}),e.jsx("span",{className:"cedros-admin-stat-value",children:i.failedCount})]})]}),(i.readyForWithdrawalCount!==void 0||i.inPrivacyPeriodCount!==void 0)&&e.jsxs("div",{className:"cedros-admin-stats-section",children:[e.jsx("h5",{className:"cedros-admin-stats-section-title",children:"Withdrawal Status"}),e.jsxs("div",{className:"cedros-admin-stats-grid",children:[e.jsxs("div",{className:"cedros-admin-stat-card cedros-admin-stat-ready",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Ready Now"}),e.jsx("span",{className:"cedros-admin-stat-value",children:i.readyForWithdrawalCount??0}),e.jsxs("span",{className:"cedros-admin-stat-sub",children:[(i.readyForWithdrawalSol??0).toFixed(4)," SOL"]})]}),e.jsxs("div",{className:"cedros-admin-stat-card cedros-admin-stat-waiting",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"In Privacy Period"}),e.jsx("span",{className:"cedros-admin-stat-value",children:i.inPrivacyPeriodCount??0}),e.jsxs("span",{className:"cedros-admin-stat-sub",children:[(i.inPrivacyPeriodSol??0).toFixed(4)," SOL"]})]})]})]}),(i.usdcDepositCount!==void 0||i.usdtDepositCount!==void 0)&&e.jsxs("div",{className:"cedros-admin-stats-section",children:[e.jsx("h5",{className:"cedros-admin-stats-section-title",children:"Input Tokens"}),e.jsxs("div",{className:"cedros-admin-stats-grid",children:[e.jsxs("div",{className:"cedros-admin-stat-card",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"USDC Deposits"}),e.jsx("span",{className:"cedros-admin-stat-value",children:i.usdcDepositCount??0}),e.jsxs("span",{className:"cedros-admin-stat-sub",children:["$",(i.totalUsdcDisplay??0).toFixed(2)]})]}),e.jsxs("div",{className:"cedros-admin-stat-card",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"USDT Deposits"}),e.jsx("span",{className:"cedros-admin-stat-value",children:i.usdtDepositCount??0}),e.jsxs("span",{className:"cedros-admin-stat-sub",children:["$",(i.totalUsdtDisplay??0).toFixed(2)]})]}),e.jsxs("div",{className:"cedros-admin-stat-card",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Native SOL"}),e.jsx("span",{className:"cedros-admin-stat-value",children:i.nativeSolDepositCount??0}),e.jsxs("span",{className:"cedros-admin-stat-sub",children:[(i.totalNativeSolDisplay??0).toFixed(4)," SOL"]})]})]})]})]}):null}function Ca(s){return{pending:"Pending",detected:"Detected",processing:"Processing",completed:"Completed",withdrawn:"Withdrawn",partially_withdrawn:"Partially Withdrawn",expired:"Expired",failed:"Failed"}[s]||s}function Sa(s){return s==="completed"||s==="withdrawn"||s==="partially_withdrawn"?"cedros-admin-deposit-success":s==="failed"||s==="expired"?"cedros-admin-deposit-error":s==="processing"||s==="detected"?"cedros-admin-deposit-processing":"cedros-admin-deposit-pending"}function Ea(s){return s==null?"—":`${(s/1e9).toFixed(4)} SOL`}function Pa(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Hs(s){return s.length<=12?s:`${s.slice(0,6)}...${s.slice(-4)}`}function pr({statusFilter:s,pageSize:t=20,refreshInterval:r=0,className:o="",onLoad:n,onDepositClick:a}){const{listDeposits:c,isLoading:i,error:d,clearError:u}=he(),[p,f]=l.useState([]),[h,w]=l.useState(0),[m,g]=l.useState(0),[y,v]=l.useState(null),x=l.useCallback(async()=>{try{const b=await c({status:s,limit:t,offset:m});f(b.deposits),w(b.total),n?.(b),v(null)}catch(b){v(b instanceof Error?b.message:"Failed to load deposits")}},[s,t,m,c,n]);l.useEffect(()=>{g(0)},[s,t]),l.useEffect(()=>{x()},[x]),l.useEffect(()=>{if(r<=0)return;const b=setInterval(x,r);return()=>clearInterval(b)},[r,x]);const j=Math.ceil(h/t),C=Math.floor(m/t)+1,k=b=>{const S=(b-1)*t;g(Math.max(0,Math.min(S,Math.max(0,h-1))))};return y||d?e.jsxs("div",{className:`cedros-admin-deposit-list cedros-admin-deposit-list-error ${o}`,children:[e.jsx("p",{className:"cedros-admin-error",children:y||d}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{u(),v(null),x()},children:"Retry"})]}):i&&p.length===0?e.jsxs("div",{className:`cedros-admin-deposit-list cedros-admin-deposit-list-loading ${o}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading deposits..."})]}):e.jsxs("div",{className:`cedros-admin-deposit-list ${o}`,children:[e.jsxs("div",{className:"cedros-admin-deposit-list-header",children:[e.jsx("h4",{className:"cedros-admin-deposit-list-title",children:"All Deposits"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm cedros-admin-icon-button",onClick:x,disabled:i,title:"Refresh deposits","aria-label":"Refresh deposits",children:i?"...":"↻"})]}),p.length===0?e.jsx("div",{className:"cedros-admin-empty",children:e.jsx("p",{className:"cedros-admin-empty-message",children:"No deposits found."})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin-deposit-table",children:[e.jsxs("div",{className:"cedros-admin-deposit-thead",children:[e.jsx("div",{className:"cedros-admin-deposit-th",children:"User"}),e.jsx("div",{className:"cedros-admin-deposit-th",children:"Amount"}),e.jsx("div",{className:"cedros-admin-deposit-th",children:"Status"}),e.jsx("div",{className:"cedros-admin-deposit-th",children:"Created"}),e.jsx("div",{className:"cedros-admin-deposit-th",children:"Tx"})]}),p.map(b=>e.jsxs("div",{className:`cedros-admin-deposit-row ${Sa(b.status)}`,onClick:()=>a?.(b),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),a?.(b))},role:a?"button":void 0,tabIndex:a?0:void 0,children:[e.jsx("div",{className:"cedros-admin-deposit-td",title:b.userId,children:Hs(b.userId)}),e.jsx("div",{className:"cedros-admin-deposit-td",children:Ea(b.amountLamports)}),e.jsx("div",{className:"cedros-admin-deposit-td",children:e.jsx("span",{className:"cedros-admin-status-badge",children:Ca(b.status)})}),e.jsx("div",{className:"cedros-admin-deposit-td",children:Pa(b.createdAt)}),e.jsx("div",{className:"cedros-admin-deposit-td",title:b.txSignature||void 0,children:b.txSignature?Hs(b.txSignature):"—"})]},b.id))]}),j>1&&e.jsxs("div",{className:"cedros-admin-pagination",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>k(C-1),disabled:C<=1,children:"Previous"}),e.jsxs("span",{className:"cedros-admin-page-info",children:["Page ",C," of ",j," (",h," total)"]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>k(C+1),disabled:C>=j,children:"Next"})]})]})]})}function Ks(s){return s==null?"—":`${(s/1e9).toFixed(4)} SOL`}function Ys(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Gs(s){return s.length<=12?s:`${s.slice(0,6)}...${s.slice(-4)}`}function La(s){const t=new Date(s),o=new Date().getTime()-t.getTime(),n=Math.floor(o/6e4),a=Math.floor(n/60),c=Math.floor(a/24);return c>0?`${c}d ago`:a>0?`${a}h ago`:n>0?`${n}m ago`:"just now"}function Js(s){return s?new Date(s)>new Date:!0}function fr({pageSize:s=20,refreshInterval:t=0,className:r="",onLoad:o,onItemClick:n,onWithdrawalProcessed:a,onAllProcessed:c}){const{listPendingWithdrawals:i,processWithdrawal:d,processAllWithdrawals:u,isLoading:p,error:f,clearError:h}=he(),[w,m]=l.useState([]),[g,y]=l.useState(0),[v,x]=l.useState(0),[j,C]=l.useState(null),[k,b]=l.useState(null),[S,T]=l.useState(!1),[N,L]=l.useState(null),[E,P]=l.useState(null),M=l.useCallback(async()=>{try{const R=await i({limit:s,offset:v});m(R.deposits),y(R.total),o?.(R),C(null)}catch(R){C(R instanceof Error?R.message:"Failed to load pending withdrawals")}},[s,v,i,o]);l.useEffect(()=>{x(0)},[s]),l.useEffect(()=>{M()},[M]),l.useEffect(()=>{if(t<=0)return;const R=setInterval(M,t);return()=>clearInterval(R)},[t,M]),l.useEffect(()=>{if(!N)return;const R=setTimeout(()=>L(null),5e3);return()=>clearTimeout(R)},[N]);const B=Math.ceil(g/s),I=Math.floor(v/s)+1,D=R=>{const U=(R-1)*s;x(Math.max(0,Math.min(U,Math.max(0,g-1))))},H=async(R,U=!1)=>{if(!U&&Js(R.withdrawalAvailableAt)){P(R);return}b(R.id),L(null);try{const F=await d(R.id,{force:U});F.success?(L({type:"success",message:`Withdrawal processed: ${F.txSignature?.slice(0,12)}...`}),a?.(F),await M()):L({type:"error",message:F.error||"Failed to process withdrawal"})}catch(F){L({type:"error",message:F instanceof Error?F.message:"Failed to process withdrawal"})}finally{b(null),P(null)}},z=async()=>{if(w.length!==0){T(!0),L(null);try{const R=await u();R.totalSucceeded>0?L({type:"success",message:`Processed ${R.totalSucceeded}/${R.totalProcessed} withdrawals`}):R.totalFailed>0&&L({type:"error",message:`Failed to process ${R.totalFailed} withdrawals`}),c?.(R),await M()}catch(R){L({type:"error",message:R instanceof Error?R.message:"Failed to process withdrawals"})}finally{T(!1)}}};return j||f?e.jsxs("div",{className:`cedros-admin-withdrawal-queue cedros-admin-withdrawal-queue-error ${r}`,children:[e.jsx("p",{className:"cedros-admin-error",children:j||f}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{h(),C(null),M()},children:"Retry"})]}):p&&w.length===0&&!k&&!S?e.jsxs("div",{className:`cedros-admin-withdrawal-queue cedros-admin-withdrawal-queue-loading ${r}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading withdrawal queue..."})]}):e.jsxs("div",{className:`cedros-admin-withdrawal-queue ${r}`,children:[E&&e.jsx("div",{className:"cedros-admin-modal-overlay",onClick:()=>P(null),onKeyDown:R=>R.key==="Escape"&&P(null),role:"dialog","aria-modal":"true","aria-labelledby":"early-withdrawal-title",children:e.jsxs("div",{className:"cedros-admin-modal cedros-admin-modal-warning",onClick:R=>R.stopPropagation(),onKeyDown:()=>{},role:"document",children:[e.jsx("h3",{id:"early-withdrawal-title",className:"cedros-admin-modal-title",children:"Early Withdrawal Warning"}),e.jsxs("div",{className:"cedros-admin-modal-content",children:[e.jsx("p",{className:"cedros-admin-modal-warning-text",children:e.jsx("strong",{children:"This deposit is still within its privacy period."})}),e.jsx("p",{children:"Processing this withdrawal early may compromise user privacy. The privacy period exists to provide plausible deniability for deposits."}),e.jsxs("p",{className:"cedros-admin-modal-details",children:["User: ",Gs(E.userId),e.jsx("br",{}),"Amount: ",Ks(E.amountLamports),e.jsx("br",{}),"Available at:"," ",E.withdrawalAvailableAt?Ys(E.withdrawalAvailableAt):"—"]}),e.jsx("p",{children:"Are you sure you want to process this withdrawal early?"})]}),e.jsxs("div",{className:"cedros-admin-modal-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>P(null),children:"Cancel"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-danger",onClick:()=>H(E,!0),disabled:k===E.id,children:k===E.id?"Processing...":"Process Early"})]})]})}),N&&e.jsx("div",{className:`cedros-admin-result cedros-admin-result-${N.type}`,role:"status","aria-live":"polite",children:N.message}),e.jsxs("div",{className:"cedros-admin-withdrawal-queue-header",children:[e.jsx("h4",{className:"cedros-admin-withdrawal-queue-title",children:"Pending Withdrawals"}),e.jsxs("div",{className:"cedros-admin-withdrawal-queue-actions",children:[e.jsxs("span",{className:"cedros-admin-queue-count",children:[g," pending"]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm cedros-admin-icon-button",onClick:M,disabled:p||S,title:"Refresh queue","aria-label":"Refresh queue",children:p&&!S?"...":"↻"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-sm",onClick:z,disabled:p||S||w.length===0,title:"Process all ready withdrawals",children:S?"Processing...":"Process All"})]})]}),w.length===0?e.jsx("div",{className:"cedros-admin-empty",children:e.jsx("p",{className:"cedros-admin-empty-message",children:"No pending withdrawals."})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin-withdrawal-table",children:[e.jsxs("div",{className:"cedros-admin-withdrawal-thead",children:[e.jsx("div",{className:"cedros-admin-withdrawal-th",children:"User"}),e.jsx("div",{className:"cedros-admin-withdrawal-th",children:"Amount"}),e.jsx("div",{className:"cedros-admin-withdrawal-th",children:"Ready Since"}),e.jsx("div",{className:"cedros-admin-withdrawal-th",children:"Waiting"}),e.jsx("div",{className:"cedros-admin-withdrawal-th cedros-admin-withdrawal-th-action",children:"Action"})]}),w.map(R=>{const U=Js(R.withdrawalAvailableAt),F=k===R.id;return e.jsxs("div",{className:`cedros-admin-withdrawal-row ${U?"cedros-admin-withdrawal-row-early":""}`,onClick:()=>n?.(R),onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),n?.(R))},role:n?"button":void 0,tabIndex:n?0:void 0,children:[e.jsx("div",{className:"cedros-admin-withdrawal-td",title:R.userId,children:Gs(R.userId)}),e.jsx("div",{className:"cedros-admin-withdrawal-td",children:Ks(R.amountLamports)}),e.jsx("div",{className:"cedros-admin-withdrawal-td",children:R.withdrawalAvailableAt?Ys(R.withdrawalAvailableAt):"—"}),e.jsx("div",{className:"cedros-admin-withdrawal-td cedros-admin-withdrawal-waiting",children:R.withdrawalAvailableAt?U?"In privacy period":La(R.withdrawalAvailableAt):"—"}),e.jsx("div",{className:"cedros-admin-withdrawal-td cedros-admin-withdrawal-td-action",children:e.jsx("button",{type:"button",className:`cedros-button cedros-button-sm ${U?"cedros-button-warning":"cedros-button-primary"}`,onClick:$=>{$.stopPropagation(),H(R)},disabled:F||S,title:U?"Early withdrawal (requires confirmation)":"Process this withdrawal",children:F?"...":U?"Early":"Process"})})]},R.id)})]}),B>1&&e.jsxs("div",{className:"cedros-admin-pagination",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>D(I-1),disabled:I<=1,children:"Previous"}),e.jsxs("span",{className:"cedros-admin-page-info",children:["Page ",I," of ",B," (",g," total)"]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>D(I+1),disabled:I>=B,children:"Next"})]})]})]})}function Ta(s){return s==null?"—":`${(s/1e9).toFixed(4)} SOL`}function Ma(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ra(s){return s.length<=12?s:`${s.slice(0,6)}...${s.slice(-4)}`}function Da(s){const t=new Date(s),r=new Date,o=t.getTime()-r.getTime();if(o<=0)return"Ready";const n=Math.floor(o/6e4),a=Math.floor(n/60),c=Math.floor(a/24);if(c>0){const i=a%24;return i>0?`${c}d ${i}h`:`${c}d`}if(a>0){const i=n%60;return i>0?`${a}h ${i}m`:`${a}h`}return`${n}m`}function gr({pageSize:s=20,refreshInterval:t=0,className:r="",onLoad:o,onItemClick:n}){const{listInPrivacyPeriod:a,isLoading:c,error:i,clearError:d}=he(),[u,p]=l.useState([]),[f,h]=l.useState(0),[w,m]=l.useState(0),[g,y]=l.useState(null),v=l.useCallback(async()=>{try{const k=await a({limit:s,offset:w});p(k.deposits),h(k.total),o?.(k),y(null)}catch(k){y(k instanceof Error?k.message:"Failed to load deposits")}},[s,w,a,o]);l.useEffect(()=>{m(0)},[s]),l.useEffect(()=>{v()},[v]),l.useEffect(()=>{if(t<=0)return;const k=setInterval(v,t);return()=>clearInterval(k)},[t,v]);const x=Math.ceil(f/s),j=Math.floor(w/s)+1,C=k=>{const b=(k-1)*s;m(Math.max(0,Math.min(b,Math.max(0,f-1))))};return g||i?e.jsxs("div",{className:`cedros-admin-privacy-deposits cedros-admin-privacy-deposits-error ${r}`,children:[e.jsx("p",{className:"cedros-admin-error",children:g||i}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{d(),y(null),v()},children:"Retry"})]}):c&&u.length===0?e.jsxs("div",{className:`cedros-admin-privacy-deposits cedros-admin-privacy-deposits-loading ${r}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading deposits..."})]}):e.jsxs("div",{className:`cedros-admin-privacy-deposits ${r}`,children:[e.jsxs("div",{className:"cedros-admin-privacy-deposits-header",children:[e.jsx("h4",{className:"cedros-admin-privacy-deposits-title",children:"In Privacy Period"}),e.jsxs("div",{className:"cedros-admin-privacy-deposits-actions",children:[e.jsxs("span",{className:"cedros-admin-queue-count",children:[f," deposit",f!==1?"s":""]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm cedros-admin-icon-button",onClick:v,disabled:c,title:"Refresh list","aria-label":"Refresh list",children:c?"...":"↻"})]})]}),u.length===0?e.jsx("div",{className:"cedros-admin-empty",children:e.jsx("p",{className:"cedros-admin-empty-message",children:"No deposits in privacy period."})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin-privacy-table",children:[e.jsxs("div",{className:"cedros-admin-privacy-thead",children:[e.jsx("div",{className:"cedros-admin-privacy-th",children:"User"}),e.jsx("div",{className:"cedros-admin-privacy-th",children:"Amount"}),e.jsx("div",{className:"cedros-admin-privacy-th",children:"Deposited"}),e.jsx("div",{className:"cedros-admin-privacy-th",children:"Ready In"})]}),u.map(k=>e.jsxs("div",{className:"cedros-admin-privacy-row",onClick:()=>n?.(k),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),n?.(k))},role:n?"button":void 0,tabIndex:n?0:void 0,children:[e.jsx("div",{className:"cedros-admin-privacy-td",title:k.userId,children:Ra(k.userId)}),e.jsx("div",{className:"cedros-admin-privacy-td",children:Ta(k.amountLamports)}),e.jsx("div",{className:"cedros-admin-privacy-td",children:k.completedAt?Ma(k.completedAt):"—"}),e.jsx("div",{className:"cedros-admin-privacy-td cedros-admin-privacy-remaining",children:k.withdrawalAvailableAt?Da(k.withdrawalAvailableAt):"—"})]},k.id))]}),x>1&&e.jsxs("div",{className:"cedros-admin-pagination",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>C(j-1),disabled:j<=1,children:"Previous"}),e.jsxs("span",{className:"cedros-admin-page-info",children:["Page ",j," of ",x," (",f," total)"]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>C(j+1),disabled:j>=x,children:"Next"})]})]})]})}function Ba(s){return s==null?"—":`${(s/1e9).toFixed(4)} SOL`}function Fa(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ua(s){return s.length<=16?s:`${s.slice(0,8)}...${s.slice(-6)}`}function Ia(s){return s.length<=12?s:`${s.slice(0,6)}...${s.slice(-4)}`}function wr({pageSize:s=20,refreshInterval:t=0,className:r="",onLoad:o,onItemClick:n}){const{listDeposits:a,isLoading:c,error:i,clearError:d}=he(),[u,p]=l.useState([]),[f,h]=l.useState(0),[w,m]=l.useState(0),[g,y]=l.useState(null),v=l.useCallback(async()=>{try{const k=await a({status:"withdrawn",limit:s,offset:w});p(k.deposits),h(k.total),o?.(k),y(null)}catch(k){y(k instanceof Error?k.message:"Failed to load withdrawal history")}},[s,w,a,o]);l.useEffect(()=>{m(0)},[s]),l.useEffect(()=>{v()},[v]),l.useEffect(()=>{if(t<=0)return;const k=setInterval(v,t);return()=>clearInterval(k)},[t,v]);const x=Math.ceil(f/s),j=Math.floor(w/s)+1,C=k=>{const b=(k-1)*s;m(Math.max(0,Math.min(b,Math.max(0,f-1))))};return g||i?e.jsxs("div",{className:`cedros-admin-withdrawal-history cedros-admin-withdrawal-history-error ${r}`,children:[e.jsx("p",{className:"cedros-admin-error",children:g||i}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{d(),y(null),v()},children:"Retry"})]}):c&&u.length===0?e.jsxs("div",{className:`cedros-admin-withdrawal-history cedros-admin-withdrawal-history-loading ${r}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading withdrawal history..."})]}):e.jsxs("div",{className:`cedros-admin-withdrawal-history ${r}`,children:[e.jsxs("div",{className:"cedros-admin-withdrawal-history-header",children:[e.jsx("h4",{className:"cedros-admin-withdrawal-history-title",children:"Withdrawal History"}),e.jsxs("div",{className:"cedros-admin-withdrawal-history-actions",children:[e.jsxs("span",{className:"cedros-admin-queue-count",children:[f," withdrawal",f!==1?"s":""]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm cedros-admin-icon-button",onClick:v,disabled:c,title:"Refresh list","aria-label":"Refresh list",children:c?"...":"↻"})]})]}),u.length===0?e.jsx("div",{className:"cedros-admin-empty",children:e.jsx("p",{className:"cedros-admin-empty-message",children:"No withdrawals processed yet."})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin-history-table",children:[e.jsxs("div",{className:"cedros-admin-history-thead",children:[e.jsx("div",{className:"cedros-admin-history-th",children:"User"}),e.jsx("div",{className:"cedros-admin-history-th",children:"Amount"}),e.jsx("div",{className:"cedros-admin-history-th",children:"Processed"}),e.jsx("div",{className:"cedros-admin-history-th",children:"Transaction"})]}),u.map(k=>e.jsxs("div",{className:"cedros-admin-history-row",onClick:()=>n?.(k),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),n?.(k))},role:n?"button":void 0,tabIndex:n?0:void 0,children:[e.jsx("div",{className:"cedros-admin-history-td",title:k.userId,children:Ia(k.userId)}),e.jsx("div",{className:"cedros-admin-history-td",children:Ba(k.amountLamports)}),e.jsx("div",{className:"cedros-admin-history-td",children:k.completedAt?Fa(k.completedAt):"—"}),e.jsx("div",{className:"cedros-admin-history-td",children:k.withdrawalTxSignature?e.jsx("a",{href:`https://orbmarkets.io/tx/${k.withdrawalTxSignature}`,target:"_blank",rel:"noopener noreferrer",className:"cedros-admin-tx-link",onClick:b=>b.stopPropagation(),title:k.withdrawalTxSignature,children:Ua(k.withdrawalTxSignature)}):"—"})]},k.id))]}),x>1&&e.jsxs("div",{className:"cedros-admin-pagination",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>C(j-1),disabled:j<=1,children:"Previous"}),e.jsxs("span",{className:"cedros-admin-page-info",children:["Page ",j," of ",x," (",f," total)"]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>C(j+1),disabled:j>=x,children:"Next"})]})]})]})}function Wa({refreshInterval:s=0,className:t="",onLoad:r}){const{getPrivacyStatus:o,isLoading:n,error:a,clearError:c}=he(),[i,d]=l.useState(null),[u,p]=l.useState(null),f=l.useCallback(async()=>{try{const w=await o();d(w),r?.(w),p(null)}catch(w){p(w instanceof Error?w.message:"Failed to load status")}},[o,r]);if(l.useEffect(()=>{f()},[f]),l.useEffect(()=>{if(s<=0)return;const w=setInterval(f,s);return()=>clearInterval(w)},[s,f]),u||a)return e.jsxs("div",{className:`cedros-admin-status cedros-admin-status-error ${t}`,children:[e.jsx("p",{className:"cedros-admin-error",children:u||a}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{c(),p(null),f()},children:"Retry"})]});if(n&&!i)return e.jsxs("div",{className:`cedros-admin-status cedros-admin-status-loading ${t}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading system status..."})]});if(!i)return null;const h=i.partialWithdrawalCount>0;return e.jsxs("div",{className:`cedros-admin-status ${t}`,children:[e.jsxs("div",{className:"cedros-admin-status-header",children:[e.jsx("h4",{className:"cedros-admin-status-title",children:"System Configuration"}),e.jsxs("div",{className:"cedros-admin-status-actions",children:[e.jsx("span",{className:`cedros-admin-status-badge ${i.enabled?"cedros-admin-status-badge-enabled":"cedros-admin-status-badge-disabled"}`,children:i.enabled?"Enabled":"Disabled"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm cedros-admin-icon-button",onClick:f,disabled:n,title:"Refresh status","aria-label":"Refresh status",children:n?"...":"↻"})]})]}),e.jsxs("div",{className:"cedros-admin-status-grid",children:[e.jsxs("div",{className:"cedros-admin-status-section",children:[e.jsx("h5",{className:"cedros-admin-status-section-title",children:"Core Settings"}),e.jsxs("div",{className:"cedros-admin-status-item",children:[e.jsx("span",{className:"cedros-admin-status-label",children:"Privacy Period"}),e.jsx("span",{className:"cedros-admin-status-value",children:i.privacyPeriodDisplay})]}),e.jsxs("div",{className:"cedros-admin-status-item",children:[e.jsx("span",{className:"cedros-admin-status-label",children:"Min Deposit"}),e.jsxs("span",{className:"cedros-admin-status-value",children:[i.minDepositSol," SOL"]})]}),e.jsxs("div",{className:"cedros-admin-status-item",children:[e.jsx("span",{className:"cedros-admin-status-label",children:"Company Currency"}),e.jsx("span",{className:"cedros-admin-status-value",children:i.companyCurrency})]})]}),e.jsxs("div",{className:"cedros-admin-status-section",children:[e.jsxs("h5",{className:"cedros-admin-status-section-title",children:["Partial Withdrawals",e.jsx("span",{className:`cedros-admin-status-badge cedros-admin-status-badge-sm ${h?"cedros-admin-status-badge-enabled":"cedros-admin-status-badge-disabled"}`,children:h?"On":"Off"})]}),e.jsxs("div",{className:"cedros-admin-status-item",children:[e.jsx("span",{className:"cedros-admin-status-label",children:"Withdrawal %"}),e.jsxs("span",{className:"cedros-admin-status-value",children:[i.withdrawalPercentage,"%"]})]}),e.jsxs("div",{className:"cedros-admin-status-item",children:[e.jsx("span",{className:"cedros-admin-status-label",children:"Max per Batch"}),e.jsx("span",{className:"cedros-admin-status-value",children:i.partialWithdrawalCount===0?"N/A":i.partialWithdrawalCount})]}),e.jsxs("div",{className:"cedros-admin-status-item",children:[e.jsx("span",{className:"cedros-admin-status-label",children:"Min Amount"}),e.jsx("span",{className:"cedros-admin-status-value",children:i.partialWithdrawalCount===0?"N/A":`${i.partialWithdrawalMinSol} SOL`})]})]}),e.jsxs("div",{className:"cedros-admin-status-section",children:[e.jsx("h5",{className:"cedros-admin-status-section-title",children:"Worker Settings"}),e.jsxs("div",{className:"cedros-admin-status-item",children:[e.jsx("span",{className:"cedros-admin-status-label",children:"Poll Interval"}),e.jsxs("span",{className:"cedros-admin-status-value",children:[i.withdrawalPollIntervalSecs,"s"]})]}),e.jsxs("div",{className:"cedros-admin-status-item",children:[e.jsx("span",{className:"cedros-admin-status-label",children:"Batch Size"}),e.jsx("span",{className:"cedros-admin-status-value",children:i.withdrawalBatchSize})]}),e.jsxs("div",{className:"cedros-admin-status-item",children:[e.jsx("span",{className:"cedros-admin-status-label",children:"Sidecar Status"}),e.jsx("span",{className:`cedros-admin-status-value ${i.sidecarStatus==="connected"?"cedros-admin-status-connected":"cedros-admin-status-disconnected"}`,children:i.sidecarStatus})]})]})]}),i.companyWallet&&e.jsxs("div",{className:"cedros-admin-status-footer",children:[e.jsx("span",{className:"cedros-admin-status-label",children:"Company Wallet"}),e.jsxs("code",{className:"cedros-admin-status-wallet",title:i.companyWallet,children:[i.companyWallet.slice(0,8),"...",i.companyWallet.slice(-6)]})]})]})}class Oa{client;constructor(t,r,o,n){this.client=new A.ApiClient({baseUrl:t,timeoutMs:r,retryAttempts:o,getAccessToken:n})}async listUsers(t){try{const r=new URLSearchParams;t?.limit&&r.set("limit",String(t.limit)),t?.offset&&r.set("offset",String(t.offset));const o=r.toString(),n=`/admin/users${o?`?${o}`:""}`;return await this.client.get(n)}catch(r){throw A.handleApiError(r,"Failed to list users")}}async getUser(t){try{return await this.client.get(`/admin/users/${t}`)}catch(r){throw A.handleApiError(r,"Failed to get user")}}async setSystemAdmin(t,r){try{await this.client.patch(`/admin/users/${t}/system-admin`,{isAdmin:r})}catch(o){throw A.handleApiError(o,"Failed to update system admin status")}}async updateUser(t,r){try{return await this.client.patch(`/admin/users/${t}`,r)}catch(o){throw A.handleApiError(o,"Failed to update user")}}async deleteUser(t){try{await this.client.delete(`/admin/users/${t}`)}catch(r){throw A.handleApiError(r,"Failed to delete user")}}async forcePasswordReset(t){try{await this.client.post(`/admin/users/${t}/force-password-reset`,{})}catch(r){throw A.handleApiError(r,"Failed to send password reset email")}}async adjustCredits(t,r){try{await this.client.post(`/admin/users/${t}/credits`,r)}catch(o){throw A.handleApiError(o,"Failed to adjust credits")}}async getUserDeposits(t,r){try{const o=new URLSearchParams;r?.limit&&o.set("limit",String(r.limit)),r?.offset&&o.set("offset",String(r.offset));const n=o.toString(),a=`/admin/users/${t}/deposits${n?`?${n}`:""}`;return await this.client.get(a)}catch(o){throw A.handleApiError(o,"Failed to get user deposits")}}async getUserCredits(t,r){try{const o=new URLSearchParams;r?.limit&&o.set("limit",String(r.limit)),r?.offset&&o.set("offset",String(r.offset));const n=o.toString(),a=`/admin/users/${t}/credits${n?`?${n}`:""}`;return await this.client.get(a)}catch(o){throw A.handleApiError(o,"Failed to get user credits")}}async getUserWithdrawalHistory(t,r){try{const o=new URLSearchParams;r?.limit&&o.set("limit",String(r.limit)),r?.offset&&o.set("offset",String(r.offset));const n=o.toString(),a=`/admin/users/${t}/withdrawal-history${n?`?${n}`:""}`;return await this.client.get(a)}catch(o){throw A.handleApiError(o,"Failed to get user withdrawal history")}}}function Ts(){const{config:s,_internal:t}=A.useCedrosLogin(),[r,o]=l.useState([]),[n,a]=l.useState(0),[c,i]=l.useState(!1),[d,u]=l.useState(null),[p,f]=l.useState({}),h=l.useMemo(()=>new Oa(s.serverUrl,s.requestTimeout,s.retryAttempts,t?.getAccessToken),[s.serverUrl,s.requestTimeout,s.retryAttempts,t]),w=l.useCallback(async N=>{i(!0),u(null),f(N||{});try{const L=await h.listUsers(N);return o(L.users),a(L.total),L}catch(L){const E=L instanceof Error?L:new Error("Failed to list users");throw u(E),E}finally{i(!1)}},[h]),m=l.useCallback(async N=>{i(!0),u(null);try{return await h.getUser(N)}catch(L){const E=L instanceof Error?L:new Error("Failed to get user");throw u(E),E}finally{i(!1)}},[h]),g=l.useCallback(async(N,L)=>{i(!0),u(null);try{await h.setSystemAdmin(N,L),o(E=>E.map(P=>P.id===N?{...P,isSystemAdmin:L}:P))}catch(E){const P=E instanceof Error?E:new Error("Failed to update admin status");throw u(P),P}finally{i(!1)}},[h]),y=l.useCallback(async(N,L)=>{i(!0),u(null);try{const E=await h.updateUser(N,L);return o(P=>P.map(M=>M.id===N?E:M)),E}catch(E){const P=E instanceof Error?E:new Error("Failed to update user");throw u(P),P}finally{i(!1)}},[h]),v=l.useCallback(async N=>{i(!0),u(null);try{await h.deleteUser(N),o(L=>L.filter(E=>E.id!==N)),a(L=>L-1)}catch(L){const E=L instanceof Error?L:new Error("Failed to delete user");throw u(E),E}finally{i(!1)}},[h]),x=l.useCallback(async N=>{i(!0),u(null);try{await h.forcePasswordReset(N)}catch(L){const E=L instanceof Error?L:new Error("Failed to send password reset");throw u(E),E}finally{i(!1)}},[h]),j=l.useCallback(async(N,L,E)=>{i(!0),u(null);try{await h.adjustCredits(N,{amount:L,reason:E})}catch(P){const M=P instanceof Error?P:new Error("Failed to adjust credits");throw u(M),M}finally{i(!1)}},[h]),C=l.useCallback(async(N,L)=>{i(!0),u(null);try{return await h.getUserDeposits(N,L)}catch(E){const P=E instanceof Error?E:new Error("Failed to get user deposits");throw u(P),P}finally{i(!1)}},[h]),k=l.useCallback(async(N,L)=>{i(!0),u(null);try{return await h.getUserCredits(N,L)}catch(E){const P=E instanceof Error?E:new Error("Failed to get user credits");throw u(P),P}finally{i(!1)}},[h]),b=l.useCallback(async(N,L)=>{i(!0),u(null);try{return await h.getUserWithdrawalHistory(N,L)}catch(E){const P=E instanceof Error?E:new Error("Failed to get user withdrawal history");throw u(P),P}finally{i(!1)}},[h]),S=l.useCallback(async()=>{await w(p)},[w,p]),T=l.useCallback(()=>{u(null)},[]);return{users:r,total:n,isLoading:c,error:d,listUsers:w,getUser:m,setSystemAdmin:g,updateUser:y,deleteUser:v,forcePasswordReset:x,adjustCredits:j,getUserDeposits:C,getUserCredits:k,getUserWithdrawalHistory:b,refresh:S,clearError:T}}function qa(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function _a(s){return s.length<=12?s:`${s.slice(0,6)}...${s.slice(-4)}`}function yr({pageSize:s=20,refreshInterval:t=0,currentUserId:r,className:o="",onLoad:n,onUserClick:a,onEditUser:c,onAdjustCredits:i}){const{users:d,total:u,isLoading:p,error:f,listUsers:h,setSystemAdmin:w,deleteUser:m,forcePasswordReset:g,clearError:y}=Ts(),[v,x]=l.useState(0),[j,C]=l.useState(null),[k,b]=l.useState(null),[S,T]=l.useState(null),N=l.useCallback(async()=>{try{const D=await h({limit:s,offset:v});n?.(D),C(null)}catch(D){C(D instanceof Error?D.message:"Failed to load users")}},[s,v,h,n]);l.useEffect(()=>{x(0)},[s]),l.useEffect(()=>{N()},[N]),l.useEffect(()=>{if(t<=0)return;const D=setInterval(N,t);return()=>clearInterval(D)},[t,N]);const L=Math.ceil(u/s),E=Math.floor(v/s)+1,P=D=>{const H=(D-1)*s;x(Math.max(0,Math.min(H,Math.max(0,u-1))))},M=async D=>{if(D.id===r){alert("You cannot change your own admin status");return}const H=D.isSystemAdmin?"remove admin privileges from":"grant admin privileges to";if(window.confirm(`Are you sure you want to ${H} ${D.name||D.email||"this user"}?`)){b(D.id);try{await w(D.id,!D.isSystemAdmin)}catch{}finally{b(null)}}},B=async D=>{if(D.id===r){alert("You cannot delete your own account");return}if(D.isSystemAdmin){alert("Cannot delete a system admin. Remove admin status first.");return}if(window.confirm(`Are you sure you want to delete ${D.name||D.email||"this user"}? This action cannot be undone.`)){T(D.id);try{await m(D.id)}catch{}finally{T(null)}}},I=async D=>{if(!D.email){alert("User has no email address");return}if(window.confirm(`Send a password reset email to ${D.email}?`)){T(D.id);try{await g(D.id),alert("Password reset email sent")}catch{}finally{T(null)}}};return j||f?e.jsxs("div",{className:`cedros-admin-user-list cedros-admin-user-list-error ${o}`,children:[e.jsx("p",{className:"cedros-admin-error",children:j||f?.message}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{y(),C(null),N()},children:"Retry"})]}):p&&d.length===0?e.jsxs("div",{className:`cedros-admin-user-list cedros-admin-user-list-loading ${o}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading users..."})]}):e.jsxs("div",{className:`cedros-admin-user-list ${o}`,children:[e.jsxs("div",{className:"cedros-admin-user-list-header",children:[e.jsx("h4",{className:"cedros-admin-user-list-title",children:"All Users"}),e.jsxs("div",{className:"cedros-admin-user-list-actions",children:[e.jsxs("span",{className:"cedros-admin-queue-count",children:[u," user",u!==1?"s":""]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm cedros-admin-icon-button",onClick:N,disabled:p,title:"Refresh list","aria-label":"Refresh list",children:p?"...":"↻"})]})]}),d.length===0?e.jsx("div",{className:"cedros-admin-empty",children:e.jsx("p",{className:"cedros-admin-empty-message",children:"No users found."})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin-user-table",children:[e.jsxs("div",{className:"cedros-admin-user-thead",children:[e.jsx("div",{className:"cedros-admin-user-th",children:"User"}),e.jsx("div",{className:"cedros-admin-user-th",children:"Auth Methods"}),e.jsx("div",{className:"cedros-admin-user-th",children:"Registered"}),e.jsx("div",{className:"cedros-admin-user-th cedros-admin-user-th-admin",children:"Admin"}),e.jsx("div",{className:"cedros-admin-user-th cedros-admin-user-th-actions",children:"Actions"})]}),d.map(D=>{const H=D.id===r,z=k===D.id;return e.jsxs("div",{className:`cedros-admin-user-row ${H?"cedros-admin-user-row-current":""}`,onClick:()=>a?.(D),onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),a?.(D))},role:a?"button":void 0,tabIndex:a?0:void 0,children:[e.jsxs("div",{className:"cedros-admin-user-td cedros-admin-user-info",children:[e.jsx("div",{className:"cedros-admin-user-avatar",children:D.picture?e.jsx("img",{src:D.picture,alt:D.name||D.email||"User",className:"cedros-admin-user-avatar-img",referrerPolicy:"no-referrer"}):e.jsx("span",{className:"cedros-admin-user-avatar-placeholder",children:(D.name?.[0]||D.email?.[0]||"?").toUpperCase()})}),e.jsxs("div",{className:"cedros-admin-user-details",children:[e.jsxs("span",{className:"cedros-admin-user-name",children:[D.name||"Unknown",H&&e.jsx("span",{className:"cedros-admin-user-you",children:"(you)"})]}),e.jsx("span",{className:"cedros-admin-user-email",title:D.email,children:D.email||_a(D.id)})]})]}),e.jsx("div",{className:"cedros-admin-user-td cedros-admin-user-methods",children:D.authMethods.length>0?D.authMethods.map(R=>e.jsx("span",{className:`cedros-admin-auth-badge cedros-admin-auth-badge-${R}`,children:R},R)):e.jsx("span",{className:"cedros-admin-auth-badge cedros-admin-auth-badge-none",children:"none"})}),e.jsx("div",{className:"cedros-admin-user-td",children:qa(D.createdAt)}),e.jsx("div",{className:"cedros-admin-user-td cedros-admin-user-td-admin",children:e.jsx("button",{type:"button",className:`cedros-admin-toggle ${D.isSystemAdmin?"cedros-admin-toggle-on":"cedros-admin-toggle-off"}`,onClick:R=>{R.stopPropagation(),M(D)},disabled:z||H,title:H?"Cannot change your own status":D.isSystemAdmin?"Revoke admin":"Grant admin","aria-label":D.isSystemAdmin?"Revoke admin":"Grant admin",children:z?"...":D.isSystemAdmin?"Yes":"No"})}),e.jsx("div",{className:"cedros-admin-user-td cedros-admin-user-td-actions",children:S===D.id?e.jsx("span",{className:"cedros-admin-action-loading",children:"..."}):e.jsxs("div",{className:"cedros-admin-action-buttons",children:[c&&e.jsx("button",{type:"button",className:"cedros-admin-action-btn",onClick:R=>{R.stopPropagation(),c(D)},title:"Edit user","aria-label":"Edit user",children:"Edit"}),D.email&&e.jsx("button",{type:"button",className:"cedros-admin-action-btn",onClick:R=>{R.stopPropagation(),I(D)},title:"Send password reset","aria-label":"Send password reset",children:"Reset"}),i&&e.jsx("button",{type:"button",className:"cedros-admin-action-btn",onClick:R=>{R.stopPropagation(),i(D)},title:"Adjust credits","aria-label":"Adjust credits",children:"Credits"}),!H&&!D.isSystemAdmin&&e.jsx("button",{type:"button",className:"cedros-admin-action-btn cedros-admin-action-btn-danger",onClick:R=>{R.stopPropagation(),B(D)},title:"Delete user","aria-label":"Delete user",children:"Delete"})]})})]},D.id)})]}),L>1&&e.jsxs("div",{className:"cedros-admin-pagination",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>P(E-1),disabled:E<=1,children:"Previous"}),e.jsxs("span",{className:"cedros-admin-page-info",children:["Page ",E," of ",L," (",u," total)"]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>P(E+1),disabled:E>=L,children:"Next"})]})]})]})}function Xs(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function br(s){return new Date(s).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Ne(s){return s==null?"—":`${(s/1e9).toFixed(4)} SOL`}function $a({userId:s,onBack:t,currentUserId:r,onEditUser:o,onAdjustCredits:n,className:a=""}){const{isLoading:c,getUser:i,getUserDeposits:d,getUserCredits:u,setSystemAdmin:p,deleteUser:f,forcePasswordReset:h,clearError:w}=Ts(),[m,g]=l.useState(null),[y,v]=l.useState(null),[x,j]=l.useState(null),[C,k]=l.useState("deposits"),[b,S]=l.useState(null),[T,N]=l.useState(null),[L,E]=l.useState(null),[P,M]=l.useState(!1),[B,I]=l.useState(0),[D,H]=l.useState(0),z=10,R=l.useCallback(async()=>{try{const Q=await i(s);g(Q),S(null)}catch(Q){S(Q instanceof Error?Q.message:"Failed to load user")}},[s,i]),U=l.useCallback(async()=>{try{const de=await d(s,{limit:z,offset:B});j(de),E(null)}catch(Q){E(Q instanceof Error?Q.message:"Failed to load deposits")}},[s,d,B]),F=l.useCallback(async()=>{try{const de=await u(s,{limit:z,offset:D});v(de),N(null)}catch(Q){N(Q instanceof Error?Q.message:"Failed to load credits")}},[s,u,D]);l.useEffect(()=>{R(),U(),F()},[R,U,F]);const $=async()=>{if(!m)return;if(m.id===r){alert("You cannot change your own admin status");return}const Q=m.isSystemAdmin?"remove admin privileges from":"grant admin privileges to";if(window.confirm(`Are you sure you want to ${Q} ${m.name||m.email||"this user"}?`)){M(!0);try{await p(m.id,!m.isSystemAdmin),await R()}catch{}finally{M(!1)}}},ae=async()=>{if(!m)return;if(m.id===r){alert("You cannot delete your own account");return}if(m.isSystemAdmin){alert("Cannot delete a system admin. Remove admin status first.");return}if(window.confirm(`Are you sure you want to delete ${m.name||m.email||"this user"}? This action cannot be undone.`)){M(!0);try{await f(m.id),t()}catch{}finally{M(!1)}}},X=async()=>{if(!m?.email){alert("User has no email address");return}if(window.confirm(`Send a password reset email to ${m.email}?`)){M(!0);try{await h(m.id),alert("Password reset email sent")}catch{}finally{M(!1)}}},oe=x?Math.ceil(x.total/z):0,se=Math.floor(B/z)+1,_=y?Math.ceil(y.totalTransactions/z):0,q=Math.floor(D/z)+1,Y=Q=>{I((Q-1)*z)},Z=Q=>{H((Q-1)*z)};if(b)return e.jsxs("div",{className:`cedros-admin-user-detail cedros-admin-user-detail-error ${a}`,children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:t,children:"Back"}),e.jsx("p",{className:"cedros-admin-error",children:b}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline",onClick:()=>{w(),S(null),R()},children:"Retry"})]});if(c&&!m)return e.jsxs("div",{className:`cedros-admin-user-detail cedros-admin-user-detail-loading ${a}`,children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{className:"cedros-admin-loading-text",children:"Loading user..."})]});if(!m)return e.jsxs("div",{className:`cedros-admin-user-detail ${a}`,children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:t,children:"Back"}),e.jsx("p",{className:"cedros-admin-empty-message",children:"User not found."})]});const ne=m.id===r;return e.jsxs("div",{className:`cedros-admin-user-detail ${a}`,children:[e.jsxs("div",{className:"cedros-admin-user-detail-header",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm cedros-admin-back-btn",onClick:t,children:"Back to Users"}),e.jsxs("div",{className:"cedros-admin-user-detail-actions",children:[o&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>o(m),disabled:P,children:"Edit"}),m.email&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:X,disabled:P,children:"Reset Password"}),n&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>n(m),disabled:P,children:"Adjust Credits"}),!ne&&!m.isSystemAdmin&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm cedros-admin-btn-danger",onClick:ae,disabled:P,children:"Delete"})]})]}),e.jsxs("div",{className:"cedros-admin-user-detail-info",children:[e.jsx("div",{className:"cedros-admin-user-detail-avatar",children:m.picture?e.jsx("img",{src:m.picture,alt:m.name||m.email||"User",className:"cedros-admin-user-detail-avatar-img",referrerPolicy:"no-referrer"}):e.jsx("span",{className:"cedros-admin-user-detail-avatar-placeholder",children:(m.name?.[0]||m.email?.[0]||"?").toUpperCase()})}),e.jsxs("div",{className:"cedros-admin-user-detail-meta",children:[e.jsxs("h2",{className:"cedros-admin-user-detail-name",children:[m.name||"Unknown",ne&&e.jsx("span",{className:"cedros-admin-user-you",children:"(you)"})]}),e.jsxs("p",{className:"cedros-admin-user-detail-email",children:[m.email||"No email",m.emailVerified&&e.jsx("span",{className:"cedros-admin-verified-badge",title:"Email verified",children:"Verified"})]}),e.jsxs("div",{className:"cedros-admin-user-detail-badges",children:[e.jsx("span",{className:`cedros-admin-admin-badge ${m.isSystemAdmin?"cedros-admin-admin-badge-yes":"cedros-admin-admin-badge-no"}`,children:m.isSystemAdmin?"System Admin":"User"}),!ne&&e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-xs",onClick:$,disabled:P,children:m.isSystemAdmin?"Revoke Admin":"Grant Admin"})]}),e.jsxs("div",{className:"cedros-admin-user-detail-methods",children:[e.jsx("span",{className:"cedros-admin-user-detail-methods-label",children:"Auth Methods:"}),m.authMethods.length>0?m.authMethods.map(Q=>e.jsx("span",{className:`cedros-admin-auth-badge cedros-admin-auth-badge-${Q}`,children:Q},Q)):e.jsx("span",{className:"cedros-admin-auth-badge cedros-admin-auth-badge-none",children:"none"})]}),e.jsxs("p",{className:"cedros-admin-user-detail-dates",children:["Registered: ",Xs(m.createdAt)," | Updated: ",Xs(m.updatedAt)]})]})]}),T?e.jsxs("div",{className:"cedros-admin-stats-error",children:[e.jsx("p",{className:"cedros-admin-error-inline",children:T}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>{N(null),F()},children:"Retry"})]}):y?e.jsxs("div",{className:"cedros-admin-user-detail-stats",children:[e.jsxs("div",{className:"cedros-admin-stat-card",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Current Balance"}),e.jsx("span",{className:"cedros-admin-stat-value",children:Ne(y.stats.currentBalanceLamports)})]}),e.jsxs("div",{className:"cedros-admin-stat-card",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Total Deposited"}),e.jsx("span",{className:"cedros-admin-stat-value",children:Ne(y.stats.totalDepositedLamports)})]}),e.jsxs("div",{className:"cedros-admin-stat-card",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Total Spent"}),e.jsx("span",{className:"cedros-admin-stat-value",children:Ne(y.stats.totalSpentLamports)})]}),e.jsxs("div",{className:"cedros-admin-stat-card",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Deposits"}),e.jsx("span",{className:"cedros-admin-stat-value",children:y.stats.depositCount})]}),e.jsxs("div",{className:"cedros-admin-stat-card",children:[e.jsx("span",{className:"cedros-admin-stat-label",children:"Transactions"}),e.jsx("span",{className:"cedros-admin-stat-value",children:y.stats.spendCount})]})]}):e.jsxs("div",{className:"cedros-admin-stats-loading",children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{children:"Loading credit stats..."})]}),e.jsxs("div",{className:"cedros-admin-user-detail-tabs",children:[e.jsxs("button",{type:"button",className:`cedros-admin-tab ${C==="deposits"?"cedros-admin-tab-active":""}`,onClick:()=>k("deposits"),children:["Deposits (",x?.total??0,")"]}),e.jsxs("button",{type:"button",className:`cedros-admin-tab ${C==="transactions"?"cedros-admin-tab-active":""}`,onClick:()=>k("transactions"),children:["Transactions (",y?.totalTransactions??0,")"]})]}),e.jsxs("div",{className:"cedros-admin-user-detail-content",children:[C==="deposits"&&e.jsx(za,{deposits:x?.deposits??[],total:x?.total??0,currentPage:se,totalPages:oe,onPageChange:Y,isLoading:c,error:L,onRetry:()=>{E(null),U()}}),C==="transactions"&&e.jsx(Va,{transactions:y?.transactions??[],total:y?.totalTransactions??0,currentPage:q,totalPages:_,onPageChange:Z,error:T,onRetry:()=>{N(null),F()},isLoading:c})]})]})}function za({deposits:s,total:t,currentPage:r,totalPages:o,onPageChange:n,isLoading:a,error:c,onRetry:i}){return c?e.jsxs("div",{className:"cedros-admin-tab-error",children:[e.jsx("p",{className:"cedros-admin-error-inline",children:c}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:i,children:"Retry"})]}):a&&s.length===0?e.jsxs("div",{className:"cedros-admin-tab-loading",children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{children:"Loading deposits..."})]}):t===0?e.jsx("div",{className:"cedros-admin-empty-message",children:"No deposits found."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin-list-table",children:[e.jsxs("div",{className:"cedros-admin-list-thead",children:[e.jsx("div",{className:"cedros-admin-list-th",children:"Amount"}),e.jsx("div",{className:"cedros-admin-list-th",children:"Status"}),e.jsx("div",{className:"cedros-admin-list-th",children:"Date"}),e.jsx("div",{className:"cedros-admin-list-th",children:"Address"})]}),s.map(d=>e.jsxs("div",{className:"cedros-admin-list-row",children:[e.jsx("div",{className:"cedros-admin-list-td",children:Ne(d.amountLamports)}),e.jsx("div",{className:"cedros-admin-list-td",children:e.jsx("span",{className:`cedros-admin-status-badge cedros-admin-status-${d.status}`,children:d.status})}),e.jsx("div",{className:"cedros-admin-list-td",children:br(d.createdAt)}),e.jsxs("div",{className:"cedros-admin-list-td cedros-admin-list-td-mono",title:d.walletAddress,children:[d.walletAddress.slice(0,8),"...",d.walletAddress.slice(-4)]})]},d.id))]}),o>1&&e.jsx(xr,{currentPage:r,totalPages:o,total:t,onPageChange:n})]})}function Va({transactions:s,total:t,currentPage:r,totalPages:o,onPageChange:n,isLoading:a,error:c,onRetry:i}){return c?e.jsxs("div",{className:"cedros-admin-tab-error",children:[e.jsx("p",{className:"cedros-admin-error-inline",children:c}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:i,children:"Retry"})]}):a&&s.length===0?e.jsxs("div",{className:"cedros-admin-tab-loading",children:[e.jsx("span",{className:"cedros-admin-loading-indicator"}),e.jsx("span",{children:"Loading transactions..."})]}):t===0?e.jsx("div",{className:"cedros-admin-empty-message",children:"No transactions found."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin-list-table",children:[e.jsxs("div",{className:"cedros-admin-list-thead",children:[e.jsx("div",{className:"cedros-admin-list-th",children:"Amount"}),e.jsx("div",{className:"cedros-admin-list-th",children:"Type"}),e.jsx("div",{className:"cedros-admin-list-th",children:"Reference"}),e.jsx("div",{className:"cedros-admin-list-th",children:"Date"})]}),s.map(d=>e.jsxs("div",{className:"cedros-admin-list-row",children:[e.jsxs("div",{className:`cedros-admin-list-td ${d.amountLamports>=0?"cedros-admin-amount-positive":"cedros-admin-amount-negative"}`,children:[d.amountLamports>=0?"+":"",Ne(d.amountLamports)]}),e.jsx("div",{className:"cedros-admin-list-td",children:e.jsx("span",{className:`cedros-admin-tx-type cedros-admin-tx-type-${d.txType.toLowerCase()}`,children:d.txType})}),e.jsx("div",{className:"cedros-admin-list-td",children:d.referenceType||"—"}),e.jsx("div",{className:"cedros-admin-list-td",children:br(d.createdAt)})]},d.id))]}),o>1&&e.jsx(xr,{currentPage:r,totalPages:o,total:t,onPageChange:n})]})}function xr({currentPage:s,totalPages:t,total:r,onPageChange:o}){return e.jsxs("div",{className:"cedros-admin-pagination",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>o(s-1),disabled:s<=1,children:"Previous"}),e.jsxs("span",{className:"cedros-admin-page-info",children:["Page ",s," of ",t," (",r," total)"]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-sm",onClick:()=>o(s+1),disabled:s>=t,children:"Next"})]})}const le={overview:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"9",rx:"1"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"5",rx:"1"}),e.jsx("rect",{x:"14",y:"12",width:"7",height:"9",rx:"1"}),e.jsx("rect",{x:"3",y:"16",width:"7",height:"5",rx:"1"})]}),users:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),members:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),invites:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),deposits:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"}),e.jsx("path",{d:"M12 18V6"})]}),withdrawals:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 5v14"}),e.jsx("path",{d:"m19 12-7 7-7-7"})]}),settings:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),wallet:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),e.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]}),chevronRight:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})},Qa=[{id:"overview",label:"Overview",icon:le.overview},{id:"users",label:"Users",icon:le.users},{id:"members",label:"Team",icon:le.members},{id:"invites",label:"Invites",icon:le.invites},{id:"deposits",label:"Deposits",icon:le.deposits},{id:"withdrawals",label:"Withdrawals",icon:le.withdrawals},{id:"settings",label:"Settings",icon:le.settings}];function Ha({title:s="Dashboard",sections:t=["overview","users","members","invites","deposits","withdrawals","settings"],defaultSection:r="overview",refreshInterval:o=0,pageSize:n=20,onSectionChange:a,className:c=""}){const[i,d]=l.useState(r),{user:u}=A.useCedrosLogin(),{activeOrg:p,role:f,isLoading:h,fetchOrgs:w,hasPermission:m}=ur();l.useEffect(()=>{w()},[w]);const g=l.useCallback(j=>{d(j),a?.(j)},[a]),y=Qa.filter(j=>t.includes(j.id));if(h&&!p)return e.jsxs("div",{className:`cedros-dashboard cedros-dashboard--loading ${c}`,children:[e.jsx(A.LoadingSpinner,{}),e.jsx("span",{className:"cedros-dashboard__loading-text",children:"Loading..."})]});if(["members","invites"].includes(i)&&!p)return e.jsx("div",{className:`cedros-dashboard ${c}`,children:e.jsx(A.ErrorMessage,{error:"No organization selected. Please select an organization first."})});const x=y.find(j=>j.id===i);return e.jsxs("div",{className:`cedros-dashboard ${c}`,children:[e.jsxs("aside",{className:"cedros-dashboard__sidebar",children:[e.jsx("div",{className:"cedros-dashboard__sidebar-header",children:e.jsxs("div",{className:"cedros-dashboard__logo",children:[le.wallet,e.jsx("span",{className:"cedros-dashboard__logo-text",children:s})]})}),e.jsx("nav",{className:"cedros-dashboard__nav",children:e.jsxs("div",{className:"cedros-dashboard__nav-group",children:[e.jsx("span",{className:"cedros-dashboard__nav-label",children:"Menu"}),y.map(j=>e.jsxs("button",{type:"button",className:`cedros-dashboard__nav-item ${i===j.id?"cedros-dashboard__nav-item--active":""}`,onClick:()=>g(j.id),"aria-current":i===j.id?"page":void 0,children:[e.jsx("span",{className:"cedros-dashboard__nav-icon",children:j.icon}),e.jsx("span",{className:"cedros-dashboard__nav-text",children:j.label})]},j.id))]})}),p&&e.jsx("div",{className:"cedros-dashboard__sidebar-footer",children:e.jsxs("div",{className:"cedros-dashboard__org",children:[e.jsx("div",{className:"cedros-dashboard__org-avatar",children:p.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"cedros-dashboard__org-info",children:[e.jsx("span",{className:"cedros-dashboard__org-name",children:p.name}),f&&e.jsx("span",{className:"cedros-dashboard__org-role",children:f})]})]})})]}),e.jsxs("main",{className:"cedros-dashboard__main",children:[e.jsx("header",{className:"cedros-dashboard__header",children:e.jsxs("div",{className:"cedros-dashboard__breadcrumb",children:[e.jsx("span",{className:"cedros-dashboard__breadcrumb-root",children:s}),e.jsx("span",{className:"cedros-dashboard__breadcrumb-sep",children:le.chevronRight}),e.jsx("span",{className:"cedros-dashboard__breadcrumb-current",children:x?.label})]})}),e.jsxs("div",{className:"cedros-dashboard__content",children:[i==="overview"&&e.jsx(Ka,{refreshInterval:o}),i==="users"&&e.jsx(Ya,{pageSize:n,currentUserId:u?.id}),i==="members"&&p&&e.jsx(Ga,{orgId:p.id,currentUserId:u?.id,hasPermission:m}),i==="invites"&&p&&e.jsx(Ja,{orgId:p.id,hasPermission:m}),i==="deposits"&&e.jsx(Xa,{pageSize:n,refreshInterval:o}),i==="withdrawals"&&e.jsx(Za,{pageSize:n,refreshInterval:o}),i==="settings"&&e.jsx(eo,{})]})]})]})}function Ka({refreshInterval:s}){const{getBalance:t,isLoading:r}=ze(),[o,n]=l.useState(null);return l.useEffect(()=>{t().then(a=>n(a.display)).catch(()=>n(null))},[t]),e.jsxs("div",{className:"cedros-dashboard__overview",children:[e.jsx("div",{className:"cedros-dashboard__cards",children:e.jsxs("div",{className:"cedros-dashboard__card",children:[e.jsxs("div",{className:"cedros-dashboard__card-header",children:[e.jsx("span",{className:"cedros-dashboard__card-title",children:"Credit Balance"}),e.jsx("span",{className:"cedros-dashboard__card-icon",children:le.wallet})]}),e.jsx("div",{className:"cedros-dashboard__card-value",children:r?"...":o??"—"}),e.jsx("p",{className:"cedros-dashboard__card-desc",children:"Available credits for services"})]})}),e.jsx(Wa,{refreshInterval:s}),e.jsx(Ls,{refreshInterval:s})]})}function Ya({pageSize:s,currentUserId:t}){const[r,o]=l.useState(null);return r?e.jsx("div",{className:"cedros-dashboard__section",children:e.jsx($a,{userId:r.id,currentUserId:t,onBack:()=>o(null)})}):e.jsxs("div",{className:"cedros-dashboard__section",children:[e.jsx("p",{className:"cedros-dashboard__text-muted",children:"All registered users in the system. Requires system admin privileges."}),e.jsx(yr,{pageSize:s,currentUserId:t,onUserClick:n=>o(n)})]})}function Ga({orgId:s,currentUserId:t,hasPermission:r}){const{members:o,isLoading:n,error:a,fetchMembers:c,updateMemberRole:i,removeMember:d}=hr(s);return l.useEffect(()=>{c()},[c]),e.jsx("div",{className:"cedros-dashboard__section",children:e.jsx(zt,{members:o,currentUserId:t,isLoading:n,error:a?.message,canManage:r("member:remove"),canChangeRoles:r("member:role_change"),onUpdateRole:i,onRemove:d})})}function Ja({orgId:s,hasPermission:t}){const{invites:r,isLoading:o,error:n,fetchInvites:a,createInvite:c,cancelInvite:i,resendInvite:d}=mr(s);l.useEffect(()=>{a()},[a]);const u=t("invite:create"),p=t("invite:cancel");return e.jsxs("div",{className:"cedros-dashboard__invites",children:[u&&e.jsxs("div",{className:"cedros-dashboard__section",children:[e.jsx("div",{className:"cedros-dashboard__section-header",children:e.jsx("h3",{className:"cedros-dashboard__section-title",children:"Send Invitation"})}),e.jsx(Vt,{onSubmit:c,isLoading:o,error:n?.message})]}),e.jsxs("div",{className:"cedros-dashboard__section",children:[e.jsx("div",{className:"cedros-dashboard__section-header",children:e.jsx("h3",{className:"cedros-dashboard__section-title",children:"Pending Invitations"})}),e.jsx(Qt,{invites:r,isLoading:o,error:n?.message,canManage:p||u,onCancel:p?i:void 0,onResend:u?d:void 0})]})]})}function Xa({pageSize:s,refreshInterval:t}){const[r,o]=l.useState("");return e.jsxs("div",{className:"cedros-dashboard__deposits",children:[e.jsx(Ls,{refreshInterval:t}),e.jsxs("div",{className:"cedros-dashboard__deposits-list",children:[e.jsx("div",{className:"cedros-dashboard__toolbar",children:e.jsxs("div",{className:"cedros-dashboard__filter",children:[e.jsx("label",{className:"cedros-dashboard__filter-label",htmlFor:"status-filter",children:"Status"}),e.jsxs("select",{id:"status-filter",className:"cedros-dashboard__select",value:r,onChange:n=>o(n.target.value),children:[e.jsx("option",{value:"",children:"All statuses"}),e.jsx("option",{value:"pending",children:"Pending"}),e.jsx("option",{value:"detected",children:"Detected"}),e.jsx("option",{value:"processing",children:"Processing"}),e.jsx("option",{value:"completed",children:"Completed"}),e.jsx("option",{value:"withdrawn",children:"Withdrawn"}),e.jsx("option",{value:"expired",children:"Expired"}),e.jsx("option",{value:"failed",children:"Failed"})]})]})}),e.jsx(pr,{statusFilter:r||void 0,pageSize:s,refreshInterval:t})]})]})}function Za({pageSize:s,refreshInterval:t}){return e.jsxs("div",{className:"cedros-dashboard__withdrawals",children:[e.jsx("p",{className:"cedros-dashboard__text-muted",children:"Track deposits through the withdrawal pipeline: privacy period, ready for processing, and completed."}),e.jsxs("div",{className:"cedros-dashboard__pipeline",children:[e.jsx(gr,{pageSize:s,refreshInterval:t}),e.jsx(fr,{pageSize:s,refreshInterval:t}),e.jsx(wr,{pageSize:s,refreshInterval:t})]})]})}function eo(){return e.jsxs("div",{className:"cedros-dashboard__section",children:[e.jsx("p",{className:"cedros-dashboard__text-muted",children:"Configure system-wide settings. Changes take effect immediately."}),e.jsx(lr,{showDescriptions:!0})]})}var ge={},Ze,Zs;function so(){return Zs||(Zs=1,Ze=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Ze}var es={},ue={},et;function me(){if(et)return ue;et=1;let s;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return ue.getSymbolSize=function(o){if(!o)throw new Error('"version" cannot be null or undefined');if(o<1||o>40)throw new Error('"version" should be in range from 1 to 40');return o*4+17},ue.getSymbolTotalCodewords=function(o){return t[o]},ue.getBCHDigit=function(r){let o=0;for(;r!==0;)o++,r>>>=1;return o},ue.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');s=o},ue.isKanjiModeEnabled=function(){return typeof s<"u"},ue.toSJIS=function(o){return s(o)},ue}var ss={},st;function Ms(){return st||(st=1,(function(s){s.L={bit:1},s.M={bit:0},s.Q={bit:3},s.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return s.L;case"m":case"medium":return s.M;case"q":case"quartile":return s.Q;case"h":case"high":return s.H;default:throw new Error("Unknown EC Level: "+r)}}s.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},s.from=function(o,n){if(s.isValid(o))return o;try{return t(o)}catch{return n}}})(ss)),ss}var ts,tt;function to(){if(tt)return ts;tt=1;function s(){this.buffer=[],this.length=0}return s.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)===1},put:function(t,r){for(let o=0;o<r;o++)this.putBit((t>>>r-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}},ts=s,ts}var rs,rt;function ro(){if(rt)return rs;rt=1;function s(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return s.prototype.set=function(t,r,o,n){const a=t*this.size+r;this.data[a]=o,n&&(this.reservedBit[a]=!0)},s.prototype.get=function(t,r){return this.data[t*this.size+r]},s.prototype.xor=function(t,r,o){this.data[t*this.size+r]^=o},s.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]},rs=s,rs}var ns={},nt;function no(){return nt||(nt=1,(function(s){const t=me().getSymbolSize;s.getRowColCoords=function(o){if(o===1)return[];const n=Math.floor(o/7)+2,a=t(o),c=a===145?26:Math.ceil((a-13)/(2*n-2))*2,i=[a-7];for(let d=1;d<n-1;d++)i[d]=i[d-1]-c;return i.push(6),i.reverse()},s.getPositions=function(o){const n=[],a=s.getRowColCoords(o),c=a.length;for(let i=0;i<c;i++)for(let d=0;d<c;d++)i===0&&d===0||i===0&&d===c-1||i===c-1&&d===0||n.push([a[i],a[d]]);return n}})(ns)),ns}var as={},at;function ao(){if(at)return as;at=1;const s=me().getSymbolSize,t=7;return as.getPositions=function(o){const n=s(o);return[[0,0],[n-t,0],[0,n-t]]},as}var os={},ot;function oo(){return ot||(ot=1,(function(s){s.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};s.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},s.from=function(n){return s.isValid(n)?parseInt(n,10):void 0},s.getPenaltyN1=function(n){const a=n.size;let c=0,i=0,d=0,u=null,p=null;for(let f=0;f<a;f++){i=d=0,u=p=null;for(let h=0;h<a;h++){let w=n.get(f,h);w===u?i++:(i>=5&&(c+=t.N1+(i-5)),u=w,i=1),w=n.get(h,f),w===p?d++:(d>=5&&(c+=t.N1+(d-5)),p=w,d=1)}i>=5&&(c+=t.N1+(i-5)),d>=5&&(c+=t.N1+(d-5))}return c},s.getPenaltyN2=function(n){const a=n.size;let c=0;for(let i=0;i<a-1;i++)for(let d=0;d<a-1;d++){const u=n.get(i,d)+n.get(i,d+1)+n.get(i+1,d)+n.get(i+1,d+1);(u===4||u===0)&&c++}return c*t.N2},s.getPenaltyN3=function(n){const a=n.size;let c=0,i=0,d=0;for(let u=0;u<a;u++){i=d=0;for(let p=0;p<a;p++)i=i<<1&2047|n.get(u,p),p>=10&&(i===1488||i===93)&&c++,d=d<<1&2047|n.get(p,u),p>=10&&(d===1488||d===93)&&c++}return c*t.N3},s.getPenaltyN4=function(n){let a=0;const c=n.data.length;for(let d=0;d<c;d++)a+=n.data[d];return Math.abs(Math.ceil(a*100/c/5)-10)*t.N4};function r(o,n,a){switch(o){case s.Patterns.PATTERN000:return(n+a)%2===0;case s.Patterns.PATTERN001:return n%2===0;case s.Patterns.PATTERN010:return a%3===0;case s.Patterns.PATTERN011:return(n+a)%3===0;case s.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(a/3))%2===0;case s.Patterns.PATTERN101:return n*a%2+n*a%3===0;case s.Patterns.PATTERN110:return(n*a%2+n*a%3)%2===0;case s.Patterns.PATTERN111:return(n*a%3+(n+a)%2)%2===0;default:throw new Error("bad maskPattern:"+o)}}s.applyMask=function(n,a){const c=a.size;for(let i=0;i<c;i++)for(let d=0;d<c;d++)a.isReserved(d,i)||a.xor(d,i,r(n,d,i))},s.getBestMask=function(n,a){const c=Object.keys(s.Patterns).length;let i=0,d=1/0;for(let u=0;u<c;u++){a(u),s.applyMask(u,n);const p=s.getPenaltyN1(n)+s.getPenaltyN2(n)+s.getPenaltyN3(n)+s.getPenaltyN4(n);s.applyMask(u,n),p<d&&(d=p,i=u)}return i}})(os)),os}var Me={},it;function vr(){if(it)return Me;it=1;const s=Ms(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Me.getBlocksCount=function(n,a){switch(a){case s.L:return t[(n-1)*4+0];case s.M:return t[(n-1)*4+1];case s.Q:return t[(n-1)*4+2];case s.H:return t[(n-1)*4+3];default:return}},Me.getTotalCodewordsCount=function(n,a){switch(a){case s.L:return r[(n-1)*4+0];case s.M:return r[(n-1)*4+1];case s.Q:return r[(n-1)*4+2];case s.H:return r[(n-1)*4+3];default:return}},Me}var is={},Ae={},lt;function io(){if(lt)return Ae;lt=1;const s=new Uint8Array(512),t=new Uint8Array(256);return(function(){let o=1;for(let n=0;n<255;n++)s[n]=o,t[o]=n,o<<=1,o&256&&(o^=285);for(let n=255;n<512;n++)s[n]=s[n-255]})(),Ae.log=function(o){if(o<1)throw new Error("log("+o+")");return t[o]},Ae.exp=function(o){return s[o]},Ae.mul=function(o,n){return o===0||n===0?0:s[t[o]+t[n]]},Ae}var ct;function lo(){return ct||(ct=1,(function(s){const t=io();s.mul=function(o,n){const a=new Uint8Array(o.length+n.length-1);for(let c=0;c<o.length;c++)for(let i=0;i<n.length;i++)a[c+i]^=t.mul(o[c],n[i]);return a},s.mod=function(o,n){let a=new Uint8Array(o);for(;a.length-n.length>=0;){const c=a[0];for(let d=0;d<n.length;d++)a[d]^=t.mul(n[d],c);let i=0;for(;i<a.length&&a[i]===0;)i++;a=a.slice(i)}return a},s.generateECPolynomial=function(o){let n=new Uint8Array([1]);for(let a=0;a<o;a++)n=s.mul(n,new Uint8Array([1,t.exp(a)]));return n}})(is)),is}var ls,dt;function co(){if(dt)return ls;dt=1;const s=lo();function t(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(o){this.degree=o,this.genPoly=s.generateECPolynomial(this.degree)},t.prototype.encode=function(o){if(!this.genPoly)throw new Error("Encoder not initialized");const n=new Uint8Array(o.length+this.degree);n.set(o);const a=s.mod(n,this.genPoly),c=this.degree-a.length;if(c>0){const i=new Uint8Array(this.degree);return i.set(a,c),i}return a},ls=t,ls}var cs={},ds={},us={},ut;function Ar(){return ut||(ut=1,us.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),us}var ie={},ht;function jr(){if(ht)return ie;ht=1;const s="[0-9]+",t="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
|
|
2050
|
+
]))+`;ie.KANJI=new RegExp(r,"g"),ie.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),ie.BYTE=new RegExp(o,"g"),ie.NUMERIC=new RegExp(s,"g"),ie.ALPHANUMERIC=new RegExp(t,"g");const n=new RegExp("^"+r+"$"),a=new RegExp("^"+s+"$"),c=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return ie.testKanji=function(d){return n.test(d)},ie.testNumeric=function(d){return a.test(d)},ie.testAlphanumeric=function(d){return c.test(d)},ie}var mt;function pe(){return mt||(mt=1,(function(s){const t=Ar(),r=jr();s.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},s.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},s.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},s.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},s.MIXED={bit:-1},s.getCharCountIndicator=function(a,c){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!t.isValid(c))throw new Error("Invalid version: "+c);return c>=1&&c<10?a.ccBits[0]:c<27?a.ccBits[1]:a.ccBits[2]},s.getBestModeForData=function(a){return r.testNumeric(a)?s.NUMERIC:r.testAlphanumeric(a)?s.ALPHANUMERIC:r.testKanji(a)?s.KANJI:s.BYTE},s.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},s.isValid=function(a){return a&&a.bit&&a.ccBits};function o(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return s.NUMERIC;case"alphanumeric":return s.ALPHANUMERIC;case"kanji":return s.KANJI;case"byte":return s.BYTE;default:throw new Error("Unknown mode: "+n)}}s.from=function(a,c){if(s.isValid(a))return a;try{return o(a)}catch{return c}}})(ds)),ds}var pt;function uo(){return pt||(pt=1,(function(s){const t=me(),r=vr(),o=Ms(),n=pe(),a=Ar(),c=7973,i=t.getBCHDigit(c);function d(h,w,m){for(let g=1;g<=40;g++)if(w<=s.getCapacity(g,m,h))return g}function u(h,w){return n.getCharCountIndicator(h,w)+4}function p(h,w){let m=0;return h.forEach(function(g){const y=u(g.mode,w);m+=y+g.getBitsLength()}),m}function f(h,w){for(let m=1;m<=40;m++)if(p(h,m)<=s.getCapacity(m,w,n.MIXED))return m}s.from=function(w,m){return a.isValid(w)?parseInt(w,10):m},s.getCapacity=function(w,m,g){if(!a.isValid(w))throw new Error("Invalid QR Code version");typeof g>"u"&&(g=n.BYTE);const y=t.getSymbolTotalCodewords(w),v=r.getTotalCodewordsCount(w,m),x=(y-v)*8;if(g===n.MIXED)return x;const j=x-u(g,w);switch(g){case n.NUMERIC:return Math.floor(j/10*3);case n.ALPHANUMERIC:return Math.floor(j/11*2);case n.KANJI:return Math.floor(j/13);case n.BYTE:default:return Math.floor(j/8)}},s.getBestVersionForData=function(w,m){let g;const y=o.from(m,o.M);if(Array.isArray(w)){if(w.length>1)return f(w,y);if(w.length===0)return 1;g=w[0]}else g=w;return d(g.mode,g.getLength(),y)},s.getEncodedBits=function(w){if(!a.isValid(w)||w<7)throw new Error("Invalid QR Code version");let m=w<<12;for(;t.getBCHDigit(m)-i>=0;)m^=c<<t.getBCHDigit(m)-i;return w<<12|m}})(cs)),cs}var hs={},ft;function ho(){if(ft)return hs;ft=1;const s=me(),t=1335,r=21522,o=s.getBCHDigit(t);return hs.getEncodedBits=function(a,c){const i=a.bit<<3|c;let d=i<<10;for(;s.getBCHDigit(d)-o>=0;)d^=t<<s.getBCHDigit(d)-o;return(i<<10|d)^r},hs}var ms={},ps,gt;function mo(){if(gt)return ps;gt=1;const s=pe();function t(r){this.mode=s.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(o){return 10*Math.floor(o/3)+(o%3?o%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(o){let n,a,c;for(n=0;n+3<=this.data.length;n+=3)a=this.data.substr(n,3),c=parseInt(a,10),o.put(c,10);const i=this.data.length-n;i>0&&(a=this.data.substr(n),c=parseInt(a,10),o.put(c,i*3+1))},ps=t,ps}var fs,wt;function po(){if(wt)return fs;wt=1;const s=pe(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(o){this.mode=s.ALPHANUMERIC,this.data=o}return r.getBitsLength=function(n){return 11*Math.floor(n/2)+6*(n%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(n){let a;for(a=0;a+2<=this.data.length;a+=2){let c=t.indexOf(this.data[a])*45;c+=t.indexOf(this.data[a+1]),n.put(c,11)}this.data.length%2&&n.put(t.indexOf(this.data[a]),6)},fs=r,fs}var gs,yt;function fo(){if(yt)return gs;yt=1;const s=pe();function t(r){this.mode=s.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(o){return o*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let o=0,n=this.data.length;o<n;o++)r.put(this.data[o],8)},gs=t,gs}var ws,bt;function go(){if(bt)return ws;bt=1;const s=pe(),t=me();function r(o){this.mode=s.KANJI,this.data=o}return r.getBitsLength=function(n){return n*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(o){let n;for(n=0;n<this.data.length;n++){let a=t.toSJIS(this.data[n]);if(a>=33088&&a<=40956)a-=33088;else if(a>=57408&&a<=60351)a-=49472;else throw new Error("Invalid SJIS character: "+this.data[n]+`
|
|
2051
|
+
Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),o.put(a,13)}},ws=r,ws}var ys={exports:{}},xt;function wo(){return xt||(xt=1,(function(s){var t={single_source_shortest_paths:function(r,o,n){var a={},c={};c[o]=0;var i=t.PriorityQueue.make();i.push(o,0);for(var d,u,p,f,h,w,m,g,y;!i.empty();){d=i.pop(),u=d.value,f=d.cost,h=r[u]||{};for(p in h)h.hasOwnProperty(p)&&(w=h[p],m=f+w,g=c[p],y=typeof c[p]>"u",(y||g>m)&&(c[p]=m,i.push(p,m),a[p]=u))}if(typeof n<"u"&&typeof c[n]>"u"){var v=["Could not find a path from ",o," to ",n,"."].join("");throw new Error(v)}return a},extract_shortest_path_from_predecessor_list:function(r,o){for(var n=[],a=o;a;)n.push(a),r[a],a=r[a];return n.reverse(),n},find_path:function(r,o,n){var a=t.single_source_shortest_paths(r,o,n);return t.extract_shortest_path_from_predecessor_list(a,n)},PriorityQueue:{make:function(r){var o=t.PriorityQueue,n={},a;r=r||{};for(a in o)o.hasOwnProperty(a)&&(n[a]=o[a]);return n.queue=[],n.sorter=r.sorter||o.default_sorter,n},default_sorter:function(r,o){return r.cost-o.cost},push:function(r,o){var n={value:r,cost:o};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};s.exports=t})(ys)),ys.exports}var vt;function yo(){return vt||(vt=1,(function(s){const t=pe(),r=mo(),o=po(),n=fo(),a=go(),c=jr(),i=me(),d=wo();function u(v){return unescape(encodeURIComponent(v)).length}function p(v,x,j){const C=[];let k;for(;(k=v.exec(j))!==null;)C.push({data:k[0],index:k.index,mode:x,length:k[0].length});return C}function f(v){const x=p(c.NUMERIC,t.NUMERIC,v),j=p(c.ALPHANUMERIC,t.ALPHANUMERIC,v);let C,k;return i.isKanjiModeEnabled()?(C=p(c.BYTE,t.BYTE,v),k=p(c.KANJI,t.KANJI,v)):(C=p(c.BYTE_KANJI,t.BYTE,v),k=[]),x.concat(j,C,k).sort(function(S,T){return S.index-T.index}).map(function(S){return{data:S.data,mode:S.mode,length:S.length}})}function h(v,x){switch(x){case t.NUMERIC:return r.getBitsLength(v);case t.ALPHANUMERIC:return o.getBitsLength(v);case t.KANJI:return a.getBitsLength(v);case t.BYTE:return n.getBitsLength(v)}}function w(v){return v.reduce(function(x,j){const C=x.length-1>=0?x[x.length-1]:null;return C&&C.mode===j.mode?(x[x.length-1].data+=j.data,x):(x.push(j),x)},[])}function m(v){const x=[];for(let j=0;j<v.length;j++){const C=v[j];switch(C.mode){case t.NUMERIC:x.push([C,{data:C.data,mode:t.ALPHANUMERIC,length:C.length},{data:C.data,mode:t.BYTE,length:C.length}]);break;case t.ALPHANUMERIC:x.push([C,{data:C.data,mode:t.BYTE,length:C.length}]);break;case t.KANJI:x.push([C,{data:C.data,mode:t.BYTE,length:u(C.data)}]);break;case t.BYTE:x.push([{data:C.data,mode:t.BYTE,length:u(C.data)}])}}return x}function g(v,x){const j={},C={start:{}};let k=["start"];for(let b=0;b<v.length;b++){const S=v[b],T=[];for(let N=0;N<S.length;N++){const L=S[N],E=""+b+N;T.push(E),j[E]={node:L,lastCount:0},C[E]={};for(let P=0;P<k.length;P++){const M=k[P];j[M]&&j[M].node.mode===L.mode?(C[M][E]=h(j[M].lastCount+L.length,L.mode)-h(j[M].lastCount,L.mode),j[M].lastCount+=L.length):(j[M]&&(j[M].lastCount=L.length),C[M][E]=h(L.length,L.mode)+4+t.getCharCountIndicator(L.mode,x))}}k=T}for(let b=0;b<k.length;b++)C[k[b]].end=0;return{map:C,table:j}}function y(v,x){let j;const C=t.getBestModeForData(v);if(j=t.from(x,C),j!==t.BYTE&&j.bit<C.bit)throw new Error('"'+v+'" cannot be encoded with mode '+t.toString(j)+`.
|
|
2052
|
+
Suggested mode is: `+t.toString(C));switch(j===t.KANJI&&!i.isKanjiModeEnabled()&&(j=t.BYTE),j){case t.NUMERIC:return new r(v);case t.ALPHANUMERIC:return new o(v);case t.KANJI:return new a(v);case t.BYTE:return new n(v)}}s.fromArray=function(x){return x.reduce(function(j,C){return typeof C=="string"?j.push(y(C,null)):C.data&&j.push(y(C.data,C.mode)),j},[])},s.fromString=function(x,j){const C=f(x,i.isKanjiModeEnabled()),k=m(C),b=g(k,j),S=d.find_path(b.map,"start","end"),T=[];for(let N=1;N<S.length-1;N++)T.push(b.table[S[N]].node);return s.fromArray(w(T))},s.rawSplit=function(x){return s.fromArray(f(x,i.isKanjiModeEnabled()))}})(ms)),ms}var At;function bo(){if(At)return es;At=1;const s=me(),t=Ms(),r=to(),o=ro(),n=no(),a=ao(),c=oo(),i=vr(),d=co(),u=uo(),p=ho(),f=pe(),h=yo();function w(b,S){const T=b.size,N=a.getPositions(S);for(let L=0;L<N.length;L++){const E=N[L][0],P=N[L][1];for(let M=-1;M<=7;M++)if(!(E+M<=-1||T<=E+M))for(let B=-1;B<=7;B++)P+B<=-1||T<=P+B||(M>=0&&M<=6&&(B===0||B===6)||B>=0&&B<=6&&(M===0||M===6)||M>=2&&M<=4&&B>=2&&B<=4?b.set(E+M,P+B,!0,!0):b.set(E+M,P+B,!1,!0))}}function m(b){const S=b.size;for(let T=8;T<S-8;T++){const N=T%2===0;b.set(T,6,N,!0),b.set(6,T,N,!0)}}function g(b,S){const T=n.getPositions(S);for(let N=0;N<T.length;N++){const L=T[N][0],E=T[N][1];for(let P=-2;P<=2;P++)for(let M=-2;M<=2;M++)P===-2||P===2||M===-2||M===2||P===0&&M===0?b.set(L+P,E+M,!0,!0):b.set(L+P,E+M,!1,!0)}}function y(b,S){const T=b.size,N=u.getEncodedBits(S);let L,E,P;for(let M=0;M<18;M++)L=Math.floor(M/3),E=M%3+T-8-3,P=(N>>M&1)===1,b.set(L,E,P,!0),b.set(E,L,P,!0)}function v(b,S,T){const N=b.size,L=p.getEncodedBits(S,T);let E,P;for(E=0;E<15;E++)P=(L>>E&1)===1,E<6?b.set(E,8,P,!0):E<8?b.set(E+1,8,P,!0):b.set(N-15+E,8,P,!0),E<8?b.set(8,N-E-1,P,!0):E<9?b.set(8,15-E-1+1,P,!0):b.set(8,15-E-1,P,!0);b.set(N-8,8,1,!0)}function x(b,S){const T=b.size;let N=-1,L=T-1,E=7,P=0;for(let M=T-1;M>0;M-=2)for(M===6&&M--;;){for(let B=0;B<2;B++)if(!b.isReserved(L,M-B)){let I=!1;P<S.length&&(I=(S[P]>>>E&1)===1),b.set(L,M-B,I),E--,E===-1&&(P++,E=7)}if(L+=N,L<0||T<=L){L-=N,N=-N;break}}}function j(b,S,T){const N=new r;T.forEach(function(B){N.put(B.mode.bit,4),N.put(B.getLength(),f.getCharCountIndicator(B.mode,b)),B.write(N)});const L=s.getSymbolTotalCodewords(b),E=i.getTotalCodewordsCount(b,S),P=(L-E)*8;for(N.getLengthInBits()+4<=P&&N.put(0,4);N.getLengthInBits()%8!==0;)N.putBit(0);const M=(P-N.getLengthInBits())/8;for(let B=0;B<M;B++)N.put(B%2?17:236,8);return C(N,b,S)}function C(b,S,T){const N=s.getSymbolTotalCodewords(S),L=i.getTotalCodewordsCount(S,T),E=N-L,P=i.getBlocksCount(S,T),M=N%P,B=P-M,I=Math.floor(N/P),D=Math.floor(E/P),H=D+1,z=I-D,R=new d(z);let U=0;const F=new Array(P),$=new Array(P);let ae=0;const X=new Uint8Array(b.buffer);for(let Y=0;Y<P;Y++){const Z=Y<B?D:H;F[Y]=X.slice(U,U+Z),$[Y]=R.encode(F[Y]),U+=Z,ae=Math.max(ae,Z)}const oe=new Uint8Array(N);let se=0,_,q;for(_=0;_<ae;_++)for(q=0;q<P;q++)_<F[q].length&&(oe[se++]=F[q][_]);for(_=0;_<z;_++)for(q=0;q<P;q++)oe[se++]=$[q][_];return oe}function k(b,S,T,N){let L;if(Array.isArray(b))L=h.fromArray(b);else if(typeof b=="string"){let I=S;if(!I){const D=h.rawSplit(b);I=u.getBestVersionForData(D,T)}L=h.fromString(b,I||40)}else throw new Error("Invalid data");const E=u.getBestVersionForData(L,T);if(!E)throw new Error("The amount of data is too big to be stored in a QR Code");if(!S)S=E;else if(S<E)throw new Error(`
|
|
2053
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
2054
|
+
Minimum version required to store current data is: `+E+`.
|
|
2055
|
+
`);const P=j(S,T,L),M=s.getSymbolSize(S),B=new o(M);return w(B,S),m(B),g(B,S),v(B,T,0),S>=7&&y(B,S),x(B,P),isNaN(N)&&(N=c.getBestMask(B,v.bind(null,B,T))),c.applyMask(N,B),v(B,T,N),{modules:B,version:S,errorCorrectionLevel:T,maskPattern:N,segments:L}}return es.create=function(S,T){if(typeof S>"u"||S==="")throw new Error("No input text");let N=t.M,L,E;return typeof T<"u"&&(N=t.from(T.errorCorrectionLevel,t.M),L=u.from(T.version),E=c.from(T.maskPattern),T.toSJISFunc&&s.setToSJISFunction(T.toSJISFunc)),k(S,L,N,E)},es}var bs={},xs={},jt;function Nr(){return jt||(jt=1,(function(s){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let o=r.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+r);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(a){return[a,a]}))),o.length===6&&o.push("F","F");const n=parseInt(o.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+o.slice(0,6).join("")}}s.getOptions=function(o){o||(o={}),o.color||(o.color={});const n=typeof o.margin>"u"||o.margin===null||o.margin<0?4:o.margin,a=o.width&&o.width>=21?o.width:void 0,c=o.scale||4;return{width:a,scale:a?4:c,margin:n,color:{dark:t(o.color.dark||"#000000ff"),light:t(o.color.light||"#ffffffff")},type:o.type,rendererOpts:o.rendererOpts||{}}},s.getScale=function(o,n){return n.width&&n.width>=o+n.margin*2?n.width/(o+n.margin*2):n.scale},s.getImageWidth=function(o,n){const a=s.getScale(o,n);return Math.floor((o+n.margin*2)*a)},s.qrToImageData=function(o,n,a){const c=n.modules.size,i=n.modules.data,d=s.getScale(c,a),u=Math.floor((c+a.margin*2)*d),p=a.margin*d,f=[a.color.light,a.color.dark];for(let h=0;h<u;h++)for(let w=0;w<u;w++){let m=(h*u+w)*4,g=a.color.light;if(h>=p&&w>=p&&h<u-p&&w<u-p){const y=Math.floor((h-p)/d),v=Math.floor((w-p)/d);g=f[i[y*c+v]?1:0]}o[m++]=g.r,o[m++]=g.g,o[m++]=g.b,o[m]=g.a}}})(xs)),xs}var Nt;function xo(){return Nt||(Nt=1,(function(s){const t=Nr();function r(n,a,c){n.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=c,a.width=c,a.style.height=c+"px",a.style.width=c+"px"}function o(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}s.render=function(a,c,i){let d=i,u=c;typeof d>"u"&&(!c||!c.getContext)&&(d=c,c=void 0),c||(u=o()),d=t.getOptions(d);const p=t.getImageWidth(a.modules.size,d),f=u.getContext("2d"),h=f.createImageData(p,p);return t.qrToImageData(h.data,a,d),r(f,u,p),f.putImageData(h,0,0),u},s.renderToDataURL=function(a,c,i){let d=i;typeof d>"u"&&(!c||!c.getContext)&&(d=c,c=void 0),d||(d={});const u=s.render(a,c,d),p=d.type||"image/png",f=d.rendererOpts||{};return u.toDataURL(p,f.quality)}})(bs)),bs}var vs={},kt;function vo(){if(kt)return vs;kt=1;const s=Nr();function t(n,a){const c=n.a/255,i=a+'="'+n.hex+'"';return c<1?i+" "+a+'-opacity="'+c.toFixed(2).slice(1)+'"':i}function r(n,a,c){let i=n+a;return typeof c<"u"&&(i+=" "+c),i}function o(n,a,c){let i="",d=0,u=!1,p=0;for(let f=0;f<n.length;f++){const h=Math.floor(f%a),w=Math.floor(f/a);!h&&!u&&(u=!0),n[f]?(p++,f>0&&h>0&&n[f-1]||(i+=u?r("M",h+c,.5+w+c):r("m",d,0),d=0,u=!1),h+1<a&&n[f+1]||(i+=r("h",p),p=0)):d++}return i}return vs.render=function(a,c,i){const d=s.getOptions(c),u=a.modules.size,p=a.modules.data,f=u+d.margin*2,h=d.color.light.a?"<path "+t(d.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",w="<path "+t(d.color.dark,"stroke")+' d="'+o(p,u,d.margin)+'"/>',m='viewBox="0 0 '+f+" "+f+'"',y='<svg xmlns="http://www.w3.org/2000/svg" '+(d.width?'width="'+d.width+'" height="'+d.width+'" ':"")+m+' shape-rendering="crispEdges">'+h+w+`</svg>
|
|
2056
|
+
`;return typeof i=="function"&&i(null,y),y},vs}var Ct;function Ao(){if(Ct)return ge;Ct=1;const s=so(),t=bo(),r=xo(),o=vo();function n(a,c,i,d,u){const p=[].slice.call(arguments,1),f=p.length,h=typeof p[f-1]=="function";if(!h&&!s())throw new Error("Callback required as last argument");if(h){if(f<2)throw new Error("Too few arguments provided");f===2?(u=i,i=c,c=d=void 0):f===3&&(c.getContext&&typeof u>"u"?(u=d,d=void 0):(u=d,d=i,i=c,c=void 0))}else{if(f<1)throw new Error("Too few arguments provided");return f===1?(i=c,c=d=void 0):f===2&&!c.getContext&&(d=i,i=c,c=void 0),new Promise(function(w,m){try{const g=t.create(i,d);w(a(g,c,d))}catch(g){m(g)}})}try{const w=t.create(i,d);u(null,a(w,c,d))}catch(w){u(w)}}return ge.create=t.create,ge.toCanvas=n.bind(null,r.render),ge.toDataURL=n.bind(null,r.renderToDataURL),ge.toString=n.bind(null,function(a,c,i){return o.render(a,i)}),ge}var jo=Ao();const No=O.getDefaultExportFromCjs(jo);function ko({value:s,size:t=200,alt:r="QR code",className:o=""}){const n=l.useRef(null),[a,c]=l.useState(null);return l.useEffect(()=>{!n.current||!s||No.toCanvas(n.current,s,{width:t,margin:2,color:{dark:"#000000",light:"#ffffff"},errorCorrectionLevel:"M"}).then(()=>{c(null)}).catch(i=>{c(i instanceof Error?i.message:"Failed to generate QR code")})},[s,t]),a?e.jsx("div",{className:`cedros-qr-error ${o}`,style:{width:t,height:t},role:"img","aria-label":r,children:e.jsx("p",{children:"Failed to generate QR code"})}):e.jsx("canvas",{ref:n,className:`cedros-totp-qr-image ${o}`,role:"img","aria-label":r,style:{borderRadius:"0.5rem"}})}function Rs(){const{config:s,_internal:t}=A.useCedrosLogin(),[r,o]=l.useState(null),[n,a]=l.useState("idle"),[c,i]=l.useState(null),[d,u]=l.useState(!1),[p,f]=l.useState(null),h=l.useMemo(()=>new A.ApiClient({baseUrl:s.serverUrl,timeoutMs:s.requestTimeout,retryAttempts:s.retryAttempts,getAccessToken:t?.getAccessToken}),[s.serverUrl,s.requestTimeout,s.retryAttempts,t]),w=l.useCallback(async()=>{u(!0),f(null);try{const C=await h.get("/mfa/status");return o(C),C}catch(C){const k=A.handleApiError(C,"Failed to get TOTP status");throw f(k),k}finally{u(!1)}},[h]),m=l.useCallback(async()=>{u(!0),f(null),a("loading");try{const C=await h.post("/mfa/setup",{});return i(C),a("setup"),C}catch(C){const k=A.handleApiError(C,"Failed to start TOTP setup");throw f(k),a("error"),k}finally{u(!1)}},[h]),g=l.useCallback(async C=>{if(!/^\d{6}$/.test(C)){const k={code:"VALIDATION_ERROR",message:"Please enter a 6-digit code"};throw f(k),k}u(!0),f(null),a("verifying");try{await h.post("/mfa/enable",{code:C}),a("success"),o({enabled:!0,recoveryCodesRemaining:c?.recoveryCodes.length??0})}catch(k){const b=A.handleApiError(k,"Invalid verification code");throw f(b),a("error"),b}finally{u(!1)}},[h,c]),y=l.useCallback(async C=>{if(!C){const k={code:"VALIDATION_ERROR",message:"Please enter your password"};throw f(k),k}u(!0),f(null);try{await h.post("/mfa/disable",{password:C}),o({enabled:!1,recoveryCodesRemaining:0}),i(null),a("idle")}catch(k){const b=A.handleApiError(k,"Failed to disable TOTP");throw f(b),b}finally{u(!1)}},[h]),v=l.useCallback(async C=>{if(!/^\d{6}$/.test(C)){const k={code:"VALIDATION_ERROR",message:"Please enter a 6-digit code"};throw f(k),k}u(!0),f(null);try{return await h.post("/mfa/recovery-codes/regenerate",{code:C})}catch(k){const b=A.handleApiError(k,"Failed to regenerate recovery codes");throw f(b),b}finally{u(!1)}},[h]),x=l.useCallback(()=>f(null),[]),j=l.useCallback(()=>{f(null),i(null),a("idle"),u(!1)},[]);return{status:r,setupState:n,setupData:c,isLoading:d,error:p,getStatus:w,beginSetup:m,enableTotp:g,disableTotp:y,regenerateBackupCodes:v,clearError:x,reset:j}}function kr({onSuccess:s,onCancel:t,className:r=""}){const{setupState:o,setupData:n,isLoading:a,error:c,beginSetup:i,enableTotp:d,clearError:u,reset:p}=Rs(),[f,h]=l.useState("qr"),[w,m]=l.useState(""),[g,y]=l.useState(!1),[v,x]=l.useState(!1),j=l.useRef(null);l.useEffect(()=>{o==="idle"&&i().catch(()=>{})},[o,i]),l.useEffect(()=>{o==="success"&&s?.()},[o,s]);const C=async()=>{n?.secret&&(await navigator.clipboard.writeText(n.secret),y(!0),j.current!==null&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>y(!1),2e3))},k=async()=>{if(n?.recoveryCodes){const T=n.recoveryCodes.join(`
|
|
2057
|
+
`);await navigator.clipboard.writeText(T)}},b=async()=>{try{await d(w)}catch{m("")}},S=()=>{p(),t?.()};return l.useEffect(()=>()=>{j.current!==null&&(window.clearTimeout(j.current),j.current=null)},[]),o==="loading"||o==="idle"&&a?e.jsx("div",{className:`cedros-totp-setup ${r}`,children:e.jsx("div",{className:"cedros-totp-loading",children:e.jsx(A.LoadingSpinner,{size:"lg",label:"Setting up two-factor authentication"})})}):o==="error"&&!n?e.jsxs("div",{className:`cedros-totp-setup ${r}`,children:[e.jsx(A.ErrorMessage,{error:c,onDismiss:u}),e.jsxs("div",{className:"cedros-totp-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-md",onClick:S,children:"Cancel"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-md",onClick:()=>i(),children:"Try again"})]})]}):o==="success"?e.jsx("div",{className:`cedros-totp-setup ${r}`,children:e.jsxs("div",{className:"cedros-totp-success",children:[e.jsxs("svg",{className:"cedros-totp-success-icon",width:"48",height:"48",viewBox:"0 0 48 48",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"24",cy:"24",r:"22",stroke:"var(--cedros-success)",strokeWidth:"2"}),e.jsx("path",{d:"M14 24l7 7 13-13",stroke:"var(--cedros-success)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsx("h3",{className:"cedros-totp-title",children:"Two-factor authentication enabled"}),e.jsx("p",{className:"cedros-totp-description",children:"Your account is now protected with an additional layer of security."})]})}):n?e.jsxs("div",{className:`cedros-totp-setup ${r}`,children:[f==="qr"&&e.jsxs("div",{className:"cedros-totp-step",children:[e.jsx("h3",{className:"cedros-totp-title",children:"Scan QR code"}),e.jsx("p",{className:"cedros-totp-description",children:"Use your authenticator app to scan this QR code."}),e.jsx("div",{className:"cedros-totp-qr",children:e.jsx(ko,{value:n.otpauthUri,size:200,alt:"QR code for authenticator app"})}),e.jsxs("div",{className:"cedros-totp-manual",children:[e.jsx("p",{className:"cedros-totp-manual-label",children:"Or enter this code manually:"}),e.jsxs("div",{className:"cedros-totp-secret",children:[e.jsx("code",{className:"cedros-totp-secret-code",children:n.secret}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-ghost cedros-button-sm",onClick:C,"aria-label":"Copy secret",children:g?"Copied!":"Copy"})]})]}),e.jsxs("div",{className:"cedros-totp-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-md",onClick:S,children:"Cancel"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-md",onClick:()=>h("backup"),children:"Continue"})]})]}),f==="backup"&&e.jsxs("div",{className:"cedros-totp-step",children:[e.jsx("h3",{className:"cedros-totp-title",children:"Save recovery codes"}),e.jsx("p",{className:"cedros-totp-description",children:"Save these codes in a secure place. You can use them to access your account if you lose your authenticator device."}),e.jsx("div",{className:"cedros-totp-backup-codes",children:n.recoveryCodes.map((T,N)=>e.jsx("code",{className:"cedros-totp-backup-code",children:T},N))}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-md cedros-button-full",onClick:k,children:"Copy all codes"}),e.jsxs("label",{className:"cedros-checkbox-label cedros-totp-confirm",children:[e.jsx("input",{type:"checkbox",className:"cedros-checkbox",checked:v,onChange:T=>x(T.target.checked)}),e.jsx("span",{className:"cedros-checkbox-text",children:"I have saved these recovery codes"})]}),e.jsxs("div",{className:"cedros-totp-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-md",onClick:()=>h("qr"),children:"Back"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-md",onClick:()=>h("verify"),disabled:!v,children:"Continue"})]})]}),f==="verify"&&e.jsxs("div",{className:"cedros-totp-step",children:[e.jsx("h3",{className:"cedros-totp-title",children:"Verify setup"}),e.jsx("p",{className:"cedros-totp-description",children:"Enter the 6-digit code from your authenticator app to complete setup."}),e.jsx(O.OtpInput,{value:w,onChange:m,onComplete:b,disabled:a,error:c?.message,autoFocus:!0}),e.jsxs("div",{className:"cedros-totp-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-md",onClick:()=>h("backup"),disabled:a,children:"Back"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-md",onClick:b,disabled:a||w.length!==6,children:a?e.jsxs(e.Fragment,{children:[e.jsx(A.LoadingSpinner,{size:"sm"}),e.jsx("span",{children:"Verifying..."})]}):"Enable 2FA"})]})]})]}):null}function Co({onStatusChange:s,className:t=""}){const{status:r,isLoading:o,error:n,getStatus:a,disableTotp:c,regenerateBackupCodes:i,clearError:d}=Rs(),[u,p]=l.useState("status"),[f,h]=l.useState(""),[w,m]=l.useState(""),[g,y]=l.useState(null),[v,x]=l.useState(!1),[j,C]=l.useState(null);l.useEffect(()=>{a().catch(()=>{})},[a]);const k=l.useCallback(()=>{p("status"),s?.(!0)},[s]),b=async()=>{x(!0),C(null);try{await c(f),p("status"),h(""),s?.(!1)}catch(N){C(N instanceof Error?N.message:"Failed to disable 2FA"),h("")}finally{x(!1)}},S=async()=>{x(!0),C(null);try{const N=await i(w);y(N.recoveryCodes),m("")}catch(N){C(N instanceof Error?N.message:"Failed to regenerate codes"),m("")}finally{x(!1)}},T=async()=>{g&&await navigator.clipboard.writeText(g.join(`
|
|
2058
|
+
`))};return o&&!r?e.jsx("div",{className:`cedros-totp-settings ${t}`,children:e.jsx("div",{className:"cedros-totp-loading",children:e.jsx(A.LoadingSpinner,{size:"md",label:"Loading security settings"})})}):n&&!r?e.jsxs("div",{className:`cedros-totp-settings ${t}`,children:[e.jsx(A.ErrorMessage,{error:n,onDismiss:d}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-md",onClick:()=>a(),children:"Retry"})]}):u==="setup"?e.jsx("div",{className:`cedros-totp-settings ${t}`,children:e.jsx(kr,{onSuccess:k,onCancel:()=>p("status")})}):u==="disable"?e.jsx("div",{className:`cedros-totp-settings ${t}`,children:e.jsxs("div",{className:"cedros-totp-panel",children:[e.jsx("h3",{className:"cedros-totp-title",children:"Disable two-factor authentication"}),e.jsx("p",{className:"cedros-totp-description cedros-totp-warning",children:"This will make your account less secure. Enter your password to confirm."}),j&&e.jsx("div",{className:"cedros-totp-error",children:e.jsx(A.ErrorMessage,{error:{code:"UNKNOWN_ERROR",message:j},onDismiss:()=>C(null)})}),e.jsx("div",{className:"cedros-totp-verify-input",children:e.jsx(O.PasswordInput,{label:"Password",placeholder:"Enter your password",value:f,onChange:N=>h(N.target.value),disabled:v,autoFocus:!0})}),e.jsxs("div",{className:"cedros-totp-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-md",onClick:()=>{p("status"),h(""),C(null)},disabled:v,children:"Cancel"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-destructive cedros-button-md",onClick:b,disabled:v||f.length===0,children:v?e.jsxs(e.Fragment,{children:[e.jsx(A.LoadingSpinner,{size:"sm"}),e.jsx("span",{children:"Disabling..."})]}):"Disable 2FA"})]})]})}):u==="regenerate"?g?e.jsx("div",{className:`cedros-totp-settings ${t}`,children:e.jsxs("div",{className:"cedros-totp-panel",children:[e.jsx("h3",{className:"cedros-totp-title",children:"New recovery codes"}),e.jsx("p",{className:"cedros-totp-description",children:"Save these codes in a secure place. Your old codes are no longer valid."}),e.jsx("div",{className:"cedros-totp-backup-codes",children:g.map((N,L)=>e.jsx("code",{className:"cedros-totp-backup-code",children:N},L))}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-md cedros-button-full",onClick:T,children:"Copy all codes"}),e.jsx("div",{className:"cedros-totp-actions",children:e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-md",onClick:()=>{p("status"),y(null)},children:"Done"})})]})}):e.jsx("div",{className:`cedros-totp-settings ${t}`,children:e.jsxs("div",{className:"cedros-totp-panel",children:[e.jsx("h3",{className:"cedros-totp-title",children:"Regenerate recovery codes"}),e.jsx("p",{className:"cedros-totp-description",children:"This will invalidate all existing recovery codes. Enter your authenticator code to confirm."}),j&&e.jsx("div",{className:"cedros-totp-error",children:e.jsx(A.ErrorMessage,{error:{code:"UNKNOWN_ERROR",message:j},onDismiss:()=>C(null)})}),e.jsx("div",{className:"cedros-totp-verify-input",children:e.jsx(O.OtpInput,{value:w,onChange:m,onComplete:S,disabled:v,autoFocus:!0})}),e.jsxs("div",{className:"cedros-totp-actions",children:[e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-md",onClick:()=>{p("status"),m(""),C(null)},disabled:v,children:"Cancel"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-md",onClick:S,disabled:v||w.length!==6,children:v?e.jsxs(e.Fragment,{children:[e.jsx(A.LoadingSpinner,{size:"sm"}),e.jsx("span",{children:"Regenerating..."})]}):"Regenerate codes"})]})]})}):e.jsx("div",{className:`cedros-totp-settings ${t}`,children:e.jsxs("div",{className:"cedros-totp-panel",children:[e.jsxs("div",{className:"cedros-totp-status-header",children:[e.jsxs("div",{className:"cedros-totp-status-info",children:[e.jsx("h3",{className:"cedros-totp-title",children:"Two-factor authentication"}),e.jsx("p",{className:"cedros-totp-description",children:"Add an extra layer of security to your account by requiring a verification code from your authenticator app when signing in."})]}),e.jsx("div",{className:`cedros-totp-badge ${r?.enabled?"cedros-totp-badge-enabled":"cedros-totp-badge-disabled"}`,children:r?.enabled?"Enabled":"Disabled"})]}),r?.enabled?e.jsxs("div",{className:"cedros-totp-enabled-actions",children:[e.jsxs("div",{className:"cedros-totp-description",style:{marginTop:"0.25rem"},children:["Recovery codes remaining: ",e.jsx("strong",{children:r.recoveryCodesRemaining})]}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-outline cedros-button-md",onClick:()=>p("regenerate"),children:"Regenerate recovery codes"}),e.jsx("button",{type:"button",className:"cedros-button cedros-button-destructive-outline cedros-button-md",onClick:()=>p("disable"),children:"Disable 2FA"})]}):e.jsx("button",{type:"button",className:"cedros-button cedros-button-primary cedros-button-md",onClick:()=>p("setup"),children:"Enable two-factor authentication"})]})})}function Cr(){const s=A.useCedrosLoginOptional(),[t,r]=l.useState(!1),[o,n]=l.useState(null),a=l.useMemo(()=>s?new A.ApiClient({baseUrl:s.config.serverUrl,timeoutMs:s.config.requestTimeout,retryAttempts:s.config.retryAttempts,getAccessToken:s._internal?.getAccessToken}):null,[s]),c=l.useCallback(()=>{n(null)},[]),i=l.useCallback(async m=>{if(!a)throw new Error("useDeposit must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.post("/deposit",{amount_lamports:m})}catch(g){const y=A.handleApiError(g,"Failed to execute deposit");throw n(y.message),y}finally{r(!1)}},[a]),d=l.useCallback(async m=>{if(!a)throw new Error("useDeposit must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.get(`/deposit/status/${m}`)}catch(g){const y=A.handleApiError(g,"Failed to get deposit status");throw n(y.message),y}finally{r(!1)}},[a]),u=l.useCallback(async()=>{if(!a)throw new Error("useDeposit must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.get("/deposit/config")}catch(m){const g=A.handleApiError(m,"Failed to get deposit config");throw n(g.message),g}finally{r(!1)}},[a]),p=l.useCallback(async m=>{if(!a)throw new Error("useDeposit must be used within a CedrosLoginProvider");r(!0),n(null);try{const g=new URLSearchParams;m?.limit!==void 0&&g.set("limit",String(m.limit)),m?.offset!==void 0&&g.set("offset",String(m.offset));const y=g.toString(),v=y?`/deposits?${y}`:"/deposits";return await a.get(v)}catch(g){const y=A.handleApiError(g,"Failed to list deposits");throw n(y.message),y}finally{r(!1)}},[a]),f=l.useCallback(async m=>{if(!a)throw new Error("useDeposit must be used within a CedrosLoginProvider");r(!0),n(null);try{const g=new URLSearchParams({input_mint:m.inputMint,amount:String(m.amount),taker:m.taker});return await a.get(`/deposit/quote?${g}`)}catch(g){const y=A.handleApiError(g,"Failed to get deposit quote");throw n(y.message),y}finally{r(!1)}},[a]),h=l.useCallback(async m=>{if(!a)throw new Error("useDeposit must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.post("/deposit/public",m)}catch(g){const y=A.handleApiError(g,"Failed to execute public deposit");throw n(y.message),y}finally{r(!1)}},[a]),w=l.useCallback(async m=>{if(!a)throw new Error("useDeposit must be used within a CedrosLoginProvider");r(!0),n(null);try{return await a.post("/deposit/micro",m)}catch(g){const y=A.handleApiError(g,"Failed to execute micro deposit");throw n(y.message),y}finally{r(!1)}},[a]);return{deposit:i,getQuote:f,publicDeposit:h,microDeposit:w,getStatus:d,getConfig:u,listDeposits:p,isLoading:t,error:o,clearError:c}}function Ds({tokens:s,selectedToken:t,onSelect:r,openSignal:o,placeholder:n="Select token",disabled:a=!1,className:c="",searchable:i=!0}){const[d,u]=l.useState(!1),[p,f]=l.useState(""),h=l.useRef(null),w=l.useRef(null),m=l.useMemo(()=>{if(!p.trim())return s;const x=p.toLowerCase();return s.filter(j=>j.symbol.toLowerCase().includes(x)||j.name.toLowerCase().includes(x)||j.mint.toLowerCase().includes(x))},[s,p]);l.useEffect(()=>{const x=j=>{h.current&&!h.current.contains(j.target)&&(u(!1),f(""))};if(d)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[d]),l.useEffect(()=>{d&&i&&w.current&&w.current.focus()},[d,i]),l.useEffect(()=>{o===void 0||a||(u(!0),f(""))},[o,a]);const g=l.useCallback(()=>{a||(u(x=>!x),d&&f(""))},[a,d]),y=l.useCallback(x=>{r(x),u(!1),f("")},[r]),v=l.useCallback(x=>{x.key==="Escape"?(u(!1),f("")):x.key==="Enter"&&m.length===1&&y(m[0])},[m,y]);return e.jsxs("div",{ref:h,className:`cedros-token-selector ${d?"cedros-token-selector-open":""} ${a?"cedros-token-selector-disabled":""} ${c}`,onKeyDown:v,children:[e.jsxs("button",{type:"button",className:"cedros-token-selector-trigger",onClick:g,disabled:a,"aria-haspopup":"listbox","aria-expanded":d,children:[t?e.jsxs("span",{className:"cedros-token-selector-selected",children:[t.logoUrl&&e.jsx("img",{src:t.logoUrl,alt:t.symbol,className:"cedros-token-icon",onError:x=>{x.target.style.display="none"}}),e.jsx("span",{className:"cedros-token-symbol",children:t.symbol})]}):e.jsx("span",{className:"cedros-token-selector-placeholder",children:n}),e.jsx("span",{className:"cedros-token-selector-arrow",children:d?"▲":"▼"})]}),d&&e.jsxs("div",{className:"cedros-token-selector-dropdown",role:"listbox",children:[i&&e.jsx("div",{className:"cedros-token-search",children:e.jsx("input",{ref:w,type:"text",value:p,onChange:x=>f(x.target.value),placeholder:"Search tokens...",className:"cedros-token-search-input"})}),e.jsx("div",{className:"cedros-token-list",children:m.length===0?e.jsx("div",{className:"cedros-token-empty",children:"No tokens found"}):e.jsx(e.Fragment,{children:m.map(x=>e.jsxs("button",{type:"button",className:`cedros-token-option ${t?.mint===x.mint?"cedros-token-option-selected":""}`,onClick:()=>y(x),role:"option","aria-selected":t?.mint===x.mint,children:[x.logoUrl&&e.jsx("img",{src:x.logoUrl,alt:x.symbol,className:"cedros-token-icon",onError:j=>{j.target.style.display="none"}}),e.jsxs("span",{className:"cedros-token-info",children:[e.jsx("span",{className:"cedros-token-symbol",children:x.symbol}),e.jsx("span",{className:"cedros-token-name",children:x.name})]}),t?.mint===x.mint&&e.jsx("span",{className:"cedros-token-check",children:"✓"})]},x.mint))})})]})]})}function Ve(s,t){return t.privateDepositsEnabled&&s>=t.privateMinUsd?"private":s>=t.publicMinUsd?"public":"sol_micro"}const Bs="data:image/webp;base64,UklGRkACAABXRUJQVlA4IDQCAACQDQCdASo8ADwAPjEWiUMiISEUBFQgAwSgB4Z/TeLt3XMAoQH23eph0gPMB+sn+M9tvngOsA9ADwgPg3/cH9sfZciikEBuA1AB+nf+84CUkAVvA2x4xvyobR+mBaYhjUv/ewHb4hTqOnP38rzsxZX2inOSciAA/v7uqvqGdpWcjjrfMDFaNHumTog38t3yor0kbjn631VsX61cAC749wWuAX74u/f/hpeDFqS/ci8E1g94wk9UVs7BHqtv7f/M9iT1u5ITJV0Gv6tE/CW5j/nVR6yExJ6JoDRDOWQ8zVpWH92r3Lnbnc4WJpOchbRT3H5rv//6PP+F//4ehLUlR/4tkRUKZu/yOa26+sywmY+Xc1X2lXMcUv7+eQ7+FBE7bhKc7htieBfH4eR134AVaILL7PWA2FjzAjfaP1Lgirqoq/ZooE8jVD/b4g3J3O3/TG/4ajHe6clnAI/4NdwrnHX0P/quBU03HqSsQ0qsEMAuhrH/jn+YtDzmjm8q/cGJ44qvi24Hn+G1kxz2XP2S/Gp7ri5cMlo+muuwBjyNJnnEcTt/5cRdYS2cbEBZtpINWj3PuC1EOsd/8cTepSpxODcJHLzktfC1PHW3Pgoh3J5PHjW3TCQ1Wlu/wP8e8OPfNm48BODGChioj3ezblqrOBV+cI+hLi7ReJdvBF/4jY+/Un0asuWnrA6kRNpgOeO8wyl4Ryhkrff+9R1SpyPYP+5T3EuWWLZaCn0bGzyk97S3VAAAAAA=",So=1e4,Oe=1e3,Sr=3;function Eo(s){return Number.isFinite(s)?`$${Math.round(s)}`:"$0"}function Po(s,t){switch(s){case"private":return{label:"Private",detail:"Private transaction, instant credit",note:null};case"public":return{label:"Public",detail:"Visible on-chain, instant credit",note:null};case"sol_micro":return{label:"SOL Only",detail:`SOL only under ${Eo(t.solMicroMaxUsd)}`,note:"Small deposits must be sent in SOL and are visible on-chain. Increase the amount to use tokens."}}}function Fs(s,t,r){return Math.min(Math.max(s,t),r)}function Lo(s,t){if(t<=0)return 0;const r=Fs(s/t,0,1);return Math.round(Math.pow(r,1/Sr)*Oe)}function To(s,t){const r=Fs(s/Oe,0,1);return t*Math.pow(r,Sr)}function Er(s){return s<10?.01:s<100?1:s<500?5:s<1e3?10:s<5e3?25:50}function Mo(s){return s<1?2:0}function St(s){const t=Er(s),r=Math.round(s/t)*t,o=Mo(t);return Number(r.toFixed(o))}function Us({config:s,valueUsd:t,onChange:r,maxUsd:o=So,disabled:n=!1,className:a=""}){const c=Fs(Number.isFinite(t)?t:0,0,o),i=l.useMemo(()=>Ve(c,s),[c,s]),d=Po(i,s),u=Lo(c,o),p=u/Oe*100;return e.jsxs("div",{className:`cedros-tiered-slider ${a}`,children:[e.jsxs("div",{className:"cedros-tiered-slider-input-row",children:[e.jsxs("div",{className:"cedros-tiered-slider-input",children:[e.jsx("span",{className:"cedros-tiered-slider-currency",children:"$"}),e.jsx("input",{type:"number",value:c||"",onChange:f=>r(St(parseFloat(f.target.value)||0)),placeholder:"Enter amount",disabled:n,min:0,step:Er(c),className:"cedros-deposit-flow-input cedros-tiered-slider-input-field","aria-label":"Deposit amount"})]}),e.jsxs("div",{className:"cedros-tiered-slider-tier",children:[e.jsxs("span",{className:`cedros-tiered-slider-badge cedros-tiered-slider-badge-${i}`,children:[i==="sol_micro"&&e.jsx("img",{src:Bs,alt:"SOL",className:"cedros-tiered-slider-badge-icon"}),d.label]}),e.jsx("span",{className:"cedros-tiered-slider-tier-detail",children:d.detail})]})]}),e.jsx("input",{type:"range",min:0,max:Oe,step:1,value:u,onChange:f=>r(St(To(parseFloat(f.target.value),o))),className:"cedros-tiered-slider-range",style:{background:`linear-gradient(to right, var(--cedros-primary) 0%, var(--cedros-primary) ${p}%, var(--cedros-border) ${p}%, var(--cedros-border) 100%)`},disabled:n,"aria-label":"Deposit amount slider"}),d.note&&e.jsx("div",{className:"cedros-tiered-slider-note",children:d.note})]})}function Ro(s){return s.companyFeePercent>0||s.feePolicy==="user_pays_all"||s.feePolicy==="user_pays_swap"||s.feePolicy==="user_pays_privacy"}function Do(s,t,r){const{feePolicy:o,privacyFeePercent:n,swapFeePercent:a,companyFeePercent:c}=s;let i=c;return r||(o==="user_pays_all"?(i+=a,t&&(i+=n)):o==="user_pays_privacy"&&t?i+=n:o==="user_pays_swap"&&(i+=a)),i}const Re=1e9,we={mint:"So11111111111111111111111111111111111111112",symbol:"SOL",name:"Solana",decimals:9,logoUrl:Bs},ye={mint:"other",symbol:"OTHER",name:"Other",decimals:6},Pr=1e4;function Bo(s,t){const r=t<s.publicMinUsd,o=t>=s.privateMinUsd,n=[],a=!r&&o&&(s.feePolicy==="user_pays_all"||s.feePolicy==="user_pays_privacy")&&(s.privacyFeeFixedLamports>0||s.privacyFeePercent>0),c=!r&&(s.feePolicy==="user_pays_all"||s.feePolicy==="user_pays_swap")&&(s.swapFeeFixedLamports>0||s.swapFeePercent>0),i=s.companyFeeFixedLamports>0||s.companyFeePercent>0;if(a){const d=s.privacyFeeFixedLamports/Re,u=s.privacyFeePercent,p=d*s.solPriceUsd,f=t*(u/100);n.push({label:"Privacy",solAmount:d,percent:u,usdAmount:p+f})}if(c){const d=s.swapFeeFixedLamports/Re,u=s.swapFeePercent,p=d*s.solPriceUsd,f=t*(u/100);n.push({label:"Swap",solAmount:d,percent:u,usdAmount:p+f})}if(i){const d=s.companyFeeFixedLamports/Re,u=s.companyFeePercent,p=d*s.solPriceUsd,f=t*(u/100);n.push({label:"Service",solAmount:d,percent:u,usdAmount:p+f})}return n}function Lr(s,t,r){const o=Bo(s,t),n=r<.01?.01:r;if(o.length===0)return`Total: $${n.toFixed(2)}`;const a=o.reduce((m,g)=>m+g.solAmount,0),c=o.reduce((m,g)=>m+g.percent,0),i={fee:7,sol:8,rate:7,usd:8},d=m=>{const g=m.label.padEnd(i.fee),y=m.solAmount.toFixed(4).padStart(6).padEnd(i.sol),v=(m.percent.toFixed(2)+"%").padStart(5).padEnd(i.rate),x=("$"+Math.max(m.usdAmount,.01).toFixed(2)).padEnd(i.usd);return`${g} │ ${y} │ ${v} │ ${x}`},u=`${"Fee".padEnd(i.fee)} │ ${"SOL".padEnd(i.sol)} │ ${"+ Rate".padEnd(i.rate)} │ ${"= Total".padEnd(i.usd)}`,p=`${"─".repeat(i.fee)}─┼─${"─".repeat(i.sol)}─┼─${"─".repeat(i.rate)}─┼─${"─".repeat(i.usd)}`,f=("$"+n.toFixed(2)).padEnd(i.usd),h=`${"TOTAL".padEnd(i.fee)} │ ${a.toFixed(4).padStart(6).padEnd(i.sol)} │ ${(c.toFixed(2)+"%").padStart(5).padEnd(i.rate)} │ ${f}`;return[u,p,...o.map(d),p,h].join(`
|
|
2059
|
+
`)}function Fo(s){const t=[],r=s.privacyFeeFixedLamports>0||s.privacyFeePercent>0,o=s.swapFeeFixedLamports>0||s.swapFeePercent>0,n=s.companyFeeFixedLamports>0||s.companyFeePercent>0;return r&&t.push("Privacy Cash fee"),o&&t.push("swap fee"),n&&t.push("company service fee"),t.length===0?"No processing fees apply to deposits.":"A small fee may apply. We'll show exact totals before you confirm."}function Qe(s,t){if(t<=0)return 0;const r=t<s.publicMinUsd,o=t>=s.privateMinUsd,n=Do(s,o,r);let a=s.companyFeeFixedLamports;r||(o&&(s.feePolicy==="user_pays_all"||s.feePolicy==="user_pays_privacy")&&(a+=s.privacyFeeFixedLamports),(s.feePolicy==="user_pays_all"||s.feePolicy==="user_pays_swap")&&(a+=s.swapFeeFixedLamports));const c=a/Re*s.solPriceUsd,i=t*(n/100);return c+i}function Tr(s,t,r){return s==="sol"?"SOL":s==="single-token"?t.symbol:r.some(n=>n.symbol==="USDC")?"SOL or USDC":"SOL or supported tokens"}function Et(s){return s.map(t=>t.trim()).filter(Boolean)}const Mr=new Set(["USDC","USDT","USD1","PYUSD","USDH","CASH"]);function Rr(s,t,r){if(Mr.has(s.symbol))return 1;const o=t.tokenPrices?.[s.symbol];if(o&&o>0)return o;if(s.symbol==="SOL")return t.solPriceUsd||null;const n=r?.[s.symbol];return n&&n>0?n:null}function Dr(s,t){const r=Mr.has(t)?2:4;return s.toFixed(r)}function Uo({config:s,currencyMode:t,depositMethod:r,tokens:o=[],defaultToken:n,minAmount:a,maxAmount:c=1e4,onSuccess:i,onError:d,onCancel:u,onUnlockRequired:p,onAuthorize:f,className:h="",showStepIndicator:w=!0,pollInterval:m=5e3,demoMode:g=!1,demoAutoConfirmMs:y,tokenPriceUsd:v,showExplainer:x=!1,siteName:j,explainerConfig:C}){const{deposit:k,getStatus:b,error:S,clearError:T}=Cr(),N=A.useWallet(),L=Et(s.quickActionTokens),E=Et(s.customTokenSymbols),P=l.useMemo(()=>{const W=s.customTokens??[];if(W.length===0)return o;const V=new Set(o.map(G=>G.symbol)),K=[...o];for(const G of W)V.has(G.symbol)||(K.push({mint:G.mint,symbol:G.symbol,name:G.symbol,decimals:G.decimals,logoUrl:G.logoUrl}),V.add(G.symbol));return K},[o,s.customTokens]),M=l.useMemo(()=>{if(E.length===0)return P;const W=P.filter(V=>E.includes(V.symbol));return W.length>0?W:P},[P,E]),B=s.privateDepositsEnabled,I=r?r==="sign"&&!B?"receive":r:B&&N.hasExternalWallet?"sign":"receive",D=L[0]?P.find(W=>W.symbol===L[0]):void 0,H=t==="sol"?we:t==="single-token"?D??P.find(W=>W.symbol==="USDC")??P[0]??we:n??D??P.find(W=>W.symbol==="USDC")??P.find(W=>W.symbol!=="SOL")??P[0]??we,z=l.useCallback(()=>x?"explainer":"unlock",[x]),[R,U]=l.useState(z),[F,$]=l.useState(H),[ae,X]=l.useState(""),[oe,se]=l.useState(null),[_,q]=l.useState(null),[Y,Z]=l.useState(null),[ne,Q]=l.useState(null),[de,xe]=l.useState(!1),[Ur,He]=l.useState(!1),[ke,Ws]=l.useState(null);l.useEffect(()=>{U(z()),$(H),X(""),se(null),q(null),Z(null),Q(null),xe(!1),He(!1),Ws(null),T()},[t,I,H,T,z]);const Ir=a??s.privateMinSol,Wr=c,Ce=parseFloat(ae),Os=N.status==="enrolled_locked"||N.status==="enrolled_unlocked"||N.status==="unlocked",Ke=Os&&N.isUnlocked,Ye=Os&&!N.isUnlocked,qs=l.useCallback(()=>{let K=I==="sign"?[{key:"unlock",label:"Authorize"},{key:"confirm",label:"Send"},{key:"signing",label:"Signing"},{key:"success",label:"Complete"}]:[{key:"unlock",label:"Authorize"},{key:"show-address",label:"Send"},{key:"waiting",label:"Confirming"},{key:"success",label:"Complete"}];return x&&(K=[{key:"explainer",label:"Info"},...K]),K},[I,x])(),Or=qs.findIndex(W=>W.key===R),_s=l.useCallback(W=>{$(W)},[]),qr=l.useCallback(async W=>{if(!f){U(I==="sign"?"confirm":"show-address");return}He(!0),q(null);try{const K=await f(W,I==="sign"?Ce:null,F);Z(K.sessionId),Q(K.depositAddress),U(I==="sign"?"confirm":"show-address")}catch(V){const K=V instanceof Error?V:new Error("Authorization failed");q(K.message)}finally{He(!1)}},[f,I,Ce,F]),_r=l.useCallback(async(W,V)=>{T(),q(null),U("signing");const K=W??Ce,G=V??F;if(!g){if(Ye&&p){p(),U("confirm");return}if(!Ke){q("Wallet not ready"),U("error");return}}try{const te=Math.floor(K*Math.pow(10,G.decimals));if(g){await new Promise(Pe=>setTimeout(Pe,1500));const Ee={token:t==="sol"?null:G,amount:K,amountSmallestUnit:te,txSignature:`demo-tx-${Date.now()}`,sessionId:Y||`demo-session-${Date.now()}`,response:{sessionId:Y||`demo-session-${Date.now()}`,txSignature:`demo-tx-${Date.now()}`,amountLamports:te,message:"Demo deposit successful",withdrawalAvailableAt:new Date(Date.now()+1440*60*1e3).toISOString()},method:"sign"};se(Ee),U("success"),i?.(Ee);return}const ee=await k(te),Se={token:t==="sol"?null:G,amount:K,amountSmallestUnit:te,txSignature:ee.txSignature,sessionId:ee.sessionId,response:ee,method:"sign"};se(Se),U("success"),i?.(Se)}catch(te){const ee=te instanceof Error?te:new Error("Deposit failed");q(ee.message),U("error"),d?.(ee)}},[k,Ce,F,t,g,Y,Ke,Ye,p,i,d,T]),$r=l.useCallback(()=>{U("waiting")},[]),Ge=l.useCallback(async()=>{const W=ne||N.solanaPubkey;if(W)try{await navigator.clipboard.writeText(W),xe(!0),setTimeout(()=>xe(!1),2e3)}catch{const V=document.createElement("textarea");V.value=W,document.body.appendChild(V),V.select(),document.execCommand("copy"),document.body.removeChild(V),xe(!0),setTimeout(()=>xe(!1),2e3)}},[ne,N.solanaPubkey]);l.useEffect(()=>{if(!(R==="confirm"||R==="show-address"||R==="waiting")||!Y||g)return;let V=!1,K=0;const G=360,te=async()=>{if(!(V||K>=G)){K++;try{const ee=await b(Y);if(ee.status==="completed"||ee.status==="detected"){const Se=ee.amountLamports?ee.amountLamports/Math.pow(10,F.decimals):0,Ee=ee.amountLamports||0,Pe={token:t==="sol"?null:F,amount:Se,amountSmallestUnit:Ee,txSignature:ee.txSignature||"",sessionId:Y,response:ee,method:"receive",depositAddress:N.solanaPubkey??void 0};se(Pe),U("success"),i?.(Pe);return}}catch{}V||setTimeout(te,m)}};return te(),()=>{V=!0}},[R,Y,g,b,F,t,N.solanaPubkey,i,m]),l.useEffect(()=>{if(!g||!y||R!=="waiting"||I!=="receive"||!ne)return;const W=window.setTimeout(()=>{const V=ke??s.privateMinUsd,K=F.symbol==="SOL"&&s.solPriceUsd>0?V/s.solPriceUsd:V,G=Math.floor(K*Math.pow(10,F.decimals)),te={token:t==="sol"?null:F,amount:K,amountSmallestUnit:G,txSignature:`demo-tx-${Date.now()}`,sessionId:Y||`demo-session-${Date.now()}`,response:{sessionId:Y||`demo-session-${Date.now()}`,txSignature:`demo-tx-${Date.now()}`,amountLamports:G,message:"Demo deposit detected",withdrawalAvailableAt:new Date(Date.now()+1440*60*1e3).toISOString()},method:"receive",depositAddress:ne??void 0};se(te),U("success"),i?.(te)},y);return()=>window.clearTimeout(W)},[g,y,R,I,ne,ke,s,F,t,Y,i]);const zr=l.useCallback(()=>{U(z()),X(""),se(null),q(null),T()},[z,T]);return s.enabled?e.jsxs("div",{className:`cedros-deposit-flow ${h}`,children:[w&&R!=="error"&&e.jsx("div",{className:"cedros-deposit-flow-steps",children:qs.map((W,V)=>{const K=Or>=V,G=W.key===R;return e.jsxs("div",{className:`cedros-deposit-flow-step-item ${K?"step-active":""}`,children:[e.jsx("div",{className:`cedros-deposit-flow-step-circle ${K?"active":""} ${G?"current":""}`,children:V+1}),e.jsx("span",{className:`cedros-deposit-flow-step-label ${K?"active":""}`,children:W.label})]},W.key)})}),e.jsxs("div",{className:"cedros-deposit-flow-content",children:[R==="explainer"&&e.jsx(Io,{siteName:j,config:C,depositConfig:s,currencyMode:t,token:F,tokens:M,onContinue:()=>U("unlock"),onCancel:u}),R==="unlock"&&e.jsx(Wo,{token:F,tokens:M,currencyMode:t,depositMethod:I,isAuthorizing:Ur,error:_,onAuthorize:qr,onBack:x?()=>U("explainer"):void 0,onCancel:u}),R==="confirm"&&I==="sign"&&e.jsx(Oo,{token:F,tokens:P,quickActionSymbols:L,customTokenSymbols:E,currencyMode:t,minAmount:Ir,maxAmount:Wr,depositAddress:ne||N.solanaPubkey,walletReady:Ke||g,needsUnlock:Ye&&!g,copied:de,isListening:!!Y&&!g,config:s,onCopy:Ge,onTokenSelect:_s,onUnlockRequired:p,onConfirm:(W,V)=>_r(W,V),onBack:()=>U("unlock"),onCancel:u}),R==="signing"&&e.jsx(qo,{depositAddress:N.solanaPubkey}),R==="show-address"&&e.jsx(_o,{token:F,tokens:P,quickActionSymbols:L,customTokenSymbols:E,tokenPriceUsd:v,currencyMode:t,depositAddress:ne||N.solanaPubkey,copied:de,isListening:!!Y&&!g,config:s,onCopy:Ge,onTokenSelect:_s,onAmountChange:Ws,onSent:$r,onBack:()=>U("unlock"),onCancel:u}),R==="waiting"&&e.jsx($o,{token:F,depositAddress:ne||N.solanaPubkey,copied:de,feeLine:ke?`Fees: $${Math.max(Qe(s,ke),.01).toFixed(2)} total`:"Fees: calculated after deposit",onCopy:Ge}),R==="success"&&oe&&e.jsx(zo,{result:oe,config:s,onNewDeposit:zr}),R==="error"&&e.jsx(Vo,{error:_||S||"An error occurred",onRetry:()=>U("confirm"),onCancel:u})]})]}):e.jsx("div",{className:`cedros-deposit-flow cedros-deposit-flow-disabled ${h}`,children:e.jsx("p",{children:"Deposits are not currently available."})})}function Io({siteName:s,config:t,depositConfig:r,currencyMode:o,token:n,tokens:a,onContinue:c,onCancel:i}){const d=t?.title??"How Deposits Work",u=t?.exchangeName??"Coinbase",p=O.sanitizeExternalUrl(t?.exchangeUrl)??"https://www.coinbase.com",f=t?.showExchangeSuggestion!==!1,h=Tr(o,n,a),w=s?`${s} uses the Solana blockchain to process secure, private payments.`:"This site uses the Solana blockchain to process secure, private payments.",m=t?.body??w,g=Ro(r),y=Fo(r);return e.jsxs("div",{className:"cedros-deposit-flow-step",children:[e.jsx("h4",{className:"cedros-deposit-flow-step-title",children:d}),e.jsx("p",{className:"cedros-deposit-flow-step-desc",children:m}),e.jsxs("div",{className:"cedros-deposit-flow-explainer-content",children:[e.jsxs("div",{className:"cedros-deposit-flow-explainer-item",children:[e.jsx("span",{className:"cedros-deposit-flow-explainer-icon cedros-deposit-flow-icon-shield"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Private & Secure"}),e.jsx("p",{children:"Your deposits are protected by cryptographic privacy technology."})]})]}),e.jsxs("div",{className:"cedros-deposit-flow-explainer-item",children:[e.jsx("span",{className:"cedros-deposit-flow-explainer-icon cedros-deposit-flow-icon-bolt"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Fast Transactions"}),e.jsx("p",{children:"Solana transactions confirm in seconds, not minutes."})]})]}),e.jsxs("div",{className:"cedros-deposit-flow-explainer-item",children:[e.jsx("span",{className:"cedros-deposit-flow-explainer-icon cedros-deposit-flow-icon-coin"}),e.jsxs("div",{children:[e.jsx("strong",{children:g?"Transparent Fees":"Low Fees"}),e.jsx("p",{children:y})]})]})]}),f&&e.jsx("div",{className:"cedros-deposit-flow-explainer-exchange",children:e.jsxs("p",{className:"cedros-deposit-flow-explainer-exchange-text",children:[e.jsx("strong",{children:"New to Solana?"})," You can purchase ",h," using your credit card at"," ",e.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",children:u}),", then send it here to fund your account."]})}),e.jsxs("div",{className:"cedros-deposit-flow-actions",children:[i&&e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-secondary",onClick:i,children:"Cancel"}),e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-primary",onClick:c,children:"Continue"})]})]})}function Wo({token:s,tokens:t,currencyMode:r,depositMethod:o,isAuthorizing:n,error:a,onAuthorize:c,onBack:i}){const[d,u]=l.useState(""),p=Tr(r,s,t),f=h=>{h.preventDefault(),d.trim()&&c(d)};return e.jsxs("div",{className:"cedros-deposit-flow-step",children:[e.jsx("h4",{className:"cedros-deposit-flow-step-title",children:"Authorize Deposit"}),e.jsx("p",{className:"cedros-deposit-flow-step-desc",children:o==="sign"?r==="multi-token"?"Enter your password to authorize a deposit. This allows us to process your withdrawal when the privacy period ends.":`Enter your password to authorize a ${p} deposit. This allows us to process your withdrawal when the privacy period ends.`:r==="multi-token"?"Enter your password to get your deposit address. Any supported token sent to this address will be credited to your account.":`Enter your password to get your deposit address. Any ${p} sent to this address will be credited to your account.`}),e.jsxs("form",{onSubmit:f,children:[e.jsxs("div",{className:"cedros-deposit-flow-field",children:[e.jsx("label",{className:"cedros-deposit-flow-label",htmlFor:"deposit-password",children:"Password"}),e.jsx("input",{id:"deposit-password",type:"password",value:d,onChange:h=>u(h.target.value),className:"cedros-deposit-flow-input",placeholder:"Enter your password",disabled:n,autoComplete:"current-password"})]}),a&&e.jsx("p",{className:"cedros-deposit-flow-error",children:a}),e.jsxs("div",{className:"cedros-deposit-flow-actions",children:[e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-secondary",onClick:i,disabled:n,children:"Back"}),e.jsx("button",{type:"submit",className:"cedros-deposit-flow-button cedros-deposit-flow-button-primary",disabled:!d.trim()||n,children:n?"Authorizing...":"Continue"})]})]})]})}function Oo({token:s,tokens:t,quickActionSymbols:r,customTokenSymbols:o,currencyMode:n,minAmount:a,maxAmount:c,depositAddress:i,walletReady:d,needsUnlock:u,copied:p,isListening:f,config:h,onCopy:w,onTokenSelect:m,onUnlockRequired:g,onConfirm:y,onBack:v}){const[x,j]=l.useState(h.privateMinUsd),[C,k]=l.useState(!1),[b,S]=l.useState(!1),[T,N]=l.useState(0),[L,E]=l.useState(null),M=Ve(x,h)==="sol_micro",B=s.symbol===ye.symbol,I=l.useMemo(()=>{const _=o.length===0?t:t.filter(Z=>o.includes(Z.symbol)),q=_.length>0?_:t;return q.some(Z=>Z.symbol===ye.symbol)?q:[...q,ye]},[t,o]),D=Qe(h,x),H=D<.01?.01:D,z=B?"Fees: calculated after deposit":`Fees: $${H.toFixed(2)} total`,R=B?"":Lr(h,x,D),U=Rr(M?we:s,h),F=U?x/U:s.symbol==="SOL"&&h.solPriceUsd>0?x/h.solPriceUsd:x,$=F?Dr(F,M?"SOL":s.symbol):null,X=x-D<=0&&x>0,oe=!B&&x>0&&!X&&F>=a&&F<=c;l.useEffect(()=>{if(n==="multi-token")if(M&&s.symbol!=="SOL"){E(s);const _=t.find(q=>q.symbol==="SOL");_&&m(_)}else!M&&L&&s.symbol==="SOL"&&(m(L),E(null))},[M,s.symbol,n,t,m,L,s]);const se=()=>{oe&&y(F,s)};return e.jsxs("div",{className:"cedros-deposit-flow-step",children:[e.jsx("h4",{className:"cedros-deposit-flow-step-title",children:"Choose Amount"}),e.jsx("p",{className:"cedros-deposit-flow-step-desc",children:"Set how much you want to deposit. Higher tiers unlock privacy."}),n==="multi-token"&&!M&&e.jsxs("div",{className:"cedros-deposit-flow-field",children:[e.jsx("label",{className:"cedros-deposit-flow-label",children:"Token"}),e.jsxs("div",{className:"cedros-deposit-flow-token-quick",children:[r.map(_=>{const q=t.find(Z=>Z.symbol===_),Y=s.symbol===_;return e.jsxs("button",{type:"button",className:`cedros-deposit-flow-token-quick-btn ${Y?"is-active":""}`,onClick:()=>{q&&(k(!1),m(q))},disabled:!q,children:[q?.logoUrl&&e.jsx("img",{className:"cedros-deposit-flow-token-quick-icon",src:q.logoUrl,alt:`${_} logo`}),_]},_)}),e.jsx("button",{type:"button",className:`cedros-deposit-flow-token-quick-btn ${C?"is-active":""}`,onClick:()=>{k(!0),N(_=>_+1)},children:"Custom"})]}),C&&e.jsx("div",{className:"cedros-deposit-flow-token-custom",children:e.jsx(Ds,{tokens:I,selectedToken:s,onSelect:m,openSignal:T})})]}),e.jsx("div",{className:"cedros-deposit-flow-field",children:e.jsx(Us,{config:h,valueUsd:x,onChange:j,maxUsd:Pr})}),e.jsxs("div",{className:"cedros-deposit-flow-field",children:[e.jsx("label",{className:"cedros-deposit-flow-label",children:B?"Sign to send tokens to this address":`Sign to send ${$??"--"} ${M?"SOL":s.symbol} to this address`}),e.jsxs("div",{className:"cedros-deposit-flow-address-box",children:[e.jsx("code",{className:"cedros-deposit-flow-address",children:i||"Loading..."}),e.jsxs("div",{className:"cedros-deposit-flow-address-actions",children:[e.jsx("button",{type:"button",className:"cedros-deposit-flow-copy-btn cedros-deposit-flow-copy-icon",onClick:w,title:"Copy address",disabled:!i,children:p?"✓":"⧉"}),i&&e.jsx("a",{className:"cedros-deposit-flow-copy-btn cedros-deposit-flow-copy-link cedros-deposit-flow-copy-icon",href:`https://orbmarkets.io/account/${i}`,target:"_blank",rel:"noopener noreferrer",title:"View on Orb Markets",children:"↗"})]})]}),p&&e.jsx("p",{className:"cedros-deposit-flow-copied-msg",children:"Copied!"})]}),X&&e.jsx("div",{className:"cedros-deposit-flow-warning",children:e.jsx("p",{children:"Deposit amount is less than the fees. Increase the amount to proceed."})}),e.jsxs("div",{className:"cedros-deposit-flow-info-stack",children:[e.jsxs("div",{className:"cedros-deposit-flow-info-item",children:[e.jsx("span",{className:"cedros-deposit-flow-info-dot"}),e.jsx("span",{children:"Send only on the Solana network."})]}),e.jsxs("div",{className:"cedros-deposit-flow-info-item",children:[e.jsx("span",{className:"cedros-deposit-flow-info-dot"}),e.jsxs("span",{children:[z,e.jsx("button",{type:"button",className:`cedros-deposit-flow-fee-info ${b?"is-open":""}`,"data-tooltip":R,"aria-label":`Fee breakdown: ${R.replaceAll(`
|
|
2060
|
+
`,", ")}`,"aria-expanded":b,onClick:_=>{_.stopPropagation(),S(q=>!q)},onBlur:()=>S(!1),onKeyDown:_=>{_.key==="Escape"&&S(!1)},children:"i"})]})]}),e.jsxs("div",{className:"cedros-deposit-flow-info-item",children:[e.jsx("span",{className:"cedros-deposit-flow-info-dot"}),e.jsx("span",{children:"Credits appear after network confirmation."})]})]}),f&&e.jsx("div",{className:"cedros-deposit-flow-info-banner",children:"Listening for incoming transfers. We will confirm automatically."}),u&&e.jsxs("div",{className:"cedros-deposit-flow-warning",children:[e.jsx("p",{children:"Your wallet is locked. Unlock it to continue."}),g&&e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-secondary",onClick:g,children:"Unlock Wallet"})]}),e.jsxs("div",{className:"cedros-deposit-flow-actions",children:[e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-secondary",onClick:v,children:"Back"}),e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-primary",onClick:se,disabled:!oe||!d||!i,children:"Deposit"})]})]})}function qo({depositAddress:s}){return e.jsxs("div",{className:"cedros-deposit-flow-step cedros-deposit-flow-step-centered",children:[e.jsx("div",{className:"cedros-deposit-flow-spinner"}),e.jsx("h4",{className:"cedros-deposit-flow-step-title",children:"Signing Transfer"}),e.jsx("p",{className:"cedros-deposit-flow-step-desc",children:"Approve the transfer in your wallet extension..."}),s&&e.jsxs("p",{className:"cedros-deposit-flow-signing-dest",children:["Sending to:"," ",e.jsxs("code",{children:[s.slice(0,6),"...",s.slice(-4)]})]})]})}function _o({token:s,tokens:t,quickActionSymbols:r,customTokenSymbols:o,tokenPriceUsd:n,currencyMode:a,depositAddress:c,copied:i,isListening:d,config:u,onCopy:p,onTokenSelect:f,onAmountChange:h,onSent:w,onBack:m}){const[g,y]=l.useState(u.privateMinUsd),[v,x]=l.useState(!1),[j,C]=l.useState(!1),[k,b]=l.useState(0),[S,T]=l.useState(null),L=Ve(g,u)==="sol_micro",E=s.symbol===ye.symbol,P=l.useMemo(()=>{const F=o.length===0?t:t.filter(X=>o.includes(X.symbol)),$=F.length>0?F:t;return $.some(X=>X.symbol===ye.symbol)?$:[...$,ye]},[t,o]),M=Qe(u,g),B=M<.01?.01:M,I=E?"Fees: calculated after deposit":`Fees: $${B.toFixed(2)} total`,D=E?"":Lr(u,g,M),H=E||g>0,z=Rr(L?we:s,u,n),R=z?g/z:null,U=R?Dr(R,s.symbol):null;return l.useEffect(()=>{if(a==="multi-token")if(L&&s.symbol!=="SOL"){T(s);const F=t.find($=>$.symbol==="SOL");F&&f(F)}else!L&&S&&s.symbol==="SOL"&&(f(S),T(null))},[L,s.symbol,a,t,f,S,s]),l.useEffect(()=>{h(g)},[g,h]),c?e.jsxs("div",{className:"cedros-deposit-flow-step",children:[e.jsx("h4",{className:"cedros-deposit-flow-step-title",children:"Send Deposit"}),e.jsx("p",{className:"cedros-deposit-flow-step-desc",children:"Send funds to your deposit address. We'll confirm automatically."}),a==="multi-token"&&!L&&e.jsxs("div",{className:"cedros-deposit-flow-field",children:[e.jsx("label",{className:"cedros-deposit-flow-label",children:"Token"}),e.jsxs("div",{className:"cedros-deposit-flow-token-quick",children:[r.map(F=>{const $=t.find(X=>X.symbol===F),ae=s.symbol===F;return e.jsxs("button",{type:"button",className:`cedros-deposit-flow-token-quick-btn ${ae?"is-active":""}`,onClick:()=>{$&&(x(!1),f($))},disabled:!$,children:[$?.logoUrl&&e.jsx("img",{className:"cedros-deposit-flow-token-quick-icon",src:$.logoUrl,alt:`${F} logo`}),F]},F)}),e.jsx("button",{type:"button",className:`cedros-deposit-flow-token-quick-btn ${v?"is-active":""}`,onClick:()=>{x(!0),b(F=>F+1)},children:"Custom"})]}),v&&e.jsx("div",{className:"cedros-deposit-flow-token-custom",children:e.jsx(Ds,{tokens:P,selectedToken:s,onSelect:f,openSignal:k})})]}),!E&&e.jsxs("div",{className:"cedros-deposit-flow-field",children:[e.jsx("label",{className:"cedros-deposit-flow-label",children:"Deposit Amount"}),e.jsx(Us,{config:u,valueUsd:g,onChange:y,maxUsd:Pr})]}),E&&e.jsx("div",{className:"cedros-deposit-flow-note",children:"Send any token you want. We'll detect the deposit, swap it, and credit your balance automatically."}),e.jsxs("div",{className:"cedros-deposit-flow-field",children:[e.jsx("label",{className:"cedros-deposit-flow-label",children:E?"Send any token to this address":`Send ${U??"--"} ${L?"SOL":s.symbol} to this address`}),e.jsxs("div",{className:"cedros-deposit-flow-address-box",children:[e.jsx("code",{className:"cedros-deposit-flow-address",children:c}),e.jsx("button",{type:"button",className:"cedros-deposit-flow-copy-btn",onClick:p,title:"Copy address",children:i?"✓":"📋"})]}),i&&e.jsx("p",{className:"cedros-deposit-flow-copied-msg",children:"Copied!"})]}),e.jsxs("div",{className:"cedros-deposit-flow-info-stack",children:[e.jsxs("div",{className:"cedros-deposit-flow-info-item",children:[e.jsx("span",{className:"cedros-deposit-flow-info-dot"}),e.jsx("span",{children:"Send only on the Solana network."})]}),e.jsxs("div",{className:"cedros-deposit-flow-info-item",children:[e.jsx("span",{className:"cedros-deposit-flow-info-dot"}),e.jsxs("span",{children:[I,!E&&e.jsx("button",{type:"button",className:`cedros-deposit-flow-fee-info ${j?"is-open":""}`,"data-tooltip":D,"aria-label":`Fee breakdown: ${D.replaceAll(`
|
|
2061
|
+
`,", ")}`,"aria-expanded":j,onClick:F=>{F.stopPropagation(),C($=>!$)},onBlur:()=>C(!1),onKeyDown:F=>{F.key==="Escape"&&C(!1)},children:"i"})]})]}),e.jsxs("div",{className:"cedros-deposit-flow-info-item",children:[e.jsx("span",{className:"cedros-deposit-flow-info-dot"}),e.jsx("span",{children:"Credits appear after confirmation (typically ~30s)."})]})]}),d&&e.jsx("div",{className:"cedros-deposit-flow-info-banner",children:"Listening for your deposit. We'll notify you when it arrives."}),e.jsxs("div",{className:"cedros-deposit-flow-actions",children:[e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-secondary",onClick:m,children:"Back"}),e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-primary",onClick:w,disabled:!H,children:"I've Sent It"})]})]}):e.jsxs("div",{className:"cedros-deposit-flow-step cedros-deposit-flow-step-centered",children:[e.jsx("div",{className:"cedros-deposit-flow-error-icon",children:"!"}),e.jsx("h4",{className:"cedros-deposit-flow-step-title",children:"Wallet Not Ready"}),e.jsx("p",{className:"cedros-deposit-flow-step-desc",children:"Your embedded wallet is not set up. Please complete wallet enrollment first."})]})}function $o({token:s,depositAddress:t,copied:r,feeLine:o,onCopy:n}){return e.jsxs("div",{className:"cedros-deposit-flow-step cedros-deposit-flow-step-centered",children:[e.jsx("div",{className:"cedros-deposit-flow-spinner"}),e.jsx("h4",{className:"cedros-deposit-flow-step-title",children:"Waiting for Deposit"}),e.jsxs("p",{className:"cedros-deposit-flow-step-desc",children:["Looking for incoming ",e.jsx("strong",{children:s.symbol})," deposits..."]}),e.jsxs("div",{className:"cedros-deposit-flow-waiting-info",children:[e.jsx("p",{className:"cedros-deposit-flow-waiting-text",children:"Once your transaction is confirmed on the Solana network, your account will be credited automatically. This usually takes 20-30 seconds."}),t&&e.jsxs("div",{className:"cedros-deposit-flow-field",children:[e.jsx("label",{className:"cedros-deposit-flow-label",children:"Deposit address"}),e.jsxs("div",{className:"cedros-deposit-flow-address-box",children:[e.jsxs("code",{className:"cedros-deposit-flow-address",children:[t.slice(0,6),"...",t.slice(-6)]}),e.jsxs("div",{className:"cedros-deposit-flow-address-actions",children:[e.jsx("button",{type:"button",className:"cedros-deposit-flow-copy-btn cedros-deposit-flow-copy-icon",onClick:n,title:"Copy address",children:r?"✓":"⧉"}),e.jsx("a",{className:"cedros-deposit-flow-copy-btn cedros-deposit-flow-copy-link cedros-deposit-flow-copy-icon",href:`https://orbmarkets.io/account/${t}`,target:"_blank",rel:"noopener noreferrer",title:"View on Orb Markets",children:"↗"})]})]})]}),e.jsxs("div",{className:"cedros-deposit-flow-info-stack",children:[e.jsxs("div",{className:"cedros-deposit-flow-info-item",children:[e.jsx("span",{className:"cedros-deposit-flow-info-dot"}),e.jsx("span",{children:"Send only on the Solana network."})]}),e.jsxs("div",{className:"cedros-deposit-flow-info-item",children:[e.jsx("span",{className:"cedros-deposit-flow-info-dot"}),e.jsx("span",{children:o})]})]})]})]})}function zo({result:s,config:t,onNewDeposit:r}){const o=s.token??we,n=o.symbol==="SOL"&&t.solPriceUsd>0?s.amount*t.solPriceUsd:s.amount,a=Qe(t,n),c=Math.max(n-a,0),i=a<.01?.01:a;return e.jsxs("div",{className:"cedros-deposit-flow-step cedros-deposit-flow-step-centered",children:[e.jsx("div",{className:"cedros-deposit-flow-success-icon",children:"✓"}),e.jsx("h4",{className:"cedros-deposit-flow-step-title",children:"Deposit Successful!"}),e.jsxs("p",{className:"cedros-deposit-flow-step-desc",children:["Your deposit of ",s.amount.toLocaleString()," ",o.symbol," has been received."]}),e.jsxs("div",{className:"cedros-deposit-flow-summary",children:[e.jsxs("div",{className:"cedros-deposit-flow-summary-row",children:[e.jsx("span",{className:"cedros-deposit-flow-summary-label",children:"Transaction"}),e.jsxs("span",{className:"cedros-deposit-flow-summary-value cedros-deposit-flow-tx",children:[e.jsxs("a",{href:`https://orbmarkets.io/tx/${s.txSignature}`,target:"_blank",rel:"noopener noreferrer",children:[s.txSignature.slice(0,8),"...",s.txSignature.slice(-8)]}),e.jsx("a",{className:"cedros-deposit-flow-tx-action",href:`https://orbmarkets.io/tx/${s.txSignature}`,target:"_blank",rel:"noopener noreferrer","aria-label":"View transaction on Orb Markets",title:"View transaction",children:"↗"})]})]}),e.jsxs("div",{className:"cedros-deposit-flow-summary-row",children:[e.jsx("span",{className:"cedros-deposit-flow-summary-label",children:"Deposit Amount"}),e.jsxs("span",{className:"cedros-deposit-flow-summary-value",children:["$",n.toFixed(2)]})]}),e.jsxs("div",{className:"cedros-deposit-flow-summary-row",children:[e.jsx("span",{className:"cedros-deposit-flow-summary-label",children:"Total Fees"}),e.jsxs("span",{className:"cedros-deposit-flow-summary-value cedros-deposit-flow-fee",children:["-$",i.toFixed(2)]})]}),e.jsxs("div",{className:"cedros-deposit-flow-summary-row",children:[e.jsx("span",{className:"cedros-deposit-flow-summary-label",children:"Credits Added"}),e.jsxs("span",{className:"cedros-deposit-flow-summary-value cedros-deposit-flow-credit",children:["+$",c.toFixed(2)]})]}),e.jsxs("div",{className:"cedros-deposit-flow-summary-row",children:[e.jsx("span",{className:"cedros-deposit-flow-summary-label",children:"Available"}),e.jsx("span",{className:"cedros-deposit-flow-summary-value",children:"Immediately"})]})]}),e.jsx("div",{className:"cedros-deposit-flow-actions",children:e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-primary",onClick:r,children:"Make Another Deposit"})})]})}function Vo({error:s,onRetry:t,onCancel:r}){return e.jsxs("div",{className:"cedros-deposit-flow-step cedros-deposit-flow-step-centered",children:[e.jsx("div",{className:"cedros-deposit-flow-error-icon",children:"✕"}),e.jsx("h4",{className:"cedros-deposit-flow-step-title",children:"Deposit Failed"}),e.jsx("p",{className:"cedros-deposit-flow-error-message",children:s}),e.jsxs("div",{className:"cedros-deposit-flow-actions",children:[r&&e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-secondary",onClick:r,children:"Cancel"}),e.jsx("button",{type:"button",className:"cedros-deposit-flow-button cedros-deposit-flow-button-primary",onClick:t,children:"Try Again"})]})]})}const Qo="data:image/webp;base64,UklGRmIEAABXRUJQVlA4WAoAAAAIAAAAOwAAOwAAVlA4IIIDAADwDwCdASo8ADwAPm0qkUWkIqGWDVeYQAbEtgBOmZMBu+H816ov3b8R8R2g2FXtxdyh5s3+A60v0APLi9ktgGB/LZjWNAXqgpE6jfW0NF+P4xEhH2L7M+26iGwrTjjcQegyCZqxs+ifvZANjWd279diqZNKUrgOTVtjJGtW4IVtRhMECd5aWVgAAP7nDv3UY/8f1l//xTP/FM/8NU8c9g//sC3+bX/1HZXsNsM57VKG2LVf1a0KdncWO8uPo/Oh79m9ZqjJZwXfPXuvwkK+WDOl6+N8C2Ux6no/V/zkoucKK/JZek7MR5sS8TknXB+6BuVDXou9Rx4aUea2q2IzvLvFIujjKsVYLMab7j9zo48fhgm9YOtjmWuS0WZ4c+6ta0mr3xF4fcdAIFf6oXRSlqovOX0HUiMV//hXwSX1cfP5cLj8c7OTyT/4ce4olJARV95GoY8oF+2uU0blGul3ItlG7c2Hl2/uC6s2WZc7Zukwojx6ed8t97bZ68N1uzCLzPlG7BuYS17F19e0wXnc6vEl3q7ft0K7OEl7r8mY6Kh+Nt/5V/Lp68mFBjLem1JjvC371+lKwez4KCdXwNo2Z04FqyzGpFutY6YQ/r5Tfu7Oi+oNfN0R/W+D4aj1nqHhlqYJzpx2NK4mj0gJIXmX8EArelSQI8mV4Ux9MRPwC2PuZhLTjQZv+Vl4p0D8bSB+Z0rek3hS6G1r80fW3cn767Pz/bXanjVmm34wt1nQPqdJObrZ7vv2NWcEuQKj9d+V6DzeDrq0CtGNcanEB5MY9agi1E6BprEScTdfPXjBeMnPbpD+QO6P7IW4UZ9etCCHtX++S/fl5Iz5RzUr10ojRMw//35C0yTjSEhbe884dPwor64n//KByjUFEGsCPAAXPJp1+O+SiKfUaODq6ncjKayTHXjoXgM7XP1z4sBhIKJZJRiM7vGC/+v/Sk8/jbgZLZDAVz1vLou93y7Yd8hxcWM/BesxgWgeKvl8fjE/Ud8tQKp4425hWh66lzzwxa4J3ctA4/E50wX/eoBOgq0B7+7S6FK4wvPHSNgfh+vwSWIJsJLt/3yjBeb41RRyMDMZqFQTZPEdFpXp48ExEyDayZ6objbjTHoS5WQDnDQpRyqMNKfvd41nhEPdb/hxpzXeTIjWmfHHCT+CQYWXDqLehCh1cRyeYOBwsSlSw5PiquAbsgAARVhJRroAAABFeGlmAABJSSoACAAAAAYAEgEDAAEAAAABAAAAGgEFAAEAAABWAAAAGwEFAAEAAABeAAAAKAEDAAEAAAACAAAAEwIDAAEAAAABAAAAaYcEAAEAAABmAAAAAAAAAEgAAAABAAAASAAAAAEAAAAGAACQBwAEAAAAMDIxMAGRBwAEAAAAAQIDAACgBwAEAAAAMDEwMAGgAwABAAAA//8AAAKgBAABAAAAPAAAAAOgBAABAAAAPAAAAAAAAAA=",Ho="data:image/webp;base64,UklGRtgCAABXRUJQVlA4WAoAAAAIAAAAOwAAOwAAVlA4IPgBAABQCwCdASo8ADwAPm0wk0ekIqGhKBQMqIANiWkADPF3uV2D8VcQGk1mg+P36i9SLnZvYAQxszEWYzEwX1RVkqG/4BGbJgMSHqhKDFsjWsGfPPrvfef11goNmCDDlBJHVVD+8gAA/vu4q03kl+E7FpjtZ2gc8pQ619Hjv9NywoRZ6az43C1wcrRr/lWzJlJhLWMHN0MkVl1ueAf6Hn8StVzeUfMBXOKkgfe2msx7QWR5PnHW/5c6/35yrtWnrURc2q6UYlGin+v8C2dQqexkW6rX2EEijTI9eEQ46PWH3/59fM2AlMvvR2abaRk5XX7V1triQncRxvMfz5YmYDN+PY/ikcZUNaiFucKoUq5riv0eKCezuFNHecE11ojwJqWRSTWpalkz5autXp6vFS+FT1tWUsB/fs1CCOZxaA1vR1grOEaiuKe1RYm7e05psWtqbXLVmm1bA8Ly9PFkVdCbc6hR3UuBBsFGnVeGOUeMn2onnfvYhBMcM9YPxGdQkwZLXOk1VuQSTk01Shf3fZrFyRlFauftFdPYhKXwqrr+meav1P+KLKBVosqmHnFFfgExsQ/rOf3TSd+mOqQfJA+cF+HojNU7nmM3uDkoCBi+//Gqp+gPNNW8M4LFrol8rxE+7WsjqMgfwv1f+Nr25RtG1Wa/KkniRCAAAABFWElGugAAAEV4aWYAAElJKgAIAAAABgASAQMAAQAAAAEAAAAaAQUAAQAAAFYAAAAbAQUAAQAAAF4AAAAoAQMAAQAAAAIAAAATAgMAAQAAAAEAAABphwQAAQAAAGYAAAAAAAAASAAAAAEAAABIAAAAAQAAAAYAAJAHAAQAAAAwMjEwAZEHAAQAAAABAgMAAKAHAAQAAAAwMTAwAaADAAEAAAD//wAAAqAEAAEAAAA8AAAAA6AEAAEAAAA8AAAAAAAAAA==",Ko="data:image/webp;base64,UklGRhYJAABXRUJQVlA4WAoAAAAYAAAAOwAAOwAAQUxQSGICAAABkJz9nzon3/nNJGnBXRvBI0sDkR7slpRBaMDl5LByx7cEyBWHtWd+8/uiK/95uEfEBKBnFwRwk6Wjm89PW2Tj9OWNo7VxASQ4DDoIML9fbdLYpbFR21tykDAY8ZCLT9okqZrsD0uqJNl5sj6CIAPwDmdqRlNlz6o0vroE5/vlPObv0kyN/dVE3pmHd31xgt0P1MgBauTHLYjrg2DoClM0DtRi4kmA6ylgrMq2cuDaZm0CoQePyTqVhVTWJ+G7EozXqSyosj4K6cIhVBhZ2MjyMNy/BFcZWeDIE8g/PLaoLLRyF/4vgrlPTMVK/DQH+cPjGpUFV17/i6BEZeGVF+Dh4F/kUYGDR4nKDBPX4AX381Deh2C1Q8vB2F4CDqnMUrkPlPMpY+obLQ/j9+k1GjNNLB0z5hJ5fD0f5Y2XTLkkPn9Hy8X4vsGMW/xvt3JqvKflYnz3nCmXxJc3qLlEXj9mzOe4xJSLcW36Oy0P47cplKl5KMvAfj6HwFKbloOxswrBfWoOyvsQjzWmPErwcKhQi6d84eHgcSGPEgSA4Dq1aMpr8PjL3CemYiV+moP8AY9darGUW/D4u+CEsUiRVyH4p8NwmbE4kZUA9y8IRuvUoijr4xB06zFZpxZDWZ+ER/cBEzW2dXDaZnUMAb06hBOmaIOxmHhlCILenWDrI6MOIio/7kIc+uk85u+SSftkasZ78/AOffYOl17RqNqbqtFqZ+A8+i8BI+tPOiRNNdkfllSNZPvJRYEXDDQI3NJerUFjl8ZmbX8ekIBBuyCAjK8d3Xh52iBbp89vHl2ecIAEh54BVlA4IMwFAADQGwCdASo8ADwAPm0qkkYkIiGhLhtqqIANiWwAqSdaNo+beZFT37f+J9yXOd2J6HfQh5gH6edIDzAfst6vXoO9AD/Lf4DrAP2V9gDzY/+57F39p/3/7k+0RmjvYp/meic9ieyvJnZVfquF/a23ZOCHGT/sfDDjQ89zOL9Gewd+s3Vh/b32Gf28Ejb5ttLg9hoDiFb2tMW81eZU9Z1LHfdRSCsRMzHz0WT4BNgUakGf9oJtrGtVJFxHJfxAatIxnW1qjDi9i3DQtJp9pVNKlMoJEWdPKv3KaaFSlhd/aMGiir9CPcex5QAA+fpjxA6zfUamE3wS2zWwLVrt/fXA5+Wvx9j5SID0zuEHU2LisPUxvtRuIUwNrsUis8zy+IMpzft+ZSg+9gdx9e6+ZvPmtj4OByz5qo26J3rXhPy8LBXSpuPb+f+mP4CoTvYDhzQXh/SIGj8Ez1+W5MJ/Tkdw09wPCs3JuR3yoqO63FH/j81xW5Abr7tCdwfXwv3CXDtOcHwUqPCd1aiU2uT6XwgdnYqYygEXGKFx8nmaUvqSn9p8HmIA9dVTOoEnqYFjrNfWY034N2vjohd16cxnkP4PYvHkIOWa/FEUug7/qbJ/GFLPxNh6y9eQ//MzzXbcPwsT2chWXPBXNVF1S9dxv5NUuEueiw2kdebblQuvUSRLN+zx3VyT2lOzWBUqrzsTmeOlxjVcTA83H99r35O4X7WXNq7HExiWXxrdM/Ih4CvPJaEHPxUE/i6WIz6+VGq4RB3sBKl3P4M7/DLWAwCnwcpX228XezqQ4cS2tttWxLTc9cPd1ofek9qF9lpB8RvakdPnj2PruFA9W3iKbNdmgnb+mIpohHuUR73KdDDOHbyfAiOjPzzqomnIU3jcSt7LKOB/Op97sCk0yd18mVG3prs351B+xmCE2Zd3RFKL+mpMz5qcuAFAfRyodbggdgmFGkEGQ33VryYFl/upr31FGdI52sqzuxd7jZIsqCcznUH/gu+xaBw7wla49EmFNf+Ss+91i9Hsys0FS//Ktru1xWgkeEweX77y6Oot5tHQsDxgy0sAI85V7FmlpiiWXQdM12MGfCBfyRM+N23SjOdReeSILYCgsM3r33/54X+lfDVNj427MvbDFtKccqazlQ+iKqC//MvYwqyiJPL1ZbVoCEP774fKZA3D3qvsVPGlp9LPchpTs4mTJugt8qXl82RwXQCDNZXnbEois53E35hkRr+IJhndoRo1o2sZDoTgykbeOKiynPH03+BcUQ8zmxTmiVlHQym/LL3kRREnUlxs2zPPGb2E+Rpdib+LxOvFSmj9RfTZoYIJnrqNnBIXV2lt7xeZ0srf98JymJxrtr8lx69oSNZIReDddL+3iiUjh6lm7EcYuclqBaKp8q68geo7H1EvKy4nSRx5Q+uz4l/ypo2hVdwi9l+BHjZZmJ7lXkpNTRJ0gZpzquzN2vh/MZQALV6FZ6q4aofA9AJy1DVLdNjV8n6s9eFA5pazxwhLW4tgWMciGf5x6G7HqFPTL1ZL3l447zLGUkqAXjkeVaNmxZ2oNKIuTy6JDc0Z61Z2dgbsg6HwCX1/ux5sk82WsnNIO4CTnWKI1aCtQZaEsBf6hIl9n7VBsgZGIcPpqn7P4mbyf3EbfdfQ32qlawLuAxmDlwRsVsPkw7j4aKbvIBykNcsVXv0/X6UXXaAtw3feJnTwDak2qY6QpMLE9e7PJeuQQ8FXpqI5HoR82kd+DOwGH5F3OpuWsmEt8v7WQG8q1LMkg6vrl3I8047zMl1Yq0VwotbrsKJocsHgsbs/PGOO9v2s8U0Sju/71XRtG5skcy2msae3wixjlGR4i6ZfldMehQD1zf/FbWN9hnHfpq1Fh8+PSA9AzUi33qli8ixISbH+tw7CcumxvegMk88HMNZlVdnIEzIfyHrSdZ2S98yX2OYZw0+JyaBbQxI0fOr6KpuMD6FVGLrdN9dgOTgOPQgAAEVYSUa6AAAARXhpZgAASUkqAAgAAAAGABIBAwABAAAAAQAAABoBBQABAAAAVgAAABsBBQABAAAAXgAAACgBAwABAAAAAgAAABMCAwABAAAAAQAAAGmHBAABAAAAZgAAAAAAAABIAAAAAQAAAEgAAAABAAAABgAAkAcABAAAADAyMTABkQcABAAAAAECAwAAoAcABAAAADAxMDABoAMAAQAAAP//AAACoAQAAQAAADwAAAADoAQAAQAAADwAAAAAAAAA",Yo="data:image/webp;base64,UklGRo4EAABXRUJQVlA4WAoAAAAYAAAAOwAAOwAAQUxQSA4CAAABkGXb2to2V9/v6D1Jmd5CQ5GXPYXAJMrtPOJMoMzMzDgIPYY5+vVds6T/m0BEOGzAtm1IBlR2d8kXUMyaADjeuHr9V7qj3E5/XrvaOA5AHCqzFgHTFz9tUTmEyq1PF6cBqVWDOLjkwS6VPsu8KqnaewRU7j5KIjipgFiQfCf1IGch8wMlv9QhcWk4nLlL9Z4l6b3y7hmUvGQkmF1nnrMC85zrc5CozDUQtwamisNSDCmxjL5jpqxMzfhutFCCY3+5110CaI9/jhVIcPg/DxiIB/x/eKgijLxkRobTyxFEw7zVm0NqcYg5LNAzKD3n4QbmyRVqWCiXJyD9uN7z0Ha9Dw4N5gzOnHU4IMJ7egt8HuYWasIJnlg46fkYgul9qgWU+9PA2Z7b2FngnR3e49Qm1QbKzVPNnltZ8wozK2S8et0SN34wt0LOnynVCsp02xI7tKSqqXYsV7ZtD/lpeaEfNyw/k9evWuKK7XfQ9ruP9/RW/s74t872N1bw2MY8n0Acmlb/KQ04AJ8t5PkeEbpDnbmR2/5392FiOfRFlCuTkIGsMh/aPBeGZFLBYuiM1IIUZLOD0NnMNBMWZdE/4bLo32MQ0wxcJnsvhcnerRhSLvPPhcj8s5DIsmtU6Tj1L1U6zvcEElfrVlHyqGy3epC4om5Vsg3OlO50UQ2V6Qa65LWf6TZ1J/11faBLlpgAVlA4IJgBAADwCQCdASo8ADwAPm0ylEckIyIhKAoAgA2JaQATzh4OcBkEByVmbl5z9gD9U/+J2APQgLaX4twLu19/UVxAWN1IKXE4cIqJBhoyQ0yDYn61m3zk6T7FMg0AAP78+EMvGgC8jLXmcbbmqvufKjG8Tv1M9Krl47vOW74O/Rapv2DgXbg9iK6PrRQG/9d9+rF/ESxzbszVFn3GThrMBmsklj/LPWDQ0pKzG7EyjQL6p6gfUwMze+wPhzJpn8tMqlUVgq6/QSUVcgG+ztsi73rA3vl3n4baeF1INsbuosTXtnsotVYuTii6rscx9OUTvevYcPNvcL9MPhyWeCQw0qynnGtzCIw+oFRN0+TN1mqXkFyk/rFBcH+FHiI6s9XX5EWCKn5vTRt/0RbS687PiXPFC5Zk/Gk4+538IYi+HZDjvlQQWOH/vddfYTerQ5QqWJt1YuaZNThQ2u+/DtXfZPRy1iWWLR9SKFFtlGrqBKWF5nPRPWWMNA3OssvUtvCNBLBA4cn1whzy+SpbgLvnaepxiykjKsU/MhzgAABFWElGugAAAEV4aWYAAElJKgAIAAAABgASAQMAAQAAAAEAAAAaAQUAAQAAAFYAAAAbAQUAAQAAAF4AAAAoAQMAAQAAAAIAAAATAgMAAQAAAAEAAABphwQAAQAAAGYAAAAAAAAASAAAAAEAAABIAAAAAQAAAAYAAJAHAAQAAAAwMjEwAZEHAAQAAAABAgMAAKAHAAQAAAAwMTAwAaADAAEAAAD//wAAAqAEAAEAAAA8AAAAA6AEAAEAAAA8AAAAAAAAAA==",Go="data:image/webp;base64,UklGRqwEAABXRUJQVlA4WAoAAAAYAAAAOwAAOwAAQUxQSL8BAAABkGvbtmlLc5997yvbmW19gBnbDm2kjF5UmW3bthXZVZFdZ+81r+87Z1XlEaHIbSNlMstwos4XUBSTLAFQo/u01Zdf/yLDDze3zB/YwADJEoOoJAKg7oTdH4SF+XxiZlMgSESzwAJdVn2iUJzzOUMiLhQKf+/va2FtBLMBuu1zpHcsincUXhtoTKLsCTVX/KF3wrLhPLm/OWzZtjQWfZ7RhYyAC/lxMowpSzJYJAyFkZDQc21FBMUT7BqGjpHxf3m+XlEPUHE/f3vGgPzmw4awRUaTexkyJhwfNShctVgZXyJDXq4CUyjNy6Y4fVOBIkAPR2GcOE7Jm2NQ/RE9YzXht3a5VYvlOX0xF0fy+tp/ozBuQg6DzZYb6Bi7ed4rB5Mp/1Co4cNhLUo1StLxDIDqrynUoRswiF6nFnIxsDpnZ5WBW0GFZ1qZ8HfLDk5txHHsGDpSa6B0cXZEa+DsTr1M+P4qPdXwjynU4+1/a7oN3Sm6G+meSd27oHsHde++7puj+tYpv7G6b7vun6L7l6n+oZp/t7JmUNUqqhpJV5upakJVLaqqgVW1t6rmV401NGMc1djqH4rpIseSfyPFkgAAVlA4IAQCAABQDACdASo8ADwAPm0yk0akIyGhJgzogA2JaQAThroHvLxu+aPf5G2BYxv+B6XHzx6GPon/o+qz/tOAA/TM82gR0vnExWoiQRM36jlg2UIvwCSqySErzuguz9EP2x/7hsNazr91aIworWI7AAD+/TZ+6Ipl444OdT+2wU0Ov+T8oJuVP/vUbT/w1Jsv6Awnl6rvF/xetfOPt3gTQZZi0Y/AOx563J7CJkqTR/fc/n34zyeKzR80fhfv4ef+Hjhz/CX5aQo+58zg/FdE+7bLoophGfG0szI513EH+q+Gc73H1PFdJYf7CF8v5dhr3tMwEVX5Ji2ZxejK8xrf/E6nVXqlA4DrYNRP09InHc+fEqO/fH8xr+rMf4y1F9TOnwVffZblLoTP6lot0m/sh7sTiDQr0mIA8TiHoOffGDG6KzV+B3239udfhzD740gkRi/m53abX0Ku3vAgadgFFqL0vk8M/4aI+cI+0fbLW17mWGeMu21wSRRQiv5iNgGKR3vEGXAItcLDft1uUzWAfbe1X3zK/ymT7bA/76PB6UUknm+Y5MM4osurUXU/k7P38pN/3slnGfpFzjl4c3USY4mH9ZCJYUuC/kGEnq/yRPalPdODNFvW6s8MiQeQejYNRY0LsJ0WXkK8vXiDmihCivYAOPoSovesL7on+WAArDNM/BcQSQvCYABFWElGugAAAEV4aWYAAElJKgAIAAAABgASAQMAAQAAAAEAAAAaAQUAAQAAAFYAAAAbAQUAAQAAAF4AAAAoAQMAAQAAAAIAAAATAgMAAQAAAAEAAABphwQAAQAAAGYAAAAAAAAASAAAAAEAAABIAAAAAQAAAAYAAJAHAAQAAAAwMjEwAZEHAAQAAAABAgMAAKAHAAQAAAAwMTAwAaADAAEAAAD//wAAAqAEAAEAAAA8AAAAA6AEAAEAAAA8AAAAAAAAAA==",Jo="data:image/webp;base64,UklGRnIIAABXRUJQVlA4WAoAAAAYAAAAOwAAOwAAQUxQSK4BAAABkHPbtrE9+z73/RTbqWw7Lf+BbbNKbTudbZe2qy+VbVv3PmeHj05G6ohg4LaRounNMtN1voB42ABA5R7TNlx5+O7du9e3Tiwb0b4EgFyAOCQM1Z16+DWFUZC7m3uVB2zKQGBhe+77RGHonJffCL1zQuHDxQ1hrEmTatDjHIXOC2MgzpNf1tVJkWgsGhyihI7JIE74aUYp2ITFAoz9QO+ZAs7zanvkEilKbIkMJS5ANwoJmrCodYVOmBqh5zIEJjZc9xods4A4rrPGxGitrJSU71yNyH4Myl7JTEl+5zzYSH9nlkrxHBzxWUzLVEnhh+YI/gq3+UphpvA8m/s7/wg9M4bjFNg/0vplrxQ+rQEDg/xihmT23jxYJZ8UPq8OA5z77Wt405FDR4poSMjiAJhPRxUIu8D+UVonOhfNPEVHPM9juFacwo+1V6kJQ3Y9Sa8ljhPuUvRk4UdNWU9ST3b9n0W3iG5DumdS9y7o3kHVu6/75ii/dbpvrO7brvtPUf2X6f5DVf/dmpxBmauociRVbqbKCXW5qCoHVuXempxf1dZQtXFUbat/yKZTtSUBVlA4INwFAABwGgCdASo8ADwAPm0qj0WkIqEZ+zYAQAbEtgBOmZoZF+E8zGoP3X8VbcdLvma8t+jH0E+YB+ofSA8wH7VdQv0AP75/iOsG9ADy3/Y5/b/91fgI/Y7MOesb0e/q+TUR1vt7VO6mwG0imO70GM5/0P7BX6qelv7EP209lz9oDRea09ZR+SjhX7sBu/ZS7tG917rPgI3Q7XsB7luy2hAg/95C2Z1L362OH1oFziDY/K5gWoSytSAtiKvA/jW1MehBzdLzJfszPPBvGa15IYwIVRTjO2Hz5ZS9HjLMehwAAP64SgjD3qeg6NRe/Ok+iFhrG3pgglCfbam3yBaDUH36sUiQx0PB1ZZyOHq0ky+f97h6tJMvo0p9LkfXecWOFJ8J5G7yRPuL4tzGLT09QulTJw42xp2hd+lMgIa51XoHx/iftn8B2D3k92H5jOQr+uIXFHHK5FpcTG+qGEF+np0LiQa+vdW7/+ZzOLVRf7jR5X3ANPt93Ng92DW7NflVr6kMr88O/v2ZNb0vtgao2Am/R3CDKiNq89f86CT6r2L2g1oTui7H3E1yhSPQpEOz01I3fhfiMMv4weqKuoedxn/xLg5uzHa6Gte4C/dQYkG3ZFSy4CXQtRjftBrjX/Oj+HpSUPDsv0wPW+ml5NbBKDCj2f3SD8TVMf2ZfHrOkR602RVk2UmKC+H0Y9iK6k98vsgPINtz0II8X7Mj2nJkTC6IMLuQ8dNTUq9VXOnhXrdhNZoaH94ePo6baBl3hTGFAnD3/b+gR/vtbqV7wktuX6fpnjeTBe/Drp6z3neeANj/aX4CsU9w67nwYOjZhueCjxaDKUnNjLPjI1e0BoTbcOzOQ0wHJHZJ+Pt608StBu4HiJ8NjH46fnvXL3yiMoSvkAuwCE1AakA+eU1u3unyjl1/MnZQmbp8fzfsfrFesehLPcIkYdCiZ+52QbmINNTjEsvjuBuZRubBE+Laihppsxoo4efGIo0xkw0etu1+yzvkqp88w3pBq0mRl13gnnc+2zl6SmhwgmNFbz+F8qAqmdfJL8iaNSGEWlPlpczDDe62GBZMlBhQmq/XCn/1b+VazHvJXkoIFDF+wktMg+rKfLyfTlXdK0cs+Kn8h+rjMakkf3WLo1TftMLn+O+x/Gat+BGstJrM1xvCSSnHQY+NV4B4gRqyZ55gRNnqN/0lWrATOcHUaGXpkTIM/yxFjxcePcSFo+t2aJ5lShtVukETzRxaIXgRkpROeWQHWpTHOaexmXOzF0b833qJSoXMk2zB/uMrgDzKd7d3ohUz8Ra08WYKlAuMQD08bF4+jUepEspqPLoYLQ73TfmL+1LwKxyTV3gEu6WnxBPWPLnYIGYN9U47ZNlB+NgHgYtKTyii6060RAG+wN32WUVFxCZw0HMHnHFgwxD34L/anlpS7mOrjKgyuGYhFC7iHqTQHuoAO1ekBHV+rndnbETKfa1F7LxNLYq+dmJyytmQrJUCGjelorI1m/TMQNiFVrY4FCI1Gl2W1JsZsw9zA+Bh3JmjkC0H5/0JV6JotNMatJIZ4v5PqwJe3r8xd+FNS3ynccdu+xtVdc27qwVdoomciZD5oXYey9KAFSAKO594sBKZNWUJTLXnt0BJbdF8FkQYvg3DQajYY2p+ixd5Ag7o92gw0pVVDDOP+WQxiEmKqgWJyTBsnsBk2Bxi2Unsv8S/4PmE8Hy/vy+Mij+aTAKZvg716IHfHX0/JMeFfmAnsZ39Q0qkfdPtq6+CxbGZ7wKDsK/8l/MVGuyd6faJFt5wyoOXuNrr3JC9EoBmjcOzkVw/6RNP49poZ1xzsX3q7B4HGfI/XSfRQq3HeZ2j12d0E3gCAube4oExaT1sx/v8F+f61QOsGdSaqM2im6qOGkSRkrRQ7L8hvS8vEYJeVkAbFvX5ov7e/egYYNToMHj651c5/rCVYtB9Ned6GvGN8R0x3t7+lsf8+ofhHRzpyvwxd6c5pREZVOKnXzplhJ61mki4JmAAAABFWElGugAAAEV4aWYAAElJKgAIAAAABgASAQMAAQAAAAEAAAAaAQUAAQAAAFYAAAAbAQUAAQAAAF4AAAAoAQMAAQAAAAIAAAATAgMAAQAAAAEAAABphwQAAQAAAGYAAAAAAAAASAAAAAEAAABIAAAAAQAAAAYAAJAHAAQAAAAwMjEwAZEHAAQAAAABAgMAAKAHAAQAAAAwMTAwAaADAAEAAAD//wAAAqAEAAEAAAA8AAAAA6AEAAEAAAA8AAAAAAAAAA==",Xo="data:image/svg+xml,%3csvg%20width='88'%20height='88'%20viewBox='0%200%2088%2088'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='88'%20height='88'%20fill='url(%23paint0_linear_170_79)'/%3e%3crect%20x='25.6665'%20y='25.6667'%20width='11'%20height='36.6667'%20rx='1.83333'%20fill='white'/%3e%3crect%20x='51.3335'%20y='25.6667'%20width='11'%20height='36.6667'%20rx='1.83333'%20fill='white'/%3e%3crect%20x='29.3335'%20y='40.3333'%20width='29.3333'%20height='7.33333'%20fill='white'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_170_79'%20x1='-75.3077'%20y1='-55'%20x2='146.302'%20y2='148.167'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF00FF'/%3e%3cstop%20offset='0.531673'%20stop-color='%237A84FF'/%3e%3cstop%20offset='1'%20stop-color='%2305FAFF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Zo="data:image/webp;base64,UklGRh4HAABXRUJQVlA4WAoAAAAYAAAAOwAAOwAAQUxQSNwBAAABkFxbexpJnyR3z8y+ajXMkAnjnnOgbUUxEAHjkpldWQwzFUn6v3PGVNI/AUQEA7dt49gN3PXavTlfQDeNAeyqg4PL5buRyOhteXlwcJWtHU8qzUIBs+30g7/s4N8Hp7cZFAtpDc7Bbr8xplB8iFJBYvBC4fjGdgvnElqdwc6XFPGRnQxehC93wjgzbxRYf1UYA+dkiJSrG1DMV6zDoW+MkQmMkd8Owdl5AsvOM3gm0geeXwY7R/Tu0EcmM3re6cF2Rr/kTJiBMmPZh+2q/wtm4ozD9qrB0tucMhunvL0Upg1n6JmRnmda4HCckVkZeRyuMWjjF0peCD9vhK3jAgMzM/BCDQ576225m/bCwcA+qzS/PLUwDrsr1ZDdcAa3KtWQWzDYPKZoQDjeDJyoVEdOAPf0cA/Lf1F0IPy1fG8VWmXvgF4LnoOLDFoIvPiaUQuRr99pNr8dUZEj0YToQnfjreaQd7oL6T6Tuu+C7juo++6rfnOUv3W631jNb7v+P8U+1ZDAZxZG9R+q/e+GxcbPuRcRftkIq+pVVD2Srjdr94TDnJ6w7MGqedFhH1bVA6t67zk9/3ctzw+YAhvSc431KExyjjNHQ2zLcTRzq/8op0vKJd+OREbvUnJJAFZQOCBaBAAA8BUAnQEqPAA8AD5tMJRHJCMiISgb+1CADYlsAJ0zIUCfxfmY2f+0b2AbztDnPeKX0qPMp+wHrDehz0AP7J/o+tP9ADy3f23+C79yPYA/aqK9mONrQbuszbsEyALJNTfg+Z6NjG2v+ETCuvlr1q6QUqEiAMUndG/WwfnjJIOTfOBS4W1w0HjOJa1XQ2K33n2b07EOjOBapwKzyoA2erTBTnEKlFjllBy68GBjZ+UKnlzN/f5ibbb4gAD+i9OsnW0xUnmTpyhVasIKzTu0BsXnfBm4rHJqGMFJBUgTESDXEPcNjAeaHP8ck9qdNBH4L/h53tXgHeZttc7c4lwTa6U4Lziz8qUoy8ce0IMc5TFElawGj16tME0GzSSbUqgH7/tYA6huPsWM2z3GjP8b9y7paRbINxwYRtuE90I6QVsNrEkbhL1YfwxRXnuobOfSe3KFVamrvsOqwTCMqlNfjsR3pyoiZ+lYt3+AH6x4ZVNltbYI5KiVhgCu1isooK324ldloH3zhlefYKEwTCYfNjbeH5UiL7JSev+t/C+ftc3TkAHcsvrLCU6n5pYYY2Yr1kRq+r6XVzI6iXuA/TqwMk6xq1PmdzHOwKavncLjWJrk0uU/5E5WKqXM0tgl5s3pduHjb5aiAt0ikEisMyYwnIhDiSemPRdGON4RlwSb3OEpZjhuZqoyen4Sw/fULewt3hAZizeiPZx1o9LS3M/4r3v/M6/o5925VJcmxAf/yjsyjCz0mV+6NuIeWp8shrFaIGgeduVJoZ0Kys1WjSLuFg9QvF5LlkOZ2k7WrzSu4ucsUOS/X4wnQvB0RCnR1PCsU4NDdLfxvQITUgGIuVTJ7LR73PHzZam/Z21oy3euiU55ffITekwjR4SgVoPvhxbdBSyVePf/twm62pSK9IfgPGN+ttubhQub1ooVZymdQCrS3goEs6dlnl/6TVfkgxFyBfAORkZafeu/Va2vIgUBNUQd48W8oPiMFjx+SAKx1qm2IwCLnuhJGf9M4nCzu7oo43f+nBeT07IjB+FpFKRGFNvlpLEXhPclSgFkqeU1W2eNqW2zShCWkQkgfE1HAoNX3z+CQcRQJq+HkC2nSjFdFYT8UNYNS6lYcyVWzEnOos1qpsNRxnLqY2Dl5CCT3Yeg/qT8chfF9ZadFvzNTEIDlARoN//7IU23MtuLdpsAjsiGfBHuR7y4lemYPdD/9Cuff9Qn/r/xlhmB5x2Y9Z1yME3aANAb5+u3lYz01zUlWwakKVmv9fhaeu/YzQ7BXLlcb+cbaIF5t/COmObnt20zaTfjad542f7p7f2Xea134nvyPYS+EAgjM+GufHvl9tXCrrRbH0pn7kH2XEGx9VbO4mY54+QZa5kPr0j3AOEtKd7SJWjlg5TQfgIuB6KoLGainSwF+pPdiCmzEzAOa1eFwn//2VdDMeq42/bKH8U4orewhLh60ci/S0BRBuItNMc+v1+vxl0YyS5it4AAAEVYSUa6AAAARXhpZgAASUkqAAgAAAAGABIBAwABAAAAAQAAABoBBQABAAAAVgAAABsBBQABAAAAXgAAACgBAwABAAAAAgAAABMCAwABAAAAAQAAAGmHBAABAAAAZgAAAAAAAABIAAAAAQAAAEgAAAABAAAABgAAkAcABAAAADAyMTABkQcABAAAAAECAwAAoAcABAAAADAxMDABoAMAAQAAAP//AAACoAQAAQAAADwAAAADoAQAAQAAADwAAAAAAAAA",ei="data:image/svg+xml,%3csvg%20width='868'%20height='868'%20viewBox='0%200%20868%20868'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='434'%20cy='434'%20r='434'%20fill='%231B262D'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M234.563%20184H640.697C650.387%20184%20659.339%20189.164%20664.172%20197.542L782.495%20402.657C788.631%20413.294%20786.808%20426.72%20778.056%20435.346L452.368%20756.327C441.818%20766.724%20424.846%20766.724%20414.296%20756.327L89.0484%20435.78C80.0927%20426.954%2078.4157%20413.136%2085.0013%20402.433L211.48%20196.884C216.405%20188.879%20225.146%20184%20234.563%20184ZM588.257%20275.577V333.129H472.567V373.032C553.82%20377.296%20614.782%20394.81%20615.234%20415.802L615.231%20459.563C614.779%20480.556%20553.82%20498.069%20472.567%20502.333V600.259H395.746V502.333C314.492%20498.069%20253.531%20480.555%20253.078%20459.563L253.081%20415.802C253.533%20394.81%20314.492%20377.296%20395.746%20373.032V333.129H280.055V275.577H588.257ZM434.156%20472.268C520.868%20472.268%20593.345%20457.459%20611.082%20437.683C596.041%20420.912%20541.636%20407.713%20472.567%20404.089V445.867C460.187%20446.516%20447.336%20446.858%20434.156%20446.858C420.976%20446.858%20408.125%20446.516%20395.746%20445.867V404.089C326.676%20407.713%20272.271%20420.912%20257.23%20437.683C274.968%20457.459%20347.444%20472.268%20434.156%20472.268Z'%20fill='%23009393'/%3e%3c/svg%3e",si=[{mint:"So11111111111111111111111111111111111111112",symbol:"SOL",name:"Solana",decimals:9,logoUrl:Bs},{mint:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",symbol:"USDC",name:"Circle USD",decimals:6,logoUrl:Jo},{mint:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",symbol:"USDT",name:"Tether USD",decimals:6,logoUrl:ei},{mint:"HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr",symbol:"EURC",name:"Circle Euro",decimals:6,logoUrl:Ko},{mint:"USD1ttGY1N17NEEHLmELoaybftRBUSErhqYiQzvEmuB",symbol:"USD1",name:"WLFI USD",decimals:6,logoUrl:Zo},{mint:"2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",symbol:"PYUSD",name:"PayPal USD",decimals:6,logoUrl:Go},{mint:"USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX",symbol:"USDH",name:"Hubble USD",decimals:6,logoUrl:Xo},{mint:"CASHVDm2wsJXfhj6VWxb7GiMdoLc17Du7paH4bNr5woT",symbol:"CASH",name:"Stripe USD",decimals:6,logoUrl:Ho},{mint:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",symbol:"BONK",name:"Bonk",decimals:5,logoUrl:Qo},{mint:"oreoU2P8bN6jkk3jbaiVxYnG1dCXcYxwhwyK9jSybcp",symbol:"ORE",name:"Ore",decimals:11,logoUrl:Yo}];function ti({showAllCurrencies:s=!1,refreshInterval:t=0,compact:r=!1,className:o="",onLoad:n}){const{getBalance:a,getAllBalances:c,isLoading:i,error:d,clearError:u}=ze(),[p,f]=l.useState([]),[h,w]=l.useState(null),m=l.useCallback(async()=>{try{if(s){const g=await c();f(g),n?.(g)}else{const g=await a();f([g]),n?.([g])}w(null)}catch(g){w(g instanceof Error?g.message:"Failed to load balance")}},[s,a,c,n]);if(l.useEffect(()=>{m()},[m]),l.useEffect(()=>{if(t<=0)return;const g=setInterval(m,t);return()=>clearInterval(g)},[t,m]),h||d)return e.jsxs("div",{className:`cedros-credit-balance cedros-credit-balance-error ${o}`,children:[e.jsx("p",{className:"cedros-credit-error",children:h||d}),e.jsx("button",{type:"button",className:"cedros-credit-retry",onClick:()=>{u(),w(null),m()},children:"Retry"})]});if(i&&p.length===0)return e.jsxs("div",{className:`cedros-credit-balance cedros-credit-balance-loading ${o}`,children:[e.jsx("span",{className:"cedros-credit-loading-indicator"}),e.jsx("span",{className:"cedros-credit-loading-text",children:"Loading balance..."})]});if(r){const g=p[0];return e.jsxs("div",{className:`cedros-credit-balance cedros-credit-balance-compact ${o}`,children:[g?e.jsx("span",{className:"cedros-credit-value",title:`${g.balanceLamports} lamports`,children:g.display}):e.jsx("span",{className:"cedros-credit-value cedros-credit-value-zero",children:"0.0000 SOL"}),i&&e.jsx("span",{className:"cedros-credit-refresh-indicator",title:"Refreshing..."})]})}return e.jsxs("div",{className:`cedros-credit-balance ${o}`,children:[e.jsxs("div",{className:"cedros-credit-header",children:[e.jsx("h4",{className:"cedros-credit-title",children:"Credit Balance"}),e.jsx("button",{type:"button",className:"cedros-credit-refresh",onClick:m,disabled:i,title:"Refresh balance",children:i?"...":"↻"})]}),p.length===0?e.jsxs("div",{className:"cedros-credit-empty",children:[e.jsx("p",{className:"cedros-credit-empty-message",children:"No credit balance yet."}),e.jsx("p",{className:"cedros-credit-empty-hint",children:"Make a deposit to get started."})]}):e.jsx("div",{className:"cedros-credit-list",children:p.map(g=>e.jsxs("div",{className:"cedros-credit-item",children:[e.jsx("span",{className:"cedros-credit-currency",children:g.currency}),e.jsx("span",{className:"cedros-credit-amount",children:g.display})]},g.currency))})]})}const As=[{key:"all",label:"All",txTypes:null},{key:"deposits",label:"Deposits",txTypes:["deposit"]},{key:"usage",label:"Usage",txTypes:["spend","usage","charge"]},{key:"adjustments",label:"Adjustments",txTypes:["refund","adjustment","bonus","credit"]}];function ri(s,t){const r=s<0,o=Math.abs(s),n=t.toUpperCase()==="SOL",c=o/Math.pow(10,n?9:6),i=r?"-":"+";return n?`${i}${c.toFixed(4)} SOL`:`${i}$${c.toFixed(2)}`}function ni(s){const t=new Date(s),r=new Date,o=r.getTime()-t.getTime(),n=Math.floor(o/(1e3*60*60*24));if(n===0){const a=Math.floor(o/36e5);if(a===0){const c=Math.floor(o/6e4);return c<1?"Just now":`${c}m ago`}return`${a}h ago`}return n===1?"Yesterday":n<7?`${n}d ago`:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:t.getFullYear()!==r.getFullYear()?"numeric":void 0})}function ai(s){return s?{deposit:"Deposit",spend:"Usage",usage:"Usage",charge:"Charge",refund:"Refund",adjustment:"Adjustment",bonus:"Bonus",credit:"Credit"}[s.toLowerCase()]||s:"Transaction"}function oi(s,t){const r=(s||"").toLowerCase();return r==="deposit"?"↓":r==="spend"||r==="usage"||r==="charge"?"↑":r==="refund"?"←":r==="bonus"||r==="credit"?"★":t?"+":"−"}function ii({defaultTab:s="all",pageSize:t=10,refreshInterval:r=0,className:o="",onLoad:n,onTransactionClick:a}){const{getHistory:c,isLoading:i,error:d,clearError:u}=ze(),[p,f]=l.useState(s),[h,w]=l.useState([]),[m,g]=l.useState(0),[y,v]=l.useState(0),[x,j]=l.useState(null),C=As.find(P=>P.key===p)||As[0],k=l.useMemo(()=>C.txTypes===null?h:h.filter(P=>{const M=P.txType||"";return C.txTypes.some(B=>M.toLowerCase().includes(B.toLowerCase()))}),[h,C.txTypes]),b=l.useCallback(async()=>{try{const P=await c({limit:t*3,offset:y});w(P.transactions),g(P.total),n?.(P),j(null)}catch(P){j(P instanceof Error?P.message:"Failed to load history")}},[t,y,c,n]);l.useEffect(()=>{v(0)},[p]),l.useEffect(()=>{b()},[b]),l.useEffect(()=>{if(r<=0)return;const P=setInterval(b,r);return()=>clearInterval(P)},[r,b]);const S=Math.ceil(m/t),T=Math.floor(y/t)+1,N=P=>{const M=(P-1)*t;v(Math.max(0,Math.min(M,Math.max(0,m-1))))},L=P=>{f(P)};if(x||d)return e.jsxs("div",{className:`cedros-tx-history cedros-tx-history-error ${o}`,children:[e.jsx("p",{className:"cedros-tx-error",children:x||d}),e.jsx("button",{type:"button",className:"cedros-tx-retry",onClick:()=>{u(),j(null),b()},children:"Retry"})]});if(i&&h.length===0)return e.jsxs("div",{className:`cedros-tx-history cedros-tx-history-loading ${o}`,children:[e.jsx("span",{className:"cedros-tx-loading-indicator"}),e.jsx("span",{className:"cedros-tx-loading-text",children:"Loading transactions..."})]});const E=P=>P.txTypes===null?h.length:h.filter(M=>{const B=M.txType||"";return P.txTypes.some(I=>B.toLowerCase().includes(I.toLowerCase()))}).length;return e.jsxs("div",{className:`cedros-tx-history ${o}`,children:[e.jsxs("div",{className:"cedros-tx-header",children:[e.jsx("h4",{className:"cedros-tx-title",children:"Transaction History"}),e.jsx("button",{type:"button",className:"cedros-tx-refresh",onClick:b,disabled:i,title:"Refresh",children:i?"...":"↻"})]}),e.jsx("div",{className:"cedros-tx-tabs",children:As.map(P=>{const M=E(P),B=p===P.key;return e.jsxs("button",{type:"button",className:`cedros-tx-tab ${B?"cedros-tx-tab-active":""}`,onClick:()=>L(P.key),children:[P.label,M>0&&e.jsx("span",{className:"cedros-tx-tab-count",children:M})]},P.key)})}),k.length===0?e.jsxs("div",{className:"cedros-tx-empty",children:[e.jsx("p",{className:"cedros-tx-empty-message",children:p==="all"?"No transactions yet.":`No ${C.label.toLowerCase()} found.`}),p==="all"&&e.jsx("p",{className:"cedros-tx-empty-hint",children:"Make a deposit to get started."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"cedros-tx-list",children:k.slice(0,t).map(P=>{const M=P.amountLamports>=0;return e.jsxs("div",{className:`cedros-tx-item ${M?"cedros-tx-item-positive":"cedros-tx-item-negative"}`,onClick:()=>a?.(P),onKeyDown:B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),a?.(P))},role:a?"button":void 0,tabIndex:a?0:void 0,children:[e.jsx("div",{className:`cedros-tx-icon ${M?"cedros-tx-icon-positive":"cedros-tx-icon-negative"}`,children:oi(P.txType,M)}),e.jsxs("div",{className:"cedros-tx-content",children:[e.jsxs("div",{className:"cedros-tx-row-main",children:[e.jsx("span",{className:"cedros-tx-type",children:ai(P.txType)}),e.jsx("span",{className:`cedros-tx-amount ${M?"cedros-tx-amount-positive":"cedros-tx-amount-negative"}`,children:ri(P.amountLamports,P.currency)})]}),e.jsxs("div",{className:"cedros-tx-row-details",children:[e.jsx("span",{className:"cedros-tx-description",children:P.description}),e.jsx("span",{className:"cedros-tx-date",children:ni(P.createdAt)})]})]})]},P.id)})}),S>1&&e.jsxs("div",{className:"cedros-tx-pagination",children:[e.jsx("button",{type:"button",className:"cedros-tx-page-btn",onClick:()=>N(T-1),disabled:T<=1,children:"Previous"}),e.jsxs("span",{className:"cedros-tx-page-info",children:["Page ",T," of ",S]}),e.jsx("button",{type:"button",className:"cedros-tx-page-btn",onClick:()=>N(T+1),disabled:T>=S,children:"Next"})]})]})]})}function li({brandLogo:s,brandName:t,title:r="Welcome back",subtitle:o="Login with your Apple or Google account",termsText:n,onSuccess:a,defaultTab:c="login",children:i,className:d=""}){return e.jsxs("div",{className:`cedros-full-page-layout ${d}`,children:[(s||t)&&e.jsxs("div",{className:"cedros-brand-header",children:[s,t&&e.jsx("span",{className:"cedros-brand-name",children:t})]}),e.jsxs("div",{className:"cedros-full-page-card",children:[e.jsxs("div",{className:"cedros-full-page-header",children:[e.jsx("h1",{className:"cedros-full-page-title",children:r}),o&&e.jsx("p",{className:"cedros-full-page-subtitle",children:o})]}),i??e.jsx($e,{defaultTab:c,onSuccess:a})]}),n&&e.jsx("p",{className:"cedros-terms-footer",children:n})]})}function ci({brandName:s="Your Brand",brandLogo:t,tagline:r="Your tagline goes here. Make it compelling.",title:o="Sign in",subtitle:n="Enter your credentials to access your account",onSuccess:a,defaultTab:c="login",children:i,className:d=""}){return e.jsxs("div",{className:`cedros-split-page-layout ${d}`,children:[e.jsx("div",{className:"cedros-split-page-brand",children:e.jsxs("div",{className:"cedros-split-page-brand-content",children:[t??e.jsx("div",{className:"cedros-split-page-logo",children:s.charAt(0).toUpperCase()}),e.jsx("h1",{className:"cedros-split-page-brand-name",children:s}),r&&e.jsx("p",{className:"cedros-split-page-tagline",children:r})]})}),e.jsx("div",{className:"cedros-split-page-form",children:e.jsxs("div",{className:"cedros-split-page-form-content",children:[e.jsx("h2",{className:"cedros-split-page-title",children:o}),n&&e.jsx("p",{className:"cedros-split-page-subtitle",children:n}),i??e.jsx($e,{defaultTab:c,onSuccess:a})]})})]})}class di{client;constructor(t,r,o,n){this.client=new A.ApiClient({baseUrl:t,timeoutMs:r,retryAttempts:o,getAccessToken:n})}async listSessions(){try{return(await this.client.get("/sessions")).sessions}catch(t){throw A.handleApiError(t,"Failed to list sessions")}}async revokeAllSessions(){try{return await this.client.delete("/sessions")}catch(t){throw A.handleApiError(t,"Failed to revoke sessions")}}}function ui(){const{config:s,authState:t,_internal:r}=A.useCedrosLogin(),[o,n]=l.useState([]),[a,c]=l.useState(!1),[i,d]=l.useState(null),u=l.useMemo(()=>new di(s.serverUrl,s.requestTimeout,s.retryAttempts,r?.getAccessToken),[s.serverUrl,s.requestTimeout,s.retryAttempts,r]),p=l.useCallback(async()=>{if(t!=="authenticated"){n([]);return}c(!0),d(null);try{const w=await u.listSessions();n(w)}catch(w){d(w)}finally{c(!1)}},[t,u]);l.useEffect(()=>{t==="authenticated"?p():n([])},[t,p]);const f=l.useCallback(async()=>{c(!0),d(null);try{const w=await u.revokeAllSessions();return await p(),w}catch(w){throw d(w),w}finally{c(!1)}},[u,p]),h=l.useMemo(()=>o.filter(w=>!w.isCurrent).length,[o]);return{sessions:o,isLoading:a,error:i,fetchSessions:p,revokeAllSessions:f,otherSessionCount:h}}function hi(){const{config:s,_internal:t}=A.useCedrosLogin(),[r,o]=l.useState({allowed:!1,reason:void 0,isLoading:!1,error:null}),n=l.useMemo(()=>new dr(s.serverUrl,s.requestTimeout,s.retryAttempts,t?.getAccessToken),[s.serverUrl,s.requestTimeout,s.retryAttempts,t]),a=l.useCallback(async d=>{o(u=>({...u,isLoading:!0,error:null}));try{const u=await n.authorize(d),p={allowed:u.allowed,reason:u.reason,isLoading:!1,error:null};return o(p),p}catch(u){const p={allowed:!1,reason:void 0,isLoading:!1,error:u};return o(p),p}},[n]),c=l.useCallback(async d=>(await a(d)).allowed,[a]),i=l.useCallback(()=>{o({allowed:!1,reason:void 0,isLoading:!1,error:null})},[]);return{authorize:c,lastCheck:r,clearCheck:i,checkAuthorization:a}}function mi(){const s=A.useCedrosLoginOptional(),[t,r]=l.useState(!1),[o,n]=l.useState(null),[a,c]=l.useState(null),i=l.useMemo(()=>s?new A.ApiClient({baseUrl:s.config.serverUrl,timeoutMs:s.config.requestTimeout,retryAttempts:s.config.retryAttempts,getAccessToken:s._internal?.getAccessToken}):null,[s]),d=l.useCallback(async()=>{if(!i)throw new Error("usePendingRecovery must be used within a CedrosLoginProvider");r(!0),n(null);try{const f=await i.get("/wallet/pending-recovery");c(f)}catch(f){const h=A.handleApiError(f,"Failed to fetch pending recovery");throw n(h.message),h}finally{r(!1)}},[i]),u=l.useCallback(async()=>{if(!i)throw new Error("usePendingRecovery must be used within a CedrosLoginProvider");r(!0),n(null);try{const f={confirmed:!0};await i.post("/wallet/acknowledge-recovery",f),c(null)}catch(f){const h=A.handleApiError(f,"Failed to acknowledge recovery");throw n(h.message),h}finally{r(!1)}},[i]),p=l.useCallback(()=>n(null),[]);return l.useEffect(()=>{i&&s?.authState==="authenticated"&&d().catch(()=>{})},[i,s?.authState,d]),{hasPendingRecovery:a?.hasPendingRecovery??!1,recoveryType:a?.recoveryType??null,recoveryPhrase:a?.recoveryPhrase??null,expiresAt:a?.expiresAt?new Date(a.expiresAt):null,fetchPendingRecovery:d,acknowledgeRecovery:u,isLoading:t,error:o,clearError:p}}function pi(s={}){const{onExternalSign:t}=s,{solanaPubkey:r,hasExternalWallet:o,status:n,isUnlocked:a}=A.useWallet(),{signTransaction:c,isSigning:i,error:d,clearError:u}=Zt(),p=l.useMemo(()=>o&&t?"external":n==="enrolled_locked"||n==="enrolled_unlocked"?"sss":"none",[o,t,n]),f=p!=="none",h=n==="enrolled_locked"||n==="enrolled_unlocked";return{signTransaction:l.useCallback(async(m,g)=>{if(p==="external"){if(!t)throw new Error("External wallet signing callback not provided");return t(m)}if(p==="sss"){if(!g&&!a)throw new Error("Credential required for signing. Unlock wallet first or provide credential.");return g?c(m,g):c(m)}throw new Error("No signing method available. Enroll a wallet first.")},[p,t,a,c]),signingMethod:p,canSign:f,isSigning:i,publicKey:r,hasExternalWallet:o,hasSssWallet:h,isSssUnlocked:a,error:d,clearError:u}}const Is=l.createContext(null),qe={auth:{email:"Email",password:"Password",confirmPassword:"Confirm Password",name:"Name",optional:"(optional)",createPassword:"Create a password",confirmYourPassword:"Confirm your password",emailPlaceholder:"you@example.com",namePlaceholder:"Your name"},buttons:{signIn:"Sign in",signUp:"Sign up",signOut:"Sign out",createAccount:"Create account",continueWithGoogle:"Continue with Google",continueWithSolana:"Connect Wallet",forgotPassword:"Forgot password?",resetPassword:"Reset password",sendVerification:"Send verification email"},messages:{signingIn:"Signing in...",signingUp:"Signing up...",creatingAccount:"Creating account...",connectingWallet:"Connecting wallet...",verifyingSignature:"Verifying signature...",passwordsDoNotMatch:"Passwords do not match",alreadyHaveAccount:"Already have an account?",dontHaveAccount:"Don't have an account?",orContinueWith:"Or continue with"},errors:{invalidCredentials:"Invalid email or password",emailExists:"An account with this email already exists",invalidEmail:"Please enter a valid email address",weakPassword:"Password does not meet requirements",networkError:"Network error. Please try again.",unknownError:"An error occurred. Please try again.",walletNotFound:"No wallet found. Please install a Solana wallet.",signatureRejected:"Signature request was rejected",challengeExpired:"Challenge expired. Please try again."},passwordValidation:{minLength:"At least 10 characters",uppercase:"At least 1 uppercase letter",lowercase:"At least 1 lowercase letter",number:"At least 1 number",special:"At least 1 special character",weak:"Weak",fair:"Fair",good:"Good",strong:"Strong"}};function Br(s,t){return Fr(s,t)}function Fr(s,t){const r={...s};for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const n=s[o],a=t[o];typeof n=="object"&&n!==null&&typeof a=="object"&&a!==null?r[o]=Fr(n,a):a!==void 0&&(r[o]=a)}return r}function fi({children:s,locale:t="en",translations:r}){const o=l.useMemo(()=>({t:r?Br(qe,r):qe,locale:t}),[r,t]);return e.jsx(Is.Provider,{value:o,children:s})}function gi(){return l.useContext(Is)?.t??qe}function wi(){return l.useContext(Is)?.locale??"en"}exports.CedrosLoginProvider=A.CedrosLoginProvider;exports.ErrorMessage=A.ErrorMessage;exports.LoadingSpinner=A.LoadingSpinner;exports.getEmbeddedWalletInfo=A.getEmbeddedWalletInfo;exports.isEmbeddedWalletAvailable=A.isEmbeddedWalletAvailable;exports.useAuth=A.useAuth;exports.useCedrosLogin=A.useCedrosLogin;exports.useWallet=A.useWallet;exports.useWalletMaterial=A.useWalletMaterial;exports.EmailLoginForm=O.EmailLoginForm;exports.EmailRegisterForm=O.EmailRegisterForm;exports.OtpInput=O.OtpInput;exports.PasswordInput=O.PasswordInput;exports.TotpVerify=O.TotpVerify;exports.useEmailAuth=O.useEmailAuth;exports.useInstantLink=O.useInstantLink;exports.useTotpVerify=O.useTotpVerify;exports.validatePassword=_e.validatePassword;exports.GoogleLoginButton=Cs.GoogleLoginButton;exports.useGoogleAuth=Cs.useGoogleAuth;exports.SolanaLoginButton=je.SolanaLoginButton;exports.useSolanaAuth=je.useSolanaAuth;exports.AdminDepositList=pr;exports.AdminDepositStats=Ls;exports.AdminPrivacyPeriodDeposits=gr;exports.AdminUserList=yr;exports.AdminWithdrawalHistory=wr;exports.AdminWithdrawalQueue=fr;exports.AppleLoginButton=Wt;exports.CapabilityWarning=Qn;exports.CedrosAdminDashboard=Ha;exports.CreditBalance=ti;exports.DepositFlow=Uo;exports.ErrorBoundary=$t;exports.ForgotPasswordForm=Ft;exports.FullPageLayout=li;exports.History=ii;exports.I18nProvider=fi;exports.InviteForm=Vt;exports.InviteList=Qt;exports.LoginButton=un;exports.LoginForm=$e;exports.LoginModal=yn;exports.MemberList=zt;exports.OrgSelector=xn;exports.OrgSwitcher=Pn;exports.PasskeyLoginButton=_t;exports.PasskeyPrompt=sr;exports.RecoveryPhraseDisplay=Kt;exports.RecoveryPhraseInput=Yt;exports.ResetPasswordForm=bn;exports.SUPPORTED_TOKENS=si;exports.SessionList=Wn;exports.SplitPageLayout=ci;exports.SystemSettings=lr;exports.TieredAmountSlider=Us;exports.TokenSelector=Ds;exports.TotpSettings=Co;exports.TotpSetup=kr;exports.WalletAddressRow=ar;exports.WalletEnrollment=Xt;exports.WalletManager=ca;exports.WalletRecovery=nr;exports.WalletStatus=or;exports.WalletUnlock=tr;exports.defaultTranslations=qe;exports.getTierForAmount=Ve;exports.mergeTranslations=Br;exports.useAdminDeposits=he;exports.useAdminUsers=Ts;exports.useAppleAuth=Ut;exports.useAuthorize=hi;exports.useCredits=ze;exports.useDeposit=Cr;exports.useInvites=mr;exports.useLocale=wi;exports.useMembers=hr;exports.useOrgs=ur;exports.usePasskeySigning=er;exports.usePasswordReset=Ps;exports.usePendingRecovery=mi;exports.useSessions=ui;exports.useSystemSettings=ir;exports.useTotp=Rs;exports.useTransactionSigning=pi;exports.useTranslations=gi;exports.useWalletEnrollment=Jt;exports.useWalletRecovery=rr;exports.useWalletSigning=Zt;exports.useWebAuthn=qt;
|