1import{e5 as C,dy as E,dw as F,d7 as y,da as e,ej as p,eJ as w,dU as R,dQ as I}from"./JPxLSbkry-VDCYml.js";import{F as P}from"./DknqV7AoD04p5CUF.js";import{F as W}from"./DusCj1HfSePQNb1c.js";import{T as x,k as v,u as j}from"./CjQahFXYn1vLeR4c.js";import{r as A}from"./DM8aQOn5jjNdTHrb.js";import{e as S}from"./BeRy8bM3b8u6tVY7.js";const M=I.div` 2 && { 3 border-width: 4px; 4 } 5 6 display: flex; 7 justify-content: center; 8 align-items: center; 9 padding: 1rem; 10 aspect-ratio: 1; 11 border-style: solid; 12 border-color: ${t=>t.$color??"var(--privy-color-accent)"}; 13 border-radius: 50%; 14`,O={component:()=>{let{user:t}=C(),{client:b,walletProxy:u,refreshSessionAndUser:k,closePrivyModal:s}=E(),r=F(),{entropyId:m,entropyIdVerifier:$}=r.data?.recoverWallet??{},[a,f]=y.useState(!1),[l,T]=y.useState(null),[i,h]=y.useState(null);function n(){if(!a){if(i)return r.data?.setWalletPassword?.onFailure(i),void s();if(!l)return r.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void s()}}r.onUserCloseViaDialogOrKeybindRef.current=n;let U=!(!a&&!l);return e.jsxs(e.Fragment,i?{children:[e.jsx(x,{onClose:n},"header"),e.jsx(M,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:e.jsx(P,{height:38,width:38,stroke:"var(--privy-color-error)"})}),e.jsx(S,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),e.jsx(p,{style:{minHeight:"2rem"}}),e.jsx(v,{onClick:()=>h(null),children:"Try again"}),e.jsx(j,{})]}:{children:[e.jsx(x,{onClose:n},"header"),e.jsx(W,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),e.jsx(S,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),e.jsx(A,{style:{marginTop:"1rem"},children:"When you log into a new device, youâll only need to authenticate to access your account. Never get logged out if you forget your password."}),e.jsx(p,{style:{minHeight:"2rem"}}),e.jsx(v,{loading:a,disabled:U,onClick:()=>(async function(){f(!0);try{let o=await b.getAccessToken(),c=w(t,m);if(!o||!u||!c)return;if(!(await u.setRecovery({accessToken:o,entropyId:m,entropyIdVerifier:$,existingRecoveryMethod:c.recoveryMethod,recoveryMethod:"privy"})).entropyId)throw Error("Unable to set recovery on wallet");let d=await k();if(!d)throw Error("Unable to set recovery on wallet");let g=w(d,c.address);if(!g)throw Error("Unabled to set recovery on wallet");T(!!d),setTimeout((()=>{r.data?.setWalletPassword?.onSuccess(g),s()}),R)}catch(o){h(o)}finally{f(!1)}})(),children:l?"Success":"Confirm"}),e.jsx(j,{})]})}};export{O as SetAutomaticRecoveryScreen,O as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.