@privy-io/react-auth 1.57.1 → 1.57.2-beta-20240227212848

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 gs=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var yc=(e,t,o)=>(gs(e,t,"read from private field"),o?o.call(e):t.get(e)),gi=(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)},vs=(e,t,o,r)=>(gs(e,t,"write to private field"),r?r.call(e,o):t.set(e,o),o);var gc=(e,t,o)=>(gs(e,t,"access private method"),o);import{getAddress as hs}from"@ethersproject/address";import{StaticJsonRpcProvider as l2,Web3Provider as pc}from"@ethersproject/providers";import{createStore as c2}from"mipd";import{useCallback as d2,useEffect as xo,useMemo as p2,useRef as fi,useState as Pe}from"react";import{FetchError as Oh}from"ofetch";var Ne=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}]`:""}`}},zt=class extends Ne{constructor(o,r,n,i,a){super(n,i,a);this.type=o;this.status=r}},w=class extends Ne{constructor(o,r,n){super(o,r,n);this.type="client_error"}},vi=class extends w{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var q=class extends Ne{constructor(o,r,n){super(o,r,n);this.type="connector_error"}},ie=e=>{if(e instanceof Ne)return e;if(!(e instanceof Oh))return Ge(e);if(!e.response)return new zt("api_error",null,e.message,e);let{type:t,message:o,error:r,code:n}=e.data;return new zt(t||"ApiError",e.response.status,o||r,e,n)},Ge=e=>e instanceof Ne?e:e instanceof Error?new w(e.message,e):new w(`Internal error: ${e}`);var Ar=class extends w{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},at=class extends w{constructor(t="Embedded wallet error",o){super(t,o,"unknown_embedded_wallet_error")}},wi=class extends w{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Ci=()=>"/api/v1/sessions",bi=()=>"/api/v1/sessions/logout",vc=()=>"/api/v1/sessions/fork",Ei=()=>"/api/v1/sessions/fork/recover",wc=()=>"/api/v1/siwe/init",Cc=()=>"/api/v1/siwe/authenticate",bc=()=>"/api/v1/siwe/link",Ec=()=>"/api/v1/farcaster/init",Tc=()=>"/api/v1/farcaster/authenticate",Pc=()=>"/api/v1/farcaster/link",xc=()=>"/api/v1/farcaster/status",Sc=()=>"/api/v1/passwordless/init",_c=()=>"/api/v1/passwordless/authenticate",Ac=()=>"/api/v1/passwordless/link",kc=()=>"/api/v1/passwordless_sms/init",Rc=()=>"/api/v1/passwordless_sms/authenticate",Ic=()=>"/api/v1/passwordless_sms/link",Wc=()=>"/api/v1/oauth/init",Mc=()=>"/api/v1/oauth/authenticate",Nc=()=>"/api/v1/oauth/link",Lc=()=>"/api/v1/siwe/unlink",Oc=()=>"/api/v1/passwordless/unlink",Dc=()=>"/api/v1/passwordless_sms/unlink",Uc=()=>"/api/v1/oauth/unlink",Fc=()=>"/api/v1/farcaster/unlink",Bc=()=>"/api/v1/analytics_events",Hc=()=>"/api/v1/plugins/moonpay_on_ramp/sign",Gc=()=>"/api/v1/custom_jwt_account/authenticate",Vc=()=>"/api/v1/mfa/passwordless_sms/init";var zc=()=>"/api/v1/mfa/passwordless_sms/enroll";var $c=()=>"/api/v1/users/me/accept_terms";var kr=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let t=Gc(),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 ie(t)}}async link(){throw new Error("Unimplemented")}};var er=class{constructor(t,o){this.meta={email:t,captchaToken:o}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=_c(),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 ie(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=Ac();return await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ie(t)}}async sendCodeEmail(t,o){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.email=t),o&&(this.meta.captchaToken=o),!this.meta.email)throw new w("Email must be set when initialzing authentication.");try{let r=Sc();return await this.api.post(r,{email:this.meta.email,token:this.meta.captchaToken})}catch(r){throw ie(r)}}};import{isMobile as Dh}from"react-device-detect";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 Pn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Ve(this._startChannelOnce.bind(this)),this.pollForReady=new Ve(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.channelToken)throw new w("Auth flow must be initialized first");try{let t=await this.api.post(Tc(),{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new w("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ie(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{return await this.api.post(Pc(),{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ie(t)}}async _startChannelOnce(){if(!this.api)throw new w("Auth flow has no API instance");let t=await this.api.post(Ec(),{token:this.captchaToken});Dh&&t.connect_uri&&window.open(t.connect_uri,"_blank","noopener noreferrer"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new w("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.channelToken)throw new w("Auth flow must be initialized first");let t=await this.api.get(xc(),{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};import{base64url as ad}from"jose";var qc="1.57.1";var Ti="4df5e2316331463a9130964bd6078dfa",jc="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Kc="34357d3c125c2bcf2ce2bc3309d98715",Pi="https://auth.privy.io",Yc=2e4,ze=1400,Jc=2500,ws=qc;var tr="privy:token",Cs="privy-token",xi="privy:refresh_token",bs="privy-refresh-token",Si="privy-session",xn="privy:session_transfer_token",Fh="privy:wallet",Sn="privy:caid",Rr="privy:state_code",Ir="privy:code_verifier",_i=e=>`${Fh}:${e}`,Es="privy:connectors",Ts="privy:connections";var or=12e4,fo=1,Ps="0x1",Wr=3e4,Qc="https://api.moonpay.com/v1",Zc="https://api.moonpay.com/v1",Xc="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",ed="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",td="0x420000000000000000000000000000000000000F",od=["function getL1Fee(bytes memory _data) external view returns (uint256)"];async function rd(e){let t=new TextEncoder().encode(e),o=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(o)}function nd(e){return crypto.getRandomValues(new Uint8Array(e))}var Ai=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)}},xs=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)}},Ss=class{get(t){let o=sessionStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?sessionStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function id(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function Bh(){return typeof window<"u"&&window.localStorage?new xs:new Ai}function Hh(){return typeof window<"u"&&window.sessionStorage?new Ss:new Ai}var It=Hh(),re=Bh();var Gh="S256",Vh="S256",ko=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");let t=It.get(Ir);if(!t)throw new w("Authentication error.");try{let o=Mc(),r=await this.api.post(o,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return It.del(Ir),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(o){let r=ie(o);throw r.privyErrorCode?new w(r.message||"Invalid code during OAuth flow.",void 0,r.privyErrorCode):r.message==="User denied confirmation during OAuth flow"?new w("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new w("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");let t=It.get(Ir);if(!t)throw new w("Authentication error.");try{let o=Nc(),r=await this.api.post(o,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return It.del(Ir),r}catch(o){throw ie(o)}}createCodeVerifier(){return ad.encode(nd(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,o=Gh){if(o==Vh){let r=await rd(t);return ad.encode(r)}else return t}async getAuthorizationUrl(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.provider)throw new w("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();It.put(Ir,t);let o=this.createStateCode();It.put(Rr,o);let r=await this.deriveCodeChallengeFromCodeVerifier(t);try{let n=Wc();return await this.api.post(n,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:r,state_code:o})}catch(n){throw ie(n)}}};var rr=class{constructor(t,o){this.createSiweMessage=(t,o,r,n,i,a,l)=>`${r} wants you to sign in with your Ethereum account:
1
+ var vs=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var gc=(e,t,o)=>(vs(e,t,"read from private field"),o?o.call(e):t.get(e)),vi=(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)},ws=(e,t,o,r)=>(vs(e,t,"write to private field"),r?r.call(e,o):t.set(e,o),o);var vc=(e,t,o)=>(vs(e,t,"access private method"),o);import{getAddress as ys}from"@ethersproject/address";import{StaticJsonRpcProvider as l2,Web3Provider as uc}from"@ethersproject/providers";import{createStore as c2}from"mipd";import{useCallback as d2,useEffect as _o,useMemo as p2,useRef as hi,useState as xe}from"react";import{FetchError as Oh}from"ofetch";var Le=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}]`:""}`}},$t=class extends Le{constructor(o,r,n,i,a){super(n,i,a);this.type=o;this.status=r}},w=class extends Le{constructor(o,r,n){super(o,r,n);this.type="client_error"}},wi=class extends w{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var j=class extends Le{constructor(o,r,n){super(o,r,n);this.type="connector_error"}},ie=e=>{if(e instanceof Le)return e;if(!(e instanceof Oh))return $e(e);if(!e.response)return new $t("api_error",null,e.message,e);let{type:t,message:o,error:r,code:n}=e.data;return new $t(t||"ApiError",e.response.status,o||r,e,n)},$e=e=>e instanceof Le?e:e instanceof Error?new w(e.message,e):new w(`Internal error: ${e}`);var kr=class extends w{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},st=class extends w{constructor(t="Embedded wallet error",o){super(t,o,"unknown_embedded_wallet_error")}},Ci=class extends w{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var bi=()=>"/api/v1/sessions",Ei=()=>"/api/v1/sessions/logout",wc=()=>"/api/v1/sessions/fork",Ti=()=>"/api/v1/sessions/fork/recover",Cc=()=>"/api/v1/siwe/init",bc=()=>"/api/v1/siwe/authenticate",Ec=()=>"/api/v1/siwe/link",Tc=()=>"/api/v1/farcaster/init",Pc=()=>"/api/v1/farcaster/authenticate",xc=()=>"/api/v1/farcaster/link",Sc=()=>"/api/v1/farcaster/status",_c=()=>"/api/v1/passwordless/init",Ac=()=>"/api/v1/passwordless/authenticate",kc=()=>"/api/v1/passwordless/link",Rc=()=>"/api/v1/passwordless_sms/init",Ic=()=>"/api/v1/passwordless_sms/authenticate",Wc=()=>"/api/v1/passwordless_sms/link",Mc=()=>"/api/v1/oauth/init",Nc=()=>"/api/v1/oauth/authenticate",Lc=()=>"/api/v1/oauth/link",Oc=()=>"/api/v1/siwe/unlink",Dc=()=>"/api/v1/passwordless/unlink",Uc=()=>"/api/v1/passwordless_sms/unlink",Fc=()=>"/api/v1/oauth/unlink",Bc=()=>"/api/v1/farcaster/unlink",Hc=()=>"/api/v1/analytics_events",Gc=()=>"/api/v1/plugins/moonpay_on_ramp/sign",Vc=()=>"/api/v1/custom_jwt_account/authenticate",zc=()=>"/api/v1/mfa/passwordless_sms/init";var $c=()=>"/api/v1/mfa/passwordless_sms/enroll";var qc=()=>"/api/v1/users/me/accept_terms";var Rr=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let t=Vc(),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 ie(t)}}async link(){throw new Error("Unimplemented")}};var tr=class{constructor(t,o){this.meta={email:t,captchaToken:o}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=Ac(),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 ie(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new w("Email and email code must be set prior to calling authenticate.");try{let t=kc();return await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ie(t)}}async sendCodeEmail(t,o){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.email=t),o&&(this.meta.captchaToken=o),!this.meta.email)throw new w("Email must be set when initialzing authentication.");try{let r=_c();return await this.api.post(r,{email:this.meta.email,token:this.meta.captchaToken})}catch(r){throw ie(r)}}};import{isMobile as Dh}from"react-device-detect";var qe=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 xn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new qe(this._startChannelOnce.bind(this)),this.pollForReady=new qe(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.channelToken)throw new w("Auth flow must be initialized first");try{let t=await this.api.post(Pc(),{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new w("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ie(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{return await this.api.post(xc(),{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ie(t)}}async _startChannelOnce(){if(!this.api)throw new w("Auth flow has no API instance");let t=await this.api.post(Tc(),{token:this.captchaToken});Dh&&t.connect_uri&&window.open(t.connect_uri,"_blank","noopener noreferrer"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new w("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.channelToken)throw new w("Auth flow must be initialized first");let t=await this.api.get(Sc(),{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};import{base64url as sd}from"jose";var jc="1.57.2-beta-20240227212848";var Pi="4df5e2316331463a9130964bd6078dfa",Kc="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Yc="34357d3c125c2bcf2ce2bc3309d98715",xi="https://auth.privy.io",Jc=2e4,je=1400,Qc=2500,Cs=jc;var or="privy:token",bs="privy-token",Si="privy:refresh_token",Es="privy-refresh-token",_i="privy-session",Sn="privy:session_transfer_token",Fh="privy:wallet",_n="privy:caid",Ir="privy:state_code",Wr="privy:code_verifier",Ai=e=>`${Fh}:${e}`,Ts="privy:connectors",Ps="privy:connections";var rr=12e4,yo=1,xs="0x1",Mr=3e4,Zc="https://api.moonpay.com/v1",Xc="https://api.moonpay.com/v1",ed="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",td="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",od="0x420000000000000000000000000000000000000F",rd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];async function nd(e){let t=new TextEncoder().encode(e),o=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(o)}function id(e){return crypto.getRandomValues(new Uint8Array(e))}var ki=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)}},Ss=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)}},_s=class{get(t){let o=sessionStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?sessionStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function ad(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function Bh(){return typeof window<"u"&&window.localStorage?new Ss:new ki}function Hh(){return typeof window<"u"&&window.sessionStorage?new _s:new ki}var Wt=Hh(),re=Bh();var Gh="S256",Vh="S256",Ro=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");let t=Wt.get(Wr);if(!t)throw new w("Authentication error.");try{let o=Nc(),r=await this.api.post(o,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Wt.del(Wr),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(o){let r=ie(o);throw r.privyErrorCode?new w(r.message||"Invalid code during OAuth flow.",void 0,r.privyErrorCode):r.message==="User denied confirmation during OAuth flow"?new w("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new w("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new w("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new w("User denied confirmation during OAuth flow");let t=Wt.get(Wr);if(!t)throw new w("Authentication error.");try{let o=Lc(),r=await this.api.post(o,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return Wt.del(Wr),r}catch(o){throw ie(o)}}createCodeVerifier(){return sd.encode(id(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,o=Gh){if(o==Vh){let r=await nd(t);return sd.encode(r)}else return t}async getAuthorizationUrl(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.provider)throw new w("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();Wt.put(Wr,t);let o=this.createStateCode();Wt.put(Ir,o);let r=await this.deriveCodeChallengeFromCodeVerifier(t);try{let n=Mc();return await this.api.post(n,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:r,state_code:o})}catch(n){throw ie(n)}}};var nr=class{constructor(t,o){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,this.captchaToken=o}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Cc(),{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 ie(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(bc(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ie(t)}}async sign(){if(!this.api)throw new w("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new w("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 w("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(wc(),{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new w("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 nr=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=Rc(),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 ie(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=Ic();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ie(t)}}async sendSmsCode(t,o){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new w("phone nNumber must be set when initialzing authentication.");try{let r=kc();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw ie(r)}}};import{v4 as Oy}from"uuid";function et(e){return new Date(e*1e3)}function zh(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:et(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:et(o.verified_at)};t.push(i);break;case"phone":let a={number:o.phoneNumber,type:o.type,verifiedAt:et(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:et(o.verified_at)};t.push(l);break;case"twitter_oauth":let s={subject:o.subject,username:o.username,name:o.name,type:o.type,profilePictureUrl:o.profile_picture_url,verifiedAt:et(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:et(o.verified_at)};t.push(c);break;case"github_oauth":let u={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:et(o.verified_at)};t.push(u);break;case"tiktok_oauth":let h={subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:et(o.verified_at)};t.push(h);break;case"linkedin_oauth":let f={subject:o.subject,name:o.name,email:o.email,type:o.type,verifiedAt:et(o.verified_at)};t.push(f);break;case"apple_oauth":let g={subject:o.subject,email:o.email,type:o.type,verifiedAt:et(o.verified_at)};t.push(g);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:et(o.verified_at)});break;case"farcaster":let C={type:o.type,fid:o.fid,ownerAddress:o.owner_address,displayName:o.display_name,username:o.username,bio:o.bio,pfp:o.profile_picture_url,url:o.homepage_url,verifiedAt:et(o.verified_at)};t.push(C);break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function Wt(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var ce=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,$h=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),yt=(e,t)=>t==="all-users"&&!ce(e)||t==="users-without-wallets"&&!$h(e)?.length;function st(e){if(!e)return null;let t=zh(e.linked_accounts),o=Wt(t,"wallet"),r=Wt(t,"email"),n=Wt(t,"phone"),i=Wt(t,"google_oauth"),a=Wt(t,"twitter_oauth"),l=Wt(t,"discord_oauth"),s=Wt(t,"github_oauth"),c=Wt(t,"tiktok_oauth"),u=Wt(t,"linkedin_oauth"),h=Wt(t,"apple_oauth"),f=Wt(t,"farcaster"),g=e.mfa_methods.map(({type:b,verified_at:x})=>({type:b,verifiedAt:et(x)}));return{id:e.id,createdAt:et(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,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},tiktok:c&&{subject:c.subject,username:c.username,name:c.name},linkedin:u&&{subject:u.subject,name:u.name,email:u.email},apple:h&&{subject:h.subject,email:h.email},farcaster:f&&{fid:f.fid,ownerAddress:f.ownerAddress,displayName:f.displayName,username:f.username,bio:f.bio,pfp:f.pfp,url:f.url},mfaMethods:g.map(b=>b.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as ip}from"@ethersproject/address";import Wy from"eventemitter3";function sd(){let e=window,t=e.ethereum;if(!t)return[];let o=[];if(t.providers?.length)for(let r of t.providers)r&&o.push(r);return o.push(e.ethereum),o}var ki=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var _s=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||ki(e)!=="MetaMask")return!1;if(e.providers){for(let o of e.providers)if(!_s(o))return!1}return!0},Ro=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ld=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var cd=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,}))$/),dd=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},Io=(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}`},As=e=>new Promise(t=>setTimeout(t,e));function pd(e,{interval:t=100,timeout:o=5e3}={}){return new Promise((r,n)=>{let i=0,a,l=()=>{if(i>=o){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){r(a);return}setTimeout(l,t)};l()})}var ud=(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 As(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},Ri=(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 ks=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),ir=e=>typeof e=="string"?e:"0x"+e.toString(16);async function md(e,t,o=3e3){let r=!1,n=window;return new Promise(i=>{n.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},o));function a(){if(r)return;r=!0,window.removeEventListener("ethereum#initialized",a);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of sd()){let u=ki(c);if(!l.some(h=>h.info.name===u)){if(_s(c,!0)&&!s.find(h=>h.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(h=>h.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}s.find(h=>h.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function Mr(e){return`eip155:${String(Number(e))}`}var Mt=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new q(`Unsupported chainId ${e}`,4901);let i;if(n.rpcUrls.privyWalletOverride&&n.rpcUrls.privyWalletOverride.http[0]?i=n.rpcUrls.privyWalletOverride.http[0]:o.rpcUrls&&o.rpcUrls[r]?i=o.rpcUrls[r]:n.rpcUrls.infura?.http[0]?i=n.rpcUrls.infura.http[0]+"/"+Ti:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+jc:i=n.rpcUrls.default?.http[0],!i)throw new q(`No RPC url found for ${e}`);return i},fd=(e,t)=>{let o=Number(e),r=t.find(n=>n.id===o);if(!r)throw new q(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url},Ii=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},o=Object.entries(e.domain).map(([r,n])=>{if(n!=null&&typeof r=="string"&&r in t)return{name:r,type:t[r]}}).filter(r=>r!==void 0);return{...e,types:{...e.types,EIP712Domain:o}}};import ty from"@coinbase/wallet-sdk";import{jsx as hd,jsxs as qh}from"react/jsx-runtime";var _n=({style:e,...t})=>qh("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:[hd("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),hd("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 Kt}from"@ethersproject/address";import{Web3Provider as Ed}from"@ethersproject/providers";import{default as Xh}from"eventemitter3";import{StaticJsonRpcProvider as gd}from"@ethersproject/providers";import Zh from"eventemitter3";var jh=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],yd=e=>jh.includes(e);import{ErrorCode as Kh}from"@ethersproject/logger";var Nr=class extends q{constructor(){super("Wallet timeout");this.type="wallet_error"}},Lr=class extends q{constructor(){super("User rejected connection");this.type="wallet_error"}},Nt=e=>{if(e instanceof q)return e;if(e?.code&&e?.reason){let t=new Le(e);return e.code===Kh.ACTION_REJECTED&&(t.details=tt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Le(e):new q("Unknown connector error",e)},qt=class extends Ne{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Le=class extends qt{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(tt).find(i=>i.eipCode===r.code);this.details=n||tt.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=tt.E32002_CONNECTION_ALREADY_PENDING:this.details=tt.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=tt.E32002_WALLET_LOCKED))}},Yh={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}},Jh={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Qh={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},tt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Qh,...Jh},ho={...Yh,...tt};var de=class{constructor(t,o){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new Nr,o=this.rpcTimeoutDuration)=>new Promise((r,n)=>setTimeout(()=>{n(t)},o));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.rpcTimeoutDuration=o||or,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 q(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(o=>{throw Nt(o)})}},Wo=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},Wi=class extends Zh{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 gd(Mt(a,this.chains,n)),this.rpcTimeoutDuration=Or(n,"privy")}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new Wo(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await _e()||!this.address)throw new Wo("Disconnected",4900);return(await Cd(r)).hash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new Wo(`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 Wo(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new gd(Mt(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 personal_sign");let r=o.params[0];return await vd(r)}async handleSignedTypedData(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_signTypedData_v4");let r=typeof o.params[1]=="string"?JSON.parse(o.params[1]):o.params[1];return await wd(Ii(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:ir(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 ir(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);case"eth_signTypedData_v4":return this.handleSignedTypedData(o);default:break}if(yd(o.method)){let r=await _e();if(await bd(),!r||!this.address)throw new Wo("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 Wo("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await _e();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}}},jt=class extends de{constructor(o){super(o,o.rpcTimeoutDuration)}},Mo=class extends de{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var ey=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},ot=class extends Xh{constructor(o,r,n,i){super();this.onAccountsChanged=o=>{o.length===0?this.onDisconnect():this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=Mr(o),this.walletClientType==="privy"&&re.put(_i(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.rpcConfig=i,this.rpcTimeoutDuration=Or(i,o),this.connected=!1,this.initialized=!1}buildConnectedWallet(o,r,n){let i=async()=>!!this.wallets.find(a=>Kt(a.address)===Kt(o));return{address:Kt(o),chainId:r,meta:n,switchChain:async a=>{if(!i)throw new q("Wallet is not currently connected.");let l=this.wallets.find(f=>Kt(f.address)===Kt(o))?.chainId;if(!l)throw new q("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===Mr(s))return;let u=this.chains.find(f=>f.id===c);if(!u)throw new q(`Unsupported chainId: ${a}`);let h=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await h()}catch(f){if(ey(f,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),h();throw this.walletClientType==="rainbow"&&f.message?.includes("wallet_switchEthereumChain")?new q(`Rainbow does not support the chainId ${r}`):f}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new q("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new q("Wallet is not currently connected.");return new Ed(new jt(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new q("Wallet is not currently connected.");return new Mo(this.proxyProvider)},sign:async a=>{if(!await i())throw new q("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;try{if(r===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(r=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let n=r[0],i=Kt(n),a=[],l;if(this.walletClientType==="privy"){let c=re.get(_i(i));this.chains.find(u=>u.id===Number(c))||(re.del(_i(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${Ps}`,c),l=Ps}let s=Mr(l);if(!a.find(c=>Kt(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet(Kt(n),s,c))}Mi(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=>Kt(n)===Kt(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 Ed(new jt(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 oy=e=>{let t=`https://mainnet.infura.io/v3/${Ti}`,o=1;return e.makeWeb3Provider(t,o)},Ni,Li=class extends ot{constructor(o,r,n){super("coinbase_wallet",o,r,n);this.connectorType="coinbase_wallet";this.proxyProvider=new de(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),Ni||(Ni=new ty({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(oy(Ni)),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(){Ni.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:_n,id:"com.coinbase.wallet"}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new q("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw Nt(o)}}};import{jsx as Td}from"react/jsx-runtime";var Oi=({...e})=>Td("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Td("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 Di=class extends ot{constructor(o,r,n,i){super("privy",r,n,i);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:[ir(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Oi,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Pd}from"react/jsx-runtime";var Dr=({style:e,...t})=>Pd("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Pd("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as lt,jsxs as ry}from"react/jsx-runtime";var Ur=({style:e,...t})=>ry("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:[lt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),lt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),lt("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"}),lt("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"}),lt("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"}),lt("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"}),lt("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"}),lt("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"}),lt("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"}),lt("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"}),lt("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"}),lt("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"}),lt("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as xd,jsxs as ny}from"react/jsx-runtime";var Yt=({style:e,...t})=>ny("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:[xd("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),xd("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 Br=class extends ot{constructor(o,r,n,i,a){super(a||"unknown",o,r,n);this.connectorType="injected";this.proxyProvider=new de(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l),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:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new q("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw Nt(o)}}},Fr,Hr=class extends ot{constructor(o,r,n,i,a){super(a??"unknown",o,r,n);this.connectorType="injected";gi(this,Fr,void 0);this.proxyProvider=new de(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0}),a==="metamask"?vs(this,Fr,{name:"MetaMask",icon:Ur,id:"io.metamask"}):a==="phantom"&&vs(this,Fr,{name:"Phantom",icon:Yt,id:"phantom"})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return yc(this,Fr)??{name:"Browser Extension",icon:Dr,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new q("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw Nt(o)}}};Fr=new WeakMap;import{getAddress as _T}from"@ethersproject/address";import{Web3Provider as kT}from"@ethersproject/providers";import{isMobile as iy}from"react-device-detect";var Ui=class extends Br{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{iy||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new q("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Nt(t)}}};var Fi=class extends ot{constructor(o,r){super(o,[],r,{});this.connectorType="null";this.proxyProvider=new de(void 0,or);this.connectorType=o}get walletBranding(){return{name:"Wallet",id:""}}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(o){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${o}`)}};var Bi=class extends Fi{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Yt,id:"phantom"}}};import{EthereumProvider as Ay,OPTIONAL_EVENTS as ky,OPTIONAL_METHODS as Ry}from"@walletconnect/ethereum-provider";import{isMobile as Iy}from"react-device-detect";import{createContext as wy,useContext as Cy,useEffect as Ms,useRef as by,useState as Ey}from"react";import{jsx as ay}from"react/jsx-runtime";function Hi({src:e,...t}){return ay("img",{src:e,...t,style:{display:"none"}})}import{useContext as Vd,useEffect as Gd,useMemo as hy,useState as yy}from"react";import{createContext as gy}from"react";var gt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Kc,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var sy=new Set(["metamask","coinbase_wallet","rainbow","zerion","phantom","wallet_connect","detected_wallets"]),ly=e=>sy.has(e),cy=(e,t,o)=>o.indexOf(e)===t,Sd=({input:e})=>e?e.filter(ly).filter(cy):gt.appearance.walletList;var Gi={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 Vi={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 zi={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var _d={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 Ad={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 $i={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 qi={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 ji={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var kd={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 Rd={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 Id={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 Wd={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 Md={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 Nd={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var Ld={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 Od={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 Ki={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 Yi={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 Ji={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 Qi={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var An={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var kn={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{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 Dd={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Ud={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 Zi={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var Xi={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var ea={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Rn=[Gi,Vi,zi,Md,Ud,Ki,Yi,Ji,Qi,An,kn,kd,Rd,Id,Wd,$i,qi,ji,Ld,Od,_d,Ad,Zi,ea,Xi,Nd,Dd],KP=new Set(Rn.map(e=>e.id));import ar from"tinycolor2";var Fd="#FFFFFF",dy="#000000",py=Fd,uy="#1E1E1D";function my(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 No(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return ar({...e.toHsl(),l:o})}function Bd({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=Fd,blackHex:a=dy}){let l;switch(e){case"light":l=py;break;case"dark":l=uy;break;default:l=e;break}let s=ar(l),c=ar(t),u=ar(o),h=ar(r),f=ar(n),g=my(s.getLuminance()),C=No(s,g==="light"?-.04:.11),b=No(s,g==="light"?-.88:.87),x=No(s,g==="light"?-.77:.75),E=No(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),T=No(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),N=No(c,.15),k=No(c,-.06),M=ar(c.getLuminance()>.5?a:i),L=No(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:C.toHslString(),foreground:b.toHslString(),foreground2:x.toHslString(),foreground3:E.toHslString(),foreground4:T.toHslString(),accent:c.toHslString(),accentLight:N.toHslString(),accentDark:k.toHslString(),foregroundAccent:M.toHslString(),success:u.toHslString(),successDark:L.toHslString(),error:f.toHslString(),warn:h.toHslString()}}function Rs(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple","farcaster"],r=t?.loginMethods?.filter(G=>o.includes(G)),n,i,a,l,s,c,u,h,f,g,C;t?.loginMethods?(n=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),a=t.loginMethods.includes("wallet"),l=r?.includes("google"),s=r?.includes("twitter"),c=r?.includes("discord"),u=r?.includes("tiktok"),f=r?.includes("github"),h=r?.includes("linkedin"),g=r?.includes("apple"),C=r?.includes("farcaster")):(n=e.emailAuth,i=e.smsAuth,a=e.walletAuth,l=e.googleOAuth,s=e.twitterOAuth,c=e.discordOAuth,f=e.githubOAuth,u=e.tiktokOAuth,h=e.linkedinOAuth,g=e.appleOAuth,C=e.farcasterAuth);let b=[n,i].filter(Boolean),x=[l,s,c,f,u,h,g,C].filter(Boolean),E=[a].filter(Boolean);if(b.length+x.length+E.length===0)throw new Error("You must enable at least one login method");let T=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;T&&E.length===0?(console.warn("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),T=!1):!T&&x.length+b.length===0&&(console.warn("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),T=!0);let N=Sd({isWalletLoginEnabled:a,input:t?.appearance?.walletList}),k=t?.intl?.defaultCountry??"US",{chains:M,defaultChain:L}=fy({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),I=!!t?.defaultChain||!!t?.supportedChains,F=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,z,X=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?F?z=t?.embeddedWallets?.noPromptOnSignature??!0:z=t?.embeddedWallets?.noPromptOnSignature??X:z=X,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&z!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:Bd({backgroundTheme:t?.appearance?.theme??gt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??gt.appearance.accentColor}),loginGroupPriority:T?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:N},loginMethods:{wallet:a,email:n,sms:i,google:l,twitter:s,discord:c,github:f,tiktok:u,linkedin:h,apple:g,farcaster:C},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??gt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??gt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??gt.rpcConfig.rpcTimeouts},chains:M,defaultChain:L,intl:{defaultCountry:k},shouldEnforceDefaultChainOnConnect:I,captchaEnabled:e.captchaEnabled??gt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...F?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:z},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:F?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??gt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??gt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??gt._render.inParentNodeId}}}function Hd(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:o,additionalChains:r,supportedChains:n,defaultChain:i,...a}=e;return{...a,...r?{additionalChains:r.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,...o?{...o,...o.logo&&typeof o.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function fy({additionalChains:e,supportedChains:t,defaultChainFromConfig:o,hasRpcConfigDefined:r}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&r&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:Rn.find(u=>u.id===s.id)??s)}else n=Rn.concat(e??[]);let i=t?n[0]:Ki,a=o??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}import{jsx as vy}from"react/jsx-runtime";var zd={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},Is=Rs(zd),Ws=gy({appConfig:Is,isServerConfigLoaded:!1}),$d=({children:e,legacyCreateEmbeddedWalletFlag:t,client:o,clientConfig:r})=>{let[n,i]=yy(null),a=hy(()=>Rs(n??zd,r),[n,r]);return Gd(()=>{let l=Hd(r,t);o.createAnalyticsEvent("sdk_initialize",l)},[r,t]),Gd(()=>{n||(async()=>{try{let s=await o.getServerConfig();s.customApiUrl&&o.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),vy(Ws.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},ta=()=>{let{appConfig:e}=Vd(Ws);return e},qd=()=>{let{isServerConfigLoaded:e}=Vd(Ws);return e};var P=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Py,jsxs as xy}from"react/jsx-runtime";var jd=wy({ready:!1,app:Is,currentScreen:null,lastScreen:null,navigate:P,navigateBack:P,resetNavigation:P,setModalData:P,onUserCloseViaDialogOrKeybindRef:void 0}),Ty=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Kd=e=>{let t=ta(),o=e.authenticated,[r,n]=Ey(e.initialScreen);Ms(()=>{!o&&!Ty.includes(e.initialScreen)&&e.setInitialScreen(null)},[o]);let i=by(null);Ms(()=>{e.open||(i.current=null)},[e.open]),Ms(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:r,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(r)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return xy(jd.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Py(Hi,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>Cy(jd);import{jsx as Gr,jsxs as Sy}from"react/jsx-runtime";var In=({style:e,...t})=>{let{app:o}=_();return Sy("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:[Gr("rect",{width:"28",height:"28",rx:"3",fill:o?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Gr("g",{clipPath:"url(#clip0_1765_9946)",children:Gr("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"})}),Gr("defs",{children:Gr("clipPath",{id:"clip0_1765_9946",children:Gr("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var oa=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(Vr))if(t.includes(r.hostname))return{walletClientType:o,entry:r}};var Vr={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}}};function _y(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var Yd=e=>e in Vr,Jd=e=>{let t=Vr[e].mobile;if("native"in t)return t.native};function Qd(e,t){let o=_y(t);if(o.deepLink)return op(o.deepLink,e);if(o.universalLink)return rp(o.universalLink,e);throw new w(`Unsupported wallet ${t.id}`)}var Zd="WALLETCONNECT_DEEPLINK_CHOICE";function Xd(){try{localStorage.removeItem(Zd)}catch{}}function ep({href:e,name:t}){try{localStorage.setItem(Zd,JSON.stringify({href:e,name:t}))}catch{}}function tp(e){return e.startsWith("http://")||e.startsWith("https://")}function op(e,t){if(tp(e))return rp(e,t);let o=e;o.includes("://")||(o=e.replaceAll("/","").replaceAll(":",""),o=`${o}://`),o.endsWith("/")||(o=`${o}/`);let r=encodeURIComponent(t);return{redirect:`${o}wc?uri=${r}`,href:o}}function rp(e,t){if(!tp(e))return op(e,t);let o=e;o.endsWith("/")||(o=`${o}/`);let r=encodeURIComponent(t);return{redirect:`${o}wc?uri=${r}`,href:o}}function np(e,t){window.open(e,t,"noreferrer noopener")}var Jt=class extends ot{constructor(o,r,n,i,a,l){super(l||"unknown",n,i,r);this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new de(void 0,this.rpcTimeoutDuration),l&&(this.walletEntry=Vr[l],this.walletClientType=l),this.createProvider().then(s=>{if(this.provider=s,this.proxyProvider.setWalletProvider(s),this.subscribeListeners(),s.session){if(this.walletProvider?.session?.peer.metadata.url){let c=oa(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=c?.entry,this.walletClientType=c?.walletClientType||"unknown"}this.connected=!0,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}else this.emit("initialized"),this.initialized=!0}),import("@walletconnect/modal").then(({WalletConnectModal:s})=>{this.modal=new s({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(c=>{!c.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})})}async connect(o){return o.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:Ur,id:"io.metamask"}:{name:ks(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||In,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(o){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Vr[o],this.walletClientType=o,this.redirectUri=void 0,Xd(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new Lr)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new q("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=oa(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Or(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),o()})().catch(a=>{if(a){r(Nt(a));return}r(new q("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){let o={};for(let a of this.chains){let l=Mt(a.id,this.chains,this.rpcConfig);l&&(o[a.id]=l)}let r=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await Ay.init({projectId:this.walletConnectCloudProjectId,chains:r,optionalChains:n,optionalEvents:ky,optionalMethods:Ry,rpcMap:o,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),Iy&&this.walletEntry){let{redirect:l,href:s}=Qd(a,this.walletEntry);ep({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,np(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=oa(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var Ns=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===ip(t)).length:!1},Or=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||or:or,Wn=class extends Wy{constructor(o,r,n,i,a,l,s){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 de:r.proxyProvider};this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=a,this.walletList=l,this.shouldEnforceDefaultChainOnConnect=s,this.initializedWalletConnectors=0,this.walletsReady=!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}async initialize(){if(this.initialized)return;re.get(Es)&&(re.getKeys().forEach(r=>{r.startsWith("walletconnect")&&re.del(r)}),re.del(Es));let o=md(this.store,this.walletList).then(r=>{r.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Ro()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await o,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"),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length}onWalletsUpdated(o){o.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(o,r,n){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=o;else{let a=new Wi(o,r,this.rpcConfig,this.chains,n.id),l=new Di(a,this.chains,n,this.rpcConfig);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.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(o,r,n){let i=this.findWalletConnector(o,r);if(i)return i instanceof Jt&&i.resetConnection(r),i;let l=(()=>{if(o==="injected"){if(r==="metamask"&&n?.eip6963InjectedProvider)return new Ui(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(r==="metamask"&&n?.legacyInjectedProvider)return new Hr(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(r==="phantom"&&n?.legacyInjectedProvider)return new Hr(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&r==="unknown_browser_extension")return new Hr(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Br(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,r)}else return o==="coinbase_wallet"?new Li(this.chains,this.defaultChain,this.rpcConfig):o==="phantom"?new Bi(this.defaultChain):new Jt(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,r)})();return l&&this.addWalletConnector(l),l||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=re.get(Ts);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}));re.put(Ts,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=ip(o),this.emit("walletsUpdated")}};function Mi(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 My}from"ofetch";var Ny=[Ci(),Ei(),bi()],ra=class{constructor(t,o,r){this.appId=t,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=ws,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=My.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!Ny.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new vi}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw ie(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw ie(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw ie(r)}}};import sr from"js-cookie";function ap(e){return e instanceof er?"email":e instanceof nr?"sms":e instanceof rr?"siwe":e instanceof kr?"custom_auth":e instanceof ko?e.meta.provider:null}import*as sp from"jose";var Qt=class{static parse(t){try{return new Qt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=sp.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 Ly=30,na=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=re.get(tr);return typeof t=="string"?new Qt(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=re.get(xi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=re.get(xn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=sr.get(Si);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=Qt.parse(this.token);return t!==null&&!t.isExpired(Ly)}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=ap(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:st(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),Ge(o)}}async _link(t){try{let o=await t.link();return st(o)}catch(o){throw console.warn("Error linking account"),Ge(o)}}async _refresh(){if(!this.api)throw new w("Session has no API instance");if(!this.client)throw new w("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(Ci(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(Ei(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),st(n.user)}catch(n){if(n instanceof zt&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Ge(n)}}async _destroy(){try{await this.api?.post(bi(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new w("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(vc(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw Ge(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let o=re.get(tr);if(re.put(tr,t),o!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let r=Qt.parse(t)?.expiration;sr.set(Cs,t,{sameSite:"Strict",secure:!0,expires:r?new Date(r*1e3):void 0})}}else re.del(tr),sr.remove(Cs)}storeRefreshToken(t){typeof t=="string"?(re.put(xi,t),this.client?.useServerCookies||(sr.set(Si,"t",{sameSite:"Strict",secure:!0,expires:30}),sr.set(bs,t,{sameSite:"Strict",secure:!0,expires:30}))):(re.del(xi),sr.remove(bs),sr.remove(Si))}clearForkedToken(){re.del(xn)}};var Ls,ia,lp,Mn=class{constructor(t){gi(this,ia);this.apiUrl=t.apiUrl||Pi,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Yc,this.appId=t.appId,this.clientAnalyticsId=gc(this,ia,lp).call(this),Ls||(Ls=new na),this.session=Ls,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r,n,i,a,l){this.connectors||(this.connectors=new Wn(t,o,r,n,i,a,l))}generateApi(){let t=new ra(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new w("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new w("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}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let o=await this.api.post(Oc(),{address:t});return st(o)}catch(o){throw Ge(o)}}async acceptTerms(){try{let t=await this.api.post($c(),{});return st(t)}catch(t){throw Ge(t)}}async unlinkPhone(t){try{let o=await this.api.post(Dc(),{phoneNumber:t});return st(o)}catch(o){throw Ge(o)}}async unlinkWallet(t){try{let o=await this.api.post(Lc(),{address:t});return st(o)}catch(o){throw Ge(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(Uc(),{provider:t,subject:o});return st(r)}catch(r){throw Ge(r)}}async unlinkFarcaster(t){try{let o=await this.api.post(Fc(),{fid:t});return st(o)}catch(o){throw Ge(o)}}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(Bc(),{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(Hc(),t)}catch(o){throw Ge(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Qt.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,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw Ge(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()}};ia=new WeakSet,lp=function(){if(typeof window>"u")return null;try{let o=re.get(Sn);if(typeof o=="string"&&o.length>0)return o}catch{}let t=Oy();try{return re.put(Sn,t),t}catch{return t}};import{Turnstile as Gy}from"@marsidev/react-turnstile";import{useEffect as Vy,useMemo as zy}from"react";import{useMemo as Dy,useRef as Uy,useContext as Fy,useState as Os,createContext as By}from"react";import{jsx as Hy}from"react/jsx-runtime";var cp=By({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:P,setError:P,setExecuting:P,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:P,reset:P,execute:P}),yo=class extends Ne{constructor(o,r,n){super(o||"Captcha failed");this.type="Captcha";r instanceof Error&&(this.cause=r),this.privyErrorCode=n}},dp=({children:e,id:t,captchaSiteKey:o,captchaEnabled:r})=>{let n=Uy(null),[i,a]=Os(),[l,s]=Os(),[c,u]=Os(!1),h=Dy(()=>r?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[r,i,l,c]);return Hy(cp.Provider,{value:{...h,ref:n,enabled:r,siteKey:o,appId:t,setToken:a,setError:s,setExecuting:u,remove(){r&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){r&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){r&&(u(!0),n.current?.execute())},async waitForResult(){if(!r)return"";try{return await pd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new yo("Captcha failed",null,"captcha_timeout")}}},children:e})},ue=()=>Fy(cp);import{jsx as pp}from"react/jsx-runtime";var Ds=e=>{let{enabled:t,siteKey:o,appId:r,setError:n,setToken:i,setExecuting:a,ref:l}=ue(),[,s]=zy(()=>o?.split("t:")||[],[o]);if(Vy(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return pp("div",{className:"hidden h-0 w-0",children:pp(Gy,{...e,ref:l,siteKey:s,options:{action:r,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as qE,useEffect as bh,useRef as jE,useState as KE}from"react";import YE from"react-dom";import{createContext as $y,useContext as qy}from"react";var Us=$y({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,nativeTokenSymbolForChainId:P,initializeWalletProxy:P,getAuthMeta:P,getAuthFlow:P,closePrivyModal:P,openPrivyModal:P,connectWallet:P,initLoginWithWallet:P,loginWithWallet:P,initLoginWithFarcaster:P,loginWithFarcaster:P,loginWithCode:P,initLoginWithEmail:P,initLoginWithSms:P,resendEmailCode:P,resendSmsCode:P,initLoginWithOAuth:P,loginWithOAuth:P,refreshUser:P,walletProxy:null,createAnalyticsEvent:P,acceptTerms:P,getUsdTokenPrice:P,recoverEmbeddedWallet:P,getFiatOnRampConfig:P,updateWallets:P,setReadyToTrue:P}),R=()=>qy(Us);import{createContext as jy,useContext as Ky}from"react";var he=jy({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:P,login:P,linkEmail:P,linkPhone:P,linkFarcaster:P,linkWallet:P,linkGoogle:P,linkTwitter:P,linkDiscord:P,linkGithub:P,linkTiktok:P,linkLinkedIn:P,linkApple:P,logout:P,getAccessToken:P,getEthereumProvider:P,getEthersProvider:P,getWeb3jsProvider:P,unlinkEmail:P,unlinkPhone:P,unlinkWallet:P,unlinkGoogle:P,unlinkTwitter:P,unlinkDiscord:P,unlinkGithub:P,unlinkTiktok:P,unlinkLinkedIn:P,unlinkApple:P,unlinkFarcaster:P,setActiveWallet:P,forkSession:P,createWallet:P,signMessage:P,signTypedData:P,enrollInMfa:P,initEnrollmentWithSms:P,initEnrollmentWithTotp:P,promptMfa:P,init:P,submitEnrollmentWithSms:P,submitEnrollmentWithTotp:P,unenroll:P,submit:P,cancel:P,sendTransaction:P,exportWallet:P,setWalletPassword:P,initLoginWithEmail:P,initLoginWithSms:P,loginWithCode:P,isModalOpen:!1}),B=()=>Ky(he);import{useEffect as Yy,useState as Jy}from"react";var up=e=>{let[t,o]=Jy("auto");return Yy(()=>{let r=new ResizeObserver(n=>{o(n[0]?.contentRect.height??"auto")});return e.current&&r.observe(e.current),()=>{e.current&&r.unobserve(e.current)}},[e.current]),t};import{createContext as Qy,useContext as Zy,useEffect as Xy}from"react";var mp={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},Fs=Qy(void 0),fp=()=>Zy(Fs);function rt(e,t){if(!t)return;let r=fp().current[e];return Xy(()=>{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 te(e,t,o,...r){for(let n of e.current[t][o])n(...r)}function hp(){let e=fp();return(t,o,...r)=>te(e,t,o,...r)}function Bs(e){rt("configureMfa",e)}import xp from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import fg from"@heroicons/react/24/solid/DocumentCheckIcon";import hg from"styled-components";import cr,{css as zs}from"styled-components";import Gs from"styled-components";import{Fragment as tg,jsx as Hs,jsxs as og}from"react/jsx-runtime";var Lo=({success:e,fail:t})=>og(tg,{children:[Hs(vt,{className:e?"success":t?"fail":""}),Hs(Vs,{className:e?"success":t?"fail":""})]}),vt=Gs.span`
12
+ - https://privy.io`;this.getNonceOnce=new qe(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=o}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(bc(),{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 ie(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(Ec(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ie(t)}}async sign(){if(!this.api)throw new w("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new w("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 w("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Cc(),{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new w("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 ir=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=Ic(),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 ie(t)}}async link(){if(!this.api)throw new w("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new w("phone number and sms code must be set prior to calling authenticate.");try{let t=Wc();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ie(t)}}async sendSmsCode(t,o){if(!this.api)throw new w("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new w("phone nNumber must be set when initialzing authentication.");try{let r=Rc();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw ie(r)}}};import{v4 as Oy}from"uuid";function ot(e){return new Date(e*1e3)}function zh(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:ot(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:ot(o.verified_at)};t.push(i);break;case"phone":let a={number:o.phoneNumber,type:o.type,verifiedAt:ot(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:ot(o.verified_at)};t.push(l);break;case"twitter_oauth":let s={subject:o.subject,username:o.username,name:o.name,type:o.type,profilePictureUrl:o.profile_picture_url,verifiedAt:ot(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:ot(o.verified_at)};t.push(c);break;case"github_oauth":let u={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:ot(o.verified_at)};t.push(u);break;case"tiktok_oauth":let h={subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:ot(o.verified_at)};t.push(h);break;case"linkedin_oauth":let f={subject:o.subject,name:o.name,email:o.email,type:o.type,verifiedAt:ot(o.verified_at)};t.push(f);break;case"apple_oauth":let g={subject:o.subject,email:o.email,type:o.type,verifiedAt:ot(o.verified_at)};t.push(g);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:ot(o.verified_at)});break;case"farcaster":let C={type:o.type,fid:o.fid,ownerAddress:o.owner_address,displayName:o.display_name,username:o.username,bio:o.bio,pfp:o.profile_picture_url,url:o.homepage_url,verifiedAt:ot(o.verified_at)};t.push(C);break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function Mt(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var de=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,$h=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),yt=(e,t)=>t==="all-users"&&!de(e)||t==="users-without-wallets"&&!$h(e)?.length;function lt(e){if(!e)return null;let t=zh(e.linked_accounts),o=Mt(t,"wallet"),r=Mt(t,"email"),n=Mt(t,"phone"),i=Mt(t,"google_oauth"),a=Mt(t,"twitter_oauth"),l=Mt(t,"discord_oauth"),s=Mt(t,"github_oauth"),c=Mt(t,"tiktok_oauth"),u=Mt(t,"linkedin_oauth"),h=Mt(t,"apple_oauth"),f=Mt(t,"farcaster"),g=e.mfa_methods.map(({type:b,verified_at:x})=>({type:b,verifiedAt:ot(x)}));return{id:e.id,createdAt:ot(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,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},tiktok:c&&{subject:c.subject,username:c.username,name:c.name},linkedin:u&&{subject:u.subject,name:u.name,email:u.email},apple:h&&{subject:h.subject,email:h.email},farcaster:f&&{fid:f.fid,ownerAddress:f.ownerAddress,displayName:f.displayName,username:f.username,bio:f.bio,pfp:f.pfp,url:f.url},mfaMethods:g.map(b=>b.type),hasAcceptedTerms:e.has_accepted_terms??!1}}import{getAddress as ap}from"@ethersproject/address";import Wy from"eventemitter3";function ld(){let e=window,t=e.ethereum;if(!t)return[];let o=[];if(t.providers?.length)for(let r of t.providers)r&&o.push(r);return o.push(e.ethereum),o}var Ri=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var As=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ri(e)!=="MetaMask")return!1;if(e.providers){for(let o of e.providers)if(!As(o))return!1}return!0},Io=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),cd=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var dd=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,}))$/),pd=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},Wo=(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}`},ks=e=>new Promise(t=>setTimeout(t,e));function ud(e,{interval:t=100,timeout:o=5e3}={}){return new Promise((r,n)=>{let i=0,a,l=()=>{if(i>=o){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){r(a);return}setTimeout(l,t)};l()})}var md=(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 ks(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},Ii=(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 Rs=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),ar=e=>typeof e=="string"?e:"0x"+e.toString(16);async function fd(e,t,o=3e3){let r=!1,n=window;return new Promise(i=>{n.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},o));function a(){if(r)return;r=!0,window.removeEventListener("ethereum#initialized",a);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of ld()){let u=Ri(c);if(!l.some(h=>h.info.name===u)){if(As(c,!0)&&!s.find(h=>h.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(h=>h.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}s.find(h=>h.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function Nr(e){return`eip155:${String(Number(e))}`}var Nt=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new j(`Unsupported chainId ${e}`,4901);let i;if(n.rpcUrls.privyWalletOverride&&n.rpcUrls.privyWalletOverride.http[0]?i=n.rpcUrls.privyWalletOverride.http[0]:o.rpcUrls&&o.rpcUrls[r]?i=o.rpcUrls[r]:n.rpcUrls.infura?.http[0]?i=n.rpcUrls.infura.http[0]+"/"+Pi:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+Kc:i=n.rpcUrls.default?.http[0],!i)throw new j(`No RPC url found for ${e}`);return i},hd=(e,t)=>{let o=Number(e),r=t.find(n=>n.id===o);if(!r)throw new j(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url},Wi=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},o=Object.entries(e.domain).map(([r,n])=>{if(n!=null&&typeof r=="string"&&r in t)return{name:r,type:t[r]}}).filter(r=>r!==void 0);return{...e,types:{...e.types,EIP712Domain:o}}};import ty from"@coinbase/wallet-sdk";import{jsx as yd,jsxs as qh}from"react/jsx-runtime";var An=({style:e,...t})=>qh("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:[yd("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),yd("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 Yt}from"@ethersproject/address";import{Web3Provider as Td}from"@ethersproject/providers";import{default as Xh}from"eventemitter3";import{StaticJsonRpcProvider as vd}from"@ethersproject/providers";import Zh from"eventemitter3";var jh=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],gd=e=>jh.includes(e);import{ErrorCode as Kh}from"@ethersproject/logger";var Lr=class extends j{constructor(){super("Wallet timeout");this.type="wallet_error"}},Or=class extends j{constructor(){super("User rejected connection");this.type="wallet_error"}},Lt=e=>{if(e instanceof j)return e;if(e?.code&&e?.reason){let t=new Oe(e);return e.code===Kh.ACTION_REJECTED&&(t.details=rt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Oe(e):new j("Unknown connector error",e)},jt=class extends Le{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Oe=class extends jt{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(rt).find(i=>i.eipCode===r.code);this.details=n||rt.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=rt.E32002_CONNECTION_ALREADY_PENDING:this.details=rt.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=rt.E32002_WALLET_LOCKED))}},Yh={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}},Jh={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},Qh={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}},rt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Qh,...Jh},go={...Yh,...rt};var pe=class{constructor(t,o){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new Lr,o=this.rpcTimeoutDuration)=>new Promise((r,n)=>setTimeout(()=>{n(t)},o));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.rpcTimeoutDuration=o||rr,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 j(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(o=>{throw Lt(o)})}},Mo=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},Mi=class extends Zh{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 vd(Nt(a,this.chains,n)),this.rpcTimeoutDuration=Dr(n,"privy")}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new Mo(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await Ae()||!this.address)throw new Mo("Disconnected",4900);return(await bd(r)).hash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new Mo(`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 Mo(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new vd(Nt(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 personal_sign");let r=o.params[0];return await wd(r)}async handleSignedTypedData(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_signTypedData_v4");let r=typeof o.params[1]=="string"?JSON.parse(o.params[1]):o.params[1];return await Cd(Wi(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:ar(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 ar(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);case"eth_signTypedData_v4":return this.handleSignedTypedData(o);default:break}if(gd(o.method)){let r=await Ae();if(await Ed(),!r||!this.address)throw new Mo("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 Mo("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await Ae();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}}},Kt=class extends pe{constructor(o){super(o,o.rpcTimeoutDuration)}},No=class extends pe{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var ey=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},nt=class extends Xh{constructor(o,r,n,i){super();this.onAccountsChanged=o=>{o.length===0?this.onDisconnect():this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=Nr(o),this.walletClientType==="privy"&&re.put(Ai(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.rpcConfig=i,this.rpcTimeoutDuration=Dr(i,o),this.connected=!1,this.initialized=!1}buildConnectedWallet(o,r,n){let i=async()=>!!this.wallets.find(a=>Yt(a.address)===Yt(o));return{address:Yt(o),chainId:r,meta:n,switchChain:async a=>{if(!i)throw new j("Wallet is not currently connected.");let l=this.wallets.find(f=>Yt(f.address)===Yt(o))?.chainId;if(!l)throw new j("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===Nr(s))return;let u=this.chains.find(f=>f.id===c);if(!u)throw new j(`Unsupported chainId: ${a}`);let h=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await h()}catch(f){if(ey(f,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),h();throw this.walletClientType==="rainbow"&&f.message?.includes("wallet_switchEthereumChain")?new j(`Rainbow does not support the chainId ${r}`):f}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new j("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new j("Wallet is not currently connected.");return new Td(new Kt(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new j("Wallet is not currently connected.");return new No(this.proxyProvider)},sign:async a=>{if(!await i())throw new j("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;try{if(r===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(r=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let n=r[0],i=Yt(n),a=[],l;if(this.walletClientType==="privy"){let c=re.get(Ai(i));this.chains.find(u=>u.id===Number(c))||(re.del(Ai(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${xs}`,c),l=xs}let s=Nr(l);if(!a.find(c=>Yt(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet(Yt(n),s,c))}Ni(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=>Yt(n)===Yt(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 Td(new Kt(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 oy=e=>{let t=`https://mainnet.infura.io/v3/${Pi}`,o=1;return e.makeWeb3Provider(t,o)},Li,Oi=class extends nt{constructor(o,r,n){super("coinbase_wallet",o,r,n);this.connectorType="coinbase_wallet";this.proxyProvider=new pe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),Li||(Li=new ty({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(oy(Li)),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(){Li.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:An,id:"com.coinbase.wallet"}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new j("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw Lt(o)}}};import{jsx as Pd}from"react/jsx-runtime";var Di=({...e})=>Pd("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:Pd("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 Ui=class extends nt{constructor(o,r,n,i){super("privy",r,n,i);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:[ar(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Di,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as xd}from"react/jsx-runtime";var Ur=({style:e,...t})=>xd("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:xd("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});import{jsx as ct,jsxs as ry}from"react/jsx-runtime";var Fr=({style:e,...t})=>ry("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:[ct("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),ct("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),ct("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"}),ct("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"}),ct("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"}),ct("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"}),ct("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"}),ct("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"}),ct("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"}),ct("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"}),ct("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"}),ct("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"}),ct("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});import{jsx as Sd,jsxs as ny}from"react/jsx-runtime";var Jt=({style:e,...t})=>ny("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:[Sd("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Sd("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 Hr=class extends nt{constructor(o,r,n,i,a){super(a||"unknown",o,r,n);this.connectorType="injected";this.proxyProvider=new pe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l),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:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new j("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw Lt(o)}}},Br,Gr=class extends nt{constructor(o,r,n,i,a){super(a??"unknown",o,r,n);this.connectorType="injected";vi(this,Br,void 0);this.proxyProvider=new pe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0}),a==="metamask"?ws(this,Br,{name:"MetaMask",icon:Fr,id:"io.metamask"}):a==="phantom"&&ws(this,Br,{name:"Phantom",icon:Jt,id:"phantom"})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return gc(this,Br)??{name:"Browser Extension",icon:Ur,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new j("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw Lt(o)}}};Br=new WeakMap;import{getAddress as M3}from"@ethersproject/address";import{Web3Provider as L3}from"@ethersproject/providers";import{isMobile as iy}from"react-device-detect";var Fi=class extends Hr{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{iy||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new j("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Lt(t)}}};var Bi=class extends nt{constructor(o,r){super(o,[],r,{});this.connectorType="null";this.proxyProvider=new pe(void 0,rr);this.connectorType=o}get walletBranding(){return{name:"Wallet",id:""}}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(o){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${o}`)}};var Hi=class extends Bi{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Jt,id:"phantom"}}};import{EthereumProvider as Ay,OPTIONAL_EVENTS as ky,OPTIONAL_METHODS as Ry}from"@walletconnect/ethereum-provider";import{isMobile as Iy}from"react-device-detect";import{createContext as wy,useContext as Cy,useEffect as Ns,useRef as by,useState as Ey}from"react";import{jsx as ay}from"react/jsx-runtime";function Gi({src:e,...t}){return ay("img",{src:e,...t,style:{display:"none"}})}import{useContext as zd,useEffect as Vd,useMemo as hy,useState as yy}from"react";import{createContext as gy}from"react";var gt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Yc,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var sy=new Set(["metamask","coinbase_wallet","rainbow","zerion","phantom","wallet_connect","detected_wallets"]),ly=e=>sy.has(e),cy=(e,t,o)=>o.indexOf(e)===t,_d=({input:e})=>e?e.filter(ly).filter(cy):gt.appearance.walletList;var Vi={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 zi={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 $i={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var Ad={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 kd={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 qi={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 ji={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 Ki={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var Rd={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 Id={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 Wd={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 Md={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 Nd={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 Ld={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var Od={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 Dd={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 Ji={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 Qi={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 Zi={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var kn={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 Rn={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 Ud={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Fd={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 Xi={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var ea={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var ta={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var In=[Vi,zi,$i,Nd,Fd,Yi,Ji,Qi,Zi,kn,Rn,Rd,Id,Wd,Md,qi,ji,Ki,Od,Dd,Ad,kd,Xi,ta,ea,Ld,Ud],ex=new Set(In.map(e=>e.id));import sr from"tinycolor2";var Bd="#FFFFFF",dy="#000000",py=Bd,uy="#1E1E1D";function my(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 Lo(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return sr({...e.toHsl(),l:o})}function Hd({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=Bd,blackHex:a=dy}){let l;switch(e){case"light":l=py;break;case"dark":l=uy;break;default:l=e;break}let s=sr(l),c=sr(t),u=sr(o),h=sr(r),f=sr(n),g=my(s.getLuminance()),C=Lo(s,g==="light"?-.04:.11),b=Lo(s,g==="light"?-.88:.87),x=Lo(s,g==="light"?-.77:.75),E=Lo(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),T=Lo(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),L=Lo(c,.15),R=Lo(c,-.06),N=sr(c.getLuminance()>.5?a:i),O=Lo(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:C.toHslString(),foreground:b.toHslString(),foreground2:x.toHslString(),foreground3:E.toHslString(),foreground4:T.toHslString(),accent:c.toHslString(),accentLight:L.toHslString(),accentDark:R.toHslString(),foregroundAccent:N.toHslString(),success:u.toHslString(),successDark:O.toHslString(),error:f.toHslString(),warn:h.toHslString()}}function Is(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple","farcaster"],r=t?.loginMethods?.filter(V=>o.includes(V)),n,i,a,l,s,c,u,h,f,g,C;t?.loginMethods?(n=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),a=t.loginMethods.includes("wallet"),l=r?.includes("google"),s=r?.includes("twitter"),c=r?.includes("discord"),u=r?.includes("tiktok"),f=r?.includes("github"),h=r?.includes("linkedin"),g=r?.includes("apple"),C=r?.includes("farcaster")):(n=e.emailAuth,i=e.smsAuth,a=e.walletAuth,l=e.googleOAuth,s=e.twitterOAuth,c=e.discordOAuth,f=e.githubOAuth,u=e.tiktokOAuth,h=e.linkedinOAuth,g=e.appleOAuth,C=e.farcasterAuth);let b=[n,i].filter(Boolean),x=[l,s,c,f,u,h,g,C].filter(Boolean),E=[a].filter(Boolean);if(b.length+x.length+E.length===0)throw new Error("You must enable at least one login method");let T=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;T&&E.length===0?(console.warn("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),T=!1):!T&&x.length+b.length===0&&(console.warn("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),T=!0);let L=_d({isWalletLoginEnabled:a,input:t?.appearance?.walletList}),R=t?.intl?.defaultCountry??"US",{chains:N,defaultChain:O}=fy({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),W=!!t?.defaultChain||!!t?.supportedChains,B=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,$,ee=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?B?$=t?.embeddedWallets?.noPromptOnSignature??!0:$=t?.embeddedWallets?.noPromptOnSignature??ee:$=ee,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&$!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:Hd({backgroundTheme:t?.appearance?.theme??gt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??gt.appearance.accentColor}),loginGroupPriority:T?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:L},loginMethods:{wallet:a,email:n,sms:i,google:l,twitter:s,discord:c,github:f,tiktok:u,linkedin:h,apple:g,farcaster:C},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??gt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??gt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??gt.rpcConfig.rpcTimeouts},chains:N,defaultChain:O,intl:{defaultCountry:R},shouldEnforceDefaultChainOnConnect:W,captchaEnabled:e.captchaEnabled??gt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...B?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:$},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:B?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??gt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??gt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??gt._render.inParentNodeId}}}function Gd(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:o,additionalChains:r,supportedChains:n,defaultChain:i,...a}=e;return{...a,...r?{additionalChains:r.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,...o?{...o,...o.logo&&typeof o.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function fy({additionalChains:e,supportedChains:t,defaultChainFromConfig:o,hasRpcConfigDefined:r}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&r&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:In.find(u=>u.id===s.id)??s)}else n=In.concat(e??[]);let i=t?n[0]:Yi,a=o??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}import{jsx as vy}from"react/jsx-runtime";var $d={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},Ws=Is($d),Ms=gy({appConfig:Ws,isServerConfigLoaded:!1}),qd=({children:e,legacyCreateEmbeddedWalletFlag:t,client:o,clientConfig:r})=>{let[n,i]=yy(null),a=hy(()=>Is(n??$d,r),[n,r]);return Vd(()=>{let l=Gd(r,t);o.createAnalyticsEvent("sdk_initialize",l)},[r,t]),Vd(()=>{n||(async()=>{try{let s=await o.getServerConfig();s.customApiUrl&&o.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),vy(Ms.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},oa=()=>{let{appConfig:e}=zd(Ms);return e},jd=()=>{let{isServerConfigLoaded:e}=zd(Ms);return e};var P=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as Py,jsxs as xy}from"react/jsx-runtime";var Kd=wy({ready:!1,app:Ws,currentScreen:null,lastScreen:null,navigate:P,navigateBack:P,resetNavigation:P,setModalData:P,onUserCloseViaDialogOrKeybindRef:void 0}),Ty=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Yd=e=>{let t=oa(),o=e.authenticated,[r,n]=Ey(e.initialScreen);Ns(()=>{!o&&!Ty.includes(e.initialScreen)&&e.setInitialScreen(null)},[o]);let i=by(null);Ns(()=>{e.open||(i.current=null)},[e.open]),Ns(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:r,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(r)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return xy(Kd.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&Py(Gi,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>Cy(Kd);import{jsx as Vr,jsxs as Sy}from"react/jsx-runtime";var Wn=({style:e,...t})=>{let{app:o}=_();return Sy("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:[Vr("rect",{width:"28",height:"28",rx:"3",fill:o?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),Vr("g",{clipPath:"url(#clip0_1765_9946)",children:Vr("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"})}),Vr("defs",{children:Vr("clipPath",{id:"clip0_1765_9946",children:Vr("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var ra=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(zr))if(t.includes(r.hostname))return{walletClientType:o,entry:r}};var zr={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}}};function _y(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var Jd=e=>e in zr,Qd=e=>{let t=zr[e].mobile;if("native"in t)return t.native};function Zd(e,t){let o=_y(t);if(o.deepLink)return rp(o.deepLink,e);if(o.universalLink)return np(o.universalLink,e);throw new w(`Unsupported wallet ${t.id}`)}var Xd="WALLETCONNECT_DEEPLINK_CHOICE";function ep(){try{localStorage.removeItem(Xd)}catch{}}function tp({href:e,name:t}){try{localStorage.setItem(Xd,JSON.stringify({href:e,name:t}))}catch{}}function op(e){return e.startsWith("http://")||e.startsWith("https://")}function rp(e,t){if(op(e))return np(e,t);let o=e;o.includes("://")||(o=e.replaceAll("/","").replaceAll(":",""),o=`${o}://`),o.endsWith("/")||(o=`${o}/`);let r=encodeURIComponent(t);return{redirect:`${o}wc?uri=${r}`,href:o}}function np(e,t){if(!op(e))return rp(e,t);let o=e;o.endsWith("/")||(o=`${o}/`);let r=encodeURIComponent(t);return{redirect:`${o}wc?uri=${r}`,href:o}}function ip(e,t){window.open(e,t,"noreferrer noopener")}var Qt=class extends nt{constructor(o,r,n,i,a,l){super(l||"unknown",n,i,r);this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new pe(void 0,this.rpcTimeoutDuration),l&&(this.walletEntry=zr[l],this.walletClientType=l),this.createProvider().then(s=>{if(this.provider=s,this.proxyProvider.setWalletProvider(s),this.subscribeListeners(),s.session){if(this.walletProvider?.session?.peer.metadata.url){let c=ra(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=c?.entry,this.walletClientType=c?.walletClientType||"unknown"}this.connected=!0,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}else this.emit("initialized"),this.initialized=!0}),import("@walletconnect/modal").then(({WalletConnectModal:s})=>{this.modal=new s({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(c=>{!c.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})})}async connect(o){return o.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:Fr,id:"io.metamask"}:{name:Rs(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Wn,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(o){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=zr[o],this.walletClientType=o,this.redirectUri=void 0,ep(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new Or)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new j("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ra(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Dr(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),o()})().catch(a=>{if(a){r(Lt(a));return}r(new j("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){let o={};for(let a of this.chains){let l=Nt(a.id,this.chains,this.rpcConfig);l&&(o[a.id]=l)}let r=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await Ay.init({projectId:this.walletConnectCloudProjectId,chains:r,optionalChains:n,optionalEvents:ky,optionalMethods:Ry,rpcMap:o,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),Iy&&this.walletEntry){let{redirect:l,href:s}=Zd(a,this.walletEntry);tp({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,ip(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=ra(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var Ls=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===ap(t)).length:!1},Dr=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||rr:rr,Mn=class extends Wy{constructor(o,r,n,i,a,l,s){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 pe:r.proxyProvider};this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=a,this.walletList=l,this.shouldEnforceDefaultChainOnConnect=s,this.initializedWalletConnectors=0,this.walletsReady=!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}async initialize(){if(this.initialized)return;re.get(Ts)&&(re.getKeys().forEach(r=>{r.startsWith("walletconnect")&&re.del(r)}),re.del(Ts));let o=fd(this.store,this.walletList).then(r=>{r.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!Io()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await o,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"),this.initializedWalletConnectors++,this.walletsReady=this.initializedWalletConnectors===this.walletConnectors.length}onWalletsUpdated(o){o.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(o,r,n){let i=this.findWalletConnector("embedded","privy");if(i)i.proxyProvider.walletProxy=o;else{let a=new Mi(o,r,this.rpcConfig,this.chains,n.id),l=new Ui(a,this.chains,n,this.rpcConfig);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.storedConnections=this.loadConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(o,r,n){let i=this.findWalletConnector(o,r);if(i)return i instanceof Qt&&i.resetConnection(r),i;let l=(()=>{if(o==="injected"){if(r==="metamask"&&n?.eip6963InjectedProvider)return new Fi(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(r==="metamask"&&n?.legacyInjectedProvider)return new Gr(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(r==="phantom"&&n?.legacyInjectedProvider)return new Gr(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&r==="unknown_browser_extension")return new Gr(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Hr(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,r)}else return o==="coinbase_wallet"?new Oi(this.chains,this.defaultChain,this.rpcConfig):o==="phantom"?new Hi(this.defaultChain):new Qt(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,r)})();return l&&this.addWalletConnector(l),l||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=re.get(Ps);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}));re.put(Ps,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=ap(o),this.emit("walletsUpdated")}};function Ni(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 My}from"ofetch";var Ny=[bi(),Ti(),Ei()],na=class{constructor(t,o,r){this.appId=t,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=Cs,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=My.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!Ny.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new wi}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw ie(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw ie(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw ie(r)}}};import lr from"js-cookie";function sp(e){return e instanceof tr?"email":e instanceof ir?"sms":e instanceof nr?"siwe":e instanceof Rr?"custom_auth":e instanceof Ro?e.meta.provider:null}import*as lp from"jose";var Zt=class{static parse(t){try{return new Zt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=lp.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 Ly=30,ia=class{constructor(){this.authenticateOnce=new qe(async t=>this._authenticate(t)),this.linkOnce=new qe(async t=>this._link(t)),this.refreshOnce=new qe(this._refresh.bind(this)),this.destroyOnce=new qe(this._destroy.bind(this)),this.forkSessionOnce=new qe(this._forkSession.bind(this))}get token(){try{let t=re.get(or);return typeof t=="string"?new Zt(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=re.get(Si);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=re.get(Sn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=lr.get(_i);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=Zt.parse(this.token);return t!==null&&!t.isExpired(Ly)}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=sp(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:lt(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),$e(o)}}async _link(t){try{let o=await t.link();return lt(o)}catch(o){throw console.warn("Error linking account"),$e(o)}}async _refresh(){if(!this.api)throw new w("Session has no API instance");if(!this.client)throw new w("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(bi(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(Ti(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),lt(n.user)}catch(n){if(n instanceof $t&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw $e(n)}}async _destroy(){try{await this.api?.post(Ei(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new w("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(wc(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw $e(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let o=re.get(or);if(re.put(or,t),o!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let r=Zt.parse(t)?.expiration;lr.set(bs,t,{sameSite:"Strict",secure:!0,expires:r?new Date(r*1e3):void 0})}}else re.del(or),lr.remove(bs)}storeRefreshToken(t){typeof t=="string"?(re.put(Si,t),this.client?.useServerCookies||(lr.set(_i,"t",{sameSite:"Strict",secure:!0,expires:30}),lr.set(Es,t,{sameSite:"Strict",secure:!0,expires:30}))):(re.del(Si),lr.remove(Es),lr.remove(_i))}clearForkedToken(){re.del(Sn)}};var Os,aa,cp,Nn=class{constructor(t){vi(this,aa);this.apiUrl=t.apiUrl||xi,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Jc,this.appId=t.appId,this.clientAnalyticsId=vc(this,aa,cp).call(this),Os||(Os=new ia),this.session=Os,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r,n,i,a,l){this.connectors||(this.connectors=new Mn(t,o,r,n,i,a,l))}generateApi(){let t=new na(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 w("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new w("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}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let o=await this.api.post(Dc(),{address:t});return lt(o)}catch(o){throw $e(o)}}async acceptTerms(){try{let t=await this.api.post(qc(),{});return lt(t)}catch(t){throw $e(t)}}async unlinkPhone(t){try{let o=await this.api.post(Uc(),{phoneNumber:t});return lt(o)}catch(o){throw $e(o)}}async unlinkWallet(t){try{let o=await this.api.post(Oc(),{address:t});return lt(o)}catch(o){throw $e(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(Fc(),{provider:t,subject:o});return lt(r)}catch(r){throw $e(r)}}async unlinkFarcaster(t){try{let o=await this.api.post(Bc(),{fid:t});return lt(o)}catch(o){throw $e(o)}}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(Hc(),{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(Gc(),t)}catch(o){throw $e(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Zt.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,farcasterAuth:t.farcaster_auth,termsAndConditionsUrl:t.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:t.embedded_wallet_config?.create_on_login,requireUserPasswordOnCreate:t.embedded_wallet_config?.require_user_password_on_create},privacyPolicyUrl:t.privacy_policy_url,requireUsersAcceptTerms:t.require_users_accept_terms,customApiUrl:t.custom_api_url,walletConnectCloudProjectId:t.wallet_connect_cloud_project_id,fiatOnRampEnabled:t.fiat_on_ramp_enabled,captchaEnabled:t.captcha_enabled,captchaSiteKey:t.captcha_site_key,twitterOAuthOnMobileEnabled:t.twitter_oauth_on_mobile_enabled,createdAt:new Date(t.created_at*1e3),updatedAt:new Date(t.updated_at*1e3),mfaMethods:t.mfa_methods,enforceWalletUis:t.enforce_wallet_uis,legacyWalletUiConfig:t.legacy_wallet_ui_config}}catch(t){throw $e(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()}};aa=new WeakSet,cp=function(){if(typeof window>"u")return null;try{let o=re.get(_n);if(typeof o=="string"&&o.length>0)return o}catch{}let t=Oy();try{return re.put(_n,t),t}catch{return t}};import{Turnstile as Gy}from"@marsidev/react-turnstile";import{useEffect as Vy,useMemo as zy}from"react";import{useMemo as Dy,useRef as Uy,useContext as Fy,useState as Ds,createContext as By}from"react";import{jsx as Hy}from"react/jsx-runtime";var dp=By({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:P,setError:P,setExecuting:P,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:P,reset:P,execute:P}),vo=class extends Le{constructor(o,r,n){super(o||"Captcha failed");this.type="Captcha";r instanceof Error&&(this.cause=r),this.privyErrorCode=n}},pp=({children:e,id:t,captchaSiteKey:o,captchaEnabled:r})=>{let n=Uy(null),[i,a]=Ds(),[l,s]=Ds(),[c,u]=Ds(!1),h=Dy(()=>r?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[r,i,l,c]);return Hy(dp.Provider,{value:{...h,ref:n,enabled:r,siteKey:o,appId:t,setToken:a,setError:s,setExecuting:u,remove(){r&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){r&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){r&&(u(!0),n.current?.execute())},async waitForResult(){if(!r)return"";try{return await ud(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new vo("Captcha failed",null,"captcha_timeout")}}},children:e})},me=()=>Fy(dp);import{jsx as up}from"react/jsx-runtime";var Us=e=>{let{enabled:t,siteKey:o,appId:r,setError:n,setToken:i,setExecuting:a,ref:l}=me(),[,s]=zy(()=>o?.split("t:")||[],[o]);if(Vy(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return up("div",{className:"hidden h-0 w-0",children:up(Gy,{...e,ref:l,siteKey:s,options:{action:r,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};import{useCallback as qE,useEffect as Eh,useRef as jE,useState as KE}from"react";import YE from"react-dom";import{createContext as $y,useContext as qy}from"react";var Fs=$y({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,nativeTokenSymbolForChainId:P,initializeWalletProxy:P,getAuthMeta:P,getAuthFlow:P,closePrivyModal:P,openPrivyModal:P,connectWallet:P,initLoginWithWallet:P,loginWithWallet:P,initLoginWithFarcaster:P,loginWithFarcaster:P,loginWithCode:P,initLoginWithEmail:P,initLoginWithSms:P,resendEmailCode:P,resendSmsCode:P,initLoginWithOAuth:P,loginWithOAuth:P,refreshUser:P,walletProxy:null,createAnalyticsEvent:P,acceptTerms:P,getUsdTokenPrice:P,recoverEmbeddedWallet:P,getFiatOnRampConfig:P,updateWallets:P,setReadyToTrue:P}),I=()=>qy(Fs);import{createContext as jy,useContext as Ky}from"react";var ae=jy({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:P,login:P,linkEmail:P,linkPhone:P,linkFarcaster:P,linkWallet:P,linkGoogle:P,linkTwitter:P,linkDiscord:P,linkGithub:P,linkTiktok:P,linkLinkedIn:P,linkApple:P,logout:P,getAccessToken:P,getEthereumProvider:P,getEthersProvider:P,getWeb3jsProvider:P,unlinkEmail:P,unlinkPhone:P,unlinkWallet:P,unlinkGoogle:P,unlinkTwitter:P,unlinkDiscord:P,unlinkGithub:P,unlinkTiktok:P,unlinkLinkedIn:P,unlinkApple:P,unlinkFarcaster:P,setActiveWallet:P,forkSession:P,createWallet:P,signMessage:P,signTypedData:P,enrollInMfa:P,initEnrollmentWithSms:P,initEnrollmentWithTotp:P,promptMfa:P,init:P,submitEnrollmentWithSms:P,submitEnrollmentWithTotp:P,unenroll:P,submit:P,cancel:P,sendTransaction:P,exportWallet:P,setWalletPassword:P,initLoginWithEmail:P,initLoginWithSms:P,loginWithCode:P,isModalOpen:!1}),H=()=>Ky(ae);import{useEffect as Yy,useState as Jy}from"react";var mp=e=>{let[t,o]=Jy("auto");return Yy(()=>{let r=new ResizeObserver(n=>{o(n[0]?.contentRect.height??"auto")});return e.current&&r.observe(e.current),()=>{e.current&&r.unobserve(e.current)}},[e.current]),t};import{createContext as Qy,useContext as Zy,useEffect as Xy}from"react";var fp={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},Bs=Qy(void 0),hp=()=>Zy(Bs);function be(e,t){if(!t)return;let r=hp().current[e];return Xy(()=>{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 F(e,t,o,...r){for(let n of e.current[t][o])n(...r)}function yp(){let e=hp();return(t,o,...r)=>F(e,t,o,...r)}function Hs(e){be("configureMfa",e)}import Sp from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import fg from"@heroicons/react/24/solid/DocumentCheckIcon";import hg from"styled-components";import dr,{css as $s}from"styled-components";import Vs from"styled-components";import{Fragment as tg,jsx as Gs,jsxs as og}from"react/jsx-runtime";var Oo=({success:e,fail:t})=>og(tg,{children:[Gs(vt,{className:e?"success":t?"fail":""}),Gs(zs,{className:e?"success":t?"fail":""})]}),vt=Vs.span`
13
13
  && {
14
14
  width: 82px;
15
15
  height: 82px;
@@ -42,13 +42,13 @@ Resources:
42
42
  border-color: var(--privy-color-error);
43
43
  border-bottom-color: var(--privy-color-error);
44
44
  }
45
- `,Vs=Gs(vt)`
45
+ `,zs=Vs(vt)`
46
46
  && {
47
47
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
48
48
  animation: none;
49
49
  opacity: 0.5;
50
50
  }
51
- `,lr=e=>Hs(eg,{color:e.color||"var(--privy-color-foreground-3)"}),eg=Gs(vt)`
51
+ `,cr=e=>Gs(eg,{color:e.color||"var(--privy-color-foreground-3)"}),eg=Vs(vt)`
52
52
  && {
53
53
  height: 0.9rem;
54
54
  width: 0.9rem;
@@ -57,7 +57,7 @@ Resources:
57
57
  /* Override default Loader to match button transitions */
58
58
  transition: border-color 200ms ease;
59
59
  }
60
- `;import{jsx as wt,jsxs as da}from"react/jsx-runtime";var aa=cr.button`
60
+ `;import{jsx as wt,jsxs as pa}from"react/jsx-runtime";var sa=dr.button`
61
61
  display: flex;
62
62
  flex-direction: row;
63
63
  align-items: center;
@@ -85,13 +85,13 @@ Resources:
85
85
  color: var(--privy-color-foreground-3);
86
86
  cursor: not-allowed;
87
87
  }
88
- `,D=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>wt(yp,{disabled:t||o,...n,children:t?da("span",{children:[wt(lr,{}),r?wt("span",{children:r}):null]}):e}),l_=cr(D)`
89
- ${e=>e.hideAnimations&&zs`
88
+ `,U=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>wt(gp,{disabled:t||o,...n,children:t?pa("span",{children:[wt(cr,{}),r?wt("span",{children:r}):null]}):e}),f_=dr(U)`
89
+ ${e=>e.hideAnimations&&$s`
90
90
  && {
91
91
  transition: none;
92
92
  }
93
93
  `}
94
- `,sa=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>wt(yp,{as:"a",disabled:t||o,...n,children:t?da("span",{children:[wt(lr,{}),r?wt("span",{children:r}):null]}):e}),yp=cr(aa)`
94
+ `,la=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>wt(gp,{as:"a",disabled:t||o,...n,children:t?pa("span",{children:[wt(cr,{}),r?wt("span",{children:r}):null]}):e}),gp=dr(sa)`
95
95
  position: relative;
96
96
 
97
97
  && {
@@ -117,7 +117,7 @@ Resources:
117
117
  }
118
118
 
119
119
  /* If an anchor tag, :disabled isn't a thing, so manually set state */
120
- ${e=>e.disabled?zs`
120
+ ${e=>e.disabled?$s`
121
121
  &&&,
122
122
  &&&:hover,
123
123
  &&&:active {
@@ -136,7 +136,7 @@ Resources:
136
136
  opacity: 1;
137
137
  animation: fadein 200ms ease;
138
138
  }
139
- `,Lt=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>wt(rg,{disabled:t||o,...n,children:t?da("span",{children:[wt(lr,{}),r?wt("span",{children:r}):null]}):e}),rg=cr(aa)`
139
+ `,Ot=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>wt(rg,{disabled:t||o,...n,children:t?pa("span",{children:[wt(cr,{}),r?wt("span",{children:r}):null]}):e}),rg=dr(sa)`
140
140
  && {
141
141
  border-width: 1px;
142
142
  border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
@@ -165,7 +165,7 @@ Resources:
165
165
  opacity: 1;
166
166
  animation: fadein 200ms ease;
167
167
  }
168
- `,la=cr.button`
168
+ `,ca=dr.button`
169
169
  && {
170
170
  padding: 12px 16px;
171
171
  font-weight: 500;
@@ -178,7 +178,7 @@ Resources:
178
178
  transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
179
179
  user-select: none;
180
180
 
181
- ${e=>e.invisible&&zs`
181
+ ${e=>e.invisible&&$s`
182
182
  pointer-events: none;
183
183
  `}
184
184
 
@@ -196,10 +196,10 @@ Resources:
196
196
  cursor: not-allowed;
197
197
  }
198
198
  }
199
- `,c_=cr.div`
199
+ `,h_=dr.div`
200
200
  /* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
201
201
  height: 44px;
202
- `,ca=({children:e,onClick:t,disabled:o,isSubmitting:r,...n})=>da(ng,{isSubmitting:r,onClick:t,disabled:o,...n,children:[wt("span",{children:e}),wt("span",{children:wt(lr,{})})]}),ng=cr.button`
202
+ `,da=({children:e,onClick:t,disabled:o,isSubmitting:r,...n})=>pa(ng,{isSubmitting:r,onClick:t,disabled:o,...n,children:[wt("span",{children:e}),wt("span",{children:wt(cr,{})})]}),ng=dr.button`
203
203
  && {
204
204
  color: var(--privy-color-accent);
205
205
  font-size: 16px;
@@ -241,7 +241,7 @@ Resources:
241
241
  cursor: not-allowed;
242
242
  }
243
243
  }
244
- `;import gp from"styled-components";import{Fragment as ig,jsx as Oo,jsxs as vp}from"react/jsx-runtime";var $s=gp.div`
244
+ `;import vp from"styled-components";import{Fragment as ig,jsx as Do,jsxs as wp}from"react/jsx-runtime";var qs=vp.div`
245
245
  margin-top: 16px;
246
246
  font-size: 13px;
247
247
  text-align: center;
@@ -250,7 +250,7 @@ Resources:
250
250
  && > a {
251
251
  color: var(--privy-color-accent);
252
252
  }
253
- `;function pa(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:o,requireUsersAcceptTerms:r}}=e.app;if(r&&!e.alwaysShowImplicitConsent)return Oo($s,{});if(!o&&!t)return Oo($s,{});let n=!!(t&&o);return vp($s,{children:["By logging in I agree to the"," ",o&&Oo("a",{href:o,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&Oo("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var H=({protectedByPrivy:e})=>Oo(K,{children:e?vp(ig,{children:[Oo(Oi,{className:"hide-on-mobile"}),Oo("span",{className:"hide-on-mobile",children:Oo("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),K=gp.div`
253
+ `;function ua(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:o,requireUsersAcceptTerms:r}}=e.app;if(r&&!e.alwaysShowImplicitConsent)return Do(qs,{});if(!o&&!t)return Do(qs,{});let n=!!(t&&o);return wp(qs,{children:["By logging in I agree to the"," ",o&&Do("a",{href:o,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&Do("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var G=({protectedByPrivy:e})=>Do(Y,{children:e?wp(ig,{children:[Do(Di,{className:"hide-on-mobile"}),Do("span",{className:"hide-on-mobile",children:Do("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),Y=vp.div`
254
254
  display: flex;
255
255
  align-items: center;
256
256
  justify-content: center;
@@ -277,7 +277,7 @@ Resources:
277
277
  @media all and (display-mode: standalone) {
278
278
  padding-bottom: 30px;
279
279
  }
280
- `;import ag from"@heroicons/react/24/outline/ArrowLeftIcon";import sg from"@heroicons/react/24/outline/XMarkIcon";import qs from"styled-components";import{jsx as Ct,jsxs as ug}from"react/jsx-runtime";var wp=()=>Ct("div",{}),lg=({backFn:e})=>Ct("div",{children:Ct(Cp,{onClick:e,children:Ct(ag,{height:"16px",width:"16px",strokeWidth:2})})}),cg=e=>Ct("div",{children:Ct(Cp,{"aria-label":"close modal",onClick:e.onClose,children:Ct(sg,{height:"16px",width:"16px",strokeWidth:2})})});var S=({backFn:e,onClose:t,title:o,closeable:r=!0})=>{let{closePrivyModal:n}=R(),{app:i}=_();return ug(dg,{children:[e?Ct(lg,{backFn:e}):Ct(wp,{}),o&&Ct(pg,{id:"privy-dialog-title",children:o}),i?.render.inDialog&&r?Ct(cg,{onClose:t||(()=>n())}):Ct(wp,{})]})},Cp=qs.button`
280
+ `;import ag from"@heroicons/react/24/outline/ArrowLeftIcon";import sg from"@heroicons/react/24/outline/XMarkIcon";import js from"styled-components";import{jsx as Ct,jsxs as ug}from"react/jsx-runtime";var Cp=()=>Ct("div",{}),lg=({backFn:e})=>Ct("div",{children:Ct(bp,{onClick:e,children:Ct(ag,{height:"16px",width:"16px",strokeWidth:2})})}),cg=e=>Ct("div",{children:Ct(bp,{"aria-label":"close modal",onClick:e.onClose,children:Ct(sg,{height:"16px",width:"16px",strokeWidth:2})})});var S=({backFn:e,onClose:t,title:o,closeable:r=!0})=>{let{closePrivyModal:n}=I(),{app:i}=_();return ug(dg,{children:[e?Ct(lg,{backFn:e}):Ct(Cp,{}),o&&Ct(pg,{id:"privy-dialog-title",children:o}),i?.render.inDialog&&r?Ct(cg,{onClose:t||(()=>n())}):Ct(Cp,{})]})},bp=js.button`
281
281
  && {
282
282
  cursor: pointer;
283
283
  display: flex;
@@ -296,7 +296,7 @@ Resources:
296
296
  opacity: 1;
297
297
  }
298
298
  }
299
- `,dg=qs.div`
299
+ `,dg=js.div`
300
300
  padding: 16px 0;
301
301
  display: flex;
302
302
  align-items: center;
@@ -318,22 +318,22 @@ Resources:
318
318
  display: flex;
319
319
  justify-content: flex-end;
320
320
  }
321
- `,pg=qs.div`
321
+ `,pg=js.div`
322
322
  overflow: hidden;
323
323
  white-space: nowrap;
324
324
  max-width: 100%;
325
325
  text-overflow: ellipsis;
326
326
  text-align: center;
327
327
  color: var(--privy-color-foreground-2);
328
- `;import zr,{css as mg}from"styled-components";var ua=zr.div`
328
+ `;import $r,{css as mg}from"styled-components";var ma=$r.div`
329
329
  text-align: left;
330
330
  flex-grow: 1;
331
- `,bp=zr.div`
331
+ `,Ep=$r.div`
332
332
  display: flex;
333
333
  flex-direction: column;
334
334
  justify-content: flex-end;
335
335
  flex-grow: 1;
336
- `,Zt=zr.div`
336
+ `,Xt=$r.div`
337
337
  display: flex;
338
338
  flex-direction: column;
339
339
  gap: 12px;
@@ -348,7 +348,7 @@ Resources:
348
348
  &::-webkit-scrollbar {
349
349
  display: none;
350
350
  }
351
- `,Ep=mg`
351
+ `,Tp=mg`
352
352
  && {
353
353
  width: 100%;
354
354
  font-size: 16px;
@@ -386,14 +386,14 @@ Resources:
386
386
  max-width: 24px;
387
387
  }
388
388
  }
389
- `,ye=zr.button`
390
- ${Ep}
391
- `,js=zr.a`
392
- ${Ep}
393
- `,go=zr.div`
389
+ `,ye=$r.button`
390
+ ${Tp}
391
+ `,Ks=$r.a`
392
+ ${Tp}
393
+ `,wo=$r.div`
394
394
  width: 100%;
395
395
  ${e=>e.if?"display: none;":""}
396
- `;import Ae from"styled-components";var Oe=Ae.div`
396
+ `;import ke from"styled-components";var De=ke.div`
397
397
  display: flex;
398
398
  flex-direction: column;
399
399
  align-items: center;
@@ -401,17 +401,17 @@ Resources:
401
401
  @media (max-width: 440px) {
402
402
  padding: 10px 10px 20px;
403
403
  }
404
- `,ge=Ae.div`
404
+ `,ge=ke.div`
405
405
  font-size: 18px;
406
406
  line-height: 18px;
407
407
  text-align: center;
408
408
  font-weight: 600;
409
409
  margin-bottom: 10px;
410
- `,pe=Ae.div`
410
+ `,ue=ke.div`
411
411
  font-size: 0.875rem;
412
412
 
413
413
  text-align: center;
414
- `,Do=Ae.div`
414
+ `,Uo=ke.div`
415
415
  display: flex;
416
416
  flex-direction: column;
417
417
  align-items: center;
@@ -421,7 +421,7 @@ Resources:
421
421
  @media (max-width: 440px) {
422
422
  padding: 10px 10px 20px;
423
423
  }
424
- `,Tp=Ae.div`
424
+ `,Pp=ke.div`
425
425
  display: flex;
426
426
  flex-direction: column;
427
427
  align-items: stretch;
@@ -429,7 +429,7 @@ Resources:
429
429
  padding: 1rem 0rem 0rem;
430
430
  flex-grow: 1;
431
431
  width: 100%;
432
- `,Ks=Ae.div`
432
+ `,Ys=ke.div`
433
433
  width: 25px;
434
434
  display: flex;
435
435
  align-items: center;
@@ -441,19 +441,19 @@ Resources:
441
441
  width: 25px !important;
442
442
  color: var(--privy-color-accent);
443
443
  }
444
- `,Ys=Ae.div`
444
+ `,Js=ke.div`
445
445
  display: flex;
446
446
  align-items: center;
447
447
  gap: 10px;
448
448
  font-size: 0.875rem;
449
449
  line-height: 1rem;
450
450
  text-align: left;
451
- `,Uo=Ae.div`
451
+ `,Fo=ke.div`
452
452
  display: flex;
453
453
  flex-direction: column;
454
454
  gap: 10px;
455
455
  padding-top: 20px;
456
- `,ma=Ae.div`
456
+ `,fa=ke.div`
457
457
  display: flex;
458
458
  flex-direction: column;
459
459
  align-items: stretch;
@@ -461,7 +461,7 @@ Resources:
461
461
  padding: 1rem 0rem 0rem;
462
462
  flex-grow: 1;
463
463
  width: 100%;
464
- `,fa=Ae.div`
464
+ `,ha=ke.div`
465
465
  display: flex;
466
466
  gap: 5px;
467
467
  width: 100%;
@@ -469,7 +469,7 @@ Resources:
469
469
  & > button:not(#remove) {
470
470
  width: 100%;
471
471
  }
472
- `,Js=Ae.button`
472
+ `,Qs=ke.button`
473
473
  && {
474
474
  background-color: transparent;
475
475
  color: var(--privy-color-foreground-3);
@@ -488,7 +488,7 @@ Resources:
488
488
  &&:hover {
489
489
  color: var(--privy-color-error);
490
490
  }
491
- `,ha=Ae.div`
491
+ `,ya=ke.div`
492
492
  display: flex;
493
493
  align-items: center;
494
494
  gap: 0.5rem;
@@ -498,7 +498,7 @@ Resources:
498
498
  height: 20px !important;
499
499
  width: 20px !important;
500
500
  }
501
- `,$r=Ae.div`
501
+ `,qr=ke.div`
502
502
  display: flex;
503
503
  align-items: center;
504
504
  gap: 6px;
@@ -512,15 +512,15 @@ Resources:
512
512
  display: flex !important;
513
513
  align-items: flex-end;
514
514
  }
515
- `,ya=Ae.div`
515
+ `,ga=ke.div`
516
516
  width: 100%;
517
517
  display: flex;
518
518
  justify-content: space-between;
519
- `,Pp=Ae.p`
519
+ `,xp=ke.p`
520
520
  text-align: left;
521
521
  width: 100%;
522
522
  color: var(--privy-color-foreground-3) !important;
523
- `,Qs=Ae.button`
523
+ `,Zs=ke.button`
524
524
  display: flex;
525
525
  flex-direction: row;
526
526
  align-items: center;
@@ -550,7 +550,7 @@ Resources:
550
550
  &:hover {
551
551
  text-decoration: underline;
552
552
  }
553
- `,$e=Ae.div`
553
+ `,Ke=ke.div`
554
554
  display: flex;
555
555
  align-items: center;
556
556
  justify-content: center;
@@ -565,10 +565,10 @@ Resources:
565
565
  width: auto !important;
566
566
  color: white;
567
567
  }
568
- `;import{Fragment as vg,jsx as Xt,jsxs as Nn}from"react/jsx-runtime";var Sp=()=>{let{user:e,logout:t}=B(),{app:o,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:i}=_(),{acceptTerms:a,closePrivyModal:l}=R(),s=u=>{u?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};r.current=s;let c=async u=>{u.preventDefault(),await a(),e&&yt(e,o?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>console.error(h),callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return Xt(yg,{termsAndConditionsUrl:o?.legal.termsAndConditionsUrl,privacyPolicyUrl:o?.legal.privacyPolicyUrl,onAccept:c,onDecline:s})},yg=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:o,onDecline:r})=>Nn(vg,{children:[Xt(S,{closeable:!1}),Xt(fg,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),Xt(ge,{style:{marginTop:24},children:"One last step"}),Xt(pe,{children:"By signing up, you agree to our terms and privacy policy."}),Nn(Zt,{style:{marginTop:24},children:[e&&Nn(js,{target:"_blank",href:e,children:["View Terms ",Xt(xp,{style:{marginLeft:"auto"}})]}),t&&Nn(js,{target:"_blank",href:t,children:["View Privacy Policy ",Xt(xp,{style:{marginLeft:"auto"}})]})]}),Nn(gg,{style:{marginTop:24},children:[Xt(Lt,{onClick:r,children:"No thanks"}),Xt(D,{onClick:o,children:"Accept"})]}),Xt(H,{protectedByPrivy:!0})]}),gg=hg.div`
568
+ `;import{Fragment as vg,jsx as eo,jsxs as Ln}from"react/jsx-runtime";var _p=()=>{let{user:e,logout:t}=H(),{app:o,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:i}=_(),{acceptTerms:a,closePrivyModal:l}=I(),s=u=>{u?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};r.current=s;let c=async u=>{u.preventDefault(),await a(),e&&yt(e,o?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:h=>console.error(h),callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return eo(yg,{termsAndConditionsUrl:o?.legal.termsAndConditionsUrl,privacyPolicyUrl:o?.legal.privacyPolicyUrl,onAccept:c,onDecline:s})},yg=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:o,onDecline:r})=>Ln(vg,{children:[eo(S,{closeable:!1}),eo(fg,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),eo(ge,{style:{marginTop:24},children:"One last step"}),eo(ue,{children:"By signing up, you agree to our terms and privacy policy."}),Ln(Xt,{style:{marginTop:24},children:[e&&Ln(Ks,{target:"_blank",href:e,children:["View Terms ",eo(Sp,{style:{marginLeft:"auto"}})]}),t&&Ln(Ks,{target:"_blank",href:t,children:["View Privacy Policy ",eo(Sp,{style:{marginLeft:"auto"}})]})]}),Ln(gg,{style:{marginTop:24},children:[eo(Ot,{onClick:r,children:"No thanks"}),eo(U,{onClick:o,children:"Accept"})]}),eo(G,{protectedByPrivy:!0})]}),gg=hg.div`
569
569
  display: flex;
570
570
  gap: 10px;
571
- `;import Xs from"styled-components";import wg from"styled-components";var ga=wg.span`
571
+ `;import el from"styled-components";import wg from"styled-components";var va=wg.span`
572
572
  && {
573
573
  width: 82px;
574
574
  height: 82px;
@@ -583,7 +583,7 @@ Resources:
583
583
  transition: border-color 800ms;
584
584
  border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
585
585
  }
586
- `;import{jsx as _p}from"react/jsx-runtime";var va=({style:e,...t})=>_p("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:_p("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 Zs,jsx as eo,jsxs as wa}from"react/jsx-runtime";var Ap=()=>{let{navigate:e,app:t}=_(),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 wa(Zs,{children:[eo(S,{}),wa(Cg,{children:[eo(Eg,{children:wa("div",{children:[eo(ga,{}),eo(va,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),wa(bg,{children:[typeof o=="string"?eo("h3",{children:o}):eo(Zs,{children:o}),typeof r=="string"?eo("p",{children:r}):eo(Zs,{children:r})]}),t?.allowlistConfig.errorCtaLink?eo(D,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):eo(D,{onClick:()=>{e("LANDING")},children:n})]})]})},Cg=Xs.div`
586
+ `;import{jsx as Ap}from"react/jsx-runtime";var wa=({style:e,...t})=>Ap("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:Ap("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 Xs,jsx as to,jsxs as Ca}from"react/jsx-runtime";var kp=()=>{let{navigate:e,app:t}=_(),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 Ca(Xs,{children:[to(S,{}),Ca(Cg,{children:[to(Eg,{children:Ca("div",{children:[to(va,{}),to(wa,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),Ca(bg,{children:[typeof o=="string"?to("h3",{children:o}):to(Xs,{children:o}),typeof r=="string"?to("p",{children:r}):to(Xs,{children:r})]}),t?.allowlistConfig.errorCtaLink?to(U,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):to(U,{onClick:()=>{e("LANDING")},children:n})]})]})},Cg=el.div`
587
587
  display: flex;
588
588
  flex-direction: column;
589
589
  align-items: center;
@@ -591,11 +591,11 @@ Resources:
591
591
  gap: 24px;
592
592
  width: 100%;
593
593
  padding-bottom: 16px;
594
- `,bg=Xs.div`
594
+ `,bg=el.div`
595
595
  display: flex;
596
596
  flex-direction: column;
597
597
  gap: 8px;
598
- `,Eg=Xs.div`
598
+ `,Eg=el.div`
599
599
  display: flex;
600
600
  flex-direction: column;
601
601
  justify-content: center;
@@ -618,7 +618,7 @@ Resources:
618
618
  left: -19px;
619
619
  top: -19px;
620
620
  }
621
- `;import xg from"@heroicons/react/24/outline/EnvelopeIcon";import Sg from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Lp,useState as ba}from"react";import{isMobile as _g}from"react-device-detect";import Dn from"styled-components";import ct from"styled-components";var to=ct.div`
621
+ `;import xg from"@heroicons/react/24/outline/EnvelopeIcon";import Sg from"@heroicons/react/24/outline/PhoneIcon";import{useEffect as Op,useState as Ea}from"react";import{isMobile as _g}from"react-device-detect";import Un from"styled-components";import dt from"styled-components";var oo=dt.div`
622
622
  display: flex;
623
623
  flex-direction: column;
624
624
  align-items: flex-start;
@@ -626,36 +626,36 @@ Resources:
626
626
  margin-top: auto;
627
627
  gap: 16px;
628
628
  flex-grow: 100;
629
- `,bt=ct.div`
629
+ `,bt=dt.div`
630
630
  display: flex;
631
631
  flex-direction: column;
632
632
  align-items: center;
633
633
  justify-content: center;
634
634
  flex-grow: 1;
635
635
  width: 100%;
636
- `,kp=ct.div`
636
+ `,Rp=dt.div`
637
637
  display: flex;
638
638
  flex-direction: column;
639
639
  align-items: center;
640
640
  width: 100%;
641
- `,Ca=ct(bt)`
641
+ `,ba=dt(bt)`
642
642
  padding: 20px 0;
643
- `,Ot=ct(bt)`
643
+ `,Dt=dt(bt)`
644
644
  gap: 16px;
645
- `,el=ct.div`
645
+ `,tl=dt.div`
646
646
  display: flex;
647
647
  flex-direction: column;
648
648
  width: 100%;
649
- `,Et=ct.div`
649
+ `,Et=dt.div`
650
650
  display: flex;
651
651
  flex-direction: column;
652
652
  gap: 8px;
653
- `,o4=ct.div`
653
+ `,l4=dt.div`
654
654
  display: flex;
655
655
  flex-direction: column;
656
656
  justify-content: space-between;
657
657
  height: 100%;
658
- `,Rp=ct.div`
658
+ `,Ip=dt.div`
659
659
  display: flex;
660
660
  flex-direction: column;
661
661
  justify-content: flex-start;
@@ -678,13 +678,13 @@ Resources:
678
678
  color: var(--privy-color-foreground-3);
679
679
  font-size: 14px;
680
680
  }
681
- `,Y=ct.div`
681
+ `,J=dt.div`
682
682
  height: 16px;
683
- `,Q=ct.div`
683
+ `,Z=dt.div`
684
684
  height: 12px;
685
- `,Ip=ct.div`
685
+ `,Wp=dt.div`
686
686
  position: relative;
687
- `,Wp=ct.div`
687
+ `,Mp=dt.div`
688
688
  background-color: var(--privy-color-accent);
689
689
  display: flex;
690
690
  justify-content: center;
@@ -692,9 +692,9 @@ Resources:
692
692
  border-radius: 50%;
693
693
  border-color: white;
694
694
  border-width: 2px !important;
695
- `;import tl from"styled-components";import{Fragment as Pg,jsx as Ln,jsxs as Np}from"react/jsx-runtime";var On=({title:e,description:t,children:o,...r})=>Ln(Mp,{...r,children:Np(Pg,{children:[Ln("h3",{children:e}),typeof t=="string"?Ln("p",{children:t}):t,o]})}),oo=tl(On)`
695
+ `;import ol from"styled-components";import{Fragment as Pg,jsx as On,jsxs as Lp}from"react/jsx-runtime";var Dn=({title:e,description:t,children:o,...r})=>On(Np,{...r,children:Lp(Pg,{children:[On("h3",{children:e}),typeof t=="string"?On("p",{children:t}):t,o]})}),ro=ol(Dn)`
696
696
  margin-bottom: 24px;
697
- `,be=({title:e,description:t,icon:o,children:r,...n})=>Np(Tg,{...n,children:[o||null,Ln("h3",{children:e}),typeof t=="string"?Ln("p",{children:t}):t,r]}),Mp=tl.div`
697
+ `,Ee=({title:e,description:t,icon:o,children:r,...n})=>Lp(Tg,{...n,children:[o||null,On("h3",{children:e}),typeof t=="string"?On("p",{children:t}):t,r]}),Np=ol.div`
698
698
  display: flex;
699
699
  flex-direction: column;
700
700
  justify-content: flex-start;
@@ -714,7 +714,7 @@ Resources:
714
714
  color: var(--privy-color-foreground-2);
715
715
  font-size: 14px;
716
716
  }
717
- `,Tg=tl(Mp)`
717
+ `,Tg=ol(Np)`
718
718
  align-items: center;
719
719
  text-align: center;
720
720
  gap: 16px;
@@ -722,7 +722,7 @@ Resources:
722
722
  h3 {
723
723
  margin-bottom: 24px;
724
724
  }
725
- `;import{Fragment as ol,jsx as De,jsxs as Fo}from"react/jsx-runtime";var rl=6,Op=new Array(rl).fill(""),Ag=1400;var Up=()=>{let{app:e,navigate:t,navigateBack:o,setModalData:r,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u}=R(),{authenticated:h,user:f}=B(),[g,C]=ba(Op),[b,x]=ba(!1),[E,T]=ba(null),[N,k]=ba(null);n.current=()=>null;let M=s()?.email?0:1,L=e?.render.inDialog?ze:0,I=e?.render.inDialog?L-500:0;Lp(()=>{if(h&&b&&f){if(e?.legal.requireUsersAcceptTerms&&!f.hasAcceptedTerms){let A=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout(A)}if(yt(f,e?.embeddedWallets?.createOnLogin)){let A=setTimeout(()=>{r({createWallet:{onSuccess:()=>{},onFailure:se=>console.error(se),callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I);return()=>clearTimeout(A)}else{u();let A=setTimeout(i,L);return()=>clearTimeout(A)}}},[h,b,f]),Lp(()=>{if(E&&N===0){let G=setTimeout(()=>{C(Op),T(null),document.querySelector("input[name=code-0]")?.focus()},Ag);return()=>clearTimeout(G)}},[E]);let F=G=>{G.preventDefault();let A=G.currentTarget.value.replace(" ","");if(A==="")return;if(isNaN(Number(A))){T("Code should be numeric"),k(1);return}T(null),k(null);let se=Number(G.currentTarget.name?.charAt(5)),ne=[...A||[""]].slice(0,rl-se),J=[...g.slice(0,se),...ne,...g.slice(se+ne.length)];C(J);let _t=ne.length,me=Math.min(Math.max(se+_t,0),rl-1);isNaN(Number(G.currentTarget.value))||document.querySelector(`input[name=code-${me}]`)?.focus(),J.every(Je=>Je&&!isNaN(+Je))&&(document.querySelector(`input[name=code-${me}]`)?.blur(),c(J.join("")).then(()=>x(!0)).catch(Me=>{Me?.status===422?T("Invalid or expired verification code"):Me instanceof zt&&Me.privyErrorCode==="cannot_link_more_of_type"?T(Me.message):T("Issue verifying code"),k(0)}))},z=G=>{N===1&&(T(null),k(null));let A=[...g.slice(0,G),"",...g.slice(G+1)];C(A),G>0&&document.querySelector(`input[name=code-${G-1}]`)?.focus()},X=M==0?De(xg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):De(Sg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),O=M==0?Fo("p",{children:["Please check ",De(Dp,{children:s()?.email})," for an email from privy.io and enter your code below."]}):Fo("p",{children:["Please check ",De(Dp,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Fo(ol,{children:[De(S,{backFn:()=>o()},"header"),Fo(kg,{children:[De(be,{title:"Enter confirmation code",description:O,icon:X}),Fo(kp,{children:[Fo(Rg,{children:[De(Ig,{fail:!!E,success:b,children:De("span",{children:E||(b?"Success!":"")})}),De("div",{children:g.map((G,A)=>De("input",{name:`code-${A}`,type:"text",value:g[A],onChange:F,onKeyUp:se=>{se.key==="Backspace"&&z(A)},inputMode:"numeric",autoFocus:A===0,pattern:"[0-9]",className:`${b?"success":""} ${E?"fail":""}`,autoComplete:_g?"one-time-code":"off"},A))})]}),De(Wg,{children:M==0?Fo(ol,{children:[De("span",{children:"Didn't get an email?"}),De("button",{onClick:a,children:"Resend code"})]}):Fo(ol,{children:[De("span",{children:"Didn't get a message?"}),De("button",{onClick:l,children:"Resend code"})]})})]})]}),De(H,{protectedByPrivy:!0})]})},kg=Dn.div`
725
+ `;import{Fragment as rl,jsx as Ue,jsxs as Bo}from"react/jsx-runtime";var nl=6,Dp=new Array(nl).fill(""),Ag=1400;var Fp=()=>{let{app:e,navigate:t,navigateBack:o,setModalData:r,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u}=I(),{authenticated:h,user:f}=H(),[g,C]=Ea(Dp),[b,x]=Ea(!1),[E,T]=Ea(null),[L,R]=Ea(null);n.current=()=>null;let N=s()?.email?0:1,O=e?.render.inDialog?je:0,W=e?.render.inDialog?O-500:0;Op(()=>{if(h&&b&&f){if(e?.legal.requireUsersAcceptTerms&&!f.hasAcceptedTerms){let A=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},W);return()=>clearTimeout(A)}if(yt(f,e?.embeddedWallets?.createOnLogin)){let A=setTimeout(()=>{r({createWallet:{onSuccess:()=>{},onFailure:le=>console.error(le),callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},W);return()=>clearTimeout(A)}else{u();let A=setTimeout(i,O);return()=>clearTimeout(A)}}},[h,b,f]),Op(()=>{if(E&&L===0){let V=setTimeout(()=>{C(Dp),T(null),document.querySelector("input[name=code-0]")?.focus()},Ag);return()=>clearTimeout(V)}},[E]);let B=V=>{V.preventDefault();let A=V.currentTarget.value.replace(" ","");if(A==="")return;if(isNaN(Number(A))){T("Code should be numeric"),R(1);return}T(null),R(null);let le=Number(V.currentTarget.name?.charAt(5)),ne=[...A||[""]].slice(0,nl-le),Q=[...g.slice(0,le),...ne,...g.slice(le+ne.length)];C(Q);let _t=ne.length,fe=Math.min(Math.max(le+_t,0),nl-1);isNaN(Number(V.currentTarget.value))||document.querySelector(`input[name=code-${fe}]`)?.focus(),Q.every(Xe=>Xe&&!isNaN(+Xe))&&(document.querySelector(`input[name=code-${fe}]`)?.blur(),c(Q.join("")).then(()=>x(!0)).catch(Ne=>{Ne?.status===422?T("Invalid or expired verification code"):Ne instanceof $t&&Ne.privyErrorCode==="cannot_link_more_of_type"?T(Ne.message):T("Issue verifying code"),R(0)}))},$=V=>{L===1&&(T(null),R(null));let A=[...g.slice(0,V),"",...g.slice(V+1)];C(A),V>0&&document.querySelector(`input[name=code-${V-1}]`)?.focus()},ee=N==0?Ue(xg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):Ue(Sg,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),D=N==0?Bo("p",{children:["Please check ",Ue(Up,{children:s()?.email})," for an email from privy.io and enter your code below."]}):Bo("p",{children:["Please check ",Ue(Up,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return Bo(rl,{children:[Ue(S,{backFn:()=>o()},"header"),Bo(kg,{children:[Ue(Ee,{title:"Enter confirmation code",description:D,icon:ee}),Bo(Rp,{children:[Bo(Rg,{children:[Ue(Ig,{fail:!!E,success:b,children:Ue("span",{children:E||(b?"Success!":"")})}),Ue("div",{children:g.map((V,A)=>Ue("input",{name:`code-${A}`,type:"text",value:g[A],onChange:B,onKeyUp:le=>{le.key==="Backspace"&&$(A)},inputMode:"numeric",autoFocus:A===0,pattern:"[0-9]",className:`${b?"success":""} ${E?"fail":""}`,autoComplete:_g?"one-time-code":"off"},A))})]}),Ue(Wg,{children:N==0?Bo(rl,{children:[Ue("span",{children:"Didn't get an email?"}),Ue("button",{onClick:a,children:"Resend code"})]}):Bo(rl,{children:[Ue("span",{children:"Didn't get a message?"}),Ue("button",{onClick:l,children:"Resend code"})]})})]})]}),Ue(G,{protectedByPrivy:!0})]})},kg=Un.div`
726
726
  display: flex;
727
727
  flex-direction: column;
728
728
  align-items: flex-start;
@@ -730,7 +730,7 @@ Resources:
730
730
  margin: auto;
731
731
  gap: 16px;
732
732
  flex-grow: 1;
733
- `,Rg=Dn.div`
733
+ `,Rg=Un.div`
734
734
  display: flex;
735
735
  flex-direction: column;
736
736
  width: 100%;
@@ -786,7 +786,7 @@ Resources:
786
786
  transform: translate(1px, 0px);
787
787
  }
788
788
  }
789
- `,Ig=Dn.div`
789
+ `,Ig=Un.div`
790
790
  line-height: 20px;
791
791
  height: 20px;
792
792
  font-size: 13px;
@@ -794,7 +794,7 @@ Resources:
794
794
  display: flex;
795
795
  justify-content: flex-end;
796
796
  width: 100%;
797
- `,Wg=Dn.div`
797
+ `,Wg=Un.div`
798
798
  font-size: 13px;
799
799
  color: var(--privy-color-foreground-3);
800
800
  display: flex;
@@ -808,10 +808,10 @@ Resources:
808
808
  > button {
809
809
  text-decoration: underline;
810
810
  }
811
- `,Dp=Dn.span`
811
+ `,Up=Un.span`
812
812
  font-weight: 500;
813
813
  word-break: break-all;
814
- `;import Dg from"@heroicons/react/24/solid/CheckCircleIcon";import Ug from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as nl,useRef as Fg,useState as jr}from"react";import Bg from"styled-components";import Mg from"styled-components";import{Fragment as Og,jsx as qr,jsxs as Lg}from"react/jsx-runtime";var Fp=({icon:e})=>{let t=e;return qr(Og,{children:qr(Ng,{children:Lg("div",{children:[qr(Lo,{}),typeof t=="string"?qr("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?qr(t,{style:{width:"38px",height:"38px"}}):qr("span",{})]})})})},Ng=Mg.div`
814
+ `;import Dg from"@heroicons/react/24/solid/CheckCircleIcon";import Ug from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as il,useRef as Fg,useState as Kr}from"react";import Bg from"styled-components";import Mg from"styled-components";import{Fragment as Og,jsx as jr,jsxs as Lg}from"react/jsx-runtime";var Bp=({icon:e})=>{let t=e;return jr(Og,{children:jr(Ng,{children:Lg("div",{children:[jr(Oo,{}),typeof t=="string"?jr("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?jr(t,{style:{width:"38px",height:"38px"}}):jr("span",{})]})})})},Ng=Mg.div`
815
815
  display: flex;
816
816
  flex-direction: column;
817
817
  justify-content: center;
@@ -834,14 +834,14 @@ Resources:
834
834
  left: -19px;
835
835
  top: -19px;
836
836
  }
837
- `;import{Fragment as Gg,jsx as Dt,jsxs as il}from"react/jsx-runtime";var Hp=500,Bp=Hp*2,Gp=()=>{let{lastScreen:e,currentScreen:t,data:o,navigateBack:r,navigate:n,setModalData:i}=_(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=ue(),h=Fg([]),f=G=>{h.current=[G,...h.current]},[g,C]=jr(!0);nl(()=>{let G=setTimeout(C,Bp,!1);return f(G),()=>{h.current.forEach(A=>clearTimeout(A)),h.current=[]}},[]);let[b,x]=jr(""),[E,T]=jr("Checking that you are a human..."),[N,k]=jr(Dt(D,{onClick:()=>{},disabled:!0,children:"Continue"})),[M,L]=jr(!1),[I,F]=jr(3),z=o?.captchaModalData,X=async G=>{try{await z?.callback(G),z?.onSuccessNavigateTo&&n(z?.onSuccessNavigateTo,!1)}catch(A){if(A instanceof yo)return;{let se={error:A,previousScreen:e||"LANDING"};i({errorModalData:se}),n(z?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};nl(()=>{if(a==="success"){let G=setTimeout(async()=>{let A=await s();!A||z?.userIntentRequired||X(A)},Bp);f(G)}else if(a==="ready"){let G=setTimeout(()=>{a==="ready"&&u()},Hp);f(G)}},[a]),nl(()=>{if(!g)switch(a){case"success":x("Success!"),T("CAPTCHA passed successfully."),k(Dt(D,{onClick:()=>{L(!0),X(l)},disabled:!z?.userIntentRequired,loading:M,children:z?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),T("Checking that you are a human..."),k(Dt(D,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),I<=0?(T("If you use an adblocker or VPN, try disabling and re-attempting."),k(null)):(T("You did not pass CAPTCHA. Please try again."),k(Dt(D,{onClick:O,children:"Retry"})));break;case"ready":default:break}},[a,g,M]);let O=async()=>{if(I<=0)return;F(A=>A-1),c(),u();let G=await s();!G||z?.userIntentRequired||X(G)};return il(Gg,{children:[Dt(S,{backFn:!e||t===e?void 0:r}),il(Hg,{children:[a==="success"?Dt(Dg,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?Dt(Ug,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Dt(Fp,{}),il(Et,{children:[b?Dt("h3",{children:b}):null,Dt("p",{children:E})]}),N]}),Dt(K,{})]})},Hg=Bg.div`
837
+ `;import{Fragment as Gg,jsx as Ut,jsxs as al}from"react/jsx-runtime";var Gp=500,Hp=Gp*2,Vp=()=>{let{lastScreen:e,currentScreen:t,data:o,navigateBack:r,navigate:n,setModalData:i}=_(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=me(),h=Fg([]),f=V=>{h.current=[V,...h.current]},[g,C]=Kr(!0);il(()=>{let V=setTimeout(C,Hp,!1);return f(V),()=>{h.current.forEach(A=>clearTimeout(A)),h.current=[]}},[]);let[b,x]=Kr(""),[E,T]=Kr("Checking that you are a human..."),[L,R]=Kr(Ut(U,{onClick:()=>{},disabled:!0,children:"Continue"})),[N,O]=Kr(!1),[W,B]=Kr(3),$=o?.captchaModalData,ee=async V=>{try{await $?.callback(V),$?.onSuccessNavigateTo&&n($?.onSuccessNavigateTo,!1)}catch(A){if(A instanceof vo)return;{let le={error:A,previousScreen:e||"LANDING"};i({errorModalData:le}),n($?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};il(()=>{if(a==="success"){let V=setTimeout(async()=>{let A=await s();!A||$?.userIntentRequired||ee(A)},Hp);f(V)}else if(a==="ready"){let V=setTimeout(()=>{a==="ready"&&u()},Gp);f(V)}},[a]),il(()=>{if(!g)switch(a){case"success":x("Success!"),T("CAPTCHA passed successfully."),R(Ut(U,{onClick:()=>{O(!0),ee(l)},disabled:!$?.userIntentRequired,loading:N,children:$?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":x(""),T("Checking that you are a human..."),R(Ut(U,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":x("Something went wrong"),W<=0?(T("If you use an adblocker or VPN, try disabling and re-attempting."),R(null)):(T("You did not pass CAPTCHA. Please try again."),R(Ut(U,{onClick:D,children:"Retry"})));break;case"ready":default:break}},[a,g,N]);let D=async()=>{if(W<=0)return;B(A=>A-1),c(),u();let V=await s();!V||$?.userIntentRequired||ee(V)};return al(Gg,{children:[Ut(S,{backFn:!e||t===e?void 0:r}),al(Hg,{children:[a==="success"?Ut(Dg,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?Ut(Ug,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):Ut(Bp,{}),al(Et,{children:[b?Ut("h3",{children:b}):null,Ut("p",{children:E})]}),L]}),Ut(Y,{})]})},Hg=Bg.div`
838
838
  display: flex;
839
839
  flex-direction: column;
840
840
  align-items: center;
841
841
  justify-content: center;
842
842
  gap: 24px;
843
843
  width: 100%;
844
- `;import Vg from"@heroicons/react/24/outline/WalletIcon";import{isMobile as zg}from"react-device-detect";import $g from"styled-components";import{jsx as Ut,jsxs as Vp}from"react/jsx-runtime";var zp=({...e})=>Vp("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Ut("defs",{children:Vp("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[Ut("stop",{offset:"0",stopColor:"#f1562b"}),Ut("stop",{offset:"0.3",stopColor:"#f1542b"}),Ut("stop",{offset:"0.41",stopColor:"#f04d2a"}),Ut("stop",{offset:"0.49",stopColor:"#ef4229"}),Ut("stop",{offset:"0.5",stopColor:"#ef4029"}),Ut("stop",{offset:"0.56",stopColor:"#e83e28"}),Ut("stop",{offset:"0.67",stopColor:"#e13c26"}),Ut("stop",{offset:"1",stopColor:"#df3c26"})]})}),Ut("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),Ut("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as $,jsxs as dt}from"react/jsx-runtime";var $p=({style:e,...t})=>dt("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[$("g",{clipPath:"url(#clip0_5_32)",children:dt("g",{clipPath:"url(#clip1_5_32)",children:[$("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:$("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),$("g",{mask:"url(#mask0_5_32)",children:$("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),$("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),$("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),$("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),$("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),$("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),$("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),$("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),$("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),$("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),dt("defs",{children:[dt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[$("stop",{stopColor:"#174299"}),$("stop",{offset:"1",stopColor:"#001E59"})]}),dt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[$("stop",{offset:"0.770277",stopColor:"#FF4000"}),$("stop",{offset:"1",stopColor:"#8754C9"})]}),dt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[$("stop",{stopColor:"#FF4000"}),$("stop",{offset:"1",stopColor:"#8754C9"})]}),dt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[$("stop",{stopColor:"#8754C9"}),$("stop",{offset:"1",stopColor:"#FF4000"})]}),dt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[$("stop",{offset:"0.723929",stopColor:"#FFF700"}),$("stop",{offset:"1",stopColor:"#FF9901"})]}),dt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[$("stop",{stopColor:"#FFF700"}),$("stop",{offset:"1",stopColor:"#FF9901"})]}),dt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[$("stop",{stopColor:"#FFF700"}),$("stop",{offset:"1",stopColor:"#FF9901"})]}),dt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[$("stop",{offset:"0.59513",stopColor:"#00AAFF"}),$("stop",{offset:"1",stopColor:"#01DA40"})]}),dt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[$("stop",{stopColor:"#00AAFF"}),$("stop",{offset:"1",stopColor:"#01DA40"})]}),dt("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[$("stop",{stopColor:"#00AAFF"}),$("stop",{offset:"1",stopColor:"#01DA40"})]}),$("clipPath",{id:"clip0_5_32",children:$("rect",{width:"120",height:"120",fill:"white"})}),$("clipPath",{id:"clip1_5_32",children:$("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as Un,jsxs as qp}from"react/jsx-runtime";var jp=({style:e,...t})=>qp("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[qp("g",{clipPath:"url(#clip0_1704_1423)",children:[Un("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),Un("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),Un("defs",{children:Un("clipPath",{id:"clip0_1704_1423",children:Un("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Kr,jsxs as Jg}from"react/jsx-runtime";var ro={coinbase_wallet:{logo:_n,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Ur,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Yt,displayName:"Phantom"},rainbow:{logo:$p,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:In,displayName:"WalletConnect"},zerion:{logo:jp,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:zp,displayName:"Brave Wallet",rdns:"com.brave.wallet"}},Yr=({provider:e,displayName:t,logo:o,connectOnly:r,connector:n})=>{let{navigate:i}=_(),{connectWallet:a}=R(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{Ro()?(a(n,l),i(r?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(zg?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(r?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},Jg(Yg,{onClick:s,children:[Kr(Kg,{icon:jg(e,n.connectorType)??o,name:n.walletClientType}),Kr("span",{style:{textTransform:"capitalize"},children:qg(e,n.connectorType)||t||n.walletClientType}),Kr("span",{id:"connect-text",children:"Connect"})]})},qg=(e,t)=>{if(ro[e]?.displayName)return ro[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},jg=(e,t)=>{if(ro[e]?.logo)return ro[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return In},Kg=({icon:e,name:t})=>typeof e=="string"?Kr("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Kr(Vg,{}):e?Kr(e,{}):null,Yg=$g(ye)`
844
+ `;import Vg from"@heroicons/react/24/outline/WalletIcon";import{isMobile as zg}from"react-device-detect";import $g from"styled-components";import{jsx as Ft,jsxs as zp}from"react/jsx-runtime";var $p=({...e})=>zp("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Ft("defs",{children:zp("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[Ft("stop",{offset:"0",stopColor:"#f1562b"}),Ft("stop",{offset:"0.3",stopColor:"#f1542b"}),Ft("stop",{offset:"0.41",stopColor:"#f04d2a"}),Ft("stop",{offset:"0.49",stopColor:"#ef4229"}),Ft("stop",{offset:"0.5",stopColor:"#ef4029"}),Ft("stop",{offset:"0.56",stopColor:"#e83e28"}),Ft("stop",{offset:"0.67",stopColor:"#e13c26"}),Ft("stop",{offset:"1",stopColor:"#df3c26"})]})}),Ft("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),Ft("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});import{jsx as q,jsxs as pt}from"react/jsx-runtime";var qp=({style:e,...t})=>pt("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[q("g",{clipPath:"url(#clip0_5_32)",children:pt("g",{clipPath:"url(#clip1_5_32)",children:[q("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:q("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),q("g",{mask:"url(#mask0_5_32)",children:q("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),q("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),q("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),q("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),q("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),q("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),q("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),q("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),q("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),q("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),pt("defs",{children:[pt("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[q("stop",{stopColor:"#174299"}),q("stop",{offset:"1",stopColor:"#001E59"})]}),pt("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[q("stop",{offset:"0.770277",stopColor:"#FF4000"}),q("stop",{offset:"1",stopColor:"#8754C9"})]}),pt("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[q("stop",{stopColor:"#FF4000"}),q("stop",{offset:"1",stopColor:"#8754C9"})]}),pt("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[q("stop",{stopColor:"#8754C9"}),q("stop",{offset:"1",stopColor:"#FF4000"})]}),pt("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[q("stop",{offset:"0.723929",stopColor:"#FFF700"}),q("stop",{offset:"1",stopColor:"#FF9901"})]}),pt("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[q("stop",{stopColor:"#FFF700"}),q("stop",{offset:"1",stopColor:"#FF9901"})]}),pt("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[q("stop",{stopColor:"#FFF700"}),q("stop",{offset:"1",stopColor:"#FF9901"})]}),pt("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[q("stop",{offset:"0.59513",stopColor:"#00AAFF"}),q("stop",{offset:"1",stopColor:"#01DA40"})]}),pt("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[q("stop",{stopColor:"#00AAFF"}),q("stop",{offset:"1",stopColor:"#01DA40"})]}),pt("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[q("stop",{stopColor:"#00AAFF"}),q("stop",{offset:"1",stopColor:"#01DA40"})]}),q("clipPath",{id:"clip0_5_32",children:q("rect",{width:"120",height:"120",fill:"white"})}),q("clipPath",{id:"clip1_5_32",children:q("rect",{width:"120",height:"120",fill:"white"})})]})]});import{jsx as Fn,jsxs as jp}from"react/jsx-runtime";var Kp=({style:e,...t})=>jp("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[jp("g",{clipPath:"url(#clip0_1704_1423)",children:[Fn("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),Fn("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),Fn("defs",{children:Fn("clipPath",{id:"clip0_1704_1423",children:Fn("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Yr,jsxs as Jg}from"react/jsx-runtime";var no={coinbase_wallet:{logo:An,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Fr,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Jt,displayName:"Phantom"},rainbow:{logo:qp,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Wn,displayName:"WalletConnect"},zerion:{logo:Kp,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:$p,displayName:"Brave Wallet",rdns:"com.brave.wallet"}},Jr=({provider:e,displayName:t,logo:o,connectOnly:r,connector:n})=>{let{navigate:i}=_(),{connectWallet:a}=I(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{Io()?(a(n,l),i(r?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(zg?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(r?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},Jg(Yg,{onClick:s,children:[Yr(Kg,{icon:jg(e,n.connectorType)??o,name:n.walletClientType}),Yr("span",{style:{textTransform:"capitalize"},children:qg(e,n.connectorType)||t||n.walletClientType}),Yr("span",{id:"connect-text",children:"Connect"})]})},qg=(e,t)=>{if(no[e]?.displayName)return no[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},jg=(e,t)=>{if(no[e]?.logo)return no[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Wn},Kg=({icon:e,name:t})=>typeof e=="string"?Yr("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Yr(Vg,{}):e?Yr(e,{}):null,Yg=$g(ye)`
845
845
  /* Show "Connect" on hover */
846
846
  > #connect-text {
847
847
  font-weight: 500;
@@ -863,23 +863,23 @@ Resources:
863
863
  display: none;
864
864
  }
865
865
  }
866
- `;import{Fragment as ev,jsx as Fn,jsxs as tv}from"react/jsx-runtime";var Qg=["coinbase_wallet"],Zg=["metamask","rainbow","zerion"],Xg=["phantom"],Jr=({connectOnly:e})=>{let{connectors:t}=R(),{app:o}=_(),r=al(o?.appearance.walletList??[],t,e);return tv(ev,{children:[...r]})},al=(e,t,o)=>{let r=[],n=[],i=[],a=t.find(l=>l.connectorType==="wallet_connect_v2");for(let l of e)if(l==="detected_wallets"){let s=t.filter(({connectorType:c,walletClientType:u})=>c==="injected"&&!e.includes(u));for(let c of s){let{walletClientType:u,walletBranding:h}=c;(u==="unknown"?n:r).push(Fn(Yr,{connectOnly:o,provider:u,logo:h.icon,displayName:h.name,connector:c},`${l}-${u}`))}}else if(Xg.includes(l)){let s=t.find(c=>c.connectorType==="injected"&&c.walletClientType===l||c.connectorType===l);s&&r.push(Fn(Yr,{connectOnly:o,provider:l,connector:s},l))}else if(Zg.includes(l)){let s=t.find(c=>c.connectorType==="injected"&&c.walletClientType===l)??a;s&&r.push(Fn(Yr,{connectOnly:o,provider:l,connector:s},l))}else if(Qg.includes(l)){let s=t.find(({connectorType:c})=>c===l);s&&r.push(Fn(Yr,{connectOnly:o,provider:l,connector:s},l))}else l==="wallet_connect"&&a&&i.push(Fn(Yr,{connectOnly:o,provider:l,connector:a},l));return[...n,...r,...i]};import{Fragment as ov,jsx as Bn,jsxs as rv}from"react/jsx-runtime";var Kp=()=>{let{app:e}=_(),t=`Connect a wallet to ${e?.name}`;return rv(ov,{children:[Bn(S,{},"header"),Bn(oo,{title:"Connect your wallet",description:t}),Bn(Zt,{children:Bn(Jr,{connectOnly:!0})}),Bn(H,{protectedByPrivy:!0})]})};import lv from"styled-components";import av from"styled-components";import nv from"react";import{jsx as iv}from"react/jsx-runtime";var Yp=()=>{let{app:e}=_(),t=e?.appearance?.logo,o=`${e?.name} logo`,r={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?iv("img",{src:t,alt:o,style:r}):t.type==="svg"||t.type==="img"?nv.cloneElement(t,{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{jsx as Jp}from"react/jsx-runtime";var Ea=e=>{let{app:t}=_();return t?.appearance.logo?Jp(sv,{...e,children:Jp(Yp,{})}):null},sv=av.div`
866
+ `;import{Fragment as ev,jsx as Bn,jsxs as tv}from"react/jsx-runtime";var Qg=["coinbase_wallet"],Zg=["metamask","rainbow","zerion"],Xg=["phantom"],Qr=({connectOnly:e})=>{let{connectors:t}=I(),{app:o}=_(),r=sl(o?.appearance.walletList??[],t,e);return tv(ev,{children:[...r]})},sl=(e,t,o)=>{let r=[],n=[],i=[],a=t.find(l=>l.connectorType==="wallet_connect_v2");for(let l of e)if(l==="detected_wallets"){let s=t.filter(({connectorType:c,walletClientType:u})=>c==="injected"&&!e.includes(u));for(let c of s){let{walletClientType:u,walletBranding:h}=c;(u==="unknown"?n:r).push(Bn(Jr,{connectOnly:o,provider:u,logo:h.icon,displayName:h.name,connector:c},`${l}-${u}`))}}else if(Xg.includes(l)){let s=t.find(c=>c.connectorType==="injected"&&c.walletClientType===l||c.connectorType===l);s&&r.push(Bn(Jr,{connectOnly:o,provider:l,connector:s},l))}else if(Zg.includes(l)){let s=t.find(c=>c.connectorType==="injected"&&c.walletClientType===l)??a;s&&r.push(Bn(Jr,{connectOnly:o,provider:l,connector:s},l))}else if(Qg.includes(l)){let s=t.find(({connectorType:c})=>c===l);s&&r.push(Bn(Jr,{connectOnly:o,provider:l,connector:s},l))}else l==="wallet_connect"&&a&&i.push(Bn(Jr,{connectOnly:o,provider:l,connector:a},l));return[...n,...r,...i]};import{Fragment as ov,jsx as Hn,jsxs as rv}from"react/jsx-runtime";var Yp=()=>{let{app:e}=_(),t=`Connect a wallet to ${e?.name}`;return rv(ov,{children:[Hn(S,{},"header"),Hn(ro,{title:"Connect your wallet",description:t}),Hn(Xt,{children:Hn(Qr,{connectOnly:!0})}),Hn(G,{protectedByPrivy:!0})]})};import lv from"styled-components";import av from"styled-components";import nv from"react";import{jsx as iv}from"react/jsx-runtime";var Jp=()=>{let{app:e}=_(),t=e?.appearance?.logo,o=`${e?.name} logo`,r={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?iv("img",{src:t,alt:o,style:r}):t.type==="svg"||t.type==="img"?nv.cloneElement(t,{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{jsx as Qp}from"react/jsx-runtime";var Ta=e=>{let{app:t}=_();return t?.appearance.logo?Qp(sv,{...e,children:Qp(Jp,{})}):null},sv=av.div`
867
867
  display: flex;
868
868
  flex-direction: column;
869
869
  align-items: center;
870
870
  padding: 24px 0;
871
871
  flex-grow: 1;
872
872
  justify-content: center;
873
- `;import{Fragment as dv,jsx as Qr,jsxs as pv}from"react/jsx-runtime";var Qp=()=>{let{app:e}=_();return pv(dv,{children:[Qr(S,{},"header"),Qr(cv,{}),Qr(Zt,{children:Qr(Jr,{connectOnly:!0})}),e&&Qr(pa,{app:e,alwaysShowImplicitConsent:!0}),Qr(H,{protectedByPrivy:!0})]})},cv=lv(Ea)`
873
+ `;import{Fragment as dv,jsx as Zr,jsxs as pv}from"react/jsx-runtime";var Zp=()=>{let{app:e}=_();return pv(dv,{children:[Zr(S,{},"header"),Zr(cv,{}),Zr(Xt,{children:Zr(Qr,{connectOnly:!0})}),e&&Zr(ua,{app:e,alwaysShowImplicitConsent:!0}),Zr(G,{protectedByPrivy:!0})]})},cv=lv(Ta)`
874
874
  margin-bottom: 16px;
875
- `;import{useEffect as ou,useState as ru}from"react";import{isMobile as wv}from"react-device-detect";import Cv from"styled-components";import{useEffect as sl,useState as dr}from"react";import{isMobile as Hn}from"react-device-detect";import{useInterval as hv}from"react-use";import Xp from"styled-components";import{useState as uv,useEffect as mv,useCallback as fv}from"react";function Zp(){let[e,t]=uv(!1),o=fv(()=>{document.hidden&&t(!0)},[]);return mv(()=>(document.addEventListener("visibilitychange",o),()=>document.removeEventListener("visibilitychange",o)),[o]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as tu,jsx as ke,jsxs as Gn}from"react/jsx-runtime";var ll=2,cl=e=>e?.privyErrorCode==="linked_to_another_user"?ho.ERROR_USER_EXISTS:e instanceof Le&&!e.details.default?e.details:e instanceof Nr?ho.ERROR_TIMED_OUT:e instanceof Lr?ho.ERROR_USER_REJECTED_CONNECTION:ho.ERROR_WALLET_CONNECTION,eu=()=>{let[e,t]=dr(!1),[o,r]=dr(!1),[n,i]=dr(void 0),{authenticated:a}=B(),{app:l,navigate:s,navigateBack:c,lastScreen:u,currentScreen:h,setModalData:f}=_(),{getAuthFlow:g,walletConnectionStatus:C,closePrivyModal:b,initLoginWithWallet:x,loginWithWallet:E,updateWallets:T}=R(),{walletConnectors:N}=B(),[k,M]=dr(0),{user:L}=B(),[I]=dr(L?.linkedAccounts.length||0),[F,z]=dr(""),[X,O]=dr(!1),{hasTabbedAway:G}=Zp(),{enabled:A,token:se}=ue(),ne=Hn&&C?.connector?.connectorType==="wallet_connect_v2"||Hn&&C?.connector?.connectorType==="coinbase_wallet"||Hn&&C?.connector?.connectorType==="injected"&&C?.connector?.walletClientType==="phantom",J=C?.status==="connected",_t=C?.status==="switching_to_supported_chain";sl(()=>{let U=g();if(J&&!U&&(A&&!se&&!a?(f({captchaModalData:{callback:Be=>x(C.connectedWallet,Be).then(()=>{O(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN",!1)):x(C.connectedWallet,se).then(()=>{O(!0)})),U&&ne&&J&&!U.preparedMessage){U.buildSiweMessage();return}!U||ne||!J||o||(async()=>{r(!0),i(void 0);try{C?.connector?.connectorType==="wallet_connect_v2"&&C?.connector?.walletClientType==="metamask"&&await As(2500),await Je()}catch(Be){console.warn("Auto-prompted signature failed",Be)}finally{r(!1)}})()},[k,J,X]),sl(()=>{if(L&&e){let U=l?.render.inDialog?ze:0,Be=l?.render.inDialog?U-500:0;if(l?.legal.requireUsersAcceptTerms&&!L.hasAcceptedTerms){let Z=setTimeout(()=>{s("AFFIRMATIVE_CONSENT_SCREEN")},Be);return()=>clearTimeout(Z)}if(yt(L,l?.embeddedWallets?.createOnLogin)){let Z=setTimeout(()=>{f({createWallet:{onSuccess:()=>{},onFailure:kt=>console.error(kt),callAuthOnSuccessOnClose:!0}}),s("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},Be);return()=>clearTimeout(Z)}T();let En=setTimeout(b,ze);return()=>clearTimeout(En)}},[L,e]);let me=U=>{if(U?.privyErrorCode==="allowlist_rejected"){s("ALLOWLIST_REJECTION_SCREEN");return}i(cl(U))};async function Je(){try{if(await E(),!l?.render.inDialog)return b();t(!0)}catch(U){me(U)}finally{r(!1)}}sl(()=>{C?.connectError&&me(C?.connectError)},[C]),hv(()=>{let U=Me==="wallet_connect_v2"&&C?.connector instanceof Jt?C.connector.redirectUri:void 0;U&&z(U)},C?.connector instanceof Jt&&!F?500:null);let Me=C?.connector?.connectorType||"injected",oe=C?.connector?.walletClientType||"unknown",uo=ro[oe]?.displayName||C?.connector?.walletBranding.name||"Browser Extension",At=ro[oe]?.logo||C?.connector?.walletBranding.icon||(U=>ke(Dr,{...U})),Pr=uo==="Browser Extension"?uo.toLowerCase():uo,Qe;e?Qe=`Successfully connected with ${Pr}`:n?Qe=n.message:_t?Qe="Switching networks":J?Qe=o&&ne?"Signing":"Sign to verify":Qe=`Waiting for ${Pr}`;let xe="Don\u2019t see your wallet? Check your other browser windows.";if(e){let U=L?.linkedAccounts.length||0;I===U?xe="Wallet was already linked.":xe="You\u2019re good to go!"}else k>=ll&&n?xe="Unable to connect wallet":n?xe=n.detail:_t?xe="Switch your wallet to the requested network.":J&&ne?xe="Sign the message in your wallet to verify it belongs to you.":oe==="metamask"&&Hn?xe="Click continue to open and connect MetaMask.":oe==="metamask"?xe="For the best experience, connect only one wallet at a time.":Me==="wallet_connect"?xe="Open your mobile wallet app to continue":Me==="coinbase_wallet"&&(ld()||(Ns(L)?xe="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":xe="Open the Coinbase app on your phone to continue."));let Vt=N?.walletConnectors?.find(U=>U.walletClientType==="coinbase_wallet"),xr=oe==="coinbase_wallet"&&(Ns(L)||n===ho.ERROR_USER_EXISTS);return Gn(tu,{children:[ke(S,{backFn:!u||h===u?void 0:c}),Gn(gv,{children:[ke(dl,{walletLogo:At,success:e,fail:!!n}),Gn(Et,{children:[ke("h3",{children:Qe}),ke("p",{children:xe}),!J&&F&&!G?Gn("p",{children:["Still here?"," ",ke("a",{href:F,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),xr?ke(D,{onClick:()=>Vt&&Vt?.disconnect(),disabled:e,children:"Use a different wallet"}):n==ho.ERROR_USER_EXISTS&&h!==u?ke(D,{onClick:c,children:"Use a different wallet"}):J&&!e&&ne?ke(D,{onClick:()=>{r(!0),Je(),yv(oe)},disabled:o,children:o?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&k<ll?ke(D,{onClick:()=>{M(k+1),i(void 0),J?(r(!0),Je()):C?.connectRetry()},disabled:!e&&(!n?.retryable||k>=ll),children:"Retry"}):!e&&!n?ke(D,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),ke(K,{})]})},yv=e=>{if(!Hn||!Yd(e))return;let t=Jd(e);t&&window.open(t,"_self","noopener,noreferrer")},gv=Xp.div`
875
+ `;import{useEffect as ru,useState as nu}from"react";import{isMobile as wv}from"react-device-detect";import Cv from"styled-components";import{useEffect as ll,useState as pr}from"react";import{isMobile as Gn}from"react-device-detect";import{useInterval as hv}from"react-use";import eu from"styled-components";import{useState as uv,useEffect as mv,useCallback as fv}from"react";function Xp(){let[e,t]=uv(!1),o=fv(()=>{document.hidden&&t(!0)},[]);return mv(()=>(document.addEventListener("visibilitychange",o),()=>document.removeEventListener("visibilitychange",o)),[o]),{hasTabbedAway:e,reset:()=>t(!1)}}import{Fragment as ou,jsx as Re,jsxs as Vn}from"react/jsx-runtime";var cl=2,dl=e=>e?.privyErrorCode==="linked_to_another_user"?go.ERROR_USER_EXISTS:e instanceof Oe&&!e.details.default?e.details:e instanceof Lr?go.ERROR_TIMED_OUT:e instanceof Or?go.ERROR_USER_REJECTED_CONNECTION:go.ERROR_WALLET_CONNECTION,tu=()=>{let[e,t]=pr(!1),[o,r]=pr(!1),[n,i]=pr(void 0),{authenticated:a}=H(),{app:l,navigate:s,navigateBack:c,lastScreen:u,currentScreen:h,setModalData:f}=_(),{getAuthFlow:g,walletConnectionStatus:C,closePrivyModal:b,initLoginWithWallet:x,loginWithWallet:E,updateWallets:T}=I(),{walletConnectors:L}=H(),[R,N]=pr(0),{user:O}=H(),[W]=pr(O?.linkedAccounts.length||0),[B,$]=pr(""),[ee,D]=pr(!1),{hasTabbedAway:V}=Xp(),{enabled:A,token:le}=me(),ne=Gn&&C?.connector?.connectorType==="wallet_connect_v2"||Gn&&C?.connector?.connectorType==="coinbase_wallet"||Gn&&C?.connector?.connectorType==="injected"&&C?.connector?.walletClientType==="phantom",Q=C?.status==="connected",_t=C?.status==="switching_to_supported_chain";ll(()=>{let k=g();if(Q&&!k&&(A&&!le&&!a?(f({captchaModalData:{callback:He=>x(C.connectedWallet,He).then(()=>{D(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN",!1)):x(C.connectedWallet,le).then(()=>{D(!0)})),k&&ne&&Q&&!k.preparedMessage){k.buildSiweMessage();return}!k||ne||!Q||o||(async()=>{r(!0),i(void 0);try{C?.connector?.connectorType==="wallet_connect_v2"&&C?.connector?.walletClientType==="metamask"&&await ks(2500),await Xe()}catch(He){console.warn("Auto-prompted signature failed",He)}finally{r(!1)}})()},[R,Q,ee]),ll(()=>{if(O&&e){let k=l?.render.inDialog?je:0,He=l?.render.inDialog?k-500:0;if(l?.legal.requireUsersAcceptTerms&&!O.hasAcceptedTerms){let X=setTimeout(()=>{s("AFFIRMATIVE_CONSENT_SCREEN")},He);return()=>clearTimeout(X)}if(yt(O,l?.embeddedWallets?.createOnLogin)){let X=setTimeout(()=>{f({createWallet:{onSuccess:()=>{},onFailure:kt=>console.error(kt),callAuthOnSuccessOnClose:!0}}),s("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},He);return()=>clearTimeout(X)}T();let Tn=setTimeout(b,je);return()=>clearTimeout(Tn)}},[O,e]);let fe=k=>{if(k?.privyErrorCode==="allowlist_rejected"){s("ALLOWLIST_REJECTION_SCREEN");return}i(dl(k))};async function Xe(){try{if(await E(),!l?.render.inDialog)return b();t(!0)}catch(k){fe(k)}finally{r(!1)}}ll(()=>{C?.connectError&&fe(C?.connectError)},[C]),hv(()=>{let k=Ne==="wallet_connect_v2"&&C?.connector instanceof Qt?C.connector.redirectUri:void 0;k&&$(k)},C?.connector instanceof Qt&&!B?500:null);let Ne=C?.connector?.connectorType||"injected",oe=C?.connector?.walletClientType||"unknown",mo=no[oe]?.displayName||C?.connector?.walletBranding.name||"Browser Extension",At=no[oe]?.logo||C?.connector?.walletBranding.icon||(k=>Re(Ur,{...k})),xr=mo==="Browser Extension"?mo.toLowerCase():mo,et;e?et=`Successfully connected with ${xr}`:n?et=n.message:_t?et="Switching networks":Q?et=o&&ne?"Signing":"Sign to verify":et=`Waiting for ${xr}`;let Se="Don\u2019t see your wallet? Check your other browser windows.";if(e){let k=O?.linkedAccounts.length||0;W===k?Se="Wallet was already linked.":Se="You\u2019re good to go!"}else R>=cl&&n?Se="Unable to connect wallet":n?Se=n.detail:_t?Se="Switch your wallet to the requested network.":Q&&ne?Se="Sign the message in your wallet to verify it belongs to you.":oe==="metamask"&&Gn?Se="Click continue to open and connect MetaMask.":oe==="metamask"?Se="For the best experience, connect only one wallet at a time.":Ne==="wallet_connect"?Se="Open your mobile wallet app to continue":Ne==="coinbase_wallet"&&(cd()||(Ls(O)?Se="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":Se="Open the Coinbase app on your phone to continue."));let zt=L?.walletConnectors?.find(k=>k.walletClientType==="coinbase_wallet"),Sr=oe==="coinbase_wallet"&&(Ls(O)||n===go.ERROR_USER_EXISTS);return Vn(ou,{children:[Re(S,{backFn:!u||h===u?void 0:c}),Vn(gv,{children:[Re(pl,{walletLogo:At,success:e,fail:!!n}),Vn(Et,{children:[Re("h3",{children:et}),Re("p",{children:Se}),!Q&&B&&!V?Vn("p",{children:["Still here?"," ",Re("a",{href:B,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Sr?Re(U,{onClick:()=>zt&&zt?.disconnect(),disabled:e,children:"Use a different wallet"}):n==go.ERROR_USER_EXISTS&&h!==u?Re(U,{onClick:c,children:"Use a different wallet"}):Q&&!e&&ne?Re(U,{onClick:()=>{r(!0),Xe(),yv(oe)},disabled:o,children:o?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&R<cl?Re(U,{onClick:()=>{N(R+1),i(void 0),Q?(r(!0),Xe()):C?.connectRetry()},disabled:!e&&(!n?.retryable||R>=cl),children:"Retry"}):!e&&!n?Re(U,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),Re(Y,{})]})},yv=e=>{if(!Gn||!Jd(e))return;let t=Qd(e);t&&window.open(t,"_self","noopener,noreferrer")},gv=eu.div`
876
876
  display: flex;
877
877
  flex-direction: column;
878
878
  align-items: center;
879
879
  justify-content: center;
880
880
  gap: 24px;
881
881
  width: 100%;
882
- `,vv=Xp.div`
882
+ `,vv=eu.div`
883
883
  display: flex;
884
884
  flex-direction: column;
885
885
  justify-content: center;
@@ -902,14 +902,14 @@ Resources:
902
902
  left: -19px;
903
903
  top: -19px;
904
904
  }
905
- `,dl=e=>{let t=e.walletLogo;return ke(tu,{children:ke(vv,{children:Gn("div",{children:[ke(Lo,{success:e.success,fail:e.fail}),typeof t=="string"?ke("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):ke(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as Ev,jsx as vo,jsxs as pl}from"react/jsx-runtime";var Ta=2,nu=()=>{let{navigateBack:e,lastScreen:t,currentScreen:o}=_(),{walletConnectionStatus:r,closePrivyModal:n}=R(),[i,a]=ru(void 0),[l,s]=ru(0),c=r?.status==="connected",u=r?.status==="switching_to_supported_chain";ou(()=>{if(c){let N=setTimeout(n,ze);return()=>clearTimeout(N)}},[c]);let h=N=>{a(cl(N))};ou(()=>{r?.connectError&&h(r?.connectError)},[r]);let f=r?.connector?.connectorType||"injected",g=r?.connector?.walletClientType||"unknown",C=ro[g]?.displayName||r?.connector?.walletBranding.name||"Browser Extension",b=ro[g]?.logo||r?.connector?.walletBranding.icon||(N=>vo(Dr,{...N})),x=C==="Browser Extension"?C.toLowerCase():C,E;c?E=`Successfully connected with ${x}`:i?E=i.message:u?E="Switching networks":E=`Waiting for ${x}`;let T="Don\u2019t see your wallet? Check your other browser windows.";return c?T="You\u2019re good to go!":l>=Ta&&i?T="Unable to connect wallet":i?T=i.detail:u?T="Switch your wallet to the requested network.":g==="metamask"&&wv?T="Click to continue to open and connect MetaMask.":g==="metamask"?T="For the best experience, connect only one wallet at a time.":f==="wallet_connect_v2"?T="Open your mobile wallet app to continue":f==="coinbase_wallet"&&(T="Open the Coinbase app on your phone to continue."),pl(Ev,{children:[vo(S,{backFn:o===t?void 0:e}),pl(bv,{children:[vo(dl,{walletLogo:b,success:c,fail:!!i}),pl(Et,{children:[vo("h3",{children:E}),vo("p",{children:T})]}),i==ho.ERROR_USER_EXISTS?vo(D,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<Ta?vo(D,{onClick:()=>{s(l+1),a(void 0),r?.connectRetry()},disabled:!c&&(!i?.retryable||l>=Ta),children:"Retry"}):!c&&i&&l>=Ta?vo(D,{onClick:e,children:"Use a different wallet"}):null]}),vo(K,{})]})},bv=Cv.div`
905
+ `,pl=e=>{let t=e.walletLogo;return Re(ou,{children:Re(vv,{children:Vn("div",{children:[Re(Oo,{success:e.success,fail:e.fail}),typeof t=="string"?Re("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):Re(t,{style:{width:"38px",height:"38px"}})]})})})};import{Fragment as Ev,jsx as Co,jsxs as ul}from"react/jsx-runtime";var Pa=2,iu=()=>{let{navigateBack:e,lastScreen:t,currentScreen:o}=_(),{walletConnectionStatus:r,closePrivyModal:n}=I(),[i,a]=nu(void 0),[l,s]=nu(0),c=r?.status==="connected",u=r?.status==="switching_to_supported_chain";ru(()=>{if(c){let L=setTimeout(n,je);return()=>clearTimeout(L)}},[c]);let h=L=>{a(dl(L))};ru(()=>{r?.connectError&&h(r?.connectError)},[r]);let f=r?.connector?.connectorType||"injected",g=r?.connector?.walletClientType||"unknown",C=no[g]?.displayName||r?.connector?.walletBranding.name||"Browser Extension",b=no[g]?.logo||r?.connector?.walletBranding.icon||(L=>Co(Ur,{...L})),x=C==="Browser Extension"?C.toLowerCase():C,E;c?E=`Successfully connected with ${x}`:i?E=i.message:u?E="Switching networks":E=`Waiting for ${x}`;let T="Don\u2019t see your wallet? Check your other browser windows.";return c?T="You\u2019re good to go!":l>=Pa&&i?T="Unable to connect wallet":i?T=i.detail:u?T="Switch your wallet to the requested network.":g==="metamask"&&wv?T="Click to continue to open and connect MetaMask.":g==="metamask"?T="For the best experience, connect only one wallet at a time.":f==="wallet_connect_v2"?T="Open your mobile wallet app to continue":f==="coinbase_wallet"&&(T="Open the Coinbase app on your phone to continue."),ul(Ev,{children:[Co(S,{backFn:o===t?void 0:e}),ul(bv,{children:[Co(pl,{walletLogo:b,success:c,fail:!!i}),ul(Et,{children:[Co("h3",{children:E}),Co("p",{children:T})]}),i==go.ERROR_USER_EXISTS?Co(U,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<Pa?Co(U,{onClick:()=>{s(l+1),a(void 0),r?.connectRetry()},disabled:!c&&(!i?.retryable||l>=Pa),children:"Retry"}):!c&&i&&l>=Pa?Co(U,{onClick:e,children:"Use a different wallet"}):null]}),Co(Y,{})]})},bv=Cv.div`
906
906
  display: flex;
907
907
  flex-direction: column;
908
908
  align-items: center;
909
909
  justify-content: center;
910
910
  gap: 24px;
911
911
  width: 100%;
912
- `;import kv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Rv,useMemo as Iv,useState as Wv}from"react";import Mv from"styled-components";import Pa from"styled-components";import{jsx as ul,jsxs as _v}from"react/jsx-runtime";var Zr=()=>ul(Tv,{children:_v(Pv,{children:[ul(xv,{}),ul(Sv,{})]})}),Tv=Pa.div`
912
+ `;import kv from"@heroicons/react/24/solid/XCircleIcon";import{useEffect as Rv,useMemo as Iv,useState as Wv}from"react";import Mv from"styled-components";import xa from"styled-components";import{jsx as ml,jsxs as _v}from"react/jsx-runtime";var Xr=()=>ml(Tv,{children:_v(Pv,{children:[ml(xv,{}),ml(Sv,{})]})}),Tv=xa.div`
913
913
  display: flex;
914
914
  justify-content: center;
915
915
  align-items: center;
@@ -921,14 +921,14 @@ Resources:
921
921
  @media all and (display-mode: standalone) {
922
922
  margin-bottom: 30px;
923
923
  }
924
- `,Pv=Pa.div`
924
+ `,Pv=xa.div`
925
925
  position: relative;
926
926
  height: 140px;
927
927
  width: 140px;
928
928
 
929
929
  opacity: 1;
930
930
  animation: fadein 200ms ease;
931
- `,xv=Pa.div`
931
+ `,xv=xa.div`
932
932
  position: absolute;
933
933
  top: 0;
934
934
  right: 0;
@@ -941,7 +941,7 @@ Resources:
941
941
  border: 4px solid var(--privy-color-accent-light);
942
942
  border-radius: 50%;
943
943
  }
944
- `,Sv=Pa.div`
944
+ `,Sv=xa.div`
945
945
  position: absolute;
946
946
  top: 0;
947
947
  right: 0;
@@ -965,20 +965,20 @@ Resources:
965
965
  transform: rotate(360deg);
966
966
  }
967
967
  }
968
- `;var iu=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var Ee=class extends Error{constructor(o,r){super(r);this.type=o}};function pr(e){let t=e.type;return typeof t=="string"&&iu.includes(t)}function Av(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function ur(e){return pr(e)&&e.type==="wallet_not_on_device"}function au(e){return pr(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function su(e){return!!(pr(e)&&e.type==="insufficient_funds"||e.code==="INSUFFICIENT_FUNDS")}function Xr(e){return!!(pr(e)&&e.type==="mfa_timeout")}function en(e){return!!(pr(e)&&e.type==="missing_or_invalid_mfa")}function ml(e){return!!(pr(e)&&e.type==="mfa_verification_max_attempts_reached")}function fl(e){return!!(pr(e)&&e.message.includes("code 429"))}function hl(e){return!!(Av(e)&&e.message==="MFA canceled")}import{Fragment as cu,jsx as tn,jsxs as yl}from"react/jsx-runtime";var lu=1,du=()=>{let{authenticated:e,user:t,getAccessToken:o}=B(),{closePrivyModal:r,createAnalyticsEvent:n,walletProxy:i}=R(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=Iv(()=>Date.now(),[]),[h,f]=Wv(!1),{onCompleteNavigateTo:g,onFailure:C}=l?.connectWallet,b=E=>{h||(f(!0),C(typeof E=="string"?new Error(E):E))};Rv(()=>{let E=ce(t),T;return!e||!E?b("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let k=await o();if(!k)return b("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:k,address:E.address});let M=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&M<lu?T=setTimeout(()=>{a(g)},(lu-M)*1e3):a(g)}catch(M){if(ur(M)&&E.recoveryMethod==="privy"){let L=await o();if(!L)return b("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:E.address}),(await i?.recover({address:E.address,accessToken:L}))?.address||b(new Error("Unable to recover wallet")),g?a(g):r({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:E.address}),a(g)}catch{b("An error has occurred, please try again.")}}else ur(M)?(s({...l,recoverWallet:{privyWallet:E,onCompleteNavigateTo:g,onFailure:C}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):b(M)}})(),()=>clearTimeout(T)):void 0},[e,t,i]);let x=()=>{b("User exited before wallet could be connected"),r({shouldCallAuthOnSuccess:!1})};return c.current=x,yl(cu,{children:[tn(S,{onClose:x}),h?yl(cu,{children:[yl(Ot,{children:[tn(kv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),tn(be,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),tn(D,{onClick:()=>r({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):tn(Zr,{}),tn(Nv,{})]})},Nv=Mv.div`
968
+ `;var au=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var Te=class extends Error{constructor(o,r){super(r);this.type=o}};function ur(e){let t=e.type;return typeof t=="string"&&au.includes(t)}function Av(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function mr(e){return ur(e)&&e.type==="wallet_not_on_device"}function su(e){return ur(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function lu(e){return!!(ur(e)&&e.type==="insufficient_funds"||e.code==="INSUFFICIENT_FUNDS")}function en(e){return!!(ur(e)&&e.type==="mfa_timeout")}function tn(e){return!!(ur(e)&&e.type==="missing_or_invalid_mfa")}function fl(e){return!!(ur(e)&&e.type==="mfa_verification_max_attempts_reached")}function hl(e){return!!(ur(e)&&e.message.includes("code 429"))}function yl(e){return!!(Av(e)&&e.message==="MFA canceled")}import{Fragment as du,jsx as on,jsxs as gl}from"react/jsx-runtime";var cu=1,pu=()=>{let{authenticated:e,user:t,getAccessToken:o}=H(),{closePrivyModal:r,createAnalyticsEvent:n,walletProxy:i}=I(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=Iv(()=>Date.now(),[]),[h,f]=Wv(!1),{onCompleteNavigateTo:g,onFailure:C}=l?.connectWallet,b=E=>{h||(f(!0),C(typeof E=="string"?new Error(E):E))};Rv(()=>{let E=de(t),T;return!e||!E?b("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let R=await o();if(!R)return b("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:R,address:E.address});let N=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&N<cu?T=setTimeout(()=>{a(g)},(cu-N)*1e3):a(g)}catch(N){if(mr(N)&&E.recoveryMethod==="privy"){let O=await o();if(!O)return b("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:E.address}),(await i?.recover({address:E.address,accessToken:O}))?.address||b(new Error("Unable to recover wallet")),g?a(g):r({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:E.address}),a(g)}catch{b("An error has occurred, please try again.")}}else mr(N)?(s({...l,recoverWallet:{privyWallet:E,onCompleteNavigateTo:g,onFailure:C}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):b(N)}})(),()=>clearTimeout(T)):void 0},[e,t,i]);let x=()=>{b("User exited before wallet could be connected"),r({shouldCallAuthOnSuccess:!1})};return c.current=x,gl(du,{children:[on(S,{onClose:x}),h?gl(du,{children:[gl(Dt,{children:[on(kv,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),on(Ee,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),on(U,{onClick:()=>r({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):on(Xr,{}),on(Nv,{})]})},Nv=Mv.div`
969
969
  height: 44px;
970
- `;import Lv from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as Ov}from"react";import{Fragment as Dv,jsx as on,jsxs as pu}from"react/jsx-runtime";var uu=()=>{let{user:e}=B(),{closePrivyModal:t,isNewUserThisSession:o,updateWallets:r}=R(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let h=ce(e);h?(r(),l(h)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return Ov(()=>{let h=setTimeout(u,Jc);return()=>clearTimeout(h)},[]),a.current=u,pu(Dv,{children:[on(S,{onClose:u}),on(Y,{}),pu(Ot,{children:[on(Lv,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),on(be,{title:o?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:o?"You\u2019ve successfully created an account.":"Your account is secured."})]}),on(Q,{}),on(H,{protectedByPrivy:!0})]})};import Uv from"@heroicons/react/20/solid/ExclamationTriangleIcon";import Fv from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as hu,useRef as Bv,useState as gl}from"react";import Bo from"styled-components";import{Fragment as Yv,jsx as Te,jsxs as Ft}from"react/jsx-runtime";var yu=()=>{let[e,t]=gl(null),{authenticated:o,user:r,getAccessToken:n}=B(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=R(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=ce(r)?.address,{onFailure:h,onSuccess:f,origin:g,appId:C}=s.keyExport,b=E=>{i({shouldCallAuthOnSuccess:!1}),h(typeof E=="string"?new Error(E):E)},x=()=>{i({shouldCallAuthOnSuccess:!1}),f(),a("embedded_wallet_key_export_completed",{walletAddress:u})};return hu(()=>{let E=ce(r);if(!o||!E)return b("User must be authenticated before exporting their wallet");n().then(t,b)},[o,r]),c.current=x,Ft(Yv,{children:[Te(S,{onClose:x}),Ft(Vv,{children:[Ft(be,{icon:Te(Fv,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Ft(jv,{children:[Te(Gv,{style:{marginRight:6}}),Io(u)]}),Te("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Ft(zv,{children:[Ft(mu,{children:[Te(fu,{children:"1"}),Ft("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."]})]}),Ft(mu,{children:[Te(fu,{children:"2"}),Te("span",{children:"Copy this key into your other wallet"})]})]}),Te("div",{style:{width:"100%"},children:e&&Te(Hv,{origin:g,appId:C,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Ft(Kv,{children:[Ft("div",{children:[Te(Uv,{viewBox:"0 0 20 18"}),Te("h4",{children:"Warning"})]}),Te("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),Te(H,{protectedByPrivy:!0})]})};function Hv(e){let[t,o]=gl(e.dimensions.width),[r,n]=gl(void 0),i=Bv(null);return hu(()=>{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&&Ft($v,{children:[Te("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Ri(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...r})}),Te(qv,{children:"Loading..."})]})})}function Gv(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 Vv=Bo.div`
970
+ `;import Lv from"@heroicons/react/24/solid/CheckCircleIcon";import{useEffect as Ov}from"react";import{Fragment as Dv,jsx as rn,jsxs as uu}from"react/jsx-runtime";var mu=()=>{let{user:e}=H(),{closePrivyModal:t,isNewUserThisSession:o,updateWallets:r}=I(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let h=de(e);h?(r(),l(h)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return Ov(()=>{let h=setTimeout(u,Qc);return()=>clearTimeout(h)},[]),a.current=u,uu(Dv,{children:[rn(S,{onClose:u}),rn(J,{}),uu(Dt,{children:[rn(Lv,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),rn(Ee,{title:o?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:o?"You\u2019ve successfully created an account.":"Your account is secured."})]}),rn(Z,{}),rn(G,{protectedByPrivy:!0})]})};import Uv from"@heroicons/react/20/solid/ExclamationTriangleIcon";import Fv from"@heroicons/react/24/outline/ArrowRightOnRectangleIcon";import{useEffect as yu,useRef as Bv,useState as vl}from"react";import Ho from"styled-components";import{Fragment as Yv,jsx as Pe,jsxs as Bt}from"react/jsx-runtime";var gu=()=>{let[e,t]=vl(null),{authenticated:o,user:r,getAccessToken:n}=H(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=I(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=de(r)?.address,{onFailure:h,onSuccess:f,origin:g,appId:C}=s.keyExport,b=E=>{i({shouldCallAuthOnSuccess:!1}),h(typeof E=="string"?new Error(E):E)},x=()=>{i({shouldCallAuthOnSuccess:!1}),f(),a("embedded_wallet_key_export_completed",{walletAddress:u})};return yu(()=>{let E=de(r);if(!o||!E)return b("User must be authenticated before exporting their wallet");n().then(t,b)},[o,r]),c.current=x,Bt(Yv,{children:[Pe(S,{onClose:x}),Bt(Vv,{children:[Bt(Ee,{icon:Pe(Fv,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[Bt(jv,{children:[Pe(Gv,{style:{marginRight:6}}),Wo(u)]}),Pe("p",{children:"You can bring your account with you to another site using an external wallet."})]}),Bt(zv,{children:[Bt(fu,{children:[Pe(hu,{children:"1"}),Bt("span",{children:[Pe("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."]})]}),Bt(fu,{children:[Pe(hu,{children:"2"}),Pe("span",{children:"Copy this key into your other wallet"})]})]}),Pe("div",{style:{width:"100%"},children:e&&Pe(Hv,{origin:g,appId:C,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),Bt(Kv,{children:[Bt("div",{children:[Pe(Uv,{viewBox:"0 0 20 18"}),Pe("h4",{children:"Warning"})]}),Pe("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),Pe(G,{protectedByPrivy:!0})]})};function Hv(e){let[t,o]=vl(e.dimensions.width),[r,n]=vl(void 0),i=Bv(null);return yu(()=>{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")})},[]),Pe("div",{ref:i,children:t&&Bt($v,{children:[Pe("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:Ii(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...r})}),Pe(qv,{children:"Loading..."})]})})}function Gv(e){return Pe("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:Pe("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 Vv=Ho.div`
971
971
  display: flex;
972
972
  flex-direction: column;
973
973
  text-align: left;
974
- `,zv=Bo.div`
974
+ `,zv=Ho.div`
975
975
  display: flex;
976
976
  flex-direction: column;
977
977
  gap: 24px;
978
978
  padding-bottom: 16px;
979
979
  margin-left: 11px;
980
980
  border-left: 1px solid var(--privy-color-foreground-4) !important;
981
- `,mu=Bo.div`
981
+ `,fu=Ho.div`
982
982
  display: flex;
983
983
  align-items: top;
984
984
  gap: 8px;
@@ -987,7 +987,7 @@ Resources:
987
987
  color: var(--privy-color-accent);
988
988
  text-decoration: underline;
989
989
  }
990
- `,fu=Bo.div`
990
+ `,hu=Ho.div`
991
991
  display: flex;
992
992
  align-items: center;
993
993
  justify-content: center;
@@ -1001,11 +1001,11 @@ Resources:
1001
1001
  border-radius: 100%;
1002
1002
  background: var(--privy-color-background);
1003
1003
  color: var(--privy-color-accent);
1004
- `,$v=Bo.div`
1004
+ `,$v=Ho.div`
1005
1005
  overflow: visible;
1006
1006
  position: relative;
1007
1007
  height: 44px;
1008
- `,qv=Bo.div`
1008
+ `,qv=Ho.div`
1009
1009
  position: absolute;
1010
1010
  display: flex;
1011
1011
  align-items: center;
@@ -1017,7 +1017,7 @@ Resources:
1017
1017
  border-radius: var(--privy-border-radius-md);
1018
1018
  background-color: var(--privy-color-background-2);
1019
1019
  color: var(--privy-color-foreground-3);
1020
- `,jv=Bo.div`
1020
+ `,jv=Ho.div`
1021
1021
  display: flex;
1022
1022
  align-items: center;
1023
1023
  padding-top: 1px;
@@ -1030,7 +1030,7 @@ Resources:
1030
1030
  font-size: 12px;
1031
1031
  font-weight: 500;
1032
1032
  margin: auto;
1033
- `,Kv=Bo.div`
1033
+ `,Kv=Ho.div`
1034
1034
  border: 1px solid var(--privy-color-background-2) !important;
1035
1035
  border-radius: var(--privy-border-radius-md);
1036
1036
  padding: 16px;
@@ -1052,7 +1052,7 @@ Resources:
1052
1052
  color: var(--privy-color-error);
1053
1053
  }
1054
1054
  }
1055
- `;import Gw from"@heroicons/react/24/outline/XCircleIcon";import{useEffect as Gu,useRef as Vw,useState as Kn}from"react";import zw from"styled-components";import{useCallback as Hu,useEffect as Hw}from"react";import ew from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as tw,useState as Cl}from"react";import Jv from"@heroicons/react/24/outline/ArrowPathIcon";import Qv from"@heroicons/react/24/outline/EyeIcon";import Zv from"@heroicons/react/24/outline/EyeSlashIcon";import Ue,{css as vl}from"styled-components";var Xv=vl`
1055
+ `;import Gw from"@heroicons/react/24/outline/XCircleIcon";import{useEffect as Vu,useRef as Vw,useState as Yn}from"react";import zw from"styled-components";import{useCallback as Gu,useEffect as Hw}from"react";import ew from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useEffect as tw,useState as bl}from"react";import Jv from"@heroicons/react/24/outline/ArrowPathIcon";import Qv from"@heroicons/react/24/outline/EyeIcon";import Zv from"@heroicons/react/24/outline/EyeSlashIcon";import Fe,{css as wl}from"styled-components";var Xv=wl`
1056
1056
  font-size: 14px;
1057
1057
  font-style: normal;
1058
1058
  font-weight: 400;
@@ -1060,7 +1060,7 @@ Resources:
1060
1060
  letter-spacing: -0.008px;
1061
1061
  text-align: left;
1062
1062
  transition: color 0.1s ease-in;
1063
- `,xa=Ue.span`
1063
+ `,Sa=Fe.span`
1064
1064
  ${Xv}
1065
1065
  transition: color 0.1s ease-in;
1066
1066
  color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
@@ -1069,18 +1069,18 @@ Resources:
1069
1069
  &[aria-hidden='true'] {
1070
1070
  visibility: hidden;
1071
1071
  }
1072
- `,Ho=Ue.div`
1072
+ `,Go=Fe.div`
1073
1073
  display: flex;
1074
1074
  flex-direction: column;
1075
1075
  justify-content: center;
1076
1076
  flex-grow: 1;
1077
- `,Go=Ue(D)`
1078
- ${e=>e.hideAnimations&&vl`
1077
+ `,Vo=Fe(U)`
1078
+ ${e=>e.hideAnimations&&wl`
1079
1079
  && {
1080
1080
  transition: none;
1081
1081
  }
1082
1082
  `}
1083
- `,gu=vl`
1083
+ `,vu=wl`
1084
1084
  && {
1085
1085
  width: 100%;
1086
1086
  border-width: 1px;
@@ -1095,23 +1095,23 @@ Resources:
1095
1095
  font-weight: 300;
1096
1096
  line-height: 22px; /* 137.5% */
1097
1097
  }
1098
- `,mr=Ue.input`
1099
- ${gu}
1098
+ `,fr=Fe.input`
1099
+ ${vu}
1100
1100
 
1101
1101
  &::placeholder {
1102
1102
  color: var(--privy-color-foreground-3);
1103
1103
  font-style: italic;
1104
1104
  font-size: 14px;
1105
1105
  }
1106
- `,vu=Ue.div`
1107
- ${gu}
1108
- `,Vo=Ue.div`
1106
+ `,wu=Fe.div`
1107
+ ${vu}
1108
+ `,zo=Fe.div`
1109
1109
  position: relative;
1110
1110
  width: 100%;
1111
1111
  display: flex;
1112
1112
  align-items: center;
1113
1113
  justify-content: ${({centered:e})=>e?"center":"space-between"};
1114
- `,zo=Ue.div`
1114
+ `,$o=Fe.div`
1115
1115
  display: flex;
1116
1116
  flex-direction: column;
1117
1117
  align-items: center;
@@ -1133,12 +1133,12 @@ Resources:
1133
1133
  font-weight: 400;
1134
1134
  line-height: 20px;
1135
1135
  }
1136
- `,Vn=Ue.div`
1136
+ `,zn=Fe.div`
1137
1137
  display: flex;
1138
1138
  flex-direction: column;
1139
1139
  gap: 10px;
1140
1140
  padding-bottom: 1rem;
1141
- `,zn=Ue.div`
1141
+ `,$n=Fe.div`
1142
1142
  display: flex;
1143
1143
  text-align: left;
1144
1144
  align-items: center;
@@ -1158,13 +1158,13 @@ Resources:
1158
1158
  > :first-child {
1159
1159
  min-width: 24px;
1160
1160
  }
1161
- `,OA=Ue.div`
1161
+ `,G6=Fe.div`
1162
1162
  height: var(--privy-height-modal-full);
1163
1163
 
1164
1164
  @media (max-width: 440px) {
1165
1165
  height: var(--privy-height-modal-compact);
1166
1166
  }
1167
- `,wl=Ue(aa)`
1167
+ `,Cl=Fe(sa)`
1168
1168
  display: flex;
1169
1169
  flex: 1;
1170
1170
  gap: 4px;
@@ -1176,7 +1176,7 @@ Resources:
1176
1176
  border-color: var(--privy-color-foreground-3);
1177
1177
  border-width: 1px;
1178
1178
  }
1179
- `,rn=Ue.div`
1179
+ `,nn=Fe.div`
1180
1180
  position: absolute;
1181
1181
  right: 0.5rem;
1182
1182
 
@@ -1184,7 +1184,7 @@ Resources:
1184
1184
  flex-direction: row;
1185
1185
  justify-content: space-around;
1186
1186
  align-items: center;
1187
- `,wu=Ue(Jv)`
1187
+ `,Cu=Fe(Jv)`
1188
1188
  height: 1.25rem;
1189
1189
  width: 1.25rem;
1190
1190
  stroke: var(--privy-color-accent);
@@ -1193,7 +1193,7 @@ Resources:
1193
1193
  :active {
1194
1194
  stroke: var(--privy-color-accent-light);
1195
1195
  }
1196
- `,nn=Ue(Zv)`
1196
+ `,an=Fe(Zv)`
1197
1197
  height: 1.25rem;
1198
1198
  width: 1.25rem;
1199
1199
  stroke: var(--privy-color-accent);
@@ -1202,7 +1202,7 @@ Resources:
1202
1202
  :active {
1203
1203
  stroke: var(--privy-color-accent-light);
1204
1204
  }
1205
- `,an=Ue(Qv)`
1205
+ `,sn=Fe(Qv)`
1206
1206
  height: 1.25rem;
1207
1207
  width: 1.25rem;
1208
1208
  stroke: var(--privy-color-accent);
@@ -1211,7 +1211,7 @@ Resources:
1211
1211
  :active {
1212
1212
  stroke: var(--privy-color-accent-light);
1213
1213
  }
1214
- `,Cu=Ue.progress`
1214
+ `,bu=Fe.progress`
1215
1215
  height: 4px;
1216
1216
  width: 100%;
1217
1217
  margin: 8px 0;
@@ -1227,14 +1227,14 @@ Resources:
1227
1227
  transition: all 0.1s ease-out;
1228
1228
  background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
1229
1229
  }
1230
- `;import{Fragment as ow,jsx as pt,jsxs as Sa}from"react/jsx-runtime";var bu=({buttonHideAnimations:e,buttonLoading:t,password:o,onSubmit:r,onBack:n})=>{let[i,a]=Cl(!0),[l,s]=Cl(!1),[c,u]=Cl(""),h=o===c;return tw(()=>{c&&!l&&s(!0)},[c]),Sa(ow,{children:[pt(S,{title:"Confirm Password",closeable:!1,backFn:n}),pt(Y,{}),Sa(Ho,{children:[Sa(zo,{children:[pt(ew,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),pt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),pt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),Sa(Vo,{children:[pt(mr,{value:c,onChange:f=>u(f.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text"}),pt(rn,{style:{right:"0.75rem"},children:i?pt(nn,{onClick:()=>a(!1)}):pt(an,{onClick:()=>a(!0)})})]}),pt(xa,{"aria-hidden":!l||h,error:!0,children:"Passwords do not match"})]}),pt(Go,{onClick:r,loading:t,disabled:!h,hideAnimations:e,children:"Continue"}),pt(Q,{}),pt(H,{protectedByPrivy:!0})]})};import aw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as sw}from"react";import lw from"styled-components";import _a from"styled-components";import{jsx as $n,jsxs as iw}from"react/jsx-runtime";var Eu=({className:e,checked:t,color:o="var(--privy-color-accent)",...r})=>$n("label",{children:iw(rw,{className:e,children:[$n(Pu,{checked:t,...r}),$n(nw,{color:o,checked:t,children:$n(Tu,{viewBox:"0 0 24 24",children:$n("polyline",{points:"20 6 9 17 4 12"})})})]})}),rw=_a.div`
1230
+ `;import{Fragment as ow,jsx as ut,jsxs as _a}from"react/jsx-runtime";var Eu=({buttonHideAnimations:e,buttonLoading:t,password:o,onSubmit:r,onBack:n})=>{let[i,a]=bl(!0),[l,s]=bl(!1),[c,u]=bl(""),h=o===c;return tw(()=>{c&&!l&&s(!0)},[c]),_a(ow,{children:[ut(S,{title:"Confirm Password",closeable:!1,backFn:n}),ut(J,{}),_a(Go,{children:[_a($o,{children:[ut(ew,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),ut("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),ut("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),_a(zo,{children:[ut(fr,{value:c,onChange:f=>u(f.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text"}),ut(nn,{style:{right:"0.75rem"},children:i?ut(an,{onClick:()=>a(!1)}):ut(sn,{onClick:()=>a(!0)})})]}),ut(Sa,{"aria-hidden":!l||h,error:!0,children:"Passwords do not match"})]}),ut(Vo,{onClick:r,loading:t,disabled:!h,hideAnimations:e,children:"Continue"}),ut(Z,{}),ut(G,{protectedByPrivy:!0})]})};import aw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as sw}from"react";import lw from"styled-components";import Aa from"styled-components";import{jsx as qn,jsxs as iw}from"react/jsx-runtime";var Tu=({className:e,checked:t,color:o="var(--privy-color-accent)",...r})=>qn("label",{children:iw(rw,{className:e,children:[qn(xu,{checked:t,...r}),qn(nw,{color:o,checked:t,children:qn(Pu,{viewBox:"0 0 24 24",children:qn("polyline",{points:"20 6 9 17 4 12"})})})]})}),rw=Aa.div`
1231
1231
  display: inline-block;
1232
1232
  vertical-align: middle;
1233
- `,Tu=_a.svg`
1233
+ `,Pu=Aa.svg`
1234
1234
  fill: none;
1235
1235
  stroke: white;
1236
1236
  stroke-width: 3px;
1237
- `,Pu=_a.input.attrs({type:"checkbox"})`
1237
+ `,xu=Aa.input.attrs({type:"checkbox"})`
1238
1238
  border: 0;
1239
1239
  clip: rect(0 0 0 0);
1240
1240
  clippath: inset(50%);
@@ -1245,7 +1245,7 @@ Resources:
1245
1245
  position: absolute;
1246
1246
  white-space: nowrap;
1247
1247
  width: 1px;
1248
- `,nw=_a.div`
1248
+ `,nw=Aa.div`
1249
1249
  display: inline-block;
1250
1250
  width: 18px;
1251
1251
  height: 18px;
@@ -1260,30 +1260,30 @@ Resources:
1260
1260
  border-width: 1px;
1261
1261
  }
1262
1262
 
1263
- ${Pu}:focus + & {
1263
+ ${xu}:focus + & {
1264
1264
  box-shadow: 0 0 0 1px ${e=>e.color};
1265
1265
  }
1266
1266
 
1267
- ${Tu} {
1267
+ ${Pu} {
1268
1268
  visibility: ${e=>e.checked?"visible":"hidden"};
1269
1269
  }
1270
- `;import{Fragment as xu,jsx as Tt,jsxs as qn}from"react/jsx-runtime";var Su=({buttonHideAnimations:e,buttonLoading:t,onSubmit:o,onBack:r,config:n})=>{let[i,a]=sw(!1);return qn(xu,{children:[Tt(S,{title:"Confirm Password",closeable:!1,backFn:r}),Tt(Y,{}),qn(Ho,{children:[qn(zo,{children:[Tt(aw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),Tt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),Tt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),Tt(Vn,{children:qn(zn,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[Tt(Eu,{color:"var(--privy-color-error)",checked:i}),Tt(xu,{children:"I understand losing my password means losing my account."})]})})]}),qn(cw,{children:[n.initiatedBy==="user"&&Tt(Lt,{onClick:n.onCancel,disabled:t,children:"Cancel"}),Tt(Go,{onClick:o,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),Tt(Q,{}),Tt(H,{protectedByPrivy:!0})]})},cw=lw.div`
1270
+ `;import{Fragment as Su,jsx as Tt,jsxs as jn}from"react/jsx-runtime";var _u=({buttonHideAnimations:e,buttonLoading:t,onSubmit:o,onBack:r,config:n})=>{let[i,a]=sw(!1);return jn(Su,{children:[Tt(S,{title:"Confirm Password",closeable:!1,backFn:r}),Tt(J,{}),jn(Go,{children:[jn($o,{children:[Tt(aw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),Tt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),Tt("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),Tt(zn,{children:jn($n,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[Tt(Tu,{color:"var(--privy-color-error)",checked:i}),Tt(Su,{children:"I understand losing my password means losing my account."})]})})]}),jn(cw,{children:[n.initiatedBy==="user"&&Tt(Ot,{onClick:n.onCancel,disabled:t,children:"Cancel"}),Tt(Vo,{onClick:o,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),Tt(Z,{}),Tt(G,{protectedByPrivy:!0})]})},cw=lw.div`
1271
1271
  display: flex;
1272
1272
  gap: 10px;
1273
- `;import xw from"@heroicons/react/24/outline/KeyIcon";import Mu from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Nu,useMemo as bl,useEffect as Sw}from"react";import Lu from"styled-components";import dw from"fast-password-entropy";import*as _u from"secure-password-utilities";import{DEFAULT_WORDLIST as pw}from"secure-password-utilities/wordlists";var uw=95,mw=8,fw=3,hw=.3,yw=/[a-z]/,gw=/[A-Z]/,vw=/[0-9]/,ww="a-zA-Z0-9",Au="!@#$%^&*()\\-_+.",ku=`${ww}${Au}`,Cw=new RegExp(`[${Au}]`),bw=new RegExp(`[${ku}]`),Ru=new RegExp(`^[${ku}]{6,}$`),Iu=(e="")=>{let t=e.split("").filter(o=>!bw.test(o)).map(o=>o.replace(" ","SPACE"));return[...new Set(t)]},Aa=()=>_u.generatePassphrase(4,pw);function Ew(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Tw(e){if(e.length<mw)return 0;let t=0;yw.test(e)&&(t+=1),gw.test(e)&&(t+=1),vw.test(e)&&(t+=1),Cw.test(e)&&(t+=1);let o=t/fw;return Math.max(0,Math.min(1,o))}function Pw(e=""){let t=Tw(e),o=dw(e)/uw;return(t*hw+o)/2}function Wu(e=""){let t=Pw(e);return{value:t,label:Ew(t)}}import{Fragment as kw,jsx as Re,jsxs as wo}from"react/jsx-runtime";var Ou=({buttonHideAnimations:e,buttonLoading:t,password:o="",config:r,onSubmit:n,onClose:i,onPasswordChange:a,onPasswordGenerate:l})=>{let[s,c]=Nu(!1),[u,h]=Nu(!1);Sw(()=>{o&&!u&&h(!0)},[o]);let f=bl(()=>u?(o?.length||0)<6?"Password must be at least 6 characters":Ru.test(o||"")?null:`Invalid characters used ( ${Iu(o).join(" ")} )`:null,[o,u]),g=bl(()=>f?{value:0,label:"Weak"}:Wu(o),[o,f]),C=bl(()=>!!(!o?.length||f),[f,o]);return wo(kw,{children:[Re(S,{onClose:i,title:"Secure your account",closeable:r.initiatedBy==="user"}),Re(Y,{}),wo(Ho,{children:[wo(zo,{children:[Re(xw,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Re("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),Re("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),wo(Vo,{children:[Re(mr,{value:o,onChange:b=>a(b.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text"}),wo(rn,{style:{width:"3.5rem"},children:[s?Re(nn,{onClick:()=>c(!1)}):Re(an,{onClick:()=>c(!0)}),Re(wu,{onClick:l})]})]}),Re(Cu,{value:g.value===0?.01:g.value,label:g.label}),Re(xa,{error:!!f,children:f||`Password Strength: ${u?g.label:"--"}`}),wo(Aw,{children:[Re(_w,{children:wo(Vn,{children:[wo(zn,{children:[Re(Mu,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),wo(zn,{children:[Re(Mu,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),Re(Go,{onClick:n,loading:t,disabled:C,hideAnimations:e,children:"Continue"})]})]}),Re(Q,{}),Re(H,{protectedByPrivy:!0})]})},_w=Lu(Vn)`
1273
+ `;import xw from"@heroicons/react/24/outline/KeyIcon";import Nu from"@heroicons/react/24/solid/CheckCircleIcon";import{useState as Lu,useMemo as El,useEffect as Sw}from"react";import Ou from"styled-components";import dw from"fast-password-entropy";import*as Au from"secure-password-utilities";import{DEFAULT_WORDLIST as pw}from"secure-password-utilities/wordlists";var uw=95,mw=8,fw=3,hw=.3,yw=/[a-z]/,gw=/[A-Z]/,vw=/[0-9]/,ww="a-zA-Z0-9",ku="!@#$%^&*()\\-_+.",Ru=`${ww}${ku}`,Cw=new RegExp(`[${ku}]`),bw=new RegExp(`[${Ru}]`),Iu=new RegExp(`^[${Ru}]{6,}$`),Wu=(e="")=>{let t=e.split("").filter(o=>!bw.test(o)).map(o=>o.replace(" ","SPACE"));return[...new Set(t)]},ka=()=>Au.generatePassphrase(4,pw);function Ew(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Tw(e){if(e.length<mw)return 0;let t=0;yw.test(e)&&(t+=1),gw.test(e)&&(t+=1),vw.test(e)&&(t+=1),Cw.test(e)&&(t+=1);let o=t/fw;return Math.max(0,Math.min(1,o))}function Pw(e=""){let t=Tw(e),o=dw(e)/uw;return(t*hw+o)/2}function Mu(e=""){let t=Pw(e);return{value:t,label:Ew(t)}}import{Fragment as kw,jsx as Ie,jsxs as bo}from"react/jsx-runtime";var Du=({buttonHideAnimations:e,buttonLoading:t,password:o="",config:r,onSubmit:n,onClose:i,onPasswordChange:a,onPasswordGenerate:l})=>{let[s,c]=Lu(!1),[u,h]=Lu(!1);Sw(()=>{o&&!u&&h(!0)},[o]);let f=El(()=>u?(o?.length||0)<6?"Password must be at least 6 characters":Iu.test(o||"")?null:`Invalid characters used ( ${Wu(o).join(" ")} )`:null,[o,u]),g=El(()=>f?{value:0,label:"Weak"}:Mu(o),[o,f]),C=El(()=>!!(!o?.length||f),[f,o]);return bo(kw,{children:[Ie(S,{onClose:i,title:"Secure your account",closeable:r.initiatedBy==="user"}),Ie(J,{}),bo(Go,{children:[bo($o,{children:[Ie(xw,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ie("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),Ie("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),bo(zo,{children:[Ie(fr,{value:o,onChange:b=>a(b.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text"}),bo(nn,{style:{width:"3.5rem"},children:[s?Ie(an,{onClick:()=>c(!1)}):Ie(sn,{onClick:()=>c(!0)}),Ie(Cu,{onClick:l})]})]}),Ie(bu,{value:g.value===0?.01:g.value,label:g.label}),Ie(Sa,{error:!!f,children:f||`Password Strength: ${u?g.label:"--"}`}),bo(Aw,{children:[Ie(_w,{children:bo(zn,{children:[bo($n,{children:[Ie(Nu,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),bo($n,{children:[Ie(Nu,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),Ie(Vo,{onClick:n,loading:t,disabled:C,hideAnimations:e,children:"Continue"})]})]}),Ie(Z,{}),Ie(G,{protectedByPrivy:!0})]})},_w=Ou(zn)`
1274
1274
  flex: 1;
1275
1275
  padding-top: 1rem;
1276
- `,Aw=Lu.div`
1276
+ `,Aw=Ou.div`
1277
1277
  display: flex;
1278
1278
  flex-direction: column;
1279
1279
  height: 100%;
1280
- `;import Rw from"@heroicons/react/24/outline/ArrowDownTrayIcon";import Iw from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Ww from"@heroicons/react/24/outline/DocumentDuplicateIcon";import Mw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Nw,useCallback as Du}from"react";import{Fragment as El,jsx as nt,jsxs as fr}from"react/jsx-runtime";var Uu=({buttonHideAnimations:e,buttonLoading:t,appName:o,password:r,onSubmit:n,onBack:i})=>{let[a,l]=Nw(!1),s=Du(()=>{l(!0),r&&navigator.clipboard.writeText(r)},[r]),c=Du(()=>{let u=document.createElement("a"),h=o.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),f=new Blob([Lw(o,r)],{type:"text/plain"}),g=URL.createObjectURL(f);u.href=g,u.target="_blank",u.download=`${h}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[r]);return fr(El,{children:[nt(S,{backFn:i,title:"Save Password",closeable:!1}),nt(Y,{}),fr(Ho,{children:[fr(zo,{children:[nt(Mw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),nt("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),nt("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."})]}),nt(Vo,{centered:!0,children:nt(vu,{children:r})}),fr("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[nt(wl,{onClick:s,children:a?fr(El,{children:[nt(Iw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):fr(El,{children:[nt(Ww,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),fr(wl,{onClick:c,children:[nt(Rw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),nt(Go,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),nt(Q,{}),nt(H,{protectedByPrivy:!0})]})},Lw=(e,t)=>`Your wallet recovery password for ${e} is
1280
+ `;import Rw from"@heroicons/react/24/outline/ArrowDownTrayIcon";import Iw from"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import Ww from"@heroicons/react/24/outline/DocumentDuplicateIcon";import Mw from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{useState as Nw,useCallback as Uu}from"react";import{Fragment as Tl,jsx as it,jsxs as hr}from"react/jsx-runtime";var Fu=({buttonHideAnimations:e,buttonLoading:t,appName:o,password:r,onSubmit:n,onBack:i})=>{let[a,l]=Nw(!1),s=Uu(()=>{l(!0),r&&navigator.clipboard.writeText(r)},[r]),c=Uu(()=>{let u=document.createElement("a"),h=o.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),f=new Blob([Lw(o,r)],{type:"text/plain"}),g=URL.createObjectURL(f);u.href=g,u.target="_blank",u.download=`${h}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[r]);return hr(Tl,{children:[it(S,{backFn:i,title:"Save Password",closeable:!1}),it(J,{}),hr(Go,{children:[hr($o,{children:[it(Mw,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),it("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),it("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."})]}),it(zo,{centered:!0,children:it(wu,{children:r})}),hr("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[it(Cl,{onClick:s,children:a?hr(Tl,{children:[it(Iw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):hr(Tl,{children:[it(Ww,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),hr(Cl,{onClick:c,children:[it(Rw,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),it(Vo,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),it(Z,{}),it(G,{protectedByPrivy:!0})]})},Lw=(e,t)=>`Your wallet recovery password for ${e} is
1281
1281
 
1282
1282
  ${t}
1283
1283
 
1284
- You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import Ow from"@heroicons/react/24/outline/CheckCircleIcon";import Dw from"@heroicons/react/24/outline/XCircleIcon";import{Fragment as Uw,jsx as Co,jsxs as Tl}from"react/jsx-runtime";var Fu=({error:e,onClose:t})=>Tl(Uw,{children:[Co(S,{closeable:!1}),Co(Y,{}),e?Tl(Ot,{children:[Co(Dw,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}),Co(be,{title:"Something went wrong",description:e})]}):Tl(Ot,{children:[Co(Ow,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),Co(be,{title:"Success"})]}),Co(D,{onClick:t,children:"Close"}),Co(Q,{}),Co(H,{protectedByPrivy:!0})]});import{useReducer as Fw}from"react";var Bw=(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}},Bu=()=>{let[e,t]=Fw(Bw,"creating");return{send:t,state:e}};import{jsx as jn}from"react/jsx-runtime";var ka=({onSubmit:e,...t})=>{let{send:o,state:r}=Bu(),n=Hu(async()=>{r==="finalizing"&&await e(),o("next")},[r,o,e]);Hw(()=>{let a;return r==="done"&&t.config.initiatedBy==="automatic"&&(a=setTimeout(()=>t.onClose?.(),ze)),()=>{a&&clearTimeout(a)}},[r,t.config.initiatedBy,t.onClose]);let i=Hu(()=>{o("back")},[o]);return r==="creating"?jn(Ou,{...t,onSubmit:n}):r==="saving"?jn(Uu,{...t,onSubmit:n,onBack:i}):r==="confirming"?jn(bu,{...t,onSubmit:n,onBack:i}):r==="finalizing"?jn(Su,{...t,onSubmit:n,onBack:i}):r==="done"?jn(Fu,{...t,onSubmit:n}):null};import{Fragment as qw,jsx as hr,jsxs as Vu}from"react/jsx-runtime";var zu=()=>{let{app:e,navigate:t,data:o,onUserCloseViaDialogOrKeybindRef:r}=_(),[n,i]=Kn(""),[a,l]=Kn(!1),[s,c]=Kn(),[u,h]=Kn(null),[f,g]=Kn(null),C=Vw(!1),{authenticated:b,getAccessToken:x}=B(),{refreshUser:E,closePrivyModal:T,createAnalyticsEvent:N,isNewUserThisSession:k,initializeWalletProxy:M}=R(),{onSuccess:L,onFailure:I,callAuthOnSuccessOnClose:F}=o.createWallet,z=e?.embeddedWallets.requireUserPasswordOnCreate===!0,X=!!(!n||C.current)&&!z,O=new Ve(async()=>A());Gu(()=>{u||M(3e4).then(ne=>h(ne))},[u]),Gu(()=>{if(!b){t("LANDING"),I(new Error("User must be authenticated before creating a Privy wallet"));return}!z&&!a&&!C.current&&(l(!0),O.execute().finally(()=>l(!1)))},[z,b]);let G=()=>{z&&f&&f?.recoveryMethod!=="user-passcode"?I(new at("User created a wallet but failed to set a password for it")):f?L(f):I(new at("User wallet creation failed")),T({shouldCallAuthOnSuccess:F})};r.current=()=>null;let A=async function(){let ne=await x();if(ne)try{N("embedded_wallet_creation_started");let J=await M(Wr);if(!J)throw new Error("walletProxy does not exist.");let _t=1e4,me=new Promise((uo,At)=>{setTimeout(()=>{At(new Error("walletProxy.create timed out."))},_t)});if(!await Promise.race([J.create({accessToken:ne,recoveryPassword:s}),me]))throw new Error("walletProxy.create did not send a response.");let Me=await E();if(!Me)throw new Error("Failed to refresh user.");let oe=ce(Me);if(!oe)throw new Error("Updated user is missing embedded wallet.");g(oe),N("embedded_wallet_creation_completed",{walletAddress:oe.address}),i(""),C.current=!0,z?t("EMBEDDED_WALLET_CREATED_SCREEN"):k?t("EMBEDDED_WALLET_CREATED_SCREEN"):oe&&(L(oe),T({shouldCallAuthOnSuccess:F}))}catch(J){if(C.current)return;N("embedded_wallet_creation_failed",{error:J.toString()}),i("An error has occurred, please try again."),console.warn(J)}else i("An error has occured, please login again."),N("embedded_wallet_creation_failed",{error:"Missing access token for user."})},se=async()=>{if(!z)return T({shouldCallAuthOnSuccess:F});l(!0);let ne=250;return O.execute().then(()=>new Promise(J=>setTimeout(J,ne))).finally(()=>l(!1))};return!z&&n?Vu(qw,{children:[hr(S,{closeable:!1}),Vu(Ot,{children:[hr(Gw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),hr(be,{title:"Something went wrong",description:n})]}),hr(D,{onClick:G,children:"Close"}),hr($w,{})]}):X?hr(Zr,{}):hr(ka,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:X||!u,buttonLoading:a,buttonHideAnimations:!f&&a,error:n,password:s||"",onClose:G,onPasswordChange:c,onPasswordGenerate:()=>c(Aa()),onSubmit:se})},$w=zw.div`
1284
+ You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;import Ow from"@heroicons/react/24/outline/CheckCircleIcon";import Dw from"@heroicons/react/24/outline/XCircleIcon";import{Fragment as Uw,jsx as Eo,jsxs as Pl}from"react/jsx-runtime";var Bu=({error:e,onClose:t})=>Pl(Uw,{children:[Eo(S,{closeable:!1}),Eo(J,{}),e?Pl(Dt,{children:[Eo(Dw,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}),Eo(Ee,{title:"Something went wrong",description:e})]}):Pl(Dt,{children:[Eo(Ow,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),Eo(Ee,{title:"Success"})]}),Eo(U,{onClick:t,children:"Close"}),Eo(Z,{}),Eo(G,{protectedByPrivy:!0})]});import{useReducer as Fw}from"react";var Bw=(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}},Hu=()=>{let[e,t]=Fw(Bw,"creating");return{send:t,state:e}};import{jsx as Kn}from"react/jsx-runtime";var Ra=({onSubmit:e,...t})=>{let{send:o,state:r}=Hu(),n=Gu(async()=>{r==="finalizing"&&await e(),o("next")},[r,o,e]);Hw(()=>{let a;return r==="done"&&t.config.initiatedBy==="automatic"&&(a=setTimeout(()=>t.onClose?.(),je)),()=>{a&&clearTimeout(a)}},[r,t.config.initiatedBy,t.onClose]);let i=Gu(()=>{o("back")},[o]);return r==="creating"?Kn(Du,{...t,onSubmit:n}):r==="saving"?Kn(Fu,{...t,onSubmit:n,onBack:i}):r==="confirming"?Kn(Eu,{...t,onSubmit:n,onBack:i}):r==="finalizing"?Kn(_u,{...t,onSubmit:n,onBack:i}):r==="done"?Kn(Bu,{...t,onSubmit:n}):null};import{Fragment as qw,jsx as yr,jsxs as zu}from"react/jsx-runtime";var $u=()=>{let{app:e,navigate:t,data:o,onUserCloseViaDialogOrKeybindRef:r}=_(),[n,i]=Yn(""),[a,l]=Yn(!1),[s,c]=Yn(),[u,h]=Yn(null),[f,g]=Yn(null),C=Vw(!1),{authenticated:b,getAccessToken:x}=H(),{refreshUser:E,closePrivyModal:T,createAnalyticsEvent:L,isNewUserThisSession:R,initializeWalletProxy:N}=I(),{onSuccess:O,onFailure:W,callAuthOnSuccessOnClose:B}=o.createWallet,$=e?.embeddedWallets.requireUserPasswordOnCreate===!0,ee=!!(!n||C.current)&&!$,D=new qe(async()=>A());Vu(()=>{u||N(3e4).then(ne=>h(ne))},[u]),Vu(()=>{if(!b){t("LANDING"),W(new Error("User must be authenticated before creating a Privy wallet"));return}!$&&!a&&!C.current&&(l(!0),D.execute().finally(()=>l(!1)))},[$,b]);let V=()=>{$&&f&&f?.recoveryMethod!=="user-passcode"?W(new st("User created a wallet but failed to set a password for it")):f?O(f):W(new st("User wallet creation failed")),T({shouldCallAuthOnSuccess:B})};r.current=()=>null;let A=async function(){let ne=await x();if(ne)try{L("embedded_wallet_creation_started");let Q=await N(Mr);if(!Q)throw new Error("walletProxy does not exist.");let _t=1e4,fe=new Promise((mo,At)=>{setTimeout(()=>{At(new Error("walletProxy.create timed out."))},_t)});if(!await Promise.race([Q.create({accessToken:ne,recoveryPassword:s}),fe]))throw new Error("walletProxy.create did not send a response.");let Ne=await E();if(!Ne)throw new Error("Failed to refresh user.");let oe=de(Ne);if(!oe)throw new Error("Updated user is missing embedded wallet.");g(oe),L("embedded_wallet_creation_completed",{walletAddress:oe.address}),i(""),C.current=!0,$?t("EMBEDDED_WALLET_CREATED_SCREEN"):R?t("EMBEDDED_WALLET_CREATED_SCREEN"):oe&&(O(oe),T({shouldCallAuthOnSuccess:B}))}catch(Q){if(C.current)return;L("embedded_wallet_creation_failed",{error:Q.toString()}),i("An error has occurred, please try again."),console.warn(Q)}else i("An error has occured, please login again."),L("embedded_wallet_creation_failed",{error:"Missing access token for user."})},le=async()=>{if(!$)return T({shouldCallAuthOnSuccess:B});l(!0);let ne=250;return D.execute().then(()=>new Promise(Q=>setTimeout(Q,ne))).finally(()=>l(!1))};return!$&&n?zu(qw,{children:[yr(S,{closeable:!1}),zu(Dt,{children:[yr(Gw,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),yr(Ee,{title:"Something went wrong",description:n})]}),yr(U,{onClick:V,children:"Close"}),yr($w,{})]}):ee?yr(Xr,{}):yr(Ra,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:ee||!u,buttonLoading:a,buttonHideAnimations:!f&&a,error:n,password:s||"",onClose:V,onPasswordChange:c,onPasswordGenerate:()=>c(ka()),onSubmit:le})},$w=zw.div`
1285
1285
  height: 44px;
1286
- `;import{useEffect as jw,useState as Ra}from"react";import{jsx as Kw}from"react/jsx-runtime";var $u=()=>{let[e,t]=Ra(null),[o,r]=Ra(!1),[n,i]=Ra(null),[a,l]=Ra(""),{authenticated:s,getAccessToken:c,user:u}=B(),{walletProxy:h,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:C}=R(),{app:b,navigate:x,data:E,onUserCloseViaDialogOrKeybindRef:T}=_(),{onSuccess:N,onFailure:k}=E.createWallet,M=ce(u),L=e?.recoveryMethod==="user-passcode";jw(()=>{s||(x("LANDING"),k(new wi("User must be authenticated before setting a password on a Privy wallet")))},[s]);let I=()=>{if(n){k(n),g({shouldCallAuthOnSuccess:!1});return}if(!L){k(new at("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}N(e),g({shouldCallAuthOnSuccess:!1})};T.current=I;let F=async()=>{let X=await c();if(X&&M?.address&&a&&h)try{if(C("embedded_wallet_set_password_started",{walletAddress:M.address}),!(await h.setRecoveryPassword({accessToken:X,address:M.address,recoveryPassword:a})).address){i(new at("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:M.address,reason:"error setting password"});return}let G=await f(),A=ce(G);if(!A){i(new at("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:M.address,reason:"wallet disconnected"});return}t(A),C("embedded_wallet_set_password_completed",{walletAddress:M.address})}catch(O){console.warn(O),i(O instanceof Error?O:new Error("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:M.address,reason:O})}},z=async()=>{L?(N(e),g({shouldCallAuthOnSuccess:!1})):(r(!0),i(null),await F(),r(!1))};return Kw(ka,{appName:b?.name||"privy",config:{initiatedBy:"user",onCancel:I},error:n?"An error has occurred, please try again.":void 0,buttonLoading:o,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(Aa()),onPasswordChange:l,onSubmit:z,onClose:I})};import Yw from"@heroicons/react/24/outline/UserCircleIcon";import Jw from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as Qw,jsx as bo,jsxs as Ia}from"react/jsx-runtime";var qu=()=>{let{user:e}=B(),{closePrivyModal:t,createAnalyticsEvent:o}=R(),{data:r,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s}=r.setWalletPassword,c=()=>{s(new at("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,Ia(Qw,{children:[bo(S,{onClose:c}),bo(Y,{}),Ia(Ot,{children:[Ia(Ip,{children:[bo(Yw,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),bo(Wp,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:bo(Jw,{width:"12px",height:"12px",fill:"white"})})]}),Ia(be,{title:"Secure Your Account",children:["Please set a password to secure your account.",bo("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."})]})]}),bo(D,{onClick:()=>{let h=ce(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"}),bo(Q,{}),bo(H,{protectedByPrivy:!0})]})};import Zw from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as Xw,useState as Wa}from"react";import Ma,{css as e1}from"styled-components";import{Fragment as i1,jsx as qe,jsxs as yr}from"react/jsx-runtime";var ju=()=>{let[e,t]=Wa(!0),{authenticated:o,getAccessToken:r}=B(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=R(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),[u,h]=Wa(void 0),[f,g]=Wa(""),[C,b]=Wa(!1),{privyWallet:x,onCompleteNavigateTo:E,onSuccess:T,onFailure:N}=s.recoverWallet,k=(I="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),N(typeof I=="string"?new at(I):I)};c.current=k,Xw(()=>{if(!o||!x)return k("User must be authenticated and have a Privy wallet before it can be recovered")},[o]);let M=I=>{I&&h(I)};return yr(i1,{children:[qe(S,{onClose:k}),qe(Y,{}),yr(o1,{children:[yr(t1,{children:[qe(Zw,{height:48,width:48,stroke:"var(--privy-color-accent)"}),qe("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),qe("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),yr("div",{children:[yr(Vo,{children:[qe(mr,{type:e?"password":"text",onChange:I=>M(I.target.value),disabled:C}),qe(rn,{style:{right:"0.75rem"},children:e?qe(nn,{onClick:()=>t(!1)}):qe(an,{onClick:()=>t(!0)})})]}),!!f&&qe(r1,{children:f})]}),yr("div",{children:[yr(Rp,{children:[qe("h4",{children:"Why is this necessary?"}),qe("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),qe(n1,{loading:C||!n,disabled:!u,onClick:async()=>{b(!0);let I=await r();if(I&&x&&u!==null)try{a("embedded_wallet_recovery_started",{walletAddress:x.address}),await n?.recover({address:x.address,accessToken:I,recoveryPin:u}),g(""),E?l(E):i({shouldCallAuthOnSuccess:!1}),T?.(x),a("embedded_wallet_recovery_completed",{walletAddress:x.address})}catch(F){au(F)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{b(!1)}else return k("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!x&&C,children:"Recover your account"})]})]}),qe(Q,{}),qe(H,{protectedByPrivy:!0})]})},t1=Ma.div`
1286
+ `;import{useEffect as jw,useState as Ia}from"react";import{jsx as Kw}from"react/jsx-runtime";var qu=()=>{let[e,t]=Ia(null),[o,r]=Ia(!1),[n,i]=Ia(null),[a,l]=Ia(""),{authenticated:s,getAccessToken:c,user:u}=H(),{walletProxy:h,refreshUser:f,closePrivyModal:g,createAnalyticsEvent:C}=I(),{app:b,navigate:x,data:E,onUserCloseViaDialogOrKeybindRef:T}=_(),{onSuccess:L,onFailure:R}=E.createWallet,N=de(u),O=e?.recoveryMethod==="user-passcode";jw(()=>{s||(x("LANDING"),R(new Ci("User must be authenticated before setting a password on a Privy wallet")))},[s]);let W=()=>{if(n){R(n),g({shouldCallAuthOnSuccess:!1});return}if(!O){R(new st("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}L(e),g({shouldCallAuthOnSuccess:!1})};T.current=W;let B=async()=>{let ee=await c();if(ee&&N?.address&&a&&h)try{if(C("embedded_wallet_set_password_started",{walletAddress:N.address}),!(await h.setRecoveryPassword({accessToken:ee,address:N.address,recoveryPassword:a})).address){i(new st("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:N.address,reason:"error setting password"});return}let V=await f(),A=de(V);if(!A){i(new st("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:N.address,reason:"wallet disconnected"});return}t(A),C("embedded_wallet_set_password_completed",{walletAddress:N.address})}catch(D){console.warn(D),i(D instanceof Error?D:new Error("Error setting password on privy wallet")),C("embedded_wallet_set_password_failed",{walletAddress:N.address,reason:D})}},$=async()=>{O?(L(e),g({shouldCallAuthOnSuccess:!1})):(r(!0),i(null),await B(),r(!1))};return Kw(Ra,{appName:b?.name||"privy",config:{initiatedBy:"user",onCancel:W},error:n?"An error has occurred, please try again.":void 0,buttonLoading:o,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(ka()),onPasswordChange:l,onSubmit:$,onClose:W})};import Yw from"@heroicons/react/24/outline/UserCircleIcon";import Jw from"@heroicons/react/24/solid/LockClosedIcon";import{Fragment as Qw,jsx as To,jsxs as Wa}from"react/jsx-runtime";var ju=()=>{let{user:e}=H(),{closePrivyModal:t,createAnalyticsEvent:o}=I(),{data:r,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s}=r.setWalletPassword,c=()=>{s(new st("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,Wa(Qw,{children:[To(S,{onClose:c}),To(J,{}),Wa(Dt,{children:[Wa(Wp,{children:[To(Yw,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),To(Mp,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:To(Jw,{width:"12px",height:"12px",fill:"white"})})]}),Wa(Ee,{title:"Secure Your Account",children:["Please set a password to secure your account.",To("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."})]})]}),To(U,{onClick:()=>{let h=de(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"}),To(Z,{}),To(G,{protectedByPrivy:!0})]})};import Zw from"@heroicons/react/24/outline/ShieldCheckIcon";import{useEffect as Xw,useState as Ma}from"react";import Na,{css as e1}from"styled-components";import{Fragment as i1,jsx as Ye,jsxs as gr}from"react/jsx-runtime";var Ku=()=>{let[e,t]=Ma(!0),{authenticated:o,getAccessToken:r}=H(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=I(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),[u,h]=Ma(void 0),[f,g]=Ma(""),[C,b]=Ma(!1),{privyWallet:x,onCompleteNavigateTo:E,onSuccess:T,onFailure:L}=s.recoverWallet,R=(W="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),L(typeof W=="string"?new st(W):W)};c.current=R,Xw(()=>{if(!o||!x)return R("User must be authenticated and have a Privy wallet before it can be recovered")},[o]);let N=W=>{W&&h(W)};return gr(i1,{children:[Ye(S,{onClose:R}),Ye(J,{}),gr(o1,{children:[gr(t1,{children:[Ye(Zw,{height:48,width:48,stroke:"var(--privy-color-accent)"}),Ye("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),Ye("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),gr("div",{children:[gr(zo,{children:[Ye(fr,{type:e?"password":"text",onChange:W=>N(W.target.value),disabled:C}),Ye(nn,{style:{right:"0.75rem"},children:e?Ye(an,{onClick:()=>t(!1)}):Ye(sn,{onClick:()=>t(!0)})})]}),!!f&&Ye(r1,{children:f})]}),gr("div",{children:[gr(Ip,{children:[Ye("h4",{children:"Why is this necessary?"}),Ye("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),Ye(n1,{loading:C||!n,disabled:!u,onClick:async()=>{b(!0);let W=await r();if(W&&x&&u!==null)try{a("embedded_wallet_recovery_started",{walletAddress:x.address}),await n?.recover({address:x.address,accessToken:W,recoveryPin:u}),g(""),E?l(E):i({shouldCallAuthOnSuccess:!1}),T?.(x),a("embedded_wallet_recovery_completed",{walletAddress:x.address})}catch(B){su(B)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{b(!1)}else return R("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!x&&C,children:"Recover your account"})]})]}),Ye(Z,{}),Ye(G,{protectedByPrivy:!0})]})},t1=Na.div`
1287
1287
  display: flex;
1288
1288
  flex-direction: column;
1289
1289
  align-items: center;
@@ -1305,18 +1305,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1305
1305
  font-weight: 400;
1306
1306
  line-height: 20px;
1307
1307
  }
1308
- `,o1=Ma.div`
1308
+ `,o1=Na.div`
1309
1309
  display: flex;
1310
1310
  flex-direction: column;
1311
1311
  justify-content: space-between;
1312
- `,r1=Ma.div`
1312
+ `,r1=Na.div`
1313
1313
  line-height: 20px;
1314
1314
  height: 20px;
1315
1315
  font-size: 13px;
1316
1316
  color: var(--privy-color-error);
1317
1317
  text-align: left;
1318
1318
  margin-top: 0.5rem;
1319
- `,n1=Ma(D)`
1319
+ `,n1=Na(U)`
1320
1320
  ${e=>e.hideAnimations&&e1`
1321
1321
  && {
1322
1322
  // Remove animations because the recoverWallet task on the iframe partially
@@ -1324,7 +1324,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1324
1324
  transition: none;
1325
1325
  }
1326
1326
  `}
1327
- `;import s1 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import l1 from"@heroicons/react/24/outline/PhoneIcon";import Pl from"styled-components";import{jsx as Na,jsxs as a1}from"react/jsx-runtime";var gr=({style:e,...t})=>a1("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[Na("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),Na("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),Na("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),Na("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as m1,jsx as Pt,jsxs as La}from"react/jsx-runtime";var c1=e=>{let t=Pt(s1,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof w)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof Ee&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:Pt(l1,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Ne)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:Pt(va,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:Pt("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:Pt("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:Pt(gr,{style:{height:38,width:38}})};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof zt&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},Ku=()=>{let{navigate:e,navigateBack:t,data:o,lastScreen:r,currentScreen:n}=_(),{reset:i}=ue(),a=o?.errorModalData,l=c1(a?.error||new Error),s=c=>{if(c instanceof Ne)switch(c.privyErrorCode){case"invalid_captcha":return()=>i()}return()=>{}};return La(m1,{children:[Pt(S,{backFn:!r||n===r?void 0:t}),La(d1,{children:[Pt(u1,{children:La("div",{children:[Pt(ga,{color:"var(--privy-color-error)"}),l.icon]})}),La(p1,{children:[Pt("h3",{children:l.title}),Pt("p",{children:l.detail})]}),Pt(D,{color:"var(--privy-color-error)",onClick:()=>{s(a?.error||new Error)(),e(r||"LANDING",!1)},children:l.ctaText})]})]})},d1=Pl.div`
1327
+ `;import s1 from"@heroicons/react/24/outline/ExclamationTriangleIcon";import l1 from"@heroicons/react/24/outline/PhoneIcon";import xl from"styled-components";import{jsx as La,jsxs as a1}from"react/jsx-runtime";var vr=({style:e,...t})=>a1("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[La("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),La("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),La("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),La("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});import{Fragment as m1,jsx as Pt,jsxs as Oa}from"react/jsx-runtime";var c1=e=>{let t=Pt(s1,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof w)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof Te&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:Pt(l1,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof Le)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:Pt(wa,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:Pt("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:Pt("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:Pt(vr,{style:{height:38,width:38}})};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof $t&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},Yu=()=>{let{navigate:e,navigateBack:t,data:o,lastScreen:r,currentScreen:n}=_(),{reset:i}=me(),a=o?.errorModalData,l=c1(a?.error||new Error),s=c=>{if(c instanceof Le)switch(c.privyErrorCode){case"invalid_captcha":return()=>i()}return()=>{}};return Oa(m1,{children:[Pt(S,{backFn:!r||n===r?void 0:t}),Oa(d1,{children:[Pt(u1,{children:Oa("div",{children:[Pt(va,{color:"var(--privy-color-error)"}),l.icon]})}),Oa(p1,{children:[Pt("h3",{children:l.title}),Pt("p",{children:l.detail})]}),Pt(U,{color:"var(--privy-color-error)",onClick:()=>{s(a?.error||new Error)(),e(r||"LANDING",!1)},children:l.ctaText})]})]})},d1=xl.div`
1328
1328
  display: flex;
1329
1329
  flex-direction: column;
1330
1330
  align-items: center;
@@ -1332,11 +1332,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
1332
1332
  gap: 24px;
1333
1333
  width: 100%;
1334
1334
  padding-bottom: 16px;
1335
- `,p1=Pl.div`
1335
+ `,p1=xl.div`
1336
1336
  display: flex;
1337
1337
  flex-direction: column;
1338
1338
  gap: 8px;
1339
- `,u1=Pl.div`
1339
+ `,u1=xl.div`
1340
1340
  display: flex;
1341
1341
  flex-direction: column;
1342
1342
  justify-content: center;
@@ -1359,7 +1359,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1359
1359
  left: -19px;
1360
1360
  top: -19px;
1361
1361
  }
1362
- `;import{useEffect as rm,useRef as W1,useState as nm}from"react";import{isMobile as im}from"react-device-detect";import cm from"styled-components";import{useState as f1}from"react";import h1 from"styled-components";import{jsx as Yu}from"react/jsx-runtime";var Oa=({style:e,color:t,...o})=>Yu("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:Yu("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as xl}from"react/jsx-runtime";var Ju=({color:e,...t})=>xl("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:xl("g",{children:xl("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as Qu,jsxs as g1}from"react/jsx-runtime";var sn=e=>{let[t,o]=f1(!1);return g1(y1,{color:e.color,onClick:()=>{o(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>o(!1),1500)},justCopied:t,children:[t?Qu(Oa,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Qu(Ju,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},y1=h1.button`
1362
+ `;import{useEffect as nm,useRef as W1,useState as im}from"react";import{isMobile as am}from"react-device-detect";import dm from"styled-components";import{useState as f1}from"react";import h1 from"styled-components";import{jsx as Ju}from"react/jsx-runtime";var Da=({style:e,color:t,...o})=>Ju("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:Ju("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});import{jsx as Sl}from"react/jsx-runtime";var Qu=({color:e,...t})=>Sl("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:Sl("g",{children:Sl("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});import{jsx as Zu,jsxs as g1}from"react/jsx-runtime";var ln=e=>{let[t,o]=f1(!1);return g1(y1,{color:e.color,onClick:()=>{o(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>o(!1),1500)},justCopied:t,children:[t?Zu(Da,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):Zu(Qu,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},y1=h1.button`
1363
1363
  display: flex;
1364
1364
  align-items: center;
1365
1365
  gap: 6px;
@@ -1397,7 +1397,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1397
1397
  width: 14px;
1398
1398
  height: 14px;
1399
1399
  }
1400
- `;import{useState as v1}from"react";import w1 from"styled-components";import{jsx as b1}from"react/jsx-runtime";var Zu=e=>{let[t,o]=v1(!1);return b1(C1,{color:e.color,onClick:()=>{o(!0),window.open(e.url,"_blank"),setTimeout(()=>o(!1),1500)},justOpened:t,children:e.text})},C1=w1.button`
1400
+ `;import{useState as v1}from"react";import w1 from"styled-components";import{jsx as b1}from"react/jsx-runtime";var Xu=e=>{let[t,o]=v1(!1);return b1(C1,{color:e.color,onClick:()=>{o(!0),window.open(e.url,"_blank"),setTimeout(()=>o(!1),1500)},justOpened:t,children:e.text})},C1=w1.button`
1401
1401
  display: flex;
1402
1402
  align-items: center;
1403
1403
  gap: 6px;
@@ -1435,7 +1435,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1435
1435
  width: 14px;
1436
1436
  height: 14px;
1437
1437
  }
1438
- `;import E1 from"qrcode";import T1 from"react";import P1 from"styled-components";import{jsx as Xu}from"react/jsx-runtime";var em=()=>Xu("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:Xu("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as Yn,jsx as je,jsxs as om}from"react/jsx-runtime";var ut=7,Sl=(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},x1=e=>{let t=E1.create(e,{errorCorrectionLevel:"high"}).modules,o=dd(Array.from(t.data),t.size);return o=Sl(o,0,0,ut,ut),o=Sl(o,o.length-ut,0,ut,ut),o=Sl(o,0,o.length-ut,ut,ut),o},S1=({x:e,y:t,cellSize:o,bgColor:r,fgColor:n})=>je(Yn,{children:[0,1,2].map(i=>je("circle",{r:o*(ut-i*2)/2,cx:e+o*ut/2,cy:t+o*ut/2,fill:i%2!==0?r:n},`finder-${e}-${t}-${i}`))}),_1=({cellSize:e,matrixSize:t,bgColor:o,fgColor:r})=>{let n=[[0,0],[(t-ut)*e,0],[0,(t-ut)*e]];return je(Yn,{children:n.map(([i,a])=>je(S1,{x:i,y:a,cellSize:e,bgColor:o,fgColor:r},`finder-${i}-${a}`))})},A1=({matrix:e,cellSize:t,color:o})=>je(Yn,{children:e.map((r,n)=>r.map((i,a)=>i?je("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:o},`circle-${n}-${a}`):je(T1.Fragment,{},`circle-${n}-${a}`)))}),tm=(e,t)=>e-e%t,k1=({outputSize:e,cellSize:t,element:o,size:r,padding:n,bgColor:i})=>{if(!o)return je(Yn,{});let a=r||40,l=n||4,s=o,c=e/2-a/2-l;return om(Yn,{children:[je("rect",{x:tm(c,t),y:tm(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),je(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},R1=e=>{let t=e.outputSize,o=x1(e.url),r=t/o.length;return om("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[je(A1,{matrix:o,cellSize:r,color:e.fgColor}),je(_1,{cellSize:r,matrixSize:o.length,fgColor:e.fgColor,bgColor:e.bgColor}),je(k1,{outputSize:e.outputSize,cellSize:r,element:e.logo?.element,bgColor:e.bgColor})]})},I1=P1.div`
1438
+ `;import E1 from"qrcode";import T1 from"react";import P1 from"styled-components";import{jsx as em}from"react/jsx-runtime";var tm=()=>em("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:em("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});import{Fragment as Jn,jsx as Je,jsxs as rm}from"react/jsx-runtime";var mt=7,_l=(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},x1=e=>{let t=E1.create(e,{errorCorrectionLevel:"high"}).modules,o=pd(Array.from(t.data),t.size);return o=_l(o,0,0,mt,mt),o=_l(o,o.length-mt,0,mt,mt),o=_l(o,0,o.length-mt,mt,mt),o},S1=({x:e,y:t,cellSize:o,bgColor:r,fgColor:n})=>Je(Jn,{children:[0,1,2].map(i=>Je("circle",{r:o*(mt-i*2)/2,cx:e+o*mt/2,cy:t+o*mt/2,fill:i%2!==0?r:n},`finder-${e}-${t}-${i}`))}),_1=({cellSize:e,matrixSize:t,bgColor:o,fgColor:r})=>{let n=[[0,0],[(t-mt)*e,0],[0,(t-mt)*e]];return Je(Jn,{children:n.map(([i,a])=>Je(S1,{x:i,y:a,cellSize:e,bgColor:o,fgColor:r},`finder-${i}-${a}`))})},A1=({matrix:e,cellSize:t,color:o})=>Je(Jn,{children:e.map((r,n)=>r.map((i,a)=>i?Je("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:o},`circle-${n}-${a}`):Je(T1.Fragment,{},`circle-${n}-${a}`)))}),om=(e,t)=>e-e%t,k1=({outputSize:e,cellSize:t,element:o,size:r,padding:n,bgColor:i})=>{if(!o)return Je(Jn,{});let a=r||40,l=n||4,s=o,c=e/2-a/2-l;return rm(Jn,{children:[Je("rect",{x:om(c,t),y:om(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),Je(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},R1=e=>{let t=e.outputSize,o=x1(e.url),r=t/o.length;return rm("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[Je(A1,{matrix:o,cellSize:r,color:e.fgColor}),Je(_1,{cellSize:r,matrixSize:o.length,fgColor:e.fgColor,bgColor:e.bgColor}),Je(k1,{outputSize:e.outputSize,cellSize:r,element:e.logo?.element,bgColor:e.bgColor})]})},I1=P1.div`
1439
1439
  display: flex;
1440
1440
  justify-content: center;
1441
1441
  align-items: center;
@@ -1450,7 +1450,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1450
1450
  border-color: ${e=>e.fgColor};
1451
1451
  border-radius: var(--privy-border-radius-md);
1452
1452
  }
1453
- `,Da=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return je(I1,{size:r,bgColor:t,fgColor:o,children:je(R1,{url:e.url,logo:{element:e.squareLogoElement??em},outputSize:r,bgColor:t,fgColor:o})})};import{Fragment as lm,jsx as ve,jsxs as vr}from"react/jsx-runtime";var am="#8a63d2",dm=1e3,M1=dm*2,N1=dm*120,pm=()=>{let{ready:e,authenticated:t,user:o}=B(),{lastScreen:r,navigate:n,navigateBack:i,setModalData:a,app:l}=_(),{getAuthFlow:s,loginWithFarcaster:c,closePrivyModal:u}=R(),[h,f]=nm(!1),[g,C]=nm(!1),b=W1([]),x=l?.render.inDialog?ze:0,E=s(),T=E?.meta.connectUri;return rm(()=>{let N=Date.now(),k=setInterval(async()=>{let M=await E.pollForReady.execute(),L=Date.now()-N;if(M){clearInterval(k),f(!0);try{await c(),C(!0)}catch(I){a({errorModalData:{error:I,previousScreen:t?"AWAITING_FARCASTER_CONNECTION":"LANDING"}}),n("ERROR_SCREEN")}}else L>N1&&(clearInterval(k),a({errorModalData:{error:new w("Timed out waiting for response from Farcaster app.",void 0,"client_request_timeout"),previousScreen:t?"AWAITING_FARCASTER_CONNECTION":"LANDING"}}),n("ERROR_SCREEN"))},M1);return()=>{clearInterval(k),b.current.forEach(M=>clearTimeout(M))}},[]),rm(()=>{if(e&&t&&g&&o){if(l?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let k=setTimeout(()=>{n("AFFIRMATIVE_CONSENT_SCREEN")},x);return()=>clearTimeout(k)}g&&(yt(o,l?.embeddedWallets.createOnLogin)?b.current.push(setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:k=>console.error(k),callAuthOnSuccessOnClose:!0}}),n("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},x)):b.current.push(setTimeout(u,x)))}},[g,e,t,o]),im||h?vr(lm,{children:[ve(S,{backFn:r?i:void 0,onClose:u},"header"),ve(Y,{}),vr(sm,{children:[ve(L1,{children:vr("div",{children:[ve(Lo,{success:g,fail:!1}),ve(gr,{style:{width:"38px",height:"38px"}})]})}),vr(Et,{children:[ve(ge,{children:"Signing in with Farcaster"}),ve(pe,{children:"This should only take a moment."}),ve(bt,{children:T&&im&&ve(Zu,{text:"Take me to Warpcast",url:T,color:am})})]})]}),ve(K,{})]}):vr(lm,{children:[ve(S,{backFn:r?i:void 0,onClose:u},"header"),ve(Y,{}),ve(sm,{children:vr("div",{children:[ve(ge,{children:"Sign in with Farcaster"}),ve(pe,{children:"Scan with your phone's camera to continue."}),ve(Ca,{children:T?ve(Da,{url:T,size:275,squareLogoElement:gr}):ve(vt,{})}),vr(bt,{children:[ve(pe,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),T&&ve(sn,{text:T,itemName:"link",color:am})]})]})}),ve(K,{})]})},sm=cm.div`
1453
+ `,Ua=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return Je(I1,{size:r,bgColor:t,fgColor:o,children:Je(R1,{url:e.url,logo:{element:e.squareLogoElement??tm},outputSize:r,bgColor:t,fgColor:o})})};import{Fragment as cm,jsx as ve,jsxs as wr}from"react/jsx-runtime";var sm="#8a63d2",pm=1e3,M1=pm*2,N1=pm*120,um=()=>{let{ready:e,authenticated:t,user:o}=H(),{lastScreen:r,navigate:n,navigateBack:i,setModalData:a,app:l}=_(),{getAuthFlow:s,loginWithFarcaster:c,closePrivyModal:u}=I(),[h,f]=im(!1),[g,C]=im(!1),b=W1([]),x=l?.render.inDialog?je:0,E=s(),T=E?.meta.connectUri;return nm(()=>{let L=Date.now(),R=setInterval(async()=>{let N=await E.pollForReady.execute(),O=Date.now()-L;if(N){clearInterval(R),f(!0);try{await c(),C(!0)}catch(W){a({errorModalData:{error:W,previousScreen:t?"AWAITING_FARCASTER_CONNECTION":"LANDING"}}),n("ERROR_SCREEN")}}else O>N1&&(clearInterval(R),a({errorModalData:{error:new w("Timed out waiting for response from Farcaster app.",void 0,"client_request_timeout"),previousScreen:t?"AWAITING_FARCASTER_CONNECTION":"LANDING"}}),n("ERROR_SCREEN"))},M1);return()=>{clearInterval(R),b.current.forEach(N=>clearTimeout(N))}},[]),nm(()=>{if(e&&t&&g&&o){if(l?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let R=setTimeout(()=>{n("AFFIRMATIVE_CONSENT_SCREEN")},x);return()=>clearTimeout(R)}g&&(yt(o,l?.embeddedWallets.createOnLogin)?b.current.push(setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:R=>console.error(R),callAuthOnSuccessOnClose:!0}}),n("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},x)):b.current.push(setTimeout(u,x)))}},[g,e,t,o]),am||h?wr(cm,{children:[ve(S,{backFn:r?i:void 0,onClose:u},"header"),ve(J,{}),wr(lm,{children:[ve(L1,{children:wr("div",{children:[ve(Oo,{success:g,fail:!1}),ve(vr,{style:{width:"38px",height:"38px"}})]})}),wr(Et,{children:[ve(ge,{children:"Signing in with Farcaster"}),ve(ue,{children:"This should only take a moment."}),ve(bt,{children:T&&am&&ve(Xu,{text:"Take me to Warpcast",url:T,color:sm})})]})]}),ve(Y,{})]}):wr(cm,{children:[ve(S,{backFn:r?i:void 0,onClose:u},"header"),ve(J,{}),ve(lm,{children:wr("div",{children:[ve(ge,{children:"Sign in with Farcaster"}),ve(ue,{children:"Scan with your phone's camera to continue."}),ve(ba,{children:T?ve(Ua,{url:T,size:275,squareLogoElement:vr}):ve(vt,{})}),wr(bt,{children:[ve(ue,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),T&&ve(ln,{text:T,itemName:"link",color:sm})]})]})}),ve(Y,{})]})},lm=dm.div`
1454
1454
  display: flex;
1455
1455
  flex-direction: column;
1456
1456
  align-items: center;
@@ -1458,7 +1458,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1458
1458
  margin-left: 27px;
1459
1459
  margin-right: 27px;
1460
1460
  gap: 24px;
1461
- `,L1=cm.div`
1461
+ `,L1=dm.div`
1462
1462
  display: flex;
1463
1463
  flex-direction: column;
1464
1464
  justify-content: center;
@@ -1481,7 +1481,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1481
1481
  left: -19px;
1482
1482
  top: -19px;
1483
1483
  }
1484
- `;import D1 from"@heroicons/react/24/outline/ClockIcon";import U1 from"@heroicons/react/24/outline/EyeSlashIcon";import F1 from"@heroicons/react/24/outline/LinkIcon";import no from"styled-components";import{jsx as _l,jsxs as O1}from"react/jsx-runtime";var Ua=({size:e=61,...t})=>_l("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:O1("g",{id:"moonpay_symbol_wht 2",children:[_l("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),_l("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 um,jsx as Ke,jsxs as wr}from"react/jsx-runtime";var Al=({title:e,desc:t,icon:o})=>wr($1,{children:[Ke(j1,{children:o}),wr(q1,{children:[Ke(V1,{children:e}),Ke(z1,{children:t})]})]}),mm=({app:e,signedUrl:t,onContinue:o})=>wr(um,{children:[wr(H1,{children:[Ke(Ua,{size:"3.75rem"}),wr(G1,{children:[e?.name," uses ",Ke("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),wr(K1,{children:[Ke(Al,{icon:Ke(F1,{width:"1rem"}),title:"Purchase assets to fund your account",desc:wr(um,{children:["Connect a payment method (",Ke("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Ke(Al,{icon:Ke(D1,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Ke(Al,{icon:Ke(U1,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Ke(Y1,{className:"mobile-only"})]}),Ke(B1,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Ke(sa,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:o,children:"Continue to Moonpay"})]}),B1=no.span`
1484
+ `;import D1 from"@heroicons/react/24/outline/ClockIcon";import U1 from"@heroicons/react/24/outline/EyeSlashIcon";import F1 from"@heroicons/react/24/outline/LinkIcon";import io from"styled-components";import{jsx as Al,jsxs as O1}from"react/jsx-runtime";var Fa=({size:e=61,...t})=>Al("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:O1("g",{id:"moonpay_symbol_wht 2",children:[Al("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),Al("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 mm,jsx as Qe,jsxs as Cr}from"react/jsx-runtime";var kl=({title:e,desc:t,icon:o})=>Cr($1,{children:[Qe(j1,{children:o}),Cr(q1,{children:[Qe(V1,{children:e}),Qe(z1,{children:t})]})]}),fm=({app:e,signedUrl:t,onContinue:o})=>Cr(mm,{children:[Cr(H1,{children:[Qe(Fa,{size:"3.75rem"}),Cr(G1,{children:[e?.name," uses ",Qe("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),Cr(K1,{children:[Qe(kl,{icon:Qe(F1,{width:"1rem"}),title:"Purchase assets to fund your account",desc:Cr(mm,{children:["Connect a payment method (",Qe("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),Qe(kl,{icon:Qe(D1,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),Qe(kl,{icon:Qe(U1,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),Qe(Y1,{className:"mobile-only"})]}),Qe(B1,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),Qe(la,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:o,children:"Continue to Moonpay"})]}),B1=io.span`
1485
1485
  display: inline-block;
1486
1486
  color: var(--privy-color-foreground-3);
1487
1487
  text-align: center;
@@ -1490,13 +1490,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
1490
1490
  font-weight: 400;
1491
1491
  line-height: 140%; /* 0.875rem */
1492
1492
  margin-bottom: 0.25rem;
1493
- `,H1=no.div`
1493
+ `,H1=io.div`
1494
1494
  display: flex;
1495
1495
  flex-direction: column;
1496
1496
  align-items: center;
1497
1497
  justify-content: center;
1498
1498
  padding: 1.5rem 0;
1499
- `,G1=no.span`
1499
+ `,G1=io.span`
1500
1500
  color: var(--privy-color-foreground);
1501
1501
  text-align: center;
1502
1502
  font-size: 1.125rem;
@@ -1505,46 +1505,46 @@ You will need this password to access your ${e} wallet on a new device. Please k
1505
1505
  margin: 1.5rem 0;
1506
1506
  text-align: center;
1507
1507
  max-width: 19.5rem;
1508
- `,V1=no.span`
1508
+ `,V1=io.span`
1509
1509
  color: var(--privy-color-foreground);
1510
1510
  font-size: 0.875rem;
1511
1511
  font-weight: 500;
1512
1512
  line-height: 1.225rem;
1513
1513
  width: 100%;
1514
- `,z1=no.span`
1514
+ `,z1=io.span`
1515
1515
  color: var(--privy-color-foreground-2);
1516
1516
  font-size: 0.875rem;
1517
1517
  font-weight: 400;
1518
1518
  line-height: 1.225rem;
1519
- `,$1=no.div`
1519
+ `,$1=io.div`
1520
1520
  display: flex;
1521
1521
  align-items: flex-start;
1522
1522
  gap: 0.5rem;
1523
1523
  align-self: stretch;
1524
- `,q1=no.div`
1524
+ `,q1=io.div`
1525
1525
  display: flex;
1526
1526
  flex-direction: column;
1527
1527
  gap: 0.25rem;
1528
1528
  align-items: flex-start;
1529
1529
  text-align: left;
1530
1530
  flex: 1 0 0;
1531
- `,j1=no.div`
1531
+ `,j1=io.div`
1532
1532
  padding-top: 2px;
1533
- `,K1=no.div`
1533
+ `,K1=io.div`
1534
1534
  display: flex;
1535
1535
  flex-direction: column;
1536
1536
  gap: 1.25rem;
1537
1537
  margin: 0 0.5rem;
1538
- `,Y1=no.div`
1538
+ `,Y1=io.div`
1539
1539
  margin: 30px 0;
1540
- `;import{ofetch as J1}from"ofetch";import{useEffect as Q1,useRef as Z1,useState as X1}from"react";var Fa="moonpay",fm="sdk_fiat_on_ramp_completed_with_status";async function hm(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 eC(e,t){let o=t?Zc:Qc,r=t?ed:Xc;return J1(`${o}/transactions/ext/${e}`,{query:{apiKey:r}})}function ym(e,t=!1){let[o,r]=X1(null),{createAnalyticsEvent:n}=R(),i=Z1(0);return Q1(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await eC(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;r(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(fm,{status:s,provider:Fa,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(fm,{status:"serviceFailure",provider:Fa}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),o}import{Fragment as tC,jsx as kl,jsxs as oC}from"react/jsx-runtime";var gm=()=>{let{app:e,data:t,navigate:o}=_(),{createAnalyticsEvent:r}=R(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:oC(tC,{children:[kl(S,{title:"Fund account"},"header"),kl(mm,{app:e,signedUrl:n,onContinue:()=>{r("sdk_fiat_on_ramp_started",{provider:Fa}),o("FIAT_ON_RAMP_STATUS_SCREEN")}}),kl(H,{protectedByPrivy:!0})]})};import rC from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import nC from"@heroicons/react/24/solid/CheckCircleIcon";import iC from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as aC}from"react";import vm from"styled-components";import{Fragment as Rl,jsx as Ye,jsxs as Cr}from"react/jsx-runtime";var wm=()=>{let{app:e,data:t}=_(),{closePrivyModal:o}=R(),{externalTransactionId:r}=t?.fiatOnRampStatus,n=ym(r||null,e.fiatOnRamp.useSandbox);return Cr(Rl,{children:[Ye(S,{title:"Fund account"},"header"),Ye(lC,{status:n,onClickCta:o}),Ye(H,{protectedByPrivy:!0})]})},sC=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:Cr(Rl,{children:[Cr("p",{children:["It looks like there was an issue with your payment. Please contact"," ",Ye("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),Ye("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:""}}},lC=({status:e,onClickCta:t})=>{let{title:o,body:r,cta:n}=aC(()=>sC(e),[e]);return Cr(Rl,{children:[Cr(mC,{children:[Ye(pC,{status:e}),Cr(Et,{children:[Ye("h3",{children:o}),Ye(uC,{children:r})]})]}),n&&Ye(D,{onClick:t,children:n})]})},cC=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",dC=e=>{switch(e){case"serviceFailure":case"failed":return iC;case"completed":return nC;case"waitingAuthorization":return()=>Ye(rC,{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}},pC=({status:e})=>{if(!e||e==="pending"){let r="var(--privy-color-foreground-4)";return Cr("div",{style:{position:"relative"},children:[Ye(vt,{color:r,style:{position:"absolute"}}),Ye(Vs,{color:r}),Ye(Ua,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=dC(e),o=cC(e);return Ye("div",{style:{borderColor:o,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&Ye(t,{width:"4rem",height:"4rem",color:o})})},uC=vm.p`
1540
+ `;import{ofetch as J1}from"ofetch";import{useEffect as Q1,useRef as Z1,useState as X1}from"react";var Ba="moonpay",hm="sdk_fiat_on_ramp_completed_with_status";async function ym(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 eC(e,t){let o=t?Xc:Zc,r=t?td:ed;return J1(`${o}/transactions/ext/${e}`,{query:{apiKey:r}})}function gm(e,t=!1){let[o,r]=X1(null),{createAnalyticsEvent:n}=I(),i=Z1(0);return Q1(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await eC(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;r(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(hm,{status:s,provider:Ba,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(hm,{status:"serviceFailure",provider:Ba}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),o}import{Fragment as tC,jsx as Rl,jsxs as oC}from"react/jsx-runtime";var vm=()=>{let{app:e,data:t,navigate:o}=_(),{createAnalyticsEvent:r}=I(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:oC(tC,{children:[Rl(S,{title:"Fund account"},"header"),Rl(fm,{app:e,signedUrl:n,onContinue:()=>{r("sdk_fiat_on_ramp_started",{provider:Ba}),o("FIAT_ON_RAMP_STATUS_SCREEN")}}),Rl(G,{protectedByPrivy:!0})]})};import rC from"@heroicons/react/24/solid/ArrowsRightLeftIcon";import nC from"@heroicons/react/24/solid/CheckCircleIcon";import iC from"@heroicons/react/24/solid/XCircleIcon";import{useMemo as aC}from"react";import wm from"styled-components";import{Fragment as Il,jsx as Ze,jsxs as br}from"react/jsx-runtime";var Cm=()=>{let{app:e,data:t}=_(),{closePrivyModal:o}=I(),{externalTransactionId:r}=t?.fiatOnRampStatus,n=gm(r||null,e.fiatOnRamp.useSandbox);return br(Il,{children:[Ze(S,{title:"Fund account"},"header"),Ze(lC,{status:n,onClickCta:o}),Ze(G,{protectedByPrivy:!0})]})},sC=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:br(Il,{children:[br("p",{children:["It looks like there was an issue with your payment. Please contact"," ",Ze("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),Ze("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:""}}},lC=({status:e,onClickCta:t})=>{let{title:o,body:r,cta:n}=aC(()=>sC(e),[e]);return br(Il,{children:[br(mC,{children:[Ze(pC,{status:e}),br(Et,{children:[Ze("h3",{children:o}),Ze(uC,{children:r})]})]}),n&&Ze(U,{onClick:t,children:n})]})},cC=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",dC=e=>{switch(e){case"serviceFailure":case"failed":return iC;case"completed":return nC;case"waitingAuthorization":return()=>Ze(rC,{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}},pC=({status:e})=>{if(!e||e==="pending"){let r="var(--privy-color-foreground-4)";return br("div",{style:{position:"relative"},children:[Ze(vt,{color:r,style:{position:"absolute"}}),Ze(zs,{color:r}),Ze(Fa,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=dC(e),o=cC(e);return Ze("div",{style:{borderColor:o,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&Ze(t,{width:"4rem",height:"4rem",color:o})})},uC=wm.p`
1541
1541
  font-size: 1rem;
1542
1542
  color: var(--privy-color-foreground-3);
1543
1543
  margin-bottom: 1rem;
1544
1544
  display: flex;
1545
1545
  flex-direction: column;
1546
1546
  gap: 1rem;
1547
- `,mC=vm.div`
1547
+ `,mC=wm.div`
1548
1548
  display: flex;
1549
1549
  flex-direction: column;
1550
1550
  align-items: center;
@@ -1552,7 +1552,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1552
1552
  margin-left: 1.75rem;
1553
1553
  margin-right: 1.75rem;
1554
1554
  padding: 2rem 0;
1555
- `;import fC from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import hC from"styled-components";import{Fragment as gC,jsx as $o,jsxs as vC}from"react/jsx-runtime";var Cm=()=>{let{closePrivyModal:e}=R();return vC(gC,{children:[$o(S,{},"header"),$o(yC,{children:$o(fC,{style:{width:32,height:32}})}),$o(oo,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),$o(to,{children:$o(D,{onClick:()=>e(),children:"Close"})}),$o(Q,{}),$o(H,{protectedByPrivy:!0})]})},yC=hC.div`
1555
+ `;import fC from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import hC from"styled-components";import{Fragment as gC,jsx as qo,jsxs as vC}from"react/jsx-runtime";var bm=()=>{let{closePrivyModal:e}=I();return vC(gC,{children:[qo(S,{},"header"),qo(yC,{children:qo(fC,{style:{width:32,height:32}})}),qo(ro,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),qo(oo,{children:qo(U,{onClick:()=>e(),children:"Close"})}),qo(Z,{}),qo(G,{protectedByPrivy:!0})]})},yC=hC.div`
1556
1556
  border-radius: 50%;
1557
1557
  height: 68px;
1558
1558
  width: 68px;
@@ -1562,18 +1562,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
1562
1562
  background-color: var(--privy-color-accent);
1563
1563
  color: white;
1564
1564
  margin: 0 auto 24px auto;
1565
- `;import*as Pm from"react-device-detect";import EC from"styled-components";import Il from"styled-components";import{jsx as bm}from"react/jsx-runtime";var Em=({style:e,...t})=>bm("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:bm("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as CC,jsxs as bC}from"react/jsx-runtime";var Tm=Il.div`
1565
+ `;import*as xm from"react-device-detect";import EC from"styled-components";import Wl from"styled-components";import{jsx as Em}from"react/jsx-runtime";var Tm=({style:e,...t})=>Em("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:Em("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});import{jsx as CC,jsxs as bC}from"react/jsx-runtime";var Pm=Wl.div`
1566
1566
  display: flex;
1567
1567
  flex-direction: column;
1568
1568
  justify-content: flex-start;
1569
1569
  gap: 4px;
1570
- `,Wl=Il.div`
1570
+ `,Ml=Wl.div`
1571
1571
  &&& {
1572
1572
  margin-left: 7px; /* TODO: This is a total hack */
1573
1573
  border-left: 2px solid var(--privy-color-foreground-4);
1574
1574
  height: 12px;
1575
1575
  }
1576
- `,Ba=({children:e})=>bC(wC,{children:[CC(Em,{style:{width:"16px",height:"16px"}}),e]}),wC=Il.div`
1576
+ `,Ha=({children:e})=>bC(wC,{children:[CC(Tm,{style:{width:"16px",height:"16px"}}),e]}),wC=Wl.div`
1577
1577
  display: flex;
1578
1578
  justify-content: flex-start;
1579
1579
  justify-items: center;
@@ -1591,15 +1591,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
1591
1591
  margin-bottom: auto;
1592
1592
  }
1593
1593
  }
1594
- `;import{Fragment as xC,jsx as Ie,jsxs as Jn}from"react/jsx-runtime";var TC=()=>{let{navigate:e}=_(),t="https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return Pm.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/phantom-app/"),Jn(PC,{children:[Ie(On,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),Ie(bt,{children:Ie(Yt,{style:{width:"152px",height:"152px"}})}),Jn(Tm,{children:[Ie(Ba,{children:Jn("div",{children:[Ie("span",{children:"Install the "}),Ie("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),Ie(Wl,{}),Ie(Ba,{children:"Set up your first wallet"}),Ie(Wl,{}),Ie(Ba,{children:"Store your recovery phrase in a safe place!"})]}),Ie(la,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},xm=()=>{let{navigateBack:e}=_();return Jn(xC,{children:[Ie(S,{backFn:e},"header"),Ie(Y,{}),Ie(TC,{}),Ie(Q,{}),Jn(K,{children:[Ie("span",{children:"Still not sure? "}),Ie("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},PC=EC(bt)`
1594
+ `;import{Fragment as xC,jsx as We,jsxs as Qn}from"react/jsx-runtime";var TC=()=>{let{navigate:e}=_(),t="https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return xm.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/phantom-app/"),Qn(PC,{children:[We(Dn,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),We(bt,{children:We(Jt,{style:{width:"152px",height:"152px"}})}),Qn(Pm,{children:[We(Ha,{children:Qn("div",{children:[We("span",{children:"Install the "}),We("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),We(Ml,{}),We(Ha,{children:"Set up your first wallet"}),We(Ml,{}),We(Ha,{children:"Store your recovery phrase in a safe place!"})]}),We(ca,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},Sm=()=>{let{navigateBack:e}=_();return Qn(xC,{children:[We(S,{backFn:e},"header"),We(J,{}),We(TC,{}),We(Z,{}),Qn(Y,{children:[We("span",{children:"Still not sure? "}),We("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},PC=EC(bt)`
1595
1595
  gap: 30px;
1596
1596
 
1597
1597
  > :first-child > svg {
1598
1598
  margin-top: 20px;
1599
1599
  }
1600
- `;import l0 from"@heroicons/react/24/outline/EnvelopeIcon";import c0 from"@heroicons/react/24/outline/PhoneIcon";import d0 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as p0,useState as Km}from"react";import{isMobile as u0}from"react-device-detect";import m0 from"styled-components";import{jsx as Qn,jsxs as Sm}from"react/jsx-runtime";var _m=({...e})=>Sm("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[Sm("g",{clipPath:"url(#clip0_2856_1743)",children:[Qn("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Qn("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Qn("defs",{children:Qn("clipPath",{id:"clip0_2856_1743",children:Qn("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import IC from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as WC}from"react";import SC from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as _C,useState as Am}from"react";import Rm from"styled-components";import{Fragment as RC,jsx as Zn,jsxs as km}from"react/jsx-runtime";var Ha=_C((e,t)=>{let[o,r]=Am(""),[n,i]=Am(!1),{authenticated:a}=B(),{initLoginWithEmail:l}=R(),{navigate:s,setModalData:c,currentScreen:u}=_(),{enabled:h,token:f}=ue(),g=cd(o),C=n,b=n||!g,x=T=>{i(!0),l(o,T).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(N=>{c({errorModalData:{error:N,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},E=()=>{h&&!f&&!a?(c({captchaModalData:{callback:T=>l(o,T),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):x(f)};return km(RC,{children:[Zn(AC,{children:km(kC,{children:[Zn(SC,{}),Zn("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:T=>r(T.target.value),onKeyUp:T=>{T.key==="Enter"&&E()},value:o,autoComplete:"email"}),e.stacked?null:Zn(ca,{isSubmitting:C,onClick:E,disabled:b,children:"Submit"})]})}),e.stacked?Zn(D,{loadingText:null,loading:C,disabled:b,onClick:E,children:"Submit"}):null]})}),AC=Rm.div`
1600
+ `;import l0 from"@heroicons/react/24/outline/EnvelopeIcon";import c0 from"@heroicons/react/24/outline/PhoneIcon";import d0 from"@heroicons/react/24/outline/UserCircleIcon";import{useEffect as p0,useState as Ym}from"react";import{isMobile as u0}from"react-device-detect";import m0 from"styled-components";import{jsx as Zn,jsxs as _m}from"react/jsx-runtime";var Am=({...e})=>_m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[_m("g",{clipPath:"url(#clip0_2856_1743)",children:[Zn("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Zn("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Zn("defs",{children:Zn("clipPath",{id:"clip0_2856_1743",children:Zn("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});import IC from"@heroicons/react/24/outline/EnvelopeIcon";import{useRef as WC}from"react";import SC from"@heroicons/react/24/outline/EnvelopeIcon";import{forwardRef as _C,useState as km}from"react";import Im from"styled-components";import{Fragment as RC,jsx as Xn,jsxs as Rm}from"react/jsx-runtime";var Ga=_C((e,t)=>{let[o,r]=km(""),[n,i]=km(!1),{authenticated:a}=H(),{initLoginWithEmail:l}=I(),{navigate:s,setModalData:c,currentScreen:u}=_(),{enabled:h,token:f}=me(),g=dd(o),C=n,b=n||!g,x=T=>{i(!0),l(o,T).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(L=>{c({errorModalData:{error:L,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},E=()=>{h&&!f&&!a?(c({captchaModalData:{callback:T=>l(o,T),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):x(f)};return Rm(RC,{children:[Xn(AC,{children:Rm(kC,{children:[Xn(SC,{}),Xn("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:T=>r(T.target.value),onKeyUp:T=>{T.key==="Enter"&&E()},value:o,autoComplete:"email"}),e.stacked?null:Xn(da,{isSubmitting:C,onClick:E,disabled:b,children:"Submit"})]})}),e.stacked?Xn(U,{loadingText:null,loading:C,disabled:b,onClick:E,children:"Submit"}):null]})}),AC=Im.div`
1601
1601
  width: 100%;
1602
- `,kC=Rm.label`
1602
+ `,kC=Im.label`
1603
1603
  display: block;
1604
1604
  position: relative;
1605
1605
  width: 100%;
@@ -1657,9 +1657,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1657
1657
  && > input::placeholder {
1658
1658
  color: var(--privy-color-foreground-3);
1659
1659
  }
1660
- `;import{Fragment as MC,jsx as Ga,jsxs as Im}from"react/jsx-runtime";var Wm=({isEditable:e,setIsEditable:t})=>{let o=WC(null);return Im(MC,{children:[Ga(go,{if:!e,children:Ga(Ha,{ref:o})}),Ga(go,{if:e,children:Im(ye,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[Ga(IC,{})," Continue with Email"]})})]})};import{useState as NC}from"react";import{jsx as Ml,jsxs as LC}from"react/jsx-runtime";var Mm=()=>{let[e,t]=NC(!1),{currentScreen:o,navigate:r,setModalData:n}=_(),{enabled:i,token:a}=ue(),{initLoginWithFarcaster:l}=R();return LC(ye,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:c=>l(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):(await l(a),r("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:o||"LANDING"}}),r("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[Ml(gr,{})," Farcaster",e&&Ml("span",{children:Ml(lr,{})})]})};import KC from"@heroicons/react/24/outline/PhoneIcon";import{useRef as YC}from"react";import{forwardRef as zC,useState as Nl}from"react";import Fm from"styled-components";import OC from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as DC,AsYouType as UC,getCountries as FC,getCountryCallingCode as Va,getExampleNumber as BC}from"libphonenumber-js/min";import{jsx as VC,jsxs as GC}from"react/jsx-runtime";var Xn=(e,t)=>DC(String(e),t),za=(e,t)=>`+${Va(t)} ${e}`,Nm=e=>`*${e.replaceAll("-","").slice(-4)}`,Lm=e=>new UC(e),HC=FC().map(e=>({code:e,callCode:Va(e)})),Om=e=>BC(e,OC)?.formatNational(),Dm=({value:e,onChange:t})=>VC("select",{value:e,onChange:t,children:HC.map(o=>GC("option",{value:o.code,children:[o.code," +",o.callCode]},o.code))});import{Fragment as jC,jsx as ei,jsxs as Um}from"react/jsx-runtime";var ln=zC((e,t)=>{let{app:o}=_(),[r,n]=Nl(""),[i,a]=Nl(o?.intl.defaultCountry??"US"),l=Xn(r,i),s=Lm(i),c=Om(i),u=Va(i),h=!l,[f,g]=Nl(!1),C=u.length,b=T=>{let N=T.target.value;a(N),n(""),e.onChange&&e.onChange({rawPhoneNumber:r,qualifiedPhoneNumber:za(r,N),countryCode:N,isValid:Xn(r,i)})},x=T=>{try{let N=T.replace(/\D/g,""),k=r.replace(/\D/g,""),M=N===k?T:s.input(T);n(M),e.onChange&&e.onChange({rawPhoneNumber:M,qualifiedPhoneNumber:za(T,i),countryCode:i,isValid:Xn(T,i)})}catch(N){console.error("Error processing phone number:",N)}},E=()=>{g(!0);let T=za(r,i);e.onSubmit({rawPhoneNumber:r,qualifiedPhoneNumber:T,countryCode:i,isValid:Xn(r,i)}).finally(()=>g(!1))};return Um(jC,{children:[ei($C,{children:Um(qC,{callingCodeLength:C,children:[ei(Dm,{value:i,onChange:b}),ei("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:T=>{x(T.target.value)},onKeyUp:T=>{T.key==="Enter"&&E()},value:r,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?ei(ca,{isSubmitting:f,onClick:E,disabled:h,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?ei(D,{loading:f,loadingText:null,onClick:E,disabled:h,children:"Submit"}):null]})}),$C=Fm.div`
1660
+ `;import{Fragment as MC,jsx as Va,jsxs as Wm}from"react/jsx-runtime";var Mm=({isEditable:e,setIsEditable:t})=>{let o=WC(null);return Wm(MC,{children:[Va(wo,{if:!e,children:Va(Ga,{ref:o})}),Va(wo,{if:e,children:Wm(ye,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[Va(IC,{})," Continue with Email"]})})]})};import{useState as NC}from"react";import{jsx as Nl,jsxs as LC}from"react/jsx-runtime";var Nm=()=>{let[e,t]=NC(!1),{currentScreen:o,navigate:r,setModalData:n}=_(),{enabled:i,token:a}=me(),{initLoginWithFarcaster:l}=I();return LC(ye,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:c=>l(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):(await l(a),r("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:o||"LANDING"}}),r("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[Nl(vr,{})," Farcaster",e&&Nl("span",{children:Nl(cr,{})})]})};import KC from"@heroicons/react/24/outline/PhoneIcon";import{useRef as YC}from"react";import{forwardRef as zC,useState as Ll}from"react";import Bm from"styled-components";import OC from"libphonenumber-js/examples.mobile.json";import{isPossiblePhoneNumber as DC,AsYouType as UC,getCountries as FC,getCountryCallingCode as za,getExampleNumber as BC}from"libphonenumber-js/min";import{jsx as VC,jsxs as GC}from"react/jsx-runtime";var ei=(e,t)=>DC(String(e),t),$a=(e,t)=>`+${za(t)} ${e}`,Lm=e=>`*${e.replaceAll("-","").slice(-4)}`,Om=e=>new UC(e),HC=FC().map(e=>({code:e,callCode:za(e)})),Dm=e=>BC(e,OC)?.formatNational(),Um=({value:e,onChange:t})=>VC("select",{value:e,onChange:t,children:HC.map(o=>GC("option",{value:o.code,children:[o.code," +",o.callCode]},o.code))});import{Fragment as jC,jsx as ti,jsxs as Fm}from"react/jsx-runtime";var cn=zC((e,t)=>{let{app:o}=_(),[r,n]=Ll(""),[i,a]=Ll(o?.intl.defaultCountry??"US"),l=ei(r,i),s=Om(i),c=Dm(i),u=za(i),h=!l,[f,g]=Ll(!1),C=u.length,b=T=>{let L=T.target.value;a(L),n(""),e.onChange&&e.onChange({rawPhoneNumber:r,qualifiedPhoneNumber:$a(r,L),countryCode:L,isValid:ei(r,i)})},x=T=>{try{let L=T.replace(/\D/g,""),R=r.replace(/\D/g,""),N=L===R?T:s.input(T);n(N),e.onChange&&e.onChange({rawPhoneNumber:N,qualifiedPhoneNumber:$a(T,i),countryCode:i,isValid:ei(T,i)})}catch(L){console.error("Error processing phone number:",L)}},E=()=>{g(!0);let T=$a(r,i);e.onSubmit({rawPhoneNumber:r,qualifiedPhoneNumber:T,countryCode:i,isValid:ei(r,i)}).finally(()=>g(!1))};return Fm(jC,{children:[ti($C,{children:Fm(qC,{callingCodeLength:C,children:[ti(Um,{value:i,onChange:b}),ti("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:T=>{x(T.target.value)},onKeyUp:T=>{T.key==="Enter"&&E()},value:r,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?ti(da,{isSubmitting:f,onClick:E,disabled:h,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?ti(U,{loading:f,loadingText:null,onClick:E,disabled:h,children:"Submit"}):null]})}),$C=Bm.div`
1661
1661
  width: 100%;
1662
- `,qC=Fm.label`
1662
+ `,qC=Bm.label`
1663
1663
  --country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
1664
1664
  --phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
1665
1665
  display: block;
@@ -1745,9 +1745,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
1745
1745
  && > input::placeholder {
1746
1746
  color: var(--privy-color-foreground-3);
1747
1747
  }
1748
- `;import{Fragment as JC,jsx as $a,jsxs as Bm}from"react/jsx-runtime";var Hm=({isEditable:e,setIsEditable:t})=>{let o=YC(null),{authenticated:r}=B(),{navigate:n,setModalData:i,currentScreen:a}=_(),{initLoginWithSms:l}=R(),{enabled:s,token:c}=ue();async function u({qualifiedPhoneNumber:h}){if(s&&!c&&!r)i({captchaModalData:{callback:f=>l(h,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(h,c),n("AWAITING_PASSWORDLESS_CODE")}catch(f){i({errorModalData:{error:f,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return Bm(JC,{children:[$a(go,{if:!e,children:$a(ln,{ref:o,onSubmit:u})}),$a(go,{if:e,children:Bm(ye,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[$a(KC,{})," Continue with SMS"]})})]})};import{jsx as Gm,jsxs as QC}from"react/jsx-runtime";var qa=({style:e,...t})=>QC("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[Gm("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),Gm("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as ti,jsxs as ZC}from"react/jsx-runtime";var ja=({style:e,...t})=>ZC("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[ti("g",{clipPath:"url(#clip0)",children:ti("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),ti("defs",{children:ti("clipPath",{id:"clip0",children:ti("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Vm}from"react/jsx-runtime";var Ka=({style:e,...t})=>Vm("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:Vm("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"#171515"})});import{jsx as Ya,jsxs as XC}from"react/jsx-runtime";var Ja=({style:e,...t})=>XC("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Ya("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Ya("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Ya("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Ya("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Qa}from"react/jsx-runtime";function Za({style:e,...t}){return Qa("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:Qa("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Qa("g",{transform:"scale(5.12,5.12)",children:Qa("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Ll,jsxs as e0}from"react/jsx-runtime";function Xa(e){return e0("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[Ll("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),Ll("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),Ll("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as zm}from"react/jsx-runtime";var es=({style:e,...t})=>zm("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:zm("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"#000000"})});import{jsx as br,jsxs as o0}from"react/jsx-runtime";var t0={apple:{logo:br(qa,{}),displayName:"Apple"},discord:{logo:br(ja,{}),displayName:"Discord"},github:{logo:br(Ka,{}),displayName:"GitHub"},google:{logo:br(Ja,{}),displayName:"Google"},linkedin:{logo:br(Za,{}),displayName:"LinkedIn"},twitter:{logo:br(es,{}),displayName:"Twitter"},tiktok:{logo:br(Xa,{}),displayName:"TikTok"}},qo=({provider:e})=>{let{enabled:t,token:o}=ue(),{navigate:r,setModalData:n}=_(),{initLoginWithOAuth:i}=R(),{displayName:a,logo:l}=t0[e];return o0(ye,{onClick:()=>{t&&!o?(n({captchaModalData:{callback:c=>i(e,c),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):i(e)},children:[l," ",a]})};import r0 from"@heroicons/react/24/outline/ChevronRightIcon";import n0 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Ol,jsxs as i0}from"react/jsx-runtime";var $m=({onClick:e,text:t})=>i0(ye,{onClick:e,children:[Ol(n0,{}),Ol(ua,{children:t}),Ol(r0,{})]});import a0 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as qm,jsxs as s0}from"react/jsx-runtime";var jm=({onClick:e,text:t,icon:o})=>s0(ye,{onClick:e,children:[o,qm(ua,{children:t}),qm(a0,{})]});import{Fragment as oi,jsx as we,jsxs as cn}from"react/jsx-runtime";var Ym=()=>{let{closePrivyModal:e,connectors:t}=R(),{app:o,onUserCloseViaDialogOrKeybindRef:r}=_(),{email:n,sms:i,google:a,twitter:l,discord:s,github:c,tiktok:u,linkedin:h,apple:f,wallet:g,farcaster:C}=o?.loginMethods??{},b=o?.appearance.loginGroupPriority||"web2-first",x=o?.appearance.hideDirectWeb2Inputs,[E,T]=Km("default"),[N,k]=Km(n?"email":"sms");p0(()=>{k(n?"email":"sms")},[n]);let M=()=>{e({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{T("default")},150)};r.current=M;let L=[n&&we(Wm,{isEditable:N==="email",setIsEditable:()=>{k("email")}}),i&&we(Hm,{isEditable:N==="sms",setIsEditable:()=>{k("sms")}})].filter(Boolean),I=[a&&we(qo,{provider:"google"}),l&&(!u0||o?.loginConfig.twitterOAuthOnMobileEnabled)&&we(qo,{provider:"twitter"}),s&&we(qo,{provider:"discord"}),c&&we(qo,{provider:"github"}),u&&we(qo,{provider:"tiktok"}),h&&we(qo,{provider:"linkedin"}),f&&we(qo,{provider:"apple"}),C&&we(Mm,{})].filter(Boolean),F=al(o?.appearance.walletList??[],t,!1),z=E==="default"?void 0:()=>{T("default")},X=h0({priority:b,email:n,sms:i,social:I}),O=y0({priority:b,email:n,sms:i,social:I}),G=g0({priority:b,email:n,sms:i,social:I}),A=we($m,{text:G,onClick:()=>T("web3-overflow")}),se=we(jm,{text:X,icon:O,onClick:()=>T("web2-overflow")}),ne=x?0:1;return cn(oi,{children:[we(S,{title:"Log in or sign up",onClose:M,backFn:z}),E==="default"&&we(f0,{}),we(bp,{style:{overflow:"hidden",padding:2},children:cn(Zt,{children:[E==="default"&&b==="web2-first"&&cn(oi,{children:[...L,...I.length+L.length>4?I.slice(0,3-L.length):I,L.length+I.length>4&&se,g&&A]}),E==="default"&&b==="web3-first"&&cn(oi,{children:[g&&cn(oi,{children:[...F.length>4?F.slice(0,3):F,F.length>4&&A]}),L.length+I.length>ne&&se,L.length+I.length===ne&&L.length?L[0]:null,L.length+I.length===ne&&I.length?I[0]:null]}),E==="web2-overflow"&&cn(oi,{children:[...b==="web3-first"?L:[],...I]}),...E==="web3-overflow"?F:[]]})}),o&&we(pa,{app:o}),we(H,{protectedByPrivy:!0})]})},f0=m0(Ea)`
1748
+ `;import{Fragment as JC,jsx as qa,jsxs as Hm}from"react/jsx-runtime";var Gm=({isEditable:e,setIsEditable:t})=>{let o=YC(null),{authenticated:r}=H(),{navigate:n,setModalData:i,currentScreen:a}=_(),{initLoginWithSms:l}=I(),{enabled:s,token:c}=me();async function u({qualifiedPhoneNumber:h}){if(s&&!c&&!r)i({captchaModalData:{callback:f=>l(h,f),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(h,c),n("AWAITING_PASSWORDLESS_CODE")}catch(f){i({errorModalData:{error:f,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return Hm(JC,{children:[qa(wo,{if:!e,children:qa(cn,{ref:o,onSubmit:u})}),qa(wo,{if:e,children:Hm(ye,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[qa(KC,{})," Continue with SMS"]})})]})};import{jsx as Vm,jsxs as QC}from"react/jsx-runtime";var ja=({style:e,...t})=>QC("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[Vm("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),Vm("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});import{jsx as oi,jsxs as ZC}from"react/jsx-runtime";var Ka=({style:e,...t})=>ZC("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[oi("g",{clipPath:"url(#clip0)",children:oi("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),oi("defs",{children:oi("clipPath",{id:"clip0",children:oi("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as zm}from"react/jsx-runtime";var Ya=({style:e,...t})=>zm("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:zm("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"#171515"})});import{jsx as Ja,jsxs as XC}from"react/jsx-runtime";var Qa=({style:e,...t})=>XC("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[Ja("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),Ja("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),Ja("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),Ja("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});import{jsx as Za}from"react/jsx-runtime";function Xa({style:e,...t}){return Za("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:Za("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Za("g",{transform:"scale(5.12,5.12)",children:Za("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}import{jsx as Ol,jsxs as e0}from"react/jsx-runtime";function es(e){return e0("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[Ol("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),Ol("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),Ol("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}import{jsx as $m}from"react/jsx-runtime";var ts=({style:e,...t})=>$m("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:$m("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"#000000"})});import{jsx as Er,jsxs as o0}from"react/jsx-runtime";var t0={apple:{logo:Er(ja,{}),displayName:"Apple"},discord:{logo:Er(Ka,{}),displayName:"Discord"},github:{logo:Er(Ya,{}),displayName:"GitHub"},google:{logo:Er(Qa,{}),displayName:"Google"},linkedin:{logo:Er(Xa,{}),displayName:"LinkedIn"},twitter:{logo:Er(ts,{}),displayName:"Twitter"},tiktok:{logo:Er(es,{}),displayName:"TikTok"}},jo=({provider:e})=>{let{enabled:t,token:o}=me(),{navigate:r,setModalData:n}=_(),{initLoginWithOAuth:i}=I(),{displayName:a,logo:l}=t0[e];return o0(ye,{onClick:()=>{t&&!o?(n({captchaModalData:{callback:c=>i(e,c),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):i(e)},children:[l," ",a]})};import r0 from"@heroicons/react/24/outline/ChevronRightIcon";import n0 from"@heroicons/react/24/outline/WalletIcon";import{jsx as Dl,jsxs as i0}from"react/jsx-runtime";var qm=({onClick:e,text:t})=>i0(ye,{onClick:e,children:[Dl(n0,{}),Dl(ma,{children:t}),Dl(r0,{})]});import a0 from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as jm,jsxs as s0}from"react/jsx-runtime";var Km=({onClick:e,text:t,icon:o})=>s0(ye,{onClick:e,children:[o,jm(ma,{children:t}),jm(a0,{})]});import{Fragment as ri,jsx as we,jsxs as dn}from"react/jsx-runtime";var Jm=()=>{let{closePrivyModal:e,connectors:t}=I(),{app:o,onUserCloseViaDialogOrKeybindRef:r}=_(),{email:n,sms:i,google:a,twitter:l,discord:s,github:c,tiktok:u,linkedin:h,apple:f,wallet:g,farcaster:C}=o?.loginMethods??{},b=o?.appearance.loginGroupPriority||"web2-first",x=o?.appearance.hideDirectWeb2Inputs,[E,T]=Ym("default"),[L,R]=Ym(n?"email":"sms");p0(()=>{R(n?"email":"sms")},[n]);let N=()=>{e({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{T("default")},150)};r.current=N;let O=[n&&we(Mm,{isEditable:L==="email",setIsEditable:()=>{R("email")}}),i&&we(Gm,{isEditable:L==="sms",setIsEditable:()=>{R("sms")}})].filter(Boolean),W=[a&&we(jo,{provider:"google"}),l&&(!u0||o?.loginConfig.twitterOAuthOnMobileEnabled)&&we(jo,{provider:"twitter"}),s&&we(jo,{provider:"discord"}),c&&we(jo,{provider:"github"}),u&&we(jo,{provider:"tiktok"}),h&&we(jo,{provider:"linkedin"}),f&&we(jo,{provider:"apple"}),C&&we(Nm,{})].filter(Boolean),B=sl(o?.appearance.walletList??[],t,!1),$=E==="default"?void 0:()=>{T("default")},ee=h0({priority:b,email:n,sms:i,social:W}),D=y0({priority:b,email:n,sms:i,social:W}),V=g0({priority:b,email:n,sms:i,social:W}),A=we(qm,{text:V,onClick:()=>T("web3-overflow")}),le=we(Km,{text:ee,icon:D,onClick:()=>T("web2-overflow")}),ne=x?0:1;return dn(ri,{children:[we(S,{title:"Log in or sign up",onClose:N,backFn:$}),E==="default"&&we(f0,{}),we(Ep,{style:{overflow:"hidden",padding:2},children:dn(Xt,{children:[E==="default"&&b==="web2-first"&&dn(ri,{children:[...O,...W.length+O.length>4?W.slice(0,3-O.length):W,O.length+W.length>4&&le,g&&A]}),E==="default"&&b==="web3-first"&&dn(ri,{children:[g&&dn(ri,{children:[...B.length>4?B.slice(0,3):B,B.length>4&&A]}),O.length+W.length>ne&&le,O.length+W.length===ne&&O.length?O[0]:null,O.length+W.length===ne&&W.length?W[0]:null]}),E==="web2-overflow"&&dn(ri,{children:[...b==="web3-first"?O:[],...W]}),...E==="web3-overflow"?B:[]]})}),o&&we(ua,{app:o}),we(G,{protectedByPrivy:!0})]})},f0=m0(Ta)`
1749
1749
  margin-bottom: 16px;
1750
- `,h0=({priority:e,email:t,sms:o,social:r})=>e==="web2-first"?"Other socials":t&&o&&r.length>0||t&&r.length>0?"Log in with email or socials":o&&r.length>0?"Log in with sms or socials":t&&o?"Continue with email or sms":t?"Continue with email":o?"Continue with sms":"Log in with a social account",y0=({priority:e,email:t,sms:o,social:r})=>e==="web2-first"||r.length>0?we(d0,{}):t&&o?we(_m,{}):t?we(l0,{}):o?we(c0,{}):null,g0=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import v0 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as w0,jsx as jo,jsxs as C0}from"react/jsx-runtime";var Jm=()=>{let{app:e}=_();return C0(w0,{children:[jo(S,{},"header"),jo(Y,{}),jo(be,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:jo(v0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),jo(to,{children:jo(Ha,{stacked:!0})}),jo(Q,{}),jo(H,{protectedByPrivy:!0})]})};import b0 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as E0,jsx as Ko,jsxs as T0}from"react/jsx-runtime";var Qm=()=>{let{app:e,currentScreen:t,data:o,navigate:r,setModalData:n}=_(),{initLoginWithSms:i}=R();async function a({qualifiedPhoneNumber:l}){try{await i(l),r("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:o?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),r("ERROR_SCREEN")}}return T0(E0,{children:[Ko(S,{},"header"),Ko(Y,{}),Ko(be,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Ko(b0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Ko(to,{children:Ko(ln,{stacked:!0,onSubmit:a})}),Ko(Q,{}),Ko(H,{protectedByPrivy:!0})]})};import{Fragment as P0,jsx as ri,jsxs as x0}from"react/jsx-runtime";var Zm=()=>{let{linkingHint:e}=R(),{app:t}=_(),o=e?`Select the wallet with ${Io(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return x0(P0,{children:[ri(S,{},"header"),ri(oo,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),ri(Zt,{children:ri(Jr,{connectOnly:!1})}),ri(H,{protectedByPrivy:!0})]})};import{jsx as Xm,jsxs as S0}from"react/jsx-runtime";var ef=({style:e,...t})=>S0("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:[Xm("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),Xm("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as _0,jsx as Yo,jsxs as tf}from"react/jsx-runtime";var of=()=>{let{closePrivyModal:e}=R(),{navigate:t}=_();return tf(_0,{children:[Yo(S,{},"header"),Yo(Y,{}),Yo(ef,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Yo(oo,{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"}}),tf(to,{children:[Yo(D,{onClick:()=>t("LANDING"),children:"Try again"}),Yo(Lt,{onClick:()=>e(),children:"Cancel"})]}),Yo(Q,{}),Yo(H,{protectedByPrivy:!0})]})};import uf from"@heroicons/react/20/solid/CheckIcon";import K0 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Y0 from"@heroicons/react/24/outline/FingerPrintIcon";import J0 from"@heroicons/react/24/outline/PhoneIcon";import mf from"@heroicons/react/24/outline/TrashIcon";import Q0 from"@heroicons/react/24/solid/CheckBadgeIcon";import ff from"@heroicons/react/24/solid/CheckCircleIcon";import hf from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Z0 from"@heroicons/react/24/solid/IdentificationIcon";import Gl from"@heroicons/react/24/solid/PhoneIcon";import Hl from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as yf,useState as Eo}from"react";import{useState as Fl}from"react";import{isMobile as M0}from"react-device-detect";import lf from"styled-components";import{Dialog as rf,Transition as Dl}from"@headlessui/react";import Ul from"react";import pn from"styled-components";import{jsx as dn,jsxs as W0}from"react/jsx-runtime";var nf=({children:e,open:t,onClick:o,...r})=>dn(Dl,{show:t,as:Ul.Fragment,children:W0(rf,{onClose:o,...r,as:k0,children:[dn(Dl.Child,{as:Ul.Fragment,enterFrom:"entering",leaveTo:"leaving",children:dn(A0,{"aria-hidden":"true"})}),dn(R0,{children:dn(Dl.Child,{as:Ul.Fragment,enterFrom:"entering",leaveTo:"leaving",children:dn(rf.Panel,{as:I0,children:e})})})]})}),un=pn.div`
1750
+ `,h0=({priority:e,email:t,sms:o,social:r})=>e==="web2-first"?"Other socials":t&&o&&r.length>0||t&&r.length>0?"Log in with email or socials":o&&r.length>0?"Log in with sms or socials":t&&o?"Continue with email or sms":t?"Continue with email":o?"Continue with sms":"Log in with a social account",y0=({priority:e,email:t,sms:o,social:r})=>e==="web2-first"||r.length>0?we(d0,{}):t&&o?we(Am,{}):t?we(l0,{}):o?we(c0,{}):null,g0=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";import v0 from"@heroicons/react/24/outline/EnvelopeIcon";import{Fragment as w0,jsx as Ko,jsxs as C0}from"react/jsx-runtime";var Qm=()=>{let{app:e}=_();return C0(w0,{children:[Ko(S,{},"header"),Ko(J,{}),Ko(Ee,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:Ko(v0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),Ko(oo,{children:Ko(Ga,{stacked:!0})}),Ko(Z,{}),Ko(G,{protectedByPrivy:!0})]})};import b0 from"@heroicons/react/24/outline/PhoneIcon";import{Fragment as E0,jsx as Yo,jsxs as T0}from"react/jsx-runtime";var Zm=()=>{let{app:e,currentScreen:t,data:o,navigate:r,setModalData:n}=_(),{initLoginWithSms:i}=I();async function a({qualifiedPhoneNumber:l}){try{await i(l),r("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:o?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),r("ERROR_SCREEN")}}return T0(E0,{children:[Yo(S,{},"header"),Yo(J,{}),Yo(Ee,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:Yo(b0,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),Yo(oo,{children:Yo(cn,{stacked:!0,onSubmit:a})}),Yo(Z,{}),Yo(G,{protectedByPrivy:!0})]})};import{Fragment as P0,jsx as ni,jsxs as x0}from"react/jsx-runtime";var Xm=()=>{let{linkingHint:e}=I(),{app:t}=_(),o=e?`Select the wallet with ${Wo(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return x0(P0,{children:[ni(S,{},"header"),ni(ro,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),ni(Xt,{children:ni(Qr,{connectOnly:!1})}),ni(G,{protectedByPrivy:!0})]})};import{jsx as ef,jsxs as S0}from"react/jsx-runtime";var tf=({style:e,...t})=>S0("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:[ef("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),ef("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});import{Fragment as _0,jsx as Jo,jsxs as of}from"react/jsx-runtime";var rf=()=>{let{closePrivyModal:e}=I(),{navigate:t}=_();return of(_0,{children:[Jo(S,{},"header"),Jo(J,{}),Jo(tf,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),Jo(ro,{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"}}),of(oo,{children:[Jo(U,{onClick:()=>t("LANDING"),children:"Try again"}),Jo(Ot,{onClick:()=>e(),children:"Cancel"})]}),Jo(Z,{}),Jo(G,{protectedByPrivy:!0})]})};import mf from"@heroicons/react/20/solid/CheckIcon";import K0 from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import Y0 from"@heroicons/react/24/outline/FingerPrintIcon";import J0 from"@heroicons/react/24/outline/PhoneIcon";import ff from"@heroicons/react/24/outline/TrashIcon";import Q0 from"@heroicons/react/24/solid/CheckBadgeIcon";import hf from"@heroicons/react/24/solid/CheckCircleIcon";import yf from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import Z0 from"@heroicons/react/24/solid/IdentificationIcon";import Vl from"@heroicons/react/24/solid/PhoneIcon";import Gl from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as gf,useState as Po}from"react";import{useState as Bl}from"react";import{isMobile as M0}from"react-device-detect";import cf from"styled-components";import{Dialog as nf,Transition as Ul}from"@headlessui/react";import Fl from"react";import un from"styled-components";import{jsx as pn,jsxs as W0}from"react/jsx-runtime";var af=({children:e,open:t,onClick:o,...r})=>pn(Ul,{show:t,as:Fl.Fragment,children:W0(nf,{onClose:o,...r,as:k0,children:[pn(Ul.Child,{as:Fl.Fragment,enterFrom:"entering",leaveTo:"leaving",children:pn(A0,{"aria-hidden":"true"})}),pn(R0,{children:pn(Ul.Child,{as:Fl.Fragment,enterFrom:"entering",leaveTo:"leaving",children:pn(nf.Panel,{as:I0,children:e})})})]})}),mn=un.div`
1751
1751
  display: flex;
1752
1752
  flex-direction: column;
1753
1753
  text-align: center;
@@ -1770,7 +1770,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1770
1770
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
1771
1771
  border-radius: var(--privy-border-radius-lg);
1772
1772
  }
1773
- `,A0=pn.div`
1773
+ `,A0=un.div`
1774
1774
  position: fixed;
1775
1775
  inset: 0;
1776
1776
 
@@ -1783,10 +1783,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
1783
1783
  backdrop-filter: unset;
1784
1784
  -webkit-backdrop-filter: unset;
1785
1785
  }
1786
- `,k0=pn.div`
1786
+ `,k0=un.div`
1787
1787
  position: relative;
1788
1788
  z-index: 999999;
1789
- `,R0=pn.div`
1789
+ `,R0=un.div`
1790
1790
  position: fixed;
1791
1791
  inset: 0;
1792
1792
  display: flex;
@@ -1794,7 +1794,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1794
1794
  justify-content: center;
1795
1795
  width: 100vw;
1796
1796
  min-height: 100vh;
1797
- `,I0=pn.div`
1797
+ `,I0=un.div`
1798
1798
  // reset some default dialog styles
1799
1799
  padding: 0;
1800
1800
  background: transparent;
@@ -1841,19 +1841,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
1841
1841
  box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
1842
1842
  border-radius: var(--privy-border-radius-lg);
1843
1843
  }
1844
- `,af=pn.div`
1844
+ `,sf=un.div`
1845
1845
  display: flex;
1846
1846
  flex-direction: column;
1847
1847
  align-items: center;
1848
1848
  justify-content: center;
1849
1849
  height: 100%;
1850
- `;import{Fragment as B0,jsx as ni,jsxs as F0}from"react/jsx-runtime";var ii=6,N0=new Array(ii).fill("");function L0(e){return e.replace(/\s+/g,"")}function Bl(e){return/^[0-9]{1}$/.test(e)}function sf(e){return e.length===ii&&e.every(Bl)}function O0(e,t){return e.reduce((o,r)=>o+Number(t(r)),0)}var mn=({onChange:e,disabled:t,errorReasonOverride:o,success:r})=>{let[n,i]=Fl(N0),[a,l]=Fl(null),[s,c]=Fl(null),u=async C=>{C.preventDefault();let b=L0(C.currentTarget.value);if(b==="")return;let x=O0(n,Bl),E=b.split(""),T=!E.every(Bl),N=E.length+x>ii;if(T){l("Passcode can only be numbers"),c(1);return}if(N){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let k=Number(C.currentTarget.name?.charAt(4)),M=[...b||[""]].slice(0,ii-k),L=[...n.slice(0,k),...M,...n.slice(k+M.length)];i(L);let I=M.length,F=Math.min(Math.max(k+I,0),ii-1);if(document.querySelector(`input[name=pin-${F}]`)?.focus(),sf(L))try{await e(L.join("")),document.querySelector(`input[name=pin-${F}]`)?.blur()}catch(X){c(1),l(X.message)}else try{await e(null)}catch(X){c(1),l(X.message)}},h=C=>{s===1&&(l(null),c(null));let b=[...n.slice(0,C),"",...n.slice(C+1)];i(b),C>0&&document.querySelector(`input[name=pin-${C-1}]`)?.focus(),sf(b)?e(b.join("")):e(null)},g=r?"success":!!(o||a)?"fail":"";return ni(B0,{children:F0(D0,{children:[ni("div",{children:n.map((C,b)=>ni("input",{name:`pin-${b}`,type:"text",value:n[b],onChange:u,onKeyUp:x=>{x.key==="Backspace"&&h(b)},inputMode:"numeric",autoFocus:b===0,pattern:"[0-9]",className:g,autoComplete:M0?"one-time-code":"off",disabled:t},b))}),ni("div",{children:ni(U0,{fail:!!o||!!a,children:o||a})})]})})},D0=lf.div`
1850
+ `;import{Fragment as B0,jsx as ii,jsxs as F0}from"react/jsx-runtime";var ai=6,N0=new Array(ai).fill("");function L0(e){return e.replace(/\s+/g,"")}function Hl(e){return/^[0-9]{1}$/.test(e)}function lf(e){return e.length===ai&&e.every(Hl)}function O0(e,t){return e.reduce((o,r)=>o+Number(t(r)),0)}var fn=({onChange:e,disabled:t,errorReasonOverride:o,success:r})=>{let[n,i]=Bl(N0),[a,l]=Bl(null),[s,c]=Bl(null),u=async C=>{C.preventDefault();let b=L0(C.currentTarget.value);if(b==="")return;let x=O0(n,Hl),E=b.split(""),T=!E.every(Hl),L=E.length+x>ai;if(T){l("Passcode can only be numbers"),c(1);return}if(L){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let R=Number(C.currentTarget.name?.charAt(4)),N=[...b||[""]].slice(0,ai-R),O=[...n.slice(0,R),...N,...n.slice(R+N.length)];i(O);let W=N.length,B=Math.min(Math.max(R+W,0),ai-1);if(document.querySelector(`input[name=pin-${B}]`)?.focus(),lf(O))try{await e(O.join("")),document.querySelector(`input[name=pin-${B}]`)?.blur()}catch(ee){c(1),l(ee.message)}else try{await e(null)}catch(ee){c(1),l(ee.message)}},h=C=>{s===1&&(l(null),c(null));let b=[...n.slice(0,C),"",...n.slice(C+1)];i(b),C>0&&document.querySelector(`input[name=pin-${C-1}]`)?.focus(),lf(b)?e(b.join("")):e(null)},g=r?"success":!!(o||a)?"fail":"";return ii(B0,{children:F0(D0,{children:[ii("div",{children:n.map((C,b)=>ii("input",{name:`pin-${b}`,type:"text",value:n[b],onChange:u,onKeyUp:x=>{x.key==="Backspace"&&h(b)},inputMode:"numeric",autoFocus:b===0,pattern:"[0-9]",className:g,autoComplete:M0?"one-time-code":"off",disabled:t},b))}),ii("div",{children:ii(U0,{fail:!!o||!!a,children:o||a})})]})})},D0=cf.div`
1851
1851
  display: flex;
1852
1852
  flex-direction: column;
1853
1853
  width: 100%;
1854
1854
  gap: 8px;
1855
1855
 
1856
- ${un}[data-height='medium'] & {
1856
+ ${mn}[data-height='medium'] & {
1857
1857
  margin-top: 22px;
1858
1858
  }
1859
1859
 
@@ -1918,7 +1918,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1918
1918
  transform: translate(1px, 0px);
1919
1919
  }
1920
1920
  }
1921
- `,U0=lf.div`
1921
+ `,U0=cf.div`
1922
1922
  line-height: 20px;
1923
1923
  font-size: 13px;
1924
1924
  display: flex;
@@ -1926,7 +1926,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1926
1926
  width: 100%;
1927
1927
 
1928
1928
  color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
1929
- `;import{useContext as H0}from"react";function fn(){let{promptMfa:e,init:t,submit:o,cancel:r}=H0(he);return{promptMfa:e,init:t,submit:o,cancel:r}}import{useContext as G0}from"react";function ai(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:r,unenroll:n,enrollInMfa:i}=G0(he);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:r,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>i(!0),closeMfaEnrollmentModal:()=>i(!1)}}import V0 from"styled-components";import{jsx as cf,jsxs as $0}from"react/jsx-runtime";var df=e=>$0(z0,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[cf("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),cf("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),z0=V0.svg`
1929
+ `;import{useContext as H0}from"react";function hn(){let{promptMfa:e,init:t,submit:o,cancel:r}=H0(ae);return{promptMfa:e,init:t,submit:o,cancel:r}}import{useContext as G0}from"react";function si(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:r,unenroll:n,enrollInMfa:i}=G0(ae);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:r,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>i(!0),closeMfaEnrollmentModal:()=>i(!1)}}import V0 from"styled-components";import{jsx as df,jsxs as $0}from"react/jsx-runtime";var pf=e=>$0(z0,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[df("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),df("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),z0=V0.svg`
1930
1930
  height: 90px;
1931
1931
  width: 90px;
1932
1932
 
@@ -1937,7 +1937,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1937
1937
  > path {
1938
1938
  fill: white;
1939
1939
  }
1940
- `;import q0 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as j0}from"react/jsx-runtime";var pf=({size:e,authUrl:t})=>j0(Da,{url:t,squareLogoElement:q0,size:e,fgColor:"#1F1F1F"});import{Fragment as xt,jsx as y,jsxs as j}from"react/jsx-runtime";var gf=()=>{let{user:e,enrollInMfa:t}=B(),[o,r]=Eo(null),{unenrollWithSms:n,unenrollWithTotp:i}=ai(),{app:a,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),{closePrivyModal:u}=R(),{promptMfa:h}=fn(),[f,g]=Eo(s?.mfaEnrollmentFlow?.seenIntro||!1),[C,b]=Eo(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),x=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{r(null),b(null)},500)};c.current=x;let E=e?.mfaMethods.includes("sms"),T=!!e?.phone,N=e?.mfaMethods.includes("totp"),k=E||N;yf(()=>{k&&g(!0)},[k]);function M(){r(null),b(null)}function L(){g(!1)}async function I(O){await h(),b(O)}if(!l||!e||!a)return j(xt,{children:[y(S,{onClose:x},"header"),y(Oe,{children:y(df,{})}),y(Do,{children:y(vt,{})}),y(K,{})]});async function F(){r(null);try{await n()}catch{r(null)}}async function z(){r(null);try{await i()}catch{r(null)}}if(o==="sms")return j(xt,{children:[y(S,{backFn:M,onClose:x},"header"),y(Oe,{children:y($e,{children:y(Gl,{})})}),y(ge,{children:"Remove SMS verification?"}),j(pe,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),y(Uo,{children:y(D,{warn:!0,onClick:F,children:"Remove SMS for MFA"})}),y(K,{})]});if(o==="totp")return j(xt,{children:[y(S,{backFn:M,onClose:x},"header"),y(Oe,{children:y($e,{children:y(hf,{})})}),y(ge,{children:"Remove Authenticator App verification?"}),j(pe,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),y(Uo,{children:y(D,{warn:!0,onClick:z,children:"Remove Authenticator App for MFA"})}),y(K,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!k)return j(xt,{children:[y(S,{onClose:x},"header"),y(Oe,{children:y($e,{children:y(Hl,{})})}),y(ge,{children:"Add more security"}),j(pe,{children:[a?.name," does not have any verification methods enabled."]}),y(Uo,{children:y(D,{onClick:x,children:"Close"})}),y(K,{})]});let X=!k&&!f;if(X)return j(xt,{children:[y(S,{onClose:x},"header"),y(Oe,{children:y($e,{children:y(Hl,{})})}),y(ge,{children:"Transaction Protection"}),y(pe,{children:"Set up transaction protection to add an extra layer of security to your account"}),j(Tp,{children:[j(Ys,{children:[y(Ks,{children:y(Q0,{})}),"Enable 2-Step verification for your ",a?.name," wallet."]}),j(Ys,{children:[y(Ks,{children:y(Z0,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),j(Uo,{children:[y(D,{onClick:()=>g(!0),children:"Continue"}),y(Lt,{onClick:x,children:"Not now"})]}),y(K,{})]});switch(C){case"sms":return y(X0,{onComplete:x,onReset:M,onClose:x});case"totp":return y(eb,{onComplete:x,onClose:x,onReset:M});default:return j(xt,{children:[y(S,{backFn:X?L:void 0,onClose:x},"header"),y(Oe,{children:y($e,{children:y(Hl,{})})}),y(ge,{children:"Choose a verification method"}),k?y(pe,{children:"To add or delete verification methods, verification is required."}):y(pe,{children:"How would you like to verify your identity? You can change this later."}),j(ma,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||N)&&j(fa,{children:[y(ye,{disabled:N,onClick:()=>I("totp"),children:j(ya,{children:[j(ha,{children:[y(K0,{}),"Authenticator App"]}),N?j($r,{children:[y(uf,{}),"Added"]}):y($r,{children:"Recommended"})]})}),N&&y(Js,{id:"remove",onClick:()=>r("totp"),children:y(mf,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||E)&&j(fa,{children:[y(ye,{disabled:E||T,onClick:()=>I("sms"),children:j(ya,{children:[j(ha,{children:[y(J0,{}),"SMS"]}),E&&j($r,{children:[y(uf,{}),"Added"]}),T&&y($r,{children:"Disabled"})]})}),E&&y(Js,{id:"remove",onClick:()=>r("sms"),children:y(mf,{})})]},"sms"),y(fa,{children:y(ye,{disabled:!0,children:j(ya,{children:[j(ha,{children:[y(Y0,{}),"Passkey"]}),y($r,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),y(K,{})]})}},X0=({onComplete:e,onReset:t,onClose:o})=>{let[r,n]=Eo(""),[i,a]=Eo(!1),[l,s]=Eo("enroll"),{initEnrollmentWithSms:c,submitEnrollmentWithSms:u}=ai(),{app:h,data:f,currentScreen:g,navigate:C,setModalData:b}=_();function x(){f?.mfaEnrollmentFlow?.onSuccess(),e()}async function E({qualifiedPhoneNumber:k}){try{await c({phoneNumber:k}),n(k),s("verify")}catch(M){b({mfaEnrollmentFlow:f?.mfaEnrollmentFlow?{...f?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:M,previousScreen:g||"MFA_ENROLLMENT_FLOW_SCREEN"}}),C("ERROR_SCREEN")}}async function T(k){try{if(!k)return;await u({phoneNumber:r,mfaCode:k}),a(!0)}catch(M){throw fl(M)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):en(M)?new Error("The code you entered is not valid"):Xr(M)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):hl(M)?new Error("Verification canceled"):new Error("Unknown error")}}function N(){l==="verify"?s("enroll"):t()}return l==="enroll"?j(xt,{children:[y(S,{backFn:t,onClose:o},"header"),y(Oe,{children:y($e,{children:y(Gl,{})})}),y(ge,{children:"Set up SMS verification"}),y(pe,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),j(Do,{children:[y(ln,{onSubmit:E}),j(Pp,{children:["By providing your mobile number, you agree to receive text messages from ",h?.name,". Some carrier charges may apply"]})]}),y(K,{})]}):i?j(xt,{children:[y(S,{onClose:x},"header"),y(Oe,{children:y($e,{status:"success",children:y(ff,{})})}),y(ge,{children:"SMS verification added"}),y(pe,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),y(Uo,{children:y(D,{onClick:x,children:"Done"})}),y(K,{})]}):j(xt,{children:[y(S,{backFn:N,onClose:o},"header"),y(Oe,{children:y($e,{children:y(Gl,{})})}),y(ge,{children:"Enter enrollment code"}),j(Do,{children:[y(mn,{onChange:T}),j(pe,{children:["To continue, enter the 6-digit code sent to ",y("strong",{children:Nm(r)})]})]}),y(K,{})]})},eb=({onComplete:e,onClose:t,onReset:o})=>{let[r,n]=Eo("enroll"),[i,a]=Eo(null),[l,s]=Eo(!1),{initEnrollmentWithTotp:c,submitEnrollmentWithTotp:u}=ai(),{data:h}=_();yf(()=>{a(null),c().then(x=>{a(x)}).catch(()=>{a(null),o()})},[]);function f(){h?.mfaEnrollmentFlow?.onSuccess(),e()}function g(){n("verify")}async function C(x){try{if(!x)return;await u({mfaCode:x}),s(!0)}catch(E){throw fl(E)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):en(E)?new Error("The code you entered is not valid"):Xr(E)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):hl(E)?new Error("Verification canceled"):new Error("Unknown error")}}function b(){r==="verify"?n("enroll"):o()}return r==="enroll"?j(xt,{children:[y(S,{backFn:o,onClose:t},"header"),y(ge,{children:"Scan QR code"}),y(pe,{children:"Open your authenticator app and scan the QR code to continue."}),y(Ca,{children:i?.authUrl?y(pf,{authUrl:i.authUrl,size:200}):y(vt,{})}),j(Uo,{children:[y(bt,{children:i?.secret&&y(sn,{itemName:"secret",text:i.secret})}),y(D,{onClick:g,children:"Continue"})]}),y(K,{})]}):l?j(xt,{children:[y(S,{onClose:f},"header"),y(Oe,{children:y($e,{status:"success",children:y(ff,{})})}),y(ge,{children:"Authenticator app verification added"}),y(pe,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),y(Uo,{children:y(D,{onClick:f,children:"Done"})}),y(K,{})]}):j(xt,{children:[y(S,{backFn:b,onClose:t},"header"),y(Oe,{children:y($e,{children:y(hf,{})})}),y(ge,{children:"Enter enrollment code"}),y(Do,{children:y(mn,{onChange:C})}),j(pe,{children:["To continue, enter the 6-digit code generated from your ",y("strong",{children:"authenticator app"})]}),y(K,{})]})};import tE from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import oE from"@heroicons/react/24/outline/PhoneIcon";import rE from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import nE from"@heroicons/react/24/solid/PhoneIcon";import iE from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as aE,useState as rc}from"react";import{StaticJsonRpcProvider as Jb}from"@ethersproject/providers";import{useMemo as Qb,useEffect as Zb,useState as Qf}from"react";import Xb from"styled-components";import Ff from"styled-components";import wf from"styled-components";import{jsx as vf,jsxs as rb}from"react/jsx-runtime";var ts=({label:e,children:t,valueStyles:o})=>rb(tb,{children:[vf("div",{children:e}),vf(ob,{style:{...o},children:t})]}),tb=wf.div`
1940
+ `;import q0 from"@heroicons/react/24/solid/ShieldCheckIcon";import{jsx as j0}from"react/jsx-runtime";var uf=({size:e,authUrl:t})=>j0(Ua,{url:t,squareLogoElement:q0,size:e,fgColor:"#1F1F1F"});import{Fragment as xt,jsx as y,jsxs as K}from"react/jsx-runtime";var vf=()=>{let{user:e,enrollInMfa:t}=H(),[o,r]=Po(null),{unenrollWithSms:n,unenrollWithTotp:i}=si(),{app:a,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),{closePrivyModal:u}=I(),{promptMfa:h}=hn(),[f,g]=Po(s?.mfaEnrollmentFlow?.seenIntro||!1),[C,b]=Po(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),x=()=>{u({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{r(null),b(null)},500)};c.current=x;let E=e?.mfaMethods.includes("sms"),T=!!e?.phone,L=e?.mfaMethods.includes("totp"),R=E||L;gf(()=>{R&&g(!0)},[R]);function N(){r(null),b(null)}function O(){g(!1)}async function W(D){await h(),b(D)}if(!l||!e||!a)return K(xt,{children:[y(S,{onClose:x},"header"),y(De,{children:y(pf,{})}),y(Uo,{children:y(vt,{})}),y(Y,{})]});async function B(){r(null);try{await n()}catch{r(null)}}async function $(){r(null);try{await i()}catch{r(null)}}if(o==="sms")return K(xt,{children:[y(S,{backFn:N,onClose:x},"header"),y(De,{children:y(Ke,{children:y(Vl,{})})}),y(ge,{children:"Remove SMS verification?"}),K(ue,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),y(Fo,{children:y(U,{warn:!0,onClick:B,children:"Remove SMS for MFA"})}),y(Y,{})]});if(o==="totp")return K(xt,{children:[y(S,{backFn:N,onClose:x},"header"),y(De,{children:y(Ke,{children:y(yf,{})})}),y(ge,{children:"Remove Authenticator App verification?"}),K(ue,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),y(Fo,{children:y(U,{warn:!0,onClick:$,children:"Remove Authenticator App for MFA"})}),y(Y,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!R)return K(xt,{children:[y(S,{onClose:x},"header"),y(De,{children:y(Ke,{children:y(Gl,{})})}),y(ge,{children:"Add more security"}),K(ue,{children:[a?.name," does not have any verification methods enabled."]}),y(Fo,{children:y(U,{onClick:x,children:"Close"})}),y(Y,{})]});let ee=!R&&!f;if(ee)return K(xt,{children:[y(S,{onClose:x},"header"),y(De,{children:y(Ke,{children:y(Gl,{})})}),y(ge,{children:"Transaction Protection"}),y(ue,{children:"Set up transaction protection to add an extra layer of security to your account"}),K(Pp,{children:[K(Js,{children:[y(Ys,{children:y(Q0,{})}),"Enable 2-Step verification for your ",a?.name," wallet."]}),K(Js,{children:[y(Ys,{children:y(Z0,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),K(Fo,{children:[y(U,{onClick:()=>g(!0),children:"Continue"}),y(Ot,{onClick:x,children:"Not now"})]}),y(Y,{})]});switch(C){case"sms":return y(X0,{onComplete:x,onReset:N,onClose:x});case"totp":return y(eb,{onComplete:x,onClose:x,onReset:N});default:return K(xt,{children:[y(S,{backFn:ee?O:void 0,onClose:x},"header"),y(De,{children:y(Ke,{children:y(Gl,{})})}),y(ge,{children:"Choose a verification method"}),R?y(ue,{children:"To add or delete verification methods, verification is required."}):y(ue,{children:"How would you like to verify your identity? You can change this later."}),K(fa,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||L)&&K(ha,{children:[y(ye,{disabled:L,onClick:()=>W("totp"),children:K(ga,{children:[K(ya,{children:[y(K0,{}),"Authenticator App"]}),L?K(qr,{children:[y(mf,{}),"Added"]}):y(qr,{children:"Recommended"})]})}),L&&y(Qs,{id:"remove",onClick:()=>r("totp"),children:y(ff,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||E)&&K(ha,{children:[y(ye,{disabled:E||T,onClick:()=>W("sms"),children:K(ga,{children:[K(ya,{children:[y(J0,{}),"SMS"]}),E&&K(qr,{children:[y(mf,{}),"Added"]}),T&&y(qr,{children:"Disabled"})]})}),E&&y(Qs,{id:"remove",onClick:()=>r("sms"),children:y(ff,{})})]},"sms"),y(ha,{children:y(ye,{disabled:!0,children:K(ga,{children:[K(ya,{children:[y(Y0,{}),"Passkey"]}),y(qr,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),y(Y,{})]})}},X0=({onComplete:e,onReset:t,onClose:o})=>{let[r,n]=Po(""),[i,a]=Po(!1),[l,s]=Po("enroll"),{initEnrollmentWithSms:c,submitEnrollmentWithSms:u}=si(),{app:h,data:f,currentScreen:g,navigate:C,setModalData:b}=_();function x(){f?.mfaEnrollmentFlow?.onSuccess(),e()}async function E({qualifiedPhoneNumber:R}){try{await c({phoneNumber:R}),n(R),s("verify")}catch(N){b({mfaEnrollmentFlow:f?.mfaEnrollmentFlow?{...f?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:N,previousScreen:g||"MFA_ENROLLMENT_FLOW_SCREEN"}}),C("ERROR_SCREEN")}}async function T(R){try{if(!R)return;await u({phoneNumber:r,mfaCode:R}),a(!0)}catch(N){throw hl(N)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):tn(N)?new Error("The code you entered is not valid"):en(N)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):yl(N)?new Error("Verification canceled"):new Error("Unknown error")}}function L(){l==="verify"?s("enroll"):t()}return l==="enroll"?K(xt,{children:[y(S,{backFn:t,onClose:o},"header"),y(De,{children:y(Ke,{children:y(Vl,{})})}),y(ge,{children:"Set up SMS verification"}),y(ue,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),K(Uo,{children:[y(cn,{onSubmit:E}),K(xp,{children:["By providing your mobile number, you agree to receive text messages from ",h?.name,". Some carrier charges may apply"]})]}),y(Y,{})]}):i?K(xt,{children:[y(S,{onClose:x},"header"),y(De,{children:y(Ke,{status:"success",children:y(hf,{})})}),y(ge,{children:"SMS verification added"}),y(ue,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),y(Fo,{children:y(U,{onClick:x,children:"Done"})}),y(Y,{})]}):K(xt,{children:[y(S,{backFn:L,onClose:o},"header"),y(De,{children:y(Ke,{children:y(Vl,{})})}),y(ge,{children:"Enter enrollment code"}),K(Uo,{children:[y(fn,{onChange:T}),K(ue,{children:["To continue, enter the 6-digit code sent to ",y("strong",{children:Lm(r)})]})]}),y(Y,{})]})},eb=({onComplete:e,onClose:t,onReset:o})=>{let[r,n]=Po("enroll"),[i,a]=Po(null),[l,s]=Po(!1),{initEnrollmentWithTotp:c,submitEnrollmentWithTotp:u}=si(),{data:h}=_();gf(()=>{a(null),c().then(x=>{a(x)}).catch(()=>{a(null),o()})},[]);function f(){h?.mfaEnrollmentFlow?.onSuccess(),e()}function g(){n("verify")}async function C(x){try{if(!x)return;await u({mfaCode:x}),s(!0)}catch(E){throw hl(E)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):tn(E)?new Error("The code you entered is not valid"):en(E)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):yl(E)?new Error("Verification canceled"):new Error("Unknown error")}}function b(){r==="verify"?n("enroll"):o()}return r==="enroll"?K(xt,{children:[y(S,{backFn:o,onClose:t},"header"),y(ge,{children:"Scan QR code"}),y(ue,{children:"Open your authenticator app and scan the QR code to continue."}),y(ba,{children:i?.authUrl?y(uf,{authUrl:i.authUrl,size:200}):y(vt,{})}),K(Fo,{children:[y(bt,{children:i?.secret&&y(ln,{itemName:"secret",text:i.secret})}),y(U,{onClick:g,children:"Continue"})]}),y(Y,{})]}):l?K(xt,{children:[y(S,{onClose:f},"header"),y(De,{children:y(Ke,{status:"success",children:y(hf,{})})}),y(ge,{children:"Authenticator app verification added"}),y(ue,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),y(Fo,{children:y(U,{onClick:f,children:"Done"})}),y(Y,{})]}):K(xt,{children:[y(S,{backFn:b,onClose:t},"header"),y(De,{children:y(Ke,{children:y(yf,{})})}),y(ge,{children:"Enter enrollment code"}),y(Uo,{children:y(fn,{onChange:C})}),K(ue,{children:["To continue, enter the 6-digit code generated from your ",y("strong",{children:"authenticator app"})]}),y(Y,{})]})};import tE from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import oE from"@heroicons/react/24/outline/PhoneIcon";import rE from"@heroicons/react/24/solid/DevicePhoneMobileIcon";import nE from"@heroicons/react/24/solid/PhoneIcon";import iE from"@heroicons/react/24/solid/ShieldCheckIcon";import{useEffect as aE,useState as nc}from"react";import{StaticJsonRpcProvider as Jb}from"@ethersproject/providers";import{useMemo as Qb,useEffect as Zb,useState as Zf}from"react";import Xb from"styled-components";import Bf from"styled-components";import Cf from"styled-components";import{jsx as wf,jsxs as rb}from"react/jsx-runtime";var os=({label:e,children:t,valueStyles:o})=>rb(tb,{children:[wf("div",{children:e}),wf(ob,{style:{...o},children:t})]}),tb=Cf.div`
1941
1941
  display: flex;
1942
1942
  align-items: center;
1943
1943
  justify-content: space-between;
@@ -1952,7 +1952,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
1952
1952
  color: var(--privy-color-foreground-2);
1953
1953
  text-align: right;
1954
1954
  }
1955
- `,ob=wf.div`
1955
+ `,ob=Cf.div`
1956
1956
  font-size: 14px;
1957
1957
  line-height: 100%;
1958
1958
  display: flex;
@@ -1961,28 +1961,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
1961
1961
  border-radius: var(--privy-border-radius-full);
1962
1962
  background-color: var(--privy-color-background-2);
1963
1963
  padding: 4px 8px;
1964
- `;import rs from"styled-components";import{BigNumber as Cf}from"@ethersproject/bignumber";import{formatEther as bf}from"@ethersproject/units";var si=(e,t)=>{let o=(t*parseFloat(bf(e))).toFixed(2);return o!=="0.00"?`$${o}`:"<$0.01"},io=(e,t,o=6,r=!1)=>{let i=parseFloat(bf(e)).toFixed(o).replace(/0+$/,"").replace(/\.$/,"");return r?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Vl=e=>e.map(Ce).reduce((t,o)=>t.add(o),Cf.from(0)).toHexString(),Ef=(e,t)=>{let{chains:o}=R(),r=`https://etherscan.io/address/${t}`,n=`${fd(e,o)}/address/${t}`;if(!n)return r;try{new URL(n)}catch{return r}return n},Ce=e=>Cf.from(e);import{Fragment as sb,jsx as os,jsxs as Tf}from"react/jsx-runtime";var Pf=({weiQuantities:e,tokenPrice:t,tokenSymbol:o})=>{let r=Vl(e),n=t?si(r,t):void 0,i=io(r,o);return os(xf,{children:n||i})},zl=({weiQuantities:e,tokenPrice:t,tokenSymbol:o})=>{let r=Vl(e),n=t?si(r,t):void 0,i=io(r,o);return os(xf,{children:n?Tf(sb,{children:[os(nb,{children:"USD"}),n==="<$0.01"?Tf(ab,{children:[os(ib,{children:"<"}),"$0.01"]}):n]}):i})},xf=rs.span`
1964
+ `;import ns from"styled-components";import{BigNumber as bf}from"@ethersproject/bignumber";import{formatEther as Ef}from"@ethersproject/units";var li=(e,t)=>{let o=(t*parseFloat(Ef(e))).toFixed(2);return o!=="0.00"?`$${o}`:"<$0.01"},ao=(e,t,o=6,r=!1)=>{let i=parseFloat(Ef(e)).toFixed(o).replace(/0+$/,"").replace(/\.$/,"");return r?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},zl=e=>e.map(Ce).reduce((t,o)=>t.add(o),bf.from(0)).toHexString(),Tf=(e,t)=>{let{chains:o}=I(),r=`https://etherscan.io/address/${t}`,n=`${hd(e,o)}/address/${t}`;if(!n)return r;try{new URL(n)}catch{return r}return n},Ce=e=>bf.from(e);import{Fragment as sb,jsx as rs,jsxs as Pf}from"react/jsx-runtime";var xf=({weiQuantities:e,tokenPrice:t,tokenSymbol:o})=>{let r=zl(e),n=t?li(r,t):void 0,i=ao(r,o);return rs(Sf,{children:n||i})},$l=({weiQuantities:e,tokenPrice:t,tokenSymbol:o})=>{let r=zl(e),n=t?li(r,t):void 0,i=ao(r,o);return rs(Sf,{children:n?Pf(sb,{children:[rs(nb,{children:"USD"}),n==="<$0.01"?Pf(ab,{children:[rs(ib,{children:"<"}),"$0.01"]}):n]}):i})},Sf=ns.span`
1965
1965
  font-size: 14px;
1966
1966
  line-height: 140%;
1967
1967
  display: flex;
1968
1968
  gap: 4px;
1969
1969
  align-items: center;
1970
- `,nb=rs.span`
1970
+ `,nb=ns.span`
1971
1971
  font-size: 12px;
1972
1972
  line-height: 12px;
1973
1973
  color: var(--privy-color-foreground-3);
1974
- `,ib=rs.span`
1974
+ `,ib=ns.span`
1975
1975
  font-size: 10px;
1976
- `,ab=rs.span`
1976
+ `,ab=ns.span`
1977
1977
  display: flex;
1978
1978
  align-items: center;
1979
- `;import $l from"styled-components";import{jsx as Jo,jsxs as ns}from"react/jsx-runtime";var Sf=({gas:e,tokenPrice:t,tokenSymbol:o})=>ns(el,{style:{paddingBottom:"12px"},children:[ns(Af,{children:[Jo(Rf,{children:"Est. Fees"}),Jo("div",{children:Jo(zl,{weiQuantities:[e],tokenPrice:t,tokenSymbol:o})})]}),t&&Jo(kf,{children:`${io(e,o)}`})]}),_f=({transactionData:e,gas:t,tokenPrice:o,tokenSymbol:r})=>{let n=Ce(e.value||0).add(Ce(t)).toHexString();return ns(el,{children:[ns(Af,{children:[Jo(Rf,{children:"Total (including fees)"}),Jo("div",{children:Jo(zl,{weiQuantities:[e.value||0,t],tokenPrice:o,tokenSymbol:r})})]}),o&&Jo(kf,{children:io(n,r)})]})},Af=$l.div`
1979
+ `;import ql from"styled-components";import{jsx as Qo,jsxs as is}from"react/jsx-runtime";var _f=({gas:e,tokenPrice:t,tokenSymbol:o})=>is(tl,{style:{paddingBottom:"12px"},children:[is(kf,{children:[Qo(If,{children:"Est. Fees"}),Qo("div",{children:Qo($l,{weiQuantities:[e],tokenPrice:t,tokenSymbol:o})})]}),t&&Qo(Rf,{children:`${ao(e,o)}`})]}),Af=({transactionData:e,gas:t,tokenPrice:o,tokenSymbol:r})=>{let n=Ce(e.value||0).add(Ce(t)).toHexString();return is(tl,{children:[is(kf,{children:[Qo(If,{children:"Total (including fees)"}),Qo("div",{children:Qo($l,{weiQuantities:[e.value||0,t],tokenPrice:o,tokenSymbol:r})})]}),o&&Qo(Rf,{children:ao(n,r)})]})},kf=ql.div`
1980
1980
  display: flex;
1981
1981
  flex-direction: row;
1982
1982
  justify-content: space-between;
1983
1983
  align-items: center;
1984
1984
  padding-top: 4px;
1985
- `,kf=$l.div`
1985
+ `,Rf=ql.div`
1986
1986
  display: flex;
1987
1987
  flex-direction: row;
1988
1988
  height: 12px;
@@ -1991,23 +1991,23 @@ You will need this password to access your ${e} wallet on a new device. Please k
1991
1991
  line-height: 12px;
1992
1992
  color: var(--privy-color-foreground-3);
1993
1993
  font-weight: 400;
1994
- `,Rf=$l.div`
1994
+ `,If=ql.div`
1995
1995
  font-size: 14px;
1996
1996
  line-height: 22.4px;
1997
1997
  font-weight: 400;
1998
- `;import lb from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Er,useState as cb}from"react";import Qo from"styled-components";import{createContext as If,useContext as jN}from"react";var hn=If(void 0);var li=If(void 0);import{Fragment as gb,jsx as Bt,jsxs as Wf}from"react/jsx-runtime";var Mf=({defaultValue:e,children:t})=>{let[o,r]=cb(e||null),n=i=>{r(o===i?null:i)};return Bt(hn.Provider,{value:{activePanel:o,togglePanel:n},children:Bt(db,{children:t})})},Nf=({value:e,children:t})=>{let{activePanel:o,togglePanel:r}=Er(hn),n=o===e;return Bt(li.Provider,{value:{onToggle:()=>r(e),value:e},children:Bt(fb,{isActive:n,"data-open":n,children:t})})},Lf=({children:e})=>{let{activePanel:t}=Er(hn),{onToggle:o,value:r}=Er(li),n=t===r;return Wf(gb,{children:[Wf(pb,{onClick:o,"data-open":n,children:[Bt(mb,{children:e}),Bt(yb,{isactive:n,children:Bt(lb,{height:"16px",width:"16px",strokeWidth:"2"})})]}),Bt(ub,{})]})},Of=({children:e})=>{let{activePanel:t}=Er(hn),{value:o}=Er(li);return Bt(hb,{"data-open":t===o,children:Bt(Uf,{children:e})})},Df=({children:e})=>{let{activePanel:t}=Er(hn),{value:o}=Er(li);return Bt(Uf,{children:typeof e=="function"?e({isActive:t===o}):e})},db=Qo.div`
1998
+ `;import lb from"@heroicons/react/24/outline/ChevronDownIcon";import{useContext as Tr,useState as cb}from"react";import Zo from"styled-components";import{createContext as Wf,useContext as XN}from"react";var yn=Wf(void 0);var ci=Wf(void 0);import{Fragment as gb,jsx as Ht,jsxs as Mf}from"react/jsx-runtime";var Nf=({defaultValue:e,children:t})=>{let[o,r]=cb(e||null),n=i=>{r(o===i?null:i)};return Ht(yn.Provider,{value:{activePanel:o,togglePanel:n},children:Ht(db,{children:t})})},Lf=({value:e,children:t})=>{let{activePanel:o,togglePanel:r}=Tr(yn),n=o===e;return Ht(ci.Provider,{value:{onToggle:()=>r(e),value:e},children:Ht(fb,{isActive:n,"data-open":n,children:t})})},Of=({children:e})=>{let{activePanel:t}=Tr(yn),{onToggle:o,value:r}=Tr(ci),n=t===r;return Mf(gb,{children:[Mf(pb,{onClick:o,"data-open":n,children:[Ht(mb,{children:e}),Ht(yb,{isactive:n,children:Ht(lb,{height:"16px",width:"16px",strokeWidth:"2"})})]}),Ht(ub,{})]})},Df=({children:e})=>{let{activePanel:t}=Tr(yn),{value:o}=Tr(ci);return Ht(hb,{"data-open":t===o,children:Ht(Ff,{children:e})})},Uf=({children:e})=>{let{activePanel:t}=Tr(yn),{value:o}=Tr(ci);return Ht(Ff,{children:typeof e=="function"?e({isActive:t===o}):e})},db=Zo.div`
1999
1999
  display: flex;
2000
2000
  flex-direction: column;
2001
2001
  width: 100%;
2002
2002
  gap: 8px;
2003
- `,pb=Qo.div`
2003
+ `,pb=Zo.div`
2004
2004
  display: flex;
2005
2005
  justify-content: space-between;
2006
2006
  align-items: center;
2007
2007
  width: 100%;
2008
2008
  cursor: pointer;
2009
2009
  padding-bottom: 8px;
2010
- `,ub=Qo.div`
2010
+ `,ub=Zo.div`
2011
2011
  width: 100%;
2012
2012
 
2013
2013
  && {
@@ -2015,13 +2015,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
2015
2015
  border-color: var(--privy-color-foreground-4);
2016
2016
  }
2017
2017
  padding-bottom: 12px;
2018
- `,mb=Qo.div`
2018
+ `,mb=Zo.div`
2019
2019
  font-size: 14px;
2020
2020
  font-weight: 500;
2021
2021
  line-height: 19.6px;
2022
2022
  width: 100%;
2023
2023
  padding-right: 8px;
2024
- `,fb=Qo.div`
2024
+ `,fb=Zo.div`
2025
2025
  display: flex;
2026
2026
  flex-direction: column;
2027
2027
  width: 100%;
@@ -2033,7 +2033,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2033
2033
  border-color: var(--privy-color-foreground-4);
2034
2034
  border-radius: var(--privy-border-radius-md);
2035
2035
  }
2036
- `,hb=Qo.div`
2036
+ `,hb=Zo.div`
2037
2037
  position: relative;
2038
2038
  overflow: hidden;
2039
2039
  transition: max-height 25ms ease-out;
@@ -2045,38 +2045,38 @@ You will need this password to access your ${e} wallet on a new device. Please k
2045
2045
  &[data-open='false'] {
2046
2046
  max-height: 0;
2047
2047
  }
2048
- `,Uf=Qo.div`
2048
+ `,Ff=Zo.div`
2049
2049
  display: flex;
2050
2050
  flex-direction: column;
2051
2051
  gap: 12px;
2052
2052
  flex: 1 1 auto;
2053
2053
  min-height: 1px;
2054
- `,yb=Qo.div`
2054
+ `,yb=Zo.div`
2055
2055
  transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
2056
- `;import vb from"styled-components";import{jsx as Cb}from"react/jsx-runtime";var ql=({walletAddress:e,chainId:t=fo})=>Cb(wb,{href:Ef(t,e),target:"_blank",children:Io(e)}),wb=vb.a`
2056
+ `;import vb from"styled-components";import{jsx as Cb}from"react/jsx-runtime";var jl=({walletAddress:e,chainId:t=yo})=>Cb(wb,{href:Tf(t,e),target:"_blank",children:Wo(e)}),wb=vb.a`
2057
2057
  &:hover {
2058
2058
  text-decoration: underline;
2059
2059
  }
2060
- `;import{jsx as mt,jsxs as jl}from"react/jsx-runtime";var yn=({from:e,to:t,txn:o,transactionInfo:r,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=o?.value||0;return mt(Mf,{children:jl(Nf,{value:"details",children:[mt(Lf,{children:jl(bb,{children:[mt("div",{children:r?.title||r?.actionDescription||"Details"}),mt(Eb,{children:mt(Pf,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),jl(Of,{children:[mt(ts,{label:"From",children:mt(ql,{walletAddress:e,chainId:o.chainId||fo})}),mt(ts,{label:"To",children:mt(ql,{walletAddress:t,chainId:o.chainId||fo})}),r&&r.action&&mt(ts,{label:"Action",children:r.action}),i&&mt(Sf,{transactionData:o,gas:i,tokenPrice:n,tokenSymbol:a})]}),mt(Df,{children:({isActive:s})=>mt(_f,{transactionData:o,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},bb=Ff.div`
2060
+ `;import{jsx as ft,jsxs as Kl}from"react/jsx-runtime";var gn=({from:e,to:t,txn:o,transactionInfo:r,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=o?.value||0;return ft(Nf,{children:Kl(Lf,{value:"details",children:[ft(Of,{children:Kl(bb,{children:[ft("div",{children:r?.title||r?.actionDescription||"Details"}),ft(Eb,{children:ft(xf,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),Kl(Df,{children:[ft(os,{label:"From",children:ft(jl,{walletAddress:e,chainId:o.chainId||yo})}),ft(os,{label:"To",children:ft(jl,{walletAddress:t,chainId:o.chainId||yo})}),r&&r.action&&ft(os,{label:"Action",children:r.action}),i&&ft(_f,{transactionData:o,gas:i,tokenPrice:n,tokenSymbol:a})]}),ft(Uf,{children:({isActive:s})=>ft(Af,{transactionData:o,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},bb=Bf.div`
2061
2061
  display: flex;
2062
2062
  flex-direction: row;
2063
2063
  justify-content: space-between;
2064
- `,Eb=Ff.div`
2064
+ `,Eb=Bf.div`
2065
2065
  flex-shrink: 0;
2066
2066
  padding-left: 8px;
2067
- `;import di from"styled-components";import{jsx as ci,jsxs as Ab}from"react/jsx-runtime";var Kl=({description:e,contractInfo:t})=>Ab(Tb,{children:[t.imgUrl&&ci(Pb,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&ci(xb,{children:ci("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&ci(Sb,{children:t.name}),ci(_b,{children:e||t.actionText})]}),Tb=di.div`
2067
+ `;import pi from"styled-components";import{jsx as di,jsxs as Ab}from"react/jsx-runtime";var Yl=({description:e,contractInfo:t})=>Ab(Tb,{children:[t.imgUrl&&di(Pb,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&di(xb,{children:di("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&di(Sb,{children:t.name}),di(_b,{children:e||t.actionText})]}),Tb=pi.div`
2068
2068
  display: flex;
2069
2069
  flex-direction: column;
2070
2070
  align-items: center;
2071
2071
  margin-bottom: 8px;
2072
- `,Pb=di.img`
2072
+ `,Pb=pi.img`
2073
2073
  && {
2074
2074
  height: ${e=>e.size==="sm"?"65px":"140px"};
2075
2075
  width: ${e=>e.size==="sm"?"65px":"140px"};
2076
2076
  border-radius: 16px;
2077
2077
  margin-bottom: 12px;
2078
2078
  }
2079
- `,xb=di.div`
2079
+ `,xb=pi.div`
2080
2080
  font-size: 12px;
2081
2081
  line-height: 12px;
2082
2082
  padding: 7px;
@@ -2089,7 +2089,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2089
2089
  text-decoration: underline;
2090
2090
  }
2091
2091
  }
2092
- `,Sb=di.div`
2092
+ `,Sb=pi.div`
2093
2093
  font-size: 18px;
2094
2094
  line-height: 18px;
2095
2095
  font-weight: 500;
@@ -2097,7 +2097,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2097
2097
  white-space: nowrap;
2098
2098
  max-width: 275px;
2099
2099
  text-overflow: ellipsis;
2100
- `,_b=di.div`
2100
+ `,_b=pi.div`
2101
2101
  font-size: 16px;
2102
2102
  line-height: 140%;
2103
2103
  font-weight: 400;
@@ -2105,7 +2105,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2105
2105
  overflow: hidden;
2106
2106
  max-width: 275px;
2107
2107
  text-overflow: ellipsis;
2108
- `;import kb from"@heroicons/react/24/outline/WalletIcon";import Jl from"styled-components";import{jsx as Bf,jsxs as Yl}from"react/jsx-runtime";var Hf=({address:e,txn:t,balance:o,hasFunds:r})=>{let n=!!o,{nativeTokenSymbolForChainId:i}=R(),a=i(t.chainId)||"ETH";return Yl(Rb,{children:[Yl(Ib,{children:[Bf(kb,{strokeWidth:"2",width:"16px",height:"16px"}),Bf("div",{children:Io(e)})]}),Yl(Wb,{displayBalanceColor:n,hasFunds:r,children:[o?io(o,a,6,!0):0," available"]})]})},Rb=Jl.div`
2108
+ `;import kb from"@heroicons/react/24/outline/WalletIcon";import Ql from"styled-components";import{jsx as Hf,jsxs as Jl}from"react/jsx-runtime";var Gf=({address:e,txn:t,balance:o,hasFunds:r})=>{let n=!!o,{nativeTokenSymbolForChainId:i}=I(),a=i(t.chainId)||"ETH";return Jl(Rb,{children:[Jl(Ib,{children:[Hf(kb,{strokeWidth:"2",width:"16px",height:"16px"}),Hf("div",{children:Wo(e)})]}),Jl(Wb,{displayBalanceColor:n,hasFunds:r,children:[o?ao(o,a,6,!0):0," available"]})]})},Rb=Ql.div`
2109
2109
  display: flex;
2110
2110
  flex-direction: row;
2111
2111
  justify-content: space-between;
@@ -2118,12 +2118,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
2118
2118
  border: 1px solid var(--privy-color-foreground-4);
2119
2119
  border-radius: var(--privy-border-radius-md);
2120
2120
  }
2121
- `,Ib=Jl.div`
2121
+ `,Ib=Ql.div`
2122
2122
  display: flex;
2123
2123
  flex-direction: row;
2124
2124
  align-items: center;
2125
2125
  gap: 8px;
2126
- `,Wb=Jl.div`
2126
+ `,Wb=Ql.div`
2127
2127
  display: flex;
2128
2128
  align-items: center;
2129
2129
  justify-content: center;
@@ -2133,35 +2133,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
2133
2133
  background-color: var(--privy-color-background-2);
2134
2134
  padding: 5px 8px;
2135
2135
  color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
2136
- `;import is from"styled-components";import{Fragment as Vf,jsx as pi,jsxs as zf}from"react/jsx-runtime";var $f=({description:e,txn:t,tokenSymbol:o,tokenPrice:r})=>{let n=t.value||0,i=r?si(n,r):void 0,a=io(n,o);return zf(Mb,{children:[i?zf(Vf,{children:[pi(Gf,{children:i}),pi(Nb,{children:a})]}):pi(Vf,{children:pi(Gf,{children:a})}),pi(Lb,{children:e})]})},Mb=is.div`
2136
+ `;import as from"styled-components";import{Fragment as zf,jsx as ui,jsxs as $f}from"react/jsx-runtime";var qf=({description:e,txn:t,tokenSymbol:o,tokenPrice:r})=>{let n=t.value||0,i=r?li(n,r):void 0,a=ao(n,o);return $f(Mb,{children:[i?$f(zf,{children:[ui(Vf,{children:i}),ui(Nb,{children:a})]}):ui(zf,{children:ui(Vf,{children:a})}),ui(Lb,{children:e})]})},Mb=as.div`
2137
2137
  display: flex;
2138
2138
  flex-direction: column;
2139
2139
  align-items: center;
2140
2140
  margin-bottom: 20px;
2141
- `,Gf=is.h2`
2141
+ `,Vf=as.h2`
2142
2142
  && {
2143
2143
  font-size: 48px;
2144
2144
  line-height: 48px;
2145
2145
  margin: 8px auto;
2146
2146
  }
2147
- `,Nb=is.p`
2147
+ `,Nb=as.p`
2148
2148
  margin-bottom: 12px;
2149
2149
  && {
2150
2150
  font-size: 17px;
2151
2151
  line-height: 17px;
2152
2152
  color: var(--privy-color-foreground-3);
2153
2153
  }
2154
- `,Lb=is.div`
2154
+ `,Lb=as.div`
2155
2155
  font-size: 16px;
2156
2156
  line-height: 22.4px;
2157
2157
  font-weight: 400;
2158
2158
  overflow: hidden;
2159
2159
  max-width: 275px;
2160
2160
  text-overflow: ellipsis;
2161
- `;import{VoidSigner as Ub}from"@ethersproject/abstract-signer";import{BigNumber as Ht}from"@ethersproject/bignumber";import{Contract as Fb}from"@ethersproject/contracts";import{EtherscanProvider as jL}from"@ethersproject/providers";import{serialize as Bb}from"@ethersproject/transactions";import{parseUnits as qf}from"@ethersproject/units";import{ofetch as Ob}from"ofetch";var jf=[An.id,kn.id],Ql=e=>({maxPriorityFee:qf(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:qf(e.maxFee.toFixed(9),"gwei").toHexString()}),Db=e=>({safeLow:Ql(e.safeLow),standard:Ql(e.standard),fast:Ql(e.fast)}),Kf=async e=>{let t="";switch(e){case An.id:t="https://gasstation.polygon.technology/v2";break;case kn.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return Db(await Ob(t))};function To(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 Hb(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=To(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=To(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=To(e.gasPrice)),e.value!==void 0&&(t.value=To(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=To(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=To(e.maxPriorityFeePerGas)),t}function Gb(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=Ce(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Ce(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Ce(e.gasPrice)),e.value!==void 0&&(t.value=Ce(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Ce(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Ce(e.maxPriorityFeePerGas)),t}async function gn(e,t,o){t.chainId=Number(t.chainId),Jf(t);let r=new Ub(e,o);if(t.gas&&(t.gasLimit=t.gas,delete t.gas),jf.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await Kf(t.chainId);t.maxPriorityFeePerGas||(t.maxPriorityFeePerGas=i.maxPriorityFee),t.maxFeePerGas||(t.maxFeePerGas=i.maxFee)}catch(i){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${i}.`)}if(Vb(t.chainId)&&!t.maxFeePerGas)try{let{lastBaseFeePerGas:i}=await r.getFeeData();if(i){let a=i.mul(Ht.from(120)).div(Ht.from(100));t.maxFeePerGas=To(a),t.maxPriorityFeePerGas=To(Ht.from(0))}}catch(i){throw new Error(`Failed to set gas price for Arbitrum transaction: ${i}.`)}if(Zl(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas)&&!t.gasPrice)try{if(t.type=2,!t.maxPriorityFeePerGas){let i=await o.send("eth_maxPriorityFeePerGas",[]);t.maxPriorityFeePerGas=i}if(t.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),t.maxPriorityFeePerGas>=t.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!t.maxFeePerGas){let{lastBaseFeePerGas:i}=await r.getFeeData();if(!i)throw new Error("Unable to fetch baseFee for last block.");let s=Ht.from(i).mul(Ht.from(126)).div(Ht.from(100)).add(Ht.from(t.maxPriorityFeePerGas));t.maxFeePerGas=To(s)}}catch(i){throw new Error(`Failed to set gas price for OP stack transaction: ${i}.`)}zb(t.chainId)&&t.type!=0&&((t.type==1||t.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),t.type===void 0&&(t.type=0));let n=await r.populateTransaction({to:t.to,from:t.from,nonce:t.nonce,gasLimit:t.gasLimit,gasPrice:t.gasPrice,data:t.data,value:t.value,chainId:t.chainId,type:t.type,accessList:t.accessList,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas});return Hb(n)}async function as(e,t,o,r,n){r=Object.assign({chainId:fo},r),Jf(r);let a=(await o.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[r]}})).response.data;return await n.sendTransaction(a)}async function Yf(e,t,o,r){let n=await r.getBalance(e),i=t.value||0,l=!n.sub(Ce(i)).sub(o).isNegative();return{balance:n,hasSufficientFunds:l}}function Zl(e){return[$i.id,qi.id,ji.id,Yi.id,Ji.id,Qi.id,Zi.id,ea.id,Xi.id].includes(e)}function Vb(e){return[Gi.id,Vi.id,zi.id].includes(e)}function zb(e){return[56,97].includes(e)}async function Xl(e,t){if(!e.chainId||e.chainId&&!Zl(e.chainId))return Ht.from(0);let o=Ht.from(0);try{let r=new Fb(td,od,t),n=Gb(e),i=Bb(n);o=await r.getL1Fee(i)}catch{}return o}async function ss(e,t){delete e.from;let o=Ht.from(0),r=Ht.from(0);if(e.gasLimit?o=Ce(e.gasLimit):o=await t.estimateGas(e),e.type==2)if(e.maxFeePerGas)r=Ce(e.maxFeePerGas);else{let i=await t.getFeeData();i.maxFeePerGas&&(r=i.maxFeePerGas)}else if(e.type==0||e.type==1)if(e.gasPrice)r=Ce(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}else if(e.gasPrice)r=Ce(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}let n=o.mul(r);if(e.chainId&&Zl(e.chainId))try{let i=await Xl(e,t);n=n.add(i)}catch{}return n}function Jf(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!$b(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 $b(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&qb(e);return t||o||r}function qb(e){return/^-?0x[a-f0-9]+$/i.test(e)}function ls(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}import{useState as ec,useEffect as jb}from"react";var cs=e=>{let{showFiatPrices:t,getUsdTokenPrice:o,chains:r}=R(),[n,i]=ec(!0),[a,l]=ec(void 0),[s,c]=ec(void 0);return jb(()=>{let u=e.chainId||fo,h=r.find(g=>g.id===Number(u));if(!h)throw new q(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let g=await o(h);g?c(g):l(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(g){l(g)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as Kb,useContext as Yb}from"react";var tc=Kb(null);function ui(){let e=Yb(tc);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as Zf}from"react/jsx-runtime";var oc=({pendingTransaction:e})=>{let{getAccessToken:t}=B(),{wallets:o}=ui(),{walletProxy:r,rpcConfig:n,chains:i,nativeTokenSymbolForChainId:a}=R(),[l,s]=Qf(e),{tokenPrice:c}=cs(l),[u,h]=Qf(null),f=a(e.chainId)||"ETH",g=Qb(()=>o.find(C=>C.walletClientType==="privy"),[o]);return Zb(()=>{async function C(){if(!await t()||!r||!g)return l;let x=new Jb(Mt(l.chainId,i,n)),E=await ss(l,x);return h(Ce(E.toBigInt()).toHexString()),gn(g.address,l,x)}C().then(b=>{s(b)})},[r]),g?Zf(eE,{children:Zf(yn,{from:g.address,to:l.to,txn:l,gas:u??void 0,tokenPrice:c,tokenSymbol:f})}):null},eE=Xb.div`
2161
+ `;import{VoidSigner as Ub}from"@ethersproject/abstract-signer";import{BigNumber as Gt}from"@ethersproject/bignumber";import{Contract as Fb}from"@ethersproject/contracts";import{EtherscanProvider as XL}from"@ethersproject/providers";import{serialize as Bb}from"@ethersproject/transactions";import{parseUnits as jf}from"@ethersproject/units";import{ofetch as Ob}from"ofetch";var Kf=[kn.id,Rn.id],Zl=e=>({maxPriorityFee:jf(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:jf(e.maxFee.toFixed(9),"gwei").toHexString()}),Db=e=>({safeLow:Zl(e.safeLow),standard:Zl(e.standard),fast:Zl(e.fast)}),Yf=async e=>{let t="";switch(e){case kn.id:t="https://gasstation.polygon.technology/v2";break;case Rn.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return Db(await Ob(t))};function xo(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 Hb(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=xo(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=xo(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=xo(e.gasPrice)),e.value!==void 0&&(t.value=xo(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=xo(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=xo(e.maxPriorityFeePerGas)),t}function Gb(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=Ce(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Ce(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Ce(e.gasPrice)),e.value!==void 0&&(t.value=Ce(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Ce(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Ce(e.maxPriorityFeePerGas)),t}async function vn(e,t,o){t.chainId=Number(t.chainId),Qf(t);let r=new Ub(e,o);if(t.gas&&(t.gasLimit=t.gas,delete t.gas),Kf.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await Yf(t.chainId);t.maxPriorityFeePerGas||(t.maxPriorityFeePerGas=i.maxPriorityFee),t.maxFeePerGas||(t.maxFeePerGas=i.maxFee)}catch(i){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${i}.`)}if(Vb(t.chainId)&&!t.maxFeePerGas)try{let{lastBaseFeePerGas:i}=await r.getFeeData();if(i){let a=i.mul(Gt.from(120)).div(Gt.from(100));t.maxFeePerGas=xo(a),t.maxPriorityFeePerGas=xo(Gt.from(0))}}catch(i){throw new Error(`Failed to set gas price for Arbitrum transaction: ${i}.`)}if(Xl(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas)&&!t.gasPrice)try{if(t.type=2,!t.maxPriorityFeePerGas){let i=await o.send("eth_maxPriorityFeePerGas",[]);t.maxPriorityFeePerGas=i}if(t.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),t.maxPriorityFeePerGas>=t.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!t.maxFeePerGas){let{lastBaseFeePerGas:i}=await r.getFeeData();if(!i)throw new Error("Unable to fetch baseFee for last block.");let s=Gt.from(i).mul(Gt.from(126)).div(Gt.from(100)).add(Gt.from(t.maxPriorityFeePerGas));t.maxFeePerGas=xo(s)}}catch(i){throw new Error(`Failed to set gas price for OP stack transaction: ${i}.`)}zb(t.chainId)&&t.type!=0&&((t.type==1||t.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),t.type===void 0&&(t.type=0));let n=await r.populateTransaction({to:t.to,from:t.from,nonce:t.nonce,gasLimit:t.gasLimit,gasPrice:t.gasPrice,data:t.data,value:t.value,chainId:t.chainId,type:t.type,accessList:t.accessList,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas});return Hb(n)}async function ss(e,t,o,r,n){r=Object.assign({chainId:yo},r),Qf(r);let a=(await o.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[r]}})).response.data;return await n.sendTransaction(a)}async function Jf(e,t,o,r){let n=await r.getBalance(e),i=t.value||0,l=!n.sub(Ce(i)).sub(o).isNegative();return{balance:n,hasSufficientFunds:l}}function Xl(e){return[qi.id,ji.id,Ki.id,Ji.id,Qi.id,Zi.id,Xi.id,ta.id,ea.id].includes(e)}function Vb(e){return[Vi.id,zi.id,$i.id].includes(e)}function zb(e){return[56,97].includes(e)}async function ec(e,t){if(!e.chainId||e.chainId&&!Xl(e.chainId))return Gt.from(0);let o=Gt.from(0);try{let r=new Fb(od,rd,t),n=Gb(e),i=Bb(n);o=await r.getL1Fee(i)}catch{}return o}async function ls(e,t){delete e.from;let o=Gt.from(0),r=Gt.from(0);if(e.gasLimit?o=Ce(e.gasLimit):o=await t.estimateGas(e),e.type==2)if(e.maxFeePerGas)r=Ce(e.maxFeePerGas);else{let i=await t.getFeeData();i.maxFeePerGas&&(r=i.maxFeePerGas)}else if(e.type==0||e.type==1)if(e.gasPrice)r=Ce(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}else if(e.gasPrice)r=Ce(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}let n=o.mul(r);if(e.chainId&&Xl(e.chainId))try{let i=await ec(e,t);n=n.add(i)}catch{}return n}function Qf(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!$b(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 $b(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&qb(e);return t||o||r}function qb(e){return/^-?0x[a-f0-9]+$/i.test(e)}function cs(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}import{useState as tc,useEffect as jb}from"react";var ds=e=>{let{showFiatPrices:t,getUsdTokenPrice:o,chains:r}=I(),[n,i]=tc(!0),[a,l]=tc(void 0),[s,c]=tc(void 0);return jb(()=>{let u=e.chainId||yo,h=r.find(g=>g.id===Number(u));if(!h)throw new j(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let g=await o(h);g?c(g):l(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(g){l(g)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};import{createContext as Kb,useContext as Yb}from"react";var oc=Kb(null);function mi(){let e=Yb(oc);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as Xf}from"react/jsx-runtime";var rc=({pendingTransaction:e})=>{let{getAccessToken:t}=H(),{wallets:o}=mi(),{walletProxy:r,rpcConfig:n,chains:i,nativeTokenSymbolForChainId:a}=I(),[l,s]=Zf(e),{tokenPrice:c}=ds(l),[u,h]=Zf(null),f=a(e.chainId)||"ETH",g=Qb(()=>o.find(C=>C.walletClientType==="privy"),[o]);return Zb(()=>{async function C(){if(!await t()||!r||!g)return l;let x=new Jb(Nt(l.chainId,i,n)),E=await ls(l,x);return h(Ce(E.toBigInt()).toHexString()),vn(g.address,l,x)}C().then(b=>{s(b)})},[r]),g?Xf(eE,{children:Xf(gn,{from:g.address,to:l.to,txn:l,gas:u??void 0,tokenPrice:c,tokenSymbol:f})}):null},eE=Xb.div`
2162
2162
  width: 100%;
2163
2163
  padding: 1rem 0;
2164
- `;import{Fragment as nc,jsx as ee,jsxs as ao}from"react/jsx-runtime";var ic=({open:e,onClose:t})=>{let{user:o}=B(),[r,n]=rc(null),{init:i,cancel:a}=fn();aE(()=>{e&&o?.mfaMethods&&o.mfaMethods.length>0?l(o.mfaMethods[0]):n(null)},[o?.mfaMethods,e]);async function l(c){try{n(c),await i(c)}catch(u){console.error(u)}}let s=()=>{n(null),a(),t()};return!e||!o?null:r?ee(sE,{selectedMethod:r,onClose:s,onBack:o.mfaMethods.length>1?()=>n(null):void 0}):ao(nc,{children:[ee(S,{onClose:s},"header"),ee(Oe,{children:ee($e,{children:ee(iE,{})})}),ee(ge,{children:"Verify your identity"}),ee(pe,{children:"Choose a verification method"}),ao(ma,{children:[o.mfaMethods.includes("totp")&&ao(ye,{onClick:()=>l("totp"),children:[ee(tE,{}),"Authenticator App"]},"totp"),o.mfaMethods.includes("sms")&&ao(ye,{onClick:()=>l("sms"),children:[ee(oE,{}),"SMS"]},"sms")]}),ee(K,{})]})},sE=({selectedMethod:e,onClose:t,onBack:o})=>{let{app:r}=_(),{pendingTransaction:n}=R(),[i,a]=rc(!1),[l,s]=rc(!1),{submit:c}=fn();async function u(h){try{if(!h)return;await c(e,h),s(!0),a(!1),t()}catch(f){throw ml(f)?(a(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):en(f)?(a(!1),new Error("The code you entered is not valid")):Xr(f)?(a(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(a(!1),new Error("Unknown error"))}}switch(e){case"sms":return ao(nc,{children:[ee(S,{onClose:t},"header"),ee(Oe,{children:ee($e,{children:ee(nE,{})})}),ee(ge,{children:"Enter verification code"}),ao(Do,{children:[ee(mn,{success:l,disabled:i,onChange:u}),ao(pe,{children:["To continue, please enter the 6-digit code sent to your ",ee("strong",{children:"mobile device"})]}),n&&ee(oc,{pendingTransaction:n})]}),o&&ee(Qs,{theme:r?.appearance.palette.colorScheme,onClick:o,children:"Choose another method"}),ee(Lt,{onClick:t,children:"Not now"}),ee(K,{})]});case"totp":return ao(nc,{children:[ee(S,{onClose:t},"header"),ee(Oe,{children:ee($e,{children:ee(rE,{})})}),ee(ge,{children:"Enter verification code"}),ao(Do,{children:[ee(mn,{success:l,disabled:i,onChange:u}),ao(pe,{children:["To continue, please enter the 6-digit code generated from your"," ",ee("strong",{children:"authenticator app"})]}),n&&ee(oc,{pendingTransaction:n})]}),o&&ee(Qs,{theme:r?.appearance.palette.colorScheme,onClick:o,children:"Choose another method"}),ee(Lt,{onClick:t,children:"Not now"}),ee(K,{})]});default:return null}};import{useEffect as Xf,useState as eh}from"react";import oh from"styled-components";function ac(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{Fragment as dE,jsx as so,jsxs as ps}from"react/jsx-runtime";var th={google:{name:"Google",component:Ja},discord:{name:"Discord",component:ja},github:{name:"Github",component:Ka},linkedin:{name:"LinkedIn",component:Za},twitter:{name:"Twitter",component:es},tiktok:{name:"Tiktok",component:Xa},apple:{name:"Apple",component:qa}},ds=()=>{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"),It.del(Rr),window.history.pushState({},"",e)},rh=()=>{let{ready:e,user:t,authenticated:o}=B(),{app:r,setModalData:n,navigate:i,resetNavigation:a}=_(),{getAuthMeta:l,initLoginWithOAuth:s,loginWithOAuth:c,updateWallets:u,setReadyToTrue:h,closePrivyModal:f}=R(),[g,C]=eh(!1),[b,x]=eh(void 0),E=l()?.provider||"google",T=th[E].name,N=th[E].component,k=r?.render.inDialog?ze:0;Xf(()=>{c(E).then(()=>{ds(),C(!0)}).catch(I=>{let F={retryable:!1,message:"Authentication failed"};if(I?.privyErrorCode==="allowlist_rejected"){x(void 0),a(),i("ALLOWLIST_REJECTION_SCREEN"),ds();return}else I?.privyErrorCode==="linked_to_another_user"?F.detail="This account has already been linked to another user.":I?.privyErrorCode==="invalid_credentials"?(F.retryable=!0,F.detail="Something went wrong. Try again."):I.privyErrorCode==="oauth_user_denied"?(F.detail=`Retry and check ${ac(E)} to finish connecting your account.`,F.retryable=!0):I?.privyErrorCode==="too_many_requests"?F.detail="Too many requests. Please wait before trying again.":I?.privyErrorCode==="oauth_account_suspended"&&(F.detail=`Your ${T} account is suspended. Please try another login method.`);ds(),x(F)}).finally(()=>{h()})},[T,E]),Xf(()=>{if(e&&o&&g&&t){if(r?.legal.requireUsersAcceptTerms&&!t.hasAcceptedTerms){let F=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},k);return()=>clearTimeout(F)}if(yt(t,r?.embeddedWallets?.createOnLogin)){let F=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:z=>console.error(z),callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},k);return()=>clearTimeout(F)}else{let F=setTimeout(f,k);return u(),()=>clearTimeout(F)}}},[e,o,g,t]);let M=g?`Successfully connected with ${T}`:b?b.message:`Verifying connection to ${T}`,L="";return g?L="You\u2019re good to go!":b?L=b.detail:L="Just a few moments more",ps(dE,{children:[so(S,{}),so(Y,{}),ps(lE,{children:[so(cE,{children:ps("div",{children:[so(Lo,{success:g,fail:!!b}),so(N,{style:{width:"38px",height:"38px"}})]})}),ps(Et,{children:[so("h3",{children:M}),so("p",{children:L})]}),b&&b?.retryable?so(la,{onClick:()=>{ds(),s(E),x(void 0)},disabled:!g&&!b?.retryable,children:"Retry"}):null]}),so(Q,{}),so(K,{})]})},lE=oh.div`
2164
+ `;import{Fragment as ic,jsx as te,jsxs as so}from"react/jsx-runtime";var ac=({open:e,onClose:t})=>{let{user:o}=H(),[r,n]=nc(null),{init:i,cancel:a}=hn();aE(()=>{e&&o?.mfaMethods&&o.mfaMethods.length>0?l(o.mfaMethods[0]):n(null)},[o?.mfaMethods,e]);async function l(c){try{n(c),await i(c)}catch(u){console.error(u)}}let s=()=>{n(null),a(),t()};return!e||!o?null:r?te(sE,{selectedMethod:r,onClose:s,onBack:o.mfaMethods.length>1?()=>n(null):void 0}):so(ic,{children:[te(S,{onClose:s},"header"),te(De,{children:te(Ke,{children:te(iE,{})})}),te(ge,{children:"Verify your identity"}),te(ue,{children:"Choose a verification method"}),so(fa,{children:[o.mfaMethods.includes("totp")&&so(ye,{onClick:()=>l("totp"),children:[te(tE,{}),"Authenticator App"]},"totp"),o.mfaMethods.includes("sms")&&so(ye,{onClick:()=>l("sms"),children:[te(oE,{}),"SMS"]},"sms")]}),te(Y,{})]})},sE=({selectedMethod:e,onClose:t,onBack:o})=>{let{app:r}=_(),{pendingTransaction:n}=I(),[i,a]=nc(!1),[l,s]=nc(!1),{submit:c}=hn();async function u(h){try{if(!h)return;await c(e,h),s(!0),a(!1),t()}catch(f){throw fl(f)?(a(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):tn(f)?(a(!1),new Error("The code you entered is not valid")):en(f)?(a(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(a(!1),new Error("Unknown error"))}}switch(e){case"sms":return so(ic,{children:[te(S,{onClose:t},"header"),te(De,{children:te(Ke,{children:te(nE,{})})}),te(ge,{children:"Enter verification code"}),so(Uo,{children:[te(fn,{success:l,disabled:i,onChange:u}),so(ue,{children:["To continue, please enter the 6-digit code sent to your ",te("strong",{children:"mobile device"})]}),n&&te(rc,{pendingTransaction:n})]}),o&&te(Zs,{theme:r?.appearance.palette.colorScheme,onClick:o,children:"Choose another method"}),te(Ot,{onClick:t,children:"Not now"}),te(Y,{})]});case"totp":return so(ic,{children:[te(S,{onClose:t},"header"),te(De,{children:te(Ke,{children:te(rE,{})})}),te(ge,{children:"Enter verification code"}),so(Uo,{children:[te(fn,{success:l,disabled:i,onChange:u}),so(ue,{children:["To continue, please enter the 6-digit code generated from your"," ",te("strong",{children:"authenticator app"})]}),n&&te(rc,{pendingTransaction:n})]}),o&&te(Zs,{theme:r?.appearance.palette.colorScheme,onClick:o,children:"Choose another method"}),te(Ot,{onClick:t,children:"Not now"}),te(Y,{})]});default:return null}};import{useEffect as eh,useState as th}from"react";import rh from"styled-components";function sc(e){return e.charAt(0).toUpperCase()+e.slice(1)}import{Fragment as dE,jsx as lo,jsxs as us}from"react/jsx-runtime";var oh={google:{name:"Google",component:Qa},discord:{name:"Discord",component:Ka},github:{name:"Github",component:Ya},linkedin:{name:"LinkedIn",component:Xa},twitter:{name:"Twitter",component:ts},tiktok:{name:"Tiktok",component:es},apple:{name:"Apple",component:ja}},ps=()=>{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"),Wt.del(Ir),window.history.pushState({},"",e)},nh=()=>{let{ready:e,user:t,authenticated:o}=H(),{app:r,setModalData:n,navigate:i,resetNavigation:a}=_(),{getAuthMeta:l,initLoginWithOAuth:s,loginWithOAuth:c,updateWallets:u,setReadyToTrue:h,closePrivyModal:f}=I(),[g,C]=th(!1),[b,x]=th(void 0),E=l()?.provider||"google",T=oh[E].name,L=oh[E].component,R=r?.render.inDialog?je:0;eh(()=>{c(E).then(()=>{ps(),C(!0)}).catch(W=>{let B={retryable:!1,message:"Authentication failed"};if(W?.privyErrorCode==="allowlist_rejected"){x(void 0),a(),i("ALLOWLIST_REJECTION_SCREEN"),ps();return}else W?.privyErrorCode==="linked_to_another_user"?B.detail="This account has already been linked to another user.":W?.privyErrorCode==="invalid_credentials"?(B.retryable=!0,B.detail="Something went wrong. Try again."):W.privyErrorCode==="oauth_user_denied"?(B.detail=`Retry and check ${sc(E)} to finish connecting your account.`,B.retryable=!0):W?.privyErrorCode==="too_many_requests"?B.detail="Too many requests. Please wait before trying again.":W?.privyErrorCode==="oauth_account_suspended"&&(B.detail=`Your ${T} account is suspended. Please try another login method.`);ps(),x(B)}).finally(()=>{h()})},[T,E]),eh(()=>{if(e&&o&&g&&t){if(r?.legal.requireUsersAcceptTerms&&!t.hasAcceptedTerms){let B=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout(B)}if(yt(t,r?.embeddedWallets?.createOnLogin)){let B=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:$=>console.error($),callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R);return()=>clearTimeout(B)}else{let B=setTimeout(f,R);return u(),()=>clearTimeout(B)}}},[e,o,g,t]);let N=g?`Successfully connected with ${T}`:b?b.message:`Verifying connection to ${T}`,O="";return g?O="You\u2019re good to go!":b?O=b.detail:O="Just a few moments more",us(dE,{children:[lo(S,{}),lo(J,{}),us(lE,{children:[lo(cE,{children:us("div",{children:[lo(Oo,{success:g,fail:!!b}),lo(L,{style:{width:"38px",height:"38px"}})]})}),us(Et,{children:[lo("h3",{children:N}),lo("p",{children:O})]}),b&&b?.retryable?lo(ca,{onClick:()=>{ps(),s(E),x(void 0)},disabled:!g&&!b?.retryable,children:"Retry"}):null]}),lo(Z,{}),lo(Y,{})]})},lE=rh.div`
2165
2165
  display: flex;
2166
2166
  flex-direction: column;
2167
2167
  align-items: center;
@@ -2169,7 +2169,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2169
2169
  margin-left: 27px;
2170
2170
  margin-right: 27px;
2171
2171
  gap: 24px;
2172
- `,cE=oh.div`
2172
+ `,cE=rh.div`
2173
2173
  display: flex;
2174
2174
  flex-direction: column;
2175
2175
  justify-content: center;
@@ -2192,55 +2192,55 @@ You will need this password to access your ${e} wallet on a new device. Please k
2192
2192
  left: -19px;
2193
2193
  top: -19px;
2194
2194
  }
2195
- `;import{useEffect as uE,useState as ih}from"react";import mE from"styled-components";import{isMobile as pE}from"react-device-detect";var nh=(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(!Ro()&&pE)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};import{Fragment as hE,jsx as Po,jsxs as ah}from"react/jsx-runtime";var sh=()=>{let{forkSession:e,ready:t,authenticated:o}=B(),[r,n]=ih(""),[i,a]=ih(!1);uE(()=>{t&&o&&e().then(n)},[t,o]);let l=nh(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."),ah(hE,{children:[Po(S,{},"header"),Po(Y,{}),Po(oo,{title:s.title,description:s.description}),ah(to,{children:[Po(fE,{children:Po(Yt,{style:{width:"72px",height:"72px"}})}),Po(sa,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?Po("p",{children:s.footnote}):null]}),Po(Q,{}),Po(H,{protectedByPrivy:!0})]})},fE=mE(bt)`
2195
+ `;import{useEffect as uE,useState as ah}from"react";import mE from"styled-components";import{isMobile as pE}from"react-device-detect";var ih=(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(!Io()&&pE)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};import{Fragment as hE,jsx as So,jsxs as sh}from"react/jsx-runtime";var lh=()=>{let{forkSession:e,ready:t,authenticated:o}=H(),[r,n]=ah(""),[i,a]=ah(!1);uE(()=>{t&&o&&e().then(n)},[t,o]);let l=ih(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."),sh(hE,{children:[So(S,{},"header"),So(J,{}),So(ro,{title:s.title,description:s.description}),sh(oo,{children:[So(fE,{children:So(Jt,{style:{width:"72px",height:"72px"}})}),So(la,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?So("p",{children:s.footnote}):null]}),So(Z,{}),So(G,{protectedByPrivy:!0})]})},fE=mE(bt)`
2196
2196
  margin: 16px auto;
2197
- `;import{BigNumber as bE}from"@ethersproject/bignumber";import{StaticJsonRpcProvider as EE}from"@ethersproject/providers";import{useMemo as dh,useEffect as ph,useState as St}from"react";import wn from"styled-components";function lh(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{BigNumber as sc}from"@ethersproject/bignumber";import yE from"styled-components";import{Fragment as wE,jsx as mi,jsxs as CE}from"react/jsx-runtime";var gE=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let o=sc.from(e.gasUsed),r=sc.from(e.effectiveGasPrice),n=o.mul(r);if(t){let i=sc.from(t);n=n.add(i)}return n.toString()}catch{return}else return},ch=({txn:e,receipt:t,transactionInfo:o,onClose:r,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a})=>CE(wE,{children:[mi(S,{onClose:r}),mi(On,{title:"Transaction complete!",description:"You're all set."}),mi(yn,{tokenPrice:n,from:t.from,to:t.to,gas:gE(t,a),txn:e,transactionInfo:o,tokenSymbol:i}),mi(vE,{loading:!1,onClick:r,children:"All Done"}),mi(K,{})]}),vE=yE(D)`
2197
+ `;import{BigNumber as bE}from"@ethersproject/bignumber";import{StaticJsonRpcProvider as EE}from"@ethersproject/providers";import{useMemo as ph,useEffect as uh,useState as St}from"react";import Cn from"styled-components";function ch(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}import{BigNumber as lc}from"@ethersproject/bignumber";import yE from"styled-components";import{Fragment as wE,jsx as fi,jsxs as CE}from"react/jsx-runtime";var gE=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let o=lc.from(e.gasUsed),r=lc.from(e.effectiveGasPrice),n=o.mul(r);if(t){let i=lc.from(t);n=n.add(i)}return n.toString()}catch{return}else return},dh=({txn:e,receipt:t,transactionInfo:o,onClose:r,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a})=>CE(wE,{children:[fi(S,{onClose:r}),fi(Dn,{title:"Transaction complete!",description:"You're all set."}),fi(gn,{tokenPrice:n,from:t.from,to:t.to,gas:gE(t,a),txn:e,transactionInfo:o,tokenSymbol:i}),fi(vE,{loading:!1,onClick:r,children:"All Done"}),fi(Y,{})]}),vE=yE(U)`
2198
2198
  && {
2199
2199
  margin-top: 24px;
2200
2200
  }
2201
2201
  transition: color 350ms ease, background-color 350ms ease;
2202
- `;import{Fragment as lc,jsx as Fe,jsxs as vn}from"react/jsx-runtime";var TE=({txn:e,txnFamily:t,uiOptions:o,tokenSymbol:r,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(o.transactionInfo?.contractInfo)return Fe(Kl,{contractInfo:o.transactionInfo.contractInfo,description:o.description});if(o.senderInfo)return Fe(Kl,{contractInfo:o.senderInfo,description:o.description||o.senderInfo.actionText})}return Fe(lc,{children:Fe($f,{description:o.description||o.transactionInfo?.description||"",txn:e,tokenSymbol:r,tokenPrice:n})})},mh=()=>{let{authenticated:e,getAccessToken:t}=B(),{wallets:o}=ui(),{walletProxy:r,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s}=R(),{app:c,navigate:u,data:h,onUserCloseViaDialogOrKeybindRef:f,setModalData:g}=_(),{transactionRequest:C,onSuccess:b,onFailure:x,uiOptions:E,fundWalletConfig:T}=h.sendTransaction,[N,k]=St(null),[M,L]=St(null),[I,F]=St(""),[z,X]=St(),[O,G]=St(!1),A=()=>{F(""),X(void 0)},se=(He,it,ft)=>{F(He),X(new Le(new qt(it??He,ft??tt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[ne,J]=St(!1),[_t,me]=St(!0),[Je,Me]=St(null),[oe,uo]=St(C),{tokenPrice:At,isTokenPriceLoading:Pr}=cs(oe),Qe=s(C.chainId)||"ETH",[xe,Vt]=St(null),[xr,U]=St(null),[Be,En]=St(!0);ph(()=>{e||(u("LANDING"),x(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let Z=dh(()=>o.find(He=>He.walletClientType==="privy"),[o]),kt=async()=>{if(!Z)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:He,externalTransactionId:it}=await i(Z.address,{config:T?.config||{}});g({fiatOnRampPrompt:{signedUrl:He},fiatOnRampStatus:{externalTransactionId:it}}),u("FIAT_ON_RAMP_PROMPT_SCREEN")},Xo=dh(()=>new EE(Mt(oe.chainId,l,a)),[oe.chainId,a]);ph(()=>{let He=()=>{me(!1),se("Wallet has insufficient funds for this transaction."),c?.fiatOnRamp.enabled&&G(!0)};async function it(){let ft=oe;if(!await t()||!r||!Z)return;try{ft=await gn(Z.address,oe,Xo),uo(ft)}catch(Rt){su(Rt)?He():se("There was an error preparing your transaction. Please try again.",Rt.reason)}let _o=bE.from(0);try{_o=await ss(ft,Xo),Vt(Ce(_o.toBigInt()).toHexString());let Rt=await Xl(oe,Xo);U(Ce(Rt.toBigInt()).toHexString())}catch{Vt(null)}try{let{balance:Rt,hasSufficientFunds:yi}=await Yf(Z.address,ft,_o,Xo);Me(Rt.toHexString()),yi||He()}catch(Rt){console.warn(`Failed to fetch wallet balance with error: ${Rt}`)}En(!1)}it()},[r]);let hi=lh(oe),Tn=hi==="SEND"?`Send ${Qe}`:"Review transaction",So={modalTitle:E.header||E.modalTitle||Tn,buttonText:E.buttonText||"Submit"},Sr=()=>{ne||(M?b(M):x(z||new Le(new qt("The user rejected the request",tt.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return f.current=Sr,At===void 0&&Pr||Be?vn(lc,{children:[E.transactionInfo?.contractInfo?.imgUrl&&Fe(Hi,{src:E.transactionInfo?.contractInfo?.imgUrl}),Fe(S,{title:So.modalTitle,onClose:Sr}),Fe(uh,{children:Fe(Zr,{})})]}):N!==null?Fe(ch,{txn:oe,onClose:Sr,receipt:N,transactionInfo:E.transactionInfo,tokenPrice:At,tokenSymbol:Qe,l1GasEstimate:xr}):vn(lc,{children:[Fe(S,{title:So.modalTitle,onClose:Sr}),vn(uh,{children:[vn(_E,{children:[Fe(TE,{txn:oe,txnFamily:hi,uiOptions:E,tokenSymbol:Qe,tokenPrice:At}),Z?Fe(yn,{from:Z.address,to:oe.to,txn:oe,transactionInfo:E.transactionInfo,gas:xe||void 0,tokenPrice:At,tokenSymbol:Qe}):null]}),vn(AE,{children:[Fe(PE,{children:I}),Fe(Hf,{txn:oe,address:Z?.address??"",hasFunds:_t,balance:Je}),vn(xE,{children:[O&&Fe(D,{onClick:kt,children:"Add Funds"}),Fe(SE,{disabled:ne||!_t,loading:!r||ne,loadingText:ne?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{J(!0);let He=await t();if(He&&!ne&&Z)try{let it=await as(He,Z.address,r,oe,Xo);L(it);let ft=await it.wait();k(ls(ft)),A()}catch(it){let ft="There was an error processing your transaction. Please contact support.";console.warn({transaction:oe,error:it}),se(ft,it.reason)}finally{J(!1)}},children:So.buttonText})]})]})]})]})},uh=wn.div`
2202
+ `;import{Fragment as cc,jsx as Be,jsxs as wn}from"react/jsx-runtime";var TE=({txn:e,txnFamily:t,uiOptions:o,tokenSymbol:r,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(o.transactionInfo?.contractInfo)return Be(Yl,{contractInfo:o.transactionInfo.contractInfo,description:o.description});if(o.senderInfo)return Be(Yl,{contractInfo:o.senderInfo,description:o.description||o.senderInfo.actionText})}return Be(cc,{children:Be(qf,{description:o.description||o.transactionInfo?.description||"",txn:e,tokenSymbol:r,tokenPrice:n})})},fh=()=>{let{authenticated:e,getAccessToken:t}=H(),{wallets:o}=mi(),{walletProxy:r,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s}=I(),{app:c,navigate:u,data:h,onUserCloseViaDialogOrKeybindRef:f,setModalData:g}=_(),{transactionRequest:C,onSuccess:b,onFailure:x,uiOptions:E,fundWalletConfig:T}=h.sendTransaction,[L,R]=St(null),[N,O]=St(null),[W,B]=St(""),[$,ee]=St(),[D,V]=St(!1),A=()=>{B(""),ee(void 0)},le=(Ge,at,ht)=>{B(Ge),ee(new Oe(new jt(at??Ge,ht??rt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[ne,Q]=St(!1),[_t,fe]=St(!0),[Xe,Ne]=St(null),[oe,mo]=St(C),{tokenPrice:At,isTokenPriceLoading:xr}=ds(oe),et=s(C.chainId)||"ETH",[Se,zt]=St(null),[Sr,k]=St(null),[He,Tn]=St(!0);uh(()=>{e||(u("LANDING"),x(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let X=ph(()=>o.find(Ge=>Ge.walletClientType==="privy"),[o]),kt=async()=>{if(!X)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:Ge,externalTransactionId:at}=await i(X.address,{config:T?.config||{}});g({fiatOnRampPrompt:{signedUrl:Ge},fiatOnRampStatus:{externalTransactionId:at}}),u("FIAT_ON_RAMP_PROMPT_SCREEN")},er=ph(()=>new EE(Nt(oe.chainId,l,a)),[oe.chainId,a]);uh(()=>{let Ge=()=>{fe(!1),le("Wallet has insufficient funds for this transaction."),c?.fiatOnRamp.enabled&&V(!0)};async function at(){let ht=oe;if(!await t()||!r||!X)return;try{ht=await vn(X.address,oe,er),mo(ht)}catch(Rt){lu(Rt)?Ge():le("There was an error preparing your transaction. Please try again.",Rt.reason)}let ko=bE.from(0);try{ko=await ls(ht,er),zt(Ce(ko.toBigInt()).toHexString());let Rt=await ec(oe,er);k(Ce(Rt.toBigInt()).toHexString())}catch{zt(null)}try{let{balance:Rt,hasSufficientFunds:gi}=await Jf(X.address,ht,ko,er);Ne(Rt.toHexString()),gi||Ge()}catch(Rt){console.warn(`Failed to fetch wallet balance with error: ${Rt}`)}Tn(!1)}at()},[r]);let yi=ch(oe),Pn=yi==="SEND"?`Send ${et}`:"Review transaction",Ao={modalTitle:E.header||E.modalTitle||Pn,buttonText:E.buttonText||"Submit"},_r=()=>{ne||(N?b(N):x($||new Oe(new jt("The user rejected the request",rt.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return f.current=_r,At===void 0&&xr||He?wn(cc,{children:[E.transactionInfo?.contractInfo?.imgUrl&&Be(Gi,{src:E.transactionInfo?.contractInfo?.imgUrl}),Be(S,{title:Ao.modalTitle,onClose:_r}),Be(mh,{children:Be(Xr,{})})]}):L!==null?Be(dh,{txn:oe,onClose:_r,receipt:L,transactionInfo:E.transactionInfo,tokenPrice:At,tokenSymbol:et,l1GasEstimate:Sr}):wn(cc,{children:[Be(S,{title:Ao.modalTitle,onClose:_r}),wn(mh,{children:[wn(_E,{children:[Be(TE,{txn:oe,txnFamily:yi,uiOptions:E,tokenSymbol:et,tokenPrice:At}),X?Be(gn,{from:X.address,to:oe.to,txn:oe,transactionInfo:E.transactionInfo,gas:Se||void 0,tokenPrice:At,tokenSymbol:et}):null]}),wn(AE,{children:[Be(PE,{children:W}),Be(Gf,{txn:oe,address:X?.address??"",hasFunds:_t,balance:Xe}),wn(xE,{children:[D&&Be(U,{onClick:kt,children:"Add Funds"}),Be(SE,{disabled:ne||!_t,loading:!r||ne,loadingText:ne?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{Q(!0);let Ge=await t();if(Ge&&!ne&&X)try{let at=await ss(Ge,X.address,r,oe,er);O(at);let ht=await at.wait();R(cs(ht)),A()}catch(at){let ht="There was an error processing your transaction. Please contact support.";console.warn({transaction:oe,error:at}),le(ht,at.reason)}finally{Q(!1)}},children:Ao.buttonText})]})]})]})]})},mh=Cn.div`
2203
2203
  display: flex;
2204
2204
  flex-direction: column;
2205
2205
  justify-content: space-between;
2206
2206
  flex-grow: 1;
2207
2207
  padding-bottom: 16px;
2208
- `,PE=wn.div`
2208
+ `,PE=Cn.div`
2209
2209
  font-size: 13px;
2210
2210
  color: var(--privy-color-error);
2211
2211
  width: 100%;
2212
2212
  margin-top: 16px;
2213
- `,xE=wn.div`
2213
+ `,xE=Cn.div`
2214
2214
  display: flex;
2215
2215
  direction: row;
2216
2216
  justify-content: space-between;
2217
2217
  align-items: center;
2218
2218
  gap: 8px;
2219
- `,SE=wn(D)`
2219
+ `,SE=Cn(U)`
2220
2220
  transition: color 350ms ease, background-color 350ms ease;
2221
- `,_E=wn.div`
2221
+ `,_E=Cn.div`
2222
2222
  height: 100%;
2223
2223
  display: flex;
2224
2224
  flex-direction: column;
2225
2225
  justify-content: space-evenly;
2226
2226
  flex-grow: 1;
2227
- `,AE=wn.div`
2227
+ `,AE=Cn.div`
2228
2228
  display: flex;
2229
2229
  flex-direction: column;
2230
2230
  gap: 8px;
2231
- `;import{isHexString as kE}from"@ethersproject/bytes";import{toUtf8String as RE}from"@ethersproject/strings";import{useEffect as fh,useState as us}from"react";import Zo,{css as IE}from"styled-components";import{Fragment as gh,jsx as Se,jsxs as Cn}from"react/jsx-runtime";var WE=e=>{if(!kE(e))return e;try{return RE(e)}catch{return e}},ME=e=>JSON.stringify(e,null,2),NE=({data:e})=>{let t=o=>typeof o=="object"&&o!==null?Se(FE,{children:Object.entries(o).map(([r,n])=>Cn("li",{children:[Cn("strong",{children:[r,":"]})," ",t(n)]},r))}):Se("span",{children:String(o)});return Se("div",{children:t(e)})},LE=e=>{let{types:t,primaryType:o,...r}=e.typedData;return Cn(gh,{children:[Se(yh,{children:Se(NE,{data:r})}),Se(sn,{text:ME(e.typedData),itemName:"full payload to clipboard"})," "]})},hh=()=>{let{authenticated:e}=B(),{initializeWalletProxy:t,closePrivyModal:o}=R(),{navigate:r,data:n,onUserCloseViaDialogOrKeybindRef:i}=_(),[a,l]=us(!0),[s,c]=us(""),[u,h]=us(),[f,g]=us(null),C=f!==null;fh(()=>{e||r("LANDING")},[e]),fh(()=>{t(Wr).then(I=>{l(!1),I||(c("An error has occurred, please try again."),h(new Le(new qt(s,tt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:b,data:x,confirmAndSign:E,onSuccess:T,onFailure:N,uiOptions:k}=n.signMessage,M={title:k.title||"Sign message",description:k.description||"Signing this message will not cost you any fees.",buttonText:k.buttonText||"Sign and continue"},L=I=>{I?T(I):N(u||new Le(new qt("The user rejected the request.",tt.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),g(null),c(""),h(void 0)};return i.current=()=>{L(f)},Cn(gh,{children:[Se(S,{onClose:()=>L(f)}),Se(Y,{}),Cn(OE,{children:[Se(DE,{children:M.title}),Se(UE,{children:M.description}),b==="personal_sign"&&Se(yh,{children:WE(x)}),b==="eth_signTypedData_v4"&&Se(LE,{typedData:x}),Se(BE,{fail:!0,children:s}),Se(GE,{success:C,loading:a,disabled:C,onClick:async()=>{try{let I=await E();g(I),c(""),setTimeout(()=>{L(I)},ze)}catch{c("An error has occurred, please try again."),h(new Le(new qt(s,tt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:C?Cn(HE,{children:[Se(Oa,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",Se("span",{children:"Success"})]}):M.buttonText})]}),Se(Q,{}),Se(H,{protectedByPrivy:!0})]})},OE=Zo.div`
2231
+ `;import{isHexString as kE}from"@ethersproject/bytes";import{toUtf8String as RE}from"@ethersproject/strings";import{useEffect as hh,useState as ms}from"react";import Xo,{css as IE}from"styled-components";import{Fragment as vh,jsx as _e,jsxs as bn}from"react/jsx-runtime";var WE=e=>{if(!kE(e))return e;try{return RE(e)}catch{return e}},ME=e=>JSON.stringify(e,null,2),NE=({data:e})=>{let t=o=>typeof o=="object"&&o!==null?_e(FE,{children:Object.entries(o).map(([r,n])=>bn("li",{children:[bn("strong",{children:[r,":"]})," ",t(n)]},r))}):_e("span",{children:String(o)});return _e("div",{children:t(e)})},LE=e=>{let{types:t,primaryType:o,...r}=e.typedData;return bn(vh,{children:[_e(gh,{children:_e(NE,{data:r})}),_e(ln,{text:ME(e.typedData),itemName:"full payload to clipboard"})," "]})},yh=()=>{let{authenticated:e}=H(),{initializeWalletProxy:t,closePrivyModal:o}=I(),{navigate:r,data:n,onUserCloseViaDialogOrKeybindRef:i}=_(),[a,l]=ms(!0),[s,c]=ms(""),[u,h]=ms(),[f,g]=ms(null),C=f!==null;hh(()=>{e||r("LANDING")},[e]),hh(()=>{t(Mr).then(W=>{l(!1),W||(c("An error has occurred, please try again."),h(new Oe(new jt(s,rt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:b,data:x,confirmAndSign:E,onSuccess:T,onFailure:L,uiOptions:R}=n.signMessage,N={title:R.title||"Sign message",description:R.description||"Signing this message will not cost you any fees.",buttonText:R.buttonText||"Sign and continue"},O=W=>{W?T(W):L(u||new Oe(new jt("The user rejected the request.",rt.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),g(null),c(""),h(void 0)};return i.current=()=>{O(f)},bn(vh,{children:[_e(S,{onClose:()=>O(f)}),_e(J,{}),bn(OE,{children:[_e(DE,{children:N.title}),_e(UE,{children:N.description}),b==="personal_sign"&&_e(gh,{children:WE(x)}),b==="eth_signTypedData_v4"&&_e(LE,{typedData:x}),_e(BE,{fail:!0,children:s}),_e(GE,{success:C,loading:a,disabled:C,onClick:async()=>{try{let W=await E();g(W),c(""),setTimeout(()=>{O(W)},je)}catch{c("An error has occurred, please try again."),h(new Oe(new jt(s,rt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:C?bn(HE,{children:[_e(Da,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",_e("span",{children:"Success"})]}):N.buttonText})]}),_e(Z,{}),_e(G,{protectedByPrivy:!0})]})},OE=Xo.div`
2232
2232
  display: flex;
2233
2233
  flex-direction: column;
2234
2234
  align-items: center;
2235
2235
  justify-content: center;
2236
- `,DE=Zo.span`
2236
+ `,DE=Xo.span`
2237
2237
  color: var(--privy-color-foreground);
2238
2238
  text-align: center;
2239
2239
  font-size: 1.125rem;
2240
2240
  font-weight: 500;
2241
2241
  line-height: 1.25rem; /* 111.111% */
2242
2242
  text-align: center;
2243
- `,UE=Zo.span`
2243
+ `,UE=Xo.span`
2244
2244
  margin-top: 4px;
2245
2245
  color: var(--privy-color-foreground);
2246
2246
  text-align: center;
@@ -2250,7 +2250,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2250
2250
  font-weight: 400;
2251
2251
  line-height: 20px; /* 142.857% */
2252
2252
  letter-spacing: -0.008px;
2253
- `,yh=Zo.div`
2253
+ `,gh=Xo.div`
2254
2254
  margin-top: 1.5rem;
2255
2255
  background-color: var(--privy-color-background-2);
2256
2256
  border-radius: var(--privy-border-radius-md);
@@ -2269,7 +2269,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2269
2269
  display: none; /* Safari and Chrome */
2270
2270
  }
2271
2271
  }
2272
- `,FE=Zo.ul`
2272
+ `,FE=Xo.ul`
2273
2273
  margin-left: 12px !important;
2274
2274
  white-space: nowrap;
2275
2275
 
@@ -2281,7 +2281,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2281
2281
  font-weight: 500 !important;
2282
2282
  }
2283
2283
  }
2284
- `,BE=Zo.div`
2284
+ `,BE=Xo.div`
2285
2285
  line-height: 20px;
2286
2286
  height: 20px;
2287
2287
  font-size: 13px;
@@ -2291,11 +2291,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
2291
2291
  width: 100%;
2292
2292
  margin-top: 16px;
2293
2293
  margin-bottom: 4px;
2294
- `,HE=Zo.span`
2294
+ `,HE=Xo.span`
2295
2295
  display: flex;
2296
2296
  align-items: center;
2297
2297
  gap: 8px;
2298
- `,GE=Zo(D)`
2298
+ `,GE=Xo(U)`
2299
2299
  transition: color 350ms ease, background-color 350ms ease;
2300
2300
 
2301
2301
  ${e=>e.success&&IE`
@@ -2534,7 +2534,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
2534
2534
  [hidden] {
2535
2535
  display: none;
2536
2536
  }
2537
- `,vh=VE;var wh=$E`
2537
+ `,wh=VE;var Ch=$E`
2538
2538
  :root {
2539
2539
  // Borders
2540
2540
  --privy-border-radius-sm: 6px;
@@ -2566,10 +2566,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
2566
2566
  --privy-height-modal-full: 620px;
2567
2567
  --privy-height-modal-compact: 480px;
2568
2568
  };
2569
- `,Ch=zE.div`
2569
+ `,bh=zE.div`
2570
2570
  // css normalize only the privy application to avoid conflicts
2571
2571
  // with consuming application
2572
- ${vh}
2572
+ ${wh}
2573
2573
 
2574
2574
  // Privy styles
2575
2575
  color: var(--privy-color-foreground-2);
@@ -2628,4 +2628,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
2628
2628
  opacity: 1;
2629
2629
  }
2630
2630
  }
2631
- `;import{jsx as We,jsxs as Eh}from"react/jsx-runtime";var JE={["LANDING"]:Ym,["AWAITING_PASSWORDLESS_CODE"]:Up,["AWAITING_CONNECTION"]:eu,["AWAITING_CONNECT_ONLY_CONNECTION"]:nu,["AWAITING_FARCASTER_CONNECTION"]:pm,["PHANTOM_INTERSTITIAL_SCREEN"]:sh,["LOGIN_FAILED_SCREEN"]:of,["AWAITING_OAUTH_SCREEN"]:rh,["ALLOWLIST_REJECTION_SCREEN"]:Ap,["INSTALL_PHANTOM_SCREEN"]:xm,["LINK_EMAIL_SCREEN"]:Jm,["LINK_PHONE_SCREEN"]:Qm,["LINK_WALLET_SCREEN"]:Zm,["CONNECT_ONLY_LANDING_SCREEN"]:Qp,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Kp,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:zu,["EMBEDDED_WALLET_CREATED_SCREEN"]:uu,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:du,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:ju,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:yu,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:hh,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:mh,["FIAT_ON_RAMP_PROMPT_SCREEN"]:gm,["FIAT_ON_RAMP_STATUS_SCREEN"]:wm,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:qu,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:$u,["MFA_ENROLLMENT_FLOW_SCREEN"]:gf,["CAPTCHA_SCREEN"]:Gp,["ERROR_SCREEN"]:Ku,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Cm,["AFFIRMATIVE_CONSENT_SCREEN"]:Sp},QE=["LANDING","AWAITING_CONNECTION"],ZE=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:o,isModalOpen:r}=B(),{headless:n}=R(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:u}=ue(),h=jE(null),f=up(h),g=r&&a&&QE.includes(a)&&!n&&l==="ready";if(bh(()=>{g&&s()},[g]),bh(()=>{!r&&u&&c()},[r,u]),(!o||!i)&&a!=="AWAITING_OAUTH_SCREEN")return Eh(un,{children:[We(S,{}),We(Y,{}),We(af,{children:We(vt,{})}),We(Q,{}),We(K,{})]});if(!a&&e)return We(un,{style:{height:f},children:We("div",{ref:h,children:We(ic,{open:e,onClose:t})})});if(!a)return null;let C=JE[a];return We(un,{style:{height:f},children:Eh("div",{ref:h,children:[We(go,{if:!!e,children:We(C,{})}),We(go,{if:!e,children:We(ic,{open:e,onClose:t})})]})})},XE=()=>{let{closePrivyModal:e}=R(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:qE(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Th=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:o}=XE(),[r,n]=KE(!1);Bs({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=We(Ch,{children:We(ZE,{isMfaVerifying:r,onMfaVerificationComplete:()=>n(!1)})}),a=e||r,l=t?.render.inDialog?We(nf,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>o(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return YE.createPortal(l,s)}return l};import{useRef as e2,useEffect as t2}from"react";var ms=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;case"privy:mfa:verify":return r;case"privy:mfa:init-enrollment":return r;case"privy:mfa:submit-enrollment":return r;case"privy:mfa:unenroll":return r;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Tr(e,t,o,r,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):r.current?.reject(new Ee("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((f,g)=>{o.current={resolve:f,reject:g};let C=1e3*60*5;setTimeout(()=>{let b=new Ee("mfa_timeout","Timed out waiting for MFA code");r.current?.reject(b),g(b)},C)});return await e(h)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),r.current?.resolve(void 0);break}catch(h){if(h.type==="missing_or_invalid_mfa")a=!0;else throw r.current?.resolve(void 0),h}if(c===null){let u=new Ee("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw r.current?.reject(u),u}return c}import{jsx as s2}from"react/jsx-runtime";var o2=function(e){return()=>`id-${e++}`}(0);function r2(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function lo(e){return e.error!==void 0}var Gt=new ms,cc=new Map,n2=(e,t)=>typeof t=="bigint"?t.toString():t,i2=(e,t)=>`${e}${JSON.stringify(t,n2)}`;function co(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=i2(e,t);if(e==="privy:wallet:create"){let a=cc.get(n);if(a)return a}let i=new Promise((a,l)=>{let s=o2();Gt.enqueue(s,{resolve:a,reject:l}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{cc.delete(n)});return cc.set(n,i),i}function a2(e){switch(e.event){case"privy:iframe:ready":let t=Gt.dequeue(e.event,e.id);return lo(e)?t.reject(new Ee(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Gt.dequeue(e.event,e.id);return lo(e)?o.reject(new Ee(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Gt.dequeue(e.event,e.id);return lo(e)?r.reject(new Ee(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Gt.dequeue(e.event,e.id);return lo(e)?n.reject(new Ee(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Gt.dequeue(e.event,e.id);return lo(e)?i.reject(new Ee(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Gt.dequeue(e.event,e.id);return lo(e)?a.reject(new Ee(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Gt.dequeue(e.event,e.id);return lo(e)?l.reject(new Ee(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Gt.dequeue(e.event,e.id);return lo(e)?s.reject(new Ee(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Gt.dequeue(e.event,e.id);return lo(e)?s.reject(new Ee(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Gt.dequeue(e.event,e.id);return lo(e)?s.reject(new Ee(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Ph(e){let t=e2(null),o=hp();return t2(()=>{let r=t.current;if(!r)return;function n(c){c&&c.origin===e.origin&&r2(c.data)&&a2(c.data)}let i={create(c){return co("privy:wallet:create",c,r)},connect(c){return co("privy:wallet:connect",c,r)},recover(c){return Tr(u=>co("privy:wallet:recover",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(c){return Tr(u=>co("privy:wallet:rpc",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(c){return Tr(u=>co("privy:wallet:set-recovery-password",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(c){return Tr(u=>co("privy:mfa:verify",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(c){return Tr(u=>co("privy:mfa:init-enrollment",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(c){return co("privy:mfa:submit-enrollment",c,r)},unenrollMfa(c){return Tr(u=>co("privy:mfa:unenroll",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)}};window.addEventListener("message",n);let a=()=>e.onLoad(i),l=(...c)=>{console.warn("Privy iframe failed to load: ",...c),e.onLoadFailed()},s=new AbortController;return ud(()=>co("privy:iframe:ready",{},r),{abortSignal:s.signal}).then(a,l),()=>{window.removeEventListener("message",n),s.abort()}},[t.current,e.mfaMethods]),s2("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:Ri(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function dc(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(r=>t.includes(r))}var fs=class{constructor(t,o){this.meta={action:t,phoneNumber:o}}async init(){if(!this.meta.action)throw new w("action required");if(!this.api)throw new w("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new w("phone number must be set when initialzing authentication.");try{let t=Vc();await this.api.post(t,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw ie(t)}}async authenticate(){if(!this.meta.action)throw new w("action required");if(!this.api)throw new w("Mfa flow has no API instance");if(!this.meta.smsCode)throw new w("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new w("phone number must be set prior to calling authenticate.");try{let t=zc(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return st(o)}catch(t){throw ie(t)}}};import{jsx as po,jsxs as xh}from"react/jsx-runtime";var bn;function u2(e){return typeof e=="string"&&e.length===25}function _e(){if(!bn){let e=re.get(tr);return Promise.resolve(e||null)}return bn.getAccessToken()}var Sh,vd=(e,t)=>Sh(e,t),_h,wd=(e,t)=>_h(e,t),Ah,Cd=(e,t)=>Ah(e,t),kh,bd=()=>kh(),m2=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;re.put(xn,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},f2=({config:e,...t})=>{if(!u2(t.appId))throw new w("Cannot initialize the Privy provider with an invalid Privy app ID");bn||(bn=new Mn({appId:t.appId,apiUrl:t.apiUrl||Pi}));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."),po($d,{client:bn,clientConfig:o,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:po(h2,{...t,config:o,client:bn})})},h2=e=>{let t=e.client,[o,r]=Pe(!1),[n,i]=Pe(!1),[a,l]=Pe(!1),[s,c]=Pe(null),[u,h]=Pe(!1),[f,g]=Pe([]),C=fi(f),[b,x]=Pe(!1),[E,T]=Pe(null),[N,k]=Pe(!1),[M,L]=Pe({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:P}),[I,F]=Pe(null),[z,X]=Pe(null),[O,G]=Pe(null),A=ta(),se=qd(),[ne,J]=Pe(!0),[_t,me]=Pe({}),[Je,Me]=Pe(null),[oe,uo]=Pe(null),[At,Pr]=Pe(!1),[Qe,xe]=Pe(!1),Vt=fi(null),xr=fi(null),U=fi(mp);t.onStoreToken=d=>{d&&te(U,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{te(U,"accessToken","onAccessTokenRemoved")};let Be=fi(),En=d2(d=>{let p=t.connectors?.walletsReady||!1;return a&&s?.linkedAccounts?.some(v=>v.type==="wallet"&&v.walletClientType==="privy")?p&&d?.some(v=>v?.walletClientType==="privy"):p},[a,s?.linkedAccounts,t?.connectors?.walletsReady]),Z=d=>{T(d),setTimeout(()=>{r(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:d})},kt=d=>{A.embeddedWallets.createOnLogin!=="off"&&J(!0),Z(d)};xo(()=>{if(!O||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(O,p,A.defaultChain)}},[O,s]),xo(()=>{O&&oe?.(O)},[O]),xo(()=>{(async()=>{if(!A.customAuth?.enabled)return;J(!0);let{getCustomAccessToken:p,isLoading:m}=A.customAuth;if(!(!n||m))try{let v=await p();if(!v){await _r.logout();return}if(a)return;t.startAuthFlow(new kr(v));let{user:W,isNewUser:V}=await t.authenticate();W||await _r.logout(),c(W||null),x(V||!1),l(!0),xe(!0)}catch(v){console.warn(v),a&&await _r.logout()}})()},[A.customAuth?.enabled,A.customAuth?.getCustomAccessToken,A.customAuth?.isLoading,n,a]),xo(()=>{Qe&&O&&s&&yt(s,e.config?.embeddedWallets?.createOnLogin)&&(xe(!1),yi(s,Wr).catch(console.error))},[Qe&&O&&s]),xo(()=>{async function d(){let p=Xo();m2();let m=c2();F(m),t.initializeConnectorManager(A.walletConnectCloudProjectId,A.rpcConfig,A.chains,A.defaultChain,m,A.appearance.walletList,A.shouldEnforceDefaultChainOnConnect),t.connectors?.initialize().then(()=>{Sr()});let v=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!v),v&&te(U,"login","onComplete",v,!1,!0,null),c(v)),p||fe.setReadyToTrue(),p&&v&&h(!0)}n||d()},[t,Je,n]);let Xo=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),m=d.get("privy_oauth_state"),v=d.get("privy_oauth_provider");return p&&m&&v?(t.startAuthFlow(new ko(v,p,m)),kt("AWAITING_OAUTH_SCREEN"),!0):!1},hi=async(d,p,m,v)=>{let W=await t.connectors?.createWalletConnector(d,p)||null;Tn(W,p,m,v)};async function Tn(d,p,m,v){if(!d)return L({status:"disconnected",connectedWallet:null,connectError:new q("Unable to connect to wallet."),connector:null,connectRetry:P}),v?.(null,m);d instanceof Jt&&p&&await d.resetConnection(p),L({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Tn(d,p,m,v)});try{let W=await d.connect({showPrompt:!0});if(A.shouldEnforceDefaultChainOnConnect&&!A.chains.find(V=>V.id===Number(W?.chainId))&&!(W?.connectorType==="wallet_connect_v2"&&W?.walletClientType==="metamask")){L(V=>({...V,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:P}));try{await W?.switchChain(A.defaultChain.id),W&&(W.chainId=Mr(ir(A.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${A.defaultChain.id}`)}}return L(V=>({...V,status:"connected",connectedWallet:W,connectError:null,connectRetry:P})),W&&!N&&te(U,"connectWallet","onSuccess",W),v?.(W,m)}catch(W){return W instanceof Ne?(console.warn(W.cause?W.cause:W.message),N||te(U,"connectWallet","onError",W.privyErrorCode||"generic_connect_wallet_error")):(console.warn(W),N||te(U,"connectWallet","onError","unknown_connect_wallet_error")),L(V=>({...V,status:"disconnected",connectedWallet:null,connectError:W})),v?.(null,m)}}let So=async(d,p)=>{if(d===null)return;let m=new rr(d,p);t.startAuthFlow(m)},Sr=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),m=d.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Ro()&&kt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new w("Connector not initialized");Z("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),hi(p,m,void 0,So)};xo(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let He=()=>{if(!a)throw new w("User must be authenticated before linking a wallet.");h(!0),Z("LINK_WALLET_SCREEN")},it=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},ft=async d=>{if(!t.connectors)throw new w("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(L(m=>({...m,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:P})),A.captchaEnabled&&!a){let m={callback:v=>So(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};me({captchaModalData:m}),kt("CAPTCHA_SCREEN")}else await So(d),kt("AWAITING_CONNECTION")},ys=async(d,p)=>{if(!A.fiatOnRamp.enabled)throw new w("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:v}=await hm(t,d,p?.config??{},A.appearance.palette,A.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:v}}else throw new w("Unsupported fund provider. Currently supported option is `moonpay`.")},_o=()=>{g(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:it(m),loginOrLink:async()=>{if(!await m.isConnected())throw new w("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new w("Cannot link or login with embedded wallet");ft(m)},fund:async v=>{let{signedUrl:W,externalTransactionId:V}=await ys(m.address,v);me({fiatOnRampPrompt:{signedUrl:W},fiatOnRampStatus:{externalTransactionId:V}}),Z("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new w("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new w("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(m.address);c(v)}}))||[];return Pr(En(p)),Mi(d,p)?d:p})};xo(()=>{_o()},[s?.linkedAccounts,a,n]),xo(()=>{if(n){if(!t.connectors)throw new w("Connector not initialized");_o(),t.connectors.on("walletsUpdated",_o)}},[n]);let Rt=()=>{Z(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};xo(()=>{if(!f[0])return;let d=f[0],p=C.current.find(v=>v.address===d.address),m;if(d.walletClientType==="privy"?m=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):m=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&m){let v=Object.assign({},s);v.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(v)}C.current=f},[f]);let yi=async(d,p)=>{if(ce(d))throw te(U,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,W]=await Promise.all([fe.initializeWalletProxy(p),_e()]);if(!v&&e.config?.customAuth?.enabled)throw te(U,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!W||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((V,le)=>{J(!0),me({createWallet:{onSuccess:Xe=>{te(U,"createWallet","onSuccess",Xe),V(Xe)},onFailure:Xe=>{te(U,"createWallet","onError","unknown_embedded_wallet_error"),le(Xe)},callAuthOnSuccessOnClose:!1}}),Z("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:W});let V=await fe.refreshUser(),le=ce(V);if(!le)throw te(U,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return te(U,"createWallet","onSuccess",le),le}},Wh=d=>{if(!A.chains.map(p=>p.id).includes(d))throw new q(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},uc=(d,p,m)=>new Promise(async(v,W)=>{if(!a||!s){W(new Error("User must be authenticated before signing with a Privy wallet"));return}let V=ce(s);if(!V){W(new Error("Must have a Privy wallet before signing"));return}J(!0);let le=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ze=d.chainId?Number(d.chainId):le.chainId;Wh(Ze);let Xe=Object.assign({},d,{chainId:Ze}),mo=async()=>{let ht=await _e();if(!ht||!O){W(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await fe.recoverEmbeddedWallet()){W(new Error("Unable to connect to wallet"));return}let hc=new l2(Mt(Xe.chainId,A.chains,A.rpcConfig)),Nh=await gn(V.address,Xe,hc),Lh=await as(ht,V.address,O,Nh,hc);v(Lh)}catch(Ao){W(Ao)}};if(A.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),mo();else{let ht={transactionRequest:Xe,onSuccess:v,onFailure:W,uiOptions:p||{},fundWalletConfig:m},Ao={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:W};me({connectWallet:Ao,sendTransaction:ht}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function mc(){return new Promise(async(d,p)=>{let m=await _e();if(!m||!O)throw new Error("Must have valid access token to enroll in MFA");try{await O.verifyMfa({accessToken:m}),d()}catch(v){p(v)}})}let _r={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Rt,linkWallet:He,linkEmail:()=>{if(!a)throw new w("User must be authenticated before linking an email address.");if(s?.email)throw new w("User already has an email linked to their account.");h(!0),Z("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(!a)throw new w("User must be authenticated before linking a phone number.");if(s?.phone)throw new w("User already has a phone number linked to their account.");h(!0),Z("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(!a)throw new w("User must be authenticated before linking a Google account.");if(s?.google)throw new w("User already has a Google account linked to their account.");await fe.initLoginWithOAuth("google")},linkTwitter:async()=>{if(!a)throw new w("User must be authenticated before linking a Twitter account.");if(s?.twitter)throw new w("User already has a Twitter account linked to their account.");await fe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(!a)throw new w("User must be authenticated before linking a Discord account.");if(s?.discord)throw new w("User already has a Discord account linked to their account.");await fe.initLoginWithOAuth("discord")},linkGithub:async()=>{if(!a)throw new w("User must be authenticated before linking a GitHub account.");if(s?.github)throw new w("User already has a Github account linked to their account.");await fe.initLoginWithOAuth("github")},linkTiktok:async()=>{if(!a)throw new w("User must be authenticated before linking a TikTok account.");if(s?.tiktok)throw new w("User already has a Tiktok account linked to their account.");await fe.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(!a)throw new w("User must be authenticated before linking a LinkedIn account.");if(s?.linkedin)throw new w("User already has a LinkedIn account linked to their account.");await fe.initLoginWithOAuth("linkedin")},linkApple:async()=>{if(!a)throw new w("User must be authenticated before linking an Apple account.");await fe.initLoginWithOAuth("apple")},linkFarcaster:async()=>{if(!a)throw new w("User must be authenticated before linking a Farcaster account.");await fe.initLoginWithFarcaster(),h(!0),Z("AWAITING_FARCASTER_CONNECTION")},login:async()=>{if(n||(await new Promise(d=>{Me(()=>d)}),Me(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}k(!0),kt("LANDING")},logout:async()=>{await t.logout(),c(null),l(!1),T(null),te(U,"logout","onSuccess"),h(!1),r(!1),re.del(Sn)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new de;let d=f.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(v=>v.address===d?.address));return!d||!p?new de:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new pc(new jt(new de));let d=f.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(v=>v.address===d?.address));return!d||!p?new pc(new jt(new de)):new pc(new jt(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new Mo(new de);let d=f.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(v=>v.address===d?.address));return!d||!p?new Mo(new de):new Mo(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},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},setActiveWallet:async d=>{let p=f.find(v=>hs(v.address)===hs(d)),m=s?.linkedAccounts.find(v=>v.type==="wallet"&&hs(v.address)===hs(d));if(!p||!await p.isConnected())X(d),He();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw te(U,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return yi(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw te(U,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=ce(s);if(!d||!O)throw te(U,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw te(U,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await mc()}catch(p){throw te(U,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{J(!0);let v={onSuccess:V=>{te(U,"setWalletPassword","onSuccess",V),p(V)},onFailure:V=>{te(U,"setWalletPassword","onError","user_exited_set_password_flow"),m(V)},callAuthOnSuccessOnClose:!1},W={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:V=>{te(U,"setWalletPassword","onError","unknown_connect_wallet_error"),m(V)}};me({setWalletPassword:v,connectWallet:W}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(m,v)=>{if(!a||!s){v(new Error("User must be authenticated before signing with a Privy wallet"));return}let W=ce(s);if(!W){v(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){v(new Error("Message must be a non-empty string"));return}J(!0);let V=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let le=await _e();if(!O||!le)throw new Error("Unable to connect to wallet");if(!await fe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:W.address});let{response:Xe}=await O.rpc({accessToken:le,address:W.address,request:{method:"personal_sign",params:[d,W.address]}}),mo=Xe.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:W.address}),mo};if(A.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let le=await V();m(le)}catch(le){v(le??new Le("Unable to sign message"))}}else{let Xe={method:"personal_sign",data:d,confirmAndSign:V,onSuccess:ht=>{m(ht)},onFailure:ht=>{v(ht)},uiOptions:p||{}},mo={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:v};me({signMessage:Xe,connectWallet:mo}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,v)=>{if(!a||!s){v(new Error("User must be authenticated before signing with a Privy wallet"));return}let W=ce(s);if(!W){v(new Error("Must have a Privy wallet before signing"));return}J(!0);let V=Ii(d),le=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Ze=await _e();if(!O||!Ze)throw new Error("Unable to connect to wallet");if(!await fe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:W.address});let{response:mo}=await O.rpc({accessToken:Ze,address:W.address,request:{method:"eth_signTypedData_v4",params:[W.address,V]}}),ht=mo.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:W.address}),ht};if(A.embeddedWallets.noPromptOnSignature||(A.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Ze=await le();m(Ze)}catch(Ze){v(Ze??new Le("Unable to sign message"))}}else{let mo={method:"eth_signTypedData_v4",data:V,confirmAndSign:le,onSuccess:Ao=>{m(Ao)},onFailure:Ao=>{v(Ao)},uiOptions:p||{}},ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:v};me({signMessage:mo,connectWallet:ht}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let W=await(await uc(d,p,m)).wait();return ls(W)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=ce(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}J(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},W=await _e();if(!W||!O){p(new Error("Must have valid access token to enroll in MFA"));return}if(!O){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await O.connect({accessToken:W,address:m.address}),await O.verifyMfa({accessToken:W})}catch(le){if(ur(le))await fe.recoverEmbeddedWallet();else throw le}}catch(le){p(le);return}let V={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};me({keyExport:V,connectWallet:v}),Z("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:mc,async init(d){let p;switch(d){case"sms":p=new fs("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(p),await p.init()},async submit(d,p){switch(d){case"totp":case"sms":Vt.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((m,v)=>{xr.current={resolve:m,reject:v}});break;default:throw Vt.current?.reject(new w("Unsupported MFA method")),new w(`Unsupported MFA method: ${d}`)}},cancel(){Vt.current?.reject(new w("MFA canceled"))},async initEnrollmentWithSms(d){let p=await _e();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){fe.closePrivyModal(),p();return}A.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),me({mfaEnrollmentFlow:{mfaMethods:A.mfa.methods,onSuccess:p,onFailure:m}}),Z("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await _e();if(!d||!O)throw new Error("Must have valid access token to enroll in MFA");let p=await O.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await _e();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await _e();if(!p||!O)throw new Error("Must have valid access token to enroll in MFA");await O.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await _e();if(!p||!O)throw new Error("Must have valid access token to remove MFA");await O.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},loginWithCode(d){return fe.loginWithCode(d)},initLoginWithEmail(d){return fe.initLoginWithEmail(d)},initLoginWithSms(d){return fe.initLoginWithSms(d)},isModalOpen:o};Sh=_r.signMessage,_h=_r.signTypedData,Ah=async(...d)=>{let p=await uc(...d);return A.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let fc=!!e.config?.headless,fe=(()=>({headless:fc,isNewUserThisSession:b,isLinking:u,linkingHint:z,pendingTransaction:null,walletConnectionStatus:M,mipdStore:I,connectors:t.connectors?.walletConnectors??[],rpcConfig:A.rpcConfig,chains:A.chains,showFiatPrices:A.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>A.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(O)return O;let p=new Promise(W=>{uo(()=>V=>W(V))}),m=new Promise(W=>setTimeout(()=>W(null),d)),v=await Promise.race([p,m]);return uo(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(te(U,"login","onComplete",s,b,!1,Be.current??null),e.onSuccess?.(s,b)):N&&te(U,"login","onError","exited_auth_flow"),X(null),k(!1),h(!1),x(!1),r(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:Z,connectWallet:Tn,initLoginWithWallet:async(d,p)=>{Be.current="siwe",So(d,p)},loginWithWallet:async()=>{if(!n)throw new Ar;if(!(t.authFlow instanceof rr))throw new w("Must initialize SIWE flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(m){throw te(U,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||s||null),x(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Pn(d);t.startAuthFlow(p);try{Be.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw te(U,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Ar;if(!(t.authFlow instanceof Pn))throw new w("Must initialize Farcaster flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(m){throw te(U,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||null),x(p||!1),l(!0)},initLoginWithOAuth:async(d,p)=>{if(id()){if(d==="google"&&dc(window.navigator.userAgent)){kt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{kt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let m=new ko(d);p&&m.addCaptchaToken(p),t.startAuthFlow(m);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&window.location.assign(v.url)},loginWithOAuth:async d=>{if(!(t.authFlow instanceof ko))throw new w("Must initialize OAuth flow before calling loginWithOAuth");let p=It.get(Rr),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d,storedStateCode:p??"",returnedStateCode:m??""}),new w("Unexpected auth flow. This may be a phishing attempt.");let v,W;if(a)v=await t.link();else try{({user:v,isNewUser:W}=await t.authenticate()),Be.current=d}catch(V){throw te(U,"login","onError",V.privyErrorCode||"unknown_auth_error"),V}c(v),x(W||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let m=new er(d,p);t.startAuthFlow(m);try{Be.current="email",await m.sendCodeEmail()}catch(v){throw te(U,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}},initLoginWithSms:async(d,p)=>{let m=new nr(d,p);t.startAuthFlow(m);try{Be.current="sms",await m.sendSmsCode()}catch(v){throw te(U,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new Ar;if(t.authFlow instanceof er)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof nr)t.authFlow.meta.smsCode=d.trim();else throw new w("Must initialize a passwordless code flow first");let p,m;a?p=await t.link():{user:p,isNewUser:m}=await t.authenticate(),c(p||s||null),x(m||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:O,createAnalyticsEvent:(d,p,m)=>t.createAnalyticsEvent(d,p,m),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let m=s?.linkedAccounts.find(W=>W.type==="wallet"&&W.walletClientType==="privy"),v=await _e();if(!v||!O||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}J(!0);try{await O.connect({accessToken:v,address:m.address}),d(!0)}catch(W){ur(W)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await O.recover({address:m.address,accessToken:v})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),d(!0)):ur(W)?(me({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)}}),Z("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(W)}}),getFiatOnRampConfig:ys,setReadyToTrue:()=>{i(!0),Je?.()},updateWallets:()=>_o()}))();kh=fe.recoverEmbeddedWallet;let Mh=p2(()=>({wallets:f,ready:At}),[f,At]);return po(he.Provider,{value:_r,children:po(Fs.Provider,{value:U,children:po(tc.Provider,{value:Mh,children:xh(dp,{...A,children:[e.children,xh(Us.Provider,{value:fe,children:[!fc&&A.captchaEnabled&&n&&!a&&po(Ds,{delayedExecution:!1}),po(wh,{theme:{...A.appearance.palette||{}}}),po(Kd,{data:_t,setModalData:me,setInitialScreen:T,initialScreen:E,authenticated:a,open:o,children:po(Th,{open:o})}),ne&&se?po(Ph,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Vt,mfaSubmitPromise:xr,onLoad:G,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as y2}from"react";function g2(e){let{login:t}=y2(he);return rt("login",e),{login:t}}import{useContext as v2}from"react";function w2(e){let{logout:t}=v2(he);return rt("logout",e),{logout:t}}import{useCallback as Rh}from"react";var C2=()=>{let e=ue(),{initLoginWithEmail:t,loginWithCode:o}=B(),r=Rh(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return e.status==="disabled",t(i)},[t]),n=Rh(async({code:i})=>{if(e.enabled&&e.status==="error")throw new yo(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};import{useCallback as Ih}from"react";var b2=()=>{let e=ue(),{initLoginWithSms:t,loginWithCode:o}=B(),r=Ih(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return e.status==="disabled",t(i)},[t]),n=Ih(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new yo(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};import{useContext as E2}from"react";function T2(e){let{connectWallet:t}=E2(he);return rt("connectWallet",e),{connectWallet:t}}import{useContext as P2}from"react";function x2(e){let{createWallet:t}=P2(he);return rt("createWallet",e),{createWallet:t}}import{useContext as S2}from"react";function _2(e){let{setWalletPassword:t}=S2(he);return rt("setWalletPassword",e),{setWalletPassword:t}}import{useContext as A2}from"react";var k2=()=>{let{isModalOpen:e}=A2(he);return{isOpen:e}};import{useContext as R2}from"react";function I2(e){let{getAccessToken:t}=R2(he);return rt("accessToken",e),{getAccessToken:t}}function W2(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{jt as AsExternalProvider,Ds as Captcha,Wn as ConnectorManager,Mn as PrivyClient,f2 as PrivyProvider,de as PrivyProxyProvider,Rn as SUPPORTED_CHAINS,ws as VERSION,ot as WalletConnector,W2 as addRpcUrlOverrideToChain,ml as errorIndicatesMaxMfaRetries,Xr as errorIndicatesMfaTimeout,en as errorIndicatesMfaVerificationFailed,_e as getAccessToken,T2 as useConnectWallet,x2 as useCreateWallet,g2 as useLogin,C2 as useLoginWithEmail,b2 as useLoginWithSms,w2 as useLogout,fn as useMfa,ai as useMfaEnrollment,k2 as useModalStatus,B as usePrivy,Bs as useRegisterMfaListener,_2 as useSetWalletPassword,I2 as useToken,ui as useWallets};
2631
+ `;import{jsx as Me,jsxs as Th}from"react/jsx-runtime";var JE={["LANDING"]:Jm,["AWAITING_PASSWORDLESS_CODE"]:Fp,["AWAITING_CONNECTION"]:tu,["AWAITING_CONNECT_ONLY_CONNECTION"]:iu,["AWAITING_FARCASTER_CONNECTION"]:um,["PHANTOM_INTERSTITIAL_SCREEN"]:lh,["LOGIN_FAILED_SCREEN"]:rf,["AWAITING_OAUTH_SCREEN"]:nh,["ALLOWLIST_REJECTION_SCREEN"]:kp,["INSTALL_PHANTOM_SCREEN"]:Sm,["LINK_EMAIL_SCREEN"]:Qm,["LINK_PHONE_SCREEN"]:Zm,["LINK_WALLET_SCREEN"]:Xm,["CONNECT_ONLY_LANDING_SCREEN"]:Zp,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Yp,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:$u,["EMBEDDED_WALLET_CREATED_SCREEN"]:mu,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:pu,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Ku,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:gu,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:yh,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:fh,["FIAT_ON_RAMP_PROMPT_SCREEN"]:vm,["FIAT_ON_RAMP_STATUS_SCREEN"]:Cm,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:ju,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:qu,["MFA_ENROLLMENT_FLOW_SCREEN"]:vf,["CAPTCHA_SCREEN"]:Vp,["ERROR_SCREEN"]:Yu,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:bm,["AFFIRMATIVE_CONSENT_SCREEN"]:_p},QE=["LANDING","AWAITING_CONNECTION"],ZE=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:o,isModalOpen:r}=H(),{headless:n}=I(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:u}=me(),h=jE(null),f=mp(h),g=r&&a&&QE.includes(a)&&!n&&l==="ready";if(Eh(()=>{g&&s()},[g]),Eh(()=>{!r&&u&&c()},[r,u]),(!o||!i)&&a!=="AWAITING_OAUTH_SCREEN")return Th(mn,{children:[Me(S,{}),Me(J,{}),Me(sf,{children:Me(vt,{})}),Me(Z,{}),Me(Y,{})]});if(!a&&e)return Me(mn,{style:{height:f},children:Me("div",{ref:h,children:Me(ac,{open:e,onClose:t})})});if(!a)return null;let C=JE[a];return Me(mn,{style:{height:f},children:Th("div",{ref:h,children:[Me(wo,{if:!!e,children:Me(C,{})}),Me(wo,{if:!e,children:Me(ac,{open:e,onClose:t})})]})})},XE=()=>{let{closePrivyModal:e}=I(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:qE(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},Ph=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:o}=XE(),[r,n]=KE(!1);Hs({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=Me(bh,{children:Me(ZE,{isMfaVerifying:r,onMfaVerificationComplete:()=>n(!1)})}),a=e||r,l=t?.render.inDialog?Me(af,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>o(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return YE.createPortal(l,s)}return l};import{useRef as e2,useEffect as t2}from"react";var fs=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;case"privy:mfa:verify":return r;case"privy:mfa:init-enrollment":return r;case"privy:mfa:submit-enrollment":return r;case"privy:mfa:unenroll":return r;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Pr(e,t,o,r,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):r.current?.reject(new Te("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((f,g)=>{o.current={resolve:f,reject:g};let C=1e3*60*5;setTimeout(()=>{let b=new Te("mfa_timeout","Timed out waiting for MFA code");r.current?.reject(b),g(b)},C)});return await e(h)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),r.current?.resolve(void 0);break}catch(h){if(h.type==="missing_or_invalid_mfa")a=!0;else throw r.current?.resolve(void 0),h}if(c===null){let u=new Te("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw r.current?.reject(u),u}return c}import{jsx as s2}from"react/jsx-runtime";var o2=function(e){return()=>`id-${e++}`}(0);function r2(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function co(e){return e.error!==void 0}var Vt=new fs,dc=new Map,n2=(e,t)=>typeof t=="bigint"?t.toString():t,i2=(e,t)=>`${e}${JSON.stringify(t,n2)}`;function po(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=i2(e,t);if(e==="privy:wallet:create"){let a=dc.get(n);if(a)return a}let i=new Promise((a,l)=>{let s=o2();Vt.enqueue(s,{resolve:a,reject:l}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{dc.delete(n)});return dc.set(n,i),i}function a2(e){switch(e.event){case"privy:iframe:ready":let t=Vt.dequeue(e.event,e.id);return co(e)?t.reject(new Te(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Vt.dequeue(e.event,e.id);return co(e)?o.reject(new Te(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Vt.dequeue(e.event,e.id);return co(e)?r.reject(new Te(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Vt.dequeue(e.event,e.id);return co(e)?n.reject(new Te(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Vt.dequeue(e.event,e.id);return co(e)?i.reject(new Te(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Vt.dequeue(e.event,e.id);return co(e)?a.reject(new Te(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Vt.dequeue(e.event,e.id);return co(e)?l.reject(new Te(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Vt.dequeue(e.event,e.id);return co(e)?s.reject(new Te(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Vt.dequeue(e.event,e.id);return co(e)?s.reject(new Te(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Vt.dequeue(e.event,e.id);return co(e)?s.reject(new Te(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function xh(e){let t=e2(null),o=yp();return t2(()=>{let r=t.current;if(!r)return;function n(c){c&&c.origin===e.origin&&r2(c.data)&&a2(c.data)}let i={create(c){return po("privy:wallet:create",c,r)},connect(c){return po("privy:wallet:connect",c,r)},recover(c){return Pr(u=>po("privy:wallet:recover",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(c){return Pr(u=>po("privy:wallet:rpc",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(c){return Pr(u=>po("privy:wallet:set-recovery-password",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(c){return Pr(u=>po("privy:mfa:verify",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(c){return Pr(u=>po("privy:mfa:init-enrollment",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(c){return po("privy:mfa:submit-enrollment",c,r)},unenrollMfa(c){return Pr(u=>po("privy:mfa:unenroll",{...c,...u},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)}};window.addEventListener("message",n);let a=()=>e.onLoad(i),l=(...c)=>{console.warn("Privy iframe failed to load: ",...c),e.onLoadFailed()},s=new AbortController;return md(()=>po("privy:iframe:ready",{},r),{abortSignal:s.signal}).then(a,l),()=>{window.removeEventListener("message",n),s.abort()}},[t.current,e.mfaMethods]),s2("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:Ii(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function pc(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(r=>t.includes(r))}var hs=class{constructor(t,o){this.meta={action:t,phoneNumber:o}}async init(){if(!this.meta.action)throw new w("action required");if(!this.api)throw new w("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new w("phone number must be set when initialzing authentication.");try{let t=zc();await this.api.post(t,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw ie(t)}}async authenticate(){if(!this.meta.action)throw new w("action required");if(!this.api)throw new w("Mfa flow has no API instance");if(!this.meta.smsCode)throw new w("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new w("phone number must be set prior to calling authenticate.");try{let t=$c(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return lt(o)}catch(t){throw ie(t)}}};import{jsx as uo,jsxs as Sh}from"react/jsx-runtime";var En;function u2(e){return typeof e=="string"&&e.length===25}function Ae(){if(!En){let e=re.get(or);return Promise.resolve(e||null)}return En.getAccessToken()}var _h,wd=(e,t)=>_h(e,t),Ah,Cd=(e,t)=>Ah(e,t),kh,bd=(e,t)=>kh(e,t),Rh,Ed=()=>Rh(),m2=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;re.put(Sn,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},f2=({config:e,...t})=>{if(!u2(t.appId))throw new w("Cannot initialize the Privy provider with an invalid Privy app ID");En||(En=new Nn({appId:t.appId,apiUrl:t.apiUrl||xi}));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."),uo(qd,{client:En,clientConfig:o,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:uo(h2,{...t,config:o,client:En})})},h2=e=>{let t=e.client,[o,r]=xe(!1),[n,i]=xe(!1),[a,l]=xe(!1),[s,c]=xe(null),[u,h]=xe(!1),[f,g]=xe([]),C=hi(f),[b,x]=xe(!1),[E,T]=xe(null),[L,R]=xe(!1),[N,O]=xe({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:P}),[W,B]=xe(null),[$,ee]=xe(null),[D,V]=xe(null),A=oa(),le=jd(),[ne,Q]=xe(!0),[_t,fe]=xe({}),[Xe,Ne]=xe(null),[oe,mo]=xe(null),[At,xr]=xe(!1),[et,Se]=xe(!1),zt=hi(null),Sr=hi(null),k=hi(fp);t.onStoreToken=d=>{d&&F(k,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{F(k,"accessToken","onAccessTokenRemoved")};let He=hi(),Tn=d2(d=>{let p=t.connectors?.walletsReady||!1;return a&&s?.linkedAccounts?.some(v=>v.type==="wallet"&&v.walletClientType==="privy")?p&&d?.some(v=>v?.walletClientType==="privy"):p},[a,s?.linkedAccounts,t?.connectors?.walletsReady]),X=d=>{T(d),setTimeout(()=>{r(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:d})},kt=d=>{A.embeddedWallets.createOnLogin!=="off"&&Q(!0),X(d)};_o(()=>{if(!D||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(D,p,A.defaultChain)}},[D,s]),_o(()=>{D&&oe?.(D)},[D]),_o(()=>{(async()=>{if(!A.customAuth?.enabled)return;Q(!0);let{getCustomAccessToken:p,isLoading:m}=A.customAuth;if(!(!n||m))try{let v=await p();if(!v){await Ar.logout();return}if(a)return;t.startAuthFlow(new Rr(v));let{user:M,isNewUser:z}=await t.authenticate();M||await Ar.logout(),c(M||null),x(z||!1),l(!0),Se(!0)}catch(v){console.warn(v),a&&await Ar.logout()}})()},[A.customAuth?.enabled,A.customAuth?.getCustomAccessToken,A.customAuth?.isLoading,n,a]),_o(()=>{et&&D&&s&&yt(s,e.config?.embeddedWallets?.createOnLogin)&&(Se(!1),gi(s,Mr).catch(console.error))},[et&&D&&s]),_o(()=>{async function d(){let p=er();m2();let m=c2();B(m),t.initializeConnectorManager(A.walletConnectCloudProjectId,A.rpcConfig,A.chains,A.defaultChain,m,A.appearance.walletList,A.shouldEnforceDefaultChainOnConnect),t.connectors?.initialize().then(()=>{_r()});let v=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!v),v&&F(k,"login","onComplete",v,!1,!0,null),c(v)),p||he.setReadyToTrue(),p&&v&&h(!0)}n||d()},[t,Xe,n]);let er=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),m=d.get("privy_oauth_state"),v=d.get("privy_oauth_provider");return p&&m&&v?(t.startAuthFlow(new Ro(v,p,m)),kt("AWAITING_OAUTH_SCREEN"),!0):!1},yi=async(d,p,m,v)=>{let M=await t.connectors?.createWalletConnector(d,p)||null;Pn(M,p,m,v)};async function Pn(d,p,m,v){if(!d)return O({status:"disconnected",connectedWallet:null,connectError:new j("Unable to connect to wallet."),connector:null,connectRetry:P}),v?.(null,m);d instanceof Qt&&p&&await d.resetConnection(p),O({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Pn(d,p,m,v)});try{let M=await d.connect({showPrompt:!0});if(A.shouldEnforceDefaultChainOnConnect&&!A.chains.find(z=>z.id===Number(M?.chainId))&&!(M?.connectorType==="wallet_connect_v2"&&M?.walletClientType==="metamask")){O(z=>({...z,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:P}));try{await M?.switchChain(A.defaultChain.id),M&&(M.chainId=Nr(ar(A.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${A.defaultChain.id}`)}}return O(z=>({...z,status:"connected",connectedWallet:M,connectError:null,connectRetry:P})),M&&!L&&F(k,"connectWallet","onSuccess",M),v?.(M,m)}catch(M){return M instanceof Le?(console.warn(M.cause?M.cause:M.message),L||F(k,"connectWallet","onError",M.privyErrorCode||"generic_connect_wallet_error")):(console.warn(M),L||F(k,"connectWallet","onError","unknown_connect_wallet_error")),O(z=>({...z,status:"disconnected",connectedWallet:null,connectError:M})),v?.(null,m)}}let Ao=async(d,p)=>{if(d===null)return;let m=new nr(d,p);t.startAuthFlow(m)},_r=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),m=d.get("privy_wallet_client");if(!p||!m)return;if(m==="phantom"&&!Io()&&kt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new w("Connector not initialized");X("AWAITING_CONNECTION");let v=new URL(window.location.href);v.searchParams.delete("privy_connector"),v.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",v),yi(p,m,void 0,Ao)};_o(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let Ge=()=>{if(!a)throw new w("User must be authenticated before linking a wallet.");h(!0),X("LINK_WALLET_SCREEN")},at=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},ht=async d=>{if(!t.connectors)throw new w("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(O(m=>({...m,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:P})),A.captchaEnabled&&!a){let m={callback:v=>Ao(d,v),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};fe({captchaModalData:m}),kt("CAPTCHA_SCREEN")}else await Ao(d),kt("AWAITING_CONNECTION")},gs=async(d,p)=>{if(!A.fiatOnRamp.enabled)throw new w("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:v}=await ym(t,d,p?.config??{},A.appearance.palette,A.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:v}}else throw new w("Unsupported fund provider. Currently supported option is `moonpay`.")},ko=()=>{g(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:at(m),loginOrLink:async()=>{if(!await m.isConnected())throw new w("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new w("Cannot link or login with embedded wallet");ht(m)},fund:async v=>{let{signedUrl:M,externalTransactionId:z}=await gs(m.address,v);fe({fiatOnRampPrompt:{signedUrl:M},fiatOnRampStatus:{externalTransactionId:z}}),X("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new w("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new w("Cannot unlink an embedded wallet");let v=await t.unlinkWallet(m.address);c(v)}}))||[];return xr(Tn(p)),Ni(d,p)?d:p})};_o(()=>{ko()},[s?.linkedAccounts,a,n]),_o(()=>{if(n){if(!t.connectors)throw new w("Connector not initialized");ko(),t.connectors.on("walletsUpdated",ko)}},[n]);let Rt=()=>{X(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};_o(()=>{if(!f[0])return;let d=f[0],p=C.current.find(v=>v.address===d.address),m;if(d.walletClientType==="privy"?m=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType==="privy"):m=s?.linkedAccounts.find(v=>v.type==="wallet"&&v.address===d.address&&v.walletClientType!=="privy"),!p&&m){let v=Object.assign({},s);v.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(v)}C.current=f},[f]);let gi=async(d,p)=>{if(de(d))throw F(k,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[v,M]=await Promise.all([he.initializeWalletProxy(p),Ae()]);if(!v&&e.config?.customAuth?.enabled)throw F(k,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!v||!M||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((z,ce)=>{Q(!0),fe({createWallet:{onSuccess:tt=>{F(k,"createWallet","onSuccess",tt),z(tt)},onFailure:tt=>{F(k,"createWallet","onError","unknown_embedded_wallet_error"),ce(tt)},callAuthOnSuccessOnClose:!1}}),X("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await v.create({accessToken:M});let z=await he.refreshUser(),ce=de(z);if(!ce)throw F(k,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return F(k,"createWallet","onSuccess",ce),ce}},Mh=d=>{if(!A.chains.map(p=>p.id).includes(d))throw new j(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},mc=(d,p,m)=>new Promise(async(v,M)=>{if(!a||!s){F(k,"sendTransaction","onError","must_be_authenticated"),M(new Error("User must be authenticated before signing with a Privy wallet"));return}let z=de(s);if(!z){F(k,"sendTransaction","onError","embedded_wallet_not_found"),M(new Error("Must have a Privy wallet before signing"));return}Q(!0);let ce=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ve=d.chainId?Number(d.chainId):ce.chainId;Mh(Ve);let tt=Object.assign({},d,{chainId:Ve}),fo=async()=>{let ze=await Ae();if(!ze||!D){F(k,"sendTransaction","onError","embedded_wallet_not_found"),M(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await he.recoverEmbeddedWallet()){F(k,"sendTransaction","onError","unknown_connect_wallet_error"),M(new Error("Unable to connect to wallet"));return}let ho=new l2(Nt(tt.chainId,A.chains,A.rpcConfig)),Lh=await vn(z.address,tt,ho),yc=await ss(ze,z.address,D,Lh,ho);F(k,"sendTransaction","onSuccess",yc),v(yc)}catch(It){F(k,"sendTransaction","onError","transaction_failure"),M(It)}};if(A.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),fo();else{let ze={transactionRequest:tt,onSuccess:ho=>{F(k,"sendTransaction","onSuccess",ho),v(ho)},onFailure:ho=>{F(k,"sendTransaction","onError","transaction_failure"),M(ho)},uiOptions:p||{},fundWalletConfig:m},It={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:ho=>{F(k,"sendTransaction","onError","unknown_connect_wallet_error"),M(ho)}};fe({connectWallet:It,sendTransaction:ze}),X("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function fc(){return new Promise(async(d,p)=>{let m=await Ae();if(!m||!D)throw new Error("Must have valid access token to enroll in MFA");try{await D.verifyMfa({accessToken:m}),d()}catch(v){p(v)}})}let Ar={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Rt,linkWallet:Ge,linkEmail:()=>{if(!a)throw new w("User must be authenticated before linking an email address.");if(s?.email)throw new w("User already has an email linked to their account.");h(!0),X("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(!a)throw new w("User must be authenticated before linking a phone number.");if(s?.phone)throw new w("User already has a phone number linked to their account.");h(!0),X("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(!a)throw new w("User must be authenticated before linking a Google account.");if(s?.google)throw new w("User already has a Google account linked to their account.");await he.initLoginWithOAuth("google")},linkTwitter:async()=>{if(!a)throw new w("User must be authenticated before linking a Twitter account.");if(s?.twitter)throw new w("User already has a Twitter account linked to their account.");await he.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(!a)throw new w("User must be authenticated before linking a Discord account.");if(s?.discord)throw new w("User already has a Discord account linked to their account.");await he.initLoginWithOAuth("discord")},linkGithub:async()=>{if(!a)throw new w("User must be authenticated before linking a GitHub account.");if(s?.github)throw new w("User already has a Github account linked to their account.");await he.initLoginWithOAuth("github")},linkTiktok:async()=>{if(!a)throw new w("User must be authenticated before linking a TikTok account.");if(s?.tiktok)throw new w("User already has a Tiktok account linked to their account.");await he.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(!a)throw new w("User must be authenticated before linking a LinkedIn account.");if(s?.linkedin)throw new w("User already has a LinkedIn account linked to their account.");await he.initLoginWithOAuth("linkedin")},linkApple:async()=>{if(!a)throw new w("User must be authenticated before linking an Apple account.");await he.initLoginWithOAuth("apple")},linkFarcaster:async()=>{if(!a)throw new w("User must be authenticated before linking a Farcaster account.");await he.initLoginWithFarcaster(),h(!0),X("AWAITING_FARCASTER_CONNECTION")},login:async()=>{if(n||(await new Promise(d=>{Ne(()=>d)}),Ne(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}R(!0),kt("LANDING")},logout:async()=>{await t.logout(),c(null),l(!1),T(null),F(k,"logout","onSuccess"),h(!1),r(!1),re.del(_n)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new pe;let d=f.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(v=>v.address===d?.address));return!d||!p?new pe:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new uc(new Kt(new pe));let d=f.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(v=>v.address===d?.address));return!d||!p?new uc(new Kt(new pe)):new uc(new Kt(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new No(new pe);let d=f.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(v=>v.address===d?.address));return!d||!p?new No(new pe):new No(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},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},setActiveWallet:async d=>{let p=f.find(v=>ys(v.address)===ys(d)),m=s?.linkedAccounts.find(v=>v.type==="wallet"&&ys(v.address)===ys(d));if(!p||!await p.isConnected())ee(d),Ge();else if(!p.linked)p.loginOrLink();else{let v=Object.assign({},s);v.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(v)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw F(k,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return gi(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw F(k,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=de(s);if(!d||!D)throw F(k,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw F(k,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await fc()}catch(p){throw F(k,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{Q(!0);let v={onSuccess:z=>{F(k,"setWalletPassword","onSuccess",z),p(z)},onFailure:z=>{F(k,"setWalletPassword","onError","user_exited_set_password_flow"),m(z)},callAuthOnSuccessOnClose:!1},M={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:z=>{F(k,"setWalletPassword","onError","unknown_connect_wallet_error"),m(z)}};fe({setWalletPassword:v,connectWallet:M}),X("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(m,v)=>{if(!a||!s){F(k,"signMessage","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let M=de(s);if(!M){F(k,"signMessage","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){F(k,"signMessage","onError","invalid_message"),v(new Error("Message must be a non-empty string"));return}Q(!0);let z=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let ce=await Ae();if(!D||!ce)throw new Error("Unable to connect to wallet");if(!await he.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:M.address});let{response:tt}=await D.rpc({accessToken:ce,address:M.address,request:{method:"personal_sign",params:[d,M.address]}}),fo=tt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:M.address}),fo};if(A.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ce=await z();F(k,"signMessage","onSuccess",ce),m(ce)}catch(ce){F(k,"signMessage","onError","unable_to_sign"),v(ce??new Oe("Unable to sign message"))}}else{let tt={method:"personal_sign",data:d,confirmAndSign:z,onSuccess:ze=>{F(k,"signMessage","onSuccess",ze),m(ze)},onFailure:ze=>{F(k,"signMessage","onError","unable_to_sign"),v(ze)},uiOptions:p||{}},fo={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:ze=>{F(k,"signMessage","onError","unknown_connect_wallet_error"),v(ze)}};fe({signMessage:tt,connectWallet:fo}),X("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,v)=>{if(!a||!s){F(k,"signTypedData","onError","must_be_authenticated"),v(new Error("User must be authenticated before signing with a Privy wallet"));return}let M=de(s);if(!M){F(k,"signTypedData","onError","embedded_wallet_not_found"),v(new Error("Must have a Privy wallet before signing"));return}Q(!0);let z=Wi(d),ce=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Ve=await Ae();if(!D||!Ve)throw new Error("Unable to connect to wallet");if(!await he.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:M.address});let{response:fo}=await D.rpc({accessToken:Ve,address:M.address,request:{method:"eth_signTypedData_v4",params:[M.address,z]}}),ze=fo.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:M.address}),ze};if(A.embeddedWallets.noPromptOnSignature||(A.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Ve=await ce();F(k,"signTypedData","onSuccess",Ve),m(Ve)}catch(Ve){F(k,"signTypedData","onError","unable_to_sign"),v(Ve??new Oe("Unable to sign message"))}}else{let fo={method:"eth_signTypedData_v4",data:z,confirmAndSign:ce,onSuccess:It=>{F(k,"signTypedData","onSuccess",It),m(It)},onFailure:It=>{F(k,"signTypedData","onError","unable_to_sign"),v(It)},uiOptions:p||{}},ze={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:It=>{F(k,"signMessage","onError","unknown_connect_wallet_error"),v(It)}};fe({signMessage:fo,connectWallet:ze}),X("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let M=await(await mc(d,p,m)).wait();return cs(M)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=de(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}Q(!0);let v={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},M=await Ae();if(!M||!D){p(new Error("Must have valid access token to enroll in MFA"));return}if(!D){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await D.connect({accessToken:M,address:m.address}),await D.verifyMfa({accessToken:M})}catch(ce){if(mr(ce))await he.recoverEmbeddedWallet();else throw ce}}catch(ce){p(ce);return}let z={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};fe({keyExport:z,connectWallet:v}),X("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:fc,async init(d){let p;switch(d){case"sms":p=new hs("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}t.startMfaFlow(p),await p.init()},async submit(d,p){switch(d){case"totp":case"sms":zt.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((m,v)=>{Sr.current={resolve:m,reject:v}});break;default:throw zt.current?.reject(new w("Unsupported MFA method")),new w(`Unsupported MFA method: ${d}`)}},cancel(){zt.current?.reject(new w("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Ae();if(!p||!D)throw new Error("Must have valid access token to enroll in MFA");await D.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){he.closePrivyModal(),p();return}A.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),fe({mfaEnrollmentFlow:{mfaMethods:A.mfa.methods,onSuccess:p,onFailure:m}}),X("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Ae();if(!d||!D)throw new Error("Must have valid access token to enroll in MFA");let p=await D.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Ae();if(!p||!D)throw new Error("Must have valid access token to enroll in MFA");await D.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await Ae();if(!p||!D)throw new Error("Must have valid access token to enroll in MFA");await D.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await Ae();if(!p||!D)throw new Error("Must have valid access token to remove MFA");await D.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},loginWithCode(d){return he.loginWithCode(d)},initLoginWithEmail(d){return he.initLoginWithEmail(d)},initLoginWithSms(d){return he.initLoginWithSms(d)},isModalOpen:o};_h=Ar.signMessage,Ah=Ar.signTypedData,kh=async(...d)=>{let p=await mc(...d);return A.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let hc=!!e.config?.headless,he=(()=>({headless:hc,isNewUserThisSession:b,isLinking:u,linkingHint:$,pendingTransaction:null,walletConnectionStatus:N,mipdStore:W,connectors:t.connectors?.walletConnectors??[],rpcConfig:A.rpcConfig,chains:A.chains,showFiatPrices:A.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>A.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(D)return D;let p=new Promise(M=>{mo(()=>z=>M(z))}),m=new Promise(M=>setTimeout(()=>M(null),d)),v=await Promise.race([p,m]);return mo(null),v},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(F(k,"login","onComplete",s,b,!1,He.current??null),e.onSuccess?.(s,b)):L&&F(k,"login","onError","exited_auth_flow"),ee(null),R(!1),h(!1),x(!1),r(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:X,connectWallet:Pn,initLoginWithWallet:async(d,p)=>{He.current="siwe",Ao(d,p)},loginWithWallet:async()=>{if(!n)throw new kr;if(!(t.authFlow instanceof nr))throw new w("Must initialize SIWE flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(m){throw F(k,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||s||null),x(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new xn(d);t.startAuthFlow(p);try{He.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw F(k,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new kr;if(!(t.authFlow instanceof xn))throw new w("Must initialize Farcaster flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(m){throw F(k,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||null),x(p||!1),l(!0)},initLoginWithOAuth:async(d,p)=>{if(ad()){if(d==="google"&&pc(window.navigator.userAgent)){kt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{kt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let m=new Ro(d);p&&m.addCaptchaToken(p),t.startAuthFlow(m);let v=await t.authFlow.getAuthorizationUrl();v&&v.url&&window.location.assign(v.url)},loginWithOAuth:async d=>{if(!(t.authFlow instanceof Ro))throw new w("Must initialize OAuth flow before calling loginWithOAuth");let p=Wt.get(Ir),m=t.authFlow.meta.stateCode;if(p!==m)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d,storedStateCode:p??"",returnedStateCode:m??""}),new w("Unexpected auth flow. This may be a phishing attempt.");let v,M;if(a)v=await t.link();else try{({user:v,isNewUser:M}=await t.authenticate()),He.current=d}catch(z){throw F(k,"login","onError",z.privyErrorCode||"unknown_auth_error"),z}c(v),x(M||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let m=new tr(d,p);t.startAuthFlow(m);try{He.current="email",await m.sendCodeEmail()}catch(v){throw F(k,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}},initLoginWithSms:async(d,p)=>{let m=new ir(d,p);t.startAuthFlow(m);try{He.current="sms",await m.sendSmsCode()}catch(v){throw F(k,"login","onError",v.privyErrorCode||"unknown_auth_error"),v}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new kr;if(t.authFlow instanceof tr)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof ir)t.authFlow.meta.smsCode=d.trim();else throw new w("Must initialize a passwordless code flow first");let p,m;a?p=await t.link():{user:p,isNewUser:m}=await t.authenticate(),c(p||s||null),x(m||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:D,createAnalyticsEvent:(d,p,m)=>t.createAnalyticsEvent(d,p,m),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let m=s?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy"),v=await Ae();if(!v||!D||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Q(!0);try{await D.connect({accessToken:v,address:m.address}),d(!0)}catch(M){mr(M)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await D.recover({address:m.address,accessToken:v})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),d(!0)):mr(M)?(fe({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)}}),X("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(M)}}),getFiatOnRampConfig:gs,setReadyToTrue:()=>{i(!0),Xe?.()},updateWallets:()=>ko()}))();Rh=he.recoverEmbeddedWallet;let Nh=p2(()=>({wallets:f,ready:At}),[f,At]);return uo(ae.Provider,{value:Ar,children:uo(Bs.Provider,{value:k,children:uo(oc.Provider,{value:Nh,children:Sh(pp,{...A,children:[e.children,Sh(Fs.Provider,{value:he,children:[!hc&&A.captchaEnabled&&n&&!a&&uo(Us,{delayedExecution:!1}),uo(Ch,{theme:{...A.appearance.palette||{}}}),uo(Yd,{data:_t,setModalData:fe,setInitialScreen:T,initialScreen:E,authenticated:a,open:o,children:uo(Ph,{open:o})}),ne&&le?uo(xh,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:zt,mfaSubmitPromise:Sr,onLoad:V,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as y2}from"react";function g2(e){let{login:t}=y2(ae);return be("login",e),{login:t}}import{useContext as v2}from"react";function w2(e){let{logout:t}=v2(ae);return be("logout",e),{logout:t}}import{useCallback as Ih}from"react";var C2=()=>{let e=me(),{initLoginWithEmail:t,loginWithCode:o}=H(),r=Ih(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return e.status==="disabled",t(i)},[t]),n=Ih(async({code:i})=>{if(e.enabled&&e.status==="error")throw new vo(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};import{useCallback as Wh}from"react";var b2=()=>{let e=me(),{initLoginWithSms:t,loginWithCode:o}=H(),r=Wh(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return e.status==="disabled",t(i)},[t]),n=Wh(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new vo(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};import{useContext as E2}from"react";function T2(e){let{connectWallet:t}=E2(ae);return be("connectWallet",e),{connectWallet:t}}import{useContext as P2}from"react";function x2(e){let{createWallet:t}=P2(ae);return be("createWallet",e),{createWallet:t}}import{useContext as S2}from"react";function _2(e){let{sendTransaction:t}=S2(ae);return be("sendTransaction",e),{sendTransaction:t}}import{useContext as A2}from"react";function k2(e){let{setWalletPassword:t}=A2(ae);return be("setWalletPassword",e),{setWalletPassword:t}}import{useContext as R2}from"react";function I2(e){let{signMessage:t}=R2(ae);return be("signMessage",e),{signMessage:t}}import{useContext as W2}from"react";function M2(e){let{signTypedData:t}=W2(ae);return be("signTypedData",e),{signTypedData:t}}import{useContext as N2}from"react";var L2=()=>{let{isModalOpen:e}=N2(ae);return{isOpen:e}};import{useContext as O2}from"react";function D2(e){let{getAccessToken:t}=O2(ae);return be("accessToken",e),{getAccessToken:t}}function U2(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{Kt as AsExternalProvider,Us as Captcha,Mn as ConnectorManager,Nn as PrivyClient,f2 as PrivyProvider,pe as PrivyProxyProvider,In as SUPPORTED_CHAINS,Cs as VERSION,nt as WalletConnector,U2 as addRpcUrlOverrideToChain,fl as errorIndicatesMaxMfaRetries,en as errorIndicatesMfaTimeout,tn as errorIndicatesMfaVerificationFailed,Ae as getAccessToken,T2 as useConnectWallet,x2 as useCreateWallet,g2 as useLogin,C2 as useLoginWithEmail,b2 as useLoginWithSms,w2 as useLogout,hn as useMfa,si as useMfaEnrollment,L2 as useModalStatus,H as usePrivy,Hs as useRegisterMfaListener,_2 as useSendTransaction,k2 as useSetWalletPassword,I2 as useSignMessage,M2 as useSignTypedData,D2 as useToken,mi as useWallets};