"use strict";var e=require("react/jsx-runtime"),r=require("@heroicons/react/24/outline/ExclamationTriangleIcon"),t=require("@heroicons/react/24/outline/WalletIcon"),n=require("react"),o=require("./ModalHeader-Cpls13mi.js"),s=require("styled-components"),i=require("./StackedContainer-CM36po_U.js"),a=require("./Address-DW_NyDV7.js"),c=require("./internal-context-CdsQ3LEl.js"),l=require("./modal-context-BgeioxwT.js"),d=require("./capitalizeFirstLetter-D-K8mqBm.js"),u=require("./context-rs-ygOK2.js"),h=require("@heroicons/react/24/outline/ExclamationCircleIcon"),f=require("@heroicons/react/24/outline/Square2StackIcon");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./useActiveWallet-dTc6deka.js"),require("viem/utils"),require("./wallet-connect-BuohfvHK.js"),require("./errors-CBapWvRs.js"),require("ofetch"),require("./getPublicClient-CFd_sHBk.js"),require("viem"),require("viem/chains"),require("@privy-io/js-sdk-core"),require("eventemitter3"),require("./events-context-Di6--rDg.js"),require("./privy-context-UTJouJ1x.js"),require("@privy-io/are-addresses-equal"),require("./index-Ub4KpwSY.js"),require("zustand"),require("react-device-detect"),require("./get-entropy-details-for-user-D63rM5_a.js"),require("./user-D2oPA-vS.js"),require("@heroicons/react/24/outline/ArrowLeftIcon"),require("@heroicons/react/24/outline/ArrowRightIcon"),require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),require("@heroicons/react/24/outline/XMarkIcon"),require("lucide-react"),require("tinycolor2");var p=/*#__PURE__*/x(r),y=/*#__PURE__*/x(t),g=/*#__PURE__*/x(h),j=/*#__PURE__*/x(f);const m=s.styled.span`
  && {
    width: 82px;
    height: 82px;
    border-width: 4px;
    border-style: solid;
    border-color: ${e=>e.color??"var(--privy-color-accent)"};
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1.2s linear infinite;
    transition: border-color 800ms;
    border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
  }
`;function v(r){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...r,children:[/*#__PURE__*/e.jsx("circle",{cx:"12",cy:"12",r:"10"}),/*#__PURE__*/e.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),/*#__PURE__*/e.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}const b=({onTransfer:r,isTransferring:t,transferSuccess:n})=>/*#__PURE__*/e.jsx(o.PrimaryButton,{...n?{success:!0,children:"Success!"}:{warn:!0,loading:t,onClick:r,children:"Transfer and delete account"}}),w=s.styled.div`
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding-bottom: 16px;
`,T=s.styled.div`
  display: flex;
  flex-direction: column;
  && p {
    font-size: 14px;
  }
  width: 100%;
  gap: 16px;
`,q=s.styled.div`
  display: flex;
  cursor: pointer;
  align-items: center;
  width: 100%;
  border: 1px solid var(--privy-color-foreground-4) !important;
  border-radius: var(--privy-border-radius-md);
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
`,k=s.styled(g.default)`
  position: relative;
  width: ${({$iconSize:e})=>`${e}px`};
  height: ${({$iconSize:e})=>`${e}px`};
  color: var(--privy-color-foreground-3);
  margin-left: auto;
`,C=s.styled(j.default)`
  position: relative;
  width: 15px;
  height: 15px;
  color: var(--privy-color-foreground-3);
  margin-left: auto;
`,A=s.styled.ol`
  display: flex;
  flex-direction: column;
  font-size: 14px;
  width: 100%;
  text-align: left;
`,S=s.styled.li`
  font-size: 14px;
  list-style-type: auto;
  list-style-position: outside;
  margin-left: 1rem;
  margin-bottom: 0.5rem; /* Adjust the margin as needed */

  &:last-child {
    margin-bottom: 0; /* Remove margin from the last item */
  }
`,I=s.styled.div`
  position: relative;
  width: 60px;
  height: 60px;
  margin: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
`;let W=()=>/*#__PURE__*/e.jsx(I,{children:/*#__PURE__*/e.jsx(k,{$iconSize:60})});const M=({address:r,onClose:t,onRetry:n,onTransfer:s,isTransferring:i,transferSuccess:c})=>{let{defaultChain:l}=u.useAppConfig(),d=l.blockExplorers?.default.url??"https://etherscan.io";/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(o.ModalHeader,{onClose:t,backFn:n}),/*#__PURE__*/e.jsxs(w,{children:[/*#__PURE__*/e.jsx(W,{}),/*#__PURE__*/e.jsxs(T,{children:[/*#__PURE__*/e.jsx("h3",{children:"Check account assets before transferring"}),/*#__PURE__*/e.jsx("p",{children:"Before transferring, ensure there are no assets in the other account. Assets in that account will not transfer automatically and may be lost."}),/*#__PURE__*/e.jsxs(A,{children:[/*#__PURE__*/e.jsx("p",{children:" To check your balance, you can:"}),/*#__PURE__*/e.jsx(S,{children:"Log out and log back into the other account, or "}),/*#__PURE__*/e.jsxs(S,{children:["Copy your wallet address and use a"," ",/*#__PURE__*/e.jsx("u",{children:/*#__PURE__*/e.jsx("a",{target:"_blank",href:d,children:"block explorer"})})," ","to see if the account holds any assets."]})]}),/*#__PURE__*/e.jsxs(q,{onClick:()=>navigator.clipboard.writeText(r).catch(console.error),children:[/*#__PURE__*/e.jsx(y.default,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/e.jsx(a.Address,{address:r,showCopyIcon:!1}),/*#__PURE__*/e.jsx(C,{})]}),/*#__PURE__*/e.jsx(b,{onTransfer:s,isTransferring:i,transferSuccess:c})]})]}),/*#__PURE__*/e.jsx(o.BlobbyFooter,{})]})},$={component:()=>{let{initiateAccountTransfer:r,closePrivyModal:t}=c.usePrivyInternal(),{data:o,navigate:s,lastScreen:i,setModalData:a}=l.usePrivyModal(),[d,u]=n.useState(void 0),[h,f]=n.useState(!1),[x,p]=n.useState(!1),y=async()=>{try{if(!o?.accountTransfer?.nonce||!o?.accountTransfer?.account)throw Error("missing account transfer inputs");p(!0),await r({nonce:o?.accountTransfer?.nonce,account:o?.accountTransfer?.account,accountType:o?.accountTransfer?.linkMethod,externalWalletMetadata:o?.accountTransfer?.externalWalletMetadata,telegramWebAppData:o?.accountTransfer?.telegramWebAppData,telegramAuthResult:o?.accountTransfer?.telegramAuthResult,farcasterEmbeddedAddress:o?.accountTransfer?.farcasterEmbeddedAddress,oAuthUserInfo:o?.accountTransfer?.oAuthUserInfo}),f(!0),p(!1),setTimeout(t,1e3)}catch(e){a({errorModalData:{error:e,previousScreen:i||"LinkConflictScreen"}}),s("ErrorScreen",!0)}};return d?/*#__PURE__*/e.jsx(M,{address:d,onClose:t,onRetry:()=>u(void 0),onTransfer:y,isTransferring:x,transferSuccess:h}):/*#__PURE__*/e.jsx(z,{onClose:t,onInfo:()=>u(o?.accountTransfer?.embeddedWalletAddress),onContinue:()=>u(o?.accountTransfer?.embeddedWalletAddress),onTransfer:y,isTransferring:x,transferSuccess:h,data:o})}},z=({onClose:r,onContinue:t,onInfo:n,onTransfer:s,transferSuccess:a,isTransferring:c,data:l})=>{if(!l?.accountTransfer?.linkMethod||!l?.accountTransfer?.displayName)return;let u={method:l?.accountTransfer?.linkMethod,handle:l?.accountTransfer?.displayName,disclosedAccount:l?.accountTransfer?.embeddedWalletAddress?{type:"wallet",handle:l?.accountTransfer?.embeddedWalletAddress}:void 0};/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(o.ModalHeader,{closeable:!0}),/*#__PURE__*/e.jsxs(w,{children:[/*#__PURE__*/e.jsx(i.e,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsx(m,{color:"var(--privy-color-error)"}),/*#__PURE__*/e.jsx(p.default,{height:38,width:38,stroke:"var(--privy-color-error)"})]})}),/*#__PURE__*/e.jsxs(T,{children:[/*#__PURE__*/e.jsxs("h3",{children:[function(e){switch(e){case"sms":return"Phone number";case"email":return"Email address";case"siwe":return"Wallet address";case"siws":return"Solana wallet address";case"linkedin":return"LinkedIn profile";case"google":case"apple":case"discord":case"github":case"instagram":case"spotify":case"tiktok":case"line":case"twitch":case"twitter":case"telegram":case"farcaster":return`${d.e(e.replace("_oauth",""))} profile`;default:return e.startsWith("privy:")?"Cross-app account":e}}(u.method)," is associated with another account"]}),/*#__PURE__*/e.jsxs("p",{children:["Do you want to transfer",/*#__PURE__*/e.jsx("b",{children:u.handle?` ${u.handle}`:""})," to this account instead? This will delete your other account."]}),/*#__PURE__*/e.jsx(E,{onClick:n,disclosedAccount:u.disclosedAccount})]}),/*#__PURE__*/e.jsxs(T,{style:{gap:12,marginTop:12},children:[l?.accountTransfer?.embeddedWalletAddress?/*#__PURE__*/e.jsx(o.PrimaryButton,{onClick:t,children:"Continue"}):/*#__PURE__*/e.jsx(b,{onTransfer:s,transferSuccess:a,isTransferring:c}),/*#__PURE__*/e.jsx(o.SecondaryButton,{onClick:r,children:"No thanks"})]})]}),/*#__PURE__*/e.jsx(o.BlobbyFooter,{})]})};function E({disclosedAccount:r,onClick:t}){return r?/*#__PURE__*/e.jsxs(q,{onClick:t,children:[/*#__PURE__*/e.jsx(y.default,{color:"var(--privy-color-foreground-1)",strokeWidth:2,height:"28px",width:"28px"}),/*#__PURE__*/e.jsx(a.Address,{address:r.handle,showCopyIcon:!1}),/*#__PURE__*/e.jsx(v,{width:15,height:15,color:"var(--privy-color-foreground-3)",style:{marginLeft:"auto"}})]}):null}exports.LinkConflictScreen=$,exports.LinkConflictScreenView=z,exports.default=$;
//# sourceMappingURL=LinkConflictScreen-BZ2kV18f.js.map
