@privy-io/react-auth 1.59.4 → 1.59.5-beta-20240318231123
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 +224 -217
- package/dist/index.js +204 -197
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Ks=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Zc=(e,t,r)=>(Ks(e,t,"read from private field"),r?r.call(e):t.get(e)),Li=(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)},Ys=(e,t,r,o)=>(Ks(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Qc=(e,t,r)=>(Ks(e,t,"access private method"),r);import{getAddress as zs}from"@ethersproject/address";import{Web3Provider as qc}from"@ethersproject/providers";import{createStore as u4}from"mipd";import{useCallback as m4,useEffect as Ir,useMemo as f4,useRef as Wn,useState as ke}from"react";import{FetchError as My}from"ofetch";var He=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}]`:""}`}},Xt=class extends He{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},P=class extends He{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Oi=class extends P{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var Y=class extends He{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},se=e=>{if(e instanceof He)return e;if(!(e instanceof My))return Ze(e);if(!e.response)return new Xt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Xt(t||"ApiError",e.response.status,r||o,e,n)},Ze=e=>e instanceof He?e:e instanceof Error?new P(e.message,e):new P(`Internal error: ${e}`);var Io=class extends P{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},mt=class extends P{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ni=class extends P{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Di="/api/v1/sessions",Ui="/api/v1/sessions/logout",Xc="/api/v1/sessions/fork",Fi="/api/v1/sessions/fork/recover",ed="/api/v1/siwe/init",td="/api/v1/siwe/authenticate",rd="/api/v1/siwe/link",od="/api/v1/siwe/unlink",nd="/api/v1/farcaster/init",id="/api/v1/farcaster/authenticate",ad="/api/v1/farcaster/link",sd="/api/v1/farcaster/status",ld="/api/v1/farcaster/unlink",cd="/api/v1/passwordless/init",dd="/api/v1/passwordless/authenticate",pd="/api/v1/passwordless/link",ud="/api/v1/passwordless/unlink",md="/api/v1/passwordless/update",fd="/api/v1/passwordless_sms/init",hd="/api/v1/passwordless_sms/link",yd="/api/v1/passwordless_sms/unlink",gd="/api/v1/passwordless_sms/authenticate",vd="/api/v1/oauth/init",wd="/api/v1/oauth/authenticate",Cd="/api/v1/oauth/link",bd="/api/v1/oauth/unlink";var Ed="/api/v1/mfa/passwordless_sms/init",Pd="/api/v1/mfa/passwordless_sms/enroll";var Td="/api/v1/users/me/accept_terms",xd="/api/v1/analytics_events",Sd="/api/v1/plugins/moonpay_on_ramp/sign",_d="/api/v1/custom_jwt_account/authenticate";var Mo=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");try{let t=await this.api.post(_d,{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 se(t)}}async link(){throw new Error("Unimplemented")}};var Lr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new P("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(dd,{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 se(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new P("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(pd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw se(t)}}async sendCodeEmail(t,r){if(!this.api)throw new P("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new P("Email must be set when initialzing authentication.");try{return await this.api.post(cd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw se(o)}}},Bi=class extends Lr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new P("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(md,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw se(r)}}};import{isMobile as Uy}from"react-device-detect";var Hi=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)}},Js=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)}},Zs=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function Qs(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function Wy(){return typeof window<"u"&&window.localStorage?new Js:new Hi}function Ly(){return typeof window<"u"&&window.sessionStorage?new Zs:new Hi}var Ge=Ly(),le=Wy();import{StaticJsonRpcProvider as Oo}from"@ethersproject/providers";function Ad(){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 Gi=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 Xs=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Gi(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Xs(r))return!1}return!0},Or=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),kd=()=>{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 Rd="1.59.4";var el="4df5e2316331463a9130964bd6078dfa",tl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Id="34357d3c125c2bcf2ce2bc3309d98715",Vi="https://auth.privy.io",Md=2e4,Qe=1400,Wd=2500,rl=Rd;var lo="privy:token",ol="privy-token",zi="privy:refresh_token",nl="privy-refresh-token",$i="privy-session",Nn="privy:session_transfer_token",Ny="privy:wallet",Dn="privy:caid",co="privy:state_code",Wo="privy:code_verifier",Un="privy:headless_oauth",qi=e=>`${Ny}:${e}`,il="privy:connectors",al="privy:connections";var po=12e4,br=1,sl="0x1",Lo=3e4,Ld="https://api.moonpay.com/v1",Od="https://api.moonpay.com/v1",Nd="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Dd="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Ud="0x420000000000000000000000000000000000000F",Fd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Bd=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);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,}))$/),Hd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Nr=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},ll=e=>new Promise(t=>setTimeout(t,e));function Gd(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var Vd=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await ll(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},Ki=(e,t,r={})=>{let o=new URL(t,e);for(let[n,i]of Object.entries(r))o.searchParams.set(n,i);return o.href};var zd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),uo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function $d(e,t,r=3e3){let o=!1,n=window;return new Promise(i=>{n.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},r));function a(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",a);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of Ad()){let u=Gi(c);if(!l.some(m=>m.info.name===u)){if(Xs(c,!0)&&!s.find(m=>m.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(m=>m.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}s.find(m=>m.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function No(e){return`eip155:${String(Number(e))}`}var Yi=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new Y(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0])a=i.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])a=r.rpcUrls[n];else if(i.rpcUrls.privy?.http[0]){let l=new URL(i.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),a=l.toString()}else i.rpcUrls.infura?.http[0]?a=i.rpcUrls.infura.http[0]+"/"+el:i.rpcUrls.blast?.http[0]?a=i.rpcUrls.blast.http[0]+"/"+tl:a=i.rpcUrls.default?.http[0];if(!a)throw new Y(`No RPC url found for ${e}`);return a},qd=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new Y(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Er=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new Y(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new Oo(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new Oo(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new Oo({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.infura?.http[0]?a=new Oo(i.rpcUrls.infura.http[0]+"/"+el):i.rpcUrls.blast?.http[0]?a=new Oo(i.rpcUrls.blast.http[0]+"/"+tl):a=new Oo(i.rpcUrls.default?.http[0]),!a)throw new Y(`No RPC url found for ${e}`);return a},Ji=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 Zi=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Do))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Do={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 Dy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var jd=e=>e in Do,Kd=e=>{let t=Do[e].mobile;if("native"in t)return t.native};function Yd(e,t){let r=Dy(t);if(r.deepLink)return ep(r.deepLink,e);if(r.universalLink)return tp(r.universalLink,e);throw new P(`Unsupported wallet ${t.id}`)}var Jd="WALLETCONNECT_DEEPLINK_CHOICE";function Zd(){try{localStorage.removeItem(Jd)}catch{}}function Qd({href:e,name:t}){try{localStorage.setItem(Jd,JSON.stringify({href:e,name:t}))}catch{}}function Xd(e){return e.startsWith("http://")||e.startsWith("https://")}function ep(e,t){if(Xd(e))return tp(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 tp(e,t){if(!Xd(e))return ep(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Qi(e,t){window.open(e,t,"noreferrer noopener")}var Xe=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 Fn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Xe(this._startChannelOnce.bind(this)),this.pollForReady=new Xe(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.channelToken)throw new P("Auth flow must be initialized first");try{let t=await this.api.post(id,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new P("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 se(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");try{return await this.api.post(ad,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw se(t)}}async _startChannelOnce(){if(!this.api)throw new P("Auth flow has no API instance");let t=await this.api.post(nd,{token:this.captchaToken});Uy&&t.connect_uri&&Qi(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new P("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.channelToken)throw new P("Auth flow must be initialized first");let t=await this.api.get(sd,{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 np}from"jose";async function rp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function op(e){return crypto.getRandomValues(new Uint8Array(e))}function Xi(){return!!Ge.get(Un)}var Fy="S256",By="S256",er=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Xi();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 P("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new P("User denied confirmation during OAuth flow");let t=Ge.get(Wo);if(!t)throw new P("Authentication error.");try{let r=await this.api.post(wd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Ge.del(Wo),this.meta.headless&&Ge.del(Un),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=se(r);throw o.privyErrorCode?new P(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new P("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new P("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new P("User denied confirmation during OAuth flow");let t=Ge.get(Wo);if(!t)throw new P("Authentication error.");try{let r=await this.api.post(Cd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Ge.del(Wo),r}catch(r){throw se(r)}}createCodeVerifier(){return np.encode(op(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=Fy){if(r==By){let o=await rp(t);return np.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.provider)throw new P("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();Ge.put(Wo,t);let r=this.createStateCode();Ge.put(co,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&Ge.put(Un,!0);try{return await this.api.post(vd,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw se(n)}}};function cl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ip(e,t){let r={detail:"",retryable:!1},o=cl(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 Hn(){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:Xi()}}function Gn(){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"),Ge.del(co),window.history.replaceState({},"",e)}var mo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
1
|
+
var Ys=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Xc=(e,t,r)=>(Ys(e,t,"read from private field"),r?r.call(e):t.get(e)),Li=(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)},Js=(e,t,r,o)=>(Ys(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var ed=(e,t,r)=>(Ys(e,t,"access private method"),r);import{getAddress as $s}from"@ethersproject/address";import{Web3Provider as Kc}from"@ethersproject/providers";import{createStore as h4}from"mipd";import{useCallback as y4,useEffect as Wr,useMemo as g4,useRef as Ln,useState as ke}from"react";import{FetchError as Wy}from"ofetch";var He=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}]`:""}`}},Xt=class extends He{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},P=class extends He{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Oi=class extends P{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var Y=class extends He{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},le=e=>{if(e instanceof He)return e;if(!(e instanceof Wy))return Ze(e);if(!e.response)return new Xt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Xt(t||"ApiError",e.response.status,r||o,e,n)},Ze=e=>e instanceof He?e:e instanceof Error?new P(e.message,e):new P(`Internal error: ${e}`);var Io=class extends P{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},mt=class extends P{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Ni=class extends P{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Di="/api/v1/sessions",Ui="/api/v1/sessions/logout",td="/api/v1/sessions/fork",Fi="/api/v1/sessions/fork/recover",rd="/api/v1/siwe/init",od="/api/v1/siwe/authenticate",nd="/api/v1/siwe/link",id="/api/v1/siwe/unlink",ad="/api/v1/farcaster/init",sd="/api/v1/farcaster/authenticate",ld="/api/v1/farcaster/link",cd="/api/v1/farcaster/status",dd="/api/v1/farcaster/unlink",pd="/api/v1/passwordless/init",ud="/api/v1/passwordless/authenticate",md="/api/v1/passwordless/link",fd="/api/v1/passwordless/unlink",hd="/api/v1/passwordless/update",yd="/api/v1/passwordless_sms/init",gd="/api/v1/passwordless_sms/link",vd="/api/v1/passwordless_sms/unlink",wd="/api/v1/passwordless_sms/authenticate",Cd="/api/v1/oauth/init",bd="/api/v1/oauth/authenticate",Ed="/api/v1/oauth/link",Pd="/api/v1/oauth/unlink";var Td="/api/v1/mfa/passwordless_sms/init",xd="/api/v1/mfa/passwordless_sms/enroll";var Sd="/api/v1/users/me/accept_terms",_d="/api/v1/analytics_events",Ad="/api/v1/plugins/moonpay_on_ramp/sign",kd="/api/v1/custom_jwt_account/authenticate";var Mo=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");try{let t=await this.api.post(kd,{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 le(t)}}async link(){throw new Error("Unimplemented")}};var Nr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new P("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(ud,{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 le(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new P("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(md,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw le(t)}}async sendCodeEmail(t,r){if(!this.api)throw new P("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new P("Email must be set when initialzing authentication.");try{return await this.api.post(pd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw le(o)}}},Bi=class extends Nr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new P("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(hd,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw le(r)}}};import{isMobile as Fy,isIOS as By}from"react-device-detect";var Hi=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)}},Zs=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)}},Qs=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function Xs(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function Ly(){return typeof window<"u"&&window.localStorage?new Zs:new Hi}function Oy(){return typeof window<"u"&&window.sessionStorage?new Qs:new Hi}var Ge=Oy(),ce=Ly();import{StaticJsonRpcProvider as Oo}from"@ethersproject/providers";function Rd(){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 Gi=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 el=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Gi(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!el(r))return!1}return!0},Dr=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Id=()=>{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 Md="1.59.5-beta-20240318231123";var tl="4df5e2316331463a9130964bd6078dfa",rl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Wd="34357d3c125c2bcf2ce2bc3309d98715",Vi="https://auth.privy.io",Ld=2e4,Qe=1400,Od=2500,ol=Md;var co="privy:token",nl="privy-token",zi="privy:refresh_token",il="privy-refresh-token",$i="privy-session",Dn="privy:session_transfer_token",Dy="privy:wallet",Un="privy:caid",po="privy:state_code",Wo="privy:code_verifier",Fn="privy:headless_oauth",qi=e=>`${Dy}:${e}`,al="privy:connectors",sl="privy:connections";var uo=12e4,Er=1,ll="0x1",Lo=3e4,Nd="https://api.moonpay.com/v1",Dd="https://api.moonpay.com/v1",Ud="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Fd="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Bd="0x420000000000000000000000000000000000000F",Hd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Gd=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);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,}))$/),Vd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Ur=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},cl=e=>new Promise(t=>setTimeout(t,e));function zd(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var $d=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await cl(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},Ki=(e,t,r={})=>{let o=new URL(t,e);for(let[n,i]of Object.entries(r))o.searchParams.set(n,i);return o.href};var qd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),mo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function jd(e,t,r=3e3){let o=!1,n=window;return new Promise(i=>{n.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},r));function a(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",a);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of Rd()){let u=Gi(c);if(!l.some(m=>m.info.name===u)){if(el(c,!0)&&!s.find(m=>m.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(m=>m.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}s.find(m=>m.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function No(e){return`eip155:${String(Number(e))}`}var Yi=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new Y(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0])a=i.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])a=r.rpcUrls[n];else if(i.rpcUrls.privy?.http[0]){let l=new URL(i.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),a=l.toString()}else i.rpcUrls.infura?.http[0]?a=i.rpcUrls.infura.http[0]+"/"+tl:i.rpcUrls.blast?.http[0]?a=i.rpcUrls.blast.http[0]+"/"+rl:a=i.rpcUrls.default?.http[0];if(!a)throw new Y(`No RPC url found for ${e}`);return a},Kd=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new Y(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Pr=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new Y(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new Oo(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new Oo(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new Oo({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.infura?.http[0]?a=new Oo(i.rpcUrls.infura.http[0]+"/"+tl):i.rpcUrls.blast?.http[0]?a=new Oo(i.rpcUrls.blast.http[0]+"/"+rl):a=new Oo(i.rpcUrls.default?.http[0]),!a)throw new Y(`No RPC url found for ${e}`);return a},Ji=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 Zi=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Do))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Do={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 Uy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var Yd=e=>e in Do,Jd=e=>{let t=Do[e].mobile;if("native"in t)return t.native};function Zd(e,t){let r=Uy(t);if(r.deepLink)return rp(r.deepLink,e);if(r.universalLink)return op(r.universalLink,e);throw new P(`Unsupported wallet ${t.id}`)}var Qd="WALLETCONNECT_DEEPLINK_CHOICE";function Xd(){try{localStorage.removeItem(Qd)}catch{}}function ep({href:e,name:t}){try{localStorage.setItem(Qd,JSON.stringify({href:e,name:t}))}catch{}}function tp(e){return e.startsWith("http://")||e.startsWith("https://")}function rp(e,t){if(tp(e))return op(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 op(e,t){if(!tp(e))return rp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Qi(e,t){window.open(e,t,"noreferrer noopener")}var Xe=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 Bn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Xe(this._startChannelOnce.bind(this)),this.pollForReady=new Xe(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.channelToken)throw new P("Auth flow must be initialized first");try{let t=await this.api.post(sd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new P("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 le(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");try{return await this.api.post(ld,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw le(t)}}async _startChannelOnce(){if(!this.api)throw new P("Auth flow has no API instance");let t=await this.api.post(ad,{token:this.captchaToken});Fy&&!By&&t.connect_uri&&Qi(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new P("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.channelToken)throw new P("Auth flow must be initialized first");let t=await this.api.get(cd,{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 ap}from"jose";async function np(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function ip(e){return crypto.getRandomValues(new Uint8Array(e))}function Xi(){return!!Ge.get(Fn)}var Hy="S256",Gy="S256",er=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Xi();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 P("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new P("User denied confirmation during OAuth flow");let t=Ge.get(Wo);if(!t)throw new P("Authentication error.");try{let r=await this.api.post(bd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Ge.del(Wo),this.meta.headless&&Ge.del(Fn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=le(r);throw o.privyErrorCode?new P(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new P("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new P("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new P("User denied confirmation during OAuth flow");let t=Ge.get(Wo);if(!t)throw new P("Authentication error.");try{let r=await this.api.post(Ed,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Ge.del(Wo),r}catch(r){throw le(r)}}createCodeVerifier(){return ap.encode(ip(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=Hy){if(r==Gy){let o=await np(t);return ap.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.provider)throw new P("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();Ge.put(Wo,t);let r=this.createStateCode();Ge.put(po,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&Ge.put(Fn,!0);try{return await this.api.post(Cd,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw le(n)}}};function dl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function sp(e,t){let r={detail:"",retryable:!1},o=dl(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 Gn(){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:Xi()}}function Vn(){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"),Ge.del(po),window.history.replaceState({},"",e)}var fo=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,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: ${a}
|
|
10
10
|
Issued At: ${i}
|
|
11
11
|
Resources:
|
|
12
|
-
- https://privy.io`;this.getNonceOnce=new Xe(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 P("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(td,{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 se(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(rd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw se(t)}}async sign(){if(!this.api)throw new P("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new P("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 P("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(ed,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new P("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,i=window.location.origin,a="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,i,l,o,a)}};var fo=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new P("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(gd,{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 se(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new P("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(hd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw se(t)}}async sendSmsCode(t,r){if(!this.api)throw new P("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new P("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(fd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw se(o)}}};import{v4 as Rg}from"uuid";function et(e){return new Date(e*1e3)}function Hy(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:et(r.verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let i={address:r.address,type:r.type,verifiedAt:et(r.verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:et(r.verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:et(r.verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:et(r.verified_at)};t.push(s);break;case"twitter_oauth":let c={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:et(r.verified_at)};t.push(c);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(u);break;case"github_oauth":let m={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(m);break;case"tiktok_oauth":let h={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:et(r.verified_at)};t.push(h);break;case"linkedin_oauth":let v={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(v);break;case"apple_oauth":let E={subject:r.subject,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(E);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:et(r.verified_at)});break;case"farcaster":let g={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:et(r.verified_at)};t.push(g);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function bt(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var fe=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,Gy=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Et=(e,t)=>t==="all-users"&&!fe(e)||t==="users-without-wallets"&&!Gy(e)?.length;function ft(e){if(!e)return null;let t=Hy(e.linked_accounts),r=bt(t,"wallet"),o=bt(t,"email"),n=bt(t,"phone"),i=bt(t,"google_oauth"),a=bt(t,"twitter_oauth"),l=bt(t,"discord_oauth"),s=bt(t,"github_oauth"),c=bt(t,"spotify_oauth"),u=bt(t,"tiktok_oauth"),m=bt(t,"linkedin_oauth"),h=bt(t,"apple_oauth"),v=bt(t,"farcaster"),E=e.mfa_methods.map(({type:x,verified_at:C})=>({type:x,verifiedAt:et(C)}));return{id:e.id,createdAt:et(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:m&&{subject:m.subject,name:m.name,email:m.email},apple:h&&{subject:h.subject,email:h.email},farcaster:v&&{fid:v.fid,ownerAddress:v.ownerAddress,displayName:v.displayName,username:v.username,bio:v.bio,pfp:v.pfp,url:v.url},mfaMethods:E.map(x=>x.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Hp}from"@ethersproject/address";import Sg from"eventemitter3";import Qy from"@coinbase/wallet-sdk";import{jsx as ap,jsxs as Vy}from"react/jsx-runtime";var ea=({style:e,...t})=>Vy("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:[ap("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),ap("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 rr}from"@ethersproject/address";import{Web3Provider as up}from"@ethersproject/providers";import{default as Jy}from"eventemitter3";import Yy from"eventemitter3";var zy=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],sp=e=>zy.includes(e);import{ErrorCode as $y}from"@ethersproject/logger";var Uo=class extends Y{constructor(){super("Wallet timeout");this.type="wallet_error"}},Fo=class extends Y{constructor(){super("User rejected connection");this.type="wallet_error"}},Bt=e=>{if(e instanceof Y)return e;if(e?.code&&e?.reason){let t=new Ce(e);return e.code===$y.ACTION_REJECTED&&(t.details=Ve.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ce(e):new Y("Unknown connector error",e)},Pt=class extends He{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Ce=class extends Pt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Ve).find(i=>i.eipCode===o.code);this.details=n||Ve.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Ve.E32002_CONNECTION_ALREADY_PENDING:this.details=Ve.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Ve.E32002_WALLET_LOCKED))}},qy={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}},jy={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}},Ky={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}},Ve={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Ky,...jy},Pr={...qy,...Ve};var he=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 Uo,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||po,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new Y(`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 Bt(r)})}},Dr=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},ta=class extends Yy{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=Er(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=Bo(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Dr(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Me()||!this.address)throw new Dr("Disconnected",4900);return(await dp(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Dr(`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 Dr(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Er(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 lp(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 cp(Ji(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:uo(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 uo(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(sp(r.method)){let o=await Me();if(await pp(),!o||!this.address)throw new Dr("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 Dr("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Me();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}}},tr=class extends he{constructor(r){super(r,r.rpcTimeoutDuration)}},Ur=class extends he{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 Zy=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},lt=class extends Jy{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=No(r),this.walletClientType==="privy"&&le.put(qi(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=i,this.rpcTimeoutDuration=Bo(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let i=async()=>!!this.wallets.find(a=>rr(a.address)===rr(r));return{address:rr(r),chainId:o,meta:n,switchChain:async a=>{if(!i)throw new Y("Wallet is not currently connected.");let l=this.wallets.find(h=>rr(h.address)===rr(r))?.chainId;if(!l)throw new Y("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===No(s))return;let u=this.chains.find(h=>h.id===c);if(!u)throw new Y(`Unsupported chainId: ${a}`);let m=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await m()}catch(h){if(Zy(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),m();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new Y(`Rainbow does not support the chainId ${o}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new Y("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new Y("Wallet is not currently connected.");return new up(new tr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new Y("Wallet is not currently connected.");return new Ur(this.proxyProvider)},sign:async a=>{if(!await i())throw new Y("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=rr(n),a=[],l;if(this.walletClientType==="privy"){let c=le.get(qi(i));this.chains.find(u=>u.id===Number(c))||(le.del(qi(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${sl}`,c),l=sl}let s=No(l);if(!a.find(c=>rr(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet(rr(n),s,c))}ra(a,this.wallets)||(this.wallets=a,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=>rr(n)===rr(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 up(new tr(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 Ho={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 Xy=(e,t)=>{let o=Yi(1,[Ho],{},t);return e.makeWeb3Provider(o,1)},oa,na=class extends lt{constructor(r,o,n,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new he(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),oa||(oa=new Qy({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(Xy(oa,i))}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(){oa.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:ea,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 Y("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Bt(r)}}};import{jsx as mp}from"react/jsx-runtime";var ia=({...e})=>mp("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:mp("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 aa=class extends lt{constructor(r,o,n,i){super("privy",o,n,i);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:[uo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ia,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as fp}from"react/jsx-runtime";var Go=({style:e,...t})=>fp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:fp("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 ht,jsxs as eg}from"react/jsx-runtime";var Vo=({style:e,...t})=>eg("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:[ht("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),ht("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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 hp,jsxs as tg}from"react/jsx-runtime";var or=({style:e,...t})=>tg("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:[hp("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),hp("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 $o=class extends lt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new he(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.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 Y("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Bt(r)}}},zo,qo=class extends lt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";Li(this,zo,void 0);this.proxyProvider=new he(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?Ys(this,zo,{name:"MetaMask",icon:Vo,id:"io.metamask"}):a==="phantom"&&Ys(this,zo,{name:"Phantom",icon:or,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 Zc(this,zo)??{name:"Browser Extension",icon:Go,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 Y("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Bt(r)}}};zo=new WeakMap;import{getAddress as n6}from"@ethersproject/address";import{Web3Provider as a6}from"@ethersproject/providers";import{isMobile as rg}from"react-device-detect";var sa=class extends $o{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{rg||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 Y("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Bt(t)}}};var la=class extends lt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new he(void 0,po);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.emit("initialized"),this.initialized=!0}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var ca=class extends la{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:or,id:"phantom"}}};import{EthereumProvider as Eg,OPTIONAL_EVENTS as Pg,OPTIONAL_METHODS as Tg}from"@walletconnect/ethereum-provider";import{isMobile as xg}from"react-device-detect";import{createContext as fg,useContext as hg,useEffect as ml,useRef as yg,useState as gg}from"react";import{jsx as og}from"react/jsx-runtime";function da({src:e,...t}){return og("img",{src:e,...t,style:{display:"none"}})}import{useContext as Np,useEffect as Op,useMemo as dg,useState as pg}from"react";import{createContext as ug}from"react";var Tt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Id,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var yp=({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 ng=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),gp=e=>ng.has(e),vp=(e,t,r)=>r.indexOf(e)===t,wp=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(gp).filter(vp):e?e.filter(gp).filter(vp):Tt.appearance.walletList;var pa={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 ua={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var ma={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var Cp={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 bp={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 fa={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 ha={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 ya={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 Ep={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 Pp={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 Tp={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 xp={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 Sp={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 _p={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 Ap={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 kp={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 ga={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 va={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 wa={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 Vn={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 Rp={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 Ip={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 Ca={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var ba={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var Ea={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 $n=[pa,ua,ma,Sp,Ip,Ho,ga,va,wa,Vn,zn,Ep,Pp,Tp,xp,fa,ha,ya,Ap,kp,Cp,bp,Ca,Ea,ba,_p,Rp],xP=new Set($n.map(e=>e.id));import ho from"tinycolor2";var Mp="#FFFFFF",ig="#000000",ag=Mp,sg="#1E1E1D";function lg(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function Fr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return ho({...e.toHsl(),l:r})}function Wp({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=Mp,blackHex:a=ig}){let l;switch(e){case"light":l=ag;break;case"dark":l=sg;break;default:l=e;break}let s=ho(l),c=ho(t),u=ho(r),m=ho(o),h=ho(n),v=lg(s.getLuminance()),E=Fr(s,v==="light"?-.04:.11),g=Fr(s,v==="light"?-.88:.87),x=Fr(s,v==="light"?-.77:.75),C=Fr(s,v==="light"?-.43:.45).desaturate(v==="light"?60:20),T=Fr(s,v==="light"?-.08:.25).desaturate(v==="light"?60:20),R=Fr(c,.15),I=Fr(c,-.06),_=ho(c.getLuminance()>.5?a:i),F=Fr(u,-.16);return{colorScheme:v,background:s.toHslString(),background2:E.toHslString(),foreground:g.toHslString(),foreground2:x.toHslString(),foreground3:C.toHslString(),foreground4:T.toHslString(),accent:c.toHslString(),accentLight:R.toHslString(),accentDark:I.toHslString(),foregroundAccent:_.toHslString(),success:u.toHslString(),successDark:F.toHslString(),error:h.toHslString(),warn:m.toHslString()}}function dl(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],i=t?.loginMethods?.filter($=>n.includes($)),a,l,s,c,u,m,h,v,E,g,x,C;t?.loginMethods?(a=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),c=i?.includes("google"),u=i?.includes("twitter"),m=i?.includes("discord"),v=i?.includes("spotify"),h=i?.includes("tiktok"),g=i?.includes("github"),E=i?.includes("linkedin"),x=i?.includes("apple"),C=i?.includes("farcaster")):(a=e.emailAuth,l=e.smsAuth,s=e.walletAuth,c=e.googleOAuth,u=e.twitterOAuth,m=e.discordOAuth,g=e.githubOAuth,v=e.spotifyOAuth,h=e.tiktokOAuth,E=e.linkedinOAuth,x=e.appleOAuth,C=e.farcasterAuth);let T=[a,l].filter(Boolean),R=[c,u,m,g,v,h,E,x,C].filter(Boolean),I=[s].filter(Boolean);if(T.length+R.length+I.length===0)throw new Error("You must enable at least one login method");let _=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;_&&I.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),_=!1):!_&&R.length+T.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),_=!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 F=wp({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),U=yp({input:t?.loginMethodsAndOrder}),B=t?.intl?.defaultCountry??"US",{chains:k,defaultChain:z}=cg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),L=!!t?.defaultChain||!!t?.supportedChains,j=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ie,ee=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?j?ie=t?.embeddedWallets?.noPromptOnSignature??!0:ie=t?.embeddedWallets?.noPromptOnSignature??ee:ie=ee,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ie!==!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:Wp({backgroundTheme:t?.appearance?.theme??Tt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Tt.appearance.accentColor}),loginGroupPriority:_?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:F},loginMethods:{wallet:s,email:a,sms:l,google:c,twitter:u,discord:m,github:g,spotify:v,tiktok:h,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??Tt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Tt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Tt.rpcConfig.rpcTimeouts},chains:k,defaultChain:z,intl:{defaultCountry:B},shouldEnforceDefaultChainOnConnect:L,captchaEnabled:e.captchaEnabled??Tt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...j?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:ie},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:j?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Tt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Tt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Tt._render.inParentNodeId}}}function Lp(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function cg({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:$n.find(u=>u.id===s.id)??s)}else n=$n.concat(e??[]);let i=t?n[0]:Ho,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}import{jsx as mg}from"react/jsx-runtime";var Dp={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:""},pl=dl(Dp,void 0,!1),ul=ug({appConfig:pl,isServerConfigLoaded:!1}),Up=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=pg(null),a=dg(()=>dl(n??Dp,o,!!n),[n,o]);return Op(()=>{let l=Lp(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),Op(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),mg(ul.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Pa=()=>{let{appConfig:e}=Np(ul);return e},Ta=()=>{let{isServerConfigLoaded:e}=Np(ul);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 Cg}from"react/jsx-runtime";var Fp=fg({ready:!1,app:pl,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),vg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Bp=e=>{let t=Pa(),r=e.authenticated,[o,n]=gg(e.initialScreen);ml(()=>{!r&&!vg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=yg(null);ml(()=>{e.open||(i.current=null)},[e.open]),ml(()=>{i.current=null},[e.initialScreen]);let a={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:i};return Cg(Fp.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&wg(da,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},S=()=>hg(Fp);import{jsx as jo,jsxs as bg}from"react/jsx-runtime";var qn=({style:e,...t})=>{let{app:r}=S();return bg("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:[jo("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),jo("g",{clipPath:"url(#clip0_1765_9946)",children:jo("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"})}),jo("defs",{children:jo("clipPath",{id:"clip0_1765_9946",children:jo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var nr=class extends lt{constructor(r,o,n,i,a,l,s){super(s||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new he(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Do[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=Zi(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:Vo,id:"io.metamask"}:{name:zd(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=Do[r],this.walletClientType=r,this.redirectUri=void 0,Zd(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Fo)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new Y("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Zi(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Bo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(Bt(a));return}o(new Y("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 a of this.chains){let l=Yi(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await Eg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Pg,optionalMethods:Tg,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),xg&&this.walletEntry){let{redirect:l,href:s}=Yd(a,this.walletEntry);Qd({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Qi(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=Zi(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var fl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===Hp(t)).length:!1},Bo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||po:po,jn=class extends Sg{constructor(r,o,n,i,a,l,s,c){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new he:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;le.get(il)&&(le.getKeys().forEach(o=>{o.startsWith("walletconnect")&&le.del(o)}),le.del(il));let r=$d(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Or()&&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(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.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,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new ta(r,o,this.rpcConfig,this.chains,i,n.id),s=new aa(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 i=this.findWalletConnector(r,o);if(i)return i instanceof nr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new sa(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new qo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new qo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new qo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new $o(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new na(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId):r==="phantom"?new ca(this.defaultChain):new nr(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=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",o=le.get(al);return o&&Array.isArray(o)&&o.map(a=>r(a)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));le.put(al,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=Hp(r),this.emit("walletsUpdated")}};function ra(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 _g}from"ofetch";var Ag=[Di,Fi,Ui],xa=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=rl,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=_g.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:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!Ag.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Oi}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw se(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw se(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw se(o)}}};import yo from"js-cookie";function Gp(e){return e instanceof Lr?"email":e instanceof fo?"sms":e instanceof mo?"siwe":e instanceof Mo?"custom_auth":e instanceof er?e.meta.provider:null}import*as Vp from"jose";var ir=class{static parse(t){try{return new ir(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Vp.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 kg=30,Sa=class{constructor(){this.authenticateOnce=new Xe(async t=>this._authenticate(t)),this.linkOnce=new Xe(async t=>this._link(t)),this.refreshOnce=new Xe(this._refresh.bind(this)),this.destroyOnce=new Xe(this._destroy.bind(this)),this.forkSessionOnce=new Xe(this._forkSession.bind(this))}get token(){try{let t=le.get(lo);return typeof t=="string"?new ir(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=le.get(zi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=le.get(Nn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=yo.get($i);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=ir.parse(this.token);return t!==null&&!t.isExpired(kg)}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:i}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let a=Gp(t);return a&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:a,isNewUser:i}),a==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:ft(n),isNewUser:i}}catch(r){throw console.warn("Error authenticating session"),Ze(r)}}async _link(t){try{let r=await t.link();return ft(r)}catch(r){throw console.warn("Error linking account"),Ze(r)}}async _refresh(){if(!this.api)throw new P("Session has no API instance");if(!this.client)throw new P("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 i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(Di,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Fi,{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),ft(n.user)}catch(n){if(n instanceof Xt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Ze(n)}}async _destroy(){try{await this.api?.post(Ui,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new P("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Xc,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw Ze(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=le.get(lo);if(le.put(lo,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=ir.parse(t)?.expiration;yo.set(ol,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else le.del(lo),yo.remove(ol)}storeRefreshToken(t){typeof t=="string"?(le.put(zi,t),this.client?.useServerCookies||(yo.set($i,"t",{sameSite:"Strict",secure:!0,expires:30}),yo.set(nl,t,{sameSite:"Strict",secure:!0,expires:30}))):(le.del(zi),yo.remove(nl),yo.remove($i))}clearForkedToken(){le.del(Nn)}};var hl,_a,zp,Kn=class{constructor(t){Li(this,_a);this.apiUrl=t.apiUrl||Vi,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Md,this.appId=t.appId,this.clientAnalyticsId=Qc(this,_a,zp).call(this),hl||(hl=new Sa),this.session=hl,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,r,o,n,i,a,l){this.connectors||(this.connectors=new jn(this.appId,t,r,o,n,i,a,l))}generateApi(){let t=new xa(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 P("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new P("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(ud,{address:t});return ft(r)}catch(r){throw Ze(r)}}async acceptTerms(){try{let t=await this.api.post(Td,{});return ft(t)}catch(t){throw Ze(t)}}async unlinkPhone(t){try{let r=await this.api.post(yd,{phoneNumber:t});return ft(r)}catch(r){throw Ze(r)}}async unlinkWallet(t){try{let r=await this.api.post(od,{address:t});return ft(r)}catch(r){throw Ze(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(bd,{provider:t,subject:r});return ft(o)}catch(o){throw Ze(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(ld,{fid:t});return ft(r)}catch(r){throw Ze(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(xd,{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(Sd,t)}catch(r){throw Ze(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?ir.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 Ze(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 forkSession(){return await this.session.forkSession()}};_a=new WeakSet,zp=function(){if(typeof window>"u")return null;try{let r=le.get(Dn);if(typeof r=="string"&&r.length>0)return r}catch{}let t=Rg();try{return le.put(Dn,t),t}catch{return t}};import{Turnstile as Ng}from"@marsidev/react-turnstile";import{useEffect as Dg,useMemo as Ug}from"react";import{useMemo as Ig,useRef as Mg,useContext as Wg,useState as yl,createContext as Lg}from"react";import{jsx as Og}from"react/jsx-runtime";var $p=Lg({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}),Ht=class extends He{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},qp=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Mg(null),[i,a]=yl(),[l,s]=yl(),[c,u]=yl(!1),m=Ig(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return Og($p.Provider,{value:{...m,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Gd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Ht("Captcha failed",null,"captcha_timeout")}}},children:e})},ce=()=>Wg($p);import{jsx as jp}from"react/jsx-runtime";var gl=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=ce(),[,s]=Ug(()=>r?.split("t:")||[],[r]);if(Dg(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return jp("div",{className:"hidden h-0 w-0",children:jp(Ng,{...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"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as Zb,useEffect as yy,useRef as Qb,useState as Xb}from"react";import e4 from"react-dom";import{createContext as Fg,useContext as Bg}from"react";var vl=Fg({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}),W=()=>Bg(vl);import{createContext as Hg,useContext as Gg}from"react";var ae=Hg({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,initLoginWithEmail:b,initLoginWithSms:b,loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),H=()=>Gg(ae);import{useEffect as Vg,useState as zg}from"react";var Kp=e=>{let[t,r]=zg("auto");return Vg(()=>{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 $g,useContext as qg,useEffect as jg}from"react";var Yp={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:[]}},wl=$g(void 0),Jp=()=>qg(wl);function ge(e,t){if(!t)return;let o=Jp().current[e];return jg(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function N(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Zp(){let e=Jp();return(t,r,...o)=>N(e,t,r,...o)}function Cl(e){ge("configureMfa",e)}import au from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import l1 from"@heroicons/react/24/solid/DocumentCheckIcon";import c1 from"styled-components";import vo,{css as Tl}from"styled-components";import El from"styled-components";import{Fragment as Yg,jsx as bl,jsxs as Jg}from"react/jsx-runtime";var Br=({success:e,fail:t})=>Jg(Yg,{children:[bl(xt,{className:e?"success":t?"fail":""}),bl(Pl,{className:e?"success":t?"fail":""})]}),xt=El.span`
|
|
12
|
+
- https://privy.io`;this.getNonceOnce=new Xe(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 P("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(od,{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 le(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(nd,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw le(t)}}async sign(){if(!this.api)throw new P("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new P("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 P("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(rd,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new P("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,i=window.location.origin,a="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,i,l,o,a)}};var ho=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new P("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(wd,{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 le(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new P("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(gd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw le(t)}}async sendSmsCode(t,r){if(!this.api)throw new P("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new P("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(yd,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw le(o)}}};import{v4 as Mg}from"uuid";function et(e){return new Date(e*1e3)}function Vy(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:et(r.verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let i={address:r.address,type:r.type,verifiedAt:et(r.verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:et(r.verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:et(r.verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:et(r.verified_at)};t.push(s);break;case"twitter_oauth":let c={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:et(r.verified_at)};t.push(c);break;case"discord_oauth":let u={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(u);break;case"github_oauth":let m={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(m);break;case"tiktok_oauth":let h={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:et(r.verified_at)};t.push(h);break;case"linkedin_oauth":let g={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(g);break;case"apple_oauth":let E={subject:r.subject,email:r.email,type:r.type,verifiedAt:et(r.verified_at)};t.push(E);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:et(r.verified_at)});break;case"farcaster":let v={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:et(r.verified_at)};t.push(v);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function Et(e,t){return e.sort((r,o)=>o.verifiedAt.getTime()-r.verifiedAt.getTime()),e.find(r=>r.type===t)}var ye=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,zy=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Pt=(e,t)=>t==="all-users"&&!ye(e)||t==="users-without-wallets"&&!zy(e)?.length;function ft(e){if(!e)return null;let t=Vy(e.linked_accounts),r=Et(t,"wallet"),o=Et(t,"email"),n=Et(t,"phone"),i=Et(t,"google_oauth"),a=Et(t,"twitter_oauth"),l=Et(t,"discord_oauth"),s=Et(t,"github_oauth"),c=Et(t,"spotify_oauth"),u=Et(t,"tiktok_oauth"),m=Et(t,"linkedin_oauth"),h=Et(t,"apple_oauth"),g=Et(t,"farcaster"),E=e.mfa_methods.map(({type:x,verified_at:C})=>({type:x,verifiedAt:et(C)}));return{id:e.id,createdAt:et(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},tiktok:u&&{subject:u.subject,username:u.username,name:u.name},linkedin:m&&{subject:m.subject,name:m.name,email:m.email},apple:h&&{subject:h.subject,email:h.email},farcaster:g&&{fid:g.fid,ownerAddress:g.ownerAddress,displayName:g.displayName,username:g.username,bio:g.bio,pfp:g.pfp,url:g.url},mfaMethods:E.map(x=>x.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as Vp}from"@ethersproject/address";import Ag from"eventemitter3";import eg from"@coinbase/wallet-sdk";import{jsx as lp,jsxs as $y}from"react/jsx-runtime";var ea=({style:e,...t})=>$y("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:[lp("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),lp("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 rr}from"@ethersproject/address";import{Web3Provider as fp}from"@ethersproject/providers";import{default as Qy}from"eventemitter3";import Zy from"eventemitter3";var qy=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],cp=e=>qy.includes(e);import{ErrorCode as jy}from"@ethersproject/logger";var Uo=class extends Y{constructor(){super("Wallet timeout");this.type="wallet_error"}},Fo=class extends Y{constructor(){super("User rejected connection");this.type="wallet_error"}},Bt=e=>{if(e instanceof Y)return e;if(e?.code&&e?.reason){let t=new Ee(e);return e.code===jy.ACTION_REJECTED&&(t.details=Ve.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ee(e):new Y("Unknown connector error",e)},Tt=class extends He{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},Ee=class extends Tt{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Ve).find(i=>i.eipCode===o.code);this.details=n||Ve.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Ve.E32002_CONNECTION_ALREADY_PENDING:this.details=Ve.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Ve.E32002_WALLET_LOCKED))}},Ky={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}},Yy={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}},Jy={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}},Ve={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Jy,...Yy},Tr={...Ky,...Ve};var ge=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 Uo,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||uo,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 Y(`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 Bt(r)})}},Fr=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},ta=class extends Zy{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=Pr(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=Bo(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new Fr(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Me()||!this.address)throw new Fr("Disconnected",4900);return(await up(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new Fr(`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 Fr(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Pr(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0];return await dp(o)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await pp(Ji(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:mo(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 mo(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(cp(r.method)){let o=await Me();if(await mp(),!o||!this.address)throw new Fr("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 Fr("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Me();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}}},tr=class extends ge{constructor(r){super(r,r.rpcTimeoutDuration)}},Br=class extends ge{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 Xy=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},lt=class extends Qy{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=No(r),this.walletClientType==="privy"&&ce.put(qi(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=i,this.rpcTimeoutDuration=Bo(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let i=async()=>!!this.wallets.find(a=>rr(a.address)===rr(r));return{address:rr(r),chainId:o,meta:n,switchChain:async a=>{if(!i)throw new Y("Wallet is not currently connected.");let l=this.wallets.find(h=>rr(h.address)===rr(r))?.chainId;if(!l)throw new Y("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===No(s))return;let u=this.chains.find(h=>h.id===c);if(!u)throw new Y(`Unsupported chainId: ${a}`);let m=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await m()}catch(h){if(Xy(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),m();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new Y(`Rainbow does not support the chainId ${o}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new Y("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new Y("Wallet is not currently connected.");return new fp(new tr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new Y("Wallet is not currently connected.");return new Br(this.proxyProvider)},sign:async a=>{if(!await i())throw new Y("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=rr(n),a=[],l;if(this.walletClientType==="privy"){let c=ce.get(qi(i));this.chains.find(u=>u.id===Number(c))||(ce.del(qi(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${ll}`,c),l=ll}let s=No(l);if(!a.find(c=>rr(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet(rr(n),s,c))}ra(a,this.wallets)||(this.wallets=a,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=>rr(n)===rr(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 fp(new tr(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 Ho={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var tg=(e,t)=>{let o=Yi(1,[Ho],{},t);return e.makeWeb3Provider(o,1)},oa,na=class extends lt{constructor(r,o,n,i){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new ge(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),oa||(oa=new eg({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(tg(oa,i))}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(){oa.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:ea,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 Y("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Bt(r)}}};import{jsx as hp}from"react/jsx-runtime";var ia=({...e})=>hp("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:hp("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 aa=class extends lt{constructor(r,o,n,i){super("privy",o,n,i);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:[mo(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ia,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as yp}from"react/jsx-runtime";var Go=({style:e,...t})=>yp("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:yp("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 ht,jsxs as rg}from"react/jsx-runtime";var Vo=({style:e,...t})=>rg("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",x:0,y:0,viewBox:"0 0 318.6 318.6",width:"28",height:"28",style:{height:"28px",width:"28px",...e},...t,children:[ht("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),ht("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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"}),ht("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 gp,jsxs as og}from"react/jsx-runtime";var or=({style:e,...t})=>og("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[gp("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),gp("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 $o=class extends lt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new ge(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.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 Y("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Bt(r)}}},zo,qo=class extends lt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";Li(this,zo,void 0);this.proxyProvider=new ge(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?Js(this,zo,{name:"MetaMask",icon:Vo,id:"io.metamask"}):a==="phantom"&&Js(this,zo,{name:"Phantom",icon:or,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 Xc(this,zo)??{name:"Browser Extension",icon:Go,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 Y("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Bt(r)}}};zo=new WeakMap;import{getAddress as s6}from"@ethersproject/address";import{Web3Provider as c6}from"@ethersproject/providers";import{isMobile as ng}from"react-device-detect";var sa=class extends $o{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{ng||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new Y("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Bt(t)}}};var la=class extends lt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new ge(void 0,uo);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 ca=class extends la{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:or,id:"phantom"}}};import{EthereumProvider as Tg,OPTIONAL_EVENTS as xg,OPTIONAL_METHODS as Sg}from"@walletconnect/ethereum-provider";import{isMobile as _g}from"react-device-detect";import{createContext as yg,useContext as gg,useEffect as fl,useRef as vg,useState as wg}from"react";import{jsx as ig}from"react/jsx-runtime";function da({src:e,...t}){return ig("img",{src:e,...t,style:{display:"none"}})}import{useContext as Up,useEffect as Dp,useMemo as ug,useState as mg}from"react";import{createContext as fg}from"react";var xt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Wd,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var vp=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var ag=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),wp=e=>ag.has(e),Cp=(e,t,r)=>r.indexOf(e)===t,bp=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(wp).filter(Cp):e?e.filter(wp).filter(Cp):xt.appearance.walletList;var pa={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 ua={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var ma={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var Ep={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 Pp={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 fa={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 ha={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 ya={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 Tp={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var xp={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var Sp={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 _p={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 Ap={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 kp={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 Rp={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 Ip={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 ga={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 va={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 wa={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 zn={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 $n={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 Mp={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 Wp={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 Ca={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var ba={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var Ea={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 qn=[pa,ua,ma,Ap,Wp,Ho,ga,va,wa,zn,$n,Tp,xp,Sp,_p,fa,ha,ya,Rp,Ip,Ep,Pp,Ca,Ea,ba,kp,Mp],AP=new Set(qn.map(e=>e.id));import yo from"tinycolor2";var Lp="#FFFFFF",sg="#000000",lg=Lp,cg="#1E1E1D";function dg(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function Hr(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return yo({...e.toHsl(),l:r})}function Op({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=Lp,blackHex:a=sg}){let l;switch(e){case"light":l=lg;break;case"dark":l=cg;break;default:l=e;break}let s=yo(l),c=yo(t),u=yo(r),m=yo(o),h=yo(n),g=dg(s.getLuminance()),E=Hr(s,g==="light"?-.04:.11),v=Hr(s,g==="light"?-.88:.87),x=Hr(s,g==="light"?-.77:.75),C=Hr(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),T=Hr(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),R=Hr(c,.15),I=Hr(c,-.06),_=yo(c.getLuminance()>.5?a:i),F=Hr(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:E.toHslString(),foreground:v.toHslString(),foreground2:x.toHslString(),foreground3:C.toHslString(),foreground4:T.toHslString(),accent:c.toHslString(),accentLight:R.toHslString(),accentDark:I.toHslString(),foregroundAccent:_.toHslString(),success:u.toHslString(),successDark:F.toHslString(),error:h.toHslString(),warn:m.toHslString()}}function pl(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","tiktok","linkedin","github","apple","farcaster"],i=t?.loginMethods?.filter($=>n.includes($)),a,l,s,c,u,m,h,g,E,v,x,C;t?.loginMethods?(a=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),s=t.loginMethods.includes("wallet"),c=i?.includes("google"),u=i?.includes("twitter"),m=i?.includes("discord"),g=i?.includes("spotify"),h=i?.includes("tiktok"),v=i?.includes("github"),E=i?.includes("linkedin"),x=i?.includes("apple"),C=i?.includes("farcaster")):(a=e.emailAuth,l=e.smsAuth,s=e.walletAuth,c=e.googleOAuth,u=e.twitterOAuth,m=e.discordOAuth,v=e.githubOAuth,g=e.spotifyOAuth,h=e.tiktokOAuth,E=e.linkedinOAuth,x=e.appleOAuth,C=e.farcasterAuth);let T=[a,l].filter(Boolean),R=[c,u,m,v,g,h,E,x,C].filter(Boolean),I=[s].filter(Boolean);if(T.length+R.length+I.length===0)throw new Error("You must enable at least one login method");let _=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;_&&I.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),_=!1):!_&&R.length+T.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),_=!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 F=bp({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),U=vp({input:t?.loginMethodsAndOrder}),B=t?.intl?.defaultCountry??"US",{chains:k,defaultChain:z}=pg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),L=!!t?.defaultChain||!!t?.supportedChains,j=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,ie,ee=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?j?ie=t?.embeddedWallets?.noPromptOnSignature??!0:ie=t?.embeddedWallets?.noPromptOnSignature??ee:ie=ee,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&ie!==!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:Op({backgroundTheme:t?.appearance?.theme??xt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??xt.appearance.accentColor}),loginGroupPriority:_?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:F},loginMethods:{wallet:s,email:a,sms:l,google:c,twitter:u,discord:m,github:v,spotify:g,tiktok:h,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??xt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??xt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??xt.rpcConfig.rpcTimeouts},chains:k,defaultChain:z,intl:{defaultCountry:B},shouldEnforceDefaultChainOnConnect:L,captchaEnabled:e.captchaEnabled??xt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...j?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:ie},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:j?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??xt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??xt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??xt._render.inParentNodeId}}}function Np(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function pg({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:qn.find(u=>u.id===s.id)??s)}else n=qn.concat(e??[]);let i=t?n[0]:Ho,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}import{jsx as hg}from"react/jsx-runtime";var Fp={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:""},ul=pl(Fp,void 0,!1),ml=fg({appConfig:ul,isServerConfigLoaded:!1}),Bp=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=mg(null),a=ug(()=>pl(n??Fp,o,!!n),[n,o]);return Dp(()=>{let l=Np(o,t);r.createAnalyticsEvent("sdk_initialize",l)},[o,t]),Dp(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),hg(ml.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Pa=()=>{let{appConfig:e}=Up(ml);return e},Ta=()=>{let{isServerConfigLoaded:e}=Up(ml);return e};var b=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as bg,jsxs as Eg}from"react/jsx-runtime";var Hp=yg({ready:!1,app:ul,currentScreen:null,lastScreen:null,navigate:b,navigateBack:b,resetNavigation:b,setModalData:b,onUserCloseViaDialogOrKeybindRef:void 0}),Cg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Gp=e=>{let t=Pa(),r=e.authenticated,[o,n]=wg(e.initialScreen);fl(()=>{!r&&!Cg.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=vg(null);fl(()=>{e.open||(i.current=null)},[e.open]),fl(()=>{i.current=null},[e.initialScreen]);let a={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:i};return Eg(Hp.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&bg(da,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},S=()=>gg(Hp);import{jsx as jo,jsxs as Pg}from"react/jsx-runtime";var jn=({style:e,...t})=>{let{app:r}=S();return Pg("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[jo("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),jo("g",{clipPath:"url(#clip0_1765_9946)",children:jo("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"})}),jo("defs",{children:jo("clipPath",{id:"clip0_1765_9946",children:jo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var nr=class extends lt{constructor(r,o,n,i,a,l,s){super(s||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new ge(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Do[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=Zi(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:Vo,id:"io.metamask"}:{name:qd(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=Do[r],this.walletClientType=r,this.redirectUri=void 0,Xd(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new Fo)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new Y("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Zi(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Bo(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(Bt(a));return}o(new Y("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 a of this.chains){let l=Yi(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await Tg.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:xg,optionalMethods:Sg,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),_g&&this.walletEntry){let{redirect:l,href:s}=Zd(a,this.walletEntry);ep({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Qi(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=Zi(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var hl=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&o.address===Vp(t)).length:!1},Bo=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||uo:uo,Kn=class extends Ag{constructor(r,o,n,i,a,l,s,c){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new ge:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let r=new Set,o=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;ce.get(al)&&(ce.getKeys().forEach(o=>{o.startsWith("walletconnect")&&ce.del(o)}),ce.del(al));let r=jd(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Dr()&&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(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.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,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new ta(r,o,this.rpcConfig,this.chains,i,n.id),s=new aa(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 i=this.findWalletConnector(r,o);if(i)return i instanceof nr&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new sa(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new qo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new qo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new qo(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new $o(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new na(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId):r==="phantom"?new ca(this.defaultChain):new nr(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=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",o=ce.get(sl);return o&&Array.isArray(o)&&o.map(a=>r(a)).every(Boolean)?o:[]}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));ce.put(sl,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=Vp(r),this.emit("walletsUpdated")}};function ra(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 Rg=[Di,Fi,Ui],xa=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=ol,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:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!Rg.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Oi}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw le(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw le(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw le(o)}}};import go from"js-cookie";function zp(e){return e instanceof Nr?"email":e instanceof ho?"sms":e instanceof fo?"siwe":e instanceof Mo?"custom_auth":e instanceof er?e.meta.provider:null}import*as $p from"jose";var ir=class{static parse(t){try{return new ir(t)}catch{return null}}constructor(t){this.value=t,this._decoded=$p.decodeJwt(t)}get subject(){return this._decoded.sub}get expiration(){return this._decoded.exp}get issuer(){return this._decoded.iss}get audience(){return this._decoded.aud}isExpired(t=0){let r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var Ig=30,Sa=class{constructor(){this.authenticateOnce=new Xe(async t=>this._authenticate(t)),this.linkOnce=new Xe(async t=>this._link(t)),this.refreshOnce=new Xe(this._refresh.bind(this)),this.destroyOnce=new Xe(this._destroy.bind(this)),this.forkSessionOnce=new Xe(this._forkSession.bind(this))}get token(){try{let t=ce.get(co);return typeof t=="string"?new ir(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=ce.get(zi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=ce.get(Dn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=go.get($i);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=ir.parse(this.token);return t!==null&&!t.isExpired(Ig)}authenticate(t){return this.authenticateOnce.execute(t)}link(t){return this.linkOnce.execute(t)}refresh(){return this.refreshOnce.execute()}forkSession(){return this.forkSessionOnce.execute()}destroy(){return this.destroyOnce.execute()}async _authenticate(t){try{let{token:r,refresh_token:o,user:n,is_new_user:i}=await t.authenticate();this.storeToken(r),this.storeRefreshToken(o);let a=zp(t);return a&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate",{method:a,isNewUser:i}),a==="siwe"&&this.client&&this.client.createAnalyticsEvent("sdk_authenticate_siwe",{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}),{user:ft(n),isNewUser:i}}catch(r){throw console.warn("Error authenticating session"),Ze(r)}}async _link(t){try{let r=await t.link();return ft(r)}catch(r){throw console.warn("Error linking account"),Ze(r)}}async _refresh(){if(!this.api)throw new P("Session has no API instance");if(!this.client)throw new P("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 i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(Di,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Fi,{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),ft(n.user)}catch(n){if(n instanceof Xt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Ze(n)}}async _destroy(){try{await this.api?.post(Ui,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new P("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(td,{refresh_token:t});return this.storeToken(r.token),this.storeRefreshToken(r.refresh_token),r.new_session_refresh_token}catch(r){throw Ze(r)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let r=ce.get(co);if(ce.put(co,t),r!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let o=ir.parse(t)?.expiration;go.set(nl,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else ce.del(co),go.remove(nl)}storeRefreshToken(t){typeof t=="string"?(ce.put(zi,t),this.client?.useServerCookies||(go.set($i,"t",{sameSite:"Strict",secure:!0,expires:30}),go.set(il,t,{sameSite:"Strict",secure:!0,expires:30}))):(ce.del(zi),go.remove(il),go.remove($i))}clearForkedToken(){ce.del(Dn)}};var yl,_a,qp,Yn=class{constructor(t){Li(this,_a);this.apiUrl=t.apiUrl||Vi,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Ld,this.appId=t.appId,this.clientAnalyticsId=ed(this,_a,qp).call(this),yl||(yl=new Sa),this.session=yl,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,r,o,n,i,a,l){this.connectors||(this.connectors=new Kn(this.appId,t,r,o,n,i,a,l))}generateApi(){let t=new xa(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 P("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new P("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let r=await this.api.post(fd,{address:t});return ft(r)}catch(r){throw Ze(r)}}async acceptTerms(){try{let t=await this.api.post(Sd,{});return ft(t)}catch(t){throw Ze(t)}}async unlinkPhone(t){try{let r=await this.api.post(vd,{phoneNumber:t});return ft(r)}catch(r){throw Ze(r)}}async unlinkWallet(t){try{let r=await this.api.post(id,{address:t});return ft(r)}catch(r){throw Ze(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(Pd,{provider:t,subject:r});return ft(o)}catch(o){throw Ze(o)}}async unlinkFarcaster(t){try{let r=await this.api.post(dd,{fid:t});return ft(r)}catch(r){throw Ze(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(_d,{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(Ad,t)}catch(r){throw Ze(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?ir.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 Ze(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 forkSession(){return await this.session.forkSession()}};_a=new WeakSet,qp=function(){if(typeof window>"u")return null;try{let r=ce.get(Un);if(typeof r=="string"&&r.length>0)return r}catch{}let t=Mg();try{return ce.put(Un,t),t}catch{return t}};import{Turnstile as Ug}from"@marsidev/react-turnstile";import{useEffect as Fg,useMemo as Bg}from"react";import{useMemo as Wg,useRef as Lg,useContext as Og,useState as gl,createContext as Ng}from"react";import{jsx as Dg}from"react/jsx-runtime";var jp=Ng({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:b,setError:b,setExecuting:b,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:b,reset:b,execute:b}),Ht=class extends He{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},Kp=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=Lg(null),[i,a]=gl(),[l,s]=gl(),[c,u]=gl(!1),m=Wg(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return Dg(jp.Provider,{value:{...m,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await zd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Ht("Captcha failed",null,"captcha_timeout")}}},children:e})},de=()=>Og(jp);import{jsx as Yp}from"react/jsx-runtime";var vl=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=de(),[,s]=Bg(()=>r?.split("t:")||[],[r]);if(Fg(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return Yp("div",{className:"hidden h-0 w-0",children:Yp(Ug,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as e4,useEffect as gy,useRef as t4,useState as r4}from"react";import o4 from"react-dom";import{createContext as Hg,useContext as Gg}from"react";var wl=Hg({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:b,initializeWalletProxy:b,getAuthMeta:b,getAuthFlow:b,closePrivyModal:b,openPrivyModal:b,connectWallet:b,initLoginWithWallet:b,loginWithWallet:b,initLoginWithFarcaster:b,loginWithFarcaster:b,loginWithCode:b,initLoginWithEmail:b,initLoginWithSms:b,initUpdateEmail:b,resendEmailCode:b,resendSmsCode:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,initLoginWithOAuth:b,loginWithOAuth:b,refreshUser:b,walletProxy:null,createAnalyticsEvent:b,acceptTerms:b,getUsdTokenPrice:b,recoverEmbeddedWallet:b,getFiatOnRampConfig:b,updateWallets:b,fundWallet:b,setReadyToTrue:b}),W=()=>Gg(wl);import{createContext as Vg,useContext as zg}from"react";var ae=Vg({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:b,login:b,connectOrCreateWallet:b,linkEmail:b,linkPhone:b,linkFarcaster:b,linkWallet:b,linkGoogle:b,linkTwitter:b,linkDiscord:b,linkGithub:b,linkSpotify:b,linkTiktok:b,linkLinkedIn:b,linkApple:b,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,initLoginWithEmail:b,initLoginWithSms:b,loginWithCode:b,fundWallet:b,initLoginWithHeadlessOAuth:b,loginWithHeadlessOAuth:b,isHeadlessOAuthLoading:!1,isModalOpen:!1}),H=()=>zg(ae);import{useEffect as $g,useState as qg}from"react";var Jp=e=>{let[t,r]=qg("auto");return $g(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};import{createContext as jg,useContext as Kg,useEffect as Yg}from"react";var Zp={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:[]}},Cl=jg(void 0),Qp=()=>Kg(Cl);function ve(e,t){if(!t)return;let o=Qp().current[e];return Yg(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function N(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Xp(){let e=Qp();return(t,r,...o)=>N(e,t,r,...o)}function bl(e){ve("configureMfa",e)}import lu from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import d1 from"@heroicons/react/24/solid/DocumentCheckIcon";import p1 from"styled-components";import wo,{css as xl}from"styled-components";import Pl from"styled-components";import{Fragment as Zg,jsx as El,jsxs as Qg}from"react/jsx-runtime";var xr=({success:e,fail:t})=>Qg(Zg,{children:[El(St,{className:e?"success":t?"fail":""}),El(Tl,{className:e?"success":t?"fail":""})]}),St=Pl.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
|
-
`,Pl
|
|
45
|
+
`,Tl=Pl(St)`
|
|
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
|
+
`,vo=e=>El(Jg,{color:e.color||"var(--privy-color-foreground-3)"}),Jg=Pl(St)`
|
|
52
52
|
&& {
|
|
53
53
|
height: 0.9rem;
|
|
54
54
|
width: 0.9rem;
|
|
@@ -57,7 +57,7 @@ Resources:
|
|
|
57
57
|
/* Override default Loader to match button transitions */
|
|
58
58
|
transition: border-color 200ms ease;
|
|
59
59
|
}
|
|
60
|
-
`;import{jsx as
|
|
60
|
+
`;import{jsx as _t,jsxs as Ia}from"react/jsx-runtime";var Aa=wo.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
|
-
`,D=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>
|
|
89
|
-
${e=>e.hideAnimations&&
|
|
88
|
+
`,D=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>_t(eu,{disabled:t||r,...n,children:t?Ia("span",{children:[_t(vo,{}),o?_t("span",{children:o}):null]}):e}),DT=wo(D)`
|
|
89
|
+
${e=>e.hideAnimations&&xl`
|
|
90
90
|
&& {
|
|
91
91
|
transition: none;
|
|
92
92
|
}
|
|
93
93
|
`}
|
|
94
|
-
`,ka=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>
|
|
94
|
+
`,ka=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>_t(eu,{as:"a",disabled:t||r,...n,children:t?Ia("span",{children:[_t(vo,{}),o?_t("span",{children:o}):null]}):e}),eu=wo(Aa)`
|
|
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?xl`
|
|
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
|
-
`,Gt=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>
|
|
139
|
+
`,Gt=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>_t(Xg,{disabled:t||r,...n,children:t?Ia("span",{children:[_t(vo,{}),o?_t("span",{children:o}):null]}):e}),Xg=wo(Aa)`
|
|
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
|
-
`,Ra=
|
|
168
|
+
`,Ra=wo.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&&xl`
|
|
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
|
+
`,UT=wo.div`
|
|
200
200
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
201
201
|
height: 44px;
|
|
202
|
-
`,Ko=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>Ia(
|
|
202
|
+
`,Ko=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>Ia(e1,{isSubmitting:o,onClick:t,disabled:r,...n,children:[_t("span",{children:e}),_t("span",{children:_t(vo,{})})]}),e1=wo.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 tu from"styled-components";import{Fragment as t1,jsx as Gr,jsxs as ru}from"react/jsx-runtime";var Sl=tu.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 Yo(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return
|
|
253
|
+
`;function Yo(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return Gr(Sl,{});if(!r&&!t)return Gr(Sl,{});let n=!!(t&&r);return ru(Sl,{children:["By logging in I agree to the"," ",r&&Gr("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&Gr("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var V=({protectedByPrivy:e})=>Gr(oe,{children:e?ru(t1,{children:[Gr(ia,{className:"hide-on-mobile"}),Gr("span",{className:"hide-on-mobile",children:Gr("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),oe=tu.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 r1 from"@heroicons/react/24/outline/ArrowLeftIcon";import o1 from"@heroicons/react/24/outline/XMarkIcon";import _l from"styled-components";import{jsx as At,jsxs as l1}from"react/jsx-runtime";var ou=()=>At("div",{}),n1=({backFn:e})=>At("div",{children:At(nu,{onClick:e,children:At(r1,{height:"16px",width:"16px",strokeWidth:2})})}),i1=e=>At("div",{children:At(nu,{"aria-label":"close modal",onClick:e.onClose,children:At(o1,{height:"16px",width:"16px",strokeWidth:2})})});var A=({backFn:e,onClose:t,title:r,closeable:o=!0})=>{let{closePrivyModal:n}=W(),{app:i}=S();return l1(a1,{children:[e?At(n1,{backFn:e}):At(ou,{}),r&&At(s1,{id:"privy-dialog-title",children:r}),i?.render.inDialog&&o?At(i1,{onClose:t||(()=>n())}):At(ou,{})]})},nu=_l.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
|
+
`,a1=_l.div`
|
|
300
300
|
padding: 16px 0;
|
|
301
301
|
display: flex;
|
|
302
302
|
align-items: center;
|
|
@@ -318,14 +318,14 @@ Resources:
|
|
|
318
318
|
display: flex;
|
|
319
319
|
justify-content: flex-end;
|
|
320
320
|
}
|
|
321
|
-
`,
|
|
321
|
+
`,s1=_l.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 Jo,{css as
|
|
328
|
+
`;import Jo,{css as c1}from"styled-components";var Ma=Jo.div`
|
|
329
329
|
text-align: left;
|
|
330
330
|
flex-grow: 1;
|
|
331
331
|
`,Wa=Jo.div`
|
|
@@ -333,7 +333,7 @@ Resources:
|
|
|
333
333
|
flex-direction: column;
|
|
334
334
|
justify-content: flex-end;
|
|
335
335
|
flex-grow: 1;
|
|
336
|
-
`,
|
|
336
|
+
`,kt=Jo.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
|
+
`,iu=c1`
|
|
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
|
-
`,
|
|
389
|
+
`,Pe=Jo.button`
|
|
390
|
+
${iu}
|
|
391
|
+
`,Al=Jo.a`
|
|
392
|
+
${iu}
|
|
393
|
+
`,Sr=Jo.div`
|
|
394
394
|
width: 100%;
|
|
395
395
|
${e=>e.if?"display: none;":""}
|
|
396
396
|
`;import We from"styled-components";var ze=We.div`
|
|
@@ -401,17 +401,17 @@ Resources:
|
|
|
401
401
|
@media (max-width: 440px) {
|
|
402
402
|
padding: 10px 10px 20px;
|
|
403
403
|
}
|
|
404
|
-
`,
|
|
404
|
+
`,we=We.div`
|
|
405
405
|
font-size: 18px;
|
|
406
406
|
line-height: 18px;
|
|
407
407
|
text-align: center;
|
|
408
408
|
font-weight: 600;
|
|
409
409
|
margin-bottom: 10px;
|
|
410
|
-
`,
|
|
410
|
+
`,fe=We.div`
|
|
411
411
|
font-size: 0.875rem;
|
|
412
412
|
|
|
413
413
|
text-align: center;
|
|
414
|
-
`,
|
|
414
|
+
`,Vr=We.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
|
+
`,au=We.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
|
+
`,kl=We.div`
|
|
433
433
|
width: 25px;
|
|
434
434
|
display: flex;
|
|
435
435
|
align-items: center;
|
|
@@ -441,14 +441,14 @@ Resources:
|
|
|
441
441
|
width: 25px !important;
|
|
442
442
|
color: var(--privy-color-accent);
|
|
443
443
|
}
|
|
444
|
-
`,
|
|
444
|
+
`,Rl=We.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
|
+
`,zr=We.div`
|
|
452
452
|
display: flex;
|
|
453
453
|
flex-direction: column;
|
|
454
454
|
gap: 10px;
|
|
@@ -469,7 +469,7 @@ Resources:
|
|
|
469
469
|
& > button:not(#remove) {
|
|
470
470
|
width: 100%;
|
|
471
471
|
}
|
|
472
|
-
`,
|
|
472
|
+
`,Il=We.button`
|
|
473
473
|
&& {
|
|
474
474
|
background-color: transparent;
|
|
475
475
|
color: var(--privy-color-foreground-3);
|
|
@@ -516,11 +516,11 @@ Resources:
|
|
|
516
516
|
width: 100%;
|
|
517
517
|
display: flex;
|
|
518
518
|
justify-content: space-between;
|
|
519
|
-
`,
|
|
519
|
+
`,su=We.p`
|
|
520
520
|
text-align: left;
|
|
521
521
|
width: 100%;
|
|
522
522
|
color: var(--privy-color-foreground-3) !important;
|
|
523
|
-
`,
|
|
523
|
+
`,Ml=We.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 f1,jsx as ar,jsxs as Jn}from"react/jsx-runtime";var cu=()=>{let{user:e,logout:t}=H(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=S(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=W(),c=m=>{m?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async m=>{m.preventDefault(),await a(),e&&Pt(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>{console.error(h),s("embedded_wallet_creation_failure_logout",{error:h,screen:"AffirmativeConsentScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return ar(u1,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},u1=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>Jn(f1,{children:[ar(A,{closeable:!1}),ar(d1,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),ar(we,{style:{marginTop:24},children:"One last step"}),ar(fe,{children:"By signing up, you agree to our terms and privacy policy."}),Jn(kt,{style:{marginTop:24},children:[e&&Jn(Al,{target:"_blank",href:e,children:["View Terms ",ar(lu,{style:{marginLeft:"auto"}})]}),t&&Jn(Al,{target:"_blank",href:t,children:["View Privacy Policy ",ar(lu,{style:{marginLeft:"auto"}})]})]}),Jn(m1,{style:{marginTop:24},children:[ar(Gt,{onClick:o,children:"No thanks"}),ar(D,{onClick:r,children:"Accept"})]}),ar(V,{protectedByPrivy:!0})]}),m1=p1.div`
|
|
569
569
|
display: flex;
|
|
570
570
|
gap: 10px;
|
|
571
|
-
`;import
|
|
571
|
+
`;import Ll from"styled-components";import h1 from"styled-components";var Ua=h1.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 du}from"react/jsx-runtime";var Fa=({style:e,...t})=>du("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:du("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});import{Fragment as Wl,jsx as sr,jsxs as Ba}from"react/jsx-runtime";var pu=()=>{let{navigate:e,app:t}=S(),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 Ba(Wl,{children:[sr(A,{}),Ba(y1,{children:[sr(v1,{children:Ba("div",{children:[sr(Ua,{}),sr(Fa,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),Ba(g1,{children:[typeof r=="string"?sr("h3",{children:r}):sr(Wl,{children:r}),typeof o=="string"?sr("p",{children:o}):sr(Wl,{children:o})]}),t?.allowlistConfig.errorCtaLink?sr(D,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):sr(D,{onClick:()=>{e("LANDING")},children:n})]})]})},y1=Ll.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
|
+
`,g1=Ll.div`
|
|
595
595
|
display: flex;
|
|
596
596
|
flex-direction: column;
|
|
597
597
|
gap: 8px;
|
|
598
|
-
`,
|
|
598
|
+
`,v1=Ll.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 E1 from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as vu,useState as Ga}from"react";import{isMobile as P1}from"react-device-detect";import Xn from"styled-components";import yt from"styled-components";var Rt=yt.div`
|
|
622
622
|
display: flex;
|
|
623
623
|
flex-direction: column;
|
|
624
624
|
align-items: flex-start;
|
|
@@ -626,36 +626,36 @@ Resources:
|
|
|
626
626
|
margin-top: auto;
|
|
627
627
|
gap: 16px;
|
|
628
628
|
flex-grow: 100;
|
|
629
|
-
`,
|
|
629
|
+
`,It=yt.div`
|
|
630
630
|
display: flex;
|
|
631
631
|
flex-direction: column;
|
|
632
632
|
align-items: center;
|
|
633
633
|
justify-content: center;
|
|
634
634
|
flex-grow: 1;
|
|
635
635
|
width: 100%;
|
|
636
|
-
`,
|
|
636
|
+
`,uu=yt.div`
|
|
637
637
|
display: flex;
|
|
638
638
|
flex-direction: column;
|
|
639
639
|
align-items: center;
|
|
640
640
|
width: 100%;
|
|
641
|
-
`,Ha=yt(
|
|
641
|
+
`,Ha=yt(It)`
|
|
642
642
|
padding: 20px 0;
|
|
643
|
-
`,Vt=yt(
|
|
643
|
+
`,Vt=yt(It)`
|
|
644
644
|
gap: 16px;
|
|
645
|
-
`,
|
|
645
|
+
`,Ol=yt.div`
|
|
646
646
|
display: flex;
|
|
647
647
|
flex-direction: column;
|
|
648
648
|
width: 100%;
|
|
649
|
-
`,
|
|
649
|
+
`,gt=yt.div`
|
|
650
650
|
display: flex;
|
|
651
651
|
flex-direction: column;
|
|
652
652
|
gap: 8px;
|
|
653
|
-
`,
|
|
653
|
+
`,k8=yt.div`
|
|
654
654
|
display: flex;
|
|
655
655
|
flex-direction: column;
|
|
656
656
|
justify-content: space-between;
|
|
657
657
|
height: 100%;
|
|
658
|
-
`,
|
|
658
|
+
`,mu=yt.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
|
`,te=yt.div`
|
|
684
684
|
height: 12px;
|
|
685
|
-
`,
|
|
685
|
+
`,fu=yt.div`
|
|
686
686
|
position: relative;
|
|
687
|
-
`,
|
|
687
|
+
`,hu=yt.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 Nl from"styled-components";import{Fragment as C1,jsx as Zn,jsxs as gu}from"react/jsx-runtime";var Qn=({title:e,description:t,children:r,...o})=>Zn(yu,{...o,children:gu(C1,{children:[Zn("h3",{children:e}),typeof t=="string"?Zn("p",{children:t}):t,r]})}),lr=Nl(Qn)`
|
|
696
696
|
margin-bottom: 24px;
|
|
697
|
-
`,
|
|
697
|
+
`,Te=({title:e,description:t,icon:r,children:o,...n})=>gu(w1,{...n,children:[r||null,Zn("h3",{children:e}),typeof t=="string"?Zn("p",{children:t}):t,o]}),yu=Nl.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
|
+
`,w1=Nl(yu)`
|
|
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 Dl,jsx as $e,jsxs as $r}from"react/jsx-runtime";var Ul=6,wu=new Array(Ul).fill(""),T1=1400;var bu=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=S(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:m}=W(),{authenticated:h,logout:g,user:E}=H(),[v,x]=Ga(wu),[C,T]=Ga(!1),[R,I]=Ga(null),[_,F]=Ga(null);n.current=()=>null;let U=s()?.email?0:1,B=e?.render.inDialog?Qe:0,k=e?.render.inDialog?B-500:0;vu(()=>{if(h&&C&&E){if(e?.legal.requireUsersAcceptTerms&&!E.hasAcceptedTerms){let Q=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},k);return()=>clearTimeout(Q)}if(Pt(E,e?.embeddedWallets?.createOnLogin)){let Q=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:$=>{console.error($),m("embedded_wallet_creation_failure_logout",{error:$,screen:"AwaitingPasswordlessCodeScreen"}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(Q)}else{u();let Q=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),B);return()=>clearTimeout(Q)}}},[h,C,E]),vu(()=>{if(R&&_===0){let ee=setTimeout(()=>{x(wu),I(null),document.querySelector("input[name=code-0]")?.focus()},T1);return()=>clearTimeout(ee)}},[R]);let z=ee=>{ee.preventDefault();let Q=ee.currentTarget.value.replace(" ","");if(Q==="")return;if(isNaN(Number(Q))){I("Code should be numeric"),F(1);return}I(null),F(null);let $=Number(ee.currentTarget.name?.charAt(5)),be=[...Q||[""]].slice(0,Ul-$),he=[...v.slice(0,$),...be,...v.slice($+be.length)];x(he);let wr=be.length,dt=Math.min(Math.max($+wr,0),Ul-1);isNaN(Number(ee.currentTarget.value))||document.querySelector(`input[name=code-${dt}]`)?.focus(),he.every(xe=>xe&&!isNaN(+xe))&&(document.querySelector(`input[name=code-${dt}]`)?.blur(),c(he.join("")).then(()=>T(!0)).catch(pe=>{pe?.status===422?I("Invalid or expired verification code"):pe instanceof Xt&&pe.privyErrorCode==="cannot_link_more_of_type"?I(pe.message):I("Issue verifying code"),F(0)}))},L=ee=>{_===1&&(I(null),F(null));let Q=[...v.slice(0,ee),"",...v.slice(ee+1)];x(Q),ee>0&&document.querySelector(`input[name=code-${ee-1}]`)?.focus()},j=U==0?$e(b1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):$e(E1,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),ie=U==0?$r("p",{children:["Please check ",$e(Cu,{children:s()?.email})," for an email from privy.io and enter your code below."]}):$r("p",{children:["Please check ",$e(Cu,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return $r(Dl,{children:[$e(A,{backFn:()=>r()},"header"),$r(x1,{children:[$e(Te,{title:"Enter confirmation code",description:ie,icon:j}),$r(uu,{children:[$r(S1,{children:[$e(_1,{fail:!!R,success:C,children:$e("span",{children:R||(C?"Success!":"")})}),$e("div",{children:v.map((ee,Q)=>$e("input",{name:`code-${Q}`,type:"text",value:v[Q],onChange:z,onKeyUp:$=>{$.key==="Backspace"&&L(Q)},inputMode:"numeric",autoFocus:Q===0,pattern:"[0-9]",className:`${C?"success":""} ${R?"fail":""}`,autoComplete:P1?"one-time-code":"off"},Q))})]}),$e(A1,{children:U==0?$r(Dl,{children:[$e("span",{children:"Didn't get an email?"}),$e("button",{onClick:a,children:"Resend code"})]}):$r(Dl,{children:[$e("span",{children:"Didn't get a message?"}),$e("button",{onClick:l,children:"Resend code"})]})})]})]}),$e(V,{protectedByPrivy:!0})]})},x1=Xn.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
|
+
`,S1=Xn.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=Xn.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
|
+
`,A1=Xn.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
|
+
`,Cu=Xn.span`
|
|
812
812
|
font-weight: 500;
|
|
813
813
|
word-break: break-all;
|
|
814
|
-
`;import
|
|
814
|
+
`;import W1 from"@heroicons/react/24/solid/CheckCircleIcon";import L1 from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Fl,useRef as O1,useState as Xo}from"react";import N1 from"styled-components";import k1 from"styled-components";import{Fragment as M1,jsx as Qo,jsxs as I1}from"react/jsx-runtime";var Eu=({icon:e})=>{let t=e;return Qo(M1,{children:Qo(R1,{children:I1("div",{children:[Qo(xr,{}),typeof t=="string"?Qo("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?Qo(t,{style:{width:"38px",height:"38px"}}):Qo("span",{})]})})})},R1=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 U1,jsx as zt,jsxs as Bl}from"react/jsx-runtime";var Tu=500,Pu=Tu*2,xu=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=S(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=de(),m=O1([]),h=j=>{m.current=[j,...m.current]},[g,E]=Xo(!0);Fl(()=>{let j=setTimeout(E,Pu,!1);return h(j),()=>{m.current.forEach(ie=>clearTimeout(ie)),m.current=[]}},[]);let[v,x]=Xo(""),[C,T]=Xo("Checking that you are a human..."),[R,I]=Xo(zt(D,{onClick:()=>{},disabled:!0,children:"Continue"})),[_,F]=Xo(!1),[U,B]=Xo(3),k=r?.captchaModalData,z=async j=>{try{await k?.callback(j),k?.onSuccessNavigateTo&&n(k?.onSuccessNavigateTo,!1)}catch(ie){if(ie instanceof Ht)return;{let ee={error:ie,previousScreen:e||"LANDING"};i({errorModalData:ee}),n(k?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};Fl(()=>{if(a==="success"){let j=setTimeout(async()=>{let ie=await s();!ie||k?.userIntentRequired||z(ie)},Pu);h(j)}else if(a==="ready"){let j=setTimeout(()=>{a==="ready"&&u()},Tu);h(j)}},[a]),Fl(()=>{if(!g)switch(a){case"success":x("Success!"),T("CAPTCHA passed successfully."),I(zt(D,{onClick:()=>{F(!0),z(l)},disabled:!k?.userIntentRequired,loading:_,children:k?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),T("Checking that you are a human..."),I(zt(D,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),U<=0?(T("If you use an adblocker or VPN, try disabling and re-attempting."),I(null)):(T("You did not pass CAPTCHA. Please try again."),I(zt(D,{onClick:L,children:"Retry"})));break;case"ready":default:break}},[a,g,_]);let L=async()=>{if(U<=0)return;B(ie=>ie-1),c(),u();let j=await s();!j||k?.userIntentRequired||z(j)};return Bl(U1,{children:[zt(A,{backFn:!e||t===e?void 0:o}),Bl(D1,{children:[a==="success"?zt(W1,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?zt(L1,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):zt(Eu,{}),Bl(gt,{children:[v?zt("h3",{children:v}):null,zt("p",{children:C})]}),R]}),zt(oe,{})]})},D1=N1.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 D1 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as U1}from"react-device-detect";import F1 from"styled-components";import{jsx as $t,jsxs as Tu}from"react/jsx-runtime";var xu=({...e})=>Tu("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[$t("defs",{children:Tu("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:[$t("stop",{offset:"0",stopColor:"#f1562b"}),$t("stop",{offset:"0.3",stopColor:"#f1542b"}),$t("stop",{offset:"0.41",stopColor:"#f04d2a"}),$t("stop",{offset:"0.49",stopColor:"#ef4229"}),$t("stop",{offset:"0.5",stopColor:"#ef4029"}),$t("stop",{offset:"0.56",stopColor:"#e83e28"}),$t("stop",{offset:"0.67",stopColor:"#e13c26"}),$t("stop",{offset:"1",stopColor:"#df3c26"})]})}),$t("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"}),$t("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 qt,jsxs as Xn}from"react/jsx-runtime";var Su=({style:e,...t})=>Xn("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:[qt("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"}),qt("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:qt("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"})}),Xn("g",{mask:"url(#mask0_16909_31415)",children:[qt("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"}),qt("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"}),qt("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"}}),qt("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"}})]}),Xn("defs",{children:[Xn("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[qt("stop",{"stop-color":"#002D72"}),qt("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),Xn("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[qt("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),qt("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as Z,jsxs as gt}from"react/jsx-runtime";var _u=({style:e,...t})=>gt("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:[Z("g",{clipPath:"url(#clip0_5_32)",children:gt("g",{clipPath:"url(#clip1_5_32)",children:[Z("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:Z("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"})}),Z("g",{mask:"url(#mask0_5_32)",children:Z("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),Z("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)"}),Z("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),Z("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),Z("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),Z("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),Z("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),Z("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)"}),Z("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),Z("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),gt("defs",{children:[gt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[Z("stop",{stopColor:"#174299"}),Z("stop",{offset:"1",stopColor:"#001E59"})]}),gt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[Z("stop",{offset:"0.770277",stopColor:"#FF4000"}),Z("stop",{offset:"1",stopColor:"#8754C9"})]}),gt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[Z("stop",{stopColor:"#FF4000"}),Z("stop",{offset:"1",stopColor:"#8754C9"})]}),gt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[Z("stop",{stopColor:"#8754C9"}),Z("stop",{offset:"1",stopColor:"#FF4000"})]}),gt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[Z("stop",{offset:"0.723929",stopColor:"#FFF700"}),Z("stop",{offset:"1",stopColor:"#FF9901"})]}),gt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[Z("stop",{stopColor:"#FFF700"}),Z("stop",{offset:"1",stopColor:"#FF9901"})]}),gt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[Z("stop",{stopColor:"#FFF700"}),Z("stop",{offset:"1",stopColor:"#FF9901"})]}),gt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[Z("stop",{offset:"0.59513",stopColor:"#00AAFF"}),Z("stop",{offset:"1",stopColor:"#01DA40"})]}),gt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[Z("stop",{stopColor:"#00AAFF"}),Z("stop",{offset:"1",stopColor:"#01DA40"})]}),gt("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:[Z("stop",{stopColor:"#00AAFF"}),Z("stop",{offset:"1",stopColor:"#01DA40"})]}),Z("clipPath",{id:"clip0_5_32",children:Z("rect",{width:"120",height:"120",fill:"white"})}),Z("clipPath",{id:"clip1_5_32",children:Z("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as cr,jsxs as Au}from"react/jsx-runtime";var ku=({style:e,...t})=>Au("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:[cr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Au("g",{filter:"url(#filter0_d_12393_20043)",children:[cr("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"}),cr("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"}),cr("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"}),cr("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"}),cr("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"}),cr("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"}),cr("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"}),cr("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"}),cr("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 ei,jsxs as Ru}from"react/jsx-runtime";var Iu=({style:e,...t})=>Ru("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:[Ru("g",{clipPath:"url(#clip0_1704_1423)",children:[ei("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"}),ei("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"})]}),ei("defs",{children:ei("clipPath",{id:"clip0_1704_1423",children:ei("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as en,jsxs as z1}from"react/jsx-runtime";var dr={coinbase_wallet:{logo:ea,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Vo,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:or,displayName:"Phantom"},rainbow:{logo:_u,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:qn,displayName:"WalletConnect"},zerion:{logo:Iu,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:xu,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Su,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:ku,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="}},wo=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=S(),{connectWallet:a}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{Or()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(U1?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},z1(V1,{onClick:s,children:[en(G1,{icon:H1(e,n.connectorType)??r,name:n.walletClientType}),en("span",{children:B1(e,n.connectorType)||t||n.walletClientType}),en("span",{id:"connect-text",children:"Connect"})]})},B1=(e,t)=>{if(dr[e]?.displayName)return dr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},H1=(e,t)=>{if(dr[e]?.logo)return dr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return qn},G1=({icon:e,name:t})=>typeof e=="string"?en("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?en(D1,{}):e?en(e,{}):null,V1=F1(be)`
|
|
844
|
+
`;import F1 from"@heroicons/react/24/outline/WalletIcon";import{isMobile as B1}from"react-device-detect";import H1 from"styled-components";import{jsx as $t,jsxs as Su}from"react/jsx-runtime";var _u=({...e})=>Su("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[$t("defs",{children:Su("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:[$t("stop",{offset:"0",stopColor:"#f1562b"}),$t("stop",{offset:"0.3",stopColor:"#f1542b"}),$t("stop",{offset:"0.41",stopColor:"#f04d2a"}),$t("stop",{offset:"0.49",stopColor:"#ef4229"}),$t("stop",{offset:"0.5",stopColor:"#ef4029"}),$t("stop",{offset:"0.56",stopColor:"#e83e28"}),$t("stop",{offset:"0.67",stopColor:"#e13c26"}),$t("stop",{offset:"1",stopColor:"#df3c26"})]})}),$t("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"}),$t("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 qt,jsxs as ei}from"react/jsx-runtime";var Au=({style:e,...t})=>ei("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:[qt("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"}),qt("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:qt("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"})}),ei("g",{mask:"url(#mask0_16909_31415)",children:[qt("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"}),qt("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"}),qt("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"}}),qt("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"}})]}),ei("defs",{children:[ei("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[qt("stop",{"stop-color":"#002D72"}),qt("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),ei("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[qt("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),qt("stop",{offset:"1","stop-color":"#002D72"})]})]})]});import{jsx as Z,jsxs as vt}from"react/jsx-runtime";var ku=({style:e,...t})=>vt("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:[Z("g",{clipPath:"url(#clip0_5_32)",children:vt("g",{clipPath:"url(#clip1_5_32)",children:[Z("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:Z("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"})}),Z("g",{mask:"url(#mask0_5_32)",children:Z("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),Z("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)"}),Z("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),Z("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),Z("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),Z("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),Z("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),Z("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)"}),Z("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),Z("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),vt("defs",{children:[vt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[Z("stop",{stopColor:"#174299"}),Z("stop",{offset:"1",stopColor:"#001E59"})]}),vt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[Z("stop",{offset:"0.770277",stopColor:"#FF4000"}),Z("stop",{offset:"1",stopColor:"#8754C9"})]}),vt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[Z("stop",{stopColor:"#FF4000"}),Z("stop",{offset:"1",stopColor:"#8754C9"})]}),vt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[Z("stop",{stopColor:"#8754C9"}),Z("stop",{offset:"1",stopColor:"#FF4000"})]}),vt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[Z("stop",{offset:"0.723929",stopColor:"#FFF700"}),Z("stop",{offset:"1",stopColor:"#FF9901"})]}),vt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[Z("stop",{stopColor:"#FFF700"}),Z("stop",{offset:"1",stopColor:"#FF9901"})]}),vt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[Z("stop",{stopColor:"#FFF700"}),Z("stop",{offset:"1",stopColor:"#FF9901"})]}),vt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[Z("stop",{offset:"0.59513",stopColor:"#00AAFF"}),Z("stop",{offset:"1",stopColor:"#01DA40"})]}),vt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[Z("stop",{stopColor:"#00AAFF"}),Z("stop",{offset:"1",stopColor:"#01DA40"})]}),vt("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:[Z("stop",{stopColor:"#00AAFF"}),Z("stop",{offset:"1",stopColor:"#01DA40"})]}),Z("clipPath",{id:"clip0_5_32",children:Z("rect",{width:"120",height:"120",fill:"white"})}),Z("clipPath",{id:"clip1_5_32",children:Z("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as cr,jsxs as Ru}from"react/jsx-runtime";var Iu=({style:e,...t})=>Ru("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:[cr("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),Ru("g",{filter:"url(#filter0_d_12393_20043)",children:[cr("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"}),cr("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"}),cr("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"}),cr("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"}),cr("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"}),cr("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"}),cr("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"}),cr("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"}),cr("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 ti,jsxs as Mu}from"react/jsx-runtime";var Wu=({style:e,...t})=>Mu("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:[Mu("g",{clipPath:"url(#clip0_1704_1423)",children:[ti("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"}),ti("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"})]}),ti("defs",{children:ti("clipPath",{id:"clip0_1704_1423",children:ti("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as en,jsxs as q1}from"react/jsx-runtime";var dr={coinbase_wallet:{logo:ea,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Vo,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:or,displayName:"Phantom"},rainbow:{logo:ku,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:jn,displayName:"WalletConnect"},zerion:{logo:Wu,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:_u,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:Au,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Iu,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="}},Co=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=S(),{connectWallet:a}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{Dr()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(B1?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},q1($1,{onClick:s,children:[en(z1,{icon:V1(e,n.connectorType)??r,name:n.walletClientType}),en("span",{children:G1(e,n.connectorType)||t||n.walletClientType}),en("span",{id:"connect-text",children:"Connect"})]})},G1=(e,t)=>{if(dr[e]?.displayName)return dr[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},V1=(e,t)=>{if(dr[e]?.logo)return dr[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return jn},z1=({icon:e,name:t})=>typeof e=="string"?en("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?en(F1,{}):e?en(e,{}):null,$1=H1(Pe)`
|
|
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 Z1,jsx as tn,jsxs as Q1}from"react/jsx-runtime";var j1=["coinbase_wallet"],K1=["metamask","okx_wallet","rainbow","uniswap","zerion"],Y1=["cryptocom"],J1=["phantom"],rn=({connectOnly:e})=>{let{connectors:t}=W(),{app:r}=S(),o=ri(r.appearance.walletList,t,e,r.appearance.walletList);return Q1(Z1,{children:[...o]})},ri=(e,t,r,o)=>{let n=[],i=[],a=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let c=t.filter(({connectorType:u,walletClientType:m})=>m==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(m));for(let u of c){let{walletClientType:m,walletBranding:h}=u;(m==="unknown"?i:n).push(tn(Co,{connectOnly:r,provider:m,logo:h.icon,displayName:h.name,connector:u},`${s}-${m}`))}}else if(J1.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push(tn(Co,{connectOnly:r,provider:s,connector:c},s))}else if(K1.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push(tn(Co,{connectOnly:r,provider:s,connector:c},s))}else if(j1.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push(tn(Co,{connectOnly:r,provider:s,connector:c},s))}else Y1.includes(s)?l&&a.push(tn(Co,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&a.push(tn(Co,{connectOnly:r,provider:s,connector:l},s));return[...i,...n,...a]};import{Fragment as X1,jsx as oi,jsxs as ev}from"react/jsx-runtime";var Lu=()=>{let{app:e}=S(),t=`Connect a wallet to ${e?.name}`;return ev(X1,{children:[oi(A,{},"header"),oi(lr,{title:"Connect your wallet",description:t}),oi(kt,{children:oi(rn,{connectOnly:!0})}),oi(V,{protectedByPrivy:!0})]})};import iv from"styled-components";import ov from"styled-components";import tv from"react";import{jsx as rv}from"react/jsx-runtime";var Ou=()=>{let{app:e}=S(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?rv("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?tv.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 Nu}from"react/jsx-runtime";var on=e=>{let{app:t}=S();return t?.appearance.logo?Nu(nv,{...e,children:Nu(Ou,{})}):null},nv=ov.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 nn,jsxs as lv}from"react/jsx-runtime";var Du=()=>{let{app:e}=S();return lv(sv,{children:[nn(A,{},"header"),nn(av,{}),nn(kt,{children:nn(rn,{connectOnly:!0})}),e&&nn(Yo,{app:e,alwaysShowImplicitConsent:!0}),nn(V,{protectedByPrivy:!0})]})},av=iv(on)`
|
|
874
874
|
margin-bottom: 16px;
|
|
875
|
-
`;import{useEffect as
|
|
875
|
+
`;import{useEffect as Gu,useState as Vu}from"react";import{isMobile as yv}from"react-device-detect";import gv from"styled-components";import{useEffect as Hl,useState as bo}from"react";import{isMobile as ni}from"react-device-detect";import{useInterval as uv}from"react-use";import Fu from"styled-components";import{useState as cv,useEffect as dv,useCallback as pv}from"react";function Uu(){let[e,t]=cv(!1),r=pv(()=>{document.hidden&&t(!0)},[]);return dv(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as Hu,jsx as Le,jsxs as ii}from"react/jsx-runtime";var Gl=2,Vl=e=>e?.privyErrorCode==="linked_to_another_user"?Tr.ERROR_USER_EXISTS:e instanceof Ee&&!e.details.default?e.details:e instanceof Uo?Tr.ERROR_TIMED_OUT:e instanceof Fo?Tr.ERROR_USER_REJECTED_CONNECTION:Tr.ERROR_WALLET_CONNECTION,Bu=()=>{let[e,t]=bo(!1),[r,o]=bo(!1),[n,i]=bo(void 0),{authenticated:a,logout:l}=H(),{app:s,navigate:c,navigateBack:u,lastScreen:m,currentScreen:h,setModalData:g}=S(),{getAuthFlow:E,walletConnectionStatus:v,closePrivyModal:x,initLoginWithWallet:C,loginWithWallet:T,updateWallets:R,createAnalyticsEvent:I}=W(),{walletConnectors:_}=H(),[F,U]=bo(0),{user:B}=H(),[k]=bo(B?.linkedAccounts.length||0),[z,L]=bo(""),[j,ie]=bo(!1),{hasTabbedAway:ee}=Uu(),{enabled:Q,token:$}=de(),be=ni&&v?.connector?.connectorType==="wallet_connect_v2"||ni&&v?.connector?.connectorType==="coinbase_wallet"||ni&&v?.connector?.connectorType==="injected"&&v?.connector?.walletClientType==="phantom",he=v?.status==="connected",wr=v?.status==="switching_to_supported_chain";Hl(()=>{let q=E();if(he&&!q&&(Q&&!$&&!a?(g({captchaModalData:{callback:Re=>C(v.connectedWallet,Re).then(()=>{ie(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):C(v.connectedWallet,$).then(()=>{ie(!0)})),q&&be&&he&&!q.preparedMessage){q.buildSiweMessage();return}!q||be||!he||r||(async()=>{o(!0),i(void 0);try{v?.connector?.connectorType==="wallet_connect_v2"&&v?.connector?.walletClientType==="metamask"&&await cl(2500),await xe()}catch(Re){console.warn("Auto-prompted signature failed",Re)}finally{o(!1)}})()},[F,he,j]),Hl(()=>{if(B&&e){let q=s?.render.inDialog?Qe:0,Re=s?.render.inDialog?q-500:0;if(s?.legal.requireUsersAcceptTerms&&!B.hasAcceptedTerms){let ao=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},Re);return()=>clearTimeout(ao)}if(Pt(B,s?.embeddedWallets?.createOnLogin)){let ao=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:Nt=>{console.error(Nt),I("embedded_wallet_creation_failure_logout",{error:Nt,screen:"ConnectionStatusScreen"}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},Re);return()=>clearTimeout(ao)}R();let at=setTimeout(()=>x({shouldCallAuthOnSuccess:!0,isSuccess:!0}),Qe);return()=>clearTimeout(at)}},[B,e]);let dt=q=>{if(q?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}i(Vl(q))};async function xe(){try{if(await T(),!s?.render.inDialog)return x({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(q){dt(q)}finally{o(!1)}}Hl(()=>{v?.connectError&&dt(v?.connectError)},[v]),uv(()=>{let q=pe==="wallet_connect_v2"&&v?.connector instanceof nr?v.connector.redirectUri:void 0;q&&L(q)},v?.connector instanceof nr&&!z?500:null);let pe=v?.connector?.connectorType||"injected",pt=v?.connector?.walletClientType||"unknown",Ot=dr[pt]?.displayName||v?.connector?.walletBranding.name||"Browser Extension",Lr=dr[pt]?.logo||v?.connector?.walletBranding.icon||(q=>Le(Go,{...q})),Zt=Ot==="Browser Extension"?Ot.toLowerCase():Ot,M;e?M=`Successfully connected with ${Zt}`:n?M=n.message:wr?M="Switching networks":he?M=r&&be?"Signing":"Sign to verify":M=`Waiting for ${Zt}`;let K="Don\u2019t see your wallet? Check your other browser windows.";if(e){let q=B?.linkedAccounts.length||0;k===q?K="Wallet was already linked.":K="You\u2019re good to go!"}else F>=Gl&&n?K="Unable to connect wallet":n?K=n.detail:wr?K="Switch your wallet to the requested network.":he&&be?K="Sign the message in your wallet to verify it belongs to you.":pt==="metamask"&&ni?K="Click continue to open and connect MetaMask.":pt==="metamask"?K="For the best experience, connect only one wallet at a time.":pe==="wallet_connect"?K="Open your mobile wallet app to continue":pe==="coinbase_wallet"&&(Id()||(hl(B)?K="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":K="Open the Coinbase app on your phone to continue."));let J=_?.walletConnectors?.find(q=>q.walletClientType==="coinbase_wallet"),Nn=pt==="coinbase_wallet"&&(hl(B)||n===Tr.ERROR_USER_EXISTS);return ii(Hu,{children:[Le(A,{backFn:!m||h===m?void 0:u}),ii(fv,{children:[Le(zl,{walletLogo:Lr,success:e,fail:!!n}),ii(gt,{children:[Le("h3",{children:M}),Le("p",{children:K}),!he&&z&&!ee?ii("p",{children:["Still here?"," ",Le("a",{href:z,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Nn?Le(D,{onClick:()=>J&&J?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Tr.ERROR_USER_EXISTS&&h!==m?Le(D,{onClick:u,children:"Use a different wallet"}):he&&!e&&be?Le(D,{onClick:()=>{o(!0),xe(),mv(pt)},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&F<Gl?Le(D,{onClick:()=>{U(F+1),i(void 0),he?(o(!0),xe()):v?.connectRetry()},disabled:!e&&(!n?.retryable||F>=Gl),children:"Retry"}):!e&&!n?Le(D,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),Le(oe,{})]})},mv=e=>{if(!ni||!Yd(e))return;let t=Jd(e);t&&window.open(t,"_self","noopener,noreferrer")},fv=Fu.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
|
+
`,hv=Fu.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
|
+
`,zl=e=>{let t=e.walletLogo;return Le(Hu,{children:Le(hv,{children:ii("div",{children:[Le(xr,{success:e.success,fail:e.fail}),typeof t=="string"?Le("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):Le(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as wv,jsx as _r,jsxs as $l}from"react/jsx-runtime";var Va=2,zu=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=S(),{walletConnectionStatus:o,closePrivyModal:n}=W(),[i,a]=Vu(void 0),[l,s]=Vu(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";Gu(()=>{if(c){let R=setTimeout(n,Qe);return()=>clearTimeout(R)}},[c]);let m=R=>{a(Vl(R))};Gu(()=>{o?.connectError&&m(o?.connectError)},[o]);let h=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",E=dr[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",v=dr[g]?.logo||o?.connector?.walletBranding.icon||(R=>_r(Go,{...R})),x=E==="Browser Extension"?E.toLowerCase():E,C;c?C=`Successfully connected with ${x}`:i?C=i.message:u?C="Switching networks":C=`Waiting for ${x}`;let T="Don\u2019t see your wallet? Check your other browser windows.";return c?T="You\u2019re good to go!":l>=Va&&i?T="Unable to connect wallet":i?T=i.detail:u?T="Switch your wallet to the requested network.":g==="metamask"&&yv?T="Click to continue to open and connect MetaMask.":g==="metamask"?T="For the best experience, connect only one wallet at a time.":h==="wallet_connect_v2"?T="Open your mobile wallet app to continue":h==="coinbase_wallet"&&(T="Open the Coinbase app on your phone to continue."),$l(wv,{children:[_r(A,{backFn:r===t?void 0:e}),$l(vv,{children:[_r(zl,{walletLogo:v,success:c,fail:!!i}),$l(gt,{children:[_r("h3",{children:C}),_r("p",{children:T})]}),i==Tr.ERROR_USER_EXISTS?_r(D,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<Va?_r(D,{onClick:()=>{s(l+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||l>=Va),children:"Retry"}):!c&&i&&l>=Va?_r(D,{onClick:e,children:"Use a different wallet"}):null]}),_r(oe,{})]})},vv=gv.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 Sv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as _v,useMemo as Av,useState as kv}from"react";import Rv from"styled-components";import za from"styled-components";import{jsx as ql,jsxs as Tv}from"react/jsx-runtime";var an=()=>ql(Cv,{children:Tv(bv,{children:[ql(Ev,{}),ql(Pv,{})]})}),Cv=za.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=za.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
|
+
`,Ev=za.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
|
+
`,Pv=za.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 $u=["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 Se=class extends Error{constructor(r,o){super(o);this.type=r}};function sn(e){let t=e.type;return typeof t=="string"&&$u.includes(t)}function xv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Eo(e){return sn(e)&&e.type==="wallet_not_on_device"}function qu(e){return sn(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function ln(e){return!!(sn(e)&&e.type==="mfa_timeout")}function cn(e){return!!(sn(e)&&e.type==="missing_or_invalid_mfa")}function jl(e){return!!(sn(e)&&e.type==="mfa_verification_max_attempts_reached")}function Kl(e){return!!(sn(e)&&e.message.includes("code 429"))}function Yl(e){return!!(xv(e)&&e.message==="MFA canceled")}import{Fragment as Ku,jsx as dn,jsxs as Jl}from"react/jsx-runtime";var ju=1,Yu=()=>{let{authenticated:e,user:t,getAccessToken:r}=H(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=W(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=S(),u=Av(()=>Date.now(),[]),[m,h]=kv(!1),{onCompleteNavigateTo:g,onFailure:E}=l?.connectWallet,v=C=>{m||(h(!0),E(typeof C=="string"?new Error(C):C))};_v(()=>{let C=ye(t),T;return!e||!C?v("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let I=await r();if(!I)return v("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:I,address:C.address});let _=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&_<ju?T=setTimeout(()=>{a(g)},(ju-_)*1e3):a(g)}catch(_){if(Eo(_)&&C.recoveryMethod==="privy"){let F=await r();if(!F)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 i?.recover({address:C.address,accessToken:F}))?.address||v(new Error("Unable to recover wallet")),g?a(g):o({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:C.address}),a(g)}catch{v("An error has occurred, please try again.")}}else Eo(_)?(s({...l,recoverWallet:{privyWallet:C,onCompleteNavigateTo:g,onFailure:E}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):v(_)}})(),()=>clearTimeout(T)):void 0},[e,t,i]);let x=()=>{v("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=x,Jl(Ku,{children:[dn(A,{onClose:x}),m?Jl(Ku,{children:[Jl(Vt,{children:[dn(Sv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),dn(Te,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),dn(D,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):dn(an,{}),dn(Iv,{})]})},Iv=Rv.div`
|
|
969
969
|
height: 44px;
|
|
970
|
-
`;import
|
|
970
|
+
`;import Mv from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as Wv}from"react";import{Fragment as Lv,jsx as pn,jsxs as Ju}from"react/jsx-runtime";var Zu=()=>{let{user:e}=H(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=W(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=S(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let m=ye(e);m?(o(),l(m)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return Wv(()=>{let m=setTimeout(u,Od);return()=>clearTimeout(m)},[]),a.current=u,Ju(Lv,{children:[pn(A,{onClose:u}),pn(X,{}),Ju(Vt,{children:[pn(Mv,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),pn(Te,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),pn(te,{}),pn(V,{protectedByPrivy:!0})]})};import Ov from"@heroicons/react/20/solid/ExclamationTriangleIcon";import Nv from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as em,useRef as Dv,useState as Zl}from"react";import qr from"styled-components";import{Fragment as qv,jsx as _e,jsxs as jt}from"react/jsx-runtime";var tm=()=>{let[e,t]=Zl(null),{authenticated:r,user:o,getAccessToken:n}=H(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=W(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=S(),u=ye(o)?.address,{onFailure:m,onSuccess:h,origin:g,appId:E}=s.keyExport,v=C=>{i({shouldCallAuthOnSuccess:!1}),m(typeof C=="string"?new Error(C):C)},x=()=>{i({shouldCallAuthOnSuccess:!1}),h(),a("embedded_wallet_key_export_completed",{walletAddress:u})};return em(()=>{let C=ye(o);if(!r||!C)return v("User must be authenticated before exporting their wallet");n().then(t,v)},[r,o]),c.current=x,jt(qv,{children:[_e(A,{onClose:x}),jt(Bv,{children:[jt(Te,{icon:_e(Nv,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[jt(zv,{children:[_e(Fv,{style:{marginRight:6}}),Ur(u)]}),_e("p",{children:"You can bring your account with you to another site using an external wallet."})]}),jt(Hv,{children:[jt(Qu,{children:[_e(Xu,{children:"1"}),jt("span",{children:[_e("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(Qu,{children:[_e(Xu,{children:"2"}),_e("span",{children:"Copy this key into your other wallet"})]})]}),_e("div",{style:{width:"100%"},children:e&&_e(Uv,{origin:g,appId:E,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),jt($v,{children:[jt("div",{children:[_e(Ov,{viewBox:"0 0 20 18"}),_e("h4",{children:"Warning"})]}),_e("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),_e(V,{protectedByPrivy:!0})]})};function Uv(e){let[t,r]=Zl(e.dimensions.width),[o,n]=Zl(void 0),i=Dv(null);return em(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();r(l)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),_e("div",{ref:i,children:t&&jt(Gv,{children:[_e("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Ki(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),_e(Vv,{children:"Loading..."})]})})}function Fv(e){return _e("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:_e("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 Bv=qr.div`
|
|
971
971
|
display: flex;
|
|
972
972
|
flex-direction: column;
|
|
973
973
|
text-align: left;
|
|
974
|
-
`,
|
|
974
|
+
`,Hv=qr.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
|
+
`,Qu=qr.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
|
+
`,Xu=qr.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
|
+
`,Gv=qr.div`
|
|
1005
1005
|
overflow: visible;
|
|
1006
1006
|
position: relative;
|
|
1007
1007
|
height: 44px;
|
|
1008
|
-
`,
|
|
1008
|
+
`,Vv=qr.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
|
+
`,zv=qr.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
|
+
`,$v=qr.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 Fw from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as _m,useRef as Bw,useState as pi}from"react";import Hw from"styled-components";import{useCallback as Sm,useEffect as Uw}from"react";import Zv from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as Qv,useState as ec}from"react";import jv from"@heroicons/react/24/outline/ArrowPathIcon";import Kv from"@heroicons/react/24/outline/EyeIcon";import Yv from"@heroicons/react/24/outline/EyeSlashIcon";import qe,{css as Ql}from"styled-components";var Jv=Ql`
|
|
1056
1056
|
font-size: 14px;
|
|
1057
1057
|
font-style: normal;
|
|
1058
1058
|
font-weight: 400;
|
|
@@ -1061,7 +1061,7 @@ Resources:
|
|
|
1061
1061
|
text-align: left;
|
|
1062
1062
|
transition: color 0.1s ease-in;
|
|
1063
1063
|
`,$a=qe.span`
|
|
1064
|
-
${
|
|
1064
|
+
${Jv}
|
|
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
|
+
`,jr=qe.div`
|
|
1073
1073
|
display: flex;
|
|
1074
1074
|
flex-direction: column;
|
|
1075
1075
|
justify-content: center;
|
|
1076
1076
|
flex-grow: 1;
|
|
1077
|
-
`,
|
|
1078
|
-
${e=>e.hideAnimations&&
|
|
1077
|
+
`,Kr=qe(D)`
|
|
1078
|
+
${e=>e.hideAnimations&&Ql`
|
|
1079
1079
|
&& {
|
|
1080
1080
|
transition: none;
|
|
1081
1081
|
}
|
|
1082
1082
|
`}
|
|
1083
|
-
`,
|
|
1083
|
+
`,rm=Ql`
|
|
1084
1084
|
&& {
|
|
1085
1085
|
width: 100%;
|
|
1086
1086
|
border-width: 1px;
|
|
@@ -1096,7 +1096,7 @@ Resources:
|
|
|
1096
1096
|
line-height: 22px; /* 137.5% */
|
|
1097
1097
|
}
|
|
1098
1098
|
`,un=qe.input`
|
|
1099
|
-
${
|
|
1099
|
+
${rm}
|
|
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
|
+
`,om=qe.div`
|
|
1111
|
+
${rm}
|
|
1112
|
+
`,Yr=qe.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
|
+
`,Jr=qe.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
|
+
`,ai=qe.div`
|
|
1141
1141
|
display: flex;
|
|
1142
1142
|
flex-direction: column;
|
|
1143
1143
|
gap: 10px;
|
|
1144
1144
|
padding-bottom: 1rem;
|
|
1145
|
-
`,
|
|
1145
|
+
`,si=qe.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
|
+
`,c_=qe.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
|
+
`,Xl=qe(Aa)`
|
|
1172
1172
|
display: flex;
|
|
1173
1173
|
flex: 1;
|
|
1174
1174
|
gap: 4px;
|
|
@@ -1188,7 +1188,7 @@ Resources:
|
|
|
1188
1188
|
flex-direction: row;
|
|
1189
1189
|
justify-content: space-around;
|
|
1190
1190
|
align-items: center;
|
|
1191
|
-
`,
|
|
1191
|
+
`,nm=qe(jv)`
|
|
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
|
-
`,fn=qe(
|
|
1200
|
+
`,fn=qe(Yv)`
|
|
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
|
-
`,hn=qe(
|
|
1209
|
+
`,hn=qe(Kv)`
|
|
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
|
+
`,im=qe.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 Xv,jsx as wt,jsxs as qa}from"react/jsx-runtime";var am=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=ec(!0),[l,s]=ec(!1),[c,u]=ec(""),m=r===c;return Qv(()=>{c&&!l&&s(!0)},[c]),qa(Xv,{children:[wt(A,{title:"Confirm Password",closeable:!1,backFn:n}),wt(X,{}),qa(jr,{children:[qa(Jr,{children:[wt(Zv,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),wt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),wt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),qa(Yr,{children:[wt(un,{value:c,onChange:h=>u(h.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),wt(mn,{style:{right:"0.75rem"},children:i?wt(fn,{onClick:()=>a(!1)}):wt(hn,{onClick:()=>a(!0)})})]}),wt($a,{"aria-hidden":!l||m,error:!0,children:"Passwords do not match"})]}),wt(Kr,{onClick:o,loading:t,disabled:!m,hideAnimations:e,children:"Continue"}),wt(te,{}),wt(V,{protectedByPrivy:!0})]})};import ow from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as nw}from"react";import iw from"styled-components";import ja from"styled-components";import{jsx as li,jsxs as rw}from"react/jsx-runtime";var sm=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>li("label",{children:rw(ew,{className:e,children:[li(cm,{checked:t,...o}),li(tw,{color:r,checked:t,children:li(lm,{viewBox:"0 0 24 24",children:li("polyline",{points:"20 6 9 17 4 12"})})})]})}),ew=ja.div`
|
|
1235
1235
|
display: inline-block;
|
|
1236
1236
|
vertical-align: middle;
|
|
1237
|
-
`,
|
|
1237
|
+
`,lm=ja.svg`
|
|
1238
1238
|
fill: none;
|
|
1239
1239
|
stroke: white;
|
|
1240
1240
|
stroke-width: 3px;
|
|
1241
|
-
`,
|
|
1241
|
+
`,cm=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
|
+
`,tw=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
|
+
${cm}:focus + & {
|
|
1268
1268
|
box-shadow: 0 0 0 1px ${e=>e.color};
|
|
1269
1269
|
}
|
|
1270
1270
|
|
|
1271
|
-
${
|
|
1271
|
+
${lm} {
|
|
1272
1272
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
1273
1273
|
}
|
|
1274
|
-
`;import{Fragment as
|
|
1274
|
+
`;import{Fragment as dm,jsx as Mt,jsxs as ci}from"react/jsx-runtime";var pm=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=nw(!1);return ci(dm,{children:[Mt(A,{title:"Confirm Password",closeable:!1,backFn:o}),Mt(X,{}),ci(jr,{children:[ci(Jr,{children:[Mt(ow,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),Mt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),Mt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),Mt(ai,{children:ci(si,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[Mt(sm,{color:"var(--privy-color-error)",checked:i}),Mt(dm,{children:"I understand losing my password means losing my account."})]})})]}),ci(aw,{children:[n.initiatedBy==="user"&&Mt(Gt,{onClick:n.onCancel,disabled:t,children:"Cancel"}),Mt(Kr,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),Mt(te,{}),Mt(V,{protectedByPrivy:!0})]})},aw=iw.div`
|
|
1275
1275
|
display: flex;
|
|
1276
1276
|
gap: 10px;
|
|
1277
|
-
`;import
|
|
1277
|
+
`;import Ew from"@heroicons/react/24/outline/KeyIcon";import vm from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as wm,useMemo as tc,useEffect as Pw}from"react";import Cm from"styled-components";import sw from"fast-password-entropy";import*as um from"secure-password-utilities";import{DEFAULT_WORDLIST as lw}from"secure-password-utilities/wordlists";var cw=95,dw=8,pw=3,uw=.3,mw=/[a-z]/,fw=/[A-Z]/,hw=/[0-9]/,yw="a-zA-Z0-9",mm="!@#$%^&*()\\-_+.",fm=`${yw}${mm}`,gw=new RegExp(`[${mm}]`),vw=new RegExp(`[${fm}]`),hm=new RegExp(`^[${fm}]{6,}$`),ym=(e="")=>{let t=e.split("").filter(r=>!vw.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},Ka=()=>um.generatePassphrase(4,lw);function ww(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Cw(e){if(e.length<dw)return 0;let t=0;mw.test(e)&&(t+=1),fw.test(e)&&(t+=1),hw.test(e)&&(t+=1),gw.test(e)&&(t+=1);let r=t/pw;return Math.max(0,Math.min(1,r))}function bw(e=""){let t=Cw(e),r=sw(e)/cw;return(t*uw+r)/2}function gm(e=""){let t=bw(e);return{value:t,label:ww(t)}}import{Fragment as Sw,jsx as Oe,jsxs as Ar}from"react/jsx-runtime";var bm=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:i,onPasswordChange:a,onPasswordGenerate:l})=>{let[s,c]=wm(!1),[u,m]=wm(!1);Pw(()=>{r&&!u&&m(!0)},[r]);let h=tc(()=>u?(r?.length||0)<6?"Password must be at least 6 characters":hm.test(r||"")?null:`Invalid characters used ( ${ym(r).join(" ")} )`:null,[r,u]),g=tc(()=>h?{value:0,label:"Weak"}:gm(r),[r,h]),E=tc(()=>!!(!r?.length||h),[h,r]);return Ar(Sw,{children:[Oe(A,{onClose:i,title:"Secure your account",closeable:o.initiatedBy==="user"}),Oe(X,{}),Ar(jr,{children:[Ar(Jr,{children:[Oe(Ew,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Oe("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),Oe("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),Ar(Yr,{children:[Oe(un,{value:r,onChange:v=>a(v.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text",style:{paddingRight:"3.8rem"}}),Ar(mn,{style:{width:"3.5rem"},children:[s?Oe(fn,{onClick:()=>c(!1)}):Oe(hn,{onClick:()=>c(!0)}),Oe(nm,{onClick:l})]})]}),Oe(im,{value:g.value===0?.01:g.value,label:g.label}),Oe($a,{error:!!h,children:h||`Password Strength: ${u?g.label:"--"}`}),Ar(xw,{children:[Oe(Tw,{children:Ar(ai,{children:[Ar(si,{children:[Oe(vm,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),Ar(si,{children:[Oe(vm,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),Oe(Kr,{onClick:n,loading:t,disabled:E,hideAnimations:e,children:"Continue"})]})]}),Oe(te,{}),Oe(V,{protectedByPrivy:!0})]})},Tw=Cm(ai)`
|
|
1278
1278
|
flex: 1;
|
|
1279
1279
|
padding-top: 1rem;
|
|
1280
|
-
`,
|
|
1280
|
+
`,xw=Cm.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 Aw from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import kw from"@heroicons/react/24/outline/DocumentDuplicateIcon";import Rw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Iw,useCallback as Em}from"react";import{Fragment as rc,jsx as ct,jsxs as Po}from"react/jsx-runtime";var Pm=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=Iw(!1),s=Em(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=Em(()=>{let u=document.createElement("a"),m=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),h=new Blob([Mw(r,o)],{type:"text/plain"}),g=URL.createObjectURL(h);u.href=g,u.target="_blank",u.download=`${m}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return Po(rc,{children:[ct(A,{backFn:i,title:"Save Password",closeable:!1}),ct(X,{}),Po(jr,{children:[Po(Jr,{children:[ct(Rw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),ct("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),ct("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."})]}),ct(Yr,{centered:!0,children:ct(om,{children:o})}),Po("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[ct(Xl,{onClick:s,children:a?Po(rc,{children:[ct(Aw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):Po(rc,{children:[ct(kw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),Po(Xl,{onClick:c,children:[ct(_w,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),ct(Kr,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),ct(te,{}),ct(V,{protectedByPrivy:!0})]})},Mw=(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 Ww from"@heroicons/react/24/solid/CheckCircleIcon";import Lw from"@heroicons/react/24/solid/XCircleIcon";import{Fragment as Ow,jsx as kr,jsxs as oc}from"react/jsx-runtime";var Tm=({error:e,onClose:t})=>oc(Ow,{children:[kr(A,{closeable:!1}),kr(X,{}),e?oc(Vt,{children:[kr(Lw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),kr(Te,{title:"Something went wrong",description:e})]}):oc(Vt,{children:[kr(Ww,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),kr(Te,{title:"Success"})]}),kr(D,{onClick:t,children:"Close"}),kr(te,{}),kr(V,{protectedByPrivy:!0})]});import{useReducer as Nw}from"react";var Dw=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},xm=()=>{let[e,t]=Nw(Dw,"creating");return{send:t,state:e}};import{jsx as di}from"react/jsx-runtime";var Ya=({onSubmit:e,...t})=>{let{send:r,state:o}=xm(),n=Sm(async()=>{o==="finalizing"&&await e(),r("next")},[o,r,e]);Uw(()=>{let a;return o==="done"&&t.config.initiatedBy==="automatic"&&(a=setTimeout(()=>t.onClose?.(),Qe)),()=>{a&&clearTimeout(a)}},[o,t.config.initiatedBy,t.onClose]);let i=Sm(()=>{r("back")},[r]);return o==="creating"?di(bm,{...t,onSubmit:n}):o==="saving"?di(Pm,{...t,onSubmit:n,onBack:i}):o==="confirming"?di(am,{...t,onSubmit:n,onBack:i}):o==="finalizing"?di(pm,{...t,onSubmit:n,onBack:i}):o==="done"?di(Tm,{...t,onSubmit:n}):null};import{Fragment as Vw,jsx as To,jsxs as Am}from"react/jsx-runtime";var km=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=S(),[n,i]=pi(""),[a,l]=pi(!1),[s,c]=pi(),[u,m]=pi(null),[h,g]=pi(null),E=Bw(!1),{authenticated:v,getAccessToken:x}=H(),{refreshUser:C,closePrivyModal:T,createAnalyticsEvent:R,isNewUserThisSession:I,initializeWalletProxy:_}=W(),{onSuccess:F,onFailure:U,callAuthOnSuccessOnClose:B}=r.createWallet,k=e?.embeddedWallets.requireUserPasswordOnCreate===!0,z=!!(!n||E.current)&&!k,L=new Xe(async()=>ie());_m(()=>{u||_(3e4).then(Q=>m(Q))},[u]),_m(()=>{if(!v){t("LANDING"),U(new Error("User must be authenticated before creating a Privy wallet"));return}!k&&!a&&!E.current&&(l(!0),L.execute().finally(()=>l(!1)))},[k,v]);let j=()=>{k&&h&&h?.recoveryMethod!=="user-passcode"?(U(new mt("User created a wallet but failed to set a password for it")),T({shouldCallAuthOnSuccess:!1})):h?(F(h),T({shouldCallAuthOnSuccess:B})):(U(new mt("User wallet creation failed")),T({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let ie=async function(){let Q=await x();if(Q)try{R("embedded_wallet_creation_started");let $=await _(Lo);if(!$)throw new Error("walletProxy does not exist.");let be=1e4,he=new Promise((pe,pt)=>{setTimeout(()=>{pt(new Error("walletProxy.create timed out."))},be)});if(!await Promise.race([$.create({accessToken:Q,recoveryPassword:s}),he]))throw new Error("walletProxy.create did not send a response.");let dt=await C();if(!dt)throw new Error("Failed to refresh user.");let xe=ye(dt);if(!xe)throw new Error("Updated user is missing embedded wallet.");g(xe),R("embedded_wallet_creation_completed",{walletAddress:xe.address}),i(""),E.current=!0,k?t("EMBEDDED_WALLET_CREATED_SCREEN"):I?t("EMBEDDED_WALLET_CREATED_SCREEN"):xe&&(F(xe),T({shouldCallAuthOnSuccess:B}))}catch($){if(E.current)return;R("embedded_wallet_creation_failed",{error:$.toString()}),i("An error has occurred, please try again."),console.warn($)}else i("An error has occured, please login again."),R("embedded_wallet_creation_failed",{error:"Missing access token for user."})},ee=async()=>{if(!k)return T({shouldCallAuthOnSuccess:B});l(!0);let Q=250;return L.execute().then(()=>new Promise($=>setTimeout($,Q))).finally(()=>l(!1))};return!k&&n?Am(Vw,{children:[To(A,{closeable:!1}),Am(Vt,{children:[To(Fw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),To(Te,{title:"Something went wrong",description:n})]}),To(D,{onClick:j,children:"Close"}),To(Gw,{})]}):z?To(an,{}):To(Ya,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:z||!u,buttonLoading:a,buttonHideAnimations:!h&&a,error:n,password:s||"",onClose:j,onPasswordChange:c,onPasswordGenerate:()=>c(Ka()),onSubmit:ee})},Gw=Hw.div`
|
|
1289
1289
|
height: 44px;
|
|
1290
|
-
`;import{useEffect as
|
|
1290
|
+
`;import{useEffect as zw,useState as Ja}from"react";import{jsx as $w}from"react/jsx-runtime";var Rm=()=>{let[e,t]=Ja(null),[r,o]=Ja(!1),[n,i]=Ja(null),[a,l]=Ja(""),{authenticated:s,getAccessToken:c,user:u}=H(),{walletProxy:m,refreshUser:h,closePrivyModal:g,createAnalyticsEvent:E}=W(),{app:v,navigate:x,data:C,onUserCloseViaDialogOrKeybindRef:T}=S(),{onSuccess:R,onFailure:I}=C.createWallet,_=ye(u),F=e?.recoveryMethod==="user-passcode";zw(()=>{s||(x("LANDING"),I(new Ni("User must be authenticated before setting a password on a Privy wallet")))},[s]);let U=()=>{if(n){I(n),g({shouldCallAuthOnSuccess:!1});return}if(!F){I(new mt("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}R(e),g({shouldCallAuthOnSuccess:!1})};T.current=U;let B=async()=>{let z=await c();if(z&&_?.address&&a&&m)try{if(E("embedded_wallet_set_password_started",{walletAddress:_.address}),!(await m.setRecoveryPassword({accessToken:z,address:_.address,recoveryPassword:a})).address){i(new mt("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:_.address,reason:"error setting password"});return}let j=await h(),ie=ye(j);if(!ie){i(new mt("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:_.address,reason:"wallet disconnected"});return}t(ie),E("embedded_wallet_set_password_completed",{walletAddress:_.address})}catch(L){console.warn(L),i(L instanceof Error?L:new Error("Error setting password on privy wallet")),E("embedded_wallet_set_password_failed",{walletAddress:_.address,reason:L})}},k=async()=>{F?(R(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await B(),o(!1))};return $w(Ya,{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:a,onPasswordGenerate:()=>l(Ka()),onPasswordChange:l,onSubmit:k,onClose:U})};import qw from"@heroicons/react/24/outline/UserCircleIcon";import jw from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as Kw,jsx as Rr,jsxs as Za}from"react/jsx-runtime";var Im=()=>{let{user:e}=H(),{closePrivyModal:t,createAnalyticsEvent:r}=W(),{data:o,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=S(),{onSuccess:l,onFailure:s}=o.setWalletPassword,c=()=>{s(new mt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,Za(Kw,{children:[Rr(A,{onClose:c}),Rr(X,{}),Za(Vt,{children:[Za(fu,{children:[Rr(qw,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Rr(hu,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Rr(jw,{width:"12px",height:"12px",fill:"white"})})]}),Za(Te,{title:"Secure Your Account",children:["Please set a password to secure your account.",Rr("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."})]})]}),Rr(D,{onClick:()=>{let m=ye(e);r("embedded_wallet_set_password_started",{walletAddress:m?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Rr(te,{}),Rr(V,{protectedByPrivy:!0})]})};import Yw from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as Jw,useState as Qa}from"react";import Xa,{css as Zw}from"styled-components";import{Fragment as r0,jsx as rt,jsxs as xo}from"react/jsx-runtime";var Mm=()=>{let[e,t]=Qa(!0),{authenticated:r,getAccessToken:o}=H(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=W(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=S(),[u,m]=Qa(void 0),[h,g]=Qa(""),[E,v]=Qa(!1),{privyWallet:x,onCompleteNavigateTo:C,onSuccess:T,onFailure:R}=s.recoverWallet,I=(U="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),R(typeof U=="string"?new mt(U):U)};c.current=I,Jw(()=>{if(!r||!x)return I("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let _=U=>{U&&m(U)};return xo(r0,{children:[rt(A,{onClose:I}),rt(X,{}),xo(Xw,{children:[xo(Qw,{children:[rt(Yw,{height:48,width:48,stroke:"var(--privy-color-accent)"}),rt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),rt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),xo("div",{children:[xo(Yr,{children:[rt(un,{type:e?"password":"text",onChange:U=>_(U.target.value),disabled:E,style:{paddingRight:"2.3rem"}}),rt(mn,{style:{right:"0.75rem"},children:e?rt(fn,{onClick:()=>t(!1)}):rt(hn,{onClick:()=>t(!0)})})]}),!!h&&rt(e0,{children:h})]}),xo("div",{children:[xo(mu,{children:[rt("h4",{children:"Why is this necessary?"}),rt("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),rt(t0,{loading:E||!n,disabled:!u,onClick:async()=>{v(!0);let U=await o();if(U&&x&&u!==null)try{a("embedded_wallet_recovery_started",{walletAddress:x.address}),await n?.recover({address:x.address,accessToken:U,recoveryPin:u}),g(""),C?l(C):i({shouldCallAuthOnSuccess:!1}),T?.(x),a("embedded_wallet_recovery_completed",{walletAddress:x.address})}catch(B){qu(B)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{v(!1)}else return I("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!x&&E,children:"Recover your account"})]})]}),rt(te,{}),rt(V,{protectedByPrivy:!0})]})},Qw=Xa.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
|
+
`,Xw=Xa.div`
|
|
1313
1313
|
display: flex;
|
|
1314
1314
|
flex-direction: column;
|
|
1315
1315
|
justify-content: space-between;
|
|
1316
|
-
`,
|
|
1316
|
+
`,e0=Xa.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
|
+
`,t0=Xa(D)`
|
|
1324
|
+
${e=>e.hideAnimations&&Zw`
|
|
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 o0 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import n0 from"@heroicons/react/24/outline/PhoneIcon";import nc from"styled-components";import{Fragment as c0,jsx as Kt,jsxs as es}from"react/jsx-runtime";var i0=e=>{let t=Kt(o0,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof P)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 Se&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:Kt(n0,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof He)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:Kt(Fa,{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:Kt("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:Kt("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 Xt&&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}}},Wm=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=S(),{reset:i}=de(),a=r?.errorModalData,l=i0(a?.error||new Error),s=c=>{if(c instanceof He)switch(c.privyErrorCode){case"invalid_captcha":return()=>i()}return()=>{}};return es(c0,{children:[Kt(A,{backFn:!o||n===o?void 0:t}),es(a0,{children:[Kt(l0,{children:es("div",{children:[Kt(Ua,{color:"var(--privy-color-error)"}),l.icon]})}),es(s0,{children:[Kt("h3",{children:l.title}),Kt("p",{children:l.detail})]}),Kt(D,{color:"var(--privy-color-error)",onClick:()=>{s(a?.error||new Error)(),e(o||"LANDING",!1)},children:l.ctaText})]})]})},a0=nc.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
|
+
`,s0=nc.div`
|
|
1340
1340
|
display: flex;
|
|
1341
1341
|
flex-direction: column;
|
|
1342
1342
|
gap: 8px;
|
|
1343
|
-
`,
|
|
1343
|
+
`,l0=nc.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 Gm,useRef as k0,useState as sc}from"react";import{isIOS as R0,isMobile as Vm}from"react-device-detect";import lc from"styled-components";import{useState as d0}from"react";import p0 from"styled-components";import{jsx as Lm}from"react/jsx-runtime";var ts=({style:e,color:t,...r})=>Lm("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:Lm("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as ic}from"react/jsx-runtime";var Om=({color:e,...t})=>ic("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:ic("g",{children:ic("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 Nm,jsxs as m0}from"react/jsx-runtime";var yn=e=>{let[t,r]=d0(!1);return m0(u0,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?Nm(ts,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Nm(Om,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},u0=p0.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 f0}from"react";import h0 from"styled-components";import{jsx as g0}from"react/jsx-runtime";var Dm=e=>{let[t,r]=f0(!1);return g0(y0,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},y0=h0.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 v0 from"qrcode";import w0 from"react";import C0 from"styled-components";import{jsx as Um}from"react/jsx-runtime";var Fm=()=>Um("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:Um("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as ui,jsx as ot,jsxs as Hm}from"react/jsx-runtime";var Ct=7,ac=(e,t,r,o,n)=>{for(let i=t;i<t+o;i++)for(let a=r;a<r+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},b0=e=>{let t=v0.create(e,{errorCorrectionLevel:"high"}).modules,r=Vd(Array.from(t.data),t.size);return r=ac(r,0,0,Ct,Ct),r=ac(r,r.length-Ct,0,Ct,Ct),r=ac(r,0,r.length-Ct,Ct,Ct),r},E0=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>ot(ui,{children:[0,1,2].map(i=>ot("circle",{r:r*(Ct-i*2)/2,cx:e+r*Ct/2,cy:t+r*Ct/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),P0=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-Ct)*e,0],[0,(t-Ct)*e]];return ot(ui,{children:n.map(([i,a])=>ot(E0,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},T0=({matrix:e,cellSize:t,color:r})=>ot(ui,{children:e.map((o,n)=>o.map((i,a)=>i?ot("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:r},`circle-${n}-${a}`):ot(w0.Fragment,{},`circle-${n}-${a}`)))}),Bm=(e,t)=>e-e%t,x0=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:i})=>{if(!r)return ot(ui,{});let a=o||40,l=n||4,s=r,c=e/2-a/2-l;return Hm(ui,{children:[ot("rect",{x:Bm(c,t),y:Bm(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),ot(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},S0=e=>{let t=e.outputSize,r=b0(e.url),o=t/r.length;return Hm("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[ot(T0,{matrix:r,cellSize:o,color:e.fgColor}),ot(P0,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),ot(x0,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},_0=C0.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
|
-
`,rs=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return ot(
|
|
1457
|
+
`,rs=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return ot(_0,{size:o,bgColor:t,fgColor:r,children:ot(S0,{url:e.url,logo:{element:e.squareLogoElement??Fm},outputSize:o,bgColor:t,fgColor:r})})};import{jsx as os,jsxs as A0}from"react/jsx-runtime";var gn=({style:e,...t})=>A0("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:[os("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),os("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"}),os("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"}),os("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 ns,jsx as se,jsxs as pr}from"react/jsx-runtime";var zm="#8a63d2",jm=1e3,I0=jm*2,M0=jm*120,Km=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=S(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:m,createAnalyticsEvent:h}=W(),[g,E]=sc(void 0),[v,x]=sc(!1),[C,T]=sc(!1),R=k0([]),I=s?.render.inDialog?Qe:0,_=c(),F=_?.meta.connectUri;return Gm(()=>{let U=Date.now(),B=setInterval(async()=>{let k=await _.pollForReady.execute(),z=Date.now()-U;if(k){clearInterval(B),x(!0);try{await u(),T(!0)}catch(L){let j={retryable:!1,message:"Authentication failed"};if(L?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else L?.privyErrorCode==="linked_to_another_user"?j.detail="This account has already been linked to another user.":L?.privyErrorCode==="invalid_credentials"?(j.retryable=!0,j.detail="Something went wrong. Try again."):L?.privyErrorCode==="too_many_requests"&&(j.detail="Too many requests. Please wait before trying again.");E(j)}}else z>M0&&(clearInterval(B),E({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},I0);return()=>{clearInterval(B),R.current.forEach(k=>clearTimeout(k))}},[]),Gm(()=>{if(r&&e&&C&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let B=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout(B)}C&&(Pt(o,s?.embeddedWallets.createOnLogin)?R.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:B=>{console.error(B),h("embedded_wallet_creation_failure_logout",{error:B,screen:"FarcasterConnectStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I)):R.current.push(setTimeout(()=>m({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I)))}},[C,r,e,o]),Vm||v?pr(ns,{children:[se(A,{backFn:n?a:void 0,onClose:m},"header"),se(X,{}),R0?se(ns,{children:pr(W0,{children:[se(qm,{children:pr("div",{children:[se(xr,{success:C,fail:!!g}),se(gn,{style:{width:"38px",height:"38px"}})]})}),pr(gt,{children:[se(we,{children:g?g.message:"Sign in with Farcaster"}),se(fe,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),F&&se(D,{onClick:U=>{U.preventDefault(),window.location.href=F},children:"Open Warpcast app"})]})}):se(ns,{children:pr($m,{children:[se(qm,{children:pr("div",{children:[se(xr,{success:C,fail:!!g}),se(gn,{style:{width:"38px",height:"38px"}})]})}),pr(gt,{children:[se(we,{children:g?g.message:"Signing in with Farcaster"}),se(fe,{children:g?g.detail:"This should only take a moment"}),se(It,{children:F&&Vm&&se(Dm,{text:"Take me to Warpcast",url:F,color:zm})})]})]})}),se(oe,{})]}):pr(ns,{children:[se(A,{backFn:n?a:void 0,onClose:m},"header"),se(X,{}),se($m,{children:pr("div",{children:[se(we,{children:"Sign in with Farcaster"}),se(fe,{children:"Scan with your phone's camera to continue."}),se(Ha,{children:F?se(rs,{url:F,size:275,squareLogoElement:gn}):se(St,{})}),pr(It,{children:[se(fe,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),F&&se(yn,{text:F,itemName:"link",color:zm})]})]})}),se(oe,{})]})},$m=lc.div`
|
|
1458
1458
|
display: flex;
|
|
1459
1459
|
flex-direction: column;
|
|
1460
1460
|
align-items: center;
|
|
@@ -1462,7 +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
|
+
`,W0=lc.div`
|
|
1466
|
+
display: flex;
|
|
1467
|
+
flex-direction: column;
|
|
1468
|
+
align-items: center;
|
|
1469
|
+
justify-content: center;
|
|
1470
|
+
gap: 24px;
|
|
1471
|
+
width: 100%;
|
|
1472
|
+
`,qm=lc.div`
|
|
1466
1473
|
display: flex;
|
|
1467
1474
|
flex-direction: column;
|
|
1468
1475
|
justify-content: center;
|
|
@@ -1485,7 +1492,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1485
1492
|
left: -19px;
|
|
1486
1493
|
top: -19px;
|
|
1487
1494
|
}
|
|
1488
|
-
`;import
|
|
1495
|
+
`;import O0 from"@heroicons/react/24/outline/ClockIcon";import N0 from"@heroicons/react/24/outline/EyeSlashIcon";import D0 from"@heroicons/react/24/outline/LinkIcon";import ur from"styled-components";import{jsx as cc,jsxs as L0}from"react/jsx-runtime";var is=({size:e=61,...t})=>cc("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:L0("g",{id:"moonpay_symbol_wht 2",children:[cc("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),cc("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 Ym,jsx as nt,jsxs as So}from"react/jsx-runtime";var dc=({title:e,desc:t,icon:r})=>So(V0,{children:[nt($0,{children:r}),So(z0,{children:[nt(H0,{children:e}),nt(G0,{children:t})]})]}),Jm=({app:e,signedUrl:t,onContinue:r})=>So(Ym,{children:[So(F0,{children:[nt(is,{size:"3.75rem"}),So(B0,{children:[e?.name," uses ",nt("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),So(q0,{children:[nt(dc,{icon:nt(D0,{width:"1rem"}),title:"Purchase assets to fund your account",desc:So(Ym,{children:["Connect a payment method (",nt("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),nt(dc,{icon:nt(O0,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),nt(dc,{icon:nt(N0,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),nt(j0,{className:"mobile-only"})]}),nt(U0,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),nt(ka,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),U0=ur.span`
|
|
1489
1496
|
display: inline-block;
|
|
1490
1497
|
color: var(--privy-color-foreground-3);
|
|
1491
1498
|
text-align: center;
|
|
@@ -1494,13 +1501,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1494
1501
|
font-weight: 400;
|
|
1495
1502
|
line-height: 140%; /* 0.875rem */
|
|
1496
1503
|
margin-bottom: 0.25rem;
|
|
1497
|
-
`,
|
|
1504
|
+
`,F0=ur.div`
|
|
1498
1505
|
display: flex;
|
|
1499
1506
|
flex-direction: column;
|
|
1500
1507
|
align-items: center;
|
|
1501
1508
|
justify-content: center;
|
|
1502
1509
|
padding: 1.5rem 0;
|
|
1503
|
-
`,
|
|
1510
|
+
`,B0=ur.span`
|
|
1504
1511
|
color: var(--privy-color-foreground);
|
|
1505
1512
|
text-align: center;
|
|
1506
1513
|
font-size: 1.125rem;
|
|
@@ -1509,46 +1516,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1509
1516
|
margin: 1.5rem 0;
|
|
1510
1517
|
text-align: center;
|
|
1511
1518
|
max-width: 19.5rem;
|
|
1512
|
-
`,
|
|
1519
|
+
`,H0=ur.span`
|
|
1513
1520
|
color: var(--privy-color-foreground);
|
|
1514
1521
|
font-size: 0.875rem;
|
|
1515
1522
|
font-weight: 500;
|
|
1516
1523
|
line-height: 1.225rem;
|
|
1517
1524
|
width: 100%;
|
|
1518
|
-
`,
|
|
1525
|
+
`,G0=ur.span`
|
|
1519
1526
|
color: var(--privy-color-foreground-2);
|
|
1520
1527
|
font-size: 0.875rem;
|
|
1521
1528
|
font-weight: 400;
|
|
1522
1529
|
line-height: 1.225rem;
|
|
1523
|
-
`,
|
|
1530
|
+
`,V0=ur.div`
|
|
1524
1531
|
display: flex;
|
|
1525
1532
|
align-items: flex-start;
|
|
1526
1533
|
gap: 0.5rem;
|
|
1527
1534
|
align-self: stretch;
|
|
1528
|
-
`,
|
|
1535
|
+
`,z0=ur.div`
|
|
1529
1536
|
display: flex;
|
|
1530
1537
|
flex-direction: column;
|
|
1531
1538
|
gap: 0.25rem;
|
|
1532
1539
|
align-items: flex-start;
|
|
1533
1540
|
text-align: left;
|
|
1534
1541
|
flex: 1 0 0;
|
|
1535
|
-
|
|
1542
|
+
`,$0=ur.div`
|
|
1536
1543
|
padding-top: 2px;
|
|
1537
|
-
`,
|
|
1544
|
+
`,q0=ur.div`
|
|
1538
1545
|
display: flex;
|
|
1539
1546
|
flex-direction: column;
|
|
1540
1547
|
gap: 1.25rem;
|
|
1541
1548
|
margin: 0 0.5rem;
|
|
1542
|
-
`,
|
|
1549
|
+
`,j0=ur.div`
|
|
1543
1550
|
margin: 30px 0;
|
|
1544
|
-
`;import{ofetch as
|
|
1551
|
+
`;import{ofetch as K0}from"ofetch";import{useEffect as Y0,useRef as J0,useState as Z0}from"react";var as="moonpay",Zm="sdk_fiat_on_ramp_completed_with_status";async function Qm(e,t,r,o,n=!1){let i=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...i,...a}})}async function Q0(e,t){let r=t?Dd:Nd,o=t?Fd:Ud;return K0(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Xm(e,t=!1){let[r,o]=Z0(null),{createAnalyticsEvent:n}=W(),i=J0(0);return Y0(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await Q0(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(Zm,{status:s,provider:as,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(a))}catch(l){l.response?.status!==404&&(i.current+=1),i.current>=3&&(o("serviceFailure"),n(Zm,{status:"serviceFailure",provider:as}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}import{Fragment as X0,jsx as pc,jsxs as e2}from"react/jsx-runtime";var ef=()=>{let{app:e,data:t,navigate:r}=S(),{createAnalyticsEvent:o}=W(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:e2(X0,{children:[pc(A,{title:"Fund account"},"header"),pc(Jm,{app:e,signedUrl:n,onContinue:()=>{o("sdk_fiat_on_ramp_started",{provider:as}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),pc(V,{protectedByPrivy:!0})]})};import t2 from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import r2 from"@heroicons/react/24/solid/CheckCircleIcon";import o2 from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as n2}from"react";import tf from"styled-components";import{Fragment as uc,jsx as it,jsxs as _o}from"react/jsx-runtime";var rf=()=>{let{app:e,data:t}=S(),{closePrivyModal:r}=W(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Xm(o||null,e.fiatOnRamp.useSandbox);return _o(uc,{children:[it(A,{title:"Fund account"},"header"),it(a2,{status:n,onClickCta:r}),it(V,{protectedByPrivy:!0})]})},i2=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:_o(uc,{children:[_o("p",{children:["It looks like there was an issue with your payment. Please contact"," ",it("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),it("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:""}}},a2=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=n2(()=>i2(e),[e]);return _o(uc,{children:[_o(p2,{children:[it(c2,{status:e}),_o(gt,{children:[it("h3",{children:r}),it(d2,{children:o})]})]}),n&&it(D,{onClick:t,children:n})]})},s2=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)",l2=e=>{switch(e){case"serviceFailure":case"failed":return o2;case"completed":return r2;case"waitingAuthorization":return()=>it(t2,{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}},c2=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return _o("div",{style:{position:"relative"},children:[it(St,{color:o,style:{position:"absolute"}}),it(Tl,{color:o}),it(is,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=l2(e),r=s2(e);return it("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&it(t,{width:"4rem",height:"4rem",color:r})})},d2=tf.p`
|
|
1545
1552
|
font-size: 1rem;
|
|
1546
1553
|
color: var(--privy-color-foreground-3);
|
|
1547
1554
|
margin-bottom: 1rem;
|
|
1548
1555
|
display: flex;
|
|
1549
1556
|
flex-direction: column;
|
|
1550
1557
|
gap: 1rem;
|
|
1551
|
-
`,
|
|
1558
|
+
`,p2=tf.div`
|
|
1552
1559
|
display: flex;
|
|
1553
1560
|
flex-direction: column;
|
|
1554
1561
|
align-items: center;
|
|
@@ -1556,7 +1563,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1556
1563
|
margin-left: 1.75rem;
|
|
1557
1564
|
margin-right: 1.75rem;
|
|
1558
1565
|
padding: 2rem 0;
|
|
1559
|
-
`;import
|
|
1566
|
+
`;import u2 from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import m2 from"styled-components";import{Fragment as h2,jsx as Zr,jsxs as y2}from"react/jsx-runtime";var of=()=>{let{closePrivyModal:e}=W();return y2(h2,{children:[Zr(A,{},"header"),Zr(f2,{children:Zr(u2,{style:{width:32,height:32}})}),Zr(lr,{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"}}),Zr(Rt,{children:Zr(D,{onClick:()=>e(),children:"Close"})}),Zr(te,{}),Zr(V,{protectedByPrivy:!0})]})},f2=m2.div`
|
|
1560
1567
|
border-radius: 50%;
|
|
1561
1568
|
height: 68px;
|
|
1562
1569
|
width: 68px;
|
|
@@ -1566,18 +1573,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1566
1573
|
background-color: var(--privy-color-accent);
|
|
1567
1574
|
color: white;
|
|
1568
1575
|
margin: 0 auto 24px auto;
|
|
1569
|
-
`;import*as
|
|
1576
|
+
`;import*as lf from"react-device-detect";import C2 from"styled-components";import mc from"styled-components";import{jsx as nf}from"react/jsx-runtime";var af=({style:e,...t})=>nf("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:nf("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 v2,jsxs as w2}from"react/jsx-runtime";var sf=mc.div`
|
|
1570
1577
|
display: flex;
|
|
1571
1578
|
flex-direction: column;
|
|
1572
1579
|
justify-content: flex-start;
|
|
1573
1580
|
gap: 4px;
|
|
1574
|
-
`,
|
|
1581
|
+
`,fc=mc.div`
|
|
1575
1582
|
&&& {
|
|
1576
1583
|
margin-left: 7px; /* TODO: This is a total hack */
|
|
1577
1584
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1578
1585
|
height: 12px;
|
|
1579
1586
|
}
|
|
1580
|
-
`,
|
|
1587
|
+
`,ss=({children:e})=>w2(g2,{children:[v2(af,{style:{width:"16px",height:"16px"}}),e]}),g2=mc.div`
|
|
1581
1588
|
display: flex;
|
|
1582
1589
|
justify-content: flex-start;
|
|
1583
1590
|
justify-items: center;
|
|
@@ -1595,15 +1602,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1595
1602
|
margin-bottom: auto;
|
|
1596
1603
|
}
|
|
1597
1604
|
}
|
|
1598
|
-
`;import{Fragment as
|
|
1605
|
+
`;import{Fragment as P2,jsx as Ne,jsxs as mi}from"react/jsx-runtime";var b2=()=>mi(E2,{children:[Ne(Qn,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),Ne(It,{children:Ne(or,{style:{width:"152px",height:"152px"}})}),mi(sf,{children:[Ne(ss,{children:mi("div",{children:[Ne("span",{children:"Install the "}),Ne("a",{href:lf.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"})]})}),Ne(fc,{}),Ne(ss,{children:"Set up your first wallet"}),Ne(fc,{}),Ne(ss,{children:"Store your recovery phrase in a safe place!"})]}),Ne(Ra,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),cf=()=>{let{navigateBack:e}=S();return mi(P2,{children:[Ne(A,{backFn:e},"header"),Ne(X,{}),Ne(b2,{}),Ne(te,{}),mi(oe,{children:[Ne("span",{children:"Still not sure? "}),Ne("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},E2=C2(It)`
|
|
1599
1606
|
gap: 30px;
|
|
1600
1607
|
|
|
1601
1608
|
> :first-child > svg {
|
|
1602
1609
|
margin-top: 20px;
|
|
1603
1610
|
}
|
|
1604
|
-
`;import
|
|
1611
|
+
`;import iC from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as aC,useState as Sf}from"react";import{isMobile as sC}from"react-device-detect";import lC from"styled-components";import k2 from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as R2}from"react";import T2 from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as x2,useState as df}from"react";import uf from"styled-components";import{Fragment as A2,jsx as fi,jsxs as pf}from"react/jsx-runtime";var ls=x2((e,t)=>{let[r,o]=df(""),[n,i]=df(!1),{authenticated:a}=H(),{initLoginWithEmail:l}=W(),{navigate:s,setModalData:c,currentScreen:u}=S(),{enabled:m,token:h}=de(),g=ji(r),E=n,v=n||!g,x=T=>{i(!0),l(r,T).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(R=>{c({errorModalData:{error:R,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},C=()=>{m&&!h&&!a?(c({captchaModalData:{callback:T=>l(r,T),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):x(h)};return pf(A2,{children:[fi(S2,{children:pf(_2,{stacked:e.stacked,children:[fi(T2,{}),fi("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:T=>o(T.target.value),onKeyUp:T=>{T.key==="Enter"&&C()},value:r,autoComplete:"email"}),e.stacked?null:fi(Ko,{isSubmitting:E,onClick:C,disabled:v,children:"Submit"})]})}),e.stacked?fi(D,{loadingText:null,loading:E,disabled:v,onClick:C,children:"Submit"}):null]})}),S2=uf.div`
|
|
1605
1612
|
width: 100%;
|
|
1606
|
-
`,
|
|
1613
|
+
`,_2=uf.label`
|
|
1607
1614
|
display: block;
|
|
1608
1615
|
position: relative;
|
|
1609
1616
|
width: 100%;
|
|
@@ -1666,9 +1673,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1666
1673
|
&& > input::placeholder {
|
|
1667
1674
|
color: var(--privy-color-foreground-3);
|
|
1668
1675
|
}
|
|
1669
|
-
`;import{Fragment as
|
|
1676
|
+
`;import{Fragment as I2,jsx as cs,jsxs as mf}from"react/jsx-runtime";var ds=({isEditable:e,setIsEditable:t})=>{let r=R2(null);return mf(I2,{children:[cs(Sr,{if:!e,children:cs(ls,{ref:r})}),cs(Sr,{if:e,children:mf(Pe,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[cs(k2,{})," Continue with Email"]})})]})};import{useState as M2}from"react";import{jsx as hc,jsxs as W2}from"react/jsx-runtime";var ps=()=>{let[e,t]=M2(!1),{currentScreen:r,navigate:o,setModalData:n}=S(),{enabled:i,token:a}=de(),{initLoginWithFarcaster:l}=W();return W2(Pe,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:c=>l(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[hc(gn,{})," Farcaster",e&&hc("span",{children:hc(vo,{})})]})};import q2 from"@heroicons/react/24/outline/PhoneIcon";import{useRef as j2}from"react";import{forwardRef as G2,useState as yc}from"react";import wf from"styled-components";import L2 from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as O2,AsYouType as N2,getCountries as D2,getCountryCallingCode as us,getExampleNumber as U2}from"libphonenumber-js/min";import{jsx as H2,jsxs as B2}from"react/jsx-runtime";var hi=(e,t)=>O2(String(e),t),ms=(e,t)=>`+${us(t)} ${e}`,ff=e=>`*${e.replaceAll("-","").slice(-4)}`,hf=e=>new N2(e),F2=D2().map(e=>({code:e,callCode:us(e)})),yf=e=>{let t=U2(e,L2)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},gf=({value:e,onChange:t})=>H2("select",{value:e,onChange:t,children:F2.map(r=>B2("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});import{Fragment as $2,jsx as yi,jsxs as vf}from"react/jsx-runtime";var vn=G2((e,t)=>{let{app:r}=S(),[o,n]=yc(""),[i,a]=yc(r?.intl.defaultCountry??"US"),l=hi(o,i),s=hf(i),c=yf(i),u=us(i),m=!l,[h,g]=yc(!1),E=u.length,v=T=>{let R=T.target.value;a(R),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:ms(o,R),countryCode:R,isValid:hi(o,i)})},x=T=>{try{let R=T.replace(/\D/g,""),I=o.replace(/\D/g,""),_=R===I?T:s.input(T);n(_),e.onChange&&e.onChange({rawPhoneNumber:_,qualifiedPhoneNumber:ms(T,i),countryCode:i,isValid:hi(T,i)})}catch(R){console.error("Error processing phone number:",R)}},C=()=>{g(!0);let T=ms(o,i);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:T,countryCode:i,isValid:hi(o,i)}).finally(()=>g(!1))};return vf($2,{children:[yi(V2,{children:vf(z2,{callingCodeLength:E,stacked:e.stacked,children:[yi(gf,{value:i,onChange:v}),yi("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:T=>{x(T.target.value)},onKeyUp:T=>{T.key==="Enter"&&C()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?yi(Ko,{isSubmitting:h,onClick:C,disabled:m,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?yi(D,{loading:h,loadingText:null,onClick:C,disabled:m,children:"Submit"}):null]})}),V2=wf.div`
|
|
1670
1677
|
width: 100%;
|
|
1671
|
-
`,
|
|
1678
|
+
`,z2=wf.label`
|
|
1672
1679
|
--country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
|
|
1673
1680
|
--phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
|
|
1674
1681
|
display: block;
|
|
@@ -1759,11 +1766,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1759
1766
|
&& > input::placeholder {
|
|
1760
1767
|
color: var(--privy-color-foreground-3);
|
|
1761
1768
|
}
|
|
1762
|
-
`;import{Fragment as $2,jsx as ms,jsxs as wf}from"react/jsx-runtime";var fs=({isEditable:e,setIsEditable:t})=>{let r=z2(null),{authenticated:o}=H(),{navigate:n,setModalData:i,currentScreen:a}=S(),{initLoginWithSms:l}=W(),{enabled:s,token:c}=ce();async function u({qualifiedPhoneNumber:m}){if(s&&!c&&!o)i({captchaModalData:{callback:h=>l(m,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(m,c),n("AWAITING_PASSWORDLESS_CODE")}catch(h){i({errorModalData:{error:h,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return wf($2,{children:[ms(Tr,{if:!e,children:ms(gn,{ref:r,onSubmit:u})}),ms(Tr,{if:e,children:wf(be,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[ms(V2,{})," Continue with SMS"]})})]})};import{useState as Z2}from"react";import{jsx as Cf,jsxs as q2}from"react/jsx-runtime";var hs=({style:e,...t})=>q2("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:[Cf("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"}),Cf("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 gi,jsxs as j2}from"react/jsx-runtime";var ys=({style:e,...t})=>j2("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:[gi("g",{clipPath:"url(#clip0)",children:gi("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"})}),gi("defs",{children:gi("clipPath",{id:"clip0",children:gi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as bf}from"react/jsx-runtime";var gs=({style:e,...t})=>bf("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:bf("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 vs,jsxs as K2}from"react/jsx-runtime";var ws=({style:e,...t})=>K2("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:[vs("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"}),vs("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"}),vs("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"}),vs("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 Cs}from"react/jsx-runtime";function bs({style:e,...t}){return Cs("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:Cs("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Cs("g",{transform:"scale(5.12,5.12)",children:Cs("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 Ef,jsxs as Y2}from"react/jsx-runtime";function Es(e){return Y2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Ef("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"}),Ef("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 hc,jsxs as J2}from"react/jsx-runtime";function Ps(e){return J2("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:[hc("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"}),hc("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"}),hc("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 Pf}from"react/jsx-runtime";var Ts=({style:e,...t})=>Pf("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:Pf("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 Zr,jsxs as X2}from"react/jsx-runtime";var Q2={apple:{logo:Zr(hs,{}),displayName:"Apple"},discord:{logo:Zr(ys,{}),displayName:"Discord"},github:{logo:Zr(gs,{}),displayName:"GitHub"},google:{logo:Zr(ws,{}),displayName:"Google"},linkedin:{logo:Zr(bs,{}),displayName:"LinkedIn"},spotify:{logo:Zr(Es,{}),displayName:"Spotify"},twitter:{logo:Zr(Ts,{}),displayName:"Twitter"},tiktok:{logo:Zr(Ps,{}),displayName:"TikTok"}},De=({provider:e})=>{let{enabled:t,token:r}=ce(),{navigate:o,setModalData:n}=S(),[i,a]=Z2(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:c}=Q2[e];return X2(be,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:m=>l(e,m),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[c," ",s]})};import eC from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Tf,jsxs as tC}from"react/jsx-runtime";var xs=({onClick:e,text:t,icon:r})=>tC(be,{onClick:e,children:[r,Tf(Ma,{children:t}),Tf(eC,{})]});import{Fragment as yc,jsx as Ue,jsxs as _s}from"react/jsx-runtime";var As=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=S(),i=o.loginMethodsAndOrder?.primary??[],a=o.loginMethodsAndOrder?.overflow??[],l=[...i,...a],[s,c]=xf("default"),[u,m]=xf("email");oC(()=>{let _=l.indexOf("sms"),F=l.indexOf("email");_>-1&&_<F&&m("sms")},[i,a]);let h=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{c("default")},150)};n.current=h;let v=_=>_==="email"?Ue(cs,{isEditable:u==="email",setIsEditable:()=>{m("email")}},_):_==="sms"?Ue(fs,{isEditable:u==="sms",setIsEditable:()=>{m("sms")}},_):_==="apple"?Ue(De,{provider:"apple"},_):_==="discord"?Ue(De,{provider:"discord"},_):_==="farcaster"?Ue(ds,{},_):_==="github"?Ue(De,{provider:"github"},_):_==="google"?Ue(De,{provider:"google"},_):_==="linkedin"?Ue(De,{provider:"linkedin"},_):_==="tiktok"?Ue(De,{provider:"tiktok"},_):_==="twitter"&&(!nC||o?.loginConfig.twitterOAuthOnMobileEnabled)?Ue(De,{provider:"twitter"},_):ti([_],r,e,l),E=i.map(v).flat(),g=a.map(v).flat(),x=[...E,...g],C=aC({primary:E.length,overflow:g.length}),[T,R]=Bd(x,C);return _s(yc,{children:[Ue(A,{title:"Log in or sign up",onClose:h,backFn:s==="default"?void 0:()=>{c("default")}}),s==="default"&&Ue(sC,{}),Ue(Wa,{style:{overflow:"hidden",padding:2},children:_s(At,{children:[s==="default"&&_s(yc,{children:[...T,R.length>0&&Ue(xs,{text:"More options",icon:Ue(rC,{}),onClick:()=>c("overflow")})]}),s==="overflow"&&_s(yc,{children:[...R]})]})}),o&&Ue(Yo,{app:o}),Ue(V,{protectedByPrivy:!0})]})},Ss=5,aC=({primary:e,overflow:t})=>e<Ss?e:e===Ss&&t===0?Ss:Ss-1,sC=iC(on)`
|
|
1769
|
+
`;import{Fragment as K2,jsx as fs,jsxs as Cf}from"react/jsx-runtime";var hs=({isEditable:e,setIsEditable:t})=>{let r=j2(null),{authenticated:o}=H(),{navigate:n,setModalData:i,currentScreen:a}=S(),{initLoginWithSms:l}=W(),{enabled:s,token:c}=de();async function u({qualifiedPhoneNumber:m}){if(s&&!c&&!o)i({captchaModalData:{callback:h=>l(m,h),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(m,c),n("AWAITING_PASSWORDLESS_CODE")}catch(h){i({errorModalData:{error:h,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return Cf(K2,{children:[fs(Sr,{if:!e,children:fs(vn,{ref:r,onSubmit:u})}),fs(Sr,{if:e,children:Cf(Pe,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[fs(q2,{})," Continue with SMS"]})})]})};import{useState as eC}from"react";import{jsx as bf,jsxs as Y2}from"react/jsx-runtime";var ys=({style:e,...t})=>Y2("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:[bf("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"}),bf("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 gi,jsxs as J2}from"react/jsx-runtime";var gs=({style:e,...t})=>J2("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:[gi("g",{clipPath:"url(#clip0)",children:gi("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"})}),gi("defs",{children:gi("clipPath",{id:"clip0",children:gi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Ef}from"react/jsx-runtime";var vs=({style:e,...t})=>Ef("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:Ef("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 ws,jsxs as Z2}from"react/jsx-runtime";var Cs=({style:e,...t})=>Z2("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:[ws("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"}),ws("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"}),ws("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"}),ws("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 bs}from"react/jsx-runtime";function Es({style:e,...t}){return bs("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:bs("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:bs("g",{transform:"scale(5.12,5.12)",children:bs("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 Pf,jsxs as Q2}from"react/jsx-runtime";function Ps(e){return Q2("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[Pf("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"}),Pf("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 gc,jsxs as X2}from"react/jsx-runtime";function Ts(e){return X2("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:[gc("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"}),gc("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"}),gc("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 Tf}from"react/jsx-runtime";var xs=({style:e,...t})=>Tf("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:Tf("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 Qr,jsxs as rC}from"react/jsx-runtime";var tC={apple:{logo:Qr(ys,{}),displayName:"Apple"},discord:{logo:Qr(gs,{}),displayName:"Discord"},github:{logo:Qr(vs,{}),displayName:"GitHub"},google:{logo:Qr(Cs,{}),displayName:"Google"},linkedin:{logo:Qr(Es,{}),displayName:"LinkedIn"},spotify:{logo:Qr(Ps,{}),displayName:"Spotify"},twitter:{logo:Qr(xs,{}),displayName:"Twitter"},tiktok:{logo:Qr(Ts,{}),displayName:"TikTok"}},De=({provider:e})=>{let{enabled:t,token:r}=de(),{navigate:o,setModalData:n}=S(),[i,a]=eC(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:c}=tC[e];return rC(Pe,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:m=>l(e,m),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[c," ",s]})};import oC from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as xf,jsxs as nC}from"react/jsx-runtime";var Ss=({onClick:e,text:t,icon:r})=>nC(Pe,{onClick:e,children:[r,xf(Ma,{children:t}),xf(oC,{})]});import{Fragment as vc,jsx as Ue,jsxs as As}from"react/jsx-runtime";var ks=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=S(),i=o.loginMethodsAndOrder?.primary??[],a=o.loginMethodsAndOrder?.overflow??[],l=[...i,...a],[s,c]=Sf("default"),[u,m]=Sf("email");aC(()=>{let _=l.indexOf("sms"),F=l.indexOf("email");_>-1&&_<F&&m("sms")},[i,a]);let h=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{c("default")},150)};n.current=h;let g=_=>_==="email"?Ue(ds,{isEditable:u==="email",setIsEditable:()=>{m("email")}},_):_==="sms"?Ue(hs,{isEditable:u==="sms",setIsEditable:()=>{m("sms")}},_):_==="apple"?Ue(De,{provider:"apple"},_):_==="discord"?Ue(De,{provider:"discord"},_):_==="farcaster"?Ue(ps,{},_):_==="github"?Ue(De,{provider:"github"},_):_==="google"?Ue(De,{provider:"google"},_):_==="linkedin"?Ue(De,{provider:"linkedin"},_):_==="tiktok"?Ue(De,{provider:"tiktok"},_):_==="twitter"&&(!sC||o?.loginConfig.twitterOAuthOnMobileEnabled)?Ue(De,{provider:"twitter"},_):ri([_],r,e,l),E=i.map(g).flat(),v=a.map(g).flat(),x=[...E,...v],C=cC({primary:E.length,overflow:v.length}),[T,R]=Gd(x,C);return As(vc,{children:[Ue(A,{title:"Log in or sign up",onClose:h,backFn:s==="default"?void 0:()=>{c("default")}}),s==="default"&&Ue(dC,{}),Ue(Wa,{style:{overflow:"hidden",padding:2},children:As(kt,{children:[s==="default"&&As(vc,{children:[...T,R.length>0&&Ue(Ss,{text:"More options",icon:Ue(iC,{}),onClick:()=>c("overflow")})]}),s==="overflow"&&As(vc,{children:[...R]})]})}),o&&Ue(Yo,{app:o}),Ue(V,{protectedByPrivy:!0})]})},_s=5,cC=({primary:e,overflow:t})=>e<_s?e:e===_s&&t===0?_s:_s-1,dC=lC(on)`
|
|
1763
1770
|
margin-bottom: 16px;
|
|
1764
|
-
`;import
|
|
1771
|
+
`;import fC from"@heroicons/react/24/outline/EnvelopeIcon";import hC from"@heroicons/react/24/outline/PhoneIcon";import yC from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as gC,useState as Rf}from"react";import{isMobile as vC}from"react-device-detect";import wC from"styled-components";import{jsx as vi,jsxs as _f}from"react/jsx-runtime";var Af=({...e})=>_f("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[_f("g",{clipPath:"url(#clip0_2856_1743)",children:[vi("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"}),vi("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"})]}),vi("defs",{children:vi("clipPath",{id:"clip0_2856_1743",children:vi("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import pC from"@heroicons/react/24/outline/ChevronRightIcon";import uC from"@heroicons/react/24/outline/WalletIcon";import{jsx as wc,jsxs as mC}from"react/jsx-runtime";var kf=({onClick:e,text:t})=>mC(Pe,{onClick:e,children:[wc(uC,{}),wc(Ma,{children:t}),wc(pC,{})]});import{Fragment as wi,jsx as Ce,jsxs as wn}from"react/jsx-runtime";var Rs=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=S(),{email:i,sms:a,google:l,twitter:s,discord:c,github:u,spotify:m,tiktok:h,linkedin:g,apple:E,wallet:v,farcaster:x}=o?.loginMethods??{},C=o?.appearance.loginGroupPriority||"web2-first",T=o?.appearance.hideDirectWeb2Inputs,[R,I]=Rf("default"),[_,F]=Rf(i?"email":"sms");gC(()=>{F(i?"email":"sms")},[i]);let U=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{I("default")},150)};n.current=U;let B=[i&&Ce(ds,{isEditable:_==="email",setIsEditable:()=>{F("email")}}),a&&Ce(hs,{isEditable:_==="sms",setIsEditable:()=>{F("sms")}})].filter(Boolean),k=[l&&Ce(De,{provider:"google"}),s&&(!vC||o?.loginConfig.twitterOAuthOnMobileEnabled)&&Ce(De,{provider:"twitter"}),c&&Ce(De,{provider:"discord"}),u&&Ce(De,{provider:"github"}),m&&Ce(De,{provider:"spotify"}),h&&Ce(De,{provider:"tiktok"}),g&&Ce(De,{provider:"linkedin"}),E&&Ce(De,{provider:"apple"}),x&&Ce(ps,{})].filter(Boolean),z=ri(o.appearance.walletList,r,e,o.appearance.walletList),L=R==="default"?void 0:()=>{I("default")},j=bC({priority:C,email:i,sms:a,social:k}),ie=EC({priority:C,email:i,sms:a,social:k}),ee=PC({priority:C,email:i,sms:a,social:k}),Q=Ce(kf,{text:ee,onClick:()=>I("web3-overflow")}),$=Ce(Ss,{text:j,icon:ie,onClick:()=>I("web2-overflow")}),be=T?0:1;return wn(wi,{children:[Ce(A,{title:"Log in or sign up",onClose:U,backFn:L}),R==="default"&&Ce(CC,{}),Ce(Wa,{style:{overflow:"hidden",padding:2},children:wn(kt,{children:[R==="default"&&C==="web2-first"&&wn(wi,{children:[...B,...k.length+B.length>4?k.slice(0,3-B.length):k,B.length+k.length>4&&$,v&&Q]}),R==="default"&&C==="web3-first"&&wn(wi,{children:[v&&wn(wi,{children:[...z.length>4?z.slice(0,3):z,z.length>4&&Q]}),B.length+k.length>be&&$,B.length+k.length===be&&B.length?B[0]:null,B.length+k.length===be&&k.length?k[0]:null]}),R==="web2-overflow"&&wn(wi,{children:[...C==="web3-first"?B:[],...k]}),...R==="web3-overflow"?z:[]]})}),o&&Ce(Yo,{app:o}),Ce(V,{protectedByPrivy:!0})]})},CC=wC(on)`
|
|
1765
1772
|
margin-bottom: 16px;
|
|
1766
|
-
`,
|
|
1773
|
+
`,bC=({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",EC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?Ce(yC,{}):t&&r?Ce(Af,{}):t?Ce(fC,{}):r?Ce(hC,{}):null,PC=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import{jsx as If}from"react/jsx-runtime";var Mf=()=>{let{app:e}=S();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?If(ks,{connectOnly:!0}):If(Rs,{connectOnly:!0})};import{jsx as Wf}from"react/jsx-runtime";var Lf=()=>{let{app:e}=S();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?Wf(ks,{connectOnly:!1}):Wf(Rs,{connectOnly:!1})};import TC from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as xC,jsx as Xr,jsxs as SC}from"react/jsx-runtime";var Of=()=>{let{app:e}=S();return SC(xC,{children:[Xr(A,{},"header"),Xr(X,{}),Xr(Te,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Xr(TC,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Xr(Rt,{children:Xr(ls,{stacked:!0})}),Xr(te,{}),Xr(V,{protectedByPrivy:!0})]})};import _C from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as AC,jsx as eo,jsxs as kC}from"react/jsx-runtime";var Nf=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=S(),{initLoginWithSms:i}=W();async function a({qualifiedPhoneNumber:l}){try{await i(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return kC(AC,{children:[eo(A,{},"header"),eo(X,{}),eo(Te,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:eo(_C,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),eo(Rt,{children:eo(vn,{stacked:!0,onSubmit:a})}),eo(te,{}),eo(V,{protectedByPrivy:!0})]})};import{Fragment as RC,jsx as Ci,jsxs as IC}from"react/jsx-runtime";var Df=()=>{let{linkingHint:e}=W(),{app:t}=S(),r=e?`Select the wallet with ${Ur(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return IC(RC,{children:[Ci(A,{},"header"),Ci(lr,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),Ci(kt,{children:Ci(rn,{connectOnly:!1})}),Ci(V,{protectedByPrivy:!0})]})};import{jsx as Uf,jsxs as MC}from"react/jsx-runtime";var Ff=({style:e,...t})=>MC("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:[Uf("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Uf("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 WC,jsx as to,jsxs as Bf}from"react/jsx-runtime";var Hf=()=>{let{closePrivyModal:e}=W(),{navigate:t}=S();return Bf(WC,{children:[to(A,{},"header"),to(X,{}),to(Ff,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),to(lr,{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"}}),Bf(Rt,{children:[to(D,{onClick:()=>t("LANDING"),children:"Try again"}),to(Gt,{onClick:()=>e(),children:"Cancel"})]}),to(te,{}),to(V,{protectedByPrivy:!0})]})};import Jf from"@heroicons/react/20/solid/CheckIcon";import e3 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import t3 from"@heroicons/react/24/outline/FingerPrintIcon";import r3 from"@heroicons/react/24/outline/PhoneIcon";import Zf from"@heroicons/react/24/outline/TrashIcon";import o3 from"@heroicons/react/24/solid/CheckBadgeIcon";import Qf from"@heroicons/react/24/solid/CheckCircleIcon";import Xf from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import n3 from"@heroicons/react/24/solid/IdentificationIcon";import xc from"@heroicons/react/24/solid/PhoneIcon";import Tc from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as eh,useState as Ir}from"react";import{useState as Ec}from"react";import{isMobile as FC}from"react-device-detect";import qf from"styled-components";import{Dialog as Gf,Transition as Cc}from"@headlessui/react";import bc from"react";import bn from"styled-components";import{jsx as Cn,jsxs as UC}from"react/jsx-runtime";var Vf=({children:e,open:t,onClick:r,...o})=>Cn(Cc,{show:t,as:bc.Fragment,children:UC(Gf,{onClose:r,...o,as:OC,children:[Cn(Cc.Child,{as:bc.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Cn(LC,{"aria-hidden":"true"})}),Cn(NC,{children:Cn(Cc.Child,{as:bc.Fragment,enterFrom:"entering",leaveTo:"leaving",children:Cn(Gf.Panel,{as:DC,children:e})})})]})}),En=bn.div`
|
|
1767
1774
|
display: flex;
|
|
1768
1775
|
flex-direction: column;
|
|
1769
1776
|
text-align: center;
|
|
@@ -1786,7 +1793,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1786
1793
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1787
1794
|
border-radius: var(--privy-border-radius-lg);
|
|
1788
1795
|
}
|
|
1789
|
-
`,
|
|
1796
|
+
`,LC=bn.div`
|
|
1790
1797
|
position: fixed;
|
|
1791
1798
|
inset: 0;
|
|
1792
1799
|
|
|
@@ -1799,10 +1806,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1799
1806
|
backdrop-filter: unset;
|
|
1800
1807
|
-webkit-backdrop-filter: unset;
|
|
1801
1808
|
}
|
|
1802
|
-
`,
|
|
1809
|
+
`,OC=bn.div`
|
|
1803
1810
|
position: relative;
|
|
1804
1811
|
z-index: 999999;
|
|
1805
|
-
`,
|
|
1812
|
+
`,NC=bn.div`
|
|
1806
1813
|
position: fixed;
|
|
1807
1814
|
inset: 0;
|
|
1808
1815
|
display: flex;
|
|
@@ -1810,7 +1817,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1810
1817
|
justify-content: center;
|
|
1811
1818
|
width: 100vw;
|
|
1812
1819
|
min-height: 100vh;
|
|
1813
|
-
`,
|
|
1820
|
+
`,DC=bn.div`
|
|
1814
1821
|
// reset some default dialog styles
|
|
1815
1822
|
padding: 0;
|
|
1816
1823
|
background: transparent;
|
|
@@ -1857,19 +1864,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1857
1864
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1858
1865
|
border-radius: var(--privy-border-radius-lg);
|
|
1859
1866
|
}
|
|
1860
|
-
`,
|
|
1867
|
+
`,zf=bn.div`
|
|
1861
1868
|
display: flex;
|
|
1862
1869
|
flex-direction: column;
|
|
1863
1870
|
align-items: center;
|
|
1864
1871
|
justify-content: center;
|
|
1865
1872
|
height: 100%;
|
|
1866
|
-
`;import{Fragment as
|
|
1873
|
+
`;import{Fragment as qC,jsx as bi,jsxs as $C}from"react/jsx-runtime";var Ei=6,BC=new Array(Ei).fill("");function HC(e){return e.replace(/\s+/g,"")}function Pc(e){return/^[0-9]{1}$/.test(e)}function $f(e){return e.length===Ei&&e.every(Pc)}function GC(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var Pn=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=Ec(BC),[a,l]=Ec(null),[s,c]=Ec(null),u=async E=>{E.preventDefault();let v=HC(E.currentTarget.value);if(v==="")return;let x=GC(n,Pc),C=v.split(""),T=!C.every(Pc),R=C.length+x>Ei;if(T){l("Passcode can only be numbers"),c(1);return}if(R){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let I=Number(E.currentTarget.name?.charAt(4)),_=[...v||[""]].slice(0,Ei-I),F=[...n.slice(0,I),..._,...n.slice(I+_.length)];i(F);let U=_.length,B=Math.min(Math.max(I+U,0),Ei-1);if(document.querySelector(`input[name=pin-${B}]`)?.focus(),$f(F))try{await e(F.join("")),document.querySelector(`input[name=pin-${B}]`)?.blur()}catch(z){c(1),l(z.message)}else try{await e(null)}catch(z){c(1),l(z.message)}},m=E=>{s===1&&(l(null),c(null));let v=[...n.slice(0,E),"",...n.slice(E+1)];i(v),E>0&&document.querySelector(`input[name=pin-${E-1}]`)?.focus(),$f(v)?e(v.join("")):e(null)},g=o?"success":!!(r||a)?"fail":"";return bi(qC,{children:$C(VC,{children:[bi("div",{children:n.map((E,v)=>bi("input",{name:`pin-${v}`,type:"text",value:n[v],onChange:u,onKeyUp:x=>{x.key==="Backspace"&&m(v)},inputMode:"numeric",autoFocus:v===0,pattern:"[0-9]",className:g,autoComplete:FC?"one-time-code":"off",disabled:t},v))}),bi("div",{children:bi(zC,{fail:!!r||!!a,children:r||a})})]})})},VC=qf.div`
|
|
1867
1874
|
display: flex;
|
|
1868
1875
|
flex-direction: column;
|
|
1869
1876
|
width: 100%;
|
|
1870
1877
|
gap: 8px;
|
|
1871
1878
|
|
|
1872
|
-
${
|
|
1879
|
+
${En}[data-height='medium'] & {
|
|
1873
1880
|
margin-top: 22px;
|
|
1874
1881
|
}
|
|
1875
1882
|
|
|
@@ -1934,7 +1941,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1934
1941
|
transform: translate(1px, 0px);
|
|
1935
1942
|
}
|
|
1936
1943
|
}
|
|
1937
|
-
`,
|
|
1944
|
+
`,zC=qf.div`
|
|
1938
1945
|
line-height: 20px;
|
|
1939
1946
|
font-size: 13px;
|
|
1940
1947
|
display: flex;
|
|
@@ -1942,7 +1949,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1942
1949
|
width: 100%;
|
|
1943
1950
|
|
|
1944
1951
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1945
|
-
`;import{useContext as
|
|
1952
|
+
`;import{useContext as jC}from"react";function Tn(){let{promptMfa:e,init:t,submit:r,cancel:o}=jC(ae);return{promptMfa:e,init:t,submit:r,cancel:o}}import{useContext as KC}from"react";function Pi(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenroll:n,enrollInMfa:i}=KC(ae);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:r,submitEnrollmentWithTotp:o,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>i(!0),closeMfaEnrollmentModal:()=>i(!1)}}import YC from"styled-components";import{jsx as jf,jsxs as ZC}from"react/jsx-runtime";var Kf=e=>ZC(JC,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[jf("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),jf("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"})]}),JC=YC.svg`
|
|
1946
1953
|
height: 90px;
|
|
1947
1954
|
width: 90px;
|
|
1948
1955
|
|
|
@@ -1953,7 +1960,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1953
1960
|
> path {
|
|
1954
1961
|
fill: white;
|
|
1955
1962
|
}
|
|
1956
|
-
`;import
|
|
1963
|
+
`;import QC from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as XC}from"react/jsx-runtime";var Yf=({size:e,authUrl:t})=>XC(rs,{url:t,squareLogoElement:QC,size:e,fgColor:"#1F1F1F"});import{Fragment as Wt,jsx as w,jsxs as re}from"react/jsx-runtime";var th=()=>{let{user:e,enrollInMfa:t}=H(),[r,o]=Ir(null),{unenrollWithSms:n,unenrollWithTotp:i}=Pi(),{app:a,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=S(),{closePrivyModal:u}=W(),{promptMfa:m}=Tn(),[h,g]=Ir(s?.mfaEnrollmentFlow?.seenIntro||!1),[E,v]=Ir(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),x=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),v(null)},500)};c.current=x;let C=e?.mfaMethods.includes("sms"),T=!!e?.phone,R=e?.mfaMethods.includes("totp"),I=C||R;eh(()=>{I&&g(!0)},[I]);function _(){o(null),v(null)}function F(){g(!1)}async function U(L){await m(),v(L)}if(!l||!e||!a)return re(Wt,{children:[w(A,{onClose:x},"header"),w(ze,{children:w(Kf,{})}),w(Vr,{children:w(St,{})}),w(oe,{})]});async function B(){o(null);try{await n()}catch{o(null)}}async function k(){o(null);try{await i()}catch{o(null)}}if(r==="sms")return re(Wt,{children:[w(A,{backFn:_,onClose:x},"header"),w(ze,{children:w(tt,{children:w(xc,{})})}),w(we,{children:"Remove SMS verification?"}),re(fe,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),w(zr,{children:w(D,{warn:!0,onClick:B,children:"Remove SMS for MFA"})}),w(oe,{})]});if(r==="totp")return re(Wt,{children:[w(A,{backFn:_,onClose:x},"header"),w(ze,{children:w(tt,{children:w(Xf,{})})}),w(we,{children:"Remove Authenticator App verification?"}),re(fe,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),w(zr,{children:w(D,{warn:!0,onClick:k,children:"Remove Authenticator App for MFA"})}),w(oe,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!I)return re(Wt,{children:[w(A,{onClose:x},"header"),w(ze,{children:w(tt,{children:w(Tc,{})})}),w(we,{children:"Add more security"}),re(fe,{children:[a?.name," does not have any verification methods enabled."]}),w(zr,{children:w(D,{onClick:x,children:"Close"})}),w(oe,{})]});let z=!I&&!h;if(z)return re(Wt,{children:[w(A,{onClose:x},"header"),w(ze,{children:w(tt,{children:w(Tc,{})})}),w(we,{children:"Transaction Protection"}),w(fe,{children:"Set up transaction protection to add an extra layer of security to your account"}),re(au,{children:[re(Rl,{children:[w(kl,{children:w(o3,{})}),"Enable 2-Step verification for your ",a?.name," wallet."]}),re(Rl,{children:[w(kl,{children:w(n3,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),re(zr,{children:[w(D,{onClick:()=>g(!0),children:"Continue"}),w(Gt,{onClick:x,children:"Not now"})]}),w(oe,{})]});switch(E){case"sms":return w(i3,{onComplete:x,onReset:_,onClose:x});case"totp":return w(a3,{onComplete:x,onClose:x,onReset:_});default:return re(Wt,{children:[w(A,{backFn:z?F:void 0,onClose:x},"header"),w(ze,{children:w(tt,{children:w(Tc,{})})}),w(we,{children:"Choose a verification method"}),I?w(fe,{children:"To add or delete verification methods, verification is required."}):w(fe,{children:"How would you like to verify your identity? You can change this later."}),re(La,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||R)&&re(Oa,{children:[w(Pe,{disabled:R,onClick:()=>U("totp"),children:re(Da,{children:[re(Na,{children:[w(e3,{}),"Authenticator App"]}),R?re(Zo,{children:[w(Jf,{}),"Added"]}):w(Zo,{children:"Recommended"})]})}),R&&w(Il,{id:"remove",onClick:()=>o("totp"),children:w(Zf,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||C)&&re(Oa,{children:[w(Pe,{disabled:C||T,onClick:()=>U("sms"),children:re(Da,{children:[re(Na,{children:[w(r3,{}),"SMS"]}),C&&re(Zo,{children:[w(Jf,{}),"Added"]}),T&&w(Zo,{children:"Disabled"})]})}),C&&w(Il,{id:"remove",onClick:()=>o("sms"),children:w(Zf,{})})]},"sms"),w(Oa,{children:w(Pe,{disabled:!0,children:re(Da,{children:[re(Na,{children:[w(t3,{}),"Passkey"]}),w(Zo,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),w(oe,{})]})}},i3=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=Ir(""),[i,a]=Ir(!1),[l,s]=Ir("enroll"),{initEnrollmentWithSms:c,submitEnrollmentWithSms:u}=Pi(),{app:m,data:h,currentScreen:g,navigate:E,setModalData:v}=S();function x(){h?.mfaEnrollmentFlow?.onSuccess(),e()}async function C({qualifiedPhoneNumber:I}){try{await c({phoneNumber:I}),n(I),s("verify")}catch(_){v({mfaEnrollmentFlow:h?.mfaEnrollmentFlow?{...h?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:_,previousScreen:g||"MFA_ENROLLMENT_FLOW_SCREEN"}}),E("ERROR_SCREEN")}}async function T(I){try{if(!I)return;await u({phoneNumber:o,mfaCode:I}),a(!0)}catch(_){throw Kl(_)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):cn(_)?new Error("The code you entered is not valid"):ln(_)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Yl(_)?new Error("Verification canceled"):new Error("Unknown error")}}function R(){l==="verify"?s("enroll"):t()}return l==="enroll"?re(Wt,{children:[w(A,{backFn:t,onClose:r},"header"),w(ze,{children:w(tt,{children:w(xc,{})})}),w(we,{children:"Set up SMS verification"}),w(fe,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),re(Vr,{children:[w(vn,{onSubmit:C}),re(su,{children:["By providing your mobile number, you agree to receive text messages from ",m?.name,". Some carrier charges may apply"]})]}),w(oe,{})]}):i?re(Wt,{children:[w(A,{onClose:x},"header"),w(ze,{children:w(tt,{status:"success",children:w(Qf,{})})}),w(we,{children:"SMS verification added"}),w(fe,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),w(zr,{children:w(D,{onClick:x,children:"Done"})}),w(oe,{})]}):re(Wt,{children:[w(A,{backFn:R,onClose:r},"header"),w(ze,{children:w(tt,{children:w(xc,{})})}),w(we,{children:"Enter enrollment code"}),re(Vr,{children:[w(Pn,{onChange:T}),re(fe,{children:["To continue, enter the 6-digit code sent to ",w("strong",{children:ff(o)})]})]}),w(oe,{})]})},a3=({onComplete:e,onClose:t,onReset:r})=>{let[o,n]=Ir("enroll"),[i,a]=Ir(null),[l,s]=Ir(!1),{initEnrollmentWithTotp:c,submitEnrollmentWithTotp:u}=Pi(),{data:m}=S();eh(()=>{a(null),c().then(x=>{a(x)}).catch(()=>{a(null),r()})},[]);function h(){m?.mfaEnrollmentFlow?.onSuccess(),e()}function g(){n("verify")}async function E(x){try{if(!x)return;await u({mfaCode:x}),s(!0)}catch(C){throw Kl(C)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):cn(C)?new Error("The code you entered is not valid"):ln(C)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Yl(C)?new Error("Verification canceled"):new Error("Unknown error")}}function v(){o==="verify"?n("enroll"):r()}return o==="enroll"?re(Wt,{children:[w(A,{backFn:r,onClose:t},"header"),w(we,{children:"Scan QR code"}),w(fe,{children:"Open your authenticator app and scan the QR code to continue."}),w(Ha,{children:i?.authUrl?w(Yf,{authUrl:i.authUrl,size:200}):w(St,{})}),re(zr,{children:[w(It,{children:i?.secret&&w(yn,{itemName:"secret",text:i.secret})}),w(D,{onClick:g,children:"Continue"})]}),w(oe,{})]}):l?re(Wt,{children:[w(A,{onClose:h},"header"),w(ze,{children:w(tt,{status:"success",children:w(Qf,{})})}),w(we,{children:"Authenticator app verification added"}),w(fe,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),w(zr,{children:w(D,{onClick:h,children:"Done"})}),w(oe,{})]}):re(Wt,{children:[w(A,{backFn:v,onClose:t},"header"),w(ze,{children:w(tt,{children:w(Xf,{})})}),w(we,{children:"Enter enrollment code"}),w(Vr,{children:w(Pn,{onChange:E})}),re(fe,{children:["To continue, enter the 6-digit code generated from your ",w("strong",{children:"authenticator app"})]}),w(oe,{})]})};import ob from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import nb from"@heroicons/react/24/outline/PhoneIcon";import ib from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import ab from"@heroicons/react/24/solid/PhoneIcon";import sb from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as lb,useState as Gc}from"react";import{useMemo as X3,useEffect as eb,useState as Hh}from"react";import tb from"styled-components";import Ph from"styled-components";import oh from"styled-components";import{jsx as rh,jsxs as c3}from"react/jsx-runtime";var Is=({label:e,children:t,valueStyles:r})=>c3(s3,{children:[rh("div",{children:e}),rh(l3,{style:{...r},children:t})]}),s3=oh.div`
|
|
1957
1964
|
display: flex;
|
|
1958
1965
|
align-items: center;
|
|
1959
1966
|
justify-content: space-between;
|
|
@@ -1968,7 +1975,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1968
1975
|
color: var(--privy-color-foreground-2);
|
|
1969
1976
|
text-align: right;
|
|
1970
1977
|
}
|
|
1971
|
-
`,
|
|
1978
|
+
`,l3=oh.div`
|
|
1972
1979
|
font-size: 14px;
|
|
1973
1980
|
line-height: 100%;
|
|
1974
1981
|
display: flex;
|
|
@@ -1977,28 +1984,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1977
1984
|
border-radius: var(--privy-border-radius-full);
|
|
1978
1985
|
background-color: var(--privy-color-background-2);
|
|
1979
1986
|
padding: 4px 8px;
|
|
1980
|
-
`;import
|
|
1987
|
+
`;import Ws from"styled-components";import{BigNumber as nh}from"@ethersproject/bignumber";import{formatEther as ih}from"@ethersproject/units";var Ti=(e,t)=>{let r=(t*parseFloat(ih(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},mr=(e,t,r=6,o=!1)=>{let i=parseFloat(ih(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Sc=e=>e.map(je).reduce((t,r)=>t.add(r),nh.from(0)).toHexString(),ah=(e,t)=>{let{chains:r}=W(),o=`https://etherscan.io/address/${t}`,n=`${Kd(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},je=e=>nh.from(e);import{Fragment as m3,jsx as Ms,jsxs as sh}from"react/jsx-runtime";var lh=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Sc(e),n=t?Ti(o,t):void 0,i=mr(o,r);return Ms(ch,{children:n||i})},_c=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=Sc(e),n=t?Ti(o,t):void 0,i=mr(o,r);return Ms(ch,{children:n?sh(m3,{children:[Ms(d3,{children:"USD"}),n==="<$0.01"?sh(u3,{children:[Ms(p3,{children:"<"}),"$0.01"]}):n]}):i})},ch=Ws.span`
|
|
1981
1988
|
font-size: 14px;
|
|
1982
1989
|
line-height: 140%;
|
|
1983
1990
|
display: flex;
|
|
1984
1991
|
gap: 4px;
|
|
1985
1992
|
align-items: center;
|
|
1986
|
-
`,
|
|
1993
|
+
`,d3=Ws.span`
|
|
1987
1994
|
font-size: 12px;
|
|
1988
1995
|
line-height: 12px;
|
|
1989
1996
|
color: var(--privy-color-foreground-3);
|
|
1990
|
-
`,
|
|
1997
|
+
`,p3=Ws.span`
|
|
1991
1998
|
font-size: 10px;
|
|
1992
|
-
`,
|
|
1999
|
+
`,u3=Ws.span`
|
|
1993
2000
|
display: flex;
|
|
1994
2001
|
align-items: center;
|
|
1995
|
-
`;import
|
|
2002
|
+
`;import Ac from"styled-components";import{jsx as ro,jsxs as Ls}from"react/jsx-runtime";var dh=({gas:e,tokenPrice:t,tokenSymbol:r})=>Ls(Ol,{style:{paddingBottom:"12px"},children:[Ls(uh,{children:[ro(fh,{children:"Est. Fees"}),ro("div",{children:ro(_c,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&ro(mh,{children:`${mr(e,r)}`})]}),ph=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=je(e.value||0).add(je(t)).toHexString();return Ls(Ol,{children:[Ls(uh,{children:[ro(fh,{children:"Total (including fees)"}),ro("div",{children:ro(_c,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&ro(mh,{children:mr(n,o)})]})},uh=Ac.div`
|
|
1996
2003
|
display: flex;
|
|
1997
2004
|
flex-direction: row;
|
|
1998
2005
|
justify-content: space-between;
|
|
1999
2006
|
align-items: center;
|
|
2000
2007
|
padding-top: 4px;
|
|
2001
|
-
`,
|
|
2008
|
+
`,mh=Ac.div`
|
|
2002
2009
|
display: flex;
|
|
2003
2010
|
flex-direction: row;
|
|
2004
2011
|
height: 12px;
|
|
@@ -2007,23 +2014,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2007
2014
|
line-height: 12px;
|
|
2008
2015
|
color: var(--privy-color-foreground-3);
|
|
2009
2016
|
font-weight: 400;
|
|
2010
|
-
`,
|
|
2017
|
+
`,fh=Ac.div`
|
|
2011
2018
|
font-size: 14px;
|
|
2012
2019
|
line-height: 22.4px;
|
|
2013
2020
|
font-weight: 400;
|
|
2014
|
-
`;import
|
|
2021
|
+
`;import f3 from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Ao,useState as h3}from"react";import oo from"styled-components";import{createContext as hh,useContext as WN}from"react";var xn=hh(void 0);var xi=hh(void 0);import{Fragment as P3,jsx as Yt,jsxs as yh}from"react/jsx-runtime";var gh=({defaultValue:e,children:t})=>{let[r,o]=h3(e||null),n=i=>{o(r===i?null:i)};return Yt(xn.Provider,{value:{activePanel:r,togglePanel:n},children:Yt(y3,{children:t})})},vh=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=Ao(xn),n=r===e;return Yt(xi.Provider,{value:{onToggle:()=>o(e),value:e},children:Yt(C3,{isActive:n,"data-open":n,children:t})})},wh=({children:e})=>{let{activePanel:t}=Ao(xn),{onToggle:r,value:o}=Ao(xi),n=t===o;return yh(P3,{children:[yh(g3,{onClick:r,"data-open":n,children:[Yt(w3,{children:e}),Yt(E3,{isactive:n,children:Yt(f3,{height:"16px",width:"16px",strokeWidth:"2"})})]}),Yt(v3,{})]})},Ch=({children:e})=>{let{activePanel:t}=Ao(xn),{value:r}=Ao(xi);return Yt(b3,{"data-open":t===r,children:Yt(Eh,{children:e})})},bh=({children:e})=>{let{activePanel:t}=Ao(xn),{value:r}=Ao(xi);return Yt(Eh,{children:typeof e=="function"?e({isActive:t===r}):e})},y3=oo.div`
|
|
2015
2022
|
display: flex;
|
|
2016
2023
|
flex-direction: column;
|
|
2017
2024
|
width: 100%;
|
|
2018
2025
|
gap: 8px;
|
|
2019
|
-
`,
|
|
2026
|
+
`,g3=oo.div`
|
|
2020
2027
|
display: flex;
|
|
2021
2028
|
justify-content: space-between;
|
|
2022
2029
|
align-items: center;
|
|
2023
2030
|
width: 100%;
|
|
2024
2031
|
cursor: pointer;
|
|
2025
2032
|
padding-bottom: 8px;
|
|
2026
|
-
`,
|
|
2033
|
+
`,v3=oo.div`
|
|
2027
2034
|
width: 100%;
|
|
2028
2035
|
|
|
2029
2036
|
&& {
|
|
@@ -2031,13 +2038,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2031
2038
|
border-color: var(--privy-color-foreground-4);
|
|
2032
2039
|
}
|
|
2033
2040
|
padding-bottom: 12px;
|
|
2034
|
-
`,
|
|
2041
|
+
`,w3=oo.div`
|
|
2035
2042
|
font-size: 14px;
|
|
2036
2043
|
font-weight: 500;
|
|
2037
2044
|
line-height: 19.6px;
|
|
2038
2045
|
width: 100%;
|
|
2039
2046
|
padding-right: 8px;
|
|
2040
|
-
`,
|
|
2047
|
+
`,C3=oo.div`
|
|
2041
2048
|
display: flex;
|
|
2042
2049
|
flex-direction: column;
|
|
2043
2050
|
width: 100%;
|
|
@@ -2049,7 +2056,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2049
2056
|
border-color: var(--privy-color-foreground-4);
|
|
2050
2057
|
border-radius: var(--privy-border-radius-md);
|
|
2051
2058
|
}
|
|
2052
|
-
`,
|
|
2059
|
+
`,b3=oo.div`
|
|
2053
2060
|
position: relative;
|
|
2054
2061
|
overflow: hidden;
|
|
2055
2062
|
transition: max-height 25ms ease-out;
|
|
@@ -2061,38 +2068,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2061
2068
|
&[data-open='false'] {
|
|
2062
2069
|
max-height: 0;
|
|
2063
2070
|
}
|
|
2064
|
-
`,
|
|
2071
|
+
`,Eh=oo.div`
|
|
2065
2072
|
display: flex;
|
|
2066
2073
|
flex-direction: column;
|
|
2067
2074
|
gap: 12px;
|
|
2068
2075
|
flex: 1 1 auto;
|
|
2069
2076
|
min-height: 1px;
|
|
2070
|
-
`,
|
|
2077
|
+
`,E3=oo.div`
|
|
2071
2078
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
2072
|
-
`;import
|
|
2079
|
+
`;import T3 from"styled-components";import{jsx as S3}from"react/jsx-runtime";var kc=({walletAddress:e,chainId:t=Er})=>S3(x3,{href:ah(t,e),target:"_blank",children:Ur(e)}),x3=T3.a`
|
|
2073
2080
|
&:hover {
|
|
2074
2081
|
text-decoration: underline;
|
|
2075
2082
|
}
|
|
2076
|
-
`;import{jsx as
|
|
2083
|
+
`;import{jsx as bt,jsxs as Rc}from"react/jsx-runtime";var Sn=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0;return bt(gh,{children:Rc(vh,{value:"details",children:[bt(wh,{children:Rc(_3,{children:[bt("div",{children:o?.title||o?.actionDescription||"Details"}),bt(A3,{children:bt(lh,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),Rc(Ch,{children:[bt(Is,{label:"From",children:bt(kc,{walletAddress:e,chainId:r.chainId||Er})}),bt(Is,{label:"To",children:bt(kc,{walletAddress:t,chainId:r.chainId||Er})}),o&&o.action&&bt(Is,{label:"Action",children:o.action}),i&&bt(dh,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),bt(bh,{children:({isActive:s})=>bt(ph,{transactionData:r,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},_3=Ph.div`
|
|
2077
2084
|
display: flex;
|
|
2078
2085
|
flex-direction: row;
|
|
2079
2086
|
justify-content: space-between;
|
|
2080
|
-
`,
|
|
2087
|
+
`,A3=Ph.div`
|
|
2081
2088
|
flex-shrink: 0;
|
|
2082
2089
|
padding-left: 8px;
|
|
2083
|
-
`;import _i from"styled-components";import{jsx as Si,jsxs as
|
|
2090
|
+
`;import _i from"styled-components";import{jsx as Si,jsxs as L3}from"react/jsx-runtime";var Ic=({description:e,contractInfo:t})=>L3(k3,{children:[t.imgUrl&&Si(R3,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&Si(I3,{children:Si("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&Si(M3,{children:t.name}),Si(W3,{children:e||t.actionText})]}),k3=_i.div`
|
|
2084
2091
|
display: flex;
|
|
2085
2092
|
flex-direction: column;
|
|
2086
2093
|
align-items: center;
|
|
2087
2094
|
margin-bottom: 8px;
|
|
2088
|
-
`,
|
|
2095
|
+
`,R3=_i.img`
|
|
2089
2096
|
&& {
|
|
2090
2097
|
height: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2091
2098
|
width: ${e=>e.size==="sm"?"65px":"140px"};
|
|
2092
2099
|
border-radius: 16px;
|
|
2093
2100
|
margin-bottom: 12px;
|
|
2094
2101
|
}
|
|
2095
|
-
`,
|
|
2102
|
+
`,I3=_i.div`
|
|
2096
2103
|
font-size: 12px;
|
|
2097
2104
|
line-height: 12px;
|
|
2098
2105
|
padding: 7px;
|
|
@@ -2105,7 +2112,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2105
2112
|
text-decoration: underline;
|
|
2106
2113
|
}
|
|
2107
2114
|
}
|
|
2108
|
-
`,
|
|
2115
|
+
`,M3=_i.div`
|
|
2109
2116
|
font-size: 18px;
|
|
2110
2117
|
line-height: 18px;
|
|
2111
2118
|
font-weight: 500;
|
|
@@ -2113,7 +2120,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2113
2120
|
white-space: nowrap;
|
|
2114
2121
|
max-width: 275px;
|
|
2115
2122
|
text-overflow: ellipsis;
|
|
2116
|
-
`,
|
|
2123
|
+
`,W3=_i.div`
|
|
2117
2124
|
font-size: 16px;
|
|
2118
2125
|
line-height: 140%;
|
|
2119
2126
|
font-weight: 400;
|
|
@@ -2121,7 +2128,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2121
2128
|
overflow: hidden;
|
|
2122
2129
|
max-width: 275px;
|
|
2123
2130
|
text-overflow: ellipsis;
|
|
2124
|
-
`;import
|
|
2131
|
+
`;import O3 from"@heroicons/react/24/outline/WalletIcon";import Wc from"styled-components";import{jsx as Th,jsxs as Mc}from"react/jsx-runtime";var xh=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:i}=W(),a=i(t.chainId)||"ETH";return Mc(N3,{children:[Mc(D3,{children:[Th(O3,{strokeWidth:"2",width:"16px",height:"16px"}),Th("div",{children:Ur(e)})]}),Mc(U3,{displayBalanceColor:n,hasFunds:o,children:[r?mr(r,a,6,!0):0," available"]})]})},N3=Wc.div`
|
|
2125
2132
|
display: flex;
|
|
2126
2133
|
flex-direction: row;
|
|
2127
2134
|
justify-content: space-between;
|
|
@@ -2134,12 +2141,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2134
2141
|
border: 1px solid var(--privy-color-foreground-4);
|
|
2135
2142
|
border-radius: var(--privy-border-radius-md);
|
|
2136
2143
|
}
|
|
2137
|
-
`,
|
|
2144
|
+
`,D3=Wc.div`
|
|
2138
2145
|
display: flex;
|
|
2139
2146
|
flex-direction: row;
|
|
2140
2147
|
align-items: center;
|
|
2141
2148
|
gap: 8px;
|
|
2142
|
-
`,
|
|
2149
|
+
`,U3=Wc.div`
|
|
2143
2150
|
display: flex;
|
|
2144
2151
|
align-items: center;
|
|
2145
2152
|
justify-content: center;
|
|
@@ -2149,35 +2156,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2149
2156
|
background-color: var(--privy-color-background-2);
|
|
2150
2157
|
padding: 5px 8px;
|
|
2151
2158
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
2152
|
-
`;import
|
|
2159
|
+
`;import Os from"styled-components";import{Fragment as _h,jsx as Ai,jsxs as Ah}from"react/jsx-runtime";var kh=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?Ti(n,o):void 0,a=mr(n,r);return Ah(F3,{children:[i?Ah(_h,{children:[Ai(Sh,{children:i}),Ai(B3,{children:a})]}):Ai(_h,{children:Ai(Sh,{children:a})}),Ai(H3,{children:e})]})},F3=Os.div`
|
|
2153
2160
|
display: flex;
|
|
2154
2161
|
flex-direction: column;
|
|
2155
2162
|
align-items: center;
|
|
2156
2163
|
margin-bottom: 20px;
|
|
2157
|
-
`,
|
|
2164
|
+
`,Sh=Os.h2`
|
|
2158
2165
|
&& {
|
|
2159
2166
|
font-size: 48px;
|
|
2160
2167
|
line-height: 48px;
|
|
2161
2168
|
margin: 8px auto;
|
|
2162
2169
|
}
|
|
2163
|
-
`,
|
|
2170
|
+
`,B3=Os.p`
|
|
2164
2171
|
margin-bottom: 12px;
|
|
2165
2172
|
&& {
|
|
2166
2173
|
font-size: 17px;
|
|
2167
2174
|
line-height: 17px;
|
|
2168
2175
|
color: var(--privy-color-foreground-3);
|
|
2169
2176
|
}
|
|
2170
|
-
`,
|
|
2177
|
+
`,H3=Os.div`
|
|
2171
2178
|
font-size: 16px;
|
|
2172
2179
|
line-height: 22.4px;
|
|
2173
2180
|
font-weight: 400;
|
|
2174
2181
|
overflow: hidden;
|
|
2175
2182
|
max-width: 275px;
|
|
2176
2183
|
text-overflow: ellipsis;
|
|
2177
|
-
`;import{VoidSigner as
|
|
2184
|
+
`;import{VoidSigner as j3}from"@ethersproject/abstract-signer";import{EtherscanProvider as ZD}from"@ethersproject/providers";import{BigNumber as Wh}from"@ethersproject/bignumber";import{BigNumber as _n}from"@ethersproject/bignumber";import{Contract as G3}from"@ethersproject/contracts";import{serialize as V3}from"@ethersproject/transactions";var An=e=>[fa.id,ha.id,ya.id,ga.id,va.id,wa.id,Ca.id,Ea.id,ba.id].includes(e),Rh=async(e,t)=>{if(!An(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(e.type===void 0&&(e.type=2),!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 i=_n.from(r).mul(_n.from(126)).div(_n.from(100)).add(_n.from(e.maxPriorityFeePerGas));e.maxFeePerGas=ki(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function Ih(e,t){if(!e.chainId||e.chainId&&!An(e.chainId))return _n.from(0);let r=_n.from(0);try{let o=new G3(Bd,Hd,t),n=Mh(e),i=V3(n);r=await o.getL1Fee(i)}catch{}return r}async function Lh(e,t){try{let o={...e,from:void 0};return(await t.estimateGas(o)).toHexString()}catch{}return(await t.estimateGas(e)).toHexString()}var Oh=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function kn(e,t){if(!e.gasLimit)throw new Ee("gasLimit was not successfully set for transaction.");let r=je(e.gasLimit),o=Wh.from(0);if(e.type==2)if(e.maxFeePerGas)o=je(e.maxFeePerGas);else throw new Ee("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=je(e.gasPrice);else throw new Ee("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=Wh.from(0);if(e.chainId&&An(e.chainId))try{i=await Ih(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}import{BigNumber as Lc}from"@ethersproject/bignumber";var Oc=e=>[pa.id,ua.id,ma.id].includes(e),Nh=async(e,t)=>{if(!Oc(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.maxFeePerGas)return e;e.type===void 0&&(e.type=2);try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(Lc.from(120)).div(Lc.from(100));e.maxFeePerGas=ki(o),e.maxPriorityFeePerGas=ki(Lc.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Nc=e=>[56,97].includes(e),Dh=async(e,t)=>{if(!Nc(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 Uh}from"@ethersproject/units";import{ofetch as z3}from"ofetch";var Uc=e=>[zn.id,$n.id].includes(e),Dc=e=>({maxPriorityFee:Uh(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:Uh(e.maxFee.toFixed(9),"gwei").toHexString()}),$3=e=>({safeLow:Dc(e.safeLow),standard:Dc(e.standard),fast:Dc(e.fast)}),q3=async e=>{let t="";switch(e){case zn.id:t="https://gasstation.polygon.technology/v2";break;case $n.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return $3(await z3(t))};async function Fh(e){if(!Uc(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;e.type===void 0&&(e.type=2);try{let{standard:t}=await q3(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 ki(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 Mh(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=je(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=je(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=je(e.gasPrice)),e.value!==void 0&&(t.value=je(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=je(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=je(e.maxPriorityFeePerGas)),t}async function Rn(e,t,r){if(t.chainId=Number(t.chainId),Bh(t),!t.nonce){let o=new j3(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await Lh(t,r)),t.from||(t.from=e),Uc(t.chainId)?t=await Fh(t):Oc(t.chainId)?t=await Nh(t,r):An(t.chainId)?t=await Rh(t,r):Nc(t.chainId)?t=await Dh(t,r):t=await Oh(t,r),t}async function Ns(e,t,r,o,n){o=Object.assign({chainId:Er},o),Bh(o);let a=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(a)}async function Ds(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(je(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function Bh(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!K3(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 K3(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&Y3(e);return t||r||o}function Y3(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Us(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 Fc,useEffect as J3}from"react";var Fs=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=W(),[n,i]=Fc(!0),[a,l]=Fc(void 0),[s,c]=Fc(void 0);return J3(()=>{let u=e.chainId||Er,m=o.find(g=>g.id===Number(u));if(!m)throw new Y(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let g=await r(m);g?c(g):l(new Error(`Unable to fetch token price on chain id ${m.id}`))}catch(g){l(g)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as Z3,useContext as Q3}from"react";var Bc=Z3(null);function Ri(){let e=Q3(Bc);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as Gh}from"react/jsx-runtime";var Hc=({pendingTransaction:e})=>{let{getAccessToken:t}=H(),{wallets:r}=Ri(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=W(),[s,c]=Hh(null),[u,m]=Hh(e),{tokenPrice:h}=Fs(u),g=l(e.chainId)||"ETH",E=X3(()=>r.find(v=>v.walletClientType==="privy"),[r]);return eb(()=>{async function v(){if(!await t()||!o||!E)return u;let C=Pr(u.chainId,i,n,{appId:a}),T=await Rn(E.address,u,C),{totalGasEstimate:R}=await kn(T,C);return c(R.toHexString()),T}v().then(x=>{m(x)})},[o]),E?Gh(rb,{children:Gh(Sn,{from:E.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:h,tokenSymbol:g})}):null},rb=tb.div`
|
|
2178
2185
|
width: 100%;
|
|
2179
2186
|
padding: 1rem 0;
|
|
2180
|
-
`;import{Fragment as
|
|
2187
|
+
`;import{Fragment as Vc,jsx as ne,jsxs as fr}from"react/jsx-runtime";var zc=({open:e,onClose:t})=>{let{user:r}=H(),[o,n]=Gc(null),{init:i,cancel:a}=Tn();lb(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(c){try{n(c),await i(c)}catch(u){console.error(u)}}let s=()=>{n(null),a(),t()};return!e||!r?null:o?ne(cb,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):fr(Vc,{children:[ne(A,{onClose:s},"header"),ne(ze,{children:ne(tt,{children:ne(sb,{})})}),ne(we,{children:"Verify your identity"}),ne(fe,{children:"Choose a verification method"}),fr(La,{children:[r.mfaMethods.includes("totp")&&fr(Pe,{onClick:()=>l("totp"),children:[ne(ob,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&fr(Pe,{onClick:()=>l("sms"),children:[ne(nb,{}),"SMS"]},"sms")]}),ne(oe,{})]})},cb=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=S(),{pendingTransaction:n}=W(),[i,a]=Gc(!1),[l,s]=Gc(!1),{submit:c}=Tn();async function u(m){try{if(!m)return;await c(e,m),s(!0),a(!1),t()}catch(h){throw jl(h)?(a(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):cn(h)?(a(!1),new Error("The code you entered is not valid")):ln(h)?(a(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(a(!1),new Error("Unknown error"))}}switch(e){case"sms":return fr(Vc,{children:[ne(A,{onClose:t},"header"),ne(ze,{children:ne(tt,{children:ne(ab,{})})}),ne(we,{children:"Enter verification code"}),fr(Vr,{children:[ne(Pn,{success:l,disabled:i,onChange:u}),fr(fe,{children:["To continue, please enter the 6-digit code sent to your ",ne("strong",{children:"mobile device"})]}),n&&ne(Hc,{pendingTransaction:n})]}),r&&ne(Ml,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ne(Gt,{onClick:t,children:"Not now"}),ne(oe,{})]});case"totp":return fr(Vc,{children:[ne(A,{onClose:t},"header"),ne(ze,{children:ne(tt,{children:ne(ib,{})})}),ne(we,{children:"Enter verification code"}),fr(Vr,{children:[ne(Pn,{success:l,disabled:i,onChange:u}),fr(fe,{children:["To continue, please enter the 6-digit code generated from your"," ",ne("strong",{children:"authenticator app"})]}),n&&ne(Hc,{pendingTransaction:n})]}),r&&ne(Ml,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ne(Gt,{onClick:t,children:"Not now"}),ne(oe,{})]});default:return null}};import{useEffect as Vh,useState as zh}from"react";import qh from"styled-components";import{Fragment as ub,jsx as hr,jsxs as Bs}from"react/jsx-runtime";var $h={google:{name:"Google",component:Cs},discord:{name:"Discord",component:gs},github:{name:"Github",component:vs},linkedin:{name:"LinkedIn",component:Es},twitter:{name:"Twitter",component:xs},spotify:{name:"Spotify",component:Ps},tiktok:{name:"Tiktok",component:Ts},apple:{name:"Apple",component:ys}},jh=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=S(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:m,setReadyToTrue:h,closePrivyModal:g,createAnalyticsEvent:E}=W(),[v,x]=zh(!1),[C,T]=zh(void 0),R=s()?.provider||"google",I=$h[R].name,_=$h[R].component,F=n?.render.inDialog?Qe:0;Vh(()=>{u(R).then(()=>{x(!0)}).catch(k=>{if(k?.privyErrorCode==="allowlist_rejected"){T(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}let{retryable:z,detail:L}=sp(k,R);T({retryable:z,detail:L,message:"Authentication failed"})}).finally(()=>{Vn(),h()})},[I,R]),Vh(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let z=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},F);return()=>clearTimeout(z)}if(Pt(o,n?.embeddedWallets?.createOnLogin)){let z=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:L=>{console.error(L),E("embedded_wallet_creation_failure_logout",{error:L,provider:R,screen:"OAuthStatusScreen"}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},F);return()=>clearTimeout(z)}else{let z=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),F);return m(),()=>clearTimeout(z)}}},[r,e,v,o]);let U=v?`Successfully connected with ${I}`:C?C.message:`Verifying connection to ${I}`,B="";return v?B="You\u2019re good to go!":C?B=C.detail:B="Just a few moments more",Bs(ub,{children:[hr(A,{}),hr(X,{}),Bs(db,{children:[hr(pb,{children:Bs("div",{children:[hr(xr,{success:v,fail:!!C}),hr(_,{style:{width:"38px",height:"38px"}})]})}),Bs(gt,{children:[hr("h3",{children:U}),hr("p",{children:B})]}),C&&C?.retryable?hr(Ra,{onClick:()=>{Vn(),c(R),T(void 0)},disabled:!v&&!C?.retryable,children:"Retry"}):null]}),hr(te,{}),hr(oe,{})]})},db=qh.div`
|
|
2181
2188
|
display: flex;
|
|
2182
2189
|
flex-direction: column;
|
|
2183
2190
|
align-items: center;
|
|
@@ -2185,7 +2192,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2185
2192
|
margin-left: 27px;
|
|
2186
2193
|
margin-right: 27px;
|
|
2187
2194
|
gap: 24px;
|
|
2188
|
-
`,
|
|
2195
|
+
`,pb=qh.div`
|
|
2189
2196
|
display: flex;
|
|
2190
2197
|
flex-direction: column;
|
|
2191
2198
|
justify-content: center;
|
|
@@ -2208,55 +2215,55 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2208
2215
|
left: -19px;
|
|
2209
2216
|
top: -19px;
|
|
2210
2217
|
}
|
|
2211
|
-
`;import{useEffect as
|
|
2218
|
+
`;import{useEffect as fb,useState as Yh}from"react";import hb from"styled-components";import{isMobile as mb}from"react-device-detect";var Kh=(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(!Dr()&&mb)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};import{Fragment as gb,jsx as Mr,jsxs as Jh}from"react/jsx-runtime";var Zh=()=>{let{forkSession:e,ready:t,authenticated:r}=H(),[o,n]=Yh(""),[i,a]=Yh(!1);fb(()=>{t&&r&&e().then(n)},[t,r]);let l=Kh(o,!i),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."),i&&(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."),Jh(gb,{children:[Mr(A,{},"header"),Mr(X,{}),Mr(lr,{title:s.title,description:s.description}),Jh(Rt,{children:[Mr(yb,{children:Mr(or,{style:{width:"72px",height:"72px"}})}),Mr(ka,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Mr("p",{children:s.footnote}):null]}),Mr(te,{}),Mr(V,{protectedByPrivy:!0})]})},yb=hb(It)`
|
|
2212
2219
|
margin: 16px auto;
|
|
2213
|
-
`;import{BigNumber as
|
|
2220
|
+
`;import{BigNumber as ey}from"@ethersproject/bignumber";import{useMemo as ty,useEffect as ry,useState as Lt}from"react";import Mn from"styled-components";function Qh(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{BigNumber as $c}from"@ethersproject/bignumber";import vb from"styled-components";import{Fragment as bb,jsx as Ii,jsxs as Eb}from"react/jsx-runtime";var wb=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=$c.from(e.gasUsed),o=$c.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=$c.from(t);n=n.add(i)}return n.toString()}catch{return}else return},Xh=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a})=>Eb(bb,{children:[Ii(A,{onClose:o}),Ii(Qn,{title:"Transaction complete!",description:"You're all set."}),Ii(Sn,{tokenPrice:n,from:t.from,to:t.to,gas:wb(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),Ii(Cb,{loading:!1,onClick:o,children:"All Done"}),Ii(oe,{})]}),Cb=vb(D)`
|
|
2214
2221
|
&& {
|
|
2215
2222
|
margin-top: 24px;
|
|
2216
2223
|
}
|
|
2217
2224
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2218
|
-
`;import{Fragment as
|
|
2225
|
+
`;import{Fragment as qc,jsx as Ke,jsxs as In}from"react/jsx-runtime";var Pb=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return Ke(Ic,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return Ke(Ic,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return Ke(qc,{children:Ke(kh,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},ny=()=>{let{authenticated:e,getAccessToken:t}=H(),{wallets:r}=Ri(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s,appId:c}=W(),{app:u,navigate:m,data:h,onUserCloseViaDialogOrKeybindRef:g,setModalData:E}=S(),{transactionRequest:v,onSuccess:x,onFailure:C,uiOptions:T,fundWalletConfig:R}=h.sendTransaction,[I,_]=Lt(null),[F,U]=Lt(null),[B,k]=Lt(""),[z,L]=Lt(),[j,ie]=Lt(!1),ee=()=>{k(""),L(void 0)},Q=(ut,Be,Qt)=>{k(ut),L(new Ee(new Tt(Be??ut,Qt??Ve.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[$,be]=Lt(!1),[he,wr]=Lt(!0),[dt,xe]=Lt(null),[pe,pt]=Lt(v),{tokenPrice:Ot,isTokenPriceLoading:Lr}=Fs(pe),Zt=s(v.chainId)||"ETH",[M,K]=Lt(null),[J,Nn]=Lt(null),[q,Re]=Lt(!0);ry(()=>{e||(m("LANDING"),C(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let at=ty(()=>r.find(ut=>ut.walletClientType==="privy"),[r]),ao=async()=>{if(!at)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:ut,externalTransactionId:Be}=await i(at.address,{config:R?.config||{}});E({fiatOnRampPrompt:{signedUrl:ut},fiatOnRampStatus:{externalTransactionId:Be}}),m("FIAT_ON_RAMP_PROMPT_SCREEN")},Nt=ty(()=>Pr(pe.chainId,l,a,{appId:c}),[pe.chainId,a]);ry(()=>{async function ut(){let Be=pe;if(!await t()||!o||!at)return;try{Be=await Rn(at.address,pe,Nt),pt(Be)}catch(Cr){Q("There was an error preparing your transaction. Please try again.",Cr.reason)}let Or=ey.from(0),Wi=ey.from(0);try{({totalGasEstimate:Or,l1ExecutionFeeEstimate:Wi}=await kn(Be,Nt)),K(Or.toHexString()),Nn(Wi.toHexString())}catch{K(null)}try{let{balance:Cr,hasSufficientFunds:js}=await Ds(at.address,Be,Or,Nt);xe(Cr.toHexString()),js||(wr(!1),Q("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&ie(!0))}catch(Cr){console.warn(`Failed to fetch wallet balance with error: ${Cr}`)}Re(!1)}ut()},[o]);let so=Qh(pe),qs=so==="SEND"?`Send ${Zt}`:"Review transaction",Ie={modalTitle:T.header||T.modalTitle||qs,buttonText:T.buttonText||"Submit"},lo=()=>{$||(F?x(F):C(z||new Ee(new Tt("The user rejected the request",Ve.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=lo,Ot===void 0&&Lr||q?In(qc,{children:[T.transactionInfo?.contractInfo?.imgUrl&&Ke(da,{src:T.transactionInfo?.contractInfo?.imgUrl}),Ke(A,{title:Ie.modalTitle,onClose:lo}),Ke(oy,{children:Ke(an,{})})]}):I!==null?Ke(Xh,{txn:pe,onClose:lo,receipt:I,transactionInfo:T.transactionInfo,tokenPrice:Ot,tokenSymbol:Zt,l1GasEstimate:J}):In(qc,{children:[Ke(A,{title:Ie.modalTitle,onClose:lo}),In(oy,{children:[In(_b,{children:[Ke(Pb,{txn:pe,txnFamily:so,uiOptions:T,tokenSymbol:Zt,tokenPrice:Ot}),at?Ke(Sn,{from:at.address,to:pe.to,txn:pe,transactionInfo:T.transactionInfo,gas:M||void 0,tokenPrice:Ot,tokenSymbol:Zt}):null]}),In(Ab,{children:[Ke(Tb,{children:B}),Ke(xh,{txn:pe,address:at?.address??"",hasFunds:he,balance:dt}),In(xb,{children:[j&&Ke(D,{onClick:ao,children:"Add Funds"}),Ke(Sb,{disabled:$||!he,loading:!o||$,loadingText:$?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{be(!0);let ut=await t();if(ut&&!$&&at)try{let Be=await Ns(ut,at.address,o,pe,Nt);U(Be);let Qt=await Be.wait();_(Us(Qt)),ee()}catch(Be){let Qt="There was an error processing your transaction. Please contact support.";console.warn({transaction:pe,error:Be}),Q(Qt,Be.reason)}finally{be(!1)}},children:Ie.buttonText})]})]})]})]})},oy=Mn.div`
|
|
2219
2226
|
display: flex;
|
|
2220
2227
|
flex-direction: column;
|
|
2221
2228
|
justify-content: space-between;
|
|
2222
2229
|
flex-grow: 1;
|
|
2223
2230
|
padding-bottom: 16px;
|
|
2224
|
-
`,
|
|
2231
|
+
`,Tb=Mn.div`
|
|
2225
2232
|
font-size: 13px;
|
|
2226
2233
|
color: var(--privy-color-error);
|
|
2227
2234
|
width: 100%;
|
|
2228
2235
|
margin-top: 16px;
|
|
2229
|
-
`,
|
|
2236
|
+
`,xb=Mn.div`
|
|
2230
2237
|
display: flex;
|
|
2231
2238
|
direction: row;
|
|
2232
2239
|
justify-content: space-between;
|
|
2233
2240
|
align-items: center;
|
|
2234
2241
|
gap: 8px;
|
|
2235
|
-
`,
|
|
2242
|
+
`,Sb=Mn(D)`
|
|
2236
2243
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2237
|
-
`,
|
|
2244
|
+
`,_b=Mn.div`
|
|
2238
2245
|
height: 100%;
|
|
2239
2246
|
display: flex;
|
|
2240
2247
|
flex-direction: column;
|
|
2241
2248
|
justify-content: space-evenly;
|
|
2242
2249
|
flex-grow: 1;
|
|
2243
|
-
`,
|
|
2250
|
+
`,Ab=Mn.div`
|
|
2244
2251
|
display: flex;
|
|
2245
2252
|
flex-direction: column;
|
|
2246
2253
|
gap: 8px;
|
|
2247
|
-
`;import{isHexString as
|
|
2254
|
+
`;import{isHexString as kb}from"@ethersproject/bytes";import{toUtf8String as Rb}from"@ethersproject/strings";import{useEffect as iy,useState as Hs}from"react";import no,{css as Ib}from"styled-components";import{Fragment as ly,jsx as Ae,jsxs as Wn}from"react/jsx-runtime";var Mb=e=>{if(!kb(e))return e;try{return Rb(e)}catch{return e}},Wb=e=>JSON.stringify(e,null,2),Lb=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?Ae(Fb,{children:Object.entries(r).map(([o,n])=>Wn("li",{children:[Wn("strong",{children:[o,":"]})," ",t(n)]},o))}):Ae("span",{children:String(r)});return Ae("div",{children:t(e)})},Ob=e=>{let{types:t,primaryType:r,...o}=e.typedData;return Wn(ly,{children:[Ae(sy,{children:Ae(Lb,{data:o})}),Ae(yn,{text:Wb(e.typedData),itemName:"full payload to clipboard"})," "]})},ay=()=>{let{authenticated:e}=H(),{initializeWalletProxy:t,closePrivyModal:r}=W(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=S(),[a,l]=Hs(!0),[s,c]=Hs(""),[u,m]=Hs(),[h,g]=Hs(null),E=h!==null;iy(()=>{e||o("LANDING")},[e]),iy(()=>{t(Lo).then(U=>{l(!1),U||(c("An error has occurred, please try again."),m(new Ee(new Tt(s,Ve.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:v,data:x,confirmAndSign:C,onSuccess:T,onFailure:R,uiOptions:I}=n.signMessage,_={title:I.title||"Sign message",description:I.description||"Signing this message will not cost you any fees.",buttonText:I.buttonText||"Sign and continue"},F=U=>{U?T(U):R(u||new Ee(new Tt("The user rejected the request.",Ve.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),g(null),c(""),m(void 0)};return i.current=()=>{F(h)},Wn(ly,{children:[Ae(A,{onClose:()=>F(h)}),Ae(X,{}),Wn(Nb,{children:[Ae(Db,{children:_.title}),Ae(Ub,{children:_.description}),v==="personal_sign"&&Ae(sy,{children:Mb(x)}),v==="eth_signTypedData_v4"&&Ae(Ob,{typedData:x}),Ae(Bb,{fail:!0,children:s}),Ae(Gb,{success:E,loading:a,disabled:E,onClick:async()=>{try{let U=await C();g(U),c(""),setTimeout(()=>{F(U)},Qe)}catch{c("An error has occurred, please try again."),m(new Ee(new Tt(s,Ve.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:E?Wn(Hb,{children:[Ae(ts,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Ae("span",{children:"Success"})]}):_.buttonText})]}),Ae(te,{}),Ae(V,{protectedByPrivy:!0})]})},Nb=no.div`
|
|
2248
2255
|
display: flex;
|
|
2249
2256
|
flex-direction: column;
|
|
2250
2257
|
align-items: center;
|
|
2251
2258
|
justify-content: center;
|
|
2252
|
-
`,
|
|
2259
|
+
`,Db=no.span`
|
|
2253
2260
|
color: var(--privy-color-foreground);
|
|
2254
2261
|
text-align: center;
|
|
2255
2262
|
font-size: 1.125rem;
|
|
2256
2263
|
font-weight: 500;
|
|
2257
2264
|
line-height: 1.25rem; /* 111.111% */
|
|
2258
2265
|
text-align: center;
|
|
2259
|
-
`,
|
|
2266
|
+
`,Ub=no.span`
|
|
2260
2267
|
margin-top: 4px;
|
|
2261
2268
|
color: var(--privy-color-foreground);
|
|
2262
2269
|
text-align: center;
|
|
@@ -2266,7 +2273,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2266
2273
|
font-weight: 400;
|
|
2267
2274
|
line-height: 20px; /* 142.857% */
|
|
2268
2275
|
letter-spacing: -0.008px;
|
|
2269
|
-
`,
|
|
2276
|
+
`,sy=no.div`
|
|
2270
2277
|
margin-top: 1.5rem;
|
|
2271
2278
|
background-color: var(--privy-color-background-2);
|
|
2272
2279
|
border-radius: var(--privy-border-radius-md);
|
|
@@ -2285,7 +2292,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2285
2292
|
display: none; /* Safari and Chrome */
|
|
2286
2293
|
}
|
|
2287
2294
|
}
|
|
2288
|
-
`,
|
|
2295
|
+
`,Fb=no.ul`
|
|
2289
2296
|
margin-left: 12px !important;
|
|
2290
2297
|
white-space: nowrap;
|
|
2291
2298
|
|
|
@@ -2297,7 +2304,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2297
2304
|
font-weight: 500 !important;
|
|
2298
2305
|
}
|
|
2299
2306
|
}
|
|
2300
|
-
`,
|
|
2307
|
+
`,Bb=no.div`
|
|
2301
2308
|
line-height: 20px;
|
|
2302
2309
|
height: 20px;
|
|
2303
2310
|
font-size: 13px;
|
|
@@ -2307,22 +2314,22 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2307
2314
|
width: 100%;
|
|
2308
2315
|
margin-top: 16px;
|
|
2309
2316
|
margin-bottom: 4px;
|
|
2310
|
-
`,
|
|
2317
|
+
`,Hb=no.span`
|
|
2311
2318
|
display: flex;
|
|
2312
2319
|
align-items: center;
|
|
2313
2320
|
gap: 8px;
|
|
2314
|
-
`,
|
|
2321
|
+
`,Gb=no(D)`
|
|
2315
2322
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2316
2323
|
|
|
2317
|
-
${e=>e.success&&
|
|
2324
|
+
${e=>e.success&&Ib`
|
|
2318
2325
|
&&&& {
|
|
2319
2326
|
background-color: var(--privy-color-success);
|
|
2320
2327
|
color: #ffffff;
|
|
2321
2328
|
}
|
|
2322
2329
|
`}
|
|
2323
|
-
`;import
|
|
2330
|
+
`;import Kb from"@heroicons/react/24/outline/EnvelopeIcon";import Vb from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as zb,useState as cy}from"react";import py from"styled-components";import{Fragment as jb,jsx as Mi,jsxs as dy}from"react/jsx-runtime";var uy=zb((e,t)=>{let[r,o]=cy(""),[n,i]=cy(!1),{authenticated:a,user:l}=H(),{initUpdateEmail:s}=W(),{navigate:c,setModalData:u,currentScreen:m}=S(),{enabled:h,token:g}=de(),E=ji(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.");i(!0);try{await s(l.email.address,r,R),c("AWAITING_PASSWORDLESS_CODE")}catch(I){u({errorModalData:{error:I,previousScreen:m||"LANDING"}})}i(!1)},T=()=>{h&&!g&&!a?(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"}}),c("CAPTCHA_SCREEN")):C(g)};return dy(jb,{children:[Mi($b,{children:dy(qb,{children:[Mi(Vb,{}),Mi("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:R=>o(R.target.value),onKeyUp:R=>{R.key==="Enter"&&T()},value:r,autoComplete:"email"}),e.stacked?null:Mi(Ko,{isSubmitting:v,onClick:T,disabled:x,children:"Submit"})]})}),e.stacked?Mi(D,{loadingText:null,loading:v,disabled:x,onClick:T,children:"Submit"}):null]})}),$b=py.div`
|
|
2324
2331
|
width: 100%;
|
|
2325
|
-
`,
|
|
2332
|
+
`,qb=py.label`
|
|
2326
2333
|
display: block;
|
|
2327
2334
|
position: relative;
|
|
2328
2335
|
width: 100%;
|
|
@@ -2380,7 +2387,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2380
2387
|
&& > input::placeholder {
|
|
2381
2388
|
color: var(--privy-color-foreground-3);
|
|
2382
2389
|
}
|
|
2383
|
-
`;import{Fragment as
|
|
2390
|
+
`;import{Fragment as Yb,jsx as io,jsxs as Jb}from"react/jsx-runtime";var my=()=>Jb(Yb,{children:[io(A,{},"header"),io(X,{}),io(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:io(Kb,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),io(Rt,{children:io(uy,{stacked:!0})}),io(te,{}),io(V,{protectedByPrivy:!0})]});import Qb,{createGlobalStyle as Xb}from"styled-components";var Zb=`
|
|
2384
2391
|
*,
|
|
2385
2392
|
::before,
|
|
2386
2393
|
::after {
|
|
@@ -2610,7 +2617,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2610
2617
|
[hidden] {
|
|
2611
2618
|
display: none;
|
|
2612
2619
|
}
|
|
2613
|
-
`,
|
|
2620
|
+
`,fy=Zb;var hy=Xb`
|
|
2614
2621
|
:root {
|
|
2615
2622
|
// Borders
|
|
2616
2623
|
--privy-border-radius-sm: 6px;
|
|
@@ -2642,10 +2649,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2642
2649
|
--privy-height-modal-full: 620px;
|
|
2643
2650
|
--privy-height-modal-compact: 480px;
|
|
2644
2651
|
};
|
|
2645
|
-
`,
|
|
2652
|
+
`,yy=Qb.div`
|
|
2646
2653
|
// css normalize only the privy application to avoid conflicts
|
|
2647
2654
|
// with consuming application
|
|
2648
|
-
${
|
|
2655
|
+
${fy}
|
|
2649
2656
|
|
|
2650
2657
|
// Privy styles
|
|
2651
2658
|
color: var(--privy-color-foreground-2);
|
|
@@ -2704,4 +2711,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2704
2711
|
opacity: 1;
|
|
2705
2712
|
}
|
|
2706
2713
|
}
|
|
2707
|
-
`;import{jsx as Fe,jsxs as gy}from"react/jsx-runtime";var t4={["LANDING"]:Wf,["CONNECT_OR_CREATE"]:If,["AWAITING_PASSWORDLESS_CODE"]:wu,["AWAITING_CONNECTION"]:Uu,["AWAITING_CONNECT_ONLY_CONNECTION"]:Gu,["AWAITING_FARCASTER_CONNECTION"]:jm,["PHANTOM_INTERSTITIAL_SCREEN"]:Jh,["LOGIN_FAILED_SCREEN"]:Bf,["AWAITING_OAUTH_SCREEN"]:qh,["ALLOWLIST_REJECTION_SCREEN"]:cu,["INSTALL_PHANTOM_SCREEN"]:lf,["LINK_EMAIL_SCREEN"]:Lf,["LINK_PHONE_SCREEN"]:Of,["LINK_WALLET_SCREEN"]:Nf,["UPDATE_EMAIL_SCREEN"]:uy,["CONNECT_ONLY_LANDING_SCREEN"]:Ou,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Mu,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:_m,["EMBEDDED_WALLET_CREATED_SCREEN"]:Yu,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:ju,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Rm,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:Xu,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:iy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:oy,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Xm,["FIAT_ON_RAMP_STATUS_SCREEN"]:tf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:km,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Am,["MFA_ENROLLMENT_FLOW_SCREEN"]:eh,["CAPTCHA_SCREEN"]:Pu,["ERROR_SCREEN"]:Im,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:rf,["AFFIRMATIVE_CONSENT_SCREEN"]:su},r4=["LANDING","AWAITING_CONNECTION"],o4=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=H(),{headless:n}=W(),{ready:i,currentScreen:a}=S(),{status:l,execute:s,reset:c,enabled:u}=ce(),m=Qb(null),h=Kp(m),v=o&&a&&r4.includes(a)&&!n&&l==="ready";if(yy(()=>{v&&s()},[v]),yy(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return gy(bn,{children:[Fe(A,{}),Fe(X,{}),Fe(Vf,{children:Fe(xt,{})}),Fe(te,{}),Fe(oe,{})]});if(!a&&e)return Fe(bn,{style:{height:h},children:Fe("div",{ref:m,children:Fe(Gc,{open:e,onClose:t})})});if(!a)return null;let E=t4[a];return Fe(bn,{style:{height:h},children:gy("div",{ref:m,children:[Fe(Tr,{if:!!e,children:Fe(E,{})}),Fe(Tr,{if:!e,children:Fe(Gc,{open:e,onClose:t})})]})})},n4=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=S();return{gracefulClosePrivyModal:Zb(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},vy=({open:e})=>{let{app:t}=S(),{gracefulClosePrivyModal:r}=n4(),[o,n]=Xb(!1);Cl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=Fe(hy,{children:Fe(o4,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?Fe(Gf,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return e4.createPortal(l,s)}return l};import{useEffect as i4,useRef as wy}from"react";var Hs=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;default:throw new Error(`invalid wallet event type ${t}`)}}};async function ko(e,t,r,o,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new Se("missing_or_invalid_mfa","MFA verification failed, retry."));let m=await new Promise((h,v)=>{r.current={resolve:h,reject:v};let E=1e3*60*5;setTimeout(()=>{let g=new Se("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(g),v(g)},E)});return await e(m)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),o.current?.resolve(void 0);break}catch(m){if(m.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),m}if(c===null){let u=new Se("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as p4}from"react/jsx-runtime";var a4=function(e){return()=>`id-${e++}`}(0);function s4(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function hr(e){return e.error!==void 0}var Jt=new Hs,$c=new Map,l4=(e,t)=>typeof t=="bigint"?t.toString():t,c4=(e,t)=>`${e}${JSON.stringify(t,l4)}`;function yr(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=c4(e,t);if(e==="privy:wallet:create"){let l=$c.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=a4();Jt.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{$c.delete(i)});return $c.set(i,a),a}function d4(e){switch(e.event){case"privy:iframe:ready":let t=Jt.dequeue(e.event,e.id);return hr(e)?t.reject(new Se(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Jt.dequeue(e.event,e.id);return hr(e)?r.reject(new Se(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Jt.dequeue(e.event,e.id);return hr(e)?o.reject(new Se(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Jt.dequeue(e.event,e.id);return hr(e)?n.reject(new Se(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Jt.dequeue(e.event,e.id);return hr(e)?i.reject(new Se(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Jt.dequeue(e.event,e.id);return hr(e)?a.reject(new Se(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Jt.dequeue(e.event,e.id);return hr(e)?l.reject(new Se(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Jt.dequeue(e.event,e.id);return hr(e)?s.reject(new Se(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Jt.dequeue(e.event,e.id);return hr(e)?s.reject(new Se(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Jt.dequeue(e.event,e.id);return hr(e)?s.reject(new Se(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Cy(e){let t=wy(null),r=wy(e.mfaMethods),o=Zp();return i4(()=>{r.current=e.mfaMethods},[e.mfaMethods]),p4("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>{let i=t.current;if(!i)return;function a(m){m&&m.origin===e.origin&&s4(m.data)&&d4(m.data)}let l={create(m){return yr("privy:wallet:create",m,i,e.origin)},connect(m){return yr("privy:wallet:connect",m,i,e.origin)},recover(m){return ko(h=>yr("privy:wallet:recover",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(m){return ko(h=>yr("privy:wallet:rpc",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(m){return ko(h=>yr("privy:wallet:set-recovery-password",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(m){return ko(h=>yr("privy:mfa:verify",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(m){return ko(h=>yr("privy:mfa:init-enrollment",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(m){return yr("privy:mfa:submit-enrollment",m,i,e.origin)},unenrollMfa(m){return ko(h=>yr("privy:mfa:unenroll",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)}};window.addEventListener("message",a);let s=()=>e.onLoad(l),c=(...m)=>{console.warn("Privy iframe failed to load: ",...m),e.onLoadFailed()},u=new AbortController;return Vd(()=>yr("privy:iframe:ready",{},i,e.origin),{abortSignal:u.signal}).then(s,c),()=>{window.removeEventListener("message",a),u.abort()}},src:Ki(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Gs(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}var Vs=class{constructor(t,r){this.meta={action:t,phoneNumber:r}}async init(){if(!this.meta.action)throw new P("action required");if(!this.api)throw new P("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new P("phone number must be set when initialzing authentication.");try{await this.api.post(Ed,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw se(t)}}async authenticate(){if(!this.meta.action)throw new P("action required");if(!this.api)throw new P("Mfa flow has no API instance");if(!this.meta.smsCode)throw new P("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new P("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(Pd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return ft(t)}catch(t){throw se(t)}}};import{jsx as gr,jsxs as by}from"react/jsx-runtime";var Ln;function h4(e){return typeof e=="string"&&e.length===25}function Me(){if(!Ln){let e=le.get(lo);return Promise.resolve(e||null)}return Ln.getAccessToken()}var Ey,lp=(e,t)=>Ey(e,t),Py,cp=(e,t)=>Py(e,t),Ty,dp=(e,t)=>Ty(e,t),xy,pp=()=>xy(),y4=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;le.put(Nn,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},g4=({config:e,...t})=>{if(!h4(t.appId))throw new P("Cannot initialize the Privy provider with an invalid Privy app ID");Ln||(Ln=new Kn({appId:t.appId,apiUrl:t.apiUrl||Vi}));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."),gr(Up,{client:Ln,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:gr(v4,{...t,config:r,client:Ln})})},v4=e=>{let t=e.client,[r,o]=ke(!1),[n,i]=ke(!1),[a,l]=ke(!1),[s,c]=ke(null),[u,m]=ke([]),h=Wn(u),[v,E]=ke(!1),[g,x]=ke(null),[C,T]=ke(!1),[R,I]=ke({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[_,F]=ke(null),[U,B]=ke(null),[k,z]=ke(null),L=Pa(),j=Ta(),[ie,ee]=ke(!0),[Q,$]=ke({}),[we,me]=ke(null),[vr,dt]=ke(null),[xe,de]=ke(!1),[pt,Ot]=ke(!1),Mr=Wn(null),Zt=Wn(null),M=Wn(Yp);t.onStoreToken=d=>{d&&N(M,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{N(M,"accessToken","onAccessTokenRemoved")};let K=Wn(null),J=Wn(null),On=m4(d=>{let p=t.connectors?.walletsReady||!1;return a&&s?.linkedAccounts?.some(y=>y.type==="wallet"&&y.walletClientType==="privy")?p&&d?.some(y=>y?.walletClientType==="privy"):p},[a,s?.linkedAccounts,t?.connectors?.walletsReady]),q=d=>{x(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:d})},Re=d=>{L.embeddedWallets.createOnLogin!=="off"&&ee(!0),q(d)};Ir(()=>{if(!k||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(k,p,L.defaultChain,e.appId)}},[k,s]),Ir(()=>{k&&vr?.(k)},[k]),Ir(()=>{(async()=>{if(!L.customAuth?.enabled)return;ee(!0);let{getCustomAccessToken:p,isLoading:f}=L.customAuth;if(!(!n||f))try{let y=await p();if(!y){await Ro.logout();return}if(a)return;t.startAuthFlow(new Mo(y));let{user:O,isNewUser:G}=await t.authenticate();O||await Ro.logout(),c(O||null),E(G||!1),l(!0),Ot(!0)}catch(y){console.warn(y),a&&await Ro.logout()}})()},[L.customAuth?.enabled,L.customAuth?.getCustomAccessToken,L.customAuth?.isLoading,n,a]),Ir(()=>{pt&&k&&s&&Et(s,e.config?.embeddedWallets?.createOnLogin)&&(Ot(!1),wr(s,Lo).catch(console.error))},[pt&&k&&s]),Ir(()=>{async function d(){let p=at();y4();let f=u4();F(f),t.initializeConnectorManager(L.walletConnectCloudProjectId,L.rpcConfig,L.chains,L.defaultChain,f,L.appearance.walletList,L.shouldEnforceDefaultChainOnConnect),t.connectors?.initialize().then(()=>{$s()});let y=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!y),y&&N(M,"login","onComplete",y,!1,!0,null),c(y)),p||pe.setReadyToTrue(),p&&(y?J.current="link":J.current="login")}!n&&j&&d()},[t,we,n,j]);let at=()=>{let d=Hn();return!d.inProgress||d.headless?!1:(t.startAuthFlow(new er(d)),Re("AWAITING_OAUTH_SCREEN"),!0)},io=async(d,p,f,y)=>{let O=await t.connectors?.createWalletConnector(d,p)||null;Nt(O,p,f,y)};async function Nt(d,p,f,y){if(d)I({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:b});else return I({status:"disconnected",connectedWallet:null,connectError:new Y("Unable to connect to wallet."),connector:null,connectRetry:b}),y?.(null,f);d instanceof nr&&p&&await d.resetConnection(p),I({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Nt(d,p,f,y)});try{let O=await d.connect({showPrompt:!0});if(L.shouldEnforceDefaultChainOnConnect&&!L.chains.find(G=>G.id===Number(O?.chainId))&&!(O?.connectorType==="wallet_connect_v2"&&O?.walletClientType==="metamask")){I(G=>({...G,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await O?.switchChain(L.defaultChain.id),O&&(O.chainId=No(uo(L.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${L.defaultChain.id}`)}}return I(G=>({...G,status:"connected",connectedWallet:O,connectError:null,connectRetry:b})),O&&!J.current&&N(M,"connectWallet","onSuccess",O),y?.(O,f)}catch(O){return O instanceof He?(console.warn(O.cause?O.cause:O.message),J.current||N(M,"connectWallet","onError",O.privyErrorCode||"generic_connect_wallet_error")):(console.warn(O),J.current||N(M,"connectWallet","onError","unknown_connect_wallet_error")),I(G=>({...G,status:"disconnected",connectedWallet:null,connectError:O})),y?.(null,f)}}let ao=async(d,p)=>{if(d===null)return;let f=new mo(d,p);t.startAuthFlow(f)},$s=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),f=d.get("privy_wallet_client");if(!p||!f)return;if(f==="phantom"&&!Or()&&Re("LOGIN_FAILED_SCREEN"),!t.connectors)throw new P("Connector not initialized");q("AWAITING_CONNECTION");let y=new URL(window.location.href);y.searchParams.delete("privy_connector"),y.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",y),io(p,f,void 0,ao)};Ir(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let Ie=()=>{if(!a)throw N(M,"linkAccount","onError","must_be_authenticated"),new P("User must be authenticated before linking an account.")},so=()=>{Ie(),K.current="siwe",J.current="link",q("LINK_WALLET_SCREEN")},ut=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},Be=async d=>{if(!t.connectors)throw new P("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(I(f=>({...f,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:b})),L.captchaEnabled&&!a){let f={callback:y=>ao(d,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};$({captchaModalData:f}),Re("CAPTCHA_SCREEN")}else await ao(d),Re("AWAITING_CONNECTION")},Qt=async(d,p)=>{if(!L.fiatOnRamp.enabled)throw new P("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:f,externalTransactionId:y}=await Zm(t,d,p?.config??{},L.appearance.palette,L.fiatOnRamp.useSandbox);return{signedUrl:f,externalTransactionId:y}}else throw new P("Unsupported fund provider. Currently supported option is `moonpay`.")},Wr=()=>{m(d=>{let p=t.connectors?.wallets.map(f=>({...f,linked:ut(f),loginOrLink:async()=>{if(!await f.isConnected())throw new P("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new P("Cannot link or login with embedded wallet");Be(f)},fund:async y=>{let{signedUrl:O,externalTransactionId:G}=await Qt(f.address,y);$({fiatOnRampPrompt:{signedUrl:O},fiatOnRampStatus:{externalTransactionId:G}}),q("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new P("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new P("Cannot unlink an embedded wallet");let y=await t.unlinkWallet(f.address);c(y)}}))||[];return de(On(p)),ra(d,p)?d:p})};Ir(()=>{Wr()},[s?.linkedAccounts,a,n]),Ir(()=>{if(n){if(!t.connectors)throw new P("Connector not initialized");Wr(),t.connectors.on("walletsUpdated",Wr)}},[n]);let Wi=()=>{q(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Ir(()=>{if(!u[0])return;let d=u[0],p=h.current.find(y=>y.address===d.address),f;if(d.walletClientType==="privy"?f=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address&&y.walletClientType==="privy"):f=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address&&y.walletClientType!=="privy"),!p&&f){let y=Object.assign({},s);y.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(y)}h.current=u},[u]);let wr=async(d,p)=>{if(fe(d))throw N(M,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[y,O]=await Promise.all([pe.initializeWalletProxy(p),Me()]);if(!y&&e.config?.customAuth?.enabled)throw N(M,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!y||!O||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((G,ue)=>{ee(!0),$({createWallet:{onSuccess:st=>{N(M,"createWallet","onSuccess",st),G(st)},onFailure:st=>{N(M,"createWallet","onError","unknown_embedded_wallet_error"),ue(st)},callAuthOnSuccessOnClose:!1}}),q("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await y.create({accessToken:O});let G=await pe.refreshUser(),ue=fe(G);if(!ue)throw N(M,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(M,"createWallet","onSuccess",ue),ue}},qs=d=>{if(!L.chains.map(p=>p.id).includes(d))throw new Y(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},jc=(d,p,f)=>new Promise(async(y,O)=>{if(!a||!s){N(M,"sendTransaction","onError","must_be_authenticated"),O(new Error("User must be authenticated before signing with a Privy wallet"));return}let G=fe(s);if(!G){N(M,"sendTransaction","onError","embedded_wallet_not_found"),O(new Error("Must have a Privy wallet before signing"));return}ee(!0);let ue=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ye=d.chainId?Number(d.chainId):ue.chainId;qs(Ye);let st=Object.assign({},d,{chainId:Ye}),Cr=async()=>{let Je=await Me();if(!Je||!k){N(M,"sendTransaction","onError","embedded_wallet_not_found"),O(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await pe.recoverEmbeddedWallet()){N(M,"sendTransaction","onError","unknown_connect_wallet_error"),O(new Error("Unable to connect to wallet"));return}let Ft=Er(st.chainId,L.chains,L.rpcConfig,{appId:e.appId}),js=await kn(G.address,st,Ft);if(L.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:Ry}=await An(js,Ft),{hasSufficientFunds:Iy}=await Ns(G.address,js,Ry,Ft);if(!Iy)throw new Ce(new Pt("Wallet has insufficient funds for this transaction.",Ve.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Jc=await Os(Je,G.address,k,js,Ft);N(M,"sendTransaction","onSuccess",Jc),y(Jc)}catch(Ut){N(M,"sendTransaction","onError","transaction_failure"),O(Ut)}};if(L.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Cr();else{let Je={transactionRequest:st,onSuccess:Ft=>{N(M,"sendTransaction","onSuccess",Ft),y(Ft)},onFailure:Ft=>{N(M,"sendTransaction","onError","transaction_failure"),O(Ft)},uiOptions:p||{},fundWalletConfig:f},Ut={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Ft=>{N(M,"sendTransaction","onError","unknown_connect_wallet_error"),O(Ft)}};$({connectWallet:Ut,sendTransaction:Je}),q("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Kc(){return new Promise(async(d,p)=>{let f=await Me();if(!f||!k)throw new Error("Must have valid access token to enroll in MFA");try{await k.verifyMfa({accessToken:f}),d()}catch(y){p(y)}})}let Dt=d=>{if(s?.[d])throw N(M,"linkAccount","onError","cannot_link_more_of_type"),new P(`User already has an account of type ${d} linked.`)},Ro={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Wi,linkWallet:so,linkEmail:()=>{Ie(),Dt("email"),K.current="email",J.current="link",q("LINK_EMAIL_SCREEN")},linkPhone:()=>{Ie(),Dt("phone"),K.current="sms",J.current="link",q("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Ie(),Dt("google"),J.current="link",await pe.initLoginWithOAuth("google")},linkTwitter:async()=>{Ie(),Dt("twitter"),J.current="link",await pe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Ie(),Dt("discord"),J.current="link",await pe.initLoginWithOAuth("discord")},linkGithub:async()=>{Ie(),Dt("github"),J.current="link",await pe.initLoginWithOAuth("github")},linkSpotify:async()=>{Ie(),Dt("spotify"),J.current="link",await pe.initLoginWithOAuth("spotify")},linkTiktok:async()=>{Ie(),Dt("tiktok"),J.current="link",await pe.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Ie(),Dt("linkedin"),J.current="link",await pe.initLoginWithOAuth("linkedin")},linkApple:async()=>{Ie(),Dt("apple"),J.current="link",await pe.initLoginWithOAuth("apple")},linkFarcaster:async()=>{Ie(),Dt("farcaster"),await pe.initLoginWithFarcaster(),J.current="link",K.current="farcaster",q("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Ie(),!s?.email)throw new P("User does not have an email linked to their account.");J.current="link",K.current="email",q("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(d=>{me(()=>d)}),me(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}J.current="login",Re("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{me(()=>d)}),me(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}Re("CONNECT_OR_CREATE")},logout:async()=>{await t.logout(),c(null),l(!1),x(null),N(M,"logout","onSuccess"),J.current=null,K.current=null,o(!1),le.del(Dn)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new he;let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(y=>y.address===d?.address));return!d||!p?new he:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new qc(new tr(new he));let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(y=>y.address===d?.address));return!d||!p?new qc(new tr(new he)):new qc(new tr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Ur(new he);let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(y=>y.address===d?.address));return!d||!p?new Ur(new he):new Ur(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(y=>zs(y.address)===zs(d)),f=s?.linkedAccounts.find(y=>y.type==="wallet"&&zs(y.address)===zs(d));if(!p||!await p.isConnected())B(d),so();else if(!p.linked)p.loginOrLink();else{let y=Object.assign({},s);y.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(y)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw N(M,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return wr(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw N(M,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=fe(s);if(!d||!k)throw N(M,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw N(M,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await Kc()}catch(p){throw N(M,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,f)=>{ee(!0);let y={onSuccess:G=>{N(M,"setWalletPassword","onSuccess",G),p(G)},onFailure:G=>{N(M,"setWalletPassword","onError","user_exited_set_password_flow"),f(G)},callAuthOnSuccessOnClose:!1},O={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:G=>{N(M,"setWalletPassword","onError","unknown_connect_wallet_error"),f(G)}};$({setWalletPassword:y,connectWallet:O}),q("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(f,y)=>{if(!a||!s){N(M,"signMessage","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let O=fe(s);if(!O){N(M,"signMessage","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){N(M,"signMessage","onError","invalid_message"),y(new Error("Message must be a non-empty string"));return}ee(!0);let G=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let ue=await Me();if(!k||!ue)throw new Error("Unable to connect to wallet");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:O.address});let{response:st}=await k.rpc({accessToken:ue,address:O.address,request:{method:"personal_sign",params:[d,O.address]}}),Cr=st.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:O.address}),Cr};if(L.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ue=await G();N(M,"signMessage","onSuccess",ue),f(ue)}catch(ue){N(M,"signMessage","onError","unable_to_sign"),y(ue??new Ce("Unable to sign message"))}}else{let st={method:"personal_sign",data:d,confirmAndSign:G,onSuccess:Je=>{N(M,"signMessage","onSuccess",Je),f(Je)},onFailure:Je=>{N(M,"signMessage","onError","unable_to_sign"),y(Je)},uiOptions:p||{}},Cr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Je=>{N(M,"signMessage","onError","unknown_connect_wallet_error"),y(Je)}};$({signMessage:st,connectWallet:Cr}),q("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(f,y)=>{if(!a||!s){N(M,"signTypedData","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let O=fe(s);if(!O){N(M,"signTypedData","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}ee(!0);let G=Ji(d),ue=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Ye=await Me();if(!k||!Ye)throw new Error("Unable to connect to wallet");if(!await pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:O.address});let{response:Cr}=await k.rpc({accessToken:Ye,address:O.address,request:{method:"eth_signTypedData_v4",params:[O.address,G]}}),Je=Cr.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:O.address}),Je};if(L.embeddedWallets.noPromptOnSignature||(L.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Ye=await ue();N(M,"signTypedData","onSuccess",Ye),f(Ye)}catch(Ye){N(M,"signTypedData","onError","unable_to_sign"),y(Ye??new Ce("Unable to sign message"))}}else{let Cr={method:"eth_signTypedData_v4",data:G,confirmAndSign:ue,onSuccess:Ut=>{N(M,"signTypedData","onSuccess",Ut),f(Ut)},onFailure:Ut=>{N(M,"signTypedData","onError","unable_to_sign"),y(Ut)},uiOptions:p||{}},Je={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Ut=>{N(M,"signMessage","onError","unknown_connect_wallet_error"),y(Ut)}};$({signMessage:Cr,connectWallet:Je}),q("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,f)=>{let O=await(await jc(d,p,f)).wait();return Ds(O)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let f=fe(s);if(!f){p(new Error("Must have a Privy wallet before exporting"));return}ee(!0);let y={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},O=await Me();if(!O||!k){p(new Error("Must have valid access token to enroll in MFA"));return}if(!k){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await k.connect({accessToken:O,address:f.address}),await k.verifyMfa({accessToken:O})}catch(ue){if(bo(ue))await pe.recoverEmbeddedWallet();else throw ue}}catch(ue){p(ue);return}let G={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};$({keyExport:G,connectWallet:y}),q("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Kc,async init(d){let p;switch(d){case"sms":p=new Vs("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(p),await p.init()},async submit(d,p){switch(d){case"totp":case"sms":Mr.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((f,y)=>{Zt.current={resolve:f,reject:y}});break;default:throw Mr.current?.reject(new P("Unsupported MFA method")),new P(`Unsupported MFA method: ${d}`)}},cancel(){Mr.current?.reject(new P("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Me();if(!p||!k)throw new Error("Must have valid access token to enroll in MFA");await k.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,f)=>{if(!d){pe.closePrivyModal(),p();return}L.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."),$({mfaEnrollmentFlow:{mfaMethods:L.mfa.methods,onSuccess:p,onFailure:f}}),q("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Me();if(!d||!k)throw new Error("Must have valid access token to enroll in MFA");let p=await k.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Me();if(!p||!k)throw new Error("Must have valid access token to enroll in MFA");await k.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async submitEnrollmentWithTotp(d){let p=await Me();if(!p||!k)throw new Error("Must have valid access token to enroll in MFA");await k.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async unenroll(d){let p=await Me();if(!p||!k)throw new Error("Must have valid access token to remove MFA");await k.unenrollMfa({method:d,accessToken:p});let f=await t.getAuthenticatedUser();c(f)},isHeadlessOAuthLoading:C,loginWithCode(d){return pe.loginWithCode(d)},initLoginWithEmail(d){return pe.initLoginWithEmail(d)},initLoginWithSms(d){return pe.initLoginWithSms(d)},fundWallet(d,p){return pe.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return pe.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return pe.loginWithHeadlessOAuth(d)},isModalOpen:r};Ey=Ro.signMessage,Py=Ro.signTypedData,Ty=async(...d)=>{let p=await jc(...d);return L.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let Yc=!!e.config?.headless,pe=(()=>({headless:Yc,isNewUserThisSession:v,linkingHint:U,pendingTransaction:null,walletConnectionStatus:R,mipdStore:_,connectors:t.connectors?.walletConnectors??[],rpcConfig:L.rpcConfig,chains:L.chains,appId:e.appId,showFiatPrices:L.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>L.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(k)return k;let p=new Promise(O=>{dt(()=>G=>O(G))}),f=new Promise(O=>setTimeout(()=>O(null),d)),y=await Promise.race([p,f]);return dt(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s;J.current==="login"?d.shouldCallAuthOnSuccess&&p?(N(M,"login","onComplete",s,v,!1,K.current??null),e.onSuccess?.(s,v)):N(M,"login","onError","exited_auth_flow"):J.current==="link"&&K.current&&(d.isSuccess&&p?N(M,"linkAccount","onSuccess",s,K.current):N(M,"linkAccount","onError","exited_link_flow")),B(null),J.current=null,K.current=null,E(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:q,connectWallet:Nt,initLoginWithWallet:async(d,p)=>{K.current="siwe",ao(d,p)},loginWithWallet:async()=>{if(!n)throw new Io;if(!(t.authFlow instanceof mo))throw new P("Must initialize SIWE flow first.");let d,p;if(a)try{d=await t.link(),K.current="siwe"}catch(f){throw N(M,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:d,isNewUser:p}=await t.authenticate()),K.current="siwe"}catch(f){throw N(M,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}c(d||s||null),E(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Fn(d);t.startAuthFlow(p);try{K.current="farcaster",await p.initializeFarcasterConnect()}catch(f){throw J.current==="login"?N(M,"login","onError",f.privyErrorCode||"unknown_auth_error"):J.current==="link"&&N(M,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},loginWithFarcaster:async()=>{if(!n)throw new Io;if(!(t.authFlow instanceof Fn))throw new P("Must initialize Farcaster flow first.");let d,p;if(a)try{d=await t.link(),K.current="farcaster"}catch(f){throw N(M,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:d,isNewUser:p}=await t.authenticate()),K.current="farcaster"}catch(f){throw N(M,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}c(d||null),E(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(K.current=d,Qs()){if(d==="google"&&Gs(window.navigator.userAgent)){Re("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{Re("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let f=new er({provider:d});p&&f.addCaptchaToken(p),t.startAuthFlow(f);let y=await t.authFlow.getAuthorizationUrl();y&&y.url&&window.location.assign(y.url)},async loginWithOAuth(d){if(!(t.authFlow instanceof er))throw new P("Must initialize OAuth flow before calling loginWithOAuth");let p=Ge.get(co),f=t.authFlow.meta.stateCode;if(p!==f)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d,storedStateCode:p??"",returnedStateCode:f??""}),new P("Unexpected auth flow. This may be a phishing attempt.");let y,O;if(a)try{y=await t.link(),K.current=d}catch(G){throw N(M,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}else try{({user:y,isNewUser:O}=await t.authenticate()),K.current=d}catch(G){throw J.current==="login"?N(M,"login","onError",G.privyErrorCode||"unknown_auth_error"):J.current==="link"&&N(M,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}c(y),E(O||!1),l(!0)},async initLoginWithHeadlessOAuth(d,p){if(Qs()){if(d==="google"&&Gs(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let f=new er({provider:d,headless:!0});p&&f.addCaptchaToken(p);let y=await t.startAuthFlow(f).getAuthorizationUrl();y?.url&&window.location.assign(y.url)},async loginWithHeadlessOAuth(d){T(!0),t.startAuthFlow(new er(d));let p=Ge.get(co),f=d.stateCode;if(p!==f)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d.provider,storedStateCode:p??"",returnedStateCode:f??""}),T(!1),new P("Unexpected auth flow. This may be a phishing attempt.");let y,O;if(a)try{y=await t.link(),K.current=d.provider}catch(G){throw N(M,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}else try{({user:y,isNewUser:O}=await t.authenticate()),K.current=d.provider}catch(G){throw J.current==="login"?N(M,"login","onError",G.privyErrorCode||"unknown_auth_error"):J.current==="link"&&N(M,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}return c(y),E(O||!1),l(!0),T(!1),y??void 0},initLoginWithEmail:async(d,p)=>{let f=new Lr(d,p);t.startAuthFlow(f);try{K.current="email",await f.sendCodeEmail()}catch(y){throw J.current==="login"?N(M,"login","onError",y.privyErrorCode||"unknown_auth_error"):J.current==="link"&&N(M,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},initUpdateEmail:async(d,p,f)=>{let y=new Bi(d,p,f);t.startAuthFlow(y),await y.sendCodeEmail()},initLoginWithSms:async(d,p)=>{let f=new fo(d,p);t.startAuthFlow(f);try{K.current="sms",await f.sendSmsCode()}catch(y){throw J.current==="login"?N(M,"login","onError",y.privyErrorCode||"unknown_auth_error"):J.current==="link"&&N(M,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new Io;if(t.authFlow instanceof Lr)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof fo)t.authFlow.meta.smsCode=d.trim();else throw new P("Must initialize a passwordless code flow first");let p,f;if(a)try{p=await t.link()}catch(y){throw N(M,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}else try{({user:p,isNewUser:f}=await t.authenticate())}catch(y){throw N(M,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}c(p||s||null),E(f||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:k,createAnalyticsEvent:(d,p,f)=>t.createAnalyticsEvent(d,p,f),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let f=s?.linkedAccounts.find(O=>O.type==="wallet"&&O.walletClientType==="privy"),y=await Me();if(!y||!k||!f){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ee(!0);try{await k.connect({accessToken:y,address:f.address}),d(!0)}catch(O){bo(O)&&f.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:f.address}),(await k.recover({address:f.address,accessToken:y})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:f.address}),d(!0)):bo(O)?($({recoverWallet:{privyWallet:f,onFailure:p,onSuccess:()=>d(!0)}}),q("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(O)}}),getFiatOnRampConfig:Qt,setReadyToTrue:()=>{i(!0),we?.()},updateWallets:()=>Wr(),fundWallet:async(d,p)=>{let{signedUrl:f,externalTransactionId:y}=await Qt(d,p);$({fiatOnRampPrompt:{signedUrl:f},fiatOnRampStatus:{externalTransactionId:y}}),q("FIAT_ON_RAMP_PROMPT_SCREEN")}}))();xy=pe.recoverEmbeddedWallet;let ky=f4(()=>({wallets:u,ready:xe}),[u,xe]);return gr(ae.Provider,{value:Ro,children:gr(wl.Provider,{value:M,children:gr(Uc.Provider,{value:ky,children:by(qp,{...L,children:[e.children,by(vl.Provider,{value:pe,children:[!Yc&&L.captchaEnabled&&n&&!a&&gr(gl,{delayedExecution:!1}),gr(fy,{theme:{...L.appearance.palette||{}}}),gr(Bp,{data:Q,setModalData:$,setInitialScreen:x,initialScreen:g,authenticated:a,open:r,children:gr(vy,{open:r})}),ie&&j?gr(Cy,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Mr,mfaSubmitPromise:Zt,onLoad:z,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as w4}from"react";function C4(e){let{login:t}=w4(ae);return ge("login",e),{login:t}}import{useContext as b4}from"react";function E4(e){let{logout:t}=b4(ae);return ge("logout",e),{logout:t}}import{useCallback as Sy,useEffect as P4}from"react";function T4(){let e=ce(),t=Ta(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=H(),l=Sy(async c=>{if(e.enabled&&e.status!=="success")throw new Ht(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=Sy(async()=>{let c=Hn();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(c)}catch(u){throw u}finally{Gn()}},[o]);return P4(()=>{let c=Hn();i&&t&&c.inProgress&&c.headless&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as _y}from"react";var x4=()=>{let e=ce(),{initLoginWithEmail:t,loginWithCode:r}=H(),o=_y(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=_y(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Ht(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as Ay}from"react";var S4=()=>{let e=ce(),{initLoginWithSms:t,loginWithCode:r}=H(),o=Ay(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),n=Ay(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Ht(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useContext as _4}from"react";function A4(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:m,linkFarcaster:h}=_4(ae);return ge("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:m,linkFarcaster:h}}import{useContext as k4}from"react";function R4(e){let{connectWallet:t}=k4(ae);return ge("connectWallet",e),{connectWallet:t}}import{useContext as I4}from"react";function M4(e){let{createWallet:t}=I4(ae);return ge("createWallet",e),{createWallet:t}}var W4=()=>{let{fundWallet:e}=H();return{fundWallet:e}};import{useContext as L4}from"react";function O4(e){let{sendTransaction:t}=L4(ae);return ge("sendTransaction",e),{sendTransaction:t}}import{useContext as N4}from"react";function D4(e){let{setWalletPassword:t}=N4(ae);return ge("setWalletPassword",e),{setWalletPassword:t}}import{useContext as U4}from"react";function F4(e){let{signMessage:t}=U4(ae);return ge("signMessage",e),{signMessage:t}}import{useContext as B4}from"react";function H4(e){let{signTypedData:t}=B4(ae);return ge("signTypedData",e),{signTypedData:t}}import{useContext as G4}from"react";var V4=()=>{let{isModalOpen:e}=G4(ae);return{isOpen:e}};import{useContext as z4}from"react";function $4(e){let{getAccessToken:t}=z4(ae);return ge("accessToken",e),{getAccessToken:t}}function q4(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{tr as AsExternalProvider,gl as Captcha,jn as ConnectorManager,Kn as PrivyClient,g4 as PrivyProvider,he as PrivyProxyProvider,$n as SUPPORTED_CHAINS,rl as VERSION,lt as WalletConnector,q4 as addRpcUrlOverrideToChain,ql as errorIndicatesMaxMfaRetries,ln as errorIndicatesMfaTimeout,cn as errorIndicatesMfaVerificationFailed,Me as getAccessToken,R4 as useConnectWallet,M4 as useCreateWallet,W4 as useFundWallet,A4 as useLinkAccount,C4 as useLogin,x4 as useLoginWithEmail,T4 as useLoginWithOAuth,S4 as useLoginWithSms,E4 as useLogout,Pn as useMfa,Pi as useMfaEnrollment,V4 as useModalStatus,H as usePrivy,Cl as useRegisterMfaListener,O4 as useSendTransaction,D4 as useSetWalletPassword,F4 as useSignMessage,H4 as useSignTypedData,$4 as useToken,Ri as useWallets};
|
|
2714
|
+
`;import{jsx as Fe,jsxs as vy}from"react/jsx-runtime";var n4={["LANDING"]:Lf,["CONNECT_OR_CREATE"]:Mf,["AWAITING_PASSWORDLESS_CODE"]:bu,["AWAITING_CONNECTION"]:Bu,["AWAITING_CONNECT_ONLY_CONNECTION"]:zu,["AWAITING_FARCASTER_CONNECTION"]:Km,["PHANTOM_INTERSTITIAL_SCREEN"]:Zh,["LOGIN_FAILED_SCREEN"]:Hf,["AWAITING_OAUTH_SCREEN"]:jh,["ALLOWLIST_REJECTION_SCREEN"]:pu,["INSTALL_PHANTOM_SCREEN"]:cf,["LINK_EMAIL_SCREEN"]:Of,["LINK_PHONE_SCREEN"]:Nf,["LINK_WALLET_SCREEN"]:Df,["UPDATE_EMAIL_SCREEN"]:my,["CONNECT_ONLY_LANDING_SCREEN"]:Du,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Lu,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:km,["EMBEDDED_WALLET_CREATED_SCREEN"]:Zu,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Yu,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Mm,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:tm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:ay,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:ny,["FIAT_ON_RAMP_PROMPT_SCREEN"]:ef,["FIAT_ON_RAMP_STATUS_SCREEN"]:rf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Im,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Rm,["MFA_ENROLLMENT_FLOW_SCREEN"]:th,["CAPTCHA_SCREEN"]:xu,["ERROR_SCREEN"]:Wm,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:of,["AFFIRMATIVE_CONSENT_SCREEN"]:cu},i4=["LANDING","AWAITING_CONNECTION"],a4=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=H(),{headless:n}=W(),{ready:i,currentScreen:a}=S(),{status:l,execute:s,reset:c,enabled:u}=de(),m=t4(null),h=Jp(m),g=o&&a&&i4.includes(a)&&!n&&l==="ready";if(gy(()=>{g&&s()},[g]),gy(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return vy(En,{children:[Fe(A,{}),Fe(X,{}),Fe(zf,{children:Fe(St,{})}),Fe(te,{}),Fe(oe,{})]});if(!a&&e)return Fe(En,{style:{height:h},children:Fe("div",{ref:m,children:Fe(zc,{open:e,onClose:t})})});if(!a)return null;let E=n4[a];return Fe(En,{style:{height:h},children:vy("div",{ref:m,children:[Fe(Sr,{if:!!e,children:Fe(E,{})}),Fe(Sr,{if:!e,children:Fe(zc,{open:e,onClose:t})})]})})},s4=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=S();return{gracefulClosePrivyModal:e4(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},wy=({open:e})=>{let{app:t}=S(),{gracefulClosePrivyModal:r}=s4(),[o,n]=r4(!1);bl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=Fe(yy,{children:Fe(a4,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?Fe(Vf,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return o4.createPortal(l,s)}return l};import{useEffect as l4,useRef as Cy}from"react";var Gs=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;default:throw new Error(`invalid wallet event type ${t}`)}}};async function ko(e,t,r,o,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new Se("missing_or_invalid_mfa","MFA verification failed, retry."));let m=await new Promise((h,g)=>{r.current={resolve:h,reject:g};let E=1e3*60*5;setTimeout(()=>{let v=new Se("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},E)});return await e(m)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),o.current?.resolve(void 0);break}catch(m){if(m.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),m}if(c===null){let u=new Se("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}import{jsx as f4}from"react/jsx-runtime";var c4=function(e){return()=>`id-${e++}`}(0);function d4(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function yr(e){return e.error!==void 0}var Jt=new Gs,jc=new Map,p4=(e,t)=>typeof t=="bigint"?t.toString():t,u4=(e,t)=>`${e}${JSON.stringify(t,p4)}`;function gr(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=u4(e,t);if(e==="privy:wallet:create"){let l=jc.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=c4();Jt.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{jc.delete(i)});return jc.set(i,a),a}function m4(e){switch(e.event){case"privy:iframe:ready":let t=Jt.dequeue(e.event,e.id);return yr(e)?t.reject(new Se(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=Jt.dequeue(e.event,e.id);return yr(e)?r.reject(new Se(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=Jt.dequeue(e.event,e.id);return yr(e)?o.reject(new Se(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=Jt.dequeue(e.event,e.id);return yr(e)?n.reject(new Se(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Jt.dequeue(e.event,e.id);return yr(e)?i.reject(new Se(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Jt.dequeue(e.event,e.id);return yr(e)?a.reject(new Se(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Jt.dequeue(e.event,e.id);return yr(e)?l.reject(new Se(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Jt.dequeue(e.event,e.id);return yr(e)?s.reject(new Se(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Jt.dequeue(e.event,e.id);return yr(e)?s.reject(new Se(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Jt.dequeue(e.event,e.id);return yr(e)?s.reject(new Se(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function by(e){let t=Cy(null),r=Cy(e.mfaMethods),o=Xp();return l4(()=>{r.current=e.mfaMethods},[e.mfaMethods]),f4("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>{let i=t.current;if(!i)return;function a(m){m&&m.origin===e.origin&&d4(m.data)&&m4(m.data)}let l={create(m){return gr("privy:wallet:create",m,i,e.origin)},connect(m){return gr("privy:wallet:connect",m,i,e.origin)},recover(m){return ko(h=>gr("privy:wallet:recover",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(m){return ko(h=>gr("privy:wallet:rpc",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(m){return ko(h=>gr("privy:wallet:set-recovery-password",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(m){return ko(h=>gr("privy:mfa:verify",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(m){return ko(h=>gr("privy:mfa:init-enrollment",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(m){return gr("privy:mfa:submit-enrollment",m,i,e.origin)},unenrollMfa(m){return ko(h=>gr("privy:mfa:unenroll",{...m,...h},i,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)}};window.addEventListener("message",a);let s=()=>e.onLoad(l),c=(...m)=>{console.warn("Privy iframe failed to load: ",...m),e.onLoadFailed()},u=new AbortController;return $d(()=>gr("privy:iframe:ready",{},i,e.origin),{abortSignal:u.signal}).then(s,c),()=>{window.removeEventListener("message",a),u.abort()}},src:Ki(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Vs(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 P("action required");if(!this.api)throw new P("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new P("phone number must be set when initialzing authentication.");try{await this.api.post(Td,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw le(t)}}async authenticate(){if(!this.meta.action)throw new P("action required");if(!this.api)throw new P("Mfa flow has no API instance");if(!this.meta.smsCode)throw new P("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new P("phone number must be set prior to calling authenticate.");try{let t=await this.api.post(xd,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return ft(t)}catch(t){throw le(t)}}};import{jsx as vr,jsxs as Ey}from"react/jsx-runtime";var On;function v4(e){return typeof e=="string"&&e.length===25}function Me(){if(!On){let e=ce.get(co);return Promise.resolve(e||null)}return On.getAccessToken()}var Py,dp=(e,t)=>Py(e,t),Ty,pp=(e,t)=>Ty(e,t),xy,up=(e,t)=>xy(e,t),Sy,mp=()=>Sy(),w4=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;ce.put(Dn,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},C4=({config:e,...t})=>{if(!v4(t.appId))throw new P("Cannot initialize the Privy provider with an invalid Privy app ID");On||(On=new Yn({appId:t.appId,apiUrl:t.apiUrl||Vi}));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."),vr(Bp,{client:On,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:vr(b4,{...t,config:r,client:On})})},b4=e=>{let t=e.client,[r,o]=ke(!1),[n,i]=ke(!1),[a,l]=ke(!1),[s,c]=ke(null),[u,m]=ke([]),h=Ln(u),[g,E]=ke(!1),[v,x]=ke(null),[C,T]=ke(!1),[R,I]=ke({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:b}),[_,F]=ke(null),[U,B]=ke(null),[k,z]=ke(null),L=Pa(),j=Ta(),[ie,ee]=ke(!0),[Q,$]=ke({}),[be,he]=ke(null),[wr,dt]=ke(null),[xe,pe]=ke(!1),[pt,Ot]=ke(!1),Lr=Ln(null),Zt=Ln(null),M=Ln(Zp);t.onStoreToken=d=>{d&&N(M,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{N(M,"accessToken","onAccessTokenRemoved")};let K=Ln(null),J=Ln(null),Nn=y4(d=>{let p=t.connectors?.walletsReady||!1;return a&&s?.linkedAccounts?.some(y=>y.type==="wallet"&&y.walletClientType==="privy")?p&&d?.some(y=>y?.walletClientType==="privy"):p},[a,s?.linkedAccounts,t?.connectors?.walletsReady]),q=d=>{x(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:d})},Re=d=>{L.embeddedWallets.createOnLogin!=="off"&&ee(!0),q(d)};Wr(()=>{if(!k||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(k,p,L.defaultChain,e.appId)}},[k,s]),Wr(()=>{k&&wr?.(k)},[k]),Wr(()=>{(async()=>{if(!L.customAuth?.enabled)return;ee(!0);let{getCustomAccessToken:p,isLoading:f}=L.customAuth;if(!(!n||f))try{let y=await p();if(!y){await Ro.logout();return}if(a)return;t.startAuthFlow(new Mo(y));let{user:O,isNewUser:G}=await t.authenticate();O||await Ro.logout(),c(O||null),E(G||!1),l(!0),Ot(!0)}catch(y){console.warn(y),a&&await Ro.logout()}})()},[L.customAuth?.enabled,L.customAuth?.getCustomAccessToken,L.customAuth?.isLoading,n,a]),Wr(()=>{pt&&k&&s&&Pt(s,e.config?.embeddedWallets?.createOnLogin)&&(Ot(!1),Cr(s,Lo).catch(console.error))},[pt&&k&&s]),Wr(()=>{async function d(){let p=at();w4();let f=h4();F(f),t.initializeConnectorManager(L.walletConnectCloudProjectId,L.rpcConfig,L.chains,L.defaultChain,f,L.appearance.walletList,L.shouldEnforceDefaultChainOnConnect),t.connectors?.initialize().then(()=>{qs()});let y=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!y),y&&N(M,"login","onComplete",y,!1,!0,null),c(y)),p||ue.setReadyToTrue(),p&&(y?J.current="link":J.current="login")}!n&&j&&d()},[t,be,n,j]);let at=()=>{let d=Gn();return!d.inProgress||d.headless?!1:(t.startAuthFlow(new er(d)),Re("AWAITING_OAUTH_SCREEN"),!0)},ao=async(d,p,f,y)=>{let O=await t.connectors?.createWalletConnector(d,p)||null;Nt(O,p,f,y)};async function Nt(d,p,f,y){if(d)I({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:b});else return I({status:"disconnected",connectedWallet:null,connectError:new Y("Unable to connect to wallet."),connector:null,connectRetry:b}),y?.(null,f);d instanceof nr&&p&&await d.resetConnection(p),I({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Nt(d,p,f,y)});try{let O=await d.connect({showPrompt:!0});if(L.shouldEnforceDefaultChainOnConnect&&!L.chains.find(G=>G.id===Number(O?.chainId))&&!(O?.connectorType==="wallet_connect_v2"&&O?.walletClientType==="metamask")){I(G=>({...G,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:b}));try{await O?.switchChain(L.defaultChain.id),O&&(O.chainId=No(mo(L.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${L.defaultChain.id}`)}}return I(G=>({...G,status:"connected",connectedWallet:O,connectError:null,connectRetry:b})),O&&!J.current&&N(M,"connectWallet","onSuccess",O),y?.(O,f)}catch(O){return O instanceof He?(console.warn(O.cause?O.cause:O.message),J.current||N(M,"connectWallet","onError",O.privyErrorCode||"generic_connect_wallet_error")):(console.warn(O),J.current||N(M,"connectWallet","onError","unknown_connect_wallet_error")),I(G=>({...G,status:"disconnected",connectedWallet:null,connectError:O})),y?.(null,f)}}let so=async(d,p)=>{if(d===null)return;let f=new fo(d,p);t.startAuthFlow(f)},qs=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),f=d.get("privy_wallet_client");if(!p||!f)return;if(f==="phantom"&&!Dr()&&Re("LOGIN_FAILED_SCREEN"),!t.connectors)throw new P("Connector not initialized");q("AWAITING_CONNECTION");let y=new URL(window.location.href);y.searchParams.delete("privy_connector"),y.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",y),ao(p,f,void 0,so)};Wr(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let Ie=()=>{if(!a)throw N(M,"linkAccount","onError","must_be_authenticated"),new P("User must be authenticated before linking an account.")},lo=()=>{Ie(),K.current="siwe",J.current="link",q("LINK_WALLET_SCREEN")},ut=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},Be=async d=>{if(!t.connectors)throw new P("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(I(f=>({...f,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:b})),L.captchaEnabled&&!a){let f={callback:y=>so(d,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};$({captchaModalData:f}),Re("CAPTCHA_SCREEN")}else await so(d),Re("AWAITING_CONNECTION")},Qt=async(d,p)=>{if(!L.fiatOnRamp.enabled)throw new P("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:f,externalTransactionId:y}=await Qm(t,d,p?.config??{},L.appearance.palette,L.fiatOnRamp.useSandbox);return{signedUrl:f,externalTransactionId:y}}else throw new P("Unsupported fund provider. Currently supported option is `moonpay`.")},Or=()=>{m(d=>{let p=t.connectors?.wallets.map(f=>({...f,linked:ut(f),loginOrLink:async()=>{if(!await f.isConnected())throw new P("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new P("Cannot link or login with embedded wallet");Be(f)},fund:async y=>{let{signedUrl:O,externalTransactionId:G}=await Qt(f.address,y);$({fiatOnRampPrompt:{signedUrl:O},fiatOnRampStatus:{externalTransactionId:G}}),q("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new P("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new P("Cannot unlink an embedded wallet");let y=await t.unlinkWallet(f.address);c(y)}}))||[];return pe(Nn(p)),ra(d,p)?d:p})};Wr(()=>{Or()},[s?.linkedAccounts,a,n]),Wr(()=>{if(n){if(!t.connectors)throw new P("Connector not initialized");Or(),t.connectors.on("walletsUpdated",Or)}},[n]);let Wi=()=>{q(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Wr(()=>{if(!u[0])return;let d=u[0],p=h.current.find(y=>y.address===d.address),f;if(d.walletClientType==="privy"?f=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address&&y.walletClientType==="privy"):f=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address&&y.walletClientType!=="privy"),!p&&f){let y=Object.assign({},s);y.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(y)}h.current=u},[u]);let Cr=async(d,p)=>{if(ye(d))throw N(M,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[y,O]=await Promise.all([ue.initializeWalletProxy(p),Me()]);if(!y&&e.config?.customAuth?.enabled)throw N(M,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!y||!O||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((G,me)=>{ee(!0),$({createWallet:{onSuccess:st=>{N(M,"createWallet","onSuccess",st),G(st)},onFailure:st=>{N(M,"createWallet","onError","unknown_embedded_wallet_error"),me(st)},callAuthOnSuccessOnClose:!1}}),q("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await y.create({accessToken:O});let G=await ue.refreshUser(),me=ye(G);if(!me)throw N(M,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return N(M,"createWallet","onSuccess",me),me}},js=d=>{if(!L.chains.map(p=>p.id).includes(d))throw new Y(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Yc=(d,p,f)=>new Promise(async(y,O)=>{if(!a||!s){N(M,"sendTransaction","onError","must_be_authenticated"),O(new Error("User must be authenticated before signing with a Privy wallet"));return}let G=ye(s);if(!G){N(M,"sendTransaction","onError","embedded_wallet_not_found"),O(new Error("Must have a Privy wallet before signing"));return}ee(!0);let me=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ye=d.chainId?Number(d.chainId):me.chainId;js(Ye);let st=Object.assign({},d,{chainId:Ye}),br=async()=>{let Je=await Me();if(!Je||!k){N(M,"sendTransaction","onError","embedded_wallet_not_found"),O(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ue.recoverEmbeddedWallet()){N(M,"sendTransaction","onError","unknown_connect_wallet_error"),O(new Error("Unable to connect to wallet"));return}let Ft=Pr(st.chainId,L.chains,L.rpcConfig,{appId:e.appId}),Ks=await Rn(G.address,st,Ft);if(L.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:Iy}=await kn(Ks,Ft),{hasSufficientFunds:My}=await Ds(G.address,Ks,Iy,Ft);if(!My)throw new Ee(new Tt("Wallet has insufficient funds for this transaction.",Ve.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Qc=await Ns(Je,G.address,k,Ks,Ft);N(M,"sendTransaction","onSuccess",Qc),y(Qc)}catch(Ut){N(M,"sendTransaction","onError","transaction_failure"),O(Ut)}};if(L.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),br();else{let Je={transactionRequest:st,onSuccess:Ft=>{N(M,"sendTransaction","onSuccess",Ft),y(Ft)},onFailure:Ft=>{N(M,"sendTransaction","onError","transaction_failure"),O(Ft)},uiOptions:p||{},fundWalletConfig:f},Ut={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Ft=>{N(M,"sendTransaction","onError","unknown_connect_wallet_error"),O(Ft)}};$({connectWallet:Ut,sendTransaction:Je}),q("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Jc(){return new Promise(async(d,p)=>{let f=await Me();if(!f||!k)throw new Error("Must have valid access token to enroll in MFA");try{await k.verifyMfa({accessToken:f}),d()}catch(y){p(y)}})}let Dt=d=>{if(s?.[d])throw N(M,"linkAccount","onError","cannot_link_more_of_type"),new P(`User already has an account of type ${d} linked.`)},Ro={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Wi,linkWallet:lo,linkEmail:()=>{Ie(),Dt("email"),K.current="email",J.current="link",q("LINK_EMAIL_SCREEN")},linkPhone:()=>{Ie(),Dt("phone"),K.current="sms",J.current="link",q("LINK_PHONE_SCREEN")},linkGoogle:async()=>{Ie(),Dt("google"),J.current="link",await ue.initLoginWithOAuth("google")},linkTwitter:async()=>{Ie(),Dt("twitter"),J.current="link",await ue.initLoginWithOAuth("twitter")},linkDiscord:async()=>{Ie(),Dt("discord"),J.current="link",await ue.initLoginWithOAuth("discord")},linkGithub:async()=>{Ie(),Dt("github"),J.current="link",await ue.initLoginWithOAuth("github")},linkSpotify:async()=>{Ie(),Dt("spotify"),J.current="link",await ue.initLoginWithOAuth("spotify")},linkTiktok:async()=>{Ie(),Dt("tiktok"),J.current="link",await ue.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{Ie(),Dt("linkedin"),J.current="link",await ue.initLoginWithOAuth("linkedin")},linkApple:async()=>{Ie(),Dt("apple"),J.current="link",await ue.initLoginWithOAuth("apple")},linkFarcaster:async()=>{Ie(),Dt("farcaster"),await ue.initLoginWithFarcaster(),J.current="link",K.current="farcaster",q("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(Ie(),!s?.email)throw new P("User does not have an email linked to their account.");J.current="link",K.current="email",q("UPDATE_EMAIL_SCREEN")},login:async()=>{if(n||(await new Promise(d=>{he(()=>d)}),he(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}J.current="login",Re("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{he(()=>d)}),he(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}Re("CONNECT_OR_CREATE")},logout:async()=>{await t.logout(),c(null),l(!1),x(null),N(M,"logout","onSuccess"),J.current=null,K.current=null,o(!1),ce.del(Un)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new ge;let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(y=>y.address===d?.address));return!d||!p?new ge:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Kc(new tr(new ge));let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(y=>y.address===d?.address));return!d||!p?new Kc(new tr(new ge)):new Kc(new tr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Br(new ge);let d=u.find(f=>s.wallet&&f.address===s.wallet.address),p=t.connectors?.walletConnectors.find(f=>f.wallets.find(y=>y.address===d?.address));return!d||!p?new Br(new ge):new Br(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(y=>$s(y.address)===$s(d)),f=s?.linkedAccounts.find(y=>y.type==="wallet"&&$s(y.address)===$s(d));if(!p||!await p.isConnected())B(d),lo();else if(!p.linked)p.loginOrLink();else{let y=Object.assign({},s);y.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(y)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw N(M,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Cr(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw N(M,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=ye(s);if(!d||!k)throw N(M,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw N(M,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await Jc()}catch(p){throw N(M,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,f)=>{ee(!0);let y={onSuccess:G=>{N(M,"setWalletPassword","onSuccess",G),p(G)},onFailure:G=>{N(M,"setWalletPassword","onError","user_exited_set_password_flow"),f(G)},callAuthOnSuccessOnClose:!1},O={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:G=>{N(M,"setWalletPassword","onError","unknown_connect_wallet_error"),f(G)}};$({setWalletPassword:y,connectWallet:O}),q("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(f,y)=>{if(!a||!s){N(M,"signMessage","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let O=ye(s);if(!O){N(M,"signMessage","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){N(M,"signMessage","onError","invalid_message"),y(new Error("Message must be a non-empty string"));return}ee(!0);let G=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let me=await Me();if(!k||!me)throw new Error("Unable to connect to wallet");if(!await ue.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:O.address});let{response:st}=await k.rpc({accessToken:me,address:O.address,request:{method:"personal_sign",params:[d,O.address]}}),br=st.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:O.address}),br};if(L.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let me=await G();N(M,"signMessage","onSuccess",me),f(me)}catch(me){N(M,"signMessage","onError","unable_to_sign"),y(me??new Ee("Unable to sign message"))}}else{let st={method:"personal_sign",data:d,confirmAndSign:G,onSuccess:Je=>{N(M,"signMessage","onSuccess",Je),f(Je)},onFailure:Je=>{N(M,"signMessage","onError","unable_to_sign"),y(Je)},uiOptions:p||{}},br={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Je=>{N(M,"signMessage","onError","unknown_connect_wallet_error"),y(Je)}};$({signMessage:st,connectWallet:br}),q("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(f,y)=>{if(!a||!s){N(M,"signTypedData","onError","must_be_authenticated"),y(new Error("User must be authenticated before signing with a Privy wallet"));return}let O=ye(s);if(!O){N(M,"signTypedData","onError","embedded_wallet_not_found"),y(new Error("Must have a Privy wallet before signing"));return}ee(!0);let G=Ji(d),me=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Ye=await Me();if(!k||!Ye)throw new Error("Unable to connect to wallet");if(!await ue.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:O.address});let{response:br}=await k.rpc({accessToken:Ye,address:O.address,request:{method:"eth_signTypedData_v4",params:[O.address,G]}}),Je=br.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:O.address}),Je};if(L.embeddedWallets.noPromptOnSignature||(L.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Ye=await me();N(M,"signTypedData","onSuccess",Ye),f(Ye)}catch(Ye){N(M,"signTypedData","onError","unable_to_sign"),y(Ye??new Ee("Unable to sign message"))}}else{let br={method:"eth_signTypedData_v4",data:G,confirmAndSign:me,onSuccess:Ut=>{N(M,"signTypedData","onSuccess",Ut),f(Ut)},onFailure:Ut=>{N(M,"signTypedData","onError","unable_to_sign"),y(Ut)},uiOptions:p||{}},Je={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Ut=>{N(M,"signMessage","onError","unknown_connect_wallet_error"),y(Ut)}};$({signMessage:br,connectWallet:Je}),q("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,f)=>{let O=await(await Yc(d,p,f)).wait();return Us(O)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let f=ye(s);if(!f){p(new Error("Must have a Privy wallet before exporting"));return}ee(!0);let y={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},O=await Me();if(!O||!k){p(new Error("Must have valid access token to enroll in MFA"));return}if(!k){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await k.connect({accessToken:O,address:f.address}),await k.verifyMfa({accessToken:O})}catch(me){if(Eo(me))await ue.recoverEmbeddedWallet();else throw me}}catch(me){p(me);return}let G={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};$({keyExport:G,connectWallet:y}),q("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Jc,async init(d){let p;switch(d){case"sms":p=new zs("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(p),await p.init()},async submit(d,p){switch(d){case"totp":case"sms":Lr.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((f,y)=>{Zt.current={resolve:f,reject:y}});break;default:throw Lr.current?.reject(new P("Unsupported MFA method")),new P(`Unsupported MFA method: ${d}`)}},cancel(){Lr.current?.reject(new P("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Me();if(!p||!k)throw new Error("Must have valid access token to enroll in MFA");await k.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,f)=>{if(!d){ue.closePrivyModal(),p();return}L.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."),$({mfaEnrollmentFlow:{mfaMethods:L.mfa.methods,onSuccess:p,onFailure:f}}),q("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Me();if(!d||!k)throw new Error("Must have valid access token to enroll in MFA");let p=await k.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Me();if(!p||!k)throw new Error("Must have valid access token to enroll in MFA");await k.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async submitEnrollmentWithTotp(d){let p=await Me();if(!p||!k)throw new Error("Must have valid access token to enroll in MFA");await k.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async unenroll(d){let p=await Me();if(!p||!k)throw new Error("Must have valid access token to remove MFA");await k.unenrollMfa({method:d,accessToken:p});let f=await t.getAuthenticatedUser();c(f)},isHeadlessOAuthLoading:C,loginWithCode(d){return ue.loginWithCode(d)},initLoginWithEmail(d){return ue.initLoginWithEmail(d)},initLoginWithSms(d){return ue.initLoginWithSms(d)},fundWallet(d,p){return ue.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return ue.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return ue.loginWithHeadlessOAuth(d)},isModalOpen:r};Py=Ro.signMessage,Ty=Ro.signTypedData,xy=async(...d)=>{let p=await Yc(...d);return L.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let Zc=!!e.config?.headless,ue=(()=>({headless:Zc,isNewUserThisSession:g,linkingHint:U,pendingTransaction:null,walletConnectionStatus:R,mipdStore:_,connectors:t.connectors?.walletConnectors??[],rpcConfig:L.rpcConfig,chains:L.chains,appId:e.appId,showFiatPrices:L.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>L.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(k)return k;let p=new Promise(O=>{dt(()=>G=>O(G))}),f=new Promise(O=>setTimeout(()=>O(null),d)),y=await Promise.race([p,f]);return dt(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s;J.current==="login"?d.shouldCallAuthOnSuccess&&p?(N(M,"login","onComplete",s,g,!1,K.current??null),e.onSuccess?.(s,g)):N(M,"login","onError","exited_auth_flow"):J.current==="link"&&K.current&&(d.isSuccess&&p?N(M,"linkAccount","onSuccess",s,K.current):N(M,"linkAccount","onError","exited_link_flow")),B(null),J.current=null,K.current=null,E(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:q,connectWallet:Nt,initLoginWithWallet:async(d,p)=>{K.current="siwe",so(d,p)},loginWithWallet:async()=>{if(!n)throw new Io;if(!(t.authFlow instanceof fo))throw new P("Must initialize SIWE flow first.");let d,p;if(a)try{d=await t.link(),K.current="siwe"}catch(f){throw N(M,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:d,isNewUser:p}=await t.authenticate()),K.current="siwe"}catch(f){throw N(M,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}c(d||s||null),E(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Bn(d);t.startAuthFlow(p);try{K.current="farcaster",await p.initializeFarcasterConnect()}catch(f){throw J.current==="login"?N(M,"login","onError",f.privyErrorCode||"unknown_auth_error"):J.current==="link"&&N(M,"linkAccount","onError",f.privyErrorCode||"unknown_auth_error"),f}},loginWithFarcaster:async()=>{if(!n)throw new Io;if(!(t.authFlow instanceof Bn))throw new P("Must initialize Farcaster flow first.");let d,p;if(a)try{d=await t.link(),K.current="farcaster"}catch(f){throw N(M,"linkAccount","onError",f.privyErrorCode||"failed_to_link_account"),f}else try{({user:d,isNewUser:p}=await t.authenticate()),K.current="farcaster"}catch(f){throw N(M,"login","onError",f.privyErrorCode||"unknown_auth_error"),f}c(d||null),E(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(K.current=d,Xs()){if(d==="google"&&Vs(window.navigator.userAgent)){Re("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{Re("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let f=new er({provider:d});p&&f.addCaptchaToken(p),t.startAuthFlow(f);let y=await t.authFlow.getAuthorizationUrl();y&&y.url&&window.location.assign(y.url)},async loginWithOAuth(d){if(!(t.authFlow instanceof er))throw new P("Must initialize OAuth flow before calling loginWithOAuth");let p=Ge.get(po),f=t.authFlow.meta.stateCode;if(p!==f)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d,storedStateCode:p??"",returnedStateCode:f??""}),new P("Unexpected auth flow. This may be a phishing attempt.");let y,O;if(a)try{y=await t.link(),K.current=d}catch(G){throw N(M,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}else try{({user:y,isNewUser:O}=await t.authenticate()),K.current=d}catch(G){throw J.current==="login"?N(M,"login","onError",G.privyErrorCode||"unknown_auth_error"):J.current==="link"&&N(M,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}c(y),E(O||!1),l(!0)},async initLoginWithHeadlessOAuth(d,p){if(Xs()){if(d==="google"&&Vs(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let f=new er({provider:d,headless:!0});p&&f.addCaptchaToken(p);let y=await t.startAuthFlow(f).getAuthorizationUrl();y?.url&&window.location.assign(y.url)},async loginWithHeadlessOAuth(d){T(!0),t.startAuthFlow(new er(d));let p=Ge.get(po),f=d.stateCode;if(p!==f)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d.provider,storedStateCode:p??"",returnedStateCode:f??""}),T(!1),new P("Unexpected auth flow. This may be a phishing attempt.");let y,O;if(a)try{y=await t.link(),K.current=d.provider}catch(G){throw N(M,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}else try{({user:y,isNewUser:O}=await t.authenticate()),K.current=d.provider}catch(G){throw J.current==="login"?N(M,"login","onError",G.privyErrorCode||"unknown_auth_error"):J.current==="link"&&N(M,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}return c(y),E(O||!1),l(!0),T(!1),y??void 0},initLoginWithEmail:async(d,p)=>{let f=new Nr(d,p);t.startAuthFlow(f);try{K.current="email",await f.sendCodeEmail()}catch(y){throw J.current==="login"?N(M,"login","onError",y.privyErrorCode||"unknown_auth_error"):J.current==="link"&&N(M,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},initUpdateEmail:async(d,p,f)=>{let y=new Bi(d,p,f);t.startAuthFlow(y),await y.sendCodeEmail()},initLoginWithSms:async(d,p)=>{let f=new ho(d,p);t.startAuthFlow(f);try{K.current="sms",await f.sendSmsCode()}catch(y){throw J.current==="login"?N(M,"login","onError",y.privyErrorCode||"unknown_auth_error"):J.current==="link"&&N(M,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new Io;if(t.authFlow instanceof Nr)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof ho)t.authFlow.meta.smsCode=d.trim();else throw new P("Must initialize a passwordless code flow first");let p,f;if(a)try{p=await t.link()}catch(y){throw N(M,"linkAccount","onError",y.privyErrorCode||"failed_to_link_account"),y}else try{({user:p,isNewUser:f}=await t.authenticate())}catch(y){throw N(M,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}c(p||s||null),E(f||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:k,createAnalyticsEvent:(d,p,f)=>t.createAnalyticsEvent(d,p,f),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let f=s?.linkedAccounts.find(O=>O.type==="wallet"&&O.walletClientType==="privy"),y=await Me();if(!y||!k||!f){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ee(!0);try{await k.connect({accessToken:y,address:f.address}),d(!0)}catch(O){Eo(O)&&f.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:f.address}),(await k.recover({address:f.address,accessToken:y})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:f.address}),d(!0)):Eo(O)?($({recoverWallet:{privyWallet:f,onFailure:p,onSuccess:()=>d(!0)}}),q("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(O)}}),getFiatOnRampConfig:Qt,setReadyToTrue:()=>{i(!0),be?.()},updateWallets:()=>Or(),fundWallet:async(d,p)=>{let{signedUrl:f,externalTransactionId:y}=await Qt(d,p);$({fiatOnRampPrompt:{signedUrl:f},fiatOnRampStatus:{externalTransactionId:y}}),q("FIAT_ON_RAMP_PROMPT_SCREEN")}}))();Sy=ue.recoverEmbeddedWallet;let Ry=g4(()=>({wallets:u,ready:xe}),[u,xe]);return vr(ae.Provider,{value:Ro,children:vr(Cl.Provider,{value:M,children:vr(Bc.Provider,{value:Ry,children:Ey(Kp,{...L,children:[e.children,Ey(wl.Provider,{value:ue,children:[!Zc&&L.captchaEnabled&&n&&!a&&vr(vl,{delayedExecution:!1}),vr(hy,{theme:{...L.appearance.palette||{}}}),vr(Gp,{data:Q,setModalData:$,setInitialScreen:x,initialScreen:v,authenticated:a,open:r,children:vr(wy,{open:r})}),ie&&j?vr(by,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Lr,mfaSubmitPromise:Zt,onLoad:z,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as E4}from"react";function P4(e){let{login:t}=E4(ae);return ve("login",e),{login:t}}import{useContext as T4}from"react";function x4(e){let{logout:t}=T4(ae);return ve("logout",e),{logout:t}}import{useCallback as _y,useEffect as S4}from"react";function _4(){let e=de(),t=Ta(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=H(),l=_y(async c=>{if(e.enabled&&e.status!=="success")throw new Ht(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=_y(async()=>{let c=Gn();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");try{return await o(c)}catch(u){throw u}finally{Vn()}},[o]);return S4(()=>{let c=Gn();i&&t&&c.inProgress&&c.headless&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}import{useCallback as Ay}from"react";var A4=()=>{let e=de(),{initLoginWithEmail:t,loginWithCode:r}=H(),o=Ay(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=Ay(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Ht(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useCallback as ky}from"react";var k4=()=>{let e=de(),{initLoginWithSms:t,loginWithCode:r}=H(),o=ky(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return t(i)},[t]),n=ky(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Ht(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};import{useContext as R4}from"react";function I4(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:m,linkFarcaster:h}=R4(ae);return ve("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:m,linkFarcaster:h}}import{useContext as M4}from"react";function W4(e){let{connectWallet:t}=M4(ae);return ve("connectWallet",e),{connectWallet:t}}import{useContext as L4}from"react";function O4(e){let{createWallet:t}=L4(ae);return ve("createWallet",e),{createWallet:t}}var N4=()=>{let{fundWallet:e}=H();return{fundWallet:e}};import{useContext as D4}from"react";function U4(e){let{sendTransaction:t}=D4(ae);return ve("sendTransaction",e),{sendTransaction:t}}import{useContext as F4}from"react";function B4(e){let{setWalletPassword:t}=F4(ae);return ve("setWalletPassword",e),{setWalletPassword:t}}import{useContext as H4}from"react";function G4(e){let{signMessage:t}=H4(ae);return ve("signMessage",e),{signMessage:t}}import{useContext as V4}from"react";function z4(e){let{signTypedData:t}=V4(ae);return ve("signTypedData",e),{signTypedData:t}}import{useContext as $4}from"react";var q4=()=>{let{isModalOpen:e}=$4(ae);return{isOpen:e}};import{useContext as j4}from"react";function K4(e){let{getAccessToken:t}=j4(ae);return ve("accessToken",e),{getAccessToken:t}}function Y4(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{tr as AsExternalProvider,vl as Captcha,Kn as ConnectorManager,Yn as PrivyClient,C4 as PrivyProvider,ge as PrivyProxyProvider,qn as SUPPORTED_CHAINS,ol as VERSION,lt as WalletConnector,Y4 as addRpcUrlOverrideToChain,jl as errorIndicatesMaxMfaRetries,ln as errorIndicatesMfaTimeout,cn as errorIndicatesMfaVerificationFailed,Me as getAccessToken,W4 as useConnectWallet,O4 as useCreateWallet,N4 as useFundWallet,I4 as useLinkAccount,P4 as useLogin,A4 as useLoginWithEmail,_4 as useLoginWithOAuth,k4 as useLoginWithSms,x4 as useLogout,Tn as useMfa,Pi as useMfaEnrollment,q4 as useModalStatus,H as usePrivy,bl as useRegisterMfaListener,U4 as useSendTransaction,B4 as useSetWalletPassword,G4 as useSignMessage,z4 as useSignTypedData,K4 as useToken,Ri as useWallets};
|