"use strict";var e=require("react/jsx-runtime"),r=require("@heroicons/react/24/outline/LockClosedIcon"),i=require("@heroicons/react/24/outline/PencilSquareIcon"),o=require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),t=require("react"),s=require("styled-components"),n=require("./privy-context-UTJouJ1x.js"),u=require("./ModalHeader-Cpls13mi.js"),c=require("./ScreenHeader-CgYJ5Fmg.js"),l=require("./context-rs-ygOK2.js"),a=require("./internal-context-CdsQ3LEl.js"),d=require("./modal-context-BgeioxwT.js"),p=require("./index-BoiKFBqR.js"),h=require("./styles-CQnB5gHS.js"),y=require("./useActiveWallet-dTc6deka.js");function q(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@privy-io/are-addresses-equal"),require("@heroicons/react/24/outline/ArrowLeftIcon"),require("@heroicons/react/24/outline/ArrowRightIcon"),require("@heroicons/react/24/outline/XMarkIcon"),require("@privy-io/js-sdk-core"),require("tinycolor2"),require("./toViemAccount-CopJpCYv.js"),require("jose"),require("eventemitter3"),require("./index-Ub4KpwSY.js"),require("zustand"),require("viem"),require("viem/utils"),require("./errors-CBapWvRs.js"),require("ofetch"),require("./wallet-connect-BuohfvHK.js"),require("./getPublicClient-CFd_sHBk.js"),require("viem/chains"),require("react-device-detect"),require("@coinbase/wallet-sdk"),require("@walletconnect/ethereum-provider"),require("./pkce-CmuJlEgn.js"),require("./paths-DizMb-lU.js"),require("./PrivyPluginContext-DsLtVhZA.js"),require("js-cookie"),require("@privy-io/ethereum"),require("viem/accounts"),require("mipd"),require("@scure/base"),require("./usePrivy-Dt4_yE6Q.js"),require("./use-unlink-wallet-DAxmY7kq.js"),require("./get-entropy-details-for-user-D63rM5_a.js"),require("./user-D2oPA-vS.js"),require("@privy-io/popup"),require("./events-context-Di6--rDg.js"),require("@headlessui/react"),require("@privy-io/urls"),require("./getEmbeddedConnectedWallet-D6YL2FS9.js"),require("./frame-BHa-PKpX.js"),require("@privy-io/routes"),require("./use-deposit-address-CVyd0fqP.js"),require("x402/client"),require("@privy-io/api-base"),require("./use-sign-with-user-signer-BhoaqeNG.js");var v=/*#__PURE__*/q(r),j=/*#__PURE__*/q(i),x=/*#__PURE__*/q(o);let g=s.styled.div`
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
`,m={"google-drive":"Google Drive",icloud:"iCloud","user-passcode":"password",privy:"Privy","privy-v2":"Privy"},C=({onClose:r})=>/*#__PURE__*/e.jsxs(h.RecoveryExplainerContainer,{children:[/*#__PURE__*/e.jsx(c.CenteredScreenHeader,{title:"Why do I need to secure my account?",icon:/*#__PURE__*/e.jsx(x.default,{width:48}),description:/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),/*#__PURE__*/e.jsx("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It’s important you don’t lose access to the method you choose."})]})}),/*#__PURE__*/e.jsx(u.PrimaryButton,{onClick:r,children:"Select backup method"})]});const w={component:()=>{let[r,i]=t.useState(!1),{navigate:o,lastScreen:s,navigateBack:q,setModalData:x,data:w,onUserCloseViaDialogOrKeybindRef:f}=d.usePrivyModal(),{user:S}=n.usePrivyContext(),{embeddedWallets:k}=l.useAppConfig(),{closePrivyModal:P}=a.usePrivyInternal(),b=n.getPrivyPrimaryWallet(S),A=null===b,{isInAccountCreateFlow:M,isResettingPassword:I,shouldCreateEth:F,shouldCreateSol:R}=w.recoverySelection,W=b&&"privy"!==b.recoveryMethod,B=W?/*#__PURE__*/e.jsxs("span",{children:["Your account is currently secured using"," ",/*#__PURE__*/e.jsx("strong",{children:m[b?.recoveryMethod||"user-passcode"]}),"."]}):"Select a method for logging in on new devices and recovering your account.";function O(e){x({recoveryOAuthStatus:{provider:e,action:A?"create-wallet":"set-recovery",isInAccountCreateFlow:M,shouldCreateEth:F,shouldCreateSol:R}}),o("RecoveryOAuthScreen")}function D(){w?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),P({shouldCallAuthOnSuccess:w?.setWalletPassword?.callAuthOnSuccessOnClose??!1})}return f.current=D,/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(u.ModalHeader,{onClose:D,backFn:r?()=>i(!1):s?q:void 0,infoFn:s||r?void 0:()=>i(!0)},"header"),r?/*#__PURE__*/e.jsx(C,{onClose:()=>i(!1)}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(c.CenteredScreenHeader,{title:W?"Update backup method":"Secure your account",icon:/*#__PURE__*/e.jsx(v.default,{width:48}),description:B}),/*#__PURE__*/e.jsx(h.RecoveryContainer,{children:k.userOwnedRecoveryOptions.filter((e=>!["icloud","google-drive"].includes(b?.recoveryMethod||"")||e!==b?.recoveryMethod)).sort().map((r=>{switch(r){case"google-drive":/*#__PURE__*/return e.jsxs(y.LoginMethodButton,{onClick:()=>O("google-drive"),children:[/*#__PURE__*/e.jsx(g,{children:/*#__PURE__*/e.jsx(h.GoogleDrive,{style:{width:18}})}),"Back up to Google Drive"]},r);case"icloud":/*#__PURE__*/return e.jsxs(y.LoginMethodButton,{onClick:()=>O("icloud"),children:[/*#__PURE__*/e.jsx(g,{children:/*#__PURE__*/e.jsx(h.AppleICloud,{style:{width:24}})}),"Back up to Apple iCloud"]},r);case"user-passcode":/*#__PURE__*/return e.jsxs(y.LoginMethodButton,{onClick:()=>{o(p.embeddedWalletSetPasswordScreen({isCreatingWallet:A,skipSplashScreen:!0}))},children:[/*#__PURE__*/e.jsx(g,{children:/*#__PURE__*/e.jsx(j.default,{style:{width:18}})}),I?"Reset your":"Set a"," password"]},r);default:return null}}))})]}),/*#__PURE__*/e.jsx(u.BlobbyFooter,{})]})}};exports.RecoverySelectionScreen=w,exports.default=w;
//# sourceMappingURL=RecoverySelectionScreen-D3VEyZnu.js.map
