@privy-io/react-auth 1.60.5-beta-20240416140304 → 1.60.5
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/esm/index.js +34 -34
- package/dist/index.d.ts +10 -3
- package/dist/index.js +15 -15
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var gl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Td=(e,t,r)=>(gl(e,t,"read from private field"),r?r.call(e):t.get(e)),Qi=(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)},vl=(e,t,r,o)=>(gl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Pd=(e,t,r)=>(gl(e,t,"access private method"),r);import{getAddress as fl}from"@ethersproject/address";import{Web3Provider as gd}from"@ethersproject/providers";import{createStore as l7}from"mipd";import{useCallback as c7,useEffect as Kr,useMemo as d7,useRef as Xn,useState as Oe}from"react";import{FetchError as N1}from"ofetch";var Ie=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}]`:""}`}},Yt=class extends Ie{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},T=class extends Ie{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Xi=class extends T{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends Ie{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},pe=e=>{if(e instanceof Ie)return e;if(!(e instanceof N1))return Xe(e);if(!e.response)return new Yt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Yt(t||"ApiError",e.response.status,r||o,e,n)},Xe=e=>e instanceof Ie?e:e instanceof Error?new T(e.message,e):new T(`Internal error: ${e}`);var Jr=class extends T{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},St=class extends T{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ea=class extends T{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var mr=class extends T{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var ta="/api/v1/sessions",ra="/api/v1/sessions/logout",Sd="/api/v1/sessions/fork",oa="/api/v1/sessions/fork/recover",xd="/api/v1/siwe/init",kd="/api/v1/siwe/authenticate",_d="/api/v1/siwe/link",Ad="/api/v1/siwe/unlink",Rd="/api/v1/farcaster/init",Id="/api/v1/farcaster/authenticate",Md="/api/v1/farcaster/link",Wd="/api/v1/farcaster/status",Ld="/api/v1/farcaster/unlink",Od="/api/v1/passwordless/init",Nd="/api/v1/passwordless/authenticate",Dd="/api/v1/passwordless/link",Fd="/api/v1/passwordless/unlink",Ud="/api/v1/passwordless/update",Bd="/api/v1/passwordless_sms/init",Hd="/api/v1/passwordless_sms/link",Gd="/api/v1/passwordless_sms/unlink",Vd="/api/v1/passwordless_sms/authenticate",zd="/api/v1/oauth/init",qd="/api/v1/oauth/authenticate",$d="/api/v1/oauth/link",jd="/api/v1/oauth/unlink",Kd="/api/v1/passkeys/link/init",Yd="/api/v1/passkeys/authenticate/init",Zd="/api/v1/passkeys/link",Jd="/api/v1/passkeys/authenticate",Qd="/api/v1/passkeys/unlink";var Xd="/api/v1/mfa/passwordless_sms/init",ep="/api/v1/mfa/passwordless_sms/enroll";var tp="/api/v1/users/me/accept_terms",rp="/api/v1/analytics_events",op="/api/v1/plugins/moonpay_on_ramp/sign",np="/api/v1/custom_jwt_account/authenticate";var Jo=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let t=await this.api.post(np,{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 pe(t)}}async link(){throw new Error("Unimplemented")}};var Qr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Nd,{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 pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Dd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw pe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new T("Email must be set when initialzing authentication.");try{return await this.api.post(Od,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw pe(o)}}},na=class extends Qr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ud,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw pe(r)}}};import{isMobile as H1,isIOS as G1}from"react-device-detect";var Cl=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)}},ia=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 wl(){try{let e="privy:__session_storage__test",t="blobby",r=new ia;return r.put(e,t),r.del(e),!0}catch{return!1}}function D1(){return typeof window<"u"&&window.localStorage?new ia:new Cl}var j=D1();import{StaticJsonRpcProvider as en}from"@ethersproject/providers";function ip(){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 aa=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 bl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||aa(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!bl(r))return!1}return!0},Xr=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ap=()=>{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 sp="1.60.5-beta-20240416140304";var El="4df5e2316331463a9130964bd6078dfa",Tl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",lp="34357d3c125c2bcf2ce2bc3309d98715",sa="https://auth.privy.io",cp=2e4,Me=1400,dp=2500,Pl=sp;var Eo="privy:token",Sl="privy-token",la="privy:refresh_token",xl="privy-refresh-token",ca="privy-session",oi="privy:session_transfer_token",U1="privy:wallet",ni="privy:caid",To="privy:state_code",Qo="privy:code_verifier",Po="privy:headless_oauth",da=e=>`${U1}:${e}`,kl="privy:connectors",_l="privy:connections";var So=12e4,Lr=1,Al="0x1",Xo=3e4,pp="https://api.moonpay.com/v1",up="https://api.moonpay.com/v1",mp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",fp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",hp="0x420000000000000000000000000000000000000F",yp=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var gp=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},pa=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,}))$/),vp=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},eo=(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}`},Rl=e=>new Promise(t=>setTimeout(t,e));function Cp(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 wp=(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 Rl(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},ua=(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 bp=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),xo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Ep(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 c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of ip()){let u=aa(c);if(!l.some(h=>h.info.name===u)){if(bl(c,!0)&&!s.find(h=>h.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(h=>h.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(h=>h.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(h=>h.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}a(s)}})}function tn(e){return`eip155:${String(Number(e))}`}var ma=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`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]+"/"+El:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+Tl:i=a.rpcUrls.default?.http[0];if(!i)throw new J(`No RPC url found for ${e}`);return i},Tp=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new J(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Or=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new en(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new en(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new en({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new en(a.rpcUrls.infura.http[0]+"/"+El):a.rpcUrls.blast?.http[0]?i=new en(a.rpcUrls.blast.http[0]+"/"+Tl):i=new en(a.rpcUrls.default?.http[0]),!i)throw new J(`No RPC url found for ${e}`);return i},fa=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 ha=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(ya))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var ya={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 B1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Pp(e,t){let r=B1(t);if(r.deepLink)return Ap(r.deepLink,e);if(r.universalLink)return Rp(r.universalLink,e);throw new T(`Unsupported wallet ${t.id}`)}var Sp="WALLETCONNECT_DEEPLINK_CHOICE";function xp(){try{localStorage.removeItem(Sp)}catch{}}function kp({href:e,name:t}){try{localStorage.setItem(Sp,JSON.stringify({href:e,name:t}))}catch{}}function _p(e){return e.startsWith("http://")||e.startsWith("https://")}function Ap(e,t){if(_p(e))return Rp(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 Rp(e,t){if(!_p(e))return Ap(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ga(e,t){window.open(e,t,"noreferrer noopener")}var Fe=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 ii=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Fe(this._startChannelOnce.bind(this)),this.pollForReady=new Fe(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let t=await this.api.post(Id,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new T("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 pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(Md,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw pe(t)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=await this.api.post(Rd,{token:this.captchaToken});H1&&!G1&&t.connect_uri&&ga(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let t=await this.api.get(Wd,{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}};import{base64url as Wp}from"jose";async function Ip(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Mp(e){return crypto.getRandomValues(new Uint8Array(e))}function va(){return!!j.get(Po)}var V1="S256",z1="S256",fr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:va();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 T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=j.get(Qo);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(qd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Qo),this.meta.headless&&j.del(Po),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=pe(r);throw o.privyErrorCode?new T(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=j.get(Qo);if(!t)throw new T("Authentication error.");try{let r=await this.api.post($d,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Qo),r}catch(r){throw pe(r)}}createCodeVerifier(){return Wp.encode(Mp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=V1){if(r==z1){let o=await Ip(t);return Wp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();j.put(Qo,t);let r=this.createStateCode();j.put(To,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&j.put(Po,!0);try{return await this.api.post(zd,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw pe(n)}}};function Il(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Lp(e,t){let r={detail:"",retryable:!1},o=Il(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 ai(){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:va()}}function si(){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"),j.del(To),window.history.replaceState({},"",e)}var ko=class{constructor(t){this.initAuthenticateOnce=new Fe(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Fe(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Jd,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):pe(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Zd,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):pe(r)}}async _initAuthenticateOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(Yd,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(Kd,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var _o=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
1
|
+
var gl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Td=(e,t,r)=>(gl(e,t,"read from private field"),r?r.call(e):t.get(e)),Qi=(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)},vl=(e,t,r,o)=>(gl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Pd=(e,t,r)=>(gl(e,t,"access private method"),r);import{getAddress as fl}from"@ethersproject/address";import{Web3Provider as gd}from"@ethersproject/providers";import{createStore as l7}from"mipd";import{useCallback as c7,useEffect as Ir,useMemo as d7,useRef as Xn,useState as Oe}from"react";import{FetchError as N1}from"ofetch";var Ie=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}]`:""}`}},Yt=class extends Ie{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},T=class extends Ie{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Xi=class extends T{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends Ie{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},pe=e=>{if(e instanceof Ie)return e;if(!(e instanceof N1))return Xe(e);if(!e.response)return new Yt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Yt(t||"ApiError",e.response.status,r||o,e,n)},Xe=e=>e instanceof Ie?e:e instanceof Error?new T(e.message,e):new T(`Internal error: ${e}`);var Jr=class extends T{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},St=class extends T{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ea=class extends T{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var mr=class extends T{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var ta="/api/v1/sessions",ra="/api/v1/sessions/logout",Sd="/api/v1/sessions/fork",oa="/api/v1/sessions/fork/recover",xd="/api/v1/siwe/init",kd="/api/v1/siwe/authenticate",_d="/api/v1/siwe/link",Ad="/api/v1/siwe/unlink",Rd="/api/v1/farcaster/init",Id="/api/v1/farcaster/authenticate",Md="/api/v1/farcaster/link",Wd="/api/v1/farcaster/status",Ld="/api/v1/farcaster/unlink",Od="/api/v1/passwordless/init",Nd="/api/v1/passwordless/authenticate",Dd="/api/v1/passwordless/link",Fd="/api/v1/passwordless/unlink",Ud="/api/v1/passwordless/update",Bd="/api/v1/passwordless_sms/init",Hd="/api/v1/passwordless_sms/link",Gd="/api/v1/passwordless_sms/unlink",Vd="/api/v1/passwordless_sms/authenticate",zd="/api/v1/oauth/init",qd="/api/v1/oauth/authenticate",$d="/api/v1/oauth/link",jd="/api/v1/oauth/unlink",Kd="/api/v1/passkeys/link/init",Yd="/api/v1/passkeys/authenticate/init",Zd="/api/v1/passkeys/link",Jd="/api/v1/passkeys/authenticate",Qd="/api/v1/passkeys/unlink";var Xd="/api/v1/mfa/passwordless_sms/init",ep="/api/v1/mfa/passwordless_sms/enroll";var tp="/api/v1/users/me/accept_terms",rp="/api/v1/analytics_events",op="/api/v1/plugins/moonpay_on_ramp/sign",np="/api/v1/custom_jwt_account/authenticate";var Jo=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let t=await this.api.post(np,{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 pe(t)}}async link(){throw new Error("Unimplemented")}};var Qr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Nd,{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 pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Dd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw pe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new T("Email must be set when initialzing authentication.");try{return await this.api.post(Od,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw pe(o)}}},na=class extends Qr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ud,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw pe(r)}}};import{isMobile as H1,isIOS as G1}from"react-device-detect";var Cl=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)}},ia=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 wl(){try{let e="privy:__session_storage__test",t="blobby",r=new ia;return r.put(e,t),r.del(e),!0}catch{return!1}}function D1(){return typeof window<"u"&&window.localStorage?new ia:new Cl}var j=D1();import{StaticJsonRpcProvider as en}from"@ethersproject/providers";function ip(){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 aa=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 bl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||aa(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!bl(r))return!1}return!0},Xr=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ap=()=>{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 sp="1.60.5";var El="4df5e2316331463a9130964bd6078dfa",Tl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",lp="34357d3c125c2bcf2ce2bc3309d98715",sa="https://auth.privy.io",cp=2e4,Me=1400,dp=2500,Pl=sp;var Eo="privy:token",Sl="privy-token",la="privy:refresh_token",xl="privy-refresh-token",ca="privy-session",oi="privy:session_transfer_token",U1="privy:wallet",ni="privy:caid",To="privy:state_code",Qo="privy:code_verifier",Po="privy:headless_oauth",da=e=>`${U1}:${e}`,kl="privy:connectors",_l="privy:connections";var So=12e4,Or=1,Al="0x1",Xo=3e4,pp="https://api.moonpay.com/v1",up="https://api.moonpay.com/v1",mp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",fp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",hp="0x420000000000000000000000000000000000000F",yp=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var gp=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},pa=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,}))$/),vp=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},eo=(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}`},Rl=e=>new Promise(t=>setTimeout(t,e));function Cp(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 wp=(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 Rl(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},ua=(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 bp=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),xo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Ep(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 c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of ip()){let u=aa(c);if(!l.some(h=>h.info.name===u)){if(bl(c,!0)&&!s.find(h=>h.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(h=>h.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(h=>h.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(h=>h.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}a(s)}})}function tn(e){return`eip155:${String(Number(e))}`}var ma=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`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]+"/"+El:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+Tl:i=a.rpcUrls.default?.http[0];if(!i)throw new J(`No RPC url found for ${e}`);return i},Tp=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new J(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Nr=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new en(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new en(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new en({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new en(a.rpcUrls.infura.http[0]+"/"+El):a.rpcUrls.blast?.http[0]?i=new en(a.rpcUrls.blast.http[0]+"/"+Tl):i=new en(a.rpcUrls.default?.http[0]),!i)throw new J(`No RPC url found for ${e}`);return i},fa=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 ha=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(ya))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var ya={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 B1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Pp(e,t){let r=B1(t);if(r.deepLink)return Ap(r.deepLink,e);if(r.universalLink)return Rp(r.universalLink,e);throw new T(`Unsupported wallet ${t.id}`)}var Sp="WALLETCONNECT_DEEPLINK_CHOICE";function xp(){try{localStorage.removeItem(Sp)}catch{}}function kp({href:e,name:t}){try{localStorage.setItem(Sp,JSON.stringify({href:e,name:t}))}catch{}}function _p(e){return e.startsWith("http://")||e.startsWith("https://")}function Ap(e,t){if(_p(e))return Rp(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 Rp(e,t){if(!_p(e))return Ap(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ga(e,t){window.open(e,t,"noreferrer noopener")}var Fe=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 ii=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Fe(this._startChannelOnce.bind(this)),this.pollForReady=new Fe(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let t=await this.api.post(Id,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new T("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 pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(Md,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw pe(t)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=await this.api.post(Rd,{token:this.captchaToken});H1&&!G1&&t.connect_uri&&ga(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let t=await this.api.get(Wd,{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}};import{base64url as Wp}from"jose";async function Ip(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Mp(e){return crypto.getRandomValues(new Uint8Array(e))}function va(){return!!j.get(Po)}var V1="S256",z1="S256",fr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:va();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 T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=j.get(Qo);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(qd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Qo),this.meta.headless&&j.del(Po),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=pe(r);throw o.privyErrorCode?new T(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=j.get(Qo);if(!t)throw new T("Authentication error.");try{let r=await this.api.post($d,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Qo),r}catch(r){throw pe(r)}}createCodeVerifier(){return Wp.encode(Mp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=V1){if(r==z1){let o=await Ip(t);return Wp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();j.put(Qo,t);let r=this.createStateCode();j.put(To,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&j.put(Po,!0);try{return await this.api.post(zd,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw pe(n)}}};function Il(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Lp(e,t){let r={detail:"",retryable:!1},o=Il(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 ai(){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:va()}}function si(){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"),j.del(To),window.history.replaceState({},"",e)}var ko=class{constructor(t){this.initAuthenticateOnce=new Fe(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Fe(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Jd,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):pe(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Zd,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):pe(r)}}async _initAuthenticateOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(Yd,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(Kd,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var _o=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 Fe(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 T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(kd,{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 pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(_d,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw pe(t)}}async sign(){if(!this.api)throw new T("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new T("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 T("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(xd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new T("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 Ao=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Vd,{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 pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Hd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw pe(t)}}async sendSmsCode(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new T("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Bd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw pe(o)}}};import{v4 as Og}from"uuid";function et(e){return new Date(e*1e3)}function q1(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:et(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:et(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:et(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:et(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:et(r.verified_at)};t.push(s);break;case"twitter_oauth":let c={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:et(r.verified_at)};t.push(c);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(u);break;case"github_oauth":let h={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(h);break;case"tiktok_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:et(r.verified_at)};t.push(f);break;case"linkedin_oauth":let g={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(g);break;case"apple_oauth":let b={subject:r.subject,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(b);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:et(r.verified_at)});break;case"farcaster":let v={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:et(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;case"passkey":let x={type:r.type,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:et(r.verified_at)};t.push(x);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Ot(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Se=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,$1=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Nt=(e,t)=>t==="all-users"&&!Se(e)||t==="users-without-wallets"&&!$1(e)?.length;function gt(e){if(!e)return null;let t=q1(e.linked_accounts),r=Ot(t,"wallet"),o=Ot(t,"email"),n=Ot(t,"phone"),a=Ot(t,"google_oauth"),i=Ot(t,"twitter_oauth"),l=Ot(t,"discord_oauth"),s=Ot(t,"github_oauth"),c=Ot(t,"spotify_oauth"),u=Ot(t,"tiktok_oauth"),h=Ot(t,"linkedin_oauth"),f=Ot(t,"apple_oauth"),g=Ot(t,"farcaster"),b=e.mfa_methods.map(({type:x,verified_at:E})=>({type:x,verifiedAt:et(E)}));return{id:e.id,createdAt:et(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:c&&{subject:c.subject,email:c.email,name:c.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:h&&{subject:h.subject,name:h.name,email:h.email},apple:f&&{subject:f.subject,email:f.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},mfaMethods:b.map(x=>x.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as vu}from"@ethersproject/address";import{isHexString as Rg}from"@ethersproject/bytes";import Ig from"eventemitter3";import rg from"@coinbase/wallet-sdk";import{jsx as Op,jsxs as j1}from"react/jsx-runtime";var Ca=({style:e,...t})=>j1("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:[Op("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Op("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"})]});import{getAddress as yr}from"@ethersproject/address";import{Web3Provider as Hp}from"@ethersproject/providers";import{default as eg}from"eventemitter3";import X1 from"eventemitter3";var K1=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Np=e=>K1.includes(e);import{ErrorCode as Y1}from"@ethersproject/logger";var rn=class extends J{constructor(){super("Wallet timeout");this.type="wallet_error"}},on=class extends J{constructor(){super("User rejected connection");this.type="wallet_error"}},Jt=e=>{if(e instanceof J)return e;if(e?.code&&e?.reason){let t=new Re(e);return e.code===Y1.ACTION_REJECTED&&(t.details=tt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Re(e):new J("Unknown connector error",e)},Dt=class extends Ie{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Re=class extends Dt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(tt).find(a=>a.eipCode===o.code);this.details=n||tt.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=tt.E32002_CONNECTION_ALREADY_PENDING:this.details=tt.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=tt.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}},J1={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}},Q1={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}},tt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Q1,...J1},Nr={...Z1,...tt};var xe=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 rn,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||So,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 J(`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 Jt(r)})}},to=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},wa=class extends X1{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=Or(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=nn(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new to(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Ce()||!this.address)throw new to("Disconnected",4900);return(await Up(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new to(`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 to(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Or(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 Dp(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 Fp(fa(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:xo(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 xo(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(Np(r.method)){let o=await Ce();if(await Bp(),!o||!this.address)throw new to("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 to("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Ce();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}}},hr=class extends xe{constructor(r){super(r,r.rpcTimeoutDuration)}},ro=class extends xe{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 tg=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},vt=class extends eg{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=tn(r),this.walletClientType==="privy"&&j.put(da(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=nn(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>yr(i.address)===yr(r));return{address:yr(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new J("Wallet is not currently connected.");let l=this.wallets.find(f=>yr(f.address)===yr(r))?.chainId;if(!l)throw new J("Unable to determine current chainId.");let s,c;if(typeof i=="number"?(s=`0x${i.toString(16)}`,c=i):(s=i,c=Number(i)),l===tn(s))return;let u=this.chains.find(f=>f.id===c);if(!u)throw new J(`Unsupported chainId: ${i}`);let h=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await h()}catch(f){if(tg(f,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??""]}]}),h();throw this.walletClientType==="rainbow"&&f.message?.includes("wallet_switchEthereumChain")?new J(`Rainbow does not support the chainId ${o}`):f}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new Hp(new hr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new ro(this.proxyProvider)},sign:async i=>{if(!await a())throw new J("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 c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}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=yr(n),i=[],l;if(this.walletClientType==="privy"){let c=j.get(da(a));this.chains.find(u=>u.id===Number(c))||(j.del(da(a)),c=null),l=c||`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 c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${Al}`,c),l=Al}let s=tn(l);if(!i.find(c=>yr(c.address)===a)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(yr(n),s,c))}ba(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=>yr(n)===yr(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 Hp(new hr(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 an={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 og=(e,t)=>{let o=ma(1,[an],{},t);return e.makeWeb3Provider(o,1)},Ea,Ta=class extends vt{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new xe(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;Ea||(Ea=new rg({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(og(Ea,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(){Ea.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Ca,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 J("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Jt(r)}}};import{jsx as Gp}from"react/jsx-runtime";var Pa=({...e})=>Gp("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Gp("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 Sa=class extends vt{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:[xo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Pa,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Vp}from"react/jsx-runtime";var sn=({style:e,...t})=>Vp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Vp("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"})});import{jsx as xt,jsxs as ng}from"react/jsx-runtime";var ln=({style:e,...t})=>ng("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:[xt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),xt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"})]});import{jsx as zp,jsxs as ig}from"react/jsx-runtime";var gr=({style:e,...t})=>ig("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:[zp("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),zp("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 dn=class extends vt{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new xe(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 J("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Jt(r)}}},cn,pn=class extends vt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Qi(this,cn,void 0);this.proxyProvider=new xe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?vl(this,cn,{name:"MetaMask",icon:ln,id:"io.metamask"}):i==="phantom"&&vl(this,cn,{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 Td(this,cn)??{name:"Browser Extension",icon:sn,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 J("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Jt(r)}}};cn=new WeakMap;import{getAddress as i9}from"@ethersproject/address";import{Web3Provider as s9}from"@ethersproject/providers";import{isMobile as ag}from"react-device-detect";var xa=class extends dn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{ag||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 J("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Jt(t)}}};var ka=class extends vt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new xe(void 0,So);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 _a=class extends ka{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:gr,id:"phantom"}}};import{EthereumProvider as xg,OPTIONAL_EVENTS as kg,OPTIONAL_METHODS as _g}from"@walletconnect/ethereum-provider";import{isMobile as Ag}from"react-device-detect";import{createContext as vg,useContext as Cg,useEffect as Ol,useRef as wg,useState as bg}from"react";import{jsx as sg}from"react/jsx-runtime";function Aa({src:e,...t}){return sg("img",{src:e,...t,style:{display:"none"}})}import{useContext as mu,useEffect as uu,useMemo as fg,useState as hg}from"react";import{createContext as yg}from"react";var Ft={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:lp,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var qp=({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 lg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),$p=e=>lg.has(e),jp=(e,t,r)=>r.indexOf(e)===t,Kp=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter($p).filter(jp):e?e.filter($p).filter(jp):Ft.appearance.walletList;var Ra={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 Ia={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 Ma={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 Yp={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 Zp={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 Wa={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 La={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 Oa={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 Jp={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 Qp={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 Xp={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 eu={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 tu={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 ru={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 ou={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 nu={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 iu={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 Na={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 Da={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 Fa={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 li={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 ci={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 au={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 su={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 Ua={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 Ba={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 Ha={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 di=[Ra,Ia,Ma,ru,su,an,Na,Da,Fa,li,ci,Qp,Xp,eu,tu,Wa,La,Oa,Jp,nu,iu,Yp,Zp,Ua,Ha,Ba,ou,au],_E=new Set(di.map(e=>e.id));import Ro from"tinycolor2";var lu="#FFFFFF",cg="#000000",dg=lu,pg="#1E1E1D";function ug(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 Dr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Ro({...e.toHsl(),l:r})}function cu({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=lu,blackHex:i=cg}){let l;switch(e){case"light":l=dg;break;case"dark":l=pg;break;default:l=e;break}let s=Ro(l),c=Ro(t),u=Ro(r),h=Ro(o),f=Ro(n),g=ug(s.getLuminance()),b=Dr(s,g==="light"?-.04:.11),v=Dr(s,g==="light"?-.88:.87),x=Dr(s,g==="light"?-.77:.75),E=Dr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),P=Dr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),W=Dr(c,.15),I=Dr(c,-.06),D=Dr(f,.3),R=Ro(c.getLuminance()>.5?i:a),B=Dr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:b.toHslString(),foreground:v.toHslString(),foreground2:x.toHslString(),foreground3:E.toHslString(),foreground4:P.toHslString(),accent:c.toHslString(),accentLight:W.toHslString(),accentDark:I.toHslString(),foregroundAccent:R.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:f.toHslString(),errorLight:D.toHslString(),warn:h.toHslString()}}function Ml(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],a=t?.loginMethods?.filter(Ae=>n.includes(Ae)),i,l,s,c,u,h,f,g,b,v,x,E,P;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),c=t.loginMethods.includes("wallet"),u=a?.includes("google"),h=a?.includes("twitter"),f=a?.includes("discord"),b=a?.includes("spotify"),g=a?.includes("tiktok"),x=a?.includes("github"),v=a?.includes("linkedin"),E=a?.includes("apple"),P=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,c=e.walletAuth,u=e.googleOAuth,h=e.twitterOAuth,f=e.discordOAuth,x=e.githubOAuth,b=e.spotifyOAuth,g=e.tiktokOAuth,v=e.linkedinOAuth,E=e.appleOAuth,P=e.farcasterAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?s=!1:e.passkeyAuth&&(s=!0);let W=[i,l].filter(Boolean),I=[u,h,f,x,b,g,v,E,P].filter(Boolean),D=[c].filter(Boolean);if(W.length+I.length+D.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&&D.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+W.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`");let B=Kp({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),$=qp({input:t?.loginMethodsAndOrder}),V=t?.intl?.defaultCountry??"US",{chains:z,defaultChain:A}=mg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),oe=!!t?.defaultChain,F=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,se,Q=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?F?se=t?.embeddedWallets?.noPromptOnSignature??!0:se=t?.embeddedWallets?.noPromptOnSignature??Q:se=Q,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&se!==!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??Ft.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ft.appearance.accentColor}),loginGroupPriority:R?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:c,email:i,sms:l,passkey:s,google:u,twitter:h,discord:f,github:x,spotify:b,tiktok:g,linkedin:v,apple:E,farcaster:P},loginMethodsAndOrder:$,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ft.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ft.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ft.rpcConfig.rpcTimeouts},chains:z,defaultChain:A,intl:{defaultCountry:V},shouldEnforceDefaultChainOnConnect:oe,captchaEnabled:e.captchaEnabled??Ft.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...F?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:se},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:F?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Ft.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Ft._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Ft._render.inParentNodeId}}}function du(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 mg({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:di.find(u=>u.id===s.id)??s)}else n=di.concat(e??[]);let a=t?n[0]:an,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 pu=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),r=Math.imul(r^a,2654435761),o=Math.imul(o^a,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};import{jsx as gg}from"react/jsx-runtime";var fu={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:""},Wl=Ml(fu,void 0,!1),Ll=yg({appConfig:Wl,isServerConfigLoaded:!1}),hu=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=hg(null),i=fg(()=>Ml(n??fu,o,!!n),[n,o]);return uu(()=>{if(!n)return;let l=du(o,t),s=pu(JSON.stringify(l)).toString(),c=`privy:sent:${n.id}:${s}`;localStorage.getItem(c)||(r.createAnalyticsEvent("sdk_initialize",l),localStorage.setItem(c,"t"))},[o,t,n]),uu(()=>{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)}})()},[]),gg(Ll.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Ga=()=>{let{appConfig:e}=mu(Ll);return e},Va=()=>{let{isServerConfigLoaded:e}=mu(Ll);return e};var C=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Tg,jsxs as Pg}from"react/jsx-runtime";var yu=vg({ready:!1,app:Wl,currentScreen:null,lastScreen:null,navigate:C,navigateBack:C,resetNavigation:C,setModalData:C,onUserCloseViaDialogOrKeybindRef:void 0}),Eg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],gu=e=>{let t=Ga(),r=e.authenticated,[o,n]=bg(e.initialScreen);Ol(()=>{!r&&!Eg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=wg(null);Ol(()=>{e.open||(a.current=null)},[e.open]),Ol(()=>{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 Pg(yu.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Tg(Aa,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>Cg(yu);import{jsx as un,jsxs as Sg}from"react/jsx-runtime";var pi=({style:e,...t})=>{let{app:r}=_();return Sg("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:[un("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),un("g",{clipPath:"url(#clip0_1765_9946)",children:un("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"})}),un("defs",{children:un("clipPath",{id:"clip0_1765_9946",children:un("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var vr=class extends vt{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 xe(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=ya[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=ha(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:ln,id:"io.metamask"}:{name:bp(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||pi,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=ya[r],this.walletClientType=r,this.redirectUri=void 0,xp(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new on)};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 J("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ha(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=nn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(Jt(i));return}o(new J("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=ma(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 xg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:kg,optionalMethods:_g,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Ag&&this.walletEntry){let{redirect:l,href:s}=Pp(i,this.walletEntry);kp({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,ga(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=ha(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 Nl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>Rg(o)).map(o=>vu(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},nn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||So:So,ui=class extends Ig{constructor(r,o,n,a,i,l,s,c,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 xe: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=c,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;j.get(kl)&&(j.getKeys().forEach(o=>{o.startsWith("walletconnect")&&j.del(o)}),j.del(kl));let r=Ep(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"),!Xr()&&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 wa(r,o,this.rpcConfig,this.chains,a,n.id),s=new Sa(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 vr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new xa(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new pn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new pn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new pn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new dn(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Ta(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new _a(this.defaultChain):new vr(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=j.get(_l);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}));j.put(_l,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=vu(r),this.emit("walletsUpdated")}};function ba(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}import{ofetch as Mg}from"ofetch";var Wg=[ta,oa,ra],za=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=Pl,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Mg.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=!Wg.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i,a.retryDelay&&(a.retryDelay=a.retryDelay*3)},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Xi}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw pe(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw pe(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw pe(o)}}};import Io from"js-cookie";function Cu(e){return e instanceof Qr?"email":e instanceof Ao?"sms":e instanceof _o?"siwe":e instanceof Jo?"custom_auth":e instanceof fr?e.meta.provider:null}import*as wu from"jose";var Cr=class{static parse(t){try{return new Cr(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 Lg=30,qa=class{constructor(){this.authenticateOnce=new Fe(async t=>this._authenticate(t)),this.linkOnce=new Fe(async t=>this._link(t)),this.refreshOnce=new Fe(this._refresh.bind(this)),this.destroyOnce=new Fe(this._destroy.bind(this)),this.forkSessionOnce=new Fe(this._forkSession.bind(this))}get token(){try{let t=j.get(Eo);return typeof t=="string"?new Cr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=j.get(la);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=j.get(oi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Io.get(ca);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=Cr.parse(this.token);return t!==null&&!t.isExpired(Lg)}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=Cu(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:gt(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),Xe(r)}}async _link(t){try{let r=await t.link();return gt(r)}catch(r){throw console.warn("Error linking account"),Xe(r)}}async _refresh(){if(!this.api)throw new T("Session has no API instance");if(!this.client)throw new T("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(ta,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(oa,{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),gt(n.user)}catch(n){if(n instanceof Yt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Xe(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 T("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Sd,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw Xe(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=j.get(Eo);if(j.put(Eo,t),!this.client?.useServerCookies){let o=Cr.parse(t)?.expiration;Io.set(Sl,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else j.del(Eo),Io.remove(Sl)}storeRefreshToken(t){typeof t=="string"?(j.put(la,t),this.client?.useServerCookies||(Io.set(ca,"t",{sameSite:"Strict",secure:!0,expires:30}),Io.set(xl,t,{sameSite:"Strict",secure:!0,expires:30}))):(j.del(la),Io.remove(xl),Io.remove(ca))}clearForkedToken(){j.del(oi)}};var Dl,$a,bu,mi=class{constructor(t){Qi(this,$a);this.apiUrl=t.apiUrl||sa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||cp,this.appId=t.appId,this.clientAnalyticsId=Pd(this,$a,bu).call(this),Dl||(Dl=new qa),this.session=Dl,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 ui(this.appId,t,r,o,n,a,i,l,s))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new za(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 T("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new T("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(Fd,{address:t});return gt(r)}catch(r){throw Xe(r)}}async acceptTerms(){try{let t=await this.api.post(tp,{});return gt(t)}catch(t){throw Xe(t)}}async unlinkPhone(t){try{let r=await this.api.post(Gd,{phoneNumber:t});return gt(r)}catch(r){throw Xe(r)}}async unlinkWallet(t){try{let r=await this.api.post(Ad,{address:t});return gt(r)}catch(r){throw Xe(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(jd,{provider:t,subject:r});return gt(o)}catch(o){throw Xe(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Ld,{fid:t});return gt(r)}catch(r){throw Xe(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Qd,{credential_id:t});return gt(r)}catch(r){throw Xe(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");let n={},a=this.session.token;a&&(n.authorization=`Bearer ${a}`),await this.api.post(rp,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{retry:-1,headers:n})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(op,t)}catch(r){throw Xe(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Cr.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={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t});return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:o.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config}}catch(t){throw Xe(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()}};$a=new WeakSet,bu=function(){if(typeof window>"u")return null;try{let r=j.get(ni);if(typeof r=="string"&&r.length>0)return r}catch{}let t=Og();try{return j.put(ni,t),t}catch{return t}};import{Turnstile as Hg}from"@marsidev/react-turnstile";import{useEffect as Gg,useMemo as Vg}from"react";import{useMemo as Ng,useRef as Dg,useContext as Fg,useState as Fl,createContext as Ug}from"react";import{jsx as Bg}from"react/jsx-runtime";var Eu=Ug({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:C,setError:C,setExecuting:C,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:C,reset:C,execute:C}),Qt=class extends Ie{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Tu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Dg(null),[a,i]=Fl(),[l,s]=Fl(),[c,u]=Fl(!1),h=Ng(()=>o?!c&&!a&&!l?{status:"ready"}:c&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,c]);return Bg(Eu.Provider,{value:{...h,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 Cp(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Qt("Captcha failed",null,"captcha_timeout")}}},children:e})},ye=()=>Fg(Eu);import{jsx as Pu}from"react/jsx-runtime";var Ul=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=ye(),[,s]=Vg(()=>r?.split("t:")||[],[r]);if(Gg(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return Pu("div",{className:"hidden h-0 w-0",children:Pu(Hg,{...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:c=>{e.onSuccess?.(c),a(c),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as j6,useEffect as v1,useRef as K6,useState as Y6}from"react";import Z6 from"react-dom";import{createContext as zg,useContext as qg}from"react";var Bl=zg({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:C,initializeWalletProxy:C,getAuthMeta:C,getAuthFlow:C,closePrivyModal:C,openPrivyModal:C,connectWallet:C,initLoginWithWallet:C,loginWithWallet:C,initLoginWithFarcaster:C,loginWithFarcaster:C,loginWithCode:C,initLoginWithEmail:C,initLoginWithSms:C,initUpdateEmail:C,resendEmailCode:C,resendSmsCode:C,initLoginWithHeadlessOAuth:C,loginWithHeadlessOAuth:C,initLoginWithOAuth:C,loginWithOAuth:C,initLoginWithPasskey:C,loginWithPasskey:C,initLinkWithPasskey:C,linkWithPasskey:C,refreshUser:C,walletProxy:null,createAnalyticsEvent:C,acceptTerms:C,getUsdTokenPrice:C,recoverEmbeddedWallet:C,getFiatOnRampConfig:C,updateWallets:C,fundWallet:C,setReadyToTrue:C,requestFarcasterSignerStatus:C}),M=()=>qg(Bl);import{createContext as $g,useContext as jg}from"react";var me=$g({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:C,login:C,connectOrCreateWallet:C,linkEmail:C,linkPhone:C,linkFarcaster:C,linkWallet:C,linkGoogle:C,linkTwitter:C,linkDiscord:C,linkGithub:C,linkSpotify:C,linkTiktok:C,linkLinkedIn:C,linkApple:C,linkPasskey:C,updateEmail:C,logout:C,getAccessToken:C,getEthereumProvider:C,getEthersProvider:C,getWeb3jsProvider:C,unlinkEmail:C,unlinkPhone:C,unlinkWallet:C,unlinkGoogle:C,unlinkTwitter:C,unlinkDiscord:C,unlinkGithub:C,unlinkSpotify:C,unlinkTiktok:C,unlinkLinkedIn:C,unlinkApple:C,unlinkFarcaster:C,unlinkPasskey:C,setActiveWallet:C,forkSession:C,createWallet:C,signMessage:C,signTypedData:C,enrollInMfa:C,initEnrollmentWithSms:C,initEnrollmentWithTotp:C,promptMfa:C,init:C,submitEnrollmentWithSms:C,submitEnrollmentWithTotp:C,unenroll:C,submit:C,cancel:C,sendTransaction:C,exportWallet:C,setWalletPassword:C,requestFarcasterSigner:C,submitCast:C,removeCast:C,likeCast:C,recastCast:C,followUser:C,unfollowUser:C,initLoginWithEmail:C,initLoginWithSms:C,otpState:{status:"initial"},loginWithCode:C,fundWallet:C,initLoginWithHeadlessOAuth:C,loginWithHeadlessOAuth:C,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>jg(me);import{useEffect as Kg,useState as Yg}from"react";var Su=e=>{let[t,r]=Yg("auto");return Kg(()=>{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};import{createContext as Zg,useContext as Jg,useEffect as Qg}from"react";var xu={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:[]}},Hl=Zg(void 0),ku=()=>Jg(Hl);function _e(e,t){if(!t)return;let o=ku().current[e];return Qg(()=>{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 O(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function _u(){let e=ku();return(t,r,...o)=>O(e,t,r,...o)}function Gl(e){_e("configureMfa",e)}import Nu from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import g2 from"@heroicons/react/24/solid/DocumentCheckIcon";import v2 from"styled-components";import Mo,{css as $l}from"styled-components";import zl from"styled-components";import{Fragment as e2,jsx as Vl,jsxs as t2}from"react/jsx-runtime";var Ct=({success:e,fail:t})=>t2(e2,{children:[Vl(wt,{className:e?"success":t?"fail":""}),Vl(ql,{className:e?"success":t?"fail":""})]}),wt=zl.span`
|
|
12
|
+
- https://privy.io`;this.getNonceOnce=new Fe(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 T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(kd,{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 pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(_d,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw pe(t)}}async sign(){if(!this.api)throw new T("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new T("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 T("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(xd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new T("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 Ao=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Vd,{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 pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Hd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw pe(t)}}async sendSmsCode(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new T("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Bd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw pe(o)}}};import{v4 as Og}from"uuid";function et(e){return new Date(e*1e3)}function q1(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:et(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:et(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:et(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:et(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:et(r.verified_at)};t.push(s);break;case"twitter_oauth":let c={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:et(r.verified_at)};t.push(c);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(u);break;case"github_oauth":let h={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(h);break;case"tiktok_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:et(r.verified_at)};t.push(f);break;case"linkedin_oauth":let g={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(g);break;case"apple_oauth":let b={subject:r.subject,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(b);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:et(r.verified_at)});break;case"farcaster":let v={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:et(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;case"passkey":let x={type:r.type,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:et(r.verified_at)};t.push(x);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Ot(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Se=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,$1=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Nt=(e,t)=>t==="all-users"&&!Se(e)||t==="users-without-wallets"&&!$1(e)?.length;function gt(e){if(!e)return null;let t=q1(e.linked_accounts),r=Ot(t,"wallet"),o=Ot(t,"email"),n=Ot(t,"phone"),a=Ot(t,"google_oauth"),i=Ot(t,"twitter_oauth"),l=Ot(t,"discord_oauth"),s=Ot(t,"github_oauth"),c=Ot(t,"spotify_oauth"),u=Ot(t,"tiktok_oauth"),h=Ot(t,"linkedin_oauth"),f=Ot(t,"apple_oauth"),g=Ot(t,"farcaster"),b=e.mfa_methods.map(({type:x,verified_at:E})=>({type:x,verifiedAt:et(E)}));return{id:e.id,createdAt:et(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:c&&{subject:c.subject,email:c.email,name:c.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:h&&{subject:h.subject,name:h.name,email:h.email},apple:f&&{subject:f.subject,email:f.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url,signerPublicKey:g.signerPublicKey},mfaMethods:b.map(x=>x.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as vu}from"@ethersproject/address";import{isHexString as Rg}from"@ethersproject/bytes";import Ig from"eventemitter3";import rg from"@coinbase/wallet-sdk";import{jsx as Op,jsxs as j1}from"react/jsx-runtime";var Ca=({style:e,...t})=>j1("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:[Op("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Op("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"})]});import{getAddress as yr}from"@ethersproject/address";import{Web3Provider as Hp}from"@ethersproject/providers";import{default as eg}from"eventemitter3";import X1 from"eventemitter3";var K1=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Np=e=>K1.includes(e);import{ErrorCode as Y1}from"@ethersproject/logger";var rn=class extends J{constructor(){super("Wallet timeout");this.type="wallet_error"}},on=class extends J{constructor(){super("User rejected connection");this.type="wallet_error"}},Jt=e=>{if(e instanceof J)return e;if(e?.code&&e?.reason){let t=new Re(e);return e.code===Y1.ACTION_REJECTED&&(t.details=tt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Re(e):new J("Unknown connector error",e)},Dt=class extends Ie{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Re=class extends Dt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(tt).find(a=>a.eipCode===o.code);this.details=n||tt.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=tt.E32002_CONNECTION_ALREADY_PENDING:this.details=tt.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=tt.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}},J1={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}},Q1={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}},tt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Q1,...J1},Dr={...Z1,...tt};var xe=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 rn,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||So,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 J(`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 Jt(r)})}},to=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},wa=class extends X1{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=Nr(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=nn(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new to(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Ce()||!this.address)throw new to("Disconnected",4900);return(await Up(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new to(`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 to(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Nr(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 Dp(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 Fp(fa(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:xo(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 xo(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(Np(r.method)){let o=await Ce();if(await Bp(),!o||!this.address)throw new to("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 to("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Ce();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}}},hr=class extends xe{constructor(r){super(r,r.rpcTimeoutDuration)}},ro=class extends xe{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 tg=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},vt=class extends eg{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=tn(r),this.walletClientType==="privy"&&j.put(da(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=nn(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>yr(i.address)===yr(r));return{address:yr(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new J("Wallet is not currently connected.");let l=this.wallets.find(f=>yr(f.address)===yr(r))?.chainId;if(!l)throw new J("Unable to determine current chainId.");let s,c;if(typeof i=="number"?(s=`0x${i.toString(16)}`,c=i):(s=i,c=Number(i)),l===tn(s))return;let u=this.chains.find(f=>f.id===c);if(!u)throw new J(`Unsupported chainId: ${i}`);let h=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await h()}catch(f){if(tg(f,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??""]}]}),h();throw this.walletClientType==="rainbow"&&f.message?.includes("wallet_switchEthereumChain")?new J(`Rainbow does not support the chainId ${o}`):f}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new Hp(new hr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new ro(this.proxyProvider)},sign:async i=>{if(!await a())throw new J("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 c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}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=yr(n),i=[],l;if(this.walletClientType==="privy"){let c=j.get(da(a));this.chains.find(u=>u.id===Number(c))||(j.del(da(a)),c=null),l=c||`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 c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${Al}`,c),l=Al}let s=tn(l);if(!i.find(c=>yr(c.address)===a)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(yr(n),s,c))}ba(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=>yr(n)===yr(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 Hp(new hr(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 an={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 og=(e,t)=>{let o=ma(1,[an],{},t);return e.makeWeb3Provider(o,1)},Ea,Ta=class extends vt{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new xe(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;Ea||(Ea=new rg({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(og(Ea,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(){Ea.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Ca,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 J("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Jt(r)}}};import{jsx as Gp}from"react/jsx-runtime";var Pa=({...e})=>Gp("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Gp("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 Sa=class extends vt{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:[xo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Pa,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Vp}from"react/jsx-runtime";var sn=({style:e,...t})=>Vp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Vp("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"})});import{jsx as xt,jsxs as ng}from"react/jsx-runtime";var ln=({style:e,...t})=>ng("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:[xt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),xt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"}),xt("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"})]});import{jsx as zp,jsxs as ig}from"react/jsx-runtime";var gr=({style:e,...t})=>ig("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:[zp("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),zp("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 dn=class extends vt{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new xe(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 J("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Jt(r)}}},cn,pn=class extends vt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Qi(this,cn,void 0);this.proxyProvider=new xe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?vl(this,cn,{name:"MetaMask",icon:ln,id:"io.metamask"}):i==="phantom"&&vl(this,cn,{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 Td(this,cn)??{name:"Browser Extension",icon:sn,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 J("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Jt(r)}}};cn=new WeakMap;import{getAddress as i9}from"@ethersproject/address";import{Web3Provider as s9}from"@ethersproject/providers";import{isMobile as ag}from"react-device-detect";var xa=class extends dn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{ag||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 J("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Jt(t)}}};var ka=class extends vt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new xe(void 0,So);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 _a=class extends ka{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:gr,id:"phantom"}}};import{EthereumProvider as xg,OPTIONAL_EVENTS as kg,OPTIONAL_METHODS as _g}from"@walletconnect/ethereum-provider";import{isMobile as Ag}from"react-device-detect";import{createContext as vg,useContext as Cg,useEffect as Ol,useRef as wg,useState as bg}from"react";import{jsx as sg}from"react/jsx-runtime";function Aa({src:e,...t}){return sg("img",{src:e,...t,style:{display:"none"}})}import{useContext as mu,useEffect as uu,useMemo as fg,useState as hg}from"react";import{createContext as yg}from"react";var Ft={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:lp,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var qp=({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 lg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),$p=e=>lg.has(e),jp=(e,t,r)=>r.indexOf(e)===t,Kp=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter($p).filter(jp):e?e.filter($p).filter(jp):Ft.appearance.walletList;var Ra={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 Ia={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 Ma={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 Yp={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 Zp={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 Wa={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 La={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 Oa={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 Jp={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 Qp={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 Xp={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 eu={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 tu={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 ru={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 ou={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 nu={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 iu={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 Na={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 Da={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 Fa={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 li={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 ci={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 au={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 su={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 Ua={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 Ba={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 Ha={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 di=[Ra,Ia,Ma,ru,su,an,Na,Da,Fa,li,ci,Qp,Xp,eu,tu,Wa,La,Oa,Jp,nu,iu,Yp,Zp,Ua,Ha,Ba,ou,au],_E=new Set(di.map(e=>e.id));import Ro from"tinycolor2";var lu="#FFFFFF",cg="#000000",dg=lu,pg="#1E1E1D";function ug(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 Fr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Ro({...e.toHsl(),l:r})}function cu({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=lu,blackHex:i=cg}){let l;switch(e){case"light":l=dg;break;case"dark":l=pg;break;default:l=e;break}let s=Ro(l),c=Ro(t),u=Ro(r),h=Ro(o),f=Ro(n),g=ug(s.getLuminance()),b=Fr(s,g==="light"?-.04:.11),v=Fr(s,g==="light"?-.88:.87),x=Fr(s,g==="light"?-.77:.75),E=Fr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),P=Fr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),W=Fr(c,.15),I=Fr(c,-.06),D=Fr(f,.3),R=Ro(c.getLuminance()>.5?i:a),B=Fr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:b.toHslString(),foreground:v.toHslString(),foreground2:x.toHslString(),foreground3:E.toHslString(),foreground4:P.toHslString(),accent:c.toHslString(),accentLight:W.toHslString(),accentDark:I.toHslString(),foregroundAccent:R.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:f.toHslString(),errorLight:D.toHslString(),warn:h.toHslString()}}function Ml(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],a=t?.loginMethods?.filter(Ae=>n.includes(Ae)),i,l,s,c,u,h,f,g,b,v,x,E,P;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),c=t.loginMethods.includes("wallet"),u=a?.includes("google"),h=a?.includes("twitter"),f=a?.includes("discord"),b=a?.includes("spotify"),g=a?.includes("tiktok"),x=a?.includes("github"),v=a?.includes("linkedin"),E=a?.includes("apple"),P=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,c=e.walletAuth,u=e.googleOAuth,h=e.twitterOAuth,f=e.discordOAuth,x=e.githubOAuth,b=e.spotifyOAuth,g=e.tiktokOAuth,v=e.linkedinOAuth,E=e.appleOAuth,P=e.farcasterAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?s=!1:e.passkeyAuth&&(s=!0);let W=[i,l].filter(Boolean),I=[u,h,f,x,b,g,v,E,P].filter(Boolean),D=[c].filter(Boolean);if(W.length+I.length+D.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&&D.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+W.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`");let B=Kp({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),$=qp({input:t?.loginMethodsAndOrder}),V=t?.intl?.defaultCountry??"US",{chains:z,defaultChain:A}=mg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),oe=!!t?.defaultChain,F=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,se,Q=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?F?se=t?.embeddedWallets?.noPromptOnSignature??!0:se=t?.embeddedWallets?.noPromptOnSignature??Q:se=Q,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&se!==!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??Ft.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ft.appearance.accentColor}),loginGroupPriority:R?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:c,email:i,sms:l,passkey:s,google:u,twitter:h,discord:f,github:x,spotify:b,tiktok:g,linkedin:v,apple:E,farcaster:P},loginMethodsAndOrder:$,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ft.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ft.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ft.rpcConfig.rpcTimeouts},chains:z,defaultChain:A,intl:{defaultCountry:V},shouldEnforceDefaultChainOnConnect:oe,captchaEnabled:e.captchaEnabled??Ft.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...F?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:se},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:F?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Ft.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Ft._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Ft._render.inParentNodeId}}}function du(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 mg({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:di.find(u=>u.id===s.id)??s)}else n=di.concat(e??[]);let a=t?n[0]:an,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 pu=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),r=Math.imul(r^a,2654435761),o=Math.imul(o^a,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};import{jsx as gg}from"react/jsx-runtime";var fu={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:""},Wl=Ml(fu,void 0,!1),Ll=yg({appConfig:Wl,isServerConfigLoaded:!1}),hu=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=hg(null),i=fg(()=>Ml(n??fu,o,!!n),[n,o]);return uu(()=>{if(!n)return;let l=du(o,t),s=pu(JSON.stringify(l)).toString(),c=`privy:sent:${n.id}:${s}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(c,"t"))},[o,t,n]),uu(()=>{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)}})()},[]),gg(Ll.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Ga=()=>{let{appConfig:e}=mu(Ll);return e},Va=()=>{let{isServerConfigLoaded:e}=mu(Ll);return e};var C=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Tg,jsxs as Pg}from"react/jsx-runtime";var yu=vg({ready:!1,app:Wl,currentScreen:null,lastScreen:null,navigate:C,navigateBack:C,resetNavigation:C,setModalData:C,onUserCloseViaDialogOrKeybindRef:void 0}),Eg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],gu=e=>{let t=Ga(),r=e.authenticated,[o,n]=bg(e.initialScreen);Ol(()=>{!r&&!Eg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=wg(null);Ol(()=>{e.open||(a.current=null)},[e.open]),Ol(()=>{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 Pg(yu.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Tg(Aa,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>Cg(yu);import{jsx as un,jsxs as Sg}from"react/jsx-runtime";var pi=({style:e,...t})=>{let{app:r}=_();return Sg("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:[un("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),un("g",{clipPath:"url(#clip0_1765_9946)",children:un("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"})}),un("defs",{children:un("clipPath",{id:"clip0_1765_9946",children:un("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var vr=class extends vt{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 xe(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=ya[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=ha(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:ln,id:"io.metamask"}:{name:bp(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||pi,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=ya[r],this.walletClientType=r,this.redirectUri=void 0,xp(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new on)};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 J("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ha(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=nn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(Jt(i));return}o(new J("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=ma(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 xg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:kg,optionalMethods:_g,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Ag&&this.walletEntry){let{redirect:l,href:s}=Pp(i,this.walletEntry);kp({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,ga(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=ha(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 Nl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>Rg(o)).map(o=>vu(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},nn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||So:So,ui=class extends Ig{constructor(r,o,n,a,i,l,s,c,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 xe: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=c,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;j.get(kl)&&(j.getKeys().forEach(o=>{o.startsWith("walletconnect")&&j.del(o)}),j.del(kl));let r=Ep(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"),!Xr()&&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 wa(r,o,this.rpcConfig,this.chains,a,n.id),s=new Sa(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 vr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new xa(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new pn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new pn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new pn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new dn(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Ta(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new _a(this.defaultChain):new vr(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=j.get(_l);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}));j.put(_l,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=vu(r),this.emit("walletsUpdated")}};function ba(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}import{ofetch as Mg}from"ofetch";var Wg=[ta,oa,ra],za=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=Pl,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Mg.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=!Wg.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i,a.retryDelay&&(a.retryDelay=a.retryDelay*3)},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Xi}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw pe(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw pe(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw pe(o)}}};import Io from"js-cookie";function Cu(e){return e instanceof Qr?"email":e instanceof Ao?"sms":e instanceof _o?"siwe":e instanceof Jo?"custom_auth":e instanceof fr?e.meta.provider:null}import*as wu from"jose";var Cr=class{static parse(t){try{return new Cr(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 Lg=30,qa=class{constructor(){this.authenticateOnce=new Fe(async t=>this._authenticate(t)),this.linkOnce=new Fe(async t=>this._link(t)),this.refreshOnce=new Fe(this._refresh.bind(this)),this.destroyOnce=new Fe(this._destroy.bind(this)),this.forkSessionOnce=new Fe(this._forkSession.bind(this))}get token(){try{let t=j.get(Eo);return typeof t=="string"?new Cr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=j.get(la);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=j.get(oi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Io.get(ca);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=Cr.parse(this.token);return t!==null&&!t.isExpired(Lg)}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=Cu(t);return i&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:i,isNewUser:a}}),i==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:gt(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),Xe(r)}}async _link(t){try{let r=await t.link();return gt(r)}catch(r){throw console.warn("Error linking account"),Xe(r)}}async _refresh(){if(!this.api)throw new T("Session has no API instance");if(!this.client)throw new T("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(ta,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(oa,{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),gt(n.user)}catch(n){if(n instanceof Yt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Xe(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 T("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Sd,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw Xe(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=j.get(Eo);if(j.put(Eo,t),!this.client?.useServerCookies){let o=Cr.parse(t)?.expiration;Io.set(Sl,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else j.del(Eo),Io.remove(Sl)}storeRefreshToken(t){typeof t=="string"?(j.put(la,t),this.client?.useServerCookies||(Io.set(ca,"t",{sameSite:"Strict",secure:!0,expires:30}),Io.set(xl,t,{sameSite:"Strict",secure:!0,expires:30}))):(j.del(la),Io.remove(xl),Io.remove(ca))}clearForkedToken(){j.del(oi)}};var Dl,$a,bu,mi=class{constructor(t){Qi(this,$a);this.apiUrl=t.apiUrl||sa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||cp,this.appId=t.appId,this.clientAnalyticsId=Pd(this,$a,bu).call(this),Dl||(Dl=new qa),this.session=Dl,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 ui(this.appId,t,r,o,n,a,i,l,s))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new za(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 T("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new T("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(Fd,{address:t});return gt(r)}catch(r){throw Xe(r)}}async acceptTerms(){try{let t=await this.api.post(tp,{});return gt(t)}catch(t){throw Xe(t)}}async unlinkPhone(t){try{let r=await this.api.post(Gd,{phoneNumber:t});return gt(r)}catch(r){throw Xe(r)}}async unlinkWallet(t){try{let r=await this.api.post(Ad,{address:t});return gt(r)}catch(r){throw Xe(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(jd,{provider:t,subject:r});return gt(o)}catch(o){throw Xe(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Ld,{fid:t});return gt(r)}catch(r){throw Xe(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Qd,{credential_id:t});return gt(r)}catch(r){throw Xe(r)}}async createAnalyticsEvent({eventName:t,payload:r,timestamp:o,options:n}){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event");let a={},i=this.session.token;i&&(a.authorization=`Bearer ${i}`),await this.api.post(rp,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{headers:a,retry:-1,keepalive:n?.keepAlive??!1})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(op,t)}catch(r){throw Xe(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Cr.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={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t});return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:o.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config}}catch(t){throw Xe(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()}};$a=new WeakSet,bu=function(){if(typeof window>"u")return null;try{let r=j.get(ni);if(typeof r=="string"&&r.length>0)return r}catch{}let t=Og();try{return j.put(ni,t),t}catch{return t}};import{Turnstile as Hg}from"@marsidev/react-turnstile";import{useEffect as Gg,useMemo as Vg}from"react";import{useMemo as Ng,useRef as Dg,useContext as Fg,useState as Fl,createContext as Ug}from"react";import{jsx as Bg}from"react/jsx-runtime";var Eu=Ug({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:C,setError:C,setExecuting:C,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:C,reset:C,execute:C}),Qt=class extends Ie{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Tu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Dg(null),[a,i]=Fl(),[l,s]=Fl(),[c,u]=Fl(!1),h=Ng(()=>o?!c&&!a&&!l?{status:"ready"}:c&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,c]);return Bg(Eu.Provider,{value:{...h,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 Cp(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Qt("Captcha failed",null,"captcha_timeout")}}},children:e})},ye=()=>Fg(Eu);import{jsx as Pu}from"react/jsx-runtime";var Ul=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=ye(),[,s]=Vg(()=>r?.split("t:")||[],[r]);if(Gg(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return Pu("div",{className:"hidden h-0 w-0",children:Pu(Hg,{...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:c=>{e.onSuccess?.(c),a(c),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as j6,useEffect as v1,useRef as K6,useState as Y6}from"react";import Z6 from"react-dom";import{createContext as zg,useContext as qg}from"react";var Bl=zg({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:C,initializeWalletProxy:C,getAuthMeta:C,getAuthFlow:C,closePrivyModal:C,openPrivyModal:C,connectWallet:C,initLoginWithWallet:C,loginWithWallet:C,initLoginWithFarcaster:C,loginWithFarcaster:C,loginWithCode:C,initLoginWithEmail:C,initLoginWithSms:C,initUpdateEmail:C,resendEmailCode:C,resendSmsCode:C,initLoginWithHeadlessOAuth:C,loginWithHeadlessOAuth:C,initLoginWithOAuth:C,loginWithOAuth:C,initLoginWithPasskey:C,loginWithPasskey:C,initLinkWithPasskey:C,linkWithPasskey:C,refreshUser:C,walletProxy:null,createAnalyticsEvent:C,acceptTerms:C,getUsdTokenPrice:C,recoverEmbeddedWallet:C,getFiatOnRampConfig:C,updateWallets:C,fundWallet:C,setReadyToTrue:C,requestFarcasterSignerStatus:C}),M=()=>qg(Bl);import{createContext as $g,useContext as jg}from"react";var me=$g({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:C,login:C,connectOrCreateWallet:C,linkEmail:C,linkPhone:C,linkFarcaster:C,linkWallet:C,linkGoogle:C,linkTwitter:C,linkDiscord:C,linkGithub:C,linkSpotify:C,linkTiktok:C,linkLinkedIn:C,linkApple:C,linkPasskey:C,updateEmail:C,logout:C,getAccessToken:C,getEthereumProvider:C,getEthersProvider:C,getWeb3jsProvider:C,unlinkEmail:C,unlinkPhone:C,unlinkWallet:C,unlinkGoogle:C,unlinkTwitter:C,unlinkDiscord:C,unlinkGithub:C,unlinkSpotify:C,unlinkTiktok:C,unlinkLinkedIn:C,unlinkApple:C,unlinkFarcaster:C,unlinkPasskey:C,setActiveWallet:C,forkSession:C,createWallet:C,signMessage:C,signTypedData:C,enrollInMfa:C,initEnrollmentWithSms:C,initEnrollmentWithTotp:C,promptMfa:C,init:C,submitEnrollmentWithSms:C,submitEnrollmentWithTotp:C,unenroll:C,submit:C,cancel:C,sendTransaction:C,exportWallet:C,setWalletPassword:C,requestFarcasterSigner:C,submitCast:C,removeCast:C,likeCast:C,recastCast:C,followUser:C,unfollowUser:C,initLoginWithEmail:C,initLoginWithSms:C,otpState:{status:"initial"},loginWithCode:C,fundWallet:C,initLoginWithHeadlessOAuth:C,loginWithHeadlessOAuth:C,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>jg(me);import{useEffect as Kg,useState as Yg}from"react";var Su=e=>{let[t,r]=Yg("auto");return Kg(()=>{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};import{createContext as Zg,useContext as Jg,useEffect as Qg}from"react";var xu={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:[]}},Hl=Zg(void 0),ku=()=>Jg(Hl);function _e(e,t){if(!t)return;let o=ku().current[e];return Qg(()=>{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 O(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function _u(){let e=ku();return(t,r,...o)=>O(e,t,r,...o)}function Gl(e){_e("configureMfa",e)}import Nu from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import g2 from"@heroicons/react/24/solid/DocumentCheckIcon";import v2 from"styled-components";import Mo,{css as $l}from"styled-components";import zl from"styled-components";import{Fragment as e2,jsx as Vl,jsxs as t2}from"react/jsx-runtime";var Ct=({success:e,fail:t})=>t2(e2,{children:[Vl(wt,{className:e?"success":t?"fail":""}),Vl(ql,{className:e?"success":t?"fail":""})]}),wt=zl.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
|
-
`,
|
|
51
|
+
`,Ur=e=>Vl(Xg,{color:e.color||"var(--privy-color-foreground-3)"}),Xg=zl(wt)`
|
|
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
|
-
`,N=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ut(Au,{disabled:t||r,...n,children:t?Za("span",{children:[Ut(
|
|
88
|
+
`,N=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ut(Au,{disabled:t||r,...n,children:t?Za("span",{children:[Ut(Ur,{}),o?Ut("span",{children:o}):null]}):e}),BP=Mo(N)`
|
|
89
89
|
${e=>e.hideAnimations&&$l`
|
|
90
90
|
&& {
|
|
91
91
|
transition: none;
|
|
92
92
|
}
|
|
93
93
|
`}
|
|
94
|
-
`,Ka=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ut(Au,{as:"a",disabled:t||r,...n,children:t?Za("span",{children:[Ut(
|
|
94
|
+
`,Ka=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ut(Au,{as:"a",disabled:t||r,...n,children:t?Za("span",{children:[Ut(Ur,{}),o?Ut("span",{children:o}):null]}):e}),Au=Mo(ja)`
|
|
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
|
-
`,Xt=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ut(r2,{disabled:t||r,...n,children:t?Za("span",{children:[Ut(
|
|
139
|
+
`,Xt=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ut(r2,{disabled:t||r,...n,children:t?Za("span",{children:[Ut(Ur,{}),o?Ut("span",{children:o}):null]}):e}),r2=Mo(ja)`
|
|
140
140
|
&& {
|
|
141
141
|
border-width: 1px;
|
|
142
142
|
border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
|
|
@@ -199,7 +199,7 @@ Resources:
|
|
|
199
199
|
`,HP=Mo.div`
|
|
200
200
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
201
201
|
height: 44px;
|
|
202
|
-
`,mn=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>Za(o2,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Ut("span",{children:e}),Ut("span",{children:Ut(
|
|
202
|
+
`,mn=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>Za(o2,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Ut("span",{children:e}),Ut("span",{children:Ut(Ur,{})})]}),o2=Mo.button`
|
|
203
203
|
&& {
|
|
204
204
|
color: var(--privy-color-accent);
|
|
205
205
|
font-size: 16px;
|
|
@@ -393,7 +393,7 @@ Resources:
|
|
|
393
393
|
${Wu}
|
|
394
394
|
`,Yl=yn.a`
|
|
395
395
|
${Wu}
|
|
396
|
-
`,
|
|
396
|
+
`,Br=yn.div`
|
|
397
397
|
width: 100%;
|
|
398
398
|
${e=>e.if?"display: none;":""}
|
|
399
399
|
`;import ze from"styled-components";var We=ze.div`
|
|
@@ -568,7 +568,7 @@ Resources:
|
|
|
568
568
|
width: auto !important;
|
|
569
569
|
color: white;
|
|
570
570
|
}
|
|
571
|
-
`;import{Fragment as b2,jsx as wr,jsxs as fi}from"react/jsx-runtime";var Du=()=>{let{user:e,logout:t}=G(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=_(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:s}=M(),c=h=>{h?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async h=>{h.preventDefault(),await i(),e&&Nt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:f=>{console.error(f),s("embedded_wallet_creation_failure_logout",{error:f,screen:"AffirmativeConsentScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return wr(C2,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},C2=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>fi(b2,{children:[wr(S,{closeable:!1}),wr(g2,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),wr(we,{style:{marginTop:24},children:"One last step"}),wr(fe,{children:"By signing up, you agree to our terms and privacy policy."}),fi(Bt,{style:{marginTop:24},children:[e&&fi(Yl,{target:"_blank",href:e,children:["View Terms ",wr(Nu,{style:{marginLeft:"auto"}})]}),t&&fi(Yl,{target:"_blank",href:t,children:["View Privacy Policy ",wr(Nu,{style:{marginLeft:"auto"}})]})]}),fi(w2,{style:{marginTop:24},children:[wr(Xt,{onClick:o,children:"No thanks"}),wr(N,{onClick:r,children:"Accept"})]}),wr(q,{protectedByPrivy:!0})]}),w2=v2.div`
|
|
571
|
+
`;import{Fragment as b2,jsx as wr,jsxs as fi}from"react/jsx-runtime";var Du=()=>{let{user:e,logout:t}=G(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=_(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:s}=M(),c=h=>{h?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async h=>{h.preventDefault(),await i(),e&&Nt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:f=>{console.error(f),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:f,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return wr(C2,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},C2=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>fi(b2,{children:[wr(S,{closeable:!1}),wr(g2,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),wr(we,{style:{marginTop:24},children:"One last step"}),wr(fe,{children:"By signing up, you agree to our terms and privacy policy."}),fi(Bt,{style:{marginTop:24},children:[e&&fi(Yl,{target:"_blank",href:e,children:["View Terms ",wr(Nu,{style:{marginLeft:"auto"}})]}),t&&fi(Yl,{target:"_blank",href:t,children:["View Privacy Policy ",wr(Nu,{style:{marginLeft:"auto"}})]})]}),fi(w2,{style:{marginTop:24},children:[wr(Xt,{onClick:o,children:"No thanks"}),wr(N,{onClick:r,children:"Accept"})]}),wr(q,{protectedByPrivy:!0})]}),w2=v2.div`
|
|
572
572
|
display: flex;
|
|
573
573
|
gap: 10px;
|
|
574
574
|
`;import Uu from"styled-components";import E2 from"styled-components";var os=E2.span`
|
|
@@ -725,7 +725,7 @@ Resources:
|
|
|
725
725
|
h3 {
|
|
726
726
|
margin-bottom: 24px;
|
|
727
727
|
}
|
|
728
|
-
`;import{Fragment as tc,jsx as rt,jsxs as io}from"react/jsx-runtime";var rc=6,Ku=new Array(rc).fill(""),M2=1400;var Zu=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:a,resendEmailCode:i,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:h}=M(),{authenticated:f,logout:g,user:b}=G(),[v,x]=as(Ku),[E,P]=as(!1),[W,I]=as(null),[D,R]=as(null);n.current=()=>null;let B=s()?.email?0:1,$=e?.render.inDialog?Me:0,V=e?.render.inDialog?$-500:0;ju(()=>{if(f&&E&&b){if(e?.legal.requireUsersAcceptTerms&&!b.hasAcceptedTerms){let Q=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},V);return()=>clearTimeout(Q)}if(Nt(b,e?.embeddedWallets?.createOnLogin)){let Q=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:Y=>{console.error(Y),h("embedded_wallet_creation_failure_logout",{error:Y,screen:"AwaitingPasswordlessCodeScreen"}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},V);return()=>clearTimeout(Q)}else{u();let Q=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),$);return()=>clearTimeout(Q)}}},[f,E,b]),ju(()=>{if(W&&D===0){let se=setTimeout(()=>{x(Ku),I(null),document.querySelector("input[name=code-0]")?.focus()},M2);return()=>clearTimeout(se)}},[W]);let z=se=>{se.preventDefault();let Q=se.currentTarget.value.replace(" ","");if(Q==="")return;if(isNaN(Number(Q))){I("Code should be numeric"),R(1);return}I(null),R(null);let Y=Number(se.currentTarget.name?.charAt(5)),Ae=[...Q||[""]].slice(0,rc-Y),ee=[...v.slice(0,Y),...Ae,...v.slice(Y+Ae.length)];x(ee);let cr=Ae.length,at=Math.min(Math.max(Y+cr,0),rc-1);isNaN(Number(se.currentTarget.value))||document.querySelector(`input[name=code-${at}]`)?.focus(),ee.every(Ne=>Ne&&!isNaN(+Ne))&&(document.querySelector(`input[name=code-${at}]`)?.blur(),c(ee.join("")).then(()=>P(!0)).catch(ue=>{if(ue?.status===422)I("Invalid or expired verification code");else if(ue instanceof Yt&&ue.privyErrorCode==="cannot_link_more_of_type")I(ue.message);else if(ue instanceof Yt&&ue.privyErrorCode==="max_accounts_reached"){console.error(new mr(ue).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else I("Issue verifying code");R(0)}))},A=se=>{D===1&&(I(null),R(null));let Q=[...v.slice(0,se),"",...v.slice(se+1)];x(Q),se>0&&document.querySelector(`input[name=code-${se-1}]`)?.focus()},oe=B==0?rt(A2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):rt(R2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),F=B==0?io("p",{children:["Please check ",rt(Yu,{children:s()?.email})," for an email from privy.io and enter your code below."]}):io("p",{children:["Please check ",rt(Yu,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return io(tc,{children:[rt(S,{backFn:()=>r()},"header"),io(W2,{children:[rt(Pe,{title:"Enter confirmation code",description:F,icon:oe}),io(Hu,{children:[io(L2,{children:[rt(O2,{fail:!!W,success:E,children:rt("span",{children:W||(E?"Success!":"")})}),rt("div",{children:v.map((se,Q)=>rt("input",{name:`code-${Q}`,type:"text",value:v[Q],onChange:z,onKeyUp:Y=>{Y.key==="Backspace"&&A(Q)},inputMode:"numeric",autoFocus:Q===0,pattern:"[0-9]",className:`${E?"success":""} ${W?"fail":""}`,autoComplete:I2?"one-time-code":"off"},Q))})]}),rt(N2,{children:B==0?io(tc,{children:[rt("span",{children:"Didn't get an email?"}),rt("button",{onClick:i,children:"Resend code"})]}):io(tc,{children:[rt("span",{children:"Didn't get a message?"}),rt("button",{onClick:l,children:"Resend code"})]})})]})]}),rt(q,{protectedByPrivy:!0})]})},W2=gi.div`
|
|
728
|
+
`;import{Fragment as tc,jsx as rt,jsxs as io}from"react/jsx-runtime";var rc=6,Ku=new Array(rc).fill(""),M2=1400;var Zu=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:a,resendEmailCode:i,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:h}=M(),{authenticated:f,logout:g,user:b}=G(),[v,x]=as(Ku),[E,P]=as(!1),[W,I]=as(null),[D,R]=as(null);n.current=()=>null;let B=s()?.email?0:1,$=e?.render.inDialog?Me:0,V=e?.render.inDialog?$-500:0;ju(()=>{if(f&&E&&b){if(e?.legal.requireUsersAcceptTerms&&!b.hasAcceptedTerms){let Q=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},V);return()=>clearTimeout(Q)}if(Nt(b,e?.embeddedWallets?.createOnLogin)){let Q=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:Y=>{console.error(Y),h({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Y,screen:"AwaitingPasswordlessCodeScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},V);return()=>clearTimeout(Q)}else{u();let Q=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),$);return()=>clearTimeout(Q)}}},[f,E,b]),ju(()=>{if(W&&D===0){let se=setTimeout(()=>{x(Ku),I(null),document.querySelector("input[name=code-0]")?.focus()},M2);return()=>clearTimeout(se)}},[W]);let z=se=>{se.preventDefault();let Q=se.currentTarget.value.replace(" ","");if(Q==="")return;if(isNaN(Number(Q))){I("Code should be numeric"),R(1);return}I(null),R(null);let Y=Number(se.currentTarget.name?.charAt(5)),Ae=[...Q||[""]].slice(0,rc-Y),ee=[...v.slice(0,Y),...Ae,...v.slice(Y+Ae.length)];x(ee);let cr=Ae.length,at=Math.min(Math.max(Y+cr,0),rc-1);isNaN(Number(se.currentTarget.value))||document.querySelector(`input[name=code-${at}]`)?.focus(),ee.every(Ne=>Ne&&!isNaN(+Ne))&&(document.querySelector(`input[name=code-${at}]`)?.blur(),c(ee.join("")).then(()=>P(!0)).catch(ue=>{if(ue?.status===422)I("Invalid or expired verification code");else if(ue instanceof Yt&&ue.privyErrorCode==="cannot_link_more_of_type")I(ue.message);else if(ue instanceof Yt&&ue.privyErrorCode==="max_accounts_reached"){console.error(new mr(ue).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else I("Issue verifying code");R(0)}))},A=se=>{D===1&&(I(null),R(null));let Q=[...v.slice(0,se),"",...v.slice(se+1)];x(Q),se>0&&document.querySelector(`input[name=code-${se-1}]`)?.focus()},oe=B==0?rt(A2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):rt(R2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),F=B==0?io("p",{children:["Please check ",rt(Yu,{children:s()?.email})," for an email from privy.io and enter your code below."]}):io("p",{children:["Please check ",rt(Yu,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return io(tc,{children:[rt(S,{backFn:()=>r()},"header"),io(W2,{children:[rt(Pe,{title:"Enter confirmation code",description:F,icon:oe}),io(Hu,{children:[io(L2,{children:[rt(O2,{fail:!!W,success:E,children:rt("span",{children:W||(E?"Success!":"")})}),rt("div",{children:v.map((se,Q)=>rt("input",{name:`code-${Q}`,type:"text",value:v[Q],onChange:z,onKeyUp:Y=>{Y.key==="Backspace"&&A(Q)},inputMode:"numeric",autoFocus:Q===0,pattern:"[0-9]",className:`${E?"success":""} ${W?"fail":""}`,autoComplete:I2?"one-time-code":"off"},Q))})]}),rt(N2,{children:B==0?io(tc,{children:[rt("span",{children:"Didn't get an email?"}),rt("button",{onClick:i,children:"Resend code"})]}):io(tc,{children:[rt("span",{children:"Didn't get a message?"}),rt("button",{onClick:l,children:"Resend code"})]})})]})]}),rt(q,{protectedByPrivy:!0})]})},W2=gi.div`
|
|
729
729
|
display: flex;
|
|
730
730
|
flex-direction: column;
|
|
731
731
|
align-items: flex-start;
|
|
@@ -875,7 +875,7 @@ Resources:
|
|
|
875
875
|
justify-content: center;
|
|
876
876
|
`;import{Fragment as h3,jsx as Sn,jsxs as y3}from"react/jsx-runtime";var um=()=>{let{app:e}=_();return y3(h3,{children:[Sn(S,{},"header"),Sn(f3,{}),Sn(Bt,{children:Sn(Tn,{connectOnly:!0})}),e&&Sn(fn,{app:e,alwaysShowImplicitConsent:!0}),Sn(q,{protectedByPrivy:!0})]})},f3=m3(Pn)`
|
|
877
877
|
margin-bottom: 16px;
|
|
878
|
-
`;import{useEffect as gm,useState as vm}from"react";import{isMobile as T3}from"react-device-detect";import P3 from"styled-components";import{useEffect as ic,useState as No}from"react";import{isMobile as ss}from"react-device-detect";import{useInterval as w3}from"react-use";import fm from"styled-components";import{useState as g3,useEffect as v3,useCallback as C3}from"react";function mm(){let[e,t]=g3(!1),r=C3(()=>{document.hidden&&t(!0)},[]);return v3(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as ym,jsx as $e,jsxs as Ei}from"react/jsx-runtime";var ac=2,sc=e=>e?.privyErrorCode==="linked_to_another_user"?
|
|
878
|
+
`;import{useEffect as gm,useState as vm}from"react";import{isMobile as T3}from"react-device-detect";import P3 from"styled-components";import{useEffect as ic,useState as No}from"react";import{isMobile as ss}from"react-device-detect";import{useInterval as w3}from"react-use";import fm from"styled-components";import{useState as g3,useEffect as v3,useCallback as C3}from"react";function mm(){let[e,t]=g3(!1),r=C3(()=>{document.hidden&&t(!0)},[]);return v3(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as ym,jsx as $e,jsxs as Ei}from"react/jsx-runtime";var ac=2,sc=e=>e?.privyErrorCode==="linked_to_another_user"?Dr.ERROR_USER_EXISTS:e instanceof Re&&!e.details.default?e.details:e instanceof rn?Dr.ERROR_TIMED_OUT:e instanceof on?Dr.ERROR_USER_REJECTED_CONNECTION:Dr.ERROR_WALLET_CONNECTION,hm=()=>{let[e,t]=No(!1),[r,o]=No(!1),[n,a]=No(void 0),{authenticated:i,logout:l}=G(),{app:s,navigate:c,navigateBack:u,lastScreen:h,currentScreen:f,setModalData:g}=_(),{getAuthFlow:b,walletConnectionStatus:v,closePrivyModal:x,initLoginWithWallet:E,loginWithWallet:P,updateWallets:W,createAnalyticsEvent:I}=M(),{walletConnectors:D}=G(),[R,B]=No(0),{user:$}=G(),[V]=No($?.linkedAccounts.length||0),[z,A]=No(""),[oe,F]=No(!1),{hasTabbedAway:se}=mm(),{enabled:Q,token:Y}=ye(),Ae=ss&&v?.connector?.connectorType==="wallet_connect_v2"||ss&&v?.connector?.connectorType==="coinbase_wallet"||ss&&v?.connector?.connectorType==="injected"&&v?.connector?.walletClientType==="phantom",ee=v?.status==="connected",cr=v?.status==="switching_to_supported_chain";ic(()=>{let H=b();if(ee&&!H&&(Q&&!Y&&!i?(g({captchaModalData:{callback:ur=>E(v.connectedWallet,ur).then(()=>{F(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):E(v.connectedWallet,Y).then(()=>{F(!0)})),H&&Ae&&ee&&!H.preparedMessage){H.buildSiweMessage();return}!H||Ae||!ee||r||(async()=>{o(!0),a(void 0);try{v?.connector?.connectorType==="wallet_connect_v2"&&v?.connector?.walletClientType==="metamask"&&await Rl(2500),await Ne()}catch(ur){console.warn("Auto-prompted signature failed",ur)}finally{o(!1)}})()},[R,ee,oe]),ic(()=>{if($&&e){let H=s?.render.inDialog?Me:0,ur=s?.render.inDialog?H-500:0;if(s?.legal.requireUsersAcceptTerms&&!$.hasAcceptedTerms){let ht=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},ur);return()=>clearTimeout(ht)}if(Nt($,s?.embeddedWallets?.createOnLogin)){let ht=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:Wr=>{console.error(Wr),I({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Wr,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ur);return()=>clearTimeout(ht)}W();let ne=setTimeout(()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Me);return()=>clearTimeout(ne)}},[$,e]);let at=H=>{if(H?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(H?.privyErrorCode==="max_accounts_reached"){console.error(new mr(H).toString()),c("USER_LIMIT_REACHED_SCREEN");return}a(sc(H))};async function Ne(){try{if(await P(),!s?.render.inDialog)return x({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(H){at(H)}finally{o(!1)}}ic(()=>{v?.connectError&&at(v?.connectError)},[v]),w3(()=>{let H=ue==="wallet_connect_v2"&&v?.connector instanceof vr?v.connector.redirectUri:void 0;H&&A(H)},v?.connector instanceof vr&&!z?500:null);let ue=v?.connector?.connectorType||"injected",Mt=v?.connector?.walletClientType||"unknown",dr=Pr[Mt]?.displayName||v?.connector?.walletBranding.name||"Browser Extension",jo=Pr[Mt]?.logo||v?.connector?.walletBranding.icon||(H=>$e(sn,{...H})),pr=dr==="Browser Extension"?dr.toLowerCase():dr,ft;e?ft=`Successfully connected with ${pr}`:n?ft=n.message:cr?ft="Switching networks":ee?ft=r&&Ae?"Signing":"Sign to verify":ft=`Waiting for ${pr}`;let De="Don\u2019t see your wallet? Check your other browser windows.";if(e){let H=$?.linkedAccounts.length||0;V===H?De="Wallet was already linked.":De="You\u2019re good to go!"}else R>=ac&&n?De="Unable to connect wallet":n?De=n.detail:cr?De="Switch your wallet to the requested network.":ee&&Ae?De="Sign the message in your wallet to verify it belongs to you.":Mt==="metamask"&&ss?De="Click continue to open and connect MetaMask.":Mt==="metamask"?De="For the best experience, connect only one wallet at a time.":ue==="wallet_connect"?De="Open your mobile wallet app to continue":ue==="coinbase_wallet"&&(ap()||(Nl($)?De="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":De="Open the Coinbase app on your phone to continue."));let L=D?.walletConnectors?.find(H=>H.walletClientType==="coinbase_wallet"),ae=Mt==="coinbase_wallet"&&(Nl($)||n===Dr.ERROR_USER_EXISTS);return Ei(ym,{children:[$e(S,{backFn:!h||f===h?void 0:u}),Ei(b3,{children:[$e(lc,{walletLogo:jo,success:e,fail:!!n}),Ei(Ue,{children:[$e("h3",{children:ft}),$e("p",{children:De}),!ee&&z&&!se?Ei("p",{children:["Still here?"," ",$e("a",{href:z,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),ae?$e(N,{onClick:()=>L&&L?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Dr.ERROR_USER_EXISTS&&f!==h?$e(N,{onClick:u,children:"Use a different wallet"}):ee&&!e&&Ae?$e(N,{onClick:()=>{o(!0),Ne()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&R<ac?$e(N,{onClick:()=>{B(R+1),a(void 0),ee?(o(!0),Ne()):v?.connectRetry()},disabled:!e&&(!n?.retryable||R>=ac),children:"Retry"}):!e&&!n?$e(N,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),$e(K,{})]})},b3=fm.div`
|
|
879
879
|
display: flex;
|
|
880
880
|
flex-direction: column;
|
|
881
881
|
align-items: center;
|
|
@@ -905,7 +905,7 @@ Resources:
|
|
|
905
905
|
left: -19px;
|
|
906
906
|
top: -19px;
|
|
907
907
|
}
|
|
908
|
-
`,lc=e=>{let t=e.walletLogo;return $e(ym,{children:$e(E3,{children:Ei("div",{children:[$e(Ct,{success:e.success,fail:e.fail}),typeof t=="string"?$e("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):$e(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as x3,jsx as
|
|
908
|
+
`,lc=e=>{let t=e.walletLogo;return $e(ym,{children:$e(E3,{children:Ei("div",{children:[$e(Ct,{success:e.success,fail:e.fail}),typeof t=="string"?$e("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):$e(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as x3,jsx as Hr,jsxs as cc}from"react/jsx-runtime";var ls=2,Cm=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=_(),{walletConnectionStatus:o,closePrivyModal:n}=M(),[a,i]=vm(void 0),[l,s]=vm(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";gm(()=>{if(c){let W=setTimeout(n,Me);return()=>clearTimeout(W)}},[c]);let h=W=>{i(sc(W))};gm(()=>{o?.connectError&&h(o?.connectError)},[o]);let f=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",b=Pr[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",v=Pr[g]?.logo||o?.connector?.walletBranding.icon||(W=>Hr(sn,{...W})),x=b==="Browser Extension"?b.toLowerCase():b,E;c?E=`Successfully connected with ${x}`:a?E=a.message:u?E="Switching networks":E=`Waiting for ${x}`;let P="Don\u2019t see your wallet? Check your other browser windows.";return c?P="You\u2019re good to go!":l>=ls&&a?P="Unable to connect wallet":a?P=a.detail:u?P="Switch your wallet to the requested network.":g==="metamask"&&T3?P="Click to continue to open and connect MetaMask.":g==="metamask"?P="For the best experience, connect only one wallet at a time.":f==="wallet_connect_v2"?P="Open your mobile wallet app to continue":f==="coinbase_wallet"&&(P="Open the Coinbase app on your phone to continue."),cc(x3,{children:[Hr(S,{backFn:r===t?void 0:e}),cc(S3,{children:[Hr(lc,{walletLogo:v,success:c,fail:!!a}),cc(Ue,{children:[Hr("h3",{children:E}),Hr("p",{children:P})]}),a==Dr.ERROR_USER_EXISTS?Hr(N,{onClick:e,children:"Use a different wallet"}):!c&&a?.retryable&&l<ls?Hr(N,{onClick:()=>{s(l+1),i(void 0),o?.connectRetry()},disabled:!c&&(!a?.retryable||l>=ls),children:"Retry"}):!c&&a&&l>=ls?Hr(N,{onClick:e,children:"Use a different wallet"}):null]}),Hr(K,{})]})},S3=P3.div`
|
|
909
909
|
display: flex;
|
|
910
910
|
flex-direction: column;
|
|
911
911
|
align-items: center;
|
|
@@ -968,9 +968,9 @@ Resources:
|
|
|
968
968
|
transform: rotate(360deg);
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
|
-
`;var wm=["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 be=class extends Error{constructor(r,o){super(o);this.type=r}};function kn(e){let t=e.type;return typeof t=="string"&&wm.includes(t)}function M3(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Do(e){return kn(e)&&e.type==="wallet_not_on_device"}function bm(e){return kn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function _n(e){return!!(kn(e)&&e.type==="mfa_timeout")}function An(e){return!!(kn(e)&&e.type==="missing_or_invalid_mfa")}function pc(e){return!!(kn(e)&&e.type==="mfa_verification_max_attempts_reached")}function uc(e){return!!(kn(e)&&e.message.includes("code 429"))}function mc(e){return!!(M3(e)&&e.message==="MFA canceled")}import{Fragment as Tm,jsx as Rn,jsxs as fc}from"react/jsx-runtime";var Em=1,Pm=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=M(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=O3(()=>Date.now(),[]),[h,f]=N3(!1),{onCompleteNavigateTo:g,onFailure:b}=l?.connectWallet,v=E=>{h||(f(!0),b(typeof E=="string"?new Error(E):E))};L3(()=>{let E=Se(t),P;return!e||!E?v("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let I=await r();if(!I)return v("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:I,address:E.address});let D=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&D<Em?P=setTimeout(()=>{i(g)},(Em-D)*1e3):i(g)}catch(D){if(Do(D)&&E.recoveryMethod==="privy"){let R=await r();if(!R)return v("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:E.address}),(await a?.recover({address:E.address,accessToken:R}))?.address||v(new Error("Unable to recover wallet")),g?i(g):o({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:E.address}),i(g)}catch{v("An error has occurred, please try again.")}}else Do(D)?(s({...l,recoverWallet:{privyWallet:E,onCompleteNavigateTo:g,onFailure:b}}),i("EMBEDDED_WALLET_RECOVERY_SCREEN")):v(D)}})(),()=>clearTimeout(P)):void 0},[e,t,a]);let x=()=>{v("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=x,fc(Tm,{children:[Rn(S,{onClose:x}),h?fc(Tm,{children:[fc(tr,{children:[Rn(W3,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Rn(Pe,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Rn(N,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Rn(xn,{}),Rn(F3,{})]})},F3=D3.div`
|
|
971
|
+
`;var wm=["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 be=class extends Error{constructor(r,o){super(o);this.type=r}};function kn(e){let t=e.type;return typeof t=="string"&&wm.includes(t)}function M3(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Do(e){return kn(e)&&e.type==="wallet_not_on_device"}function bm(e){return kn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function _n(e){return!!(kn(e)&&e.type==="mfa_timeout")}function An(e){return!!(kn(e)&&e.type==="missing_or_invalid_mfa")}function pc(e){return!!(kn(e)&&e.type==="mfa_verification_max_attempts_reached")}function uc(e){return!!(kn(e)&&e.message.includes("code 429"))}function mc(e){return!!(M3(e)&&e.message==="MFA canceled")}import{Fragment as Tm,jsx as Rn,jsxs as fc}from"react/jsx-runtime";var Em=1,Pm=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=M(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=O3(()=>Date.now(),[]),[h,f]=N3(!1),{onCompleteNavigateTo:g,onFailure:b}=l?.connectWallet,v=E=>{h||(f(!0),b(typeof E=="string"?new Error(E):E))};L3(()=>{let E=Se(t),P;return!e||!E?v("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let I=await r();if(!I)return v("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:I,address:E.address});let D=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&D<Em?P=setTimeout(()=>{i(g)},(Em-D)*1e3):i(g)}catch(D){if(Do(D)&&E.recoveryMethod==="privy"){let R=await r();if(!R)return v("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:E.address}}),(await a?.recover({address:E.address,accessToken:R}))?.address||v(new Error("Unable to recover wallet")),g?i(g):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:E.address}}),i(g)}catch{v("An error has occurred, please try again.")}}else Do(D)?(s({...l,recoverWallet:{privyWallet:E,onCompleteNavigateTo:g,onFailure:b}}),i("EMBEDDED_WALLET_RECOVERY_SCREEN")):v(D)}})(),()=>clearTimeout(P)):void 0},[e,t,a]);let x=()=>{v("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=x,fc(Tm,{children:[Rn(S,{onClose:x}),h?fc(Tm,{children:[fc(tr,{children:[Rn(W3,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Rn(Pe,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),Rn(N,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):Rn(xn,{}),Rn(F3,{})]})},F3=D3.div`
|
|
972
972
|
height: 44px;
|
|
973
|
-
`;import U3 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as B3}from"react";import{Fragment as H3,jsx as In,jsxs as Sm}from"react/jsx-runtime";var xm=()=>{let{user:e}=G(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=a.createWallet,u=()=>{let h=Se(e);h?(o(),l(h)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return B3(()=>{let h=setTimeout(u,dp);return()=>clearTimeout(h)},[]),i.current=u,Sm(H3,{children:[In(S,{onClose:u}),In(Z,{}),Sm(tr,{children:[In(U3,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),In(Pe,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),In(te,{}),In(q,{protectedByPrivy:!0})]})};import G3 from"@heroicons/react/20/solid/ExclamationTriangleIcon";import V3 from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as Am,useRef as z3,useState as hc}from"react";import ao from"styled-components";import{Fragment as X3,jsx as Le,jsxs as ir}from"react/jsx-runtime";var Rm=()=>{let[e,t]=hc(null),{authenticated:r,user:o,getAccessToken:n}=G(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:l}=M(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=Se(o)?.address,{onFailure:h,onSuccess:f,origin:g,appId:b}=s.keyExport,v=E=>{a({shouldCallAuthOnSuccess:!1}),h(typeof E=="string"?new Error(E):E)},x=()=>{a({shouldCallAuthOnSuccess:!1}),f(),i("embedded_wallet_key_export_completed",{walletAddress:u})};return Am(()=>{let E=Se(o);if(!r||!E)return v("User must be authenticated before exporting their wallet");n().then(t,v)},[r,o]),c.current=x,ir(X3,{children:[Le(S,{onClose:x}),ir(j3,{children:[ir(Pe,{icon:Le(V3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[ir(J3,{children:[Le($3,{style:{marginRight:6}}),eo(u)]}),Le("p",{children:"You can bring your account with you to another site using an external wallet."})]}),ir(K3,{children:[ir(km,{children:[Le(_m,{children:"1"}),ir("span",{children:[Le("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."]})]}),ir(km,{children:[Le(_m,{children:"2"}),Le("span",{children:"Copy this key into your other wallet"})]})]}),Le("div",{style:{width:"100%"},children:e&&Le(q3,{origin:g,appId:b,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),ir(Q3,{children:[ir("div",{children:[Le(G3,{viewBox:"0 0 20 18"}),Le("h4",{children:"Warning"})]}),Le("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),Le(q,{protectedByPrivy:!0})]})};function q3(e){let[t,r]=hc(e.dimensions.width),[o,n]=hc(void 0),a=z3(null);return Am(()=>{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")})},[]),Le("div",{ref:a,children:t&&ir(Y3,{children:[Le("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:ua(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),Le(Z3,{children:"Loading..."})]})})}function $3(e){return Le("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:Le("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 j3=ao.div`
|
|
973
|
+
`;import U3 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as B3}from"react";import{Fragment as H3,jsx as In,jsxs as Sm}from"react/jsx-runtime";var xm=()=>{let{user:e}=G(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=M(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=a.createWallet,u=()=>{let h=Se(e);h?(o(),l(h)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return B3(()=>{let h=setTimeout(u,dp);return()=>clearTimeout(h)},[]),i.current=u,Sm(H3,{children:[In(S,{onClose:u}),In(Z,{}),Sm(tr,{children:[In(U3,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),In(Pe,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),In(te,{}),In(q,{protectedByPrivy:!0})]})};import G3 from"@heroicons/react/20/solid/ExclamationTriangleIcon";import V3 from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as Am,useRef as z3,useState as hc}from"react";import ao from"styled-components";import{Fragment as X3,jsx as Le,jsxs as ir}from"react/jsx-runtime";var Rm=()=>{let[e,t]=hc(null),{authenticated:r,user:o,getAccessToken:n}=G(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:l}=M(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=Se(o)?.address,{onFailure:h,onSuccess:f,origin:g,appId:b}=s.keyExport,v=E=>{a({shouldCallAuthOnSuccess:!1}),h(typeof E=="string"?new Error(E):E)},x=()=>{a({shouldCallAuthOnSuccess:!1}),f(),i({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return Am(()=>{let E=Se(o);if(!r||!E)return v("User must be authenticated before exporting their wallet");n().then(t,v)},[r,o]),c.current=x,ir(X3,{children:[Le(S,{onClose:x}),ir(j3,{children:[ir(Pe,{icon:Le(V3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[ir(J3,{children:[Le($3,{style:{marginRight:6}}),eo(u)]}),Le("p",{children:"You can bring your account with you to another site using an external wallet."})]}),ir(K3,{children:[ir(km,{children:[Le(_m,{children:"1"}),ir("span",{children:[Le("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."]})]}),ir(km,{children:[Le(_m,{children:"2"}),Le("span",{children:"Copy this key into your other wallet"})]})]}),Le("div",{style:{width:"100%"},children:e&&Le(q3,{origin:g,appId:b,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),ir(Q3,{children:[ir("div",{children:[Le(G3,{viewBox:"0 0 20 18"}),Le("h4",{children:"Warning"})]}),Le("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),Le(q,{protectedByPrivy:!0})]})};function q3(e){let[t,r]=hc(e.dimensions.width),[o,n]=hc(void 0),a=z3(null);return Am(()=>{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")})},[]),Le("div",{ref:a,children:t&&ir(Y3,{children:[Le("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:ua(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),Le(Z3,{children:"Loading..."})]})})}function $3(e){return Le("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:Le("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 j3=ao.div`
|
|
974
974
|
display: flex;
|
|
975
975
|
flex-direction: column;
|
|
976
976
|
text-align: left;
|
|
@@ -1277,7 +1277,7 @@ Resources:
|
|
|
1277
1277
|
`;import{Fragment as Um,jsx as Gt,jsxs as xi}from"react/jsx-runtime";var Bm=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=p0(!1);return xi(Um,{children:[Gt(S,{title:"Confirm Password",closeable:!1,backFn:o}),Gt(Z,{}),xi(so,{children:[xi(po,{children:[Gt(d0,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),Gt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),Gt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),Gt(Ti,{children:xi(Pi,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),i(s=>!s)},children:[Gt(Nm,{color:"var(--privy-color-error)",checked:a}),Gt(Um,{children:"I understand losing my password means losing my account."})]})})]}),xi(m0,{children:[n.initiatedBy==="user"&&Gt(Xt,{onClick:n.onCancel,disabled:t,children:"Cancel"}),Gt(lo,{onClick:r,loading:t,hideAnimations:e,disabled:!a,children:"Set Password"})]}),Gt(te,{}),Gt(q,{protectedByPrivy:!0})]})},m0=u0.div`
|
|
1278
1278
|
display: flex;
|
|
1279
1279
|
gap: 10px;
|
|
1280
|
-
`;import A0 from"@heroicons/react/24/outline/KeyIcon";import jm from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Km,useMemo as Cc,useEffect as R0}from"react";import Ym from"styled-components";import f0 from"fast-password-entropy";import*as Hm from"secure-password-utilities";import{DEFAULT_WORDLIST as h0}from"secure-password-utilities/wordlists";var y0=95,g0=8,v0=3,C0=.3,w0=/[a-z]/,b0=/[A-Z]/,E0=/[0-9]/,T0="a-zA-Z0-9",Gm="!@#$%^&*()\\-_+.",Vm=`${T0}${Gm}`,P0=new RegExp(`[${Gm}]`),S0=new RegExp(`[${Vm}]`),zm=new RegExp(`^[${Vm}]{6,}$`),qm=(e="")=>{let t=e.split("").filter(r=>!S0.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},ms=()=>Hm.generatePassphrase(4,h0);function x0(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function k0(e){if(e.length<g0)return 0;let t=0;w0.test(e)&&(t+=1),b0.test(e)&&(t+=1),E0.test(e)&&(t+=1),P0.test(e)&&(t+=1);let r=t/v0;return Math.max(0,Math.min(1,r))}function _0(e=""){let t=k0(e),r=f0(e)/y0;return(t*C0+r)/2}function $m(e=""){let t=_0(e);return{value:t,label:x0(t)}}import{Fragment as W0,jsx as je,jsxs as
|
|
1280
|
+
`;import A0 from"@heroicons/react/24/outline/KeyIcon";import jm from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Km,useMemo as Cc,useEffect as R0}from"react";import Ym from"styled-components";import f0 from"fast-password-entropy";import*as Hm from"secure-password-utilities";import{DEFAULT_WORDLIST as h0}from"secure-password-utilities/wordlists";var y0=95,g0=8,v0=3,C0=.3,w0=/[a-z]/,b0=/[A-Z]/,E0=/[0-9]/,T0="a-zA-Z0-9",Gm="!@#$%^&*()\\-_+.",Vm=`${T0}${Gm}`,P0=new RegExp(`[${Gm}]`),S0=new RegExp(`[${Vm}]`),zm=new RegExp(`^[${Vm}]{6,}$`),qm=(e="")=>{let t=e.split("").filter(r=>!S0.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},ms=()=>Hm.generatePassphrase(4,h0);function x0(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function k0(e){if(e.length<g0)return 0;let t=0;w0.test(e)&&(t+=1),b0.test(e)&&(t+=1),E0.test(e)&&(t+=1),P0.test(e)&&(t+=1);let r=t/v0;return Math.max(0,Math.min(1,r))}function _0(e=""){let t=k0(e),r=f0(e)/y0;return(t*C0+r)/2}function $m(e=""){let t=_0(e);return{value:t,label:x0(t)}}import{Fragment as W0,jsx as je,jsxs as Gr}from"react/jsx-runtime";var Zm=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:a,onPasswordChange:i,onPasswordGenerate:l})=>{let[s,c]=Km(!1),[u,h]=Km(!1);R0(()=>{r&&!u&&h(!0)},[r]);let f=Cc(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":zm.test(r||"")?null:`Invalid characters used ( ${qm(r).join(" ")} )`:null,[r,u]),g=Cc(()=>f?{value:0,label:"Weak"}:$m(r),[r,f]),b=Cc(()=>!!(!r?.length||f),[f,r]);return Gr(W0,{children:[je(S,{onClose:a,title:"Secure your account",closeable:o.initiatedBy==="user"}),je(Z,{}),Gr(so,{children:[Gr(po,{children:[je(A0,{height:48,width:48,stroke:"var(--privy-color-accent)"}),je("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),je("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),Gr(co,{children:[je(Mn,{value:r,onChange:v=>i(v.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text",style:{paddingRight:"3.8rem"}}),Gr(Wn,{style:{width:"3.5rem"},children:[s?je(Ln,{onClick:()=>c(!1)}):je(On,{onClick:()=>c(!0)}),je(Wm,{onClick:l})]})]}),je(Lm,{value:g.value===0?.01:g.value,label:g.label}),je(ds,{error:!!f,children:f||`Password Strength: ${u?g.label:"--"}`}),Gr(M0,{children:[je(I0,{children:Gr(Ti,{children:[Gr(Pi,{children:[je(jm,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),Gr(Pi,{children:[je(jm,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),je(lo,{onClick:n,loading:t,disabled:b,hideAnimations:e,children:"Continue"})]})]}),je(te,{}),je(q,{protectedByPrivy:!0})]})},I0=Ym(Ti)`
|
|
1281
1281
|
flex: 1;
|
|
1282
1282
|
padding-top: 1rem;
|
|
1283
1283
|
`,M0=Ym.div`
|
|
@@ -1288,9 +1288,9 @@ Resources:
|
|
|
1288
1288
|
|
|
1289
1289
|
${t}
|
|
1290
1290
|
|
|
1291
|
-
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import B0 from"@heroicons/react/24/solid/CheckCircleIcon";import H0 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as G0,jsx as
|
|
1291
|
+
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import B0 from"@heroicons/react/24/solid/CheckCircleIcon";import H0 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as G0,jsx as Vr,jsxs as bc}from"react/jsx-runtime";var Xm=({error:e,onClose:t})=>bc(G0,{children:[Vr(S,{closeable:!1}),Vr(Z,{}),e?bc(tr,{children:[Vr(H0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Vr(Pe,{title:"Something went wrong",description:e})]}):bc(tr,{children:[Vr(B0,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),Vr(Pe,{title:"Success"})]}),Vr(N,{onClick:t,children:"Close"}),Vr(te,{}),Vr(q,{protectedByPrivy:!0})]});import{useReducer as V0}from"react";var z0=(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}},ef=()=>{let[e,t]=V0(z0,"creating");return{send:t,state:e}};import{jsx as ki}from"react/jsx-runtime";var fs=({onSubmit:e,...t})=>{let{send:r,state:o}=ef(),n=tf(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);q0(()=>{let i;return o==="done"&&t.config.initiatedBy==="automatic"&&(i=setTimeout(()=>t.onClose?.(),Me)),()=>{i&&clearTimeout(i)}},[o,t.config.initiatedBy,t.onClose]);let a=tf(()=>{r("back")},[r]);return o==="creating"?ki(Zm,{...t,onSubmit:n}):o==="saving"?ki(Qm,{...t,onSubmit:n,onBack:a}):o==="confirming"?ki(Om,{...t,onSubmit:n,onBack:a}):o==="finalizing"?ki(Bm,{...t,onSubmit:n,onBack:a}):o==="done"?ki(Xm,{...t,onSubmit:n}):null};import{Fragment as Z0,jsx as Uo,jsxs as of}from"react/jsx-runtime";var nf=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,a]=_i(""),[i,l]=_i(!1),[s,c]=_i(),[u,h]=_i(null),[f,g]=_i(null),b=j0(!1),{authenticated:v,getAccessToken:x}=G(),{refreshUser:E,closePrivyModal:P,createAnalyticsEvent:W,isNewUserThisSession:I,initializeWalletProxy:D}=M(),{onSuccess:R,onFailure:B,callAuthOnSuccessOnClose:$}=r.createWallet,V=e?.embeddedWallets.requireUserPasswordOnCreate===!0,z=!!(!n||b.current)&&!V,A=new Fe(async()=>F());rf(()=>{u||D(3e4).then(Q=>h(Q))},[u]),rf(()=>{if(!v){t("LANDING"),B(new Error("User must be authenticated before creating a Privy wallet"));return}!V&&!i&&!b.current&&(l(!0),A.execute().finally(()=>l(!1)))},[V,v]);let oe=()=>{V&&f&&f?.recoveryMethod!=="user-passcode"?(B(new St("User created a wallet but failed to set a password for it")),P({shouldCallAuthOnSuccess:!1})):f?(R(f),P({shouldCallAuthOnSuccess:$})):(B(new St("User wallet creation failed")),P({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let F=async function(){let Q=await x();if(Q)try{W({eventName:"embedded_wallet_creation_started"});let Y=await D(Xo);if(!Y)throw new Error("walletProxy does not exist.");let Ae=1e4,ee=new Promise((ue,Mt)=>{setTimeout(()=>{Mt(new Error("walletProxy.create timed out."))},Ae)});if(!await Promise.race([Y.create({accessToken:Q,recoveryPassword:s}),ee]))throw new Error("walletProxy.create did not send a response.");let at=await E();if(!at)throw new Error("Failed to refresh user.");let Ne=Se(at);if(!Ne)throw new Error("Updated user is missing embedded wallet.");g(Ne),W({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:Ne.address}}),a(""),b.current=!0,V?t("EMBEDDED_WALLET_CREATED_SCREEN"):I?t("EMBEDDED_WALLET_CREATED_SCREEN"):Ne&&(R(Ne),P({shouldCallAuthOnSuccess:$}))}catch(Y){if(b.current)return;W({eventName:"embedded_wallet_creation_failed",payload:{error:Y.toString()}}),a("An error has occurred, please try again."),console.warn(Y)}else a("An error has occured, please login again."),W({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}})},se=async()=>{if(!V)return P({shouldCallAuthOnSuccess:$});l(!0);let Q=250;return A.execute().then(()=>new Promise(Y=>setTimeout(Y,Q))).finally(()=>l(!1))};return!V&&n?of(Z0,{children:[Uo(S,{closeable:!1}),of(tr,{children:[Uo($0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Uo(Pe,{title:"Something went wrong",description:n})]}),Uo(N,{onClick:oe,children:"Close"}),Uo(Y0,{})]}):z?Uo(xn,{}):Uo(fs,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:z||!u,buttonLoading:i,buttonHideAnimations:!f&&i,error:n,password:s||"",onClose:oe,onPasswordChange:c,onPasswordGenerate:()=>c(ms()),onSubmit:se})},Y0=K0.div`
|
|
1292
1292
|
height: 44px;
|
|
1293
|
-
`;import{useEffect as J0,useState as hs}from"react";import{jsx as Q0}from"react/jsx-runtime";var af=()=>{let[e,t]=hs(null),[r,o]=hs(!1),[n,a]=hs(null),[i,l]=hs(""),{authenticated:s,getAccessToken:c,user:u}=G(),{walletProxy:h,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:b}=M(),{app:v,navigate:x,data:E,onUserCloseViaDialogOrKeybindRef:P}=_(),{onSuccess:W,onFailure:I}=E.createWallet,D=Se(u),R=e?.recoveryMethod==="user-passcode";J0(()=>{s||(x("LANDING"),I(new ea("User must be authenticated before setting a password on a Privy wallet")))},[s]);let B=()=>{if(n){I(n),g({shouldCallAuthOnSuccess:!1});return}if(!R){I(new St("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}W(e),g({shouldCallAuthOnSuccess:!1})};P.current=B;let $=async()=>{let z=await c();if(z&&D?.address&&i&&h)try{if(b("embedded_wallet_set_password_started",{walletAddress:D.address}),!(await h.setRecoveryPassword({accessToken:z,address:D.address,recoveryPassword:i})).address){a(new St("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:D.address,reason:"error setting password"});return}let oe=await f(),F=Se(oe);if(!F){a(new St("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:D.address,reason:"wallet disconnected"});return}t(F),b("embedded_wallet_set_password_completed",{walletAddress:D.address})}catch(A){console.warn(A),a(A instanceof Error?A:new Error("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:D.address,reason:A})}},V=async()=>{R?(W(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await $(),o(!1))};return Q0(fs,{appName:v?.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(ms()),onPasswordChange:l,onSubmit:V,onClose:B})};import X0 from"@heroicons/react/24/outline/UserCircleIcon";import ev from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as tv,jsx as
|
|
1293
|
+
`;import{useEffect as J0,useState as hs}from"react";import{jsx as Q0}from"react/jsx-runtime";var af=()=>{let[e,t]=hs(null),[r,o]=hs(!1),[n,a]=hs(null),[i,l]=hs(""),{authenticated:s,getAccessToken:c,user:u}=G(),{walletProxy:h,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:b}=M(),{app:v,navigate:x,data:E,onUserCloseViaDialogOrKeybindRef:P}=_(),{onSuccess:W,onFailure:I}=E.createWallet,D=Se(u),R=e?.recoveryMethod==="user-passcode";J0(()=>{s||(x("LANDING"),I(new ea("User must be authenticated before setting a password on a Privy wallet")))},[s]);let B=()=>{if(n){I(n),g({shouldCallAuthOnSuccess:!1});return}if(!R){I(new St("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}W(e),g({shouldCallAuthOnSuccess:!1})};P.current=B;let $=async()=>{let z=await c();if(z&&D?.address&&i&&h)try{if(b({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:D.address}}),!(await h.setRecoveryPassword({accessToken:z,address:D.address,recoveryPassword:i})).address){a(new St("Error setting password on privy wallet")),b({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:D.address,reason:"error setting password"}});return}let oe=await f(),F=Se(oe);if(!F){a(new St("Error setting password on privy wallet")),b({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:D.address,reason:"wallet disconnected"}});return}t(F),b({eventName:"embedded_wallet_set_password_completed",payload:{walletAddress:D.address}})}catch(A){console.warn(A),a(A instanceof Error?A:new Error("Error setting password on privy wallet")),b({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:D.address,reason:A}})}},V=async()=>{R?(W(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await $(),o(!1))};return Q0(fs,{appName:v?.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(ms()),onPasswordChange:l,onSubmit:V,onClose:B})};import X0 from"@heroicons/react/24/outline/UserCircleIcon";import ev from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as tv,jsx as zr,jsxs as ys}from"react/jsx-runtime";var sf=()=>{let{user:e}=G(),{closePrivyModal:t,createAnalyticsEvent:r}=M(),{data:o,setModalData:n,navigate:a,onUserCloseViaDialogOrKeybindRef:i}=_(),{onSuccess:l,onFailure:s}=o.setWalletPassword,c=()=>{s(new St("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return i.current=c,ys(tv,{children:[zr(S,{onClose:c}),zr(Z,{}),ys(tr,{children:[ys(Vu,{children:[zr(X0,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),zr(zu,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:zr(ev,{width:"12px",height:"12px",fill:"white"})})]}),ys(Pe,{title:"Secure Your Account",children:["Please set a password to secure your account.",zr("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."})]})]}),zr(N,{onClick:()=>{let h=Se(e);r({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:h?.address}}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),a("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),zr(te,{}),zr(q,{protectedByPrivy:!0})]})};import rv from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as ov,useState as gs}from"react";import vs,{css as nv}from"styled-components";import{Fragment as cv,jsx as dt,jsxs as Bo}from"react/jsx-runtime";var lf=()=>{let[e,t]=gs(!0),{authenticated:r,getAccessToken:o}=G(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=M(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),[u,h]=gs(void 0),[f,g]=gs(""),[b,v]=gs(!1),{privyWallet:x,onCompleteNavigateTo:E,onSuccess:P,onFailure:W}=s.recoverWallet,I=(B="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),W(typeof B=="string"?new St(B):B)};c.current=I,ov(()=>{if(!r||!x)return I("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let D=B=>{B&&h(B)};return Bo(cv,{children:[dt(S,{onClose:I}),dt(Z,{}),Bo(av,{children:[Bo(iv,{children:[dt(rv,{height:48,width:48,stroke:"var(--privy-color-accent)"}),dt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),dt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),Bo("div",{children:[Bo(co,{children:[dt(Mn,{type:e?"password":"text",onChange:B=>D(B.target.value),disabled:b,style:{paddingRight:"2.3rem"}}),dt(Wn,{style:{right:"0.75rem"},children:e?dt(Ln,{onClick:()=>t(!1)}):dt(On,{onClick:()=>t(!0)})})]}),!!f&&dt(sv,{children:f})]}),Bo("div",{children:[Bo(Gu,{children:[dt("h4",{children:"Why is this necessary?"}),dt("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),dt(lv,{loading:b||!n,disabled:!u,onClick:async()=>{v(!0);let B=await o();if(B&&x&&u!==null)try{i({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:x.address}}),await n?.recover({address:x.address,accessToken:B,recoveryPin:u}),g(""),E?l(E):a({shouldCallAuthOnSuccess:!1}),P?.(x),i({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:x.address}})}catch($){bm($)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{v(!1)}else return I("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!x&&b,children:"Recover your account"})]})]}),dt(te,{}),dt(q,{protectedByPrivy:!0})]})},iv=vs.div`
|
|
1294
1294
|
display: flex;
|
|
1295
1295
|
flex-direction: column;
|
|
1296
1296
|
align-items: center;
|
|
@@ -1434,7 +1434,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1434
1434
|
border-color: ${e=>e.fgColor};
|
|
1435
1435
|
border-radius: var(--privy-border-radius-md);
|
|
1436
1436
|
}
|
|
1437
|
-
`,Nn=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return pt(Wv,{size:o,bgColor:t,fgColor:r,children:pt(Mv,{url:e.url,logo:{element:e.squareLogoElement??hf},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as Es,jsxs as Lv}from"react/jsx-runtime";var Sr=({style:e,...t})=>Lv("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:[Es("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),Es("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"}),Es("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"}),Es("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"})]});import{Fragment as Ts,jsx as he,jsxs as xr}from"react/jsx-runtime";var wf="#8a63d2",Tf=1e3,Dv=Tf*2,Fv=Tf*120,Pf=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:s}=_(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:h,createAnalyticsEvent:f}=M(),[g,b]=Pc(void 0),[v,x]=Pc(!1),[E,P]=Pc(!1),W=Ov([]),I=s?.render.inDialog?Me:0,D=c(),R=D?.meta.connectUri;return vf(()=>{let B=Date.now(),$=setInterval(async()=>{let V=await D.pollForReady.execute(),z=Date.now()-B;if(V){clearInterval($),x(!0);try{await u(),P(!0)}catch(A){let oe={retryable:!1,message:"Authentication failed"};if(A?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else if(A?.privyErrorCode==="max_accounts_reached"){console.error(new mr(A).toString()),a("USER_LIMIT_REACHED_SCREEN");return}else A?.privyErrorCode==="linked_to_another_user"?oe.detail="This account has already been linked to another user.":A?.privyErrorCode==="invalid_credentials"?(oe.retryable=!0,oe.detail="Something went wrong. Try again."):A?.privyErrorCode==="too_many_requests"&&(oe.detail="Too many requests. Please wait before trying again.");b(oe)}}else z>Fv&&(clearInterval($),b({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},Dv);return()=>{clearInterval($),W.current.forEach(V=>clearTimeout(V))}},[]),vf(()=>{if(r&&e&&E&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let $=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout($)}E&&(Nt(o,s?.embeddedWallets.createOnLogin)?W.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:$=>{console.error($),f("embedded_wallet_creation_failure_logout",{error:$,screen:"FarcasterConnectStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I)):W.current.push(setTimeout(()=>h({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I)))}},[E,r,e,o]),Cf||v?xr(Ts,{children:[he(S,{backFn:n?i:void 0,onClose:h},"header"),he(Z,{}),Nv?he(Ts,{children:xr(Uv,{children:[he(Et,{children:xr("div",{children:[he(Ct,{success:E,fail:!!g}),he(Sr,{style:{width:"38px",height:"38px"}})]})}),xr(Ue,{children:[he(we,{children:g?g.message:"Sign in with Farcaster"}),he(fe,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),R&&he(N,{onClick:B=>{B.preventDefault(),window.location.href=R},children:"Open Warpcast app"})]})}):he(Ts,{children:xr(bf,{children:[he(Et,{children:xr("div",{children:[he(Ct,{success:E,fail:!!g}),he(Sr,{style:{width:"38px",height:"38px"}})]})}),xr(Ue,{children:[he(we,{children:g?g.message:"Signing in with Farcaster"}),he(fe,{children:g?g.detail:"This should only take a moment"}),he(ct,{children:R&&Cf&&he(bs,{text:"Take me to Warpcast",url:R,color:wf})})]})]})}),he(K,{})]}):xr(Ts,{children:[he(S,{backFn:n?i:void 0,onClose:h},"header"),he(Z,{}),he(bf,{children:xr("div",{children:[he(we,{children:"Sign in with Farcaster"}),he(fe,{children:"Scan with your phone's camera to continue."}),he(vn,{children:R?he(Nn,{url:R,size:275,squareLogoElement:Sr}):he(wt,{})}),xr(ct,{children:[he(fe,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),R&&he(uo,{text:R,itemName:"link",color:wf})]})]})}),he(K,{})]})},bf=Ef.div`
|
|
1437
|
+
`,Nn=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return pt(Wv,{size:o,bgColor:t,fgColor:r,children:pt(Mv,{url:e.url,logo:{element:e.squareLogoElement??hf},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as Es,jsxs as Lv}from"react/jsx-runtime";var Sr=({style:e,...t})=>Lv("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:[Es("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),Es("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"}),Es("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"}),Es("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"})]});import{Fragment as Ts,jsx as he,jsxs as xr}from"react/jsx-runtime";var wf="#8a63d2",Tf=1e3,Dv=Tf*2,Fv=Tf*120,Pf=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:s}=_(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:h,createAnalyticsEvent:f}=M(),[g,b]=Pc(void 0),[v,x]=Pc(!1),[E,P]=Pc(!1),W=Ov([]),I=s?.render.inDialog?Me:0,D=c(),R=D?.meta.connectUri;return vf(()=>{let B=Date.now(),$=setInterval(async()=>{let V=await D.pollForReady.execute(),z=Date.now()-B;if(V){clearInterval($),x(!0);try{await u(),P(!0)}catch(A){let oe={retryable:!1,message:"Authentication failed"};if(A?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else if(A?.privyErrorCode==="max_accounts_reached"){console.error(new mr(A).toString()),a("USER_LIMIT_REACHED_SCREEN");return}else A?.privyErrorCode==="linked_to_another_user"?oe.detail="This account has already been linked to another user.":A?.privyErrorCode==="invalid_credentials"?(oe.retryable=!0,oe.detail="Something went wrong. Try again."):A?.privyErrorCode==="too_many_requests"&&(oe.detail="Too many requests. Please wait before trying again.");b(oe)}}else z>Fv&&(clearInterval($),b({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},Dv);return()=>{clearInterval($),W.current.forEach(V=>clearTimeout(V))}},[]),vf(()=>{if(r&&e&&E&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let $=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout($)}E&&(Nt(o,s?.embeddedWallets.createOnLogin)?W.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:$=>{console.error($),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:$,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I)):W.current.push(setTimeout(()=>h({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I)))}},[E,r,e,o]),Cf||v?xr(Ts,{children:[he(S,{backFn:n?i:void 0,onClose:h},"header"),he(Z,{}),Nv?he(Ts,{children:xr(Uv,{children:[he(Et,{children:xr("div",{children:[he(Ct,{success:E,fail:!!g}),he(Sr,{style:{width:"38px",height:"38px"}})]})}),xr(Ue,{children:[he(we,{children:g?g.message:"Sign in with Farcaster"}),he(fe,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),R&&he(N,{onClick:B=>{B.preventDefault(),window.location.href=R},children:"Open Warpcast app"})]})}):he(Ts,{children:xr(bf,{children:[he(Et,{children:xr("div",{children:[he(Ct,{success:E,fail:!!g}),he(Sr,{style:{width:"38px",height:"38px"}})]})}),xr(Ue,{children:[he(we,{children:g?g.message:"Signing in with Farcaster"}),he(fe,{children:g?g.detail:"This should only take a moment"}),he(ct,{children:R&&Cf&&he(bs,{text:"Take me to Warpcast",url:R,color:wf})})]})]})}),he(K,{})]}):xr(Ts,{children:[he(S,{backFn:n?i:void 0,onClose:h},"header"),he(Z,{}),he(bf,{children:xr("div",{children:[he(we,{children:"Sign in with Farcaster"}),he(fe,{children:"Scan with your phone's camera to continue."}),he(vn,{children:R?he(Nn,{url:R,size:275,squareLogoElement:Sr}):he(wt,{})}),xr(ct,{children:[he(fe,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),R&&he(uo,{text:R,itemName:"link",color:wf})]})]})}),he(K,{})]})},bf=Ef.div`
|
|
1438
1438
|
display: flex;
|
|
1439
1439
|
flex-direction: column;
|
|
1440
1440
|
align-items: center;
|
|
@@ -1520,7 +1520,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1520
1520
|
margin: 0 0.5rem;
|
|
1521
1521
|
`,iC=kr.div`
|
|
1522
1522
|
margin: 30px 0;
|
|
1523
|
-
`;import{ofetch as aC}from"ofetch";import{useEffect as sC,useRef as lC,useState as cC}from"react";var xs="moonpay",Wf="sdk_fiat_on_ramp_completed_with_status";async function Lf(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 dC(e,t){let r=t?up:pp,o=t?fp:mp;return aC(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Of(e,t=!1){let[r,o]=cC(null),{createAnalyticsEvent:n}=M(),a=lC(0);return sC(()=>{let i=setInterval(async()=>{if(e)try{let[l]=await dC(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(Wf,{status:s,provider:xs,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(Wf,{status:"serviceFailure",provider:xs}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}import{Fragment as pC,jsx as _c,jsxs as uC}from"react/jsx-runtime";var Nf=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=M(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:uC(pC,{children:[_c(S,{title:"Fund account"},"header"),_c(Mf,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:xs}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),_c(q,{protectedByPrivy:!0})]})};import mC from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import fC from"@heroicons/react/24/solid/CheckCircleIcon";import hC from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as yC}from"react";import Df from"styled-components";import{Fragment as Ac,jsx as mt,jsxs as Go}from"react/jsx-runtime";var Ff=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Of(o||null,e.fiatOnRamp.useSandbox);return Go(Ac,{children:[mt(S,{title:"Fund account"},"header"),mt(vC,{status:n,onClickCta:r}),mt(q,{protectedByPrivy:!0})]})},gC=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:Go(Ac,{children:[Go("p",{children:["It looks like there was an issue with your payment. Please contact"," ",mt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),mt("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:""}}},vC=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=yC(()=>gC(e),[e]);return Go(Ac,{children:[Go(TC,{children:[mt(bC,{status:e}),Go(Ue,{children:[mt("h3",{children:r}),mt(EC,{children:o})]})]}),n&&mt(N,{onClick:t,children:n})]})},CC=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)",wC=e=>{switch(e){case"serviceFailure":case"failed":return hC;case"completed":return fC;case"waitingAuthorization":return()=>mt(mC,{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}},bC=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Go("div",{style:{position:"relative"},children:[mt(wt,{color:o,style:{position:"absolute"}}),mt(ql,{color:o}),mt(Ss,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=wC(e),r=CC(e);return mt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&mt(t,{width:"4rem",height:"4rem",color:r})})},EC=Df.p`
|
|
1523
|
+
`;import{ofetch as aC}from"ofetch";import{useEffect as sC,useRef as lC,useState as cC}from"react";var xs="moonpay",Wf="sdk_fiat_on_ramp_completed_with_status";async function Lf(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 dC(e,t){let r=t?up:pp,o=t?fp:mp;return aC(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Of(e,t=!1){let[r,o]=cC(null),{createAnalyticsEvent:n}=M(),a=lC(0);return sC(()=>{let i=setInterval(async()=>{if(e)try{let[l]=await dC(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n({eventName:Wf,payload:{status:s,provider:xs,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({eventName:Wf,payload:{status:"serviceFailure",provider:xs}}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}import{Fragment as pC,jsx as _c,jsxs as uC}from"react/jsx-runtime";var Nf=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=M(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:uC(pC,{children:[_c(S,{title:"Fund account"},"header"),_c(Mf,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:xs}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),_c(q,{protectedByPrivy:!0})]})};import mC from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import fC from"@heroicons/react/24/solid/CheckCircleIcon";import hC from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as yC}from"react";import Df from"styled-components";import{Fragment as Ac,jsx as mt,jsxs as Go}from"react/jsx-runtime";var Ff=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Of(o||null,e.fiatOnRamp.useSandbox);return Go(Ac,{children:[mt(S,{title:"Fund account"},"header"),mt(vC,{status:n,onClickCta:r}),mt(q,{protectedByPrivy:!0})]})},gC=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:Go(Ac,{children:[Go("p",{children:["It looks like there was an issue with your payment. Please contact"," ",mt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),mt("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:""}}},vC=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=yC(()=>gC(e),[e]);return Go(Ac,{children:[Go(TC,{children:[mt(bC,{status:e}),Go(Ue,{children:[mt("h3",{children:r}),mt(EC,{children:o})]})]}),n&&mt(N,{onClick:t,children:n})]})},CC=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)",wC=e=>{switch(e){case"serviceFailure":case"failed":return hC;case"completed":return fC;case"waitingAuthorization":return()=>mt(mC,{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}},bC=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Go("div",{style:{position:"relative"},children:[mt(wt,{color:o,style:{position:"absolute"}}),mt(ql,{color:o}),mt(Ss,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=wC(e),r=CC(e);return mt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&mt(t,{width:"4rem",height:"4rem",color:r})})},EC=Df.p`
|
|
1524
1524
|
font-size: 1rem;
|
|
1525
1525
|
color: var(--privy-color-foreground-3);
|
|
1526
1526
|
margin-bottom: 1rem;
|
|
@@ -1643,7 +1643,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1643
1643
|
&& > input::placeholder {
|
|
1644
1644
|
color: var(--privy-color-foreground-3);
|
|
1645
1645
|
}
|
|
1646
|
-
`;import{Fragment as VC,jsx as As,jsxs as Kf}from"react/jsx-runtime";var Rs=({isEditable:e,setIsEditable:t})=>{let r=GC(null);return Kf(VC,{children:[As(
|
|
1646
|
+
`;import{Fragment as VC,jsx as As,jsxs as Kf}from"react/jsx-runtime";var Rs=({isEditable:e,setIsEditable:t})=>{let r=GC(null);return Kf(VC,{children:[As(Br,{if:!e,children:As(_s,{ref:r})}),As(Br,{if:e,children:Kf(Te,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[As(HC,{})," Continue with Email"]})})]})};import{useState as zC}from"react";import{jsx as Mc,jsxs as qC}from"react/jsx-runtime";var Is=()=>{let[e,t]=zC(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:a,token:i}=ye(),{initLoginWithFarcaster:l}=M();return qC(Te,{onClick:async()=>{t(!0);try{a&&!i?(n({captchaModalData:{callback:c=>l(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(i),o("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[Mc(Sr,{})," Farcaster",e&&Mc("span",{children:Mc(Ur,{})})]})};import $C,{css as jC}from"styled-components";import{jsx as ZC}from"react/jsx-runtime";var Ms=()=>{let{enabled:e,token:t}=ye(),{navigate:r,setModalData:o}=_(),{initLoginWithPasskey:n}=M();return ZC(YC,{onClick:async()=>{e&&!t?(o({captchaModalData:{callback:i=>n(i),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSKEY_SYSTEM_DIALOGUE",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):(await n(),r("AWAITING_PASSKEY_SYSTEM_DIALOGUE"))},children:"I have a passkey"})},KC=jC`
|
|
1647
1647
|
&& {
|
|
1648
1648
|
width: 100%;
|
|
1649
1649
|
font-size: 0.875rem;
|
|
@@ -1759,11 +1759,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1759
1759
|
&& > input::placeholder {
|
|
1760
1760
|
color: var(--privy-color-foreground-3);
|
|
1761
1761
|
}
|
|
1762
|
-
`;import{Fragment as p4,jsx as Os,jsxs as th}from"react/jsx-runtime";var Ns=({isEditable:e,setIsEditable:t})=>{let r=d4(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=_(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=ye();async function u({qualifiedPhoneNumber:h}){if(s&&!c&&!o)a({captchaModalData:{callback:f=>l(h,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(h,c),n("AWAITING_PASSWORDLESS_CODE")}catch(f){a({errorModalData:{error:f,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return th(p4,{children:[Os(Ur,{if:!e,children:Os(Dn,{ref:r,onSubmit:u})}),Os(Ur,{if:e,children:th(Te,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Os(c4,{})," Continue with SMS"]})})]})};import{useState as g4}from"react";import{jsx as rh,jsxs as u4}from"react/jsx-runtime";var Ds=({style:e,...t})=>u4("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:[rh("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"}),rh("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"})]});import{jsx as Li,jsxs as m4}from"react/jsx-runtime";var Fs=({style:e,...t})=>m4("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:[Li("g",{clipPath:"url(#clip0)",children:Li("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"})}),Li("defs",{children:Li("clipPath",{id:"clip0",children:Li("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as oh}from"react/jsx-runtime";var Us=({style:e,...t})=>oh("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:oh("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"})});import{jsx as Bs,jsxs as f4}from"react/jsx-runtime";var Hs=({style:e,...t})=>f4("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:[Bs("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"}),Bs("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"}),Bs("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"}),Bs("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"})]});import{jsx as Gs}from"react/jsx-runtime";function Vs({style:e,...t}){return Gs("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:Gs("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Gs("g",{transform:"scale(5.12,5.12)",children:Gs("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"})})})})}import{jsx as nh,jsxs as h4}from"react/jsx-runtime";function zs(e){return h4("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[nh("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"}),nh("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"})]})}import{jsx as Lc,jsxs as y4}from"react/jsx-runtime";function qs(e){return y4("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:[Lc("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"}),Lc("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"}),Lc("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"})]})}import{jsx as ih}from"react/jsx-runtime";var $s=({style:e,...t})=>ih("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:ih("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"})});import{jsx as fo,jsxs as C4}from"react/jsx-runtime";var v4={apple:{logo:fo(Ds,{}),displayName:"Apple"},discord:{logo:fo(Fs,{}),displayName:"Discord"},github:{logo:fo(Us,{}),displayName:"GitHub"},google:{logo:fo(Hs,{}),displayName:"Google"},linkedin:{logo:fo(Vs,{}),displayName:"LinkedIn"},spotify:{logo:fo(zs,{}),displayName:"Spotify"},twitter:{logo:fo($s,{}),displayName:"Twitter"},tiktok:{logo:fo(qs,{}),displayName:"TikTok"}},Ye=({provider:e})=>{let{enabled:t,token:r}=ye(),{navigate:o,setModalData:n}=_(),[a,i]=g4(!1),{initLoginWithOAuth:l}=M(),{displayName:s,logo:c}=v4[e];return C4(Te,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:h=>l(e,h),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[c," ",s]})};import w4 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as ah,jsxs as b4}from"react/jsx-runtime";var js=({onClick:e,text:t,icon:r})=>b4(Te,{onClick:e,children:[r,ah(Ja,{children:t}),ah(w4,{})]});import{Fragment as Oc,jsx as Be,jsxs as Ys}from"react/jsx-runtime";var Zs=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],s=o.loginMethods.passkey,[c,u]=sh("default"),[h,f]=sh("email");T4(()=>{let R=l.indexOf("sms"),B=l.indexOf("email");R>-1&&R<B&&f("sms")},[a,i]);let g=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{u("default")},150)};n.current=g;let b=R=>R==="email"?Be(Rs,{isEditable:h==="email",setIsEditable:()=>{f("email")}},R):R==="sms"?Be(Ns,{isEditable:h==="sms",setIsEditable:()=>{f("sms")}},R):R==="apple"?Be(Ye,{provider:"apple"},R):R==="discord"?Be(Ye,{provider:"discord"},R):R==="farcaster"?Be(Is,{},R):R==="github"?Be(Ye,{provider:"github"},R):R==="google"?Be(Ye,{provider:"google"},R):R==="linkedin"?Be(Ye,{provider:"linkedin"},R):R==="tiktok"?Be(Ye,{provider:"tiktok"},R):R==="twitter"&&(!P4||o?.loginConfig.twitterOAuthOnMobileEnabled)?Be(Ye,{provider:"twitter"},R):wi([R],r,e,l),v=a.map(b).flat(),x=i.map(b).flat(),E=[...v,...x],P=x4({primary:v.length,overflow:x.length}),[W,I]=gp(E,P);return Ys(Oc,{children:[Be(S,{title:"Log in or sign up",onClose:g,backFn:c==="default"?void 0:()=>{u("default")}}),c==="default"&&Be(k4,{}),Be(Qa,{style:{overflow:"hidden",padding:2},children:Ys(Bt,{children:[c==="default"&&Ys(Oc,{children:[...W,I.length>0&&Be(js,{text:"More options",icon:Be(E4,{}),onClick:()=>u("overflow")})]}),c==="overflow"&&Ys(Oc,{children:[...I]}),s&&c==="default"&&Be(Ms,{})]})}),o&&Be(fn,{app:o}),Be(q,{protectedByPrivy:!0})]})},Ks=5,x4=({primary:e,overflow:t})=>e<Ks?e:e===Ks&&t===0?Ks:Ks-1,k4=S4(Pn)`
|
|
1762
|
+
`;import{Fragment as p4,jsx as Os,jsxs as th}from"react/jsx-runtime";var Ns=({isEditable:e,setIsEditable:t})=>{let r=d4(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=_(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=ye();async function u({qualifiedPhoneNumber:h}){if(s&&!c&&!o)a({captchaModalData:{callback:f=>l(h,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(h,c),n("AWAITING_PASSWORDLESS_CODE")}catch(f){a({errorModalData:{error:f,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return th(p4,{children:[Os(Br,{if:!e,children:Os(Dn,{ref:r,onSubmit:u})}),Os(Br,{if:e,children:th(Te,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Os(c4,{})," Continue with SMS"]})})]})};import{useState as g4}from"react";import{jsx as rh,jsxs as u4}from"react/jsx-runtime";var Ds=({style:e,...t})=>u4("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:[rh("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"}),rh("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"})]});import{jsx as Li,jsxs as m4}from"react/jsx-runtime";var Fs=({style:e,...t})=>m4("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:[Li("g",{clipPath:"url(#clip0)",children:Li("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"})}),Li("defs",{children:Li("clipPath",{id:"clip0",children:Li("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as oh}from"react/jsx-runtime";var Us=({style:e,...t})=>oh("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:oh("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"})});import{jsx as Bs,jsxs as f4}from"react/jsx-runtime";var Hs=({style:e,...t})=>f4("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:[Bs("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"}),Bs("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"}),Bs("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"}),Bs("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"})]});import{jsx as Gs}from"react/jsx-runtime";function Vs({style:e,...t}){return Gs("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:Gs("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Gs("g",{transform:"scale(5.12,5.12)",children:Gs("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"})})})})}import{jsx as nh,jsxs as h4}from"react/jsx-runtime";function zs(e){return h4("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[nh("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"}),nh("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"})]})}import{jsx as Lc,jsxs as y4}from"react/jsx-runtime";function qs(e){return y4("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:[Lc("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"}),Lc("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"}),Lc("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"})]})}import{jsx as ih}from"react/jsx-runtime";var $s=({style:e,...t})=>ih("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:ih("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"})});import{jsx as fo,jsxs as C4}from"react/jsx-runtime";var v4={apple:{logo:fo(Ds,{}),displayName:"Apple"},discord:{logo:fo(Fs,{}),displayName:"Discord"},github:{logo:fo(Us,{}),displayName:"GitHub"},google:{logo:fo(Hs,{}),displayName:"Google"},linkedin:{logo:fo(Vs,{}),displayName:"LinkedIn"},spotify:{logo:fo(zs,{}),displayName:"Spotify"},twitter:{logo:fo($s,{}),displayName:"Twitter"},tiktok:{logo:fo(qs,{}),displayName:"TikTok"}},Ye=({provider:e})=>{let{enabled:t,token:r}=ye(),{navigate:o,setModalData:n}=_(),[a,i]=g4(!1),{initLoginWithOAuth:l}=M(),{displayName:s,logo:c}=v4[e];return C4(Te,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:h=>l(e,h),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[c," ",s]})};import w4 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as ah,jsxs as b4}from"react/jsx-runtime";var js=({onClick:e,text:t,icon:r})=>b4(Te,{onClick:e,children:[r,ah(Ja,{children:t}),ah(w4,{})]});import{Fragment as Oc,jsx as Be,jsxs as Ys}from"react/jsx-runtime";var Zs=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],s=o.loginMethods.passkey,[c,u]=sh("default"),[h,f]=sh("email");T4(()=>{let R=l.indexOf("sms"),B=l.indexOf("email");R>-1&&R<B&&f("sms")},[a,i]);let g=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{u("default")},150)};n.current=g;let b=R=>R==="email"?Be(Rs,{isEditable:h==="email",setIsEditable:()=>{f("email")}},R):R==="sms"?Be(Ns,{isEditable:h==="sms",setIsEditable:()=>{f("sms")}},R):R==="apple"?Be(Ye,{provider:"apple"},R):R==="discord"?Be(Ye,{provider:"discord"},R):R==="farcaster"?Be(Is,{},R):R==="github"?Be(Ye,{provider:"github"},R):R==="google"?Be(Ye,{provider:"google"},R):R==="linkedin"?Be(Ye,{provider:"linkedin"},R):R==="tiktok"?Be(Ye,{provider:"tiktok"},R):R==="twitter"&&(!P4||o?.loginConfig.twitterOAuthOnMobileEnabled)?Be(Ye,{provider:"twitter"},R):wi([R],r,e,l),v=a.map(b).flat(),x=i.map(b).flat(),E=[...v,...x],P=x4({primary:v.length,overflow:x.length}),[W,I]=gp(E,P);return Ys(Oc,{children:[Be(S,{title:"Log in or sign up",onClose:g,backFn:c==="default"?void 0:()=>{u("default")}}),c==="default"&&Be(k4,{}),Be(Qa,{style:{overflow:"hidden",padding:2},children:Ys(Bt,{children:[c==="default"&&Ys(Oc,{children:[...W,I.length>0&&Be(js,{text:"More options",icon:Be(E4,{}),onClick:()=>u("overflow")})]}),c==="overflow"&&Ys(Oc,{children:[...I]}),s&&c==="default"&&Be(Ms,{})]})}),o&&Be(fn,{app:o}),Be(q,{protectedByPrivy:!0})]})},Ks=5,x4=({primary:e,overflow:t})=>e<Ks?e:e===Ks&&t===0?Ks:Ks-1,k4=S4(Pn)`
|
|
1763
1763
|
margin-bottom: 16px;
|
|
1764
1764
|
`;import I4 from"@heroicons/react/24/outline/EnvelopeIcon";import M4 from"@heroicons/react/24/outline/PhoneIcon";import W4 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as L4,useState as ph}from"react";import{isMobile as O4}from"react-device-detect";import N4 from"styled-components";import{jsx as Oi,jsxs as lh}from"react/jsx-runtime";var ch=({...e})=>lh("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[lh("g",{clipPath:"url(#clip0_2856_1743)",children:[Oi("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"}),Oi("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"})]}),Oi("defs",{children:Oi("clipPath",{id:"clip0_2856_1743",children:Oi("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import _4 from"@heroicons/react/24/outline/ChevronRightIcon";import A4 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Nc,jsxs as R4}from"react/jsx-runtime";var dh=({onClick:e,text:t})=>R4(Te,{onClick:e,children:[Nc(A4,{}),Nc(Ja,{children:t}),Nc(_4,{})]});import{Fragment as Ni,jsx as ke,jsxs as Fn}from"react/jsx-runtime";var Js=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=M(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{email:a,sms:i,google:l,twitter:s,discord:c,github:u,spotify:h,tiktok:f,linkedin:g,apple:b,wallet:v,farcaster:x,passkey:E}=o?.loginMethods??{},P=o?.appearance.loginGroupPriority||"web2-first",W=o?.appearance.hideDirectWeb2Inputs,[I,D]=ph("default"),[R,B]=ph(a?"email":"sms");L4(()=>{B(a?"email":"sms")},[a]);let $=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{D("default")},150)};n.current=$;let V=[a&&ke(Rs,{isEditable:R==="email",setIsEditable:()=>{B("email")}}),i&&ke(Ns,{isEditable:R==="sms",setIsEditable:()=>{B("sms")}})].filter(Boolean),z=[l&&ke(Ye,{provider:"google"}),s&&(!O4||o?.loginConfig.twitterOAuthOnMobileEnabled)&&ke(Ye,{provider:"twitter"}),c&&ke(Ye,{provider:"discord"}),u&&ke(Ye,{provider:"github"}),h&&ke(Ye,{provider:"spotify"}),f&&ke(Ye,{provider:"tiktok"}),g&&ke(Ye,{provider:"linkedin"}),b&&ke(Ye,{provider:"apple"}),x&&ke(Is,{})].filter(Boolean),A=wi(o.appearance.walletList,r,e,o.appearance.walletList),oe=I==="default"?void 0:()=>{D("default")},F=F4({priority:P,email:a,sms:i,social:z}),se=U4({priority:P,email:a,sms:i,social:z}),Q=B4({priority:P,email:a,sms:i,social:z}),Y=ke(dh,{text:Q,onClick:()=>D("web3-overflow")}),Ae=ke(js,{text:F,icon:se,onClick:()=>D("web2-overflow")}),ee=W?0:1;return Fn(Ni,{children:[ke(S,{title:"Log in or sign up",onClose:$,backFn:oe}),I==="default"&&ke(D4,{}),ke(Qa,{style:{overflow:"hidden",padding:2},children:Fn(Bt,{children:[I==="default"&&P==="web2-first"&&Fn(Ni,{children:[...V,...z.length+V.length>4?z.slice(0,3-V.length):z,V.length+z.length>4&&Ae,v&&Y]}),I==="default"&&P==="web3-first"&&Fn(Ni,{children:[v&&Fn(Ni,{children:[...A.length>4?A.slice(0,3):A,A.length>4&&Y]}),V.length+z.length>ee&&Ae,V.length+z.length===ee&&V.length?V[0]:null,V.length+z.length===ee&&z.length?z[0]:null]}),I==="web2-overflow"&&Fn(Ni,{children:[...P==="web3-first"?V:[],...z]}),...I==="web3-overflow"?A:[],E&&I==="default"&&ke(Ms,{})]})}),o&&ke(fn,{app:o}),ke(q,{protectedByPrivy:!0})]})},D4=N4(Pn)`
|
|
1765
1765
|
margin-bottom: 16px;
|
|
1766
|
-
`,F4=({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",U4=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?ke(W4,{}):t&&r?ke(ch,{}):t?ke(I4,{}):r?ke(M4,{}):null,B4=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as uh}from"react/jsx-runtime";var mh=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?uh(Zs,{connectOnly:!0}):uh(Js,{connectOnly:!0})};import{jsx as fh}from"react/jsx-runtime";var hh=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?fh(Zs,{connectOnly:!1}):fh(Js,{connectOnly:!1})};import H4 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as G4,jsx as ho,jsxs as V4}from"react/jsx-runtime";var yh=()=>{let{app:e}=_();return V4(G4,{children:[ho(S,{},"header"),ho(Z,{}),ho(Pe,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:ho(H4,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),ho(Ht,{children:ho(_s,{stacked:!0})}),ho(te,{}),ho(q,{protectedByPrivy:!0})]})};import z4 from"@heroicons/react/24/outline/ClockIcon";import q4 from"@heroicons/react/24/outline/TrashIcon";import $4 from"@heroicons/react/24/solid/CheckBadgeIcon";import j4 from"@heroicons/react/24/solid/CheckCircleIcon";import K4 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as Y4,useState as Di}from"react";import Vt,{css as Eh}from"styled-components";import{jsx as gh}from"react/jsx-runtime";var vh=({style:e,...t})=>gh("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:gh("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Ee,jsxs as Ch}from"react/jsx-runtime";var Qs=({style:e,...t})=>Ch("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[Ch("g",{clipPath:"url(#clip0_113_33841)",children:[Ee("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),Ee("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),Ee("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),Ee("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),Ee("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),Ee("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),Ee("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),Ee("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),Ee("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),Ee("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),Ee("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),Ee("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),Ee("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),Ee("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),Ee("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),Ee("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),Ee("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),Ee("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),Ee("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),Ee("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),Ee("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),Ee("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),Ee("defs",{children:Ee("clipPath",{id:"clip0_113_33841",children:Ee("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Dc,jsx as ie,jsxs as Pt}from"react/jsx-runtime";var wh=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,a]=Di([]),i=t?e.length:2,l=c=>c.authenticatorName?c.createdWithBrowser?`${c.authenticatorName} on ${c.createdWithBrowser}`:c.authenticatorName:c.createdWithBrowser?c.createdWithOs?`${c.createdWithBrowser} on ${c.createdWithOs}`:`${c.createdWithBrowser}`:"Unknown device",s=c=>{a(u=>u.concat([c])),r(c)};return Pt("div",{children:[ie(ow,{children:"Your passkeys"}),Pt(Ph,{children:[e.slice(0,i).map(c=>Pt(aw,{children:[Pt("div",{children:[ie(nw,{children:l(c)}),Pt(iw,{children:["Last used: ",c.verifiedAt.toLocaleString()]})]}),ie(lw,{onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?ie(Fr,{}):ie(q4,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&ie(ew,{onClick:o,children:"View all"})]})]})},Z4=()=>Pt(Ph,{children:[Pt(Lo,{children:[ie(Wo,{children:ie($4,{})}),"Log in with Touch ID, Face ID, or a security key."]}),Pt(Lo,{children:[ie(Wo,{children:ie(K4,{})}),"More secure than a password."]}),Pt(Lo,{children:[ie(Wo,{children:ie(z4,{})}),"Takes seconds to set up and use."]})]}),Th=()=>{let{user:e,unlinkPasskey:t}=G(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(b=>b.type==="passkey"),[a,i]=Di(!1),[l,s]=Di(""),[c,u]=Di(!1),[h,f]=Di(!1);Y4(()=>{n.length===0&&f(!1)},[n.length]);let g=()=>{i(!0),r().then(()=>u(!0)).catch(b=>{if(b instanceof Ie){if(b.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(b.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{i(!1)})};return c?Pt(Dc,{children:[ie(S,{onClose:()=>o()},"header"),ie(We,{children:ie(qe,{status:"success",children:ie(j4,{})})}),ie(bh,{children:"Passkey added"}),ie(tw,{children:"From now on, you can use your passkey to log in."}),ie(er,{children:ie(N,{onClick:()=>o(),children:"Done"})}),ie(K,{})]}):h?Pt(Dc,{children:[ie(S,{backFn:()=>f(!1),onClose:()=>o()},"header"),ie(wh,{passkeys:n,expanded:h,onUnlink:t,onExpand:()=>f(!0)}),ie(K,{})]}):Pt(Dc,{children:[ie(S,{onClose:()=>o()},"header"),ie(We,{children:Pt(J4,{children:[ie(vh,{}),ie(Qs,{})]})}),ie(bh,{children:"Secure your account with a passkey"}),ie(rw,{}),n.length===0?ie(Z4,{}):ie(wh,{passkeys:n,expanded:h,onUnlink:t,onExpand:()=>f(!0)}),Pt(er,{style:{marginTop:"12px"},children:[l&&ie(Q4,{fail:!0,children:l}),ie(N,{onClick:g,loading:a,children:"Add new passkey"})]}),ie(K,{})]})},J4=Vt.div`
|
|
1766
|
+
`,F4=({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",U4=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?ke(W4,{}):t&&r?ke(ch,{}):t?ke(I4,{}):r?ke(M4,{}):null,B4=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as uh}from"react/jsx-runtime";var mh=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?uh(Zs,{connectOnly:!0}):uh(Js,{connectOnly:!0})};import{jsx as fh}from"react/jsx-runtime";var hh=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?fh(Zs,{connectOnly:!1}):fh(Js,{connectOnly:!1})};import H4 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as G4,jsx as ho,jsxs as V4}from"react/jsx-runtime";var yh=()=>{let{app:e}=_();return V4(G4,{children:[ho(S,{},"header"),ho(Z,{}),ho(Pe,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:ho(H4,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),ho(Ht,{children:ho(_s,{stacked:!0})}),ho(te,{}),ho(q,{protectedByPrivy:!0})]})};import z4 from"@heroicons/react/24/outline/ClockIcon";import q4 from"@heroicons/react/24/outline/TrashIcon";import $4 from"@heroicons/react/24/solid/CheckBadgeIcon";import j4 from"@heroicons/react/24/solid/CheckCircleIcon";import K4 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as Y4,useState as Di}from"react";import Vt,{css as Eh}from"styled-components";import{jsx as gh}from"react/jsx-runtime";var vh=({style:e,...t})=>gh("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:gh("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});import{jsx as Ee,jsxs as Ch}from"react/jsx-runtime";var Qs=({style:e,...t})=>Ch("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[Ch("g",{clipPath:"url(#clip0_113_33841)",children:[Ee("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),Ee("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),Ee("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),Ee("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),Ee("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),Ee("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),Ee("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),Ee("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),Ee("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),Ee("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),Ee("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),Ee("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),Ee("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),Ee("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),Ee("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),Ee("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),Ee("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),Ee("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),Ee("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),Ee("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),Ee("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),Ee("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),Ee("defs",{children:Ee("clipPath",{id:"clip0_113_33841",children:Ee("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});import{Fragment as Dc,jsx as ie,jsxs as Pt}from"react/jsx-runtime";var wh=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,a]=Di([]),i=t?e.length:2,l=c=>c.authenticatorName?c.createdWithBrowser?`${c.authenticatorName} on ${c.createdWithBrowser}`:c.authenticatorName:c.createdWithBrowser?c.createdWithOs?`${c.createdWithBrowser} on ${c.createdWithOs}`:`${c.createdWithBrowser}`:"Unknown device",s=c=>{a(u=>u.concat([c])),r(c)};return Pt("div",{children:[ie(ow,{children:"Your passkeys"}),Pt(Ph,{children:[e.slice(0,i).map(c=>Pt(aw,{children:[Pt("div",{children:[ie(nw,{children:l(c)}),Pt(iw,{children:["Last used: ",c.verifiedAt.toLocaleString()]})]}),ie(lw,{onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?ie(Ur,{}):ie(q4,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&ie(ew,{onClick:o,children:"View all"})]})]})},Z4=()=>Pt(Ph,{children:[Pt(Lo,{children:[ie(Wo,{children:ie($4,{})}),"Log in with Touch ID, Face ID, or a security key."]}),Pt(Lo,{children:[ie(Wo,{children:ie(K4,{})}),"More secure than a password."]}),Pt(Lo,{children:[ie(Wo,{children:ie(z4,{})}),"Takes seconds to set up and use."]})]}),Th=()=>{let{user:e,unlinkPasskey:t}=G(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(b=>b.type==="passkey"),[a,i]=Di(!1),[l,s]=Di(""),[c,u]=Di(!1),[h,f]=Di(!1);Y4(()=>{n.length===0&&f(!1)},[n.length]);let g=()=>{i(!0),r().then(()=>u(!0)).catch(b=>{if(b instanceof Ie){if(b.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(b.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{i(!1)})};return c?Pt(Dc,{children:[ie(S,{onClose:()=>o()},"header"),ie(We,{children:ie(qe,{status:"success",children:ie(j4,{})})}),ie(bh,{children:"Passkey added"}),ie(tw,{children:"From now on, you can use your passkey to log in."}),ie(er,{children:ie(N,{onClick:()=>o(),children:"Done"})}),ie(K,{})]}):h?Pt(Dc,{children:[ie(S,{backFn:()=>f(!1),onClose:()=>o()},"header"),ie(wh,{passkeys:n,expanded:h,onUnlink:t,onExpand:()=>f(!0)}),ie(K,{})]}):Pt(Dc,{children:[ie(S,{onClose:()=>o()},"header"),ie(We,{children:Pt(J4,{children:[ie(vh,{}),ie(Qs,{})]})}),ie(bh,{children:"Secure your account with a passkey"}),ie(rw,{}),n.length===0?ie(Z4,{}):ie(wh,{passkeys:n,expanded:h,onUnlink:t,onExpand:()=>f(!0)}),Pt(er,{style:{marginTop:"12px"},children:[l&&ie(Q4,{fail:!0,children:l}),ie(N,{onClick:g,loading:a,children:"Add new passkey"})]}),ie(K,{})]})},J4=Vt.div`
|
|
1767
1767
|
display: flex;
|
|
1768
1768
|
align-items: center;
|
|
1769
1769
|
justify-content: center;
|
|
@@ -1884,7 +1884,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1884
1884
|
}
|
|
1885
1885
|
`,lw=Vt.button`
|
|
1886
1886
|
${sw}
|
|
1887
|
-
`;import cw from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as dw,jsx as yo,jsxs as pw}from"react/jsx-runtime";var Sh=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=_(),{initLoginWithSms:a}=M();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 pw(dw,{children:[yo(S,{},"header"),yo(Z,{}),yo(Pe,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:yo(cw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),yo(Ht,{children:yo(Dn,{stacked:!0,onSubmit:i})}),yo(te,{}),yo(q,{protectedByPrivy:!0})]})};import{Fragment as uw,jsx as Fi,jsxs as mw}from"react/jsx-runtime";var xh=()=>{let{linkingHint:e}=M(),{app:t}=_(),r=e?`Select the wallet with ${eo(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return mw(uw,{children:[Fi(S,{},"header"),Fi(Er,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),Fi(Bt,{children:Fi(Tn,{connectOnly:!1})}),Fi(q,{protectedByPrivy:!0})]})};import{jsx as kh,jsxs as fw}from"react/jsx-runtime";var _h=({style:e,...t})=>fw("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:[kh("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),kh("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"})]});import{Fragment as hw,jsx as go,jsxs as Ah}from"react/jsx-runtime";var Rh=()=>{let{closePrivyModal:e}=M(),{navigate:t}=_();return Ah(hw,{children:[go(S,{},"header"),go(Z,{}),go(_h,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),go(Er,{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"}}),Ah(Ht,{children:[go(N,{onClick:()=>t("LANDING"),children:"Try again"}),go(Xt,{onClick:()=>e(),children:"Cancel"})]}),go(te,{}),go(q,{protectedByPrivy:!0})]})};import Uh from"@heroicons/react/20/solid/CheckIcon";import Nw from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Dw from"@heroicons/react/24/outline/FingerPrintIcon";import Fw from"@heroicons/react/24/outline/PhoneIcon";import Bh from"@heroicons/react/24/outline/TrashIcon";import Uw from"@heroicons/react/24/solid/CheckBadgeIcon";import Hh from"@heroicons/react/24/solid/CheckCircleIcon";import Gh from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Bw from"@heroicons/react/24/solid/IdentificationIcon";import Vc from"@heroicons/react/24/solid/PhoneIcon";import Gc from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as Vh,useState as
|
|
1887
|
+
`;import cw from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as dw,jsx as yo,jsxs as pw}from"react/jsx-runtime";var Sh=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=_(),{initLoginWithSms:a}=M();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 pw(dw,{children:[yo(S,{},"header"),yo(Z,{}),yo(Pe,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:yo(cw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),yo(Ht,{children:yo(Dn,{stacked:!0,onSubmit:i})}),yo(te,{}),yo(q,{protectedByPrivy:!0})]})};import{Fragment as uw,jsx as Fi,jsxs as mw}from"react/jsx-runtime";var xh=()=>{let{linkingHint:e}=M(),{app:t}=_(),r=e?`Select the wallet with ${eo(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return mw(uw,{children:[Fi(S,{},"header"),Fi(Er,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),Fi(Bt,{children:Fi(Tn,{connectOnly:!1})}),Fi(q,{protectedByPrivy:!0})]})};import{jsx as kh,jsxs as fw}from"react/jsx-runtime";var _h=({style:e,...t})=>fw("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:[kh("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),kh("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"})]});import{Fragment as hw,jsx as go,jsxs as Ah}from"react/jsx-runtime";var Rh=()=>{let{closePrivyModal:e}=M(),{navigate:t}=_();return Ah(hw,{children:[go(S,{},"header"),go(Z,{}),go(_h,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),go(Er,{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"}}),Ah(Ht,{children:[go(N,{onClick:()=>t("LANDING"),children:"Try again"}),go(Xt,{onClick:()=>e(),children:"Cancel"})]}),go(te,{}),go(q,{protectedByPrivy:!0})]})};import Uh from"@heroicons/react/20/solid/CheckIcon";import Nw from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Dw from"@heroicons/react/24/outline/FingerPrintIcon";import Fw from"@heroicons/react/24/outline/PhoneIcon";import Bh from"@heroicons/react/24/outline/TrashIcon";import Uw from"@heroicons/react/24/solid/CheckBadgeIcon";import Hh from"@heroicons/react/24/solid/CheckCircleIcon";import Gh from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Bw from"@heroicons/react/24/solid/IdentificationIcon";import Vc from"@heroicons/react/24/solid/PhoneIcon";import Gc from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as Vh,useState as qr}from"react";import{useState as Bc}from"react";import{isMobile as bw}from"react-device-detect";import Oh from"styled-components";import{Dialog as Ih,Transition as Fc}from"@headlessui/react";import Uc from"react";import Bn from"styled-components";import{jsx as Un,jsxs as ww}from"react/jsx-runtime";var Mh=({children:e,open:t,onClick:r,...o})=>Un(Fc,{show:t,as:Uc.Fragment,children:ww(Ih,{onClose:r,...o,as:gw,children:[Un(Fc.Child,{as:Uc.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Un(yw,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Un(vw,{children:Un(Fc.Child,{as:Uc.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Un(Ih.Panel,{as:Cw,children:e})})})]})}),Hn=Bn.div`
|
|
1888
1888
|
display: flex;
|
|
1889
1889
|
flex-direction: column;
|
|
1890
1890
|
text-align: center;
|
|
@@ -2074,7 +2074,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2074
2074
|
> path {
|
|
2075
2075
|
fill: white;
|
|
2076
2076
|
}
|
|
2077
|
-
`;import Lw from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as Ow}from"react/jsx-runtime";var Fh=({size:e,authUrl:t})=>Ow(Nn,{url:t,squareLogoElement:Lw,size:e,fgColor:"#1F1F1F"});import{Fragment as zt,jsx as w,jsxs as re}from"react/jsx-runtime";var zh=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=
|
|
2077
|
+
`;import Lw from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as Ow}from"react/jsx-runtime";var Fh=({size:e,authUrl:t})=>Ow(Nn,{url:t,squareLogoElement:Lw,size:e,fgColor:"#1F1F1F"});import{Fragment as zt,jsx as w,jsxs as re}from"react/jsx-runtime";var zh=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=qr(null),{unenrollWithSms:n,unenrollWithTotp:a}=Hi(),{app:i,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),{closePrivyModal:u}=M(),{promptMfa:h}=Vn(),[f,g]=qr(s?.mfaEnrollmentFlow?.seenIntro||!1),[b,v]=qr(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),x=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),v(null)},500)};c.current=x;let E=e?.mfaMethods.includes("sms"),P=!!e?.phone,W=e?.mfaMethods.includes("totp"),I=E||W;Vh(()=>{I&&g(!0)},[I]);function D(){o(null),v(null)}function R(){g(!1)}async function B(A){await h(),v(A)}if(!l||!e||!i)return re(zt,{children:[w(S,{onClose:x},"header"),w(We,{children:w(Dh,{})}),w(no,{children:w(wt,{})}),w(K,{})]});async function $(){o(null);try{await n()}catch{o(null)}}async function V(){o(null);try{await a()}catch{o(null)}}if(r==="sms")return re(zt,{children:[w(S,{backFn:D,onClose:x},"header"),w(We,{children:w(qe,{children:w(Vc,{})})}),w(we,{children:"Remove SMS verification?"}),re(fe,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),w(er,{children:w(N,{warn:!0,onClick:$,children:"Remove SMS for MFA"})}),w(K,{})]});if(r==="totp")return re(zt,{children:[w(S,{backFn:D,onClose:x},"header"),w(We,{children:w(qe,{children:w(Gh,{})})}),w(we,{children:"Remove Authenticator App verification?"}),re(fe,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),w(er,{children:w(N,{warn:!0,onClick:V,children:"Remove Authenticator App for MFA"})}),w(K,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!I)return re(zt,{children:[w(S,{onClose:x},"header"),w(We,{children:w(qe,{children:w(Gc,{})})}),w(we,{children:"Add more security"}),re(fe,{children:[i?.name," does not have any verification methods enabled."]}),w(er,{children:w(N,{onClick:x,children:"Close"})}),w(K,{})]});let z=!I&&!f;if(z)return re(zt,{children:[w(S,{onClose:x},"header"),w(We,{children:w(qe,{children:w(Gc,{})})}),w(we,{children:"Transaction Protection"}),w(fe,{children:"Set up transaction protection to add an extra layer of security to your account"}),re(Lu,{children:[re(Lo,{children:[w(Wo,{children:w(Uw,{})}),"Enable 2-Step verification for your ",i?.name," wallet."]}),re(Lo,{children:[w(Wo,{children:w(Bw,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),re(er,{children:[w(N,{onClick:()=>g(!0),children:"Continue"}),w(Xt,{onClick:x,children:"Not now"})]}),w(K,{})]});switch(b){case"sms":return w(Hw,{onComplete:x,onReset:D,onClose:x});case"totp":return w(Gw,{onComplete:x,onClose:x,onReset:D});default:return re(zt,{children:[w(S,{backFn:z?R:void 0,onClose:x},"header"),w(We,{children:w(qe,{children:w(Gc,{})})}),w(we,{children:"Choose a verification method"}),I?w(fe,{children:"To add or delete verification methods, verification is required."}):w(fe,{children:"How would you like to verify your identity? You can change this later."}),re(Xa,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||W)&&re(es,{children:[w(Te,{disabled:W,onClick:()=>B("totp"),children:re(rs,{children:[re(ts,{children:[w(Nw,{}),"Authenticator App"]}),W?re(gn,{children:[w(Uh,{}),"Added"]}):w(gn,{children:"Recommended"})]})}),W&&w(Zl,{id:"remove",onClick:()=>o("totp"),children:w(Bh,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||E)&&re(es,{children:[w(Te,{disabled:E||P,onClick:()=>B("sms"),children:re(rs,{children:[re(ts,{children:[w(Fw,{}),"SMS"]}),E&&re(gn,{children:[w(Uh,{}),"Added"]}),P&&w(gn,{children:"Disabled"})]})}),E&&w(Zl,{id:"remove",onClick:()=>o("sms"),children:w(Bh,{})})]},"sms"),w(es,{children:w(Te,{disabled:!0,children:re(rs,{children:[re(ts,{children:[w(Dw,{}),"Passkey"]}),w(gn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),w(K,{})]})}},Hw=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=qr(""),[a,i]=qr(!1),[l,s]=qr("enroll"),{initEnrollmentWithSms:c,submitEnrollmentWithSms:u}=Hi(),{app:h,data:f,currentScreen:g,navigate:b,setModalData:v}=_();function x(){f?.mfaEnrollmentFlow?.onSuccess(),e()}async function E({qualifiedPhoneNumber:I}){try{await c({phoneNumber:I}),n(I),s("verify")}catch(D){v({mfaEnrollmentFlow:f?.mfaEnrollmentFlow?{...f?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:D,previousScreen:g||"MFA_ENROLLMENT_FLOW_SCREEN"}}),b("ERROR_SCREEN")}}async function P(I){try{if(!I)return;await u({phoneNumber:o,mfaCode:I}),i(!0)}catch(D){throw uc(D)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):An(D)?new Error("The code you entered is not valid"):_n(D)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):mc(D)?new Error("Verification canceled"):new Error("Unknown error")}}function W(){l==="verify"?s("enroll"):t()}return l==="enroll"?re(zt,{children:[w(S,{backFn:t,onClose:r},"header"),w(We,{children:w(qe,{children:w(Vc,{})})}),w(we,{children:"Set up SMS verification"}),w(fe,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),re(no,{children:[w(Dn,{onSubmit:E}),re(Ou,{children:["By providing your mobile number, you agree to receive text messages from ",h?.name,". Some carrier charges may apply"]})]}),w(K,{})]}):a?re(zt,{children:[w(S,{onClose:x},"header"),w(We,{children:w(qe,{status:"success",children:w(Hh,{})})}),w(we,{children:"SMS verification added"}),w(fe,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),w(er,{children:w(N,{onClick:x,children:"Done"})}),w(K,{})]}):re(zt,{children:[w(S,{backFn:W,onClose:r},"header"),w(We,{children:w(qe,{children:w(Vc,{})})}),w(we,{children:"Enter enrollment code"}),re(no,{children:[w(Gn,{onChange:P}),re(fe,{children:["To continue, enter the 6-digit code sent to ",w("strong",{children:Yf(o)})]})]}),w(K,{})]})},Gw=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=qr("enroll"),[a,i]=qr(null),[l,s]=qr(!1),{initEnrollmentWithTotp:c,submitEnrollmentWithTotp:u}=Hi(),{data:h}=_();Vh(()=>{i(null),c().then(x=>{i(x)}).catch(()=>{i(null),r()})},[]);function f(){h?.mfaEnrollmentFlow?.onSuccess(),e()}function g(){n("verify")}async function b(x){try{if(!x)return;await u({mfaCode:x}),s(!0)}catch(E){throw uc(E)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):An(E)?new Error("The code you entered is not valid"):_n(E)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):mc(E)?new Error("Verification canceled"):new Error("Unknown error")}}function v(){o==="verify"?n("enroll"):r()}return o==="enroll"?re(zt,{children:[w(S,{backFn:r,onClose:t},"header"),w(we,{children:"Scan QR code"}),w(fe,{children:"Open your authenticator app and scan the QR code to continue."}),w(vn,{children:a?.authUrl?w(Fh,{authUrl:a.authUrl,size:200}):w(wt,{})}),re(er,{children:[w(ct,{children:a?.secret&&w(uo,{itemName:"secret",text:a.secret})}),w(N,{onClick:g,children:"Continue"})]}),w(K,{})]}):l?re(zt,{children:[w(S,{onClose:f},"header"),w(We,{children:w(qe,{status:"success",children:w(Hh,{})})}),w(we,{children:"Authenticator app verification added"}),w(fe,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),w(er,{children:w(N,{onClick:f,children:"Done"})}),w(K,{})]}):re(zt,{children:[w(S,{backFn:v,onClose:t},"header"),w(We,{children:w(qe,{children:w(Gh,{})})}),w(we,{children:"Enter enrollment code"}),w(no,{children:w(Gn,{onChange:b})}),re(fe,{children:["To continue, enter the 6-digit code generated from your ",w("strong",{children:"authenticator app"})]}),w(K,{})]})};import F5 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import U5 from"@heroicons/react/24/outline/PhoneIcon";import B5 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import H5 from"@heroicons/react/24/solid/PhoneIcon";import G5 from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as V5,useState as sd}from"react";import{useMemo as L5,useEffect as O5,useState as Iy}from"react";import N5 from"styled-components";import uy from"styled-components";import $h from"styled-components";import{jsx as qh,jsxs as qw}from"react/jsx-runtime";var Xs=({label:e,children:t,valueStyles:r})=>qw(Vw,{children:[qh("div",{children:e}),qh(zw,{style:{...r},children:t})]}),Vw=$h.div`
|
|
2078
2078
|
display: flex;
|
|
2079
2079
|
align-items: center;
|
|
2080
2080
|
justify-content: space-between;
|
|
@@ -2190,11 +2190,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2190
2190
|
min-height: 1px;
|
|
2191
2191
|
`,n5=Co.div`
|
|
2192
2192
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
2193
|
-
`;import a5 from"styled-components";import{jsx as l5}from"react/jsx-runtime";var jc=({walletAddress:e,chainId:t=
|
|
2193
|
+
`;import a5 from"styled-components";import{jsx as l5}from"react/jsx-runtime";var jc=({walletAddress:e,chainId:t=Or})=>l5(s5,{href:Yh(t,e),target:"_blank",children:eo(e)}),s5=a5.a`
|
|
2194
2194
|
&:hover {
|
|
2195
2195
|
text-decoration: underline;
|
|
2196
2196
|
}
|
|
2197
|
-
`;import{jsx as It,jsxs as Kc}from"react/jsx-runtime";var qn=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let l=r?.value||0;return It(ay,{children:Kc(sy,{value:"details",children:[It(ly,{children:Kc(c5,{children:[It("div",{children:o?.title||o?.actionDescription||"Details"}),It(d5,{children:It(Jh,{weiQuantities:[l],tokenPrice:n,tokenSymbol:i})})]})}),Kc(cy,{children:[It(Xs,{label:"From",children:It(jc,{walletAddress:e,chainId:r.chainId||
|
|
2197
|
+
`;import{jsx as It,jsxs as Kc}from"react/jsx-runtime";var qn=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let l=r?.value||0;return It(ay,{children:Kc(sy,{value:"details",children:[It(ly,{children:Kc(c5,{children:[It("div",{children:o?.title||o?.actionDescription||"Details"}),It(d5,{children:It(Jh,{weiQuantities:[l],tokenPrice:n,tokenSymbol:i})})]})}),Kc(cy,{children:[It(Xs,{label:"From",children:It(jc,{walletAddress:e,chainId:r.chainId||Or})}),It(Xs,{label:"To",children:It(jc,{walletAddress:t,chainId:r.chainId||Or})}),o&&o.action&&It(Xs,{label:"Action",children:o.action}),a&&It(Xh,{transactionData:r,gas:a,tokenPrice:n,tokenSymbol:i})]}),It(dy,{children:({isActive:s})=>It(ey,{transactionData:r,displayFee:s,gas:a||"0x0",tokenPrice:n,tokenSymbol:i})})]})})},c5=uy.div`
|
|
2198
2198
|
display: flex;
|
|
2199
2199
|
flex-direction: row;
|
|
2200
2200
|
justify-content: space-between;
|
|
@@ -2295,10 +2295,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2295
2295
|
overflow: hidden;
|
|
2296
2296
|
max-width: 275px;
|
|
2297
2297
|
text-overflow: ellipsis;
|
|
2298
|
-
`;import{VoidSigner as A5}from"@ethersproject/abstract-signer";import{EtherscanProvider as iH}from"@ethersproject/providers";import{BigNumber as Ey}from"@ethersproject/bignumber";import{BigNumber as $n}from"@ethersproject/bignumber";import{Contract as P5}from"@ethersproject/contracts";import{serialize as S5}from"@ethersproject/transactions";var jn=e=>[Wa.id,La.id,Oa.id,Na.id,Da.id,Fa.id,Ua.id,Ha.id,Ba.id].includes(e),Cy=async(e,t)=>{if(!jn(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=$n.from(r).mul($n.from(126)).div($n.from(100)).add($n.from(e.maxPriorityFeePerGas));e.maxFeePerGas=ji(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function wy(e,t){if(!e.chainId||e.chainId&&!jn(e.chainId))return $n.from(0);let r=$n.from(0);try{let o=new P5(hp,yp,t),n=by(e),a=S5(n);r=await o.getL1Fee(a)}catch{}return r}async function Ty(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var Py=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 Kn(e,t){if(!e.gasLimit)throw new Re("gasLimit was not successfully set for transaction.");let r=nt(e.gasLimit),o=Ey.from(0);if(e.type==2)if(e.maxFeePerGas)o=nt(e.maxFeePerGas);else throw new Re("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=nt(e.gasPrice);else throw new Re("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=Ey.from(0);if(e.chainId&&jn(e.chainId))try{a=await wy(e,t),n=n.add(a)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:a}}import{BigNumber as Qc}from"@ethersproject/bignumber";var Xc=e=>[Ra.id,Ia.id,Ma.id].includes(e),Sy=async(e,t)=>{if(!Xc(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(Qc.from(120)).div(Qc.from(100));e.maxFeePerGas=ji(o),e.maxPriorityFeePerGas=ji(Qc.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var ed=e=>[56,97].includes(e),xy=async(e,t)=>{if(!ed(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};import{parseUnits as ky}from"@ethersproject/units";import{ofetch as x5}from"ofetch";var td={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},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 od=e=>[li.id,ci.id,td.id].includes(e),rd=e=>({maxPriorityFee:ky(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:ky(e.maxFee.toFixed(9),"gwei").toHexString()}),k5=e=>({safeLow:rd(e.safeLow),standard:rd(e.standard),fast:rd(e.fast)}),_5=async e=>{let t="";switch(e){case li.id:t="https://gasstation.polygon.technology/v2";break;case ci.id:t="https://gasstation-testnet.polygon.technology/v2";break;case td.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return k5(await x5(t))};async function _y(e){if(!od(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 _5(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 ji(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 by(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=nt(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=nt(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=nt(e.gasPrice)),e.value!==void 0&&(t.value=nt(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=nt(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=nt(e.maxPriorityFeePerGas)),t}async function Yn(e,t,r){if(t.chainId=Number(t.chainId),Ay(t),t.from||(t.from=e),!t.nonce){let o=new A5(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await Ty(t,r)),typeof t.type=="string"&&Ry(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),od(t.chainId)?t=await _y(t):Xc(t.chainId)?t=await Sy(t,r):jn(t.chainId)?t=await Cy(t,r):ed(t.chainId)?t=await xy(t,r):t=await Py(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function nl(e,t,r,o,n){o=Object.assign({chainId:
|
|
2298
|
+
`;import{VoidSigner as A5}from"@ethersproject/abstract-signer";import{EtherscanProvider as iH}from"@ethersproject/providers";import{BigNumber as Ey}from"@ethersproject/bignumber";import{BigNumber as $n}from"@ethersproject/bignumber";import{Contract as P5}from"@ethersproject/contracts";import{serialize as S5}from"@ethersproject/transactions";var jn=e=>[Wa.id,La.id,Oa.id,Na.id,Da.id,Fa.id,Ua.id,Ha.id,Ba.id].includes(e),Cy=async(e,t)=>{if(!jn(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=$n.from(r).mul($n.from(126)).div($n.from(100)).add($n.from(e.maxPriorityFeePerGas));e.maxFeePerGas=ji(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function wy(e,t){if(!e.chainId||e.chainId&&!jn(e.chainId))return $n.from(0);let r=$n.from(0);try{let o=new P5(hp,yp,t),n=by(e),a=S5(n);r=await o.getL1Fee(a)}catch{}return r}async function Ty(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var Py=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 Kn(e,t){if(!e.gasLimit)throw new Re("gasLimit was not successfully set for transaction.");let r=nt(e.gasLimit),o=Ey.from(0);if(e.type==2)if(e.maxFeePerGas)o=nt(e.maxFeePerGas);else throw new Re("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=nt(e.gasPrice);else throw new Re("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=Ey.from(0);if(e.chainId&&jn(e.chainId))try{a=await wy(e,t),n=n.add(a)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:a}}import{BigNumber as Qc}from"@ethersproject/bignumber";var Xc=e=>[Ra.id,Ia.id,Ma.id].includes(e),Sy=async(e,t)=>{if(!Xc(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(Qc.from(120)).div(Qc.from(100));e.maxFeePerGas=ji(o),e.maxPriorityFeePerGas=ji(Qc.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var ed=e=>[56,97].includes(e),xy=async(e,t)=>{if(!ed(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};import{parseUnits as ky}from"@ethersproject/units";import{ofetch as x5}from"ofetch";var td={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},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 od=e=>[li.id,ci.id,td.id].includes(e),rd=e=>({maxPriorityFee:ky(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:ky(e.maxFee.toFixed(9),"gwei").toHexString()}),k5=e=>({safeLow:rd(e.safeLow),standard:rd(e.standard),fast:rd(e.fast)}),_5=async e=>{let t="";switch(e){case li.id:t="https://gasstation.polygon.technology/v2";break;case ci.id:t="https://gasstation-testnet.polygon.technology/v2";break;case td.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return k5(await x5(t))};async function _y(e){if(!od(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 _5(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 ji(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 by(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=nt(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=nt(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=nt(e.gasPrice)),e.value!==void 0&&(t.value=nt(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=nt(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=nt(e.maxPriorityFeePerGas)),t}async function Yn(e,t,r){if(t.chainId=Number(t.chainId),Ay(t),t.from||(t.from=e),!t.nonce){let o=new A5(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await Ty(t,r)),typeof t.type=="string"&&Ry(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),od(t.chainId)?t=await _y(t):Xc(t.chainId)?t=await Sy(t,r):jn(t.chainId)?t=await Cy(t,r):ed(t.chainId)?t=await xy(t,r):t=await Py(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function nl(e,t,r,o,n){o=Object.assign({chainId:Or},o),Ay(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 il(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub(nt(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function Ay(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!R5(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 R5(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&Ry(e);return t||r||o}function Ry(e){return/^-?0x[a-f0-9]+$/i.test(e)}function al(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}}import{useState as nd,useEffect as I5}from"react";var sl=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,a]=nd(!0),[i,l]=nd(void 0),[s,c]=nd(void 0);return I5(()=>{let u=e.chainId||Or,h=o.find(g=>g.id===Number(u));if(!h)throw new J(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let g=await r(h);g?c(g):l(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(g){l(g)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};import{createContext as M5,useContext as W5}from"react";var id=M5(null);function Ki(){let e=W5(id);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as My}from"react/jsx-runtime";var ad=({pendingTransaction:e})=>{let{getAccessToken:t}=G(),{wallets:r}=Ki(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=M(),[s,c]=Iy(null),[u,h]=Iy(e),{tokenPrice:f}=sl(u),g=l(e.chainId)||"ETH",b=L5(()=>r.find(v=>v.walletClientType==="privy"),[r]);return O5(()=>{async function v(){if(!await t()||!o||!b)return u;let E=Nr(u.chainId,a,n,{appId:i}),P=await Yn(b.address,u,E),{totalGasEstimate:W}=await Kn(P,E);return c(W.toHexString()),P}v().then(h).catch(console.error)},[o]),b?My(D5,{children:My(qn,{from:b.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:g})}):null},D5=N5.div`
|
|
2299
2299
|
width: 100%;
|
|
2300
2300
|
padding: 1rem 0;
|
|
2301
|
-
`;import{Fragment as ld,jsx as ce,jsxs as Ar}from"react/jsx-runtime";var cd=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=sd(null),{init:a,cancel:i}=Vn();V5(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(c){try{n(c),await a(c)}catch(u){console.error(u)}}let s=()=>{n(null),i(),t()};return!e||!r?null:o?ce(z5,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Ar(ld,{children:[ce(S,{onClose:s},"header"),ce(We,{children:ce(qe,{children:ce(G5,{})})}),ce(we,{children:"Verify your identity"}),ce(fe,{children:"Choose a verification method"}),Ar(Xa,{children:[r.mfaMethods.includes("totp")&&Ar(Te,{onClick:()=>l("totp"),children:[ce(F5,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Ar(Te,{onClick:()=>l("sms"),children:[ce(U5,{}),"SMS"]},"sms")]}),ce(K,{})]})},z5=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=_(),{pendingTransaction:n}=M(),[a,i]=sd(!1),[l,s]=sd(!1),{submit:c}=Vn();async function u(h){try{if(!h)return;await c(e,h),s(!0),i(!1),t()}catch(f){throw pc(f)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):An(f)?(i(!1),new Error("The code you entered is not valid")):_n(f)?(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 Ar(ld,{children:[ce(S,{onClose:t},"header"),ce(We,{children:ce(qe,{children:ce(H5,{})})}),ce(we,{children:"Enter verification code"}),Ar(no,{children:[ce(Gn,{success:l,disabled:a,onChange:u}),Ar(fe,{children:["To continue, please enter the 6-digit code sent to your ",ce("strong",{children:"mobile device"})]}),n&&ce(ad,{pendingTransaction:n})]}),r&&ce(Jl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ce(Xt,{onClick:t,children:"Not now"}),ce(K,{})]});case"totp":return Ar(ld,{children:[ce(S,{onClose:t},"header"),ce(We,{children:ce(qe,{children:ce(B5,{})})}),ce(we,{children:"Enter verification code"}),Ar(no,{children:[ce(Gn,{success:l,disabled:a,onChange:u}),Ar(fe,{children:["To continue, please enter the 6-digit code generated from your"," ",ce("strong",{children:"authenticator app"})]}),n&&ce(ad,{pendingTransaction:n})]}),r&&ce(Jl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ce(Xt,{onClick:t,children:"Not now"}),ce(K,{})]});default:return null}};import{useEffect as Wy,useState as Ly}from"react";import q5 from"styled-components";import{Fragment as j5,jsx as Rr,jsxs as ll}from"react/jsx-runtime";var Oy={google:{name:"Google",component:Hs},discord:{name:"Discord",component:Fs},github:{name:"Github",component:Us},linkedin:{name:"LinkedIn",component:Vs},twitter:{name:"Twitter",component:$s},spotify:{name:"Spotify",component:zs},tiktok:{name:"Tiktok",component:qs},apple:{name:"Apple",component:Ds}},Ny=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:h,setReadyToTrue:f,closePrivyModal:g,createAnalyticsEvent:b}=M(),[v,x]=Ly(!1),[E,P]=Ly(void 0),W=s()?.provider||"google",I=Oy[W].name,D=Oy[W].component,R=n?.render.inDialog?Me:0;Wy(()=>{u(W).then(()=>{x(!0),f(!0)}).catch(V=>{if(V?.privyErrorCode==="allowlist_rejected"){P(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}if(V?.privyErrorCode==="max_accounts_reached"){console.error(new mr(V).toString()),P(void 0),l(),i("USER_LIMIT_REACHED_SCREEN");return}let{retryable:z,detail:A}=Lp(V,W);P({retryable:z,detail:A,message:"Authentication failed"}),f(!1)}).finally(()=>{si()})},[I,W]),Wy(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let z=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout(z)}if(Nt(o,n?.embeddedWallets?.createOnLogin)){let z=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:A=>{console.error(A),b("embedded_wallet_creation_failure_logout",{error:A,provider:W,screen:"OAuthStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R);return()=>clearTimeout(z)}else{let z=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),R);return h(),()=>clearTimeout(z)}}},[r,e,v,o]);let B=v?`Successfully connected with ${I}`:E?E.message:`Verifying connection to ${I}`,$="";return v?$="You\u2019re good to go!":E?$=E.detail:$="Just a few moments more",ll(j5,{children:[Rr(S,{}),Rr(Z,{}),ll($5,{children:[Rr(Et,{children:ll("div",{children:[Rr(Ct,{success:v,fail:!!E}),Rr(D,{style:{width:"38px",height:"38px"}})]})}),ll(Ue,{children:[Rr("h3",{children:B}),Rr("p",{children:$})]}),E&&E?.retryable?Rr(Ya,{onClick:()=>{si(),c(W),P(void 0)},disabled:!v&&!E?.retryable,children:"Retry"}):null]}),Rr(te,{}),Rr(K,{})]})},$5=q5.div`
|
|
2301
|
+
`;import{Fragment as ld,jsx as ce,jsxs as Ar}from"react/jsx-runtime";var cd=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=sd(null),{init:a,cancel:i}=Vn();V5(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(c){try{n(c),await a(c)}catch(u){console.error(u)}}let s=()=>{n(null),i(),t()};return!e||!r?null:o?ce(z5,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Ar(ld,{children:[ce(S,{onClose:s},"header"),ce(We,{children:ce(qe,{children:ce(G5,{})})}),ce(we,{children:"Verify your identity"}),ce(fe,{children:"Choose a verification method"}),Ar(Xa,{children:[r.mfaMethods.includes("totp")&&Ar(Te,{onClick:()=>l("totp"),children:[ce(F5,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Ar(Te,{onClick:()=>l("sms"),children:[ce(U5,{}),"SMS"]},"sms")]}),ce(K,{})]})},z5=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=_(),{pendingTransaction:n}=M(),[a,i]=sd(!1),[l,s]=sd(!1),{submit:c}=Vn();async function u(h){try{if(!h)return;await c(e,h),s(!0),i(!1),t()}catch(f){throw pc(f)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):An(f)?(i(!1),new Error("The code you entered is not valid")):_n(f)?(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 Ar(ld,{children:[ce(S,{onClose:t},"header"),ce(We,{children:ce(qe,{children:ce(H5,{})})}),ce(we,{children:"Enter verification code"}),Ar(no,{children:[ce(Gn,{success:l,disabled:a,onChange:u}),Ar(fe,{children:["To continue, please enter the 6-digit code sent to your ",ce("strong",{children:"mobile device"})]}),n&&ce(ad,{pendingTransaction:n})]}),r&&ce(Jl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ce(Xt,{onClick:t,children:"Not now"}),ce(K,{})]});case"totp":return Ar(ld,{children:[ce(S,{onClose:t},"header"),ce(We,{children:ce(qe,{children:ce(B5,{})})}),ce(we,{children:"Enter verification code"}),Ar(no,{children:[ce(Gn,{success:l,disabled:a,onChange:u}),Ar(fe,{children:["To continue, please enter the 6-digit code generated from your"," ",ce("strong",{children:"authenticator app"})]}),n&&ce(ad,{pendingTransaction:n})]}),r&&ce(Jl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ce(Xt,{onClick:t,children:"Not now"}),ce(K,{})]});default:return null}};import{useEffect as Wy,useState as Ly}from"react";import q5 from"styled-components";import{Fragment as j5,jsx as Rr,jsxs as ll}from"react/jsx-runtime";var Oy={google:{name:"Google",component:Hs},discord:{name:"Discord",component:Fs},github:{name:"Github",component:Us},linkedin:{name:"LinkedIn",component:Vs},twitter:{name:"Twitter",component:$s},spotify:{name:"Spotify",component:zs},tiktok:{name:"Tiktok",component:qs},apple:{name:"Apple",component:Ds}},Ny=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:h,setReadyToTrue:f,closePrivyModal:g,createAnalyticsEvent:b}=M(),[v,x]=Ly(!1),[E,P]=Ly(void 0),W=s()?.provider||"google",I=Oy[W].name,D=Oy[W].component,R=n?.render.inDialog?Me:0;Wy(()=>{u(W).then(()=>{x(!0),f(!0)}).catch(V=>{if(V?.privyErrorCode==="allowlist_rejected"){P(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}if(V?.privyErrorCode==="max_accounts_reached"){console.error(new mr(V).toString()),P(void 0),l(),i("USER_LIMIT_REACHED_SCREEN");return}let{retryable:z,detail:A}=Lp(V,W);P({retryable:z,detail:A,message:"Authentication failed"}),f(!1)}).finally(()=>{si()})},[I,W]),Wy(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let z=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout(z)}if(Nt(o,n?.embeddedWallets?.createOnLogin)){let z=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:A=>{console.error(A),b({eventName:"embedded_wallet_creation_failure_logout",payload:{error:A,provider:W,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R);return()=>clearTimeout(z)}else{let z=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),R);return h(),()=>clearTimeout(z)}}},[r,e,v,o]);let B=v?`Successfully connected with ${I}`:E?E.message:`Verifying connection to ${I}`,$="";return v?$="You\u2019re good to go!":E?$=E.detail:$="Just a few moments more",ll(j5,{children:[Rr(S,{}),Rr(Z,{}),ll($5,{children:[Rr(Et,{children:ll("div",{children:[Rr(Ct,{success:v,fail:!!E}),Rr(D,{style:{width:"38px",height:"38px"}})]})}),ll(Ue,{children:[Rr("h3",{children:B}),Rr("p",{children:$})]}),E&&E?.retryable?Rr(Ya,{onClick:()=>{si(),c(W),P(void 0)},disabled:!v&&!E?.retryable,children:"Retry"}):null]}),Rr(te,{}),Rr(K,{})]})},$5=q5.div`
|
|
2302
2302
|
display: flex;
|
|
2303
2303
|
flex-direction: column;
|
|
2304
2304
|
align-items: center;
|
|
@@ -2306,10 +2306,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2306
2306
|
margin-left: 27px;
|
|
2307
2307
|
margin-right: 27px;
|
|
2308
2308
|
gap: 24px;
|
|
2309
|
-
`;import{useEffect as dd,useRef as K5,useState as Dy}from"react";import Fy from"styled-components";import{Fragment as Z5,jsx as
|
|
2309
|
+
`;import{useEffect as dd,useRef as K5,useState as Dy}from"react";import Fy from"styled-components";import{Fragment as Z5,jsx as $r,jsxs as cl}from"react/jsx-runtime";var Uy=()=>{let{app:e,lastScreen:t,currentScreen:r,navigateBack:o}=_(),{loginWithPasskey:n,closePrivyModal:a}=M(),i=e?.render.inDialog?Me:0,[l,s]=Dy("loading"),[c,u]=Dy(null),h=K5([]),f=E=>{h.current=[E,...h.current]};dd(()=>()=>{h.current.forEach(E=>clearTimeout(E)),h.current=[]},[]);let g=()=>{switch(l){case"loading":return"Waiting for passkey";case"success":return"Success";case"error":return"Something went wrong"}},b=()=>{switch(l){case"loading":return`Please follow prompts to verify your passkey.
|
|
2310
2310
|
You will have to sign up with another method first to register a passkey for your account.`;case"success":return"You've successfully logged in with your passkey.";case"error":if(c instanceof Ie){if(c.privyErrorCode==="cannot_link_more_of_type")return"Cannot link more passkeys to account.";if(c.privyErrorCode==="passkey_not_allowed")return`Passkey request timed out or rejected by user.
|
|
2311
2311
|
You will have to sign up with another method first to register a passkey for your account.`}return`An unknown error occurred.
|
|
2312
|
-
You will have to sign up with another method first to register a passkey for your account.`}},v=()=>{switch(l){case"loading":case"success":return
|
|
2312
|
+
You will have to sign up with another method first to register a passkey for your account.`}},v=()=>{switch(l){case"loading":case"success":return $r(N,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return $r(N,{onClick:x,disabled:!1,children:"Retry"})}},x=async()=>{s("loading");try{await n(),s("success")}catch(E){u(E),s("error")}};return dd(()=>{l==="success"&&f(setTimeout(()=>{a({shouldCallAuthOnSuccess:!0,isSuccess:!0})},i))},[l]),dd(()=>{x()},[]),cl(Z5,{children:[$r(S,{backFn:!t||r===t?void 0:o}),cl(Y5,{children:[$r(Et,{children:cl("div",{children:[$r(Ct,{success:l==="success",fail:l==="error"}),$r(Qs,{style:{width:"38px",height:"38px"}})]})}),cl(Ue,{children:[$r("h3",{children:g()}),$r("p",{style:{whiteSpace:"pre-wrap"},children:b()})]}),v()]}),$r(K,{})]})},Y5=Fy.div`
|
|
2313
2313
|
display: flex;
|
|
2314
2314
|
flex-direction: column;
|
|
2315
2315
|
align-items: center;
|
|
@@ -2332,9 +2332,9 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2332
2332
|
stroke: var(--privy-color-accent) !important;
|
|
2333
2333
|
fill: var(--privy-color-accent) !important;
|
|
2334
2334
|
}
|
|
2335
|
-
`;import{useEffect as Q5,useState as Hy}from"react";import X5 from"styled-components";import{isMobile as J5}from"react-device-detect";var By=(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(!Xr()&&J5)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as t6,jsx as
|
|
2335
|
+
`;import{useEffect as Q5,useState as Hy}from"react";import X5 from"styled-components";import{isMobile as J5}from"react-device-detect";var By=(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(!Xr()&&J5)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as t6,jsx as jr,jsxs as Gy}from"react/jsx-runtime";var Vy=()=>{let{forkSession:e,ready:t,authenticated:r}=G(),[o,n]=Hy(""),[a,i]=Hy(!1);Q5(()=>{t&&r&&e().then(n)},[t,r]);let l=By(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."),Gy(t6,{children:[jr(S,{},"header"),jr(Z,{}),jr(Er,{title:s.title,description:s.description}),Gy(Ht,{children:[jr(e6,{children:jr(gr,{style:{width:"72px",height:"72px"}})}),jr(Ka,{href:l,onClick:()=>{setTimeout(()=>i(!0),1e3)},loading:t&&!l,children:a?"Go to App Store":"Continue"}),s.footnote?jr("p",{children:s.footnote}):null]}),jr(te,{}),jr(q,{protectedByPrivy:!0})]})},e6=X5(ct)`
|
|
2336
2336
|
margin: 16px auto;
|
|
2337
|
-
`;import r6 from"@heroicons/react/24/outline/LockClosedIcon";import o6 from"@heroicons/react/24/outline/PencilSquareIcon";import n6 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as i6}from"react";import{jsx as
|
|
2337
|
+
`;import r6 from"@heroicons/react/24/outline/LockClosedIcon";import o6 from"@heroicons/react/24/outline/PencilSquareIcon";import n6 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as i6}from"react";import{jsx as Kr,jsxs as zy}from"react/jsx-runtime";var qy=()=>zy("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[zy("g",{"clip-path":"url(#clip0_2115_829)",children:[Kr("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),Kr("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),Kr("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),Kr("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),Kr("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),Kr("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),Kr("defs",{children:Kr("clipPath",{id:"clip0_2115_829",children:Kr("rect",{width:"16",height:"14",fill:"white"})})})]});import $y from"styled-components";var jy=$y.div`
|
|
2338
2338
|
display: flex;
|
|
2339
2339
|
flex-direction: column;
|
|
2340
2340
|
gap: 12px;
|
|
@@ -2347,7 +2347,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2347
2347
|
margin-top: 24px;
|
|
2348
2348
|
}
|
|
2349
2349
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2350
|
-
`;import{Fragment as md,jsx as it,jsxs as Zn}from"react/jsx-runtime";var u6=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return it(Yc,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return it(Yc,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return it(md,{children:it(vy,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},r1=()=>{let{authenticated:e,getAccessToken:t}=G(),{wallets:r}=Ki(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:l,nativeTokenSymbolForChainId:s,appId:c}=M(),{app:u,navigate:h,data:f,onUserCloseViaDialogOrKeybindRef:g,setModalData:b}=_(),{transactionRequest:v,onSuccess:x,onFailure:E,uiOptions:P,fundWalletConfig:W}=f.sendTransaction,[I,D]=$t(null),[R,B]=$t(null),[$,V]=$t(""),[z,A]=$t(),[oe,F]=$t(!1),se=()=>{V(""),A(void 0)},Q=(ve,Ve,Zr)=>{V(ve),A(new Re(new Dt(Ve??ve,Zr??tt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[Y,Ae]=$t(!1),[ee,cr]=$t(!0),[at,Ne]=$t(null),[ue,Mt]=$t(v),{tokenPrice:dr,isTokenPriceLoading:jo}=sl(ue),pr=s(v.chainId)||"ETH",[ft,De]=$t(null),[L,ae]=$t(null),[H,ur]=$t(!0);e1(()=>{e||(h("LANDING"),E(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let ne=Xy(()=>r.find(ve=>ve.walletClientType==="privy"),[r]),ht=async()=>{if(!ne)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:ve,externalTransactionId:Ve}=await a(ne.address,{config:W?.config||{}});b({fiatOnRampPrompt:{signedUrl:ve},fiatOnRampStatus:{externalTransactionId:Ve}}),h("FIAT_ON_RAMP_PROMPT_SCREEN")},
|
|
2350
|
+
`;import{Fragment as md,jsx as it,jsxs as Zn}from"react/jsx-runtime";var u6=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return it(Yc,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return it(Yc,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return it(md,{children:it(vy,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},r1=()=>{let{authenticated:e,getAccessToken:t}=G(),{wallets:r}=Ki(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:l,nativeTokenSymbolForChainId:s,appId:c}=M(),{app:u,navigate:h,data:f,onUserCloseViaDialogOrKeybindRef:g,setModalData:b}=_(),{transactionRequest:v,onSuccess:x,onFailure:E,uiOptions:P,fundWalletConfig:W}=f.sendTransaction,[I,D]=$t(null),[R,B]=$t(null),[$,V]=$t(""),[z,A]=$t(),[oe,F]=$t(!1),se=()=>{V(""),A(void 0)},Q=(ve,Ve,Zr)=>{V(ve),A(new Re(new Dt(Ve??ve,Zr??tt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[Y,Ae]=$t(!1),[ee,cr]=$t(!0),[at,Ne]=$t(null),[ue,Mt]=$t(v),{tokenPrice:dr,isTokenPriceLoading:jo}=sl(ue),pr=s(v.chainId)||"ETH",[ft,De]=$t(null),[L,ae]=$t(null),[H,ur]=$t(!0);e1(()=>{e||(h("LANDING"),E(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let ne=Xy(()=>r.find(ve=>ve.walletClientType==="privy"),[r]),ht=async()=>{if(!ne)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:ve,externalTransactionId:Ve}=await a(ne.address,{config:W?.config||{}});b({fiatOnRampPrompt:{signedUrl:ve},fiatOnRampStatus:{externalTransactionId:Ve}}),h("FIAT_ON_RAMP_PROMPT_SCREEN")},Wr=Xy(()=>Nr(ue.chainId,l,i,{appId:c}),[ue.chainId,i]);e1(()=>{async function ve(){let Ve=ue;if(!await t()||!o||!ne)return;try{Ve=await Yn(ne.address,ue,Wr),Mt(Ve)}catch(Wt){console.error(Wt),Q("There was an error preparing your transaction. Please try again.",Wt.reason)}let ri=Qy.from(0),Yo=Qy.from(0);try{({totalGasEstimate:ri,l1ExecutionFeeEstimate:Yo}=await Kn(Ve,Wr)),De(ri.toHexString()),ae(Yo.toHexString())}catch{De(null)}try{let{balance:Wt,hasSufficientFunds:hl}=await il(ne.address,Ve,ri,Wr);Ne(Wt.toHexString()),hl||(cr(!1),Q("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&F(!0))}catch(Wt){console.warn(`Failed to fetch wallet balance with error: ${Wt}`)}ur(!1)}ve()},[o]);let Ji=Zy(ue),ti=Ji==="SEND"?`Send ${pr}`:"Review transaction",Yr={modalTitle:P.header||P.modalTitle||ti,buttonText:P.buttonText||"Submit"},Ko=()=>{Y||(R?x(R):E(z||new Re(new Dt("The user rejected the request",tt.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=Ko,dr===void 0&&jo||H?Zn(md,{children:[P.transactionInfo?.contractInfo?.imgUrl&&it(Aa,{src:P.transactionInfo?.contractInfo?.imgUrl}),it(S,{title:Yr.modalTitle,onClose:Ko}),it(t1,{children:it(xn,{})})]}):I!==null?it(Jy,{txn:ue,onClose:Ko,receipt:I,transactionInfo:P.transactionInfo,tokenPrice:dr,tokenSymbol:pr,l1GasEstimate:L}):Zn(md,{children:[it(S,{title:Yr.modalTitle,onClose:Ko}),Zn(t1,{children:[Zn(y6,{children:[it(u6,{txn:ue,txnFamily:Ji,uiOptions:P,tokenSymbol:pr,tokenPrice:dr}),ne?it(qn,{from:ne.address,to:ue.to,txn:ue,transactionInfo:P.transactionInfo,gas:ft||void 0,tokenPrice:dr,tokenSymbol:pr}):null]}),Zn(g6,{children:[it(m6,{children:$}),it(fy,{txn:ue,address:ne?.address??"",hasFunds:ee,balance:at}),Zn(f6,{children:[oe&&it(N,{onClick:ht,children:"Add Funds"}),it(h6,{disabled:Y||!ee,loading:!o||Y,loadingText:Y?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Ae(!0);let ve=await t();if(ve&&!Y&&ne)try{let Ve=await nl(ve,ne.address,o,ue,Wr);B(Ve);let Zr=await Ve.wait();D(al(Zr)),se()}catch(Ve){let Zr="There was an error processing your transaction. Please contact support.";console.warn({transaction:ue,error:Ve}),Q(Zr,Ve.reason)}finally{Ae(!1)}},children:Yr.buttonText})]})]})]})]})},t1=Jn.div`
|
|
2351
2351
|
display: flex;
|
|
2352
2352
|
flex-direction: column;
|
|
2353
2353
|
justify-content: space-between;
|
|
@@ -2859,4 +2859,4 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2859
2859
|
opacity: 1;
|
|
2860
2860
|
}
|
|
2861
2861
|
}
|
|
2862
|
-
`;import{jsx as Ze,jsxs as C1}from"react/jsx-runtime";var J6={["LANDING"]:hh,["CONNECT_OR_CREATE"]:mh,["AWAITING_PASSWORDLESS_CODE"]:Zu,["AWAITING_CONNECTION"]:hm,["AWAITING_CONNECT_ONLY_CONNECTION"]:Cm,["AWAITING_FARCASTER_CONNECTION"]:Pf,["AWAITING_FARCASTER_SIGNER"]:Rf,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:Uy,["PHANTOM_INTERSTITIAL_SCREEN"]:Vy,["LOGIN_FAILED_SCREEN"]:Rh,["AWAITING_OAUTH_SCREEN"]:Ny,["ALLOWLIST_REJECTION_SCREEN"]:Bu,["USER_LIMIT_REACHED_SCREEN"]:f1,["INSTALL_PHANTOM_SCREEN"]:zf,["LINK_EMAIL_SCREEN"]:yh,["LINK_PHONE_SCREEN"]:Sh,["LINK_WALLET_SCREEN"]:xh,["LINK_PASSKEY_SCREEN"]:Th,["UPDATE_EMAIL_SCREEN"]:p1,["CONNECT_ONLY_LANDING_SCREEN"]:um,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:cm,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:nf,["EMBEDDED_WALLET_CREATED_SCREEN"]:xm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Pm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:lf,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:Yy,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Rm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:n1,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:r1,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Nf,["FIAT_ON_RAMP_STATUS_SCREEN"]:Ff,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:sf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:af,["MFA_ENROLLMENT_FLOW_SCREEN"]:zh,["CAPTCHA_SCREEN"]:em,["ERROR_SCREEN"]:df,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Uf,["AFFIRMATIVE_CONSENT_SCREEN"]:Du},Q6=["LANDING","AWAITING_CONNECTION"],X6=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=M(),{ready:a,currentScreen:i}=_(),{status:l,execute:s,reset:c,enabled:u}=ye(),h=K6(null),f=Su(h),g=o&&i&&Q6.includes(i)&&!n&&l==="ready";if(v1(()=>{g&&s()},[g]),v1(()=>{!o&&u&&c()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return C1(Hn,{id:"privy-modal-content",children:[Ze(S,{}),Ze(Z,{}),Ze(Wh,{children:Ze(wt,{})}),Ze(te,{}),Ze(K,{})]});if(!i&&e)return Ze(Hn,{style:{height:f},id:"privy-modal-conent",children:Ze("div",{ref:h,children:Ze(cd,{open:e,onClose:t})})});if(!i)return null;let b=J6[i];return Ze(Hn,{style:{height:f},id:"privy-modal-content",children:C1("div",{ref:h,children:[Ze(Ur,{if:!!e,children:Ze(b,{})}),Ze(Ur,{if:!e,children:Ze(cd,{open:e,onClose:t})})]})})},e7=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:j6(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},w1=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=e7(),[o,n]=Y6(!1);Gl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ze(g1,{children:Ze(X6,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ze(Mh,{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 Z6.createPortal(l,s)}return l};import{useState as t7}from"react";import{useEffect as b1,useRef as E1}from"react";var pl=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 $o(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 be("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((f,g)=>{r.current={resolve:f,reject:g};let b=1e3*60*5;setTimeout(()=>{let v=new be("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},b)});return await e(h)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),o.current?.resolve(void 0);break}catch(h){if(h.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),h}if(c===null){let u=new be("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as s7}from"react/jsx-runtime";var r7=function(e){return()=>`id-${e++}`}(0);function o7(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Je(e){return e.error!==void 0}var Ge=new pl,yd=new Map,n7=(e,t)=>typeof t=="bigint"?t.toString():t,i7=(e,t)=>`${e}${JSON.stringify(t,n7)}`;function Qe(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=i7(e,t);if(e==="privy:wallet:create"){let l=yd.get(a);if(l)return l}let i=new Promise((l,s)=>{let c=r7();Ge.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{yd.delete(a)});return yd.set(a,i),i}function a7(e){switch(e.event){case"privy:iframe:ready":let t=Ge.dequeue(e.event,e.id);return Je(e)?t.reject(new be(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ge.dequeue(e.event,e.id);return Je(e)?r.reject(new be(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ge.dequeue(e.event,e.id);return Je(e)?o.reject(new be(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ge.dequeue(e.event,e.id);return Je(e)?n.reject(new be(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=Ge.dequeue(e.event,e.id);return Je(e)?a.reject(new be(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=Ge.dequeue(e.event,e.id);return Je(e)?i.reject(new be(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=Ge.dequeue(e.event,e.id);return Je(e)?l.reject(new be(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function T1(e){let t=E1(null),r=E1(e.mfaMethods),o=_u(),[n,a]=t7(!1);return b1(()=>{r.current=e.mfaMethods},[e.mfaMethods]),b1(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&o7(f.data)&&a7(f.data)}let s={create(f){return Qe("privy:wallet:create",f,i,e.origin)},connect(f){return Qe("privy:wallet:connect",f,i,e.origin)},recover(f){return $o(g=>Qe("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return $o(g=>Qe("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return $o(g=>Qe("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return $o(g=>Qe("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return $o(g=>Qe("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return Qe("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return $o(g=>Qe("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return Qe("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return Qe("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return Qe("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return Qe("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return Qe("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return Qe("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return Qe("privy:farcaster:remove-link",f,i,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},h=new AbortController;return wp(()=>Qe("privy:iframe:ready",{},i,e.origin),{abortSignal:h.signal}).then(c,u),()=>{window.removeEventListener("message",l),h.abort()}},[n]),s7("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:ua(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function ul(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var ml=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new T("action required");if(!this.api)throw new T("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new T("phone number must be set when initialzing authentication.");try{await this.api.post(Xd,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw pe(t)}}async authenticate(){if(!this.meta.action)throw new T("action required");if(!this.api)throw new T("Mfa flow has no API instance");if(!this.meta.smsCode)throw new T("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new T("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(ep,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return gt(t)}catch(t){throw pe(t)}}};import{jsx as Ir,jsxs as P1}from"react/jsx-runtime";var ei;function p7(e){return typeof e=="string"&&e.length===25}function Ce(){if(!ei){let e=j.get(Eo);return Promise.resolve(e||null)}return ei.getAccessToken()}var S1,Dp=(e,t)=>S1(e,t),x1,Fp=(e,t)=>x1(e,t),k1,Up=(e,t)=>k1(e,t),_1,Bp=()=>_1(),u7=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;j.put(oi,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},m7=({config:e,...t})=>{if(!p7(t.appId))throw new T("Cannot initialize the Privy provider with an invalid Privy app ID");ei||(ei=new mi({appId:t.appId,apiUrl:t.apiUrl||sa}));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."),Ir(hu,{client:ei,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Ir(f7,{...t,config:r,client:ei})})},f7=e=>{let t=e.client,[r,o]=Oe(!1),[n,a]=Oe(!1),[i,l]=Oe(!1),[s,c]=Oe(null),[u,h]=Oe([]),f=Xn(u),[g,b]=Oe(!1),[v,x]=Oe(null),[E,P]=Oe(!1),[W,I]=Oe({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:C}),[D,R]=Oe({status:"initial"}),[B,$]=Oe(null),[V,z]=Oe(null),[A,oe]=Oe(null),F=Ga(),se=Va(),[Q,Y]=Oe(!0),[Ae,ee]=Oe({}),[cr,at]=Oe(null),[Ne,ue]=Oe(null),[Mt,dr]=Oe(!1),[jo,pr]=Oe(!1),ft=Xn(null),De=Xn(null),L=Xn(xu);t.onStoreToken=d=>{d&&O(L,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),x(null),H.current=null,ae.current=null,o(!1),O(L,"accessToken","onAccessTokenRemoved")};let ae=Xn(null),H=Xn(null),ur=c7(d=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(y=>y.type==="wallet"&&y.walletClientType==="privy")?p&&d?.some(y=>y?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),ne=d=>{x(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:d})},ht=d=>{F.embeddedWallets.createOnLogin!=="off"&&Y(!0),ne(d)};Kr(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s.linkedAccounts.find(p=>p.type==="wallet"&&p.walletClientType==="privy");if(!d){t.connectors?.removeEmbeddedWalletConnector();return}if(!t.connectors){console.warn("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!A){console.warn("Failed to add embedded wallet connector: Wallet proxy not initialized");return}t.connectors.addEmbeddedWalletConnector(A,d.address,F.defaultChain,e.appId)},[A,s]),Kr(()=>{A&&Ne?.(A)},[A]),Kr(()=>{(async()=>{if(!F.customAuth?.enabled)return;Y(!0);let{getCustomAccessToken:p,isLoading:m}=F.customAuth;if(!(!n||m))try{let y=await p();if(!y&&i){await Zo.logout();return}if(!y||i)return;t.startAuthFlow(new Jo(y));let{user:k,isNewUser:U}=await t.authenticate();if(!k){await Zo.logout();return}c(k||null),b(U||!1),l(!0),pr(!0)}catch(y){console.warn(y),i&&await Zo.logout()}})()},[F.customAuth?.enabled,F.customAuth?.getCustomAccessToken,F.customAuth?.isLoading,n,i]),Kr(()=>{jo&&A&&s&&Nt(s,e.config?.embeddedWallets?.createOnLogin)&&(pr(!1),vd(s,Xo).catch(console.error))},[jo&&A&&s]),Kr(()=>{async function d(){let p=Mr();u7();let m=l7();$(m),t.initializeConnectorManager({walletConnectCloudProjectId:F.walletConnectCloudProjectId,rpcConfig:F.rpcConfig,chains:F.chains,defaultChain:F.defaultChain,store:m,walletList:F.appearance.walletList,shouldEnforceDefaultChainOnConnect:F.shouldEnforceDefaultChainOnConnect,appName:F.name??"Privy"}),t.connectors?.initialize().then(()=>{Ko()});let y=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!y),y&&O(L,"login","onComplete",y,!1,!0,null),c(y)),p||le.setReadyToTrue(!!y),p&&(y?H.current="link":H.current="login")}!n&&se&&d()},[t,cr,n,se]);let Mr=()=>{let d=ai();return!d.inProgress||d.headless?!1:(t.startAuthFlow(new fr(d)),ht("AWAITING_OAUTH_SCREEN"),!0)},Ji=async(d,p,m,y)=>{let k=await t.connectors?.createWalletConnector(d,p)||null;ti(k,p,m,y)};async function ti(d,p,m,y){if(d)I({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:C});else return I({status:"disconnected",connectedWallet:null,connectError:new J("Unable to connect to wallet."),connector:null,connectRetry:C}),y?.(null,m);d instanceof vr&&p&&await d.resetConnection(p),I({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>ti(d,p,m,y)});try{let k=await d.connect({showPrompt:!0});if(F.shouldEnforceDefaultChainOnConnect&&!F.chains.find(U=>U.id===Number(k?.chainId))&&!(k?.connectorType==="wallet_connect_v2"&&k?.walletClientType==="metamask")){I(U=>({...U,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:C}));try{await k?.switchChain(F.defaultChain.id),k&&(k.chainId=tn(xo(F.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${F.defaultChain.id}`)}}return I(U=>({...U,status:"connected",connectedWallet:k,connectError:null,connectRetry:C})),k&&!H.current&&O(L,"connectWallet","onSuccess",k),y?.(k,m)}catch(k){return k instanceof Ie?(console.warn(k.cause?k.cause:k.message),H.current||O(L,"connectWallet","onError",k.privyErrorCode||"generic_connect_wallet_error")):(console.warn(k),H.current||O(L,"connectWallet","onError","unknown_connect_wallet_error")),I(U=>({...U,status:"disconnected",connectedWallet:null,connectError:k})),y?.(null,m)}}let Yr=async(d,p)=>{if(d===null)return;let m=new _o(d,p);t.startAuthFlow(m)},Ko=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),m=d.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Xr()&&ht("LOGIN_FAILED_SCREEN"),!t.connectors)throw new T("Connector not initialized");ne("AWAITING_CONNECTION");let y=new URL(window.location.href);y.searchParams.delete("privy_connector"),y.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",y),Ji(p,m,void 0,Yr)};Kr(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(c)},[n,i,s,t]);let ve=()=>{if(!i)throw O(L,"linkAccount","onError","must_be_authenticated"),new T("User must be authenticated before linking an account.")},Ve=()=>{ve(),ae.current="siwe",H.current="link",ne("LINK_WALLET_SCREEN")},Zr=d=>{if(!i||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},ri=async d=>{if(!t.connectors)throw new T("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(I(m=>({...m,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:C})),F.captchaEnabled&&!i){let m={callback:y=>Yr(d,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ee({captchaModalData:m}),ht("CAPTCHA_SCREEN")}else await Yr(d),ht("AWAITING_CONNECTION")},Yo=async(d,p)=>{if(!F.fiatOnRamp.enabled)throw new T("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:y}=await Lf(t,d,p?.config??{},F.appearance.palette,F.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:y}}else throw new T("Unsupported fund provider. Currently supported option is `moonpay`.")},Wt=()=>{h(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:Zr(m),loginOrLink:async()=>{if(!await m.isConnected())throw new T("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new T("Cannot link or login with embedded wallet");ri(m)},fund:async y=>{let{signedUrl:k,externalTransactionId:U}=await Yo(m.address,y);ee({fiatOnRampPrompt:{signedUrl:k},fiatOnRampStatus:{externalTransactionId:U}}),ne("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new T("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new T("Cannot unlink an embedded wallet");let y=await t.unlinkWallet(m.address);c(y)}}))||[];return dr(ur(p)),ba(d,p)?d:p})};Kr(()=>{Wt()},[s?.linkedAccounts,i,n]),Kr(()=>{if(n){if(!t.connectors)throw new T("Connector not initialized");Wt(),t.connectors.on("walletsUpdated",Wt)}},[n]);let hl=()=>{ne(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Kr(()=>{if(!u[0])return;let d=u[0],p=f.current.find(y=>y.address===d.address),m;if(d.walletClientType==="privy"?m=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address&&y.walletClientType==="privy"):m=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address&&y.walletClientType!=="privy"),!p&&m){let y=Object.assign({},s);y.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(y)}f.current=u},[u]);let vd=async(d,p)=>{if(Se(d))throw O(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[y,k]=await Promise.all([le.initializeWalletProxy(p),Ce()]);if(!y&&e.config?.customAuth?.enabled)throw O(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!y||!k||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((U,de)=>{Y(!0),ee({createWallet:{onSuccess:yt=>{O(L,"createWallet","onSuccess",yt),U(yt)},onFailure:yt=>{O(L,"createWallet","onError","unknown_embedded_wallet_error"),de(yt)},callAuthOnSuccessOnClose:!1}}),ne("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await y.create({accessToken:k});let U=await le.refreshUser(),de=Se(U);if(!de)throw O(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return O(L,"createWallet","onSuccess",de),de}},M1=d=>{if(!F.chains.map(p=>p.id).includes(d))throw new J(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Cd=(d,p,m)=>new Promise(async(y,k)=>{if(!i||!s){O(L,"sendTransaction","onError","must_be_authenticated"),k(new Error("User must be authenticated before signing with a Privy wallet"));return}let U=Se(s);if(!U){O(L,"sendTransaction","onError","embedded_wallet_not_found"),k(new Error("Must have a Privy wallet before signing"));return}Y(!0);let de=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,st=d.chainId?Number(d.chainId):de.chainId;M1(st);let yt=Object.assign({},d,{chainId:st}),Wr=async()=>{let lt=await Ce();if(!lt||!A){O(L,"sendTransaction","onError","embedded_wallet_not_found"),k(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await le.recoverEmbeddedWallet()){O(L,"sendTransaction","onError","unknown_connect_wallet_error"),k(new Error("Unable to connect to wallet"));return}let Kt=Or(yt.chainId,F.chains,F.rpcConfig,{appId:e.appId}),yl=await Yn(U.address,yt,Kt);if(F.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:L1}=await Kn(yl,Kt),{hasSufficientFunds:O1}=await il(U.address,yl,L1,Kt);if(!O1)throw new Re(new Dt("Wallet has insufficient funds for this transaction.",tt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Ed=await nl(lt,U.address,A,yl,Kt);O(L,"sendTransaction","onSuccess",Ed),y(Ed)}catch(jt){O(L,"sendTransaction","onError","transaction_failure"),k(jt)}};if(F.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Wr();else{let lt={transactionRequest:yt,onSuccess:Kt=>{O(L,"sendTransaction","onSuccess",Kt),y(Kt)},onFailure:Kt=>{O(L,"sendTransaction","onError","transaction_failure"),k(Kt)},uiOptions:p||{},fundWalletConfig:m},jt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Kt=>{O(L,"sendTransaction","onError","unknown_connect_wallet_error"),k(Kt)}};ee({connectWallet:jt,sendTransaction:lt}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function wd(){return new Promise(async(d,p)=>{let m=await Ce();if(!m||!A)throw new Error("Must have valid access token to enroll in MFA");try{await A.verifyMfa({accessToken:m}),d()}catch(y){p(y)}})}let Lt=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw O(L,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw O(L,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)},Zo={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:hl,linkWallet:Ve,linkEmail:()=>{ve(),Lt("email"),ae.current="email",H.current="link",ne("LINK_EMAIL_SCREEN")},linkPhone:()=>{ve(),Lt("phone"),ae.current="sms",H.current="link",ne("LINK_PHONE_SCREEN")},linkGoogle:async()=>{ve(),Lt("google"),H.current="link",await le.initLoginWithOAuth("google")},linkTwitter:async()=>{ve(),Lt("twitter"),H.current="link",await le.initLoginWithOAuth("twitter")},linkDiscord:async()=>{ve(),Lt("discord"),H.current="link",await le.initLoginWithOAuth("discord")},linkGithub:async()=>{ve(),Lt("github"),H.current="link",await le.initLoginWithOAuth("github")},linkSpotify:async()=>{ve(),Lt("spotify"),H.current="link",await le.initLoginWithOAuth("spotify")},linkTiktok:async()=>{ve(),Lt("tiktok"),H.current="link",await le.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{ve(),Lt("linkedin"),H.current="link",await le.initLoginWithOAuth("linkedin")},linkApple:async()=>{ve(),Lt("apple"),H.current="link",await le.initLoginWithOAuth("apple")},linkPasskey:async()=>{ve(),Lt("passkey"),await le.initLinkWithPasskey(),ne("LINK_PASSKEY_SCREEN")},linkFarcaster:async()=>{ve(),Lt("farcaster"),await le.initLoginWithFarcaster(),H.current="link",ae.current="farcaster",ne("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(ve(),!s?.email)throw new T("User does not have an email linked to their account.");H.current="link",ae.current="email",ne("UPDATE_EMAIL_SCREEN")},login:async()=>{let d="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let p=await new Promise(m=>{at(y=>m.bind(y))});if(at(null),p){console.warn(d);return}}if(i){console.warn(d);return}H.current="login",ht("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{at(()=>d)}),at(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}ht("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&A)try{await A.clearMfa({userId:s.id})}catch{}c(null),l(!1),x(null),O(L,"logout","onSuccess"),H.current=null,ae.current=null,o(!1),j.del(ni)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new xe;let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===d?.address));return!d||!p?new xe:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new gd(new hr(new xe));let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===d?.address));return!d||!p?new gd(new hr(new xe)):new gd(new hr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new ro(new xe);let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===d?.address));return!d||!p?new ro(new xe):new ro(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(y=>fl(y.address)===fl(d)),m=s?.linkedAccounts.find(y=>y.type==="wallet"&&fl(y.address)===fl(d));if(!p||!await p.isConnected())z(d),Ve();else if(!p.linked)p.loginOrLink();else{let y=Object.assign({},s);y.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(y)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw O(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return vd(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw O(L,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Se(s);if(!d||!A)throw O(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw O(L,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await wd()}catch(p){throw O(L,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{Y(!0);let y={onSuccess:U=>{O(L,"setWalletPassword","onSuccess",U),p(U)},onFailure:U=>{O(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(U)},callAuthOnSuccessOnClose:!1},k={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:U=>{O(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(U)}};ee({setWalletPassword:y,connectWallet:k}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(m,y)=>{if(!i||!s){O(L,"signMessage","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let k=Se(s);if(!k){O(L,"signMessage","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){O(L,"signMessage","onError","invalid_message"),y(new Error("Message must be a non-empty string"));return}Y(!0);let U=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let de=await Ce();if(!A||!de)throw new Error("Unable to connect to wallet");if(!await le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:k.address});let{response:yt}=await A.rpc({accessToken:de,address:k.address,request:{method:"personal_sign",params:[d,k.address]}}),Wr=yt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:k.address}),Wr};if(F.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let de=await U();O(L,"signMessage","onSuccess",de),m(de)}catch(de){O(L,"signMessage","onError","unable_to_sign"),y(de??new Re("Unable to sign message"))}}else{let yt={method:"personal_sign",data:d,confirmAndSign:U,onSuccess:lt=>{O(L,"signMessage","onSuccess",lt),m(lt)},onFailure:lt=>{O(L,"signMessage","onError","unable_to_sign"),y(lt)},uiOptions:p||{}},Wr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:lt=>{O(L,"signMessage","onError","unknown_connect_wallet_error"),y(lt)}};ee({signMessage:yt,connectWallet:Wr}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,y)=>{if(!i||!s){O(L,"signTypedData","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let k=Se(s);if(!k){O(L,"signTypedData","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}Y(!0);let U=fa(d),de=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let st=await Ce();if(!A||!st)throw new Error("Unable to connect to wallet");if(!await le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:k.address});let{response:Wr}=await A.rpc({accessToken:st,address:k.address,request:{method:"eth_signTypedData_v4",params:[k.address,U]}}),lt=Wr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:k.address}),lt};if(F.embeddedWallets.noPromptOnSignature||(F.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let st=await de();O(L,"signTypedData","onSuccess",st),m(st)}catch(st){O(L,"signTypedData","onError","unable_to_sign"),y(st??new Re("Unable to sign message"))}}else{let Wr={method:"eth_signTypedData_v4",data:U,confirmAndSign:de,onSuccess:jt=>{O(L,"signTypedData","onSuccess",jt),m(jt)},onFailure:jt=>{O(L,"signTypedData","onError","unable_to_sign"),y(jt)},uiOptions:p||{}},lt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:jt=>{O(L,"signMessage","onError","unknown_connect_wallet_error"),y(jt)}};ee({signMessage:Wr,connectWallet:lt}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let k=await(await Cd(d,p,m)).wait();return al(k)},exportWallet:()=>new Promise(async(d,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=Se(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}Y(!0);let y={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},k=await Ce();if(!k||!A){p(new Error("Must have valid access token to enroll in MFA"));return}if(!A){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await A.connect({accessToken:k,address:m.address}),await A.verifyMfa({accessToken:k})}catch(de){if(Do(de))await le.recoverEmbeddedWallet();else throw de}}catch(de){p(de);return}let U={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};ee({keyExport:U,connectWallet:y}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:wd,async init(d){let p;switch(d){case"sms":p=new ml("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(p),await p.init()},async submit(d,p){switch(d){case"totp":case"sms":ft.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((m,y)=>{De.current={resolve:m,reject:y}});break;default:throw ft.current?.reject(new T("Unsupported MFA method")),new T(`Unsupported MFA method: ${d}`)}},cancel(){ft.current?.reject(new T("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Ce();if(!p||!A)throw new Error("Must have valid access token to enroll in MFA");await A.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){le.closePrivyModal(),p();return}F.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."),ee({mfaEnrollmentFlow:{mfaMethods:F.mfa.methods,onSuccess:p,onFailure:m}}),ne("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Ce();if(!d||!A)throw new Error("Must have valid access token to enroll in MFA");let p=await A.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Ce();if(!p||!A)throw new Error("Must have valid access token to enroll in MFA");await A.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await Ce();if(!p||!A)throw new Error("Must have valid access token to enroll in MFA");await A.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await Ce();if(!p||!A)throw new Error("Must have valid access token to remove MFA");await A.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},requestFarcasterSigner:async()=>{let d=await Ce(),p=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let y=await A.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null});if(y.status==="approved"){let k=await t.getAuthenticatedUser();c(k||s||null)}ee({farcasterSigner:y}),ne("AWAITING_FARCASTER_SIGNER")},submitCast:async d=>{let p=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!m)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.submitCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:d,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:d})=>{let p=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!m)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.removeCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:d,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:d,castAuthorFid:p})=>{let m=await Ce(),y=s?.linkedAccounts.find(de=>de.type==="wallet"&&de.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!y)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.reactToCast({address:y.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:d,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:d,castAuthorFid:p})=>{let m=await Ce(),y=s?.linkedAccounts.find(de=>de.type==="wallet"&&de.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!y)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.reactToCast({address:y.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:d,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:d})=>{let p=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!m)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.submitLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:d},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:d})=>{let p=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!m)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.removeLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:d},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:E,loginWithCode(d){return le.loginWithCode(d)},initLoginWithEmail(d){return le.initLoginWithEmail(d)},initLoginWithSms(d){return le.initLoginWithSms(d)},otpState:D,fundWallet(d,p){return le.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return le.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return le.loginWithHeadlessOAuth(d)},isModalOpen:r};S1=Zo.signMessage,x1=Zo.signTypedData,k1=async(...d)=>{let p=await Cd(...d);return F.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let bd=!!e.config?.headless,le=(()=>({headless:bd,isNewUserThisSession:g,linkingHint:V,pendingTransaction:null,walletConnectionStatus:W,mipdStore:B,connectors:t.connectors?.walletConnectors??[],rpcConfig:F.rpcConfig,chains:F.chains,appId:e.appId,showFiatPrices:F.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>F.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(A)return A;let p=new Promise(k=>{ue(()=>U=>k(U))}),m=new Promise(k=>setTimeout(()=>k(null),d)),y=await Promise.race([p,m]);return ue(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;H.current==="login"?d.shouldCallAuthOnSuccess&&p?(O(L,"login","onComplete",s,g,!1,ae.current??null),e.onSuccess?.(s,g)):O(L,"login","onError","exited_auth_flow"):H.current==="link"&&ae.current&&(d.isSuccess&&p?O(L,"linkAccount","onSuccess",s,ae.current):O(L,"linkAccount","onError","exited_link_flow")),z(null),H.current=null,ae.current=null,b(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:ne,connectWallet:ti,initLoginWithWallet:async(d,p)=>{ae.current="siwe",Yr(d,p)},loginWithWallet:async()=>{if(!n)throw new Jr;if(!(t.authFlow instanceof _o))throw new T("Must initialize SIWE flow first.");let d,p;if(i)try{d=await t.link(),ae.current="siwe"}catch(m){throw O(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),ae.current="siwe"}catch(m){throw O(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||s||null),b(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new ii(d);t.startAuthFlow(p);try{ae.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw H.current==="login"?O(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):H.current==="link"&&O(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Jr;if(!(t.authFlow instanceof ii))throw new T("Must initialize Farcaster flow first.");let d,p;if(i)try{d=await t.link(),ae.current="farcaster"}catch(m){throw O(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),ae.current="farcaster"}catch(m){throw O(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d||null),b(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(ae.current=d,wl()){if(d==="google"&&ul(window.navigator.userAgent)){ht("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{ht("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}j.del(Po);let m=new fr({provider:d});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let y=await t.authFlow.getAuthorizationUrl();y&&y.url&&window.location.assign(y.url)},async loginWithOAuth(d){if(!(t.authFlow instanceof fr))throw new T("Must initialize OAuth flow before calling loginWithOAuth");let p=j.get(To),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d,storedStateCode:p??"",returnedStateCode:m??""}),new T("Unexpected auth flow. This may be a phishing attempt.");let y,k;if(i)try{y=await t.link(),ae.current=d}catch(U){throw O(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}else try{({user:y,isNewUser:k}=await t.authenticate()),ae.current=d}catch(U){throw H.current==="login"?O(L,"login","onError",U.privyErrorCode||"unknown_auth_error"):H.current==="link"&&O(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}c(y),b(k||!1),l(!0)},async initLoginWithPasskey(d){let p=new ko(d);t.startAuthFlow(p),H.current="login";try{ae.current="passkey",await p.initAuthenticationFlow()}catch(m){throw O(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},async loginWithPasskey(){if(!n)throw new Jr;if(!(t.authFlow instanceof ko))throw new T("Must initialize Passkey flow first.");if(ae.current!=="passkey")throw new T("Must init login with Passkey flow first.");let d,p;try{ae.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(m){throw O(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d),b(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new ko(d);t.startAuthFlow(p),H.current="link",ae.current="passkey";try{await p.initLinkFlow()}catch(m){throw O(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},async linkWithPasskey(){if(!n)throw new Jr;if(!(t.authFlow instanceof ko))throw new T("Must initialize Passkey flow first.");if(ae.current!=="passkey")throw new T("Must init login with Passkey flow first.");let d;try{ae.current="passkey",d=await t.link()}catch(p){throw O(L,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}c(d||s||null)},async initLoginWithHeadlessOAuth(d,p){if(wl()){if(d==="google"&&ul(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 m=new fr({provider:d,headless:!0});p&&m.addCaptchaToken(p);let y=await t.startAuthFlow(m).getAuthorizationUrl();y?.url&&window.location.assign(y.url)},async loginWithHeadlessOAuth(d){P(!0),t.startAuthFlow(new fr(d));let p=j.get(To),m=d.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d.provider,storedStateCode:p??"",returnedStateCode:m??""}),P(!1),new T("Unexpected auth flow. This may be a phishing attempt.");let y,k;if(i)try{y=await t.link(),ae.current=d.provider}catch(U){throw O(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}else try{({user:y,isNewUser:k}=await t.authenticate()),ae.current=d.provider}catch(U){throw H.current==="login"?O(L,"login","onError",U.privyErrorCode||"unknown_auth_error"):H.current==="link"&&O(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}return c(y),b(k||!1),l(!0),P(!1),y??void 0},initLoginWithEmail:async(d,p)=>{let m=new Qr(d,p);t.startAuthFlow(m);try{ae.current="email",await m.sendCodeEmail()}catch(y){throw H.current==="login"?O(L,"login","onError",y.privyErrorCode||"unknown_auth_error"):H.current==="link"&&O(L,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},initUpdateEmail:async(d,p,m)=>{let y=new na(d,p,m);t.startAuthFlow(y),await y.sendCodeEmail()},initLoginWithSms:async(d,p)=>{R({status:"sending-code"});let m=new Ao(d,p);t.startAuthFlow(m);try{ae.current="sms",await m.sendSmsCode(),R({status:"awaiting-code-input"})}catch(y){throw R({status:"error",error:y}),H.current==="login"?O(L,"login","onError",y.privyErrorCode||"unknown_auth_error"):H.current==="link"&&O(L,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(R({status:"submitting-code"}),!n){let k=new Jr;throw R({status:"error",error:k}),k}if(t.authFlow instanceof Qr)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Ao)t.authFlow.meta.smsCode=d.trim();else{let k=new T("Must initialize a passwordless code flow first");throw R({status:"error",error:k}),k}let p=await Ce(),m,y;if(p&&t.sessionHasActiveToken())try{m=await t.link()}catch(k){throw R({status:"error",error:k}),O(L,"linkAccount","onError",k.privyErrorCode||"failed_to_link_account"),k}else try{({user:m,isNewUser:y}=await t.authenticate())}catch(k){throw R({status:"error",error:k}),O(L,"login","onError",k.privyErrorCode||"unknown_auth_error"),k}c(m||s||null),b(y||!1),l(!0),R({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:A,createAnalyticsEvent:(d,p,m)=>t.createAnalyticsEvent(d,p,m),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let m=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy"),y=await Ce();if(!y||!A||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await A.connect({accessToken:y,address:m.address}),d(!0)}catch(k){Do(k)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await A.recover({address:m.address,accessToken:y})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),d(!0)):Do(k)?(ee({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)}}),ne("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(k)}}),getFiatOnRampConfig:Yo,setReadyToTrue:d=>{a(!0),cr?.(d)},updateWallets:()=>Wt(),fundWallet:async(d,p)=>{let{signedUrl:m,externalTransactionId:y}=await Yo(d,p);ee({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:y}}),ne("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await Ce(),m=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!m)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 y=await t.requestFarcasterSignerStatus(d);if(y.status==="approved"){let k=await t.getAuthenticatedUser();c(k||s||null)}return y}}))();_1=le.recoverEmbeddedWallet;let W1=d7(()=>({wallets:u,ready:Mt}),[u,Mt]);return Ir(me.Provider,{value:Zo,children:Ir(Hl.Provider,{value:L,children:Ir(id.Provider,{value:W1,children:P1(Tu,{...F,children:[e.children,P1(Bl.Provider,{value:le,children:[!bd&&F.captchaEnabled&&n&&!i&&Ir(Ul,{delayedExecution:!1}),Ir(y1,{theme:{...F.appearance.palette||{}}}),Ir(gu,{data:Ae,setModalData:ee,setInitialScreen:x,initialScreen:v,authenticated:i,open:r,children:Ir(w1,{open:r})}),Q&&se?Ir(T1,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:ft,mfaSubmitPromise:De,onLoad:oe,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as h7}from"react";function y7(e){let{login:t}=h7(me);return _e("login",e),{login:t}}import{useContext as g7}from"react";function v7(e){let{logout:t}=g7(me);return _e("logout",e),{logout:t}}import{useCallback as A1,useEffect as C7}from"react";function w7(){let e=ye(),t=Va(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=A1(async c=>{if(e.enabled&&e.status!=="success")throw new Qt(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=A1(async()=>{let c=ai();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(c)}catch(u){throw u}finally{si()}},[o]);return C7(()=>{let c=ai();a&&t&&c.inProgress&&c.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as R1}from"react";var b7=()=>{let e=ye(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=R1(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=R1(async({code:a})=>{if(e.enabled&&e.status==="error")throw new Qt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as I1}from"react";var E7=()=>{let e=ye(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=G(),n=I1(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),a=I1(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Qt(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:n,loginWithCode:a,state:o}};import{useContext as T7}from"react";function P7(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:h,linkFarcaster:f}=T7(me);return _e("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:h,linkFarcaster:f}}import{useContext as S7}from"react";function x7(e){let{connectWallet:t}=S7(me);return _e("connectWallet",e),{connectWallet:t}}import{useContext as k7}from"react";function _7(e){let{createWallet:t}=k7(me);return _e("createWallet",e),{createWallet:t}}var A7=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as R7}from"react";function I7(e){let{sendTransaction:t}=R7(me);return _e("sendTransaction",e),{sendTransaction:t}}import{useContext as M7}from"react";function W7(e){let{setWalletPassword:t}=M7(me);return _e("setWalletPassword",e),{setWalletPassword:t}}import{useContext as L7}from"react";function O7(e){let{signMessage:t}=L7(me);return _e("signMessage",e),{signMessage:t}}import{useContext as N7}from"react";function D7(e){let{signTypedData:t}=N7(me);return _e("signTypedData",e),{signTypedData:t}}import{useContext as F7}from"react";var U7=()=>{let{isModalOpen:e}=F7(me);return{isOpen:e}};import{useContext as B7}from"react";function H7(e){let{getAccessToken:t}=B7(me);return _e("accessToken",e),{getAccessToken:t}}function G7(){let{submitCast:e,removeCast:t,likeCast:r,recastCast:o,followUser:n,unfollowUser:a,requestFarcasterSigner:i}=G();return{followUser:n,unfollowUser:a,submitCast:e,removeCast:t,likeCast:r,recastCast:o,requestFarcasterSigner:i}}function V7(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{hr as AsExternalProvider,Ul as Captcha,ui as ConnectorManager,mi as PrivyClient,m7 as PrivyProvider,xe as PrivyProxyProvider,di as SUPPORTED_CHAINS,Pl as VERSION,vt as WalletConnector,V7 as addRpcUrlOverrideToChain,pc as errorIndicatesMaxMfaRetries,_n as errorIndicatesMfaTimeout,An as errorIndicatesMfaVerificationFailed,Ce as getAccessToken,x7 as useConnectWallet,_7 as useCreateWallet,G7 as useExperimentalFarcasterSigner,A7 as useFundWallet,P7 as useLinkAccount,y7 as useLogin,b7 as useLoginWithEmail,w7 as useLoginWithOAuth,E7 as useLoginWithSms,v7 as useLogout,Vn as useMfa,Hi as useMfaEnrollment,U7 as useModalStatus,G as usePrivy,Gl as useRegisterMfaListener,I7 as useSendTransaction,W7 as useSetWalletPassword,O7 as useSignMessage,D7 as useSignTypedData,H7 as useToken,Ki as useWallets};
|
|
2862
|
+
`;import{jsx as Ze,jsxs as C1}from"react/jsx-runtime";var J6={["LANDING"]:hh,["CONNECT_OR_CREATE"]:mh,["AWAITING_PASSWORDLESS_CODE"]:Zu,["AWAITING_CONNECTION"]:hm,["AWAITING_CONNECT_ONLY_CONNECTION"]:Cm,["AWAITING_FARCASTER_CONNECTION"]:Pf,["AWAITING_FARCASTER_SIGNER"]:Rf,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:Uy,["PHANTOM_INTERSTITIAL_SCREEN"]:Vy,["LOGIN_FAILED_SCREEN"]:Rh,["AWAITING_OAUTH_SCREEN"]:Ny,["ALLOWLIST_REJECTION_SCREEN"]:Bu,["USER_LIMIT_REACHED_SCREEN"]:f1,["INSTALL_PHANTOM_SCREEN"]:zf,["LINK_EMAIL_SCREEN"]:yh,["LINK_PHONE_SCREEN"]:Sh,["LINK_WALLET_SCREEN"]:xh,["LINK_PASSKEY_SCREEN"]:Th,["UPDATE_EMAIL_SCREEN"]:p1,["CONNECT_ONLY_LANDING_SCREEN"]:um,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:cm,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:nf,["EMBEDDED_WALLET_CREATED_SCREEN"]:xm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Pm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:lf,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:Yy,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Rm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:n1,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:r1,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Nf,["FIAT_ON_RAMP_STATUS_SCREEN"]:Ff,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:sf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:af,["MFA_ENROLLMENT_FLOW_SCREEN"]:zh,["CAPTCHA_SCREEN"]:em,["ERROR_SCREEN"]:df,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Uf,["AFFIRMATIVE_CONSENT_SCREEN"]:Du},Q6=["LANDING","AWAITING_CONNECTION"],X6=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=M(),{ready:a,currentScreen:i}=_(),{status:l,execute:s,reset:c,enabled:u}=ye(),h=K6(null),f=Su(h),g=o&&i&&Q6.includes(i)&&!n&&l==="ready";if(v1(()=>{g&&s()},[g]),v1(()=>{!o&&u&&c()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return C1(Hn,{id:"privy-modal-content",children:[Ze(S,{}),Ze(Z,{}),Ze(Wh,{children:Ze(wt,{})}),Ze(te,{}),Ze(K,{})]});if(!i&&e)return Ze(Hn,{style:{height:f},id:"privy-modal-conent",children:Ze("div",{ref:h,children:Ze(cd,{open:e,onClose:t})})});if(!i)return null;let b=J6[i];return Ze(Hn,{style:{height:f},id:"privy-modal-content",children:C1("div",{ref:h,children:[Ze(Br,{if:!!e,children:Ze(b,{})}),Ze(Br,{if:!e,children:Ze(cd,{open:e,onClose:t})})]})})},e7=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:j6(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},w1=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=e7(),[o,n]=Y6(!1);Gl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ze(g1,{children:Ze(X6,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ze(Mh,{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 Z6.createPortal(l,s)}return l};import{useState as t7}from"react";import{useEffect as b1,useRef as E1}from"react";var pl=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 $o(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 be("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((f,g)=>{r.current={resolve:f,reject:g};let b=1e3*60*5;setTimeout(()=>{let v=new be("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},b)});return await e(h)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),o.current?.resolve(void 0);break}catch(h){if(h.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),h}if(c===null){let u=new be("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as s7}from"react/jsx-runtime";var r7=function(e){return()=>`id-${e++}`}(0);function o7(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Je(e){return e.error!==void 0}var Ge=new pl,yd=new Map,n7=(e,t)=>typeof t=="bigint"?t.toString():t,i7=(e,t)=>`${e}${JSON.stringify(t,n7)}`;function Qe(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=i7(e,t);if(e==="privy:wallet:create"){let l=yd.get(a);if(l)return l}let i=new Promise((l,s)=>{let c=r7();Ge.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{yd.delete(a)});return yd.set(a,i),i}function a7(e){switch(e.event){case"privy:iframe:ready":let t=Ge.dequeue(e.event,e.id);return Je(e)?t.reject(new be(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ge.dequeue(e.event,e.id);return Je(e)?r.reject(new be(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ge.dequeue(e.event,e.id);return Je(e)?o.reject(new be(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ge.dequeue(e.event,e.id);return Je(e)?n.reject(new be(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=Ge.dequeue(e.event,e.id);return Je(e)?a.reject(new be(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=Ge.dequeue(e.event,e.id);return Je(e)?i.reject(new be(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=Ge.dequeue(e.event,e.id);return Je(e)?l.reject(new be(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=Ge.dequeue(e.event,e.id);return Je(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function T1(e){let t=E1(null),r=E1(e.mfaMethods),o=_u(),[n,a]=t7(!1);return b1(()=>{r.current=e.mfaMethods},[e.mfaMethods]),b1(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&o7(f.data)&&a7(f.data)}let s={create(f){return Qe("privy:wallet:create",f,i,e.origin)},connect(f){return Qe("privy:wallet:connect",f,i,e.origin)},recover(f){return $o(g=>Qe("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return $o(g=>Qe("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return $o(g=>Qe("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return $o(g=>Qe("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return $o(g=>Qe("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return Qe("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return $o(g=>Qe("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return Qe("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return Qe("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return Qe("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return Qe("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return Qe("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return Qe("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return Qe("privy:farcaster:remove-link",f,i,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},h=new AbortController;return wp(()=>Qe("privy:iframe:ready",{},i,e.origin),{abortSignal:h.signal}).then(c,u),()=>{window.removeEventListener("message",l),h.abort()}},[n]),s7("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:ua(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function ul(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var ml=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new T("action required");if(!this.api)throw new T("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new T("phone number must be set when initialzing authentication.");try{await this.api.post(Xd,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw pe(t)}}async authenticate(){if(!this.meta.action)throw new T("action required");if(!this.api)throw new T("Mfa flow has no API instance");if(!this.meta.smsCode)throw new T("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new T("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(ep,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return gt(t)}catch(t){throw pe(t)}}};import{jsx as Mr,jsxs as P1}from"react/jsx-runtime";var ei;function p7(e){return typeof e=="string"&&e.length===25}function Ce(){if(!ei){let e=j.get(Eo);return Promise.resolve(e||null)}return ei.getAccessToken()}var S1,Dp=(e,t)=>S1(e,t),x1,Fp=(e,t)=>x1(e,t),k1,Up=(e,t)=>k1(e,t),_1,Bp=()=>_1(),u7=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;j.put(oi,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},m7=({config:e,...t})=>{if(!p7(t.appId))throw new T("Cannot initialize the Privy provider with an invalid Privy app ID");ei||(ei=new mi({appId:t.appId,apiUrl:t.apiUrl||sa}));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."),Mr(hu,{client:ei,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Mr(f7,{...t,config:r,client:ei})})},f7=e=>{let t=e.client,[r,o]=Oe(!1),[n,a]=Oe(!1),[i,l]=Oe(!1),[s,c]=Oe(null),[u,h]=Oe([]),f=Xn(u),[g,b]=Oe(!1),[v,x]=Oe(null),[E,P]=Oe(!1),[W,I]=Oe({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:C}),[D,R]=Oe({status:"initial"}),[B,$]=Oe(null),[V,z]=Oe(null),[A,oe]=Oe(null),F=Ga(),se=Va(),[Q,Y]=Oe(!0),[Ae,ee]=Oe({}),[cr,at]=Oe(null),[Ne,ue]=Oe(null),[Mt,dr]=Oe(!1),[jo,pr]=Oe(!1),ft=Xn(null),De=Xn(null),L=Xn(xu);t.onStoreToken=d=>{d&&O(L,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),x(null),H.current=null,ae.current=null,o(!1),O(L,"accessToken","onAccessTokenRemoved")};let ae=Xn(null),H=Xn(null),ur=c7(d=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(y=>y.type==="wallet"&&y.walletClientType==="privy")?p&&d?.some(y=>y?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),ne=d=>{x(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},ht=d=>{F.embeddedWallets.createOnLogin!=="off"&&Y(!0),ne(d)};Ir(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),Ir(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s.linkedAccounts.find(p=>p.type==="wallet"&&p.walletClientType==="privy");if(!d){t.connectors?.removeEmbeddedWalletConnector();return}if(!t.connectors){console.warn("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!A){console.warn("Failed to add embedded wallet connector: Wallet proxy not initialized");return}t.connectors.addEmbeddedWalletConnector(A,d.address,F.defaultChain,e.appId)},[A,s]),Ir(()=>{A&&Ne?.(A)},[A]),Ir(()=>{(async()=>{if(!F.customAuth?.enabled)return;Y(!0);let{getCustomAccessToken:p,isLoading:m}=F.customAuth;if(!(!n||m))try{let y=await p();if(!y&&i){await Zo.logout();return}if(!y||i)return;t.startAuthFlow(new Jo(y));let{user:k,isNewUser:U}=await t.authenticate();if(!k){await Zo.logout();return}c(k||null),b(U||!1),l(!0),pr(!0)}catch(y){console.warn(y),i&&await Zo.logout()}})()},[F.customAuth?.enabled,F.customAuth?.getCustomAccessToken,F.customAuth?.isLoading,n,i]),Ir(()=>{jo&&A&&s&&Nt(s,e.config?.embeddedWallets?.createOnLogin)&&(pr(!1),vd(s,Xo).catch(console.error))},[jo&&A&&s]),Ir(()=>{async function d(){let p=Wr();u7();let m=l7();$(m),t.initializeConnectorManager({walletConnectCloudProjectId:F.walletConnectCloudProjectId,rpcConfig:F.rpcConfig,chains:F.chains,defaultChain:F.defaultChain,store:m,walletList:F.appearance.walletList,shouldEnforceDefaultChainOnConnect:F.shouldEnforceDefaultChainOnConnect,appName:F.name??"Privy"}),t.connectors?.initialize().then(()=>{Ko()});let y=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!y),y&&O(L,"login","onComplete",y,!1,!0,null),c(y)),p||le.setReadyToTrue(!!y),p&&(y?H.current="link":H.current="login")}!n&&se&&d()},[t,cr,n,se]);let Wr=()=>{let d=ai();return!d.inProgress||d.headless?!1:(t.startAuthFlow(new fr(d)),ht("AWAITING_OAUTH_SCREEN"),!0)},Ji=async(d,p,m,y)=>{let k=await t.connectors?.createWalletConnector(d,p)||null;ti(k,p,m,y)};async function ti(d,p,m,y){if(d)I({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:C});else return I({status:"disconnected",connectedWallet:null,connectError:new J("Unable to connect to wallet."),connector:null,connectRetry:C}),y?.(null,m);d instanceof vr&&p&&await d.resetConnection(p),I({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>ti(d,p,m,y)});try{let k=await d.connect({showPrompt:!0});if(F.shouldEnforceDefaultChainOnConnect&&!F.chains.find(U=>U.id===Number(k?.chainId))&&!(k?.connectorType==="wallet_connect_v2"&&k?.walletClientType==="metamask")){I(U=>({...U,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:C}));try{await k?.switchChain(F.defaultChain.id),k&&(k.chainId=tn(xo(F.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${F.defaultChain.id}`)}}return I(U=>({...U,status:"connected",connectedWallet:k,connectError:null,connectRetry:C})),k&&!H.current&&O(L,"connectWallet","onSuccess",k),y?.(k,m)}catch(k){return k instanceof Ie?(console.warn(k.cause?k.cause:k.message),H.current||O(L,"connectWallet","onError",k.privyErrorCode||"generic_connect_wallet_error")):(console.warn(k),H.current||O(L,"connectWallet","onError","unknown_connect_wallet_error")),I(U=>({...U,status:"disconnected",connectedWallet:null,connectError:k})),y?.(null,m)}}let Yr=async(d,p)=>{if(d===null)return;let m=new _o(d,p);t.startAuthFlow(m)},Ko=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),m=d.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Xr()&&ht("LOGIN_FAILED_SCREEN"),!t.connectors)throw new T("Connector not initialized");ne("AWAITING_CONNECTION");let y=new URL(window.location.href);y.searchParams.delete("privy_connector"),y.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",y),Ji(p,m,void 0,Yr)};Ir(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(c)},[n,i,s,t]);let ve=()=>{if(!i)throw O(L,"linkAccount","onError","must_be_authenticated"),new T("User must be authenticated before linking an account.")},Ve=()=>{ve(),ae.current="siwe",H.current="link",ne("LINK_WALLET_SCREEN")},Zr=d=>{if(!i||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},ri=async d=>{if(!t.connectors)throw new T("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(I(m=>({...m,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:C})),F.captchaEnabled&&!i){let m={callback:y=>Yr(d,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ee({captchaModalData:m}),ht("CAPTCHA_SCREEN")}else await Yr(d),ht("AWAITING_CONNECTION")},Yo=async(d,p)=>{if(!F.fiatOnRamp.enabled)throw new T("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:y}=await Lf(t,d,p?.config??{},F.appearance.palette,F.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:y}}else throw new T("Unsupported fund provider. Currently supported option is `moonpay`.")},Wt=()=>{h(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:Zr(m),loginOrLink:async()=>{if(!await m.isConnected())throw new T("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new T("Cannot link or login with embedded wallet");ri(m)},fund:async y=>{let{signedUrl:k,externalTransactionId:U}=await Yo(m.address,y);ee({fiatOnRampPrompt:{signedUrl:k},fiatOnRampStatus:{externalTransactionId:U}}),ne("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new T("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new T("Cannot unlink an embedded wallet");let y=await t.unlinkWallet(m.address);c(y)}}))||[];return dr(ur(p)),ba(d,p)?d:p})};Ir(()=>{Wt()},[s?.linkedAccounts,i,n]),Ir(()=>{if(n){if(!t.connectors)throw new T("Connector not initialized");Wt(),t.connectors.on("walletsUpdated",Wt)}},[n]);let hl=()=>{ne(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Ir(()=>{if(!u[0])return;let d=u[0],p=f.current.find(y=>y.address===d.address),m;if(d.walletClientType==="privy"?m=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address&&y.walletClientType==="privy"):m=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address&&y.walletClientType!=="privy"),!p&&m){let y=Object.assign({},s);y.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(y)}f.current=u},[u]);let vd=async(d,p)=>{if(Se(d))throw O(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[y,k]=await Promise.all([le.initializeWalletProxy(p),Ce()]);if(!y&&e.config?.customAuth?.enabled)throw O(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!y||!k||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((U,de)=>{Y(!0),ee({createWallet:{onSuccess:yt=>{O(L,"createWallet","onSuccess",yt),U(yt)},onFailure:yt=>{O(L,"createWallet","onError","unknown_embedded_wallet_error"),de(yt)},callAuthOnSuccessOnClose:!1}}),ne("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await y.create({accessToken:k});let U=await le.refreshUser(),de=Se(U);if(!de)throw O(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return O(L,"createWallet","onSuccess",de),de}},M1=d=>{if(!F.chains.map(p=>p.id).includes(d))throw new J(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Cd=(d,p,m)=>new Promise(async(y,k)=>{if(!i||!s){O(L,"sendTransaction","onError","must_be_authenticated"),k(new Error("User must be authenticated before signing with a Privy wallet"));return}let U=Se(s);if(!U){O(L,"sendTransaction","onError","embedded_wallet_not_found"),k(new Error("Must have a Privy wallet before signing"));return}Y(!0);let de=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,st=d.chainId?Number(d.chainId):de.chainId;M1(st);let yt=Object.assign({},d,{chainId:st}),Lr=async()=>{let lt=await Ce();if(!lt||!A){O(L,"sendTransaction","onError","embedded_wallet_not_found"),k(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await le.recoverEmbeddedWallet()){O(L,"sendTransaction","onError","unknown_connect_wallet_error"),k(new Error("Unable to connect to wallet"));return}let Kt=Nr(yt.chainId,F.chains,F.rpcConfig,{appId:e.appId}),yl=await Yn(U.address,yt,Kt);if(F.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:L1}=await Kn(yl,Kt),{hasSufficientFunds:O1}=await il(U.address,yl,L1,Kt);if(!O1)throw new Re(new Dt("Wallet has insufficient funds for this transaction.",tt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Ed=await nl(lt,U.address,A,yl,Kt);O(L,"sendTransaction","onSuccess",Ed),y(Ed)}catch(jt){O(L,"sendTransaction","onError","transaction_failure"),k(jt)}};if(F.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Lr();else{let lt={transactionRequest:yt,onSuccess:Kt=>{O(L,"sendTransaction","onSuccess",Kt),y(Kt)},onFailure:Kt=>{O(L,"sendTransaction","onError","transaction_failure"),k(Kt)},uiOptions:p||{},fundWalletConfig:m},jt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Kt=>{O(L,"sendTransaction","onError","unknown_connect_wallet_error"),k(Kt)}};ee({connectWallet:jt,sendTransaction:lt}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function wd(){return new Promise(async(d,p)=>{let m=await Ce();if(!m||!A)throw new Error("Must have valid access token to enroll in MFA");try{await A.verifyMfa({accessToken:m}),d()}catch(y){p(y)}})}let Lt=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw O(L,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw O(L,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)},Zo={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:hl,linkWallet:Ve,linkEmail:()=>{ve(),Lt("email"),ae.current="email",H.current="link",ne("LINK_EMAIL_SCREEN")},linkPhone:()=>{ve(),Lt("phone"),ae.current="sms",H.current="link",ne("LINK_PHONE_SCREEN")},linkGoogle:async()=>{ve(),Lt("google"),H.current="link",await le.initLoginWithOAuth("google")},linkTwitter:async()=>{ve(),Lt("twitter"),H.current="link",await le.initLoginWithOAuth("twitter")},linkDiscord:async()=>{ve(),Lt("discord"),H.current="link",await le.initLoginWithOAuth("discord")},linkGithub:async()=>{ve(),Lt("github"),H.current="link",await le.initLoginWithOAuth("github")},linkSpotify:async()=>{ve(),Lt("spotify"),H.current="link",await le.initLoginWithOAuth("spotify")},linkTiktok:async()=>{ve(),Lt("tiktok"),H.current="link",await le.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{ve(),Lt("linkedin"),H.current="link",await le.initLoginWithOAuth("linkedin")},linkApple:async()=>{ve(),Lt("apple"),H.current="link",await le.initLoginWithOAuth("apple")},linkPasskey:async()=>{ve(),Lt("passkey"),await le.initLinkWithPasskey(),ne("LINK_PASSKEY_SCREEN")},linkFarcaster:async()=>{ve(),Lt("farcaster"),await le.initLoginWithFarcaster(),H.current="link",ae.current="farcaster",ne("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(ve(),!s?.email)throw new T("User does not have an email linked to their account.");H.current="link",ae.current="email",ne("UPDATE_EMAIL_SCREEN")},login:async()=>{let d="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let p=await new Promise(m=>{at(y=>m.bind(y))});if(at(null),p){console.warn(d);return}}if(i){console.warn(d);return}H.current="login",ht("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{at(()=>d)}),at(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}ht("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&A)try{await A.clearMfa({userId:s.id})}catch{}c(null),l(!1),x(null),O(L,"logout","onSuccess"),H.current=null,ae.current=null,o(!1),j.del(ni)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new xe;let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===d?.address));return!d||!p?new xe:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new gd(new hr(new xe));let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===d?.address));return!d||!p?new gd(new hr(new xe)):new gd(new hr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new ro(new xe);let d=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===d?.address));return!d||!p?new ro(new xe):new ro(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(y=>fl(y.address)===fl(d)),m=s?.linkedAccounts.find(y=>y.type==="wallet"&&fl(y.address)===fl(d));if(!p||!await p.isConnected())z(d),Ve();else if(!p.linked)p.loginOrLink();else{let y=Object.assign({},s);y.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(y)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!i||!s)throw O(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return vd(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw O(L,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Se(s);if(!d||!A)throw O(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw O(L,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await wd()}catch(p){throw O(L,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{Y(!0);let y={onSuccess:U=>{O(L,"setWalletPassword","onSuccess",U),p(U)},onFailure:U=>{O(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(U)},callAuthOnSuccessOnClose:!1},k={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:U=>{O(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(U)}};ee({setWalletPassword:y,connectWallet:k}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(m,y)=>{if(!i||!s){O(L,"signMessage","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let k=Se(s);if(!k){O(L,"signMessage","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){O(L,"signMessage","onError","invalid_message"),y(new Error("Message must be a non-empty string"));return}Y(!0);let U=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let de=await Ce();if(!A||!de)throw new Error("Unable to connect to wallet");if(!await le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:k.address}});let{response:yt}=await A.rpc({accessToken:de,address:k.address,request:{method:"personal_sign",params:[d,k.address]}}),Lr=yt.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:k.address}}),Lr};if(F.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let de=await U();O(L,"signMessage","onSuccess",de),m(de)}catch(de){O(L,"signMessage","onError","unable_to_sign"),y(de??new Re("Unable to sign message"))}}else{let yt={method:"personal_sign",data:d,confirmAndSign:U,onSuccess:lt=>{O(L,"signMessage","onSuccess",lt),m(lt)},onFailure:lt=>{O(L,"signMessage","onError","unable_to_sign"),y(lt)},uiOptions:p||{}},Lr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:lt=>{O(L,"signMessage","onError","unknown_connect_wallet_error"),y(lt)}};ee({signMessage:yt,connectWallet:Lr}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,y)=>{if(!i||!s){O(L,"signTypedData","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let k=Se(s);if(!k){O(L,"signTypedData","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}Y(!0);let U=fa(d),de=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let st=await Ce();if(!A||!st)throw new Error("Unable to connect to wallet");if(!await le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:k.address}});let{response:Lr}=await A.rpc({accessToken:st,address:k.address,request:{method:"eth_signTypedData_v4",params:[k.address,U]}}),lt=Lr.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:k.address}}),lt};if(F.embeddedWallets.noPromptOnSignature||(F.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let st=await de();O(L,"signTypedData","onSuccess",st),m(st)}catch(st){O(L,"signTypedData","onError","unable_to_sign"),y(st??new Re("Unable to sign message"))}}else{let Lr={method:"eth_signTypedData_v4",data:U,confirmAndSign:de,onSuccess:jt=>{O(L,"signTypedData","onSuccess",jt),m(jt)},onFailure:jt=>{O(L,"signTypedData","onError","unable_to_sign"),y(jt)},uiOptions:p||{}},lt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:jt=>{O(L,"signMessage","onError","unknown_connect_wallet_error"),y(jt)}};ee({signMessage:Lr,connectWallet:lt}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let k=await(await Cd(d,p,m)).wait();return al(k)},exportWallet:()=>new Promise(async(d,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=Se(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}Y(!0);let y={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},k=await Ce();if(!k||!A){p(new Error("Must have valid access token to enroll in MFA"));return}if(!A){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await A.connect({accessToken:k,address:m.address}),await A.verifyMfa({accessToken:k})}catch(de){if(Do(de))await le.recoverEmbeddedWallet();else throw de}}catch(de){p(de);return}let U={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};ee({keyExport:U,connectWallet:y}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:wd,async init(d){let p;switch(d){case"sms":p=new ml("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(p),await p.init()},async submit(d,p){switch(d){case"totp":case"sms":ft.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((m,y)=>{De.current={resolve:m,reject:y}});break;default:throw ft.current?.reject(new T("Unsupported MFA method")),new T(`Unsupported MFA method: ${d}`)}},cancel(){ft.current?.reject(new T("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Ce();if(!p||!A)throw new Error("Must have valid access token to enroll in MFA");await A.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){le.closePrivyModal(),p();return}F.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."),ee({mfaEnrollmentFlow:{mfaMethods:F.mfa.methods,onSuccess:p,onFailure:m}}),ne("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Ce();if(!d||!A)throw new Error("Must have valid access token to enroll in MFA");let p=await A.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Ce();if(!p||!A)throw new Error("Must have valid access token to enroll in MFA");await A.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await Ce();if(!p||!A)throw new Error("Must have valid access token to enroll in MFA");await A.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await Ce();if(!p||!A)throw new Error("Must have valid access token to remove MFA");await A.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},requestFarcasterSigner:async()=>{let d=await Ce(),p=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let y=await A.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null});if(y.status==="approved"){let k=await t.getAuthenticatedUser();c(k||s||null)}ee({farcasterSigner:y}),ne("AWAITING_FARCASTER_SIGNER")},submitCast:async d=>{let p=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!m)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.submitCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:d,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:d})=>{let p=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!m)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.removeCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:d,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:d,castAuthorFid:p})=>{let m=await Ce(),y=s?.linkedAccounts.find(de=>de.type==="wallet"&&de.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!y)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.reactToCast({address:y.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:d,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:d,castAuthorFid:p})=>{let m=await Ce(),y=s?.linkedAccounts.find(de=>de.type==="wallet"&&de.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!y)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.reactToCast({address:y.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:d,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:d})=>{let p=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!m)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.submitLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:d},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:d})=>{let p=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!m)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 le.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.removeLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:d},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:E,loginWithCode(d){return le.loginWithCode(d)},initLoginWithEmail(d){return le.initLoginWithEmail(d)},initLoginWithSms(d){return le.initLoginWithSms(d)},otpState:D,fundWallet(d,p){return le.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return le.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return le.loginWithHeadlessOAuth(d)},isModalOpen:r};S1=Zo.signMessage,x1=Zo.signTypedData,k1=async(...d)=>{let p=await Cd(...d);return F.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let bd=!!e.config?.headless,le=(()=>({headless:bd,isNewUserThisSession:g,linkingHint:V,pendingTransaction:null,walletConnectionStatus:W,mipdStore:B,connectors:t.connectors?.walletConnectors??[],rpcConfig:F.rpcConfig,chains:F.chains,appId:e.appId,showFiatPrices:F.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>F.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(A)return A;let p=new Promise(k=>{ue(()=>U=>k(U))}),m=new Promise(k=>setTimeout(()=>k(null),d)),y=await Promise.race([p,m]);return ue(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;H.current==="login"?d.shouldCallAuthOnSuccess&&p?(O(L,"login","onComplete",s,g,!1,ae.current??null),e.onSuccess?.(s,g)):O(L,"login","onError","exited_auth_flow"):H.current==="link"&&ae.current&&(d.isSuccess&&p?O(L,"linkAccount","onSuccess",s,ae.current):O(L,"linkAccount","onError","exited_link_flow")),z(null),H.current=null,ae.current=null,b(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:ne,connectWallet:ti,initLoginWithWallet:async(d,p)=>{ae.current="siwe",Yr(d,p)},loginWithWallet:async()=>{if(!n)throw new Jr;if(!(t.authFlow instanceof _o))throw new T("Must initialize SIWE flow first.");let d,p;if(i)try{d=await t.link(),ae.current="siwe"}catch(m){throw O(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),ae.current="siwe"}catch(m){throw O(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||s||null),b(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new ii(d);t.startAuthFlow(p);try{ae.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw H.current==="login"?O(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):H.current==="link"&&O(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Jr;if(!(t.authFlow instanceof ii))throw new T("Must initialize Farcaster flow first.");let d,p;if(i)try{d=await t.link(),ae.current="farcaster"}catch(m){throw O(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:d,isNewUser:p}=await t.authenticate()),ae.current="farcaster"}catch(m){throw O(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d||null),b(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(ae.current=d,wl()){if(d==="google"&&ul(window.navigator.userAgent)){ht("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{ht("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}j.del(Po);let m=new fr({provider:d});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let y=await t.authFlow.getAuthorizationUrl();y&&y.url&&window.location.assign(y.url)},async loginWithOAuth(d){if(!(t.authFlow instanceof fr))throw new T("Must initialize OAuth flow before calling loginWithOAuth");let p=j.get(To),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:m??""}}),new T("Unexpected auth flow. This may be a phishing attempt.");let y,k;if(i)try{y=await t.link(),ae.current=d}catch(U){throw O(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}else try{({user:y,isNewUser:k}=await t.authenticate()),ae.current=d}catch(U){throw H.current==="login"?O(L,"login","onError",U.privyErrorCode||"unknown_auth_error"):H.current==="link"&&O(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}c(y),b(k||!1),l(!0)},async initLoginWithPasskey(d){let p=new ko(d);t.startAuthFlow(p),H.current="login";try{ae.current="passkey",await p.initAuthenticationFlow()}catch(m){throw O(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},async loginWithPasskey(){if(!n)throw new Jr;if(!(t.authFlow instanceof ko))throw new T("Must initialize Passkey flow first.");if(ae.current!=="passkey")throw new T("Must init login with Passkey flow first.");let d,p;try{ae.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(m){throw O(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(d),b(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new ko(d);t.startAuthFlow(p),H.current="link",ae.current="passkey";try{await p.initLinkFlow()}catch(m){throw O(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},async linkWithPasskey(){if(!n)throw new Jr;if(!(t.authFlow instanceof ko))throw new T("Must initialize Passkey flow first.");if(ae.current!=="passkey")throw new T("Must init login with Passkey flow first.");let d;try{ae.current="passkey",d=await t.link()}catch(p){throw O(L,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}c(d||s||null)},async initLoginWithHeadlessOAuth(d,p){if(wl()){if(d==="google"&&ul(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 m=new fr({provider:d,headless:!0});p&&m.addCaptchaToken(p);let y=await t.startAuthFlow(m).getAuthorizationUrl();y?.url&&window.location.assign(y.url)},async loginWithHeadlessOAuth(d){P(!0),t.startAuthFlow(new fr(d));let p=j.get(To),m=d.stateCode;if(p!==m)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:m??""}}),P(!1),new T("Unexpected auth flow. This may be a phishing attempt.");let y,k;if(i)try{y=await t.link(),ae.current=d.provider}catch(U){throw O(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}else try{({user:y,isNewUser:k}=await t.authenticate()),ae.current=d.provider}catch(U){throw H.current==="login"?O(L,"login","onError",U.privyErrorCode||"unknown_auth_error"):H.current==="link"&&O(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}return c(y),b(k||!1),l(!0),P(!1),y??void 0},initLoginWithEmail:async(d,p)=>{let m=new Qr(d,p);t.startAuthFlow(m);try{ae.current="email",await m.sendCodeEmail()}catch(y){throw H.current==="login"?O(L,"login","onError",y.privyErrorCode||"unknown_auth_error"):H.current==="link"&&O(L,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},initUpdateEmail:async(d,p,m)=>{let y=new na(d,p,m);t.startAuthFlow(y),await y.sendCodeEmail()},initLoginWithSms:async(d,p)=>{R({status:"sending-code"});let m=new Ao(d,p);t.startAuthFlow(m);try{ae.current="sms",await m.sendSmsCode(),R({status:"awaiting-code-input"})}catch(y){throw R({status:"error",error:y}),H.current==="login"?O(L,"login","onError",y.privyErrorCode||"unknown_auth_error"):H.current==="link"&&O(L,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(R({status:"submitting-code"}),!n){let k=new Jr;throw R({status:"error",error:k}),k}if(t.authFlow instanceof Qr)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Ao)t.authFlow.meta.smsCode=d.trim();else{let k=new T("Must initialize a passwordless code flow first");throw R({status:"error",error:k}),k}let p=await Ce(),m,y;if(p&&t.sessionHasActiveToken())try{m=await t.link()}catch(k){throw R({status:"error",error:k}),O(L,"linkAccount","onError",k.privyErrorCode||"failed_to_link_account"),k}else try{({user:m,isNewUser:y}=await t.authenticate())}catch(k){throw R({status:"error",error:k}),O(L,"login","onError",k.privyErrorCode||"unknown_auth_error"),k}c(m||s||null),b(y||!1),l(!0),R({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:A,createAnalyticsEvent:({eventName:d,payload:p,timestamp:m})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:m}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let m=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy"),y=await Ce();if(!y||!A||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Y(!0);try{await A.connect({accessToken:y,address:m.address}),d(!0)}catch(k){Do(k)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:m.address}}),(await A.recover({address:m.address,accessToken:y})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:m.address}}),d(!0)):Do(k)?(ee({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)}}),ne("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(k)}}),getFiatOnRampConfig:Yo,setReadyToTrue:d=>{a(!0),cr?.(d)},updateWallets:()=>Wt(),fundWallet:async(d,p)=>{let{signedUrl:m,externalTransactionId:y}=await Yo(d,p);ee({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:y}}),ne("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await Ce(),m=s?.linkedAccounts.find(k=>k.type==="wallet"&&k.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!m)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 y=await t.requestFarcasterSignerStatus(d);if(y.status==="approved"){let k=await t.getAuthenticatedUser();c(k||s||null)}return y}}))();_1=le.recoverEmbeddedWallet;let W1=d7(()=>({wallets:u,ready:Mt}),[u,Mt]);return Mr(me.Provider,{value:Zo,children:Mr(Hl.Provider,{value:L,children:Mr(id.Provider,{value:W1,children:P1(Tu,{...F,children:[e.children,P1(Bl.Provider,{value:le,children:[!bd&&F.captchaEnabled&&n&&!i&&Mr(Ul,{delayedExecution:!1}),Mr(y1,{theme:{...F.appearance.palette||{}}}),Mr(gu,{data:Ae,setModalData:ee,setInitialScreen:x,initialScreen:v,authenticated:i,open:r,children:Mr(w1,{open:r})}),Q&&se?Mr(T1,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:ft,mfaSubmitPromise:De,onLoad:oe,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as h7}from"react";function y7(e){let{login:t}=h7(me);return _e("login",e),{login:t}}import{useContext as g7}from"react";function v7(e){let{logout:t}=g7(me);return _e("logout",e),{logout:t}}import{useCallback as A1,useEffect as C7}from"react";function w7(){let e=ye(),t=Va(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=A1(async c=>{if(e.enabled&&e.status!=="success")throw new Qt(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=A1(async()=>{let c=ai();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(c)}catch(u){throw u}finally{si()}},[o]);return C7(()=>{let c=ai();a&&t&&c.inProgress&&c.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as R1}from"react";var b7=()=>{let e=ye(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=R1(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=R1(async({code:a})=>{if(e.enabled&&e.status==="error")throw new Qt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as I1}from"react";var E7=()=>{let e=ye(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=G(),n=I1(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),a=I1(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Qt(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:n,loginWithCode:a,state:o}};import{useContext as T7}from"react";function P7(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:h,linkFarcaster:f}=T7(me);return _e("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:h,linkFarcaster:f}}import{useContext as S7}from"react";function x7(e){let{connectWallet:t}=S7(me);return _e("connectWallet",e),{connectWallet:t}}import{useContext as k7}from"react";function _7(e){let{createWallet:t}=k7(me);return _e("createWallet",e),{createWallet:t}}var A7=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as R7}from"react";function I7(e){let{sendTransaction:t}=R7(me);return _e("sendTransaction",e),{sendTransaction:t}}import{useContext as M7}from"react";function W7(e){let{setWalletPassword:t}=M7(me);return _e("setWalletPassword",e),{setWalletPassword:t}}import{useContext as L7}from"react";function O7(e){let{signMessage:t}=L7(me);return _e("signMessage",e),{signMessage:t}}import{useContext as N7}from"react";function D7(e){let{signTypedData:t}=N7(me);return _e("signTypedData",e),{signTypedData:t}}import{useContext as F7}from"react";var U7=()=>{let{isModalOpen:e}=F7(me);return{isOpen:e}};import{useContext as B7}from"react";function H7(e){let{getAccessToken:t}=B7(me);return _e("accessToken",e),{getAccessToken:t}}function G7(){let{submitCast:e,removeCast:t,likeCast:r,recastCast:o,followUser:n,unfollowUser:a,requestFarcasterSigner:i}=G();return{followUser:n,unfollowUser:a,submitCast:e,removeCast:t,likeCast:r,recastCast:o,requestFarcasterSigner:i}}function V7(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{hr as AsExternalProvider,Ul as Captcha,ui as ConnectorManager,mi as PrivyClient,m7 as PrivyProvider,xe as PrivyProxyProvider,di as SUPPORTED_CHAINS,Pl as VERSION,vt as WalletConnector,V7 as addRpcUrlOverrideToChain,pc as errorIndicatesMaxMfaRetries,_n as errorIndicatesMfaTimeout,An as errorIndicatesMfaVerificationFailed,Ce as getAccessToken,x7 as useConnectWallet,_7 as useCreateWallet,G7 as useExperimentalFarcasterSigner,A7 as useFundWallet,P7 as useLinkAccount,y7 as useLogin,b7 as useLoginWithEmail,w7 as useLoginWithOAuth,E7 as useLoginWithSms,v7 as useLogout,Vn as useMfa,Hi as useMfaEnrollment,U7 as useModalStatus,G as usePrivy,Gl as useRegisterMfaListener,I7 as useSendTransaction,W7 as useSetWalletPassword,O7 as useSignMessage,D7 as useSignTypedData,H7 as useToken,Ki as useWallets};
|