@privy-io/react-auth 3.0.2-beta-20250925222239 → 3.1.0-beta-20251002001741

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 (35) hide show
  1. package/dist/cjs/{SignRequestScreen-CCe20ORz.js → SignRequestScreen-DV1Heklf.js} +1 -1
  2. package/dist/cjs/abstract-smart-wallets.js +1 -1
  3. package/dist/cjs/index.js +2 -2
  4. package/dist/cjs/{smart-wallets-CmBEmFub.js → smart-wallets-DeEe61HL.js} +1 -1
  5. package/dist/cjs/smart-wallets.js +1 -1
  6. package/dist/cjs/solana.js +1 -1
  7. package/dist/cjs/ui.js +1 -1
  8. package/dist/cjs/{use-export-wallet-NzNJQIVp.js → use-export-wallet-tRGLWjW_.js} +1 -1
  9. package/dist/cjs/{useActiveWallet-CCF7VIo-.js → useActiveWallet-gTHZwo4V.js} +1 -1
  10. package/dist/cjs/{usePrivy-75GUcthO.js → usePrivy-BEkYq46W.js} +1 -1
  11. package/dist/dts/extended-chains.d.mts +1 -2
  12. package/dist/dts/extended-chains.d.ts +1 -2
  13. package/dist/dts/farcaster.d.mts +1 -2
  14. package/dist/dts/farcaster.d.ts +1 -2
  15. package/dist/dts/index.d.mts +2 -3
  16. package/dist/dts/index.d.ts +2 -3
  17. package/dist/dts/smart-wallets.d.mts +1 -2
  18. package/dist/dts/smart-wallets.d.ts +1 -2
  19. package/dist/dts/solana.d.mts +40 -32
  20. package/dist/dts/solana.d.ts +40 -32
  21. package/dist/dts/{types-D0jOlnAF.d.mts → types-Dj3OrBM7.d.mts} +134 -135
  22. package/dist/dts/{types-D0jOlnAF.d.ts → types-Dj3OrBM7.d.ts} +134 -135
  23. package/dist/dts/ui.d.mts +1 -2
  24. package/dist/dts/ui.d.ts +1 -2
  25. package/dist/esm/{SignRequestScreen-D9E9CdCn.mjs → SignRequestScreen-BoXouQjU.mjs} +1 -1
  26. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  27. package/dist/esm/index.mjs +2 -2
  28. package/dist/esm/{smart-wallets-BznVpb5a.mjs → smart-wallets-BmQ4aRYi.mjs} +1 -1
  29. package/dist/esm/smart-wallets.mjs +1 -1
  30. package/dist/esm/solana.mjs +1 -1
  31. package/dist/esm/ui.mjs +1 -1
  32. package/dist/esm/{use-export-wallet-ffYkDJ-W.mjs → use-export-wallet-Cd7-p_d9.mjs} +1 -1
  33. package/dist/esm/{useActiveWallet-D9rQ-Mni.mjs → useActiveWallet-DbX_sPZP.mjs} +1 -1
  34. package/dist/esm/{usePrivy-BU9ewpTg.mjs → usePrivy-wMqZ49nw.mjs} +1 -1
  35. package/package.json +6 -12
@@ -24,4 +24,4 @@ return e.jsx(ci,{...Gn().render.standalone?{defaultValue:"details"}:{},children:
24
24
  /*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Kr,{}),/*#__PURE__*/e.jsx("div",{style:{marginTop:"1rem"}}),/*#__PURE__*/e.jsx(xr,{})]})}},Cp={component:()=>{let{data:t,setModalData:r}=Zn(),a=t?.funding,i="solana"===a.chainType,o=n.useRef(null),{tokenPrice:s}=Ii(i?"solana":a.chain.id),l=i?void 0:a,c=!(!l?.erc20Address||l?.erc20ContractInfo),d=i?a.isUSDC?"USDC":"SOL":a.erc20Address?a.erc20ContractInfo?.symbol:a.chain.nativeCurrency.symbol||"ETH",u=parseFloat(a.amount),p=!isNaN(u)&&u>0,h=s?Ea(a.amount,s):void 0;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(jc,{children:"Confirm or edit amount"}),/*#__PURE__*/e.jsxs(Ka,{style:{marginTop:"32px"},children:[/*#__PURE__*/e.jsx(op,{children:c?/*#__PURE__*/e.jsx(Kr,{size:"50px"}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(sp,{onClick:()=>o.current?.focus(),children:[/*#__PURE__*/e.jsx(cp,{ref:o,value:a.amount,onChange:e=>{let n=e.target.value;/^[0-9.]*$/.test(n)&&n.split(".").length-1<=1&&r({...t,funding:{...a,amount:n},solanaFundingData:t?.solanaFundingData?{...t.solanaFundingData,amount:n}:void 0})}}),/*#__PURE__*/e.jsx(dp,{children:d})]}),!l?.erc20Address&&/*#__PURE__*/e.jsx(up,{children:h&&p?`${h} USD`:""})]})}),/*#__PURE__*/e.jsx(Nr,{style:{marginTop:"1rem"},disabled:!p,onClick:a.onContinueWithExternalWallet,children:"Continue"})]}),/*#__PURE__*/e.jsx(xr,{})]})}},bp={component:()=>{let t,{connectors:a}=r.usePrivyInternal(),{app:i,setModalData:o,data:s,navigate:l}=Zn(),{wallets:c}=Ni(),d=a.filter(Sn).flatMap((e=>e.wallets)),[u,p]=n.useState("default"),h="solana"===s?.funding?.chainType,g=!!s?.funding?.crossChainBridgingEnabled;t="ethereum"===s?.funding?.chainType?s.funding.erc20Address&&!s.funding.isUSDC?"ethereum-only":g&&!s.funding.chain.testnet?"ethereum-and-solana":"ethereum-only":g&&!s.funding?.isUSDC?"ethereum-and-solana":"solana-only";let m=c.filter((e=>"privy"!==e.walletClientType)),y=m.map((e=>e.walletClientType)),f=d.filter((e=>"privy"!==e.walletClientType)),x=f.map((e=>e.walletClientType)),v=[],w={...s.funding};w.usingDefaultFundingMethod&&(w.usingDefaultFundingMethod=!1);let C=({address:e,walletChainType:t,walletClientType:n})=>{o({...s,funding:{...w,connectedWalletAddress:e,onContinueWithExternalWallet:()=>l(j({destChainType:h?"solana":"ethereum",sourceChainType:t}))},solanaFundingData:s?.solanaFundingData?{...s.solanaFundingData,sourceWalletData:{address:e,walletClientType:n}}:void 0}),l(Cp)};"solana-only"!==t&&v.push(...m.map(((t,n)=>/*#__PURE__*/e.jsx(jp,{onClick:()=>C({address:t.address,walletChainType:"ethereum",walletClientType:t.walletClientType}),icon:t.meta.icon,name:t.meta.name,chainType:t.type},n)))),"ethereum-only"!==t&&v.push(...f.map(((t,n)=>/*#__PURE__*/e.jsx(jp,{onClick:()=>C({address:t.address,walletChainType:"solana",walletClientType:t.walletClientType}),icon:t.meta.icon,name:t.meta.name,chainType:t.type},n)))),v.push(...zu({walletList:i.appearance.walletList.filter((e=>!m.some((t=>t.walletClientType===e))&&!f.some((t=>t.walletClientType===e)))),walletChainType:t,connectors:a,connectOnly:!0,ignore:[...i.appearance.walletList,...y,...x],walletConnectEnabled:i.externalWallets.walletConnect.enabled}));let b=/*#__PURE__*/e.jsx(wu,{text:"More wallets",onClick:()=>p("overflow")}),j=({sourceChainType:e,destChainType:t})=>"ethereum"===e&&"solana"===t?fp:"ethereum"===e&&"ethereum"===t?xp:"solana"===e&&"ethereum"===t?wp:w.externalSolanaFundingScreen;return n.useEffect((()=>{o({...s,externalConnectWallet:{onCompleteNavigateTo:({address:e,walletClientType:t,walletChainType:n})=>(o({...s,funding:{...w,connectedWalletAddress:e,onContinueWithExternalWallet:()=>{l(j({destChainType:h?"solana":"ethereum",sourceChainType:n??"ethereum"}))}},solanaFundingData:s?.solanaFundingData?{...s.solanaFundingData,sourceWalletData:{address:e||"",walletClientType:t||""}}:void 0}),Cp)}})}),[]),"overflow"===u?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{backFn:()=>p("default")},"header"),/*#__PURE__*/e.jsxs(or,{children:[/*#__PURE__*/e.jsx(bc,{style:{color:"var(--privy-color-foreground-3)",textAlign:"left"},children:"More wallets"}),v]}),/*#__PURE__*/e.jsx(xr,{})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx(Ui,{title:"Transfer from wallet",description:"Connect a wallet to deposit funds or send funds manually to your wallet address."}),/*#__PURE__*/e.jsxs(or,{children:[v.length>4?v.slice(0,3):v,v.length>4&&b]}),/*#__PURE__*/e.jsx(xr,{})]})}};let jp=({onClick:t,icon:n,name:r,chainType:a})=>/*#__PURE__*/e.jsxs(dr,{onClick:t,children:[/*#__PURE__*/e.jsx(ip,{style:{width:20},children:/*#__PURE__*/e.jsx("img",{src:n})}),r,/*#__PURE__*/e.jsx(xu,{color:"gray",style:{marginLeft:"auto"},children:"Connected"}),"solana"===a&&/*#__PURE__*/e.jsx(xu,{color:"gray",children:"Solana"})]});const kp={component:()=>{let{data:t,setModalData:a,navigate:i,navigateBack:o}=Zn(),{closePrivyModal:s,createAnalyticsEvent:l,client:c}=r.usePrivyInternal(),[d,u]=n.useState("pending-in-flow"),p=n.useRef(0),h={...t?.funding,showAlternateFundingMethod:!0};h.usingDefaultFundingMethod&&(h.usingDefaultFundingMethod=!1);let{partnerUserId:g,popup:m}=t?.coinbaseOnrampStatus??{};return n.useEffect((()=>{if("pending-in-flow"===d||"pending-after-flow"===d){let e=setInterval((async()=>{if(g)try{let{status:e}=await c.getCoinbaseOnRampStatus({partnerUserId:g});if("success"===e)return void u("success");if("failure"===e)throw Error("There was an error completing Coinbase Onramp flow.");if(p.current>=3)return a({funding:h,solanaFundingData:t?.solanaFundingData}),void i(Vp);m?.closed&&(p.current=p.current+1,u("pending-after-flow"))}catch(e){console.error(e),u("error"),l({eventName:Wc,payload:{status:"failure",provider:"coinbase-onramp",error:e.message}}),a({funding:{...h,errorMessage:"Something went wrong adding funds. Please try again or use another method."},solanaFundingData:t?.solanaFundingData}),i(Vp)}}),1500);return()=>clearInterval(e)}}),[g,m,d]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{title:"Fund account",backFn:()=>{a({funding:h,solanaFundingData:t?.solanaFundingData}),o()}},"header"),/*#__PURE__*/e.jsx(Tp,{status:d,onClickCta:s}),/*#__PURE__*/e.jsx(xr,{})]})}};let Tp=({status:t,onClickCta:r})=>{let{title:a,body:i,cta:o}=n.useMemo((()=>(e=>{switch(e){case"success":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"pending-after-flow":return{title:"In Progress",body:"Almost done. Retrieving transaction status from Coinbase",cta:""};case"error":case"pending-in-flow":return{title:"In Progress",body:"Go back to Coinbase Onramp to finish funding your account.",cta:""}}})(t)),[t]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Ep,{children:[/*#__PURE__*/e.jsx(Ap,{isSucccess:"success"===t}),/*#__PURE__*/e.jsxs(Qa,{children:[/*#__PURE__*/e.jsx("h3",{children:a}),/*#__PURE__*/e.jsx(Sp,{children:i})]})]}),o&&/*#__PURE__*/e.jsx(Pr,{onClick:r,children:o})]})},Ap=({isSucccess:t})=>{if(!t){let t="var(--privy-color-foreground-4)";/*#__PURE__*/return e.jsxs("div",{style:{position:"relative"},children:[/*#__PURE__*/e.jsx(kr,{color:t,style:{position:"absolute"}}),/*#__PURE__*/e.jsx(Tr,{color:t}),/*#__PURE__*/e.jsx(Xt,{style:{position:"absolute",width:"2.8rem",height:"2.8rem",top:"1.2rem",left:"1.2rem"}})]})}let n=(t=>t?Ie.default:()=>/*#__PURE__*/e.jsx(Be.default,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}}))(t),r=(e=>e?"var(--privy-color-success)":"var(--privy-color-foreground-4)")(t);/*#__PURE__*/return e.jsx("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&/*#__PURE__*/e.jsx(n,{width:"4rem",height:"4rem",color:r})})},Sp=/*#__PURE__*/i.styled.p.withConfig({displayName:"StatusBody",componentId:"sc-8428a551-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),Ep=/*#__PURE__*/i.styled.div.withConfig({displayName:"ConnectContainer",componentId:"sc-8428a551-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);let Ip={[l.mainnet.id]:"ethereum",[l.base.id]:"base",[l.optimism.id]:"optimism",[l.polygon.id]:"polygon",[l.arbitrum.id]:"arbitrum"};const Pp=(e,t,n,r,a,i)=>new Promise((async(o,s)=>{let d=Ri();if(!d)return void s(Error("Unable to initialize flow"));let u="ethereum"===t.chainType?function(e){let t=Ip[e];if(!t)throw new c.PrivyClientError(`Unsupported chainId: ${e} for Coinbase Onramp`);return t}(t.chain.id):"solana",p=t.isUSDC?"USDC":"ethereum"===t.chainType?l.toCoinbaseAssetId(t.chain.id,"native-currency"):"SOL",h=await e.initCoinbaseOnRamp({addresses:[{address:t.address,blockchains:[u]}],assets:[p]}),{url:g}=l.getCoinbaseOnRampUrl({appId:e.getAppId(),input:h,amount:t.amount,blockchain:u,asset:p,experience:i});d.location=g.toString();let m={...a?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(m.usingDefaultFundingMethod=!1),n({funding:m,solanaFundingData:a?.solanaFundingData,coinbaseOnrampStatus:{popup:d}}),r(kp),e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"coinbase-onramp",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.chain}}),setTimeout((()=>{n({funding:m,solanaFundingData:a?.solanaFundingData,coinbaseOnrampStatus:{partnerUserId:h.partner_user_id,popup:d}})}),5e3),o()})),Np="moonpay";function _p(e){return parseFloat(e)}function Mp(e,t=!1){let[a,i]=n.useState(null),{createAnalyticsEvent:o}=r.usePrivyInternal(),{data:s,navigate:l,setModalData:c}=Zn(),d=s?.funding,u=n.useRef(0);return n.useEffect((()=>{let n=setInterval((async()=>{if(e)try{let[r]=await async function(e,t){return re.ofetch(`https://api.moonpay.com/v1/transactions/ext/${e}`,{query:{apiKey:t?"pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI":"pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL"}})}(e,t),a="waitingAuthorization"===r.status&&"credit_debit_card"===r.paymentMethod?"pending":r.status;if(["failed","completed","awaitingAuthorization"].includes(a)&&(o({eventName:Wc,payload:{status:a,provider:Np,paymentMethod:r.paymentMethod,cardPaymentType:r.cardPaymentType,currency:r.currency?.code,baseCurrencyAmount:r.baseCurrencyAmount,quoteCurrencyAmount:r.quoteCurrencyAmount,feeAmount:r.feeAmount,extraFeeAmount:r.extraFeeAmount,networkFeeAmount:r.networkFeeAmount,isSandbox:t}}),clearInterval(n)),"failed"===a||"serviceFailure"===a)return c({funding:{...d,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:s?.solanaFundingData}),void l(Vp);i(a)}catch(e){404!==e.response?.status&&(u.current+=1),u.current>=3&&(o({eventName:Wc,payload:{status:"serviceFailure",provider:Np}}),clearInterval(n),c({funding:{...d,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:s?.solanaFundingData}),l(Vp))}}),3e3);return()=>clearInterval(n)}),[e,u]),a}const Fp=({size:t=61,...n})=>/*#__PURE__*/e.jsx("svg",{width:t,height:t,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:/*#__PURE__*/e.jsxs("g",{id:"moonpay_symbol_wht 2",children:[/*#__PURE__*/e.jsx("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),/*#__PURE__*/e.jsx("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});const Lp={component:()=>{let{app:t,data:n,setModalData:a,navigateBack:i}=Zn(),{closePrivyModal:o}=r.usePrivyInternal(),{externalTransactionId:s}=n?.moonpayStatus,l=Mp(s||null,t.fundingMethodConfig.moonpay.useSandbox??!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{title:"Fund account",backFn:()=>{let e={...n?.funding,showAlternateFundingMethod:!0};e.usingDefaultFundingMethod&&(e.usingDefaultFundingMethod=!1),a({funding:e,solanaFundingData:n?.solanaFundingData}),i()}}),/*#__PURE__*/e.jsx(Wp,{status:l,onClickCta:o}),/*#__PURE__*/e.jsx(xr,{})]})}};let Wp=({status:t,onClickCta:r})=>{let{title:a,body:i,cta:o}=n.useMemo((()=>(e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}})(t)),[t]);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(Op,{children:[/*#__PURE__*/e.jsx(Dp,{status:t}),/*#__PURE__*/e.jsxs(Qa,{children:[/*#__PURE__*/e.jsx("h3",{children:a}),/*#__PURE__*/e.jsx(Rp,{children:i})]})]}),o&&/*#__PURE__*/e.jsx(Pr,{onClick:r,children:o})]})},Dp=({status:t})=>{if(!t||"pending"===t){let t="var(--privy-color-foreground-4)";/*#__PURE__*/return e.jsxs("div",{style:{position:"relative"},children:[/*#__PURE__*/e.jsx(kr,{color:t,style:{position:"absolute"}}),/*#__PURE__*/e.jsx(Tr,{color:t}),/*#__PURE__*/e.jsx(Fp,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let n=(t=>{switch(t){case"completed":return Ie.default;case"waitingAuthorization":return()=>/*#__PURE__*/e.jsx(Be.default,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}})(t),r=(e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)")(t);/*#__PURE__*/return e.jsx("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:n&&/*#__PURE__*/e.jsx(n,{width:"4rem",height:"4rem",color:r})})},Rp=/*#__PURE__*/i.styled.p.withConfig({displayName:"StatusBody",componentId:"sc-75e2a891-0"})(["font-size:1rem;color:var(--privy-color-foreground-3);margin-bottom:1rem;display:flex;flex-direction:column;gap:1rem;"]),Op=/*#__PURE__*/i.styled.div.withConfig({displayName:"ConnectContainer",componentId:"sc-75e2a891-1"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin-left:1.75rem;margin-right:1.75rem;padding:2rem 0;"]);const Bp=async(e,t,n,r,a,i,o,s)=>{let c=Ri();if(!c)throw Error("Unable to initialize flow");let d="ethereum"===t.chainType?l.chainToMoonpayCurrency(t.chain.id,r):t.isUSDC?"USDC_SOL":"SOL",{signedUrl:u,externalTransactionId:p}=await e.signMoonpayOnRampUrl({address:t.address,useSandbox:n.fundingMethodConfig.moonpay.useSandbox??!1,config:{uiConfig:{accentColor:n.appearance.palette.accent,theme:n.appearance.palette.colorScheme},paymentMethod:s,currencyCode:d,quoteCurrencyAmount:_p(t.amount)}});e.createAnalyticsEvent({eventName:"sdk_fiat_on_ramp_started",payload:{provider:"moonpay",value:t.amount,chainType:t.chainType,chainId:"ethereum"===t.chainType?t.chain.id:t.chain}}),c.location=u;let h={...o?.funding,showAlternateFundingMethod:!0};t.usingDefaultFundingMethod&&(h.usingDefaultFundingMethod=!1),a({moonpayStatus:{},funding:h,solanaFundingData:o?.solanaFundingData}),i(Lp),setTimeout((()=>{a({moonpayStatus:{externalTransactionId:p},funding:h,solanaFundingData:o?.solanaFundingData})}),8e3)};let Up=async e=>"undefined"!=typeof window&&"PaymentRequest"in window&&await new window.PaymentRequest([{supportedMethods:e}],{id:"0",total:{label:"Item",amount:{currency:"USD",value:"1.00"}}}).canMakePayment();const zp=()=>Up("https://apple.com/apple-pay"),Hp=()=>Up("https://google.com/pay"),Vp={component:()=>{let{wallets:t}=Ni(),{connectors:a}=r.usePrivyInternal(),i=a.filter(Sn).flatMap((e=>e.wallets)),{navigate:o,data:s,setModalData:c}=Zn(),{client:d}=r.usePrivyInternal(),u=Gn(),p=s?.funding,h=fu(zp),g=fu(Hp),m="solana"===p.chainType,y=m?void 0:p,f=n.useMemo((()=>((e,t,n,r,a,i)=>{let o,s,c="solana"===n.chainType,d=c?void 0:n,u=n.isUSDC?"USDC":d?.erc20Address?void 0:"native-currency",p=!!c||u&&l.isSupportedChainIdForMoonpay(Number(n.chain.id),u),h=!!c||u&&l.isSupportedChainIdForCoinbaseOnramp(Number(n.chain.id),u),g=[];for(let o of(n.preferredCardProvider&&n.supportedOptions.sort((e=>e.provider===n.preferredCardProvider?-1:1)),n.supportedOptions))"card"===o.method&&"coinbase"===o.provider&&h&&g.push((()=>Pp(t,n,r,a,i,"buy"))),"card"===o.method&&"moonpay"===o.provider&&p&&u&&g.push((()=>Bp(t,n,e,u,r,a,i,"credit_debit_card")));for(let e of n.supportedOptions)"exchange"===e.method&&"coinbase"===e.provider&&h&&(o=()=>Pp(t,n,r,a,i,"buy"));for(let e of i?.funding?.supportedOptions??[])"wallets"===e.method&&(s=()=>a(bp));return{onFundWithCard:g,onFundWithExchange:o,onFundWithWallet:s}})(u,d,p,c,o,s)),[u,d,p,s,c,o]),x=m?i.find((({address:e})=>e===p.address)):t.find((({address:e})=>H.getAddress(e)===H.getAddress(p.address))),v=Nn(x?.walletClientType||"unknown"),w=v?.name||"wallet",C=x&&"privy"!==x.walletClientType?w:u.name,b=n.useMemo((()=>p.uiConfig?.landing?.title?p.uiConfig?.landing?.title:`Add funds to your ${C?.toLowerCase().endsWith("wallet")?C:C+" wallet"}`),[p.uiConfig?.landing?.title,C]);n.useEffect((()=>{if(p?.defaultFundingMethod&&p.usingDefaultFundingMethod)switch(c({funding:{...p,usingDefaultFundingMethod:!1},solanaFundingData:s?.solanaFundingData}),p?.defaultFundingMethod){case"card":f.onFundWithCard[0]&&f.onFundWithCard[0]();break;case"exchange":f.onFundWithExchange&&f.onFundWithExchange();break;case"wallet":f.onFundWithWallet&&f.onFundWithWallet();break;case"manual":o(zc)}}),[]),n.useEffect((()=>{y?.erc20Address&&!y.erc20ContractInfo&&$c({address:y.erc20Address,chain:y.chain,rpcConfig:u.rpcConfig,privyAppId:u.id}).then((e=>{c({...s,funding:{...y,erc20ContractInfo:e?{symbol:e.symbol,decimals:e.decimals}:void 0}})})).catch(console.error)}),[y?.erc20Address,y?.chain]);let j=!(!y?.erc20Address||y?.erc20ContractInfo);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(gu,{}),/*#__PURE__*/e.jsx("h3",{children:b}),/*#__PURE__*/e.jsxs(ap,{children:[p.errorMessage&&/*#__PURE__*/e.jsx(gd,{theme:u.appearance.palette.colorScheme,children:p.errorMessage}),f.onFundWithCard?.[0]&&/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:f.onFundWithCard[0],children:[/*#__PURE__*/e.jsx(ip,{children:/*#__PURE__*/e.jsx(Re.default,{style:{width:24}})}),"Pay with card",h?/*#__PURE__*/e.jsx(mu,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):g?/*#__PURE__*/e.jsx(yu,{style:{marginLeft:"auto",maxWidth:"100%",width:"auto",height:"0.875rem"}}):null]}),f.onFundWithExchange&&/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:f.onFundWithExchange,children:[/*#__PURE__*/e.jsx(ip,{children:/*#__PURE__*/e.jsx(Be.default,{style:{width:24}})}),"Transfer from an exchange"]}),f.onFundWithWallet&&/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:f.onFundWithWallet,children:[/*#__PURE__*/e.jsx(ip,{children:/*#__PURE__*/e.jsx(Tl,{style:{width:24}})}),"Transfer from wallet"]}),/*#__PURE__*/e.jsxs(dr,{disabled:j,onClick:()=>o(zc),children:[/*#__PURE__*/e.jsx(ip,{children:/*#__PURE__*/e.jsx(Oe.default,{style:{width:24}})}),"Receive funds"]}),p?.showAlternateFundingMethod&&f.onFundWithCard?.[1]&&/*#__PURE__*/e.jsx(vc,{theme:u.appearance.palette.colorScheme,children:/*#__PURE__*/e.jsxs(pp,{children:["Having trouble or facing location restrictions?"," ",/*#__PURE__*/e.jsx(hp,{onClick:f.onFundWithCard[1],children:"Try a different provider."})]})})]}),/*#__PURE__*/e.jsx(xr,{})]})}},$p={component:()=>{let{closePrivyModal:t}=r.usePrivyInternal(),{app:a,data:i,navigate:o}=Zn(),s=rr(),l=i?.externalConnectWallet?.description,d=n.useRef(i?.externalConnectWallet?.walletList??a.appearance.walletList),u=n.useRef(i?.externalConnectWallet?.walletChainType??a.appearance.walletChainType);/*#__PURE__*/return e.jsx(Hl,{walletList:d.current,walletChainType:u.current,preSelectedWalletId:i?.externalConnectWallet?.preSelectedWalletId,onBack:i?.funding?()=>o(Vp):void 0,onClose:()=>{s("connectWallet","onError",c.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR),t()},onConnect:({connector:e,wallet:n})=>{s("connectWallet","onSuccess",{wallet:n});let r=i?.externalConnectWallet?.onCompleteNavigateTo;r?o(r({address:n.address,walletClientType:e?.walletClientType,walletChainType:e?.chainType})):t()},onConnectError:e=>{e instanceof c.PrivyError?(console.warn(e.cause?e.cause:e.message),s("connectWallet","onError",e.privyErrorCode||c.PrivyErrorCode.GENERIC_CONNECT_WALLET_ERROR)):(console.warn(e),s("connectWallet","onError",c.PrivyErrorCode.UNKNOWN_CONNECT_WALLET_ERROR))},customDescription:l,app:a})},isUnauthenticatedScreem:!0},qp=t=>/*#__PURE__*/e.jsxs("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[/*#__PURE__*/e.jsx("rect",{x:"0.5",width:"32",height:"32",rx:"4",fill:"#855DCD"}),/*#__PURE__*/e.jsxs("g",{"clip-path":"url(#clip0_1715_1960)",children:[/*#__PURE__*/e.jsx("path",{d:"M4.5 4H28.5V28H4.5V4Z",fill:"#855DCD"}),/*#__PURE__*/e.jsx("path",{d:"M11.1072 8.42105H21.6983V23.5789H20.1437V16.6357H20.1284C19.9566 14.7167 18.3542 13.2129 16.4028 13.2129C14.4514 13.2129 12.849 14.7167 12.6771 16.6357H12.6619V23.5789H11.1072V8.42105Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M8.28943 10.5725L8.92101 12.7239H9.45542V21.4275C9.1871 21.4275 8.96959 21.6464 8.96959 21.9165V22.5032H8.87242C8.60411 22.5032 8.38659 22.7221 8.38659 22.9922V23.5789H13.8279V22.9922C13.8279 22.7221 13.6104 22.5032 13.3421 22.5032H13.2449V21.9165C13.2449 21.6464 13.0274 21.4275 12.7591 21.4275H12.1761V10.5725H8.28943Z",fill:"white"}),/*#__PURE__*/e.jsx("path",{d:"M20.2408 21.4275C19.9725 21.4275 19.755 21.6464 19.755 21.9165V22.5032H19.6579C19.3895 22.5032 19.172 22.7221 19.172 22.9922V23.5789H24.6133V22.9922C24.6133 22.7221 24.3958 22.5032 24.1275 22.5032H24.0303V21.9165C24.0303 21.6464 23.8128 21.4275 23.5445 21.4275V12.7239H24.0789L24.7105 10.5725H20.8238V21.4275H20.2408Z",fill:"white"})]}),/*#__PURE__*/e.jsx("defs",{children:/*#__PURE__*/e.jsx("clipPath",{id:"clip0_1715_1960",children:/*#__PURE__*/e.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(4.5 4)"})})})]}),Gp=t=>{let[r,a]=n.useState(!1);/*#__PURE__*/return e.jsx(Yp,{color:t.color,href:t.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{a(!0),setTimeout((()=>a(!1)),1500)},justOpened:r,children:t.text})};let Yp=/*#__PURE__*/i.styled.a.withConfig({displayName:"StyledOpenLinkButton",componentId:"sc-4e695c83-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(e=>e.justOpened?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"),(e=>e.justOpened?"medium":"normal"),(e=>e.justOpened?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)")),Zp=/*#__PURE__*/i.styled.div.withConfig({displayName:"Container",componentId:"sc-913deead-0"})(["width:100%;"]),Kp=/*#__PURE__*/i.styled.div.withConfig({displayName:"InputContainer",componentId:"sc-913deead-1"})(["display:flex;align-items:center;justify-content:space-between;gap:0.75rem;padding:0.75rem;height:56px;background:",";border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);&:hover{border-color:",";}"],(e=>e.$disabled?"var(--privy-color-background-2)":"var(--privy-color-background)"),(e=>e.$disabled?"var(--privy-color-foreground-4)":"var(--privy-color-foreground-3)")),Qp=/*#__PURE__*/i.styled.div.withConfig({displayName:"TextContainer",componentId:"sc-913deead-2"})(["flex:1;min-width:0;display:flex;align-items:center;"]),Xp=/*#__PURE__*/i.styled.span.withConfig({displayName:"Text",componentId:"sc-913deead-3"})(["display:block;font-size:16px;line-height:24px;color:",";overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;word-break:break-all;@media (min-width:441px){font-size:14px;line-height:20px;}"],(e=>e.$disabled?"var(--privy-color-foreground-2)":"var(--privy-color-foreground)")),Jp=/*#__PURE__*/i.styled(Xp).withConfig({displayName:"PlaceholderText",componentId:"sc-913deead-4"})(["color:var(--privy-color-foreground-3);font-style:italic;"]),eh=/*#__PURE__*/i.styled(kc).withConfig({displayName:"TitleLabel",componentId:"sc-913deead-5"})(["margin-bottom:0.5rem;"]),th=/*#__PURE__*/i.styled(Fr).withConfig({displayName:"CopyButton",componentId:"sc-913deead-6"})(["&&{gap:0.375rem;font-size:14px;flex-shrink:0;}"]);const nh=({value:r,title:a,placeholder:i,className:o,showCopyButton:s=!0,truncate:l,maxLength:c=40,disabled:d=!1})=>{let[u,p]=n.useState(!1),h=l&&r?((e,t,n)=>{if((e=e.startsWith("https://")?e.slice(8):e).length<=n)return e;if("middle"===t){let t=Math.ceil(n/2)-2,r=Math.floor(n/2)-1;return`${e.slice(0,t)}...${e.slice(-r)}`}return`${e.slice(0,n-3)}...`})(r,l,c):r;return n.useEffect((()=>{if(u){let e=setTimeout((()=>p(!1)),3e3);return()=>clearTimeout(e)}}),[u]),/*#__PURE__*/e.jsxs(Zp,{className:o,children:[a&&/*#__PURE__*/e.jsx(eh,{children:a}),/*#__PURE__*/e.jsxs(Kp,{$disabled:d,children:[/*#__PURE__*/e.jsx(Qp,{children:r?/*#__PURE__*/e.jsx(Xp,{$disabled:d,title:r,children:h}):/*#__PURE__*/e.jsx(Jp,{$disabled:d,children:i||"No value"})}),s&&r&&/*#__PURE__*/e.jsx(th,{onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(r).then((()=>p(!0))).catch(console.error)},size:"sm",children:u?/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copied",/*#__PURE__*/e.jsx(t.Check,{size:14})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy",/*#__PURE__*/e.jsx(t.Copy,{size:14})]})})]})]})},rh=({connectUri:t,loading:n,success:r,errorMessage:a,onBack:i,onClose:o,onOpenFarcaster:s})=>x.isMobile||n?x.isIOS?/*#__PURE__*/e.jsx(ba,{title:a?a.message:"Sign in with Farcaster",subtitle:a?a.detail:"To sign in with Farcaster, please open the Farcaster app.",icon:qp,iconVariant:"loading",iconLoadingStatus:{success:r,fail:!!a},primaryCta:t&&s?{label:"Open Farcaster app",onClick:s}:void 0,onBack:i,onClose:o,watermark:!0}):/*#__PURE__*/e.jsx(ba,{title:a?a.message:"Signing in with Farcaster",subtitle:a?a.detail:"This should only take a moment",icon:qp,iconVariant:"loading",iconLoadingStatus:{success:r,fail:!!a},onBack:i,onClose:o,watermark:!0,children:t&&x.isMobile&&/*#__PURE__*/e.jsx(ih,{children:/*#__PURE__*/e.jsx(Gp,{text:"Take me to Farcaster",url:t,color:"#8a63d2"})})}):
25
25
  /*#__PURE__*/e.jsx(ba,{title:"Sign in with Farcaster",subtitle:"Scan with your phone's camera to continue.",onBack:i,onClose:o,watermark:!0,children:/*#__PURE__*/e.jsxs(oh,{children:[/*#__PURE__*/e.jsx(sh,{children:t?/*#__PURE__*/e.jsx(vl,{url:t,size:275,squareLogoElement:qp}):/*#__PURE__*/e.jsx(dh,{children:/*#__PURE__*/e.jsx(kr,{})})}),/*#__PURE__*/e.jsxs(lh,{children:[/*#__PURE__*/e.jsx(ch,{children:"Or copy this link and paste it into a phone browser to open the Farcaster app."}),t&&/*#__PURE__*/e.jsx(nh,{value:t,truncate:"end",maxLength:30,showCopyButton:!0,disabled:!0})]})]})}),ah={component:()=>{let{authenticated:t,logout:i,ready:o,user:s}=a.usePrivyContext(),{lastScreen:l,navigate:d,navigateBack:u,setModalData:p,app:h}=Zn(),{getAuthFlow:g,loginWithFarcaster:m,closePrivyModal:y,createAnalyticsEvent:f}=r.usePrivyInternal(),[x,v]=n.useState(void 0),[w,C]=n.useState(!1),[b,j]=n.useState(!1),k=n.useRef([]),T=g(),A=T?.meta.connectUri;return n.useEffect((()=>{let e=Date.now(),t=setInterval((async()=>{let n=await T.pollForReady.execute(),r=Date.now()-e;if(n){clearInterval(t),C(!0);try{await m(),j(!0)}catch(e){let t={retryable:!1,message:"Authentication failed"};if(e?.privyErrorCode===c.PrivyErrorCode.ALLOWLIST_REJECTED)return void d(rc);if(e?.privyErrorCode===c.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new c.PrivyUserLimitReachedError(e).toString()),void d(hc);if(e?.privyErrorCode===c.PrivyErrorCode.USER_DOES_NOT_EXIST)return void d(vs);if(e?.privyErrorCode===c.PrivyErrorCode.LINKED_TO_ANOTHER_USER)t.detail=e.message??"This account has already been linked to another user.";else{if(e?.privyErrorCode===c.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return p({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,displayName:e.data?.data?.account?.displayName,linkMethod:"farcaster",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress,farcasterEmbeddedAddress:e.data?.data?.otherUser?.farcasterEmbeddedAddress}}),void d(Qs);e?.privyErrorCode===c.PrivyErrorCode.INVALID_CREDENTIALS?(t.retryable=!0,t.detail="Something went wrong. Try again."):e?.privyErrorCode===c.PrivyErrorCode.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again.")}v(t)}}else r>12e4&&(clearInterval(t),v({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))}),2e3);return()=>{clearInterval(t),k.current.forEach((e=>clearTimeout(e)))}}),[]),n.useEffect((()=>{if(o&&t&&b&&s){if(h?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{d(nl)}),rt);return()=>clearTimeout(e)}b&&(fs(s,h.embeddedWallets)?k.current.push(setTimeout((()=>{p({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"FarcasterConnectStatusScreen"}}),i()},callAuthOnSuccessOnClose:!0}}),d(tl)}),rt)):k.current.push(setTimeout((()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0})),rt)))}}),[b,o,t,s]),/*#__PURE__*/e.jsx(rh,{connectUri:A,loading:w,success:b,errorMessage:x,onBack:l?u:void 0,onClose:y,onOpenFarcaster:()=>{A&&(window.location.href=A)}})}};let ih=/*#__PURE__*/i.styled.div.withConfig({displayName:"MobileLinkContainer",componentId:"sc-8d74ecf6-0"})(["margin-top:24px;"]),oh=/*#__PURE__*/i.styled.div.withConfig({displayName:"ContentContainer",componentId:"sc-8d74ecf6-1"})(["display:flex;flex-direction:column;align-items:center;gap:24px;"]),sh=/*#__PURE__*/i.styled.div.withConfig({displayName:"QrContainer",componentId:"sc-8d74ecf6-2"})(["display:flex;align-items:center;justify-content:center;min-height:275px;"]),lh=/*#__PURE__*/i.styled.div.withConfig({displayName:"InstructionsContainer",componentId:"sc-8d74ecf6-3"})(["display:flex;flex-direction:column;align-items:center;gap:16px;"]),ch=/*#__PURE__*/i.styled.div.withConfig({displayName:"InstructionText",componentId:"sc-8d74ecf6-4"})(["font-size:0.875rem;text-align:center;color:var(--privy-color-foreground-2);"]),dh=/*#__PURE__*/i.styled.div.withConfig({displayName:"LoaderWrapper",componentId:"sc-8d74ecf6-5"})(["position:relative;width:82px;height:82px;"]);const uh=()=>{let[t,a]=n.useState(!1),{currentScreen:i,navigate:o,setModalData:s,data:l}=Zn(),{enabled:c,token:d}=qt(),{initLoginWithFarcaster:u}=r.usePrivyInternal(),{accountType:p}=is();/*#__PURE__*/return e.jsxs(dr,{onClick:async()=>{a(!0);try{c&&!d?(s({captchaModalData:{callback:e=>u(e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:ah,onErrorNavigateTo:Rs}}),o(ic)):(await u(d,l?.login?.disableSignup),o(ah))}catch(e){s({errorModalData:{error:e,previousScreen:i||cg}}),o(Rs)}finally{a(!1)}},disabled:!1,children:[/*#__PURE__*/e.jsx(qp,{width:32,height:32})," Farcaster",t&&/*#__PURE__*/e.jsx(Ar,{}),"farcaster"===p&&/*#__PURE__*/e.jsx(ph,{color:"gray",children:"Recent"})]})};let ph=/*#__PURE__*/i.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-c6317ff9-0"})(["margin-left:auto;"]);const hh=({status:n,passkeySignupFlow:r=!1,error:a,onRetry:i})=>/*#__PURE__*/e.jsx(ba,{title:(()=>{switch(n){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}})(),subtitle:/*#__PURE__*/e.jsx(mh,{children:(()=>{switch(n){case"loading":return r?"Please follow prompts to register your passkey.":"Please follow prompts to verify your passkey.\nYou will have to sign up with another method first to register a passkey for your account.";case"success":return"You've successfully logged in with your passkey.";case"error":if(a instanceof c.PrivyError){if(a.privyErrorCode===c.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)return"Cannot link more passkeys to account.";if(a.privyErrorCode===c.PrivyErrorCode.PASSKEY_NOT_ALLOWED)return"Passkey request timed out or rejected by user.\nYou will have to sign up with another method first to register a passkey for your account."}return"An unknown error occurred.\nYou will have to sign up with another method first to register a passkey for your account."}})()}),icon:t.FingerprintIcon,iconVariant:"loading",iconLoadingStatus:{success:"success"===n,fail:"error"===n},primaryCta:"error"===n&&i?{label:"Retry",onClick:i}:"success"===n?{label:"Continue",disabled:!0}:void 0,watermark:!0}),gh={component:()=>{let{app:t,data:i,setModalData:o,navigate:s}=Zn(),{loginWithPasskey:l,signupWithPasskey:c,closePrivyModal:d,createAnalyticsEvent:u}=r.usePrivyInternal(),{user:p,logout:h}=a.usePrivyContext(),{passkeySignupFlow:g}=i?.passkeyAuthModalData??{},[m,y]=n.useState("loading"),[f,x]=n.useState(null),v=n.useRef([]),w=e=>{v.current=[e,...v.current]};n.useEffect((()=>()=>{v.current.forEach((e=>clearTimeout(e))),v.current=[]}),[]);let C=async()=>{y("loading");try{g?await c():await l(),y("success")}catch(e){x(e),y("error")}};return n.useEffect((()=>{if("success"===m&&p){if(t?.legal.requireUsersAcceptTerms&&!p.hasAcceptedTerms)return void w(setTimeout((()=>{s(nl)}),900));if(!fs(p,t?.embeddedWallets))return void w(setTimeout((()=>{d({shouldCallAuthOnSuccess:!0,isSuccess:!0})}),rt));w(setTimeout((()=>{o({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),u({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"PasskeyStatusScreen"}}),h()},callAuthOnSuccessOnClose:!0}}),s(tl)}),900))}}),[p,m]),n.useEffect((()=>{C()}),[]),/*#__PURE__*/e.jsx(hh,{status:m,passkeySignupFlow:g,error:f,onRetry:C})}};let mh=/*#__PURE__*/i.styled.span.withConfig({displayName:"SubtitleText",componentId:"sc-ad4f7fb3-0"})(["white-space:pre-wrap;"]);const yh=({title:n="Log in or create a new account?",subtitle:r="Create a new account with a passkey or use a passkey to log in to an existing account.",onSignup:a,onLogin:i})=>/*#__PURE__*/e.jsx(ba,{title:n,subtitle:r,icon:t.FingerprintIcon,primaryCta:{label:"Create new account",onClick:a},secondaryCta:{label:"Log in with a passkey",onClick:i},watermark:!0}),fh={component:()=>{let{enabled:t,token:n}=qt(),{navigate:a,setModalData:i}=Zn(),{initSignupWithPasskey:o,initLoginWithPasskey:s}=r.usePrivyInternal();/*#__PURE__*/return e.jsx(yh,{onSignup:async()=>{t&&!n?(i({passkeyAuthModalData:{passkeySignupFlow:!0},captchaModalData:{callback:e=>o({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:gh,onErrorNavigateTo:Rs}}),a(ic)):(await o({withPrivyUi:!0}),i({passkeyAuthModalData:{passkeySignupFlow:!0}}),a(gh))},onLogin:async()=>{t&&!n?(i({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>s({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:gh,onErrorNavigateTo:Rs}}),a(ic)):(await s({withPrivyUi:!0}),i({passkeyAuthModalData:{passkeySignupFlow:!1}}),a(gh))}})}},xh=()=>{let{enabled:t,token:a}=qt(),{navigate:i,setModalData:o,app:s,data:l}=Zn(),{initLoginWithPasskey:c}=r.usePrivyInternal(),d=()=>{s.loginConfig.passkeysForSignupEnabled?i(fh):(async()=>{t&&!a?(o({passkeyAuthModalData:{passkeySignupFlow:!1},captchaModalData:{callback:e=>c({captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:gh,onErrorNavigateTo:Rs}}),i(ic)):(await c({withPrivyUi:!0}),o({passkeyAuthModalData:{passkeySignupFlow:!1}}),i(gh))})()};return 0===n.useMemo((()=>{let e=l?.login?.loginMethods;return e?e.filter((e=>"passkey"!==e)).length:Object.entries(s.loginMethods).filter((([e,t])=>t)).filter((([e])=>"passkey"!==e)).length}),[s.loginMethods,l?.login])?/*#__PURE__*/e.jsxs(dr,{onClick:d,children:[/*#__PURE__*/e.jsx(qe.default,{})," Continue with passkey"]}):/*#__PURE__*/e.jsx(ps,{as:"button",onClick:d,size:"sm",variant:"navigation",style:{width:"100%",justifyContent:"center"},children:"I have a passkey"})},vh=({value:t,onChange:n})=>/*#__PURE__*/e.jsx("select",{value:t,onChange:n,children:l.countryCodesAndNumbers.map((t=>/*#__PURE__*/e.jsxs("option",{value:t.code,children:[t.code," +",t.callCode]},t.code)))}),wh=/*#__PURE__*/n.forwardRef(((t,r)=>{let{app:a}=Zn(),[i,o]=n.useState(!1),{accountType:s}=is(),[c,d]=n.useState(""),[u,p]=n.useState(a?.intl.defaultCountry??"US"),h=l.validatePhoneNumber(c,u),g=l.phoneNumberTypingFormatter(u),m=l.getPlaceholderPhoneNumber(u),y=l.getCountryCallingCode(u),f=!h,[x,v]=n.useState(!1),w=y.length,C=e=>{let n=e.target.value;p(n),d(""),t.onChange&&t.onChange({rawPhoneNumber:c,qualifiedPhoneNumber:l.formatPhoneNumber(c,n),countryCode:n,isValid:l.validatePhoneNumber(c,u)})},b=(e,n)=>{try{let r=e.replace(/\D/g,"")===c.replace(/\D/g,"")?e:g.input(e);d(r),t.onChange&&t.onChange({rawPhoneNumber:r,qualifiedPhoneNumber:l.formatPhoneNumber(e,n),countryCode:n,isValid:l.validatePhoneNumber(e,n)})}catch(e){console.error("Error processing phone number:",e)}},j=()=>{v(!0);let e=l.formatPhoneNumber(c,u);t.onSubmit({rawPhoneNumber:c,qualifiedPhoneNumber:e,countryCode:u,isValid:l.validatePhoneNumber(c,u)}).finally((()=>v(!1)))};return n.useEffect((()=>{if(t.defaultValue){let e=l.getPhoneCountryCodeAndNumber(t.defaultValue);g.reset(),C({target:{value:e.countryCode}}),b(e.phone,e.countryCode)}}),[t.defaultValue]),/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Ch,{children:/*#__PURE__*/e.jsxs(bh,{$callingCodeLength:w,$stacked:t.stacked,children:[/*#__PURE__*/e.jsx(vh,{value:u,onChange:C}),/*#__PURE__*/e.jsx("input",{ref:r,id:"phone-number-input",className:"login-method-button",type:"tel",placeholder:m,onFocus:()=>o(!0),onChange:e=>{b(e.target.value,u)},onKeyUp:e=>{"Enter"===e.key&&j()},value:c,autoComplete:"tel"}),"phone"!==s||i||t.hideRecent?t.stacked||t.noIncludeSubmitButton?/*#__PURE__*/e.jsx("span",{}):/*#__PURE__*/e.jsx(Rr,{isSubmitting:x,onClick:j,disabled:f,children:"Submit"}):/*#__PURE__*/e.jsx(xu,{color:"gray",children:"Recent"})]})}),t.stacked&&!t.noIncludeSubmitButton?/*#__PURE__*/e.jsx(Pr,{loading:x,loadingText:null,onClick:j,disabled:f,children:"Submit"}):null]})}));let Ch=/*#__PURE__*/i.styled.div.withConfig({displayName:"InputContainer",componentId:"sc-f29a1304-0"})(["width:100%;"]),bh=/*#__PURE__*/i.styled.label.withConfig({displayName:"PhoneNumberInput",componentId:"sc-f29a1304-1"})(["--country-code-dropdown-width:calc(54px + calc(12 * ","px));--phone-input-extra-padding-left:calc(12px + calc(3 * ","px));display:block;position:relative;width:100%;@media (min-width:441px){--country-code-dropdown-width:calc(52px + calc(10 * ","px));}&& > select{font-size:16px;height:24px;position:absolute;margin:13px calc(var(--country-code-dropdown-width) / 4);line-height:24px;width:var(--country-code-dropdown-width);background-color:var(--privy-color-background);background-size:auto;background-position-x:right;cursor:pointer;@media (min-width:441px){font-size:14px;width:var(--country-code-dropdown-width);}:focus{outline:none;box-shadow:none;}}&& > input{font-size:16px;line-height:24px;color:var(--privy-color-foreground);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;width:calc(100% - var(--country-code-dropdown-width));padding:12px 88px 12px calc(var(--country-code-dropdown-width) + var(--phone-input-extra-padding-left));padding-right:",";flex-grow:1;background:var(--privy-color-background);border:1px solid var(--privy-color-foreground-4);border-radius:var(--privy-border-radius-md);width:100%;:focus{outline:none;border-color:var(--privy-color-accent);}:autofill,:-webkit-autofill{background:var(--privy-color-background);}@media (min-width:441px){font-size:14px;padding-right:78px;}}&& > :last-child{right:16px;position:absolute;top:50%;transform:translate(0,-50%);}&& > button:last-child{right:0px;line-height:24px;padding:13px 17px;:focus{outline:none;border-color:var(--privy-color-accent);}}&& > input::placeholder{color:var(--privy-color-foreground-3);}"],(e=>e.$callingCodeLength),(e=>e.$callingCodeLength),(e=>e.$callingCodeLength),(e=>e.$stacked?"16px":"88px"));const jh=({isEditable:i,setIsEditable:o,defaultValue:s})=>{let l=n.useRef(null),{authenticated:c}=a.usePrivyContext(),{navigate:d,setModalData:u,currentScreen:p,data:h}=Zn(),{initLoginWithSms:g}=r.usePrivyInternal(),{enabled:m,token:y}=qt(),{whatsAppEnabled:f}=Gn();/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(pr,{$if:!i,children:/*#__PURE__*/e.jsx(wh,{ref:l,onSubmit:async function({qualifiedPhoneNumber:e}){if(!m||y||c)try{await g({phoneNumber:e,captchaToken:y,withPrivyUi:!0,disableSignup:h?.login?.disableSignup}),d(Yh)}catch(e){u({errorModalData:{error:e,previousScreen:p||cg}}),d(Rs)}else u({captchaModalData:{callback:t=>g({phoneNumber:e,captchaToken:t,withPrivyUi:!0,disableSignup:h?.login?.disableSignup}),userIntentRequired:!1,onSuccessNavigateTo:Yh,onErrorNavigateTo:Rs}}),d(ic)},defaultValue:s})}),/*#__PURE__*/e.jsx(pr,{$if:i,children:/*#__PURE__*/e.jsxs(dr,{onClick:()=>{o(),setTimeout((()=>{l.current?.focus()}),0)},children:[/*#__PURE__*/e.jsx(ur,{children:/*#__PURE__*/e.jsx(t.Smartphone,{})}),"Continue with ",f?"WhatsApp":"SMS"]})})]})};let kh={apple:{logo:mt,displayName:"Apple"},discord:{logo:yt,displayName:"Discord"},github:{logo:ft,displayName:"GitHub"},google:{logo:xt,displayName:"Google"},linkedin:{logo:Ct,displayName:"LinkedIn"},spotify:{logo:bt,displayName:"Spotify"},instagram:{logo:vt,displayName:"Instagram"},twitter:{logo:kt,displayName:"Twitter"},tiktok:{logo:jt,displayName:"TikTok"},line:{logo:wt,displayName:"LINE"}};const Th=({provider:t})=>{let{enabled:a,token:i}=qt(),{navigate:o,setModalData:s,data:l}=Zn(),[c,d]=n.useState(!1),{initLoginWithOAuth:u}=r.usePrivyInternal(),{accountType:p}=is(),h=n.useMemo((()=>p&&"guest"!==p&&"authorization_key"!==p&&"cross_app"!==p?es(p):null),[p]),{displayName:g,logo:m}=kh[t];/*#__PURE__*/return e.jsxs(dr,{onClick:()=>{d(!0),setTimeout((()=>{d(!1)}),2e3),a&&!i?(s({captchaModalData:{callback:e=>u(t,e,l?.login?.disableSignup),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Rs}}),o(ic)):u(t,void 0,l?.login?.disableSignup)},disabled:c,children:[/*#__PURE__*/e.jsx(ur,{$fullSize:!0,children:/*#__PURE__*/e.jsx(m,{style:{width:"32px",height:"32px"}})}),g,h?.loginMethod===t&&/*#__PURE__*/e.jsx(Ah,{color:"gray",children:"Recent"})]})};let Ah=/*#__PURE__*/i.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-afd4ca87-0"})(["margin-left:auto;"]);function Sh(t){/*#__PURE__*/return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",...t,children:[/*#__PURE__*/e.jsx("rect",{width:"512",height:"512",rx:"15%",fill:"#37aee2"}),/*#__PURE__*/e.jsx("path",{fill:"#c8daea",d:"M199 404c-11 0-10-4-13-14l-32-105 245-144"}),/*#__PURE__*/e.jsx("path",{fill:"#a9c9dd",d:"M199 404c7 0 11-4 16-8l45-43-56-34"}),/*#__PURE__*/e.jsx("path",{fill:"#f6fbfe",d:"M204 319l135 99c14 9 26 4 30-14l55-258c5-22-9-32-24-25L79 245c-21 8-21 21-4 26l83 26 190-121c9-5 17-3 11 4"})]})}const Eh=({success:t,errorMessage:n,onRetry:r})=>{let a=t?"Successfully connected with Telegram":n?n.message:"Verifying connection to Telegram";/*#__PURE__*/return e.jsx(ba,{title:a,subtitle:t?"You're good to go!":n?n.detail:"Just a few moments more",icon:Sh,iconVariant:"loading",iconLoadingStatus:{success:t,fail:!!n},secondaryCta:n?.retryable&&r?{label:"Retry",onClick:r}:void 0,watermark:!0})},Ih={component:()=>{let{authenticated:t,logout:i,ready:o,user:s}=a.usePrivyContext(),{app:l,setModalData:d,navigate:u,resetNavigation:p,data:h}=Zn(),{initLoginWithTelegram:g,loginWithTelegram:m,updateWallets:y,setReadyToTrue:f,closePrivyModal:x,createAnalyticsEvent:v,getAuthMeta:w}=r.usePrivyInternal(),[C,b]=n.useState(!1),[j,k]=n.useState(void 0),T=qt();async function A(){try{let e=await async function(){let e;if(!t){if(T.enabled&&"error"===T.status)throw new $t(T.error,null,c.PrivyErrorCode.CAPTCHA_FAILURE);return T.enabled&&"success"!==T.status&&(T.execute(),e=await T.waitForResult()),e}}();await m({captchaToken:e}),b(!0),f(!0)}catch(e){if(e?.privyErrorCode===c.PrivyErrorCode.ALLOWLIST_REJECTED)return k(void 0),p(),void u(rc);if(e?.privyErrorCode===c.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new c.PrivyUserLimitReachedError(e).toString()),k(void 0),p(),void u(hc);if(e?.privyErrorCode===c.PrivyErrorCode.USER_DOES_NOT_EXIST)return k(void 0),p(),void u(vs);if(e?.privyErrorCode===c.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return k(void 0),p(),d({accountTransfer:{nonce:e.data?.data?.nonce,account:e.data?.data?.subject,telegramAuthResult:w()?.telegramAuthResult,telegramWebAppData:w()?.telegramWebAppData,displayName:e.data?.data?.account?.displayName,linkMethod:"telegram",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void u(Qs);let{retryable:t,detail:n}=Gt(e);k({retryable:t,detail:n,message:"Authentication failed"})}}n.useEffect((()=>{A()}),[]),n.useEffect((()=>{if(!(o&&t&&C&&s))return;if(l?.legal.requireUsersAcceptTerms&&!s.hasAcceptedTerms){let e=setTimeout((()=>{u(nl)}),rt);return()=>clearTimeout(e)}if(fs(s,l.embeddedWallets)){let e=setTimeout((()=>{d({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),v({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,provider:"telegram",screen:"TelegramAuthScreen"}}),i()},callAuthOnSuccessOnClose:!0}}),u(tl)}),rt);return()=>clearTimeout(e)}y();let e=setTimeout((()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0})),rt);return()=>clearTimeout(e)}),[o,t,C,s]);/*#__PURE__*/return e.jsx(Eh,{success:C,errorMessage:j,onRetry:j?.retryable?async()=>{try{k(void 0),h?.telegramAuthModalData?.seamlessAuth||await g(void 0,h?.login?.disableSignup),await A()}catch(e){let{retryable:t,detail:n}=Gt(e);k({retryable:t,detail:n,message:"Authentication failed"})}}:void 0})},isCaptchaRequired:!0},Ph=()=>{let{enabled:t,token:a}=qt(),{navigate:i,setModalData:o,data:s}=Zn(),[l,c]=n.useState(!1),{initLoginWithTelegram:d}=r.usePrivyInternal(),{accountType:u}=is();async function p(e){try{await d(e,s?.login?.disableSignup),o({telegramAuthModalData:{seamlessAuth:!1}}),i(Ih)}catch(e){console.error(e),c(!1)}}/*#__PURE__*/return e.jsxs(dr,{onClick:async function(){if(c(!0),t&&!a)return o({captchaModalData:{callback:p,userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:Rs}}),void i(ic);await p(a)},disabled:l,children:[/*#__PURE__*/e.jsx(Sh,{width:32,height:32}),"Telegram","telegram"===u&&/*#__PURE__*/e.jsx(Nh,{color:"gray",children:"Recent"})]})};let Nh=/*#__PURE__*/i.styled(xu).withConfig({displayName:"StyledChip",componentId:"sc-4b233cf1-0"})(["margin-left:auto;"]);const _h=({onClick:t,text:n,icon:r})=>/*#__PURE__*/e.jsxs(dr,{onClick:t,children:[/*#__PURE__*/e.jsx(ur,{children:r}),/*#__PURE__*/e.jsx(ar,{children:n})]}),Mh=({connectOnly:t})=>{let{closePrivyModal:a}=r.usePrivyInternal(),{data:i,setModalData:o,onUserCloseViaDialogOrKeybindRef:s,navigate:c}=Zn(),d=Gn(),u=i?.login,p=d.appearance.walletList,h=u?.walletChainType??d.appearance.walletChainType,{accountType:g,walletClientType:m,chainType:y}=is(),{wallets:f}=Bl({walletList:p,walletChainType:h}),x=n.useMemo((()=>g&&"guest"!==g&&"authorization_key"!==g&&"cross_app"!==g?es(g):null),[g]),{email:v,sms:w,google:C,twitter:b,discord:j,github:k,spotify:T,instagram:A,tiktok:S,line:E,linkedin:I,apple:P,wallet:N,farcaster:_,telegram:M}=n.useMemo((()=>u?.loginMethods?l.toObjectKeys(u.loginMethods,!0):null),[u])??d.loginMethods,{passkey:F}=d.loginMethods,L=[v&&"email",w&&"sms",C&&"google",b&&"twitter",j&&"discord",k&&"github",T&&"spotify",A&&"instagram",S&&"tiktok",E&&"line",I&&"linkedin",P&&"apple",_&&"farcaster",M&&"telegram"].filter((e=>!!e)),W=L.length>0,D=n.useMemo((()=>N&&!W?"web3-first":N&&d?.appearance.loginGroupPriority||"web2-first"),[N,W,d?.appearance.loginGroupPriority]),R=d?.appearance.hideDirectWeb2Inputs,[O,B]=n.useState("default"),[U,z]=n.useState(Oh({mostRecentlyUsedAccountType:g,smsAvailable:w,emailAvailable:v,prefilledType:u?.prefill?.type}));n.useEffect((()=>{z(Oh({mostRecentlyUsedAccountType:g,smsAvailable:w,emailAvailable:v,prefilledType:u?.prefill?.type}))}),[v,w,g]);let H=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{B("default")}),150)};s.current=H;let V=[];m&&N?V.push(m):x?.loginMethod&&L.includes(x.loginMethod)&&V.push(x.loginMethod);let $=n=>{if("email"===n)/*#__PURE__*/return e.jsx(ig,{isEditable:"email"===U,setIsEditable:()=>{z("email")},defaultValue:"email"===u?.prefill?.type?u.prefill.value:void 0},n);if("sms"===n)/*#__PURE__*/return e.jsx(jh,{isEditable:"sms"===U,setIsEditable:()=>{z("sms")},defaultValue:"phone"===u?.prefill?.type?u.prefill.value:void 0},n);if("apple"===n)/*#__PURE__*/return e.jsx(Th,{provider:"apple"},n);if("discord"===n)/*#__PURE__*/return e.jsx(Th,{provider:"discord"},n);if("farcaster"===n)/*#__PURE__*/return e.jsx(uh,{},n);if("github"===n)/*#__PURE__*/return e.jsx(Th,{provider:"github"},n);if("google"===n)/*#__PURE__*/return e.jsx(Th,{provider:"google"},n);if("linkedin"===n)/*#__PURE__*/return e.jsx(Th,{provider:"linkedin"},n);if("tiktok"===n)/*#__PURE__*/return e.jsx(Th,{provider:"tiktok"},n);if("line"===n)/*#__PURE__*/return e.jsx(Th,{provider:"line"},n);if("spotify"===n)/*#__PURE__*/return e.jsx(Th,{provider:"spotify"},n);if("instagram"===n)/*#__PURE__*/return e.jsx(Th,{provider:"instagram"},n);if("twitter"===n)/*#__PURE__*/return e.jsx(Th,{provider:"twitter"},n);if("telegram"===n)/*#__PURE__*/return e.jsx(Ph,{},n);let r=f.findIndex((({id:e})=>e===Sl.normalize(n))),a="solana"===y?"solana-only":"ethereum-only";/*#__PURE__*/return e.jsx(zl,{recent:!0,index:r,data:{wallets:f,walletChainType:a,handleWalletClick(e){o((t=>({...t,externalConnectWallet:{walletList:p,walletChainType:a,preSelectedWalletId:e.id}}))),c(t?$p:xc)}}})},q=f.filter((e=>e.id!==Sl.normalize(m||""))),G=q.map(((n,r)=>/*#__PURE__*/e.jsx(zl,{index:r,data:{walletChainType:h,wallets:q,handleWalletClick(e){o((t=>({...t,externalConnectWallet:{walletList:p,walletChainType:h,preSelectedWalletId:e.id}}))),c(t?$p:xc)}}},n.id))),Y=L.filter((e=>e!==x?.loginMethod)).flatMap($),Z=V.flatMap($);"web3-first"===D&&"default"===O?G.unshift(...Z):"web2-first"===D&&Y.unshift(...Z);let K="web2-overflow"===O?()=>B("default"):void 0,Q=L.filter((e=>"email"!==e&&"sms"!==e)),X=Wh({priority:D,email:v,sms:w,social:Q}),J=Dh({priority:D,email:v,sms:w,social:Q}),ee=/*#__PURE__*/e.jsx(wu,{text:Rh({priority:D}),onClick:()=>{o({...i,externalConnectWallet:{walletChainType:u?.walletChainType??d.appearance.walletChainType}}),c(xc)}}),te=/*#__PURE__*/e.jsx(_h,{text:X,icon:J,onClick:()=>B("web2-overflow")}),ne=R?0:1,re=N&&G.length>0,ae=0===Y.length&&N&&0===G.length,ie=5-(re?1:0),oe="default"===O&&d?.appearance.logo,se="default"===O&&d.appearance.loginMessage;/*#__PURE__*/return e.jsxs(ba,{title:d.appearance.landingHeader,icon:oe?/*#__PURE__*/e.jsx(os,{}):void 0,iconVariant:oe?"logo":void 0,onClose:H,showClose:!0,onBack:K,showBack:!!K,helpText:d||F&&"default"===O?/*#__PURE__*/e.jsxs(e.Fragment,{children:[F&&"default"===O&&/*#__PURE__*/e.jsx(xh,{}),d&&/*#__PURE__*/e.jsx(fr,{app:d})]}):void 0,watermark:!0,children:[se&&("string"==typeof d.appearance.loginMessage?/*#__PURE__*/e.jsx(Fh,{children:d.appearance.loginMessage}):/*#__PURE__*/e.jsx(Lh,{children:d.appearance.loginMessage})),/*#__PURE__*/e.jsx(sr,{$colorScheme:d.appearance.palette.colorScheme,children:"default"===O&&"web2-first"===D?/*#__PURE__*/e.jsxs(e.Fragment,{children:[Y.length>ie?Y.slice(0,ie-1):Y,Y.length>ie&&te,re&&ee,ae&&/*#__PURE__*/e.jsx(Cu,{chainType:d.appearance.walletChainType})]}):"default"===O&&"web3-first"===D?/*#__PURE__*/e.jsxs(e.Fragment,{children:[N&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[G.length>ie?G.slice(0,ie-1):G,G.length>ie&&ee]}),Y.length>ne&&te,Y.length===ne&&Y[0],ae&&/*#__PURE__*/e.jsx(Cu,{chainType:d.appearance.walletChainType})]}):"web2-overflow"===O?/*#__PURE__*/e.jsx(e.Fragment,{children:"web3-first"===D?Y:Y.slice(3)}):null})]})};let Fh=/*#__PURE__*/i.styled.div.withConfig({displayName:"StyledSubtitle",componentId:"sc-a0c826dc-0"})(["text-align:center;font-size:14px;margin-bottom:24px;"]),Lh=/*#__PURE__*/i.styled.div.withConfig({displayName:"MessageContainer",componentId:"sc-a0c826dc-1"})(["margin-bottom:24px;"]),Wh=({priority:e,email:t,sms:n,social:r})=>"web2-first"===e?"Other socials":t&&n&&r.length>0||t&&r.length>0?"Log in with email or socials":n&&r.length>0?"Log in with sms or socials":t&&n?"Continue with email or sms":t?"Continue with email":n?"Continue with sms":"Log in with a social account",Dh=({priority:n,email:r,sms:a,social:i})=>"web2-first"===n||i.length>0?/*#__PURE__*/e.jsx(t.UserCircle,{}):r&&a?/*#__PURE__*/e.jsx(Ql,{}):r?/*#__PURE__*/e.jsx(t.Mail,{}):a?/*#__PURE__*/e.jsx(t.Smartphone,{}):null,Rh=({priority:e})=>"web2-first"===e?"Continue with a wallet":"Other wallets";const Oh=({mostRecentlyUsedAccountType:e,smsAvailable:t,emailAvailable:n,prefilledType:r})=>n&&("email"===e&&"phone"!==r||"email"===r)||!t||"phone"!==e&&"phone"!==r?"email":"sms",Bh={component:()=>{let{app:t}=Zn();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/e.jsx(og,{connectOnly:!0}):/*#__PURE__*/e.jsx(Mh,{connectOnly:!0})}},Uh=({contactMethod:t,authFlow:r,appName:a="Privy",whatsAppEnabled:i=!1,onBack:o,onCodeSubmit:s,onResend:l,errorMessage:c,success:d=!1,resendCountdown:u=0,onInvalidInput:p,onClearError:h})=>{let[g,m]=n.useState(Hh);n.useEffect((()=>{c||m(Hh)}),[c]);let y="email"===r?/*#__PURE__*/e.jsxs("span",{children:["Please check ",/*#__PURE__*/e.jsx(eg,{children:t})," for an email from privy.io and enter your code below."]}):/*#__PURE__*/e.jsxs("span",{children:["Please check ",/*#__PURE__*/e.jsx(eg,{children:t})," for a",i?" WhatsApp":""," message from ",a," and enter your code below."]}),f=/*#__PURE__*/e.jsxs(Xh,{children:[/*#__PURE__*/e.jsxs("span",{children:["Didn't get ","email"===r?"an email":"a message","?"]}),u?/*#__PURE__*/e.jsxs(Jh,{children:[/*#__PURE__*/e.jsx(he.default,{color:"var(--privy-color-foreground)",strokeWidth:1.33,height:"12px",width:"12px"}),/*#__PURE__*/e.jsx("span",{children:"Code sent"})]}):/*#__PURE__*/e.jsx(ps,{as:"button",size:"sm",onClick:l,children:"Resend code"})]}),v=async e=>{e.preventDefault();let t=e.currentTarget.value.replace(" ","");if(""===t)return;if(isNaN(Number(t)))return void p?.("Code should be numeric");h?.();let n=Number(e.currentTarget.name?.charAt(5)),r=[...t||[""]].slice(0,zh-n),a=[...g.slice(0,n),...r,...g.slice(n+r.length)];m(a);let i=Math.min(Math.max(n+r.length,0),zh-1);if(!isNaN(Number(e.currentTarget.value))){let e=document.querySelector(`input[name=code-${i}]`);e?.focus()}if(a.every((e=>e&&!isNaN(+e)))){let e=document.querySelector(`input[name=code-${i}]`);e?.blur(),await(s?.(a.join("")))}};/*#__PURE__*/return e.jsx(ba,{title:"Enter confirmation code",subtitle:y,icon:"email"===r?ge.default:me.default,onBack:o,showBack:!0,helpText:f,children:/*#__PURE__*/e.jsx(Zh,{children:/*#__PURE__*/e.jsx(Ga,{children:/*#__PURE__*/e.jsxs(Kh,{children:[/*#__PURE__*/e.jsx("div",{children:g.map(((t,n)=>/*#__PURE__*/e.jsx("input",{name:`code-${n}`,type:"text",value:g[n],onChange:v,onKeyUp:e=>{"Backspace"===e.key&&(e=>{if(h?.(),m([...g.slice(0,e),"",...g.slice(e+1)]),e>0){let t=document.querySelector(`input[name=code-${e-1}]`);t?.focus()}})(n)},inputMode:"numeric",autoFocus:0===n,pattern:"[0-9]",className:`${d?"success":""} ${c?"fail":""}`,autoComplete:x.isMobile?"one-time-code":"off"},n)))}),/*#__PURE__*/e.jsx(Qh,{$fail:!!c,$success:d,children:/*#__PURE__*/e.jsx("span",{children:"Invalid or expired verification code"===c?"Incorrect code":c||(d?"Success!":"")})})]})})})})};let zh=6,Hh=Array(6).fill("");var Vh,$h,qh=((Vh=qh||{})[Vh.RESET_AFTER_DELAY=0]="RESET_AFTER_DELAY",Vh[Vh.CLEAR_ON_NEXT_VALID_INPUT=1]="CLEAR_ON_NEXT_VALID_INPUT",Vh),Gh=(($h=Gh||{})[$h.EMAIL=0]="EMAIL",$h[$h.SMS=1]="SMS",$h);const Yh={component:()=>{let{app:t,navigate:i,lastScreen:o,navigateBack:s,setModalData:l,onUserCloseViaDialogOrKeybindRef:d}=Zn(),{closePrivyModal:u,resendEmailCode:p,resendSmsCode:h,getAuthMeta:g,loginWithCode:m,updateWallets:y,createAnalyticsEvent:f}=r.usePrivyInternal(),{authenticated:x,logout:v,user:w}=a.usePrivyContext(),{whatsAppEnabled:C}=Gn(),[b,j]=n.useState(!1),[k,T]=n.useState(null),[A,S]=n.useState(null),[E,I]=n.useState(0);d.current=()=>null;let P=g()?.email?0:1,N=0===P?g()?.email||"":g()?.phoneNumber||"";n.useEffect((()=>{if(E){let e=setTimeout((()=>{I(E-1)}),1e3);return()=>clearTimeout(e)}}),[E]),n.useEffect((()=>{if(x&&b&&w){if(t?.legal.requireUsersAcceptTerms&&!w.hasAcceptedTerms){let e=setTimeout((()=>{i(nl)}),900);return()=>clearTimeout(e)}if(fs(w,t.embeddedWallets)){let e=setTimeout((()=>{l({createWallet:{onSuccess:()=>{},onFailure:e=>{console.error(e),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:e,screen:"AwaitingPasswordlessCodeScreen"}}),v()},callAuthOnSuccessOnClose:!0}}),i(tl)}),900);return()=>clearTimeout(e)}{y();let e=setTimeout((()=>u({shouldCallAuthOnSuccess:!0,isSuccess:!0})),rt);return()=>clearTimeout(e)}}}),[x,b,w]),n.useEffect((()=>{if(k&&0===A){let e=setTimeout((()=>{T(null),S(null);let e=document.querySelector("input[name=code-0]");e?.focus()}),1400);return()=>clearTimeout(e)}}),[k,A]);/*#__PURE__*/return e.jsx(Uh,{contactMethod:N,authFlow:0===P?"email":"sms",appName:t?.name,whatsAppEnabled:C,onBack:()=>s(),onCodeSubmit:async e=>{try{await m(e),j(!0)}catch(e){if(e instanceof c.PrivyApiError&&e.privyErrorCode===c.PrivyErrorCode.INVALID_CREDENTIALS)T("Invalid or expired verification code"),S(0);else if(e instanceof c.PrivyApiError&&e.privyErrorCode===c.PrivyErrorCode.CANNOT_LINK_MORE_OF_TYPE)T(e.message);else{if(e instanceof c.PrivyApiError&&e.privyErrorCode===c.PrivyErrorCode.USER_LIMIT_REACHED)return console.error(new c.PrivyUserLimitReachedError(e).toString()),void i(hc);if(e instanceof c.PrivyApiError&&e.privyErrorCode===c.PrivyErrorCode.USER_DOES_NOT_EXIST)return void i(vs);if(e instanceof c.PrivyApiError&&e.privyErrorCode===c.PrivyErrorCode.LINKED_TO_ANOTHER_USER)return l({errorModalData:{error:e,previousScreen:o??Yh}}),void i(Rs,!1);if(e instanceof c.PrivyApiError&&e.privyErrorCode===c.PrivyErrorCode.DISALLOWED_PLUS_EMAIL)return l({inlineError:{error:e}}),void i(Bh,!1);if(e instanceof c.PrivyApiError&&e.privyErrorCode===c.PrivyErrorCode.ACCOUNT_TRANSFER_REQUIRED&&e.data?.data?.nonce)return l({accountTransfer:{nonce:e.data?.data?.nonce,account:N,displayName:e.data?.data?.account?.displayName,linkMethod:0===P?"email":"sms",embeddedWalletAddress:e.data?.data?.otherUser?.embeddedWalletAddress}}),void i(Qs);T("Issue verifying code"),S(0)}}},onResend:async()=>{I(30),0===P?await p():await h()},errorMessage:k||void 0,success:b,resendCountdown:E,onInvalidInput:e=>{T(e),S(1)},onClearError:()=>{1===A&&(T(null),S(null))}})}};let Zh=/*#__PURE__*/i.styled.div.withConfig({displayName:"PasswordlessCodeContainer",componentId:"sc-5dd8bc26-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;margin:auto;gap:16px;flex-grow:1;width:100%;"]),Kh=/*#__PURE__*/i.styled.div.withConfig({displayName:"CodeInput",componentId:"sc-5dd8bc26-1"})(["display:flex;flex-direction:column;width:100%;gap:12px;> div:first-child{display:flex;justify-content:center;gap:0.5rem;width:100%;border-radius:var(--privy-border-radius-sm);> input{border:1px solid var(--privy-color-foreground-4);background:var(--privy-color-background);border-radius:var(--privy-border-radius-sm);padding:8px 10px;height:48px;width:40px;text-align:center;font-size:18px;font-weight:600;color:var(--privy-color-foreground);transition:all 0.2s ease;}> input:focus{border:1px solid var(--privy-color-foreground);box-shadow:0 0 0 1px var(--privy-color-foreground);}> input:invalid{border:1px solid var(--privy-color-error);}> input.success{border:1px solid var(--privy-color-border-success);background:var(--privy-color-success-bg);}> input.fail{border:1px solid var(--privy-color-border-error);background:var(--privy-color-error-bg);animation:shake 180ms;animation-iteration-count:2;}}@keyframes shake{0%{transform:translate(1px,0px);}33%{transform:translate(-1px,0px);}67%{transform:translate(-1px,0px);}100%{transform:translate(1px,0px);}}"]),Qh=/*#__PURE__*/i.styled.div.withConfig({displayName:"InputHelp",componentId:"sc-5dd8bc26-2"})(["line-height:20px;min-height:20px;font-size:14px;font-weight:400;color:",";display:flex;justify-content:center;width:100%;text-align:center;"],(e=>e.$success?"var(--privy-color-success-dark)":e.$fail?"var(--privy-color-error-dark)":"transparent")),Xh=/*#__PURE__*/i.styled.div.withConfig({displayName:"HelpTextContainer",componentId:"sc-5dd8bc26-3"})(["display:flex;gap:8px;align-items:center;justify-content:center;width:100%;color:var(--privy-color-foreground-2);"]),Jh=/*#__PURE__*/i.styled.div.withConfig({displayName:"Badge",componentId:"sc-5dd8bc26-4"})(["display:flex;align-items:center;justify-content:center;border-radius:var(--privy-border-radius-sm);padding:2px 8px;gap:4px;background:var(--privy-color-background-2);color:var(--privy-color-foreground-2);"]),eg=/*#__PURE__*/i.styled.span.withConfig({displayName:"BoldWrappingSpan",componentId:"sc-5dd8bc26-5"})(["font-weight:500;word-break:break-all;color:var(--privy-color-foreground);"]);const tg=/*#__PURE__*/n.forwardRef(((i,o)=>{let[s,l]=n.useState(i.defaultValue||""),[d,u]=n.useState(""),[p,h]=n.useState(!1),{authenticated:g}=a.usePrivyContext(),{initLoginWithEmail:m}=r.usePrivyInternal(),{navigate:y,setModalData:f,currentScreen:x,data:v}=Zn(),{enabled:w,token:C}=qt(),[b,j]=n.useState(!1),{accountType:k}=is(),T=Gn();n.useEffect((()=>{!s&&T.disablePlusEmails&&v?.inlineError?.error instanceof c.PrivyError&&v?.inlineError?.error.privyErrorCode===c.PrivyErrorCode.DISALLOWED_PLUS_EMAIL&&!d&&u("Please enter a valid email address without a '+'."),d&&u("")}),[s]);let A=Lt(s),S=p||!A,E=()=>{f({login:v?.login,inlineError:void 0}),!w||C||g?(e=>{h(!0),m({email:s,captchaToken:e,disableSignup:v?.login?.disableSignup,withPrivyUi:!0}).then((()=>{y(Yh)})).catch((e=>{f({errorModalData:{error:e,previousScreen:x||cg}}),y(Rs)})).finally((()=>{h(!1)}))})(C):(f({captchaModalData:{callback:e=>m({email:s,captchaToken:e,withPrivyUi:!0}),userIntentRequired:!1,onSuccessNavigateTo:Yh,onErrorNavigateTo:Rs}}),y(ic))};/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsxs(ng,{children:[d&&/*#__PURE__*/e.jsx(wl,{style:{display:"block",marginTop:"0.25rem",textAlign:"left"},children:d}),/*#__PURE__*/e.jsxs(rg,{stacked:i.stacked,$error:!!d,children:[/*#__PURE__*/e.jsx(ag,{children:/*#__PURE__*/e.jsx(t.Mail,{})}),/*#__PURE__*/e.jsx("input",{ref:o,id:"email-input",className:"login-method-button",type:"email",placeholder:"your@email.com",onFocus:()=>j(!0),onChange:e=>l(e.target.value),onKeyUp:e=>{"Enter"===e.key&&E()},value:s,autoComplete:"email"}),"email"!==k||b?i.stacked?/*#__PURE__*/e.jsx("span",{}):/*#__PURE__*/e.jsx(Rr,{isSubmitting:p,onClick:E,disabled:S,children:"Submit"}):/*#__PURE__*/e.jsx(xu,{color:"gray",children:"Recent"})]})]}),i.stacked?/*#__PURE__*/e.jsx(Pr,{loadingText:null,loading:p,disabled:S,onClick:E,style:{width:"100%"},children:"Submit"}):null]})}));let ng=kl,rg=jl,ag=/*#__PURE__*/i.styled(ur).withConfig({displayName:"StyledLoginMethodIconWrapper",componentId:"sc-e33d938a-0"})(["display:inline-flex;"]);const ig=({isEditable:r,setIsEditable:a,defaultValue:i})=>{let o=n.useRef(null);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(pr,{$if:!r,children:/*#__PURE__*/e.jsx(tg,{ref:o,defaultValue:i})}),/*#__PURE__*/e.jsx(pr,{$if:r,children:/*#__PURE__*/e.jsxs(dr,{onClick:()=>{a(),setTimeout((()=>{o.current?.focus()}),0)},children:[/*#__PURE__*/e.jsx(ur,{children:/*#__PURE__*/e.jsx(t.Mail,{})}),"Continue with Email"]})})]})},og=({connectOnly:t})=>{let{closePrivyModal:a,connectors:i}=r.usePrivyInternal(),{app:o,onUserCloseViaDialogOrKeybindRef:s,data:l}=Zn(),{appearance:{palette:{colorScheme:c}}}=Gn(),{accountType:d,walletClientType:u,chainType:p}=is(),h=n.useMemo((()=>d&&"guest"!==d&&"authorization_key"!==d&&"cross_app"!==d?es(d):null),[d]),g=o.loginMethodsAndOrder?.primary??[],m=o.loginMethodsAndOrder?.overflow??[],y=n.useMemo((()=>[...g,...m]),[g,m]),f=o.loginMethods.passkey,x=l?.login,v=[];u&&y.includes(u)?v.push(u):d&&y.includes(h?.loginMethod)&&v.push(h?.loginMethod);let[w,C]=n.useState("default"),[b,j]=n.useState(Oh({mostRecentlyUsedAccountType:d,smsAvailable:y.includes("sms"),emailAvailable:y.includes("email"),prefilledType:x?.prefill?.type}));n.useEffect((()=>{j(Oh({mostRecentlyUsedAccountType:d,smsAvailable:y.includes("sms"),emailAvailable:y.includes("email"),prefilledType:x?.prefill?.type}))}),[y,d]),n.useEffect((()=>{"phone"===d&&j("sms");let e=y.indexOf("sms"),t=y.indexOf("email");e>-1&&e<t&&j("sms")}),[d,g,m]);let k=()=>{a({shouldCallAuthOnSuccess:!0}),setTimeout((()=>{C("default")}),150)};s.current=k;let T=n=>"email"===n?/*#__PURE__*/e.jsx(ig,{isEditable:"email"===b,setIsEditable:()=>{j("email")},defaultValue:"email"===x?.prefill?.type?x.prefill.value:void 0},n):"sms"===n?/*#__PURE__*/e.jsx(jh,{isEditable:"sms"===b,setIsEditable:()=>{j("sms")},defaultValue:"phone"===x?.prefill?.type?x.prefill.value:void 0},n):"apple"===n?/*#__PURE__*/e.jsx(Th,{provider:"apple"},n):"discord"===n?/*#__PURE__*/e.jsx(Th,{provider:"discord"},n):"farcaster"===n?/*#__PURE__*/e.jsx(uh,{},n):"github"===n?/*#__PURE__*/e.jsx(Th,{provider:"github"},n):"google"===n?/*#__PURE__*/e.jsx(Th,{provider:"google"},n):"linkedin"===n?/*#__PURE__*/e.jsx(Th,{provider:"linkedin"},n):"spotify"===n?/*#__PURE__*/e.jsx(Th,{provider:"spotify"},n):"instagram"===n?/*#__PURE__*/e.jsx(Th,{provider:"instagram"},n):"tiktok"===n?/*#__PURE__*/e.jsx(Th,{provider:"tiktok"},n):"line"===n?/*#__PURE__*/e.jsx(Th,{provider:"line"},n):"twitter"===n?/*#__PURE__*/e.jsx(Th,{provider:"twitter"},n):"telegram"===n?/*#__PURE__*/e.jsx(Ph,{},n):n.startsWith("privy:")?/*#__PURE__*/e.jsx(ds,{appId:n.replace("privy:","")},n):zu({walletList:o.appearance.walletList,walletChainType:x?.walletChainType??o.appearance.walletChainType,connectors:i,connectOnly:t,ignore:y,walletConnectEnabled:o.externalWallets.walletConnect.enabled,forceWallet:{wallet:n,chainType:p??"ethereum"}}),A=v.flatMap(T),S=g.filter((e=>e!==u&&e!==h?.loginMethod)).flatMap(T),E=m.filter((e=>e!==u&&e!==h?.loginMethod)).flatMap(T),[I,P]=((e,t)=>{let n=[],r=[];for(let[a,i]of e.entries())a<t?n.push(i):r.push(i);return[n,r]})([...A,...S,...E],sg({primary:S.length+A.length,overflow:E.length}));/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{title:o.appearance.landingHeader,onClose:k,backFn:"default"===w?void 0:()=>{C("default")}}),"default"===w&&/*#__PURE__*/e.jsx(lg,{}),"default"===w&&("string"==typeof o.appearance.loginMessage?/*#__PURE__*/e.jsx(cr,{children:o.appearance.loginMessage}):o.appearance.loginMessage),/*#__PURE__*/e.jsx(ir,{style:{overflow:"hidden"},children:/*#__PURE__*/e.jsxs(sr,{$colorScheme:c,children:["default"===w&&/*#__PURE__*/e.jsxs(e.Fragment,{children:[I,P.length>0&&/*#__PURE__*/e.jsx(_h,{text:"More options",icon:/*#__PURE__*/e.jsx(ce.default,{}),onClick:()=>C("overflow")})]}),"overflow"===w&&/*#__PURE__*/e.jsx(e.Fragment,{children:P}),f&&"default"===w&&/*#__PURE__*/e.jsx(xh,{})]})}),o&&/*#__PURE__*/e.jsx(fr,{app:o}),/*#__PURE__*/e.jsx(xr,{})]})};let sg=({primary:e,overflow:t})=>e<5?e:5===e&&0===t?5:4,lg=/*#__PURE__*/i.styled(ss).withConfig({displayName:"StyledAppLogoHeader",componentId:"sc-ccb89604-0"})(["margin-bottom:16px;"]);const cg={component:()=>{let{app:t}=Zn();return t.loginMethodsAndOrder&&t.loginMethodsAndOrder.primary.length>0?/*#__PURE__*/e.jsx(og,{connectOnly:!1}):/*#__PURE__*/e.jsx(Mh,{connectOnly:!1})},isCaptchaRequired:!0,isUnauthenticatedScreem:!0},dg={component:()=>{let[t,i]=n.useState(null),[o,s]=n.useState(!1),[l,d]=n.useState(null),[u,p]=n.useState(""),{authenticated:h,user:g}=a.usePrivyContext(),{client:m,walletProxy:y,refreshSessionAndUser:f,closePrivyModal:x,createAnalyticsEvent:v}=r.usePrivyInternal(),{app:w,navigate:C,data:b,onUserCloseViaDialogOrKeybindRef:j}=Zn(),{onSuccess:k,onFailure:T}=b.setWalletPassword,A=a.getPrivyPrimaryWallet(g),S="user-passcode"===t?.recoveryMethod,E="user-passcode"===A?.recoveryMethod;n.useEffect((()=>{h||(C(cg),T(new c.PrivyUnauthenticatedError("User must be authenticated before setting a password on a Privy wallet")))}),[h]);let I=()=>l?(T(l),void x({shouldCallAuthOnSuccess:!1})):S?(k(t),void x({shouldCallAuthOnSuccess:!1})):(T(new c.PrivyEmbeddedWalletError("Exited before password was added to wallet")),void x({shouldCallAuthOnSuccess:!1}));j.current=I;/*#__PURE__*/return e.jsx(Xo,{appName:w?.name||"privy",config:{initiatedBy:"user",onCancel:I},error:l?"An error has occurred, please try again.":void 0,buttonLoading:o,buttonHideAnimations:!1,password:u,isResettingPassword:E,onPasswordGenerate:()=>p(zo()),onPasswordChange:p,onSubmit:async()=>{S?(k(t),x({shouldCallAuthOnSuccess:!1})):(s(!0),d(null),await(async()=>{let e=await m.getAccessToken();if(e&&g&&A?.address&&u&&y)try{v({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E}});let{entropyId:t,entropyIdVerifier:n}=Qt(g);if(!(await y.setRecovery({accessToken:e,entropyId:t,entropyIdVerifier:n,recoveryPassword:u,recoveryMethod:"user-passcode"})).entropyId)return d(new c.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E,reason:"error setting password"}});let r=await f(),o=a.getPrivyPrimaryWallet(r);if(!o)return d(new c.PrivyEmbeddedWalletError("Error setting password on privy wallet")),void v({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E,reason:"wallet disconnected"}});i(o),v({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:A.address,existingRecoveryMethod:A.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:E}})}catch(e){console.warn(e),d(e instanceof Error?e:Error("Error setting password on privy wallet")),v({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:A.address,reason:e}})}})(),s(!1))},onClose:I})}},ug=({onClose:n,onProceed:r})=>/*#__PURE__*/e.jsx(ba,{title:"Secure Your Account",subtitle:/*#__PURE__*/e.jsxs(e.Fragment,{children:["Please set a password to secure your account.",/*#__PURE__*/e.jsx("br",{}),"Losing access to this password and this device will make your account inaccessible."]}),icon:t.Lock,primaryCta:{label:"Add password",onClick:r},onClose:n,watermark:!0}),pg={component:()=>{let{closePrivyModal:t}=r.usePrivyInternal(),{data:n,navigate:a,onUserCloseViaDialogOrKeybindRef:i}=Zn(),{onFailure:o}=n.setWalletPassword,s=()=>{o(new c.PrivyEmbeddedWalletError("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return i.current=s,/*#__PURE__*/e.jsx(ug,{onClose:s,onProceed:()=>{a(dg)}})}},hg={component:()=>{let[t,i]=n.useState(!0),{authenticated:o,user:s}=a.usePrivyContext(),{walletProxy:l,closePrivyModal:d,createAnalyticsEvent:u,client:p}=r.usePrivyInternal(),{navigate:h,data:g,onUserCloseViaDialogOrKeybindRef:m}=Zn(),[y,f]=n.useState(void 0),[x,v]=n.useState(""),[w,C]=n.useState(!1),{entropyId:b,entropyIdVerifier:j,onCompleteNavigateTo:k,onSuccess:T,onFailure:A}=g.recoverWallet,S=(e="User exited before their wallet could be recovered")=>{d({shouldCallAuthOnSuccess:!1}),A("string"==typeof e?new c.PrivyEmbeddedWalletError(e):e)};m.current=S,n.useEffect((()=>{if(!o)return S("User must be authenticated and have a Privy wallet before it can be recovered")}),[o]);/*#__PURE__*/return e.jsxs(ma,{children:[/*#__PURE__*/e.jsx(ma.Header,{icon:Fe.default,title:"Enter your password",subtitle:"Please provision your account on this new device. To continue, enter your recovery password.",showClose:!0,onClose:S}),/*#__PURE__*/e.jsx(ma.Body,{children:/*#__PURE__*/e.jsx(gg,{children:/*#__PURE__*/e.jsxs("div",{children:[/*#__PURE__*/e.jsxs(yo,{children:[/*#__PURE__*/e.jsx(go,{type:t?"password":"text",onChange:e=>(e=>{e&&f(e)})(e.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),/*#__PURE__*/e.jsx(Co,{style:{right:"0.75rem"},children:t?/*#__PURE__*/e.jsx(jo,{onClick:()=>i(!1)}):/*#__PURE__*/e.jsx(ko,{onClick:()=>i(!0)})})]}),!!x&&/*#__PURE__*/e.jsx(mg,{children:x})]})})}),/*#__PURE__*/e.jsxs(ma.Footer,{children:[/*#__PURE__*/e.jsx(ma.HelpText,{children:/*#__PURE__*/e.jsxs(Xa,{children:[/*#__PURE__*/e.jsx("h4",{children:"Why is this necessary?"}),/*#__PURE__*/e.jsx("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]})}),/*#__PURE__*/e.jsx(ma.Actions,{children:/*#__PURE__*/e.jsx(yg,{loading:w||!l,disabled:!y,onClick:async()=>{C(!0);let e=await p.getAccessToken(),t=a.getPrivyWalletWithAddress(s,b);if(!e||!t||null===y)return S("User must be authenticated and have a Privy wallet before it can be recovered");try{u({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:t.address}}),await(l?.recover({accessToken:e,entropyId:b,entropyIdVerifier:j,recoveryPassword:y})),v(""),k?h(k):d({shouldCallAuthOnSuccess:!1}),T?.(t),u({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:t.address}})}catch(e){!function(e){return Wi(e)&&("invalid_recovery_pin"===e.type||"invalid_request_arguments"===e.type)}(e)?v("An error has occurred, please try again."):v("Invalid recovery password, please try again.")}finally{C(!1)}},$hideAnimations:!b&&w,children:"Recover your account"})}),/*#__PURE__*/e.jsx(ma.Watermark,{})]})]})}};let gg=/*#__PURE__*/i.styled.div.withConfig({displayName:"Content",componentId:"sc-f366413c-0"})(["display:flex;flex-direction:column;gap:1.5rem;"]),mg=/*#__PURE__*/i.styled.div.withConfig({displayName:"ErrorMessage",componentId:"sc-f366413c-1"})(["line-height:20px;height:20px;font-size:13px;color:var(--privy-color-error);text-align:left;margin-top:0.5rem;"]),yg=/*#__PURE__*/i.styled(Pr).withConfig({displayName:"NoAnimationPrimaryButton",componentId:"sc-f366413c-2"})(["",""],(({$hideAnimations:e})=>e&&/*#__PURE__*/i.css(["&&{transition:none;}"])));const fg={component:()=>{let{app:t,navigate:i,data:o,onUserCloseViaDialogOrKeybindRef:s}=Zn(),[l,d]=n.useState(""),[u,p]=n.useState(!1),[h,g]=n.useState(),[m,y]=n.useState(null),{create:f}=Qi(),{authenticated:x,user:v}=a.usePrivyContext(),{closePrivyModal:w,isNewUserThisSession:C,initializeWalletProxy:b}=r.usePrivyInternal(),{onSuccess:j,onFailure:k,callAuthOnSuccessOnClose:T,shouldCreateEth:A,shouldCreateSol:S}=o.createWallet,[E,I]=n.useState(null),P=new nt((async()=>{try{let e;if(A&&S)e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:v}),e=await f({chainType:"solana",walletIndex:0,latestUser:e.user});else if(S)e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"solana",walletIndex:0,latestUser:v});else{if(!A)throw Error("Invalid args to create wallet");e=await f({recoveryMethod:"user-passcode",recoveryPassword:h,chainType:"ethereum",walletIndex:0,latestUser:v})}I(e),C?i(Ji):(j(e),w({shouldCallAuthOnSuccess:T}))}catch(e){d(e.message)}}));n.useEffect((()=>{m||b(3e4).then((e=>y(e)))}),[m]),n.useEffect((()=>{if(!x||!v)return i(cg),void k(Error("User must be authenticated before creating a Privy wallet"))}),[x]),s.current=()=>null;/*#__PURE__*/return e.jsx(Xo,{config:{initiatedBy:"automatic"},appName:t?.name||"privy",loading:!m,buttonLoading:u,buttonHideAnimations:!E&&u,isResettingPassword:!1,error:l,password:h||"",onClose:()=>{E&&"user-passcode"!==E.account.recoveryMethod?(k(new c.PrivyEmbeddedWalletError("User created a wallet but failed to set a password for it")),w({shouldCallAuthOnSuccess:!1})):E?(j(E),w({shouldCallAuthOnSuccess:T})):(k(new c.PrivyEmbeddedWalletError("User wallet creation failed")),w({shouldCallAuthOnSuccess:!1}))},onPasswordChange:g,onPasswordGenerate:()=>g(zo()),onSubmit:async()=>(p(!0),P.execute().then((()=>new Promise((e=>setTimeout(e,250))))).finally((()=>p(!1))))})}},xg=/*#__PURE__*/i.styled.div.withConfig({displayName:"WithCircleBorder",componentId:"sc-e4fc5563-0"})(["&&{border-width:4px;}display:flex;justify-content:center;align-items:center;padding:1rem;aspect-ratio:1;border-style:solid;border-color:",";border-radius:50%;"],(e=>e.$color??"var(--privy-color-accent)")),vg={component:()=>{let{user:t}=a.usePrivyContext(),{client:i,walletProxy:o,refreshSessionAndUser:s,closePrivyModal:l}=r.usePrivyInternal(),c=Zn(),{entropyId:d,entropyIdVerifier:u}=c.data?.recoverWallet,[p,h]=n.useState(!1),[g,m]=n.useState(null),[y,f]=n.useState(null);function x(){if(!p){if(y)return c.data?.setWalletPassword?.onFailure(y),void l();if(!g)return c.data?.setWalletPassword?.onFailure(Error("User exited set recovery flow")),void l()}}c.onUserCloseViaDialogOrKeybindRef.current=x;let v=!(!p&&!g);return y?/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:x},"header"),/*#__PURE__*/e.jsx(xg,{$color:"var(--privy-color-error)",style:{alignSelf:"center"},children:/*#__PURE__*/e.jsx(fe.default,{height:38,width:38,stroke:"var(--privy-color-error)"})}),/*#__PURE__*/e.jsx(jc,{style:{marginTop:"0.5rem"},children:"Something went wrong"}),/*#__PURE__*/e.jsx(ar,{style:{minHeight:"2rem"}}),/*#__PURE__*/e.jsx(Nr,{onClick:()=>f(null),children:"Try again"}),/*#__PURE__*/e.jsx(xr,{})]}):/*#__PURE__*/e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:x},"header"),/*#__PURE__*/e.jsx(je.default,{style:{width:"3rem",height:"3rem",alignSelf:"center"}}),/*#__PURE__*/e.jsx(jc,{style:{marginTop:"0.5rem"},children:"Automatically secure your account"}),/*#__PURE__*/e.jsx(bc,{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."}),/*#__PURE__*/e.jsx(ar,{style:{minHeight:"2rem"}}),/*#__PURE__*/e.jsx(Nr,{loading:p,disabled:v,onClick:()=>async function(){h(!0);try{let e=await i.getAccessToken(),n=a.getPrivyWalletWithAddress(t,d);if(!e||!o||!n)return;if(!(await o.setRecovery({accessToken:e,entropyId:d,entropyIdVerifier:u,existingRecoveryMethod:n.recoveryMethod,recoveryMethod:"privy"})).entropyId)throw Error("Unable to set recovery on wallet");let r=await s();if(!r)throw Error("Unable to set recovery on wallet");let p=a.getPrivyWalletWithAddress(r,n.address);if(!p)throw Error("Unabled to set recovery on wallet");m(!!r),setTimeout((()=>{c.data?.setWalletPassword?.onSuccess(p),l()}),rt)}catch(e){f(e)}finally{h(!1)}}(),children:g?"Success":"Confirm"}),/*#__PURE__*/e.jsx(xr,{})]})}};function wg({isCreatingWallet:e,skipSplashScreen:t}){return e?fg:t?dg:pg}function Cg({walletAction:e,availableRecoveryMethods:t,legacySetWalletPasswordFlow:n,isResettingPassword:r,showAutomaticRecovery:a}){return a?vg:n||1===t.length?wg({isCreatingWallet:"create"===e,skipSplashScreen:r}):so}function bg(e){switch(e){case"user-passcode":return hg;case"google-drive":case"icloud":return ro;default:throw Error("Recovery method not supported")}}const jg=({address:t,accessToken:n,appConfigTheme:r,onClose:a,isLoading:i=!1,exportButtonProps:o})=>/*#__PURE__*/e.jsx(ba,{title:"Export wallet",subtitle:/*#__PURE__*/e.jsxs(e.Fragment,{children:["Copy either your private key or seed phrase to export your wallet."," ",/*#__PURE__*/e.jsx("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Learn more"})]}),onClose:a,watermark:!0,children:/*#__PURE__*/e.jsxs(kg,{children:[/*#__PURE__*/e.jsx(fd,{theme:r,children:"Never share your private key or seed phrase with anyone."}),/*#__PURE__*/e.jsx(Fc,{title:"Your wallet",address:t,showCopyButton:!0}),/*#__PURE__*/e.jsx("div",{style:{width:"100%"},children:i?/*#__PURE__*/e.jsx(Tg,{}):n&&o&&/*#__PURE__*/e.jsx(Eg,{accessToken:n,dimensions:{height:"44px"},...o})})]})});let kg=/*#__PURE__*/i.styled.div.withConfig({displayName:"ContentContainer",componentId:"sc-e0132ced-0"})(["display:flex;flex-direction:column;gap:1.25rem;text-align:left;"]),Tg=()=>/*#__PURE__*/e.jsx(Ag,{children:/*#__PURE__*/e.jsx(Sg,{children:"Loading..."})}),Ag=/*#__PURE__*/i.styled.div.withConfig({displayName:"PlaceholderContainer",componentId:"sc-e0132ced-1"})(["display:flex;gap:12px;height:44px;"]),Sg=/*#__PURE__*/i.styled.div.withConfig({displayName:"PlaceholderButton",componentId:"sc-e0132ced-2"})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:16px;font-weight:500;border-radius:var(--privy-border-radius-md);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);"]);function Eg(t){let[r,a]=n.useState(t.dimensions.width),[i,o]=n.useState(void 0),s=n.useRef(null);n.useEffect((()=>{if(s.current&&void 0===r){let{width:e}=s.current.getBoundingClientRect();a(e)}let e=getComputedStyle(document.documentElement);o({background:e.getPropertyValue("--privy-color-background"),background2:e.getPropertyValue("--privy-color-background-2"),foreground3:e.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:e.getPropertyValue("--privy-color-foreground-accent"),accent:e.getPropertyValue("--privy-color-accent"),accentDark:e.getPropertyValue("--privy-color-accent-dark"),success:e.getPropertyValue("--privy-color-success"),colorScheme:e.getPropertyValue("color-scheme")})}),[]);let l="ethereum"===t.chainType&&!t.imported&&!t.isUnifiedWallet;/*#__PURE__*/return e.jsx("div",{ref:s,children:r&&
26
26
  /*#__PURE__*/e.jsxs(Pg,{children:[/*#__PURE__*/e.jsx("iframe",{style:{position:"absolute",zIndex:1},width:r,height:t.dimensions.height,allow:"clipboard-write self *",src:Bt(t.origin,`/apps/${t.appId}/embedded-wallets/export`,t.isUnifiedWallet?{v:"1-unified",wallet_id:t.walletId,client_id:t.appClientId,width:`${r}px`,caid:t.clientAnalyticsId,phrase_export:l,...i}:{v:"1",entropy_id:t.entropyId,entropy_id_verifier:t.entropyIdVerifier,hd_wallet_index:t.hdWalletIndex,chain_type:t.chainType,client_id:t.appClientId,width:`${r}px`,caid:t.clientAnalyticsId,phrase_export:l,...i},{token:t.accessToken})}),/*#__PURE__*/e.jsx(Ng,{children:"Loading..."}),l&&/*#__PURE__*/e.jsx(Ng,{children:"Loading..."})]})})}const Ig={component:()=>{let[t,i]=n.useState(null),{authenticated:o,user:s}=a.usePrivyContext(),{closePrivyModal:l,createAnalyticsEvent:c,clientAnalyticsId:d,client:u}=r.usePrivyInternal(),p=Gn(),{data:h,onUserCloseViaDialogOrKeybindRef:g}=Zn(),{onFailure:m,onSuccess:y,origin:f,appId:x,appClientId:v,entropyId:w,entropyIdVerifier:C,walletId:b,hdWalletIndex:j,chainType:k,address:T,isUnifiedWallet:A,imported:S}=h.keyExport,E=e=>{l({shouldCallAuthOnSuccess:!1}),m("string"==typeof e?Error(e):e)},I=()=>{l({shouldCallAuthOnSuccess:!1}),y(),c({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:T}})};return n.useEffect((()=>{if(!o)return E("User must be authenticated before exporting their wallet");u.getAccessToken().then(i).catch(E)}),[o,s]),g.current=I,/*#__PURE__*/e.jsx(jg,{address:T,accessToken:t,appConfigTheme:p.appearance.palette.colorScheme,onClose:I,isLoading:!t,exportButtonProps:t?{origin:f,appId:x,appClientId:v,clientAnalyticsId:d,entropyId:w,entropyIdVerifier:C,walletId:b,hdWalletIndex:j,isUnifiedWallet:A,imported:S,chainType:k}:void 0})}};let Pg=/*#__PURE__*/i.styled.div.withConfig({displayName:"ButtonContainer",componentId:"sc-e0132ced-3"})(["overflow:visible;position:relative;overflow:none;height:44px;display:flex;gap:12px;"]),Ng=/*#__PURE__*/i.styled.div.withConfig({displayName:"LoadingButton",componentId:"sc-e0132ced-4"})(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:16px;font-weight:500;border-radius:var(--privy-border-radius-md);background-color:var(--privy-color-background-2);color:var(--privy-color-foreground-3);"]);const _g=({connectionFailed:n,onClose:r})=>n?/*#__PURE__*/e.jsx(ba,{title:"Something went wrong",subtitle:"We're on it. Please try again later.",icon:t.XCircle,iconVariant:"error",primaryCta:{label:"Close",onClick:r},watermark:!0}):/*#__PURE__*/e.jsx(ba,{title:"Connecting to your wallet",subtitle:"Please wait...",iconVariant:"loading",showClose:!0,onClose:r,watermark:!1}),Mg={component:()=>{let{authenticated:t,user:i}=a.usePrivyContext(),{client:o,closePrivyModal:s,createAnalyticsEvent:l,walletProxy:c}=r.usePrivyInternal(),{navigate:d,data:u,setModalData:p,onUserCloseViaDialogOrKeybindRef:h}=Zn(),g=n.useMemo((()=>Date.now()),[]),[m,y]=n.useState(!1),{onCompleteNavigateTo:f,onFailure:x,shouldForceMFA:v,entropyId:w,entropyIdVerifier:C,recoveryMethod:b,connectingWalletAddress:j,isUnifiedWallet:k=!1}=u?.connectWallet,T=e=>{m||(y(!0),x("string"==typeof e?Error(e):e))};return n.useEffect((()=>{let e;return t?c?((async()=>{let t=await o.getAccessToken();if(!t)return T("User must be authenticated and have a Privy wallet before it can be connected");try{k||await c.connect({accessToken:t,entropyId:w,entropyIdVerifier:C}),v&&await c.verifyMfa({accessToken:t});let n=(Date.now()-g)/1e3;f===Ig&&n<1?e=setTimeout((()=>{d(f,!1)}),1e3*(1-n)):d(f,!1)}catch(e){if(Di(e)&&"privy"===b){let e=await o.getAccessToken();if(!e)return T("User must be authenticated and have a Privy wallet before it can be recovered");try{l({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:j}});let t=await(c?.recover({accessToken:e,entropyId:w,entropyIdVerifier:C}));t?.entropyId||T(Error("Unable to recover wallet")),f?d(f):s({shouldCallAuthOnSuccess:!1}),l({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:j}}),d(f)}catch(e){T("An error has occurred, please try again.")}}else Di(e)&&"privy"!==b&&"privy-v2"!==b?(p({...u,recoverWallet:{entropyId:w,entropyIdVerifier:C,onCompleteNavigateTo:f,onFailure:x},recoveryOAuthStatus:{provider:b,action:"recover",isInAccountCreateFlow:!1,shouldCreateEth:!1,shouldCreateSol:!1}}),d(bg(b))):T(e)}})(),()=>clearTimeout(e)):void 0:T("User must be authenticated and have a Privy wallet before it can be connected")}),[t,i,c]),h.current=()=>{T("User exited before wallet could be connected"),s({shouldCallAuthOnSuccess:!1})},/*#__PURE__*/e.jsx(_g,{connectionFailed:m,onClose:()=>s({shouldCallAuthOnSuccess:!1})})}},Fg=({style:t,color:n,...r})=>/*#__PURE__*/e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:n||"currentColor",style:{height:"1.5rem",width:"1.5rem",...t},...r,children:/*#__PURE__*/e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),Lg=t=>{let[r,a]=n.useState(!1);/*#__PURE__*/return e.jsxs(Wg,{color:t.color,onClick:()=>{a(!0),navigator.clipboard.writeText(t.text),setTimeout((()=>a(!1)),1500)},$justCopied:r,children:[r?/*#__PURE__*/e.jsx(Fg,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):/*#__PURE__*/e.jsx(il,{style:{height:"14px",width:"14px"}}),r?"Copied":"Copy"," ",t.itemName?t.itemName:"to Clipboard"]})};let Wg=/*#__PURE__*/i.styled.button.withConfig({displayName:"StyledCopytoClipboardButton",componentId:"sc-46f4187f-0"})(["display:flex;align-items:center;gap:6px;&&{margin:8px 2px;font-size:14px;color:",";font-weight:",";transition:color 350ms ease;:focus,:active{background-color:transparent;border:none;outline:none;box-shadow:none;}:hover{color:",";}:active{color:'var(--privy-color-foreground)';font-weight:medium;}@media (max-width:440px){margin:12px 2px;}}svg{width:14px;height:14px;}"],(e=>e.$justCopied?"var(--privy-color-foreground)":e.color||"var(--privy-color-foreground-3)"),(e=>e.$justCopied?"medium":"normal"),(e=>e.$justCopied?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"));const Dg=/*#__PURE__*/i.styled.img.withConfig({displayName:"StyledLogo",componentId:"sc-68c1b1ea-0"})(["&&{height:",";width:",";border-radius:16px;margin-bottom:12px;}"],(e=>"sm"===e.size?"65px":"140px"),(e=>"sm"===e.size?"65px":"140px"));let Rg=e=>{if(!s.isHex(e))return e;try{let t=s.hexToString(e);return t.includes("�")?e:t}catch{return e}},Og=e=>{try{let t=o.base64.decode(e),n=(new TextDecoder).decode(t);return n.includes("�")?e:n}catch{return e}},Bg=e=>JSON.stringify(e,null,2),Ug=t=>{let{types:n,primaryType:r,...a}=t.typedData;/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(qg,{data:a}),/*#__PURE__*/e.jsx(Lg,{text:Bg(t.typedData),itemName:"full payload to clipboard"})," "]})};const zg=({method:n,messageData:r,copy:a,iconUrl:i,isLoading:o,success:s,walletProxyIsLoading:l,errorMessage:c,isCancellable:d,onSign:u,onCancel:p,onClose:h})=>/*#__PURE__*/e.jsx(ba,{title:a.title,subtitle:a.description,showClose:!0,onClose:h,icon:t.Edit,iconVariant:"subtle",helpText:c?/*#__PURE__*/e.jsx($g,{children:c}):void 0,primaryCta:{label:a.buttonText,onClick:u,disabled:o||s||l,loading:o},secondaryCta:d?{label:"Not now",onClick:p,disabled:o||s||l}:void 0,watermark:!0,children:/*#__PURE__*/e.jsxs(Qa,{children:[i?/*#__PURE__*/e.jsx(Dg,{style:{alignSelf:"center"},size:"sm",src:i,alt:"app image"}):null,/*#__PURE__*/e.jsxs(Vg,{children:["personal_sign"===n&&/*#__PURE__*/e.jsx(Gg,{children:Rg(r)}),"eth_signTypedData_v4"===n&&/*#__PURE__*/e.jsx(Ug,{typedData:r}),"solana_signMessage"===n&&/*#__PURE__*/e.jsx(Gg,{children:Og(r)})]})]})}),Hg={component:()=>{let{authenticated:t}=a.usePrivyContext(),{initializeWalletProxy:i,closePrivyModal:o}=r.usePrivyInternal(),{navigate:s,data:c,onUserCloseViaDialogOrKeybindRef:d}=Zn(),[u,p]=n.useState(!0),[h,g]=n.useState(""),[m,y]=n.useState(),[f,x]=n.useState(null),[v,w]=n.useState(!1);n.useEffect((()=>{t||s(cg)}),[t]),n.useEffect((()=>{i(3e4).then((e=>{p(!1),e||(g("An error has occurred, please try again."),y(new an(new rn(h,l.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))}))}),[]);let{method:C,data:b,confirmAndSign:j,onSuccess:k,onFailure:T,uiOptions:A}=c.signMessage,S={title:A?.title||"Sign message",description:A?.description||"Signing this message will not cost you any fees.",buttonText:A?.buttonText||"Sign and continue"},E=e=>{e?k(e):T(m||new an(new rn("The user rejected the request.",l.ProviderErrors.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),setTimeout((()=>{x(null),g(""),y(void 0)}),200)};d.current=()=>{E(f)};/*#__PURE__*/return e.jsx(zg,{method:C,messageData:b,copy:S,iconUrl:A?.iconUrl&&"string"==typeof A.iconUrl?A.iconUrl:void 0,isLoading:v,success:null!==f,walletProxyIsLoading:u,errorMessage:h,isCancellable:A?.isCancellable,onSign:async()=>{w(!0),g("");try{let e=await j();x(e),w(!1),setTimeout((()=>{E(e)}),rt)}catch(e){console.error(e),g("An error has occurred, please try again."),y(new an(new rn(h,l.ProviderErrors.E32603_DEFAULT_INTERNAL_ERROR.eipCode))),w(!1)}},onCancel:()=>E(null),onClose:()=>E(f)})}};let Vg=/*#__PURE__*/i.styled.div.withConfig({displayName:"MessageContainer",componentId:"sc-e01d451f-0"})(["flex:1;display:flex;flex-direction:column;gap:16px;"]),$g=/*#__PURE__*/i.styled.p.withConfig({displayName:"ErrorText",componentId:"sc-e01d451f-1"})(["&&{margin:0;width:100%;text-align:center;color:var(--privy-color-error-dark);font-size:14px;line-height:22px;}"]),qg=/*#__PURE__*/i.styled(Xc).withConfig({displayName:"StyledDisplayJsonTree",componentId:"sc-e01d451f-2"})(["margin-top:0;"]),Gg=/*#__PURE__*/i.styled(Kc).withConfig({displayName:"StyledMessage",componentId:"sc-e01d451f-3"})(["margin-top:0;"]);exports.ASSOCIATED_TOKEN_PROGRAM_ID="ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",exports.AccountNotFoundScreen=vs,exports.Address=Cs,exports.AffirmativeConsentScreen=nl,exports.AllowlistRejectionScreen=rc,exports.Apple=mt,exports.AuthenticateWithWalletScreen=xc,exports.AwaitingEvmToSolBridgingScreen=fp,exports.AwaitingExternalTransferScreen=xp,exports.AwaitingPasswordlessCodeScreen=Yh,exports.AwaitingSolToEvmBridgingScreen=wp,exports.BASE_ACCOUNT_DATA_URI=en,exports.Blobby=hn,exports.BlobbyFooter=xr,exports.BottomPusherContainer=$a,exports.Box=Ac,exports.BrowserExtensionWallet=mn,exports.ButtonLoader=Ar,exports.CLIENT_ANALYTICS_ID_KEY="privy:caid",exports.CODE_VERIFIER_KEY=ot,exports.COINBASE_WALLET_DATA_URI=Jt,exports.CONNECTIONS_HISTORY_KEY=lt,exports.CUSTOMER_ACCESS_TOKEN_COOKIE_KEY="privy-token",exports.CUSTOMER_ACCESS_TOKEN_STORAGE_KEY="privy:token",exports.CaptchaError=$t,exports.CaptchaProvider=({children:t,id:r,captchaSiteKey:a,captchaEnabled:i})=>{let o=n.useRef(null),[s,l]=n.useState(),[d,u]=n.useState(),[p,h]=n.useState(!1),g=n.useMemo((()=>i?p||s||d?!p||s||d?s&&!d?{status:"success",token:s}:d?{status:"error",error:d}:{status:"ready"}:{status:"loading"}:{status:"ready"}:{status:"disabled"}),[i,s,d,p]);/*#__PURE__*/return e.jsx(Vt.Provider,{value:{...g,ref:o,enabled:i,siteKey:a,appId:r,setToken:l,setError:u,setExecuting:h,remove(){i&&(o.current?.remove(),h(!1),u(void 0),l(void 0))},reset(){i&&(o.current?.reset(),h(!1),u(void 0),l(void 0))},execute(){i&&(h(!0),o.current?.execute())},async waitForResult(){if(!i)return"";try{return await function(e,{interval:t=100,timeout:n=5e3}={}){return new Promise(((r,a)=>{let i,o=0,s=()=>{o>=n?a("Max attempts reached without result"):(i=e(),o+=t,null==i?setTimeout(s,t):r(i))};s()}))}((()=>o.current?.getResponse()),{interval:200,timeout:2e4})}catch(e){throw new $t("Captcha failed",null,c.PrivyErrorCode.CAPTCHA_TIMEOUT)}}},children:t})},exports.CaptchaScreen=ic,exports.CenteredItem=qa,exports.CenteredItemWithGap=Za,exports.CenteredItemWithPadding=Ya,exports.CenteredScreenHeader=Ui,exports.Chip=xu,exports.Chip$1=Fl,exports.CloseButton=Nl,exports.ConnectEmailForm=tg,exports.ConnectOnlyLandingScreen=$p,exports.ConnectOnlyStatusScreen=Tu,exports.ConnectOrCreateScreen=Bh,exports.ConnectPhoneNumberForm=wh,exports.ConnectionLoader=Cr,exports.ConnectionStatusScreen=yc,exports.CopyableText=dl,exports.CopytoClipboardButton=Lg,exports.DEFAULT_API_TIMEOUT_MS=2e4,exports.DEFAULT_PRIVY_API_URL="https://auth.privy.io",exports.DEFAULT_SUCCESS_SCREEN_DURATION_MS=rt,exports.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS=at,exports.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS=2500,exports.DEFAULT_TOKENS_DATA=La,exports.DEPRECATED_REFRESH_TOKEN="deprecated",exports.Discord=yt,exports.EmailUpdateForm=bl,exports.EmbeddedButton=Rr,exports.EmbeddedWalletConnectingScreen=Mg,exports.EmbeddedWalletKeyExportScreen=Ig,exports.EmbeddedWalletOnAccountCreateScreen=tl,exports.ErrorMessage=wl,exports.ErrorScreen=Rs,exports.ErrorScreenView=Ds,exports.EthereumNullConnector=gn,exports.EthereumWalletConnector=un,exports.Farcaster=qp,exports.FarcasterConnectStatusScreen=ah,exports.FundingMethodSelectionScreen=Vp,exports.Github=ft,exports.Google=xt,exports.Grow=ar,exports.HEADLESS_OAUTH_KEY="privy:headless_oauth",exports.Header=Pl,exports.Hide=pr,exports.IDENTITY_TOKEN_COOKIE_KEY="privy-id-token",exports.IDENTITY_TOKEN_STORAGE_KEY="privy:id_token",exports.InjectedWalletIcon=bu,exports.InputContainerForm=kl,exports.Instagram=vt,exports.JUPITER_SWAP_PROGRAM_IDS=["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"],exports.LAMPORTS_PER_SOL=Fa,exports.LabelSm=td,exports.LabelXs=kc,exports.LandingScreen=cg,exports.Line=wt,exports.LinkConflictScreen=Qs,exports.LinkedIn=Ct,exports.Loader=kr,exports.LoginMethodButton=dr,exports.LoginMethodIconWrapper=ur,exports.ManualTransferScreen=zc,exports.Metamask=yn,exports.ModalFooter=wr,exports.ModalHeader=Hr,exports.ModalProvider=t=>{let r=Gn(),a=t.authenticated,[i,o]=n.useState(t.initialScreen);n.useEffect((()=>{a||!t.initialScreen||t.initialScreen.isUnauthenticatedScreem||t.setInitialScreen(null)}),[a]);let s=n.useRef(null);n.useEffect((()=>{t.open||(s.current=null)}),[t.open]),n.useEffect((()=>{s.current=null}),[t.initialScreen]);let l={app:r,data:t.data,setModalData:t.setModalData,currentScreen:t.initialScreen,lastScreen:i,navigate:(e,n=!0)=>{t.setInitialScreen(e),n&&o(t.initialScreen)},navigateBack:()=>{t.setInitialScreen(i)},resetNavigation:()=>{t.setInitialScreen(null),o(null)},onUserCloseViaDialogOrKeybindRef:s};/*#__PURE__*/return e.jsxs(Yn.Provider,{value:l,children:[("string"==typeof r.appearance.logo||"img"===r.appearance.logo?.type)&&/*#__PURE__*/e.jsx(Mn,{src:"string"==typeof r.appearance.logo?r.appearance.logo:r.appearance.logo.props.src}),t.children]})},exports.MoonpayStatusScreen=Lp,exports.NetworkIcon=qu,exports.NeutralSpinner=Kr,exports.OAUTH_DISABLE_SIGNUP_KEY="privy:oauth_disable_signup",exports.ON_RAMP_COMPLETE_ANALYTICS_EVENT=Wc,exports.OpenLinkButton=Gp,exports.PRIVY_ACCESS_TOKEN_STORAGE_KEY="privy:pat",exports.Phantom=fn,exports.PrimaryButton=Pr,exports.PrivyAppConfigProvider=({children:t,client:r,legacyClient:a,clientConfig:i,appClientId:o})=>{let[s,l]=n.useState(null),c=n.useMemo((()=>Hn(s??Vn,i,!!s,"undefined"!=typeof window?window.location.origin:void 0,o)),[s,i,o]);return n.useEffect((()=>{if(!s)return;let e=function(e){if(!e)return{};let{appearance:t,supportedChains:n,defaultChain:r,externalWallets:a,...i}=e;return{...i,...n?{supportedChains:n.map((e=>e.id))}:void 0,...r?{defaultChain:r.id}:void 0,...a?{walletConnect:a.walletConnect?{enabled:a.walletConnect.enabled}:void 0,coinbaseWallet:a.coinbaseWallet,solana:{connectors:a.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0}}(i),t=function(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t,a=0;a<e.length;a++)n=Math.imul(n^(t=e.charCodeAt(a)),2654435761),r=Math.imul(r^t,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&(r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909)))+(n>>>0)}(JSON.stringify(e)).toString(),n=`privy:sent:${s.id}:${t}`;localStorage.getItem(n)||(a.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(n,"t"))}),[i,s]),n.useEffect((()=>{s||(async()=>{try{await r.initialize();let e=r.app.getConfig();e.custom_api_url&&a.updateApiUrl(e.custom_api_url),l(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),/*#__PURE__*/e.jsx(qn.Provider,{value:{appConfig:c,isServerConfigLoaded:!!s},children:t})},exports.PrivyEventsContext=Jn,exports.PrivyIframeError=Li,exports.PrivyPluginProvider=({children:t})=>{let r=n.useRef({});/*#__PURE__*/return e.jsx(Jl.Provider,{value:{plugins:r},children:t})},exports.PrivyProviderRpcError=an,exports.PrivyProxyProvider=pn,exports.QrCode=vl,exports.RAYDIUM_SWAP_PROGRAM_IDS=["CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C","CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW"],exports.REFRESH_TOKEN_COOKIE_KEY="privy-refresh-token",exports.REFRESH_TOKEN_STORAGE_KEY="privy:refresh_token",exports.RecentlyUsedAccountProvider=({children:t})=>{let r=Gn(),[a,i]=n.useState({});return tr("login",{onComplete:({loginAccount:e})=>{e&&"passkey"!==e.type&&"cross_app"!==e.type&&("wallet"!==e.type||"privy"!==e.walletClientType)&&(Ye.put(ns(r.id),e.type),"wallet"===e.type?(Ye.put(rs(r.id),e.walletClientType),Ye.put(as(r.id),e.chainType),i({accountType:e.type,walletClientType:e.walletClientType,chainType:e.chainType})):(Ye.del(rs(r.id)),Ye.del(as(r.id)),i({accountType:e.type})))}}),n.useEffect((()=>{if(!r.id)return;let e=Ye.get(ns(r.id)),t=Ye.get(rs(r.id)),n=Ye.get(as(r.id));e&&i("wallet"===e?{accountType:e,walletClientType:t,chainType:n}:{accountType:e})}),[r.id]),/*#__PURE__*/e.jsx(ts.Provider,{value:a,children:t})},exports.RefactorSpacerBottom=ei,exports.RefactorSpacerTop=Ja,exports.Row=id,exports.Rows=ad,exports.RunEffectOnce=nt,exports.SESSION_COOKIE_KEY="privy-session",exports.SOLANA_FUNDING_PLUGIN_ID=vp,exports.SOLANA_LEDGER_PLUGIN_ID=tc,exports.STATE_CODE_KEY=it,exports.SYSTEM_PROGRAM_ID="11111111111111111111111111111111",exports.ScreenLayout=ba,exports.ScrollContainer=Ll,exports.SecondaryButton=Fr,exports.SendSolanaTransactionScreenView=({img:t,title:r,subtitle:a,cta:i,instructions:o,network:s,blockExplorerUrl:c,isMissingFunds:d,submitError:u,parseError:p,total:h,swap:g,transactingWalletAddress:m,fee:y,balance:f,disabled:x,isSubmitting:v,isPreparing:w,isTokenPriceLoading:C,onClick:b,onClose:j,onBack:k})=>{let T=w||C,[A,S]=n.useState(!1);/*#__PURE__*/return e.jsxs(e.Fragment,{children:[/*#__PURE__*/e.jsx(Hr,{onClose:j,backFn:k}),t&&/*#__PURE__*/e.jsx(Ed,{children:t}),/*#__PURE__*/e.jsx(jc,{style:{marginTop:t?"1.5rem":0},children:r}),/*#__PURE__*/e.jsx(bc,{children:a}),/*#__PURE__*/e.jsxs(ad,{style:{marginTop:"2rem",marginBottom:".5rem"},children:[(h||T)&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsx(ld,{$isLoading:T,children:h})]}),g&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Swap"}),/*#__PURE__*/e.jsx(ld,{children:g})]}),s&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Network"}),/*#__PURE__*/e.jsx(ld,{children:s})]}),(y||T)&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Estimated fee"}),/*#__PURE__*/e.jsx(ld,{$isLoading:T,children:y})]})]}),/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(rd,{onClick:()=>S((e=>!e)),children:[/*#__PURE__*/e.jsx("span",{children:"Advanced"}),/*#__PURE__*/e.jsx(O.ChevronDownIcon,{height:"16px",width:"16px",strokeWidth:"2",style:{transition:"all 300ms",transform:A?"rotate(180deg)":void 0}})]})}),A&&/*#__PURE__*/e.jsx(e.Fragment,{children:o.map(((t,n)=>"sol-transfer"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Transfer ",t.withSeed?"with seed":""]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsxs(ld,{children:[l.formatTokenAmount({amount:t.value,decimals:t.token.decimals})," ",t.token.symbol]})]}),!!t.toAccount&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Destination"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.toAccount,url:c})})]})]},n):"spl-transfer"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Transfer ",t.token.symbol]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsx(ld,{children:t.value.toString()})]}),!!t.fromAta&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Source"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.fromAta,url:c})})]}),!!t.toAta&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Destination"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.toAta,url:c})})]}),!!t.token.address&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.token.address,url:c})})]})]},n):"ata-creation"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsx(kc,{children:"Create token account"})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Program ID"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.program,url:c})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Owner"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.owner,url:c})})]})]},n):"create-account"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Create account ",t.withSeed?"with seed":""]})}),!!t.account&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Account"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.account,url:c})})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount"}),/*#__PURE__*/e.jsxs(ld,{children:[l.formatTokenAmount({amount:t.value,decimals:9})," SOL"]})]})]},n):"spl-init-account"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsx(kc,{children:"Initialize token account"})}),!!t.account&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Account"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.account,url:c})})]}),!!t.mint&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Mint"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mint,url:c})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Owner"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.owner,url:c})})]})]},n):"spl-close-account"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsx(kc,{children:"Close token account"})}),!!t.source&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Source"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.source,url:c})})]}),!!t.destination&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Destination"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.destination,url:c})})]}),!!t.owner&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Owner"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.owner,url:c})})]})]},n):"spl-sync-native"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsx(kc,{children:"Sync native"})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Program ID"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.program,url:c})})]})]},n):"raydium-swap-base-input"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Raydium swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount in"}),/*#__PURE__*/e.jsx(ld,{children:t.amountIn.toString()})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Minimum amount out"}),/*#__PURE__*/e.jsx(ld,{children:t.minimumAmountOut.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:c})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:c})})]})]},n):"raydium-swap-base-output"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Raydium swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Max amount in"}),/*#__PURE__*/e.jsx(ld,{children:t.maxAmountIn.toString()})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount out"}),/*#__PURE__*/e.jsx(ld,{children:t.amountOut.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:c})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:c})})]})]},n):"jupiter-swap-shared-accounts-route"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Jupiter swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"In amount"}),/*#__PURE__*/e.jsx(ld,{children:t.inAmount.toString()})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Quoted out amount"}),/*#__PURE__*/e.jsx(ld,{children:t.quotedOutAmount.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:c})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:c})})]})]},n):"jupiter-swap-exact-out-route"===t.type?/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsx(id,{children:/*#__PURE__*/e.jsxs(kc,{children:["Jupiter swap"," ",t.tokenIn&&t.tokenOut?`${t.tokenIn.symbol} → ${t.tokenOut.symbol}`:""]})}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Quoted in amount"}),/*#__PURE__*/e.jsx(ld,{children:t.quotedInAmount.toString()})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Amount out"}),/*#__PURE__*/e.jsx(ld,{children:t.outAmount.toString()})]}),t.mintIn&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token in"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintIn,url:c})})]}),t.mintOut&&/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Token out"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.mintOut,url:c})})]})]},n):/*#__PURE__*/e.jsxs(Ad,{children:[/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Program ID"}),/*#__PURE__*/e.jsx(ld,{children:/*#__PURE__*/e.jsx(Cs,{address:t.program,url:c})})]}),/*#__PURE__*/e.jsxs(id,{children:[/*#__PURE__*/e.jsx(td,{children:"Data"}),/*#__PURE__*/e.jsx(ld,{children:t.discriminator})]})]},n)))}),/*#__PURE__*/e.jsx(ar,{}),u?/*#__PURE__*/e.jsx(wl,{style:{marginTop:"2rem"},children:u.message}):p?/*#__PURE__*/e.jsx(wl,{style:{marginTop:"2rem"},children:Sd}):null,/*#__PURE__*/e.jsx(Td,{$useSmallMargins:!(!p&&!u),title:"Your wallet",address:m,balance:f,errMsg:w||p||u||!d?void 0:"Add funds on Solana to complete transaction."}),/*#__PURE__*/e.jsx(Pr,{style:{marginTop:"1rem"},loading:v,disabled:x||w,onClick:b,children:i}),/*#__PURE__*/e.jsx(xr,{})]})},exports.SendTransactionScreen=hu,exports.SignRequestScreen=Hg,exports.SiweFlow=St,exports.SiwsFlow=It,exports.SolanaNullConnector=An,exports.SolanaPriceDisplay=({quantities:t,tokenPrice:n,tokenSymbol:r="SOL",tokenDecimals:a=9})=>{let i=t.reduce(((e,t)=>e+t),0n),o=n&&"SOL"===r&&9===a?Wa(i,n):void 0,l="SOL"===r&&9===a?Ra(i):`${s.formatUnits(i,a)} ${r}`;/*#__PURE__*/return e.jsx(Ua,{children:o?/*#__PURE__*/e.jsx(e.Fragment,{children:"<$0.01"===o?
27
- /*#__PURE__*/e.jsxs(Va,{children:[/*#__PURE__*/e.jsx(Ha,{children:"<"}),"$0.01"]}):o}):l})},exports.SolanaWalletConnector=Tn,exports.Spotify=bt,exports.Subtitle=bc,exports.TOKEN_2022_PROGRAM_ID="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",exports.TOKEN_PROGRAM_ID="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",exports.TelegramAuthFlow=class{async authenticate(){if(!this.api)throw new c.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(c.telegramAccountAuthenticatePath,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw c.formatApiError(e)}}async link(){if(!this.api)throw new c.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(c.telegramAccountLinkPath,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw c.formatApiError(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}},exports.TelegramAuthScreen=Ih,exports.Tiktok=jt,exports.Title=jc,exports.TodoItem=Su,exports.TodoList=Au,exports.TransactionDetails=Ti,exports.TransactionErrorView=_d,exports.TransferFromWalletScreen=bp,exports.Twitter=kt,exports.UseWalletsContext=Pi,exports.UserLimitReachedScreen=hc,exports.VERSION="3.0.2-beta-20250925222239",exports.Value=ld,exports.WALLET_PROXY_TIMEOUT=3e4,exports.WalletCards=Tl,exports.WalletConnectV2WalletConnector=Xn,exports.WalletConnector=cn,exports.WalletIcon=Ml,exports.WalletInfoCard=Fc,exports.WalletLink=ji,exports.areWalletArraysEqual=ln,exports.close=()=>{let e=Wl.getState().resolvers;e||console.warn("useActiveWalletStore: Called close while modal was not open"),Wl.setState({isModalOpen:!1}),e?.resolve({wallet:Wl.getState().wallet})},exports.constructURL=Bt,exports.convertInitDataRawToTelegramWebAppData=Yt,exports.createCodeVerifier=ut,exports.createStateCode=pt,exports.createWalletAtIndex=Ki,exports.deriveCodeChallengeFromCodeVerifier=ht,exports.detectCompletingTelegramFlow=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),n=e.get("hash"),r=Number(e.get("auth_date")||""),a=e.get("first_name");if(t&&a&&r&&n)return Object.fromEntries(e.entries())}())?(Zt(),{flowType:"login-url",authData:e}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=Yt(e.replace("#tgWebAppData=","")),{user:n,auth_date:r,hash:a}=t;return n&&r&&a?t:void 0}())?(Zt(),{flowType:"web-app",authData:e}):void 0},exports.detectInjectedConnectors=async function({store:e,walletList:t,externalWalletConfig:n,walletChainType:r,timeout:a=3e3}){let i=!1,o=window;return new Promise((s=>{function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);let a=e.getProviders();console.debug("Detected injected providers:",a.map((e=>e.info)));let o=[];for(let e of a)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===r&&"app.phantom"===e.info.rdns||o.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==r)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let n=[];if(t.providers?.length)for(let e of t.providers)e&&n.push(e);return n.push(e.ethereum),n}()){let t=Pt(e);if(!a.some((e=>e.info.name===t))){if(Nt(e,!0)&&!o.find((e=>"metamask"===e.type))){o.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!o.find((e=>"phantom"===e.type))){o.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!o.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==n.coinbaseWallet?.config?.preference?.options))){o.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}o.find((e=>"unknown_browser_extension"===e.type))||o.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}s(o)}o.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout((()=>{l()}),a))}))},exports.e=gt,exports.e$1=function(){try{let e="privy:__session_storage__test",t=new Ge;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}},exports.e$2=Mi,exports.e$3=ju,exports.embeddedWalletRecoveryScreen=bg,exports.emitPrivyEvent=nr,exports.errorIndicatesMaxMfaRetries=function(e){return!!Wi(e)&&"mfa_verification_max_attempts_reached"===e.type},exports.errorIndicatesMfaCanceled=function(e){return!!function(e){let t=e.type;return"string"==typeof t&&"client_error"===t}(e)&&"MFA canceled"===e.message},exports.errorIndicatesMfaRateLimit=function(e){return!(!Wi(e)||!e.message.includes("code 429"))},exports.errorIndicatesMfaTimeout=function(e){return!!Wi(e)&&"mfa_timeout"===e.type},exports.errorIndicatesMfaVerificationFailed=function(e){return!!Wi(e)&&"missing_or_invalid_mfa"===e.type},exports.errorIndicatesRecoveryIsNeeded=Di,exports.fetchWalletBalance=Dc,exports.formatChainIdToCAIP2=zt,exports.formatConnectorError=nn,exports.formatErc20TokenAmount=Yc,exports.formatWalletAddress=Wt,exports.generateTypedDataWithDomainType=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},n=e.types.EIP712Domain??Object.entries(e.domain).map((([e,n])=>{if(null!=n&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:n}}},exports.getChainName=Rc,exports.getCodeVerifier=function(){let e=Ye.get(ot);if(!e)throw new c.PrivyClientError("Authentication error.");return e},exports.getEntropyDetailsForUser=Qt,exports.getErc20Balance=Bc,exports.getErc20TokenInfo=$c,exports.getFormattedUsdFromLamports=Wa,exports.getGuestCredentialStorageKey=e=>`privy:guest:${e}`,exports.getJsonRpcEndpointFromChain=Ft,exports.getNativeCurrencyFromLamports=Ra,exports.getNativeCurrencyFromWei=Pa,exports.getPrivyWalletsWithFilter=Zi,exports.getProviderAccessTokenStorageKey=e=>`privy:cross-app:${e}`,exports.getPublicClient=Mt,exports.getRpcTimeout=dn,exports.getUsdcMintAddress=Oc,exports.getWalletConfigForConnector=wn,exports.i=gu,exports.invokeUntilSettled=Ot,exports.isBaseConnectedEthereumWallet=sn,exports.isBaseConnectedSolanaWallet=function(e){return"solana"===e.type},exports.isEthereumWalletConnector=function(e){return"ethereum"===e.chainType},exports.isSolanaWalletConnector=Sn,exports.l=Hl,exports.loadConnectionHistory=bn,exports.mobileWalletsConfig=vn,exports.open=async()=>{let e,t,n=new Promise(((n,r)=>{e=n,t=r}));return Dl.setState({}),Wl.setState({isModalOpen:!0,resolvers:{resolve:e,reject:t}}),await n},exports.openHref=tt,exports.parseAdditionalSigners=e=>e?.map((e=>({signer_id:e.signerId,override_policy_ids:e.policyIds}))),exports.prepareSiweMessageWithNonce=At,exports.prepareSiwsMessageWithNonce=Et,exports.prepareTransactionRequest=_i,exports.privyEventsDefault={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},connectOrCreateWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},update:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},signTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]},fundSolanaWallet:{onUserExited:[]},customAuth:{onAuthenticated:[],onUnauthenticated:[]}},exports.randomBytes=dt,exports.s=Ye,exports.setActiveWallet=Rl,exports.setExternalWalletState=In,exports.shouldCreateEmbeddedEthWallet=hs,exports.shouldCreateEmbeddedSolWallet=ms,exports.shouldProceedtoEmbeddedWalletCreationFlow=fs,exports.stripUrlOAuthParamsAndRemoveStateCode=Tt,exports.toActiveWalletKey=Ol,exports.toDisplayFromAccountType=es,exports.toEmbeddedWalletSetRecoveryScreen=Cg,exports.toHex=e=>"string"==typeof e?e:"0x"+e.toString(16),exports.toSolanaWalletClientType=kn,exports.triggerPopup=Ri,exports.updateBalance=(e,t,n)=>{Dl.setState((r=>({[e]:{...r[e],[t]:n}})))},exports.useActiveWalletStore=Wl,exports.useAppConfig=Gn,exports.useBalance=(e,t)=>Dl((n=>n[e]?.[t])),exports.useCaptcha=qt,exports.useEmitPrivyEvent=rr,exports.useGetSolPrice=Ei,exports.useGetTokenPrice=Ii,exports.useIsModalOpen=()=>Wl((e=>e.isModalOpen)),exports.useIsServerConfigLoaded=()=>{let{isServerConfigLoaded:e}=n.useContext(qn);return e},exports.usePlugins=ec,exports.usePrivyEventSubscription=tr,exports.usePrivyModal=Zn,exports.useRecentlyUsedLogin=is,exports.useRegisterPlugin=(...e)=>{let{plugins:t}=n.useContext(Jl);n.useEffect((()=>{for(let n of e)t.current[n.id]=n;return()=>{for(let n of e)delete t.current[n.id]}}),[t])},exports.useWalletBalance=Lc,exports.useWallets=Ni,exports.validateEmail=Lt;
27
+ /*#__PURE__*/e.jsxs(Va,{children:[/*#__PURE__*/e.jsx(Ha,{children:"<"}),"$0.01"]}):o}):l})},exports.SolanaWalletConnector=Tn,exports.Spotify=bt,exports.Subtitle=bc,exports.TOKEN_2022_PROGRAM_ID="TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",exports.TOKEN_PROGRAM_ID="TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",exports.TelegramAuthFlow=class{async authenticate(){if(!this.api)throw new c.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(c.telegramAccountAuthenticatePath,{captcha_token:this.meta.captchaToken,telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw c.formatApiError(e)}}async link(){if(!this.api)throw new c.PrivyClientError("Auth flow has no API instance");try{return await this.api.post(c.telegramAccountLinkPath,{telegram_auth_result:this.meta.telegramAuthResult,telegram_web_app_data:this.meta.telegramWebAppData})}catch(e){throw c.formatApiError(e)}}constructor(e,t=!1){this.meta={disableSignup:!1},this.meta={captchaToken:e,disableSignup:!1},this.meta.disableSignup=t}},exports.TelegramAuthScreen=Ih,exports.Tiktok=jt,exports.Title=jc,exports.TodoItem=Su,exports.TodoList=Au,exports.TransactionDetails=Ti,exports.TransactionErrorView=_d,exports.TransferFromWalletScreen=bp,exports.Twitter=kt,exports.UseWalletsContext=Pi,exports.UserLimitReachedScreen=hc,exports.VERSION="3.1.0-beta-20251002001741",exports.Value=ld,exports.WALLET_PROXY_TIMEOUT=3e4,exports.WalletCards=Tl,exports.WalletConnectV2WalletConnector=Xn,exports.WalletConnector=cn,exports.WalletIcon=Ml,exports.WalletInfoCard=Fc,exports.WalletLink=ji,exports.areWalletArraysEqual=ln,exports.close=()=>{let e=Wl.getState().resolvers;e||console.warn("useActiveWalletStore: Called close while modal was not open"),Wl.setState({isModalOpen:!1}),e?.resolve({wallet:Wl.getState().wallet})},exports.constructURL=Bt,exports.convertInitDataRawToTelegramWebAppData=Yt,exports.createCodeVerifier=ut,exports.createStateCode=pt,exports.createWalletAtIndex=Ki,exports.deriveCodeChallengeFromCodeVerifier=ht,exports.detectCompletingTelegramFlow=function(){let e;return(e=function(){let e=new URLSearchParams(window.location.search),t=Number(e.get("id")||""),n=e.get("hash"),r=Number(e.get("auth_date")||""),a=e.get("first_name");if(t&&a&&r&&n)return Object.fromEntries(e.entries())}())?(Zt(),{flowType:"login-url",authData:e}):(e=function(){let e=window.location.hash;if(!e||!e.startsWith("#tgWebAppData"))return;let t=Yt(e.replace("#tgWebAppData=","")),{user:n,auth_date:r,hash:a}=t;return n&&r&&a?t:void 0}())?(Zt(),{flowType:"web-app",authData:e}):void 0},exports.detectInjectedConnectors=async function({store:e,walletList:t,externalWalletConfig:n,walletChainType:r,timeout:a=3e3}){let i=!1,o=window;return new Promise((s=>{function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);let a=e.getProviders();console.debug("Detected injected providers:",a.map((e=>e.info)));let o=[];for(let e of a)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===r&&"app.phantom"===e.info.rdns||o.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==r)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let n=[];if(t.providers?.length)for(let e of t.providers)e&&n.push(e);return n.push(e.ethereum),n}()){let t=Pt(e);if(!a.some((e=>e.info.name===t))){if(Nt(e,!0)&&!o.find((e=>"metamask"===e.type))){o.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!o.find((e=>"phantom"===e.type))){o.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!o.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==n.coinbaseWallet?.config?.preference?.options))){o.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}o.find((e=>"unknown_browser_extension"===e.type))||o.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}s(o)}o.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout((()=>{l()}),a))}))},exports.e=gt,exports.e$1=function(){try{let e="privy:__session_storage__test",t=new Ge;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}},exports.e$2=Mi,exports.e$3=ju,exports.embeddedWalletRecoveryScreen=bg,exports.emitPrivyEvent=nr,exports.errorIndicatesMaxMfaRetries=function(e){return!!Wi(e)&&"mfa_verification_max_attempts_reached"===e.type},exports.errorIndicatesMfaCanceled=function(e){return!!function(e){let t=e.type;return"string"==typeof t&&"client_error"===t}(e)&&"MFA canceled"===e.message},exports.errorIndicatesMfaRateLimit=function(e){return!(!Wi(e)||!e.message.includes("code 429"))},exports.errorIndicatesMfaTimeout=function(e){return!!Wi(e)&&"mfa_timeout"===e.type},exports.errorIndicatesMfaVerificationFailed=function(e){return!!Wi(e)&&"missing_or_invalid_mfa"===e.type},exports.errorIndicatesRecoveryIsNeeded=Di,exports.fetchWalletBalance=Dc,exports.formatChainIdToCAIP2=zt,exports.formatConnectorError=nn,exports.formatErc20TokenAmount=Yc,exports.formatWalletAddress=Wt,exports.generateTypedDataWithDomainType=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},n=e.types.EIP712Domain??Object.entries(e.domain).map((([e,n])=>{if(null!=n&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:n}}},exports.getChainName=Rc,exports.getCodeVerifier=function(){let e=Ye.get(ot);if(!e)throw new c.PrivyClientError("Authentication error.");return e},exports.getEntropyDetailsForUser=Qt,exports.getErc20Balance=Bc,exports.getErc20TokenInfo=$c,exports.getFormattedUsdFromLamports=Wa,exports.getGuestCredentialStorageKey=e=>`privy:guest:${e}`,exports.getJsonRpcEndpointFromChain=Ft,exports.getNativeCurrencyFromLamports=Ra,exports.getNativeCurrencyFromWei=Pa,exports.getPrivyWalletsWithFilter=Zi,exports.getProviderAccessTokenStorageKey=e=>`privy:cross-app:${e}`,exports.getPublicClient=Mt,exports.getRpcTimeout=dn,exports.getUsdcMintAddress=Oc,exports.getWalletConfigForConnector=wn,exports.i=gu,exports.invokeUntilSettled=Ot,exports.isBaseConnectedEthereumWallet=sn,exports.isBaseConnectedSolanaWallet=function(e){return"solana"===e.type},exports.isEthereumWalletConnector=function(e){return"ethereum"===e.chainType},exports.isSolanaWalletConnector=Sn,exports.l=Hl,exports.loadConnectionHistory=bn,exports.mobileWalletsConfig=vn,exports.open=async()=>{let e,t,n=new Promise(((n,r)=>{e=n,t=r}));return Dl.setState({}),Wl.setState({isModalOpen:!0,resolvers:{resolve:e,reject:t}}),await n},exports.openHref=tt,exports.parseAdditionalSigners=e=>e?.map((e=>({signer_id:e.signerId,override_policy_ids:e.policyIds}))),exports.prepareSiweMessageWithNonce=At,exports.prepareSiwsMessageWithNonce=Et,exports.prepareTransactionRequest=_i,exports.privyEventsDefault={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},connectOrCreateWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},update:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},signTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]},fundSolanaWallet:{onUserExited:[]},customAuth:{onAuthenticated:[],onUnauthenticated:[]}},exports.randomBytes=dt,exports.s=Ye,exports.setActiveWallet=Rl,exports.setExternalWalletState=In,exports.shouldCreateEmbeddedEthWallet=hs,exports.shouldCreateEmbeddedSolWallet=ms,exports.shouldProceedtoEmbeddedWalletCreationFlow=fs,exports.stripUrlOAuthParamsAndRemoveStateCode=Tt,exports.toActiveWalletKey=Ol,exports.toDisplayFromAccountType=es,exports.toEmbeddedWalletSetRecoveryScreen=Cg,exports.toHex=e=>"string"==typeof e?e:"0x"+e.toString(16),exports.toSolanaWalletClientType=kn,exports.triggerPopup=Ri,exports.updateBalance=(e,t,n)=>{Dl.setState((r=>({[e]:{...r[e],[t]:n}})))},exports.useActiveWalletStore=Wl,exports.useAppConfig=Gn,exports.useBalance=(e,t)=>Dl((n=>n[e]?.[t])),exports.useCaptcha=qt,exports.useEmitPrivyEvent=rr,exports.useGetSolPrice=Ei,exports.useGetTokenPrice=Ii,exports.useIsModalOpen=()=>Wl((e=>e.isModalOpen)),exports.useIsServerConfigLoaded=()=>{let{isServerConfigLoaded:e}=n.useContext(qn);return e},exports.usePlugins=ec,exports.usePrivyEventSubscription=tr,exports.usePrivyModal=Zn,exports.useRecentlyUsedLogin=is,exports.useRegisterPlugin=(...e)=>{let{plugins:t}=n.useContext(Jl);n.useEffect((()=>{for(let n of e)t.current[n.id]=n;return()=>{for(let n of e)delete t.current[n.id]}}),[t])},exports.useWalletBalance=Lc,exports.useWallets=Ni,exports.validateEmail=Lt;
@@ -1 +1 @@
1
- "use strict";var e=require("@abstract-foundation/agw-client"),r=require("@abstract-foundation/agw-client/actions"),n=require("viem"),t=require("viem/accounts"),a=require("viem/chains"),i=require("./privy-context-C4y2c3Ko.js"),o=require("./SignRequestScreen-CCe20ORz.js"),s=require("./internal-context-DNWjSiYq.js"),c=require("./getEmbeddedConnectedWallet-DTU4T9TJ.js"),l=require("./smart-wallets-CmBEmFub.js");require("react"),require("react/jsx-runtime"),require("lucide-react"),require("styled-components"),require("@scure/base"),require("@privy-io/js-sdk-core"),require("./paths-B00ZrFQm.js"),require("ofetch"),require("tinycolor2"),require("@heroicons/react/24/outline/UserCircleIcon"),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("@heroicons/react/20/solid/CheckIcon"),require("@heroicons/react/24/outline/EnvelopeIcon"),require("@heroicons/react/24/outline/PhoneIcon"),require("react-device-detect"),require("@heroicons/react/24/outline/ExclamationTriangleIcon"),require("@heroicons/react/24/outline/WalletIcon"),require("@heroicons/react/24/outline/ExclamationCircleIcon"),require("@heroicons/react/24/outline/Square2StackIcon"),require("fast-password-entropy"),require("secure-password-utilities"),require("secure-password-utilities/wordlists"),require("@heroicons/react/24/outline/LockClosedIcon"),require("@heroicons/react/24/outline/PencilSquareIcon"),require("jose"),require("@heroicons/react/24/outline/ArrowPathIcon"),require("@heroicons/react/24/outline/EyeIcon"),require("@heroicons/react/24/outline/EyeSlashIcon"),require("@heroicons/react/24/outline/KeyIcon"),require("@heroicons/react/24/solid/CheckCircleIcon"),require("@heroicons/react/24/outline/ArrowDownTrayIcon"),require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),require("@heroicons/react/24/outline/DocumentDuplicateIcon"),require("@heroicons/react/24/solid/XCircleIcon"),require("@heroicons/react/24/outline/ShieldCheckIcon"),require("@heroicons/react/24/outline"),require("@tanstack/react-virtual"),require("@heroicons/react/24/outline/CheckIcon"),require("qrcode"),require("viem/utils"),require("eventemitter3"),require("zustand"),require("@walletconnect/ethereum-provider"),require("@heroicons/react/24/outline/CreditCardIcon"),require("@heroicons/react/24/outline/QrCodeIcon"),require("@heroicons/react/24/solid/ArrowsRightLeftIcon"),require("@heroicons/react/24/outline/InformationCircleIcon"),require("@heroicons/react/24/outline/ClipboardDocumentIcon"),require("@heroicons/react/24/outline/ChevronDownIcon"),require("@privy-io/ethereum"),require("@heroicons/react/24/outline/CheckCircleIcon"),require("@heroicons/react/24/outline/GlobeAltIcon"),require("@headlessui/react"),require("@heroicons/react/24/outline/FingerPrintIcon"),require("permissionless"),require("permissionless/accounts"),require("permissionless/clients/pimlico"),require("viem/account-abstraction"),exports.useAbstractSmartWallets=function(){let{user:u}=i.usePrivyContext(),{hideWalletUIs:d,openPrivyModal:p,chains:h,appId:g,rpcConfig:y,client:m}=s.usePrivyInternal(),q=o.useAppConfig(),{wallets:I}=o.useWallets(),{setModalData:v}=o.usePrivyModal(),f=i.getPrivyEthereumWallet(u),T=!!f&&i.getIsUnifiedWallet(f),C=async(r=a.abstractTestnet.id)=>{let i=c.getEmbeddedConnectedWallet(I);if(!i)throw Error("No connected wallet found");let s="string"==typeof r?n.hexToNumber(r):r;if(![a.abstractTestnet.id,2741,a.zksync.id].includes(s))throw Error("Error, only Abstract and ZKSync Era chains are supported");let l=h.find((e=>e.id===s));if(!l)throw Error("Chain not configured");await i.switchChain(l.id);let u=await i.getEthereumProvider(),d=n.createWalletClient({account:i.address,transport:n.custom(u)}),p=t.toAccount({address:i.address,signMessage:d.signMessage,signTransaction:d.signTransaction,signTypedData:d.signTypedData});return await e.createAbstractClient({chain:l,transport:n.http(o.getJsonRpcEndpointFromChain(l,y,g)),publicTransport:n.http(o.getJsonRpcEndpointFromChain(l,y,g)),signer:p})};return{signMessage:async({message:e},r)=>{let n=await C(r);return new Promise((async(r,t)=>{let{entropyId:a,entropyIdVerifier:i}=o.getEntropyDetailsForUser(u);d.current=!0,v({connectWallet:{recoveryMethod:f.recoveryMethod,connectingWalletAddress:f.address,isUnifiedWallet:T,entropyId:a,entropyIdVerifier:i,onCompleteNavigateTo:o.SignRequestScreen,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>n.signMessage({message:e}),onSuccess:e=>r(e),onFailure:t,uiOptions:{isCancellable:!0}}}),p(o.EmbeddedWalletConnectingScreen)})).finally((()=>{d.current=!1}))},signTypedData:async(e,r)=>{let n=await C(r);return new Promise((async(r,t)=>{d.current=!0;let{entropyId:a,entropyIdVerifier:i}=o.getEntropyDetailsForUser(u);v({connectWallet:{recoveryMethod:f.recoveryMethod,connectingWalletAddress:f.address,isUnifiedWallet:T,entropyId:a,entropyIdVerifier:i,onCompleteNavigateTo:o.SignRequestScreen,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>n.signTypedData(e),onSuccess:e=>r(e),onFailure:t,uiOptions:{isCancellable:!0}}}),p(o.EmbeddedWalletConnectingScreen)})).finally((()=>{d.current=!1}))},sendTransaction:async e=>{let n=await C(e.chainId),t=[],a="calls"in e&&void 0!==e.calls;return t=a?[...e.calls]:[e],new Promise((async(i,s)=>{d.current=!0;let{entropyId:c,entropyIdVerifier:h}=o.getEntropyDetailsForUser(u);v({connectWallet:{recoveryMethod:f.recoveryMethod,connectingWalletAddress:f.address,isUnifiedWallet:T,entropyId:c,entropyIdVerifier:h,onCompleteNavigateTo:o.SendTransactionScreen,onFailure:()=>{}},sendTransaction:{transactionRequests:l.callsToTransactionRequests({calls:t,chain:n.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:h,transactingWalletAddress:n.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=a?r.getBatchTransactionObject(n.account.address,e):e;return await n.prepareAbstractTransactionRequest(t)},scanTransaction:async()=>{if(!m)throw Error("Privy client not found");let t=a?r.getBatchTransactionObject(n.account.address,e):e,i=await n.prepareAbstractTransactionRequest(t);return await m.scanTransaction({metadata:{domain:q.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>a?n.sendTransactionBatch(e):n.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:s,uiOptions:{isCancellable:!0}}}),p(o.EmbeddedWalletConnectingScreen)})).finally((()=>{d.current=!1}))},signTransaction:async e=>{let n=await C(e.chainId),t=[],a="calls"in e&&void 0!==e.calls;return t=a?[...e.calls]:[e],new Promise((async(i,s)=>{d.current=!0;let{entropyId:c,entropyIdVerifier:h}=o.getEntropyDetailsForUser(u);v({connectWallet:{recoveryMethod:f.recoveryMethod,connectingWalletAddress:f.address,isUnifiedWallet:T,entropyId:c,entropyIdVerifier:h,onCompleteNavigateTo:o.SendTransactionScreen,onFailure:()=>{}},sendTransaction:{transactionRequests:l.callsToTransactionRequests({calls:t,chain:n.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:h,transactingWalletAddress:n.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=a?r.getBatchTransactionObject(n.account.address,e):e;return await n.prepareAbstractTransactionRequest(t)},scanTransaction:async()=>{if(!m)throw Error("Privy client not found");let t=a?r.getBatchTransactionObject(n.account.address,e):e,i=await n.prepareAbstractTransactionRequest(t);return await m.scanTransaction({metadata:{domain:q.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:async()=>{let t=a?r.getBatchTransactionObject(n.account.address,e):e,i=await n.prepareAbstractTransactionRequest(t);return n.signTransaction(i)},onSuccess:e=>i(e.hash),onFailure:s,uiOptions:{isCancellable:!0}}}),p(o.EmbeddedWalletConnectingScreen)})).finally((()=>{d.current=!1}))}}};
1
+ "use strict";var e=require("@abstract-foundation/agw-client"),r=require("@abstract-foundation/agw-client/actions"),n=require("viem"),t=require("viem/accounts"),a=require("viem/chains"),i=require("./privy-context-C4y2c3Ko.js"),o=require("./SignRequestScreen-DV1Heklf.js"),s=require("./internal-context-DNWjSiYq.js"),c=require("./getEmbeddedConnectedWallet-DTU4T9TJ.js"),l=require("./smart-wallets-DeEe61HL.js");require("react"),require("react/jsx-runtime"),require("lucide-react"),require("styled-components"),require("@scure/base"),require("@privy-io/js-sdk-core"),require("./paths-B00ZrFQm.js"),require("ofetch"),require("tinycolor2"),require("@heroicons/react/24/outline/UserCircleIcon"),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("@heroicons/react/20/solid/CheckIcon"),require("@heroicons/react/24/outline/EnvelopeIcon"),require("@heroicons/react/24/outline/PhoneIcon"),require("react-device-detect"),require("@heroicons/react/24/outline/ExclamationTriangleIcon"),require("@heroicons/react/24/outline/WalletIcon"),require("@heroicons/react/24/outline/ExclamationCircleIcon"),require("@heroicons/react/24/outline/Square2StackIcon"),require("fast-password-entropy"),require("secure-password-utilities"),require("secure-password-utilities/wordlists"),require("@heroicons/react/24/outline/LockClosedIcon"),require("@heroicons/react/24/outline/PencilSquareIcon"),require("jose"),require("@heroicons/react/24/outline/ArrowPathIcon"),require("@heroicons/react/24/outline/EyeIcon"),require("@heroicons/react/24/outline/EyeSlashIcon"),require("@heroicons/react/24/outline/KeyIcon"),require("@heroicons/react/24/solid/CheckCircleIcon"),require("@heroicons/react/24/outline/ArrowDownTrayIcon"),require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon"),require("@heroicons/react/24/outline/DocumentDuplicateIcon"),require("@heroicons/react/24/solid/XCircleIcon"),require("@heroicons/react/24/outline/ShieldCheckIcon"),require("@heroicons/react/24/outline"),require("@tanstack/react-virtual"),require("@heroicons/react/24/outline/CheckIcon"),require("qrcode"),require("viem/utils"),require("eventemitter3"),require("zustand"),require("@walletconnect/ethereum-provider"),require("@heroicons/react/24/outline/CreditCardIcon"),require("@heroicons/react/24/outline/QrCodeIcon"),require("@heroicons/react/24/solid/ArrowsRightLeftIcon"),require("@heroicons/react/24/outline/InformationCircleIcon"),require("@heroicons/react/24/outline/ClipboardDocumentIcon"),require("@heroicons/react/24/outline/ChevronDownIcon"),require("@privy-io/ethereum"),require("@heroicons/react/24/outline/CheckCircleIcon"),require("@heroicons/react/24/outline/GlobeAltIcon"),require("@headlessui/react"),require("@heroicons/react/24/outline/FingerPrintIcon"),require("permissionless"),require("permissionless/accounts"),require("permissionless/clients/pimlico"),require("viem/account-abstraction"),exports.useAbstractSmartWallets=function(){let{user:u}=i.usePrivyContext(),{hideWalletUIs:d,openPrivyModal:p,chains:h,appId:g,rpcConfig:y,client:m}=s.usePrivyInternal(),q=o.useAppConfig(),{wallets:I}=o.useWallets(),{setModalData:v}=o.usePrivyModal(),f=i.getPrivyEthereumWallet(u),T=!!f&&i.getIsUnifiedWallet(f),C=async(r=a.abstractTestnet.id)=>{let i=c.getEmbeddedConnectedWallet(I);if(!i)throw Error("No connected wallet found");let s="string"==typeof r?n.hexToNumber(r):r;if(![a.abstractTestnet.id,2741,a.zksync.id].includes(s))throw Error("Error, only Abstract and ZKSync Era chains are supported");let l=h.find((e=>e.id===s));if(!l)throw Error("Chain not configured");await i.switchChain(l.id);let u=await i.getEthereumProvider(),d=n.createWalletClient({account:i.address,transport:n.custom(u)}),p=t.toAccount({address:i.address,signMessage:d.signMessage,signTransaction:d.signTransaction,signTypedData:d.signTypedData});return await e.createAbstractClient({chain:l,transport:n.http(o.getJsonRpcEndpointFromChain(l,y,g)),publicTransport:n.http(o.getJsonRpcEndpointFromChain(l,y,g)),signer:p})};return{signMessage:async({message:e},r)=>{let n=await C(r);return new Promise((async(r,t)=>{let{entropyId:a,entropyIdVerifier:i}=o.getEntropyDetailsForUser(u);d.current=!0,v({connectWallet:{recoveryMethod:f.recoveryMethod,connectingWalletAddress:f.address,isUnifiedWallet:T,entropyId:a,entropyIdVerifier:i,onCompleteNavigateTo:o.SignRequestScreen,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>n.signMessage({message:e}),onSuccess:e=>r(e),onFailure:t,uiOptions:{isCancellable:!0}}}),p(o.EmbeddedWalletConnectingScreen)})).finally((()=>{d.current=!1}))},signTypedData:async(e,r)=>{let n=await C(r);return new Promise((async(r,t)=>{d.current=!0;let{entropyId:a,entropyIdVerifier:i}=o.getEntropyDetailsForUser(u);v({connectWallet:{recoveryMethod:f.recoveryMethod,connectingWalletAddress:f.address,isUnifiedWallet:T,entropyId:a,entropyIdVerifier:i,onCompleteNavigateTo:o.SignRequestScreen,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>n.signTypedData(e),onSuccess:e=>r(e),onFailure:t,uiOptions:{isCancellable:!0}}}),p(o.EmbeddedWalletConnectingScreen)})).finally((()=>{d.current=!1}))},sendTransaction:async e=>{let n=await C(e.chainId),t=[],a="calls"in e&&void 0!==e.calls;return t=a?[...e.calls]:[e],new Promise((async(i,s)=>{d.current=!0;let{entropyId:c,entropyIdVerifier:h}=o.getEntropyDetailsForUser(u);v({connectWallet:{recoveryMethod:f.recoveryMethod,connectingWalletAddress:f.address,isUnifiedWallet:T,entropyId:c,entropyIdVerifier:h,onCompleteNavigateTo:o.SendTransactionScreen,onFailure:()=>{}},sendTransaction:{transactionRequests:l.callsToTransactionRequests({calls:t,chain:n.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:h,transactingWalletAddress:n.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=a?r.getBatchTransactionObject(n.account.address,e):e;return await n.prepareAbstractTransactionRequest(t)},scanTransaction:async()=>{if(!m)throw Error("Privy client not found");let t=a?r.getBatchTransactionObject(n.account.address,e):e,i=await n.prepareAbstractTransactionRequest(t);return await m.scanTransaction({metadata:{domain:q.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>a?n.sendTransactionBatch(e):n.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:s,uiOptions:{isCancellable:!0}}}),p(o.EmbeddedWalletConnectingScreen)})).finally((()=>{d.current=!1}))},signTransaction:async e=>{let n=await C(e.chainId),t=[],a="calls"in e&&void 0!==e.calls;return t=a?[...e.calls]:[e],new Promise((async(i,s)=>{d.current=!0;let{entropyId:c,entropyIdVerifier:h}=o.getEntropyDetailsForUser(u);v({connectWallet:{recoveryMethod:f.recoveryMethod,connectingWalletAddress:f.address,isUnifiedWallet:T,entropyId:c,entropyIdVerifier:h,onCompleteNavigateTo:o.SendTransactionScreen,onFailure:()=>{}},sendTransaction:{transactionRequests:l.callsToTransactionRequests({calls:t,chain:n.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:h,transactingWalletAddress:n.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=a?r.getBatchTransactionObject(n.account.address,e):e;return await n.prepareAbstractTransactionRequest(t)},scanTransaction:async()=>{if(!m)throw Error("Privy client not found");let t=a?r.getBatchTransactionObject(n.account.address,e):e,i=await n.prepareAbstractTransactionRequest(t);return await m.scanTransaction({metadata:{domain:q.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:async()=>{let t=a?r.getBatchTransactionObject(n.account.address,e):e,i=await n.prepareAbstractTransactionRequest(t);return n.signTransaction(i)},onSuccess:e=>i(e.hash),onFailure:s,uiOptions:{isCancellable:!0}}}),p(o.EmbeddedWalletConnectingScreen)})).finally((()=>{d.current=!1}))}}};