@privy-io/react-auth 1.60.1 → 1.60.2-beta-20240406003256
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 +222 -208
- package/dist/index.js +215 -201
- 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 Tp=(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 Pp=(e,t,r)=>(gl(e,t,"access private method"),r);import{getAddress as fl}from"@ethersproject/address";import{Web3Provider as gp}from"@ethersproject/providers";import{createStore as o7}from"mipd";import{useCallback as n7,useEffect as Kr,useMemo as i7,useRef as Qn,useState as Oe}from"react";import{FetchError as L1}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}},x=class extends Ie{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Xi=class extends x{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 L1))return Qe(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)},Qe=e=>e instanceof Ie?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var Yo=class extends x{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},St=class extends x{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ea=class extends x{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var ur=class extends x{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",Sp="/api/v1/sessions/fork",oa="/api/v1/sessions/fork/recover",xp="/api/v1/siwe/init",kp="/api/v1/siwe/authenticate",_p="/api/v1/siwe/link",Ap="/api/v1/siwe/unlink",Rp="/api/v1/farcaster/init",Ip="/api/v1/farcaster/authenticate",Mp="/api/v1/farcaster/link",Wp="/api/v1/farcaster/status",Lp="/api/v1/farcaster/unlink",Op="/api/v1/passwordless/init",Np="/api/v1/passwordless/authenticate",Dp="/api/v1/passwordless/link",Fp="/api/v1/passwordless/unlink",Up="/api/v1/passwordless/update",Bp="/api/v1/passwordless_sms/init",Hp="/api/v1/passwordless_sms/link",Gp="/api/v1/passwordless_sms/unlink",Vp="/api/v1/passwordless_sms/authenticate",zp="/api/v1/oauth/init",qp="/api/v1/oauth/authenticate",$p="/api/v1/oauth/link",jp="/api/v1/oauth/unlink",Kp="/api/v1/passkeys/link/init",Yp="/api/v1/passkeys/authenticate/init",Zp="/api/v1/passkeys/link",Jp="/api/v1/passkeys/authenticate",Qp="/api/v1/passkeys/unlink";var Xp="/api/v1/mfa/passwordless_sms/init",ed="/api/v1/mfa/passwordless_sms/enroll";var td="/api/v1/users/me/accept_terms",rd="/api/v1/analytics_events",od="/api/v1/plugins/moonpay_on_ramp/sign",nd="/api/v1/custom_jwt_account/authenticate";var Zo=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");try{let t=await this.api.post(nd,{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 Jr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Np,{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 x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Dp,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw pe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{return await this.api.post(Op,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw pe(o)}}},na=class extends Jr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new x("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Up,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw pe(r)}}};import{isMobile as U1,isIOS as B1}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 O1(){return typeof window<"u"&&window.localStorage?new ia:new Cl}var j=O1();import{StaticJsonRpcProvider as Xo}from"@ethersproject/providers";function id(){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},Qr=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ad=()=>{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 sd="1.60.1";var El="4df5e2316331463a9130964bd6078dfa",Tl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",ld="34357d3c125c2bcf2ce2bc3309d98715",sa="https://auth.privy.io",cd=2e4,Me=1400,pd=2500,Pl=sd;var bo="privy:token",Sl="privy-token",la="privy:refresh_token",xl="privy-refresh-token",ca="privy-session",ri="privy:session_transfer_token",D1="privy:wallet",oi="privy:caid",Eo="privy:state_code",Jo="privy:code_verifier",To="privy:headless_oauth",pa=e=>`${D1}:${e}`,kl="privy:connectors",_l="privy:connections";var Po=12e4,Wr=1,Al="0x1",Qo=3e4,dd="https://api.moonpay.com/v1",ud="https://api.moonpay.com/v1",md="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",fd="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",hd="0x420000000000000000000000000000000000000F",yd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var gd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},da=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,}))$/),vd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Xr=(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 Cd(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 wd=(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 bd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),So=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Ed(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 id()){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 en(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},Td=(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},Lr=(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 Xo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Xo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Xo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Xo(a.rpcUrls.infura.http[0]+"/"+El):a.rpcUrls.blast?.http[0]?i=new Xo(a.rpcUrls.blast.http[0]+"/"+Tl):i=new Xo(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 F1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Pd(e,t){let r=F1(t);if(r.deepLink)return Ad(r.deepLink,e);if(r.universalLink)return Rd(r.universalLink,e);throw new x(`Unsupported wallet ${t.id}`)}var Sd="WALLETCONNECT_DEEPLINK_CHOICE";function xd(){try{localStorage.removeItem(Sd)}catch{}}function kd({href:e,name:t}){try{localStorage.setItem(Sd,JSON.stringify({href:e,name:t}))}catch{}}function _d(e){return e.startsWith("http://")||e.startsWith("https://")}function Ad(e,t){if(_d(e))return Rd(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 Rd(e,t){if(!_d(e))return Ad(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 lt=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 ni=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new lt(this._startChannelOnce.bind(this)),this.pollForReady=new lt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");try{let t=await this.api.post(Ip,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new x("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 x("Auth flow has no API instance");try{return await this.api.post(Mp,{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 x("Auth flow has no API instance");let t=await this.api.post(Rp,{token:this.captchaToken});U1&&!B1&&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 x("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");let t=await this.api.get(Wp,{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 Wd}from"jose";async function Id(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Md(e){return crypto.getRandomValues(new Uint8Array(e))}function va(){return!!j.get(To)}var H1="S256",G1="S256",mr=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 x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=j.get(Jo);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(qp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Jo),this.meta.headless&&j.del(To),{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 x(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new x("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new x("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=j.get(Jo);if(!t)throw new x("Authentication error.");try{let r=await this.api.post($p,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Jo),r}catch(r){throw pe(r)}}createCodeVerifier(){return Wd.encode(Md(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=H1){if(r==G1){let o=await Id(t);return Wd.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();j.put(Jo,t);let r=this.createStateCode();j.put(Eo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&j.put(To,!0);try{return await this.api.post(zp,{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 Ld(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 ii(){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 ai(){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(Eo),window.history.replaceState({},"",e)}var si=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new x("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new x("WebAuthn is not supported in this browser");try{let r=await this.api.post(Yp,{token:this.meta.captchaToken}),o=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(r.options)),n=await this.api.post(Jp,{relying_party:r.relying_party,challenge:r.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(o)});return{user:n.user,token:n.token,refresh_token:n.refresh_token,is_new_user:n.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new x("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 x("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new x("WebAuthn is not supported in this browser");try{let r=await this.api.post(Kp,{token:this.meta.captchaToken}),o=r.options,n=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(o));return await this.api.post(Zp,{relying_party:r.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(r){throw r.name==="NotAllowedError"?new x("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):pe(r)}}_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 xo=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 Tp=(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 Pp=(e,t,r)=>(gl(e,t,"access private method"),r);import{getAddress as fl}from"@ethersproject/address";import{Web3Provider as gp}from"@ethersproject/providers";import{createStore as a7}from"mipd";import{useCallback as s7,useEffect as Kr,useMemo as l7,useRef as Qn,useState as Oe}from"react";import{FetchError as O1}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}},x=class extends Ie{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Xi=class extends x{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 O1))return Qe(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)},Qe=e=>e instanceof Ie?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var Yo=class extends x{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},St=class extends x{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ea=class extends x{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var mr=class extends x{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",Sp="/api/v1/sessions/fork",oa="/api/v1/sessions/fork/recover",xp="/api/v1/siwe/init",kp="/api/v1/siwe/authenticate",_p="/api/v1/siwe/link",Ap="/api/v1/siwe/unlink",Rp="/api/v1/farcaster/init",Ip="/api/v1/farcaster/authenticate",Mp="/api/v1/farcaster/link",Wp="/api/v1/farcaster/status",Lp="/api/v1/farcaster/unlink",Op="/api/v1/passwordless/init",Np="/api/v1/passwordless/authenticate",Dp="/api/v1/passwordless/link",Fp="/api/v1/passwordless/unlink",Up="/api/v1/passwordless/update",Bp="/api/v1/passwordless_sms/init",Hp="/api/v1/passwordless_sms/link",Gp="/api/v1/passwordless_sms/unlink",Vp="/api/v1/passwordless_sms/authenticate",zp="/api/v1/oauth/init",qp="/api/v1/oauth/authenticate",$p="/api/v1/oauth/link",jp="/api/v1/oauth/unlink",Kp="/api/v1/passkeys/link/init",Yp="/api/v1/passkeys/authenticate/init",Zp="/api/v1/passkeys/link",Jp="/api/v1/passkeys/authenticate",Qp="/api/v1/passkeys/unlink";var Xp="/api/v1/mfa/passwordless_sms/init",ed="/api/v1/mfa/passwordless_sms/enroll";var td="/api/v1/users/me/accept_terms",rd="/api/v1/analytics_events",od="/api/v1/plugins/moonpay_on_ramp/sign",nd="/api/v1/custom_jwt_account/authenticate";var Zo=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");try{let t=await this.api.post(nd,{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 Jr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Np,{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 x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Dp,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw pe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{return await this.api.post(Op,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw pe(o)}}},na=class extends Jr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new x("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Up,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw pe(r)}}};import{isMobile as B1,isIOS as H1}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 N1(){return typeof window<"u"&&window.localStorage?new ia:new Cl}var j=N1();import{StaticJsonRpcProvider as Xo}from"@ethersproject/providers";function id(){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},Qr=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ad=()=>{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 sd="1.60.2-beta-20240406003256";var El="4df5e2316331463a9130964bd6078dfa",Tl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",ld="34357d3c125c2bcf2ce2bc3309d98715",sa="https://auth.privy.io",cd=2e4,Me=1400,pd=2500,Pl=sd;var bo="privy:token",Sl="privy-token",la="privy:refresh_token",xl="privy-refresh-token",ca="privy-session",ri="privy:session_transfer_token",F1="privy:wallet",oi="privy:caid",Eo="privy:state_code",Jo="privy:code_verifier",To="privy:headless_oauth",pa=e=>`${F1}:${e}`,kl="privy:connectors",_l="privy:connections";var Po=12e4,Lr=1,Al="0x1",Qo=3e4,dd="https://api.moonpay.com/v1",ud="https://api.moonpay.com/v1",md="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",fd="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",hd="0x420000000000000000000000000000000000000F",yd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var gd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},da=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,}))$/),vd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Xr=(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 Cd(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 wd=(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 bd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),So=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Ed(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 id()){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 en(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},Td=(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 Xo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Xo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Xo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Xo(a.rpcUrls.infura.http[0]+"/"+El):a.rpcUrls.blast?.http[0]?i=new Xo(a.rpcUrls.blast.http[0]+"/"+Tl):i=new Xo(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 U1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Pd(e,t){let r=U1(t);if(r.deepLink)return Ad(r.deepLink,e);if(r.universalLink)return Rd(r.universalLink,e);throw new x(`Unsupported wallet ${t.id}`)}var Sd="WALLETCONNECT_DEEPLINK_CHOICE";function xd(){try{localStorage.removeItem(Sd)}catch{}}function kd({href:e,name:t}){try{localStorage.setItem(Sd,JSON.stringify({href:e,name:t}))}catch{}}function _d(e){return e.startsWith("http://")||e.startsWith("https://")}function Ad(e,t){if(_d(e))return Rd(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 Rd(e,t){if(!_d(e))return Ad(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 lt=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 ni=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new lt(this._startChannelOnce.bind(this)),this.pollForReady=new lt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");try{let t=await this.api.post(Ip,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new x("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 x("Auth flow has no API instance");try{return await this.api.post(Mp,{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 x("Auth flow has no API instance");let t=await this.api.post(Rp,{token:this.captchaToken});B1&&!H1&&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 x("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");let t=await this.api.get(Wp,{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 Wd}from"jose";async function Id(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Md(e){return crypto.getRandomValues(new Uint8Array(e))}function va(){return!!j.get(To)}var G1="S256",V1="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 x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=j.get(Jo);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(qp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Jo),this.meta.headless&&j.del(To),{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 x(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new x("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new x("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=j.get(Jo);if(!t)throw new x("Authentication error.");try{let r=await this.api.post($p,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Jo),r}catch(r){throw pe(r)}}createCodeVerifier(){return Wd.encode(Md(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=G1){if(r==V1){let o=await Id(t);return Wd.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();j.put(Jo,t);let r=this.createStateCode();j.put(Eo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&j.put(To,!0);try{return await this.api.post(zp,{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 Ld(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 ii(){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 ai(){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(Eo),window.history.replaceState({},"",e)}var si=class{constructor(t){this.meta={captchaToken:t}}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new x("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new x("WebAuthn is not supported in this browser");try{let r=await this.api.post(Yp,{token:this.meta.captchaToken}),o=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(r.options)),n=await this.api.post(Jp,{relying_party:r.relying_party,challenge:r.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(o)});return{user:n.user,token:n.token,refresh_token:n.refresh_token,is_new_user:n.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new x("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 x("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new x("WebAuthn is not supported in this browser");try{let r=await this.api.post(Kp,{token:this.meta.captchaToken}),o=r.options,n=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(o));return await this.api.post(Zp,{relying_party:r.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(n)})}catch(r){throw r.name==="NotAllowedError"?new x("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):pe(r)}}_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 xo=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 lt(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 x("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(kp,{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 x("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(_p,{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 x("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new x("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 x("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(xp,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new x("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 ko=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Vp,{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 x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Hp,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw pe(t)}}async sendSmsCode(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new x("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Bp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw pe(o)}}};import{v4 as Mg}from"uuid";function Xe(e){return new Date(e*1e3)}function V1(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:Xe(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:Xe(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:Xe(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:Xe(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:Xe(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:Xe(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:Xe(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:Xe(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:Xe(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:Xe(r.verified_at)};t.push(g);break;case"apple_oauth":let w={subject:r.subject,email:r.email,type:r.type,verifiedAt:Xe(r.verified_at)};t.push(w);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:Xe(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:Xe(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;case"passkey":let k={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:Xe(r.verified_at)};t.push(k);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Nt(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,z1=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Dt=(e,t)=>t==="all-users"&&!Se(e)||t==="users-without-wallets"&&!z1(e)?.length;function gt(e){if(!e)return null;let t=V1(e.linked_accounts),r=Nt(t,"wallet"),o=Nt(t,"email"),n=Nt(t,"phone"),a=Nt(t,"google_oauth"),i=Nt(t,"twitter_oauth"),l=Nt(t,"discord_oauth"),s=Nt(t,"github_oauth"),c=Nt(t,"spotify_oauth"),u=Nt(t,"tiktok_oauth"),h=Nt(t,"linkedin_oauth"),f=Nt(t,"apple_oauth"),g=Nt(t,"farcaster"),w=e.mfa_methods.map(({type:k,verified_at:E})=>({type:k,verifiedAt:Xe(E)}));return{id:e.id,createdAt:Xe(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:w.map(k=>k.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as gu}from"@ethersproject/address";import _g from"eventemitter3";import eg from"@coinbase/wallet-sdk";import{jsx as Od,jsxs as q1}from"react/jsx-runtime";var Ca=({style:e,...t})=>q1("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:[Od("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Od("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 hr}from"@ethersproject/address";import{Web3Provider as Hd}from"@ethersproject/providers";import{default as Q1}from"eventemitter3";import J1 from"eventemitter3";var $1=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Nd=e=>$1.includes(e);import{ErrorCode as j1}from"@ethersproject/logger";var tn=class extends J{constructor(){super("Wallet timeout");this.type="wallet_error"}},rn=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===j1.ACTION_REJECTED&&(t.details=et.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Re(e):new J("Unknown connector error",e)},Ft=class extends Ie{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Re=class extends Ft{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(et).find(a=>a.eipCode===o.code);this.details=n||et.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=et.E32002_CONNECTION_ALREADY_PENDING:this.details=et.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=et.E32002_WALLET_LOCKED))}},K1={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}},Y1={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}},Z1={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}},et={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Z1,...Y1},Or={...K1,...et};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 tn,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||Po,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)})}},eo=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},wa=class extends J1{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=Lr(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=on(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new eo(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await we()||!this.address)throw new eo("Disconnected",4900);return(await Ud(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new eo(`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 eo(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Lr(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 Dd(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 Fd(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:So(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 So(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(Nd(r.method)){let o=await we();if(await Bd(),!o||!this.address)throw new eo("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 eo("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await we();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}}},fr=class extends xe{constructor(r){super(r,r.rpcTimeoutDuration)}},to=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 X1=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},vt=class extends Q1{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=en(r),this.walletClientType==="privy"&&j.put(pa(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=on(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>hr(i.address)===hr(r));return{address:hr(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new J("Wallet is not currently connected.");let l=this.wallets.find(f=>hr(f.address)===hr(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===en(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(X1(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 Hd(new fr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new to(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=hr(n),i=[],l;if(this.walletClientType==="privy"){let c=j.get(pa(a));this.chains.find(u=>u.id===Number(c))||(j.del(pa(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=en(l);if(!i.find(c=>hr(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(hr(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=>hr(n)===hr(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 Hd(new fr(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 nn={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 tg=(e,t)=>{let o=ma(1,[nn],{},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 eg({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(tg(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 Gd}from"react/jsx-runtime";var Pa=({...e})=>Gd("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Gd("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:[So(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 Vd}from"react/jsx-runtime";var an=({style:e,...t})=>Vd("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Vd("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 rg}from"react/jsx-runtime";var sn=({style:e,...t})=>rg("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 zd,jsxs as og}from"react/jsx-runtime";var yr=({style:e,...t})=>og("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:[zd("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),zd("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 cn=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)}}},ln,pn=class extends vt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Qi(this,ln,void 0);this.proxyProvider=new xe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?vl(this,ln,{name:"MetaMask",icon:sn,id:"io.metamask"}):i==="phantom"&&vl(this,ln,{name:"Phantom",icon:yr,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 Tp(this,ln)??{name:"Browser Extension",icon:an,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)}}};ln=new WeakMap;import{getAddress as X8}from"@ethersproject/address";import{Web3Provider as t9}from"@ethersproject/providers";import{isMobile as ng}from"react-device-detect";var xa=class extends cn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{ng||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,Po);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:yr,id:"phantom"}}};import{EthereumProvider as Pg,OPTIONAL_EVENTS as Sg,OPTIONAL_METHODS as xg}from"@walletconnect/ethereum-provider";import{isMobile as kg}from"react-device-detect";import{createContext as yg,useContext as gg,useEffect as Ol,useRef as vg,useState as Cg}from"react";import{jsx as ig}from"react/jsx-runtime";function Aa({src:e,...t}){return ig("img",{src:e,...t,style:{display:"none"}})}import{useContext as uu,useEffect as du,useMemo as ug,useState as mg}from"react";import{createContext as fg}from"react";var Ut={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:ld,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var qd=({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 ag=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),$d=e=>ag.has(e),jd=(e,t,r)=>r.indexOf(e)===t,Kd=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter($d).filter(jd):e?e.filter($d).filter(jd):Ut.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 Yd={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 Zd={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 Jd={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 Qd={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 Xd={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 pi=[Ra,Ia,Ma,ru,su,nn,Na,Da,Fa,li,ci,Qd,Xd,eu,tu,Wa,La,Oa,Jd,nu,iu,Yd,Zd,Ua,Ha,Ba,ou,au],EE=new Set(pi.map(e=>e.id));import _o from"tinycolor2";var lu="#FFFFFF",sg="#000000",lg=lu,cg="#1E1E1D";function pg(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 Nr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return _o({...e.toHsl(),l:r})}function cu({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=lu,blackHex:i=sg}){let l;switch(e){case"light":l=lg;break;case"dark":l=cg;break;default:l=e;break}let s=_o(l),c=_o(t),u=_o(r),h=_o(o),f=_o(n),g=pg(s.getLuminance()),w=Nr(s,g==="light"?-.04:.11),v=Nr(s,g==="light"?-.88:.87),k=Nr(s,g==="light"?-.77:.75),E=Nr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),T=Nr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),W=Nr(c,.15),I=Nr(c,-.06),D=Nr(f,.3),R=_o(c.getLuminance()>.5?i:a),B=Nr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:w.toHslString(),foreground:v.toHslString(),foreground2:k.toHslString(),foreground3:E.toHslString(),foreground4:T.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,w,v,k,E,T;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"),w=a?.includes("spotify"),g=a?.includes("tiktok"),k=a?.includes("github"),v=a?.includes("linkedin"),E=a?.includes("apple"),T=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,c=e.walletAuth,u=e.googleOAuth,h=e.twitterOAuth,f=e.discordOAuth,k=e.githubOAuth,w=e.spotifyOAuth,g=e.tiktokOAuth,v=e.linkedinOAuth,E=e.appleOAuth,T=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,k,w,g,v,E,T].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=Kd({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),$=qd({input:t?.loginMethodsAndOrder}),V=t?.intl?.defaultCountry??"US",{chains:z,defaultChain:A}=dg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),ne=!!t?.defaultChain,F=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ae,Q=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?F?ae=t?.embeddedWallets?.noPromptOnSignature??!0:ae=t?.embeddedWallets?.noPromptOnSignature??Q:ae=Q,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ae!==!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??Ut.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ut.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:k,spotify:w,tiktok:g,linkedin:v,apple:E,farcaster:T},loginMethodsAndOrder:$,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ut.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ut.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ut.rpcConfig.rpcTimeouts},chains:z,defaultChain:A,intl:{defaultCountry:V},shouldEnforceDefaultChainOnConnect:ne,captchaEnabled:e.captchaEnabled??Ut.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:ae},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??Ut.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Ut._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Ut._render.inParentNodeId}}}function pu(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 dg({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:pi.find(u=>u.id===s.id)??s)}else n=pi.concat(e??[]);let a=t?n[0]:nn,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}}import{jsx as hg}from"react/jsx-runtime";var mu={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(mu,void 0,!1),Ll=fg({appConfig:Wl,isServerConfigLoaded:!1}),fu=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=mg(null),i=ug(()=>Ml(n??mu,o,!!n),[n,o]);return du(()=>{let l=pu(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),du(()=>{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)}})()},[]),hg(Ll.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Ga=()=>{let{appConfig:e}=uu(Ll);return e},Va=()=>{let{isServerConfigLoaded:e}=uu(Ll);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as bg,jsxs as Eg}from"react/jsx-runtime";var hu=yg({ready:!1,app:Wl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),wg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],yu=e=>{let t=Ga(),r=e.authenticated,[o,n]=Cg(e.initialScreen);Ol(()=>{!r&&!wg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=vg(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 Eg(hu.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&bg(Aa,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>gg(hu);import{jsx as dn,jsxs as Tg}from"react/jsx-runtime";var di=({style:e,...t})=>{let{app:r}=_();return Tg("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:[dn("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),dn("g",{clipPath:"url(#clip0_1765_9946)",children:dn("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"})}),dn("defs",{children:dn("clipPath",{id:"clip0_1765_9946",children:dn("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var gr=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:sn,id:"io.metamask"}:{name:bd(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||di,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,xd(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new rn)};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=on(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 Pg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Sg,optionalMethods:xg,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),kg&&this.walletEntry){let{redirect:l,href:s}=Pd(i,this.walletEntry);kd({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");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===gu(t)).length:!1},on=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Po:Po,ui=class extends _g{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=Ed(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"),!Qr()&&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 gr&&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 cn(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 gr(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=gu(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 Ag}from"ofetch";var Rg=[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=Ag.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=!Rg.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new 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 Ao from"js-cookie";function vu(e){return e instanceof Jr?"email":e instanceof ko?"sms":e instanceof xo?"siwe":e instanceof Zo?"custom_auth":e instanceof mr?e.meta.provider:null}import*as Cu from"jose";var vr=class{static parse(t){try{return new vr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Cu.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 Ig=30,qa=class{constructor(){this.authenticateOnce=new lt(async t=>this._authenticate(t)),this.linkOnce=new lt(async t=>this._link(t)),this.refreshOnce=new lt(this._refresh.bind(this)),this.destroyOnce=new lt(this._destroy.bind(this)),this.forkSessionOnce=new lt(this._forkSession.bind(this))}get token(){try{let t=j.get(bo);return typeof t=="string"?new vr(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(ri);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Ao.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=vr.parse(this.token);return t!==null&&!t.isExpired(Ig)}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=vu(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"),Qe(r)}}async _link(t){try{let r=await t.link();return gt(r)}catch(r){throw console.warn("Error linking account"),Qe(r)}}async _refresh(){if(!this.api)throw new x("Session has no API instance");if(!this.client)throw new x("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 Qe(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 x("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Sp,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw Qe(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=j.get(bo);if(j.put(bo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=vr.parse(t)?.expiration;Ao.set(Sl,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else j.del(bo),Ao.remove(Sl)}storeRefreshToken(t){typeof t=="string"?(j.put(la,t),this.client?.useServerCookies||(Ao.set(ca,"t",{sameSite:"Strict",secure:!0,expires:30}),Ao.set(xl,t,{sameSite:"Strict",secure:!0,expires:30}))):(j.del(la),Ao.remove(xl),Ao.remove(ca))}clearForkedToken(){j.del(ri)}};var Dl,$a,wu,mi=class{constructor(t){Qi(this,$a);this.apiUrl=t.apiUrl||sa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||cd,this.appId=t.appId,this.clientAnalyticsId=Pp(this,$a,wu).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 x("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new x("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(Fp,{address:t});return gt(r)}catch(r){throw Qe(r)}}async acceptTerms(){try{let t=await this.api.post(td,{});return gt(t)}catch(t){throw Qe(t)}}async unlinkPhone(t){try{let r=await this.api.post(Gp,{phoneNumber:t});return gt(r)}catch(r){throw Qe(r)}}async unlinkWallet(t){try{let r=await this.api.post(Ap,{address:t});return gt(r)}catch(r){throw Qe(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(jp,{provider:t,subject:r});return gt(o)}catch(o){throw Qe(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Lp,{fid:t});return gt(r)}catch(r){throw Qe(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Qp,{credential_id:t});return gt(r)}catch(r){throw Qe(r)}}async createAnalyticsEvent(t,r,o){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(rd,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(od,t)}catch(r){throw Qe(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?vr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,passkeyAuth:t.passkey_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw Qe(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,wu=function(){if(typeof window>"u")return null;try{let r=j.get(oi);if(typeof r=="string"&&r.length>0)return r}catch{}let t=Mg();try{return j.put(oi,t),t}catch{return t}};import{Turnstile as Fg}from"@marsidev/react-turnstile";import{useEffect as Ug,useMemo as Bg}from"react";import{useMemo as Wg,useRef as Lg,useContext as Og,useState as Fl,createContext as Ng}from"react";import{jsx as Dg}from"react/jsx-runtime";var bu=Ng({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:b,setError:b,setExecuting:b,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:b,reset:b,execute:b}),Qt=class extends Ie{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Eu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Lg(null),[a,i]=Fl(),[l,s]=Fl(),[c,u]=Fl(!1),h=Wg(()=>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 Dg(bu.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 Cd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Qt("Captcha failed",null,"captcha_timeout")}}},children:e})},ge=()=>Og(bu);import{jsx as Tu}from"react/jsx-runtime";var Ul=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=ge(),[,s]=Bg(()=>r?.split("t:")||[],[r]);if(Ug(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return Tu("div",{className:"hidden h-0 w-0",children:Tu(Fg,{...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 G6,useEffect as y1,useRef as V6,useState as z6}from"react";import q6 from"react-dom";import{createContext as Hg,useContext as Gg}from"react";var Bl=Hg({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:b,initializeWalletProxy:b,getAuthMeta:b,getAuthFlow:b,closePrivyModal:b,openPrivyModal:b,connectWallet:b,initLoginWithWallet:b,loginWithWallet:b,initLoginWithFarcaster:b,loginWithFarcaster:b,loginWithCode:b,initLoginWithEmail:b,initLoginWithSms:b,initUpdateEmail:b,resendEmailCode:b,resendSmsCode:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,initLoginWithOAuth:b,loginWithOAuth:b,loginWithPasskey:b,linkWithPasskey:b,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),M=()=>Gg(Bl);import{createContext as Vg,useContext as zg}from"react";var fe=Vg({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:b,login:b,connectOrCreateWallet:b,linkEmail:b,linkPhone:b,linkFarcaster:b,linkWallet:b,linkGoogle:b,linkTwitter:b,linkDiscord:b,linkGithub:b,linkSpotify:b,linkTiktok:b,linkLinkedIn:b,linkApple:b,linkPasskey:b,updateEmail:b,logout:b,getAccessToken:b,getEthereumProvider:b,getEthersProvider:b,getWeb3jsProvider:b,unlinkEmail:b,unlinkPhone:b,unlinkWallet:b,unlinkGoogle:b,unlinkTwitter:b,unlinkDiscord:b,unlinkGithub:b,unlinkSpotify:b,unlinkTiktok:b,unlinkLinkedIn:b,unlinkApple:b,unlinkFarcaster:b,unlinkPasskey:b,setActiveWallet:b,forkSession:b,createWallet:b,signMessage:b,signTypedData:b,enrollInMfa:b,initEnrollmentWithSms:b,initEnrollmentWithTotp:b,promptMfa:b,init:b,submitEnrollmentWithSms:b,submitEnrollmentWithTotp:b,unenroll:b,submit:b,cancel:b,sendTransaction:b,exportWallet:b,setWalletPassword:b,requestFarcasterSigner:b,submitCast:b,removeCast:b,likeCast:b,recastCast:b,followUser:b,unfollowUser:b,initLoginWithEmail:b,initLoginWithSms:b,otpState:{status:"initial"},loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>zg(fe);import{useEffect as qg,useState as $g}from"react";var Pu=e=>{let[t,r]=$g("auto");return qg(()=>{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 jg,useContext as Kg,useEffect as Yg}from"react";var Su={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=jg(void 0),xu=()=>Kg(Hl);function _e(e,t){if(!t)return;let o=xu().current[e];return Yg(()=>{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 N(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function ku(){let e=xu();return(t,r,...o)=>N(e,t,r,...o)}function Gl(e){_e("configureMfa",e)}import Ou from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import f2 from"@heroicons/react/24/solid/DocumentCheckIcon";import h2 from"styled-components";import Ro,{css as $l}from"styled-components";import zl from"styled-components";import{Fragment as Jg,jsx as Vl,jsxs as Qg}from"react/jsx-runtime";var Ct=({success:e,fail:t})=>Qg(Jg,{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 lt(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 x("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(kp,{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 x("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(_p,{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 x("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new x("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 x("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(xp,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new x("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 ko=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Vp,{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 x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Hp,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw pe(t)}}async sendSmsCode(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new x("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Bp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw pe(o)}}};import{v4 as Wg}from"uuid";function Xe(e){return new Date(e*1e3)}function z1(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:Xe(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:Xe(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:Xe(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:Xe(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:Xe(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:Xe(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:Xe(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:Xe(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:Xe(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:Xe(r.verified_at)};t.push(g);break;case"apple_oauth":let w={subject:r.subject,email:r.email,type:r.type,verifiedAt:Xe(r.verified_at)};t.push(w);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:Xe(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:Xe(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;case"passkey":let k={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:Xe(r.verified_at)};t.push(k);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,q1=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Nt=(e,t)=>t==="all-users"&&!Se(e)||t==="users-without-wallets"&&!q1(e)?.length;function gt(e){if(!e)return null;let t=z1(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"),w=e.mfa_methods.map(({type:k,verified_at:E})=>({type:k,verifiedAt:Xe(E)}));return{id:e.id,createdAt:Xe(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:w.map(k=>k.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as gu}from"@ethersproject/address";import Ag from"eventemitter3";import tg from"@coinbase/wallet-sdk";import{jsx as Od,jsxs as $1}from"react/jsx-runtime";var Ca=({style:e,...t})=>$1("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:[Od("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Od("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 Hd}from"@ethersproject/providers";import{default as X1}from"eventemitter3";import Q1 from"eventemitter3";var j1=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Nd=e=>j1.includes(e);import{ErrorCode as K1}from"@ethersproject/logger";var tn=class extends J{constructor(){super("Wallet timeout");this.type="wallet_error"}},rn=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===K1.ACTION_REJECTED&&(t.details=et.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(et).find(a=>a.eipCode===o.code);this.details=n||et.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=et.E32002_CONNECTION_ALREADY_PENDING:this.details=et.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=et.E32002_WALLET_LOCKED))}},Y1={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}},Z1={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}},J1={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}},et={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...J1,...Z1},Nr={...Y1,...et};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 tn,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||Po,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)})}},eo=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},wa=class extends Q1{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=on(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new eo(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Ce()||!this.address)throw new eo("Disconnected",4900);return(await Ud(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new eo(`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 eo(`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 Dd(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 Fd(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:So(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 So(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(Nd(r.method)){let o=await Ce();if(await Bd(),!o||!this.address)throw new eo("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 eo("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)}},to=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 eg=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},vt=class extends X1{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=en(r),this.walletClientType==="privy"&&j.put(pa(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=on(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===en(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(eg(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 Hd(new hr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new to(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(pa(a));this.chains.find(u=>u.id===Number(c))||(j.del(pa(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=en(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 Hd(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 nn={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 rg=(e,t)=>{let o=ma(1,[nn],{},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 tg({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(rg(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 Gd}from"react/jsx-runtime";var Pa=({...e})=>Gd("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Gd("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:[So(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 Vd}from"react/jsx-runtime";var an=({style:e,...t})=>Vd("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Vd("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 og}from"react/jsx-runtime";var sn=({style:e,...t})=>og("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 zd,jsxs as ng}from"react/jsx-runtime";var gr=({style:e,...t})=>ng("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:[zd("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),zd("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 cn=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)}}},ln,pn=class extends vt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Qi(this,ln,void 0);this.proxyProvider=new xe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?vl(this,ln,{name:"MetaMask",icon:sn,id:"io.metamask"}):i==="phantom"&&vl(this,ln,{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 Tp(this,ln)??{name:"Browser Extension",icon:an,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)}}};ln=new WeakMap;import{getAddress as r9}from"@ethersproject/address";import{Web3Provider as n9}from"@ethersproject/providers";import{isMobile as ig}from"react-device-detect";var xa=class extends cn{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{ig||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,Po);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 Sg,OPTIONAL_EVENTS as xg,OPTIONAL_METHODS as kg}from"@walletconnect/ethereum-provider";import{isMobile as _g}from"react-device-detect";import{createContext as gg,useContext as vg,useEffect as Ol,useRef as Cg,useState as wg}from"react";import{jsx as ag}from"react/jsx-runtime";function Aa({src:e,...t}){return ag("img",{src:e,...t,style:{display:"none"}})}import{useContext as uu,useEffect as du,useMemo as mg,useState as fg}from"react";import{createContext as hg}from"react";var Ft={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:ld,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var qd=({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 sg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),$d=e=>sg.has(e),jd=(e,t,r)=>r.indexOf(e)===t,Kd=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter($d).filter(jd):e?e.filter($d).filter(jd):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 Yd={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 Zd={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 Jd={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 Qd={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 Xd={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 pi=[Ra,Ia,Ma,ru,su,nn,Na,Da,Fa,li,ci,Qd,Xd,eu,tu,Wa,La,Oa,Jd,nu,iu,Yd,Zd,Ua,Ha,Ba,ou,au],SE=new Set(pi.map(e=>e.id));import _o from"tinycolor2";var lu="#FFFFFF",lg="#000000",cg=lu,pg="#1E1E1D";function dg(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 _o({...e.toHsl(),l:r})}function cu({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=lu,blackHex:i=lg}){let l;switch(e){case"light":l=cg;break;case"dark":l=pg;break;default:l=e;break}let s=_o(l),c=_o(t),u=_o(r),h=_o(o),f=_o(n),g=dg(s.getLuminance()),w=Dr(s,g==="light"?-.04:.11),v=Dr(s,g==="light"?-.88:.87),k=Dr(s,g==="light"?-.77:.75),E=Dr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),T=Dr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),W=Dr(c,.15),I=Dr(c,-.06),D=Dr(f,.3),R=_o(c.getLuminance()>.5?i:a),B=Dr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:w.toHslString(),foreground:v.toHslString(),foreground2:k.toHslString(),foreground3:E.toHslString(),foreground4:T.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,w,v,k,E,T;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"),w=a?.includes("spotify"),g=a?.includes("tiktok"),k=a?.includes("github"),v=a?.includes("linkedin"),E=a?.includes("apple"),T=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,c=e.walletAuth,u=e.googleOAuth,h=e.twitterOAuth,f=e.discordOAuth,k=e.githubOAuth,w=e.spotifyOAuth,g=e.tiktokOAuth,v=e.linkedinOAuth,E=e.appleOAuth,T=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,k,w,g,v,E,T].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=Kd({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),$=qd({input:t?.loginMethodsAndOrder}),V=t?.intl?.defaultCountry??"US",{chains:z,defaultChain:A}=ug({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,ae,Q=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?F?ae=t?.embeddedWallets?.noPromptOnSignature??!0:ae=t?.embeddedWallets?.noPromptOnSignature??Q:ae=Q,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ae!==!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:k,spotify:w,tiktok:g,linkedin:v,apple:E,farcaster:T},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:ae},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 pu(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 ug({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:pi.find(u=>u.id===s.id)??s)}else n=pi.concat(e??[]);let a=t?n[0]:nn,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}}import{jsx as yg}from"react/jsx-runtime";var mu={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(mu,void 0,!1),Ll=hg({appConfig:Wl,isServerConfigLoaded:!1}),fu=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=fg(null),i=mg(()=>Ml(n??mu,o,!!n),[n,o]);return du(()=>{let l=pu(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),du(()=>{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)}})()},[]),yg(Ll.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Ga=()=>{let{appConfig:e}=uu(Ll);return e},Va=()=>{let{isServerConfigLoaded:e}=uu(Ll);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Eg,jsxs as Tg}from"react/jsx-runtime";var hu=gg({ready:!1,app:Wl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),bg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],yu=e=>{let t=Ga(),r=e.authenticated,[o,n]=wg(e.initialScreen);Ol(()=>{!r&&!bg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=Cg(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 Tg(hu.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Eg(Aa,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>vg(hu);import{jsx as dn,jsxs as Pg}from"react/jsx-runtime";var di=({style:e,...t})=>{let{app:r}=_();return Pg("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:[dn("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),dn("g",{clipPath:"url(#clip0_1765_9946)",children:dn("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"})}),dn("defs",{children:dn("clipPath",{id:"clip0_1765_9946",children:dn("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:sn,id:"io.metamask"}:{name:bd(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||di,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,xd(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new rn)};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=on(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 Sg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:xg,optionalMethods:kg,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),_g&&this.walletEntry){let{redirect:l,href:s}=Pd(i,this.walletEntry);kd({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");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===gu(t)).length:!1},on=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Po:Po,ui=class extends Ag{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=Ed(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"),!Qr()&&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 cn(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=gu(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 Rg}from"ofetch";var Ig=[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=Rg.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=!Ig.includes(n.toString());if(!i.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&i.set("authorization",`Bearer ${s}`)}a.headers=i},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new 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 Ao from"js-cookie";function vu(e){return e instanceof Jr?"email":e instanceof ko?"sms":e instanceof xo?"siwe":e instanceof Zo?"custom_auth":e instanceof fr?e.meta.provider:null}import*as Cu from"jose";var Cr=class{static parse(t){try{return new Cr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Cu.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 Mg=30,qa=class{constructor(){this.authenticateOnce=new lt(async t=>this._authenticate(t)),this.linkOnce=new lt(async t=>this._link(t)),this.refreshOnce=new lt(this._refresh.bind(this)),this.destroyOnce=new lt(this._destroy.bind(this)),this.forkSessionOnce=new lt(this._forkSession.bind(this))}get token(){try{let t=j.get(bo);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(ri);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Ao.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(Mg)}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=vu(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"),Qe(r)}}async _link(t){try{let r=await t.link();return gt(r)}catch(r){throw console.warn("Error linking account"),Qe(r)}}async _refresh(){if(!this.api)throw new x("Session has no API instance");if(!this.client)throw new x("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 Qe(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 x("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Sp,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw Qe(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=j.get(bo);if(j.put(bo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=Cr.parse(t)?.expiration;Ao.set(Sl,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else j.del(bo),Ao.remove(Sl)}storeRefreshToken(t){typeof t=="string"?(j.put(la,t),this.client?.useServerCookies||(Ao.set(ca,"t",{sameSite:"Strict",secure:!0,expires:30}),Ao.set(xl,t,{sameSite:"Strict",secure:!0,expires:30}))):(j.del(la),Ao.remove(xl),Ao.remove(ca))}clearForkedToken(){j.del(ri)}};var Dl,$a,wu,mi=class{constructor(t){Qi(this,$a);this.apiUrl=t.apiUrl||sa,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||cd,this.appId=t.appId,this.clientAnalyticsId=Pp(this,$a,wu).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 x("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new x("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(Fp,{address:t});return gt(r)}catch(r){throw Qe(r)}}async acceptTerms(){try{let t=await this.api.post(td,{});return gt(t)}catch(t){throw Qe(t)}}async unlinkPhone(t){try{let r=await this.api.post(Gp,{phoneNumber:t});return gt(r)}catch(r){throw Qe(r)}}async unlinkWallet(t){try{let r=await this.api.post(Ap,{address:t});return gt(r)}catch(r){throw Qe(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(jp,{provider:t,subject:r});return gt(o)}catch(o){throw Qe(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(Lp,{fid:t});return gt(r)}catch(r){throw Qe(r)}}async unlinkPasskey(t){try{let r=await this.api.post(Qp,{credential_id:t});return gt(r)}catch(r){throw Qe(r)}}async createAnalyticsEvent(t,r,o){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(rd,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(od,t)}catch(r){throw Qe(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=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,passkeyAuth:t.passkey_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw Qe(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,wu=function(){if(typeof window>"u")return null;try{let r=j.get(oi);if(typeof r=="string"&&r.length>0)return r}catch{}let t=Wg();try{return j.put(oi,t),t}catch{return t}};import{Turnstile as Ug}from"@marsidev/react-turnstile";import{useEffect as Bg,useMemo as Hg}from"react";import{useMemo as Lg,useRef as Og,useContext as Ng,useState as Fl,createContext as Dg}from"react";import{jsx as Fg}from"react/jsx-runtime";var bu=Dg({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:b,setError:b,setExecuting:b,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:b,reset:b,execute:b}),Qt=class extends Ie{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Eu=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Og(null),[a,i]=Fl(),[l,s]=Fl(),[c,u]=Fl(!1),h=Lg(()=>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 Fg(bu.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 Cd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Qt("Captcha failed",null,"captcha_timeout")}}},children:e})},ye=()=>Ng(bu);import{jsx as Tu}from"react/jsx-runtime";var Ul=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=ye(),[,s]=Hg(()=>r?.split("t:")||[],[r]);if(Bg(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return Tu("div",{className:"hidden h-0 w-0",children:Tu(Ug,{...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 q6,useEffect as g1,useRef as $6,useState as j6}from"react";import K6 from"react-dom";import{createContext as Gg,useContext as Vg}from"react";var Bl=Gg({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:b,initializeWalletProxy:b,getAuthMeta:b,getAuthFlow:b,closePrivyModal:b,openPrivyModal:b,connectWallet:b,initLoginWithWallet:b,loginWithWallet:b,initLoginWithFarcaster:b,loginWithFarcaster:b,loginWithCode:b,initLoginWithEmail:b,initLoginWithSms:b,initUpdateEmail:b,resendEmailCode:b,resendSmsCode:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,initLoginWithOAuth:b,loginWithOAuth:b,loginWithPasskey:b,linkWithPasskey:b,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),M=()=>Vg(Bl);import{createContext as zg,useContext as qg}from"react";var me=zg({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:b,login:b,connectOrCreateWallet:b,linkEmail:b,linkPhone:b,linkFarcaster:b,linkWallet:b,linkGoogle:b,linkTwitter:b,linkDiscord:b,linkGithub:b,linkSpotify:b,linkTiktok:b,linkLinkedIn:b,linkApple:b,linkPasskey:b,updateEmail:b,logout:b,getAccessToken:b,getEthereumProvider:b,getEthersProvider:b,getWeb3jsProvider:b,unlinkEmail:b,unlinkPhone:b,unlinkWallet:b,unlinkGoogle:b,unlinkTwitter:b,unlinkDiscord:b,unlinkGithub:b,unlinkSpotify:b,unlinkTiktok:b,unlinkLinkedIn:b,unlinkApple:b,unlinkFarcaster:b,unlinkPasskey:b,setActiveWallet:b,forkSession:b,createWallet:b,signMessage:b,signTypedData:b,enrollInMfa:b,initEnrollmentWithSms:b,initEnrollmentWithTotp:b,promptMfa:b,init:b,submitEnrollmentWithSms:b,submitEnrollmentWithTotp:b,unenroll:b,submit:b,cancel:b,sendTransaction:b,exportWallet:b,setWalletPassword:b,requestFarcasterSigner:b,submitCast:b,removeCast:b,likeCast:b,recastCast:b,followUser:b,unfollowUser:b,initLoginWithEmail:b,initLoginWithSms:b,otpState:{status:"initial"},loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>qg(me);import{useEffect as $g,useState as jg}from"react";var Pu=e=>{let[t,r]=jg("auto");return $g(()=>{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 Kg,useContext as Yg,useEffect as Zg}from"react";var Su={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=Kg(void 0),xu=()=>Yg(Hl);function _e(e,t){if(!t)return;let o=xu().current[e];return Zg(()=>{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 N(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function ku(){let e=xu();return(t,r,...o)=>N(e,t,r,...o)}function Gl(e){_e("configureMfa",e)}import Ou from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import h2 from"@heroicons/react/24/solid/DocumentCheckIcon";import y2 from"styled-components";import Ro,{css as $l}from"styled-components";import zl from"styled-components";import{Fragment as Qg,jsx as Vl,jsxs as Xg}from"react/jsx-runtime";var Ct=({success:e,fail:t})=>Xg(Qg,{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
|
+
`,Fr=e=>Vl(Jg,{color:e.color||"var(--privy-color-foreground-3)"}),Jg=zl(wt)`
|
|
52
52
|
&& {
|
|
53
53
|
height: 0.9rem;
|
|
54
54
|
width: 0.9rem;
|
|
@@ -57,7 +57,7 @@ Resources:
|
|
|
57
57
|
/* Override default Loader to match button transitions */
|
|
58
58
|
transition: border-color 200ms ease;
|
|
59
59
|
}
|
|
60
|
-
`;import{jsx as
|
|
60
|
+
`;import{jsx as Ut,jsxs as Za}from"react/jsx-runtime";var ja=Ro.button`
|
|
61
61
|
display: flex;
|
|
62
62
|
flex-direction: row;
|
|
63
63
|
align-items: center;
|
|
@@ -85,13 +85,13 @@ Resources:
|
|
|
85
85
|
color: var(--privy-color-foreground-3);
|
|
86
86
|
cursor: not-allowed;
|
|
87
87
|
}
|
|
88
|
-
`,O=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>
|
|
88
|
+
`,O=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ut(_u,{disabled:t||r,...n,children:t?Za("span",{children:[Ut(Fr,{}),o?Ut("span",{children:o}):null]}):e}),LP=Ro(O)`
|
|
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})=>
|
|
94
|
+
`,Ka=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ut(_u,{as:"a",disabled:t||r,...n,children:t?Za("span",{children:[Ut(Fr,{}),o?Ut("span",{children:o}):null]}):e}),_u=Ro(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
|
-
`,
|
|
139
|
+
`,Xt=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Ut(e2,{disabled:t||r,...n,children:t?Za("span",{children:[Ut(Fr,{}),o?Ut("span",{children:o}):null]}):e}),e2=Ro(ja)`
|
|
140
140
|
&& {
|
|
141
141
|
border-width: 1px;
|
|
142
142
|
border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
|
|
@@ -196,10 +196,10 @@ Resources:
|
|
|
196
196
|
cursor: not-allowed;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`,
|
|
199
|
+
`,OP=Ro.div`
|
|
200
200
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
201
201
|
height: 44px;
|
|
202
|
-
`,un=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>Za(
|
|
202
|
+
`,un=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>Za(t2,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Ut("span",{children:e}),Ut("span",{children:Ut(Fr,{})})]}),t2=Ro.button`
|
|
203
203
|
&& {
|
|
204
204
|
color: var(--privy-color-accent);
|
|
205
205
|
font-size: 16px;
|
|
@@ -241,7 +241,7 @@ Resources:
|
|
|
241
241
|
cursor: not-allowed;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
`;import Au from"styled-components";import{Fragment as
|
|
244
|
+
`;import Au from"styled-components";import{Fragment as r2,jsx as ro,jsxs as Ru}from"react/jsx-runtime";var jl=Au.div`
|
|
245
245
|
margin-top: 16px;
|
|
246
246
|
font-size: 13px;
|
|
247
247
|
text-align: center;
|
|
@@ -250,7 +250,7 @@ Resources:
|
|
|
250
250
|
&& > a {
|
|
251
251
|
color: var(--privy-color-accent);
|
|
252
252
|
}
|
|
253
|
-
`;function mn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return ro(jl,{});if(!r&&!t)return ro(jl,{});let n=!!(t&&r);return Ru(jl,{children:["By logging in I agree to the"," ",r&&ro("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&ro("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var q=({protectedByPrivy:e})=>ro(K,{children:e?Ru(
|
|
253
|
+
`;function mn(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return ro(jl,{});if(!r&&!t)return ro(jl,{});let n=!!(t&&r);return Ru(jl,{children:["By logging in I agree to the"," ",r&&ro("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&ro("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var q=({protectedByPrivy:e})=>ro(K,{children:e?Ru(r2,{children:[ro(Pa,{className:"hide-on-mobile"}),ro("span",{className:"hide-on-mobile",children:ro("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),K=Au.div`
|
|
254
254
|
display: flex;
|
|
255
255
|
align-items: center;
|
|
256
256
|
justify-content: center;
|
|
@@ -277,7 +277,7 @@ Resources:
|
|
|
277
277
|
@media all and (display-mode: standalone) {
|
|
278
278
|
padding-bottom: 30px;
|
|
279
279
|
}
|
|
280
|
-
`;import
|
|
280
|
+
`;import o2 from"@heroicons/react/24/outline/ArrowLeftIcon";import n2 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import i2 from"@heroicons/react/24/outline/XMarkIcon";import fn from"styled-components";import{jsx as bt,jsxs as Iu}from"react/jsx-runtime";var a2=({backFn:e})=>bt("div",{children:bt(Kl,{onClick:e,children:bt(o2,{height:"16px",width:"16px",strokeWidth:2})})}),s2=({infoFn:e})=>bt("div",{children:bt(c2,{"aria-label":"info",onClick:e,children:bt(n2,{height:"22px",width:"22px",strokeWidth:2})})}),l2=e=>bt("div",{children:bt(Kl,{"aria-label":"close modal",onClick:e.onClose,children:bt(i2,{height:"16px",width:"16px",strokeWidth:2})})});var P=({backFn:e,infoFn:t,onClose:r,title:o,closeable:n=!0})=>{let{closePrivyModal:a}=M(),{app:i}=_();return Iu(p2,{children:[Iu(d2,{children:[e&&bt(a2,{backFn:e}),t&&bt(s2,{infoFn:t})]}),o&&bt(m2,{id:"privy-dialog-title",children:o}),bt(u2,{children:i?.render.inDialog&&n&&bt(l2,{onClose:r||(()=>a())})})]})},Kl=fn.button`
|
|
281
281
|
&& {
|
|
282
282
|
cursor: pointer;
|
|
283
283
|
display: flex;
|
|
@@ -296,11 +296,11 @@ Resources:
|
|
|
296
296
|
opacity: 1;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
`,
|
|
299
|
+
`,c2=fn(Kl)`
|
|
300
300
|
&& {
|
|
301
301
|
background-color: transparent;
|
|
302
302
|
}
|
|
303
|
-
`,
|
|
303
|
+
`,p2=fn.div`
|
|
304
304
|
padding: 16px 0;
|
|
305
305
|
display: flex;
|
|
306
306
|
align-items: center;
|
|
@@ -312,23 +312,23 @@ Resources:
|
|
|
312
312
|
font-weight: 600;
|
|
313
313
|
color: var(--privy-color-foreground);
|
|
314
314
|
}
|
|
315
|
-
`,
|
|
315
|
+
`,d2=fn.div`
|
|
316
316
|
flex: 1;
|
|
317
317
|
align-items: center;
|
|
318
318
|
display: flex;
|
|
319
319
|
gap: 8px;
|
|
320
|
-
`,
|
|
320
|
+
`,u2=fn.div`
|
|
321
321
|
flex: 1;
|
|
322
322
|
display: flex;
|
|
323
323
|
justify-content: flex-end;
|
|
324
|
-
`,
|
|
324
|
+
`,m2=fn.div`
|
|
325
325
|
overflow: hidden;
|
|
326
326
|
white-space: nowrap;
|
|
327
327
|
max-width: 100%;
|
|
328
328
|
text-overflow: ellipsis;
|
|
329
329
|
text-align: center;
|
|
330
330
|
color: var(--privy-color-foreground-2);
|
|
331
|
-
`;import hn,{css as
|
|
331
|
+
`;import hn,{css as f2}from"styled-components";var Ja=hn.div`
|
|
332
332
|
text-align: left;
|
|
333
333
|
flex-grow: 1;
|
|
334
334
|
`,Qa=hn.div`
|
|
@@ -336,7 +336,7 @@ Resources:
|
|
|
336
336
|
flex-direction: column;
|
|
337
337
|
justify-content: flex-end;
|
|
338
338
|
flex-grow: 1;
|
|
339
|
-
`,
|
|
339
|
+
`,Bt=hn.div`
|
|
340
340
|
display: flex;
|
|
341
341
|
flex-direction: column;
|
|
342
342
|
gap: 12px;
|
|
@@ -351,7 +351,7 @@ Resources:
|
|
|
351
351
|
&::-webkit-scrollbar {
|
|
352
352
|
display: none;
|
|
353
353
|
}
|
|
354
|
-
`,Mu=
|
|
354
|
+
`,Mu=f2`
|
|
355
355
|
&& {
|
|
356
356
|
width: 100%;
|
|
357
357
|
font-size: 16px;
|
|
@@ -393,7 +393,7 @@ Resources:
|
|
|
393
393
|
${Mu}
|
|
394
394
|
`,Yl=hn.a`
|
|
395
395
|
${Mu}
|
|
396
|
-
`,
|
|
396
|
+
`,Ur=hn.div`
|
|
397
397
|
width: 100%;
|
|
398
398
|
${e=>e.if?"display: none;":""}
|
|
399
399
|
`;import Ve from"styled-components";var We=Ve.div`
|
|
@@ -404,13 +404,13 @@ Resources:
|
|
|
404
404
|
@media (max-width: 440px) {
|
|
405
405
|
padding: 10px 10px 20px;
|
|
406
406
|
}
|
|
407
|
-
`,
|
|
407
|
+
`,we=Ve.div`
|
|
408
408
|
font-size: 18px;
|
|
409
409
|
line-height: 18px;
|
|
410
410
|
text-align: center;
|
|
411
411
|
font-weight: 600;
|
|
412
412
|
margin-bottom: 10px;
|
|
413
|
-
`,
|
|
413
|
+
`,fe=Ve.div`
|
|
414
414
|
font-size: 0.875rem;
|
|
415
415
|
|
|
416
416
|
text-align: center;
|
|
@@ -451,7 +451,7 @@ Resources:
|
|
|
451
451
|
font-size: 0.875rem;
|
|
452
452
|
line-height: 1rem;
|
|
453
453
|
text-align: left;
|
|
454
|
-
`,
|
|
454
|
+
`,er=Ve.div`
|
|
455
455
|
display: flex;
|
|
456
456
|
flex-direction: column;
|
|
457
457
|
gap: 10px;
|
|
@@ -568,10 +568,10 @@ Resources:
|
|
|
568
568
|
width: auto !important;
|
|
569
569
|
color: white;
|
|
570
570
|
}
|
|
571
|
-
`;import{Fragment as
|
|
571
|
+
`;import{Fragment as C2,jsx as wr,jsxs as fi}from"react/jsx-runtime";var Nu=()=>{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(g2,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},g2=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>fi(C2,{children:[wr(P,{closeable:!1}),wr(h2,{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(Ou,{style:{marginLeft:"auto"}})]}),t&&fi(Yl,{target:"_blank",href:t,children:["View Privacy Policy ",wr(Ou,{style:{marginLeft:"auto"}})]})]}),fi(v2,{style:{marginTop:24},children:[wr(Xt,{onClick:o,children:"No thanks"}),wr(O,{onClick:r,children:"Accept"})]}),wr(q,{protectedByPrivy:!0})]}),v2=y2.div`
|
|
572
572
|
display: flex;
|
|
573
573
|
gap: 10px;
|
|
574
|
-
`;import Fu from"styled-components";import
|
|
574
|
+
`;import Fu from"styled-components";import w2 from"styled-components";var os=w2.span`
|
|
575
575
|
&& {
|
|
576
576
|
width: 82px;
|
|
577
577
|
height: 82px;
|
|
@@ -586,7 +586,7 @@ Resources:
|
|
|
586
586
|
transition: border-color 800ms;
|
|
587
587
|
border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
|
|
588
588
|
}
|
|
589
|
-
`;import
|
|
589
|
+
`;import b2 from"styled-components";var E2=b2.div`
|
|
590
590
|
display: flex;
|
|
591
591
|
flex-direction: column;
|
|
592
592
|
justify-content: center;
|
|
@@ -609,7 +609,7 @@ Resources:
|
|
|
609
609
|
left: -19px;
|
|
610
610
|
top: -19px;
|
|
611
611
|
}
|
|
612
|
-
`,Et=
|
|
612
|
+
`,Et=E2;import{jsx as Du}from"react/jsx-runtime";var ns=({style:e,...t})=>Du("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:Du("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as Ql,jsx as br,jsxs as is}from"react/jsx-runtime";var Uu=()=>{let{navigate:e,app:t}=_(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return is(Ql,{children:[br(P,{}),is(T2,{children:[br(Et,{children:is("div",{children:[br(os,{}),br(ns,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),is(P2,{children:[typeof r=="string"?br("h3",{children:r}):br(Ql,{children:r}),typeof o=="string"?br("p",{children:o}):br(Ql,{children:o})]}),t?.allowlistConfig.errorCtaLink?br(O,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):br(O,{onClick:()=>{e("LANDING")},children:n})]})]})},T2=Fu.div`
|
|
613
613
|
display: flex;
|
|
614
614
|
flex-direction: column;
|
|
615
615
|
align-items: center;
|
|
@@ -617,11 +617,11 @@ Resources:
|
|
|
617
617
|
gap: 24px;
|
|
618
618
|
width: 100%;
|
|
619
619
|
padding-bottom: 16px;
|
|
620
|
-
`,
|
|
620
|
+
`,P2=Fu.div`
|
|
621
621
|
display: flex;
|
|
622
622
|
flex-direction: column;
|
|
623
623
|
gap: 8px;
|
|
624
|
-
`;import
|
|
624
|
+
`;import k2 from"@heroicons/react/24/outline/EnvelopeIcon";import _2 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as $u,useState as as}from"react";import{isMobile as A2}from"react-device-detect";import gi from"styled-components";import kt from"styled-components";var Ht=kt.div`
|
|
625
625
|
display: flex;
|
|
626
626
|
flex-direction: column;
|
|
627
627
|
align-items: flex-start;
|
|
@@ -629,36 +629,36 @@ Resources:
|
|
|
629
629
|
margin-top: auto;
|
|
630
630
|
gap: 16px;
|
|
631
631
|
flex-grow: 100;
|
|
632
|
-
`,ct=
|
|
632
|
+
`,ct=kt.div`
|
|
633
633
|
display: flex;
|
|
634
634
|
flex-direction: column;
|
|
635
635
|
align-items: center;
|
|
636
636
|
justify-content: center;
|
|
637
637
|
flex-grow: 1;
|
|
638
638
|
width: 100%;
|
|
639
|
-
`,Bu=
|
|
639
|
+
`,Bu=kt.div`
|
|
640
640
|
display: flex;
|
|
641
641
|
flex-direction: column;
|
|
642
642
|
align-items: center;
|
|
643
643
|
width: 100%;
|
|
644
|
-
`,gn=
|
|
644
|
+
`,gn=kt(ct)`
|
|
645
645
|
padding: 20px 0;
|
|
646
|
-
`,
|
|
646
|
+
`,tr=kt(ct)`
|
|
647
647
|
gap: 16px;
|
|
648
|
-
`,Xl=
|
|
648
|
+
`,Xl=kt.div`
|
|
649
649
|
display: flex;
|
|
650
650
|
flex-direction: column;
|
|
651
651
|
width: 100%;
|
|
652
|
-
`,Fe=
|
|
652
|
+
`,Fe=kt.div`
|
|
653
653
|
display: flex;
|
|
654
654
|
flex-direction: column;
|
|
655
655
|
gap: 8px;
|
|
656
|
-
`,
|
|
656
|
+
`,RS=kt.div`
|
|
657
657
|
display: flex;
|
|
658
658
|
flex-direction: column;
|
|
659
659
|
justify-content: space-between;
|
|
660
660
|
height: 100%;
|
|
661
|
-
`,Hu=
|
|
661
|
+
`,Hu=kt.div`
|
|
662
662
|
display: flex;
|
|
663
663
|
flex-direction: column;
|
|
664
664
|
justify-content: flex-start;
|
|
@@ -681,13 +681,13 @@ Resources:
|
|
|
681
681
|
color: var(--privy-color-foreground-3);
|
|
682
682
|
font-size: 14px;
|
|
683
683
|
}
|
|
684
|
-
`,Z=
|
|
684
|
+
`,Z=kt.div`
|
|
685
685
|
height: 16px;
|
|
686
|
-
`,te=
|
|
686
|
+
`,te=kt.div`
|
|
687
687
|
height: 12px;
|
|
688
|
-
`,Gu=
|
|
688
|
+
`,Gu=kt.div`
|
|
689
689
|
position: relative;
|
|
690
|
-
`,Vu=
|
|
690
|
+
`,Vu=kt.div`
|
|
691
691
|
background-color: var(--privy-color-accent);
|
|
692
692
|
display: flex;
|
|
693
693
|
justify-content: center;
|
|
@@ -695,9 +695,9 @@ Resources:
|
|
|
695
695
|
border-radius: 50%;
|
|
696
696
|
border-color: white;
|
|
697
697
|
border-width: 2px !important;
|
|
698
|
-
`;import ec from"styled-components";import{Fragment as
|
|
698
|
+
`;import ec from"styled-components";import{Fragment as x2,jsx as hi,jsxs as qu}from"react/jsx-runtime";var yi=({title:e,description:t,children:r,...o})=>hi(zu,{...o,children:qu(x2,{children:[hi("h3",{children:e}),typeof t=="string"?hi("p",{children:t}):t,r]})}),Er=ec(yi)`
|
|
699
699
|
margin-bottom: 24px;
|
|
700
|
-
`,Pe=({title:e,description:t,icon:r,children:o,...n})=>qu(
|
|
700
|
+
`,Pe=({title:e,description:t,icon:r,children:o,...n})=>qu(S2,{...n,children:[r||null,hi("h3",{children:e}),typeof t=="string"?hi("p",{children:t}):t,o]}),zu=ec.div`
|
|
701
701
|
display: flex;
|
|
702
702
|
flex-direction: column;
|
|
703
703
|
justify-content: flex-start;
|
|
@@ -717,7 +717,7 @@ Resources:
|
|
|
717
717
|
color: var(--privy-color-foreground-2);
|
|
718
718
|
font-size: 14px;
|
|
719
719
|
}
|
|
720
|
-
`,
|
|
720
|
+
`,S2=ec(zu)`
|
|
721
721
|
align-items: center;
|
|
722
722
|
text-align: center;
|
|
723
723
|
gap: 16px;
|
|
@@ -725,7 +725,7 @@ Resources:
|
|
|
725
725
|
h3 {
|
|
726
726
|
margin-bottom: 24px;
|
|
727
727
|
}
|
|
728
|
-
`;import{Fragment as tc,jsx as tt,jsxs as no}from"react/jsx-runtime";var rc=6,ju=new Array(rc).fill(""),
|
|
728
|
+
`;import{Fragment as tc,jsx as tt,jsxs as no}from"react/jsx-runtime";var rc=6,ju=new Array(rc).fill(""),R2=1400;var Yu=()=>{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:w}=G(),[v,k]=as(ju),[E,T]=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;$u(()=>{if(f&&E&&w){if(e?.legal.requireUsersAcceptTerms&&!w.hasAcceptedTerms){let Q=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},V);return()=>clearTimeout(Q)}if(Nt(w,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,w]),$u(()=>{if(W&&D===0){let ae=setTimeout(()=>{k(ju),I(null),document.querySelector("input[name=code-0]")?.focus()},R2);return()=>clearTimeout(ae)}},[W]);let z=ae=>{ae.preventDefault();let Q=ae.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(ae.currentTarget.name?.charAt(5)),Ae=[...Q||[""]].slice(0,rc-Y),ee=[...v.slice(0,Y),...Ae,...v.slice(Y+Ae.length)];k(ee);let cr=Ae.length,it=Math.min(Math.max(Y+cr,0),rc-1);isNaN(Number(ae.currentTarget.value))||document.querySelector(`input[name=code-${it}]`)?.focus(),ee.every(Ne=>Ne&&!isNaN(+Ne))&&(document.querySelector(`input[name=code-${it}]`)?.blur(),c(ee.join("")).then(()=>T(!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=ae=>{D===1&&(I(null),R(null));let Q=[...v.slice(0,ae),"",...v.slice(ae+1)];k(Q),ae>0&&document.querySelector(`input[name=code-${ae-1}]`)?.focus()},oe=B==0?tt(k2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):tt(_2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),F=B==0?no("p",{children:["Please check ",tt(Ku,{children:s()?.email})," for an email from privy.io and enter your code below."]}):no("p",{children:["Please check ",tt(Ku,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return no(tc,{children:[tt(P,{backFn:()=>r()},"header"),no(I2,{children:[tt(Pe,{title:"Enter confirmation code",description:F,icon:oe}),no(Bu,{children:[no(M2,{children:[tt(W2,{fail:!!W,success:E,children:tt("span",{children:W||(E?"Success!":"")})}),tt("div",{children:v.map((ae,Q)=>tt("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:A2?"one-time-code":"off"},Q))})]}),tt(L2,{children:B==0?no(tc,{children:[tt("span",{children:"Didn't get an email?"}),tt("button",{onClick:i,children:"Resend code"})]}):no(tc,{children:[tt("span",{children:"Didn't get a message?"}),tt("button",{onClick:l,children:"Resend code"})]})})]})]}),tt(q,{protectedByPrivy:!0})]})},I2=gi.div`
|
|
729
729
|
display: flex;
|
|
730
730
|
flex-direction: column;
|
|
731
731
|
align-items: flex-start;
|
|
@@ -733,7 +733,7 @@ Resources:
|
|
|
733
733
|
margin: auto;
|
|
734
734
|
gap: 16px;
|
|
735
735
|
flex-grow: 1;
|
|
736
|
-
`,
|
|
736
|
+
`,M2=gi.div`
|
|
737
737
|
display: flex;
|
|
738
738
|
flex-direction: column;
|
|
739
739
|
width: 100%;
|
|
@@ -789,7 +789,7 @@ Resources:
|
|
|
789
789
|
transform: translate(1px, 0px);
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
|
-
`,
|
|
792
|
+
`,W2=gi.div`
|
|
793
793
|
line-height: 20px;
|
|
794
794
|
height: 20px;
|
|
795
795
|
font-size: 13px;
|
|
@@ -797,7 +797,7 @@ Resources:
|
|
|
797
797
|
display: flex;
|
|
798
798
|
justify-content: flex-end;
|
|
799
799
|
width: 100%;
|
|
800
|
-
`,
|
|
800
|
+
`,L2=gi.div`
|
|
801
801
|
font-size: 13px;
|
|
802
802
|
color: var(--privy-color-foreground-3);
|
|
803
803
|
display: flex;
|
|
@@ -814,7 +814,7 @@ Resources:
|
|
|
814
814
|
`,Ku=gi.span`
|
|
815
815
|
font-weight: 500;
|
|
816
816
|
word-break: break-all;
|
|
817
|
-
`;import
|
|
817
|
+
`;import U2 from"@heroicons/react/24/solid/CheckCircleIcon";import B2 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as oc,useRef as H2,useState as Cn}from"react";import G2 from"styled-components";import O2 from"styled-components";import{Fragment as F2,jsx as vn,jsxs as D2}from"react/jsx-runtime";var Zu=({icon:e})=>{let t=e;return vn(F2,{children:vn(N2,{children:D2("div",{children:[vn(Ct,{}),typeof t=="string"?vn("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?vn(t,{style:{width:"38px",height:"38px"}}):vn("span",{})]})})})},N2=O2.div`
|
|
818
818
|
display: flex;
|
|
819
819
|
flex-direction: column;
|
|
820
820
|
justify-content: center;
|
|
@@ -837,14 +837,14 @@ Resources:
|
|
|
837
837
|
left: -19px;
|
|
838
838
|
top: -19px;
|
|
839
839
|
}
|
|
840
|
-
`;import{Fragment as
|
|
840
|
+
`;import{Fragment as z2,jsx as rr,jsxs as nc}from"react/jsx-runtime";var Qu=500,Ju=Qu*2,Xu=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=_(),{status:i,token:l,waitForResult:s,reset:c,execute:u}=ye(),h=H2([]),f=oe=>{h.current=[oe,...h.current]},[g,w]=Cn(!0);oc(()=>{let oe=setTimeout(w,Ju,!1);return f(oe),()=>{h.current.forEach(F=>clearTimeout(F)),h.current=[]}},[]);let[v,k]=Cn(""),[E,T]=Cn("Checking that you are a human..."),[W,I]=Cn(rr(O,{onClick:()=>{},disabled:!0,children:"Continue"})),[D,R]=Cn(!1),[B,$]=Cn(3),V=r?.captchaModalData,z=async oe=>{try{await V?.callback(oe),V?.onSuccessNavigateTo&&n(V?.onSuccessNavigateTo,!1)}catch(F){if(F instanceof Qt)return;{let ae={error:F,previousScreen:e||"LANDING"};a({errorModalData:ae}),n(V?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};oc(()=>{if(i==="success"){let oe=setTimeout(async()=>{let F=await s();!F||V?.userIntentRequired||z(F)},Ju);f(oe)}else if(i==="ready"){let oe=setTimeout(()=>{i==="ready"&&u()},Qu);f(oe)}},[i]),oc(()=>{if(!g)switch(i){case"success":k("Success!"),T("CAPTCHA passed successfully."),I(rr(O,{onClick:()=>{R(!0),z(l)},disabled:!V?.userIntentRequired,loading:D,children:V?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":k(""),T("Checking that you are a human..."),I(rr(O,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":k("Something went wrong"),B<=0?(T("If you use an adblocker or VPN, try disabling and re-attempting."),I(null)):(T("You did not pass CAPTCHA. Please try again."),I(rr(O,{onClick:A,children:"Retry"})));break;case"ready":default:break}},[i,g,D]);let A=async()=>{if(B<=0)return;$(F=>F-1),c(),u();let oe=await s();!oe||V?.userIntentRequired||z(oe)};return nc(z2,{children:[rr(P,{backFn:!e||t===e?void 0:o}),nc(V2,{children:[i==="success"?rr(U2,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?rr(B2,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):rr(Zu,{}),nc(Fe,{children:[v?rr("h3",{children:v}):null,rr("p",{children:E})]}),W]}),rr(K,{})]})},V2=G2.div`
|
|
841
841
|
display: flex;
|
|
842
842
|
flex-direction: column;
|
|
843
843
|
align-items: center;
|
|
844
844
|
justify-content: center;
|
|
845
845
|
gap: 24px;
|
|
846
846
|
width: 100%;
|
|
847
|
-
`;import z2 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as q2}from"react-device-detect";import $2 from"styled-components";import{jsx as rr,jsxs as em}from"react/jsx-runtime";var tm=({...e})=>em("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[rr("defs",{children:em("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[rr("stop",{offset:"0",stopColor:"#f1562b"}),rr("stop",{offset:"0.3",stopColor:"#f1542b"}),rr("stop",{offset:"0.41",stopColor:"#f04d2a"}),rr("stop",{offset:"0.49",stopColor:"#ef4229"}),rr("stop",{offset:"0.5",stopColor:"#ef4029"}),rr("stop",{offset:"0.56",stopColor:"#e83e28"}),rr("stop",{offset:"0.67",stopColor:"#e13c26"}),rr("stop",{offset:"1",stopColor:"#df3c26"})]})}),rr("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),rr("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as or,jsxs as vi}from"react/jsx-runtime";var rm=({style:e,...t})=>vi("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[or("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),or("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:or("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),vi("g",{mask:"url(#mask0_16909_31415)",children:[or("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),or("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),or("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),or("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),vi("defs",{children:[vi("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[or("stop",{"stop-color":"#002D72"}),or("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),vi("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[or("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),or("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as X,jsxs as At}from"react/jsx-runtime";var om=({style:e,...t})=>At("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[X("g",{clipPath:"url(#clip0_5_32)",children:At("g",{clipPath:"url(#clip1_5_32)",children:[X("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:X("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),X("g",{mask:"url(#mask0_5_32)",children:X("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),X("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),X("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),X("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),X("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),X("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),X("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),X("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),X("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),X("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),At("defs",{children:[At("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#174299"}),X("stop",{offset:"1",stopColor:"#001E59"})]}),At("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[X("stop",{offset:"0.770277",stopColor:"#FF4000"}),X("stop",{offset:"1",stopColor:"#8754C9"})]}),At("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#FF4000"}),X("stop",{offset:"1",stopColor:"#8754C9"})]}),At("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#8754C9"}),X("stop",{offset:"1",stopColor:"#FF4000"})]}),At("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[X("stop",{offset:"0.723929",stopColor:"#FFF700"}),X("stop",{offset:"1",stopColor:"#FF9901"})]}),At("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#FFF700"}),X("stop",{offset:"1",stopColor:"#FF9901"})]}),At("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#FFF700"}),X("stop",{offset:"1",stopColor:"#FF9901"})]}),At("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[X("stop",{offset:"0.59513",stopColor:"#00AAFF"}),X("stop",{offset:"1",stopColor:"#01DA40"})]}),At("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[X("stop",{stopColor:"#00AAFF"}),X("stop",{offset:"1",stopColor:"#01DA40"})]}),At("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[X("stop",{stopColor:"#00AAFF"}),X("stop",{offset:"1",stopColor:"#01DA40"})]}),X("clipPath",{id:"clip0_5_32",children:X("rect",{width:"120",height:"120",fill:"white"})}),X("clipPath",{id:"clip1_5_32",children:X("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as Er,jsxs as nm}from"react/jsx-runtime";var im=({style:e,...t})=>nm("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Er("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),nm("g",{filter:"url(#filter0_d_12393_20043)",children:[Er("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),Er("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),Er("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),Er("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),Er("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),Er("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),Er("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),Er("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),Er("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as Ci,jsxs as am}from"react/jsx-runtime";var sm=({style:e,...t})=>am("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[am("g",{clipPath:"url(#clip0_1704_1423)",children:[Ci("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),Ci("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),Ci("defs",{children:Ci("clipPath",{id:"clip0_1704_1423",children:Ci("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as wn,jsxs as J2}from"react/jsx-runtime";var Tr={coinbase_wallet:{logo:Ca,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:sn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:yr,displayName:"Phantom"},rainbow:{logo:om,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:di,displayName:"WalletConnect"},zerion:{logo:sm,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:tm,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:rm,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:im,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="}},Wo=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=_(),{connectWallet:i}=M(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{Qr()?(i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(q2?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},J2(Z2,{onClick:s,children:[wn(Y2,{icon:K2(e,n.connectorType)??r,name:n.walletClientType}),wn("span",{children:j2(e,n.connectorType)||t||n.walletClientType}),wn("span",{id:"connect-text",children:"Connect"})]})},j2=(e,t)=>{if(Tr[e]?.displayName)return Tr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},K2=(e,t)=>{if(Tr[e]?.logo)return Tr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return di},Y2=({icon:e,name:t})=>typeof e=="string"?wn("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?wn(z2,{}):e?wn(e,{}):null,Z2=$2(Te)`
|
|
847
|
+
`;import q2 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as $2}from"react-device-detect";import j2 from"styled-components";import{jsx as or,jsxs as em}from"react/jsx-runtime";var tm=({...e})=>em("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[or("defs",{children:em("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[or("stop",{offset:"0",stopColor:"#f1562b"}),or("stop",{offset:"0.3",stopColor:"#f1542b"}),or("stop",{offset:"0.41",stopColor:"#f04d2a"}),or("stop",{offset:"0.49",stopColor:"#ef4229"}),or("stop",{offset:"0.5",stopColor:"#ef4029"}),or("stop",{offset:"0.56",stopColor:"#e83e28"}),or("stop",{offset:"0.67",stopColor:"#e13c26"}),or("stop",{offset:"1",stopColor:"#df3c26"})]})}),or("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),or("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as nr,jsxs as vi}from"react/jsx-runtime";var rm=({style:e,...t})=>vi("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[nr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),nr("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:nr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),vi("g",{mask:"url(#mask0_16909_31415)",children:[nr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),nr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),nr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),nr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),vi("defs",{children:[vi("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[nr("stop",{"stop-color":"#002D72"}),nr("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),vi("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[nr("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),nr("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as X,jsxs as _t}from"react/jsx-runtime";var om=({style:e,...t})=>_t("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[X("g",{clipPath:"url(#clip0_5_32)",children:_t("g",{clipPath:"url(#clip1_5_32)",children:[X("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:X("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),X("g",{mask:"url(#mask0_5_32)",children:X("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),X("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),X("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),X("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),X("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),X("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),X("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),X("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),X("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),X("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),_t("defs",{children:[_t("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#174299"}),X("stop",{offset:"1",stopColor:"#001E59"})]}),_t("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[X("stop",{offset:"0.770277",stopColor:"#FF4000"}),X("stop",{offset:"1",stopColor:"#8754C9"})]}),_t("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#FF4000"}),X("stop",{offset:"1",stopColor:"#8754C9"})]}),_t("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#8754C9"}),X("stop",{offset:"1",stopColor:"#FF4000"})]}),_t("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[X("stop",{offset:"0.723929",stopColor:"#FFF700"}),X("stop",{offset:"1",stopColor:"#FF9901"})]}),_t("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#FFF700"}),X("stop",{offset:"1",stopColor:"#FF9901"})]}),_t("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[X("stop",{stopColor:"#FFF700"}),X("stop",{offset:"1",stopColor:"#FF9901"})]}),_t("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[X("stop",{offset:"0.59513",stopColor:"#00AAFF"}),X("stop",{offset:"1",stopColor:"#01DA40"})]}),_t("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[X("stop",{stopColor:"#00AAFF"}),X("stop",{offset:"1",stopColor:"#01DA40"})]}),_t("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[X("stop",{stopColor:"#00AAFF"}),X("stop",{offset:"1",stopColor:"#01DA40"})]}),X("clipPath",{id:"clip0_5_32",children:X("rect",{width:"120",height:"120",fill:"white"})}),X("clipPath",{id:"clip1_5_32",children:X("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as Tr,jsxs as nm}from"react/jsx-runtime";var im=({style:e,...t})=>nm("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[Tr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),nm("g",{filter:"url(#filter0_d_12393_20043)",children:[Tr("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),Tr("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),Tr("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),Tr("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),Tr("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),Tr("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),Tr("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),Tr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),Tr("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});import{jsx as Ci,jsxs as am}from"react/jsx-runtime";var sm=({style:e,...t})=>am("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[am("g",{clipPath:"url(#clip0_1704_1423)",children:[Ci("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),Ci("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),Ci("defs",{children:Ci("clipPath",{id:"clip0_1704_1423",children:Ci("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as wn,jsxs as Q2}from"react/jsx-runtime";var Pr={coinbase_wallet:{logo:Ca,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:sn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:gr,displayName:"Phantom"},rainbow:{logo:om,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:di,displayName:"WalletConnect"},zerion:{logo:sm,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:tm,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:rm,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:im,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="}},Wo=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=_(),{connectWallet:i}=M(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{Qr()?(i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a($2?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},Q2(J2,{onClick:s,children:[wn(Z2,{icon:Y2(e,n.connectorType)??r,name:n.walletClientType}),wn("span",{children:K2(e,n.connectorType)||t||n.walletClientType}),wn("span",{id:"connect-text",children:"Connect"})]})},K2=(e,t)=>{if(Pr[e]?.displayName)return Pr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Y2=(e,t)=>{if(Pr[e]?.logo)return Pr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return di},Z2=({icon:e,name:t})=>typeof e=="string"?wn("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?wn(q2,{}):e?wn(e,{}):null,J2=j2(Te)`
|
|
848
848
|
/* Show "Connect" on hover */
|
|
849
849
|
> #connect-text {
|
|
850
850
|
font-weight: 500;
|
|
@@ -866,23 +866,23 @@ Resources:
|
|
|
866
866
|
display: none;
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
|
-
`;import{Fragment as
|
|
869
|
+
`;import{Fragment as o3,jsx as bn,jsxs as n3}from"react/jsx-runtime";var X2=["coinbase_wallet"],e3=["metamask","okx_wallet","rainbow","uniswap","zerion"],t3=["cryptocom"],r3=["phantom"],En=({connectOnly:e})=>{let{connectors:t}=M(),{app:r}=_(),o=wi(r.appearance.walletList,t,e,r.appearance.walletList);return n3(o3,{children:[...o]})},wi=(e,t,r,o)=>{let n=[],a=[],i=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let c=t.filter(({connectorType:u,walletClientType:h})=>h==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(h));for(let u of c){let{walletClientType:h,walletBranding:f}=u;(h==="unknown"?a:n).push(bn(Wo,{connectOnly:r,provider:h,logo:f.icon,displayName:f.name,connector:u},`${s}-${h}`))}}else if(r3.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push(bn(Wo,{connectOnly:r,provider:s,connector:c},s))}else if(e3.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push(bn(Wo,{connectOnly:r,provider:s,connector:c},s))}else if(X2.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push(bn(Wo,{connectOnly:r,provider:s,connector:c},s))}else t3.includes(s)?l&&i.push(bn(Wo,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&i.push(bn(Wo,{connectOnly:r,provider:s,connector:l},s));return[...a,...n,...i]};import{Fragment as i3,jsx as bi,jsxs as a3}from"react/jsx-runtime";var lm=()=>{let{app:e}=_(),t=`Connect a wallet to ${e?.name}`;return a3(i3,{children:[bi(P,{},"header"),bi(Er,{title:"Connect your wallet",description:t}),bi(Bt,{children:bi(En,{connectOnly:!0})}),bi(q,{protectedByPrivy:!0})]})};import d3 from"styled-components";import c3 from"styled-components";import s3 from"react";import{jsx as l3}from"react/jsx-runtime";var cm=()=>{let{app:e}=_(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?l3("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?s3.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{jsx as pm}from"react/jsx-runtime";var Tn=e=>{let{app:t}=_();return t?.appearance.logo?pm(p3,{...e,children:pm(cm,{})}):null},p3=c3.div`
|
|
870
870
|
display: flex;
|
|
871
871
|
flex-direction: column;
|
|
872
872
|
align-items: center;
|
|
873
873
|
padding: 24px 0;
|
|
874
874
|
flex-grow: 1;
|
|
875
875
|
justify-content: center;
|
|
876
|
-
`;import{Fragment as
|
|
876
|
+
`;import{Fragment as m3,jsx as Pn,jsxs as f3}from"react/jsx-runtime";var dm=()=>{let{app:e}=_();return f3(m3,{children:[Pn(P,{},"header"),Pn(u3,{}),Pn(Bt,{children:Pn(En,{connectOnly:!0})}),e&&Pn(mn,{app:e,alwaysShowImplicitConsent:!0}),Pn(q,{protectedByPrivy:!0})]})},u3=d3(Tn)`
|
|
877
877
|
margin-bottom: 16px;
|
|
878
|
-
`;import{useEffect as ym,useState as gm}from"react";import{isMobile as
|
|
878
|
+
`;import{useEffect as ym,useState as gm}from"react";import{isMobile as b3}from"react-device-detect";import E3 from"styled-components";import{useEffect as ic,useState as Lo}from"react";import{isMobile as ss}from"react-device-detect";import{useInterval as v3}from"react-use";import mm from"styled-components";import{useState as h3,useEffect as y3,useCallback as g3}from"react";function um(){let[e,t]=h3(!1),r=g3(()=>{document.hidden&&t(!0)},[]);return y3(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as hm,jsx as qe,jsxs as Ei}from"react/jsx-runtime";var ac=2,sc=e=>e?.privyErrorCode==="linked_to_another_user"?Nr.ERROR_USER_EXISTS:e instanceof Re&&!e.details.default?e.details:e instanceof tn?Nr.ERROR_TIMED_OUT:e instanceof rn?Nr.ERROR_USER_REJECTED_CONNECTION:Nr.ERROR_WALLET_CONNECTION,fm=()=>{let[e,t]=Lo(!1),[r,o]=Lo(!1),[n,a]=Lo(void 0),{authenticated:i,logout:l}=G(),{app:s,navigate:c,navigateBack:u,lastScreen:h,currentScreen:f,setModalData:g}=_(),{getAuthFlow:w,walletConnectionStatus:v,closePrivyModal:k,initLoginWithWallet:E,loginWithWallet:T,updateWallets:W,createAnalyticsEvent:I}=M(),{walletConnectors:D}=G(),[R,B]=Lo(0),{user:$}=G(),[V]=Lo($?.linkedAccounts.length||0),[z,A]=Lo(""),[oe,F]=Lo(!1),{hasTabbedAway:ae}=um(),{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=w();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:Mr=>{console.error(Mr),I("embedded_wallet_creation_failure_logout",{error:Mr,screen:"ConnectionStatusScreen"}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ur);return()=>clearTimeout(ht)}W();let ne=setTimeout(()=>k({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Me);return()=>clearTimeout(ne)}},[$,e]);let it=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 T(),!s?.render.inDialog)return k({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(H){it(H)}finally{o(!1)}}ic(()=>{v?.connectError&&it(v?.connectError)},[v]),v3(()=>{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",pr=Pr[Mt]?.displayName||v?.connector?.walletBranding.name||"Browser Extension",qo=Pr[Mt]?.logo||v?.connector?.walletBranding.icon||(H=>qe(an,{...H})),dr=pr==="Browser Extension"?pr.toLowerCase():pr,ft;e?ft=`Successfully connected with ${dr}`:n?ft=n.message:cr?ft="Switching networks":ee?ft=r&&Ae?"Signing":"Sign to verify":ft=`Waiting for ${dr}`;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"&&(ad()||(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"),de=Mt==="coinbase_wallet"&&(Nl($)||n===Nr.ERROR_USER_EXISTS);return Ei(hm,{children:[qe(P,{backFn:!h||f===h?void 0:u}),Ei(C3,{children:[qe(lc,{walletLogo:qo,success:e,fail:!!n}),Ei(Fe,{children:[qe("h3",{children:ft}),qe("p",{children:De}),!ee&&z&&!ae?Ei("p",{children:["Still here?"," ",qe("a",{href:z,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),de?qe(O,{onClick:()=>L&&L?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Nr.ERROR_USER_EXISTS&&f!==h?qe(O,{onClick:u,children:"Use a different wallet"}):ee&&!e&&Ae?qe(O,{onClick:()=>{o(!0),Ne()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&R<ac?qe(O,{onClick:()=>{B(R+1),a(void 0),ee?(o(!0),Ne()):v?.connectRetry()},disabled:!e&&(!n?.retryable||R>=ac),children:"Retry"}):!e&&!n?qe(O,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),qe(K,{})]})},C3=mm.div`
|
|
879
879
|
display: flex;
|
|
880
880
|
flex-direction: column;
|
|
881
881
|
align-items: center;
|
|
882
882
|
justify-content: center;
|
|
883
883
|
gap: 24px;
|
|
884
884
|
width: 100%;
|
|
885
|
-
`,
|
|
885
|
+
`,w3=mm.div`
|
|
886
886
|
display: flex;
|
|
887
887
|
flex-direction: column;
|
|
888
888
|
justify-content: center;
|
|
@@ -905,14 +905,14 @@ Resources:
|
|
|
905
905
|
left: -19px;
|
|
906
906
|
top: -19px;
|
|
907
907
|
}
|
|
908
|
-
`,lc=e=>{let t=e.walletLogo;return qe(hm,{children:qe(
|
|
908
|
+
`,lc=e=>{let t=e.walletLogo;return qe(hm,{children:qe(w3,{children:Ei("div",{children:[qe(Ct,{success:e.success,fail:e.fail}),typeof t=="string"?qe("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):qe(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as P3,jsx as Br,jsxs as cc}from"react/jsx-runtime";var ls=2,vm=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=_(),{walletConnectionStatus:o,closePrivyModal:n}=M(),[a,i]=gm(void 0),[l,s]=gm(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";ym(()=>{if(c){let W=setTimeout(n,Me);return()=>clearTimeout(W)}},[c]);let h=W=>{i(sc(W))};ym(()=>{o?.connectError&&h(o?.connectError)},[o]);let f=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",w=Pr[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",v=Pr[g]?.logo||o?.connector?.walletBranding.icon||(W=>Br(an,{...W})),k=w==="Browser Extension"?w.toLowerCase():w,E;c?E=`Successfully connected with ${k}`:a?E=a.message:u?E="Switching networks":E=`Waiting for ${k}`;let T="Don\u2019t see your wallet? Check your other browser windows.";return c?T="You\u2019re good to go!":l>=ls&&a?T="Unable to connect wallet":a?T=a.detail:u?T="Switch your wallet to the requested network.":g==="metamask"&&b3?T="Click to continue to open and connect MetaMask.":g==="metamask"?T="For the best experience, connect only one wallet at a time.":f==="wallet_connect_v2"?T="Open your mobile wallet app to continue":f==="coinbase_wallet"&&(T="Open the Coinbase app on your phone to continue."),cc(P3,{children:[Br(P,{backFn:r===t?void 0:e}),cc(T3,{children:[Br(lc,{walletLogo:v,success:c,fail:!!a}),cc(Fe,{children:[Br("h3",{children:E}),Br("p",{children:T})]}),a==Nr.ERROR_USER_EXISTS?Br(O,{onClick:e,children:"Use a different wallet"}):!c&&a?.retryable&&l<ls?Br(O,{onClick:()=>{s(l+1),i(void 0),o?.connectRetry()},disabled:!c&&(!a?.retryable||l>=ls),children:"Retry"}):!c&&a&&l>=ls?Br(O,{onClick:e,children:"Use a different wallet"}):null]}),Br(K,{})]})},T3=E3.div`
|
|
909
909
|
display: flex;
|
|
910
910
|
flex-direction: column;
|
|
911
911
|
align-items: center;
|
|
912
912
|
justify-content: center;
|
|
913
913
|
gap: 24px;
|
|
914
914
|
width: 100%;
|
|
915
|
-
`;import
|
|
915
|
+
`;import I3 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as M3,useMemo as W3,useState as L3}from"react";import O3 from"styled-components";import cs from"styled-components";import{jsx as pc,jsxs as A3}from"react/jsx-runtime";var Sn=()=>pc(S3,{children:A3(x3,{children:[pc(k3,{}),pc(_3,{})]})}),S3=cs.div`
|
|
916
916
|
display: flex;
|
|
917
917
|
justify-content: center;
|
|
918
918
|
align-items: center;
|
|
@@ -924,14 +924,14 @@ Resources:
|
|
|
924
924
|
@media all and (display-mode: standalone) {
|
|
925
925
|
margin-bottom: 30px;
|
|
926
926
|
}
|
|
927
|
-
`,
|
|
927
|
+
`,x3=cs.div`
|
|
928
928
|
position: relative;
|
|
929
929
|
height: 140px;
|
|
930
930
|
width: 140px;
|
|
931
931
|
|
|
932
932
|
opacity: 1;
|
|
933
933
|
animation: fadein 200ms ease;
|
|
934
|
-
`,
|
|
934
|
+
`,k3=cs.div`
|
|
935
935
|
position: absolute;
|
|
936
936
|
top: 0;
|
|
937
937
|
right: 0;
|
|
@@ -944,7 +944,7 @@ Resources:
|
|
|
944
944
|
border: 4px solid var(--privy-color-accent-light);
|
|
945
945
|
border-radius: 50%;
|
|
946
946
|
}
|
|
947
|
-
`,
|
|
947
|
+
`,_3=cs.div`
|
|
948
948
|
position: absolute;
|
|
949
949
|
top: 0;
|
|
950
950
|
right: 0;
|
|
@@ -968,13 +968,13 @@ Resources:
|
|
|
968
968
|
transform: rotate(360deg);
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
|
-
`;var Cm=["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 xn(e){let t=e.type;return typeof t=="string"&&Cm.includes(t)}function
|
|
971
|
+
`;var Cm=["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 xn(e){let t=e.type;return typeof t=="string"&&Cm.includes(t)}function R3(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Oo(e){return xn(e)&&e.type==="wallet_not_on_device"}function wm(e){return xn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function kn(e){return!!(xn(e)&&e.type==="mfa_timeout")}function _n(e){return!!(xn(e)&&e.type==="missing_or_invalid_mfa")}function dc(e){return!!(xn(e)&&e.type==="mfa_verification_max_attempts_reached")}function uc(e){return!!(xn(e)&&e.message.includes("code 429"))}function mc(e){return!!(R3(e)&&e.message==="MFA canceled")}import{Fragment as Em,jsx as An,jsxs as fc}from"react/jsx-runtime";var bm=1,Tm=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=M(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=W3(()=>Date.now(),[]),[h,f]=L3(!1),{onCompleteNavigateTo:g,onFailure:w}=l?.connectWallet,v=E=>{h||(f(!0),w(typeof E=="string"?new Error(E):E))};M3(()=>{let E=Se(t),T;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<bm?T=setTimeout(()=>{i(g)},(bm-D)*1e3):i(g)}catch(D){if(Oo(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 Oo(D)?(s({...l,recoverWallet:{privyWallet:E,onCompleteNavigateTo:g,onFailure:w}}),i("EMBEDDED_WALLET_RECOVERY_SCREEN")):v(D)}})(),()=>clearTimeout(T)):void 0},[e,t,a]);let k=()=>{v("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=k,fc(Em,{children:[An(P,{onClose:k}),h?fc(Em,{children:[fc(tr,{children:[An(I3,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),An(Pe,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),An(O,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):An(Sn,{}),An(N3,{})]})},N3=O3.div`
|
|
972
972
|
height: 44px;
|
|
973
|
-
`;import
|
|
973
|
+
`;import D3 from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as F3}from"react";import{Fragment as U3,jsx as Rn,jsxs as Pm}from"react/jsx-runtime";var Sm=()=>{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 F3(()=>{let h=setTimeout(u,pd);return()=>clearTimeout(h)},[]),i.current=u,Pm(U3,{children:[Rn(P,{onClose:u}),Rn(Z,{}),Pm(tr,{children:[Rn(D3,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),Rn(Pe,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),Rn(te,{}),Rn(q,{protectedByPrivy:!0})]})};import B3 from"@heroicons/react/20/solid/ExclamationTriangleIcon";import H3 from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as _m,useRef as G3,useState as hc}from"react";import io from"styled-components";import{Fragment as J3,jsx as Le,jsxs as ir}from"react/jsx-runtime";var Am=()=>{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:w}=s.keyExport,v=E=>{a({shouldCallAuthOnSuccess:!1}),h(typeof E=="string"?new Error(E):E)},k=()=>{a({shouldCallAuthOnSuccess:!1}),f(),i("embedded_wallet_key_export_completed",{walletAddress:u})};return _m(()=>{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=k,ir(J3,{children:[Le(P,{onClose:k}),ir(q3,{children:[ir(Pe,{icon:Le(H3,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[ir(Y3,{children:[Le(z3,{style:{marginRight:6}}),Xr(u)]}),Le("p",{children:"You can bring your account with you to another site using an external wallet."})]}),ir($3,{children:[ir(xm,{children:[Le(km,{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(xm,{children:[Le(km,{children:"2"}),Le("span",{children:"Copy this key into your other wallet"})]})]}),Le("div",{style:{width:"100%"},children:e&&Le(V3,{origin:g,appId:w,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),ir(Z3,{children:[ir("div",{children:[Le(B3,{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 V3(e){let[t,r]=hc(e.dimensions.width),[o,n]=hc(void 0),a=G3(null);return _m(()=>{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(j3,{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(K3,{children:"Loading..."})]})})}function z3(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 q3=io.div`
|
|
974
974
|
display: flex;
|
|
975
975
|
flex-direction: column;
|
|
976
976
|
text-align: left;
|
|
977
|
-
|
|
977
|
+
`,$3=io.div`
|
|
978
978
|
display: flex;
|
|
979
979
|
flex-direction: column;
|
|
980
980
|
gap: 24px;
|
|
@@ -1004,11 +1004,11 @@ Resources:
|
|
|
1004
1004
|
border-radius: 100%;
|
|
1005
1005
|
background: var(--privy-color-background);
|
|
1006
1006
|
color: var(--privy-color-accent);
|
|
1007
|
-
|
|
1007
|
+
`,j3=io.div`
|
|
1008
1008
|
overflow: visible;
|
|
1009
1009
|
position: relative;
|
|
1010
1010
|
height: 44px;
|
|
1011
|
-
`,
|
|
1011
|
+
`,K3=io.div`
|
|
1012
1012
|
position: absolute;
|
|
1013
1013
|
display: flex;
|
|
1014
1014
|
align-items: center;
|
|
@@ -1020,7 +1020,7 @@ Resources:
|
|
|
1020
1020
|
border-radius: var(--privy-border-radius-md);
|
|
1021
1021
|
background-color: var(--privy-color-background-2);
|
|
1022
1022
|
color: var(--privy-color-foreground-3);
|
|
1023
|
-
`,
|
|
1023
|
+
`,Y3=io.div`
|
|
1024
1024
|
display: flex;
|
|
1025
1025
|
align-items: center;
|
|
1026
1026
|
padding-top: 1px;
|
|
@@ -1033,7 +1033,7 @@ Resources:
|
|
|
1033
1033
|
font-size: 12px;
|
|
1034
1034
|
font-weight: 500;
|
|
1035
1035
|
margin: auto;
|
|
1036
|
-
`,
|
|
1036
|
+
`,Z3=io.div`
|
|
1037
1037
|
border: 1px solid var(--privy-color-background-2) !important;
|
|
1038
1038
|
border-radius: var(--privy-border-radius-md);
|
|
1039
1039
|
padding: 16px;
|
|
@@ -1055,7 +1055,7 @@ Resources:
|
|
|
1055
1055
|
color: var(--privy-color-error);
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
|
-
`;import
|
|
1058
|
+
`;import z0 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as tf,useRef as q0,useState as _i}from"react";import $0 from"styled-components";import{useCallback as ef,useEffect as V0}from"react";import r0 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as o0,useState as vc}from"react";import Q3 from"@heroicons/react/24/outline/ArrowPathIcon";import X3 from"@heroicons/react/24/outline/EyeIcon";import e0 from"@heroicons/react/24/outline/EyeSlashIcon";import rt,{css as yc}from"styled-components";var t0=yc`
|
|
1059
1059
|
font-size: 14px;
|
|
1060
1060
|
font-style: normal;
|
|
1061
1061
|
font-weight: 400;
|
|
@@ -1064,7 +1064,7 @@ Resources:
|
|
|
1064
1064
|
text-align: left;
|
|
1065
1065
|
transition: color 0.1s ease-in;
|
|
1066
1066
|
`,ps=rt.span`
|
|
1067
|
-
${
|
|
1067
|
+
${t0}
|
|
1068
1068
|
transition: color 0.1s ease-in;
|
|
1069
1069
|
color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1070
1070
|
text-transform: ${({error:e})=>e?"":"capitalize"};
|
|
@@ -1165,7 +1165,7 @@ Resources:
|
|
|
1165
1165
|
> :first-child {
|
|
1166
1166
|
min-width: 24px;
|
|
1167
1167
|
}
|
|
1168
|
-
`,
|
|
1168
|
+
`,pA=rt.div`
|
|
1169
1169
|
height: var(--privy-height-modal-full);
|
|
1170
1170
|
|
|
1171
1171
|
@media (max-width: 440px) {
|
|
@@ -1191,7 +1191,7 @@ Resources:
|
|
|
1191
1191
|
flex-direction: row;
|
|
1192
1192
|
justify-content: space-around;
|
|
1193
1193
|
align-items: center;
|
|
1194
|
-
`,Mm=rt(
|
|
1194
|
+
`,Mm=rt(Q3)`
|
|
1195
1195
|
height: 1.25rem;
|
|
1196
1196
|
width: 1.25rem;
|
|
1197
1197
|
stroke: var(--privy-color-accent);
|
|
@@ -1200,7 +1200,7 @@ Resources:
|
|
|
1200
1200
|
:active {
|
|
1201
1201
|
stroke: var(--privy-color-accent-light);
|
|
1202
1202
|
}
|
|
1203
|
-
`,Wn=rt(
|
|
1203
|
+
`,Wn=rt(e0)`
|
|
1204
1204
|
height: 1.25rem;
|
|
1205
1205
|
width: 1.25rem;
|
|
1206
1206
|
stroke: var(--privy-color-accent);
|
|
@@ -1209,7 +1209,7 @@ Resources:
|
|
|
1209
1209
|
:active {
|
|
1210
1210
|
stroke: var(--privy-color-accent-light);
|
|
1211
1211
|
}
|
|
1212
|
-
`,Ln=rt(
|
|
1212
|
+
`,Ln=rt(X3)`
|
|
1213
1213
|
height: 1.25rem;
|
|
1214
1214
|
width: 1.25rem;
|
|
1215
1215
|
stroke: var(--privy-color-accent);
|
|
@@ -1234,7 +1234,7 @@ Resources:
|
|
|
1234
1234
|
transition: all 0.1s ease-out;
|
|
1235
1235
|
background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
|
|
1236
1236
|
}
|
|
1237
|
-
`;import{Fragment as
|
|
1237
|
+
`;import{Fragment as n0,jsx as At,jsxs as ds}from"react/jsx-runtime";var Lm=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[a,i]=vc(!0),[l,s]=vc(!1),[c,u]=vc(""),h=r===c;return o0(()=>{c&&!l&&s(!0)},[c]),ds(n0,{children:[At(P,{title:"Confirm Password",closeable:!1,backFn:n}),At(Z,{}),ds(ao,{children:[ds(co,{children:[At(r0,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),At("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),At("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),ds(lo,{children:[At(In,{value:c,onChange:f=>u(f.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:a?"password":"text",style:{paddingRight:"2.3rem"}}),At(Mn,{style:{right:"0.75rem"},children:a?At(Wn,{onClick:()=>i(!1)}):At(Ln,{onClick:()=>i(!0)})})]}),At(ps,{"aria-hidden":!l||h,error:!0,children:"Passwords do not match"})]}),At(so,{onClick:o,loading:t,disabled:!h,hideAnimations:e,children:"Continue"}),At(te,{}),At(q,{protectedByPrivy:!0})]})};import l0 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as c0}from"react";import p0 from"styled-components";import us from"styled-components";import{jsx as Si,jsxs as s0}from"react/jsx-runtime";var Om=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>Si("label",{children:s0(i0,{className:e,children:[Si(Dm,{checked:t,...o}),Si(a0,{color:r,checked:t,children:Si(Nm,{viewBox:"0 0 24 24",children:Si("polyline",{points:"20 6 9 17 4 12"})})})]})}),i0=us.div`
|
|
1238
1238
|
display: inline-block;
|
|
1239
1239
|
vertical-align: middle;
|
|
1240
1240
|
`,Nm=us.svg`
|
|
@@ -1252,7 +1252,7 @@ Resources:
|
|
|
1252
1252
|
position: absolute;
|
|
1253
1253
|
white-space: nowrap;
|
|
1254
1254
|
width: 1px;
|
|
1255
|
-
`,
|
|
1255
|
+
`,a0=us.div`
|
|
1256
1256
|
display: inline-block;
|
|
1257
1257
|
width: 18px;
|
|
1258
1258
|
height: 18px;
|
|
@@ -1274,23 +1274,23 @@ Resources:
|
|
|
1274
1274
|
${Nm} {
|
|
1275
1275
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
1276
1276
|
}
|
|
1277
|
-
`;import{Fragment as Fm,jsx as
|
|
1277
|
+
`;import{Fragment as Fm,jsx as Gt,jsxs as xi}from"react/jsx-runtime";var Um=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=c0(!1);return xi(Fm,{children:[Gt(P,{title:"Confirm Password",closeable:!1,backFn:o}),Gt(Z,{}),xi(ao,{children:[xi(co,{children:[Gt(l0,{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(Om,{color:"var(--privy-color-error)",checked:a}),Gt(Fm,{children:"I understand losing my password means losing my account."})]})})]}),xi(d0,{children:[n.initiatedBy==="user"&&Gt(Xt,{onClick:n.onCancel,disabled:t,children:"Cancel"}),Gt(so,{onClick:r,loading:t,hideAnimations:e,disabled:!a,children:"Set Password"})]}),Gt(te,{}),Gt(q,{protectedByPrivy:!0})]})},d0=p0.div`
|
|
1278
1278
|
display: flex;
|
|
1279
1279
|
gap: 10px;
|
|
1280
|
-
`;import
|
|
1280
|
+
`;import k0 from"@heroicons/react/24/outline/KeyIcon";import $m from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as jm,useMemo as Cc,useEffect as _0}from"react";import Km from"styled-components";import u0 from"fast-password-entropy";import*as Bm from"secure-password-utilities";import{DEFAULT_WORDLIST as m0}from"secure-password-utilities/wordlists";var f0=95,h0=8,y0=3,g0=.3,v0=/[a-z]/,C0=/[A-Z]/,w0=/[0-9]/,b0="a-zA-Z0-9",Hm="!@#$%^&*()\\-_+.",Gm=`${b0}${Hm}`,E0=new RegExp(`[${Hm}]`),T0=new RegExp(`[${Gm}]`),Vm=new RegExp(`^[${Gm}]{6,}$`),zm=(e="")=>{let t=e.split("").filter(r=>!T0.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},ms=()=>Bm.generatePassphrase(4,m0);function P0(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function S0(e){if(e.length<h0)return 0;let t=0;v0.test(e)&&(t+=1),C0.test(e)&&(t+=1),w0.test(e)&&(t+=1),E0.test(e)&&(t+=1);let r=t/y0;return Math.max(0,Math.min(1,r))}function x0(e=""){let t=S0(e),r=u0(e)/f0;return(t*g0+r)/2}function qm(e=""){let t=x0(e);return{value:t,label:P0(t)}}import{Fragment as I0,jsx as $e,jsxs as Hr}from"react/jsx-runtime";var Ym=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:a,onPasswordChange:i,onPasswordGenerate:l})=>{let[s,c]=jm(!1),[u,h]=jm(!1);_0(()=>{r&&!u&&h(!0)},[r]);let f=Cc(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":Vm.test(r||"")?null:`Invalid characters used ( ${zm(r).join(" ")} )`:null,[r,u]),g=Cc(()=>f?{value:0,label:"Weak"}:qm(r),[r,f]),w=Cc(()=>!!(!r?.length||f),[f,r]);return Hr(I0,{children:[$e(P,{onClose:a,title:"Secure your account",closeable:o.initiatedBy==="user"}),$e(Z,{}),Hr(ao,{children:[Hr(co,{children:[$e(k0,{height:48,width:48,stroke:"var(--privy-color-accent)"}),$e("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),$e("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),Hr(lo,{children:[$e(In,{value:r,onChange:v=>i(v.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text",style:{paddingRight:"3.8rem"}}),Hr(Mn,{style:{width:"3.5rem"},children:[s?$e(Wn,{onClick:()=>c(!1)}):$e(Ln,{onClick:()=>c(!0)}),$e(Mm,{onClick:l})]})]}),$e(Wm,{value:g.value===0?.01:g.value,label:g.label}),$e(ps,{error:!!f,children:f||`Password Strength: ${u?g.label:"--"}`}),Hr(R0,{children:[$e(A0,{children:Hr(Ti,{children:[Hr(Pi,{children:[$e($m,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),Hr(Pi,{children:[$e($m,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),$e(so,{onClick:n,loading:t,disabled:w,hideAnimations:e,children:"Continue"})]})]}),$e(te,{}),$e(q,{protectedByPrivy:!0})]})},A0=Km(Ti)`
|
|
1281
1281
|
flex: 1;
|
|
1282
1282
|
padding-top: 1rem;
|
|
1283
|
-
`,
|
|
1283
|
+
`,R0=Km.div`
|
|
1284
1284
|
display: flex;
|
|
1285
1285
|
flex-direction: column;
|
|
1286
1286
|
height: 100%;
|
|
1287
|
-
`;import
|
|
1287
|
+
`;import M0 from"@heroicons/react/24/outline/ArrowDownTrayIcon";import W0 from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import L0 from"@heroicons/react/24/outline/DocumentDuplicateIcon";import O0 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as N0,useCallback as Zm}from"react";import{Fragment as wc,jsx as Tt,jsxs as No}from"react/jsx-runtime";var Jm=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,l]=N0(!1),s=Zm(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=Zm(()=>{let u=document.createElement("a"),h=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),f=new Blob([D0(r,o)],{type:"text/plain"}),g=URL.createObjectURL(f);u.href=g,u.target="_blank",u.download=`${h}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return No(wc,{children:[Tt(P,{backFn:a,title:"Save Password",closeable:!1}),Tt(Z,{}),No(ao,{children:[No(co,{children:[Tt(O0,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Tt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Tt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset if you lose your device. Make sure to secure it to keep your assets safe."})]}),Tt(lo,{centered:!0,children:Tt(Im,{children:o})}),No("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Tt(gc,{onClick:s,children:i?No(wc,{children:[Tt(W0,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):No(wc,{children:[Tt(L0,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),No(gc,{onClick:c,children:[Tt(M0,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Tt(so,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Tt(te,{}),Tt(q,{protectedByPrivy:!0})]})},D0=(e,t)=>`Your wallet recovery password for ${e} is
|
|
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
|
|
1291
|
+
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import F0 from"@heroicons/react/24/solid/CheckCircleIcon";import U0 from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as B0,jsx as Gr,jsxs as bc}from"react/jsx-runtime";var Qm=({error:e,onClose:t})=>bc(B0,{children:[Gr(P,{closeable:!1}),Gr(Z,{}),e?bc(tr,{children:[Gr(U0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Gr(Pe,{title:"Something went wrong",description:e})]}):bc(tr,{children:[Gr(F0,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),Gr(Pe,{title:"Success"})]}),Gr(O,{onClick:t,children:"Close"}),Gr(te,{}),Gr(q,{protectedByPrivy:!0})]});import{useReducer as H0}from"react";var G0=(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}},Xm=()=>{let[e,t]=H0(G0,"creating");return{send:t,state:e}};import{jsx as ki}from"react/jsx-runtime";var fs=({onSubmit:e,...t})=>{let{send:r,state:o}=Xm(),n=ef(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);V0(()=>{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=ef(()=>{r("back")},[r]);return o==="creating"?ki(Ym,{...t,onSubmit:n}):o==="saving"?ki(Jm,{...t,onSubmit:n,onBack:a}):o==="confirming"?ki(Lm,{...t,onSubmit:n,onBack:a}):o==="finalizing"?ki(Um,{...t,onSubmit:n,onBack:a}):o==="done"?ki(Qm,{...t,onSubmit:n}):null};import{Fragment as K0,jsx as Do,jsxs as rf}from"react/jsx-runtime";var of=()=>{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),w=q0(!1),{authenticated:v,getAccessToken:k}=G(),{refreshUser:E,closePrivyModal:T,createAnalyticsEvent:W,isNewUserThisSession:I,initializeWalletProxy:D}=M(),{onSuccess:R,onFailure:B,callAuthOnSuccessOnClose:$}=r.createWallet,V=e?.embeddedWallets.requireUserPasswordOnCreate===!0,z=!!(!n||w.current)&&!V,A=new lt(async()=>F());tf(()=>{u||D(3e4).then(Q=>h(Q))},[u]),tf(()=>{if(!v){t("LANDING"),B(new Error("User must be authenticated before creating a Privy wallet"));return}!V&&!i&&!w.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")),T({shouldCallAuthOnSuccess:!1})):f?(R(f),T({shouldCallAuthOnSuccess:$})):(B(new St("User wallet creation failed")),T({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let F=async function(){let Q=await k();if(Q)try{W("embedded_wallet_creation_started");let Y=await D(Qo);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 it=await E();if(!it)throw new Error("Failed to refresh user.");let Ne=Se(it);if(!Ne)throw new Error("Updated user is missing embedded wallet.");g(Ne),W("embedded_wallet_creation_completed",{walletAddress:Ne.address}),a(""),w.current=!0,V?t("EMBEDDED_WALLET_CREATED_SCREEN"):I?t("EMBEDDED_WALLET_CREATED_SCREEN"):Ne&&(R(Ne),T({shouldCallAuthOnSuccess:$}))}catch(Y){if(w.current)return;W("embedded_wallet_creation_failed",{error:Y.toString()}),a("An error has occurred, please try again."),console.warn(Y)}else a("An error has occured, please login again."),W("embedded_wallet_creation_failed",{error:"Missing access token for user."})},ae=async()=>{if(!V)return T({shouldCallAuthOnSuccess:$});l(!0);let Q=250;return A.execute().then(()=>new Promise(Y=>setTimeout(Y,Q))).finally(()=>l(!1))};return!V&&n?rf(K0,{children:[Do(P,{closeable:!1}),rf(tr,{children:[Do(z0,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Do(Pe,{title:"Something went wrong",description:n})]}),Do(O,{onClick:oe,children:"Close"}),Do(j0,{})]}):z?Do(Sn,{}):Do(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:ae})},j0=$0.div`
|
|
1292
1292
|
height: 44px;
|
|
1293
|
-
`;import{useEffect as
|
|
1293
|
+
`;import{useEffect as Y0,useState as hs}from"react";import{jsx as Z0}from"react/jsx-runtime";var nf=()=>{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:w}=M(),{app:v,navigate:k,data:E,onUserCloseViaDialogOrKeybindRef:T}=_(),{onSuccess:W,onFailure:I}=E.createWallet,D=Se(u),R=e?.recoveryMethod==="user-passcode";Y0(()=>{s||(k("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})};T.current=B;let $=async()=>{let z=await c();if(z&&D?.address&&i&&h)try{if(w("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")),w("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")),w("embedded_wallet_set_password_failed",{walletAddress:D.address,reason:"wallet disconnected"});return}t(F),w("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")),w("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 Z0(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 J0 from"@heroicons/react/24/outline/UserCircleIcon";import Q0 from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as X0,jsx as Vr,jsxs as ys}from"react/jsx-runtime";var af=()=>{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(X0,{children:[Vr(P,{onClose:c}),Vr(Z,{}),ys(tr,{children:[ys(Gu,{children:[Vr(J0,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Vr(Vu,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Vr(Q0,{width:"12px",height:"12px",fill:"white"})})]}),ys(Pe,{title:"Secure Your Account",children:["Please set a password to secure your account.",Vr("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."})]})]}),Vr(O,{onClick:()=>{let h=Se(e);r("embedded_wallet_set_password_started",{walletAddress:h?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),a("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Vr(te,{}),Vr(q,{protectedByPrivy:!0})]})};import ev from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as tv,useState as gs}from"react";import vs,{css as rv}from"styled-components";import{Fragment as sv,jsx as pt,jsxs as Fo}from"react/jsx-runtime";var sf=()=>{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(""),[w,v]=gs(!1),{privyWallet:k,onCompleteNavigateTo:E,onSuccess:T,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,tv(()=>{if(!r||!k)return I("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let D=B=>{B&&h(B)};return Fo(sv,{children:[pt(P,{onClose:I}),pt(Z,{}),Fo(nv,{children:[Fo(ov,{children:[pt(ev,{height:48,width:48,stroke:"var(--privy-color-accent)"}),pt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),pt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),Fo("div",{children:[Fo(lo,{children:[pt(In,{type:e?"password":"text",onChange:B=>D(B.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),pt(Mn,{style:{right:"0.75rem"},children:e?pt(Wn,{onClick:()=>t(!1)}):pt(Ln,{onClick:()=>t(!0)})})]}),!!f&&pt(iv,{children:f})]}),Fo("div",{children:[Fo(Hu,{children:[pt("h4",{children:"Why is this necessary?"}),pt("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),pt(av,{loading:w||!n,disabled:!u,onClick:async()=>{v(!0);let B=await o();if(B&&k&&u!==null)try{i("embedded_wallet_recovery_started",{walletAddress:k.address}),await n?.recover({address:k.address,accessToken:B,recoveryPin:u}),g(""),E?l(E):a({shouldCallAuthOnSuccess:!1}),T?.(k),i("embedded_wallet_recovery_completed",{walletAddress:k.address})}catch($){wm($)?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:!k&&w,children:"Recover your account"})]})]}),pt(te,{}),pt(q,{protectedByPrivy:!0})]})},ov=vs.div`
|
|
1294
1294
|
display: flex;
|
|
1295
1295
|
flex-direction: column;
|
|
1296
1296
|
align-items: center;
|
|
@@ -1312,26 +1312,26 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1312
1312
|
font-weight: 400;
|
|
1313
1313
|
line-height: 20px;
|
|
1314
1314
|
}
|
|
1315
|
-
`,
|
|
1315
|
+
`,nv=vs.div`
|
|
1316
1316
|
display: flex;
|
|
1317
1317
|
flex-direction: column;
|
|
1318
1318
|
justify-content: space-between;
|
|
1319
|
-
`,
|
|
1319
|
+
`,iv=vs.div`
|
|
1320
1320
|
line-height: 20px;
|
|
1321
1321
|
height: 20px;
|
|
1322
1322
|
font-size: 13px;
|
|
1323
1323
|
color: var(--privy-color-error);
|
|
1324
1324
|
text-align: left;
|
|
1325
1325
|
margin-top: 0.5rem;
|
|
1326
|
-
`,
|
|
1327
|
-
${e=>e.hideAnimations&&
|
|
1326
|
+
`,av=vs(O)`
|
|
1327
|
+
${e=>e.hideAnimations&&rv`
|
|
1328
1328
|
&& {
|
|
1329
1329
|
// Remove animations because the recoverWallet task on the iframe partially
|
|
1330
1330
|
// blocks the renderer, so the animation stutters and doesn't look good
|
|
1331
1331
|
transition: none;
|
|
1332
1332
|
}
|
|
1333
1333
|
`}
|
|
1334
|
-
`;import
|
|
1334
|
+
`;import lv from"@heroicons/react/24/outline/ExclamationTriangleIcon";import cv from"@heroicons/react/24/outline/PhoneIcon";import lf from"styled-components";import{Fragment as mv,jsx as ar,jsxs as Cs}from"react/jsx-runtime";var pv=e=>{let t=ar(lv,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof x)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof be&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:ar(cv,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Ie)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:ar(ns,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:ar("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:ar("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Yt&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},cf=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_(),{reset:a}=ye(),i=r?.errorModalData,l=pv(i?.error||new Error),s=c=>{if(c instanceof Ie)switch(c.privyErrorCode){case"invalid_captcha":return()=>a()}return()=>{}};return Cs(mv,{children:[ar(P,{backFn:!o||n===o?void 0:t}),Cs(dv,{children:[ar(Et,{children:Cs("div",{children:[ar(os,{color:"var(--privy-color-error)"}),l.icon]})}),Cs(uv,{children:[ar("h3",{children:l.title}),ar("p",{children:l.detail})]}),ar(O,{color:"var(--privy-color-error)",onClick:()=>{s(i?.error||new Error)(),e(o||"LANDING",!1)},children:l.ctaText})]})]})},dv=lf.div`
|
|
1335
1335
|
display: flex;
|
|
1336
1336
|
flex-direction: column;
|
|
1337
1337
|
align-items: center;
|
|
@@ -1339,11 +1339,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1339
1339
|
gap: 24px;
|
|
1340
1340
|
width: 100%;
|
|
1341
1341
|
padding-bottom: 16px;
|
|
1342
|
-
`,
|
|
1342
|
+
`,uv=lf.div`
|
|
1343
1343
|
display: flex;
|
|
1344
1344
|
flex-direction: column;
|
|
1345
1345
|
gap: 8px;
|
|
1346
|
-
`;import{useEffect as gf,useRef as
|
|
1346
|
+
`;import{useEffect as gf,useRef as Wv,useState as Pc}from"react";import{isIOS as Lv,isMobile as vf}from"react-device-detect";import bf from"styled-components";import{useState as fv}from"react";import hv from"styled-components";import{jsx as pf}from"react/jsx-runtime";var ws=({style:e,color:t,...r})=>pf("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:pf("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as Ec}from"react/jsx-runtime";var df=({color:e,...t})=>Ec("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:Ec("g",{children:Ec("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as uf,jsxs as gv}from"react/jsx-runtime";var po=e=>{let[t,r]=fv(!1);return gv(yv,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?uf(ws,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):uf(df,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},yv=hv.button`
|
|
1347
1347
|
display: flex;
|
|
1348
1348
|
align-items: center;
|
|
1349
1349
|
gap: 6px;
|
|
@@ -1381,7 +1381,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1381
1381
|
width: 14px;
|
|
1382
1382
|
height: 14px;
|
|
1383
1383
|
}
|
|
1384
|
-
`;import{useState as
|
|
1384
|
+
`;import{useState as vv}from"react";import Cv from"styled-components";import{jsx as bv}from"react/jsx-runtime";var bs=e=>{let[t,r]=vv(!1);return bv(wv,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},wv=Cv.a`
|
|
1385
1385
|
display: flex;
|
|
1386
1386
|
align-items: center;
|
|
1387
1387
|
gap: 6px;
|
|
@@ -1419,7 +1419,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1419
1419
|
width: 14px;
|
|
1420
1420
|
height: 14px;
|
|
1421
1421
|
}
|
|
1422
|
-
`;import
|
|
1422
|
+
`;import Ev from"qrcode";import Tv from"react";import Pv from"styled-components";import{jsx as mf}from"react/jsx-runtime";var ff=()=>mf("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:mf("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as Ai,jsx as dt,jsxs as yf}from"react/jsx-runtime";var Rt=7,Tc=(e,t,r,o,n)=>{for(let a=t;a<t+o;a++)for(let i=r;i<r+n;i++){let l=e?.[i];l&&l[a]&&(l[a]=0)}return e},Sv=e=>{let t=Ev.create(e,{errorCorrectionLevel:"high"}).modules,r=vd(Array.from(t.data),t.size);return r=Tc(r,0,0,Rt,Rt),r=Tc(r,r.length-Rt,0,Rt,Rt),r=Tc(r,0,r.length-Rt,Rt,Rt),r},xv=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>dt(Ai,{children:[0,1,2].map(a=>dt("circle",{r:r*(Rt-a*2)/2,cx:e+r*Rt/2,cy:t+r*Rt/2,fill:a%2!==0?o:n},`finder-${e}-${t}-${a}`))}),kv=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Rt)*e,0],[0,(t-Rt)*e]];return dt(Ai,{children:n.map(([a,i])=>dt(xv,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},_v=({matrix:e,cellSize:t,color:r})=>dt(Ai,{children:e.map((o,n)=>o.map((a,i)=>a?dt("circle",{r:t/2.5,cx:n*t+t/2,cy:i*t+t/2,fill:r},`circle-${n}-${i}`):dt(Tv.Fragment,{},`circle-${n}-${i}`)))}),hf=(e,t)=>e-e%t,Av=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:a})=>{if(!r)return dt(Ai,{});let i=o||40,l=n||4,s=r,c=e/2-i/2-l;return yf(Ai,{children:[dt("rect",{x:hf(c,t),y:hf(c,t),width:i+l*2+(c%t?t+.5:.5),height:i+l*2+(c%t?t+.5:.5),fill:a}),dt(s,{x:e/2-i/2,y:e/2-i/2,height:i,width:i})]})},Rv=e=>{let t=e.outputSize,r=Sv(e.url),o=t/r.length;return yf("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[dt(_v,{matrix:r,cellSize:o,color:e.fgColor}),dt(kv,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),dt(Av,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},Iv=Pv.div`
|
|
1423
1423
|
display: flex;
|
|
1424
1424
|
justify-content: center;
|
|
1425
1425
|
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
|
-
`,On=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return dt(
|
|
1437
|
+
`,On=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return dt(Iv,{size:o,bgColor:t,fgColor:r,children:dt(Rv,{url:e.url,logo:{element:e.squareLogoElement??ff},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as Es,jsxs as Mv}from"react/jsx-runtime";var Sr=({style:e,...t})=>Mv("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 Cf="#8a63d2",Ef=1e3,Ov=Ef*2,Nv=Ef*120,Tf=()=>{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,w]=Pc(void 0),[v,k]=Pc(!1),[E,T]=Pc(!1),W=Wv([]),I=s?.render.inDialog?Me:0,D=c(),R=D?.meta.connectUri;return gf(()=>{let B=Date.now(),$=setInterval(async()=>{let V=await D.pollForReady.execute(),z=Date.now()-B;if(V){clearInterval($),k(!0);try{await u(),T(!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.");w(oe)}}else z>Nv&&(clearInterval($),w({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},Ov);return()=>{clearInterval($),W.current.forEach(V=>clearTimeout(V))}},[]),gf(()=>{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]),vf||v?xr(Ts,{children:[he(P,{backFn:n?i:void 0,onClose:h},"header"),he(Z,{}),Lv?he(Ts,{children:xr(Dv,{children:[he(Et,{children:xr("div",{children:[he(Ct,{success:E,fail:!!g}),he(Sr,{style:{width:"38px",height:"38px"}})]})}),xr(Fe,{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(O,{onClick:B=>{B.preventDefault(),window.location.href=R},children:"Open Warpcast app"})]})}):he(Ts,{children:xr(wf,{children:[he(Et,{children:xr("div",{children:[he(Ct,{success:E,fail:!!g}),he(Sr,{style:{width:"38px",height:"38px"}})]})}),xr(Fe,{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&&vf&&he(bs,{text:"Take me to Warpcast",url:R,color:Cf})})]})]})}),he(K,{})]}):xr(Ts,{children:[he(P,{backFn:n?i:void 0,onClose:h},"header"),he(Z,{}),he(wf,{children:xr("div",{children:[he(we,{children:"Sign in with Farcaster"}),he(fe,{children:"Scan with your phone's camera to continue."}),he(gn,{children:R?he(On,{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(po,{text:R,itemName:"link",color:Cf})]})]})}),he(K,{})]})},wf=bf.div`
|
|
1438
1438
|
display: flex;
|
|
1439
1439
|
flex-direction: column;
|
|
1440
1440
|
align-items: center;
|
|
@@ -1442,14 +1442,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1442
1442
|
margin-left: 27px;
|
|
1443
1443
|
margin-right: 27px;
|
|
1444
1444
|
gap: 24px;
|
|
1445
|
-
`,
|
|
1445
|
+
`,Dv=bf.div`
|
|
1446
1446
|
display: flex;
|
|
1447
1447
|
flex-direction: column;
|
|
1448
1448
|
align-items: center;
|
|
1449
1449
|
justify-content: center;
|
|
1450
1450
|
gap: 24px;
|
|
1451
1451
|
width: 100%;
|
|
1452
|
-
`;import{useEffect as
|
|
1452
|
+
`;import{useEffect as Fv,useRef as Uv,useState as Sc}from"react";import{isIOS as Bv,isMobile as Pf}from"react-device-detect";import kf from"styled-components";import{Fragment as Ps,jsx as ge,jsxs as sr}from"react/jsx-runtime";var Sf="#8a63d2",_f=1e3,Hv=_f*2,Gv=_f*300,Af=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=_(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=M(),[i,l]=Sc(void 0),[s,c]=Sc(!1),[u,h]=Sc(!1),f=Uv([]),g=o?.render.inDialog?Me:0,w=r?.farcasterSigner;Fv(()=>{let k=Date.now(),E=setInterval(async()=>{if(!w?.public_key){clearInterval(E),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}w.status==="approved"&&(clearInterval(E),c(!1),h(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let T=await n(w?.public_key),W=Date.now()-k;T.status==="approved"?(clearInterval(E),c(!1),h(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):W>Gv?(clearInterval(E),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):T.status==="revoked"&&(clearInterval(E),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},Hv);return()=>{clearInterval(E),f.current.forEach(T=>clearTimeout(T))}},[]);let v=w?.status==="pending_approval"?w.signer_approval_url:void 0;return Pf||s?sr(Ps,{children:[ge(P,{backFn:e?t:void 0,onClose:a},"header"),ge(Z,{}),Bv?ge(Ps,{children:sr(Vv,{children:[ge(Et,{children:sr("div",{children:[ge(Ct,{success:u,fail:!!i}),ge(Sr,{style:{width:"38px",height:"38px"}})]})}),sr(Fe,{children:[ge(we,{children:i?i.message:"Add a signer to Farcaster"}),ge(fe,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),v&&ge(O,{onClick:k=>{k.preventDefault(),window.location.href=v},children:"Open Warpcast app"})]})}):ge(Ps,{children:sr(xf,{children:[ge(Et,{children:sr("div",{children:[ge(Ct,{success:u,fail:!!i}),ge(Sr,{style:{width:"38px",height:"38px"}})]})}),sr(Fe,{children:[ge(we,{children:i?i.message:"Requesting signer from Farcaster"}),ge(fe,{children:i?i.detail:"This should only take a moment"}),ge(ct,{children:v&&Pf&&ge(bs,{text:"Take me to Warpcast",url:v,color:Sf})})]})]})}),ge(K,{})]}):sr(Ps,{children:[ge(P,{backFn:e?t:void 0,onClose:a},"header"),ge(Z,{}),ge(xf,{children:sr("div",{children:[ge(we,{children:"Add a signer to Farcaster"}),sr(fe,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),ge(gn,{children:w?.status==="pending_approval"?ge(On,{url:w.signer_approval_url,size:275,squareLogoElement:Sr}):ge(wt,{})}),sr(ct,{children:[ge(fe,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),w?.status==="pending_approval"&&ge(po,{text:w.signer_approval_url,itemName:"link",color:Sf})]})]})}),ge(K,{})]})},xf=kf.div`
|
|
1453
1453
|
display: flex;
|
|
1454
1454
|
flex-direction: column;
|
|
1455
1455
|
align-items: center;
|
|
@@ -1457,14 +1457,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1457
1457
|
margin-left: 27px;
|
|
1458
1458
|
margin-right: 27px;
|
|
1459
1459
|
gap: 24px;
|
|
1460
|
-
`,
|
|
1460
|
+
`,Vv=kf.div`
|
|
1461
1461
|
display: flex;
|
|
1462
1462
|
flex-direction: column;
|
|
1463
1463
|
align-items: center;
|
|
1464
1464
|
justify-content: center;
|
|
1465
1465
|
gap: 24px;
|
|
1466
1466
|
width: 100%;
|
|
1467
|
-
`;import
|
|
1467
|
+
`;import qv from"@heroicons/react/24/outline/ClockIcon";import $v from"@heroicons/react/24/outline/EyeSlashIcon";import jv from"@heroicons/react/24/outline/LinkIcon";import kr from"styled-components";import{jsx as xc,jsxs as zv}from"react/jsx-runtime";var Ss=({size:e=61,...t})=>xc("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:zv("g",{id:"moonpay_symbol_wht 2",children:[xc("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),xc("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});import{Fragment as Rf,jsx as ut,jsxs as Uo}from"react/jsx-runtime";var kc=({title:e,desc:t,icon:r})=>Uo(Xv,{children:[ut(tC,{children:r}),Uo(eC,{children:[ut(Jv,{children:e}),ut(Qv,{children:t})]})]}),If=({app:e,signedUrl:t,onContinue:r})=>Uo(Rf,{children:[Uo(Yv,{children:[ut(Ss,{size:"3.75rem"}),Uo(Zv,{children:[e?.name," uses ",ut("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),Uo(rC,{children:[ut(kc,{icon:ut(jv,{width:"1rem"}),title:"Purchase assets to fund your account",desc:Uo(Rf,{children:["Connect a payment method (",ut("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),ut(kc,{icon:ut(qv,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),ut(kc,{icon:ut($v,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),ut(oC,{className:"mobile-only"})]}),ut(Kv,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),ut(Ka,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),Kv=kr.span`
|
|
1468
1468
|
display: inline-block;
|
|
1469
1469
|
color: var(--privy-color-foreground-3);
|
|
1470
1470
|
text-align: center;
|
|
@@ -1473,13 +1473,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1473
1473
|
font-weight: 400;
|
|
1474
1474
|
line-height: 140%; /* 0.875rem */
|
|
1475
1475
|
margin-bottom: 0.25rem;
|
|
1476
|
-
`,
|
|
1476
|
+
`,Yv=kr.div`
|
|
1477
1477
|
display: flex;
|
|
1478
1478
|
flex-direction: column;
|
|
1479
1479
|
align-items: center;
|
|
1480
1480
|
justify-content: center;
|
|
1481
1481
|
padding: 1.5rem 0;
|
|
1482
|
-
`,
|
|
1482
|
+
`,Zv=kr.span`
|
|
1483
1483
|
color: var(--privy-color-foreground);
|
|
1484
1484
|
text-align: center;
|
|
1485
1485
|
font-size: 1.125rem;
|
|
@@ -1488,46 +1488,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1488
1488
|
margin: 1.5rem 0;
|
|
1489
1489
|
text-align: center;
|
|
1490
1490
|
max-width: 19.5rem;
|
|
1491
|
-
`,
|
|
1491
|
+
`,Jv=kr.span`
|
|
1492
1492
|
color: var(--privy-color-foreground);
|
|
1493
1493
|
font-size: 0.875rem;
|
|
1494
1494
|
font-weight: 500;
|
|
1495
1495
|
line-height: 1.225rem;
|
|
1496
1496
|
width: 100%;
|
|
1497
|
-
`,
|
|
1497
|
+
`,Qv=kr.span`
|
|
1498
1498
|
color: var(--privy-color-foreground-2);
|
|
1499
1499
|
font-size: 0.875rem;
|
|
1500
1500
|
font-weight: 400;
|
|
1501
1501
|
line-height: 1.225rem;
|
|
1502
|
-
`,
|
|
1502
|
+
`,Xv=kr.div`
|
|
1503
1503
|
display: flex;
|
|
1504
1504
|
align-items: flex-start;
|
|
1505
1505
|
gap: 0.5rem;
|
|
1506
1506
|
align-self: stretch;
|
|
1507
|
-
`,
|
|
1507
|
+
`,eC=kr.div`
|
|
1508
1508
|
display: flex;
|
|
1509
1509
|
flex-direction: column;
|
|
1510
1510
|
gap: 0.25rem;
|
|
1511
1511
|
align-items: flex-start;
|
|
1512
1512
|
text-align: left;
|
|
1513
1513
|
flex: 1 0 0;
|
|
1514
|
-
`,
|
|
1514
|
+
`,tC=kr.div`
|
|
1515
1515
|
padding-top: 2px;
|
|
1516
|
-
`,
|
|
1516
|
+
`,rC=kr.div`
|
|
1517
1517
|
display: flex;
|
|
1518
1518
|
flex-direction: column;
|
|
1519
1519
|
gap: 1.25rem;
|
|
1520
1520
|
margin: 0 0.5rem;
|
|
1521
|
-
`,
|
|
1521
|
+
`,oC=kr.div`
|
|
1522
1522
|
margin: 30px 0;
|
|
1523
|
-
`;import{ofetch as
|
|
1523
|
+
`;import{ofetch as nC}from"ofetch";import{useEffect as iC,useRef as aC,useState as sC}from"react";var xs="moonpay",Mf="sdk_fiat_on_ramp_completed_with_status";async function Wf(e,t,r,o,n=!1){let a=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},i=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...a,...i}})}async function lC(e,t){let r=t?ud:dd,o=t?fd:md;return nC(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Lf(e,t=!1){let[r,o]=sC(null),{createAnalyticsEvent:n}=M(),a=aC(0);return iC(()=>{let i=setInterval(async()=>{if(e)try{let[l]=await lC(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(Mf,{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(Mf,{status:"serviceFailure",provider:xs}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}import{Fragment as cC,jsx as _c,jsxs as pC}from"react/jsx-runtime";var Of=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=M(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:pC(cC,{children:[_c(P,{title:"Fund account"},"header"),_c(If,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:xs}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),_c(q,{protectedByPrivy:!0})]})};import dC from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import uC from"@heroicons/react/24/solid/CheckCircleIcon";import mC from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as fC}from"react";import Nf from"styled-components";import{Fragment as Ac,jsx as mt,jsxs as Bo}from"react/jsx-runtime";var Df=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=M(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Lf(o||null,e.fiatOnRamp.useSandbox);return Bo(Ac,{children:[mt(P,{title:"Fund account"},"header"),mt(yC,{status:n,onClickCta:r}),mt(q,{protectedByPrivy:!0})]})},hC=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:Bo(Ac,{children:[Bo("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:""}}},yC=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=fC(()=>hC(e),[e]);return Bo(Ac,{children:[Bo(bC,{children:[mt(CC,{status:e}),Bo(Fe,{children:[mt("h3",{children:r}),mt(wC,{children:o})]})]}),n&&mt(O,{onClick:t,children:n})]})},gC=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)",vC=e=>{switch(e){case"serviceFailure":case"failed":return mC;case"completed":return uC;case"waitingAuthorization":return()=>mt(dC,{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}},CC=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Bo("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=vC(e),r=gC(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})})},wC=Nf.p`
|
|
1524
1524
|
font-size: 1rem;
|
|
1525
1525
|
color: var(--privy-color-foreground-3);
|
|
1526
1526
|
margin-bottom: 1rem;
|
|
1527
1527
|
display: flex;
|
|
1528
1528
|
flex-direction: column;
|
|
1529
1529
|
gap: 1rem;
|
|
1530
|
-
`,
|
|
1530
|
+
`,bC=Nf.div`
|
|
1531
1531
|
display: flex;
|
|
1532
1532
|
flex-direction: column;
|
|
1533
1533
|
align-items: center;
|
|
@@ -1535,7 +1535,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1535
1535
|
margin-left: 1.75rem;
|
|
1536
1536
|
margin-right: 1.75rem;
|
|
1537
1537
|
padding: 2rem 0;
|
|
1538
|
-
`;import
|
|
1538
|
+
`;import EC from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import TC from"styled-components";import{Fragment as SC,jsx as uo,jsxs as xC}from"react/jsx-runtime";var Ff=()=>{let{closePrivyModal:e}=M();return xC(SC,{children:[uo(P,{},"header"),uo(PC,{children:uo(EC,{style:{width:32,height:32}})}),uo(Er,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),uo(Ht,{children:uo(O,{onClick:()=>e(),children:"Close"})}),uo(te,{}),uo(q,{protectedByPrivy:!0})]})},PC=TC.div`
|
|
1539
1539
|
border-radius: 50%;
|
|
1540
1540
|
height: 68px;
|
|
1541
1541
|
width: 68px;
|
|
@@ -1545,7 +1545,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1545
1545
|
background-color: var(--privy-color-accent);
|
|
1546
1546
|
color: white;
|
|
1547
1547
|
margin: 0 auto 24px auto;
|
|
1548
|
-
`;import*as Gf from"react-device-detect";import
|
|
1548
|
+
`;import*as Gf from"react-device-detect";import RC from"styled-components";import Rc from"styled-components";import{jsx as Uf}from"react/jsx-runtime";var Bf=({style:e,...t})=>Uf("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:Uf("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as _C,jsxs as AC}from"react/jsx-runtime";var Hf=Rc.div`
|
|
1549
1549
|
display: flex;
|
|
1550
1550
|
flex-direction: column;
|
|
1551
1551
|
justify-content: flex-start;
|
|
@@ -1556,7 +1556,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1556
1556
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1557
1557
|
height: 12px;
|
|
1558
1558
|
}
|
|
1559
|
-
`,ks=({children:e})=>
|
|
1559
|
+
`,ks=({children:e})=>AC(kC,{children:[_C(Bf,{style:{width:"16px",height:"16px"}}),e]}),kC=Rc.div`
|
|
1560
1560
|
display: flex;
|
|
1561
1561
|
justify-content: flex-start;
|
|
1562
1562
|
justify-items: center;
|
|
@@ -1574,15 +1574,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1574
1574
|
margin-bottom: auto;
|
|
1575
1575
|
}
|
|
1576
1576
|
}
|
|
1577
|
-
`;import{Fragment as
|
|
1577
|
+
`;import{Fragment as WC,jsx as je,jsxs as Ri}from"react/jsx-runtime";var IC=()=>Ri(MC,{children:[je(yi,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),je(ct,{children:je(gr,{style:{width:"152px",height:"152px"}})}),Ri(Hf,{children:[je(ks,{children:Ri("div",{children:[je("span",{children:"Install the "}),je("a",{href:Gf.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),je(Ic,{}),je(ks,{children:"Set up your first wallet"}),je(Ic,{}),je(ks,{children:"Store your recovery phrase in a safe place!"})]}),je(Ya,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Vf=()=>{let{navigateBack:e}=_();return Ri(WC,{children:[je(P,{backFn:e},"header"),je(Z,{}),je(IC,{}),je(te,{}),Ri(K,{children:[je("span",{children:"Still not sure? "}),je("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},MC=RC(ct)`
|
|
1578
1578
|
gap: 30px;
|
|
1579
1579
|
|
|
1580
1580
|
> :first-child > svg {
|
|
1581
1581
|
margin-top: 20px;
|
|
1582
1582
|
}
|
|
1583
|
-
`;import
|
|
1583
|
+
`;import w4 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as b4,useState as ah}from"react";import{isMobile as E4}from"react-device-detect";import T4 from"styled-components";import UC from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as BC}from"react";import LC from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as OC,useState as zf}from"react";import $f from"styled-components";import{Fragment as FC,jsx as Ii,jsxs as qf}from"react/jsx-runtime";var _s=OC((e,t)=>{let[r,o]=zf(""),[n,a]=zf(!1),{authenticated:i}=G(),{initLoginWithEmail:l}=M(),{navigate:s,setModalData:c,currentScreen:u}=_(),{enabled:h,token:f}=ye(),g=da(r),w=n,v=n||!g,k=T=>{a(!0),l(r,T).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(W=>{c({errorModalData:{error:W,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{a(!1)})},E=()=>{h&&!f&&!i?(c({captchaModalData:{callback:T=>l(r,T),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):k(f)};return qf(FC,{children:[Ii(NC,{children:qf(DC,{stacked:e.stacked,children:[Ii(LC,{}),Ii("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:T=>o(T.target.value),onKeyUp:T=>{T.key==="Enter"&&E()},value:r,autoComplete:"email"}),e.stacked?null:Ii(un,{isSubmitting:w,onClick:E,disabled:v,children:"Submit"})]})}),e.stacked?Ii(O,{loadingText:null,loading:w,disabled:v,onClick:E,children:"Submit"}):null]})}),NC=$f.div`
|
|
1584
1584
|
width: 100%;
|
|
1585
|
-
`,
|
|
1585
|
+
`,DC=$f.label`
|
|
1586
1586
|
display: block;
|
|
1587
1587
|
position: relative;
|
|
1588
1588
|
width: 100%;
|
|
@@ -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
|
|
1646
|
+
`;import{Fragment as HC,jsx as As,jsxs as jf}from"react/jsx-runtime";var Rs=({isEditable:e,setIsEditable:t})=>{let r=BC(null);return jf(HC,{children:[As(Ur,{if:!e,children:As(_s,{ref:r})}),As(Ur,{if:e,children:jf(Te,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[As(UC,{})," Continue with Email"]})})]})};import{useState as GC}from"react";import{jsx as Mc,jsxs as VC}from"react/jsx-runtime";var Is=()=>{let[e,t]=GC(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:a,token:i}=ye(),{initLoginWithFarcaster:l}=M();return VC(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(Fr,{})})]})};import zC,{css as qC}from"styled-components";import{jsx as KC}from"react/jsx-runtime";var Ms=()=>{let{enabled:e,token:t}=ye(),{navigate:r,setModalData:o}=_(),{loginWithPasskey:n}=M();return KC(jC,{onClick:()=>{e&&!t?(o({captchaModalData:{callback:i=>n(i),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSKEY_SYSTEM_DIALOGUE",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):r("AWAITING_PASSKEY_SYSTEM_DIALOGUE")},children:"Log in with a passkey"})},$C=qC`
|
|
1647
1647
|
&& {
|
|
1648
1648
|
width: 100%;
|
|
1649
1649
|
font-size: 0.875rem;
|
|
@@ -1668,11 +1668,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1668
1668
|
box-shadow: none;
|
|
1669
1669
|
}
|
|
1670
1670
|
}
|
|
1671
|
-
|
|
1672
|
-
${
|
|
1673
|
-
`;import
|
|
1671
|
+
`,jC=zC.button`
|
|
1672
|
+
${$C}
|
|
1673
|
+
`;import s4 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as l4}from"react";import{forwardRef as o4,useState as Wc}from"react";import Xf from"styled-components";import YC from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as ZC,AsYouType as JC,getCountries as QC,getCountryCallingCode as Ws,getExampleNumber as XC}from"libphonenumber-js/min";import{jsx as r4,jsxs as t4}from"react/jsx-runtime";var Mi=(e,t)=>ZC(String(e),t),Ls=(e,t)=>`+${Ws(t)} ${e}`,Kf=e=>`*${e.replaceAll("-","").slice(-4)}`,Yf=e=>new JC(e),e4=QC().map(e=>({code:e,callCode:Ws(e)})),Zf=e=>{let t=XC(e,YC)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},Jf=({value:e,onChange:t})=>r4("select",{value:e,onChange:t,children:e4.map(r=>t4("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as a4,jsx as Wi,jsxs as Qf}from"react/jsx-runtime";var Nn=o4((e,t)=>{let{app:r}=_(),[o,n]=Wc(""),[a,i]=Wc(r?.intl.defaultCountry??"US"),l=Mi(o,a),s=Yf(a),c=Zf(a),u=Ws(a),h=!l,[f,g]=Wc(!1),w=u.length,v=T=>{let W=T.target.value;i(W),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:Ls(o,W),countryCode:W,isValid:Mi(o,a)})},k=T=>{try{let W=T.replace(/\D/g,""),I=o.replace(/\D/g,""),D=W===I?T:s.input(T);n(D),e.onChange&&e.onChange({rawPhoneNumber:D,qualifiedPhoneNumber:Ls(T,a),countryCode:a,isValid:Mi(T,a)})}catch(W){console.error("Error processing phone number:",W)}},E=()=>{g(!0);let T=Ls(o,a);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:T,countryCode:a,isValid:Mi(o,a)}).finally(()=>g(!1))};return Qf(a4,{children:[Wi(n4,{children:Qf(i4,{callingCodeLength:w,stacked:e.stacked,children:[Wi(Jf,{value:a,onChange:v}),Wi("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:T=>{k(T.target.value)},onKeyUp:T=>{T.key==="Enter"&&E()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?Wi(un,{isSubmitting:f,onClick:E,disabled:h,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?Wi(O,{loading:f,loadingText:null,onClick:E,disabled:h,children:"Submit"}):null]})}),n4=Xf.div`
|
|
1674
1674
|
width: 100%;
|
|
1675
|
-
`,
|
|
1675
|
+
`,i4=Xf.label`
|
|
1676
1676
|
--country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
|
|
1677
1677
|
--phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
|
|
1678
1678
|
display: block;
|
|
@@ -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 l4,jsx as Os,jsxs as eh}from"react/jsx-runtime";var Ns=({isEditable:e,setIsEditable:t})=>{let r=s4(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=_(),{initLoginWithSms:l}=M(),{enabled:s,token:c}=ge();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 eh(l4,{children:[Os(Fr,{if:!e,children:Os(Nn,{ref:r,onSubmit:u})}),Os(Fr,{if:e,children:eh(Te,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Os(a4,{})," Continue with SMS"]})})]})};import{useState as f4}from"react";import{jsx as th,jsxs as c4}from"react/jsx-runtime";var Ds=({style:e,...t})=>c4("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:[th("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"}),th("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 p4}from"react/jsx-runtime";var Fs=({style:e,...t})=>p4("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 rh}from"react/jsx-runtime";var Us=({style:e,...t})=>rh("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:rh("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 d4}from"react/jsx-runtime";var Hs=({style:e,...t})=>d4("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 oh,jsxs as u4}from"react/jsx-runtime";function zs(e){return u4("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[oh("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"}),oh("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 m4}from"react/jsx-runtime";function qs(e){return m4("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 nh}from"react/jsx-runtime";var $s=({style:e,...t})=>nh("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:nh("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 mo,jsxs as y4}from"react/jsx-runtime";var h4={apple:{logo:mo(Ds,{}),displayName:"Apple"},discord:{logo:mo(Fs,{}),displayName:"Discord"},github:{logo:mo(Us,{}),displayName:"GitHub"},google:{logo:mo(Hs,{}),displayName:"Google"},linkedin:{logo:mo(Vs,{}),displayName:"LinkedIn"},spotify:{logo:mo(zs,{}),displayName:"Spotify"},twitter:{logo:mo($s,{}),displayName:"Twitter"},tiktok:{logo:mo(qs,{}),displayName:"TikTok"}},Ke=({provider:e})=>{let{enabled:t,token:r}=ge(),{navigate:o,setModalData:n}=_(),[a,i]=f4(!1),{initLoginWithOAuth:l}=M(),{displayName:s,logo:c}=h4[e];return y4(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 g4 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as ih,jsxs as v4}from"react/jsx-runtime";var js=({onClick:e,text:t,icon:r})=>v4(Te,{onClick:e,children:[r,ih(Ja,{children:t}),ih(g4,{})]});import{Fragment as Oc,jsx as Ue,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]=ah("default"),[h,f]=ah("email");w4(()=>{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 w=R=>R==="email"?Ue(Rs,{isEditable:h==="email",setIsEditable:()=>{f("email")}},R):R==="sms"?Ue(Ns,{isEditable:h==="sms",setIsEditable:()=>{f("sms")}},R):R==="apple"?Ue(Ke,{provider:"apple"},R):R==="discord"?Ue(Ke,{provider:"discord"},R):R==="farcaster"?Ue(Is,{},R):R==="github"?Ue(Ke,{provider:"github"},R):R==="google"?Ue(Ke,{provider:"google"},R):R==="linkedin"?Ue(Ke,{provider:"linkedin"},R):R==="tiktok"?Ue(Ke,{provider:"tiktok"},R):R==="twitter"&&(!b4||o?.loginConfig.twitterOAuthOnMobileEnabled)?Ue(Ke,{provider:"twitter"},R):wi([R],r,e,l),v=a.map(w).flat(),k=i.map(w).flat(),E=[...v,...k],T=T4({primary:v.length,overflow:k.length}),[W,I]=gd(E,T);return Ys(Oc,{children:[Ue(P,{title:"Log in or sign up",onClose:g,backFn:c==="default"?void 0:()=>{u("default")}}),c==="default"&&Ue(P4,{}),Ue(Qa,{style:{overflow:"hidden",padding:2},children:Ys(Ht,{children:[c==="default"&&Ys(Oc,{children:[...W,I.length>0&&Ue(js,{text:"More options",icon:Ue(C4,{}),onClick:()=>u("overflow")})]}),c==="overflow"&&Ys(Oc,{children:[...I]}),s&&c==="default"&&Ue(Ms,{})]})}),o&&Ue(mn,{app:o}),Ue(q,{protectedByPrivy:!0})]})},Ks=5,T4=({primary:e,overflow:t})=>e<Ks?e:e===Ks&&t===0?Ks:Ks-1,P4=E4(Tn)`
|
|
1762
|
+
`;import{Fragment as c4,jsx as Os,jsxs as eh}from"react/jsx-runtime";var Ns=({isEditable:e,setIsEditable:t})=>{let r=l4(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 eh(c4,{children:[Os(Ur,{if:!e,children:Os(Nn,{ref:r,onSubmit:u})}),Os(Ur,{if:e,children:eh(Te,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[Os(s4,{})," Continue with SMS"]})})]})};import{useState as h4}from"react";import{jsx as th,jsxs as p4}from"react/jsx-runtime";var Ds=({style:e,...t})=>p4("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:[th("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"}),th("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 d4}from"react/jsx-runtime";var Fs=({style:e,...t})=>d4("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 rh}from"react/jsx-runtime";var Us=({style:e,...t})=>rh("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:rh("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 u4}from"react/jsx-runtime";var Hs=({style:e,...t})=>u4("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 oh,jsxs as m4}from"react/jsx-runtime";function zs(e){return m4("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[oh("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"}),oh("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 f4}from"react/jsx-runtime";function qs(e){return f4("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 nh}from"react/jsx-runtime";var $s=({style:e,...t})=>nh("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:nh("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 mo,jsxs as g4}from"react/jsx-runtime";var y4={apple:{logo:mo(Ds,{}),displayName:"Apple"},discord:{logo:mo(Fs,{}),displayName:"Discord"},github:{logo:mo(Us,{}),displayName:"GitHub"},google:{logo:mo(Hs,{}),displayName:"Google"},linkedin:{logo:mo(Vs,{}),displayName:"LinkedIn"},spotify:{logo:mo(zs,{}),displayName:"Spotify"},twitter:{logo:mo($s,{}),displayName:"Twitter"},tiktok:{logo:mo(qs,{}),displayName:"TikTok"}},Ke=({provider:e})=>{let{enabled:t,token:r}=ye(),{navigate:o,setModalData:n}=_(),[a,i]=h4(!1),{initLoginWithOAuth:l}=M(),{displayName:s,logo:c}=y4[e];return g4(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 v4 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as ih,jsxs as C4}from"react/jsx-runtime";var js=({onClick:e,text:t,icon:r})=>C4(Te,{onClick:e,children:[r,ih(Ja,{children:t}),ih(v4,{})]});import{Fragment as Oc,jsx as Ue,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]=ah("default"),[h,f]=ah("email");b4(()=>{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 w=R=>R==="email"?Ue(Rs,{isEditable:h==="email",setIsEditable:()=>{f("email")}},R):R==="sms"?Ue(Ns,{isEditable:h==="sms",setIsEditable:()=>{f("sms")}},R):R==="apple"?Ue(Ke,{provider:"apple"},R):R==="discord"?Ue(Ke,{provider:"discord"},R):R==="farcaster"?Ue(Is,{},R):R==="github"?Ue(Ke,{provider:"github"},R):R==="google"?Ue(Ke,{provider:"google"},R):R==="linkedin"?Ue(Ke,{provider:"linkedin"},R):R==="tiktok"?Ue(Ke,{provider:"tiktok"},R):R==="twitter"&&(!E4||o?.loginConfig.twitterOAuthOnMobileEnabled)?Ue(Ke,{provider:"twitter"},R):wi([R],r,e,l),v=a.map(w).flat(),k=i.map(w).flat(),E=[...v,...k],T=P4({primary:v.length,overflow:k.length}),[W,I]=gd(E,T);return Ys(Oc,{children:[Ue(P,{title:"Log in or sign up",onClose:g,backFn:c==="default"?void 0:()=>{u("default")}}),c==="default"&&Ue(S4,{}),Ue(Qa,{style:{overflow:"hidden",padding:2},children:Ys(Bt,{children:[c==="default"&&Ys(Oc,{children:[...W,I.length>0&&Ue(js,{text:"More options",icon:Ue(w4,{}),onClick:()=>u("overflow")})]}),c==="overflow"&&Ys(Oc,{children:[...I]}),s&&c==="default"&&Ue(Ms,{})]})}),o&&Ue(mn,{app:o}),Ue(q,{protectedByPrivy:!0})]})},Ks=5,P4=({primary:e,overflow:t})=>e<Ks?e:e===Ks&&t===0?Ks:Ks-1,S4=T4(Tn)`
|
|
1763
1763
|
margin-bottom: 16px;
|
|
1764
|
-
`;import
|
|
1764
|
+
`;import A4 from"@heroicons/react/24/outline/EnvelopeIcon";import R4 from"@heroicons/react/24/outline/PhoneIcon";import I4 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as M4,useState as ph}from"react";import{isMobile as W4}from"react-device-detect";import L4 from"styled-components";import{jsx as Oi,jsxs as sh}from"react/jsx-runtime";var lh=({...e})=>sh("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[sh("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 x4 from"@heroicons/react/24/outline/ChevronRightIcon";import k4 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Nc,jsxs as _4}from"react/jsx-runtime";var ch=({onClick:e,text:t})=>_4(Te,{onClick:e,children:[Nc(k4,{}),Nc(Ja,{children:t}),Nc(x4,{})]});import{Fragment as Ni,jsx as ke,jsxs as Dn}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:w,wallet:v,farcaster:k,passkey:E}=o?.loginMethods??{},T=o?.appearance.loginGroupPriority||"web2-first",W=o?.appearance.hideDirectWeb2Inputs,[I,D]=ph("default"),[R,B]=ph(a?"email":"sms");M4(()=>{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(Ke,{provider:"google"}),s&&(!W4||o?.loginConfig.twitterOAuthOnMobileEnabled)&&ke(Ke,{provider:"twitter"}),c&&ke(Ke,{provider:"discord"}),u&&ke(Ke,{provider:"github"}),h&&ke(Ke,{provider:"spotify"}),f&&ke(Ke,{provider:"tiktok"}),g&&ke(Ke,{provider:"linkedin"}),w&&ke(Ke,{provider:"apple"}),k&&ke(Is,{})].filter(Boolean),A=wi(o.appearance.walletList,r,e,o.appearance.walletList),oe=I==="default"?void 0:()=>{D("default")},F=N4({priority:T,email:a,sms:i,social:z}),ae=D4({priority:T,email:a,sms:i,social:z}),Q=F4({priority:T,email:a,sms:i,social:z}),Y=ke(ch,{text:Q,onClick:()=>D("web3-overflow")}),Ae=ke(js,{text:F,icon:ae,onClick:()=>D("web2-overflow")}),ee=W?0:1;return Dn(Ni,{children:[ke(P,{title:"Log in or sign up",onClose:$,backFn:oe}),I==="default"&&ke(O4,{}),ke(Qa,{style:{overflow:"hidden",padding:2},children:Dn(Bt,{children:[I==="default"&&T==="web2-first"&&Dn(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"&&T==="web3-first"&&Dn(Ni,{children:[v&&Dn(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"&&Dn(Ni,{children:[...T==="web3-first"?V:[],...z]}),...I==="web3-overflow"?A:[],E&&I==="default"&&ke(Ms,{})]})}),o&&ke(mn,{app:o}),ke(q,{protectedByPrivy:!0})]})},O4=L4(Tn)`
|
|
1765
1765
|
margin-bottom: 16px;
|
|
1766
|
-
`,O4=({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",N4=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?ke(R4,{}):t&&r?ke(lh,{}):t?ke(_4,{}):r?ke(A4,{}):null,D4=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as dh}from"react/jsx-runtime";var uh=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?dh(Zs,{connectOnly:!0}):dh(Js,{connectOnly:!0})};import{jsx as mh}from"react/jsx-runtime";var fh=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?mh(Zs,{connectOnly:!1}):mh(Js,{connectOnly:!1})};import F4 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as U4,jsx as fo,jsxs as B4}from"react/jsx-runtime";var hh=()=>{let{app:e}=_();return B4(U4,{children:[fo(P,{},"header"),fo(Z,{}),fo(Pe,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:fo(F4,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),fo(Gt,{children:fo(_s,{stacked:!0})}),fo(te,{}),fo(q,{protectedByPrivy:!0})]})};import H4 from"@heroicons/react/24/outline/ClockIcon";import G4 from"@heroicons/react/24/outline/TrashIcon";import V4 from"@heroicons/react/24/solid/CheckBadgeIcon";import z4 from"@heroicons/react/24/solid/CheckCircleIcon";import q4 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as $4,useState as Di}from"react";import Vr,{css as wh}from"styled-components";import{jsx as yh}from"react/jsx-runtime";var gh=({style:e,...t})=>yh("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:yh("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 vh}from"react/jsx-runtime";var Qs=({style:e,...t})=>vh("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:[vh("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 re,jsxs as Pt}from"react/jsx-runtime";var Ch=({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:[re(Q4,{children:"Your passkeys"}),Pt(Eh,{children:[e.slice(0,i).map(c=>Pt(tw,{children:[Pt("div",{children:[re(X4,{children:l(c)}),Pt(ew,{children:["Last used: ",c.verifiedAt.toLocaleString()]})]}),re(ow,{onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?re(Dr,{}):re(G4,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&re(J4,{onClick:o,children:"View all"})]})]})},j4=()=>Pt(Eh,{children:[Pt(Mo,{children:[re(Io,{children:re(V4,{})}),"Log in with touch, face, PIN, or hardware key."]}),Pt(Mo,{children:[re(Io,{children:re(q4,{})}),"More secure than a password."]}),Pt(Mo,{children:[re(Io,{children:re(H4,{})}),"Takes less than a minute to set up."]})]}),bh=()=>{let{user:e,unlinkPasskey:t}=G(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(w=>w.type==="passkey"),[a,i]=Di(!1),[l,s]=Di(""),[c,u]=Di(!1),[h,f]=Di(!1);$4(()=>{n.length===0&&f(!1)},[n.length]);let g=()=>{i(!0),r().then(()=>u(!0)).catch(w=>{if(w instanceof Ie){if(w.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(w.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:[re(P,{onClose:()=>o()},"header"),re(We,{children:re(ze,{status:"success",children:re(z4,{})})}),re(he,{children:"Passkey account added"}),re(de,{children:"From now on, you can use your Passkey to log in."}),re(Xt,{children:re(O,{onClick:()=>o(),children:"Done"})}),re(K,{})]}):h?Pt(Dc,{children:[re(P,{backFn:()=>f(!1),onClose:()=>o()},"header"),re(Ch,{passkeys:n,expanded:h,onUnlink:t,onExpand:()=>f(!0)}),re(K,{})]}):Pt(Dc,{children:[re(P,{onClose:()=>o()},"header"),re(We,{children:Pt(K4,{children:[re(gh,{}),re(Qs,{})]})}),re(he,{children:"Secure your account with a passkey"}),n.length===0?re(j4,{}):re("div",{style:{marginTop:"1.5em"},children:re(Ch,{passkeys:n,expanded:h,onUnlink:t,onExpand:()=>f(!0)})}),Pt(Xt,{children:[l&&re(Y4,{fail:!0,children:l}),re(O,{onClick:g,loading:a,children:"Add new passkey"}),re(kt,{onClick:()=>o(),children:"Skip for now"})]}),re(K,{})]})},K4=Vr.div`
|
|
1766
|
+
`,N4=({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",D4=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?ke(I4,{}):t&&r?ke(lh,{}):t?ke(A4,{}):r?ke(R4,{}):null,F4=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as dh}from"react/jsx-runtime";var uh=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?dh(Zs,{connectOnly:!0}):dh(Js,{connectOnly:!0})};import{jsx as mh}from"react/jsx-runtime";var fh=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?mh(Zs,{connectOnly:!1}):mh(Js,{connectOnly:!1})};import U4 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as B4,jsx as fo,jsxs as H4}from"react/jsx-runtime";var hh=()=>{let{app:e}=_();return H4(B4,{children:[fo(P,{},"header"),fo(Z,{}),fo(Pe,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:fo(U4,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),fo(Ht,{children:fo(_s,{stacked:!0})}),fo(te,{}),fo(q,{protectedByPrivy:!0})]})};import G4 from"@heroicons/react/24/outline/ClockIcon";import V4 from"@heroicons/react/24/outline/TrashIcon";import z4 from"@heroicons/react/24/solid/CheckBadgeIcon";import q4 from"@heroicons/react/24/solid/CheckCircleIcon";import $4 from"@heroicons/react/24/solid/LockClosedIcon";import{useEffect as j4,useState as Di}from"react";import Vt,{css as bh}from"styled-components";import{jsx as yh}from"react/jsx-runtime";var gh=({style:e,...t})=>yh("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:yh("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 vh}from"react/jsx-runtime";var Qs=({style:e,...t})=>vh("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:[vh("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 Ch=({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(tw,{children:"Your passkeys"}),Pt(Th,{children:[e.slice(0,i).map(c=>Pt(nw,{children:[Pt("div",{children:[ie(rw,{children:l(c)}),Pt(ow,{children:["Last used: ",c.verifiedAt.toLocaleString()]})]}),ie(aw,{onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?ie(Fr,{}):ie(V4,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&ie(Q4,{onClick:o,children:"View all"})]})]})},K4=()=>Pt(Th,{children:[Pt(Mo,{children:[ie(Io,{children:ie(z4,{})}),"Log in with Touch ID, Face ID, or a security key."]}),Pt(Mo,{children:[ie(Io,{children:ie($4,{})}),"More secure than a password."]}),Pt(Mo,{children:[ie(Io,{children:ie(G4,{})}),"Takes seconds to set up and use."]})]}),Eh=()=>{let{user:e,unlinkPasskey:t}=G(),{linkWithPasskey:r,closePrivyModal:o}=M(),n=e?.linkedAccounts.filter(w=>w.type==="passkey"),[a,i]=Di(!1),[l,s]=Di(""),[c,u]=Di(!1),[h,f]=Di(!1);j4(()=>{n.length===0&&f(!1)},[n.length]);let g=()=>{i(!0),r().then(()=>u(!0)).catch(w=>{if(w instanceof Ie){if(w.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(w.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(P,{onClose:()=>o()},"header"),ie(We,{children:ie(ze,{status:"success",children:ie(q4,{})})}),ie(wh,{children:"Passkey added"}),ie(X4,{children:"From now on, you can use your passkey to log in."}),ie(er,{children:ie(O,{onClick:()=>o(),children:"Done"})}),ie(K,{})]}):h?Pt(Dc,{children:[ie(P,{backFn:()=>f(!1),onClose:()=>o()},"header"),ie(Ch,{passkeys:n,expanded:h,onUnlink:t,onExpand:()=>f(!0)}),ie(K,{})]}):Pt(Dc,{children:[ie(P,{onClose:()=>o()},"header"),ie(We,{children:Pt(Y4,{children:[ie(gh,{}),ie(Qs,{})]})}),ie(wh,{children:"Secure your account with a passkey"}),ie(ew,{}),n.length===0?ie(K4,{}):ie(Ch,{passkeys:n,expanded:h,onUnlink:t,onExpand:()=>f(!0)}),Pt(er,{style:{marginTop:"12px"},children:[l&&ie(Z4,{fail:!0,children:l}),ie(O,{onClick:g,loading:a,children:"Add new passkey"})]}),ie(K,{})]})},Y4=Vt.div`
|
|
1767
1767
|
display: flex;
|
|
1768
1768
|
align-items: center;
|
|
1769
1769
|
justify-content: center;
|
|
@@ -1779,7 +1779,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1779
1779
|
stroke: var(--privy-color-accent) !important;
|
|
1780
1780
|
fill: var(--privy-color-accent) !important;
|
|
1781
1781
|
}
|
|
1782
|
-
`,
|
|
1782
|
+
`,Z4=Vt.div`
|
|
1783
1783
|
line-height: 20px;
|
|
1784
1784
|
height: 20px;
|
|
1785
1785
|
font-size: 13px;
|
|
@@ -1787,7 +1787,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1787
1787
|
display: flex;
|
|
1788
1788
|
justify-content: flex-beginngin;
|
|
1789
1789
|
width: 100%;
|
|
1790
|
-
`,
|
|
1790
|
+
`,J4=bh`
|
|
1791
1791
|
&& {
|
|
1792
1792
|
width: 100%;
|
|
1793
1793
|
font-size: 0.875rem;
|
|
@@ -1812,17 +1812,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1812
1812
|
box-shadow: none;
|
|
1813
1813
|
}
|
|
1814
1814
|
}
|
|
1815
|
-
`,
|
|
1816
|
-
${
|
|
1817
|
-
`,
|
|
1815
|
+
`,Q4=Vt.button`
|
|
1816
|
+
${J4}
|
|
1817
|
+
`,Th=Vt.div`
|
|
1818
1818
|
display: flex;
|
|
1819
1819
|
flex-direction: column;
|
|
1820
1820
|
align-items: stretch;
|
|
1821
1821
|
gap: 0.8rem;
|
|
1822
|
-
padding:
|
|
1822
|
+
padding: 0.5rem 0rem 0rem;
|
|
1823
1823
|
flex-grow: 1;
|
|
1824
1824
|
width: 100%;
|
|
1825
|
-
`,
|
|
1825
|
+
`,wh=Vt.div`
|
|
1826
|
+
font-size: 18px;
|
|
1827
|
+
line-height: 18px;
|
|
1828
|
+
text-align: center;
|
|
1829
|
+
font-weight: 600;
|
|
1830
|
+
`,X4=Vt.div`
|
|
1831
|
+
font-size: 0.875rem;
|
|
1832
|
+
text-align: center;
|
|
1833
|
+
margin-top: 10px;
|
|
1834
|
+
`,ew=Vt.div`
|
|
1835
|
+
height: 32px;
|
|
1836
|
+
`,tw=Vt.div`
|
|
1826
1837
|
line-height: 20px;
|
|
1827
1838
|
height: 20px;
|
|
1828
1839
|
font-size: 1em;
|
|
@@ -1830,18 +1841,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1830
1841
|
display: flex;
|
|
1831
1842
|
justify-content: flex-beginning;
|
|
1832
1843
|
width: 100%;
|
|
1833
|
-
`,
|
|
1844
|
+
`,rw=Vt.div`
|
|
1834
1845
|
font-size: 1em;
|
|
1835
1846
|
line-height: 1.3em;
|
|
1836
1847
|
font-weight: 500;
|
|
1837
1848
|
color: var(--privy-color-foreground-2);
|
|
1838
1849
|
padding: 0.2em 0;
|
|
1839
|
-
`,
|
|
1850
|
+
`,ow=Vt.div`
|
|
1840
1851
|
font-size: 0.875rem;
|
|
1841
1852
|
line-height: 1rem;
|
|
1842
1853
|
color: #64668b;
|
|
1843
1854
|
padding: 0.2em 0;
|
|
1844
|
-
`,
|
|
1855
|
+
`,nw=Vt.div`
|
|
1845
1856
|
display: flex;
|
|
1846
1857
|
align-items: center;
|
|
1847
1858
|
justify-content: space-between;
|
|
@@ -1854,7 +1865,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1854
1865
|
border: 1px solid #e2e3f0 !important;
|
|
1855
1866
|
width: 100%;
|
|
1856
1867
|
height: 5em;
|
|
1857
|
-
`,
|
|
1868
|
+
`,iw=bh`
|
|
1858
1869
|
:focus,
|
|
1859
1870
|
:hover,
|
|
1860
1871
|
:active {
|
|
@@ -1871,9 +1882,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1871
1882
|
svg:hover {
|
|
1872
1883
|
color: var(--privy-color-foreground-3);
|
|
1873
1884
|
}
|
|
1874
|
-
`,
|
|
1875
|
-
${
|
|
1876
|
-
`;import
|
|
1885
|
+
`,aw=Vt.button`
|
|
1886
|
+
${iw}
|
|
1887
|
+
`;import sw from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as lw,jsx as ho,jsxs as cw}from"react/jsx-runtime";var Ph=()=>{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 cw(lw,{children:[ho(P,{},"header"),ho(Z,{}),ho(Pe,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:ho(sw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),ho(Ht,{children:ho(Nn,{stacked:!0,onSubmit:i})}),ho(te,{}),ho(q,{protectedByPrivy:!0})]})};import{Fragment as pw,jsx as Fi,jsxs as dw}from"react/jsx-runtime";var Sh=()=>{let{linkingHint:e}=M(),{app:t}=_(),r=e?`Select the wallet with ${Xr(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return dw(pw,{children:[Fi(P,{},"header"),Fi(Er,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),Fi(Bt,{children:Fi(En,{connectOnly:!1})}),Fi(q,{protectedByPrivy:!0})]})};import{jsx as xh,jsxs as uw}from"react/jsx-runtime";var kh=({style:e,...t})=>uw("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:[xh("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),xh("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 mw,jsx as yo,jsxs as _h}from"react/jsx-runtime";var Ah=()=>{let{closePrivyModal:e}=M(),{navigate:t}=_();return _h(mw,{children:[yo(P,{},"header"),yo(Z,{}),yo(kh,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),yo(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"}}),_h(Ht,{children:[yo(O,{onClick:()=>t("LANDING"),children:"Try again"}),yo(Xt,{onClick:()=>e(),children:"Cancel"})]}),yo(te,{}),yo(q,{protectedByPrivy:!0})]})};import Fh from"@heroicons/react/20/solid/CheckIcon";import Lw from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Ow from"@heroicons/react/24/outline/FingerPrintIcon";import Nw from"@heroicons/react/24/outline/PhoneIcon";import Uh from"@heroicons/react/24/outline/TrashIcon";import Dw from"@heroicons/react/24/solid/CheckBadgeIcon";import Bh from"@heroicons/react/24/solid/CheckCircleIcon";import Hh from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Fw 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 Gh,useState as zr}from"react";import{useState as Bc}from"react";import{isMobile as Cw}from"react-device-detect";import Lh from"styled-components";import{Dialog as Rh,Transition as Fc}from"@headlessui/react";import Uc from"react";import Un from"styled-components";import{jsx as Fn,jsxs as vw}from"react/jsx-runtime";var Ih=({children:e,open:t,onClick:r,...o})=>Fn(Fc,{show:t,as:Uc.Fragment,children:vw(Rh,{onClose:r,...o,as:hw,children:[Fn(Fc.Child,{as:Uc.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Fn(fw,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),Fn(yw,{children:Fn(Fc.Child,{as:Uc.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Fn(Rh.Panel,{as:gw,children:e})})})]})}),Bn=Un.div`
|
|
1877
1888
|
display: flex;
|
|
1878
1889
|
flex-direction: column;
|
|
1879
1890
|
text-align: center;
|
|
@@ -1896,7 +1907,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1896
1907
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1897
1908
|
border-radius: var(--privy-border-radius-lg);
|
|
1898
1909
|
}
|
|
1899
|
-
`,
|
|
1910
|
+
`,fw=Un.div`
|
|
1900
1911
|
position: fixed;
|
|
1901
1912
|
inset: 0;
|
|
1902
1913
|
|
|
@@ -1909,10 +1920,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1909
1920
|
backdrop-filter: unset;
|
|
1910
1921
|
-webkit-backdrop-filter: unset;
|
|
1911
1922
|
}
|
|
1912
|
-
`,
|
|
1923
|
+
`,hw=Un.div`
|
|
1913
1924
|
position: relative;
|
|
1914
1925
|
z-index: 999999;
|
|
1915
|
-
`,
|
|
1926
|
+
`,yw=Un.div`
|
|
1916
1927
|
position: fixed;
|
|
1917
1928
|
inset: 0;
|
|
1918
1929
|
display: flex;
|
|
@@ -1920,7 +1931,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1920
1931
|
justify-content: center;
|
|
1921
1932
|
width: 100vw;
|
|
1922
1933
|
min-height: 100vh;
|
|
1923
|
-
`,
|
|
1934
|
+
`,gw=Un.div`
|
|
1924
1935
|
// reset some default dialog styles
|
|
1925
1936
|
padding: 0;
|
|
1926
1937
|
background: transparent;
|
|
@@ -1967,13 +1978,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1967
1978
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1968
1979
|
border-radius: var(--privy-border-radius-lg);
|
|
1969
1980
|
}
|
|
1970
|
-
`,
|
|
1981
|
+
`,Mh=Un.div`
|
|
1971
1982
|
display: flex;
|
|
1972
1983
|
flex-direction: column;
|
|
1973
1984
|
align-items: center;
|
|
1974
1985
|
justify-content: center;
|
|
1975
1986
|
height: 100%;
|
|
1976
|
-
`;import{Fragment as
|
|
1987
|
+
`;import{Fragment as xw,jsx as Ui,jsxs as Sw}from"react/jsx-runtime";var Bi=6,ww=new Array(Bi).fill("");function bw(e){return e.replace(/\s+/g,"")}function Hc(e){return/^[0-9]{1}$/.test(e)}function Wh(e){return e.length===Bi&&e.every(Hc)}function Ew(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var Hn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,a]=Bc(ww),[i,l]=Bc(null),[s,c]=Bc(null),u=async w=>{w.preventDefault();let v=bw(w.currentTarget.value);if(v==="")return;let k=Ew(n,Hc),E=v.split(""),T=!E.every(Hc),W=E.length+k>Bi;if(T){l("Passcode can only be numbers"),c(1);return}if(W){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let I=Number(w.currentTarget.name?.charAt(4)),D=[...v||[""]].slice(0,Bi-I),R=[...n.slice(0,I),...D,...n.slice(I+D.length)];a(R);let B=D.length,$=Math.min(Math.max(I+B,0),Bi-1);if(document.querySelector(`input[name=pin-${$}]`)?.focus(),Wh(R))try{await e(R.join("")),document.querySelector(`input[name=pin-${$}]`)?.blur()}catch(z){c(1),l(z.message)}else try{await e(null)}catch(z){c(1),l(z.message)}},h=w=>{s===1&&(l(null),c(null));let v=[...n.slice(0,w),"",...n.slice(w+1)];a(v),w>0&&document.querySelector(`input[name=pin-${w-1}]`)?.focus(),Wh(v)?e(v.join("")):e(null)},g=o?"success":!!(r||i)?"fail":"";return Ui(xw,{children:Sw(Tw,{children:[Ui("div",{children:n.map((w,v)=>Ui("input",{name:`pin-${v}`,type:"text",value:n[v],onChange:u,onKeyUp:k=>{k.key==="Backspace"&&h(v)},inputMode:"numeric",autoFocus:v===0,pattern:"[0-9]",className:g,autoComplete:Cw?"one-time-code":"off",disabled:t},v))}),Ui("div",{children:Ui(Pw,{fail:!!r||!!i,children:r||i})})]})})},Tw=Lh.div`
|
|
1977
1988
|
display: flex;
|
|
1978
1989
|
flex-direction: column;
|
|
1979
1990
|
width: 100%;
|
|
@@ -2044,7 +2055,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2044
2055
|
transform: translate(1px, 0px);
|
|
2045
2056
|
}
|
|
2046
2057
|
}
|
|
2047
|
-
`,
|
|
2058
|
+
`,Pw=Lh.div`
|
|
2048
2059
|
line-height: 20px;
|
|
2049
2060
|
font-size: 13px;
|
|
2050
2061
|
display: flex;
|
|
@@ -2052,7 +2063,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2052
2063
|
width: 100%;
|
|
2053
2064
|
|
|
2054
2065
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
2055
|
-
`;import{useContext as
|
|
2066
|
+
`;import{useContext as kw}from"react";function Gn(){let{promptMfa:e,init:t,submit:r,cancel:o}=kw(me);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as _w}from"react";function Hi(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenroll:n,enrollInMfa:a}=_w(me);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>a(!0),closeMfaEnrollmentModal:()=>a(!1)}}import Aw from"styled-components";import{jsx as Oh,jsxs as Iw}from"react/jsx-runtime";var Nh=e=>Iw(Rw,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[Oh("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),Oh("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),Rw=Aw.svg`
|
|
2056
2067
|
height: 90px;
|
|
2057
2068
|
width: 90px;
|
|
2058
2069
|
|
|
@@ -2063,7 +2074,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2063
2074
|
> path {
|
|
2064
2075
|
fill: white;
|
|
2065
2076
|
}
|
|
2066
|
-
`;import
|
|
2077
|
+
`;import Mw from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as Ww}from"react/jsx-runtime";var Dh=({size:e,authUrl:t})=>Ww(On,{url:t,squareLogoElement:Mw,size:e,fgColor:"#1F1F1F"});import{Fragment as zt,jsx as C,jsxs as re}from"react/jsx-runtime";var Vh=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=zr(null),{unenrollWithSms:n,unenrollWithTotp:a}=Hi(),{app:i,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),{closePrivyModal:u}=M(),{promptMfa:h}=Gn(),[f,g]=zr(s?.mfaEnrollmentFlow?.seenIntro||!1),[w,v]=zr(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),k=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),v(null)},500)};c.current=k;let E=e?.mfaMethods.includes("sms"),T=!!e?.phone,W=e?.mfaMethods.includes("totp"),I=E||W;Gh(()=>{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:[C(P,{onClose:k},"header"),C(We,{children:C(Nh,{})}),C(oo,{children:C(wt,{})}),C(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:[C(P,{backFn:D,onClose:k},"header"),C(We,{children:C(ze,{children:C(Vc,{})})}),C(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."]}),C(er,{children:C(O,{warn:!0,onClick:$,children:"Remove SMS for MFA"})}),C(K,{})]});if(r==="totp")return re(zt,{children:[C(P,{backFn:D,onClose:k},"header"),C(We,{children:C(ze,{children:C(Hh,{})})}),C(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."]}),C(er,{children:C(O,{warn:!0,onClick:V,children:"Remove Authenticator App for MFA"})}),C(K,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!I)return re(zt,{children:[C(P,{onClose:k},"header"),C(We,{children:C(ze,{children:C(Gc,{})})}),C(we,{children:"Add more security"}),re(fe,{children:[i?.name," does not have any verification methods enabled."]}),C(er,{children:C(O,{onClick:k,children:"Close"})}),C(K,{})]});let z=!I&&!f;if(z)return re(zt,{children:[C(P,{onClose:k},"header"),C(We,{children:C(ze,{children:C(Gc,{})})}),C(we,{children:"Transaction Protection"}),C(fe,{children:"Set up transaction protection to add an extra layer of security to your account"}),re(Wu,{children:[re(Mo,{children:[C(Io,{children:C(Dw,{})}),"Enable 2-Step verification for your ",i?.name," wallet."]}),re(Mo,{children:[C(Io,{children:C(Fw,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),re(er,{children:[C(O,{onClick:()=>g(!0),children:"Continue"}),C(Xt,{onClick:k,children:"Not now"})]}),C(K,{})]});switch(w){case"sms":return C(Uw,{onComplete:k,onReset:D,onClose:k});case"totp":return C(Bw,{onComplete:k,onClose:k,onReset:D});default:return re(zt,{children:[C(P,{backFn:z?R:void 0,onClose:k},"header"),C(We,{children:C(ze,{children:C(Gc,{})})}),C(we,{children:"Choose a verification method"}),I?C(fe,{children:"To add or delete verification methods, verification is required."}):C(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:[C(Te,{disabled:W,onClick:()=>B("totp"),children:re(rs,{children:[re(ts,{children:[C(Lw,{}),"Authenticator App"]}),W?re(yn,{children:[C(Fh,{}),"Added"]}):C(yn,{children:"Recommended"})]})}),W&&C(Zl,{id:"remove",onClick:()=>o("totp"),children:C(Uh,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||E)&&re(es,{children:[C(Te,{disabled:E||T,onClick:()=>B("sms"),children:re(rs,{children:[re(ts,{children:[C(Nw,{}),"SMS"]}),E&&re(yn,{children:[C(Fh,{}),"Added"]}),T&&C(yn,{children:"Disabled"})]})}),E&&C(Zl,{id:"remove",onClick:()=>o("sms"),children:C(Uh,{})})]},"sms"),C(es,{children:C(Te,{disabled:!0,children:re(rs,{children:[re(ts,{children:[C(Ow,{}),"Passkey"]}),C(yn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),C(K,{})]})}},Uw=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=zr(""),[a,i]=zr(!1),[l,s]=zr("enroll"),{initEnrollmentWithSms:c,submitEnrollmentWithSms:u}=Hi(),{app:h,data:f,currentScreen:g,navigate:w,setModalData:v}=_();function k(){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"}}),w("ERROR_SCREEN")}}async function T(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."):_n(D)?new Error("The code you entered is not valid"):kn(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:[C(P,{backFn:t,onClose:r},"header"),C(We,{children:C(ze,{children:C(Vc,{})})}),C(we,{children:"Set up SMS verification"}),C(fe,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),re(oo,{children:[C(Nn,{onSubmit:E}),re(Lu,{children:["By providing your mobile number, you agree to receive text messages from ",h?.name,". Some carrier charges may apply"]})]}),C(K,{})]}):a?re(zt,{children:[C(P,{onClose:k},"header"),C(We,{children:C(ze,{status:"success",children:C(Bh,{})})}),C(we,{children:"SMS verification added"}),C(fe,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),C(er,{children:C(O,{onClick:k,children:"Done"})}),C(K,{})]}):re(zt,{children:[C(P,{backFn:W,onClose:r},"header"),C(We,{children:C(ze,{children:C(Vc,{})})}),C(we,{children:"Enter enrollment code"}),re(oo,{children:[C(Hn,{onChange:T}),re(fe,{children:["To continue, enter the 6-digit code sent to ",C("strong",{children:Kf(o)})]})]}),C(K,{})]})},Bw=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=zr("enroll"),[a,i]=zr(null),[l,s]=zr(!1),{initEnrollmentWithTotp:c,submitEnrollmentWithTotp:u}=Hi(),{data:h}=_();Gh(()=>{i(null),c().then(k=>{i(k)}).catch(()=>{i(null),r()})},[]);function f(){h?.mfaEnrollmentFlow?.onSuccess(),e()}function g(){n("verify")}async function w(k){try{if(!k)return;await u({mfaCode:k}),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."):_n(E)?new Error("The code you entered is not valid"):kn(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:[C(P,{backFn:r,onClose:t},"header"),C(we,{children:"Scan QR code"}),C(fe,{children:"Open your authenticator app and scan the QR code to continue."}),C(gn,{children:a?.authUrl?C(Dh,{authUrl:a.authUrl,size:200}):C(wt,{})}),re(er,{children:[C(ct,{children:a?.secret&&C(po,{itemName:"secret",text:a.secret})}),C(O,{onClick:g,children:"Continue"})]}),C(K,{})]}):l?re(zt,{children:[C(P,{onClose:f},"header"),C(We,{children:C(ze,{status:"success",children:C(Bh,{})})}),C(we,{children:"Authenticator app verification added"}),C(fe,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),C(er,{children:C(O,{onClick:f,children:"Done"})}),C(K,{})]}):re(zt,{children:[C(P,{backFn:v,onClose:t},"header"),C(We,{children:C(ze,{children:C(Hh,{})})}),C(we,{children:"Enter enrollment code"}),C(oo,{children:C(Hn,{onChange:w})}),re(fe,{children:["To continue, enter the 6-digit code generated from your ",C("strong",{children:"authenticator app"})]}),C(K,{})]})};import N5 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import D5 from"@heroicons/react/24/outline/PhoneIcon";import F5 from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import U5 from"@heroicons/react/24/solid/PhoneIcon";import B5 from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as H5,useState as sp}from"react";import{useMemo as M5,useEffect as W5,useState as Ry}from"react";import L5 from"styled-components";import dy from"styled-components";import qh from"styled-components";import{jsx as zh,jsxs as Vw}from"react/jsx-runtime";var Xs=({label:e,children:t,valueStyles:r})=>Vw(Hw,{children:[zh("div",{children:e}),zh(Gw,{style:{...r},children:t})]}),Hw=qh.div`
|
|
2067
2078
|
display: flex;
|
|
2068
2079
|
align-items: center;
|
|
2069
2080
|
justify-content: space-between;
|
|
@@ -2078,7 +2089,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2078
2089
|
color: var(--privy-color-foreground-2);
|
|
2079
2090
|
text-align: right;
|
|
2080
2091
|
}
|
|
2081
|
-
`,
|
|
2092
|
+
`,Gw=qh.div`
|
|
2082
2093
|
font-size: 14px;
|
|
2083
2094
|
line-height: 100%;
|
|
2084
2095
|
display: flex;
|
|
@@ -2087,28 +2098,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2087
2098
|
border-radius: var(--privy-border-radius-full);
|
|
2088
2099
|
background-color: var(--privy-color-background-2);
|
|
2089
2100
|
padding: 4px 8px;
|
|
2090
|
-
`;import tl from"styled-components";import{BigNumber as
|
|
2101
|
+
`;import tl from"styled-components";import{BigNumber as $h}from"@ethersproject/bignumber";import{formatEther as jh}from"@ethersproject/units";var Gi=(e,t)=>{let r=(t*parseFloat(jh(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},_r=(e,t,r=6,o=!1)=>{let a=parseFloat(jh(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${a} ${t}`:`${a==="0"?"<0.001":a} ${t}`},zc=e=>e.map(ot).reduce((t,r)=>t.add(r),$h.from(0)).toHexString(),Kh=(e,t)=>{let{chains:r}=M(),o=`https://etherscan.io/address/${t}`,n=`${Td(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},ot=e=>$h.from(e);import{Fragment as jw,jsx as el,jsxs as Yh}from"react/jsx-runtime";var Zh=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=zc(e),n=t?Gi(o,t):void 0,a=_r(o,r);return el(Jh,{children:n||a})},qc=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=zc(e),n=t?Gi(o,t):void 0,a=_r(o,r);return el(Jh,{children:n?Yh(jw,{children:[el(zw,{children:"USD"}),n==="<$0.01"?Yh($w,{children:[el(qw,{children:"<"}),"$0.01"]}):n]}):a})},Jh=tl.span`
|
|
2091
2102
|
font-size: 14px;
|
|
2092
2103
|
line-height: 140%;
|
|
2093
2104
|
display: flex;
|
|
2094
2105
|
gap: 4px;
|
|
2095
2106
|
align-items: center;
|
|
2096
|
-
`,
|
|
2107
|
+
`,zw=tl.span`
|
|
2097
2108
|
font-size: 12px;
|
|
2098
2109
|
line-height: 12px;
|
|
2099
2110
|
color: var(--privy-color-foreground-3);
|
|
2100
|
-
`,
|
|
2111
|
+
`,qw=tl.span`
|
|
2101
2112
|
font-size: 10px;
|
|
2102
|
-
|
|
2113
|
+
`,$w=tl.span`
|
|
2103
2114
|
display: flex;
|
|
2104
2115
|
align-items: center;
|
|
2105
|
-
`;import $c from"styled-components";import{jsx as go,jsxs as rl}from"react/jsx-runtime";var
|
|
2116
|
+
`;import $c from"styled-components";import{jsx as go,jsxs as rl}from"react/jsx-runtime";var Qh=({gas:e,tokenPrice:t,tokenSymbol:r})=>rl(Xl,{style:{paddingBottom:"12px"},children:[rl(ey,{children:[go(ry,{children:"Est. Fees"}),go("div",{children:go(qc,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&go(ty,{children:`${_r(e,r)}`})]}),Xh=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=ot(e.value||0).add(ot(t)).toHexString();return rl(Xl,{children:[rl(ey,{children:[go(ry,{children:"Total (including fees)"}),go("div",{children:go(qc,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&go(ty,{children:_r(n,o)})]})},ey=$c.div`
|
|
2106
2117
|
display: flex;
|
|
2107
2118
|
flex-direction: row;
|
|
2108
2119
|
justify-content: space-between;
|
|
2109
2120
|
align-items: center;
|
|
2110
2121
|
padding-top: 4px;
|
|
2111
|
-
`,
|
|
2122
|
+
`,ty=$c.div`
|
|
2112
2123
|
display: flex;
|
|
2113
2124
|
flex-direction: row;
|
|
2114
2125
|
height: 12px;
|
|
@@ -2117,23 +2128,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2117
2128
|
line-height: 12px;
|
|
2118
2129
|
color: var(--privy-color-foreground-3);
|
|
2119
2130
|
font-weight: 400;
|
|
2120
|
-
`,
|
|
2131
|
+
`,ry=$c.div`
|
|
2121
2132
|
font-size: 14px;
|
|
2122
2133
|
line-height: 22.4px;
|
|
2123
2134
|
font-weight: 400;
|
|
2124
|
-
`;import
|
|
2135
|
+
`;import Kw from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Ho,useState as Yw}from"react";import vo from"styled-components";import{createContext as oy,useContext as WU}from"react";var Vn=oy(void 0);var Vi=oy(void 0);import{Fragment as o5,jsx as lr,jsxs as ny}from"react/jsx-runtime";var iy=({defaultValue:e,children:t})=>{let[r,o]=Yw(e||null),n=a=>{o(r===a?null:a)};return lr(Vn.Provider,{value:{activePanel:r,togglePanel:n},children:lr(Zw,{children:t})})},ay=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=Ho(Vn),n=r===e;return lr(Vi.Provider,{value:{onToggle:()=>o(e),value:e},children:lr(e5,{isActive:n,"data-open":n,children:t})})},sy=({children:e})=>{let{activePanel:t}=Ho(Vn),{onToggle:r,value:o}=Ho(Vi),n=t===o;return ny(o5,{children:[ny(Jw,{onClick:r,"data-open":n,children:[lr(Xw,{children:e}),lr(r5,{isactive:n,children:lr(Kw,{height:"16px",width:"16px",strokeWidth:"2"})})]}),lr(Qw,{})]})},ly=({children:e})=>{let{activePanel:t}=Ho(Vn),{value:r}=Ho(Vi);return lr(t5,{"data-open":t===r,children:lr(py,{children:e})})},cy=({children:e})=>{let{activePanel:t}=Ho(Vn),{value:r}=Ho(Vi);return lr(py,{children:typeof e=="function"?e({isActive:t===r}):e})},Zw=vo.div`
|
|
2125
2136
|
display: flex;
|
|
2126
2137
|
flex-direction: column;
|
|
2127
2138
|
width: 100%;
|
|
2128
2139
|
gap: 8px;
|
|
2129
|
-
`,
|
|
2140
|
+
`,Jw=vo.div`
|
|
2130
2141
|
display: flex;
|
|
2131
2142
|
justify-content: space-between;
|
|
2132
2143
|
align-items: center;
|
|
2133
2144
|
width: 100%;
|
|
2134
2145
|
cursor: pointer;
|
|
2135
2146
|
padding-bottom: 8px;
|
|
2136
|
-
`,
|
|
2147
|
+
`,Qw=vo.div`
|
|
2137
2148
|
width: 100%;
|
|
2138
2149
|
|
|
2139
2150
|
&& {
|
|
@@ -2141,13 +2152,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2141
2152
|
border-color: var(--privy-color-foreground-4);
|
|
2142
2153
|
}
|
|
2143
2154
|
padding-bottom: 12px;
|
|
2144
|
-
`,
|
|
2155
|
+
`,Xw=vo.div`
|
|
2145
2156
|
font-size: 14px;
|
|
2146
2157
|
font-weight: 500;
|
|
2147
2158
|
line-height: 19.6px;
|
|
2148
2159
|
width: 100%;
|
|
2149
2160
|
padding-right: 8px;
|
|
2150
|
-
`,
|
|
2161
|
+
`,e5=vo.div`
|
|
2151
2162
|
display: flex;
|
|
2152
2163
|
flex-direction: column;
|
|
2153
2164
|
width: 100%;
|
|
@@ -2159,7 +2170,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2159
2170
|
border-color: var(--privy-color-foreground-4);
|
|
2160
2171
|
border-radius: var(--privy-border-radius-md);
|
|
2161
2172
|
}
|
|
2162
|
-
`,
|
|
2173
|
+
`,t5=vo.div`
|
|
2163
2174
|
position: relative;
|
|
2164
2175
|
overflow: hidden;
|
|
2165
2176
|
transition: max-height 25ms ease-out;
|
|
@@ -2171,38 +2182,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2171
2182
|
&[data-open='false'] {
|
|
2172
2183
|
max-height: 0;
|
|
2173
2184
|
}
|
|
2174
|
-
`,
|
|
2185
|
+
`,py=vo.div`
|
|
2175
2186
|
display: flex;
|
|
2176
2187
|
flex-direction: column;
|
|
2177
2188
|
gap: 12px;
|
|
2178
2189
|
flex: 1 1 auto;
|
|
2179
2190
|
min-height: 1px;
|
|
2180
|
-
`,
|
|
2191
|
+
`,r5=vo.div`
|
|
2181
2192
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
2182
|
-
`;import
|
|
2193
|
+
`;import n5 from"styled-components";import{jsx as a5}from"react/jsx-runtime";var jc=({walletAddress:e,chainId:t=Lr})=>a5(i5,{href:Kh(t,e),target:"_blank",children:Xr(e)}),i5=n5.a`
|
|
2183
2194
|
&:hover {
|
|
2184
2195
|
text-decoration: underline;
|
|
2185
2196
|
}
|
|
2186
|
-
`;import{jsx as
|
|
2197
|
+
`;import{jsx as It,jsxs as Kc}from"react/jsx-runtime";var zn=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let l=r?.value||0;return It(iy,{children:Kc(ay,{value:"details",children:[It(sy,{children:Kc(s5,{children:[It("div",{children:o?.title||o?.actionDescription||"Details"}),It(l5,{children:It(Zh,{weiQuantities:[l],tokenPrice:n,tokenSymbol:i})})]})}),Kc(ly,{children:[It(Xs,{label:"From",children:It(jc,{walletAddress:e,chainId:r.chainId||Lr})}),It(Xs,{label:"To",children:It(jc,{walletAddress:t,chainId:r.chainId||Lr})}),o&&o.action&&It(Xs,{label:"Action",children:o.action}),a&&It(Qh,{transactionData:r,gas:a,tokenPrice:n,tokenSymbol:i})]}),It(cy,{children:({isActive:s})=>It(Xh,{transactionData:r,displayFee:s,gas:a||"0x0",tokenPrice:n,tokenSymbol:i})})]})})},s5=dy.div`
|
|
2187
2198
|
display: flex;
|
|
2188
2199
|
flex-direction: row;
|
|
2189
2200
|
justify-content: space-between;
|
|
2190
|
-
`,
|
|
2201
|
+
`,l5=dy.div`
|
|
2191
2202
|
flex-shrink: 0;
|
|
2192
2203
|
padding-left: 8px;
|
|
2193
|
-
`;import qi from"styled-components";import{jsx as zi,jsxs as
|
|
2204
|
+
`;import qi from"styled-components";import{jsx as zi,jsxs as f5}from"react/jsx-runtime";var Yc=({description:e,contractInfo:t})=>f5(c5,{children:[t.imgUrl&&zi(p5,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&zi(d5,{children:zi("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&zi(u5,{children:t.name}),zi(m5,{children:e||t.actionText})]}),c5=qi.div`
|
|
2194
2205
|
display: flex;
|
|
2195
2206
|
flex-direction: column;
|
|
2196
2207
|
align-items: center;
|
|
2197
2208
|
margin-bottom: 8px;
|
|
2198
|
-
`,
|
|
2209
|
+
`,p5=qi.img`
|
|
2199
2210
|
&& {
|
|
2200
2211
|
height: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2201
2212
|
width: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2202
2213
|
border-radius: 16px;
|
|
2203
2214
|
margin-bottom: 12px;
|
|
2204
2215
|
}
|
|
2205
|
-
`,
|
|
2216
|
+
`,d5=qi.div`
|
|
2206
2217
|
font-size: 12px;
|
|
2207
2218
|
line-height: 12px;
|
|
2208
2219
|
padding: 7px;
|
|
@@ -2215,7 +2226,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2215
2226
|
text-decoration: underline;
|
|
2216
2227
|
}
|
|
2217
2228
|
}
|
|
2218
|
-
`,
|
|
2229
|
+
`,u5=qi.div`
|
|
2219
2230
|
font-size: 18px;
|
|
2220
2231
|
line-height: 18px;
|
|
2221
2232
|
font-weight: 500;
|
|
@@ -2223,7 +2234,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2223
2234
|
white-space: nowrap;
|
|
2224
2235
|
max-width: 275px;
|
|
2225
2236
|
text-overflow: ellipsis;
|
|
2226
|
-
`,
|
|
2237
|
+
`,m5=qi.div`
|
|
2227
2238
|
font-size: 16px;
|
|
2228
2239
|
line-height: 140%;
|
|
2229
2240
|
font-weight: 400;
|
|
@@ -2231,7 +2242,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2231
2242
|
overflow: hidden;
|
|
2232
2243
|
max-width: 275px;
|
|
2233
2244
|
text-overflow: ellipsis;
|
|
2234
|
-
`;import
|
|
2245
|
+
`;import h5 from"@heroicons/react/24/outline/WalletIcon";import Jc from"styled-components";import{jsx as uy,jsxs as Zc}from"react/jsx-runtime";var my=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:a}=M(),i=a(t.chainId)||"ETH";return Zc(y5,{children:[Zc(g5,{children:[uy(h5,{strokeWidth:"2",width:"16px",height:"16px"}),uy("div",{children:Xr(e)})]}),Zc(v5,{displayBalanceColor:n,hasFunds:o,children:[r?_r(r,i,6,!0):0," available"]})]})},y5=Jc.div`
|
|
2235
2246
|
display: flex;
|
|
2236
2247
|
flex-direction: row;
|
|
2237
2248
|
justify-content: space-between;
|
|
@@ -2244,12 +2255,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2244
2255
|
border: 1px solid var(--privy-color-foreground-4);
|
|
2245
2256
|
border-radius: var(--privy-border-radius-md);
|
|
2246
2257
|
}
|
|
2247
|
-
`,
|
|
2258
|
+
`,g5=Jc.div`
|
|
2248
2259
|
display: flex;
|
|
2249
2260
|
flex-direction: row;
|
|
2250
2261
|
align-items: center;
|
|
2251
2262
|
gap: 8px;
|
|
2252
|
-
`,
|
|
2263
|
+
`,v5=Jc.div`
|
|
2253
2264
|
display: flex;
|
|
2254
2265
|
align-items: center;
|
|
2255
2266
|
justify-content: center;
|
|
@@ -2259,35 +2270,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2259
2270
|
background-color: var(--privy-color-background-2);
|
|
2260
2271
|
padding: 5px 8px;
|
|
2261
2272
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
2262
|
-
`;import ol from"styled-components";import{Fragment as
|
|
2273
|
+
`;import ol from"styled-components";import{Fragment as hy,jsx as $i,jsxs as yy}from"react/jsx-runtime";var gy=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,a=o?Gi(n,o):void 0,i=_r(n,r);return yy(C5,{children:[a?yy(hy,{children:[$i(fy,{children:a}),$i(w5,{children:i})]}):$i(hy,{children:$i(fy,{children:i})}),$i(b5,{children:e})]})},C5=ol.div`
|
|
2263
2274
|
display: flex;
|
|
2264
2275
|
flex-direction: column;
|
|
2265
2276
|
align-items: center;
|
|
2266
2277
|
margin-bottom: 20px;
|
|
2267
|
-
`,
|
|
2278
|
+
`,fy=ol.h2`
|
|
2268
2279
|
&& {
|
|
2269
2280
|
font-size: 48px;
|
|
2270
2281
|
line-height: 48px;
|
|
2271
2282
|
margin: 8px auto;
|
|
2272
2283
|
}
|
|
2273
|
-
`,
|
|
2284
|
+
`,w5=ol.p`
|
|
2274
2285
|
margin-bottom: 12px;
|
|
2275
2286
|
&& {
|
|
2276
2287
|
font-size: 17px;
|
|
2277
2288
|
line-height: 17px;
|
|
2278
2289
|
color: var(--privy-color-foreground-3);
|
|
2279
2290
|
}
|
|
2280
|
-
`,
|
|
2291
|
+
`,b5=ol.div`
|
|
2281
2292
|
font-size: 16px;
|
|
2282
2293
|
line-height: 22.4px;
|
|
2283
2294
|
font-weight: 400;
|
|
2284
2295
|
overflow: hidden;
|
|
2285
2296
|
max-width: 275px;
|
|
2286
2297
|
text-overflow: ellipsis;
|
|
2287
|
-
`;import{VoidSigner as
|
|
2298
|
+
`;import{VoidSigner as k5}from"@ethersproject/abstract-signer";import{EtherscanProvider as XB}from"@ethersproject/providers";import{BigNumber as by}from"@ethersproject/bignumber";import{BigNumber as qn}from"@ethersproject/bignumber";import{Contract as E5}from"@ethersproject/contracts";import{serialize as T5}from"@ethersproject/transactions";var $n=e=>[Wa.id,La.id,Oa.id,Na.id,Da.id,Fa.id,Ua.id,Ha.id,Ba.id].includes(e),vy=async(e,t)=>{if(!$n(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=qn.from(r).mul(qn.from(126)).div(qn.from(100)).add(qn.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 Cy(e,t){if(!e.chainId||e.chainId&&!$n(e.chainId))return qn.from(0);let r=qn.from(0);try{let o=new E5(hd,yd,t),n=wy(e),a=T5(n);r=await o.getL1Fee(a)}catch{}return r}async function Ey(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var Ty=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 jn(e,t){if(!e.gasLimit)throw new Re("gasLimit was not successfully set for transaction.");let r=ot(e.gasLimit),o=by.from(0);if(e.type==2)if(e.maxFeePerGas)o=ot(e.maxFeePerGas);else throw new Re("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=ot(e.gasPrice);else throw new Re("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=by.from(0);if(e.chainId&&$n(e.chainId))try{a=await Cy(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),Py=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 ep=e=>[56,97].includes(e),Sy=async(e,t)=>{if(!ep(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 xy}from"@ethersproject/units";import{ofetch as P5}from"ofetch";var tp={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var op=e=>[li.id,ci.id,tp.id].includes(e),rp=e=>({maxPriorityFee:xy(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:xy(e.maxFee.toFixed(9),"gwei").toHexString()}),S5=e=>({safeLow:rp(e.safeLow),standard:rp(e.standard),fast:rp(e.fast)}),x5=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 tp.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return S5(await P5(t))};async function ky(e){if(!op(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 x5(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 wy(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=ot(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=ot(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=ot(e.gasPrice)),e.value!==void 0&&(t.value=ot(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=ot(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=ot(e.maxPriorityFeePerGas)),t}async function Kn(e,t,r){if(t.chainId=Number(t.chainId),_y(t),t.from||(t.from=e),!t.nonce){let o=new k5(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await Ey(t,r)),typeof t.type=="string"&&Ay(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),op(t.chainId)?t=await ky(t):Xc(t.chainId)?t=await Py(t,r):$n(t.chainId)?t=await vy(t,r):ep(t.chainId)?t=await Sy(t,r):t=await Ty(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:Lr},o),_y(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(ot(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function _y(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!_5(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 _5(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&Ay(e);return t||r||o}function Ay(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 np,useEffect as A5}from"react";var sl=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,a]=np(!0),[i,l]=np(void 0),[s,c]=np(void 0);return A5(()=>{let u=e.chainId||Lr,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 R5,useContext as I5}from"react";var ip=R5(null);function Ki(){let e=I5(ip);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as Iy}from"react/jsx-runtime";var ap=({pendingTransaction:e})=>{let{getAccessToken:t}=G(),{wallets:r}=Ki(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=M(),[s,c]=Ry(null),[u,h]=Ry(e),{tokenPrice:f}=sl(u),g=l(e.chainId)||"ETH",w=M5(()=>r.find(v=>v.walletClientType==="privy"),[r]);return W5(()=>{async function v(){if(!await t()||!o||!w)return u;let E=Or(u.chainId,a,n,{appId:i}),T=await Kn(w.address,u,E),{totalGasEstimate:W}=await jn(T,E);return c(W.toHexString()),T}v().then(k=>{h(k)})},[o]),w?Iy(O5,{children:Iy(zn,{from:w.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:g})}):null},O5=L5.div`
|
|
2288
2299
|
width: 100%;
|
|
2289
2300
|
padding: 1rem 0;
|
|
2290
|
-
`;import{Fragment as lp,jsx as le,jsxs as
|
|
2301
|
+
`;import{Fragment as lp,jsx as le,jsxs as Ar}from"react/jsx-runtime";var cp=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=sp(null),{init:a,cancel:i}=Gn();H5(()=>{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?le(G5,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Ar(lp,{children:[le(P,{onClose:s},"header"),le(We,{children:le(ze,{children:le(B5,{})})}),le(we,{children:"Verify your identity"}),le(fe,{children:"Choose a verification method"}),Ar(Xa,{children:[r.mfaMethods.includes("totp")&&Ar(Te,{onClick:()=>l("totp"),children:[le(N5,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Ar(Te,{onClick:()=>l("sms"),children:[le(D5,{}),"SMS"]},"sms")]}),le(K,{})]})},G5=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=_(),{pendingTransaction:n}=M(),[a,i]=sp(!1),[l,s]=sp(!1),{submit:c}=Gn();async function u(h){try{if(!h)return;await c(e,h),s(!0),i(!1),t()}catch(f){throw dc(f)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):_n(f)?(i(!1),new Error("The code you entered is not valid")):kn(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(lp,{children:[le(P,{onClose:t},"header"),le(We,{children:le(ze,{children:le(U5,{})})}),le(we,{children:"Enter verification code"}),Ar(oo,{children:[le(Hn,{success:l,disabled:a,onChange:u}),Ar(fe,{children:["To continue, please enter the 6-digit code sent to your ",le("strong",{children:"mobile device"})]}),n&&le(ap,{pendingTransaction:n})]}),r&&le(Jl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),le(Xt,{onClick:t,children:"Not now"}),le(K,{})]});case"totp":return Ar(lp,{children:[le(P,{onClose:t},"header"),le(We,{children:le(ze,{children:le(F5,{})})}),le(we,{children:"Enter verification code"}),Ar(oo,{children:[le(Hn,{success:l,disabled:a,onChange:u}),Ar(fe,{children:["To continue, please enter the 6-digit code generated from your"," ",le("strong",{children:"authenticator app"})]}),n&&le(ap,{pendingTransaction:n})]}),r&&le(Jl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),le(Xt,{onClick:t,children:"Not now"}),le(K,{})]});default:return null}};import{useEffect as My,useState as Wy}from"react";import V5 from"styled-components";import{Fragment as q5,jsx as Rr,jsxs as ll}from"react/jsx-runtime";var Ly={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}},Oy=()=>{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:w}=M(),[v,k]=Wy(!1),[E,T]=Wy(void 0),W=s()?.provider||"google",I=Ly[W].name,D=Ly[W].component,R=n?.render.inDialog?Me:0;My(()=>{u(W).then(()=>{k(!0),f(!0)}).catch(V=>{if(V?.privyErrorCode==="allowlist_rejected"){T(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}if(V?.privyErrorCode==="max_accounts_reached"){console.error(new mr(V).toString()),T(void 0),l(),i("USER_LIMIT_REACHED_SCREEN");return}let{retryable:z,detail:A}=Ld(V,W);T({retryable:z,detail:A,message:"Authentication failed"}),f(!1)}).finally(()=>{ai()})},[I,W]),My(()=>{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),w("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(q5,{children:[Rr(P,{}),Rr(Z,{}),ll(z5,{children:[Rr(Et,{children:ll("div",{children:[Rr(Ct,{success:v,fail:!!E}),Rr(D,{style:{width:"38px",height:"38px"}})]})}),ll(Fe,{children:[Rr("h3",{children:B}),Rr("p",{children:$})]}),E&&E?.retryable?Rr(Ya,{onClick:()=>{ai(),c(W),T(void 0)},disabled:!v&&!E?.retryable,children:"Retry"}):null]}),Rr(te,{}),Rr(K,{})]})},z5=V5.div`
|
|
2291
2302
|
display: flex;
|
|
2292
2303
|
flex-direction: column;
|
|
2293
2304
|
align-items: center;
|
|
@@ -2295,14 +2306,17 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2295
2306
|
margin-left: 27px;
|
|
2296
2307
|
margin-right: 27px;
|
|
2297
2308
|
gap: 24px;
|
|
2298
|
-
`;import{useEffect as pp,useRef as
|
|
2309
|
+
`;import{useEffect as pp,useRef as $5,useState as Ny}from"react";import Dy from"styled-components";import{Fragment as K5,jsx as qr,jsxs as cl}from"react/jsx-runtime";var Fy=()=>{let{app:e,lastScreen:t,currentScreen:r,navigateBack:o}=_(),{loginWithPasskey:n,closePrivyModal:a}=M(),i=e?.render.inDialog?Me:0,[l,s]=Ny("loading"),[c,u]=Ny(null),h=$5([]),f=E=>{h.current=[E,...h.current]};pp(()=>()=>{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"}},w=()=>{switch(l){case"loading":return`Please follow prompts to verify your passkey.
|
|
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
|
+
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 qr(O,{onClick:()=>{},disabled:!0,children:"Continue"});case"error":return qr(O,{onClick:k,disabled:!1,children:"Retry"})}},k=async()=>{s("loading");try{await n(),s("success")}catch(E){u(E),s("error")}};return pp(()=>{l==="success"&&f(setTimeout(()=>{a({shouldCallAuthOnSuccess:!0,isSuccess:!0})},i))},[l]),pp(()=>{k()},[]),cl(K5,{children:[qr(P,{backFn:!t||r===t?void 0:o}),cl(j5,{children:[qr(Et,{children:cl("div",{children:[qr(Ct,{success:l==="success",fail:l==="error"}),qr(Qs,{style:{width:"38px",height:"38px"}})]})}),cl(Fe,{children:[qr("h3",{children:g()}),qr("p",{style:{whiteSpace:"pre-wrap"},children:w()})]}),v()]}),qr(K,{})]})},j5=Dy.div`
|
|
2299
2313
|
display: flex;
|
|
2300
2314
|
flex-direction: column;
|
|
2301
2315
|
align-items: center;
|
|
2302
2316
|
justify-content: center;
|
|
2303
2317
|
gap: 24px;
|
|
2304
2318
|
width: 100%;
|
|
2305
|
-
`,
|
|
2319
|
+
`,IG=Dy.div`
|
|
2306
2320
|
display: flex;
|
|
2307
2321
|
align-items: center;
|
|
2308
2322
|
justify-content: center;
|
|
@@ -2318,63 +2332,63 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2318
2332
|
stroke: var(--privy-color-accent) !important;
|
|
2319
2333
|
fill: var(--privy-color-accent) !important;
|
|
2320
2334
|
}
|
|
2321
|
-
`;import{useEffect as
|
|
2335
|
+
`;import{useEffect as Z5,useState as By}from"react";import J5 from"styled-components";import{isMobile as Y5}from"react-device-detect";var Uy=(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(!Qr()&&Y5)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as X5,jsx as $r,jsxs as Hy}from"react/jsx-runtime";var Gy=()=>{let{forkSession:e,ready:t,authenticated:r}=G(),[o,n]=By(""),[a,i]=By(!1);Z5(()=>{t&&r&&e().then(n)},[t,r]);let l=Uy(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."),Hy(X5,{children:[$r(P,{},"header"),$r(Z,{}),$r(Er,{title:s.title,description:s.description}),Hy(Ht,{children:[$r(Q5,{children:$r(gr,{style:{width:"72px",height:"72px"}})}),$r(Ka,{href:l,onClick:()=>{setTimeout(()=>i(!0),1e3)},loading:t&&!l,children:a?"Go to App Store":"Continue"}),s.footnote?$r("p",{children:s.footnote}):null]}),$r(te,{}),$r(q,{protectedByPrivy:!0})]})},Q5=J5(ct)`
|
|
2322
2336
|
margin: 16px auto;
|
|
2323
|
-
`;import
|
|
2337
|
+
`;import e6 from"@heroicons/react/24/outline/LockClosedIcon";import t6 from"@heroicons/react/24/outline/PencilSquareIcon";import r6 from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import{useState as o6}from"react";import{jsx as jr,jsxs as Vy}from"react/jsx-runtime";var zy=()=>Vy("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Vy("g",{"clip-path":"url(#clip0_2115_829)",children:[jr("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"}),jr("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"}),jr("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"}),jr("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"}),jr("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"}),jr("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"})]}),jr("defs",{children:jr("clipPath",{id:"clip0_2115_829",children:jr("rect",{width:"16",height:"14",fill:"white"})})})]});import qy from"styled-components";var $y=qy.div`
|
|
2324
2338
|
display: flex;
|
|
2325
2339
|
flex-direction: column;
|
|
2326
2340
|
gap: 12px;
|
|
2327
2341
|
padding-top: 24px;
|
|
2328
2342
|
padding-bottom: 24px;
|
|
2329
|
-
|
|
2343
|
+
`,jy=qy.div`
|
|
2330
2344
|
padding-bottom: 24px;
|
|
2331
|
-
`;import{Fragment as dp,jsx as qt,jsxs as Go}from"react/jsx-runtime";var
|
|
2345
|
+
`;import{Fragment as dp,jsx as qt,jsxs as Go}from"react/jsx-runtime";var n6=({onClose:e})=>Go(jy,{children:[qt(Pe,{title:"Why do I need to secure my account?",icon:qt(r6,{width:48}),description:Go(dp,{children:[qt("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),qt("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It\u2019s important you don\u2019t lose access to the method you choose."})]})}),qt(O,{onClick:e,children:"Select backup method"})]}),Ky=()=>{let[e,t]=o6(!1);return Go(dp,{children:[qt(P,{backFn:e?()=>t(!1):void 0,infoFn:e?void 0:()=>t(!0)},"header"),e?qt(n6,{onClose:()=>t(!1)}):Go(dp,{children:[qt(Pe,{title:"Secure your account",icon:qt(e6,{width:48}),description:"Select a method for logging in on new devices and recovering your account."}),Go($y,{children:[Go(Te,{children:[qt(zy,{})," Back up to Google Drive"]}),Go(Te,{children:[qt(t6,{})," Set a password"]})]})]}),qt(q,{protectedByPrivy:!0})]})};import{BigNumber as Jy}from"@ethersproject/bignumber";import{useMemo as Qy,useEffect as Xy,useState as $t}from"react";import Zn from"styled-components";function Yy(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{BigNumber as up}from"@ethersproject/bignumber";import i6 from"styled-components";import{Fragment as l6,jsx as Yi,jsxs as c6}from"react/jsx-runtime";var a6=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=up.from(e.gasUsed),o=up.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=up.from(t);n=n.add(a)}return n.toString()}catch{return}else return},Zy=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i})=>c6(l6,{children:[Yi(P,{onClose:o}),Yi(yi,{title:"Transaction complete!",description:"You're all set."}),Yi(zn,{tokenPrice:n,from:t.from,to:t.to,gas:a6(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),Yi(s6,{loading:!1,onClick:o,children:"All Done"}),Yi(K,{})]}),s6=i6(O)`
|
|
2332
2346
|
&& {
|
|
2333
2347
|
margin-top: 24px;
|
|
2334
2348
|
}
|
|
2335
2349
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2336
|
-
`;import{Fragment as mp,jsx as nt,jsxs as Yn}from"react/jsx-runtime";var
|
|
2350
|
+
`;import{Fragment as mp,jsx as nt,jsxs as Yn}from"react/jsx-runtime";var p6=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return nt(Yc,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return nt(Yc,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return nt(mp,{children:nt(gy,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},t1=()=>{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:w}=_(),{transactionRequest:v,onSuccess:k,onFailure:E,uiOptions:T,fundWalletConfig:W}=f.sendTransaction,[I,D]=$t(null),[R,B]=$t(null),[$,V]=$t(""),[z,A]=$t(),[oe,F]=$t(!1),ae=()=>{V(""),A(void 0)},Q=(ve,Ge,Zr)=>{V(ve),A(new Re(new Dt(Ge??ve,Zr??et.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[Y,Ae]=$t(!1),[ee,cr]=$t(!0),[it,Ne]=$t(null),[ue,Mt]=$t(v),{tokenPrice:pr,isTokenPriceLoading:qo}=sl(ue),dr=s(v.chainId)||"ETH",[ft,De]=$t(null),[L,de]=$t(null),[H,ur]=$t(!0);Xy(()=>{e||(h("LANDING"),E(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let ne=Qy(()=>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:Ge}=await a(ne.address,{config:W?.config||{}});w({fiatOnRampPrompt:{signedUrl:ve},fiatOnRampStatus:{externalTransactionId:Ge}}),h("FIAT_ON_RAMP_PROMPT_SCREEN")},Mr=Qy(()=>Or(ue.chainId,l,i,{appId:c}),[ue.chainId,i]);Xy(()=>{async function ve(){let Ge=ue;if(!await t()||!o||!ne)return;try{Ge=await Kn(ne.address,ue,Mr),Mt(Ge)}catch(Wt){console.error(Wt),Q("There was an error preparing your transaction. Please try again.",Wt.reason)}let ti=Jy.from(0),jo=Jy.from(0);try{({totalGasEstimate:ti,l1ExecutionFeeEstimate:jo}=await jn(Ge,Mr)),De(ti.toHexString()),de(jo.toHexString())}catch{De(null)}try{let{balance:Wt,hasSufficientFunds:hl}=await il(ne.address,Ge,ti,Mr);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=Yy(ue),ei=Ji==="SEND"?`Send ${dr}`:"Review transaction",Yr={modalTitle:T.header||T.modalTitle||ei,buttonText:T.buttonText||"Submit"},$o=()=>{Y||(R?k(R):E(z||new Re(new Dt("The user rejected the request",et.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=$o,pr===void 0&&qo||H?Yn(mp,{children:[T.transactionInfo?.contractInfo?.imgUrl&&nt(Aa,{src:T.transactionInfo?.contractInfo?.imgUrl}),nt(P,{title:Yr.modalTitle,onClose:$o}),nt(e1,{children:nt(Sn,{})})]}):I!==null?nt(Zy,{txn:ue,onClose:$o,receipt:I,transactionInfo:T.transactionInfo,tokenPrice:pr,tokenSymbol:dr,l1GasEstimate:L}):Yn(mp,{children:[nt(P,{title:Yr.modalTitle,onClose:$o}),Yn(e1,{children:[Yn(f6,{children:[nt(p6,{txn:ue,txnFamily:Ji,uiOptions:T,tokenSymbol:dr,tokenPrice:pr}),ne?nt(zn,{from:ne.address,to:ue.to,txn:ue,transactionInfo:T.transactionInfo,gas:ft||void 0,tokenPrice:pr,tokenSymbol:dr}):null]}),Yn(h6,{children:[nt(d6,{children:$}),nt(my,{txn:ue,address:ne?.address??"",hasFunds:ee,balance:it}),Yn(u6,{children:[oe&&nt(O,{onClick:ht,children:"Add Funds"}),nt(m6,{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 Ge=await nl(ve,ne.address,o,ue,Mr);B(Ge);let Zr=await Ge.wait();D(al(Zr)),ae()}catch(Ge){let Zr="There was an error processing your transaction. Please contact support.";console.warn({transaction:ue,error:Ge}),Q(Zr,Ge.reason)}finally{Ae(!1)}},children:Yr.buttonText})]})]})]})]})},e1=Zn.div`
|
|
2337
2351
|
display: flex;
|
|
2338
2352
|
flex-direction: column;
|
|
2339
2353
|
justify-content: space-between;
|
|
2340
2354
|
flex-grow: 1;
|
|
2341
2355
|
padding-bottom: 16px;
|
|
2342
|
-
`,
|
|
2356
|
+
`,d6=Zn.div`
|
|
2343
2357
|
font-size: 13px;
|
|
2344
2358
|
color: var(--privy-color-error);
|
|
2345
2359
|
width: 100%;
|
|
2346
2360
|
margin-top: 16px;
|
|
2347
|
-
`,
|
|
2361
|
+
`,u6=Zn.div`
|
|
2348
2362
|
display: flex;
|
|
2349
2363
|
direction: row;
|
|
2350
2364
|
justify-content: space-between;
|
|
2351
2365
|
align-items: center;
|
|
2352
2366
|
gap: 8px;
|
|
2353
|
-
`,
|
|
2367
|
+
`,m6=Zn(O)`
|
|
2354
2368
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2355
|
-
`,
|
|
2369
|
+
`,f6=Zn.div`
|
|
2356
2370
|
height: 100%;
|
|
2357
2371
|
display: flex;
|
|
2358
2372
|
flex-direction: column;
|
|
2359
2373
|
justify-content: space-evenly;
|
|
2360
2374
|
flex-grow: 1;
|
|
2361
|
-
`,
|
|
2375
|
+
`,h6=Zn.div`
|
|
2362
2376
|
display: flex;
|
|
2363
2377
|
flex-direction: column;
|
|
2364
2378
|
gap: 8px;
|
|
2365
|
-
`;import{isHexString as
|
|
2379
|
+
`;import{isHexString as y6}from"@ethersproject/bytes";import{toUtf8String as g6}from"@ethersproject/strings";import{useEffect as r1,useState as pl}from"react";import Co,{css as v6}from"styled-components";import{Fragment as i1,jsx as Be,jsxs as Jn}from"react/jsx-runtime";var C6=e=>{if(!y6(e))return e;try{return g6(e)}catch{return e}},w6=e=>JSON.stringify(e,null,2),b6=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Be(x6,{children:Object.entries(r).map(([o,n])=>Jn("li",{children:[Jn("strong",{children:[o,":"]})," ",t(n)]},o))}):Be("span",{children:String(r)});return Be("div",{children:t(e)})},E6=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Jn(i1,{children:[Be(n1,{children:Be(b6,{data:o})}),Be(po,{text:w6(e.typedData),itemName:"full payload to clipboard"})," "]})},o1=()=>{let{authenticated:e}=G(),{initializeWalletProxy:t,closePrivyModal:r}=M(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=_(),[i,l]=pl(!0),[s,c]=pl(""),[u,h]=pl(),[f,g]=pl(null),w=f!==null;r1(()=>{e||o("LANDING")},[e]),r1(()=>{t(Qo).then(B=>{l(!1),B||(c("An error has occurred, please try again."),h(new Re(new Dt(s,et.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:v,data:k,confirmAndSign:E,onSuccess:T,onFailure:W,uiOptions:I}=n.signMessage,D={title:I.title||"Sign message",description:I.description||"Signing this message will not cost you any fees.",buttonText:I.buttonText||"Sign and continue"},R=B=>{B?T(B):W(u||new Re(new Dt("The user rejected the request.",et.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),g(null),c(""),h(void 0)};return a.current=()=>{R(f)},Jn(i1,{children:[Be(P,{onClose:()=>R(f)}),Be(Z,{}),Jn(T6,{children:[Be(P6,{children:D.title}),Be(S6,{children:D.description}),v==="personal_sign"&&Be(n1,{children:C6(k)}),v==="eth_signTypedData_v4"&&Be(E6,{typedData:k}),Be(k6,{fail:!0,children:s}),Be(A6,{success:w,loading:i,disabled:w,onClick:async()=>{try{let B=await E();g(B),c(""),setTimeout(()=>{R(B)},Me)}catch{c("An error has occurred, please try again."),h(new Re(new Dt(s,et.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:w?Jn(_6,{children:[Be(ws,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Be("span",{children:"Success"})]}):D.buttonText})]}),Be(te,{}),Be(q,{protectedByPrivy:!0})]})},T6=Co.div`
|
|
2366
2380
|
display: flex;
|
|
2367
2381
|
flex-direction: column;
|
|
2368
2382
|
align-items: center;
|
|
2369
2383
|
justify-content: center;
|
|
2370
|
-
`,
|
|
2384
|
+
`,P6=Co.span`
|
|
2371
2385
|
color: var(--privy-color-foreground);
|
|
2372
2386
|
text-align: center;
|
|
2373
2387
|
font-size: 1.125rem;
|
|
2374
2388
|
font-weight: 500;
|
|
2375
2389
|
line-height: 1.25rem; /* 111.111% */
|
|
2376
2390
|
text-align: center;
|
|
2377
|
-
`,
|
|
2391
|
+
`,S6=Co.span`
|
|
2378
2392
|
margin-top: 4px;
|
|
2379
2393
|
color: var(--privy-color-foreground);
|
|
2380
2394
|
text-align: center;
|
|
@@ -2384,7 +2398,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2384
2398
|
font-weight: 400;
|
|
2385
2399
|
line-height: 20px; /* 142.857% */
|
|
2386
2400
|
letter-spacing: -0.008px;
|
|
2387
|
-
`,
|
|
2401
|
+
`,n1=Co.div`
|
|
2388
2402
|
margin-top: 1.5rem;
|
|
2389
2403
|
background-color: var(--privy-color-background-2);
|
|
2390
2404
|
border-radius: var(--privy-border-radius-md);
|
|
@@ -2403,7 +2417,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2403
2417
|
display: none; /* Safari and Chrome */
|
|
2404
2418
|
}
|
|
2405
2419
|
}
|
|
2406
|
-
`,
|
|
2420
|
+
`,x6=Co.ul`
|
|
2407
2421
|
margin-left: 12px !important;
|
|
2408
2422
|
white-space: nowrap;
|
|
2409
2423
|
|
|
@@ -2415,7 +2429,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2415
2429
|
font-weight: 500 !important;
|
|
2416
2430
|
}
|
|
2417
2431
|
}
|
|
2418
|
-
`,
|
|
2432
|
+
`,k6=Co.div`
|
|
2419
2433
|
line-height: 20px;
|
|
2420
2434
|
height: 20px;
|
|
2421
2435
|
font-size: 13px;
|
|
@@ -2425,22 +2439,22 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2425
2439
|
width: 100%;
|
|
2426
2440
|
margin-top: 16px;
|
|
2427
2441
|
margin-bottom: 4px;
|
|
2428
|
-
`,
|
|
2442
|
+
`,_6=Co.span`
|
|
2429
2443
|
display: flex;
|
|
2430
2444
|
align-items: center;
|
|
2431
2445
|
gap: 8px;
|
|
2432
|
-
`,
|
|
2446
|
+
`,A6=Co(O)`
|
|
2433
2447
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2434
2448
|
|
|
2435
|
-
${e=>e.success&&
|
|
2449
|
+
${e=>e.success&&v6`
|
|
2436
2450
|
&&&& {
|
|
2437
2451
|
background-color: var(--privy-color-success);
|
|
2438
2452
|
color: #ffffff;
|
|
2439
2453
|
}
|
|
2440
2454
|
`}
|
|
2441
|
-
`;import
|
|
2455
|
+
`;import O6 from"@heroicons/react/24/outline/EnvelopeIcon";import R6 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as I6,useState as a1}from"react";import l1 from"styled-components";import{Fragment as L6,jsx as Zi,jsxs as s1}from"react/jsx-runtime";var c1=I6((e,t)=>{let[r,o]=a1(""),[n,a]=a1(!1),{authenticated:i,user:l}=G(),{initUpdateEmail:s}=M(),{navigate:c,setModalData:u,currentScreen:h}=_(),{enabled:f,token:g}=ye(),w=da(r),v=n,k=n||!w,E=async W=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");a(!0);try{await s(l.email.address,r,W),c("AWAITING_PASSWORDLESS_CODE")}catch(I){u({errorModalData:{error:I,previousScreen:h||"LANDING"}})}a(!1)},T=()=>{f&&!g&&!i?(u({captchaModalData:{callback:W=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,W)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):E(g)};return s1(L6,{children:[Zi(M6,{children:s1(W6,{children:[Zi(R6,{}),Zi("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:W=>o(W.target.value),onKeyUp:W=>{W.key==="Enter"&&T()},value:r,autoComplete:"email"}),e.stacked?null:Zi(un,{isSubmitting:v,onClick:T,disabled:k,children:"Submit"})]})}),e.stacked?Zi(O,{loadingText:null,loading:v,disabled:k,onClick:T,children:"Submit"}):null]})}),M6=l1.div`
|
|
2442
2456
|
width: 100%;
|
|
2443
|
-
`,
|
|
2457
|
+
`,W6=l1.label`
|
|
2444
2458
|
display: block;
|
|
2445
2459
|
position: relative;
|
|
2446
2460
|
width: 100%;
|
|
@@ -2498,7 +2512,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2498
2512
|
&& > input::placeholder {
|
|
2499
2513
|
color: var(--privy-color-foreground-3);
|
|
2500
2514
|
}
|
|
2501
|
-
`;import{Fragment as
|
|
2515
|
+
`;import{Fragment as N6,jsx as wo,jsxs as D6}from"react/jsx-runtime";var p1=()=>D6(N6,{children:[wo(P,{},"header"),wo(Z,{}),wo(Pe,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:wo(O6,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),wo(Ht,{children:wo(c1,{stacked:!0})}),wo(te,{}),wo(q,{protectedByPrivy:!0})]});import hp from"styled-components";import{jsx as d1}from"react/jsx-runtime";var u1=({style:e,...t})=>d1("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...t,children:d1("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});import{Fragment as H6,jsx as Vo,jsxs as fp}from"react/jsx-runtime";var m1=()=>{let{navigate:e}=_();return fp(H6,{children:[Vo(P,{}),fp(F6,{children:[Vo(U6,{children:Vo(u1,{})}),fp(B6,{children:[Vo("h3",{children:"Unable to sign in"}),Vo("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),Vo(O,{onClick:()=>{e("LANDING")},children:"Go back"})]}),Vo(q,{protectedByPrivy:!0})]})},F6=hp.div`
|
|
2502
2516
|
display: flex;
|
|
2503
2517
|
flex-direction: column;
|
|
2504
2518
|
align-items: center;
|
|
@@ -2507,7 +2521,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2507
2521
|
width: 100%;
|
|
2508
2522
|
padding-top: 8px;
|
|
2509
2523
|
padding-bottom: 32px;
|
|
2510
|
-
`,
|
|
2524
|
+
`,U6=hp.div`
|
|
2511
2525
|
display: flex;
|
|
2512
2526
|
align-items: center;
|
|
2513
2527
|
justify-content: center;
|
|
@@ -2516,11 +2530,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2516
2530
|
color: var(--privy-color-error);
|
|
2517
2531
|
background-color: var(--privy-color-error-light);
|
|
2518
2532
|
border-radius: 50%;
|
|
2519
|
-
`,
|
|
2533
|
+
`,B6=hp.div`
|
|
2520
2534
|
display: flex;
|
|
2521
2535
|
flex-direction: column;
|
|
2522
2536
|
gap: 8px;
|
|
2523
|
-
`;import
|
|
2537
|
+
`;import V6,{createGlobalStyle as z6}from"styled-components";var G6=`
|
|
2524
2538
|
*,
|
|
2525
2539
|
::before,
|
|
2526
2540
|
::after {
|
|
@@ -2750,7 +2764,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2750
2764
|
[hidden] {
|
|
2751
2765
|
display: none;
|
|
2752
2766
|
}
|
|
2753
|
-
`,
|
|
2767
|
+
`,f1=G6;var h1=z6`
|
|
2754
2768
|
:root {
|
|
2755
2769
|
// Borders
|
|
2756
2770
|
--privy-border-radius-sm: 6px;
|
|
@@ -2783,10 +2797,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2783
2797
|
--privy-height-modal-full: 620px;
|
|
2784
2798
|
--privy-height-modal-compact: 480px;
|
|
2785
2799
|
};
|
|
2786
|
-
`,
|
|
2800
|
+
`,y1=V6.div`
|
|
2787
2801
|
// css normalize only the privy application to avoid conflicts
|
|
2788
2802
|
// with consuming application
|
|
2789
|
-
${
|
|
2803
|
+
${f1}
|
|
2790
2804
|
|
|
2791
2805
|
// Privy styles
|
|
2792
2806
|
color: var(--privy-color-foreground-2);
|
|
@@ -2845,4 +2859,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2845
2859
|
opacity: 1;
|
|
2846
2860
|
}
|
|
2847
2861
|
}
|
|
2848
|
-
`;import{jsx as Ye,jsxs as g1}from"react/jsx-runtime";var $6={["LANDING"]:fh,["CONNECT_OR_CREATE"]:uh,["AWAITING_PASSWORDLESS_CODE"]:Yu,["AWAITING_CONNECTION"]:fm,["AWAITING_CONNECT_ONLY_CONNECTION"]:vm,["AWAITING_FARCASTER_CONNECTION"]:Tf,["AWAITING_FARCASTER_SIGNER"]:Af,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:Dy,["PHANTOM_INTERSTITIAL_SCREEN"]:Hy,["LOGIN_FAILED_SCREEN"]:_h,["AWAITING_OAUTH_SCREEN"]:Ly,["ALLOWLIST_REJECTION_SCREEN"]:Uu,["USER_LIMIT_REACHED_SCREEN"]:u1,["INSTALL_PHANTOM_SCREEN"]:Vf,["LINK_EMAIL_SCREEN"]:hh,["LINK_PHONE_SCREEN"]:Th,["LINK_WALLET_SCREEN"]:Ph,["LINK_PASSKEY_SCREEN"]:bh,["UPDATE_EMAIL_SCREEN"]:c1,["CONNECT_ONLY_LANDING_SCREEN"]:dm,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:lm,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:of,["EMBEDDED_WALLET_CREATED_SCREEN"]:Sm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Tm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:sf,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:jy,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Am,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:r1,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:e1,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Of,["FIAT_ON_RAMP_STATUS_SCREEN"]:Df,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:af,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:nf,["MFA_ENROLLMENT_FLOW_SCREEN"]:Gh,["CAPTCHA_SCREEN"]:Xu,["ERROR_SCREEN"]:cf,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Ff,["AFFIRMATIVE_CONSENT_SCREEN"]:Nu},j6=["LANDING","AWAITING_CONNECTION"],K6=({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}=ge(),h=V6(null),f=Pu(h),g=o&&i&&j6.includes(i)&&!n&&l==="ready";if(y1(()=>{g&&s()},[g]),y1(()=>{!o&&u&&c()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return g1(Bn,{id:"privy-modal-content",children:[Ye(P,{}),Ye(Z,{}),Ye(Ih,{children:Ye(wt,{})}),Ye(te,{}),Ye(K,{})]});if(!i&&e)return Ye(Bn,{style:{height:f},id:"privy-modal-conent",children:Ye("div",{ref:h,children:Ye(cp,{open:e,onClose:t})})});if(!i)return null;let w=$6[i];return Ye(Bn,{style:{height:f},id:"privy-modal-content",children:g1("div",{ref:h,children:[Ye(Fr,{if:!!e,children:Ye(w,{})}),Ye(Fr,{if:!e,children:Ye(cp,{open:e,onClose:t})})]})})},Y6=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:G6(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},v1=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=Y6(),[o,n]=z6(!1);Gl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ye(h1,{children:Ye(K6,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ye(Rh,{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 q6.createPortal(l,s)}return l};import{useState as Z6}from"react";import{useEffect as C1,useRef as w1}from"react";var dl=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 zo(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 w=1e3*60*5;setTimeout(()=>{let v=new be("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},w)});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 r7}from"react/jsx-runtime";var J6=function(e){return()=>`id-${e++}`}(0);function Q6(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ze(e){return e.error!==void 0}var He=new dl,yp=new Map,X6=(e,t)=>typeof t=="bigint"?t.toString():t,e7=(e,t)=>`${e}${JSON.stringify(t,X6)}`;function Je(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=e7(e,t);if(e==="privy:wallet:create"){let l=yp.get(a);if(l)return l}let i=new Promise((l,s)=>{let c=J6();He.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{yp.delete(a)});return yp.set(a,i),i}function t7(e){switch(e.event){case"privy:iframe:ready":let t=He.dequeue(e.event,e.id);return Ze(e)?t.reject(new be(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=He.dequeue(e.event,e.id);return Ze(e)?r.reject(new be(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=He.dequeue(e.event,e.id);return Ze(e)?o.reject(new be(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=He.dequeue(e.event,e.id);return Ze(e)?n.reject(new be(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=He.dequeue(e.event,e.id);return Ze(e)?a.reject(new be(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=He.dequeue(e.event,e.id);return Ze(e)?i.reject(new be(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=He.dequeue(e.event,e.id);return Ze(e)?l.reject(new be(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function b1(e){let t=w1(null),r=w1(e.mfaMethods),o=ku(),[n,a]=Z6(!1);return C1(()=>{r.current=e.mfaMethods},[e.mfaMethods]),C1(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&Q6(f.data)&&t7(f.data)}let s={create(f){return Je("privy:wallet:create",f,i,e.origin)},connect(f){return Je("privy:wallet:connect",f,i,e.origin)},recover(f){return zo(g=>Je("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return zo(g=>Je("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return zo(g=>Je("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return zo(g=>Je("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return zo(g=>Je("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return Je("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return zo(g=>Je("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return Je("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return Je("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return Je("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return Je("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return Je("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return Je("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return Je("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 wd(()=>Je("privy:iframe:ready",{},i,e.origin),{abortSignal:h.signal}).then(c,u),()=>{window.removeEventListener("message",l),h.abort()}},[n]),r7("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 x("action required");if(!this.api)throw new x("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new x("phone number must be set when initialzing authentication.");try{await this.api.post(Xp,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw pe(t)}}async authenticate(){if(!this.meta.action)throw new x("action required");if(!this.api)throw new x("Mfa flow has no API instance");if(!this.meta.smsCode)throw new x("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new x("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(ed,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return gt(t)}catch(t){throw pe(t)}}};import{jsx as Rr,jsxs as E1}from"react/jsx-runtime";var Xn;function a7(e){return typeof e=="string"&&e.length===25}function we(){if(!Xn){let e=j.get(bo);return Promise.resolve(e||null)}return Xn.getAccessToken()}var T1,Dd=(e,t)=>T1(e,t),P1,Fd=(e,t)=>P1(e,t),S1,Ud=(e,t)=>S1(e,t),x1,Bd=()=>x1(),s7=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;j.put(ri,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},l7=({config:e,...t})=>{if(!a7(t.appId))throw new x("Cannot initialize the Privy provider with an invalid Privy app ID");Xn||(Xn=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."),Rr(fu,{client:Xn,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Rr(c7,{...t,config:r,client:Xn})})},c7=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=Qn(u),[g,w]=Oe(!1),[v,k]=Oe(null),[E,T]=Oe(!1),[W,I]=Oe({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[D,R]=Oe({status:"initial"}),[B,$]=Oe(null),[V,z]=Oe(null),[A,ne]=Oe(null),F=Ga(),ae=Va(),[Q,Y]=Oe(!0),[Ae,ee]=Oe({}),[lr,it]=Oe(null),[Ne,me]=Oe(null),[Wt,cr]=Oe(!1),[qo,pr]=Oe(!1),ft=Qn(null),De=Qn(null),L=Qn(Su);t.onStoreToken=p=>{p&&N(L,"accessToken","onAccessTokenGranted",p)},t.onDeleteToken=()=>{N(L,"accessToken","onAccessTokenRemoved")};let ue=Qn(null),H=Qn(null),dr=n7(p=>{let d=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(y=>y.type==="wallet"&&y.walletClientType==="privy")?d&&p?.some(y=>y?.walletClientType==="privy"):d},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),ie=p=>{k(p),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:p})},ht=p=>{F.embeddedWallets.createOnLogin!=="off"&&Y(!0),ie(p)};Kr(()=>{if(!A||!s){t.connectors?.removeEmbeddedWalletConnector();return}let p=s?.linkedAccounts.filter(d=>d.type==="wallet"&&d.walletClientType==="privy");if(p&&p.length>0){let d=p[0].address;t.connectors?.addEmbeddedWalletConnector(A,d,F.defaultChain,e.appId)}},[A,s]),Kr(()=>{A&&Ne?.(A)},[A]),Kr(()=>{(async()=>{if(!F.customAuth?.enabled)return;Y(!0);let{getCustomAccessToken:d,isLoading:m}=F.customAuth;if(!(!n||m))try{let y=await d();if(!y&&i){await Ko.logout();return}if(!y||i)return;t.startAuthFlow(new Zo(y));let{user:S,isNewUser:U}=await t.authenticate();if(!S){await Ko.logout();return}c(S||null),w(U||!1),l(!0),pr(!0)}catch(y){console.warn(y),i&&await Ko.logout()}})()},[F.customAuth?.enabled,F.customAuth?.getCustomAccessToken,F.customAuth?.isLoading,n,i]),Kr(()=>{qo&&A&&s&&Dt(s,e.config?.embeddedWallets?.createOnLogin)&&(pr(!1),vp(s,Qo).catch(console.error))},[qo&&A&&s]),Kr(()=>{async function p(){let d=Ir();s7();let m=o7();$(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(()=>{$o()});let y=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!y),y&&N(L,"login","onComplete",y,!1,!0,null),c(y)),d||se.setReadyToTrue(!!y),d&&(y?H.current="link":H.current="login")}!n&&ae&&p()},[t,lr,n,ae]);let Ir=()=>{let p=ii();return!p.inProgress||p.headless?!1:(t.startAuthFlow(new mr(p)),ht("AWAITING_OAUTH_SCREEN"),!0)},Ji=async(p,d,m,y)=>{let S=await t.connectors?.createWalletConnector(p,d)||null;ei(S,d,m,y)};async function ei(p,d,m,y){if(p)I({status:"disconnected",connectedWallet:null,connectError:null,connector:p,connectRetry:b});else return I({status:"disconnected",connectedWallet:null,connectError:new J("Unable to connect to wallet."),connector:null,connectRetry:b}),y?.(null,m);p instanceof gr&&d&&await p.resetConnection(d),I({connector:p,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>ei(p,d,m,y)});try{let S=await p.connect({showPrompt:!0});if(F.shouldEnforceDefaultChainOnConnect&&!F.chains.find(U=>U.id===Number(S?.chainId))&&!(S?.connectorType==="wallet_connect_v2"&&S?.walletClientType==="metamask")){I(U=>({...U,connector:p,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await S?.switchChain(F.defaultChain.id),S&&(S.chainId=en(So(F.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${F.defaultChain.id}`)}}return I(U=>({...U,status:"connected",connectedWallet:S,connectError:null,connectRetry:b})),S&&!H.current&&N(L,"connectWallet","onSuccess",S),y?.(S,m)}catch(S){return S instanceof Ie?(console.warn(S.cause?S.cause:S.message),H.current||N(L,"connectWallet","onError",S.privyErrorCode||"generic_connect_wallet_error")):(console.warn(S),H.current||N(L,"connectWallet","onError","unknown_connect_wallet_error")),I(U=>({...U,status:"disconnected",connectedWallet:null,connectError:S})),y?.(null,m)}}let Yr=async(p,d)=>{if(p===null)return;let m=new xo(p,d);t.startAuthFlow(m)},$o=()=>{let p=new URLSearchParams(window.location.search),d=p.get("privy_connector"),m=p.get("privy_wallet_client");if(!d||!m)return;if(m==="phantom"&&!Qr()&&ht("LOGIN_FAILED_SCREEN"),!t.connectors)throw new x("Connector not initialized");ie("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(d,m,void 0,Yr)};Kr(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(c)},[n,i,s,t]);let Ce=()=>{if(!i)throw N(L,"linkAccount","onError","must_be_authenticated"),new x("User must be authenticated before linking an account.")},Ge=()=>{Ce(),ue.current="siwe",H.current="link",ie("LINK_WALLET_SCREEN")},Zr=p=>{if(!i||!s)return!1;if(p.walletClientType==="privy")return!0;for(let d of s.linkedAccounts)if(d.type==="wallet"&&d.address===p.address&&d.walletClientType!=="privy")return!0;return!1},ti=async p=>{if(!t.connectors)throw new x("Connector not initialized");let d=t.connectors.findWalletConnector(p.connectorType,p.walletClientType)||null;if(I(m=>({...m,connector:d,status:"connected",connectedWallet:p,connectError:null,connectRetry:b})),F.captchaEnabled&&!i){let m={callback:y=>Yr(p,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ee({captchaModalData:m}),ht("CAPTCHA_SCREEN")}else await Yr(p),ht("AWAITING_CONNECTION")},jo=async(p,d)=>{if(!F.fiatOnRamp.enabled)throw new x("Fiat on-ramp is not enabled");if(!d||!d.provider||d.provider==="moonpay"){let{signedUrl:m,externalTransactionId:y}=await Wf(t,p,d?.config??{},F.appearance.palette,F.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:y}}else throw new x("Unsupported fund provider. Currently supported option is `moonpay`.")},Lt=()=>{h(p=>{let d=t.connectors?.wallets.map(m=>({...m,linked:Zr(m),loginOrLink:async()=>{if(!await m.isConnected())throw new x("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new x("Cannot link or login with embedded wallet");ti(m)},fund:async y=>{let{signedUrl:S,externalTransactionId:U}=await jo(m.address,y);ee({fiatOnRampPrompt:{signedUrl:S},fiatOnRampStatus:{externalTransactionId:U}}),ie("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new x("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new x("Cannot unlink an embedded wallet");let y=await t.unlinkWallet(m.address);c(y)}}))||[];return cr(dr(d)),ba(p,d)?p:d})};Kr(()=>{Lt()},[s?.linkedAccounts,i,n]),Kr(()=>{if(n){if(!t.connectors)throw new x("Connector not initialized");Lt(),t.connectors.on("walletsUpdated",Lt)}},[n]);let hl=()=>{ie(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Kr(()=>{if(!u[0])return;let p=u[0],d=f.current.find(y=>y.address===p.address),m;if(p.walletClientType==="privy"?m=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===p.address&&y.walletClientType==="privy"):m=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===p.address&&y.walletClientType!=="privy"),!d&&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 vp=async(p,d)=>{if(Se(p))throw N(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[y,S]=await Promise.all([se.initializeWalletProxy(d),we()]);if(!y&&e.config?.customAuth?.enabled)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!y||!S||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((U,ce)=>{Y(!0),ee({createWallet:{onSuccess:yt=>{N(L,"createWallet","onSuccess",yt),U(yt)},onFailure:yt=>{N(L,"createWallet","onError","unknown_embedded_wallet_error"),ce(yt)},callAuthOnSuccessOnClose:!1}}),ie("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await y.create({accessToken:S});let U=await se.refreshUser(),ce=Se(U);if(!ce)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(L,"createWallet","onSuccess",ce),ce}},R1=p=>{if(!F.chains.map(d=>d.id).includes(p))throw new J(`Chain ID ${p} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Cp=(p,d,m)=>new Promise(async(y,S)=>{if(!i||!s){N(L,"sendTransaction","onError","must_be_authenticated"),S(new Error("User must be authenticated before signing with a Privy wallet"));return}let U=Se(s);if(!U){N(L,"sendTransaction","onError","embedded_wallet_not_found"),S(new Error("Must have a Privy wallet before signing"));return}Y(!0);let ce=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,at=p.chainId?Number(p.chainId):ce.chainId;R1(at);let yt=Object.assign({},p,{chainId:at}),Mr=async()=>{let st=await we();if(!st||!A){N(L,"sendTransaction","onError","embedded_wallet_not_found"),S(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await se.recoverEmbeddedWallet()){N(L,"sendTransaction","onError","unknown_connect_wallet_error"),S(new Error("Unable to connect to wallet"));return}let Kt=Lr(yt.chainId,F.chains,F.rpcConfig,{appId:e.appId}),yl=await Kn(U.address,yt,Kt);if(F.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:M1}=await jn(yl,Kt),{hasSufficientFunds:W1}=await il(U.address,yl,M1,Kt);if(!W1)throw new Re(new Ft("Wallet has insufficient funds for this transaction.",et.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Ep=await nl(st,U.address,A,yl,Kt);N(L,"sendTransaction","onSuccess",Ep),y(Ep)}catch(jt){N(L,"sendTransaction","onError","transaction_failure"),S(jt)}};if(F.embeddedWallets.noPromptOnSignature)d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Mr();else{let st={transactionRequest:yt,onSuccess:Kt=>{N(L,"sendTransaction","onSuccess",Kt),y(Kt)},onFailure:Kt=>{N(L,"sendTransaction","onError","transaction_failure"),S(Kt)},uiOptions:d||{},fundWalletConfig:m},jt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Kt=>{N(L,"sendTransaction","onError","unknown_connect_wallet_error"),S(Kt)}};ee({connectWallet:jt,sendTransaction:st}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function wp(){return new Promise(async(p,d)=>{let m=await we();if(!m||!A)throw new Error("Must have valid access token to enroll in MFA");try{await A.verifyMfa({accessToken:m}),p()}catch(y){d(y)}})}let Ot=p=>{if(p==="passkey"){if(s&&s.linkedAccounts.filter(d=>d.type==="passkey").length>=5)throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new x(`User already has an account of type ${p} linked.`)}else if(s?.[p])throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new x(`User already has an account of type ${p} linked.`)},Ko={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:hl,linkWallet:Ge,linkEmail:()=>{Ce(),Ot("email"),ue.current="email",H.current="link",ie("LINK_EMAIL_SCREEN")},linkPhone:()=>{Ce(),Ot("phone"),ue.current="sms",H.current="link",ie("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Ce(),Ot("google"),H.current="link",await se.initLoginWithOAuth("google")},linkTwitter:async()=>{Ce(),Ot("twitter"),H.current="link",await se.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Ce(),Ot("discord"),H.current="link",await se.initLoginWithOAuth("discord")},linkGithub:async()=>{Ce(),Ot("github"),H.current="link",await se.initLoginWithOAuth("github")},linkSpotify:async()=>{Ce(),Ot("spotify"),H.current="link",await se.initLoginWithOAuth("spotify")},linkTiktok:async()=>{Ce(),Ot("tiktok"),H.current="link",await se.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Ce(),Ot("linkedin"),H.current="link",await se.initLoginWithOAuth("linkedin")},linkApple:async()=>{Ce(),Ot("apple"),H.current="link",await se.initLoginWithOAuth("apple")},linkPasskey:async()=>{Ce(),Ot("passkey"),H.current="link",ue.current="passkey",ie("LINK_PASSKEY_SCREEN")},linkFarcaster:async()=>{Ce(),Ot("farcaster"),await se.initLoginWithFarcaster(),H.current="link",ue.current="farcaster",ie("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Ce(),!s?.email)throw new x("User does not have an email linked to their account.");H.current="link",ue.current="email",ie("UPDATE_EMAIL_SCREEN")},login:async()=>{let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let d=await new Promise(m=>{it(y=>m.bind(y))});if(it(null),d){console.warn(p);return}}if(i){console.warn(p);return}H.current="login",ht("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(p=>{it(()=>p)}),it(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),k(null),N(L,"logout","onSuccess"),H.current=null,ue.current=null,o(!1),j.del(oi)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new xe;let p=u.find(m=>s.wallet&&m.address===s.wallet.address),d=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===p?.address));return!p||!d?new xe:d.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new gp(new fr(new xe));let p=u.find(m=>s.wallet&&m.address===s.wallet.address),d=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===p?.address));return!p||!d?new gp(new fr(new xe)):new gp(new fr(d.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new to(new xe);let p=u.find(m=>s.wallet&&m.address===s.wallet.address),d=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===p?.address));return!p||!d?new to(new xe):new to(d.proxyProvider)},unlinkWallet:async p=>{let d=await t.unlinkWallet(p);return c(d),d},unlinkEmail:async p=>{let d=await t.unlinkEmail(p);return c(d),d},unlinkPhone:async p=>{let d=await t.unlinkPhone(p);return c(d),d},unlinkGoogle:async p=>{let d=await t.unlinkOAuth("google",p);return c(d),d},unlinkTwitter:async p=>{let d=await t.unlinkOAuth("twitter",p);return c(d),d},unlinkDiscord:async p=>{let d=await t.unlinkOAuth("discord",p);return c(d),d},unlinkGithub:async p=>{let d=await t.unlinkOAuth("github",p);return c(d),d},unlinkSpotify:async p=>{let d=await t.unlinkOAuth("spotify",p);return c(d),d},unlinkTiktok:async p=>{let d=await t.unlinkOAuth("tiktok",p);return c(d),d},unlinkLinkedIn:async p=>{let d=await t.unlinkOAuth("linkedin",p);return c(d),d},unlinkApple:async p=>{let d=await t.unlinkOAuth("apple",p);return c(d),d},unlinkFarcaster:async p=>{let d=await t.unlinkFarcaster(p);return c(d),d},unlinkPasskey:async p=>{let d=await t.unlinkPasskey(p);return c(d),d},setActiveWallet:async p=>{let d=u.find(y=>fl(y.address)===fl(p)),m=s?.linkedAccounts.find(y=>y.type==="wallet"&&fl(y.address)===fl(p));if(!d||!await d.isConnected())z(p),Ge();else if(!d.linked)d.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 N(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return vp(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw N(L,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let p=Se(s);if(!p||!A)throw N(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(p.recoveryMethod==="user-passcode")throw N(L,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await wp()}catch(d){throw N(L,"setWalletPassword","onError","missing_mfa_credentials"),d}return new Promise((d,m)=>{Y(!0);let y={onSuccess:U=>{N(L,"setWalletPassword","onSuccess",U),d(U)},onFailure:U=>{N(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(U)},callAuthOnSuccessOnClose:!1},S={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:U=>{N(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(U)}};ee({setWalletPassword:y,connectWallet:S}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(p,d)=>new Promise(async(m,y)=>{if(!i||!s){N(L,"signMessage","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let S=Se(s);if(!S){N(L,"signMessage","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}if(typeof p!="string"||p.length<1){N(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 ce=await we();if(!A||!ce)throw new Error("Unable to connect to wallet");if(!await se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:S.address});let{response:yt}=await A.rpc({accessToken:ce,address:S.address,request:{method:"personal_sign",params:[p,S.address]}}),Mr=yt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:S.address}),Mr};if(F.embeddedWallets.noPromptOnSignature){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ce=await U();N(L,"signMessage","onSuccess",ce),m(ce)}catch(ce){N(L,"signMessage","onError","unable_to_sign"),y(ce??new Re("Unable to sign message"))}}else{let yt={method:"personal_sign",data:p,confirmAndSign:U,onSuccess:st=>{N(L,"signMessage","onSuccess",st),m(st)},onFailure:st=>{N(L,"signMessage","onError","unable_to_sign"),y(st)},uiOptions:d||{}},Mr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:st=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),y(st)}};ee({signMessage:yt,connectWallet:Mr}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(p,d)=>new Promise(async(m,y)=>{if(!i||!s){N(L,"signTypedData","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let S=Se(s);if(!S){N(L,"signTypedData","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}Y(!0);let U=fa(p),ce=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let at=await we();if(!A||!at)throw new Error("Unable to connect to wallet");if(!await se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:S.address});let{response:Mr}=await A.rpc({accessToken:at,address:S.address,request:{method:"eth_signTypedData_v4",params:[S.address,U]}}),st=Mr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:S.address}),st};if(F.embeddedWallets.noPromptOnSignature||(F.legacyWalletUiConfig??!1)){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let at=await ce();N(L,"signTypedData","onSuccess",at),m(at)}catch(at){N(L,"signTypedData","onError","unable_to_sign"),y(at??new Re("Unable to sign message"))}}else{let Mr={method:"eth_signTypedData_v4",data:U,confirmAndSign:ce,onSuccess:jt=>{N(L,"signTypedData","onSuccess",jt),m(jt)},onFailure:jt=>{N(L,"signTypedData","onError","unable_to_sign"),y(jt)},uiOptions:d||{}},st={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:jt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),y(jt)}};ee({signMessage:Mr,connectWallet:st}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(p,d,m)=>{let S=await(await Cp(p,d,m)).wait();return al(S)},exportWallet:()=>new Promise(async(p,d)=>{if(!i||!s){d(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=Se(s);if(!m){d(new Error("Must have a Privy wallet before exporting"));return}Y(!0);let y={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:d},S=await we();if(!S||!A){d(new Error("Must have valid access token to enroll in MFA"));return}if(!A){d(new Error("Must have a Privy wallet before exporting"));return}try{try{await A.connect({accessToken:S,address:m.address}),await A.verifyMfa({accessToken:S})}catch(ce){if(Oo(ce))await se.recoverEmbeddedWallet();else throw ce}}catch(ce){d(ce);return}let U={appId:e.appId,origin:t.apiUrl,onSuccess:p,onFailure:d};ee({keyExport:U,connectWallet:y}),ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:wp,async init(p){let d;switch(p){case"sms":d=new ml("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${p}`)}t.startMfaFlow(d),await d.init()},async submit(p,d){switch(p){case"totp":case"sms":ft.current?.resolve({mfaMethod:p,mfaCode:d}),await new Promise((m,y)=>{De.current={resolve:m,reject:y}});break;default:throw ft.current?.reject(new x("Unsupported MFA method")),new x(`Unsupported MFA method: ${p}`)}},cancel(){ft.current?.reject(new x("MFA canceled"))},async initEnrollmentWithSms(p){let d=await we();if(!d||!A)throw new Error("Must have valid access token to enroll in MFA");await A.initEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber})},enrollInMfa(p){return new Promise((d,m)=>{if(!p){se.closePrivyModal(),d();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:d,onFailure:m}}),ie("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let p=await we();if(!p||!A)throw new Error("Must have valid access token to enroll in MFA");let d=await A.initEnrollMfa({method:"totp",accessToken:p});return{secret:d.secret,authUrl:d.authUrl}},async submitEnrollmentWithSms(p){let d=await we();if(!d||!A)throw new Error("Must have valid access token to enroll in MFA");await A.submitEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber,code:p.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(p){let d=await we();if(!d||!A)throw new Error("Must have valid access token to enroll in MFA");await A.submitEnrollMfa({method:"totp",accessToken:d,code:p.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async unenroll(p){let d=await we();if(!d||!A)throw new Error("Must have valid access token to remove MFA");await A.unenrollMfa({method:p,accessToken:d});let m=await t.getAuthenticatedUser();c(m)},requestFarcasterSigner:async()=>{let p=await we(),d=s?.linkedAccounts.find(S=>S.type==="wallet"&&S.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!d)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 se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let y=await A.initFarcasterSigner({address:d.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null});if(y.status==="approved"){let S=await t.getAuthenticatedUser();c(S||s||null)}ee({farcasterSigner:y}),ie("AWAITING_FARCASTER_SIGNER")},submitCast:async p=>{let d=await we(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!d)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 se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.submitCast({address:m.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:p,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:p})=>{let d=await we(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!d)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 se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.removeCast({address:m.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:p,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:p,castAuthorFid:d})=>{let m=await we(),y=s?.linkedAccounts.find(ce=>ce.type==="wallet"&&ce.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 se.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:p,fid:d}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:p,castAuthorFid:d})=>{let m=await we(),y=s?.linkedAccounts.find(ce=>ce.type==="wallet"&&ce.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 se.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:p,fid:d}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:p})=>{let d=await we(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!d)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 se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.submitLink({address:m.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:p},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:p})=>{let d=await we(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!d)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 se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.removeLink({address:m.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:p},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:E,loginWithCode(p){return se.loginWithCode(p)},initLoginWithEmail(p){return se.initLoginWithEmail(p)},initLoginWithSms(p){return se.initLoginWithSms(p)},otpState:D,fundWallet(p,d){return se.fundWallet(p,d)},initLoginWithHeadlessOAuth(p,d){return se.initLoginWithHeadlessOAuth(p,d)},loginWithHeadlessOAuth(p){return se.loginWithHeadlessOAuth(p)},isModalOpen:r};T1=Ko.signMessage,P1=Ko.signTypedData,S1=async(...p)=>{let d=await Cp(...p);return F.embeddedWallets.waitForTransactionConfirmation&&await d.wait(),d};let bp=!!e.config?.headless,se=(()=>({headless:bp,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:p=>F.chains.find(d=>d.id===Number(p))?.nativeCurrency.symbol,initializeWalletProxy:async p=>{if(A)return A;let d=new Promise(S=>{me(()=>U=>S(U))}),m=new Promise(S=>setTimeout(()=>S(null),p)),y=await Promise.race([d,m]);return me(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(p={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let d=n&&i&&s;H.current==="login"?p.shouldCallAuthOnSuccess&&d?(N(L,"login","onComplete",s,g,!1,ue.current??null),e.onSuccess?.(s,g)):N(L,"login","onError","exited_auth_flow"):H.current==="link"&&ue.current&&(p.isSuccess&&d?N(L,"linkAccount","onSuccess",s,ue.current):N(L,"linkAccount","onError","exited_link_flow")),z(null),H.current=null,ue.current=null,w(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:ie,connectWallet:ei,initLoginWithWallet:async(p,d)=>{ue.current="siwe",Yr(p,d)},loginWithWallet:async()=>{if(!n)throw new Yo;if(!(t.authFlow instanceof xo))throw new x("Must initialize SIWE flow first.");let p,d;if(i)try{p=await t.link(),ue.current="siwe"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:p,isNewUser:d}=await t.authenticate()),ue.current="siwe"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(p||s||null),w(d||!1),l(!0)},initLoginWithFarcaster:async p=>{let d=new ni(p);t.startAuthFlow(d);try{ue.current="farcaster",await d.initializeFarcasterConnect()}catch(m){throw H.current==="login"?N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):H.current==="link"&&N(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Yo;if(!(t.authFlow instanceof ni))throw new x("Must initialize Farcaster flow first.");let p,d;if(i)try{p=await t.link(),ue.current="farcaster"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:p,isNewUser:d}=await t.authenticate()),ue.current="farcaster"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(p||null),w(d||!1),l(!0)},async initLoginWithOAuth(p,d){if(ue.current=p,wl()){if(p==="google"&&ul(window.navigator.userAgent)){ht("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{ht("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}j.del(To);let m=new mr({provider:p});d&&m.addCaptchaToken(d),t.startAuthFlow(m);let y=await t.authFlow.getAuthorizationUrl();y&&y.url&&window.location.assign(y.url)},async loginWithOAuth(p){if(!(t.authFlow instanceof mr))throw new x("Must initialize OAuth flow before calling loginWithOAuth");let d=j.get(Eo),m=t.authFlow.meta.stateCode;if(d!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:p,storedStateCode:d??"",returnedStateCode:m??""}),new x("Unexpected auth flow. This may be a phishing attempt.");let y,S;if(i)try{y=await t.link(),ue.current=p}catch(U){throw N(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}else try{({user:y,isNewUser:S}=await t.authenticate()),ue.current=p}catch(U){throw H.current==="login"?N(L,"login","onError",U.privyErrorCode||"unknown_auth_error"):H.current==="link"&&N(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}c(y),w(S||!1),l(!0)},async loginWithPasskey(p){let d=new si(p);t.startAuthFlow(d),H.current="login";let m,y;try{ue.current="passkey",{user:m,isNewUser:y}=await t.authenticate()}catch(S){throw N(L,"login","onError",S.privyErrorCode||"unknown_auth_error"),S}c(m),w(y||!1),l(!0)},async linkWithPasskey(){let p=new si;t.startAuthFlow(p);let d;try{ue.current="passkey",d=await t.link()}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}c(d||s||null)},async initLoginWithHeadlessOAuth(p,d){if(wl()){if(p==="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 mr({provider:p,headless:!0});d&&m.addCaptchaToken(d);let y=await t.startAuthFlow(m).getAuthorizationUrl();y?.url&&window.location.assign(y.url)},async loginWithHeadlessOAuth(p){T(!0),t.startAuthFlow(new mr(p));let d=j.get(Eo),m=p.stateCode;if(d!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:p.provider,storedStateCode:d??"",returnedStateCode:m??""}),T(!1),new x("Unexpected auth flow. This may be a phishing attempt.");let y,S;if(i)try{y=await t.link(),ue.current=p.provider}catch(U){throw N(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}else try{({user:y,isNewUser:S}=await t.authenticate()),ue.current=p.provider}catch(U){throw H.current==="login"?N(L,"login","onError",U.privyErrorCode||"unknown_auth_error"):H.current==="link"&&N(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}return c(y),w(S||!1),l(!0),T(!1),y??void 0},initLoginWithEmail:async(p,d)=>{let m=new Jr(p,d);t.startAuthFlow(m);try{ue.current="email",await m.sendCodeEmail()}catch(y){throw H.current==="login"?N(L,"login","onError",y.privyErrorCode||"unknown_auth_error"):H.current==="link"&&N(L,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},initUpdateEmail:async(p,d,m)=>{let y=new na(p,d,m);t.startAuthFlow(y),await y.sendCodeEmail()},initLoginWithSms:async(p,d)=>{R({status:"sending-code"});let m=new ko(p,d);t.startAuthFlow(m);try{ue.current="sms",await m.sendSmsCode(),R({status:"awaiting-code-input"})}catch(y){throw R({status:"error",error:y}),H.current==="login"?N(L,"login","onError",y.privyErrorCode||"unknown_auth_error"):H.current==="link"&&N(L,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async p=>{if(R({status:"submitting-code"}),!n){let S=new Yo;throw R({status:"error",error:S}),S}if(t.authFlow instanceof Jr)t.authFlow.meta.emailCode=p.trim();else if(t.authFlow instanceof ko)t.authFlow.meta.smsCode=p.trim();else{let S=new x("Must initialize a passwordless code flow first");throw R({status:"error",error:S}),S}let d=await we(),m,y;if(d&&t.sessionHasActiveToken())try{m=await t.link()}catch(S){throw R({status:"error",error:S}),N(L,"linkAccount","onError",S.privyErrorCode||"failed_to_link_account"),S}else try{({user:m,isNewUser:y}=await t.authenticate())}catch(S){throw R({status:"error",error:S}),N(L,"login","onError",S.privyErrorCode||"unknown_auth_error"),S}c(m||s||null),w(y||!1),l(!0),R({status:"done"})},refreshUser:async()=>{let p=await t.getAuthenticatedUser();return c(p),p},walletProxy:A,createAnalyticsEvent:(p,d,m)=>t.createAnalyticsEvent(p,d,m),acceptTerms:async()=>{let p=await t.acceptTerms();return c(p),p},getUsdTokenPrice:p=>t.getUsdTokenPrice(p),recoverEmbeddedWallet:async()=>new Promise(async(p,d)=>{let m=s?.linkedAccounts.find(S=>S.type==="wallet"&&S.walletClientType==="privy"),y=await we();if(!y||!A||!m){d(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}),p(!0)}catch(S){Oo(S)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await A.recover({address:m.address,accessToken:y})).address||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),p(!0)):Oo(S)?(ee({recoverWallet:{privyWallet:m,onFailure:d,onSuccess:()=>p(!0)}}),ie("EMBEDDED_WALLET_RECOVERY_SCREEN")):d(S)}}),getFiatOnRampConfig:jo,setReadyToTrue:p=>{a(!0),lr?.(p)},updateWallets:()=>Lt(),fundWallet:async(p,d)=>{let{signedUrl:m,externalTransactionId:y}=await jo(p,d);ee({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:y}}),ie("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async p=>{let d=await we(),m=s?.linkedAccounts.find(S=>S.type==="wallet"&&S.walletClientType==="privy");if(!d)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(p);if(y.status==="approved"){let S=await t.getAuthenticatedUser();c(S||s||null)}return y}}))();x1=se.recoverEmbeddedWallet;let I1=i7(()=>({wallets:u,ready:Wt}),[u,Wt]);return Rr(fe.Provider,{value:Ko,children:Rr(Hl.Provider,{value:L,children:Rr(ip.Provider,{value:I1,children:E1(Eu,{...F,children:[e.children,E1(Bl.Provider,{value:se,children:[!bp&&F.captchaEnabled&&n&&!i&&Rr(Ul,{delayedExecution:!1}),Rr(f1,{theme:{...F.appearance.palette||{}}}),Rr(yu,{data:Ae,setModalData:ee,setInitialScreen:k,initialScreen:v,authenticated:i,open:r,children:Rr(v1,{open:r})}),Q&&ae?Rr(b1,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:ft,mfaSubmitPromise:De,onLoad:ne,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as p7}from"react";function d7(e){let{login:t}=p7(fe);return _e("login",e),{login:t}}import{useContext as u7}from"react";function m7(e){let{logout:t}=u7(fe);return _e("logout",e),{logout:t}}import{useCallback as k1,useEffect as f7}from"react";function h7(){let e=ge(),t=Va(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=k1(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=k1(async()=>{let c=ii();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{ai()}},[o]);return f7(()=>{let c=ii();a&&t&&c.inProgress&&c.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as _1}from"react";var y7=()=>{let e=ge(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=_1(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=_1(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 A1}from"react";var g7=()=>{let e=ge(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=G(),n=A1(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),a=A1(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 v7}from"react";function C7(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}=v7(fe);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 w7}from"react";function b7(e){let{connectWallet:t}=w7(fe);return _e("connectWallet",e),{connectWallet:t}}import{useContext as E7}from"react";function T7(e){let{createWallet:t}=E7(fe);return _e("createWallet",e),{createWallet:t}}var P7=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as S7}from"react";function x7(e){let{sendTransaction:t}=S7(fe);return _e("sendTransaction",e),{sendTransaction:t}}import{useContext as k7}from"react";function _7(e){let{setWalletPassword:t}=k7(fe);return _e("setWalletPassword",e),{setWalletPassword:t}}import{useContext as A7}from"react";function R7(e){let{signMessage:t}=A7(fe);return _e("signMessage",e),{signMessage:t}}import{useContext as I7}from"react";function M7(e){let{signTypedData:t}=I7(fe);return _e("signTypedData",e),{signTypedData:t}}import{useContext as W7}from"react";var L7=()=>{let{isModalOpen:e}=W7(fe);return{isOpen:e}};import{useContext as O7}from"react";function N7(e){let{getAccessToken:t}=O7(fe);return _e("accessToken",e),{getAccessToken:t}}function D7(){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 F7(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{fr as AsExternalProvider,Ul as Captcha,ui as ConnectorManager,mi as PrivyClient,l7 as PrivyProvider,xe as PrivyProxyProvider,pi as SUPPORTED_CHAINS,Pl as VERSION,vt as WalletConnector,F7 as addRpcUrlOverrideToChain,dc as errorIndicatesMaxMfaRetries,kn as errorIndicatesMfaTimeout,_n as errorIndicatesMfaVerificationFailed,we as getAccessToken,b7 as useConnectWallet,T7 as useCreateWallet,D7 as useExperimentalFarcasterSigner,P7 as useFundWallet,C7 as useLinkAccount,d7 as useLogin,y7 as useLoginWithEmail,h7 as useLoginWithOAuth,g7 as useLoginWithSms,m7 as useLogout,Gn as useMfa,Hi as useMfaEnrollment,L7 as useModalStatus,G as usePrivy,Gl as useRegisterMfaListener,x7 as useSendTransaction,_7 as useSetWalletPassword,R7 as useSignMessage,M7 as useSignTypedData,N7 as useToken,Ki as useWallets};
|
|
2862
|
+
`;import{jsx as Ye,jsxs as v1}from"react/jsx-runtime";var Y6={["LANDING"]:fh,["CONNECT_OR_CREATE"]:uh,["AWAITING_PASSWORDLESS_CODE"]:Yu,["AWAITING_CONNECTION"]:fm,["AWAITING_CONNECT_ONLY_CONNECTION"]:vm,["AWAITING_FARCASTER_CONNECTION"]:Tf,["AWAITING_FARCASTER_SIGNER"]:Af,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:Fy,["PHANTOM_INTERSTITIAL_SCREEN"]:Gy,["LOGIN_FAILED_SCREEN"]:Ah,["AWAITING_OAUTH_SCREEN"]:Oy,["ALLOWLIST_REJECTION_SCREEN"]:Uu,["USER_LIMIT_REACHED_SCREEN"]:m1,["INSTALL_PHANTOM_SCREEN"]:Vf,["LINK_EMAIL_SCREEN"]:hh,["LINK_PHONE_SCREEN"]:Ph,["LINK_WALLET_SCREEN"]:Sh,["LINK_PASSKEY_SCREEN"]:Eh,["UPDATE_EMAIL_SCREEN"]:p1,["CONNECT_ONLY_LANDING_SCREEN"]:dm,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:lm,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:of,["EMBEDDED_WALLET_CREATED_SCREEN"]:Sm,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Tm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:sf,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:Ky,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Am,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:o1,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:t1,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Of,["FIAT_ON_RAMP_STATUS_SCREEN"]:Df,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:af,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:nf,["MFA_ENROLLMENT_FLOW_SCREEN"]:Vh,["CAPTCHA_SCREEN"]:Xu,["ERROR_SCREEN"]:cf,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Ff,["AFFIRMATIVE_CONSENT_SCREEN"]:Nu},Z6=["LANDING","AWAITING_CONNECTION"],J6=({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=$6(null),f=Pu(h),g=o&&i&&Z6.includes(i)&&!n&&l==="ready";if(g1(()=>{g&&s()},[g]),g1(()=>{!o&&u&&c()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return v1(Bn,{id:"privy-modal-content",children:[Ye(P,{}),Ye(Z,{}),Ye(Mh,{children:Ye(wt,{})}),Ye(te,{}),Ye(K,{})]});if(!i&&e)return Ye(Bn,{style:{height:f},id:"privy-modal-conent",children:Ye("div",{ref:h,children:Ye(cp,{open:e,onClose:t})})});if(!i)return null;let w=Y6[i];return Ye(Bn,{style:{height:f},id:"privy-modal-content",children:v1("div",{ref:h,children:[Ye(Ur,{if:!!e,children:Ye(w,{})}),Ye(Ur,{if:!e,children:Ye(cp,{open:e,onClose:t})})]})})},Q6=()=>{let{closePrivyModal:e}=M(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:q6(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},C1=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=Q6(),[o,n]=j6(!1);Gl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ye(y1,{children:Ye(J6,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ye(Ih,{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 K6.createPortal(l,s)}return l};import{useState as X6}from"react";import{useEffect as w1,useRef as b1}from"react";var dl=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 zo(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 w=1e3*60*5;setTimeout(()=>{let v=new be("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},w)});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 i7}from"react/jsx-runtime";var e7=function(e){return()=>`id-${e++}`}(0);function t7(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ze(e){return e.error!==void 0}var He=new dl,yp=new Map,r7=(e,t)=>typeof t=="bigint"?t.toString():t,o7=(e,t)=>`${e}${JSON.stringify(t,r7)}`;function Je(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=o7(e,t);if(e==="privy:wallet:create"){let l=yp.get(a);if(l)return l}let i=new Promise((l,s)=>{let c=e7();He.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{yp.delete(a)});return yp.set(a,i),i}function n7(e){switch(e.event){case"privy:iframe:ready":let t=He.dequeue(e.event,e.id);return Ze(e)?t.reject(new be(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=He.dequeue(e.event,e.id);return Ze(e)?r.reject(new be(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=He.dequeue(e.event,e.id);return Ze(e)?o.reject(new be(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=He.dequeue(e.event,e.id);return Ze(e)?n.reject(new be(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=He.dequeue(e.event,e.id);return Ze(e)?a.reject(new be(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=He.dequeue(e.event,e.id);return Ze(e)?i.reject(new be(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=He.dequeue(e.event,e.id);return Ze(e)?l.reject(new be(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=He.dequeue(e.event,e.id);return Ze(e)?s.reject(new be(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function E1(e){let t=b1(null),r=b1(e.mfaMethods),o=ku(),[n,a]=X6(!1);return w1(()=>{r.current=e.mfaMethods},[e.mfaMethods]),w1(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&t7(f.data)&&n7(f.data)}let s={create(f){return Je("privy:wallet:create",f,i,e.origin)},connect(f){return Je("privy:wallet:connect",f,i,e.origin)},recover(f){return zo(g=>Je("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return zo(g=>Je("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return zo(g=>Je("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return zo(g=>Je("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return zo(g=>Je("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return Je("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return zo(g=>Je("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return Je("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return Je("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return Je("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return Je("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return Je("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return Je("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return Je("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 wd(()=>Je("privy:iframe:ready",{},i,e.origin),{abortSignal:h.signal}).then(c,u),()=>{window.removeEventListener("message",l),h.abort()}},[n]),i7("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 x("action required");if(!this.api)throw new x("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new x("phone number must be set when initialzing authentication.");try{await this.api.post(Xp,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw pe(t)}}async authenticate(){if(!this.meta.action)throw new x("action required");if(!this.api)throw new x("Mfa flow has no API instance");if(!this.meta.smsCode)throw new x("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new x("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(ed,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return gt(t)}catch(t){throw pe(t)}}};import{jsx as Ir,jsxs as T1}from"react/jsx-runtime";var Xn;function c7(e){return typeof e=="string"&&e.length===25}function Ce(){if(!Xn){let e=j.get(bo);return Promise.resolve(e||null)}return Xn.getAccessToken()}var P1,Dd=(e,t)=>P1(e,t),S1,Fd=(e,t)=>S1(e,t),x1,Ud=(e,t)=>x1(e,t),k1,Bd=()=>k1(),p7=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;j.put(ri,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},d7=({config:e,...t})=>{if(!c7(t.appId))throw new x("Cannot initialize the Privy provider with an invalid Privy app ID");Xn||(Xn=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(fu,{client:Xn,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Ir(u7,{...t,config:r,client:Xn})})},u7=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=Qn(u),[g,w]=Oe(!1),[v,k]=Oe(null),[E,T]=Oe(!1),[W,I]=Oe({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[D,R]=Oe({status:"initial"}),[B,$]=Oe(null),[V,z]=Oe(null),[A,oe]=Oe(null),F=Ga(),ae=Va(),[Q,Y]=Oe(!0),[Ae,ee]=Oe({}),[cr,it]=Oe(null),[Ne,ue]=Oe(null),[Mt,pr]=Oe(!1),[qo,dr]=Oe(!1),ft=Qn(null),De=Qn(null),L=Qn(Su);t.onStoreToken=p=>{p&&N(L,"accessToken","onAccessTokenGranted",p)},t.onDeleteToken=()=>{N(L,"accessToken","onAccessTokenRemoved")};let de=Qn(null),H=Qn(null),ur=s7(p=>{let d=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(y=>y.type==="wallet"&&y.walletClientType==="privy")?d&&p?.some(y=>y?.walletClientType==="privy"):d},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),ne=p=>{k(p),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:p})},ht=p=>{F.embeddedWallets.createOnLogin!=="off"&&Y(!0),ne(p)};Kr(()=>{if(!A||!s){t.connectors?.removeEmbeddedWalletConnector();return}let p=s?.linkedAccounts.filter(d=>d.type==="wallet"&&d.walletClientType==="privy");if(p&&p.length>0){let d=p[0].address;t.connectors?.addEmbeddedWalletConnector(A,d,F.defaultChain,e.appId)}},[A,s]),Kr(()=>{A&&Ne?.(A)},[A]),Kr(()=>{(async()=>{if(!F.customAuth?.enabled)return;Y(!0);let{getCustomAccessToken:d,isLoading:m}=F.customAuth;if(!(!n||m))try{let y=await d();if(!y&&i){await Ko.logout();return}if(!y||i)return;t.startAuthFlow(new Zo(y));let{user:S,isNewUser:U}=await t.authenticate();if(!S){await Ko.logout();return}c(S||null),w(U||!1),l(!0),dr(!0)}catch(y){console.warn(y),i&&await Ko.logout()}})()},[F.customAuth?.enabled,F.customAuth?.getCustomAccessToken,F.customAuth?.isLoading,n,i]),Kr(()=>{qo&&A&&s&&Nt(s,e.config?.embeddedWallets?.createOnLogin)&&(dr(!1),vp(s,Qo).catch(console.error))},[qo&&A&&s]),Kr(()=>{async function p(){let d=Mr();p7();let m=a7();$(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(()=>{$o()});let y=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!y),y&&N(L,"login","onComplete",y,!1,!0,null),c(y)),d||se.setReadyToTrue(!!y),d&&(y?H.current="link":H.current="login")}!n&&ae&&p()},[t,cr,n,ae]);let Mr=()=>{let p=ii();return!p.inProgress||p.headless?!1:(t.startAuthFlow(new fr(p)),ht("AWAITING_OAUTH_SCREEN"),!0)},Ji=async(p,d,m,y)=>{let S=await t.connectors?.createWalletConnector(p,d)||null;ei(S,d,m,y)};async function ei(p,d,m,y){if(p)I({status:"disconnected",connectedWallet:null,connectError:null,connector:p,connectRetry:b});else return I({status:"disconnected",connectedWallet:null,connectError:new J("Unable to connect to wallet."),connector:null,connectRetry:b}),y?.(null,m);p instanceof vr&&d&&await p.resetConnection(d),I({connector:p,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>ei(p,d,m,y)});try{let S=await p.connect({showPrompt:!0});if(F.shouldEnforceDefaultChainOnConnect&&!F.chains.find(U=>U.id===Number(S?.chainId))&&!(S?.connectorType==="wallet_connect_v2"&&S?.walletClientType==="metamask")){I(U=>({...U,connector:p,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await S?.switchChain(F.defaultChain.id),S&&(S.chainId=en(So(F.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${F.defaultChain.id}`)}}return I(U=>({...U,status:"connected",connectedWallet:S,connectError:null,connectRetry:b})),S&&!H.current&&N(L,"connectWallet","onSuccess",S),y?.(S,m)}catch(S){return S instanceof Ie?(console.warn(S.cause?S.cause:S.message),H.current||N(L,"connectWallet","onError",S.privyErrorCode||"generic_connect_wallet_error")):(console.warn(S),H.current||N(L,"connectWallet","onError","unknown_connect_wallet_error")),I(U=>({...U,status:"disconnected",connectedWallet:null,connectError:S})),y?.(null,m)}}let Yr=async(p,d)=>{if(p===null)return;let m=new xo(p,d);t.startAuthFlow(m)},$o=()=>{let p=new URLSearchParams(window.location.search),d=p.get("privy_connector"),m=p.get("privy_wallet_client");if(!d||!m)return;if(m==="phantom"&&!Qr()&&ht("LOGIN_FAILED_SCREEN"),!t.connectors)throw new x("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(d,m,void 0,Yr)};Kr(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(c)},[n,i,s,t]);let ve=()=>{if(!i)throw N(L,"linkAccount","onError","must_be_authenticated"),new x("User must be authenticated before linking an account.")},Ge=()=>{ve(),de.current="siwe",H.current="link",ne("LINK_WALLET_SCREEN")},Zr=p=>{if(!i||!s)return!1;if(p.walletClientType==="privy")return!0;for(let d of s.linkedAccounts)if(d.type==="wallet"&&d.address===p.address&&d.walletClientType!=="privy")return!0;return!1},ti=async p=>{if(!t.connectors)throw new x("Connector not initialized");let d=t.connectors.findWalletConnector(p.connectorType,p.walletClientType)||null;if(I(m=>({...m,connector:d,status:"connected",connectedWallet:p,connectError:null,connectRetry:b})),F.captchaEnabled&&!i){let m={callback:y=>Yr(p,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ee({captchaModalData:m}),ht("CAPTCHA_SCREEN")}else await Yr(p),ht("AWAITING_CONNECTION")},jo=async(p,d)=>{if(!F.fiatOnRamp.enabled)throw new x("Fiat on-ramp is not enabled");if(!d||!d.provider||d.provider==="moonpay"){let{signedUrl:m,externalTransactionId:y}=await Wf(t,p,d?.config??{},F.appearance.palette,F.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:y}}else throw new x("Unsupported fund provider. Currently supported option is `moonpay`.")},Wt=()=>{h(p=>{let d=t.connectors?.wallets.map(m=>({...m,linked:Zr(m),loginOrLink:async()=>{if(!await m.isConnected())throw new x("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new x("Cannot link or login with embedded wallet");ti(m)},fund:async y=>{let{signedUrl:S,externalTransactionId:U}=await jo(m.address,y);ee({fiatOnRampPrompt:{signedUrl:S},fiatOnRampStatus:{externalTransactionId:U}}),ne("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new x("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new x("Cannot unlink an embedded wallet");let y=await t.unlinkWallet(m.address);c(y)}}))||[];return pr(ur(d)),ba(p,d)?p:d})};Kr(()=>{Wt()},[s?.linkedAccounts,i,n]),Kr(()=>{if(n){if(!t.connectors)throw new x("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 p=u[0],d=f.current.find(y=>y.address===p.address),m;if(p.walletClientType==="privy"?m=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===p.address&&y.walletClientType==="privy"):m=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===p.address&&y.walletClientType!=="privy"),!d&&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 vp=async(p,d)=>{if(Se(p))throw N(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[y,S]=await Promise.all([se.initializeWalletProxy(d),Ce()]);if(!y&&e.config?.customAuth?.enabled)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!y||!S||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((U,ce)=>{Y(!0),ee({createWallet:{onSuccess:yt=>{N(L,"createWallet","onSuccess",yt),U(yt)},onFailure:yt=>{N(L,"createWallet","onError","unknown_embedded_wallet_error"),ce(yt)},callAuthOnSuccessOnClose:!1}}),ne("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await y.create({accessToken:S});let U=await se.refreshUser(),ce=Se(U);if(!ce)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(L,"createWallet","onSuccess",ce),ce}},I1=p=>{if(!F.chains.map(d=>d.id).includes(p))throw new J(`Chain ID ${p} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Cp=(p,d,m)=>new Promise(async(y,S)=>{if(!i||!s){N(L,"sendTransaction","onError","must_be_authenticated"),S(new Error("User must be authenticated before signing with a Privy wallet"));return}let U=Se(s);if(!U){N(L,"sendTransaction","onError","embedded_wallet_not_found"),S(new Error("Must have a Privy wallet before signing"));return}Y(!0);let ce=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,at=p.chainId?Number(p.chainId):ce.chainId;I1(at);let yt=Object.assign({},p,{chainId:at}),Wr=async()=>{let st=await Ce();if(!st||!A){N(L,"sendTransaction","onError","embedded_wallet_not_found"),S(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await se.recoverEmbeddedWallet()){N(L,"sendTransaction","onError","unknown_connect_wallet_error"),S(new Error("Unable to connect to wallet"));return}let Kt=Or(yt.chainId,F.chains,F.rpcConfig,{appId:e.appId}),yl=await Kn(U.address,yt,Kt);if(F.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:W1}=await jn(yl,Kt),{hasSufficientFunds:L1}=await il(U.address,yl,W1,Kt);if(!L1)throw new Re(new Dt("Wallet has insufficient funds for this transaction.",et.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Ep=await nl(st,U.address,A,yl,Kt);N(L,"sendTransaction","onSuccess",Ep),y(Ep)}catch(jt){N(L,"sendTransaction","onError","transaction_failure"),S(jt)}};if(F.embeddedWallets.noPromptOnSignature)d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Wr();else{let st={transactionRequest:yt,onSuccess:Kt=>{N(L,"sendTransaction","onSuccess",Kt),y(Kt)},onFailure:Kt=>{N(L,"sendTransaction","onError","transaction_failure"),S(Kt)},uiOptions:d||{},fundWalletConfig:m},jt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Kt=>{N(L,"sendTransaction","onError","unknown_connect_wallet_error"),S(Kt)}};ee({connectWallet:jt,sendTransaction:st}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function wp(){return new Promise(async(p,d)=>{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}),p()}catch(y){d(y)}})}let Lt=p=>{if(p==="passkey"){if(s&&s.linkedAccounts.filter(d=>d.type==="passkey").length>=5)throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new x(`User already has an account of type ${p} linked.`)}else if(s?.[p])throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new x(`User already has an account of type ${p} linked.`)},Ko={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:hl,linkWallet:Ge,linkEmail:()=>{ve(),Lt("email"),de.current="email",H.current="link",ne("LINK_EMAIL_SCREEN")},linkPhone:()=>{ve(),Lt("phone"),de.current="sms",H.current="link",ne("LINK_PHONE_SCREEN")},linkGoogle:async()=>{ve(),Lt("google"),H.current="link",await se.initLoginWithOAuth("google")},linkTwitter:async()=>{ve(),Lt("twitter"),H.current="link",await se.initLoginWithOAuth("twitter")},linkDiscord:async()=>{ve(),Lt("discord"),H.current="link",await se.initLoginWithOAuth("discord")},linkGithub:async()=>{ve(),Lt("github"),H.current="link",await se.initLoginWithOAuth("github")},linkSpotify:async()=>{ve(),Lt("spotify"),H.current="link",await se.initLoginWithOAuth("spotify")},linkTiktok:async()=>{ve(),Lt("tiktok"),H.current="link",await se.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{ve(),Lt("linkedin"),H.current="link",await se.initLoginWithOAuth("linkedin")},linkApple:async()=>{ve(),Lt("apple"),H.current="link",await se.initLoginWithOAuth("apple")},linkPasskey:async()=>{ve(),Lt("passkey"),H.current="link",de.current="passkey",ne("LINK_PASSKEY_SCREEN")},linkFarcaster:async()=>{ve(),Lt("farcaster"),await se.initLoginWithFarcaster(),H.current="link",de.current="farcaster",ne("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(ve(),!s?.email)throw new x("User does not have an email linked to their account.");H.current="link",de.current="email",ne("UPDATE_EMAIL_SCREEN")},login:async()=>{let p="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let d=await new Promise(m=>{it(y=>m.bind(y))});if(it(null),d){console.warn(p);return}}if(i){console.warn(p);return}H.current="login",ht("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(p=>{it(()=>p)}),it(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),k(null),N(L,"logout","onSuccess"),H.current=null,de.current=null,o(!1),j.del(oi)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new xe;let p=u.find(m=>s.wallet&&m.address===s.wallet.address),d=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===p?.address));return!p||!d?new xe:d.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new gp(new hr(new xe));let p=u.find(m=>s.wallet&&m.address===s.wallet.address),d=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===p?.address));return!p||!d?new gp(new hr(new xe)):new gp(new hr(d.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new to(new xe);let p=u.find(m=>s.wallet&&m.address===s.wallet.address),d=t.connectors?.walletConnectors.find(m=>m.wallets.find(y=>y.address===p?.address));return!p||!d?new to(new xe):new to(d.proxyProvider)},unlinkWallet:async p=>{let d=await t.unlinkWallet(p);return c(d),d},unlinkEmail:async p=>{let d=await t.unlinkEmail(p);return c(d),d},unlinkPhone:async p=>{let d=await t.unlinkPhone(p);return c(d),d},unlinkGoogle:async p=>{let d=await t.unlinkOAuth("google",p);return c(d),d},unlinkTwitter:async p=>{let d=await t.unlinkOAuth("twitter",p);return c(d),d},unlinkDiscord:async p=>{let d=await t.unlinkOAuth("discord",p);return c(d),d},unlinkGithub:async p=>{let d=await t.unlinkOAuth("github",p);return c(d),d},unlinkSpotify:async p=>{let d=await t.unlinkOAuth("spotify",p);return c(d),d},unlinkTiktok:async p=>{let d=await t.unlinkOAuth("tiktok",p);return c(d),d},unlinkLinkedIn:async p=>{let d=await t.unlinkOAuth("linkedin",p);return c(d),d},unlinkApple:async p=>{let d=await t.unlinkOAuth("apple",p);return c(d),d},unlinkFarcaster:async p=>{let d=await t.unlinkFarcaster(p);return c(d),d},unlinkPasskey:async p=>{let d=await t.unlinkPasskey(p);return c(d),d},setActiveWallet:async p=>{let d=u.find(y=>fl(y.address)===fl(p)),m=s?.linkedAccounts.find(y=>y.type==="wallet"&&fl(y.address)===fl(p));if(!d||!await d.isConnected())z(p),Ge();else if(!d.linked)d.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 N(L,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return vp(s,15e3)},setWalletPassword:async()=>{if(!i||!s)throw N(L,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let p=Se(s);if(!p||!A)throw N(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(p.recoveryMethod==="user-passcode")throw N(L,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await wp()}catch(d){throw N(L,"setWalletPassword","onError","missing_mfa_credentials"),d}return new Promise((d,m)=>{Y(!0);let y={onSuccess:U=>{N(L,"setWalletPassword","onSuccess",U),d(U)},onFailure:U=>{N(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(U)},callAuthOnSuccessOnClose:!1},S={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:U=>{N(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(U)}};ee({setWalletPassword:y,connectWallet:S}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(p,d)=>new Promise(async(m,y)=>{if(!i||!s){N(L,"signMessage","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let S=Se(s);if(!S){N(L,"signMessage","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}if(typeof p!="string"||p.length<1){N(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 ce=await Ce();if(!A||!ce)throw new Error("Unable to connect to wallet");if(!await se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:S.address});let{response:yt}=await A.rpc({accessToken:ce,address:S.address,request:{method:"personal_sign",params:[p,S.address]}}),Wr=yt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:S.address}),Wr};if(F.embeddedWallets.noPromptOnSignature){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ce=await U();N(L,"signMessage","onSuccess",ce),m(ce)}catch(ce){N(L,"signMessage","onError","unable_to_sign"),y(ce??new Re("Unable to sign message"))}}else{let yt={method:"personal_sign",data:p,confirmAndSign:U,onSuccess:st=>{N(L,"signMessage","onSuccess",st),m(st)},onFailure:st=>{N(L,"signMessage","onError","unable_to_sign"),y(st)},uiOptions:d||{}},Wr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:st=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),y(st)}};ee({signMessage:yt,connectWallet:Wr}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(p,d)=>new Promise(async(m,y)=>{if(!i||!s){N(L,"signTypedData","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let S=Se(s);if(!S){N(L,"signTypedData","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}Y(!0);let U=fa(p),ce=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let at=await Ce();if(!A||!at)throw new Error("Unable to connect to wallet");if(!await se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:S.address});let{response:Wr}=await A.rpc({accessToken:at,address:S.address,request:{method:"eth_signTypedData_v4",params:[S.address,U]}}),st=Wr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:S.address}),st};if(F.embeddedWallets.noPromptOnSignature||(F.legacyWalletUiConfig??!1)){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let at=await ce();N(L,"signTypedData","onSuccess",at),m(at)}catch(at){N(L,"signTypedData","onError","unable_to_sign"),y(at??new Re("Unable to sign message"))}}else{let Wr={method:"eth_signTypedData_v4",data:U,confirmAndSign:ce,onSuccess:jt=>{N(L,"signTypedData","onSuccess",jt),m(jt)},onFailure:jt=>{N(L,"signTypedData","onError","unable_to_sign"),y(jt)},uiOptions:d||{}},st={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:jt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),y(jt)}};ee({signMessage:Wr,connectWallet:st}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(p,d,m)=>{let S=await(await Cp(p,d,m)).wait();return al(S)},exportWallet:()=>new Promise(async(p,d)=>{if(!i||!s){d(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=Se(s);if(!m){d(new Error("Must have a Privy wallet before exporting"));return}Y(!0);let y={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:d},S=await Ce();if(!S||!A){d(new Error("Must have valid access token to enroll in MFA"));return}if(!A){d(new Error("Must have a Privy wallet before exporting"));return}try{try{await A.connect({accessToken:S,address:m.address}),await A.verifyMfa({accessToken:S})}catch(ce){if(Oo(ce))await se.recoverEmbeddedWallet();else throw ce}}catch(ce){d(ce);return}let U={appId:e.appId,origin:t.apiUrl,onSuccess:p,onFailure:d};ee({keyExport:U,connectWallet:y}),ne("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:wp,async init(p){let d;switch(p){case"sms":d=new ml("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${p}`)}t.startMfaFlow(d),await d.init()},async submit(p,d){switch(p){case"totp":case"sms":ft.current?.resolve({mfaMethod:p,mfaCode:d}),await new Promise((m,y)=>{De.current={resolve:m,reject:y}});break;default:throw ft.current?.reject(new x("Unsupported MFA method")),new x(`Unsupported MFA method: ${p}`)}},cancel(){ft.current?.reject(new x("MFA canceled"))},async initEnrollmentWithSms(p){let d=await Ce();if(!d||!A)throw new Error("Must have valid access token to enroll in MFA");await A.initEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber})},enrollInMfa(p){return new Promise((d,m)=>{if(!p){se.closePrivyModal(),d();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:d,onFailure:m}}),ne("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let p=await Ce();if(!p||!A)throw new Error("Must have valid access token to enroll in MFA");let d=await A.initEnrollMfa({method:"totp",accessToken:p});return{secret:d.secret,authUrl:d.authUrl}},async submitEnrollmentWithSms(p){let d=await Ce();if(!d||!A)throw new Error("Must have valid access token to enroll in MFA");await A.submitEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber,code:p.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(p){let d=await Ce();if(!d||!A)throw new Error("Must have valid access token to enroll in MFA");await A.submitEnrollMfa({method:"totp",accessToken:d,code:p.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async unenroll(p){let d=await Ce();if(!d||!A)throw new Error("Must have valid access token to remove MFA");await A.unenrollMfa({method:p,accessToken:d});let m=await t.getAuthenticatedUser();c(m)},requestFarcasterSigner:async()=>{let p=await Ce(),d=s?.linkedAccounts.find(S=>S.type==="wallet"&&S.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!A||!d)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 se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let y=await A.initFarcasterSigner({address:d.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null});if(y.status==="approved"){let S=await t.getAuthenticatedUser();c(S||s||null)}ee({farcasterSigner:y}),ne("AWAITING_FARCASTER_SIGNER")},submitCast:async p=>{let d=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!d)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 se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.submitCast({address:m.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:p,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:p})=>{let d=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!d)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 se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.removeCast({address:m.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:p,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:p,castAuthorFid:d})=>{let m=await Ce(),y=s?.linkedAccounts.find(ce=>ce.type==="wallet"&&ce.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 se.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:p,fid:d}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:p,castAuthorFid:d})=>{let m=await Ce(),y=s?.linkedAccounts.find(ce=>ce.type==="wallet"&&ce.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 se.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:p,fid:d}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:p})=>{let d=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!d)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 se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.submitLink({address:m.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:p},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:p})=>{let d=await Ce(),m=s?.linkedAccounts.find(U=>U.type==="wallet"&&U.walletClientType==="privy");if(!d)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 se.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await A.removeLink({address:m.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:p},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:E,loginWithCode(p){return se.loginWithCode(p)},initLoginWithEmail(p){return se.initLoginWithEmail(p)},initLoginWithSms(p){return se.initLoginWithSms(p)},otpState:D,fundWallet(p,d){return se.fundWallet(p,d)},initLoginWithHeadlessOAuth(p,d){return se.initLoginWithHeadlessOAuth(p,d)},loginWithHeadlessOAuth(p){return se.loginWithHeadlessOAuth(p)},isModalOpen:r};P1=Ko.signMessage,S1=Ko.signTypedData,x1=async(...p)=>{let d=await Cp(...p);return F.embeddedWallets.waitForTransactionConfirmation&&await d.wait(),d};let bp=!!e.config?.headless,se=(()=>({headless:bp,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:p=>F.chains.find(d=>d.id===Number(p))?.nativeCurrency.symbol,initializeWalletProxy:async p=>{if(A)return A;let d=new Promise(S=>{ue(()=>U=>S(U))}),m=new Promise(S=>setTimeout(()=>S(null),p)),y=await Promise.race([d,m]);return ue(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(p={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let d=n&&i&&s;H.current==="login"?p.shouldCallAuthOnSuccess&&d?(N(L,"login","onComplete",s,g,!1,de.current??null),e.onSuccess?.(s,g)):N(L,"login","onError","exited_auth_flow"):H.current==="link"&&de.current&&(p.isSuccess&&d?N(L,"linkAccount","onSuccess",s,de.current):N(L,"linkAccount","onError","exited_link_flow")),z(null),H.current=null,de.current=null,w(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:ne,connectWallet:ei,initLoginWithWallet:async(p,d)=>{de.current="siwe",Yr(p,d)},loginWithWallet:async()=>{if(!n)throw new Yo;if(!(t.authFlow instanceof xo))throw new x("Must initialize SIWE flow first.");let p,d;if(i)try{p=await t.link(),de.current="siwe"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:p,isNewUser:d}=await t.authenticate()),de.current="siwe"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(p||s||null),w(d||!1),l(!0)},initLoginWithFarcaster:async p=>{let d=new ni(p);t.startAuthFlow(d);try{de.current="farcaster",await d.initializeFarcasterConnect()}catch(m){throw H.current==="login"?N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):H.current==="link"&&N(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Yo;if(!(t.authFlow instanceof ni))throw new x("Must initialize Farcaster flow first.");let p,d;if(i)try{p=await t.link(),de.current="farcaster"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:p,isNewUser:d}=await t.authenticate()),de.current="farcaster"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}c(p||null),w(d||!1),l(!0)},async initLoginWithOAuth(p,d){if(de.current=p,wl()){if(p==="google"&&ul(window.navigator.userAgent)){ht("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{ht("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}j.del(To);let m=new fr({provider:p});d&&m.addCaptchaToken(d),t.startAuthFlow(m);let y=await t.authFlow.getAuthorizationUrl();y&&y.url&&window.location.assign(y.url)},async loginWithOAuth(p){if(!(t.authFlow instanceof fr))throw new x("Must initialize OAuth flow before calling loginWithOAuth");let d=j.get(Eo),m=t.authFlow.meta.stateCode;if(d!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:p,storedStateCode:d??"",returnedStateCode:m??""}),new x("Unexpected auth flow. This may be a phishing attempt.");let y,S;if(i)try{y=await t.link(),de.current=p}catch(U){throw N(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}else try{({user:y,isNewUser:S}=await t.authenticate()),de.current=p}catch(U){throw H.current==="login"?N(L,"login","onError",U.privyErrorCode||"unknown_auth_error"):H.current==="link"&&N(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}c(y),w(S||!1),l(!0)},async loginWithPasskey(p){let d=new si(p);t.startAuthFlow(d),H.current="login";let m,y;try{de.current="passkey",{user:m,isNewUser:y}=await t.authenticate()}catch(S){throw N(L,"login","onError",S.privyErrorCode||"unknown_auth_error"),S}c(m),w(y||!1),l(!0)},async linkWithPasskey(){let p=new si;t.startAuthFlow(p);let d;try{de.current="passkey",d=await t.link()}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}c(d||s||null)},async initLoginWithHeadlessOAuth(p,d){if(wl()){if(p==="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:p,headless:!0});d&&m.addCaptchaToken(d);let y=await t.startAuthFlow(m).getAuthorizationUrl();y?.url&&window.location.assign(y.url)},async loginWithHeadlessOAuth(p){T(!0),t.startAuthFlow(new fr(p));let d=j.get(Eo),m=p.stateCode;if(d!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:p.provider,storedStateCode:d??"",returnedStateCode:m??""}),T(!1),new x("Unexpected auth flow. This may be a phishing attempt.");let y,S;if(i)try{y=await t.link(),de.current=p.provider}catch(U){throw N(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}else try{({user:y,isNewUser:S}=await t.authenticate()),de.current=p.provider}catch(U){throw H.current==="login"?N(L,"login","onError",U.privyErrorCode||"unknown_auth_error"):H.current==="link"&&N(L,"linkAccount","onError",U.privyErrorCode||"failed_to_link_account"),U}return c(y),w(S||!1),l(!0),T(!1),y??void 0},initLoginWithEmail:async(p,d)=>{let m=new Jr(p,d);t.startAuthFlow(m);try{de.current="email",await m.sendCodeEmail()}catch(y){throw H.current==="login"?N(L,"login","onError",y.privyErrorCode||"unknown_auth_error"):H.current==="link"&&N(L,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},initUpdateEmail:async(p,d,m)=>{let y=new na(p,d,m);t.startAuthFlow(y),await y.sendCodeEmail()},initLoginWithSms:async(p,d)=>{R({status:"sending-code"});let m=new ko(p,d);t.startAuthFlow(m);try{de.current="sms",await m.sendSmsCode(),R({status:"awaiting-code-input"})}catch(y){throw R({status:"error",error:y}),H.current==="login"?N(L,"login","onError",y.privyErrorCode||"unknown_auth_error"):H.current==="link"&&N(L,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async p=>{if(R({status:"submitting-code"}),!n){let S=new Yo;throw R({status:"error",error:S}),S}if(t.authFlow instanceof Jr)t.authFlow.meta.emailCode=p.trim();else if(t.authFlow instanceof ko)t.authFlow.meta.smsCode=p.trim();else{let S=new x("Must initialize a passwordless code flow first");throw R({status:"error",error:S}),S}let d=await Ce(),m,y;if(d&&t.sessionHasActiveToken())try{m=await t.link()}catch(S){throw R({status:"error",error:S}),N(L,"linkAccount","onError",S.privyErrorCode||"failed_to_link_account"),S}else try{({user:m,isNewUser:y}=await t.authenticate())}catch(S){throw R({status:"error",error:S}),N(L,"login","onError",S.privyErrorCode||"unknown_auth_error"),S}c(m||s||null),w(y||!1),l(!0),R({status:"done"})},refreshUser:async()=>{let p=await t.getAuthenticatedUser();return c(p),p},walletProxy:A,createAnalyticsEvent:(p,d,m)=>t.createAnalyticsEvent(p,d,m),acceptTerms:async()=>{let p=await t.acceptTerms();return c(p),p},getUsdTokenPrice:p=>t.getUsdTokenPrice(p),recoverEmbeddedWallet:async()=>new Promise(async(p,d)=>{let m=s?.linkedAccounts.find(S=>S.type==="wallet"&&S.walletClientType==="privy"),y=await Ce();if(!y||!A||!m){d(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}),p(!0)}catch(S){Oo(S)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await A.recover({address:m.address,accessToken:y})).address||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),p(!0)):Oo(S)?(ee({recoverWallet:{privyWallet:m,onFailure:d,onSuccess:()=>p(!0)}}),ne("EMBEDDED_WALLET_RECOVERY_SCREEN")):d(S)}}),getFiatOnRampConfig:jo,setReadyToTrue:p=>{a(!0),cr?.(p)},updateWallets:()=>Wt(),fundWallet:async(p,d)=>{let{signedUrl:m,externalTransactionId:y}=await jo(p,d);ee({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:y}}),ne("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async p=>{let d=await Ce(),m=s?.linkedAccounts.find(S=>S.type==="wallet"&&S.walletClientType==="privy");if(!d)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(p);if(y.status==="approved"){let S=await t.getAuthenticatedUser();c(S||s||null)}return y}}))();k1=se.recoverEmbeddedWallet;let M1=l7(()=>({wallets:u,ready:Mt}),[u,Mt]);return Ir(me.Provider,{value:Ko,children:Ir(Hl.Provider,{value:L,children:Ir(ip.Provider,{value:M1,children:T1(Eu,{...F,children:[e.children,T1(Bl.Provider,{value:se,children:[!bp&&F.captchaEnabled&&n&&!i&&Ir(Ul,{delayedExecution:!1}),Ir(h1,{theme:{...F.appearance.palette||{}}}),Ir(yu,{data:Ae,setModalData:ee,setInitialScreen:k,initialScreen:v,authenticated:i,open:r,children:Ir(C1,{open:r})}),Q&&ae?Ir(E1,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:ft,mfaSubmitPromise:De,onLoad:oe,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as m7}from"react";function f7(e){let{login:t}=m7(me);return _e("login",e),{login:t}}import{useContext as h7}from"react";function y7(e){let{logout:t}=h7(me);return _e("logout",e),{logout:t}}import{useCallback as _1,useEffect as g7}from"react";function v7(){let e=ye(),t=Va(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=_1(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=_1(async()=>{let c=ii();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{ai()}},[o]);return g7(()=>{let c=ii();a&&t&&c.inProgress&&c.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as A1}from"react";var C7=()=>{let e=ye(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=A1(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=A1(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 R1}from"react";var w7=()=>{let e=ye(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=G(),n=R1(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),a=R1(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 b7}from"react";function E7(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}=b7(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 T7}from"react";function P7(e){let{connectWallet:t}=T7(me);return _e("connectWallet",e),{connectWallet:t}}import{useContext as S7}from"react";function x7(e){let{createWallet:t}=S7(me);return _e("createWallet",e),{createWallet:t}}var k7=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as _7}from"react";function A7(e){let{sendTransaction:t}=_7(me);return _e("sendTransaction",e),{sendTransaction:t}}import{useContext as R7}from"react";function I7(e){let{setWalletPassword:t}=R7(me);return _e("setWalletPassword",e),{setWalletPassword:t}}import{useContext as M7}from"react";function W7(e){let{signMessage:t}=M7(me);return _e("signMessage",e),{signMessage:t}}import{useContext as L7}from"react";function O7(e){let{signTypedData:t}=L7(me);return _e("signTypedData",e),{signTypedData:t}}import{useContext as N7}from"react";var D7=()=>{let{isModalOpen:e}=N7(me);return{isOpen:e}};import{useContext as F7}from"react";function U7(e){let{getAccessToken:t}=F7(me);return _e("accessToken",e),{getAccessToken:t}}function B7(){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 H7(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{hr as AsExternalProvider,Ul as Captcha,ui as ConnectorManager,mi as PrivyClient,d7 as PrivyProvider,xe as PrivyProxyProvider,pi as SUPPORTED_CHAINS,Pl as VERSION,vt as WalletConnector,H7 as addRpcUrlOverrideToChain,dc as errorIndicatesMaxMfaRetries,kn as errorIndicatesMfaTimeout,_n as errorIndicatesMfaVerificationFailed,Ce as getAccessToken,P7 as useConnectWallet,x7 as useCreateWallet,B7 as useExperimentalFarcasterSigner,k7 as useFundWallet,E7 as useLinkAccount,f7 as useLogin,C7 as useLoginWithEmail,v7 as useLoginWithOAuth,w7 as useLoginWithSms,y7 as useLogout,Gn as useMfa,Hi as useMfaEnrollment,D7 as useModalStatus,G as usePrivy,Gl as useRegisterMfaListener,A7 as useSendTransaction,I7 as useSetWalletPassword,W7 as useSignMessage,O7 as useSignTypedData,U7 as useToken,Ki as useWallets};
|