@clerk/ui 1.0.0-canary.v20251218195700 → 1.0.0-canary.v20251218215334

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.
Files changed (58) hide show
  1. package/dist/ClerkUi.js +2 -2
  2. package/dist/components/UserProfile/Web3Form.js +32 -45
  3. package/dist/components/UserProfile/Web3Form.js.map +1 -1
  4. package/dist/components/UserProfile/Web3Section.js +6 -3
  5. package/dist/components/UserProfile/Web3Section.js.map +1 -1
  6. package/dist/foundations/defaultFoundations.d.ts +153 -153
  7. package/dist/index.js +1 -1
  8. package/dist/internal/index.js +1 -1
  9. package/dist/{ui-common_ui_7ee629_1.0.0-canary.v20251218195700.js → ui-common_ui_25df52_1.0.0-canary.v20251218215334.js} +1 -1
  10. package/dist/ui.browser.js +1 -1
  11. package/dist/{userprofile_ui_7ee629_1.0.0-canary.v20251218195700.js → userprofile_ui_25df52_1.0.0-canary.v20251218215334.js} +2 -2
  12. package/dist/utils/errorHandler.js +1 -7
  13. package/dist/utils/errorHandler.js.map +1 -1
  14. package/package.json +3 -3
  15. /package/dist/{207_ui_7ee629_1.0.0-canary.v20251218195700.js → 207_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  16. /package/dist/{217_ui_7ee629_1.0.0-canary.v20251218195700.js → 217_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  17. /package/dist/{360_ui_7ee629_1.0.0-canary.v20251218195700.js → 360_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  18. /package/dist/{444_ui_7ee629_1.0.0-canary.v20251218195700.js → 444_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  19. /package/dist/{573_ui_7ee629_1.0.0-canary.v20251218195700.js → 573_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  20. /package/dist/{970_ui_7ee629_1.0.0-canary.v20251218195700.js → 970_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  21. /package/dist/{apiKeys_ui_7ee629_1.0.0-canary.v20251218195700.js → apiKeys_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  22. /package/dist/{blankcaptcha_ui_7ee629_1.0.0-canary.v20251218195700.js → blankcaptcha_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  23. /package/dist/{checkout_ui_7ee629_1.0.0-canary.v20251218195700.js → checkout_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  24. /package/dist/{copy-api-key-modal_ui_7ee629_1.0.0-canary.v20251218195700.js → copy-api-key-modal_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  25. /package/dist/{createorganization_ui_7ee629_1.0.0-canary.v20251218195700.js → createorganization_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  26. /package/dist/{enableOrganizationsPrompt_ui_7ee629_1.0.0-canary.v20251218195700.js → enableOrganizationsPrompt_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  27. /package/dist/{framework_ui_7ee629_1.0.0-canary.v20251218195700.js → framework_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  28. /package/dist/{impersonationfab_ui_7ee629_1.0.0-canary.v20251218195700.js → impersonationfab_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  29. /package/dist/{keylessPrompt_ui_7ee629_1.0.0-canary.v20251218195700.js → keylessPrompt_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  30. /package/dist/{oauthConsent_ui_7ee629_1.0.0-canary.v20251218195700.js → oauthConsent_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  31. /package/dist/{onetap_ui_7ee629_1.0.0-canary.v20251218195700.js → onetap_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  32. /package/dist/{op-api-keys-page_ui_7ee629_1.0.0-canary.v20251218195700.js → op-api-keys-page_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  33. /package/dist/{op-billing-page_ui_7ee629_1.0.0-canary.v20251218195700.js → op-billing-page_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  34. /package/dist/{op-plans-page_ui_7ee629_1.0.0-canary.v20251218195700.js → op-plans-page_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  35. /package/dist/{organizationlist_ui_7ee629_1.0.0-canary.v20251218195700.js → organizationlist_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  36. /package/dist/{organizationprofile_ui_7ee629_1.0.0-canary.v20251218195700.js → organizationprofile_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  37. /package/dist/{organizationswitcher_ui_7ee629_1.0.0-canary.v20251218195700.js → organizationswitcher_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  38. /package/dist/{payment-attempt-page_ui_7ee629_1.0.0-canary.v20251218195700.js → payment-attempt-page_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  39. /package/dist/{planDetails_ui_7ee629_1.0.0-canary.v20251218195700.js → planDetails_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  40. /package/dist/{prefetchorganizationlist_ui_7ee629_1.0.0-canary.v20251218195700.js → prefetchorganizationlist_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  41. /package/dist/{pricingTable_ui_7ee629_1.0.0-canary.v20251218195700.js → pricingTable_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  42. /package/dist/{revoke-api-key-modal_ui_7ee629_1.0.0-canary.v20251218195700.js → revoke-api-key-modal_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  43. /package/dist/{sessionTasks_ui_7ee629_1.0.0-canary.v20251218195700.js → sessionTasks_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  44. /package/dist/{signin_ui_7ee629_1.0.0-canary.v20251218195700.js → signin_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  45. /package/dist/{signup_ui_7ee629_1.0.0-canary.v20251218195700.js → signup_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  46. /package/dist/{statement-page_ui_7ee629_1.0.0-canary.v20251218195700.js → statement-page_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  47. /package/dist/{subscriptionDetails_ui_7ee629_1.0.0-canary.v20251218195700.js → subscriptionDetails_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  48. /package/dist/{taskChooseOrganization_ui_7ee629_1.0.0-canary.v20251218195700.js → taskChooseOrganization_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  49. /package/dist/{taskResetPassword_ui_7ee629_1.0.0-canary.v20251218195700.js → taskResetPassword_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  50. /package/dist/{up-api-keys-page_ui_7ee629_1.0.0-canary.v20251218195700.js → up-api-keys-page_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  51. /package/dist/{up-billing-page_ui_7ee629_1.0.0-canary.v20251218195700.js → up-billing-page_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  52. /package/dist/{up-plans-page_ui_7ee629_1.0.0-canary.v20251218195700.js → up-plans-page_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  53. /package/dist/{useravatar_ui_7ee629_1.0.0-canary.v20251218195700.js → useravatar_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  54. /package/dist/{userbutton_ui_7ee629_1.0.0-canary.v20251218195700.js → userbutton_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  55. /package/dist/{userverification_ui_7ee629_1.0.0-canary.v20251218195700.js → userverification_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  56. /package/dist/{vendors_ui_7ee629_1.0.0-canary.v20251218195700.js → vendors_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  57. /package/dist/{waitlist_ui_7ee629_1.0.0-canary.v20251218195700.js → waitlist_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
  58. /package/dist/{web3-solana-wallet-buttons_ui_7ee629_1.0.0-canary.v20251218195700.js → web3-solana-wallet-buttons_ui_25df52_1.0.0-canary.v20251218215334.js} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["718"],{4484:function(e,r,t){t.r(r),t.d(r,{UserProfile:()=>r6,UserProfileModal:()=>r7});var i=t(4518),n=t(5074),l=t(1227),o=t(3264),a=t(5240),s=t(4607),c=t(2861),d=t(3269),u=t(9764),h=t(5396),m=t(7831),f=t(2265);let p=e=>{let{pages:r,apiKeysProps:t}=(0,a.B)(),n=r.routes.filter(e=>e.id!==l.j2.API_KEYS||!t?.hide);return(0,i.FD)(u.XM,{contentRef:e.contentRef,children:[(0,i.Y)(u.jq,{title:(0,c.G)("userProfile.navbar.title"),description:(0,c.G)("userProfile.navbar.description"),routes:n,contentRef:e.contentRef}),e.children]})};var g=t(540),Y=t(7697),v=t(1210),P=t(6088),b=t(6153),y=t(8272),S=t(8920),_=t(1421),D=t(4003),R=t(8080),G=t(4468),w=t(2660),C=t(3453),$=t(2513),F=t(2216),I=t(4964),x=t(6735);let k=e=>{let{strategy:r}=e,t=(0,d.f0)(),{user:n}=(0,v.Jd)(),{navigate:l}=(0,I.r)(),{strategyToDisplayData:o}=(0,F.k)(),{additionalOAuthScopes:s,componentName:u,mode:h}=(0,a.B)(),m="modal"===h,f=(0,v.Wp)(()=>{let e=r.replace("oauth_",""),t=m?(0,_.j)({url:window.location.href,componentName:u,socialProvider:e}):window.location.href,i=s?s[e]:[];return n?.createExternalAccount({strategy:r,redirectUrl:t,additionalScopes:i})}),p=o[r].iconUrl?(0,i.Y)(y._V,{isLoading:t.loadingMetadata===r,isDisabled:t.isLoading,elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(o[r].id),src:o[r].iconUrl,alt:`Connect ${o[r].name} account`,sx:e=>({width:e.sizes.$4})}):(0,i.Y)(w.T,{id:o[r].id,value:o[r].name,isLoading:t.loadingMetadata===r,isDisabled:t.isLoading});return(0,i.Y)(D.rd.ActionMenuItem,{id:o[r].id,onClick:()=>{if(n)return t.setLoading(r),f().then(e=>{e&&e.verification?.externalVerificationRedirectURL&&((0,x.y)(2e3).then(()=>t.setIdle(r)),l(e.verification.externalVerificationRedirectURL.href))}).catch(e=>{(0,G.H4)(e,[],t.setError),t.setIdle(r)})},isDisabled:t.isLoading,variant:"ghost",isLoading:t.loadingMetadata===r,focusRing:!1,closeAfterClick:!1,localizationKey:(0,c.G)("userProfile.connectedAccountPage.socialButtonsBlockButton",{provider:o[r].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:p},r)},A=({onClick:e})=>{let{user:r}=(0,v.Jd)(),{strategies:t}=(0,F.k)(),n=t.filter(e=>e.startsWith("oauth")),l=r?.verifiedExternalAccounts.map(e=>`oauth_${e.provider}`),o=n.filter(e=>!l.includes(e));return 0===o.length?null:(0,i.Y)(D.rd.ActionMenu,{triggerLocalizationKey:(0,c.G)("userProfile.start.connectedAccountsSection.primaryButton"),id:"connectedAccounts",onClick:e,children:o.map(e=>(0,i.Y)(k,{strategy:e},e))})};var z=t(8046);let T=e=>{let{onSuccess:r,onReset:t}=e,{user:l}=(0,v.Jd)(),{emailId:o}=e,a=l?.emailAddresses.find(e=>e.id===o),s=n.useRef(a?.emailAddress),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.emailAddressPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.emailAddressPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.emailAddressPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.emailAddressPage.removeResource.successMessage",{emailAddress:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:r,onReset:t}):null},E=e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.phoneNumbers.find(e=>e.id===r),s=n.useRef(a?.phoneNumber),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.phoneNumberPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.phoneNumberPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.phoneNumberPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.phoneNumberPage.removeResource.successMessage",{phoneNumber:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},L=e=>{let{accountId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.externalAccounts.find(e=>e.id===r),s=n.useRef(a?.provider),{providerToDisplayData:d}=(0,F.k)();return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.connectedAccountPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.connectedAccountPage.removeResource.messageLine1",{identifier:d[s.current]?.name||""}),messageLine2:(0,c.G)("userProfile.connectedAccountPage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.connectedAccountPage.removeResource.successMessage",{connectedAccount:d[s.current]?.name||""}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},O=e=>{let{user:r}=(0,v.Jd)(),{walletId:t,onSuccess:l,onReset:o}=e,a=r?.web3Wallets.find(e=>e.id===t),s=n.useRef(a?.web3Wallet),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.web3WalletPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.web3WalletPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.web3WalletPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.web3WalletPage.removeResource.successMessage",{web3Wallet:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:l,onReset:o}):null},K=e=>{let{user:r}=(0,v.Jd)(),{phoneId:t,onSuccess:l,onReset:o}=e,a=r?.phoneNumbers.find(e=>e.id===t),s=n.useRef(a?.phoneNumber);return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.title"),messageLine1:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine1",{identifier:s.current}),messageLine2:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.successMessage",{mfaPhoneCode:s.current}),deleteResource:()=>Promise.resolve(a?.setReservedForSecondFactor({reserved:!1})),onSuccess:l,onReset:o}):null},B=e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)();return n?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.mfaTOTPPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.mfaTOTPPage.removeResource.messageLine1"),messageLine2:(0,c.G)("userProfile.mfaTOTPPage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.mfaTOTPPage.removeResource.successMessage"),deleteResource:n.disableTOTP,onSuccess:r,onReset:t}):null},M=e=>{let{onSuccess:r,onReset:t,passkey:n}=e;return(0,i.Y)(z.P,{title:(0,c.G)("userProfile.passkeyScreen.removeResource.title"),messageLine1:(0,c.G)("userProfile.passkeyScreen.removeResource.messageLine1",{name:n.name||""}),deleteResource:n.delete,onSuccess:r,onReset:t})},W=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(L,{onSuccess:r,onReset:r,...e})},N=["external_account_missing_refresh_token","oauth_fetch_user_error","oauth_token_exchange_error","external_account_email_address_verification_required"],J=(0,d.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,d.f0)(),l=!!r?.externalAccounts?.length,[o,a]=(0,n.useState)(null);if(!r||!e&&!l)return null;let s=[...r.verifiedExternalAccounts,...r.unverifiedExternalAccounts.filter(e=>e.verification?.error)];return(0,i.FD)(D.rd.Root,{title:(0,c.G)("userProfile.start.connectedAccountsSection.title"),centered:!1,id:"connectedAccounts",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(C.r.Root,{value:o,onChange:a,children:[(0,i.Y)(D.rd.ItemList,{id:"connectedAccounts",children:s.map(e=>(0,i.Y)(q,{account:e},e.id))}),e&&(0,i.Y)(A,{onClick:()=>a(null)})]})]})}),q=({account:e})=>{let{additionalOAuthScopes:r,componentName:t,mode:l}=(0,a.B)(),{navigate:o}=(0,I.r)(),{user:s}=(0,v.Jd)(),u=(0,d.f0)(),h=e.id,m="modal"===l,f=m?(0,_.j)({url:window.location.href,componentName:t}):window.location.href,p=(0,v.Wp)(()=>s?.createExternalAccount({strategy:e.verification.strategy,redirectUrl:f,additionalScopes:b}));if(!s)return null;let{providerToDisplayData:g}=(0,F.k)(),Y=e.username||e.emailAddress,P=e.verification?.error?.longMessage,b=function(e,r){if(!r)return[];let t=r[e.provider]||[],i=e.approvedScopes.split(" ");return 0===t.filter(e=>!i.includes(e)).length?[]:t}(e,r),R=b.length>0&&""!=e.approvedScopes,$=N.includes(e.verification?.error?.code||"")||R,x=$?(0,c.G)("userProfile.start.connectedAccountsSection.subtitle__disconnected"):P,k=async()=>{let r=m?(0,_.j)({url:window.location.href,componentName:t}):window.location.href;try{let t;(t=R?await e.reauthorize({additionalScopes:b,redirectUrl:r}):await p())&&await o(t.verification.externalVerificationRedirectURL?.href||"")}catch(e){(0,G.H4)(e,[],u.setError)}};return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"connectedAccounts",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$2}),children:[(0,i.Y)(()=>g[e.provider].iconUrl?(0,i.Y)(y._V,{elementDescriptor:[S.$z.providerIcon],elementId:S.$z.socialButtonsProviderIcon.setId(e.provider),alt:g[e.provider].name,src:g[e.provider].iconUrl,sx:e=>({width:e.sizes.$4,flexShrink:0})}):(0,i.Y)(w.T,{id:e.provider,value:g[e.provider].name}),{}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:`${g[e.provider].name}`}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:Y?`• ${Y}`:""})]})})]}),(0,i.Y)(U,{account:e})]}),$&&(0,i.FD)(y.az,{sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:[(0,i.Y)(y.EY,{colorScheme:"secondary",sx:e=>({paddingRight:e.sizes.$1x5,display:"inline-block"}),localizationKey:x}),(0,i.Y)(y.$n,{sx:{display:"inline-block"},onClick:k,variant:"link",localizationKey:(0,c.G)("userProfile.start.connectedAccountsSection.actionLabel__connectionFailed")})]}),e.verification?.error?.code&&!$&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:P}),(0,i.Y)(C.r.Open,{value:`remove-${h}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(W,{accountId:e.id})})})]},e.id)},U=({account:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,c.G)("userProfile.start.connectedAccountsSection.destructiveActionTitle"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:n})},j=e=>e.defaultSecondFactor?-1:1;function H(e){let r=[];return Object.entries(e).forEach(([,e])=>{e.used_for_second_factor&&r.push(...e.second_factors)}),r}function V(e,r){let t=H(e);return r.totpEnabled&&(t=t.filter(e=>"totp"!==e)),(r.backupCodeEnabled||!r.twoFactorEnabled)&&(t=t.filter(e=>"backup_code"!==e)),t}function Z(e,r){if(!e)return[];let t=e.filter(e=>e.id===r),i=e.filter(e=>e.id!==r),n=i.filter(e=>e.verification?.status==="verified"),l=i.filter(e=>!!e.verification?.status&&e.verification?.status!=="verified"),o=i.filter(e=>!e.verification.status);return n.sort((e,r)=>e.id.localeCompare(r.id)),l.sort((e,r)=>e.verification?.expireAt&&r.verification?.expireAt?e.verification.expireAt.getTime()-r.verification.expireAt.getTime():0),[...t,...n,...l,...o]}var X=t(2336);let Q=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(T,{onSuccess:r,onReset:r,...e})},ee=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(X.v,{onSuccess:r,onReset:r,...e})},er=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)();return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.emailAddressesSection.title"),centered:!1,id:"emailAddresses",children:(0,i.Y)(C.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"emailAddresses",children:[Z(r?.emailAddresses,r?.primaryEmailAddressId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"emailAddresses",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$1}),children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),truncate:!0,children:e.emailAddress}),r?.primaryEmailAddressId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]}),(0,i.Y)(et,{email:e})]}),(0,i.Y)(C.r.Open,{value:`remove-${t}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(Q,{emailId:t})})}),(0,i.Y)(C.r.Open,{value:`verify-${t}`,children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(ee,{emailId:t})})})]},e.emailAddress)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(C.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"emailAddresses",localizationKey:(0,c.G)("userProfile.start.emailAddressesSection.primaryButton")})}),(0,i.Y)(C.r.Open,{value:"add",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(ee,{})})})]})]})})})},et=({email:e})=>{let r=(0,d.f0)(),{user:t}=(0,v.Jd)(),{open:n}=(0,$.D5)(),l=e.id,o=t?.primaryEmailAddressId===l,a="verified"===e.verification.status,s=(0,v.Wp)(()=>t?.update({primaryEmailAddressId:l})),u=[o&&!a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__primary"),onClick:()=>n(`verify-${l}`)}:null,!o&&a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__nonPrimary"),onClick:()=>{s().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,!o&&!a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__unverified"),onClick:()=>n(`verify-${l}`)}:null,{label:(0,c.G)("userProfile.start.emailAddressesSection.destructiveAction"),isDestructive:!0,onClick:()=>n(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:u})},ei=()=>{let{user:e}=(0,v.Jd)(),r=e?.enterpriseAccounts.filter(({enterpriseConnection:e})=>e?.active);return r?.length?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.enterpriseAccountsSection.title"),id:"enterpriseAccounts",centered:!1,children:(0,i.Y)(D.rd.ItemList,{id:"enterpriseAccounts",children:r.map(e=>(0,i.Y)(en,{account:e},e.id))})}):null},en=({account:e})=>{let r=e.emailAddress,t=e?.enterpriseConnection?.name,n=e.verification?.error?.longMessage;return(0,i.FD)(D.rd.Item,{id:"enterpriseAccounts",sx:e=>({gap:e.space.$2,justifyContent:"start"}),children:[(0,i.Y)(el,{account:e}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{truncate:!0,colorScheme:"body",children:t}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:r?`• ${r}`:""}),n&&(0,i.Y)(y.Ex,{colorScheme:"danger",localizationKey:(0,c.G)("badge__requiresAction")})]})})]},e.id)},el=({account:e})=>{let{provider:r,enterpriseConnection:t}=e,n=r.replace(/(oauth_|saml_)/,"").trim(),l=t?.name??n,o={elementDescriptor:[S.$z.providerIcon],alt:l,sx:e=>({width:e.sizes.$4}),elementId:S.$z.enterpriseButtonsProviderIcon.setId(e.provider)};return t?.logoPublicUrl?(0,i.Y)(y._V,{...o,src:t.logoPublicUrl}):(0,i.Y)(w.T,{id:n,value:l,"aria-label":`${l}'s icon`,elementDescriptor:[S.$z.providerIcon,S.$z.providerInitialIcon],elementId:S.$z.providerInitialIcon.setId(n)})};var eo=t(7651),ea=t(2454),es=t(1475),ec=t(3549),ed=t(8640),eu=t(6245),eh=t(1282);let em=(0,d.dm)(e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=n.useRef(o?.phoneNumbers.find(e=>e.id===r)),s=(0,eu.X)({defaultStep:+!!a.current});return(0,i.FD)(eu.s,{...s.props,children:[(0,i.Y)(ef,{resourceRef:a,title:(0,c.G)("userProfile.phoneNumberPage.title"),onSuccess:s.nextStep,onReset:l}),(0,i.Y)(ep,{resourceRef:a,title:(0,c.G)("userProfile.phoneNumberPage.verifyTitle"),onSuccess:t,onReset:l})]})}),ef=e=>{let{title:r,onSuccess:t,onReset:n,onUseExistingNumberClick:l,resourceRef:o}=e,a=(0,d.f0)(),{user:s}=(0,v.Jd)(),u=(0,v.Wp)((e,r)=>e.createPhoneNumber(r)),h=(0,ed.tJ)("phoneNumber","",{type:"tel",label:(0,c.G)("formFieldLabel__phoneNumber"),isRequired:!0}),m=h.value.length>1&&s?.username!==h.value,f=!!s?.phoneNumbers?.length&&l,p=async e=>{if(e.preventDefault(),s)return u(s,{phoneNumber:h.value}).then(e=>{o.current=e,t()}).catch(e=>(0,G.H4)(e,[h],a.setError))};return(0,i.Y)(ec.M,{headerTitle:r,gap:1,children:(0,i.FD)(ea.l.Root,{gap:4,onSubmit:p,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.phoneNumberPage.infoText"),colorScheme:"secondary"}),(0,i.Y)(ea.l.ControlRow,{elementId:h.id,children:(0,i.Y)(ea.l.PhoneInput,{...h.props,autoFocus:!0})}),(0,i.FD)(y.so,{justify:f?"between":"end",children:[f&&(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,c.G)("userProfile.mfaPhoneCodePage.backButton"),onClick:l}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.formButtonPrimary__add"),isDisabled:!m,onReset:n})]})]})})},ep=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:l}=e;return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,c.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:t,identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:l})})},eg=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(E,{onSuccess:r,onReset:r,...e})},eY=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(em,{onSuccess:r,onReset:r,...e})},ev=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=!!r?.phoneNumbers?.length;return e||t?(0,i.Y)(D.rd.Root,{centered:!1,title:(0,c.G)("userProfile.start.phoneNumbersSection.title"),id:"phoneNumbers",children:(0,i.Y)(C.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"phoneNumbers",children:[Z(r?.phoneNumbers,r?.primaryPhoneNumberId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"phoneNumbers",children:[(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:(0,eo.Om)(e.phoneNumber)}),r?.primaryPhoneNumberId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]})}),(0,i.Y)(eP,{phone:e})]}),(0,i.Y)(C.r.Open,{value:`remove-${t}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(eg,{phoneId:t})})}),(0,i.Y)(C.r.Open,{value:`verify-${t}`,children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eY,{phoneId:t})})})]},t)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(C.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"phoneNumbers",localizationKey:(0,c.G)("userProfile.start.phoneNumbersSection.primaryButton")})}),(0,i.Y)(C.r.Open,{value:"add",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eY,{})})})]})]})})}):null},eP=({phone:e})=>{let r=(0,d.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),l=e.id,o=(0,v.Wp)(r=>r.update({primaryPhoneNumberId:e.id}));if(!n)return null;let a=n.primaryPhoneNumberId===e.id,s="verified"===e.verification.status,u=[a&&!s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__primary"),onClick:()=>t(`verify-${l}`)}:null,!a&&s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__nonPrimary"),onClick:()=>o(n).catch(e=>(0,G.H4)(e,[],r.setError))}:null,!a&&!s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__unverified"),onClick:()=>t(`verify-${l}`)}:null,{label:(0,c.G)("userProfile.start.phoneNumbersSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:u})};var eb=t(7591),ey=t(4557),eS=t(78);let e_=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)(),l=(0,v.Wp)(e=>n?.update({username:e})),{userSettings:o}=(0,Y.O)(),a=(0,d.f0)(),{t:s,locale:u}=(0,eS._)(),{usernameSettings:h}=o,m=(0,ed.tJ)("username",n?.username||"",{type:"text",label:(0,c.G)("formFieldLabel__username"),placeholder:(0,c.G)("formFieldInputPlaceholder__username"),buildErrorMessage:e=>(0,ey.Z)(e,{t:s,locale:u,usernameSettings:h})});if(!n)return null;let f=o.attributes.username?.required,p=(!f||m.value.length>0)&&n.username!==m.value,g=async()=>{try{await l(m.value),r()}catch(e){(0,G.H4)(e,[m],a.setError)}};return(0,i.Y)(ec.M,{headerTitle:n.username?(0,c.G)("userProfile.usernamePage.title__update"):(0,c.G)("userProfile.usernamePage.title__set"),children:(0,i.FD)(ea.l.Root,{onSubmit:g,children:[(0,i.Y)(ea.l.ControlRow,{elementId:m.id,children:(0,i.Y)(ea.l.PlainInput,{...m.props,autoFocus:!0,isRequired:f})}),(0,i.Y)(es.G,{isDisabled:!p,onReset:t})]})})}),eD=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e_,{onSuccess:e,onReset:e})},eR=()=>{let{user:e}=(0,v.Jd)();return e?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.usernameSection.title"),id:"username",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"username",sx:{paddingLeft:e.username?void 0:"0"},children:[e.username&&(0,i.Y)(y.EY,{truncate:!0,sx:e=>({color:e.colors.$colorForeground}),children:e.username}),(0,i.Y)(C.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"username",localizationKey:e.username?(0,c.G)("userProfile.start.usernameSection.primaryButton__updateUsername"):(0,c.G)("userProfile.start.usernameSection.primaryButton__setUsername")})})]})}),(0,i.Y)(C.r.Open,{value:"edit",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eD,{})})})]})}):null};var eG=t(9345),ew=t(2421),eC=t(8225),e$=t(3817),eF=t(9538);let eI=e=>{let{user:r,...t}=e;return(0,i.Y)(e$.k,{...t,title:(0,c.G)("userProfile.profilePage.imageFormTitle"),avatarPreview:(0,i.Y)(eF.H,{size:e=>e.sizes.$12,...r})})},ex=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,d.f0)(),{user:l}=(0,v.Jd)();if(!l)return null;let{first_name:o,last_name:a}=(0,Y.O)().userSettings.attributes,s=o?.enabled,u=a?.enabled,h=l.firstName||"",m=l.lastName||"",f=(0,ed.tJ)("firstName",l.firstName||"",{type:"text",label:(0,c.G)("formFieldLabel__firstName"),placeholder:(0,c.G)("formFieldInputPlaceholder__firstName"),isRequired:a?.required}),p=(0,ed.tJ)("lastName",l.lastName||"",{type:"text",label:(0,c.G)("formFieldLabel__lastName"),placeholder:(0,c.G)("formFieldInputPlaceholder__lastName"),isRequired:a?.required}),g=s&&f.value!==h||u&&p.value!==m,P=s&&o.required||u&&a.required,b=P&&!!p.value&&!!f.value&&g,y=l.enterpriseAccounts.some(e=>e.active),S=async e=>(e.preventDefault(),(g?l.update({firstName:f.value,lastName:p.value}):Promise.resolve()).then(r).catch(e=>{(0,G.H4)(e,[f,p],n.setError)}));return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.profilePage.title"),children:[y&&(0,i.Y)(ew.k,{message:(0,c.G)("userProfile.profilePage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:S,sx:e=>({gap:e.space.$6}),children:[(0,i.Y)(eI,{user:l,onAvatarChange:e=>l.setProfileImage({file:e}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError)),onAvatarRemove:(0,eC.p)(l.imageUrl)?null:()=>{l.setProfileImage({file:null}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError))}}),(s||u)&&(0,i.FD)(ea.l.ControlRow,{elementId:"name",children:[s&&(0,i.Y)(ea.l.PlainInput,{...f.props,isDisabled:y,autoFocus:!0}),u&&(0,i.Y)(ea.l.PlainInput,{...p.props,isDisabled:y,autoFocus:!s})]}),(0,i.Y)(es.G,{isDisabled:P?!b:!g,onReset:t})]})]})}),ek=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(ex,{onSuccess:e,onReset:e})},eA=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{username:r,primaryEmailAddress:t,primaryPhoneNumber:n,primaryWeb3Wallet:l,...o}=e;return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.profileSection.title"),id:"profile",sx:{[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"profile",children:[(0,i.Y)(eG.c,{user:o,size:"lg",mainIdentifierVariant:"subtitle",sx:e=>({color:e.colors.$colorForeground})}),(0,i.Y)(C.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"profile",localizationKey:(0,c.G)("userProfile.start.profileSection.primaryButton")})})]})}),(0,i.Y)(C.r.Open,{value:"edit",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(ek,{})})})]})})};var ez=t(6463),eT=t(3610);let eE=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("188")]).then(t.bind(t,6464)).then(e=>({default:e.Web3SolanaWalletButtons}))),eL=({onConnect:e})=>{let r=(0,d.f0)(),{close:t}=(0,$.D5)(),l=async({walletName:i})=>{r.setLoading(i);try{await e({strategy:"web3_solana_signature",walletName:i}),r.setIdle(),t()}catch(e){if(r.setIdle(),e instanceof Error)(0,G.H4)(e,[],r.setError);else{let t=new eT.cR("An error occurred while generating the Solana signature.",{code:"web3_solana_signature_generation_failed",cause:e instanceof Error?e:void 0});(0,G.H4)(t,[],r.setError)}}};return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.start.web3WalletsSection.web3SelectSolanaWalletScreen.title"),headerSubtitle:(0,c.G)("userProfile.start.web3WalletsSection.web3SelectSolanaWalletScreen.subtitle"),children:(0,i.FD)(ea.l.Root,{children:[(0,i.Y)(n.Suspense,{fallback:(0,i.Y)(y.so,{direction:"row",align:"center",justify:"center",sx:e=>({height:"100%",minHeight:e.sizes.$32}),children:(0,i.Y)(y.y$,{size:"lg",colorScheme:"primary",elementDescriptor:S.$z.spinner})}),children:(0,i.Y)(eE,{web3AuthCallback:l})}),(0,i.Y)(es.c,{children:(0,i.Y)(y.$n,{type:"button",variant:"ghost",onClick:()=>{t()},localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})})]})})};var eO=t(5243);let eK=()=>{let e=(0,d.f0)(),{open:r}=(0,$.D5)(),{user:t}=(0,v.Jd)(),{strategies:n,strategyToDisplayData:l}=(0,F.k)(),o=(0,eO.R)(),a=n.filter(e=>e.startsWith("web3")),s=t?.verifiedWeb3Wallets?.map(e=>e.verification.strategy)??[],u=a.filter(e=>!s.includes(e)&&l[e]);if(0===u.length)return null;let h=(0,v.Wp)(e=>t?.createWeb3Wallet({web3Wallet:e})),m=async({strategy:i,walletName:n})=>{let l=(0,ez.U)(o);if("web3_solana_signature"===i&&!n)return void r("web3Wallets");let a=i.replace("web3_","").replace("_signature","");e.setError(void 0);try{e.setLoading(i);let r=await l.getWeb3Identifier({provider:a,walletName:n});if(!t)throw Error("user is not defined");let o=await h(r);o=await o?.prepareVerification({strategy:i});let s=o?.verification.message,c=await l.generateWeb3Signature({identifier:r,nonce:s,provider:a,walletName:n});await o?.attemptVerification({signature:c}),e.setIdle()}catch(t){e.setIdle();let r=(0,G.hG)(t);r?e.setError(r.longMessage):(0,G.H4)(t,[],e.setError)}};return(0,i.FD)(i.FK,{children:[(0,i.Y)(C.r.Closed,{value:"web3Wallets",children:(0,i.Y)(D.rd.ActionMenu,{id:"web3Wallets",triggerLocalizationKey:(0,c.G)("userProfile.start.web3WalletsSection.primaryButton"),children:u.map(r=>(0,i.Y)(D.rd.ActionMenuItem,{id:l[r].id,onClick:()=>{m({strategy:r})},isLoading:e.loadingMetadata===r,isDisabled:e.isLoading,localizationKey:(0,c.G)("userProfile.web3WalletPage.web3WalletButtonsBlockButton",{provider:l[r].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:(0,i.Y)(y._V,{elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(l[r].id),isLoading:e.loadingMetadata===r,isDisabled:e.isLoading,src:l[r].iconUrl,alt:`Connect ${l[r].name}`,sx:e=>({width:e.sizes.$5})})},r))})}),(0,i.Y)(C.r.Open,{value:"web3Wallets",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eL,{onConnect:m})})}),e.error&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:e.sizes.$1x5,paddingLeft:e.sizes.$8x5}),children:e.error})]})},eB=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(O,{onSuccess:r,onReset:r,...e})},eM=(0,d.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,d.f0)(),{strategyToDisplayData:l}=(0,F.k)(),o=!!r?.web3Wallets?.length,[a,s]=(0,n.useState)(null);return e||o?(0,i.FD)(D.rd.Root,{title:(0,c.G)("userProfile.start.web3WalletsSection.title"),centered:!1,id:"web3Wallets",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(C.r.Root,{value:a,onChange:s,children:[(0,i.Y)(D.rd.ItemList,{id:"web3Wallets",children:Z(r?.web3Wallets,r?.primaryWeb3WalletId).map(e=>{var t;let o=e.verification.strategy,a=e.id;return l[o]&&(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"web3Wallets",align:"start",children:[(0,i.FD)(y.so,{sx:e=>({alignItems:"center",gap:e.space.$2,width:"100%"}),children:[l[o].iconUrl&&(0,i.Y)(y._V,{src:l[o].iconUrl,alt:l[o].name,sx:e=>({width:e.sizes.$4})}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,justify:"start",children:[(0,i.FD)(y.EY,{children:[l[o].name," (",(t=e.web3Wallet).length<=10?t:t.slice(0,6)+"..."+t.slice(-4),")"]}),r?.primaryWeb3WalletId===a&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]})})]}),(0,i.Y)(eW,{walletId:a})]},a),(0,i.Y)(C.r.Open,{value:`remove-${a}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(eB,{walletId:e.id})})})]},e.id)})}),e&&(0,i.Y)(eK,{})]})]}):null}),eW=({walletId:e})=>{let r=(0,d.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),l=n?.primaryWeb3WalletId===e,o=(0,v.Wp)(()=>n?.update({primaryWeb3WalletId:e})),a=[!l?{label:(0,c.G)("userProfile.start.web3WalletsSection.detailsAction__nonPrimary"),onClick:()=>{o().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,{label:(0,c.G)("userProfile.start.web3WalletsSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${e}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:a})},eN=(0,d.dm)(()=>{let{attributes:e,social:r,enterpriseSSO:t}=(0,Y.O)().userSettings,n=(0,d.f0)(),{user:l}=(0,v.Jd)(),{shouldAllowIdentificationCreation:o}=(0,a.B)(),s=e.username?.enabled,u=e.email_address?.enabled,h=e.phone_number?.enabled,m=r&&Object.values(r).filter(e=>e.enabled).length>0,f=l&&t.enabled,p=e.web3_wallet?.enabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8,color:e.colors.$colorForeground}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("account"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,c.G)("userProfile.start.headerTitle__account"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:n.error}),(0,i.Y)(eA,{}),s&&(0,i.Y)(eR,{}),u&&(0,i.Y)(er,{shouldAllowCreation:o}),h&&(0,i.Y)(ev,{shouldAllowCreation:o}),m&&(0,i.Y)(J,{shouldAllowCreation:o}),f&&(0,i.Y)(ei,{}),p&&(0,i.Y)(eM,{shouldAllowCreation:o})]})})});var eJ=t(2611),eq=t(7806),eU=t(7896),ej=t(4901),eH=t(892),eV=t(8910);let eZ=()=>{let e,{user:r}=(0,v.Jd)(),{session:t}=(0,v.wV)(),{data:n,isLoading:l}=(0,eU.s)(r?.getSessions,"user-sessions");return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.activeDevicesSection.title"),centered:!1,id:"activeDevices",children:(0,i.Y)(D.rd.ItemList,{id:"activeDevices",disableAnimation:!0,children:l?(0,i.Y)(eJ.K,{}):n?.sort((e=t.id,r=>r.id===e?-1:1)).map(e=>eX(e.status)?(0,i.Y)(eQ,{session:e},e.id):null)})})},eX=e=>["active","pending"].includes(e),eQ=({session:e})=>{let r=(0,v.wV)().session?.id===e.id,t=(0,ej.m)(),n=(0,v.Wp)(e.revoke.bind(e)),l=async()=>{if(!r&&e)return t.setLoading(),n().catch(e=>(0,G.H4)(e,[],t.setError)).finally(()=>t.setIdle())};return(0,i.Y)(D.rd.Item,{id:"activeDevices",elementDescriptor:S.$z.activeDeviceListItem,elementId:r?S.$z.activeDeviceListItem.setId("current"):void 0,sx:{alignItems:"flex-start",opacity:t.isLoading?.5:1},isDisabled:t.isLoading,children:(0,i.FD)(i.FK,{children:[(0,i.Y)(e0,{session:e}),!r&&(0,i.Y)(e1,{revoke:l})]})})},e0=e=>{let{session:r}=(0,v.wV)(),t=r?.id===e.session.id,n=!!r?.actor,l=!!e.session.actor,{city:o,country:a,browserName:s,browserVersion:d,deviceType:u,ipAddress:h,isMobile:m}=e.session.latestActivity,f=`${s||""} ${d||""}`.trim()||"Web browser",p=[o||"",a||""].filter(Boolean).join(", ").trim()||null,{t:g}=(0,eS._)();return(0,i.FD)(y.so,{elementDescriptor:S.$z.activeDevice,elementId:t?S.$z.activeDevice.setId("current"):void 0,sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:[(0,i.Y)(y.so,{sx:e=>({[eb.g.sm]:{padding:"0"},borderRadius:e.radii.$md}),children:(0,i.Y)(y.In,{elementDescriptor:S.$z.activeDeviceIcon,elementId:S.$z.activeDeviceIcon.setId(m?"mobile":"desktop"),icon:m?eH.A:eV.A,sx:e=>({"--cl-chassis-bottom":"#444444","--cl-chassis-back":"#343434","--cl-chassis-screen":"#575757","--cl-screen":"#000000",width:e.space.$8,height:e.space.$8})})}),(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.FD)(y.so,{center:!0,gap:2,children:[(0,i.Y)(y.EY,{children:u||(m?"Mobile device":"Desktop device")}),t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__thisDevice"),colorScheme:n?"danger":"primary"}),n&&!l&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__userDevice")}),!t&&l&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__otherImpersonatorDevice"),colorScheme:"danger"})]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:f}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:[h," (",p,")"]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:g((0,eq.T)(e.session.lastActiveAt))})]})]})},e1=({revoke:e})=>{let r=[{label:(0,c.G)("userProfile.start.activeDevicesSection.destructiveAction"),isDestructive:!0,onClick:e}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})};var e2=t(9599),e5=t(8691);let e4=(0,d.dm)(e=>{let{onReset:r}=e,t=(0,d.f0)(),{afterSignOutUrl:n,afterMultiSessionSingleSignOutUrl:l}=(0,e2.g)(),{user:o}=(0,v.Jd)(),{t:a}=(0,eS._)(),{otherSessions:s}=(0,e5.z)({user:o}),{setActive:u}=(0,v.ho)(),h=(0,v.Wp)(()=>o?.delete()),m=(0,ed.tJ)("deleteConfirmation","",{type:"text",label:(0,c.G)("userProfile.deletePage.actionDescription"),isRequired:!0,placeholder:(0,c.G)("formFieldInputPlaceholder__confirmDeletionUserAccount")}),f=m.value===(a((0,c.G)("formFieldInputPlaceholder__confirmDeletionUserAccount"))||"Delete account"),p=async()=>{if(f)try{await h();let e=0===s.length?n:l;return await u({session:null,redirectUrl:e})}catch(e){(0,G.H4)(e,[],t.setError)}};return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.deletePage.title"),sx:e=>({gap:e.space.$0x5}),children:(0,i.FD)(ea.l.Root,{onSubmit:p,children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.deletePage.messageLine1")}),(0,i.Y)(y.EY,{colorScheme:"danger",localizationKey:(0,c.G)("userProfile.deletePage.messageLine2")})]}),(0,i.Y)(ea.l.ControlRow,{elementId:m.id,children:(0,i.Y)(ea.l.PlainInput,{...m.props,ignorePasswordManager:!0})}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.deletePage.confirm"),colorScheme:"danger",isDisabled:!f,onReset:r})]})})}),e3=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e4,{onSuccess:e,onReset:e})},e6=()=>(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.dangerSection.title"),id:"danger",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"delete",children:(0,i.Y)(D.rd.Item,{id:"danger",sx:e=>({paddingLeft:e.space.$1}),children:(0,i.Y)(C.r.Trigger,{value:"delete",children:(0,i.Y)(D.rd.Button,{id:"danger",variant:"ghost",colorScheme:"danger",localizationKey:(0,c.G)("userProfile.start.dangerSection.deleteAccountButton")})})})}),(0,i.Y)(C.r.Open,{value:"delete",children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(e3,{})})})]})});var e8=t(1323),e7=t(5079),e9=t(6103),re=t(2534),rr=t(8095),rt=t(9126),ri=t(7782),rn=t(1072),rl=t(5976),ro=t(2405),ra=t(2852);let rs=e=>{let{code:r}=e;return(0,i.Y)(y.so,{center:!0,sx:e=>({padding:`${e.space.$1} ${e.space.$4}`}),children:(0,i.Y)(y.EY,{children:r})})},rc=e=>{let{subtitle:r,backupCodes:t}=e,{applicationName:n}=(0,Y.O)().displayConfig,{user:l}=(0,v.Jd)(),{print:o,printableProps:a}=(0,rt.h)(),{onCopy:s,hasCopied:d}=(0,ri.i)(t?.join(",")||"");if(!l)return null;let u=(0,rr.Cm)(l);return t?(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.title__codelist"),variant:"subtitle"}),(0,i.Y)(y.EY,{localizationKey:r,variant:"caption",colorScheme:"secondary"})]}),(0,i.FD)(y.az,{sx:e=>({borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha100,borderRadius:e.radii.$lg}),children:[(0,i.Y)(y.xA,{gap:2,sx:e=>({gridTemplateColumns:`repeat(2, minmax(${e.sizes.$12}, 1fr))`,padding:`${e.space.$4} ${e.space.$6}`}),children:t.map((e,r)=>(0,i.Y)(rs,{code:e},r))}),(0,i.FD)(y.xA,{sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,gridTemplateColumns:"repeat(3, minmax(0, 1fr))",">:not([hidden])~:not([hidden])":{borderRightWidth:"0px",borderLeftWidth:"1px",borderStyle:"solid",borderColor:e.colors.$borderAlpha100},">:first-child":{borderBottomLeftRadius:e.radii.$lg},">:last-child":{borderBottomRightRadius:e.radii.$lg}}),children:[(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:()=>{var e,r,i;let l,o=document.createElement("a"),a=new Blob([(e=t,r=n,i=u,l=e?.join("\n"),`These are your backup codes for ${r} account ${i}.
1
+ "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["718"],{4484:function(e,r,t){t.r(r),t.d(r,{UserProfile:()=>r8,UserProfileModal:()=>r9});var i=t(4518),n=t(5074),l=t(1227),o=t(3264),a=t(5240),s=t(4607),c=t(2861),d=t(3269),u=t(9764),h=t(5396),f=t(7831),m=t(2265);let p=e=>{let{pages:r,apiKeysProps:t}=(0,a.B)(),n=r.routes.filter(e=>e.id!==l.j2.API_KEYS||!t?.hide);return(0,i.FD)(u.XM,{contentRef:e.contentRef,children:[(0,i.Y)(u.jq,{title:(0,c.G)("userProfile.navbar.title"),description:(0,c.G)("userProfile.navbar.description"),routes:n,contentRef:e.contentRef}),e.children]})};var g=t(540),Y=t(7697),v=t(1210),P=t(6088),b=t(6153),y=t(8272),S=t(8920),_=t(1421),D=t(4003),R=t(8080),G=t(4468),w=t(2660),C=t(3453),$=t(2513),F=t(2216),I=t(4964),k=t(6735);let x=e=>{let{strategy:r}=e,t=(0,d.f0)(),{user:n}=(0,v.Jd)(),{navigate:l}=(0,I.r)(),{strategyToDisplayData:o}=(0,F.k)(),{additionalOAuthScopes:s,componentName:u,mode:h}=(0,a.B)(),f="modal"===h,m=(0,v.Wp)(()=>{let e=r.replace("oauth_",""),t=f?(0,_.j)({url:window.location.href,componentName:u,socialProvider:e}):window.location.href,i=s?s[e]:[];return n?.createExternalAccount({strategy:r,redirectUrl:t,additionalScopes:i})}),p=o[r].iconUrl?(0,i.Y)(y._V,{isLoading:t.loadingMetadata===r,isDisabled:t.isLoading,elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(o[r].id),src:o[r].iconUrl,alt:`Connect ${o[r].name} account`,sx:e=>({width:e.sizes.$4})}):(0,i.Y)(w.T,{id:o[r].id,value:o[r].name,isLoading:t.loadingMetadata===r,isDisabled:t.isLoading});return(0,i.Y)(D.rd.ActionMenuItem,{id:o[r].id,onClick:()=>{if(n)return t.setLoading(r),m().then(e=>{e&&e.verification?.externalVerificationRedirectURL&&((0,k.y)(2e3).then(()=>t.setIdle(r)),l(e.verification.externalVerificationRedirectURL.href))}).catch(e=>{(0,G.H4)(e,[],t.setError),t.setIdle(r)})},isDisabled:t.isLoading,variant:"ghost",isLoading:t.loadingMetadata===r,focusRing:!1,closeAfterClick:!1,localizationKey:(0,c.G)("userProfile.connectedAccountPage.socialButtonsBlockButton",{provider:o[r].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:p},r)},A=({onClick:e})=>{let{user:r}=(0,v.Jd)(),{strategies:t}=(0,F.k)(),n=t.filter(e=>e.startsWith("oauth")),l=r?.verifiedExternalAccounts.map(e=>`oauth_${e.provider}`),o=n.filter(e=>!l.includes(e));return 0===o.length?null:(0,i.Y)(D.rd.ActionMenu,{triggerLocalizationKey:(0,c.G)("userProfile.start.connectedAccountsSection.primaryButton"),id:"connectedAccounts",onClick:e,children:o.map(e=>(0,i.Y)(x,{strategy:e},e))})};var z=t(8046);let T=e=>{let{onSuccess:r,onReset:t}=e,{user:l}=(0,v.Jd)(),{emailId:o}=e,a=l?.emailAddresses.find(e=>e.id===o),s=n.useRef(a?.emailAddress),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.emailAddressPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.emailAddressPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.emailAddressPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.emailAddressPage.removeResource.successMessage",{emailAddress:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:r,onReset:t}):null},E=e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.phoneNumbers.find(e=>e.id===r),s=n.useRef(a?.phoneNumber),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.phoneNumberPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.phoneNumberPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.phoneNumberPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.phoneNumberPage.removeResource.successMessage",{phoneNumber:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},L=e=>{let{accountId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.externalAccounts.find(e=>e.id===r),s=n.useRef(a?.provider),{providerToDisplayData:d}=(0,F.k)();return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.connectedAccountPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.connectedAccountPage.removeResource.messageLine1",{identifier:d[s.current]?.name||""}),messageLine2:(0,c.G)("userProfile.connectedAccountPage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.connectedAccountPage.removeResource.successMessage",{connectedAccount:d[s.current]?.name||""}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},O=e=>{let{user:r}=(0,v.Jd)(),{walletId:t,onSuccess:l,onReset:o}=e,a=r?.web3Wallets.find(e=>e.id===t),s=n.useRef(a?.web3Wallet),d=a?.verification?.status==="verified"?(0,c.G)("userProfile.web3WalletPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.web3WalletPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.web3WalletPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:d,successMessage:(0,c.G)("userProfile.web3WalletPage.removeResource.successMessage",{web3Wallet:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:l,onReset:o}):null},K=e=>{let{user:r}=(0,v.Jd)(),{phoneId:t,onSuccess:l,onReset:o}=e,a=r?.phoneNumbers.find(e=>e.id===t),s=n.useRef(a?.phoneNumber);return s.current?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.title"),messageLine1:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine1",{identifier:s.current}),messageLine2:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.mfaPhoneCodePage.removeResource.successMessage",{mfaPhoneCode:s.current}),deleteResource:()=>Promise.resolve(a?.setReservedForSecondFactor({reserved:!1})),onSuccess:l,onReset:o}):null},B=e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)();return n?(0,i.Y)(z.P,{title:(0,c.G)("userProfile.mfaTOTPPage.removeResource.title"),messageLine1:(0,c.G)("userProfile.mfaTOTPPage.removeResource.messageLine1"),messageLine2:(0,c.G)("userProfile.mfaTOTPPage.removeResource.messageLine2"),successMessage:(0,c.G)("userProfile.mfaTOTPPage.removeResource.successMessage"),deleteResource:n.disableTOTP,onSuccess:r,onReset:t}):null},W=e=>{let{onSuccess:r,onReset:t,passkey:n}=e;return(0,i.Y)(z.P,{title:(0,c.G)("userProfile.passkeyScreen.removeResource.title"),messageLine1:(0,c.G)("userProfile.passkeyScreen.removeResource.messageLine1",{name:n.name||""}),deleteResource:n.delete,onSuccess:r,onReset:t})},M=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(L,{onSuccess:r,onReset:r,...e})},N=["external_account_missing_refresh_token","oauth_fetch_user_error","oauth_token_exchange_error","external_account_email_address_verification_required"],J=(0,d.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,d.f0)(),l=!!r?.externalAccounts?.length,[o,a]=(0,n.useState)(null);if(!r||!e&&!l)return null;let s=[...r.verifiedExternalAccounts,...r.unverifiedExternalAccounts.filter(e=>e.verification?.error)];return(0,i.FD)(D.rd.Root,{title:(0,c.G)("userProfile.start.connectedAccountsSection.title"),centered:!1,id:"connectedAccounts",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(C.r.Root,{value:o,onChange:a,children:[(0,i.Y)(D.rd.ItemList,{id:"connectedAccounts",children:s.map(e=>(0,i.Y)(q,{account:e},e.id))}),e&&(0,i.Y)(A,{onClick:()=>a(null)})]})]})}),q=({account:e})=>{let{additionalOAuthScopes:r,componentName:t,mode:l}=(0,a.B)(),{navigate:o}=(0,I.r)(),{user:s}=(0,v.Jd)(),u=(0,d.f0)(),h=e.id,f="modal"===l,m=f?(0,_.j)({url:window.location.href,componentName:t}):window.location.href,p=(0,v.Wp)(()=>s?.createExternalAccount({strategy:e.verification.strategy,redirectUrl:m,additionalScopes:b}));if(!s)return null;let{providerToDisplayData:g}=(0,F.k)(),Y=e.username||e.emailAddress,P=e.verification?.error?.longMessage,b=function(e,r){if(!r)return[];let t=r[e.provider]||[],i=e.approvedScopes.split(" ");return 0===t.filter(e=>!i.includes(e)).length?[]:t}(e,r),R=b.length>0&&""!=e.approvedScopes,$=N.includes(e.verification?.error?.code||"")||R,k=$?(0,c.G)("userProfile.start.connectedAccountsSection.subtitle__disconnected"):P,x=async()=>{let r=f?(0,_.j)({url:window.location.href,componentName:t}):window.location.href;try{let t;(t=R?await e.reauthorize({additionalScopes:b,redirectUrl:r}):await p())&&await o(t.verification.externalVerificationRedirectURL?.href||"")}catch(e){(0,G.H4)(e,[],u.setError)}};return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"connectedAccounts",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$2}),children:[(0,i.Y)(()=>g[e.provider].iconUrl?(0,i.Y)(y._V,{elementDescriptor:[S.$z.providerIcon],elementId:S.$z.socialButtonsProviderIcon.setId(e.provider),alt:g[e.provider].name,src:g[e.provider].iconUrl,sx:e=>({width:e.sizes.$4,flexShrink:0})}):(0,i.Y)(w.T,{id:e.provider,value:g[e.provider].name}),{}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:`${g[e.provider].name}`}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:Y?`• ${Y}`:""})]})})]}),(0,i.Y)(U,{account:e})]}),$&&(0,i.FD)(y.az,{sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:[(0,i.Y)(y.EY,{colorScheme:"secondary",sx:e=>({paddingRight:e.sizes.$1x5,display:"inline-block"}),localizationKey:k}),(0,i.Y)(y.$n,{sx:{display:"inline-block"},onClick:x,variant:"link",localizationKey:(0,c.G)("userProfile.start.connectedAccountsSection.actionLabel__connectionFailed")})]}),e.verification?.error?.code&&!$&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:P}),(0,i.Y)(C.r.Open,{value:`remove-${h}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(M,{accountId:e.id})})})]},e.id)},U=({account:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,c.G)("userProfile.start.connectedAccountsSection.destructiveActionTitle"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:n})},j=e=>e.defaultSecondFactor?-1:1;function H(e){let r=[];return Object.entries(e).forEach(([,e])=>{e.used_for_second_factor&&r.push(...e.second_factors)}),r}function V(e,r){let t=H(e);return r.totpEnabled&&(t=t.filter(e=>"totp"!==e)),(r.backupCodeEnabled||!r.twoFactorEnabled)&&(t=t.filter(e=>"backup_code"!==e)),t}function Z(e,r){if(!e)return[];let t=e.filter(e=>e.id===r),i=e.filter(e=>e.id!==r),n=i.filter(e=>e.verification?.status==="verified"),l=i.filter(e=>!!e.verification?.status&&e.verification?.status!=="verified"),o=i.filter(e=>!e.verification.status);return n.sort((e,r)=>e.id.localeCompare(r.id)),l.sort((e,r)=>e.verification?.expireAt&&r.verification?.expireAt?e.verification.expireAt.getTime()-r.verification.expireAt.getTime():0),[...t,...n,...l,...o]}var X=t(2336);let Q=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(T,{onSuccess:r,onReset:r,...e})},ee=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(X.v,{onSuccess:r,onReset:r,...e})},er=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)();return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.emailAddressesSection.title"),centered:!1,id:"emailAddresses",children:(0,i.Y)(C.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"emailAddresses",children:[Z(r?.emailAddresses,r?.primaryEmailAddressId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"emailAddresses",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$1}),children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),truncate:!0,children:e.emailAddress}),r?.primaryEmailAddressId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]}),(0,i.Y)(et,{email:e})]}),(0,i.Y)(C.r.Open,{value:`remove-${t}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(Q,{emailId:t})})}),(0,i.Y)(C.r.Open,{value:`verify-${t}`,children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(ee,{emailId:t})})})]},e.emailAddress)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(C.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"emailAddresses",localizationKey:(0,c.G)("userProfile.start.emailAddressesSection.primaryButton")})}),(0,i.Y)(C.r.Open,{value:"add",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(ee,{})})})]})]})})})},et=({email:e})=>{let r=(0,d.f0)(),{user:t}=(0,v.Jd)(),{open:n}=(0,$.D5)(),l=e.id,o=t?.primaryEmailAddressId===l,a="verified"===e.verification.status,s=(0,v.Wp)(()=>t?.update({primaryEmailAddressId:l})),u=[o&&!a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__primary"),onClick:()=>n(`verify-${l}`)}:null,!o&&a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__nonPrimary"),onClick:()=>{s().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,!o&&!a?{label:(0,c.G)("userProfile.start.emailAddressesSection.detailsAction__unverified"),onClick:()=>n(`verify-${l}`)}:null,{label:(0,c.G)("userProfile.start.emailAddressesSection.destructiveAction"),isDestructive:!0,onClick:()=>n(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:u})},ei=()=>{let{user:e}=(0,v.Jd)(),r=e?.enterpriseAccounts.filter(({enterpriseConnection:e})=>e?.active);return r?.length?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.enterpriseAccountsSection.title"),id:"enterpriseAccounts",centered:!1,children:(0,i.Y)(D.rd.ItemList,{id:"enterpriseAccounts",children:r.map(e=>(0,i.Y)(en,{account:e},e.id))})}):null},en=({account:e})=>{let r=e.emailAddress,t=e?.enterpriseConnection?.name,n=e.verification?.error?.longMessage;return(0,i.FD)(D.rd.Item,{id:"enterpriseAccounts",sx:e=>({gap:e.space.$2,justifyContent:"start"}),children:[(0,i.Y)(el,{account:e}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{truncate:!0,colorScheme:"body",children:t}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:r?`• ${r}`:""}),n&&(0,i.Y)(y.Ex,{colorScheme:"danger",localizationKey:(0,c.G)("badge__requiresAction")})]})})]},e.id)},el=({account:e})=>{let{provider:r,enterpriseConnection:t}=e,n=r.replace(/(oauth_|saml_)/,"").trim(),l=t?.name??n,o={elementDescriptor:[S.$z.providerIcon],alt:l,sx:e=>({width:e.sizes.$4}),elementId:S.$z.enterpriseButtonsProviderIcon.setId(e.provider)};return t?.logoPublicUrl?(0,i.Y)(y._V,{...o,src:t.logoPublicUrl}):(0,i.Y)(w.T,{id:n,value:l,"aria-label":`${l}'s icon`,elementDescriptor:[S.$z.providerIcon,S.$z.providerInitialIcon],elementId:S.$z.providerInitialIcon.setId(n)})};var eo=t(7651),ea=t(2454),es=t(1475),ec=t(3549),ed=t(8640),eu=t(6245),eh=t(1282);let ef=(0,d.dm)(e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=n.useRef(o?.phoneNumbers.find(e=>e.id===r)),s=(0,eu.X)({defaultStep:+!!a.current});return(0,i.FD)(eu.s,{...s.props,children:[(0,i.Y)(em,{resourceRef:a,title:(0,c.G)("userProfile.phoneNumberPage.title"),onSuccess:s.nextStep,onReset:l}),(0,i.Y)(ep,{resourceRef:a,title:(0,c.G)("userProfile.phoneNumberPage.verifyTitle"),onSuccess:t,onReset:l})]})}),em=e=>{let{title:r,onSuccess:t,onReset:n,onUseExistingNumberClick:l,resourceRef:o}=e,a=(0,d.f0)(),{user:s}=(0,v.Jd)(),u=(0,v.Wp)((e,r)=>e.createPhoneNumber(r)),h=(0,ed.tJ)("phoneNumber","",{type:"tel",label:(0,c.G)("formFieldLabel__phoneNumber"),isRequired:!0}),f=h.value.length>1&&s?.username!==h.value,m=!!s?.phoneNumbers?.length&&l,p=async e=>{if(e.preventDefault(),s)return u(s,{phoneNumber:h.value}).then(e=>{o.current=e,t()}).catch(e=>(0,G.H4)(e,[h],a.setError))};return(0,i.Y)(ec.M,{headerTitle:r,gap:1,children:(0,i.FD)(ea.l.Root,{gap:4,onSubmit:p,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.phoneNumberPage.infoText"),colorScheme:"secondary"}),(0,i.Y)(ea.l.ControlRow,{elementId:h.id,children:(0,i.Y)(ea.l.PhoneInput,{...h.props,autoFocus:!0})}),(0,i.FD)(y.so,{justify:m?"between":"end",children:[m&&(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,c.G)("userProfile.mfaPhoneCodePage.backButton"),onClick:l}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.formButtonPrimary__add"),isDisabled:!f,onReset:n})]})]})})},ep=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:l}=e;return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,c.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:t,identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:l})})},eg=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(E,{onSuccess:r,onReset:r,...e})},eY=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(ef,{onSuccess:r,onReset:r,...e})},ev=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=!!r?.phoneNumbers?.length;return e||t?(0,i.Y)(D.rd.Root,{centered:!1,title:(0,c.G)("userProfile.start.phoneNumbersSection.title"),id:"phoneNumbers",children:(0,i.Y)(C.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"phoneNumbers",children:[Z(r?.phoneNumbers,r?.primaryPhoneNumberId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"phoneNumbers",children:[(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:(0,eo.Om)(e.phoneNumber)}),r?.primaryPhoneNumberId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]})}),(0,i.Y)(eP,{phone:e})]}),(0,i.Y)(C.r.Open,{value:`remove-${t}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(eg,{phoneId:t})})}),(0,i.Y)(C.r.Open,{value:`verify-${t}`,children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eY,{phoneId:t})})})]},t)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(C.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"phoneNumbers",localizationKey:(0,c.G)("userProfile.start.phoneNumbersSection.primaryButton")})}),(0,i.Y)(C.r.Open,{value:"add",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eY,{})})})]})]})})}):null},eP=({phone:e})=>{let r=(0,d.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),l=e.id,o=(0,v.Wp)(r=>r.update({primaryPhoneNumberId:e.id}));if(!n)return null;let a=n.primaryPhoneNumberId===e.id,s="verified"===e.verification.status,u=[a&&!s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__primary"),onClick:()=>t(`verify-${l}`)}:null,!a&&s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__nonPrimary"),onClick:()=>o(n).catch(e=>(0,G.H4)(e,[],r.setError))}:null,!a&&!s?{label:(0,c.G)("userProfile.start.phoneNumbersSection.detailsAction__unverified"),onClick:()=>t(`verify-${l}`)}:null,{label:(0,c.G)("userProfile.start.phoneNumbersSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:u})};var eb=t(7591),ey=t(4557),eS=t(78);let e_=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)(),l=(0,v.Wp)(e=>n?.update({username:e})),{userSettings:o}=(0,Y.O)(),a=(0,d.f0)(),{t:s,locale:u}=(0,eS._)(),{usernameSettings:h}=o,f=(0,ed.tJ)("username",n?.username||"",{type:"text",label:(0,c.G)("formFieldLabel__username"),placeholder:(0,c.G)("formFieldInputPlaceholder__username"),buildErrorMessage:e=>(0,ey.Z)(e,{t:s,locale:u,usernameSettings:h})});if(!n)return null;let m=o.attributes.username?.required,p=(!m||f.value.length>0)&&n.username!==f.value,g=async()=>{try{await l(f.value),r()}catch(e){(0,G.H4)(e,[f],a.setError)}};return(0,i.Y)(ec.M,{headerTitle:n.username?(0,c.G)("userProfile.usernamePage.title__update"):(0,c.G)("userProfile.usernamePage.title__set"),children:(0,i.FD)(ea.l.Root,{onSubmit:g,children:[(0,i.Y)(ea.l.ControlRow,{elementId:f.id,children:(0,i.Y)(ea.l.PlainInput,{...f.props,autoFocus:!0,isRequired:m})}),(0,i.Y)(es.G,{isDisabled:!p,onReset:t})]})})}),eD=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e_,{onSuccess:e,onReset:e})},eR=()=>{let{user:e}=(0,v.Jd)();return e?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.usernameSection.title"),id:"username",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"username",sx:{paddingLeft:e.username?void 0:"0"},children:[e.username&&(0,i.Y)(y.EY,{truncate:!0,sx:e=>({color:e.colors.$colorForeground}),children:e.username}),(0,i.Y)(C.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"username",localizationKey:e.username?(0,c.G)("userProfile.start.usernameSection.primaryButton__updateUsername"):(0,c.G)("userProfile.start.usernameSection.primaryButton__setUsername")})})]})}),(0,i.Y)(C.r.Open,{value:"edit",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eD,{})})})]})}):null};var eG=t(9345),ew=t(2421),eC=t(8225),e$=t(3817),eF=t(9538);let eI=e=>{let{user:r,...t}=e;return(0,i.Y)(e$.k,{...t,title:(0,c.G)("userProfile.profilePage.imageFormTitle"),avatarPreview:(0,i.Y)(eF.H,{size:e=>e.sizes.$12,...r})})},ek=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,d.f0)(),{user:l}=(0,v.Jd)();if(!l)return null;let{first_name:o,last_name:a}=(0,Y.O)().userSettings.attributes,s=o?.enabled,u=a?.enabled,h=l.firstName||"",f=l.lastName||"",m=(0,ed.tJ)("firstName",l.firstName||"",{type:"text",label:(0,c.G)("formFieldLabel__firstName"),placeholder:(0,c.G)("formFieldInputPlaceholder__firstName"),isRequired:a?.required}),p=(0,ed.tJ)("lastName",l.lastName||"",{type:"text",label:(0,c.G)("formFieldLabel__lastName"),placeholder:(0,c.G)("formFieldInputPlaceholder__lastName"),isRequired:a?.required}),g=s&&m.value!==h||u&&p.value!==f,P=s&&o.required||u&&a.required,b=P&&!!p.value&&!!m.value&&g,y=l.enterpriseAccounts.some(e=>e.active),S=async e=>(e.preventDefault(),(g?l.update({firstName:m.value,lastName:p.value}):Promise.resolve()).then(r).catch(e=>{(0,G.H4)(e,[m,p],n.setError)}));return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.profilePage.title"),children:[y&&(0,i.Y)(ew.k,{message:(0,c.G)("userProfile.profilePage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:S,sx:e=>({gap:e.space.$6}),children:[(0,i.Y)(eI,{user:l,onAvatarChange:e=>l.setProfileImage({file:e}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError)),onAvatarRemove:(0,eC.p)(l.imageUrl)?null:()=>{l.setProfileImage({file:null}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError))}}),(s||u)&&(0,i.FD)(ea.l.ControlRow,{elementId:"name",children:[s&&(0,i.Y)(ea.l.PlainInput,{...m.props,isDisabled:y,autoFocus:!0}),u&&(0,i.Y)(ea.l.PlainInput,{...p.props,isDisabled:y,autoFocus:!s})]}),(0,i.Y)(es.G,{isDisabled:P?!b:!g,onReset:t})]})]})}),ex=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(ek,{onSuccess:e,onReset:e})},eA=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{username:r,primaryEmailAddress:t,primaryPhoneNumber:n,primaryWeb3Wallet:l,...o}=e;return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.profileSection.title"),id:"profile",sx:{[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"profile",children:[(0,i.Y)(eG.c,{user:o,size:"lg",mainIdentifierVariant:"subtitle",sx:e=>({color:e.colors.$colorForeground})}),(0,i.Y)(C.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"profile",localizationKey:(0,c.G)("userProfile.start.profileSection.primaryButton")})})]})}),(0,i.Y)(C.r.Open,{value:"edit",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(ex,{})})})]})})};var ez=t(6463),eT=t(5243),eE=t(3610);let eL=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("188")]).then(t.bind(t,6464)).then(e=>({default:e.Web3SolanaWalletButtons}))),eO=({onConnect:e})=>{let r=(0,d.f0)(),{close:t}=(0,$.D5)(),l=async({walletName:i})=>{r.setLoading(i);try{await e({strategy:"web3_solana_signature",walletName:i}),r.setIdle(),t()}catch(e){if(r.setIdle(),e instanceof Error)(0,G.H4)(e,[],r.setError);else{let t=new eE.cR("An error occurred while generating the Solana signature.",{code:"web3_solana_signature_generation_failed",cause:e instanceof Error?e:void 0});(0,G.H4)(t,[],r.setError)}}};return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.start.web3WalletsSection.web3SelectSolanaWalletScreen.title"),headerSubtitle:(0,c.G)("userProfile.start.web3WalletsSection.web3SelectSolanaWalletScreen.subtitle"),children:(0,i.FD)(ea.l.Root,{children:[(0,i.Y)(n.Suspense,{fallback:(0,i.Y)(y.so,{direction:"row",align:"center",justify:"center",sx:e=>({height:"100%",minHeight:e.sizes.$32}),children:(0,i.Y)(y.y$,{size:"lg",colorScheme:"primary",elementDescriptor:S.$z.spinner})}),children:(0,i.Y)(eL,{web3AuthCallback:l})}),(0,i.Y)(es.c,{children:(0,i.Y)(y.$n,{type:"button",variant:"ghost",onClick:()=>{t()},localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})})]})})};var eK=t(9236);let eB=()=>{let e=(0,d.f0)(),{open:r}=(0,$.D5)(),{user:t}=(0,v.Jd)(),{strategies:n,strategyToDisplayData:l}=(0,F.k)(),o=(0,eT.R)(),a=n.filter(e=>e.startsWith("web3")),s=t?.verifiedWeb3Wallets?.map(e=>e.verification.strategy)??[],u=a.filter(e=>!s.includes(e)&&l[e]);if(0===u.length)return null;let h=(0,v.Wp)(e=>t?.createWeb3Wallet({web3Wallet:e})),f=async({strategy:i,walletName:n})=>{let l=(0,ez.U)(o);if("web3_solana_signature"===i&&!n)return void r("web3Wallets");let a=i.replace("web3_","").replace("_signature","");e.setError(void 0);try{e.setLoading(i);let r=await l.getWeb3Identifier({provider:a,walletName:n});if(!t)throw Error("user is not defined");let o=await h(r);o=await o?.prepareVerification({strategy:i});let s=o?.verification.message,c=await l.generateWeb3Signature({identifier:r,nonce:s,provider:a,walletName:n});await o?.attemptVerification({signature:c}),e.setIdle()}catch(r){e.setIdle(),(0,eK.f)(r,e.setError)}};return(0,i.FD)(i.FK,{children:[(0,i.Y)(C.r.Closed,{value:"web3Wallets",children:(0,i.Y)(D.rd.ActionMenu,{id:"web3Wallets",triggerLocalizationKey:(0,c.G)("userProfile.start.web3WalletsSection.primaryButton"),children:u.map(r=>(0,i.Y)(D.rd.ActionMenuItem,{id:l[r].id,onClick:()=>{f({strategy:r})},isLoading:e.loadingMetadata===r,isDisabled:e.isLoading,localizationKey:(0,c.G)("userProfile.web3WalletPage.web3WalletButtonsBlockButton",{provider:l[r].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:(0,i.Y)(y._V,{elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(l[r].id),isLoading:e.loadingMetadata===r,isDisabled:e.isLoading,src:l[r].iconUrl,alt:`Connect ${l[r].name}`,sx:e=>({width:e.sizes.$5})})},r))})}),(0,i.Y)(C.r.Open,{value:"web3Wallets",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(eO,{onConnect:f})})})]})},eW=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(O,{onSuccess:r,onReset:r,...e})},eM=(0,d.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,d.f0)(),{strategyToDisplayData:l}=(0,F.k)(),o=!!r?.web3Wallets?.length,[a,s]=(0,n.useState)(null);return e||o?(0,i.FD)(D.rd.Root,{title:(0,c.G)("userProfile.start.web3WalletsSection.title"),centered:!1,id:"web3Wallets",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(C.r.Root,{value:a,onChange:s,children:[(0,i.Y)(D.rd.ItemList,{id:"web3Wallets",children:Z(r?.web3Wallets,r?.primaryWeb3WalletId).map(e=>{var t;let o=e.verification.strategy,a=e.id;return l[o]&&(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"web3Wallets",align:"start",children:[(0,i.FD)(y.so,{sx:e=>({alignItems:"center",gap:e.space.$2,width:"100%"}),children:[l[o].iconUrl&&(0,i.Y)(y._V,{src:l[o].iconUrl,alt:l[o].name,sx:e=>({width:e.sizes.$4})}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,justify:"start",children:[(0,i.FD)(y.EY,{children:[l[o].name," (",(t=e.web3Wallet).length<=10?t:t.slice(0,6)+"..."+t.slice(-4),")"]}),r?.primaryWeb3WalletId===a&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__unverified")})]})})]}),(0,i.Y)(eN,{walletId:a,isVerified:"verified"===e.verification.status})]},a),(0,i.Y)(C.r.Open,{value:`remove-${a}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(eW,{walletId:e.id})})})]},e.id)})}),e&&(0,i.Y)(eB,{})]})]}):null}),eN=({walletId:e,isVerified:r})=>{let t=(0,d.f0)(),{open:n}=(0,$.D5)(),{user:l}=(0,v.Jd)(),o=l?.primaryWeb3WalletId===e,a=(0,v.Wp)(()=>l?.update({primaryWeb3WalletId:e})),s=[!o&&r?{label:(0,c.G)("userProfile.start.web3WalletsSection.detailsAction__nonPrimary"),onClick:()=>{a().catch(e=>(0,G.H4)(e,[],t.setError))}}:null,{label:(0,c.G)("userProfile.start.web3WalletsSection.destructiveAction"),isDestructive:!0,onClick:()=>n(`remove-${e}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:s})},eJ=(0,d.dm)(()=>{let{attributes:e,social:r,enterpriseSSO:t}=(0,Y.O)().userSettings,n=(0,d.f0)(),{user:l}=(0,v.Jd)(),{shouldAllowIdentificationCreation:o}=(0,a.B)(),s=e.username?.enabled,u=e.email_address?.enabled,h=e.phone_number?.enabled,f=r&&Object.values(r).filter(e=>e.enabled).length>0,m=l&&t.enabled,p=e.web3_wallet?.enabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8,color:e.colors.$colorForeground}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("account"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,c.G)("userProfile.start.headerTitle__account"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:n.error}),(0,i.Y)(eA,{}),s&&(0,i.Y)(eR,{}),u&&(0,i.Y)(er,{shouldAllowCreation:o}),h&&(0,i.Y)(ev,{shouldAllowCreation:o}),f&&(0,i.Y)(J,{shouldAllowCreation:o}),m&&(0,i.Y)(ei,{}),p&&(0,i.Y)(eM,{shouldAllowCreation:o})]})})});var eq=t(2611),eU=t(7806),ej=t(7896),eH=t(4901),eV=t(892),eZ=t(8910);let eX=()=>{let e,{user:r}=(0,v.Jd)(),{session:t}=(0,v.wV)(),{data:n,isLoading:l}=(0,ej.s)(r?.getSessions,"user-sessions");return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.activeDevicesSection.title"),centered:!1,id:"activeDevices",children:(0,i.Y)(D.rd.ItemList,{id:"activeDevices",disableAnimation:!0,children:l?(0,i.Y)(eq.K,{}):n?.sort((e=t.id,r=>r.id===e?-1:1)).map(e=>eQ(e.status)?(0,i.Y)(e0,{session:e},e.id):null)})})},eQ=e=>["active","pending"].includes(e),e0=({session:e})=>{let r=(0,v.wV)().session?.id===e.id,t=(0,eH.m)(),n=(0,v.Wp)(e.revoke.bind(e)),l=async()=>{if(!r&&e)return t.setLoading(),n().catch(e=>(0,G.H4)(e,[],t.setError)).finally(()=>t.setIdle())};return(0,i.Y)(D.rd.Item,{id:"activeDevices",elementDescriptor:S.$z.activeDeviceListItem,elementId:r?S.$z.activeDeviceListItem.setId("current"):void 0,sx:{alignItems:"flex-start",opacity:t.isLoading?.5:1},isDisabled:t.isLoading,children:(0,i.FD)(i.FK,{children:[(0,i.Y)(e1,{session:e}),!r&&(0,i.Y)(e2,{revoke:l})]})})},e1=e=>{let{session:r}=(0,v.wV)(),t=r?.id===e.session.id,n=!!r?.actor,l=!!e.session.actor,{city:o,country:a,browserName:s,browserVersion:d,deviceType:u,ipAddress:h,isMobile:f}=e.session.latestActivity,m=`${s||""} ${d||""}`.trim()||"Web browser",p=[o||"",a||""].filter(Boolean).join(", ").trim()||null,{t:g}=(0,eS._)();return(0,i.FD)(y.so,{elementDescriptor:S.$z.activeDevice,elementId:t?S.$z.activeDevice.setId("current"):void 0,sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:[(0,i.Y)(y.so,{sx:e=>({[eb.g.sm]:{padding:"0"},borderRadius:e.radii.$md}),children:(0,i.Y)(y.In,{elementDescriptor:S.$z.activeDeviceIcon,elementId:S.$z.activeDeviceIcon.setId(f?"mobile":"desktop"),icon:f?eV.A:eZ.A,sx:e=>({"--cl-chassis-bottom":"#444444","--cl-chassis-back":"#343434","--cl-chassis-screen":"#575757","--cl-screen":"#000000",width:e.space.$8,height:e.space.$8})})}),(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.FD)(y.so,{center:!0,gap:2,children:[(0,i.Y)(y.EY,{children:u||(f?"Mobile device":"Desktop device")}),t&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__thisDevice"),colorScheme:n?"danger":"primary"}),n&&!l&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__userDevice")}),!t&&l&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__otherImpersonatorDevice"),colorScheme:"danger"})]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:m}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:[h," (",p,")"]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:g((0,eU.T)(e.session.lastActiveAt))})]})]})},e2=({revoke:e})=>{let r=[{label:(0,c.G)("userProfile.start.activeDevicesSection.destructiveAction"),isDestructive:!0,onClick:e}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})};var e5=t(9599),e4=t(8691);let e3=(0,d.dm)(e=>{let{onReset:r}=e,t=(0,d.f0)(),{afterSignOutUrl:n,afterMultiSessionSingleSignOutUrl:l}=(0,e5.g)(),{user:o}=(0,v.Jd)(),{t:a}=(0,eS._)(),{otherSessions:s}=(0,e4.z)({user:o}),{setActive:u}=(0,v.ho)(),h=(0,v.Wp)(()=>o?.delete()),f=(0,ed.tJ)("deleteConfirmation","",{type:"text",label:(0,c.G)("userProfile.deletePage.actionDescription"),isRequired:!0,placeholder:(0,c.G)("formFieldInputPlaceholder__confirmDeletionUserAccount")}),m=f.value===(a((0,c.G)("formFieldInputPlaceholder__confirmDeletionUserAccount"))||"Delete account"),p=async()=>{if(m)try{await h();let e=0===s.length?n:l;return await u({session:null,redirectUrl:e})}catch(e){(0,G.H4)(e,[],t.setError)}};return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.deletePage.title"),sx:e=>({gap:e.space.$0x5}),children:(0,i.FD)(ea.l.Root,{onSubmit:p,children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.deletePage.messageLine1")}),(0,i.Y)(y.EY,{colorScheme:"danger",localizationKey:(0,c.G)("userProfile.deletePage.messageLine2")})]}),(0,i.Y)(ea.l.ControlRow,{elementId:f.id,children:(0,i.Y)(ea.l.PlainInput,{...f.props,ignorePasswordManager:!0})}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.deletePage.confirm"),colorScheme:"danger",isDisabled:!m,onReset:r})]})})}),e6=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e3,{onSuccess:e,onReset:e})},e8=()=>(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.dangerSection.title"),id:"danger",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"delete",children:(0,i.Y)(D.rd.Item,{id:"danger",sx:e=>({paddingLeft:e.space.$1}),children:(0,i.Y)(C.r.Trigger,{value:"delete",children:(0,i.Y)(D.rd.Button,{id:"danger",variant:"ghost",colorScheme:"danger",localizationKey:(0,c.G)("userProfile.start.dangerSection.deleteAccountButton")})})})}),(0,i.Y)(C.r.Open,{value:"delete",children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(e6,{})})})]})});var e7=t(1323),e9=t(5079),re=t(6103),rr=t(2534),rt=t(8095),ri=t(9126),rn=t(7782),rl=t(1072),ro=t(5976),ra=t(2405),rs=t(2852);let rc=e=>{let{code:r}=e;return(0,i.Y)(y.so,{center:!0,sx:e=>({padding:`${e.space.$1} ${e.space.$4}`}),children:(0,i.Y)(y.EY,{children:r})})},rd=e=>{let{subtitle:r,backupCodes:t}=e,{applicationName:n}=(0,Y.O)().displayConfig,{user:l}=(0,v.Jd)(),{print:o,printableProps:a}=(0,ri.h)(),{onCopy:s,hasCopied:d}=(0,rn.i)(t?.join(",")||"");if(!l)return null;let u=(0,rt.Cm)(l);return t?(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.title__codelist"),variant:"subtitle"}),(0,i.Y)(y.EY,{localizationKey:r,variant:"caption",colorScheme:"secondary"})]}),(0,i.FD)(y.az,{sx:e=>({borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha100,borderRadius:e.radii.$lg}),children:[(0,i.Y)(y.xA,{gap:2,sx:e=>({gridTemplateColumns:`repeat(2, minmax(${e.sizes.$12}, 1fr))`,padding:`${e.space.$4} ${e.space.$6}`}),children:t.map((e,r)=>(0,i.Y)(rc,{code:e},r))}),(0,i.FD)(y.xA,{sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,gridTemplateColumns:"repeat(3, minmax(0, 1fr))",">:not([hidden])~:not([hidden])":{borderRightWidth:"0px",borderLeftWidth:"1px",borderStyle:"solid",borderColor:e.colors.$borderAlpha100},">:first-child":{borderBottomLeftRadius:e.radii.$lg},">:last-child":{borderBottomRightRadius:e.radii.$lg}}),children:[(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:()=>{var e,r,i;let l,o=document.createElement("a"),a=new Blob([(e=t,r=n,i=u,l=e?.join("\n"),`These are your backup codes for ${r} account ${i}.
2
2
  Store them securely and keep them secret. Each code can only be used once.
3
3
 
4
- ${l}`)],{type:"text/plain"});o.href=URL.createObjectURL(a),o.download=`${n}_backup_codes.txt`,document.body.appendChild(o),o.click()},children:(0,i.Y)(y.In,{icon:rn.A})}),(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:o,children:(0,i.Y)(y.In,{icon:rl.A})}),(0,i.Y)(y.$n,{variant:"ghost",onClick:s,sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),children:(0,i.Y)(y.In,{icon:d?ro.A:ra.A})})]})]}),(0,i.FD)(rt.L,{...a,children:[(0,i.FD)(y.DZ,{children:["Your backup codes for ",n," account ",u,":"]}),(0,i.Y)(y.fv,{gap:2,children:t.map((e,r)=>(0,i.Y)(rs,{code:e},r))})]})]}):null},rd=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:l}=(0,v.Jd)(),o=(0,d.f0)(),a=(0,v.Wp)(()=>l?.createBackupCode()),[s,u]=n.useState(void 0);return(n.useEffect(()=>{!s&&l&&a().then(e=>u(e)).catch(e=>{if((0,eT.I3)(e))return t();(0,G.H4)(e,[],o.setError)})},[]),o.error)?(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title")}):(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title"),children:s?(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.successMessage")}),(0,i.Y)(rc,{subtitle:(0,c.G)("userProfile.backupCodePage.subtitle__codelist"),backupCodes:s.codes}),(0,i.Y)(es.c,{children:(0,i.Y)(y.$n,{autoFocus:!0,onClick:r,localizationKey:(0,c.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary})})]}):(0,i.Y)(eJ.K,{})})}),ru=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,eu.X)();return(0,i.FD)(eu.s,{...n.props,children:[(0,i.Y)(rh,{onContinue:n.nextStep}),(0,i.Y)(rd,{onSuccess:r,onReset:t})]})}),rh=e=>{let{onContinue:r}=e,{close:t}=(0,$.D5)();return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title"),children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.infoText1")}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.infoText2")}),(0,i.FD)(es.c,{sx:{marginTop:0},children:[(0,i.Y)(y.$n,{textVariant:"buttonSmall",onClick:r,localizationKey:(0,c.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:t,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})};var rm=t(155),rf=t(6370),rp=t(9679);let rg=(0,d.dm)(e=>{let{onReset:r,onSuccess:t}=e,l=n.useRef(),o=(0,eu.X)({defaultStep:2}),a=(0,Y.O)().userSettings.attributes.backup_code?.enabled;return(0,i.FD)(eu.s,{...o.props,children:[(0,i.Y)(ef,{title:(0,c.G)("userProfile.phoneNumberPage.title"),resourceRef:l,onSuccess:o.nextStep,onUseExistingNumberClick:()=>o.goToStep(2),onReset:r}),(0,i.Y)(rv,{title:(0,c.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l,onSuccess:()=>a?o.goToStep(3):t(),onReset:()=>o.goToStep(2)}),(0,i.Y)(rP,{onSuccess:a?o.nextStep:t,onReset:r,onAddPhoneClick:()=>o.goToStep(0),onUnverifiedPhoneClick:e=>{l.current=e,o.goToStep(1)},title:(0,c.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l}),a&&(0,i.Y)(rf.B,{title:(0,c.G)("userProfile.mfaPhoneCodePage.successTitle"),text:l.current?.backupCodes&&l.current?.backupCodes.length>0?[(0,c.G)("userProfile.mfaPhoneCodePage.successMessage1"),(0,c.G)("userProfile.mfaPhoneCodePage.successMessage2")]:[(0,c.G)("userProfile.mfaPhoneCodePage.successMessage1")],onFinish:r,contents:(0,i.Y)(rc,{backupCodes:l.current?.backupCodes})})]})}),rY=e=>{let{phone:r,onSuccess:t,onUnverifiedPhoneClick:n,resourceRef:l}=e,o=(0,d.f0)(),a=(0,v.Wp)(()=>r.setReservedForSecondFactor({reserved:!0})),{country:s}=(0,eo.Mz)(r.phoneNumber),c=(0,eo.Om)(r.phoneNumber),u=async()=>{if("verified"!==r.verification.status)return n(r);o.setLoading(r.id);try{await a(),l.current=r,t()}catch(e){(0,G.H4)(e,[],o.setError)}finally{o.setIdle()}};return(0,i.FD)(y.$n,{variant:"outline",colorScheme:"neutral",sx:{justifyContent:"start"},onClick:u,isLoading:o.loadingMetadata===r.id,isDisabled:o.isLoading,children:[s.iso.toUpperCase()," ",c]},r.id)},rv=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:l}=e,o=(0,d.f0)(),a=n.current,s=(0,v.Wp)(()=>a?.setReservedForSecondFactor({reserved:!0})),u=async()=>{o.setLoading(a?.id);try{await s(),n.current=a,t()}catch(e){(0,G.H4)(e,[],o.setError)}finally{o.setIdle()}};return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,c.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:()=>{u()},identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:l})})},rP=e=>{let{onSuccess:r,onReset:t,title:n,onAddPhoneClick:l,onUnverifiedPhoneClick:o,resourceRef:a}=e,{user:s}=(0,v.Jd)();if(!s)return null;let d=s.phoneNumbers.filter(e=>!e.reservedForSecondFactor);return(0,i.FD)(ec.M,{headerTitle:n,gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)(d.length?"userProfile.mfaPhoneCodePage.subtitle__availablePhoneNumbers":"userProfile.mfaPhoneCodePage.subtitle__unavailablePhoneNumbers"),colorScheme:"secondary"}),d.length>0&&(0,i.Y)(y.fv,{gap:2,children:d.map(e=>(0,i.Y)(rY,{onSuccess:r,phone:e,onUnverifiedPhoneClick:o,resourceRef:a},e.id))}),(0,i.FD)(es.c,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[(0,i.Y)(rm.K,{variant:"ghost","aria-label":"Add phone number",icon:(0,i.Y)(y.In,{icon:rp.A,sx:e=>({marginRight:e.space.$2})}),localizationKey:(0,c.G)("userProfile.mfaPhoneCodePage.primaryButton__addPhoneNumber"),onClick:l}),(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,c.G)("userProfile.formButtonReset"),onClick:t})]})]})};var rb=t(5559),ry=t(2094);let rS=(0,d.dm)(e=>{let{title:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=(0,d.f0)(),s=(0,v.Wp)(()=>o?.createTOTP()),{close:u}=(0,$.D5)(),[h,m]=n.useState(void 0),[f,p]=n.useState("qr");return(n.useEffect(()=>{o&&s().then(e=>m(e)).catch(e=>(0,eT.Cm)(e)&&"reverification_cancelled"===e.code?u():(0,G.H4)(e,[],a.setError))},[]),a.error)?(0,i.Y)(ec.M,{headerTitle:r}):(0,i.FD)(ec.M,{headerTitle:r,headerSubtitle:"qr"==f?(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__ableToScan"):(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__unableToScan"),children:[!h&&(0,i.Y)(eJ.K,{}),h&&(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:4,children:["qr"==f&&(0,i.Y)(ry.r,{justify:"center",url:h.uri||""}),"uri"==f&&(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan1")}),(0,i.Y)(rb.r,{value:h.secret}),(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan2")}),(0,i.Y)(rb.r,{value:h.uri})]})]}),(0,i.FD)(y.so,{justify:"between",align:"center",sx:{width:"100%"},children:["qr"==f&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("uri"),localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonUnableToScan__nonPrimary")}),"uri"==f&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("qr"),localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonAbleToScan__nonPrimary")}),(0,i.FD)(es.c,{children:[(0,i.Y)(y.$n,{onClick:t,localizationKey:(0,c.G)("userProfile.formButtonPrimary__continue"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:l,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})]})]})});var r_=t(3356);let rD=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,resourceRef:n}=e,{user:l}=(0,v.Jd)(),o=(0,r_.xM)({onCodeEntryFinished:(e,r,t)=>{l?.verifyTOTP({code:e}).then(e=>r(e)).catch(t)},onResolve:e=>{n.current=e,r()}});return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.mfaTOTPPage.title"),children:[(0,i.Y)(y.fv,{children:(0,i.Y)(ea.l.OTPInput,{...o,label:(0,c.G)("userProfile.mfaTOTPPage.verifyTitle"),description:(0,c.G)("userProfile.mfaTOTPPage.verifySubtitle")})}),(0,i.Y)(es.c,{sx:{marginTop:0},children:(0,i.Y)(y.$n,{onClick:t,variant:"ghost",isDisabled:o.isLoading,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})})]})}),rR=(0,d.dm)(e=>{let{onReset:r}=e,t=(0,eu.X)(),l=n.useRef();return(0,i.FD)(eu.s,{...t.props,children:[(0,i.Y)(rS,{title:(0,c.G)("userProfile.mfaTOTPPage.title"),onSuccess:t.nextStep,onReset:r}),(0,i.Y)(rD,{onSuccess:t.nextStep,onReset:r,resourceRef:l}),(0,i.Y)(rf.B,{title:(0,c.G)("userProfile.mfaTOTPPage.title"),text:(0,c.G)("userProfile.mfaTOTPPage.successMessage"),onFinish:r,contents:(0,i.Y)(rc,{subtitle:(0,c.G)("userProfile.backupCodePage.successSubtitle"),backupCodes:l.current?.backupCodes})})]})}),rG=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,selectedStrategy:l}=e,o=(0,d.f0)(),{userSettings:{attributes:a}}=(0,Y.O)(),{user:s}=(0,v.Jd)();if(!s)return null;let u=(0,c.G)("userProfile.mfaPage.title"),h=n.useMemo(()=>V(a,s),[]);return(n.useEffect(()=>{0===h.length&&o.setError("There are no second factors available to add")},[]),o.error)?(0,i.Y)(ec.M,{headerTitle:u}):0!==h.length||l?(0,i.Y)(rw,{onSuccess:r,onReset:t,method:l||h[0]}):null}),rw=e=>{let{method:r,onSuccess:t,onReset:n}=e;switch(r){case"phone_code":return(0,i.Y)(rg,{onSuccess:t,onReset:n});case"totp":return(0,i.Y)(rR,{onSuccess:t,onReset:n});case"backup_code":return(0,i.Y)(ru,{onSuccess:t,onReset:n});default:return null}},rC=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(B,{onSuccess:e,onReset:e})},r$=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(K,{onSuccess:r,onReset:r,...e})},rF=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rd,{onSuccess:e,onReset:e})},rI=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rG,{onSuccess:r,onReset:r,selectedStrategy:e.selectedStrategy})},rx=()=>{let{userSettings:{attributes:e}}=(0,Y.O)(),{user:r}=(0,v.Jd)(),[t,l]=(0,n.useState)(null);if(!r)return null;let o=H(e),a=V(e,r),s=o.includes("totp")&&r.totpEnabled,d=o.includes("backup_code")&&r.backupCodeEnabled,u=r.phoneNumbers.filter(e=>"verified"===e.verification.status).filter(e=>e.reservedForSecondFactor).sort(j);return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.mfaSection.title"),centered:!1,id:"mfa",children:(0,i.Y)(C.r.Root,{value:t,onChange:l,children:(0,i.FD)(D.rd.ItemList,{id:"mfa",children:[s&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e7.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.start.mfaSection.totp.headerTitle")}),(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__default")})]}),(0,i.Y)(rz,{})]}),(0,i.Y)(C.r.Open,{value:"remove-totp",children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(rC,{})})})]}),o.includes("phone_code")&&u.map(e=>{let r=!s&&e.defaultSecondFactor,t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e9.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.FD)(y.EY,{children:["SMS Code ",(0,i.Y)(e8.R,{value:e.phoneNumber})]}),r&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__default")})]}),(0,i.Y)(rk,{phone:e,showTOTP:s})]}),(0,i.Y)(C.r.Open,{value:`remove-${t}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(r$,{phoneId:t})})})]},t)}),d&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:re.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.start.mfaSection.backupCodes.headerTitle")})]}),(0,i.Y)(rA,{})]}),(0,i.Y)(C.r.Open,{value:"regenerate",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(rF,{})})})]}),(0,i.Y)(rT,{secondFactorsAvailableToAdd:a,onClick:()=>l(null)})]})})})},rk=({phone:e,showTOTP:r})=>{let{open:t}=(0,$.D5)(),n=(0,d.f0)(),l=e.id,o=[!r&&!e.defaultSecondFactor?{label:(0,c.G)("userProfile.start.mfaSection.phoneCode.actionLabel__setDefault"),onClick:()=>e.makeDefaultSecondFactor().catch(e=>(0,G.H4)(e,[],n.setError))}:null,{label:(0,c.G)("userProfile.start.mfaSection.phoneCode.destructiveActionLabel"),isDestructive:!0,onClick:()=>t(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:o})},rA=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,c.G)("userProfile.start.mfaSection.backupCodes.actionLabel__regenerate"),onClick:()=>e("regenerate")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rz=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,c.G)("userProfile.start.mfaSection.totp.destructiveActionTitle"),isDestructive:!0,onClick:()=>e("remove-totp")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rT=e=>{let{open:r}=(0,$.D5)(),{secondFactorsAvailableToAdd:t,onClick:l}=e,[o,a]=(0,n.useState)(),s=n.useMemo(()=>t.map(e=>"phone_code"===e?{icon:e9.A,text:"SMS code",key:"phone_code"}:"totp"===e?{icon:e7.A,text:"Authenticator application",key:"totp"}:"backup_code"===e?{icon:re.A,text:"Backup code",key:"backup_code"}:null).filter(e=>null!==e),[t]);return(0,i.FD)(i.FK,{children:[t.length>0&&(0,i.Y)(C.r.Closed,{value:"multi-factor",children:(0,i.Y)(D.rd.ActionMenu,{id:"mfa",triggerLocalizationKey:(0,c.G)("userProfile.start.mfaSection.primaryButton"),onClick:l,children:s.map(e=>e&&(0,i.Y)(D.rd.ActionMenuItem,{id:e.key,localizationKey:e.text,leftIcon:e.icon,onClick:()=>{a(e.key),r("multi-factor")}},e.key))})}),(0,i.Y)(C.r.Open,{value:"multi-factor",children:(0,i.Y)(C.r.Card,{children:o&&(0,i.Y)(rI,{selectedStrategy:o})})})]})},rE=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(M,{onSuccess:r,onReset:r,...e})},rL=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rO,{onSuccess:r,onReset:r,passkey:e.passkey})},rO=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,passkey:n}=e,l=(0,d.f0)(),o=(0,ed.tJ)("passkeyName",n.name||"",{type:"text",label:(0,c.G)("formFieldLabel__passkeyName"),isRequired:!0}),a=o.value.length>1&&n.name!==o.value,s=async e=>(e.preventDefault(),n.update({name:o.value}).then(r).catch(e=>(0,G.H4)(e,[o],l.setError)));return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.passkeyScreen.title__rename"),headerSubtitle:(0,c.G)("userProfile.passkeyScreen.subtitle__rename"),children:(0,i.FD)(ea.l.Root,{onSubmit:s,children:[(0,i.Y)(ea.l.ControlRow,{elementId:o.id,children:(0,i.Y)(ea.l.PlainInput,{...o.props,autoComplete:"off"})}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.formButtonPrimary__save"),isDisabled:!a,onReset:t})]})})}),rK=()=>{let{user:e}=(0,v.Jd)(),[r,t]=(0,n.useState)(null);return e?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.passkeysSection.title"),centered:!1,id:"passkeys",children:(0,i.Y)(C.r.Root,{value:r,onChange:t,children:(0,i.FD)(D.rd.ItemList,{id:"passkeys",children:[e.passkeys.map(e=>{let r=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.Y)(rB,{...e},r),(0,i.Y)(C.r.Open,{value:`remove-${r}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(rE,{passkey:e})})}),(0,i.Y)(C.r.Open,{value:`rename-${r}`,children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(rL,{passkey:e})})})]},r)}),(0,i.Y)(rN,{onClick:()=>t(null)})]})})}):null},rB=e=>(0,i.FD)(D.rd.Item,{id:"passkeys",hoverable:!0,sx:{alignItems:"flex-start"},children:[(0,i.Y)(rM,{...e}),(0,i.Y)(rW,{passkey:e})]}),rM=e=>{let{name:r,createdAt:t,lastUsedAt:n}=e,{t:l}=(0,eS._)();return(0,i.Y)(y.so,{sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.Y)(y.EY,{children:r}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Created: ",l((0,eq.T)(t))]}),n&&(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Last used: ",l((0,eq.T)(n))]})]})})},rW=({passkey:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,c.G)("userProfile.start.passkeysSection.menuAction__rename"),onClick:()=>r(`rename-${t}`)},{label:(0,c.G)("userProfile.start.passkeysSection.menuAction__destructive"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}];return(0,i.Y)(R.o,{actions:n})},rN=({onClick:e})=>{let r=(0,d.f0)(),{isSatellite:t}=(0,v.ho)(),{user:n}=(0,v.Jd)(),l=(0,v.Wp)(()=>n?.createPasskey()),o=async()=>{if(e?.(),n)try{await l()}catch(e){(0,G.H4)(e,[],r.setError)}};return t?null:(0,i.Y)(D.rd.ArrowButton,{id:"passkeys",localizationKey:(0,c.G)("userProfile.start.passkeysSection.primaryButton"),onClick:o})};var rJ=t(3990),rq=t(620);let rU=(0,d.dm)(e=>{let{t:r,locale:t}=(0,eS._)(),{onSuccess:l,onReset:o}=e,{user:a}=(0,v.Jd)(),s=(0,v.Wp)((e,r)=>e.updatePassword(...r));if(!a)return null;let{userSettings:{passwordSettings:u},authConfig:{reverification:h}}=(0,Y.O)(),{session:m}=(0,v.wV)(),f=a.passwordEnabled?(0,c.G)("userProfile.passwordPage.title__update"):(0,c.G)("userProfile.passwordPage.title__set"),p=(0,d.f0)(),g=a.enterpriseAccounts.some(e=>e.active),P=a.passwordEnabled&&!h,b=(0,n.useRef)({title:(0,c.G)("userProfile.passwordPage.title__set")}),y=(0,ed.tJ)("currentPassword","",{type:"password",label:(0,c.G)("formFieldLabel__currentPassword"),isRequired:!0}),S=(0,ed.tJ)("newPassword","",{type:"password",label:(0,c.G)("formFieldLabel__newPassword"),isRequired:!0,validatePassword:!0,buildErrorMessage:e=>(0,rJ.C5)(e,{t:r,locale:t,passwordSettings:u})}),_=(0,ed.tJ)("confirmPassword","",{type:"password",label:(0,c.G)("formFieldLabel__confirmPassword"),isRequired:!0}),D=(0,ed.tJ)("signOutOfOtherSessions","",{type:"checkbox",label:(0,c.G)("formFieldLabel__signOutOfOtherSessions"),defaultChecked:!0}),{setConfirmPasswordFeedback:R,isPasswordMatch:w}=(0,rq.Z)({passwordField:S,confirmPasswordField:_}),C=(P?y.value&&w:w)&&S.value&&_.value,$=async()=>{if(C)try{var e,r;let t;b.current={title:a.passwordEnabled?(0,c.G)("userProfile.passwordPage.title__update"):(0,c.G)("userProfile.passwordPage.title__set"),text:(e=a.passwordEnabled,r=!!D.checked,t=[],e?t.push((0,c.G)("userProfile.passwordPage.successMessage__update")):t.push((0,c.G)("userProfile.passwordPage.successMessage__set")),r&&t.push((0,c.G)("userProfile.passwordPage.successMessage__signOutOfOtherSessions")),t)};let i={newPassword:S.value,signOutOfOtherSessions:D.checked,currentPassword:P?y.value:void 0};await s(a,[i]),l()}catch(e){(0,G.H4)(e,[y,S,_],p.setError)}};return(0,i.FD)(ec.M,{headerTitle:f,children:[g&&(0,i.Y)(ew.k,{message:(0,c.G)("userProfile.passwordPage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:$,onBlur:()=>{S.value&&R(_.value)},children:[(0,i.Y)("input",{readOnly:!0,"data-testid":"hidden-identifier",id:"identifier-field",name:"identifier",value:m?.publicUserData.identifier||"",style:{display:"none"}}),P&&(0,i.Y)(ea.l.ControlRow,{elementId:y.id,children:(0,i.Y)(ea.l.PasswordInput,{...y.props,minLength:6,isRequired:!0,autoFocus:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:S.id,children:(0,i.Y)(ea.l.PasswordInput,{...S.props,minLength:6,isRequired:!0,autoFocus:!a.passwordEnabled,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:_.id,children:(0,i.Y)(ea.l.PasswordInput,{..._.props,onChange:e=>(e.target.value&&R(e.target.value),_.props.onChange(e)),isRequired:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:D.id,children:(0,i.Y)(ea.l.Checkbox,{...D.props,description:(0,c.G)("userProfile.passwordPage.checkboxInfoText__signOutOfOtherSessions"),isDisabled:g})}),g?(0,i.Y)(es.c,{children:(0,i.Y)(ea.l.ResetButton,{localizationKey:(0,c.G)("userProfile.formButtonReset"),block:!1,onClick:o})}):(0,i.Y)(es.G,{isDisabled:!C,onReset:o})]})]})}),rj=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rU,{onSuccess:e,onReset:e})},rH=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{passwordEnabled:r}=e;return(0,i.Y)(D.rd.Root,{centered:!1,title:(0,c.G)("userProfile.start.passwordSection.title"),id:"password",children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"password",sx:e=>({paddingLeft:r?void 0:"0",paddingTop:e.space.$0x25,paddingBottom:e.space.$0x25}),children:[r&&(0,i.Y)(y.EY,{variant:"h2",children:"••••••••••"}),(0,i.Y)(C.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"password",localizationKey:r?(0,c.G)("userProfile.start.passwordSection.primaryButton__updatePassword"):(0,c.G)("userProfile.start.passwordSection.primaryButton__setPassword")})})]})}),(0,i.Y)(C.r.Open,{value:"edit",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(rj,{})})})]})})},rV=(0,d.dm)(()=>{let{attributes:e,instanceIsPasswordBased:r}=(0,Y.O)().userSettings,t=(0,d.f0)(),{user:n}=(0,v.Jd)(),{shouldAllowIdentificationCreation:l}=(0,a.B)(),o=e.passkey?.enabled&&l,s=H(e).length>0,u=n?.deleteSelfEnabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("security"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,c.G)("userProfile.start.headerTitle__security"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:t.error}),r&&(0,i.Y)(rH,{}),o&&(0,i.Y)(rK,{}),s&&(0,i.Y)(rx,{}),(0,i.Y)(eZ,{}),u&&(0,i.Y)(e6,{})]})})}),rZ=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("207"),t.e("259")]).then(t.bind(t,1608)).then(e=>({default:e.BillingPage}))),rX=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("326"),t.e("817")]).then(t.bind(t,8201)).then(e=>({default:e.APIKeysPage}))),rQ=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("970"),t.e("110")]).then(t.bind(t,7437)).then(e=>({default:e.PlansPage}))),r0=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("627")]).then(t.bind(t,1666)).then(e=>({default:e.StatementPage}))),r1=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("122")]).then(t.bind(t,4856)).then(e=>({default:e.PaymentAttemptPage}))),r2=()=>{let{pages:e,shouldShowBilling:r,apiKeysProps:t}=(0,a.B)(),{apiKeysSettings:o,commerceSettings:s}=(0,Y.O)(),c=e.routes[0].id===l.j2.ACCOUNT,d=e.routes[0].id===l.j2.SECURITY,u=e.routes[0].id===l.j2.BILLING,h=e.routes[0].id===l.j2.API_KEYS,p=e.contents?.map((e,r)=>{let t=!c&&!d&&0===r;return(0,i.Y)(f.q,{index:t,path:t?void 0:e.url,children:(0,i.Y)(g.H,{mount:e.mount,unmount:e.unmount})},`custom-page-${e.url}`)});return(0,i.FD)(m.d,{children:[p,(0,i.FD)(f.q,{children:[(0,i.Y)(f.q,{path:c?void 0:"account",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(eN,{})})})}),(0,i.Y)(f.q,{path:d?void 0:"security",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(rV,{})})})}),s.billing.user.enabled&&r?(0,i.Y)(f.q,{path:u?void 0:"billing",children:(0,i.FD)(m.d,{children:[(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rZ,{})})}),s.billing.user.hasPaidPlans?(0,i.Y)(f.q,{path:"plans",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rQ,{})})}):null,(0,i.Y)(f.q,{path:"statement/:statementId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(r0,{})})}),(0,i.Y)(f.q,{path:"payment-attempt/:paymentAttemptId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(r1,{})})})]})}):null,o.user_api_keys_enabled&&!t?.hide&&(0,i.Y)(f.q,{path:h?void 0:"api-keys",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rX,{})})})})})]})]})};var r5=t(393);let r4=()=>(0,i.Y)(s.n.Root,{flow:"userProfile",children:(0,i.Y)(s.n.Part,{children:(0,i.FD)(m.d,{children:[(0,i.Y)(f.q,{path:"verify",children:(0,i.Y)(r5.G,{})}),(0,i.Y)(f.q,{children:(0,i.Y)(r3,{})})]})})}),r3=(0,o.G)(()=>{let e=n.useRef(null);return(0,i.Y)(h.a.Root,{children:(0,i.FD)(p,{contentRef:e,children:[(0,i.Y)(u.oT,{navbarTitleLocalizationKey:(0,c.G)("userProfile.navbar.title")}),(0,i.Y)(h.a.Content,{contentRef:e,scrollBoxId:l.AG,children:(0,i.Y)(r2,{})})]})})}),r6=(0,d.dm)(r4),r8=(0,d.dm)(r4),r7=e=>{let r={...e,routing:"virtual",componentName:"UserProfile",mode:"modal"};return(0,i.Y)(f.q,{path:"user",children:(0,i.Y)(a.M.Provider,{value:r,children:(0,i.Y)("div",{children:(0,i.Y)(r8,{...r})})})})}},9599:function(e,r,t){t.d(r,{g:()=>l});var i=t(1210),n=t(4964);let l=()=>{let{navigate:e}=(0,n.r)(),r=(0,i.ho)();return{navigateAfterSignOut:()=>e(r.buildAfterSignOutUrl()),navigateAfterMultiSessionSingleSignOutUrl:()=>e(r.buildAfterMultiSessionSingleSignOutUrl()),afterSignOutUrl:r.buildAfterSignOutUrl(),afterMultiSessionSingleSignOutUrl:r.buildAfterMultiSessionSingleSignOutUrl()}}}}]);
4
+ ${l}`)],{type:"text/plain"});o.href=URL.createObjectURL(a),o.download=`${n}_backup_codes.txt`,document.body.appendChild(o),o.click()},children:(0,i.Y)(y.In,{icon:rl.A})}),(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:o,children:(0,i.Y)(y.In,{icon:ro.A})}),(0,i.Y)(y.$n,{variant:"ghost",onClick:s,sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),children:(0,i.Y)(y.In,{icon:d?ra.A:rs.A})})]})]}),(0,i.FD)(ri.L,{...a,children:[(0,i.FD)(y.DZ,{children:["Your backup codes for ",n," account ",u,":"]}),(0,i.Y)(y.fv,{gap:2,children:t.map((e,r)=>(0,i.Y)(rc,{code:e},r))})]})]}):null},ru=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:l}=(0,v.Jd)(),o=(0,d.f0)(),a=(0,v.Wp)(()=>l?.createBackupCode()),[s,u]=n.useState(void 0);return(n.useEffect(()=>{!s&&l&&a().then(e=>u(e)).catch(e=>{if((0,eE.I3)(e))return t();(0,G.H4)(e,[],o.setError)})},[]),o.error)?(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title")}):(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title"),children:s?(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.successMessage")}),(0,i.Y)(rd,{subtitle:(0,c.G)("userProfile.backupCodePage.subtitle__codelist"),backupCodes:s.codes}),(0,i.Y)(es.c,{children:(0,i.Y)(y.$n,{autoFocus:!0,onClick:r,localizationKey:(0,c.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary})})]}):(0,i.Y)(eq.K,{})})}),rh=(0,d.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,eu.X)();return(0,i.FD)(eu.s,{...n.props,children:[(0,i.Y)(rf,{onContinue:n.nextStep}),(0,i.Y)(ru,{onSuccess:r,onReset:t})]})}),rf=e=>{let{onContinue:r}=e,{close:t}=(0,$.D5)();return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.backupCodePage.title"),children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.infoText1")}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.backupCodePage.infoText2")}),(0,i.FD)(es.c,{sx:{marginTop:0},children:[(0,i.Y)(y.$n,{textVariant:"buttonSmall",onClick:r,localizationKey:(0,c.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:t,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})};var rm=t(155),rp=t(6370),rg=t(9679);let rY=(0,d.dm)(e=>{let{onReset:r,onSuccess:t}=e,l=n.useRef(),o=(0,eu.X)({defaultStep:2}),a=(0,Y.O)().userSettings.attributes.backup_code?.enabled;return(0,i.FD)(eu.s,{...o.props,children:[(0,i.Y)(em,{title:(0,c.G)("userProfile.phoneNumberPage.title"),resourceRef:l,onSuccess:o.nextStep,onUseExistingNumberClick:()=>o.goToStep(2),onReset:r}),(0,i.Y)(rP,{title:(0,c.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l,onSuccess:()=>a?o.goToStep(3):t(),onReset:()=>o.goToStep(2)}),(0,i.Y)(rb,{onSuccess:a?o.nextStep:t,onReset:r,onAddPhoneClick:()=>o.goToStep(0),onUnverifiedPhoneClick:e=>{l.current=e,o.goToStep(1)},title:(0,c.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l}),a&&(0,i.Y)(rp.B,{title:(0,c.G)("userProfile.mfaPhoneCodePage.successTitle"),text:l.current?.backupCodes&&l.current?.backupCodes.length>0?[(0,c.G)("userProfile.mfaPhoneCodePage.successMessage1"),(0,c.G)("userProfile.mfaPhoneCodePage.successMessage2")]:[(0,c.G)("userProfile.mfaPhoneCodePage.successMessage1")],onFinish:r,contents:(0,i.Y)(rd,{backupCodes:l.current?.backupCodes})})]})}),rv=e=>{let{phone:r,onSuccess:t,onUnverifiedPhoneClick:n,resourceRef:l}=e,o=(0,d.f0)(),a=(0,v.Wp)(()=>r.setReservedForSecondFactor({reserved:!0})),{country:s}=(0,eo.Mz)(r.phoneNumber),c=(0,eo.Om)(r.phoneNumber),u=async()=>{if("verified"!==r.verification.status)return n(r);o.setLoading(r.id);try{await a(),l.current=r,t()}catch(e){(0,G.H4)(e,[],o.setError)}finally{o.setIdle()}};return(0,i.FD)(y.$n,{variant:"outline",colorScheme:"neutral",sx:{justifyContent:"start"},onClick:u,isLoading:o.loadingMetadata===r.id,isDisabled:o.isLoading,children:[s.iso.toUpperCase()," ",c]},r.id)},rP=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:l}=e,o=(0,d.f0)(),a=n.current,s=(0,v.Wp)(()=>a?.setReservedForSecondFactor({reserved:!0})),u=async()=>{o.setLoading(a?.id);try{await s(),n.current=a,t()}catch(e){(0,G.H4)(e,[],o.setError)}finally{o.setIdle()}};return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,c.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:()=>{u()},identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:l})})},rb=e=>{let{onSuccess:r,onReset:t,title:n,onAddPhoneClick:l,onUnverifiedPhoneClick:o,resourceRef:a}=e,{user:s}=(0,v.Jd)();if(!s)return null;let d=s.phoneNumbers.filter(e=>!e.reservedForSecondFactor);return(0,i.FD)(ec.M,{headerTitle:n,gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,c.G)(d.length?"userProfile.mfaPhoneCodePage.subtitle__availablePhoneNumbers":"userProfile.mfaPhoneCodePage.subtitle__unavailablePhoneNumbers"),colorScheme:"secondary"}),d.length>0&&(0,i.Y)(y.fv,{gap:2,children:d.map(e=>(0,i.Y)(rv,{onSuccess:r,phone:e,onUnverifiedPhoneClick:o,resourceRef:a},e.id))}),(0,i.FD)(es.c,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[(0,i.Y)(rm.K,{variant:"ghost","aria-label":"Add phone number",icon:(0,i.Y)(y.In,{icon:rg.A,sx:e=>({marginRight:e.space.$2})}),localizationKey:(0,c.G)("userProfile.mfaPhoneCodePage.primaryButton__addPhoneNumber"),onClick:l}),(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,c.G)("userProfile.formButtonReset"),onClick:t})]})]})};var ry=t(5559),rS=t(2094);let r_=(0,d.dm)(e=>{let{title:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=(0,d.f0)(),s=(0,v.Wp)(()=>o?.createTOTP()),{close:u}=(0,$.D5)(),[h,f]=n.useState(void 0),[m,p]=n.useState("qr");return(n.useEffect(()=>{o&&s().then(e=>f(e)).catch(e=>(0,eE.Cm)(e)&&"reverification_cancelled"===e.code?u():(0,G.H4)(e,[],a.setError))},[]),a.error)?(0,i.Y)(ec.M,{headerTitle:r}):(0,i.FD)(ec.M,{headerTitle:r,headerSubtitle:"qr"==m?(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__ableToScan"):(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__unableToScan"),children:[!h&&(0,i.Y)(eq.K,{}),h&&(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:4,children:["qr"==m&&(0,i.Y)(rS.r,{justify:"center",url:h.uri||""}),"uri"==m&&(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan1")}),(0,i.Y)(ry.r,{value:h.secret}),(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan2")}),(0,i.Y)(ry.r,{value:h.uri})]})]}),(0,i.FD)(y.so,{justify:"between",align:"center",sx:{width:"100%"},children:["qr"==m&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("uri"),localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonUnableToScan__nonPrimary")}),"uri"==m&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("qr"),localizationKey:(0,c.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonAbleToScan__nonPrimary")}),(0,i.FD)(es.c,{children:[(0,i.Y)(y.$n,{onClick:t,localizationKey:(0,c.G)("userProfile.formButtonPrimary__continue"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:l,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})]})]})});var rD=t(3356);let rR=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,resourceRef:n}=e,{user:l}=(0,v.Jd)(),o=(0,rD.xM)({onCodeEntryFinished:(e,r,t)=>{l?.verifyTOTP({code:e}).then(e=>r(e)).catch(t)},onResolve:e=>{n.current=e,r()}});return(0,i.FD)(ec.M,{headerTitle:(0,c.G)("userProfile.mfaTOTPPage.title"),children:[(0,i.Y)(y.fv,{children:(0,i.Y)(ea.l.OTPInput,{...o,label:(0,c.G)("userProfile.mfaTOTPPage.verifyTitle"),description:(0,c.G)("userProfile.mfaTOTPPage.verifySubtitle")})}),(0,i.Y)(es.c,{sx:{marginTop:0},children:(0,i.Y)(y.$n,{onClick:t,variant:"ghost",isDisabled:o.isLoading,localizationKey:(0,c.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})})]})}),rG=(0,d.dm)(e=>{let{onReset:r}=e,t=(0,eu.X)(),l=n.useRef();return(0,i.FD)(eu.s,{...t.props,children:[(0,i.Y)(r_,{title:(0,c.G)("userProfile.mfaTOTPPage.title"),onSuccess:t.nextStep,onReset:r}),(0,i.Y)(rR,{onSuccess:t.nextStep,onReset:r,resourceRef:l}),(0,i.Y)(rp.B,{title:(0,c.G)("userProfile.mfaTOTPPage.title"),text:(0,c.G)("userProfile.mfaTOTPPage.successMessage"),onFinish:r,contents:(0,i.Y)(rd,{subtitle:(0,c.G)("userProfile.backupCodePage.successSubtitle"),backupCodes:l.current?.backupCodes})})]})}),rw=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,selectedStrategy:l}=e,o=(0,d.f0)(),{userSettings:{attributes:a}}=(0,Y.O)(),{user:s}=(0,v.Jd)();if(!s)return null;let u=(0,c.G)("userProfile.mfaPage.title"),h=n.useMemo(()=>V(a,s),[]);return(n.useEffect(()=>{0===h.length&&o.setError("There are no second factors available to add")},[]),o.error)?(0,i.Y)(ec.M,{headerTitle:u}):0!==h.length||l?(0,i.Y)(rC,{onSuccess:r,onReset:t,method:l||h[0]}):null}),rC=e=>{let{method:r,onSuccess:t,onReset:n}=e;switch(r){case"phone_code":return(0,i.Y)(rY,{onSuccess:t,onReset:n});case"totp":return(0,i.Y)(rG,{onSuccess:t,onReset:n});case"backup_code":return(0,i.Y)(rh,{onSuccess:t,onReset:n});default:return null}},r$=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(B,{onSuccess:e,onReset:e})},rF=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(K,{onSuccess:r,onReset:r,...e})},rI=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(ru,{onSuccess:e,onReset:e})},rk=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rw,{onSuccess:r,onReset:r,selectedStrategy:e.selectedStrategy})},rx=()=>{let{userSettings:{attributes:e}}=(0,Y.O)(),{user:r}=(0,v.Jd)(),[t,l]=(0,n.useState)(null);if(!r)return null;let o=H(e),a=V(e,r),s=o.includes("totp")&&r.totpEnabled,d=o.includes("backup_code")&&r.backupCodeEnabled,u=r.phoneNumbers.filter(e=>"verified"===e.verification.status).filter(e=>e.reservedForSecondFactor).sort(j);return(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.mfaSection.title"),centered:!1,id:"mfa",children:(0,i.Y)(C.r.Root,{value:t,onChange:l,children:(0,i.FD)(D.rd.ItemList,{id:"mfa",children:[s&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e9.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.start.mfaSection.totp.headerTitle")}),(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__default")})]}),(0,i.Y)(rT,{})]}),(0,i.Y)(C.r.Open,{value:"remove-totp",children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(r$,{})})})]}),o.includes("phone_code")&&u.map(e=>{let r=!s&&e.defaultSecondFactor,t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:re.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.FD)(y.EY,{children:["SMS Code ",(0,i.Y)(e7.R,{value:e.phoneNumber})]}),r&&(0,i.Y)(y.Ex,{localizationKey:(0,c.G)("badge__default")})]}),(0,i.Y)(rA,{phone:e,showTOTP:s})]}),(0,i.Y)(C.r.Open,{value:`remove-${t}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(rF,{phoneId:t})})})]},t)}),d&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:rr.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,c.G)("userProfile.start.mfaSection.backupCodes.headerTitle")})]}),(0,i.Y)(rz,{})]}),(0,i.Y)(C.r.Open,{value:"regenerate",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(rI,{})})})]}),(0,i.Y)(rE,{secondFactorsAvailableToAdd:a,onClick:()=>l(null)})]})})})},rA=({phone:e,showTOTP:r})=>{let{open:t}=(0,$.D5)(),n=(0,d.f0)(),l=e.id,o=[!r&&!e.defaultSecondFactor?{label:(0,c.G)("userProfile.start.mfaSection.phoneCode.actionLabel__setDefault"),onClick:()=>e.makeDefaultSecondFactor().catch(e=>(0,G.H4)(e,[],n.setError))}:null,{label:(0,c.G)("userProfile.start.mfaSection.phoneCode.destructiveActionLabel"),isDestructive:!0,onClick:()=>t(`remove-${l}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:o})},rz=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,c.G)("userProfile.start.mfaSection.backupCodes.actionLabel__regenerate"),onClick:()=>e("regenerate")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rT=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,c.G)("userProfile.start.mfaSection.totp.destructiveActionTitle"),isDestructive:!0,onClick:()=>e("remove-totp")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rE=e=>{let{open:r}=(0,$.D5)(),{secondFactorsAvailableToAdd:t,onClick:l}=e,[o,a]=(0,n.useState)(),s=n.useMemo(()=>t.map(e=>"phone_code"===e?{icon:re.A,text:"SMS code",key:"phone_code"}:"totp"===e?{icon:e9.A,text:"Authenticator application",key:"totp"}:"backup_code"===e?{icon:rr.A,text:"Backup code",key:"backup_code"}:null).filter(e=>null!==e),[t]);return(0,i.FD)(i.FK,{children:[t.length>0&&(0,i.Y)(C.r.Closed,{value:"multi-factor",children:(0,i.Y)(D.rd.ActionMenu,{id:"mfa",triggerLocalizationKey:(0,c.G)("userProfile.start.mfaSection.primaryButton"),onClick:l,children:s.map(e=>e&&(0,i.Y)(D.rd.ActionMenuItem,{id:e.key,localizationKey:e.text,leftIcon:e.icon,onClick:()=>{a(e.key),r("multi-factor")}},e.key))})}),(0,i.Y)(C.r.Open,{value:"multi-factor",children:(0,i.Y)(C.r.Card,{children:o&&(0,i.Y)(rk,{selectedStrategy:o})})})]})},rL=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(W,{onSuccess:r,onReset:r,...e})},rO=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rK,{onSuccess:r,onReset:r,passkey:e.passkey})},rK=(0,d.dm)(e=>{let{onSuccess:r,onReset:t,passkey:n}=e,l=(0,d.f0)(),o=(0,ed.tJ)("passkeyName",n.name||"",{type:"text",label:(0,c.G)("formFieldLabel__passkeyName"),isRequired:!0}),a=o.value.length>1&&n.name!==o.value,s=async e=>(e.preventDefault(),n.update({name:o.value}).then(r).catch(e=>(0,G.H4)(e,[o],l.setError)));return(0,i.Y)(ec.M,{headerTitle:(0,c.G)("userProfile.passkeyScreen.title__rename"),headerSubtitle:(0,c.G)("userProfile.passkeyScreen.subtitle__rename"),children:(0,i.FD)(ea.l.Root,{onSubmit:s,children:[(0,i.Y)(ea.l.ControlRow,{elementId:o.id,children:(0,i.Y)(ea.l.PlainInput,{...o.props,autoComplete:"off"})}),(0,i.Y)(es.G,{submitLabel:(0,c.G)("userProfile.formButtonPrimary__save"),isDisabled:!a,onReset:t})]})})}),rB=()=>{let{user:e}=(0,v.Jd)(),[r,t]=(0,n.useState)(null);return e?(0,i.Y)(D.rd.Root,{title:(0,c.G)("userProfile.start.passkeysSection.title"),centered:!1,id:"passkeys",children:(0,i.Y)(C.r.Root,{value:r,onChange:t,children:(0,i.FD)(D.rd.ItemList,{id:"passkeys",children:[e.passkeys.map(e=>{let r=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.Y)(rW,{...e},r),(0,i.Y)(C.r.Open,{value:`remove-${r}`,children:(0,i.Y)(C.r.Card,{variant:"destructive",children:(0,i.Y)(rL,{passkey:e})})}),(0,i.Y)(C.r.Open,{value:`rename-${r}`,children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(rO,{passkey:e})})})]},r)}),(0,i.Y)(rJ,{onClick:()=>t(null)})]})})}):null},rW=e=>(0,i.FD)(D.rd.Item,{id:"passkeys",hoverable:!0,sx:{alignItems:"flex-start"},children:[(0,i.Y)(rM,{...e}),(0,i.Y)(rN,{passkey:e})]}),rM=e=>{let{name:r,createdAt:t,lastUsedAt:n}=e,{t:l}=(0,eS._)();return(0,i.Y)(y.so,{sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.Y)(y.EY,{children:r}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Created: ",l((0,eU.T)(t))]}),n&&(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Last used: ",l((0,eU.T)(n))]})]})})},rN=({passkey:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,c.G)("userProfile.start.passkeysSection.menuAction__rename"),onClick:()=>r(`rename-${t}`)},{label:(0,c.G)("userProfile.start.passkeysSection.menuAction__destructive"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}];return(0,i.Y)(R.o,{actions:n})},rJ=({onClick:e})=>{let r=(0,d.f0)(),{isSatellite:t}=(0,v.ho)(),{user:n}=(0,v.Jd)(),l=(0,v.Wp)(()=>n?.createPasskey()),o=async()=>{if(e?.(),n)try{await l()}catch(e){(0,G.H4)(e,[],r.setError)}};return t?null:(0,i.Y)(D.rd.ArrowButton,{id:"passkeys",localizationKey:(0,c.G)("userProfile.start.passkeysSection.primaryButton"),onClick:o})};var rq=t(3990),rU=t(620);let rj=(0,d.dm)(e=>{let{t:r,locale:t}=(0,eS._)(),{onSuccess:l,onReset:o}=e,{user:a}=(0,v.Jd)(),s=(0,v.Wp)((e,r)=>e.updatePassword(...r));if(!a)return null;let{userSettings:{passwordSettings:u},authConfig:{reverification:h}}=(0,Y.O)(),{session:f}=(0,v.wV)(),m=a.passwordEnabled?(0,c.G)("userProfile.passwordPage.title__update"):(0,c.G)("userProfile.passwordPage.title__set"),p=(0,d.f0)(),g=a.enterpriseAccounts.some(e=>e.active),P=a.passwordEnabled&&!h,b=(0,n.useRef)({title:(0,c.G)("userProfile.passwordPage.title__set")}),y=(0,ed.tJ)("currentPassword","",{type:"password",label:(0,c.G)("formFieldLabel__currentPassword"),isRequired:!0}),S=(0,ed.tJ)("newPassword","",{type:"password",label:(0,c.G)("formFieldLabel__newPassword"),isRequired:!0,validatePassword:!0,buildErrorMessage:e=>(0,rq.C5)(e,{t:r,locale:t,passwordSettings:u})}),_=(0,ed.tJ)("confirmPassword","",{type:"password",label:(0,c.G)("formFieldLabel__confirmPassword"),isRequired:!0}),D=(0,ed.tJ)("signOutOfOtherSessions","",{type:"checkbox",label:(0,c.G)("formFieldLabel__signOutOfOtherSessions"),defaultChecked:!0}),{setConfirmPasswordFeedback:R,isPasswordMatch:w}=(0,rU.Z)({passwordField:S,confirmPasswordField:_}),C=(P?y.value&&w:w)&&S.value&&_.value,$=async()=>{if(C)try{var e,r;let t;b.current={title:a.passwordEnabled?(0,c.G)("userProfile.passwordPage.title__update"):(0,c.G)("userProfile.passwordPage.title__set"),text:(e=a.passwordEnabled,r=!!D.checked,t=[],e?t.push((0,c.G)("userProfile.passwordPage.successMessage__update")):t.push((0,c.G)("userProfile.passwordPage.successMessage__set")),r&&t.push((0,c.G)("userProfile.passwordPage.successMessage__signOutOfOtherSessions")),t)};let i={newPassword:S.value,signOutOfOtherSessions:D.checked,currentPassword:P?y.value:void 0};await s(a,[i]),l()}catch(e){(0,G.H4)(e,[y,S,_],p.setError)}};return(0,i.FD)(ec.M,{headerTitle:m,children:[g&&(0,i.Y)(ew.k,{message:(0,c.G)("userProfile.passwordPage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:$,onBlur:()=>{S.value&&R(_.value)},children:[(0,i.Y)("input",{readOnly:!0,"data-testid":"hidden-identifier",id:"identifier-field",name:"identifier",value:f?.publicUserData.identifier||"",style:{display:"none"}}),P&&(0,i.Y)(ea.l.ControlRow,{elementId:y.id,children:(0,i.Y)(ea.l.PasswordInput,{...y.props,minLength:6,isRequired:!0,autoFocus:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:S.id,children:(0,i.Y)(ea.l.PasswordInput,{...S.props,minLength:6,isRequired:!0,autoFocus:!a.passwordEnabled,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:_.id,children:(0,i.Y)(ea.l.PasswordInput,{..._.props,onChange:e=>(e.target.value&&R(e.target.value),_.props.onChange(e)),isRequired:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:D.id,children:(0,i.Y)(ea.l.Checkbox,{...D.props,description:(0,c.G)("userProfile.passwordPage.checkboxInfoText__signOutOfOtherSessions"),isDisabled:g})}),g?(0,i.Y)(es.c,{children:(0,i.Y)(ea.l.ResetButton,{localizationKey:(0,c.G)("userProfile.formButtonReset"),block:!1,onClick:o})}):(0,i.Y)(es.G,{isDisabled:!C,onReset:o})]})]})}),rH=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rj,{onSuccess:e,onReset:e})},rV=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{passwordEnabled:r}=e;return(0,i.Y)(D.rd.Root,{centered:!1,title:(0,c.G)("userProfile.start.passwordSection.title"),id:"password",children:(0,i.FD)(C.r.Root,{children:[(0,i.Y)(C.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"password",sx:e=>({paddingLeft:r?void 0:"0",paddingTop:e.space.$0x25,paddingBottom:e.space.$0x25}),children:[r&&(0,i.Y)(y.EY,{variant:"h2",children:"••••••••••"}),(0,i.Y)(C.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"password",localizationKey:r?(0,c.G)("userProfile.start.passwordSection.primaryButton__updatePassword"):(0,c.G)("userProfile.start.passwordSection.primaryButton__setPassword")})})]})}),(0,i.Y)(C.r.Open,{value:"edit",children:(0,i.Y)(C.r.Card,{children:(0,i.Y)(rH,{})})})]})})},rZ=(0,d.dm)(()=>{let{attributes:e,instanceIsPasswordBased:r}=(0,Y.O)().userSettings,t=(0,d.f0)(),{user:n}=(0,v.Jd)(),{shouldAllowIdentificationCreation:l}=(0,a.B)(),o=e.passkey?.enabled&&l,s=H(e).length>0,u=n?.deleteSelfEnabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("security"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,c.G)("userProfile.start.headerTitle__security"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:t.error}),r&&(0,i.Y)(rV,{}),o&&(0,i.Y)(rB,{}),s&&(0,i.Y)(rx,{}),(0,i.Y)(eX,{}),u&&(0,i.Y)(e8,{})]})})}),rX=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("207"),t.e("259")]).then(t.bind(t,1608)).then(e=>({default:e.BillingPage}))),rQ=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("326"),t.e("817")]).then(t.bind(t,8201)).then(e=>({default:e.APIKeysPage}))),r0=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("970"),t.e("110")]).then(t.bind(t,7437)).then(e=>({default:e.PlansPage}))),r1=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("627")]).then(t.bind(t,1666)).then(e=>({default:e.StatementPage}))),r2=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("122")]).then(t.bind(t,4856)).then(e=>({default:e.PaymentAttemptPage}))),r5=()=>{let{pages:e,shouldShowBilling:r,apiKeysProps:t}=(0,a.B)(),{apiKeysSettings:o,commerceSettings:s}=(0,Y.O)(),c=e.routes[0].id===l.j2.ACCOUNT,d=e.routes[0].id===l.j2.SECURITY,u=e.routes[0].id===l.j2.BILLING,h=e.routes[0].id===l.j2.API_KEYS,p=e.contents?.map((e,r)=>{let t=!c&&!d&&0===r;return(0,i.Y)(m.q,{index:t,path:t?void 0:e.url,children:(0,i.Y)(g.H,{mount:e.mount,unmount:e.unmount})},`custom-page-${e.url}`)});return(0,i.FD)(f.d,{children:[p,(0,i.FD)(m.q,{children:[(0,i.Y)(m.q,{path:c?void 0:"account",children:(0,i.Y)(f.d,{children:(0,i.Y)(m.q,{index:!0,children:(0,i.Y)(eJ,{})})})}),(0,i.Y)(m.q,{path:d?void 0:"security",children:(0,i.Y)(f.d,{children:(0,i.Y)(m.q,{index:!0,children:(0,i.Y)(rZ,{})})})}),s.billing.user.enabled&&r?(0,i.Y)(m.q,{path:u?void 0:"billing",children:(0,i.FD)(f.d,{children:[(0,i.Y)(m.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rX,{})})}),s.billing.user.hasPaidPlans?(0,i.Y)(m.q,{path:"plans",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(r0,{})})}):null,(0,i.Y)(m.q,{path:"statement/:statementId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(r1,{})})}),(0,i.Y)(m.q,{path:"payment-attempt/:paymentAttemptId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(r2,{})})})]})}):null,o.user_api_keys_enabled&&!t?.hide&&(0,i.Y)(m.q,{path:h?void 0:"api-keys",children:(0,i.Y)(f.d,{children:(0,i.Y)(m.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rQ,{})})})})})]})]})};var r4=t(393);let r3=()=>(0,i.Y)(s.n.Root,{flow:"userProfile",children:(0,i.Y)(s.n.Part,{children:(0,i.FD)(f.d,{children:[(0,i.Y)(m.q,{path:"verify",children:(0,i.Y)(r4.G,{})}),(0,i.Y)(m.q,{children:(0,i.Y)(r6,{})})]})})}),r6=(0,o.G)(()=>{let e=n.useRef(null);return(0,i.Y)(h.a.Root,{children:(0,i.FD)(p,{contentRef:e,children:[(0,i.Y)(u.oT,{navbarTitleLocalizationKey:(0,c.G)("userProfile.navbar.title")}),(0,i.Y)(h.a.Content,{contentRef:e,scrollBoxId:l.AG,children:(0,i.Y)(r5,{})})]})})}),r8=(0,d.dm)(r3),r7=(0,d.dm)(r3),r9=e=>{let r={...e,routing:"virtual",componentName:"UserProfile",mode:"modal"};return(0,i.Y)(m.q,{path:"user",children:(0,i.Y)(a.M.Provider,{value:r,children:(0,i.Y)("div",{children:(0,i.Y)(r7,{...r})})})})}},9599:function(e,r,t){t.d(r,{g:()=>l});var i=t(1210),n=t(4964);let l=()=>{let{navigate:e}=(0,n.r)(),r=(0,i.ho)();return{navigateAfterSignOut:()=>e(r.buildAfterSignOutUrl()),navigateAfterMultiSessionSingleSignOutUrl:()=>e(r.buildAfterMultiSessionSingleSignOutUrl()),afterSignOutUrl:r.buildAfterSignOutUrl(),afterMultiSessionSingleSignOutUrl:r.buildAfterMultiSessionSingleSignOutUrl()}}}}]);
@@ -33,12 +33,6 @@ const handleError = (err, fieldStates, setGlobalError) => {
33
33
  if (isClerkRuntimeError(err) && err.code === "reverification_cancelled") return;
34
34
  if (isClerkRuntimeError(err)) return handleClerkRuntimeError(err, fieldStates, setGlobalError);
35
35
  };
36
- function getFieldError(err) {
37
- if (!isClerkAPIResponseError(err)) return;
38
- const { fieldErrors } = parseErrors(err.errors);
39
- if (!fieldErrors.length) return;
40
- return fieldErrors[0];
41
- }
42
36
  const handleMetamaskError = (err, _, setGlobalError) => {
43
37
  return setGlobalError?.(err.message);
44
38
  };
@@ -62,5 +56,5 @@ const handleClerkRuntimeError = (err, _, setGlobalError) => {
62
56
  };
63
57
 
64
58
  //#endregion
65
- export { getFieldError, handleError };
59
+ export { handleError };
66
60
  //# sourceMappingURL=errorHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errorHandler.js","names":["handleError: HandleError","handleMetamaskError: HandleError","handleClerkApiError: HandleError","handleClerkRuntimeError: HandleError"],"sources":["../../src/utils/errorHandler.ts"],"sourcesContent":["import { isClerkAPIResponseError, isClerkRuntimeError, isKnownError, isMetamaskError } from '@clerk/shared/error';\nimport type { ClerkAPIError, ClerkRuntimeError } from '@clerk/shared/types';\nimport { snakeToCamel } from '@clerk/shared/underscore';\n\nimport type { FormControlState } from './useFormControl';\n\ninterface ParserErrors {\n fieldErrors: ClerkAPIError[];\n globalErrors: ClerkAPIError[];\n}\n\nconst getFirstError = (err: ClerkAPIError[]) => err[0];\n\nfunction setFieldErrors(fieldStates: Array<FormControlState<string>>, errors: ClerkAPIError[]) {\n if (!errors || errors.length < 1) {\n return;\n }\n\n fieldStates.forEach(field => {\n let buildErrorMessage = field?.buildErrorMessage;\n\n if (!buildErrorMessage) {\n buildErrorMessage = getFirstError;\n }\n\n const errorsArray = errors.filter(err => {\n return err.meta?.paramName === field.id || snakeToCamel(err.meta?.paramName) === field.id;\n });\n\n const errorMessage = buildErrorMessage(errorsArray);\n if (errorsArray.length && errorMessage) {\n field.setError(errorMessage);\n } else {\n field.clearFeedback();\n }\n });\n}\n\nfunction parseErrors(errors: ClerkAPIError[]): ParserErrors {\n return (errors || []).reduce(\n (memo, err) => {\n if (err.meta?.paramName) {\n memo.fieldErrors.push(err);\n } else {\n memo.globalErrors.push(err);\n }\n return memo;\n },\n {\n fieldErrors: Array<ClerkAPIError>(0),\n globalErrors: Array<ClerkAPIError>(0),\n },\n );\n}\n\ntype HandleError = {\n (\n err: Error,\n fieldStates: Array<FormControlState<string>>,\n setGlobalError?: (err: ClerkRuntimeError | ClerkAPIError | string | undefined) => void,\n ): void;\n};\n\nexport const handleError: HandleError = (err, fieldStates, setGlobalError) => {\n // Throw unknown errors\n if (!isKnownError(err)) {\n throw err;\n }\n\n if (isMetamaskError(err)) {\n return handleMetamaskError(err, fieldStates, setGlobalError);\n }\n\n if (isClerkAPIResponseError(err)) {\n return handleClerkApiError(err, fieldStates, setGlobalError);\n }\n\n if (isClerkRuntimeError(err) && err.code === 'reverification_cancelled') {\n // Don't log or display an error for cancelled reverification, the user simply closed the modal.\n return;\n }\n\n if (isClerkRuntimeError(err)) {\n return handleClerkRuntimeError(err, fieldStates, setGlobalError);\n }\n};\n\n// Returns the first global API error or undefined if none exists.\nexport function getGlobalError(err: Error): ClerkAPIError | undefined {\n if (!isClerkAPIResponseError(err)) {\n return;\n }\n const { globalErrors } = parseErrors(err.errors);\n if (!globalErrors.length) {\n return;\n }\n return globalErrors[0];\n}\n\n// Returns the first field API error or undefined if none exists.\nexport function getFieldError(err: Error): ClerkAPIError | undefined {\n if (!isClerkAPIResponseError(err)) {\n return;\n }\n const { fieldErrors } = parseErrors(err.errors);\n\n if (!fieldErrors.length) {\n return;\n }\n\n return fieldErrors[0];\n}\n\nexport function getClerkAPIErrorMessage(err: ClerkAPIError): string {\n return err.longMessage || err.message;\n}\n\nconst handleMetamaskError: HandleError = (err, _, setGlobalError) => {\n return setGlobalError?.(err.message);\n};\n\nconst handleClerkApiError: HandleError = (err, fieldStates, setGlobalError) => {\n if (!isClerkAPIResponseError(err)) {\n return;\n }\n\n const { fieldErrors, globalErrors } = parseErrors(err.errors);\n setFieldErrors(fieldStates, fieldErrors);\n\n if (setGlobalError) {\n setGlobalError(undefined);\n // Show only the first global error until we have snack bar stacks if applicable\n // TODO: Make global errors localizable\n const firstGlobalError = globalErrors[0];\n if (firstGlobalError) {\n setGlobalError(firstGlobalError);\n }\n }\n};\n\nconst handleClerkRuntimeError: HandleError = (err, _, setGlobalError) => {\n if (!isClerkRuntimeError(err)) {\n return;\n }\n\n if (setGlobalError) {\n setGlobalError(undefined);\n const firstGlobalError = err;\n if (firstGlobalError) {\n setGlobalError(firstGlobalError);\n }\n }\n};\n"],"mappings":";;;;AAWA,MAAM,iBAAiB,QAAyB,IAAI;AAEpD,SAAS,eAAe,aAA8C,QAAyB;AAC7F,KAAI,CAAC,UAAU,OAAO,SAAS,EAC7B;AAGF,aAAY,SAAQ,UAAS;EAC3B,IAAI,oBAAoB,OAAO;AAE/B,MAAI,CAAC,kBACH,qBAAoB;EAGtB,MAAM,cAAc,OAAO,QAAO,QAAO;AACvC,UAAO,IAAI,MAAM,cAAc,MAAM,MAAM,aAAa,IAAI,MAAM,UAAU,KAAK,MAAM;IACvF;EAEF,MAAM,eAAe,kBAAkB,YAAY;AACnD,MAAI,YAAY,UAAU,aACxB,OAAM,SAAS,aAAa;MAE5B,OAAM,eAAe;GAEvB;;AAGJ,SAAS,YAAY,QAAuC;AAC1D,SAAQ,UAAU,EAAE,EAAE,QACnB,MAAM,QAAQ;AACb,MAAI,IAAI,MAAM,UACZ,MAAK,YAAY,KAAK,IAAI;MAE1B,MAAK,aAAa,KAAK,IAAI;AAE7B,SAAO;IAET;EACE,aAAa,MAAqB,EAAE;EACpC,cAAc,MAAqB,EAAE;EACtC,CACF;;AAWH,MAAaA,eAA4B,KAAK,aAAa,mBAAmB;AAE5E,KAAI,CAAC,aAAa,IAAI,CACpB,OAAM;AAGR,KAAI,gBAAgB,IAAI,CACtB,QAAO,oBAAoB,KAAK,aAAa,eAAe;AAG9D,KAAI,wBAAwB,IAAI,CAC9B,QAAO,oBAAoB,KAAK,aAAa,eAAe;AAG9D,KAAI,oBAAoB,IAAI,IAAI,IAAI,SAAS,2BAE3C;AAGF,KAAI,oBAAoB,IAAI,CAC1B,QAAO,wBAAwB,KAAK,aAAa,eAAe;;AAiBpE,SAAgB,cAAc,KAAuC;AACnE,KAAI,CAAC,wBAAwB,IAAI,CAC/B;CAEF,MAAM,EAAE,gBAAgB,YAAY,IAAI,OAAO;AAE/C,KAAI,CAAC,YAAY,OACf;AAGF,QAAO,YAAY;;AAOrB,MAAMC,uBAAoC,KAAK,GAAG,mBAAmB;AACnE,QAAO,iBAAiB,IAAI,QAAQ;;AAGtC,MAAMC,uBAAoC,KAAK,aAAa,mBAAmB;AAC7E,KAAI,CAAC,wBAAwB,IAAI,CAC/B;CAGF,MAAM,EAAE,aAAa,iBAAiB,YAAY,IAAI,OAAO;AAC7D,gBAAe,aAAa,YAAY;AAExC,KAAI,gBAAgB;AAClB,iBAAe,OAAU;EAGzB,MAAM,mBAAmB,aAAa;AACtC,MAAI,iBACF,gBAAe,iBAAiB;;;AAKtC,MAAMC,2BAAwC,KAAK,GAAG,mBAAmB;AACvE,KAAI,CAAC,oBAAoB,IAAI,CAC3B;AAGF,KAAI,gBAAgB;AAClB,iBAAe,OAAU;EACzB,MAAM,mBAAmB;AACzB,MAAI,iBACF,gBAAe,iBAAiB"}
1
+ {"version":3,"file":"errorHandler.js","names":["handleError: HandleError","handleMetamaskError: HandleError","handleClerkApiError: HandleError","handleClerkRuntimeError: HandleError"],"sources":["../../src/utils/errorHandler.ts"],"sourcesContent":["import { isClerkAPIResponseError, isClerkRuntimeError, isKnownError, isMetamaskError } from '@clerk/shared/error';\nimport type { ClerkAPIError, ClerkRuntimeError } from '@clerk/shared/types';\nimport { snakeToCamel } from '@clerk/shared/underscore';\n\nimport type { FormControlState } from './useFormControl';\n\ninterface ParserErrors {\n fieldErrors: ClerkAPIError[];\n globalErrors: ClerkAPIError[];\n}\n\nconst getFirstError = (err: ClerkAPIError[]) => err[0];\n\nfunction setFieldErrors(fieldStates: Array<FormControlState<string>>, errors: ClerkAPIError[]) {\n if (!errors || errors.length < 1) {\n return;\n }\n\n fieldStates.forEach(field => {\n let buildErrorMessage = field?.buildErrorMessage;\n\n if (!buildErrorMessage) {\n buildErrorMessage = getFirstError;\n }\n\n const errorsArray = errors.filter(err => {\n return err.meta?.paramName === field.id || snakeToCamel(err.meta?.paramName) === field.id;\n });\n\n const errorMessage = buildErrorMessage(errorsArray);\n if (errorsArray.length && errorMessage) {\n field.setError(errorMessage);\n } else {\n field.clearFeedback();\n }\n });\n}\n\nfunction parseErrors(errors: ClerkAPIError[]): ParserErrors {\n return (errors || []).reduce(\n (memo, err) => {\n if (err.meta?.paramName) {\n memo.fieldErrors.push(err);\n } else {\n memo.globalErrors.push(err);\n }\n return memo;\n },\n {\n fieldErrors: Array<ClerkAPIError>(0),\n globalErrors: Array<ClerkAPIError>(0),\n },\n );\n}\n\ntype HandleError = {\n (\n err: Error,\n fieldStates: Array<FormControlState<string>>,\n setGlobalError?: (err: ClerkRuntimeError | ClerkAPIError | string | undefined) => void,\n ): void;\n};\n\nexport const handleError: HandleError = (err, fieldStates, setGlobalError) => {\n // Throw unknown errors\n if (!isKnownError(err)) {\n throw err;\n }\n\n if (isMetamaskError(err)) {\n return handleMetamaskError(err, fieldStates, setGlobalError);\n }\n\n if (isClerkAPIResponseError(err)) {\n return handleClerkApiError(err, fieldStates, setGlobalError);\n }\n\n if (isClerkRuntimeError(err) && err.code === 'reverification_cancelled') {\n // Don't log or display an error for cancelled reverification, the user simply closed the modal.\n return;\n }\n\n if (isClerkRuntimeError(err)) {\n return handleClerkRuntimeError(err, fieldStates, setGlobalError);\n }\n};\n\n// Returns the first global API error or undefined if none exists.\nexport function getGlobalError(err: Error): ClerkAPIError | undefined {\n if (!isClerkAPIResponseError(err)) {\n return;\n }\n const { globalErrors } = parseErrors(err.errors);\n if (!globalErrors.length) {\n return;\n }\n return globalErrors[0];\n}\n\n// Returns the first field API error or undefined if none exists.\nexport function getFieldError(err: Error): ClerkAPIError | undefined {\n if (!isClerkAPIResponseError(err)) {\n return;\n }\n const { fieldErrors } = parseErrors(err.errors);\n\n if (!fieldErrors.length) {\n return;\n }\n\n return fieldErrors[0];\n}\n\nexport function getClerkAPIErrorMessage(err: ClerkAPIError): string {\n return err.longMessage || err.message;\n}\n\nconst handleMetamaskError: HandleError = (err, _, setGlobalError) => {\n return setGlobalError?.(err.message);\n};\n\nconst handleClerkApiError: HandleError = (err, fieldStates, setGlobalError) => {\n if (!isClerkAPIResponseError(err)) {\n return;\n }\n\n const { fieldErrors, globalErrors } = parseErrors(err.errors);\n setFieldErrors(fieldStates, fieldErrors);\n\n if (setGlobalError) {\n setGlobalError(undefined);\n // Show only the first global error until we have snack bar stacks if applicable\n // TODO: Make global errors localizable\n const firstGlobalError = globalErrors[0];\n if (firstGlobalError) {\n setGlobalError(firstGlobalError);\n }\n }\n};\n\nconst handleClerkRuntimeError: HandleError = (err, _, setGlobalError) => {\n if (!isClerkRuntimeError(err)) {\n return;\n }\n\n if (setGlobalError) {\n setGlobalError(undefined);\n const firstGlobalError = err;\n if (firstGlobalError) {\n setGlobalError(firstGlobalError);\n }\n }\n};\n"],"mappings":";;;;AAWA,MAAM,iBAAiB,QAAyB,IAAI;AAEpD,SAAS,eAAe,aAA8C,QAAyB;AAC7F,KAAI,CAAC,UAAU,OAAO,SAAS,EAC7B;AAGF,aAAY,SAAQ,UAAS;EAC3B,IAAI,oBAAoB,OAAO;AAE/B,MAAI,CAAC,kBACH,qBAAoB;EAGtB,MAAM,cAAc,OAAO,QAAO,QAAO;AACvC,UAAO,IAAI,MAAM,cAAc,MAAM,MAAM,aAAa,IAAI,MAAM,UAAU,KAAK,MAAM;IACvF;EAEF,MAAM,eAAe,kBAAkB,YAAY;AACnD,MAAI,YAAY,UAAU,aACxB,OAAM,SAAS,aAAa;MAE5B,OAAM,eAAe;GAEvB;;AAGJ,SAAS,YAAY,QAAuC;AAC1D,SAAQ,UAAU,EAAE,EAAE,QACnB,MAAM,QAAQ;AACb,MAAI,IAAI,MAAM,UACZ,MAAK,YAAY,KAAK,IAAI;MAE1B,MAAK,aAAa,KAAK,IAAI;AAE7B,SAAO;IAET;EACE,aAAa,MAAqB,EAAE;EACpC,cAAc,MAAqB,EAAE;EACtC,CACF;;AAWH,MAAaA,eAA4B,KAAK,aAAa,mBAAmB;AAE5E,KAAI,CAAC,aAAa,IAAI,CACpB,OAAM;AAGR,KAAI,gBAAgB,IAAI,CACtB,QAAO,oBAAoB,KAAK,aAAa,eAAe;AAG9D,KAAI,wBAAwB,IAAI,CAC9B,QAAO,oBAAoB,KAAK,aAAa,eAAe;AAG9D,KAAI,oBAAoB,IAAI,IAAI,IAAI,SAAS,2BAE3C;AAGF,KAAI,oBAAoB,IAAI,CAC1B,QAAO,wBAAwB,KAAK,aAAa,eAAe;;AAkCpE,MAAMC,uBAAoC,KAAK,GAAG,mBAAmB;AACnE,QAAO,iBAAiB,IAAI,QAAQ;;AAGtC,MAAMC,uBAAoC,KAAK,aAAa,mBAAmB;AAC7E,KAAI,CAAC,wBAAwB,IAAI,CAC/B;CAGF,MAAM,EAAE,aAAa,iBAAiB,YAAY,IAAI,OAAO;AAC7D,gBAAe,aAAa,YAAY;AAExC,KAAI,gBAAgB;AAClB,iBAAe,OAAU;EAGzB,MAAM,mBAAmB,aAAa;AACtC,MAAI,iBACF,gBAAe,iBAAiB;;;AAKtC,MAAMC,2BAAwC,KAAK,GAAG,mBAAmB;AACvE,KAAI,CAAC,oBAAoB,IAAI,CAC3B;AAGF,KAAI,gBAAgB;AAClB,iBAAe,OAAU;EACzB,MAAM,mBAAmB;AACzB,MAAI,iBACF,gBAAe,iBAAiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerk/ui",
3
- "version": "1.0.0-canary.v20251218195700",
3
+ "version": "1.0.0-canary.v20251218215334",
4
4
  "description": "Internal package that contains the UI components for the Clerk frontend SDKs",
5
5
  "repository": {
6
6
  "type": "git",
@@ -62,8 +62,8 @@
62
62
  "react": "^18.0.0 || ^19.0.3 || ^19.1.4 || ^19.2.3 || ^19.3.0-0",
63
63
  "react-dom": "^18.0.0 || ^19.0.3 || ^19.1.4 || ^19.2.3 || ^19.3.0-0",
64
64
  "swr": "2.3.4",
65
- "@clerk/localizations": "4.0.0-canary.v20251218195700",
66
- "@clerk/shared": "4.0.0-canary.v20251218195700"
65
+ "@clerk/localizations": "4.0.0-canary.v20251218215334",
66
+ "@clerk/shared": "4.0.0-canary.v20251218215334"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@floating-ui/react-dom": "^2.1.6",