@privy-io/react-auth 1.59.9 → 1.59.10-beta-20240402143202
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 +231 -225
- package/dist/index.js +231 -225
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Qs=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var nd=(e,t,r)=>(Qs(e,t,"read from private field"),r?r.call(e):t.get(e)),Di=(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)},Xs=(e,t,r,o)=>(Qs(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var id=(e,t,r)=>(Qs(e,t,"access private method"),r);import{getAddress as Ks}from"@ethersproject/address";import{Web3Provider as Xc}from"@ethersproject/providers";import{createStore as ME}from"mipd";import{useCallback as WE,useEffect as Or,useMemo as LE,useRef as Fn,useState as Me}from"react";import{FetchError as $y}from"ofetch";var $e=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}]`:""}`}},nr=class extends $e{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},S=class extends $e{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Fi=class extends S{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var Z=class extends $e{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ue=e=>{if(e instanceof $e)return e;if(!(e instanceof $y))return rt(e);if(!e.response)return new nr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new nr(t||"ApiError",e.response.status,r||o,e,n)},rt=e=>e instanceof $e?e:e instanceof Error?new S(e.message,e):new S(`Internal error: ${e}`);var Oo=class extends S{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},wt=class extends S{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ui=class extends S{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Bi="/api/v1/sessions",Hi="/api/v1/sessions/logout",ad="/api/v1/sessions/fork",Gi="/api/v1/sessions/fork/recover",sd="/api/v1/siwe/init",ld="/api/v1/siwe/authenticate",cd="/api/v1/siwe/link",dd="/api/v1/siwe/unlink",pd="/api/v1/farcaster/init",ud="/api/v1/farcaster/authenticate",md="/api/v1/farcaster/link",fd="/api/v1/farcaster/status",hd="/api/v1/farcaster/unlink",yd="/api/v1/passwordless/init",gd="/api/v1/passwordless/authenticate",vd="/api/v1/passwordless/link",wd="/api/v1/passwordless/unlink",Cd="/api/v1/passwordless/update",bd="/api/v1/passwordless_sms/init",Ed="/api/v1/passwordless_sms/link",Td="/api/v1/passwordless_sms/unlink",Pd="/api/v1/passwordless_sms/authenticate",xd="/api/v1/oauth/init",Sd="/api/v1/oauth/authenticate",_d="/api/v1/oauth/link",Ad="/api/v1/oauth/unlink";var kd="/api/v1/mfa/passwordless_sms/init",Rd="/api/v1/mfa/passwordless_sms/enroll";var Id="/api/v1/users/me/accept_terms",Md="/api/v1/analytics_events",Wd="/api/v1/plugins/moonpay_on_ramp/sign",Ld="/api/v1/custom_jwt_account/authenticate";var No=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");try{let t=await this.api.post(Ld,{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 ue(t)}}async link(){throw new Error("Unimplemented")}};var Fr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new S("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(gd,{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 ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new S("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(vd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ue(t)}}async sendCodeEmail(t,r){if(!this.api)throw new S("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new S("Email must be set when initialzing authentication.");try{return await this.api.post(yd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ue(o)}}},Vi=class extends Fr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new S("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Cd,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ue(r)}}};import{isMobile as Zy,isIOS as Qy}from"react-device-detect";var el=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)}},zi=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 tl(){try{let e="privy:__session_storage__test",t="blobby",r=new zi;return r.put(e,t),r.del(e),!0}catch{return!1}}function jy(){return typeof window<"u"&&window.localStorage?new zi:new el}var j=jy();import{StaticJsonRpcProvider as Uo}from"@ethersproject/providers";function Od(){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 qi=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 rl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||qi(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!rl(r))return!1}return!0},Ur=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Nd=()=>{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 Dd="1.59.9";var ol="4df5e2316331463a9130964bd6078dfa",nl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Fd="34357d3c125c2bcf2ce2bc3309d98715",$i="https://auth.privy.io",Ud=2e4,Oe=1400,Bd=2500,il=Dd;var mo="privy:token",al="privy-token",ji="privy:refresh_token",sl="privy-refresh-token",Ki="privy-session",Hn="privy:session_transfer_token",Yy="privy:wallet",Gn="privy:caid",fo="privy:state_code",Do="privy:code_verifier",ho="privy:headless_oauth",Yi=e=>`${Yy}:${e}`,ll="privy:connectors",cl="privy:connections";var yo=12e4,xr=1,dl="0x1",Fo=3e4,Hd="https://api.moonpay.com/v1",Gd="https://api.moonpay.com/v1",Vd="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",zd="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",qd="0x420000000000000000000000000000000000000F",$d=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var jd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Ji=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,}))$/),Kd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Br=(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}`},pl=e=>new Promise(t=>setTimeout(t,e));function Yd(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 Jd=(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 pl(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Zi=(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 Zd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),go=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Qd(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of Od()){let u=qi(d);if(!l.some(y=>y.info.name===u)){if(rl(d,!0)&&!s.find(y=>y.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(y=>y.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(y=>y.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function Bo(e){return`eip155:${String(Number(e))}`}var Qi=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new Z(`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]+"/"+ol:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+nl:i=a.rpcUrls.default?.http[0];if(!i)throw new Z(`No RPC url found for ${e}`);return i},Xd=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new Z(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Sr=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new Z(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new Uo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Uo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Uo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Uo(a.rpcUrls.infura.http[0]+"/"+ol):a.rpcUrls.blast?.http[0]?i=new Uo(a.rpcUrls.blast.http[0]+"/"+nl):i=new Uo(a.rpcUrls.default?.http[0]),!i)throw new Z(`No RPC url found for ${e}`);return i},Xi=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 ea=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Ho))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Ho={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 Jy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var ep=e=>e in Ho,tp=e=>{let t=Ho[e].mobile;if("native"in t)return t.native};function rp(e,t){let r=Jy(t);if(r.deepLink)return sp(r.deepLink,e);if(r.universalLink)return lp(r.universalLink,e);throw new S(`Unsupported wallet ${t.id}`)}var op="WALLETCONNECT_DEEPLINK_CHOICE";function np(){try{localStorage.removeItem(op)}catch{}}function ip({href:e,name:t}){try{localStorage.setItem(op,JSON.stringify({href:e,name:t}))}catch{}}function ap(e){return e.startsWith("http://")||e.startsWith("https://")}function sp(e,t){if(ap(e))return lp(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 lp(e,t){if(!ap(e))return sp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ta(e,t){window.open(e,t,"noreferrer noopener")}var ot=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 Vn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new ot(this._startChannelOnce.bind(this)),this.pollForReady=new ot(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.channelToken)throw new S("Auth flow must be initialized first");try{let t=await this.api.post(ud,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new S("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 ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");try{return await this.api.post(md,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ue(t)}}async _startChannelOnce(){if(!this.api)throw new S("Auth flow has no API instance");let t=await this.api.post(pd,{token:this.captchaToken});Zy&&!Qy&&t.connect_uri&&ta(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new S("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.channelToken)throw new S("Auth flow must be initialized first");let t=await this.api.get(fd,{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 pp}from"jose";async function cp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function dp(e){return crypto.getRandomValues(new Uint8Array(e))}function ra(){return!!j.get(ho)}var Xy="S256",eg="S256",ir=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:ra();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 S("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new S("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new S("User denied confirmation during OAuth flow");let t=j.get(Do);if(!t)throw new S("Authentication error.");try{let r=await this.api.post(Sd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Do),this.meta.headless&&j.del(ho),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=ue(r);throw o.privyErrorCode?new S(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new S("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new S("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new S("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new S("User denied confirmation during OAuth flow");let t=j.get(Do);if(!t)throw new S("Authentication error.");try{let r=await this.api.post(_d,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Do),r}catch(r){throw ue(r)}}createCodeVerifier(){return pp.encode(dp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=Xy){if(r==eg){let o=await cp(t);return pp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.provider)throw new S("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();j.put(Do,t);let r=this.createStateCode();j.put(fo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&j.put(ho,!0);try{return await this.api.post(xd,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ue(n)}}};function ul(e){return e.charAt(0).toUpperCase()+e.slice(1)}function up(e,t){let r={detail:"",retryable:!1},o=ul(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 qn(){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:ra()}}function $n(){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(fo),window.history.replaceState({},"",e)}var vo=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 tl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var sd=(e,t,r)=>(tl(e,t,"read from private field"),r?r.call(e):t.get(e)),Ui=(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)},rl=(e,t,r,o)=>(tl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var ld=(e,t,r)=>(tl(e,t,"access private method"),r);import{getAddress as Js}from"@ethersproject/address";import{Web3Provider as rd}from"@ethersproject/providers";import{createStore as V4}from"mipd";import{useCallback as z4,useEffect as Nr,useMemo as q4,useRef as Bn,useState as Me}from"react";import{FetchError as Xy}from"ofetch";var $e=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}]`:""}`}},nr=class extends $e{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},_=class extends $e{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Bi=class extends _{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends $e{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ue=e=>{if(e instanceof $e)return e;if(!(e instanceof Xy))return rt(e);if(!e.response)return new nr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new nr(t||"ApiError",e.response.status,r||o,e,n)},rt=e=>e instanceof $e?e:e instanceof Error?new _(e.message,e):new _(`Internal error: ${e}`);var No=class extends _{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},wt=class extends _{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Hi=class extends _{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Gi="/api/v1/sessions",Vi="/api/v1/sessions/logout",cd="/api/v1/sessions/fork",zi="/api/v1/sessions/fork/recover",dd="/api/v1/siwe/init",pd="/api/v1/siwe/authenticate",ud="/api/v1/siwe/link",md="/api/v1/siwe/unlink",fd="/api/v1/farcaster/init",hd="/api/v1/farcaster/authenticate",yd="/api/v1/farcaster/link",gd="/api/v1/farcaster/status",vd="/api/v1/farcaster/unlink",wd="/api/v1/passwordless/init",Cd="/api/v1/passwordless/authenticate",bd="/api/v1/passwordless/link",Ed="/api/v1/passwordless/unlink",Td="/api/v1/passwordless/update",Pd="/api/v1/passwordless_sms/init",xd="/api/v1/passwordless_sms/link",Sd="/api/v1/passwordless_sms/unlink",_d="/api/v1/passwordless_sms/authenticate",Ad="/api/v1/oauth/init",kd="/api/v1/oauth/authenticate",Rd="/api/v1/oauth/link",Id="/api/v1/oauth/unlink";var Md="/api/v1/mfa/passwordless_sms/init",Wd="/api/v1/mfa/passwordless_sms/enroll";var Ld="/api/v1/users/me/accept_terms",Od="/api/v1/analytics_events",Nd="/api/v1/plugins/moonpay_on_ramp/sign",Dd="/api/v1/custom_jwt_account/authenticate";var Do=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{let t=await this.api.post(Dd,{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 ue(t)}}async link(){throw new Error("Unimplemented")}};var Ur=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Cd,{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 ue(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(bd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ue(t)}}async sendCodeEmail(t,r){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new _("Email must be set when initialzing authentication.");try{return await this.api.post(wd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ue(o)}}},qi=class extends Ur{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new _("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Td,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ue(r)}}};import{isMobile as ng,isIOS as ig}from"react-device-detect";var ol=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)}},$i=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 nl(){try{let e="privy:__session_storage__test",t="blobby",r=new $i;return r.put(e,t),r.del(e),!0}catch{return!1}}function eg(){return typeof window<"u"&&window.localStorage?new $i:new ol}var j=eg();import{StaticJsonRpcProvider as Bo}from"@ethersproject/providers";function Fd(){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 ji=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 il=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||ji(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!il(r))return!1}return!0},Br=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Ud=()=>{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 Bd="1.59.10-beta-20240402143202";var al="4df5e2316331463a9130964bd6078dfa",sl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Hd="34357d3c125c2bcf2ce2bc3309d98715",Ki="https://auth.privy.io",Gd=2e4,Oe=1400,Vd=2500,ll=Bd;var fo="privy:token",cl="privy-token",Yi="privy:refresh_token",dl="privy-refresh-token",Zi="privy-session",Vn="privy:session_transfer_token",rg="privy:wallet",zn="privy:caid",ho="privy:state_code",Fo="privy:code_verifier",yo="privy:headless_oauth",Ji=e=>`${rg}:${e}`,pl="privy:connectors",ul="privy:connections";var go=12e4,xr=1,ml="0x1",Uo=3e4,zd="https://api.moonpay.com/v1",qd="https://api.moonpay.com/v1",$d="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",jd="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Kd="0x420000000000000000000000000000000000000F",Yd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Zd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Qi=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,}))$/),Jd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Hr=(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}`},fl=e=>new Promise(t=>setTimeout(t,e));function Qd(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 Xd=(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 fl(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Xi=(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 ep=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),vo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function tp(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of Fd()){let u=ji(d);if(!l.some(y=>y.info.name===u)){if(il(d,!0)&&!s.find(y=>y.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(y=>y.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}if(u==="Coinbase Wallet"&&!s.find(y=>y.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:d});continue}s.find(y=>y.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function Ho(e){return`eip155:${String(Number(e))}`}var ea=(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]+"/"+al:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+sl:i=a.rpcUrls.default?.http[0];if(!i)throw new J(`No RPC url found for ${e}`);return i},rp=(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},Sr=(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 Bo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Bo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Bo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Bo(a.rpcUrls.infura.http[0]+"/"+al):a.rpcUrls.blast?.http[0]?i=new Bo(a.rpcUrls.blast.http[0]+"/"+sl):i=new Bo(a.rpcUrls.default?.http[0]),!i)throw new J(`No RPC url found for ${e}`);return i},ta=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 ra=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Go))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Go={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 og(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var op=e=>e in Go,np=e=>{let t=Go[e].mobile;if("native"in t)return t.native};function ip(e,t){let r=og(t);if(r.deepLink)return dp(r.deepLink,e);if(r.universalLink)return pp(r.universalLink,e);throw new _(`Unsupported wallet ${t.id}`)}var ap="WALLETCONNECT_DEEPLINK_CHOICE";function sp(){try{localStorage.removeItem(ap)}catch{}}function lp({href:e,name:t}){try{localStorage.setItem(ap,JSON.stringify({href:e,name:t}))}catch{}}function cp(e){return e.startsWith("http://")||e.startsWith("https://")}function dp(e,t){if(cp(e))return pp(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 pp(e,t){if(!cp(e))return dp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function oa(e,t){window.open(e,t,"noreferrer noopener")}var ot=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 qn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new ot(this._startChannelOnce.bind(this)),this.pollForReady=new ot(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");try{let t=await this.api.post(hd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new _("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ue(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post(yd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ue(t)}}async _startChannelOnce(){if(!this.api)throw new _("Auth flow has no API instance");let t=await this.api.post(fd,{token:this.captchaToken});ng&&!ig&&t.connect_uri&&oa(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new _("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");let t=await this.api.get(gd,{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 fp}from"jose";async function up(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function mp(e){return crypto.getRandomValues(new Uint8Array(e))}function na(){return!!j.get(yo)}var ag="S256",sg="S256",ir=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:na();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");let t=j.get(Fo);if(!t)throw new _("Authentication error.");try{let r=await this.api.post(kd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Fo),this.meta.headless&&j.del(yo),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=ue(r);throw o.privyErrorCode?new _(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new _("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new _("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");let t=j.get(Fo);if(!t)throw new _("Authentication error.");try{let r=await this.api.post(Rd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Fo),r}catch(r){throw ue(r)}}createCodeVerifier(){return fp.encode(mp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=ag){if(r==sg){let o=await up(t);return fp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.provider)throw new _("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();j.put(Fo,t);let r=this.createStateCode();j.put(ho,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&j.put(yo,!0);try{return await this.api.post(Ad,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ue(n)}}};function hl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hp(e,t){let r={detail:"",retryable:!1},o=hl(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 jn(){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:na()}}function Kn(){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(ho),window.history.replaceState({},"",e)}var wo=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 ot(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 S("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(ld,{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 ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(cd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ue(t)}}async sign(){if(!this.api)throw new S("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new S("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 S("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(sd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new S("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 wo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new S("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(Pd,{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 ue(t)}}async link(){if(!this.api)throw new S("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new S("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Ed,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ue(t)}}async sendSmsCode(t,r){if(!this.api)throw new S("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new S("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(bd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ue(o)}}};import{v4 as zg}from"uuid";function nt(e){return new Date(e*1e3)}function tg(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:nt(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:nt(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:nt(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:nt(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:nt(r.verified_at)};t.push(s);break;case"twitter_oauth":let d={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:nt(r.verified_at)};t.push(d);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(u);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(y);break;case"tiktok_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:nt(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:nt(r.verified_at)};t.push(g);break;case"apple_oauth":let E={subject:r.subject,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(E);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:nt(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:nt(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function _t(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var Ce=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,rg=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),At=(e,t)=>t==="all-users"&&!Ce(e)||t==="users-without-wallets"&&!rg(e)?.length;function Ct(e){if(!e)return null;let t=tg(e.linked_accounts),r=_t(t,"wallet"),o=_t(t,"email"),n=_t(t,"phone"),a=_t(t,"google_oauth"),i=_t(t,"twitter_oauth"),l=_t(t,"discord_oauth"),s=_t(t,"github_oauth"),d=_t(t,"spotify_oauth"),u=_t(t,"tiktok_oauth"),y=_t(t,"linkedin_oauth"),f=_t(t,"apple_oauth"),g=_t(t,"farcaster"),E=e.mfa_methods.map(({type:x,verified_at:C})=>({type:x,verifiedAt:nt(C)}));return{id:e.id,createdAt:nt(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.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:E.map(x=>x.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Yp}from"@ethersproject/address";import Bg from"eventemitter3";import ug from"@coinbase/wallet-sdk";import{jsx as mp,jsxs as og}from"react/jsx-runtime";var oa=({style:e,...t})=>og("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:[mp("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),mp("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 sr}from"@ethersproject/address";import{Web3Provider as wp}from"@ethersproject/providers";import{default as dg}from"eventemitter3";import cg from"eventemitter3";var ng=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],fp=e=>ng.includes(e);import{ErrorCode as ig}from"@ethersproject/logger";var Go=class extends Z{constructor(){super("Wallet timeout");this.type="wallet_error"}},Vo=class extends Z{constructor(){super("User rejected connection");this.type="wallet_error"}},zt=e=>{if(e instanceof Z)return e;if(e?.code&&e?.reason){let t=new xe(e);return e.code===ig.ACTION_REJECTED&&(t.details=je.E4001_USER_REJECTED_REQUEST),t}return e?.code?new xe(e):new Z("Unknown connector error",e)},kt=class extends $e{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},xe=class extends kt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(je).find(a=>a.eipCode===o.code);this.details=n||je.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=je.E32002_CONNECTION_ALREADY_PENDING:this.details=je.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=je.E32002_WALLET_LOCKED))}},ag={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}},sg={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}},lg={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}},je={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...lg,...sg},_r={...ag,...je};var be=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 Go,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||yo,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 Z(`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 zt(r)})}},Hr=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},na=class extends cg{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=Sr(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=zo(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Hr(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await ve()||!this.address)throw new Hr("Disconnected",4900);return(await gp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Hr(`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 Hr(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Sr(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 hp(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 yp(Xi(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:go(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 go(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(fp(r.method)){let o=await ve();if(await vp(),!o||!this.address)throw new Hr("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 Hr("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await ve();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}}},ar=class extends be{constructor(r){super(r,r.rpcTimeoutDuration)}},Gr=class extends be{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 pg=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},mt=class extends dg{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=Bo(r),this.walletClientType==="privy"&&j.put(Yi(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=zo(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>sr(i.address)===sr(r));return{address:sr(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new Z("Wallet is not currently connected.");let l=this.wallets.find(f=>sr(f.address)===sr(r))?.chainId;if(!l)throw new Z("Unable to determine current chainId.");let s,d;if(typeof i=="number"?(s=`0x${i.toString(16)}`,d=i):(s=i,d=Number(i)),l===Bo(s))return;let u=this.chains.find(f=>f.id===d);if(!u)throw new Z(`Unsupported chainId: ${i}`);let y=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await y()}catch(f){if(pg(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??""]}]}),y();throw this.walletClientType==="rainbow"&&f.message?.includes("wallet_switchEthereumChain")?new Z(`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 Z("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await a())throw new Z("Wallet is not currently connected.");return new wp(new ar(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new Z("Wallet is not currently connected.");return new Gr(this.proxyProvider)},sign:async i=>{if(!await a())throw new Z("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let d=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(d)&&(o=d)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=sr(n),i=[],l;if(this.walletClientType==="privy"){let d=j.get(Yi(a));this.chains.find(u=>u.id===Number(d))||(j.del(Yi(a)),d=null),l=d||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let d=await this.proxyProvider.request({method:"eth_chainId"});if(typeof d=="string")l=d;else if(typeof d=="number")l=`0x${d.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(d){console.warn(`Failed to get chainId from provider, defaulting to ${dl}`,d),l=dl}let s=Bo(l);if(!i.find(d=>sr(d.address)===a)){let d={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(sr(n),s,d))}ia(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=>sr(n)===sr(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 wp(new ar(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 qo={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 mg=(e,t)=>{let o=Qi(1,[qo],{},t);return e.makeWeb3Provider(o,1)},aa,sa=class extends mt{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),aa||(aa=new ug({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(mg(aa,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(){aa.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:oa,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 Z("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw zt(r)}}};import{jsx as Cp}from"react/jsx-runtime";var la=({...e})=>Cp("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Cp("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 ca=class extends mt{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:[go(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:la,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as bp}from"react/jsx-runtime";var $o=({style:e,...t})=>bp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:bp("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 bt,jsxs as fg}from"react/jsx-runtime";var jo=({style:e,...t})=>fg("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:[bt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),bt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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 Ep,jsxs as hg}from"react/jsx-runtime";var lr=({style:e,...t})=>hg("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:[Ep("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Ep("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 Yo=class extends mt{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new be(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 Z("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw zt(r)}}},Ko,Jo=class extends mt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Di(this,Ko,void 0);this.proxyProvider=new be(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?Xs(this,Ko,{name:"MetaMask",icon:jo,id:"io.metamask"}):i==="phantom"&&Xs(this,Ko,{name:"Phantom",icon:lr,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 nd(this,Ko)??{name:"Browser Extension",icon:$o,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 Z("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw zt(r)}}};Ko=new WeakMap;import{getAddress as xT}from"@ethersproject/address";import{Web3Provider as _T}from"@ethersproject/providers";import{isMobile as yg}from"react-device-detect";var da=class extends Yo{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{yg||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 Z("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw zt(t)}}};var pa=class extends mt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new be(void 0,yo);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 ua=class extends pa{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:lr,id:"phantom"}}};import{EthereumProvider as Ng,OPTIONAL_EVENTS as Dg,OPTIONAL_METHODS as Fg}from"@walletconnect/ethereum-provider";import{isMobile as Ug}from"react-device-detect";import{createContext as Ag,useContext as kg,useEffect as yl,useRef as Rg,useState as Ig}from"react";import{jsx as gg}from"react/jsx-runtime";function ma({src:e,...t}){return gg("img",{src:e,...t,style:{display:"none"}})}import{useContext as zp,useEffect as Vp,useMemo as Pg,useState as xg}from"react";import{createContext as Sg}from"react";var Rt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Fd,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Tp=({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 vg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),Pp=e=>vg.has(e),xp=(e,t,r)=>r.indexOf(e)===t,Sp=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(Pp).filter(xp):e?e.filter(Pp).filter(xp):Rt.appearance.walletList;var fa={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 ha={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 ya={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 _p={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 Ap={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 ga={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 va={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 wa={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 kp={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 Rp={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 Ip={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 Mp={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 Wp={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 Lp={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 Op={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 Np={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 Dp={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 Ca={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 ba={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 Ea={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 jn={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 Kn={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 Fp={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 Up={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 Ta={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 Pa={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 xa={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 Yn=[fa,ha,ya,Lp,Up,qo,Ca,ba,Ea,jn,Kn,Rp,Ip,Mp,Wp,ga,va,wa,kp,Np,Dp,_p,Ap,Ta,xa,Pa,Op,Fp],K6=new Set(Yn.map(e=>e.id));import Co from"tinycolor2";var Bp="#FFFFFF",wg="#000000",Cg=Bp,bg="#1E1E1D";function Eg(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 Vr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return Co({...e.toHsl(),l:r})}function Hp({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Bp,blackHex:i=wg}){let l;switch(e){case"light":l=Cg;break;case"dark":l=bg;break;default:l=e;break}let s=Co(l),d=Co(t),u=Co(r),y=Co(o),f=Co(n),g=Eg(s.getLuminance()),E=Vr(s,g==="light"?-.04:.11),v=Vr(s,g==="light"?-.88:.87),x=Vr(s,g==="light"?-.77:.75),C=Vr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),P=Vr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),R=Vr(d,.15),M=Vr(d,-.06),k=Co(d.getLuminance()>.5?i:a),B=Vr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:E.toHslString(),foreground:v.toHslString(),foreground2:x.toHslString(),foreground3:C.toHslString(),foreground4:P.toHslString(),accent:d.toHslString(),accentLight:R.toHslString(),accentDark:M.toHslString(),foregroundAccent:k.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:f.toHslString(),warn:y.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(z=>n.includes(z)),i,l,s,d,u,y,f,g,E,v,x,C;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),d=a?.includes("google"),u=a?.includes("twitter"),y=a?.includes("discord"),g=a?.includes("spotify"),f=a?.includes("tiktok"),v=a?.includes("github"),E=a?.includes("linkedin"),x=a?.includes("apple"),C=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,s=e.walletAuth,d=e.googleOAuth,u=e.twitterOAuth,y=e.discordOAuth,v=e.githubOAuth,g=e.spotifyOAuth,f=e.tiktokOAuth,E=e.linkedinOAuth,x=e.appleOAuth,C=e.farcasterAuth);let P=[i,l].filter(Boolean),R=[d,u,y,v,g,f,E,x,C].filter(Boolean),M=[s].filter(Boolean);if(P.length+R.length+M.length===0)throw new Error("You must enable at least one login method");let k=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;k&&M.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),k=!1):!k&&R.length+P.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),k=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let B=Sp({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),U=Tp({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:T,defaultChain:q}=Tg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),O=!!t?.defaultChain,Y=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,se,re=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?Y?se=t?.embeddedWallets?.noPromptOnSignature??!0:se=t?.embeddedWallets?.noPromptOnSignature??re:se=re,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&se!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:Hp({backgroundTheme:t?.appearance?.theme??Rt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Rt.appearance.accentColor}),loginGroupPriority:k?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:s,email:i,sms:l,google:d,twitter:u,discord:y,github:v,spotify:g,tiktok:f,linkedin:E,apple:x,farcaster:C},loginMethodsAndOrder:U,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Rt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Rt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Rt.rpcConfig.rpcTimeouts},chains:T,defaultChain:q,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:O,captchaEnabled:e.captchaEnabled??Rt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...Y?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:se},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:Y?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Rt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Rt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Rt._render.inParentNodeId}}}function Gp(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 Tg({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:Yn.find(u=>u.id===s.id)??s)}else n=Yn.concat(e??[]);let a=t?n[0]:qo,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 _g}from"react/jsx-runtime";var qp={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:""},fl=ml(qp,void 0,!1),hl=Sg({appConfig:fl,isServerConfigLoaded:!1}),$p=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=xg(null),i=Pg(()=>ml(n??qp,o,!!n),[n,o]);return Vp(()=>{let l=Gp(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),Vp(()=>{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)}})()},[]),_g(hl.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Sa=()=>{let{appConfig:e}=zp(hl);return e},_a=()=>{let{isServerConfigLoaded:e}=zp(hl);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Wg,jsxs as Lg}from"react/jsx-runtime";var jp=Ag({ready:!1,app:fl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),Mg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Kp=e=>{let t=Sa(),r=e.authenticated,[o,n]=Ig(e.initialScreen);yl(()=>{!r&&!Mg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=Rg(null);yl(()=>{e.open||(a.current=null)},[e.open]),yl(()=>{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 Lg(jp.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Wg(ma,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>kg(jp);import{jsx as Zo,jsxs as Og}from"react/jsx-runtime";var Jn=({style:e,...t})=>{let{app:r}=_();return Og("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:[Zo("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Zo("g",{clipPath:"url(#clip0_1765_9946)",children:Zo("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"})}),Zo("defs",{children:Zo("clipPath",{id:"clip0_1765_9946",children:Zo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var cr=class extends mt{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 be(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Ho[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=ea(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:jo,id:"io.metamask"}:{name:Zd(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Jn,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=Ho[r],this.walletClientType=r,this.redirectUri=void 0,np(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Vo)};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 Z("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ea(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=zo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(zt(i));return}o(new Z("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=Qi(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 Ng.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Dg,optionalMethods:Fg,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),Ug&&this.walletEntry){let{redirect:l,href:s}=rp(i,this.walletEntry);ip({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,ta(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=ea(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 gl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===Yp(t)).length:!1},zo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||yo:yo,Zn=class extends Bg{constructor(r,o,n,a,i,l,s,d,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new be:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=d,this.privyAppName=u,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;j.get(ll)&&(j.getKeys().forEach(o=>{o.startsWith("walletconnect")&&j.del(o)}),j.del(ll));let r=Qd(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"),!Ur()&&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 na(r,o,this.rpcConfig,this.chains,a,n.id),s=new ca(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 cr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new da(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Yo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new sa(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new ua(this.defaultChain):new cr(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(cl);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(cl,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=Yp(r),this.emit("walletsUpdated")}};function ia(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 Hg}from"ofetch";var Gg=[Bi,Gi,Hi],Aa=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=il,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Hg.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=!Gg.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 Fi}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ue(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ue(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ue(o)}}};import bo from"js-cookie";function Jp(e){return e instanceof Fr?"email":e instanceof wo?"sms":e instanceof vo?"siwe":e instanceof No?"custom_auth":e instanceof ir?e.meta.provider:null}import*as Zp from"jose";var dr=class{static parse(t){try{return new dr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Zp.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 Vg=30,ka=class{constructor(){this.authenticateOnce=new ot(async t=>this._authenticate(t)),this.linkOnce=new ot(async t=>this._link(t)),this.refreshOnce=new ot(this._refresh.bind(this)),this.destroyOnce=new ot(this._destroy.bind(this)),this.forkSessionOnce=new ot(this._forkSession.bind(this))}get token(){try{let t=j.get(mo);return typeof t=="string"?new dr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=j.get(ji);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=j.get(Hn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=bo.get(Ki);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=dr.parse(this.token);return t!==null&&!t.isExpired(Vg)}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=Jp(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:Ct(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),rt(r)}}async _link(t){try{let r=await t.link();return Ct(r)}catch(r){throw console.warn("Error linking account"),rt(r)}}async _refresh(){if(!this.api)throw new S("Session has no API instance");if(!this.client)throw new S("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(Bi,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Gi,{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),Ct(n.user)}catch(n){if(n instanceof nr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw rt(n)}}async _destroy(){try{await this.api?.post(Hi,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new S("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(ad,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw rt(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=j.get(mo);if(j.put(mo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=dr.parse(t)?.expiration;bo.set(al,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else j.del(mo),bo.remove(al)}storeRefreshToken(t){typeof t=="string"?(j.put(ji,t),this.client?.useServerCookies||(bo.set(Ki,"t",{sameSite:"Strict",secure:!0,expires:30}),bo.set(sl,t,{sameSite:"Strict",secure:!0,expires:30}))):(j.del(ji),bo.remove(sl),bo.remove(Ki))}clearForkedToken(){j.del(Hn)}};var vl,Ra,Qp,Qn=class{constructor(t){Di(this,Ra);this.apiUrl=t.apiUrl||$i,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Ud,this.appId=t.appId,this.clientAnalyticsId=id(this,Ra,Qp).call(this),vl||(vl=new ka),this.session=vl,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 Zn(this.appId,t,r,o,n,a,i,l,s))}generateApi(){let t=new Aa(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 S("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new S("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(wd,{address:t});return Ct(r)}catch(r){throw rt(r)}}async acceptTerms(){try{let t=await this.api.post(Id,{});return Ct(t)}catch(t){throw rt(t)}}async unlinkPhone(t){try{let r=await this.api.post(Td,{phoneNumber:t});return Ct(r)}catch(r){throw rt(r)}}async unlinkWallet(t){try{let r=await this.api.post(dd,{address:t});return Ct(r)}catch(r){throw rt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Ad,{provider:t,subject:r});return Ct(o)}catch(o){throw rt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(hd,{fid:t});return Ct(r)}catch(r){throw rt(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(Md,{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(Wd,t)}catch(r){throw rt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?dr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw rt(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()}};Ra=new WeakSet,Qp=function(){if(typeof window>"u")return null;try{let r=j.get(Gn);if(typeof r=="string"&&r.length>0)return r}catch{}let t=zg();try{return j.put(Gn,t),t}catch{return t}};import{Turnstile as Jg}from"@marsidev/react-turnstile";import{useEffect as Zg,useMemo as Qg}from"react";import{useMemo as qg,useRef as $g,useContext as jg,useState as wl,createContext as Kg}from"react";import{jsx as Yg}from"react/jsx-runtime";var Xp=Kg({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 $e{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=$g(null),[a,i]=wl(),[l,s]=wl(),[d,u]=wl(!1),y=qg(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return Yg(Xp.Provider,{value:{...y,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 Yd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new qt("Captcha failed",null,"captcha_timeout")}}},children:e})},fe=()=>jg(Xp);import{jsx as tu}from"react/jsx-runtime";var Cl=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=fe(),[,s]=Qg(()=>r?.split("t:")||[],[r]);if(Zg(()=>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(Jg,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:d=>{e.onSuccess?.(d),a(d),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as gE,useEffect as ky,useRef as vE,useState as wE}from"react";import CE from"react-dom";import{createContext as Xg,useContext as e1}from"react";var bl=Xg({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,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),W=()=>e1(bl);import{createContext as t1,useContext as r1}from"react";var ce=t1({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,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,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,loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>r1(ce);import{useEffect as o1,useState as n1}from"react";var ru=e=>{let[t,r]=n1("auto");return o1(()=>{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 i1,useContext as a1,useEffect as s1}from"react";var ou={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:[]}},El=i1(void 0),nu=()=>a1(El);function Ee(e,t){if(!t)return;let o=nu().current[e];return s1(()=>{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 iu(){let e=nu();return(t,r,...o)=>N(e,t,r,...o)}function Tl(e){Ee("configureMfa",e)}import fu from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import E1 from"@heroicons/react/24/solid/DocumentCheckIcon";import T1 from"styled-components";import To,{css as _l}from"styled-components";import xl from"styled-components";import{Fragment as c1,jsx as Pl,jsxs as d1}from"react/jsx-runtime";var It=({success:e,fail:t})=>d1(c1,{children:[Pl(ft,{className:e?"success":t?"fail":""}),Pl(Sl,{className:e?"success":t?"fail":""})]}),ft=xl.span`
|
|
12
|
+
- https://privy.io`;this.getNonceOnce=new ot(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(pd,{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 ue(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(ud,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ue(t)}}async sign(){if(!this.api)throw new _("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new _("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new _("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(dd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new _("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){let n=window.location.host,a=window.location.origin,i="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,r,n,a,l,o,i)}};var Co=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(_d,{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 ue(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new _("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(xd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ue(t)}}async sendSmsCode(t,r){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new _("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Pd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw ue(o)}}};import{v4 as Jg}from"uuid";function nt(e){return new Date(e*1e3)}function lg(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:nt(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:nt(r.verified_at)};t.push(a);break;case"phone":let i={number:r.phoneNumber,type:r.type,verifiedAt:nt(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:nt(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:nt(r.verified_at)};t.push(s);break;case"twitter_oauth":let d={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:nt(r.verified_at)};t.push(d);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(u);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(y);break;case"tiktok_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:nt(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:nt(r.verified_at)};t.push(g);break;case"apple_oauth":let E={subject:r.subject,email:r.email,type:r.type,verifiedAt:nt(r.verified_at)};t.push(E);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:nt(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:nt(r.verified_at),signerPublicKey:r.signer_public_key};t.push(v);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function _t(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var be=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,cg=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),At=(e,t)=>t==="all-users"&&!be(e)||t==="users-without-wallets"&&!cg(e)?.length;function Ct(e){if(!e)return null;let t=lg(e.linked_accounts),r=_t(t,"wallet"),o=_t(t,"email"),n=_t(t,"phone"),a=_t(t,"google_oauth"),i=_t(t,"twitter_oauth"),l=_t(t,"discord_oauth"),s=_t(t,"github_oauth"),d=_t(t,"spotify_oauth"),u=_t(t,"tiktok_oauth"),y=_t(t,"linkedin_oauth"),f=_t(t,"apple_oauth"),g=_t(t,"farcaster"),E=e.mfa_methods.map(({type:x,verified_at:C})=>({type:x,verifiedAt:nt(C)}));return{id:e.id,createdAt:nt(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:a&&{subject:a.subject,email:a.email,name:a.name},twitter:i&&{subject:i.subject,username:i.username,name:i.name,profilePictureUrl:i.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:d&&{subject:d.subject,email:d.email,name:d.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.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:E.map(x=>x.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Qp}from"@ethersproject/address";import jg from"eventemitter3";import wg from"@coinbase/wallet-sdk";import{jsx as yp,jsxs as dg}from"react/jsx-runtime";var ia=({style:e,...t})=>dg("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:[yp("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),yp("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 sr}from"@ethersproject/address";import{Web3Provider as Ep}from"@ethersproject/providers";import{default as gg}from"eventemitter3";import yg from"eventemitter3";var pg=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],gp=e=>pg.includes(e);import{ErrorCode as ug}from"@ethersproject/logger";var Vo=class extends J{constructor(){super("Wallet timeout");this.type="wallet_error"}},zo=class extends J{constructor(){super("User rejected connection");this.type="wallet_error"}},zt=e=>{if(e instanceof J)return e;if(e?.code&&e?.reason){let t=new _e(e);return e.code===ug.ACTION_REJECTED&&(t.details=je.E4001_USER_REJECTED_REQUEST),t}return e?.code?new _e(e):new J("Unknown connector error",e)},kt=class extends $e{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},_e=class extends kt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(je).find(a=>a.eipCode===o.code);this.details=n||je.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=je.E32002_CONNECTION_ALREADY_PENDING:this.details=je.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=je.E32002_WALLET_LOCKED))}},mg={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}},fg={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}},hg={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}},je={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...hg,...fg},_r={...mg,...je};var Ee=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 Vo,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||go,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 zt(r)})}},Gr=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},aa=class extends yg{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=Sr(l,this.chains,n,{appId:i}),this.rpcTimeoutDuration=qo(n,"privy"),this.appId=i}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Gr(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await ve()||!this.address)throw new Gr("Disconnected",4900);return(await Cp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Gr(`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 Gr(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Sr(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 vp(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 wp(ta(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:vo(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 vo(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(gp(r.method)){let o=await ve();if(await bp(),!o||!this.address)throw new Gr("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 Gr("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await ve();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}}},ar=class extends Ee{constructor(r){super(r,r.rpcTimeoutDuration)}},Vr=class extends Ee{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 vg=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},mt=class extends gg{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=Ho(r),this.walletClientType==="privy"&&j.put(Ji(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=qo(a,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let a=async()=>!!this.wallets.find(i=>sr(i.address)===sr(r));return{address:sr(r),chainId:o,meta:n,switchChain:async i=>{if(!a)throw new J("Wallet is not currently connected.");let l=this.wallets.find(f=>sr(f.address)===sr(r))?.chainId;if(!l)throw new J("Unable to determine current chainId.");let s,d;if(typeof i=="number"?(s=`0x${i.toString(16)}`,d=i):(s=i,d=Number(i)),l===Ho(s))return;let u=this.chains.find(f=>f.id===d);if(!u)throw new J(`Unsupported chainId: ${i}`);let y=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await y()}catch(f){if(vg(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??""]}]}),y();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 Ep(new ar(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await a())throw new J("Wallet is not currently connected.");return new Vr(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 d=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(d)&&(o=d)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],a=sr(n),i=[],l;if(this.walletClientType==="privy"){let d=j.get(Ji(a));this.chains.find(u=>u.id===Number(d))||(j.del(Ji(a)),d=null),l=d||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let d=await this.proxyProvider.request({method:"eth_chainId"});if(typeof d=="string")l=d;else if(typeof d=="number")l=`0x${d.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(d){console.warn(`Failed to get chainId from provider, defaulting to ${ml}`,d),l=ml}let s=Ho(l);if(!i.find(d=>sr(d.address)===a)){let d={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};i.push(this.buildConnectedWallet(sr(n),s,d))}sa(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=>sr(n)===sr(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 Ep(new ar(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 $o={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 Cg=(e,t)=>{let o=ea(1,[$o],{},t);return e.makeWeb3Provider(o,1)},la,ca=class extends mt{constructor(r,o,n,a,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Ee(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;la||(la=new wg({appName:i,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(Cg(la,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(){la.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:ia,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 zt(r)}}};import{jsx as Tp}from"react/jsx-runtime";var da=({...e})=>Tp("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Tp("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 pa=class extends mt{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:[vo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:da,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Pp}from"react/jsx-runtime";var jo=({style:e,...t})=>Pp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Pp("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 bt,jsxs as bg}from"react/jsx-runtime";var Ko=({style:e,...t})=>bg("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:[bt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),bt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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"}),bt("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 xp,jsxs as Eg}from"react/jsx-runtime";var lr=({style:e,...t})=>Eg("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:[xp("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),xp("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 Zo=class extends mt{constructor(r,o,n,a,i){super(i||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Ee(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 zt(r)}}},Yo,Jo=class extends mt{constructor(r,o,n,a,i){super(i??"unknown",r,o,n);this.connectorType="injected";Ui(this,Yo,void 0);this.proxyProvider=new Ee(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(a),i==="metamask"?rl(this,Yo,{name:"MetaMask",icon:Ko,id:"io.metamask"}):i==="phantom"&&rl(this,Yo,{name:"Phantom",icon:lr,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 sd(this,Yo)??{name:"Browser Extension",icon:jo,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 zt(r)}}};Yo=new WeakMap;import{getAddress as NT}from"@ethersproject/address";import{Web3Provider as FT}from"@ethersproject/providers";import{isMobile as Tg}from"react-device-detect";var ua=class extends Zo{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{Tg||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 zt(t)}}};var ma=class extends mt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Ee(void 0,go);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 fa=class extends ma{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:lr,id:"phantom"}}};import{EthereumProvider as Vg,OPTIONAL_EVENTS as zg,OPTIONAL_METHODS as qg}from"@walletconnect/ethereum-provider";import{isMobile as $g}from"react-device-detect";import{createContext as Og,useContext as Ng,useEffect as wl,useRef as Dg,useState as Fg}from"react";import{jsx as Pg}from"react/jsx-runtime";function ha({src:e,...t}){return Pg("img",{src:e,...t,style:{display:"none"}})}import{useContext as jp,useEffect as $p,useMemo as Ig,useState as Mg}from"react";import{createContext as Wg}from"react";var Rt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Hd,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Sp=({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 xg=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),_p=e=>xg.has(e),Ap=(e,t,r)=>r.indexOf(e)===t,kp=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(_p).filter(Ap):e?e.filter(_p).filter(Ap):Rt.appearance.walletList;var ya={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 ga={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 va={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 Rp={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 Ip={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 Ca={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 ba={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 Mp={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 Wp={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 Lp={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 Op={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 Np={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 Dp={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 Fp={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 Up={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 Bp={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 Ea={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 Ta={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 Pa={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 Yn={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 Zn={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 Hp={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 Gp={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 xa={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 Sa={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 _a={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 Jn=[ya,ga,va,Dp,Gp,$o,Ea,Ta,Pa,Yn,Zn,Wp,Lp,Op,Np,wa,Ca,ba,Mp,Up,Bp,Rp,Ip,xa,_a,Sa,Fp,Hp],i7=new Set(Jn.map(e=>e.id));import bo from"tinycolor2";var Vp="#FFFFFF",Sg="#000000",_g=Vp,Ag="#1E1E1D";function kg(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 zr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return bo({...e.toHsl(),l:r})}function zp({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:a=Vp,blackHex:i=Sg}){let l;switch(e){case"light":l=_g;break;case"dark":l=Ag;break;default:l=e;break}let s=bo(l),d=bo(t),u=bo(r),y=bo(o),f=bo(n),g=kg(s.getLuminance()),E=zr(s,g==="light"?-.04:.11),v=zr(s,g==="light"?-.88:.87),x=zr(s,g==="light"?-.77:.75),C=zr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),P=zr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),R=zr(d,.15),M=zr(d,-.06),k=bo(d.getLuminance()>.5?i:a),B=zr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:E.toHslString(),foreground:v.toHslString(),foreground2:x.toHslString(),foreground3:C.toHslString(),foreground4:P.toHslString(),accent:d.toHslString(),accentLight:R.toHslString(),accentDark:M.toHslString(),foregroundAccent:k.toHslString(),success:u.toHslString(),successDark:B.toHslString(),error:f.toHslString(),warn:y.toHslString()}}function yl(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],a=t?.loginMethods?.filter(z=>n.includes(z)),i,l,s,d,u,y,f,g,E,v,x,C;t?.loginMethods?(i=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),d=a?.includes("google"),u=a?.includes("twitter"),y=a?.includes("discord"),g=a?.includes("spotify"),f=a?.includes("tiktok"),v=a?.includes("github"),E=a?.includes("linkedin"),x=a?.includes("apple"),C=a?.includes("farcaster")):(i=e.emailAuth,l=e.smsAuth,s=e.walletAuth,d=e.googleOAuth,u=e.twitterOAuth,y=e.discordOAuth,v=e.githubOAuth,g=e.spotifyOAuth,f=e.tiktokOAuth,E=e.linkedinOAuth,x=e.appleOAuth,C=e.farcasterAuth);let P=[i,l].filter(Boolean),R=[d,u,y,v,g,f,E,x,C].filter(Boolean),M=[s].filter(Boolean);if(P.length+R.length+M.length===0)throw new Error("You must enable at least one login method");let k=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;k&&M.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),k=!1):!k&&R.length+P.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),k=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`"),t?.appearance?.walletList&&t.loginMethodsAndOrder&&o("You should only configure one of `appearance.walletList` or `loginMethodsAndOrder`");let B=kp({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),U=Sp({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:T,defaultChain:q}=Rg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),O=!!t?.defaultChain,Y=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,se,re=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?Y?se=t?.embeddedWallets?.noPromptOnSignature??!0:se=t?.embeddedWallets?.noPromptOnSignature??re:se=re,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&se!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:zp({backgroundTheme:t?.appearance?.theme??Rt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Rt.appearance.accentColor}),loginGroupPriority:k?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:B},loginMethods:{wallet:s,email:i,sms:l,google:d,twitter:u,discord:y,github:v,spotify:g,tiktok:f,linkedin:E,apple:x,farcaster:C},loginMethodsAndOrder:U,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Rt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Rt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Rt.rpcConfig.rpcTimeouts},chains:T,defaultChain:q,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:O,captchaEnabled:e.captchaEnabled??Rt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...Y?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:se},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:Y?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Rt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Rt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Rt._render.inParentNodeId}}}function qp(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 Rg({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:Jn.find(u=>u.id===s.id)??s)}else n=Jn.concat(e??[]);let a=t?n[0]:$o,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 Lg}from"react/jsx-runtime";var Kp={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:""},gl=yl(Kp,void 0,!1),vl=Wg({appConfig:gl,isServerConfigLoaded:!1}),Yp=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,a]=Mg(null),i=Ig(()=>yl(n??Kp,o,!!n),[n,o]);return $p(()=>{let l=qp(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),$p(()=>{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)}})()},[]),Lg(vl.Provider,{value:{appConfig:i,isServerConfigLoaded:!!n},children:e})},Aa=()=>{let{appConfig:e}=jp(vl);return e},ka=()=>{let{isServerConfigLoaded:e}=jp(vl);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 Hg}from"react/jsx-runtime";var Zp=Og({ready:!1,app:gl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),Ug=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Jp=e=>{let t=Aa(),r=e.authenticated,[o,n]=Fg(e.initialScreen);wl(()=>{!r&&!Ug.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let a=Dg(null);wl(()=>{e.open||(a.current=null)},[e.open]),wl(()=>{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 Hg(Zp.Provider,{value:i,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Bg(ha,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},A=()=>Ng(Zp);import{jsx as Qo,jsxs as Gg}from"react/jsx-runtime";var Qn=({style:e,...t})=>{let{app:r}=A();return Gg("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:[Qo("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Qo("g",{clipPath:"url(#clip0_1765_9946)",children:Qo("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"})}),Qo("defs",{children:Qo("clipPath",{id:"clip0_1765_9946",children:Qo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var cr=class extends mt{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 Ee(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Go[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=ra(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:Ko,id:"io.metamask"}:{name:ep(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Qn,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=Go[r],this.walletClientType=r,this.redirectUri=void 0,sp(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new zo)};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=ra(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=qo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(i=>{if(i){o(zt(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=ea(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 Vg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:zg,optionalMethods:qg,rpcMap:r,showQrModal:!1});return a.on("display_uri",i=>{if(a.signer.abortPairingAttempt(),$g&&this.walletEntry){let{redirect:l,href:s}=ip(i,this.walletEntry);lp({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,oa(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=ra(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 Cl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===Qp(t)).length:!1},qo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||go:go,Xn=class extends jg{constructor(r,o,n,a,i,l,s,d,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(a=>a.address===r?.address));return!r||!o?new Ee:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=a,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=d,this.privyAppName=u,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(a=>a.wallets).sort((a,i)=>a.connectedAt&&i.connectedAt?i.connectedAt-a.connectedAt:0).filter(a=>{let i=`${a.address}${a.walletClientType}${a.connectorType}`;return r.has(i)?!1:(r.add(i),!0)}),n=o.findIndex(a=>a.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;j.get(pl)&&(j.getKeys().forEach(o=>{o.startsWith("walletconnect")&&j.del(o)}),j.del(pl));let r=tp(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"),!Br()&&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 aa(r,o,this.rpcConfig,this.chains,a,n.id),s=new pa(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 cr&&a.resetConnection(o),a;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new ua(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Jo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Zo(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new ca(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new fa(this.defaultChain):new cr(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(ul);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(ul,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=Qp(r),this.emit("walletsUpdated")}};function sa(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 Kg}from"ofetch";var Yg=[Gi,zi,Vi],Ra=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=ll,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Kg.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=!Yg.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 Bi}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw ue(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw ue(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw ue(o)}}};import Eo from"js-cookie";function Xp(e){return e instanceof Ur?"email":e instanceof Co?"sms":e instanceof wo?"siwe":e instanceof Do?"custom_auth":e instanceof ir?e.meta.provider:null}import*as eu from"jose";var dr=class{static parse(t){try{return new dr(t)}catch{return null}}constructor(t){this.value=t,this._decoded=eu.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 Zg=30,Ia=class{constructor(){this.authenticateOnce=new ot(async t=>this._authenticate(t)),this.linkOnce=new ot(async t=>this._link(t)),this.refreshOnce=new ot(this._refresh.bind(this)),this.destroyOnce=new ot(this._destroy.bind(this)),this.forkSessionOnce=new ot(this._forkSession.bind(this))}get token(){try{let t=j.get(fo);return typeof t=="string"?new dr(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=j.get(Yi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=j.get(Vn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Eo.get(Zi);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=dr.parse(this.token);return t!==null&&!t.isExpired(Zg)}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=Xp(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:Ct(n),isNewUser:a}}catch(r){throw console.warn("Error authenticating session"),rt(r)}}async _link(t){try{let r=await t.link();return Ct(r)}catch(r){throw console.warn("Error linking account"),rt(r)}}async _refresh(){if(!this.api)throw new _("Session has no API instance");if(!this.client)throw new _("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let a={};t&&(a.authorization=`Bearer ${t}`);let i=r?{refresh_token:r}:{};n=await this.api.post(Gi,i,{headers:a}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(zi,{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),Ct(n.user)}catch(n){if(n instanceof nr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw rt(n)}}async _destroy(){try{await this.api?.post(Vi,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new _("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(cd,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw rt(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=j.get(fo);if(j.put(fo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=dr.parse(t)?.expiration;Eo.set(cl,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else j.del(fo),Eo.remove(cl)}storeRefreshToken(t){typeof t=="string"?(j.put(Yi,t),this.client?.useServerCookies||(Eo.set(Zi,"t",{sameSite:"Strict",secure:!0,expires:30}),Eo.set(dl,t,{sameSite:"Strict",secure:!0,expires:30}))):(j.del(Yi),Eo.remove(dl),Eo.remove(Zi))}clearForkedToken(){j.del(Vn)}};var bl,Ma,tu,ei=class{constructor(t){Ui(this,Ma);this.apiUrl=t.apiUrl||Ki,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Gd,this.appId=t.appId,this.clientAnalyticsId=ld(this,Ma,tu).call(this),bl||(bl=new Ia),this.session=bl,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 Xn(this.appId,t,r,o,n,a,i,l,s))}generateApi(){let t=new Ra(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new _("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new _("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let r=await this.api.post(Ed,{address:t});return Ct(r)}catch(r){throw rt(r)}}async acceptTerms(){try{let t=await this.api.post(Ld,{});return Ct(t)}catch(t){throw rt(t)}}async unlinkPhone(t){try{let r=await this.api.post(Sd,{phoneNumber:t});return Ct(r)}catch(r){throw rt(r)}}async unlinkWallet(t){try{let r=await this.api.post(md,{address:t});return Ct(r)}catch(r){throw rt(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Id,{provider:t,subject:r});return Ct(o)}catch(o){throw rt(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(vd,{fid:t});return Ct(r)}catch(r){throw rt(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(Od,{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(Nd,t)}catch(r){throw rt(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?dr.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:t.id,name:t.name,verificationKey:t.verification_key,logoUrl:t.logo_url||void 0,accentColor:t.accent_color||void 0,showWalletLoginFirst:t.show_wallet_login_first,allowlistConfig:{errorTitle:t.allowlist_config.error_title,errorDetail:t.allowlist_config.error_detail,errorCtaText:t.allowlist_config.cta_text,errorCtaLink:t.allowlist_config.cta_link},walletAuth:t.wallet_auth,emailAuth:t.email_auth,smsAuth:t.sms_auth,googleOAuth:t.google_oauth,twitterOAuth:t.twitter_oauth,discordOAuth:t.discord_oauth,githubOAuth:t.github_oauth,spotifyOAuth:t.spotify_oauth,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw rt(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()}};Ma=new WeakSet,tu=function(){if(typeof window>"u")return null;try{let r=j.get(zn);if(typeof r=="string"&&r.length>0)return r}catch{}let t=Jg();try{return j.put(zn,t),t}catch{return t}};import{Turnstile as o1}from"@marsidev/react-turnstile";import{useEffect as n1,useMemo as i1}from"react";import{useMemo as Qg,useRef as Xg,useContext as e1,useState as El,createContext as t1}from"react";import{jsx as r1}from"react/jsx-runtime";var ru=t1({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 $e{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},ou=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Xg(null),[a,i]=El(),[l,s]=El(),[d,u]=El(!1),y=Qg(()=>o?!d&&!a&&!l?{status:"ready"}:d&&!a&&!l?{status:"loading"}:a&&!l?{status:"success",token:a}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,a,l,d]);return r1(ru.Provider,{value:{...y,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 Qd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new qt("Captcha failed",null,"captcha_timeout")}}},children:e})},fe=()=>e1(ru);import{jsx as nu}from"react/jsx-runtime";var Tl=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:a,setExecuting:i,ref:l}=fe(),[,s]=i1(()=>r?.split("t:")||[],[r]);if(n1(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return nu("div",{className:"hidden h-0 w-0",children:nu(o1,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),i(!1)},onSuccess:d=>{e.onSuccess?.(d),a(d),i(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),a(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as A4,useEffect as Ny,useRef as k4,useState as R4}from"react";import I4 from"react-dom";import{createContext as a1,useContext as s1}from"react";var Pl=a1({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,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b,requestFarcasterSignerStatus:b}),W=()=>s1(Pl);import{createContext as l1,useContext as c1}from"react";var ce=l1({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,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,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,loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),G=()=>c1(ce);import{useEffect as d1,useState as p1}from"react";var iu=e=>{let[t,r]=p1("auto");return d1(()=>{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 u1,useContext as m1,useEffect as f1}from"react";var au={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:[]}},xl=u1(void 0),su=()=>m1(xl);function Pe(e,t){if(!t)return;let o=su().current[e];return f1(()=>{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 lu(){let e=su();return(t,r,...o)=>N(e,t,r,...o)}function Sl(e){Pe("configureMfa",e)}import gu from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import k1 from"@heroicons/react/24/solid/DocumentCheckIcon";import R1 from"styled-components";import Po,{css as Rl}from"styled-components";import Al from"styled-components";import{Fragment as y1,jsx as _l,jsxs as g1}from"react/jsx-runtime";var It=({success:e,fail:t})=>g1(y1,{children:[_l(ft,{className:e?"success":t?"fail":""}),_l(kl,{className:e?"success":t?"fail":""})]}),ft=Al.span`
|
|
13
13
|
&& {
|
|
14
14
|
width: 82px;
|
|
15
15
|
height: 82px;
|
|
@@ -42,13 +42,13 @@ Resources:
|
|
|
42
42
|
border-color: var(--privy-color-error);
|
|
43
43
|
border-bottom-color: var(--privy-color-error);
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,kl=Al(ft)`
|
|
46
46
|
&& {
|
|
47
47
|
border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
|
|
48
48
|
animation: none;
|
|
49
49
|
opacity: 0.5;
|
|
50
50
|
}
|
|
51
|
-
`,
|
|
51
|
+
`,To=e=>_l(h1,{color:e.color||"var(--privy-color-foreground-3)"}),h1=Al(ft)`
|
|
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 Mt,jsxs as
|
|
60
|
+
`;import{jsx as Mt,jsxs as Na}from"react/jsx-runtime";var Wa=Po.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
|
-
`,F=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(
|
|
89
|
-
${e=>e.hideAnimations&&
|
|
88
|
+
`,F=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(cu,{disabled:t||r,...n,children:t?Na("span",{children:[Mt(To,{}),o?Mt("span",{children:o}):null]}):e}),f8=Po(F)`
|
|
89
|
+
${e=>e.hideAnimations&&Rl`
|
|
90
90
|
&& {
|
|
91
91
|
transition: none;
|
|
92
92
|
}
|
|
93
93
|
`}
|
|
94
|
-
`,
|
|
94
|
+
`,La=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(cu,{as:"a",disabled:t||r,...n,children:t?Na("span",{children:[Mt(To,{}),o?Mt("span",{children:o}):null]}):e}),cu=Po(Wa)`
|
|
95
95
|
position: relative;
|
|
96
96
|
|
|
97
97
|
&& {
|
|
@@ -117,7 +117,7 @@ Resources:
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/* If an anchor tag, :disabled isn't a thing, so manually set state */
|
|
120
|
-
${e=>e.disabled?
|
|
120
|
+
${e=>e.disabled?Rl`
|
|
121
121
|
&&&,
|
|
122
122
|
&&&:hover,
|
|
123
123
|
&&&:active {
|
|
@@ -136,7 +136,7 @@ Resources:
|
|
|
136
136
|
opacity: 1;
|
|
137
137
|
animation: fadein 200ms ease;
|
|
138
138
|
}
|
|
139
|
-
`,$t=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(
|
|
139
|
+
`,$t=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>Mt(v1,{disabled:t||r,...n,children:t?Na("span",{children:[Mt(To,{}),o?Mt("span",{children:o}):null]}):e}),v1=Po(Wa)`
|
|
140
140
|
&& {
|
|
141
141
|
border-width: 1px;
|
|
142
142
|
border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
|
|
@@ -165,7 +165,7 @@ Resources:
|
|
|
165
165
|
opacity: 1;
|
|
166
166
|
animation: fadein 200ms ease;
|
|
167
167
|
}
|
|
168
|
-
`,
|
|
168
|
+
`,Oa=Po.button`
|
|
169
169
|
&& {
|
|
170
170
|
padding: 12px 16px;
|
|
171
171
|
font-weight: 500;
|
|
@@ -178,7 +178,7 @@ Resources:
|
|
|
178
178
|
transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
|
|
179
179
|
user-select: none;
|
|
180
180
|
|
|
181
|
-
${e=>e.invisible&&
|
|
181
|
+
${e=>e.invisible&&Rl`
|
|
182
182
|
pointer-events: none;
|
|
183
183
|
`}
|
|
184
184
|
|
|
@@ -196,10 +196,10 @@ Resources:
|
|
|
196
196
|
cursor: not-allowed;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`,
|
|
199
|
+
`,h8=Po.div`
|
|
200
200
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
201
201
|
height: 44px;
|
|
202
|
-
`,
|
|
202
|
+
`,Xo=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>Na(w1,{isSubmitting:o,onClick:t,disabled:r,...n,children:[Mt("span",{children:e}),Mt("span",{children:Mt(To,{})})]}),w1=Po.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
|
|
244
|
+
`;import du from"styled-components";import{Fragment as C1,jsx as qr,jsxs as pu}from"react/jsx-runtime";var Il=du.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
|
|
253
|
+
`;function en(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return qr(Il,{});if(!r&&!t)return qr(Il,{});let n=!!(t&&r);return pu(Il,{children:["By logging in I agree to the"," ",r&&qr("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&qr("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var V=({protectedByPrivy:e})=>qr(X,{children:e?pu(C1,{children:[qr(da,{className:"hide-on-mobile"}),qr("span",{className:"hide-on-mobile",children:qr("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),X=du.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 b1 from"@heroicons/react/24/outline/ArrowLeftIcon";import E1 from"@heroicons/react/24/outline/XMarkIcon";import Ml from"styled-components";import{jsx as Wt,jsxs as _1}from"react/jsx-runtime";var uu=()=>Wt("div",{}),T1=({backFn:e})=>Wt("div",{children:Wt(mu,{onClick:e,children:Wt(b1,{height:"16px",width:"16px",strokeWidth:2})})}),P1=e=>Wt("div",{children:Wt(mu,{"aria-label":"close modal",onClick:e.onClose,children:Wt(E1,{height:"16px",width:"16px",strokeWidth:2})})});var S=({backFn:e,onClose:t,title:r,closeable:o=!0})=>{let{closePrivyModal:n}=W(),{app:a}=A();return _1(x1,{children:[e?Wt(T1,{backFn:e}):Wt(uu,{}),r&&Wt(S1,{id:"privy-dialog-title",children:r}),a?.render.inDialog&&o?Wt(P1,{onClose:t||(()=>n())}):Wt(uu,{})]})},mu=Ml.button`
|
|
281
281
|
&& {
|
|
282
282
|
cursor: pointer;
|
|
283
283
|
display: flex;
|
|
@@ -296,7 +296,7 @@ Resources:
|
|
|
296
296
|
opacity: 1;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
`,
|
|
299
|
+
`,x1=Ml.div`
|
|
300
300
|
padding: 16px 0;
|
|
301
301
|
display: flex;
|
|
302
302
|
align-items: center;
|
|
@@ -318,22 +318,22 @@ Resources:
|
|
|
318
318
|
display: flex;
|
|
319
319
|
justify-content: flex-end;
|
|
320
320
|
}
|
|
321
|
-
`,
|
|
321
|
+
`,S1=Ml.div`
|
|
322
322
|
overflow: hidden;
|
|
323
323
|
white-space: nowrap;
|
|
324
324
|
max-width: 100%;
|
|
325
325
|
text-overflow: ellipsis;
|
|
326
326
|
text-align: center;
|
|
327
327
|
color: var(--privy-color-foreground-2);
|
|
328
|
-
`;import
|
|
328
|
+
`;import tn,{css as A1}from"styled-components";var Da=tn.div`
|
|
329
329
|
text-align: left;
|
|
330
330
|
flex-grow: 1;
|
|
331
|
-
`,
|
|
331
|
+
`,Fa=tn.div`
|
|
332
332
|
display: flex;
|
|
333
333
|
flex-direction: column;
|
|
334
334
|
justify-content: flex-end;
|
|
335
335
|
flex-grow: 1;
|
|
336
|
-
`,Lt=
|
|
336
|
+
`,Lt=tn.div`
|
|
337
337
|
display: flex;
|
|
338
338
|
flex-direction: column;
|
|
339
339
|
gap: 12px;
|
|
@@ -348,7 +348,7 @@ Resources:
|
|
|
348
348
|
&::-webkit-scrollbar {
|
|
349
349
|
display: none;
|
|
350
350
|
}
|
|
351
|
-
`,
|
|
351
|
+
`,fu=A1`
|
|
352
352
|
&& {
|
|
353
353
|
width: 100%;
|
|
354
354
|
font-size: 16px;
|
|
@@ -386,11 +386,11 @@ Resources:
|
|
|
386
386
|
max-width: 24px;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
`,
|
|
390
|
-
${
|
|
391
|
-
`,
|
|
392
|
-
${
|
|
393
|
-
`,Ar=
|
|
389
|
+
`,we=tn.button`
|
|
390
|
+
${fu}
|
|
391
|
+
`,Wl=tn.a`
|
|
392
|
+
${fu}
|
|
393
|
+
`,Ar=tn.div`
|
|
394
394
|
width: 100%;
|
|
395
395
|
${e=>e.if?"display: none;":""}
|
|
396
396
|
`;import Ne from"styled-components";var Ke=Ne.div`
|
|
@@ -411,7 +411,7 @@ Resources:
|
|
|
411
411
|
font-size: 0.875rem;
|
|
412
412
|
|
|
413
413
|
text-align: center;
|
|
414
|
-
|
|
414
|
+
`,$r=Ne.div`
|
|
415
415
|
display: flex;
|
|
416
416
|
flex-direction: column;
|
|
417
417
|
align-items: center;
|
|
@@ -421,7 +421,7 @@ Resources:
|
|
|
421
421
|
@media (max-width: 440px) {
|
|
422
422
|
padding: 10px 10px 20px;
|
|
423
423
|
}
|
|
424
|
-
`,
|
|
424
|
+
`,hu=Ne.div`
|
|
425
425
|
display: flex;
|
|
426
426
|
flex-direction: column;
|
|
427
427
|
align-items: stretch;
|
|
@@ -429,7 +429,7 @@ Resources:
|
|
|
429
429
|
padding: 1rem 0rem 0rem;
|
|
430
430
|
flex-grow: 1;
|
|
431
431
|
width: 100%;
|
|
432
|
-
`,
|
|
432
|
+
`,Ll=Ne.div`
|
|
433
433
|
width: 25px;
|
|
434
434
|
display: flex;
|
|
435
435
|
align-items: center;
|
|
@@ -441,19 +441,19 @@ Resources:
|
|
|
441
441
|
width: 25px !important;
|
|
442
442
|
color: var(--privy-color-accent);
|
|
443
443
|
}
|
|
444
|
-
`,
|
|
444
|
+
`,Ol=Ne.div`
|
|
445
445
|
display: flex;
|
|
446
446
|
align-items: center;
|
|
447
447
|
gap: 10px;
|
|
448
448
|
font-size: 0.875rem;
|
|
449
449
|
line-height: 1rem;
|
|
450
450
|
text-align: left;
|
|
451
|
-
|
|
451
|
+
`,jr=Ne.div`
|
|
452
452
|
display: flex;
|
|
453
453
|
flex-direction: column;
|
|
454
454
|
gap: 10px;
|
|
455
455
|
padding-top: 20px;
|
|
456
|
-
`,
|
|
456
|
+
`,Ua=Ne.div`
|
|
457
457
|
display: flex;
|
|
458
458
|
flex-direction: column;
|
|
459
459
|
align-items: stretch;
|
|
@@ -461,7 +461,7 @@ Resources:
|
|
|
461
461
|
padding: 1rem 0rem 0rem;
|
|
462
462
|
flex-grow: 1;
|
|
463
463
|
width: 100%;
|
|
464
|
-
`,
|
|
464
|
+
`,Ba=Ne.div`
|
|
465
465
|
display: flex;
|
|
466
466
|
gap: 5px;
|
|
467
467
|
width: 100%;
|
|
@@ -469,7 +469,7 @@ Resources:
|
|
|
469
469
|
& > button:not(#remove) {
|
|
470
470
|
width: 100%;
|
|
471
471
|
}
|
|
472
|
-
`,
|
|
472
|
+
`,Nl=Ne.button`
|
|
473
473
|
&& {
|
|
474
474
|
background-color: transparent;
|
|
475
475
|
color: var(--privy-color-foreground-3);
|
|
@@ -488,7 +488,7 @@ Resources:
|
|
|
488
488
|
&&:hover {
|
|
489
489
|
color: var(--privy-color-error);
|
|
490
490
|
}
|
|
491
|
-
`,
|
|
491
|
+
`,Ha=Ne.div`
|
|
492
492
|
display: flex;
|
|
493
493
|
align-items: center;
|
|
494
494
|
gap: 0.5rem;
|
|
@@ -498,7 +498,7 @@ Resources:
|
|
|
498
498
|
height: 20px !important;
|
|
499
499
|
width: 20px !important;
|
|
500
500
|
}
|
|
501
|
-
`,
|
|
501
|
+
`,rn=Ne.div`
|
|
502
502
|
display: flex;
|
|
503
503
|
align-items: center;
|
|
504
504
|
gap: 6px;
|
|
@@ -512,15 +512,15 @@ Resources:
|
|
|
512
512
|
display: flex !important;
|
|
513
513
|
align-items: flex-end;
|
|
514
514
|
}
|
|
515
|
-
`,
|
|
515
|
+
`,Ga=Ne.div`
|
|
516
516
|
width: 100%;
|
|
517
517
|
display: flex;
|
|
518
518
|
justify-content: space-between;
|
|
519
|
-
`,
|
|
519
|
+
`,yu=Ne.p`
|
|
520
520
|
text-align: left;
|
|
521
521
|
width: 100%;
|
|
522
522
|
color: var(--privy-color-foreground-3) !important;
|
|
523
|
-
`,
|
|
523
|
+
`,Dl=Ne.button`
|
|
524
524
|
display: flex;
|
|
525
525
|
flex-direction: row;
|
|
526
526
|
align-items: center;
|
|
@@ -565,10 +565,10 @@ Resources:
|
|
|
565
565
|
width: auto !important;
|
|
566
566
|
color: white;
|
|
567
567
|
}
|
|
568
|
-
`;import{Fragment as
|
|
568
|
+
`;import{Fragment as W1,jsx as pr,jsxs as ti}from"react/jsx-runtime";var vu=()=>{let{user:e,logout:t}=G(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:a}=A(),{acceptTerms:i,closePrivyModal:l,createAnalyticsEvent:s}=W(),d=y=>{y?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=d;let u=async y=>{y.preventDefault(),await i(),e&&At(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 pr(I1,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:d})},I1=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>ti(W1,{children:[pr(S,{closeable:!1}),pr(k1,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),pr(he,{style:{marginTop:24},children:"One last step"}),pr(de,{children:"By signing up, you agree to our terms and privacy policy."}),ti(Lt,{style:{marginTop:24},children:[e&&ti(Wl,{target:"_blank",href:e,children:["View Terms ",pr(gu,{style:{marginLeft:"auto"}})]}),t&&ti(Wl,{target:"_blank",href:t,children:["View Privacy Policy ",pr(gu,{style:{marginLeft:"auto"}})]})]}),ti(M1,{style:{marginTop:24},children:[pr($t,{onClick:o,children:"No thanks"}),pr(F,{onClick:r,children:"Accept"})]}),pr(V,{protectedByPrivy:!0})]}),M1=R1.div`
|
|
569
569
|
display: flex;
|
|
570
570
|
gap: 10px;
|
|
571
|
-
`;import
|
|
571
|
+
`;import Ul from"styled-components";import L1 from"styled-components";var Va=L1.span`
|
|
572
572
|
&& {
|
|
573
573
|
width: 82px;
|
|
574
574
|
height: 82px;
|
|
@@ -583,7 +583,7 @@ Resources:
|
|
|
583
583
|
transition: border-color 800ms;
|
|
584
584
|
border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
|
|
585
585
|
}
|
|
586
|
-
`;import{jsx as
|
|
586
|
+
`;import{jsx as wu}from"react/jsx-runtime";var za=({style:e,...t})=>wu("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:wu("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 Fl,jsx as ur,jsxs as qa}from"react/jsx-runtime";var Cu=()=>{let{navigate:e,app:t}=A(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return qa(Fl,{children:[ur(S,{}),qa(O1,{children:[ur(D1,{children:qa("div",{children:[ur(Va,{}),ur(za,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),qa(N1,{children:[typeof r=="string"?ur("h3",{children:r}):ur(Fl,{children:r}),typeof o=="string"?ur("p",{children:o}):ur(Fl,{children:o})]}),t?.allowlistConfig.errorCtaLink?ur(F,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):ur(F,{onClick:()=>{e("LANDING")},children:n})]})]})},O1=Ul.div`
|
|
587
587
|
display: flex;
|
|
588
588
|
flex-direction: column;
|
|
589
589
|
align-items: center;
|
|
@@ -591,11 +591,11 @@ Resources:
|
|
|
591
591
|
gap: 24px;
|
|
592
592
|
width: 100%;
|
|
593
593
|
padding-bottom: 16px;
|
|
594
|
-
`,
|
|
594
|
+
`,N1=Ul.div`
|
|
595
595
|
display: flex;
|
|
596
596
|
flex-direction: column;
|
|
597
597
|
gap: 8px;
|
|
598
|
-
`,
|
|
598
|
+
`,D1=Ul.div`
|
|
599
599
|
display: flex;
|
|
600
600
|
flex-direction: column;
|
|
601
601
|
justify-content: center;
|
|
@@ -618,7 +618,7 @@ Resources:
|
|
|
618
618
|
left: -19px;
|
|
619
619
|
top: -19px;
|
|
620
620
|
}
|
|
621
|
-
`;import
|
|
621
|
+
`;import B1 from"@heroicons/react/24/outline/EnvelopeIcon";import H1 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as _u,useState as $a}from"react";import{isMobile as G1}from"react-device-detect";import ni from"styled-components";import Et from"styled-components";var Ot=Et.div`
|
|
622
622
|
display: flex;
|
|
623
623
|
flex-direction: column;
|
|
624
624
|
align-items: flex-start;
|
|
@@ -633,16 +633,16 @@ Resources:
|
|
|
633
633
|
justify-content: center;
|
|
634
634
|
flex-grow: 1;
|
|
635
635
|
width: 100%;
|
|
636
|
-
`,
|
|
636
|
+
`,bu=Et.div`
|
|
637
637
|
display: flex;
|
|
638
638
|
flex-direction: column;
|
|
639
639
|
align-items: center;
|
|
640
640
|
width: 100%;
|
|
641
|
-
`,
|
|
641
|
+
`,on=Et(at)`
|
|
642
642
|
padding: 20px 0;
|
|
643
643
|
`,jt=Et(at)`
|
|
644
644
|
gap: 16px;
|
|
645
|
-
`,
|
|
645
|
+
`,Bl=Et.div`
|
|
646
646
|
display: flex;
|
|
647
647
|
flex-direction: column;
|
|
648
648
|
width: 100%;
|
|
@@ -650,12 +650,12 @@ Resources:
|
|
|
650
650
|
display: flex;
|
|
651
651
|
flex-direction: column;
|
|
652
652
|
gap: 8px;
|
|
653
|
-
`,
|
|
653
|
+
`,ax=Et.div`
|
|
654
654
|
display: flex;
|
|
655
655
|
flex-direction: column;
|
|
656
656
|
justify-content: space-between;
|
|
657
657
|
height: 100%;
|
|
658
|
-
`,
|
|
658
|
+
`,Eu=Et.div`
|
|
659
659
|
display: flex;
|
|
660
660
|
flex-direction: column;
|
|
661
661
|
justify-content: flex-start;
|
|
@@ -682,9 +682,9 @@ Resources:
|
|
|
682
682
|
height: 16px;
|
|
683
683
|
`,oe=Et.div`
|
|
684
684
|
height: 12px;
|
|
685
|
-
`,
|
|
685
|
+
`,Tu=Et.div`
|
|
686
686
|
position: relative;
|
|
687
|
-
`,
|
|
687
|
+
`,Pu=Et.div`
|
|
688
688
|
background-color: var(--privy-color-accent);
|
|
689
689
|
display: flex;
|
|
690
690
|
justify-content: center;
|
|
@@ -692,9 +692,9 @@ Resources:
|
|
|
692
692
|
border-radius: 50%;
|
|
693
693
|
border-color: white;
|
|
694
694
|
border-width: 2px !important;
|
|
695
|
-
`;import
|
|
695
|
+
`;import Hl from"styled-components";import{Fragment as U1,jsx as ri,jsxs as Su}from"react/jsx-runtime";var oi=({title:e,description:t,children:r,...o})=>ri(xu,{...o,children:Su(U1,{children:[ri("h3",{children:e}),typeof t=="string"?ri("p",{children:t}):t,r]})}),mr=Hl(oi)`
|
|
696
696
|
margin-bottom: 24px;
|
|
697
|
-
`,
|
|
697
|
+
`,Te=({title:e,description:t,icon:r,children:o,...n})=>Su(F1,{...n,children:[r||null,ri("h3",{children:e}),typeof t=="string"?ri("p",{children:t}):t,o]}),xu=Hl.div`
|
|
698
698
|
display: flex;
|
|
699
699
|
flex-direction: column;
|
|
700
700
|
justify-content: flex-start;
|
|
@@ -714,7 +714,7 @@ Resources:
|
|
|
714
714
|
color: var(--privy-color-foreground-2);
|
|
715
715
|
font-size: 14px;
|
|
716
716
|
}
|
|
717
|
-
`,
|
|
717
|
+
`,F1=Hl(xu)`
|
|
718
718
|
align-items: center;
|
|
719
719
|
text-align: center;
|
|
720
720
|
gap: 16px;
|
|
@@ -722,7 +722,7 @@ Resources:
|
|
|
722
722
|
h3 {
|
|
723
723
|
margin-bottom: 24px;
|
|
724
724
|
}
|
|
725
|
-
`;import{Fragment as
|
|
725
|
+
`;import{Fragment as Gl,jsx as Ze,jsxs as Kr}from"react/jsx-runtime";var Vl=6,Au=new Array(Vl).fill(""),V1=1400;var Ru=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{closePrivyModal:a,resendEmailCode:i,resendSmsCode:l,getAuthMeta:s,loginWithCode:d,updateWallets:u,createAnalyticsEvent:y}=W(),{authenticated:f,logout:g,user:E}=G(),[v,x]=$a(Au),[C,P]=$a(!1),[R,M]=$a(null),[k,B]=$a(null);n.current=()=>null;let U=s()?.email?0:1,H=e?.render.inDialog?Oe:0,T=e?.render.inDialog?H-500:0;_u(()=>{if(f&&C&&E){if(e?.legal.requireUsersAcceptTerms&&!E.hasAcceptedTerms){let te=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},T);return()=>clearTimeout(te)}if(At(E,e?.embeddedWallets?.createOnLogin)){let te=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:z=>{console.error(z),y("embedded_wallet_creation_failure_logout",{error:z,screen:"AwaitingPasswordlessCodeScreen"}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},T);return()=>clearTimeout(te)}else{u();let te=setTimeout(()=>a({shouldCallAuthOnSuccess:!0,isSuccess:!0}),H);return()=>clearTimeout(te)}}},[f,C,E]),_u(()=>{if(R&&k===0){let re=setTimeout(()=>{x(Au),M(null),document.querySelector("input[name=code-0]")?.focus()},V1);return()=>clearTimeout(re)}},[R]);let q=re=>{re.preventDefault();let te=re.currentTarget.value.replace(" ","");if(te==="")return;if(isNaN(Number(te))){M("Code should be numeric"),B(1);return}M(null),B(null);let z=Number(re.currentTarget.name?.charAt(5)),Se=[...te||[""]].slice(0,Vl-z),Ce=[...v.slice(0,z),...Se,...v.slice(z+Se.length)];x(Ce);let Tr=Se.length,yt=Math.min(Math.max(z+Tr,0),Vl-1);isNaN(Number(re.currentTarget.value))||document.querySelector(`input[name=code-${yt}]`)?.focus(),Ce.every(Ae=>Ae&&!isNaN(+Ae))&&(document.querySelector(`input[name=code-${yt}]`)?.blur(),d(Ce.join("")).then(()=>P(!0)).catch(ge=>{ge?.status===422?M("Invalid or expired verification code"):ge instanceof nr&&ge.privyErrorCode==="cannot_link_more_of_type"?M(ge.message):M("Issue verifying code"),B(0)}))},O=re=>{k===1&&(M(null),B(null));let te=[...v.slice(0,re),"",...v.slice(re+1)];x(te),re>0&&document.querySelector(`input[name=code-${re-1}]`)?.focus()},Y=U==0?Ze(B1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Ze(H1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),se=U==0?Kr("p",{children:["Please check ",Ze(ku,{children:s()?.email})," for an email from privy.io and enter your code below."]}):Kr("p",{children:["Please check ",Ze(ku,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Kr(Gl,{children:[Ze(S,{backFn:()=>r()},"header"),Kr(z1,{children:[Ze(Te,{title:"Enter confirmation code",description:se,icon:Y}),Kr(bu,{children:[Kr(q1,{children:[Ze($1,{fail:!!R,success:C,children:Ze("span",{children:R||(C?"Success!":"")})}),Ze("div",{children:v.map((re,te)=>Ze("input",{name:`code-${te}`,type:"text",value:v[te],onChange:q,onKeyUp:z=>{z.key==="Backspace"&&O(te)},inputMode:"numeric",autoFocus:te===0,pattern:"[0-9]",className:`${C?"success":""} ${R?"fail":""}`,autoComplete:G1?"one-time-code":"off"},te))})]}),Ze(j1,{children:U==0?Kr(Gl,{children:[Ze("span",{children:"Didn't get an email?"}),Ze("button",{onClick:i,children:"Resend code"})]}):Kr(Gl,{children:[Ze("span",{children:"Didn't get a message?"}),Ze("button",{onClick:l,children:"Resend code"})]})})]})]}),Ze(V,{protectedByPrivy:!0})]})},z1=ni.div`
|
|
726
726
|
display: flex;
|
|
727
727
|
flex-direction: column;
|
|
728
728
|
align-items: flex-start;
|
|
@@ -730,7 +730,7 @@ Resources:
|
|
|
730
730
|
margin: auto;
|
|
731
731
|
gap: 16px;
|
|
732
732
|
flex-grow: 1;
|
|
733
|
-
`,
|
|
733
|
+
`,q1=ni.div`
|
|
734
734
|
display: flex;
|
|
735
735
|
flex-direction: column;
|
|
736
736
|
width: 100%;
|
|
@@ -786,7 +786,7 @@ Resources:
|
|
|
786
786
|
transform: translate(1px, 0px);
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
|
|
789
|
+
`,$1=ni.div`
|
|
790
790
|
line-height: 20px;
|
|
791
791
|
height: 20px;
|
|
792
792
|
font-size: 13px;
|
|
@@ -794,7 +794,7 @@ Resources:
|
|
|
794
794
|
display: flex;
|
|
795
795
|
justify-content: flex-end;
|
|
796
796
|
width: 100%;
|
|
797
|
-
`,
|
|
797
|
+
`,j1=ni.div`
|
|
798
798
|
font-size: 13px;
|
|
799
799
|
color: var(--privy-color-foreground-3);
|
|
800
800
|
display: flex;
|
|
@@ -808,10 +808,10 @@ Resources:
|
|
|
808
808
|
> button {
|
|
809
809
|
text-decoration: underline;
|
|
810
810
|
}
|
|
811
|
-
`,
|
|
811
|
+
`,ku=ni.span`
|
|
812
812
|
font-weight: 500;
|
|
813
813
|
word-break: break-all;
|
|
814
|
-
`;import
|
|
814
|
+
`;import Q1 from"@heroicons/react/24/solid/CheckCircleIcon";import X1 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as zl,useRef as ev,useState as an}from"react";import tv from"styled-components";import K1 from"styled-components";import{Fragment as J1,jsx as nn,jsxs as Z1}from"react/jsx-runtime";var Iu=({icon:e})=>{let t=e;return nn(J1,{children:nn(Y1,{children:Z1("div",{children:[nn(It,{}),typeof t=="string"?nn("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?nn(t,{style:{width:"38px",height:"38px"}}):nn("span",{})]})})})},Y1=K1.div`
|
|
815
815
|
display: flex;
|
|
816
816
|
flex-direction: column;
|
|
817
817
|
justify-content: center;
|
|
@@ -834,14 +834,14 @@ Resources:
|
|
|
834
834
|
left: -19px;
|
|
835
835
|
top: -19px;
|
|
836
836
|
}
|
|
837
|
-
`;import{Fragment as
|
|
837
|
+
`;import{Fragment as ov,jsx as Kt,jsxs as ql}from"react/jsx-runtime";var Wu=500,Mu=Wu*2,Lu=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:a}=A(),{status:i,token:l,waitForResult:s,reset:d,execute:u}=fe(),y=ev([]),f=Y=>{y.current=[Y,...y.current]},[g,E]=an(!0);zl(()=>{let Y=setTimeout(E,Mu,!1);return f(Y),()=>{y.current.forEach(se=>clearTimeout(se)),y.current=[]}},[]);let[v,x]=an(""),[C,P]=an("Checking that you are a human..."),[R,M]=an(Kt(F,{onClick:()=>{},disabled:!0,children:"Continue"})),[k,B]=an(!1),[U,H]=an(3),T=r?.captchaModalData,q=async Y=>{try{await T?.callback(Y),T?.onSuccessNavigateTo&&n(T?.onSuccessNavigateTo,!1)}catch(se){if(se instanceof qt)return;{let re={error:se,previousScreen:e||"LANDING"};a({errorModalData:re}),n(T?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};zl(()=>{if(i==="success"){let Y=setTimeout(async()=>{let se=await s();!se||T?.userIntentRequired||q(se)},Mu);f(Y)}else if(i==="ready"){let Y=setTimeout(()=>{i==="ready"&&u()},Wu);f(Y)}},[i]),zl(()=>{if(!g)switch(i){case"success":x("Success!"),P("CAPTCHA passed successfully."),M(Kt(F,{onClick:()=>{B(!0),q(l)},disabled:!T?.userIntentRequired,loading:k,children:T?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),P("Checking that you are a human..."),M(Kt(F,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),U<=0?(P("If you use an adblocker or VPN, try disabling and re-attempting."),M(null)):(P("You did not pass CAPTCHA. Please try again."),M(Kt(F,{onClick:O,children:"Retry"})));break;case"ready":default:break}},[i,g,k]);let O=async()=>{if(U<=0)return;H(se=>se-1),d(),u();let Y=await s();!Y||T?.userIntentRequired||q(Y)};return ql(ov,{children:[Kt(S,{backFn:!e||t===e?void 0:o}),ql(rv,{children:[i==="success"?Kt(Q1,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):i==="error"?Kt(X1,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Kt(Iu,{}),ql(Ye,{children:[v?Kt("h3",{children:v}):null,Kt("p",{children:C})]}),R]}),Kt(X,{})]})},rv=tv.div`
|
|
838
838
|
display: flex;
|
|
839
839
|
flex-direction: column;
|
|
840
840
|
align-items: center;
|
|
841
841
|
justify-content: center;
|
|
842
842
|
gap: 24px;
|
|
843
843
|
width: 100%;
|
|
844
|
-
`;import Z1 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as Q1}from"react-device-detect";import X1 from"styled-components";import{jsx as Yt,jsxs as Mu}from"react/jsx-runtime";var Wu=({...e})=>Mu("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Yt("defs",{children:Mu("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:[Yt("stop",{offset:"0",stopColor:"#f1562b"}),Yt("stop",{offset:"0.3",stopColor:"#f1542b"}),Yt("stop",{offset:"0.41",stopColor:"#f04d2a"}),Yt("stop",{offset:"0.49",stopColor:"#ef4229"}),Yt("stop",{offset:"0.5",stopColor:"#ef4029"}),Yt("stop",{offset:"0.56",stopColor:"#e83e28"}),Yt("stop",{offset:"0.67",stopColor:"#e13c26"}),Yt("stop",{offset:"1",stopColor:"#df3c26"})]})}),Yt("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"}),Yt("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 Jt,jsxs as oi}from"react/jsx-runtime";var Lu=({style:e,...t})=>oi("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:[Jt("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"}),Jt("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Jt("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"})}),oi("g",{mask:"url(#mask0_16909_31415)",children:[Jt("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"}),Jt("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"}),Jt("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"}}),Jt("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"}})]}),oi("defs",{children:[oi("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Jt("stop",{"stop-color":"#002D72"}),Jt("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),oi("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Jt("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),Jt("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as ee,jsxs as Tt}from"react/jsx-runtime";var Ou=({style:e,...t})=>Tt("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:[ee("g",{clipPath:"url(#clip0_5_32)",children:Tt("g",{clipPath:"url(#clip1_5_32)",children:[ee("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:ee("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"})}),ee("g",{mask:"url(#mask0_5_32)",children:ee("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),ee("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)"}),ee("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),ee("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),ee("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),ee("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),ee("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),ee("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)"}),ee("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),ee("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),Tt("defs",{children:[Tt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#174299"}),ee("stop",{offset:"1",stopColor:"#001E59"})]}),Tt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[ee("stop",{offset:"0.770277",stopColor:"#FF4000"}),ee("stop",{offset:"1",stopColor:"#8754C9"})]}),Tt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FF4000"}),ee("stop",{offset:"1",stopColor:"#8754C9"})]}),Tt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#8754C9"}),ee("stop",{offset:"1",stopColor:"#FF4000"})]}),Tt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[ee("stop",{offset:"0.723929",stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[ee("stop",{offset:"0.59513",stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),Tt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[ee("stop",{stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),Tt("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:[ee("stop",{stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),ee("clipPath",{id:"clip0_5_32",children:ee("rect",{width:"120",height:"120",fill:"white"})}),ee("clipPath",{id:"clip1_5_32",children:ee("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as fr,jsxs as Nu}from"react/jsx-runtime";var Du=({style:e,...t})=>Nu("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:[fr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Nu("g",{filter:"url(#filter0_d_12393_20043)",children:[fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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 ni,jsxs as Fu}from"react/jsx-runtime";var Uu=({style:e,...t})=>Fu("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:[Fu("g",{clipPath:"url(#clip0_1704_1423)",children:[ni("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"}),ni("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"})]}),ni("defs",{children:ni("clipPath",{id:"clip0_1704_1423",children:ni("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as an,jsxs as nv}from"react/jsx-runtime";var hr={coinbase_wallet:{logo:oa,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:jo,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:lr,displayName:"Phantom"},rainbow:{logo:Ou,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Jn,displayName:"WalletConnect"},zerion:{logo:Uu,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Wu,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Lu,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Du,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="}},Po=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=_(),{connectWallet:i}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{Ur()?(i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(Q1?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},nv(ov,{onClick:s,children:[an(rv,{icon:tv(e,n.connectorType)??r,name:n.walletClientType}),an("span",{children:ev(e,n.connectorType)||t||n.walletClientType}),an("span",{id:"connect-text",children:"Connect"})]})},ev=(e,t)=>{if(hr[e]?.displayName)return hr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},tv=(e,t)=>{if(hr[e]?.logo)return hr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Jn},rv=({icon:e,name:t})=>typeof e=="string"?an("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?an(Z1,{}):e?an(e,{}):null,ov=X1(Se)`
|
|
844
|
+
`;import nv from"@heroicons/react/24/outline/WalletIcon";import{isMobile as iv}from"react-device-detect";import av from"styled-components";import{jsx as Yt,jsxs as Ou}from"react/jsx-runtime";var Nu=({...e})=>Ou("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Yt("defs",{children:Ou("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:[Yt("stop",{offset:"0",stopColor:"#f1562b"}),Yt("stop",{offset:"0.3",stopColor:"#f1542b"}),Yt("stop",{offset:"0.41",stopColor:"#f04d2a"}),Yt("stop",{offset:"0.49",stopColor:"#ef4229"}),Yt("stop",{offset:"0.5",stopColor:"#ef4029"}),Yt("stop",{offset:"0.56",stopColor:"#e83e28"}),Yt("stop",{offset:"0.67",stopColor:"#e13c26"}),Yt("stop",{offset:"1",stopColor:"#df3c26"})]})}),Yt("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"}),Yt("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 Zt,jsxs as ii}from"react/jsx-runtime";var Du=({style:e,...t})=>ii("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:[Zt("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"}),Zt("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:Zt("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"})}),ii("g",{mask:"url(#mask0_16909_31415)",children:[Zt("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"}),Zt("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"}),Zt("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"}}),Zt("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"}})]}),ii("defs",{children:[ii("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Zt("stop",{"stop-color":"#002D72"}),Zt("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),ii("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[Zt("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),Zt("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as ee,jsxs as Tt}from"react/jsx-runtime";var Fu=({style:e,...t})=>Tt("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:[ee("g",{clipPath:"url(#clip0_5_32)",children:Tt("g",{clipPath:"url(#clip1_5_32)",children:[ee("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:ee("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"})}),ee("g",{mask:"url(#mask0_5_32)",children:ee("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),ee("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)"}),ee("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),ee("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),ee("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),ee("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),ee("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),ee("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)"}),ee("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),ee("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),Tt("defs",{children:[Tt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#174299"}),ee("stop",{offset:"1",stopColor:"#001E59"})]}),Tt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[ee("stop",{offset:"0.770277",stopColor:"#FF4000"}),ee("stop",{offset:"1",stopColor:"#8754C9"})]}),Tt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FF4000"}),ee("stop",{offset:"1",stopColor:"#8754C9"})]}),Tt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#8754C9"}),ee("stop",{offset:"1",stopColor:"#FF4000"})]}),Tt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[ee("stop",{offset:"0.723929",stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[ee("stop",{stopColor:"#FFF700"}),ee("stop",{offset:"1",stopColor:"#FF9901"})]}),Tt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[ee("stop",{offset:"0.59513",stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),Tt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[ee("stop",{stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),Tt("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:[ee("stop",{stopColor:"#00AAFF"}),ee("stop",{offset:"1",stopColor:"#01DA40"})]}),ee("clipPath",{id:"clip0_5_32",children:ee("rect",{width:"120",height:"120",fill:"white"})}),ee("clipPath",{id:"clip1_5_32",children:ee("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as fr,jsxs as Uu}from"react/jsx-runtime";var Bu=({style:e,...t})=>Uu("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:[fr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Uu("g",{filter:"url(#filter0_d_12393_20043)",children:[fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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"}),fr("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 ai,jsxs as Hu}from"react/jsx-runtime";var Gu=({style:e,...t})=>Hu("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:[Hu("g",{clipPath:"url(#clip0_1704_1423)",children:[ai("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"}),ai("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"})]}),ai("defs",{children:ai("clipPath",{id:"clip0_1704_1423",children:ai("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as sn,jsxs as pv}from"react/jsx-runtime";var hr={coinbase_wallet:{logo:ia,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Ko,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:lr,displayName:"Phantom"},rainbow:{logo:Fu,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Qn,displayName:"WalletConnect"},zerion:{logo:Gu,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Nu,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Du,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Bu,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="}},xo=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:a}=A(),{connectWallet:i}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{Br()?(i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):a(iv?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{i(n,l),a(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},pv(dv,{onClick:s,children:[sn(cv,{icon:lv(e,n.connectorType)??r,name:n.walletClientType}),sn("span",{children:sv(e,n.connectorType)||t||n.walletClientType}),sn("span",{id:"connect-text",children:"Connect"})]})},sv=(e,t)=>{if(hr[e]?.displayName)return hr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},lv=(e,t)=>{if(hr[e]?.logo)return hr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Qn},cv=({icon:e,name:t})=>typeof e=="string"?sn("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?sn(nv,{}):e?sn(e,{}):null,dv=av(we)`
|
|
845
845
|
/* Show "Connect" on hover */
|
|
846
846
|
> #connect-text {
|
|
847
847
|
font-weight: 500;
|
|
@@ -863,23 +863,23 @@ Resources:
|
|
|
863
863
|
display: none;
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
`;import{Fragment as
|
|
866
|
+
`;import{Fragment as yv,jsx as ln,jsxs as gv}from"react/jsx-runtime";var uv=["coinbase_wallet"],mv=["metamask","okx_wallet","rainbow","uniswap","zerion"],fv=["cryptocom"],hv=["phantom"],cn=({connectOnly:e})=>{let{connectors:t}=W(),{app:r}=A(),o=si(r.appearance.walletList,t,e,r.appearance.walletList);return gv(yv,{children:[...o]})},si=(e,t,r,o)=>{let n=[],a=[],i=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let d=t.filter(({connectorType:u,walletClientType:y})=>y==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(y));for(let u of d){let{walletClientType:y,walletBranding:f}=u;(y==="unknown"?a:n).push(ln(xo,{connectOnly:r,provider:y,logo:f.icon,displayName:f.name,connector:u},`${s}-${y}`))}}else if(hv.includes(s)){let d=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);d&&n.push(ln(xo,{connectOnly:r,provider:s,connector:d},s))}else if(mv.includes(s)){let d=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;d&&n.push(ln(xo,{connectOnly:r,provider:s,connector:d},s))}else if(uv.includes(s)){let d=t.find(({connectorType:u})=>u===s);d&&n.push(ln(xo,{connectOnly:r,provider:s,connector:d},s))}else fv.includes(s)?l&&i.push(ln(xo,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&i.push(ln(xo,{connectOnly:r,provider:s,connector:l},s));return[...a,...n,...i]};import{Fragment as vv,jsx as li,jsxs as wv}from"react/jsx-runtime";var Vu=()=>{let{app:e}=A(),t=`Connect a wallet to ${e?.name}`;return wv(vv,{children:[li(S,{},"header"),li(mr,{title:"Connect your wallet",description:t}),li(Lt,{children:li(cn,{connectOnly:!0})}),li(V,{protectedByPrivy:!0})]})};import Pv from"styled-components";import Ev from"styled-components";import Cv from"react";import{jsx as bv}from"react/jsx-runtime";var zu=()=>{let{app:e}=A(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?bv("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?Cv.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 qu}from"react/jsx-runtime";var dn=e=>{let{app:t}=A();return t?.appearance.logo?qu(Tv,{...e,children:qu(zu,{})}):null},Tv=Ev.div`
|
|
867
867
|
display: flex;
|
|
868
868
|
flex-direction: column;
|
|
869
869
|
align-items: center;
|
|
870
870
|
padding: 24px 0;
|
|
871
871
|
flex-grow: 1;
|
|
872
872
|
justify-content: center;
|
|
873
|
-
`;import{Fragment as
|
|
873
|
+
`;import{Fragment as Sv,jsx as pn,jsxs as _v}from"react/jsx-runtime";var $u=()=>{let{app:e}=A();return _v(Sv,{children:[pn(S,{},"header"),pn(xv,{}),pn(Lt,{children:pn(cn,{connectOnly:!0})}),e&&pn(en,{app:e,alwaysShowImplicitConsent:!0}),pn(V,{protectedByPrivy:!0})]})},xv=Pv(dn)`
|
|
874
874
|
margin-bottom: 16px;
|
|
875
|
-
`;import{useEffect as
|
|
875
|
+
`;import{useEffect as Ju,useState as Qu}from"react";import{isMobile as Ov}from"react-device-detect";import Nv from"styled-components";import{useEffect as $l,useState as So}from"react";import{isMobile as ci}from"react-device-detect";import{useInterval as Iv}from"react-use";import Ku from"styled-components";import{useState as Av,useEffect as kv,useCallback as Rv}from"react";function ju(){let[e,t]=Av(!1),r=Rv(()=>{document.hidden&&t(!0)},[]);return kv(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as Zu,jsx as De,jsxs as di}from"react/jsx-runtime";var jl=2,Kl=e=>e?.privyErrorCode==="linked_to_another_user"?_r.ERROR_USER_EXISTS:e instanceof _e&&!e.details.default?e.details:e instanceof Vo?_r.ERROR_TIMED_OUT:e instanceof zo?_r.ERROR_USER_REJECTED_CONNECTION:_r.ERROR_WALLET_CONNECTION,Yu=()=>{let[e,t]=So(!1),[r,o]=So(!1),[n,a]=So(void 0),{authenticated:i,logout:l}=G(),{app:s,navigate:d,navigateBack:u,lastScreen:y,currentScreen:f,setModalData:g}=A(),{getAuthFlow:E,walletConnectionStatus:v,closePrivyModal:x,initLoginWithWallet:C,loginWithWallet:P,updateWallets:R,createAnalyticsEvent:M}=W(),{walletConnectors:k}=G(),[B,U]=So(0),{user:H}=G(),[T]=So(H?.linkedAccounts.length||0),[q,O]=So(""),[Y,se]=So(!1),{hasTabbedAway:re}=ju(),{enabled:te,token:z}=fe(),Se=ci&&v?.connector?.connectorType==="wallet_connect_v2"||ci&&v?.connector?.connectorType==="coinbase_wallet"||ci&&v?.connector?.connectorType==="injected"&&v?.connector?.walletClientType==="phantom",Ce=v?.status==="connected",Tr=v?.status==="switching_to_supported_chain";$l(()=>{let $=E();if(Ce&&!$&&(te&&!z&&!i?(g({captchaModalData:{callback:We=>C(v.connectedWallet,We).then(()=>{se(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN",!1)):C(v.connectedWallet,z).then(()=>{se(!0)})),$&&Se&&Ce&&!$.preparedMessage){$.buildSiweMessage();return}!$||Se||!Ce||r||(async()=>{o(!0),a(void 0);try{v?.connector?.connectorType==="wallet_connect_v2"&&v?.connector?.walletClientType==="metamask"&&await fl(2500),await Ae()}catch(We){console.warn("Auto-prompted signature failed",We)}finally{o(!1)}})()},[B,Ce,Y]),$l(()=>{if(H&&e){let $=s?.render.inDialog?Oe:0,We=s?.render.inDialog?$-500:0;if(s?.legal.requireUsersAcceptTerms&&!H.hasAcceptedTerms){let po=setTimeout(()=>{d("AFFIRMATIVE_CONSENT_SCREEN")},We);return()=>clearTimeout(po)}if(At(H,s?.embeddedWallets?.createOnLogin)){let po=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:Bt=>{console.error(Bt),M("embedded_wallet_creation_failure_logout",{error:Bt,screen:"ConnectionStatusScreen"}),l()},callAuthOnSuccessOnClose:!0}}),d("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},We);return()=>clearTimeout(po)}R();let pt=setTimeout(()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Oe);return()=>clearTimeout(pt)}},[H,e]);let yt=$=>{if($?.privyErrorCode==="allowlist_rejected"){d("ALLOWLIST_REJECTION_SCREEN");return}a(Kl($))};async function Ae(){try{if(await P(),!s?.render.inDialog)return x({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch($){yt($)}finally{o(!1)}}$l(()=>{v?.connectError&&yt(v?.connectError)},[v]),Iv(()=>{let $=ge==="wallet_connect_v2"&&v?.connector instanceof cr?v.connector.redirectUri:void 0;$&&O($)},v?.connector instanceof cr&&!q?500:null);let ge=v?.connector?.connectorType||"injected",gt=v?.connector?.walletClientType||"unknown",Ut=hr[gt]?.displayName||v?.connector?.walletBranding.name||"Browser Extension",Dr=hr[gt]?.logo||v?.connector?.walletBranding.icon||($=>De(jo,{...$})),tr=Ut==="Browser Extension"?Ut.toLowerCase():Ut,L;e?L=`Successfully connected with ${tr}`:n?L=n.message:Tr?L="Switching networks":Ce?L=r&&Se?"Signing":"Sign to verify":L=`Waiting for ${tr}`;let Z="Don\u2019t see your wallet? Check your other browser windows.";if(e){let $=H?.linkedAccounts.length||0;T===$?Z="Wallet was already linked.":Z="You\u2019re good to go!"}else B>=jl&&n?Z="Unable to connect wallet":n?Z=n.detail:Tr?Z="Switch your wallet to the requested network.":Ce&&Se?Z="Sign the message in your wallet to verify it belongs to you.":gt==="metamask"&&ci?Z="Click continue to open and connect MetaMask.":gt==="metamask"?Z="For the best experience, connect only one wallet at a time.":ge==="wallet_connect"?Z="Open your mobile wallet app to continue":ge==="coinbase_wallet"&&(Ud()||(Cl(H)?Z="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":Z="Open the Coinbase app on your phone to continue."));let Q=k?.walletConnectors?.find($=>$.walletClientType==="coinbase_wallet"),Gn=gt==="coinbase_wallet"&&(Cl(H)||n===_r.ERROR_USER_EXISTS);return di(Zu,{children:[De(S,{backFn:!y||f===y?void 0:u}),di(Wv,{children:[De(Yl,{walletLogo:Dr,success:e,fail:!!n}),di(Ye,{children:[De("h3",{children:L}),De("p",{children:Z}),!Ce&&q&&!re?di("p",{children:["Still here?"," ",De("a",{href:q,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Gn?De(F,{onClick:()=>Q&&Q?.disconnect(),disabled:e,children:"Use a different wallet"}):n==_r.ERROR_USER_EXISTS&&f!==y?De(F,{onClick:u,children:"Use a different wallet"}):Ce&&!e&&Se?De(F,{onClick:()=>{o(!0),Ae(),Mv(gt)},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&B<jl?De(F,{onClick:()=>{U(B+1),a(void 0),Ce?(o(!0),Ae()):v?.connectRetry()},disabled:!e&&(!n?.retryable||B>=jl),children:"Retry"}):!e&&!n?De(F,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),De(X,{})]})},Mv=e=>{if(!ci||!op(e))return;let t=np(e);t&&window.open(t,"_self","noopener,noreferrer")},Wv=Ku.div`
|
|
876
876
|
display: flex;
|
|
877
877
|
flex-direction: column;
|
|
878
878
|
align-items: center;
|
|
879
879
|
justify-content: center;
|
|
880
880
|
gap: 24px;
|
|
881
881
|
width: 100%;
|
|
882
|
-
`,
|
|
882
|
+
`,Lv=Ku.div`
|
|
883
883
|
display: flex;
|
|
884
884
|
flex-direction: column;
|
|
885
885
|
justify-content: center;
|
|
@@ -902,14 +902,14 @@ Resources:
|
|
|
902
902
|
left: -19px;
|
|
903
903
|
top: -19px;
|
|
904
904
|
}
|
|
905
|
-
|
|
905
|
+
`,Yl=e=>{let t=e.walletLogo;return De(Zu,{children:De(Lv,{children:di("div",{children:[De(It,{success:e.success,fail:e.fail}),typeof t=="string"?De("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):De(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as Fv,jsx as kr,jsxs as Zl}from"react/jsx-runtime";var ja=2,Xu=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=A(),{walletConnectionStatus:o,closePrivyModal:n}=W(),[a,i]=Qu(void 0),[l,s]=Qu(0),d=o?.status==="connected",u=o?.status==="switching_to_supported_chain";Ju(()=>{if(d){let R=setTimeout(n,Oe);return()=>clearTimeout(R)}},[d]);let y=R=>{i(Kl(R))};Ju(()=>{o?.connectError&&y(o?.connectError)},[o]);let f=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",E=hr[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",v=hr[g]?.logo||o?.connector?.walletBranding.icon||(R=>kr(jo,{...R})),x=E==="Browser Extension"?E.toLowerCase():E,C;d?C=`Successfully connected with ${x}`:a?C=a.message:u?C="Switching networks":C=`Waiting for ${x}`;let P="Don\u2019t see your wallet? Check your other browser windows.";return d?P="You\u2019re good to go!":l>=ja&&a?P="Unable to connect wallet":a?P=a.detail:u?P="Switch your wallet to the requested network.":g==="metamask"&&Ov?P="Click to continue to open and connect MetaMask.":g==="metamask"?P="For the best experience, connect only one wallet at a time.":f==="wallet_connect_v2"?P="Open your mobile wallet app to continue":f==="coinbase_wallet"&&(P="Open the Coinbase app on your phone to continue."),Zl(Fv,{children:[kr(S,{backFn:r===t?void 0:e}),Zl(Dv,{children:[kr(Yl,{walletLogo:v,success:d,fail:!!a}),Zl(Ye,{children:[kr("h3",{children:C}),kr("p",{children:P})]}),a==_r.ERROR_USER_EXISTS?kr(F,{onClick:e,children:"Use a different wallet"}):!d&&a?.retryable&&l<ja?kr(F,{onClick:()=>{s(l+1),i(void 0),o?.connectRetry()},disabled:!d&&(!a?.retryable||l>=ja),children:"Retry"}):!d&&a&&l>=ja?kr(F,{onClick:e,children:"Use a different wallet"}):null]}),kr(X,{})]})},Dv=Nv.div`
|
|
906
906
|
display: flex;
|
|
907
907
|
flex-direction: column;
|
|
908
908
|
align-items: center;
|
|
909
909
|
justify-content: center;
|
|
910
910
|
gap: 24px;
|
|
911
911
|
width: 100%;
|
|
912
|
-
`;import
|
|
912
|
+
`;import qv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as $v,useMemo as jv,useState as Kv}from"react";import Yv from"styled-components";import Ka from"styled-components";import{jsx as Jl,jsxs as Vv}from"react/jsx-runtime";var un=()=>Jl(Uv,{children:Vv(Bv,{children:[Jl(Hv,{}),Jl(Gv,{})]})}),Uv=Ka.div`
|
|
913
913
|
display: flex;
|
|
914
914
|
justify-content: center;
|
|
915
915
|
align-items: center;
|
|
@@ -921,14 +921,14 @@ Resources:
|
|
|
921
921
|
@media all and (display-mode: standalone) {
|
|
922
922
|
margin-bottom: 30px;
|
|
923
923
|
}
|
|
924
|
-
`,
|
|
924
|
+
`,Bv=Ka.div`
|
|
925
925
|
position: relative;
|
|
926
926
|
height: 140px;
|
|
927
927
|
width: 140px;
|
|
928
928
|
|
|
929
929
|
opacity: 1;
|
|
930
930
|
animation: fadein 200ms ease;
|
|
931
|
-
`,
|
|
931
|
+
`,Hv=Ka.div`
|
|
932
932
|
position: absolute;
|
|
933
933
|
top: 0;
|
|
934
934
|
right: 0;
|
|
@@ -941,7 +941,7 @@ Resources:
|
|
|
941
941
|
border: 4px solid var(--privy-color-accent-light);
|
|
942
942
|
border-radius: 50%;
|
|
943
943
|
}
|
|
944
|
-
`,
|
|
944
|
+
`,Gv=Ka.div`
|
|
945
945
|
position: absolute;
|
|
946
946
|
top: 0;
|
|
947
947
|
right: 0;
|
|
@@ -965,20 +965,20 @@ Resources:
|
|
|
965
965
|
transform: rotate(360deg);
|
|
966
966
|
}
|
|
967
967
|
}
|
|
968
|
-
`;var
|
|
968
|
+
`;var em=["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 ye=class extends Error{constructor(r,o){super(o);this.type=r}};function mn(e){let t=e.type;return typeof t=="string"&&em.includes(t)}function zv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function _o(e){return mn(e)&&e.type==="wallet_not_on_device"}function tm(e){return mn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function fn(e){return!!(mn(e)&&e.type==="mfa_timeout")}function hn(e){return!!(mn(e)&&e.type==="missing_or_invalid_mfa")}function Ql(e){return!!(mn(e)&&e.type==="mfa_verification_max_attempts_reached")}function Xl(e){return!!(mn(e)&&e.message.includes("code 429"))}function ec(e){return!!(zv(e)&&e.message==="MFA canceled")}import{Fragment as om,jsx as yn,jsxs as tc}from"react/jsx-runtime";var rm=1,nm=()=>{let{authenticated:e,user:t,getAccessToken:r}=G(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:a}=W(),{navigate:i,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:d}=A(),u=jv(()=>Date.now(),[]),[y,f]=Kv(!1),{onCompleteNavigateTo:g,onFailure:E}=l?.connectWallet,v=C=>{y||(f(!0),E(typeof C=="string"?new Error(C):C))};$v(()=>{let C=be(t),P;return!e||!C?v("User must be authenticated and have a Privy wallet before it can be connected"):a?((async()=>{let M=await r();if(!M)return v("User must be authenticated and have a Privy wallet before it can be connected");try{await a.connect({accessToken:M,address:C.address});let k=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&k<rm?P=setTimeout(()=>{i(g)},(rm-k)*1e3):i(g)}catch(k){if(_o(k)&&C.recoveryMethod==="privy"){let B=await r();if(!B)return v("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:C.address}),(await a?.recover({address:C.address,accessToken:B}))?.address||v(new Error("Unable to recover wallet")),g?i(g):o({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:C.address}),i(g)}catch{v("An error has occurred, please try again.")}}else _o(k)?(s({...l,recoverWallet:{privyWallet:C,onCompleteNavigateTo:g,onFailure:E}}),i("EMBEDDED_WALLET_RECOVERY_SCREEN")):v(k)}})(),()=>clearTimeout(P)):void 0},[e,t,a]);let x=()=>{v("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return d.current=x,tc(om,{children:[yn(S,{onClose:x}),y?tc(om,{children:[tc(jt,{children:[yn(qv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),yn(Te,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),yn(F,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):yn(un,{}),yn(Zv,{})]})},Zv=Yv.div`
|
|
969
969
|
height: 44px;
|
|
970
|
-
`;import
|
|
970
|
+
`;import Jv from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as Qv}from"react";import{Fragment as Xv,jsx as gn,jsxs as im}from"react/jsx-runtime";var am=()=>{let{user:e}=G(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=W(),{app:n,data:a,onUserCloseViaDialogOrKeybindRef:i}=A(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:d}=a.createWallet,u=()=>{let y=be(e);y?(o(),l(y)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:d})};return Qv(()=>{let y=setTimeout(u,Vd);return()=>clearTimeout(y)},[]),i.current=u,im(Xv,{children:[gn(S,{onClose:u}),gn(K,{}),im(jt,{children:[gn(Jv,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),gn(Te,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),gn(oe,{}),gn(V,{protectedByPrivy:!0})]})};import ew from"@heroicons/react/20/solid/ExclamationTriangleIcon";import tw from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as cm,useRef as rw,useState as rc}from"react";import Yr from"styled-components";import{Fragment as pw,jsx as ke,jsxs as Jt}from"react/jsx-runtime";var dm=()=>{let[e,t]=rc(null),{authenticated:r,user:o,getAccessToken:n}=G(),{closePrivyModal:a,createAnalyticsEvent:i,clientAnalyticsId:l}=W(),{data:s,onUserCloseViaDialogOrKeybindRef:d}=A(),u=be(o)?.address,{onFailure:y,onSuccess:f,origin:g,appId:E}=s.keyExport,v=C=>{a({shouldCallAuthOnSuccess:!1}),y(typeof C=="string"?new Error(C):C)},x=()=>{a({shouldCallAuthOnSuccess:!1}),f(),i("embedded_wallet_key_export_completed",{walletAddress:u})};return cm(()=>{let C=be(o);if(!r||!C)return v("User must be authenticated before exporting their wallet");n().then(t,v)},[r,o]),d.current=x,Jt(pw,{children:[ke(S,{onClose:x}),Jt(iw,{children:[Jt(Te,{icon:ke(tw,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Jt(cw,{children:[ke(nw,{style:{marginRight:6}}),Hr(u)]}),ke("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Jt(aw,{children:[Jt(sm,{children:[ke(lm,{children:"1"}),Jt("span",{children:[ke("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."]})]}),Jt(sm,{children:[ke(lm,{children:"2"}),ke("span",{children:"Copy this key into your other wallet"})]})]}),ke("div",{style:{width:"100%"},children:e&&ke(ow,{origin:g,appId:E,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Jt(dw,{children:[Jt("div",{children:[ke(ew,{viewBox:"0 0 20 18"}),ke("h4",{children:"Warning"})]}),ke("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),ke(V,{protectedByPrivy:!0})]})};function ow(e){let[t,r]=rc(e.dimensions.width),[o,n]=rc(void 0),a=rw(null);return cm(()=>{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")})},[]),ke("div",{ref:a,children:t&&Jt(sw,{children:[ke("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Xi(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),ke(lw,{children:"Loading..."})]})})}function nw(e){return ke("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:ke("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 iw=Yr.div`
|
|
971
971
|
display: flex;
|
|
972
972
|
flex-direction: column;
|
|
973
973
|
text-align: left;
|
|
974
|
-
`,
|
|
974
|
+
`,aw=Yr.div`
|
|
975
975
|
display: flex;
|
|
976
976
|
flex-direction: column;
|
|
977
977
|
gap: 24px;
|
|
978
978
|
padding-bottom: 16px;
|
|
979
979
|
margin-left: 11px;
|
|
980
980
|
border-left: 1px solid var(--privy-color-foreground-4) !important;
|
|
981
|
-
`,
|
|
981
|
+
`,sm=Yr.div`
|
|
982
982
|
display: flex;
|
|
983
983
|
align-items: top;
|
|
984
984
|
gap: 8px;
|
|
@@ -987,7 +987,7 @@ Resources:
|
|
|
987
987
|
color: var(--privy-color-accent);
|
|
988
988
|
text-decoration: underline;
|
|
989
989
|
}
|
|
990
|
-
`,
|
|
990
|
+
`,lm=Yr.div`
|
|
991
991
|
display: flex;
|
|
992
992
|
align-items: center;
|
|
993
993
|
justify-content: center;
|
|
@@ -1001,11 +1001,11 @@ Resources:
|
|
|
1001
1001
|
border-radius: 100%;
|
|
1002
1002
|
background: var(--privy-color-background);
|
|
1003
1003
|
color: var(--privy-color-accent);
|
|
1004
|
-
`,
|
|
1004
|
+
`,sw=Yr.div`
|
|
1005
1005
|
overflow: visible;
|
|
1006
1006
|
position: relative;
|
|
1007
1007
|
height: 44px;
|
|
1008
|
-
`,
|
|
1008
|
+
`,lw=Yr.div`
|
|
1009
1009
|
position: absolute;
|
|
1010
1010
|
display: flex;
|
|
1011
1011
|
align-items: center;
|
|
@@ -1017,7 +1017,7 @@ Resources:
|
|
|
1017
1017
|
border-radius: var(--privy-border-radius-md);
|
|
1018
1018
|
background-color: var(--privy-color-background-2);
|
|
1019
1019
|
color: var(--privy-color-foreground-3);
|
|
1020
|
-
`,
|
|
1020
|
+
`,cw=Yr.div`
|
|
1021
1021
|
display: flex;
|
|
1022
1022
|
align-items: center;
|
|
1023
1023
|
padding-top: 1px;
|
|
@@ -1030,7 +1030,7 @@ Resources:
|
|
|
1030
1030
|
font-size: 12px;
|
|
1031
1031
|
font-weight: 500;
|
|
1032
1032
|
margin: auto;
|
|
1033
|
-
`,
|
|
1033
|
+
`,dw=Yr.div`
|
|
1034
1034
|
border: 1px solid var(--privy-color-background-2) !important;
|
|
1035
1035
|
border-radius: var(--privy-border-radius-md);
|
|
1036
1036
|
padding: 16px;
|
|
@@ -1052,7 +1052,7 @@ Resources:
|
|
|
1052
1052
|
color: var(--privy-color-error);
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
`;import
|
|
1055
|
+
`;import nC from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Nm,useRef as iC,useState as yi}from"react";import aC from"styled-components";import{useCallback as Om,useEffect as oC}from"react";import yw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as gw,useState as ic}from"react";import uw from"@heroicons/react/24/outline/ArrowPathIcon";import mw from"@heroicons/react/24/outline/EyeIcon";import fw from"@heroicons/react/24/outline/EyeSlashIcon";import Je,{css as oc}from"styled-components";var hw=oc`
|
|
1056
1056
|
font-size: 14px;
|
|
1057
1057
|
font-style: normal;
|
|
1058
1058
|
font-weight: 400;
|
|
@@ -1060,8 +1060,8 @@ Resources:
|
|
|
1060
1060
|
letter-spacing: -0.008px;
|
|
1061
1061
|
text-align: left;
|
|
1062
1062
|
transition: color 0.1s ease-in;
|
|
1063
|
-
`,
|
|
1064
|
-
${
|
|
1063
|
+
`,Ya=Je.span`
|
|
1064
|
+
${hw}
|
|
1065
1065
|
transition: color 0.1s ease-in;
|
|
1066
1066
|
color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1067
1067
|
text-transform: ${({error:e})=>e?"":"capitalize"};
|
|
@@ -1069,18 +1069,18 @@ Resources:
|
|
|
1069
1069
|
&[aria-hidden='true'] {
|
|
1070
1070
|
visibility: hidden;
|
|
1071
1071
|
}
|
|
1072
|
-
`,
|
|
1072
|
+
`,Zr=Je.div`
|
|
1073
1073
|
display: flex;
|
|
1074
1074
|
flex-direction: column;
|
|
1075
1075
|
justify-content: center;
|
|
1076
1076
|
flex-grow: 1;
|
|
1077
|
-
`,Jr=
|
|
1078
|
-
${e=>e.hideAnimations&&
|
|
1077
|
+
`,Jr=Je(F)`
|
|
1078
|
+
${e=>e.hideAnimations&&oc`
|
|
1079
1079
|
&& {
|
|
1080
1080
|
transition: none;
|
|
1081
1081
|
}
|
|
1082
1082
|
`}
|
|
1083
|
-
`,
|
|
1083
|
+
`,pm=oc`
|
|
1084
1084
|
&& {
|
|
1085
1085
|
width: 100%;
|
|
1086
1086
|
border-width: 1px;
|
|
@@ -1095,8 +1095,8 @@ Resources:
|
|
|
1095
1095
|
font-weight: 300;
|
|
1096
1096
|
line-height: 22px; /* 137.5% */
|
|
1097
1097
|
}
|
|
1098
|
-
`,
|
|
1099
|
-
${
|
|
1098
|
+
`,vn=Je.input`
|
|
1099
|
+
${pm}
|
|
1100
1100
|
|
|
1101
1101
|
&::placeholder {
|
|
1102
1102
|
color: var(--privy-color-foreground-3);
|
|
@@ -1107,15 +1107,15 @@ Resources:
|
|
|
1107
1107
|
overflow: hidden;
|
|
1108
1108
|
text-overflow: ellipsis;
|
|
1109
1109
|
white-space: nowrap;
|
|
1110
|
-
`,
|
|
1111
|
-
${
|
|
1112
|
-
`,
|
|
1110
|
+
`,um=Je.div`
|
|
1111
|
+
${pm}
|
|
1112
|
+
`,Qr=Je.div`
|
|
1113
1113
|
position: relative;
|
|
1114
1114
|
width: 100%;
|
|
1115
1115
|
display: flex;
|
|
1116
1116
|
align-items: center;
|
|
1117
1117
|
justify-content: ${({centered:e})=>e?"center":"space-between"};
|
|
1118
|
-
`,
|
|
1118
|
+
`,Xr=Je.div`
|
|
1119
1119
|
display: flex;
|
|
1120
1120
|
flex-direction: column;
|
|
1121
1121
|
align-items: center;
|
|
@@ -1137,12 +1137,12 @@ Resources:
|
|
|
1137
1137
|
font-weight: 400;
|
|
1138
1138
|
line-height: 20px;
|
|
1139
1139
|
}
|
|
1140
|
-
`,
|
|
1140
|
+
`,pi=Je.div`
|
|
1141
1141
|
display: flex;
|
|
1142
1142
|
flex-direction: column;
|
|
1143
1143
|
gap: 10px;
|
|
1144
1144
|
padding-bottom: 1rem;
|
|
1145
|
-
`,
|
|
1145
|
+
`,ui=Je.div`
|
|
1146
1146
|
display: flex;
|
|
1147
1147
|
text-align: left;
|
|
1148
1148
|
align-items: center;
|
|
@@ -1162,13 +1162,13 @@ Resources:
|
|
|
1162
1162
|
> :first-child {
|
|
1163
1163
|
min-width: 24px;
|
|
1164
1164
|
}
|
|
1165
|
-
`,
|
|
1165
|
+
`,B_=Je.div`
|
|
1166
1166
|
height: var(--privy-height-modal-full);
|
|
1167
1167
|
|
|
1168
1168
|
@media (max-width: 440px) {
|
|
1169
1169
|
height: var(--privy-height-modal-compact);
|
|
1170
1170
|
}
|
|
1171
|
-
`,
|
|
1171
|
+
`,nc=Je(Wa)`
|
|
1172
1172
|
display: flex;
|
|
1173
1173
|
flex: 1;
|
|
1174
1174
|
gap: 4px;
|
|
@@ -1180,7 +1180,7 @@ Resources:
|
|
|
1180
1180
|
border-color: var(--privy-color-foreground-3);
|
|
1181
1181
|
border-width: 1px;
|
|
1182
1182
|
}
|
|
1183
|
-
`,
|
|
1183
|
+
`,wn=Je.div`
|
|
1184
1184
|
position: absolute;
|
|
1185
1185
|
right: 0.5rem;
|
|
1186
1186
|
|
|
@@ -1188,7 +1188,7 @@ Resources:
|
|
|
1188
1188
|
flex-direction: row;
|
|
1189
1189
|
justify-content: space-around;
|
|
1190
1190
|
align-items: center;
|
|
1191
|
-
`,
|
|
1191
|
+
`,mm=Je(uw)`
|
|
1192
1192
|
height: 1.25rem;
|
|
1193
1193
|
width: 1.25rem;
|
|
1194
1194
|
stroke: var(--privy-color-accent);
|
|
@@ -1197,7 +1197,7 @@ Resources:
|
|
|
1197
1197
|
:active {
|
|
1198
1198
|
stroke: var(--privy-color-accent-light);
|
|
1199
1199
|
}
|
|
1200
|
-
`,
|
|
1200
|
+
`,Cn=Je(fw)`
|
|
1201
1201
|
height: 1.25rem;
|
|
1202
1202
|
width: 1.25rem;
|
|
1203
1203
|
stroke: var(--privy-color-accent);
|
|
@@ -1206,7 +1206,7 @@ Resources:
|
|
|
1206
1206
|
:active {
|
|
1207
1207
|
stroke: var(--privy-color-accent-light);
|
|
1208
1208
|
}
|
|
1209
|
-
`,
|
|
1209
|
+
`,bn=Je(mw)`
|
|
1210
1210
|
height: 1.25rem;
|
|
1211
1211
|
width: 1.25rem;
|
|
1212
1212
|
stroke: var(--privy-color-accent);
|
|
@@ -1215,7 +1215,7 @@ Resources:
|
|
|
1215
1215
|
:active {
|
|
1216
1216
|
stroke: var(--privy-color-accent-light);
|
|
1217
1217
|
}
|
|
1218
|
-
`,
|
|
1218
|
+
`,fm=Je.progress`
|
|
1219
1219
|
height: 4px;
|
|
1220
1220
|
width: 100%;
|
|
1221
1221
|
margin: 8px 0;
|
|
@@ -1231,14 +1231,14 @@ Resources:
|
|
|
1231
1231
|
transition: all 0.1s ease-out;
|
|
1232
1232
|
background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
|
|
1233
1233
|
}
|
|
1234
|
-
`;import{Fragment as
|
|
1234
|
+
`;import{Fragment as vw,jsx as Pt,jsxs as Za}from"react/jsx-runtime";var hm=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[a,i]=ic(!0),[l,s]=ic(!1),[d,u]=ic(""),y=r===d;return gw(()=>{d&&!l&&s(!0)},[d]),Za(vw,{children:[Pt(S,{title:"Confirm Password",closeable:!1,backFn:n}),Pt(K,{}),Za(Zr,{children:[Za(Xr,{children:[Pt(yw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Pt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),Pt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),Za(Qr,{children:[Pt(vn,{value:d,onChange:f=>u(f.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:a?"password":"text",style:{paddingRight:"2.3rem"}}),Pt(wn,{style:{right:"0.75rem"},children:a?Pt(Cn,{onClick:()=>i(!1)}):Pt(bn,{onClick:()=>i(!0)})})]}),Pt(Ya,{"aria-hidden":!l||y,error:!0,children:"Passwords do not match"})]}),Pt(Jr,{onClick:o,loading:t,disabled:!y,hideAnimations:e,children:"Continue"}),Pt(oe,{}),Pt(V,{protectedByPrivy:!0})]})};import Ew from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Tw}from"react";import Pw from"styled-components";import Ja from"styled-components";import{jsx as mi,jsxs as bw}from"react/jsx-runtime";var ym=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>mi("label",{children:bw(ww,{className:e,children:[mi(vm,{checked:t,...o}),mi(Cw,{color:r,checked:t,children:mi(gm,{viewBox:"0 0 24 24",children:mi("polyline",{points:"20 6 9 17 4 12"})})})]})}),ww=Ja.div`
|
|
1235
1235
|
display: inline-block;
|
|
1236
1236
|
vertical-align: middle;
|
|
1237
|
-
`,
|
|
1237
|
+
`,gm=Ja.svg`
|
|
1238
1238
|
fill: none;
|
|
1239
1239
|
stroke: white;
|
|
1240
1240
|
stroke-width: 3px;
|
|
1241
|
-
`,
|
|
1241
|
+
`,vm=Ja.input.attrs({type:"checkbox"})`
|
|
1242
1242
|
border: 0;
|
|
1243
1243
|
clip: rect(0 0 0 0);
|
|
1244
1244
|
clippath: inset(50%);
|
|
@@ -1249,7 +1249,7 @@ Resources:
|
|
|
1249
1249
|
position: absolute;
|
|
1250
1250
|
white-space: nowrap;
|
|
1251
1251
|
width: 1px;
|
|
1252
|
-
`,
|
|
1252
|
+
`,Cw=Ja.div`
|
|
1253
1253
|
display: inline-block;
|
|
1254
1254
|
width: 18px;
|
|
1255
1255
|
height: 18px;
|
|
@@ -1264,30 +1264,30 @@ Resources:
|
|
|
1264
1264
|
border-width: 1px;
|
|
1265
1265
|
}
|
|
1266
1266
|
|
|
1267
|
-
${
|
|
1267
|
+
${vm}:focus + & {
|
|
1268
1268
|
box-shadow: 0 0 0 1px ${e=>e.color};
|
|
1269
1269
|
}
|
|
1270
1270
|
|
|
1271
|
-
${
|
|
1271
|
+
${gm} {
|
|
1272
1272
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
1273
1273
|
}
|
|
1274
|
-
`;import{Fragment as
|
|
1274
|
+
`;import{Fragment as wm,jsx as Nt,jsxs as fi}from"react/jsx-runtime";var Cm=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[a,i]=Tw(!1);return fi(wm,{children:[Nt(S,{title:"Confirm Password",closeable:!1,backFn:o}),Nt(K,{}),fi(Zr,{children:[fi(Xr,{children:[Nt(Ew,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),Nt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),Nt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),Nt(pi,{children:fi(ui,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),i(s=>!s)},children:[Nt(ym,{color:"var(--privy-color-error)",checked:a}),Nt(wm,{children:"I understand losing my password means losing my account."})]})})]}),fi(xw,{children:[n.initiatedBy==="user"&&Nt($t,{onClick:n.onCancel,disabled:t,children:"Cancel"}),Nt(Jr,{onClick:r,loading:t,hideAnimations:e,disabled:!a,children:"Set Password"})]}),Nt(oe,{}),Nt(V,{protectedByPrivy:!0})]})},xw=Pw.div`
|
|
1275
1275
|
display: flex;
|
|
1276
1276
|
gap: 10px;
|
|
1277
|
-
`;import
|
|
1277
|
+
`;import Hw from"@heroicons/react/24/outline/KeyIcon";import _m from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Am,useMemo as ac,useEffect as Gw}from"react";import km from"styled-components";import Sw from"fast-password-entropy";import*as bm from"secure-password-utilities";import{DEFAULT_WORDLIST as _w}from"secure-password-utilities/wordlists";var Aw=95,kw=8,Rw=3,Iw=.3,Mw=/[a-z]/,Ww=/[A-Z]/,Lw=/[0-9]/,Ow="a-zA-Z0-9",Em="!@#$%^&*()\\-_+.",Tm=`${Ow}${Em}`,Nw=new RegExp(`[${Em}]`),Dw=new RegExp(`[${Tm}]`),Pm=new RegExp(`^[${Tm}]{6,}$`),xm=(e="")=>{let t=e.split("").filter(r=>!Dw.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},Qa=()=>bm.generatePassphrase(4,_w);function Fw(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Uw(e){if(e.length<kw)return 0;let t=0;Mw.test(e)&&(t+=1),Ww.test(e)&&(t+=1),Lw.test(e)&&(t+=1),Nw.test(e)&&(t+=1);let r=t/Rw;return Math.max(0,Math.min(1,r))}function Bw(e=""){let t=Uw(e),r=Sw(e)/Aw;return(t*Iw+r)/2}function Sm(e=""){let t=Bw(e);return{value:t,label:Fw(t)}}import{Fragment as qw,jsx as Fe,jsxs as Rr}from"react/jsx-runtime";var Rm=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:a,onPasswordChange:i,onPasswordGenerate:l})=>{let[s,d]=Am(!1),[u,y]=Am(!1);Gw(()=>{r&&!u&&y(!0)},[r]);let f=ac(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":Pm.test(r||"")?null:`Invalid characters used ( ${xm(r).join(" ")} )`:null,[r,u]),g=ac(()=>f?{value:0,label:"Weak"}:Sm(r),[r,f]),E=ac(()=>!!(!r?.length||f),[f,r]);return Rr(qw,{children:[Fe(S,{onClose:a,title:"Secure your account",closeable:o.initiatedBy==="user"}),Fe(K,{}),Rr(Zr,{children:[Rr(Xr,{children:[Fe(Hw,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Fe("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),Fe("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),Rr(Qr,{children:[Fe(vn,{value:r,onChange:v=>i(v.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text",style:{paddingRight:"3.8rem"}}),Rr(wn,{style:{width:"3.5rem"},children:[s?Fe(Cn,{onClick:()=>d(!1)}):Fe(bn,{onClick:()=>d(!0)}),Fe(mm,{onClick:l})]})]}),Fe(fm,{value:g.value===0?.01:g.value,label:g.label}),Fe(Ya,{error:!!f,children:f||`Password Strength: ${u?g.label:"--"}`}),Rr(zw,{children:[Fe(Vw,{children:Rr(pi,{children:[Rr(ui,{children:[Fe(_m,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),Rr(ui,{children:[Fe(_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."]})]})}),Fe(Jr,{onClick:n,loading:t,disabled:E,hideAnimations:e,children:"Continue"})]})]}),Fe(oe,{}),Fe(V,{protectedByPrivy:!0})]})},Vw=km(pi)`
|
|
1278
1278
|
flex: 1;
|
|
1279
1279
|
padding-top: 1rem;
|
|
1280
|
-
`,
|
|
1280
|
+
`,zw=km.div`
|
|
1281
1281
|
display: flex;
|
|
1282
1282
|
flex-direction: column;
|
|
1283
1283
|
height: 100%;
|
|
1284
|
-
`;import
|
|
1284
|
+
`;import $w from"@heroicons/react/24/outline/ArrowDownTrayIcon";import jw from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Kw from"@heroicons/react/24/outline/DocumentDuplicateIcon";import Yw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Zw,useCallback as Im}from"react";import{Fragment as sc,jsx as ht,jsxs as Ao}from"react/jsx-runtime";var Mm=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:a})=>{let[i,l]=Zw(!1),s=Im(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),d=Im(()=>{let u=document.createElement("a"),y=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),f=new Blob([Jw(r,o)],{type:"text/plain"}),g=URL.createObjectURL(f);u.href=g,u.target="_blank",u.download=`${y}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return Ao(sc,{children:[ht(S,{backFn:a,title:"Save Password",closeable:!1}),ht(K,{}),Ao(Zr,{children:[Ao(Xr,{children:[ht(Yw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),ht("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),ht("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."})]}),ht(Qr,{centered:!0,children:ht(um,{children:o})}),Ao("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[ht(nc,{onClick:s,children:i?Ao(sc,{children:[ht(jw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):Ao(sc,{children:[ht(Kw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),Ao(nc,{onClick:d,children:[ht($w,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),ht(Jr,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),ht(oe,{}),ht(V,{protectedByPrivy:!0})]})},Jw=(e,t)=>`Your wallet recovery password for ${e} is
|
|
1285
1285
|
|
|
1286
1286
|
${t}
|
|
1287
1287
|
|
|
1288
|
-
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import
|
|
1288
|
+
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import Qw from"@heroicons/react/24/solid/CheckCircleIcon";import Xw from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as eC,jsx as Ir,jsxs as lc}from"react/jsx-runtime";var Wm=({error:e,onClose:t})=>lc(eC,{children:[Ir(S,{closeable:!1}),Ir(K,{}),e?lc(jt,{children:[Ir(Xw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),Ir(Te,{title:"Something went wrong",description:e})]}):lc(jt,{children:[Ir(Qw,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),Ir(Te,{title:"Success"})]}),Ir(F,{onClick:t,children:"Close"}),Ir(oe,{}),Ir(V,{protectedByPrivy:!0})]});import{useReducer as tC}from"react";var rC=(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}},Lm=()=>{let[e,t]=tC(rC,"creating");return{send:t,state:e}};import{jsx as hi}from"react/jsx-runtime";var Xa=({onSubmit:e,...t})=>{let{send:r,state:o}=Lm(),n=Om(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);oC(()=>{let i;return o==="done"&&t.config.initiatedBy==="automatic"&&(i=setTimeout(()=>t.onClose?.(),Oe)),()=>{i&&clearTimeout(i)}},[o,t.config.initiatedBy,t.onClose]);let a=Om(()=>{r("back")},[r]);return o==="creating"?hi(Rm,{...t,onSubmit:n}):o==="saving"?hi(Mm,{...t,onSubmit:n,onBack:a}):o==="confirming"?hi(hm,{...t,onSubmit:n,onBack:a}):o==="finalizing"?hi(Cm,{...t,onSubmit:n,onBack:a}):o==="done"?hi(Wm,{...t,onSubmit:n}):null};import{Fragment as lC,jsx as ko,jsxs as Dm}from"react/jsx-runtime";var Fm=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=A(),[n,a]=yi(""),[i,l]=yi(!1),[s,d]=yi(),[u,y]=yi(null),[f,g]=yi(null),E=iC(!1),{authenticated:v,getAccessToken:x}=G(),{refreshUser:C,closePrivyModal:P,createAnalyticsEvent:R,isNewUserThisSession:M,initializeWalletProxy:k}=W(),{onSuccess:B,onFailure:U,callAuthOnSuccessOnClose:H}=r.createWallet,T=e?.embeddedWallets.requireUserPasswordOnCreate===!0,q=!!(!n||E.current)&&!T,O=new ot(async()=>se());Nm(()=>{u||k(3e4).then(te=>y(te))},[u]),Nm(()=>{if(!v){t("LANDING"),U(new Error("User must be authenticated before creating a Privy wallet"));return}!T&&!i&&!E.current&&(l(!0),O.execute().finally(()=>l(!1)))},[T,v]);let Y=()=>{T&&f&&f?.recoveryMethod!=="user-passcode"?(U(new wt("User created a wallet but failed to set a password for it")),P({shouldCallAuthOnSuccess:!1})):f?(B(f),P({shouldCallAuthOnSuccess:H})):(U(new wt("User wallet creation failed")),P({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let se=async function(){let te=await x();if(te)try{R("embedded_wallet_creation_started");let z=await k(Uo);if(!z)throw new Error("walletProxy does not exist.");let Se=1e4,Ce=new Promise((ge,gt)=>{setTimeout(()=>{gt(new Error("walletProxy.create timed out."))},Se)});if(!await Promise.race([z.create({accessToken:te,recoveryPassword:s}),Ce]))throw new Error("walletProxy.create did not send a response.");let yt=await C();if(!yt)throw new Error("Failed to refresh user.");let Ae=be(yt);if(!Ae)throw new Error("Updated user is missing embedded wallet.");g(Ae),R("embedded_wallet_creation_completed",{walletAddress:Ae.address}),a(""),E.current=!0,T?t("EMBEDDED_WALLET_CREATED_SCREEN"):M?t("EMBEDDED_WALLET_CREATED_SCREEN"):Ae&&(B(Ae),P({shouldCallAuthOnSuccess:H}))}catch(z){if(E.current)return;R("embedded_wallet_creation_failed",{error:z.toString()}),a("An error has occurred, please try again."),console.warn(z)}else a("An error has occured, please login again."),R("embedded_wallet_creation_failed",{error:"Missing access token for user."})},re=async()=>{if(!T)return P({shouldCallAuthOnSuccess:H});l(!0);let te=250;return O.execute().then(()=>new Promise(z=>setTimeout(z,te))).finally(()=>l(!1))};return!T&&n?Dm(lC,{children:[ko(S,{closeable:!1}),Dm(jt,{children:[ko(nC,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),ko(Te,{title:"Something went wrong",description:n})]}),ko(F,{onClick:Y,children:"Close"}),ko(sC,{})]}):q?ko(un,{}):ko(Xa,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:q||!u,buttonLoading:i,buttonHideAnimations:!f&&i,error:n,password:s||"",onClose:Y,onPasswordChange:d,onPasswordGenerate:()=>d(Qa()),onSubmit:re})},sC=aC.div`
|
|
1289
1289
|
height: 44px;
|
|
1290
|
-
`;import{useEffect as
|
|
1290
|
+
`;import{useEffect as cC,useState as es}from"react";import{jsx as dC}from"react/jsx-runtime";var Um=()=>{let[e,t]=es(null),[r,o]=es(!1),[n,a]=es(null),[i,l]=es(""),{authenticated:s,getAccessToken:d,user:u}=G(),{walletProxy:y,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:E}=W(),{app:v,navigate:x,data:C,onUserCloseViaDialogOrKeybindRef:P}=A(),{onSuccess:R,onFailure:M}=C.createWallet,k=be(u),B=e?.recoveryMethod==="user-passcode";cC(()=>{s||(x("LANDING"),M(new Hi("User must be authenticated before setting a password on a Privy wallet")))},[s]);let U=()=>{if(n){M(n),g({shouldCallAuthOnSuccess:!1});return}if(!B){M(new wt("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}R(e),g({shouldCallAuthOnSuccess:!1})};P.current=U;let H=async()=>{let q=await d();if(q&&k?.address&&i&&y)try{if(E("embedded_wallet_set_password_started",{walletAddress:k.address}),!(await y.setRecoveryPassword({accessToken:q,address:k.address,recoveryPassword:i})).address){a(new wt("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"error setting password"});return}let Y=await f(),se=be(Y);if(!se){a(new wt("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"wallet disconnected"});return}t(se),E("embedded_wallet_set_password_completed",{walletAddress:k.address})}catch(O){console.warn(O),a(O instanceof Error?O:new Error("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:O})}},T=async()=>{B?(R(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),a(null),await H(),o(!1))};return dC(Xa,{appName:v?.name||"privy",config:{initiatedBy:"user",onCancel:U},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:i,onPasswordGenerate:()=>l(Qa()),onPasswordChange:l,onSubmit:T,onClose:U})};import pC from"@heroicons/react/24/outline/UserCircleIcon";import uC from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as mC,jsx as Mr,jsxs as ts}from"react/jsx-runtime";var Bm=()=>{let{user:e}=G(),{closePrivyModal:t,createAnalyticsEvent:r}=W(),{data:o,setModalData:n,navigate:a,onUserCloseViaDialogOrKeybindRef:i}=A(),{onSuccess:l,onFailure:s}=o.setWalletPassword,d=()=>{s(new wt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return i.current=d,ts(mC,{children:[Mr(S,{onClose:d}),Mr(K,{}),ts(jt,{children:[ts(Tu,{children:[Mr(pC,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Mr(Pu,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Mr(uC,{width:"12px",height:"12px",fill:"white"})})]}),ts(Te,{title:"Secure Your Account",children:["Please set a password to secure your account.",Mr("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."})]})]}),Mr(F,{onClick:()=>{let y=be(e);r("embedded_wallet_set_password_started",{walletAddress:y?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),a("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Mr(oe,{}),Mr(V,{protectedByPrivy:!0})]})};import fC from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as hC,useState as rs}from"react";import os,{css as yC}from"styled-components";import{Fragment as bC,jsx as st,jsxs as Ro}from"react/jsx-runtime";var Hm=()=>{let[e,t]=rs(!0),{authenticated:r,getAccessToken:o}=G(),{walletProxy:n,closePrivyModal:a,createAnalyticsEvent:i}=W(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=A(),[u,y]=rs(void 0),[f,g]=rs(""),[E,v]=rs(!1),{privyWallet:x,onCompleteNavigateTo:C,onSuccess:P,onFailure:R}=s.recoverWallet,M=(U="User exited before their wallet could be recovered")=>{a({shouldCallAuthOnSuccess:!1}),R(typeof U=="string"?new wt(U):U)};d.current=M,hC(()=>{if(!r||!x)return M("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let k=U=>{U&&y(U)};return Ro(bC,{children:[st(S,{onClose:M}),st(K,{}),Ro(vC,{children:[Ro(gC,{children:[st(fC,{height:48,width:48,stroke:"var(--privy-color-accent)"}),st("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),st("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),Ro("div",{children:[Ro(Qr,{children:[st(vn,{type:e?"password":"text",onChange:U=>k(U.target.value),disabled:E,style:{paddingRight:"2.3rem"}}),st(wn,{style:{right:"0.75rem"},children:e?st(Cn,{onClick:()=>t(!1)}):st(bn,{onClick:()=>t(!0)})})]}),!!f&&st(wC,{children:f})]}),Ro("div",{children:[Ro(Eu,{children:[st("h4",{children:"Why is this necessary?"}),st("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),st(CC,{loading:E||!n,disabled:!u,onClick:async()=>{v(!0);let U=await o();if(U&&x&&u!==null)try{i("embedded_wallet_recovery_started",{walletAddress:x.address}),await n?.recover({address:x.address,accessToken:U,recoveryPin:u}),g(""),C?l(C):a({shouldCallAuthOnSuccess:!1}),P?.(x),i("embedded_wallet_recovery_completed",{walletAddress:x.address})}catch(H){tm(H)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{v(!1)}else return M("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!x&&E,children:"Recover your account"})]})]}),st(oe,{}),st(V,{protectedByPrivy:!0})]})},gC=os.div`
|
|
1291
1291
|
display: flex;
|
|
1292
1292
|
flex-direction: column;
|
|
1293
1293
|
align-items: center;
|
|
@@ -1309,26 +1309,26 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1309
1309
|
font-weight: 400;
|
|
1310
1310
|
line-height: 20px;
|
|
1311
1311
|
}
|
|
1312
|
-
`,
|
|
1312
|
+
`,vC=os.div`
|
|
1313
1313
|
display: flex;
|
|
1314
1314
|
flex-direction: column;
|
|
1315
1315
|
justify-content: space-between;
|
|
1316
|
-
`,
|
|
1316
|
+
`,wC=os.div`
|
|
1317
1317
|
line-height: 20px;
|
|
1318
1318
|
height: 20px;
|
|
1319
1319
|
font-size: 13px;
|
|
1320
1320
|
color: var(--privy-color-error);
|
|
1321
1321
|
text-align: left;
|
|
1322
1322
|
margin-top: 0.5rem;
|
|
1323
|
-
`,
|
|
1324
|
-
${e=>e.hideAnimations&&
|
|
1323
|
+
`,CC=os(F)`
|
|
1324
|
+
${e=>e.hideAnimations&&yC`
|
|
1325
1325
|
&& {
|
|
1326
1326
|
// Remove animations because the recoverWallet task on the iframe partially
|
|
1327
1327
|
// blocks the renderer, so the animation stutters and doesn't look good
|
|
1328
1328
|
transition: none;
|
|
1329
1329
|
}
|
|
1330
1330
|
`}
|
|
1331
|
-
`;import
|
|
1331
|
+
`;import EC from"@heroicons/react/24/outline/ExclamationTriangleIcon";import TC from"@heroicons/react/24/outline/PhoneIcon";import cc from"styled-components";import{Fragment as AC,jsx as Qt,jsxs as ns}from"react/jsx-runtime";var PC=e=>{let t=Qt(EC,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof _)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof ye&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:Qt(TC,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof $e)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:Qt(za,{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:Qt("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:Qt("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 nr&&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}}},Gm=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=A(),{reset:a}=fe(),i=r?.errorModalData,l=PC(i?.error||new Error),s=d=>{if(d instanceof $e)switch(d.privyErrorCode){case"invalid_captcha":return()=>a()}return()=>{}};return ns(AC,{children:[Qt(S,{backFn:!o||n===o?void 0:t}),ns(xC,{children:[Qt(_C,{children:ns("div",{children:[Qt(Va,{color:"var(--privy-color-error)"}),l.icon]})}),ns(SC,{children:[Qt("h3",{children:l.title}),Qt("p",{children:l.detail})]}),Qt(F,{color:"var(--privy-color-error)",onClick:()=>{s(i?.error||new Error)(),e(o||"LANDING",!1)},children:l.ctaText})]})]})},xC=cc.div`
|
|
1332
1332
|
display: flex;
|
|
1333
1333
|
flex-direction: column;
|
|
1334
1334
|
align-items: center;
|
|
@@ -1336,11 +1336,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1336
1336
|
gap: 24px;
|
|
1337
1337
|
width: 100%;
|
|
1338
1338
|
padding-bottom: 16px;
|
|
1339
|
-
`,
|
|
1339
|
+
`,SC=cc.div`
|
|
1340
1340
|
display: flex;
|
|
1341
1341
|
flex-direction: column;
|
|
1342
1342
|
gap: 8px;
|
|
1343
|
-
`,
|
|
1343
|
+
`,_C=cc.div`
|
|
1344
1344
|
display: flex;
|
|
1345
1345
|
flex-direction: column;
|
|
1346
1346
|
justify-content: center;
|
|
@@ -1363,7 +1363,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1363
1363
|
left: -19px;
|
|
1364
1364
|
top: -19px;
|
|
1365
1365
|
}
|
|
1366
|
-
`;import{useEffect as
|
|
1366
|
+
`;import{useEffect as Zm,useRef as KC,useState as uc}from"react";import{isIOS as YC,isMobile as Jm}from"react-device-detect";import mc from"styled-components";import{useState as kC}from"react";import RC from"styled-components";import{jsx as Vm}from"react/jsx-runtime";var is=({style:e,color:t,...r})=>Vm("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:Vm("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as dc}from"react/jsx-runtime";var zm=({color:e,...t})=>dc("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:dc("g",{children:dc("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 qm,jsxs as MC}from"react/jsx-runtime";var eo=e=>{let[t,r]=kC(!1);return MC(IC,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?qm(is,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):qm(zm,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},IC=RC.button`
|
|
1367
1367
|
display: flex;
|
|
1368
1368
|
align-items: center;
|
|
1369
1369
|
gap: 6px;
|
|
@@ -1401,7 +1401,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1401
1401
|
width: 14px;
|
|
1402
1402
|
height: 14px;
|
|
1403
1403
|
}
|
|
1404
|
-
`;import{useState as
|
|
1404
|
+
`;import{useState as WC}from"react";import LC from"styled-components";import{jsx as NC}from"react/jsx-runtime";var as=e=>{let[t,r]=WC(!1);return NC(OC,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},OC=LC.a`
|
|
1405
1405
|
display: flex;
|
|
1406
1406
|
align-items: center;
|
|
1407
1407
|
gap: 6px;
|
|
@@ -1439,7 +1439,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1439
1439
|
width: 14px;
|
|
1440
1440
|
height: 14px;
|
|
1441
1441
|
}
|
|
1442
|
-
`;import
|
|
1442
|
+
`;import DC from"qrcode";import FC from"react";import UC from"styled-components";import{jsx as $m}from"react/jsx-runtime";var jm=()=>$m("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:$m("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as gi,jsx as lt,jsxs as Ym}from"react/jsx-runtime";var xt=7,pc=(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},BC=e=>{let t=DC.create(e,{errorCorrectionLevel:"high"}).modules,r=Jd(Array.from(t.data),t.size);return r=pc(r,0,0,xt,xt),r=pc(r,r.length-xt,0,xt,xt),r=pc(r,0,r.length-xt,xt,xt),r},HC=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>lt(gi,{children:[0,1,2].map(a=>lt("circle",{r:r*(xt-a*2)/2,cx:e+r*xt/2,cy:t+r*xt/2,fill:a%2!==0?o:n},`finder-${e}-${t}-${a}`))}),GC=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-xt)*e,0],[0,(t-xt)*e]];return lt(gi,{children:n.map(([a,i])=>lt(HC,{x:a,y:i,cellSize:e,bgColor:r,fgColor:o},`finder-${a}-${i}`))})},VC=({matrix:e,cellSize:t,color:r})=>lt(gi,{children:e.map((o,n)=>o.map((a,i)=>a?lt("circle",{r:t/2.5,cx:n*t+t/2,cy:i*t+t/2,fill:r},`circle-${n}-${i}`):lt(FC.Fragment,{},`circle-${n}-${i}`)))}),Km=(e,t)=>e-e%t,zC=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:a})=>{if(!r)return lt(gi,{});let i=o||40,l=n||4,s=r,d=e/2-i/2-l;return Ym(gi,{children:[lt("rect",{x:Km(d,t),y:Km(d,t),width:i+l*2+(d%t?t+.5:.5),height:i+l*2+(d%t?t+.5:.5),fill:a}),lt(s,{x:e/2-i/2,y:e/2-i/2,height:i,width:i})]})},qC=e=>{let t=e.outputSize,r=BC(e.url),o=t/r.length;return Ym("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[lt(VC,{matrix:r,cellSize:o,color:e.fgColor}),lt(GC,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),lt(zC,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},$C=UC.div`
|
|
1443
1443
|
display: flex;
|
|
1444
1444
|
justify-content: center;
|
|
1445
1445
|
align-items: center;
|
|
@@ -1454,7 +1454,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1454
1454
|
border-color: ${e=>e.fgColor};
|
|
1455
1455
|
border-radius: var(--privy-border-radius-md);
|
|
1456
1456
|
}
|
|
1457
|
-
`,
|
|
1457
|
+
`,En=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return lt($C,{size:o,bgColor:t,fgColor:r,children:lt(qC,{url:e.url,logo:{element:e.squareLogoElement??jm},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as ss,jsxs as jC}from"react/jsx-runtime";var yr=({style:e,...t})=>jC("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:[ss("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),ss("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"}),ss("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"}),ss("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 ls,jsx as pe,jsxs as gr}from"react/jsx-runtime";var Qm="#8a63d2",tf=1e3,ZC=tf*2,JC=tf*120,rf=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{lastScreen:n,navigate:a,navigateBack:i,setModalData:l,app:s}=A(),{getAuthFlow:d,loginWithFarcaster:u,closePrivyModal:y,createAnalyticsEvent:f}=W(),[g,E]=uc(void 0),[v,x]=uc(!1),[C,P]=uc(!1),R=KC([]),M=s?.render.inDialog?Oe:0,k=d(),B=k?.meta.connectUri;return Zm(()=>{let U=Date.now(),H=setInterval(async()=>{let T=await k.pollForReady.execute(),q=Date.now()-U;if(T){clearInterval(H),x(!0);try{await u(),P(!0)}catch(O){let Y={retryable:!1,message:"Authentication failed"};if(O?.privyErrorCode==="allowlist_rejected"){a("ALLOWLIST_REJECTION_SCREEN");return}else O?.privyErrorCode==="linked_to_another_user"?Y.detail="This account has already been linked to another user.":O?.privyErrorCode==="invalid_credentials"?(Y.retryable=!0,Y.detail="Something went wrong. Try again."):O?.privyErrorCode==="too_many_requests"&&(Y.detail="Too many requests. Please wait before trying again.");E(Y)}}else q>JC&&(clearInterval(H),E({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},ZC);return()=>{clearInterval(H),R.current.forEach(T=>clearTimeout(T))}},[]),Zm(()=>{if(r&&e&&C&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let H=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},M);return()=>clearTimeout(H)}C&&(At(o,s?.embeddedWallets.createOnLogin)?R.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:H=>{console.error(H),f("embedded_wallet_creation_failure_logout",{error:H,screen:"FarcasterConnectStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},M)):R.current.push(setTimeout(()=>y({shouldCallAuthOnSuccess:!0,isSuccess:!0}),M)))}},[C,r,e,o]),Jm||v?gr(ls,{children:[pe(S,{backFn:n?i:void 0,onClose:y},"header"),pe(K,{}),YC?pe(ls,{children:gr(QC,{children:[pe(ef,{children:gr("div",{children:[pe(It,{success:C,fail:!!g}),pe(yr,{style:{width:"38px",height:"38px"}})]})}),gr(Ye,{children:[pe(he,{children:g?g.message:"Sign in with Farcaster"}),pe(de,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),B&&pe(F,{onClick:U=>{U.preventDefault(),window.location.href=B},children:"Open Warpcast app"})]})}):pe(ls,{children:gr(Xm,{children:[pe(ef,{children:gr("div",{children:[pe(It,{success:C,fail:!!g}),pe(yr,{style:{width:"38px",height:"38px"}})]})}),gr(Ye,{children:[pe(he,{children:g?g.message:"Signing in with Farcaster"}),pe(de,{children:g?g.detail:"This should only take a moment"}),pe(at,{children:B&&Jm&&pe(as,{text:"Take me to Warpcast",url:B,color:Qm})})]})]})}),pe(X,{})]}):gr(ls,{children:[pe(S,{backFn:n?i:void 0,onClose:y},"header"),pe(K,{}),pe(Xm,{children:gr("div",{children:[pe(he,{children:"Sign in with Farcaster"}),pe(de,{children:"Scan with your phone's camera to continue."}),pe(on,{children:B?pe(En,{url:B,size:275,squareLogoElement:yr}):pe(ft,{})}),gr(at,{children:[pe(de,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),B&&pe(eo,{text:B,itemName:"link",color:Qm})]})]})}),pe(X,{})]})},Xm=mc.div`
|
|
1458
1458
|
display: flex;
|
|
1459
1459
|
flex-direction: column;
|
|
1460
1460
|
align-items: center;
|
|
@@ -1462,14 +1462,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1462
1462
|
margin-left: 27px;
|
|
1463
1463
|
margin-right: 27px;
|
|
1464
1464
|
gap: 24px;
|
|
1465
|
-
`,
|
|
1465
|
+
`,QC=mc.div`
|
|
1466
1466
|
display: flex;
|
|
1467
1467
|
flex-direction: column;
|
|
1468
1468
|
align-items: center;
|
|
1469
1469
|
justify-content: center;
|
|
1470
1470
|
gap: 24px;
|
|
1471
1471
|
width: 100%;
|
|
1472
|
-
`,
|
|
1472
|
+
`,ef=mc.div`
|
|
1473
1473
|
display: flex;
|
|
1474
1474
|
flex-direction: column;
|
|
1475
1475
|
justify-content: center;
|
|
@@ -1492,7 +1492,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1492
1492
|
left: -19px;
|
|
1493
1493
|
top: -19px;
|
|
1494
1494
|
}
|
|
1495
|
-
`;import{useEffect as
|
|
1495
|
+
`;import{useEffect as XC,useRef as e0,useState as fc}from"react";import{isIOS as t0,isMobile as of}from"react-device-detect";import hc from"styled-components";import{Fragment as cs,jsx as me,jsxs as Xt}from"react/jsx-runtime";var nf="#8a63d2",lf=1e3,r0=lf*2,o0=lf*300,cf=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=A(),{requestFarcasterSignerStatus:n,closePrivyModal:a}=W(),[i,l]=fc(void 0),[s,d]=fc(!1),[u,y]=fc(!1),f=e0([]),g=o?.render.inDialog?Oe:0,E=r?.farcasterSigner;XC(()=>{let x=Date.now(),C=setInterval(async()=>{if(!E?.public_key){clearInterval(C),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}E.status==="approved"&&(clearInterval(C),d(!1),y(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let P=await n(E?.public_key),R=Date.now()-x;P.status==="approved"?(clearInterval(C),d(!1),y(!0),f.current.push(setTimeout(()=>a({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):R>o0?(clearInterval(C),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):P.status==="revoked"&&(clearInterval(C),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},r0);return()=>{clearInterval(C),f.current.forEach(P=>clearTimeout(P))}},[]);let v=E?.status==="pending_approval"?E.signer_approval_url:void 0;return of||s?Xt(cs,{children:[me(S,{backFn:e?t:void 0,onClose:a},"header"),me(K,{}),t0?me(cs,{children:Xt(n0,{children:[me(sf,{children:Xt("div",{children:[me(It,{success:u,fail:!!i}),me(yr,{style:{width:"38px",height:"38px"}})]})}),Xt(Ye,{children:[me(he,{children:i?i.message:"Add a signer to Farcaster"}),me(de,{children:i?i.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),v&&me(F,{onClick:x=>{x.preventDefault(),window.location.href=v},children:"Open Warpcast app"})]})}):me(cs,{children:Xt(af,{children:[me(sf,{children:Xt("div",{children:[me(It,{success:u,fail:!!i}),me(yr,{style:{width:"38px",height:"38px"}})]})}),Xt(Ye,{children:[me(he,{children:i?i.message:"Requesting signer from Farcaster"}),me(de,{children:i?i.detail:"This should only take a moment"}),me(at,{children:v&&of&&me(as,{text:"Take me to Warpcast",url:v,color:nf})})]})]})}),me(X,{})]}):Xt(cs,{children:[me(S,{backFn:e?t:void 0,onClose:a},"header"),me(K,{}),me(af,{children:Xt("div",{children:[me(he,{children:"Add a signer to Farcaster"}),Xt(de,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),me(on,{children:E?.status==="pending_approval"?me(En,{url:E.signer_approval_url,size:275,squareLogoElement:yr}):me(ft,{})}),Xt(at,{children:[me(de,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),E?.status==="pending_approval"&&me(eo,{text:E.signer_approval_url,itemName:"link",color:nf})]})]})}),me(X,{})]})},af=hc.div`
|
|
1496
1496
|
display: flex;
|
|
1497
1497
|
flex-direction: column;
|
|
1498
1498
|
align-items: center;
|
|
@@ -1500,14 +1500,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1500
1500
|
margin-left: 27px;
|
|
1501
1501
|
margin-right: 27px;
|
|
1502
1502
|
gap: 24px;
|
|
1503
|
-
`,
|
|
1503
|
+
`,n0=hc.div`
|
|
1504
1504
|
display: flex;
|
|
1505
1505
|
flex-direction: column;
|
|
1506
1506
|
align-items: center;
|
|
1507
1507
|
justify-content: center;
|
|
1508
1508
|
gap: 24px;
|
|
1509
1509
|
width: 100%;
|
|
1510
|
-
`,
|
|
1510
|
+
`,sf=hc.div`
|
|
1511
1511
|
display: flex;
|
|
1512
1512
|
flex-direction: column;
|
|
1513
1513
|
justify-content: center;
|
|
@@ -1530,7 +1530,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1530
1530
|
left: -19px;
|
|
1531
1531
|
top: -19px;
|
|
1532
1532
|
}
|
|
1533
|
-
`;import
|
|
1533
|
+
`;import a0 from"@heroicons/react/24/outline/ClockIcon";import s0 from"@heroicons/react/24/outline/EyeSlashIcon";import l0 from"@heroicons/react/24/outline/LinkIcon";import vr from"styled-components";import{jsx as yc,jsxs as i0}from"react/jsx-runtime";var ds=({size:e=61,...t})=>yc("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:i0("g",{id:"moonpay_symbol_wht 2",children:[yc("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),yc("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 df,jsx as ct,jsxs as Io}from"react/jsx-runtime";var gc=({title:e,desc:t,icon:r})=>Io(f0,{children:[ct(y0,{children:r}),Io(h0,{children:[ct(u0,{children:e}),ct(m0,{children:t})]})]}),pf=({app:e,signedUrl:t,onContinue:r})=>Io(df,{children:[Io(d0,{children:[ct(ds,{size:"3.75rem"}),Io(p0,{children:[e?.name," uses ",ct("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),Io(g0,{children:[ct(gc,{icon:ct(l0,{width:"1rem"}),title:"Purchase assets to fund your account",desc:Io(df,{children:["Connect a payment method (",ct("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),ct(gc,{icon:ct(a0,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),ct(gc,{icon:ct(s0,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),ct(v0,{className:"mobile-only"})]}),ct(c0,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),ct(La,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),c0=vr.span`
|
|
1534
1534
|
display: inline-block;
|
|
1535
1535
|
color: var(--privy-color-foreground-3);
|
|
1536
1536
|
text-align: center;
|
|
@@ -1539,13 +1539,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1539
1539
|
font-weight: 400;
|
|
1540
1540
|
line-height: 140%; /* 0.875rem */
|
|
1541
1541
|
margin-bottom: 0.25rem;
|
|
1542
|
-
`,
|
|
1542
|
+
`,d0=vr.div`
|
|
1543
1543
|
display: flex;
|
|
1544
1544
|
flex-direction: column;
|
|
1545
1545
|
align-items: center;
|
|
1546
1546
|
justify-content: center;
|
|
1547
1547
|
padding: 1.5rem 0;
|
|
1548
|
-
`,
|
|
1548
|
+
`,p0=vr.span`
|
|
1549
1549
|
color: var(--privy-color-foreground);
|
|
1550
1550
|
text-align: center;
|
|
1551
1551
|
font-size: 1.125rem;
|
|
@@ -1554,46 +1554,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1554
1554
|
margin: 1.5rem 0;
|
|
1555
1555
|
text-align: center;
|
|
1556
1556
|
max-width: 19.5rem;
|
|
1557
|
-
`,
|
|
1557
|
+
`,u0=vr.span`
|
|
1558
1558
|
color: var(--privy-color-foreground);
|
|
1559
1559
|
font-size: 0.875rem;
|
|
1560
1560
|
font-weight: 500;
|
|
1561
1561
|
line-height: 1.225rem;
|
|
1562
1562
|
width: 100%;
|
|
1563
|
-
`,
|
|
1563
|
+
`,m0=vr.span`
|
|
1564
1564
|
color: var(--privy-color-foreground-2);
|
|
1565
1565
|
font-size: 0.875rem;
|
|
1566
1566
|
font-weight: 400;
|
|
1567
1567
|
line-height: 1.225rem;
|
|
1568
|
-
`,
|
|
1568
|
+
`,f0=vr.div`
|
|
1569
1569
|
display: flex;
|
|
1570
1570
|
align-items: flex-start;
|
|
1571
1571
|
gap: 0.5rem;
|
|
1572
1572
|
align-self: stretch;
|
|
1573
|
-
`,
|
|
1573
|
+
`,h0=vr.div`
|
|
1574
1574
|
display: flex;
|
|
1575
1575
|
flex-direction: column;
|
|
1576
1576
|
gap: 0.25rem;
|
|
1577
1577
|
align-items: flex-start;
|
|
1578
1578
|
text-align: left;
|
|
1579
1579
|
flex: 1 0 0;
|
|
1580
|
-
`,
|
|
1580
|
+
`,y0=vr.div`
|
|
1581
1581
|
padding-top: 2px;
|
|
1582
|
-
`,
|
|
1582
|
+
`,g0=vr.div`
|
|
1583
1583
|
display: flex;
|
|
1584
1584
|
flex-direction: column;
|
|
1585
1585
|
gap: 1.25rem;
|
|
1586
1586
|
margin: 0 0.5rem;
|
|
1587
|
-
`,
|
|
1587
|
+
`,v0=vr.div`
|
|
1588
1588
|
margin: 30px 0;
|
|
1589
|
-
`;import{ofetch as
|
|
1589
|
+
`;import{ofetch as w0}from"ofetch";import{useEffect as C0,useRef as b0,useState as E0}from"react";var ps="moonpay",uf="sdk_fiat_on_ramp_completed_with_status";async function mf(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 T0(e,t){let r=t?qd:zd,o=t?jd:$d;return w0(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function ff(e,t=!1){let[r,o]=E0(null),{createAnalyticsEvent:n}=W(),a=b0(0);return C0(()=>{let i=setInterval(async()=>{if(e)try{let[l]=await T0(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(uf,{status:s,provider:ps,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(uf,{status:"serviceFailure",provider:ps}),clearInterval(i))}},3e3);return()=>clearInterval(i)},[e,a]),r}import{Fragment as P0,jsx as vc,jsxs as x0}from"react/jsx-runtime";var hf=()=>{let{app:e,data:t,navigate:r}=A(),{createAnalyticsEvent:o}=W(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:x0(P0,{children:[vc(S,{title:"Fund account"},"header"),vc(pf,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:ps}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),vc(V,{protectedByPrivy:!0})]})};import S0 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import _0 from"@heroicons/react/24/solid/CheckCircleIcon";import A0 from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as k0}from"react";import yf from"styled-components";import{Fragment as wc,jsx as dt,jsxs as Mo}from"react/jsx-runtime";var gf=()=>{let{app:e,data:t}=A(),{closePrivyModal:r}=W(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=ff(o||null,e.fiatOnRamp.useSandbox);return Mo(wc,{children:[dt(S,{title:"Fund account"},"header"),dt(I0,{status:n,onClickCta:r}),dt(V,{protectedByPrivy:!0})]})},R0=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:Mo(wc,{children:[Mo("p",{children:["It looks like there was an issue with your payment. Please contact"," ",dt("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),dt("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:""}}},I0=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=k0(()=>R0(e),[e]);return Mo(wc,{children:[Mo(N0,{children:[dt(L0,{status:e}),Mo(Ye,{children:[dt("h3",{children:r}),dt(O0,{children:o})]})]}),n&&dt(F,{onClick:t,children:n})]})},M0=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)",W0=e=>{switch(e){case"serviceFailure":case"failed":return A0;case"completed":return _0;case"waitingAuthorization":return()=>dt(S0,{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}},L0=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return Mo("div",{style:{position:"relative"},children:[dt(ft,{color:o,style:{position:"absolute"}}),dt(kl,{color:o}),dt(ds,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=W0(e),r=M0(e);return dt("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&dt(t,{width:"4rem",height:"4rem",color:r})})},O0=yf.p`
|
|
1590
1590
|
font-size: 1rem;
|
|
1591
1591
|
color: var(--privy-color-foreground-3);
|
|
1592
1592
|
margin-bottom: 1rem;
|
|
1593
1593
|
display: flex;
|
|
1594
1594
|
flex-direction: column;
|
|
1595
1595
|
gap: 1rem;
|
|
1596
|
-
`,
|
|
1596
|
+
`,N0=yf.div`
|
|
1597
1597
|
display: flex;
|
|
1598
1598
|
flex-direction: column;
|
|
1599
1599
|
align-items: center;
|
|
@@ -1601,7 +1601,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1601
1601
|
margin-left: 1.75rem;
|
|
1602
1602
|
margin-right: 1.75rem;
|
|
1603
1603
|
padding: 2rem 0;
|
|
1604
|
-
`;import
|
|
1604
|
+
`;import D0 from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import F0 from"styled-components";import{Fragment as B0,jsx as to,jsxs as H0}from"react/jsx-runtime";var vf=()=>{let{closePrivyModal:e}=W();return H0(B0,{children:[to(S,{},"header"),to(U0,{children:to(D0,{style:{width:32,height:32}})}),to(mr,{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"}}),to(Ot,{children:to(F,{onClick:()=>e(),children:"Close"})}),to(oe,{}),to(V,{protectedByPrivy:!0})]})},U0=F0.div`
|
|
1605
1605
|
border-radius: 50%;
|
|
1606
1606
|
height: 68px;
|
|
1607
1607
|
width: 68px;
|
|
@@ -1611,18 +1611,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1611
1611
|
background-color: var(--privy-color-accent);
|
|
1612
1612
|
color: white;
|
|
1613
1613
|
margin: 0 auto 24px auto;
|
|
1614
|
-
`;import*as
|
|
1614
|
+
`;import*as Ef from"react-device-detect";import q0 from"styled-components";import Cc from"styled-components";import{jsx as wf}from"react/jsx-runtime";var Cf=({style:e,...t})=>wf("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:wf("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 V0,jsxs as z0}from"react/jsx-runtime";var bf=Cc.div`
|
|
1615
1615
|
display: flex;
|
|
1616
1616
|
flex-direction: column;
|
|
1617
1617
|
justify-content: flex-start;
|
|
1618
1618
|
gap: 4px;
|
|
1619
|
-
`,
|
|
1619
|
+
`,bc=Cc.div`
|
|
1620
1620
|
&&& {
|
|
1621
1621
|
margin-left: 7px; /* TODO: This is a total hack */
|
|
1622
1622
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1623
1623
|
height: 12px;
|
|
1624
1624
|
}
|
|
1625
|
-
`,
|
|
1625
|
+
`,us=({children:e})=>z0(G0,{children:[V0(Cf,{style:{width:"16px",height:"16px"}}),e]}),G0=Cc.div`
|
|
1626
1626
|
display: flex;
|
|
1627
1627
|
justify-content: flex-start;
|
|
1628
1628
|
justify-items: center;
|
|
@@ -1640,15 +1640,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1640
1640
|
margin-bottom: auto;
|
|
1641
1641
|
}
|
|
1642
1642
|
}
|
|
1643
|
-
`;import{Fragment as
|
|
1643
|
+
`;import{Fragment as K0,jsx as Ue,jsxs as vi}from"react/jsx-runtime";var $0=()=>vi(j0,{children:[Ue(oi,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),Ue(at,{children:Ue(lr,{style:{width:"152px",height:"152px"}})}),vi(bf,{children:[Ue(us,{children:vi("div",{children:[Ue("span",{children:"Install the "}),Ue("a",{href:Ef.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"})]})}),Ue(bc,{}),Ue(us,{children:"Set up your first wallet"}),Ue(bc,{}),Ue(us,{children:"Store your recovery phrase in a safe place!"})]}),Ue(Oa,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Tf=()=>{let{navigateBack:e}=A();return vi(K0,{children:[Ue(S,{backFn:e},"header"),Ue(K,{}),Ue($0,{}),Ue(oe,{}),vi(X,{children:[Ue("span",{children:"Still not sure? "}),Ue("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},j0=q0(at)`
|
|
1644
1644
|
gap: 30px;
|
|
1645
1645
|
|
|
1646
1646
|
> :first-child > svg {
|
|
1647
1647
|
margin-top: 20px;
|
|
1648
1648
|
}
|
|
1649
|
-
`;import
|
|
1649
|
+
`;import R2 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as I2,useState as Bf}from"react";import{isMobile as M2}from"react-device-detect";import W2 from"styled-components";import e2 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as t2}from"react";import Y0 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as Z0,useState as Pf}from"react";import Sf from"styled-components";import{Fragment as X0,jsx as wi,jsxs as xf}from"react/jsx-runtime";var ms=Z0((e,t)=>{let[r,o]=Pf(""),[n,a]=Pf(!1),{authenticated:i}=G(),{initLoginWithEmail:l}=W(),{navigate:s,setModalData:d,currentScreen:u}=A(),{enabled:y,token:f}=fe(),g=Qi(r),E=n,v=n||!g,x=P=>{a(!0),l(r,P).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(R=>{d({errorModalData:{error:R,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{a(!1)})},C=()=>{y&&!f&&!i?(d({captchaModalData:{callback:P=>l(r,P),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):x(f)};return xf(X0,{children:[wi(J0,{children:xf(Q0,{stacked:e.stacked,children:[wi(Y0,{}),wi("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:P=>o(P.target.value),onKeyUp:P=>{P.key==="Enter"&&C()},value:r,autoComplete:"email"}),e.stacked?null:wi(Xo,{isSubmitting:E,onClick:C,disabled:v,children:"Submit"})]})}),e.stacked?wi(F,{loadingText:null,loading:E,disabled:v,onClick:C,children:"Submit"}):null]})}),J0=Sf.div`
|
|
1650
1650
|
width: 100%;
|
|
1651
|
-
`,
|
|
1651
|
+
`,Q0=Sf.label`
|
|
1652
1652
|
display: block;
|
|
1653
1653
|
position: relative;
|
|
1654
1654
|
width: 100%;
|
|
@@ -1709,9 +1709,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1709
1709
|
&& > input::placeholder {
|
|
1710
1710
|
color: var(--privy-color-foreground-3);
|
|
1711
1711
|
}
|
|
1712
|
-
`;import{Fragment as
|
|
1712
|
+
`;import{Fragment as r2,jsx as fs,jsxs as _f}from"react/jsx-runtime";var hs=({isEditable:e,setIsEditable:t})=>{let r=t2(null);return _f(r2,{children:[fs(Ar,{if:!e,children:fs(ms,{ref:r})}),fs(Ar,{if:e,children:_f(we,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[fs(e2,{})," Continue with Email"]})})]})};import{useState as o2}from"react";import{jsx as Ec,jsxs as n2}from"react/jsx-runtime";var ys=()=>{let[e,t]=o2(!1),{currentScreen:r,navigate:o,setModalData:n}=A(),{enabled:a,token:i}=fe(),{initLoginWithFarcaster:l}=W();return n2(we,{onClick:async()=>{t(!0);try{a&&!i?(n({captchaModalData:{callback:d=>l(d),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(i),o("AWAITING_FARCASTER_CONNECTION"))}catch(d){n({errorModalData:{error:d,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[Ec(yr,{})," Farcaster",e&&Ec("span",{children:Ec(To,{})})]})};import g2 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as v2}from"react";import{forwardRef as m2,useState as Tc}from"react";import Wf from"styled-components";import i2 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as a2,AsYouType as s2,getCountries as l2,getCountryCallingCode as gs,getExampleNumber as c2}from"libphonenumber-js/min";import{jsx as u2,jsxs as p2}from"react/jsx-runtime";var Ci=(e,t)=>a2(String(e),t),vs=(e,t)=>`+${gs(t)} ${e}`,Af=e=>`*${e.replaceAll("-","").slice(-4)}`,kf=e=>new s2(e),d2=l2().map(e=>({code:e,callCode:gs(e)})),Rf=e=>{let t=c2(e,i2)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},If=({value:e,onChange:t})=>u2("select",{value:e,onChange:t,children:d2.map(r=>p2("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as y2,jsx as bi,jsxs as Mf}from"react/jsx-runtime";var Tn=m2((e,t)=>{let{app:r}=A(),[o,n]=Tc(""),[a,i]=Tc(r?.intl.defaultCountry??"US"),l=Ci(o,a),s=kf(a),d=Rf(a),u=gs(a),y=!l,[f,g]=Tc(!1),E=u.length,v=P=>{let R=P.target.value;i(R),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:vs(o,R),countryCode:R,isValid:Ci(o,a)})},x=P=>{try{let R=P.replace(/\D/g,""),M=o.replace(/\D/g,""),k=R===M?P:s.input(P);n(k),e.onChange&&e.onChange({rawPhoneNumber:k,qualifiedPhoneNumber:vs(P,a),countryCode:a,isValid:Ci(P,a)})}catch(R){console.error("Error processing phone number:",R)}},C=()=>{g(!0);let P=vs(o,a);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:P,countryCode:a,isValid:Ci(o,a)}).finally(()=>g(!1))};return Mf(y2,{children:[bi(f2,{children:Mf(h2,{callingCodeLength:E,stacked:e.stacked,children:[bi(If,{value:a,onChange:v}),bi("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:d,onChange:P=>{x(P.target.value)},onKeyUp:P=>{P.key==="Enter"&&C()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?bi(Xo,{isSubmitting:f,onClick:C,disabled:y,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?bi(F,{loading:f,loadingText:null,onClick:C,disabled:y,children:"Submit"}):null]})}),f2=Wf.div`
|
|
1713
1713
|
width: 100%;
|
|
1714
|
-
`,
|
|
1714
|
+
`,h2=Wf.label`
|
|
1715
1715
|
--country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
|
|
1716
1716
|
--phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
|
|
1717
1717
|
display: block;
|
|
@@ -1800,11 +1800,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1800
1800
|
&& > input::placeholder {
|
|
1801
1801
|
color: var(--privy-color-foreground-3);
|
|
1802
1802
|
}
|
|
1803
|
-
`;import{Fragment as u2,jsx as gs,jsxs as If}from"react/jsx-runtime";var vs=({isEditable:e,setIsEditable:t})=>{let r=p2(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=_(),{initLoginWithSms:l}=W(),{enabled:s,token:d}=fe();async function u({qualifiedPhoneNumber:y}){if(s&&!d&&!o)a({captchaModalData:{callback:f=>l(y,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(y,d),n("AWAITING_PASSWORDLESS_CODE")}catch(f){a({errorModalData:{error:f,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return If(u2,{children:[gs(Ar,{if:!e,children:gs(En,{ref:r,onSubmit:u})}),gs(Ar,{if:e,children:If(Se,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[gs(d2,{})," Continue with SMS"]})})]})};import{useState as v2}from"react";import{jsx as Mf,jsxs as m2}from"react/jsx-runtime";var ws=({style:e,...t})=>m2("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:[Mf("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"}),Mf("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 Ci,jsxs as f2}from"react/jsx-runtime";var Cs=({style:e,...t})=>f2("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:[Ci("g",{clipPath:"url(#clip0)",children:Ci("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"})}),Ci("defs",{children:Ci("clipPath",{id:"clip0",children:Ci("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Wf}from"react/jsx-runtime";var bs=({style:e,...t})=>Wf("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:Wf("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 Es,jsxs as h2}from"react/jsx-runtime";var Ts=({style:e,...t})=>h2("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:[Es("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"}),Es("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"}),Es("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"}),Es("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 Ps}from"react/jsx-runtime";function xs({style:e,...t}){return Ps("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:Ps("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Ps("g",{transform:"scale(5.12,5.12)",children:Ps("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 Lf,jsxs as y2}from"react/jsx-runtime";function Ss(e){return y2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Lf("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"}),Lf("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 bc,jsxs as g2}from"react/jsx-runtime";function _s(e){return g2("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:[bc("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"}),bc("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"}),bc("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 Of}from"react/jsx-runtime";var As=({style:e,...t})=>Of("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:Of("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 to,jsxs as C2}from"react/jsx-runtime";var w2={apple:{logo:to(ws,{}),displayName:"Apple"},discord:{logo:to(Cs,{}),displayName:"Discord"},github:{logo:to(bs,{}),displayName:"GitHub"},google:{logo:to(Ts,{}),displayName:"Google"},linkedin:{logo:to(xs,{}),displayName:"LinkedIn"},spotify:{logo:to(Ss,{}),displayName:"Spotify"},twitter:{logo:to(As,{}),displayName:"Twitter"},tiktok:{logo:to(_s,{}),displayName:"TikTok"}},Be=({provider:e})=>{let{enabled:t,token:r}=fe(),{navigate:o,setModalData:n}=_(),[a,i]=v2(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:d}=w2[e];return C2(Se,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:y=>l(e,y),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[d," ",s]})};import b2 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Nf,jsxs as E2}from"react/jsx-runtime";var ks=({onClick:e,text:t,icon:r})=>E2(Se,{onClick:e,children:[r,Nf(Oa,{children:t}),Nf(b2,{})]});import{Fragment as Ec,jsx as He,jsxs as Is}from"react/jsx-runtime";var Ms=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],[s,d]=Df("default"),[u,y]=Df("email");P2(()=>{let k=l.indexOf("sms"),B=l.indexOf("email");k>-1&&k<B&&y("sms")},[a,i]);let f=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{d("default")},150)};n.current=f;let g=k=>k==="email"?He(ms,{isEditable:u==="email",setIsEditable:()=>{y("email")}},k):k==="sms"?He(vs,{isEditable:u==="sms",setIsEditable:()=>{y("sms")}},k):k==="apple"?He(Be,{provider:"apple"},k):k==="discord"?He(Be,{provider:"discord"},k):k==="farcaster"?He(fs,{},k):k==="github"?He(Be,{provider:"github"},k):k==="google"?He(Be,{provider:"google"},k):k==="linkedin"?He(Be,{provider:"linkedin"},k):k==="tiktok"?He(Be,{provider:"tiktok"},k):k==="twitter"&&(!x2||o?.loginConfig.twitterOAuthOnMobileEnabled)?He(Be,{provider:"twitter"},k):ii([k],r,e,l),E=a.map(g).flat(),v=i.map(g).flat(),x=[...E,...v],C=_2({primary:E.length,overflow:v.length}),[P,R]=jd(x,C);return Is(Ec,{children:[He(A,{title:"Log in or sign up",onClose:f,backFn:s==="default"?void 0:()=>{d("default")}}),s==="default"&&He(A2,{}),He(Na,{style:{overflow:"hidden",padding:2},children:Is(Lt,{children:[s==="default"&&Is(Ec,{children:[...P,R.length>0&&He(ks,{text:"More options",icon:He(T2,{}),onClick:()=>d("overflow")})]}),s==="overflow"&&Is(Ec,{children:[...R]})]})}),o&&He(Xo,{app:o}),He(V,{protectedByPrivy:!0})]})},Rs=5,_2=({primary:e,overflow:t})=>e<Rs?e:e===Rs&&t===0?Rs:Rs-1,A2=S2(cn)`
|
|
1803
|
+
`;import{Fragment as w2,jsx as ws,jsxs as Lf}from"react/jsx-runtime";var Cs=({isEditable:e,setIsEditable:t})=>{let r=v2(null),{authenticated:o}=G(),{navigate:n,setModalData:a,currentScreen:i}=A(),{initLoginWithSms:l}=W(),{enabled:s,token:d}=fe();async function u({qualifiedPhoneNumber:y}){if(s&&!d&&!o)a({captchaModalData:{callback:f=>l(y,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(y,d),n("AWAITING_PASSWORDLESS_CODE")}catch(f){a({errorModalData:{error:f,previousScreen:i||"LANDING"}}),n("ERROR_SCREEN")}}return Lf(w2,{children:[ws(Ar,{if:!e,children:ws(Tn,{ref:r,onSubmit:u})}),ws(Ar,{if:e,children:Lf(we,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[ws(g2,{})," Continue with SMS"]})})]})};import{useState as x2}from"react";import{jsx as Of,jsxs as C2}from"react/jsx-runtime";var bs=({style:e,...t})=>C2("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:[Of("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"}),Of("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 Ei,jsxs as b2}from"react/jsx-runtime";var Es=({style:e,...t})=>b2("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:[Ei("g",{clipPath:"url(#clip0)",children:Ei("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"})}),Ei("defs",{children:Ei("clipPath",{id:"clip0",children:Ei("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Nf}from"react/jsx-runtime";var Ts=({style:e,...t})=>Nf("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:Nf("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 Ps,jsxs as E2}from"react/jsx-runtime";var xs=({style:e,...t})=>E2("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:[Ps("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"}),Ps("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"}),Ps("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"}),Ps("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 Ss}from"react/jsx-runtime";function _s({style:e,...t}){return Ss("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:Ss("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Ss("g",{transform:"scale(5.12,5.12)",children:Ss("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 Df,jsxs as T2}from"react/jsx-runtime";function As(e){return T2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Df("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"}),Df("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 Pc,jsxs as P2}from"react/jsx-runtime";function ks(e){return P2("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:[Pc("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"}),Pc("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"}),Pc("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 Ff}from"react/jsx-runtime";var Rs=({style:e,...t})=>Ff("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:Ff("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 ro,jsxs as _2}from"react/jsx-runtime";var S2={apple:{logo:ro(bs,{}),displayName:"Apple"},discord:{logo:ro(Es,{}),displayName:"Discord"},github:{logo:ro(Ts,{}),displayName:"GitHub"},google:{logo:ro(xs,{}),displayName:"Google"},linkedin:{logo:ro(_s,{}),displayName:"LinkedIn"},spotify:{logo:ro(As,{}),displayName:"Spotify"},twitter:{logo:ro(Rs,{}),displayName:"Twitter"},tiktok:{logo:ro(ks,{}),displayName:"TikTok"}},Be=({provider:e})=>{let{enabled:t,token:r}=fe(),{navigate:o,setModalData:n}=A(),[a,i]=x2(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:d}=S2[e];return _2(we,{onClick:()=>{i(!0),t&&!r?(n({captchaModalData:{callback:y=>l(e,y),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:a,children:[d," ",s]})};import A2 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Uf,jsxs as k2}from"react/jsx-runtime";var Is=({onClick:e,text:t,icon:r})=>k2(we,{onClick:e,children:[r,Uf(Da,{children:t}),Uf(A2,{})]});import{Fragment as xc,jsx as He,jsxs as Ws}from"react/jsx-runtime";var Ls=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),a=o.loginMethodsAndOrder?.primary??[],i=o.loginMethodsAndOrder?.overflow??[],l=[...a,...i],[s,d]=Bf("default"),[u,y]=Bf("email");I2(()=>{let k=l.indexOf("sms"),B=l.indexOf("email");k>-1&&k<B&&y("sms")},[a,i]);let f=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{d("default")},150)};n.current=f;let g=k=>k==="email"?He(hs,{isEditable:u==="email",setIsEditable:()=>{y("email")}},k):k==="sms"?He(Cs,{isEditable:u==="sms",setIsEditable:()=>{y("sms")}},k):k==="apple"?He(Be,{provider:"apple"},k):k==="discord"?He(Be,{provider:"discord"},k):k==="farcaster"?He(ys,{},k):k==="github"?He(Be,{provider:"github"},k):k==="google"?He(Be,{provider:"google"},k):k==="linkedin"?He(Be,{provider:"linkedin"},k):k==="tiktok"?He(Be,{provider:"tiktok"},k):k==="twitter"&&(!M2||o?.loginConfig.twitterOAuthOnMobileEnabled)?He(Be,{provider:"twitter"},k):si([k],r,e,l),E=a.map(g).flat(),v=i.map(g).flat(),x=[...E,...v],C=L2({primary:E.length,overflow:v.length}),[P,R]=Zd(x,C);return Ws(xc,{children:[He(S,{title:"Log in or sign up",onClose:f,backFn:s==="default"?void 0:()=>{d("default")}}),s==="default"&&He(O2,{}),He(Fa,{style:{overflow:"hidden",padding:2},children:Ws(Lt,{children:[s==="default"&&Ws(xc,{children:[...P,R.length>0&&He(Is,{text:"More options",icon:He(R2,{}),onClick:()=>d("overflow")})]}),s==="overflow"&&Ws(xc,{children:[...R]})]})}),o&&He(en,{app:o}),He(V,{protectedByPrivy:!0})]})},Ms=5,L2=({primary:e,overflow:t})=>e<Ms?e:e===Ms&&t===0?Ms:Ms-1,O2=W2(dn)`
|
|
1804
1804
|
margin-bottom: 16px;
|
|
1805
|
-
`;import
|
|
1805
|
+
`;import U2 from"@heroicons/react/24/outline/EnvelopeIcon";import B2 from"@heroicons/react/24/outline/PhoneIcon";import H2 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as G2,useState as zf}from"react";import{isMobile as V2}from"react-device-detect";import z2 from"styled-components";import{jsx as Ti,jsxs as Hf}from"react/jsx-runtime";var Gf=({...e})=>Hf("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[Hf("g",{clipPath:"url(#clip0_2856_1743)",children:[Ti("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"}),Ti("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"})]}),Ti("defs",{children:Ti("clipPath",{id:"clip0_2856_1743",children:Ti("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import N2 from"@heroicons/react/24/outline/ChevronRightIcon";import D2 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Sc,jsxs as F2}from"react/jsx-runtime";var Vf=({onClick:e,text:t})=>F2(we,{onClick:e,children:[Sc(D2,{}),Sc(Da,{children:t}),Sc(N2,{})]});import{Fragment as Pi,jsx as xe,jsxs as Pn}from"react/jsx-runtime";var Os=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=A(),{email:a,sms:i,google:l,twitter:s,discord:d,github:u,spotify:y,tiktok:f,linkedin:g,apple:E,wallet:v,farcaster:x}=o?.loginMethods??{},C=o?.appearance.loginGroupPriority||"web2-first",P=o?.appearance.hideDirectWeb2Inputs,[R,M]=zf("default"),[k,B]=zf(a?"email":"sms");G2(()=>{B(a?"email":"sms")},[a]);let U=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{M("default")},150)};n.current=U;let H=[a&&xe(hs,{isEditable:k==="email",setIsEditable:()=>{B("email")}}),i&&xe(Cs,{isEditable:k==="sms",setIsEditable:()=>{B("sms")}})].filter(Boolean),T=[l&&xe(Be,{provider:"google"}),s&&(!V2||o?.loginConfig.twitterOAuthOnMobileEnabled)&&xe(Be,{provider:"twitter"}),d&&xe(Be,{provider:"discord"}),u&&xe(Be,{provider:"github"}),y&&xe(Be,{provider:"spotify"}),f&&xe(Be,{provider:"tiktok"}),g&&xe(Be,{provider:"linkedin"}),E&&xe(Be,{provider:"apple"}),x&&xe(ys,{})].filter(Boolean),q=si(o.appearance.walletList,r,e,o.appearance.walletList),O=R==="default"?void 0:()=>{M("default")},Y=$2({priority:C,email:a,sms:i,social:T}),se=j2({priority:C,email:a,sms:i,social:T}),re=K2({priority:C,email:a,sms:i,social:T}),te=xe(Vf,{text:re,onClick:()=>M("web3-overflow")}),z=xe(Is,{text:Y,icon:se,onClick:()=>M("web2-overflow")}),Se=P?0:1;return Pn(Pi,{children:[xe(S,{title:"Log in or sign up",onClose:U,backFn:O}),R==="default"&&xe(q2,{}),xe(Fa,{style:{overflow:"hidden",padding:2},children:Pn(Lt,{children:[R==="default"&&C==="web2-first"&&Pn(Pi,{children:[...H,...T.length+H.length>4?T.slice(0,3-H.length):T,H.length+T.length>4&&z,v&&te]}),R==="default"&&C==="web3-first"&&Pn(Pi,{children:[v&&Pn(Pi,{children:[...q.length>4?q.slice(0,3):q,q.length>4&&te]}),H.length+T.length>Se&&z,H.length+T.length===Se&&H.length?H[0]:null,H.length+T.length===Se&&T.length?T[0]:null]}),R==="web2-overflow"&&Pn(Pi,{children:[...C==="web3-first"?H:[],...T]}),...R==="web3-overflow"?q:[]]})}),o&&xe(en,{app:o}),xe(V,{protectedByPrivy:!0})]})},q2=z2(dn)`
|
|
1806
1806
|
margin-bottom: 16px;
|
|
1807
|
-
|
|
1807
|
+
`,$2=({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",j2=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?xe(H2,{}):t&&r?xe(Gf,{}):t?xe(U2,{}):r?xe(B2,{}):null,K2=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as qf}from"react/jsx-runtime";var $f=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?qf(Ls,{connectOnly:!0}):qf(Os,{connectOnly:!0})};import{jsx as jf}from"react/jsx-runtime";var Kf=()=>{let{app:e}=A();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?jf(Ls,{connectOnly:!1}):jf(Os,{connectOnly:!1})};import Y2 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as Z2,jsx as oo,jsxs as J2}from"react/jsx-runtime";var Yf=()=>{let{app:e}=A();return J2(Z2,{children:[oo(S,{},"header"),oo(K,{}),oo(Te,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:oo(Y2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),oo(Ot,{children:oo(ms,{stacked:!0})}),oo(oe,{}),oo(V,{protectedByPrivy:!0})]})};import Q2 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as X2,jsx as no,jsxs as e3}from"react/jsx-runtime";var Zf=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=A(),{initLoginWithSms:a}=W();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 e3(X2,{children:[no(S,{},"header"),no(K,{}),no(Te,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:no(Q2,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),no(Ot,{children:no(Tn,{stacked:!0,onSubmit:i})}),no(oe,{}),no(V,{protectedByPrivy:!0})]})};import{Fragment as t3,jsx as xi,jsxs as r3}from"react/jsx-runtime";var Jf=()=>{let{linkingHint:e}=W(),{app:t}=A(),r=e?`Select the wallet with ${Hr(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return r3(t3,{children:[xi(S,{},"header"),xi(mr,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),xi(Lt,{children:xi(cn,{connectOnly:!1})}),xi(V,{protectedByPrivy:!0})]})};import{jsx as Qf,jsxs as o3}from"react/jsx-runtime";var Xf=({style:e,...t})=>o3("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:[Qf("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Qf("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 n3,jsx as io,jsxs as eh}from"react/jsx-runtime";var th=()=>{let{closePrivyModal:e}=W(),{navigate:t}=A();return eh(n3,{children:[io(S,{},"header"),io(K,{}),io(Xf,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),io(mr,{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"}}),eh(Ot,{children:[io(F,{onClick:()=>t("LANDING"),children:"Try again"}),io($t,{onClick:()=>e(),children:"Cancel"})]}),io(oe,{}),io(V,{protectedByPrivy:!0})]})};import dh from"@heroicons/react/20/solid/CheckIcon";import x3 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import S3 from"@heroicons/react/24/outline/FingerPrintIcon";import _3 from"@heroicons/react/24/outline/PhoneIcon";import ph from"@heroicons/react/24/outline/TrashIcon";import A3 from"@heroicons/react/24/solid/CheckBadgeIcon";import uh from"@heroicons/react/24/solid/CheckCircleIcon";import mh from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import k3 from"@heroicons/react/24/solid/IdentificationIcon";import Mc from"@heroicons/react/24/solid/PhoneIcon";import Ic from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as fh,useState as Wr}from"react";import{useState as kc}from"react";import{isMobile as d3}from"react-device-detect";import ah from"styled-components";import{Dialog as rh,Transition as _c}from"@headlessui/react";import Ac from"react";import Sn from"styled-components";import{jsx as xn,jsxs as c3}from"react/jsx-runtime";var oh=({children:e,open:t,onClick:r,...o})=>xn(_c,{show:t,as:Ac.Fragment,children:c3(rh,{onClose:r,...o,as:a3,children:[xn(_c.Child,{as:Ac.Fragment,enterFrom:"entering",leaveTo:"leaving",children:xn(i3,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),xn(s3,{children:xn(_c.Child,{as:Ac.Fragment,enterFrom:"entering",leaveTo:"leaving",children:xn(rh.Panel,{as:l3,children:e})})})]})}),_n=Sn.div`
|
|
1808
1808
|
display: flex;
|
|
1809
1809
|
flex-direction: column;
|
|
1810
1810
|
text-align: center;
|
|
@@ -1827,7 +1827,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1827
1827
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1828
1828
|
border-radius: var(--privy-border-radius-lg);
|
|
1829
1829
|
}
|
|
1830
|
-
`,
|
|
1830
|
+
`,i3=Sn.div`
|
|
1831
1831
|
position: fixed;
|
|
1832
1832
|
inset: 0;
|
|
1833
1833
|
|
|
@@ -1840,10 +1840,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1840
1840
|
backdrop-filter: unset;
|
|
1841
1841
|
-webkit-backdrop-filter: unset;
|
|
1842
1842
|
}
|
|
1843
|
-
`,
|
|
1843
|
+
`,a3=Sn.div`
|
|
1844
1844
|
position: relative;
|
|
1845
1845
|
z-index: 999999;
|
|
1846
|
-
`,
|
|
1846
|
+
`,s3=Sn.div`
|
|
1847
1847
|
position: fixed;
|
|
1848
1848
|
inset: 0;
|
|
1849
1849
|
display: flex;
|
|
@@ -1851,7 +1851,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1851
1851
|
justify-content: center;
|
|
1852
1852
|
width: 100vw;
|
|
1853
1853
|
min-height: 100vh;
|
|
1854
|
-
`,
|
|
1854
|
+
`,l3=Sn.div`
|
|
1855
1855
|
// reset some default dialog styles
|
|
1856
1856
|
padding: 0;
|
|
1857
1857
|
background: transparent;
|
|
@@ -1898,19 +1898,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1898
1898
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1899
1899
|
border-radius: var(--privy-border-radius-lg);
|
|
1900
1900
|
}
|
|
1901
|
-
`,
|
|
1901
|
+
`,nh=Sn.div`
|
|
1902
1902
|
display: flex;
|
|
1903
1903
|
flex-direction: column;
|
|
1904
1904
|
align-items: center;
|
|
1905
1905
|
justify-content: center;
|
|
1906
1906
|
height: 100%;
|
|
1907
|
-
`;import{Fragment as
|
|
1907
|
+
`;import{Fragment as g3,jsx as Si,jsxs as y3}from"react/jsx-runtime";var _i=6,p3=new Array(_i).fill("");function u3(e){return e.replace(/\s+/g,"")}function Rc(e){return/^[0-9]{1}$/.test(e)}function ih(e){return e.length===_i&&e.every(Rc)}function m3(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var An=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,a]=kc(p3),[i,l]=kc(null),[s,d]=kc(null),u=async E=>{E.preventDefault();let v=u3(E.currentTarget.value);if(v==="")return;let x=m3(n,Rc),C=v.split(""),P=!C.every(Rc),R=C.length+x>_i;if(P){l("Passcode can only be numbers"),d(1);return}if(R){l("Passcode must be exactly 6 numbers"),d(1);return}l(null),d(null);let M=Number(E.currentTarget.name?.charAt(4)),k=[...v||[""]].slice(0,_i-M),B=[...n.slice(0,M),...k,...n.slice(M+k.length)];a(B);let U=k.length,H=Math.min(Math.max(M+U,0),_i-1);if(document.querySelector(`input[name=pin-${H}]`)?.focus(),ih(B))try{await e(B.join("")),document.querySelector(`input[name=pin-${H}]`)?.blur()}catch(q){d(1),l(q.message)}else try{await e(null)}catch(q){d(1),l(q.message)}},y=E=>{s===1&&(l(null),d(null));let v=[...n.slice(0,E),"",...n.slice(E+1)];a(v),E>0&&document.querySelector(`input[name=pin-${E-1}]`)?.focus(),ih(v)?e(v.join("")):e(null)},g=o?"success":!!(r||i)?"fail":"";return Si(g3,{children:y3(f3,{children:[Si("div",{children:n.map((E,v)=>Si("input",{name:`pin-${v}`,type:"text",value:n[v],onChange:u,onKeyUp:x=>{x.key==="Backspace"&&y(v)},inputMode:"numeric",autoFocus:v===0,pattern:"[0-9]",className:g,autoComplete:d3?"one-time-code":"off",disabled:t},v))}),Si("div",{children:Si(h3,{fail:!!r||!!i,children:r||i})})]})})},f3=ah.div`
|
|
1908
1908
|
display: flex;
|
|
1909
1909
|
flex-direction: column;
|
|
1910
1910
|
width: 100%;
|
|
1911
1911
|
gap: 8px;
|
|
1912
1912
|
|
|
1913
|
-
${
|
|
1913
|
+
${_n}[data-height='medium'] & {
|
|
1914
1914
|
margin-top: 22px;
|
|
1915
1915
|
}
|
|
1916
1916
|
|
|
@@ -1975,7 +1975,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1975
1975
|
transform: translate(1px, 0px);
|
|
1976
1976
|
}
|
|
1977
1977
|
}
|
|
1978
|
-
`,
|
|
1978
|
+
`,h3=ah.div`
|
|
1979
1979
|
line-height: 20px;
|
|
1980
1980
|
font-size: 13px;
|
|
1981
1981
|
display: flex;
|
|
@@ -1983,7 +1983,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1983
1983
|
width: 100%;
|
|
1984
1984
|
|
|
1985
1985
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1986
|
-
`;import{useContext as
|
|
1986
|
+
`;import{useContext as v3}from"react";function kn(){let{promptMfa:e,init:t,submit:r,cancel:o}=v3(ce);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as w3}from"react";function Ai(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenroll:n,enrollInMfa:a}=w3(ce);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>a(!0),closeMfaEnrollmentModal:()=>a(!1)}}import C3 from"styled-components";import{jsx as sh,jsxs as E3}from"react/jsx-runtime";var lh=e=>E3(b3,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[sh("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),sh("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"})]}),b3=C3.svg`
|
|
1987
1987
|
height: 90px;
|
|
1988
1988
|
width: 90px;
|
|
1989
1989
|
|
|
@@ -1994,7 +1994,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1994
1994
|
> path {
|
|
1995
1995
|
fill: white;
|
|
1996
1996
|
}
|
|
1997
|
-
`;import
|
|
1997
|
+
`;import T3 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as P3}from"react/jsx-runtime";var ch=({size:e,authUrl:t})=>P3(En,{url:t,squareLogoElement:T3,size:e,fgColor:"#1F1F1F"});import{Fragment as Dt,jsx as w,jsxs as ne}from"react/jsx-runtime";var hh=()=>{let{user:e,enrollInMfa:t}=G(),[r,o]=Wr(null),{unenrollWithSms:n,unenrollWithTotp:a}=Ai(),{app:i,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:d}=A(),{closePrivyModal:u}=W(),{promptMfa:y}=kn(),[f,g]=Wr(s?.mfaEnrollmentFlow?.seenIntro||!1),[E,v]=Wr(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),x=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),v(null)},500)};d.current=x;let C=e?.mfaMethods.includes("sms"),P=!!e?.phone,R=e?.mfaMethods.includes("totp"),M=C||R;fh(()=>{M&&g(!0)},[M]);function k(){o(null),v(null)}function B(){g(!1)}async function U(O){await y(),v(O)}if(!l||!e||!i)return ne(Dt,{children:[w(S,{onClose:x},"header"),w(Ke,{children:w(lh,{})}),w($r,{children:w(ft,{})}),w(X,{})]});async function H(){o(null);try{await n()}catch{o(null)}}async function T(){o(null);try{await a()}catch{o(null)}}if(r==="sms")return ne(Dt,{children:[w(S,{backFn:k,onClose:x},"header"),w(Ke,{children:w(it,{children:w(Mc,{})})}),w(he,{children:"Remove SMS verification?"}),ne(de,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),w(jr,{children:w(F,{warn:!0,onClick:H,children:"Remove SMS for MFA"})}),w(X,{})]});if(r==="totp")return ne(Dt,{children:[w(S,{backFn:k,onClose:x},"header"),w(Ke,{children:w(it,{children:w(mh,{})})}),w(he,{children:"Remove Authenticator App verification?"}),ne(de,{children:["MFA adds an extra layer of security to your ",i?.name," account. Make sure you have other methods to secure your account."]}),w(jr,{children:w(F,{warn:!0,onClick:T,children:"Remove Authenticator App for MFA"})}),w(X,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!M)return ne(Dt,{children:[w(S,{onClose:x},"header"),w(Ke,{children:w(it,{children:w(Ic,{})})}),w(he,{children:"Add more security"}),ne(de,{children:[i?.name," does not have any verification methods enabled."]}),w(jr,{children:w(F,{onClick:x,children:"Close"})}),w(X,{})]});let q=!M&&!f;if(q)return ne(Dt,{children:[w(S,{onClose:x},"header"),w(Ke,{children:w(it,{children:w(Ic,{})})}),w(he,{children:"Transaction Protection"}),w(de,{children:"Set up transaction protection to add an extra layer of security to your account"}),ne(hu,{children:[ne(Ol,{children:[w(Ll,{children:w(A3,{})}),"Enable 2-Step verification for your ",i?.name," wallet."]}),ne(Ol,{children:[w(Ll,{children:w(k3,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),ne(jr,{children:[w(F,{onClick:()=>g(!0),children:"Continue"}),w($t,{onClick:x,children:"Not now"})]}),w(X,{})]});switch(E){case"sms":return w(R3,{onComplete:x,onReset:k,onClose:x});case"totp":return w(I3,{onComplete:x,onClose:x,onReset:k});default:return ne(Dt,{children:[w(S,{backFn:q?B:void 0,onClose:x},"header"),w(Ke,{children:w(it,{children:w(Ic,{})})}),w(he,{children:"Choose a verification method"}),M?w(de,{children:"To add or delete verification methods, verification is required."}):w(de,{children:"How would you like to verify your identity? You can change this later."}),ne(Ua,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||R)&&ne(Ba,{children:[w(we,{disabled:R,onClick:()=>U("totp"),children:ne(Ga,{children:[ne(Ha,{children:[w(x3,{}),"Authenticator App"]}),R?ne(rn,{children:[w(dh,{}),"Added"]}):w(rn,{children:"Recommended"})]})}),R&&w(Nl,{id:"remove",onClick:()=>o("totp"),children:w(ph,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||C)&&ne(Ba,{children:[w(we,{disabled:C||P,onClick:()=>U("sms"),children:ne(Ga,{children:[ne(Ha,{children:[w(_3,{}),"SMS"]}),C&&ne(rn,{children:[w(dh,{}),"Added"]}),P&&w(rn,{children:"Disabled"})]})}),C&&w(Nl,{id:"remove",onClick:()=>o("sms"),children:w(ph,{})})]},"sms"),w(Ba,{children:w(we,{disabled:!0,children:ne(Ga,{children:[ne(Ha,{children:[w(S3,{}),"Passkey"]}),w(rn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),w(X,{})]})}},R3=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Wr(""),[a,i]=Wr(!1),[l,s]=Wr("enroll"),{initEnrollmentWithSms:d,submitEnrollmentWithSms:u}=Ai(),{app:y,data:f,currentScreen:g,navigate:E,setModalData:v}=A();function x(){f?.mfaEnrollmentFlow?.onSuccess(),e()}async function C({qualifiedPhoneNumber:M}){try{await d({phoneNumber:M}),n(M),s("verify")}catch(k){v({mfaEnrollmentFlow:f?.mfaEnrollmentFlow?{...f?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:k,previousScreen:g||"MFA_ENROLLMENT_FLOW_SCREEN"}}),E("ERROR_SCREEN")}}async function P(M){try{if(!M)return;await u({phoneNumber:o,mfaCode:M}),i(!0)}catch(k){throw Xl(k)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):hn(k)?new Error("The code you entered is not valid"):fn(k)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):ec(k)?new Error("Verification canceled"):new Error("Unknown error")}}function R(){l==="verify"?s("enroll"):t()}return l==="enroll"?ne(Dt,{children:[w(S,{backFn:t,onClose:r},"header"),w(Ke,{children:w(it,{children:w(Mc,{})})}),w(he,{children:"Set up SMS verification"}),w(de,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),ne($r,{children:[w(Tn,{onSubmit:C}),ne(yu,{children:["By providing your mobile number, you agree to receive text messages from ",y?.name,". Some carrier charges may apply"]})]}),w(X,{})]}):a?ne(Dt,{children:[w(S,{onClose:x},"header"),w(Ke,{children:w(it,{status:"success",children:w(uh,{})})}),w(he,{children:"SMS verification added"}),w(de,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),w(jr,{children:w(F,{onClick:x,children:"Done"})}),w(X,{})]}):ne(Dt,{children:[w(S,{backFn:R,onClose:r},"header"),w(Ke,{children:w(it,{children:w(Mc,{})})}),w(he,{children:"Enter enrollment code"}),ne($r,{children:[w(An,{onChange:P}),ne(de,{children:["To continue, enter the 6-digit code sent to ",w("strong",{children:Af(o)})]})]}),w(X,{})]})},I3=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=Wr("enroll"),[a,i]=Wr(null),[l,s]=Wr(!1),{initEnrollmentWithTotp:d,submitEnrollmentWithTotp:u}=Ai(),{data:y}=A();fh(()=>{i(null),d().then(x=>{i(x)}).catch(()=>{i(null),r()})},[]);function f(){y?.mfaEnrollmentFlow?.onSuccess(),e()}function g(){n("verify")}async function E(x){try{if(!x)return;await u({mfaCode:x}),s(!0)}catch(C){throw Xl(C)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):hn(C)?new Error("The code you entered is not valid"):fn(C)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):ec(C)?new Error("Verification canceled"):new Error("Unknown error")}}function v(){o==="verify"?n("enroll"):r()}return o==="enroll"?ne(Dt,{children:[w(S,{backFn:r,onClose:t},"header"),w(he,{children:"Scan QR code"}),w(de,{children:"Open your authenticator app and scan the QR code to continue."}),w(on,{children:a?.authUrl?w(ch,{authUrl:a.authUrl,size:200}):w(ft,{})}),ne(jr,{children:[w(at,{children:a?.secret&&w(eo,{itemName:"secret",text:a.secret})}),w(F,{onClick:g,children:"Continue"})]}),w(X,{})]}):l?ne(Dt,{children:[w(S,{onClose:f},"header"),w(Ke,{children:w(it,{status:"success",children:w(uh,{})})}),w(he,{children:"Authenticator app verification added"}),w(de,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),w(jr,{children:w(F,{onClick:f,children:"Done"})}),w(X,{})]}):ne(Dt,{children:[w(S,{backFn:v,onClose:t},"header"),w(Ke,{children:w(it,{children:w(mh,{})})}),w(he,{children:"Enter enrollment code"}),w($r,{children:w(An,{onChange:E})}),ne(de,{children:["To continue, enter the 6-digit code generated from your ",w("strong",{children:"authenticator app"})]}),w(X,{})]})};import _b from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Ab from"@heroicons/react/24/outline/PhoneIcon";import kb from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Rb from"@heroicons/react/24/solid/PhoneIcon";import Ib from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as Mb,useState as Zc}from"react";import{useMemo as Tb,useEffect as Pb,useState as ry}from"react";import xb from"styled-components";import Dh from"styled-components";import gh from"styled-components";import{jsx as yh,jsxs as L3}from"react/jsx-runtime";var Ns=({label:e,children:t,valueStyles:r})=>L3(M3,{children:[yh("div",{children:e}),yh(W3,{style:{...r},children:t})]}),M3=gh.div`
|
|
1998
1998
|
display: flex;
|
|
1999
1999
|
align-items: center;
|
|
2000
2000
|
justify-content: space-between;
|
|
@@ -2009,7 +2009,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2009
2009
|
color: var(--privy-color-foreground-2);
|
|
2010
2010
|
text-align: right;
|
|
2011
2011
|
}
|
|
2012
|
-
`,
|
|
2012
|
+
`,W3=gh.div`
|
|
2013
2013
|
font-size: 14px;
|
|
2014
2014
|
line-height: 100%;
|
|
2015
2015
|
display: flex;
|
|
@@ -2018,28 +2018,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2018
2018
|
border-radius: var(--privy-border-radius-full);
|
|
2019
2019
|
background-color: var(--privy-color-background-2);
|
|
2020
2020
|
padding: 4px 8px;
|
|
2021
|
-
`;import
|
|
2021
|
+
`;import Fs from"styled-components";import{BigNumber as vh}from"@ethersproject/bignumber";import{formatEther as wh}from"@ethersproject/units";var ki=(e,t)=>{let r=(t*parseFloat(wh(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},wr=(e,t,r=6,o=!1)=>{let a=parseFloat(wh(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${a} ${t}`:`${a==="0"?"<0.001":a} ${t}`},Wc=e=>e.map(Qe).reduce((t,r)=>t.add(r),vh.from(0)).toHexString(),Ch=(e,t)=>{let{chains:r}=W(),o=`https://etherscan.io/address/${t}`,n=`${rp(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},Qe=e=>vh.from(e);import{Fragment as F3,jsx as Ds,jsxs as bh}from"react/jsx-runtime";var Eh=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Wc(e),n=t?ki(o,t):void 0,a=wr(o,r);return Ds(Th,{children:n||a})},Lc=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Wc(e),n=t?ki(o,t):void 0,a=wr(o,r);return Ds(Th,{children:n?bh(F3,{children:[Ds(O3,{children:"USD"}),n==="<$0.01"?bh(D3,{children:[Ds(N3,{children:"<"}),"$0.01"]}):n]}):a})},Th=Fs.span`
|
|
2022
2022
|
font-size: 14px;
|
|
2023
2023
|
line-height: 140%;
|
|
2024
2024
|
display: flex;
|
|
2025
2025
|
gap: 4px;
|
|
2026
2026
|
align-items: center;
|
|
2027
|
-
`,
|
|
2027
|
+
`,O3=Fs.span`
|
|
2028
2028
|
font-size: 12px;
|
|
2029
2029
|
line-height: 12px;
|
|
2030
2030
|
color: var(--privy-color-foreground-3);
|
|
2031
|
-
`,
|
|
2031
|
+
`,N3=Fs.span`
|
|
2032
2032
|
font-size: 10px;
|
|
2033
|
-
`,
|
|
2033
|
+
`,D3=Fs.span`
|
|
2034
2034
|
display: flex;
|
|
2035
2035
|
align-items: center;
|
|
2036
|
-
`;import
|
|
2036
|
+
`;import Oc from"styled-components";import{jsx as ao,jsxs as Us}from"react/jsx-runtime";var Ph=({gas:e,tokenPrice:t,tokenSymbol:r})=>Us(Bl,{style:{paddingBottom:"12px"},children:[Us(Sh,{children:[ao(Ah,{children:"Est. Fees"}),ao("div",{children:ao(Lc,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&ao(_h,{children:`${wr(e,r)}`})]}),xh=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=Qe(e.value||0).add(Qe(t)).toHexString();return Us(Bl,{children:[Us(Sh,{children:[ao(Ah,{children:"Total (including fees)"}),ao("div",{children:ao(Lc,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&ao(_h,{children:wr(n,o)})]})},Sh=Oc.div`
|
|
2037
2037
|
display: flex;
|
|
2038
2038
|
flex-direction: row;
|
|
2039
2039
|
justify-content: space-between;
|
|
2040
2040
|
align-items: center;
|
|
2041
2041
|
padding-top: 4px;
|
|
2042
|
-
`,
|
|
2042
|
+
`,_h=Oc.div`
|
|
2043
2043
|
display: flex;
|
|
2044
2044
|
flex-direction: row;
|
|
2045
2045
|
height: 12px;
|
|
@@ -2048,23 +2048,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2048
2048
|
line-height: 12px;
|
|
2049
2049
|
color: var(--privy-color-foreground-3);
|
|
2050
2050
|
font-weight: 400;
|
|
2051
|
-
`,
|
|
2051
|
+
`,Ah=Oc.div`
|
|
2052
2052
|
font-size: 14px;
|
|
2053
2053
|
line-height: 22.4px;
|
|
2054
2054
|
font-weight: 400;
|
|
2055
|
-
`;import
|
|
2055
|
+
`;import U3 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Wo,useState as B3}from"react";import so from"styled-components";import{createContext as kh,useContext as AD}from"react";var Rn=kh(void 0);var Ri=kh(void 0);import{Fragment as K3,jsx as er,jsxs as Rh}from"react/jsx-runtime";var Ih=({defaultValue:e,children:t})=>{let[r,o]=B3(e||null),n=a=>{o(r===a?null:a)};return er(Rn.Provider,{value:{activePanel:r,togglePanel:n},children:er(H3,{children:t})})},Mh=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=Wo(Rn),n=r===e;return er(Ri.Provider,{value:{onToggle:()=>o(e),value:e},children:er(q3,{isActive:n,"data-open":n,children:t})})},Wh=({children:e})=>{let{activePanel:t}=Wo(Rn),{onToggle:r,value:o}=Wo(Ri),n=t===o;return Rh(K3,{children:[Rh(G3,{onClick:r,"data-open":n,children:[er(z3,{children:e}),er(j3,{isactive:n,children:er(U3,{height:"16px",width:"16px",strokeWidth:"2"})})]}),er(V3,{})]})},Lh=({children:e})=>{let{activePanel:t}=Wo(Rn),{value:r}=Wo(Ri);return er($3,{"data-open":t===r,children:er(Nh,{children:e})})},Oh=({children:e})=>{let{activePanel:t}=Wo(Rn),{value:r}=Wo(Ri);return er(Nh,{children:typeof e=="function"?e({isActive:t===r}):e})},H3=so.div`
|
|
2056
2056
|
display: flex;
|
|
2057
2057
|
flex-direction: column;
|
|
2058
2058
|
width: 100%;
|
|
2059
2059
|
gap: 8px;
|
|
2060
|
-
`,
|
|
2060
|
+
`,G3=so.div`
|
|
2061
2061
|
display: flex;
|
|
2062
2062
|
justify-content: space-between;
|
|
2063
2063
|
align-items: center;
|
|
2064
2064
|
width: 100%;
|
|
2065
2065
|
cursor: pointer;
|
|
2066
2066
|
padding-bottom: 8px;
|
|
2067
|
-
`,
|
|
2067
|
+
`,V3=so.div`
|
|
2068
2068
|
width: 100%;
|
|
2069
2069
|
|
|
2070
2070
|
&& {
|
|
@@ -2072,13 +2072,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2072
2072
|
border-color: var(--privy-color-foreground-4);
|
|
2073
2073
|
}
|
|
2074
2074
|
padding-bottom: 12px;
|
|
2075
|
-
`,
|
|
2075
|
+
`,z3=so.div`
|
|
2076
2076
|
font-size: 14px;
|
|
2077
2077
|
font-weight: 500;
|
|
2078
2078
|
line-height: 19.6px;
|
|
2079
2079
|
width: 100%;
|
|
2080
2080
|
padding-right: 8px;
|
|
2081
|
-
`,
|
|
2081
|
+
`,q3=so.div`
|
|
2082
2082
|
display: flex;
|
|
2083
2083
|
flex-direction: column;
|
|
2084
2084
|
width: 100%;
|
|
@@ -2090,7 +2090,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2090
2090
|
border-color: var(--privy-color-foreground-4);
|
|
2091
2091
|
border-radius: var(--privy-border-radius-md);
|
|
2092
2092
|
}
|
|
2093
|
-
|
|
2093
|
+
`,$3=so.div`
|
|
2094
2094
|
position: relative;
|
|
2095
2095
|
overflow: hidden;
|
|
2096
2096
|
transition: max-height 25ms ease-out;
|
|
@@ -2102,38 +2102,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2102
2102
|
&[data-open='false'] {
|
|
2103
2103
|
max-height: 0;
|
|
2104
2104
|
}
|
|
2105
|
-
`,
|
|
2105
|
+
`,Nh=so.div`
|
|
2106
2106
|
display: flex;
|
|
2107
2107
|
flex-direction: column;
|
|
2108
2108
|
gap: 12px;
|
|
2109
2109
|
flex: 1 1 auto;
|
|
2110
2110
|
min-height: 1px;
|
|
2111
|
-
`,
|
|
2111
|
+
`,j3=so.div`
|
|
2112
2112
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
2113
|
-
`;import
|
|
2113
|
+
`;import Y3 from"styled-components";import{jsx as J3}from"react/jsx-runtime";var Nc=({walletAddress:e,chainId:t=xr})=>J3(Z3,{href:Ch(t,e),target:"_blank",children:Hr(e)}),Z3=Y3.a`
|
|
2114
2114
|
&:hover {
|
|
2115
2115
|
text-decoration: underline;
|
|
2116
2116
|
}
|
|
2117
|
-
`;import{jsx as St,jsxs as
|
|
2117
|
+
`;import{jsx as St,jsxs as Dc}from"react/jsx-runtime";var In=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:a,tokenSymbol:i})=>{let l=r?.value||0;return St(Ih,{children:Dc(Mh,{value:"details",children:[St(Wh,{children:Dc(Q3,{children:[St("div",{children:o?.title||o?.actionDescription||"Details"}),St(X3,{children:St(Eh,{weiQuantities:[l],tokenPrice:n,tokenSymbol:i})})]})}),Dc(Lh,{children:[St(Ns,{label:"From",children:St(Nc,{walletAddress:e,chainId:r.chainId||xr})}),St(Ns,{label:"To",children:St(Nc,{walletAddress:t,chainId:r.chainId||xr})}),o&&o.action&&St(Ns,{label:"Action",children:o.action}),a&&St(Ph,{transactionData:r,gas:a,tokenPrice:n,tokenSymbol:i})]}),St(Oh,{children:({isActive:s})=>St(xh,{transactionData:r,displayFee:s,gas:a||"0x0",tokenPrice:n,tokenSymbol:i})})]})})},Q3=Dh.div`
|
|
2118
2118
|
display: flex;
|
|
2119
2119
|
flex-direction: row;
|
|
2120
2120
|
justify-content: space-between;
|
|
2121
|
-
|
|
2121
|
+
`,X3=Dh.div`
|
|
2122
2122
|
flex-shrink: 0;
|
|
2123
2123
|
padding-left: 8px;
|
|
2124
|
-
`;import
|
|
2124
|
+
`;import Mi from"styled-components";import{jsx as Ii,jsxs as ib}from"react/jsx-runtime";var Fc=({description:e,contractInfo:t})=>ib(eb,{children:[t.imgUrl&&Ii(tb,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&Ii(rb,{children:Ii("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&Ii(ob,{children:t.name}),Ii(nb,{children:e||t.actionText})]}),eb=Mi.div`
|
|
2125
2125
|
display: flex;
|
|
2126
2126
|
flex-direction: column;
|
|
2127
2127
|
align-items: center;
|
|
2128
2128
|
margin-bottom: 8px;
|
|
2129
|
-
`,
|
|
2129
|
+
`,tb=Mi.img`
|
|
2130
2130
|
&& {
|
|
2131
2131
|
height: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2132
2132
|
width: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2133
2133
|
border-radius: 16px;
|
|
2134
2134
|
margin-bottom: 12px;
|
|
2135
2135
|
}
|
|
2136
|
-
`,
|
|
2136
|
+
`,rb=Mi.div`
|
|
2137
2137
|
font-size: 12px;
|
|
2138
2138
|
line-height: 12px;
|
|
2139
2139
|
padding: 7px;
|
|
@@ -2146,7 +2146,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2146
2146
|
text-decoration: underline;
|
|
2147
2147
|
}
|
|
2148
2148
|
}
|
|
2149
|
-
`,
|
|
2149
|
+
`,ob=Mi.div`
|
|
2150
2150
|
font-size: 18px;
|
|
2151
2151
|
line-height: 18px;
|
|
2152
2152
|
font-weight: 500;
|
|
@@ -2154,7 +2154,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2154
2154
|
white-space: nowrap;
|
|
2155
2155
|
max-width: 275px;
|
|
2156
2156
|
text-overflow: ellipsis;
|
|
2157
|
-
`,
|
|
2157
|
+
`,nb=Mi.div`
|
|
2158
2158
|
font-size: 16px;
|
|
2159
2159
|
line-height: 140%;
|
|
2160
2160
|
font-weight: 400;
|
|
@@ -2162,7 +2162,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2162
2162
|
overflow: hidden;
|
|
2163
2163
|
max-width: 275px;
|
|
2164
2164
|
text-overflow: ellipsis;
|
|
2165
|
-
`;import
|
|
2165
|
+
`;import ab from"@heroicons/react/24/outline/WalletIcon";import Bc from"styled-components";import{jsx as Fh,jsxs as Uc}from"react/jsx-runtime";var Uh=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:a}=W(),i=a(t.chainId)||"ETH";return Uc(sb,{children:[Uc(lb,{children:[Fh(ab,{strokeWidth:"2",width:"16px",height:"16px"}),Fh("div",{children:Hr(e)})]}),Uc(cb,{displayBalanceColor:n,hasFunds:o,children:[r?wr(r,i,6,!0):0," available"]})]})},sb=Bc.div`
|
|
2166
2166
|
display: flex;
|
|
2167
2167
|
flex-direction: row;
|
|
2168
2168
|
justify-content: space-between;
|
|
@@ -2175,12 +2175,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2175
2175
|
border: 1px solid var(--privy-color-foreground-4);
|
|
2176
2176
|
border-radius: var(--privy-border-radius-md);
|
|
2177
2177
|
}
|
|
2178
|
-
`,
|
|
2178
|
+
`,lb=Bc.div`
|
|
2179
2179
|
display: flex;
|
|
2180
2180
|
flex-direction: row;
|
|
2181
2181
|
align-items: center;
|
|
2182
2182
|
gap: 8px;
|
|
2183
|
-
`,
|
|
2183
|
+
`,cb=Bc.div`
|
|
2184
2184
|
display: flex;
|
|
2185
2185
|
align-items: center;
|
|
2186
2186
|
justify-content: center;
|
|
@@ -2190,35 +2190,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2190
2190
|
background-color: var(--privy-color-background-2);
|
|
2191
2191
|
padding: 5px 8px;
|
|
2192
2192
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
2193
|
-
`;import
|
|
2193
|
+
`;import Bs from"styled-components";import{Fragment as Hh,jsx as Wi,jsxs as Gh}from"react/jsx-runtime";var Vh=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,a=o?ki(n,o):void 0,i=wr(n,r);return Gh(db,{children:[a?Gh(Hh,{children:[Wi(Bh,{children:a}),Wi(pb,{children:i})]}):Wi(Hh,{children:Wi(Bh,{children:i})}),Wi(ub,{children:e})]})},db=Bs.div`
|
|
2194
2194
|
display: flex;
|
|
2195
2195
|
flex-direction: column;
|
|
2196
2196
|
align-items: center;
|
|
2197
2197
|
margin-bottom: 20px;
|
|
2198
|
-
`,
|
|
2198
|
+
`,Bh=Bs.h2`
|
|
2199
2199
|
&& {
|
|
2200
2200
|
font-size: 48px;
|
|
2201
2201
|
line-height: 48px;
|
|
2202
2202
|
margin: 8px auto;
|
|
2203
2203
|
}
|
|
2204
|
-
`,
|
|
2204
|
+
`,pb=Bs.p`
|
|
2205
2205
|
margin-bottom: 12px;
|
|
2206
2206
|
&& {
|
|
2207
2207
|
font-size: 17px;
|
|
2208
2208
|
line-height: 17px;
|
|
2209
2209
|
color: var(--privy-color-foreground-3);
|
|
2210
2210
|
}
|
|
2211
|
-
`,
|
|
2211
|
+
`,ub=Bs.div`
|
|
2212
2212
|
font-size: 16px;
|
|
2213
2213
|
line-height: 22.4px;
|
|
2214
2214
|
font-weight: 400;
|
|
2215
2215
|
overflow: hidden;
|
|
2216
2216
|
max-width: 275px;
|
|
2217
2217
|
text-overflow: ellipsis;
|
|
2218
|
-
`;import{VoidSigner as
|
|
2218
|
+
`;import{VoidSigner as vb}from"@ethersproject/abstract-signer";import{EtherscanProvider as KF}from"@ethersproject/providers";import{BigNumber as jh}from"@ethersproject/bignumber";import{BigNumber as Mn}from"@ethersproject/bignumber";import{Contract as mb}from"@ethersproject/contracts";import{serialize as fb}from"@ethersproject/transactions";var Wn=e=>[wa.id,Ca.id,ba.id,Ea.id,Ta.id,Pa.id,xa.id,_a.id,Sa.id].includes(e),zh=async(e,t)=>{if(!Wn(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=Mn.from(r).mul(Mn.from(126)).div(Mn.from(100)).add(Mn.from(e.maxPriorityFeePerGas));e.maxFeePerGas=Li(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function qh(e,t){if(!e.chainId||e.chainId&&!Wn(e.chainId))return Mn.from(0);let r=Mn.from(0);try{let o=new mb(Kd,Yd,t),n=$h(e),a=fb(n);r=await o.getL1Fee(a)}catch{}return r}async function Kh(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var Yh=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 Ln(e,t){if(!e.gasLimit)throw new _e("gasLimit was not successfully set for transaction.");let r=Qe(e.gasLimit),o=jh.from(0);if(e.type==2)if(e.maxFeePerGas)o=Qe(e.maxFeePerGas);else throw new _e("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=Qe(e.gasPrice);else throw new _e("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=jh.from(0);if(e.chainId&&Wn(e.chainId))try{a=await qh(e,t),n=n.add(a)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:a}}import{BigNumber as Hc}from"@ethersproject/bignumber";var Gc=e=>[ya.id,ga.id,va.id].includes(e),Zh=async(e,t)=>{if(!Gc(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(Hc.from(120)).div(Hc.from(100));e.maxFeePerGas=Li(o),e.maxPriorityFeePerGas=Li(Hc.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Vc=e=>[56,97].includes(e),Jh=async(e,t)=>{if(!Vc(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 Qh}from"@ethersproject/units";import{ofetch as hb}from"ofetch";var zc={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 $c=e=>[Yn.id,Zn.id,zc.id].includes(e),qc=e=>({maxPriorityFee:Qh(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:Qh(e.maxFee.toFixed(9),"gwei").toHexString()}),yb=e=>({safeLow:qc(e.safeLow),standard:qc(e.standard),fast:qc(e.fast)}),gb=async e=>{let t="";switch(e){case Yn.id:t="https://gasstation.polygon.technology/v2";break;case Zn.id:t="https://gasstation-testnet.polygon.technology/v2";break;case zc.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return yb(await hb(t))};async function Xh(e){if(!$c(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 gb(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 Li(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 $h(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=Qe(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Qe(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Qe(e.gasPrice)),e.value!==void 0&&(t.value=Qe(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Qe(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Qe(e.maxPriorityFeePerGas)),t}async function On(e,t,r){if(t.chainId=Number(t.chainId),ey(t),t.from||(t.from=e),!t.nonce){let o=new vb(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await Kh(t,r)),typeof t.type=="string"&&ty(t.type)&&(t.type=Number(t.type)),$c(t.chainId)?t=await Xh(t):Gc(t.chainId)?t=await Zh(t,r):Wn(t.chainId)?t=await zh(t,r):Vc(t.chainId)?t=await Jh(t,r):t=await Yh(t,r),t}async function Hs(e,t,r,o,n){o=Object.assign({chainId:xr},o),ey(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 Gs(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub(Qe(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function ey(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!wb(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 wb(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&ty(e);return t||r||o}function ty(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Vs(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 jc,useEffect as Cb}from"react";var zs=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=W(),[n,a]=jc(!0),[i,l]=jc(void 0),[s,d]=jc(void 0);return Cb(()=>{let u=e.chainId||xr,y=o.find(g=>g.id===Number(u));if(!y)throw new J(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let g=await r(y);g?d(g):l(new Error(`Unable to fetch token price on chain id ${y.id}`))}catch(g){l(g)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};import{createContext as bb,useContext as Eb}from"react";var Kc=bb(null);function Oi(){let e=Eb(Kc);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as oy}from"react/jsx-runtime";var Yc=({pendingTransaction:e})=>{let{getAccessToken:t}=G(),{wallets:r}=Oi(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=W(),[s,d]=ry(null),[u,y]=ry(e),{tokenPrice:f}=zs(u),g=l(e.chainId)||"ETH",E=Tb(()=>r.find(v=>v.walletClientType==="privy"),[r]);return Pb(()=>{async function v(){if(!await t()||!o||!E)return u;let C=Sr(u.chainId,a,n,{appId:i}),P=await On(E.address,u,C),{totalGasEstimate:R}=await Ln(P,C);return d(R.toHexString()),P}v().then(x=>{y(x)})},[o]),E?oy(Sb,{children:oy(In,{from:E.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:g})}):null},Sb=xb.div`
|
|
2219
2219
|
width: 100%;
|
|
2220
2220
|
padding: 1rem 0;
|
|
2221
|
-
`;import{Fragment as
|
|
2221
|
+
`;import{Fragment as Jc,jsx as ae,jsxs as Cr}from"react/jsx-runtime";var Qc=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=Zc(null),{init:a,cancel:i}=kn();Mb(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(d){try{n(d),await a(d)}catch(u){console.error(u)}}let s=()=>{n(null),i(),t()};return!e||!r?null:o?ae(Wb,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Cr(Jc,{children:[ae(S,{onClose:s},"header"),ae(Ke,{children:ae(it,{children:ae(Ib,{})})}),ae(he,{children:"Verify your identity"}),ae(de,{children:"Choose a verification method"}),Cr(Ua,{children:[r.mfaMethods.includes("totp")&&Cr(we,{onClick:()=>l("totp"),children:[ae(_b,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Cr(we,{onClick:()=>l("sms"),children:[ae(Ab,{}),"SMS"]},"sms")]}),ae(X,{})]})},Wb=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=A(),{pendingTransaction:n}=W(),[a,i]=Zc(!1),[l,s]=Zc(!1),{submit:d}=kn();async function u(y){try{if(!y)return;await d(e,y),s(!0),i(!1),t()}catch(f){throw Ql(f)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):hn(f)?(i(!1),new Error("The code you entered is not valid")):fn(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 Cr(Jc,{children:[ae(S,{onClose:t},"header"),ae(Ke,{children:ae(it,{children:ae(Rb,{})})}),ae(he,{children:"Enter verification code"}),Cr($r,{children:[ae(An,{success:l,disabled:a,onChange:u}),Cr(de,{children:["To continue, please enter the 6-digit code sent to your ",ae("strong",{children:"mobile device"})]}),n&&ae(Yc,{pendingTransaction:n})]}),r&&ae(Dl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ae($t,{onClick:t,children:"Not now"}),ae(X,{})]});case"totp":return Cr(Jc,{children:[ae(S,{onClose:t},"header"),ae(Ke,{children:ae(it,{children:ae(kb,{})})}),ae(he,{children:"Enter verification code"}),Cr($r,{children:[ae(An,{success:l,disabled:a,onChange:u}),Cr(de,{children:["To continue, please enter the 6-digit code generated from your"," ",ae("strong",{children:"authenticator app"})]}),n&&ae(Yc,{pendingTransaction:n})]}),r&&ae(Dl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ae($t,{onClick:t,children:"Not now"}),ae(X,{})]});default:return null}};import{useEffect as ny,useState as iy}from"react";import sy from"styled-components";import{Fragment as Nb,jsx as br,jsxs as qs}from"react/jsx-runtime";var ay={google:{name:"Google",component:xs},discord:{name:"Discord",component:Es},github:{name:"Github",component:Ts},linkedin:{name:"LinkedIn",component:_s},twitter:{name:"Twitter",component:Rs},spotify:{name:"Spotify",component:As},tiktok:{name:"Tiktok",component:ks},apple:{name:"Apple",component:bs}},ly=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=A(),{getAuthMeta:s,initLoginWithOAuth:d,loginWithOAuth:u,updateWallets:y,setReadyToTrue:f,closePrivyModal:g,createAnalyticsEvent:E}=W(),[v,x]=iy(!1),[C,P]=iy(void 0),R=s()?.provider||"google",M=ay[R].name,k=ay[R].component,B=n?.render.inDialog?Oe:0;ny(()=>{u(R).then(()=>{x(!0)}).catch(T=>{if(T?.privyErrorCode==="allowlist_rejected"){P(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}let{retryable:q,detail:O}=hp(T,R);P({retryable:q,detail:O,message:"Authentication failed"})}).finally(()=>{Kn(),f()})},[M,R]),ny(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let q=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},B);return()=>clearTimeout(q)}if(At(o,n?.embeddedWallets?.createOnLogin)){let q=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:O=>{console.error(O),E("embedded_wallet_creation_failure_logout",{error:O,provider:R,screen:"OAuthStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},B);return()=>clearTimeout(q)}else{let q=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),B);return y(),()=>clearTimeout(q)}}},[r,e,v,o]);let U=v?`Successfully connected with ${M}`:C?C.message:`Verifying connection to ${M}`,H="";return v?H="You\u2019re good to go!":C?H=C.detail:H="Just a few moments more",qs(Nb,{children:[br(S,{}),br(K,{}),qs(Lb,{children:[br(Ob,{children:qs("div",{children:[br(It,{success:v,fail:!!C}),br(k,{style:{width:"38px",height:"38px"}})]})}),qs(Ye,{children:[br("h3",{children:U}),br("p",{children:H})]}),C&&C?.retryable?br(Oa,{onClick:()=>{Kn(),d(R),P(void 0)},disabled:!v&&!C?.retryable,children:"Retry"}):null]}),br(oe,{}),br(X,{})]})},Lb=sy.div`
|
|
2222
2222
|
display: flex;
|
|
2223
2223
|
flex-direction: column;
|
|
2224
2224
|
align-items: center;
|
|
@@ -2226,7 +2226,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2226
2226
|
margin-left: 27px;
|
|
2227
2227
|
margin-right: 27px;
|
|
2228
2228
|
gap: 24px;
|
|
2229
|
-
`,
|
|
2229
|
+
`,Ob=sy.div`
|
|
2230
2230
|
display: flex;
|
|
2231
2231
|
flex-direction: column;
|
|
2232
2232
|
justify-content: center;
|
|
@@ -2249,55 +2249,61 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2249
2249
|
left: -19px;
|
|
2250
2250
|
top: -19px;
|
|
2251
2251
|
}
|
|
2252
|
-
`;import{useEffect as
|
|
2252
|
+
`;import{useEffect as Fb,useState as dy}from"react";import Ub from"styled-components";import{isMobile as Db}from"react-device-detect";var cy=(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(!Br()&&Db)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as Hb,jsx as Lr,jsxs as py}from"react/jsx-runtime";var uy=()=>{let{forkSession:e,ready:t,authenticated:r}=G(),[o,n]=dy(""),[a,i]=dy(!1);Fb(()=>{t&&r&&e().then(n)},[t,r]);let l=cy(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."),py(Hb,{children:[Lr(S,{},"header"),Lr(K,{}),Lr(mr,{title:s.title,description:s.description}),py(Ot,{children:[Lr(Bb,{children:Lr(lr,{style:{width:"72px",height:"72px"}})}),Lr(La,{href:l,onClick:()=>{setTimeout(()=>i(!0),1e3)},loading:t&&!l,children:a?"Go to App Store":"Continue"}),s.footnote?Lr("p",{children:s.footnote}):null]}),Lr(oe,{}),Lr(V,{protectedByPrivy:!0})]})},Bb=Ub(at)`
|
|
2253
2253
|
margin: 16px auto;
|
|
2254
|
-
`;import
|
|
2254
|
+
`;import Vb from"@heroicons/react/24/outline/LockClosedIcon";import zb from"@heroicons/react/24/outline/PencilSquareIcon";import{jsx as Or,jsxs as my}from"react/jsx-runtime";var fy=()=>my("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[my("g",{"clip-path":"url(#clip0_2115_829)",children:[Or("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"}),Or("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"}),Or("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"}),Or("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"}),Or("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"}),Or("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"})]}),Or("defs",{children:Or("clipPath",{id:"clip0_2115_829",children:Or("rect",{width:"16",height:"14",fill:"white"})})})]});import Gb from"styled-components";var hy=Gb.div`
|
|
2255
|
+
display: flex;
|
|
2256
|
+
flex-direction: column;
|
|
2257
|
+
gap: 12px;
|
|
2258
|
+
padding-top: 24px;
|
|
2259
|
+
padding-bottom: 24px;
|
|
2260
|
+
`;import{Fragment as qb,jsx as Nn,jsxs as $s}from"react/jsx-runtime";var yy=()=>$s(qb,{children:[Nn(S,{},"header"),Nn(Te,{title:"Secure your account",icon:Nn(Vb,{width:48}),description:"Select a method for logging in on new devices and recovering your account."}),$s(hy,{children:[$s(we,{children:[Nn(fy,{})," Back up to Google Drive"]}),$s(we,{children:[Nn(zb,{})," Set a password"]})]}),Nn(V,{protectedByPrivy:!0})]});import{BigNumber as wy}from"@ethersproject/bignumber";import{useMemo as Cy,useEffect as by,useState as Ft}from"react";import Fn from"styled-components";function gy(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{BigNumber as Xc}from"@ethersproject/bignumber";import $b from"styled-components";import{Fragment as Yb,jsx as Ni,jsxs as Zb}from"react/jsx-runtime";var jb=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Xc.from(e.gasUsed),o=Xc.from(e.effectiveGasPrice),n=r.mul(o);if(t){let a=Xc.from(t);n=n.add(a)}return n.toString()}catch{return}else return},vy=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:a,l1GasEstimate:i})=>Zb(Yb,{children:[Ni(S,{onClose:o}),Ni(oi,{title:"Transaction complete!",description:"You're all set."}),Ni(In,{tokenPrice:n,from:t.from,to:t.to,gas:jb(t,i),txn:e,transactionInfo:r,tokenSymbol:a}),Ni(Kb,{loading:!1,onClick:o,children:"All Done"}),Ni(X,{})]}),Kb=$b(F)`
|
|
2255
2261
|
&& {
|
|
2256
2262
|
margin-top: 24px;
|
|
2257
2263
|
}
|
|
2258
2264
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2259
|
-
`;import{Fragment as
|
|
2265
|
+
`;import{Fragment as ed,jsx as Xe,jsxs as Dn}from"react/jsx-runtime";var Jb=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return Xe(Fc,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return Xe(Fc,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return Xe(ed,{children:Xe(Vh,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},Ty=()=>{let{authenticated:e,getAccessToken:t}=G(),{wallets:r}=Oi(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:a,rpcConfig:i,chains:l,nativeTokenSymbolForChainId:s,appId:d}=W(),{app:u,navigate:y,data:f,onUserCloseViaDialogOrKeybindRef:g,setModalData:E}=A(),{transactionRequest:v,onSuccess:x,onFailure:C,uiOptions:P,fundWalletConfig:R}=f.sendTransaction,[M,k]=Ft(null),[B,U]=Ft(null),[H,T]=Ft(""),[q,O]=Ft(),[Y,se]=Ft(!1),re=()=>{T(""),O(void 0)},te=(vt,qe,rr)=>{T(vt),O(new _e(new kt(qe??vt,rr??je.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[z,Se]=Ft(!1),[Ce,Tr]=Ft(!0),[yt,Ae]=Ft(null),[ge,gt]=Ft(v),{tokenPrice:Ut,isTokenPriceLoading:Dr}=zs(ge),tr=s(v.chainId)||"ETH",[L,Z]=Ft(null),[Q,Gn]=Ft(null),[$,We]=Ft(!0);by(()=>{e||(y("LANDING"),C(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let pt=Cy(()=>r.find(vt=>vt.walletClientType==="privy"),[r]),po=async()=>{if(!pt)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:vt,externalTransactionId:qe}=await a(pt.address,{config:R?.config||{}});E({fiatOnRampPrompt:{signedUrl:vt},fiatOnRampStatus:{externalTransactionId:qe}}),y("FIAT_ON_RAMP_PROMPT_SCREEN")},Bt=Cy(()=>Sr(ge.chainId,l,i,{appId:d}),[ge.chainId,i]);by(()=>{async function vt(){let qe=ge;if(!await t()||!o||!pt)return;try{qe=await On(pt.address,ge,Bt),gt(qe)}catch(or){console.error(or),te("There was an error preparing your transaction. Please try again.",or.reason)}let Fr=wy.from(0),Fi=wy.from(0);try{({totalGasEstimate:Fr,l1ExecutionFeeEstimate:Fi}=await Ln(qe,Bt)),Z(Fr.toHexString()),Gn(Fi.toHexString())}catch{Z(null)}try{let{balance:or,hasSufficientFunds:Xs}=await Gs(pt.address,qe,Fr,Bt);Ae(or.toHexString()),Xs||(Tr(!1),te("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&se(!0))}catch(or){console.warn(`Failed to fetch wallet balance with error: ${or}`)}We(!1)}vt()},[o]);let uo=gy(ge),Qs=uo==="SEND"?`Send ${tr}`:"Review transaction",Le={modalTitle:P.header||P.modalTitle||Qs,buttonText:P.buttonText||"Submit"},mo=()=>{z||(B?x(B):C(q||new _e(new kt("The user rejected the request",je.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=mo,Ut===void 0&&Dr||$?Dn(ed,{children:[P.transactionInfo?.contractInfo?.imgUrl&&Xe(ha,{src:P.transactionInfo?.contractInfo?.imgUrl}),Xe(S,{title:Le.modalTitle,onClose:mo}),Xe(Ey,{children:Xe(un,{})})]}):M!==null?Xe(vy,{txn:ge,onClose:mo,receipt:M,transactionInfo:P.transactionInfo,tokenPrice:Ut,tokenSymbol:tr,l1GasEstimate:Q}):Dn(ed,{children:[Xe(S,{title:Le.modalTitle,onClose:mo}),Dn(Ey,{children:[Dn(t4,{children:[Xe(Jb,{txn:ge,txnFamily:uo,uiOptions:P,tokenSymbol:tr,tokenPrice:Ut}),pt?Xe(In,{from:pt.address,to:ge.to,txn:ge,transactionInfo:P.transactionInfo,gas:L||void 0,tokenPrice:Ut,tokenSymbol:tr}):null]}),Dn(r4,{children:[Xe(Qb,{children:H}),Xe(Uh,{txn:ge,address:pt?.address??"",hasFunds:Ce,balance:yt}),Dn(Xb,{children:[Y&&Xe(F,{onClick:po,children:"Add Funds"}),Xe(e4,{disabled:z||!Ce,loading:!o||z,loadingText:z?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{Se(!0);let vt=await t();if(vt&&!z&&pt)try{let qe=await Hs(vt,pt.address,o,ge,Bt);U(qe);let rr=await qe.wait();k(Vs(rr)),re()}catch(qe){let rr="There was an error processing your transaction. Please contact support.";console.warn({transaction:ge,error:qe}),te(rr,qe.reason)}finally{Se(!1)}},children:Le.buttonText})]})]})]})]})},Ey=Fn.div`
|
|
2260
2266
|
display: flex;
|
|
2261
2267
|
flex-direction: column;
|
|
2262
2268
|
justify-content: space-between;
|
|
2263
2269
|
flex-grow: 1;
|
|
2264
2270
|
padding-bottom: 16px;
|
|
2265
|
-
`,
|
|
2271
|
+
`,Qb=Fn.div`
|
|
2266
2272
|
font-size: 13px;
|
|
2267
2273
|
color: var(--privy-color-error);
|
|
2268
2274
|
width: 100%;
|
|
2269
2275
|
margin-top: 16px;
|
|
2270
|
-
`,
|
|
2276
|
+
`,Xb=Fn.div`
|
|
2271
2277
|
display: flex;
|
|
2272
2278
|
direction: row;
|
|
2273
2279
|
justify-content: space-between;
|
|
2274
2280
|
align-items: center;
|
|
2275
2281
|
gap: 8px;
|
|
2276
|
-
`,
|
|
2282
|
+
`,e4=Fn(F)`
|
|
2277
2283
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2278
|
-
`,
|
|
2284
|
+
`,t4=Fn.div`
|
|
2279
2285
|
height: 100%;
|
|
2280
2286
|
display: flex;
|
|
2281
2287
|
flex-direction: column;
|
|
2282
2288
|
justify-content: space-evenly;
|
|
2283
2289
|
flex-grow: 1;
|
|
2284
|
-
`,
|
|
2290
|
+
`,r4=Fn.div`
|
|
2285
2291
|
display: flex;
|
|
2286
2292
|
flex-direction: column;
|
|
2287
2293
|
gap: 8px;
|
|
2288
|
-
`;import{isHexString as
|
|
2294
|
+
`;import{isHexString as o4}from"@ethersproject/bytes";import{toUtf8String as n4}from"@ethersproject/strings";import{useEffect as Py,useState as js}from"react";import lo,{css as i4}from"styled-components";import{Fragment as _y,jsx as Re,jsxs as Un}from"react/jsx-runtime";var a4=e=>{if(!o4(e))return e;try{return n4(e)}catch{return e}},s4=e=>JSON.stringify(e,null,2),l4=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Re(m4,{children:Object.entries(r).map(([o,n])=>Un("li",{children:[Un("strong",{children:[o,":"]})," ",t(n)]},o))}):Re("span",{children:String(r)});return Re("div",{children:t(e)})},c4=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Un(_y,{children:[Re(Sy,{children:Re(l4,{data:o})}),Re(eo,{text:s4(e.typedData),itemName:"full payload to clipboard"})," "]})},xy=()=>{let{authenticated:e}=G(),{initializeWalletProxy:t,closePrivyModal:r}=W(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:a}=A(),[i,l]=js(!0),[s,d]=js(""),[u,y]=js(),[f,g]=js(null),E=f!==null;Py(()=>{e||o("LANDING")},[e]),Py(()=>{t(Uo).then(U=>{l(!1),U||(d("An error has occurred, please try again."),y(new _e(new kt(s,je.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:v,data:x,confirmAndSign:C,onSuccess:P,onFailure:R,uiOptions:M}=n.signMessage,k={title:M.title||"Sign message",description:M.description||"Signing this message will not cost you any fees.",buttonText:M.buttonText||"Sign and continue"},B=U=>{U?P(U):R(u||new _e(new kt("The user rejected the request.",je.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),g(null),d(""),y(void 0)};return a.current=()=>{B(f)},Un(_y,{children:[Re(S,{onClose:()=>B(f)}),Re(K,{}),Un(d4,{children:[Re(p4,{children:k.title}),Re(u4,{children:k.description}),v==="personal_sign"&&Re(Sy,{children:a4(x)}),v==="eth_signTypedData_v4"&&Re(c4,{typedData:x}),Re(f4,{fail:!0,children:s}),Re(y4,{success:E,loading:i,disabled:E,onClick:async()=>{try{let U=await C();g(U),d(""),setTimeout(()=>{B(U)},Oe)}catch{d("An error has occurred, please try again."),y(new _e(new kt(s,je.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:E?Un(h4,{children:[Re(is,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Re("span",{children:"Success"})]}):k.buttonText})]}),Re(oe,{}),Re(V,{protectedByPrivy:!0})]})},d4=lo.div`
|
|
2289
2295
|
display: flex;
|
|
2290
2296
|
flex-direction: column;
|
|
2291
2297
|
align-items: center;
|
|
2292
2298
|
justify-content: center;
|
|
2293
|
-
`,
|
|
2299
|
+
`,p4=lo.span`
|
|
2294
2300
|
color: var(--privy-color-foreground);
|
|
2295
2301
|
text-align: center;
|
|
2296
2302
|
font-size: 1.125rem;
|
|
2297
2303
|
font-weight: 500;
|
|
2298
2304
|
line-height: 1.25rem; /* 111.111% */
|
|
2299
2305
|
text-align: center;
|
|
2300
|
-
`,
|
|
2306
|
+
`,u4=lo.span`
|
|
2301
2307
|
margin-top: 4px;
|
|
2302
2308
|
color: var(--privy-color-foreground);
|
|
2303
2309
|
text-align: center;
|
|
@@ -2307,7 +2313,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2307
2313
|
font-weight: 400;
|
|
2308
2314
|
line-height: 20px; /* 142.857% */
|
|
2309
2315
|
letter-spacing: -0.008px;
|
|
2310
|
-
`,
|
|
2316
|
+
`,Sy=lo.div`
|
|
2311
2317
|
margin-top: 1.5rem;
|
|
2312
2318
|
background-color: var(--privy-color-background-2);
|
|
2313
2319
|
border-radius: var(--privy-border-radius-md);
|
|
@@ -2326,7 +2332,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2326
2332
|
display: none; /* Safari and Chrome */
|
|
2327
2333
|
}
|
|
2328
2334
|
}
|
|
2329
|
-
`,
|
|
2335
|
+
`,m4=lo.ul`
|
|
2330
2336
|
margin-left: 12px !important;
|
|
2331
2337
|
white-space: nowrap;
|
|
2332
2338
|
|
|
@@ -2338,7 +2344,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2338
2344
|
font-weight: 500 !important;
|
|
2339
2345
|
}
|
|
2340
2346
|
}
|
|
2341
|
-
`,
|
|
2347
|
+
`,f4=lo.div`
|
|
2342
2348
|
line-height: 20px;
|
|
2343
2349
|
height: 20px;
|
|
2344
2350
|
font-size: 13px;
|
|
@@ -2348,22 +2354,22 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2348
2354
|
width: 100%;
|
|
2349
2355
|
margin-top: 16px;
|
|
2350
2356
|
margin-bottom: 4px;
|
|
2351
|
-
`,
|
|
2357
|
+
`,h4=lo.span`
|
|
2352
2358
|
display: flex;
|
|
2353
2359
|
align-items: center;
|
|
2354
2360
|
gap: 8px;
|
|
2355
|
-
`,
|
|
2361
|
+
`,y4=lo(F)`
|
|
2356
2362
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2357
2363
|
|
|
2358
|
-
${e=>e.success&&
|
|
2364
|
+
${e=>e.success&&i4`
|
|
2359
2365
|
&&&& {
|
|
2360
2366
|
background-color: var(--privy-color-success);
|
|
2361
2367
|
color: #ffffff;
|
|
2362
2368
|
}
|
|
2363
2369
|
`}
|
|
2364
|
-
`;import
|
|
2370
|
+
`;import E4 from"@heroicons/react/24/outline/EnvelopeIcon";import g4 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as v4,useState as Ay}from"react";import Ry from"styled-components";import{Fragment as b4,jsx as Di,jsxs as ky}from"react/jsx-runtime";var Iy=v4((e,t)=>{let[r,o]=Ay(""),[n,a]=Ay(!1),{authenticated:i,user:l}=G(),{initUpdateEmail:s}=W(),{navigate:d,setModalData:u,currentScreen:y}=A(),{enabled:f,token:g}=fe(),E=Qi(r),v=n,x=n||!E,C=async R=>{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,R),d("AWAITING_PASSWORDLESS_CODE")}catch(M){u({errorModalData:{error:M,previousScreen:y||"LANDING"}})}a(!1)},P=()=>{f&&!g&&!i?(u({captchaModalData:{callback:R=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,R)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),d("CAPTCHA_SCREEN")):C(g)};return ky(b4,{children:[Di(w4,{children:ky(C4,{children:[Di(g4,{}),Di("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:R=>o(R.target.value),onKeyUp:R=>{R.key==="Enter"&&P()},value:r,autoComplete:"email"}),e.stacked?null:Di(Xo,{isSubmitting:v,onClick:P,disabled:x,children:"Submit"})]})}),e.stacked?Di(F,{loadingText:null,loading:v,disabled:x,onClick:P,children:"Submit"}):null]})}),w4=Ry.div`
|
|
2365
2371
|
width: 100%;
|
|
2366
|
-
`,
|
|
2372
|
+
`,C4=Ry.label`
|
|
2367
2373
|
display: block;
|
|
2368
2374
|
position: relative;
|
|
2369
2375
|
width: 100%;
|
|
@@ -2421,7 +2427,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2421
2427
|
&& > input::placeholder {
|
|
2422
2428
|
color: var(--privy-color-foreground-3);
|
|
2423
2429
|
}
|
|
2424
|
-
`;import{Fragment as
|
|
2430
|
+
`;import{Fragment as T4,jsx as co,jsxs as P4}from"react/jsx-runtime";var My=()=>P4(T4,{children:[co(S,{},"header"),co(K,{}),co(Te,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:co(E4,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),co(Ot,{children:co(Iy,{stacked:!0})}),co(oe,{}),co(V,{protectedByPrivy:!0})]});import S4,{createGlobalStyle as _4}from"styled-components";var x4=`
|
|
2425
2431
|
*,
|
|
2426
2432
|
::before,
|
|
2427
2433
|
::after {
|
|
@@ -2651,7 +2657,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2651
2657
|
[hidden] {
|
|
2652
2658
|
display: none;
|
|
2653
2659
|
}
|
|
2654
|
-
`,
|
|
2660
|
+
`,Wy=x4;var Ly=_4`
|
|
2655
2661
|
:root {
|
|
2656
2662
|
// Borders
|
|
2657
2663
|
--privy-border-radius-sm: 6px;
|
|
@@ -2683,10 +2689,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2683
2689
|
--privy-height-modal-full: 620px;
|
|
2684
2690
|
--privy-height-modal-compact: 480px;
|
|
2685
2691
|
};
|
|
2686
|
-
`,
|
|
2692
|
+
`,Oy=S4.div`
|
|
2687
2693
|
// css normalize only the privy application to avoid conflicts
|
|
2688
2694
|
// with consuming application
|
|
2689
|
-
${
|
|
2695
|
+
${Wy}
|
|
2690
2696
|
|
|
2691
2697
|
// Privy styles
|
|
2692
2698
|
color: var(--privy-color-foreground-2);
|
|
@@ -2745,4 +2751,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2745
2751
|
opacity: 1;
|
|
2746
2752
|
}
|
|
2747
2753
|
}
|
|
2748
|
-
`;import{jsx as Ge,jsxs as Ry}from"react/jsx-runtime";var bE={["LANDING"]:qf,["CONNECT_OR_CREATE"]:Vf,["AWAITING_PASSWORDLESS_CODE"]:_u,["AWAITING_CONNECTION"]:$u,["AWAITING_CONNECT_ONLY_CONNECTION"]:Ju,["AWAITING_FARCASTER_CONNECTION"]:Xm,["AWAITING_FARCASTER_SIGNER"]:af,["PHANTOM_INTERSTITIAL_SCREEN"]:cy,["LOGIN_FAILED_SCREEN"]:Qf,["AWAITING_OAUTH_SCREEN"]:iy,["ALLOWLIST_REJECTION_SCREEN"]:gu,["INSTALL_PHANTOM_SCREEN"]:Cf,["LINK_EMAIL_SCREEN"]:$f,["LINK_PHONE_SCREEN"]:jf,["LINK_WALLET_SCREEN"]:Kf,["UPDATE_EMAIL_SCREEN"]:xy,["CONNECT_ONLY_LANDING_SCREEN"]:Vu,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Bu,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Om,["EMBEDDED_WALLET_CREATED_SCREEN"]:om,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:tm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Fm,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:sm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:vy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:yy,["FIAT_ON_RAMP_PROMPT_SCREEN"]:uf,["FIAT_ON_RAMP_STATUS_SCREEN"]:ff,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Dm,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Nm,["MFA_ENROLLMENT_FLOW_SCREEN"]:uh,["CAPTCHA_SCREEN"]:Iu,["ERROR_SCREEN"]:Um,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:hf,["AFFIRMATIVE_CONSENT_SCREEN"]:hu},EE=["LANDING","AWAITING_CONNECTION"],TE=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=W(),{ready:a,currentScreen:i}=_(),{status:l,execute:s,reset:d,enabled:u}=fe(),y=vE(null),f=ru(y),g=o&&i&&EE.includes(i)&&!n&&l==="ready";if(ky(()=>{g&&s()},[g]),ky(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return Ry(Sn,{id:"privy-modal-content",children:[Ge(A,{}),Ge(K,{}),Ge(th,{children:Ge(ft,{})}),Ge(oe,{}),Ge(X,{})]});if(!i&&e)return Ge(Sn,{style:{height:f},id:"privy-modal-conent",children:Ge("div",{ref:y,children:Ge(Yc,{open:e,onClose:t})})});if(!i)return null;let E=bE[i];return Ge(Sn,{style:{height:f},id:"privy-modal-content",children:Ry("div",{ref:y,children:[Ge(Ar,{if:!!e,children:Ge(E,{})}),Ge(Ar,{if:!e,children:Ge(Yc,{open:e,onClose:t})})]})})},PE=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:gE(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Iy=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=PE(),[o,n]=wE(!1);Tl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ge(Ay,{children:Ge(TE,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ge(eh,{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 CE.createPortal(l,s)}return l};import{useState as xE}from"react";import{useEffect as My,useRef as Wy}from"react";var qs=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 Wo(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 ye("missing_or_invalid_mfa","MFA verification failed, retry."));let y=await new Promise((f,g)=>{r.current={resolve:f,reject:g};let E=1e3*60*5;setTimeout(()=>{let v=new ye("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},E)});return await e(y)}return await e()},s=4,d=null;for(let u=0;u<s;u++)try{d=await l(u),o.current?.resolve(void 0);break}catch(y){if(y.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),y}if(d===null){let u=new ye("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return d}import{jsx as IE}from"react/jsx-runtime";var SE=function(e){return()=>`id-${e++}`}(0);function _E(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ve(e){return e.error!==void 0}var Ie=new qs,Qc=new Map,AE=(e,t)=>typeof t=="bigint"?t.toString():t,kE=(e,t)=>`${e}${JSON.stringify(t,AE)}`;function ze(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=kE(e,t);if(e==="privy:wallet:create"){let l=Qc.get(a);if(l)return l}let i=new Promise((l,s)=>{let d=SE();Ie.enqueue(d,{resolve:l,reject:s}),n.postMessage({id:d,event:e,data:t},o)}).finally(()=>{Qc.delete(a)});return Qc.set(a,i),i}function RE(e){switch(e.event){case"privy:iframe:ready":let t=Ie.dequeue(e.event,e.id);return Ve(e)?t.reject(new ye(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ie.dequeue(e.event,e.id);return Ve(e)?r.reject(new ye(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ie.dequeue(e.event,e.id);return Ve(e)?o.reject(new ye(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ie.dequeue(e.event,e.id);return Ve(e)?n.reject(new ye(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=Ie.dequeue(e.event,e.id);return Ve(e)?a.reject(new ye(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=Ie.dequeue(e.event,e.id);return Ve(e)?i.reject(new ye(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=Ie.dequeue(e.event,e.id);return Ve(e)?l.reject(new ye(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Ly(e){let t=Wy(null),r=Wy(e.mfaMethods),o=iu(),[n,a]=xE(!1);return My(()=>{r.current=e.mfaMethods},[e.mfaMethods]),My(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&_E(f.data)&&RE(f.data)}let s={create(f){return ze("privy:wallet:create",f,i,e.origin)},connect(f){return ze("privy:wallet:connect",f,i,e.origin)},recover(f){return Wo(g=>ze("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return Wo(g=>ze("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return Wo(g=>ze("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return Wo(g=>ze("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return Wo(g=>ze("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return ze("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return Wo(g=>ze("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return ze("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return ze("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return ze("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return ze("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return ze("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return ze("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return ze("privy:farcaster:remove-link",f,i,e.origin)}};window.addEventListener("message",l);let d=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},y=new AbortController;return Jd(()=>ze("privy:iframe:ready",{},i,e.origin),{abortSignal:y.signal}).then(d,u),()=>{window.removeEventListener("message",l),y.abort()}},[n]),IE("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Zi(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function $s(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var js=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new S("action required");if(!this.api)throw new S("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new S("phone number must be set when initialzing authentication.");try{await this.api.post(kd,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw ue(t)}}async authenticate(){if(!this.meta.action)throw new S("action required");if(!this.api)throw new S("Mfa flow has no API instance");if(!this.meta.smsCode)throw new S("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new S("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(Rd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return Ct(t)}catch(t){throw ue(t)}}};import{jsx as Er,jsxs as Oy}from"react/jsx-runtime";var Un;function OE(e){return typeof e=="string"&&e.length===25}function ve(){if(!Un){let e=j.get(mo);return Promise.resolve(e||null)}return Un.getAccessToken()}var Ny,hp=(e,t)=>Ny(e,t),Dy,yp=(e,t)=>Dy(e,t),Fy,gp=(e,t)=>Fy(e,t),Uy,vp=()=>Uy(),NE=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;j.put(Hn,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},DE=({config:e,...t})=>{if(!OE(t.appId))throw new S("Cannot initialize the Privy provider with an invalid Privy app ID");Un||(Un=new Qn({appId:t.appId,apiUrl:t.apiUrl||$i}));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."),Er($p,{client:Un,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Er(FE,{...t,config:r,client:Un})})},FE=e=>{let t=e.client,[r,o]=Me(!1),[n,a]=Me(!1),[i,l]=Me(!1),[s,d]=Me(null),[u,y]=Me([]),f=Fn(u),[g,E]=Me(!1),[v,x]=Me(null),[C,P]=Me(!1),[R,M]=Me({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[k,B]=Me(null),[U,H]=Me(null),[T,q]=Me(null),O=Sa(),Y=_a(),[se,re]=Me(!0),[te,z]=Me({}),[Pe,we]=Me(null),[Tr,yt]=Me(null),[Ae,ge]=Me(!1),[gt,Ut]=Me(!1),Nr=Fn(null),tr=Fn(null),L=Fn(ou);t.onStoreToken=c=>{c&&N(L,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{N(L,"accessToken","onAccessTokenRemoved")};let J=Fn(null),Q=Fn(null),Bn=WE(c=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(h=>h.type==="wallet"&&h.walletClientType==="privy")?p&&c?.some(h=>h?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),$=c=>{x(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:c})},We=c=>{O.embeddedWallets.createOnLogin!=="off"&&re(!0),$(c)};Or(()=>{if(!T||!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(c&&c.length>0){let p=c[0].address;t.connectors?.addEmbeddedWalletConnector(T,p,O.defaultChain,e.appId)}},[T,s]),Or(()=>{T&&Tr?.(T)},[T]),Or(()=>{(async()=>{if(!O.customAuth?.enabled)return;re(!0);let{getCustomAccessToken:p,isLoading:m}=O.customAuth;if(!(!n||m))try{let h=await p();if(!h&&i){await Lo.logout();return}if(!h||i)return;t.startAuthFlow(new No(h));let{user:I,isNewUser:D}=await t.authenticate();if(!I){await Lo.logout();return}d(I||null),E(D||!1),l(!0),Ut(!0)}catch(h){console.warn(h),i&&await Lo.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,i]),Or(()=>{gt&&T&&s&&At(s,e.config?.embeddedWallets?.createOnLogin)&&(Ut(!1),or(s,Fo).catch(console.error))},[gt&&T&&s]),Or(()=>{async function c(){let p=pt();NE();let m=ME();B(m),t.initializeConnectorManager({walletConnectCloudProjectId:O.walletConnectCloudProjectId,rpcConfig:O.rpcConfig,chains:O.chains,defaultChain:O.defaultChain,store:m,walletList:O.appearance.walletList,shouldEnforceDefaultChainOnConnect:O.shouldEnforceDefaultChainOnConnect,appName:O.name??"Privy"}),t.connectors?.initialize().then(()=>{Ys()});let h=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!h),h&&N(L,"login","onComplete",h,!1,!0,null),d(h)),p||ie.setReadyToTrue(),p&&(h?Q.current="link":Q.current="login")}!n&&Y&&c()},[t,Pe,n,Y]);let pt=()=>{let c=qn();return!c.inProgress||c.headless?!1:(t.startAuthFlow(new ir(c)),We("AWAITING_OAUTH_SCREEN"),!0)},co=async(c,p,m,h)=>{let I=await t.connectors?.createWalletConnector(c,p)||null;Bt(I,p,m,h)};async function Bt(c,p,m,h){if(c)M({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:b});else return M({status:"disconnected",connectedWallet:null,connectError:new Z("Unable to connect to wallet."),connector:null,connectRetry:b}),h?.(null,m);c instanceof cr&&p&&await c.resetConnection(p),M({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Bt(c,p,m,h)});try{let I=await c.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(D=>D.id===Number(I?.chainId))&&!(I?.connectorType==="wallet_connect_v2"&&I?.walletClientType==="metamask")){M(D=>({...D,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await I?.switchChain(O.defaultChain.id),I&&(I.chainId=Bo(go(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return M(D=>({...D,status:"connected",connectedWallet:I,connectError:null,connectRetry:b})),I&&!Q.current&&N(L,"connectWallet","onSuccess",I),h?.(I,m)}catch(I){return I instanceof $e?(console.warn(I.cause?I.cause:I.message),Q.current||N(L,"connectWallet","onError",I.privyErrorCode||"generic_connect_wallet_error")):(console.warn(I),Q.current||N(L,"connectWallet","onError","unknown_connect_wallet_error")),M(D=>({...D,status:"disconnected",connectedWallet:null,connectError:I})),h?.(null,m)}}let po=async(c,p)=>{if(c===null)return;let m=new vo(c,p);t.startAuthFlow(m)},Ys=()=>{let c=new URLSearchParams(window.location.search),p=c.get("privy_connector"),m=c.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Ur()&&We("LOGIN_FAILED_SCREEN"),!t.connectors)throw new S("Connector not initialized");$("AWAITING_CONNECTION");let h=new URL(window.location.href);h.searchParams.delete("privy_connector"),h.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",h),co(p,m,void 0,po)};Or(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(d)},[n,i,s,t]);let Le=()=>{if(!i)throw N(L,"linkAccount","onError","must_be_authenticated"),new S("User must be authenticated before linking an account.")},uo=()=>{Le(),J.current="siwe",Q.current="link",$("LINK_WALLET_SCREEN")},vt=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===c.address&&p.walletClientType!=="privy")return!0;return!1},qe=async c=>{if(!t.connectors)throw new S("Connector not initialized");let p=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(M(m=>({...m,connector:p,status:"connected",connectedWallet:c,connectError:null,connectRetry:b})),O.captchaEnabled&&!i){let m={callback:h=>po(c,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};z({captchaModalData:m}),We("CAPTCHA_SCREEN")}else await po(c),We("AWAITING_CONNECTION")},rr=async(c,p)=>{if(!O.fiatOnRamp.enabled)throw new S("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:h}=await df(t,c,p?.config??{},O.appearance.palette,O.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:h}}else throw new S("Unsupported fund provider. Currently supported option is `moonpay`.")},Dr=()=>{y(c=>{let p=t.connectors?.wallets.map(m=>({...m,linked:vt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new S("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new S("Cannot link or login with embedded wallet");qe(m)},fund:async h=>{let{signedUrl:I,externalTransactionId:D}=await rr(m.address,h);z({fiatOnRampPrompt:{signedUrl:I},fiatOnRampStatus:{externalTransactionId:D}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new S("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new S("Cannot unlink an embedded wallet");let h=await t.unlinkWallet(m.address);d(h)}}))||[];return ge(Bn(p)),ia(c,p)?c:p})};Or(()=>{Dr()},[s?.linkedAccounts,i,n]),Or(()=>{if(n){if(!t.connectors)throw new S("Connector not initialized");Dr(),t.connectors.on("walletsUpdated",Dr)}},[n]);let Ni=()=>{$(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Or(()=>{if(!u[0])return;let c=u[0],p=f.current.find(h=>h.address===c.address),m;if(c.walletClientType==="privy"?m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType==="privy"):m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType!=="privy"),!p&&m){let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}f.current=u},[u]);let or=async(c,p)=>{if(Ce(c))throw N(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[h,I]=await Promise.all([ie.initializeWalletProxy(p),ve()]);if(!h&&e.config?.customAuth?.enabled)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!h||!I||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((D,le)=>{re(!0),z({createWallet:{onSuccess:ut=>{N(L,"createWallet","onSuccess",ut),D(ut)},onFailure:ut=>{N(L,"createWallet","onError","unknown_embedded_wallet_error"),le(ut)},callAuthOnSuccessOnClose:!1}}),$("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await h.create({accessToken:I});let D=await ie.refreshUser(),le=Ce(D);if(!le)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(L,"createWallet","onSuccess",le),le}},Js=c=>{if(!O.chains.map(p=>p.id).includes(c))throw new Z(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},ed=(c,p,m)=>new Promise(async(h,I)=>{if(!i||!s){N(L,"sendTransaction","onError","must_be_authenticated"),I(new Error("User must be authenticated before signing with a Privy wallet"));return}let D=Ce(s);if(!D){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have a Privy wallet before signing"));return}re(!0);let le=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,et=c.chainId?Number(c.chainId):le.chainId;Js(et);let ut=Object.assign({},c,{chainId:et}),Pr=async()=>{let tt=await ve();if(!tt||!T){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ie.recoverEmbeddedWallet()){N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(new Error("Unable to connect to wallet"));return}let Vt=Sr(ut.chainId,O.chains,O.rpcConfig,{appId:e.appId}),Zs=await Ln(D.address,ut,Vt);if(O.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:zy}=await Wn(Zs,Vt),{hasSufficientFunds:qy}=await Bs(D.address,Zs,zy,Vt);if(!qy)throw new xe(new kt("Wallet has insufficient funds for this transaction.",je.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let od=await Us(tt,D.address,T,Zs,Vt);N(L,"sendTransaction","onSuccess",od),h(od)}catch(Gt){N(L,"sendTransaction","onError","transaction_failure"),I(Gt)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Pr();else{let tt={transactionRequest:ut,onSuccess:Vt=>{N(L,"sendTransaction","onSuccess",Vt),h(Vt)},onFailure:Vt=>{N(L,"sendTransaction","onError","transaction_failure"),I(Vt)},uiOptions:p||{},fundWalletConfig:m},Gt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Vt=>{N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(Vt)}};z({connectWallet:Gt,sendTransaction:tt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function td(){return new Promise(async(c,p)=>{let m=await ve();if(!m||!T)throw new Error("Must have valid access token to enroll in MFA");try{await T.verifyMfa({accessToken:m}),c()}catch(h){p(h)}})}let Ht=c=>{if(s?.[c])throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new S(`User already has an account of type ${c} linked.`)},Lo={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:Ni,linkWallet:uo,linkEmail:()=>{Le(),Ht("email"),J.current="email",Q.current="link",$("LINK_EMAIL_SCREEN")},linkPhone:()=>{Le(),Ht("phone"),J.current="sms",Q.current="link",$("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Le(),Ht("google"),Q.current="link",await ie.initLoginWithOAuth("google")},linkTwitter:async()=>{Le(),Ht("twitter"),Q.current="link",await ie.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Le(),Ht("discord"),Q.current="link",await ie.initLoginWithOAuth("discord")},linkGithub:async()=>{Le(),Ht("github"),Q.current="link",await ie.initLoginWithOAuth("github")},linkSpotify:async()=>{Le(),Ht("spotify"),Q.current="link",await ie.initLoginWithOAuth("spotify")},linkTiktok:async()=>{Le(),Ht("tiktok"),Q.current="link",await ie.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Le(),Ht("linkedin"),Q.current="link",await ie.initLoginWithOAuth("linkedin")},linkApple:async()=>{Le(),Ht("apple"),Q.current="link",await ie.initLoginWithOAuth("apple")},linkFarcaster:async()=>{Le(),Ht("farcaster"),await ie.initLoginWithFarcaster(),Q.current="link",J.current="farcaster",$("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Le(),!s?.email)throw new S("User does not have an email linked to their account.");Q.current="link",J.current="email",$("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(null)),i){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}Q.current="login",We("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{we(()=>c)}),we(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}We("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&T)try{await T.clearMfa({userId:s.id})}catch{}d(null),l(!1),x(null),N(L,"logout","onSuccess"),Q.current=null,J.current=null,o(!1),j.del(Gn)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new be;let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new be:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Xc(new ar(new be));let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Xc(new ar(new be)):new Xc(new ar(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Gr(new be);let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Gr(new be):new Gr(p.proxyProvider)},unlinkWallet:async c=>{let p=await t.unlinkWallet(c);return d(p),p},unlinkEmail:async c=>{let p=await t.unlinkEmail(c);return d(p),p},unlinkPhone:async c=>{let p=await t.unlinkPhone(c);return d(p),p},unlinkGoogle:async c=>{let p=await t.unlinkOAuth("google",c);return d(p),p},unlinkTwitter:async c=>{let p=await t.unlinkOAuth("twitter",c);return d(p),p},unlinkDiscord:async c=>{let p=await t.unlinkOAuth("discord",c);return d(p),p},unlinkGithub:async c=>{let p=await t.unlinkOAuth("github",c);return d(p),p},unlinkSpotify:async c=>{let p=await t.unlinkOAuth("spotify",c);return d(p),p},unlinkTiktok:async c=>{let p=await t.unlinkOAuth("tiktok",c);return d(p),p},unlinkLinkedIn:async c=>{let p=await t.unlinkOAuth("linkedin",c);return d(p),p},unlinkApple:async c=>{let p=await t.unlinkOAuth("apple",c);return d(p),p},unlinkFarcaster:async c=>{let p=await t.unlinkFarcaster(c);return d(p),p},setActiveWallet:async c=>{let p=u.find(h=>Ks(h.address)===Ks(c)),m=s?.linkedAccounts.find(h=>h.type==="wallet"&&Ks(h.address)===Ks(c));if(!p||!await p.isConnected())H(c),uo();else if(!p.linked)p.loginOrLink();else{let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}},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 or(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 c=Ce(s);if(!c||!T)throw N(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(c.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 td()}catch(p){throw N(L,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{re(!0);let h={onSuccess:D=>{N(L,"setWalletPassword","onSuccess",D),p(D)},onFailure:D=>{N(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(D)},callAuthOnSuccessOnClose:!1},I={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:D=>{N(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(D)}};z({setWalletPassword:h,connectWallet:I}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signMessage","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=Ce(s);if(!I){N(L,"signMessage","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){N(L,"signMessage","onError","invalid_message"),h(new Error("Message must be a non-empty string"));return}re(!0);let D=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let le=await ve();if(!T||!le)throw new Error("Unable to connect to wallet");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:I.address});let{response:ut}=await T.rpc({accessToken:le,address:I.address,request:{method:"personal_sign",params:[c,I.address]}}),Pr=ut.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:I.address}),Pr};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let le=await D();N(L,"signMessage","onSuccess",le),m(le)}catch(le){N(L,"signMessage","onError","unable_to_sign"),h(le??new xe("Unable to sign message"))}}else{let ut={method:"personal_sign",data:c,confirmAndSign:D,onSuccess:tt=>{N(L,"signMessage","onSuccess",tt),m(tt)},onFailure:tt=>{N(L,"signMessage","onError","unable_to_sign"),h(tt)},uiOptions:p||{}},Pr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:tt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(tt)}};z({signMessage:ut,connectWallet:Pr}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signTypedData","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=Ce(s);if(!I){N(L,"signTypedData","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}re(!0);let D=Xi(c),le=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let et=await ve();if(!T||!et)throw new Error("Unable to connect to wallet");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:I.address});let{response:Pr}=await T.rpc({accessToken:et,address:I.address,request:{method:"eth_signTypedData_v4",params:[I.address,D]}}),tt=Pr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:I.address}),tt};if(O.embeddedWallets.noPromptOnSignature||(O.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let et=await le();N(L,"signTypedData","onSuccess",et),m(et)}catch(et){N(L,"signTypedData","onError","unable_to_sign"),h(et??new xe("Unable to sign message"))}}else{let Pr={method:"eth_signTypedData_v4",data:D,confirmAndSign:le,onSuccess:Gt=>{N(L,"signTypedData","onSuccess",Gt),m(Gt)},onFailure:Gt=>{N(L,"signTypedData","onError","unable_to_sign"),h(Gt)},uiOptions:p||{}},tt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Gt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(Gt)}};z({signMessage:Pr,connectWallet:tt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,p,m)=>{let I=await(await ed(c,p,m)).wait();return Hs(I)},exportWallet:()=>new Promise(async(c,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=Ce(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}re(!0);let h={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},I=await ve();if(!I||!T){p(new Error("Must have valid access token to enroll in MFA"));return}if(!T){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await T.connect({accessToken:I,address:m.address}),await T.verifyMfa({accessToken:I})}catch(le){if(So(le))await ie.recoverEmbeddedWallet();else throw le}}catch(le){p(le);return}let D={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:p};z({keyExport:D,connectWallet:h}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:td,async init(c){let p;switch(c){case"sms":p=new js("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}t.startMfaFlow(p),await p.init()},async submit(c,p){switch(c){case"totp":case"sms":Nr.current?.resolve({mfaMethod:c,mfaCode:p}),await new Promise((m,h)=>{tr.current={resolve:m,reject:h}});break;default:throw Nr.current?.reject(new S("Unsupported MFA method")),new S(`Unsupported MFA method: ${c}`)}},cancel(){Nr.current?.reject(new S("MFA canceled"))},async initEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((p,m)=>{if(!c){ie.closePrivyModal(),p();return}O.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."),z({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:m}}),$("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await ve();if(!c||!T)throw new Error("Must have valid access token to enroll in MFA");let p=await T.initEnrollMfa({method:"totp",accessToken:c});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async submitEnrollmentWithTotp(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"totp",accessToken:p,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async unenroll(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to remove MFA");await T.unenrollMfa({method:c,accessToken:p});let m=await t.getAuthenticatedUser();d(m)},requestFarcasterSigner:async()=>{let c=await ve(),p=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let h=await T.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null});if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}z({farcasterSigner:h}),$("AWAITING_FARCASTER_SIGNER")},submitCast:async c=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(le=>le.type==="wallet"&&le.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(le=>le.type==="wallet"&&le.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:C,loginWithCode(c){return ie.loginWithCode(c)},initLoginWithEmail(c){return ie.initLoginWithEmail(c)},initLoginWithSms(c){return ie.initLoginWithSms(c)},fundWallet(c,p){return ie.fundWallet(c,p)},initLoginWithHeadlessOAuth(c,p){return ie.initLoginWithHeadlessOAuth(c,p)},loginWithHeadlessOAuth(c){return ie.loginWithHeadlessOAuth(c)},isModalOpen:r};Ny=Lo.signMessage,Dy=Lo.signTypedData,Fy=async(...c)=>{let p=await ed(...c);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let rd=!!e.config?.headless,ie=(()=>({headless:rd,isNewUserThisSession:g,linkingHint:U,pendingTransaction:null,walletConnectionStatus:R,mipdStore:k,connectors:t.connectors?.walletConnectors??[],rpcConfig:O.rpcConfig,chains:O.chains,appId:e.appId,showFiatPrices:O.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>O.chains.find(p=>p.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(T)return T;let p=new Promise(I=>{yt(()=>D=>I(D))}),m=new Promise(I=>setTimeout(()=>I(null),c)),h=await Promise.race([p,m]);return yt(null),h},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;Q.current==="login"?c.shouldCallAuthOnSuccess&&p?(N(L,"login","onComplete",s,g,!1,J.current??null),e.onSuccess?.(s,g)):N(L,"login","onError","exited_auth_flow"):Q.current==="link"&&J.current&&(c.isSuccess&&p?N(L,"linkAccount","onSuccess",s,J.current):N(L,"linkAccount","onError","exited_link_flow")),H(null),Q.current=null,J.current=null,E(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:$,connectWallet:Bt,initLoginWithWallet:async(c,p)=>{J.current="siwe",po(c,p)},loginWithWallet:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof vo))throw new S("Must initialize SIWE flow first.");let c,p;if(i)try{c=await t.link(),J.current="siwe"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),J.current="siwe"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}d(c||s||null),E(p||!1),l(!0)},initLoginWithFarcaster:async c=>{let p=new Vn(c);t.startAuthFlow(p);try{J.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw Q.current==="login"?N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Oo;if(!(t.authFlow instanceof Vn))throw new S("Must initialize Farcaster flow first.");let c,p;if(i)try{c=await t.link(),J.current="farcaster"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),J.current="farcaster"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}d(c||null),E(p||!1),l(!0)},async initLoginWithOAuth(c,p){if(J.current=c,tl()){if(c==="google"&&$s(window.navigator.userAgent)){We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}j.del(ho);let m=new ir({provider:c});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let h=await t.authFlow.getAuthorizationUrl();h&&h.url&&window.location.assign(h.url)},async loginWithOAuth(c){if(!(t.authFlow instanceof ir))throw new S("Must initialize OAuth flow before calling loginWithOAuth");let p=j.get(fo),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c,storedStateCode:p??"",returnedStateCode:m??""}),new S("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),J.current=c}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),J.current=c}catch(D){throw Q.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}d(h),E(I||!1),l(!0)},async initLoginWithHeadlessOAuth(c,p){if(tl()){if(c==="google"&&$s(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 ir({provider:c,headless:!0});p&&m.addCaptchaToken(p);let h=await t.startAuthFlow(m).getAuthorizationUrl();h?.url&&window.location.assign(h.url)},async loginWithHeadlessOAuth(c){P(!0),t.startAuthFlow(new ir(c));let p=j.get(fo),m=c.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c.provider,storedStateCode:p??"",returnedStateCode:m??""}),P(!1),new S("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),J.current=c.provider}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),J.current=c.provider}catch(D){throw Q.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}return d(h),E(I||!1),l(!0),P(!1),h??void 0},initLoginWithEmail:async(c,p)=>{let m=new Fr(c,p);t.startAuthFlow(m);try{J.current="email",await m.sendCodeEmail()}catch(h){throw Q.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},initUpdateEmail:async(c,p,m)=>{let h=new Vi(c,p,m);t.startAuthFlow(h),await h.sendCodeEmail()},initLoginWithSms:async(c,p)=>{let m=new wo(c,p);t.startAuthFlow(m);try{J.current="sms",await m.sendSmsCode()}catch(h){throw Q.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(!n)throw new Oo;if(t.authFlow instanceof Fr)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof wo)t.authFlow.meta.smsCode=c.trim();else throw new S("Must initialize a passwordless code flow first");let p,m;if(i)try{p=await t.link()}catch(h){throw N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:p,isNewUser:m}=await t.authenticate())}catch(h){throw N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}d(p||s||null),E(m||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return d(c),c},walletProxy:T,createAnalyticsEvent:(c,p,m)=>t.createAnalyticsEvent(c,p,m),acceptTerms:async()=>{let c=await t.acceptTerms();return d(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:async()=>new Promise(async(c,p)=>{let m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy"),h=await ve();if(!h||!T||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}re(!0);try{await T.connect({accessToken:h,address:m.address}),c(!0)}catch(I){So(I)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await T.recover({address:m.address,accessToken:h})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),c(!0)):So(I)?(z({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>c(!0)}}),$("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(I)}}),getFiatOnRampConfig:rr,setReadyToTrue:()=>{a(!0),Pe?.()},updateWallets:()=>Dr(),fundWallet:async(c,p)=>{let{signedUrl:m,externalTransactionId:h}=await rr(c,p);z({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:h}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let p=await ve(),m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 h=await t.requestFarcasterSignerStatus(c);if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}return h}}))();Uy=ie.recoverEmbeddedWallet;let Vy=LE(()=>({wallets:u,ready:Ae}),[u,Ae]);return Er(ce.Provider,{value:Lo,children:Er(El.Provider,{value:L,children:Er(qc.Provider,{value:Vy,children:Oy(eu,{...O,children:[e.children,Oy(bl.Provider,{value:ie,children:[!rd&&O.captchaEnabled&&n&&!i&&Er(Cl,{delayedExecution:!1}),Er(_y,{theme:{...O.appearance.palette||{}}}),Er(Kp,{data:te,setModalData:z,setInitialScreen:x,initialScreen:v,authenticated:i,open:r,children:Er(Iy,{open:r})}),se&&Y?Er(Ly,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Nr,mfaSubmitPromise:tr,onLoad:q,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as UE}from"react";function BE(e){let{login:t}=UE(ce);return Ee("login",e),{login:t}}import{useContext as HE}from"react";function GE(e){let{logout:t}=HE(ce);return Ee("logout",e),{logout:t}}import{useCallback as By,useEffect as VE}from"react";function zE(){let e=fe(),t=_a(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=By(async d=>{if(e.enabled&&e.status!=="success")throw new qt(e.error,null,"captcha_failure");return r(d.provider,e.token)},[r,e]),s=By(async()=>{let d=qn();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!d.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(d)}catch(u){throw u}finally{$n()}},[o]);return VE(()=>{let d=qn();a&&t&&d.inProgress&&d.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Hy}from"react";var qE=()=>{let e=fe(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=Hy(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=Hy(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 Gy}from"react";var $E=()=>{let e=fe(),{initLoginWithSms:t,loginWithCode:r}=G(),o=Gy(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),n=Gy(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new qt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useContext as jE}from"react";function KE(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}=jE(ce);return Ee("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}}import{useContext as YE}from"react";function JE(e){let{connectWallet:t}=YE(ce);return Ee("connectWallet",e),{connectWallet:t}}import{useContext as ZE}from"react";function QE(e){let{createWallet:t}=ZE(ce);return Ee("createWallet",e),{createWallet:t}}var XE=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as e4}from"react";function t4(e){let{sendTransaction:t}=e4(ce);return Ee("sendTransaction",e),{sendTransaction:t}}import{useContext as r4}from"react";function o4(e){let{setWalletPassword:t}=r4(ce);return Ee("setWalletPassword",e),{setWalletPassword:t}}import{useContext as n4}from"react";function i4(e){let{signMessage:t}=n4(ce);return Ee("signMessage",e),{signMessage:t}}import{useContext as a4}from"react";function s4(e){let{signTypedData:t}=a4(ce);return Ee("signTypedData",e),{signTypedData:t}}import{useContext as l4}from"react";var c4=()=>{let{isModalOpen:e}=l4(ce);return{isOpen:e}};import{useContext as d4}from"react";function p4(e){let{getAccessToken:t}=d4(ce);return Ee("accessToken",e),{getAccessToken:t}}function u4(){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 m4(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{ar as AsExternalProvider,Cl as Captcha,Zn as ConnectorManager,Qn as PrivyClient,DE as PrivyProvider,be as PrivyProxyProvider,Yn as SUPPORTED_CHAINS,il as VERSION,mt as WalletConnector,m4 as addRpcUrlOverrideToChain,Yl as errorIndicatesMaxMfaRetries,mn as errorIndicatesMfaTimeout,fn as errorIndicatesMfaVerificationFailed,ve as getAccessToken,JE as useConnectWallet,QE as useCreateWallet,u4 as useExperimentalFarcasterSigner,XE as useFundWallet,KE as useLinkAccount,BE as useLogin,qE as useLoginWithEmail,zE as useLoginWithOAuth,$E as useLoginWithSms,GE as useLogout,An as useMfa,Si as useMfaEnrollment,c4 as useModalStatus,G as usePrivy,Tl as useRegisterMfaListener,t4 as useSendTransaction,o4 as useSetWalletPassword,i4 as useSignMessage,s4 as useSignTypedData,p4 as useToken,Wi as useWallets};
|
|
2754
|
+
`;import{jsx as Ge,jsxs as Dy}from"react/jsx-runtime";var M4={["LANDING"]:Kf,["CONNECT_OR_CREATE"]:$f,["AWAITING_PASSWORDLESS_CODE"]:Ru,["AWAITING_CONNECTION"]:Yu,["AWAITING_CONNECT_ONLY_CONNECTION"]:Xu,["AWAITING_FARCASTER_CONNECTION"]:rf,["AWAITING_FARCASTER_SIGNER"]:cf,["PHANTOM_INTERSTITIAL_SCREEN"]:uy,["LOGIN_FAILED_SCREEN"]:th,["AWAITING_OAUTH_SCREEN"]:ly,["ALLOWLIST_REJECTION_SCREEN"]:Cu,["INSTALL_PHANTOM_SCREEN"]:Tf,["LINK_EMAIL_SCREEN"]:Yf,["LINK_PHONE_SCREEN"]:Zf,["LINK_WALLET_SCREEN"]:Jf,["UPDATE_EMAIL_SCREEN"]:My,["CONNECT_ONLY_LANDING_SCREEN"]:$u,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Vu,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Fm,["EMBEDDED_WALLET_CREATED_SCREEN"]:am,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:nm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Hm,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:yy,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:dm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:xy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Ty,["FIAT_ON_RAMP_PROMPT_SCREEN"]:hf,["FIAT_ON_RAMP_STATUS_SCREEN"]:gf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Bm,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Um,["MFA_ENROLLMENT_FLOW_SCREEN"]:hh,["CAPTCHA_SCREEN"]:Lu,["ERROR_SCREEN"]:Gm,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:vf,["AFFIRMATIVE_CONSENT_SCREEN"]:vu},W4=["LANDING","AWAITING_CONNECTION"],L4=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=G(),{headless:n}=W(),{ready:a,currentScreen:i}=A(),{status:l,execute:s,reset:d,enabled:u}=fe(),y=k4(null),f=iu(y),g=o&&i&&W4.includes(i)&&!n&&l==="ready";if(Ny(()=>{g&&s()},[g]),Ny(()=>{!o&&u&&d()},[o,u]),(!r||!a)&&i!=="AWAITING_OAUTH_SCREEN")return Dy(_n,{id:"privy-modal-content",children:[Ge(S,{}),Ge(K,{}),Ge(nh,{children:Ge(ft,{})}),Ge(oe,{}),Ge(X,{})]});if(!i&&e)return Ge(_n,{style:{height:f},id:"privy-modal-conent",children:Ge("div",{ref:y,children:Ge(Qc,{open:e,onClose:t})})});if(!i)return null;let E=M4[i];return Ge(_n,{style:{height:f},id:"privy-modal-content",children:Dy("div",{ref:y,children:[Ge(Ar,{if:!!e,children:Ge(E,{})}),Ge(Ar,{if:!e,children:Ge(Qc,{open:e,onClose:t})})]})})},O4=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=A();return{gracefulClosePrivyModal:A4(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Fy=({open:e})=>{let{app:t}=A(),{gracefulClosePrivyModal:r}=O4(),[o,n]=R4(!1);Sl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let a=Ge(Oy,{children:Ge(L4,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),i=e||o,l=t?.render.inDialog?Ge(oh,{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 I4.createPortal(l,s)}return l};import{useState as N4}from"react";import{useEffect as Uy,useRef as By}from"react";var Ks=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 Lo(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 ye("missing_or_invalid_mfa","MFA verification failed, retry."));let y=await new Promise((f,g)=>{r.current={resolve:f,reject:g};let E=1e3*60*5;setTimeout(()=>{let v=new ye("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},E)});return await e(y)}return await e()},s=4,d=null;for(let u=0;u<s;u++)try{d=await l(u),o.current?.resolve(void 0);break}catch(y){if(y.type==="missing_or_invalid_mfa")i=!0;else throw o.current?.resolve(void 0),y}if(d===null){let u=new ye("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return d}import{jsx as G4}from"react/jsx-runtime";var D4=function(e){return()=>`id-${e++}`}(0);function F4(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Ve(e){return e.error!==void 0}var Ie=new Ks,td=new Map,U4=(e,t)=>typeof t=="bigint"?t.toString():t,B4=(e,t)=>`${e}${JSON.stringify(t,U4)}`;function ze(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let a=B4(e,t);if(e==="privy:wallet:create"){let l=td.get(a);if(l)return l}let i=new Promise((l,s)=>{let d=D4();Ie.enqueue(d,{resolve:l,reject:s}),n.postMessage({id:d,event:e,data:t},o)}).finally(()=>{td.delete(a)});return td.set(a,i),i}function H4(e){switch(e.event){case"privy:iframe:ready":let t=Ie.dequeue(e.event,e.id);return Ve(e)?t.reject(new ye(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Ie.dequeue(e.event,e.id);return Ve(e)?r.reject(new ye(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Ie.dequeue(e.event,e.id);return Ve(e)?o.reject(new ye(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Ie.dequeue(e.event,e.id);return Ve(e)?n.reject(new ye(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let a=Ie.dequeue(e.event,e.id);return Ve(e)?a.reject(new ye(e.error.type,e.error.message)):a.resolve(e.data);case"privy:wallet:set-recovery-password":let i=Ie.dequeue(e.event,e.id);return Ve(e)?i.reject(new ye(e.error.type,e.error.message)):i.resolve(e.data);case"privy:mfa:verify":let l=Ie.dequeue(e.event,e.id);return Ve(e)?l.reject(new ye(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:react-to-cast":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:submit-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:remove-link":{let s=Ie.dequeue(e.event,e.id);return Ve(e)?s.reject(new ye(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Hy(e){let t=By(null),r=By(e.mfaMethods),o=lu(),[n,a]=N4(!1);return Uy(()=>{r.current=e.mfaMethods},[e.mfaMethods]),Uy(()=>{if(!n)return;let i=t.current;if(!i)return;function l(f){f&&f.origin===e.origin&&F4(f.data)&&H4(f.data)}let s={create(f){return ze("privy:wallet:create",f,i,e.origin)},connect(f){return ze("privy:wallet:connect",f,i,e.origin)},recover(f){return Lo(g=>ze("privy:wallet:recover",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(f){return Lo(g=>ze("privy:wallet:rpc",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(f){return Lo(g=>ze("privy:wallet:set-recovery-password",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(f){return Lo(g=>ze("privy:mfa:verify",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(f){return Lo(g=>ze("privy:mfa:init-enrollment",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(f){return ze("privy:mfa:submit-enrollment",f,i,e.origin)},unenrollMfa(f){return Lo(g=>ze("privy:mfa:unenroll",{...f,...g},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(f){return ze("privy:mfa:clear",f,i,e.origin)},initFarcasterSigner(f){return ze("privy:farcaster:init-signer",f,i,e.origin)},submitCast(f){return ze("privy:farcaster:submit-cast",f,i,e.origin)},removeCast(f){return ze("privy:farcaster:remove-cast",f,i,e.origin)},reactToCast(f){return ze("privy:farcaster:react-to-cast",f,i,e.origin)},submitLink(f){return ze("privy:farcaster:submit-link",f,i,e.origin)},removeLink(f){return ze("privy:farcaster:remove-link",f,i,e.origin)}};window.addEventListener("message",l);let d=()=>e.onLoad(s),u=(...f)=>{console.warn("Privy iframe failed to load: ",...f),e.onLoadFailed()},y=new AbortController;return Xd(()=>ze("privy:iframe:ready",{},i,e.origin),{abortSignal:y.signal}).then(d,u),()=>{window.removeEventListener("message",l),y.abort()}},[n]),G4("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>a(!0),src:Xi(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Ys(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var Zs=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new _("action required");if(!this.api)throw new _("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new _("phone number must be set when initialzing authentication.");try{await this.api.post(Md,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw ue(t)}}async authenticate(){if(!this.meta.action)throw new _("action required");if(!this.api)throw new _("Mfa flow has no API instance");if(!this.meta.smsCode)throw new _("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new _("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(Wd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return Ct(t)}catch(t){throw ue(t)}}};import{jsx as Er,jsxs as Gy}from"react/jsx-runtime";var Hn;function $4(e){return typeof e=="string"&&e.length===25}function ve(){if(!Hn){let e=j.get(fo);return Promise.resolve(e||null)}return Hn.getAccessToken()}var Vy,vp=(e,t)=>Vy(e,t),zy,wp=(e,t)=>zy(e,t),qy,Cp=(e,t)=>qy(e,t),$y,bp=()=>$y(),j4=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;j.put(Vn,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},K4=({config:e,...t})=>{if(!$4(t.appId))throw new _("Cannot initialize the Privy provider with an invalid Privy app ID");Hn||(Hn=new ei({appId:t.appId,apiUrl:t.apiUrl||Ki}));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."),Er(Yp,{client:Hn,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:Er(Y4,{...t,config:r,client:Hn})})},Y4=e=>{let t=e.client,[r,o]=Me(!1),[n,a]=Me(!1),[i,l]=Me(!1),[s,d]=Me(null),[u,y]=Me([]),f=Bn(u),[g,E]=Me(!1),[v,x]=Me(null),[C,P]=Me(!1),[R,M]=Me({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[k,B]=Me(null),[U,H]=Me(null),[T,q]=Me(null),O=Aa(),Y=ka(),[se,re]=Me(!0),[te,z]=Me({}),[Se,Ce]=Me(null),[Tr,yt]=Me(null),[Ae,ge]=Me(!1),[gt,Ut]=Me(!1),Dr=Bn(null),tr=Bn(null),L=Bn(au);t.onStoreToken=c=>{c&&N(L,"accessToken","onAccessTokenGranted",c)},t.onDeleteToken=()=>{N(L,"accessToken","onAccessTokenRemoved")};let Z=Bn(null),Q=Bn(null),Gn=z4(c=>{let p=t.connectors?.walletsReady||!1;return i&&s?.linkedAccounts?.some(h=>h.type==="wallet"&&h.walletClientType==="privy")?p&&c?.some(h=>h?.walletClientType==="privy"):p},[i,s?.linkedAccounts,t?.connectors?.walletsReady]),$=c=>{x(c),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:c})},We=c=>{O.embeddedWallets.createOnLogin!=="off"&&re(!0),$(c)};Nr(()=>{if(!T||!s){t.connectors?.removeEmbeddedWalletConnector();return}let c=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(c&&c.length>0){let p=c[0].address;t.connectors?.addEmbeddedWalletConnector(T,p,O.defaultChain,e.appId)}},[T,s]),Nr(()=>{T&&Tr?.(T)},[T]),Nr(()=>{(async()=>{if(!O.customAuth?.enabled)return;re(!0);let{getCustomAccessToken:p,isLoading:m}=O.customAuth;if(!(!n||m))try{let h=await p();if(!h&&i){await Oo.logout();return}if(!h||i)return;t.startAuthFlow(new Do(h));let{user:I,isNewUser:D}=await t.authenticate();if(!I){await Oo.logout();return}d(I||null),E(D||!1),l(!0),Ut(!0)}catch(h){console.warn(h),i&&await Oo.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,i]),Nr(()=>{gt&&T&&s&&At(s,e.config?.embeddedWallets?.createOnLogin)&&(Ut(!1),or(s,Uo).catch(console.error))},[gt&&T&&s]),Nr(()=>{async function c(){let p=pt();j4();let m=V4();B(m),t.initializeConnectorManager({walletConnectCloudProjectId:O.walletConnectCloudProjectId,rpcConfig:O.rpcConfig,chains:O.chains,defaultChain:O.defaultChain,store:m,walletList:O.appearance.walletList,shouldEnforceDefaultChainOnConnect:O.shouldEnforceDefaultChainOnConnect,appName:O.name??"Privy"}),t.connectors?.initialize().then(()=>{Qs()});let h=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!h),h&&N(L,"login","onComplete",h,!1,!0,null),d(h)),p||ie.setReadyToTrue(),p&&(h?Q.current="link":Q.current="login")}!n&&Y&&c()},[t,Se,n,Y]);let pt=()=>{let c=jn();return!c.inProgress||c.headless?!1:(t.startAuthFlow(new ir(c)),We("AWAITING_OAUTH_SCREEN"),!0)},po=async(c,p,m,h)=>{let I=await t.connectors?.createWalletConnector(c,p)||null;Bt(I,p,m,h)};async function Bt(c,p,m,h){if(c)M({status:"disconnected",connectedWallet:null,connectError:null,connector:c,connectRetry:b});else return M({status:"disconnected",connectedWallet:null,connectError:new J("Unable to connect to wallet."),connector:null,connectRetry:b}),h?.(null,m);c instanceof cr&&p&&await c.resetConnection(p),M({connector:c,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Bt(c,p,m,h)});try{let I=await c.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(D=>D.id===Number(I?.chainId))&&!(I?.connectorType==="wallet_connect_v2"&&I?.walletClientType==="metamask")){M(D=>({...D,connector:c,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await I?.switchChain(O.defaultChain.id),I&&(I.chainId=Ho(vo(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return M(D=>({...D,status:"connected",connectedWallet:I,connectError:null,connectRetry:b})),I&&!Q.current&&N(L,"connectWallet","onSuccess",I),h?.(I,m)}catch(I){return I instanceof $e?(console.warn(I.cause?I.cause:I.message),Q.current||N(L,"connectWallet","onError",I.privyErrorCode||"generic_connect_wallet_error")):(console.warn(I),Q.current||N(L,"connectWallet","onError","unknown_connect_wallet_error")),M(D=>({...D,status:"disconnected",connectedWallet:null,connectError:I})),h?.(null,m)}}let uo=async(c,p)=>{if(c===null)return;let m=new wo(c,p);t.startAuthFlow(m)},Qs=()=>{let c=new URLSearchParams(window.location.search),p=c.get("privy_connector"),m=c.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Br()&&We("LOGIN_FAILED_SCREEN"),!t.connectors)throw new _("Connector not initialized");$("AWAITING_CONNECTION");let h=new URL(window.location.href);h.searchParams.delete("privy_connector"),h.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",h),po(p,m,void 0,uo)};Nr(()=>{n&&i&&s===null&&t.getAuthenticatedUser().then(d)},[n,i,s,t]);let Le=()=>{if(!i)throw N(L,"linkAccount","onError","must_be_authenticated"),new _("User must be authenticated before linking an account.")},mo=()=>{Le(),Z.current="siwe",Q.current="link",$("LINK_WALLET_SCREEN")},vt=c=>{if(!i||!s)return!1;if(c.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===c.address&&p.walletClientType!=="privy")return!0;return!1},qe=async c=>{if(!t.connectors)throw new _("Connector not initialized");let p=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;if(M(m=>({...m,connector:p,status:"connected",connectedWallet:c,connectError:null,connectRetry:b})),O.captchaEnabled&&!i){let m={callback:h=>uo(c,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};z({captchaModalData:m}),We("CAPTCHA_SCREEN")}else await uo(c),We("AWAITING_CONNECTION")},rr=async(c,p)=>{if(!O.fiatOnRamp.enabled)throw new _("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:h}=await mf(t,c,p?.config??{},O.appearance.palette,O.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:h}}else throw new _("Unsupported fund provider. Currently supported option is `moonpay`.")},Fr=()=>{y(c=>{let p=t.connectors?.wallets.map(m=>({...m,linked:vt(m),loginOrLink:async()=>{if(!await m.isConnected())throw new _("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new _("Cannot link or login with embedded wallet");qe(m)},fund:async h=>{let{signedUrl:I,externalTransactionId:D}=await rr(m.address,h);z({fiatOnRampPrompt:{signedUrl:I},fiatOnRampStatus:{externalTransactionId:D}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!i)throw new _("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new _("Cannot unlink an embedded wallet");let h=await t.unlinkWallet(m.address);d(h)}}))||[];return ge(Gn(p)),sa(c,p)?c:p})};Nr(()=>{Fr()},[s?.linkedAccounts,i,n]),Nr(()=>{if(n){if(!t.connectors)throw new _("Connector not initialized");Fr(),t.connectors.on("walletsUpdated",Fr)}},[n]);let Fi=()=>{$(i?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Nr(()=>{if(!u[0])return;let c=u[0],p=f.current.find(h=>h.address===c.address),m;if(c.walletClientType==="privy"?m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType==="privy"):m=s?.linkedAccounts.find(h=>h.type==="wallet"&&h.address===c.address&&h.walletClientType!=="privy"),!p&&m){let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}f.current=u},[u]);let or=async(c,p)=>{if(be(c))throw N(L,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[h,I]=await Promise.all([ie.initializeWalletProxy(p),ve()]);if(!h&&e.config?.customAuth?.enabled)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!h||!I||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((D,le)=>{re(!0),z({createWallet:{onSuccess:ut=>{N(L,"createWallet","onSuccess",ut),D(ut)},onFailure:ut=>{N(L,"createWallet","onError","unknown_embedded_wallet_error"),le(ut)},callAuthOnSuccessOnClose:!1}}),$("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await h.create({accessToken:I});let D=await ie.refreshUser(),le=be(D);if(!le)throw N(L,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(L,"createWallet","onSuccess",le),le}},Xs=c=>{if(!O.chains.map(p=>p.id).includes(c))throw new J(`Chain ID ${c} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},od=(c,p,m)=>new Promise(async(h,I)=>{if(!i||!s){N(L,"sendTransaction","onError","must_be_authenticated"),I(new Error("User must be authenticated before signing with a Privy wallet"));return}let D=be(s);if(!D){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have a Privy wallet before signing"));return}re(!0);let le=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,et=c.chainId?Number(c.chainId):le.chainId;Xs(et);let ut=Object.assign({},c,{chainId:et}),Pr=async()=>{let tt=await ve();if(!tt||!T){N(L,"sendTransaction","onError","embedded_wallet_not_found"),I(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ie.recoverEmbeddedWallet()){N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(new Error("Unable to connect to wallet"));return}let Vt=Sr(ut.chainId,O.chains,O.rpcConfig,{appId:e.appId}),el=await On(D.address,ut,Vt);if(O.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:Jy}=await Ln(el,Vt),{hasSufficientFunds:Qy}=await Gs(D.address,el,Jy,Vt);if(!Qy)throw new _e(new kt("Wallet has insufficient funds for this transaction.",je.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let ad=await Hs(tt,D.address,T,el,Vt);N(L,"sendTransaction","onSuccess",ad),h(ad)}catch(Gt){N(L,"sendTransaction","onError","transaction_failure"),I(Gt)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Pr();else{let tt={transactionRequest:ut,onSuccess:Vt=>{N(L,"sendTransaction","onSuccess",Vt),h(Vt)},onFailure:Vt=>{N(L,"sendTransaction","onError","transaction_failure"),I(Vt)},uiOptions:p||{},fundWalletConfig:m},Gt={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Vt=>{N(L,"sendTransaction","onError","unknown_connect_wallet_error"),I(Vt)}};z({connectWallet:Gt,sendTransaction:tt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function nd(){return new Promise(async(c,p)=>{let m=await ve();if(!m||!T)throw new Error("Must have valid access token to enroll in MFA");try{await T.verifyMfa({accessToken:m}),c()}catch(h){p(h)}})}let Ht=c=>{if(s?.[c])throw N(L,"linkAccount","onError","cannot_link_more_of_type"),new _(`User already has an account of type ${c} linked.`)},Oo={ready:n,authenticated:i,user:s,walletConnectors:t.connectors||null,connectWallet:Fi,linkWallet:mo,linkEmail:()=>{Le(),Ht("email"),Z.current="email",Q.current="link",$("LINK_EMAIL_SCREEN")},linkPhone:()=>{Le(),Ht("phone"),Z.current="sms",Q.current="link",$("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Le(),Ht("google"),Q.current="link",await ie.initLoginWithOAuth("google")},linkTwitter:async()=>{Le(),Ht("twitter"),Q.current="link",await ie.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Le(),Ht("discord"),Q.current="link",await ie.initLoginWithOAuth("discord")},linkGithub:async()=>{Le(),Ht("github"),Q.current="link",await ie.initLoginWithOAuth("github")},linkSpotify:async()=>{Le(),Ht("spotify"),Q.current="link",await ie.initLoginWithOAuth("spotify")},linkTiktok:async()=>{Le(),Ht("tiktok"),Q.current="link",await ie.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Le(),Ht("linkedin"),Q.current="link",await ie.initLoginWithOAuth("linkedin")},linkApple:async()=>{Le(),Ht("apple"),Q.current="link",await ie.initLoginWithOAuth("apple")},linkFarcaster:async()=>{Le(),Ht("farcaster"),await ie.initLoginWithFarcaster(),Q.current="link",Z.current="farcaster",$("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Le(),!s?.email)throw new _("User does not have an email linked to their account.");Q.current="link",Z.current="email",$("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(c=>{Ce(()=>c)}),Ce(null)),i){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}Q.current="login",We("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(c=>{Ce(()=>c)}),Ce(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}We("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&T)try{await T.clearMfa({userId:s.id})}catch{}d(null),l(!1),x(null),N(L,"logout","onSuccess"),Q.current=null,Z.current=null,o(!1),j.del(zn)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Ee;let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Ee:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new rd(new ar(new Ee));let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new rd(new ar(new Ee)):new rd(new ar(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Vr(new Ee);let c=u.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(h=>h.address===c?.address));return!c||!p?new Vr(new Ee):new Vr(p.proxyProvider)},unlinkWallet:async c=>{let p=await t.unlinkWallet(c);return d(p),p},unlinkEmail:async c=>{let p=await t.unlinkEmail(c);return d(p),p},unlinkPhone:async c=>{let p=await t.unlinkPhone(c);return d(p),p},unlinkGoogle:async c=>{let p=await t.unlinkOAuth("google",c);return d(p),p},unlinkTwitter:async c=>{let p=await t.unlinkOAuth("twitter",c);return d(p),p},unlinkDiscord:async c=>{let p=await t.unlinkOAuth("discord",c);return d(p),p},unlinkGithub:async c=>{let p=await t.unlinkOAuth("github",c);return d(p),p},unlinkSpotify:async c=>{let p=await t.unlinkOAuth("spotify",c);return d(p),p},unlinkTiktok:async c=>{let p=await t.unlinkOAuth("tiktok",c);return d(p),p},unlinkLinkedIn:async c=>{let p=await t.unlinkOAuth("linkedin",c);return d(p),p},unlinkApple:async c=>{let p=await t.unlinkOAuth("apple",c);return d(p),p},unlinkFarcaster:async c=>{let p=await t.unlinkFarcaster(c);return d(p),p},setActiveWallet:async c=>{let p=u.find(h=>Js(h.address)===Js(c)),m=s?.linkedAccounts.find(h=>h.type==="wallet"&&Js(h.address)===Js(c));if(!p||!await p.isConnected())H(c),mo();else if(!p.linked)p.loginOrLink();else{let h=Object.assign({},s);h.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},d(h)}},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 or(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 c=be(s);if(!c||!T)throw N(L,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(c.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 nd()}catch(p){throw N(L,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{re(!0);let h={onSuccess:D=>{N(L,"setWalletPassword","onSuccess",D),p(D)},onFailure:D=>{N(L,"setWalletPassword","onError","user_exited_set_password_flow"),m(D)},callAuthOnSuccessOnClose:!1},I={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:D=>{N(L,"setWalletPassword","onError","unknown_connect_wallet_error"),m(D)}};z({setWalletPassword:h,connectWallet:I}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signMessage","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=be(s);if(!I){N(L,"signMessage","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){N(L,"signMessage","onError","invalid_message"),h(new Error("Message must be a non-empty string"));return}re(!0);let D=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let le=await ve();if(!T||!le)throw new Error("Unable to connect to wallet");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:I.address});let{response:ut}=await T.rpc({accessToken:le,address:I.address,request:{method:"personal_sign",params:[c,I.address]}}),Pr=ut.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:I.address}),Pr};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let le=await D();N(L,"signMessage","onSuccess",le),m(le)}catch(le){N(L,"signMessage","onError","unable_to_sign"),h(le??new _e("Unable to sign message"))}}else{let ut={method:"personal_sign",data:c,confirmAndSign:D,onSuccess:tt=>{N(L,"signMessage","onSuccess",tt),m(tt)},onFailure:tt=>{N(L,"signMessage","onError","unable_to_sign"),h(tt)},uiOptions:p||{}},Pr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:tt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(tt)}};z({signMessage:ut,connectWallet:Pr}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(c,p)=>new Promise(async(m,h)=>{if(!i||!s){N(L,"signTypedData","onError","must_be_authenticated"),h(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=be(s);if(!I){N(L,"signTypedData","onError","embedded_wallet_not_found"),h(new Error("Must have a Privy wallet before signing"));return}re(!0);let D=ta(c),le=async()=>{if(!i)throw new Error("User must be authenticated before signing with a Privy wallet");let et=await ve();if(!T||!et)throw new Error("Unable to connect to wallet");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:I.address});let{response:Pr}=await T.rpc({accessToken:et,address:I.address,request:{method:"eth_signTypedData_v4",params:[I.address,D]}}),tt=Pr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:I.address}),tt};if(O.embeddedWallets.noPromptOnSignature||(O.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let et=await le();N(L,"signTypedData","onSuccess",et),m(et)}catch(et){N(L,"signTypedData","onError","unable_to_sign"),h(et??new _e("Unable to sign message"))}}else{let Pr={method:"eth_signTypedData_v4",data:D,confirmAndSign:le,onSuccess:Gt=>{N(L,"signTypedData","onSuccess",Gt),m(Gt)},onFailure:Gt=>{N(L,"signTypedData","onError","unable_to_sign"),h(Gt)},uiOptions:p||{}},tt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Gt=>{N(L,"signMessage","onError","unknown_connect_wallet_error"),h(Gt)}};z({signMessage:Pr,connectWallet:tt}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(c,p,m)=>{let I=await(await od(c,p,m)).wait();return Vs(I)},exportWallet:()=>new Promise(async(c,p)=>{if(!i||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=be(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}re(!0);let h={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},I=await ve();if(!I||!T){p(new Error("Must have valid access token to enroll in MFA"));return}if(!T){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await T.connect({accessToken:I,address:m.address}),await T.verifyMfa({accessToken:I})}catch(le){if(_o(le))await ie.recoverEmbeddedWallet();else throw le}}catch(le){p(le);return}let D={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:p};z({keyExport:D,connectWallet:h}),$("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:nd,async init(c){let p;switch(c){case"sms":p=new Zs("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${c}`)}t.startMfaFlow(p),await p.init()},async submit(c,p){switch(c){case"totp":case"sms":Dr.current?.resolve({mfaMethod:c,mfaCode:p}),await new Promise((m,h)=>{tr.current={resolve:m,reject:h}});break;default:throw Dr.current?.reject(new _("Unsupported MFA method")),new _(`Unsupported MFA method: ${c}`)}},cancel(){Dr.current?.reject(new _("MFA canceled"))},async initEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber})},enrollInMfa(c){return new Promise((p,m)=>{if(!c){ie.closePrivyModal(),p();return}O.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."),z({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:m}}),$("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let c=await ve();if(!c||!T)throw new Error("Must have valid access token to enroll in MFA");let p=await T.initEnrollMfa({method:"totp",accessToken:c});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:c.phoneNumber,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async submitEnrollmentWithTotp(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to enroll in MFA");await T.submitEnrollMfa({method:"totp",accessToken:p,code:c.mfaCode});let m=await t.getAuthenticatedUser();d(m)},async unenroll(c){let p=await ve();if(!p||!T)throw new Error("Must have valid access token to remove MFA");await T.unenrollMfa({method:c,accessToken:p});let m=await t.getAuthenticatedUser();d(m)},requestFarcasterSigner:async()=>{let c=await ve(),p=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!c)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let h=await T.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:c,mfaCode:null,mfaMethod:null});if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}z({farcasterSigner:h}),$("AWAITING_FARCASTER_SIGNER")},submitCast:async c=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},removeCast:async({castHash:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeCast({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:c,fid:BigInt(s.farcaster.fid)})).response.hash}},likeCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(le=>le.type==="wallet"&&le.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:1,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},recastCast:async({castHash:c,castAuthorFid:p})=>{let m=await ve(),h=s?.linkedAccounts.find(le=>le.type==="wallet"&&le.walletClientType==="privy");if(!m)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!h)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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.reactToCast({address:h.address,hdWalletIndex:null,accessToken:m,mfaCode:null,mfaMethod:null,payload:{type:2,castId:{hash:c,fid:p}},fid:BigInt(s.farcaster.fid)})).response.hash}},followUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.submitLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},unfollowUser:async({fid:c})=>{let p=await ve(),m=s?.linkedAccounts.find(D=>D.type==="wallet"&&D.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");return{hash:(await T.removeLink({address:m.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{type:"follow",targetFid:c},fid:BigInt(s.farcaster.fid)})).response.hash}},isHeadlessOAuthLoading:C,loginWithCode(c){return ie.loginWithCode(c)},initLoginWithEmail(c){return ie.initLoginWithEmail(c)},initLoginWithSms(c){return ie.initLoginWithSms(c)},fundWallet(c,p){return ie.fundWallet(c,p)},initLoginWithHeadlessOAuth(c,p){return ie.initLoginWithHeadlessOAuth(c,p)},loginWithHeadlessOAuth(c){return ie.loginWithHeadlessOAuth(c)},isModalOpen:r};Vy=Oo.signMessage,zy=Oo.signTypedData,qy=async(...c)=>{let p=await od(...c);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let id=!!e.config?.headless,ie=(()=>({headless:id,isNewUserThisSession:g,linkingHint:U,pendingTransaction:null,walletConnectionStatus:R,mipdStore:k,connectors:t.connectors?.walletConnectors??[],rpcConfig:O.rpcConfig,chains:O.chains,appId:e.appId,showFiatPrices:O.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:c=>O.chains.find(p=>p.id===Number(c))?.nativeCurrency.symbol,initializeWalletProxy:async c=>{if(T)return T;let p=new Promise(I=>{yt(()=>D=>I(D))}),m=new Promise(I=>setTimeout(()=>I(null),c)),h=await Promise.race([p,m]);return yt(null),h},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(c={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&i&&s;Q.current==="login"?c.shouldCallAuthOnSuccess&&p?(N(L,"login","onComplete",s,g,!1,Z.current??null),e.onSuccess?.(s,g)):N(L,"login","onError","exited_auth_flow"):Q.current==="link"&&Z.current&&(c.isSuccess&&p?N(L,"linkAccount","onSuccess",s,Z.current):N(L,"linkAccount","onError","exited_link_flow")),H(null),Q.current=null,Z.current=null,E(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:$,connectWallet:Bt,initLoginWithWallet:async(c,p)=>{Z.current="siwe",uo(c,p)},loginWithWallet:async()=>{if(!n)throw new No;if(!(t.authFlow instanceof wo))throw new _("Must initialize SIWE flow first.");let c,p;if(i)try{c=await t.link(),Z.current="siwe"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),Z.current="siwe"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}d(c||s||null),E(p||!1),l(!0)},initLoginWithFarcaster:async c=>{let p=new qn(c);t.startAuthFlow(p);try{Z.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw Q.current==="login"?N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new No;if(!(t.authFlow instanceof qn))throw new _("Must initialize Farcaster flow first.");let c,p;if(i)try{c=await t.link(),Z.current="farcaster"}catch(m){throw N(L,"linkAccount","onError",m.privyErrorCode||"failed_to_link_account"),m}else try{({user:c,isNewUser:p}=await t.authenticate()),Z.current="farcaster"}catch(m){throw N(L,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}d(c||null),E(p||!1),l(!0)},async initLoginWithOAuth(c,p){if(Z.current=c,nl()){if(c==="google"&&Ys(window.navigator.userAgent)){We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{We("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}j.del(yo);let m=new ir({provider:c});p&&m.addCaptchaToken(p),t.startAuthFlow(m);let h=await t.authFlow.getAuthorizationUrl();h&&h.url&&window.location.assign(h.url)},async loginWithOAuth(c){if(!(t.authFlow instanceof ir))throw new _("Must initialize OAuth flow before calling loginWithOAuth");let p=j.get(ho),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c,storedStateCode:p??"",returnedStateCode:m??""}),new _("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),Z.current=c}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),Z.current=c}catch(D){throw Q.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}d(h),E(I||!1),l(!0)},async initLoginWithHeadlessOAuth(c,p){if(nl()){if(c==="google"&&Ys(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 ir({provider:c,headless:!0});p&&m.addCaptchaToken(p);let h=await t.startAuthFlow(m).getAuthorizationUrl();h?.url&&window.location.assign(h.url)},async loginWithHeadlessOAuth(c){P(!0),t.startAuthFlow(new ir(c));let p=j.get(ho),m=c.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:c.provider,storedStateCode:p??"",returnedStateCode:m??""}),P(!1),new _("Unexpected auth flow. This may be a phishing attempt.");let h,I;if(i)try{h=await t.link(),Z.current=c.provider}catch(D){throw N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}else try{({user:h,isNewUser:I}=await t.authenticate()),Z.current=c.provider}catch(D){throw Q.current==="login"?N(L,"login","onError",D.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",D.privyErrorCode||"failed_to_link_account"),D}return d(h),E(I||!1),l(!0),P(!1),h??void 0},initLoginWithEmail:async(c,p)=>{let m=new Ur(c,p);t.startAuthFlow(m);try{Z.current="email",await m.sendCodeEmail()}catch(h){throw Q.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},initUpdateEmail:async(c,p,m)=>{let h=new qi(c,p,m);t.startAuthFlow(h),await h.sendCodeEmail()},initLoginWithSms:async(c,p)=>{let m=new Co(c,p);t.startAuthFlow(m);try{Z.current="sms",await m.sendSmsCode()}catch(h){throw Q.current==="login"?N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"):Q.current==="link"&&N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async c=>{if(!n)throw new No;if(t.authFlow instanceof Ur)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof Co)t.authFlow.meta.smsCode=c.trim();else throw new _("Must initialize a passwordless code flow first");let p,m;if(i)try{p=await t.link()}catch(h){throw N(L,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:p,isNewUser:m}=await t.authenticate())}catch(h){throw N(L,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}d(p||s||null),E(m||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return d(c),c},walletProxy:T,createAnalyticsEvent:(c,p,m)=>t.createAnalyticsEvent(c,p,m),acceptTerms:async()=>{let c=await t.acceptTerms();return d(c),c},getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:async()=>new Promise(async(c,p)=>{let m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy"),h=await ve();if(!h||!T||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}re(!0);try{await T.connect({accessToken:h,address:m.address}),c(!0)}catch(I){_o(I)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await T.recover({address:m.address,accessToken:h})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),c(!0)):_o(I)?(z({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>c(!0)}}),$("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(I)}}),getFiatOnRampConfig:rr,setReadyToTrue:()=>{a(!0),Se?.()},updateWallets:()=>Fr(),fundWallet:async(c,p)=>{let{signedUrl:m,externalTransactionId:h}=await rr(c,p);z({fiatOnRampPrompt:{signedUrl:m},fiatOnRampStatus:{externalTransactionId:h}}),$("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async c=>{let p=await ve(),m=s?.linkedAccounts.find(I=>I.type==="wallet"&&I.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!T||!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 h=await t.requestFarcasterSignerStatus(c);if(h.status==="approved"){let I=await t.getAuthenticatedUser();d(I||s||null)}return h}}))();$y=ie.recoverEmbeddedWallet;let Zy=q4(()=>({wallets:u,ready:Ae}),[u,Ae]);return Er(ce.Provider,{value:Oo,children:Er(xl.Provider,{value:L,children:Er(Kc.Provider,{value:Zy,children:Gy(ou,{...O,children:[e.children,Gy(Pl.Provider,{value:ie,children:[!id&&O.captchaEnabled&&n&&!i&&Er(Tl,{delayedExecution:!1}),Er(Ly,{theme:{...O.appearance.palette||{}}}),Er(Jp,{data:te,setModalData:z,setInitialScreen:x,initialScreen:v,authenticated:i,open:r,children:Er(Fy,{open:r})}),se&&Y?Er(Hy,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Dr,mfaSubmitPromise:tr,onLoad:q,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as Z4}from"react";function J4(e){let{login:t}=Z4(ce);return Pe("login",e),{login:t}}import{useContext as Q4}from"react";function X4(e){let{logout:t}=Q4(ce);return Pe("logout",e),{logout:t}}import{useCallback as jy,useEffect as eE}from"react";function tE(){let e=fe(),t=ka(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:a,user:i}=G(),l=jy(async d=>{if(e.enabled&&e.status!=="success")throw new qt(e.error,null,"captcha_failure");return r(d.provider,e.token)},[r,e]),s=jy(async()=>{let d=jn();if(i)return console.warn("Cannot login with OAuth when already logged in"),i;if(!d.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(d)}catch(u){throw u}finally{Kn()}},[o]);return eE(()=>{let d=jn();a&&t&&d.inProgress&&d.headless&&s()},[a,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Ky}from"react";var rE=()=>{let e=fe(),{initLoginWithEmail:t,loginWithCode:r}=G(),o=Ky(async({email:a})=>{if(!a)throw new Error("Email required to send OTP code");return t(a)},[t]),n=Ky(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 Yy}from"react";var oE=()=>{let e=fe(),{initLoginWithSms:t,loginWithCode:r}=G(),o=Yy(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),n=Yy(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new qt(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useContext as nE}from"react";function iE(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}=nE(ce);return Pe("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:a,linkTwitter:i,linkDiscord:l,linkGithub:s,linkLinkedIn:d,linkTiktok:u,linkSpotify:y,linkFarcaster:f}}import{useContext as aE}from"react";function sE(e){let{connectWallet:t}=aE(ce);return Pe("connectWallet",e),{connectWallet:t}}import{useContext as lE}from"react";function cE(e){let{createWallet:t}=lE(ce);return Pe("createWallet",e),{createWallet:t}}var dE=()=>{let{fundWallet:e}=G();return{fundWallet:e}};import{useContext as pE}from"react";function uE(e){let{sendTransaction:t}=pE(ce);return Pe("sendTransaction",e),{sendTransaction:t}}import{useContext as mE}from"react";function fE(e){let{setWalletPassword:t}=mE(ce);return Pe("setWalletPassword",e),{setWalletPassword:t}}import{useContext as hE}from"react";function yE(e){let{signMessage:t}=hE(ce);return Pe("signMessage",e),{signMessage:t}}import{useContext as gE}from"react";function vE(e){let{signTypedData:t}=gE(ce);return Pe("signTypedData",e),{signTypedData:t}}import{useContext as wE}from"react";var CE=()=>{let{isModalOpen:e}=wE(ce);return{isOpen:e}};import{useContext as bE}from"react";function EE(e){let{getAccessToken:t}=bE(ce);return Pe("accessToken",e),{getAccessToken:t}}function TE(){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 PE(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{ar as AsExternalProvider,Tl as Captcha,Xn as ConnectorManager,ei as PrivyClient,K4 as PrivyProvider,Ee as PrivyProxyProvider,Jn as SUPPORTED_CHAINS,ll as VERSION,mt as WalletConnector,PE as addRpcUrlOverrideToChain,Ql as errorIndicatesMaxMfaRetries,fn as errorIndicatesMfaTimeout,hn as errorIndicatesMfaVerificationFailed,ve as getAccessToken,sE as useConnectWallet,cE as useCreateWallet,TE as useExperimentalFarcasterSigner,dE as useFundWallet,iE as useLinkAccount,J4 as useLogin,rE as useLoginWithEmail,tE as useLoginWithOAuth,oE as useLoginWithSms,X4 as useLogout,kn as useMfa,Ai as useMfaEnrollment,CE as useModalStatus,G as usePrivy,Sl as useRegisterMfaListener,uE as useSendTransaction,fE as useSetWalletPassword,yE as useSignMessage,vE as useSignTypedData,EE as useToken,Oi as useWallets};
|