@privy-io/react-auth 1.57.0 → 1.58.0-beta-20240226175037
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 +226 -226
- package/dist/index.js +221 -221
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ys=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var fc=(e,t,o)=>(ys(e,t,"read from private field"),o?o.call(e):t.get(e)),yi=(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)},gs=(e,t,o,r)=>(ys(e,t,"write to private field"),r?r.call(e,o):t.set(e,o),o);var hc=(e,t,o)=>(ys(e,t,"access private method"),o);import{getAddress as fs}from"@ethersproject/address";import{StaticJsonRpcProvider as ZE,Web3Provider as sc}from"@ethersproject/providers";import{createStore as XE}from"mipd";import{useCallback as e2,useEffect as uo,useMemo as t2,useRef as fi,useState as Te}from"react";import{FetchError as Rh}from"ofetch";var De=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 De{constructor(o,r,n,i,a){super(n,i,a);this.type=o;this.status=r}},v=class extends De{constructor(o,r,n){super(o,r,n);this.type="client_error"}},gi=class extends v{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var q=class extends De{constructor(o,r,n){super(o,r,n);this.type="connector_error"}},ie=e=>{if(e instanceof De)return e;if(!(e instanceof Rh))return Ve(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)},Ve=e=>e instanceof De?e:e instanceof Error?new v(e.message,e):new v(`Internal error: ${e}`);var Ar=class extends v{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},lt=class extends v{constructor(t="Embedded wallet error",o){super(t,o,"unknown_embedded_wallet_error")}},vi=class extends v{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var wi=()=>"/api/v1/sessions",Ci=()=>"/api/v1/sessions/logout",yc=()=>"/api/v1/sessions/fork",bi=()=>"/api/v1/sessions/fork/recover",gc=()=>"/api/v1/siwe/init",vc=()=>"/api/v1/siwe/authenticate",wc=()=>"/api/v1/siwe/link",Cc=()=>"/api/v1/farcaster/init",bc=()=>"/api/v1/farcaster/authenticate",Ec=()=>"/api/v1/farcaster/link",Tc=()=>"/api/v1/farcaster/status",Pc=()=>"/api/v1/passwordless/init",xc=()=>"/api/v1/passwordless/authenticate",Sc=()=>"/api/v1/passwordless/link",_c=()=>"/api/v1/passwordless_sms/init",Ac=()=>"/api/v1/passwordless_sms/authenticate",kc=()=>"/api/v1/passwordless_sms/link",Rc=()=>"/api/v1/oauth/init",Ic=()=>"/api/v1/oauth/authenticate",Wc=()=>"/api/v1/oauth/link",Mc=()=>"/api/v1/siwe/unlink",Nc=()=>"/api/v1/passwordless/unlink",Lc=()=>"/api/v1/passwordless_sms/unlink",Oc=()=>"/api/v1/oauth/unlink",Dc=()=>"/api/v1/farcaster/unlink",Uc=()=>"/api/v1/analytics_events",Fc=()=>"/api/v1/plugins/moonpay_on_ramp/sign",Bc=()=>"/api/v1/custom_jwt_account/authenticate",Hc=()=>"/api/v1/mfa/passwordless_sms/init";var Gc=()=>"/api/v1/mfa/passwordless_sms/enroll";var Vc=()=>"/api/v1/users/me/accept_terms";var kr=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new v("Auth flow has no API instance");try{let t=Bc(),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 v("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new v("Email and email code must be set prior to calling authenticate.");try{let t=xc(),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 v("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new v("Email and email code must be set prior to calling authenticate.");try{let t=Sc();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 v("Auth flow has no API instance");if(t&&(this.meta.email=t),o&&(this.meta.captchaToken=o),!this.meta.email)throw new v("Email must be set when initialzing authentication.");try{let r=Pc();return await this.api.post(r,{email:this.meta.email,token:this.meta.captchaToken})}catch(r){throw ie(r)}}};import{isMobile as Ih}from"react-device-detect";var ze=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 ze(this._startChannelOnce.bind(this)),this.pollForReady=new ze(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.channelToken)throw new v("Auth flow must be initialized first");try{let t=await this.api.post(bc(),{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new v("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 v("Auth flow has no API instance");try{return await this.api.post(Ec(),{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 v("Auth flow has no API instance");let t=await this.api.post(Cc(),{token:this.captchaToken});Ih&&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 v("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.channelToken)throw new v("Auth flow must be initialized first");let t=await this.api.get(Tc(),{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 nd}from"jose";var zc="1.57.0";var Ei="4df5e2316331463a9130964bd6078dfa",$c="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",qc="34357d3c125c2bcf2ce2bc3309d98715",Ti="https://auth.privy.io",jc=2e4,$e=1400,Kc=2500,vs=zc;var or="privy:token",ws="privy-token",Pi="privy:refresh_token",Cs="privy-refresh-token",xi="privy-session",xn="privy:session_transfer_token",Mh="privy:wallet",Sn="privy:caid",Rr="privy:state_code",Ir="privy:code_verifier",Si=e=>`${Mh}:${e}`,bs="privy:connectors",Es="privy:connections";var rr=12e4,ho=1,Ts="0x1",Wr=3e4,Yc="https://api.moonpay.com/v1",Jc="https://api.moonpay.com/v1",Qc="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Zc="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Xc="0x420000000000000000000000000000000000000F",ed=["function getL1Fee(bytes memory _data) external view returns (uint256)"];async function td(e){let t=new TextEncoder().encode(e),o=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(o)}function od(e){return crypto.getRandomValues(new Uint8Array(e))}var _i=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)}},Ps=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)}},xs=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 rd(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function Nh(){return typeof window<"u"&&window.localStorage?new Ps:new _i}function Lh(){return typeof window<"u"&&window.sessionStorage?new xs:new _i}var It=Lh(),oe=Nh();var Oh="S256",Dh="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 v("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new v("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new v("User denied confirmation during OAuth flow");let t=It.get(Ir);if(!t)throw new v("Authentication error.");try{let o=Ic(),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 v(r.message||"Invalid code during OAuth flow.",void 0,r.privyErrorCode):r.message==="User denied confirmation during OAuth flow"?new v("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new v("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new v("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new v("User denied confirmation during OAuth flow");let t=It.get(Ir);if(!t)throw new v("Authentication error.");try{let o=Wc(),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 nd.encode(od(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,o=Oh){if(o==Dh){let r=await td(t);return nd.encode(r)}else return t}async getAuthorizationUrl(){if(!this.api)throw new v("Auth flow has no API instance");if(!this.meta.provider)throw new v("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=Rc();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:
|
|
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.58.0-beta-20240226175037";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:
|
|
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 ze(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 v("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(vc(),{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 v("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(wc(),{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 v("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new v("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 v("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(gc(),{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new v("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 v("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new v("phone number and sms code must be set prior to calling authenticate.");try{let t=Ac(),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 v("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new v("phone number and sms code must be set prior to calling authenticate.");try{let t=kc();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 v("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new v("phone nNumber must be set when initialzing authentication.");try{let r=_c();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw ie(r)}}};import{v4 as vy}from"uuid";function et(e){return new Date(e*1e3)}function Uh(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 pe=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,Fh=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),vt=(e,t)=>t==="all-users"&&!pe(e)||t==="users-without-wallets"&&!Fh(e)?.length;function ct(e){if(!e)return null;let t=Uh(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 Od}from"@ethersproject/address";import fy from"eventemitter3";function id(){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 Ai=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 Ss=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ai(e)!=="MetaMask")return!1;if(e.providers){for(let o of e.providers)if(!Ss(o))return!1}return!0},Io=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ad=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var sd=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,}))$/),ld=(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}`},_s=e=>new Promise(t=>setTimeout(t,e));function cd(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 dd=(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 _s(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},ki=(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 As=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 pd(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 id()){let u=Ai(c);if(!l.some(h=>h.info.name===u)){if(Ss(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]+"/"+Ei:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+$c:i=n.rpcUrls.default?.http[0],!i)throw new q(`No RPC url found for ${e}`);return i},ud=(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},Ri=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 Yh from"@coinbase/wallet-sdk";import{jsx as md,jsxs as Bh}from"react/jsx-runtime";var _n=({style:e,...t})=>Bh("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:[md("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),md("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 Cd}from"@ethersproject/providers";import{default as jh}from"eventemitter3";import{StaticJsonRpcProvider as hd}from"@ethersproject/providers";import qh from"eventemitter3";var Hh=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],fd=e=>Hh.includes(e);import{ErrorCode as Gh}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 Ue(e);return e.code===Gh.ACTION_REJECTED&&(t.details=tt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new Ue(e):new q("Unknown connector error",e)},jt=class extends De{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Ue=class extends jt{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))}},Vh={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}},zh={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}},$h={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},...$h,...zh},yo={...Vh,...tt};var ue=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||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 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)})}},Mo=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},Ii=class extends qh{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 hd(Mt(a,this.chains,n)),this.rpcTimeoutDuration=Or(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 Ie()||!this.address)throw new Mo("Disconnected",4900);return(await vd(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 hd(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 yd(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 gd(Ri(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(fd(o.method)){let r=await Ie();if(await wd(),!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 Ie();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 ue{constructor(o){super(o,o.rpcTimeoutDuration)}},No=class extends ue{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 Kh=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},ot=class extends jh{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"&&oe.put(Si(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=>Yt(a.address)===Yt(o));return{address:Yt(o),chainId:r,meta:n,switchChain:async a=>{if(!i)throw new q("Wallet is not currently connected.");let l=this.wallets.find(f=>Yt(f.address)===Yt(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(Kh(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 Cd(new Kt(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new q("Wallet is not currently connected.");return new No(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=Yt(n),a=[],l;if(this.walletClientType==="privy"){let c=oe.get(Si(i));this.chains.find(u=>u.id===Number(c))||(oe.del(Si(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 ${Ts}`,c),l=Ts}let s=Mr(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))}Wi(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 Cd(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 Jh=e=>{let t=`https://mainnet.infura.io/v3/${Ei}`,o=1;return e.makeWeb3Provider(t,o)},Mi,Ni=class extends ot{constructor(o,r,n){super("coinbase_wallet",o,r,n);this.connectorType="coinbase_wallet";this.proxyProvider=new ue(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),Mi||(Mi=new Yh({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(Jh(Mi)),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(){Mi.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 bd}from"react/jsx-runtime";var Li=({...e})=>bd("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:bd("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 Oi=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:[ar(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Li,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};import{jsx as Ed}from"react/jsx-runtime";var Dr=({style:e,...t})=>Ed("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:Ed("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 dt,jsxs as Qh}from"react/jsx-runtime";var Ur=({style:e,...t})=>Qh("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:[dt("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),dt("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),dt("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"}),dt("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"}),dt("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"}),dt("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"}),dt("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"}),dt("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"}),dt("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"}),dt("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"}),dt("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"}),dt("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"}),dt("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 Td,jsxs as Zh}from"react/jsx-runtime";var Jt=({style:e,...t})=>Zh("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:[Td("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),Td("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 ue(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";yi(this,Fr,void 0);this.proxyProvider=new ue(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0}),a==="metamask"?gs(this,Fr,{name:"MetaMask",icon:Ur,id:"io.metamask"}):a==="phantom"&&gs(this,Fr,{name:"Phantom",icon:Jt,id:"phantom"})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return fc(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 gT}from"@ethersproject/address";import{Web3Provider as wT}from"@ethersproject/providers";import{isMobile as Xh}from"react-device-detect";var Di=class extends Br{disconnect(){console.warn("Metamask does not support programmatic disconnect.")}async promptConnection(){try{Xh||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 Ui=class extends ot{constructor(o,r){super(o,[],r,{});this.connectorType="null";this.proxyProvider=new ue(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 Fi=class extends Ui{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:Jt,id:"phantom"}}};import{EthereumProvider as dy,OPTIONAL_EVENTS as py,OPTIONAL_METHODS as uy}from"@walletconnect/ethereum-provider";import{isMobile as my}from"react-device-detect";import{createContext as ty,useContext as oy,useEffect as ks,useRef as ry,useState as ny}from"react";import{jsx as ey}from"react/jsx-runtime";function Bi({src:e,...t}){return ey("img",{src:e,...t,style:{display:"none"}})}var P=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import{jsx as ay,jsxs as sy}from"react/jsx-runtime";var Pd=ty({ready:!1,app:null,currentScreen:null,lastScreen:null,navigate:P,navigateBack:P,resetNavigation:P,setModalData:P,onUserCloseViaDialogOrKeybindRef:void 0}),iy=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],xd=e=>{let t=e.appConfig,o=e.authenticated,[r,n]=ny(e.initialScreen);ks(()=>{!o&&!iy.includes(e.initialScreen)&&e.setInitialScreen(null)},[o]);let i=ry(null);ks(()=>{e.open||(i.current=null)},[e.open]),ks(()=>{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 sy(Pd.Provider,{value:a,children:[(typeof t?.appearance?.logo=="string"||t?.appearance?.logo?.type==="img")&&ay(Bi,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>oy(Pd);import{jsx as Gr,jsxs as ly}from"react/jsx-runtime";var An=({style:e,...t})=>{let{app:o}=_();return ly("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 Hi=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 cy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var Sd=e=>e in Vr,_d=e=>{let t=Vr[e].mobile;if("native"in t)return t.native};function Ad(e,t){let o=cy(t);if(o.deepLink)return Md(o.deepLink,e);if(o.universalLink)return Nd(o.universalLink,e);throw new v(`Unsupported wallet ${t.id}`)}var kd="WALLETCONNECT_DEEPLINK_CHOICE";function Rd(){try{localStorage.removeItem(kd)}catch{}}function Id({href:e,name:t}){try{localStorage.setItem(kd,JSON.stringify({href:e,name:t}))}catch{}}function Wd(e){return e.startsWith("http://")||e.startsWith("https://")}function Md(e,t){if(Wd(e))return Nd(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 Nd(e,t){if(!Wd(e))return Md(e,t);let o=e;o.endsWith("/")||(o=`${o}/`);let r=encodeURIComponent(t);return{redirect:`${o}wc?uri=${r}`,href:o}}function Ld(e,t){window.open(e,t,"noreferrer noopener")}var Qt=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 ue(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=Hi(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:As(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||An,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,Rd(),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=Hi(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 dy.init({projectId:this.walletConnectCloudProjectId,chains:r,optionalChains:n,optionalEvents:py,optionalMethods:uy,rpcMap:o,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),my&&this.walletEntry){let{redirect:l,href:s}=Ad(a,this.walletEntry);Id({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Ld(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=Hi(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 Rs=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===Od(t)).length:!1},Or=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||rr:rr,kn=class extends fy{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 ue: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;oe.get(bs)&&(oe.getKeys().forEach(r=>{r.startsWith("walletconnect")&&oe.del(r)}),oe.del(bs));let o=pd(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 Ii(o,r,this.rpcConfig,this.chains,n.id),l=new Oi(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 Di(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 Ni(this.chains,this.defaultChain,this.rpcConfig):o==="phantom"?new Fi(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=oe.get(Es);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}));oe.put(Es,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=Od(o),this.emit("walletsUpdated")}};function Wi(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 hy}from"ofetch";var yy=[wi(),bi(),Ci()],Gi=class{constructor(t,o,r){this.appId=t,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=vs,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=hy.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=!yy.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 gi}})}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 Dd(e){return e instanceof tr?"email":e instanceof ir?"sms":e instanceof nr?"siwe":e instanceof kr?"custom_auth":e instanceof Ro?e.meta.provider:null}import*as Ud from"jose";var Zt=class{static parse(t){try{return new Zt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Ud.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 gy=30,Vi=class{constructor(){this.authenticateOnce=new ze(async t=>this._authenticate(t)),this.linkOnce=new ze(async t=>this._link(t)),this.refreshOnce=new ze(this._refresh.bind(this)),this.destroyOnce=new ze(this._destroy.bind(this)),this.forkSessionOnce=new ze(this._forkSession.bind(this))}get token(){try{let t=oe.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=oe.get(Pi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=oe.get(xn);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=sr.get(xi);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(gy)}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=Dd(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:ct(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),Ve(o)}}async _link(t){try{let o=await t.link();return ct(o)}catch(o){throw console.warn("Error linking account"),Ve(o)}}async _refresh(){if(!this.api)throw new v("Session has no API instance");if(!this.client)throw new v("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(wi(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(bi(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),ct(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 Ve(n)}}async _destroy(){try{await this.api?.post(Ci(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new v("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(yc(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw Ve(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let o=oe.get(or);if(oe.put(or,t),o!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let r=Zt.parse(t)?.expiration;sr.set(ws,t,{sameSite:"Strict",secure:!0,expires:r?new Date(r*1e3):void 0})}}else oe.del(or),sr.remove(ws)}storeRefreshToken(t){typeof t=="string"?(oe.put(Pi,t),this.client?.useServerCookies||(sr.set(xi,"t",{sameSite:"Strict",secure:!0,expires:30}),sr.set(Cs,t,{sameSite:"Strict",secure:!0,expires:30}))):(oe.del(Pi),sr.remove(Cs),sr.remove(xi))}clearForkedToken(){oe.del(xn)}};var Is,zi,Fd,Rn=class{constructor(t){yi(this,zi);this.apiUrl=t.apiUrl||Ti,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||jc,this.appId=t.appId,this.clientAnalyticsId=hc(this,zi,Fd).call(this),Is||(Is=new Vi),this.session=Is,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r,n,i,a,l){this.connectors||(this.connectors=new kn(t,o,r,n,i,a,l))}generateApi(){let t=new Gi(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 v("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new v("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(Nc(),{address:t});return ct(o)}catch(o){throw Ve(o)}}async acceptTerms(){try{let t=await this.api.post(Vc(),{});return ct(t)}catch(t){throw Ve(t)}}async unlinkPhone(t){try{let o=await this.api.post(Lc(),{phoneNumber:t});return ct(o)}catch(o){throw Ve(o)}}async unlinkWallet(t){try{let o=await this.api.post(Mc(),{address:t});return ct(o)}catch(o){throw Ve(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(Oc(),{provider:t,subject:o});return ct(r)}catch(r){throw Ve(r)}}async unlinkFarcaster(t){try{let o=await this.api.post(Dc(),{fid:t});return ct(o)}catch(o){throw Ve(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(Uc(),{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(Fc(),t)}catch(o){throw Ve(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 Ve(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()}};zi=new WeakSet,Fd=function(){if(typeof window>"u")return null;try{let o=oe.get(Sn);if(typeof o=="string"&&o.length>0)return o}catch{}let t=vy();try{return oe.put(Sn,t),t}catch{return t}};import{Turnstile as Py}from"@marsidev/react-turnstile";import{useEffect as xy,useMemo as Sy}from"react";import{useMemo as wy,useRef as Cy,useContext as by,useState as Ws,createContext as Ey}from"react";import{jsx as Ty}from"react/jsx-runtime";var Bd=Ey({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}),go=class extends De{constructor(o,r,n){super(o||"Captcha failed");this.type="Captcha";r instanceof Error&&(this.cause=r),this.privyErrorCode=n}},Hd=({children:e,id:t,captchaSiteKey:o,captchaEnabled:r})=>{let n=Cy(null),[i,a]=Ws(),[l,s]=Ws(),[c,u]=Ws(!1),h=wy(()=>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 Ty(Bd.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 cd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new go("Captcha failed",null,"captcha_timeout")}}},children:e})},fe=()=>by(Bd);import{jsx as Gd}from"react/jsx-runtime";var Ms=e=>{let{enabled:t,siteKey:o,appId:r,setError:n,setToken:i,setExecuting:a,ref:l}=fe(),[,s]=Sy(()=>o?.split("t:")||[],[o]);if(xy(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return Gd("div",{className:"hidden h-0 w-0",children:Gd(Py,{...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 AE,useEffect as Zf,useRef as kE,useState as RE}from"react";import IE from"react-dom";import{createContext as _y,useContext as Ay}from"react";var Ns=_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}),k=()=>Ay(Ns);import{createContext as ky,useContext as Ry}from"react";var ge=ky({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}),F=()=>Ry(ge);import{useEffect as Iy,useState as Wy}from"react";var Vd=e=>{let[t,o]=Wy("auto");return Iy(()=>{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 My,useContext as Ny,useEffect as Ly}from"react";var zd={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},Ls=My(void 0),$d=()=>Ny(Ls);function rt(e,t){if(!t)return;let r=$d().current[e];return Ly(()=>{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 ee(e,t,o,...r){for(let n of e.current[t][o])n(...r)}function qd(){let e=$d();return(t,o,...r)=>ee(e,t,o,...r)}function Os(e){rt("configureMfa",e)}import op from"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import Jy from"@heroicons/react/24/solid/DocumentCheckIcon";import Qy from"styled-components";import cr,{css as Bs}from"styled-components";import Us from"styled-components";import{Fragment as Dy,jsx as Ds,jsxs as Uy}from"react/jsx-runtime";var Lo=({success:e,fail:t})=>Uy(Dy,{children:[Ds(wt,{className:e?"success":t?"fail":""}),Ds(Fs,{className:e?"success":t?"fail":""})]}),wt=Us.span`
|
|
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`
|
|
13
13
|
&& {
|
|
14
14
|
width: 82px;
|
|
15
15
|
height: 82px;
|
|
@@ -42,13 +42,13 @@ Resources:
|
|
|
42
42
|
border-color: var(--privy-color-error);
|
|
43
43
|
border-bottom-color: var(--privy-color-error);
|
|
44
44
|
}
|
|
45
|
-
`,
|
|
45
|
+
`,Vs=Gs(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=>
|
|
51
|
+
`,lr=e=>Hs(eg,{color:e.color||"var(--privy-color-foreground-3)"}),eg=Gs(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
|
|
60
|
+
`;import{jsx as wt,jsxs as da}from"react/jsx-runtime";var aa=cr.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})=>
|
|
89
|
-
${e=>e.hideAnimations&&
|
|
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`
|
|
90
90
|
&& {
|
|
91
91
|
transition: none;
|
|
92
92
|
}
|
|
93
93
|
`}
|
|
94
|
-
`,
|
|
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)`
|
|
95
95
|
position: relative;
|
|
96
96
|
|
|
97
97
|
&& {
|
|
@@ -117,7 +117,7 @@ Resources:
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/* If an anchor tag, :disabled isn't a thing, so manually set state */
|
|
120
|
-
${e=>e.disabled?
|
|
120
|
+
${e=>e.disabled?zs`
|
|
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})=>
|
|
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)`
|
|
140
140
|
&& {
|
|
141
141
|
border-width: 1px;
|
|
142
142
|
border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
|
|
@@ -165,7 +165,7 @@ Resources:
|
|
|
165
165
|
opacity: 1;
|
|
166
166
|
animation: fadein 200ms ease;
|
|
167
167
|
}
|
|
168
|
-
`,
|
|
168
|
+
`,la=cr.button`
|
|
169
169
|
&& {
|
|
170
170
|
padding: 12px 16px;
|
|
171
171
|
font-weight: 500;
|
|
@@ -178,7 +178,7 @@ Resources:
|
|
|
178
178
|
transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
|
|
179
179
|
user-select: none;
|
|
180
180
|
|
|
181
|
-
${e=>e.invisible&&
|
|
181
|
+
${e=>e.invisible&&zs`
|
|
182
182
|
pointer-events: none;
|
|
183
183
|
`}
|
|
184
184
|
|
|
@@ -196,10 +196,10 @@ Resources:
|
|
|
196
196
|
cursor: not-allowed;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`,
|
|
199
|
+
`,c_=cr.div`
|
|
200
200
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
201
201
|
height: 44px;
|
|
202
|
-
`,
|
|
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`
|
|
203
203
|
&& {
|
|
204
204
|
color: var(--privy-color-accent);
|
|
205
205
|
font-size: 16px;
|
|
@@ -241,7 +241,7 @@ Resources:
|
|
|
241
241
|
cursor: not-allowed;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
`;import
|
|
244
|
+
`;import gp from"styled-components";import{Fragment as ig,jsx as Oo,jsxs as vp}from"react/jsx-runtime";var $s=gp.div`
|
|
245
245
|
margin-top: 16px;
|
|
246
246
|
font-size: 13px;
|
|
247
247
|
text-align: center;
|
|
@@ -250,7 +250,7 @@ Resources:
|
|
|
250
250
|
&& > a {
|
|
251
251
|
color: var(--privy-color-accent);
|
|
252
252
|
}
|
|
253
|
-
`;function
|
|
253
|
+
`;function 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`
|
|
254
254
|
display: flex;
|
|
255
255
|
align-items: center;
|
|
256
256
|
justify-content: center;
|
|
@@ -277,7 +277,7 @@ Resources:
|
|
|
277
277
|
@media all and (display-mode: standalone) {
|
|
278
278
|
padding-bottom: 30px;
|
|
279
279
|
}
|
|
280
|
-
`;import
|
|
280
|
+
`;import 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,{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,{children:o}),i?.render.inDialog&&r?Ct(cg,{onClose:t||(()=>n())}):Ct(wp,{})]})},Cp=qs.button`
|
|
281
281
|
&& {
|
|
282
282
|
cursor: pointer;
|
|
283
283
|
display: flex;
|
|
@@ -296,7 +296,7 @@ Resources:
|
|
|
296
296
|
opacity: 1;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
`,
|
|
299
|
+
`,dg=qs.div`
|
|
300
300
|
padding: 16px 0;
|
|
301
301
|
display: flex;
|
|
302
302
|
align-items: center;
|
|
@@ -318,22 +318,22 @@ Resources:
|
|
|
318
318
|
display: flex;
|
|
319
319
|
justify-content: flex-end;
|
|
320
320
|
}
|
|
321
|
-
`,
|
|
321
|
+
`,pg=qs.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
|
|
328
|
+
`;import zr,{css as mg}from"styled-components";var ua=zr.div`
|
|
329
329
|
text-align: left;
|
|
330
330
|
flex-grow: 1;
|
|
331
|
-
`,
|
|
331
|
+
`,bp=zr.div`
|
|
332
332
|
display: flex;
|
|
333
333
|
flex-direction: column;
|
|
334
334
|
justify-content: flex-end;
|
|
335
335
|
flex-grow: 1;
|
|
336
|
-
`,
|
|
336
|
+
`,Zt=zr.div`
|
|
337
337
|
display: flex;
|
|
338
338
|
flex-direction: column;
|
|
339
339
|
gap: 12px;
|
|
@@ -348,7 +348,7 @@ Resources:
|
|
|
348
348
|
&::-webkit-scrollbar {
|
|
349
349
|
display: none;
|
|
350
350
|
}
|
|
351
|
-
`,
|
|
351
|
+
`,Ep=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
|
-
`,
|
|
390
|
-
${
|
|
391
|
-
`,
|
|
392
|
-
${
|
|
393
|
-
`,
|
|
389
|
+
`,ye=zr.button`
|
|
390
|
+
${Ep}
|
|
391
|
+
`,js=zr.a`
|
|
392
|
+
${Ep}
|
|
393
|
+
`,go=zr.div`
|
|
394
394
|
width: 100%;
|
|
395
395
|
${e=>e.if?"display: none;":""}
|
|
396
|
-
`;import
|
|
396
|
+
`;import Ae from"styled-components";var Oe=Ae.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
|
-
`,
|
|
404
|
+
`,ge=Ae.div`
|
|
405
405
|
font-size: 18px;
|
|
406
406
|
line-height: 18px;
|
|
407
407
|
text-align: center;
|
|
408
408
|
font-weight: 600;
|
|
409
409
|
margin-bottom: 10px;
|
|
410
|
-
`,
|
|
410
|
+
`,pe=Ae.div`
|
|
411
411
|
font-size: 0.875rem;
|
|
412
412
|
|
|
413
413
|
text-align: center;
|
|
414
|
-
`,Do=
|
|
414
|
+
`,Do=Ae.div`
|
|
415
415
|
display: flex;
|
|
416
416
|
flex-direction: column;
|
|
417
417
|
align-items: center;
|
|
@@ -421,7 +421,7 @@ Resources:
|
|
|
421
421
|
@media (max-width: 440px) {
|
|
422
422
|
padding: 10px 10px 20px;
|
|
423
423
|
}
|
|
424
|
-
`,
|
|
424
|
+
`,Tp=Ae.div`
|
|
425
425
|
display: flex;
|
|
426
426
|
flex-direction: column;
|
|
427
427
|
align-items: stretch;
|
|
@@ -429,7 +429,7 @@ Resources:
|
|
|
429
429
|
padding: 1rem 0rem 0rem;
|
|
430
430
|
flex-grow: 1;
|
|
431
431
|
width: 100%;
|
|
432
|
-
`,
|
|
432
|
+
`,Ks=Ae.div`
|
|
433
433
|
width: 25px;
|
|
434
434
|
display: flex;
|
|
435
435
|
align-items: center;
|
|
@@ -441,19 +441,19 @@ Resources:
|
|
|
441
441
|
width: 25px !important;
|
|
442
442
|
color: var(--privy-color-accent);
|
|
443
443
|
}
|
|
444
|
-
|
|
444
|
+
`,Ys=Ae.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=
|
|
451
|
+
`,Uo=Ae.div`
|
|
452
452
|
display: flex;
|
|
453
453
|
flex-direction: column;
|
|
454
454
|
gap: 10px;
|
|
455
455
|
padding-top: 20px;
|
|
456
|
-
`,
|
|
456
|
+
`,ma=Ae.div`
|
|
457
457
|
display: flex;
|
|
458
458
|
flex-direction: column;
|
|
459
459
|
align-items: stretch;
|
|
@@ -461,7 +461,7 @@ Resources:
|
|
|
461
461
|
padding: 1rem 0rem 0rem;
|
|
462
462
|
flex-grow: 1;
|
|
463
463
|
width: 100%;
|
|
464
|
-
`,
|
|
464
|
+
`,fa=Ae.div`
|
|
465
465
|
display: flex;
|
|
466
466
|
gap: 5px;
|
|
467
467
|
width: 100%;
|
|
@@ -469,7 +469,7 @@ Resources:
|
|
|
469
469
|
& > button:not(#remove) {
|
|
470
470
|
width: 100%;
|
|
471
471
|
}
|
|
472
|
-
`,
|
|
472
|
+
`,Js=Ae.button`
|
|
473
473
|
&& {
|
|
474
474
|
background-color: transparent;
|
|
475
475
|
color: var(--privy-color-foreground-3);
|
|
@@ -488,7 +488,7 @@ Resources:
|
|
|
488
488
|
&&:hover {
|
|
489
489
|
color: var(--privy-color-error);
|
|
490
490
|
}
|
|
491
|
-
`,
|
|
491
|
+
`,ha=Ae.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=
|
|
501
|
+
`,$r=Ae.div`
|
|
502
502
|
display: flex;
|
|
503
503
|
align-items: center;
|
|
504
504
|
gap: 6px;
|
|
@@ -512,15 +512,15 @@ Resources:
|
|
|
512
512
|
display: flex !important;
|
|
513
513
|
align-items: flex-end;
|
|
514
514
|
}
|
|
515
|
-
`,
|
|
515
|
+
`,ya=Ae.div`
|
|
516
516
|
width: 100%;
|
|
517
517
|
display: flex;
|
|
518
518
|
justify-content: space-between;
|
|
519
|
-
`,
|
|
519
|
+
`,Pp=Ae.p`
|
|
520
520
|
text-align: left;
|
|
521
521
|
width: 100%;
|
|
522
522
|
color: var(--privy-color-foreground-3) !important;
|
|
523
|
-
`,
|
|
523
|
+
`,Qs=Ae.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
|
-
|
|
553
|
+
`,$e=Ae.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
|
|
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`
|
|
569
569
|
display: flex;
|
|
570
570
|
gap: 10px;
|
|
571
|
-
`;import
|
|
571
|
+
`;import Xs from"styled-components";import wg from"styled-components";var ga=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
|
|
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`
|
|
587
587
|
display: flex;
|
|
588
588
|
flex-direction: column;
|
|
589
589
|
align-items: center;
|
|
@@ -591,11 +591,11 @@ Resources:
|
|
|
591
591
|
gap: 24px;
|
|
592
592
|
width: 100%;
|
|
593
593
|
padding-bottom: 16px;
|
|
594
|
-
`,
|
|
594
|
+
`,bg=Xs.div`
|
|
595
595
|
display: flex;
|
|
596
596
|
flex-direction: column;
|
|
597
597
|
gap: 8px;
|
|
598
|
-
`,
|
|
598
|
+
`,Eg=Xs.div`
|
|
599
599
|
display: flex;
|
|
600
600
|
flex-direction: column;
|
|
601
601
|
justify-content: center;
|
|
@@ -618,7 +618,7 @@ Resources:
|
|
|
618
618
|
left: -19px;
|
|
619
619
|
top: -19px;
|
|
620
620
|
}
|
|
621
|
-
`;import
|
|
621
|
+
`;import 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`
|
|
622
622
|
display: flex;
|
|
623
623
|
flex-direction: column;
|
|
624
624
|
align-items: flex-start;
|
|
@@ -626,36 +626,36 @@ Resources:
|
|
|
626
626
|
margin-top: auto;
|
|
627
627
|
gap: 16px;
|
|
628
628
|
flex-grow: 100;
|
|
629
|
-
`,
|
|
629
|
+
`,bt=ct.div`
|
|
630
630
|
display: flex;
|
|
631
631
|
flex-direction: column;
|
|
632
632
|
align-items: center;
|
|
633
633
|
justify-content: center;
|
|
634
634
|
flex-grow: 1;
|
|
635
635
|
width: 100%;
|
|
636
|
-
`,
|
|
636
|
+
`,kp=ct.div`
|
|
637
637
|
display: flex;
|
|
638
638
|
flex-direction: column;
|
|
639
639
|
align-items: center;
|
|
640
640
|
width: 100%;
|
|
641
|
-
`,
|
|
641
|
+
`,Ca=ct(bt)`
|
|
642
642
|
padding: 20px 0;
|
|
643
|
-
`,Ot=
|
|
643
|
+
`,Ot=ct(bt)`
|
|
644
644
|
gap: 16px;
|
|
645
|
-
`,
|
|
645
|
+
`,el=ct.div`
|
|
646
646
|
display: flex;
|
|
647
647
|
flex-direction: column;
|
|
648
648
|
width: 100%;
|
|
649
|
-
`,
|
|
649
|
+
`,Et=ct.div`
|
|
650
650
|
display: flex;
|
|
651
651
|
flex-direction: column;
|
|
652
652
|
gap: 8px;
|
|
653
|
-
`,
|
|
653
|
+
`,o4=ct.div`
|
|
654
654
|
display: flex;
|
|
655
655
|
flex-direction: column;
|
|
656
656
|
justify-content: space-between;
|
|
657
657
|
height: 100%;
|
|
658
|
-
`,
|
|
658
|
+
`,Rp=ct.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=
|
|
681
|
+
`,Y=ct.div`
|
|
682
682
|
height: 16px;
|
|
683
|
-
`,Q=
|
|
683
|
+
`,Q=ct.div`
|
|
684
684
|
height: 12px;
|
|
685
|
-
`,
|
|
685
|
+
`,Ip=ct.div`
|
|
686
686
|
position: relative;
|
|
687
|
-
`,
|
|
687
|
+
`,Wp=ct.div`
|
|
688
688
|
background-color: var(--privy-color-accent);
|
|
689
689
|
display: flex;
|
|
690
690
|
justify-content: center;
|
|
@@ -692,9 +692,9 @@ Resources:
|
|
|
692
692
|
border-radius: 50%;
|
|
693
693
|
border-color: white;
|
|
694
694
|
border-width: 2px !important;
|
|
695
|
-
`;import
|
|
695
|
+
`;import 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)`
|
|
696
696
|
margin-bottom: 24px;
|
|
697
|
-
`,
|
|
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`
|
|
698
698
|
display: flex;
|
|
699
699
|
flex-direction: column;
|
|
700
700
|
justify-content: flex-start;
|
|
@@ -714,7 +714,7 @@ Resources:
|
|
|
714
714
|
color: var(--privy-color-foreground-2);
|
|
715
715
|
font-size: 14px;
|
|
716
716
|
}
|
|
717
|
-
`,
|
|
717
|
+
`,Tg=tl(Mp)`
|
|
718
718
|
align-items: center;
|
|
719
719
|
text-align: center;
|
|
720
720
|
gap: 16px;
|
|
@@ -722,7 +722,7 @@ Resources:
|
|
|
722
722
|
h3 {
|
|
723
723
|
margin-bottom: 24px;
|
|
724
724
|
}
|
|
725
|
-
`;import{Fragment as
|
|
725
|
+
`;import{Fragment as 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`
|
|
726
726
|
display: flex;
|
|
727
727
|
flex-direction: column;
|
|
728
728
|
align-items: flex-start;
|
|
@@ -730,7 +730,7 @@ Resources:
|
|
|
730
730
|
margin: auto;
|
|
731
731
|
gap: 16px;
|
|
732
732
|
flex-grow: 1;
|
|
733
|
-
`,
|
|
733
|
+
`,Rg=Dn.div`
|
|
734
734
|
display: flex;
|
|
735
735
|
flex-direction: column;
|
|
736
736
|
width: 100%;
|
|
@@ -786,7 +786,7 @@ Resources:
|
|
|
786
786
|
transform: translate(1px, 0px);
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
`,
|
|
789
|
+
`,Ig=Dn.div`
|
|
790
790
|
line-height: 20px;
|
|
791
791
|
height: 20px;
|
|
792
792
|
font-size: 13px;
|
|
@@ -794,7 +794,7 @@ Resources:
|
|
|
794
794
|
display: flex;
|
|
795
795
|
justify-content: flex-end;
|
|
796
796
|
width: 100%;
|
|
797
|
-
`,
|
|
797
|
+
`,Wg=Dn.div`
|
|
798
798
|
font-size: 13px;
|
|
799
799
|
color: var(--privy-color-foreground-3);
|
|
800
800
|
display: flex;
|
|
@@ -808,10 +808,10 @@ Resources:
|
|
|
808
808
|
> button {
|
|
809
809
|
text-decoration: underline;
|
|
810
810
|
}
|
|
811
|
-
`,
|
|
811
|
+
`,Dp=Dn.span`
|
|
812
812
|
font-weight: 500;
|
|
813
813
|
word-break: break-all;
|
|
814
|
-
`;import
|
|
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`
|
|
815
815
|
display: flex;
|
|
816
816
|
flex-direction: column;
|
|
817
817
|
justify-content: center;
|
|
@@ -834,14 +834,14 @@ Resources:
|
|
|
834
834
|
left: -19px;
|
|
835
835
|
top: -19px;
|
|
836
836
|
}
|
|
837
|
-
`;import{Fragment as
|
|
837
|
+
`;import{Fragment as 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`
|
|
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 xg from"@heroicons/react/24/outline/WalletIcon";import{isMobile as Sg}from"react-device-detect";import _g from"styled-components";import{jsx as Ut,jsxs as Cp}from"react/jsx-runtime";var bp=({...e})=>Cp("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[Ut("defs",{children:Cp("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 ut}from"react/jsx-runtime";var Ep=({style:e,...t})=>ut("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:ut("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)"})]})}),ut("defs",{children:[ut("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"})]}),ut("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"})]}),ut("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"})]}),ut("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"})]}),ut("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"})]}),ut("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"})]}),ut("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"})]}),ut("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"})]}),ut("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"})]}),ut("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 Ln,jsxs as Tp}from"react/jsx-runtime";var Pp=({style:e,...t})=>Tp("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:[Tp("g",{clipPath:"url(#clip0_1704_1423)",children:[Ln("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"}),Ln("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"})]}),Ln("defs",{children:Ln("clipPath",{id:"clip0_1704_1423",children:Ln("rect",{width:"176",height:"176",fill:"white"})})})]});import{jsx as Kr,jsxs as Wg}from"react/jsx-runtime";var no={coinbase_wallet:{logo:_n,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Ur,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:Jt,displayName:"Phantom"},rainbow:{logo:Ep,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:An,displayName:"WalletConnect"},zerion:{logo:Pp,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:bp,displayName:"Brave Wallet",rdns:"com.brave.wallet"}},Yr=({provider:e,displayName:t,logo:o,connectOnly:r,connector:n})=>{let{navigate:i}=_(),{connectWallet:a}=k(),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(Sg?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(r?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},Wg(Ig,{onClick:s,children:[Kr(Rg,{icon:kg(e,n.connectorType)??o}),Kr("span",{style:{textTransform:"capitalize"},children:Ag(e,n.connectorType)||t||n.walletClientType}),Kr("span",{id:"connect-text",children:"Connect"})]})},Ag=(e,t)=>{if(no[e]?.displayName)return no[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},kg=(e,t)=>{if(no[e]?.logo)return no[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return An},Rg=({icon:e})=>typeof e=="string"?Kr("img",{src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Kr(xg,{}):e?Kr(e,{}):null,Ig=_g(ve)`
|
|
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}),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})=>typeof e=="string"?Kr("img",{src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?Kr(Vg,{}):e?Kr(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
|
|
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`
|
|
867
867
|
display: flex;
|
|
868
868
|
flex-direction: column;
|
|
869
869
|
align-items: center;
|
|
870
870
|
padding: 24px 0;
|
|
871
871
|
flex-grow: 1;
|
|
872
872
|
justify-content: center;
|
|
873
|
-
`;import{Fragment as
|
|
873
|
+
`;import{Fragment as 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)`
|
|
874
874
|
margin-bottom: 16px;
|
|
875
|
-
`;import{useEffect as
|
|
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`
|
|
876
876
|
display: flex;
|
|
877
877
|
flex-direction: column;
|
|
878
878
|
align-items: center;
|
|
879
879
|
justify-content: center;
|
|
880
880
|
gap: 24px;
|
|
881
881
|
width: 100%;
|
|
882
|
-
`,
|
|
882
|
+
`,vv=Xp.div`
|
|
883
883
|
display: flex;
|
|
884
884
|
flex-direction: column;
|
|
885
885
|
justify-content: center;
|
|
@@ -902,14 +902,14 @@ Resources:
|
|
|
902
902
|
left: -19px;
|
|
903
903
|
top: -19px;
|
|
904
904
|
}
|
|
905
|
-
`,
|
|
905
|
+
`,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`
|
|
906
906
|
display: flex;
|
|
907
907
|
flex-direction: column;
|
|
908
908
|
align-items: center;
|
|
909
909
|
justify-content: center;
|
|
910
910
|
gap: 24px;
|
|
911
911
|
width: 100%;
|
|
912
|
-
`;import
|
|
912
|
+
`;import 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`
|
|
913
913
|
display: flex;
|
|
914
914
|
justify-content: center;
|
|
915
915
|
align-items: center;
|
|
@@ -921,14 +921,14 @@ Resources:
|
|
|
921
921
|
@media all and (display-mode: standalone) {
|
|
922
922
|
margin-bottom: 30px;
|
|
923
923
|
}
|
|
924
|
-
`,
|
|
924
|
+
`,Pv=Pa.div`
|
|
925
925
|
position: relative;
|
|
926
926
|
height: 140px;
|
|
927
927
|
width: 140px;
|
|
928
928
|
|
|
929
929
|
opacity: 1;
|
|
930
930
|
animation: fadein 200ms ease;
|
|
931
|
-
`,
|
|
931
|
+
`,xv=Pa.div`
|
|
932
932
|
position: absolute;
|
|
933
933
|
top: 0;
|
|
934
934
|
right: 0;
|
|
@@ -941,7 +941,7 @@ Resources:
|
|
|
941
941
|
border: 4px solid var(--privy-color-accent-light);
|
|
942
942
|
border-radius: 50%;
|
|
943
943
|
}
|
|
944
|
-
`,
|
|
944
|
+
`,Sv=Pa.div`
|
|
945
945
|
position: absolute;
|
|
946
946
|
top: 0;
|
|
947
947
|
right: 0;
|
|
@@ -965,20 +965,20 @@ Resources:
|
|
|
965
965
|
transform: rotate(360deg);
|
|
966
966
|
}
|
|
967
967
|
}
|
|
968
|
-
`;var
|
|
968
|
+
`;var 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`
|
|
969
969
|
height: 44px;
|
|
970
|
-
`;import
|
|
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`
|
|
971
971
|
display: flex;
|
|
972
972
|
flex-direction: column;
|
|
973
973
|
text-align: left;
|
|
974
|
-
`,
|
|
974
|
+
`,zv=Bo.div`
|
|
975
975
|
display: flex;
|
|
976
976
|
flex-direction: column;
|
|
977
977
|
gap: 24px;
|
|
978
978
|
padding-bottom: 16px;
|
|
979
979
|
margin-left: 11px;
|
|
980
980
|
border-left: 1px solid var(--privy-color-foreground-4) !important;
|
|
981
|
-
`,
|
|
981
|
+
`,mu=Bo.div`
|
|
982
982
|
display: flex;
|
|
983
983
|
align-items: top;
|
|
984
984
|
gap: 8px;
|
|
@@ -987,7 +987,7 @@ Resources:
|
|
|
987
987
|
color: var(--privy-color-accent);
|
|
988
988
|
text-decoration: underline;
|
|
989
989
|
}
|
|
990
|
-
|
|
990
|
+
`,fu=Bo.div`
|
|
991
991
|
display: flex;
|
|
992
992
|
align-items: center;
|
|
993
993
|
justify-content: center;
|
|
@@ -1001,11 +1001,11 @@ Resources:
|
|
|
1001
1001
|
border-radius: 100%;
|
|
1002
1002
|
background: var(--privy-color-background);
|
|
1003
1003
|
color: var(--privy-color-accent);
|
|
1004
|
-
|
|
1004
|
+
`,$v=Bo.div`
|
|
1005
1005
|
overflow: visible;
|
|
1006
1006
|
position: relative;
|
|
1007
1007
|
height: 44px;
|
|
1008
|
-
`,
|
|
1008
|
+
`,qv=Bo.div`
|
|
1009
1009
|
position: absolute;
|
|
1010
1010
|
display: flex;
|
|
1011
1011
|
align-items: center;
|
|
@@ -1017,7 +1017,7 @@ Resources:
|
|
|
1017
1017
|
border-radius: var(--privy-border-radius-md);
|
|
1018
1018
|
background-color: var(--privy-color-background-2);
|
|
1019
1019
|
color: var(--privy-color-foreground-3);
|
|
1020
|
-
`,
|
|
1020
|
+
`,jv=Bo.div`
|
|
1021
1021
|
display: flex;
|
|
1022
1022
|
align-items: center;
|
|
1023
1023
|
padding-top: 1px;
|
|
@@ -1030,7 +1030,7 @@ Resources:
|
|
|
1030
1030
|
font-size: 12px;
|
|
1031
1031
|
font-weight: 500;
|
|
1032
1032
|
margin: auto;
|
|
1033
|
-
`,
|
|
1033
|
+
`,Kv=Bo.div`
|
|
1034
1034
|
border: 1px solid var(--privy-color-background-2) !important;
|
|
1035
1035
|
border-radius: var(--privy-border-radius-md);
|
|
1036
1036
|
padding: 16px;
|
|
@@ -1052,7 +1052,7 @@ Resources:
|
|
|
1052
1052
|
color: var(--privy-color-error);
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
|
-
`;import
|
|
1055
|
+
`;import 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`
|
|
1056
1056
|
font-size: 14px;
|
|
1057
1057
|
font-style: normal;
|
|
1058
1058
|
font-weight: 400;
|
|
@@ -1060,8 +1060,8 @@ Resources:
|
|
|
1060
1060
|
letter-spacing: -0.008px;
|
|
1061
1061
|
text-align: left;
|
|
1062
1062
|
transition: color 0.1s ease-in;
|
|
1063
|
-
`,
|
|
1064
|
-
${
|
|
1063
|
+
`,xa=Ue.span`
|
|
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)"};
|
|
1067
1067
|
text-transform: ${({error:e})=>e?"":"capitalize"};
|
|
@@ -1069,18 +1069,18 @@ Resources:
|
|
|
1069
1069
|
&[aria-hidden='true'] {
|
|
1070
1070
|
visibility: hidden;
|
|
1071
1071
|
}
|
|
1072
|
-
`,Ho=
|
|
1072
|
+
`,Ho=Ue.div`
|
|
1073
1073
|
display: flex;
|
|
1074
1074
|
flex-direction: column;
|
|
1075
1075
|
justify-content: center;
|
|
1076
1076
|
flex-grow: 1;
|
|
1077
|
-
`,Go=
|
|
1078
|
-
${e=>e.hideAnimations&&
|
|
1077
|
+
`,Go=Ue(D)`
|
|
1078
|
+
${e=>e.hideAnimations&&vl`
|
|
1079
1079
|
&& {
|
|
1080
1080
|
transition: none;
|
|
1081
1081
|
}
|
|
1082
1082
|
`}
|
|
1083
|
-
`,
|
|
1083
|
+
`,gu=vl`
|
|
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=
|
|
1099
|
-
${
|
|
1098
|
+
`,mr=Ue.input`
|
|
1099
|
+
${gu}
|
|
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
|
-
`,
|
|
1107
|
-
${
|
|
1108
|
-
`,Vo=
|
|
1106
|
+
`,vu=Ue.div`
|
|
1107
|
+
${gu}
|
|
1108
|
+
`,Vo=Ue.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=
|
|
1114
|
+
`,zo=Ue.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
|
-
`,
|
|
1136
|
+
`,Vn=Ue.div`
|
|
1137
1137
|
display: flex;
|
|
1138
1138
|
flex-direction: column;
|
|
1139
1139
|
gap: 10px;
|
|
1140
1140
|
padding-bottom: 1rem;
|
|
1141
|
-
`,
|
|
1141
|
+
`,zn=Ue.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
|
-
`,
|
|
1161
|
+
`,OA=Ue.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
|
-
`,
|
|
1167
|
+
`,wl=Ue(aa)`
|
|
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=
|
|
1179
|
+
`,rn=Ue.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
|
-
`,
|
|
1187
|
+
`,wu=Ue(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=
|
|
1196
|
+
`,nn=Ue(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=
|
|
1205
|
+
`,an=Ue(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
|
-
`,
|
|
1214
|
+
`,Cu=Ue.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
|
|
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`
|
|
1231
1231
|
display: inline-block;
|
|
1232
1232
|
vertical-align: middle;
|
|
1233
|
-
`,
|
|
1233
|
+
`,Tu=_a.svg`
|
|
1234
1234
|
fill: none;
|
|
1235
1235
|
stroke: white;
|
|
1236
1236
|
stroke-width: 3px;
|
|
1237
|
-
`,
|
|
1237
|
+
`,Pu=_a.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
|
-
`,
|
|
1248
|
+
`,nw=_a.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
|
-
${
|
|
1263
|
+
${Pu}:focus + & {
|
|
1264
1264
|
box-shadow: 0 0 0 1px ${e=>e.color};
|
|
1265
1265
|
}
|
|
1266
1266
|
|
|
1267
|
-
${
|
|
1267
|
+
${Tu} {
|
|
1268
1268
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
1269
1269
|
}
|
|
1270
|
-
`;import{Fragment as
|
|
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`
|
|
1271
1271
|
display: flex;
|
|
1272
1272
|
gap: 10px;
|
|
1273
|
-
`;import
|
|
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)`
|
|
1274
1274
|
flex: 1;
|
|
1275
1275
|
padding-top: 1rem;
|
|
1276
|
-
`,
|
|
1276
|
+
`,Aw=Lu.div`
|
|
1277
1277
|
display: flex;
|
|
1278
1278
|
flex-direction: column;
|
|
1279
1279
|
height: 100%;
|
|
1280
|
-
`;import
|
|
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
|
|
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
|
|
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`
|
|
1285
1285
|
height: 44px;
|
|
1286
|
-
`;import{useEffect as
|
|
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`
|
|
1287
1287
|
display: flex;
|
|
1288
1288
|
flex-direction: column;
|
|
1289
1289
|
align-items: center;
|
|
@@ -1305,26 +1305,26 @@ 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
|
-
`,
|
|
1308
|
+
`,o1=Ma.div`
|
|
1309
1309
|
display: flex;
|
|
1310
1310
|
flex-direction: column;
|
|
1311
1311
|
justify-content: space-between;
|
|
1312
|
-
`,
|
|
1312
|
+
`,r1=Ma.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
|
-
`,
|
|
1320
|
-
${e=>e.hideAnimations&&
|
|
1319
|
+
`,n1=Ma(D)`
|
|
1320
|
+
${e=>e.hideAnimations&&e1`
|
|
1321
1321
|
&& {
|
|
1322
1322
|
// Remove animations because the recoverWallet task on the iframe partially
|
|
1323
1323
|
// blocks the renderer, so the animation stutters and doesn't look good
|
|
1324
1324
|
transition: none;
|
|
1325
1325
|
}
|
|
1326
1326
|
`}
|
|
1327
|
-
`;import
|
|
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`
|
|
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
|
-
`,
|
|
1335
|
+
`,p1=Pl.div`
|
|
1336
1336
|
display: flex;
|
|
1337
1337
|
flex-direction: column;
|
|
1338
1338
|
gap: 8px;
|
|
1339
|
-
`,
|
|
1339
|
+
`,u1=Pl.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
|
|
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`
|
|
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
|
|
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`
|
|
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
|
|
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`
|
|
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
|
-
`,
|
|
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`
|
|
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
|
-
`,
|
|
1461
|
+
`,L1=cm.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
|
|
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`
|
|
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
|
-
`,
|
|
1493
|
+
`,H1=no.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
|
-
`,
|
|
1499
|
+
`,G1=no.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
|
-
`,
|
|
1508
|
+
`,V1=no.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
|
-
`,
|
|
1514
|
+
`,z1=no.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
|
-
|
|
1519
|
+
`,$1=no.div`
|
|
1520
1520
|
display: flex;
|
|
1521
1521
|
align-items: flex-start;
|
|
1522
1522
|
gap: 0.5rem;
|
|
1523
1523
|
align-self: stretch;
|
|
1524
|
-
`,
|
|
1524
|
+
`,q1=no.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
|
-
`,
|
|
1531
|
+
`,j1=no.div`
|
|
1532
1532
|
padding-top: 2px;
|
|
1533
|
-
`,
|
|
1533
|
+
`,K1=no.div`
|
|
1534
1534
|
display: flex;
|
|
1535
1535
|
flex-direction: column;
|
|
1536
1536
|
gap: 1.25rem;
|
|
1537
1537
|
margin: 0 0.5rem;
|
|
1538
|
-
`,
|
|
1538
|
+
`,Y1=no.div`
|
|
1539
1539
|
margin: 30px 0;
|
|
1540
|
-
`;import{ofetch as
|
|
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`
|
|
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
|
-
`,
|
|
1547
|
+
`,mC=vm.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
|
|
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`
|
|
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
|
|
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`
|
|
1566
1566
|
display: flex;
|
|
1567
1567
|
flex-direction: column;
|
|
1568
1568
|
justify-content: flex-start;
|
|
1569
1569
|
gap: 4px;
|
|
1570
|
-
`,
|
|
1570
|
+
`,Wl=Il.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
|
-
`,
|
|
1576
|
+
`,Ba=({children:e})=>bC(wC,{children:[CC(Em,{style:{width:"16px",height:"16px"}}),e]}),wC=Il.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
|
|
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)`
|
|
1595
1595
|
gap: 30px;
|
|
1596
1596
|
|
|
1597
1597
|
> :first-child > svg {
|
|
1598
1598
|
margin-top: 20px;
|
|
1599
1599
|
}
|
|
1600
|
-
`;import
|
|
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`
|
|
1601
1601
|
width: 100%;
|
|
1602
|
-
`,
|
|
1602
|
+
`,kC=Rm.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
|
|
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`
|
|
1661
1661
|
width: 100%;
|
|
1662
|
-
`,
|
|
1662
|
+
`,qC=Fm.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 WC,jsx as Ra,jsxs as gm}from"react/jsx-runtime";var vm=({isEditable:e,setIsEditable:t})=>{let o=IC(null),{authenticated:r}=F(),{navigate:n,setModalData:i,currentScreen:a}=_(),{initLoginWithSms:l}=k(),{enabled:s,token:c}=fe();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 gm(WC,{children:[Ra(vo,{if:!e,children:Ra(ln,{ref:o,onSubmit:u})}),Ra(vo,{if:e,children:gm(ve,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[Ra(RC,{})," Continue with SMS"]})})]})};import{jsx as wm,jsxs as MC}from"react/jsx-runtime";var Ia=({style:e,...t})=>MC("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:[wm("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"}),wm("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 Zn,jsxs as NC}from"react/jsx-runtime";var Wa=({style:e,...t})=>NC("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:[Zn("g",{clipPath:"url(#clip0)",children:Zn("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"})}),Zn("defs",{children:Zn("clipPath",{id:"clip0",children:Zn("rect",{width:"71",height:"55",fill:"white"})})})]});import{jsx as Cm}from"react/jsx-runtime";var Ma=({style:e,...t})=>Cm("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:Cm("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 Na,jsxs as LC}from"react/jsx-runtime";var La=({style:e,...t})=>LC("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:[Na("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"}),Na("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"}),Na("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"}),Na("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 Oa}from"react/jsx-runtime";function Da({style:e,...t}){return Oa("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:Oa("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:Oa("g",{transform:"scale(5.12,5.12)",children:Oa("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 Il,jsxs as OC}from"react/jsx-runtime";function Ua(e){return OC("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:[Il("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"}),Il("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"}),Il("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 bm}from"react/jsx-runtime";var Fa=({style:e,...t})=>bm("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:bm("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 UC}from"react/jsx-runtime";var DC={apple:{logo:br(Ia,{}),displayName:"Apple"},discord:{logo:br(Wa,{}),displayName:"Discord"},github:{logo:br(Ma,{}),displayName:"GitHub"},google:{logo:br(La,{}),displayName:"Google"},linkedin:{logo:br(Da,{}),displayName:"LinkedIn"},twitter:{logo:br(Fa,{}),displayName:"Twitter"},tiktok:{logo:br(Ua,{}),displayName:"TikTok"}},qo=({provider:e})=>{let{enabled:t,token:o}=fe(),{navigate:r,setModalData:n}=_(),{initLoginWithOAuth:i}=k(),{displayName:a,logo:l}=DC[e];return UC(ve,{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 FC from"@heroicons/react/24/outline/ChevronRightIcon";import BC from"@heroicons/react/24/outline/WalletIcon";import{jsx as Wl,jsxs as HC}from"react/jsx-runtime";var Em=({onClick:e,text:t})=>HC(ve,{onClick:e,children:[Wl(BC,{}),Wl(Qi,{children:t}),Wl(FC,{})]});import GC from"@heroicons/react/24/outline/ChevronRightIcon";import{jsx as Tm,jsxs as VC}from"react/jsx-runtime";var Pm=({onClick:e,text:t,icon:o})=>VC(ve,{onClick:e,children:[o,Tm(Qi,{children:t}),Tm(GC,{})]});import{Fragment as Xn,jsx as be,jsxs as cn}from"react/jsx-runtime";var Sm=()=>{let{closePrivyModal:e,connectors:t}=k(),{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]=xm("default"),[M,A]=xm(n?"email":"sms");jC(()=>{A(n?"email":"sms")},[n]);let W=()=>{e({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{T("default")},150)};r.current=W;let N=[n&&be(cm,{isEditable:M==="email",setIsEditable:()=>{A("email")}}),i&&be(vm,{isEditable:M==="sms",setIsEditable:()=>{A("sms")}})].filter(Boolean),R=[a&&be(qo,{provider:"google"}),l&&(!KC||o?.loginConfig.twitterOAuthOnMobileEnabled)&&be(qo,{provider:"twitter"}),s&&be(qo,{provider:"discord"}),c&&be(qo,{provider:"github"}),u&&be(qo,{provider:"tiktok"}),h&&be(qo,{provider:"linkedin"}),f&&be(qo,{provider:"apple"}),C&&be(dm,{})].filter(Boolean),U=ol(o?.appearance.walletList??[],t,!1),z=E==="default"?void 0:()=>{T("default")},Z=QC({priority:b,email:n,sms:i,social:R}),L=ZC({priority:b,email:n,sms:i,social:R}),V=XC({priority:b,email:n,sms:i,social:R}),B=be(Em,{text:V,onClick:()=>T("web3-overflow")}),se=be(Pm,{text:Z,icon:L,onClick:()=>T("web2-overflow")}),O=x?0:1;return cn(Xn,{children:[be(S,{title:"Log in or Sign Up",onClose:W,backFn:z}),E==="default"&&be(JC,{}),be(Zd,{style:{overflow:"hidden",padding:2},children:cn(Xt,{children:[E==="default"&&b==="web2-first"&&cn(Xn,{children:[...N,...R.length+N.length>4?R.slice(0,3-N.length):R,N.length+R.length>4&&se,g&&B]}),E==="default"&&b==="web3-first"&&cn(Xn,{children:[g&&cn(Xn,{children:[...U.length>4?U.slice(0,3):U,U.length>4&&B]}),N.length+R.length>O&&se,N.length+R.length===O&&N.length?N[0]:null,N.length+R.length===O&&R.length?R[0]:null]}),E==="web2-overflow"&&cn(Xn,{children:[...b==="web3-first"?N:[],...R]}),...E==="web3-overflow"?U:[]]})}),o&&be(Ji,{app:o}),be(G,{protectedByPrivy:!0})]})},JC=YC(sa)`
|
|
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)`
|
|
1749
1749
|
margin-bottom: 16px;
|
|
1750
|
-
`,
|
|
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`
|
|
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
|
-
`,
|
|
1773
|
+
`,A0=pn.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
|
-
`,
|
|
1786
|
+
`,k0=pn.div`
|
|
1787
1787
|
position: relative;
|
|
1788
1788
|
z-index: 999999;
|
|
1789
|
-
`,
|
|
1789
|
+
`,R0=pn.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
|
-
`,
|
|
1797
|
+
`,I0=pn.div`
|
|
1798
1798
|
// reset some default dialog styles
|
|
1799
1799
|
padding: 0;
|
|
1800
1800
|
background: transparent;
|
|
@@ -1841,13 +1841,13 @@ 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
|
-
`,
|
|
1844
|
+
`,af=pn.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
|
|
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`
|
|
1851
1851
|
display: flex;
|
|
1852
1852
|
flex-direction: column;
|
|
1853
1853
|
width: 100%;
|
|
@@ -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
|
-
`,
|
|
1921
|
+
`,U0=lf.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
|
|
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`
|
|
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
|
|
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`
|
|
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
|
-
`,
|
|
1955
|
+
`,ob=wf.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
|
|
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`
|
|
1965
1965
|
font-size: 14px;
|
|
1966
1966
|
line-height: 140%;
|
|
1967
1967
|
display: flex;
|
|
1968
1968
|
gap: 4px;
|
|
1969
1969
|
align-items: center;
|
|
1970
|
-
`,
|
|
1970
|
+
`,nb=rs.span`
|
|
1971
1971
|
font-size: 12px;
|
|
1972
1972
|
line-height: 12px;
|
|
1973
1973
|
color: var(--privy-color-foreground-3);
|
|
1974
|
-
`,
|
|
1974
|
+
`,ib=rs.span`
|
|
1975
1975
|
font-size: 10px;
|
|
1976
|
-
`,
|
|
1976
|
+
`,ab=rs.span`
|
|
1977
1977
|
display: flex;
|
|
1978
1978
|
align-items: center;
|
|
1979
|
-
`;import
|
|
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`
|
|
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
|
-
`,
|
|
1985
|
+
`,kf=$l.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
|
-
`,
|
|
1994
|
+
`,Rf=$l.div`
|
|
1995
1995
|
font-size: 14px;
|
|
1996
1996
|
line-height: 22.4px;
|
|
1997
1997
|
font-weight: 400;
|
|
1998
|
-
`;import
|
|
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`
|
|
1999
1999
|
display: flex;
|
|
2000
2000
|
flex-direction: column;
|
|
2001
2001
|
width: 100%;
|
|
2002
2002
|
gap: 8px;
|
|
2003
|
-
`,
|
|
2003
|
+
`,pb=Qo.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
|
-
`,
|
|
2010
|
+
`,ub=Qo.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
|
-
`,
|
|
2018
|
+
`,mb=Qo.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
|
-
`,
|
|
2024
|
+
`,fb=Qo.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
|
-
`,
|
|
2036
|
+
`,hb=Qo.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
|
-
`,
|
|
2048
|
+
`,Uf=Qo.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
|
-
`,
|
|
2054
|
+
`,yb=Qo.div`
|
|
2055
2055
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
2056
|
-
`;import
|
|
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`
|
|
2057
2057
|
&:hover {
|
|
2058
2058
|
text-decoration: underline;
|
|
2059
2059
|
}
|
|
2060
|
-
`;import{jsx as
|
|
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`
|
|
2061
2061
|
display: flex;
|
|
2062
2062
|
flex-direction: row;
|
|
2063
2063
|
justify-content: space-between;
|
|
2064
|
-
`,
|
|
2064
|
+
`,Eb=Ff.div`
|
|
2065
2065
|
flex-shrink: 0;
|
|
2066
2066
|
padding-left: 8px;
|
|
2067
|
-
`;import
|
|
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`
|
|
2068
2068
|
display: flex;
|
|
2069
2069
|
flex-direction: column;
|
|
2070
2070
|
align-items: center;
|
|
2071
2071
|
margin-bottom: 8px;
|
|
2072
|
-
`,
|
|
2072
|
+
`,Pb=di.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
|
-
`,
|
|
2079
|
+
`,xb=di.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
|
-
`,
|
|
2092
|
+
`,Sb=di.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
|
-
`,
|
|
2100
|
+
`,_b=di.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
|
|
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`
|
|
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
|
-
`,
|
|
2121
|
+
`,Ib=Jl.div`
|
|
2122
2122
|
display: flex;
|
|
2123
2123
|
flex-direction: row;
|
|
2124
2124
|
align-items: center;
|
|
2125
2125
|
gap: 8px;
|
|
2126
|
-
`,
|
|
2126
|
+
`,Wb=Jl.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
|
|
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`
|
|
2137
2137
|
display: flex;
|
|
2138
2138
|
flex-direction: column;
|
|
2139
2139
|
align-items: center;
|
|
2140
2140
|
margin-bottom: 20px;
|
|
2141
|
-
`,
|
|
2141
|
+
`,Gf=is.h2`
|
|
2142
2142
|
&& {
|
|
2143
2143
|
font-size: 48px;
|
|
2144
2144
|
line-height: 48px;
|
|
2145
2145
|
margin: 8px auto;
|
|
2146
2146
|
}
|
|
2147
|
-
`,
|
|
2147
|
+
`,Nb=is.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
|
-
`,
|
|
2154
|
+
`,Lb=is.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 Cb}from"@ethersproject/abstract-signer";import{BigNumber as Ht}from"@ethersproject/bignumber";import{Contract as bb}from"@ethersproject/contracts";import{EtherscanProvider as RN}from"@ethersproject/providers";import{serialize as Eb}from"@ethersproject/transactions";var $a={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 qa={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 ja={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 Ka={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 Ya={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 Ja={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 Qa={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 Za={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 Xa={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 es={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 ts={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 os={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};import{parseUnits as Tf}from"@ethersproject/units";import{ofetch as vb}from"ofetch";var ci={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 di={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 Pf=[ci.id,di.id],jl=e=>({maxPriorityFee:Tf(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:Tf(e.maxFee.toFixed(9),"gwei").toHexString()}),wb=e=>({safeLow:jl(e.safeLow),standard:jl(e.standard),fast:jl(e.fast)}),xf=async e=>{let t="";switch(e){case ci.id:t="https://gasstation.polygon.technology/v2";break;case di.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return wb(await vb(t))};function Po(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 Tb(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=Po(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=Po(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Po(e.gasPrice)),e.value!==void 0&&(t.value=Po(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Po(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Po(e.maxPriorityFeePerGas)),t}function Pb(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=Ee(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Ee(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Ee(e.gasPrice)),e.value!==void 0&&(t.value=Ee(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Ee(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Ee(e.maxPriorityFeePerGas)),t}async function gn(e,t,o){t.chainId=Number(t.chainId),_f(t);let r=new Cb(e,o);if(t.gas&&(t.gasLimit=t.gas,delete t.gas),Pf.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await xf(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(xb(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=Po(a),t.maxPriorityFeePerGas=Po(Ht.from(0))}}catch(i){throw new Error(`Failed to set gas price for Arbitrum transaction: ${i}.`)}if(Kl(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=Po(s)}}catch(i){throw new Error(`Failed to set gas price for OP stack transaction: ${i}.`)}Sb(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 Tb(n)}async function rs(e,t,o,r,n){r=Object.assign({chainId:ho},r),_f(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 Sf(e,t,o,r){let n=await r.getBalance(e),i=t.value||0,l=!n.sub(Ee(i)).sub(o).isNegative();return{balance:n,hasSufficientFunds:l}}function Kl(e){return[Ka.id,Ya.id,Ja.id,Qa.id,Za.id,Xa.id,es.id,os.id,ts.id].includes(e)}function xb(e){return[$a.id,qa.id,ja.id].includes(e)}function Sb(e){return[56,97].includes(e)}async function Yl(e,t){if(!e.chainId||e.chainId&&!Kl(e.chainId))return Ht.from(0);let o=Ht.from(0);try{let r=new bb(Xc,ed,t),n=Pb(e),i=Eb(n);o=await r.getL1Fee(i)}catch{}return o}async function ns(e,t){delete e.from;let o=Ht.from(0),r=Ht.from(0);if(e.gasLimit?o=Ee(e.gasLimit):o=await t.estimateGas(e),e.type==2)if(e.maxFeePerGas)r=Ee(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=Ee(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}else if(e.gasPrice)r=Ee(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}let n=o.mul(r);if(e.chainId&&Kl(e.chainId))try{let i=await Yl(e,t);n=n.add(i)}catch{}return n}function _f(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"&&Ab(e);return t||o||r}function Ab(e){return/^-?0x[a-f0-9]+$/i.test(e)}function is(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 Jl,useEffect as kb}from"react";var as=e=>{let{showFiatPrices:t,getUsdTokenPrice:o,chains:r}=k(),[n,i]=Jl(!0),[a,l]=Jl(void 0),[s,c]=Jl(void 0);return kb(()=>{let u=e.chainId||ho,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 Rb,useContext as Ib}from"react";var Ql=Rb(null);function pi(){let e=Ib(Ql);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as kf}from"react/jsx-runtime";var Zl=({pendingTransaction:e})=>{let{getAccessToken:t}=F(),{wallets:o}=pi(),{walletProxy:r,rpcConfig:n,chains:i,nativeTokenSymbolForChainId:a}=k(),[l,s]=Af(e),{tokenPrice:c}=as(l),[u,h]=Af(null),f=a(e.chainId)||"ETH",g=Mb(()=>o.find(C=>C.walletClientType==="privy"),[o]);return Nb(()=>{async function C(){if(!await t()||!r||!g)return l;let x=new Wb(Mt(l.chainId,i,n)),E=await ns(l,x);return h(Ee(E.toBigInt()).toHexString()),gn(g.address,l,x)}C().then(b=>{s(b)})},[r]),g?kf(Ob,{children:kf(yn,{from:g.address,to:l.to,txn:l,gas:u??void 0,tokenPrice:c,tokenSymbol:f})}):null},Ob=Lb.div`
|
|
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`
|
|
2162
2162
|
width: 100%;
|
|
2163
2163
|
padding: 1rem 0;
|
|
2164
|
-
`;import{Fragment as
|
|
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`
|
|
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
|
-
|
|
2172
|
+
`,cE=oh.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
|
|
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)`
|
|
2196
2196
|
margin: 16px auto;
|
|
2197
|
-
`;import{BigNumber as
|
|
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)`
|
|
2198
2198
|
&& {
|
|
2199
2199
|
margin-top: 24px;
|
|
2200
2200
|
}
|
|
2201
2201
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2202
|
-
`;import{Fragment as
|
|
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`
|
|
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
|
-
`,
|
|
2208
|
+
`,PE=wn.div`
|
|
2209
2209
|
font-size: 13px;
|
|
2210
2210
|
color: var(--privy-color-error);
|
|
2211
2211
|
width: 100%;
|
|
2212
2212
|
margin-top: 16px;
|
|
2213
|
-
`,
|
|
2213
|
+
`,xE=wn.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
|
-
`,
|
|
2219
|
+
`,SE=wn(D)`
|
|
2220
2220
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2221
|
-
`,
|
|
2221
|
+
`,_E=wn.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
|
-
`,
|
|
2227
|
+
`,AE=wn.div`
|
|
2228
2228
|
display: flex;
|
|
2229
2229
|
flex-direction: column;
|
|
2230
2230
|
gap: 8px;
|
|
2231
|
-
`;import{isHexString as
|
|
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`
|
|
2232
2232
|
display: flex;
|
|
2233
2233
|
flex-direction: column;
|
|
2234
2234
|
align-items: center;
|
|
2235
2235
|
justify-content: center;
|
|
2236
|
-
`,
|
|
2236
|
+
`,DE=Zo.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
|
-
`,
|
|
2243
|
+
`,UE=Zo.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
|
-
`,
|
|
2253
|
+
`,yh=Zo.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
|
-
`,
|
|
2272
|
+
`,FE=Zo.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
|
-
`,
|
|
2284
|
+
`,BE=Zo.div`
|
|
2285
2285
|
line-height: 20px;
|
|
2286
2286
|
height: 20px;
|
|
2287
2287
|
font-size: 13px;
|
|
@@ -2291,20 +2291,20 @@ 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
|
-
`,
|
|
2294
|
+
`,HE=Zo.span`
|
|
2295
2295
|
display: flex;
|
|
2296
2296
|
align-items: center;
|
|
2297
2297
|
gap: 8px;
|
|
2298
|
-
`,
|
|
2298
|
+
`,GE=Zo(D)`
|
|
2299
2299
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2300
2300
|
|
|
2301
|
-
${e=>e.success&&
|
|
2301
|
+
${e=>e.success&&IE`
|
|
2302
2302
|
&&&& {
|
|
2303
2303
|
background-color: var(--privy-color-success);
|
|
2304
2304
|
color: #ffffff;
|
|
2305
2305
|
}
|
|
2306
2306
|
`}
|
|
2307
|
-
`;import
|
|
2307
|
+
`;import zE,{createGlobalStyle as $E}from"styled-components";var VE=`
|
|
2308
2308
|
*,
|
|
2309
2309
|
::before,
|
|
2310
2310
|
::after {
|
|
@@ -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
|
-
`,
|
|
2537
|
+
`,vh=VE;var wh=$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
|
-
`,
|
|
2569
|
+
`,Ch=zE.div`
|
|
2570
2570
|
// css normalize only the privy application to avoid conflicts
|
|
2571
2571
|
// with consuming application
|
|
2572
|
-
${
|
|
2572
|
+
${vh}
|
|
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 Oe,jsxs as Xf}from"react/jsx-runtime";var WE={["LANDING"]:Sm,["AWAITING_PASSWORDLESS_CODE"]:hp,["AWAITING_CONNECTION"]:Ip,["AWAITING_CONNECT_ONLY_CONNECTION"]:Lp,["AWAITING_FARCASTER_CONNECTION"]:Gu,["PHANTOM_INTERSTITIAL_SCREEN"]:Uf,["LOGIN_FAILED_SCREEN"]:Mm,["AWAITING_OAUTH_SCREEN"]:Nf,["ALLOWLIST_REJECTION_SCREEN"]:ip,["INSTALL_PHANTOM_SCREEN"]:om,["LINK_EMAIL_SCREEN"]:_m,["LINK_PHONE_SCREEN"]:Am,["LINK_WALLET_SCREEN"]:km,["CONNECT_ONLY_LANDING_SCREEN"]:Ap,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:xp,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:bu,["EMBEDDED_WALLET_CREATED_SCREEN"]:Vp,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:Hp,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Pu,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:jp,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:qf,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:zf,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Ku,["FIAT_ON_RAMP_STATUS_SCREEN"]:Ju,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Tu,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Eu,["MFA_ENROLLMENT_FLOW_SCREEN"]:jm,["CAPTCHA_SCREEN"]:wp,["ERROR_SCREEN"]:xu,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Qu,["AFFIRMATIVE_CONSENT_SCREEN"]:rp},ME=["LANDING","AWAITING_CONNECTION"],NE=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:o,isModalOpen:r}=F(),{headless:n}=k(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:u}=fe(),h=kE(null),f=Vd(h),g=r&&a&&ME.includes(a)&&!n&&l==="ready";if(Zf(()=>{g&&s()},[g]),Zf(()=>{!r&&u&&c()},[r,u]),(!o||!i)&&a!=="AWAITING_OAUTH_SCREEN")return Xf(un,{children:[Oe(S,{}),Oe(Y,{}),Oe(Om,{children:Oe(wt,{})}),Oe(Q,{}),Oe(K,{})]});if(!a&&e)return Oe(un,{style:{height:f},children:Oe("div",{ref:h,children:Oe(tc,{open:e,onClose:t})})});if(!a)return null;let C=WE[a];return Oe(un,{style:{height:f},children:Xf("div",{ref:h,children:[Oe(vo,{if:!!e,children:Oe(C,{})}),Oe(vo,{if:!e,children:Oe(tc,{open:e,onClose:t})})]})})},LE=()=>{let{closePrivyModal:e}=k(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:AE(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},eh=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:o}=LE(),[r,n]=RE(!1);Os({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=Oe(Qf,{children:Oe(NE,{isMfaVerifying:r,onMfaVerificationComplete:()=>n(!1)})}),a=e||r,l=t?.render.inDialog?Oe(Lm,{open:a,id:"privy-dialog",onClick:()=>o(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return IE.createPortal(l,s)}return l};var At={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:qc,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var OE=new Set(["metamask","coinbase_wallet","rainbow","zerion","phantom","wallet_connect","detected_wallets"]),DE=e=>OE.has(e),UE=(e,t,o)=>o.indexOf(e)===t,th=({input:e})=>e?e.filter(DE).filter(UE):At.appearance.walletList;var oh={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 rh={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 nh={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 ih={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 ah={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 sh={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 lh={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 ch={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 dh={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 ph={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 ds={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 uh={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 mh={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 mi=[$a,qa,ja,lh,mh,ds,Qa,Za,Xa,ci,di,nh,ih,ah,sh,Ka,Ya,Ja,dh,ph,oh,rh,es,os,ts,ch,uh],uF=new Set(mi.map(e=>e.id));import Tr from"tinycolor2";var fh="#FFFFFF",FE="#000000",BE=fh,HE="#1E1E1D";function GE(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 Xo(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return Tr({...e.toHsl(),l:o})}function hh({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=fh,blackHex:a=FE}){let l;switch(e){case"light":l=BE;break;case"dark":l=HE;break;default:l=e;break}let s=Tr(l),c=Tr(t),u=Tr(o),h=Tr(r),f=Tr(n),g=GE(s.getLuminance()),C=Xo(s,g==="light"?-.04:.11),b=Xo(s,g==="light"?-.88:.87),x=Xo(s,g==="light"?-.77:.75),E=Xo(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),T=Xo(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),M=Xo(c,.15),A=Xo(c,-.06),W=Tr(c.getLuminance()>.5?a:i),N=Xo(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:M.toHslString(),accentDark:A.toHslString(),foregroundAccent:W.toHslString(),success:u.toHslString(),successDark:N.toHslString(),error:f.toHslString(),warn:h.toHslString()}}function ps(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 M=th({isWalletLoginEnabled:a,input:t?.appearance?.walletList}),A=t?.intl?.defaultCountry??"US",{chains:W,defaultChain:N}=VE({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),R=!!t?.defaultChain||!!t?.supportedChains,U=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,z,Z=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?U?z=t?.embeddedWallets?.noPromptOnSignature??!0:z=t?.embeddedWallets?.noPromptOnSignature??Z:z=Z,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,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:hh({backgroundTheme:t?.appearance?.theme??At.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??At.appearance.accentColor}),loginGroupPriority:T?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:M},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??At.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??At.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??At.rpcConfig.rpcTimeouts},chains:W,defaultChain:N,intl:{defaultCountry:A},shouldEnforceDefaultChainOnConnect:R,captchaEnabled:e.captchaEnabled??At.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...U?{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:U?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??At.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??At._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??At._render.inParentNodeId}}}function yh(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 VE({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:mi.find(u=>u.id===s.id)??s)}else n=mi.concat(e??[]);let i=t?n[0]:ds,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{useRef as zE,useEffect as $E}from"react";var us=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 Se("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 Se("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 Se("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw r.current?.reject(u),u}return c}import{jsx as QE}from"react/jsx-runtime";var qE=function(e){return()=>`id-${e++}`}(0);function jE(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function co(e){return e.error!==void 0}var Gt=new us,ic=new Map,KE=(e,t)=>typeof t=="bigint"?t.toString():t,YE=(e,t)=>`${e}${JSON.stringify(t,KE)}`;function po(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=YE(e,t);if(e==="privy:wallet:create"){let a=ic.get(n);if(a)return a}let i=new Promise((a,l)=>{let s=qE();Gt.enqueue(s,{resolve:a,reject:l}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{ic.delete(n)});return ic.set(n,i),i}function JE(e){switch(e.event){case"privy:iframe:ready":let t=Gt.dequeue(e.event,e.id);return co(e)?t.reject(new Se(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Gt.dequeue(e.event,e.id);return co(e)?o.reject(new Se(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Gt.dequeue(e.event,e.id);return co(e)?r.reject(new Se(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Gt.dequeue(e.event,e.id);return co(e)?n.reject(new Se(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Gt.dequeue(e.event,e.id);return co(e)?i.reject(new Se(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 co(e)?a.reject(new Se(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Gt.dequeue(e.event,e.id);return co(e)?l.reject(new Se(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Gt.dequeue(e.event,e.id);return co(e)?s.reject(new Se(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Gt.dequeue(e.event,e.id);return co(e)?s.reject(new Se(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Gt.dequeue(e.event,e.id);return co(e)?s.reject(new Se(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function gh(e){let t=zE(null),o=qd();return $E(()=>{let r=t.current;if(!r)return;function n(c){c&&c.origin===e.origin&&jE(c.data)&&JE(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 dd(()=>po("privy:iframe:ready",{},r),{abortSignal:s.signal}).then(a,l),()=>{window.removeEventListener("message",n),s.abort()}},[t.current,e.mfaMethods]),QE("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:ki(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function ac(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(r=>t.includes(r))}var ms=class{constructor(t,o){this.meta={action:t,phoneNumber:o}}async init(){if(!this.meta.action)throw new v("action required");if(!this.api)throw new v("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new v("phone number must be set when initialzing authentication.");try{let t=Hc();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 v("action required");if(!this.api)throw new v("Mfa flow has no API instance");if(!this.meta.smsCode)throw new v("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new v("phone number must be set prior to calling authenticate.");try{let t=Gc(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return ct(o)}catch(t){throw ie(t)}}};import{jsx as So,jsxs as vh}from"react/jsx-runtime";var hi;function o2(e){return typeof e=="string"&&e.length===25}function Ie(){if(!hi){let e=oe.get(or);return Promise.resolve(e||null)}return hi.getAccessToken()}var wh,yd=(e,t)=>wh(e,t),Ch,gd=(e,t)=>Ch(e,t),bh,vd=(e,t)=>bh(e,t),Eh,wd=()=>Eh(),r2=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;oe.put(xn,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},n2=({config:e,...t})=>{if(!o2(t.appId))throw new v("Cannot initialize the Privy provider with an invalid Privy app ID");hi||(hi=new Rn({appId:t.appId,apiUrl:t.apiUrl||Ti}));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."),So(i2,{...t,config:o,client:hi})},i2=e=>{let t=e.client,[o,r]=Te(!1),[n,i]=Te(!1),[a,l]=Te(!1),[s,c]=Te(null),[u,h]=Te(!1),[f,g]=Te([]),C=fi(f),[b,x]=Te(!1),[E,T]=Te(null),[M,A]=Te(!1),[W,N]=Te({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:P}),[R,U]=Te(null),[z,Z]=Te(null),[L,V]=Te(null),[B,se]=Te({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:""}),[O,ne]=Te(()=>{let d=yh(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",d),ps(B,e.config)}),[kt,Pe]=Te(!0),[it,le]=Te({}),[te,mo]=Te(null),[Vt,er]=Te(null),[Qe,ke]=Te(!1),[_o,xr]=Te(!1),re=fi(null),Rt=fi(null),J=fi(zd);t.onStoreToken=d=>{d&&ee(J,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{ee(J,"accessToken","onAccessTokenRemoved")};let he=fi(),bn=e2(d=>{let p=t.connectors?.walletsReady||!1;return a&&s?.linkedAccounts?.some(w=>w.type==="wallet"&&w.walletClientType==="privy")?p&&d?.some(w=>w?.walletClientType==="privy"):p},[a,s?.linkedAccounts,t?.connectors?.walletsReady]),ce=d=>{T(d),setTimeout(()=>{r(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:d})},zt=d=>{O.embeddedWallets.createOnLogin!=="off"&&Pe(!0),ce(d)};uo(()=>{if(!L||!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(L,p,O.defaultChain)}},[L,s]),uo(()=>{L&&Vt?.(L)},[L]),uo(()=>{(async()=>{if(!O.customAuth?.enabled)return;Pe(!0);let{getCustomAccessToken:p,isLoading:m}=O.customAuth;if(!(!n||m))try{let w=await p();if(!w){await _r.logout();return}if(a)return;t.startAuthFlow(new kr(w));let{user:I,isNewUser:H}=await t.authenticate();I||await _r.logout(),c(I||null),x(H||!1),l(!0),xr(!0)}catch(w){console.warn(w),a&&await _r.logout()}})()},[O.customAuth?.enabled,O.customAuth?.getCustomAccessToken,O.customAuth?.isLoading,n,a]),uo(()=>{_o&&L&&s&&vt(s,e.config?.embeddedWallets?.createOnLogin)&&(xr(!1),cc(s,Wr).catch(console.error))},[_o&&L&&s]),uo(()=>{async function d(){let p=await t.getServerConfig();se(p);let m=ps(p,e.config);ne(m),p.customApiUrl&&t.updateApiUrl(p.customApiUrl);let w=hs();r2();let I=XE();U(I),t.initializeConnectorManager(m.walletConnectCloudProjectId,m.rpcConfig,m.chains,m.defaultChain,I,m.appearance.walletList,m.shouldEnforceDefaultChainOnConnect),t.connectors?.initialize().then(()=>{at()});let H=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!H),H&&ee(J,"login","onComplete",H,!1,!0,null),c(H)),w||ye.setReadyToTrue(),w&&H&&h(!0)}n||d()},[t,te,n]),uo(()=>{let d=ps(B,e.config);ne(d)},[e.config,B]);let hs=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),m=d.get("privy_oauth_state"),w=d.get("privy_oauth_provider");return p&&m&&w?(t.startAuthFlow(new Ro(w,p,m)),zt("AWAITING_OAUTH_SCREEN"),!0):!1},En=async(d,p,m,w)=>{let I=await t.connectors?.createWalletConnector(d,p)||null;Ao(I,p,m,w)};async function Ao(d,p,m,w){if(!d)return N({status:"disconnected",connectedWallet:null,connectError:new q("Unable to connect to wallet."),connector:null,connectRetry:P}),w?.(null,m);d instanceof Qt&&p&&await d.resetConnection(p),N({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>Ao(d,p,m,w)});try{let I=await d.connect({showPrompt:!0});if(O.shouldEnforceDefaultChainOnConnect&&!O.chains.find(H=>H.id===Number(I?.chainId))&&!(I?.connectorType==="wallet_connect_v2"&&I?.walletClientType==="metamask")){N(H=>({...H,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:P}));try{await I?.switchChain(O.defaultChain.id),I&&(I.chainId=Mr(ar(O.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${O.defaultChain.id}`)}}return N(H=>({...H,status:"connected",connectedWallet:I,connectError:null,connectRetry:P})),I&&!M&&ee(J,"connectWallet","onSuccess",I),w?.(I,m)}catch(I){return I instanceof De?(console.warn(I.cause?I.cause:I.message),M||ee(J,"connectWallet","onError",I.privyErrorCode||"generic_connect_wallet_error")):(console.warn(I),M||ee(J,"connectWallet","onError","unknown_connect_wallet_error")),N(H=>({...H,status:"disconnected",connectedWallet:null,connectError:I})),w?.(null,m)}}let Re=async(d,p)=>{if(d===null)return;let m=new nr(d,p);t.startAuthFlow(m)},at=()=>{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()&&zt("LOGIN_FAILED_SCREEN"),!t.connectors)throw new v("Connector not initialized");ce("AWAITING_CONNECTION");let w=new URL(window.location.href);w.searchParams.delete("privy_connector"),w.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",w),En(p,m,void 0,Re)};uo(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let st=()=>{if(!a)throw new v("User must be authenticated before linking a wallet.");h(!0),ce("LINK_WALLET_SCREEN")},lc=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},Tn=async d=>{if(!t.connectors)throw new v("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(N(m=>({...m,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:P})),O.captchaEnabled&&!a){let m={callback:w=>Re(d,w),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};le({captchaModalData:m}),zt("CAPTCHA_SCREEN")}else await Re(d),zt("AWAITING_CONNECTION")},yt=async(d,p)=>{if(!O.fiatOnRamp.enabled)throw new v("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:m,externalTransactionId:w}=await qu(t,d,p?.config??{},O.appearance.palette,O.fiatOnRamp.useSandbox);return{signedUrl:m,externalTransactionId:w}}else throw new v("Unsupported fund provider. Currently supported option is `moonpay`.")},Sr=()=>{g(d=>{let p=t.connectors?.wallets.map(m=>({...m,linked:lc(m),loginOrLink:async()=>{if(!await m.isConnected())throw new v("Wallet is not connected");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new v("Cannot link or login with embedded wallet");Tn(m)},fund:async w=>{let{signedUrl:I,externalTransactionId:H}=await yt(m.address,w);le({fiatOnRampPrompt:{signedUrl:I},fiatOnRampStatus:{externalTransactionId:H}}),ce("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new v("User is not authenticated.");if(m.connectorType==="embedded"&&m.walletClientType==="privy")throw new v("Cannot unlink an embedded wallet");let w=await t.unlinkWallet(m.address);c(w)}}))||[];return ke(bn(p)),Wi(d,p)?d:p})};uo(()=>{Sr()},[s?.linkedAccounts,a,n]),uo(()=>{if(n){if(!t.connectors)throw new v("Connector not initialized");Sr(),t.connectors.on("walletsUpdated",Sr)}},[n]);let xh=()=>{ce(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};uo(()=>{if(!f[0])return;let d=f[0],p=C.current.find(w=>w.address===d.address),m;if(d.walletClientType==="privy"?m=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===d.address&&w.walletClientType==="privy"):m=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===d.address&&w.walletClientType!=="privy"),!p&&m){let w=Object.assign({},s);w.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(w)}C.current=f},[f]);let cc=async(d,p)=>{if(pe(d))throw ee(J,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[w,I]=await Promise.all([ye.initializeWalletProxy(p),Ie()]);if(!w&&e.config?.customAuth?.enabled)throw ee(J,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!w||!I||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((H,de)=>{Pe(!0),le({createWallet:{onSuccess:Xe=>{ee(J,"createWallet","onSuccess",Xe),H(Xe)},onFailure:Xe=>{ee(J,"createWallet","onError","unknown_embedded_wallet_error"),de(Xe)},callAuthOnSuccessOnClose:!1}}),ce("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await w.create({accessToken:I});let H=await ye.refreshUser(),de=pe(H);if(!de)throw ee(J,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return ee(J,"createWallet","onSuccess",de),de}},Sh=d=>{if(!O.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")},dc=(d,p,m)=>new Promise(async(w,I)=>{if(!a||!s){I(new Error("User must be authenticated before signing with a Privy wallet"));return}let H=pe(s);if(!H){I(new Error("Must have a Privy wallet before signing"));return}Pe(!0);let de=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,Ze=d.chainId?Number(d.chainId):de.chainId;Sh(Ze);let Xe=Object.assign({},d,{chainId:Ze}),fo=async()=>{let gt=await Ie();if(!gt||!L){I(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await ye.recoverEmbeddedWallet()){I(new Error("Unable to connect to wallet"));return}let mc=new ZE(Mt(Xe.chainId,O.chains,O.rpcConfig)),Ah=await gn(H.address,Xe,mc),kh=await rs(gt,H.address,L,Ah,mc);w(kh)}catch(ko){I(ko)}};if(O.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),fo();else{let gt={transactionRequest:Xe,onSuccess:w,onFailure:I,uiOptions:p||{},fundWalletConfig:m},ko={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:I};le({connectWallet:ko,sendTransaction:gt}),ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function pc(){return new Promise(async(d,p)=>{let m=await Ie();if(!m||!L)throw new Error("Must have valid access token to enroll in MFA");try{await L.verifyMfa({accessToken:m}),d()}catch(w){p(w)}})}let _r={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:xh,linkWallet:st,linkEmail:()=>{if(!a)throw new v("User must be authenticated before linking an email address.");if(s?.email)throw new v("User already has an email linked to their account.");h(!0),ce("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(!a)throw new v("User must be authenticated before linking a phone number.");if(s?.phone)throw new v("User already has a phone number linked to their account.");h(!0),ce("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(!a)throw new v("User must be authenticated before linking a Google account.");if(s?.google)throw new v("User already has a Google account linked to their account.");await ye.initLoginWithOAuth("google")},linkTwitter:async()=>{if(!a)throw new v("User must be authenticated before linking a Twitter account.");if(s?.twitter)throw new v("User already has a Twitter account linked to their account.");await ye.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(!a)throw new v("User must be authenticated before linking a Discord account.");if(s?.discord)throw new v("User already has a Discord account linked to their account.");await ye.initLoginWithOAuth("discord")},linkGithub:async()=>{if(!a)throw new v("User must be authenticated before linking a GitHub account.");if(s?.github)throw new v("User already has a Github account linked to their account.");await ye.initLoginWithOAuth("github")},linkTiktok:async()=>{if(!a)throw new v("User must be authenticated before linking a TikTok account.");if(s?.tiktok)throw new v("User already has a Tiktok account linked to their account.");await ye.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(!a)throw new v("User must be authenticated before linking a LinkedIn account.");if(s?.linkedin)throw new v("User already has a LinkedIn account linked to their account.");await ye.initLoginWithOAuth("linkedin")},linkApple:async()=>{if(!a)throw new v("User must be authenticated before linking an Apple account.");await ye.initLoginWithOAuth("apple")},linkFarcaster:async()=>{if(!a)throw new v("User must be authenticated before linking a Farcaster account.");await ye.initLoginWithFarcaster(),h(!0),ce("AWAITING_FARCASTER_CONNECTION")},login:async()=>{if(n||(await new Promise(d=>{mo(()=>d)}),mo(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}A(!0),zt("LANDING")},logout:async()=>{await t.logout(),c(null),l(!1),T(null),ee(J,"logout","onSuccess"),h(!1),r(!1),oe.del(Sn)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new ue;let d=f.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===d?.address));return!d||!p?new ue:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new sc(new Kt(new ue));let d=f.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===d?.address));return!d||!p?new sc(new Kt(new ue)):new sc(new Kt(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new No(new ue);let d=f.find(m=>s.wallet&&m.address===s.wallet.address),p=t.connectors?.walletConnectors.find(m=>m.wallets.find(w=>w.address===d?.address));return!d||!p?new No(new ue):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(w=>fs(w.address)===fs(d)),m=s?.linkedAccounts.find(w=>w.type==="wallet"&&fs(w.address)===fs(d));if(!p||!await p.isConnected())Z(d),st();else if(!p.linked)p.loginOrLink();else{let w=Object.assign({},s);w.wallet=m&&{address:m.address,chainType:m.chainType,chainId:m.chainId,walletClient:m.walletClient,walletClientType:m.walletClientType,connectorType:m.connectorType},c(w)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw ee(J,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return cc(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw ee(J,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=pe(s);if(!d||!L)throw ee(J,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw ee(J,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await pc()}catch(p){throw ee(J,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,m)=>{Pe(!0);let w={onSuccess:H=>{ee(J,"setWalletPassword","onSuccess",H),p(H)},onFailure:H=>{ee(J,"setWalletPassword","onError","user_exited_set_password_flow"),m(H)},callAuthOnSuccessOnClose:!1},I={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:H=>{ee(J,"setWalletPassword","onError","unknown_connect_wallet_error"),m(H)}};le({setWalletPassword:w,connectWallet:I}),ce("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(m,w)=>{if(!a||!s){w(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=pe(s);if(!I){w(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){w(new Error("Message must be a non-empty string"));return}Pe(!0);let H=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let de=await Ie();if(!L||!de)throw new Error("Unable to connect to wallet");if(!await ye.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:I.address});let{response:Xe}=await L.rpc({accessToken:de,address:I.address,request:{method:"personal_sign",params:[d,I.address]}}),fo=Xe.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:I.address}),fo};if(O.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let de=await H();m(de)}catch(de){w(de??new Ue("Unable to sign message"))}}else{let Xe={method:"personal_sign",data:d,confirmAndSign:H,onSuccess:gt=>{m(gt)},onFailure:gt=>{w(gt)},uiOptions:p||{}},fo={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:w};le({signMessage:Xe,connectWallet:fo}),ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(m,w)=>{if(!a||!s){w(new Error("User must be authenticated before signing with a Privy wallet"));return}let I=pe(s);if(!I){w(new Error("Must have a Privy wallet before signing"));return}Pe(!0);let H=Ri(d),de=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Ze=await Ie();if(!L||!Ze)throw new Error("Unable to connect to wallet");if(!await ye.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:I.address});let{response:fo}=await L.rpc({accessToken:Ze,address:I.address,request:{method:"eth_signTypedData_v4",params:[I.address,H]}}),gt=fo.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:I.address}),gt};if(O.embeddedWallets.noPromptOnSignature||(B?.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Ze=await de();m(Ze)}catch(Ze){w(Ze??new Ue("Unable to sign message"))}}else{let fo={method:"eth_signTypedData_v4",data:H,confirmAndSign:de,onSuccess:ko=>{m(ko)},onFailure:ko=>{w(ko)},uiOptions:p||{}},gt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:w};le({signMessage:fo,connectWallet:gt}),ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,m)=>{let I=await(await dc(d,p,m)).wait();return is(I)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let m=pe(s);if(!m){p(new Error("Must have a Privy wallet before exporting"));return}Pe(!0);let w={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},I=await Ie();if(!I||!L){p(new Error("Must have valid access token to enroll in MFA"));return}if(!L){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await L.connect({accessToken:I,address:m.address}),await L.verifyMfa({accessToken:I})}catch(de){if(ur(de))await ye.recoverEmbeddedWallet();else throw de}}catch(de){p(de);return}let H={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};le({keyExport:H,connectWallet:w}),ce("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:pc,async init(d){let p;switch(d){case"sms":p=new ms("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":re.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((m,w)=>{Rt.current={resolve:m,reject:w}});break;default:throw re.current?.reject(new v("Unsupported MFA method")),new v(`Unsupported MFA method: ${d}`)}},cancel(){re.current?.reject(new v("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Ie();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,m)=>{if(!d){ye.closePrivyModal(),p();return}O.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),le({mfaEnrollmentFlow:{mfaMethods:O.mfa.methods,onSuccess:p,onFailure:m}}),ce("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Ie();if(!d||!L)throw new Error("Must have valid access token to enroll in MFA");let p=await L.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Ie();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async submitEnrollmentWithTotp(d){let p=await Ie();if(!p||!L)throw new Error("Must have valid access token to enroll in MFA");await L.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let m=await t.getAuthenticatedUser();c(m)},async unenroll(d){let p=await Ie();if(!p||!L)throw new Error("Must have valid access token to remove MFA");await L.unenrollMfa({method:d,accessToken:p});let m=await t.getAuthenticatedUser();c(m)},loginWithCode(d){return ye.loginWithCode(d)},initLoginWithEmail(d){return ye.initLoginWithEmail(d)},initLoginWithSms(d){return ye.initLoginWithSms(d)},isModalOpen:o};wh=_r.signMessage,Ch=_r.signTypedData,bh=async(...d)=>{let p=await dc(...d);return O.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let uc=!!e.config?.headless,ye=(()=>({headless:uc,isNewUserThisSession:b,isLinking:u,linkingHint:z,pendingTransaction:null,walletConnectionStatus:W,mipdStore:R,connectors:t.connectors?.walletConnectors??[],rpcConfig:O.rpcConfig,chains:O.chains,showFiatPrices:O.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>O.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(L)return L;let p=new Promise(I=>{er(()=>H=>I(H))}),m=new Promise(I=>setTimeout(()=>I(null),d)),w=await Promise.race([p,m]);return er(null),w},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(ee(J,"login","onComplete",s,b,!1,he.current??null),e.onSuccess?.(s,b)):M&&ee(J,"login","onError","exited_auth_flow"),Z(null),A(!1),h(!1),x(!1),r(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:ce,connectWallet:Ao,initLoginWithWallet:async(d,p)=>{he.current="siwe",Re(d,p)},loginWithWallet:async()=>{if(!n)throw new Ar;if(!(t.authFlow instanceof nr))throw new v("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 ee(J,"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{he.current="farcaster",await p.initializeFarcasterConnect()}catch(m){throw ee(J,"login","onError",m.privyErrorCode||"unknown_auth_error"),m}},loginWithFarcaster:async()=>{if(!n)throw new Ar;if(!(t.authFlow instanceof Pn))throw new v("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 ee(J,"login","onError",m.privyErrorCode||"generic_connect_wallet_error"),m}c(d||null),x(p||!1),l(!0)},initLoginWithOAuth:async(d,p)=>{if(rd()){if(d==="google"&&ac(window.navigator.userAgent)){zt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{zt("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let m=new Ro(d);p&&m.addCaptchaToken(p),t.startAuthFlow(m);let w=await t.authFlow.getAuthorizationUrl();w&&w.url&&window.location.assign(w.url)},loginWithOAuth:async d=>{if(!(t.authFlow instanceof Ro))throw new v("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 v("Unexpected auth flow. This may be a phishing attempt.");let w,I;if(a)w=await t.link();else try{({user:w,isNewUser:I}=await t.authenticate()),he.current=d}catch(H){throw ee(J,"login","onError",H.privyErrorCode||"unknown_auth_error"),H}c(w),x(I||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let m=new tr(d,p);t.startAuthFlow(m);try{he.current="email",await m.sendCodeEmail()}catch(w){throw ee(J,"login","onError",w.privyErrorCode||"unknown_auth_error"),w}},initLoginWithSms:async(d,p)=>{let m=new ir(d,p);t.startAuthFlow(m);try{he.current="sms",await m.sendSmsCode()}catch(w){throw ee(J,"login","onError",w.privyErrorCode||"unknown_auth_error"),w}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(!n)throw new Ar;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 v("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:L,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(I=>I.type==="wallet"&&I.walletClientType==="privy"),w=await Ie();if(!w||!L||!m){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Pe(!0);try{await L.connect({accessToken:w,address:m.address}),d(!0)}catch(I){ur(I)&&m.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:m.address}),(await L.recover({address:m.address,accessToken:w})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:m.address}),d(!0)):ur(I)?(le({recoverWallet:{privyWallet:m,onFailure:p,onSuccess:()=>d(!0)}}),ce("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(I)}}),getFiatOnRampConfig:yt,setReadyToTrue:()=>{i(!0),te?.()},updateWallets:()=>Sr()}))();Eh=ye.recoverEmbeddedWallet;let _h=t2(()=>({wallets:f,ready:Qe}),[f,Qe]);return So(ge.Provider,{value:_r,children:So(Ls.Provider,{value:J,children:So(Ql.Provider,{value:_h,children:vh(Hd,{...O,children:[e.children,vh(Ns.Provider,{value:ye,children:[!uc&&O.captchaEnabled&&n&&!a&&So(Ms,{delayedExecution:!1}),So(Jf,{theme:{...O.appearance.palette||{}}}),So(xd,{appConfig:O,data:it,setModalData:le,setInitialScreen:T,initialScreen:E,authenticated:a,open:o,children:So(eh,{open:o})}),kt&&B.id?So(gh,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:re,mfaSubmitPromise:Rt,onLoad:V,onLoadFailed:()=>null}):null]})]})})})})};import{useContext as a2}from"react";function s2(e){let{login:t}=a2(ge);return rt("login",e),{login:t}}import{useContext as l2}from"react";function c2(e){let{logout:t}=l2(ge);return rt("logout",e),{logout:t}}import{useCallback as Th}from"react";var d2=()=>{let e=fe(),{initLoginWithEmail:t,loginWithCode:o}=F(),r=Th(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return e.status==="disabled",t(i)},[t]),n=Th(async({code:i})=>{if(e.enabled&&e.status==="error")throw new go(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};import{useCallback as Ph}from"react";var p2=()=>{let e=fe(),{initLoginWithSms:t,loginWithCode:o}=F(),r=Ph(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return e.status==="disabled",t(i)},[t]),n=Ph(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new go(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};import{useContext as u2}from"react";function m2(e){let{connectWallet:t}=u2(ge);return rt("connectWallet",e),{connectWallet:t}}import{useContext as f2}from"react";function h2(e){let{createWallet:t}=f2(ge);return rt("createWallet",e),{createWallet:t}}import{useContext as y2}from"react";function g2(e){let{setWalletPassword:t}=y2(ge);return rt("setWalletPassword",e),{setWalletPassword:t}}import{useContext as v2}from"react";var w2=()=>{let{isModalOpen:e}=v2(ge);return{isOpen:e}};import{useContext as C2}from"react";function b2(e){let{getAccessToken:t}=C2(ge);return rt("accessToken",e),{getAccessToken:t}}function E2(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}export{Kt as AsExternalProvider,Ms as Captcha,kn as ConnectorManager,Rn as PrivyClient,n2 as PrivyProvider,ue as PrivyProxyProvider,mi as SUPPORTED_CHAINS,vs as VERSION,ot as WalletConnector,E2 as addRpcUrlOverrideToChain,cl as errorIndicatesMaxMfaRetries,Xr as errorIndicatesMfaTimeout,en as errorIndicatesMfaVerificationFailed,Ie as getAccessToken,m2 as useConnectWallet,h2 as useCreateWallet,s2 as useLogin,d2 as useLoginWithEmail,p2 as useLoginWithSms,c2 as useLogout,fn as useMfa,ri as useMfaEnrollment,w2 as useModalStatus,F as usePrivy,Os as useRegisterMfaListener,g2 as useSetWalletPassword,b2 as useToken,pi as useWallets};
|
|
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",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};
|