@privy-io/react-auth 1.59.8 → 1.59.9

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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var O1=Object.create;var xa=Object.defineProperty;var N1=Object.getOwnPropertyDescriptor;var D1=Object.getOwnPropertyNames;var F1=Object.getPrototypeOf,U1=Object.prototype.hasOwnProperty;var B1=(e,t)=>{for(var r in t)xa(e,r,{get:t[r],enumerable:!0})},Nd=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of D1(t))!U1.call(e,n)&&n!==r&&xa(e,n,{get:()=>t[n],enumerable:!(o=N1(t,n))||o.enumerable});return e};var y=(e,t,r)=>(r=e!=null?O1(F1(e)):{},Nd(t||!e||!e.__esModule?xa(r,"default",{value:e,enumerable:!0}):r,e)),H1=e=>Nd(xa({},"__esModule",{value:!0}),e);var jl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Dd=(e,t,r)=>(jl(e,t,"read from private field"),r?r.call(e):t.get(e)),Sa=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Kl=(e,t,r,o)=>(jl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Fd=(e,t,r)=>(jl(e,t,"access private method"),r);var i2={};B1(i2,{AsExternalProvider:()=>br,Captcha:()=>Ps,ConnectorManager:()=>Gn,PrivyClient:()=>Vn,PrivyProvider:()=>o1,PrivyProxyProvider:()=>Le,SUPPORTED_CHAINS:()=>Bn,VERSION:()=>Na,WalletConnector:()=>St,addRpcUrlOverrideToChain:()=>I1,errorIndicatesMaxMfaRetries:()=>qs,errorIndicatesMfaTimeout:()=>cn,errorIndicatesMfaVerificationFailed:()=>dn,getAccessToken:()=>Se,useConnectWallet:()=>f1,useCreateWallet:()=>y1,useExperimentalFarcasterSigner:()=>R1,useFundWallet:()=>g1,useLinkAccount:()=>u1,useLogin:()=>i1,useLoginWithEmail:()=>c1,useLoginWithOAuth:()=>l1,useLoginWithSms:()=>d1,useLogout:()=>s1,useMfa:()=>vn,useMfaEnrollment:()=>bi,useModalStatus:()=>_1,usePrivy:()=>V,useRegisterMfaListener:()=>As,useSendTransaction:()=>w1,useSetWalletPassword:()=>b1,useSignMessage:()=>T1,useSignTypedData:()=>x1,useToken:()=>k1,useWallets:()=>ki});module.exports=H1(i2);var Ea=require("@ethersproject/address"),Vl=require("@ethersproject/providers"),Qg=require("mipd"),ee=require("react");var Ud=require("ofetch"),mt=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Br=class extends mt{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},_=class extends mt{constructor(r,o,n){super(r,o,n);this.type="client_error"}},_a=class extends _{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var oe=class extends mt{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},we=e=>{if(e instanceof mt)return e;if(!(e instanceof Ud.FetchError))return Tt(e);if(!e.response)return new Br("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Br(t||"ApiError",e.response.status,r||o,e,n)},Tt=e=>e instanceof mt?e:e instanceof Error?new _(e.message,e):new _(`Internal error: ${e}`);var xn=class extends _{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},qt=class extends _{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Aa=class extends _{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var ka="/api/v1/sessions",Ra="/api/v1/sessions/logout",Bd="/api/v1/sessions/fork",Ia="/api/v1/sessions/fork/recover",Hd="/api/v1/siwe/init",Gd="/api/v1/siwe/authenticate",Vd="/api/v1/siwe/link",zd="/api/v1/siwe/unlink",qd="/api/v1/farcaster/init",$d="/api/v1/farcaster/authenticate",jd="/api/v1/farcaster/link",Kd="/api/v1/farcaster/status",Yd="/api/v1/farcaster/unlink",Jd="/api/v1/passwordless/init",Zd="/api/v1/passwordless/authenticate",Qd="/api/v1/passwordless/link",Xd="/api/v1/passwordless/unlink",ep="/api/v1/passwordless/update",tp="/api/v1/passwordless_sms/init",rp="/api/v1/passwordless_sms/link",op="/api/v1/passwordless_sms/unlink",np="/api/v1/passwordless_sms/authenticate",ip="/api/v1/oauth/init",ap="/api/v1/oauth/authenticate",sp="/api/v1/oauth/link",lp="/api/v1/oauth/unlink";var cp="/api/v1/mfa/passwordless_sms/init",dp="/api/v1/mfa/passwordless_sms/enroll";var pp="/api/v1/users/me/accept_terms",up="/api/v1/analytics_events",mp="/api/v1/plugins/moonpay_on_ramp/sign",fp="/api/v1/custom_jwt_account/authenticate";var Sn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{let t=await this.api.post(fp,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw we(t)}}async link(){throw new Error("Unimplemented")}};var xo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Zd,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw we(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Qd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw we(t)}}async sendCodeEmail(t,r){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new _("Email must be set when initialzing authentication.");try{return await this.api.post(Jd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw we(o)}}},Ma=class extends xo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new _("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(ep,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw we(r)}}};var $a=require("react-device-detect");var Yl=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Wa=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Jl(){try{let e="privy:__session_storage__test",t="blobby",r=new Wa;return r.put(e,t),r.del(e),!0}catch{return!1}}function G1(){return typeof window<"u"&&window.localStorage?new Wa:new Yl}var Q=G1();var tn=require("@ethersproject/providers");function hp(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var La=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var Zl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||La(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Zl(r))return!1}return!0},So=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),yp=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var gp="1.59.8";var Ql="4df5e2316331463a9130964bd6078dfa",Xl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",vp="34357d3c125c2bcf2ce2bc3309d98715",Oa="https://auth.privy.io",wp=2e4,at=1400,Cp=2500,Na=gp;var Zo="privy:token",ec="privy-token",Da="privy:refresh_token",tc="privy-refresh-token",Fa="privy-session",Oi="privy:session_transfer_token",z1="privy:wallet",Ni="privy:caid",Qo="privy:state_code",_n="privy:code_verifier",Xo="privy:headless_oauth",Ua=e=>`${z1}:${e}`,rc="privy:connectors",oc="privy:connections";var en=12e4,ao=1,nc="0x1",An=3e4,bp="https://api.moonpay.com/v1",Ep="https://api.moonpay.com/v1",Tp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Pp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",xp="0x420000000000000000000000000000000000000F",Sp=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var _p=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Ba=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Ap=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},_o=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},ic=e=>new Promise(t=>setTimeout(t,e));function kp(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var Rp=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await ic(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Ha=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var Ip=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),rn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Mp(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of hp()){let u=La(d);if(!l.some(v=>v.info.name===u)){if(Zl(d,!0)&&!s.find(v=>v.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(v=>v.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(v=>v.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function kn(e){return`eip155:${String(Number(e))}`}var Ga=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new oe(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+Ql:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+Xl:i=a.rpcUrls.default?.http[0];if(!i)throw new oe(`No RPC url found for ${e}`);return i},Wp=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new oe(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},so=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new oe(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new tn.StaticJsonRpcProvider(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new tn.StaticJsonRpcProvider({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.infura.http[0]+"/"+Ql):a.rpcUrls.blast?.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.blast.http[0]+"/"+Xl):i=new tn.StaticJsonRpcProvider(a.rpcUrls.default?.http[0]),!i)throw new oe(`No RPC url found for ${e}`);return i},Va=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var za=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Rn))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Rn={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function q1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var Lp=e=>e in Rn,Op=e=>{let t=Rn[e].mobile;if("native"in t)return t.native};function Np(e,t){let r=q1(t);if(r.deepLink)return Hp(r.deepLink,e);if(r.universalLink)return Gp(r.universalLink,e);throw new _(`Unsupported wallet ${t.id}`)}var Dp="WALLETCONNECT_DEEPLINK_CHOICE";function Fp(){try{localStorage.removeItem(Dp)}catch{}}function Up({href:e,name:t}){try{localStorage.setItem(Dp,JSON.stringify({href:e,name:t}))}catch{}}function Bp(e){return e.startsWith("http://")||e.startsWith("https://")}function Hp(e,t){if(Bp(e))return Gp(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Gp(e,t){if(!Bp(e))return Hp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function qa(e,t){window.open(e,t,"noreferrer noopener")}var Pt=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Di=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Pt(this._startChannelOnce.bind(this)),this.pollForReady=new Pt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");try{let t=await this.api.post($d,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new _("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw we(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post(jd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw we(t)}}async _startChannelOnce(){if(!this.api)throw new _("Auth flow has no API instance");let t=await this.api.post(qd,{token:this.captchaToken});$a.isMobile&&!$a.isIOS&&t.connect_uri&&qa(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new _("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");let t=await this.api.get(Kd,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var ac=require("jose");async function Vp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function zp(e){return crypto.getRandomValues(new Uint8Array(e))}function ja(){return!!Q.get(Xo)}var $1="S256",j1="S256",Hr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:ja();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");let t=Q.get(_n);if(!t)throw new _("Authentication error.");try{let r=await this.api.post(ap,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(_n),this.meta.headless&&Q.del(Xo),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=we(r);throw o.privyErrorCode?new _(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new _("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new _("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");let t=Q.get(_n);if(!t)throw new _("Authentication error.");try{let r=await this.api.post(sp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(_n),r}catch(r){throw we(r)}}createCodeVerifier(){return ac.base64url.encode(zp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=$1){if(r==j1){let o=await Vp(t);return ac.base64url.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.provider)throw new _("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();Q.put(_n,t);let r=this.createStateCode();Q.put(Qo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&Q.put(Xo,!0);try{return await this.api.post(ip,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw we(n)}}};function sc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qp(e,t){let r={detail:"",retryable:!1},o=sc(t);return e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function Ui(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:ja()}}function Bi(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),Q.del(Qo),window.history.replaceState({},"",e)}var on=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
1
+ "use strict";var N1=Object.create;var xa=Object.defineProperty;var D1=Object.getOwnPropertyDescriptor;var F1=Object.getOwnPropertyNames;var U1=Object.getPrototypeOf,B1=Object.prototype.hasOwnProperty;var H1=(e,t)=>{for(var r in t)xa(e,r,{get:t[r],enumerable:!0})},Nd=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of F1(t))!B1.call(e,n)&&n!==r&&xa(e,n,{get:()=>t[n],enumerable:!(o=D1(t,n))||o.enumerable});return e};var y=(e,t,r)=>(r=e!=null?N1(U1(e)):{},Nd(t||!e||!e.__esModule?xa(r,"default",{value:e,enumerable:!0}):r,e)),G1=e=>Nd(xa({},"__esModule",{value:!0}),e);var jl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Dd=(e,t,r)=>(jl(e,t,"read from private field"),r?r.call(e):t.get(e)),Sa=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Kl=(e,t,r,o)=>(jl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Fd=(e,t,r)=>(jl(e,t,"access private method"),r);var a2={};H1(a2,{AsExternalProvider:()=>br,Captcha:()=>Ps,ConnectorManager:()=>Gn,PrivyClient:()=>Vn,PrivyProvider:()=>n1,PrivyProxyProvider:()=>Le,SUPPORTED_CHAINS:()=>Bn,VERSION:()=>Na,WalletConnector:()=>St,addRpcUrlOverrideToChain:()=>M1,errorIndicatesMaxMfaRetries:()=>qs,errorIndicatesMfaTimeout:()=>cn,errorIndicatesMfaVerificationFailed:()=>dn,getAccessToken:()=>Se,useConnectWallet:()=>h1,useCreateWallet:()=>g1,useExperimentalFarcasterSigner:()=>I1,useFundWallet:()=>v1,useLinkAccount:()=>m1,useLogin:()=>a1,useLoginWithEmail:()=>d1,useLoginWithOAuth:()=>c1,useLoginWithSms:()=>p1,useLogout:()=>l1,useMfa:()=>vn,useMfaEnrollment:()=>bi,useModalStatus:()=>A1,usePrivy:()=>V,useRegisterMfaListener:()=>As,useSendTransaction:()=>C1,useSetWalletPassword:()=>E1,useSignMessage:()=>P1,useSignTypedData:()=>S1,useToken:()=>R1,useWallets:()=>ki});module.exports=G1(a2);var Ea=require("@ethersproject/address"),Vl=require("@ethersproject/providers"),Xg=require("mipd"),ee=require("react");var Ud=require("ofetch"),mt=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Br=class extends mt{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},_=class extends mt{constructor(r,o,n){super(r,o,n);this.type="client_error"}},_a=class extends _{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var oe=class extends mt{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},we=e=>{if(e instanceof mt)return e;if(!(e instanceof Ud.FetchError))return Tt(e);if(!e.response)return new Br("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Br(t||"ApiError",e.response.status,r||o,e,n)},Tt=e=>e instanceof mt?e:e instanceof Error?new _(e.message,e):new _(`Internal error: ${e}`);var xn=class extends _{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},qt=class extends _{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Aa=class extends _{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var ka="/api/v1/sessions",Ra="/api/v1/sessions/logout",Bd="/api/v1/sessions/fork",Ia="/api/v1/sessions/fork/recover",Hd="/api/v1/siwe/init",Gd="/api/v1/siwe/authenticate",Vd="/api/v1/siwe/link",zd="/api/v1/siwe/unlink",qd="/api/v1/farcaster/init",$d="/api/v1/farcaster/authenticate",jd="/api/v1/farcaster/link",Kd="/api/v1/farcaster/status",Yd="/api/v1/farcaster/unlink",Jd="/api/v1/passwordless/init",Zd="/api/v1/passwordless/authenticate",Qd="/api/v1/passwordless/link",Xd="/api/v1/passwordless/unlink",ep="/api/v1/passwordless/update",tp="/api/v1/passwordless_sms/init",rp="/api/v1/passwordless_sms/link",op="/api/v1/passwordless_sms/unlink",np="/api/v1/passwordless_sms/authenticate",ip="/api/v1/oauth/init",ap="/api/v1/oauth/authenticate",sp="/api/v1/oauth/link",lp="/api/v1/oauth/unlink";var cp="/api/v1/mfa/passwordless_sms/init",dp="/api/v1/mfa/passwordless_sms/enroll";var pp="/api/v1/users/me/accept_terms",up="/api/v1/analytics_events",mp="/api/v1/plugins/moonpay_on_ramp/sign",fp="/api/v1/custom_jwt_account/authenticate";var Sn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{let t=await this.api.post(fp,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw we(t)}}async link(){throw new Error("Unimplemented")}};var xo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Zd,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw we(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Qd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw we(t)}}async sendCodeEmail(t,r){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new _("Email must be set when initialzing authentication.");try{return await this.api.post(Jd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw we(o)}}},Ma=class extends xo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new _("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(ep,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw we(r)}}};var $a=require("react-device-detect");var Yl=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Wa=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Jl(){try{let e="privy:__session_storage__test",t="blobby",r=new Wa;return r.put(e,t),r.del(e),!0}catch{return!1}}function V1(){return typeof window<"u"&&window.localStorage?new Wa:new Yl}var Q=V1();var tn=require("@ethersproject/providers");function hp(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var La=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var Zl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||La(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Zl(r))return!1}return!0},So=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),yp=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var gp="1.59.9";var Ql="4df5e2316331463a9130964bd6078dfa",Xl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",vp="34357d3c125c2bcf2ce2bc3309d98715",Oa="https://auth.privy.io",wp=2e4,at=1400,Cp=2500,Na=gp;var Zo="privy:token",ec="privy-token",Da="privy:refresh_token",tc="privy-refresh-token",Fa="privy-session",Oi="privy:session_transfer_token",q1="privy:wallet",Ni="privy:caid",Qo="privy:state_code",_n="privy:code_verifier",Xo="privy:headless_oauth",Ua=e=>`${q1}:${e}`,rc="privy:connectors",oc="privy:connections";var en=12e4,ao=1,nc="0x1",An=3e4,bp="https://api.moonpay.com/v1",Ep="https://api.moonpay.com/v1",Tp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Pp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",xp="0x420000000000000000000000000000000000000F",Sp=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var _p=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Ba=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Ap=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},_o=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},ic=e=>new Promise(t=>setTimeout(t,e));function kp(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var Rp=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await ic(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Ha=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var Ip=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),rn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Mp(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of hp()){let u=La(d);if(!l.some(v=>v.info.name===u)){if(Zl(d,!0)&&!s.find(v=>v.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(v=>v.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(v=>v.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function kn(e){return`eip155:${String(Number(e))}`}var Ga=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new oe(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+Ql:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+Xl:i=a.rpcUrls.default?.http[0];if(!i)throw new oe(`No RPC url found for ${e}`);return i},Wp=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new oe(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},so=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new oe(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new tn.StaticJsonRpcProvider(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new tn.StaticJsonRpcProvider({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.infura.http[0]+"/"+Ql):a.rpcUrls.blast?.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.blast.http[0]+"/"+Xl):i=new tn.StaticJsonRpcProvider(a.rpcUrls.default?.http[0]),!i)throw new oe(`No RPC url found for ${e}`);return i},Va=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var za=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Rn))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Rn={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function $1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var Lp=e=>e in Rn,Op=e=>{let t=Rn[e].mobile;if("native"in t)return t.native};function Np(e,t){let r=$1(t);if(r.deepLink)return Hp(r.deepLink,e);if(r.universalLink)return Gp(r.universalLink,e);throw new _(`Unsupported wallet ${t.id}`)}var Dp="WALLETCONNECT_DEEPLINK_CHOICE";function Fp(){try{localStorage.removeItem(Dp)}catch{}}function Up({href:e,name:t}){try{localStorage.setItem(Dp,JSON.stringify({href:e,name:t}))}catch{}}function Bp(e){return e.startsWith("http://")||e.startsWith("https://")}function Hp(e,t){if(Bp(e))return Gp(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Gp(e,t){if(!Bp(e))return Hp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function qa(e,t){window.open(e,t,"noreferrer noopener")}var Pt=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Di=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Pt(this._startChannelOnce.bind(this)),this.pollForReady=new Pt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");try{let t=await this.api.post($d,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new _("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw we(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post(jd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw we(t)}}async _startChannelOnce(){if(!this.api)throw new _("Auth flow has no API instance");let t=await this.api.post(qd,{token:this.captchaToken});$a.isMobile&&!$a.isIOS&&t.connect_uri&&qa(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new _("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");let t=await this.api.get(Kd,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var ac=require("jose");async function Vp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function zp(e){return crypto.getRandomValues(new Uint8Array(e))}function ja(){return!!Q.get(Xo)}var j1="S256",K1="S256",Hr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:ja();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");let t=Q.get(_n);if(!t)throw new _("Authentication error.");try{let r=await this.api.post(ap,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(_n),this.meta.headless&&Q.del(Xo),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=we(r);throw o.privyErrorCode?new _(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new _("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new _("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");let t=Q.get(_n);if(!t)throw new _("Authentication error.");try{let r=await this.api.post(sp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Q.del(_n),r}catch(r){throw we(r)}}createCodeVerifier(){return ac.base64url.encode(zp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=j1){if(r==K1){let o=await Vp(t);return ac.base64url.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.provider)throw new _("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();Q.put(_n,t);let r=this.createStateCode();Q.put(Qo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&Q.put(Xo,!0);try{return await this.api.post(ip,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw we(n)}}};function sc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qp(e,t){let r={detail:"",retryable:!1},o=sc(t);return e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function Ui(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:ja()}}function Bi(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),Q.del(Qo),window.history.replaceState({},"",e)}var on=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
2
2
  ${r}
3
3
 
4
4
  ${l}
@@ -9,7 +9,7 @@ Chain ID: ${t}
9
9
  Nonce: ${i}
10
10
  Issued At: ${a}
11
11
  Resources:
12
- - https://privy.io`;this.getNonceOnce=new Pt(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(Gd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw we(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(Vd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw we(t)}}async sign(){if(!this.api)throw new _("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new _("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new _("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Hd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new _("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,a=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,a,l,o,i)}};var nn=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(np,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw we(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(rp,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw we(t)}}async sendSmsCode(t,r){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new _("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(tp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw we(o)}}};var Wu=require("uuid");function xt(e){return new Date(e*1e3)}function K1(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:xt(r.verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let a={address:r.address,type:r.type,verifiedAt:xt(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:xt(r.verified_at)};t.push(i);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:xt(r.verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:xt(r.verified_at)};t.push(s);break;case"twitter_oauth":let d={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:xt(r.verified_at)};t.push(d);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:xt(r.verified_at)};t.push(u);break;case"github_oauth":let v={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:xt(r.verified_at)};t.push(v);break;case"tiktok_oauth":let h={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:xt(r.verified_at)};t.push(h);break;case"linkedin_oauth":let w={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:xt(r.verified_at)};t.push(w);break;case"apple_oauth":let T={subject:r.subject,email:r.email,type:r.type,verifiedAt:xt(r.verified_at)};t.push(T);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:xt(r.verified_at)});break;case"farcaster":let C={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:xt(r.verified_at),signerPublicKey:r.signer_public_key};t.push(C);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function rr(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Ne=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,Y1=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),or=(e,t)=>t==="all-users"&&!Ne(e)||t==="users-without-wallets"&&!Y1(e)?.length;function $t(e){if(!e)return null;let t=K1(e.linked_accounts),r=rr(t,"wallet"),o=rr(t,"email"),n=rr(t,"phone"),a=rr(t,"google_oauth"),i=rr(t,"twitter_oauth"),l=rr(t,"discord_oauth"),s=rr(t,"github_oauth"),d=rr(t,"spotify_oauth"),u=rr(t,"tiktok_oauth"),v=rr(t,"linkedin_oauth"),h=rr(t,"apple_oauth"),w=rr(t,"farcaster"),T=e.mfa_methods.map(({type:S,verified_at:b})=>({type:S,verifiedAt:xt(b)}));return{id:e.id,createdAt:xt(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:v&&{subject:v.subject,name:v.name,email:v.email},apple:h&&{subject:h.subject,email:h.email},farcaster:w&&{fid:w.fid,ownerAddress:w.ownerAddress,displayName:w.displayName,username:w.username,bio:w.bio,pfp:w.pfp,url:w.url,signerPublicKey:w.signerPublicKey},mfaMethods:T.map(S=>S.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var fc=require("@ethersproject/address"),ku=y(require("eventemitter3"));var eu=y(require("@coinbase/wallet-sdk"));var Hi=require("react/jsx-runtime"),Ka=({style:e,...t})=>(0,Hi.jsxs)("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,Hi.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Hi.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});var Er=require("@ethersproject/address"),lc=require("@ethersproject/providers"),Xp=y(require("eventemitter3"));var Kp=y(require("eventemitter3"));var J1=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],$p=e=>J1.includes(e);var jp=require("@ethersproject/logger");var In=class extends oe{constructor(){super("Wallet timeout");this.type="wallet_error"}},Mn=class extends oe{constructor(){super("User rejected connection");this.type="wallet_error"}},Cr=e=>{if(e instanceof oe)return e;if(e?.code&&e?.reason){let t=new Be(e);return e.code===jp.ErrorCode.ACTION_REJECTED&&(t.details=ft.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Be(e):new oe("Unknown connector error",e)},nr=class extends mt{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Be=class extends nr{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(ft).find(a=>a.eipCode===o.code);this.details=n||ft.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=ft.E32002_CONNECTION_ALREADY_PENDING:this.details=ft.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=ft.E32002_WALLET_LOCKED))}},Z1={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},Q1={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},X1={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},ft={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...X1,...Q1},lo={...Z1,...ft};var Le=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new In,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||en,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new oe(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw Cr(r)})}},Ao=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Ya=class extends Kp.default{constructor(r,o,n,a,i,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=a,this.provider=so(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=Wn(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Ao(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Se()||!this.address)throw new Ao("Disconnected",4900);return(await Zp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Ao(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new Ao(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=so(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0];return await Yp(o)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await Jp(Va(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:rn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return rn(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if($p(r.method)){let o=await Se();if(await Qp(),!o||!this.address)throw new Ao("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:o,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new Ao("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Se();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},br=class extends Le{constructor(r){super(r,r.rpcTimeoutDuration)}},ko=class extends Le{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var ev=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},St=class extends Xp.default{constructor(r,o,n,a){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=kn(r),this.walletClientType==="privy"&&Q.put(Ua(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=Wn(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>(0,Er.getAddress)(i.address)===(0,Er.getAddress)(r));return{address:(0,Er.getAddress)(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new oe("Wallet is not currently connected.");let l=this.wallets.find(h=>(0,Er.getAddress)(h.address)===(0,Er.getAddress)(r))?.chainId;if(!l)throw new oe("Unable to determine current chainId.");let s,d;if(typeof i=="number"?(s=`0x${i.toString(16)}`,d=i):(s=i,d=Number(i)),l===kn(s))return;let u=this.chains.find(h=>h.id===d);if(!u)throw new oe(`Unsupported chainId: ${i}`);let v=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await v()}catch(h){if(ev(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),v();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new oe(`Rainbow does not support the chainId ${o}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new oe("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new oe("Wallet is not currently connected.");return new lc.Web3Provider(new br(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new oe("Wallet is not currently connected.");return new ko(this.proxyProvider)},sign:async i=>{if(!await a())throw new oe("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let d=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(d)&&(o=d)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=(0,Er.getAddress)(n),i=[],l;if(this.walletClientType==="privy"){let d=Q.get(Ua(a));this.chains.find(u=>u.id===Number(d))||(Q.del(Ua(a)),d=null),l=d||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let d=await this.proxyProvider.request({method:"eth_chainId"});if(typeof d=="string")l=d;else if(typeof d=="number")l=`0x${d.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(d){console.warn(`Failed to get chainId from provider, defaulting to ${nc}`,d),l=nc}let s=kn(l);if(!i.find(d=>(0,Er.getAddress)(d.address)===a)){let d={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet((0,Er.getAddress)(n),s,d))}Ja(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>(0,Er.getAddress)(n)===(0,Er.getAddress)(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new lc.Web3Provider(new br(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var Ln={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var tv=(e,t)=>{let o=Ga(1,[Ln],{},t);return e.makeWeb3Provider(o,1)},Za,Qa=class extends St{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),Za||(Za=new eu.default({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(tv(Za,a))}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){Za.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Ka,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new oe("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Cr(r)}}};var cc=require("react/jsx-runtime"),Xa=({...e})=>(0,cc.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,cc.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});var es=class extends St{constructor(r,o,n,a){super("privy",o,n,a);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[rn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Xa,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var dc=require("react/jsx-runtime"),On=({style:e,...t})=>(0,dc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:(0,dc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});var ht=require("react/jsx-runtime"),Nn=({style:e,...t})=>(0,ht.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[(0,ht.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,ht.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,ht.jsx)("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),(0,ht.jsx)("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),(0,ht.jsx)("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),(0,ht.jsx)("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),(0,ht.jsx)("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),(0,ht.jsx)("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),(0,ht.jsx)("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),(0,ht.jsx)("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),(0,ht.jsx)("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),(0,ht.jsx)("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),(0,ht.jsx)("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var Gi=require("react/jsx-runtime"),Gr=({style:e,...t})=>(0,Gi.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[(0,Gi.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,Gi.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Fn=class extends St{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let l=a.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new oe("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Cr(r)}}},Dn,Un=class extends St{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Sa(this,Dn,void 0);this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?Kl(this,Dn,{name:"MetaMask",icon:Nn,id:"io.metamask"}):i==="phantom"&&Kl(this,Dn,{name:"Phantom",icon:Gr,id:"phantom"})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Dd(this,Dn)??{name:"Browser Extension",icon:On,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new oe("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Cr(r)}}};Dn=new WeakMap;var rv=require("@ethersproject/address"),ov=require("@ethersproject/providers"),tu=require("react-device-detect");var ts=class extends Fn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{tu.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new oe("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Cr(t)}}};var rs=class extends St{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Le(void 0,en);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.emit("initialized"),this.initialized=!0}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var os=class extends rs{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Gr,id:"phantom"}}};var Hn=require("@walletconnect/ethereum-provider"),Au=require("react-device-detect");var ar=require("react");var ru=require("react/jsx-runtime");function ns({src:e,...t}){return(0,ru.jsx)("img",{src:e,...t,style:{display:"none"}})}var Vr=require("react"),Eu=require("react");var ir={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:vp,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var ou=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var nv=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),nu=e=>nv.has(e),iu=(e,t,r)=>r.indexOf(e)===t,au=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(nu).filter(iu):e?e.filter(nu).filter(iu):ir.appearance.walletList;var is={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var as={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var ss={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var su={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var lu={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var ls={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var cs={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var ds={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var cu={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var du={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var pu={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var uu={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var mu={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://goerli.rpc.privy.systems"]},alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var fu={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var hu={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var yu={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var ps={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var us={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var ms={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var Vi={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var zi={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mumbai.rpc.privy.systems"]},alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://matic-mumbai.chainstacklabs.com"]},public:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var gu={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var vu={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var fs={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var hs={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var ys={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Bn=[is,as,ss,mu,vu,Ln,ps,us,ms,Vi,zi,cu,du,pu,uu,ls,cs,ds,hu,yu,su,lu,fs,ys,hs,fu,gu],gE=new Set(Bn.map(e=>e.id));var Io=y(require("tinycolor2")),wu="#FFFFFF",iv="#000000",av=wu,sv="#1E1E1D";function lv(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function Ro(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,Io.default)({...e.toHsl(),l:r})}function Cu({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=wu,blackHex:i=iv}){let l;switch(e){case"light":l=av;break;case"dark":l=sv;break;default:l=e;break}let s=(0,Io.default)(l),d=(0,Io.default)(t),u=(0,Io.default)(r),v=(0,Io.default)(o),h=(0,Io.default)(n),w=lv(s.getLuminance()),T=Ro(s,w==="light"?-.04:.11),C=Ro(s,w==="light"?-.88:.87),S=Ro(s,w==="light"?-.77:.75),b=Ro(s,w==="light"?-.43:.45).desaturate(w==="light"?60:20),x=Ro(s,w==="light"?-.08:.25).desaturate(w==="light"?60:20),I=Ro(d,.15),W=Ro(d,-.06),R=(0,Io.default)(d.getLuminance()>.5?i:a),H=Ro(u,-.16);return{colorScheme:w,background:s.toHslString(),background2:T.toHslString(),foreground:C.toHslString(),foreground2:S.toHslString(),foreground3:b.toHslString(),foreground4:x.toHslString(),accent:d.toHslString(),accentLight:I.toHslString(),accentDark:W.toHslString(),foregroundAccent:R.toHslString(),success:u.toHslString(),successDark:H.toHslString(),error:h.toHslString(),warn:v.toHslString()}}function pc(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],a=t?.loginMethods?.filter(j=>n.includes(j)),i,l,s,d,u,v,h,w,T,C,S,b;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),d=a?.includes("google"),u=a?.includes("twitter"),v=a?.includes("discord"),w=a?.includes("spotify"),h=a?.includes("tiktok"),C=a?.includes("github"),T=a?.includes("linkedin"),S=a?.includes("apple"),b=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,s=e.walletAuth,d=e.googleOAuth,u=e.twitterOAuth,v=e.discordOAuth,C=e.githubOAuth,w=e.spotifyOAuth,h=e.tiktokOAuth,T=e.linkedinOAuth,S=e.appleOAuth,b=e.farcasterAuth);let x=[i,l].filter(Boolean),I=[d,u,v,C,w,h,T,S,b].filter(Boolean),W=[s].filter(Boolean);if(x.length+I.length+W.length===0)throw new Error("You must enable at least one login method");let R=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;R&&W.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),R=!1):!R&&I.length+x.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),R=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let H=au({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),B=ou({input:t?.loginMethodsAndOrder}),G=t?.intl?.defaultCountry??"US",{chains:P,defaultChain:J}=cv({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),N=!!t?.defaultChain,te=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ue,se=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?te?ue=t?.embeddedWallets?.noPromptOnSignature??!0:ue=t?.embeddedWallets?.noPromptOnSignature??se:ue=se,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ue!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:Cu({backgroundTheme:t?.appearance?.theme??ir.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??ir.appearance.accentColor}),loginGroupPriority:R?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:H},loginMethods:{wallet:s,email:i,sms:l,google:d,twitter:u,discord:v,github:C,spotify:w,tiktok:h,linkedin:T,apple:S,farcaster:b},loginMethodsAndOrder:B,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??ir.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??ir.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??ir.rpcConfig.rpcTimeouts},chains:P,defaultChain:J,intl:{defaultCountry:G},shouldEnforceDefaultChainOnConnect:N,captchaEnabled:e.captchaEnabled??ir.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...te?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:ue},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:te?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??ir.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??ir._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??ir._render.inParentNodeId}}}function bu(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:a,...i}=e;return{...i,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...a?{defaultChain:a.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function cv({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:Bn.find(u=>u.id===s.id)??s)}else n=Bn.concat(e??[]);let a=t?n[0]:Ln,i=r??a;if(!n.find(l=>l.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}var xu=require("react/jsx-runtime"),Tu={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},uc=pc(Tu,void 0,!1),mc=(0,Eu.createContext)({appConfig:uc,isServerConfigLoaded:!1}),Pu=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=(0,Vr.useState)(null),i=(0,Vr.useMemo)(()=>pc(n??Tu,o,!!n),[n,o]);return(0,Vr.useEffect)(()=>{let l=bu(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),(0,Vr.useEffect)(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),a(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),(0,xu.jsx)(mc.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},gs=()=>{let{appConfig:e}=(0,Vr.useContext)(mc);return e},vs=()=>{let{isServerConfigLoaded:e}=(0,Vr.useContext)(mc);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var ws=require("react/jsx-runtime"),Su=(0,ar.createContext)({ready:!1,app:uc,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),dv=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],_u=e=>{let t=gs(),r=e.authenticated,[o,n]=(0,ar.useState)(e.initialScreen);(0,ar.useEffect)(()=>{!r&&!dv.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=(0,ar.useRef)(null);(0,ar.useEffect)(()=>{e.open||(a.current=null)},[e.open]),(0,ar.useEffect)(()=>{a.current=null},[e.initialScreen]);let i={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:a};return(0,ws.jsxs)(Su.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,ws.jsx)(ns,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},A=()=>(0,ar.useContext)(Su);var co=require("react/jsx-runtime"),qi=({style:e,...t})=>{let{app:r}=A();return(0,co.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,co.jsx)("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,co.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,co.jsx)("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),(0,co.jsx)("defs",{children:(0,co.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,co.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var zr=class extends St{constructor(r,o,n,a,i,l,s){super(s||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Rn[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=za(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.emit("initialized"),this.initialized=!0;let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:Nn,id:"io.metamask"}:{name:Ip(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||qi,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Rn[r],this.walletClientType=r,this.redirectUri=void 0,Fp(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Mn)};this.onQrModalClosed=n,(async()=>{let i="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(i=l[0]),!i||i==="")throw new oe("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=za(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Wn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(Cr(i));return}o(new oe("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let i of this.chains){let l=Ga(i.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[i.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(i=>i.id),a=await Hn.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Hn.OPTIONAL_EVENTS,optionalMethods:Hn.OPTIONAL_METHODS,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Au.isMobile&&this.walletEntry){let{redirect:l,href:s}=Np(i,this.walletEntry);Up({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,qa(l,"_self")}else this.modal?.openModal({uri:i,chains:[this.defaultChain.id]})}),a.on("connect",()=>{if(this.modal?.closeModal(),a.session?.peer.metadata.url){let i=za(a.session?.peer.metadata.url);this.walletEntry=i?.entry,this.walletClientType=i?.walletClientType||"unknown"}}),a}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var hc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===(0,fc.getAddress)(t)).length:!1},Wn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||en:en,Gn=class extends ku.default{constructor(r,o,n,a,i,l,s,d,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new Le:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=d,this.privyAppName=u,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;Q.get(rc)&&(Q.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Q.del(o)}),Q.del(rc));let r=Mp(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:a,legacyInjectedProvider:i})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:a,legacyInjectedProvider:i})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!So()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)||null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)||null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length,this.emit("walletsUpdated")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=r;else{let l=new Ya(r,o,this.rpcConfig,this.chains,a,n.id),s=new es(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a)return a instanceof zr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new ts(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Un(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Un(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Un(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Fn(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Qa(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new os(this.defaultChain):new zr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize()}loadConnectionHistory(){let r=i=>i&&typeof i.address=="string"&&typeof i.connectorType=="string"&&typeof i.walletClientType=="string"&&typeof i.connectedAt=="number",o=Q.get(oc);return o&&Array.isArray(o)&&o.map(i=>r(i)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));Q.put(oc,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=(0,fc.getAddress)(r),this.emit("walletsUpdated")}};function Ja(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var Ru=require("ofetch");var pv=[ka,Ia,Ra],Cs=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=Na,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Ru.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:a})=>{let i=new Headers(a.headers);i.set("privy-app-id",this.appId),i.set("privy-ca-id",this.clientAnalyticsId||""),i.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!pv.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new _a}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw we(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw we(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw we(o)}}};var Mo=y(require("js-cookie"));function Iu(e){return e instanceof xo?"email":e instanceof nn?"sms":e instanceof on?"siwe":e instanceof Sn?"custom_auth":e instanceof Hr?e.meta.provider:null}var Mu=y(require("jose")),qr=class{static parse(t){try{return new qr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Mu.decodeJwt(t)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(t=0){let r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var uv=30,bs=class{constructor(){this.authenticateOnce=new Pt(async t=>this._authenticate(t)),this.linkOnce=new Pt(async t=>this._link(t)),this.refreshOnce=new Pt(this._refresh.bind(this)),this.destroyOnce=new Pt(this._destroy.bind(this)),this.forkSessionOnce=new Pt(this._forkSession.bind(this))}get token(){try{let t=Q.get(Zo);return typeof t=="string"?new qr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Q.get(Da);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Q.get(Oi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Mo.default.get(Fa);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=qr.parse(this.token);return t!==null&&!t.isExpired(uv)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(t){try{let{token:r,refresh_token:o,user:n,is_new_user:a}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let i=Iu(t);return i&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:i,isNewUser:a}),i==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:$t(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),Tt(r)}}async _link(t){try{let r=await t.link();return $t(r)}catch(r){throw console.warn("Error linking account"),Tt(r)}}async _refresh(){if(!this.api)throw new _("Session has no API instance");if(!this.client)throw new _("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(ka,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Ia,{refresh_token:o}),this.clearForkedToken();else return null;return n.session_update_action==="set"&&(this.storeToken(n.token),this.storeRefreshToken(n.refresh_token)),n.session_update_action==="clear"&&this.destroyLocalState(),n.session_update_action==="ignore"&&n.token&&this.storeToken(n.token),$t(n.user)}catch(n){if(n instanceof Br&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Tt(n)}}async _destroy(){try{await this.api?.post(Ra,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new _("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Bd,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw Tt(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=Q.get(Zo);if(Q.put(Zo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=qr.parse(t)?.expiration;Mo.default.set(ec,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else Q.del(Zo),Mo.default.remove(ec)}storeRefreshToken(t){typeof t=="string"?(Q.put(Da,t),this.client?.useServerCookies||(Mo.default.set(Fa,"t",{sameSite:"Strict",secure:!0,expires:30}),Mo.default.set(tc,t,{sameSite:"Strict",secure:!0,expires:30}))):(Q.del(Da),Mo.default.remove(tc),Mo.default.remove(Fa))}clearForkedToken(){Q.del(Oi)}};var yc,Es,Lu,Vn=class{constructor(t){Sa(this,Es);this.apiUrl=t.apiUrl||Oa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||wp,this.appId=t.appId,this.clientAnalyticsId=Fd(this,Es,Lu).call(this),yc||(yc=new bs),this.session=yc,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new Gn(this.appId,t,r,o,n,a,i,l,s))}generateApi(){let t=new Cs(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new _("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new _("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let r=await this.api.post(Xd,{address:t});return $t(r)}catch(r){throw Tt(r)}}async acceptTerms(){try{let t=await this.api.post(pp,{});return $t(t)}catch(t){throw Tt(t)}}async unlinkPhone(t){try{let r=await this.api.post(op,{phoneNumber:t});return $t(r)}catch(r){throw Tt(r)}}async unlinkWallet(t){try{let r=await this.api.post(zd,{address:t});return $t(r)}catch(r){throw Tt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(lp,{provider:t,subject:r});return $t(o)}catch(o){throw Tt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Yd,{fid:t});return $t(r)}catch(r){throw Tt(r)}}async createAnalyticsEvent(t,r,o){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(up,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(mp,t)}catch(r){throw Tt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?qr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw Tt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}};Es=new WeakSet,Lu=function(){if(typeof window>"u")return null;try{let r=Q.get(Ni);if(typeof r=="string"&&r.length>0)return r}catch{}let t=(0,Wu.v4)();try{return Q.put(Ni,t),t}catch{return t}};var Fu=require("@marsidev/react-turnstile"),Ts=require("react");var sr=require("react");var Du=require("react/jsx-runtime"),Ou=(0,sr.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),Tr=class extends mt{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Nu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=(0,sr.useRef)(null),[a,i]=(0,sr.useState)(),[l,s]=(0,sr.useState)(),[d,u]=(0,sr.useState)(!1),v=(0,sr.useMemo)(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return(0,Du.jsx)(Ou.Provider,{value:{...v,ref:n,enabled:o,siteKey:r,appId:t,setToken:i,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),i(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),i(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await kp(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Tr("Captcha failed",null,"captcha_timeout")}}},children:e})},_e=()=>(0,sr.useContext)(Ou);var gc=require("react/jsx-runtime"),Ps=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=_e(),[,s]=(0,Ts.useMemo)(()=>r?.split("t:")||[],[r]);if((0,Ts.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,gc.jsx)("div",{className:"hidden h-0 w-0",children:(0,gc.jsx)(Fu.Turnstile,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:d=>{e.onSuccess?.(d),a(d),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};var Eo=require("react"),jg=y(require("react-dom"));var xs=require("react");var vc=(0,xs.createContext)({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,initLoginWithOAuth:E,loginWithOAuth:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E}),L=()=>(0,xs.useContext)(vc);var Ss=require("react");var ye=(0,Ss.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkFarcaster:E,setActiveWallet:E,forkSession:E,createWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,requestFarcasterSigner:E,submitCast:E,removeCast:E,likeCast:E,recastCast:E,followUser:E,unfollowUser:E,initLoginWithEmail:E,initLoginWithSms:E,loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,isHeadlessOAuthLoading:!1,isModalOpen:!1}),V=()=>(0,Ss.useContext)(ye);var _s=require("react"),Uu=e=>{let[t,r]=(0,_s.useState)("auto");return(0,_s.useEffect)(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};var zn=require("react"),Bu={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},wc=(0,zn.createContext)(void 0),Hu=()=>(0,zn.useContext)(wc);function De(e,t){if(!t)return;let o=Hu().current[e];return(0,zn.useEffect)(()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(i=>i!==a)}},[t])}function D(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Gu(){let e=Hu();return(t,r,...o)=>D(e,t,r,...o)}function As(e){De("configureMfa",e)}var Ac=y(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),Zu=y(require("@heroicons/react/24/solid/DocumentCheckIcon")),Qu=y(require("styled-components"));var cr=y(require("styled-components"));var ks=y(require("styled-components")),Wo=require("react/jsx-runtime"),lr=({success:e,fail:t})=>(0,Wo.jsxs)(Wo.Fragment,{children:[(0,Wo.jsx)(Lt,{className:e?"success":t?"fail":""}),(0,Wo.jsx)(Cc,{className:e?"success":t?"fail":""})]}),Lt=ks.default.span`
12
+ - https://privy.io`;this.getNonceOnce=new Pt(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(Gd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw we(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(Vd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw we(t)}}async sign(){if(!this.api)throw new _("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new _("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new _("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Hd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new _("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,a=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,a,l,o,i)}};var nn=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(np,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw we(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(rp,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw we(t)}}async sendSmsCode(t,r){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new _("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(tp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw we(o)}}};var Lu=require("uuid");function xt(e){return new Date(e*1e3)}function Y1(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:xt(r.verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let a={address:r.address,type:r.type,verifiedAt:xt(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:xt(r.verified_at)};t.push(i);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:xt(r.verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:xt(r.verified_at)};t.push(s);break;case"twitter_oauth":let d={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:xt(r.verified_at)};t.push(d);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:xt(r.verified_at)};t.push(u);break;case"github_oauth":let v={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:xt(r.verified_at)};t.push(v);break;case"tiktok_oauth":let h={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:xt(r.verified_at)};t.push(h);break;case"linkedin_oauth":let w={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:xt(r.verified_at)};t.push(w);break;case"apple_oauth":let T={subject:r.subject,email:r.email,type:r.type,verifiedAt:xt(r.verified_at)};t.push(T);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:xt(r.verified_at)});break;case"farcaster":let C={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:xt(r.verified_at),signerPublicKey:r.signer_public_key};t.push(C);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function rr(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Ne=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,J1=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),or=(e,t)=>t==="all-users"&&!Ne(e)||t==="users-without-wallets"&&!J1(e)?.length;function $t(e){if(!e)return null;let t=Y1(e.linked_accounts),r=rr(t,"wallet"),o=rr(t,"email"),n=rr(t,"phone"),a=rr(t,"google_oauth"),i=rr(t,"twitter_oauth"),l=rr(t,"discord_oauth"),s=rr(t,"github_oauth"),d=rr(t,"spotify_oauth"),u=rr(t,"tiktok_oauth"),v=rr(t,"linkedin_oauth"),h=rr(t,"apple_oauth"),w=rr(t,"farcaster"),T=e.mfa_methods.map(({type:S,verified_at:b})=>({type:S,verifiedAt:xt(b)}));return{id:e.id,createdAt:xt(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:v&&{subject:v.subject,name:v.name,email:v.email},apple:h&&{subject:h.subject,email:h.email},farcaster:w&&{fid:w.fid,ownerAddress:w.ownerAddress,displayName:w.displayName,username:w.username,bio:w.bio,pfp:w.pfp,url:w.url,signerPublicKey:w.signerPublicKey},mfaMethods:T.map(S=>S.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var fc=require("@ethersproject/address"),Ru=y(require("eventemitter3"));var eu=y(require("@coinbase/wallet-sdk"));var Hi=require("react/jsx-runtime"),Ka=({style:e,...t})=>(0,Hi.jsxs)("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,Hi.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Hi.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});var Er=require("@ethersproject/address"),lc=require("@ethersproject/providers"),Xp=y(require("eventemitter3"));var Kp=y(require("eventemitter3"));var Z1=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],$p=e=>Z1.includes(e);var jp=require("@ethersproject/logger");var In=class extends oe{constructor(){super("Wallet timeout");this.type="wallet_error"}},Mn=class extends oe{constructor(){super("User rejected connection");this.type="wallet_error"}},Cr=e=>{if(e instanceof oe)return e;if(e?.code&&e?.reason){let t=new Be(e);return e.code===jp.ErrorCode.ACTION_REJECTED&&(t.details=ft.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Be(e):new oe("Unknown connector error",e)},nr=class extends mt{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Be=class extends nr{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(ft).find(a=>a.eipCode===o.code);this.details=n||ft.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=ft.E32002_CONNECTION_ALREADY_PENDING:this.details=ft.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=ft.E32002_WALLET_LOCKED))}},Q1={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},X1={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},ev={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},ft={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...ev,...X1},lo={...Q1,...ft};var Le=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new In,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||en,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new oe(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw Cr(r)})}},Ao=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Ya=class extends Kp.default{constructor(r,o,n,a,i,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=a,this.provider=so(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=Wn(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Ao(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Se()||!this.address)throw new Ao("Disconnected",4900);return(await Zp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Ao(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new Ao(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=so(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0];return await Yp(o)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await Jp(Va(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:rn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return rn(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if($p(r.method)){let o=await Se();if(await Qp(),!o||!this.address)throw new Ao("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:o,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new Ao("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Se();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},br=class extends Le{constructor(r){super(r,r.rpcTimeoutDuration)}},ko=class extends Le{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var tv=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},St=class extends Xp.default{constructor(r,o,n,a){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=kn(r),this.walletClientType==="privy"&&Q.put(Ua(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=a,this.rpcTimeoutDuration=Wn(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>(0,Er.getAddress)(i.address)===(0,Er.getAddress)(r));return{address:(0,Er.getAddress)(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new oe("Wallet is not currently connected.");let l=this.wallets.find(h=>(0,Er.getAddress)(h.address)===(0,Er.getAddress)(r))?.chainId;if(!l)throw new oe("Unable to determine current chainId.");let s,d;if(typeof i=="number"?(s=`0x${i.toString(16)}`,d=i):(s=i,d=Number(i)),l===kn(s))return;let u=this.chains.find(h=>h.id===d);if(!u)throw new oe(`Unsupported chainId: ${i}`);let v=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await v()}catch(h){if(tv(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),v();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new oe(`Rainbow does not support the chainId ${o}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new oe("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new oe("Wallet is not currently connected.");return new lc.Web3Provider(new br(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new oe("Wallet is not currently connected.");return new ko(this.proxyProvider)},sign:async i=>{if(!await a())throw new oe("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let d=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(d)&&(o=d)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=(0,Er.getAddress)(n),i=[],l;if(this.walletClientType==="privy"){let d=Q.get(Ua(a));this.chains.find(u=>u.id===Number(d))||(Q.del(Ua(a)),d=null),l=d||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let d=await this.proxyProvider.request({method:"eth_chainId"});if(typeof d=="string")l=d;else if(typeof d=="number")l=`0x${d.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(d){console.warn(`Failed to get chainId from provider, defaulting to ${nc}`,d),l=nc}let s=kn(l);if(!i.find(d=>(0,Er.getAddress)(d.address)===a)){let d={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet((0,Er.getAddress)(n),s,d))}Ja(i,this.wallets)||(this.wallets=i,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>(0,Er.getAddress)(n)===(0,Er.getAddress)(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new lc.Web3Provider(new br(this.proxyProvider)).getSigner().signMessage(r)}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}};var Ln={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var rv=(e,t)=>{let o=Ga(1,[Ln],{},t);return e.makeWeb3Provider(o,1)},Za,Qa=class extends St{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),Za||(Za=new eu.default({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(rv(Za,a))}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){Za.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Ka,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new oe("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Cr(r)}}};var cc=require("react/jsx-runtime"),Xa=({...e})=>(0,cc.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,cc.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});var es=class extends St{constructor(r,o,n,a){super("privy",o,n,a);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[rn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Xa,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var dc=require("react/jsx-runtime"),On=({style:e,...t})=>(0,dc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:(0,dc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});var ht=require("react/jsx-runtime"),Nn=({style:e,...t})=>(0,ht.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[(0,ht.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,ht.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,ht.jsx)("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),(0,ht.jsx)("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),(0,ht.jsx)("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),(0,ht.jsx)("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),(0,ht.jsx)("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),(0,ht.jsx)("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),(0,ht.jsx)("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),(0,ht.jsx)("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),(0,ht.jsx)("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),(0,ht.jsx)("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),(0,ht.jsx)("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var Gi=require("react/jsx-runtime"),Gr=({style:e,...t})=>(0,Gi.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[(0,Gi.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,Gi.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Fn=class extends St{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=a;let l=a.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new oe("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Cr(r)}}},Dn,Un=class extends St{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Sa(this,Dn,void 0);this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?Kl(this,Dn,{name:"MetaMask",icon:Nn,id:"io.metamask"}):i==="phantom"&&Kl(this,Dn,{name:"Phantom",icon:Gr,id:"phantom"})}async initialize(){await this.syncAccounts(),this.emit("initialized"),this.initialized=!0}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Dd(this,Dn)??{name:"Browser Extension",icon:On,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new oe("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Cr(r)}}};Dn=new WeakMap;var ov=require("@ethersproject/address"),nv=require("@ethersproject/providers"),tu=require("react-device-detect");var ts=class extends Fn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{tu.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new oe("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Cr(t)}}};var rs=class extends St{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Le(void 0,en);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.emit("initialized"),this.initialized=!0}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var os=class extends rs{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Gr,id:"phantom"}}};var Hn=require("@walletconnect/ethereum-provider"),ku=require("react-device-detect");var ar=require("react");var ru=require("react/jsx-runtime");function ns({src:e,...t}){return(0,ru.jsx)("img",{src:e,...t,style:{display:"none"}})}var Vr=require("react"),Tu=require("react");var ir={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:vp,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var ou=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var iv=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),nu=e=>iv.has(e),iu=(e,t,r)=>r.indexOf(e)===t,au=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(nu).filter(iu):e?e.filter(nu).filter(iu):ir.appearance.walletList;var is={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var as={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var ss={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var su={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var lu={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var ls={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var cs={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var ds={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var cu={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://artio.rpc.berachain.com"]},public:{http:["https://artio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var du={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var pu={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var uu={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var mu={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var fu={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://goerli.rpc.privy.systems"]},alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var hu={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var yu={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var gu={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var ps={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var us={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var ms={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var Vi={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var zi={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mumbai.rpc.privy.systems"]},alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://matic-mumbai.chainstacklabs.com"]},public:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var vu={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var wu={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var fs={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var hs={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var ys={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Bn=[is,as,ss,fu,wu,Ln,ps,us,ms,Vi,zi,du,pu,uu,mu,ls,cs,ds,cu,yu,gu,su,lu,fs,ys,hs,hu,vu],CE=new Set(Bn.map(e=>e.id));var Io=y(require("tinycolor2")),Cu="#FFFFFF",av="#000000",sv=Cu,lv="#1E1E1D";function cv(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function Ro(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,Io.default)({...e.toHsl(),l:r})}function bu({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Cu,blackHex:i=av}){let l;switch(e){case"light":l=sv;break;case"dark":l=lv;break;default:l=e;break}let s=(0,Io.default)(l),d=(0,Io.default)(t),u=(0,Io.default)(r),v=(0,Io.default)(o),h=(0,Io.default)(n),w=cv(s.getLuminance()),T=Ro(s,w==="light"?-.04:.11),C=Ro(s,w==="light"?-.88:.87),S=Ro(s,w==="light"?-.77:.75),b=Ro(s,w==="light"?-.43:.45).desaturate(w==="light"?60:20),x=Ro(s,w==="light"?-.08:.25).desaturate(w==="light"?60:20),I=Ro(d,.15),W=Ro(d,-.06),R=(0,Io.default)(d.getLuminance()>.5?i:a),H=Ro(u,-.16);return{colorScheme:w,background:s.toHslString(),background2:T.toHslString(),foreground:C.toHslString(),foreground2:S.toHslString(),foreground3:b.toHslString(),foreground4:x.toHslString(),accent:d.toHslString(),accentLight:I.toHslString(),accentDark:W.toHslString(),foregroundAccent:R.toHslString(),success:u.toHslString(),successDark:H.toHslString(),error:h.toHslString(),warn:v.toHslString()}}function pc(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],a=t?.loginMethods?.filter(j=>n.includes(j)),i,l,s,d,u,v,h,w,T,C,S,b;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),d=a?.includes("google"),u=a?.includes("twitter"),v=a?.includes("discord"),w=a?.includes("spotify"),h=a?.includes("tiktok"),C=a?.includes("github"),T=a?.includes("linkedin"),S=a?.includes("apple"),b=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,s=e.walletAuth,d=e.googleOAuth,u=e.twitterOAuth,v=e.discordOAuth,C=e.githubOAuth,w=e.spotifyOAuth,h=e.tiktokOAuth,T=e.linkedinOAuth,S=e.appleOAuth,b=e.farcasterAuth);let x=[i,l].filter(Boolean),I=[d,u,v,C,w,h,T,S,b].filter(Boolean),W=[s].filter(Boolean);if(x.length+I.length+W.length===0)throw new Error("You must enable at least one login method");let R=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;R&&W.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),R=!1):!R&&I.length+x.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),R=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let H=au({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),B=ou({input:t?.loginMethodsAndOrder}),G=t?.intl?.defaultCountry??"US",{chains:P,defaultChain:J}=dv({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),N=!!t?.defaultChain,te=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ue,se=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?te?ue=t?.embeddedWallets?.noPromptOnSignature??!0:ue=t?.embeddedWallets?.noPromptOnSignature??se:ue=se,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ue!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:bu({backgroundTheme:t?.appearance?.theme??ir.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??ir.appearance.accentColor}),loginGroupPriority:R?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:H},loginMethods:{wallet:s,email:i,sms:l,google:d,twitter:u,discord:v,github:C,spotify:w,tiktok:h,linkedin:T,apple:S,farcaster:b},loginMethodsAndOrder:B,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??ir.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??ir.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??ir.rpcConfig.rpcTimeouts},chains:P,defaultChain:J,intl:{defaultCountry:G},shouldEnforceDefaultChainOnConnect:N,captchaEnabled:e.captchaEnabled??ir.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...te?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:ue},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:te?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??ir.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??ir._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??ir._render.inParentNodeId}}}function Eu(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:a,...i}=e;return{...i,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...a?{defaultChain:a.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function dv({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:Bn.find(u=>u.id===s.id)??s)}else n=Bn.concat(e??[]);let a=t?n[0]:Ln,i=r??a;if(!n.find(l=>l.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:i}}var Su=require("react/jsx-runtime"),Pu={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},uc=pc(Pu,void 0,!1),mc=(0,Tu.createContext)({appConfig:uc,isServerConfigLoaded:!1}),xu=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=(0,Vr.useState)(null),i=(0,Vr.useMemo)(()=>pc(n??Pu,o,!!n),[n,o]);return(0,Vr.useEffect)(()=>{let l=Eu(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),(0,Vr.useEffect)(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),a(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),(0,Su.jsx)(mc.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},gs=()=>{let{appConfig:e}=(0,Vr.useContext)(mc);return e},vs=()=>{let{isServerConfigLoaded:e}=(0,Vr.useContext)(mc);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var ws=require("react/jsx-runtime"),_u=(0,ar.createContext)({ready:!1,app:uc,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),pv=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Au=e=>{let t=gs(),r=e.authenticated,[o,n]=(0,ar.useState)(e.initialScreen);(0,ar.useEffect)(()=>{!r&&!pv.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=(0,ar.useRef)(null);(0,ar.useEffect)(()=>{e.open||(a.current=null)},[e.open]),(0,ar.useEffect)(()=>{a.current=null},[e.initialScreen]);let i={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:a};return(0,ws.jsxs)(_u.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,ws.jsx)(ns,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},A=()=>(0,ar.useContext)(_u);var co=require("react/jsx-runtime"),qi=({style:e,...t})=>{let{app:r}=A();return(0,co.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,co.jsx)("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,co.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,co.jsx)("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),(0,co.jsx)("defs",{children:(0,co.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,co.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var zr=class extends St{constructor(r,o,n,a,i,l,s){super(s||"unknown",n,a,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=i,this.proxyProvider=new Le(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Rn[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=za(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.emit("initialized"),this.initialized=!0;let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:Nn,id:"io.metamask"}:{name:Ip(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||qi,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Rn[r],this.walletClientType=r,this.redirectUri=void 0,Fp(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Mn)};this.onQrModalClosed=n,(async()=>{let i="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(i=l[0]),!i||i==="")throw new oe("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=za(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Wn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(Cr(i));return}o(new oe("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let i of this.chains){let l=Ga(i.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[i.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(i=>i.id),a=await Hn.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Hn.OPTIONAL_EVENTS,optionalMethods:Hn.OPTIONAL_METHODS,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),ku.isMobile&&this.walletEntry){let{redirect:l,href:s}=Np(i,this.walletEntry);Up({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,qa(l,"_self")}else this.modal?.openModal({uri:i,chains:[this.defaultChain.id]})}),a.on("connect",()=>{if(this.modal?.closeModal(),a.session?.peer.metadata.url){let i=za(a.session?.peer.metadata.url);this.walletEntry=i?.entry,this.walletClientType=i?.walletClientType||"unknown"}}),a}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var hc=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===(0,fc.getAddress)(t)).length:!1},Wn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||en:en,Gn=class extends Ru.default{constructor(r,o,n,a,i,l,s,d,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new Le:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=d,this.privyAppName=u,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;Q.get(rc)&&(Q.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Q.del(o)}),Q.del(rc));let r=Mp(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:a,legacyInjectedProvider:i})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:a,legacyInjectedProvider:i})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!So()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)||null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)||null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(a=>a.address===o.address&&a.connectorType===o.connectorType&&a.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length,this.emit("walletsUpdated")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,a){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=r;else{let l=new Ya(r,o,this.rpcConfig,this.chains,a,n.id),s=new es(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let a=this.findWalletConnector(r,o);if(a)return a instanceof zr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new ts(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Un(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Un(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Un(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Fn(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Qa(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new os(this.defaultChain):new zr(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize()}loadConnectionHistory(){let r=i=>i&&typeof i.address=="string"&&typeof i.connectorType=="string"&&typeof i.walletClientType=="string"&&typeof i.connectedAt=="number",o=Q.get(oc);return o&&Array.isArray(o)&&o.map(i=>r(i)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));Q.put(oc,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=(0,fc.getAddress)(r),this.emit("walletsUpdated")}};function Ja(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var Iu=require("ofetch");var uv=[ka,Ia,Ra],Cs=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=Na,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Iu.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:a})=>{let i=new Headers(a.headers);i.set("privy-app-id",this.appId),i.set("privy-ca-id",this.clientAnalyticsId||""),i.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!uv.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new _a}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw we(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw we(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw we(o)}}};var Mo=y(require("js-cookie"));function Mu(e){return e instanceof xo?"email":e instanceof nn?"sms":e instanceof on?"siwe":e instanceof Sn?"custom_auth":e instanceof Hr?e.meta.provider:null}var Wu=y(require("jose")),qr=class{static parse(t){try{return new qr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Wu.decodeJwt(t)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(t=0){let r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var mv=30,bs=class{constructor(){this.authenticateOnce=new Pt(async t=>this._authenticate(t)),this.linkOnce=new Pt(async t=>this._link(t)),this.refreshOnce=new Pt(this._refresh.bind(this)),this.destroyOnce=new Pt(this._destroy.bind(this)),this.forkSessionOnce=new Pt(this._forkSession.bind(this))}get token(){try{let t=Q.get(Zo);return typeof t=="string"?new qr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Q.get(Da);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Q.get(Oi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Mo.default.get(Fa);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=qr.parse(this.token);return t!==null&&!t.isExpired(mv)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(t){try{let{token:r,refresh_token:o,user:n,is_new_user:a}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let i=Mu(t);return i&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:i,isNewUser:a}),i==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:$t(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),Tt(r)}}async _link(t){try{let r=await t.link();return $t(r)}catch(r){throw console.warn("Error linking account"),Tt(r)}}async _refresh(){if(!this.api)throw new _("Session has no API instance");if(!this.client)throw new _("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(ka,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Ia,{refresh_token:o}),this.clearForkedToken();else return null;return n.session_update_action==="set"&&(this.storeToken(n.token),this.storeRefreshToken(n.refresh_token)),n.session_update_action==="clear"&&this.destroyLocalState(),n.session_update_action==="ignore"&&n.token&&this.storeToken(n.token),$t(n.user)}catch(n){if(n instanceof Br&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Tt(n)}}async _destroy(){try{await this.api?.post(Ra,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new _("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Bd,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw Tt(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=Q.get(Zo);if(Q.put(Zo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=qr.parse(t)?.expiration;Mo.default.set(ec,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else Q.del(Zo),Mo.default.remove(ec)}storeRefreshToken(t){typeof t=="string"?(Q.put(Da,t),this.client?.useServerCookies||(Mo.default.set(Fa,"t",{sameSite:"Strict",secure:!0,expires:30}),Mo.default.set(tc,t,{sameSite:"Strict",secure:!0,expires:30}))):(Q.del(Da),Mo.default.remove(tc),Mo.default.remove(Fa))}clearForkedToken(){Q.del(Oi)}};var yc,Es,Ou,Vn=class{constructor(t){Sa(this,Es);this.apiUrl=t.apiUrl||Oa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||wp,this.appId=t.appId,this.clientAnalyticsId=Fd(this,Es,Ou).call(this),yc||(yc=new bs),this.session=yc,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:a,walletList:i,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new Gn(this.appId,t,r,o,n,a,i,l,s))}generateApi(){let t=new Cs(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new _("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new _("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let r=await this.api.post(Xd,{address:t});return $t(r)}catch(r){throw Tt(r)}}async acceptTerms(){try{let t=await this.api.post(pp,{});return $t(t)}catch(t){throw Tt(t)}}async unlinkPhone(t){try{let r=await this.api.post(op,{phoneNumber:t});return $t(r)}catch(r){throw Tt(r)}}async unlinkWallet(t){try{let r=await this.api.post(zd,{address:t});return $t(r)}catch(r){throw Tt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(lp,{provider:t,subject:r});return $t(o)}catch(o){throw Tt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Yd,{fid:t});return $t(r)}catch(r){throw Tt(r)}}async createAnalyticsEvent(t,r,o){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(up,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(mp,t)}catch(r){throw Tt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?qr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw Tt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}};Es=new WeakSet,Ou=function(){if(typeof window>"u")return null;try{let r=Q.get(Ni);if(typeof r=="string"&&r.length>0)return r}catch{}let t=(0,Lu.v4)();try{return Q.put(Ni,t),t}catch{return t}};var Uu=require("@marsidev/react-turnstile"),Ts=require("react");var sr=require("react");var Fu=require("react/jsx-runtime"),Nu=(0,sr.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),Tr=class extends mt{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Du=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=(0,sr.useRef)(null),[a,i]=(0,sr.useState)(),[l,s]=(0,sr.useState)(),[d,u]=(0,sr.useState)(!1),v=(0,sr.useMemo)(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return(0,Fu.jsx)(Nu.Provider,{value:{...v,ref:n,enabled:o,siteKey:r,appId:t,setToken:i,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),i(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),i(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await kp(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Tr("Captcha failed",null,"captcha_timeout")}}},children:e})},_e=()=>(0,sr.useContext)(Nu);var gc=require("react/jsx-runtime"),Ps=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=_e(),[,s]=(0,Ts.useMemo)(()=>r?.split("t:")||[],[r]);if((0,Ts.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,gc.jsx)("div",{className:"hidden h-0 w-0",children:(0,gc.jsx)(Uu.Turnstile,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:d=>{e.onSuccess?.(d),a(d),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};var Eo=require("react"),Kg=y(require("react-dom"));var xs=require("react");var vc=(0,xs.createContext)({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,initLoginWithOAuth:E,loginWithOAuth:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E}),L=()=>(0,xs.useContext)(vc);var Ss=require("react");var ye=(0,Ss.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkFarcaster:E,setActiveWallet:E,forkSession:E,createWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,requestFarcasterSigner:E,submitCast:E,removeCast:E,likeCast:E,recastCast:E,followUser:E,unfollowUser:E,initLoginWithEmail:E,initLoginWithSms:E,loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,isHeadlessOAuthLoading:!1,isModalOpen:!1}),V=()=>(0,Ss.useContext)(ye);var _s=require("react"),Bu=e=>{let[t,r]=(0,_s.useState)("auto");return(0,_s.useEffect)(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};var zn=require("react"),Hu={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},wc=(0,zn.createContext)(void 0),Gu=()=>(0,zn.useContext)(wc);function De(e,t){if(!t)return;let o=Gu().current[e];return(0,zn.useEffect)(()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(a);return()=>{for(let[n,a]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(i=>i!==a)}},[t])}function D(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Vu(){let e=Gu();return(t,r,...o)=>D(e,t,r,...o)}function As(e){De("configureMfa",e)}var Ac=y(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),Qu=y(require("@heroicons/react/24/solid/DocumentCheckIcon")),Xu=y(require("styled-components"));var cr=y(require("styled-components"));var ks=y(require("styled-components")),Wo=require("react/jsx-runtime"),lr=({success:e,fail:t})=>(0,Wo.jsxs)(Wo.Fragment,{children:[(0,Wo.jsx)(Lt,{className:e?"success":t?"fail":""}),(0,Wo.jsx)(Cc,{className:e?"success":t?"fail":""})]}),Lt=ks.default.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -48,7 +48,7 @@ Resources:
48
48
  animation: none;
49
49
  opacity: 0.5;
50
50
  }
51
- `,an=e=>(0,Wo.jsx)(mv,{color:e.color||"var(--privy-color-foreground-3)"}),mv=(0,ks.default)(Lt)`
51
+ `,an=e=>(0,Wo.jsx)(fv,{color:e.color||"var(--privy-color-foreground-3)"}),fv=(0,ks.default)(Lt)`
52
52
  && {
53
53
  height: 0.9rem;
54
54
  width: 0.9rem;
@@ -85,13 +85,13 @@ Resources:
85
85
  color: var(--privy-color-foreground-3);
86
86
  cursor: not-allowed;
87
87
  }
88
- `,U=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Ze.jsx)(Vu,{disabled:t||r,...n,children:t?(0,Ze.jsxs)("span",{children:[(0,Ze.jsx)(an,{}),o?(0,Ze.jsx)("span",{children:o}):null]}):e}),e5=(0,cr.default)(U)`
88
+ `,U=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Ze.jsx)(zu,{disabled:t||r,...n,children:t?(0,Ze.jsxs)("span",{children:[(0,Ze.jsx)(an,{}),o?(0,Ze.jsx)("span",{children:o}):null]}):e}),o5=(0,cr.default)(U)`
89
89
  ${e=>e.hideAnimations&&cr.css`
90
90
  && {
91
91
  transition: none;
92
92
  }
93
93
  `}
94
- `,Is=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Ze.jsx)(Vu,{as:"a",disabled:t||r,...n,children:t?(0,Ze.jsxs)("span",{children:[(0,Ze.jsx)(an,{}),o?(0,Ze.jsx)("span",{children:o}):null]}):e}),Vu=(0,cr.default)(Rs)`
94
+ `,Is=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Ze.jsx)(zu,{as:"a",disabled:t||r,...n,children:t?(0,Ze.jsxs)("span",{children:[(0,Ze.jsx)(an,{}),o?(0,Ze.jsx)("span",{children:o}):null]}):e}),zu=(0,cr.default)(Rs)`
95
95
  position: relative;
96
96
 
97
97
  && {
@@ -136,7 +136,7 @@ Resources:
136
136
  opacity: 1;
137
137
  animation: fadein 200ms ease;
138
138
  }
139
- `,Pr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Ze.jsx)(fv,{disabled:t||r,...n,children:t?(0,Ze.jsxs)("span",{children:[(0,Ze.jsx)(an,{}),o?(0,Ze.jsx)("span",{children:o}):null]}):e}),fv=(0,cr.default)(Rs)`
139
+ `,Pr=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Ze.jsx)(hv,{disabled:t||r,...n,children:t?(0,Ze.jsxs)("span",{children:[(0,Ze.jsx)(an,{}),o?(0,Ze.jsx)("span",{children:o}):null]}):e}),hv=(0,cr.default)(Rs)`
140
140
  && {
141
141
  border-width: 1px;
142
142
  border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
@@ -196,10 +196,10 @@ Resources:
196
196
  cursor: not-allowed;
197
197
  }
198
198
  }
199
- `,t5=cr.default.div`
199
+ `,n5=cr.default.div`
200
200
  /* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
201
201
  height: 44px;
202
- `,qn=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>(0,Ze.jsxs)(hv,{isSubmitting:o,onClick:t,disabled:r,...n,children:[(0,Ze.jsx)("span",{children:e}),(0,Ze.jsx)("span",{children:(0,Ze.jsx)(an,{})})]}),hv=cr.default.button`
202
+ `,qn=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>(0,Ze.jsxs)(yv,{isSubmitting:o,onClick:t,disabled:r,...n,children:[(0,Ze.jsx)("span",{children:e}),(0,Ze.jsx)("span",{children:(0,Ze.jsx)(an,{})})]}),yv=cr.default.button`
203
203
  && {
204
204
  color: var(--privy-color-accent);
205
205
  font-size: 16px;
@@ -277,7 +277,7 @@ Resources:
277
277
  @media all and (display-mode: standalone) {
278
278
  padding-bottom: 30px;
279
279
  }
280
- `;var qu=y(require("@heroicons/react/24/outline/ArrowLeftIcon")),$u=y(require("@heroicons/react/24/outline/XMarkIcon")),Ws=y(require("styled-components"));var _t=require("react/jsx-runtime"),zu=()=>(0,_t.jsx)("div",{}),yv=({backFn:e})=>(0,_t.jsx)("div",{children:(0,_t.jsx)(ju,{onClick:e,children:(0,_t.jsx)(qu.default,{height:"16px",width:"16px",strokeWidth:2})})}),gv=e=>(0,_t.jsx)("div",{children:(0,_t.jsx)(ju,{"aria-label":"close modal",onClick:e.onClose,children:(0,_t.jsx)($u.default,{height:"16px",width:"16px",strokeWidth:2})})});var k=({backFn:e,onClose:t,title:r,closeable:o=!0})=>{let{closePrivyModal:n}=L(),{app:a}=A();return(0,_t.jsxs)(vv,{children:[e?(0,_t.jsx)(yv,{backFn:e}):(0,_t.jsx)(zu,{}),r&&(0,_t.jsx)(wv,{id:"privy-dialog-title",children:r}),a?.render.inDialog&&o?(0,_t.jsx)(gv,{onClose:t||(()=>n())}):(0,_t.jsx)(zu,{})]})},ju=Ws.default.button`
280
+ `;var $u=y(require("@heroicons/react/24/outline/ArrowLeftIcon")),ju=y(require("@heroicons/react/24/outline/XMarkIcon")),Ws=y(require("styled-components"));var _t=require("react/jsx-runtime"),qu=()=>(0,_t.jsx)("div",{}),gv=({backFn:e})=>(0,_t.jsx)("div",{children:(0,_t.jsx)(Ku,{onClick:e,children:(0,_t.jsx)($u.default,{height:"16px",width:"16px",strokeWidth:2})})}),vv=e=>(0,_t.jsx)("div",{children:(0,_t.jsx)(Ku,{"aria-label":"close modal",onClick:e.onClose,children:(0,_t.jsx)(ju.default,{height:"16px",width:"16px",strokeWidth:2})})});var k=({backFn:e,onClose:t,title:r,closeable:o=!0})=>{let{closePrivyModal:n}=L(),{app:a}=A();return(0,_t.jsxs)(wv,{children:[e?(0,_t.jsx)(gv,{backFn:e}):(0,_t.jsx)(qu,{}),r&&(0,_t.jsx)(Cv,{id:"privy-dialog-title",children:r}),a?.render.inDialog&&o?(0,_t.jsx)(vv,{onClose:t||(()=>n())}):(0,_t.jsx)(qu,{})]})},Ku=Ws.default.button`
281
281
  && {
282
282
  cursor: pointer;
283
283
  display: flex;
@@ -296,7 +296,7 @@ Resources:
296
296
  opacity: 1;
297
297
  }
298
298
  }
299
- `,vv=Ws.default.div`
299
+ `,wv=Ws.default.div`
300
300
  padding: 16px 0;
301
301
  display: flex;
302
302
  align-items: center;
@@ -318,7 +318,7 @@ Resources:
318
318
  display: flex;
319
319
  justify-content: flex-end;
320
320
  }
321
- `,wv=Ws.default.div`
321
+ `,Cv=Ws.default.div`
322
322
  overflow: hidden;
323
323
  white-space: nowrap;
324
324
  max-width: 100%;
@@ -348,7 +348,7 @@ Resources:
348
348
  &::-webkit-scrollbar {
349
349
  display: none;
350
350
  }
351
- `,Ku=po.css`
351
+ `,Yu=po.css`
352
352
  && {
353
353
  width: 100%;
354
354
  font-size: 16px;
@@ -387,9 +387,9 @@ Resources:
387
387
  }
388
388
  }
389
389
  `,He=po.default.button`
390
- ${Ku}
390
+ ${Yu}
391
391
  `,Tc=po.default.a`
392
- ${Ku}
392
+ ${Yu}
393
393
  `,uo=po.default.div`
394
394
  width: 100%;
395
395
  ${e=>e.if?"display: none;":""}
@@ -421,7 +421,7 @@ Resources:
421
421
  @media (max-width: 440px) {
422
422
  padding: 10px 10px 20px;
423
423
  }
424
- `,Yu=Qe.default.div`
424
+ `,Ju=Qe.default.div`
425
425
  display: flex;
426
426
  flex-direction: column;
427
427
  align-items: stretch;
@@ -516,7 +516,7 @@ Resources:
516
516
  width: 100%;
517
517
  display: flex;
518
518
  justify-content: space-between;
519
- `,Ju=Qe.default.p`
519
+ `,Zu=Qe.default.p`
520
520
  text-align: left;
521
521
  width: 100%;
522
522
  color: var(--privy-color-foreground-3) !important;
@@ -565,10 +565,10 @@ Resources:
565
565
  width: auto !important;
566
566
  color: white;
567
567
  }
568
- `;var Ke=require("react/jsx-runtime"),Xu=()=>{let{user:e,logout:t}=V(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=A(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:s}=L(),d=v=>{v?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=d;let u=async v=>{v.preventDefault(),await i(),e&&or(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>{console.error(h),s("embedded_wallet_creation_failure_logout",{error:h,screen:"AffirmativeConsentScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return(0,Ke.jsx)(Cv,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:d})},Cv=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>(0,Ke.jsxs)(Ke.Fragment,{children:[(0,Ke.jsx)(k,{closeable:!1}),(0,Ke.jsx)(Zu.default,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),(0,Ke.jsx)(Ae,{style:{marginTop:24},children:"One last step"}),(0,Ke.jsx)(ge,{children:"By signing up, you agree to our terms and privacy policy."}),(0,Ke.jsxs)(dr,{style:{marginTop:24},children:[e&&(0,Ke.jsxs)(Tc,{target:"_blank",href:e,children:["View Terms ",(0,Ke.jsx)(Ac.default,{style:{marginLeft:"auto"}})]}),t&&(0,Ke.jsxs)(Tc,{target:"_blank",href:t,children:["View Privacy Policy ",(0,Ke.jsx)(Ac.default,{style:{marginLeft:"auto"}})]})]}),(0,Ke.jsxs)(bv,{style:{marginTop:24},children:[(0,Ke.jsx)(Pr,{onClick:o,children:"No thanks"}),(0,Ke.jsx)(U,{onClick:r,children:"Accept"})]}),(0,Ke.jsx)(q,{protectedByPrivy:!0})]}),bv=Qu.default.div`
568
+ `;var Ke=require("react/jsx-runtime"),em=()=>{let{user:e,logout:t}=V(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=A(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:s}=L(),d=v=>{v?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=d;let u=async v=>{v.preventDefault(),await i(),e&&or(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>{console.error(h),s("embedded_wallet_creation_failure_logout",{error:h,screen:"AffirmativeConsentScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return(0,Ke.jsx)(bv,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:d})},bv=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>(0,Ke.jsxs)(Ke.Fragment,{children:[(0,Ke.jsx)(k,{closeable:!1}),(0,Ke.jsx)(Qu.default,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),(0,Ke.jsx)(Ae,{style:{marginTop:24},children:"One last step"}),(0,Ke.jsx)(ge,{children:"By signing up, you agree to our terms and privacy policy."}),(0,Ke.jsxs)(dr,{style:{marginTop:24},children:[e&&(0,Ke.jsxs)(Tc,{target:"_blank",href:e,children:["View Terms ",(0,Ke.jsx)(Ac.default,{style:{marginLeft:"auto"}})]}),t&&(0,Ke.jsxs)(Tc,{target:"_blank",href:t,children:["View Privacy Policy ",(0,Ke.jsx)(Ac.default,{style:{marginLeft:"auto"}})]})]}),(0,Ke.jsxs)(Ev,{style:{marginTop:24},children:[(0,Ke.jsx)(Pr,{onClick:o,children:"No thanks"}),(0,Ke.jsx)(U,{onClick:r,children:"Accept"})]}),(0,Ke.jsx)(q,{protectedByPrivy:!0})]}),Ev=Xu.default.div`
569
569
  display: flex;
570
570
  gap: 10px;
571
- `;var Gs=y(require("styled-components"));var em=y(require("styled-components")),Bs=em.default.span`
571
+ `;var Gs=y(require("styled-components"));var tm=y(require("styled-components")),Bs=tm.default.span`
572
572
  && {
573
573
  width: 82px;
574
574
  height: 82px;
@@ -583,7 +583,7 @@ Resources:
583
583
  transition: border-color 800ms;
584
584
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
585
585
  }
586
- `;var kc=require("react/jsx-runtime"),Hs=({style:e,...t})=>(0,kc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:(0,kc.jsx)("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});var $e=require("react/jsx-runtime"),tm=()=>{let{navigate:e,app:t}=A(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return(0,$e.jsxs)($e.Fragment,{children:[(0,$e.jsx)(k,{}),(0,$e.jsxs)(Ev,{children:[(0,$e.jsx)(Pv,{children:(0,$e.jsxs)("div",{children:[(0,$e.jsx)(Bs,{}),(0,$e.jsx)(Hs,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),(0,$e.jsxs)(Tv,{children:[typeof r=="string"?(0,$e.jsx)("h3",{children:r}):(0,$e.jsx)($e.Fragment,{children:r}),typeof o=="string"?(0,$e.jsx)("p",{children:o}):(0,$e.jsx)($e.Fragment,{children:o})]}),t?.allowlistConfig.errorCtaLink?(0,$e.jsx)(U,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):(0,$e.jsx)(U,{onClick:()=>{e("LANDING")},children:n})]})]})},Ev=Gs.default.div`
586
+ `;var kc=require("react/jsx-runtime"),Hs=({style:e,...t})=>(0,kc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:(0,kc.jsx)("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});var $e=require("react/jsx-runtime"),rm=()=>{let{navigate:e,app:t}=A(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return(0,$e.jsxs)($e.Fragment,{children:[(0,$e.jsx)(k,{}),(0,$e.jsxs)(Tv,{children:[(0,$e.jsx)(xv,{children:(0,$e.jsxs)("div",{children:[(0,$e.jsx)(Bs,{}),(0,$e.jsx)(Hs,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),(0,$e.jsxs)(Pv,{children:[typeof r=="string"?(0,$e.jsx)("h3",{children:r}):(0,$e.jsx)($e.Fragment,{children:r}),typeof o=="string"?(0,$e.jsx)("p",{children:o}):(0,$e.jsx)($e.Fragment,{children:o})]}),t?.allowlistConfig.errorCtaLink?(0,$e.jsx)(U,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):(0,$e.jsx)(U,{onClick:()=>{e("LANDING")},children:n})]})]})},Tv=Gs.default.div`
587
587
  display: flex;
588
588
  flex-direction: column;
589
589
  align-items: center;
@@ -591,11 +591,11 @@ Resources:
591
591
  gap: 24px;
592
592
  width: 100%;
593
593
  padding-bottom: 16px;
594
- `,Tv=Gs.default.div`
594
+ `,Pv=Gs.default.div`
595
595
  display: flex;
596
596
  flex-direction: column;
597
597
  gap: 8px;
598
- `,Pv=Gs.default.div`
598
+ `,xv=Gs.default.div`
599
599
  display: flex;
600
600
  flex-direction: column;
601
601
  justify-content: center;
@@ -618,7 +618,7 @@ Resources:
618
618
  left: -19px;
619
619
  top: -19px;
620
620
  }
621
- `;var cm=y(require("@heroicons/react/24/outline/EnvelopeIcon")),dm=y(require("@heroicons/react/24/outline/PhoneIcon")),No=require("react"),pm=require("react-device-detect"),Yn=y(require("styled-components"));var Nt=y(require("styled-components")),pr=Nt.default.div`
621
+ `;var dm=y(require("@heroicons/react/24/outline/EnvelopeIcon")),pm=y(require("@heroicons/react/24/outline/PhoneIcon")),No=require("react"),um=require("react-device-detect"),Yn=y(require("styled-components"));var Nt=y(require("styled-components")),pr=Nt.default.div`
622
622
  display: flex;
623
623
  flex-direction: column;
624
624
  align-items: flex-start;
@@ -633,7 +633,7 @@ Resources:
633
633
  justify-content: center;
634
634
  flex-grow: 1;
635
635
  width: 100%;
636
- `,rm=Nt.default.div`
636
+ `,om=Nt.default.div`
637
637
  display: flex;
638
638
  flex-direction: column;
639
639
  align-items: center;
@@ -650,12 +650,12 @@ Resources:
650
650
  display: flex;
651
651
  flex-direction: column;
652
652
  gap: 8px;
653
- `,A5=Nt.default.div`
653
+ `,I5=Nt.default.div`
654
654
  display: flex;
655
655
  flex-direction: column;
656
656
  justify-content: space-between;
657
657
  height: 100%;
658
- `,om=Nt.default.div`
658
+ `,nm=Nt.default.div`
659
659
  display: flex;
660
660
  flex-direction: column;
661
661
  justify-content: flex-start;
@@ -682,9 +682,9 @@ Resources:
682
682
  height: 16px;
683
683
  `,le=Nt.default.div`
684
684
  height: 12px;
685
- `,nm=Nt.default.div`
686
- position: relative;
687
685
  `,im=Nt.default.div`
686
+ position: relative;
687
+ `,am=Nt.default.div`
688
688
  background-color: var(--privy-color-accent);
689
689
  display: flex;
690
690
  justify-content: center;
@@ -692,9 +692,9 @@ Resources:
692
692
  border-radius: 50%;
693
693
  border-color: white;
694
694
  border-width: 2px !important;
695
- `;var Vs=y(require("styled-components")),Sr=require("react/jsx-runtime"),$i=({title:e,description:t,children:r,...o})=>(0,Sr.jsx)(am,{...o,children:(0,Sr.jsxs)(Sr.Fragment,{children:[(0,Sr.jsx)("h3",{children:e}),typeof t=="string"?(0,Sr.jsx)("p",{children:t}):t,r]})}),$r=(0,Vs.default)($i)`
695
+ `;var Vs=y(require("styled-components")),Sr=require("react/jsx-runtime"),$i=({title:e,description:t,children:r,...o})=>(0,Sr.jsx)(sm,{...o,children:(0,Sr.jsxs)(Sr.Fragment,{children:[(0,Sr.jsx)("h3",{children:e}),typeof t=="string"?(0,Sr.jsx)("p",{children:t}):t,r]})}),$r=(0,Vs.default)($i)`
696
696
  margin-bottom: 24px;
697
- `,Ge=({title:e,description:t,icon:r,children:o,...n})=>(0,Sr.jsxs)(xv,{...n,children:[r||null,(0,Sr.jsx)("h3",{children:e}),typeof t=="string"?(0,Sr.jsx)("p",{children:t}):t,o]}),am=Vs.default.div`
697
+ `,Ge=({title:e,description:t,icon:r,children:o,...n})=>(0,Sr.jsxs)(Sv,{...n,children:[r||null,(0,Sr.jsx)("h3",{children:e}),typeof t=="string"?(0,Sr.jsx)("p",{children:t}):t,o]}),sm=Vs.default.div`
698
698
  display: flex;
699
699
  flex-direction: column;
700
700
  justify-content: flex-start;
@@ -714,7 +714,7 @@ Resources:
714
714
  color: var(--privy-color-foreground-2);
715
715
  font-size: 14px;
716
716
  }
717
- `,xv=(0,Vs.default)(am)`
717
+ `,Sv=(0,Vs.default)(sm)`
718
718
  align-items: center;
719
719
  text-align: center;
720
720
  gap: 16px;
@@ -722,7 +722,7 @@ Resources:
722
722
  h3 {
723
723
  margin-bottom: 24px;
724
724
  }
725
- `;var fe=require("react/jsx-runtime"),Ic=6,sm=new Array(Ic).fill(""),Sv=1400;var um=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{closePrivyModal:a,resendEmailCode:i,resendSmsCode:l,getAuthMeta:s,loginWithCode:d,updateWallets:u,createAnalyticsEvent:v}=L(),{authenticated:h,logout:w,user:T}=V(),[C,S]=(0,No.useState)(sm),[b,x]=(0,No.useState)(!1),[I,W]=(0,No.useState)(null),[R,H]=(0,No.useState)(null);n.current=()=>null;let B=s()?.email?0:1,G=e?.render.inDialog?at:0,P=e?.render.inDialog?G-500:0;(0,No.useEffect)(()=>{if(h&&b&&T){if(e?.legal.requireUsersAcceptTerms&&!T.hasAcceptedTerms){let ae=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},P);return()=>clearTimeout(ae)}if(or(T,e?.embeddedWallets?.createOnLogin)){let ae=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:j=>{console.error(j),v("embedded_wallet_creation_failure_logout",{error:j,screen:"AwaitingPasswordlessCodeScreen"}),w()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},P);return()=>clearTimeout(ae)}else{u();let ae=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),G);return()=>clearTimeout(ae)}}},[h,b,T]),(0,No.useEffect)(()=>{if(I&&R===0){let se=setTimeout(()=>{S(sm),W(null),document.querySelector("input[name=code-0]")?.focus()},Sv);return()=>clearTimeout(se)}},[I]);let J=se=>{se.preventDefault();let ae=se.currentTarget.value.replace(" ","");if(ae==="")return;if(isNaN(Number(ae))){W("Code should be numeric"),H(1);return}W(null),H(null);let j=Number(se.currentTarget.name?.charAt(5)),Ue=[...ae||[""]].slice(0,Ic-j),Oe=[...C.slice(0,j),...Ue,...C.slice(j+Ue.length)];S(Oe);let no=Ue.length,Gt=Math.min(Math.max(j+no,0),Ic-1);isNaN(Number(se.currentTarget.value))||document.querySelector(`input[name=code-${Gt}]`)?.focus(),Oe.every(je=>je&&!isNaN(+je))&&(document.querySelector(`input[name=code-${Gt}]`)?.blur(),d(Oe.join("")).then(()=>x(!0)).catch(Me=>{Me?.status===422?W("Invalid or expired verification code"):Me instanceof Br&&Me.privyErrorCode==="cannot_link_more_of_type"?W(Me.message):W("Issue verifying code"),H(0)}))},N=se=>{R===1&&(W(null),H(null));let ae=[...C.slice(0,se),"",...C.slice(se+1)];S(ae),se>0&&document.querySelector(`input[name=code-${se-1}]`)?.focus()},te=B==0?(0,fe.jsx)(cm.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):(0,fe.jsx)(dm.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),ue=B==0?(0,fe.jsxs)("p",{children:["Please check ",(0,fe.jsx)(lm,{children:s()?.email})," for an email from privy.io and enter your code below."]}):(0,fe.jsxs)("p",{children:["Please check ",(0,fe.jsx)(lm,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(k,{backFn:()=>r()},"header"),(0,fe.jsxs)(_v,{children:[(0,fe.jsx)(Ge,{title:"Enter confirmation code",description:ue,icon:te}),(0,fe.jsxs)(rm,{children:[(0,fe.jsxs)(Av,{children:[(0,fe.jsx)(kv,{fail:!!I,success:b,children:(0,fe.jsx)("span",{children:I||(b?"Success!":"")})}),(0,fe.jsx)("div",{children:C.map((se,ae)=>(0,fe.jsx)("input",{name:`code-${ae}`,type:"text",value:C[ae],onChange:J,onKeyUp:j=>{j.key==="Backspace"&&N(ae)},inputMode:"numeric",autoFocus:ae===0,pattern:"[0-9]",className:`${b?"success":""} ${I?"fail":""}`,autoComplete:pm.isMobile?"one-time-code":"off"},ae))})]}),(0,fe.jsx)(Rv,{children:B==0?(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)("span",{children:"Didn't get an email?"}),(0,fe.jsx)("button",{onClick:i,children:"Resend code"})]}):(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)("span",{children:"Didn't get a message?"}),(0,fe.jsx)("button",{onClick:l,children:"Resend code"})]})})]})]}),(0,fe.jsx)(q,{protectedByPrivy:!0})]})},_v=Yn.default.div`
725
+ `;var fe=require("react/jsx-runtime"),Ic=6,lm=new Array(Ic).fill(""),_v=1400;var mm=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{closePrivyModal:a,resendEmailCode:i,resendSmsCode:l,getAuthMeta:s,loginWithCode:d,updateWallets:u,createAnalyticsEvent:v}=L(),{authenticated:h,logout:w,user:T}=V(),[C,S]=(0,No.useState)(lm),[b,x]=(0,No.useState)(!1),[I,W]=(0,No.useState)(null),[R,H]=(0,No.useState)(null);n.current=()=>null;let B=s()?.email?0:1,G=e?.render.inDialog?at:0,P=e?.render.inDialog?G-500:0;(0,No.useEffect)(()=>{if(h&&b&&T){if(e?.legal.requireUsersAcceptTerms&&!T.hasAcceptedTerms){let ae=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},P);return()=>clearTimeout(ae)}if(or(T,e?.embeddedWallets?.createOnLogin)){let ae=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:j=>{console.error(j),v("embedded_wallet_creation_failure_logout",{error:j,screen:"AwaitingPasswordlessCodeScreen"}),w()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},P);return()=>clearTimeout(ae)}else{u();let ae=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),G);return()=>clearTimeout(ae)}}},[h,b,T]),(0,No.useEffect)(()=>{if(I&&R===0){let se=setTimeout(()=>{S(lm),W(null),document.querySelector("input[name=code-0]")?.focus()},_v);return()=>clearTimeout(se)}},[I]);let J=se=>{se.preventDefault();let ae=se.currentTarget.value.replace(" ","");if(ae==="")return;if(isNaN(Number(ae))){W("Code should be numeric"),H(1);return}W(null),H(null);let j=Number(se.currentTarget.name?.charAt(5)),Ue=[...ae||[""]].slice(0,Ic-j),Oe=[...C.slice(0,j),...Ue,...C.slice(j+Ue.length)];S(Oe);let no=Ue.length,Gt=Math.min(Math.max(j+no,0),Ic-1);isNaN(Number(se.currentTarget.value))||document.querySelector(`input[name=code-${Gt}]`)?.focus(),Oe.every(je=>je&&!isNaN(+je))&&(document.querySelector(`input[name=code-${Gt}]`)?.blur(),d(Oe.join("")).then(()=>x(!0)).catch(Me=>{Me?.status===422?W("Invalid or expired verification code"):Me instanceof Br&&Me.privyErrorCode==="cannot_link_more_of_type"?W(Me.message):W("Issue verifying code"),H(0)}))},N=se=>{R===1&&(W(null),H(null));let ae=[...C.slice(0,se),"",...C.slice(se+1)];S(ae),se>0&&document.querySelector(`input[name=code-${se-1}]`)?.focus()},te=B==0?(0,fe.jsx)(dm.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):(0,fe.jsx)(pm.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),ue=B==0?(0,fe.jsxs)("p",{children:["Please check ",(0,fe.jsx)(cm,{children:s()?.email})," for an email from privy.io and enter your code below."]}):(0,fe.jsxs)("p",{children:["Please check ",(0,fe.jsx)(cm,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)(k,{backFn:()=>r()},"header"),(0,fe.jsxs)(Av,{children:[(0,fe.jsx)(Ge,{title:"Enter confirmation code",description:ue,icon:te}),(0,fe.jsxs)(om,{children:[(0,fe.jsxs)(kv,{children:[(0,fe.jsx)(Rv,{fail:!!I,success:b,children:(0,fe.jsx)("span",{children:I||(b?"Success!":"")})}),(0,fe.jsx)("div",{children:C.map((se,ae)=>(0,fe.jsx)("input",{name:`code-${ae}`,type:"text",value:C[ae],onChange:J,onKeyUp:j=>{j.key==="Backspace"&&N(ae)},inputMode:"numeric",autoFocus:ae===0,pattern:"[0-9]",className:`${b?"success":""} ${I?"fail":""}`,autoComplete:um.isMobile?"one-time-code":"off"},ae))})]}),(0,fe.jsx)(Iv,{children:B==0?(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)("span",{children:"Didn't get an email?"}),(0,fe.jsx)("button",{onClick:i,children:"Resend code"})]}):(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsx)("span",{children:"Didn't get a message?"}),(0,fe.jsx)("button",{onClick:l,children:"Resend code"})]})})]})]}),(0,fe.jsx)(q,{protectedByPrivy:!0})]})},Av=Yn.default.div`
726
726
  display: flex;
727
727
  flex-direction: column;
728
728
  align-items: flex-start;
@@ -730,7 +730,7 @@ Resources:
730
730
  margin: auto;
731
731
  gap: 16px;
732
732
  flex-grow: 1;
733
- `,Av=Yn.default.div`
733
+ `,kv=Yn.default.div`
734
734
  display: flex;
735
735
  flex-direction: column;
736
736
  width: 100%;
@@ -786,7 +786,7 @@ Resources:
786
786
  transform: translate(1px, 0px);
787
787
  }
788
788
  }
789
- `,kv=Yn.default.div`
789
+ `,Rv=Yn.default.div`
790
790
  line-height: 20px;
791
791
  height: 20px;
792
792
  font-size: 13px;
@@ -794,7 +794,7 @@ Resources:
794
794
  display: flex;
795
795
  justify-content: flex-end;
796
796
  width: 100%;
797
- `,Rv=Yn.default.div`
797
+ `,Iv=Yn.default.div`
798
798
  font-size: 13px;
799
799
  color: var(--privy-color-foreground-3);
800
800
  display: flex;
@@ -808,10 +808,10 @@ Resources:
808
808
  > button {
809
809
  text-decoration: underline;
810
810
  }
811
- `,lm=Yn.default.span`
811
+ `,cm=Yn.default.span`
812
812
  font-weight: 500;
813
813
  word-break: break-all;
814
- `;var ym=y(require("@heroicons/react/24/solid/CheckCircleIcon")),gm=y(require("@heroicons/react/24/solid/XCircleIcon")),jt=require("react"),vm=y(require("styled-components"));var mm=y(require("styled-components"));var _r=require("react/jsx-runtime"),fm=({icon:e})=>{let t=e;return(0,_r.jsx)(_r.Fragment,{children:(0,_r.jsx)(Iv,{children:(0,_r.jsxs)("div",{children:[(0,_r.jsx)(lr,{}),typeof t=="string"?(0,_r.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?(0,_r.jsx)(t,{style:{width:"38px",height:"38px"}}):(0,_r.jsx)("span",{})]})})})},Iv=mm.default.div`
814
+ `;var gm=y(require("@heroicons/react/24/solid/CheckCircleIcon")),vm=y(require("@heroicons/react/24/solid/XCircleIcon")),jt=require("react"),wm=y(require("styled-components"));var fm=y(require("styled-components"));var _r=require("react/jsx-runtime"),hm=({icon:e})=>{let t=e;return(0,_r.jsx)(_r.Fragment,{children:(0,_r.jsx)(Mv,{children:(0,_r.jsxs)("div",{children:[(0,_r.jsx)(lr,{}),typeof t=="string"?(0,_r.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?(0,_r.jsx)(t,{style:{width:"38px",height:"38px"}}):(0,_r.jsx)("span",{})]})})})},Mv=fm.default.div`
815
815
  display: flex;
816
816
  flex-direction: column;
817
817
  justify-content: center;
@@ -834,14 +834,14 @@ Resources:
834
834
  left: -19px;
835
835
  top: -19px;
836
836
  }
837
- `;var Xe=require("react/jsx-runtime"),wm=500,hm=wm*2,Cm=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=A(),{status:i,token:l,waitForResult:s,reset:d,execute:u}=_e(),v=(0,jt.useRef)([]),h=te=>{v.current=[te,...v.current]},[w,T]=(0,jt.useState)(!0);(0,jt.useEffect)(()=>{let te=setTimeout(T,hm,!1);return h(te),()=>{v.current.forEach(ue=>clearTimeout(ue)),v.current=[]}},[]);let[C,S]=(0,jt.useState)(""),[b,x]=(0,jt.useState)("Checking that you are a human..."),[I,W]=(0,jt.useState)((0,Xe.jsx)(U,{onClick:()=>{},disabled:!0,children:"Continue"})),[R,H]=(0,jt.useState)(!1),[B,G]=(0,jt.useState)(3),P=r?.captchaModalData,J=async te=>{try{await P?.callback(te),P?.onSuccessNavigateTo&&n(P?.onSuccessNavigateTo,!1)}catch(ue){if(ue instanceof Tr)return;{let se={error:ue,previousScreen:e||"LANDING"};a({errorModalData:se}),n(P?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};(0,jt.useEffect)(()=>{if(i==="success"){let te=setTimeout(async()=>{let ue=await s();!ue||P?.userIntentRequired||J(ue)},hm);h(te)}else if(i==="ready"){let te=setTimeout(()=>{i==="ready"&&u()},wm);h(te)}},[i]),(0,jt.useEffect)(()=>{if(!w)switch(i){case"success":S("Success!"),x("CAPTCHA passed successfully."),W((0,Xe.jsx)(U,{onClick:()=>{H(!0),J(l)},disabled:!P?.userIntentRequired,loading:R,children:P?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":S(""),x("Checking that you are a human..."),W((0,Xe.jsx)(U,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":S("Something went wrong"),B<=0?(x("If you use an adblocker or VPN, try disabling and re-attempting."),W(null)):(x("You did not pass CAPTCHA. Please try again."),W((0,Xe.jsx)(U,{onClick:N,children:"Retry"})));break;case"ready":default:break}},[i,w,R]);let N=async()=>{if(B<=0)return;G(ue=>ue-1),d(),u();let te=await s();!te||P?.userIntentRequired||J(te)};return(0,Xe.jsxs)(Xe.Fragment,{children:[(0,Xe.jsx)(k,{backFn:!e||t===e?void 0:o}),(0,Xe.jsxs)(Mv,{children:[i==="success"?(0,Xe.jsx)(ym.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?(0,Xe.jsx)(gm.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):(0,Xe.jsx)(fm,{}),(0,Xe.jsxs)(gt,{children:[C?(0,Xe.jsx)("h3",{children:C}):null,(0,Xe.jsx)("p",{children:b})]}),I]}),(0,Xe.jsx)(ie,{})]})},Mv=vm.default.div`
837
+ `;var Xe=require("react/jsx-runtime"),Cm=500,ym=Cm*2,bm=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=A(),{status:i,token:l,waitForResult:s,reset:d,execute:u}=_e(),v=(0,jt.useRef)([]),h=te=>{v.current=[te,...v.current]},[w,T]=(0,jt.useState)(!0);(0,jt.useEffect)(()=>{let te=setTimeout(T,ym,!1);return h(te),()=>{v.current.forEach(ue=>clearTimeout(ue)),v.current=[]}},[]);let[C,S]=(0,jt.useState)(""),[b,x]=(0,jt.useState)("Checking that you are a human..."),[I,W]=(0,jt.useState)((0,Xe.jsx)(U,{onClick:()=>{},disabled:!0,children:"Continue"})),[R,H]=(0,jt.useState)(!1),[B,G]=(0,jt.useState)(3),P=r?.captchaModalData,J=async te=>{try{await P?.callback(te),P?.onSuccessNavigateTo&&n(P?.onSuccessNavigateTo,!1)}catch(ue){if(ue instanceof Tr)return;{let se={error:ue,previousScreen:e||"LANDING"};a({errorModalData:se}),n(P?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};(0,jt.useEffect)(()=>{if(i==="success"){let te=setTimeout(async()=>{let ue=await s();!ue||P?.userIntentRequired||J(ue)},ym);h(te)}else if(i==="ready"){let te=setTimeout(()=>{i==="ready"&&u()},Cm);h(te)}},[i]),(0,jt.useEffect)(()=>{if(!w)switch(i){case"success":S("Success!"),x("CAPTCHA passed successfully."),W((0,Xe.jsx)(U,{onClick:()=>{H(!0),J(l)},disabled:!P?.userIntentRequired,loading:R,children:P?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":S(""),x("Checking that you are a human..."),W((0,Xe.jsx)(U,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":S("Something went wrong"),B<=0?(x("If you use an adblocker or VPN, try disabling and re-attempting."),W(null)):(x("You did not pass CAPTCHA. Please try again."),W((0,Xe.jsx)(U,{onClick:N,children:"Retry"})));break;case"ready":default:break}},[i,w,R]);let N=async()=>{if(B<=0)return;G(ue=>ue-1),d(),u();let te=await s();!te||P?.userIntentRequired||J(te)};return(0,Xe.jsxs)(Xe.Fragment,{children:[(0,Xe.jsx)(k,{backFn:!e||t===e?void 0:o}),(0,Xe.jsxs)(Wv,{children:[i==="success"?(0,Xe.jsx)(gm.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?(0,Xe.jsx)(vm.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):(0,Xe.jsx)(hm,{}),(0,Xe.jsxs)(gt,{children:[C?(0,Xe.jsx)("h3",{children:C}):null,(0,Xe.jsx)("p",{children:b})]}),I]}),(0,Xe.jsx)(ie,{})]})},Wv=wm.default.div`
838
838
  display: flex;
839
839
  flex-direction: column;
840
840
  align-items: center;
841
841
  justify-content: center;
842
842
  gap: 24px;
843
843
  width: 100%;
844
- `;var Sm=y(require("@heroicons/react/24/outline/WalletIcon")),_m=require("react-device-detect"),Am=y(require("styled-components"));var Rt=require("react/jsx-runtime"),bm=({...e})=>(0,Rt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[(0,Rt.jsx)("defs",{children:(0,Rt.jsxs)("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[(0,Rt.jsx)("stop",{offset:"0",stopColor:"#f1562b"}),(0,Rt.jsx)("stop",{offset:"0.3",stopColor:"#f1542b"}),(0,Rt.jsx)("stop",{offset:"0.41",stopColor:"#f04d2a"}),(0,Rt.jsx)("stop",{offset:"0.49",stopColor:"#ef4229"}),(0,Rt.jsx)("stop",{offset:"0.5",stopColor:"#ef4029"}),(0,Rt.jsx)("stop",{offset:"0.56",stopColor:"#e83e28"}),(0,Rt.jsx)("stop",{offset:"0.67",stopColor:"#e13c26"}),(0,Rt.jsx)("stop",{offset:"1",stopColor:"#df3c26"})]})}),(0,Rt.jsx)("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),(0,Rt.jsx)("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});var et=require("react/jsx-runtime"),Em=({style:e,...t})=>(0,et.jsxs)("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),(0,et.jsx)("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),(0,et.jsxs)("g",{mask:"url(#mask0_16909_31415)",children:[(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),(0,et.jsxs)("defs",{children:[(0,et.jsxs)("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,et.jsx)("stop",{"stop-color":"#002D72"}),(0,et.jsx)("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),(0,et.jsxs)("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,et.jsx)("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),(0,et.jsx)("stop",{offset:"1","stop-color":"#002D72"})]})]})]});var z=require("react/jsx-runtime"),Tm=({style:e,...t})=>(0,z.jsxs)("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,z.jsx)("g",{clipPath:"url(#clip0_5_32)",children:(0,z.jsxs)("g",{clipPath:"url(#clip1_5_32)",children:[(0,z.jsx)("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,z.jsx)("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),(0,z.jsx)("g",{mask:"url(#mask0_5_32)",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),(0,z.jsx)("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),(0,z.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),(0,z.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),(0,z.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),(0,z.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),(0,z.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),(0,z.jsxs)("defs",{children:[(0,z.jsxs)("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#174299"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),(0,z.jsxs)("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,z.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,z.jsxs)("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FF4000"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,z.jsxs)("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#8754C9"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),(0,z.jsxs)("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,z.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,z.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsxs)("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,z.jsx)("stop",{stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsxs)("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[(0,z.jsx)("stop",{stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsx)("clipPath",{id:"clip0_5_32",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"white"})}),(0,z.jsx)("clipPath",{id:"clip1_5_32",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"white"})})]})]});var Dt=require("react/jsx-runtime"),Pm=({style:e,...t})=>(0,Dt.jsxs)("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,Dt.jsx)("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),(0,Dt.jsxs)("g",{filter:"url(#filter0_d_12393_20043)",children:[(0,Dt.jsx)("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});var mo=require("react/jsx-runtime"),xm=({style:e,...t})=>(0,mo.jsxs)("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,mo.jsxs)("g",{clipPath:"url(#clip0_1704_1423)",children:[(0,mo.jsx)("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),(0,mo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),(0,mo.jsx)("defs",{children:(0,mo.jsx)("clipPath",{id:"clip0_1704_1423",children:(0,mo.jsx)("rect",{width:"176",height:"176",fill:"white"})})})]});var fo=require("react/jsx-runtime"),jr={coinbase_wallet:{logo:Ka,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Nn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Gr,displayName:"Phantom"},rainbow:{logo:Tm,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:qi,displayName:"WalletConnect"},zerion:{logo:xm,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:bm,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Em,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Pm,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="}},sn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=A(),{connectWallet:i}=L(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{So()?(i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(_m.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},(0,fo.jsxs)(Nv,{onClick:s,children:[(0,fo.jsx)(Ov,{icon:Lv(e,n.connectorType)??r,name:n.walletClientType}),(0,fo.jsx)("span",{children:Wv(e,n.connectorType)||t||n.walletClientType}),(0,fo.jsx)("span",{id:"connect-text",children:"Connect"})]})},Wv=(e,t)=>{if(jr[e]?.displayName)return jr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Lv=(e,t)=>{if(jr[e]?.logo)return jr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return qi},Ov=({icon:e,name:t})=>typeof e=="string"?(0,fo.jsx)("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?(0,fo.jsx)(Sm.default,{}):e?(0,fo.jsx)(e,{}):null,Nv=(0,Am.default)(He)`
844
+ `;var _m=y(require("@heroicons/react/24/outline/WalletIcon")),Am=require("react-device-detect"),km=y(require("styled-components"));var Rt=require("react/jsx-runtime"),Em=({...e})=>(0,Rt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[(0,Rt.jsx)("defs",{children:(0,Rt.jsxs)("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[(0,Rt.jsx)("stop",{offset:"0",stopColor:"#f1562b"}),(0,Rt.jsx)("stop",{offset:"0.3",stopColor:"#f1542b"}),(0,Rt.jsx)("stop",{offset:"0.41",stopColor:"#f04d2a"}),(0,Rt.jsx)("stop",{offset:"0.49",stopColor:"#ef4229"}),(0,Rt.jsx)("stop",{offset:"0.5",stopColor:"#ef4029"}),(0,Rt.jsx)("stop",{offset:"0.56",stopColor:"#e83e28"}),(0,Rt.jsx)("stop",{offset:"0.67",stopColor:"#e13c26"}),(0,Rt.jsx)("stop",{offset:"1",stopColor:"#df3c26"})]})}),(0,Rt.jsx)("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),(0,Rt.jsx)("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});var et=require("react/jsx-runtime"),Tm=({style:e,...t})=>(0,et.jsxs)("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),(0,et.jsx)("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),(0,et.jsxs)("g",{mask:"url(#mask0_16909_31415)",children:[(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),(0,et.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),(0,et.jsxs)("defs",{children:[(0,et.jsxs)("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,et.jsx)("stop",{"stop-color":"#002D72"}),(0,et.jsx)("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),(0,et.jsxs)("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,et.jsx)("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),(0,et.jsx)("stop",{offset:"1","stop-color":"#002D72"})]})]})]});var z=require("react/jsx-runtime"),Pm=({style:e,...t})=>(0,z.jsxs)("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,z.jsx)("g",{clipPath:"url(#clip0_5_32)",children:(0,z.jsxs)("g",{clipPath:"url(#clip1_5_32)",children:[(0,z.jsx)("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,z.jsx)("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),(0,z.jsx)("g",{mask:"url(#mask0_5_32)",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),(0,z.jsx)("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),(0,z.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),(0,z.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),(0,z.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),(0,z.jsx)("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),(0,z.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),(0,z.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),(0,z.jsxs)("defs",{children:[(0,z.jsxs)("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#174299"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),(0,z.jsxs)("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,z.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,z.jsxs)("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FF4000"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,z.jsxs)("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#8754C9"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),(0,z.jsxs)("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,z.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,z.jsx)("stop",{stopColor:"#FFF700"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,z.jsxs)("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,z.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsxs)("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,z.jsx)("stop",{stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsxs)("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[(0,z.jsx)("stop",{stopColor:"#00AAFF"}),(0,z.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,z.jsx)("clipPath",{id:"clip0_5_32",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"white"})}),(0,z.jsx)("clipPath",{id:"clip1_5_32",children:(0,z.jsx)("rect",{width:"120",height:"120",fill:"white"})})]})]});var Dt=require("react/jsx-runtime"),xm=({style:e,...t})=>(0,Dt.jsxs)("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,Dt.jsx)("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),(0,Dt.jsxs)("g",{filter:"url(#filter0_d_12393_20043)",children:[(0,Dt.jsx)("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),(0,Dt.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});var mo=require("react/jsx-runtime"),Sm=({style:e,...t})=>(0,mo.jsxs)("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,mo.jsxs)("g",{clipPath:"url(#clip0_1704_1423)",children:[(0,mo.jsx)("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),(0,mo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),(0,mo.jsx)("defs",{children:(0,mo.jsx)("clipPath",{id:"clip0_1704_1423",children:(0,mo.jsx)("rect",{width:"176",height:"176",fill:"white"})})})]});var fo=require("react/jsx-runtime"),jr={coinbase_wallet:{logo:Ka,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Nn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Gr,displayName:"Phantom"},rainbow:{logo:Pm,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:qi,displayName:"WalletConnect"},zerion:{logo:Sm,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Em,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Tm,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:xm,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="}},sn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=A(),{connectWallet:i}=L(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{So()?(i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(Am.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},(0,fo.jsxs)(Dv,{onClick:s,children:[(0,fo.jsx)(Nv,{icon:Ov(e,n.connectorType)??r,name:n.walletClientType}),(0,fo.jsx)("span",{children:Lv(e,n.connectorType)||t||n.walletClientType}),(0,fo.jsx)("span",{id:"connect-text",children:"Connect"})]})},Lv=(e,t)=>{if(jr[e]?.displayName)return jr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Ov=(e,t)=>{if(jr[e]?.logo)return jr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return qi},Nv=({icon:e,name:t})=>typeof e=="string"?(0,fo.jsx)("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?(0,fo.jsx)(_m.default,{}):e?(0,fo.jsx)(e,{}):null,Dv=(0,km.default)(He)`
845
845
  /* Show "Connect" on hover */
846
846
  > #connect-text {
847
847
  font-weight: 500;
@@ -863,23 +863,23 @@ Resources:
863
863
  display: none;
864
864
  }
865
865
  }
866
- `;var Ar=require("react/jsx-runtime"),Dv=["coinbase_wallet"],Fv=["metamask","okx_wallet","rainbow","uniswap","zerion"],Uv=["cryptocom"],Bv=["phantom"],Jn=({connectOnly:e})=>{let{connectors:t}=L(),{app:r}=A(),o=ji(r.appearance.walletList,t,e,r.appearance.walletList);return(0,Ar.jsxs)(Ar.Fragment,{children:[...o]})},ji=(e,t,r,o)=>{let n=[],a=[],i=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let d=t.filter(({connectorType:u,walletClientType:v})=>v==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(v));for(let u of d){let{walletClientType:v,walletBranding:h}=u;(v==="unknown"?a:n).push((0,Ar.jsx)(sn,{connectOnly:r,provider:v,logo:h.icon,displayName:h.name,connector:u},`${s}-${v}`))}}else if(Bv.includes(s)){let d=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);d&&n.push((0,Ar.jsx)(sn,{connectOnly:r,provider:s,connector:d},s))}else if(Fv.includes(s)){let d=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;d&&n.push((0,Ar.jsx)(sn,{connectOnly:r,provider:s,connector:d},s))}else if(Dv.includes(s)){let d=t.find(({connectorType:u})=>u===s);d&&n.push((0,Ar.jsx)(sn,{connectOnly:r,provider:s,connector:d},s))}else Uv.includes(s)?l&&i.push((0,Ar.jsx)(sn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&i.push((0,Ar.jsx)(sn,{connectOnly:r,provider:s,connector:l},s));return[...a,...n,...i]};var Kr=require("react/jsx-runtime"),km=()=>{let{app:e}=A(),t=`Connect a wallet to ${e?.name}`;return(0,Kr.jsxs)(Kr.Fragment,{children:[(0,Kr.jsx)(k,{},"header"),(0,Kr.jsx)($r,{title:"Connect your wallet",description:t}),(0,Kr.jsx)(dr,{children:(0,Kr.jsx)(Jn,{connectOnly:!0})}),(0,Kr.jsx)(q,{protectedByPrivy:!0})]})};var Lm=y(require("styled-components"));var Wm=y(require("styled-components"));var Rm=y(require("react"));var Mm=require("react/jsx-runtime"),Im=()=>{let{app:e}=A(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?(0,Mm.jsx)("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?Rm.default.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};var Mc=require("react/jsx-runtime"),Zn=e=>{let{app:t}=A();return t?.appearance.logo?(0,Mc.jsx)(Hv,{...e,children:(0,Mc.jsx)(Im,{})}):null},Hv=Wm.default.div`
866
+ `;var Ar=require("react/jsx-runtime"),Fv=["coinbase_wallet"],Uv=["metamask","okx_wallet","rainbow","uniswap","zerion"],Bv=["cryptocom"],Hv=["phantom"],Jn=({connectOnly:e})=>{let{connectors:t}=L(),{app:r}=A(),o=ji(r.appearance.walletList,t,e,r.appearance.walletList);return(0,Ar.jsxs)(Ar.Fragment,{children:[...o]})},ji=(e,t,r,o)=>{let n=[],a=[],i=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let d=t.filter(({connectorType:u,walletClientType:v})=>v==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(v));for(let u of d){let{walletClientType:v,walletBranding:h}=u;(v==="unknown"?a:n).push((0,Ar.jsx)(sn,{connectOnly:r,provider:v,logo:h.icon,displayName:h.name,connector:u},`${s}-${v}`))}}else if(Hv.includes(s)){let d=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);d&&n.push((0,Ar.jsx)(sn,{connectOnly:r,provider:s,connector:d},s))}else if(Uv.includes(s)){let d=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;d&&n.push((0,Ar.jsx)(sn,{connectOnly:r,provider:s,connector:d},s))}else if(Fv.includes(s)){let d=t.find(({connectorType:u})=>u===s);d&&n.push((0,Ar.jsx)(sn,{connectOnly:r,provider:s,connector:d},s))}else Bv.includes(s)?l&&i.push((0,Ar.jsx)(sn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&i.push((0,Ar.jsx)(sn,{connectOnly:r,provider:s,connector:l},s));return[...a,...n,...i]};var Kr=require("react/jsx-runtime"),Rm=()=>{let{app:e}=A(),t=`Connect a wallet to ${e?.name}`;return(0,Kr.jsxs)(Kr.Fragment,{children:[(0,Kr.jsx)(k,{},"header"),(0,Kr.jsx)($r,{title:"Connect your wallet",description:t}),(0,Kr.jsx)(dr,{children:(0,Kr.jsx)(Jn,{connectOnly:!0})}),(0,Kr.jsx)(q,{protectedByPrivy:!0})]})};var Om=y(require("styled-components"));var Lm=y(require("styled-components"));var Im=y(require("react"));var Wm=require("react/jsx-runtime"),Mm=()=>{let{app:e}=A(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?(0,Wm.jsx)("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?Im.default.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};var Mc=require("react/jsx-runtime"),Zn=e=>{let{app:t}=A();return t?.appearance.logo?(0,Mc.jsx)(Gv,{...e,children:(0,Mc.jsx)(Mm,{})}):null},Gv=Lm.default.div`
867
867
  display: flex;
868
868
  flex-direction: column;
869
869
  align-items: center;
870
870
  padding: 24px 0;
871
871
  flex-grow: 1;
872
872
  justify-content: center;
873
- `;var kr=require("react/jsx-runtime"),Om=()=>{let{app:e}=A();return(0,kr.jsxs)(kr.Fragment,{children:[(0,kr.jsx)(k,{},"header"),(0,kr.jsx)(Gv,{}),(0,kr.jsx)(dr,{children:(0,kr.jsx)(Jn,{connectOnly:!0})}),e&&(0,kr.jsx)($n,{app:e,alwaysShowImplicitConsent:!0}),(0,kr.jsx)(q,{protectedByPrivy:!0})]})},Gv=(0,Lm.default)(Zn)`
873
+ `;var kr=require("react/jsx-runtime"),Nm=()=>{let{app:e}=A();return(0,kr.jsxs)(kr.Fragment,{children:[(0,kr.jsx)(k,{},"header"),(0,kr.jsx)(Vv,{}),(0,kr.jsx)(dr,{children:(0,kr.jsx)(Jn,{connectOnly:!0})}),e&&(0,kr.jsx)($n,{app:e,alwaysShowImplicitConsent:!0}),(0,kr.jsx)(q,{protectedByPrivy:!0})]})},Vv=(0,Om.default)(Zn)`
874
874
  margin-bottom: 16px;
875
- `;var ei=require("react"),Um=require("react-device-detect"),Bm=y(require("styled-components"));var ur=require("react"),Xn=require("react-device-detect"),Dm=require("react-use"),Lc=y(require("styled-components"));var Qn=require("react");function Nm(){let[e,t]=(0,Qn.useState)(!1),r=(0,Qn.useCallback)(()=>{document.hidden&&t(!0)},[]);return(0,Qn.useEffect)(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}var Ee=require("react/jsx-runtime"),Wc=2,Oc=e=>e?.privyErrorCode==="linked_to_another_user"?lo.ERROR_USER_EXISTS:e instanceof Be&&!e.details.default?e.details:e instanceof In?lo.ERROR_TIMED_OUT:e instanceof Mn?lo.ERROR_USER_REJECTED_CONNECTION:lo.ERROR_WALLET_CONNECTION,Fm=()=>{let[e,t]=(0,ur.useState)(!1),[r,o]=(0,ur.useState)(!1),[n,a]=(0,ur.useState)(void 0),{authenticated:i,logout:l}=V(),{app:s,navigate:d,navigateBack:u,lastScreen:v,currentScreen:h,setModalData:w}=A(),{getAuthFlow:T,walletConnectionStatus:C,closePrivyModal:S,initLoginWithWallet:b,loginWithWallet:x,updateWallets:I,createAnalyticsEvent:W}=L(),{walletConnectors:R}=V(),[H,B]=(0,ur.useState)(0),{user:G}=V(),[P]=(0,ur.useState)(G?.linkedAccounts.length||0),[J,N]=(0,ur.useState)(""),[te,ue]=(0,ur.useState)(!1),{hasTabbedAway:se}=Nm(),{enabled:ae,token:j}=_e(),Ue=Xn.isMobile&&C?.connector?.connectorType==="wallet_connect_v2"||Xn.isMobile&&C?.connector?.connectorType==="coinbase_wallet"||Xn.isMobile&&C?.connector?.connectorType==="injected"&&C?.connector?.walletClientType==="phantom",Oe=C?.status==="connected",no=C?.status==="switching_to_supported_chain";(0,ur.useEffect)(()=>{let Z=T();if(Oe&&!Z&&(ae&&!j&&!i?(w({captchaModalData:{callback:nt=>b(C.connectedWallet,nt).then(()=>{ue(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN",!1)):b(C.connectedWallet,j).then(()=>{ue(!0)})),Z&&Ue&&Oe&&!Z.preparedMessage){Z.buildSiweMessage();return}!Z||Ue||!Oe||r||(async()=>{o(!0),a(void 0);try{C?.connector?.connectorType==="wallet_connect_v2"&&C?.connector?.walletClientType==="metamask"&&await ic(2500),await je()}catch(nt){console.warn("Auto-prompted signature failed",nt)}finally{o(!1)}})()},[H,Oe,te]),(0,ur.useEffect)(()=>{if(G&&e){let Z=s?.render.inDialog?at:0,nt=s?.render.inDialog?Z-500:0;if(s?.legal.requireUsersAcceptTerms&&!G.hasAcceptedTerms){let Ko=setTimeout(()=>{d("AFFIRMATIVE_CONSENT_SCREEN")},nt);return()=>clearTimeout(Ko)}if(or(G,s?.embeddedWallets?.createOnLogin)){let Ko=setTimeout(()=>{w({createWallet:{onSuccess:()=>{},onFailure:yr=>{console.error(yr),W("embedded_wallet_creation_failure_logout",{error:yr,screen:"ConnectionStatusScreen"}),l()},callAuthOnSuccessOnClose:!0}}),d("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},nt);return()=>clearTimeout(Ko)}I();let Mt=setTimeout(()=>S({shouldCallAuthOnSuccess:!0,isSuccess:!0}),at);return()=>clearTimeout(Mt)}},[G,e]);let Gt=Z=>{if(Z?.privyErrorCode==="allowlist_rejected"){d("ALLOWLIST_REJECTION_SCREEN");return}a(Oc(Z))};async function je(){try{if(await x(),!s?.render.inDialog)return S({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(Z){Gt(Z)}finally{o(!1)}}(0,ur.useEffect)(()=>{C?.connectError&&Gt(C?.connectError)},[C]),(0,Dm.useInterval)(()=>{let Z=Me==="wallet_connect_v2"&&C?.connector instanceof zr?C.connector.redirectUri:void 0;Z&&N(Z)},C?.connector instanceof zr&&!J?500:null);let Me=C?.connector?.connectorType||"injected",Vt=C?.connector?.walletClientType||"unknown",hr=jr[Vt]?.displayName||C?.connector?.walletBranding.name||"Browser Extension",To=jr[Vt]?.logo||C?.connector?.walletBranding.icon||(Z=>(0,Ee.jsx)(On,{...Z})),Dr=hr==="Browser Extension"?hr.toLowerCase():hr,O;e?O=`Successfully connected with ${Dr}`:n?O=n.message:no?O="Switching networks":Oe?O=r&&Ue?"Signing":"Sign to verify":O=`Waiting for ${Dr}`;let re="Don\u2019t see your wallet? Check your other browser windows.";if(e){let Z=G?.linkedAccounts.length||0;P===Z?re="Wallet was already linked.":re="You\u2019re good to go!"}else H>=Wc&&n?re="Unable to connect wallet":n?re=n.detail:no?re="Switch your wallet to the requested network.":Oe&&Ue?re="Sign the message in your wallet to verify it belongs to you.":Vt==="metamask"&&Xn.isMobile?re="Click continue to open and connect MetaMask.":Vt==="metamask"?re="For the best experience, connect only one wallet at a time.":Me==="wallet_connect"?re="Open your mobile wallet app to continue":Me==="coinbase_wallet"&&(yp()||(hc(G)?re="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":re="Open the Coinbase app on your phone to continue."));let ne=R?.walletConnectors?.find(Z=>Z.walletClientType==="coinbase_wallet"),Li=Vt==="coinbase_wallet"&&(hc(G)||n===lo.ERROR_USER_EXISTS);return(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)(k,{backFn:!v||h===v?void 0:u}),(0,Ee.jsxs)(zv,{children:[(0,Ee.jsx)(Nc,{walletLogo:To,success:e,fail:!!n}),(0,Ee.jsxs)(gt,{children:[(0,Ee.jsx)("h3",{children:O}),(0,Ee.jsx)("p",{children:re}),!Oe&&J&&!se?(0,Ee.jsxs)("p",{children:["Still here?"," ",(0,Ee.jsx)("a",{href:J,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Li?(0,Ee.jsx)(U,{onClick:()=>ne&&ne?.disconnect(),disabled:e,children:"Use a different wallet"}):n==lo.ERROR_USER_EXISTS&&h!==v?(0,Ee.jsx)(U,{onClick:u,children:"Use a different wallet"}):Oe&&!e&&Ue?(0,Ee.jsx)(U,{onClick:()=>{o(!0),je(),Vv(Vt)},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&H<Wc?(0,Ee.jsx)(U,{onClick:()=>{B(H+1),a(void 0),Oe?(o(!0),je()):C?.connectRetry()},disabled:!e&&(!n?.retryable||H>=Wc),children:"Retry"}):!e&&!n?(0,Ee.jsx)(U,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),(0,Ee.jsx)(ie,{})]})},Vv=e=>{if(!Xn.isMobile||!Lp(e))return;let t=Op(e);t&&window.open(t,"_self","noopener,noreferrer")},zv=Lc.default.div`
875
+ `;var ei=require("react"),Bm=require("react-device-detect"),Hm=y(require("styled-components"));var ur=require("react"),Xn=require("react-device-detect"),Fm=require("react-use"),Lc=y(require("styled-components"));var Qn=require("react");function Dm(){let[e,t]=(0,Qn.useState)(!1),r=(0,Qn.useCallback)(()=>{document.hidden&&t(!0)},[]);return(0,Qn.useEffect)(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}var Ee=require("react/jsx-runtime"),Wc=2,Oc=e=>e?.privyErrorCode==="linked_to_another_user"?lo.ERROR_USER_EXISTS:e instanceof Be&&!e.details.default?e.details:e instanceof In?lo.ERROR_TIMED_OUT:e instanceof Mn?lo.ERROR_USER_REJECTED_CONNECTION:lo.ERROR_WALLET_CONNECTION,Um=()=>{let[e,t]=(0,ur.useState)(!1),[r,o]=(0,ur.useState)(!1),[n,a]=(0,ur.useState)(void 0),{authenticated:i,logout:l}=V(),{app:s,navigate:d,navigateBack:u,lastScreen:v,currentScreen:h,setModalData:w}=A(),{getAuthFlow:T,walletConnectionStatus:C,closePrivyModal:S,initLoginWithWallet:b,loginWithWallet:x,updateWallets:I,createAnalyticsEvent:W}=L(),{walletConnectors:R}=V(),[H,B]=(0,ur.useState)(0),{user:G}=V(),[P]=(0,ur.useState)(G?.linkedAccounts.length||0),[J,N]=(0,ur.useState)(""),[te,ue]=(0,ur.useState)(!1),{hasTabbedAway:se}=Dm(),{enabled:ae,token:j}=_e(),Ue=Xn.isMobile&&C?.connector?.connectorType==="wallet_connect_v2"||Xn.isMobile&&C?.connector?.connectorType==="coinbase_wallet"||Xn.isMobile&&C?.connector?.connectorType==="injected"&&C?.connector?.walletClientType==="phantom",Oe=C?.status==="connected",no=C?.status==="switching_to_supported_chain";(0,ur.useEffect)(()=>{let Z=T();if(Oe&&!Z&&(ae&&!j&&!i?(w({captchaModalData:{callback:nt=>b(C.connectedWallet,nt).then(()=>{ue(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN",!1)):b(C.connectedWallet,j).then(()=>{ue(!0)})),Z&&Ue&&Oe&&!Z.preparedMessage){Z.buildSiweMessage();return}!Z||Ue||!Oe||r||(async()=>{o(!0),a(void 0);try{C?.connector?.connectorType==="wallet_connect_v2"&&C?.connector?.walletClientType==="metamask"&&await ic(2500),await je()}catch(nt){console.warn("Auto-prompted signature failed",nt)}finally{o(!1)}})()},[H,Oe,te]),(0,ur.useEffect)(()=>{if(G&&e){let Z=s?.render.inDialog?at:0,nt=s?.render.inDialog?Z-500:0;if(s?.legal.requireUsersAcceptTerms&&!G.hasAcceptedTerms){let Ko=setTimeout(()=>{d("AFFIRMATIVE_CONSENT_SCREEN")},nt);return()=>clearTimeout(Ko)}if(or(G,s?.embeddedWallets?.createOnLogin)){let Ko=setTimeout(()=>{w({createWallet:{onSuccess:()=>{},onFailure:yr=>{console.error(yr),W("embedded_wallet_creation_failure_logout",{error:yr,screen:"ConnectionStatusScreen"}),l()},callAuthOnSuccessOnClose:!0}}),d("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},nt);return()=>clearTimeout(Ko)}I();let Mt=setTimeout(()=>S({shouldCallAuthOnSuccess:!0,isSuccess:!0}),at);return()=>clearTimeout(Mt)}},[G,e]);let Gt=Z=>{if(Z?.privyErrorCode==="allowlist_rejected"){d("ALLOWLIST_REJECTION_SCREEN");return}a(Oc(Z))};async function je(){try{if(await x(),!s?.render.inDialog)return S({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(Z){Gt(Z)}finally{o(!1)}}(0,ur.useEffect)(()=>{C?.connectError&&Gt(C?.connectError)},[C]),(0,Fm.useInterval)(()=>{let Z=Me==="wallet_connect_v2"&&C?.connector instanceof zr?C.connector.redirectUri:void 0;Z&&N(Z)},C?.connector instanceof zr&&!J?500:null);let Me=C?.connector?.connectorType||"injected",Vt=C?.connector?.walletClientType||"unknown",hr=jr[Vt]?.displayName||C?.connector?.walletBranding.name||"Browser Extension",To=jr[Vt]?.logo||C?.connector?.walletBranding.icon||(Z=>(0,Ee.jsx)(On,{...Z})),Dr=hr==="Browser Extension"?hr.toLowerCase():hr,O;e?O=`Successfully connected with ${Dr}`:n?O=n.message:no?O="Switching networks":Oe?O=r&&Ue?"Signing":"Sign to verify":O=`Waiting for ${Dr}`;let re="Don\u2019t see your wallet? Check your other browser windows.";if(e){let Z=G?.linkedAccounts.length||0;P===Z?re="Wallet was already linked.":re="You\u2019re good to go!"}else H>=Wc&&n?re="Unable to connect wallet":n?re=n.detail:no?re="Switch your wallet to the requested network.":Oe&&Ue?re="Sign the message in your wallet to verify it belongs to you.":Vt==="metamask"&&Xn.isMobile?re="Click continue to open and connect MetaMask.":Vt==="metamask"?re="For the best experience, connect only one wallet at a time.":Me==="wallet_connect"?re="Open your mobile wallet app to continue":Me==="coinbase_wallet"&&(yp()||(hc(G)?re="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":re="Open the Coinbase app on your phone to continue."));let ne=R?.walletConnectors?.find(Z=>Z.walletClientType==="coinbase_wallet"),Li=Vt==="coinbase_wallet"&&(hc(G)||n===lo.ERROR_USER_EXISTS);return(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)(k,{backFn:!v||h===v?void 0:u}),(0,Ee.jsxs)(qv,{children:[(0,Ee.jsx)(Nc,{walletLogo:To,success:e,fail:!!n}),(0,Ee.jsxs)(gt,{children:[(0,Ee.jsx)("h3",{children:O}),(0,Ee.jsx)("p",{children:re}),!Oe&&J&&!se?(0,Ee.jsxs)("p",{children:["Still here?"," ",(0,Ee.jsx)("a",{href:J,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Li?(0,Ee.jsx)(U,{onClick:()=>ne&&ne?.disconnect(),disabled:e,children:"Use a different wallet"}):n==lo.ERROR_USER_EXISTS&&h!==v?(0,Ee.jsx)(U,{onClick:u,children:"Use a different wallet"}):Oe&&!e&&Ue?(0,Ee.jsx)(U,{onClick:()=>{o(!0),je(),zv(Vt)},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&H<Wc?(0,Ee.jsx)(U,{onClick:()=>{B(H+1),a(void 0),Oe?(o(!0),je()):C?.connectRetry()},disabled:!e&&(!n?.retryable||H>=Wc),children:"Retry"}):!e&&!n?(0,Ee.jsx)(U,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),(0,Ee.jsx)(ie,{})]})},zv=e=>{if(!Xn.isMobile||!Lp(e))return;let t=Op(e);t&&window.open(t,"_self","noopener,noreferrer")},qv=Lc.default.div`
876
876
  display: flex;
877
877
  flex-direction: column;
878
878
  align-items: center;
879
879
  justify-content: center;
880
880
  gap: 24px;
881
881
  width: 100%;
882
- `,qv=Lc.default.div`
882
+ `,$v=Lc.default.div`
883
883
  display: flex;
884
884
  flex-direction: column;
885
885
  justify-content: center;
@@ -902,14 +902,14 @@ Resources:
902
902
  left: -19px;
903
903
  top: -19px;
904
904
  }
905
- `,Nc=e=>{let t=e.walletLogo;return(0,Ee.jsx)(Ee.Fragment,{children:(0,Ee.jsx)(qv,{children:(0,Ee.jsxs)("div",{children:[(0,Ee.jsx)(lr,{success:e.success,fail:e.fail}),typeof t=="string"?(0,Ee.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,Ee.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var vt=require("react/jsx-runtime"),zs=2,Hm=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=A(),{walletConnectionStatus:o,closePrivyModal:n}=L(),[a,i]=(0,ei.useState)(void 0),[l,s]=(0,ei.useState)(0),d=o?.status==="connected",u=o?.status==="switching_to_supported_chain";(0,ei.useEffect)(()=>{if(d){let I=setTimeout(n,at);return()=>clearTimeout(I)}},[d]);let v=I=>{i(Oc(I))};(0,ei.useEffect)(()=>{o?.connectError&&v(o?.connectError)},[o]);let h=o?.connector?.connectorType||"injected",w=o?.connector?.walletClientType||"unknown",T=jr[w]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",C=jr[w]?.logo||o?.connector?.walletBranding.icon||(I=>(0,vt.jsx)(On,{...I})),S=T==="Browser Extension"?T.toLowerCase():T,b;d?b=`Successfully connected with ${S}`:a?b=a.message:u?b="Switching networks":b=`Waiting for ${S}`;let x="Don\u2019t see your wallet? Check your other browser windows.";return d?x="You\u2019re good to go!":l>=zs&&a?x="Unable to connect wallet":a?x=a.detail:u?x="Switch your wallet to the requested network.":w==="metamask"&&Um.isMobile?x="Click to continue to open and connect MetaMask.":w==="metamask"?x="For the best experience, connect only one wallet at a time.":h==="wallet_connect_v2"?x="Open your mobile wallet app to continue":h==="coinbase_wallet"&&(x="Open the Coinbase app on your phone to continue."),(0,vt.jsxs)(vt.Fragment,{children:[(0,vt.jsx)(k,{backFn:r===t?void 0:e}),(0,vt.jsxs)($v,{children:[(0,vt.jsx)(Nc,{walletLogo:C,success:d,fail:!!a}),(0,vt.jsxs)(gt,{children:[(0,vt.jsx)("h3",{children:b}),(0,vt.jsx)("p",{children:x})]}),a==lo.ERROR_USER_EXISTS?(0,vt.jsx)(U,{onClick:e,children:"Use a different wallet"}):!d&&a?.retryable&&l<zs?(0,vt.jsx)(U,{onClick:()=>{s(l+1),i(void 0),o?.connectRetry()},disabled:!d&&(!a?.retryable||l>=zs),children:"Retry"}):!d&&a&&l>=zs?(0,vt.jsx)(U,{onClick:e,children:"Use a different wallet"}):null]}),(0,vt.jsx)(ie,{})]})},$v=Bm.default.div`
905
+ `,Nc=e=>{let t=e.walletLogo;return(0,Ee.jsx)(Ee.Fragment,{children:(0,Ee.jsx)($v,{children:(0,Ee.jsxs)("div",{children:[(0,Ee.jsx)(lr,{success:e.success,fail:e.fail}),typeof t=="string"?(0,Ee.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,Ee.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var vt=require("react/jsx-runtime"),zs=2,Gm=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=A(),{walletConnectionStatus:o,closePrivyModal:n}=L(),[a,i]=(0,ei.useState)(void 0),[l,s]=(0,ei.useState)(0),d=o?.status==="connected",u=o?.status==="switching_to_supported_chain";(0,ei.useEffect)(()=>{if(d){let I=setTimeout(n,at);return()=>clearTimeout(I)}},[d]);let v=I=>{i(Oc(I))};(0,ei.useEffect)(()=>{o?.connectError&&v(o?.connectError)},[o]);let h=o?.connector?.connectorType||"injected",w=o?.connector?.walletClientType||"unknown",T=jr[w]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",C=jr[w]?.logo||o?.connector?.walletBranding.icon||(I=>(0,vt.jsx)(On,{...I})),S=T==="Browser Extension"?T.toLowerCase():T,b;d?b=`Successfully connected with ${S}`:a?b=a.message:u?b="Switching networks":b=`Waiting for ${S}`;let x="Don\u2019t see your wallet? Check your other browser windows.";return d?x="You\u2019re good to go!":l>=zs&&a?x="Unable to connect wallet":a?x=a.detail:u?x="Switch your wallet to the requested network.":w==="metamask"&&Bm.isMobile?x="Click to continue to open and connect MetaMask.":w==="metamask"?x="For the best experience, connect only one wallet at a time.":h==="wallet_connect_v2"?x="Open your mobile wallet app to continue":h==="coinbase_wallet"&&(x="Open the Coinbase app on your phone to continue."),(0,vt.jsxs)(vt.Fragment,{children:[(0,vt.jsx)(k,{backFn:r===t?void 0:e}),(0,vt.jsxs)(jv,{children:[(0,vt.jsx)(Nc,{walletLogo:C,success:d,fail:!!a}),(0,vt.jsxs)(gt,{children:[(0,vt.jsx)("h3",{children:b}),(0,vt.jsx)("p",{children:x})]}),a==lo.ERROR_USER_EXISTS?(0,vt.jsx)(U,{onClick:e,children:"Use a different wallet"}):!d&&a?.retryable&&l<zs?(0,vt.jsx)(U,{onClick:()=>{s(l+1),i(void 0),o?.connectRetry()},disabled:!d&&(!a?.retryable||l>=zs),children:"Retry"}):!d&&a&&l>=zs?(0,vt.jsx)(U,{onClick:e,children:"Use a different wallet"}):null]}),(0,vt.jsx)(ie,{})]})},jv=Hm.default.div`
906
906
  display: flex;
907
907
  flex-direction: column;
908
908
  align-items: center;
909
909
  justify-content: center;
910
910
  gap: 24px;
911
911
  width: 100%;
912
- `;var qm=y(require("@heroicons/react/24/solid/XCircleIcon")),ni=require("react"),$m=y(require("styled-components"));var Ki=y(require("styled-components")),ti=require("react/jsx-runtime"),ri=()=>(0,ti.jsx)(jv,{children:(0,ti.jsxs)(Kv,{children:[(0,ti.jsx)(Yv,{}),(0,ti.jsx)(Jv,{})]})}),jv=Ki.default.div`
912
+ `;var $m=y(require("@heroicons/react/24/solid/XCircleIcon")),ni=require("react"),jm=y(require("styled-components"));var Ki=y(require("styled-components")),ti=require("react/jsx-runtime"),ri=()=>(0,ti.jsx)(Kv,{children:(0,ti.jsxs)(Yv,{children:[(0,ti.jsx)(Jv,{}),(0,ti.jsx)(Zv,{})]})}),Kv=Ki.default.div`
913
913
  display: flex;
914
914
  justify-content: center;
915
915
  align-items: center;
@@ -921,14 +921,14 @@ Resources:
921
921
  @media all and (display-mode: standalone) {
922
922
  margin-bottom: 30px;
923
923
  }
924
- `,Kv=Ki.default.div`
924
+ `,Yv=Ki.default.div`
925
925
  position: relative;
926
926
  height: 140px;
927
927
  width: 140px;
928
928
 
929
929
  opacity: 1;
930
930
  animation: fadein 200ms ease;
931
- `,Yv=Ki.default.div`
931
+ `,Jv=Ki.default.div`
932
932
  position: absolute;
933
933
  top: 0;
934
934
  right: 0;
@@ -941,7 +941,7 @@ Resources:
941
941
  border: 4px solid var(--privy-color-accent-light);
942
942
  border-radius: 50%;
943
943
  }
944
- `,Jv=Ki.default.div`
944
+ `,Zv=Ki.default.div`
945
945
  position: absolute;
946
946
  top: 0;
947
947
  right: 0;
@@ -965,20 +965,20 @@ Resources:
965
965
  transform: rotate(360deg);
966
966
  }
967
967
  }
968
- `;var Gm=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var ke=class extends Error{constructor(r,o){super(o);this.type=r}};function oi(e){let t=e.type;return typeof t=="string"&&Gm.includes(t)}function Zv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function ln(e){return oi(e)&&e.type==="wallet_not_on_device"}function Vm(e){return oi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function cn(e){return!!(oi(e)&&e.type==="mfa_timeout")}function dn(e){return!!(oi(e)&&e.type==="missing_or_invalid_mfa")}function qs(e){return!!(oi(e)&&e.type==="mfa_verification_max_attempts_reached")}function Dc(e){return!!(oi(e)&&e.message.includes("code 429"))}function Fc(e){return!!(Zv(e)&&e.message==="MFA canceled")}var Ft=require("react/jsx-runtime"),zm=1,jm=()=>{let{authenticated:e,user:t,getAccessToken:r}=V(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=L(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:d}=A(),u=(0,ni.useMemo)(()=>Date.now(),[]),[v,h]=(0,ni.useState)(!1),{onCompleteNavigateTo:w,onFailure:T}=l?.connectWallet,C=b=>{v||(h(!0),T(typeof b=="string"?new Error(b):b))};(0,ni.useEffect)(()=>{let b=Ne(t),x;return!e||!b?C("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let W=await r();if(!W)return C("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:W,address:b.address});let R=(Date.now()-u)/1e3;w==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&R<zm?x=setTimeout(()=>{i(w)},(zm-R)*1e3):i(w)}catch(R){if(ln(R)&&b.recoveryMethod==="privy"){let H=await r();if(!H)return C("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:b.address}),(await a?.recover({address:b.address,accessToken:H}))?.address||C(new Error("Unable to recover wallet")),w?i(w):o({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:b.address}),i(w)}catch{C("An error has occurred, please try again.")}}else ln(R)?(s({...l,recoverWallet:{privyWallet:b,onCompleteNavigateTo:w,onFailure:T}}),i("EMBEDDED_WALLET_RECOVERY_SCREEN")):C(R)}})(),()=>clearTimeout(x)):void 0},[e,t,a]);let S=()=>{C("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return d.current=S,(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsx)(k,{onClose:S}),v?(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsxs)(xr,{children:[(0,Ft.jsx)(qm.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Ft.jsx)(Ge,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),(0,Ft.jsx)(U,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):(0,Ft.jsx)(ri,{}),(0,Ft.jsx)(Qv,{})]})},Qv=$m.default.div`
968
+ `;var Vm=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var ke=class extends Error{constructor(r,o){super(o);this.type=r}};function oi(e){let t=e.type;return typeof t=="string"&&Vm.includes(t)}function Qv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function ln(e){return oi(e)&&e.type==="wallet_not_on_device"}function zm(e){return oi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function cn(e){return!!(oi(e)&&e.type==="mfa_timeout")}function dn(e){return!!(oi(e)&&e.type==="missing_or_invalid_mfa")}function qs(e){return!!(oi(e)&&e.type==="mfa_verification_max_attempts_reached")}function Dc(e){return!!(oi(e)&&e.message.includes("code 429"))}function Fc(e){return!!(Qv(e)&&e.message==="MFA canceled")}var Ft=require("react/jsx-runtime"),qm=1,Km=()=>{let{authenticated:e,user:t,getAccessToken:r}=V(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=L(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:d}=A(),u=(0,ni.useMemo)(()=>Date.now(),[]),[v,h]=(0,ni.useState)(!1),{onCompleteNavigateTo:w,onFailure:T}=l?.connectWallet,C=b=>{v||(h(!0),T(typeof b=="string"?new Error(b):b))};(0,ni.useEffect)(()=>{let b=Ne(t),x;return!e||!b?C("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let W=await r();if(!W)return C("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:W,address:b.address});let R=(Date.now()-u)/1e3;w==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&R<qm?x=setTimeout(()=>{i(w)},(qm-R)*1e3):i(w)}catch(R){if(ln(R)&&b.recoveryMethod==="privy"){let H=await r();if(!H)return C("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:b.address}),(await a?.recover({address:b.address,accessToken:H}))?.address||C(new Error("Unable to recover wallet")),w?i(w):o({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:b.address}),i(w)}catch{C("An error has occurred, please try again.")}}else ln(R)?(s({...l,recoverWallet:{privyWallet:b,onCompleteNavigateTo:w,onFailure:T}}),i("EMBEDDED_WALLET_RECOVERY_SCREEN")):C(R)}})(),()=>clearTimeout(x)):void 0},[e,t,a]);let S=()=>{C("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return d.current=S,(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsx)(k,{onClose:S}),v?(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsxs)(xr,{children:[(0,Ft.jsx)($m.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Ft.jsx)(Ge,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),(0,Ft.jsx)(U,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):(0,Ft.jsx)(ri,{}),(0,Ft.jsx)(Xv,{})]})},Xv=jm.default.div`
969
969
  height: 44px;
970
- `;var Km=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Ym=require("react");var mr=require("react/jsx-runtime"),Jm=()=>{let{user:e}=V(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=L(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=A(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:d}=a.createWallet,u=()=>{let v=Ne(e);v?(o(),l(v)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:d})};return(0,Ym.useEffect)(()=>{let v=setTimeout(u,Cp);return()=>clearTimeout(v)},[]),i.current=u,(0,mr.jsxs)(mr.Fragment,{children:[(0,mr.jsx)(k,{onClose:u}),(0,mr.jsx)(X,{}),(0,mr.jsxs)(xr,{children:[(0,mr.jsx)(Km.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,mr.jsx)(Ge,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),(0,mr.jsx)(le,{}),(0,mr.jsx)(q,{protectedByPrivy:!0})]})};var Xm=y(require("@heroicons/react/20/solid/ExclamationTriangleIcon")),ef=y(require("@heroicons/react/24/outline/ArrowRightOnRectangleIcon")),ho=require("react"),yo=y(require("styled-components"));var de=require("react/jsx-runtime"),tf=()=>{let[e,t]=(0,ho.useState)(null),{authenticated:r,user:o,getAccessToken:n}=V(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:l}=L(),{data:s,onUserCloseViaDialogOrKeybindRef:d}=A(),u=Ne(o)?.address,{onFailure:v,onSuccess:h,origin:w,appId:T}=s.keyExport,C=b=>{a({shouldCallAuthOnSuccess:!1}),v(typeof b=="string"?new Error(b):b)},S=()=>{a({shouldCallAuthOnSuccess:!1}),h(),i("embedded_wallet_key_export_completed",{walletAddress:u})};return(0,ho.useEffect)(()=>{let b=Ne(o);if(!r||!b)return C("User must be authenticated before exporting their wallet");n().then(t,C)},[r,o]),d.current=S,(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)(k,{onClose:S}),(0,de.jsxs)(tw,{children:[(0,de.jsxs)(Ge,{icon:(0,de.jsx)(ef.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[(0,de.jsxs)(iw,{children:[(0,de.jsx)(ew,{style:{marginRight:6}}),_o(u)]}),(0,de.jsx)("p",{children:"You can bring your account with you to another site using an external wallet."})]}),(0,de.jsxs)(rw,{children:[(0,de.jsxs)(Zm,{children:[(0,de.jsx)(Qm,{children:"1"}),(0,de.jsxs)("span",{children:[(0,de.jsx)("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),(0,de.jsxs)(Zm,{children:[(0,de.jsx)(Qm,{children:"2"}),(0,de.jsx)("span",{children:"Copy this key into your other wallet"})]})]}),(0,de.jsx)("div",{style:{width:"100%"},children:e&&(0,de.jsx)(Xv,{origin:w,appId:T,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),(0,de.jsxs)(aw,{children:[(0,de.jsxs)("div",{children:[(0,de.jsx)(Xm.default,{viewBox:"0 0 20 18"}),(0,de.jsx)("h4",{children:"Warning"})]}),(0,de.jsx)("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),(0,de.jsx)(q,{protectedByPrivy:!0})]})};function Xv(e){let[t,r]=(0,ho.useState)(e.dimensions.width),[o,n]=(0,ho.useState)(void 0),a=(0,ho.useRef)(null);return(0,ho.useEffect)(()=>{if(a.current&&t===void 0){let{width:l}=a.current.getBoundingClientRect();r(l)}let i=getComputedStyle(document.documentElement);n({background2:i.getPropertyValue("--privy-color-background-2"),foreground3:i.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:i.getPropertyValue("--privy-color-foreground-accent"),accent:i.getPropertyValue("--privy-color-accent"),accentDark:i.getPropertyValue("--privy-color-accent-dark"),success:i.getPropertyValue("--privy-color-success")})},[]),(0,de.jsx)("div",{ref:a,children:t&&(0,de.jsxs)(ow,{children:[(0,de.jsx)("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Ha(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),(0,de.jsx)(nw,{children:"Loading..."})]})})}function ew(e){return(0,de.jsx)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:(0,de.jsx)("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var tw=yo.default.div`
970
+ `;var Ym=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Jm=require("react");var mr=require("react/jsx-runtime"),Zm=()=>{let{user:e}=V(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=L(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=A(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:d}=a.createWallet,u=()=>{let v=Ne(e);v?(o(),l(v)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:d})};return(0,Jm.useEffect)(()=>{let v=setTimeout(u,Cp);return()=>clearTimeout(v)},[]),i.current=u,(0,mr.jsxs)(mr.Fragment,{children:[(0,mr.jsx)(k,{onClose:u}),(0,mr.jsx)(X,{}),(0,mr.jsxs)(xr,{children:[(0,mr.jsx)(Ym.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,mr.jsx)(Ge,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),(0,mr.jsx)(le,{}),(0,mr.jsx)(q,{protectedByPrivy:!0})]})};var ef=y(require("@heroicons/react/20/solid/ExclamationTriangleIcon")),tf=y(require("@heroicons/react/24/outline/ArrowRightOnRectangleIcon")),ho=require("react"),yo=y(require("styled-components"));var de=require("react/jsx-runtime"),rf=()=>{let[e,t]=(0,ho.useState)(null),{authenticated:r,user:o,getAccessToken:n}=V(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:l}=L(),{data:s,onUserCloseViaDialogOrKeybindRef:d}=A(),u=Ne(o)?.address,{onFailure:v,onSuccess:h,origin:w,appId:T}=s.keyExport,C=b=>{a({shouldCallAuthOnSuccess:!1}),v(typeof b=="string"?new Error(b):b)},S=()=>{a({shouldCallAuthOnSuccess:!1}),h(),i("embedded_wallet_key_export_completed",{walletAddress:u})};return(0,ho.useEffect)(()=>{let b=Ne(o);if(!r||!b)return C("User must be authenticated before exporting their wallet");n().then(t,C)},[r,o]),d.current=S,(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)(k,{onClose:S}),(0,de.jsxs)(rw,{children:[(0,de.jsxs)(Ge,{icon:(0,de.jsx)(tf.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[(0,de.jsxs)(aw,{children:[(0,de.jsx)(tw,{style:{marginRight:6}}),_o(u)]}),(0,de.jsx)("p",{children:"You can bring your account with you to another site using an external wallet."})]}),(0,de.jsxs)(ow,{children:[(0,de.jsxs)(Qm,{children:[(0,de.jsx)(Xm,{children:"1"}),(0,de.jsxs)("span",{children:[(0,de.jsx)("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),(0,de.jsxs)(Qm,{children:[(0,de.jsx)(Xm,{children:"2"}),(0,de.jsx)("span",{children:"Copy this key into your other wallet"})]})]}),(0,de.jsx)("div",{style:{width:"100%"},children:e&&(0,de.jsx)(ew,{origin:w,appId:T,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),(0,de.jsxs)(sw,{children:[(0,de.jsxs)("div",{children:[(0,de.jsx)(ef.default,{viewBox:"0 0 20 18"}),(0,de.jsx)("h4",{children:"Warning"})]}),(0,de.jsx)("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),(0,de.jsx)(q,{protectedByPrivy:!0})]})};function ew(e){let[t,r]=(0,ho.useState)(e.dimensions.width),[o,n]=(0,ho.useState)(void 0),a=(0,ho.useRef)(null);return(0,ho.useEffect)(()=>{if(a.current&&t===void 0){let{width:l}=a.current.getBoundingClientRect();r(l)}let i=getComputedStyle(document.documentElement);n({background2:i.getPropertyValue("--privy-color-background-2"),foreground3:i.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:i.getPropertyValue("--privy-color-foreground-accent"),accent:i.getPropertyValue("--privy-color-accent"),accentDark:i.getPropertyValue("--privy-color-accent-dark"),success:i.getPropertyValue("--privy-color-success")})},[]),(0,de.jsx)("div",{ref:a,children:t&&(0,de.jsxs)(nw,{children:[(0,de.jsx)("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Ha(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),(0,de.jsx)(iw,{children:"Loading..."})]})})}function tw(e){return(0,de.jsx)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:(0,de.jsx)("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var rw=yo.default.div`
971
971
  display: flex;
972
972
  flex-direction: column;
973
973
  text-align: left;
974
- `,rw=yo.default.div`
974
+ `,ow=yo.default.div`
975
975
  display: flex;
976
976
  flex-direction: column;
977
977
  gap: 24px;
978
978
  padding-bottom: 16px;
979
979
  margin-left: 11px;
980
980
  border-left: 1px solid var(--privy-color-foreground-4) !important;
981
- `,Zm=yo.default.div`
981
+ `,Qm=yo.default.div`
982
982
  display: flex;
983
983
  align-items: top;
984
984
  gap: 8px;
@@ -987,7 +987,7 @@ Resources:
987
987
  color: var(--privy-color-accent);
988
988
  text-decoration: underline;
989
989
  }
990
- `,Qm=yo.default.div`
990
+ `,Xm=yo.default.div`
991
991
  display: flex;
992
992
  align-items: center;
993
993
  justify-content: center;
@@ -1001,11 +1001,11 @@ Resources:
1001
1001
  border-radius: 100%;
1002
1002
  background: var(--privy-color-background);
1003
1003
  color: var(--privy-color-accent);
1004
- `,ow=yo.default.div`
1004
+ `,nw=yo.default.div`
1005
1005
  overflow: visible;
1006
1006
  position: relative;
1007
1007
  height: 44px;
1008
- `,nw=yo.default.div`
1008
+ `,iw=yo.default.div`
1009
1009
  position: absolute;
1010
1010
  display: flex;
1011
1011
  align-items: center;
@@ -1017,7 +1017,7 @@ Resources:
1017
1017
  border-radius: var(--privy-border-radius-md);
1018
1018
  background-color: var(--privy-color-background-2);
1019
1019
  color: var(--privy-color-foreground-3);
1020
- `,iw=yo.default.div`
1020
+ `,aw=yo.default.div`
1021
1021
  display: flex;
1022
1022
  align-items: center;
1023
1023
  padding-top: 1px;
@@ -1030,7 +1030,7 @@ Resources:
1030
1030
  font-size: 12px;
1031
1031
  font-weight: 500;
1032
1032
  margin: auto;
1033
- `,aw=yo.default.div`
1033
+ `,sw=yo.default.div`
1034
1034
  border: 1px solid var(--privy-color-background-2) !important;
1035
1035
  border-radius: var(--privy-border-radius-md);
1036
1036
  padding: 16px;
@@ -1052,7 +1052,7 @@ Resources:
1052
1052
  color: var(--privy-color-error);
1053
1053
  }
1054
1054
  }
1055
- `;var Uf=y(require("@heroicons/react/24/solid/XCircleIcon")),Rr=require("react"),Bf=y(require("styled-components"));var Xi=require("react");var df=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),ci=require("react");var rf=y(require("@heroicons/react/24/outline/ArrowPathIcon")),of=y(require("@heroicons/react/24/outline/EyeIcon")),nf=y(require("@heroicons/react/24/outline/EyeSlashIcon")),Ve=y(require("styled-components"));var sw=Ve.css`
1055
+ `;var Bf=y(require("@heroicons/react/24/solid/XCircleIcon")),Rr=require("react"),Hf=y(require("styled-components"));var Xi=require("react");var pf=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),ci=require("react");var of=y(require("@heroicons/react/24/outline/ArrowPathIcon")),nf=y(require("@heroicons/react/24/outline/EyeIcon")),af=y(require("@heroicons/react/24/outline/EyeSlashIcon")),Ve=y(require("styled-components"));var lw=Ve.css`
1056
1056
  font-size: 14px;
1057
1057
  font-style: normal;
1058
1058
  font-weight: 400;
@@ -1061,7 +1061,7 @@ Resources:
1061
1061
  text-align: left;
1062
1062
  transition: color 0.1s ease-in;
1063
1063
  `,$s=Ve.default.span`
1064
- ${sw}
1064
+ ${lw}
1065
1065
  transition: color 0.1s ease-in;
1066
1066
  color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1067
1067
  text-transform: ${({error:e})=>e?"":"capitalize"};
@@ -1080,7 +1080,7 @@ Resources:
1080
1080
  transition: none;
1081
1081
  }
1082
1082
  `}
1083
- `,af=Ve.css`
1083
+ `,sf=Ve.css`
1084
1084
  && {
1085
1085
  width: 100%;
1086
1086
  border-width: 1px;
@@ -1096,7 +1096,7 @@ Resources:
1096
1096
  line-height: 22px; /* 137.5% */
1097
1097
  }
1098
1098
  `,ii=Ve.default.input`
1099
- ${af}
1099
+ ${sf}
1100
1100
 
1101
1101
  &::placeholder {
1102
1102
  color: var(--privy-color-foreground-3);
@@ -1107,8 +1107,8 @@ Resources:
1107
1107
  overflow: hidden;
1108
1108
  text-overflow: ellipsis;
1109
1109
  white-space: nowrap;
1110
- `,sf=Ve.default.div`
1111
- ${af}
1110
+ `,lf=Ve.default.div`
1111
+ ${sf}
1112
1112
  `,Uo=Ve.default.div`
1113
1113
  position: relative;
1114
1114
  width: 100%;
@@ -1162,7 +1162,7 @@ Resources:
1162
1162
  > :first-child {
1163
1163
  min-width: 24px;
1164
1164
  }
1165
- `,rP=Ve.default.div`
1165
+ `,iP=Ve.default.div`
1166
1166
  height: var(--privy-height-modal-full);
1167
1167
 
1168
1168
  @media (max-width: 440px) {
@@ -1188,7 +1188,7 @@ Resources:
1188
1188
  flex-direction: row;
1189
1189
  justify-content: space-around;
1190
1190
  align-items: center;
1191
- `,lf=(0,Ve.default)(rf.default)`
1191
+ `,cf=(0,Ve.default)(of.default)`
1192
1192
  height: 1.25rem;
1193
1193
  width: 1.25rem;
1194
1194
  stroke: var(--privy-color-accent);
@@ -1197,7 +1197,7 @@ Resources:
1197
1197
  :active {
1198
1198
  stroke: var(--privy-color-accent-light);
1199
1199
  }
1200
- `,si=(0,Ve.default)(nf.default)`
1200
+ `,si=(0,Ve.default)(af.default)`
1201
1201
  height: 1.25rem;
1202
1202
  width: 1.25rem;
1203
1203
  stroke: var(--privy-color-accent);
@@ -1206,7 +1206,7 @@ Resources:
1206
1206
  :active {
1207
1207
  stroke: var(--privy-color-accent-light);
1208
1208
  }
1209
- `,li=(0,Ve.default)(of.default)`
1209
+ `,li=(0,Ve.default)(nf.default)`
1210
1210
  height: 1.25rem;
1211
1211
  width: 1.25rem;
1212
1212
  stroke: var(--privy-color-accent);
@@ -1215,7 +1215,7 @@ Resources:
1215
1215
  :active {
1216
1216
  stroke: var(--privy-color-accent-light);
1217
1217
  }
1218
- `,cf=Ve.default.progress`
1218
+ `,df=Ve.default.progress`
1219
1219
  height: 4px;
1220
1220
  width: 100%;
1221
1221
  margin: 8px 0;
@@ -1231,14 +1231,14 @@ Resources:
1231
1231
  transition: all 0.1s ease-out;
1232
1232
  background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1233
1233
  }
1234
- `;var ze=require("react/jsx-runtime"),pf=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[a,i]=(0,ci.useState)(!0),[l,s]=(0,ci.useState)(!1),[d,u]=(0,ci.useState)(""),v=r===d;return(0,ci.useEffect)(()=>{d&&!l&&s(!0)},[d]),(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)(k,{title:"Confirm Password",closeable:!1,backFn:n}),(0,ze.jsx)(X,{}),(0,ze.jsxs)(Do,{children:[(0,ze.jsxs)(Bo,{children:[(0,ze.jsx)(df.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,ze.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),(0,ze.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),(0,ze.jsxs)(Uo,{children:[(0,ze.jsx)(ii,{value:d,onChange:h=>u(h.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:a?"password":"text",style:{paddingRight:"2.3rem"}}),(0,ze.jsx)(ai,{style:{right:"0.75rem"},children:a?(0,ze.jsx)(si,{onClick:()=>i(!1)}):(0,ze.jsx)(li,{onClick:()=>i(!0)})})]}),(0,ze.jsx)($s,{"aria-hidden":!l||v,error:!0,children:"Passwords do not match"})]}),(0,ze.jsx)(Fo,{onClick:o,loading:t,disabled:!v,hideAnimations:e,children:"Continue"}),(0,ze.jsx)(le,{}),(0,ze.jsx)(q,{protectedByPrivy:!0})]})};var hf=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),yf=require("react"),gf=y(require("styled-components"));var Zi=y(require("styled-components")),Ho=require("react/jsx-runtime"),uf=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>(0,Ho.jsx)("label",{children:(0,Ho.jsxs)(lw,{className:e,children:[(0,Ho.jsx)(ff,{checked:t,...o}),(0,Ho.jsx)(cw,{color:r,checked:t,children:(0,Ho.jsx)(mf,{viewBox:"0 0 24 24",children:(0,Ho.jsx)("polyline",{points:"20 6 9 17 4 12"})})})]})}),lw=Zi.default.div`
1234
+ `;var ze=require("react/jsx-runtime"),uf=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[a,i]=(0,ci.useState)(!0),[l,s]=(0,ci.useState)(!1),[d,u]=(0,ci.useState)(""),v=r===d;return(0,ci.useEffect)(()=>{d&&!l&&s(!0)},[d]),(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)(k,{title:"Confirm Password",closeable:!1,backFn:n}),(0,ze.jsx)(X,{}),(0,ze.jsxs)(Do,{children:[(0,ze.jsxs)(Bo,{children:[(0,ze.jsx)(pf.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,ze.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),(0,ze.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),(0,ze.jsxs)(Uo,{children:[(0,ze.jsx)(ii,{value:d,onChange:h=>u(h.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:a?"password":"text",style:{paddingRight:"2.3rem"}}),(0,ze.jsx)(ai,{style:{right:"0.75rem"},children:a?(0,ze.jsx)(si,{onClick:()=>i(!1)}):(0,ze.jsx)(li,{onClick:()=>i(!0)})})]}),(0,ze.jsx)($s,{"aria-hidden":!l||v,error:!0,children:"Passwords do not match"})]}),(0,ze.jsx)(Fo,{onClick:o,loading:t,disabled:!v,hideAnimations:e,children:"Continue"}),(0,ze.jsx)(le,{}),(0,ze.jsx)(q,{protectedByPrivy:!0})]})};var yf=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),gf=require("react"),vf=y(require("styled-components"));var Zi=y(require("styled-components")),Ho=require("react/jsx-runtime"),mf=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>(0,Ho.jsx)("label",{children:(0,Ho.jsxs)(cw,{className:e,children:[(0,Ho.jsx)(hf,{checked:t,...o}),(0,Ho.jsx)(dw,{color:r,checked:t,children:(0,Ho.jsx)(ff,{viewBox:"0 0 24 24",children:(0,Ho.jsx)("polyline",{points:"20 6 9 17 4 12"})})})]})}),cw=Zi.default.div`
1235
1235
  display: inline-block;
1236
1236
  vertical-align: middle;
1237
- `,mf=Zi.default.svg`
1237
+ `,ff=Zi.default.svg`
1238
1238
  fill: none;
1239
1239
  stroke: white;
1240
1240
  stroke-width: 3px;
1241
- `,ff=Zi.default.input.attrs({type:"checkbox"})`
1241
+ `,hf=Zi.default.input.attrs({type:"checkbox"})`
1242
1242
  border: 0;
1243
1243
  clip: rect(0 0 0 0);
1244
1244
  clippath: inset(50%);
@@ -1249,7 +1249,7 @@ Resources:
1249
1249
  position: absolute;
1250
1250
  white-space: nowrap;
1251
1251
  width: 1px;
1252
- `,cw=Zi.default.div`
1252
+ `,dw=Zi.default.div`
1253
1253
  display: inline-block;
1254
1254
  width: 18px;
1255
1255
  height: 18px;
@@ -1264,30 +1264,30 @@ Resources:
1264
1264
  border-width: 1px;
1265
1265
  }
1266
1266
 
1267
- ${ff}:focus + & {
1267
+ ${hf}:focus + & {
1268
1268
  box-shadow: 0 0 0 1px ${e=>e.color};
1269
1269
  }
1270
1270
 
1271
- ${mf} {
1271
+ ${ff} {
1272
1272
  visibility: ${e=>e.checked?"visible":"hidden"};
1273
1273
  }
1274
- `;var Fe=require("react/jsx-runtime"),vf=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=(0,yf.useState)(!1);return(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(k,{title:"Confirm Password",closeable:!1,backFn:o}),(0,Fe.jsx)(X,{}),(0,Fe.jsxs)(Do,{children:[(0,Fe.jsxs)(Bo,{children:[(0,Fe.jsx)(hf.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),(0,Fe.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),(0,Fe.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),(0,Fe.jsx)(Yi,{children:(0,Fe.jsxs)(Ji,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),i(s=>!s)},children:[(0,Fe.jsx)(uf,{color:"var(--privy-color-error)",checked:a}),(0,Fe.jsx)(Fe.Fragment,{children:"I understand losing my password means losing my account."})]})})]}),(0,Fe.jsxs)(dw,{children:[n.initiatedBy==="user"&&(0,Fe.jsx)(Pr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),(0,Fe.jsx)(Fo,{onClick:r,loading:t,hideAnimations:e,disabled:!a,children:"Set Password"})]}),(0,Fe.jsx)(le,{}),(0,Fe.jsx)(q,{protectedByPrivy:!0})]})},dw=gf.default.div`
1274
+ `;var Fe=require("react/jsx-runtime"),wf=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=(0,gf.useState)(!1);return(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(k,{title:"Confirm Password",closeable:!1,backFn:o}),(0,Fe.jsx)(X,{}),(0,Fe.jsxs)(Do,{children:[(0,Fe.jsxs)(Bo,{children:[(0,Fe.jsx)(yf.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),(0,Fe.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),(0,Fe.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),(0,Fe.jsx)(Yi,{children:(0,Fe.jsxs)(Ji,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),i(s=>!s)},children:[(0,Fe.jsx)(mf,{color:"var(--privy-color-error)",checked:a}),(0,Fe.jsx)(Fe.Fragment,{children:"I understand losing my password means losing my account."})]})})]}),(0,Fe.jsxs)(pw,{children:[n.initiatedBy==="user"&&(0,Fe.jsx)(Pr,{onClick:n.onCancel,disabled:t,children:"Cancel"}),(0,Fe.jsx)(Fo,{onClick:r,loading:t,hideAnimations:e,disabled:!a,children:"Set Password"})]}),(0,Fe.jsx)(le,{}),(0,Fe.jsx)(q,{protectedByPrivy:!0})]})},pw=vf.default.div`
1275
1275
  display: flex;
1276
1276
  gap: 10px;
1277
- `;var _f=y(require("@heroicons/react/24/outline/KeyIcon")),Bc=y(require("@heroicons/react/24/solid/CheckCircleIcon")),go=require("react"),Hc=y(require("styled-components"));var wf=y(require("fast-password-entropy")),Cf=y(require("secure-password-utilities")),bf=require("secure-password-utilities/wordlists"),pw=95,uw=8,mw=3,fw=.3,hw=/[a-z]/,yw=/[A-Z]/,gw=/[0-9]/,vw="a-zA-Z0-9",Ef="!@#$%^&*()\\-_+.",Tf=`${vw}${Ef}`,ww=new RegExp(`[${Ef}]`),Cw=new RegExp(`[${Tf}]`),Pf=new RegExp(`^[${Tf}]{6,}$`),xf=(e="")=>{let t=e.split("").filter(r=>!Cw.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},js=()=>Cf.generatePassphrase(4,bf.DEFAULT_WORDLIST);function bw(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Ew(e){if(e.length<uw)return 0;let t=0;hw.test(e)&&(t+=1),yw.test(e)&&(t+=1),gw.test(e)&&(t+=1),ww.test(e)&&(t+=1);let r=t/mw;return Math.max(0,Math.min(1,r))}function Tw(e=""){let t=Ew(e),r=(0,wf.default)(e)/pw;return(t*fw+r)/2}function Sf(e=""){let t=Tw(e);return{value:t,label:bw(t)}}var he=require("react/jsx-runtime"),Af=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:a,onPasswordChange:i,onPasswordGenerate:l})=>{let[s,d]=(0,go.useState)(!1),[u,v]=(0,go.useState)(!1);(0,go.useEffect)(()=>{r&&!u&&v(!0)},[r]);let h=(0,go.useMemo)(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":Pf.test(r||"")?null:`Invalid characters used ( ${xf(r).join(" ")} )`:null,[r,u]),w=(0,go.useMemo)(()=>h?{value:0,label:"Weak"}:Sf(r),[r,h]),T=(0,go.useMemo)(()=>!!(!r?.length||h),[h,r]);return(0,he.jsxs)(he.Fragment,{children:[(0,he.jsx)(k,{onClose:a,title:"Secure your account",closeable:o.initiatedBy==="user"}),(0,he.jsx)(X,{}),(0,he.jsxs)(Do,{children:[(0,he.jsxs)(Bo,{children:[(0,he.jsx)(_f.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,he.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),(0,he.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),(0,he.jsxs)(Uo,{children:[(0,he.jsx)(ii,{value:r,onChange:C=>i(C.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text",style:{paddingRight:"3.8rem"}}),(0,he.jsxs)(ai,{style:{width:"3.5rem"},children:[s?(0,he.jsx)(si,{onClick:()=>d(!1)}):(0,he.jsx)(li,{onClick:()=>d(!0)}),(0,he.jsx)(lf,{onClick:l})]})]}),(0,he.jsx)(cf,{value:w.value===0?.01:w.value,label:w.label}),(0,he.jsx)($s,{error:!!h,children:h||`Password Strength: ${u?w.label:"--"}`}),(0,he.jsxs)(xw,{children:[(0,he.jsx)(Pw,{children:(0,he.jsxs)(Yi,{children:[(0,he.jsxs)(Ji,{children:[(0,he.jsx)(Bc.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),(0,he.jsxs)(Ji,{children:[(0,he.jsx)(Bc.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),(0,he.jsx)(Fo,{onClick:n,loading:t,disabled:T,hideAnimations:e,children:"Continue"})]})]}),(0,he.jsx)(le,{}),(0,he.jsx)(q,{protectedByPrivy:!0})]})},Pw=(0,Hc.default)(Yi)`
1277
+ `;var Af=y(require("@heroicons/react/24/outline/KeyIcon")),Bc=y(require("@heroicons/react/24/solid/CheckCircleIcon")),go=require("react"),Hc=y(require("styled-components"));var Cf=y(require("fast-password-entropy")),bf=y(require("secure-password-utilities")),Ef=require("secure-password-utilities/wordlists"),uw=95,mw=8,fw=3,hw=.3,yw=/[a-z]/,gw=/[A-Z]/,vw=/[0-9]/,ww="a-zA-Z0-9",Tf="!@#$%^&*()\\-_+.",Pf=`${ww}${Tf}`,Cw=new RegExp(`[${Tf}]`),bw=new RegExp(`[${Pf}]`),xf=new RegExp(`^[${Pf}]{6,}$`),Sf=(e="")=>{let t=e.split("").filter(r=>!bw.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},js=()=>bf.generatePassphrase(4,Ef.DEFAULT_WORDLIST);function Ew(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Tw(e){if(e.length<mw)return 0;let t=0;yw.test(e)&&(t+=1),gw.test(e)&&(t+=1),vw.test(e)&&(t+=1),Cw.test(e)&&(t+=1);let r=t/fw;return Math.max(0,Math.min(1,r))}function Pw(e=""){let t=Tw(e),r=(0,Cf.default)(e)/uw;return(t*hw+r)/2}function _f(e=""){let t=Pw(e);return{value:t,label:Ew(t)}}var he=require("react/jsx-runtime"),kf=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:a,onPasswordChange:i,onPasswordGenerate:l})=>{let[s,d]=(0,go.useState)(!1),[u,v]=(0,go.useState)(!1);(0,go.useEffect)(()=>{r&&!u&&v(!0)},[r]);let h=(0,go.useMemo)(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":xf.test(r||"")?null:`Invalid characters used ( ${Sf(r).join(" ")} )`:null,[r,u]),w=(0,go.useMemo)(()=>h?{value:0,label:"Weak"}:_f(r),[r,h]),T=(0,go.useMemo)(()=>!!(!r?.length||h),[h,r]);return(0,he.jsxs)(he.Fragment,{children:[(0,he.jsx)(k,{onClose:a,title:"Secure your account",closeable:o.initiatedBy==="user"}),(0,he.jsx)(X,{}),(0,he.jsxs)(Do,{children:[(0,he.jsxs)(Bo,{children:[(0,he.jsx)(Af.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,he.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),(0,he.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),(0,he.jsxs)(Uo,{children:[(0,he.jsx)(ii,{value:r,onChange:C=>i(C.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text",style:{paddingRight:"3.8rem"}}),(0,he.jsxs)(ai,{style:{width:"3.5rem"},children:[s?(0,he.jsx)(si,{onClick:()=>d(!1)}):(0,he.jsx)(li,{onClick:()=>d(!0)}),(0,he.jsx)(cf,{onClick:l})]})]}),(0,he.jsx)(df,{value:w.value===0?.01:w.value,label:w.label}),(0,he.jsx)($s,{error:!!h,children:h||`Password Strength: ${u?w.label:"--"}`}),(0,he.jsxs)(Sw,{children:[(0,he.jsx)(xw,{children:(0,he.jsxs)(Yi,{children:[(0,he.jsxs)(Ji,{children:[(0,he.jsx)(Bc.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),(0,he.jsxs)(Ji,{children:[(0,he.jsx)(Bc.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),(0,he.jsx)(Fo,{onClick:n,loading:t,disabled:T,hideAnimations:e,children:"Continue"})]})]}),(0,he.jsx)(le,{}),(0,he.jsx)(q,{protectedByPrivy:!0})]})},xw=(0,Hc.default)(Yi)`
1278
1278
  flex: 1;
1279
1279
  padding-top: 1rem;
1280
- `,xw=Hc.default.div`
1280
+ `,Sw=Hc.default.div`
1281
1281
  display: flex;
1282
1282
  flex-direction: column;
1283
1283
  height: 100%;
1284
- `;var kf=y(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),Rf=y(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),If=y(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),Mf=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Qi=require("react");var Te=require("react/jsx-runtime"),Wf=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,l]=(0,Qi.useState)(!1),s=(0,Qi.useCallback)(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),d=(0,Qi.useCallback)(()=>{let u=document.createElement("a"),v=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),h=new Blob([Sw(r,o)],{type:"text/plain"}),w=URL.createObjectURL(h);u.href=w,u.target="_blank",u.download=`${v}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(w)},5e3)},[o]);return(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(k,{backFn:a,title:"Save Password",closeable:!1}),(0,Te.jsx)(X,{}),(0,Te.jsxs)(Do,{children:[(0,Te.jsxs)(Bo,{children:[(0,Te.jsx)(Mf.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,Te.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),(0,Te.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset if you lose your device. Make sure to secure it to keep your assets safe."})]}),(0,Te.jsx)(Uo,{centered:!0,children:(0,Te.jsx)(sf,{children:o})}),(0,Te.jsxs)("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[(0,Te.jsx)(Uc,{onClick:s,children:i?(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(Rf.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(If.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),(0,Te.jsxs)(Uc,{onClick:d,children:[(0,Te.jsx)(kf.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),(0,Te.jsx)(Fo,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),(0,Te.jsx)(le,{}),(0,Te.jsx)(q,{protectedByPrivy:!0})]})},Sw=(e,t)=>`Your wallet recovery password for ${e} is
1284
+ `;var Rf=y(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),If=y(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),Mf=y(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),Wf=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Qi=require("react");var Te=require("react/jsx-runtime"),Lf=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,l]=(0,Qi.useState)(!1),s=(0,Qi.useCallback)(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),d=(0,Qi.useCallback)(()=>{let u=document.createElement("a"),v=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),h=new Blob([_w(r,o)],{type:"text/plain"}),w=URL.createObjectURL(h);u.href=w,u.target="_blank",u.download=`${v}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(w)},5e3)},[o]);return(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(k,{backFn:a,title:"Save Password",closeable:!1}),(0,Te.jsx)(X,{}),(0,Te.jsxs)(Do,{children:[(0,Te.jsxs)(Bo,{children:[(0,Te.jsx)(Wf.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,Te.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),(0,Te.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset if you lose your device. Make sure to secure it to keep your assets safe."})]}),(0,Te.jsx)(Uo,{centered:!0,children:(0,Te.jsx)(lf,{children:o})}),(0,Te.jsxs)("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[(0,Te.jsx)(Uc,{onClick:s,children:i?(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(If.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(Mf.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),(0,Te.jsxs)(Uc,{onClick:d,children:[(0,Te.jsx)(Rf.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),(0,Te.jsx)(Fo,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),(0,Te.jsx)(le,{}),(0,Te.jsx)(q,{protectedByPrivy:!0})]})},_w=(e,t)=>`Your wallet recovery password for ${e} is
1285
1285
 
1286
1286
  ${t}
1287
1287
 
1288
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;var Lf=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Of=y(require("@heroicons/react/24/solid/XCircleIcon"));var wt=require("react/jsx-runtime"),Nf=({error:e,onClose:t})=>(0,wt.jsxs)(wt.Fragment,{children:[(0,wt.jsx)(k,{closeable:!1}),(0,wt.jsx)(X,{}),e?(0,wt.jsxs)(xr,{children:[(0,wt.jsx)(Of.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,wt.jsx)(Ge,{title:"Something went wrong",description:e})]}):(0,wt.jsxs)(xr,{children:[(0,wt.jsx)(Lf.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,wt.jsx)(Ge,{title:"Success"})]}),(0,wt.jsx)(U,{onClick:t,children:"Close"}),(0,wt.jsx)(le,{}),(0,wt.jsx)(q,{protectedByPrivy:!0})]});var Df=require("react"),_w=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},Ff=()=>{let[e,t]=(0,Df.useReducer)(_w,"creating");return{send:t,state:e}};var di=require("react/jsx-runtime"),Ks=({onSubmit:e,...t})=>{let{send:r,state:o}=Ff(),n=(0,Xi.useCallback)(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);(0,Xi.useEffect)(()=>{let i;return o==="done"&&t.config.initiatedBy==="automatic"&&(i=setTimeout(()=>t.onClose?.(),at)),()=>{i&&clearTimeout(i)}},[o,t.config.initiatedBy,t.onClose]);let a=(0,Xi.useCallback)(()=>{r("back")},[r]);return o==="creating"?(0,di.jsx)(Af,{...t,onSubmit:n}):o==="saving"?(0,di.jsx)(Wf,{...t,onSubmit:n,onBack:a}):o==="confirming"?(0,di.jsx)(pf,{...t,onSubmit:n,onBack:a}):o==="finalizing"?(0,di.jsx)(vf,{...t,onSubmit:n,onBack:a}):o==="done"?(0,di.jsx)(Nf,{...t,onSubmit:n}):null};var Kt=require("react/jsx-runtime"),Hf=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=A(),[n,a]=(0,Rr.useState)(""),[i,l]=(0,Rr.useState)(!1),[s,d]=(0,Rr.useState)(),[u,v]=(0,Rr.useState)(null),[h,w]=(0,Rr.useState)(null),T=(0,Rr.useRef)(!1),{authenticated:C,getAccessToken:S}=V(),{refreshUser:b,closePrivyModal:x,createAnalyticsEvent:I,isNewUserThisSession:W,initializeWalletProxy:R}=L(),{onSuccess:H,onFailure:B,callAuthOnSuccessOnClose:G}=r.createWallet,P=e?.embeddedWallets.requireUserPasswordOnCreate===!0,J=!!(!n||T.current)&&!P,N=new Pt(async()=>ue());(0,Rr.useEffect)(()=>{u||R(3e4).then(ae=>v(ae))},[u]),(0,Rr.useEffect)(()=>{if(!C){t("LANDING"),B(new Error("User must be authenticated before creating a Privy wallet"));return}!P&&!i&&!T.current&&(l(!0),N.execute().finally(()=>l(!1)))},[P,C]);let te=()=>{P&&h&&h?.recoveryMethod!=="user-passcode"?(B(new qt("User created a wallet but failed to set a password for it")),x({shouldCallAuthOnSuccess:!1})):h?(H(h),x({shouldCallAuthOnSuccess:G})):(B(new qt("User wallet creation failed")),x({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let ue=async function(){let ae=await S();if(ae)try{I("embedded_wallet_creation_started");let j=await R(An);if(!j)throw new Error("walletProxy does not exist.");let Ue=1e4,Oe=new Promise((Me,Vt)=>{setTimeout(()=>{Vt(new Error("walletProxy.create timed out."))},Ue)});if(!await Promise.race([j.create({accessToken:ae,recoveryPassword:s}),Oe]))throw new Error("walletProxy.create did not send a response.");let Gt=await b();if(!Gt)throw new Error("Failed to refresh user.");let je=Ne(Gt);if(!je)throw new Error("Updated user is missing embedded wallet.");w(je),I("embedded_wallet_creation_completed",{walletAddress:je.address}),a(""),T.current=!0,P?t("EMBEDDED_WALLET_CREATED_SCREEN"):W?t("EMBEDDED_WALLET_CREATED_SCREEN"):je&&(H(je),x({shouldCallAuthOnSuccess:G}))}catch(j){if(T.current)return;I("embedded_wallet_creation_failed",{error:j.toString()}),a("An error has occurred, please try again."),console.warn(j)}else a("An error has occured, please login again."),I("embedded_wallet_creation_failed",{error:"Missing access token for user."})},se=async()=>{if(!P)return x({shouldCallAuthOnSuccess:G});l(!0);let ae=250;return N.execute().then(()=>new Promise(j=>setTimeout(j,ae))).finally(()=>l(!1))};return!P&&n?(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsx)(k,{closeable:!1}),(0,Kt.jsxs)(xr,{children:[(0,Kt.jsx)(Uf.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Kt.jsx)(Ge,{title:"Something went wrong",description:n})]}),(0,Kt.jsx)(U,{onClick:te,children:"Close"}),(0,Kt.jsx)(Aw,{})]}):J?(0,Kt.jsx)(ri,{}):(0,Kt.jsx)(Ks,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:J||!u,buttonLoading:i,buttonHideAnimations:!h&&i,error:n,password:s||"",onClose:te,onPasswordChange:d,onPasswordGenerate:()=>d(js()),onSubmit:se})},Aw=Bf.default.div`
1288
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;var Of=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Nf=y(require("@heroicons/react/24/solid/XCircleIcon"));var wt=require("react/jsx-runtime"),Df=({error:e,onClose:t})=>(0,wt.jsxs)(wt.Fragment,{children:[(0,wt.jsx)(k,{closeable:!1}),(0,wt.jsx)(X,{}),e?(0,wt.jsxs)(xr,{children:[(0,wt.jsx)(Nf.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,wt.jsx)(Ge,{title:"Something went wrong",description:e})]}):(0,wt.jsxs)(xr,{children:[(0,wt.jsx)(Of.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,wt.jsx)(Ge,{title:"Success"})]}),(0,wt.jsx)(U,{onClick:t,children:"Close"}),(0,wt.jsx)(le,{}),(0,wt.jsx)(q,{protectedByPrivy:!0})]});var Ff=require("react"),Aw=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},Uf=()=>{let[e,t]=(0,Ff.useReducer)(Aw,"creating");return{send:t,state:e}};var di=require("react/jsx-runtime"),Ks=({onSubmit:e,...t})=>{let{send:r,state:o}=Uf(),n=(0,Xi.useCallback)(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);(0,Xi.useEffect)(()=>{let i;return o==="done"&&t.config.initiatedBy==="automatic"&&(i=setTimeout(()=>t.onClose?.(),at)),()=>{i&&clearTimeout(i)}},[o,t.config.initiatedBy,t.onClose]);let a=(0,Xi.useCallback)(()=>{r("back")},[r]);return o==="creating"?(0,di.jsx)(kf,{...t,onSubmit:n}):o==="saving"?(0,di.jsx)(Lf,{...t,onSubmit:n,onBack:a}):o==="confirming"?(0,di.jsx)(uf,{...t,onSubmit:n,onBack:a}):o==="finalizing"?(0,di.jsx)(wf,{...t,onSubmit:n,onBack:a}):o==="done"?(0,di.jsx)(Df,{...t,onSubmit:n}):null};var Kt=require("react/jsx-runtime"),Gf=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=A(),[n,a]=(0,Rr.useState)(""),[i,l]=(0,Rr.useState)(!1),[s,d]=(0,Rr.useState)(),[u,v]=(0,Rr.useState)(null),[h,w]=(0,Rr.useState)(null),T=(0,Rr.useRef)(!1),{authenticated:C,getAccessToken:S}=V(),{refreshUser:b,closePrivyModal:x,createAnalyticsEvent:I,isNewUserThisSession:W,initializeWalletProxy:R}=L(),{onSuccess:H,onFailure:B,callAuthOnSuccessOnClose:G}=r.createWallet,P=e?.embeddedWallets.requireUserPasswordOnCreate===!0,J=!!(!n||T.current)&&!P,N=new Pt(async()=>ue());(0,Rr.useEffect)(()=>{u||R(3e4).then(ae=>v(ae))},[u]),(0,Rr.useEffect)(()=>{if(!C){t("LANDING"),B(new Error("User must be authenticated before creating a Privy wallet"));return}!P&&!i&&!T.current&&(l(!0),N.execute().finally(()=>l(!1)))},[P,C]);let te=()=>{P&&h&&h?.recoveryMethod!=="user-passcode"?(B(new qt("User created a wallet but failed to set a password for it")),x({shouldCallAuthOnSuccess:!1})):h?(H(h),x({shouldCallAuthOnSuccess:G})):(B(new qt("User wallet creation failed")),x({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let ue=async function(){let ae=await S();if(ae)try{I("embedded_wallet_creation_started");let j=await R(An);if(!j)throw new Error("walletProxy does not exist.");let Ue=1e4,Oe=new Promise((Me,Vt)=>{setTimeout(()=>{Vt(new Error("walletProxy.create timed out."))},Ue)});if(!await Promise.race([j.create({accessToken:ae,recoveryPassword:s}),Oe]))throw new Error("walletProxy.create did not send a response.");let Gt=await b();if(!Gt)throw new Error("Failed to refresh user.");let je=Ne(Gt);if(!je)throw new Error("Updated user is missing embedded wallet.");w(je),I("embedded_wallet_creation_completed",{walletAddress:je.address}),a(""),T.current=!0,P?t("EMBEDDED_WALLET_CREATED_SCREEN"):W?t("EMBEDDED_WALLET_CREATED_SCREEN"):je&&(H(je),x({shouldCallAuthOnSuccess:G}))}catch(j){if(T.current)return;I("embedded_wallet_creation_failed",{error:j.toString()}),a("An error has occurred, please try again."),console.warn(j)}else a("An error has occured, please login again."),I("embedded_wallet_creation_failed",{error:"Missing access token for user."})},se=async()=>{if(!P)return x({shouldCallAuthOnSuccess:G});l(!0);let ae=250;return N.execute().then(()=>new Promise(j=>setTimeout(j,ae))).finally(()=>l(!1))};return!P&&n?(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsx)(k,{closeable:!1}),(0,Kt.jsxs)(xr,{children:[(0,Kt.jsx)(Bf.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Kt.jsx)(Ge,{title:"Something went wrong",description:n})]}),(0,Kt.jsx)(U,{onClick:te,children:"Close"}),(0,Kt.jsx)(kw,{})]}):J?(0,Kt.jsx)(ri,{}):(0,Kt.jsx)(Ks,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:J||!u,buttonLoading:i,buttonHideAnimations:!h&&i,error:n,password:s||"",onClose:te,onPasswordChange:d,onPasswordGenerate:()=>d(js()),onSubmit:se})},kw=Hf.default.div`
1289
1289
  height: 44px;
1290
- `;var pn=require("react");var Vf=require("react/jsx-runtime"),Gf=()=>{let[e,t]=(0,pn.useState)(null),[r,o]=(0,pn.useState)(!1),[n,a]=(0,pn.useState)(null),[i,l]=(0,pn.useState)(""),{authenticated:s,getAccessToken:d,user:u}=V(),{walletProxy:v,refreshUser:h,closePrivyModal:w,createAnalyticsEvent:T}=L(),{app:C,navigate:S,data:b,onUserCloseViaDialogOrKeybindRef:x}=A(),{onSuccess:I,onFailure:W}=b.createWallet,R=Ne(u),H=e?.recoveryMethod==="user-passcode";(0,pn.useEffect)(()=>{s||(S("LANDING"),W(new Aa("User must be authenticated before setting a password on a Privy wallet")))},[s]);let B=()=>{if(n){W(n),w({shouldCallAuthOnSuccess:!1});return}if(!H){W(new qt("Exited before password was added to wallet")),w({shouldCallAuthOnSuccess:!1});return}I(e),w({shouldCallAuthOnSuccess:!1})};x.current=B;let G=async()=>{let J=await d();if(J&&R?.address&&i&&v)try{if(T("embedded_wallet_set_password_started",{walletAddress:R.address}),!(await v.setRecoveryPassword({accessToken:J,address:R.address,recoveryPassword:i})).address){a(new qt("Error setting password on privy wallet")),T("embedded_wallet_set_password_failed",{walletAddress:R.address,reason:"error setting password"});return}let te=await h(),ue=Ne(te);if(!ue){a(new qt("Error setting password on privy wallet")),T("embedded_wallet_set_password_failed",{walletAddress:R.address,reason:"wallet disconnected"});return}t(ue),T("embedded_wallet_set_password_completed",{walletAddress:R.address})}catch(N){console.warn(N),a(N instanceof Error?N:new Error("Error setting password on privy wallet")),T("embedded_wallet_set_password_failed",{walletAddress:R.address,reason:N})}},P=async()=>{H?(I(e),w({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await G(),o(!1))};return(0,Vf.jsx)(Ks,{appName:C?.name||"privy",config:{initiatedBy:"user",onCancel:B},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:i,onPasswordGenerate:()=>l(js()),onPasswordChange:l,onSubmit:P,onClose:B})};var zf=y(require("@heroicons/react/24/outline/UserCircleIcon")),qf=y(require("@heroicons/react/24/solid/LockClosedIcon"));var st=require("react/jsx-runtime"),$f=()=>{let{user:e}=V(),{closePrivyModal:t,createAnalyticsEvent:r}=L(),{data:o,setModalData:n,navigate:a,onUserCloseViaDialogOrKeybindRef:i}=A(),{onSuccess:l,onFailure:s}=o.setWalletPassword,d=()=>{s(new qt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return i.current=d,(0,st.jsxs)(st.Fragment,{children:[(0,st.jsx)(k,{onClose:d}),(0,st.jsx)(X,{}),(0,st.jsxs)(xr,{children:[(0,st.jsxs)(nm,{children:[(0,st.jsx)(zf.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,st.jsx)(im,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:(0,st.jsx)(qf.default,{width:"12px",height:"12px",fill:"white"})})]}),(0,st.jsxs)(Ge,{title:"Secure Your Account",children:["Please set a password to secure your account.",(0,st.jsx)("p",{children:"Losing this password will make your account inaccessible on new devices. You will only be asked for it when you log on to a new device."})]})]}),(0,st.jsx)(U,{onClick:()=>{let v=Ne(e);r("embedded_wallet_set_password_started",{walletAddress:v?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),a("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),(0,st.jsx)(le,{}),(0,st.jsx)(q,{protectedByPrivy:!0})]})};var jf=y(require("@heroicons/react/24/outline/ShieldCheckIcon")),un=require("react"),mn=y(require("styled-components"));var Re=require("react/jsx-runtime"),Kf=()=>{let[e,t]=(0,un.useState)(!0),{authenticated:r,getAccessToken:o}=V(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=L(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=A(),[u,v]=(0,un.useState)(void 0),[h,w]=(0,un.useState)(""),[T,C]=(0,un.useState)(!1),{privyWallet:S,onCompleteNavigateTo:b,onSuccess:x,onFailure:I}=s.recoverWallet,W=(B="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),I(typeof B=="string"?new qt(B):B)};d.current=W,(0,un.useEffect)(()=>{if(!r||!S)return W("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let R=B=>{B&&v(B)};return(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(k,{onClose:W}),(0,Re.jsx)(X,{}),(0,Re.jsxs)(Rw,{children:[(0,Re.jsxs)(kw,{children:[(0,Re.jsx)(jf.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,Re.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),(0,Re.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),(0,Re.jsxs)("div",{children:[(0,Re.jsxs)(Uo,{children:[(0,Re.jsx)(ii,{type:e?"password":"text",onChange:B=>R(B.target.value),disabled:T,style:{paddingRight:"2.3rem"}}),(0,Re.jsx)(ai,{style:{right:"0.75rem"},children:e?(0,Re.jsx)(si,{onClick:()=>t(!1)}):(0,Re.jsx)(li,{onClick:()=>t(!0)})})]}),!!h&&(0,Re.jsx)(Iw,{children:h})]}),(0,Re.jsxs)("div",{children:[(0,Re.jsxs)(om,{children:[(0,Re.jsx)("h4",{children:"Why is this necessary?"}),(0,Re.jsx)("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),(0,Re.jsx)(Mw,{loading:T||!n,disabled:!u,onClick:async()=>{C(!0);let B=await o();if(B&&S&&u!==null)try{i("embedded_wallet_recovery_started",{walletAddress:S.address}),await n?.recover({address:S.address,accessToken:B,recoveryPin:u}),w(""),b?l(b):a({shouldCallAuthOnSuccess:!1}),x?.(S),i("embedded_wallet_recovery_completed",{walletAddress:S.address})}catch(G){Vm(G)?w("Invalid recovery password, please try again."):w("An error has occurred, please try again.")}finally{C(!1)}else return W("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!S&&T,children:"Recover your account"})]})]}),(0,Re.jsx)(le,{}),(0,Re.jsx)(q,{protectedByPrivy:!0})]})},kw=mn.default.div`
1290
+ `;var pn=require("react");var zf=require("react/jsx-runtime"),Vf=()=>{let[e,t]=(0,pn.useState)(null),[r,o]=(0,pn.useState)(!1),[n,a]=(0,pn.useState)(null),[i,l]=(0,pn.useState)(""),{authenticated:s,getAccessToken:d,user:u}=V(),{walletProxy:v,refreshUser:h,closePrivyModal:w,createAnalyticsEvent:T}=L(),{app:C,navigate:S,data:b,onUserCloseViaDialogOrKeybindRef:x}=A(),{onSuccess:I,onFailure:W}=b.createWallet,R=Ne(u),H=e?.recoveryMethod==="user-passcode";(0,pn.useEffect)(()=>{s||(S("LANDING"),W(new Aa("User must be authenticated before setting a password on a Privy wallet")))},[s]);let B=()=>{if(n){W(n),w({shouldCallAuthOnSuccess:!1});return}if(!H){W(new qt("Exited before password was added to wallet")),w({shouldCallAuthOnSuccess:!1});return}I(e),w({shouldCallAuthOnSuccess:!1})};x.current=B;let G=async()=>{let J=await d();if(J&&R?.address&&i&&v)try{if(T("embedded_wallet_set_password_started",{walletAddress:R.address}),!(await v.setRecoveryPassword({accessToken:J,address:R.address,recoveryPassword:i})).address){a(new qt("Error setting password on privy wallet")),T("embedded_wallet_set_password_failed",{walletAddress:R.address,reason:"error setting password"});return}let te=await h(),ue=Ne(te);if(!ue){a(new qt("Error setting password on privy wallet")),T("embedded_wallet_set_password_failed",{walletAddress:R.address,reason:"wallet disconnected"});return}t(ue),T("embedded_wallet_set_password_completed",{walletAddress:R.address})}catch(N){console.warn(N),a(N instanceof Error?N:new Error("Error setting password on privy wallet")),T("embedded_wallet_set_password_failed",{walletAddress:R.address,reason:N})}},P=async()=>{H?(I(e),w({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await G(),o(!1))};return(0,zf.jsx)(Ks,{appName:C?.name||"privy",config:{initiatedBy:"user",onCancel:B},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:i,onPasswordGenerate:()=>l(js()),onPasswordChange:l,onSubmit:P,onClose:B})};var qf=y(require("@heroicons/react/24/outline/UserCircleIcon")),$f=y(require("@heroicons/react/24/solid/LockClosedIcon"));var st=require("react/jsx-runtime"),jf=()=>{let{user:e}=V(),{closePrivyModal:t,createAnalyticsEvent:r}=L(),{data:o,setModalData:n,navigate:a,onUserCloseViaDialogOrKeybindRef:i}=A(),{onSuccess:l,onFailure:s}=o.setWalletPassword,d=()=>{s(new qt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return i.current=d,(0,st.jsxs)(st.Fragment,{children:[(0,st.jsx)(k,{onClose:d}),(0,st.jsx)(X,{}),(0,st.jsxs)(xr,{children:[(0,st.jsxs)(im,{children:[(0,st.jsx)(qf.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,st.jsx)(am,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:(0,st.jsx)($f.default,{width:"12px",height:"12px",fill:"white"})})]}),(0,st.jsxs)(Ge,{title:"Secure Your Account",children:["Please set a password to secure your account.",(0,st.jsx)("p",{children:"Losing this password will make your account inaccessible on new devices. You will only be asked for it when you log on to a new device."})]})]}),(0,st.jsx)(U,{onClick:()=>{let v=Ne(e);r("embedded_wallet_set_password_started",{walletAddress:v?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),a("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),(0,st.jsx)(le,{}),(0,st.jsx)(q,{protectedByPrivy:!0})]})};var Kf=y(require("@heroicons/react/24/outline/ShieldCheckIcon")),un=require("react"),mn=y(require("styled-components"));var Re=require("react/jsx-runtime"),Yf=()=>{let[e,t]=(0,un.useState)(!0),{authenticated:r,getAccessToken:o}=V(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=L(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=A(),[u,v]=(0,un.useState)(void 0),[h,w]=(0,un.useState)(""),[T,C]=(0,un.useState)(!1),{privyWallet:S,onCompleteNavigateTo:b,onSuccess:x,onFailure:I}=s.recoverWallet,W=(B="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),I(typeof B=="string"?new qt(B):B)};d.current=W,(0,un.useEffect)(()=>{if(!r||!S)return W("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let R=B=>{B&&v(B)};return(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(k,{onClose:W}),(0,Re.jsx)(X,{}),(0,Re.jsxs)(Iw,{children:[(0,Re.jsxs)(Rw,{children:[(0,Re.jsx)(Kf.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,Re.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),(0,Re.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),(0,Re.jsxs)("div",{children:[(0,Re.jsxs)(Uo,{children:[(0,Re.jsx)(ii,{type:e?"password":"text",onChange:B=>R(B.target.value),disabled:T,style:{paddingRight:"2.3rem"}}),(0,Re.jsx)(ai,{style:{right:"0.75rem"},children:e?(0,Re.jsx)(si,{onClick:()=>t(!1)}):(0,Re.jsx)(li,{onClick:()=>t(!0)})})]}),!!h&&(0,Re.jsx)(Mw,{children:h})]}),(0,Re.jsxs)("div",{children:[(0,Re.jsxs)(nm,{children:[(0,Re.jsx)("h4",{children:"Why is this necessary?"}),(0,Re.jsx)("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),(0,Re.jsx)(Ww,{loading:T||!n,disabled:!u,onClick:async()=>{C(!0);let B=await o();if(B&&S&&u!==null)try{i("embedded_wallet_recovery_started",{walletAddress:S.address}),await n?.recover({address:S.address,accessToken:B,recoveryPin:u}),w(""),b?l(b):a({shouldCallAuthOnSuccess:!1}),x?.(S),i("embedded_wallet_recovery_completed",{walletAddress:S.address})}catch(G){zm(G)?w("Invalid recovery password, please try again."):w("An error has occurred, please try again.")}finally{C(!1)}else return W("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!S&&T,children:"Recover your account"})]})]}),(0,Re.jsx)(le,{}),(0,Re.jsx)(q,{protectedByPrivy:!0})]})},Rw=mn.default.div`
1291
1291
  display: flex;
1292
1292
  flex-direction: column;
1293
1293
  align-items: center;
@@ -1309,18 +1309,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1309
1309
  font-weight: 400;
1310
1310
  line-height: 20px;
1311
1311
  }
1312
- `,Rw=mn.default.div`
1312
+ `,Iw=mn.default.div`
1313
1313
  display: flex;
1314
1314
  flex-direction: column;
1315
1315
  justify-content: space-between;
1316
- `,Iw=mn.default.div`
1316
+ `,Mw=mn.default.div`
1317
1317
  line-height: 20px;
1318
1318
  height: 20px;
1319
1319
  font-size: 13px;
1320
1320
  color: var(--privy-color-error);
1321
1321
  text-align: left;
1322
1322
  margin-top: 0.5rem;
1323
- `,Mw=(0,mn.default)(U)`
1323
+ `,Ww=(0,mn.default)(U)`
1324
1324
  ${e=>e.hideAnimations&&mn.css`
1325
1325
  && {
1326
1326
  // Remove animations because the recoverWallet task on the iframe partially
@@ -1328,7 +1328,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1328
1328
  transition: none;
1329
1329
  }
1330
1330
  `}
1331
- `;var Yf=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Jf=y(require("@heroicons/react/24/outline/PhoneIcon")),Ys=y(require("styled-components"));var Ye=require("react/jsx-runtime"),Ww=e=>{let t=(0,Ye.jsx)(Yf.default,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof _)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof ke&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:(0,Ye.jsx)(Jf.default,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof mt)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:(0,Ye.jsx)(Hs,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:(0,Ye.jsx)("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:(0,Ye.jsx)("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Br&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},Zf=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=A(),{reset:a}=_e(),i=r?.errorModalData,l=Ww(i?.error||new Error),s=d=>{if(d instanceof mt)switch(d.privyErrorCode){case"invalid_captcha":return()=>a()}return()=>{}};return(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(k,{backFn:!o||n===o?void 0:t}),(0,Ye.jsxs)(Lw,{children:[(0,Ye.jsx)(Nw,{children:(0,Ye.jsxs)("div",{children:[(0,Ye.jsx)(Bs,{color:"var(--privy-color-error)"}),l.icon]})}),(0,Ye.jsxs)(Ow,{children:[(0,Ye.jsx)("h3",{children:l.title}),(0,Ye.jsx)("p",{children:l.detail})]}),(0,Ye.jsx)(U,{color:"var(--privy-color-error)",onClick:()=>{s(i?.error||new Error)(),e(o||"LANDING",!1)},children:l.ctaText})]})]})},Lw=Ys.default.div`
1331
+ `;var Jf=y(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Zf=y(require("@heroicons/react/24/outline/PhoneIcon")),Ys=y(require("styled-components"));var Ye=require("react/jsx-runtime"),Lw=e=>{let t=(0,Ye.jsx)(Jf.default,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof _)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof ke&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:(0,Ye.jsx)(Zf.default,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof mt)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:(0,Ye.jsx)(Hs,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:(0,Ye.jsx)("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:(0,Ye.jsx)("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Br&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},Qf=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=A(),{reset:a}=_e(),i=r?.errorModalData,l=Lw(i?.error||new Error),s=d=>{if(d instanceof mt)switch(d.privyErrorCode){case"invalid_captcha":return()=>a()}return()=>{}};return(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(k,{backFn:!o||n===o?void 0:t}),(0,Ye.jsxs)(Ow,{children:[(0,Ye.jsx)(Dw,{children:(0,Ye.jsxs)("div",{children:[(0,Ye.jsx)(Bs,{color:"var(--privy-color-error)"}),l.icon]})}),(0,Ye.jsxs)(Nw,{children:[(0,Ye.jsx)("h3",{children:l.title}),(0,Ye.jsx)("p",{children:l.detail})]}),(0,Ye.jsx)(U,{color:"var(--privy-color-error)",onClick:()=>{s(i?.error||new Error)(),e(o||"LANDING",!1)},children:l.ctaText})]})]})},Ow=Ys.default.div`
1332
1332
  display: flex;
1333
1333
  flex-direction: column;
1334
1334
  align-items: center;
@@ -1336,11 +1336,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1336
1336
  gap: 24px;
1337
1337
  width: 100%;
1338
1338
  padding-bottom: 16px;
1339
- `,Ow=Ys.default.div`
1339
+ `,Nw=Ys.default.div`
1340
1340
  display: flex;
1341
1341
  flex-direction: column;
1342
1342
  gap: 8px;
1343
- `,Nw=Ys.default.div`
1343
+ `,Dw=Ys.default.div`
1344
1344
  display: flex;
1345
1345
  flex-direction: column;
1346
1346
  justify-content: center;
@@ -1363,7 +1363,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1363
1363
  left: -19px;
1364
1364
  top: -19px;
1365
1365
  }
1366
- `;var vo=require("react"),ta=require("react-device-detect"),Xs=y(require("styled-components"));var Xf=require("react"),eh=y(require("styled-components"));var Gc=require("react/jsx-runtime"),Js=({style:e,color:t,...r})=>(0,Gc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:(0,Gc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});var Zs=require("react/jsx-runtime"),Qf=({color:e,...t})=>(0,Zs.jsx)("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:(0,Zs.jsx)("g",{children:(0,Zs.jsx)("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});var ea=require("react/jsx-runtime"),Go=e=>{let[t,r]=(0,Xf.useState)(!1);return(0,ea.jsxs)(Dw,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?(0,ea.jsx)(Js,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):(0,ea.jsx)(Qf,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},Dw=eh.default.button`
1366
+ `;var vo=require("react"),ta=require("react-device-detect"),Xs=y(require("styled-components"));var eh=require("react"),th=y(require("styled-components"));var Gc=require("react/jsx-runtime"),Js=({style:e,color:t,...r})=>(0,Gc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:(0,Gc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});var Zs=require("react/jsx-runtime"),Xf=({color:e,...t})=>(0,Zs.jsx)("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:(0,Zs.jsx)("g",{children:(0,Zs.jsx)("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});var ea=require("react/jsx-runtime"),Go=e=>{let[t,r]=(0,eh.useState)(!1);return(0,ea.jsxs)(Fw,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?(0,ea.jsx)(Js,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):(0,ea.jsx)(Xf,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},Fw=th.default.button`
1367
1367
  display: flex;
1368
1368
  align-items: center;
1369
1369
  gap: 6px;
@@ -1401,7 +1401,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1401
1401
  width: 14px;
1402
1402
  height: 14px;
1403
1403
  }
1404
- `;var th=require("react"),rh=y(require("styled-components")),oh=require("react/jsx-runtime"),Qs=e=>{let[t,r]=(0,th.useState)(!1);return(0,oh.jsx)(Fw,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},Fw=rh.default.a`
1404
+ `;var rh=require("react"),oh=y(require("styled-components")),nh=require("react/jsx-runtime"),Qs=e=>{let[t,r]=(0,rh.useState)(!1);return(0,nh.jsx)(Uw,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},Uw=oh.default.a`
1405
1405
  display: flex;
1406
1406
  align-items: center;
1407
1407
  gap: 6px;
@@ -1439,7 +1439,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1439
1439
  width: 14px;
1440
1440
  height: 14px;
1441
1441
  }
1442
- `;var ah=y(require("qrcode")),sh=y(require("react")),lh=y(require("styled-components"));var Vc=require("react/jsx-runtime"),nh=()=>(0,Vc.jsx)("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:(0,Vc.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var We=require("react/jsx-runtime"),Yt=7,zc=(e,t,r,o,n)=>{for(let a=t;a<t+o;a++)for(let i=r;i<r+n;i++){let l=e?.[i];l&&l[a]&&(l[a]=0)}return e},Uw=e=>{let t=ah.default.create(e,{errorCorrectionLevel:"high"}).modules,r=Ap(Array.from(t.data),t.size);return r=zc(r,0,0,Yt,Yt),r=zc(r,r.length-Yt,0,Yt,Yt),r=zc(r,0,r.length-Yt,Yt,Yt),r},Bw=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>(0,We.jsx)(We.Fragment,{children:[0,1,2].map(a=>(0,We.jsx)("circle",{r:r*(Yt-a*2)/2,cx:e+r*Yt/2,cy:t+r*Yt/2,fill:a%2!==0?o:n},`finder-${e}-${t}-${a}`))}),Hw=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Yt)*e,0],[0,(t-Yt)*e]];return(0,We.jsx)(We.Fragment,{children:n.map(([a,i])=>(0,We.jsx)(Bw,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},Gw=({matrix:e,cellSize:t,color:r})=>(0,We.jsx)(We.Fragment,{children:e.map((o,n)=>o.map((a,i)=>a?(0,We.jsx)("circle",{r:t/2.5,cx:n*t+t/2,cy:i*t+t/2,fill:r},`circle-${n}-${i}`):(0,We.jsx)(sh.default.Fragment,{},`circle-${n}-${i}`)))}),ih=(e,t)=>e-e%t,Vw=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:a})=>{if(!r)return(0,We.jsx)(We.Fragment,{});let i=o||40,l=n||4,s=r,d=e/2-i/2-l;return(0,We.jsxs)(We.Fragment,{children:[(0,We.jsx)("rect",{x:ih(d,t),y:ih(d,t),width:i+l*2+(d%t?t+.5:.5),height:i+l*2+(d%t?t+.5:.5),fill:a}),(0,We.jsx)(s,{x:e/2-i/2,y:e/2-i/2,height:i,width:i})]})},zw=e=>{let t=e.outputSize,r=Uw(e.url),o=t/r.length;return(0,We.jsxs)("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,We.jsx)(Gw,{matrix:r,cellSize:o,color:e.fgColor}),(0,We.jsx)(Hw,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),(0,We.jsx)(Vw,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},qw=lh.default.div`
1442
+ `;var sh=y(require("qrcode")),lh=y(require("react")),ch=y(require("styled-components"));var Vc=require("react/jsx-runtime"),ih=()=>(0,Vc.jsx)("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:(0,Vc.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var We=require("react/jsx-runtime"),Yt=7,zc=(e,t,r,o,n)=>{for(let a=t;a<t+o;a++)for(let i=r;i<r+n;i++){let l=e?.[i];l&&l[a]&&(l[a]=0)}return e},Bw=e=>{let t=sh.default.create(e,{errorCorrectionLevel:"high"}).modules,r=Ap(Array.from(t.data),t.size);return r=zc(r,0,0,Yt,Yt),r=zc(r,r.length-Yt,0,Yt,Yt),r=zc(r,0,r.length-Yt,Yt,Yt),r},Hw=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>(0,We.jsx)(We.Fragment,{children:[0,1,2].map(a=>(0,We.jsx)("circle",{r:r*(Yt-a*2)/2,cx:e+r*Yt/2,cy:t+r*Yt/2,fill:a%2!==0?o:n},`finder-${e}-${t}-${a}`))}),Gw=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Yt)*e,0],[0,(t-Yt)*e]];return(0,We.jsx)(We.Fragment,{children:n.map(([a,i])=>(0,We.jsx)(Hw,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},Vw=({matrix:e,cellSize:t,color:r})=>(0,We.jsx)(We.Fragment,{children:e.map((o,n)=>o.map((a,i)=>a?(0,We.jsx)("circle",{r:t/2.5,cx:n*t+t/2,cy:i*t+t/2,fill:r},`circle-${n}-${i}`):(0,We.jsx)(lh.default.Fragment,{},`circle-${n}-${i}`)))}),ah=(e,t)=>e-e%t,zw=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:a})=>{if(!r)return(0,We.jsx)(We.Fragment,{});let i=o||40,l=n||4,s=r,d=e/2-i/2-l;return(0,We.jsxs)(We.Fragment,{children:[(0,We.jsx)("rect",{x:ah(d,t),y:ah(d,t),width:i+l*2+(d%t?t+.5:.5),height:i+l*2+(d%t?t+.5:.5),fill:a}),(0,We.jsx)(s,{x:e/2-i/2,y:e/2-i/2,height:i,width:i})]})},qw=e=>{let t=e.outputSize,r=Bw(e.url),o=t/r.length;return(0,We.jsxs)("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,We.jsx)(Vw,{matrix:r,cellSize:o,color:e.fgColor}),(0,We.jsx)(Gw,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),(0,We.jsx)(zw,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},$w=ch.default.div`
1443
1443
  display: flex;
1444
1444
  justify-content: center;
1445
1445
  align-items: center;
@@ -1454,7 +1454,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1454
1454
  border-color: ${e=>e.fgColor};
1455
1455
  border-radius: var(--privy-border-radius-md);
1456
1456
  }
1457
- `,pi=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return(0,We.jsx)(qw,{size:o,bgColor:t,fgColor:r,children:(0,We.jsx)(zw,{url:e.url,logo:{element:e.squareLogoElement??nh},outputSize:o,bgColor:t,fgColor:r})})};var fn=require("react/jsx-runtime"),Yr=({style:e,...t})=>(0,fn.jsxs)("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[(0,fn.jsx)("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),(0,fn.jsx)("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),(0,fn.jsx)("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),(0,fn.jsx)("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});var K=require("react/jsx-runtime"),ch="#8a63d2",uh=1e3,$w=uh*2,jw=uh*120,mh=()=>{let{authenticated:e,logout:t,ready:r,user:o}=V(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:s}=A(),{getAuthFlow:d,loginWithFarcaster:u,closePrivyModal:v,createAnalyticsEvent:h}=L(),[w,T]=(0,vo.useState)(void 0),[C,S]=(0,vo.useState)(!1),[b,x]=(0,vo.useState)(!1),I=(0,vo.useRef)([]),W=s?.render.inDialog?at:0,R=d(),H=R?.meta.connectUri;return(0,vo.useEffect)(()=>{let B=Date.now(),G=setInterval(async()=>{let P=await R.pollForReady.execute(),J=Date.now()-B;if(P){clearInterval(G),S(!0);try{await u(),x(!0)}catch(N){let te={retryable:!1,message:"Authentication failed"};if(N?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else N?.privyErrorCode==="linked_to_another_user"?te.detail="This account has already been linked to another user.":N?.privyErrorCode==="invalid_credentials"?(te.retryable=!0,te.detail="Something went wrong. Try again."):N?.privyErrorCode==="too_many_requests"&&(te.detail="Too many requests. Please wait before trying again.");T(te)}}else J>jw&&(clearInterval(G),T({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},$w);return()=>{clearInterval(G),I.current.forEach(P=>clearTimeout(P))}},[]),(0,vo.useEffect)(()=>{if(r&&e&&b&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let G=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},W);return()=>clearTimeout(G)}b&&(or(o,s?.embeddedWallets.createOnLogin)?I.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:G=>{console.error(G),h("embedded_wallet_creation_failure_logout",{error:G,screen:"FarcasterConnectStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},W)):I.current.push(setTimeout(()=>v({shouldCallAuthOnSuccess:!0,isSuccess:!0}),W)))}},[b,r,e,o]),ta.isMobile||C?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(k,{backFn:n?i:void 0,onClose:v},"header"),(0,K.jsx)(X,{}),ta.isIOS?(0,K.jsx)(K.Fragment,{children:(0,K.jsxs)(Kw,{children:[(0,K.jsx)(ph,{children:(0,K.jsxs)("div",{children:[(0,K.jsx)(lr,{success:b,fail:!!w}),(0,K.jsx)(Yr,{style:{width:"38px",height:"38px"}})]})}),(0,K.jsxs)(gt,{children:[(0,K.jsx)(Ae,{children:w?w.message:"Sign in with Farcaster"}),(0,K.jsx)(ge,{children:w?w.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),H&&(0,K.jsx)(U,{onClick:B=>{B.preventDefault(),window.location.href=H},children:"Open Warpcast app"})]})}):(0,K.jsx)(K.Fragment,{children:(0,K.jsxs)(dh,{children:[(0,K.jsx)(ph,{children:(0,K.jsxs)("div",{children:[(0,K.jsx)(lr,{success:b,fail:!!w}),(0,K.jsx)(Yr,{style:{width:"38px",height:"38px"}})]})}),(0,K.jsxs)(gt,{children:[(0,K.jsx)(Ae,{children:w?w.message:"Signing in with Farcaster"}),(0,K.jsx)(ge,{children:w?w.detail:"This should only take a moment"}),(0,K.jsx)(kt,{children:H&&ta.isMobile&&(0,K.jsx)(Qs,{text:"Take me to Warpcast",url:H,color:ch})})]})]})}),(0,K.jsx)(ie,{})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(k,{backFn:n?i:void 0,onClose:v},"header"),(0,K.jsx)(X,{}),(0,K.jsx)(dh,{children:(0,K.jsxs)("div",{children:[(0,K.jsx)(Ae,{children:"Sign in with Farcaster"}),(0,K.jsx)(ge,{children:"Scan with your phone's camera to continue."}),(0,K.jsx)(Kn,{children:H?(0,K.jsx)(pi,{url:H,size:275,squareLogoElement:Yr}):(0,K.jsx)(Lt,{})}),(0,K.jsxs)(kt,{children:[(0,K.jsx)(ge,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),H&&(0,K.jsx)(Go,{text:H,itemName:"link",color:ch})]})]})}),(0,K.jsx)(ie,{})]})},dh=Xs.default.div`
1457
+ `,pi=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return(0,We.jsx)($w,{size:o,bgColor:t,fgColor:r,children:(0,We.jsx)(qw,{url:e.url,logo:{element:e.squareLogoElement??ih},outputSize:o,bgColor:t,fgColor:r})})};var fn=require("react/jsx-runtime"),Yr=({style:e,...t})=>(0,fn.jsxs)("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[(0,fn.jsx)("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),(0,fn.jsx)("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),(0,fn.jsx)("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),(0,fn.jsx)("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});var K=require("react/jsx-runtime"),dh="#8a63d2",mh=1e3,jw=mh*2,Kw=mh*120,fh=()=>{let{authenticated:e,logout:t,ready:r,user:o}=V(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:s}=A(),{getAuthFlow:d,loginWithFarcaster:u,closePrivyModal:v,createAnalyticsEvent:h}=L(),[w,T]=(0,vo.useState)(void 0),[C,S]=(0,vo.useState)(!1),[b,x]=(0,vo.useState)(!1),I=(0,vo.useRef)([]),W=s?.render.inDialog?at:0,R=d(),H=R?.meta.connectUri;return(0,vo.useEffect)(()=>{let B=Date.now(),G=setInterval(async()=>{let P=await R.pollForReady.execute(),J=Date.now()-B;if(P){clearInterval(G),S(!0);try{await u(),x(!0)}catch(N){let te={retryable:!1,message:"Authentication failed"};if(N?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else N?.privyErrorCode==="linked_to_another_user"?te.detail="This account has already been linked to another user.":N?.privyErrorCode==="invalid_credentials"?(te.retryable=!0,te.detail="Something went wrong. Try again."):N?.privyErrorCode==="too_many_requests"&&(te.detail="Too many requests. Please wait before trying again.");T(te)}}else J>Kw&&(clearInterval(G),T({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},jw);return()=>{clearInterval(G),I.current.forEach(P=>clearTimeout(P))}},[]),(0,vo.useEffect)(()=>{if(r&&e&&b&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let G=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},W);return()=>clearTimeout(G)}b&&(or(o,s?.embeddedWallets.createOnLogin)?I.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:G=>{console.error(G),h("embedded_wallet_creation_failure_logout",{error:G,screen:"FarcasterConnectStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},W)):I.current.push(setTimeout(()=>v({shouldCallAuthOnSuccess:!0,isSuccess:!0}),W)))}},[b,r,e,o]),ta.isMobile||C?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(k,{backFn:n?i:void 0,onClose:v},"header"),(0,K.jsx)(X,{}),ta.isIOS?(0,K.jsx)(K.Fragment,{children:(0,K.jsxs)(Yw,{children:[(0,K.jsx)(uh,{children:(0,K.jsxs)("div",{children:[(0,K.jsx)(lr,{success:b,fail:!!w}),(0,K.jsx)(Yr,{style:{width:"38px",height:"38px"}})]})}),(0,K.jsxs)(gt,{children:[(0,K.jsx)(Ae,{children:w?w.message:"Sign in with Farcaster"}),(0,K.jsx)(ge,{children:w?w.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),H&&(0,K.jsx)(U,{onClick:B=>{B.preventDefault(),window.location.href=H},children:"Open Warpcast app"})]})}):(0,K.jsx)(K.Fragment,{children:(0,K.jsxs)(ph,{children:[(0,K.jsx)(uh,{children:(0,K.jsxs)("div",{children:[(0,K.jsx)(lr,{success:b,fail:!!w}),(0,K.jsx)(Yr,{style:{width:"38px",height:"38px"}})]})}),(0,K.jsxs)(gt,{children:[(0,K.jsx)(Ae,{children:w?w.message:"Signing in with Farcaster"}),(0,K.jsx)(ge,{children:w?w.detail:"This should only take a moment"}),(0,K.jsx)(kt,{children:H&&ta.isMobile&&(0,K.jsx)(Qs,{text:"Take me to Warpcast",url:H,color:dh})})]})]})}),(0,K.jsx)(ie,{})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(k,{backFn:n?i:void 0,onClose:v},"header"),(0,K.jsx)(X,{}),(0,K.jsx)(ph,{children:(0,K.jsxs)("div",{children:[(0,K.jsx)(Ae,{children:"Sign in with Farcaster"}),(0,K.jsx)(ge,{children:"Scan with your phone's camera to continue."}),(0,K.jsx)(Kn,{children:H?(0,K.jsx)(pi,{url:H,size:275,squareLogoElement:Yr}):(0,K.jsx)(Lt,{})}),(0,K.jsxs)(kt,{children:[(0,K.jsx)(ge,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),H&&(0,K.jsx)(Go,{text:H,itemName:"link",color:dh})]})]})}),(0,K.jsx)(ie,{})]})},ph=Xs.default.div`
1458
1458
  display: flex;
1459
1459
  flex-direction: column;
1460
1460
  align-items: center;
@@ -1462,14 +1462,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1462
1462
  margin-left: 27px;
1463
1463
  margin-right: 27px;
1464
1464
  gap: 24px;
1465
- `,Kw=Xs.default.div`
1465
+ `,Yw=Xs.default.div`
1466
1466
  display: flex;
1467
1467
  flex-direction: column;
1468
1468
  align-items: center;
1469
1469
  justify-content: center;
1470
1470
  gap: 24px;
1471
1471
  width: 100%;
1472
- `,ph=Xs.default.div`
1472
+ `,uh=Xs.default.div`
1473
1473
  display: flex;
1474
1474
  flex-direction: column;
1475
1475
  justify-content: center;
@@ -1492,7 +1492,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1492
1492
  left: -19px;
1493
1493
  top: -19px;
1494
1494
  }
1495
- `;var Vo=require("react"),ra=require("react-device-detect"),el=y(require("styled-components"));var Y=require("react/jsx-runtime"),fh="#8a63d2",gh=1e3,Yw=gh*2,Jw=gh*300,vh=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=A(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=L(),[i,l]=(0,Vo.useState)(void 0),[s,d]=(0,Vo.useState)(!1),[u,v]=(0,Vo.useState)(!1),h=(0,Vo.useRef)([]),w=o?.render.inDialog?at:0,T=r?.farcasterSigner;(0,Vo.useEffect)(()=>{let S=Date.now(),b=setInterval(async()=>{if(!T?.public_key){clearInterval(b),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}T.status==="approved"&&(clearInterval(b),d(!1),v(!0),h.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),w)));let x=await n(T?.public_key),I=Date.now()-S;x.status==="approved"?(clearInterval(b),d(!1),v(!0),h.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),w))):I>Jw?(clearInterval(b),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):x.status==="revoked"&&(clearInterval(b),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},Yw);return()=>{clearInterval(b),h.current.forEach(x=>clearTimeout(x))}},[]);let C=T?.status==="pending_approval"?T.signer_approval_url:void 0;return ra.isMobile||s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(k,{backFn:e?t:void 0,onClose:a},"header"),(0,Y.jsx)(X,{}),ra.isIOS?(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsxs)(Zw,{children:[(0,Y.jsx)(yh,{children:(0,Y.jsxs)("div",{children:[(0,Y.jsx)(lr,{success:u,fail:!!i}),(0,Y.jsx)(Yr,{style:{width:"38px",height:"38px"}})]})}),(0,Y.jsxs)(gt,{children:[(0,Y.jsx)(Ae,{children:i?i.message:"Add a signer to Farcaster"}),(0,Y.jsx)(ge,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),C&&(0,Y.jsx)(U,{onClick:S=>{S.preventDefault(),window.location.href=C},children:"Open Warpcast app"})]})}):(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsxs)(hh,{children:[(0,Y.jsx)(yh,{children:(0,Y.jsxs)("div",{children:[(0,Y.jsx)(lr,{success:u,fail:!!i}),(0,Y.jsx)(Yr,{style:{width:"38px",height:"38px"}})]})}),(0,Y.jsxs)(gt,{children:[(0,Y.jsx)(Ae,{children:i?i.message:"Requesting signer from Farcaster"}),(0,Y.jsx)(ge,{children:i?i.detail:"This should only take a moment"}),(0,Y.jsx)(kt,{children:C&&ra.isMobile&&(0,Y.jsx)(Qs,{text:"Take me to Warpcast",url:C,color:fh})})]})]})}),(0,Y.jsx)(ie,{})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(k,{backFn:e?t:void 0,onClose:a},"header"),(0,Y.jsx)(X,{}),(0,Y.jsx)(hh,{children:(0,Y.jsxs)("div",{children:[(0,Y.jsx)(Ae,{children:"Add a signer to Farcaster"}),(0,Y.jsxs)(ge,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),(0,Y.jsx)(Kn,{children:T?.status==="pending_approval"?(0,Y.jsx)(pi,{url:T.signer_approval_url,size:275,squareLogoElement:Yr}):(0,Y.jsx)(Lt,{})}),(0,Y.jsxs)(kt,{children:[(0,Y.jsx)(ge,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),T?.status==="pending_approval"&&(0,Y.jsx)(Go,{text:T.signer_approval_url,itemName:"link",color:fh})]})]})}),(0,Y.jsx)(ie,{})]})},hh=el.default.div`
1495
+ `;var Vo=require("react"),ra=require("react-device-detect"),el=y(require("styled-components"));var Y=require("react/jsx-runtime"),hh="#8a63d2",vh=1e3,Jw=vh*2,Zw=vh*300,wh=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=A(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=L(),[i,l]=(0,Vo.useState)(void 0),[s,d]=(0,Vo.useState)(!1),[u,v]=(0,Vo.useState)(!1),h=(0,Vo.useRef)([]),w=o?.render.inDialog?at:0,T=r?.farcasterSigner;(0,Vo.useEffect)(()=>{let S=Date.now(),b=setInterval(async()=>{if(!T?.public_key){clearInterval(b),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}T.status==="approved"&&(clearInterval(b),d(!1),v(!0),h.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),w)));let x=await n(T?.public_key),I=Date.now()-S;x.status==="approved"?(clearInterval(b),d(!1),v(!0),h.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),w))):I>Zw?(clearInterval(b),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):x.status==="revoked"&&(clearInterval(b),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},Jw);return()=>{clearInterval(b),h.current.forEach(x=>clearTimeout(x))}},[]);let C=T?.status==="pending_approval"?T.signer_approval_url:void 0;return ra.isMobile||s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(k,{backFn:e?t:void 0,onClose:a},"header"),(0,Y.jsx)(X,{}),ra.isIOS?(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsxs)(Qw,{children:[(0,Y.jsx)(gh,{children:(0,Y.jsxs)("div",{children:[(0,Y.jsx)(lr,{success:u,fail:!!i}),(0,Y.jsx)(Yr,{style:{width:"38px",height:"38px"}})]})}),(0,Y.jsxs)(gt,{children:[(0,Y.jsx)(Ae,{children:i?i.message:"Add a signer to Farcaster"}),(0,Y.jsx)(ge,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),C&&(0,Y.jsx)(U,{onClick:S=>{S.preventDefault(),window.location.href=C},children:"Open Warpcast app"})]})}):(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsxs)(yh,{children:[(0,Y.jsx)(gh,{children:(0,Y.jsxs)("div",{children:[(0,Y.jsx)(lr,{success:u,fail:!!i}),(0,Y.jsx)(Yr,{style:{width:"38px",height:"38px"}})]})}),(0,Y.jsxs)(gt,{children:[(0,Y.jsx)(Ae,{children:i?i.message:"Requesting signer from Farcaster"}),(0,Y.jsx)(ge,{children:i?i.detail:"This should only take a moment"}),(0,Y.jsx)(kt,{children:C&&ra.isMobile&&(0,Y.jsx)(Qs,{text:"Take me to Warpcast",url:C,color:hh})})]})]})}),(0,Y.jsx)(ie,{})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(k,{backFn:e?t:void 0,onClose:a},"header"),(0,Y.jsx)(X,{}),(0,Y.jsx)(yh,{children:(0,Y.jsxs)("div",{children:[(0,Y.jsx)(Ae,{children:"Add a signer to Farcaster"}),(0,Y.jsxs)(ge,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),(0,Y.jsx)(Kn,{children:T?.status==="pending_approval"?(0,Y.jsx)(pi,{url:T.signer_approval_url,size:275,squareLogoElement:Yr}):(0,Y.jsx)(Lt,{})}),(0,Y.jsxs)(kt,{children:[(0,Y.jsx)(ge,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),T?.status==="pending_approval"&&(0,Y.jsx)(Go,{text:T.signer_approval_url,itemName:"link",color:hh})]})]})}),(0,Y.jsx)(ie,{})]})},yh=el.default.div`
1496
1496
  display: flex;
1497
1497
  flex-direction: column;
1498
1498
  align-items: center;
@@ -1500,14 +1500,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
1500
1500
  margin-left: 27px;
1501
1501
  margin-right: 27px;
1502
1502
  gap: 24px;
1503
- `,Zw=el.default.div`
1503
+ `,Qw=el.default.div`
1504
1504
  display: flex;
1505
1505
  flex-direction: column;
1506
1506
  align-items: center;
1507
1507
  justify-content: center;
1508
1508
  gap: 24px;
1509
1509
  width: 100%;
1510
- `,yh=el.default.div`
1510
+ `,gh=el.default.div`
1511
1511
  display: flex;
1512
1512
  flex-direction: column;
1513
1513
  justify-content: center;
@@ -1530,7 +1530,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1530
1530
  left: -19px;
1531
1531
  top: -19px;
1532
1532
  }
1533
- `;var wh=y(require("@heroicons/react/24/outline/ClockIcon")),Ch=y(require("@heroicons/react/24/outline/EyeSlashIcon")),bh=y(require("@heroicons/react/24/outline/LinkIcon")),Ir=y(require("styled-components"));var ui=require("react/jsx-runtime"),tl=({size:e=61,...t})=>(0,ui.jsx)("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,ui.jsxs)("g",{id:"moonpay_symbol_wht 2",children:[(0,ui.jsx)("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),(0,ui.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"})]})});var Pe=require("react/jsx-runtime"),qc=({title:e,desc:t,icon:r})=>(0,Pe.jsxs)(oC,{children:[(0,Pe.jsx)(iC,{children:r}),(0,Pe.jsxs)(nC,{children:[(0,Pe.jsx)(tC,{children:e}),(0,Pe.jsx)(rC,{children:t})]})]}),Eh=({app:e,signedUrl:t,onContinue:r})=>(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsxs)(Xw,{children:[(0,Pe.jsx)(tl,{size:"3.75rem"}),(0,Pe.jsxs)(eC,{children:[e?.name," uses ",(0,Pe.jsx)("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),(0,Pe.jsxs)(aC,{children:[(0,Pe.jsx)(qc,{icon:(0,Pe.jsx)(bh.default,{width:"1rem"}),title:"Purchase assets to fund your account",desc:(0,Pe.jsxs)(Pe.Fragment,{children:["Connect a payment method (",(0,Pe.jsx)("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),(0,Pe.jsx)(qc,{icon:(0,Pe.jsx)(wh.default,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),(0,Pe.jsx)(qc,{icon:(0,Pe.jsx)(Ch.default,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),(0,Pe.jsx)(sC,{className:"mobile-only"})]}),(0,Pe.jsx)(Qw,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),(0,Pe.jsx)(Is,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),Qw=Ir.default.span`
1533
+ `;var Ch=y(require("@heroicons/react/24/outline/ClockIcon")),bh=y(require("@heroicons/react/24/outline/EyeSlashIcon")),Eh=y(require("@heroicons/react/24/outline/LinkIcon")),Ir=y(require("styled-components"));var ui=require("react/jsx-runtime"),tl=({size:e=61,...t})=>(0,ui.jsx)("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,ui.jsxs)("g",{id:"moonpay_symbol_wht 2",children:[(0,ui.jsx)("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),(0,ui.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"})]})});var Pe=require("react/jsx-runtime"),qc=({title:e,desc:t,icon:r})=>(0,Pe.jsxs)(nC,{children:[(0,Pe.jsx)(aC,{children:r}),(0,Pe.jsxs)(iC,{children:[(0,Pe.jsx)(rC,{children:e}),(0,Pe.jsx)(oC,{children:t})]})]}),Th=({app:e,signedUrl:t,onContinue:r})=>(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsxs)(eC,{children:[(0,Pe.jsx)(tl,{size:"3.75rem"}),(0,Pe.jsxs)(tC,{children:[e?.name," uses ",(0,Pe.jsx)("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),(0,Pe.jsxs)(sC,{children:[(0,Pe.jsx)(qc,{icon:(0,Pe.jsx)(Eh.default,{width:"1rem"}),title:"Purchase assets to fund your account",desc:(0,Pe.jsxs)(Pe.Fragment,{children:["Connect a payment method (",(0,Pe.jsx)("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),(0,Pe.jsx)(qc,{icon:(0,Pe.jsx)(Ch.default,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),(0,Pe.jsx)(qc,{icon:(0,Pe.jsx)(bh.default,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),(0,Pe.jsx)(lC,{className:"mobile-only"})]}),(0,Pe.jsx)(Xw,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),(0,Pe.jsx)(Is,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),Xw=Ir.default.span`
1534
1534
  display: inline-block;
1535
1535
  color: var(--privy-color-foreground-3);
1536
1536
  text-align: center;
@@ -1539,13 +1539,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1539
1539
  font-weight: 400;
1540
1540
  line-height: 140%; /* 0.875rem */
1541
1541
  margin-bottom: 0.25rem;
1542
- `,Xw=Ir.default.div`
1542
+ `,eC=Ir.default.div`
1543
1543
  display: flex;
1544
1544
  flex-direction: column;
1545
1545
  align-items: center;
1546
1546
  justify-content: center;
1547
1547
  padding: 1.5rem 0;
1548
- `,eC=Ir.default.span`
1548
+ `,tC=Ir.default.span`
1549
1549
  color: var(--privy-color-foreground);
1550
1550
  text-align: center;
1551
1551
  font-size: 1.125rem;
@@ -1554,46 +1554,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
1554
1554
  margin: 1.5rem 0;
1555
1555
  text-align: center;
1556
1556
  max-width: 19.5rem;
1557
- `,tC=Ir.default.span`
1557
+ `,rC=Ir.default.span`
1558
1558
  color: var(--privy-color-foreground);
1559
1559
  font-size: 0.875rem;
1560
1560
  font-weight: 500;
1561
1561
  line-height: 1.225rem;
1562
1562
  width: 100%;
1563
- `,rC=Ir.default.span`
1563
+ `,oC=Ir.default.span`
1564
1564
  color: var(--privy-color-foreground-2);
1565
1565
  font-size: 0.875rem;
1566
1566
  font-weight: 400;
1567
1567
  line-height: 1.225rem;
1568
- `,oC=Ir.default.div`
1568
+ `,nC=Ir.default.div`
1569
1569
  display: flex;
1570
1570
  align-items: flex-start;
1571
1571
  gap: 0.5rem;
1572
1572
  align-self: stretch;
1573
- `,nC=Ir.default.div`
1573
+ `,iC=Ir.default.div`
1574
1574
  display: flex;
1575
1575
  flex-direction: column;
1576
1576
  gap: 0.25rem;
1577
1577
  align-items: flex-start;
1578
1578
  text-align: left;
1579
1579
  flex: 1 0 0;
1580
- `,iC=Ir.default.div`
1581
- padding-top: 2px;
1582
1580
  `,aC=Ir.default.div`
1581
+ padding-top: 2px;
1582
+ `,sC=Ir.default.div`
1583
1583
  display: flex;
1584
1584
  flex-direction: column;
1585
1585
  gap: 1.25rem;
1586
1586
  margin: 0 0.5rem;
1587
- `,sC=Ir.default.div`
1587
+ `,lC=Ir.default.div`
1588
1588
  margin: 30px 0;
1589
- `;var Ph=require("ofetch"),mi=require("react");var rl="moonpay",Th="sdk_fiat_on_ramp_completed_with_status";async function xh(e,t,r,o,n=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},i=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...a,...i}})}async function lC(e,t){let r=t?Ep:bp,o=t?Pp:Tp;return(0,Ph.ofetch)(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Sh(e,t=!1){let[r,o]=(0,mi.useState)(null),{createAnalyticsEvent:n}=L(),a=(0,mi.useRef)(0);return(0,mi.useEffect)(()=>{let i=setInterval(async()=>{if(e)try{let[l]=await lC(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(Th,{status:s,provider:rl,paymentMethod:l.paymentMethod,cardPaymentType:l.cardPaymentType,currency:l.currency?.code,baseCurrencyAmount:l.baseCurrencyAmount,quoteCurrencyAmount:l.quoteCurrencyAmount,feeAmount:l.feeAmount,extraFeeAmount:l.extraFeeAmount,networkFeeAmount:l.networkFeeAmount}),clearInterval(i))}catch(l){l.response?.status!==404&&(a.current+=1),a.current>=3&&(o("serviceFailure"),n(Th,{status:"serviceFailure",provider:rl}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}var zo=require("react/jsx-runtime"),_h=()=>{let{app:e,data:t,navigate:r}=A(),{createAnalyticsEvent:o}=L(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:(0,zo.jsxs)(zo.Fragment,{children:[(0,zo.jsx)(k,{title:"Fund account"},"header"),(0,zo.jsx)(Eh,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:rl}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),(0,zo.jsx)(q,{protectedByPrivy:!0})]})};var Ah=y(require("@heroicons/react/24/solid/ArrowsRightLeftIcon")),kh=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Rh=y(require("@heroicons/react/24/solid/XCircleIcon")),Ih=require("react"),$c=y(require("styled-components"));var Ce=require("react/jsx-runtime"),Mh=()=>{let{app:e,data:t}=A(),{closePrivyModal:r}=L(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Sh(o||null,e.fiatOnRamp.useSandbox);return(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(k,{title:"Fund account"},"header"),(0,Ce.jsx)(dC,{status:n,onClickCta:r}),(0,Ce.jsx)(q,{protectedByPrivy:!0})]})},cC=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"failed":return{title:"Something went wrong!",body:(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)("p",{children:["It looks like there was an issue with your payment. Please contact"," ",(0,Ce.jsx)("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),(0,Ce.jsx)("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};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:""}}},dC=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=(0,Ih.useMemo)(()=>cC(e),[e]);return(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)(hC,{children:[(0,Ce.jsx)(mC,{status:e}),(0,Ce.jsxs)(gt,{children:[(0,Ce.jsx)("h3",{children:r}),(0,Ce.jsx)(fC,{children:o})]})]}),n&&(0,Ce.jsx)(U,{onClick:t,children:n})]})},pC=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)",uC=e=>{switch(e){case"serviceFailure":case"failed":return Rh.default;case"completed":return kh.default;case"waitingAuthorization":return()=>(0,Ce.jsx)(Ah.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}},mC=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return(0,Ce.jsxs)("div",{style:{position:"relative"},children:[(0,Ce.jsx)(Lt,{color:o,style:{position:"absolute"}}),(0,Ce.jsx)(Cc,{color:o}),(0,Ce.jsx)(tl,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=uC(e),r=pC(e);return(0,Ce.jsx)("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&(0,Ce.jsx)(t,{width:"4rem",height:"4rem",color:r})})},fC=$c.default.p`
1589
+ `;var xh=require("ofetch"),mi=require("react");var rl="moonpay",Ph="sdk_fiat_on_ramp_completed_with_status";async function Sh(e,t,r,o,n=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},i=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...a,...i}})}async function cC(e,t){let r=t?Ep:bp,o=t?Pp:Tp;return(0,xh.ofetch)(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function _h(e,t=!1){let[r,o]=(0,mi.useState)(null),{createAnalyticsEvent:n}=L(),a=(0,mi.useRef)(0);return(0,mi.useEffect)(()=>{let i=setInterval(async()=>{if(e)try{let[l]=await cC(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(Ph,{status:s,provider:rl,paymentMethod:l.paymentMethod,cardPaymentType:l.cardPaymentType,currency:l.currency?.code,baseCurrencyAmount:l.baseCurrencyAmount,quoteCurrencyAmount:l.quoteCurrencyAmount,feeAmount:l.feeAmount,extraFeeAmount:l.extraFeeAmount,networkFeeAmount:l.networkFeeAmount}),clearInterval(i))}catch(l){l.response?.status!==404&&(a.current+=1),a.current>=3&&(o("serviceFailure"),n(Ph,{status:"serviceFailure",provider:rl}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}var zo=require("react/jsx-runtime"),Ah=()=>{let{app:e,data:t,navigate:r}=A(),{createAnalyticsEvent:o}=L(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:(0,zo.jsxs)(zo.Fragment,{children:[(0,zo.jsx)(k,{title:"Fund account"},"header"),(0,zo.jsx)(Th,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:rl}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),(0,zo.jsx)(q,{protectedByPrivy:!0})]})};var kh=y(require("@heroicons/react/24/solid/ArrowsRightLeftIcon")),Rh=y(require("@heroicons/react/24/solid/CheckCircleIcon")),Ih=y(require("@heroicons/react/24/solid/XCircleIcon")),Mh=require("react"),$c=y(require("styled-components"));var Ce=require("react/jsx-runtime"),Wh=()=>{let{app:e,data:t}=A(),{closePrivyModal:r}=L(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=_h(o||null,e.fiatOnRamp.useSandbox);return(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(k,{title:"Fund account"},"header"),(0,Ce.jsx)(pC,{status:n,onClickCta:r}),(0,Ce.jsx)(q,{protectedByPrivy:!0})]})},dC=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"failed":return{title:"Something went wrong!",body:(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)("p",{children:["It looks like there was an issue with your payment. Please contact"," ",(0,Ce.jsx)("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),(0,Ce.jsx)("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};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:""}}},pC=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=(0,Mh.useMemo)(()=>dC(e),[e]);return(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)(yC,{children:[(0,Ce.jsx)(fC,{status:e}),(0,Ce.jsxs)(gt,{children:[(0,Ce.jsx)("h3",{children:r}),(0,Ce.jsx)(hC,{children:o})]})]}),n&&(0,Ce.jsx)(U,{onClick:t,children:n})]})},uC=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)",mC=e=>{switch(e){case"serviceFailure":case"failed":return Ih.default;case"completed":return Rh.default;case"waitingAuthorization":return()=>(0,Ce.jsx)(kh.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}},fC=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return(0,Ce.jsxs)("div",{style:{position:"relative"},children:[(0,Ce.jsx)(Lt,{color:o,style:{position:"absolute"}}),(0,Ce.jsx)(Cc,{color:o}),(0,Ce.jsx)(tl,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=mC(e),r=uC(e);return(0,Ce.jsx)("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&(0,Ce.jsx)(t,{width:"4rem",height:"4rem",color:r})})},hC=$c.default.p`
1590
1590
  font-size: 1rem;
1591
1591
  color: var(--privy-color-foreground-3);
1592
1592
  margin-bottom: 1rem;
1593
1593
  display: flex;
1594
1594
  flex-direction: column;
1595
1595
  gap: 1rem;
1596
- `,hC=$c.default.div`
1596
+ `,yC=$c.default.div`
1597
1597
  display: flex;
1598
1598
  flex-direction: column;
1599
1599
  align-items: center;
@@ -1601,7 +1601,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1601
1601
  margin-left: 1.75rem;
1602
1602
  margin-right: 1.75rem;
1603
1603
  padding: 2rem 0;
1604
- `;var Wh=y(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),Lh=y(require("styled-components"));var Jt=require("react/jsx-runtime"),Oh=()=>{let{closePrivyModal:e}=L();return(0,Jt.jsxs)(Jt.Fragment,{children:[(0,Jt.jsx)(k,{},"header"),(0,Jt.jsx)(yC,{children:(0,Jt.jsx)(Wh.default,{style:{width:32,height:32}})}),(0,Jt.jsx)($r,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),(0,Jt.jsx)(pr,{children:(0,Jt.jsx)(U,{onClick:()=>e(),children:"Close"})}),(0,Jt.jsx)(le,{}),(0,Jt.jsx)(q,{protectedByPrivy:!0})]})},yC=Lh.default.div`
1604
+ `;var Lh=y(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),Oh=y(require("styled-components"));var Jt=require("react/jsx-runtime"),Nh=()=>{let{closePrivyModal:e}=L();return(0,Jt.jsxs)(Jt.Fragment,{children:[(0,Jt.jsx)(k,{},"header"),(0,Jt.jsx)(gC,{children:(0,Jt.jsx)(Lh.default,{style:{width:32,height:32}})}),(0,Jt.jsx)($r,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),(0,Jt.jsx)(pr,{children:(0,Jt.jsx)(U,{onClick:()=>e(),children:"Close"})}),(0,Jt.jsx)(le,{}),(0,Jt.jsx)(q,{protectedByPrivy:!0})]})},gC=Oh.default.div`
1605
1605
  border-radius: 50%;
1606
1606
  height: 68px;
1607
1607
  width: 68px;
@@ -1611,7 +1611,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1611
1611
  background-color: var(--privy-color-accent);
1612
1612
  color: white;
1613
1613
  margin: 0 auto 24px auto;
1614
- `;var Fh=y(require("react-device-detect")),Uh=y(require("styled-components"));var ol=y(require("styled-components"));var jc=require("react/jsx-runtime"),Nh=({style:e,...t})=>(0,jc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:(0,jc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});var il=require("react/jsx-runtime"),Dh=ol.default.div`
1614
+ `;var Uh=y(require("react-device-detect")),Bh=y(require("styled-components"));var ol=y(require("styled-components"));var jc=require("react/jsx-runtime"),Dh=({style:e,...t})=>(0,jc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:(0,jc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});var il=require("react/jsx-runtime"),Fh=ol.default.div`
1615
1615
  display: flex;
1616
1616
  flex-direction: column;
1617
1617
  justify-content: flex-start;
@@ -1622,7 +1622,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1622
1622
  border-left: 2px solid var(--privy-color-foreground-4);
1623
1623
  height: 12px;
1624
1624
  }
1625
- `,nl=({children:e})=>(0,il.jsxs)(gC,{children:[(0,il.jsx)(Nh,{style:{width:"16px",height:"16px"}}),e]}),gC=ol.default.div`
1625
+ `,nl=({children:e})=>(0,il.jsxs)(vC,{children:[(0,il.jsx)(Dh,{style:{width:"16px",height:"16px"}}),e]}),vC=ol.default.div`
1626
1626
  display: flex;
1627
1627
  justify-content: flex-start;
1628
1628
  justify-items: center;
@@ -1640,15 +1640,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
1640
1640
  margin-bottom: auto;
1641
1641
  }
1642
1642
  }
1643
- `;var Ie=require("react/jsx-runtime"),vC=()=>(0,Ie.jsxs)(wC,{children:[(0,Ie.jsx)($i,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),(0,Ie.jsx)(kt,{children:(0,Ie.jsx)(Gr,{style:{width:"152px",height:"152px"}})}),(0,Ie.jsxs)(Dh,{children:[(0,Ie.jsx)(nl,{children:(0,Ie.jsxs)("div",{children:[(0,Ie.jsx)("span",{children:"Install the "}),(0,Ie.jsx)("a",{href:Fh.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),(0,Ie.jsx)(Kc,{}),(0,Ie.jsx)(nl,{children:"Set up your first wallet"}),(0,Ie.jsx)(Kc,{}),(0,Ie.jsx)(nl,{children:"Store your recovery phrase in a safe place!"})]}),(0,Ie.jsx)(Ms,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Bh=()=>{let{navigateBack:e}=A();return(0,Ie.jsxs)(Ie.Fragment,{children:[(0,Ie.jsx)(k,{backFn:e},"header"),(0,Ie.jsx)(X,{}),(0,Ie.jsx)(vC,{}),(0,Ie.jsx)(le,{}),(0,Ie.jsxs)(ie,{children:[(0,Ie.jsx)("span",{children:"Still not sure? "}),(0,Ie.jsx)("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},wC=(0,Uh.default)(kt)`
1643
+ `;var Ie=require("react/jsx-runtime"),wC=()=>(0,Ie.jsxs)(CC,{children:[(0,Ie.jsx)($i,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),(0,Ie.jsx)(kt,{children:(0,Ie.jsx)(Gr,{style:{width:"152px",height:"152px"}})}),(0,Ie.jsxs)(Fh,{children:[(0,Ie.jsx)(nl,{children:(0,Ie.jsxs)("div",{children:[(0,Ie.jsx)("span",{children:"Install the "}),(0,Ie.jsx)("a",{href:Uh.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),(0,Ie.jsx)(Kc,{}),(0,Ie.jsx)(nl,{children:"Set up your first wallet"}),(0,Ie.jsx)(Kc,{}),(0,Ie.jsx)(nl,{children:"Store your recovery phrase in a safe place!"})]}),(0,Ie.jsx)(Ms,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Hh=()=>{let{navigateBack:e}=A();return(0,Ie.jsxs)(Ie.Fragment,{children:[(0,Ie.jsx)(k,{backFn:e},"header"),(0,Ie.jsx)(X,{}),(0,Ie.jsx)(wC,{}),(0,Ie.jsx)(le,{}),(0,Ie.jsxs)(ie,{children:[(0,Ie.jsx)("span",{children:"Still not sure? "}),(0,Ie.jsx)("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},CC=(0,Bh.default)(kt)`
1644
1644
  gap: 30px;
1645
1645
 
1646
1646
  > :first-child > svg {
1647
1647
  margin-top: 20px;
1648
1648
  }
1649
- `;var ey=y(require("@heroicons/react/24/outline/UserCircleIcon")),ca=require("react"),ty=require("react-device-detect"),ry=y(require("styled-components"));var Gh=y(require("@heroicons/react/24/outline/EnvelopeIcon")),Vh=require("react");var Hh=y(require("@heroicons/react/24/outline/EnvelopeIcon")),oa=require("react"),Yc=y(require("styled-components"));var Mr=require("react/jsx-runtime"),al=(0,oa.forwardRef)((e,t)=>{let[r,o]=(0,oa.useState)(""),[n,a]=(0,oa.useState)(!1),{authenticated:i}=V(),{initLoginWithEmail:l}=L(),{navigate:s,setModalData:d,currentScreen:u}=A(),{enabled:v,token:h}=_e(),w=Ba(r),T=n,C=n||!w,S=x=>{a(!0),l(r,x).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(I=>{d({errorModalData:{error:I,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{a(!1)})},b=()=>{v&&!h&&!i?(d({captchaModalData:{callback:x=>l(r,x),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):S(h)};return(0,Mr.jsxs)(Mr.Fragment,{children:[(0,Mr.jsx)(CC,{children:(0,Mr.jsxs)(bC,{stacked:e.stacked,children:[(0,Mr.jsx)(Hh.default,{}),(0,Mr.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:x=>o(x.target.value),onKeyUp:x=>{x.key==="Enter"&&b()},value:r,autoComplete:"email"}),e.stacked?null:(0,Mr.jsx)(qn,{isSubmitting:T,onClick:b,disabled:C,children:"Submit"})]})}),e.stacked?(0,Mr.jsx)(U,{loadingText:null,loading:T,disabled:C,onClick:b,children:"Submit"}):null]})}),CC=Yc.default.div`
1649
+ `;var ty=y(require("@heroicons/react/24/outline/UserCircleIcon")),ca=require("react"),ry=require("react-device-detect"),oy=y(require("styled-components"));var Vh=y(require("@heroicons/react/24/outline/EnvelopeIcon")),zh=require("react");var Gh=y(require("@heroicons/react/24/outline/EnvelopeIcon")),oa=require("react"),Yc=y(require("styled-components"));var Mr=require("react/jsx-runtime"),al=(0,oa.forwardRef)((e,t)=>{let[r,o]=(0,oa.useState)(""),[n,a]=(0,oa.useState)(!1),{authenticated:i}=V(),{initLoginWithEmail:l}=L(),{navigate:s,setModalData:d,currentScreen:u}=A(),{enabled:v,token:h}=_e(),w=Ba(r),T=n,C=n||!w,S=x=>{a(!0),l(r,x).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(I=>{d({errorModalData:{error:I,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{a(!1)})},b=()=>{v&&!h&&!i?(d({captchaModalData:{callback:x=>l(r,x),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):S(h)};return(0,Mr.jsxs)(Mr.Fragment,{children:[(0,Mr.jsx)(bC,{children:(0,Mr.jsxs)(EC,{stacked:e.stacked,children:[(0,Mr.jsx)(Gh.default,{}),(0,Mr.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:x=>o(x.target.value),onKeyUp:x=>{x.key==="Enter"&&b()},value:r,autoComplete:"email"}),e.stacked?null:(0,Mr.jsx)(qn,{isSubmitting:T,onClick:b,disabled:C,children:"Submit"})]})}),e.stacked?(0,Mr.jsx)(U,{loadingText:null,loading:T,disabled:C,onClick:b,children:"Submit"}):null]})}),bC=Yc.default.div`
1650
1650
  width: 100%;
1651
- `,bC=Yc.default.label`
1651
+ `,EC=Yc.default.label`
1652
1652
  display: block;
1653
1653
  position: relative;
1654
1654
  width: 100%;
@@ -1709,9 +1709,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1709
1709
  && > input::placeholder {
1710
1710
  color: var(--privy-color-foreground-3);
1711
1711
  }
1712
- `;var Jr=require("react/jsx-runtime"),sl=({isEditable:e,setIsEditable:t})=>{let r=(0,Vh.useRef)(null);return(0,Jr.jsxs)(Jr.Fragment,{children:[(0,Jr.jsx)(uo,{if:!e,children:(0,Jr.jsx)(al,{ref:r})}),(0,Jr.jsx)(uo,{if:e,children:(0,Jr.jsxs)(He,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,Jr.jsx)(Gh.default,{})," Continue with Email"]})})]})};var zh=require("react");var fi=require("react/jsx-runtime"),ll=()=>{let[e,t]=(0,zh.useState)(!1),{currentScreen:r,navigate:o,setModalData:n}=A(),{enabled:a,token:i}=_e(),{initLoginWithFarcaster:l}=L();return(0,fi.jsxs)(He,{onClick:async()=>{t(!0);try{a&&!i?(n({captchaModalData:{callback:d=>l(d),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(i),o("AWAITING_FARCASTER_CONNECTION"))}catch(d){n({errorModalData:{error:d,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[(0,fi.jsx)(Yr,{})," Farcaster",e&&(0,fi.jsx)("span",{children:(0,fi.jsx)(an,{})})]})};var Jh=y(require("@heroicons/react/24/outline/PhoneIcon")),Zh=require("react");var hi=require("react"),Jc=y(require("styled-components"));var qh=y(require("libphonenumber-js/examples.mobile.json")),Zt=require("libphonenumber-js/min"),dl=require("react/jsx-runtime");var na=(e,t)=>(0,Zt.isPossiblePhoneNumber)(String(e),t),cl=(e,t)=>`+${(0,Zt.getCountryCallingCode)(t)} ${e}`,$h=e=>`*${e.replaceAll("-","").slice(-4)}`,jh=e=>new Zt.AsYouType(e),EC=(0,Zt.getCountries)().map(e=>({code:e,callCode:(0,Zt.getCountryCallingCode)(e)})),Kh=e=>{let t=(0,Zt.getExampleNumber)(e,qh.default)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},Yh=({value:e,onChange:t})=>(0,dl.jsx)("select",{value:e,onChange:t,children:EC.map(r=>(0,dl.jsxs)("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});var Wr=require("react/jsx-runtime"),yi=(0,hi.forwardRef)((e,t)=>{let{app:r}=A(),[o,n]=(0,hi.useState)(""),[a,i]=(0,hi.useState)(r?.intl.defaultCountry??"US"),l=na(o,a),s=jh(a),d=Kh(a),u=(0,Zt.getCountryCallingCode)(a),v=!l,[h,w]=(0,hi.useState)(!1),T=u.length,C=x=>{let I=x.target.value;i(I),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:cl(o,I),countryCode:I,isValid:na(o,a)})},S=x=>{try{let I=x.replace(/\D/g,""),W=o.replace(/\D/g,""),R=I===W?x:s.input(x);n(R),e.onChange&&e.onChange({rawPhoneNumber:R,qualifiedPhoneNumber:cl(x,a),countryCode:a,isValid:na(x,a)})}catch(I){console.error("Error processing phone number:",I)}},b=()=>{w(!0);let x=cl(o,a);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:x,countryCode:a,isValid:na(o,a)}).finally(()=>w(!1))};return(0,Wr.jsxs)(Wr.Fragment,{children:[(0,Wr.jsx)(TC,{children:(0,Wr.jsxs)(PC,{callingCodeLength:T,stacked:e.stacked,children:[(0,Wr.jsx)(Yh,{value:a,onChange:C}),(0,Wr.jsx)("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:d,onChange:x=>{S(x.target.value)},onKeyUp:x=>{x.key==="Enter"&&b()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?(0,Wr.jsx)(qn,{isSubmitting:h,onClick:b,disabled:v,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?(0,Wr.jsx)(U,{loading:h,loadingText:null,onClick:b,disabled:v,children:"Submit"}):null]})}),TC=Jc.default.div`
1712
+ `;var Jr=require("react/jsx-runtime"),sl=({isEditable:e,setIsEditable:t})=>{let r=(0,zh.useRef)(null);return(0,Jr.jsxs)(Jr.Fragment,{children:[(0,Jr.jsx)(uo,{if:!e,children:(0,Jr.jsx)(al,{ref:r})}),(0,Jr.jsx)(uo,{if:e,children:(0,Jr.jsxs)(He,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,Jr.jsx)(Vh.default,{})," Continue with Email"]})})]})};var qh=require("react");var fi=require("react/jsx-runtime"),ll=()=>{let[e,t]=(0,qh.useState)(!1),{currentScreen:r,navigate:o,setModalData:n}=A(),{enabled:a,token:i}=_e(),{initLoginWithFarcaster:l}=L();return(0,fi.jsxs)(He,{onClick:async()=>{t(!0);try{a&&!i?(n({captchaModalData:{callback:d=>l(d),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(i),o("AWAITING_FARCASTER_CONNECTION"))}catch(d){n({errorModalData:{error:d,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[(0,fi.jsx)(Yr,{})," Farcaster",e&&(0,fi.jsx)("span",{children:(0,fi.jsx)(an,{})})]})};var Zh=y(require("@heroicons/react/24/outline/PhoneIcon")),Qh=require("react");var hi=require("react"),Jc=y(require("styled-components"));var $h=y(require("libphonenumber-js/examples.mobile.json")),Zt=require("libphonenumber-js/min"),dl=require("react/jsx-runtime");var na=(e,t)=>(0,Zt.isPossiblePhoneNumber)(String(e),t),cl=(e,t)=>`+${(0,Zt.getCountryCallingCode)(t)} ${e}`,jh=e=>`*${e.replaceAll("-","").slice(-4)}`,Kh=e=>new Zt.AsYouType(e),TC=(0,Zt.getCountries)().map(e=>({code:e,callCode:(0,Zt.getCountryCallingCode)(e)})),Yh=e=>{let t=(0,Zt.getExampleNumber)(e,$h.default)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},Jh=({value:e,onChange:t})=>(0,dl.jsx)("select",{value:e,onChange:t,children:TC.map(r=>(0,dl.jsxs)("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});var Wr=require("react/jsx-runtime"),yi=(0,hi.forwardRef)((e,t)=>{let{app:r}=A(),[o,n]=(0,hi.useState)(""),[a,i]=(0,hi.useState)(r?.intl.defaultCountry??"US"),l=na(o,a),s=Kh(a),d=Yh(a),u=(0,Zt.getCountryCallingCode)(a),v=!l,[h,w]=(0,hi.useState)(!1),T=u.length,C=x=>{let I=x.target.value;i(I),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:cl(o,I),countryCode:I,isValid:na(o,a)})},S=x=>{try{let I=x.replace(/\D/g,""),W=o.replace(/\D/g,""),R=I===W?x:s.input(x);n(R),e.onChange&&e.onChange({rawPhoneNumber:R,qualifiedPhoneNumber:cl(x,a),countryCode:a,isValid:na(x,a)})}catch(I){console.error("Error processing phone number:",I)}},b=()=>{w(!0);let x=cl(o,a);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:x,countryCode:a,isValid:na(o,a)}).finally(()=>w(!1))};return(0,Wr.jsxs)(Wr.Fragment,{children:[(0,Wr.jsx)(PC,{children:(0,Wr.jsxs)(xC,{callingCodeLength:T,stacked:e.stacked,children:[(0,Wr.jsx)(Jh,{value:a,onChange:C}),(0,Wr.jsx)("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:d,onChange:x=>{S(x.target.value)},onKeyUp:x=>{x.key==="Enter"&&b()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?(0,Wr.jsx)(qn,{isSubmitting:h,onClick:b,disabled:v,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?(0,Wr.jsx)(U,{loading:h,loadingText:null,onClick:b,disabled:v,children:"Submit"}):null]})}),PC=Jc.default.div`
1713
1713
  width: 100%;
1714
- `,PC=Jc.default.label`
1714
+ `,xC=Jc.default.label`
1715
1715
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
1716
1716
  --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
1717
1717
  display: block;
@@ -1800,11 +1800,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1800
1800
  && > input::placeholder {
1801
1801
  color: var(--privy-color-foreground-3);
1802
1802
  }
1803
- `;var Zr=require("react/jsx-runtime"),pl=({isEditable:e,setIsEditable:t})=>{let r=(0,Zh.useRef)(null),{authenticated:o}=V(),{navigate:n,setModalData:a,currentScreen:i}=A(),{initLoginWithSms:l}=L(),{enabled:s,token:d}=_e();async function u({qualifiedPhoneNumber:v}){if(s&&!d&&!o)a({captchaModalData:{callback:h=>l(v,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(v,d),n("AWAITING_PASSWORDLESS_CODE")}catch(h){a({errorModalData:{error:h,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return(0,Zr.jsxs)(Zr.Fragment,{children:[(0,Zr.jsx)(uo,{if:!e,children:(0,Zr.jsx)(yi,{ref:r,onSubmit:u})}),(0,Zr.jsx)(uo,{if:e,children:(0,Zr.jsxs)(He,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,Zr.jsx)(Jh.default,{})," Continue with SMS"]})})]})};var Qh=require("react");var ia=require("react/jsx-runtime"),ul=({style:e,...t})=>(0,ia.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[(0,ia.jsx)("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),(0,ia.jsx)("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});var qo=require("react/jsx-runtime"),ml=({style:e,...t})=>(0,qo.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[(0,qo.jsx)("g",{clipPath:"url(#clip0)",children:(0,qo.jsx)("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),(0,qo.jsx)("defs",{children:(0,qo.jsx)("clipPath",{id:"clip0",children:(0,qo.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var Zc=require("react/jsx-runtime"),fl=({style:e,...t})=>(0,Zc.jsx)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:(0,Zc.jsx)("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"#171515"})});var hn=require("react/jsx-runtime"),hl=({style:e,...t})=>(0,hn.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[(0,hn.jsx)("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),(0,hn.jsx)("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),(0,hn.jsx)("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),(0,hn.jsx)("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});var aa=require("react/jsx-runtime");function yl({style:e,...t}){return(0,aa.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:(0,aa.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,aa.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,aa.jsx)("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}var sa=require("react/jsx-runtime");function gl(e){return(0,sa.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[(0,sa.jsx)("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),(0,sa.jsx)("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}var gi=require("react/jsx-runtime");function vl(e){return(0,gi.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[(0,gi.jsx)("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),(0,gi.jsx)("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),(0,gi.jsx)("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}var Qc=require("react/jsx-runtime"),wl=({style:e,...t})=>(0,Qc.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:(0,Qc.jsx)("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"#000000"})});var Lr=require("react/jsx-runtime"),xC={apple:{logo:(0,Lr.jsx)(ul,{}),displayName:"Apple"},discord:{logo:(0,Lr.jsx)(ml,{}),displayName:"Discord"},github:{logo:(0,Lr.jsx)(fl,{}),displayName:"GitHub"},google:{logo:(0,Lr.jsx)(hl,{}),displayName:"Google"},linkedin:{logo:(0,Lr.jsx)(yl,{}),displayName:"LinkedIn"},spotify:{logo:(0,Lr.jsx)(gl,{}),displayName:"Spotify"},twitter:{logo:(0,Lr.jsx)(wl,{}),displayName:"Twitter"},tiktok:{logo:(0,Lr.jsx)(vl,{}),displayName:"TikTok"}},lt=({provider:e})=>{let{enabled:t,token:r}=_e(),{navigate:o,setModalData:n}=A(),[a,i]=(0,Qh.useState)(!1),{initLoginWithOAuth:l}=L(),{displayName:s,logo:d}=xC[e];return(0,Lr.jsxs)(He,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:v=>l(e,v),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[d," ",s]})};var Xh=y(require("@heroicons/react/24/outline/ChevronRightIcon"));var la=require("react/jsx-runtime"),Cl=({onClick:e,text:t,icon:r})=>(0,la.jsxs)(He,{onClick:e,children:[r,(0,la.jsx)(Ls,{children:t}),(0,la.jsx)(Xh.default,{})]});var xe=require("react/jsx-runtime"),El=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=L(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],[s,d]=(0,ca.useState)("default"),[u,v]=(0,ca.useState)("email");(0,ca.useEffect)(()=>{let R=l.indexOf("sms"),H=l.indexOf("email");R>-1&&R<H&&v("sms")},[a,i]);let h=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{d("default")},150)};n.current=h;let w=R=>R==="email"?(0,xe.jsx)(sl,{isEditable:u==="email",setIsEditable:()=>{v("email")}},R):R==="sms"?(0,xe.jsx)(pl,{isEditable:u==="sms",setIsEditable:()=>{v("sms")}},R):R==="apple"?(0,xe.jsx)(lt,{provider:"apple"},R):R==="discord"?(0,xe.jsx)(lt,{provider:"discord"},R):R==="farcaster"?(0,xe.jsx)(ll,{},R):R==="github"?(0,xe.jsx)(lt,{provider:"github"},R):R==="google"?(0,xe.jsx)(lt,{provider:"google"},R):R==="linkedin"?(0,xe.jsx)(lt,{provider:"linkedin"},R):R==="tiktok"?(0,xe.jsx)(lt,{provider:"tiktok"},R):R==="twitter"&&(!ty.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)?(0,xe.jsx)(lt,{provider:"twitter"},R):ji([R],r,e,l),T=a.map(w).flat(),C=i.map(w).flat(),S=[...T,...C],b=SC({primary:T.length,overflow:C.length}),[x,I]=_p(S,b);return(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(k,{title:"Log in or sign up",onClose:h,backFn:s==="default"?void 0:()=>{d("default")}}),s==="default"&&(0,xe.jsx)(_C,{}),(0,xe.jsx)(Os,{style:{overflow:"hidden",padding:2},children:(0,xe.jsxs)(dr,{children:[s==="default"&&(0,xe.jsxs)(xe.Fragment,{children:[...x,I.length>0&&(0,xe.jsx)(Cl,{text:"More options",icon:(0,xe.jsx)(ey.default,{}),onClick:()=>d("overflow")})]}),s==="overflow"&&(0,xe.jsxs)(xe.Fragment,{children:[...I]})]})}),o&&(0,xe.jsx)($n,{app:o}),(0,xe.jsx)(q,{protectedByPrivy:!0})]})},bl=5,SC=({primary:e,overflow:t})=>e<bl?e:e===bl&&t===0?bl:bl-1,_C=(0,ry.default)(Zn)`
1803
+ `;var Zr=require("react/jsx-runtime"),pl=({isEditable:e,setIsEditable:t})=>{let r=(0,Qh.useRef)(null),{authenticated:o}=V(),{navigate:n,setModalData:a,currentScreen:i}=A(),{initLoginWithSms:l}=L(),{enabled:s,token:d}=_e();async function u({qualifiedPhoneNumber:v}){if(s&&!d&&!o)a({captchaModalData:{callback:h=>l(v,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(v,d),n("AWAITING_PASSWORDLESS_CODE")}catch(h){a({errorModalData:{error:h,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return(0,Zr.jsxs)(Zr.Fragment,{children:[(0,Zr.jsx)(uo,{if:!e,children:(0,Zr.jsx)(yi,{ref:r,onSubmit:u})}),(0,Zr.jsx)(uo,{if:e,children:(0,Zr.jsxs)(He,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,Zr.jsx)(Zh.default,{})," Continue with SMS"]})})]})};var Xh=require("react");var ia=require("react/jsx-runtime"),ul=({style:e,...t})=>(0,ia.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[(0,ia.jsx)("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),(0,ia.jsx)("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});var qo=require("react/jsx-runtime"),ml=({style:e,...t})=>(0,qo.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[(0,qo.jsx)("g",{clipPath:"url(#clip0)",children:(0,qo.jsx)("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),(0,qo.jsx)("defs",{children:(0,qo.jsx)("clipPath",{id:"clip0",children:(0,qo.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var Zc=require("react/jsx-runtime"),fl=({style:e,...t})=>(0,Zc.jsx)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:(0,Zc.jsx)("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"#171515"})});var hn=require("react/jsx-runtime"),hl=({style:e,...t})=>(0,hn.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[(0,hn.jsx)("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),(0,hn.jsx)("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),(0,hn.jsx)("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),(0,hn.jsx)("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});var aa=require("react/jsx-runtime");function yl({style:e,...t}){return(0,aa.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:(0,aa.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,aa.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,aa.jsx)("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}var sa=require("react/jsx-runtime");function gl(e){return(0,sa.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[(0,sa.jsx)("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),(0,sa.jsx)("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}var gi=require("react/jsx-runtime");function vl(e){return(0,gi.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[(0,gi.jsx)("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),(0,gi.jsx)("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),(0,gi.jsx)("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}var Qc=require("react/jsx-runtime"),wl=({style:e,...t})=>(0,Qc.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:(0,Qc.jsx)("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"#000000"})});var Lr=require("react/jsx-runtime"),SC={apple:{logo:(0,Lr.jsx)(ul,{}),displayName:"Apple"},discord:{logo:(0,Lr.jsx)(ml,{}),displayName:"Discord"},github:{logo:(0,Lr.jsx)(fl,{}),displayName:"GitHub"},google:{logo:(0,Lr.jsx)(hl,{}),displayName:"Google"},linkedin:{logo:(0,Lr.jsx)(yl,{}),displayName:"LinkedIn"},spotify:{logo:(0,Lr.jsx)(gl,{}),displayName:"Spotify"},twitter:{logo:(0,Lr.jsx)(wl,{}),displayName:"Twitter"},tiktok:{logo:(0,Lr.jsx)(vl,{}),displayName:"TikTok"}},lt=({provider:e})=>{let{enabled:t,token:r}=_e(),{navigate:o,setModalData:n}=A(),[a,i]=(0,Xh.useState)(!1),{initLoginWithOAuth:l}=L(),{displayName:s,logo:d}=SC[e];return(0,Lr.jsxs)(He,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:v=>l(e,v),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[d," ",s]})};var ey=y(require("@heroicons/react/24/outline/ChevronRightIcon"));var la=require("react/jsx-runtime"),Cl=({onClick:e,text:t,icon:r})=>(0,la.jsxs)(He,{onClick:e,children:[r,(0,la.jsx)(Ls,{children:t}),(0,la.jsx)(ey.default,{})]});var xe=require("react/jsx-runtime"),El=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=L(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],[s,d]=(0,ca.useState)("default"),[u,v]=(0,ca.useState)("email");(0,ca.useEffect)(()=>{let R=l.indexOf("sms"),H=l.indexOf("email");R>-1&&R<H&&v("sms")},[a,i]);let h=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{d("default")},150)};n.current=h;let w=R=>R==="email"?(0,xe.jsx)(sl,{isEditable:u==="email",setIsEditable:()=>{v("email")}},R):R==="sms"?(0,xe.jsx)(pl,{isEditable:u==="sms",setIsEditable:()=>{v("sms")}},R):R==="apple"?(0,xe.jsx)(lt,{provider:"apple"},R):R==="discord"?(0,xe.jsx)(lt,{provider:"discord"},R):R==="farcaster"?(0,xe.jsx)(ll,{},R):R==="github"?(0,xe.jsx)(lt,{provider:"github"},R):R==="google"?(0,xe.jsx)(lt,{provider:"google"},R):R==="linkedin"?(0,xe.jsx)(lt,{provider:"linkedin"},R):R==="tiktok"?(0,xe.jsx)(lt,{provider:"tiktok"},R):R==="twitter"&&(!ry.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)?(0,xe.jsx)(lt,{provider:"twitter"},R):ji([R],r,e,l),T=a.map(w).flat(),C=i.map(w).flat(),S=[...T,...C],b=_C({primary:T.length,overflow:C.length}),[x,I]=_p(S,b);return(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(k,{title:"Log in or sign up",onClose:h,backFn:s==="default"?void 0:()=>{d("default")}}),s==="default"&&(0,xe.jsx)(AC,{}),(0,xe.jsx)(Os,{style:{overflow:"hidden",padding:2},children:(0,xe.jsxs)(dr,{children:[s==="default"&&(0,xe.jsxs)(xe.Fragment,{children:[...x,I.length>0&&(0,xe.jsx)(Cl,{text:"More options",icon:(0,xe.jsx)(ty.default,{}),onClick:()=>d("overflow")})]}),s==="overflow"&&(0,xe.jsxs)(xe.Fragment,{children:[...I]})]})}),o&&(0,xe.jsx)($n,{app:o}),(0,xe.jsx)(q,{protectedByPrivy:!0})]})},bl=5,_C=({primary:e,overflow:t})=>e<bl?e:e===bl&&t===0?bl:bl-1,AC=(0,oy.default)(Zn)`
1804
1804
  margin-bottom: 16px;
1805
- `;var sy=y(require("@heroicons/react/24/outline/EnvelopeIcon")),ly=y(require("@heroicons/react/24/outline/PhoneIcon")),cy=y(require("@heroicons/react/24/outline/UserCircleIcon")),da=require("react"),dy=require("react-device-detect"),py=y(require("styled-components"));var wo=require("react/jsx-runtime"),oy=({...e})=>(0,wo.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,wo.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,wo.jsx)("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,wo.jsx)("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,wo.jsx)("defs",{children:(0,wo.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,wo.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var ny=y(require("@heroicons/react/24/outline/ChevronRightIcon")),iy=y(require("@heroicons/react/24/outline/WalletIcon"));var vi=require("react/jsx-runtime"),ay=({onClick:e,text:t})=>(0,vi.jsxs)(He,{onClick:e,children:[(0,vi.jsx)(iy.default,{}),(0,vi.jsx)(Ls,{children:t}),(0,vi.jsx)(ny.default,{})]});var ce=require("react/jsx-runtime"),Tl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=L(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{email:a,sms:i,google:l,twitter:s,discord:d,github:u,spotify:v,tiktok:h,linkedin:w,apple:T,wallet:C,farcaster:S}=o?.loginMethods??{},b=o?.appearance.loginGroupPriority||"web2-first",x=o?.appearance.hideDirectWeb2Inputs,[I,W]=(0,da.useState)("default"),[R,H]=(0,da.useState)(a?"email":"sms");(0,da.useEffect)(()=>{H(a?"email":"sms")},[a]);let B=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{W("default")},150)};n.current=B;let G=[a&&(0,ce.jsx)(sl,{isEditable:R==="email",setIsEditable:()=>{H("email")}}),i&&(0,ce.jsx)(pl,{isEditable:R==="sms",setIsEditable:()=>{H("sms")}})].filter(Boolean),P=[l&&(0,ce.jsx)(lt,{provider:"google"}),s&&(!dy.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)&&(0,ce.jsx)(lt,{provider:"twitter"}),d&&(0,ce.jsx)(lt,{provider:"discord"}),u&&(0,ce.jsx)(lt,{provider:"github"}),v&&(0,ce.jsx)(lt,{provider:"spotify"}),h&&(0,ce.jsx)(lt,{provider:"tiktok"}),w&&(0,ce.jsx)(lt,{provider:"linkedin"}),T&&(0,ce.jsx)(lt,{provider:"apple"}),S&&(0,ce.jsx)(ll,{})].filter(Boolean),J=ji(o.appearance.walletList,r,e,o.appearance.walletList),N=I==="default"?void 0:()=>{W("default")},te=kC({priority:b,email:a,sms:i,social:P}),ue=RC({priority:b,email:a,sms:i,social:P}),se=IC({priority:b,email:a,sms:i,social:P}),ae=(0,ce.jsx)(ay,{text:se,onClick:()=>W("web3-overflow")}),j=(0,ce.jsx)(Cl,{text:te,icon:ue,onClick:()=>W("web2-overflow")}),Ue=x?0:1;return(0,ce.jsxs)(ce.Fragment,{children:[(0,ce.jsx)(k,{title:"Log in or sign up",onClose:B,backFn:N}),I==="default"&&(0,ce.jsx)(AC,{}),(0,ce.jsx)(Os,{style:{overflow:"hidden",padding:2},children:(0,ce.jsxs)(dr,{children:[I==="default"&&b==="web2-first"&&(0,ce.jsxs)(ce.Fragment,{children:[...G,...P.length+G.length>4?P.slice(0,3-G.length):P,G.length+P.length>4&&j,C&&ae]}),I==="default"&&b==="web3-first"&&(0,ce.jsxs)(ce.Fragment,{children:[C&&(0,ce.jsxs)(ce.Fragment,{children:[...J.length>4?J.slice(0,3):J,J.length>4&&ae]}),G.length+P.length>Ue&&j,G.length+P.length===Ue&&G.length?G[0]:null,G.length+P.length===Ue&&P.length?P[0]:null]}),I==="web2-overflow"&&(0,ce.jsxs)(ce.Fragment,{children:[...b==="web3-first"?G:[],...P]}),...I==="web3-overflow"?J:[]]})}),o&&(0,ce.jsx)($n,{app:o}),(0,ce.jsx)(q,{protectedByPrivy:!0})]})},AC=(0,py.default)(Zn)`
1805
+ `;var ly=y(require("@heroicons/react/24/outline/EnvelopeIcon")),cy=y(require("@heroicons/react/24/outline/PhoneIcon")),dy=y(require("@heroicons/react/24/outline/UserCircleIcon")),da=require("react"),py=require("react-device-detect"),uy=y(require("styled-components"));var wo=require("react/jsx-runtime"),ny=({...e})=>(0,wo.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,wo.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,wo.jsx)("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,wo.jsx)("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,wo.jsx)("defs",{children:(0,wo.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,wo.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var iy=y(require("@heroicons/react/24/outline/ChevronRightIcon")),ay=y(require("@heroicons/react/24/outline/WalletIcon"));var vi=require("react/jsx-runtime"),sy=({onClick:e,text:t})=>(0,vi.jsxs)(He,{onClick:e,children:[(0,vi.jsx)(ay.default,{}),(0,vi.jsx)(Ls,{children:t}),(0,vi.jsx)(iy.default,{})]});var ce=require("react/jsx-runtime"),Tl=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=L(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{email:a,sms:i,google:l,twitter:s,discord:d,github:u,spotify:v,tiktok:h,linkedin:w,apple:T,wallet:C,farcaster:S}=o?.loginMethods??{},b=o?.appearance.loginGroupPriority||"web2-first",x=o?.appearance.hideDirectWeb2Inputs,[I,W]=(0,da.useState)("default"),[R,H]=(0,da.useState)(a?"email":"sms");(0,da.useEffect)(()=>{H(a?"email":"sms")},[a]);let B=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{W("default")},150)};n.current=B;let G=[a&&(0,ce.jsx)(sl,{isEditable:R==="email",setIsEditable:()=>{H("email")}}),i&&(0,ce.jsx)(pl,{isEditable:R==="sms",setIsEditable:()=>{H("sms")}})].filter(Boolean),P=[l&&(0,ce.jsx)(lt,{provider:"google"}),s&&(!py.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)&&(0,ce.jsx)(lt,{provider:"twitter"}),d&&(0,ce.jsx)(lt,{provider:"discord"}),u&&(0,ce.jsx)(lt,{provider:"github"}),v&&(0,ce.jsx)(lt,{provider:"spotify"}),h&&(0,ce.jsx)(lt,{provider:"tiktok"}),w&&(0,ce.jsx)(lt,{provider:"linkedin"}),T&&(0,ce.jsx)(lt,{provider:"apple"}),S&&(0,ce.jsx)(ll,{})].filter(Boolean),J=ji(o.appearance.walletList,r,e,o.appearance.walletList),N=I==="default"?void 0:()=>{W("default")},te=RC({priority:b,email:a,sms:i,social:P}),ue=IC({priority:b,email:a,sms:i,social:P}),se=MC({priority:b,email:a,sms:i,social:P}),ae=(0,ce.jsx)(sy,{text:se,onClick:()=>W("web3-overflow")}),j=(0,ce.jsx)(Cl,{text:te,icon:ue,onClick:()=>W("web2-overflow")}),Ue=x?0:1;return(0,ce.jsxs)(ce.Fragment,{children:[(0,ce.jsx)(k,{title:"Log in or sign up",onClose:B,backFn:N}),I==="default"&&(0,ce.jsx)(kC,{}),(0,ce.jsx)(Os,{style:{overflow:"hidden",padding:2},children:(0,ce.jsxs)(dr,{children:[I==="default"&&b==="web2-first"&&(0,ce.jsxs)(ce.Fragment,{children:[...G,...P.length+G.length>4?P.slice(0,3-G.length):P,G.length+P.length>4&&j,C&&ae]}),I==="default"&&b==="web3-first"&&(0,ce.jsxs)(ce.Fragment,{children:[C&&(0,ce.jsxs)(ce.Fragment,{children:[...J.length>4?J.slice(0,3):J,J.length>4&&ae]}),G.length+P.length>Ue&&j,G.length+P.length===Ue&&G.length?G[0]:null,G.length+P.length===Ue&&P.length?P[0]:null]}),I==="web2-overflow"&&(0,ce.jsxs)(ce.Fragment,{children:[...b==="web3-first"?G:[],...P]}),...I==="web3-overflow"?J:[]]})}),o&&(0,ce.jsx)($n,{app:o}),(0,ce.jsx)(q,{protectedByPrivy:!0})]})},kC=(0,uy.default)(Zn)`
1806
1806
  margin-bottom: 16px;
1807
- `,kC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",RC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?(0,ce.jsx)(cy.default,{}):t&&r?(0,ce.jsx)(oy,{}):t?(0,ce.jsx)(sy.default,{}):r?(0,ce.jsx)(ly.default,{}):null,IC=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var Xc=require("react/jsx-runtime"),uy=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,Xc.jsx)(El,{connectOnly:!0}):(0,Xc.jsx)(Tl,{connectOnly:!0})};var ed=require("react/jsx-runtime"),my=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,ed.jsx)(El,{connectOnly:!1}):(0,ed.jsx)(Tl,{connectOnly:!1})};var fy=y(require("@heroicons/react/24/outline/EnvelopeIcon"));var Qt=require("react/jsx-runtime"),hy=()=>{let{app:e}=A();return(0,Qt.jsxs)(Qt.Fragment,{children:[(0,Qt.jsx)(k,{},"header"),(0,Qt.jsx)(X,{}),(0,Qt.jsx)(Ge,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,Qt.jsx)(fy.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Qt.jsx)(pr,{children:(0,Qt.jsx)(al,{stacked:!0})}),(0,Qt.jsx)(le,{}),(0,Qt.jsx)(q,{protectedByPrivy:!0})]})};var yy=y(require("@heroicons/react/24/outline/PhoneIcon"));var Xt=require("react/jsx-runtime"),gy=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=A(),{initLoginWithSms:a}=L();async function i({qualifiedPhoneNumber:l}){try{await a(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return(0,Xt.jsxs)(Xt.Fragment,{children:[(0,Xt.jsx)(k,{},"header"),(0,Xt.jsx)(X,{}),(0,Xt.jsx)(Ge,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:(0,Xt.jsx)(yy.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),(0,Xt.jsx)(pr,{children:(0,Xt.jsx)(yi,{stacked:!0,onSubmit:i})}),(0,Xt.jsx)(le,{}),(0,Xt.jsx)(q,{protectedByPrivy:!0})]})};var Qr=require("react/jsx-runtime"),vy=()=>{let{linkingHint:e}=L(),{app:t}=A(),r=e?`Select the wallet with ${_o(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return(0,Qr.jsxs)(Qr.Fragment,{children:[(0,Qr.jsx)(k,{},"header"),(0,Qr.jsx)($r,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),(0,Qr.jsx)(dr,{children:(0,Qr.jsx)(Jn,{connectOnly:!1})}),(0,Qr.jsx)(q,{protectedByPrivy:!0})]})};var pa=require("react/jsx-runtime"),wy=({style:e,...t})=>(0,pa.jsxs)("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[(0,pa.jsx)("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),(0,pa.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});var Ut=require("react/jsx-runtime"),Cy=()=>{let{closePrivyModal:e}=L(),{navigate:t}=A();return(0,Ut.jsxs)(Ut.Fragment,{children:[(0,Ut.jsx)(k,{},"header"),(0,Ut.jsx)(X,{}),(0,Ut.jsx)(wy,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),(0,Ut.jsx)($r,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),(0,Ut.jsxs)(pr,{children:[(0,Ut.jsx)(U,{onClick:()=>t("LANDING"),children:"Try again"}),(0,Ut.jsx)(Pr,{onClick:()=>e(),children:"Cancel"})]}),(0,Ut.jsx)(le,{}),(0,Ut.jsx)(q,{protectedByPrivy:!0})]})};var od=y(require("@heroicons/react/20/solid/CheckIcon")),My=y(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),Wy=y(require("@heroicons/react/24/outline/FingerPrintIcon")),Ly=y(require("@heroicons/react/24/outline/PhoneIcon")),nd=y(require("@heroicons/react/24/outline/TrashIcon")),Oy=y(require("@heroicons/react/24/solid/CheckBadgeIcon")),id=y(require("@heroicons/react/24/solid/CheckCircleIcon")),ad=y(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Ny=y(require("@heroicons/react/24/solid/IdentificationIcon")),_l=y(require("@heroicons/react/24/solid/PhoneIcon")),Sl=y(require("@heroicons/react/24/solid/ShieldCheckIcon")),er=require("react");var xl=require("react"),Py=require("react-device-detect"),rd=y(require("styled-components"));var yn=require("@headlessui/react"),Pl=y(require("react")),gn=y(require("styled-components")),Co=require("react/jsx-runtime"),by=({children:e,open:t,onClick:r,...o})=>(0,Co.jsx)(yn.Transition,{show:t,as:Pl.default.Fragment,children:(0,Co.jsxs)(yn.Dialog,{onClose:r,...o,as:WC,children:[(0,Co.jsx)(yn.Transition.Child,{as:Pl.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,Co.jsx)(MC,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),(0,Co.jsx)(LC,{children:(0,Co.jsx)(yn.Transition.Child,{as:Pl.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,Co.jsx)(yn.Dialog.Panel,{as:OC,children:e})})})]})}),wi=gn.default.div`
1807
+ `,RC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",IC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?(0,ce.jsx)(dy.default,{}):t&&r?(0,ce.jsx)(ny,{}):t?(0,ce.jsx)(ly.default,{}):r?(0,ce.jsx)(cy.default,{}):null,MC=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var Xc=require("react/jsx-runtime"),my=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,Xc.jsx)(El,{connectOnly:!0}):(0,Xc.jsx)(Tl,{connectOnly:!0})};var ed=require("react/jsx-runtime"),fy=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,ed.jsx)(El,{connectOnly:!1}):(0,ed.jsx)(Tl,{connectOnly:!1})};var hy=y(require("@heroicons/react/24/outline/EnvelopeIcon"));var Qt=require("react/jsx-runtime"),yy=()=>{let{app:e}=A();return(0,Qt.jsxs)(Qt.Fragment,{children:[(0,Qt.jsx)(k,{},"header"),(0,Qt.jsx)(X,{}),(0,Qt.jsx)(Ge,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,Qt.jsx)(hy.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Qt.jsx)(pr,{children:(0,Qt.jsx)(al,{stacked:!0})}),(0,Qt.jsx)(le,{}),(0,Qt.jsx)(q,{protectedByPrivy:!0})]})};var gy=y(require("@heroicons/react/24/outline/PhoneIcon"));var Xt=require("react/jsx-runtime"),vy=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=A(),{initLoginWithSms:a}=L();async function i({qualifiedPhoneNumber:l}){try{await a(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return(0,Xt.jsxs)(Xt.Fragment,{children:[(0,Xt.jsx)(k,{},"header"),(0,Xt.jsx)(X,{}),(0,Xt.jsx)(Ge,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:(0,Xt.jsx)(gy.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),(0,Xt.jsx)(pr,{children:(0,Xt.jsx)(yi,{stacked:!0,onSubmit:i})}),(0,Xt.jsx)(le,{}),(0,Xt.jsx)(q,{protectedByPrivy:!0})]})};var Qr=require("react/jsx-runtime"),wy=()=>{let{linkingHint:e}=L(),{app:t}=A(),r=e?`Select the wallet with ${_o(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return(0,Qr.jsxs)(Qr.Fragment,{children:[(0,Qr.jsx)(k,{},"header"),(0,Qr.jsx)($r,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),(0,Qr.jsx)(dr,{children:(0,Qr.jsx)(Jn,{connectOnly:!1})}),(0,Qr.jsx)(q,{protectedByPrivy:!0})]})};var pa=require("react/jsx-runtime"),Cy=({style:e,...t})=>(0,pa.jsxs)("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[(0,pa.jsx)("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),(0,pa.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});var Ut=require("react/jsx-runtime"),by=()=>{let{closePrivyModal:e}=L(),{navigate:t}=A();return(0,Ut.jsxs)(Ut.Fragment,{children:[(0,Ut.jsx)(k,{},"header"),(0,Ut.jsx)(X,{}),(0,Ut.jsx)(Cy,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),(0,Ut.jsx)($r,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),(0,Ut.jsxs)(pr,{children:[(0,Ut.jsx)(U,{onClick:()=>t("LANDING"),children:"Try again"}),(0,Ut.jsx)(Pr,{onClick:()=>e(),children:"Cancel"})]}),(0,Ut.jsx)(le,{}),(0,Ut.jsx)(q,{protectedByPrivy:!0})]})};var od=y(require("@heroicons/react/20/solid/CheckIcon")),Wy=y(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),Ly=y(require("@heroicons/react/24/outline/FingerPrintIcon")),Oy=y(require("@heroicons/react/24/outline/PhoneIcon")),nd=y(require("@heroicons/react/24/outline/TrashIcon")),Ny=y(require("@heroicons/react/24/solid/CheckBadgeIcon")),id=y(require("@heroicons/react/24/solid/CheckCircleIcon")),ad=y(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Dy=y(require("@heroicons/react/24/solid/IdentificationIcon")),_l=y(require("@heroicons/react/24/solid/PhoneIcon")),Sl=y(require("@heroicons/react/24/solid/ShieldCheckIcon")),er=require("react");var xl=require("react"),xy=require("react-device-detect"),rd=y(require("styled-components"));var yn=require("@headlessui/react"),Pl=y(require("react")),gn=y(require("styled-components")),Co=require("react/jsx-runtime"),Ey=({children:e,open:t,onClick:r,...o})=>(0,Co.jsx)(yn.Transition,{show:t,as:Pl.default.Fragment,children:(0,Co.jsxs)(yn.Dialog,{onClose:r,...o,as:LC,children:[(0,Co.jsx)(yn.Transition.Child,{as:Pl.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,Co.jsx)(WC,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),(0,Co.jsx)(OC,{children:(0,Co.jsx)(yn.Transition.Child,{as:Pl.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,Co.jsx)(yn.Dialog.Panel,{as:NC,children:e})})})]})}),wi=gn.default.div`
1808
1808
  display: flex;
1809
1809
  flex-direction: column;
1810
1810
  text-align: center;
@@ -1827,7 +1827,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1827
1827
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
1828
1828
  border-radius: var(--privy-border-radius-lg);
1829
1829
  }
1830
- `,MC=gn.default.div`
1830
+ `,WC=gn.default.div`
1831
1831
  position: fixed;
1832
1832
  inset: 0;
1833
1833
 
@@ -1840,10 +1840,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
1840
1840
  backdrop-filter: unset;
1841
1841
  -webkit-backdrop-filter: unset;
1842
1842
  }
1843
- `,WC=gn.default.div`
1843
+ `,LC=gn.default.div`
1844
1844
  position: relative;
1845
1845
  z-index: 999999;
1846
- `,LC=gn.default.div`
1846
+ `,OC=gn.default.div`
1847
1847
  position: fixed;
1848
1848
  inset: 0;
1849
1849
  display: flex;
@@ -1851,7 +1851,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1851
1851
  justify-content: center;
1852
1852
  width: 100vw;
1853
1853
  min-height: 100vh;
1854
- `,OC=gn.default.div`
1854
+ `,NC=gn.default.div`
1855
1855
  // reset some default dialog styles
1856
1856
  padding: 0;
1857
1857
  background: transparent;
@@ -1898,13 +1898,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1898
1898
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
1899
1899
  border-radius: var(--privy-border-radius-lg);
1900
1900
  }
1901
- `,Ey=gn.default.div`
1901
+ `,Ty=gn.default.div`
1902
1902
  display: flex;
1903
1903
  flex-direction: column;
1904
1904
  align-items: center;
1905
1905
  justify-content: center;
1906
1906
  height: 100%;
1907
- `;var Xr=require("react/jsx-runtime"),ua=6,NC=new Array(ua).fill("");function DC(e){return e.replace(/\s+/g,"")}function td(e){return/^[0-9]{1}$/.test(e)}function Ty(e){return e.length===ua&&e.every(td)}function FC(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var Ci=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,a]=(0,xl.useState)(NC),[i,l]=(0,xl.useState)(null),[s,d]=(0,xl.useState)(null),u=async T=>{T.preventDefault();let C=DC(T.currentTarget.value);if(C==="")return;let S=FC(n,td),b=C.split(""),x=!b.every(td),I=b.length+S>ua;if(x){l("Passcode can only be numbers"),d(1);return}if(I){l("Passcode must be exactly 6 numbers"),d(1);return}l(null),d(null);let W=Number(T.currentTarget.name?.charAt(4)),R=[...C||[""]].slice(0,ua-W),H=[...n.slice(0,W),...R,...n.slice(W+R.length)];a(H);let B=R.length,G=Math.min(Math.max(W+B,0),ua-1);if(document.querySelector(`input[name=pin-${G}]`)?.focus(),Ty(H))try{await e(H.join("")),document.querySelector(`input[name=pin-${G}]`)?.blur()}catch(J){d(1),l(J.message)}else try{await e(null)}catch(J){d(1),l(J.message)}},v=T=>{s===1&&(l(null),d(null));let C=[...n.slice(0,T),"",...n.slice(T+1)];a(C),T>0&&document.querySelector(`input[name=pin-${T-1}]`)?.focus(),Ty(C)?e(C.join("")):e(null)},w=o?"success":!!(r||i)?"fail":"";return(0,Xr.jsx)(Xr.Fragment,{children:(0,Xr.jsxs)(UC,{children:[(0,Xr.jsx)("div",{children:n.map((T,C)=>(0,Xr.jsx)("input",{name:`pin-${C}`,type:"text",value:n[C],onChange:u,onKeyUp:S=>{S.key==="Backspace"&&v(C)},inputMode:"numeric",autoFocus:C===0,pattern:"[0-9]",className:w,autoComplete:Py.isMobile?"one-time-code":"off",disabled:t},C))}),(0,Xr.jsx)("div",{children:(0,Xr.jsx)(BC,{fail:!!r||!!i,children:r||i})})]})})},UC=rd.default.div`
1907
+ `;var Xr=require("react/jsx-runtime"),ua=6,DC=new Array(ua).fill("");function FC(e){return e.replace(/\s+/g,"")}function td(e){return/^[0-9]{1}$/.test(e)}function Py(e){return e.length===ua&&e.every(td)}function UC(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var Ci=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,a]=(0,xl.useState)(DC),[i,l]=(0,xl.useState)(null),[s,d]=(0,xl.useState)(null),u=async T=>{T.preventDefault();let C=FC(T.currentTarget.value);if(C==="")return;let S=UC(n,td),b=C.split(""),x=!b.every(td),I=b.length+S>ua;if(x){l("Passcode can only be numbers"),d(1);return}if(I){l("Passcode must be exactly 6 numbers"),d(1);return}l(null),d(null);let W=Number(T.currentTarget.name?.charAt(4)),R=[...C||[""]].slice(0,ua-W),H=[...n.slice(0,W),...R,...n.slice(W+R.length)];a(H);let B=R.length,G=Math.min(Math.max(W+B,0),ua-1);if(document.querySelector(`input[name=pin-${G}]`)?.focus(),Py(H))try{await e(H.join("")),document.querySelector(`input[name=pin-${G}]`)?.blur()}catch(J){d(1),l(J.message)}else try{await e(null)}catch(J){d(1),l(J.message)}},v=T=>{s===1&&(l(null),d(null));let C=[...n.slice(0,T),"",...n.slice(T+1)];a(C),T>0&&document.querySelector(`input[name=pin-${T-1}]`)?.focus(),Py(C)?e(C.join("")):e(null)},w=o?"success":!!(r||i)?"fail":"";return(0,Xr.jsx)(Xr.Fragment,{children:(0,Xr.jsxs)(BC,{children:[(0,Xr.jsx)("div",{children:n.map((T,C)=>(0,Xr.jsx)("input",{name:`pin-${C}`,type:"text",value:n[C],onChange:u,onKeyUp:S=>{S.key==="Backspace"&&v(C)},inputMode:"numeric",autoFocus:C===0,pattern:"[0-9]",className:w,autoComplete:xy.isMobile?"one-time-code":"off",disabled:t},C))}),(0,Xr.jsx)("div",{children:(0,Xr.jsx)(HC,{fail:!!r||!!i,children:r||i})})]})})},BC=rd.default.div`
1908
1908
  display: flex;
1909
1909
  flex-direction: column;
1910
1910
  width: 100%;
@@ -1975,7 +1975,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1975
1975
  transform: translate(1px, 0px);
1976
1976
  }
1977
1977
  }
1978
- `,BC=rd.default.div`
1978
+ `,HC=rd.default.div`
1979
1979
  line-height: 20px;
1980
1980
  font-size: 13px;
1981
1981
  display: flex;
@@ -1983,7 +1983,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1983
1983
  width: 100%;
1984
1984
 
1985
1985
  color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1986
- `;var xy=require("react");function vn(){let{promptMfa:e,init:t,submit:r,cancel:o}=(0,xy.useContext)(ye);return{promptMfa:e,init:t,submit:r,cancel:o}}var Sy=require("react");function bi(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenroll:n,enrollInMfa:a}=(0,Sy.useContext)(ye);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>a(!0),closeMfaEnrollmentModal:()=>a(!1)}}var _y=y(require("styled-components")),ma=require("react/jsx-runtime"),Ay=e=>(0,ma.jsxs)(HC,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[(0,ma.jsx)("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),(0,ma.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),HC=_y.default.svg`
1986
+ `;var Sy=require("react");function vn(){let{promptMfa:e,init:t,submit:r,cancel:o}=(0,Sy.useContext)(ye);return{promptMfa:e,init:t,submit:r,cancel:o}}var _y=require("react");function bi(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenroll:n,enrollInMfa:a}=(0,_y.useContext)(ye);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>a(!0),closeMfaEnrollmentModal:()=>a(!1)}}var Ay=y(require("styled-components")),ma=require("react/jsx-runtime"),ky=e=>(0,ma.jsxs)(GC,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[(0,ma.jsx)("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),(0,ma.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),GC=Ay.default.svg`
1987
1987
  height: 90px;
1988
1988
  width: 90px;
1989
1989
 
@@ -1994,7 +1994,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1994
1994
  > path {
1995
1995
  fill: white;
1996
1996
  }
1997
- `;var ky=y(require("@heroicons/react/24/solid/ShieldCheckIcon"));var Iy=require("react/jsx-runtime");var Ry=({size:e,authUrl:t})=>(0,Iy.jsx)(pi,{url:t,squareLogoElement:ky.default,size:e,fgColor:"#1F1F1F"});var m=require("react/jsx-runtime"),Dy=()=>{let{user:e,enrollInMfa:t}=V(),[r,o]=(0,er.useState)(null),{unenrollWithSms:n,unenrollWithTotp:a}=bi(),{app:i,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=A(),{closePrivyModal:u}=L(),{promptMfa:v}=vn(),[h,w]=(0,er.useState)(s?.mfaEnrollmentFlow?.seenIntro||!1),[T,C]=(0,er.useState)(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),S=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),C(null)},500)};d.current=S;let b=e?.mfaMethods.includes("sms"),x=!!e?.phone,I=e?.mfaMethods.includes("totp"),W=b||I;(0,er.useEffect)(()=>{W&&w(!0)},[W]);function R(){o(null),C(null)}function H(){w(!1)}async function B(N){await v(),C(N)}if(!l||!e||!i)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(Ay,{})}),(0,m.jsx)(Lo,{children:(0,m.jsx)(Lt,{})}),(0,m.jsx)(ie,{})]});async function G(){o(null);try{await n()}catch{o(null)}}async function P(){o(null);try{await a()}catch{o(null)}}if(r==="sms")return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:R,onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(_l.default,{})})}),(0,m.jsx)(Ae,{children:"Remove SMS verification?"}),(0,m.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),(0,m.jsx)(Oo,{children:(0,m.jsx)(U,{warn:!0,onClick:G,children:"Remove SMS for MFA"})}),(0,m.jsx)(ie,{})]});if(r==="totp")return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:R,onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(ad.default,{})})}),(0,m.jsx)(Ae,{children:"Remove Authenticator App verification?"}),(0,m.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),(0,m.jsx)(Oo,{children:(0,m.jsx)(U,{warn:!0,onClick:P,children:"Remove Authenticator App for MFA"})}),(0,m.jsx)(ie,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!W)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(Sl.default,{})})}),(0,m.jsx)(Ae,{children:"Add more security"}),(0,m.jsxs)(ge,{children:[i?.name," does not have any verification methods enabled."]}),(0,m.jsx)(Oo,{children:(0,m.jsx)(U,{onClick:S,children:"Close"})}),(0,m.jsx)(ie,{})]});let J=!W&&!h;if(J)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(Sl.default,{})})}),(0,m.jsx)(Ae,{children:"Transaction Protection"}),(0,m.jsx)(ge,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,m.jsxs)(Yu,{children:[(0,m.jsxs)(xc,{children:[(0,m.jsx)(Pc,{children:(0,m.jsx)(Oy.default,{})}),"Enable 2-Step verification for your ",i?.name," wallet."]}),(0,m.jsxs)(xc,{children:[(0,m.jsx)(Pc,{children:(0,m.jsx)(Ny.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,m.jsxs)(Oo,{children:[(0,m.jsx)(U,{onClick:()=>w(!0),children:"Continue"}),(0,m.jsx)(Pr,{onClick:S,children:"Not now"})]}),(0,m.jsx)(ie,{})]});switch(T){case"sms":return(0,m.jsx)(GC,{onComplete:S,onReset:R,onClose:S});case"totp":return(0,m.jsx)(VC,{onComplete:S,onClose:S,onReset:R});default:return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:J?H:void 0,onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(Sl.default,{})})}),(0,m.jsx)(Ae,{children:"Choose a verification method"}),W?(0,m.jsx)(ge,{children:"To add or delete verification methods, verification is required."}):(0,m.jsx)(ge,{children:"How would you like to verify your identity? You can change this later."}),(0,m.jsxs)(Ns,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||I)&&(0,m.jsxs)(Ds,{children:[(0,m.jsx)(He,{disabled:I,onClick:()=>B("totp"),children:(0,m.jsxs)(Us,{children:[(0,m.jsxs)(Fs,{children:[(0,m.jsx)(My.default,{}),"Authenticator App"]}),I?(0,m.jsxs)(jn,{children:[(0,m.jsx)(od.default,{}),"Added"]}):(0,m.jsx)(jn,{children:"Recommended"})]})}),I&&(0,m.jsx)(Sc,{id:"remove",onClick:()=>o("totp"),children:(0,m.jsx)(nd.default,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||b)&&(0,m.jsxs)(Ds,{children:[(0,m.jsx)(He,{disabled:b||x,onClick:()=>B("sms"),children:(0,m.jsxs)(Us,{children:[(0,m.jsxs)(Fs,{children:[(0,m.jsx)(Ly.default,{}),"SMS"]}),b&&(0,m.jsxs)(jn,{children:[(0,m.jsx)(od.default,{}),"Added"]}),x&&(0,m.jsx)(jn,{children:"Disabled"})]})}),b&&(0,m.jsx)(Sc,{id:"remove",onClick:()=>o("sms"),children:(0,m.jsx)(nd.default,{})})]},"sms"),(0,m.jsx)(Ds,{children:(0,m.jsx)(He,{disabled:!0,children:(0,m.jsxs)(Us,{children:[(0,m.jsxs)(Fs,{children:[(0,m.jsx)(Wy.default,{}),"Passkey"]}),(0,m.jsx)(jn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),(0,m.jsx)(ie,{})]})}},GC=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=(0,er.useState)(""),[a,i]=(0,er.useState)(!1),[l,s]=(0,er.useState)("enroll"),{initEnrollmentWithSms:d,submitEnrollmentWithSms:u}=bi(),{app:v,data:h,currentScreen:w,navigate:T,setModalData:C}=A();function S(){h?.mfaEnrollmentFlow?.onSuccess(),e()}async function b({qualifiedPhoneNumber:W}){try{await d({phoneNumber:W}),n(W),s("verify")}catch(R){C({mfaEnrollmentFlow:h?.mfaEnrollmentFlow?{...h?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:R,previousScreen:w||"MFA_ENROLLMENT_FLOW_SCREEN"}}),T("ERROR_SCREEN")}}async function x(W){try{if(!W)return;await u({phoneNumber:o,mfaCode:W}),i(!0)}catch(R){throw Dc(R)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):dn(R)?new Error("The code you entered is not valid"):cn(R)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Fc(R)?new Error("Verification canceled"):new Error("Unknown error")}}function I(){l==="verify"?s("enroll"):t()}return l==="enroll"?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:t,onClose:r},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(_l.default,{})})}),(0,m.jsx)(Ae,{children:"Set up SMS verification"}),(0,m.jsx)(ge,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,m.jsxs)(Lo,{children:[(0,m.jsx)(yi,{onSubmit:b}),(0,m.jsxs)(Ju,{children:["By providing your mobile number, you agree to receive text messages from ",v?.name,". Some carrier charges may apply"]})]}),(0,m.jsx)(ie,{})]}):a?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{status:"success",children:(0,m.jsx)(id.default,{})})}),(0,m.jsx)(Ae,{children:"SMS verification added"}),(0,m.jsx)(ge,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,m.jsx)(Oo,{children:(0,m.jsx)(U,{onClick:S,children:"Done"})}),(0,m.jsx)(ie,{})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:I,onClose:r},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(_l.default,{})})}),(0,m.jsx)(Ae,{children:"Enter enrollment code"}),(0,m.jsxs)(Lo,{children:[(0,m.jsx)(Ci,{onChange:x}),(0,m.jsxs)(ge,{children:["To continue, enter the 6-digit code sent to ",(0,m.jsx)("strong",{children:$h(o)})]})]}),(0,m.jsx)(ie,{})]})},VC=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=(0,er.useState)("enroll"),[a,i]=(0,er.useState)(null),[l,s]=(0,er.useState)(!1),{initEnrollmentWithTotp:d,submitEnrollmentWithTotp:u}=bi(),{data:v}=A();(0,er.useEffect)(()=>{i(null),d().then(S=>{i(S)}).catch(()=>{i(null),r()})},[]);function h(){v?.mfaEnrollmentFlow?.onSuccess(),e()}function w(){n("verify")}async function T(S){try{if(!S)return;await u({mfaCode:S}),s(!0)}catch(b){throw Dc(b)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):dn(b)?new Error("The code you entered is not valid"):cn(b)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Fc(b)?new Error("Verification canceled"):new Error("Unknown error")}}function C(){o==="verify"?n("enroll"):r()}return o==="enroll"?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:r,onClose:t},"header"),(0,m.jsx)(Ae,{children:"Scan QR code"}),(0,m.jsx)(ge,{children:"Open your authenticator app and scan the QR code to continue."}),(0,m.jsx)(Kn,{children:a?.authUrl?(0,m.jsx)(Ry,{authUrl:a.authUrl,size:200}):(0,m.jsx)(Lt,{})}),(0,m.jsxs)(Oo,{children:[(0,m.jsx)(kt,{children:a?.secret&&(0,m.jsx)(Go,{itemName:"secret",text:a.secret})}),(0,m.jsx)(U,{onClick:w,children:"Continue"})]}),(0,m.jsx)(ie,{})]}):l?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:h},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{status:"success",children:(0,m.jsx)(id.default,{})})}),(0,m.jsx)(Ae,{children:"Authenticator app verification added"}),(0,m.jsx)(ge,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,m.jsx)(Oo,{children:(0,m.jsx)(U,{onClick:h,children:"Done"})}),(0,m.jsx)(ie,{})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:C,onClose:t},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(ad.default,{})})}),(0,m.jsx)(Ae,{children:"Enter enrollment code"}),(0,m.jsx)(Lo,{children:(0,m.jsx)(Ci,{onChange:T})}),(0,m.jsxs)(ge,{children:["To continue, enter the 6-digit code generated from your ",(0,m.jsx)("strong",{children:"authenticator app"})]}),(0,m.jsx)(ie,{})]})};var Cg=y(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),bg=y(require("@heroicons/react/24/outline/PhoneIcon")),Eg=y(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Tg=y(require("@heroicons/react/24/solid/PhoneIcon")),Pg=y(require("@heroicons/react/24/solid/ShieldCheckIcon")),Ri=require("react");var bn=require("react"),wg=y(require("styled-components"));var md=y(require("styled-components"));var sd=y(require("styled-components")),fa=require("react/jsx-runtime"),Al=({label:e,children:t,valueStyles:r})=>(0,fa.jsxs)(zC,{children:[(0,fa.jsx)("div",{children:e}),(0,fa.jsx)(qC,{style:{...r},children:t})]}),zC=sd.default.div`
1997
+ `;var Ry=y(require("@heroicons/react/24/solid/ShieldCheckIcon"));var My=require("react/jsx-runtime");var Iy=({size:e,authUrl:t})=>(0,My.jsx)(pi,{url:t,squareLogoElement:Ry.default,size:e,fgColor:"#1F1F1F"});var m=require("react/jsx-runtime"),Fy=()=>{let{user:e,enrollInMfa:t}=V(),[r,o]=(0,er.useState)(null),{unenrollWithSms:n,unenrollWithTotp:a}=bi(),{app:i,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=A(),{closePrivyModal:u}=L(),{promptMfa:v}=vn(),[h,w]=(0,er.useState)(s?.mfaEnrollmentFlow?.seenIntro||!1),[T,C]=(0,er.useState)(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),S=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),C(null)},500)};d.current=S;let b=e?.mfaMethods.includes("sms"),x=!!e?.phone,I=e?.mfaMethods.includes("totp"),W=b||I;(0,er.useEffect)(()=>{W&&w(!0)},[W]);function R(){o(null),C(null)}function H(){w(!1)}async function B(N){await v(),C(N)}if(!l||!e||!i)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(ky,{})}),(0,m.jsx)(Lo,{children:(0,m.jsx)(Lt,{})}),(0,m.jsx)(ie,{})]});async function G(){o(null);try{await n()}catch{o(null)}}async function P(){o(null);try{await a()}catch{o(null)}}if(r==="sms")return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:R,onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(_l.default,{})})}),(0,m.jsx)(Ae,{children:"Remove SMS verification?"}),(0,m.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),(0,m.jsx)(Oo,{children:(0,m.jsx)(U,{warn:!0,onClick:G,children:"Remove SMS for MFA"})}),(0,m.jsx)(ie,{})]});if(r==="totp")return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:R,onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(ad.default,{})})}),(0,m.jsx)(Ae,{children:"Remove Authenticator App verification?"}),(0,m.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),(0,m.jsx)(Oo,{children:(0,m.jsx)(U,{warn:!0,onClick:P,children:"Remove Authenticator App for MFA"})}),(0,m.jsx)(ie,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!W)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(Sl.default,{})})}),(0,m.jsx)(Ae,{children:"Add more security"}),(0,m.jsxs)(ge,{children:[i?.name," does not have any verification methods enabled."]}),(0,m.jsx)(Oo,{children:(0,m.jsx)(U,{onClick:S,children:"Close"})}),(0,m.jsx)(ie,{})]});let J=!W&&!h;if(J)return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(Sl.default,{})})}),(0,m.jsx)(Ae,{children:"Transaction Protection"}),(0,m.jsx)(ge,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,m.jsxs)(Ju,{children:[(0,m.jsxs)(xc,{children:[(0,m.jsx)(Pc,{children:(0,m.jsx)(Ny.default,{})}),"Enable 2-Step verification for your ",i?.name," wallet."]}),(0,m.jsxs)(xc,{children:[(0,m.jsx)(Pc,{children:(0,m.jsx)(Dy.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,m.jsxs)(Oo,{children:[(0,m.jsx)(U,{onClick:()=>w(!0),children:"Continue"}),(0,m.jsx)(Pr,{onClick:S,children:"Not now"})]}),(0,m.jsx)(ie,{})]});switch(T){case"sms":return(0,m.jsx)(VC,{onComplete:S,onReset:R,onClose:S});case"totp":return(0,m.jsx)(zC,{onComplete:S,onClose:S,onReset:R});default:return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:J?H:void 0,onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(Sl.default,{})})}),(0,m.jsx)(Ae,{children:"Choose a verification method"}),W?(0,m.jsx)(ge,{children:"To add or delete verification methods, verification is required."}):(0,m.jsx)(ge,{children:"How would you like to verify your identity? You can change this later."}),(0,m.jsxs)(Ns,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||I)&&(0,m.jsxs)(Ds,{children:[(0,m.jsx)(He,{disabled:I,onClick:()=>B("totp"),children:(0,m.jsxs)(Us,{children:[(0,m.jsxs)(Fs,{children:[(0,m.jsx)(Wy.default,{}),"Authenticator App"]}),I?(0,m.jsxs)(jn,{children:[(0,m.jsx)(od.default,{}),"Added"]}):(0,m.jsx)(jn,{children:"Recommended"})]})}),I&&(0,m.jsx)(Sc,{id:"remove",onClick:()=>o("totp"),children:(0,m.jsx)(nd.default,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||b)&&(0,m.jsxs)(Ds,{children:[(0,m.jsx)(He,{disabled:b||x,onClick:()=>B("sms"),children:(0,m.jsxs)(Us,{children:[(0,m.jsxs)(Fs,{children:[(0,m.jsx)(Oy.default,{}),"SMS"]}),b&&(0,m.jsxs)(jn,{children:[(0,m.jsx)(od.default,{}),"Added"]}),x&&(0,m.jsx)(jn,{children:"Disabled"})]})}),b&&(0,m.jsx)(Sc,{id:"remove",onClick:()=>o("sms"),children:(0,m.jsx)(nd.default,{})})]},"sms"),(0,m.jsx)(Ds,{children:(0,m.jsx)(He,{disabled:!0,children:(0,m.jsxs)(Us,{children:[(0,m.jsxs)(Fs,{children:[(0,m.jsx)(Ly.default,{}),"Passkey"]}),(0,m.jsx)(jn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),(0,m.jsx)(ie,{})]})}},VC=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=(0,er.useState)(""),[a,i]=(0,er.useState)(!1),[l,s]=(0,er.useState)("enroll"),{initEnrollmentWithSms:d,submitEnrollmentWithSms:u}=bi(),{app:v,data:h,currentScreen:w,navigate:T,setModalData:C}=A();function S(){h?.mfaEnrollmentFlow?.onSuccess(),e()}async function b({qualifiedPhoneNumber:W}){try{await d({phoneNumber:W}),n(W),s("verify")}catch(R){C({mfaEnrollmentFlow:h?.mfaEnrollmentFlow?{...h?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:R,previousScreen:w||"MFA_ENROLLMENT_FLOW_SCREEN"}}),T("ERROR_SCREEN")}}async function x(W){try{if(!W)return;await u({phoneNumber:o,mfaCode:W}),i(!0)}catch(R){throw Dc(R)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):dn(R)?new Error("The code you entered is not valid"):cn(R)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Fc(R)?new Error("Verification canceled"):new Error("Unknown error")}}function I(){l==="verify"?s("enroll"):t()}return l==="enroll"?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:t,onClose:r},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(_l.default,{})})}),(0,m.jsx)(Ae,{children:"Set up SMS verification"}),(0,m.jsx)(ge,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,m.jsxs)(Lo,{children:[(0,m.jsx)(yi,{onSubmit:b}),(0,m.jsxs)(Zu,{children:["By providing your mobile number, you agree to receive text messages from ",v?.name,". Some carrier charges may apply"]})]}),(0,m.jsx)(ie,{})]}):a?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:S},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{status:"success",children:(0,m.jsx)(id.default,{})})}),(0,m.jsx)(Ae,{children:"SMS verification added"}),(0,m.jsx)(ge,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,m.jsx)(Oo,{children:(0,m.jsx)(U,{onClick:S,children:"Done"})}),(0,m.jsx)(ie,{})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:I,onClose:r},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(_l.default,{})})}),(0,m.jsx)(Ae,{children:"Enter enrollment code"}),(0,m.jsxs)(Lo,{children:[(0,m.jsx)(Ci,{onChange:x}),(0,m.jsxs)(ge,{children:["To continue, enter the 6-digit code sent to ",(0,m.jsx)("strong",{children:jh(o)})]})]}),(0,m.jsx)(ie,{})]})},zC=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=(0,er.useState)("enroll"),[a,i]=(0,er.useState)(null),[l,s]=(0,er.useState)(!1),{initEnrollmentWithTotp:d,submitEnrollmentWithTotp:u}=bi(),{data:v}=A();(0,er.useEffect)(()=>{i(null),d().then(S=>{i(S)}).catch(()=>{i(null),r()})},[]);function h(){v?.mfaEnrollmentFlow?.onSuccess(),e()}function w(){n("verify")}async function T(S){try{if(!S)return;await u({mfaCode:S}),s(!0)}catch(b){throw Dc(b)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):dn(b)?new Error("The code you entered is not valid"):cn(b)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Fc(b)?new Error("Verification canceled"):new Error("Unknown error")}}function C(){o==="verify"?n("enroll"):r()}return o==="enroll"?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:r,onClose:t},"header"),(0,m.jsx)(Ae,{children:"Scan QR code"}),(0,m.jsx)(ge,{children:"Open your authenticator app and scan the QR code to continue."}),(0,m.jsx)(Kn,{children:a?.authUrl?(0,m.jsx)(Iy,{authUrl:a.authUrl,size:200}):(0,m.jsx)(Lt,{})}),(0,m.jsxs)(Oo,{children:[(0,m.jsx)(kt,{children:a?.secret&&(0,m.jsx)(Go,{itemName:"secret",text:a.secret})}),(0,m.jsx)(U,{onClick:w,children:"Continue"})]}),(0,m.jsx)(ie,{})]}):l?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{onClose:h},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{status:"success",children:(0,m.jsx)(id.default,{})})}),(0,m.jsx)(Ae,{children:"Authenticator app verification added"}),(0,m.jsx)(ge,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,m.jsx)(Oo,{children:(0,m.jsx)(U,{onClick:h,children:"Done"})}),(0,m.jsx)(ie,{})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(k,{backFn:C,onClose:t},"header"),(0,m.jsx)(yt,{children:(0,m.jsx)(At,{children:(0,m.jsx)(ad.default,{})})}),(0,m.jsx)(Ae,{children:"Enter enrollment code"}),(0,m.jsx)(Lo,{children:(0,m.jsx)(Ci,{onChange:T})}),(0,m.jsxs)(ge,{children:["To continue, enter the 6-digit code generated from your ",(0,m.jsx)("strong",{children:"authenticator app"})]}),(0,m.jsx)(ie,{})]})};var bg=y(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),Eg=y(require("@heroicons/react/24/outline/PhoneIcon")),Tg=y(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Pg=y(require("@heroicons/react/24/solid/PhoneIcon")),xg=y(require("@heroicons/react/24/solid/ShieldCheckIcon")),Ri=require("react");var bn=require("react"),Cg=y(require("styled-components"));var md=y(require("styled-components"));var sd=y(require("styled-components")),fa=require("react/jsx-runtime"),Al=({label:e,children:t,valueStyles:r})=>(0,fa.jsxs)(qC,{children:[(0,fa.jsx)("div",{children:e}),(0,fa.jsx)($C,{style:{...r},children:t})]}),qC=sd.default.div`
1998
1998
  display: flex;
1999
1999
  align-items: center;
2000
2000
  justify-content: space-between;
@@ -2009,7 +2009,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2009
2009
  color: var(--privy-color-foreground-2);
2010
2010
  text-align: right;
2011
2011
  }
2012
- `,qC=sd.default.div`
2012
+ `,$C=sd.default.div`
2013
2013
  font-size: 14px;
2014
2014
  line-height: 100%;
2015
2015
  display: flex;
@@ -2018,28 +2018,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
2018
2018
  border-radius: var(--privy-border-radius-full);
2019
2019
  background-color: var(--privy-color-background-2);
2020
2020
  padding: 4px 8px;
2021
- `;var ya=y(require("styled-components"));var ld=require("@ethersproject/bignumber"),cd=require("@ethersproject/units");var ha=(e,t)=>{let r=(t*parseFloat((0,cd.formatEther)(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},eo=(e,t,r=6,o=!1)=>{let a=parseFloat((0,cd.formatEther)(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${a} ${t}`:`${a==="0"?"<0.001":a} ${t}`},dd=e=>e.map(Ct).reduce((t,r)=>t.add(r),ld.BigNumber.from(0)).toHexString(),Fy=(e,t)=>{let{chains:r}=L(),o=`https://etherscan.io/address/${t}`,n=`${Wp(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},Ct=e=>ld.BigNumber.from(e);var to=require("react/jsx-runtime"),Uy=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=dd(e),n=t?ha(o,t):void 0,a=eo(o,r);return(0,to.jsx)(By,{children:n||a})},pd=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=dd(e),n=t?ha(o,t):void 0,a=eo(o,r);return(0,to.jsx)(By,{children:n?(0,to.jsxs)(to.Fragment,{children:[(0,to.jsx)($C,{children:"USD"}),n==="<$0.01"?(0,to.jsxs)(KC,{children:[(0,to.jsx)(jC,{children:"<"}),"$0.01"]}):n]}):a})},By=ya.default.span`
2021
+ `;var ya=y(require("styled-components"));var ld=require("@ethersproject/bignumber"),cd=require("@ethersproject/units");var ha=(e,t)=>{let r=(t*parseFloat((0,cd.formatEther)(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},eo=(e,t,r=6,o=!1)=>{let a=parseFloat((0,cd.formatEther)(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${a} ${t}`:`${a==="0"?"<0.001":a} ${t}`},dd=e=>e.map(Ct).reduce((t,r)=>t.add(r),ld.BigNumber.from(0)).toHexString(),Uy=(e,t)=>{let{chains:r}=L(),o=`https://etherscan.io/address/${t}`,n=`${Wp(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},Ct=e=>ld.BigNumber.from(e);var to=require("react/jsx-runtime"),By=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=dd(e),n=t?ha(o,t):void 0,a=eo(o,r);return(0,to.jsx)(Hy,{children:n||a})},pd=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=dd(e),n=t?ha(o,t):void 0,a=eo(o,r);return(0,to.jsx)(Hy,{children:n?(0,to.jsxs)(to.Fragment,{children:[(0,to.jsx)(jC,{children:"USD"}),n==="<$0.01"?(0,to.jsxs)(YC,{children:[(0,to.jsx)(KC,{children:"<"}),"$0.01"]}):n]}):a})},Hy=ya.default.span`
2022
2022
  font-size: 14px;
2023
2023
  line-height: 140%;
2024
2024
  display: flex;
2025
2025
  gap: 4px;
2026
2026
  align-items: center;
2027
- `,$C=ya.default.span`
2027
+ `,jC=ya.default.span`
2028
2028
  font-size: 12px;
2029
2029
  line-height: 12px;
2030
2030
  color: var(--privy-color-foreground-3);
2031
- `,jC=ya.default.span`
2032
- font-size: 10px;
2033
2031
  `,KC=ya.default.span`
2032
+ font-size: 10px;
2033
+ `,YC=ya.default.span`
2034
2034
  display: flex;
2035
2035
  align-items: center;
2036
- `;var kl=y(require("styled-components"));var Bt=require("react/jsx-runtime"),Hy=({gas:e,tokenPrice:t,tokenSymbol:r})=>(0,Bt.jsxs)(Rc,{style:{paddingBottom:"12px"},children:[(0,Bt.jsxs)(Vy,{children:[(0,Bt.jsx)(qy,{children:"Est. Fees"}),(0,Bt.jsx)("div",{children:(0,Bt.jsx)(pd,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&(0,Bt.jsx)(zy,{children:`${eo(e,r)}`})]}),Gy=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=Ct(e.value||0).add(Ct(t)).toHexString();return(0,Bt.jsxs)(Rc,{children:[(0,Bt.jsxs)(Vy,{children:[(0,Bt.jsx)(qy,{children:"Total (including fees)"}),(0,Bt.jsx)("div",{children:(0,Bt.jsx)(pd,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&(0,Bt.jsx)(zy,{children:eo(n,o)})]})},Vy=kl.default.div`
2036
+ `;var kl=y(require("styled-components"));var Bt=require("react/jsx-runtime"),Gy=({gas:e,tokenPrice:t,tokenSymbol:r})=>(0,Bt.jsxs)(Rc,{style:{paddingBottom:"12px"},children:[(0,Bt.jsxs)(zy,{children:[(0,Bt.jsx)($y,{children:"Est. Fees"}),(0,Bt.jsx)("div",{children:(0,Bt.jsx)(pd,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&(0,Bt.jsx)(qy,{children:`${eo(e,r)}`})]}),Vy=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=Ct(e.value||0).add(Ct(t)).toHexString();return(0,Bt.jsxs)(Rc,{children:[(0,Bt.jsxs)(zy,{children:[(0,Bt.jsx)($y,{children:"Total (including fees)"}),(0,Bt.jsx)("div",{children:(0,Bt.jsx)(pd,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&(0,Bt.jsx)(qy,{children:eo(n,o)})]})},zy=kl.default.div`
2037
2037
  display: flex;
2038
2038
  flex-direction: row;
2039
2039
  justify-content: space-between;
2040
2040
  align-items: center;
2041
2041
  padding-top: 4px;
2042
- `,zy=kl.default.div`
2042
+ `,qy=kl.default.div`
2043
2043
  display: flex;
2044
2044
  flex-direction: row;
2045
2045
  height: 12px;
@@ -2048,23 +2048,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
2048
2048
  line-height: 12px;
2049
2049
  color: var(--privy-color-foreground-3);
2050
2050
  font-weight: 400;
2051
- `,qy=kl.default.div`
2051
+ `,$y=kl.default.div`
2052
2052
  font-size: 14px;
2053
2053
  line-height: 22.4px;
2054
2054
  font-weight: 400;
2055
- `;var $y=y(require("@heroicons/react/24/outline/ChevronDownIcon")),ro=require("react"),bo=y(require("styled-components"));var Rl=require("react"),Ei=(0,Rl.createContext)(void 0);var ga=(0,Rl.createContext)(void 0);var ct=require("react/jsx-runtime"),jy=({defaultValue:e,children:t})=>{let[r,o]=(0,ro.useState)(e||null),n=a=>{o(r===a?null:a)};return(0,ct.jsx)(Ei.Provider,{value:{activePanel:r,togglePanel:n},children:(0,ct.jsx)(YC,{children:t})})},Ky=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=(0,ro.useContext)(Ei),n=r===e;return(0,ct.jsx)(ga.Provider,{value:{onToggle:()=>o(e),value:e},children:(0,ct.jsx)(XC,{isActive:n,"data-open":n,children:t})})},Yy=({children:e})=>{let{activePanel:t}=(0,ro.useContext)(Ei),{onToggle:r,value:o}=(0,ro.useContext)(ga),n=t===o;return(0,ct.jsxs)(ct.Fragment,{children:[(0,ct.jsxs)(JC,{onClick:r,"data-open":n,children:[(0,ct.jsx)(QC,{children:e}),(0,ct.jsx)(t0,{isactive:n,children:(0,ct.jsx)($y.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),(0,ct.jsx)(ZC,{})]})},Jy=({children:e})=>{let{activePanel:t}=(0,ro.useContext)(Ei),{value:r}=(0,ro.useContext)(ga);return(0,ct.jsx)(e0,{"data-open":t===r,children:(0,ct.jsx)(Qy,{children:e})})},Zy=({children:e})=>{let{activePanel:t}=(0,ro.useContext)(Ei),{value:r}=(0,ro.useContext)(ga);return(0,ct.jsx)(Qy,{children:typeof e=="function"?e({isActive:t===r}):e})},YC=bo.default.div`
2055
+ `;var jy=y(require("@heroicons/react/24/outline/ChevronDownIcon")),ro=require("react"),bo=y(require("styled-components"));var Rl=require("react"),Ei=(0,Rl.createContext)(void 0);var ga=(0,Rl.createContext)(void 0);var ct=require("react/jsx-runtime"),Ky=({defaultValue:e,children:t})=>{let[r,o]=(0,ro.useState)(e||null),n=a=>{o(r===a?null:a)};return(0,ct.jsx)(Ei.Provider,{value:{activePanel:r,togglePanel:n},children:(0,ct.jsx)(JC,{children:t})})},Yy=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=(0,ro.useContext)(Ei),n=r===e;return(0,ct.jsx)(ga.Provider,{value:{onToggle:()=>o(e),value:e},children:(0,ct.jsx)(e0,{isActive:n,"data-open":n,children:t})})},Jy=({children:e})=>{let{activePanel:t}=(0,ro.useContext)(Ei),{onToggle:r,value:o}=(0,ro.useContext)(ga),n=t===o;return(0,ct.jsxs)(ct.Fragment,{children:[(0,ct.jsxs)(ZC,{onClick:r,"data-open":n,children:[(0,ct.jsx)(XC,{children:e}),(0,ct.jsx)(r0,{isactive:n,children:(0,ct.jsx)(jy.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),(0,ct.jsx)(QC,{})]})},Zy=({children:e})=>{let{activePanel:t}=(0,ro.useContext)(Ei),{value:r}=(0,ro.useContext)(ga);return(0,ct.jsx)(t0,{"data-open":t===r,children:(0,ct.jsx)(Xy,{children:e})})},Qy=({children:e})=>{let{activePanel:t}=(0,ro.useContext)(Ei),{value:r}=(0,ro.useContext)(ga);return(0,ct.jsx)(Xy,{children:typeof e=="function"?e({isActive:t===r}):e})},JC=bo.default.div`
2056
2056
  display: flex;
2057
2057
  flex-direction: column;
2058
2058
  width: 100%;
2059
2059
  gap: 8px;
2060
- `,JC=bo.default.div`
2060
+ `,ZC=bo.default.div`
2061
2061
  display: flex;
2062
2062
  justify-content: space-between;
2063
2063
  align-items: center;
2064
2064
  width: 100%;
2065
2065
  cursor: pointer;
2066
2066
  padding-bottom: 8px;
2067
- `,ZC=bo.default.div`
2067
+ `,QC=bo.default.div`
2068
2068
  width: 100%;
2069
2069
 
2070
2070
  && {
@@ -2072,13 +2072,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
2072
2072
  border-color: var(--privy-color-foreground-4);
2073
2073
  }
2074
2074
  padding-bottom: 12px;
2075
- `,QC=bo.default.div`
2075
+ `,XC=bo.default.div`
2076
2076
  font-size: 14px;
2077
2077
  font-weight: 500;
2078
2078
  line-height: 19.6px;
2079
2079
  width: 100%;
2080
2080
  padding-right: 8px;
2081
- `,XC=bo.default.div`
2081
+ `,e0=bo.default.div`
2082
2082
  display: flex;
2083
2083
  flex-direction: column;
2084
2084
  width: 100%;
@@ -2090,7 +2090,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2090
2090
  border-color: var(--privy-color-foreground-4);
2091
2091
  border-radius: var(--privy-border-radius-md);
2092
2092
  }
2093
- `,e0=bo.default.div`
2093
+ `,t0=bo.default.div`
2094
2094
  position: relative;
2095
2095
  overflow: hidden;
2096
2096
  transition: max-height 25ms ease-out;
@@ -2102,38 +2102,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
2102
2102
  &[data-open='false'] {
2103
2103
  max-height: 0;
2104
2104
  }
2105
- `,Qy=bo.default.div`
2105
+ `,Xy=bo.default.div`
2106
2106
  display: flex;
2107
2107
  flex-direction: column;
2108
2108
  gap: 12px;
2109
2109
  flex: 1 1 auto;
2110
2110
  min-height: 1px;
2111
- `,t0=bo.default.div`
2111
+ `,r0=bo.default.div`
2112
2112
  transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2113
- `;var Xy=y(require("styled-components"));var eg=require("react/jsx-runtime"),ud=({walletAddress:e,chainId:t=ao})=>(0,eg.jsx)(r0,{href:Fy(t,e),target:"_blank",children:_o(e)}),r0=Xy.default.a`
2113
+ `;var eg=y(require("styled-components"));var tg=require("react/jsx-runtime"),ud=({walletAddress:e,chainId:t=ao})=>(0,tg.jsx)(o0,{href:Uy(t,e),target:"_blank",children:_o(e)}),o0=eg.default.a`
2114
2114
  &:hover {
2115
2115
  text-decoration: underline;
2116
2116
  }
2117
- `;var tt=require("react/jsx-runtime"),Ti=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let l=r?.value||0;return(0,tt.jsx)(jy,{children:(0,tt.jsxs)(Ky,{value:"details",children:[(0,tt.jsx)(Yy,{children:(0,tt.jsxs)(o0,{children:[(0,tt.jsx)("div",{children:o?.title||o?.actionDescription||"Details"}),(0,tt.jsx)(n0,{children:(0,tt.jsx)(Uy,{weiQuantities:[l],tokenPrice:n,tokenSymbol:i})})]})}),(0,tt.jsxs)(Jy,{children:[(0,tt.jsx)(Al,{label:"From",children:(0,tt.jsx)(ud,{walletAddress:e,chainId:r.chainId||ao})}),(0,tt.jsx)(Al,{label:"To",children:(0,tt.jsx)(ud,{walletAddress:t,chainId:r.chainId||ao})}),o&&o.action&&(0,tt.jsx)(Al,{label:"Action",children:o.action}),a&&(0,tt.jsx)(Hy,{transactionData:r,gas:a,tokenPrice:n,tokenSymbol:i})]}),(0,tt.jsx)(Zy,{children:({isActive:s})=>(0,tt.jsx)(Gy,{transactionData:r,displayFee:s,gas:a||"0x0",tokenPrice:n,tokenSymbol:i})})]})})},o0=md.default.div`
2117
+ `;var tt=require("react/jsx-runtime"),Ti=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let l=r?.value||0;return(0,tt.jsx)(Ky,{children:(0,tt.jsxs)(Yy,{value:"details",children:[(0,tt.jsx)(Jy,{children:(0,tt.jsxs)(n0,{children:[(0,tt.jsx)("div",{children:o?.title||o?.actionDescription||"Details"}),(0,tt.jsx)(i0,{children:(0,tt.jsx)(By,{weiQuantities:[l],tokenPrice:n,tokenSymbol:i})})]})}),(0,tt.jsxs)(Zy,{children:[(0,tt.jsx)(Al,{label:"From",children:(0,tt.jsx)(ud,{walletAddress:e,chainId:r.chainId||ao})}),(0,tt.jsx)(Al,{label:"To",children:(0,tt.jsx)(ud,{walletAddress:t,chainId:r.chainId||ao})}),o&&o.action&&(0,tt.jsx)(Al,{label:"Action",children:o.action}),a&&(0,tt.jsx)(Gy,{transactionData:r,gas:a,tokenPrice:n,tokenSymbol:i})]}),(0,tt.jsx)(Qy,{children:({isActive:s})=>(0,tt.jsx)(Vy,{transactionData:r,displayFee:s,gas:a||"0x0",tokenPrice:n,tokenSymbol:i})})]})})},n0=md.default.div`
2118
2118
  display: flex;
2119
2119
  flex-direction: row;
2120
2120
  justify-content: space-between;
2121
- `,n0=md.default.div`
2121
+ `,i0=md.default.div`
2122
2122
  flex-shrink: 0;
2123
2123
  padding-left: 8px;
2124
- `;var Pi=y(require("styled-components")),$o=require("react/jsx-runtime"),fd=({description:e,contractInfo:t})=>(0,$o.jsxs)(i0,{children:[t.imgUrl&&(0,$o.jsx)(a0,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&(0,$o.jsx)(s0,{children:(0,$o.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&(0,$o.jsx)(l0,{children:t.name}),(0,$o.jsx)(c0,{children:e||t.actionText})]}),i0=Pi.default.div`
2124
+ `;var Pi=y(require("styled-components")),$o=require("react/jsx-runtime"),fd=({description:e,contractInfo:t})=>(0,$o.jsxs)(a0,{children:[t.imgUrl&&(0,$o.jsx)(s0,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&(0,$o.jsx)(l0,{children:(0,$o.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&(0,$o.jsx)(c0,{children:t.name}),(0,$o.jsx)(d0,{children:e||t.actionText})]}),a0=Pi.default.div`
2125
2125
  display: flex;
2126
2126
  flex-direction: column;
2127
2127
  align-items: center;
2128
2128
  margin-bottom: 8px;
2129
- `,a0=Pi.default.img`
2129
+ `,s0=Pi.default.img`
2130
2130
  && {
2131
2131
  height: ${e=>e.size==="sm"?"65px":"140px"};
2132
2132
  width: ${e=>e.size==="sm"?"65px":"140px"};
2133
2133
  border-radius: 16px;
2134
2134
  margin-bottom: 12px;
2135
2135
  }
2136
- `,s0=Pi.default.div`
2136
+ `,l0=Pi.default.div`
2137
2137
  font-size: 12px;
2138
2138
  line-height: 12px;
2139
2139
  padding: 7px;
@@ -2146,7 +2146,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2146
2146
  text-decoration: underline;
2147
2147
  }
2148
2148
  }
2149
- `,l0=Pi.default.div`
2149
+ `,c0=Pi.default.div`
2150
2150
  font-size: 18px;
2151
2151
  line-height: 18px;
2152
2152
  font-weight: 500;
@@ -2154,7 +2154,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2154
2154
  white-space: nowrap;
2155
2155
  max-width: 275px;
2156
2156
  text-overflow: ellipsis;
2157
- `,c0=Pi.default.div`
2157
+ `,d0=Pi.default.div`
2158
2158
  font-size: 16px;
2159
2159
  line-height: 140%;
2160
2160
  font-weight: 400;
@@ -2162,7 +2162,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2162
2162
  overflow: hidden;
2163
2163
  max-width: 275px;
2164
2164
  text-overflow: ellipsis;
2165
- `;var tg=y(require("@heroicons/react/24/outline/WalletIcon")),Il=y(require("styled-components"));var wn=require("react/jsx-runtime"),rg=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:a}=L(),i=a(t.chainId)||"ETH";return(0,wn.jsxs)(d0,{children:[(0,wn.jsxs)(p0,{children:[(0,wn.jsx)(tg.default,{strokeWidth:"2",width:"16px",height:"16px"}),(0,wn.jsx)("div",{children:_o(e)})]}),(0,wn.jsxs)(u0,{displayBalanceColor:n,hasFunds:o,children:[r?eo(r,i,6,!0):0," available"]})]})},d0=Il.default.div`
2165
+ `;var rg=y(require("@heroicons/react/24/outline/WalletIcon")),Il=y(require("styled-components"));var wn=require("react/jsx-runtime"),og=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:a}=L(),i=a(t.chainId)||"ETH";return(0,wn.jsxs)(p0,{children:[(0,wn.jsxs)(u0,{children:[(0,wn.jsx)(rg.default,{strokeWidth:"2",width:"16px",height:"16px"}),(0,wn.jsx)("div",{children:_o(e)})]}),(0,wn.jsxs)(m0,{displayBalanceColor:n,hasFunds:o,children:[r?eo(r,i,6,!0):0," available"]})]})},p0=Il.default.div`
2166
2166
  display: flex;
2167
2167
  flex-direction: row;
2168
2168
  justify-content: space-between;
@@ -2175,12 +2175,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
2175
2175
  border: 1px solid var(--privy-color-foreground-4);
2176
2176
  border-radius: var(--privy-border-radius-md);
2177
2177
  }
2178
- `,p0=Il.default.div`
2178
+ `,u0=Il.default.div`
2179
2179
  display: flex;
2180
2180
  flex-direction: row;
2181
2181
  align-items: center;
2182
2182
  gap: 8px;
2183
- `,u0=Il.default.div`
2183
+ `,m0=Il.default.div`
2184
2184
  display: flex;
2185
2185
  align-items: center;
2186
2186
  justify-content: center;
@@ -2190,35 +2190,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
2190
2190
  background-color: var(--privy-color-background-2);
2191
2191
  padding: 5px 8px;
2192
2192
  color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
2193
- `;var va=y(require("styled-components"));var fr=require("react/jsx-runtime"),ng=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,a=o?ha(n,o):void 0,i=eo(n,r);return(0,fr.jsxs)(m0,{children:[a?(0,fr.jsxs)(fr.Fragment,{children:[(0,fr.jsx)(og,{children:a}),(0,fr.jsx)(f0,{children:i})]}):(0,fr.jsx)(fr.Fragment,{children:(0,fr.jsx)(og,{children:i})}),(0,fr.jsx)(h0,{children:e})]})},m0=va.default.div`
2193
+ `;var va=y(require("styled-components"));var fr=require("react/jsx-runtime"),ig=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,a=o?ha(n,o):void 0,i=eo(n,r);return(0,fr.jsxs)(f0,{children:[a?(0,fr.jsxs)(fr.Fragment,{children:[(0,fr.jsx)(ng,{children:a}),(0,fr.jsx)(h0,{children:i})]}):(0,fr.jsx)(fr.Fragment,{children:(0,fr.jsx)(ng,{children:i})}),(0,fr.jsx)(y0,{children:e})]})},f0=va.default.div`
2194
2194
  display: flex;
2195
2195
  flex-direction: column;
2196
2196
  align-items: center;
2197
2197
  margin-bottom: 20px;
2198
- `,og=va.default.h2`
2198
+ `,ng=va.default.h2`
2199
2199
  && {
2200
2200
  font-size: 48px;
2201
2201
  line-height: 48px;
2202
2202
  margin: 8px auto;
2203
2203
  }
2204
- `,f0=va.default.p`
2204
+ `,h0=va.default.p`
2205
2205
  margin-bottom: 12px;
2206
2206
  && {
2207
2207
  font-size: 17px;
2208
2208
  line-height: 17px;
2209
2209
  color: var(--privy-color-foreground-3);
2210
2210
  }
2211
- `,h0=va.default.div`
2211
+ `,y0=va.default.div`
2212
2212
  font-size: 16px;
2213
2213
  line-height: 22.4px;
2214
2214
  font-weight: 400;
2215
2215
  overflow: hidden;
2216
2216
  max-width: 275px;
2217
2217
  text-overflow: ellipsis;
2218
- `;var yg=require("@ethersproject/abstract-signer"),v0=require("@ethersproject/providers");var hd=require("@ethersproject/bignumber");var Cn=require("@ethersproject/bignumber"),ig=require("@ethersproject/contracts"),ag=require("@ethersproject/transactions");var xi=e=>[ls.id,cs.id,ds.id,ps.id,us.id,ms.id,fs.id,ys.id,hs.id].includes(e),sg=async(e,t)=>{if(!xi(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let a=Cn.BigNumber.from(r).mul(Cn.BigNumber.from(126)).div(Cn.BigNumber.from(100)).add(Cn.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=wa(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function lg(e,t){if(!e.chainId||e.chainId&&!xi(e.chainId))return Cn.BigNumber.from(0);let r=Cn.BigNumber.from(0);try{let o=new ig.Contract(xp,Sp,t),n=cg(e),a=(0,ag.serialize)(n);r=await o.getL1Fee(a)}catch{}return r}async function dg(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var pg=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function Si(e,t){if(!e.gasLimit)throw new Be("gasLimit was not successfully set for transaction.");let r=Ct(e.gasLimit),o=hd.BigNumber.from(0);if(e.type==2)if(e.maxFeePerGas)o=Ct(e.maxFeePerGas);else throw new Be("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=Ct(e.gasPrice);else throw new Be("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=hd.BigNumber.from(0);if(e.chainId&&xi(e.chainId))try{a=await lg(e,t),n=n.add(a)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:a}}var Ml=require("@ethersproject/bignumber");var yd=e=>[is.id,as.id,ss.id].includes(e),ug=async(e,t)=>{if(!yd(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.type===void 0&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(Ml.BigNumber.from(120)).div(Ml.BigNumber.from(100));e.maxFeePerGas=wa(o),e.maxPriorityFeePerGas=wa(Ml.BigNumber.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var gd=e=>[56,97].includes(e),mg=async(e,t)=>{if(!gd(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};var Cd=require("@ethersproject/units"),fg=require("ofetch");var vd={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var bd=e=>[Vi.id,zi.id,vd.id].includes(e),wd=e=>({maxPriorityFee:(0,Cd.parseUnits)(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:(0,Cd.parseUnits)(e.maxFee.toFixed(9),"gwei").toHexString()}),y0=e=>({safeLow:wd(e.safeLow),standard:wd(e.standard),fast:wd(e.fast)}),g0=async e=>{let t="";switch(e){case Vi.id:t="https://gasstation.polygon.technology/v2";break;case zi.id:t="https://gasstation-testnet.polygon.technology/v2";break;case vd.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return y0(await(0,fg.ofetch)(t))};async function hg(e){if(!bd(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await g0(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee)}catch(t){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${t}.`)}return e}function wa(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function cg(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=Ct(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Ct(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Ct(e.gasPrice)),e.value!==void 0&&(t.value=Ct(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Ct(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Ct(e.maxPriorityFeePerGas)),t}async function _i(e,t,r){if(t.chainId=Number(t.chainId),gg(t),t.from||(t.from=e),!t.nonce){let o=new yg.VoidSigner(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await dg(t,r)),typeof t.type=="string"&&vg(t.type)&&(t.type=Number(t.type)),bd(t.chainId)?t=await hg(t):yd(t.chainId)?t=await ug(t,r):xi(t.chainId)?t=await sg(t,r):gd(t.chainId)?t=await mg(t,r):t=await pg(t,r),t}async function Wl(e,t,r,o,n){o=Object.assign({chainId:ao},o),gg(o);let i=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(i)}async function Ll(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub(Ct(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function gg(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!w0(o))throw new Error(`Transaction request property '${r}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function w0(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&vg(e);return t||r||o}function vg(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Ol(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}var Ai=require("react");var Nl=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=L(),[n,a]=(0,Ai.useState)(!0),[i,l]=(0,Ai.useState)(void 0),[s,d]=(0,Ai.useState)(void 0);return(0,Ai.useEffect)(()=>{let u=e.chainId||ao,v=o.find(w=>w.id===Number(u));if(!v)throw new oe(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let w=await r(v);w?d(w):l(new Error(`Unable to fetch token price on chain id ${v.id}`))}catch(w){l(w)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};var Dl=require("react"),Ed=(0,Dl.createContext)(null);function ki(){let e=(0,Dl.useContext)(Ed);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}var Td=require("react/jsx-runtime"),Pd=({pendingTransaction:e})=>{let{getAccessToken:t}=V(),{wallets:r}=ki(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=L(),[s,d]=(0,bn.useState)(null),[u,v]=(0,bn.useState)(e),{tokenPrice:h}=Nl(u),w=l(e.chainId)||"ETH",T=(0,bn.useMemo)(()=>r.find(C=>C.walletClientType==="privy"),[r]);return(0,bn.useEffect)(()=>{async function C(){if(!await t()||!o||!T)return u;let b=so(u.chainId,a,n,{appId:i}),x=await _i(T.address,u,b),{totalGasEstimate:I}=await Si(x,b);return d(I.toHexString()),x}C().then(S=>{v(S)})},[o]),T?(0,Td.jsx)(C0,{children:(0,Td.jsx)(Ti,{from:T.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:h,tokenSymbol:w})}):null},C0=wg.default.div`
2218
+ `;var gg=require("@ethersproject/abstract-signer"),w0=require("@ethersproject/providers");var hd=require("@ethersproject/bignumber");var Cn=require("@ethersproject/bignumber"),ag=require("@ethersproject/contracts"),sg=require("@ethersproject/transactions");var xi=e=>[ls.id,cs.id,ds.id,ps.id,us.id,ms.id,fs.id,ys.id,hs.id].includes(e),lg=async(e,t)=>{if(!xi(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let a=Cn.BigNumber.from(r).mul(Cn.BigNumber.from(126)).div(Cn.BigNumber.from(100)).add(Cn.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=wa(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function cg(e,t){if(!e.chainId||e.chainId&&!xi(e.chainId))return Cn.BigNumber.from(0);let r=Cn.BigNumber.from(0);try{let o=new ag.Contract(xp,Sp,t),n=dg(e),a=(0,sg.serialize)(n);r=await o.getL1Fee(a)}catch{}return r}async function pg(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var ug=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function Si(e,t){if(!e.gasLimit)throw new Be("gasLimit was not successfully set for transaction.");let r=Ct(e.gasLimit),o=hd.BigNumber.from(0);if(e.type==2)if(e.maxFeePerGas)o=Ct(e.maxFeePerGas);else throw new Be("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=Ct(e.gasPrice);else throw new Be("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=hd.BigNumber.from(0);if(e.chainId&&xi(e.chainId))try{a=await cg(e,t),n=n.add(a)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:a}}var Ml=require("@ethersproject/bignumber");var yd=e=>[is.id,as.id,ss.id].includes(e),mg=async(e,t)=>{if(!yd(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.type===void 0&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(Ml.BigNumber.from(120)).div(Ml.BigNumber.from(100));e.maxFeePerGas=wa(o),e.maxPriorityFeePerGas=wa(Ml.BigNumber.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var gd=e=>[56,97].includes(e),fg=async(e,t)=>{if(!gd(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};var Cd=require("@ethersproject/units"),hg=require("ofetch");var vd={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var bd=e=>[Vi.id,zi.id,vd.id].includes(e),wd=e=>({maxPriorityFee:(0,Cd.parseUnits)(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:(0,Cd.parseUnits)(e.maxFee.toFixed(9),"gwei").toHexString()}),g0=e=>({safeLow:wd(e.safeLow),standard:wd(e.standard),fast:wd(e.fast)}),v0=async e=>{let t="";switch(e){case Vi.id:t="https://gasstation.polygon.technology/v2";break;case zi.id:t="https://gasstation-testnet.polygon.technology/v2";break;case vd.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return g0(await(0,hg.ofetch)(t))};async function yg(e){if(!bd(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await v0(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee)}catch(t){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${t}.`)}return e}function wa(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function dg(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=Ct(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Ct(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Ct(e.gasPrice)),e.value!==void 0&&(t.value=Ct(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Ct(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Ct(e.maxPriorityFeePerGas)),t}async function _i(e,t,r){if(t.chainId=Number(t.chainId),vg(t),t.from||(t.from=e),!t.nonce){let o=new gg.VoidSigner(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await pg(t,r)),typeof t.type=="string"&&wg(t.type)&&(t.type=Number(t.type)),bd(t.chainId)?t=await yg(t):yd(t.chainId)?t=await mg(t,r):xi(t.chainId)?t=await lg(t,r):gd(t.chainId)?t=await fg(t,r):t=await ug(t,r),t}async function Wl(e,t,r,o,n){o=Object.assign({chainId:ao},o),vg(o);let i=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(i)}async function Ll(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub(Ct(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function vg(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!C0(o))throw new Error(`Transaction request property '${r}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function C0(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&wg(e);return t||r||o}function wg(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Ol(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}var Ai=require("react");var Nl=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=L(),[n,a]=(0,Ai.useState)(!0),[i,l]=(0,Ai.useState)(void 0),[s,d]=(0,Ai.useState)(void 0);return(0,Ai.useEffect)(()=>{let u=e.chainId||ao,v=o.find(w=>w.id===Number(u));if(!v)throw new oe(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let w=await r(v);w?d(w):l(new Error(`Unable to fetch token price on chain id ${v.id}`))}catch(w){l(w)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};var Dl=require("react"),Ed=(0,Dl.createContext)(null);function ki(){let e=(0,Dl.useContext)(Ed);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}var Td=require("react/jsx-runtime"),Pd=({pendingTransaction:e})=>{let{getAccessToken:t}=V(),{wallets:r}=ki(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=L(),[s,d]=(0,bn.useState)(null),[u,v]=(0,bn.useState)(e),{tokenPrice:h}=Nl(u),w=l(e.chainId)||"ETH",T=(0,bn.useMemo)(()=>r.find(C=>C.walletClientType==="privy"),[r]);return(0,bn.useEffect)(()=>{async function C(){if(!await t()||!o||!T)return u;let b=so(u.chainId,a,n,{appId:i}),x=await _i(T.address,u,b),{totalGasEstimate:I}=await Si(x,b);return d(I.toHexString()),x}C().then(S=>{v(S)})},[o]),T?(0,Td.jsx)(b0,{children:(0,Td.jsx)(Ti,{from:T.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:h,tokenSymbol:w})}):null},b0=Cg.default.div`
2219
2219
  width: 100%;
2220
2220
  padding: 1rem 0;
2221
- `;var $=require("react/jsx-runtime"),xd=({open:e,onClose:t})=>{let{user:r}=V(),[o,n]=(0,Ri.useState)(null),{init:a,cancel:i}=vn();(0,Ri.useEffect)(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(d){try{n(d),await a(d)}catch(u){console.error(u)}}let s=()=>{n(null),i(),t()};return!e||!r?null:o?(0,$.jsx)(b0,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{onClose:s},"header"),(0,$.jsx)(yt,{children:(0,$.jsx)(At,{children:(0,$.jsx)(Pg.default,{})})}),(0,$.jsx)(Ae,{children:"Verify your identity"}),(0,$.jsx)(ge,{children:"Choose a verification method"}),(0,$.jsxs)(Ns,{children:[r.mfaMethods.includes("totp")&&(0,$.jsxs)(He,{onClick:()=>l("totp"),children:[(0,$.jsx)(Cg.default,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&(0,$.jsxs)(He,{onClick:()=>l("sms"),children:[(0,$.jsx)(bg.default,{}),"SMS"]},"sms")]}),(0,$.jsx)(ie,{})]})},b0=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=A(),{pendingTransaction:n}=L(),[a,i]=(0,Ri.useState)(!1),[l,s]=(0,Ri.useState)(!1),{submit:d}=vn();async function u(v){try{if(!v)return;await d(e,v),s(!0),i(!1),t()}catch(h){throw qs(h)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):dn(h)?(i(!1),new Error("The code you entered is not valid")):cn(h)?(i(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(i(!1),new Error("Unknown error"))}}switch(e){case"sms":return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{onClose:t},"header"),(0,$.jsx)(yt,{children:(0,$.jsx)(At,{children:(0,$.jsx)(Tg.default,{})})}),(0,$.jsx)(Ae,{children:"Enter verification code"}),(0,$.jsxs)(Lo,{children:[(0,$.jsx)(Ci,{success:l,disabled:a,onChange:u}),(0,$.jsxs)(ge,{children:["To continue, please enter the 6-digit code sent to your ",(0,$.jsx)("strong",{children:"mobile device"})]}),n&&(0,$.jsx)(Pd,{pendingTransaction:n})]}),r&&(0,$.jsx)(_c,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),(0,$.jsx)(Pr,{onClick:t,children:"Not now"}),(0,$.jsx)(ie,{})]});case"totp":return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{onClose:t},"header"),(0,$.jsx)(yt,{children:(0,$.jsx)(At,{children:(0,$.jsx)(Eg.default,{})})}),(0,$.jsx)(Ae,{children:"Enter verification code"}),(0,$.jsxs)(Lo,{children:[(0,$.jsx)(Ci,{success:l,disabled:a,onChange:u}),(0,$.jsxs)(ge,{children:["To continue, please enter the 6-digit code generated from your"," ",(0,$.jsx)("strong",{children:"authenticator app"})]}),n&&(0,$.jsx)(Pd,{pendingTransaction:n})]}),r&&(0,$.jsx)(_c,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),(0,$.jsx)(Pr,{onClick:t,children:"Not now"}),(0,$.jsx)(ie,{})]});default:return null}};var Ii=require("react"),Sd=y(require("styled-components"));var rt=require("react/jsx-runtime"),xg={google:{name:"Google",component:hl},discord:{name:"Discord",component:ml},github:{name:"Github",component:fl},linkedin:{name:"LinkedIn",component:yl},twitter:{name:"Twitter",component:wl},spotify:{name:"Spotify",component:gl},tiktok:{name:"Tiktok",component:vl},apple:{name:"Apple",component:ul}},Sg=()=>{let{authenticated:e,logout:t,ready:r,user:o}=V(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=A(),{getAuthMeta:s,initLoginWithOAuth:d,loginWithOAuth:u,updateWallets:v,setReadyToTrue:h,closePrivyModal:w,createAnalyticsEvent:T}=L(),[C,S]=(0,Ii.useState)(!1),[b,x]=(0,Ii.useState)(void 0),I=s()?.provider||"google",W=xg[I].name,R=xg[I].component,H=n?.render.inDialog?at:0;(0,Ii.useEffect)(()=>{u(I).then(()=>{S(!0)}).catch(P=>{if(P?.privyErrorCode==="allowlist_rejected"){x(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}let{retryable:J,detail:N}=qp(P,I);x({retryable:J,detail:N,message:"Authentication failed"})}).finally(()=>{Bi(),h()})},[W,I]),(0,Ii.useEffect)(()=>{if(r&&e&&C&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let J=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},H);return()=>clearTimeout(J)}if(or(o,n?.embeddedWallets?.createOnLogin)){let J=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:N=>{console.error(N),T("embedded_wallet_creation_failure_logout",{error:N,provider:I,screen:"OAuthStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},H);return()=>clearTimeout(J)}else{let J=setTimeout(()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return v(),()=>clearTimeout(J)}}},[r,e,C,o]);let B=C?`Successfully connected with ${W}`:b?b.message:`Verifying connection to ${W}`,G="";return C?G="You\u2019re good to go!":b?G=b.detail:G="Just a few moments more",(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.jsx)(k,{}),(0,rt.jsx)(X,{}),(0,rt.jsxs)(E0,{children:[(0,rt.jsx)(T0,{children:(0,rt.jsxs)("div",{children:[(0,rt.jsx)(lr,{success:C,fail:!!b}),(0,rt.jsx)(R,{style:{width:"38px",height:"38px"}})]})}),(0,rt.jsxs)(gt,{children:[(0,rt.jsx)("h3",{children:B}),(0,rt.jsx)("p",{children:G})]}),b&&b?.retryable?(0,rt.jsx)(Ms,{onClick:()=>{Bi(),d(I),x(void 0)},disabled:!C&&!b?.retryable,children:"Retry"}):null]}),(0,rt.jsx)(le,{}),(0,rt.jsx)(ie,{})]})},E0=Sd.default.div`
2221
+ `;var $=require("react/jsx-runtime"),xd=({open:e,onClose:t})=>{let{user:r}=V(),[o,n]=(0,Ri.useState)(null),{init:a,cancel:i}=vn();(0,Ri.useEffect)(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(d){try{n(d),await a(d)}catch(u){console.error(u)}}let s=()=>{n(null),i(),t()};return!e||!r?null:o?(0,$.jsx)(E0,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{onClose:s},"header"),(0,$.jsx)(yt,{children:(0,$.jsx)(At,{children:(0,$.jsx)(xg.default,{})})}),(0,$.jsx)(Ae,{children:"Verify your identity"}),(0,$.jsx)(ge,{children:"Choose a verification method"}),(0,$.jsxs)(Ns,{children:[r.mfaMethods.includes("totp")&&(0,$.jsxs)(He,{onClick:()=>l("totp"),children:[(0,$.jsx)(bg.default,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&(0,$.jsxs)(He,{onClick:()=>l("sms"),children:[(0,$.jsx)(Eg.default,{}),"SMS"]},"sms")]}),(0,$.jsx)(ie,{})]})},E0=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=A(),{pendingTransaction:n}=L(),[a,i]=(0,Ri.useState)(!1),[l,s]=(0,Ri.useState)(!1),{submit:d}=vn();async function u(v){try{if(!v)return;await d(e,v),s(!0),i(!1),t()}catch(h){throw qs(h)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):dn(h)?(i(!1),new Error("The code you entered is not valid")):cn(h)?(i(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(i(!1),new Error("Unknown error"))}}switch(e){case"sms":return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{onClose:t},"header"),(0,$.jsx)(yt,{children:(0,$.jsx)(At,{children:(0,$.jsx)(Pg.default,{})})}),(0,$.jsx)(Ae,{children:"Enter verification code"}),(0,$.jsxs)(Lo,{children:[(0,$.jsx)(Ci,{success:l,disabled:a,onChange:u}),(0,$.jsxs)(ge,{children:["To continue, please enter the 6-digit code sent to your ",(0,$.jsx)("strong",{children:"mobile device"})]}),n&&(0,$.jsx)(Pd,{pendingTransaction:n})]}),r&&(0,$.jsx)(_c,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),(0,$.jsx)(Pr,{onClick:t,children:"Not now"}),(0,$.jsx)(ie,{})]});case"totp":return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{onClose:t},"header"),(0,$.jsx)(yt,{children:(0,$.jsx)(At,{children:(0,$.jsx)(Tg.default,{})})}),(0,$.jsx)(Ae,{children:"Enter verification code"}),(0,$.jsxs)(Lo,{children:[(0,$.jsx)(Ci,{success:l,disabled:a,onChange:u}),(0,$.jsxs)(ge,{children:["To continue, please enter the 6-digit code generated from your"," ",(0,$.jsx)("strong",{children:"authenticator app"})]}),n&&(0,$.jsx)(Pd,{pendingTransaction:n})]}),r&&(0,$.jsx)(_c,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),(0,$.jsx)(Pr,{onClick:t,children:"Not now"}),(0,$.jsx)(ie,{})]});default:return null}};var Ii=require("react"),Sd=y(require("styled-components"));var rt=require("react/jsx-runtime"),Sg={google:{name:"Google",component:hl},discord:{name:"Discord",component:ml},github:{name:"Github",component:fl},linkedin:{name:"LinkedIn",component:yl},twitter:{name:"Twitter",component:wl},spotify:{name:"Spotify",component:gl},tiktok:{name:"Tiktok",component:vl},apple:{name:"Apple",component:ul}},_g=()=>{let{authenticated:e,logout:t,ready:r,user:o}=V(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=A(),{getAuthMeta:s,initLoginWithOAuth:d,loginWithOAuth:u,updateWallets:v,setReadyToTrue:h,closePrivyModal:w,createAnalyticsEvent:T}=L(),[C,S]=(0,Ii.useState)(!1),[b,x]=(0,Ii.useState)(void 0),I=s()?.provider||"google",W=Sg[I].name,R=Sg[I].component,H=n?.render.inDialog?at:0;(0,Ii.useEffect)(()=>{u(I).then(()=>{S(!0)}).catch(P=>{if(P?.privyErrorCode==="allowlist_rejected"){x(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}let{retryable:J,detail:N}=qp(P,I);x({retryable:J,detail:N,message:"Authentication failed"})}).finally(()=>{Bi(),h()})},[W,I]),(0,Ii.useEffect)(()=>{if(r&&e&&C&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let J=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},H);return()=>clearTimeout(J)}if(or(o,n?.embeddedWallets?.createOnLogin)){let J=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:N=>{console.error(N),T("embedded_wallet_creation_failure_logout",{error:N,provider:I,screen:"OAuthStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},H);return()=>clearTimeout(J)}else{let J=setTimeout(()=>w({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return v(),()=>clearTimeout(J)}}},[r,e,C,o]);let B=C?`Successfully connected with ${W}`:b?b.message:`Verifying connection to ${W}`,G="";return C?G="You\u2019re good to go!":b?G=b.detail:G="Just a few moments more",(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.jsx)(k,{}),(0,rt.jsx)(X,{}),(0,rt.jsxs)(T0,{children:[(0,rt.jsx)(P0,{children:(0,rt.jsxs)("div",{children:[(0,rt.jsx)(lr,{success:C,fail:!!b}),(0,rt.jsx)(R,{style:{width:"38px",height:"38px"}})]})}),(0,rt.jsxs)(gt,{children:[(0,rt.jsx)("h3",{children:B}),(0,rt.jsx)("p",{children:G})]}),b&&b?.retryable?(0,rt.jsx)(Ms,{onClick:()=>{Bi(),d(I),x(void 0)},disabled:!C&&!b?.retryable,children:"Retry"}):null]}),(0,rt.jsx)(le,{}),(0,rt.jsx)(ie,{})]})},T0=Sd.default.div`
2222
2222
  display: flex;
2223
2223
  flex-direction: column;
2224
2224
  align-items: center;
@@ -2226,7 +2226,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2226
2226
  margin-left: 27px;
2227
2227
  margin-right: 27px;
2228
2228
  gap: 24px;
2229
- `,T0=Sd.default.div`
2229
+ `,P0=Sd.default.div`
2230
2230
  display: flex;
2231
2231
  flex-direction: column;
2232
2232
  justify-content: center;
@@ -2249,55 +2249,55 @@ You will need this password to access your ${e} wallet on a new device. Please k
2249
2249
  left: -19px;
2250
2250
  top: -19px;
2251
2251
  }
2252
- `;var Ca=require("react"),kg=y(require("styled-components"));var _g=require("react-device-detect");var Ag=(e,t)=>{let r=new URL(window.location.href),o=encodeURIComponent(r.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!So()&&_g.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};var It=require("react/jsx-runtime"),Rg=()=>{let{forkSession:e,ready:t,authenticated:r}=V(),[o,n]=(0,Ca.useState)(""),[a,i]=(0,Ca.useState)(!1);(0,Ca.useEffect)(()=>{t&&r&&e().then(n)},[t,r]);let l=Ag(o,!a),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),a&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),(0,It.jsxs)(It.Fragment,{children:[(0,It.jsx)(k,{},"header"),(0,It.jsx)(X,{}),(0,It.jsx)($r,{title:s.title,description:s.description}),(0,It.jsxs)(pr,{children:[(0,It.jsx)(P0,{children:(0,It.jsx)(Gr,{style:{width:"72px",height:"72px"}})}),(0,It.jsx)(Is,{href:l,onClick:()=>{setTimeout(()=>i(!0),1e3)},loading:t&&!l,children:a?"Go to App Store":"Continue"}),s.footnote?(0,It.jsx)("p",{children:s.footnote}):null]}),(0,It.jsx)(le,{}),(0,It.jsx)(q,{protectedByPrivy:!0})]})},P0=(0,kg.default)(kt)`
2252
+ `;var Ca=require("react"),Rg=y(require("styled-components"));var Ag=require("react-device-detect");var kg=(e,t)=>{let r=new URL(window.location.href),o=encodeURIComponent(r.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!So()&&Ag.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};var It=require("react/jsx-runtime"),Ig=()=>{let{forkSession:e,ready:t,authenticated:r}=V(),[o,n]=(0,Ca.useState)(""),[a,i]=(0,Ca.useState)(!1);(0,Ca.useEffect)(()=>{t&&r&&e().then(n)},[t,r]);let l=kg(o,!a),s={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(s.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",s.footnote="Once you're done, you can always return here and refresh to view your updated account."),a&&(s.title="Still here?",s.description="You may need to install the Phantom mobile app.",s.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),(0,It.jsxs)(It.Fragment,{children:[(0,It.jsx)(k,{},"header"),(0,It.jsx)(X,{}),(0,It.jsx)($r,{title:s.title,description:s.description}),(0,It.jsxs)(pr,{children:[(0,It.jsx)(x0,{children:(0,It.jsx)(Gr,{style:{width:"72px",height:"72px"}})}),(0,It.jsx)(Is,{href:l,onClick:()=>{setTimeout(()=>i(!0),1e3)},loading:t&&!l,children:a?"Go to App Store":"Continue"}),s.footnote?(0,It.jsx)("p",{children:s.footnote}):null]}),(0,It.jsx)(le,{}),(0,It.jsx)(q,{protectedByPrivy:!0})]})},x0=(0,Rg.default)(kt)`
2253
2253
  margin: 16px auto;
2254
- `;var _d=require("@ethersproject/bignumber"),Je=require("react"),En=y(require("styled-components"));function Ig(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}var Fl=require("@ethersproject/bignumber"),Mg=y(require("styled-components"));var oo=require("react/jsx-runtime"),x0=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Fl.BigNumber.from(e.gasUsed),o=Fl.BigNumber.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=Fl.BigNumber.from(t);n=n.add(a)}return n.toString()}catch{return}else return},Wg=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i})=>(0,oo.jsxs)(oo.Fragment,{children:[(0,oo.jsx)(k,{onClose:o}),(0,oo.jsx)($i,{title:"Transaction complete!",description:"You're all set."}),(0,oo.jsx)(Ti,{tokenPrice:n,from:t.from,to:t.to,gas:x0(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),(0,oo.jsx)(S0,{loading:!1,onClick:o,children:"All Done"}),(0,oo.jsx)(ie,{})]}),S0=(0,Mg.default)(U)`
2254
+ `;var _d=require("@ethersproject/bignumber"),Je=require("react"),En=y(require("styled-components"));function Mg(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}var Fl=require("@ethersproject/bignumber"),Wg=y(require("styled-components"));var oo=require("react/jsx-runtime"),S0=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Fl.BigNumber.from(e.gasUsed),o=Fl.BigNumber.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=Fl.BigNumber.from(t);n=n.add(a)}return n.toString()}catch{return}else return},Lg=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i})=>(0,oo.jsxs)(oo.Fragment,{children:[(0,oo.jsx)(k,{onClose:o}),(0,oo.jsx)($i,{title:"Transaction complete!",description:"You're all set."}),(0,oo.jsx)(Ti,{tokenPrice:n,from:t.from,to:t.to,gas:S0(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),(0,oo.jsx)(_0,{loading:!1,onClick:o,children:"All Done"}),(0,oo.jsx)(ie,{})]}),_0=(0,Wg.default)(U)`
2255
2255
  && {
2256
2256
  margin-top: 24px;
2257
2257
  }
2258
2258
  transition: color 350ms ease, background-color 350ms ease;
2259
- `;var be=require("react/jsx-runtime");var _0=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return(0,be.jsx)(fd,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return(0,be.jsx)(fd,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return(0,be.jsx)(be.Fragment,{children:(0,be.jsx)(ng,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},Og=()=>{let{authenticated:e,getAccessToken:t}=V(),{wallets:r}=ki(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:l,nativeTokenSymbolForChainId:s,appId:d}=L(),{app:u,navigate:v,data:h,onUserCloseViaDialogOrKeybindRef:w,setModalData:T}=A(),{transactionRequest:C,onSuccess:S,onFailure:b,uiOptions:x,fundWalletConfig:I}=h.sendTransaction,[W,R]=(0,Je.useState)(null),[H,B]=(0,Je.useState)(null),[G,P]=(0,Je.useState)(""),[J,N]=(0,Je.useState)(),[te,ue]=(0,Je.useState)(!1),se=()=>{P(""),N(void 0)},ae=(zt,ut,Fr)=>{P(zt),N(new Be(new nr(ut??zt,Fr??ft.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[j,Ue]=(0,Je.useState)(!1),[Oe,no]=(0,Je.useState)(!0),[Gt,je]=(0,Je.useState)(null),[Me,Vt]=(0,Je.useState)(C),{tokenPrice:hr,isTokenPriceLoading:To}=Nl(Me),Dr=s(C.chainId)||"ETH",[O,re]=(0,Je.useState)(null),[ne,Li]=(0,Je.useState)(null),[Z,nt]=(0,Je.useState)(!0);(0,Je.useEffect)(()=>{e||(v("LANDING"),b(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let Mt=(0,Je.useMemo)(()=>r.find(zt=>zt.walletClientType==="privy"),[r]),Ko=async()=>{if(!Mt)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:zt,externalTransactionId:ut}=await a(Mt.address,{config:I?.config||{}});T({fiatOnRampPrompt:{signedUrl:zt},fiatOnRampStatus:{externalTransactionId:ut}}),v("FIAT_ON_RAMP_PROMPT_SCREEN")},yr=(0,Je.useMemo)(()=>so(Me.chainId,l,i,{appId:d}),[Me.chainId,i]);(0,Je.useEffect)(()=>{async function zt(){let ut=Me;if(!await t()||!o||!Mt)return;try{ut=await _i(Mt.address,Me,yr),Vt(ut)}catch(Ur){console.error(Ur),ae("There was an error preparing your transaction. Please try again.",Ur.reason)}let Po=_d.BigNumber.from(0),Pa=_d.BigNumber.from(0);try{({totalGasEstimate:Po,l1ExecutionFeeEstimate:Pa}=await Si(ut,yr)),re(Po.toHexString()),Li(Pa.toHexString())}catch{re(null)}try{let{balance:Ur,hasSufficientFunds:ql}=await Ll(Mt.address,ut,Po,yr);je(Ur.toHexString()),ql||(no(!1),ae("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&ue(!0))}catch(Ur){console.warn(`Failed to fetch wallet balance with error: ${Ur}`)}nt(!1)}zt()},[o]);let Yo=Ig(Me),zl=Yo==="SEND"?`Send ${Dr}`:"Review transaction",it={modalTitle:x.header||x.modalTitle||zl,buttonText:x.buttonText||"Submit"},Jo=()=>{j||(H?S(H):b(J||new Be(new nr("The user rejected the request",ft.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return w.current=Jo,hr===void 0&&To||Z?(0,be.jsxs)(be.Fragment,{children:[x.transactionInfo?.contractInfo?.imgUrl&&(0,be.jsx)(ns,{src:x.transactionInfo?.contractInfo?.imgUrl}),(0,be.jsx)(k,{title:it.modalTitle,onClose:Jo}),(0,be.jsx)(Lg,{children:(0,be.jsx)(ri,{})})]}):W!==null?(0,be.jsx)(Wg,{txn:Me,onClose:Jo,receipt:W,transactionInfo:x.transactionInfo,tokenPrice:hr,tokenSymbol:Dr,l1GasEstimate:ne}):(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(k,{title:it.modalTitle,onClose:Jo}),(0,be.jsxs)(Lg,{children:[(0,be.jsxs)(I0,{children:[(0,be.jsx)(_0,{txn:Me,txnFamily:Yo,uiOptions:x,tokenSymbol:Dr,tokenPrice:hr}),Mt?(0,be.jsx)(Ti,{from:Mt.address,to:Me.to,txn:Me,transactionInfo:x.transactionInfo,gas:O||void 0,tokenPrice:hr,tokenSymbol:Dr}):null]}),(0,be.jsxs)(M0,{children:[(0,be.jsx)(A0,{children:G}),(0,be.jsx)(rg,{txn:Me,address:Mt?.address??"",hasFunds:Oe,balance:Gt}),(0,be.jsxs)(k0,{children:[te&&(0,be.jsx)(U,{onClick:Ko,children:"Add Funds"}),(0,be.jsx)(R0,{disabled:j||!Oe,loading:!o||j,loadingText:j?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Ue(!0);let zt=await t();if(zt&&!j&&Mt)try{let ut=await Wl(zt,Mt.address,o,Me,yr);B(ut);let Fr=await ut.wait();R(Ol(Fr)),se()}catch(ut){let Fr="There was an error processing your transaction. Please contact support.";console.warn({transaction:Me,error:ut}),ae(Fr,ut.reason)}finally{Ue(!1)}},children:it.buttonText})]})]})]})]})},Lg=En.default.div`
2259
+ `;var be=require("react/jsx-runtime");var A0=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return(0,be.jsx)(fd,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return(0,be.jsx)(fd,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return(0,be.jsx)(be.Fragment,{children:(0,be.jsx)(ig,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},Ng=()=>{let{authenticated:e,getAccessToken:t}=V(),{wallets:r}=ki(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:l,nativeTokenSymbolForChainId:s,appId:d}=L(),{app:u,navigate:v,data:h,onUserCloseViaDialogOrKeybindRef:w,setModalData:T}=A(),{transactionRequest:C,onSuccess:S,onFailure:b,uiOptions:x,fundWalletConfig:I}=h.sendTransaction,[W,R]=(0,Je.useState)(null),[H,B]=(0,Je.useState)(null),[G,P]=(0,Je.useState)(""),[J,N]=(0,Je.useState)(),[te,ue]=(0,Je.useState)(!1),se=()=>{P(""),N(void 0)},ae=(zt,ut,Fr)=>{P(zt),N(new Be(new nr(ut??zt,Fr??ft.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[j,Ue]=(0,Je.useState)(!1),[Oe,no]=(0,Je.useState)(!0),[Gt,je]=(0,Je.useState)(null),[Me,Vt]=(0,Je.useState)(C),{tokenPrice:hr,isTokenPriceLoading:To}=Nl(Me),Dr=s(C.chainId)||"ETH",[O,re]=(0,Je.useState)(null),[ne,Li]=(0,Je.useState)(null),[Z,nt]=(0,Je.useState)(!0);(0,Je.useEffect)(()=>{e||(v("LANDING"),b(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let Mt=(0,Je.useMemo)(()=>r.find(zt=>zt.walletClientType==="privy"),[r]),Ko=async()=>{if(!Mt)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:zt,externalTransactionId:ut}=await a(Mt.address,{config:I?.config||{}});T({fiatOnRampPrompt:{signedUrl:zt},fiatOnRampStatus:{externalTransactionId:ut}}),v("FIAT_ON_RAMP_PROMPT_SCREEN")},yr=(0,Je.useMemo)(()=>so(Me.chainId,l,i,{appId:d}),[Me.chainId,i]);(0,Je.useEffect)(()=>{async function zt(){let ut=Me;if(!await t()||!o||!Mt)return;try{ut=await _i(Mt.address,Me,yr),Vt(ut)}catch(Ur){console.error(Ur),ae("There was an error preparing your transaction. Please try again.",Ur.reason)}let Po=_d.BigNumber.from(0),Pa=_d.BigNumber.from(0);try{({totalGasEstimate:Po,l1ExecutionFeeEstimate:Pa}=await Si(ut,yr)),re(Po.toHexString()),Li(Pa.toHexString())}catch{re(null)}try{let{balance:Ur,hasSufficientFunds:ql}=await Ll(Mt.address,ut,Po,yr);je(Ur.toHexString()),ql||(no(!1),ae("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&ue(!0))}catch(Ur){console.warn(`Failed to fetch wallet balance with error: ${Ur}`)}nt(!1)}zt()},[o]);let Yo=Mg(Me),zl=Yo==="SEND"?`Send ${Dr}`:"Review transaction",it={modalTitle:x.header||x.modalTitle||zl,buttonText:x.buttonText||"Submit"},Jo=()=>{j||(H?S(H):b(J||new Be(new nr("The user rejected the request",ft.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return w.current=Jo,hr===void 0&&To||Z?(0,be.jsxs)(be.Fragment,{children:[x.transactionInfo?.contractInfo?.imgUrl&&(0,be.jsx)(ns,{src:x.transactionInfo?.contractInfo?.imgUrl}),(0,be.jsx)(k,{title:it.modalTitle,onClose:Jo}),(0,be.jsx)(Og,{children:(0,be.jsx)(ri,{})})]}):W!==null?(0,be.jsx)(Lg,{txn:Me,onClose:Jo,receipt:W,transactionInfo:x.transactionInfo,tokenPrice:hr,tokenSymbol:Dr,l1GasEstimate:ne}):(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(k,{title:it.modalTitle,onClose:Jo}),(0,be.jsxs)(Og,{children:[(0,be.jsxs)(M0,{children:[(0,be.jsx)(A0,{txn:Me,txnFamily:Yo,uiOptions:x,tokenSymbol:Dr,tokenPrice:hr}),Mt?(0,be.jsx)(Ti,{from:Mt.address,to:Me.to,txn:Me,transactionInfo:x.transactionInfo,gas:O||void 0,tokenPrice:hr,tokenSymbol:Dr}):null]}),(0,be.jsxs)(W0,{children:[(0,be.jsx)(k0,{children:G}),(0,be.jsx)(og,{txn:Me,address:Mt?.address??"",hasFunds:Oe,balance:Gt}),(0,be.jsxs)(R0,{children:[te&&(0,be.jsx)(U,{onClick:Ko,children:"Add Funds"}),(0,be.jsx)(I0,{disabled:j||!Oe,loading:!o||j,loadingText:j?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Ue(!0);let zt=await t();if(zt&&!j&&Mt)try{let ut=await Wl(zt,Mt.address,o,Me,yr);B(ut);let Fr=await ut.wait();R(Ol(Fr)),se()}catch(ut){let Fr="There was an error processing your transaction. Please contact support.";console.warn({transaction:Me,error:ut}),ae(Fr,ut.reason)}finally{Ue(!1)}},children:it.buttonText})]})]})]})]})},Og=En.default.div`
2260
2260
  display: flex;
2261
2261
  flex-direction: column;
2262
2262
  justify-content: space-between;
2263
2263
  flex-grow: 1;
2264
2264
  padding-bottom: 16px;
2265
- `,A0=En.default.div`
2265
+ `,k0=En.default.div`
2266
2266
  font-size: 13px;
2267
2267
  color: var(--privy-color-error);
2268
2268
  width: 100%;
2269
2269
  margin-top: 16px;
2270
- `,k0=En.default.div`
2270
+ `,R0=En.default.div`
2271
2271
  display: flex;
2272
2272
  direction: row;
2273
2273
  justify-content: space-between;
2274
2274
  align-items: center;
2275
2275
  gap: 8px;
2276
- `,R0=(0,En.default)(U)`
2276
+ `,I0=(0,En.default)(U)`
2277
2277
  transition: color 350ms ease, background-color 350ms ease;
2278
- `,I0=En.default.div`
2278
+ `,M0=En.default.div`
2279
2279
  height: 100%;
2280
2280
  display: flex;
2281
2281
  flex-direction: column;
2282
2282
  justify-content: space-evenly;
2283
2283
  flex-grow: 1;
2284
- `,M0=En.default.div`
2284
+ `,W0=En.default.div`
2285
2285
  display: flex;
2286
2286
  flex-direction: column;
2287
2287
  gap: 8px;
2288
- `;var Ng=require("@ethersproject/bytes"),Dg=require("@ethersproject/strings"),jo=require("react"),Or=y(require("styled-components"));var ve=require("react/jsx-runtime"),W0=e=>{if(!(0,Ng.isHexString)(e))return e;try{return(0,Dg.toUtf8String)(e)}catch{return e}},L0=e=>JSON.stringify(e,null,2),O0=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?(0,ve.jsx)(B0,{children:Object.entries(r).map(([o,n])=>(0,ve.jsxs)("li",{children:[(0,ve.jsxs)("strong",{children:[o,":"]})," ",t(n)]},o))}):(0,ve.jsx)("span",{children:String(r)});return(0,ve.jsx)("div",{children:t(e)})},N0=e=>{let{types:t,primaryType:r,...o}=e.typedData;return(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(Ug,{children:(0,ve.jsx)(O0,{data:o})}),(0,ve.jsx)(Go,{text:L0(e.typedData),itemName:"full payload to clipboard"})," "]})},Fg=()=>{let{authenticated:e}=V(),{initializeWalletProxy:t,closePrivyModal:r}=L(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=A(),[i,l]=(0,jo.useState)(!0),[s,d]=(0,jo.useState)(""),[u,v]=(0,jo.useState)(),[h,w]=(0,jo.useState)(null),T=h!==null;(0,jo.useEffect)(()=>{e||o("LANDING")},[e]),(0,jo.useEffect)(()=>{t(An).then(B=>{l(!1),B||(d("An error has occurred, please try again."),v(new Be(new nr(s,ft.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:C,data:S,confirmAndSign:b,onSuccess:x,onFailure:I,uiOptions:W}=n.signMessage,R={title:W.title||"Sign message",description:W.description||"Signing this message will not cost you any fees.",buttonText:W.buttonText||"Sign and continue"},H=B=>{B?x(B):I(u||new Be(new nr("The user rejected the request.",ft.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),w(null),d(""),v(void 0)};return a.current=()=>{H(h)},(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(k,{onClose:()=>H(h)}),(0,ve.jsx)(X,{}),(0,ve.jsxs)(D0,{children:[(0,ve.jsx)(F0,{children:R.title}),(0,ve.jsx)(U0,{children:R.description}),C==="personal_sign"&&(0,ve.jsx)(Ug,{children:W0(S)}),C==="eth_signTypedData_v4"&&(0,ve.jsx)(N0,{typedData:S}),(0,ve.jsx)(H0,{fail:!0,children:s}),(0,ve.jsx)(V0,{success:T,loading:i,disabled:T,onClick:async()=>{try{let B=await b();w(B),d(""),setTimeout(()=>{H(B)},at)}catch{d("An error has occurred, please try again."),v(new Be(new nr(s,ft.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:T?(0,ve.jsxs)(G0,{children:[(0,ve.jsx)(Js,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",(0,ve.jsx)("span",{children:"Success"})]}):R.buttonText})]}),(0,ve.jsx)(le,{}),(0,ve.jsx)(q,{protectedByPrivy:!0})]})},D0=Or.default.div`
2288
+ `;var Dg=require("@ethersproject/bytes"),Fg=require("@ethersproject/strings"),jo=require("react"),Or=y(require("styled-components"));var ve=require("react/jsx-runtime"),L0=e=>{if(!(0,Dg.isHexString)(e))return e;try{return(0,Fg.toUtf8String)(e)}catch{return e}},O0=e=>JSON.stringify(e,null,2),N0=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?(0,ve.jsx)(H0,{children:Object.entries(r).map(([o,n])=>(0,ve.jsxs)("li",{children:[(0,ve.jsxs)("strong",{children:[o,":"]})," ",t(n)]},o))}):(0,ve.jsx)("span",{children:String(r)});return(0,ve.jsx)("div",{children:t(e)})},D0=e=>{let{types:t,primaryType:r,...o}=e.typedData;return(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(Bg,{children:(0,ve.jsx)(N0,{data:o})}),(0,ve.jsx)(Go,{text:O0(e.typedData),itemName:"full payload to clipboard"})," "]})},Ug=()=>{let{authenticated:e}=V(),{initializeWalletProxy:t,closePrivyModal:r}=L(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=A(),[i,l]=(0,jo.useState)(!0),[s,d]=(0,jo.useState)(""),[u,v]=(0,jo.useState)(),[h,w]=(0,jo.useState)(null),T=h!==null;(0,jo.useEffect)(()=>{e||o("LANDING")},[e]),(0,jo.useEffect)(()=>{t(An).then(B=>{l(!1),B||(d("An error has occurred, please try again."),v(new Be(new nr(s,ft.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:C,data:S,confirmAndSign:b,onSuccess:x,onFailure:I,uiOptions:W}=n.signMessage,R={title:W.title||"Sign message",description:W.description||"Signing this message will not cost you any fees.",buttonText:W.buttonText||"Sign and continue"},H=B=>{B?x(B):I(u||new Be(new nr("The user rejected the request.",ft.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),w(null),d(""),v(void 0)};return a.current=()=>{H(h)},(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsx)(k,{onClose:()=>H(h)}),(0,ve.jsx)(X,{}),(0,ve.jsxs)(F0,{children:[(0,ve.jsx)(U0,{children:R.title}),(0,ve.jsx)(B0,{children:R.description}),C==="personal_sign"&&(0,ve.jsx)(Bg,{children:L0(S)}),C==="eth_signTypedData_v4"&&(0,ve.jsx)(D0,{typedData:S}),(0,ve.jsx)(G0,{fail:!0,children:s}),(0,ve.jsx)(z0,{success:T,loading:i,disabled:T,onClick:async()=>{try{let B=await b();w(B),d(""),setTimeout(()=>{H(B)},at)}catch{d("An error has occurred, please try again."),v(new Be(new nr(s,ft.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:T?(0,ve.jsxs)(V0,{children:[(0,ve.jsx)(Js,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",(0,ve.jsx)("span",{children:"Success"})]}):R.buttonText})]}),(0,ve.jsx)(le,{}),(0,ve.jsx)(q,{protectedByPrivy:!0})]})},F0=Or.default.div`
2289
2289
  display: flex;
2290
2290
  flex-direction: column;
2291
2291
  align-items: center;
2292
2292
  justify-content: center;
2293
- `,F0=Or.default.span`
2293
+ `,U0=Or.default.span`
2294
2294
  color: var(--privy-color-foreground);
2295
2295
  text-align: center;
2296
2296
  font-size: 1.125rem;
2297
2297
  font-weight: 500;
2298
2298
  line-height: 1.25rem; /* 111.111% */
2299
2299
  text-align: center;
2300
- `,U0=Or.default.span`
2300
+ `,B0=Or.default.span`
2301
2301
  margin-top: 4px;
2302
2302
  color: var(--privy-color-foreground);
2303
2303
  text-align: center;
@@ -2307,7 +2307,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2307
2307
  font-weight: 400;
2308
2308
  line-height: 20px; /* 142.857% */
2309
2309
  letter-spacing: -0.008px;
2310
- `,Ug=Or.default.div`
2310
+ `,Bg=Or.default.div`
2311
2311
  margin-top: 1.5rem;
2312
2312
  background-color: var(--privy-color-background-2);
2313
2313
  border-radius: var(--privy-border-radius-md);
@@ -2326,7 +2326,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2326
2326
  display: none; /* Safari and Chrome */
2327
2327
  }
2328
2328
  }
2329
- `,B0=Or.default.ul`
2329
+ `,H0=Or.default.ul`
2330
2330
  margin-left: 12px !important;
2331
2331
  white-space: nowrap;
2332
2332
 
@@ -2338,7 +2338,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2338
2338
  font-weight: 500 !important;
2339
2339
  }
2340
2340
  }
2341
- `,H0=Or.default.div`
2341
+ `,G0=Or.default.div`
2342
2342
  line-height: 20px;
2343
2343
  height: 20px;
2344
2344
  font-size: 13px;
@@ -2348,11 +2348,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
2348
2348
  width: 100%;
2349
2349
  margin-top: 16px;
2350
2350
  margin-bottom: 4px;
2351
- `,G0=Or.default.span`
2351
+ `,V0=Or.default.span`
2352
2352
  display: flex;
2353
2353
  align-items: center;
2354
2354
  gap: 8px;
2355
- `,V0=(0,Or.default)(U)`
2355
+ `,z0=(0,Or.default)(U)`
2356
2356
  transition: color 350ms ease, background-color 350ms ease;
2357
2357
 
2358
2358
  ${e=>e.success&&Or.css`
@@ -2361,9 +2361,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
2361
2361
  color: #ffffff;
2362
2362
  }
2363
2363
  `}
2364
- `;var Gg=y(require("@heroicons/react/24/outline/EnvelopeIcon"));var Bg=y(require("@heroicons/react/24/outline/EnvelopeIcon")),ba=require("react"),Ad=y(require("styled-components"));var Nr=require("react/jsx-runtime"),Hg=(0,ba.forwardRef)((e,t)=>{let[r,o]=(0,ba.useState)(""),[n,a]=(0,ba.useState)(!1),{authenticated:i,user:l}=V(),{initUpdateEmail:s}=L(),{navigate:d,setModalData:u,currentScreen:v}=A(),{enabled:h,token:w}=_e(),T=Ba(r),C=n,S=n||!T,b=async I=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");a(!0);try{await s(l.email.address,r,I),d("AWAITING_PASSWORDLESS_CODE")}catch(W){u({errorModalData:{error:W,previousScreen:v||"LANDING"}})}a(!1)},x=()=>{h&&!w&&!i?(u({captchaModalData:{callback:I=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,I)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN")):b(w)};return(0,Nr.jsxs)(Nr.Fragment,{children:[(0,Nr.jsx)(z0,{children:(0,Nr.jsxs)(q0,{children:[(0,Nr.jsx)(Bg.default,{}),(0,Nr.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:I=>o(I.target.value),onKeyUp:I=>{I.key==="Enter"&&x()},value:r,autoComplete:"email"}),e.stacked?null:(0,Nr.jsx)(qn,{isSubmitting:C,onClick:x,disabled:S,children:"Submit"})]})}),e.stacked?(0,Nr.jsx)(U,{loadingText:null,loading:C,disabled:S,onClick:x,children:"Submit"}):null]})}),z0=Ad.default.div`
2364
+ `;var Vg=y(require("@heroicons/react/24/outline/EnvelopeIcon"));var Hg=y(require("@heroicons/react/24/outline/EnvelopeIcon")),ba=require("react"),Ad=y(require("styled-components"));var Nr=require("react/jsx-runtime"),Gg=(0,ba.forwardRef)((e,t)=>{let[r,o]=(0,ba.useState)(""),[n,a]=(0,ba.useState)(!1),{authenticated:i,user:l}=V(),{initUpdateEmail:s}=L(),{navigate:d,setModalData:u,currentScreen:v}=A(),{enabled:h,token:w}=_e(),T=Ba(r),C=n,S=n||!T,b=async I=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");a(!0);try{await s(l.email.address,r,I),d("AWAITING_PASSWORDLESS_CODE")}catch(W){u({errorModalData:{error:W,previousScreen:v||"LANDING"}})}a(!1)},x=()=>{h&&!w&&!i?(u({captchaModalData:{callback:I=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,I)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN")):b(w)};return(0,Nr.jsxs)(Nr.Fragment,{children:[(0,Nr.jsx)(q0,{children:(0,Nr.jsxs)($0,{children:[(0,Nr.jsx)(Hg.default,{}),(0,Nr.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:I=>o(I.target.value),onKeyUp:I=>{I.key==="Enter"&&x()},value:r,autoComplete:"email"}),e.stacked?null:(0,Nr.jsx)(qn,{isSubmitting:C,onClick:x,disabled:S,children:"Submit"})]})}),e.stacked?(0,Nr.jsx)(U,{loadingText:null,loading:C,disabled:S,onClick:x,children:"Submit"}):null]})}),q0=Ad.default.div`
2365
2365
  width: 100%;
2366
- `,q0=Ad.default.label`
2366
+ `,$0=Ad.default.label`
2367
2367
  display: block;
2368
2368
  position: relative;
2369
2369
  width: 100%;
@@ -2421,7 +2421,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2421
2421
  && > input::placeholder {
2422
2422
  color: var(--privy-color-foreground-3);
2423
2423
  }
2424
- `;var tr=require("react/jsx-runtime"),Vg=()=>(0,tr.jsxs)(tr.Fragment,{children:[(0,tr.jsx)(k,{},"header"),(0,tr.jsx)(X,{}),(0,tr.jsx)(Ge,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:(0,tr.jsx)(Gg.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,tr.jsx)(pr,{children:(0,tr.jsx)(Hg,{stacked:!0})}),(0,tr.jsx)(le,{}),(0,tr.jsx)(q,{protectedByPrivy:!0})]});var Ul=y(require("styled-components"));var $0=`
2424
+ `;var tr=require("react/jsx-runtime"),zg=()=>(0,tr.jsxs)(tr.Fragment,{children:[(0,tr.jsx)(k,{},"header"),(0,tr.jsx)(X,{}),(0,tr.jsx)(Ge,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:(0,tr.jsx)(Vg.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,tr.jsx)(pr,{children:(0,tr.jsx)(Gg,{stacked:!0})}),(0,tr.jsx)(le,{}),(0,tr.jsx)(q,{protectedByPrivy:!0})]});var Ul=y(require("styled-components"));var j0=`
2425
2425
  *,
2426
2426
  ::before,
2427
2427
  ::after {
@@ -2651,7 +2651,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2651
2651
  [hidden] {
2652
2652
  display: none;
2653
2653
  }
2654
- `,zg=$0;var qg=Ul.createGlobalStyle`
2654
+ `,qg=j0;var $g=Ul.createGlobalStyle`
2655
2655
  :root {
2656
2656
  // Borders
2657
2657
  --privy-border-radius-sm: 6px;
@@ -2683,10 +2683,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
2683
2683
  --privy-height-modal-full: 620px;
2684
2684
  --privy-height-modal-compact: 480px;
2685
2685
  };
2686
- `,$g=Ul.default.div`
2686
+ `,jg=Ul.default.div`
2687
2687
  // css normalize only the privy application to avoid conflicts
2688
2688
  // with consuming application
2689
- ${zg}
2689
+ ${qg}
2690
2690
 
2691
2691
  // Privy styles
2692
2692
  color: var(--privy-color-foreground-2);
@@ -2745,4 +2745,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
2745
2745
  opacity: 1;
2746
2746
  }
2747
2747
  }
2748
- `;var qe=require("react/jsx-runtime"),j0={["LANDING"]:my,["CONNECT_OR_CREATE"]:uy,["AWAITING_PASSWORDLESS_CODE"]:um,["AWAITING_CONNECTION"]:Fm,["AWAITING_CONNECT_ONLY_CONNECTION"]:Hm,["AWAITING_FARCASTER_CONNECTION"]:mh,["AWAITING_FARCASTER_SIGNER"]:vh,["PHANTOM_INTERSTITIAL_SCREEN"]:Rg,["LOGIN_FAILED_SCREEN"]:Cy,["AWAITING_OAUTH_SCREEN"]:Sg,["ALLOWLIST_REJECTION_SCREEN"]:tm,["INSTALL_PHANTOM_SCREEN"]:Bh,["LINK_EMAIL_SCREEN"]:hy,["LINK_PHONE_SCREEN"]:gy,["LINK_WALLET_SCREEN"]:vy,["UPDATE_EMAIL_SCREEN"]:Vg,["CONNECT_ONLY_LANDING_SCREEN"]:Om,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:km,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Hf,["EMBEDDED_WALLET_CREATED_SCREEN"]:Jm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:jm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Kf,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:tf,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Fg,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Og,["FIAT_ON_RAMP_PROMPT_SCREEN"]:_h,["FIAT_ON_RAMP_STATUS_SCREEN"]:Mh,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:$f,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Gf,["MFA_ENROLLMENT_FLOW_SCREEN"]:Dy,["CAPTCHA_SCREEN"]:Cm,["ERROR_SCREEN"]:Zf,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Oh,["AFFIRMATIVE_CONSENT_SCREEN"]:Xu},K0=["LANDING","AWAITING_CONNECTION"],Y0=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=V(),{headless:n}=L(),{ready:a,currentScreen:i}=A(),{status:l,execute:s,reset:d,enabled:u}=_e(),v=(0,Eo.useRef)(null),h=Uu(v),w=o&&i&&K0.includes(i)&&!n&&l==="ready";if((0,Eo.useEffect)(()=>{w&&s()},[w]),(0,Eo.useEffect)(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return(0,qe.jsxs)(wi,{id:"privy-modal-content",children:[(0,qe.jsx)(k,{}),(0,qe.jsx)(X,{}),(0,qe.jsx)(Ey,{children:(0,qe.jsx)(Lt,{})}),(0,qe.jsx)(le,{}),(0,qe.jsx)(ie,{})]});if(!i&&e)return(0,qe.jsx)(wi,{style:{height:h},id:"privy-modal-conent",children:(0,qe.jsx)("div",{ref:v,children:(0,qe.jsx)(xd,{open:e,onClose:t})})});if(!i)return null;let T=j0[i];return(0,qe.jsx)(wi,{style:{height:h},id:"privy-modal-content",children:(0,qe.jsxs)("div",{ref:v,children:[(0,qe.jsx)(uo,{if:!!e,children:(0,qe.jsx)(T,{})}),(0,qe.jsx)(uo,{if:!e,children:(0,qe.jsx)(xd,{open:e,onClose:t})})]})})},J0=()=>{let{closePrivyModal:e}=L(),{onUserCloseViaDialogOrKeybindRef:t}=A();return{gracefulClosePrivyModal:(0,Eo.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Kg=({open:e})=>{let{app:t}=A(),{gracefulClosePrivyModal:r}=J0(),[o,n]=(0,Eo.useState)(!1);As({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=(0,qe.jsx)($g,{children:(0,qe.jsx)(Y0,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?(0,qe.jsx)(by,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:a}):a;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return jg.default.createPortal(l,s)}return l};var Yg=require("react"),Mi=require("react");var Bl=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:submit-cast":return o;case"privy:farcaster:remove-cast":return o;case"privy:farcaster:react-to-cast":return o;case"privy:farcaster:submit-link":return o;case"privy:farcaster:remove-link":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Tn(e,t,r,o,n,a=!1){let i=a,l=async u=>{if(i&&t&&t.length>0){u===(a?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new ke("missing_or_invalid_mfa","MFA verification failed, retry."));let v=await new Promise((h,w)=>{r.current={resolve:h,reject:w};let T=1e3*60*5;setTimeout(()=>{let C=new ke("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(C),w(C)},T)});return await e(v)}return await e()},s=4,d=null;for(let u=0;u<s;u++)try{d=await l(u),o.current?.resolve(void 0);break}catch(v){if(v.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),v}if(d===null){let u=new ke("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return d}var Zg=require("react/jsx-runtime"),Z0=function(e){return()=>`id-${e++}`}(0);function Q0(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function dt(e){return e.error!==void 0}var ot=new Bl,kd=new Map,X0=(e,t)=>typeof t=="bigint"?t.toString():t,e2=(e,t)=>`${e}${JSON.stringify(t,X0)}`;function pt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=e2(e,t);if(e==="privy:wallet:create"){let l=kd.get(a);if(l)return l}let i=new Promise((l,s)=>{let d=Z0();ot.enqueue(d,{resolve:l,reject:s}),n.postMessage({id:d,event:e,data:t},o)}).finally(()=>{kd.delete(a)});return kd.set(a,i),i}function t2(e){switch(e.event){case"privy:iframe:ready":let t=ot.dequeue(e.event,e.id);return dt(e)?t.reject(new ke(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=ot.dequeue(e.event,e.id);return dt(e)?r.reject(new ke(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=ot.dequeue(e.event,e.id);return dt(e)?o.reject(new ke(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=ot.dequeue(e.event,e.id);return dt(e)?n.reject(new ke(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=ot.dequeue(e.event,e.id);return dt(e)?a.reject(new ke(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=ot.dequeue(e.event,e.id);return dt(e)?i.reject(new ke(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=ot.dequeue(e.event,e.id);return dt(e)?l.reject(new ke(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Jg(e){let t=(0,Mi.useRef)(null),r=(0,Mi.useRef)(e.mfaMethods),o=Gu(),[n,a]=(0,Yg.useState)(!1);return(0,Mi.useEffect)(()=>{r.current=e.mfaMethods},[e.mfaMethods]),(0,Mi.useEffect)(()=>{if(!n)return;let i=t.current;if(!i)return;function l(h){h&&h.origin===e.origin&&Q0(h.data)&&t2(h.data)}let s={create(h){return pt("privy:wallet:create",h,i,e.origin)},connect(h){return pt("privy:wallet:connect",h,i,e.origin)},recover(h){return Tn(w=>pt("privy:wallet:recover",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(h){return Tn(w=>pt("privy:wallet:rpc",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(h){return Tn(w=>pt("privy:wallet:set-recovery-password",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(h){return Tn(w=>pt("privy:mfa:verify",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(h){return Tn(w=>pt("privy:mfa:init-enrollment",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(h){return pt("privy:mfa:submit-enrollment",h,i,e.origin)},unenrollMfa(h){return Tn(w=>pt("privy:mfa:unenroll",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(h){return pt("privy:mfa:clear",h,i,e.origin)},initFarcasterSigner(h){return pt("privy:farcaster:init-signer",h,i,e.origin)},submitCast(h){return pt("privy:farcaster:submit-cast",h,i,e.origin)},removeCast(h){return pt("privy:farcaster:remove-cast",h,i,e.origin)},reactToCast(h){return pt("privy:farcaster:react-to-cast",h,i,e.origin)},submitLink(h){return pt("privy:farcaster:submit-link",h,i,e.origin)},removeLink(h){return pt("privy:farcaster:remove-link",h,i,e.origin)}};window.addEventListener("message",l);let d=()=>e.onLoad(s),u=(...h)=>{console.warn("Privy iframe failed to load: ",...h),e.onLoadFailed()},v=new AbortController;return Rp(()=>pt("privy:iframe:ready",{},i,e.origin),{abortSignal:v.signal}).then(d,u),()=>{window.removeEventListener("message",l),v.abort()}},[n]),(0,Zg.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Ha(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Hl(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var Gl=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new _("action required");if(!this.api)throw new _("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new _("phone number must be set when initialzing authentication.");try{await this.api.post(cp,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw we(t)}}async authenticate(){if(!this.meta.action)throw new _("action required");if(!this.api)throw new _("Mfa flow has no API instance");if(!this.meta.smsCode)throw new _("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new _("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(dp,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return $t(t)}catch(t){throw we(t)}}};var Ht=require("react/jsx-runtime"),Wi;function r2(e){return typeof e=="string"&&e.length===25}function Se(){if(!Wi){let e=Q.get(Zo);return Promise.resolve(e||null)}return Wi.getAccessToken()}var Xg,Yp=(e,t)=>Xg(e,t),e1,Jp=(e,t)=>e1(e,t),t1,Zp=(e,t)=>t1(e,t),r1,Qp=()=>r1(),o2=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Q.put(Oi,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},o1=({config:e,...t})=>{if(!r2(t.appId))throw new _("Cannot initialize the Privy provider with an invalid Privy app ID");Wi||(Wi=new Vn({appId:t.appId,apiUrl:t.apiUrl||Oa}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),(0,Ht.jsx)(Pu,{client:Wi,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,Ht.jsx)(n2,{...t,config:r,client:Wi})})},n2=e=>{let t=e.client,[r,o]=(0,ee.useState)(!1),[n,a]=(0,ee.useState)(!1),[i,l]=(0,ee.useState)(!1),[s,d]=(0,ee.useState)(null),[u,v]=(0,ee.useState)([]),h=(0,ee.useRef)(u),[w,T]=(0,ee.useState)(!1),[C,S]=(0,ee.useState)(null),[b,x]=(0,ee.useState)(!1),[I,W]=(0,ee.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[R,H]=(0,ee.useState)(null),[B,G]=(0,ee.useState)(null),[P,J]=(0,ee.useState)(null),N=gs(),te=vs(),[ue,se]=(0,ee.useState)(!0),[ae,j]=(0,ee.useState)({}),[Ue,Oe]=(0,ee.useState)(null),[no,Gt]=(0,ee.useState)(null),[je,Me]=(0,ee.useState)(!1),[Vt,hr]=(0,ee.useState)(!1),To=(0,ee.useRef)(null),Dr=(0,ee.useRef)(null),O=(0,ee.useRef)(Bu);t.onStoreToken=c=>{c&&D(O,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{D(O,"accessToken","onAccessTokenRemoved")};let re=(0,ee.useRef)(null),ne=(0,ee.useRef)(null),Li=(0,ee.useCallback)(c=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(g=>g.type==="wallet"&&g.walletClientType==="privy")?p&&c?.some(g=>g?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),Z=c=>{S(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:c})},nt=c=>{N.embeddedWallets.createOnLogin!=="off"&&se(!0),Z(c)};(0,ee.useEffect)(()=>{if(!P||!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(c&&c.length>0){let p=c[0].address;t.connectors?.addEmbeddedWalletConnector(P,p,N.defaultChain,e.appId)}},[P,s]),(0,ee.useEffect)(()=>{P&&no?.(P)},[P]),(0,ee.useEffect)(()=>{(async()=>{if(!N.customAuth?.enabled)return;se(!0);let{getCustomAccessToken:p,isLoading:f}=N.customAuth;if(!(!n||f))try{let g=await p();if(!g&&i){await Pn.logout();return}if(!g||i)return;t.startAuthFlow(new Sn(g));let{user:M,isNewUser:F}=await t.authenticate();if(!M){await Pn.logout();return}d(M||null),T(F||!1),l(!0),hr(!0)}catch(g){console.warn(g),i&&await Pn.logout()}})()},[N.customAuth?.enabled,N.customAuth?.getCustomAccessToken,N.customAuth?.isLoading,n,i]),(0,ee.useEffect)(()=>{Vt&&P&&s&&or(s,e.config?.embeddedWallets?.createOnLogin)&&(hr(!1),Ur(s,An).catch(console.error))},[Vt&&P&&s]),(0,ee.useEffect)(()=>{async function c(){let p=Mt();o2();let f=(0,Qg.createStore)();H(f),t.initializeConnectorManager({walletConnectCloudProjectId:N.walletConnectCloudProjectId,rpcConfig:N.rpcConfig,chains:N.chains,defaultChain:N.defaultChain,store:f,walletList:N.appearance.walletList,shouldEnforceDefaultChainOnConnect:N.shouldEnforceDefaultChainOnConnect,appName:N.name??"Privy"}),t.connectors?.initialize().then(()=>{zl()});let g=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!g),g&&D(O,"login","onComplete",g,!1,!0,null),d(g)),p||pe.setReadyToTrue(),p&&(g?ne.current="link":ne.current="login")}!n&&te&&c()},[t,Ue,n,te]);let Mt=()=>{let c=Ui();return!c.inProgress||c.headless?!1:(t.startAuthFlow(new Hr(c)),nt("AWAITING_OAUTH_SCREEN"),!0)},Ko=async(c,p,f,g)=>{let M=await t.connectors?.createWalletConnector(c,p)||null;yr(M,p,f,g)};async function yr(c,p,f,g){if(c)W({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:E});else return W({status:"disconnected",connectedWallet:null,connectError:new oe("Unable to connect to wallet."),connector:null,connectRetry:E}),g?.(null,f);c instanceof zr&&p&&await c.resetConnection(p),W({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>yr(c,p,f,g)});try{let M=await c.connect({showPrompt:!0});if(N.shouldEnforceDefaultChainOnConnect&&!N.chains.find(F=>F.id===Number(M?.chainId))&&!(M?.connectorType==="wallet_connect_v2"&&M?.walletClientType==="metamask")){W(F=>({...F,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await M?.switchChain(N.defaultChain.id),M&&(M.chainId=kn(rn(N.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${N.defaultChain.id}`)}}return W(F=>({...F,status:"connected",connectedWallet:M,connectError:null,connectRetry:E})),M&&!ne.current&&D(O,"connectWallet","onSuccess",M),g?.(M,f)}catch(M){return M instanceof mt?(console.warn(M.cause?M.cause:M.message),ne.current||D(O,"connectWallet","onError",M.privyErrorCode||"generic_connect_wallet_error")):(console.warn(M),ne.current||D(O,"connectWallet","onError","unknown_connect_wallet_error")),W(F=>({...F,status:"disconnected",connectedWallet:null,connectError:M})),g?.(null,f)}}let Yo=async(c,p)=>{if(c===null)return;let f=new on(c,p);t.startAuthFlow(f)},zl=()=>{let c=new URLSearchParams(window.location.search),p=c.get("privy_connector"),f=c.get("privy_wallet_client");if(!p||!f)return;if(f==="phantom"&&!So()&&nt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new _("Connector not initialized");Z("AWAITING_CONNECTION");let g=new URL(window.location.href);g.searchParams.delete("privy_connector"),g.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",g),Ko(p,f,void 0,Yo)};(0,ee.useEffect)(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(d)},[n,i,s,t]);let it=()=>{if(!i)throw D(O,"linkAccount","onError","must_be_authenticated"),new _("User must be authenticated before linking an account.")},Jo=()=>{it(),re.current="siwe",ne.current="link",Z("LINK_WALLET_SCREEN")},zt=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===c.address&&p.walletClientType!=="privy")return!0;return!1},ut=async c=>{if(!t.connectors)throw new _("Connector not initialized");let p=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(W(f=>({...f,connector:p,status:"connected",connectedWallet:c,connectError:null,connectRetry:E})),N.captchaEnabled&&!i){let f={callback:g=>Yo(c,g),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};j({captchaModalData:f}),nt("CAPTCHA_SCREEN")}else await Yo(c),nt("AWAITING_CONNECTION")},Fr=async(c,p)=>{if(!N.fiatOnRamp.enabled)throw new _("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:f,externalTransactionId:g}=await xh(t,c,p?.config??{},N.appearance.palette,N.fiatOnRamp.useSandbox);return{signedUrl:f,externalTransactionId:g}}else throw new _("Unsupported fund provider. Currently supported option is `moonpay`.")},Po=()=>{v(c=>{let p=t.connectors?.wallets.map(f=>({...f,linked:zt(f),loginOrLink:async()=>{if(!await f.isConnected())throw new _("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new _("Cannot link or login with embedded wallet");ut(f)},fund:async g=>{let{signedUrl:M,externalTransactionId:F}=await Fr(f.address,g);j({fiatOnRampPrompt:{signedUrl:M},fiatOnRampStatus:{externalTransactionId:F}}),Z("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new _("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new _("Cannot unlink an embedded wallet");let g=await t.unlinkWallet(f.address);d(g)}}))||[];return Me(Li(p)),Ja(c,p)?c:p})};(0,ee.useEffect)(()=>{Po()},[s?.linkedAccounts,i,n]),(0,ee.useEffect)(()=>{if(n){if(!t.connectors)throw new _("Connector not initialized");Po(),t.connectors.on("walletsUpdated",Po)}},[n]);let Pa=()=>{Z(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,ee.useEffect)(()=>{if(!u[0])return;let c=u[0],p=h.current.find(g=>g.address===c.address),f;if(c.walletClientType==="privy"?f=s?.linkedAccounts.find(g=>g.type==="wallet"&&g.address===c.address&&g.walletClientType==="privy"):f=s?.linkedAccounts.find(g=>g.type==="wallet"&&g.address===c.address&&g.walletClientType!=="privy"),!p&&f){let g=Object.assign({},s);g.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},d(g)}h.current=u},[u]);let Ur=async(c,p)=>{if(Ne(c))throw D(O,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[g,M]=await Promise.all([pe.initializeWalletProxy(p),Se()]);if(!g&&e.config?.customAuth?.enabled)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!g||!M||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((F,me)=>{se(!0),j({createWallet:{onSuccess:Wt=>{D(O,"createWallet","onSuccess",Wt),F(Wt)},onFailure:Wt=>{D(O,"createWallet","onError","unknown_embedded_wallet_error"),me(Wt)},callAuthOnSuccessOnClose:!1}}),Z("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await g.create({accessToken:M});let F=await pe.refreshUser(),me=Ne(F);if(!me)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return D(O,"createWallet","onSuccess",me),me}},ql=c=>{if(!N.chains.map(p=>p.id).includes(c))throw new oe(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Md=(c,p,f)=>new Promise(async(g,M)=>{if(!i||!s){D(O,"sendTransaction","onError","must_be_authenticated"),M(new Error("User must be authenticated before signing with a Privy wallet"));return}let F=Ne(s);if(!F){D(O,"sendTransaction","onError","embedded_wallet_not_found"),M(new Error("Must have a Privy wallet before signing"));return}se(!0);let me=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,bt=c.chainId?Number(c.chainId):me.chainId;ql(bt);let Wt=Object.assign({},c,{chainId:bt}),io=async()=>{let Et=await Se();if(!Et||!P){D(O,"sendTransaction","onError","embedded_wallet_not_found"),M(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await pe.recoverEmbeddedWallet()){D(O,"sendTransaction","onError","unknown_connect_wallet_error"),M(new Error("Unable to connect to wallet"));return}let wr=so(Wt.chainId,N.chains,N.rpcConfig,{appId:e.appId}),$l=await _i(F.address,Wt,wr);if(N.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:W1}=await Si($l,wr),{hasSufficientFunds:L1}=await Ll(F.address,$l,W1,wr);if(!L1)throw new Be(new nr("Wallet has insufficient funds for this transaction.",ft.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Od=await Wl(Et,F.address,P,$l,wr);D(O,"sendTransaction","onSuccess",Od),g(Od)}catch(vr){D(O,"sendTransaction","onError","transaction_failure"),M(vr)}};if(N.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),io();else{let Et={transactionRequest:Wt,onSuccess:wr=>{D(O,"sendTransaction","onSuccess",wr),g(wr)},onFailure:wr=>{D(O,"sendTransaction","onError","transaction_failure"),M(wr)},uiOptions:p||{},fundWalletConfig:f},vr={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:wr=>{D(O,"sendTransaction","onError","unknown_connect_wallet_error"),M(wr)}};j({connectWallet:vr,sendTransaction:Et}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Wd(){return new Promise(async(c,p)=>{let f=await Se();if(!f||!P)throw new Error("Must have valid access token to enroll in MFA");try{await P.verifyMfa({accessToken:f}),c()}catch(g){p(g)}})}let gr=c=>{if(s?.[c])throw D(O,"linkAccount","onError","cannot_link_more_of_type"),new _(`User already has an account of type ${c} linked.`)},Pn={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:Pa,linkWallet:Jo,linkEmail:()=>{it(),gr("email"),re.current="email",ne.current="link",Z("LINK_EMAIL_SCREEN")},linkPhone:()=>{it(),gr("phone"),re.current="sms",ne.current="link",Z("LINK_PHONE_SCREEN")},linkGoogle:async()=>{it(),gr("google"),ne.current="link",await pe.initLoginWithOAuth("google")},linkTwitter:async()=>{it(),gr("twitter"),ne.current="link",await pe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{it(),gr("discord"),ne.current="link",await pe.initLoginWithOAuth("discord")},linkGithub:async()=>{it(),gr("github"),ne.current="link",await pe.initLoginWithOAuth("github")},linkSpotify:async()=>{it(),gr("spotify"),ne.current="link",await pe.initLoginWithOAuth("spotify")},linkTiktok:async()=>{it(),gr("tiktok"),ne.current="link",await pe.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{it(),gr("linkedin"),ne.current="link",await pe.initLoginWithOAuth("linkedin")},linkApple:async()=>{it(),gr("apple"),ne.current="link",await pe.initLoginWithOAuth("apple")},linkFarcaster:async()=>{it(),gr("farcaster"),await pe.initLoginWithFarcaster(),ne.current="link",re.current="farcaster",Z("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(it(),!s?.email)throw new _("User does not have an email linked to their account.");ne.current="link",re.current="email",Z("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(c=>{Oe(()=>c)}),Oe(null)),i){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}ne.current="login",nt("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{Oe(()=>c)}),Oe(null)),i){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}nt("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&P)try{await P.clearMfa({userId:s.id})}catch{}d(null),l(!1),S(null),D(O,"logout","onSuccess"),ne.current=null,re.current=null,o(!1),Q.del(Ni)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Le;let c=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===c?.address));return!c||!p?new Le:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Vl.Web3Provider(new br(new Le));let c=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===c?.address));return!c||!p?new Vl.Web3Provider(new br(new Le)):new Vl.Web3Provider(new br(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new ko(new Le);let c=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===c?.address));return!c||!p?new ko(new Le):new ko(p.proxyProvider)},unlinkWallet:async c=>{let p=await t.unlinkWallet(c);return d(p),p},unlinkEmail:async c=>{let p=await t.unlinkEmail(c);return d(p),p},unlinkPhone:async c=>{let p=await t.unlinkPhone(c);return d(p),p},unlinkGoogle:async c=>{let p=await t.unlinkOAuth("google",c);return d(p),p},unlinkTwitter:async c=>{let p=await t.unlinkOAuth("twitter",c);return d(p),p},unlinkDiscord:async c=>{let p=await t.unlinkOAuth("discord",c);return d(p),p},unlinkGithub:async c=>{let p=await t.unlinkOAuth("github",c);return d(p),p},unlinkSpotify:async c=>{let p=await t.unlinkOAuth("spotify",c);return d(p),p},unlinkTiktok:async c=>{let p=await t.unlinkOAuth("tiktok",c);return d(p),p},unlinkLinkedIn:async c=>{let p=await t.unlinkOAuth("linkedin",c);return d(p),p},unlinkApple:async c=>{let p=await t.unlinkOAuth("apple",c);return d(p),p},unlinkFarcaster:async c=>{let p=await t.unlinkFarcaster(c);return d(p),p},setActiveWallet:async c=>{let p=u.find(g=>(0,Ea.getAddress)(g.address)===(0,Ea.getAddress)(c)),f=s?.linkedAccounts.find(g=>g.type==="wallet"&&(0,Ea.getAddress)(g.address)===(0,Ea.getAddress)(c));if(!p||!await p.isConnected())G(c),Jo();else if(!p.linked)p.loginOrLink();else{let g=Object.assign({},s);g.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},d(g)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw D(O,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ur(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw D(O,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let c=Ne(s);if(!c||!P)throw D(O,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(c.recoveryMethod==="user-passcode")throw D(O,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await Wd()}catch(p){throw D(O,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,f)=>{se(!0);let g={onSuccess:F=>{D(O,"setWalletPassword","onSuccess",F),p(F)},onFailure:F=>{D(O,"setWalletPassword","onError","user_exited_set_password_flow"),f(F)},callAuthOnSuccessOnClose:!1},M={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:F=>{D(O,"setWalletPassword","onError","unknown_connect_wallet_error"),f(F)}};j({setWalletPassword:g,connectWallet:M}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(c,p)=>new Promise(async(f,g)=>{if(!i||!s){D(O,"signMessage","onError","must_be_authenticated"),g(new Error("User must be authenticated before signing with a Privy wallet"));return}let M=Ne(s);if(!M){D(O,"signMessage","onError","embedded_wallet_not_found"),g(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){D(O,"signMessage","onError","invalid_message"),g(new Error("Message must be a non-empty string"));return}se(!0);let F=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let me=await Se();if(!P||!me)throw new Error("Unable to connect to wallet");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:M.address});let{response:Wt}=await P.rpc({accessToken:me,address:M.address,request:{method:"personal_sign",params:[c,M.address]}}),io=Wt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:M.address}),io};if(N.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let me=await F();D(O,"signMessage","onSuccess",me),f(me)}catch(me){D(O,"signMessage","onError","unable_to_sign"),g(me??new Be("Unable to sign message"))}}else{let Wt={method:"personal_sign",data:c,confirmAndSign:F,onSuccess:Et=>{D(O,"signMessage","onSuccess",Et),f(Et)},onFailure:Et=>{D(O,"signMessage","onError","unable_to_sign"),g(Et)},uiOptions:p||{}},io={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Et=>{D(O,"signMessage","onError","unknown_connect_wallet_error"),g(Et)}};j({signMessage:Wt,connectWallet:io}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,p)=>new Promise(async(f,g)=>{if(!i||!s){D(O,"signTypedData","onError","must_be_authenticated"),g(new Error("User must be authenticated before signing with a Privy wallet"));return}let M=Ne(s);if(!M){D(O,"signTypedData","onError","embedded_wallet_not_found"),g(new Error("Must have a Privy wallet before signing"));return}se(!0);let F=Va(c),me=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let bt=await Se();if(!P||!bt)throw new Error("Unable to connect to wallet");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:M.address});let{response:io}=await P.rpc({accessToken:bt,address:M.address,request:{method:"eth_signTypedData_v4",params:[M.address,F]}}),Et=io.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:M.address}),Et};if(N.embeddedWallets.noPromptOnSignature||(N.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let bt=await me();D(O,"signTypedData","onSuccess",bt),f(bt)}catch(bt){D(O,"signTypedData","onError","unable_to_sign"),g(bt??new Be("Unable to sign message"))}}else{let io={method:"eth_signTypedData_v4",data:F,confirmAndSign:me,onSuccess:vr=>{D(O,"signTypedData","onSuccess",vr),f(vr)},onFailure:vr=>{D(O,"signTypedData","onError","unable_to_sign"),g(vr)},uiOptions:p||{}},Et={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:vr=>{D(O,"signMessage","onError","unknown_connect_wallet_error"),g(vr)}};j({signMessage:io,connectWallet:Et}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,p,f)=>{let M=await(await Md(c,p,f)).wait();return Ol(M)},exportWallet:()=>new Promise(async(c,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let f=Ne(s);if(!f){p(new Error("Must have a Privy wallet before exporting"));return}se(!0);let g={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},M=await Se();if(!M||!P){p(new Error("Must have valid access token to enroll in MFA"));return}if(!P){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await P.connect({accessToken:M,address:f.address}),await P.verifyMfa({accessToken:M})}catch(me){if(ln(me))await pe.recoverEmbeddedWallet();else throw me}}catch(me){p(me);return}let F={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:p};j({keyExport:F,connectWallet:g}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Wd,async init(c){let p;switch(c){case"sms":p=new Gl("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}t.startMfaFlow(p),await p.init()},async submit(c,p){switch(c){case"totp":case"sms":To.current?.resolve({mfaMethod:c,mfaCode:p}),await new Promise((f,g)=>{Dr.current={resolve:f,reject:g}});break;default:throw To.current?.reject(new _("Unsupported MFA method")),new _(`Unsupported MFA method: ${c}`)}},cancel(){To.current?.reject(new _("MFA canceled"))},async initEnrollmentWithSms(c){let p=await Se();if(!p||!P)throw new Error("Must have valid access token to enroll in MFA");await P.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((p,f)=>{if(!c){pe.closePrivyModal(),p();return}N.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),j({mfaEnrollmentFlow:{mfaMethods:N.mfa.methods,onSuccess:p,onFailure:f}}),Z("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await Se();if(!c||!P)throw new Error("Must have valid access token to enroll in MFA");let p=await P.initEnrollMfa({method:"totp",accessToken:c});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(c){let p=await Se();if(!p||!P)throw new Error("Must have valid access token to enroll in MFA");await P.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber,code:c.mfaCode});let f=await t.getAuthenticatedUser();d(f)},async submitEnrollmentWithTotp(c){let p=await Se();if(!p||!P)throw new Error("Must have valid access token to enroll in MFA");await P.submitEnrollMfa({method:"totp",accessToken:p,code:c.mfaCode});let f=await t.getAuthenticatedUser();d(f)},async unenroll(c){let p=await Se();if(!p||!P)throw new Error("Must have valid access token to remove MFA");await P.unenrollMfa({method:c,accessToken:p});let f=await t.getAuthenticatedUser();d(f)},requestFarcasterSigner:async()=>{let c=await Se(),p=s?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let g=await P.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null});if(g.status==="approved"){let M=await t.getAuthenticatedUser();d(M||s||null)}j({farcasterSigner:g}),Z("AWAITING_FARCASTER_SIGNER")},submitCast:async c=>{let p=await Se(),f=s?.linkedAccounts.find(F=>F.type==="wallet"&&F.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.submitCast({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:c})=>{let p=await Se(),f=s?.linkedAccounts.find(F=>F.type==="wallet"&&F.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.removeCast({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:c,castAuthorFid:p})=>{let f=await Se(),g=s?.linkedAccounts.find(me=>me.type==="wallet"&&me.walletClientType==="privy");if(!f)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!g)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.reactToCast({address:g.address,hdWalletIndex:null,accessToken:f,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:c,castAuthorFid:p})=>{let f=await Se(),g=s?.linkedAccounts.find(me=>me.type==="wallet"&&me.walletClientType==="privy");if(!f)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!g)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.reactToCast({address:g.address,hdWalletIndex:null,accessToken:f,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:c})=>{let p=await Se(),f=s?.linkedAccounts.find(F=>F.type==="wallet"&&F.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.submitLink({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:c})=>{let p=await Se(),f=s?.linkedAccounts.find(F=>F.type==="wallet"&&F.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.removeLink({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:b,loginWithCode(c){return pe.loginWithCode(c)},initLoginWithEmail(c){return pe.initLoginWithEmail(c)},initLoginWithSms(c){return pe.initLoginWithSms(c)},fundWallet(c,p){return pe.fundWallet(c,p)},initLoginWithHeadlessOAuth(c,p){return pe.initLoginWithHeadlessOAuth(c,p)},loginWithHeadlessOAuth(c){return pe.loginWithHeadlessOAuth(c)},isModalOpen:r};Xg=Pn.signMessage,e1=Pn.signTypedData,t1=async(...c)=>{let p=await Md(...c);return N.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let Ld=!!e.config?.headless,pe=(()=>({headless:Ld,isNewUserThisSession:w,linkingHint:B,pendingTransaction:null,walletConnectionStatus:I,mipdStore:R,connectors:t.connectors?.walletConnectors??[],rpcConfig:N.rpcConfig,chains:N.chains,appId:e.appId,showFiatPrices:N.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>N.chains.find(p=>p.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(P)return P;let p=new Promise(M=>{Gt(()=>F=>M(F))}),f=new Promise(M=>setTimeout(()=>M(null),c)),g=await Promise.race([p,f]);return Gt(null),g},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;ne.current==="login"?c.shouldCallAuthOnSuccess&&p?(D(O,"login","onComplete",s,w,!1,re.current??null),e.onSuccess?.(s,w)):D(O,"login","onError","exited_auth_flow"):ne.current==="link"&&re.current&&(c.isSuccess&&p?D(O,"linkAccount","onSuccess",s,re.current):D(O,"linkAccount","onError","exited_link_flow")),G(null),ne.current=null,re.current=null,T(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:Z,connectWallet:yr,initLoginWithWallet:async(c,p)=>{re.current="siwe",Yo(c,p)},loginWithWallet:async()=>{if(!n)throw new xn;if(!(t.authFlow instanceof on))throw new _("Must initialize SIWE flow first.");let c,p;if(i)try{c=await t.link(),re.current="siwe"}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:c,isNewUser:p}=await t.authenticate()),re.current="siwe"}catch(f){throw D(O,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}d(c||s||null),T(p||!1),l(!0)},initLoginWithFarcaster:async c=>{let p=new Di(c);t.startAuthFlow(p);try{re.current="farcaster",await p.initializeFarcasterConnect()}catch(f){throw ne.current==="login"?D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"):ne.current==="link"&&D(O,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},loginWithFarcaster:async()=>{if(!n)throw new xn;if(!(t.authFlow instanceof Di))throw new _("Must initialize Farcaster flow first.");let c,p;if(i)try{c=await t.link(),re.current="farcaster"}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:c,isNewUser:p}=await t.authenticate()),re.current="farcaster"}catch(f){throw D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}d(c||null),T(p||!1),l(!0)},async initLoginWithOAuth(c,p){if(re.current=c,Jl()){if(c==="google"&&Hl(window.navigator.userAgent)){nt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{nt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}Q.del(Xo);let f=new Hr({provider:c});p&&f.addCaptchaToken(p),t.startAuthFlow(f);let g=await t.authFlow.getAuthorizationUrl();g&&g.url&&window.location.assign(g.url)},async loginWithOAuth(c){if(!(t.authFlow instanceof Hr))throw new _("Must initialize OAuth flow before calling loginWithOAuth");let p=Q.get(Qo),f=t.authFlow.meta.stateCode;if(p!==f)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c,storedStateCode:p??"",returnedStateCode:f??""}),new _("Unexpected auth flow. This may be a phishing attempt.");let g,M;if(i)try{g=await t.link(),re.current=c}catch(F){throw D(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}else try{({user:g,isNewUser:M}=await t.authenticate()),re.current=c}catch(F){throw ne.current==="login"?D(O,"login","onError",F.privyErrorCode||"unknown_auth_error"):ne.current==="link"&&D(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}d(g),T(M||!1),l(!0)},async initLoginWithHeadlessOAuth(c,p){if(Jl()){if(c==="google"&&Hl(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let f=new Hr({provider:c,headless:!0});p&&f.addCaptchaToken(p);let g=await t.startAuthFlow(f).getAuthorizationUrl();g?.url&&window.location.assign(g.url)},async loginWithHeadlessOAuth(c){x(!0),t.startAuthFlow(new Hr(c));let p=Q.get(Qo),f=c.stateCode;if(p!==f)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c.provider,storedStateCode:p??"",returnedStateCode:f??""}),x(!1),new _("Unexpected auth flow. This may be a phishing attempt.");let g,M;if(i)try{g=await t.link(),re.current=c.provider}catch(F){throw D(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}else try{({user:g,isNewUser:M}=await t.authenticate()),re.current=c.provider}catch(F){throw ne.current==="login"?D(O,"login","onError",F.privyErrorCode||"unknown_auth_error"):ne.current==="link"&&D(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}return d(g),T(M||!1),l(!0),x(!1),g??void 0},initLoginWithEmail:async(c,p)=>{let f=new xo(c,p);t.startAuthFlow(f);try{re.current="email",await f.sendCodeEmail()}catch(g){throw ne.current==="login"?D(O,"login","onError",g.privyErrorCode||"unknown_auth_error"):ne.current==="link"&&D(O,"linkAccount","onError",g.privyErrorCode||"failed_to_link_account"),g}},initUpdateEmail:async(c,p,f)=>{let g=new Ma(c,p,f);t.startAuthFlow(g),await g.sendCodeEmail()},initLoginWithSms:async(c,p)=>{let f=new nn(c,p);t.startAuthFlow(f);try{re.current="sms",await f.sendSmsCode()}catch(g){throw ne.current==="login"?D(O,"login","onError",g.privyErrorCode||"unknown_auth_error"):ne.current==="link"&&D(O,"linkAccount","onError",g.privyErrorCode||"failed_to_link_account"),g}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(!n)throw new xn;if(t.authFlow instanceof xo)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof nn)t.authFlow.meta.smsCode=c.trim();else throw new _("Must initialize a passwordless code flow first");let p,f;if(i)try{p=await t.link()}catch(g){throw D(O,"linkAccount","onError",g.privyErrorCode||"failed_to_link_account"),g}else try{({user:p,isNewUser:f}=await t.authenticate())}catch(g){throw D(O,"login","onError",g.privyErrorCode||"unknown_auth_error"),g}d(p||s||null),T(f||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return d(c),c},walletProxy:P,createAnalyticsEvent:(c,p,f)=>t.createAnalyticsEvent(c,p,f),acceptTerms:async()=>{let c=await t.acceptTerms();return d(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:async()=>new Promise(async(c,p)=>{let f=s?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy"),g=await Se();if(!g||!P||!f){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}se(!0);try{await P.connect({accessToken:g,address:f.address}),c(!0)}catch(M){ln(M)&&f.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:f.address}),(await P.recover({address:f.address,accessToken:g})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:f.address}),c(!0)):ln(M)?(j({recoverWallet:{privyWallet:f,onFailure:p,onSuccess:()=>c(!0)}}),Z("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(M)}}),getFiatOnRampConfig:Fr,setReadyToTrue:()=>{a(!0),Ue?.()},updateWallets:()=>Po(),fundWallet:async(c,p)=>{let{signedUrl:f,externalTransactionId:g}=await Fr(c,p);j({fiatOnRampPrompt:{signedUrl:f},fiatOnRampStatus:{externalTransactionId:g}}),Z("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let p=await Se(),f=s?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let g=await t.requestFarcasterSignerStatus(c);if(g.status==="approved"){let M=await t.getAuthenticatedUser();d(M||s||null)}return g}}))();r1=pe.recoverEmbeddedWallet;let M1=(0,ee.useMemo)(()=>({wallets:u,ready:je}),[u,je]);return(0,Ht.jsx)(ye.Provider,{value:Pn,children:(0,Ht.jsx)(wc.Provider,{value:O,children:(0,Ht.jsx)(Ed.Provider,{value:M1,children:(0,Ht.jsxs)(Nu,{...N,children:[e.children,(0,Ht.jsxs)(vc.Provider,{value:pe,children:[!Ld&&N.captchaEnabled&&n&&!i&&(0,Ht.jsx)(Ps,{delayedExecution:!1}),(0,Ht.jsx)(qg,{theme:{...N.appearance.palette||{}}}),(0,Ht.jsx)(_u,{data:ae,setModalData:j,setInitialScreen:S,initialScreen:C,authenticated:i,open:r,children:(0,Ht.jsx)(Kg,{open:r})}),ue&&te?(0,Ht.jsx)(Jg,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:To,mfaSubmitPromise:Dr,onLoad:J,onLoadFailed:()=>null}):null]})]})})})})};var n1=require("react");function i1(e){let{login:t}=(0,n1.useContext)(ye);return De("login",e),{login:t}}var a1=require("react");function s1(e){let{logout:t}=(0,a1.useContext)(ye);return De("logout",e),{logout:t}}var Ta=require("react");function l1(){let e=_e(),t=vs(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=V(),l=(0,Ta.useCallback)(async d=>{if(e.enabled&&e.status!=="success")throw new Tr(e.error,null,"captcha_failure");return r(d.provider,e.token)},[r,e]),s=(0,Ta.useCallback)(async()=>{let d=Ui();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!d.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(d)}catch(u){throw u}finally{Bi()}},[o]);return(0,Ta.useEffect)(()=>{let d=Ui();a&&t&&d.inProgress&&d.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}var Rd=require("react");var c1=()=>{let e=_e(),{initLoginWithEmail:t,loginWithCode:r}=V(),o=(0,Rd.useCallback)(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=(0,Rd.useCallback)(async({code:a})=>{if(e.enabled&&e.status==="error")throw new Tr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var Id=require("react");var d1=()=>{let e=_e(),{initLoginWithSms:t,loginWithCode:r}=V(),o=(0,Id.useCallback)(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),n=(0,Id.useCallback)(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new Tr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var p1=require("react");function u1(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:v,linkFarcaster:h}=(0,p1.useContext)(ye);return De("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:v,linkFarcaster:h}}var m1=require("react");function f1(e){let{connectWallet:t}=(0,m1.useContext)(ye);return De("connectWallet",e),{connectWallet:t}}var h1=require("react");function y1(e){let{createWallet:t}=(0,h1.useContext)(ye);return De("createWallet",e),{createWallet:t}}var g1=()=>{let{fundWallet:e}=V();return{fundWallet:e}};var v1=require("react");function w1(e){let{sendTransaction:t}=(0,v1.useContext)(ye);return De("sendTransaction",e),{sendTransaction:t}}var C1=require("react");function b1(e){let{setWalletPassword:t}=(0,C1.useContext)(ye);return De("setWalletPassword",e),{setWalletPassword:t}}var E1=require("react");function T1(e){let{signMessage:t}=(0,E1.useContext)(ye);return De("signMessage",e),{signMessage:t}}var P1=require("react");function x1(e){let{signTypedData:t}=(0,P1.useContext)(ye);return De("signTypedData",e),{signTypedData:t}}var S1=require("react");var _1=()=>{let{isModalOpen:e}=(0,S1.useContext)(ye);return{isOpen:e}};var A1=require("react");function k1(e){let{getAccessToken:t}=(0,A1.useContext)(ye);return De("accessToken",e),{getAccessToken:t}}function R1(){let{submitCast:e,removeCast:t,likeCast:r,recastCast:o,followUser:n,unfollowUser:a,requestFarcasterSigner:i}=V();return{followUser:n,unfollowUser:a,submitCast:e,removeCast:t,likeCast:r,recastCast:o,requestFarcasterSigner:i}}function I1(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useExperimentalFarcasterSigner,useFundWallet,useLinkAccount,useLogin,useLoginWithEmail,useLoginWithOAuth,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSignMessage,useSignTypedData,useToken,useWallets});
2748
+ `;var qe=require("react/jsx-runtime"),K0={["LANDING"]:fy,["CONNECT_OR_CREATE"]:my,["AWAITING_PASSWORDLESS_CODE"]:mm,["AWAITING_CONNECTION"]:Um,["AWAITING_CONNECT_ONLY_CONNECTION"]:Gm,["AWAITING_FARCASTER_CONNECTION"]:fh,["AWAITING_FARCASTER_SIGNER"]:wh,["PHANTOM_INTERSTITIAL_SCREEN"]:Ig,["LOGIN_FAILED_SCREEN"]:by,["AWAITING_OAUTH_SCREEN"]:_g,["ALLOWLIST_REJECTION_SCREEN"]:rm,["INSTALL_PHANTOM_SCREEN"]:Hh,["LINK_EMAIL_SCREEN"]:yy,["LINK_PHONE_SCREEN"]:vy,["LINK_WALLET_SCREEN"]:wy,["UPDATE_EMAIL_SCREEN"]:zg,["CONNECT_ONLY_LANDING_SCREEN"]:Nm,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Rm,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Gf,["EMBEDDED_WALLET_CREATED_SCREEN"]:Zm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Km,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Yf,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:rf,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Ug,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Ng,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Ah,["FIAT_ON_RAMP_STATUS_SCREEN"]:Wh,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:jf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Vf,["MFA_ENROLLMENT_FLOW_SCREEN"]:Fy,["CAPTCHA_SCREEN"]:bm,["ERROR_SCREEN"]:Qf,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Nh,["AFFIRMATIVE_CONSENT_SCREEN"]:em},Y0=["LANDING","AWAITING_CONNECTION"],J0=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=V(),{headless:n}=L(),{ready:a,currentScreen:i}=A(),{status:l,execute:s,reset:d,enabled:u}=_e(),v=(0,Eo.useRef)(null),h=Bu(v),w=o&&i&&Y0.includes(i)&&!n&&l==="ready";if((0,Eo.useEffect)(()=>{w&&s()},[w]),(0,Eo.useEffect)(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return(0,qe.jsxs)(wi,{id:"privy-modal-content",children:[(0,qe.jsx)(k,{}),(0,qe.jsx)(X,{}),(0,qe.jsx)(Ty,{children:(0,qe.jsx)(Lt,{})}),(0,qe.jsx)(le,{}),(0,qe.jsx)(ie,{})]});if(!i&&e)return(0,qe.jsx)(wi,{style:{height:h},id:"privy-modal-conent",children:(0,qe.jsx)("div",{ref:v,children:(0,qe.jsx)(xd,{open:e,onClose:t})})});if(!i)return null;let T=K0[i];return(0,qe.jsx)(wi,{style:{height:h},id:"privy-modal-content",children:(0,qe.jsxs)("div",{ref:v,children:[(0,qe.jsx)(uo,{if:!!e,children:(0,qe.jsx)(T,{})}),(0,qe.jsx)(uo,{if:!e,children:(0,qe.jsx)(xd,{open:e,onClose:t})})]})})},Z0=()=>{let{closePrivyModal:e}=L(),{onUserCloseViaDialogOrKeybindRef:t}=A();return{gracefulClosePrivyModal:(0,Eo.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Yg=({open:e})=>{let{app:t}=A(),{gracefulClosePrivyModal:r}=Z0(),[o,n]=(0,Eo.useState)(!1);As({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=(0,qe.jsx)(jg,{children:(0,qe.jsx)(J0,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?(0,qe.jsx)(Ey,{open:i,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:a}):a;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return Kg.default.createPortal(l,s)}return l};var Jg=require("react"),Mi=require("react");var Bl=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:submit-cast":return o;case"privy:farcaster:remove-cast":return o;case"privy:farcaster:react-to-cast":return o;case"privy:farcaster:submit-link":return o;case"privy:farcaster:remove-link":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Tn(e,t,r,o,n,a=!1){let i=a,l=async u=>{if(i&&t&&t.length>0){u===(a?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new ke("missing_or_invalid_mfa","MFA verification failed, retry."));let v=await new Promise((h,w)=>{r.current={resolve:h,reject:w};let T=1e3*60*5;setTimeout(()=>{let C=new ke("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(C),w(C)},T)});return await e(v)}return await e()},s=4,d=null;for(let u=0;u<s;u++)try{d=await l(u),o.current?.resolve(void 0);break}catch(v){if(v.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),v}if(d===null){let u=new ke("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return d}var Qg=require("react/jsx-runtime"),Q0=function(e){return()=>`id-${e++}`}(0);function X0(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function dt(e){return e.error!==void 0}var ot=new Bl,kd=new Map,e2=(e,t)=>typeof t=="bigint"?t.toString():t,t2=(e,t)=>`${e}${JSON.stringify(t,e2)}`;function pt(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=t2(e,t);if(e==="privy:wallet:create"){let l=kd.get(a);if(l)return l}let i=new Promise((l,s)=>{let d=Q0();ot.enqueue(d,{resolve:l,reject:s}),n.postMessage({id:d,event:e,data:t},o)}).finally(()=>{kd.delete(a)});return kd.set(a,i),i}function r2(e){switch(e.event){case"privy:iframe:ready":let t=ot.dequeue(e.event,e.id);return dt(e)?t.reject(new ke(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=ot.dequeue(e.event,e.id);return dt(e)?r.reject(new ke(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=ot.dequeue(e.event,e.id);return dt(e)?o.reject(new ke(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=ot.dequeue(e.event,e.id);return dt(e)?n.reject(new ke(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=ot.dequeue(e.event,e.id);return dt(e)?a.reject(new ke(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=ot.dequeue(e.event,e.id);return dt(e)?i.reject(new ke(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=ot.dequeue(e.event,e.id);return dt(e)?l.reject(new ke(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=ot.dequeue(e.event,e.id);return dt(e)?s.reject(new ke(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Zg(e){let t=(0,Mi.useRef)(null),r=(0,Mi.useRef)(e.mfaMethods),o=Vu(),[n,a]=(0,Jg.useState)(!1);return(0,Mi.useEffect)(()=>{r.current=e.mfaMethods},[e.mfaMethods]),(0,Mi.useEffect)(()=>{if(!n)return;let i=t.current;if(!i)return;function l(h){h&&h.origin===e.origin&&X0(h.data)&&r2(h.data)}let s={create(h){return pt("privy:wallet:create",h,i,e.origin)},connect(h){return pt("privy:wallet:connect",h,i,e.origin)},recover(h){return Tn(w=>pt("privy:wallet:recover",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(h){return Tn(w=>pt("privy:wallet:rpc",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(h){return Tn(w=>pt("privy:wallet:set-recovery-password",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(h){return Tn(w=>pt("privy:mfa:verify",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(h){return Tn(w=>pt("privy:mfa:init-enrollment",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(h){return pt("privy:mfa:submit-enrollment",h,i,e.origin)},unenrollMfa(h){return Tn(w=>pt("privy:mfa:unenroll",{...h,...w},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(h){return pt("privy:mfa:clear",h,i,e.origin)},initFarcasterSigner(h){return pt("privy:farcaster:init-signer",h,i,e.origin)},submitCast(h){return pt("privy:farcaster:submit-cast",h,i,e.origin)},removeCast(h){return pt("privy:farcaster:remove-cast",h,i,e.origin)},reactToCast(h){return pt("privy:farcaster:react-to-cast",h,i,e.origin)},submitLink(h){return pt("privy:farcaster:submit-link",h,i,e.origin)},removeLink(h){return pt("privy:farcaster:remove-link",h,i,e.origin)}};window.addEventListener("message",l);let d=()=>e.onLoad(s),u=(...h)=>{console.warn("Privy iframe failed to load: ",...h),e.onLoadFailed()},v=new AbortController;return Rp(()=>pt("privy:iframe:ready",{},i,e.origin),{abortSignal:v.signal}).then(d,u),()=>{window.removeEventListener("message",l),v.abort()}},[n]),(0,Qg.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Ha(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Hl(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var Gl=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new _("action required");if(!this.api)throw new _("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new _("phone number must be set when initialzing authentication.");try{await this.api.post(cp,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw we(t)}}async authenticate(){if(!this.meta.action)throw new _("action required");if(!this.api)throw new _("Mfa flow has no API instance");if(!this.meta.smsCode)throw new _("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new _("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(dp,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return $t(t)}catch(t){throw we(t)}}};var Ht=require("react/jsx-runtime"),Wi;function o2(e){return typeof e=="string"&&e.length===25}function Se(){if(!Wi){let e=Q.get(Zo);return Promise.resolve(e||null)}return Wi.getAccessToken()}var e1,Yp=(e,t)=>e1(e,t),t1,Jp=(e,t)=>t1(e,t),r1,Zp=(e,t)=>r1(e,t),o1,Qp=()=>o1(),n2=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Q.put(Oi,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},n1=({config:e,...t})=>{if(!o2(t.appId))throw new _("Cannot initialize the Privy provider with an invalid Privy app ID");Wi||(Wi=new Vn({appId:t.appId,apiUrl:t.apiUrl||Oa}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),(0,Ht.jsx)(xu,{client:Wi,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,Ht.jsx)(i2,{...t,config:r,client:Wi})})},i2=e=>{let t=e.client,[r,o]=(0,ee.useState)(!1),[n,a]=(0,ee.useState)(!1),[i,l]=(0,ee.useState)(!1),[s,d]=(0,ee.useState)(null),[u,v]=(0,ee.useState)([]),h=(0,ee.useRef)(u),[w,T]=(0,ee.useState)(!1),[C,S]=(0,ee.useState)(null),[b,x]=(0,ee.useState)(!1),[I,W]=(0,ee.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[R,H]=(0,ee.useState)(null),[B,G]=(0,ee.useState)(null),[P,J]=(0,ee.useState)(null),N=gs(),te=vs(),[ue,se]=(0,ee.useState)(!0),[ae,j]=(0,ee.useState)({}),[Ue,Oe]=(0,ee.useState)(null),[no,Gt]=(0,ee.useState)(null),[je,Me]=(0,ee.useState)(!1),[Vt,hr]=(0,ee.useState)(!1),To=(0,ee.useRef)(null),Dr=(0,ee.useRef)(null),O=(0,ee.useRef)(Hu);t.onStoreToken=c=>{c&&D(O,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{D(O,"accessToken","onAccessTokenRemoved")};let re=(0,ee.useRef)(null),ne=(0,ee.useRef)(null),Li=(0,ee.useCallback)(c=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(g=>g.type==="wallet"&&g.walletClientType==="privy")?p&&c?.some(g=>g?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),Z=c=>{S(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:c})},nt=c=>{N.embeddedWallets.createOnLogin!=="off"&&se(!0),Z(c)};(0,ee.useEffect)(()=>{if(!P||!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(c&&c.length>0){let p=c[0].address;t.connectors?.addEmbeddedWalletConnector(P,p,N.defaultChain,e.appId)}},[P,s]),(0,ee.useEffect)(()=>{P&&no?.(P)},[P]),(0,ee.useEffect)(()=>{(async()=>{if(!N.customAuth?.enabled)return;se(!0);let{getCustomAccessToken:p,isLoading:f}=N.customAuth;if(!(!n||f))try{let g=await p();if(!g&&i){await Pn.logout();return}if(!g||i)return;t.startAuthFlow(new Sn(g));let{user:M,isNewUser:F}=await t.authenticate();if(!M){await Pn.logout();return}d(M||null),T(F||!1),l(!0),hr(!0)}catch(g){console.warn(g),i&&await Pn.logout()}})()},[N.customAuth?.enabled,N.customAuth?.getCustomAccessToken,N.customAuth?.isLoading,n,i]),(0,ee.useEffect)(()=>{Vt&&P&&s&&or(s,e.config?.embeddedWallets?.createOnLogin)&&(hr(!1),Ur(s,An).catch(console.error))},[Vt&&P&&s]),(0,ee.useEffect)(()=>{async function c(){let p=Mt();n2();let f=(0,Xg.createStore)();H(f),t.initializeConnectorManager({walletConnectCloudProjectId:N.walletConnectCloudProjectId,rpcConfig:N.rpcConfig,chains:N.chains,defaultChain:N.defaultChain,store:f,walletList:N.appearance.walletList,shouldEnforceDefaultChainOnConnect:N.shouldEnforceDefaultChainOnConnect,appName:N.name??"Privy"}),t.connectors?.initialize().then(()=>{zl()});let g=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!g),g&&D(O,"login","onComplete",g,!1,!0,null),d(g)),p||pe.setReadyToTrue(),p&&(g?ne.current="link":ne.current="login")}!n&&te&&c()},[t,Ue,n,te]);let Mt=()=>{let c=Ui();return!c.inProgress||c.headless?!1:(t.startAuthFlow(new Hr(c)),nt("AWAITING_OAUTH_SCREEN"),!0)},Ko=async(c,p,f,g)=>{let M=await t.connectors?.createWalletConnector(c,p)||null;yr(M,p,f,g)};async function yr(c,p,f,g){if(c)W({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:E});else return W({status:"disconnected",connectedWallet:null,connectError:new oe("Unable to connect to wallet."),connector:null,connectRetry:E}),g?.(null,f);c instanceof zr&&p&&await c.resetConnection(p),W({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>yr(c,p,f,g)});try{let M=await c.connect({showPrompt:!0});if(N.shouldEnforceDefaultChainOnConnect&&!N.chains.find(F=>F.id===Number(M?.chainId))&&!(M?.connectorType==="wallet_connect_v2"&&M?.walletClientType==="metamask")){W(F=>({...F,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await M?.switchChain(N.defaultChain.id),M&&(M.chainId=kn(rn(N.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${N.defaultChain.id}`)}}return W(F=>({...F,status:"connected",connectedWallet:M,connectError:null,connectRetry:E})),M&&!ne.current&&D(O,"connectWallet","onSuccess",M),g?.(M,f)}catch(M){return M instanceof mt?(console.warn(M.cause?M.cause:M.message),ne.current||D(O,"connectWallet","onError",M.privyErrorCode||"generic_connect_wallet_error")):(console.warn(M),ne.current||D(O,"connectWallet","onError","unknown_connect_wallet_error")),W(F=>({...F,status:"disconnected",connectedWallet:null,connectError:M})),g?.(null,f)}}let Yo=async(c,p)=>{if(c===null)return;let f=new on(c,p);t.startAuthFlow(f)},zl=()=>{let c=new URLSearchParams(window.location.search),p=c.get("privy_connector"),f=c.get("privy_wallet_client");if(!p||!f)return;if(f==="phantom"&&!So()&&nt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new _("Connector not initialized");Z("AWAITING_CONNECTION");let g=new URL(window.location.href);g.searchParams.delete("privy_connector"),g.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",g),Ko(p,f,void 0,Yo)};(0,ee.useEffect)(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(d)},[n,i,s,t]);let it=()=>{if(!i)throw D(O,"linkAccount","onError","must_be_authenticated"),new _("User must be authenticated before linking an account.")},Jo=()=>{it(),re.current="siwe",ne.current="link",Z("LINK_WALLET_SCREEN")},zt=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===c.address&&p.walletClientType!=="privy")return!0;return!1},ut=async c=>{if(!t.connectors)throw new _("Connector not initialized");let p=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(W(f=>({...f,connector:p,status:"connected",connectedWallet:c,connectError:null,connectRetry:E})),N.captchaEnabled&&!i){let f={callback:g=>Yo(c,g),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};j({captchaModalData:f}),nt("CAPTCHA_SCREEN")}else await Yo(c),nt("AWAITING_CONNECTION")},Fr=async(c,p)=>{if(!N.fiatOnRamp.enabled)throw new _("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:f,externalTransactionId:g}=await Sh(t,c,p?.config??{},N.appearance.palette,N.fiatOnRamp.useSandbox);return{signedUrl:f,externalTransactionId:g}}else throw new _("Unsupported fund provider. Currently supported option is `moonpay`.")},Po=()=>{v(c=>{let p=t.connectors?.wallets.map(f=>({...f,linked:zt(f),loginOrLink:async()=>{if(!await f.isConnected())throw new _("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new _("Cannot link or login with embedded wallet");ut(f)},fund:async g=>{let{signedUrl:M,externalTransactionId:F}=await Fr(f.address,g);j({fiatOnRampPrompt:{signedUrl:M},fiatOnRampStatus:{externalTransactionId:F}}),Z("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new _("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new _("Cannot unlink an embedded wallet");let g=await t.unlinkWallet(f.address);d(g)}}))||[];return Me(Li(p)),Ja(c,p)?c:p})};(0,ee.useEffect)(()=>{Po()},[s?.linkedAccounts,i,n]),(0,ee.useEffect)(()=>{if(n){if(!t.connectors)throw new _("Connector not initialized");Po(),t.connectors.on("walletsUpdated",Po)}},[n]);let Pa=()=>{Z(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,ee.useEffect)(()=>{if(!u[0])return;let c=u[0],p=h.current.find(g=>g.address===c.address),f;if(c.walletClientType==="privy"?f=s?.linkedAccounts.find(g=>g.type==="wallet"&&g.address===c.address&&g.walletClientType==="privy"):f=s?.linkedAccounts.find(g=>g.type==="wallet"&&g.address===c.address&&g.walletClientType!=="privy"),!p&&f){let g=Object.assign({},s);g.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},d(g)}h.current=u},[u]);let Ur=async(c,p)=>{if(Ne(c))throw D(O,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[g,M]=await Promise.all([pe.initializeWalletProxy(p),Se()]);if(!g&&e.config?.customAuth?.enabled)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!g||!M||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((F,me)=>{se(!0),j({createWallet:{onSuccess:Wt=>{D(O,"createWallet","onSuccess",Wt),F(Wt)},onFailure:Wt=>{D(O,"createWallet","onError","unknown_embedded_wallet_error"),me(Wt)},callAuthOnSuccessOnClose:!1}}),Z("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await g.create({accessToken:M});let F=await pe.refreshUser(),me=Ne(F);if(!me)throw D(O,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return D(O,"createWallet","onSuccess",me),me}},ql=c=>{if(!N.chains.map(p=>p.id).includes(c))throw new oe(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Md=(c,p,f)=>new Promise(async(g,M)=>{if(!i||!s){D(O,"sendTransaction","onError","must_be_authenticated"),M(new Error("User must be authenticated before signing with a Privy wallet"));return}let F=Ne(s);if(!F){D(O,"sendTransaction","onError","embedded_wallet_not_found"),M(new Error("Must have a Privy wallet before signing"));return}se(!0);let me=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,bt=c.chainId?Number(c.chainId):me.chainId;ql(bt);let Wt=Object.assign({},c,{chainId:bt}),io=async()=>{let Et=await Se();if(!Et||!P){D(O,"sendTransaction","onError","embedded_wallet_not_found"),M(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await pe.recoverEmbeddedWallet()){D(O,"sendTransaction","onError","unknown_connect_wallet_error"),M(new Error("Unable to connect to wallet"));return}let wr=so(Wt.chainId,N.chains,N.rpcConfig,{appId:e.appId}),$l=await _i(F.address,Wt,wr);if(N.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:L1}=await Si($l,wr),{hasSufficientFunds:O1}=await Ll(F.address,$l,L1,wr);if(!O1)throw new Be(new nr("Wallet has insufficient funds for this transaction.",ft.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Od=await Wl(Et,F.address,P,$l,wr);D(O,"sendTransaction","onSuccess",Od),g(Od)}catch(vr){D(O,"sendTransaction","onError","transaction_failure"),M(vr)}};if(N.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),io();else{let Et={transactionRequest:Wt,onSuccess:wr=>{D(O,"sendTransaction","onSuccess",wr),g(wr)},onFailure:wr=>{D(O,"sendTransaction","onError","transaction_failure"),M(wr)},uiOptions:p||{},fundWalletConfig:f},vr={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:wr=>{D(O,"sendTransaction","onError","unknown_connect_wallet_error"),M(wr)}};j({connectWallet:vr,sendTransaction:Et}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Wd(){return new Promise(async(c,p)=>{let f=await Se();if(!f||!P)throw new Error("Must have valid access token to enroll in MFA");try{await P.verifyMfa({accessToken:f}),c()}catch(g){p(g)}})}let gr=c=>{if(s?.[c])throw D(O,"linkAccount","onError","cannot_link_more_of_type"),new _(`User already has an account of type ${c} linked.`)},Pn={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:Pa,linkWallet:Jo,linkEmail:()=>{it(),gr("email"),re.current="email",ne.current="link",Z("LINK_EMAIL_SCREEN")},linkPhone:()=>{it(),gr("phone"),re.current="sms",ne.current="link",Z("LINK_PHONE_SCREEN")},linkGoogle:async()=>{it(),gr("google"),ne.current="link",await pe.initLoginWithOAuth("google")},linkTwitter:async()=>{it(),gr("twitter"),ne.current="link",await pe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{it(),gr("discord"),ne.current="link",await pe.initLoginWithOAuth("discord")},linkGithub:async()=>{it(),gr("github"),ne.current="link",await pe.initLoginWithOAuth("github")},linkSpotify:async()=>{it(),gr("spotify"),ne.current="link",await pe.initLoginWithOAuth("spotify")},linkTiktok:async()=>{it(),gr("tiktok"),ne.current="link",await pe.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{it(),gr("linkedin"),ne.current="link",await pe.initLoginWithOAuth("linkedin")},linkApple:async()=>{it(),gr("apple"),ne.current="link",await pe.initLoginWithOAuth("apple")},linkFarcaster:async()=>{it(),gr("farcaster"),await pe.initLoginWithFarcaster(),ne.current="link",re.current="farcaster",Z("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(it(),!s?.email)throw new _("User does not have an email linked to their account.");ne.current="link",re.current="email",Z("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(c=>{Oe(()=>c)}),Oe(null)),i){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}ne.current="login",nt("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{Oe(()=>c)}),Oe(null)),i){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}nt("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&P)try{await P.clearMfa({userId:s.id})}catch{}d(null),l(!1),S(null),D(O,"logout","onSuccess"),ne.current=null,re.current=null,o(!1),Q.del(Ni)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Le;let c=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===c?.address));return!c||!p?new Le:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Vl.Web3Provider(new br(new Le));let c=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===c?.address));return!c||!p?new Vl.Web3Provider(new br(new Le)):new Vl.Web3Provider(new br(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new ko(new Le);let c=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===c?.address));return!c||!p?new ko(new Le):new ko(p.proxyProvider)},unlinkWallet:async c=>{let p=await t.unlinkWallet(c);return d(p),p},unlinkEmail:async c=>{let p=await t.unlinkEmail(c);return d(p),p},unlinkPhone:async c=>{let p=await t.unlinkPhone(c);return d(p),p},unlinkGoogle:async c=>{let p=await t.unlinkOAuth("google",c);return d(p),p},unlinkTwitter:async c=>{let p=await t.unlinkOAuth("twitter",c);return d(p),p},unlinkDiscord:async c=>{let p=await t.unlinkOAuth("discord",c);return d(p),p},unlinkGithub:async c=>{let p=await t.unlinkOAuth("github",c);return d(p),p},unlinkSpotify:async c=>{let p=await t.unlinkOAuth("spotify",c);return d(p),p},unlinkTiktok:async c=>{let p=await t.unlinkOAuth("tiktok",c);return d(p),p},unlinkLinkedIn:async c=>{let p=await t.unlinkOAuth("linkedin",c);return d(p),p},unlinkApple:async c=>{let p=await t.unlinkOAuth("apple",c);return d(p),p},unlinkFarcaster:async c=>{let p=await t.unlinkFarcaster(c);return d(p),p},setActiveWallet:async c=>{let p=u.find(g=>(0,Ea.getAddress)(g.address)===(0,Ea.getAddress)(c)),f=s?.linkedAccounts.find(g=>g.type==="wallet"&&(0,Ea.getAddress)(g.address)===(0,Ea.getAddress)(c));if(!p||!await p.isConnected())G(c),Jo();else if(!p.linked)p.loginOrLink();else{let g=Object.assign({},s);g.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},d(g)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw D(O,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Ur(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw D(O,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let c=Ne(s);if(!c||!P)throw D(O,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(c.recoveryMethod==="user-passcode")throw D(O,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await Wd()}catch(p){throw D(O,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,f)=>{se(!0);let g={onSuccess:F=>{D(O,"setWalletPassword","onSuccess",F),p(F)},onFailure:F=>{D(O,"setWalletPassword","onError","user_exited_set_password_flow"),f(F)},callAuthOnSuccessOnClose:!1},M={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:F=>{D(O,"setWalletPassword","onError","unknown_connect_wallet_error"),f(F)}};j({setWalletPassword:g,connectWallet:M}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(c,p)=>new Promise(async(f,g)=>{if(!i||!s){D(O,"signMessage","onError","must_be_authenticated"),g(new Error("User must be authenticated before signing with a Privy wallet"));return}let M=Ne(s);if(!M){D(O,"signMessage","onError","embedded_wallet_not_found"),g(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){D(O,"signMessage","onError","invalid_message"),g(new Error("Message must be a non-empty string"));return}se(!0);let F=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let me=await Se();if(!P||!me)throw new Error("Unable to connect to wallet");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:M.address});let{response:Wt}=await P.rpc({accessToken:me,address:M.address,request:{method:"personal_sign",params:[c,M.address]}}),io=Wt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:M.address}),io};if(N.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let me=await F();D(O,"signMessage","onSuccess",me),f(me)}catch(me){D(O,"signMessage","onError","unable_to_sign"),g(me??new Be("Unable to sign message"))}}else{let Wt={method:"personal_sign",data:c,confirmAndSign:F,onSuccess:Et=>{D(O,"signMessage","onSuccess",Et),f(Et)},onFailure:Et=>{D(O,"signMessage","onError","unable_to_sign"),g(Et)},uiOptions:p||{}},io={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Et=>{D(O,"signMessage","onError","unknown_connect_wallet_error"),g(Et)}};j({signMessage:Wt,connectWallet:io}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,p)=>new Promise(async(f,g)=>{if(!i||!s){D(O,"signTypedData","onError","must_be_authenticated"),g(new Error("User must be authenticated before signing with a Privy wallet"));return}let M=Ne(s);if(!M){D(O,"signTypedData","onError","embedded_wallet_not_found"),g(new Error("Must have a Privy wallet before signing"));return}se(!0);let F=Va(c),me=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let bt=await Se();if(!P||!bt)throw new Error("Unable to connect to wallet");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:M.address});let{response:io}=await P.rpc({accessToken:bt,address:M.address,request:{method:"eth_signTypedData_v4",params:[M.address,F]}}),Et=io.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:M.address}),Et};if(N.embeddedWallets.noPromptOnSignature||(N.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let bt=await me();D(O,"signTypedData","onSuccess",bt),f(bt)}catch(bt){D(O,"signTypedData","onError","unable_to_sign"),g(bt??new Be("Unable to sign message"))}}else{let io={method:"eth_signTypedData_v4",data:F,confirmAndSign:me,onSuccess:vr=>{D(O,"signTypedData","onSuccess",vr),f(vr)},onFailure:vr=>{D(O,"signTypedData","onError","unable_to_sign"),g(vr)},uiOptions:p||{}},Et={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:vr=>{D(O,"signMessage","onError","unknown_connect_wallet_error"),g(vr)}};j({signMessage:io,connectWallet:Et}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,p,f)=>{let M=await(await Md(c,p,f)).wait();return Ol(M)},exportWallet:()=>new Promise(async(c,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let f=Ne(s);if(!f){p(new Error("Must have a Privy wallet before exporting"));return}se(!0);let g={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},M=await Se();if(!M||!P){p(new Error("Must have valid access token to enroll in MFA"));return}if(!P){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await P.connect({accessToken:M,address:f.address}),await P.verifyMfa({accessToken:M})}catch(me){if(ln(me))await pe.recoverEmbeddedWallet();else throw me}}catch(me){p(me);return}let F={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:p};j({keyExport:F,connectWallet:g}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Wd,async init(c){let p;switch(c){case"sms":p=new Gl("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}t.startMfaFlow(p),await p.init()},async submit(c,p){switch(c){case"totp":case"sms":To.current?.resolve({mfaMethod:c,mfaCode:p}),await new Promise((f,g)=>{Dr.current={resolve:f,reject:g}});break;default:throw To.current?.reject(new _("Unsupported MFA method")),new _(`Unsupported MFA method: ${c}`)}},cancel(){To.current?.reject(new _("MFA canceled"))},async initEnrollmentWithSms(c){let p=await Se();if(!p||!P)throw new Error("Must have valid access token to enroll in MFA");await P.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((p,f)=>{if(!c){pe.closePrivyModal(),p();return}N.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),j({mfaEnrollmentFlow:{mfaMethods:N.mfa.methods,onSuccess:p,onFailure:f}}),Z("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await Se();if(!c||!P)throw new Error("Must have valid access token to enroll in MFA");let p=await P.initEnrollMfa({method:"totp",accessToken:c});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(c){let p=await Se();if(!p||!P)throw new Error("Must have valid access token to enroll in MFA");await P.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber,code:c.mfaCode});let f=await t.getAuthenticatedUser();d(f)},async submitEnrollmentWithTotp(c){let p=await Se();if(!p||!P)throw new Error("Must have valid access token to enroll in MFA");await P.submitEnrollMfa({method:"totp",accessToken:p,code:c.mfaCode});let f=await t.getAuthenticatedUser();d(f)},async unenroll(c){let p=await Se();if(!p||!P)throw new Error("Must have valid access token to remove MFA");await P.unenrollMfa({method:c,accessToken:p});let f=await t.getAuthenticatedUser();d(f)},requestFarcasterSigner:async()=>{let c=await Se(),p=s?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let g=await P.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null});if(g.status==="approved"){let M=await t.getAuthenticatedUser();d(M||s||null)}j({farcasterSigner:g}),Z("AWAITING_FARCASTER_SIGNER")},submitCast:async c=>{let p=await Se(),f=s?.linkedAccounts.find(F=>F.type==="wallet"&&F.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.submitCast({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:c})=>{let p=await Se(),f=s?.linkedAccounts.find(F=>F.type==="wallet"&&F.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.removeCast({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:c,castAuthorFid:p})=>{let f=await Se(),g=s?.linkedAccounts.find(me=>me.type==="wallet"&&me.walletClientType==="privy");if(!f)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!g)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.reactToCast({address:g.address,hdWalletIndex:null,accessToken:f,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:c,castAuthorFid:p})=>{let f=await Se(),g=s?.linkedAccounts.find(me=>me.type==="wallet"&&me.walletClientType==="privy");if(!f)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!g)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.reactToCast({address:g.address,hdWalletIndex:null,accessToken:f,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:c})=>{let p=await Se(),f=s?.linkedAccounts.find(F=>F.type==="wallet"&&F.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.submitLink({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:c})=>{let p=await Se(),f=s?.linkedAccounts.find(F=>F.type==="wallet"&&F.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!s?.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster embedded signer write to Farcaster");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await P.removeLink({address:f.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:b,loginWithCode(c){return pe.loginWithCode(c)},initLoginWithEmail(c){return pe.initLoginWithEmail(c)},initLoginWithSms(c){return pe.initLoginWithSms(c)},fundWallet(c,p){return pe.fundWallet(c,p)},initLoginWithHeadlessOAuth(c,p){return pe.initLoginWithHeadlessOAuth(c,p)},loginWithHeadlessOAuth(c){return pe.loginWithHeadlessOAuth(c)},isModalOpen:r};e1=Pn.signMessage,t1=Pn.signTypedData,r1=async(...c)=>{let p=await Md(...c);return N.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let Ld=!!e.config?.headless,pe=(()=>({headless:Ld,isNewUserThisSession:w,linkingHint:B,pendingTransaction:null,walletConnectionStatus:I,mipdStore:R,connectors:t.connectors?.walletConnectors??[],rpcConfig:N.rpcConfig,chains:N.chains,appId:e.appId,showFiatPrices:N.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>N.chains.find(p=>p.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(P)return P;let p=new Promise(M=>{Gt(()=>F=>M(F))}),f=new Promise(M=>setTimeout(()=>M(null),c)),g=await Promise.race([p,f]);return Gt(null),g},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;ne.current==="login"?c.shouldCallAuthOnSuccess&&p?(D(O,"login","onComplete",s,w,!1,re.current??null),e.onSuccess?.(s,w)):D(O,"login","onError","exited_auth_flow"):ne.current==="link"&&re.current&&(c.isSuccess&&p?D(O,"linkAccount","onSuccess",s,re.current):D(O,"linkAccount","onError","exited_link_flow")),G(null),ne.current=null,re.current=null,T(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:Z,connectWallet:yr,initLoginWithWallet:async(c,p)=>{re.current="siwe",Yo(c,p)},loginWithWallet:async()=>{if(!n)throw new xn;if(!(t.authFlow instanceof on))throw new _("Must initialize SIWE flow first.");let c,p;if(i)try{c=await t.link(),re.current="siwe"}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:c,isNewUser:p}=await t.authenticate()),re.current="siwe"}catch(f){throw D(O,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}d(c||s||null),T(p||!1),l(!0)},initLoginWithFarcaster:async c=>{let p=new Di(c);t.startAuthFlow(p);try{re.current="farcaster",await p.initializeFarcasterConnect()}catch(f){throw ne.current==="login"?D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"):ne.current==="link"&&D(O,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},loginWithFarcaster:async()=>{if(!n)throw new xn;if(!(t.authFlow instanceof Di))throw new _("Must initialize Farcaster flow first.");let c,p;if(i)try{c=await t.link(),re.current="farcaster"}catch(f){throw D(O,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:c,isNewUser:p}=await t.authenticate()),re.current="farcaster"}catch(f){throw D(O,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}d(c||null),T(p||!1),l(!0)},async initLoginWithOAuth(c,p){if(re.current=c,Jl()){if(c==="google"&&Hl(window.navigator.userAgent)){nt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{nt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}Q.del(Xo);let f=new Hr({provider:c});p&&f.addCaptchaToken(p),t.startAuthFlow(f);let g=await t.authFlow.getAuthorizationUrl();g&&g.url&&window.location.assign(g.url)},async loginWithOAuth(c){if(!(t.authFlow instanceof Hr))throw new _("Must initialize OAuth flow before calling loginWithOAuth");let p=Q.get(Qo),f=t.authFlow.meta.stateCode;if(p!==f)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c,storedStateCode:p??"",returnedStateCode:f??""}),new _("Unexpected auth flow. This may be a phishing attempt.");let g,M;if(i)try{g=await t.link(),re.current=c}catch(F){throw D(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}else try{({user:g,isNewUser:M}=await t.authenticate()),re.current=c}catch(F){throw ne.current==="login"?D(O,"login","onError",F.privyErrorCode||"unknown_auth_error"):ne.current==="link"&&D(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}d(g),T(M||!1),l(!0)},async initLoginWithHeadlessOAuth(c,p){if(Jl()){if(c==="google"&&Hl(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let f=new Hr({provider:c,headless:!0});p&&f.addCaptchaToken(p);let g=await t.startAuthFlow(f).getAuthorizationUrl();g?.url&&window.location.assign(g.url)},async loginWithHeadlessOAuth(c){x(!0),t.startAuthFlow(new Hr(c));let p=Q.get(Qo),f=c.stateCode;if(p!==f)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c.provider,storedStateCode:p??"",returnedStateCode:f??""}),x(!1),new _("Unexpected auth flow. This may be a phishing attempt.");let g,M;if(i)try{g=await t.link(),re.current=c.provider}catch(F){throw D(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}else try{({user:g,isNewUser:M}=await t.authenticate()),re.current=c.provider}catch(F){throw ne.current==="login"?D(O,"login","onError",F.privyErrorCode||"unknown_auth_error"):ne.current==="link"&&D(O,"linkAccount","onError",F.privyErrorCode||"failed_to_link_account"),F}return d(g),T(M||!1),l(!0),x(!1),g??void 0},initLoginWithEmail:async(c,p)=>{let f=new xo(c,p);t.startAuthFlow(f);try{re.current="email",await f.sendCodeEmail()}catch(g){throw ne.current==="login"?D(O,"login","onError",g.privyErrorCode||"unknown_auth_error"):ne.current==="link"&&D(O,"linkAccount","onError",g.privyErrorCode||"failed_to_link_account"),g}},initUpdateEmail:async(c,p,f)=>{let g=new Ma(c,p,f);t.startAuthFlow(g),await g.sendCodeEmail()},initLoginWithSms:async(c,p)=>{let f=new nn(c,p);t.startAuthFlow(f);try{re.current="sms",await f.sendSmsCode()}catch(g){throw ne.current==="login"?D(O,"login","onError",g.privyErrorCode||"unknown_auth_error"):ne.current==="link"&&D(O,"linkAccount","onError",g.privyErrorCode||"failed_to_link_account"),g}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(!n)throw new xn;if(t.authFlow instanceof xo)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof nn)t.authFlow.meta.smsCode=c.trim();else throw new _("Must initialize a passwordless code flow first");let p,f;if(i)try{p=await t.link()}catch(g){throw D(O,"linkAccount","onError",g.privyErrorCode||"failed_to_link_account"),g}else try{({user:p,isNewUser:f}=await t.authenticate())}catch(g){throw D(O,"login","onError",g.privyErrorCode||"unknown_auth_error"),g}d(p||s||null),T(f||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return d(c),c},walletProxy:P,createAnalyticsEvent:(c,p,f)=>t.createAnalyticsEvent(c,p,f),acceptTerms:async()=>{let c=await t.acceptTerms();return d(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:async()=>new Promise(async(c,p)=>{let f=s?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy"),g=await Se();if(!g||!P||!f){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}se(!0);try{await P.connect({accessToken:g,address:f.address}),c(!0)}catch(M){ln(M)&&f.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:f.address}),(await P.recover({address:f.address,accessToken:g})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:f.address}),c(!0)):ln(M)?(j({recoverWallet:{privyWallet:f,onFailure:p,onSuccess:()=>c(!0)}}),Z("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(M)}}),getFiatOnRampConfig:Fr,setReadyToTrue:()=>{a(!0),Ue?.()},updateWallets:()=>Po(),fundWallet:async(c,p)=>{let{signedUrl:f,externalTransactionId:g}=await Fr(c,p);j({fiatOnRampPrompt:{signedUrl:f},fiatOnRampStatus:{externalTransactionId:g}}),Z("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let p=await Se(),f=s?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!P||!f)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let g=await t.requestFarcasterSignerStatus(c);if(g.status==="approved"){let M=await t.getAuthenticatedUser();d(M||s||null)}return g}}))();o1=pe.recoverEmbeddedWallet;let W1=(0,ee.useMemo)(()=>({wallets:u,ready:je}),[u,je]);return(0,Ht.jsx)(ye.Provider,{value:Pn,children:(0,Ht.jsx)(wc.Provider,{value:O,children:(0,Ht.jsx)(Ed.Provider,{value:W1,children:(0,Ht.jsxs)(Du,{...N,children:[e.children,(0,Ht.jsxs)(vc.Provider,{value:pe,children:[!Ld&&N.captchaEnabled&&n&&!i&&(0,Ht.jsx)(Ps,{delayedExecution:!1}),(0,Ht.jsx)($g,{theme:{...N.appearance.palette||{}}}),(0,Ht.jsx)(Au,{data:ae,setModalData:j,setInitialScreen:S,initialScreen:C,authenticated:i,open:r,children:(0,Ht.jsx)(Yg,{open:r})}),ue&&te?(0,Ht.jsx)(Zg,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:To,mfaSubmitPromise:Dr,onLoad:J,onLoadFailed:()=>null}):null]})]})})})})};var i1=require("react");function a1(e){let{login:t}=(0,i1.useContext)(ye);return De("login",e),{login:t}}var s1=require("react");function l1(e){let{logout:t}=(0,s1.useContext)(ye);return De("logout",e),{logout:t}}var Ta=require("react");function c1(){let e=_e(),t=vs(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=V(),l=(0,Ta.useCallback)(async d=>{if(e.enabled&&e.status!=="success")throw new Tr(e.error,null,"captcha_failure");return r(d.provider,e.token)},[r,e]),s=(0,Ta.useCallback)(async()=>{let d=Ui();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!d.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(d)}catch(u){throw u}finally{Bi()}},[o]);return(0,Ta.useEffect)(()=>{let d=Ui();a&&t&&d.inProgress&&d.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}var Rd=require("react");var d1=()=>{let e=_e(),{initLoginWithEmail:t,loginWithCode:r}=V(),o=(0,Rd.useCallback)(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=(0,Rd.useCallback)(async({code:a})=>{if(e.enabled&&e.status==="error")throw new Tr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var Id=require("react");var p1=()=>{let e=_e(),{initLoginWithSms:t,loginWithCode:r}=V(),o=(0,Id.useCallback)(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),n=(0,Id.useCallback)(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new Tr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var u1=require("react");function m1(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:v,linkFarcaster:h}=(0,u1.useContext)(ye);return De("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:v,linkFarcaster:h}}var f1=require("react");function h1(e){let{connectWallet:t}=(0,f1.useContext)(ye);return De("connectWallet",e),{connectWallet:t}}var y1=require("react");function g1(e){let{createWallet:t}=(0,y1.useContext)(ye);return De("createWallet",e),{createWallet:t}}var v1=()=>{let{fundWallet:e}=V();return{fundWallet:e}};var w1=require("react");function C1(e){let{sendTransaction:t}=(0,w1.useContext)(ye);return De("sendTransaction",e),{sendTransaction:t}}var b1=require("react");function E1(e){let{setWalletPassword:t}=(0,b1.useContext)(ye);return De("setWalletPassword",e),{setWalletPassword:t}}var T1=require("react");function P1(e){let{signMessage:t}=(0,T1.useContext)(ye);return De("signMessage",e),{signMessage:t}}var x1=require("react");function S1(e){let{signTypedData:t}=(0,x1.useContext)(ye);return De("signTypedData",e),{signTypedData:t}}var _1=require("react");var A1=()=>{let{isModalOpen:e}=(0,_1.useContext)(ye);return{isOpen:e}};var k1=require("react");function R1(e){let{getAccessToken:t}=(0,k1.useContext)(ye);return De("accessToken",e),{getAccessToken:t}}function I1(){let{submitCast:e,removeCast:t,likeCast:r,recastCast:o,followUser:n,unfollowUser:a,requestFarcasterSigner:i}=V();return{followUser:n,unfollowUser:a,submitCast:e,removeCast:t,likeCast:r,recastCast:o,requestFarcasterSigner:i}}function M1(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useExperimentalFarcasterSigner,useFundWallet,useLinkAccount,useLogin,useLoginWithEmail,useLoginWithOAuth,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSignMessage,useSignTypedData,useToken,useWallets});