@privy-io/react-auth 1.43.2-beta-20231006232842 → 1.43.2-beta-20231006233355

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 CHANGED
@@ -1,4 +1,4 @@
1
- var Cu=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var ds=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)};var ps=(e,t,o)=>(Cu(e,t,"access private method"),o);import{getAddress as Ci}from"@ethersproject/address";import{StaticJsonRpcProvider as Sv,Web3Provider as rs}from"@ethersproject/providers";import{useEffect as Tt,useMemo as Av,useRef as iu,useState as Q}from"react";import{FetchError as bu}from"ofetch";var et=class extends Error{constructor(o,r,n){super(o);r instanceof Error&&(this.cause=r),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Uo=class extends et{constructor(o,r,n,i,a){super(n,i,a);this.type=o;this.status=r}},C=class extends et{constructor(o,r,n){super(o,r,n);this.type="client_error"}},Kr=class extends C{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var F=class extends et{constructor(o,r,n){super(o,r,n);this.type="connector_error"}},ee=e=>{if(e instanceof et)return e;if(!(e instanceof bu))return De(e);if(!e.response)return new Uo("api_error",null,e.message,e);let{type:t,message:o,error:r,code:n}=e.data;return new Uo(t||"ApiError",e.response.status,o||r,e,n)},De=e=>e instanceof et?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var fr=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Me=class extends C{constructor(t="Embedded wallet error",o){super(t,o,"unknown_embedded_wallet_error")}},Yr=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Jr=()=>"/api/v1/sessions",us=()=>"/api/v1/sessions/logout",ms=()=>"/api/v1/sessions/fork",Qr=()=>"/api/v1/sessions/fork/recover",hs=()=>"/api/v1/siwe/init",fs=()=>"/api/v1/siwe/authenticate",ys=()=>"/api/v1/siwe/link",gs=()=>"/api/v1/passwordless/init",vs=()=>"/api/v1/passwordless/authenticate",ws=()=>"/api/v1/passwordless/link",Cs=()=>"/api/v1/passwordless_sms/init",bs=()=>"/api/v1/passwordless_sms/authenticate",Es=()=>"/api/v1/passwordless_sms/link",xs=()=>"/api/v1/oauth/init",Ts=()=>"/api/v1/oauth/authenticate",Ps=()=>"/api/v1/oauth/link",_s=()=>"/api/v1/siwe/unlink",Ss=()=>"/api/v1/passwordless/unlink",As=()=>"/api/v1/passwordless_sms/unlink",ks=()=>"/api/v1/oauth/unlink",Rs=()=>"/api/v1/analytics_events",Ws=()=>"/api/v1/plugins/moonpay_on_ramp/sign",Is=()=>"/api/v1/custom_jwt_account/authenticate";var Fo=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=Is(),o=await this.api.post(t,{token:this.meta.token});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ee(t)}}async link(){throw new Error("Unimplemented")}};var yo=class{constructor(t,o){this.meta={email:t,captchaToken:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=vs(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ee(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=ws();return await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ee(t)}}async sendCodeEmail(t,o){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),o&&(this.meta.captchaToken=o),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{let r=gs();return await this.api.post(r,{email:this.meta.email,token:this.meta.captchaToken})}catch(r){throw ee(r)}}};var Gt=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=Ts(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){let o=ee(t);throw o.privyErrorCode?new C(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=Ps();return await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})}catch(t){throw ee(t)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initialzing OAuth authentication.");try{let t=xs();return await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href},{baseURL:this.api?.fallbackApiUrl})}catch(t){throw ee(t)}}};var Ve=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 go=class{constructor(t){this.createSiweMessage=(t,o,r,n,i,a,l)=>`${r} wants you to sign in with your Ethereum account:
1
+ var Cu=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var ds=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)};var ps=(e,t,o)=>(Cu(e,t,"access private method"),o);import{getAddress as Ci}from"@ethersproject/address";import{StaticJsonRpcProvider as Sv,Web3Provider as rs}from"@ethersproject/providers";import{useEffect as Pt,useMemo as Av,useRef as iu,useState as Q}from"react";import{FetchError as bu}from"ofetch";var et=class extends Error{constructor(o,r,n){super(o);r instanceof Error&&(this.cause=r),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Uo=class extends et{constructor(o,r,n,i,a){super(n,i,a);this.type=o;this.status=r}},C=class extends et{constructor(o,r,n){super(o,r,n);this.type="client_error"}},Kr=class extends C{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var F=class extends et{constructor(o,r,n){super(o,r,n);this.type="connector_error"}},ee=e=>{if(e instanceof et)return e;if(!(e instanceof bu))return De(e);if(!e.response)return new Uo("api_error",null,e.message,e);let{type:t,message:o,error:r,code:n}=e.data;return new Uo(t||"ApiError",e.response.status,o||r,e,n)},De=e=>e instanceof et?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var fr=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Me=class extends C{constructor(t="Embedded wallet error",o){super(t,o,"unknown_embedded_wallet_error")}},Yr=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Jr=()=>"/api/v1/sessions",us=()=>"/api/v1/sessions/logout",ms=()=>"/api/v1/sessions/fork",Qr=()=>"/api/v1/sessions/fork/recover",hs=()=>"/api/v1/siwe/init",fs=()=>"/api/v1/siwe/authenticate",ys=()=>"/api/v1/siwe/link",gs=()=>"/api/v1/passwordless/init",vs=()=>"/api/v1/passwordless/authenticate",ws=()=>"/api/v1/passwordless/link",Cs=()=>"/api/v1/passwordless_sms/init",bs=()=>"/api/v1/passwordless_sms/authenticate",Es=()=>"/api/v1/passwordless_sms/link",xs=()=>"/api/v1/oauth/init",Ps=()=>"/api/v1/oauth/authenticate",Ts=()=>"/api/v1/oauth/link",_s=()=>"/api/v1/siwe/unlink",Ss=()=>"/api/v1/passwordless/unlink",As=()=>"/api/v1/passwordless_sms/unlink",ks=()=>"/api/v1/oauth/unlink",Rs=()=>"/api/v1/analytics_events",Ws=()=>"/api/v1/plugins/moonpay_on_ramp/sign",Is=()=>"/api/v1/custom_jwt_account/authenticate";var Fo=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=Is(),o=await this.api.post(t,{token:this.meta.token});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ee(t)}}async link(){throw new Error("Unimplemented")}};var yo=class{constructor(t,o){this.meta={email:t,captchaToken:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=vs(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ee(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=ws();return await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ee(t)}}async sendCodeEmail(t,o){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),o&&(this.meta.captchaToken=o),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{let r=gs();return await this.api.post(r,{email:this.meta.email,token:this.meta.captchaToken})}catch(r){throw ee(r)}}};var Gt=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=Ps(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){let o=ee(t);throw o.privyErrorCode?new C(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=Ts();return await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})}catch(t){throw ee(t)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initialzing OAuth authentication.");try{let t=xs();return await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href},{baseURL:this.api?.fallbackApiUrl})}catch(t){throw ee(t)}}};var Ve=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 go=class{constructor(t){this.createSiweMessage=(t,o,r,n,i,a,l)=>`${r} wants you to sign in with your Ethereum account:
2
2
  ${o}
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 Ve(this._getNonceOnce.bind(this)),this.wallet=t}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(fs(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(t){throw ee(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(ys(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ee(t)}}async sign(){if(!this.api)throw new C("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new C("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 C("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(hs(),{address:t})).nonce}async buildSiweMessage(){if(!this.api)throw new C("Auth flow has no API instance");let t=this.wallet.address,o=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(o,t,this.nonce),this.preparedMessage}prepareMessage(t,o,r){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,o,n,i,l,r,a)}};var vo=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=bs(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ee(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=Es();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ee(t)}}async sendSmsCode(t,o){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{let r=Cs();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw ee(r)}}};import{v4 as cm}from"uuid";function qe(e){return new Date(e*1e3)}function Eu(e){let t=[];for(let o of e){let r=o.type;switch(o.type){case"wallet":let n={address:o.address,type:o.type,verifiedAt:qe(o.verified_at),chainType:"ethereum",chainId:o.chain_id,walletClient:o.wallet_client_type==="privy"?"privy":"unknown",walletClientType:o.wallet_client_type,connectorType:o.connector_type,recoveryMethod:o.recovery_method};t.push(n);break;case"email":let i={address:o.address,type:o.type,verifiedAt:qe(o.verified_at)};t.push(i);break;case"phone":let a={number:o.phoneNumber,type:o.type,verifiedAt:qe(o.verified_at)};t.push(a);break;case"google_oauth":let l={subject:o.subject,email:o.email,name:o.name,type:o.type,verifiedAt:qe(o.verified_at)};t.push(l);break;case"twitter_oauth":let s={subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:qe(o.verified_at)};t.push(s);break;case"discord_oauth":let c={subject:o.subject,username:o.username,email:o.email,type:o.type,verifiedAt:qe(o.verified_at)};t.push(c);break;case"github_oauth":let m={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:qe(o.verified_at)};t.push(m);break;case"tiktok_oauth":let h={subject:o.subject,username:o.username,type:o.type,verifiedAt:qe(o.verified_at)};t.push(h);break;case"linkedin_oauth":let w={subject:o.subject,name:o.name,email:o.email,type:o.type,verifiedAt:qe(o.verified_at)};t.push(w);break;case"apple_oauth":let f={subject:o.subject,email:o.email,type:o.type,verifiedAt:qe(o.verified_at)};t.push(f);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:qe(o.verified_at)});break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function ct(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var Z=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,xu=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),zt=(e,t)=>t==="all-users"&&!Z(e)||t==="users-without-wallets"&&!xu(e)?.length;function _t(e){if(!e)return null;let t=Eu(e.linked_accounts),o=ct(t,"wallet"),r=ct(t,"email"),n=ct(t,"phone"),i=ct(t,"google_oauth"),a=ct(t,"twitter_oauth"),l=ct(t,"discord_oauth"),s=ct(t,"github_oauth"),c=ct(t,"tiktok_oauth"),m=ct(t,"linkedin_oauth"),h=ct(t,"apple_oauth");return{id:e.id,createdAt:qe(e.created_at),linkedAccounts:t,email:r&&{address:r?.address},phone:n&&{number:n?.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletClient:o.walletClient,walletClientType:o.walletClientType,connectorType:o.connectorType,recoveryMethod:o.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name},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},tiktok:c&&{subject:c.subject,username:c.username},linkedin:m&&{subject:m.subject,name:m.name},apple:h&&{subject:h.subject,email:h.email}}}import{getAddress as gl}from"@ethersproject/address";import nm from"eventemitter3";var Ns="1.43.2-beta-20231006232842";var Zr="4df5e2316331463a9130964bd6078dfa",Ls="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Os="34357d3c125c2bcf2ce2bc3309d98715",Ms="0x4AAAAAAAJFhr_rDU7HKpyw",Xr="https://auth.privy.io",Ds=2e4,Ue=1400,Us=2500,Ti=Ns;var Ho="privy:token",Pi="privy-token",en="privy:refresh_token",_i="privy-refresh-token",Fs="privy-session",yr="privy:session_transfer_token",Pu="privy:wallet",gr="privy:caid",tn=e=>`${Pu}:${e}`,Si="privy:connectors",Ai="privy:connections";var dt=1,ki="0x1",Bs="https://api.moonpay.com/v1",Hs="https://api.moonpay.com/v1",Gs="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",zs="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Ri=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Wi=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function _u(){return typeof window<"u"&&window.localStorage?new Wi:new Ri}var z=_u();import{isPossiblePhoneNumber as Su}from"libphonenumber-js/min";var rn=()=>{let e=window;if(!e.ethereum)return!1;if(on(window.ethereum,!0))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(on(t,!0))return!0}return!1},vr=()=>{let e=window;if(!e.ethereum)return!1;if(on(window.ethereum,!1))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(on(t,!1))return!0}return!!window.ethereum.isZerion},on=(e,t)=>e.isMetaMask?e.isMetaMask&&!t?!0:!(e.isBraveWallet&&!e._events&&!e._state||e.isApexWallet||e.isAvalanche||e.isBitKeep||e.isBlockWallet||e.isKuCoinWallet||e.isMathWallet||e.isOkxWallet||e.isOKExWallet||e.isOneInchIOSWallet||e.isOneInchAndroidWallet||e.isOpera||e.isPhantom||e.isPortal||e.isRabby||e.isRainbow||e.isTokenPocket||e.isTokenary||e.isZerion):!1,je=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),nn=()=>{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.isCoinbaseWallet)return!0}return!1};var $s=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,}))$/),Vs=e=>Su(String(e),"US"),qs=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},$t=(e,t=3,o=4)=>{if(!e)return"";let r=2,n=3;if(t+o+r+n>=e.length)return e;let i=e.slice(0,r+t),a=e.slice(e.length-o,e.length);return`${i}...${a}`},Ii=e=>new Promise(t=>setTimeout(t,e)),js=(e,t={})=>{let o=t.delayMs||150,r=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<r;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await Ii(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},an=(e,t,o={})=>{let r=new URL(t,e);for(let[n,i]of Object.entries(o))r.searchParams.set(n,i);return r.href};var Ni=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),wr=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Ks(e=3e3){let t=!1,o=window;return new Promise(r=>{o.ethereum?n():(window.addEventListener("ethereum#initialized",n,{once:!0}),setTimeout(()=>{n()},e));function n(){if(t)return;t=!0,window.removeEventListener("ethereum#initialized",n);let i=[];rn()&&i.push("metamask"),je()&&i.push("phantom"),o.ethereum&&o.ethereum.isBraveWallet&&i.push("brave"),r(i)}})}function sn(e){return`eip155:${String(Number(e))}`}var tt=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new F(`Unsupported chainId ${e}`,4901);let i;if(o.rpcUrls[r]?i=o.rpcUrls[r]:n.rpcUrls.infura?.http[0]?i=n.rpcUrls.infura.http[0]+"/"+Zr:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+Ls:i=n.rpcUrls.default?.http[0],!i)throw new F(`No RPC url found for ${e}`);return i},Ys=(e,t)=>{let o=Number(e),r=t.find(n=>n.id===o);if(!r)throw new F(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url};import Uu from"@coinbase/wallet-sdk";import{jsx as Js,jsxs as Au}from"react/jsx-runtime";var pt=({style:e,...t})=>Au("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:[Js("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Js("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 ft}from"@ethersproject/address";import{Web3Provider as ol}from"@ethersproject/providers";import{default as Mu}from"eventemitter3";import{StaticJsonRpcProvider as Zs}from"@ethersproject/providers";import Lu from"eventemitter3";var ku=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Qs=e=>ku.includes(e);import{ErrorCode as Ru}from"@ethersproject/logger";var Go=class extends F{constructor(){super("Wallet timeout");this.type="wallet_error"}},zo=class extends F{constructor(){super("User rejected connection");this.type="wallet_error"}},mt=e=>{if(e instanceof F)return e;if(e?.code&&e?.reason){let t=new Ee(e);return e.code===Ru.ACTION_REJECTED&&(t.details=Ae.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ee(e):new F("Unknown connector error",e)},ut=class extends et{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Ee=class extends ut{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(Ae).find(i=>i.eipCode===r.code);this.details=n||Ae.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=Ae.E32002_CONNECTION_ALREADY_PENDING:this.details=Ae.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ae.E32002_WALLET_LOCKED))}},Wu={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}},Iu={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Nu={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}},Ae={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Nu,...Iu},St={...Wu,...Ae};var Ou=12e4,Li=(e=new Go,t=Ou)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),X=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(o=>{this.removeListener(o.eventName,o.listener)}),this.walletProvider=t,this._subscriptions.forEach(o=>{this.walletProvider?.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new F(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),Li()]).catch(o=>{throw mt(o)})}},Vt=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},ln=class extends Lu{constructor(o,r,n,i,a=1){super();this.walletProxy=o,this.address=r,this.chainId=a,this.rpcConfig=n,this.chains=i,this.provider=new Zs(tt(a,this.chains,n))}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new Vt(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await At()||!this.address)throw new Vt("Disconnected",4900);return(await el(r)).transactionHash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new Vt(`Invalid params for ${o.method}`,4200);let r;if(typeof o.params[0]=="string")r=o.params[0];else if("chainId"in o.params[0]&&typeof o.params[0].chainId=="string")r=o.params[0].chainId;else throw new Vt(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new Zs(tt(this.chainId,this.chains,this.rpcConfig)),this.emit("chainChanged",r)}async handlePersonalSign(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");let r=o.params[0];return await Xs(r)}async handleEstimateGas(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");delete o.params[0].gasPrice,delete o.params[0].maxFeePerGas,delete o.params[0].maxPriorityFeePerGas;let r={...o.params[0],chainId:wr(this.chainId)};try{return await this.provider.send("eth_estimateGas",[r])}catch{return delete r.from,await this.provider.send("eth_estimateGas",[r])}}async request(o){switch(console.debug("Embedded1193Provider.request() called with args",o),o.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return wr(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(o);case"eth_sendTransaction":return this.handleSendTransaction(o);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(o);case"personal_sign":return this.handlePersonalSign(o);default:break}if(Qs(o.method)){let r=await At();if(await tl(),!r||!this.address)throw new Vt("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:r,request:{method:o.method,params:o.params}})).response.data}catch(n){throw console.error(n),new Vt("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await At();if(!o||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:o})).address}catch(r){return console.error(r),null}}},ht=class extends X{constructor(o){super(o)}},qt=class extends X{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Du=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Fe=class extends Mu{constructor(o,r,n){super();this.onAccountsChanged=o=>{o.length===0?this.onDisconnect():this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=sn(o),this.walletClientType==="privy"&&z.put(tn(r.address),o)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=o,this.chains=r,this.defaultChain=n,this.connected=!1,this.initialized=!1}buildConnectedWallet(o,r){let n=async()=>!!this.wallets.find(i=>ft(i.address)===ft(o));return{address:ft(o),chainId:r,switchChain:async i=>{if(!n)throw new F("Wallet is not currently connected.");let a=this.wallets.find(h=>ft(h.address)===ft(o))?.chainId;if(!a)throw new F("Unable to determine current chainId.");let l,s;if(typeof i=="number"?(l=`0x${i.toString(16)}`,s=i):(l=i,s=Number(i)),a===sn(l))return;let c=this.chains.find(h=>h.id===s);if(!c)throw new F(`Unsupported chainId: ${i}`);let m=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})};try{return await m()}catch(h){if(Du(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:l,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:[c.rpcUrls.public?.http[0]??""],blockExplorerUrls:[c.blockExplorers?.default.url??""]}]}),m();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new F(`Rainbow does not support the chainId ${r}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:n,getEthereumProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return new ol(new ht(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return new qt(this.proxyProvider)},sign:async i=>{if(!await n())throw new F("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;if(r===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(r=c)}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let n=r[0],i=ft(n),a=[],l;if(this.walletClientType==="privy"){let c=z.get(tn(i));this.chains.find(m=>m.id===Number(c))||(z.del(tn(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")throw new Error("Invalid chainId returned from provider");l=c}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${ki}`,c),l=ki}let s=sn(l);a.find(c=>ft(c.address)===i)||a.push(this.buildConnectedWallet(ft(n),s)),cn(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let o=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((r,n)=>n.connectedAt-r.connectedAt).find(r=>o.find(n=>ft(n)===ft(r.address)))||null}async isConnected(){let o=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(o)&&o.length>0}async sign(o){return await this.connect({showPrompt:!1}),new ol(new ht(this.proxyProvider)).getSigner().signMessage(o)}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 Fu=e=>{let t=`https://mainnet.infura.io/v3/${Zr}`,o=1;return e.makeWeb3Provider(t,o)},dn,pn=class extends Fe{constructor(o,r){super("coinbase_wallet",o,r);this.connectorType="coinbase_wallet";this.proxyProvider=new X,this.subscribeListeners(),dn||(dn=new Uu({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(Fu(dn)),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){dn.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:pt}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw mt(o)}}};import{jsx as rl}from"react/jsx-runtime";var $o=({...e})=>rl("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:rl("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 un=class extends Fe{constructor(o,r,n){super("privy",r,n);this.connectorType="embedded";this.proxyProvider=o,this.subscribeListeners(),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[wr(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:$o}}disconnect(){this.connected=!1}async promptConnection(){}};import{getAddress as l2}from"@ethersproject/address";import{Web3Provider as d2}from"@ethersproject/providers";import{isMobile as Hu}from"react-device-detect";import{jsx as Be,jsxs as Bu}from"react/jsx-runtime";var Ce=({style:e,...t})=>Bu("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:[Be("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Be("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var mn=class extends Fe{constructor(o,r){super("metamask",o,r);this.connectorType="injected";this.proxyProvider=new X,this.subscribeListeners();let n=window,i=n.ethereum,a=n.ethereum.providers||[];for(let l of a)if(l.isMetaMask){i=l;break}this.proxyProvider.setWalletProvider(i),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"MetaMask",icon:Ce}}disconnect(){console.warn("Metamask does not support programmatic disconnect.")}async promptConnection(){try{!Hu&&rn()&&await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw mt(o)}}};import{jsx as nl,jsxs as Gu}from"react/jsx-runtime";var Ke=({style:e,...t})=>Gu("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:[nl("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),nl("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 hn=class extends Fe{constructor(o,r){super("phantom",o,r);this.connectorType="injected";this.proxyProvider=new X,this.subscribeListeners(),this.proxyProvider.setWalletProvider(window.phantom.ethereum),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"Phantom",icon:Ke}}disconnect(){console.warn("Phantom does not support programmatic disconnect.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw mt(o)}}};import{EthereumProvider as Xu,OPTIONAL_EVENTS as em,OPTIONAL_METHODS as tm}from"@walletconnect/ethereum-provider";import Di from"@walletconnect/qrcode-modal";import{isAndroid as om,isMobile as rm}from"react-device-detect";import{createContext as $u,useContext as Vu,useEffect as Oi,useRef as qu,useState as al}from"react";import{jsx as zu}from"react/jsx-runtime";function il(e){return zu("link",{rel:"prefetch",href:e.src})}var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as ju,jsxs as Ku}from"react/jsx-runtime";var ot="LANDING",sl=$u({ready:!1,app:null,currentScreen:ot,lastScreen:ot,navigate:x,navigateBack:x,resetNavigation:x,setModalData:x,outerClickRef:null}),ll=e=>{let t=e.appConfig,o=e.authenticated,r=e.visible,[n,i]=al(e.initialScreen||ot),[a,l]=al(e.initialScreen||ot);Oi(()=>{o||i(ot)},[o]),Oi(()=>{r||(l(ot),i(ot))},[r]),Oi(()=>{e.initialScreen&&n===ot&&(i(e.initialScreen),l(e.initialScreen))},[e.initialScreen]);let s=e.initialScreen&&n===ot?e.initialScreen:n,c=qu(null),m={ready:!!t?.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:s,lastScreen:a,navigate:h=>{l(n),i(h)},navigateBack:()=>{i(a)},resetNavigation:()=>{e.setInitialScreen(null),l(ot),i(ot)},outerClickRef:c};return Ku(sl.Provider,{value:m,children:[(typeof t?.appearance?.logo=="string"||t?.appearance?.logo?.type==="img")&&ju(il,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},v=()=>Vu(sl);import{jsx as Vo,jsxs as Yu}from"react/jsx-runtime";var qo=({style:e,...t})=>{let{app:o}=v();return Yu("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:[Vo("rect",{width:"28",height:"28",rx:"3",fill:o?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Vo("g",{clipPath:"url(#clip0_1765_9946)",children:Vo("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"})}),Vo("defs",{children:Vo("clipPath",{id:"clip0_1765_9946",children:Vo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};import{isAndroid as dl,isDesktop as Ju,isMobileOnly as Qu}from"react-device-detect";var fn=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(pl))if(r.hostname===t)return{walletClientType:o,entry:r}};var pl={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",image_id:"5195e9db-94d8-4579-6f11-ef553be95100",hostname:"metamask.io",mobile:{native:"metamask:"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",image_id:"0528ee7e-16d1-4089-21e3-bbfb41933100",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",image_id:"a1cb2777-f8f9-49b0-53fd-443d20ee0b00",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",image_id:"7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500",hostname:"rainbow.me",mobile:{universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",image_id:"bff9cf1f-df19-42ce-f62a-87f04df13c00",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",image_id:"f216b371-96cf-409a-9d88-296392b85800",hostname:"zerion.io",mobile:{universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",image_id:"215158d2-614b-49c9-410f-77aa661c3900",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",image_id:"1bf33a89-b049-4a1c-d1f6-4dd7419ee400",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",image_id:"2cd67b4c-282b-4809-e7c0-a88cd5116f00",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",image_id:"7c5ff577-a68d-49c5-02cd-3d83637b0b00",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",image_id:"6f913b80-86c0-46f9-61ca-cc90a1805900",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",image_id:"252753e7-b783-4e03-7f77-d39864530900",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",image_id:"3f7075d0-4ab7-4db5-404d-3e4c05e6fe00",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",image_id:"cfc07342-23ea-4f3f-f071-ec9d2cd86b00",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",image_id:"52b1da3c-9e72-40ae-5dac-6142addd9c00",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",image_id:"ebac7b39-688c-41e3-7912-a4fefba74600",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",image_id:"4c16cad4-cac9-4643-6726-c696efaf5200",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",image_id:"e2024511-2c9b-46d7-3111-52df3d241700",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",image_id:"5b1cddfb-056e-4e78-029a-54de5d70c500",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",image_id:"dda0f0fb-34e8-4a57-dcea-b008e7d1ff00",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",image_id:"26a8f588-3231-4411-60ce-5bb6b805a700",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",image_id:"4725dda0-4471-4d0f-7adf-6bbe8b929c00",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",image_id:"61abe2ca-b06d-4a8b-de3e-8326f523e900",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",image_id:"c39b3a16-1a38-4588-f089-cb7aeb584700",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",image_id:"204b2240-5ce4-4996-6ec4-f06a22726900",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",image_id:"fc460647-ea95-447a-99f0-1bff8fa4be00",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",image_id:"f9854c79-14ba-4987-42e1-4a82abbf5700",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",image_id:"f78dab27-7165-4a3d-fdb1-fcff06c0a700",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",image_id:"79285c9f-2630-451e-0680-c71b42fb7400",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",image_id:"2d8006c3-852b-458a-d6b0-916c5ba76800",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",image_id:"339b9e9d-e2a7-46eb-4ed3-272321257a00",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",image_id:"cae1be94-9f53-4eba-b915-f6e381d5a500",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",image_id:"7eec7187-3f48-4fda-53bb-b0ad55749a00",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",image_id:"add9626b-a5fa-4c12-178c-e5584e6dcd00",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",image_id:"c268e78d-ffb0-4c8b-5cad-04c3add48500",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",image_id:"a7106965-91cc-4a73-4688-c5c72ae0ed00",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",image_id:"f90bc33f-f085-40cf-7538-fae5ae84f900",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",image_id:"691c0716-5213-4b99-e837-079268313800",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",image_id:"a5d9dd15-8cef-42de-8bed-09e01a8b0200",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",image_id:"b57b2163-1bd8-4f6b-3311-470767e6d200",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",image_id:"3ccbd966-97e8-45a0-1ceb-6141a8978e00",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",image_id:"6487869b-1165-4f30-aa3a-115665be8300",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",image_id:"10c75467-6612-48ad-b97b-63985e922200",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",image_id:"363fae03-882a-4d81-a721-6e6f6e9ac500",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",image_id:"32e89601-0490-42fc-0cc4-8627d62a2000",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",image_id:"98183be0-3125-45ee-a6b6-fbd47ebefd00",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",image_id:"75dd1471-77e9-4811-ce57-ec8fc980ec00",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",image_id:"374258d3-c749-4f37-7815-77e61f798c00",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",image_id:"ea0140c7-787c-43a4-838f-d5ab6a342000",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}}},ul=(e,t="md")=>`https://registry.walletconnect.com/v2/logo/${t}/${e}`;function Mi(e){return{name:e.displayName||"",universalLink:e.mobile.universal||"",deepLink:e.mobile.native||""}}function Zu(e){let t="mobile";return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Mi(o))}function ml(){return Zu(pl)}function hl(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${e}`:""}function fl(e,t){return dl?e:hl(e,Mi(t))}var yl="WALLETCONNECT_DEEPLINK_CHOICE";function cl(e){let t=e.href.split("?")[0];z.put(yl,{...e,href:t})}var Cr=(e,t)=>{if(!e||Ju){z.del(yl);return}if(dl){cl({name:"Unknown",href:t||"wc:"});return}else if(Qu){let o=hl(t||"wc:",Mi(e));cl({name:e?.displayName||"",href:o})}};var br=class extends Fe{constructor(o,r,n,i,a){super(a||"unknown",n,i);this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.proxyProvider=new X,this.createProvider().then(l=>{if(this.provider=l,this.proxyProvider.setWalletProvider(l),this.subscribeListeners(),l.session){if(this.walletProvider.session?.peer.metadata.url){let s=fn(this.walletProvider.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",Cr(this.walletEntry)}this.connected=!0,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}else this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return this.walletProvider.connected}get walletBranding(){return this.walletEntry?{name:this.walletEntry.displayName,icon:this.walletClientType==="metamask"?Ce:ul(this.walletEntry.image_id)}:{name:Ni(this.walletProvider.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider.session?.peer.metadata.icons?.[0]||qo}}resetConnection(){this.walletProvider&&this.walletProvider.connected&&(this.walletProvider.signer.session=void 0,this.walletEntry=void 0,Cr(void 0),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new zo)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider.enable(),Li()]);if(l.length>0&&(a=l[0]),!a||a==="")throw new F("Unable to retrieve address");if(this.walletProvider.session?.peer.metadata.url){let s=fn(this.walletProvider.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts(l),o()})().catch(a=>{if(a){r(mt(a));return}r(new F("Unknown error during connection"))}).finally(()=>Di.close())})}disconnect(){this.walletProvider.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){let o={};for(let n of this.chains){let i=tt(n.id,this.chains,this.rpcConfig);i&&(o[n.id]=i)}let r=await Xu.init({projectId:this.walletConnectCloudProjectId,chains:[this.defaultChain.id],optionalChains:this.chains.map(n=>n.id),optionalEvents:em,optionalMethods:tm,rpcMap:o,showQrModal:!1});return r.on("display_uri",n=>{if(om)window.open(n,"_self");else if(rm&&this.walletEntry){Cr(this.walletEntry,n);let a=fl(n,this.walletEntry);window.open(a,"_self","noopener,noreferrer")}else Di.open(n,()=>{this.onQrModalClosed&&this.onQrModalClosed()},{mobileLinks:ml().map(i=>i.name)})}),r.on("connect",()=>{if(Di.close(),r.session?.peer.metadata.url){let n=fn(r.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown",Cr(this.walletEntry)}}),r}async enableProvider(){return this.walletProvider.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider.enable()}};var Ui=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===gl(t)).length:!1},Er=class extends nm{constructor(o,r,n,i){super();this.getEthereumProvider=()=>{let o=this.wallets[0],r=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===o?.address));return!o||!r?new X:r.proxyProvider};this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let o=new Set,r=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 o.has(a)?!1:(o.add(a),!0)}),n=r.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&r.unshift(r.splice(n,1)[0]),r}initialize(){this.initialized||(z.get(Si)&&(z.getKeys().forEach(o=>{o.startsWith("walletconnect")&&z.del(o)}),z.del(Si)),Ks().then(o=>o.forEach(r=>{switch(r){case"metamask":this.createWalletConnector("injected","metamask");break;case"phantom":this.createWalletConnector("injected","phantom");break;case"unknown":default:break}})),(nn()||z.getKeys().find(o=>o.startsWith("-walletlink")))&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),this.createWalletConnector("wallet_connect_v2","unknown"),this.initialized=!0)}findWalletConnector(o,r){return o==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===o)||null:this.walletConnectors.find(n=>n.connectorType===o&&n.walletClientType===r)||null}onInitialized(o){o.wallets.forEach(r=>{let n=this.storedConnections.find(i=>i.address===r.address&&i.connectorType===r.connectorType&&i.walletClientType===r.walletClientType);n&&(r.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated")}onWalletsUpdated(o){o.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(o,r,n){if(!this.findWalletConnector("embedded","privy")){let a=new ln(o,r,this.rpcConfig,this.chains,n.id),l=new un(a,this.chains,n);this.addWalletConnector(l)}}removeEmbeddedWalletConnector(){let o=this.findWalletConnector("embedded","privy");if(o){let r=this.walletConnectors.indexOf(o);this.walletConnectors.splice(r,1),this.saveConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(o,r){let n=this.findWalletConnector(o,r);if(n)return n instanceof br&&n.resetConnection(),n;let a=(()=>{switch(o){case"injected":switch(r){case"phantom":return je()?new hn(this.chains,this.defaultChain):null;case"metamask":default:return vr()?new mn(this.chains,this.defaultChain):null}case"coinbase_wallet":return new pn(this.chains,this.defaultChain);case"wallet_connect_v2":return new br(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain)}})();return a&&this.addWalletConnector(a),a||null}addWalletConnector(o){this.walletConnectors.push(o),o.on("initialized",()=>this.onInitialized(o)),o.on("walletsUpdated",()=>this.onWalletsUpdated(o))}loadConnectionHistory(){let o=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",r=z.get(Ai);return r&&Array.isArray(r)&&r.map(a=>o(a)).every(Boolean)?r:[]}saveConnectionHistory(){let o=this.wallets.map(r=>({address:r.address,connectorType:r.connectorType,walletClientType:r.walletClientType,connectedAt:r.connectedAt}));z.put(Ai,o)}async activeWalletSign(o){let r=this.wallets,n=r.length>0?r[0]:null;return n?n.sign(o):null}setActiveWallet(o){this.activeWallet=gl(o),this.emit("walletsUpdated")}};function cn(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++){let r=e[o],n=t[o];if(r?.address!==n?.address||r?.chainId!==n?.chainId||r?.connectorType!==n?.connectorType||r?.connectedAt!==n?.connectedAt||r?.walletClientType!==n?.walletClientType||r?.isConnected!==n?.isConnected||r?.linked!==n?.linked)return!1}return!0}import{ofetch as im}from"ofetch";var am=[Jr(),Qr()],sm=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal},yn=class{constructor(t,o,r){this.appId=t,this.sdkVersion=Ti,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=im.create({baseURL:this.defaults.baseURL,retry:3,retryDelay:500,credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!am.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.signal||(i.signal=sm(this.defaults.timeout))},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Kr}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw ee(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw ee(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw ee(r)}}};import xr from"js-cookie";function vl(e){return e instanceof yo?"email":e instanceof vo?"sms":e instanceof go?"siwe":e instanceof Fo?"custom_auth":e instanceof Gt?e.meta.provider:null}import*as wl from"jose";var yt=class{static parse(t){try{return new yt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=wl.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 o=Date.now(),r=(this.expiration-t)*1e3;return o>=r}};var lm=30,gn=class{constructor(){this.authenticateOnce=new Ve(async t=>this._authenticate(t)),this.linkOnce=new Ve(async t=>this._link(t)),this.refreshOnce=new Ve(this._refresh.bind(this)),this.destroyOnce=new Ve(this._destroy.bind(this)),this.forkSessionOnce=new Ve(this._forkSession.bind(this))}get token(){try{let t=z.get(Ho);return typeof t=="string"?new yt(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=z.get(en);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=z.get(yr);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=xr.get(Fs);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=yt.parse(this.token);return t!==null&&!t.isExpired(lm)}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:o,refresh_token:r,user:n,is_new_user:i}=await t.authenticate();this.storeToken(o),this.storeRefreshToken(r);let a=vl(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:_t(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),De(o)}}async _link(t){try{let o=await t.link();return _t(o)}catch(o){throw console.warn("Error linking account"),De(o)}}async _refresh(){if(!this.api)throw new C("Session has no API instance");if(!this.client)throw new C("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,o=this.refreshToken,r=this.forkedToken;try{let n;if(t&&o||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=o?{refresh_token:o}:{};n=await this.api.post(Jr(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(Qr(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),_t(n.user)}catch(n){if(n instanceof Uo&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw De(n)}}async _destroy(){try{await this.api?.post(us(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new C("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(ms(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw De(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){if(z.put(Ho,t),!this.client?.useServerCookies){let o=yt.parse(t)?.expiration;xr.set(Pi,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else z.del(Ho),xr.remove(Pi)}storeRefreshToken(t){typeof t=="string"?(z.put(en,t),this.client?.useServerCookies||xr.set(_i,t,{sameSite:"Strict",secure:!0,expires:30})):(z.del(en),xr.remove(_i))}clearForkedToken(){z.del(yr)}};var Fi,vn,Cl,Tr=class{constructor(t){ds(this,vn);this.apiUrl=t.apiUrl||Xr,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Ds,this.appId=t.appId,this.clientAnalyticsId=ps(this,vn,Cl).call(this),Fi||(Fi=new gn),this.session=Fi,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r,n){this.connectors||(this.connectors=new Er(t,o,r,n))}generateApi(){let t=new yn(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 C("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){t.api=this.api,this.authFlow=t}async unlinkEmail(t){try{let o=await this.api.post(Ss(),{address:t});return _t(o)}catch(o){throw De(o)}}async unlinkPhone(t){try{let o=await this.api.post(As(),{phoneNumber:t});return _t(o)}catch(o){throw De(o)}}async unlinkWallet(t){try{let o=await this.api.post(_s(),{address:t});return _t(o)}catch(o){throw De(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(ks(),{provider:t,subject:o});return _t(r)}catch(r){throw De(r)}}async createAnalyticsEvent(t,o,r){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Rs(),{event_name:t,client_id:this.clientAnalyticsId,payload:{...o||{},clientTimestamp:r?r.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(Ws(),t)}catch(o){throw De(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?yt.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,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,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,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3)}}catch(t){throw De(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()}};vn=new WeakSet,Cl=function(){if(typeof window>"u")return null;try{let o=z.get(gr);if(typeof o=="string"&&o.length>0)return o}catch{}let t=cm();try{return z.put(gr,t),t}catch{return t}};import"wicg-inert";import{disableBodyScroll as j1,clearAllBodyScrollLocks as K1}from"body-scroll-lock";import{useRef as Y1,useCallback as J1}from"react";import{useEffect as Op}from"react";import Q1 from"react-dom";import es from"styled-components";import{createContext as dm,useContext as pm}from"react";var Bi=dm({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,rpcConfig:{rpcUrls:{}},chains:[],nativeTokenSymbolForChainId:x,captchaData:{enabled:!1,ready:!1,execute:x,remove:x,token:void 0,error:void 0},initializeWalletProxy:x,getAuthMeta:x,getAuthFlow:x,closePrivyModal:x,connectWallet:x,initLoginWithWallet:x,loginWithWallet:x,loginWithCode:x,initLoginWithEmail:x,initLoginWithSms:x,resendEmailCode:x,resendSmsCode:x,initLoginWithOAuth:x,loginWithOAuth:x,refreshUser:x,walletProxy:null,createAnalyticsEvent:x,getUsdTokenPrice:x,recoverEmbeddedWallet:x,getFiatOnRampConfig:x,updateWallets:x}),_=()=>pm(Bi);import{createContext as um,useContext as mm}from"react";var rt=um({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:x,login:x,linkEmail:x,linkPhone:x,linkWallet:x,linkGoogle:x,linkTwitter:x,linkDiscord:x,linkGithub:x,linkTiktok:x,linkLinkedIn:x,linkApple:x,logout:x,getAccessToken:x,getEthereumProvider:x,getEthersProvider:x,getWeb3jsProvider:x,unlinkEmail:x,unlinkPhone:x,unlinkWallet:x,unlinkGoogle:x,unlinkTwitter:x,unlinkDiscord:x,unlinkGithub:x,unlinkTiktok:x,unlinkLinkedIn:x,unlinkApple:x,setActiveWallet:x,forkSession:x,createWallet:x,signMessage:x,sendTransaction:x,exportWallet:x,setWalletPassword:x}),$=()=>mm(rt);import Ki from"styled-components";import Kt,{css as $i}from"styled-components";import Gi from"styled-components";import{Fragment as fm,jsx as Hi,jsxs as ym}from"react/jsx-runtime";var wn=({success:e,fail:t})=>ym(fm,{children:[Hi(wo,{className:e?"success":t?"fail":""}),Hi(zi,{className:e?"success":t?"fail":""})]}),wo=Gi.span`
12
+ - https://privy.io`;this.getNonceOnce=new Ve(this._getNonceOnce.bind(this)),this.wallet=t}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(fs(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});return{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(t){throw ee(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(ys(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ee(t)}}async sign(){if(!this.api)throw new C("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new C("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 C("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(hs(),{address:t})).nonce}async buildSiweMessage(){if(!this.api)throw new C("Auth flow has no API instance");let t=this.wallet.address,o=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(o,t,this.nonce),this.preparedMessage}prepareMessage(t,o,r){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,o,n,i,l,r,a)}};var vo=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=bs(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ee(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=Es();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ee(t)}}async sendSmsCode(t,o){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{let r=Cs();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw ee(r)}}};import{v4 as cm}from"uuid";function qe(e){return new Date(e*1e3)}function Eu(e){let t=[];for(let o of e){let r=o.type;switch(o.type){case"wallet":let n={address:o.address,type:o.type,verifiedAt:qe(o.verified_at),chainType:"ethereum",chainId:o.chain_id,walletClient:o.wallet_client_type==="privy"?"privy":"unknown",walletClientType:o.wallet_client_type,connectorType:o.connector_type,recoveryMethod:o.recovery_method};t.push(n);break;case"email":let i={address:o.address,type:o.type,verifiedAt:qe(o.verified_at)};t.push(i);break;case"phone":let a={number:o.phoneNumber,type:o.type,verifiedAt:qe(o.verified_at)};t.push(a);break;case"google_oauth":let l={subject:o.subject,email:o.email,name:o.name,type:o.type,verifiedAt:qe(o.verified_at)};t.push(l);break;case"twitter_oauth":let s={subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:qe(o.verified_at)};t.push(s);break;case"discord_oauth":let c={subject:o.subject,username:o.username,email:o.email,type:o.type,verifiedAt:qe(o.verified_at)};t.push(c);break;case"github_oauth":let m={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:qe(o.verified_at)};t.push(m);break;case"tiktok_oauth":let h={subject:o.subject,username:o.username,type:o.type,verifiedAt:qe(o.verified_at)};t.push(h);break;case"linkedin_oauth":let w={subject:o.subject,name:o.name,email:o.email,type:o.type,verifiedAt:qe(o.verified_at)};t.push(w);break;case"apple_oauth":let f={subject:o.subject,email:o.email,type:o.type,verifiedAt:qe(o.verified_at)};t.push(f);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:qe(o.verified_at)});break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function ct(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var Z=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,xu=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),zt=(e,t)=>t==="all-users"&&!Z(e)||t==="users-without-wallets"&&!xu(e)?.length;function _t(e){if(!e)return null;let t=Eu(e.linked_accounts),o=ct(t,"wallet"),r=ct(t,"email"),n=ct(t,"phone"),i=ct(t,"google_oauth"),a=ct(t,"twitter_oauth"),l=ct(t,"discord_oauth"),s=ct(t,"github_oauth"),c=ct(t,"tiktok_oauth"),m=ct(t,"linkedin_oauth"),h=ct(t,"apple_oauth");return{id:e.id,createdAt:qe(e.created_at),linkedAccounts:t,email:r&&{address:r?.address},phone:n&&{number:n?.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletClient:o.walletClient,walletClientType:o.walletClientType,connectorType:o.connectorType,recoveryMethod:o.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name},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},tiktok:c&&{subject:c.subject,username:c.username},linkedin:m&&{subject:m.subject,name:m.name},apple:h&&{subject:h.subject,email:h.email}}}import{getAddress as gl}from"@ethersproject/address";import nm from"eventemitter3";var Ns="1.43.2-beta-20231006233355";var Zr="4df5e2316331463a9130964bd6078dfa",Ls="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Os="34357d3c125c2bcf2ce2bc3309d98715",Ms="0x4AAAAAAAJFhr_rDU7HKpyw",Xr="https://auth.privy.io",Ds=2e4,Ue=1400,Us=2500,Pi=Ns;var Ho="privy:token",Ti="privy-token",en="privy:refresh_token",_i="privy-refresh-token",Fs="privy-session",yr="privy:session_transfer_token",Tu="privy:wallet",gr="privy:caid",tn=e=>`${Tu}:${e}`,Si="privy:connectors",Ai="privy:connections";var dt=1,ki="0x1",Bs="https://api.moonpay.com/v1",Hs="https://api.moonpay.com/v1",Gs="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",zs="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";var Ri=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Wi=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function _u(){return typeof window<"u"&&window.localStorage?new Wi:new Ri}var z=_u();import{isPossiblePhoneNumber as Su}from"libphonenumber-js/min";var rn=()=>{let e=window;if(!e.ethereum)return!1;if(on(window.ethereum,!0))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(on(t,!0))return!0}return!1},vr=()=>{let e=window;if(!e.ethereum)return!1;if(on(window.ethereum,!1))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(on(t,!1))return!0}return!!window.ethereum.isZerion},on=(e,t)=>e.isMetaMask?e.isMetaMask&&!t?!0:!(e.isBraveWallet&&!e._events&&!e._state||e.isApexWallet||e.isAvalanche||e.isBitKeep||e.isBlockWallet||e.isKuCoinWallet||e.isMathWallet||e.isOkxWallet||e.isOKExWallet||e.isOneInchIOSWallet||e.isOneInchAndroidWallet||e.isOpera||e.isPhantom||e.isPortal||e.isRabby||e.isRainbow||e.isTokenPocket||e.isTokenary||e.isZerion):!1,je=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),nn=()=>{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.isCoinbaseWallet)return!0}return!1};var $s=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,}))$/),Vs=e=>Su(String(e),"US"),qs=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},$t=(e,t=3,o=4)=>{if(!e)return"";let r=2,n=3;if(t+o+r+n>=e.length)return e;let i=e.slice(0,r+t),a=e.slice(e.length-o,e.length);return`${i}...${a}`},Ii=e=>new Promise(t=>setTimeout(t,e)),js=(e,t={})=>{let o=t.delayMs||150,r=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<r;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await Ii(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},an=(e,t,o={})=>{let r=new URL(t,e);for(let[n,i]of Object.entries(o))r.searchParams.set(n,i);return r.href};var Ni=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),wr=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Ks(e=3e3){let t=!1,o=window;return new Promise(r=>{o.ethereum?n():(window.addEventListener("ethereum#initialized",n,{once:!0}),setTimeout(()=>{n()},e));function n(){if(t)return;t=!0,window.removeEventListener("ethereum#initialized",n);let i=[];rn()&&i.push("metamask"),je()&&i.push("phantom"),o.ethereum&&o.ethereum.isBraveWallet&&i.push("brave"),r(i)}})}function sn(e){return`eip155:${String(Number(e))}`}var tt=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new F(`Unsupported chainId ${e}`,4901);let i;if(o.rpcUrls[r]?i=o.rpcUrls[r]:n.rpcUrls.infura?.http[0]?i=n.rpcUrls.infura.http[0]+"/"+Zr:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+Ls:i=n.rpcUrls.default?.http[0],!i)throw new F(`No RPC url found for ${e}`);return i},Ys=(e,t)=>{let o=Number(e),r=t.find(n=>n.id===o);if(!r)throw new F(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url};import Uu from"@coinbase/wallet-sdk";import{jsx as Js,jsxs as Au}from"react/jsx-runtime";var pt=({style:e,...t})=>Au("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:[Js("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Js("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 ft}from"@ethersproject/address";import{Web3Provider as ol}from"@ethersproject/providers";import{default as Mu}from"eventemitter3";import{StaticJsonRpcProvider as Zs}from"@ethersproject/providers";import Lu from"eventemitter3";var ku=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Qs=e=>ku.includes(e);import{ErrorCode as Ru}from"@ethersproject/logger";var Go=class extends F{constructor(){super("Wallet timeout");this.type="wallet_error"}},zo=class extends F{constructor(){super("User rejected connection");this.type="wallet_error"}},mt=e=>{if(e instanceof F)return e;if(e?.code&&e?.reason){let t=new Ee(e);return e.code===Ru.ACTION_REJECTED&&(t.details=Ae.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ee(e):new F("Unknown connector error",e)},ut=class extends et{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Ee=class extends ut{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(Ae).find(i=>i.eipCode===r.code);this.details=n||Ae.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=Ae.E32002_CONNECTION_ALREADY_PENDING:this.details=Ae.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ae.E32002_WALLET_LOCKED))}},Wu={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}},Iu={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Nu={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}},Ae={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Nu,...Iu},St={...Wu,...Ae};var Ou=12e4,Li=(e=new Go,t=Ou)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),X=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(o=>{this.removeListener(o.eventName,o.listener)}),this.walletProvider=t,this._subscriptions.forEach(o=>{this.walletProvider?.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new F(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),Li()]).catch(o=>{throw mt(o)})}},Vt=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},ln=class extends Lu{constructor(o,r,n,i,a=1){super();this.walletProxy=o,this.address=r,this.chainId=a,this.rpcConfig=n,this.chains=i,this.provider=new Zs(tt(a,this.chains,n))}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new Vt(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await At()||!this.address)throw new Vt("Disconnected",4900);return(await el(r)).transactionHash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new Vt(`Invalid params for ${o.method}`,4200);let r;if(typeof o.params[0]=="string")r=o.params[0];else if("chainId"in o.params[0]&&typeof o.params[0].chainId=="string")r=o.params[0].chainId;else throw new Vt(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new Zs(tt(this.chainId,this.chains,this.rpcConfig)),this.emit("chainChanged",r)}async handlePersonalSign(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");let r=o.params[0];return await Xs(r)}async handleEstimateGas(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");delete o.params[0].gasPrice,delete o.params[0].maxFeePerGas,delete o.params[0].maxPriorityFeePerGas;let r={...o.params[0],chainId:wr(this.chainId)};try{return await this.provider.send("eth_estimateGas",[r])}catch{return delete r.from,await this.provider.send("eth_estimateGas",[r])}}async request(o){switch(console.debug("Embedded1193Provider.request() called with args",o),o.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return wr(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(o);case"eth_sendTransaction":return this.handleSendTransaction(o);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(o);case"personal_sign":return this.handlePersonalSign(o);default:break}if(Qs(o.method)){let r=await At();if(await tl(),!r||!this.address)throw new Vt("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:r,request:{method:o.method,params:o.params}})).response.data}catch(n){throw console.error(n),new Vt("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await At();if(!o||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:o})).address}catch(r){return console.error(r),null}}},ht=class extends X{constructor(o){super(o)}},qt=class extends X{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Du=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Fe=class extends Mu{constructor(o,r,n){super();this.onAccountsChanged=o=>{o.length===0?this.onDisconnect():this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=sn(o),this.walletClientType==="privy"&&z.put(tn(r.address),o)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=o,this.chains=r,this.defaultChain=n,this.connected=!1,this.initialized=!1}buildConnectedWallet(o,r){let n=async()=>!!this.wallets.find(i=>ft(i.address)===ft(o));return{address:ft(o),chainId:r,switchChain:async i=>{if(!n)throw new F("Wallet is not currently connected.");let a=this.wallets.find(h=>ft(h.address)===ft(o))?.chainId;if(!a)throw new F("Unable to determine current chainId.");let l,s;if(typeof i=="number"?(l=`0x${i.toString(16)}`,s=i):(l=i,s=Number(i)),a===sn(l))return;let c=this.chains.find(h=>h.id===s);if(!c)throw new F(`Unsupported chainId: ${i}`);let m=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})};try{return await m()}catch(h){if(Du(h,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:l,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:[c.rpcUrls.public?.http[0]??""],blockExplorerUrls:[c.blockExplorers?.default.url??""]}]}),m();throw this.walletClientType==="rainbow"&&h.message?.includes("wallet_switchEthereumChain")?new F(`Rainbow does not support the chainId ${r}`):h}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:n,getEthereumProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return new ol(new ht(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await n())throw new F("Wallet is not currently connected.");return new qt(this.proxyProvider)},sign:async i=>{if(!await n())throw new F("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;if(r===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(r=c)}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let n=r[0],i=ft(n),a=[],l;if(this.walletClientType==="privy"){let c=z.get(tn(i));this.chains.find(m=>m.id===Number(c))||(z.del(tn(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")throw new Error("Invalid chainId returned from provider");l=c}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${ki}`,c),l=ki}let s=sn(l);a.find(c=>ft(c.address)===i)||a.push(this.buildConnectedWallet(ft(n),s)),cn(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let o=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((r,n)=>n.connectedAt-r.connectedAt).find(r=>o.find(n=>ft(n)===ft(r.address)))||null}async isConnected(){let o=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(o)&&o.length>0}async sign(o){return await this.connect({showPrompt:!1}),new ol(new ht(this.proxyProvider)).getSigner().signMessage(o)}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 Fu=e=>{let t=`https://mainnet.infura.io/v3/${Zr}`,o=1;return e.makeWeb3Provider(t,o)},dn,pn=class extends Fe{constructor(o,r){super("coinbase_wallet",o,r);this.connectorType="coinbase_wallet";this.proxyProvider=new X,this.subscribeListeners(),dn||(dn=new Uu({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(Fu(dn)),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){dn.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:pt}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw mt(o)}}};import{jsx as rl}from"react/jsx-runtime";var $o=({...e})=>rl("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:rl("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 un=class extends Fe{constructor(o,r,n){super("privy",r,n);this.connectorType="embedded";this.proxyProvider=o,this.subscribeListeners(),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[wr(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:$o}}disconnect(){this.connected=!1}async promptConnection(){}};import{getAddress as lC}from"@ethersproject/address";import{Web3Provider as dC}from"@ethersproject/providers";import{isMobile as Hu}from"react-device-detect";import{jsx as Be,jsxs as Bu}from"react/jsx-runtime";var Ce=({style:e,...t})=>Bu("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:[Be("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),Be("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("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"}),Be("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var mn=class extends Fe{constructor(o,r){super("metamask",o,r);this.connectorType="injected";this.proxyProvider=new X,this.subscribeListeners();let n=window,i=n.ethereum,a=n.ethereum.providers||[];for(let l of a)if(l.isMetaMask){i=l;break}this.proxyProvider.setWalletProvider(i),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"MetaMask",icon:Ce}}disconnect(){console.warn("Metamask does not support programmatic disconnect.")}async promptConnection(){try{!Hu&&rn()&&await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw mt(o)}}};import{jsx as nl,jsxs as Gu}from"react/jsx-runtime";var Ke=({style:e,...t})=>Gu("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:[nl("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),nl("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 hn=class extends Fe{constructor(o,r){super("phantom",o,r);this.connectorType="injected";this.proxyProvider=new X,this.subscribeListeners(),this.proxyProvider.setWalletProvider(window.phantom.ethereum),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"Phantom",icon:Ke}}disconnect(){console.warn("Phantom does not support programmatic disconnect.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new F("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw mt(o)}}};import{EthereumProvider as Xu,OPTIONAL_EVENTS as em,OPTIONAL_METHODS as tm}from"@walletconnect/ethereum-provider";import Di from"@walletconnect/qrcode-modal";import{isAndroid as om,isMobile as rm}from"react-device-detect";import{createContext as $u,useContext as Vu,useEffect as Oi,useRef as qu,useState as al}from"react";import{jsx as zu}from"react/jsx-runtime";function il(e){return zu("link",{rel:"prefetch",href:e.src})}var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as ju,jsxs as Ku}from"react/jsx-runtime";var ot="LANDING",sl=$u({ready:!1,app:null,currentScreen:ot,lastScreen:ot,navigate:x,navigateBack:x,resetNavigation:x,setModalData:x,outerClickRef:null}),ll=e=>{let t=e.appConfig,o=e.authenticated,r=e.visible,[n,i]=al(e.initialScreen||ot),[a,l]=al(e.initialScreen||ot);Oi(()=>{o||i(ot)},[o]),Oi(()=>{r||(l(ot),i(ot))},[r]),Oi(()=>{e.initialScreen&&n===ot&&(i(e.initialScreen),l(e.initialScreen))},[e.initialScreen]);let s=e.initialScreen&&n===ot?e.initialScreen:n,c=qu(null),m={ready:!!t?.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:s,lastScreen:a,navigate:h=>{l(n),i(h)},navigateBack:()=>{i(a)},resetNavigation:()=>{e.setInitialScreen(null),l(ot),i(ot)},outerClickRef:c};return Ku(sl.Provider,{value:m,children:[(typeof t?.appearance?.logo=="string"||t?.appearance?.logo?.type==="img")&&ju(il,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},v=()=>Vu(sl);import{jsx as Vo,jsxs as Yu}from"react/jsx-runtime";var qo=({style:e,...t})=>{let{app:o}=v();return Yu("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:[Vo("rect",{width:"28",height:"28",rx:"3",fill:o?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Vo("g",{clipPath:"url(#clip0_1765_9946)",children:Vo("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"})}),Vo("defs",{children:Vo("clipPath",{id:"clip0_1765_9946",children:Vo("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};import{isAndroid as dl,isDesktop as Ju,isMobileOnly as Qu}from"react-device-detect";var fn=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(pl))if(r.hostname===t)return{walletClientType:o,entry:r}};var pl={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",image_id:"5195e9db-94d8-4579-6f11-ef553be95100",hostname:"metamask.io",mobile:{native:"metamask:"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",image_id:"0528ee7e-16d1-4089-21e3-bbfb41933100",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",image_id:"a1cb2777-f8f9-49b0-53fd-443d20ee0b00",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",image_id:"7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500",hostname:"rainbow.me",mobile:{universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",image_id:"bff9cf1f-df19-42ce-f62a-87f04df13c00",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",image_id:"f216b371-96cf-409a-9d88-296392b85800",hostname:"zerion.io",mobile:{universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",image_id:"215158d2-614b-49c9-410f-77aa661c3900",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",image_id:"1bf33a89-b049-4a1c-d1f6-4dd7419ee400",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",image_id:"2cd67b4c-282b-4809-e7c0-a88cd5116f00",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",image_id:"7c5ff577-a68d-49c5-02cd-3d83637b0b00",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",image_id:"6f913b80-86c0-46f9-61ca-cc90a1805900",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",image_id:"252753e7-b783-4e03-7f77-d39864530900",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",image_id:"3f7075d0-4ab7-4db5-404d-3e4c05e6fe00",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",image_id:"cfc07342-23ea-4f3f-f071-ec9d2cd86b00",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",image_id:"52b1da3c-9e72-40ae-5dac-6142addd9c00",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",image_id:"ebac7b39-688c-41e3-7912-a4fefba74600",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",image_id:"4c16cad4-cac9-4643-6726-c696efaf5200",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",image_id:"e2024511-2c9b-46d7-3111-52df3d241700",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",image_id:"5b1cddfb-056e-4e78-029a-54de5d70c500",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",image_id:"dda0f0fb-34e8-4a57-dcea-b008e7d1ff00",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",image_id:"26a8f588-3231-4411-60ce-5bb6b805a700",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",image_id:"4725dda0-4471-4d0f-7adf-6bbe8b929c00",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",image_id:"61abe2ca-b06d-4a8b-de3e-8326f523e900",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",image_id:"c39b3a16-1a38-4588-f089-cb7aeb584700",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",image_id:"204b2240-5ce4-4996-6ec4-f06a22726900",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",image_id:"fc460647-ea95-447a-99f0-1bff8fa4be00",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",image_id:"f9854c79-14ba-4987-42e1-4a82abbf5700",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",image_id:"f78dab27-7165-4a3d-fdb1-fcff06c0a700",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",image_id:"79285c9f-2630-451e-0680-c71b42fb7400",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",image_id:"2d8006c3-852b-458a-d6b0-916c5ba76800",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",image_id:"339b9e9d-e2a7-46eb-4ed3-272321257a00",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",image_id:"cae1be94-9f53-4eba-b915-f6e381d5a500",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",image_id:"7eec7187-3f48-4fda-53bb-b0ad55749a00",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",image_id:"add9626b-a5fa-4c12-178c-e5584e6dcd00",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",image_id:"c268e78d-ffb0-4c8b-5cad-04c3add48500",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",image_id:"a7106965-91cc-4a73-4688-c5c72ae0ed00",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",image_id:"f90bc33f-f085-40cf-7538-fae5ae84f900",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",image_id:"691c0716-5213-4b99-e837-079268313800",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",image_id:"a5d9dd15-8cef-42de-8bed-09e01a8b0200",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",image_id:"b57b2163-1bd8-4f6b-3311-470767e6d200",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",image_id:"3ccbd966-97e8-45a0-1ceb-6141a8978e00",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",image_id:"6487869b-1165-4f30-aa3a-115665be8300",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",image_id:"10c75467-6612-48ad-b97b-63985e922200",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",image_id:"363fae03-882a-4d81-a721-6e6f6e9ac500",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",image_id:"32e89601-0490-42fc-0cc4-8627d62a2000",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",image_id:"98183be0-3125-45ee-a6b6-fbd47ebefd00",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",image_id:"75dd1471-77e9-4811-ce57-ec8fc980ec00",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",image_id:"374258d3-c749-4f37-7815-77e61f798c00",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",image_id:"ea0140c7-787c-43a4-838f-d5ab6a342000",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}}},ul=(e,t="md")=>`https://registry.walletconnect.com/v2/logo/${t}/${e}`;function Mi(e){return{name:e.displayName||"",universalLink:e.mobile.universal||"",deepLink:e.mobile.native||""}}function Zu(e){let t="mobile";return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>Mi(o))}function ml(){return Zu(pl)}function hl(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${e}`:""}function fl(e,t){return dl?e:hl(e,Mi(t))}var yl="WALLETCONNECT_DEEPLINK_CHOICE";function cl(e){let t=e.href.split("?")[0];z.put(yl,{...e,href:t})}var Cr=(e,t)=>{if(!e||Ju){z.del(yl);return}if(dl){cl({name:"Unknown",href:t||"wc:"});return}else if(Qu){let o=hl(t||"wc:",Mi(e));cl({name:e?.displayName||"",href:o})}};var br=class extends Fe{constructor(o,r,n,i,a){super(a||"unknown",n,i);this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.proxyProvider=new X,this.createProvider().then(l=>{if(this.provider=l,this.proxyProvider.setWalletProvider(l),this.subscribeListeners(),l.session){if(this.walletProvider.session?.peer.metadata.url){let s=fn(this.walletProvider.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",Cr(this.walletEntry)}this.connected=!0,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}else this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return this.walletProvider.connected}get walletBranding(){return this.walletEntry?{name:this.walletEntry.displayName,icon:this.walletClientType==="metamask"?Ce:ul(this.walletEntry.image_id)}:{name:Ni(this.walletProvider.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider.session?.peer.metadata.icons?.[0]||qo}}resetConnection(){this.walletProvider&&this.walletProvider.connected&&(this.walletProvider.signer.session=void 0,this.walletEntry=void 0,Cr(void 0),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new zo)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider.enable(),Li()]);if(l.length>0&&(a=l[0]),!a||a==="")throw new F("Unable to retrieve address");if(this.walletProvider.session?.peer.metadata.url){let s=fn(this.walletProvider.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts(l),o()})().catch(a=>{if(a){r(mt(a));return}r(new F("Unknown error during connection"))}).finally(()=>Di.close())})}disconnect(){this.walletProvider.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){let o={};for(let n of this.chains){let i=tt(n.id,this.chains,this.rpcConfig);i&&(o[n.id]=i)}let r=await Xu.init({projectId:this.walletConnectCloudProjectId,chains:[this.defaultChain.id],optionalChains:this.chains.map(n=>n.id),optionalEvents:em,optionalMethods:tm,rpcMap:o,showQrModal:!1});return r.on("display_uri",n=>{if(om)window.open(n,"_self");else if(rm&&this.walletEntry){Cr(this.walletEntry,n);let a=fl(n,this.walletEntry);window.open(a,"_self","noopener,noreferrer")}else Di.open(n,()=>{this.onQrModalClosed&&this.onQrModalClosed()},{mobileLinks:ml().map(i=>i.name)})}),r.on("connect",()=>{if(Di.close(),r.session?.peer.metadata.url){let n=fn(r.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown",Cr(this.walletEntry)}}),r}async enableProvider(){return this.walletProvider.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider.enable()}};var Ui=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===gl(t)).length:!1},Er=class extends nm{constructor(o,r,n,i){super();this.getEthereumProvider=()=>{let o=this.wallets[0],r=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===o?.address));return!o||!r?new X:r.proxyProvider};this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let o=new Set,r=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 o.has(a)?!1:(o.add(a),!0)}),n=r.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&r.unshift(r.splice(n,1)[0]),r}initialize(){this.initialized||(z.get(Si)&&(z.getKeys().forEach(o=>{o.startsWith("walletconnect")&&z.del(o)}),z.del(Si)),Ks().then(o=>o.forEach(r=>{switch(r){case"metamask":this.createWalletConnector("injected","metamask");break;case"phantom":this.createWalletConnector("injected","phantom");break;case"unknown":default:break}})),(nn()||z.getKeys().find(o=>o.startsWith("-walletlink")))&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),this.createWalletConnector("wallet_connect_v2","unknown"),this.initialized=!0)}findWalletConnector(o,r){return o==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===o)||null:this.walletConnectors.find(n=>n.connectorType===o&&n.walletClientType===r)||null}onInitialized(o){o.wallets.forEach(r=>{let n=this.storedConnections.find(i=>i.address===r.address&&i.connectorType===r.connectorType&&i.walletClientType===r.walletClientType);n&&(r.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated")}onWalletsUpdated(o){o.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(o,r,n){if(!this.findWalletConnector("embedded","privy")){let a=new ln(o,r,this.rpcConfig,this.chains,n.id),l=new un(a,this.chains,n);this.addWalletConnector(l)}}removeEmbeddedWalletConnector(){let o=this.findWalletConnector("embedded","privy");if(o){let r=this.walletConnectors.indexOf(o);this.walletConnectors.splice(r,1),this.saveConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(o,r){let n=this.findWalletConnector(o,r);if(n)return n instanceof br&&n.resetConnection(),n;let a=(()=>{switch(o){case"injected":switch(r){case"phantom":return je()?new hn(this.chains,this.defaultChain):null;case"metamask":default:return vr()?new mn(this.chains,this.defaultChain):null}case"coinbase_wallet":return new pn(this.chains,this.defaultChain);case"wallet_connect_v2":return new br(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain)}})();return a&&this.addWalletConnector(a),a||null}addWalletConnector(o){this.walletConnectors.push(o),o.on("initialized",()=>this.onInitialized(o)),o.on("walletsUpdated",()=>this.onWalletsUpdated(o))}loadConnectionHistory(){let o=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",r=z.get(Ai);return r&&Array.isArray(r)&&r.map(a=>o(a)).every(Boolean)?r:[]}saveConnectionHistory(){let o=this.wallets.map(r=>({address:r.address,connectorType:r.connectorType,walletClientType:r.walletClientType,connectedAt:r.connectedAt}));z.put(Ai,o)}async activeWalletSign(o){let r=this.wallets,n=r.length>0?r[0]:null;return n?n.sign(o):null}setActiveWallet(o){this.activeWallet=gl(o),this.emit("walletsUpdated")}};function cn(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++){let r=e[o],n=t[o];if(r?.address!==n?.address||r?.chainId!==n?.chainId||r?.connectorType!==n?.connectorType||r?.connectedAt!==n?.connectedAt||r?.walletClientType!==n?.walletClientType||r?.isConnected!==n?.isConnected||r?.linked!==n?.linked)return!1}return!0}import{ofetch as im}from"ofetch";var am=[Jr(),Qr()],sm=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal},yn=class{constructor(t,o,r){this.appId=t,this.sdkVersion=Pi,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=im.create({baseURL:this.defaults.baseURL,retry:3,retryDelay:500,credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!am.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.signal||(i.signal=sm(this.defaults.timeout))},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Kr}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw ee(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw ee(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw ee(r)}}};import xr from"js-cookie";function vl(e){return e instanceof yo?"email":e instanceof vo?"sms":e instanceof go?"siwe":e instanceof Fo?"custom_auth":e instanceof Gt?e.meta.provider:null}import*as wl from"jose";var yt=class{static parse(t){try{return new yt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=wl.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 o=Date.now(),r=(this.expiration-t)*1e3;return o>=r}};var lm=30,gn=class{constructor(){this.authenticateOnce=new Ve(async t=>this._authenticate(t)),this.linkOnce=new Ve(async t=>this._link(t)),this.refreshOnce=new Ve(this._refresh.bind(this)),this.destroyOnce=new Ve(this._destroy.bind(this)),this.forkSessionOnce=new Ve(this._forkSession.bind(this))}get token(){try{let t=z.get(Ho);return typeof t=="string"?new yt(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=z.get(en);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=z.get(yr);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=xr.get(Fs);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=yt.parse(this.token);return t!==null&&!t.isExpired(lm)}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:o,refresh_token:r,user:n,is_new_user:i}=await t.authenticate();this.storeToken(o),this.storeRefreshToken(r);let a=vl(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:_t(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),De(o)}}async _link(t){try{let o=await t.link();return _t(o)}catch(o){throw console.warn("Error linking account"),De(o)}}async _refresh(){if(!this.api)throw new C("Session has no API instance");if(!this.client)throw new C("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,o=this.refreshToken,r=this.forkedToken;try{let n;if(t&&o||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=o?{refresh_token:o}:{};n=await this.api.post(Jr(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(Qr(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),_t(n.user)}catch(n){if(n instanceof Uo&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw De(n)}}async _destroy(){try{await this.api?.post(us(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new C("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(ms(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw De(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){if(z.put(Ho,t),!this.client?.useServerCookies){let o=yt.parse(t)?.expiration;xr.set(Ti,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}}else z.del(Ho),xr.remove(Ti)}storeRefreshToken(t){typeof t=="string"?(z.put(en,t),this.client?.useServerCookies||xr.set(_i,t,{sameSite:"Strict",secure:!0,expires:30})):(z.del(en),xr.remove(_i))}clearForkedToken(){z.del(yr)}};var Fi,vn,Cl,Pr=class{constructor(t){ds(this,vn);this.apiUrl=t.apiUrl||Xr,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Ds,this.appId=t.appId,this.clientAnalyticsId=ps(this,vn,Cl).call(this),Fi||(Fi=new gn),this.session=Fi,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r,n){this.connectors||(this.connectors=new Er(t,o,r,n))}generateApi(){let t=new yn(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 C("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){t.api=this.api,this.authFlow=t}async unlinkEmail(t){try{let o=await this.api.post(Ss(),{address:t});return _t(o)}catch(o){throw De(o)}}async unlinkPhone(t){try{let o=await this.api.post(As(),{phoneNumber:t});return _t(o)}catch(o){throw De(o)}}async unlinkWallet(t){try{let o=await this.api.post(_s(),{address:t});return _t(o)}catch(o){throw De(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(ks(),{provider:t,subject:o});return _t(r)}catch(r){throw De(r)}}async createAnalyticsEvent(t,o,r){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(Rs(),{event_name:t,client_id:this.clientAnalyticsId,payload:{...o||{},clientTimestamp:r?r.toISOString():new Date().toISOString()}})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(Ws(),t)}catch(o){throw De(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?yt.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,tiktokOAuth:t.tiktok_oauth,linkedinOAuth:t.linkedin_oauth,appleOAuth:t.apple_oauth,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,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3)}}catch(t){throw De(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()}};vn=new WeakSet,Cl=function(){if(typeof window>"u")return null;try{let o=z.get(gr);if(typeof o=="string"&&o.length>0)return o}catch{}let t=cm();try{return z.put(gr,t),t}catch{return t}};import"wicg-inert";import{disableBodyScroll as j1,clearAllBodyScrollLocks as K1}from"body-scroll-lock";import{useRef as Y1,useCallback as J1}from"react";import{useEffect as Op}from"react";import Q1 from"react-dom";import es from"styled-components";import{createContext as dm,useContext as pm}from"react";var Bi=dm({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,rpcConfig:{rpcUrls:{}},chains:[],nativeTokenSymbolForChainId:x,captchaData:{enabled:!1,ready:!1,execute:x,remove:x,token:void 0,error:void 0},initializeWalletProxy:x,getAuthMeta:x,getAuthFlow:x,closePrivyModal:x,connectWallet:x,initLoginWithWallet:x,loginWithWallet:x,loginWithCode:x,initLoginWithEmail:x,initLoginWithSms:x,resendEmailCode:x,resendSmsCode:x,initLoginWithOAuth:x,loginWithOAuth:x,refreshUser:x,walletProxy:null,createAnalyticsEvent:x,getUsdTokenPrice:x,recoverEmbeddedWallet:x,getFiatOnRampConfig:x,updateWallets:x}),_=()=>pm(Bi);import{createContext as um,useContext as mm}from"react";var rt=um({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:x,login:x,linkEmail:x,linkPhone:x,linkWallet:x,linkGoogle:x,linkTwitter:x,linkDiscord:x,linkGithub:x,linkTiktok:x,linkLinkedIn:x,linkApple:x,logout:x,getAccessToken:x,getEthereumProvider:x,getEthersProvider:x,getWeb3jsProvider:x,unlinkEmail:x,unlinkPhone:x,unlinkWallet:x,unlinkGoogle:x,unlinkTwitter:x,unlinkDiscord:x,unlinkGithub:x,unlinkTiktok:x,unlinkLinkedIn:x,unlinkApple:x,setActiveWallet:x,forkSession:x,createWallet:x,signMessage:x,sendTransaction:x,exportWallet:x,setWalletPassword:x}),$=()=>mm(rt);import Ki from"styled-components";import Kt,{css as $i}from"styled-components";import Gi from"styled-components";import{Fragment as fm,jsx as Hi,jsxs as ym}from"react/jsx-runtime";var wn=({success:e,fail:t})=>ym(fm,{children:[Hi(wo,{className:e?"success":t?"fail":""}),Hi(zi,{className:e?"success":t?"fail":""})]}),wo=Gi.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -197,10 +197,10 @@ Resources:
197
197
  cursor: not-allowed;
198
198
  }
199
199
  }
200
- `,Tn=Kt.div`
200
+ `,Pn=Kt.div`
201
201
  /* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
202
202
  height: 44px;
203
- `,Pn=Kt.button`
203
+ `,Tn=Kt.button`
204
204
  display: flex;
205
205
  flex-direction: row;
206
206
  align-items: center;
@@ -290,7 +290,7 @@ Resources:
290
290
  flex-direction: column;
291
291
  justify-content: space-between;
292
292
  height: 100%;
293
- `,Tl=Ye.div`
293
+ `,Pl=Ye.div`
294
294
  display: flex;
295
295
  flex-direction: column;
296
296
  justify-content: flex-start;
@@ -317,7 +317,7 @@ Resources:
317
317
  height: 16px;
318
318
  `,W=Ye.div`
319
319
  height: 12px;
320
- `,Pl=Ye.div`
320
+ `,Tl=Ye.div`
321
321
  position: relative;
322
322
  `,_l=Ye.div`
323
323
  background-color: var(--privy-color-accent);
@@ -365,7 +365,7 @@ Resources:
365
365
  @media all and (display-mode: standalone) {
366
366
  padding-bottom: 30px;
367
367
  }
368
- `;import{ArrowLeftIcon as Em,XMarkIcon as xm}from"@heroicons/react/24/outline";import Rl from"styled-components";import{jsx as nt,jsxs as Am}from"react/jsx-runtime";var kl=()=>nt("div",{}),Tm=({backFn:e})=>nt("div",{children:nt(Em,{height:"16px",width:"16px",strokeWidth:2,onClick:e})}),Pm=e=>nt("div",{children:nt("div",{children:nt(xm,{height:"16px",width:"16px",strokeWidth:2,onClick:e.onClose})})});var T=({backFn:e,onClose:t,title:o,closeable:r=!0})=>{let{closePrivyModal:n}=_(),{app:i}=v();return Am(_m,{children:[e?nt(Tm,{backFn:e}):nt(kl,{}),o&&nt(Sm,{children:o}),i?.render.inDialog&&r?nt(Pm,{onClose:t||(()=>n())}):nt(kl,{})]})},_m=Rl.div`
368
+ `;import{ArrowLeftIcon as Em,XMarkIcon as xm}from"@heroicons/react/24/outline";import Rl from"styled-components";import{jsx as nt,jsxs as Am}from"react/jsx-runtime";var kl=()=>nt("div",{}),Pm=({backFn:e})=>nt("div",{children:nt(Em,{height:"16px",width:"16px",strokeWidth:2,onClick:e})}),Tm=e=>nt("div",{children:nt("div",{children:nt(xm,{height:"16px",width:"16px",strokeWidth:2,onClick:e.onClose})})});var P=({backFn:e,onClose:t,title:o,closeable:r=!0})=>{let{closePrivyModal:n}=_(),{app:i}=v();return Am(_m,{children:[e?nt(Pm,{backFn:e}):nt(kl,{}),o&&nt(Sm,{children:o}),i?.render.inDialog&&r?nt(Tm,{onClose:t||(()=>n())}):nt(kl,{})]})},_m=Rl.div`
369
369
  padding-top: 16px;
370
370
  display: flex;
371
371
  align-items: center;
@@ -429,7 +429,7 @@ Resources:
429
429
  text-overflow: ellipsis;
430
430
  text-align: center;
431
431
  color: var(--privy-color-foreground-2);
432
- `;import{jsx as Wl}from"react/jsx-runtime";var Il=({style:e,...t})=>Wl("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:Wl("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 ji,jsx as Je,jsxs as Sn}from"react/jsx-runtime";var Nl=()=>{let{navigate:e,app:t}=v(),o=t?.allowlistConfig.errorTitle||"You don't have access to this app",r=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return Sn(ji,{children:[Je(T,{}),Je(A,{}),Sn(km,{children:[Je(Wm,{children:Sn("div",{children:[Je(El,{}),Je(Il,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),Sn(Rm,{children:[typeof o=="string"?Je("h3",{children:o}):Je(ji,{children:o}),typeof r=="string"?Je("p",{children:r}):Je(ji,{children:r})]}),t?.allowlistConfig.errorCtaLink?Je(he,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):Je(he,{onClick:()=>{e("LANDING")},children:n})]}),Je(J,{})]})},km=Ki.div`
432
+ `;import{jsx as Wl}from"react/jsx-runtime";var Il=({style:e,...t})=>Wl("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:Wl("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 ji,jsx as Je,jsxs as Sn}from"react/jsx-runtime";var Nl=()=>{let{navigate:e,app:t}=v(),o=t?.allowlistConfig.errorTitle||"You don't have access to this app",r=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return Sn(ji,{children:[Je(P,{}),Je(A,{}),Sn(km,{children:[Je(Wm,{children:Sn("div",{children:[Je(El,{}),Je(Il,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),Sn(Rm,{children:[typeof o=="string"?Je("h3",{children:o}):Je(ji,{children:o}),typeof r=="string"?Je("p",{children:r}):Je(ji,{children:r})]}),t?.allowlistConfig.errorCtaLink?Je(he,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):Je(he,{onClick:()=>{e("LANDING")},children:n})]}),Je(J,{})]})},km=Ki.div`
433
433
  display: flex;
434
434
  flex-direction: column;
435
435
  align-items: center;
@@ -464,9 +464,9 @@ Resources:
464
464
  left: -19px;
465
465
  top: -19px;
466
466
  }
467
- `;import{EnvelopeIcon as Lm,PhoneIcon as Om}from"@heroicons/react/24/outline";import{useEffect as Ml,useState as An}from"react";import{isMobile as Mm}from"react-device-detect";import _r from"styled-components";import Yi from"styled-components";import{Fragment as Nm,jsx as Pr,jsxs as Ol}from"react/jsx-runtime";var vt=({title:e,description:t,children:o,...r})=>Pr(Ll,{...r,children:Ol(Nm,{children:[Pr("h3",{children:e}),typeof t=="string"?Pr("p",{children:t}):t,o]})}),Jt=Yi(vt)`
467
+ `;import{EnvelopeIcon as Lm,PhoneIcon as Om}from"@heroicons/react/24/outline";import{useEffect as Ml,useState as An}from"react";import{isMobile as Mm}from"react-device-detect";import _r from"styled-components";import Yi from"styled-components";import{Fragment as Nm,jsx as Tr,jsxs as Ol}from"react/jsx-runtime";var vt=({title:e,description:t,children:o,...r})=>Tr(Ll,{...r,children:Ol(Nm,{children:[Tr("h3",{children:e}),typeof t=="string"?Tr("p",{children:t}):t,o]})}),Jt=Yi(vt)`
468
468
  margin-bottom: 24px;
469
- `,fe=({title:e,description:t,icon:o,children:r,...n})=>Ol(Im,{...n,children:[o||null,Pr("h3",{children:e}),typeof t=="string"?Pr("p",{children:t}):t,r]}),Ll=Yi.div`
469
+ `,fe=({title:e,description:t,icon:o,children:r,...n})=>Ol(Im,{...n,children:[o||null,Tr("h3",{children:e}),typeof t=="string"?Tr("p",{children:t}):t,r]}),Ll=Yi.div`
470
470
  display: flex;
471
471
  flex-direction: column;
472
472
  justify-content: flex-start;
@@ -494,7 +494,7 @@ Resources:
494
494
  h3 {
495
495
  margin-bottom: 24px;
496
496
  }
497
- `;import{Fragment as Ji,jsx as de,jsxs as Qt}from"react/jsx-runtime";var Qi=6,Dl=new Array(Qi).fill(""),Dm=1400;var Fl=()=>{let{app:e,navigate:t,setModalData:o}=v(),{closePrivyModal:r,resendEmailCode:n,resendSmsCode:i,getAuthMeta:a,loginWithCode:l,updateWallets:s}=_(),{authenticated:c,user:m}=$(),[h,w]=An(Dl),[f,b]=An(!1),[S,E]=An(null),[P,g]=An(null),D=a()?.email?0:1,U=e?.render.inDialog?Ue:0,k=e?.render.inDialog?U-500:0;Ml(()=>{if(c&&f&&m)if(zt(m,e?.embeddedWallets?.createOnLogin)){let B=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:Y=>console.error(Y),callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(B)}else{s();let B=setTimeout(r,U);return()=>clearTimeout(B)}},[c,f,m]),Ml(()=>{if(S&&P===0){let j=setTimeout(()=>{w(Dl),E(null),document.querySelector("input[name=code-0]")?.focus()},Dm);return()=>clearTimeout(j)}},[S]);let N=j=>{let B=j.currentTarget.value.replace(" ","");if(B==="")return;if(isNaN(Number(B))){E("Code should be numeric"),g(1);return}E(null),g(null);let Y=Number(j.currentTarget.name?.charAt(5)),I=[...B||[""]].slice(0,Qi-Y),_e=[...h.slice(0,Y),...I,...h.slice(Y+I.length)];w(_e);let q=I.length,G=Math.min(Math.max(Y+q,0),Qi-1);isNaN(Number(j.currentTarget.value))||document.querySelector(`input[name=code-${G}]`)?.focus(),_e.every(Le=>Le&&!isNaN(+Le))&&(document.querySelector(`input[name=code-${G}]`)?.blur(),l(_e.join("")).then(()=>b(!0)).catch(we=>{we?.status===422?E("Invalid or expired verification code"):E("Issue verifying code"),g(0)})),j.preventDefault()},M=j=>{P===1&&(E(null),g(null));let B=[...h.slice(0,j),"",...h.slice(j+1)];w(B),j>0&&document.querySelector(`input[name=code-${j-1}]`)?.focus()},ue=D==0?de(Lm,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):de(Om,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),H=D==0?Qt("p",{children:["Please check ",de(Ul,{children:a()?.email})," for an email from privy.io and enter your code below."]}):Qt("p",{children:["Please check ",de(Ul,{children:a()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Qt(Ji,{children:[de(T,{},"header"),de(A,{}),Qt(Um,{children:[de(fe,{title:"Enter confirmation code",description:H,icon:ue}),Qt(xl,{children:[Qt(Fm,{children:[de(Bm,{fail:!!S,success:f,children:de("span",{children:S||(f?"Success!":"")})}),de("div",{children:h.map((j,B)=>de("input",{name:`code-${B}`,type:"text",value:h[B],onChange:N,onKeyUp:Y=>{Y.key==="Backspace"&&M(B)},inputMode:"numeric",autoFocus:B===0,pattern:"[0-9]",className:`${f?"success":""} ${S?"fail":""}`,autoComplete:Mm?"one-time-code":"off"},B))})]}),de(Hm,{children:D==0?Qt(Ji,{children:[de("span",{children:"Didn't get an email?"}),de("button",{onClick:n,children:"Resend Code"})]}):Qt(Ji,{children:[de("span",{children:"Didn't get a message?"}),de("button",{onClick:i,children:"Resend Code"})]})})]})]}),de(W,{}),de(O,{protectedByPrivy:!0})]})},Um=_r.div`
497
+ `;import{Fragment as Ji,jsx as de,jsxs as Qt}from"react/jsx-runtime";var Qi=6,Dl=new Array(Qi).fill(""),Dm=1400;var Fl=()=>{let{app:e,navigate:t,setModalData:o}=v(),{closePrivyModal:r,resendEmailCode:n,resendSmsCode:i,getAuthMeta:a,loginWithCode:l,updateWallets:s}=_(),{authenticated:c,user:m}=$(),[h,w]=An(Dl),[f,b]=An(!1),[S,E]=An(null),[T,g]=An(null),D=a()?.email?0:1,U=e?.render.inDialog?Ue:0,k=e?.render.inDialog?U-500:0;Ml(()=>{if(c&&f&&m)if(zt(m,e?.embeddedWallets?.createOnLogin)){let B=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:Y=>console.error(Y),callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(B)}else{s();let B=setTimeout(r,U);return()=>clearTimeout(B)}},[c,f,m]),Ml(()=>{if(S&&T===0){let j=setTimeout(()=>{w(Dl),E(null),document.querySelector("input[name=code-0]")?.focus()},Dm);return()=>clearTimeout(j)}},[S]);let N=j=>{let B=j.currentTarget.value.replace(" ","");if(B==="")return;if(isNaN(Number(B))){E("Code should be numeric"),g(1);return}E(null),g(null);let Y=Number(j.currentTarget.name?.charAt(5)),I=[...B||[""]].slice(0,Qi-Y),_e=[...h.slice(0,Y),...I,...h.slice(Y+I.length)];w(_e);let q=I.length,G=Math.min(Math.max(Y+q,0),Qi-1);isNaN(Number(j.currentTarget.value))||document.querySelector(`input[name=code-${G}]`)?.focus(),_e.every(Le=>Le&&!isNaN(+Le))&&(document.querySelector(`input[name=code-${G}]`)?.blur(),l(_e.join("")).then(()=>b(!0)).catch(we=>{we?.status===422?E("Invalid or expired verification code"):E("Issue verifying code"),g(0)})),j.preventDefault()},M=j=>{T===1&&(E(null),g(null));let B=[...h.slice(0,j),"",...h.slice(j+1)];w(B),j>0&&document.querySelector(`input[name=code-${j-1}]`)?.focus()},ue=D==0?de(Lm,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):de(Om,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),H=D==0?Qt("p",{children:["Please check ",de(Ul,{children:a()?.email})," for an email from privy.io and enter your code below."]}):Qt("p",{children:["Please check ",de(Ul,{children:a()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Qt(Ji,{children:[de(P,{},"header"),de(A,{}),Qt(Um,{children:[de(fe,{title:"Enter confirmation code",description:H,icon:ue}),Qt(xl,{children:[Qt(Fm,{children:[de(Bm,{fail:!!S,success:f,children:de("span",{children:S||(f?"Success!":"")})}),de("div",{children:h.map((j,B)=>de("input",{name:`code-${B}`,type:"text",value:h[B],onChange:N,onKeyUp:Y=>{Y.key==="Backspace"&&M(B)},inputMode:"numeric",autoFocus:B===0,pattern:"[0-9]",className:`${f?"success":""} ${S?"fail":""}`,autoComplete:Mm?"one-time-code":"off"},B))})]}),de(Hm,{children:D==0?Qt(Ji,{children:[de("span",{children:"Didn't get an email?"}),de("button",{onClick:n,children:"Resend Code"})]}):Qt(Ji,{children:[de("span",{children:"Didn't get a message?"}),de("button",{onClick:i,children:"Resend Code"})]})})]})]}),de(W,{}),de(O,{protectedByPrivy:!0})]})},Um=_r.div`
498
498
  display: flex;
499
499
  flex-direction: column;
500
500
  align-items: flex-start;
@@ -657,7 +657,7 @@ Resources:
657
657
  @media (max-width: 440px) {
658
658
  margin-top: 4px;
659
659
  }
660
- `;import{Fragment as jm,jsx as Co,jsxs as zl}from"react/jsx-runtime";var $l=()=>{let{app:e}=v(),t=`Connect a wallet to ${e?.name}`;return zl(jm,{children:[Co(T,{},"header"),Co(A,{}),Co(Jt,{title:"Connect your wallet",description:t}),zl(ce,{children:[Co(Zt,{connectOnly:!0}),Co(Xt,{})]}),Co(W,{}),Co(O,{protectedByPrivy:!0})]})};import Xi from"styled-components";import Km from"react";import{jsx as Vl}from"react/jsx-runtime";var Rn=()=>{let{app:e}=v(),t=e?.appearance?.logo,o=`${e?.name} logo`,r={maxHeight:"50px"},n="100%",i="auto";return t?typeof t=="string"?Vl("div",{children:Vl("img",{height:n,width:i,src:t,alt:o,style:r})}):t.type==="svg"||t.type==="img"?Km.cloneElement(t,{height:n,width:i,alt:o,style:r}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{Fragment as Zm,jsx as Rt,jsxs as ql}from"react/jsx-runtime";var jl=()=>{let{app:e}=v();return ql(Zm,{children:[Rt(T,{},"header"),e?.appearance.logo?Rt(Qm,{children:Rt(Rn,{})}):null,ql(Jm,{children:[Rt(Ym,{children:Rt("h4",{children:"Connect Wallet"})}),Rt(Zt,{connectOnly:!0}),Rt(Xt,{})]}),e&&Rt(_n,{app:e}),Rt(O,{protectedByPrivy:!0})]})},Ym=Xi.div`
660
+ `;import{Fragment as jm,jsx as Co,jsxs as zl}from"react/jsx-runtime";var $l=()=>{let{app:e}=v(),t=`Connect a wallet to ${e?.name}`;return zl(jm,{children:[Co(P,{},"header"),Co(A,{}),Co(Jt,{title:"Connect your wallet",description:t}),zl(ce,{children:[Co(Zt,{connectOnly:!0}),Co(Xt,{})]}),Co(W,{}),Co(O,{protectedByPrivy:!0})]})};import Xi from"styled-components";import Km from"react";import{jsx as Vl}from"react/jsx-runtime";var Rn=()=>{let{app:e}=v(),t=e?.appearance?.logo,o=`${e?.name} logo`,r={maxHeight:"50px"},n="100%",i="auto";return t?typeof t=="string"?Vl("div",{children:Vl("img",{height:n,width:i,src:t,alt:o,style:r})}):t.type==="svg"||t.type==="img"?Km.cloneElement(t,{height:n,width:i,alt:o,style:r}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};import{Fragment as Zm,jsx as Rt,jsxs as ql}from"react/jsx-runtime";var jl=()=>{let{app:e}=v();return ql(Zm,{children:[Rt(P,{},"header"),e?.appearance.logo?Rt(Qm,{children:Rt(Rn,{})}):null,ql(Jm,{children:[Rt(Ym,{children:Rt("h4",{children:"Connect Wallet"})}),Rt(Zt,{connectOnly:!0}),Rt(Xt,{})]}),e&&Rt(_n,{app:e}),Rt(O,{protectedByPrivy:!0})]})},Ym=Xi.div`
661
661
  font-weight: 600;
662
662
  color: 'var(--privy-color-foreground)';
663
663
  display: flex;
@@ -693,7 +693,7 @@ Resources:
693
693
  @media (max-width: 440px) {
694
694
  padding: 10px 10px 20px;
695
695
  }
696
- `;import{useEffect as Ql,useState as Zl}from"react";import th from"styled-components";import{useEffect as ea,useState as Sr}from"react";import{isMobile as ta}from"react-device-detect";import Kl from"styled-components";import{Fragment as Jl,jsx as ye,jsxs as In}from"react/jsx-runtime";var Wn=2,Ar={metamask:{name:"MetaMask",component:Ce},phantom:{name:"Phantom",component:Ke},coinbase_wallet:{name:"Coinbase Wallet",component:pt},wallet_connect:{name:"WalletConnect",component:qo},embedded:{name:"Privy Wallet",component:$o}},oa=e=>e?.privyErrorCode==="linked_to_another_user"?St.ERROR_USER_EXISTS:e instanceof Ee&&!e.details.default?e.details:e instanceof Go?St.ERROR_TIMED_OUT:e instanceof zo?St.ERROR_USER_REJECTED_CONNECTION:St.ERROR_WALLET_CONNECTION,Yl=()=>{let[e,t]=Sr(!1),[o,r]=Sr(!1),[n,i]=Sr(void 0),{app:a,navigate:l,navigateBack:s,lastScreen:c,currentScreen:m,setModalData:h}=v(),{getAuthFlow:w,walletConnectionStatus:f,closePrivyModal:b,loginWithWallet:S,updateWallets:E}=_(),{walletConnectors:P}=$(),[g,D]=Sr(0),{user:U}=$(),[k]=Sr(U?.linkedAccounts.length||0),N=ta&&f?.connector?.connectorType==="wallet_connect_v2"||ta&&f?.connector?.connectorType==="coinbase_wallet"||ta&&f?.connector?.connectorType==="injected"&&f?.connector?.walletClientType==="phantom",M=f?.status==="connected",ue=f?.status==="switching_to_supported_chain";ea(()=>{let K=w();if(K&&N&&M&&!K.preparedMessage){K.buildSiweMessage();return}!K||N||!M||(async()=>{r(!0),i(void 0);try{f?.connector?.connectorType==="wallet_connect_v2"&&f?.connector?.walletClientType==="metamask"&&await Ii(2500),await j()}catch(le){console.warn("Auto-prompted signature failed",le)}finally{r(!1)}})()},[g,M]),ea(()=>{if(U&&e){let K;if(zt(U,a?.embeddedWallets?.createOnLogin)){let le=a?.render.inDialog?Ue:0,ur=a?.render.inDialog?le-500:0;K=setTimeout(()=>{h({createWallet:{onSuccess:()=>{},onFailure:Pt=>console.error(Pt),callAuthOnSuccessOnClose:!0}}),l("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ur)}else E(),K=setTimeout(b,Ue);return()=>clearTimeout(K)}},[U,e]);let H=K=>{if(K?.privyErrorCode==="allowlist_rejected"){l("ALLOWLIST_REJECTION_SCREEN");return}i(oa(K))};async function j(){try{if(await S(),!a?.render.inDialog)return b();t(!0)}catch(K){H(K)}finally{r(!1)}}ea(()=>{f?.connectError&&H(f?.connectError)},[f]);let B=f?.connector?.connectorType||"metamask",Y=f?.connector?.walletClientType||"metamask",I=f?.connector?.walletBranding.name||Ar[Y]?.name||"MetaMask",_e=f?.connector?.walletBranding.icon||Ar[Y]?.component||(K=>ye(Ce,{...K})),q;e?q=`Successfully connected with ${I}`:n?q=n.message:ue?q="Switching networks":M?q=o&&N?"Signing":"Sign to verify":q=`Waiting for ${I}`;let G="Don\u2019t see your wallet modal? Check your other browser windows.";if(e){let K=U?.linkedAccounts.length||0;k===K?G="Wallet was already linked.":G="You\u2019re good to go!"}else g>=Wn&&n?G="Unable to connect wallet":n?G=n.detail:ue?G="Switch your wallet to the requested network.":M&&N?G="Sign the message in your wallet to verify it belongs to you.":Y==="metamask"?G="For the best experience, connect only one wallet at a time.":B==="wallet_connect"?G="Open your mobile wallet app to continue":B==="coinbase_wallet"&&(nn()||(Ui(U)?G="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":G="Open the Coinbase app on your phone to continue."));let Le=P?.walletConnectors?.find(K=>K.walletClientType==="coinbase_wallet"),we=Y==="coinbase_wallet"&&(Ui(U)||n===St.ERROR_USER_EXISTS);return In(Jl,{children:[ye(T,{backFn:m===c?void 0:s}),ye(A,{}),In(Xm,{children:[ye(ra,{walletLogo:_e,success:e,fail:!!n}),In(Yt,{children:[ye("h3",{children:q}),ye("p",{children:G})]}),ye(Tn,{children:we?ye(he,{onClick:()=>Le&&Le?.disconnect(),invisible:e,disabled:e,children:"Use a different wallet"}):n==St.ERROR_USER_EXISTS&&m!==c?ye(he,{onClick:s,children:"Use a different wallet"}):M&&!e&&N?ye(he,{onClick:()=>{r(!0),j()},disabled:o,children:o?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&g<Wn?ye(he,{onClick:()=>{D(g+1),i(void 0),M?(r(!0),j()):f?.connectRetry()},invisible:e||!n?.retryable||g>=Wn,disabled:!e&&(!n?.retryable||g>=Wn),children:"Retry"}):null})]}),ye(J,{})]})},Xm=Kl.div`
696
+ `;import{useEffect as Ql,useState as Zl}from"react";import th from"styled-components";import{useEffect as ea,useState as Sr}from"react";import{isMobile as ta}from"react-device-detect";import Kl from"styled-components";import{Fragment as Jl,jsx as ye,jsxs as In}from"react/jsx-runtime";var Wn=2,Ar={metamask:{name:"MetaMask",component:Ce},phantom:{name:"Phantom",component:Ke},coinbase_wallet:{name:"Coinbase Wallet",component:pt},wallet_connect:{name:"WalletConnect",component:qo},embedded:{name:"Privy Wallet",component:$o}},oa=e=>e?.privyErrorCode==="linked_to_another_user"?St.ERROR_USER_EXISTS:e instanceof Ee&&!e.details.default?e.details:e instanceof Go?St.ERROR_TIMED_OUT:e instanceof zo?St.ERROR_USER_REJECTED_CONNECTION:St.ERROR_WALLET_CONNECTION,Yl=()=>{let[e,t]=Sr(!1),[o,r]=Sr(!1),[n,i]=Sr(void 0),{app:a,navigate:l,navigateBack:s,lastScreen:c,currentScreen:m,setModalData:h}=v(),{getAuthFlow:w,walletConnectionStatus:f,closePrivyModal:b,loginWithWallet:S,updateWallets:E}=_(),{walletConnectors:T}=$(),[g,D]=Sr(0),{user:U}=$(),[k]=Sr(U?.linkedAccounts.length||0),N=ta&&f?.connector?.connectorType==="wallet_connect_v2"||ta&&f?.connector?.connectorType==="coinbase_wallet"||ta&&f?.connector?.connectorType==="injected"&&f?.connector?.walletClientType==="phantom",M=f?.status==="connected",ue=f?.status==="switching_to_supported_chain";ea(()=>{let K=w();if(K&&N&&M&&!K.preparedMessage){K.buildSiweMessage();return}!K||N||!M||(async()=>{r(!0),i(void 0);try{f?.connector?.connectorType==="wallet_connect_v2"&&f?.connector?.walletClientType==="metamask"&&await Ii(2500),await j()}catch(le){console.warn("Auto-prompted signature failed",le)}finally{r(!1)}})()},[g,M]),ea(()=>{if(U&&e){let K;if(zt(U,a?.embeddedWallets?.createOnLogin)){let le=a?.render.inDialog?Ue:0,ur=a?.render.inDialog?le-500:0;K=setTimeout(()=>{h({createWallet:{onSuccess:()=>{},onFailure:Tt=>console.error(Tt),callAuthOnSuccessOnClose:!0}}),l("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},ur)}else E(),K=setTimeout(b,Ue);return()=>clearTimeout(K)}},[U,e]);let H=K=>{if(K?.privyErrorCode==="allowlist_rejected"){l("ALLOWLIST_REJECTION_SCREEN");return}i(oa(K))};async function j(){try{if(await S(),!a?.render.inDialog)return b();t(!0)}catch(K){H(K)}finally{r(!1)}}ea(()=>{f?.connectError&&H(f?.connectError)},[f]);let B=f?.connector?.connectorType||"metamask",Y=f?.connector?.walletClientType||"metamask",I=f?.connector?.walletBranding.name||Ar[Y]?.name||"MetaMask",_e=f?.connector?.walletBranding.icon||Ar[Y]?.component||(K=>ye(Ce,{...K})),q;e?q=`Successfully connected with ${I}`:n?q=n.message:ue?q="Switching networks":M?q=o&&N?"Signing":"Sign to verify":q=`Waiting for ${I}`;let G="Don\u2019t see your wallet modal? Check your other browser windows.";if(e){let K=U?.linkedAccounts.length||0;k===K?G="Wallet was already linked.":G="You\u2019re good to go!"}else g>=Wn&&n?G="Unable to connect wallet":n?G=n.detail:ue?G="Switch your wallet to the requested network.":M&&N?G="Sign the message in your wallet to verify it belongs to you.":Y==="metamask"?G="For the best experience, connect only one wallet at a time.":B==="wallet_connect"?G="Open your mobile wallet app to continue":B==="coinbase_wallet"&&(nn()||(Ui(U)?G="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":G="Open the Coinbase app on your phone to continue."));let Le=T?.walletConnectors?.find(K=>K.walletClientType==="coinbase_wallet"),we=Y==="coinbase_wallet"&&(Ui(U)||n===St.ERROR_USER_EXISTS);return In(Jl,{children:[ye(P,{backFn:m===c?void 0:s}),ye(A,{}),In(Xm,{children:[ye(ra,{walletLogo:_e,success:e,fail:!!n}),In(Yt,{children:[ye("h3",{children:q}),ye("p",{children:G})]}),ye(Pn,{children:we?ye(he,{onClick:()=>Le&&Le?.disconnect(),invisible:e,disabled:e,children:"Use a different wallet"}):n==St.ERROR_USER_EXISTS&&m!==c?ye(he,{onClick:s,children:"Use a different wallet"}):M&&!e&&N?ye(he,{onClick:()=>{r(!0),j()},disabled:o,children:o?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&g<Wn?ye(he,{onClick:()=>{D(g+1),i(void 0),M?(r(!0),j()):f?.connectRetry()},invisible:e||!n?.retryable||g>=Wn,disabled:!e&&(!n?.retryable||g>=Wn),children:"Retry"}):null})]}),ye(J,{})]})},Xm=Kl.div`
697
697
  display: flex;
698
698
  flex-direction: column;
699
699
  align-items: center;
@@ -724,7 +724,7 @@ Resources:
724
724
  left: -19px;
725
725
  top: -19px;
726
726
  }
727
- `,ra=e=>{let t=e.walletLogo;return ye(Jl,{children:ye(eh,{children:In("div",{children:[ye(wn,{success:e.success,fail:e.fail}),typeof t=="string"?ye("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ye(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as rh,jsx as wt,jsxs as na}from"react/jsx-runtime";var Nn=2,Xl=()=>{let{navigateBack:e,lastScreen:t,currentScreen:o}=v(),{walletConnectionStatus:r,closePrivyModal:n}=_(),[i,a]=Zl(void 0),[l,s]=Zl(0),c=r?.status==="connected",m=r?.status==="switching_to_supported_chain";Ql(()=>{if(c){let g=setTimeout(n,Ue);return()=>clearTimeout(g)}},[c]);let h=g=>{a(oa(g))};Ql(()=>{r?.connectError&&h(r?.connectError)},[r]);let w=r?.connector?.connectorType||"metamask",f=r?.connector?.walletClientType||"metamask",b=r?.connector?.walletBranding.name||Ar[f]?.name||"MetaMask",S=r?.connector?.walletBranding.icon||Ar[f]?.component||(g=>wt(Ce,{...g})),E;c?E=`Successfully connected with ${b}`:i?E=i.message:m?E="Switching networks":E=`Waiting for ${b}`;let P="Don\u2019t see your wallet modal? Check your other browser windows.";return c?P="You\u2019re good to go!":l>=Nn&&i?P="Unable to connect wallet":i?P=i.detail:m?P="Switch your wallet to the requested network.":f==="metamask"?P="For the best experience, connect only one wallet at a time.":w==="wallet_connect_v2"?P="Open your mobile wallet app to continue":w==="coinbase_wallet"&&(P="Open the Coinbase app on your phone to continue."),na(rh,{children:[wt(T,{backFn:o===t?void 0:e}),wt(A,{}),na(oh,{children:[wt(ra,{walletLogo:S,success:c,fail:!!i}),na(Yt,{children:[wt("h3",{children:E}),wt("p",{children:P})]}),wt(Tn,{children:i==St.ERROR_USER_EXISTS?wt(he,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<Nn?wt(he,{onClick:()=>{s(l+1),a(void 0),r?.connectRetry()},invisible:c||!i?.retryable||l>=Nn,disabled:!c&&(!i?.retryable||l>=Nn),children:"Retry"}):null})]}),wt(J,{})]})},oh=th.div`
727
+ `,ra=e=>{let t=e.walletLogo;return ye(Jl,{children:ye(eh,{children:In("div",{children:[ye(wn,{success:e.success,fail:e.fail}),typeof t=="string"?ye("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ye(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as rh,jsx as wt,jsxs as na}from"react/jsx-runtime";var Nn=2,Xl=()=>{let{navigateBack:e,lastScreen:t,currentScreen:o}=v(),{walletConnectionStatus:r,closePrivyModal:n}=_(),[i,a]=Zl(void 0),[l,s]=Zl(0),c=r?.status==="connected",m=r?.status==="switching_to_supported_chain";Ql(()=>{if(c){let g=setTimeout(n,Ue);return()=>clearTimeout(g)}},[c]);let h=g=>{a(oa(g))};Ql(()=>{r?.connectError&&h(r?.connectError)},[r]);let w=r?.connector?.connectorType||"metamask",f=r?.connector?.walletClientType||"metamask",b=r?.connector?.walletBranding.name||Ar[f]?.name||"MetaMask",S=r?.connector?.walletBranding.icon||Ar[f]?.component||(g=>wt(Ce,{...g})),E;c?E=`Successfully connected with ${b}`:i?E=i.message:m?E="Switching networks":E=`Waiting for ${b}`;let T="Don\u2019t see your wallet modal? Check your other browser windows.";return c?T="You\u2019re good to go!":l>=Nn&&i?T="Unable to connect wallet":i?T=i.detail:m?T="Switch your wallet to the requested network.":f==="metamask"?T="For the best experience, connect only one wallet at a time.":w==="wallet_connect_v2"?T="Open your mobile wallet app to continue":w==="coinbase_wallet"&&(T="Open the Coinbase app on your phone to continue."),na(rh,{children:[wt(P,{backFn:o===t?void 0:e}),wt(A,{}),na(oh,{children:[wt(ra,{walletLogo:S,success:c,fail:!!i}),na(Yt,{children:[wt("h3",{children:E}),wt("p",{children:T})]}),wt(Pn,{children:i==St.ERROR_USER_EXISTS?wt(he,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<Nn?wt(he,{onClick:()=>{s(l+1),a(void 0),r?.connectRetry()},invisible:c||!i?.retryable||l>=Nn,disabled:!c&&(!i?.retryable||l>=Nn),children:"Retry"}):null})]}),wt(J,{})]})},oh=th.div`
728
728
  display: flex;
729
729
  flex-direction: column;
730
730
  align-items: center;
@@ -788,12 +788,12 @@ Resources:
788
788
  transform: rotate(360deg);
789
789
  }
790
790
  }
791
- `;var ec=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds"];var Wt=class extends Error{constructor(o,r){super(r);this.type=o}};function aa(e){let t=e.type;return typeof t=="string"&&ec.includes(t)}function Jo(e){return aa(e)&&e.type==="wallet_not_on_device"}function tc(e){return aa(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function oc(e){return!!(aa(e)&&e.type==="insufficient_funds"||e.code==="INSUFFICIENT_FUNDS")}function rc(e){return e.code==="UNPREDICTABLE_GAS_LIMIT"}import{Fragment as ic,jsx as eo,jsxs as sa}from"react/jsx-runtime";var nc=1,ac=()=>{let{authenticated:e,user:t,getAccessToken:o}=$(),{closePrivyModal:r,createAnalyticsEvent:n,walletProxy:i}=_(),{navigate:a,data:l,setModalData:s,outerClickRef:c}=v(),m=ph(()=>Date.now(),[]),[h,w]=uh(!1),{onCompleteNavigateTo:f,onFailure:b}=l?.connectWallet,S=P=>{h||(w(!0),b(typeof P=="string"?new Error(P):P))};dh(()=>{let P=Z(t),g;return!e||!P?S("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let U=await o();if(!U)return S("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:U,address:P.address});let k=(Date.now()-m)/1e3;f==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&k<nc?g=setTimeout(()=>{a(f)},(nc-k)*1e3):a(f)}catch(k){if(Jo(k)&&P.recoveryMethod==="privy"){let N=await o();if(!N)return S("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:P.address}),(await i?.recover({address:P.address,accessToken:N}))?.address||S(new Error("Unable to recover wallet")),f?a(f):r({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:P.address}),a(f)}catch{S("An error has occurred, please try again.")}}else Jo(k)?(s({...l,recoverWallet:{privyWallet:P,onCompleteNavigateTo:f,onFailure:b}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):S(k)}})(),()=>clearTimeout(g)):void 0},[e,t,i]);let E=()=>{r({shouldCallAuthOnSuccess:!1}),S("User exited before wallet could be connected")};return c&&(c.current=E),sa(ic,{children:[eo(T,{onClose:E}),eo(A,{}),eo(hh,{children:h?sa(ic,{children:[sa(kt,{children:[eo(ch,{fill:"var(--privy-color-error)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),eo(fe,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),eo(V,{onClick:()=>r({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):eo(Yo,{})}),eo(W,{})]})},hh=mh.div`
791
+ `;var ec=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds"];var Wt=class extends Error{constructor(o,r){super(r);this.type=o}};function aa(e){let t=e.type;return typeof t=="string"&&ec.includes(t)}function Jo(e){return aa(e)&&e.type==="wallet_not_on_device"}function tc(e){return aa(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function oc(e){return!!(aa(e)&&e.type==="insufficient_funds"||e.code==="INSUFFICIENT_FUNDS")}function rc(e){return e.code==="UNPREDICTABLE_GAS_LIMIT"}import{Fragment as ic,jsx as eo,jsxs as sa}from"react/jsx-runtime";var nc=1,ac=()=>{let{authenticated:e,user:t,getAccessToken:o}=$(),{closePrivyModal:r,createAnalyticsEvent:n,walletProxy:i}=_(),{navigate:a,data:l,setModalData:s,outerClickRef:c}=v(),m=ph(()=>Date.now(),[]),[h,w]=uh(!1),{onCompleteNavigateTo:f,onFailure:b}=l?.connectWallet,S=T=>{h||(w(!0),b(typeof T=="string"?new Error(T):T))};dh(()=>{let T=Z(t),g;return!e||!T?S("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let U=await o();if(!U)return S("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:U,address:T.address});let k=(Date.now()-m)/1e3;f==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&k<nc?g=setTimeout(()=>{a(f)},(nc-k)*1e3):a(f)}catch(k){if(Jo(k)&&T.recoveryMethod==="privy"){let N=await o();if(!N)return S("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:T.address}),(await i?.recover({address:T.address,accessToken:N}))?.address||S(new Error("Unable to recover wallet")),f?a(f):r({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:T.address}),a(f)}catch{S("An error has occurred, please try again.")}}else Jo(k)?(s({...l,recoverWallet:{privyWallet:T,onCompleteNavigateTo:f,onFailure:b}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):S(k)}})(),()=>clearTimeout(g)):void 0},[e,t,i]);let E=()=>{r({shouldCallAuthOnSuccess:!1}),S("User exited before wallet could be connected")};return c&&(c.current=E),sa(ic,{children:[eo(P,{onClose:E}),eo(A,{}),eo(hh,{children:h?sa(ic,{children:[sa(kt,{children:[eo(ch,{fill:"var(--privy-color-error)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),eo(fe,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),eo(V,{onClick:()=>r({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):eo(Yo,{})}),eo(W,{})]})},hh=mh.div`
792
792
  display: flex;
793
793
  height: 100%;
794
794
  flex-direction: column;
795
795
  flex-grow: 1;
796
- `;import{CheckCircleIcon as fh}from"@heroicons/react/24/solid";import{useEffect as yh}from"react";import{Fragment as gh,jsx as Qo,jsxs as sc}from"react/jsx-runtime";var lc=()=>{let{user:e}=$(),{closePrivyModal:t,isNewUserThisSession:o,updateWallets:r}=_(),{app:n,data:i,outerClickRef:a}=v(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,m=()=>{let h=Z(e);h?(r(),l(h),t({shouldCallAuthOnSuccess:c})):s(new Error("Failed to create wallet"))};return yh(()=>{let h=setTimeout(m,Us);return()=>clearTimeout(h)},[]),a&&(a.current=m),sc(gh,{children:[Qo(T,{onClose:m}),Qo(A,{}),sc(kt,{children:[Qo(fh,{fill:"var(--privy-color-accent)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),Qo(fe,{title:o?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:o?"You\u2019ve successfully created an account.":"Your account is secured."})]}),Qo(W,{}),Qo(O,{protectedByPrivy:!0})]})};import{useEffect as uc,useRef as wh,useState as la}from"react";import It from"styled-components";import{jsx as ke,jsxs as vh}from"react/jsx-runtime";var cc=({style:e,...t})=>vh("svg",{width:"320",height:"144",viewBox:"0 0 320 144",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:320,height:144,...e},...t,children:[ke("rect",{x:"214.681",y:"51.6852",width:"40",height:"40",rx:"20",fill:"var(--privy-color-background-2)"}),ke("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M229.848 64.9512C228.001 65.1452 226.643 66.726 226.643 68.5829V75.414C226.643 77.2883 228.026 78.8767 229.891 79.0615C231.417 79.2127 233.21 79.3518 234.643 79.3518C236.862 79.3518 239.95 79.0176 241.563 78.8225C242.183 78.7474 242.643 78.2196 242.643 77.5948V69.7756C242.643 69.1508 242.183 68.6229 241.563 68.5479C239.955 68.3534 236.883 68.0207 234.665 68.0185L234.643 68.0185L234.622 68.0185C233.219 68.0199 231.475 68.1534 229.975 68.3005C229.636 68.3007 229.346 68.0433 229.312 67.6989C229.277 67.3325 229.544 67.0063 229.911 66.9703C231.423 66.8219 233.203 66.6852 234.643 66.6852C236.246 66.6852 238.275 66.855 239.887 67.0221C240.412 67.0765 240.896 67.1309 241.309 67.1796V66.4289C241.309 65.8099 240.858 65.2851 240.244 65.2046C238.746 65.0083 235.977 64.6852 233.976 64.6852C232.734 64.6852 231.195 64.8098 229.848 64.9512ZM240.309 74.6852C240.862 74.6852 241.309 74.2375 241.309 73.6852C241.309 73.1329 240.862 72.6852 240.309 72.6852C239.757 72.6852 239.309 73.1329 239.309 73.6852C239.309 74.2375 239.757 74.6852 240.309 74.6852Z",fill:"var(--privy-color-accent)"}),ke("path",{d:"M92.6426 74.2969H89.5743M76.6426 74.2969H85.5085M77.5837 78.2687L87.1555 61.6852M84.7273 65.9017L82.2897 61.6852M91.8614 78.2687L86.6849 69.2993",stroke:"var(--privy-color-accent)","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),ke("rect",{x:"65.6426",y:"52.6852",width:"38",height:"38",rx:"19",stroke:"var(--privy-color-background-2","stroke-width":"2"}),ke("path",{d:"M103.162 71.6852H213.662",stroke:"var(--privy-color-background-2","stroke-width":"2","stroke-dasharray":"4 4"}),ke("path",{d:"M270.544 116.469C272.146 116.469 273.445 115.175 273.445 113.577C273.445 111.98 272.146 110.685 270.544 110.685C268.942 110.685 267.643 111.98 267.643 113.577C267.643 115.175 268.942 116.469 270.544 116.469Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M157.878 48.3615C160.282 48.3615 162.231 46.4193 162.231 44.0234C162.231 41.6274 160.282 39.6852 157.878 39.6852C155.475 39.6852 153.526 41.6274 153.526 44.0234C153.526 46.4193 155.475 48.3615 157.878 48.3615Z",fill:"var(--privy-color-accent-dark)"}),ke("path",{d:"M35.0825 96.1749C36.8852 96.1749 38.3466 94.7182 38.3466 92.9212C38.3466 91.1243 36.8852 89.6676 35.0825 89.6676C33.2797 89.6676 31.8184 91.1243 31.8184 92.9212C31.8184 94.7182 33.2797 96.1749 35.0825 96.1749Z",fill:"var(--privy-color-accent-dark)"}),ke("path",{d:"M164.407 103.673C166.41 103.673 168.034 102.055 168.034 100.058C168.034 98.0616 166.41 96.443 164.407 96.443C162.404 96.443 160.78 98.0616 160.78 100.058C160.78 102.055 162.404 103.673 164.407 103.673Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M292.664 33.277C294.267 33.277 295.566 31.9822 295.566 30.3849C295.566 28.7876 294.267 27.4928 292.664 27.4928C291.062 27.4928 289.763 28.7876 289.763 30.3849C289.763 31.9822 291.062 33.277 292.664 33.277Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M104 12.6997C105.302 12.6997 106.357 11.6476 106.357 10.3498C106.357 9.05206 105.302 8 104 8C102.698 8 101.643 9.05206 101.643 10.3498C101.643 11.6476 102.698 12.6997 104 12.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M7.99998 68.6997C9.30194 68.6997 10.3574 67.6476 10.3574 66.3498C10.3574 65.0521 9.30194 64 7.99998 64C6.69802 64 5.64258 65.0521 5.64258 66.3498C5.64258 67.6476 6.69802 68.6997 7.99998 68.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M312 60.6997C313.302 60.6997 314.357 59.6476 314.357 58.3498C314.357 57.0521 313.302 56 312 56C310.698 56 309.643 57.0521 309.643 58.3498C309.643 59.6476 310.698 60.6997 312 60.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M35.544 42.4694C37.1464 42.4694 38.4454 41.1746 38.4454 39.5773C38.4454 37.98 37.1464 36.6852 35.544 36.6852C33.9416 36.6852 32.6426 37.98 32.6426 39.5773C32.6426 41.1746 33.9416 42.4694 35.544 42.4694Z",fill:"var(--privy-color-accent-light"})]});import{Fragment as kh,jsx as te,jsxs as Ct}from"react/jsx-runtime";var mc=()=>{let[e,t]=la(null),{authenticated:o,user:r,getAccessToken:n}=$(),{closePrivyModal:i,createAnalyticsEvent:a}=_(),{data:l,outerClickRef:s}=v(),c=Z(r)?.address,{onFailure:m,onSuccess:h,origin:w,appId:f}=l.keyExport,b=E=>{i({shouldCallAuthOnSuccess:!1}),m(typeof E=="string"?new Error(E):E)},S=()=>{i({shouldCallAuthOnSuccess:!1}),h(),a("embedded_wallet_key_export_completed",{walletAddress:c})};return uc(()=>{let E=Z(r);if(!o||!E)return b("User must be authenticated before exporting their wallet");n().then(t,b)},[o,r]),s&&(s.current=S),Ct(kh,{children:[te(T,{onClose:S}),te(A,{}),Ct(Eh,{children:[te(cc,{}),Ct(xh,{children:[te("h3",{children:"Transfer"}),Ct(Sh,{children:[te(bh,{style:{marginRight:6}}),$t(c)]})]}),te("p",{children:"You can take your account with you to another site using an external wallet!"}),Ct(Th,{children:[Ct(dc,{children:[te(pc,{children:"1"}),Ct("span",{children:[te("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."]})]}),Ct(dc,{children:[te(pc,{children:"2"}),te("span",{children:"Copy this key into your other wallet"})]})]}),te("div",{style:{width:"100%"},children:e&&te(Ch,{origin:w,appId:f,accessToken:e,address:c,dimensions:{height:"44px"}})}),Ct(Ah,{children:[te("h4",{children:"WARNING"}),te("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),te(W,{}),te(O,{protectedByPrivy:!0})]})};function Ch(e){let[t,o]=la(e.dimensions.width),[r,n]=la(void 0),i=wh(null);return uc(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();o(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")})},[]),te("div",{ref:i,children:t&&Ct(Ph,{children:[te("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:an(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,...r})}),te(_h,{children:"Loading..."})]})})}function bh(e){return te("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:te("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 Eh=It.div`
796
+ `;import{CheckCircleIcon as fh}from"@heroicons/react/24/solid";import{useEffect as yh}from"react";import{Fragment as gh,jsx as Qo,jsxs as sc}from"react/jsx-runtime";var lc=()=>{let{user:e}=$(),{closePrivyModal:t,isNewUserThisSession:o,updateWallets:r}=_(),{app:n,data:i,outerClickRef:a}=v(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,m=()=>{let h=Z(e);h?(r(),l(h),t({shouldCallAuthOnSuccess:c})):s(new Error("Failed to create wallet"))};return yh(()=>{let h=setTimeout(m,Us);return()=>clearTimeout(h)},[]),a&&(a.current=m),sc(gh,{children:[Qo(P,{onClose:m}),Qo(A,{}),sc(kt,{children:[Qo(fh,{fill:"var(--privy-color-accent)",stroke:"white",strokeWidth:".25px",width:"64px",height:"64px"}),Qo(fe,{title:o?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:o?"You\u2019ve successfully created an account.":"Your account is secured."})]}),Qo(W,{}),Qo(O,{protectedByPrivy:!0})]})};import{useEffect as uc,useRef as wh,useState as la}from"react";import It from"styled-components";import{jsx as ke,jsxs as vh}from"react/jsx-runtime";var cc=({style:e,...t})=>vh("svg",{width:"320",height:"144",viewBox:"0 0 320 144",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:320,height:144,...e},...t,children:[ke("rect",{x:"214.681",y:"51.6852",width:"40",height:"40",rx:"20",fill:"var(--privy-color-background-2)"}),ke("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M229.848 64.9512C228.001 65.1452 226.643 66.726 226.643 68.5829V75.414C226.643 77.2883 228.026 78.8767 229.891 79.0615C231.417 79.2127 233.21 79.3518 234.643 79.3518C236.862 79.3518 239.95 79.0176 241.563 78.8225C242.183 78.7474 242.643 78.2196 242.643 77.5948V69.7756C242.643 69.1508 242.183 68.6229 241.563 68.5479C239.955 68.3534 236.883 68.0207 234.665 68.0185L234.643 68.0185L234.622 68.0185C233.219 68.0199 231.475 68.1534 229.975 68.3005C229.636 68.3007 229.346 68.0433 229.312 67.6989C229.277 67.3325 229.544 67.0063 229.911 66.9703C231.423 66.8219 233.203 66.6852 234.643 66.6852C236.246 66.6852 238.275 66.855 239.887 67.0221C240.412 67.0765 240.896 67.1309 241.309 67.1796V66.4289C241.309 65.8099 240.858 65.2851 240.244 65.2046C238.746 65.0083 235.977 64.6852 233.976 64.6852C232.734 64.6852 231.195 64.8098 229.848 64.9512ZM240.309 74.6852C240.862 74.6852 241.309 74.2375 241.309 73.6852C241.309 73.1329 240.862 72.6852 240.309 72.6852C239.757 72.6852 239.309 73.1329 239.309 73.6852C239.309 74.2375 239.757 74.6852 240.309 74.6852Z",fill:"var(--privy-color-accent)"}),ke("path",{d:"M92.6426 74.2969H89.5743M76.6426 74.2969H85.5085M77.5837 78.2687L87.1555 61.6852M84.7273 65.9017L82.2897 61.6852M91.8614 78.2687L86.6849 69.2993",stroke:"var(--privy-color-accent)","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),ke("rect",{x:"65.6426",y:"52.6852",width:"38",height:"38",rx:"19",stroke:"var(--privy-color-background-2","stroke-width":"2"}),ke("path",{d:"M103.162 71.6852H213.662",stroke:"var(--privy-color-background-2","stroke-width":"2","stroke-dasharray":"4 4"}),ke("path",{d:"M270.544 116.469C272.146 116.469 273.445 115.175 273.445 113.577C273.445 111.98 272.146 110.685 270.544 110.685C268.942 110.685 267.643 111.98 267.643 113.577C267.643 115.175 268.942 116.469 270.544 116.469Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M157.878 48.3615C160.282 48.3615 162.231 46.4193 162.231 44.0234C162.231 41.6274 160.282 39.6852 157.878 39.6852C155.475 39.6852 153.526 41.6274 153.526 44.0234C153.526 46.4193 155.475 48.3615 157.878 48.3615Z",fill:"var(--privy-color-accent-dark)"}),ke("path",{d:"M35.0825 96.1749C36.8852 96.1749 38.3466 94.7182 38.3466 92.9212C38.3466 91.1243 36.8852 89.6676 35.0825 89.6676C33.2797 89.6676 31.8184 91.1243 31.8184 92.9212C31.8184 94.7182 33.2797 96.1749 35.0825 96.1749Z",fill:"var(--privy-color-accent-dark)"}),ke("path",{d:"M164.407 103.673C166.41 103.673 168.034 102.055 168.034 100.058C168.034 98.0616 166.41 96.443 164.407 96.443C162.404 96.443 160.78 98.0616 160.78 100.058C160.78 102.055 162.404 103.673 164.407 103.673Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M292.664 33.277C294.267 33.277 295.566 31.9822 295.566 30.3849C295.566 28.7876 294.267 27.4928 292.664 27.4928C291.062 27.4928 289.763 28.7876 289.763 30.3849C289.763 31.9822 291.062 33.277 292.664 33.277Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M104 12.6997C105.302 12.6997 106.357 11.6476 106.357 10.3498C106.357 9.05206 105.302 8 104 8C102.698 8 101.643 9.05206 101.643 10.3498C101.643 11.6476 102.698 12.6997 104 12.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M7.99998 68.6997C9.30194 68.6997 10.3574 67.6476 10.3574 66.3498C10.3574 65.0521 9.30194 64 7.99998 64C6.69802 64 5.64258 65.0521 5.64258 66.3498C5.64258 67.6476 6.69802 68.6997 7.99998 68.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M312 60.6997C313.302 60.6997 314.357 59.6476 314.357 58.3498C314.357 57.0521 313.302 56 312 56C310.698 56 309.643 57.0521 309.643 58.3498C309.643 59.6476 310.698 60.6997 312 60.6997Z",fill:"var(--privy-color-accent-light"}),ke("path",{d:"M35.544 42.4694C37.1464 42.4694 38.4454 41.1746 38.4454 39.5773C38.4454 37.98 37.1464 36.6852 35.544 36.6852C33.9416 36.6852 32.6426 37.98 32.6426 39.5773C32.6426 41.1746 33.9416 42.4694 35.544 42.4694Z",fill:"var(--privy-color-accent-light"})]});import{Fragment as kh,jsx as te,jsxs as Ct}from"react/jsx-runtime";var mc=()=>{let[e,t]=la(null),{authenticated:o,user:r,getAccessToken:n}=$(),{closePrivyModal:i,createAnalyticsEvent:a}=_(),{data:l,outerClickRef:s}=v(),c=Z(r)?.address,{onFailure:m,onSuccess:h,origin:w,appId:f}=l.keyExport,b=E=>{i({shouldCallAuthOnSuccess:!1}),m(typeof E=="string"?new Error(E):E)},S=()=>{i({shouldCallAuthOnSuccess:!1}),h(),a("embedded_wallet_key_export_completed",{walletAddress:c})};return uc(()=>{let E=Z(r);if(!o||!E)return b("User must be authenticated before exporting their wallet");n().then(t,b)},[o,r]),s&&(s.current=S),Ct(kh,{children:[te(P,{onClose:S}),te(A,{}),Ct(Eh,{children:[te(cc,{}),Ct(xh,{children:[te("h3",{children:"Transfer"}),Ct(Sh,{children:[te(bh,{style:{marginRight:6}}),$t(c)]})]}),te("p",{children:"You can take your account with you to another site using an external wallet!"}),Ct(Ph,{children:[Ct(dc,{children:[te(pc,{children:"1"}),Ct("span",{children:[te("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."]})]}),Ct(dc,{children:[te(pc,{children:"2"}),te("span",{children:"Copy this key into your other wallet"})]})]}),te("div",{style:{width:"100%"},children:e&&te(Ch,{origin:w,appId:f,accessToken:e,address:c,dimensions:{height:"44px"}})}),Ct(Ah,{children:[te("h4",{children:"WARNING"}),te("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),te(W,{}),te(O,{protectedByPrivy:!0})]})};function Ch(e){let[t,o]=la(e.dimensions.width),[r,n]=la(void 0),i=wh(null);return uc(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();o(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")})},[]),te("div",{ref:i,children:t&&Ct(Th,{children:[te("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:an(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,...r})}),te(_h,{children:"Loading..."})]})})}function bh(e){return te("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:te("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 Eh=It.div`
797
797
  display: flex;
798
798
  height: 100%;
799
799
  flex-direction: column;
@@ -803,7 +803,7 @@ Resources:
803
803
  align-items: center;
804
804
  justify-content: space-between;
805
805
  margin-bottom: 8px;
806
- `,Th=It.div`
806
+ `,Ph=It.div`
807
807
  display: flex;
808
808
  flex-direction: column;
809
809
  gap: 24px;
@@ -836,7 +836,7 @@ Resources:
836
836
  border-radius: 100%;
837
837
  background: var(--privy-color-background);
838
838
  color: var(--privy-color-accent);
839
- `,Ph=It.div`
839
+ `,Th=It.div`
840
840
  position: relative;
841
841
  height: 44px;
842
842
  `,_h=It.div`
@@ -873,7 +873,7 @@ Resources:
873
873
  && > h4 {
874
874
  color: var(--privy-color-error);
875
875
  }
876
- `;import{useEffect as xf,useRef as Tf,useState as Fn}from"react";import{useCallback as Uc,useEffect as Ef}from"react";import{ExclamationTriangleIcon as Ih}from"@heroicons/react/24/outline";import{useEffect as Nh,useState as wc}from"react";import{ArrowPathIcon as Rh}from"@heroicons/react/24/outline";import He,{css as ca}from"styled-components";var Wh=ca`
876
+ `;import{useEffect as xf,useRef as Pf,useState as Fn}from"react";import{useCallback as Uc,useEffect as Ef}from"react";import{ExclamationTriangleIcon as Ih}from"@heroicons/react/24/outline";import{useEffect as Nh,useState as wc}from"react";import{ArrowPathIcon as Rh}from"@heroicons/react/24/outline";import He,{css as ca}from"styled-components";var Wh=ca`
877
877
  font-size: 14px;
878
878
  font-style: normal;
879
879
  font-weight: 400;
@@ -1023,7 +1023,7 @@ Resources:
1023
1023
  transition: all 0.1s ease-out;
1024
1024
  background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1025
1025
  }
1026
- `;import{Fragment as Lh,jsx as it,jsxs as pa}from"react/jsx-runtime";var Cc=({buttonHideAnimations:e,buttonLoading:t,password:o,onSubmit:r,onBack:n})=>{let[i,a]=wc(!1),[l,s]=wc(""),c=o===l;return Nh(()=>{l&&!i&&a(!0)},[l]),pa(Lh,{children:[it(T,{title:"Confirm Password",closeable:!1,backFn:n}),it(A,{}),pa(to,{children:[pa(ro,{children:[it(Ih,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),it("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),it("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),it(Zo,{children:it(bo,{value:l,onChange:m=>s(m.target.value),onBlur:()=>a(!0),placeholder:"confirm your password"})}),it(On,{"aria-hidden":!i||c,error:!0,children:"Passwords do not match"})]}),it(oo,{onClick:r,loading:t,disabled:!c,hideAnimations:e,children:"Continue"}),it(W,{}),it(O,{protectedByPrivy:!0})]})};import{ExclamationTriangleIcon as Uh}from"@heroicons/react/24/outline";import{useState as Fh}from"react";import Bh from"styled-components";import Mn from"styled-components";import{jsx as Wr,jsxs as Dh}from"react/jsx-runtime";var bc=({className:e,checked:t,color:o="var(--privy-color-accent)",...r})=>Wr("label",{children:Dh(Oh,{className:e,children:[Wr(xc,{checked:t,...r}),Wr(Mh,{color:o,checked:t,children:Wr(Ec,{viewBox:"0 0 24 24",children:Wr("polyline",{points:"20 6 9 17 4 12"})})})]})}),Oh=Mn.div`
1026
+ `;import{Fragment as Lh,jsx as it,jsxs as pa}from"react/jsx-runtime";var Cc=({buttonHideAnimations:e,buttonLoading:t,password:o,onSubmit:r,onBack:n})=>{let[i,a]=wc(!1),[l,s]=wc(""),c=o===l;return Nh(()=>{l&&!i&&a(!0)},[l]),pa(Lh,{children:[it(P,{title:"Confirm Password",closeable:!1,backFn:n}),it(A,{}),pa(to,{children:[pa(ro,{children:[it(Ih,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),it("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),it("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),it(Zo,{children:it(bo,{value:l,onChange:m=>s(m.target.value),onBlur:()=>a(!0),placeholder:"confirm your password"})}),it(On,{"aria-hidden":!i||c,error:!0,children:"Passwords do not match"})]}),it(oo,{onClick:r,loading:t,disabled:!c,hideAnimations:e,children:"Continue"}),it(W,{}),it(O,{protectedByPrivy:!0})]})};import{ExclamationTriangleIcon as Uh}from"@heroicons/react/24/outline";import{useState as Fh}from"react";import Bh from"styled-components";import Mn from"styled-components";import{jsx as Wr,jsxs as Dh}from"react/jsx-runtime";var bc=({className:e,checked:t,color:o="var(--privy-color-accent)",...r})=>Wr("label",{children:Dh(Oh,{className:e,children:[Wr(xc,{checked:t,...r}),Wr(Mh,{color:o,checked:t,children:Wr(Ec,{viewBox:"0 0 24 24",children:Wr("polyline",{points:"20 6 9 17 4 12"})})})]})}),Oh=Mn.div`
1027
1027
  display: inline-block;
1028
1028
  vertical-align: middle;
1029
1029
  `,Ec=Mn.svg`
@@ -1063,21 +1063,21 @@ Resources:
1063
1063
  ${Ec} {
1064
1064
  visibility: ${e=>e.checked?"visible":"hidden"};
1065
1065
  }
1066
- `;import{Fragment as Gh,jsx as at,jsxs as Ir}from"react/jsx-runtime";var Tc=({buttonHideAnimations:e,buttonLoading:t,onSubmit:o,onBack:r,config:n})=>{let[i,a]=Fh(!1);return Ir(Gh,{children:[at(T,{title:"Confirm Password",closeable:!1,backFn:r}),at(A,{}),Ir(to,{children:[Ir(ro,{children:[at(Uh,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),at("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),at("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),at(kr,{children:Ir(Rr,{style:{color:"var(--privy-color-error)"},children:[at(bc,{color:"var(--privy-color-error)",checked:i,onChange:()=>a(l=>!l)}),"I understand losing my password means losing my account."]})})]}),Ir(Hh,{children:[n.initiatedBy==="user"&&at(xn,{onClick:n.onCancel,disabled:t,children:"Cancel"}),at(oo,{onClick:o,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),at(W,{}),at(O,{protectedByPrivy:!0})]})},Hh=Bh.div`
1066
+ `;import{Fragment as Gh,jsx as at,jsxs as Ir}from"react/jsx-runtime";var Pc=({buttonHideAnimations:e,buttonLoading:t,onSubmit:o,onBack:r,config:n})=>{let[i,a]=Fh(!1);return Ir(Gh,{children:[at(P,{title:"Confirm Password",closeable:!1,backFn:r}),at(A,{}),Ir(to,{children:[Ir(ro,{children:[at(Uh,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),at("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),at("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),at(kr,{children:Ir(Rr,{style:{color:"var(--privy-color-error)"},children:[at(bc,{color:"var(--privy-color-error)",checked:i,onChange:()=>a(l=>!l)}),"I understand losing my password means losing my account."]})})]}),Ir(Hh,{children:[n.initiatedBy==="user"&&at(xn,{onClick:n.onCancel,disabled:t,children:"Cancel"}),at(oo,{onClick:o,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),at(W,{}),at(O,{protectedByPrivy:!0})]})},Hh=Bh.div`
1067
1067
  display: flex;
1068
1068
  gap: 10px;
1069
- `;import{KeyIcon as nf}from"@heroicons/react/24/outline";import{CheckCircleIcon as Wc}from"@heroicons/react/24/solid";import{useState as af,useMemo as ua,useEffect as sf}from"react";import Ic from"styled-components";import zh from"fast-password-entropy";import*as Pc from"secure-password-utilities";import{DEFAULT_WORDLIST as $h}from"secure-password-utilities/wordlists";var Vh=95,qh=8,jh=3,Kh=.3,Yh=/[a-z]/,Jh=/[A-Z]/,Qh=/[0-9]/,Zh="a-zA-Z0-9",_c="!@#$%^&*()\\-_+.",Sc=`${Zh}${_c}`,Xh=new RegExp(`[${_c}]`),ef=new RegExp(`[${Sc}]`),Ac=new RegExp(`^[${Sc}]{6,}$`),kc=(e="")=>{let t=e.split("").filter(o=>!ef.test(o)).map(o=>o.replace(" ","SPACE"));return[...new Set(t)]},Dn=()=>Pc.generatePassphrase(4,$h);function tf(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function of(e){if(e.length<qh)return 0;let t=0;Yh.test(e)&&(t+=1),Jh.test(e)&&(t+=1),Qh.test(e)&&(t+=1),Xh.test(e)&&(t+=1);let o=t/jh;return Math.max(0,Math.min(1,o))}function rf(e=""){let t=of(e),o=zh(e)/Vh;return(t*Kh+o)/2}function Rc(e=""){let t=rf(e);return{value:t,label:tf(t)}}import{Fragment as df,jsx as xe,jsxs as no}from"react/jsx-runtime";var Nc=({buttonHideAnimations:e,buttonLoading:t,password:o="",config:r,onSubmit:n,onClose:i,onPasswordChange:a,onPasswordGenerate:l})=>{let[s,c]=af(!1);sf(()=>{o&&!s&&c(!0)},[o]);let m=ua(()=>s?(o?.length||0)<6?"Password must be at least 6 characters":Ac.test(o||"")?null:`Invalid characters used ( ${kc(o).join(" ")} )`:null,[o,s]),h=ua(()=>m?{value:0,label:"Weak"}:Rc(o),[o,m]),w=ua(()=>!!(!o?.length||m),[m,o]);return no(df,{children:[xe(T,{onClose:i,title:"Secure your account",closeable:r.initiatedBy==="user"}),xe(A,{}),no(to,{children:[no(ro,{children:[xe(nf,{height:48,width:48,stroke:"var(--privy-color-accent)"}),xe("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),xe("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),no(Zo,{children:[xe(bo,{value:o,onChange:f=>a(f.target.value),placeholder:"enter or generate a strong password"}),xe(gc,{onClick:l})]}),xe(vc,{value:h.value===0?.01:h.value,label:h.label}),xe(On,{error:!!m,children:m||`Password Strength: ${s?h.label:"--"}`}),no(cf,{children:[xe(lf,{children:no(kr,{children:[no(Rr,{children:[xe(Wc,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),no(Rr,{children:[xe(Wc,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),xe(oo,{onClick:n,loading:t,disabled:w,hideAnimations:e,children:"Continue"})]})]}),xe(W,{}),xe(O,{protectedByPrivy:!0})]})},lf=Ic(kr)`
1069
+ `;import{KeyIcon as nf}from"@heroicons/react/24/outline";import{CheckCircleIcon as Wc}from"@heroicons/react/24/solid";import{useState as af,useMemo as ua,useEffect as sf}from"react";import Ic from"styled-components";import zh from"fast-password-entropy";import*as Tc from"secure-password-utilities";import{DEFAULT_WORDLIST as $h}from"secure-password-utilities/wordlists";var Vh=95,qh=8,jh=3,Kh=.3,Yh=/[a-z]/,Jh=/[A-Z]/,Qh=/[0-9]/,Zh="a-zA-Z0-9",_c="!@#$%^&*()\\-_+.",Sc=`${Zh}${_c}`,Xh=new RegExp(`[${_c}]`),ef=new RegExp(`[${Sc}]`),Ac=new RegExp(`^[${Sc}]{6,}$`),kc=(e="")=>{let t=e.split("").filter(o=>!ef.test(o)).map(o=>o.replace(" ","SPACE"));return[...new Set(t)]},Dn=()=>Tc.generatePassphrase(4,$h);function tf(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function of(e){if(e.length<qh)return 0;let t=0;Yh.test(e)&&(t+=1),Jh.test(e)&&(t+=1),Qh.test(e)&&(t+=1),Xh.test(e)&&(t+=1);let o=t/jh;return Math.max(0,Math.min(1,o))}function rf(e=""){let t=of(e),o=zh(e)/Vh;return(t*Kh+o)/2}function Rc(e=""){let t=rf(e);return{value:t,label:tf(t)}}import{Fragment as df,jsx as xe,jsxs as no}from"react/jsx-runtime";var Nc=({buttonHideAnimations:e,buttonLoading:t,password:o="",config:r,onSubmit:n,onClose:i,onPasswordChange:a,onPasswordGenerate:l})=>{let[s,c]=af(!1);sf(()=>{o&&!s&&c(!0)},[o]);let m=ua(()=>s?(o?.length||0)<6?"Password must be at least 6 characters":Ac.test(o||"")?null:`Invalid characters used ( ${kc(o).join(" ")} )`:null,[o,s]),h=ua(()=>m?{value:0,label:"Weak"}:Rc(o),[o,m]),w=ua(()=>!!(!o?.length||m),[m,o]);return no(df,{children:[xe(P,{onClose:i,title:"Secure your account",closeable:r.initiatedBy==="user"}),xe(A,{}),no(to,{children:[no(ro,{children:[xe(nf,{height:48,width:48,stroke:"var(--privy-color-accent)"}),xe("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),xe("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),no(Zo,{children:[xe(bo,{value:o,onChange:f=>a(f.target.value),placeholder:"enter or generate a strong password"}),xe(gc,{onClick:l})]}),xe(vc,{value:h.value===0?.01:h.value,label:h.label}),xe(On,{error:!!m,children:m||`Password Strength: ${s?h.label:"--"}`}),no(cf,{children:[xe(lf,{children:no(kr,{children:[no(Rr,{children:[xe(Wc,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),no(Rr,{children:[xe(Wc,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),xe(oo,{onClick:n,loading:t,disabled:w,hideAnimations:e,children:"Continue"})]})]}),xe(W,{}),xe(O,{protectedByPrivy:!0})]})},lf=Ic(kr)`
1070
1070
  flex: 1;
1071
1071
  padding-top: 1rem;
1072
1072
  `,cf=Ic.div`
1073
1073
  display: flex;
1074
1074
  flex-direction: column;
1075
1075
  height: 100%;
1076
- `;import{ArrowDownTrayIcon as pf,ClipboardDocumentCheckIcon as uf,DocumentDuplicateIcon as mf,ExclamationTriangleIcon as hf}from"@heroicons/react/24/outline";import{useState as ff,useCallback as Lc}from"react";import{Fragment as ma,jsx as Re,jsxs as Eo}from"react/jsx-runtime";var Oc=({buttonHideAnimations:e,buttonLoading:t,appName:o,password:r,onSubmit:n,onBack:i})=>{let[a,l]=ff(!1),s=Lc(()=>{l(!0),r&&navigator.clipboard.writeText(r)},[r]),c=Lc(()=>{let m=document.createElement("a"),h=o.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),w=new Blob([yf(o,r)],{type:"text/plain"}),f=URL.createObjectURL(w);m.href=f,m.target="_blank",m.download=`${h}-privy-wallet-recovery.txt`,document.body.appendChild(m),m.click(),setTimeout(()=>{m.remove(),URL.revokeObjectURL(f)},5e3)},[r]);return Eo(ma,{children:[Re(T,{backFn:i,title:"Save Password",closeable:!1}),Re(A,{}),Eo(to,{children:[Eo(ro,{children:[Re(hf,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Re("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Re("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."})]}),Re(Zo,{centered:!0,children:Re(fc,{children:r})}),Eo("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Re(da,{onClick:s,children:a?Eo(ma,{children:[Re(uf,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):Eo(ma,{children:[Re(mf,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),Eo(da,{onClick:c,children:[Re(pf,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Re(oo,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Re(W,{}),Re(O,{protectedByPrivy:!0})]})},yf=(e,t)=>`"Your wallet recovery password for ${e} is
1076
+ `;import{ArrowDownTrayIcon as pf,ClipboardDocumentCheckIcon as uf,DocumentDuplicateIcon as mf,ExclamationTriangleIcon as hf}from"@heroicons/react/24/outline";import{useState as ff,useCallback as Lc}from"react";import{Fragment as ma,jsx as Re,jsxs as Eo}from"react/jsx-runtime";var Oc=({buttonHideAnimations:e,buttonLoading:t,appName:o,password:r,onSubmit:n,onBack:i})=>{let[a,l]=ff(!1),s=Lc(()=>{l(!0),r&&navigator.clipboard.writeText(r)},[r]),c=Lc(()=>{let m=document.createElement("a"),h=o.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),w=new Blob([yf(o,r)],{type:"text/plain"}),f=URL.createObjectURL(w);m.href=f,m.target="_blank",m.download=`${h}-privy-wallet-recovery.txt`,document.body.appendChild(m),m.click(),setTimeout(()=>{m.remove(),URL.revokeObjectURL(f)},5e3)},[r]);return Eo(ma,{children:[Re(P,{backFn:i,title:"Save Password",closeable:!1}),Re(A,{}),Eo(to,{children:[Eo(ro,{children:[Re(hf,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),Re("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),Re("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."})]}),Re(Zo,{centered:!0,children:Re(fc,{children:r})}),Eo("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[Re(da,{onClick:s,children:a?Eo(ma,{children:[Re(uf,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):Eo(ma,{children:[Re(mf,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),Eo(da,{onClick:c,children:[Re(pf,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),Re(oo,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),Re(W,{}),Re(O,{protectedByPrivy:!0})]})},yf=(e,t)=>`"Your wallet recovery password for ${e} is
1077
1077
 
1078
1078
  ${t}
1079
1079
 
1080
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe."`;import{CheckCircleIcon as gf,XCircleIcon as vf}from"@heroicons/react/24/outline";import{Fragment as wf,jsx as Nt,jsxs as ha}from"react/jsx-runtime";var Mc=({error:e,onClose:t})=>ha(wf,{children:[Nt(T,{closeable:!1}),Nt(A,{}),e?ha(kt,{children:[Nt(vf,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}),Nt(fe,{title:"Something went wrong",description:e})]}):ha(kt,{children:[Nt(gf,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),Nt(fe,{title:"Success"})]}),Nt(V,{onClick:t,children:"Close"}),Nt(W,{}),Nt(O,{protectedByPrivy:!0})]});import{useReducer as Cf}from"react";var bf=(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}},Dc=()=>{let[e,t]=Cf(bf,"creating");return{send:t,state:e}};import{jsx as Nr}from"react/jsx-runtime";var Un=({onSubmit:e,...t})=>{let{send:o,state:r}=Dc(),n=Uc(async()=>{r==="finalizing"&&await e(),o("next")},[r,o,e]);Ef(()=>{let a;return r==="done"&&t.config.initiatedBy==="automatic"&&(a=setTimeout(()=>t.onClose?.(),Ue)),()=>{a&&clearTimeout(a)}},[r,t.config.initiatedBy,t.onClose]);let i=Uc(()=>{o("back")},[o]);return r==="creating"?Nr(Nc,{...t,onSubmit:n}):r==="saving"?Nr(Oc,{...t,onSubmit:n,onBack:i}):r==="confirming"?Nr(Cc,{...t,onSubmit:n,onBack:i}):r==="finalizing"?Nr(Tc,{...t,onSubmit:n,onBack:i}):r==="done"?Nr(Mc,{...t,onSubmit:n}):null};import{jsx as fa}from"react/jsx-runtime";var Pf=250,Fc=()=>{let{app:e,navigate:t,data:o,outerClickRef:r}=v(),[n,i]=Fn(""),[a,l]=Fn(!1),[s,c]=Fn(),[m,h]=Fn(null),w=Tf(!1),{authenticated:f,getAccessToken:b}=$(),{walletProxy:S,refreshUser:E,closePrivyModal:P,createAnalyticsEvent:g,isNewUserThisSession:D}=_(),{onSuccess:U,onFailure:k,callAuthOnSuccessOnClose:N}=o.createWallet,M=e?.embeddedWallets.requireUserPasswordOnCreate===!0,ue=!!(!n||w.current)&&!M,H=new Ve(async()=>B());xf(()=>{if(!f){t("LANDING"),k(new Error("User must be authenticated before creating a Privy wallet"));return}!M&&!a&&!w.current&&(l(!0),H.execute().finally(()=>l(!1)))},[M,f]);let j=()=>{M&&m&&m?.recoveryMethod!=="user-passcode"?k(new Me("User created a wallet but failed to set a password for it")):m?U(m):k(new Me("User wallet creation failed")),P({shouldCallAuthOnSuccess:N})};r&&(r.current=()=>({closeModal:!1}));let B=async function(){let I=await b();if(I)try{if(g("embedded_wallet_creation_started"),!await S?.create({accessToken:I,recoveryPassword:s}))throw g("embedded_wallet_creation_failed",{}),new Error("Unable to create wallet");let q=await E(),G=Z(q);if(!G)throw g("embedded_wallet_creation_failed",{}),new Error("Unable to create wallet");h(G),g("embedded_wallet_creation_completed",{walletAddress:G.address}),i(""),w.current=!0,M?t("EMBEDDED_WALLET_CREATED_SCREEN"):D?t("EMBEDDED_WALLET_CREATED_SCREEN"):G&&(U(G),P({shouldCallAuthOnSuccess:N}))}catch(_e){if(w.current)return;i("An error has occurred, please try again."),console.warn(_e)}},Y=async()=>M?(l(!0),H.execute().then(()=>new Promise(I=>setTimeout(I,Pf))).finally(()=>l(!1))):P({shouldCallAuthOnSuccess:N});return ue?fa(yc,{children:fa(Yo,{})}):fa(Un,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:ue||!S,buttonLoading:a,buttonHideAnimations:!m&&a,error:n,password:s||"",onClose:j,onPasswordChange:c,onPasswordGenerate:()=>c(Dn()),onSubmit:Y})};import{useEffect as _f,useState as Bn}from"react";import{jsx as Sf}from"react/jsx-runtime";var Bc=()=>{let[e,t]=Bn(null),[o,r]=Bn(!1),[n,i]=Bn(null),[a,l]=Bn(""),{authenticated:s,getAccessToken:c,user:m}=$(),{walletProxy:h,refreshUser:w,closePrivyModal:f,createAnalyticsEvent:b}=_(),{app:S,navigate:E,data:P,outerClickRef:g}=v(),{onSuccess:D,onFailure:U}=P.createWallet,k=Z(m),N=e?.recoveryMethod==="user-passcode";_f(()=>{s||(E("LANDING"),U(new Yr("User must be authenticated before setting a password on a Privy wallet")))},[s]);let M=()=>{if(n){U(n),f({shouldCallAuthOnSuccess:!1});return}if(!N){U(new Me("Exited before password was added to wallet")),f({shouldCallAuthOnSuccess:!1});return}D(e),f({shouldCallAuthOnSuccess:!1})};g&&(g.current=()=>(M(),{closeModal:!N}));let ue=async()=>{let j=await c();if(j&&k?.address&&a&&h)try{if(b("embedded_wallet_set_password_started",{walletAddress:k.address}),!(await h.setRecoveryPassword({accessToken:j,address:k.address,recoveryPassword:a})).address){i(new Me("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"error setting password"});return}let Y=await w(),I=Z(Y);if(!I){i(new Me("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"wallet disconnected"});return}t(I),b("embedded_wallet_set_password_completed",{walletAddress:k.address})}catch(B){console.warn(B),i(B instanceof Error?B:new Error("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:B})}},H=async()=>{N?(D(e),f({shouldCallAuthOnSuccess:!1})):(r(!0),i(null),await ue(),r(!1))};return Sf(Un,{appName:S?.name||"privy",config:{initiatedBy:"user",onCancel:M},error:n?"An error has occurred, please try again.":void 0,buttonLoading:o,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(Dn()),onPasswordChange:l,onSubmit:H,onClose:M})};import{UserCircleIcon as Af}from"@heroicons/react/24/outline";import{LockClosedIcon as kf}from"@heroicons/react/24/solid";import{useEffect as Rf}from"react";import{Fragment as Wf,jsx as Lt,jsxs as Hn}from"react/jsx-runtime";var Hc=()=>{let{user:e}=$(),{closePrivyModal:t,createAnalyticsEvent:o}=_(),{data:r,setModalData:n,navigate:i,outerClickRef:a}=v(),{onSuccess:l,onFailure:s}=r.setWalletPassword,c=()=>{s(new Me("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return Rf(()=>{a&&(a.current=c)},[]),Hn(Wf,{children:[Lt(T,{onClose:c}),Lt(A,{}),Hn(kt,{children:[Hn(Pl,{children:[Lt(Af,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Lt(_l,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Lt(kf,{width:"12px",height:"12px",fill:"white"})})]}),Hn(fe,{title:"Secure Your Account",children:["Please set a password to secure your account.",Lt("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."})]})]}),Lt(V,{onClick:()=>{let h=Z(e);o("embedded_wallet_set_password_started",{walletAddress:h?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Lt(W,{}),Lt(O,{protectedByPrivy:!0})]})};import{ShieldCheckIcon as If}from"@heroicons/react/24/outline";import{useEffect as Nf,useState as ya}from"react";import Gn,{css as Lf}from"styled-components";import{Fragment as Ff,jsx as Ze,jsxs as Xo}from"react/jsx-runtime";var Gc=()=>{let{authenticated:e,getAccessToken:t}=$(),{walletProxy:o,closePrivyModal:r,createAnalyticsEvent:n}=_(),{navigate:i,data:a,outerClickRef:l}=v(),[s,c]=ya(void 0),[m,h]=ya(""),[w,f]=ya(!1),{privyWallet:b,onCompleteNavigateTo:S,onSuccess:E,onFailure:P}=a.recoverWallet,g=(k="User exited before their wallet could be recovered")=>{r({shouldCallAuthOnSuccess:!1}),P(typeof k=="string"?new Me(k):k)};l&&(l.current=()=>g()),Nf(()=>{if(!e||!b)return g("User must be authenticated and have a Privy wallet before it can be recovered")},[e]);let D=k=>{k&&c(k)};return Xo(Ff,{children:[Ze(T,{onClose:g}),Ze(A,{}),Xo(Mf,{children:[Xo(Of,{children:[Ze(If,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ze("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),Ze("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:[Ze(bo,{onChange:k=>D(k.target.value),disabled:w}),!!m&&Ze(Df,{children:m})]}),Xo("div",{children:[Xo(Tl,{children:[Ze("h4",{children:"Why is this necessary?"}),Ze("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ze(Uf,{loading:w||!o,disabled:!s,onClick:async()=>{f(!0);let k=await t();if(k&&b&&s!==null)try{n("embedded_wallet_recovery_started",{walletAddress:b.address}),await o?.recover({address:b.address,accessToken:k,recoveryPin:s}),h(""),S?i(S):r({shouldCallAuthOnSuccess:!1}),E?.(b),n("embedded_wallet_recovery_completed",{walletAddress:b.address})}catch(N){tc(N)?h("Invalid recovery password, please try again."):h("An error has occurred, please try again.")}finally{f(!1)}else return g("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!b&&w,children:"Recover your account"})]})]}),Ze(W,{}),Ze(O,{protectedByPrivy:!0})]})},Of=Gn.div`
1080
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe."`;import{CheckCircleIcon as gf,XCircleIcon as vf}from"@heroicons/react/24/outline";import{Fragment as wf,jsx as Nt,jsxs as ha}from"react/jsx-runtime";var Mc=({error:e,onClose:t})=>ha(wf,{children:[Nt(P,{closeable:!1}),Nt(A,{}),e?ha(kt,{children:[Nt(vf,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}),Nt(fe,{title:"Something went wrong",description:e})]}):ha(kt,{children:[Nt(gf,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),Nt(fe,{title:"Success"})]}),Nt(V,{onClick:t,children:"Close"}),Nt(W,{}),Nt(O,{protectedByPrivy:!0})]});import{useReducer as Cf}from"react";var bf=(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}},Dc=()=>{let[e,t]=Cf(bf,"creating");return{send:t,state:e}};import{jsx as Nr}from"react/jsx-runtime";var Un=({onSubmit:e,...t})=>{let{send:o,state:r}=Dc(),n=Uc(async()=>{r==="finalizing"&&await e(),o("next")},[r,o,e]);Ef(()=>{let a;return r==="done"&&t.config.initiatedBy==="automatic"&&(a=setTimeout(()=>t.onClose?.(),Ue)),()=>{a&&clearTimeout(a)}},[r,t.config.initiatedBy,t.onClose]);let i=Uc(()=>{o("back")},[o]);return r==="creating"?Nr(Nc,{...t,onSubmit:n}):r==="saving"?Nr(Oc,{...t,onSubmit:n,onBack:i}):r==="confirming"?Nr(Cc,{...t,onSubmit:n,onBack:i}):r==="finalizing"?Nr(Pc,{...t,onSubmit:n,onBack:i}):r==="done"?Nr(Mc,{...t,onSubmit:n}):null};import{jsx as fa}from"react/jsx-runtime";var Tf=250,Fc=()=>{let{app:e,navigate:t,data:o,outerClickRef:r}=v(),[n,i]=Fn(""),[a,l]=Fn(!1),[s,c]=Fn(),[m,h]=Fn(null),w=Pf(!1),{authenticated:f,getAccessToken:b}=$(),{walletProxy:S,refreshUser:E,closePrivyModal:T,createAnalyticsEvent:g,isNewUserThisSession:D}=_(),{onSuccess:U,onFailure:k,callAuthOnSuccessOnClose:N}=o.createWallet,M=e?.embeddedWallets.requireUserPasswordOnCreate===!0,ue=!!(!n||w.current)&&!M,H=new Ve(async()=>B());xf(()=>{if(!f){t("LANDING"),k(new Error("User must be authenticated before creating a Privy wallet"));return}!M&&!a&&!w.current&&(l(!0),H.execute().finally(()=>l(!1)))},[M,f]);let j=()=>{M&&m&&m?.recoveryMethod!=="user-passcode"?k(new Me("User created a wallet but failed to set a password for it")):m?U(m):k(new Me("User wallet creation failed")),T({shouldCallAuthOnSuccess:N})};r&&(r.current=()=>({closeModal:!1}));let B=async function(){let I=await b();if(I)try{if(g("embedded_wallet_creation_started"),!await S?.create({accessToken:I,recoveryPassword:s}))throw g("embedded_wallet_creation_failed",{}),new Error("Unable to create wallet");let q=await E(),G=Z(q);if(!G)throw g("embedded_wallet_creation_failed",{}),new Error("Unable to create wallet");h(G),g("embedded_wallet_creation_completed",{walletAddress:G.address}),i(""),w.current=!0,M?t("EMBEDDED_WALLET_CREATED_SCREEN"):D?t("EMBEDDED_WALLET_CREATED_SCREEN"):G&&(U(G),T({shouldCallAuthOnSuccess:N}))}catch(_e){if(w.current)return;i("An error has occurred, please try again."),console.warn(_e)}},Y=async()=>M?(l(!0),H.execute().then(()=>new Promise(I=>setTimeout(I,Tf))).finally(()=>l(!1))):T({shouldCallAuthOnSuccess:N});return ue?fa(yc,{children:fa(Yo,{})}):fa(Un,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:ue||!S,buttonLoading:a,buttonHideAnimations:!m&&a,error:n,password:s||"",onClose:j,onPasswordChange:c,onPasswordGenerate:()=>c(Dn()),onSubmit:Y})};import{useEffect as _f,useState as Bn}from"react";import{jsx as Sf}from"react/jsx-runtime";var Bc=()=>{let[e,t]=Bn(null),[o,r]=Bn(!1),[n,i]=Bn(null),[a,l]=Bn(""),{authenticated:s,getAccessToken:c,user:m}=$(),{walletProxy:h,refreshUser:w,closePrivyModal:f,createAnalyticsEvent:b}=_(),{app:S,navigate:E,data:T,outerClickRef:g}=v(),{onSuccess:D,onFailure:U}=T.createWallet,k=Z(m),N=e?.recoveryMethod==="user-passcode";_f(()=>{s||(E("LANDING"),U(new Yr("User must be authenticated before setting a password on a Privy wallet")))},[s]);let M=()=>{if(n){U(n),f({shouldCallAuthOnSuccess:!1});return}if(!N){U(new Me("Exited before password was added to wallet")),f({shouldCallAuthOnSuccess:!1});return}D(e),f({shouldCallAuthOnSuccess:!1})};g&&(g.current=()=>(M(),{closeModal:!N}));let ue=async()=>{let j=await c();if(j&&k?.address&&a&&h)try{if(b("embedded_wallet_set_password_started",{walletAddress:k.address}),!(await h.setRecoveryPassword({accessToken:j,address:k.address,recoveryPassword:a})).address){i(new Me("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"error setting password"});return}let Y=await w(),I=Z(Y);if(!I){i(new Me("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:"wallet disconnected"});return}t(I),b("embedded_wallet_set_password_completed",{walletAddress:k.address})}catch(B){console.warn(B),i(B instanceof Error?B:new Error("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:k.address,reason:B})}},H=async()=>{N?(D(e),f({shouldCallAuthOnSuccess:!1})):(r(!0),i(null),await ue(),r(!1))};return Sf(Un,{appName:S?.name||"privy",config:{initiatedBy:"user",onCancel:M},error:n?"An error has occurred, please try again.":void 0,buttonLoading:o,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(Dn()),onPasswordChange:l,onSubmit:H,onClose:M})};import{UserCircleIcon as Af}from"@heroicons/react/24/outline";import{LockClosedIcon as kf}from"@heroicons/react/24/solid";import{useEffect as Rf}from"react";import{Fragment as Wf,jsx as Lt,jsxs as Hn}from"react/jsx-runtime";var Hc=()=>{let{user:e}=$(),{closePrivyModal:t,createAnalyticsEvent:o}=_(),{data:r,setModalData:n,navigate:i,outerClickRef:a}=v(),{onSuccess:l,onFailure:s}=r.setWalletPassword,c=()=>{s(new Me("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return Rf(()=>{a&&(a.current=c)},[]),Hn(Wf,{children:[Lt(P,{onClose:c}),Lt(A,{}),Hn(kt,{children:[Hn(Tl,{children:[Lt(Af,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),Lt(_l,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:Lt(kf,{width:"12px",height:"12px",fill:"white"})})]}),Hn(fe,{title:"Secure Your Account",children:["Please set a password to secure your account.",Lt("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."})]})]}),Lt(V,{onClick:()=>{let h=Z(e);o("embedded_wallet_set_password_started",{walletAddress:h?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),Lt(W,{}),Lt(O,{protectedByPrivy:!0})]})};import{ShieldCheckIcon as If}from"@heroicons/react/24/outline";import{useEffect as Nf,useState as ya}from"react";import Gn,{css as Lf}from"styled-components";import{Fragment as Ff,jsx as Ze,jsxs as Xo}from"react/jsx-runtime";var Gc=()=>{let{authenticated:e,getAccessToken:t}=$(),{walletProxy:o,closePrivyModal:r,createAnalyticsEvent:n}=_(),{navigate:i,data:a,outerClickRef:l}=v(),[s,c]=ya(void 0),[m,h]=ya(""),[w,f]=ya(!1),{privyWallet:b,onCompleteNavigateTo:S,onSuccess:E,onFailure:T}=a.recoverWallet,g=(k="User exited before their wallet could be recovered")=>{r({shouldCallAuthOnSuccess:!1}),T(typeof k=="string"?new Me(k):k)};l&&(l.current=()=>g()),Nf(()=>{if(!e||!b)return g("User must be authenticated and have a Privy wallet before it can be recovered")},[e]);let D=k=>{k&&c(k)};return Xo(Ff,{children:[Ze(P,{onClose:g}),Ze(A,{}),Xo(Mf,{children:[Xo(Of,{children:[Ze(If,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ze("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),Ze("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:[Ze(bo,{onChange:k=>D(k.target.value),disabled:w}),!!m&&Ze(Df,{children:m})]}),Xo("div",{children:[Xo(Pl,{children:[Ze("h4",{children:"Why is this necessary?"}),Ze("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ze(Uf,{loading:w||!o,disabled:!s,onClick:async()=>{f(!0);let k=await t();if(k&&b&&s!==null)try{n("embedded_wallet_recovery_started",{walletAddress:b.address}),await o?.recover({address:b.address,accessToken:k,recoveryPin:s}),h(""),S?i(S):r({shouldCallAuthOnSuccess:!1}),E?.(b),n("embedded_wallet_recovery_completed",{walletAddress:b.address})}catch(N){tc(N)?h("Invalid recovery password, please try again."):h("An error has occurred, please try again.")}finally{f(!1)}else return g("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!b&&w,children:"Recover your account"})]})]}),Ze(W,{}),Ze(O,{protectedByPrivy:!0})]})},Of=Gn.div`
1081
1081
  display: flex;
1082
1082
  flex-direction: column;
1083
1083
  align-items: center;
@@ -1119,7 +1119,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1119
1119
  transition: none;
1120
1120
  }
1121
1121
  `}
1122
- `;import{EyeSlashIcon as Hf,LinkIcon as Gf,ClockIcon as zf}from"@heroicons/react/24/outline";import Ot from"styled-components";import{jsx as ga,jsxs as Bf}from"react/jsx-runtime";var zn=({size:e=61,...t})=>ga("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:Bf("g",{id:"moonpay_symbol_wht 2",children:[ga("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),ga("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 zc,jsx as Te,jsxs as xo}from"react/jsx-runtime";var va=({title:e,desc:t,icon:o})=>xo(Kf,{children:[Te(Jf,{children:o}),xo(Yf,{children:[Te(qf,{children:e}),Te(jf,{children:t})]})]}),$c=({app:e,signedUrl:t,onContinue:o})=>xo(zc,{children:[xo($f,{children:[Te(zn,{size:"3.75rem"}),xo(Vf,{children:[e?.name," uses ",Te("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),xo(Qf,{children:[Te(va,{icon:Te(Gf,{width:"1rem"}),title:"Purchase assets to fund your account",desc:xo(zc,{children:["Connect a payment method (",Te("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Te(va,{icon:Te(zf,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Te(va,{icon:Te(Hf,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Te(Zf,{className:"mobile-only"})]}),Te(ce,{children:Te(En,{href:t,target:"_blank",rel:"noopener noreferrer",annotation:"By clicking continue, you will be taken to MoonPay in a new tab",onClick:o,children:"Continue to Moonpay"})})]}),$f=Ot.div`
1122
+ `;import{EyeSlashIcon as Hf,LinkIcon as Gf,ClockIcon as zf}from"@heroicons/react/24/outline";import Ot from"styled-components";import{jsx as ga,jsxs as Bf}from"react/jsx-runtime";var zn=({size:e=61,...t})=>ga("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:Bf("g",{id:"moonpay_symbol_wht 2",children:[ga("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),ga("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 zc,jsx as Pe,jsxs as xo}from"react/jsx-runtime";var va=({title:e,desc:t,icon:o})=>xo(Kf,{children:[Pe(Jf,{children:o}),xo(Yf,{children:[Pe(qf,{children:e}),Pe(jf,{children:t})]})]}),$c=({app:e,signedUrl:t,onContinue:o})=>xo(zc,{children:[xo($f,{children:[Pe(zn,{size:"3.75rem"}),xo(Vf,{children:[e?.name," uses ",Pe("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),xo(Qf,{children:[Pe(va,{icon:Pe(Gf,{width:"1rem"}),title:"Purchase assets to fund your account",desc:xo(zc,{children:["Connect a payment method (",Pe("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Pe(va,{icon:Pe(zf,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Pe(va,{icon:Pe(Hf,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Pe(Zf,{className:"mobile-only"})]}),Pe(ce,{children:Pe(En,{href:t,target:"_blank",rel:"noopener noreferrer",annotation:"By clicking continue, you will be taken to MoonPay in a new tab",onClick:o,children:"Continue to Moonpay"})})]}),$f=Ot.div`
1123
1123
  display: flex;
1124
1124
  flex-direction: column;
1125
1125
  align-items: center;
@@ -1166,7 +1166,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1166
1166
  margin: 0 0.5rem;
1167
1167
  `,Zf=Ot.div`
1168
1168
  margin: 30px 0;
1169
- `;import{ofetch as Xf}from"ofetch";import{useEffect as ey,useRef as ty,useState as oy}from"react";var $n="moonpay",Vc="sdk_fiat_on_ramp_completed_with_status";async function qc(e,t,o,r,n=!1){let i=o.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=o.uiConfig||{accentColor:r.accent,theme:r.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...o,...i,...a}})}async function ry(e,t){let o=t?Hs:Bs,r=t?zs:Gs;return Xf(`${o}/transactions/ext/${e}`,{query:{apiKey:r}})}function jc(e,t=!1){let[o,r]=oy(null),{createAnalyticsEvent:n}=_(),i=ty(0);return ey(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await ry(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;r(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(Vc,{status:s,provider:$n,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&&(r("serviceFailure"),n(Vc,{status:"serviceFailure",provider:$n}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),o}import{Fragment as ny,jsx as Vn,jsxs as iy}from"react/jsx-runtime";var Kc=()=>{let{app:e,data:t,navigate:o}=v(),{createAnalyticsEvent:r}=_(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:iy(ny,{children:[Vn(T,{title:"Fund account"},"header"),Vn(A,{}),Vn($c,{app:e,signedUrl:n,onContinue:()=>{r("sdk_fiat_on_ramp_started",{provider:$n}),o("FIAT_ON_RAMP_STATUS_SCREEN")}}),Vn(O,{protectedByPrivy:!0})]})};import{ArrowsRightLeftIcon as ay,CheckCircleIcon as sy,XCircleIcon as ly}from"@heroicons/react/24/solid";import{useMemo as cy}from"react";import Yc from"styled-components";import{Fragment as wa,jsx as ge,jsxs as To}from"react/jsx-runtime";var Jc=()=>{let{app:e,data:t}=v(),{closePrivyModal:o}=_(),{externalTransactionId:r}=t?.fiatOnRampStatus,n=jc(r||null,e.fiatOnRamp.useSandbox);return To(wa,{children:[ge(T,{title:"Fund account"},"header"),ge(A,{}),ge(py,{status:n,onClickCta:o}),ge(O,{protectedByPrivy:!0})]})},dy=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:To(wa,{children:[To("p",{children:["It looks like there was an issue with your payment. Please contact"," ",ge("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),ge("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:""}}},py=({status:e,onClickCta:t})=>{let{title:o,body:r,cta:n}=cy(()=>dy(e),[e]);return To(wa,{children:[To(yy,{style:{height:"100%",gap:0},children:[ge(hy,{status:e}),To(Yt,{children:[ge("h3",{children:o}),ge(fy,{children:r})]})]}),n&&ge(ce,{children:ge(V,{onClick:t,children:n})})]})},uy=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)",my=e=>{switch(e){case"serviceFailure":case"failed":return ly;case"completed":return sy;case"waitingAuthorization":return()=>ge(ay,{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}},hy=({status:e})=>{if(!e||e==="pending"){let r="var(--privy-color-foreground-4)";return To("div",{style:{position:"relative"},children:[ge(wo,{color:r,style:{position:"absolute"}}),ge(zi,{color:r}),ge(zn,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=my(e),o=uy(e);return ge("div",{style:{borderColor:o,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&ge(t,{width:"4rem",height:"4rem",color:o})})},fy=Yc.p`
1169
+ `;import{ofetch as Xf}from"ofetch";import{useEffect as ey,useRef as ty,useState as oy}from"react";var $n="moonpay",Vc="sdk_fiat_on_ramp_completed_with_status";async function qc(e,t,o,r,n=!1){let i=o.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=o.uiConfig||{accentColor:r.accent,theme:r.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...o,...i,...a}})}async function ry(e,t){let o=t?Hs:Bs,r=t?zs:Gs;return Xf(`${o}/transactions/ext/${e}`,{query:{apiKey:r}})}function jc(e,t=!1){let[o,r]=oy(null),{createAnalyticsEvent:n}=_(),i=ty(0);return ey(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await ry(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;r(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(Vc,{status:s,provider:$n,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&&(r("serviceFailure"),n(Vc,{status:"serviceFailure",provider:$n}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),o}import{Fragment as ny,jsx as Vn,jsxs as iy}from"react/jsx-runtime";var Kc=()=>{let{app:e,data:t,navigate:o}=v(),{createAnalyticsEvent:r}=_(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:iy(ny,{children:[Vn(P,{title:"Fund account"},"header"),Vn(A,{}),Vn($c,{app:e,signedUrl:n,onContinue:()=>{r("sdk_fiat_on_ramp_started",{provider:$n}),o("FIAT_ON_RAMP_STATUS_SCREEN")}}),Vn(O,{protectedByPrivy:!0})]})};import{ArrowsRightLeftIcon as ay,CheckCircleIcon as sy,XCircleIcon as ly}from"@heroicons/react/24/solid";import{useMemo as cy}from"react";import Yc from"styled-components";import{Fragment as wa,jsx as ge,jsxs as Po}from"react/jsx-runtime";var Jc=()=>{let{app:e,data:t}=v(),{closePrivyModal:o}=_(),{externalTransactionId:r}=t?.fiatOnRampStatus,n=jc(r||null,e.fiatOnRamp.useSandbox);return Po(wa,{children:[ge(P,{title:"Fund account"},"header"),ge(A,{}),ge(py,{status:n,onClickCta:o}),ge(O,{protectedByPrivy:!0})]})},dy=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:Po(wa,{children:[Po("p",{children:["It looks like there was an issue with your payment. Please contact"," ",ge("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),ge("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:""}}},py=({status:e,onClickCta:t})=>{let{title:o,body:r,cta:n}=cy(()=>dy(e),[e]);return Po(wa,{children:[Po(yy,{style:{height:"100%",gap:0},children:[ge(hy,{status:e}),Po(Yt,{children:[ge("h3",{children:o}),ge(fy,{children:r})]})]}),n&&ge(ce,{children:ge(V,{onClick:t,children:n})})]})},uy=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)",my=e=>{switch(e){case"serviceFailure":case"failed":return ly;case"completed":return sy;case"waitingAuthorization":return()=>ge(ay,{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}},hy=({status:e})=>{if(!e||e==="pending"){let r="var(--privy-color-foreground-4)";return Po("div",{style:{position:"relative"},children:[ge(wo,{color:r,style:{position:"absolute"}}),ge(zi,{color:r}),ge(zn,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=my(e),o=uy(e);return ge("div",{style:{borderColor:o,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&ge(t,{width:"4rem",height:"4rem",color:o})})},fy=Yc.p`
1170
1170
  font-size: 1rem;
1171
1171
  color: var(--privy-color-foreground-3);
1172
1172
  margin-bottom: 1rem;
@@ -1185,7 +1185,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1185
1185
  flex-direction: column;
1186
1186
  justify-content: flex-start;
1187
1187
  gap: 4px;
1188
- `,Po=Ca.div`
1188
+ `,To=Ca.div`
1189
1189
  &&& {
1190
1190
  margin-left: 7px; /* TODO: This is a total hack */
1191
1191
  border-left: 2px solid var(--privy-color-foreground-4);
@@ -1209,7 +1209,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1209
1209
  margin-bottom: auto;
1210
1210
  }
1211
1211
  }
1212
- `;import Cy from"qrcode";import by from"styled-components";import{Fragment as er,jsx as Pe,jsxs as td}from"react/jsx-runtime";var Ge=7,ba=(e,t,o,r,n)=>{for(let i=t;i<t+r;i++)for(let a=o;a<o+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},Ey=e=>{let t=Cy.create(e,{errorCorrectionLevel:"high"}).modules,o=qs(Array.from(t.data),t.size);return o=ba(o,0,0,Ge,Ge),o=ba(o,o.length-Ge,0,Ge,Ge),o=ba(o,0,o.length-Ge,Ge,Ge),o},xy=({x:e,y:t,cellSize:o,bgColor:r,fgColor:n})=>Pe(er,{children:[0,1,2].map(i=>Pe("circle",{r:o*(Ge-i*2)/2,cx:e+o*Ge/2,cy:t+o*Ge/2,fill:i%2!==0?r:n},`finder-${e}-${t}-${i}`))}),Ty=({cellSize:e,matrixSize:t,bgColor:o,fgColor:r})=>{let n=[[0,0],[(t-Ge)*e,0],[0,(t-Ge)*e]];return Pe(er,{children:n.map(([i,a])=>Pe(xy,{x:i,y:a,cellSize:e,bgColor:o,fgColor:r}))})},Py=({matrix:e,cellSize:t,color:o})=>Pe(er,{children:e.map((r,n)=>r.map((i,a)=>i?Pe("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:o},`circle-${n}-${a}`):Pe(er,{})))}),Xc=(e,t)=>e-e%t,_y=({outputSize:e,cellSize:t,element:o,size:r,padding:n,bgColor:i})=>{if(!o)return Pe(er,{});let a=r||40,l=n||4,s=o,c=e/2-a/2-l;return td(er,{children:[Pe("rect",{x:Xc(c,t),y:Xc(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),Pe(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},Sy=e=>{let t=e.outputSize,o=Ey(e.url),r=t/o.length;return td("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Pe(Py,{matrix:o,cellSize:r,color:e.fgColor}),Pe(Ty,{cellSize:r,matrixSize:o.length,fgColor:e.fgColor,bgColor:e.bgColor}),Pe(_y,{outputSize:e.outputSize,cellSize:r,element:e.logo?.element,bgColor:e.bgColor})]})},Ay=by.div`
1212
+ `;import Cy from"qrcode";import by from"styled-components";import{Fragment as er,jsx as Te,jsxs as td}from"react/jsx-runtime";var Ge=7,ba=(e,t,o,r,n)=>{for(let i=t;i<t+r;i++)for(let a=o;a<o+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},Ey=e=>{let t=Cy.create(e,{errorCorrectionLevel:"high"}).modules,o=qs(Array.from(t.data),t.size);return o=ba(o,0,0,Ge,Ge),o=ba(o,o.length-Ge,0,Ge,Ge),o=ba(o,0,o.length-Ge,Ge,Ge),o},xy=({x:e,y:t,cellSize:o,bgColor:r,fgColor:n})=>Te(er,{children:[0,1,2].map(i=>Te("circle",{r:o*(Ge-i*2)/2,cx:e+o*Ge/2,cy:t+o*Ge/2,fill:i%2!==0?r:n},`finder-${e}-${t}-${i}`))}),Py=({cellSize:e,matrixSize:t,bgColor:o,fgColor:r})=>{let n=[[0,0],[(t-Ge)*e,0],[0,(t-Ge)*e]];return Te(er,{children:n.map(([i,a])=>Te(xy,{x:i,y:a,cellSize:e,bgColor:o,fgColor:r}))})},Ty=({matrix:e,cellSize:t,color:o})=>Te(er,{children:e.map((r,n)=>r.map((i,a)=>i?Te("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:o},`circle-${n}-${a}`):Te(er,{})))}),Xc=(e,t)=>e-e%t,_y=({outputSize:e,cellSize:t,element:o,size:r,padding:n,bgColor:i})=>{if(!o)return Te(er,{});let a=r||40,l=n||4,s=o,c=e/2-a/2-l;return td(er,{children:[Te("rect",{x:Xc(c,t),y:Xc(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),Te(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},Sy=e=>{let t=e.outputSize,o=Ey(e.url),r=t/o.length;return td("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Te(Ty,{matrix:o,cellSize:r,color:e.fgColor}),Te(Py,{cellSize:r,matrixSize:o.length,fgColor:e.fgColor,bgColor:e.bgColor}),Te(_y,{outputSize:e.outputSize,cellSize:r,element:e.logo?.element,bgColor:e.bgColor})]})},Ay=by.div`
1213
1213
  display: flex;
1214
1214
  justify-content: center;
1215
1215
  align-items: center;
@@ -1224,7 +1224,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1224
1224
  border-color: ${e=>e.fgColor};
1225
1225
  border-radius: var(--privy-border-radius-md);
1226
1226
  }
1227
- `,ed=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return Pe(Ay,{size:r,bgColor:t,fgColor:o,children:Pe(Sy,{url:e.url,logo:{element:e.squareLogoElement},outputSize:r,bgColor:t,fgColor:o})})};import{jsx as ky}from"react/jsx-runtime";var od=({size:e})=>ky(ed,{url:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",squareLogoElement:pt,size:e,fgColor:"#1F1F1F"});import{jsx as rd}from"react/jsx-runtime";var nd=e=>rd("svg",{width:"160",height:"160",viewBox:"0 0 160 160",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:rd("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M68.853 62.127c-5.174.517-8.978 4.95-8.978 10.149v15.336c0 5.248 3.873 9.7 9.098 10.196 3.623.344 7.71.64 11.027.64 5.445 0 12.964-.799 17.098-1.294a3.445 3.445 0 0 0 3.027-3.436v-19.05c0-1.75-1.29-3.228-3.027-3.436-3.657-.438-9.961-1.113-15.136-1.264a66.647 66.647 0 0 0-1.965-.03c-.72 0-1.478.013-2.262.04-3.046.1-6.453.373-9.467.669a1.677 1.677 0 0 1-.174-3.347c3.804-.373 8.282-.717 11.903-.717 4.034 0 9.137.427 13.193.847 1.322.137 2.54.274 3.58.397v-1.582c0-1.734-1.264-3.203-2.983-3.426-3.83-.497-10.563-1.267-15.464-1.267-2.848 0-6.314.26-9.47.575Zm25.399 24.581a2.516 2.516 0 1 0 0-5.031 2.516 2.516 0 0 0 0 5.031Z",fill:"var(--privy-color-accent)"})});import{jsx as ve,jsxs as Ry}from"react/jsx-runtime";var id=({style:e,...t})=>Ry("svg",{width:"286",height:"183",viewBox:"0 0 286 183",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:[ve("rect",{x:"198.5",y:"133",width:"50",height:"50",rx:"25",fill:"#E1E7EF"}),ve(Ce,{x:"206",y:"140",width:"36",height:"36"}),ve("rect",{x:"192",y:"30",width:"50",height:"50",rx:"25",fill:"#0C5BFF"}),ve("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M205 55C205 61.6274 210.373 67 217 67C223.627 67 229 61.6274 229 55C229 48.3726 223.627 43 217 43C210.373 43 205 48.3726 205 55ZM213.933 51.1333C213.491 51.1333 213.133 51.4915 213.133 51.9333V58.0667C213.133 58.5085 213.491 58.8667 213.933 58.8667H220.067C220.508 58.8667 220.867 58.5085 220.867 58.0667V51.9333C220.867 51.4915 220.508 51.1333 220.067 51.1333H213.933Z",fill:"white"}),ve("rect",{x:"39.5",y:"18",width:"50",height:"50",rx:"50",fill:"#AB9FF2"}),ve(Ke,{x:"44.5",y:"23",width:"40",height:"40"}),ve("rect",{x:"46.5",y:"124",width:"50",height:"50",rx:"25",fill:"#141414"}),ve("g",{clipPath:"url(#clip0_428_81)",children:ve("path",{d:"M62.1497 143.578C67.3134 138.585 75.6867 138.585 80.8505 143.578L81.4722 144.179C81.5335 144.238 81.5822 144.308 81.6155 144.386C81.6488 144.463 81.666 144.547 81.666 144.631C81.666 144.715 81.6488 144.799 81.6155 144.876C81.5822 144.954 81.5335 145.024 81.4722 145.083L79.3462 147.139C79.2835 147.199 79.1996 147.232 79.1123 147.232C79.025 147.232 78.9411 147.199 78.8784 147.139L78.0232 146.311C74.421 142.829 68.58 142.829 64.977 146.311L64.0611 147.197C63.9984 147.257 63.9145 147.29 63.8272 147.29C63.7399 147.29 63.656 147.257 63.5933 147.197L61.4672 145.141C61.4059 145.083 61.3572 145.012 61.3239 144.935C61.2906 144.857 61.2735 144.774 61.2735 144.689C61.2735 144.605 61.2906 144.521 61.3239 144.444C61.3572 144.366 61.4059 144.296 61.4672 144.237L62.1497 143.578ZM85.248 147.829L87.1397 149.659C87.201 149.718 87.2497 149.788 87.283 149.865C87.3163 149.943 87.3334 150.027 87.3334 150.111C87.3334 150.195 87.3163 150.279 87.283 150.356C87.2497 150.434 87.201 150.504 87.1397 150.563L78.6081 158.812C78.4828 158.933 78.315 159 78.1403 159C77.9656 159 77.7978 158.933 77.6725 158.812L71.6177 152.957C71.5864 152.927 71.5443 152.91 71.5005 152.91C71.4567 152.91 71.4147 152.927 71.3833 152.957L65.3285 158.812C65.2032 158.933 65.0354 159 64.8607 159C64.686 159 64.5182 158.933 64.3929 158.812L55.8605 150.563C55.7992 150.504 55.7505 150.434 55.7172 150.356C55.6839 150.279 55.6667 150.195 55.6667 150.111C55.6667 150.027 55.6839 149.943 55.7172 149.865C55.7505 149.788 55.7992 149.718 55.8605 149.659L57.7531 147.829C57.8783 147.709 58.0459 147.642 58.2204 147.642C58.3949 147.642 58.5625 147.709 58.6878 147.829L64.7427 153.684C64.774 153.714 64.816 153.731 64.8598 153.731C64.9036 153.731 64.9457 153.714 64.977 153.684L71.0319 147.829C71.1572 147.709 71.325 147.641 71.4997 147.641C71.6743 147.641 71.8422 147.709 71.9675 147.829L78.0232 153.684C78.0545 153.714 78.0965 153.731 78.1403 153.731C78.1841 153.731 78.2262 153.714 78.2575 153.684L84.3124 147.829C84.4377 147.709 84.6055 147.641 84.7802 147.641C84.9549 147.641 85.1227 147.709 85.248 147.829Z",fill:"white"})}),ve("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",fill:"var(--privy-color-foreground-accent)"}),ve(nd,{x:"63",y:"17"}),ve("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",stroke:"#E1E7EF",strokeWidth:"2"}),ve("path",{fill:"var(--privy-color-accent)",d:"M269.405 111c8.865 0 16.052-7.163 16.052-16s-7.187-16-16.052-16c-8.865 0-16.051 7.163-16.051 16s7.186 16 16.051 16ZM133.971 24c6.649 0 12.039-5.373 12.039-12s-5.39-12-12.039-12-12.039 5.373-12.039 12 5.39 12 12.039 12ZM15.592 112c4.986 0 9.029-4.029 9.029-9 0-4.97-4.043-9-9.03-9-4.986 0-9.028 4.03-9.028 9 0 4.971 4.042 9 9.029 9Z"}),ve("path",{fill:"var(--privy-color-accent-light)",d:"M152.029 177c5.541 0 10.032-4.477 10.032-10s-4.491-10-10.032-10-10.032 4.477-10.032 10 4.491 10 10.032 10ZM263.386 21c4.432 0 8.026-3.582 8.026-8s-3.594-8-8.026-8c-4.433 0-8.026 3.582-8.026 8s3.593 8 8.026 8ZM7.064 36c3.602 0 6.521-2.91 6.521-6.5s-2.92-6.5-6.52-6.5C3.462 23 .542 25.91.542 29.5S3.463 36 7.064 36Z"}),ve("defs",{children:ve("clipPath",{id:"clip0_428_81",children:ve("rect",{width:"31.6667",height:"19.1667",fill:"white",transform:"translate(55.6667 139.833)"})})})]});import{Fragment as Ea,jsx as R,jsxs as ae}from"react/jsx-runtime";var xa=()=>{let{navigate:e}=v(),t="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en";return Mt.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"),ae(_a,{children:[R(vt,{title:"Create a MetaMask wallet",description:"Follow the instructions below to get started."}),R(Sa,{children:R(Ce,{style:{width:"152px",height:"152px"}})}),ae(qn,{children:[R(bt,{children:ae("div",{children:[R("span",{children:"Install the "}),R("a",{href:t,target:"_blank",children:"MetaMask browser extension"})]})}),R(Po,{}),R(bt,{children:"Set up your first wallet"}),R(Po,{}),R(bt,{children:"Store your recovery phrase in a safe place!"})]}),R(he,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Ta=()=>{let{navigate:e}=v(),t="https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return Mt.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/phantom-app/"),ae(_a,{children:[R(vt,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),R(Sa,{children:R(Ke,{style:{width:"152px",height:"152px"}})}),ae(qn,{children:[R(bt,{children:ae("div",{children:[R("span",{children:"Install the "}),R("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),R(Po,{}),R(bt,{children:"Set up your first wallet"}),R(Po,{}),R(bt,{children:"Store your recovery phrase in a safe place!"})]}),R(he,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Pa=()=>{let{navigate:e}=v();return ae(_a,{children:[R(vt,{title:"Create a Coinbase wallet",description:"Follow the instructions below to get started."}),R(Sa,{style:{marginTop:"-24px"},children:R(od,{size:200})}),ae(qn,{children:[R(bt,{children:"Scan the QR code with your camera"}),R(Po,{}),R(bt,{children:"Set up your first wallet"}),R(Po,{}),R(bt,{children:"Store your seed phrase in a safe place!"})]}),R(he,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},ld=()=>{let[e,t]=Wy("WHAT_IS_A_WALLET"),{navigateBack:o}=v();return ae(Ea,{children:[R(T,{backFn:e==="WHAT_IS_A_WALLET"?o:e==="PICK_A_NEW_WALLET"?()=>t("WHAT_IS_A_WALLET"):()=>t("PICK_A_NEW_WALLET")},"header"),R(A,{}),ae(Iy,{children:[e==="WHAT_IS_A_WALLET"&&ae(Ea,{children:[R(Dy,{children:R(id,{style:{width:"240px",height:"auto",borderRadius:"var(--privy-border-radius-sm)",marginBottom:"32px"}})}),ae(fe,{title:"Get started with a new wallet",children:[R("p",{children:"Wallets help you store, send, and receive digital assets and collectibles. They are also a new\xA0way\xA0to\xA0log\xA0in."}),R("p",{children:"Instead of creating new accounts and passwords for every app, you just connect your wallet and bring your\xA0data\xA0with\xA0you."})]}),R(Oy,{children:R(My,{onClick:()=>{t("PICK_A_NEW_WALLET")},children:"Create a wallet"})})]}),e==="PICK_A_NEW_WALLET"&&R(Ea,{children:ae(Ny,{children:[R(vt,{title:"Create a new wallet",description:"Select one of the wallet providers below to get started."}),ae(Ly,{children:[ae(ad,{onClick:()=>{Mt.isIOS?window.location.href="https://apps.apple.com/us/app/metamask-blockchain-wallet/id1438144202":Mt.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=io.metamask":t("CREATE_METAMASK_WALLET")},children:[R(Ce,{}),ae(sd,{children:[R("h4",{children:"MetaMask"}),R("p",{children:"Get a browser-based wallet"})]})]}),ae(ad,{onClick:()=>{Mt.isIOS?window.location.href="https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455":Mt.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=org.toshi":t("CREATE_COINBASE_WALLET")},children:[R(pt,{}),ae(sd,{children:[R("h4",{children:"Coinbase Wallet"}),R("p",{children:"Get a mobile app wallet"})]})]})]})]})}),e==="CREATE_COINBASE_WALLET"&&R(Pa,{}),e==="CREATE_METAMASK_WALLET"&&R(xa,{}),e==="CREATE_PHANTOM_WALLET"&&R(Ta,{})]}),R(W,{}),ae(J,{children:[R("span",{children:"Still not sure? "}),R("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"}),"."]})]})},Iy=Et.div`
1227
+ `,ed=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return Te(Ay,{size:r,bgColor:t,fgColor:o,children:Te(Sy,{url:e.url,logo:{element:e.squareLogoElement},outputSize:r,bgColor:t,fgColor:o})})};import{jsx as ky}from"react/jsx-runtime";var od=({size:e})=>ky(ed,{url:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",squareLogoElement:pt,size:e,fgColor:"#1F1F1F"});import{jsx as rd}from"react/jsx-runtime";var nd=e=>rd("svg",{width:"160",height:"160",viewBox:"0 0 160 160",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:rd("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M68.853 62.127c-5.174.517-8.978 4.95-8.978 10.149v15.336c0 5.248 3.873 9.7 9.098 10.196 3.623.344 7.71.64 11.027.64 5.445 0 12.964-.799 17.098-1.294a3.445 3.445 0 0 0 3.027-3.436v-19.05c0-1.75-1.29-3.228-3.027-3.436-3.657-.438-9.961-1.113-15.136-1.264a66.647 66.647 0 0 0-1.965-.03c-.72 0-1.478.013-2.262.04-3.046.1-6.453.373-9.467.669a1.677 1.677 0 0 1-.174-3.347c3.804-.373 8.282-.717 11.903-.717 4.034 0 9.137.427 13.193.847 1.322.137 2.54.274 3.58.397v-1.582c0-1.734-1.264-3.203-2.983-3.426-3.83-.497-10.563-1.267-15.464-1.267-2.848 0-6.314.26-9.47.575Zm25.399 24.581a2.516 2.516 0 1 0 0-5.031 2.516 2.516 0 0 0 0 5.031Z",fill:"var(--privy-color-accent)"})});import{jsx as ve,jsxs as Ry}from"react/jsx-runtime";var id=({style:e,...t})=>Ry("svg",{width:"286",height:"183",viewBox:"0 0 286 183",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:[ve("rect",{x:"198.5",y:"133",width:"50",height:"50",rx:"25",fill:"#E1E7EF"}),ve(Ce,{x:"206",y:"140",width:"36",height:"36"}),ve("rect",{x:"192",y:"30",width:"50",height:"50",rx:"25",fill:"#0C5BFF"}),ve("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M205 55C205 61.6274 210.373 67 217 67C223.627 67 229 61.6274 229 55C229 48.3726 223.627 43 217 43C210.373 43 205 48.3726 205 55ZM213.933 51.1333C213.491 51.1333 213.133 51.4915 213.133 51.9333V58.0667C213.133 58.5085 213.491 58.8667 213.933 58.8667H220.067C220.508 58.8667 220.867 58.5085 220.867 58.0667V51.9333C220.867 51.4915 220.508 51.1333 220.067 51.1333H213.933Z",fill:"white"}),ve("rect",{x:"39.5",y:"18",width:"50",height:"50",rx:"50",fill:"#AB9FF2"}),ve(Ke,{x:"44.5",y:"23",width:"40",height:"40"}),ve("rect",{x:"46.5",y:"124",width:"50",height:"50",rx:"25",fill:"#141414"}),ve("g",{clipPath:"url(#clip0_428_81)",children:ve("path",{d:"M62.1497 143.578C67.3134 138.585 75.6867 138.585 80.8505 143.578L81.4722 144.179C81.5335 144.238 81.5822 144.308 81.6155 144.386C81.6488 144.463 81.666 144.547 81.666 144.631C81.666 144.715 81.6488 144.799 81.6155 144.876C81.5822 144.954 81.5335 145.024 81.4722 145.083L79.3462 147.139C79.2835 147.199 79.1996 147.232 79.1123 147.232C79.025 147.232 78.9411 147.199 78.8784 147.139L78.0232 146.311C74.421 142.829 68.58 142.829 64.977 146.311L64.0611 147.197C63.9984 147.257 63.9145 147.29 63.8272 147.29C63.7399 147.29 63.656 147.257 63.5933 147.197L61.4672 145.141C61.4059 145.083 61.3572 145.012 61.3239 144.935C61.2906 144.857 61.2735 144.774 61.2735 144.689C61.2735 144.605 61.2906 144.521 61.3239 144.444C61.3572 144.366 61.4059 144.296 61.4672 144.237L62.1497 143.578ZM85.248 147.829L87.1397 149.659C87.201 149.718 87.2497 149.788 87.283 149.865C87.3163 149.943 87.3334 150.027 87.3334 150.111C87.3334 150.195 87.3163 150.279 87.283 150.356C87.2497 150.434 87.201 150.504 87.1397 150.563L78.6081 158.812C78.4828 158.933 78.315 159 78.1403 159C77.9656 159 77.7978 158.933 77.6725 158.812L71.6177 152.957C71.5864 152.927 71.5443 152.91 71.5005 152.91C71.4567 152.91 71.4147 152.927 71.3833 152.957L65.3285 158.812C65.2032 158.933 65.0354 159 64.8607 159C64.686 159 64.5182 158.933 64.3929 158.812L55.8605 150.563C55.7992 150.504 55.7505 150.434 55.7172 150.356C55.6839 150.279 55.6667 150.195 55.6667 150.111C55.6667 150.027 55.6839 149.943 55.7172 149.865C55.7505 149.788 55.7992 149.718 55.8605 149.659L57.7531 147.829C57.8783 147.709 58.0459 147.642 58.2204 147.642C58.3949 147.642 58.5625 147.709 58.6878 147.829L64.7427 153.684C64.774 153.714 64.816 153.731 64.8598 153.731C64.9036 153.731 64.9457 153.714 64.977 153.684L71.0319 147.829C71.1572 147.709 71.325 147.641 71.4997 147.641C71.6743 147.641 71.8422 147.709 71.9675 147.829L78.0232 153.684C78.0545 153.714 78.0965 153.731 78.1403 153.731C78.1841 153.731 78.2262 153.714 78.2575 153.684L84.3124 147.829C84.4377 147.709 84.6055 147.641 84.7802 147.641C84.9549 147.641 85.1227 147.709 85.248 147.829Z",fill:"white"})}),ve("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",fill:"var(--privy-color-foreground-accent)"}),ve(nd,{x:"63",y:"17"}),ve("rect",{x:"103.5",y:"58",width:"78",height:"78",rx:"39",stroke:"#E1E7EF",strokeWidth:"2"}),ve("path",{fill:"var(--privy-color-accent)",d:"M269.405 111c8.865 0 16.052-7.163 16.052-16s-7.187-16-16.052-16c-8.865 0-16.051 7.163-16.051 16s7.186 16 16.051 16ZM133.971 24c6.649 0 12.039-5.373 12.039-12s-5.39-12-12.039-12-12.039 5.373-12.039 12 5.39 12 12.039 12ZM15.592 112c4.986 0 9.029-4.029 9.029-9 0-4.97-4.043-9-9.03-9-4.986 0-9.028 4.03-9.028 9 0 4.971 4.042 9 9.029 9Z"}),ve("path",{fill:"var(--privy-color-accent-light)",d:"M152.029 177c5.541 0 10.032-4.477 10.032-10s-4.491-10-10.032-10-10.032 4.477-10.032 10 4.491 10 10.032 10ZM263.386 21c4.432 0 8.026-3.582 8.026-8s-3.594-8-8.026-8c-4.433 0-8.026 3.582-8.026 8s3.593 8 8.026 8ZM7.064 36c3.602 0 6.521-2.91 6.521-6.5s-2.92-6.5-6.52-6.5C3.462 23 .542 25.91.542 29.5S3.463 36 7.064 36Z"}),ve("defs",{children:ve("clipPath",{id:"clip0_428_81",children:ve("rect",{width:"31.6667",height:"19.1667",fill:"white",transform:"translate(55.6667 139.833)"})})})]});import{Fragment as Ea,jsx as R,jsxs as ae}from"react/jsx-runtime";var xa=()=>{let{navigate:e}=v(),t="https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en";return Mt.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/"),ae(_a,{children:[R(vt,{title:"Create a MetaMask wallet",description:"Follow the instructions below to get started."}),R(Sa,{children:R(Ce,{style:{width:"152px",height:"152px"}})}),ae(qn,{children:[R(bt,{children:ae("div",{children:[R("span",{children:"Install the "}),R("a",{href:t,target:"_blank",children:"MetaMask browser extension"})]})}),R(To,{}),R(bt,{children:"Set up your first wallet"}),R(To,{}),R(bt,{children:"Store your recovery phrase in a safe place!"})]}),R(he,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Pa=()=>{let{navigate:e}=v(),t="https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return Mt.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/phantom-app/"),ae(_a,{children:[R(vt,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),R(Sa,{children:R(Ke,{style:{width:"152px",height:"152px"}})}),ae(qn,{children:[R(bt,{children:ae("div",{children:[R("span",{children:"Install the "}),R("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),R(To,{}),R(bt,{children:"Set up your first wallet"}),R(To,{}),R(bt,{children:"Store your recovery phrase in a safe place!"})]}),R(he,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Ta=()=>{let{navigate:e}=v();return ae(_a,{children:[R(vt,{title:"Create a Coinbase wallet",description:"Follow the instructions below to get started."}),R(Sa,{style:{marginTop:"-24px"},children:R(od,{size:200})}),ae(qn,{children:[R(bt,{children:"Scan the QR code with your camera"}),R(To,{}),R(bt,{children:"Set up your first wallet"}),R(To,{}),R(bt,{children:"Store your seed phrase in a safe place!"})]}),R(he,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},ld=()=>{let[e,t]=Wy("WHAT_IS_A_WALLET"),{navigateBack:o}=v();return ae(Ea,{children:[R(P,{backFn:e==="WHAT_IS_A_WALLET"?o:e==="PICK_A_NEW_WALLET"?()=>t("WHAT_IS_A_WALLET"):()=>t("PICK_A_NEW_WALLET")},"header"),R(A,{}),ae(Iy,{children:[e==="WHAT_IS_A_WALLET"&&ae(Ea,{children:[R(Dy,{children:R(id,{style:{width:"240px",height:"auto",borderRadius:"var(--privy-border-radius-sm)",marginBottom:"32px"}})}),ae(fe,{title:"Get started with a new wallet",children:[R("p",{children:"Wallets help you store, send, and receive digital assets and collectibles. They are also a new\xA0way\xA0to\xA0log\xA0in."}),R("p",{children:"Instead of creating new accounts and passwords for every app, you just connect your wallet and bring your\xA0data\xA0with\xA0you."})]}),R(Oy,{children:R(My,{onClick:()=>{t("PICK_A_NEW_WALLET")},children:"Create a wallet"})})]}),e==="PICK_A_NEW_WALLET"&&R(Ea,{children:ae(Ny,{children:[R(vt,{title:"Create a new wallet",description:"Select one of the wallet providers below to get started."}),ae(Ly,{children:[ae(ad,{onClick:()=>{Mt.isIOS?window.location.href="https://apps.apple.com/us/app/metamask-blockchain-wallet/id1438144202":Mt.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=io.metamask":t("CREATE_METAMASK_WALLET")},children:[R(Ce,{}),ae(sd,{children:[R("h4",{children:"MetaMask"}),R("p",{children:"Get a browser-based wallet"})]})]}),ae(ad,{onClick:()=>{Mt.isIOS?window.location.href="https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455":Mt.isAndroid?window.location.href="https://play.google.com/store/apps/details?id=org.toshi":t("CREATE_COINBASE_WALLET")},children:[R(pt,{}),ae(sd,{children:[R("h4",{children:"Coinbase Wallet"}),R("p",{children:"Get a mobile app wallet"})]})]})]})]})}),e==="CREATE_COINBASE_WALLET"&&R(Ta,{}),e==="CREATE_METAMASK_WALLET"&&R(xa,{}),e==="CREATE_PHANTOM_WALLET"&&R(Pa,{})]}),R(W,{}),ae(J,{children:[R("span",{children:"Still not sure? "}),R("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"}),"."]})]})},Iy=Et.div`
1228
1228
  display: flex;
1229
1229
  flex-direction: column;
1230
1230
  height: 100%;
@@ -1319,7 +1319,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1319
1319
  display: flex;
1320
1320
  justify-content: center;
1321
1321
  flex-grow: 1;
1322
- `;import{Fragment as Uy,jsx as tr,jsxs as cd}from"react/jsx-runtime";var dd=()=>{let{navigateBack:e}=v();return cd(Uy,{children:[tr(T,{backFn:e},"header"),tr(A,{}),tr(Pa,{}),tr(W,{}),cd(J,{children:[tr("span",{children:"Still not sure? "}),tr("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as Fy,jsx as or,jsxs as pd}from"react/jsx-runtime";var ud=()=>{let{navigateBack:e}=v();return pd(Fy,{children:[or(T,{backFn:e},"header"),or(A,{}),or(xa,{}),or(W,{}),pd(J,{children:[or("span",{children:"Still not sure? "}),or("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as By,jsx as rr,jsxs as md}from"react/jsx-runtime";var hd=()=>{let{navigateBack:e}=v();return md(By,{children:[rr(T,{backFn:e},"header"),rr(A,{}),rr(Ta,{}),rr(W,{}),md(J,{children:[rr("span",{children:"Still not sure? "}),rr("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{useState as ng}from"react";import{isMobile as Cd}from"react-device-detect";import nr from"styled-components";import{EnvelopeIcon as Hy}from"@heroicons/react/24/outline";import{useEffect as Aa,useState as ka}from"react";import Wa from"styled-components";import{Fragment as Vy,jsx as _o,jsxs as Ra}from"react/jsx-runtime";var jn=e=>{let[t,o]=ka(""),[r,n]=ka(!1),[i,a]=ka(null),{isLinking:l,initLoginWithEmail:s,captchaData:c}=_(),{app:m,navigate:h}=v(),w=m?.loginMethods.wallet??!1;Aa(()=>{document.querySelector("#email-input")?.focus()},[]);let f=$s(t),b=()=>{n(!0),s(t,c.token).then(()=>{c.enabled&&c.remove(),h("AWAITING_PASSWORDLESS_CODE")}).catch(g=>{g?.status===422?a(g.message):g?.privyErrorCode==="allowlist_rejected"?h("ALLOWLIST_REJECTION_SCREEN"):(console.error(g),a("Issue submitting email")),n(!1)})},S="Get started without a wallet.";i?S=i:l?S="\u200B":w||(S="Get started quickly with email");let E=c.enabled&&!c.token&&!c.error,P=c.error!==void 0;return Aa(()=>{c.error&&a("Issue verifying you are a human")},[c.error]),Aa(()=>{c.ready&&c.execute()},[c.ready]),Ra(Vy,{children:[Ra(Gy,{stacked:e.stacked,children:[Ra(zy,{standalone:e.stacked,children:[_o(Hy,{}),_o("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:g=>o(g.target.value),onKeyUp:g=>{g.key==="Enter"&&b()},value:t,autoComplete:"email"})]}),e.stacked?null:_o(Pn,{disabled:r||!f||E||P,onClick:b,children:r||E?_o(jt,{}):"Submit"})]}),c.enabled&&_o("div",{id:"cf-turnstile"}),_o($y,{fail:!!i,children:S}),e.stacked?_o(V,{loading:r||E,loadingText:null,disabled:r||!f||E||P,onClick:b,children:"Submit"}):null]})},Gy=Wa.div`
1322
+ `;import{Fragment as Uy,jsx as tr,jsxs as cd}from"react/jsx-runtime";var dd=()=>{let{navigateBack:e}=v();return cd(Uy,{children:[tr(P,{backFn:e},"header"),tr(A,{}),tr(Ta,{}),tr(W,{}),cd(J,{children:[tr("span",{children:"Still not sure? "}),tr("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as Fy,jsx as or,jsxs as pd}from"react/jsx-runtime";var ud=()=>{let{navigateBack:e}=v();return pd(Fy,{children:[or(P,{backFn:e},"header"),or(A,{}),or(xa,{}),or(W,{}),pd(J,{children:[or("span",{children:"Still not sure? "}),or("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{Fragment as By,jsx as rr,jsxs as md}from"react/jsx-runtime";var hd=()=>{let{navigateBack:e}=v();return md(By,{children:[rr(P,{backFn:e},"header"),rr(A,{}),rr(Pa,{}),rr(W,{}),md(J,{children:[rr("span",{children:"Still not sure? "}),rr("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})};import{useState as ng}from"react";import{isMobile as Cd}from"react-device-detect";import nr from"styled-components";import{EnvelopeIcon as Hy}from"@heroicons/react/24/outline";import{useEffect as Aa,useState as ka}from"react";import Wa from"styled-components";import{Fragment as Vy,jsx as _o,jsxs as Ra}from"react/jsx-runtime";var jn=e=>{let[t,o]=ka(""),[r,n]=ka(!1),[i,a]=ka(null),{isLinking:l,initLoginWithEmail:s,captchaData:c}=_(),{app:m,navigate:h}=v(),w=m?.loginMethods.wallet??!1;Aa(()=>{document.querySelector("#email-input")?.focus()},[]);let f=$s(t),b=()=>{n(!0),s(t,c.token).then(()=>{c.enabled&&c.remove(),h("AWAITING_PASSWORDLESS_CODE")}).catch(g=>{g?.status===422?a(g.message):g?.privyErrorCode==="allowlist_rejected"?h("ALLOWLIST_REJECTION_SCREEN"):(console.error(g),a("Issue submitting email")),n(!1)})},S="Get started without a wallet.";i?S=i:l?S="\u200B":w||(S="Get started quickly with email");let E=c.enabled&&!c.token&&!c.error,T=c.error!==void 0;return Aa(()=>{c.error&&a("Issue verifying you are a human")},[c.error]),Aa(()=>{c.ready&&c.execute()},[c.ready]),Ra(Vy,{children:[Ra(Gy,{stacked:e.stacked,children:[Ra(zy,{standalone:e.stacked,children:[_o(Hy,{}),_o("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:g=>o(g.target.value),onKeyUp:g=>{g.key==="Enter"&&b()},value:t,autoComplete:"email"})]}),e.stacked?null:_o(Tn,{disabled:r||!f||E||T,onClick:b,children:r||E?_o(jt,{}):"Submit"})]}),c.enabled&&_o("div",{id:"cf-turnstile"}),_o($y,{fail:!!i,children:S}),e.stacked?_o(V,{loading:r||E,loadingText:null,disabled:r||!f||E||T,onClick:b,children:"Submit"}):null]})},Gy=Wa.div`
1323
1323
  width: 100%;
1324
1324
  height: ${e=>e.stacked?"100%":"auto"};
1325
1325
 
@@ -1381,7 +1381,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1381
1381
  > a {
1382
1382
  text-decoration: underline;
1383
1383
  }
1384
- `;import{PhoneIcon as qy}from"@heroicons/react/24/outline";import{useEffect as Ia,useState as Na}from"react";import Oa from"styled-components";import{Fragment as Jy,jsx as So,jsxs as La}from"react/jsx-runtime";var Kn=e=>{let[t,o]=Na(""),[r,n]=Na(!1),[i,a]=Na(null),{isLinking:l,initLoginWithSms:s,captchaData:c}=_(),{app:m,navigate:h}=v(),w=m?.loginMethods.wallet??!1;Ia(()=>{document.querySelector("#phone-number-input")?.focus()},[]);let f=Vs(t),b=()=>{n(!0),s(t,c.token).then(()=>{c.enabled&&c.remove(),h("AWAITING_PASSWORDLESS_CODE")}).catch(g=>{g?.status===422?a(g.message):g?.privyErrorCode==="allowlist_rejected"?h("ALLOWLIST_REJECTION_SCREEN"):(console.error(g),a("Issue submitting phone number")),n(!1)})},S="Get started without a wallet.";i?S=i:l?S="\u200B":w||(S="Get started quickly with your phone");let E=c.enabled&&!c.token&&!c.error,P=c.error!==void 0;return Ia(()=>{c.error&&a("Issue verifying you are a human")},[c.error]),Ia(()=>{c.ready&&c.execute()},[c.ready]),La(Jy,{children:[La(jy,{stacked:e.stacked,children:[La(Ky,{standalone:e.stacked,children:[So(qy,{}),So("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:g=>{o(g.target.value)},onKeyUp:g=>{g.key==="Enter"&&b()},value:t,autoComplete:"tel"})]}),e.stacked?null:So(Pn,{disabled:r||!f||E||P,onClick:b,children:r||E?So(jt,{}):"Submit"})]}),c.enabled&&So("div",{id:"cf-turnstile"}),So(Yy,{fail:!!i,children:S}),e.stacked?So(V,{loading:r||E,loadingText:null,disabled:r||!f||E||P,onClick:b,children:"Submit"}):null]})},jy=Oa.div`
1384
+ `;import{PhoneIcon as qy}from"@heroicons/react/24/outline";import{useEffect as Ia,useState as Na}from"react";import Oa from"styled-components";import{Fragment as Jy,jsx as So,jsxs as La}from"react/jsx-runtime";var Kn=e=>{let[t,o]=Na(""),[r,n]=Na(!1),[i,a]=Na(null),{isLinking:l,initLoginWithSms:s,captchaData:c}=_(),{app:m,navigate:h}=v(),w=m?.loginMethods.wallet??!1;Ia(()=>{document.querySelector("#phone-number-input")?.focus()},[]);let f=Vs(t),b=()=>{n(!0),s(t,c.token).then(()=>{c.enabled&&c.remove(),h("AWAITING_PASSWORDLESS_CODE")}).catch(g=>{g?.status===422?a(g.message):g?.privyErrorCode==="allowlist_rejected"?h("ALLOWLIST_REJECTION_SCREEN"):(console.error(g),a("Issue submitting phone number")),n(!1)})},S="Get started without a wallet.";i?S=i:l?S="\u200B":w||(S="Get started quickly with your phone");let E=c.enabled&&!c.token&&!c.error,T=c.error!==void 0;return Ia(()=>{c.error&&a("Issue verifying you are a human")},[c.error]),Ia(()=>{c.ready&&c.execute()},[c.ready]),La(Jy,{children:[La(jy,{stacked:e.stacked,children:[La(Ky,{standalone:e.stacked,children:[So(qy,{}),So("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:g=>{o(g.target.value)},onKeyUp:g=>{g.key==="Enter"&&b()},value:t,autoComplete:"tel"})]}),e.stacked?null:So(Tn,{disabled:r||!f||E||T,onClick:b,children:r||E?So(jt,{}):"Submit"})]}),c.enabled&&So("div",{id:"cf-turnstile"}),So(Yy,{fail:!!i,children:S}),e.stacked?So(V,{loading:r||E,loadingText:null,disabled:r||!f||E||T,onClick:b,children:"Submit"}):null]})},jy=Oa.div`
1385
1385
  display: flex;
1386
1386
  border: 1px solid var(--privy-color-foreground-4);
1387
1387
  width: 100%;
@@ -1472,13 +1472,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1472
1472
  background-color: var(--privy-color-background-2);
1473
1473
  }
1474
1474
  }
1475
- `;import{Fragment as Da,jsx as oe,jsxs as ko}from"react/jsx-runtime";var Ed=()=>{let{app:e,outerClickRef:t}=v(),{captchaData:o,closePrivyModal:r}=_(),n=e?.loginMethods.email??!1,i=e?.loginMethods.sms??!1,a=e?.loginMethods.wallet??!1,l=e?.loginMethods.google??!1,s=e?.loginMethods.twitter??!1,c=e?.loginMethods.discord??!1,m=e?.loginMethods.github??!1,h=e?.loginMethods.tiktok??!1,w=e?.loginMethods.linkedin??!1,f=e?.loginMethods.apple??!1,b=!e?.appearance.showWalletLoginFirst,S=a&&e?.appearance.showWalletLoginFirst?0:1,[E,P]=ng(S),g=E==0,D=E==1,U=a,k=n||i,N=U!==k,M=()=>{o.enabled&&o.remove(),r()};return t&&(t.current=M),ko(Da,{children:[oe(T,{onClose:M},"header"),e?.appearance.logo?oe(cg,{hasOnlyOneSection:N,hasTerms:!!(e?.legal.privacyPolicyUrl||e?.legal.termsAndConditionsUrl),children:oe(Rn,{})}):null,ko(dg,{reverse:b,children:[U&&oe(ig,{active:g||N,connectOnly:!1,tabIndex:b?1:0,onClick:()=>{o.enabled&&o.remove(),P(0)},isOnlySection:!k}),k&&oe(ag,{active:D||N,onClick:()=>P(1),email:n,sms:i,google:l,twitter:s,twitterOAuthOnMobileEnabled:e?.loginConfig.twitterOAuthOnMobileEnabled??!1,discord:c,github:m,tiktok:h,linkedin:w,apple:f,tabIndex:b?0:1,isOnlySection:!U})]}),e&&oe(_n,{app:e}),oe(O,{protectedByPrivy:!0})]})};function ig(e){return ko(Td,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,tabIndex:e.tabIndex,children:[oe(xd,{active:e.active,children:oe("h4",{children:"Connect Wallet"})}),e.active&&ko(Da,{children:[oe(Zt,{connectOnly:e.connectOnly}),oe(Xt,{})]})]})}function ag(e){let t=!Cd||e.twitterOAuthOnMobileEnabled&&Cd,o=e.google||e.discord||e.github||e.tiktok||e.linkedin||e.twitter&&t||e.apple,r=e.email?"Email":"Phone";return ko(Td,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,tabIndex:e.tabIndex,children:[e.isOnlySection?null:oe(xd,{active:e.active,children:oe("h4",{children:o?`${r} & Social`:r})}),e.active&&e.email&&oe(jn,{}),e.active&&e.sms&&!e.email&&oe(Kn,{}),e.active&&o&&oe(sg,{google:e.google,twitter:e.twitter&&t,discord:e.discord,github:e.github,tiktok:e.tiktok,linkedin:e.linkedin,apple:e.apple})]})}function sg(e){return ko(Da,{children:[ko(lg,{children:[oe(bd,{}),oe("p",{children:" Or "}),oe(bd,{})]}),oe(wd,{showGoogle:e.google,showDiscord:e.discord,showGithub:e.github,showLinkedIn:e.linkedin,showTwitter:e.twitter,showTiktok:e.tiktok,showApple:e.apple})]})}var xd=nr.div`
1475
+ `;import{Fragment as Da,jsx as oe,jsxs as ko}from"react/jsx-runtime";var Ed=()=>{let{app:e,outerClickRef:t}=v(),{captchaData:o,closePrivyModal:r}=_(),n=e?.loginMethods.email??!1,i=e?.loginMethods.sms??!1,a=e?.loginMethods.wallet??!1,l=e?.loginMethods.google??!1,s=e?.loginMethods.twitter??!1,c=e?.loginMethods.discord??!1,m=e?.loginMethods.github??!1,h=e?.loginMethods.tiktok??!1,w=e?.loginMethods.linkedin??!1,f=e?.loginMethods.apple??!1,b=!e?.appearance.showWalletLoginFirst,S=a&&e?.appearance.showWalletLoginFirst?0:1,[E,T]=ng(S),g=E==0,D=E==1,U=a,k=n||i,N=U!==k,M=()=>{o.enabled&&o.remove(),r()};return t&&(t.current=M),ko(Da,{children:[oe(P,{onClose:M},"header"),e?.appearance.logo?oe(cg,{hasOnlyOneSection:N,hasTerms:!!(e?.legal.privacyPolicyUrl||e?.legal.termsAndConditionsUrl),children:oe(Rn,{})}):null,ko(dg,{reverse:b,children:[U&&oe(ig,{active:g||N,connectOnly:!1,tabIndex:b?1:0,onClick:()=>{o.enabled&&o.remove(),T(0)},isOnlySection:!k}),k&&oe(ag,{active:D||N,onClick:()=>T(1),email:n,sms:i,google:l,twitter:s,twitterOAuthOnMobileEnabled:e?.loginConfig.twitterOAuthOnMobileEnabled??!1,discord:c,github:m,tiktok:h,linkedin:w,apple:f,tabIndex:b?0:1,isOnlySection:!U})]}),e&&oe(_n,{app:e}),oe(O,{protectedByPrivy:!0})]})};function ig(e){return ko(Pd,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,tabIndex:e.tabIndex,children:[oe(xd,{active:e.active,children:oe("h4",{children:"Connect Wallet"})}),e.active&&ko(Da,{children:[oe(Zt,{connectOnly:e.connectOnly}),oe(Xt,{})]})]})}function ag(e){let t=!Cd||e.twitterOAuthOnMobileEnabled&&Cd,o=e.google||e.discord||e.github||e.tiktok||e.linkedin||e.twitter&&t||e.apple,r=e.email?"Email":"Phone";return ko(Pd,{active:e.active,onClick:e.onClick,isOnlySection:e.isOnlySection,tabIndex:e.tabIndex,children:[e.isOnlySection?null:oe(xd,{active:e.active,children:oe("h4",{children:o?`${r} & Social`:r})}),e.active&&e.email&&oe(jn,{}),e.active&&e.sms&&!e.email&&oe(Kn,{}),e.active&&o&&oe(sg,{google:e.google,twitter:e.twitter&&t,discord:e.discord,github:e.github,tiktok:e.tiktok,linkedin:e.linkedin,apple:e.apple})]})}function sg(e){return ko(Da,{children:[ko(lg,{children:[oe(bd,{}),oe("p",{children:" Or "}),oe(bd,{})]}),oe(wd,{showGoogle:e.google,showDiscord:e.discord,showGithub:e.github,showLinkedIn:e.linkedin,showTwitter:e.twitter,showTiktok:e.tiktok,showApple:e.apple})]})}var xd=nr.div`
1476
1476
  font-weight: ${e=>e.active?600:500};
1477
1477
  color: ${e=>e.active?"var(--privy-color-foreground)":"var(--privy-color-foreground-2)"};
1478
1478
  display: flex;
1479
1479
  justify-content: center;
1480
1480
  align-items: center;
1481
- `,Td=nr.div.attrs({role:"button"})`
1481
+ `,Pd=nr.div.attrs({role:"button"})`
1482
1482
  display: flex;
1483
1483
  flex-direction: column;
1484
1484
  align-items: flex-start;
@@ -1532,7 +1532,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1532
1532
  }
1533
1533
  `,dg=nr(ce)`
1534
1534
  flex-direction: ${e=>e.reverse?"column-reverse":"column"};
1535
- `;import{EnvelopeIcon as pg}from"@heroicons/react/24/outline";import{Fragment as ug,jsx as io,jsxs as mg}from"react/jsx-runtime";var Pd=()=>{let{app:e}=v();return mg(ug,{children:[io(T,{},"header"),io(A,{}),io(fe,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:io(pg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),io(ce,{children:io(jn,{stacked:!0})}),io(W,{}),io(O,{protectedByPrivy:!0})]})};import{PhoneIcon as hg}from"@heroicons/react/24/outline";import{Fragment as fg,jsx as ao,jsxs as yg}from"react/jsx-runtime";var _d=()=>{let{app:e}=v();return yg(fg,{children:[ao(T,{},"header"),ao(A,{}),ao(fe,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:ao(hg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),ao(ce,{children:ao(Kn,{stacked:!0})}),ao(W,{}),ao(O,{protectedByPrivy:!0})]})};import{Fragment as gg,jsx as Ro,jsxs as Sd}from"react/jsx-runtime";var Ad=()=>{let{linkingHint:e}=_(),{app:t}=v(),o=e?`Select the wallet with ${$t(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return Sd(gg,{children:[Ro(T,{},"header"),Ro(A,{}),Ro(Jt,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),Sd(ce,{children:[Ro(Zt,{connectOnly:!1}),Ro(Xt,{})]}),Ro(W,{}),Ro(O,{protectedByPrivy:!0})]})};import{jsx as kd,jsxs as vg}from"react/jsx-runtime";var Rd=({style:e,...t})=>vg("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:[kd("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),kd("path",{"fill-rule":"evenodd","clip-rule":"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 wg,jsx as so,jsxs as Wd}from"react/jsx-runtime";var Id=()=>{let{closePrivyModal:e}=_(),{navigate:t}=v();return Wd(wg,{children:[so(T,{},"header"),so(A,{}),so(Rd,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),so(Jt,{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"}}),Wd(ce,{children:[so(V,{onClick:()=>t("LANDING"),children:"Try again"}),so(xn,{onClick:()=>e(),children:"Cancel"})]}),so(W,{}),so(O,{protectedByPrivy:!0})]})};import{useEffect as Nd,useState as Ld}from"react";import Md from"styled-components";function Ua(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{Fragment as Eg,jsx as Dt,jsxs as ii}from"react/jsx-runtime";var Od={google:{name:"Google",component:Xn},discord:{name:"Discord",component:Jn},github:{name:"Github",component:Qn},linkedin:{name:"LinkedIn",component:ti},twitter:{name:"Twitter",component:ri},tiktok:{name:"Tiktok",component:oi},apple:{name:"Apple",component:Yn}},ni=()=>{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"),window.history.pushState({},"",e)},Dd=()=>{let{user:e,authenticated:t}=$(),{app:o,setModalData:r,navigate:n,resetNavigation:i,data:a}=v(),{getAuthMeta:l,initLoginWithOAuth:s,loginWithOAuth:c,updateWallets:m,closePrivyModal:h}=_(),[w,f]=Ld(!1),[b,S]=Ld(void 0),E=l()?.provider||"google",P=Od[E].name,g=Od[E].component,D=o?.render.inDialog?Ue:0;Nd(()=>{c().then(()=>{ni(),f(!0)}).catch(N=>{let M={retryable:!1,message:"Authentication failed"};if(N?.privyErrorCode==="allowlist_rejected"){S(void 0),i(),n("ALLOWLIST_REJECTION_SCREEN"),ni();return}else N?.privyErrorCode==="linked_to_another_user"?M.detail="This account has already been linked to another user.":N?.privyErrorCode==="invalid_credentials"?(M.retryable=!0,M.detail="Something went wrong. Try again."):N.privyErrorCode==="oauth_user_denied"&&(M.detail=`Retry and check ${Ua(E)} to finish connecting your account.`,M.retryable=!0);ni(),S(M)}).finally(()=>{a?.finishOauthFlow?.onComplete?.()})},[]),Nd(()=>{if(t&&w&&e)if(zt(e,o?.embeddedWallets?.createOnLogin)){let M=setTimeout(()=>{r({createWallet:{onSuccess:()=>{},onFailure:ue=>console.error(ue),callAuthOnSuccessOnClose:!0}}),n("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},D);return()=>clearTimeout(M)}else{let M=setTimeout(h,D);return m(),()=>clearTimeout(M)}},[t,w,e]);let U=w?`Successfully connected with ${P}`:b?b.message:`Verifying connection to ${P}`,k="";return w?k="You\u2019re good to go!":b?k=b.detail:k="Just a few moments more",ii(Eg,{children:[Dt(T,{}),Dt(A,{}),ii(Cg,{children:[Dt(bg,{children:ii("div",{children:[Dt(wn,{success:w,fail:!!b}),Dt(g,{style:{width:"38px",height:"38px"}})]})}),ii(Yt,{children:[Dt("h3",{children:U}),Dt("p",{children:k})]}),b&&b?.retryable?Dt(he,{onClick:()=>{ni(),s(E),S(void 0)},disabled:!w&&!b?.retryable,children:"Retry"}):null]}),Dt(J,{})]})},Cg=Md.div`
1535
+ `;import{EnvelopeIcon as pg}from"@heroicons/react/24/outline";import{Fragment as ug,jsx as io,jsxs as mg}from"react/jsx-runtime";var Td=()=>{let{app:e}=v();return mg(ug,{children:[io(P,{},"header"),io(A,{}),io(fe,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:io(pg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),io(ce,{children:io(jn,{stacked:!0})}),io(W,{}),io(O,{protectedByPrivy:!0})]})};import{PhoneIcon as hg}from"@heroicons/react/24/outline";import{Fragment as fg,jsx as ao,jsxs as yg}from"react/jsx-runtime";var _d=()=>{let{app:e}=v();return yg(fg,{children:[ao(P,{},"header"),ao(A,{}),ao(fe,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:ao(hg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),ao(ce,{children:ao(Kn,{stacked:!0})}),ao(W,{}),ao(O,{protectedByPrivy:!0})]})};import{Fragment as gg,jsx as Ro,jsxs as Sd}from"react/jsx-runtime";var Ad=()=>{let{linkingHint:e}=_(),{app:t}=v(),o=e?`Select the wallet with ${$t(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return Sd(gg,{children:[Ro(P,{},"header"),Ro(A,{}),Ro(Jt,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),Sd(ce,{children:[Ro(Zt,{connectOnly:!1}),Ro(Xt,{})]}),Ro(W,{}),Ro(O,{protectedByPrivy:!0})]})};import{jsx as kd,jsxs as vg}from"react/jsx-runtime";var Rd=({style:e,...t})=>vg("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:[kd("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),kd("path",{"fill-rule":"evenodd","clip-rule":"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 wg,jsx as so,jsxs as Wd}from"react/jsx-runtime";var Id=()=>{let{closePrivyModal:e}=_(),{navigate:t}=v();return Wd(wg,{children:[so(P,{},"header"),so(A,{}),so(Rd,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),so(Jt,{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"}}),Wd(ce,{children:[so(V,{onClick:()=>t("LANDING"),children:"Try again"}),so(xn,{onClick:()=>e(),children:"Cancel"})]}),so(W,{}),so(O,{protectedByPrivy:!0})]})};import{useEffect as Nd,useState as Ld}from"react";import Md from"styled-components";function Ua(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{Fragment as Eg,jsx as Dt,jsxs as ii}from"react/jsx-runtime";var Od={google:{name:"Google",component:Xn},discord:{name:"Discord",component:Jn},github:{name:"Github",component:Qn},linkedin:{name:"LinkedIn",component:ti},twitter:{name:"Twitter",component:ri},tiktok:{name:"Tiktok",component:oi},apple:{name:"Apple",component:Yn}},ni=()=>{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"),window.history.pushState({},"",e)},Dd=()=>{let{user:e,authenticated:t}=$(),{app:o,setModalData:r,navigate:n,resetNavigation:i,data:a}=v(),{getAuthMeta:l,initLoginWithOAuth:s,loginWithOAuth:c,updateWallets:m,closePrivyModal:h}=_(),[w,f]=Ld(!1),[b,S]=Ld(void 0),E=l()?.provider||"google",T=Od[E].name,g=Od[E].component,D=o?.render.inDialog?Ue:0;Nd(()=>{c().then(()=>{ni(),f(!0)}).catch(N=>{let M={retryable:!1,message:"Authentication failed"};if(N?.privyErrorCode==="allowlist_rejected"){S(void 0),i(),n("ALLOWLIST_REJECTION_SCREEN"),ni();return}else N?.privyErrorCode==="linked_to_another_user"?M.detail="This account has already been linked to another user.":N?.privyErrorCode==="invalid_credentials"?(M.retryable=!0,M.detail="Something went wrong. Try again."):N.privyErrorCode==="oauth_user_denied"&&(M.detail=`Retry and check ${Ua(E)} to finish connecting your account.`,M.retryable=!0);ni(),S(M)}).finally(()=>{a?.finishOauthFlow?.onComplete?.()})},[]),Nd(()=>{if(t&&w&&e)if(zt(e,o?.embeddedWallets?.createOnLogin)){let M=setTimeout(()=>{r({createWallet:{onSuccess:()=>{},onFailure:ue=>console.error(ue),callAuthOnSuccessOnClose:!0}}),n("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},D);return()=>clearTimeout(M)}else{let M=setTimeout(h,D);return m(),()=>clearTimeout(M)}},[t,w,e]);let U=w?`Successfully connected with ${T}`:b?b.message:`Verifying connection to ${T}`,k="";return w?k="You\u2019re good to go!":b?k=b.detail:k="Just a few moments more",ii(Eg,{children:[Dt(P,{}),Dt(A,{}),ii(Cg,{children:[Dt(bg,{children:ii("div",{children:[Dt(wn,{success:w,fail:!!b}),Dt(g,{style:{width:"38px",height:"38px"}})]})}),ii(Yt,{children:[Dt("h3",{children:U}),Dt("p",{children:k})]}),b&&b?.retryable?Dt(he,{onClick:()=>{ni(),s(E),S(void 0)},disabled:!w&&!b?.retryable,children:"Retry"}):null]}),Dt(J,{})]})},Cg=Md.div`
1536
1536
  display: flex;
1537
1537
  flex-direction: column;
1538
1538
  align-items: center;
@@ -1563,9 +1563,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1563
1563
  left: -19px;
1564
1564
  top: -19px;
1565
1565
  }
1566
- `;import{useEffect as Tg,useState as Fd}from"react";import Pg from"styled-components";import{isMobile as xg}from"react-device-detect";var Ud=(e,t)=>{let o=new URL(window.location.href),r=encodeURIComponent(o.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!je()&&xg)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};import{Fragment as Sg,jsx as Ut,jsxs as Bd}from"react/jsx-runtime";var Hd=()=>{let{forkSession:e,ready:t,authenticated:o}=$(),[r,n]=Fd(""),[i,a]=Fd(!1);Tg(()=>{t&&o&&e().then(n)},[t,o]);let l=Ud(r,!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."),Bd(Sg,{children:[Ut(T,{},"header"),Ut(A,{}),Ut(Jt,{title:s.title,description:s.description}),Bd(ce,{children:[Ut(_g,{children:Ut(Ke,{style:{width:"72px",height:"72px"}})}),Ut(En,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Ut("p",{children:s.footnote}):null]}),Ut(W,{}),Ut(O,{protectedByPrivy:!0})]})},_g=Pg(Vi)`
1566
+ `;import{useEffect as Pg,useState as Fd}from"react";import Tg from"styled-components";import{isMobile as xg}from"react-device-detect";var Ud=(e,t)=>{let o=new URL(window.location.href),r=encodeURIComponent(o.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!je()&&xg)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};import{Fragment as Sg,jsx as Ut,jsxs as Bd}from"react/jsx-runtime";var Hd=()=>{let{forkSession:e,ready:t,authenticated:o}=$(),[r,n]=Fd(""),[i,a]=Fd(!1);Pg(()=>{t&&o&&e().then(n)},[t,o]);let l=Ud(r,!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."),Bd(Sg,{children:[Ut(P,{},"header"),Ut(A,{}),Ut(Jt,{title:s.title,description:s.description}),Bd(ce,{children:[Ut(_g,{children:Ut(Ke,{style:{width:"72px",height:"72px"}})}),Ut(En,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Ut("p",{children:s.footnote}):null]}),Ut(W,{}),Ut(O,{protectedByPrivy:!0})]})},_g=Tg(Vi)`
1567
1567
  margin: 16px auto;
1568
- `;import{StaticJsonRpcProvider as _1}from"@ethersproject/providers";import{useMemo as Tp,useEffect as Pp,useState as No}from"react";import cr from"styled-components";import cp from"styled-components";import zd from"styled-components";import{jsx as Gd,jsxs as Rg}from"react/jsx-runtime";var ai=({label:e,children:t,valueStyles:o})=>Rg(Ag,{children:[Gd("div",{children:e}),Gd(kg,{style:{...o},children:t})]}),Ag=zd.div`
1568
+ `;import{StaticJsonRpcProvider as _1}from"@ethersproject/providers";import{useMemo as Pp,useEffect as Tp,useState as No}from"react";import cr from"styled-components";import cp from"styled-components";import zd from"styled-components";import{jsx as Gd,jsxs as Rg}from"react/jsx-runtime";var ai=({label:e,children:t,valueStyles:o})=>Rg(Ag,{children:[Gd("div",{children:e}),Gd(kg,{style:{...o},children:t})]}),Ag=zd.div`
1569
1569
  display: flex;
1570
1570
  align-items: center;
1571
1571
  justify-content: space-between;
@@ -1623,7 +1623,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1623
1623
  font-size: 14px;
1624
1624
  line-height: 22.4px;
1625
1625
  font-weight: 400;
1626
- `;import{ChevronDownIcon as Og}from"@heroicons/react/24/outline";import{useContext as Io,useState as Mg}from"react";import co from"styled-components";import{createContext as tp,useContext as jT}from"react";var ir=tp(void 0);var Mr=tp(void 0);import{Fragment as $g,jsx as st,jsxs as op}from"react/jsx-runtime";var rp=({defaultValue:e,children:t})=>{let[o,r]=Mg(e||null),n=i=>{r(o===i?null:i)};return st(ir.Provider,{value:{activePanel:o,togglePanel:n},children:st(Dg,{children:t})})},np=({value:e,children:t})=>{let{activePanel:o,togglePanel:r}=Io(ir),n=o===e;return st(Mr.Provider,{value:{onToggle:()=>r(e),value:e},children:st(Hg,{isActive:n,"data-open":n,children:t})})},ip=({children:e})=>{let{activePanel:t}=Io(ir),{onToggle:o,value:r}=Io(Mr),n=t===r;return op($g,{children:[op(Ug,{onClick:o,"data-open":n,children:[st(Bg,{children:e}),st(zg,{isactive:n,children:st(Og,{height:"16px",width:"16px",strokeWidth:"2"})})]}),st(Fg,{})]})},ap=({children:e})=>{let{activePanel:t}=Io(ir),{value:o}=Io(Mr);return st(Gg,{"data-open":t===o,children:st(lp,{children:e})})},sp=({children:e})=>{let{activePanel:t}=Io(ir),{value:o}=Io(Mr);return st(lp,{children:typeof e=="function"?e({isActive:t===o}):e})},Dg=co.div`
1626
+ `;import{ChevronDownIcon as Og}from"@heroicons/react/24/outline";import{useContext as Io,useState as Mg}from"react";import co from"styled-components";import{createContext as tp,useContext as jP}from"react";var ir=tp(void 0);var Mr=tp(void 0);import{Fragment as $g,jsx as st,jsxs as op}from"react/jsx-runtime";var rp=({defaultValue:e,children:t})=>{let[o,r]=Mg(e||null),n=i=>{r(o===i?null:i)};return st(ir.Provider,{value:{activePanel:o,togglePanel:n},children:st(Dg,{children:t})})},np=({value:e,children:t})=>{let{activePanel:o,togglePanel:r}=Io(ir),n=o===e;return st(Mr.Provider,{value:{onToggle:()=>r(e),value:e},children:st(Hg,{isActive:n,"data-open":n,children:t})})},ip=({children:e})=>{let{activePanel:t}=Io(ir),{onToggle:o,value:r}=Io(Mr),n=t===r;return op($g,{children:[op(Ug,{onClick:o,"data-open":n,children:[st(Bg,{children:e}),st(zg,{isactive:n,children:st(Og,{height:"16px",width:"16px",strokeWidth:"2"})})]}),st(Fg,{})]})},ap=({children:e})=>{let{activePanel:t}=Io(ir),{value:o}=Io(Mr);return st(Gg,{"data-open":t===o,children:st(lp,{children:e})})},sp=({children:e})=>{let{activePanel:t}=Io(ir),{value:o}=Io(Mr);return st(lp,{children:typeof e=="function"?e({isActive:t===o}):e})},Dg=co.div`
1627
1627
  display: flex;
1628
1628
  flex-direction: column;
1629
1629
  width: 100%;
@@ -1732,7 +1732,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1732
1732
  white-space: nowrap;
1733
1733
  max-width: 275px;
1734
1734
  text-overflow: ellipsis;
1735
- `;import{WalletIcon as d1}from"@heroicons/react/24/outline";import{useState as qa,useEffect as p1}from"react";import Ka from"styled-components";import{VoidSigner as i1}from"@ethersproject/abstract-signer";import{EtherscanProvider as kP}from"@ethersproject/providers";import{parseUnits as dp}from"@ethersproject/units";import{ofetch as r1}from"ofetch";var Fr={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 Br={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{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 pp=[Fr.id,Br.id],Va=e=>({maxPriorityFee:dp(e.maxPriorityFee.toString(),"gwei").toHexString(),maxFee:dp(e.maxFee.toString(),"gwei").toHexString()}),n1=e=>({safeLow:Va(e.safeLow),standard:Va(e.standard),fast:Va(e.fast)}),up=async e=>{let t="";switch(e){case Fr.id:t="https://gasstation.polygon.technology/v2";break;case Br.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return n1(await r1(t))};function ar(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 a1(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=ar(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=ar(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=ar(e.gasPrice)),e.value!==void 0&&(t.value=ar(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=ar(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=ar(e.maxPriorityFeePerGas)),t}async function di(e,t,o){t.chainId=Number(t.chainId),hp(t);let r=new i1(e,o);if(delete t.gas,pp.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await up(t.chainId);t.maxPriorityFeePerGas||(t.maxPriorityFeePerGas=i.maxPriorityFee),t.maxFeePerGas||(t.maxFeePerGas=i.maxFee)}catch{throw new Error("Unable to get current gas prices from Polygon gas station.")}let n=await r.populateTransaction(t);return a1(n)}async function pi(e,t,o,r,n){r=Object.assign({chainId:dt},r),hp(r);let a=(await o.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[r]}})).response.data,s=await(await n.sendTransaction(a)).wait();return c1(s)}async function ui(e,t,o){let r=await o.getBalance(e),n=t.value||0,i=r.sub(Ie(n)),a=!i.isNegative()&&!i.isZero();return{balance:r,hasSufficientFunds:a}}async function mp(e,t){return delete e.from,await t.estimateGas(e)}function hp(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!s1(r))throw new Error(`Transaction request property '${o}' 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 s1(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&l1(e);return t||o||r}function l1(e){return/^-?0x[a-f0-9]+$/i.test(e)}function c1(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{jsx as fp,jsxs as ja}from"react/jsx-runtime";var yp=({wallet:e,txn:t,provider:o})=>{let[r,n]=qa(),[i,a]=qa(!1),[l,s]=qa(!1),{nativeTokenSymbolForChainId:c}=_(),m=c(t.chainId)||"ETH";return p1(()=>{(async w=>{try{let{balance:f,hasSufficientFunds:b}=await ui(w,t,o);s(!0),a(b===!1),n(f.toHexString())}catch(f){console.warn(`Failed to fetch wallet balance with error: ${f}`)}})(e.address)},[e,t]),ja(u1,{children:[ja(m1,{children:[fp(d1,{strokeWidth:"2",width:"16px",height:"16px"}),fp("div",{children:$t(e?.address)})]}),ja(h1,{displayBalanceColor:l,hasFunds:!i,children:[r?Wo(r):0," ",m," available"]})]})},u1=Ka.div`
1735
+ `;import{WalletIcon as d1}from"@heroicons/react/24/outline";import{useState as qa,useEffect as p1}from"react";import Ka from"styled-components";import{VoidSigner as i1}from"@ethersproject/abstract-signer";import{EtherscanProvider as kT}from"@ethersproject/providers";import{parseUnits as dp}from"@ethersproject/units";import{ofetch as r1}from"ofetch";var Fr={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 Br={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{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 pp=[Fr.id,Br.id],Va=e=>({maxPriorityFee:dp(e.maxPriorityFee.toString(),"gwei").toHexString(),maxFee:dp(e.maxFee.toString(),"gwei").toHexString()}),n1=e=>({safeLow:Va(e.safeLow),standard:Va(e.standard),fast:Va(e.fast)}),up=async e=>{let t="";switch(e){case Fr.id:t="https://gasstation.polygon.technology/v2";break;case Br.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return n1(await r1(t))};function ar(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 a1(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=ar(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=ar(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=ar(e.gasPrice)),e.value!==void 0&&(t.value=ar(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=ar(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=ar(e.maxPriorityFeePerGas)),t}async function di(e,t,o){t.chainId=Number(t.chainId),hp(t);let r=new i1(e,o);if(delete t.gas,pp.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await up(t.chainId);t.maxPriorityFeePerGas||(t.maxPriorityFeePerGas=i.maxPriorityFee),t.maxFeePerGas||(t.maxFeePerGas=i.maxFee)}catch{throw new Error("Unable to get current gas prices from Polygon gas station.")}let n=await r.populateTransaction(t);return a1(n)}async function pi(e,t,o,r,n){r=Object.assign({chainId:dt},r),hp(r);let a=(await o.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[r]}})).response.data,s=await(await n.sendTransaction(a)).wait();return c1(s)}async function ui(e,t,o){let r=await o.getBalance(e),n=t.value||0,i=r.sub(Ie(n)),a=!i.isNegative()&&!i.isZero();return{balance:r,hasSufficientFunds:a}}async function mp(e,t){return delete e.from,await t.estimateGas(e)}function hp(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!s1(r))throw new Error(`Transaction request property '${o}' 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 s1(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&l1(e);return t||o||r}function l1(e){return/^-?0x[a-f0-9]+$/i.test(e)}function c1(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{jsx as fp,jsxs as ja}from"react/jsx-runtime";var yp=({wallet:e,txn:t,provider:o})=>{let[r,n]=qa(),[i,a]=qa(!1),[l,s]=qa(!1),{nativeTokenSymbolForChainId:c}=_(),m=c(t.chainId)||"ETH";return p1(()=>{(async w=>{try{let{balance:f,hasSufficientFunds:b}=await ui(w,t,o);s(!0),a(b===!1),n(f.toHexString())}catch(f){console.warn(`Failed to fetch wallet balance with error: ${f}`)}})(e.address)},[e,t]),ja(u1,{children:[ja(m1,{children:[fp(d1,{strokeWidth:"2",width:"16px",height:"16px"}),fp("div",{children:$t(e?.address)})]}),ja(h1,{displayBalanceColor:l,hasFunds:!i,children:[r?Wo(r):0," ",m," available"]})]})},u1=Ka.div`
1736
1736
  display: flex;
1737
1737
  flex-direction: row;
1738
1738
  justify-content: space-between;
@@ -1786,16 +1786,16 @@ You will need this password to access your ${e} wallet on a new device. Please k
1786
1786
  white-space: nowrap;
1787
1787
  max-width: 275px;
1788
1788
  text-overflow: ellipsis;
1789
- `;function bp(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{createContext as b1,useContext as E1}from"react";var Ya=b1({wallets:[]});function Ja(){return E1(Ya)}import Ep from"styled-components";import{Fragment as P1,jsx as sr,jsxs as Qa}from"react/jsx-runtime";var xp=({txn:e,receipt:t,transactionInfo:o,onClose:r,tokenPrice:n})=>Qa(P1,{children:[sr(T,{onClose:r}),Qa(x1,{children:[Qa("div",{children:[sr(vt,{title:"Transaction complete!",description:"You're all set."}),sr(ci,{tokenPrice:n,from:t.from,to:t.to,gas:t.gasUsed,txn:e,transactionInfo:o})]}),sr("div",{children:sr(T1,{loading:!1,onClick:r,children:"All Done"})})]}),sr(J,{})]}),x1=Ep.div`
1789
+ `;function bp(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{createContext as b1,useContext as E1}from"react";var Ya=b1({wallets:[]});function Ja(){return E1(Ya)}import Ep from"styled-components";import{Fragment as T1,jsx as sr,jsxs as Qa}from"react/jsx-runtime";var xp=({txn:e,receipt:t,transactionInfo:o,onClose:r,tokenPrice:n})=>Qa(T1,{children:[sr(P,{onClose:r}),Qa(x1,{children:[Qa("div",{children:[sr(vt,{title:"Transaction complete!",description:"You're all set."}),sr(ci,{tokenPrice:n,from:t.from,to:t.to,gas:t.gasUsed,txn:e,transactionInfo:o})]}),sr("div",{children:sr(P1,{loading:!1,onClick:r,children:"All Done"})})]}),sr(J,{})]}),x1=Ep.div`
1790
1790
  display: flex;
1791
1791
  height: 100%;
1792
1792
  flex-direction: column;
1793
1793
  justify-content: space-between;
1794
1794
  flex-grow: 1;
1795
- `,T1=Ep(V)`
1795
+ `,P1=Ep(V)`
1796
1796
  margin-top: 24px;
1797
1797
  transition: color 350ms ease, background-color 350ms ease;
1798
- `;import{Fragment as Za,jsx as pe,jsxs as lr}from"react/jsx-runtime";var S1=({txn:e,txnFamily:t,uiOptions:o})=>{if(t==="CONTRACT_CALL"){if(o.transactionInfo?.contractInfo)return pe($a,{contractInfo:o.transactionInfo.contractInfo,description:o.description});if(o.senderInfo)return pe($a,{contractInfo:o.senderInfo,description:o.description||o.senderInfo.actionText})}return pe(Za,{children:pe(Cp,{description:o.description||o.transactionInfo?.description||"",txn:e})})},Sp=()=>{let{authenticated:e,getAccessToken:t}=$(),{wallets:o}=Ja(),{walletProxy:r,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s}=_(),{app:c,navigate:m,data:h,outerClickRef:w,setModalData:f}=v(),{transactionRequest:b,onSuccess:S,onFailure:E,uiOptions:P,fundWalletConfig:g}=h.sendTransaction,[D,U]=No(null),[k,N]=No(""),[M,ue]=No(),[H,j]=No(!1),[B,Y]=No(!0),[I,_e]=No(!1),[q,G]=No(b),{tokenPrice:Le,estimatedGas:we}=mi(q),K=s(b.chainId)||"ETH";Pp(()=>{e||(m("LANDING"),E(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let le=Tp(()=>o.find(lt=>lt.walletClientType==="privy"),[o]),ur=async()=>{if(!le)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:lt,externalTransactionId:re}=await i(le.address,{config:g?.config||{}});f({fiatOnRampPrompt:{signedUrl:lt},fiatOnRampStatus:{externalTransactionId:re}}),m("FIAT_ON_RAMP_PROMPT_SCREEN")},Pt=Tp(()=>new _1(tt(q.chainId,l,a)),[q.chainId,a]);Pp(()=>{async function lt(){return!await t()||!r||!le?q:di(le.address,q,Pt)}lt().then(re=>{Y(!1),G(re)},async re=>{Y(!0);let ze=!1;if(oc(re))ze=!0;else if(rc(re))try{let{hasSufficientFunds:Mo}=await ui(le.address,q,Pt);ze=Mo===!1}catch(Mo){console.warn(`Cannot accurately determine if wallet has sufficient funds with error: ${Mo}`)}let fo="";ze?(fo="Wallet has insufficient funds for this transaction",c?.fiatOnRamp.enabled&&j(!0)):(fo="There was an error preparing your transaction",console.error(re)),N(fo),ue(new Ee(new ut(fo,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))})},[r]);let $r=bp(q),bi=$r==="SEND"?`Send ${K}`:"Review transaction",mr={modalTitle:P.header||P.modalTitle||bi,buttonText:P.buttonText||"Submit"},Ft=()=>{I||(D?S(D):E(M||new Ee(new ut("The user rejected the request",Ae.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return w&&(w.current=Ft),Le===void 0?lr(Za,{children:[pe(T,{title:mr.modalTitle,onClose:Ft}),pe(A,{}),pe(_p,{children:pe(Yo,{})}),pe(W,{})]}):D!==null?pe(xp,{txn:q,onClose:Ft,receipt:D,transactionInfo:P.transactionInfo,tokenPrice:Le}):lr(Za,{children:[pe(T,{title:mr.modalTitle,onClose:Ft}),lr(_p,{children:[lr(W1,{children:[pe(S1,{txn:q,txnFamily:$r,uiOptions:P}),le?pe(ci,{from:le.address,to:q.to,txn:q,transactionInfo:P.transactionInfo,gas:we?Ie(we).toHexString():void 0,tokenPrice:Le}):null]}),lr(I1,{children:[pe(A1,{children:k}),le?pe(yp,{txn:q,wallet:le,provider:Pt}):null,lr(k1,{children:[H&&pe(V,{onClick:ur,children:"Add Funds"}),pe(R1,{disabled:B||I,loading:!r||I,loadingText:I?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{_e(!0);let lt=await t();if(lt&&!I&&le)try{let re=await pi(lt,le.address,r,q,Pt);U(re),N("")}catch(re){let ze="";re.reason==="processing response error"?(console.warn({transaction:q,error:re}),ze="An error has occurred, please contact support."):ze=re.reason||"An error has occurred, please try again.",N(ze),ue(new Ee(new ut(ze,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{_e(!1)}},children:mr.buttonText})]})]})]}),pe(J,{})]})},_p=cr.div`
1798
+ `;import{Fragment as Za,jsx as pe,jsxs as lr}from"react/jsx-runtime";var S1=({txn:e,txnFamily:t,uiOptions:o})=>{if(t==="CONTRACT_CALL"){if(o.transactionInfo?.contractInfo)return pe($a,{contractInfo:o.transactionInfo.contractInfo,description:o.description});if(o.senderInfo)return pe($a,{contractInfo:o.senderInfo,description:o.description||o.senderInfo.actionText})}return pe(Za,{children:pe(Cp,{description:o.description||o.transactionInfo?.description||"",txn:e})})},Sp=()=>{let{authenticated:e,getAccessToken:t}=$(),{wallets:o}=Ja(),{walletProxy:r,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s}=_(),{app:c,navigate:m,data:h,outerClickRef:w,setModalData:f}=v(),{transactionRequest:b,onSuccess:S,onFailure:E,uiOptions:T,fundWalletConfig:g}=h.sendTransaction,[D,U]=No(null),[k,N]=No(""),[M,ue]=No(),[H,j]=No(!1),[B,Y]=No(!0),[I,_e]=No(!1),[q,G]=No(b),{tokenPrice:Le,estimatedGas:we}=mi(q),K=s(b.chainId)||"ETH";Tp(()=>{e||(m("LANDING"),E(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let le=Pp(()=>o.find(lt=>lt.walletClientType==="privy"),[o]),ur=async()=>{if(!le)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:lt,externalTransactionId:re}=await i(le.address,{config:g?.config||{}});f({fiatOnRampPrompt:{signedUrl:lt},fiatOnRampStatus:{externalTransactionId:re}}),m("FIAT_ON_RAMP_PROMPT_SCREEN")},Tt=Pp(()=>new _1(tt(q.chainId,l,a)),[q.chainId,a]);Tp(()=>{async function lt(){return!await t()||!r||!le?q:di(le.address,q,Tt)}lt().then(re=>{Y(!1),G(re)},async re=>{Y(!0);let ze=!1;if(oc(re))ze=!0;else if(rc(re))try{let{hasSufficientFunds:Mo}=await ui(le.address,q,Tt);ze=Mo===!1}catch(Mo){console.warn(`Cannot accurately determine if wallet has sufficient funds with error: ${Mo}`)}let fo="";ze?(fo="Wallet has insufficient funds for this transaction",c?.fiatOnRamp.enabled&&j(!0)):(fo="There was an error preparing your transaction",console.error(re)),N(fo),ue(new Ee(new ut(fo,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))})},[r]);let $r=bp(q),bi=$r==="SEND"?`Send ${K}`:"Review transaction",mr={modalTitle:T.header||T.modalTitle||bi,buttonText:T.buttonText||"Submit"},Ft=()=>{I||(D?S(D):E(M||new Ee(new ut("The user rejected the request",Ae.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return w&&(w.current=Ft),Le===void 0?lr(Za,{children:[pe(P,{title:mr.modalTitle,onClose:Ft}),pe(A,{}),pe(_p,{children:pe(Yo,{})}),pe(W,{})]}):D!==null?pe(xp,{txn:q,onClose:Ft,receipt:D,transactionInfo:T.transactionInfo,tokenPrice:Le}):lr(Za,{children:[pe(P,{title:mr.modalTitle,onClose:Ft}),lr(_p,{children:[lr(W1,{children:[pe(S1,{txn:q,txnFamily:$r,uiOptions:T}),le?pe(ci,{from:le.address,to:q.to,txn:q,transactionInfo:T.transactionInfo,gas:we?Ie(we).toHexString():void 0,tokenPrice:Le}):null]}),lr(I1,{children:[pe(A1,{children:k}),le?pe(yp,{txn:q,wallet:le,provider:Tt}):null,lr(k1,{children:[H&&pe(V,{onClick:ur,children:"Add Funds"}),pe(R1,{disabled:B||I,loading:!r||I,loadingText:I?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{_e(!0);let lt=await t();if(lt&&!I&&le)try{let re=await pi(lt,le.address,r,q,Tt);U(re),N("")}catch(re){let ze="";re.reason==="processing response error"?(console.warn({transaction:q,error:re}),ze="An error has occurred, please contact support."):ze=re.reason||"An error has occurred, please try again.",N(ze),ue(new Ee(new ut(ze,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{_e(!1)}},children:mr.buttonText})]})]})]}),pe(J,{})]})},_p=cr.div`
1799
1799
  display: flex;
1800
1800
  height: 100%;
1801
1801
  flex-direction: column;
@@ -1825,7 +1825,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1825
1825
  display: flex;
1826
1826
  flex-direction: column;
1827
1827
  gap: 8px;
1828
- `;import{isHexString as N1}from"@ethersproject/bytes";import{toUtf8String as L1}from"@ethersproject/strings";import{useEffect as O1,useState as Xa}from"react";import Gr,{css as M1}from"styled-components";import{jsx as Ap}from"react/jsx-runtime";var kp=({style:e,color:t,...o})=>Ap("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},...o,children:Ap("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{Fragment as z1,jsx as xt,jsxs as fi}from"react/jsx-runtime";var D1=e=>{if(!N1(e))return e;try{return L1(e)}catch{return e}},Rp=()=>{let{authenticated:e}=$(),{walletProxy:t,closePrivyModal:o}=_(),{navigate:r,data:n,outerClickRef:i}=v(),[a,l]=Xa(""),[s,c]=Xa(),[m,h]=Xa(null),w=m!==null;O1(()=>{e||r("LANDING")},[e]);let{message:f,confirmAndSignMessage:b,onSuccess:S,onFailure:E,uiOptions:P}=n.signMessage,g=!t,D={title:P.title||"Sign message",description:P.description||"Signing this message will not cost you any fees.",buttonText:P.buttonText||"Sign and continue"},U=k=>{k?S(k):E(s||new Ee(new ut("The user rejected the request.",Ae.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),h(null),l(""),c(void 0)};return i&&(i.current=()=>U(m)),fi(z1,{children:[xt(T,{onClose:()=>U(m)}),xt(A,{}),fi(U1,{children:[fi("div",{children:[xt(vt,{title:D.title,description:D.description}),xt(F1,{children:D1(f)}),xt(B1,{fail:!0,children:a})]}),xt(G1,{success:w,loading:g,disabled:w,onClick:async()=>{try{let k=await b();h(k),l(""),setTimeout(()=>{U(k)},Ue)}catch{l("An error has occurred, please try again."),c(new Ee(new ut(a,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:w?fi(H1,{children:[xt(kp,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",xt("span",{children:"Success"})]}):D.buttonText})]}),xt(W,{}),xt(O,{protectedByPrivy:!0})]})},U1=Gr.div`
1828
+ `;import{isHexString as N1}from"@ethersproject/bytes";import{toUtf8String as L1}from"@ethersproject/strings";import{useEffect as O1,useState as Xa}from"react";import Gr,{css as M1}from"styled-components";import{jsx as Ap}from"react/jsx-runtime";var kp=({style:e,color:t,...o})=>Ap("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},...o,children:Ap("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{Fragment as z1,jsx as xt,jsxs as fi}from"react/jsx-runtime";var D1=e=>{if(!N1(e))return e;try{return L1(e)}catch{return e}},Rp=()=>{let{authenticated:e}=$(),{walletProxy:t,closePrivyModal:o}=_(),{navigate:r,data:n,outerClickRef:i}=v(),[a,l]=Xa(""),[s,c]=Xa(),[m,h]=Xa(null),w=m!==null;O1(()=>{e||r("LANDING")},[e]);let{message:f,confirmAndSignMessage:b,onSuccess:S,onFailure:E,uiOptions:T}=n.signMessage,g=!t,D={title:T.title||"Sign message",description:T.description||"Signing this message will not cost you any fees.",buttonText:T.buttonText||"Sign and continue"},U=k=>{k?S(k):E(s||new Ee(new ut("The user rejected the request.",Ae.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),h(null),l(""),c(void 0)};return i&&(i.current=()=>U(m)),fi(z1,{children:[xt(P,{onClose:()=>U(m)}),xt(A,{}),fi(U1,{children:[fi("div",{children:[xt(vt,{title:D.title,description:D.description}),xt(F1,{children:D1(f)}),xt(B1,{fail:!0,children:a})]}),xt(G1,{success:w,loading:g,disabled:w,onClick:async()=>{try{let k=await b();h(k),l(""),setTimeout(()=>{U(k)},Ue)}catch{l("An error has occurred, please try again."),c(new Ee(new ut(a,Ae.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:w?fi(H1,{children:[xt(kp,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",xt("span",{children:"Success"})]}):D.buttonText})]}),xt(W,{}),xt(O,{protectedByPrivy:!0})]})},U1=Gr.div`
1829
1829
  display: flex;
1830
1830
  height: 100%;
1831
1831
  flex-direction: column;
@@ -2192,7 +2192,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2192
2192
  opacity: 1;
2193
2193
  }
2194
2194
  }
2195
- `;import{jsx as Xe,jsxs as iv}from"react/jsx-runtime";var Z1={["LANDING"]:Ed,["AWAITING_PASSWORDLESS_CODE"]:Fl,["WALLET_EDUCATION"]:ld,["AWAITING_CONNECTION"]:Yl,["AWAITING_CONNECT_ONLY_CONNECTION"]:Xl,["PHANTOM_INTERSTITIAL_SCREEN"]:Hd,["LOGIN_FAILED_SCREEN"]:Id,["AWAITING_OAUTH_SCREEN"]:Dd,["ALLOWLIST_REJECTION_SCREEN"]:Nl,["INSTALL_METAMASK_SCREEN"]:ud,["INSTALL_PHANTOM_SCREEN"]:hd,["INSTALL_COINBASE_WALLET_SCREEN"]:dd,["LINK_EMAIL_SCREEN"]:Pd,["LINK_PHONE_SCREEN"]:_d,["LINK_WALLET_SCREEN"]:Ad,["CONNECT_ONLY_LANDING_SCREEN"]:jl,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:$l,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Fc,["EMBEDDED_WALLET_CREATED_SCREEN"]:lc,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:ac,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Gc,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:mc,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Rp,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Sp,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Kc,["FIAT_ON_RAMP_STATUS_SCREEN"]:Jc,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Hc,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Bc},X1={["AWAITING_CONNECTION"]:"compact",["AWAITING_CONNECT_ONLY_CONNECTION"]:"compact",["CONNECT_ONLY_LANDING_SCREEN"]:"compact",["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:"compact",["AWAITING_OAUTH_SCREEN"]:"compact",["ALLOWLIST_REJECTION_SCREEN"]:"compact",["WALLET_EDUCATION"]:"full",["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:"full",["EMBEDDED_WALLET_RECOVERY_SCREEN"]:"compact"},ev=(e,t,o)=>{if(e==="LANDING"&&t)return"compact";let r=X1[e];return r||(o?"medium":"full")},tv=()=>{let{ready:e}=$(),{isLinking:t}=_(),{ready:o,currentScreen:r,app:n}=v(),i=!!n?.loginMethods.wallet,a=!!(n?.loginMethods.email||n?.loginMethods.sms),s=ev(r,i!==a,t);if((!e||!o)&&r!=="AWAITING_OAUTH_SCREEN")return iv(Lp,{"data-height":s,children:[Xe(T,{}),Xe(A,{}),Xe(nv,{children:Xe(wo,{})}),Xe(W,{}),Xe(J,{})]});let c=Z1[r];return c?Xe(Lp,{"data-height":s,children:Xe(c,{})}):null},Mp=()=>{let{closePrivyModal:e}=_(),{app:t,outerClickRef:o}=v(),r=()=>{if(o?.current){let{closeModal:l}=o.current()||{closeModal:!0};l&&(e(),o.current=null)}else return e()},n=J1(l=>{l.key==="Escape"&&t?.render.inDialog&&r()},[t?.render.inDialog]);Op(()=>(document.addEventListener("keydown",n,!1),()=>{document.removeEventListener("keydown",n,!1)}),[n]);let i=Xe(Np,{onClick:l=>l.stopPropagation(),children:Xe(tv,{})}),a=t?.render.inDialog?Xe(rv,{id:"privy-dialog",onClick:()=>r(),children:i}):i;return Q1.createPortal(a,t?.render.inParentNodeId&&document.getElementById(t.render.inParentNodeId)||document.body)},ov=({children:e,...t})=>{let o=Y1(null);return Op(()=>{document?.activeElement?.blur();let r=document?.getElementById("root")||document?.getElementById("__next");if(r)return r.setAttribute("inert","true"),j1(o?.current),()=>{let n=document?.getElementById("root")||document?.getElementById("__next");n&&(n.removeAttribute("inert"),K1())}},[t.open,t.onClose]),Xe("dialog",{open:!0,role:"dialog",...t,ref:o,children:e})},rv=es(ov)`
2195
+ `;import{jsx as Xe,jsxs as iv}from"react/jsx-runtime";var Z1={["LANDING"]:Ed,["AWAITING_PASSWORDLESS_CODE"]:Fl,["WALLET_EDUCATION"]:ld,["AWAITING_CONNECTION"]:Yl,["AWAITING_CONNECT_ONLY_CONNECTION"]:Xl,["PHANTOM_INTERSTITIAL_SCREEN"]:Hd,["LOGIN_FAILED_SCREEN"]:Id,["AWAITING_OAUTH_SCREEN"]:Dd,["ALLOWLIST_REJECTION_SCREEN"]:Nl,["INSTALL_METAMASK_SCREEN"]:ud,["INSTALL_PHANTOM_SCREEN"]:hd,["INSTALL_COINBASE_WALLET_SCREEN"]:dd,["LINK_EMAIL_SCREEN"]:Td,["LINK_PHONE_SCREEN"]:_d,["LINK_WALLET_SCREEN"]:Ad,["CONNECT_ONLY_LANDING_SCREEN"]:jl,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:$l,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Fc,["EMBEDDED_WALLET_CREATED_SCREEN"]:lc,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:ac,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Gc,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:mc,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Rp,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Sp,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Kc,["FIAT_ON_RAMP_STATUS_SCREEN"]:Jc,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Hc,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Bc},X1={["AWAITING_CONNECTION"]:"compact",["AWAITING_CONNECT_ONLY_CONNECTION"]:"compact",["CONNECT_ONLY_LANDING_SCREEN"]:"compact",["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:"compact",["AWAITING_OAUTH_SCREEN"]:"compact",["ALLOWLIST_REJECTION_SCREEN"]:"compact",["WALLET_EDUCATION"]:"full",["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:"full",["EMBEDDED_WALLET_RECOVERY_SCREEN"]:"compact"},ev=(e,t,o)=>{if(e==="LANDING"&&t)return"compact";let r=X1[e];return r||(o?"medium":"full")},tv=()=>{let{ready:e}=$(),{isLinking:t}=_(),{ready:o,currentScreen:r,app:n}=v(),i=!!n?.loginMethods.wallet,a=!!(n?.loginMethods.email||n?.loginMethods.sms),s=ev(r,i!==a,t);if((!e||!o)&&r!=="AWAITING_OAUTH_SCREEN")return iv(Lp,{"data-height":s,children:[Xe(P,{}),Xe(A,{}),Xe(nv,{children:Xe(wo,{})}),Xe(W,{}),Xe(J,{})]});let c=Z1[r];return c?Xe(Lp,{"data-height":s,children:Xe(c,{})}):null},Mp=()=>{let{closePrivyModal:e}=_(),{app:t,outerClickRef:o}=v(),r=()=>{if(o?.current){let{closeModal:l}=o.current()||{closeModal:!0};l&&(e(),o.current=null)}else return e()},n=J1(l=>{l.key==="Escape"&&t?.render.inDialog&&r()},[t?.render.inDialog]);Op(()=>(document.addEventListener("keydown",n,!1),()=>{document.removeEventListener("keydown",n,!1)}),[n]);let i=Xe(Np,{onClick:l=>l.stopPropagation(),children:Xe(tv,{})}),a=t?.render.inDialog?Xe(rv,{id:"privy-dialog",onClick:()=>r(),children:i}):i;return Q1.createPortal(a,t?.render.inParentNodeId&&document.getElementById(t.render.inParentNodeId)||document.body)},ov=({children:e,...t})=>{let o=Y1(null);return Op(()=>{document?.activeElement?.blur();let r=document?.getElementById("root")||document?.getElementById("__next");if(r)return r.setAttribute("inert","true"),j1(o?.current),()=>{let n=document?.getElementById("root")||document?.getElementById("__next");n&&(n.removeAttribute("inert"),K1())}},[t.open,t.onClose]),Xe("dialog",{open:!0,role:"dialog",...t,ref:o,children:e})},rv=es(ov)`
2196
2196
  position: fixed;
2197
2197
  top: 0;
2198
2198
  left: 0;
@@ -2250,4 +2250,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
2250
2250
  align-items: center;
2251
2251
  justify-content: center;
2252
2252
  height: 100%;
2253
- `;import{useEffect as av}from"react";import{Fragment as lv,jsx as cv}from"react/jsx-runtime";var sv=({onLoad:e})=>{let t=window;return av(()=>{if(document.getElementById("cf-script")!==null||t.turnstile)return;t.onloadTurnstileCallback=e;let o=document.createElement("script");o.setAttribute("src","https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback&render=explicit"),o.setAttribute("id","cf-script"),o.setAttribute("async","true"),document.body.appendChild(o)},[]),cv(lv,{})},Dp=sv;var Up={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 Fp={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 Bp={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 Hp={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 Gp={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 zp={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 $p={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 Vp={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 qp={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 jp={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 Kp={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{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 Yp={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 Jp={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 yi={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 Qp={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 Zp={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 Xp={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{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 gi=[Up,Fp,Kp,Xp,yi,Qp,Zp,Fr,Br,$p,Vp,qp,jp,Gp,zp,Yp,Jp,Bp,Hp],KS=new Set(gi.map(e=>e.id));import Lo from"tinycolor2";var eu="#FFFFFF",dv="#000000",pv=eu,uv="#1E1E1D";function mv(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 po(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return Lo({...e.toHsl(),l:o})}function tu({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=eu,blackHex:a=dv}){let l;switch(e){case"light":l=pv;break;case"dark":l=uv;break;default:l=e;break}let s=Lo(l),c=Lo(t),m=Lo(o),h=Lo(r),w=Lo(n),f=mv(s.getLuminance()),b=po(s,f==="light"?-.04:.11),S=po(s,f==="light"?-.88:.87),E=po(s,f==="light"?-.77:.75),P=po(s,f==="light"?-.43:.45).desaturate(f==="light"?60:20),g=po(s,f==="light"?-.08:.25).desaturate(f==="light"?60:20),D=po(c,.15),U=po(c,-.06),k=Lo(c.getLuminance()>.5?a:i),N=po(m,-.16);return{colorScheme:f,background:s.toHslString(),background2:b.toHslString(),foreground:S.toHslString(),foreground2:E.toHslString(),foreground3:P.toHslString(),foreground4:g.toHslString(),accent:c.toHslString(),accentLight:D.toHslString(),accentDark:U.toHslString(),foregroundAccent:k.toHslString(),success:m.toHslString(),successDark:N.toHslString(),error:w.toHslString(),warn:h.toHslString()}}var uo={appearance:{theme:"light",accentColor:"#676FFF"},walletConnectCloudProjectId:Os,rpcConfig:{rpcUrls:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};function vi(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple"],r=t?.loginMethods?.filter(D=>o.includes(D)),n=r?.slice(0,5),i,a,l,s,c,m,h,w,f,b;if(t?.loginMethods?(i=t.loginMethods.includes("email"),a=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=n?.includes("google"),c=n?.includes("twitter"),m=n?.includes("discord"),h=n?.includes("tiktok"),f=n?.includes("github"),w=n?.includes("linkedin"),b=n?.includes("apple")):(i=e.emailAuth,a=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,m=e.discordOAuth,f=e.githubOAuth,h=e.tiktokOAuth,w=e.linkedinOAuth,b=e.appleOAuth),i&&a&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),a=!1),!i&&!a&&[s,c,m,f,h,w,b].some(D=>D))throw new Error("To enable social logins you must also enable either SMS or Email login");if(![i,a,l,s,c,m,f,h,w,b].some(D=>D))throw new Error("You must enable at least one login method");let{chains:S,defaultChain:E}=hv(t?.additionalChains,t?.supportedChains,t?.defaultChain);r&&r.length>5&&console.warn("Max number of social logins allowed is 5. Any more have been removed.");let P=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1;return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:tu({backgroundTheme:t?.appearance?.theme??uo.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??uo.appearance.accentColor}),showWalletLoginFirst:t?.appearance?.showWalletLoginFirst??e.showWalletLoginFirst},loginMethods:{wallet:l,email:i,sms:a,google:s,twitter:c,discord:m,github:f,tiktok:h,linkedin:w,apple:b},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??uo.walletConnectCloudProjectId,rpcConfig:t?.rpcConfig??uo.rpcConfig,chains:S,defaultChain:E,captchaEnabled:e.captchaEnabled??uo.captchaEnabled,embeddedWallets:{...e.embeddedWalletConfig,...P?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1,noPromptOnSignature:!0}:{},...t?.embeddedWallets},customAuth:P?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??uo.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??uo._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??uo._render.inParentNodeId}}}function ou(e,t){return e?.appearance?.logo&&typeof e.appearance.logo=="object"&&(e.appearance.logo="component"),{...e,legacyCreateEmbeddedWalletFlag:t}}function hv(e,t,o){let r;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");r=t}else r=gi.concat(e??[]);let n=t?r[0]:yi,i=o??n;if(!r.find(a=>a.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:r,defaultChain:i}}import{useRef as fv,useEffect as yv}from"react";var wi=class{constructor(){this.callbacks={}}enqueue(t,o){this.callbacks[t]=o}dequeue(t,o){let r=this.callbacks[o];if(!r)throw new Error(`cannot dequeue ${t} event: no event found for id ${o}`);switch(delete this.callbacks[o],t){case"privy:iframe:ready":return r;case"privy:wallet:create":return r;case"privy:wallet:connect":return r;case"privy:wallet:recover":return r;case"privy:wallet:rpc":return r;case"privy:wallet:set-recovery-password":return r;default:throw new Error(`invalid wallet event type ${t}`)}}};import{jsx as Ev}from"react/jsx-runtime";var gv=function(e){return()=>`id-${e++}`}(0);function vv(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function dr(e){return e.error!==void 0}var Oo=new wi,ts=new Map,wv=(e,t)=>typeof t=="bigint"?t.toString():t,Cv=(e,t)=>`${e}${JSON.stringify(t,wv)}`;function pr(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=Cv(e,t);if(e==="privy:wallet:create"){let a=ts.get(n);if(a)return a}let i=new Promise((a,l)=>{let s=gv();Oo.enqueue(s,{resolve:a,reject:l}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{ts.delete(n)});return ts.set(n,i),i}function bv(e){switch(e.event){case"privy:iframe:ready":let t=Oo.dequeue(e.event,e.id);return dr(e)?t.reject(new Wt(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Oo.dequeue(e.event,e.id);return dr(e)?o.reject(new Wt(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Oo.dequeue(e.event,e.id);return dr(e)?r.reject(new Wt(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Oo.dequeue(e.event,e.id);return dr(e)?n.reject(new Wt(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Oo.dequeue(e.event,e.id);return dr(e)?i.reject(new Wt(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Oo.dequeue(e.event,e.id);return dr(e)?a.reject(new Wt(e.error.type,e.error.message)):a.resolve(e.data);default:console.warn("Unsupported wallet proxy method:",e)}}function ru(e){let t=fv(null);return yv(()=>{let o=t.current;if(!o)return;function r(s){s&&s.origin===e.origin&&vv(s.data)&&bv(s.data)}let n={create(s){return pr("privy:wallet:create",s,o)},connect(s){return pr("privy:wallet:connect",s,o)},recover(s){return pr("privy:wallet:recover",s,o)},rpc(s){return pr("privy:wallet:rpc",s,o)},setRecoveryPassword(s){return pr("privy:wallet:set-recovery-password",s,o)}};window.addEventListener("message",r);let i=()=>e.onLoad(n),a=(...s)=>{console.warn("Privy iframe failed to load: ",...s),e.onLoadFailed()},l=new AbortController;return js(()=>pr("privy:iframe:ready",{},o),{abortSignal:l.signal}).then(i,a),()=>{window.removeEventListener("message",r),l.abort()}},[t.current]),Ev("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:an(e.origin,`/apps/${e.appId}/embedded-wallets`)})}import{createContext as xv,useContext as Tv,useEffect as Pv}from"react";var nu={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]}},os=xv(void 0),_v=()=>Tv(os);function mo(e,t){if(!t)return;let r=_v().current[e];return Pv(()=>{for(let[n,i]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]=r[n]?.filter(a=>a!==i)}},[t])}function se(e,t,o,...r){for(let n of e.current[t][o])n(...r)}import{jsx as ho,jsxs as au}from"react/jsx-runtime";function kv(e){return typeof e=="string"&&e.length===25}var zr;function At(){if(!zr){let e=z.get(Ho);return Promise.resolve(e||null)}return zr.getAccessToken()}var su,Xs=(e,t)=>su(e,t),lu,el=(e,t)=>lu(e,t),cu,tl=()=>cu(),Rv=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;z.put(yr,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},Wv=({config:e,...t})=>{if(!kv(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");zr||(zr=new Tr({appId:t.appId,apiUrl:t.apiUrl||Xr}));let o=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&o.embeddedWallets?.createOnLogin===void 0&&(o.embeddedWallets||(o.embeddedWallets={}),o.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."),ho(Iv,{...t,config:o,client:zr})},Iv=e=>{let t=e.client,[o,r]=Q(!1),[n,i]=Q(!1),[a,l]=Q(!1),[s,c]=Q(null),[m,h]=Q(!1),[w,f]=Q([]),b=iu(w),[S,E]=Q(!1),[P,g]=Q(null),[D,U]=Q(!1),[k,N]=Q({status:"disconnected",connectError:null,connector:null,connectRetry:x}),[M,ue]=Q(null),[H,j]=Q(null),[B,Y]=Q({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}),[I,_e]=Q(()=>{let d=ou(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",d),vi(B,e.config)}),[q,G]=Q(!0),[Le,we]=Q({}),[K,le]=Q(null),[ur,Pt]=Q(null),[$r,bi]=Q(!1),[mr,Ft]=Q(),[lt,re]=Q(),[ze,fo]=Q(),[Mo,ns]=Q(!1),ne=iu(nu),Se=d=>{d&&g(d),r(!0),t.createAnalyticsEvent("modal_open",{initialScreen:d})},Vr=d=>{I.embeddedWallets.createOnLogin!=="off"&&G(!0),Se(d)};Tt(()=>{if(!H||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClient==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(H,p,I.defaultChain)}},[H,s]),Tt(()=>{H&&ur?.(H)},[H]),Tt(()=>{(async()=>{if(!I.customAuth?.enabled)return;G(!0);let{getCustomAccessToken:p,isLoading:u}=I.customAuth;if(!(!n||u))try{let y=await p();if(!y){await Do.logout();return}if(a)return;t.startAuthFlow(new Fo(y));let{user:L,isNewUser:me}=await t.authenticate();L||await Do.logout(),c(L||null),E(me||!1),l(!0),ns(!0)}catch(y){console.warn(y),a&&await Do.logout()}})()},[I.customAuth?.enabled,I.customAuth?.getCustomAccessToken,I.customAuth?.isLoading,n,a]),Tt(()=>{Mo&&H&&s&&zt(s,e.config?.embeddedWallets?.createOnLogin)&&(ns(!1),ls(s,3e4).catch(console.error))},[Mo&&H&&s]),Tt(()=>{async function d(){let p=await t.getServerConfig();Y(p);let u=vi(p,e.config);_e(u),p.customApiUrl&&t.updateApiUrl(p.customApiUrl),t.initializeConnectorManager(u.walletConnectCloudProjectId,u.rpcConfig,u.chains,u.defaultChain),t.connectors?.initialize();let y=du();Rv();let L=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!L),L&&se(ne,"login","onComplete",L,!1,!0),c(L)),y||(i(!0),K?.()),y&&L&&h(!0),pu()}n||d()},[t,K,n]),Tt(()=>{let d=vi(B,e.config);_e(d)},[e.config]);let du=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),u=d.get("privy_oauth_state"),y=d.get("privy_oauth_provider");return p&&u&&y?(t.startAuthFlow(new Gt(y,p,u)),Vr("AWAITING_OAUTH_SCREEN"),we({finishOauthFlow:{onComplete:()=>{i(!0),K?.()}}}),!0):!1},Ei=async(d,p,u)=>{let y=await t.connectors?.createWalletConnector(d,p)||null;is(y,u)};async function is(d,p){if(!d)return N({status:"disconnected",connectError:new F("Unable to connect to wallet."),connector:null,connectRetry:x}),p?.(null);N({connector:d,status:"connecting",connectError:null,connectRetry:()=>is(d,p)});try{let u=await d.connect({showPrompt:!0});if(!I.chains.find(y=>y.id===Number(u?.chainId))){N(y=>({...y,connector:d,status:"switching_to_supported_chain",connectError:null,connectRetry:x}));try{await u?.switchChain(I.defaultChain.id)}catch{console.warn(`Unable to switch to default chain: ${I.defaultChain.id}`)}}return N(y=>({...y,status:"connected",connectError:null,connectRetry:x})),u&&!D&&se(ne,"connectWallet","onSuccess",u),p?.(u)}catch(u){return u instanceof et?(console.warn(u.cause?u.cause:u.message),D||se(ne,"connectWallet","onError",u.privyErrorCode||"generic_connect_wallet_error")):(console.warn(u),D||se(ne,"connectWallet","onError","unknown_connect_wallet_error")),N(y=>({...y,status:"disconnected",connectError:u})),p?.(null)}}let xi=d=>{d!==null&&t.startAuthFlow(new go(d))},pu=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),u=d.get("privy_wallet_client");if(!p||!u)return;if(u==="phantom"&&!je()&&Vr("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");Se("AWAITING_CONNECTION");let y=new URL(window.location.href);y.searchParams.delete("privy_connector"),y.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",y),Ei(p,u,xi)};Tt(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let as=()=>{h(!0),Se("LINK_WALLET_SCREEN")},uu=d=>{if(!a||!s)return!1;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address)return!0;return!1},mu=async d=>{if(!t.connectors)throw new C("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;N(u=>({...u,connector:p,status:"connected",connectError:null,connectRetry:x})),xi(d),Vr("AWAITING_CONNECTION")},hu=async(d,p)=>{if(!t.connectors)throw new C("Connector not initialized");await Ei(d,p,xi)},ss=async(d,p)=>{if(!I.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:u,externalTransactionId:y}=await qc(t,d,p?.config??{},I.appearance.palette,I.fiatOnRamp.useSandbox);return{signedUrl:u,externalTransactionId:y}}else throw new C("Unsupported fund provider. Currently supported option is `moonpay`.")},qr=()=>{f(d=>{let p=t.connectors?.wallets.map(u=>({...u,linked:uu(u),loginOrLink:async()=>{if(!await u.isConnected())throw new C("Wallet is not connected");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");mu(u)},fund:async y=>{let{signedUrl:L,externalTransactionId:me}=await ss(u.address,y);we({fiatOnRampPrompt:{signedUrl:L},fiatOnRampStatus:{externalTransactionId:me}}),Se("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new C("User is not authenticated.");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let y=await t.unlinkWallet(u.address);c(y)}}))||[];return cn(d,p)?d:p})};Tt(()=>{qr()},[s?.linkedAccounts,a,n]),Tt(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");qr(),t.connectors.on("walletsUpdated",qr)}},[n]);let fu=()=>{Se(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Tt(()=>{if(!w[0])return;let d=w[0],p=b.current.find(y=>y.address===d.address),u=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address);if(!p&&u){let y=Object.assign({},s);y.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},c(y)}b.current=w},[w]);let ls=async(d,p)=>{if(Z(d))throw se(ne,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[y,L]=await Promise.all([Oe.initializeWalletProxy(p),At()]);if(!y&&e.config?.customAuth?.enabled)throw se(ne,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!y||!L||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((me,be)=>{G(!0),we({createWallet:{onSuccess:$e=>{se(ne,"createWallet","onSuccess",$e),me($e)},onFailure:$e=>{se(ne,"createWallet","onError","unknown_embedded_wallet_error"),be($e)},callAuthOnSuccessOnClose:!1}}),Se("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await y.create({accessToken:L});let me=await Oe.refreshUser(),be=Z(me);if(!be)throw se(ne,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return se(ne,"createWallet","onSuccess",be),be}},yu=d=>{if(!I.chains.map(p=>p.id).includes(d))throw new F(`${d} is not supported`,"unsupported_chain_id")},Do={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:fu,linkWallet:as,linkEmail:()=>{if(s?.email)throw new C("User already has an email linked to their account.");h(!0),Se("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(s?.phone)throw new C("User already has a phone number linked to their account.");h(!0),Se("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(s?.google)throw new C("User already has a Google account linked to their account.");await Oe.initLoginWithOAuth("google")},linkTwitter:async()=>{if(s?.twitter)throw new C("User already has a Twitter account linked to their account.");await Oe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(s?.discord)throw new C("User already has a Discord account linked to their account.");await Oe.initLoginWithOAuth("discord")},linkGithub:async()=>{if(s?.github)throw new C("User already has a Github account linked to their account.");await Oe.initLoginWithOAuth("github")},linkTiktok:async()=>{if(s?.tiktok)throw new C("User already has a Tiktok account linked to their account.");await Oe.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(s?.linkedin)throw new C("User already has a LinkedIn account linked to their account.");await Oe.initLoginWithOAuth("linkedin")},linkApple:async()=>{await Oe.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(d=>{le(()=>d)}),le(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}U(!0),Vr()},logout:async()=>{await t.logout(),c(null),l(!1),g(null),se(ne,"logout","onSuccess"),h(!1),r(!1),z.del(gr)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new X;let d=w.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(y=>y.address===d?.address));return!d||!p?new X:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new rs(new ht(new X));let d=w.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(y=>y.address===d?.address));return!d||!p?new rs(new ht(new X)):new rs(new ht(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new qt(new X);let d=w.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(y=>y.address===d?.address));return!d||!p?new qt(new X):new qt(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},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},setActiveWallet:async d=>{let p=w.find(y=>Ci(y.address)===Ci(d)),u=s?.linkedAccounts.find(y=>y.type==="wallet"&&Ci(y.address)===Ci(d));if(!p||!await p.isConnected())ue(d),as();else if(!p.linked)p.loginOrLink();else{let y=Object.assign({},s);y.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},c(y)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw se(ne,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return ls(s,15e3)},setWalletPassword:()=>new Promise((d,p)=>{if(!a||!s){p(new Error("User must be authenticated before adding password to Privy wallet"));return}let u=Z(s);if(!u||!H){p(new Error("Must have a Privy wallet to add a password"));return}if(u.recoveryMethod==="user-passcode"){p(new Error("Cannot set password. Embedded wallet already has a password."));return}G(!0);let y={onSuccess:d,onFailure:p,callAuthOnSuccessOnClose:!1},L={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:p};we({setWalletPassword:y,connectWallet:L}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}),signMessage:(d,p)=>new Promise(async(u,y)=>{if(!a||!s){y(new Error("User must be authenticated before signing with a Privy wallet"));return}let L=Z(s);if(!L){y(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){y(new Error("Message must be a non-empty string"));return}G(!0);let me=async()=>{if(!a)return y(new Error("User must be authenticated before signing with a Privy wallet")),null;let be=await At();if(H&&be)try{if(!await Oe.recoverEmbeddedWallet())return y(new Error("Unable to connect to wallet")),null;t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:L.address});let{response:$e}=await H.rpc({accessToken:be,address:L.address,request:{method:"personal_sign",params:[d,L.address]}}),hr=$e.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:L.address}),hr}catch(Bt){return y(Bt),null}else return null};if(I.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");let be=await me();be?u(be):y(new Ee("Unable to sign message"))}else{let $e={message:d,confirmAndSignMessage:me,onSuccess:Ht=>{u(Ht)},onFailure:Ht=>{y(Ht)},uiOptions:p||{}},hr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:y};we({signMessage:$e,connectWallet:hr}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:(d,p,u)=>new Promise(async(y,L)=>{if(!a||!s){L(new Error("User must be authenticated before signing with a Privy wallet"));return}let me=Z(s);if(!me){L(new Error("Must have a Privy wallet before signing"));return}G(!0);let be=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Bt=d.chainId||be.chainId;yu(Bt);let $e=Object.assign({},d,{chainId:Bt}),hr=async()=>{let Ht=await At();if(!Ht||!H){L(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Oe.recoverEmbeddedWallet()){L(new Error("Unable to connect to wallet"));return}let cs=new Sv(tt($e.chainId,I.chains,I.rpcConfig)),vu=await di(me.address,$e,cs),wu=await pi(Ht,me.address,H,vu,cs);y(wu)}catch(jr){L(jr)}};if(I.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),hr();else{let Ht={transactionRequest:$e,onSuccess:y,onFailure:L,uiOptions:p||{},fundWalletConfig:u},jr={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:L};we({connectWallet:jr,sendTransaction:Ht}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),exportWallet:()=>new Promise((d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Z(s)){p(new Error("Must have a Privy wallet before exporting"));return}G(!0);let y={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},L={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};we({keyExport:L,connectWallet:y}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")})};su=Do.signMessage,lu=Do.sendTransaction;let Oe=(()=>({isNewUserThisSession:S,isLinking:m,linkingHint:M,walletConnectionStatus:k,rpcConfig:I.rpcConfig,chains:I.chains,nativeTokenSymbolForChainId:d=>I.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,captchaData:{ready:$r,enabled:I.captchaEnabled,execute:()=>{let d=window.turnstile;if(!d)return;let p=d.render("#cf-turnstile",{sitekey:Ms,action:I.id,callback:Ft,"error-callback":re,"expired-callback":()=>{try{d.reset(ze),re(void 0),Ft(void 0)}catch{re("expired_and_failed_reset")}},"unsupported-callback":()=>{console.warn("Browser does not support Turnstile.")}});p||console.warn("Failed to render challenge."),fo(p)},remove:()=>{let d=window.turnstile;!d?.remove||!ze||(d.remove(ze),fo(void 0),re(void 0),Ft(void 0))},token:mr,error:lt},initializeWalletProxy:async d=>{if(H)return H;let p=new Promise(L=>{Pt(()=>me=>L(me))}),u=new Promise(L=>setTimeout(()=>L(null),d)),y=await Promise.race([p,u]);return Pt(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(se(ne,"login","onComplete",s,S,!1),e.onSuccess?.(s,S)):D&&se(ne,"login","onError","exited_auth_flow"),t.authFlow=void 0,ue(null),g(null),U(!1),h(!1),E(!1),r(!1),t.createAnalyticsEvent("modal_closed")},connectWallet:Ei,initLoginWithWallet:hu,loginWithWallet:async()=>{if(!n)throw new fr;if(!(t.authFlow instanceof go))throw new C("Must initialize SIWE flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw se(ne,"login","onError",u.privyErrorCode||"generic_connect_wallet_error"),u}c(d||s||null),E(p||!1),l(!0)},initLoginWithOAuth:async d=>{t.startAuthFlow(new Gt(d));let p=await t.authFlow.getAuthorizationUrl();p&&p.url&&window.location.assign(p.url)},loginWithOAuth:async()=>{if(!(t.authFlow instanceof Gt))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw se(ne,"login","onError",u.privyErrorCode||"unknown_auth_error"),u}c(d),E(p||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let u=new yo(d,p);t.startAuthFlow(u);try{await u.sendCodeEmail()}catch(y){throw se(ne,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}},initLoginWithSms:async(d,p)=>{let u=new vo(d,p);t.startAuthFlow(u);try{await u.sendSmsCode()}catch(y){throw se(ne,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new fr;if(t.authFlow instanceof yo)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof vo)t.authFlow.meta.smsCode=d.trim();else throw new C("Must initialize a passwordless code flow first");let p,u;a?p=await t.link():{user:p,isNewUser:u}=await t.authenticate(),c(p||s||null),E(u||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:H,createAnalyticsEvent:(d,p,u)=>t.createAnalyticsEvent(d,p,u),getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let u=s?.linkedAccounts.find(L=>L.type==="wallet"&&L.walletClientType==="privy"),y=await At();if(!y||!H||!u){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}G(!0);try{await H.connect({accessToken:y,address:u.address}),d(!0)}catch(L){Jo(L)&&u.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:u.address}),(await H.recover({address:u.address,accessToken:y})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:u.address}),d(!0)):Jo(L)?(we({recoverWallet:{privyWallet:u,onFailure:p,onSuccess:()=>d(!0)}}),Se("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(L)}}),getFiatOnRampConfig:ss,updateWallets:()=>qr()}))();cu=Oe.recoverEmbeddedWallet;let gu=Av(()=>({wallets:w}),[w]);return ho(rt.Provider,{value:Do,children:ho(os.Provider,{value:ne,children:au(Ya.Provider,{value:gu,children:[e.children,au(Bi.Provider,{value:Oe,children:[ho(Ip,{theme:{...I.appearance.palette||{}}}),ho(ll,{appConfig:I,data:Le,setModalData:we,setInitialScreen:g,initialScreen:P,visible:o,authenticated:a,children:o?ho(Mp,{}):null}),q&&B.id?ho(ru,{appId:e.appId,origin:t.apiUrl,onLoad:j,onLoadFailed:()=>null}):null]}),I.captchaEnabled&&ho(Dp,{onLoad:()=>bi(!0)})]})})})};import{useContext as Nv}from"react";function Lv(e){let{login:t}=Nv(rt);return mo("login",e),{login:t}}import{useContext as Ov}from"react";function Mv(e){let{logout:t}=Ov(rt);return mo("logout",e),{logout:t}}import{useContext as Dv}from"react";function Uv(e){let{connectWallet:t}=Dv(rt);return mo("connectWallet",e),{connectWallet:t}}import{useContext as Fv}from"react";function Bv(e){let{createWallet:t}=Fv(rt);return mo("createWallet",e),{createWallet:t}}export{ht as AsExternalProvider,Er as ConnectorManager,Tr as PrivyClient,Wv as PrivyProvider,X as PrivyProxyProvider,gi as SUPPORTED_CHAINS,Ti as VERSION,Fe as WalletConnector,At as getAccessToken,Uv as useConnectWallet,Bv as useCreateWallet,Lv as useLogin,Mv as useLogout,$ as usePrivy,Ja as useWallets};
2253
+ `;import{useEffect as av}from"react";import{Fragment as lv,jsx as cv}from"react/jsx-runtime";var sv=({onLoad:e})=>{let t=window;return av(()=>{if(document.getElementById("cf-script")!==null||t.turnstile)return;t.onloadTurnstileCallback=e;let o=document.createElement("script");o.setAttribute("src","https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback&render=explicit"),o.setAttribute("id","cf-script"),o.setAttribute("async","true"),document.body.appendChild(o)},[]),cv(lv,{})},Dp=sv;var Up={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 Fp={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 Bp={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 Hp={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 Gp={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 zp={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 $p={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 Vp={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 qp={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 jp={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 Kp={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{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 Yp={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 Jp={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 yi={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 Qp={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 Zp={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 Xp={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{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 gi=[Up,Fp,Kp,Xp,yi,Qp,Zp,Fr,Br,$p,Vp,qp,jp,Gp,zp,Yp,Jp,Bp,Hp],KS=new Set(gi.map(e=>e.id));import Lo from"tinycolor2";var eu="#FFFFFF",dv="#000000",pv=eu,uv="#1E1E1D";function mv(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 po(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return Lo({...e.toHsl(),l:o})}function tu({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=eu,blackHex:a=dv}){let l;switch(e){case"light":l=pv;break;case"dark":l=uv;break;default:l=e;break}let s=Lo(l),c=Lo(t),m=Lo(o),h=Lo(r),w=Lo(n),f=mv(s.getLuminance()),b=po(s,f==="light"?-.04:.11),S=po(s,f==="light"?-.88:.87),E=po(s,f==="light"?-.77:.75),T=po(s,f==="light"?-.43:.45).desaturate(f==="light"?60:20),g=po(s,f==="light"?-.08:.25).desaturate(f==="light"?60:20),D=po(c,.15),U=po(c,-.06),k=Lo(c.getLuminance()>.5?a:i),N=po(m,-.16);return{colorScheme:f,background:s.toHslString(),background2:b.toHslString(),foreground:S.toHslString(),foreground2:E.toHslString(),foreground3:T.toHslString(),foreground4:g.toHslString(),accent:c.toHslString(),accentLight:D.toHslString(),accentDark:U.toHslString(),foregroundAccent:k.toHslString(),success:m.toHslString(),successDark:N.toHslString(),error:w.toHslString(),warn:h.toHslString()}}var uo={appearance:{theme:"light",accentColor:"#676FFF"},walletConnectCloudProjectId:Os,rpcConfig:{rpcUrls:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};function vi(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple"],r=t?.loginMethods?.filter(D=>o.includes(D)),n=r?.slice(0,5),i,a,l,s,c,m,h,w,f,b;if(t?.loginMethods?(i=t.loginMethods.includes("email"),a=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),s=n?.includes("google"),c=n?.includes("twitter"),m=n?.includes("discord"),h=n?.includes("tiktok"),f=n?.includes("github"),w=n?.includes("linkedin"),b=n?.includes("apple")):(i=e.emailAuth,a=e.smsAuth,l=e.walletAuth,s=e.googleOAuth,c=e.twitterOAuth,m=e.discordOAuth,f=e.githubOAuth,h=e.tiktokOAuth,w=e.linkedinOAuth,b=e.appleOAuth),i&&a&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),a=!1),!i&&!a&&[s,c,m,f,h,w,b].some(D=>D))throw new Error("To enable social logins you must also enable either SMS or Email login");if(![i,a,l,s,c,m,f,h,w,b].some(D=>D))throw new Error("You must enable at least one login method");let{chains:S,defaultChain:E}=hv(t?.additionalChains,t?.supportedChains,t?.defaultChain);r&&r.length>5&&console.warn("Max number of social logins allowed is 5. Any more have been removed.");let T=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1;return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:tu({backgroundTheme:t?.appearance?.theme??uo.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??uo.appearance.accentColor}),showWalletLoginFirst:t?.appearance?.showWalletLoginFirst??e.showWalletLoginFirst},loginMethods:{wallet:l,email:i,sms:a,google:s,twitter:c,discord:m,github:f,tiktok:h,linkedin:w,apple:b},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??uo.walletConnectCloudProjectId,rpcConfig:t?.rpcConfig??uo.rpcConfig,chains:S,defaultChain:E,captchaEnabled:e.captchaEnabled??uo.captchaEnabled,embeddedWallets:{...e.embeddedWalletConfig,...T?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1,noPromptOnSignature:!0}:{},...t?.embeddedWallets},customAuth:T?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??uo.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??uo._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??uo._render.inParentNodeId}}}function ou(e,t){return e?.appearance?.logo&&typeof e.appearance.logo=="object"&&(e.appearance.logo="component"),{...e,legacyCreateEmbeddedWalletFlag:t}}function hv(e,t,o){let r;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");r=t}else r=gi.concat(e??[]);let n=t?r[0]:yi,i=o??n;if(!r.find(a=>a.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:r,defaultChain:i}}import{useRef as fv,useEffect as yv}from"react";var wi=class{constructor(){this.callbacks={}}enqueue(t,o){this.callbacks[t]=o}dequeue(t,o){let r=this.callbacks[o];if(!r)throw new Error(`cannot dequeue ${t} event: no event found for id ${o}`);switch(delete this.callbacks[o],t){case"privy:iframe:ready":return r;case"privy:wallet:create":return r;case"privy:wallet:connect":return r;case"privy:wallet:recover":return r;case"privy:wallet:rpc":return r;case"privy:wallet:set-recovery-password":return r;default:throw new Error(`invalid wallet event type ${t}`)}}};import{jsx as Ev}from"react/jsx-runtime";var gv=function(e){return()=>`id-${e++}`}(0);function vv(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function dr(e){return e.error!==void 0}var Oo=new wi,ts=new Map,wv=(e,t)=>typeof t=="bigint"?t.toString():t,Cv=(e,t)=>`${e}${JSON.stringify(t,wv)}`;function pr(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=Cv(e,t);if(e==="privy:wallet:create"){let a=ts.get(n);if(a)return a}let i=new Promise((a,l)=>{let s=gv();Oo.enqueue(s,{resolve:a,reject:l}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{ts.delete(n)});return ts.set(n,i),i}function bv(e){switch(e.event){case"privy:iframe:ready":let t=Oo.dequeue(e.event,e.id);return dr(e)?t.reject(new Wt(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Oo.dequeue(e.event,e.id);return dr(e)?o.reject(new Wt(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Oo.dequeue(e.event,e.id);return dr(e)?r.reject(new Wt(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Oo.dequeue(e.event,e.id);return dr(e)?n.reject(new Wt(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Oo.dequeue(e.event,e.id);return dr(e)?i.reject(new Wt(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Oo.dequeue(e.event,e.id);return dr(e)?a.reject(new Wt(e.error.type,e.error.message)):a.resolve(e.data);default:console.warn("Unsupported wallet proxy method:",e)}}function ru(e){let t=fv(null);return yv(()=>{let o=t.current;if(!o)return;function r(s){s&&s.origin===e.origin&&vv(s.data)&&bv(s.data)}let n={create(s){return pr("privy:wallet:create",s,o)},connect(s){return pr("privy:wallet:connect",s,o)},recover(s){return pr("privy:wallet:recover",s,o)},rpc(s){return pr("privy:wallet:rpc",s,o)},setRecoveryPassword(s){return pr("privy:wallet:set-recovery-password",s,o)}};window.addEventListener("message",r);let i=()=>e.onLoad(n),a=(...s)=>{console.warn("Privy iframe failed to load: ",...s),e.onLoadFailed()},l=new AbortController;return js(()=>pr("privy:iframe:ready",{},o),{abortSignal:l.signal}).then(i,a),()=>{window.removeEventListener("message",r),l.abort()}},[t.current]),Ev("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:an(e.origin,`/apps/${e.appId}/embedded-wallets`)})}import{createContext as xv,useContext as Pv,useEffect as Tv}from"react";var nu={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]}},os=xv(void 0),_v=()=>Pv(os);function mo(e,t){if(!t)return;let r=_v().current[e];return Tv(()=>{for(let[n,i]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))r.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]=r[n]?.filter(a=>a!==i)}},[t])}function se(e,t,o,...r){for(let n of e.current[t][o])n(...r)}import{jsx as ho,jsxs as au}from"react/jsx-runtime";function kv(e){return typeof e=="string"&&e.length===25}var zr;function At(){if(!zr){let e=z.get(Ho);return Promise.resolve(e||null)}return zr.getAccessToken()}var su,Xs=(e,t)=>su(e,t),lu,el=(e,t)=>lu(e,t),cu,tl=()=>cu(),Rv=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;z.put(yr,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},Wv=({config:e,...t})=>{if(!kv(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");zr||(zr=new Pr({appId:t.appId,apiUrl:t.apiUrl||Xr}));let o=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&o.embeddedWallets?.createOnLogin===void 0&&(o.embeddedWallets||(o.embeddedWallets={}),o.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."),ho(Iv,{...t,config:o,client:zr})},Iv=e=>{let t=e.client,[o,r]=Q(!1),[n,i]=Q(!1),[a,l]=Q(!1),[s,c]=Q(null),[m,h]=Q(!1),[w,f]=Q([]),b=iu(w),[S,E]=Q(!1),[T,g]=Q(null),[D,U]=Q(!1),[k,N]=Q({status:"disconnected",connectError:null,connector:null,connectRetry:x}),[M,ue]=Q(null),[H,j]=Q(null),[B,Y]=Q({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}),[I,_e]=Q(()=>{let d=ou(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",d),vi(B,e.config)}),[q,G]=Q(!0),[Le,we]=Q({}),[K,le]=Q(null),[ur,Tt]=Q(null),[$r,bi]=Q(!1),[mr,Ft]=Q(),[lt,re]=Q(),[ze,fo]=Q(),[Mo,ns]=Q(!1),ne=iu(nu),Se=d=>{d&&g(d),r(!0),t.createAnalyticsEvent("modal_open",{initialScreen:d})},Vr=d=>{I.embeddedWallets.createOnLogin!=="off"&&G(!0),Se(d)};Pt(()=>{if(!H||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClient==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(H,p,I.defaultChain)}},[H,s]),Pt(()=>{H&&ur?.(H)},[H]),Pt(()=>{(async()=>{if(!I.customAuth?.enabled)return;G(!0);let{getCustomAccessToken:p,isLoading:u}=I.customAuth;if(!(!n||u))try{let y=await p();if(!y){await Do.logout();return}if(a)return;t.startAuthFlow(new Fo(y));let{user:L,isNewUser:me}=await t.authenticate();L||await Do.logout(),c(L||null),E(me||!1),l(!0),ns(!0)}catch(y){console.warn(y),a&&await Do.logout()}})()},[I.customAuth?.enabled,I.customAuth?.getCustomAccessToken,I.customAuth?.isLoading,n,a]),Pt(()=>{Mo&&H&&s&&zt(s,e.config?.embeddedWallets?.createOnLogin)&&(ns(!1),ls(s,3e4).catch(console.error))},[Mo&&H&&s]),Pt(()=>{async function d(){let p=await t.getServerConfig();Y(p);let u=vi(p,e.config);_e(u),p.customApiUrl&&t.updateApiUrl(p.customApiUrl),t.initializeConnectorManager(u.walletConnectCloudProjectId,u.rpcConfig,u.chains,u.defaultChain),t.connectors?.initialize();let y=du();Rv();let L=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!L),L&&se(ne,"login","onComplete",L,!1,!0),c(L)),y||(i(!0),K?.()),y&&L&&h(!0),pu()}n||d()},[t,K,n]),Pt(()=>{let d=vi(B,e.config);_e(d)},[e.config]);let du=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),u=d.get("privy_oauth_state"),y=d.get("privy_oauth_provider");return p&&u&&y?(t.startAuthFlow(new Gt(y,p,u)),Vr("AWAITING_OAUTH_SCREEN"),we({finishOauthFlow:{onComplete:()=>{i(!0),K?.()}}}),!0):!1},Ei=async(d,p,u)=>{let y=await t.connectors?.createWalletConnector(d,p)||null;is(y,u)};async function is(d,p){if(!d)return N({status:"disconnected",connectError:new F("Unable to connect to wallet."),connector:null,connectRetry:x}),p?.(null);N({connector:d,status:"connecting",connectError:null,connectRetry:()=>is(d,p)});try{let u=await d.connect({showPrompt:!0});if(!I.chains.find(y=>y.id===Number(u?.chainId))){N(y=>({...y,connector:d,status:"switching_to_supported_chain",connectError:null,connectRetry:x}));try{await u?.switchChain(I.defaultChain.id)}catch{console.warn(`Unable to switch to default chain: ${I.defaultChain.id}`)}}return N(y=>({...y,status:"connected",connectError:null,connectRetry:x})),u&&!D&&se(ne,"connectWallet","onSuccess",u),p?.(u)}catch(u){return u instanceof et?(console.warn(u.cause?u.cause:u.message),D||se(ne,"connectWallet","onError",u.privyErrorCode||"generic_connect_wallet_error")):(console.warn(u),D||se(ne,"connectWallet","onError","unknown_connect_wallet_error")),N(y=>({...y,status:"disconnected",connectError:u})),p?.(null)}}let xi=d=>{d!==null&&t.startAuthFlow(new go(d))},pu=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),u=d.get("privy_wallet_client");if(!p||!u)return;if(u==="phantom"&&!je()&&Vr("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");Se("AWAITING_CONNECTION");let y=new URL(window.location.href);y.searchParams.delete("privy_connector"),y.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",y),Ei(p,u,xi)};Pt(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let as=()=>{h(!0),Se("LINK_WALLET_SCREEN")},uu=d=>{if(!a||!s)return!1;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address)return!0;return!1},mu=async d=>{if(!t.connectors)throw new C("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;N(u=>({...u,connector:p,status:"connected",connectError:null,connectRetry:x})),xi(d),Vr("AWAITING_CONNECTION")},hu=async(d,p)=>{if(!t.connectors)throw new C("Connector not initialized");await Ei(d,p,xi)},ss=async(d,p)=>{if(!I.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:u,externalTransactionId:y}=await qc(t,d,p?.config??{},I.appearance.palette,I.fiatOnRamp.useSandbox);return{signedUrl:u,externalTransactionId:y}}else throw new C("Unsupported fund provider. Currently supported option is `moonpay`.")},qr=()=>{f(d=>{let p=t.connectors?.wallets.map(u=>({...u,linked:uu(u),loginOrLink:async()=>{if(!await u.isConnected())throw new C("Wallet is not connected");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");mu(u)},fund:async y=>{let{signedUrl:L,externalTransactionId:me}=await ss(u.address,y);we({fiatOnRampPrompt:{signedUrl:L},fiatOnRampStatus:{externalTransactionId:me}}),Se("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new C("User is not authenticated.");if(u.connectorType==="embedded"&&u.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let y=await t.unlinkWallet(u.address);c(y)}}))||[];return cn(d,p)?d:p})};Pt(()=>{qr()},[s?.linkedAccounts,a,n]),Pt(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");qr(),t.connectors.on("walletsUpdated",qr)}},[n]);let fu=()=>{Se(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};Pt(()=>{if(!w[0])return;let d=w[0],p=b.current.find(y=>y.address===d.address),u=s?.linkedAccounts.find(y=>y.type==="wallet"&&y.address===d.address);if(!p&&u){let y=Object.assign({},s);y.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},c(y)}b.current=w},[w]);let ls=async(d,p)=>{if(Z(d))throw se(ne,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[y,L]=await Promise.all([Oe.initializeWalletProxy(p),At()]);if(!y&&e.config?.customAuth?.enabled)throw se(ne,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!y||!L||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((me,be)=>{G(!0),we({createWallet:{onSuccess:$e=>{se(ne,"createWallet","onSuccess",$e),me($e)},onFailure:$e=>{se(ne,"createWallet","onError","unknown_embedded_wallet_error"),be($e)},callAuthOnSuccessOnClose:!1}}),Se("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await y.create({accessToken:L});let me=await Oe.refreshUser(),be=Z(me);if(!be)throw se(ne,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return se(ne,"createWallet","onSuccess",be),be}},yu=d=>{if(!I.chains.map(p=>p.id).includes(d))throw new F(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Do={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:fu,linkWallet:as,linkEmail:()=>{if(s?.email)throw new C("User already has an email linked to their account.");h(!0),Se("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(s?.phone)throw new C("User already has a phone number linked to their account.");h(!0),Se("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(s?.google)throw new C("User already has a Google account linked to their account.");await Oe.initLoginWithOAuth("google")},linkTwitter:async()=>{if(s?.twitter)throw new C("User already has a Twitter account linked to their account.");await Oe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(s?.discord)throw new C("User already has a Discord account linked to their account.");await Oe.initLoginWithOAuth("discord")},linkGithub:async()=>{if(s?.github)throw new C("User already has a Github account linked to their account.");await Oe.initLoginWithOAuth("github")},linkTiktok:async()=>{if(s?.tiktok)throw new C("User already has a Tiktok account linked to their account.");await Oe.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(s?.linkedin)throw new C("User already has a LinkedIn account linked to their account.");await Oe.initLoginWithOAuth("linkedin")},linkApple:async()=>{await Oe.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(d=>{le(()=>d)}),le(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}U(!0),Vr()},logout:async()=>{await t.logout(),c(null),l(!1),g(null),se(ne,"logout","onSuccess"),h(!1),r(!1),z.del(gr)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new X;let d=w.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(y=>y.address===d?.address));return!d||!p?new X:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new rs(new ht(new X));let d=w.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(y=>y.address===d?.address));return!d||!p?new rs(new ht(new X)):new rs(new ht(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new qt(new X);let d=w.find(u=>s.wallet&&u.address===s.wallet.address),p=t.connectors?.walletConnectors.find(u=>u.wallets.find(y=>y.address===d?.address));return!d||!p?new qt(new X):new qt(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},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},setActiveWallet:async d=>{let p=w.find(y=>Ci(y.address)===Ci(d)),u=s?.linkedAccounts.find(y=>y.type==="wallet"&&Ci(y.address)===Ci(d));if(!p||!await p.isConnected())ue(d),as();else if(!p.linked)p.loginOrLink();else{let y=Object.assign({},s);y.wallet=u&&{address:u.address,chainType:u.chainType,chainId:u.chainId,walletClient:u.walletClient,walletClientType:u.walletClientType,connectorType:u.connectorType},c(y)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw se(ne,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return ls(s,15e3)},setWalletPassword:()=>new Promise((d,p)=>{if(!a||!s){p(new Error("User must be authenticated before adding password to Privy wallet"));return}let u=Z(s);if(!u||!H){p(new Error("Must have a Privy wallet to add a password"));return}if(u.recoveryMethod==="user-passcode"){p(new Error("Cannot set password. Embedded wallet already has a password."));return}G(!0);let y={onSuccess:d,onFailure:p,callAuthOnSuccessOnClose:!1},L={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:p};we({setWalletPassword:y,connectWallet:L}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}),signMessage:(d,p)=>new Promise(async(u,y)=>{if(!a||!s){y(new Error("User must be authenticated before signing with a Privy wallet"));return}let L=Z(s);if(!L){y(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){y(new Error("Message must be a non-empty string"));return}G(!0);let me=async()=>{if(!a)return y(new Error("User must be authenticated before signing with a Privy wallet")),null;let be=await At();if(H&&be)try{if(!await Oe.recoverEmbeddedWallet())return y(new Error("Unable to connect to wallet")),null;t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:L.address});let{response:$e}=await H.rpc({accessToken:be,address:L.address,request:{method:"personal_sign",params:[d,L.address]}}),hr=$e.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:L.address}),hr}catch(Bt){return y(Bt),null}else return null};if(I.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");let be=await me();be?u(be):y(new Ee("Unable to sign message"))}else{let $e={message:d,confirmAndSignMessage:me,onSuccess:Ht=>{u(Ht)},onFailure:Ht=>{y(Ht)},uiOptions:p||{}},hr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:y};we({signMessage:$e,connectWallet:hr}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:(d,p,u)=>new Promise(async(y,L)=>{if(!a||!s){L(new Error("User must be authenticated before signing with a Privy wallet"));return}let me=Z(s);if(!me){L(new Error("Must have a Privy wallet before signing"));return}G(!0);let be=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Bt=d.chainId||be.chainId;yu(Bt);let $e=Object.assign({},d,{chainId:Bt}),hr=async()=>{let Ht=await At();if(!Ht||!H){L(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Oe.recoverEmbeddedWallet()){L(new Error("Unable to connect to wallet"));return}let cs=new Sv(tt($e.chainId,I.chains,I.rpcConfig)),vu=await di(me.address,$e,cs),wu=await pi(Ht,me.address,H,vu,cs);y(wu)}catch(jr){L(jr)}};if(I.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),hr();else{let Ht={transactionRequest:$e,onSuccess:y,onFailure:L,uiOptions:p||{},fundWalletConfig:u},jr={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:L};we({connectWallet:jr,sendTransaction:Ht}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),exportWallet:()=>new Promise((d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Z(s)){p(new Error("Must have a Privy wallet before exporting"));return}G(!0);let y={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},L={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};we({keyExport:L,connectWallet:y}),Se("EMBEDDED_WALLET_CONNECTING_SCREEN")})};su=Do.signMessage,lu=Do.sendTransaction;let Oe=(()=>({isNewUserThisSession:S,isLinking:m,linkingHint:M,walletConnectionStatus:k,rpcConfig:I.rpcConfig,chains:I.chains,nativeTokenSymbolForChainId:d=>I.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,captchaData:{ready:$r,enabled:I.captchaEnabled,execute:()=>{let d=window.turnstile;if(!d)return;let p=d.render("#cf-turnstile",{sitekey:Ms,action:I.id,callback:Ft,"error-callback":re,"expired-callback":()=>{try{d.reset(ze),re(void 0),Ft(void 0)}catch{re("expired_and_failed_reset")}},"unsupported-callback":()=>{console.warn("Browser does not support Turnstile.")}});p||console.warn("Failed to render challenge."),fo(p)},remove:()=>{let d=window.turnstile;!d?.remove||!ze||(d.remove(ze),fo(void 0),re(void 0),Ft(void 0))},token:mr,error:lt},initializeWalletProxy:async d=>{if(H)return H;let p=new Promise(L=>{Tt(()=>me=>L(me))}),u=new Promise(L=>setTimeout(()=>L(null),d)),y=await Promise.race([p,u]);return Tt(null),y},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(se(ne,"login","onComplete",s,S,!1),e.onSuccess?.(s,S)):D&&se(ne,"login","onError","exited_auth_flow"),t.authFlow=void 0,ue(null),g(null),U(!1),h(!1),E(!1),r(!1),t.createAnalyticsEvent("modal_closed")},connectWallet:Ei,initLoginWithWallet:hu,loginWithWallet:async()=>{if(!n)throw new fr;if(!(t.authFlow instanceof go))throw new C("Must initialize SIWE flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw se(ne,"login","onError",u.privyErrorCode||"generic_connect_wallet_error"),u}c(d||s||null),E(p||!1),l(!0)},initLoginWithOAuth:async d=>{t.startAuthFlow(new Gt(d));let p=await t.authFlow.getAuthorizationUrl();p&&p.url&&window.location.assign(p.url)},loginWithOAuth:async()=>{if(!(t.authFlow instanceof Gt))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(u){throw se(ne,"login","onError",u.privyErrorCode||"unknown_auth_error"),u}c(d),E(p||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let u=new yo(d,p);t.startAuthFlow(u);try{await u.sendCodeEmail()}catch(y){throw se(ne,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}},initLoginWithSms:async(d,p)=>{let u=new vo(d,p);t.startAuthFlow(u);try{await u.sendSmsCode()}catch(y){throw se(ne,"login","onError",y.privyErrorCode||"unknown_auth_error"),y}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new fr;if(t.authFlow instanceof yo)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof vo)t.authFlow.meta.smsCode=d.trim();else throw new C("Must initialize a passwordless code flow first");let p,u;a?p=await t.link():{user:p,isNewUser:u}=await t.authenticate(),c(p||s||null),E(u||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:H,createAnalyticsEvent:(d,p,u)=>t.createAnalyticsEvent(d,p,u),getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let u=s?.linkedAccounts.find(L=>L.type==="wallet"&&L.walletClientType==="privy"),y=await At();if(!y||!H||!u){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}G(!0);try{await H.connect({accessToken:y,address:u.address}),d(!0)}catch(L){Jo(L)&&u.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:u.address}),(await H.recover({address:u.address,accessToken:y})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:u.address}),d(!0)):Jo(L)?(we({recoverWallet:{privyWallet:u,onFailure:p,onSuccess:()=>d(!0)}}),Se("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(L)}}),getFiatOnRampConfig:ss,updateWallets:()=>qr()}))();cu=Oe.recoverEmbeddedWallet;let gu=Av(()=>({wallets:w}),[w]);return ho(rt.Provider,{value:Do,children:ho(os.Provider,{value:ne,children:au(Ya.Provider,{value:gu,children:[e.children,au(Bi.Provider,{value:Oe,children:[ho(Ip,{theme:{...I.appearance.palette||{}}}),ho(ll,{appConfig:I,data:Le,setModalData:we,setInitialScreen:g,initialScreen:T,visible:o,authenticated:a,children:o?ho(Mp,{}):null}),q&&B.id?ho(ru,{appId:e.appId,origin:t.apiUrl,onLoad:j,onLoadFailed:()=>null}):null]}),I.captchaEnabled&&ho(Dp,{onLoad:()=>bi(!0)})]})})})};import{useContext as Nv}from"react";function Lv(e){let{login:t}=Nv(rt);return mo("login",e),{login:t}}import{useContext as Ov}from"react";function Mv(e){let{logout:t}=Ov(rt);return mo("logout",e),{logout:t}}import{useContext as Dv}from"react";function Uv(e){let{connectWallet:t}=Dv(rt);return mo("connectWallet",e),{connectWallet:t}}import{useContext as Fv}from"react";function Bv(e){let{createWallet:t}=Fv(rt);return mo("createWallet",e),{createWallet:t}}export{ht as AsExternalProvider,Er as ConnectorManager,Pr as PrivyClient,Wv as PrivyProvider,X as PrivyProxyProvider,gi as SUPPORTED_CHAINS,Pi as VERSION,Fe as WalletConnector,At as getAccessToken,Uv as useConnectWallet,Bv as useCreateWallet,Lv as useLogin,Mv as useLogout,$ as usePrivy,Ja as useWallets};