@privy-io/react-auth 1.57.1 → 1.57.2-beta-20240227212848
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +223 -223
- package/dist/index.d.ts +94 -3
- package/dist/index.js +223 -223
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Cg=Object.create;var ea=Object.defineProperty;var bg=Object.getOwnPropertyDescriptor;var Eg=Object.getOwnPropertyNames;var Tg=Object.getPrototypeOf,Pg=Object.prototype.hasOwnProperty;var xg=(e,t)=>{for(var o in t)ea(e,o,{get:t[o],enumerable:!0})},qc=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Eg(t))!Pg.call(e,n)&&n!==o&&ea(e,n,{get:()=>t[n],enumerable:!(r=bg(t,n))||r.enumerable});return e};var f=(e,t,o)=>(o=e!=null?Cg(Tg(e)):{},qc(t||!e||!e.__esModule?ea(o,"default",{value:e,enumerable:!0}):o,e)),Sg=e=>qc(ea({},"__esModule",{value:!0}),e);var al=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var jc=(e,t,o)=>(al(e,t,"read from private field"),o?o.call(e):t.get(e)),ta=(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)},sl=(e,t,o,r)=>(al(e,t,"write to private field"),r?r.call(e,o):t.set(e,o),o);var Kc=(e,t,o)=>(al(e,t,"access private method"),o);var VC={};xg(VC,{AsExternalProvider:()=>lo,Captcha:()=>ja,ConnectorManager:()=>Wn,PrivyClient:()=>Mn,PrivyProvider:()=>Zy,PrivyProxyProvider:()=>Pe,SUPPORTED_CHAINS:()=>kn,VERSION:()=>ca,WalletConnector:()=>pt,addRpcUrlOverrideToChain:()=>hg,errorIndicatesMaxMfaRetries:()=>gs,errorIndicatesMfaTimeout:()=>Kr,errorIndicatesMfaVerificationFailed:()=>Yr,getAccessToken:()=>$e,useConnectWallet:()=>ag,useCreateWallet:()=>lg,useLogin:()=>eg,useLoginWithEmail:()=>rg,useLoginWithSms:()=>ng,useLogout:()=>og,useMfa:()=>an,useMfaEnrollment:()=>ai,useModalStatus:()=>ug,usePrivy:()=>G,useRegisterMfaListener:()=>Qa,useSetWalletPassword:()=>dg,useToken:()=>fg,useWallets:()=>ui});module.exports=Sg(VC);var Qi=require("@ethersproject/address"),yi=require("@ethersproject/providers"),jy=require("mipd"),j=require("react");var Yc=require("ofetch"),et=class extends Error{constructor(o,r,n){super(o);r instanceof Error&&(this.cause=r),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},To=class extends et{constructor(o,r,n,i,a){super(n,i,a);this.type=o;this.status=r}},C=class extends et{constructor(o,r,n){super(o,r,n);this.type="client_error"}},oa=class extends C{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var Y=class extends et{constructor(o,r,n){super(o,r,n);this.type="connector_error"}},fe=e=>{if(e instanceof et)return e;if(!(e instanceof Yc.FetchError))return lt(e);if(!e.response)return new To("api_error",null,e.message,e);let{type:t,message:o,error:r,code:n}=e.data;return new To(t||"ApiError",e.response.status,o||r,e,n)},lt=e=>e instanceof et?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var hn=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Rt=class extends C{constructor(t="Embedded wallet error",o){super(t,o,"unknown_embedded_wallet_error")}},ra=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var na=()=>"/api/v1/sessions",ia=()=>"/api/v1/sessions/logout",Jc=()=>"/api/v1/sessions/fork",aa=()=>"/api/v1/sessions/fork/recover",Qc=()=>"/api/v1/siwe/init",Zc=()=>"/api/v1/siwe/authenticate",Xc=()=>"/api/v1/siwe/link",ed=()=>"/api/v1/farcaster/init",td=()=>"/api/v1/farcaster/authenticate",od=()=>"/api/v1/farcaster/link",rd=()=>"/api/v1/farcaster/status",nd=()=>"/api/v1/passwordless/init",id=()=>"/api/v1/passwordless/authenticate",ad=()=>"/api/v1/passwordless/link",sd=()=>"/api/v1/passwordless_sms/init",ld=()=>"/api/v1/passwordless_sms/authenticate",cd=()=>"/api/v1/passwordless_sms/link",dd=()=>"/api/v1/oauth/init",pd=()=>"/api/v1/oauth/authenticate",ud=()=>"/api/v1/oauth/link",md=()=>"/api/v1/siwe/unlink",fd=()=>"/api/v1/passwordless/unlink",hd=()=>"/api/v1/passwordless_sms/unlink",yd=()=>"/api/v1/oauth/unlink",gd=()=>"/api/v1/farcaster/unlink",vd=()=>"/api/v1/analytics_events",wd=()=>"/api/v1/plugins/moonpay_on_ramp/sign",Cd=()=>"/api/v1/custom_jwt_account/authenticate",bd=()=>"/api/v1/mfa/passwordless_sms/init";var Ed=()=>"/api/v1/mfa/passwordless_sms/enroll";var Td=()=>"/api/v1/users/me/accept_terms";var yn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=Cd(),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 fe(t)}}async link(){throw new Error("Unimplemented")}};var Fr=class{constructor(t,o){this.meta={email:t,captchaToken:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=id(),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 fe(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=ad();return await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw fe(t)}}async sendCodeEmail(t,o){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),o&&(this.meta.captchaToken=o),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{let r=nd();return await this.api.post(r,{email:this.meta.email,token:this.meta.captchaToken})}catch(r){throw fe(r)}}};var Pd=require("react-device-detect");var ct=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 wi=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new ct(this._startChannelOnce.bind(this)),this.pollForReady=new ct(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");try{let t=await this.api.post(td(),{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new C("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 fe(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(od(),{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw fe(t)}}async _startChannelOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.api.post(ed(),{token:this.captchaToken});Pd.isMobile&&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 C("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");let t=await this.api.get(rd(),{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}};var hl=require("jose");var xd="1.57.1";var sa="4df5e2316331463a9130964bd6078dfa",Sd="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",_d="34357d3c125c2bcf2ce2bc3309d98715",la="https://auth.privy.io",Ad=2e4,dt=1400,kd=2500,ca=xd;var Br="privy:token",ll="privy-token",da="privy:refresh_token",cl="privy-refresh-token",pa="privy-session",Ci="privy:session_transfer_token",Ag="privy:wallet",bi="privy:caid",gn="privy:state_code",vn="privy:code_verifier",ua=e=>`${Ag}:${e}`,dl="privy:connectors",pl="privy:connections";var Hr=12e4,Yo=1,ul="0x1",wn=3e4,Rd="https://api.moonpay.com/v1",Id="https://api.moonpay.com/v1",Wd="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Md="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Nd="0x420000000000000000000000000000000000000F",Ld=["function getL1Fee(bytes memory _data) external view returns (uint256)"];async function Od(e){let t=new TextEncoder().encode(e),o=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(o)}function Dd(e){return crypto.getRandomValues(new Uint8Array(e))}var ma=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)}},ml=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)}},fl=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 Ud(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function kg(){return typeof window<"u"&&window.localStorage?new ml:new ma}function Rg(){return typeof window<"u"&&window.sessionStorage?new fl:new ma}var no=Rg(),ce=kg();var Ig="S256",Wg="S256",fr=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 C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=no.get(vn);if(!t)throw new C("Authentication error.");try{let o=pd(),r=await this.api.post(o,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return no.del(vn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(o){let r=fe(o);throw r.privyErrorCode?new C(r.message||"Invalid code during OAuth flow.",void 0,r.privyErrorCode):r.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=no.get(vn);if(!t)throw new C("Authentication error.");try{let o=ud(),r=await this.api.post(o,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return no.del(vn),r}catch(o){throw fe(o)}}createCodeVerifier(){return hl.base64url.encode(Dd(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,o=Ig){if(o==Wg){let r=await Od(t);return hl.base64url.encode(r)}else return t}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();no.put(vn,t);let o=this.createStateCode();no.put(gn,o);let r=await this.deriveCodeChallengeFromCodeVerifier(t);try{let n=dd();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 fe(n)}}};var Gr=class{constructor(t,o){this.createSiweMessage=(t,o,r,n,i,a,l)=>`${r} wants you to sign in with your Ethereum account:
|
|
1
|
+
"use strict";var Sg=Object.create;var ta=Object.defineProperty;var _g=Object.getOwnPropertyDescriptor;var Ag=Object.getOwnPropertyNames;var kg=Object.getPrototypeOf,Rg=Object.prototype.hasOwnProperty;var Ig=(e,t)=>{for(var o in t)ta(e,o,{get:t[o],enumerable:!0})},jc=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ag(t))!Rg.call(e,n)&&n!==o&&ta(e,n,{get:()=>t[n],enumerable:!(r=_g(t,n))||r.enumerable});return e};var f=(e,t,o)=>(o=e!=null?Sg(kg(e)):{},jc(t||!e||!e.__esModule?ta(o,"default",{value:e,enumerable:!0}):o,e)),Wg=e=>jc(ta({},"__esModule",{value:!0}),e);var sl=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var Kc=(e,t,o)=>(sl(e,t,"read from private field"),o?o.call(e):t.get(e)),oa=(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)},ll=(e,t,o,r)=>(sl(e,t,"write to private field"),r?r.call(e,o):t.set(e,o),o);var Yc=(e,t,o)=>(sl(e,t,"access private method"),o);var YC={};Ig(YC,{AsExternalProvider:()=>co,Captcha:()=>Ka,ConnectorManager:()=>Mn,PrivyClient:()=>Nn,PrivyProvider:()=>Xy,PrivyProxyProvider:()=>xe,SUPPORTED_CHAINS:()=>Rn,VERSION:()=>da,WalletConnector:()=>ft,addRpcUrlOverrideToChain:()=>Eg,errorIndicatesMaxMfaRetries:()=>vs,errorIndicatesMfaTimeout:()=>Yr,errorIndicatesMfaVerificationFailed:()=>Jr,getAccessToken:()=>qe,useConnectWallet:()=>sg,useCreateWallet:()=>cg,useLogin:()=>tg,useLoginWithEmail:()=>ng,useLoginWithSms:()=>ig,useLogout:()=>rg,useMfa:()=>sn,useMfaEnrollment:()=>si,useModalStatus:()=>wg,usePrivy:()=>V,useRegisterMfaListener:()=>Za,useSendTransaction:()=>pg,useSetWalletPassword:()=>mg,useSignMessage:()=>hg,useSignTypedData:()=>gg,useToken:()=>bg,useWallets:()=>mi});module.exports=Wg(YC);var Zi=require("@ethersproject/address"),gi=require("@ethersproject/providers"),Ky=require("mipd"),K=require("react");var Jc=require("ofetch"),tt=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}]`:""}`}},Po=class extends tt{constructor(o,r,n,i,a){super(n,i,a);this.type=o;this.status=r}},C=class extends tt{constructor(o,r,n){super(o,r,n);this.type="client_error"}},ra=class extends C{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends tt{constructor(o,r,n){super(o,r,n);this.type="connector_error"}},fe=e=>{if(e instanceof tt)return e;if(!(e instanceof Jc.FetchError))return pt(e);if(!e.response)return new Po("api_error",null,e.message,e);let{type:t,message:o,error:r,code:n}=e.data;return new Po(t||"ApiError",e.response.status,o||r,e,n)},pt=e=>e instanceof tt?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var yn=class extends C{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},It=class extends C{constructor(t="Embedded wallet error",o){super(t,o,"unknown_embedded_wallet_error")}},na=class extends C{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var ia=()=>"/api/v1/sessions",aa=()=>"/api/v1/sessions/logout",Qc=()=>"/api/v1/sessions/fork",sa=()=>"/api/v1/sessions/fork/recover",Zc=()=>"/api/v1/siwe/init",Xc=()=>"/api/v1/siwe/authenticate",ed=()=>"/api/v1/siwe/link",td=()=>"/api/v1/farcaster/init",od=()=>"/api/v1/farcaster/authenticate",rd=()=>"/api/v1/farcaster/link",nd=()=>"/api/v1/farcaster/status",id=()=>"/api/v1/passwordless/init",ad=()=>"/api/v1/passwordless/authenticate",sd=()=>"/api/v1/passwordless/link",ld=()=>"/api/v1/passwordless_sms/init",cd=()=>"/api/v1/passwordless_sms/authenticate",dd=()=>"/api/v1/passwordless_sms/link",pd=()=>"/api/v1/oauth/init",ud=()=>"/api/v1/oauth/authenticate",md=()=>"/api/v1/oauth/link",fd=()=>"/api/v1/siwe/unlink",hd=()=>"/api/v1/passwordless/unlink",yd=()=>"/api/v1/passwordless_sms/unlink",gd=()=>"/api/v1/oauth/unlink",vd=()=>"/api/v1/farcaster/unlink",wd=()=>"/api/v1/analytics_events",Cd=()=>"/api/v1/plugins/moonpay_on_ramp/sign",bd=()=>"/api/v1/custom_jwt_account/authenticate",Ed=()=>"/api/v1/mfa/passwordless_sms/init";var Td=()=>"/api/v1/mfa/passwordless_sms/enroll";var Pd=()=>"/api/v1/users/me/accept_terms";var gn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let t=bd(),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 fe(t)}}async link(){throw new Error("Unimplemented")}};var Br=class{constructor(t,o){this.meta={email:t,captchaToken:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=ad(),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 fe(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=sd();return await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw fe(t)}}async sendCodeEmail(t,o){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),o&&(this.meta.captchaToken=o),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{let r=id();return await this.api.post(r,{email:this.meta.email,token:this.meta.captchaToken})}catch(r){throw fe(r)}}};var xd=require("react-device-detect");var ut=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 Ci=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new ut(this._startChannelOnce.bind(this)),this.pollForReady=new ut(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");try{let t=await this.api.post(od(),{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new C("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 fe(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{return await this.api.post(rd(),{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw fe(t)}}async _startChannelOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.api.post(td(),{token:this.captchaToken});xd.isMobile&&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 C("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.channelToken)throw new C("Auth flow must be initialized first");let t=await this.api.get(nd(),{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}};var yl=require("jose");var Sd="1.57.2-beta-20240227212848";var la="4df5e2316331463a9130964bd6078dfa",_d="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Ad="34357d3c125c2bcf2ce2bc3309d98715",ca="https://auth.privy.io",kd=2e4,mt=1400,Rd=2500,da=Sd;var Hr="privy:token",cl="privy-token",pa="privy:refresh_token",dl="privy-refresh-token",ua="privy-session",bi="privy:session_transfer_token",Ng="privy:wallet",Ei="privy:caid",vn="privy:state_code",wn="privy:code_verifier",ma=e=>`${Ng}:${e}`,pl="privy:connectors",ul="privy:connections";var Gr=12e4,Qo=1,ml="0x1",Cn=3e4,Id="https://api.moonpay.com/v1",Wd="https://api.moonpay.com/v1",Md="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Nd="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Ld="0x420000000000000000000000000000000000000F",Od=["function getL1Fee(bytes memory _data) external view returns (uint256)"];async function Dd(e){let t=new TextEncoder().encode(e),o=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(o)}function Ud(e){return crypto.getRandomValues(new Uint8Array(e))}var fa=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)}},fl=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)}},hl=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 Fd(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function Lg(){return typeof window<"u"&&window.localStorage?new fl:new fa}function Og(){return typeof window<"u"&&window.sessionStorage?new hl:new fa}var io=Og(),ce=Lg();var Dg="S256",Ug="S256",hr=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 C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=io.get(wn);if(!t)throw new C("Authentication error.");try{let o=ud(),r=await this.api.post(o,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return io.del(wn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(o){let r=fe(o);throw r.privyErrorCode?new C(r.message||"Invalid code during OAuth flow.",void 0,r.privyErrorCode):r.message==="User denied confirmation during OAuth flow"?new C("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new C("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");let t=io.get(wn);if(!t)throw new C("Authentication error.");try{let o=md(),r=await this.api.post(o,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return io.del(wn),r}catch(o){throw fe(o)}}createCodeVerifier(){return yl.base64url.encode(Ud(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,o=Dg){if(o==Ug){let r=await Dd(t);return yl.base64url.encode(r)}else return t}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();io.put(wn,t);let o=this.createStateCode();io.put(vn,o);let r=await this.deriveCodeChallengeFromCodeVerifier(t);try{let n=pd();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 fe(n)}}};var Vr=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 ct(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 C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Zc(),{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 fe(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(Xc(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw fe(t)}}async sign(){if(!this.api)throw new C("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new C("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Qc(),{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new C("Auth flow has no API instance");let t=this.wallet.address,o=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(o,t,this.nonce),this.preparedMessage}prepareMessage(t,o,r){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,o,n,i,l,r,a)}};var Vr=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=ld(),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 fe(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=cd();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw fe(t)}}async sendSmsCode(t,o){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{let r=sd();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw fe(r)}}};var Gp=require("uuid");function Ct(e){return new Date(e*1e3)}function Mg(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:Ct(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:Ct(o.verified_at)};t.push(i);break;case"phone":let a={number:o.phoneNumber,type:o.type,verifiedAt:Ct(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:Ct(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:Ct(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:Ct(o.verified_at)};t.push(c);break;case"github_oauth":let m={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:Ct(o.verified_at)};t.push(m);break;case"tiktok_oauth":let g={subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:Ct(o.verified_at)};t.push(g);break;case"linkedin_oauth":let y={subject:o.subject,name:o.name,email:o.email,type:o.type,verifiedAt:Ct(o.verified_at)};t.push(y);break;case"apple_oauth":let v={subject:o.subject,email:o.email,type:o.type,verifiedAt:Ct(o.verified_at)};t.push(v);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:Ct(o.verified_at)});break;case"farcaster":let b={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:Ct(o.verified_at)};t.push(b);break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function io(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var xe=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,Ng=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Gt=(e,t)=>t==="all-users"&&!xe(e)||t==="users-without-wallets"&&!Ng(e)?.length;function It(e){if(!e)return null;let t=Mg(e.linked_accounts),o=io(t,"wallet"),r=io(t,"email"),n=io(t,"phone"),i=io(t,"google_oauth"),a=io(t,"twitter_oauth"),l=io(t,"discord_oauth"),s=io(t,"github_oauth"),c=io(t,"tiktok_oauth"),m=io(t,"linkedin_oauth"),g=io(t,"apple_oauth"),y=io(t,"farcaster"),v=e.mfa_methods.map(({type:E,verified_at:S})=>({type:E,verifiedAt:Ct(S)}));return{id:e.id,createdAt:Ct(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:m&&{subject:m.subject,name:m.name,email:m.email},apple:g&&{subject:g.subject,email:g.email},farcaster:y&&{fid:y.fid,ownerAddress:y.ownerAddress,displayName:y.displayName,username:y.username,bio:y.bio,pfp:y.pfp,url:y.url},mfaMethods:v.map(E=>E.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var Sl=require("@ethersproject/address"),Up=f(require("eventemitter3"));function Fd(){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 fa=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 yl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||fa(e)!=="MetaMask")return!1;if(e.providers){for(let o of e.providers)if(!yl(o))return!1}return!0},hr=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Bd=()=>{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 Hd=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,}))$/),Gd=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},yr=(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}`},gl=e=>new Promise(t=>setTimeout(t,e));function Vd(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 zd=(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 gl(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},ha=(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 vl=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),zr=e=>typeof e=="string"?e:"0x"+e.toString(16);async function $d(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 Fd()){let m=fa(c);if(!l.some(g=>g.info.name===m)){if(yl(c,!0)&&!s.find(g=>g.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(m==="Phantom"&&!s.find(g=>g.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}s.find(g=>g.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function Cn(e){return`eip155:${String(Number(e))}`}var ao=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new Y(`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]+"/"+sa:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+Sd:i=n.rpcUrls.default?.http[0],!i)throw new Y(`No RPC url found for ${e}`);return i},qd=(e,t)=>{let o=Number(e),r=t.find(n=>n.id===o);if(!r)throw new Y(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url},ya=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}}};var tp=f(require("@coinbase/wallet-sdk"));var Ei=require("react/jsx-runtime"),Ti=({style:e,...t})=>(0,Ei.jsxs)("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:[(0,Ei.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Ei.jsx)("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"})]});var co=require("@ethersproject/address"),Cl=require("@ethersproject/providers"),ep=f(require("eventemitter3"));var wl=require("@ethersproject/providers"),Yd=f(require("eventemitter3"));var Lg=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],jd=e=>Lg.includes(e);var Kd=require("@ethersproject/logger");var bn=class extends Y{constructor(){super("Wallet timeout");this.type="wallet_error"}},En=class extends Y{constructor(){super("User rejected connection");this.type="wallet_error"}},so=e=>{if(e instanceof Y)return e;if(e?.code&&e?.reason){let t=new tt(e);return e.code===Kd.ErrorCode.ACTION_REJECTED&&(t.details=bt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new tt(e):new Y("Unknown connector error",e)},xo=class extends et{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},tt=class extends xo{constructor(o){let r=o;super(r.message,r.code,r.data);let n=Object.values(bt).find(i=>i.eipCode===r.code);this.details=n||bt.UNKNOWN_ERROR,r.code===-32002&&(r.message?.includes("already pending for origin")?r.message?.includes("wallet_requestPermissions")?this.details=bt.E32002_CONNECTION_ALREADY_PENDING:this.details=bt.E32002_REQUEST_ALREADY_PENDING:r.message?.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=bt.E32002_WALLET_LOCKED))}},Og={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}},Dg={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}},Ug={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}},bt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...Ug,...Dg},Jo={...Og,...bt};var Pe=class{constructor(t,o){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new bn,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||Hr,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 Y(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(o=>{throw so(o)})}},gr=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},ga=class extends Yd.default{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 wl.StaticJsonRpcProvider(ao(a,this.chains,n)),this.rpcTimeoutDuration=Tn(n,"privy")}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new gr(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await $e()||!this.address)throw new gr("Disconnected",4900);return(await Zd(r)).hash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new gr(`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 gr(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new wl.StaticJsonRpcProvider(ao(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 Jd(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 Qd(ya(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:zr(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 zr(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(jd(o.method)){let r=await $e();if(await Xd(),!r||!this.address)throw new gr("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 gr("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}}},lo=class extends Pe{constructor(o){super(o,o.rpcTimeoutDuration)}},vr=class extends Pe{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Fg=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},pt=class extends ep.default{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=Cn(o),this.walletClientType==="privy"&&ce.put(ua(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=Tn(i,o),this.connected=!1,this.initialized=!1}buildConnectedWallet(o,r,n){let i=async()=>!!this.wallets.find(a=>(0,co.getAddress)(a.address)===(0,co.getAddress)(o));return{address:(0,co.getAddress)(o),chainId:r,meta:n,switchChain:async a=>{if(!i)throw new Y("Wallet is not currently connected.");let l=this.wallets.find(y=>(0,co.getAddress)(y.address)===(0,co.getAddress)(o))?.chainId;if(!l)throw new Y("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===Cn(s))return;let m=this.chains.find(y=>y.id===c);if(!m)throw new Y(`Unsupported chainId: ${a}`);let g=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await g()}catch(y){if(Fg(y,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:m.name,nativeCurrency:m.nativeCurrency,rpcUrls:[m.rpcUrls.default?.http[0]??""],blockExplorerUrls:[m.blockExplorers?.default.url??""]}]}),g();throw this.walletClientType==="rainbow"&&y.message?.includes("wallet_switchEthereumChain")?new Y(`Rainbow does not support the chainId ${r}`):y}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new Y("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new Y("Wallet is not currently connected.");return new Cl.Web3Provider(new lo(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new Y("Wallet is not currently connected.");return new vr(this.proxyProvider)},sign:async a=>{if(!await i())throw new Y("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(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=(0,co.getAddress)(n),a=[],l;if(this.walletClientType==="privy"){let c=ce.get(ua(i));this.chains.find(m=>m.id===Number(c))||(ce.del(ua(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 ${ul}`,c),l=ul}let s=Cn(l);if(!a.find(c=>(0,co.getAddress)(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((0,co.getAddress)(n),s,c))}va(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=>(0,co.getAddress)(n)===(0,co.getAddress)(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 Cl.Web3Provider(new lo(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 Bg=e=>{let t=`https://mainnet.infura.io/v3/${sa}`,o=1;return e.makeWeb3Provider(t,o)},wa,Ca=class extends pt{constructor(o,r,n){super("coinbase_wallet",o,r,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Pe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),wa||(wa=new tp.default({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(Bg(wa)),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(){wa.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Ti,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 Y("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw so(o)}}};var bl=require("react/jsx-runtime"),ba=({...e})=>(0,bl.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,bl.jsx)("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 Ea=class extends pt{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:[zr(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ba,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var El=require("react/jsx-runtime"),Pn=({style:e,...t})=>(0,El.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:(0,El.jsx)("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"})});var ot=require("react/jsx-runtime"),xn=({style:e,...t})=>(0,ot.jsxs)("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:[(0,ot.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,ot.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,ot.jsx)("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"}),(0,ot.jsx)("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"}),(0,ot.jsx)("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"}),(0,ot.jsx)("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"}),(0,ot.jsx)("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"}),(0,ot.jsx)("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"}),(0,ot.jsx)("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"}),(0,ot.jsx)("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"}),(0,ot.jsx)("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"}),(0,ot.jsx)("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"}),(0,ot.jsx)("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var Pi=require("react/jsx-runtime"),So=({style:e,...t})=>(0,Pi.jsxs)("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:[(0,Pi.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,Pi.jsx)("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 _n=class extends pt{constructor(o,r,n,i,a){super(a||"unknown",o,r,n);this.connectorType="injected";this.proxyProvider=new Pe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new Y("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw so(o)}}},Sn,An=class extends pt{constructor(o,r,n,i,a){super(a??"unknown",o,r,n);this.connectorType="injected";ta(this,Sn,void 0);this.proxyProvider=new Pe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0}),a==="metamask"?sl(this,Sn,{name:"MetaMask",icon:xn,id:"io.metamask"}):a==="phantom"&&sl(this,Sn,{name:"Phantom",icon:So,id:"phantom"})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return jc(this,Sn)??{name:"Browser Extension",icon:Pn,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 Y("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw so(o)}}};Sn=new WeakMap;var Hg=require("@ethersproject/address"),Gg=require("@ethersproject/providers"),op=require("react-device-detect");var Ta=class extends _n{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{op.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new Y("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw so(t)}}};var Pa=class extends pt{constructor(o,r){super(o,[],r,{});this.connectorType="null";this.proxyProvider=new Pe(void 0,Hr);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 xa=class extends Pa{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:So,id:"phantom"}}};var In=require("@walletconnect/ethereum-provider"),Dp=require("react-device-detect");var zt=require("react");var rp=require("react/jsx-runtime");function Sa({src:e,...t}){return(0,rp.jsx)("img",{src:e,...t,style:{display:"none"}})}var _o=require("react"),Cp=require("react");var Vt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:_d,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Vg=new Set(["metamask","coinbase_wallet","rainbow","zerion","phantom","wallet_connect","detected_wallets"]),zg=e=>Vg.has(e),$g=(e,t,o)=>o.indexOf(e)===t,np=({input:e})=>e?e.filter(zg).filter($g):Vt.appearance.walletList;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 Aa={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 ka={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 ip={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var ap={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var Ra={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 Ia={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var Wa={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{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 sp={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var lp={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var cp={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 dp={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 pp={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 up={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 mp={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 fp={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 Ma={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 Na={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 La={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 Oa={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 xi={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 Si={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 hp={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var yp={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 Da={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 Ua={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 Fa={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 kn=[_a,Aa,ka,pp,yp,Ma,Na,La,Oa,xi,Si,sp,lp,cp,dp,Ra,Ia,Wa,mp,fp,ip,ap,Da,Fa,Ua,up,hp],UE=new Set(kn.map(e=>e.id));var Cr=f(require("tinycolor2")),gp="#FFFFFF",qg="#000000",jg=gp,Kg="#1E1E1D";function Yg(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 wr(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,Cr.default)({...e.toHsl(),l:o})}function vp({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=gp,blackHex:a=qg}){let l;switch(e){case"light":l=jg;break;case"dark":l=Kg;break;default:l=e;break}let s=(0,Cr.default)(l),c=(0,Cr.default)(t),m=(0,Cr.default)(o),g=(0,Cr.default)(r),y=(0,Cr.default)(n),v=Yg(s.getLuminance()),b=wr(s,v==="light"?-.04:.11),E=wr(s,v==="light"?-.88:.87),S=wr(s,v==="light"?-.77:.75),T=wr(s,v==="light"?-.43:.45).desaturate(v==="light"?60:20),P=wr(s,v==="light"?-.08:.25).desaturate(v==="light"?60:20),L=wr(c,.15),R=wr(c,-.06),N=(0,Cr.default)(c.getLuminance()>.5?a:i),O=wr(m,-.16);return{colorScheme:v,background:s.toHslString(),background2:b.toHslString(),foreground:E.toHslString(),foreground2:S.toHslString(),foreground3:T.toHslString(),foreground4:P.toHslString(),accent:c.toHslString(),accentLight:L.toHslString(),accentDark:R.toHslString(),foregroundAccent:N.toHslString(),success:m.toHslString(),successDark:O.toHslString(),error:y.toHslString(),warn:g.toHslString()}}function Tl(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple","farcaster"],r=t?.loginMethods?.filter($=>o.includes($)),n,i,a,l,s,c,m,g,y,v,b;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"),m=r?.includes("tiktok"),y=r?.includes("github"),g=r?.includes("linkedin"),v=r?.includes("apple"),b=r?.includes("farcaster")):(n=e.emailAuth,i=e.smsAuth,a=e.walletAuth,l=e.googleOAuth,s=e.twitterOAuth,c=e.discordOAuth,y=e.githubOAuth,m=e.tiktokOAuth,g=e.linkedinOAuth,v=e.appleOAuth,b=e.farcasterAuth);let E=[n,i].filter(Boolean),S=[l,s,c,y,m,g,v,b].filter(Boolean),T=[a].filter(Boolean);if(E.length+S.length+T.length===0)throw new Error("You must enable at least one login method");let P=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;P&&T.length===0?(console.warn("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),P=!1):!P&&S.length+E.length===0&&(console.warn("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),P=!0);let L=np({isWalletLoginEnabled:a,input:t?.appearance?.walletList}),R=t?.intl?.defaultCountry??"US",{chains:N,defaultChain:O}=Jg({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),W=!!t?.defaultChain||!!t?.supportedChains,H=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,K,ne=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?H?K=t?.embeddedWallets?.noPromptOnSignature??!0:K=t?.embeddedWallets?.noPromptOnSignature??ne:K=ne,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&K!==!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:vp({backgroundTheme:t?.appearance?.theme??Vt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Vt.appearance.accentColor}),loginGroupPriority:P?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:L},loginMethods:{wallet:a,email:n,sms:i,google:l,twitter:s,discord:c,github:y,tiktok:m,linkedin:g,apple:v,farcaster:b},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Vt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Vt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Vt.rpcConfig.rpcTimeouts},chains:N,defaultChain:O,intl:{defaultCountry:R},shouldEnforceDefaultChainOnConnect:W,captchaEnabled:e.captchaEnabled??Vt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...H?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:K},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:H?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Vt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Vt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Vt._render.inParentNodeId}}}function wp(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 Jg({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:kn.find(m=>m.id===s.id)??s)}else n=kn.concat(e??[]);let i=t?n[0]:Ma,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}}var Pp=require("react/jsx-runtime"),bp={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},Pl=Tl(bp),xl=(0,Cp.createContext)({appConfig:Pl,isServerConfigLoaded:!1}),Ep=({children:e,legacyCreateEmbeddedWalletFlag:t,client:o,clientConfig:r})=>{let[n,i]=(0,_o.useState)(null),a=(0,_o.useMemo)(()=>Tl(n??bp,r),[n,r]);return(0,_o.useEffect)(()=>{let l=wp(r,t);o.createAnalyticsEvent("sdk_initialize",l)},[r,t]),(0,_o.useEffect)(()=>{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)}})()},[]),(0,Pp.jsx)(xl.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Ba=()=>{let{appConfig:e}=(0,_o.useContext)(xl);return e},Tp=()=>{let{isServerConfigLoaded:e}=(0,_o.useContext)(xl);return e};var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Ha=require("react/jsx-runtime"),xp=(0,zt.createContext)({ready:!1,app:Pl,currentScreen:null,lastScreen:null,navigate:x,navigateBack:x,resetNavigation:x,setModalData:x,onUserCloseViaDialogOrKeybindRef:void 0}),Qg=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Sp=e=>{let t=Ba(),o=e.authenticated,[r,n]=(0,zt.useState)(e.initialScreen);(0,zt.useEffect)(()=>{!o&&!Qg.includes(e.initialScreen)&&e.setInitialScreen(null)},[o]);let i=(0,zt.useRef)(null);(0,zt.useEffect)(()=>{e.open||(i.current=null)},[e.open]),(0,zt.useEffect)(()=>{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(0,Ha.jsxs)(xp.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,Ha.jsx)(Sa,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},A=()=>(0,zt.useContext)(xp);var Qo=require("react/jsx-runtime"),_i=({style:e,...t})=>{let{app:o}=A();return(0,Qo.jsxs)("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:[(0,Qo.jsx)("rect",{width:"28",height:"28",rx:"3",fill:o?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,Qo.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,Qo.jsx)("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"})}),(0,Qo.jsx)("defs",{children:(0,Qo.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,Qo.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Ga=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(Rn))if(t.includes(r.hostname))return{walletClientType:o,entry:r}};var Rn={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 Zg(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var _p=e=>e in Rn,Ap=e=>{let t=Rn[e].mobile;if("native"in t)return t.native};function kp(e,t){let o=Zg(t);if(o.deepLink)return Np(o.deepLink,e);if(o.universalLink)return Lp(o.universalLink,e);throw new C(`Unsupported wallet ${t.id}`)}var Rp="WALLETCONNECT_DEEPLINK_CHOICE";function Ip(){try{localStorage.removeItem(Rp)}catch{}}function Wp({href:e,name:t}){try{localStorage.setItem(Rp,JSON.stringify({href:e,name:t}))}catch{}}function Mp(e){return e.startsWith("http://")||e.startsWith("https://")}function Np(e,t){if(Mp(e))return Lp(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 Lp(e,t){if(!Mp(e))return Np(e,t);let o=e;o.endsWith("/")||(o=`${o}/`);let r=encodeURIComponent(t);return{redirect:`${o}wc?uri=${r}`,href:o}}function Op(e,t){window.open(e,t,"noreferrer noopener")}var Ao=class extends pt{constructor(o,r,n,i,a,l){super(l||"unknown",n,i,r);this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new Pe(void 0,this.rpcTimeoutDuration),l&&(this.walletEntry=Rn[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=Ga(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:xn,id:"io.metamask"}:{name:vl(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||_i,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=Rn[o],this.walletClientType=o,this.redirectUri=void 0,Ip(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new En)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new Y("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Ga(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Tn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),o()})().catch(a=>{if(a){r(so(a));return}r(new Y("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){let o={};for(let a of this.chains){let l=ao(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 In.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:r,optionalChains:n,optionalEvents:In.OPTIONAL_EVENTS,optionalMethods:In.OPTIONAL_METHODS,rpcMap:o,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),Dp.isMobile&&this.walletEntry){let{redirect:l,href:s}=kp(a,this.walletEntry);Wp({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Op(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=Ga(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 _l=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===(0,Sl.getAddress)(t)).length:!1},Tn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Hr:Hr,Wn=class extends Up.default{constructor(o,r,n,i,a,l,s){super();this.getEthereumProvider=()=>{let o=this.wallets[0],r=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===o?.address));return!o||!r?new Pe:r.proxyProvider};this.walletConnectCloudProjectId=o,this.rpcConfig=r,this.chains=n,this.defaultChain=i,this.walletConnectors=[],this.initialized=!1,this.store=a,this.walletList=l,this.shouldEnforceDefaultChainOnConnect=s,this.initializedWalletConnectors=0,this.walletsReady=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let o=new Set,r=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return o.has(a)?!1:(o.add(a),!0)}),n=r.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&r.unshift(r.splice(n,1)[0]),r}async initialize(){if(this.initialized)return;ce.get(dl)&&(ce.getKeys().forEach(r=>{r.startsWith("walletconnect")&&ce.del(r)}),ce.del(dl));let o=$d(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"),!hr()&&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 ga(o,r,this.rpcConfig,this.chains,n.id),l=new Ea(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 Ao&&i.resetConnection(r),i;let l=(()=>{if(o==="injected"){if(r==="metamask"&&n?.eip6963InjectedProvider)return new Ta(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(r==="metamask"&&n?.legacyInjectedProvider)return new An(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(r==="phantom"&&n?.legacyInjectedProvider)return new An(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&r==="unknown_browser_extension")return new An(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new _n(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,r)}else return o==="coinbase_wallet"?new Ca(this.chains,this.defaultChain,this.rpcConfig):o==="phantom"?new xa(this.defaultChain):new Ao(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=ce.get(pl);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}));ce.put(pl,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=(0,Sl.getAddress)(o),this.emit("walletsUpdated")}};function va(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}var Fp=require("ofetch");var Xg=[na(),aa(),ia()],Va=class{constructor(t,o,r){this.appId=t,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=ca,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=Fp.ofetch.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=!Xg.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 oa}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw fe(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw fe(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw fe(r)}}};var br=f(require("js-cookie"));function Bp(e){return e instanceof Fr?"email":e instanceof Vr?"sms":e instanceof Gr?"siwe":e instanceof yn?"custom_auth":e instanceof fr?e.meta.provider:null}var Hp=f(require("jose")),ko=class{static parse(t){try{return new ko(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Hp.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 ev=30,za=class{constructor(){this.authenticateOnce=new ct(async t=>this._authenticate(t)),this.linkOnce=new ct(async t=>this._link(t)),this.refreshOnce=new ct(this._refresh.bind(this)),this.destroyOnce=new ct(this._destroy.bind(this)),this.forkSessionOnce=new ct(this._forkSession.bind(this))}get token(){try{let t=ce.get(Br);return typeof t=="string"?new ko(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=ce.get(da);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=ce.get(Ci);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=br.default.get(pa);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=ko.parse(this.token);return t!==null&&!t.isExpired(ev)}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=Bp(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:It(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),lt(o)}}async _link(t){try{let o=await t.link();return It(o)}catch(o){throw console.warn("Error linking account"),lt(o)}}async _refresh(){if(!this.api)throw new C("Session has no API instance");if(!this.client)throw new C("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,o=this.refreshToken,r=this.forkedToken;try{let n;if(t&&o||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=o?{refresh_token:o}:{};n=await this.api.post(na(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(aa(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),It(n.user)}catch(n){if(n instanceof To&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw lt(n)}}async _destroy(){try{await this.api?.post(ia(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new C("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(Jc(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw lt(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let o=ce.get(Br);if(ce.put(Br,t),o!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let r=ko.parse(t)?.expiration;br.default.set(ll,t,{sameSite:"Strict",secure:!0,expires:r?new Date(r*1e3):void 0})}}else ce.del(Br),br.default.remove(ll)}storeRefreshToken(t){typeof t=="string"?(ce.put(da,t),this.client?.useServerCookies||(br.default.set(pa,"t",{sameSite:"Strict",secure:!0,expires:30}),br.default.set(cl,t,{sameSite:"Strict",secure:!0,expires:30}))):(ce.del(da),br.default.remove(cl),br.default.remove(pa))}clearForkedToken(){ce.del(Ci)}};var Al,$a,Vp,Mn=class{constructor(t){ta(this,$a);this.apiUrl=t.apiUrl||la,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Ad,this.appId=t.appId,this.clientAnalyticsId=Kc(this,$a,Vp).call(this),Al||(Al=new za),this.session=Al,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 Va(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){t.api=this.api,this.authFlow=t}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let o=await this.api.post(fd(),{address:t});return It(o)}catch(o){throw lt(o)}}async acceptTerms(){try{let t=await this.api.post(Td(),{});return It(t)}catch(t){throw lt(t)}}async unlinkPhone(t){try{let o=await this.api.post(hd(),{phoneNumber:t});return It(o)}catch(o){throw lt(o)}}async unlinkWallet(t){try{let o=await this.api.post(md(),{address:t});return It(o)}catch(o){throw lt(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(yd(),{provider:t,subject:o});return It(r)}catch(r){throw lt(r)}}async unlinkFarcaster(t){try{let o=await this.api.post(gd(),{fid:t});return It(o)}catch(o){throw lt(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(vd(),{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(wd(),t)}catch(o){throw lt(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?ko.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 lt(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async forkSession(){return await this.session.forkSession()}};$a=new WeakSet,Vp=function(){if(typeof window>"u")return null;try{let o=ce.get(bi);if(typeof o=="string"&&o.length>0)return o}catch{}let t=(0,Gp.v4)();try{return ce.put(bi,t),t}catch{return t}};var jp=require("@marsidev/react-turnstile"),qa=require("react");var $t=require("react");var qp=require("react/jsx-runtime"),zp=(0,$t.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:x,setError:x,setExecuting:x,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:x,reset:x,execute:x}),Zo=class extends et{constructor(o,r,n){super(o||"Captcha failed");this.type="Captcha";r instanceof Error&&(this.cause=r),this.privyErrorCode=n}},$p=({children:e,id:t,captchaSiteKey:o,captchaEnabled:r})=>{let n=(0,$t.useRef)(null),[i,a]=(0,$t.useState)(),[l,s]=(0,$t.useState)(),[c,m]=(0,$t.useState)(!1),g=(0,$t.useMemo)(()=>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(0,qp.jsx)(zp.Provider,{value:{...g,ref:n,enabled:r,siteKey:o,appId:t,setToken:a,setError:s,setExecuting:m,remove(){r&&(n.current?.remove(),m(!1),s(void 0),a(void 0))},reset(){r&&(n.current?.reset(),m(!1),s(void 0),a(void 0))},execute(){r&&(m(!0),n.current?.execute())},async waitForResult(){if(!r)return"";try{return await Vd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Zo("Captcha failed",null,"captcha_timeout")}}},children:e})},_e=()=>(0,$t.useContext)(zp);var kl=require("react/jsx-runtime"),ja=e=>{let{enabled:t,siteKey:o,appId:r,setError:n,setToken:i,setExecuting:a,ref:l}=_e(),[,s]=(0,qa.useMemo)(()=>o?.split("t:")||[],[o]);if((0,qa.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,kl.jsx)("div",{className:"hidden h-0 w-0",children:(0,kl.jsx)(jp.Turnstile,{...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")}}})})};var dr=require("react"),Vy=f(require("react-dom"));var Ka=require("react");var Rl=(0,Ka.createContext)({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,nativeTokenSymbolForChainId:x,initializeWalletProxy:x,getAuthMeta:x,getAuthFlow:x,closePrivyModal:x,openPrivyModal:x,connectWallet:x,initLoginWithWallet:x,loginWithWallet:x,initLoginWithFarcaster:x,loginWithFarcaster:x,loginWithCode:x,initLoginWithEmail:x,initLoginWithSms:x,resendEmailCode:x,resendSmsCode:x,initLoginWithOAuth:x,loginWithOAuth:x,refreshUser:x,walletProxy:null,createAnalyticsEvent:x,acceptTerms:x,getUsdTokenPrice:x,recoverEmbeddedWallet:x,getFiatOnRampConfig:x,updateWallets:x,setReadyToTrue:x}),I=()=>(0,Ka.useContext)(Rl);var Ya=require("react");var Ie=(0,Ya.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:x,login:x,linkEmail:x,linkPhone:x,linkFarcaster:x,linkWallet:x,linkGoogle:x,linkTwitter:x,linkDiscord:x,linkGithub:x,linkTiktok:x,linkLinkedIn:x,linkApple:x,logout:x,getAccessToken:x,getEthereumProvider:x,getEthersProvider:x,getWeb3jsProvider:x,unlinkEmail:x,unlinkPhone:x,unlinkWallet:x,unlinkGoogle:x,unlinkTwitter:x,unlinkDiscord:x,unlinkGithub:x,unlinkTiktok:x,unlinkLinkedIn:x,unlinkApple:x,unlinkFarcaster:x,setActiveWallet:x,forkSession:x,createWallet:x,signMessage:x,signTypedData:x,enrollInMfa:x,initEnrollmentWithSms:x,initEnrollmentWithTotp:x,promptMfa:x,init:x,submitEnrollmentWithSms:x,submitEnrollmentWithTotp:x,unenroll:x,submit:x,cancel:x,sendTransaction:x,exportWallet:x,setWalletPassword:x,initLoginWithEmail:x,initLoginWithSms:x,loginWithCode:x,isModalOpen:!1}),G=()=>(0,Ya.useContext)(Ie);var Ja=require("react"),Kp=e=>{let[t,o]=(0,Ja.useState)("auto");return(0,Ja.useEffect)(()=>{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};var Nn=require("react"),Yp={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},Il=(0,Nn.createContext)(void 0),Jp=()=>(0,Nn.useContext)(Il);function Et(e,t){if(!t)return;let r=Jp().current[e];return(0,Nn.useEffect)(()=>{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 ie(e,t,o,...r){for(let n of e.current[t][o])n(...r)}function Qp(){let e=Jp();return(t,o,...r)=>ie(e,t,o,...r)}function Qa(e){Et("configureMfa",e)}var Bl=f(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),su=f(require("@heroicons/react/24/solid/DocumentCheckIcon")),lu=f(require("styled-components"));var jt=f(require("styled-components"));var Za=f(require("styled-components")),Er=require("react/jsx-runtime"),Tr=({success:e,fail:t})=>(0,Er.jsxs)(Er.Fragment,{children:[(0,Er.jsx)(qt,{className:e?"success":t?"fail":""}),(0,Er.jsx)(Wl,{className:e?"success":t?"fail":""})]}),qt=Za.default.span`
|
|
12
|
+
- https://privy.io`;this.getNonceOnce=new ut(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 C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(Xc(),{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 fe(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(ed(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw fe(t)}}async sign(){if(!this.api)throw new C("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new C("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new C("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Zc(),{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new C("Auth flow has no API instance");let t=this.wallet.address,o=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(o,t,this.nonce),this.preparedMessage}prepareMessage(t,o,r){let n=window.location.host,i=window.location.origin,a="By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",l=new Date().toISOString();return this.createSiweMessage(t,o,n,i,l,r,a)}};var zr=class{constructor(t,o){this.meta={phoneNumber:t,captchaToken:o}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=cd(),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 fe(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=dd();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw fe(t)}}async sendSmsCode(t,o){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),o&&(this.meta.captchaToken=o),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{let r=ld();return await this.api.post(r,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(r){throw fe(r)}}};var Vp=require("uuid");function Et(e){return new Date(e*1e3)}function Fg(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 m={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:Et(o.verified_at)};t.push(m);break;case"tiktok_oauth":let g={subject:o.subject,username:o.username,name:o.name,type:o.type,verifiedAt:Et(o.verified_at)};t.push(g);break;case"linkedin_oauth":let y={subject:o.subject,name:o.name,email:o.email,type:o.type,verifiedAt:Et(o.verified_at)};t.push(y);break;case"apple_oauth":let v={subject:o.subject,email:o.email,type:o.type,verifiedAt:Et(o.verified_at)};t.push(v);break;case"custom_auth":t.push({type:o.type,customUserId:o.custom_user_id,verifiedAt:Et(o.verified_at)});break;case"farcaster":let b={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(b);break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function ao(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var Se=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,Bg=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Gt=(e,t)=>t==="all-users"&&!Se(e)||t==="users-without-wallets"&&!Bg(e)?.length;function Wt(e){if(!e)return null;let t=Fg(e.linked_accounts),o=ao(t,"wallet"),r=ao(t,"email"),n=ao(t,"phone"),i=ao(t,"google_oauth"),a=ao(t,"twitter_oauth"),l=ao(t,"discord_oauth"),s=ao(t,"github_oauth"),c=ao(t,"tiktok_oauth"),m=ao(t,"linkedin_oauth"),g=ao(t,"apple_oauth"),y=ao(t,"farcaster"),v=e.mfa_methods.map(({type:E,verified_at:S})=>({type:E,verifiedAt:Et(S)}));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:m&&{subject:m.subject,name:m.name,email:m.email},apple:g&&{subject:g.subject,email:g.email},farcaster:y&&{fid:y.fid,ownerAddress:y.ownerAddress,displayName:y.displayName,username:y.username,bio:y.bio,pfp:y.pfp,url:y.url},mfaMethods:v.map(E=>E.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var _l=require("@ethersproject/address"),Fp=f(require("eventemitter3"));function Bd(){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 ha=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 gl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||ha(e)!=="MetaMask")return!1;if(e.providers){for(let o of e.providers)if(!gl(o))return!1}return!0},yr=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Hd=()=>{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 Gd=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),Vd=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},gr=(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}`},vl=e=>new Promise(t=>setTimeout(t,e));function zd(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 $d=(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 vl(o)}a||i(new Error("Exceeded max attempts before resolving function"))})},ya=(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 wl=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),$r=e=>typeof e=="string"?e:"0x"+e.toString(16);async function qd(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 Bd()){let m=ha(c);if(!l.some(g=>g.info.name===m)){if(gl(c,!0)&&!s.find(g=>g.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(m==="Phantom"&&!s.find(g=>g.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}s.find(g=>g.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function bn(e){return`eip155:${String(Number(e))}`}var so=(e,t,o)=>{let r=Number(e),n=t.find(a=>a.id===r);if(!n)throw new J(`Unsupported chainId ${e}`,4901);let i;if(n.rpcUrls.privyWalletOverride&&n.rpcUrls.privyWalletOverride.http[0]?i=n.rpcUrls.privyWalletOverride.http[0]:o.rpcUrls&&o.rpcUrls[r]?i=o.rpcUrls[r]:n.rpcUrls.infura?.http[0]?i=n.rpcUrls.infura.http[0]+"/"+la:n.rpcUrls.blast?.http[0]?i=n.rpcUrls.blast.http[0]+"/"+_d:i=n.rpcUrls.default?.http[0],!i)throw new J(`No RPC url found for ${e}`);return i},jd=(e,t)=>{let o=Number(e),r=t.find(n=>n.id===o);if(!r)throw new J(`Unsupported chainId ${e}`,4901);return r.blockExplorers?.default.url},ga=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}}};var op=f(require("@coinbase/wallet-sdk"));var Ti=require("react/jsx-runtime"),Pi=({style:e,...t})=>(0,Ti.jsxs)("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:[(0,Ti.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Ti.jsx)("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"})]});var po=require("@ethersproject/address"),bl=require("@ethersproject/providers"),tp=f(require("eventemitter3"));var Cl=require("@ethersproject/providers"),Jd=f(require("eventemitter3"));var Hg=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],Kd=e=>Hg.includes(e);var Yd=require("@ethersproject/logger");var En=class extends J{constructor(){super("Wallet timeout");this.type="wallet_error"}},Tn=class extends J{constructor(){super("User rejected connection");this.type="wallet_error"}},lo=e=>{if(e instanceof J)return e;if(e?.code&&e?.reason){let t=new ot(e);return e.code===Yd.ErrorCode.ACTION_REJECTED&&(t.details=Tt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new ot(e):new J("Unknown connector error",e)},So=class extends tt{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},ot=class extends So{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))}},Gg={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}},Vg={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}},zg={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},...zg,...Vg},Zo={...Gg,...Tt};var xe=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 En,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||Gr,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new J(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(o=>{throw lo(o)})}},vr=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},va=class extends Jd.default{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 Cl.StaticJsonRpcProvider(so(a,this.chains,n)),this.rpcTimeoutDuration=Pn(n,"privy")}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new vr(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await qe()||!this.address)throw new vr("Disconnected",4900);return(await Xd(r)).hash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new vr(`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 vr(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new Cl.StaticJsonRpcProvider(so(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 Qd(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 Zd(ga(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:$r(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 $r(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(Kd(o.method)){let r=await qe();if(await ep(),!r||!this.address)throw new vr("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 vr("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await qe();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}}},co=class extends xe{constructor(o){super(o,o.rpcTimeoutDuration)}},wr=class extends xe{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 $g=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},ft=class extends tp.default{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=bn(o),this.walletClientType==="privy"&&ce.put(ma(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=Pn(i,o),this.connected=!1,this.initialized=!1}buildConnectedWallet(o,r,n){let i=async()=>!!this.wallets.find(a=>(0,po.getAddress)(a.address)===(0,po.getAddress)(o));return{address:(0,po.getAddress)(o),chainId:r,meta:n,switchChain:async a=>{if(!i)throw new J("Wallet is not currently connected.");let l=this.wallets.find(y=>(0,po.getAddress)(y.address)===(0,po.getAddress)(o))?.chainId;if(!l)throw new J("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===bn(s))return;let m=this.chains.find(y=>y.id===c);if(!m)throw new J(`Unsupported chainId: ${a}`);let g=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await g()}catch(y){if($g(y,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:m.name,nativeCurrency:m.nativeCurrency,rpcUrls:[m.rpcUrls.default?.http[0]??""],blockExplorerUrls:[m.blockExplorers?.default.url??""]}]}),g();throw this.walletClientType==="rainbow"&&y.message?.includes("wallet_switchEthereumChain")?new J(`Rainbow does not support the chainId ${r}`):y}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new J("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new J("Wallet is not currently connected.");return new bl.Web3Provider(new co(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new J("Wallet is not currently connected.");return new wr(this.proxyProvider)},sign:async a=>{if(!await i())throw new J("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;try{if(r===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(r=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return;let n=r[0],i=(0,po.getAddress)(n),a=[],l;if(this.walletClientType==="privy"){let c=ce.get(ma(i));this.chains.find(m=>m.id===Number(c))||(ce.del(ma(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 ${ml}`,c),l=ml}let s=bn(l);if(!a.find(c=>(0,po.getAddress)(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((0,po.getAddress)(n),s,c))}wa(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=>(0,po.getAddress)(n)===(0,po.getAddress)(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 bl.Web3Provider(new co(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 qg=e=>{let t=`https://mainnet.infura.io/v3/${la}`,o=1;return e.makeWeb3Provider(t,o)},Ca,ba=class extends ft{constructor(o,r,n){super("coinbase_wallet",o,r,n);this.connectorType="coinbase_wallet";this.proxyProvider=new xe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),Ca||(Ca=new op.default({appName:"Privy",darkMode:!1,headlessMode:!1,enableMobileWalletLink:!0})),this.proxyProvider.setWalletProvider(qg(Ca)),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(){Ca.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Pi,id:"com.coinbase.wallet"}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new J("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([o[0]])}catch(o){throw lo(o)}}};var El=require("react/jsx-runtime"),Ea=({...e})=>(0,El.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,El.jsx)("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 Ta=class extends ft{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:[$r(o?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:Ea,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var Tl=require("react/jsx-runtime"),xn=({style:e,...t})=>(0,Tl.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:(0,Tl.jsx)("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"})});var rt=require("react/jsx-runtime"),Sn=({style:e,...t})=>(0,rt.jsxs)("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:[(0,rt.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,rt.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,rt.jsx)("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"}),(0,rt.jsx)("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"}),(0,rt.jsx)("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"}),(0,rt.jsx)("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"}),(0,rt.jsx)("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"}),(0,rt.jsx)("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"}),(0,rt.jsx)("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"}),(0,rt.jsx)("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"}),(0,rt.jsx)("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"}),(0,rt.jsx)("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"}),(0,rt.jsx)("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]});var xi=require("react/jsx-runtime"),_o=({style:e,...t})=>(0,xi.jsxs)("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:[(0,xi.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,xi.jsx)("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 An=class extends ft{constructor(o,r,n,i,a){super(a||"unknown",o,r,n);this.connectorType="injected";this.proxyProvider=new xe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new J("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw lo(o)}}},_n,kn=class extends ft{constructor(o,r,n,i,a){super(a??"unknown",o,r,n);this.connectorType="injected";oa(this,_n,void 0);this.proxyProvider=new xe(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0}),a==="metamask"?ll(this,_n,{name:"MetaMask",icon:Sn,id:"io.metamask"}):a==="phantom"&&ll(this,_n,{name:"Phantom",icon:_o,id:"phantom"})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Kc(this,_n)??{name:"Browser Extension",icon:xn,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0||!o[0])throw new J("Unable to retrieve accounts");await this.syncAccounts([o[0]])}catch(o){throw lo(o)}}};_n=new WeakMap;var jg=require("@ethersproject/address"),Kg=require("@ethersproject/providers"),rp=require("react-device-detect");var Pa=class extends An{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{rp.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new J("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw lo(t)}}};var xa=class extends ft{constructor(o,r){super(o,[],r,{});this.connectorType="null";this.proxyProvider=new xe(void 0,Gr);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 Sa=class extends xa{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:_o,id:"phantom"}}};var Wn=require("@walletconnect/ethereum-provider"),Up=require("react-device-detect");var zt=require("react");var np=require("react/jsx-runtime");function _a({src:e,...t}){return(0,np.jsx)("img",{src:e,...t,style:{display:"none"}})}var Ao=require("react"),bp=require("react");var Vt={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Ad,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Yg=new Set(["metamask","coinbase_wallet","rainbow","zerion","phantom","wallet_connect","detected_wallets"]),Jg=e=>Yg.has(e),Qg=(e,t,o)=>o.indexOf(e)===t,ip=({input:e})=>e?e.filter(Jg).filter(Qg):Vt.appearance.walletList;var Aa={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 ka={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 Ra={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 ap={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 sp={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 Ia={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 Wa={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 Ma={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 lp={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 cp={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 dp={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 pp={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 up={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 mp={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 fp={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 hp={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 Na={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 La={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 Oa={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 Da={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 Si={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 _i={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 yp={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var gp={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{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 Ua={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 Fa={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 Ba={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=[Aa,ka,Ra,up,gp,Na,La,Oa,Da,Si,_i,lp,cp,dp,pp,Ia,Wa,Ma,fp,hp,ap,sp,Ua,Ba,Fa,mp,yp],zE=new Set(Rn.map(e=>e.id));var br=f(require("tinycolor2")),vp="#FFFFFF",Zg="#000000",Xg=vp,ev="#1E1E1D";function tv(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 Cr(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,br.default)({...e.toHsl(),l:o})}function wp({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=vp,blackHex:a=Zg}){let l;switch(e){case"light":l=Xg;break;case"dark":l=ev;break;default:l=e;break}let s=(0,br.default)(l),c=(0,br.default)(t),m=(0,br.default)(o),g=(0,br.default)(r),y=(0,br.default)(n),v=tv(s.getLuminance()),b=Cr(s,v==="light"?-.04:.11),E=Cr(s,v==="light"?-.88:.87),S=Cr(s,v==="light"?-.77:.75),T=Cr(s,v==="light"?-.43:.45).desaturate(v==="light"?60:20),P=Cr(s,v==="light"?-.08:.25).desaturate(v==="light"?60:20),O=Cr(c,.15),I=Cr(c,-.06),L=(0,br.default)(c.getLuminance()>.5?a:i),D=Cr(m,-.16);return{colorScheme:v,background:s.toHslString(),background2:b.toHslString(),foreground:E.toHslString(),foreground2:S.toHslString(),foreground3:T.toHslString(),foreground4:P.toHslString(),accent:c.toHslString(),accentLight:O.toHslString(),accentDark:I.toHslString(),foregroundAccent:L.toHslString(),success:m.toHslString(),successDark:D.toHslString(),error:y.toHslString(),warn:g.toHslString()}}function Pl(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple","farcaster"],r=t?.loginMethods?.filter(q=>o.includes(q)),n,i,a,l,s,c,m,g,y,v,b;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"),m=r?.includes("tiktok"),y=r?.includes("github"),g=r?.includes("linkedin"),v=r?.includes("apple"),b=r?.includes("farcaster")):(n=e.emailAuth,i=e.smsAuth,a=e.walletAuth,l=e.googleOAuth,s=e.twitterOAuth,c=e.discordOAuth,y=e.githubOAuth,m=e.tiktokOAuth,g=e.linkedinOAuth,v=e.appleOAuth,b=e.farcasterAuth);let E=[n,i].filter(Boolean),S=[l,s,c,y,m,g,v,b].filter(Boolean),T=[a].filter(Boolean);if(E.length+S.length+T.length===0)throw new Error("You must enable at least one login method");let P=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;P&&T.length===0?(console.warn("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),P=!1):!P&&S.length+E.length===0&&(console.warn("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),P=!0);let O=ip({isWalletLoginEnabled:a,input:t?.appearance?.walletList}),I=t?.intl?.defaultCountry??"US",{chains:L,defaultChain:D}=ov({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),M=!!t?.defaultChain||!!t?.supportedChains,G=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,Y,ie=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?G?Y=t?.embeddedWallets?.noPromptOnSignature??!0:Y=t?.embeddedWallets?.noPromptOnSignature??ie:Y=ie,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&Y!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:wp({backgroundTheme:t?.appearance?.theme??Vt.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Vt.appearance.accentColor}),loginGroupPriority:P?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:O},loginMethods:{wallet:a,email:n,sms:i,google:l,twitter:s,discord:c,github:y,tiktok:m,linkedin:g,apple:v,farcaster:b},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Vt.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Vt.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Vt.rpcConfig.rpcTimeouts},chains:L,defaultChain:D,intl:{defaultCountry:I},shouldEnforceDefaultChainOnConnect:M,captchaEnabled:e.captchaEnabled??Vt.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...G?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets,noPromptOnSignature:Y},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:G?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Vt.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Vt._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Vt._render.inParentNodeId}}}function Cp(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 ov({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(m=>m.id===s.id)??s)}else n=Rn.concat(e??[]);let i=t?n[0]:Na,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}}var xp=require("react/jsx-runtime"),Ep={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:""},xl=Pl(Ep),Sl=(0,bp.createContext)({appConfig:xl,isServerConfigLoaded:!1}),Tp=({children:e,legacyCreateEmbeddedWalletFlag:t,client:o,clientConfig:r})=>{let[n,i]=(0,Ao.useState)(null),a=(0,Ao.useMemo)(()=>Pl(n??Ep,r),[n,r]);return(0,Ao.useEffect)(()=>{let l=Cp(r,t);o.createAnalyticsEvent("sdk_initialize",l)},[r,t]),(0,Ao.useEffect)(()=>{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)}})()},[]),(0,xp.jsx)(Sl.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Ha=()=>{let{appConfig:e}=(0,Ao.useContext)(Sl);return e},Pp=()=>{let{isServerConfigLoaded:e}=(0,Ao.useContext)(Sl);return e};var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Ga=require("react/jsx-runtime"),Sp=(0,zt.createContext)({ready:!1,app:xl,currentScreen:null,lastScreen:null,navigate:x,navigateBack:x,resetNavigation:x,setModalData:x,onUserCloseViaDialogOrKeybindRef:void 0}),rv=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],_p=e=>{let t=Ha(),o=e.authenticated,[r,n]=(0,zt.useState)(e.initialScreen);(0,zt.useEffect)(()=>{!o&&!rv.includes(e.initialScreen)&&e.setInitialScreen(null)},[o]);let i=(0,zt.useRef)(null);(0,zt.useEffect)(()=>{e.open||(i.current=null)},[e.open]),(0,zt.useEffect)(()=>{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(0,Ga.jsxs)(Sp.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,Ga.jsx)(_a,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},A=()=>(0,zt.useContext)(Sp);var Xo=require("react/jsx-runtime"),Ai=({style:e,...t})=>{let{app:o}=A();return(0,Xo.jsxs)("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:[(0,Xo.jsx)("rect",{width:"28",height:"28",rx:"3",fill:o?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,Xo.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,Xo.jsx)("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"})}),(0,Xo.jsx)("defs",{children:(0,Xo.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,Xo.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var Va=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(In))if(t.includes(r.hostname))return{walletClientType:o,entry:r}};var In={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 nv(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var Ap=e=>e in In,kp=e=>{let t=In[e].mobile;if("native"in t)return t.native};function Rp(e,t){let o=nv(t);if(o.deepLink)return Lp(o.deepLink,e);if(o.universalLink)return Op(o.universalLink,e);throw new C(`Unsupported wallet ${t.id}`)}var Ip="WALLETCONNECT_DEEPLINK_CHOICE";function Wp(){try{localStorage.removeItem(Ip)}catch{}}function Mp({href:e,name:t}){try{localStorage.setItem(Ip,JSON.stringify({href:e,name:t}))}catch{}}function Np(e){return e.startsWith("http://")||e.startsWith("https://")}function Lp(e,t){if(Np(e))return Op(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 Op(e,t){if(!Np(e))return Lp(e,t);let o=e;o.endsWith("/")||(o=`${o}/`);let r=encodeURIComponent(t);return{redirect:`${o}wc?uri=${r}`,href:o}}function Dp(e,t){window.open(e,t,"noreferrer noopener")}var ko=class extends ft{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 xe(void 0,this.rpcTimeoutDuration),l&&(this.walletEntry=In[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=Va(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:Sn,id:"io.metamask"}:{name:wl(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Ai,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=In[o],this.walletClientType=o,this.redirectUri=void 0,Wp(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((o,r)=>{let n=()=>{r(new Tn)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new J("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=Va(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=Pn(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),o()})().catch(a=>{if(a){r(lo(a));return}r(new J("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){let o={};for(let a of this.chains){let l=so(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 Wn.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:r,optionalChains:n,optionalEvents:Wn.OPTIONAL_EVENTS,optionalMethods:Wn.OPTIONAL_METHODS,rpcMap:o,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),Up.isMobile&&this.walletEntry){let{redirect:l,href:s}=Rp(a,this.walletEntry);Mp({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Dp(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=Va(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 Al=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!e?.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===(0,_l.getAddress)(t)).length:!1},Pn=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Gr:Gr,Mn=class extends Fp.default{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 xe: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;ce.get(pl)&&(ce.getKeys().forEach(r=>{r.startsWith("walletconnect")&&ce.del(r)}),ce.del(pl));let o=qd(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"),!yr()&&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 va(o,r,this.rpcConfig,this.chains,n.id),l=new Ta(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 ko&&i.resetConnection(r),i;let l=(()=>{if(o==="injected"){if(r==="metamask"&&n?.eip6963InjectedProvider)return new Pa(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(r==="metamask"&&n?.legacyInjectedProvider)return new kn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(r==="phantom"&&n?.legacyInjectedProvider)return new kn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&r==="unknown_browser_extension")return new kn(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new An(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,r)}else return o==="coinbase_wallet"?new ba(this.chains,this.defaultChain,this.rpcConfig):o==="phantom"?new Sa(this.defaultChain):new ko(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=ce.get(ul);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}));ce.put(ul,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=(0,_l.getAddress)(o),this.emit("walletsUpdated")}};function wa(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}var Bp=require("ofetch");var iv=[ia(),sa(),aa()],za=class{constructor(t,o,r){this.appId=t,this.clientAnalyticsId=o.clientAnalyticsId,this.sdkVersion=da,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=Bp.ofetch.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=!iv.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 ra}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw fe(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw fe(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw fe(r)}}};var Er=f(require("js-cookie"));function Hp(e){return e instanceof Br?"email":e instanceof zr?"sms":e instanceof Vr?"siwe":e instanceof gn?"custom_auth":e instanceof hr?e.meta.provider:null}var Gp=f(require("jose")),Ro=class{static parse(t){try{return new Ro(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Gp.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 av=30,$a=class{constructor(){this.authenticateOnce=new ut(async t=>this._authenticate(t)),this.linkOnce=new ut(async t=>this._link(t)),this.refreshOnce=new ut(this._refresh.bind(this)),this.destroyOnce=new ut(this._destroy.bind(this)),this.forkSessionOnce=new ut(this._forkSession.bind(this))}get token(){try{let t=ce.get(Hr);return typeof t=="string"?new Ro(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=ce.get(pa);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=ce.get(bi);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=Er.default.get(ua);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=Ro.parse(this.token);return t!==null&&!t.isExpired(av)}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=Hp(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:Wt(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),pt(o)}}async _link(t){try{let o=await t.link();return Wt(o)}catch(o){throw console.warn("Error linking account"),pt(o)}}async _refresh(){if(!this.api)throw new C("Session has no API instance");if(!this.client)throw new C("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,o=this.refreshToken,r=this.forkedToken;try{let n;if(t&&o||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=o?{refresh_token:o}:{};n=await this.api.post(ia(),a,{headers:i}),r&&this.clearForkedToken()}else if(r)n=await this.api.post(sa(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),Wt(n.user)}catch(n){if(n instanceof Po&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw pt(n)}}async _destroy(){try{await this.api?.post(aa(),{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new C("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(Qc(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw pt(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken(),this.client?.onDeleteToken?.()}storeToken(t){if(typeof t=="string"){let o=ce.get(Hr);if(ce.put(Hr,t),o!==t&&this.client?.onStoreToken?.(t),!this.client?.useServerCookies){let r=Ro.parse(t)?.expiration;Er.default.set(cl,t,{sameSite:"Strict",secure:!0,expires:r?new Date(r*1e3):void 0})}}else ce.del(Hr),Er.default.remove(cl)}storeRefreshToken(t){typeof t=="string"?(ce.put(pa,t),this.client?.useServerCookies||(Er.default.set(ua,"t",{sameSite:"Strict",secure:!0,expires:30}),Er.default.set(dl,t,{sameSite:"Strict",secure:!0,expires:30}))):(ce.del(pa),Er.default.remove(dl),Er.default.remove(ua))}clearForkedToken(){ce.del(bi)}};var kl,qa,zp,Nn=class{constructor(t){oa(this,qa);this.apiUrl=t.apiUrl||ca,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||kd,this.appId=t.appId,this.clientAnalyticsId=Yc(this,qa,zp).call(this),kl||(kl=new $a),this.session=kl,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t,o,r,n,i,a,l){this.connectors||(this.connectors=new Mn(t,o,r,n,i,a,l))}generateApi(){let t=new za(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new C("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){t.api=this.api,this.authFlow=t}startMfaFlow(t){t.api=this.api,this.mfaFlow=t}async unlinkEmail(t){try{let o=await this.api.post(hd(),{address:t});return Wt(o)}catch(o){throw pt(o)}}async acceptTerms(){try{let t=await this.api.post(Pd(),{});return Wt(t)}catch(t){throw pt(t)}}async unlinkPhone(t){try{let o=await this.api.post(yd(),{phoneNumber:t});return Wt(o)}catch(o){throw pt(o)}}async unlinkWallet(t){try{let o=await this.api.post(fd(),{address:t});return Wt(o)}catch(o){throw pt(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(gd(),{provider:t,subject:o});return Wt(r)}catch(r){throw pt(r)}}async unlinkFarcaster(t){try{let o=await this.api.post(vd(),{fid:t});return Wt(o)}catch(o){throw pt(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(wd(),{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(Cd(),t)}catch(o){throw pt(o)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?Ro.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 pt(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()}};qa=new WeakSet,zp=function(){if(typeof window>"u")return null;try{let o=ce.get(Ei);if(typeof o=="string"&&o.length>0)return o}catch{}let t=(0,Vp.v4)();try{return ce.put(Ei,t),t}catch{return t}};var Kp=require("@marsidev/react-turnstile"),ja=require("react");var $t=require("react");var jp=require("react/jsx-runtime"),$p=(0,$t.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:x,setError:x,setExecuting:x,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:x,reset:x,execute:x}),er=class extends tt{constructor(o,r,n){super(o||"Captcha failed");this.type="Captcha";r instanceof Error&&(this.cause=r),this.privyErrorCode=n}},qp=({children:e,id:t,captchaSiteKey:o,captchaEnabled:r})=>{let n=(0,$t.useRef)(null),[i,a]=(0,$t.useState)(),[l,s]=(0,$t.useState)(),[c,m]=(0,$t.useState)(!1),g=(0,$t.useMemo)(()=>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(0,jp.jsx)($p.Provider,{value:{...g,ref:n,enabled:r,siteKey:o,appId:t,setToken:a,setError:s,setExecuting:m,remove(){r&&(n.current?.remove(),m(!1),s(void 0),a(void 0))},reset(){r&&(n.current?.reset(),m(!1),s(void 0),a(void 0))},execute(){r&&(m(!0),n.current?.execute())},async waitForResult(){if(!r)return"";try{return await zd(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new er("Captcha failed",null,"captcha_timeout")}}},children:e})},Ae=()=>(0,$t.useContext)($p);var Rl=require("react/jsx-runtime"),Ka=e=>{let{enabled:t,siteKey:o,appId:r,setError:n,setToken:i,setExecuting:a,ref:l}=Ae(),[,s]=(0,ja.useMemo)(()=>o?.split("t:")||[],[o]);if((0,ja.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,Rl.jsx)("div",{className:"hidden h-0 w-0",children:(0,Rl.jsx)(Kp.Turnstile,{...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")}}})})};var ur=require("react"),zy=f(require("react-dom"));var Ya=require("react");var Il=(0,Ya.createContext)({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,nativeTokenSymbolForChainId:x,initializeWalletProxy:x,getAuthMeta:x,getAuthFlow:x,closePrivyModal:x,openPrivyModal:x,connectWallet:x,initLoginWithWallet:x,loginWithWallet:x,initLoginWithFarcaster:x,loginWithFarcaster:x,loginWithCode:x,initLoginWithEmail:x,initLoginWithSms:x,resendEmailCode:x,resendSmsCode:x,initLoginWithOAuth:x,loginWithOAuth:x,refreshUser:x,walletProxy:null,createAnalyticsEvent:x,acceptTerms:x,getUsdTokenPrice:x,recoverEmbeddedWallet:x,getFiatOnRampConfig:x,updateWallets:x,setReadyToTrue:x}),W=()=>(0,Ya.useContext)(Il);var Ja=require("react");var he=(0,Ja.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:x,login:x,linkEmail:x,linkPhone:x,linkFarcaster:x,linkWallet:x,linkGoogle:x,linkTwitter:x,linkDiscord:x,linkGithub:x,linkTiktok:x,linkLinkedIn:x,linkApple:x,logout:x,getAccessToken:x,getEthereumProvider:x,getEthersProvider:x,getWeb3jsProvider:x,unlinkEmail:x,unlinkPhone:x,unlinkWallet:x,unlinkGoogle:x,unlinkTwitter:x,unlinkDiscord:x,unlinkGithub:x,unlinkTiktok:x,unlinkLinkedIn:x,unlinkApple:x,unlinkFarcaster:x,setActiveWallet:x,forkSession:x,createWallet:x,signMessage:x,signTypedData:x,enrollInMfa:x,initEnrollmentWithSms:x,initEnrollmentWithTotp:x,promptMfa:x,init:x,submitEnrollmentWithSms:x,submitEnrollmentWithTotp:x,unenroll:x,submit:x,cancel:x,sendTransaction:x,exportWallet:x,setWalletPassword:x,initLoginWithEmail:x,initLoginWithSms:x,loginWithCode:x,isModalOpen:!1}),V=()=>(0,Ja.useContext)(he);var Qa=require("react"),Yp=e=>{let[t,o]=(0,Qa.useState)("auto");return(0,Qa.useEffect)(()=>{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};var Ln=require("react"),Jp={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},Wl=(0,Ln.createContext)(void 0),Qp=()=>(0,Ln.useContext)(Wl);function Ue(e,t){if(!t)return;let r=Qp().current[e];return(0,Ln.useEffect)(()=>{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 B(e,t,o,...r){for(let n of e.current[t][o])n(...r)}function Zp(){let e=Qp();return(t,o,...r)=>B(e,t,o,...r)}function Za(e){Ue("configureMfa",e)}var Hl=f(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),lu=f(require("@heroicons/react/24/solid/DocumentCheckIcon")),cu=f(require("styled-components"));var jt=f(require("styled-components"));var Xa=f(require("styled-components")),Tr=require("react/jsx-runtime"),Pr=({success:e,fail:t})=>(0,Tr.jsxs)(Tr.Fragment,{children:[(0,Tr.jsx)(qt,{className:e?"success":t?"fail":""}),(0,Tr.jsx)(Ml,{className:e?"success":t?"fail":""})]}),qt=Xa.default.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
|
+
`,Ml=(0,Xa.default)(qt)`
|
|
46
46
|
&& {
|
|
47
47
|
border-bottom-color: ${e=>e.color??"var(--privy-color-accent)"};
|
|
48
48
|
animation: none;
|
|
49
49
|
opacity: 0.5;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
`,qr=e=>(0,Tr.jsx)(sv,{color:e.color||"var(--privy-color-foreground-3)"}),sv=(0,Xa.default)(qt)`
|
|
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
|
-
`;var
|
|
60
|
+
`;var je=require("react/jsx-runtime"),es=jt.default.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
|
-
`,
|
|
88
|
+
`,F=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>(0,je.jsx)(Xp,{disabled:t||o,...n,children:t?(0,je.jsxs)("span",{children:[(0,je.jsx)(qr,{}),r?(0,je.jsx)("span",{children:r}):null]}):e}),WT=(0,jt.default)(F)`
|
|
89
89
|
${e=>e.hideAnimations&&jt.css`
|
|
90
90
|
&& {
|
|
91
91
|
transition: none;
|
|
92
92
|
}
|
|
93
93
|
`}
|
|
94
|
-
`,
|
|
94
|
+
`,ts=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>(0,je.jsx)(Xp,{as:"a",disabled:t||o,...n,children:t?(0,je.jsxs)("span",{children:[(0,je.jsx)(qr,{}),r?(0,je.jsx)("span",{children:r}):null]}):e}),Xp=(0,jt.default)(es)`
|
|
95
95
|
position: relative;
|
|
96
96
|
|
|
97
97
|
&& {
|
|
@@ -136,7 +136,7 @@ Resources:
|
|
|
136
136
|
opacity: 1;
|
|
137
137
|
animation: fadein 200ms ease;
|
|
138
138
|
}
|
|
139
|
-
`,
|
|
139
|
+
`,uo=({children:e,loading:t,disabled:o,loadingText:r="Loading...",...n})=>(0,je.jsx)(lv,{disabled:t||o,...n,children:t?(0,je.jsxs)("span",{children:[(0,je.jsx)(qr,{}),r?(0,je.jsx)("span",{children:r}):null]}):e}),lv=(0,jt.default)(es)`
|
|
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
|
+
`,os=jt.default.button`
|
|
169
169
|
&& {
|
|
170
170
|
padding: 12px 16px;
|
|
171
171
|
font-weight: 500;
|
|
@@ -196,10 +196,10 @@ Resources:
|
|
|
196
196
|
cursor: not-allowed;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`,
|
|
199
|
+
`,MT=jt.default.div`
|
|
200
200
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
201
201
|
height: 44px;
|
|
202
|
-
`,
|
|
202
|
+
`,rs=({children:e,onClick:t,disabled:o,isSubmitting:r,...n})=>(0,je.jsxs)(cv,{isSubmitting:r,onClick:t,disabled:o,...n,children:[(0,je.jsx)("span",{children:e}),(0,je.jsx)("span",{children:(0,je.jsx)(qr,{})})]}),cv=jt.default.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
|
-
`;var
|
|
244
|
+
`;var Ll=f(require("styled-components"));var Pt=require("react/jsx-runtime"),Nl=Ll.default.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 ns(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:o,requireUsersAcceptTerms:r}}=e.app;if(r&&!e.alwaysShowImplicitConsent)return(0,Pt.jsx)(Nl,{});if(!o&&!t)return(0,Pt.jsx)(Nl,{});let n=!!(t&&o);return(0,Pt.jsxs)(Nl,{children:["By logging in I agree to the"," ",o&&(0,Pt.jsx)("a",{href:o,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&(0,Pt.jsx)("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var $=({protectedByPrivy:e})=>(0,Pt.jsx)(Q,{children:e?(0,Pt.jsxs)(Pt.Fragment,{children:[(0,Pt.jsx)(Ea,{className:"hide-on-mobile"}),(0,Pt.jsx)("span",{className:"hide-on-mobile",children:(0,Pt.jsx)("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),Q=Ll.default.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
|
-
`;var
|
|
280
|
+
`;var tu=f(require("@heroicons/react/24/outline/ArrowLeftIcon")),ou=f(require("@heroicons/react/24/outline/XMarkIcon")),is=f(require("styled-components"));var ht=require("react/jsx-runtime"),eu=()=>(0,ht.jsx)("div",{}),dv=({backFn:e})=>(0,ht.jsx)("div",{children:(0,ht.jsx)(ru,{onClick:e,children:(0,ht.jsx)(tu.default,{height:"16px",width:"16px",strokeWidth:2})})}),pv=e=>(0,ht.jsx)("div",{children:(0,ht.jsx)(ru,{"aria-label":"close modal",onClick:e.onClose,children:(0,ht.jsx)(ou.default,{height:"16px",width:"16px",strokeWidth:2})})});var _=({backFn:e,onClose:t,title:o,closeable:r=!0})=>{let{closePrivyModal:n}=W(),{app:i}=A();return(0,ht.jsxs)(uv,{children:[e?(0,ht.jsx)(dv,{backFn:e}):(0,ht.jsx)(eu,{}),o&&(0,ht.jsx)(mv,{id:"privy-dialog-title",children:o}),i?.render.inDialog&&r?(0,ht.jsx)(pv,{onClose:t||(()=>n())}):(0,ht.jsx)(eu,{})]})},ru=is.default.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
|
+
`,uv=is.default.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
|
+
`,mv=is.default.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
|
-
`;var
|
|
328
|
+
`;var tr=f(require("styled-components")),as=tr.default.div`
|
|
329
329
|
text-align: left;
|
|
330
330
|
flex-grow: 1;
|
|
331
|
-
`,
|
|
331
|
+
`,nu=tr.default.div`
|
|
332
332
|
display: flex;
|
|
333
333
|
flex-direction: column;
|
|
334
334
|
justify-content: flex-end;
|
|
335
335
|
flex-grow: 1;
|
|
336
|
-
`,
|
|
336
|
+
`,Io=tr.default.div`
|
|
337
337
|
display: flex;
|
|
338
338
|
flex-direction: column;
|
|
339
339
|
gap: 12px;
|
|
@@ -348,7 +348,7 @@ Resources:
|
|
|
348
348
|
&::-webkit-scrollbar {
|
|
349
349
|
display: none;
|
|
350
350
|
}
|
|
351
|
-
`,
|
|
351
|
+
`,iu=tr.css`
|
|
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
|
-
`,We=
|
|
390
|
-
${
|
|
391
|
-
`,
|
|
392
|
-
${
|
|
393
|
-
`,
|
|
389
|
+
`,We=tr.default.button`
|
|
390
|
+
${iu}
|
|
391
|
+
`,Ol=tr.default.a`
|
|
392
|
+
${iu}
|
|
393
|
+
`,or=tr.default.div`
|
|
394
394
|
width: 100%;
|
|
395
395
|
${e=>e.if?"display: none;":""}
|
|
396
|
-
`;var
|
|
396
|
+
`;var Ke=f(require("styled-components")),nt=Ke.default.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
|
-
`,Me=
|
|
404
|
+
`,Me=Ke.default.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
|
+
`,_e=Ke.default.div`
|
|
411
411
|
font-size: 0.875rem;
|
|
412
412
|
|
|
413
413
|
text-align: center;
|
|
414
|
-
`,
|
|
414
|
+
`,xr=Ke.default.div`
|
|
415
415
|
display: flex;
|
|
416
416
|
flex-direction: column;
|
|
417
417
|
align-items: center;
|
|
@@ -421,7 +421,7 @@ Resources:
|
|
|
421
421
|
@media (max-width: 440px) {
|
|
422
422
|
padding: 10px 10px 20px;
|
|
423
423
|
}
|
|
424
|
-
`,
|
|
424
|
+
`,au=Ke.default.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
|
+
`,Dl=Ke.default.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
|
+
`,Ul=Ke.default.div`
|
|
445
445
|
display: flex;
|
|
446
446
|
align-items: center;
|
|
447
447
|
gap: 10px;
|
|
448
448
|
font-size: 0.875rem;
|
|
449
449
|
line-height: 1rem;
|
|
450
450
|
text-align: left;
|
|
451
|
-
`,
|
|
451
|
+
`,Sr=Ke.default.div`
|
|
452
452
|
display: flex;
|
|
453
453
|
flex-direction: column;
|
|
454
454
|
gap: 10px;
|
|
455
455
|
padding-top: 20px;
|
|
456
|
-
`,
|
|
456
|
+
`,ss=Ke.default.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
|
+
`,ls=Ke.default.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
|
+
`,Fl=Ke.default.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
|
+
`,cs=Ke.default.div`
|
|
492
492
|
display: flex;
|
|
493
493
|
align-items: center;
|
|
494
494
|
gap: 0.5rem;
|
|
@@ -498,7 +498,7 @@ Resources:
|
|
|
498
498
|
height: 20px !important;
|
|
499
499
|
width: 20px !important;
|
|
500
500
|
}
|
|
501
|
-
`,
|
|
501
|
+
`,On=Ke.default.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
|
+
`,ds=Ke.default.div`
|
|
516
516
|
width: 100%;
|
|
517
517
|
display: flex;
|
|
518
518
|
justify-content: space-between;
|
|
519
|
-
`,
|
|
519
|
+
`,su=Ke.default.p`
|
|
520
520
|
text-align: left;
|
|
521
521
|
width: 100%;
|
|
522
522
|
color: var(--privy-color-foreground-3) !important;
|
|
523
|
-
`,
|
|
523
|
+
`,Bl=Ke.default.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
|
+
`,yt=Ke.default.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
|
-
`;var
|
|
568
|
+
`;var He=require("react/jsx-runtime"),du=()=>{let{user:e,logout:t}=V(),{app:o,onUserCloseViaDialogOrKeybindRef:r,setModalData:n,navigate:i}=A(),{acceptTerms:a,closePrivyModal:l}=W(),s=m=>{m?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};r.current=s;let c=async m=>{m.preventDefault(),await a(),e&&Gt(e,o?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:g=>console.error(g),callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return(0,He.jsx)(fv,{termsAndConditionsUrl:o?.legal.termsAndConditionsUrl,privacyPolicyUrl:o?.legal.privacyPolicyUrl,onAccept:c,onDecline:s})},fv=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:o,onDecline:r})=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(_,{closeable:!1}),(0,He.jsx)(lu.default,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),(0,He.jsx)(Me,{style:{marginTop:24},children:"One last step"}),(0,He.jsx)(_e,{children:"By signing up, you agree to our terms and privacy policy."}),(0,He.jsxs)(Io,{style:{marginTop:24},children:[e&&(0,He.jsxs)(Ol,{target:"_blank",href:e,children:["View Terms ",(0,He.jsx)(Hl.default,{style:{marginLeft:"auto"}})]}),t&&(0,He.jsxs)(Ol,{target:"_blank",href:t,children:["View Privacy Policy ",(0,He.jsx)(Hl.default,{style:{marginLeft:"auto"}})]})]}),(0,He.jsxs)(hv,{style:{marginTop:24},children:[(0,He.jsx)(uo,{onClick:r,children:"No thanks"}),(0,He.jsx)(F,{onClick:o,children:"Accept"})]}),(0,He.jsx)($,{protectedByPrivy:!0})]}),hv=cu.default.div`
|
|
569
569
|
display: flex;
|
|
570
570
|
gap: 10px;
|
|
571
|
-
`;var
|
|
571
|
+
`;var ms=f(require("styled-components"));var pu=f(require("styled-components")),ps=pu.default.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
|
-
`;var
|
|
586
|
+
`;var Gl=require("react/jsx-runtime"),us=({style:e,...t})=>(0,Gl.jsx)("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:(0,Gl.jsx)("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"})});var Fe=require("react/jsx-runtime"),uu=()=>{let{navigate:e,app:t}=A(),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(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(_,{}),(0,Fe.jsxs)(yv,{children:[(0,Fe.jsx)(vv,{children:(0,Fe.jsxs)("div",{children:[(0,Fe.jsx)(ps,{}),(0,Fe.jsx)(us,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),(0,Fe.jsxs)(gv,{children:[typeof o=="string"?(0,Fe.jsx)("h3",{children:o}):(0,Fe.jsx)(Fe.Fragment,{children:o}),typeof r=="string"?(0,Fe.jsx)("p",{children:r}):(0,Fe.jsx)(Fe.Fragment,{children:r})]}),t?.allowlistConfig.errorCtaLink?(0,Fe.jsx)(F,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):(0,Fe.jsx)(F,{onClick:()=>{e("LANDING")},children:n})]})]})},yv=ms.default.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
|
+
`,gv=ms.default.div`
|
|
595
595
|
display: flex;
|
|
596
596
|
flex-direction: column;
|
|
597
597
|
gap: 8px;
|
|
598
|
-
`,
|
|
598
|
+
`,vv=ms.default.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
|
-
`;var
|
|
621
|
+
`;var Cu=f(require("@heroicons/react/24/outline/EnvelopeIcon")),bu=f(require("@heroicons/react/24/outline/PhoneIcon")),_r=require("react"),Eu=require("react-device-detect"),Dn=f(require("styled-components"));var xt=f(require("styled-components")),Wo=xt.default.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
|
-
`,Kt=
|
|
629
|
+
`,Kt=xt.default.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
|
+
`,mu=xt.default.div`
|
|
637
637
|
display: flex;
|
|
638
638
|
flex-direction: column;
|
|
639
639
|
align-items: center;
|
|
640
640
|
width: 100%;
|
|
641
|
-
`,
|
|
641
|
+
`,fs=(0,xt.default)(Kt)`
|
|
642
642
|
padding: 20px 0;
|
|
643
|
-
`,
|
|
643
|
+
`,mo=(0,xt.default)(Kt)`
|
|
644
644
|
gap: 16px;
|
|
645
|
-
`,
|
|
645
|
+
`,Vl=xt.default.div`
|
|
646
646
|
display: flex;
|
|
647
647
|
flex-direction: column;
|
|
648
648
|
width: 100%;
|
|
649
|
-
`,Yt=
|
|
649
|
+
`,Yt=xt.default.div`
|
|
650
650
|
display: flex;
|
|
651
651
|
flex-direction: column;
|
|
652
652
|
gap: 8px;
|
|
653
|
-
`,
|
|
653
|
+
`,l3=xt.default.div`
|
|
654
654
|
display: flex;
|
|
655
655
|
flex-direction: column;
|
|
656
656
|
justify-content: space-between;
|
|
657
657
|
height: 100%;
|
|
658
|
-
`,
|
|
658
|
+
`,fu=xt.default.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
|
-
`,
|
|
681
|
+
`,Z=xt.default.div`
|
|
682
682
|
height: 16px;
|
|
683
|
-
`,
|
|
683
|
+
`,te=xt.default.div`
|
|
684
684
|
height: 12px;
|
|
685
|
-
`,
|
|
685
|
+
`,hu=xt.default.div`
|
|
686
686
|
position: relative;
|
|
687
|
-
`,
|
|
687
|
+
`,yu=xt.default.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
|
-
`;var
|
|
695
|
+
`;var hs=f(require("styled-components")),fo=require("react/jsx-runtime"),ki=({title:e,description:t,children:o,...r})=>(0,fo.jsx)(gu,{...r,children:(0,fo.jsxs)(fo.Fragment,{children:[(0,fo.jsx)("h3",{children:e}),typeof t=="string"?(0,fo.jsx)("p",{children:t}):t,o]})}),Mo=(0,hs.default)(ki)`
|
|
696
696
|
margin-bottom: 24px;
|
|
697
|
-
`,
|
|
697
|
+
`,Ge=({title:e,description:t,icon:o,children:r,...n})=>(0,fo.jsxs)(wv,{...n,children:[o||null,(0,fo.jsx)("h3",{children:e}),typeof t=="string"?(0,fo.jsx)("p",{children:t}):t,r]}),gu=hs.default.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
|
+
`,wv=(0,hs.default)(gu)`
|
|
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
|
-
`;var ae=require("react/jsx-runtime"),
|
|
725
|
+
`;var ae=require("react/jsx-runtime"),zl=6,vu=new Array(zl).fill(""),Cv=1400;var Tu=()=>{let{app:e,navigate:t,navigateBack:o,setModalData:r,onUserCloseViaDialogOrKeybindRef:n}=A(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:m}=W(),{authenticated:g,user:y}=V(),[v,b]=(0,_r.useState)(vu),[E,S]=(0,_r.useState)(!1),[T,P]=(0,_r.useState)(null),[O,I]=(0,_r.useState)(null);n.current=()=>null;let L=s()?.email?0:1,D=e?.render.inDialog?mt:0,M=e?.render.inDialog?D-500:0;(0,_r.useEffect)(()=>{if(g&&E&&y){if(e?.legal.requireUsersAcceptTerms&&!y.hasAcceptedTerms){let k=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},M);return()=>clearTimeout(k)}if(Gt(y,e?.embeddedWallets?.createOnLogin)){let k=setTimeout(()=>{r({createWallet:{onSuccess:()=>{},onFailure:Ee=>console.error(Ee),callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},M);return()=>clearTimeout(k)}else{m();let k=setTimeout(i,D);return()=>clearTimeout(k)}}},[g,E,y]),(0,_r.useEffect)(()=>{if(T&&O===0){let q=setTimeout(()=>{b(vu),P(null),document.querySelector("input[name=code-0]")?.focus()},Cv);return()=>clearTimeout(q)}},[T]);let G=q=>{q.preventDefault();let k=q.currentTarget.value.replace(" ","");if(k==="")return;if(isNaN(Number(k))){P("Code should be numeric"),I(1);return}P(null),I(null);let Ee=Number(q.currentTarget.name?.charAt(5)),pe=[...k||[""]].slice(0,zl-Ee),ee=[...v.slice(0,Ee),...pe,...v.slice(Ee+pe.length)];b(ee);let eo=pe.length,Re=Math.min(Math.max(Ee+eo,0),zl-1);isNaN(Number(q.currentTarget.value))||document.querySelector(`input[name=code-${Re}]`)?.focus(),ee.every(wt=>wt&&!isNaN(+wt))&&(document.querySelector(`input[name=code-${Re}]`)?.blur(),c(ee.join("")).then(()=>S(!0)).catch(et=>{et?.status===422?P("Invalid or expired verification code"):et instanceof Po&&et.privyErrorCode==="cannot_link_more_of_type"?P(et.message):P("Issue verifying code"),I(0)}))},Y=q=>{O===1&&(P(null),I(null));let k=[...v.slice(0,q),"",...v.slice(q+1)];b(k),q>0&&document.querySelector(`input[name=code-${q-1}]`)?.focus()},ie=L==0?(0,ae.jsx)(Cu.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):(0,ae.jsx)(bu.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),U=L==0?(0,ae.jsxs)("p",{children:["Please check ",(0,ae.jsx)(wu,{children:s()?.email})," for an email from privy.io and enter your code below."]}):(0,ae.jsxs)("p",{children:["Please check ",(0,ae.jsx)(wu,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(_,{backFn:()=>o()},"header"),(0,ae.jsxs)(bv,{children:[(0,ae.jsx)(Ge,{title:"Enter confirmation code",description:U,icon:ie}),(0,ae.jsxs)(mu,{children:[(0,ae.jsxs)(Ev,{children:[(0,ae.jsx)(Tv,{fail:!!T,success:E,children:(0,ae.jsx)("span",{children:T||(E?"Success!":"")})}),(0,ae.jsx)("div",{children:v.map((q,k)=>(0,ae.jsx)("input",{name:`code-${k}`,type:"text",value:v[k],onChange:G,onKeyUp:Ee=>{Ee.key==="Backspace"&&Y(k)},inputMode:"numeric",autoFocus:k===0,pattern:"[0-9]",className:`${E?"success":""} ${T?"fail":""}`,autoComplete:Eu.isMobile?"one-time-code":"off"},k))})]}),(0,ae.jsx)(Pv,{children:L==0?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)("span",{children:"Didn't get an email?"}),(0,ae.jsx)("button",{onClick:a,children:"Resend code"})]}):(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)("span",{children:"Didn't get a message?"}),(0,ae.jsx)("button",{onClick:l,children:"Resend code"})]})})]})]}),(0,ae.jsx)($,{protectedByPrivy:!0})]})},bv=Dn.default.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
|
+
`,Ev=Dn.default.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
|
+
`,Tv=Dn.default.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
|
+
`,Pv=Dn.default.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
|
+
`,wu=Dn.default.span`
|
|
812
812
|
font-weight: 500;
|
|
813
813
|
word-break: break-all;
|
|
814
|
-
`;var
|
|
814
|
+
`;var _u=f(require("@heroicons/react/24/solid/CheckCircleIcon")),Au=f(require("@heroicons/react/24/solid/XCircleIcon")),Mt=require("react"),ku=f(require("styled-components"));var Pu=f(require("styled-components"));var ho=require("react/jsx-runtime"),xu=({icon:e})=>{let t=e;return(0,ho.jsx)(ho.Fragment,{children:(0,ho.jsx)(xv,{children:(0,ho.jsxs)("div",{children:[(0,ho.jsx)(Pr,{}),typeof t=="string"?(0,ho.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?(0,ho.jsx)(t,{style:{width:"38px",height:"38px"}}):(0,ho.jsx)("span",{})]})})})},xv=Pu.default.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
|
-
`;var
|
|
837
|
+
`;var Ye=require("react/jsx-runtime"),Ru=500,Su=Ru*2,Iu=()=>{let{lastScreen:e,currentScreen:t,data:o,navigateBack:r,navigate:n,setModalData:i}=A(),{status:a,token:l,waitForResult:s,reset:c,execute:m}=Ae(),g=(0,Mt.useRef)([]),y=q=>{g.current=[q,...g.current]},[v,b]=(0,Mt.useState)(!0);(0,Mt.useEffect)(()=>{let q=setTimeout(b,Su,!1);return y(q),()=>{g.current.forEach(k=>clearTimeout(k)),g.current=[]}},[]);let[E,S]=(0,Mt.useState)(""),[T,P]=(0,Mt.useState)("Checking that you are a human..."),[O,I]=(0,Mt.useState)((0,Ye.jsx)(F,{onClick:()=>{},disabled:!0,children:"Continue"})),[L,D]=(0,Mt.useState)(!1),[M,G]=(0,Mt.useState)(3),Y=o?.captchaModalData,ie=async q=>{try{await Y?.callback(q),Y?.onSuccessNavigateTo&&n(Y?.onSuccessNavigateTo,!1)}catch(k){if(k instanceof er)return;{let Ee={error:k,previousScreen:e||"LANDING"};i({errorModalData:Ee}),n(Y?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};(0,Mt.useEffect)(()=>{if(a==="success"){let q=setTimeout(async()=>{let k=await s();!k||Y?.userIntentRequired||ie(k)},Su);y(q)}else if(a==="ready"){let q=setTimeout(()=>{a==="ready"&&m()},Ru);y(q)}},[a]),(0,Mt.useEffect)(()=>{if(!v)switch(a){case"success":S("Success!"),P("CAPTCHA passed successfully."),I((0,Ye.jsx)(F,{onClick:()=>{D(!0),ie(l)},disabled:!Y?.userIntentRequired,loading:L,children:Y?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":S(""),P("Checking that you are a human..."),I((0,Ye.jsx)(F,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":S("Something went wrong"),M<=0?(P("If you use an adblocker or VPN, try disabling and re-attempting."),I(null)):(P("You did not pass CAPTCHA. Please try again."),I((0,Ye.jsx)(F,{onClick:U,children:"Retry"})));break;case"ready":default:break}},[a,v,L]);let U=async()=>{if(M<=0)return;G(k=>k-1),c(),m();let q=await s();!q||Y?.userIntentRequired||ie(q)};return(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(_,{backFn:!e||t===e?void 0:r}),(0,Ye.jsxs)(Sv,{children:[a==="success"?(0,Ye.jsx)(_u.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?(0,Ye.jsx)(Au.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):(0,Ye.jsx)(xu,{}),(0,Ye.jsxs)(Yt,{children:[E?(0,Ye.jsx)("h3",{children:E}):null,(0,Ye.jsx)("p",{children:T})]}),O]}),(0,Ye.jsx)(Q,{})]})},Sv=ku.default.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
|
-
`;var Nu=f(require("@heroicons/react/24/outline/WalletIcon")),Lu=require("react-device-detect"),Ou=f(require("styled-components"));var ft=require("react/jsx-runtime"),Iu=({...e})=>(0,ft.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[(0,ft.jsx)("defs",{children:(0,ft.jsxs)("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:[(0,ft.jsx)("stop",{offset:"0",stopColor:"#f1562b"}),(0,ft.jsx)("stop",{offset:"0.3",stopColor:"#f1542b"}),(0,ft.jsx)("stop",{offset:"0.41",stopColor:"#f04d2a"}),(0,ft.jsx)("stop",{offset:"0.49",stopColor:"#ef4229"}),(0,ft.jsx)("stop",{offset:"0.5",stopColor:"#ef4029"}),(0,ft.jsx)("stop",{offset:"0.56",stopColor:"#e83e28"}),(0,ft.jsx)("stop",{offset:"0.67",stopColor:"#e13c26"}),(0,ft.jsx)("stop",{offset:"1",stopColor:"#df3c26"})]})}),(0,ft.jsx)("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"}),(0,ft.jsx)("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"})]});var B=require("react/jsx-runtime"),Wu=({style:e,...t})=>(0,B.jsxs)("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:[(0,B.jsx)("g",{clipPath:"url(#clip0_5_32)",children:(0,B.jsxs)("g",{clipPath:"url(#clip1_5_32)",children:[(0,B.jsx)("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,B.jsx)("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"})}),(0,B.jsx)("g",{mask:"url(#mask0_5_32)",children:(0,B.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),(0,B.jsx)("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)"}),(0,B.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),(0,B.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),(0,B.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),(0,B.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),(0,B.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),(0,B.jsx)("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)"}),(0,B.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),(0,B.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),(0,B.jsxs)("defs",{children:[(0,B.jsxs)("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,B.jsx)("stop",{stopColor:"#174299"}),(0,B.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),(0,B.jsxs)("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,B.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,B.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,B.jsxs)("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,B.jsx)("stop",{stopColor:"#FF4000"}),(0,B.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,B.jsxs)("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,B.jsx)("stop",{stopColor:"#8754C9"}),(0,B.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),(0,B.jsxs)("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,B.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,B.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,B.jsxs)("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,B.jsx)("stop",{stopColor:"#FFF700"}),(0,B.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,B.jsxs)("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,B.jsx)("stop",{stopColor:"#FFF700"}),(0,B.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,B.jsxs)("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,B.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,B.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,B.jsxs)("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,B.jsx)("stop",{stopColor:"#00AAFF"}),(0,B.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,B.jsxs)("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:[(0,B.jsx)("stop",{stopColor:"#00AAFF"}),(0,B.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,B.jsx)("clipPath",{id:"clip0_5_32",children:(0,B.jsx)("rect",{width:"120",height:"120",fill:"white"})}),(0,B.jsx)("clipPath",{id:"clip1_5_32",children:(0,B.jsx)("rect",{width:"120",height:"120",fill:"white"})})]})]});var tr=require("react/jsx-runtime"),Mu=({style:e,...t})=>(0,tr.jsxs)("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:[(0,tr.jsxs)("g",{clipPath:"url(#clip0_1704_1423)",children:[(0,tr.jsx)("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"}),(0,tr.jsx)("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"})]}),(0,tr.jsx)("defs",{children:(0,tr.jsx)("clipPath",{id:"clip0_1704_1423",children:(0,tr.jsx)("rect",{width:"176",height:"176",fill:"white"})})})]});var or=require("react/jsx-runtime"),Mo={coinbase_wallet:{logo:Ti,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:xn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:So,displayName:"Phantom"},rainbow:{logo:Wu,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:_i,displayName:"WalletConnect"},zerion:{logo:Mu,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Iu,displayName:"Brave Wallet",rdns:"com.brave.wallet"}},Dn=({provider:e,displayName:t,logo:o,connectOnly:r,connector:n})=>{let{navigate:i}=A(),{connectWallet:a}=I(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{hr()?(a(n,l),i(r?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Lu.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(r?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},(0,or.jsxs)(Pv,{onClick:s,children:[(0,or.jsx)(Tv,{icon:Ev(e,n.connectorType)??o,name:n.walletClientType}),(0,or.jsx)("span",{style:{textTransform:"capitalize"},children:bv(e,n.connectorType)||t||n.walletClientType}),(0,or.jsx)("span",{id:"connect-text",children:"Connect"})]})},bv=(e,t)=>{if(Mo[e]?.displayName)return Mo[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Ev=(e,t)=>{if(Mo[e]?.logo)return Mo[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return _i},Tv=({icon:e,name:t})=>typeof e=="string"?(0,or.jsx)("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?(0,or.jsx)(Nu.default,{}):e?(0,or.jsx)(e,{}):null,Pv=(0,Ou.default)(We)`
|
|
844
|
+
`;var Lu=f(require("@heroicons/react/24/outline/WalletIcon")),Ou=require("react-device-detect"),Du=f(require("styled-components"));var gt=require("react/jsx-runtime"),Wu=({...e})=>(0,gt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[(0,gt.jsx)("defs",{children:(0,gt.jsxs)("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:[(0,gt.jsx)("stop",{offset:"0",stopColor:"#f1562b"}),(0,gt.jsx)("stop",{offset:"0.3",stopColor:"#f1542b"}),(0,gt.jsx)("stop",{offset:"0.41",stopColor:"#f04d2a"}),(0,gt.jsx)("stop",{offset:"0.49",stopColor:"#ef4229"}),(0,gt.jsx)("stop",{offset:"0.5",stopColor:"#ef4029"}),(0,gt.jsx)("stop",{offset:"0.56",stopColor:"#e83e28"}),(0,gt.jsx)("stop",{offset:"0.67",stopColor:"#e13c26"}),(0,gt.jsx)("stop",{offset:"1",stopColor:"#df3c26"})]})}),(0,gt.jsx)("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"}),(0,gt.jsx)("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"})]});var H=require("react/jsx-runtime"),Mu=({style:e,...t})=>(0,H.jsxs)("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:[(0,H.jsx)("g",{clipPath:"url(#clip0_5_32)",children:(0,H.jsxs)("g",{clipPath:"url(#clip1_5_32)",children:[(0,H.jsx)("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,H.jsx)("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"})}),(0,H.jsx)("g",{mask:"url(#mask0_5_32)",children:(0,H.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),(0,H.jsx)("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)"}),(0,H.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),(0,H.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),(0,H.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),(0,H.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),(0,H.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),(0,H.jsx)("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)"}),(0,H.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),(0,H.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),(0,H.jsxs)("defs",{children:[(0,H.jsxs)("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,H.jsx)("stop",{stopColor:"#174299"}),(0,H.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),(0,H.jsxs)("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,H.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,H.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,H.jsxs)("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,H.jsx)("stop",{stopColor:"#FF4000"}),(0,H.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,H.jsxs)("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,H.jsx)("stop",{stopColor:"#8754C9"}),(0,H.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),(0,H.jsxs)("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,H.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,H.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,H.jsxs)("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,H.jsx)("stop",{stopColor:"#FFF700"}),(0,H.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,H.jsxs)("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,H.jsx)("stop",{stopColor:"#FFF700"}),(0,H.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,H.jsxs)("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,H.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,H.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,H.jsxs)("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,H.jsx)("stop",{stopColor:"#00AAFF"}),(0,H.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,H.jsxs)("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:[(0,H.jsx)("stop",{stopColor:"#00AAFF"}),(0,H.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,H.jsx)("clipPath",{id:"clip0_5_32",children:(0,H.jsx)("rect",{width:"120",height:"120",fill:"white"})}),(0,H.jsx)("clipPath",{id:"clip1_5_32",children:(0,H.jsx)("rect",{width:"120",height:"120",fill:"white"})})]})]});var rr=require("react/jsx-runtime"),Nu=({style:e,...t})=>(0,rr.jsxs)("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:[(0,rr.jsxs)("g",{clipPath:"url(#clip0_1704_1423)",children:[(0,rr.jsx)("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"}),(0,rr.jsx)("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"})]}),(0,rr.jsx)("defs",{children:(0,rr.jsx)("clipPath",{id:"clip0_1704_1423",children:(0,rr.jsx)("rect",{width:"176",height:"176",fill:"white"})})})]});var nr=require("react/jsx-runtime"),No={coinbase_wallet:{logo:Pi,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:Sn,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:_o,displayName:"Phantom"},rainbow:{logo:Mu,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Ai,displayName:"WalletConnect"},zerion:{logo:Nu,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Wu,displayName:"Brave Wallet",rdns:"com.brave.wallet"}},Un=({provider:e,displayName:t,logo:o,connectOnly:r,connector:n})=>{let{navigate:i}=A(),{connectWallet:a}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{yr()?(a(n,l),i(r?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Ou.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(r?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},(0,nr.jsxs)(Rv,{onClick:s,children:[(0,nr.jsx)(kv,{icon:Av(e,n.connectorType)??o,name:n.walletClientType}),(0,nr.jsx)("span",{style:{textTransform:"capitalize"},children:_v(e,n.connectorType)||t||n.walletClientType}),(0,nr.jsx)("span",{id:"connect-text",children:"Connect"})]})},_v=(e,t)=>{if(No[e]?.displayName)return No[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Av=(e,t)=>{if(No[e]?.logo)return No[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Ai},kv=({icon:e,name:t})=>typeof e=="string"?(0,nr.jsx)("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?(0,nr.jsx)(Lu.default,{}):e?(0,nr.jsx)(e,{}):null,Rv=(0,Du.default)(We)`
|
|
845
845
|
/* Show "Connect" on hover */
|
|
846
846
|
> #connect-text {
|
|
847
847
|
font-weight: 500;
|
|
@@ -863,23 +863,23 @@ Resources:
|
|
|
863
863
|
display: none;
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
`;var
|
|
866
|
+
`;var Lo=require("react/jsx-runtime"),Iv=["coinbase_wallet"],Wv=["metamask","rainbow","zerion"],Mv=["phantom"],Fn=({connectOnly:e})=>{let{connectors:t}=W(),{app:o}=A(),r=$l(o?.appearance.walletList??[],t,e);return(0,Lo.jsxs)(Lo.Fragment,{children:[...r]})},$l=(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:m})=>c==="injected"&&!e.includes(m));for(let c of s){let{walletClientType:m,walletBranding:g}=c;(m==="unknown"?n:r).push((0,Lo.jsx)(Un,{connectOnly:o,provider:m,logo:g.icon,displayName:g.name,connector:c},`${l}-${m}`))}}else if(Mv.includes(l)){let s=t.find(c=>c.connectorType==="injected"&&c.walletClientType===l||c.connectorType===l);s&&r.push((0,Lo.jsx)(Un,{connectOnly:o,provider:l,connector:s},l))}else if(Wv.includes(l)){let s=t.find(c=>c.connectorType==="injected"&&c.walletClientType===l)??a;s&&r.push((0,Lo.jsx)(Un,{connectOnly:o,provider:l,connector:s},l))}else if(Iv.includes(l)){let s=t.find(({connectorType:c})=>c===l);s&&r.push((0,Lo.jsx)(Un,{connectOnly:o,provider:l,connector:s},l))}else l==="wallet_connect"&&a&&i.push((0,Lo.jsx)(Un,{connectOnly:o,provider:l,connector:a},l));return[...n,...r,...i]};var Oo=require("react/jsx-runtime"),Uu=()=>{let{app:e}=A(),t=`Connect a wallet to ${e?.name}`;return(0,Oo.jsxs)(Oo.Fragment,{children:[(0,Oo.jsx)(_,{},"header"),(0,Oo.jsx)(Mo,{title:"Connect your wallet",description:t}),(0,Oo.jsx)(Io,{children:(0,Oo.jsx)(Fn,{connectOnly:!0})}),(0,Oo.jsx)($,{protectedByPrivy:!0})]})};var Vu=f(require("styled-components"));var Gu=f(require("styled-components"));var Fu=f(require("react"));var Hu=require("react/jsx-runtime"),Bu=()=>{let{app:e}=A(),t=e?.appearance?.logo,o=`${e?.name} logo`,r={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?(0,Hu.jsx)("img",{src:t,alt:o,style:r}):t.type==="svg"||t.type==="img"?Fu.default.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};var ql=require("react/jsx-runtime"),ys=e=>{let{app:t}=A();return t?.appearance.logo?(0,ql.jsx)(Nv,{...e,children:(0,ql.jsx)(Bu,{})}):null},Nv=Gu.default.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
|
-
`;var
|
|
873
|
+
`;var yo=require("react/jsx-runtime"),zu=()=>{let{app:e}=A();return(0,yo.jsxs)(yo.Fragment,{children:[(0,yo.jsx)(_,{},"header"),(0,yo.jsx)(Lv,{}),(0,yo.jsx)(Io,{children:(0,yo.jsx)(Fn,{connectOnly:!0})}),e&&(0,yo.jsx)(ns,{app:e,alwaysShowImplicitConsent:!0}),(0,yo.jsx)($,{protectedByPrivy:!0})]})},Lv=(0,Vu.default)(ys)`
|
|
874
874
|
margin-bottom: 16px;
|
|
875
|
-
`;var
|
|
875
|
+
`;var Gn=require("react"),Ku=require("react-device-detect"),Yu=f(require("styled-components"));var Jt=require("react"),Hn=require("react-device-detect"),qu=require("react-use"),Kl=f(require("styled-components"));var Bn=require("react");function $u(){let[e,t]=(0,Bn.useState)(!1),o=(0,Bn.useCallback)(()=>{document.hidden&&t(!0)},[]);return(0,Bn.useEffect)(()=>(document.addEventListener("visibilitychange",o),()=>document.removeEventListener("visibilitychange",o)),[o]),{hasTabbedAway:e,reset:()=>t(!1)}}var ye=require("react/jsx-runtime"),jl=2,Yl=e=>e?.privyErrorCode==="linked_to_another_user"?Zo.ERROR_USER_EXISTS:e instanceof ot&&!e.details.default?e.details:e instanceof En?Zo.ERROR_TIMED_OUT:e instanceof Tn?Zo.ERROR_USER_REJECTED_CONNECTION:Zo.ERROR_WALLET_CONNECTION,ju=()=>{let[e,t]=(0,Jt.useState)(!1),[o,r]=(0,Jt.useState)(!1),[n,i]=(0,Jt.useState)(void 0),{authenticated:a}=V(),{app:l,navigate:s,navigateBack:c,lastScreen:m,currentScreen:g,setModalData:y}=A(),{getAuthFlow:v,walletConnectionStatus:b,closePrivyModal:E,initLoginWithWallet:S,loginWithWallet:T,updateWallets:P}=W(),{walletConnectors:O}=V(),[I,L]=(0,Jt.useState)(0),{user:D}=V(),[M]=(0,Jt.useState)(D?.linkedAccounts.length||0),[G,Y]=(0,Jt.useState)(""),[ie,U]=(0,Jt.useState)(!1),{hasTabbedAway:q}=$u(),{enabled:k,token:Ee}=Ae(),pe=Hn.isMobile&&b?.connector?.connectorType==="wallet_connect_v2"||Hn.isMobile&&b?.connector?.connectorType==="coinbase_wallet"||Hn.isMobile&&b?.connector?.connectorType==="injected"&&b?.connector?.walletClientType==="phantom",ee=b?.status==="connected",eo=b?.status==="switching_to_supported_chain";(0,Jt.useEffect)(()=>{let R=v();if(ee&&!R&&(k&&!Ee&&!a?(y({captchaModalData:{callback:st=>S(b.connectedWallet,st).then(()=>{U(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN",!1)):S(b.connectedWallet,Ee).then(()=>{U(!0)})),R&&pe&&ee&&!R.preparedMessage){R.buildSiweMessage();return}!R||pe||!ee||o||(async()=>{r(!0),i(void 0);try{b?.connector?.connectorType==="wallet_connect_v2"&&b?.connector?.walletClientType==="metamask"&&await vl(2500),await wt()}catch(st){console.warn("Auto-prompted signature failed",st)}finally{r(!1)}})()},[I,ee,ie]),(0,Jt.useEffect)(()=>{if(D&&e){let R=l?.render.inDialog?mt:0,st=l?.render.inDialog?R-500:0;if(l?.legal.requireUsersAcceptTerms&&!D.hasAcceptedTerms){let re=setTimeout(()=>{s("AFFIRMATIVE_CONSENT_SCREEN")},st);return()=>clearTimeout(re)}if(Gt(D,l?.embeddedWallets?.createOnLogin)){let re=setTimeout(()=>{y({createWallet:{onSuccess:()=>{},onFailure:oo=>console.error(oo),callAuthOnSuccessOnClose:!0}}),s("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},st);return()=>clearTimeout(re)}P();let vi=setTimeout(E,mt);return()=>clearTimeout(vi)}},[D,e]);let Re=R=>{if(R?.privyErrorCode==="allowlist_rejected"){s("ALLOWLIST_REJECTION_SCREEN");return}i(Yl(R))};async function wt(){try{if(await T(),!l?.render.inDialog)return E();t(!0)}catch(R){Re(R)}finally{r(!1)}}(0,Jt.useEffect)(()=>{b?.connectError&&Re(b?.connectError)},[b]),(0,qu.useInterval)(()=>{let R=et==="wallet_connect_v2"&&b?.connector instanceof ko?b.connector.redirectUri:void 0;R&&Y(R)},b?.connector instanceof ko&&!G?500:null);let et=b?.connector?.connectorType||"injected",le=b?.connector?.walletClientType||"unknown",Ko=No[le]?.displayName||b?.connector?.walletBranding.name||"Browser Extension",to=No[le]?.logo||b?.connector?.walletBranding.icon||(R=>(0,ye.jsx)(xn,{...R})),un=Ko==="Browser Extension"?Ko.toLowerCase():Ko,Ct;e?Ct=`Successfully connected with ${un}`:n?Ct=n.message:eo?Ct="Switching networks":ee?Ct=o&&pe?"Signing":"Sign to verify":Ct=`Waiting for ${un}`;let $e="Don\u2019t see your wallet? Check your other browser windows.";if(e){let R=D?.linkedAccounts.length||0;M===R?$e="Wallet was already linked.":$e="You\u2019re good to go!"}else I>=jl&&n?$e="Unable to connect wallet":n?$e=n.detail:eo?$e="Switch your wallet to the requested network.":ee&&pe?$e="Sign the message in your wallet to verify it belongs to you.":le==="metamask"&&Hn.isMobile?$e="Click continue to open and connect MetaMask.":le==="metamask"?$e="For the best experience, connect only one wallet at a time.":et==="wallet_connect"?$e="Open your mobile wallet app to continue":et==="coinbase_wallet"&&(Hd()||(Al(D)?$e="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":$e="Open the Coinbase app on your phone to continue."));let To=O?.walletConnectors?.find(R=>R.walletClientType==="coinbase_wallet"),mn=le==="coinbase_wallet"&&(Al(D)||n===Zo.ERROR_USER_EXISTS);return(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)(_,{backFn:!m||g===m?void 0:c}),(0,ye.jsxs)(Dv,{children:[(0,ye.jsx)(Jl,{walletLogo:to,success:e,fail:!!n}),(0,ye.jsxs)(Yt,{children:[(0,ye.jsx)("h3",{children:Ct}),(0,ye.jsx)("p",{children:$e}),!ee&&G&&!q?(0,ye.jsxs)("p",{children:["Still here?"," ",(0,ye.jsx)("a",{href:G,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),mn?(0,ye.jsx)(F,{onClick:()=>To&&To?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Zo.ERROR_USER_EXISTS&&g!==m?(0,ye.jsx)(F,{onClick:c,children:"Use a different wallet"}):ee&&!e&&pe?(0,ye.jsx)(F,{onClick:()=>{r(!0),wt(),Ov(le)},disabled:o,children:o?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&I<jl?(0,ye.jsx)(F,{onClick:()=>{L(I+1),i(void 0),ee?(r(!0),wt()):b?.connectRetry()},disabled:!e&&(!n?.retryable||I>=jl),children:"Retry"}):!e&&!n?(0,ye.jsx)(F,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),(0,ye.jsx)(Q,{})]})},Ov=e=>{if(!Hn.isMobile||!Ap(e))return;let t=kp(e);t&&window.open(t,"_self","noopener,noreferrer")},Dv=Kl.default.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
|
+
`,Uv=Kl.default.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
|
+
`,Jl=e=>{let t=e.walletLogo;return(0,ye.jsx)(ye.Fragment,{children:(0,ye.jsx)(Uv,{children:(0,ye.jsxs)("div",{children:[(0,ye.jsx)(Pr,{success:e.success,fail:e.fail}),typeof t=="string"?(0,ye.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,ye.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var it=require("react/jsx-runtime"),gs=2,Ju=()=>{let{navigateBack:e,lastScreen:t,currentScreen:o}=A(),{walletConnectionStatus:r,closePrivyModal:n}=W(),[i,a]=(0,Gn.useState)(void 0),[l,s]=(0,Gn.useState)(0),c=r?.status==="connected",m=r?.status==="switching_to_supported_chain";(0,Gn.useEffect)(()=>{if(c){let O=setTimeout(n,mt);return()=>clearTimeout(O)}},[c]);let g=O=>{a(Yl(O))};(0,Gn.useEffect)(()=>{r?.connectError&&g(r?.connectError)},[r]);let y=r?.connector?.connectorType||"injected",v=r?.connector?.walletClientType||"unknown",b=No[v]?.displayName||r?.connector?.walletBranding.name||"Browser Extension",E=No[v]?.logo||r?.connector?.walletBranding.icon||(O=>(0,it.jsx)(xn,{...O})),S=b==="Browser Extension"?b.toLowerCase():b,T;c?T=`Successfully connected with ${S}`:i?T=i.message:m?T="Switching networks":T=`Waiting for ${S}`;let P="Don\u2019t see your wallet? Check your other browser windows.";return c?P="You\u2019re good to go!":l>=gs&&i?P="Unable to connect wallet":i?P=i.detail:m?P="Switch your wallet to the requested network.":v==="metamask"&&Ku.isMobile?P="Click to continue to open and connect MetaMask.":v==="metamask"?P="For the best experience, connect only one wallet at a time.":y==="wallet_connect_v2"?P="Open your mobile wallet app to continue":y==="coinbase_wallet"&&(P="Open the Coinbase app on your phone to continue."),(0,it.jsxs)(it.Fragment,{children:[(0,it.jsx)(_,{backFn:o===t?void 0:e}),(0,it.jsxs)(Fv,{children:[(0,it.jsx)(Jl,{walletLogo:E,success:c,fail:!!i}),(0,it.jsxs)(Yt,{children:[(0,it.jsx)("h3",{children:T}),(0,it.jsx)("p",{children:P})]}),i==Zo.ERROR_USER_EXISTS?(0,it.jsx)(F,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<gs?(0,it.jsx)(F,{onClick:()=>{s(l+1),a(void 0),r?.connectRetry()},disabled:!c&&(!i?.retryable||l>=gs),children:"Retry"}):!c&&i&&l>=gs?(0,it.jsx)(F,{onClick:e,children:"Use a different wallet"}):null]}),(0,it.jsx)(Q,{})]})},Fv=Yu.default.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
|
-
`;var
|
|
912
|
+
`;var tm=f(require("@heroicons/react/24/solid/XCircleIcon")),$n=require("react"),om=f(require("styled-components"));var Ri=f(require("styled-components")),Vn=require("react/jsx-runtime"),zn=()=>(0,Vn.jsx)(Bv,{children:(0,Vn.jsxs)(Hv,{children:[(0,Vn.jsx)(Gv,{}),(0,Vn.jsx)(Vv,{})]})}),Bv=Ri.default.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
|
+
`,Hv=Ri.default.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
|
+
`,Gv=Ri.default.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
|
+
`,Vv=Ri.default.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 Qu=["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 Ve=class extends Error{constructor(o,r){super(r);this.type=o}};function jr(e){let t=e.type;return typeof t=="string"&&Qu.includes(t)}function zv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Kr(e){return jr(e)&&e.type==="wallet_not_on_device"}function Zu(e){return jr(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function Xu(e){return!!(jr(e)&&e.type==="insufficient_funds"||e.code==="INSUFFICIENT_FUNDS")}function Yr(e){return!!(jr(e)&&e.type==="mfa_timeout")}function Jr(e){return!!(jr(e)&&e.type==="missing_or_invalid_mfa")}function vs(e){return!!(jr(e)&&e.type==="mfa_verification_max_attempts_reached")}function Ql(e){return!!(jr(e)&&e.message.includes("code 429"))}function Zl(e){return!!(zv(e)&&e.message==="MFA canceled")}var St=require("react/jsx-runtime"),em=1,rm=()=>{let{authenticated:e,user:t,getAccessToken:o}=V(),{closePrivyModal:r,createAnalyticsEvent:n,walletProxy:i}=W(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=A(),m=(0,$n.useMemo)(()=>Date.now(),[]),[g,y]=(0,$n.useState)(!1),{onCompleteNavigateTo:v,onFailure:b}=l?.connectWallet,E=T=>{g||(y(!0),b(typeof T=="string"?new Error(T):T))};(0,$n.useEffect)(()=>{let T=Se(t),P;return!e||!T?E("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let I=await o();if(!I)return E("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:I,address:T.address});let L=(Date.now()-m)/1e3;v==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&L<em?P=setTimeout(()=>{a(v)},(em-L)*1e3):a(v)}catch(L){if(Kr(L)&&T.recoveryMethod==="privy"){let D=await o();if(!D)return E("User must be authenticated and have a Privy wallet before it can be recovered");try{n("embedded_wallet_pinless_recovery_started",{walletAddress:T.address}),(await i?.recover({address:T.address,accessToken:D}))?.address||E(new Error("Unable to recover wallet")),v?a(v):r({shouldCallAuthOnSuccess:!1}),n("embedded_wallet_recovery_completed",{walletAddress:T.address}),a(v)}catch{E("An error has occurred, please try again.")}}else Kr(L)?(s({...l,recoverWallet:{privyWallet:T,onCompleteNavigateTo:v,onFailure:b}}),a("EMBEDDED_WALLET_RECOVERY_SCREEN")):E(L)}})(),()=>clearTimeout(P)):void 0},[e,t,i]);let S=()=>{E("User exited before wallet could be connected"),r({shouldCallAuthOnSuccess:!1})};return c.current=S,(0,St.jsxs)(St.Fragment,{children:[(0,St.jsx)(_,{onClose:S}),g?(0,St.jsxs)(St.Fragment,{children:[(0,St.jsxs)(mo,{children:[(0,St.jsx)(tm.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,St.jsx)(Ge,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),(0,St.jsx)(F,{onClick:()=>r({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):(0,St.jsx)(zn,{}),(0,St.jsx)($v,{})]})},$v=om.default.div`
|
|
969
969
|
height: 44px;
|
|
970
|
-
`;var
|
|
970
|
+
`;var nm=f(require("@heroicons/react/24/solid/CheckCircleIcon")),im=require("react");var Qt=require("react/jsx-runtime"),am=()=>{let{user:e}=V(),{closePrivyModal:t,isNewUserThisSession:o,updateWallets:r}=W(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=A(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,m=()=>{let g=Se(e);g?(r(),l(g)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return(0,im.useEffect)(()=>{let g=setTimeout(m,Rd);return()=>clearTimeout(g)},[]),a.current=m,(0,Qt.jsxs)(Qt.Fragment,{children:[(0,Qt.jsx)(_,{onClose:m}),(0,Qt.jsx)(Z,{}),(0,Qt.jsxs)(mo,{children:[(0,Qt.jsx)(nm.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,Qt.jsx)(Ge,{title:o?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:o?"You\u2019ve successfully created an account.":"Your account is secured."})]}),(0,Qt.jsx)(te,{}),(0,Qt.jsx)($,{protectedByPrivy:!0})]})};var cm=f(require("@heroicons/react/20/solid/ExclamationTriangleIcon")),dm=f(require("@heroicons/react/24/outline/ArrowRightOnRectangleIcon")),ir=require("react"),ar=f(require("styled-components"));var oe=require("react/jsx-runtime"),pm=()=>{let[e,t]=(0,ir.useState)(null),{authenticated:o,user:r,getAccessToken:n}=V(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=W(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=A(),m=Se(r)?.address,{onFailure:g,onSuccess:y,origin:v,appId:b}=s.keyExport,E=T=>{i({shouldCallAuthOnSuccess:!1}),g(typeof T=="string"?new Error(T):T)},S=()=>{i({shouldCallAuthOnSuccess:!1}),y(),a("embedded_wallet_key_export_completed",{walletAddress:m})};return(0,ir.useEffect)(()=>{let T=Se(r);if(!o||!T)return E("User must be authenticated before exporting their wallet");n().then(t,E)},[o,r]),c.current=S,(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(_,{onClose:S}),(0,oe.jsxs)(Kv,{children:[(0,oe.jsxs)(Ge,{icon:(0,oe.jsx)(dm.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[(0,oe.jsxs)(Zv,{children:[(0,oe.jsx)(jv,{style:{marginRight:6}}),gr(m)]}),(0,oe.jsx)("p",{children:"You can bring your account with you to another site using an external wallet."})]}),(0,oe.jsxs)(Yv,{children:[(0,oe.jsxs)(sm,{children:[(0,oe.jsx)(lm,{children:"1"}),(0,oe.jsxs)("span",{children:[(0,oe.jsx)("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."]})]}),(0,oe.jsxs)(sm,{children:[(0,oe.jsx)(lm,{children:"2"}),(0,oe.jsx)("span",{children:"Copy this key into your other wallet"})]})]}),(0,oe.jsx)("div",{style:{width:"100%"},children:e&&(0,oe.jsx)(qv,{origin:v,appId:b,accessToken:e,clientAnalyticsId:l,address:m,dimensions:{height:"44px"}})}),(0,oe.jsxs)(Xv,{children:[(0,oe.jsxs)("div",{children:[(0,oe.jsx)(cm.default,{viewBox:"0 0 20 18"}),(0,oe.jsx)("h4",{children:"Warning"})]}),(0,oe.jsx)("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),(0,oe.jsx)($,{protectedByPrivy:!0})]})};function qv(e){let[t,o]=(0,ir.useState)(e.dimensions.width),[r,n]=(0,ir.useState)(void 0),i=(0,ir.useRef)(null);return(0,ir.useEffect)(()=>{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")})},[]),(0,oe.jsx)("div",{ref:i,children:t&&(0,oe.jsxs)(Jv,{children:[(0,oe.jsx)("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:ya(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...r})}),(0,oe.jsx)(Qv,{children:"Loading..."})]})})}function jv(e){return(0,oe.jsx)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:(0,oe.jsx)("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 Kv=ar.default.div`
|
|
971
971
|
display: flex;
|
|
972
972
|
flex-direction: column;
|
|
973
973
|
text-align: left;
|
|
974
|
-
`,
|
|
974
|
+
`,Yv=ar.default.div`
|
|
975
975
|
display: flex;
|
|
976
976
|
flex-direction: column;
|
|
977
977
|
gap: 24px;
|
|
978
978
|
padding-bottom: 16px;
|
|
979
979
|
margin-left: 11px;
|
|
980
980
|
border-left: 1px solid var(--privy-color-foreground-4) !important;
|
|
981
|
-
`,
|
|
981
|
+
`,sm=ar.default.div`
|
|
982
982
|
display: flex;
|
|
983
983
|
align-items: top;
|
|
984
984
|
gap: 8px;
|
|
@@ -987,7 +987,7 @@ Resources:
|
|
|
987
987
|
color: var(--privy-color-accent);
|
|
988
988
|
text-decoration: underline;
|
|
989
989
|
}
|
|
990
|
-
`,
|
|
990
|
+
`,lm=ar.default.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
|
+
`,Jv=ar.default.div`
|
|
1005
1005
|
overflow: visible;
|
|
1006
1006
|
position: relative;
|
|
1007
1007
|
height: 44px;
|
|
1008
|
-
|
|
1008
|
+
`,Qv=ar.default.div`
|
|
1009
1009
|
position: absolute;
|
|
1010
1010
|
display: flex;
|
|
1011
1011
|
align-items: center;
|
|
@@ -1017,7 +1017,7 @@ Resources:
|
|
|
1017
1017
|
border-radius: var(--privy-border-radius-md);
|
|
1018
1018
|
background-color: var(--privy-color-background-2);
|
|
1019
1019
|
color: var(--privy-color-foreground-3);
|
|
1020
|
-
`,
|
|
1020
|
+
`,Zv=ar.default.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
|
+
`,Xv=ar.default.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
|
-
`;var
|
|
1055
|
+
`;var Km=f(require("@heroicons/react/24/outline/XCircleIcon")),go=require("react"),Ym=f(require("styled-components"));var Li=require("react");var wm=f(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Yn=require("react");var um=f(require("@heroicons/react/24/outline/ArrowPathIcon")),mm=f(require("@heroicons/react/24/outline/EyeIcon")),fm=f(require("@heroicons/react/24/outline/EyeSlashIcon")),Ne=f(require("styled-components"));var ew=Ne.css`
|
|
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
|
+
`,ws=Ne.default.span`
|
|
1064
|
+
${ew}
|
|
1065
1065
|
transition: color 0.1s ease-in;
|
|
1066
1066
|
color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1067
1067
|
text-transform: ${({error:e})=>e?"":"capitalize"};
|
|
@@ -1069,18 +1069,18 @@ Resources:
|
|
|
1069
1069
|
&[aria-hidden='true'] {
|
|
1070
1070
|
visibility: hidden;
|
|
1071
1071
|
}
|
|
1072
|
-
`,
|
|
1072
|
+
`,Ar=Ne.default.div`
|
|
1073
1073
|
display: flex;
|
|
1074
1074
|
flex-direction: column;
|
|
1075
1075
|
justify-content: center;
|
|
1076
1076
|
flex-grow: 1;
|
|
1077
|
-
`,
|
|
1077
|
+
`,kr=(0,Ne.default)(F)`
|
|
1078
1078
|
${e=>e.hideAnimations&&Ne.css`
|
|
1079
1079
|
&& {
|
|
1080
1080
|
transition: none;
|
|
1081
1081
|
}
|
|
1082
1082
|
`}
|
|
1083
|
-
`,
|
|
1083
|
+
`,hm=Ne.css`
|
|
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
|
-
`,
|
|
1099
|
-
${
|
|
1098
|
+
`,Qr=Ne.default.input`
|
|
1099
|
+
${hm}
|
|
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
|
-
`,
|
|
1106
|
+
`,ym=Ne.default.div`
|
|
1107
|
+
${hm}
|
|
1108
|
+
`,Rr=Ne.default.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
|
-
`,
|
|
1114
|
+
`,Ir=Ne.default.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
|
+
`,Ii=Ne.default.div`
|
|
1137
1137
|
display: flex;
|
|
1138
1138
|
flex-direction: column;
|
|
1139
1139
|
gap: 10px;
|
|
1140
1140
|
padding-bottom: 1rem;
|
|
1141
|
-
`,
|
|
1141
|
+
`,Wi=Ne.default.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
|
+
`,Ux=Ne.default.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
|
+
`,Xl=(0,Ne.default)(es)`
|
|
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
|
-
|
|
1179
|
+
`,qn=Ne.default.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
|
+
`,gm=(0,Ne.default)(um.default)`
|
|
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
|
-
`,
|
|
1196
|
+
`,jn=(0,Ne.default)(fm.default)`
|
|
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
|
-
`,
|
|
1205
|
+
`,Kn=(0,Ne.default)(mm.default)`
|
|
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
|
+
`,vm=Ne.default.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
|
-
`;var Le=require("react/jsx-runtime"),
|
|
1230
|
+
`;var Le=require("react/jsx-runtime"),Cm=({buttonHideAnimations:e,buttonLoading:t,password:o,onSubmit:r,onBack:n})=>{let[i,a]=(0,Yn.useState)(!0),[l,s]=(0,Yn.useState)(!1),[c,m]=(0,Yn.useState)(""),g=o===c;return(0,Yn.useEffect)(()=>{c&&!l&&s(!0)},[c]),(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(_,{title:"Confirm Password",closeable:!1,backFn:n}),(0,Le.jsx)(Z,{}),(0,Le.jsxs)(Ar,{children:[(0,Le.jsxs)(Ir,{children:[(0,Le.jsx)(wm.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,Le.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),(0,Le.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),(0,Le.jsxs)(Rr,{children:[(0,Le.jsx)(Qr,{value:c,onChange:y=>m(y.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text"}),(0,Le.jsx)(qn,{style:{right:"0.75rem"},children:i?(0,Le.jsx)(jn,{onClick:()=>a(!1)}):(0,Le.jsx)(Kn,{onClick:()=>a(!0)})})]}),(0,Le.jsx)(ws,{"aria-hidden":!l||g,error:!0,children:"Passwords do not match"})]}),(0,Le.jsx)(kr,{onClick:r,loading:t,disabled:!g,hideAnimations:e,children:"Continue"}),(0,Le.jsx)(te,{}),(0,Le.jsx)($,{protectedByPrivy:!0})]})};var Pm=f(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),xm=require("react"),Sm=f(require("styled-components"));var Mi=f(require("styled-components")),Wr=require("react/jsx-runtime"),bm=({className:e,checked:t,color:o="var(--privy-color-accent)",...r})=>(0,Wr.jsx)("label",{children:(0,Wr.jsxs)(tw,{className:e,children:[(0,Wr.jsx)(Tm,{checked:t,...r}),(0,Wr.jsx)(ow,{color:o,checked:t,children:(0,Wr.jsx)(Em,{viewBox:"0 0 24 24",children:(0,Wr.jsx)("polyline",{points:"20 6 9 17 4 12"})})})]})}),tw=Mi.default.div`
|
|
1231
1231
|
display: inline-block;
|
|
1232
1232
|
vertical-align: middle;
|
|
1233
|
-
`,
|
|
1233
|
+
`,Em=Mi.default.svg`
|
|
1234
1234
|
fill: none;
|
|
1235
1235
|
stroke: white;
|
|
1236
1236
|
stroke-width: 3px;
|
|
1237
|
-
`,
|
|
1237
|
+
`,Tm=Mi.default.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
|
+
`,ow=Mi.default.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
|
+
${Tm}:focus + & {
|
|
1264
1264
|
box-shadow: 0 0 0 1px ${e=>e.color};
|
|
1265
1265
|
}
|
|
1266
1266
|
|
|
1267
|
-
${
|
|
1267
|
+
${Em} {
|
|
1268
1268
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
1269
1269
|
}
|
|
1270
|
-
`;var
|
|
1270
|
+
`;var ke=require("react/jsx-runtime"),_m=({buttonHideAnimations:e,buttonLoading:t,onSubmit:o,onBack:r,config:n})=>{let[i,a]=(0,xm.useState)(!1);return(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)(_,{title:"Confirm Password",closeable:!1,backFn:r}),(0,ke.jsx)(Z,{}),(0,ke.jsxs)(Ar,{children:[(0,ke.jsxs)(Ir,{children:[(0,ke.jsx)(Pm.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),(0,ke.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),(0,ke.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),(0,ke.jsx)(Ii,{children:(0,ke.jsxs)(Wi,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[(0,ke.jsx)(bm,{color:"var(--privy-color-error)",checked:i}),(0,ke.jsx)(ke.Fragment,{children:"I understand losing my password means losing my account."})]})})]}),(0,ke.jsxs)(rw,{children:[n.initiatedBy==="user"&&(0,ke.jsx)(uo,{onClick:n.onCancel,disabled:t,children:"Cancel"}),(0,ke.jsx)(kr,{onClick:o,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),(0,ke.jsx)(te,{}),(0,ke.jsx)($,{protectedByPrivy:!0})]})},rw=Sm.default.div`
|
|
1271
1271
|
display: flex;
|
|
1272
1272
|
gap: 10px;
|
|
1273
|
-
`;var
|
|
1273
|
+
`;var Om=f(require("@heroicons/react/24/outline/KeyIcon")),ec=f(require("@heroicons/react/24/solid/CheckCircleIcon")),sr=require("react"),tc=f(require("styled-components"));var Am=f(require("fast-password-entropy")),km=f(require("secure-password-utilities")),Rm=require("secure-password-utilities/wordlists"),nw=95,iw=8,aw=3,sw=.3,lw=/[a-z]/,cw=/[A-Z]/,dw=/[0-9]/,pw="a-zA-Z0-9",Im="!@#$%^&*()\\-_+.",Wm=`${pw}${Im}`,uw=new RegExp(`[${Im}]`),mw=new RegExp(`[${Wm}]`),Mm=new RegExp(`^[${Wm}]{6,}$`),Nm=(e="")=>{let t=e.split("").filter(o=>!mw.test(o)).map(o=>o.replace(" ","SPACE"));return[...new Set(t)]},Cs=()=>km.generatePassphrase(4,Rm.DEFAULT_WORDLIST);function fw(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function hw(e){if(e.length<iw)return 0;let t=0;lw.test(e)&&(t+=1),cw.test(e)&&(t+=1),dw.test(e)&&(t+=1),uw.test(e)&&(t+=1);let o=t/aw;return Math.max(0,Math.min(1,o))}function yw(e=""){let t=hw(e),o=(0,Am.default)(e)/nw;return(t*sw+o)/2}function Lm(e=""){let t=yw(e);return{value:t,label:fw(t)}}var se=require("react/jsx-runtime"),Dm=({buttonHideAnimations:e,buttonLoading:t,password:o="",config:r,onSubmit:n,onClose:i,onPasswordChange:a,onPasswordGenerate:l})=>{let[s,c]=(0,sr.useState)(!1),[m,g]=(0,sr.useState)(!1);(0,sr.useEffect)(()=>{o&&!m&&g(!0)},[o]);let y=(0,sr.useMemo)(()=>m?(o?.length||0)<6?"Password must be at least 6 characters":Mm.test(o||"")?null:`Invalid characters used ( ${Nm(o).join(" ")} )`:null,[o,m]),v=(0,sr.useMemo)(()=>y?{value:0,label:"Weak"}:Lm(o),[o,y]),b=(0,sr.useMemo)(()=>!!(!o?.length||y),[y,o]);return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(_,{onClose:i,title:"Secure your account",closeable:r.initiatedBy==="user"}),(0,se.jsx)(Z,{}),(0,se.jsxs)(Ar,{children:[(0,se.jsxs)(Ir,{children:[(0,se.jsx)(Om.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,se.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),(0,se.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),(0,se.jsxs)(Rr,{children:[(0,se.jsx)(Qr,{value:o,onChange:E=>a(E.target.value),placeholder:"enter or generate a strong password",type:s?"password":"text"}),(0,se.jsxs)(qn,{style:{width:"3.5rem"},children:[s?(0,se.jsx)(jn,{onClick:()=>c(!1)}):(0,se.jsx)(Kn,{onClick:()=>c(!0)}),(0,se.jsx)(gm,{onClick:l})]})]}),(0,se.jsx)(vm,{value:v.value===0?.01:v.value,label:v.label}),(0,se.jsx)(ws,{error:!!y,children:y||`Password Strength: ${m?v.label:"--"}`}),(0,se.jsxs)(vw,{children:[(0,se.jsx)(gw,{children:(0,se.jsxs)(Ii,{children:[(0,se.jsxs)(Wi,{children:[(0,se.jsx)(ec.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),(0,se.jsxs)(Wi,{children:[(0,se.jsx)(ec.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"You will only be asked to enter it when signing on to a new device."]})]})}),(0,se.jsx)(kr,{onClick:n,loading:t,disabled:b,hideAnimations:e,children:"Continue"})]})]}),(0,se.jsx)(te,{}),(0,se.jsx)($,{protectedByPrivy:!0})]})},gw=(0,tc.default)(Ii)`
|
|
1274
1274
|
flex: 1;
|
|
1275
1275
|
padding-top: 1rem;
|
|
1276
|
-
`,
|
|
1276
|
+
`,vw=tc.default.div`
|
|
1277
1277
|
display: flex;
|
|
1278
1278
|
flex-direction: column;
|
|
1279
1279
|
height: 100%;
|
|
1280
|
-
`;var
|
|
1280
|
+
`;var Um=f(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),Fm=f(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),Bm=f(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),Hm=f(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Ni=require("react");var ge=require("react/jsx-runtime"),Gm=({buttonHideAnimations:e,buttonLoading:t,appName:o,password:r,onSubmit:n,onBack:i})=>{let[a,l]=(0,Ni.useState)(!1),s=(0,Ni.useCallback)(()=>{l(!0),r&&navigator.clipboard.writeText(r)},[r]),c=(0,Ni.useCallback)(()=>{let m=document.createElement("a"),g=o.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),y=new Blob([ww(o,r)],{type:"text/plain"}),v=URL.createObjectURL(y);m.href=v,m.target="_blank",m.download=`${g}-privy-wallet-recovery.txt`,document.body.appendChild(m),m.click(),setTimeout(()=>{m.remove(),URL.revokeObjectURL(v)},5e3)},[r]);return(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(_,{backFn:i,title:"Save Password",closeable:!1}),(0,ge.jsx)(Z,{}),(0,ge.jsxs)(Ar,{children:[(0,ge.jsxs)(Ir,{children:[(0,ge.jsx)(Hm.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,ge.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),(0,ge.jsx)("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."})]}),(0,ge.jsx)(Rr,{centered:!0,children:(0,ge.jsx)(ym,{children:r})}),(0,ge.jsxs)("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[(0,ge.jsx)(Xl,{onClick:s,children:a?(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(Fm.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(Bm.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),(0,ge.jsxs)(Xl,{onClick:c,children:[(0,ge.jsx)(Um.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),(0,ge.jsx)(kr,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),(0,ge.jsx)(te,{}),(0,ge.jsx)($,{protectedByPrivy:!0})]})},ww=(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.`;var
|
|
1284
|
+
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;var Vm=f(require("@heroicons/react/24/outline/CheckCircleIcon")),zm=f(require("@heroicons/react/24/outline/XCircleIcon"));var at=require("react/jsx-runtime"),$m=({error:e,onClose:t})=>(0,at.jsxs)(at.Fragment,{children:[(0,at.jsx)(_,{closeable:!1}),(0,at.jsx)(Z,{}),e?(0,at.jsxs)(mo,{children:[(0,at.jsx)(zm.default,{stroke:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,at.jsx)(Ge,{title:"Something went wrong",description:e})]}):(0,at.jsxs)(mo,{children:[(0,at.jsx)(Vm.default,{stroke:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,at.jsx)(Ge,{title:"Success"})]}),(0,at.jsx)(F,{onClick:t,children:"Close"}),(0,at.jsx)(te,{}),(0,at.jsx)($,{protectedByPrivy:!0})]});var qm=require("react"),Cw=(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}},jm=()=>{let[e,t]=(0,qm.useReducer)(Cw,"creating");return{send:t,state:e}};var Jn=require("react/jsx-runtime"),bs=({onSubmit:e,...t})=>{let{send:o,state:r}=jm(),n=(0,Li.useCallback)(async()=>{r==="finalizing"&&await e(),o("next")},[r,o,e]);(0,Li.useEffect)(()=>{let a;return r==="done"&&t.config.initiatedBy==="automatic"&&(a=setTimeout(()=>t.onClose?.(),mt)),()=>{a&&clearTimeout(a)}},[r,t.config.initiatedBy,t.onClose]);let i=(0,Li.useCallback)(()=>{o("back")},[o]);return r==="creating"?(0,Jn.jsx)(Dm,{...t,onSubmit:n}):r==="saving"?(0,Jn.jsx)(Gm,{...t,onSubmit:n,onBack:i}):r==="confirming"?(0,Jn.jsx)(Cm,{...t,onSubmit:n,onBack:i}):r==="finalizing"?(0,Jn.jsx)(_m,{...t,onSubmit:n,onBack:i}):r==="done"?(0,Jn.jsx)($m,{...t,onSubmit:n}):null};var Nt=require("react/jsx-runtime"),Jm=()=>{let{app:e,navigate:t,data:o,onUserCloseViaDialogOrKeybindRef:r}=A(),[n,i]=(0,go.useState)(""),[a,l]=(0,go.useState)(!1),[s,c]=(0,go.useState)(),[m,g]=(0,go.useState)(null),[y,v]=(0,go.useState)(null),b=(0,go.useRef)(!1),{authenticated:E,getAccessToken:S}=V(),{refreshUser:T,closePrivyModal:P,createAnalyticsEvent:O,isNewUserThisSession:I,initializeWalletProxy:L}=W(),{onSuccess:D,onFailure:M,callAuthOnSuccessOnClose:G}=o.createWallet,Y=e?.embeddedWallets.requireUserPasswordOnCreate===!0,ie=!!(!n||b.current)&&!Y,U=new ut(async()=>k());(0,go.useEffect)(()=>{m||L(3e4).then(pe=>g(pe))},[m]),(0,go.useEffect)(()=>{if(!E){t("LANDING"),M(new Error("User must be authenticated before creating a Privy wallet"));return}!Y&&!a&&!b.current&&(l(!0),U.execute().finally(()=>l(!1)))},[Y,E]);let q=()=>{Y&&y&&y?.recoveryMethod!=="user-passcode"?M(new It("User created a wallet but failed to set a password for it")):y?D(y):M(new It("User wallet creation failed")),P({shouldCallAuthOnSuccess:G})};r.current=()=>null;let k=async function(){let pe=await S();if(pe)try{O("embedded_wallet_creation_started");let ee=await L(Cn);if(!ee)throw new Error("walletProxy does not exist.");let eo=1e4,Re=new Promise((Ko,to)=>{setTimeout(()=>{to(new Error("walletProxy.create timed out."))},eo)});if(!await Promise.race([ee.create({accessToken:pe,recoveryPassword:s}),Re]))throw new Error("walletProxy.create did not send a response.");let et=await T();if(!et)throw new Error("Failed to refresh user.");let le=Se(et);if(!le)throw new Error("Updated user is missing embedded wallet.");v(le),O("embedded_wallet_creation_completed",{walletAddress:le.address}),i(""),b.current=!0,Y?t("EMBEDDED_WALLET_CREATED_SCREEN"):I?t("EMBEDDED_WALLET_CREATED_SCREEN"):le&&(D(le),P({shouldCallAuthOnSuccess:G}))}catch(ee){if(b.current)return;O("embedded_wallet_creation_failed",{error:ee.toString()}),i("An error has occurred, please try again."),console.warn(ee)}else i("An error has occured, please login again."),O("embedded_wallet_creation_failed",{error:"Missing access token for user."})},Ee=async()=>{if(!Y)return P({shouldCallAuthOnSuccess:G});l(!0);let pe=250;return U.execute().then(()=>new Promise(ee=>setTimeout(ee,pe))).finally(()=>l(!1))};return!Y&&n?(0,Nt.jsxs)(Nt.Fragment,{children:[(0,Nt.jsx)(_,{closeable:!1}),(0,Nt.jsxs)(mo,{children:[(0,Nt.jsx)(Km.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,Nt.jsx)(Ge,{title:"Something went wrong",description:n})]}),(0,Nt.jsx)(F,{onClick:q,children:"Close"}),(0,Nt.jsx)(bw,{})]}):ie?(0,Nt.jsx)(zn,{}):(0,Nt.jsx)(bs,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:ie||!m,buttonLoading:a,buttonHideAnimations:!y&&a,error:n,password:s||"",onClose:q,onPasswordChange:c,onPasswordGenerate:()=>c(Cs()),onSubmit:Ee})},bw=Ym.default.div`
|
|
1285
1285
|
height: 44px;
|
|
1286
|
-
`;var
|
|
1286
|
+
`;var Zr=require("react");var Zm=require("react/jsx-runtime"),Qm=()=>{let[e,t]=(0,Zr.useState)(null),[o,r]=(0,Zr.useState)(!1),[n,i]=(0,Zr.useState)(null),[a,l]=(0,Zr.useState)(""),{authenticated:s,getAccessToken:c,user:m}=V(),{walletProxy:g,refreshUser:y,closePrivyModal:v,createAnalyticsEvent:b}=W(),{app:E,navigate:S,data:T,onUserCloseViaDialogOrKeybindRef:P}=A(),{onSuccess:O,onFailure:I}=T.createWallet,L=Se(m),D=e?.recoveryMethod==="user-passcode";(0,Zr.useEffect)(()=>{s||(S("LANDING"),I(new na("User must be authenticated before setting a password on a Privy wallet")))},[s]);let M=()=>{if(n){I(n),v({shouldCallAuthOnSuccess:!1});return}if(!D){I(new It("Exited before password was added to wallet")),v({shouldCallAuthOnSuccess:!1});return}O(e),v({shouldCallAuthOnSuccess:!1})};P.current=M;let G=async()=>{let ie=await c();if(ie&&L?.address&&a&&g)try{if(b("embedded_wallet_set_password_started",{walletAddress:L.address}),!(await g.setRecoveryPassword({accessToken:ie,address:L.address,recoveryPassword:a})).address){i(new It("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:L.address,reason:"error setting password"});return}let q=await y(),k=Se(q);if(!k){i(new It("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:L.address,reason:"wallet disconnected"});return}t(k),b("embedded_wallet_set_password_completed",{walletAddress:L.address})}catch(U){console.warn(U),i(U instanceof Error?U:new Error("Error setting password on privy wallet")),b("embedded_wallet_set_password_failed",{walletAddress:L.address,reason:U})}},Y=async()=>{D?(O(e),v({shouldCallAuthOnSuccess:!1})):(r(!0),i(null),await G(),r(!1))};return(0,Zm.jsx)(bs,{appName:E?.name||"privy",config:{initiatedBy:"user",onCancel:M},error:n?"An error has occurred, please try again.":void 0,buttonLoading:o,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(Cs()),onPasswordChange:l,onSubmit:Y,onClose:M})};var Xm=f(require("@heroicons/react/24/outline/UserCircleIcon")),ef=f(require("@heroicons/react/24/solid/LockClosedIcon"));var Ze=require("react/jsx-runtime"),tf=()=>{let{user:e}=V(),{closePrivyModal:t,createAnalyticsEvent:o}=W(),{data:r,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=A(),{onSuccess:l,onFailure:s}=r.setWalletPassword,c=()=>{s(new It("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,(0,Ze.jsxs)(Ze.Fragment,{children:[(0,Ze.jsx)(_,{onClose:c}),(0,Ze.jsx)(Z,{}),(0,Ze.jsxs)(mo,{children:[(0,Ze.jsxs)(hu,{children:[(0,Ze.jsx)(Xm.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,Ze.jsx)(yu,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:(0,Ze.jsx)(ef.default,{width:"12px",height:"12px",fill:"white"})})]}),(0,Ze.jsxs)(Ge,{title:"Secure Your Account",children:["Please set a password to secure your account.",(0,Ze.jsx)("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."})]})]}),(0,Ze.jsx)(F,{onClick:()=>{let g=Se(e);o("embedded_wallet_set_password_started",{walletAddress:g?.address}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),(0,Ze.jsx)(te,{}),(0,Ze.jsx)($,{protectedByPrivy:!0})]})};var of=f(require("@heroicons/react/24/outline/ShieldCheckIcon")),Xr=require("react"),en=f(require("styled-components"));var Ce=require("react/jsx-runtime"),rf=()=>{let[e,t]=(0,Xr.useState)(!0),{authenticated:o,getAccessToken:r}=V(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=W(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=A(),[m,g]=(0,Xr.useState)(void 0),[y,v]=(0,Xr.useState)(""),[b,E]=(0,Xr.useState)(!1),{privyWallet:S,onCompleteNavigateTo:T,onSuccess:P,onFailure:O}=s.recoverWallet,I=(M="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),O(typeof M=="string"?new It(M):M)};c.current=I,(0,Xr.useEffect)(()=>{if(!o||!S)return I("User must be authenticated and have a Privy wallet before it can be recovered")},[o]);let L=M=>{M&&g(M)};return(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)(_,{onClose:I}),(0,Ce.jsx)(Z,{}),(0,Ce.jsxs)(Tw,{children:[(0,Ce.jsxs)(Ew,{children:[(0,Ce.jsx)(of.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,Ce.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),(0,Ce.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),(0,Ce.jsxs)("div",{children:[(0,Ce.jsxs)(Rr,{children:[(0,Ce.jsx)(Qr,{type:e?"password":"text",onChange:M=>L(M.target.value),disabled:b}),(0,Ce.jsx)(qn,{style:{right:"0.75rem"},children:e?(0,Ce.jsx)(jn,{onClick:()=>t(!1)}):(0,Ce.jsx)(Kn,{onClick:()=>t(!0)})})]}),!!y&&(0,Ce.jsx)(Pw,{children:y})]}),(0,Ce.jsxs)("div",{children:[(0,Ce.jsxs)(fu,{children:[(0,Ce.jsx)("h4",{children:"Why is this necessary?"}),(0,Ce.jsx)("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),(0,Ce.jsx)(xw,{loading:b||!n,disabled:!m,onClick:async()=>{E(!0);let M=await r();if(M&&S&&m!==null)try{a("embedded_wallet_recovery_started",{walletAddress:S.address}),await n?.recover({address:S.address,accessToken:M,recoveryPin:m}),v(""),T?l(T):i({shouldCallAuthOnSuccess:!1}),P?.(S),a("embedded_wallet_recovery_completed",{walletAddress:S.address})}catch(G){Zu(G)?v("Invalid recovery password, please try again."):v("An error has occurred, please try again.")}finally{E(!1)}else return I("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!S&&b,children:"Recover your account"})]})]}),(0,Ce.jsx)(te,{}),(0,Ce.jsx)($,{protectedByPrivy:!0})]})},Ew=en.default.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
|
+
`,Tw=en.default.div`
|
|
1309
1309
|
display: flex;
|
|
1310
1310
|
flex-direction: column;
|
|
1311
1311
|
justify-content: space-between;
|
|
1312
|
-
`,
|
|
1312
|
+
`,Pw=en.default.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
|
+
`,xw=(0,en.default)(F)`
|
|
1320
|
+
${e=>e.hideAnimations&&en.css`
|
|
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
|
-
`;var
|
|
1327
|
+
`;var nf=f(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),af=f(require("@heroicons/react/24/outline/PhoneIcon")),Es=f(require("styled-components"));var tn=require("react/jsx-runtime"),on=({style:e,...t})=>(0,tn.jsxs)("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:[(0,tn.jsx)("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),(0,tn.jsx)("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"}),(0,tn.jsx)("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"}),(0,tn.jsx)("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"})]});var Be=require("react/jsx-runtime"),Sw=e=>{let t=(0,Be.jsx)(nf.default,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof C)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 Ve&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:(0,Be.jsx)(af.default,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof tt)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:(0,Be.jsx)(us,{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:(0,Be.jsx)("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:(0,Be.jsx)("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:(0,Be.jsx)(on,{style:{height:38,width:38}})};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Po&&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}}},sf=()=>{let{navigate:e,navigateBack:t,data:o,lastScreen:r,currentScreen:n}=A(),{reset:i}=Ae(),a=o?.errorModalData,l=Sw(a?.error||new Error),s=c=>{if(c instanceof tt)switch(c.privyErrorCode){case"invalid_captcha":return()=>i()}return()=>{}};return(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)(_,{backFn:!r||n===r?void 0:t}),(0,Be.jsxs)(_w,{children:[(0,Be.jsx)(kw,{children:(0,Be.jsxs)("div",{children:[(0,Be.jsx)(ps,{color:"var(--privy-color-error)"}),l.icon]})}),(0,Be.jsxs)(Aw,{children:[(0,Be.jsx)("h3",{children:l.title}),(0,Be.jsx)("p",{children:l.detail})]}),(0,Be.jsx)(F,{color:"var(--privy-color-error)",onClick:()=>{s(a?.error||new Error)(),e(r||"LANDING",!1)},children:l.ctaText})]})]})},_w=Es.default.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
|
+
`,Aw=Es.default.div`
|
|
1336
1336
|
display: flex;
|
|
1337
1337
|
flex-direction: column;
|
|
1338
1338
|
gap: 8px;
|
|
1339
|
-
`,
|
|
1339
|
+
`,kw=Es.default.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
|
-
`;var
|
|
1362
|
+
`;var Mr=require("react"),ic=require("react-device-detect"),ac=f(require("styled-components"));var cf=require("react"),df=f(require("styled-components"));var oc=require("react/jsx-runtime"),Ts=({style:e,color:t,...o})=>(0,oc.jsx)("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:(0,oc.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});var Ps=require("react/jsx-runtime"),lf=({color:e,...t})=>(0,Ps.jsx)("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:(0,Ps.jsx)("g",{children:(0,Ps.jsx)("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"})})});var Oi=require("react/jsx-runtime"),Qn=e=>{let[t,o]=(0,cf.useState)(!1);return(0,Oi.jsxs)(Rw,{color:e.color,onClick:()=>{o(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>o(!1),1500)},justCopied:t,children:[t?(0,Oi.jsx)(Ts,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):(0,Oi.jsx)(lf,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},Rw=df.default.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
|
-
`;var
|
|
1400
|
+
`;var pf=require("react"),uf=f(require("styled-components")),ff=require("react/jsx-runtime"),mf=e=>{let[t,o]=(0,pf.useState)(!1);return(0,ff.jsx)(Iw,{color:e.color,onClick:()=>{o(!0),window.open(e.url,"_blank"),setTimeout(()=>o(!1),1500)},justOpened:t,children:e.text})},Iw=uf.default.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
|
-
`;var
|
|
1438
|
+
`;var gf=f(require("qrcode")),vf=f(require("react")),wf=f(require("styled-components"));var rc=require("react/jsx-runtime"),hf=()=>(0,rc.jsx)("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:(0,rc.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var Pe=require("react/jsx-runtime"),Lt=7,nc=(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},Ww=e=>{let t=gf.default.create(e,{errorCorrectionLevel:"high"}).modules,o=Vd(Array.from(t.data),t.size);return o=nc(o,0,0,Lt,Lt),o=nc(o,o.length-Lt,0,Lt,Lt),o=nc(o,0,o.length-Lt,Lt,Lt),o},Mw=({x:e,y:t,cellSize:o,bgColor:r,fgColor:n})=>(0,Pe.jsx)(Pe.Fragment,{children:[0,1,2].map(i=>(0,Pe.jsx)("circle",{r:o*(Lt-i*2)/2,cx:e+o*Lt/2,cy:t+o*Lt/2,fill:i%2!==0?r:n},`finder-${e}-${t}-${i}`))}),Nw=({cellSize:e,matrixSize:t,bgColor:o,fgColor:r})=>{let n=[[0,0],[(t-Lt)*e,0],[0,(t-Lt)*e]];return(0,Pe.jsx)(Pe.Fragment,{children:n.map(([i,a])=>(0,Pe.jsx)(Mw,{x:i,y:a,cellSize:e,bgColor:o,fgColor:r},`finder-${i}-${a}`))})},Lw=({matrix:e,cellSize:t,color:o})=>(0,Pe.jsx)(Pe.Fragment,{children:e.map((r,n)=>r.map((i,a)=>i?(0,Pe.jsx)("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:o},`circle-${n}-${a}`):(0,Pe.jsx)(vf.default.Fragment,{},`circle-${n}-${a}`)))}),yf=(e,t)=>e-e%t,Ow=({outputSize:e,cellSize:t,element:o,size:r,padding:n,bgColor:i})=>{if(!o)return(0,Pe.jsx)(Pe.Fragment,{});let a=r||40,l=n||4,s=o,c=e/2-a/2-l;return(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsx)("rect",{x:yf(c,t),y:yf(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),(0,Pe.jsx)(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},Dw=e=>{let t=e.outputSize,o=Ww(e.url),r=t/o.length;return(0,Pe.jsxs)("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,Pe.jsx)(Lw,{matrix:o,cellSize:r,color:e.fgColor}),(0,Pe.jsx)(Nw,{cellSize:r,matrixSize:o.length,fgColor:e.fgColor,bgColor:e.bgColor}),(0,Pe.jsx)(Ow,{outputSize:e.outputSize,cellSize:r,element:e.logo?.element,bgColor:e.bgColor})]})},Uw=wf.default.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
|
+
`,xs=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return(0,Pe.jsx)(Uw,{size:r,bgColor:t,fgColor:o,children:(0,Pe.jsx)(Dw,{url:e.url,logo:{element:e.squareLogoElement??hf},outputSize:r,bgColor:t,fgColor:o})})};var ne=require("react/jsx-runtime"),Cf="#8a63d2",Ef=1e3,Fw=Ef*2,Bw=Ef*120,Tf=()=>{let{ready:e,authenticated:t,user:o}=V(),{lastScreen:r,navigate:n,navigateBack:i,setModalData:a,app:l}=A(),{getAuthFlow:s,loginWithFarcaster:c,closePrivyModal:m}=W(),[g,y]=(0,Mr.useState)(!1),[v,b]=(0,Mr.useState)(!1),E=(0,Mr.useRef)([]),S=l?.render.inDialog?mt:0,T=s(),P=T?.meta.connectUri;return(0,Mr.useEffect)(()=>{let O=Date.now(),I=setInterval(async()=>{let L=await T.pollForReady.execute(),D=Date.now()-O;if(L){clearInterval(I),y(!0);try{await c(),b(!0)}catch(M){a({errorModalData:{error:M,previousScreen:t?"AWAITING_FARCASTER_CONNECTION":"LANDING"}}),n("ERROR_SCREEN")}}else D>Bw&&(clearInterval(I),a({errorModalData:{error:new C("Timed out waiting for response from Farcaster app.",void 0,"client_request_timeout"),previousScreen:t?"AWAITING_FARCASTER_CONNECTION":"LANDING"}}),n("ERROR_SCREEN"))},Fw);return()=>{clearInterval(I),E.current.forEach(L=>clearTimeout(L))}},[]),(0,Mr.useEffect)(()=>{if(e&&t&&v&&o){if(l?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let I=setTimeout(()=>{n("AFFIRMATIVE_CONSENT_SCREEN")},S);return()=>clearTimeout(I)}v&&(Gt(o,l?.embeddedWallets.createOnLogin)?E.current.push(setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:I=>console.error(I),callAuthOnSuccessOnClose:!0}}),n("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},S)):E.current.push(setTimeout(m,S)))}},[v,e,t,o]),ic.isMobile||g?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(_,{backFn:r?i:void 0,onClose:m},"header"),(0,ne.jsx)(Z,{}),(0,ne.jsxs)(bf,{children:[(0,ne.jsx)(Hw,{children:(0,ne.jsxs)("div",{children:[(0,ne.jsx)(Pr,{success:v,fail:!1}),(0,ne.jsx)(on,{style:{width:"38px",height:"38px"}})]})}),(0,ne.jsxs)(Yt,{children:[(0,ne.jsx)(Me,{children:"Signing in with Farcaster"}),(0,ne.jsx)(_e,{children:"This should only take a moment."}),(0,ne.jsx)(Kt,{children:P&&ic.isMobile&&(0,ne.jsx)(mf,{text:"Take me to Warpcast",url:P,color:Cf})})]})]}),(0,ne.jsx)(Q,{})]}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(_,{backFn:r?i:void 0,onClose:m},"header"),(0,ne.jsx)(Z,{}),(0,ne.jsx)(bf,{children:(0,ne.jsxs)("div",{children:[(0,ne.jsx)(Me,{children:"Sign in with Farcaster"}),(0,ne.jsx)(_e,{children:"Scan with your phone's camera to continue."}),(0,ne.jsx)(fs,{children:P?(0,ne.jsx)(xs,{url:P,size:275,squareLogoElement:on}):(0,ne.jsx)(qt,{})}),(0,ne.jsxs)(Kt,{children:[(0,ne.jsx)(_e,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),P&&(0,ne.jsx)(Qn,{text:P,itemName:"link",color:Cf})]})]})}),(0,ne.jsx)(Q,{})]})},bf=ac.default.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
|
+
`,Hw=ac.default.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
|
-
`;var
|
|
1484
|
+
`;var Pf=f(require("@heroicons/react/24/outline/ClockIcon")),xf=f(require("@heroicons/react/24/outline/EyeSlashIcon")),Sf=f(require("@heroicons/react/24/outline/LinkIcon")),vo=f(require("styled-components"));var Zn=require("react/jsx-runtime"),Ss=({size:e=61,...t})=>(0,Zn.jsx)("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,Zn.jsxs)("g",{id:"moonpay_symbol_wht 2",children:[(0,Zn.jsx)("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),(0,Zn.jsx)("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"})]})});var ve=require("react/jsx-runtime"),sc=({title:e,desc:t,icon:o})=>(0,ve.jsxs)(jw,{children:[(0,ve.jsx)(Yw,{children:o}),(0,ve.jsxs)(Kw,{children:[(0,ve.jsx)($w,{children:e}),(0,ve.jsx)(qw,{children:t})]})]}),_f=({app:e,signedUrl:t,onContinue:o})=>(0,ve.jsxs)(ve.Fragment,{children:[(0,ve.jsxs)(Vw,{children:[(0,ve.jsx)(Ss,{size:"3.75rem"}),(0,ve.jsxs)(zw,{children:[e?.name," uses ",(0,ve.jsx)("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),(0,ve.jsxs)(Jw,{children:[(0,ve.jsx)(sc,{icon:(0,ve.jsx)(Sf.default,{width:"1rem"}),title:"Purchase assets to fund your account",desc:(0,ve.jsxs)(ve.Fragment,{children:["Connect a payment method (",(0,ve.jsx)("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),(0,ve.jsx)(sc,{icon:(0,ve.jsx)(Pf.default,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),(0,ve.jsx)(sc,{icon:(0,ve.jsx)(xf.default,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),(0,ve.jsx)(Qw,{className:"mobile-only"})]}),(0,ve.jsx)(Gw,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),(0,ve.jsx)(ts,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:o,children:"Continue to Moonpay"})]}),Gw=vo.default.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
|
+
`,Vw=vo.default.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
|
+
`,zw=vo.default.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
|
+
`,$w=vo.default.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
|
+
`,qw=vo.default.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
|
+
`,jw=vo.default.div`
|
|
1520
1520
|
display: flex;
|
|
1521
1521
|
align-items: flex-start;
|
|
1522
1522
|
gap: 0.5rem;
|
|
1523
1523
|
align-self: stretch;
|
|
1524
|
-
`,
|
|
1524
|
+
`,Kw=vo.default.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
|
+
`,Yw=vo.default.div`
|
|
1532
1532
|
padding-top: 2px;
|
|
1533
|
-
`,
|
|
1533
|
+
`,Jw=vo.default.div`
|
|
1534
1534
|
display: flex;
|
|
1535
1535
|
flex-direction: column;
|
|
1536
1536
|
gap: 1.25rem;
|
|
1537
1537
|
margin: 0 0.5rem;
|
|
1538
|
-
|
|
1538
|
+
`,Qw=vo.default.div`
|
|
1539
1539
|
margin: 30px 0;
|
|
1540
|
-
`;var
|
|
1540
|
+
`;var kf=require("ofetch"),Xn=require("react");var _s="moonpay",Af="sdk_fiat_on_ramp_completed_with_status";async function Rf(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 Zw(e,t){let o=t?Wd:Id,r=t?Nd:Md;return(0,kf.ofetch)(`${o}/transactions/ext/${e}`,{query:{apiKey:r}})}function If(e,t=!1){let[o,r]=(0,Xn.useState)(null),{createAnalyticsEvent:n}=W(),i=(0,Xn.useRef)(0);return(0,Xn.useEffect)(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await Zw(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;r(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n(Af,{status:s,provider:_s,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(Af,{status:"serviceFailure",provider:_s}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),o}var Nr=require("react/jsx-runtime"),Wf=()=>{let{app:e,data:t,navigate:o}=A(),{createAnalyticsEvent:r}=W(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:(0,Nr.jsxs)(Nr.Fragment,{children:[(0,Nr.jsx)(_,{title:"Fund account"},"header"),(0,Nr.jsx)(_f,{app:e,signedUrl:n,onContinue:()=>{r("sdk_fiat_on_ramp_started",{provider:_s}),o("FIAT_ON_RAMP_STATUS_SCREEN")}}),(0,Nr.jsx)($,{protectedByPrivy:!0})]})};var Mf=f(require("@heroicons/react/24/solid/ArrowsRightLeftIcon")),Nf=f(require("@heroicons/react/24/solid/CheckCircleIcon")),Lf=f(require("@heroicons/react/24/solid/XCircleIcon")),Of=require("react"),lc=f(require("styled-components"));var ue=require("react/jsx-runtime"),Df=()=>{let{app:e,data:t}=A(),{closePrivyModal:o}=W(),{externalTransactionId:r}=t?.fiatOnRampStatus,n=If(r||null,e.fiatOnRamp.useSandbox);return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(_,{title:"Fund account"},"header"),(0,ue.jsx)(e1,{status:n,onClickCta:o}),(0,ue.jsx)($,{protectedByPrivy:!0})]})},Xw=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:(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)("p",{children:["It looks like there was an issue with your payment. Please contact"," ",(0,ue.jsx)("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),(0,ue.jsx)("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:""}}},e1=({status:e,onClickCta:t})=>{let{title:o,body:r,cta:n}=(0,Of.useMemo)(()=>Xw(e),[e]);return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)(i1,{children:[(0,ue.jsx)(r1,{status:e}),(0,ue.jsxs)(Yt,{children:[(0,ue.jsx)("h3",{children:o}),(0,ue.jsx)(n1,{children:r})]})]}),n&&(0,ue.jsx)(F,{onClick:t,children:n})]})},t1=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)",o1=e=>{switch(e){case"serviceFailure":case"failed":return Lf.default;case"completed":return Nf.default;case"waitingAuthorization":return()=>(0,ue.jsx)(Mf.default,{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}},r1=({status:e})=>{if(!e||e==="pending"){let r="var(--privy-color-foreground-4)";return(0,ue.jsxs)("div",{style:{position:"relative"},children:[(0,ue.jsx)(qt,{color:r,style:{position:"absolute"}}),(0,ue.jsx)(Ml,{color:r}),(0,ue.jsx)(Ss,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=o1(e),o=t1(e);return(0,ue.jsx)("div",{style:{borderColor:o,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&(0,ue.jsx)(t,{width:"4rem",height:"4rem",color:o})})},n1=lc.default.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
|
+
`,i1=lc.default.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
|
-
`;var
|
|
1555
|
+
`;var Uf=f(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),Ff=f(require("styled-components"));var Ot=require("react/jsx-runtime"),Bf=()=>{let{closePrivyModal:e}=W();return(0,Ot.jsxs)(Ot.Fragment,{children:[(0,Ot.jsx)(_,{},"header"),(0,Ot.jsx)(a1,{children:(0,Ot.jsx)(Uf.default,{style:{width:32,height:32}})}),(0,Ot.jsx)(Mo,{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"}}),(0,Ot.jsx)(Wo,{children:(0,Ot.jsx)(F,{onClick:()=>e(),children:"Close"})}),(0,Ot.jsx)(te,{}),(0,Ot.jsx)($,{protectedByPrivy:!0})]})},a1=Ff.default.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
|
-
`;var
|
|
1565
|
+
`;var Vf=f(require("react-device-detect")),zf=f(require("styled-components"));var As=f(require("styled-components"));var cc=require("react/jsx-runtime"),Hf=({style:e,...t})=>(0,cc.jsx)("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:(0,cc.jsx)("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)"})});var Rs=require("react/jsx-runtime"),Gf=As.default.div`
|
|
1566
1566
|
display: flex;
|
|
1567
1567
|
flex-direction: column;
|
|
1568
1568
|
justify-content: flex-start;
|
|
1569
1569
|
gap: 4px;
|
|
1570
|
-
`,
|
|
1570
|
+
`,dc=As.default.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
|
+
`,ks=({children:e})=>(0,Rs.jsxs)(s1,{children:[(0,Rs.jsx)(Hf,{style:{width:"16px",height:"16px"}}),e]}),s1=As.default.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
|
-
`;var
|
|
1594
|
+
`;var be=require("react/jsx-runtime"),l1=()=>{let{navigate:e}=A(),t="https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return Vf.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/phantom-app/"),(0,be.jsxs)(c1,{children:[(0,be.jsx)(ki,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),(0,be.jsx)(Kt,{children:(0,be.jsx)(_o,{style:{width:"152px",height:"152px"}})}),(0,be.jsxs)(Gf,{children:[(0,be.jsx)(ks,{children:(0,be.jsxs)("div",{children:[(0,be.jsx)("span",{children:"Install the "}),(0,be.jsx)("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),(0,be.jsx)(dc,{}),(0,be.jsx)(ks,{children:"Set up your first wallet"}),(0,be.jsx)(dc,{}),(0,be.jsx)(ks,{children:"Store your recovery phrase in a safe place!"})]}),(0,be.jsx)(os,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},$f=()=>{let{navigateBack:e}=A();return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(_,{backFn:e},"header"),(0,be.jsx)(Z,{}),(0,be.jsx)(l1,{}),(0,be.jsx)(te,{}),(0,be.jsxs)(Q,{children:[(0,be.jsx)("span",{children:"Still not sure? "}),(0,be.jsx)("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},c1=(0,zf.default)(Kt)`
|
|
1595
1595
|
gap: 30px;
|
|
1596
1596
|
|
|
1597
1597
|
> :first-child > svg {
|
|
1598
1598
|
margin-top: 20px;
|
|
1599
1599
|
}
|
|
1600
|
-
`;var
|
|
1600
|
+
`;var uh=f(require("@heroicons/react/24/outline/EnvelopeIcon")),mh=f(require("@heroicons/react/24/outline/PhoneIcon")),fh=f(require("@heroicons/react/24/outline/UserCircleIcon")),Gi=require("react"),hh=require("react-device-detect"),yh=f(require("styled-components"));var lr=require("react/jsx-runtime"),qf=({...e})=>(0,lr.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,lr.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,lr.jsx)("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"}),(0,lr.jsx)("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"})]}),(0,lr.jsx)("defs",{children:(0,lr.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,lr.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var Kf=f(require("@heroicons/react/24/outline/EnvelopeIcon")),Yf=require("react");var jf=f(require("@heroicons/react/24/outline/EnvelopeIcon")),Di=require("react"),pc=f(require("styled-components"));var wo=require("react/jsx-runtime"),Is=(0,Di.forwardRef)((e,t)=>{let[o,r]=(0,Di.useState)(""),[n,i]=(0,Di.useState)(!1),{authenticated:a}=V(),{initLoginWithEmail:l}=W(),{navigate:s,setModalData:c,currentScreen:m}=A(),{enabled:g,token:y}=Ae(),v=Gd(o),b=n,E=n||!v,S=P=>{i(!0),l(o,P).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(O=>{c({errorModalData:{error:O,previousScreen:m||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},T=()=>{g&&!y&&!a?(c({captchaModalData:{callback:P=>l(o,P),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):S(y)};return(0,wo.jsxs)(wo.Fragment,{children:[(0,wo.jsx)(d1,{children:(0,wo.jsxs)(p1,{children:[(0,wo.jsx)(jf.default,{}),(0,wo.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:P=>r(P.target.value),onKeyUp:P=>{P.key==="Enter"&&T()},value:o,autoComplete:"email"}),e.stacked?null:(0,wo.jsx)(rs,{isSubmitting:b,onClick:T,disabled:E,children:"Submit"})]})}),e.stacked?(0,wo.jsx)(F,{loadingText:null,loading:b,disabled:E,onClick:T,children:"Submit"}):null]})}),d1=pc.default.div`
|
|
1601
1601
|
width: 100%;
|
|
1602
|
-
`,
|
|
1602
|
+
`,p1=pc.default.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
|
-
`;var
|
|
1660
|
+
`;var Do=require("react/jsx-runtime"),Jf=({isEditable:e,setIsEditable:t})=>{let o=(0,Yf.useRef)(null);return(0,Do.jsxs)(Do.Fragment,{children:[(0,Do.jsx)(or,{if:!e,children:(0,Do.jsx)(Is,{ref:o})}),(0,Do.jsx)(or,{if:e,children:(0,Do.jsxs)(We,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[(0,Do.jsx)(Kf.default,{})," Continue with Email"]})})]})};var Qf=require("react");var ei=require("react/jsx-runtime"),Zf=()=>{let[e,t]=(0,Qf.useState)(!1),{currentScreen:o,navigate:r,setModalData:n}=A(),{enabled:i,token:a}=Ae(),{initLoginWithFarcaster:l}=W();return(0,ei.jsxs)(We,{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:[(0,ei.jsx)(on,{})," Farcaster",e&&(0,ei.jsx)("span",{children:(0,ei.jsx)(qr,{})})]})};var nh=f(require("@heroicons/react/24/outline/PhoneIcon")),ih=require("react");var ti=require("react"),uc=f(require("styled-components"));var Xf=f(require("libphonenumber-js/examples.mobile.json")),Dt=require("libphonenumber-js/min"),Ms=require("react/jsx-runtime");var Ui=(e,t)=>(0,Dt.isPossiblePhoneNumber)(String(e),t),Ws=(e,t)=>`+${(0,Dt.getCountryCallingCode)(t)} ${e}`,eh=e=>`*${e.replaceAll("-","").slice(-4)}`,th=e=>new Dt.AsYouType(e),u1=(0,Dt.getCountries)().map(e=>({code:e,callCode:(0,Dt.getCountryCallingCode)(e)})),oh=e=>(0,Dt.getExampleNumber)(e,Xf.default)?.formatNational(),rh=({value:e,onChange:t})=>(0,Ms.jsx)("select",{value:e,onChange:t,children:u1.map(o=>(0,Ms.jsxs)("option",{value:o.code,children:[o.code," +",o.callCode]},o.code))});var Co=require("react/jsx-runtime"),oi=(0,ti.forwardRef)((e,t)=>{let{app:o}=A(),[r,n]=(0,ti.useState)(""),[i,a]=(0,ti.useState)(o?.intl.defaultCountry??"US"),l=Ui(r,i),s=th(i),c=oh(i),m=(0,Dt.getCountryCallingCode)(i),g=!l,[y,v]=(0,ti.useState)(!1),b=m.length,E=P=>{let O=P.target.value;a(O),n(""),e.onChange&&e.onChange({rawPhoneNumber:r,qualifiedPhoneNumber:Ws(r,O),countryCode:O,isValid:Ui(r,i)})},S=P=>{try{let O=P.replace(/\D/g,""),I=r.replace(/\D/g,""),L=O===I?P:s.input(P);n(L),e.onChange&&e.onChange({rawPhoneNumber:L,qualifiedPhoneNumber:Ws(P,i),countryCode:i,isValid:Ui(P,i)})}catch(O){console.error("Error processing phone number:",O)}},T=()=>{v(!0);let P=Ws(r,i);e.onSubmit({rawPhoneNumber:r,qualifiedPhoneNumber:P,countryCode:i,isValid:Ui(r,i)}).finally(()=>v(!1))};return(0,Co.jsxs)(Co.Fragment,{children:[(0,Co.jsx)(m1,{children:(0,Co.jsxs)(f1,{callingCodeLength:b,children:[(0,Co.jsx)(rh,{value:i,onChange:E}),(0,Co.jsx)("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:P=>{S(P.target.value)},onKeyUp:P=>{P.key==="Enter"&&T()},value:r,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?(0,Co.jsx)(rs,{isSubmitting:y,onClick:T,disabled:g,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?(0,Co.jsx)(F,{loading:y,loadingText:null,onClick:T,disabled:g,children:"Submit"}):null]})}),m1=uc.default.div`
|
|
1661
1661
|
width: 100%;
|
|
1662
|
-
`,
|
|
1662
|
+
`,f1=uc.default.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
|
-
`;var Do=require("react/jsx-runtime"),ih=({isEditable:e,setIsEditable:t})=>{let o=(0,nh.useRef)(null),{authenticated:r}=G(),{navigate:n,setModalData:i,currentScreen:a}=A(),{initLoginWithSms:l}=I(),{enabled:s,token:c}=_e();async function m({qualifiedPhoneNumber:g}){if(s&&!c&&!r)i({captchaModalData:{callback:y=>l(g,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(g,c),n("AWAITING_PASSWORDLESS_CODE")}catch(y){i({errorModalData:{error:y,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return(0,Do.jsxs)(Do.Fragment,{children:[(0,Do.jsx)(er,{if:!e,children:(0,Do.jsx)(ti,{ref:o,onSubmit:m})}),(0,Do.jsx)(er,{if:e,children:(0,Do.jsxs)(We,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[(0,Do.jsx)(rh.default,{})," Continue with SMS"]})})]})};var Ui=require("react/jsx-runtime"),Ms=({style:e,...t})=>(0,Ui.jsxs)("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:[(0,Ui.jsx)("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"}),(0,Ui.jsx)("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"})]});var Nr=require("react/jsx-runtime"),Ns=({style:e,...t})=>(0,Nr.jsxs)("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:[(0,Nr.jsx)("g",{clipPath:"url(#clip0)",children:(0,Nr.jsx)("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"})}),(0,Nr.jsx)("defs",{children:(0,Nr.jsx)("clipPath",{id:"clip0",children:(0,Nr.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var uc=require("react/jsx-runtime"),Ls=({style:e,...t})=>(0,uc.jsx)("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:(0,uc.jsx)("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"})});var on=require("react/jsx-runtime"),Os=({style:e,...t})=>(0,on.jsxs)("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:[(0,on.jsx)("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"}),(0,on.jsx)("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"}),(0,on.jsx)("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"}),(0,on.jsx)("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"})]});var Fi=require("react/jsx-runtime");function Ds({style:e,...t}){return(0,Fi.jsx)("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:(0,Fi.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,Fi.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,Fi.jsx)("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"})})})})}var oi=require("react/jsx-runtime");function Us(e){return(0,oi.jsxs)("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:[(0,oi.jsx)("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"}),(0,oi.jsx)("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"}),(0,oi.jsx)("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"})]})}var mc=require("react/jsx-runtime"),Fs=({style:e,...t})=>(0,mc.jsx)("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:(0,mc.jsx)("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"})});var Uo=require("react/jsx-runtime"),c1={apple:{logo:(0,Uo.jsx)(Ms,{}),displayName:"Apple"},discord:{logo:(0,Uo.jsx)(Ns,{}),displayName:"Discord"},github:{logo:(0,Uo.jsx)(Ls,{}),displayName:"GitHub"},google:{logo:(0,Uo.jsx)(Os,{}),displayName:"Google"},linkedin:{logo:(0,Uo.jsx)(Ds,{}),displayName:"LinkedIn"},twitter:{logo:(0,Uo.jsx)(Fs,{}),displayName:"Twitter"},tiktok:{logo:(0,Uo.jsx)(Us,{}),displayName:"TikTok"}},Lr=({provider:e})=>{let{enabled:t,token:o}=_e(),{navigate:r,setModalData:n}=A(),{initLoginWithOAuth:i}=I(),{displayName:a,logo:l}=c1[e];return(0,Uo.jsxs)(We,{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]})};var ah=f(require("@heroicons/react/24/outline/ChevronRightIcon")),sh=f(require("@heroicons/react/24/outline/WalletIcon"));var ri=require("react/jsx-runtime"),lh=({onClick:e,text:t})=>(0,ri.jsxs)(We,{onClick:e,children:[(0,ri.jsx)(sh.default,{}),(0,ri.jsx)(is,{children:t}),(0,ri.jsx)(ah.default,{})]});var ch=f(require("@heroicons/react/24/outline/ChevronRightIcon"));var Bi=require("react/jsx-runtime"),dh=({onClick:e,text:t,icon:o})=>(0,Bi.jsxs)(We,{onClick:e,children:[o,(0,Bi.jsx)(is,{children:t}),(0,Bi.jsx)(ch.default,{})]});var Z=require("react/jsx-runtime"),yh=()=>{let{closePrivyModal:e,connectors:t}=I(),{app:o,onUserCloseViaDialogOrKeybindRef:r}=A(),{email:n,sms:i,google:a,twitter:l,discord:s,github:c,tiktok:m,linkedin:g,apple:y,wallet:v,farcaster:b}=o?.loginMethods??{},E=o?.appearance.loginGroupPriority||"web2-first",S=o?.appearance.hideDirectWeb2Inputs,[T,P]=(0,Hi.useState)("default"),[L,R]=(0,Hi.useState)(n?"email":"sms");(0,Hi.useEffect)(()=>{R(n?"email":"sms")},[n]);let N=()=>{e({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{P("default")},150)};r.current=N;let O=[n&&(0,Z.jsx)(Yf,{isEditable:L==="email",setIsEditable:()=>{R("email")}}),i&&(0,Z.jsx)(ih,{isEditable:L==="sms",setIsEditable:()=>{R("sms")}})].filter(Boolean),W=[a&&(0,Z.jsx)(Lr,{provider:"google"}),l&&(!fh.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)&&(0,Z.jsx)(Lr,{provider:"twitter"}),s&&(0,Z.jsx)(Lr,{provider:"discord"}),c&&(0,Z.jsx)(Lr,{provider:"github"}),m&&(0,Z.jsx)(Lr,{provider:"tiktok"}),g&&(0,Z.jsx)(Lr,{provider:"linkedin"}),y&&(0,Z.jsx)(Lr,{provider:"apple"}),b&&(0,Z.jsx)(Qf,{})].filter(Boolean),H=zl(o?.appearance.walletList??[],t,!1),K=T==="default"?void 0:()=>{P("default")},ne=p1({priority:E,email:n,sms:i,social:W}),D=u1({priority:E,email:n,sms:i,social:W}),$=m1({priority:E,email:n,sms:i,social:W}),k=(0,Z.jsx)(lh,{text:$,onClick:()=>P("web3-overflow")}),be=(0,Z.jsx)(dh,{text:ne,icon:D,onClick:()=>P("web2-overflow")}),pe=S?0:1;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_,{title:"Log in or sign up",onClose:N,backFn:K}),T==="default"&&(0,Z.jsx)(d1,{}),(0,Z.jsx)(ru,{style:{overflow:"hidden",padding:2},children:(0,Z.jsxs)(Ro,{children:[T==="default"&&E==="web2-first"&&(0,Z.jsxs)(Z.Fragment,{children:[...O,...W.length+O.length>4?W.slice(0,3-O.length):W,O.length+W.length>4&&be,v&&k]}),T==="default"&&E==="web3-first"&&(0,Z.jsxs)(Z.Fragment,{children:[v&&(0,Z.jsxs)(Z.Fragment,{children:[...H.length>4?H.slice(0,3):H,H.length>4&&k]}),O.length+W.length>pe&&be,O.length+W.length===pe&&O.length?O[0]:null,O.length+W.length===pe&&W.length?W[0]:null]}),T==="web2-overflow"&&(0,Z.jsxs)(Z.Fragment,{children:[...E==="web3-first"?O:[],...W]}),...T==="web3-overflow"?H:[]]})}),o&&(0,Z.jsx)(rs,{app:o}),(0,Z.jsx)(z,{protectedByPrivy:!0})]})},d1=(0,hh.default)(hs)`
|
|
1748
|
+
`;var Uo=require("react/jsx-runtime"),ah=({isEditable:e,setIsEditable:t})=>{let o=(0,ih.useRef)(null),{authenticated:r}=V(),{navigate:n,setModalData:i,currentScreen:a}=A(),{initLoginWithSms:l}=W(),{enabled:s,token:c}=Ae();async function m({qualifiedPhoneNumber:g}){if(s&&!c&&!r)i({captchaModalData:{callback:y=>l(g,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(g,c),n("AWAITING_PASSWORDLESS_CODE")}catch(y){i({errorModalData:{error:y,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return(0,Uo.jsxs)(Uo.Fragment,{children:[(0,Uo.jsx)(or,{if:!e,children:(0,Uo.jsx)(oi,{ref:o,onSubmit:m})}),(0,Uo.jsx)(or,{if:e,children:(0,Uo.jsxs)(We,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[(0,Uo.jsx)(nh.default,{})," Continue with SMS"]})})]})};var Fi=require("react/jsx-runtime"),Ns=({style:e,...t})=>(0,Fi.jsxs)("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:[(0,Fi.jsx)("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"}),(0,Fi.jsx)("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"})]});var Lr=require("react/jsx-runtime"),Ls=({style:e,...t})=>(0,Lr.jsxs)("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:[(0,Lr.jsx)("g",{clipPath:"url(#clip0)",children:(0,Lr.jsx)("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"})}),(0,Lr.jsx)("defs",{children:(0,Lr.jsx)("clipPath",{id:"clip0",children:(0,Lr.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var mc=require("react/jsx-runtime"),Os=({style:e,...t})=>(0,mc.jsx)("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:(0,mc.jsx)("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"})});var rn=require("react/jsx-runtime"),Ds=({style:e,...t})=>(0,rn.jsxs)("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:[(0,rn.jsx)("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"}),(0,rn.jsx)("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"}),(0,rn.jsx)("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"}),(0,rn.jsx)("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"})]});var Bi=require("react/jsx-runtime");function Us({style:e,...t}){return(0,Bi.jsx)("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:(0,Bi.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,Bi.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,Bi.jsx)("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"})})})})}var ri=require("react/jsx-runtime");function Fs(e){return(0,ri.jsxs)("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:[(0,ri.jsx)("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"}),(0,ri.jsx)("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"}),(0,ri.jsx)("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"})]})}var fc=require("react/jsx-runtime"),Bs=({style:e,...t})=>(0,fc.jsx)("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:(0,fc.jsx)("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"})});var Fo=require("react/jsx-runtime"),h1={apple:{logo:(0,Fo.jsx)(Ns,{}),displayName:"Apple"},discord:{logo:(0,Fo.jsx)(Ls,{}),displayName:"Discord"},github:{logo:(0,Fo.jsx)(Os,{}),displayName:"GitHub"},google:{logo:(0,Fo.jsx)(Ds,{}),displayName:"Google"},linkedin:{logo:(0,Fo.jsx)(Us,{}),displayName:"LinkedIn"},twitter:{logo:(0,Fo.jsx)(Bs,{}),displayName:"Twitter"},tiktok:{logo:(0,Fo.jsx)(Fs,{}),displayName:"TikTok"}},Or=({provider:e})=>{let{enabled:t,token:o}=Ae(),{navigate:r,setModalData:n}=A(),{initLoginWithOAuth:i}=W(),{displayName:a,logo:l}=h1[e];return(0,Fo.jsxs)(We,{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]})};var sh=f(require("@heroicons/react/24/outline/ChevronRightIcon")),lh=f(require("@heroicons/react/24/outline/WalletIcon"));var ni=require("react/jsx-runtime"),ch=({onClick:e,text:t})=>(0,ni.jsxs)(We,{onClick:e,children:[(0,ni.jsx)(lh.default,{}),(0,ni.jsx)(as,{children:t}),(0,ni.jsx)(sh.default,{})]});var dh=f(require("@heroicons/react/24/outline/ChevronRightIcon"));var Hi=require("react/jsx-runtime"),ph=({onClick:e,text:t,icon:o})=>(0,Hi.jsxs)(We,{onClick:e,children:[o,(0,Hi.jsx)(as,{children:t}),(0,Hi.jsx)(dh.default,{})]});var X=require("react/jsx-runtime"),gh=()=>{let{closePrivyModal:e,connectors:t}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:r}=A(),{email:n,sms:i,google:a,twitter:l,discord:s,github:c,tiktok:m,linkedin:g,apple:y,wallet:v,farcaster:b}=o?.loginMethods??{},E=o?.appearance.loginGroupPriority||"web2-first",S=o?.appearance.hideDirectWeb2Inputs,[T,P]=(0,Gi.useState)("default"),[O,I]=(0,Gi.useState)(n?"email":"sms");(0,Gi.useEffect)(()=>{I(n?"email":"sms")},[n]);let L=()=>{e({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{P("default")},150)};r.current=L;let D=[n&&(0,X.jsx)(Jf,{isEditable:O==="email",setIsEditable:()=>{I("email")}}),i&&(0,X.jsx)(ah,{isEditable:O==="sms",setIsEditable:()=>{I("sms")}})].filter(Boolean),M=[a&&(0,X.jsx)(Or,{provider:"google"}),l&&(!hh.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)&&(0,X.jsx)(Or,{provider:"twitter"}),s&&(0,X.jsx)(Or,{provider:"discord"}),c&&(0,X.jsx)(Or,{provider:"github"}),m&&(0,X.jsx)(Or,{provider:"tiktok"}),g&&(0,X.jsx)(Or,{provider:"linkedin"}),y&&(0,X.jsx)(Or,{provider:"apple"}),b&&(0,X.jsx)(Zf,{})].filter(Boolean),G=$l(o?.appearance.walletList??[],t,!1),Y=T==="default"?void 0:()=>{P("default")},ie=g1({priority:E,email:n,sms:i,social:M}),U=v1({priority:E,email:n,sms:i,social:M}),q=w1({priority:E,email:n,sms:i,social:M}),k=(0,X.jsx)(ch,{text:q,onClick:()=>P("web3-overflow")}),Ee=(0,X.jsx)(ph,{text:ie,icon:U,onClick:()=>P("web2-overflow")}),pe=S?0:1;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_,{title:"Log in or sign up",onClose:L,backFn:Y}),T==="default"&&(0,X.jsx)(y1,{}),(0,X.jsx)(nu,{style:{overflow:"hidden",padding:2},children:(0,X.jsxs)(Io,{children:[T==="default"&&E==="web2-first"&&(0,X.jsxs)(X.Fragment,{children:[...D,...M.length+D.length>4?M.slice(0,3-D.length):M,D.length+M.length>4&&Ee,v&&k]}),T==="default"&&E==="web3-first"&&(0,X.jsxs)(X.Fragment,{children:[v&&(0,X.jsxs)(X.Fragment,{children:[...G.length>4?G.slice(0,3):G,G.length>4&&k]}),D.length+M.length>pe&&Ee,D.length+M.length===pe&&D.length?D[0]:null,D.length+M.length===pe&&M.length?M[0]:null]}),T==="web2-overflow"&&(0,X.jsxs)(X.Fragment,{children:[...E==="web3-first"?D:[],...M]}),...T==="web3-overflow"?G:[]]})}),o&&(0,X.jsx)(ns,{app:o}),(0,X.jsx)($,{protectedByPrivy:!0})]})},y1=(0,yh.default)(ys)`
|
|
1749
1749
|
margin-bottom: 16px;
|
|
1750
|
-
`,
|
|
1750
|
+
`,g1=({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",v1=({priority:e,email:t,sms:o,social:r})=>e==="web2-first"||r.length>0?(0,X.jsx)(fh.default,{}):t&&o?(0,X.jsx)(qf,{}):t?(0,X.jsx)(uh.default,{}):o?(0,X.jsx)(mh.default,{}):null,w1=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var vh=f(require("@heroicons/react/24/outline/EnvelopeIcon"));var Ut=require("react/jsx-runtime"),wh=()=>{let{app:e}=A();return(0,Ut.jsxs)(Ut.Fragment,{children:[(0,Ut.jsx)(_,{},"header"),(0,Ut.jsx)(Z,{}),(0,Ut.jsx)(Ge,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,Ut.jsx)(vh.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Ut.jsx)(Wo,{children:(0,Ut.jsx)(Is,{stacked:!0})}),(0,Ut.jsx)(te,{}),(0,Ut.jsx)($,{protectedByPrivy:!0})]})};var Ch=f(require("@heroicons/react/24/outline/PhoneIcon"));var Ft=require("react/jsx-runtime"),bh=()=>{let{app:e,currentScreen:t,data:o,navigate:r,setModalData:n}=A(),{initLoginWithSms:i}=W();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(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsx)(_,{},"header"),(0,Ft.jsx)(Z,{}),(0,Ft.jsx)(Ge,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:(0,Ft.jsx)(Ch.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),(0,Ft.jsx)(Wo,{children:(0,Ft.jsx)(oi,{stacked:!0,onSubmit:a})}),(0,Ft.jsx)(te,{}),(0,Ft.jsx)($,{protectedByPrivy:!0})]})};var Bo=require("react/jsx-runtime"),Eh=()=>{let{linkingHint:e}=W(),{app:t}=A(),o=e?`Select the wallet with ${gr(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return(0,Bo.jsxs)(Bo.Fragment,{children:[(0,Bo.jsx)(_,{},"header"),(0,Bo.jsx)(Mo,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),(0,Bo.jsx)(Io,{children:(0,Bo.jsx)(Fn,{connectOnly:!1})}),(0,Bo.jsx)($,{protectedByPrivy:!0})]})};var Vi=require("react/jsx-runtime"),Th=({style:e,...t})=>(0,Vi.jsxs)("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:[(0,Vi.jsx)("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),(0,Vi.jsx)("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"})]});var _t=require("react/jsx-runtime"),Ph=()=>{let{closePrivyModal:e}=W(),{navigate:t}=A();return(0,_t.jsxs)(_t.Fragment,{children:[(0,_t.jsx)(_,{},"header"),(0,_t.jsx)(Z,{}),(0,_t.jsx)(Th,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),(0,_t.jsx)(Mo,{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"}}),(0,_t.jsxs)(Wo,{children:[(0,_t.jsx)(F,{onClick:()=>t("LANDING"),children:"Try again"}),(0,_t.jsx)(uo,{onClick:()=>e(),children:"Cancel"})]}),(0,_t.jsx)(te,{}),(0,_t.jsx)($,{protectedByPrivy:!0})]})};var gc=f(require("@heroicons/react/20/solid/CheckIcon")),Oh=f(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),Dh=f(require("@heroicons/react/24/outline/FingerPrintIcon")),Uh=f(require("@heroicons/react/24/outline/PhoneIcon")),vc=f(require("@heroicons/react/24/outline/TrashIcon")),Fh=f(require("@heroicons/react/24/solid/CheckBadgeIcon")),wc=f(require("@heroicons/react/24/solid/CheckCircleIcon")),Cc=f(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Bh=f(require("@heroicons/react/24/solid/IdentificationIcon")),zs=f(require("@heroicons/react/24/solid/PhoneIcon")),Vs=f(require("@heroicons/react/24/solid/ShieldCheckIcon")),Bt=require("react");var Gs=require("react"),Ah=require("react-device-detect"),yc=f(require("styled-components"));var nn=require("@headlessui/react"),Hs=f(require("react")),an=f(require("styled-components")),cr=require("react/jsx-runtime"),xh=({children:e,open:t,onClick:o,...r})=>(0,cr.jsx)(nn.Transition,{show:t,as:Hs.default.Fragment,children:(0,cr.jsxs)(nn.Dialog,{onClose:o,...r,as:b1,children:[(0,cr.jsx)(nn.Transition.Child,{as:Hs.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,cr.jsx)(C1,{"aria-hidden":"true"})}),(0,cr.jsx)(E1,{children:(0,cr.jsx)(nn.Transition.Child,{as:Hs.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,cr.jsx)(nn.Dialog.Panel,{as:T1,children:e})})})]})}),ii=an.default.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
|
+
`,C1=an.default.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
|
+
`,b1=an.default.div`
|
|
1787
1787
|
position: relative;
|
|
1788
1788
|
z-index: 999999;
|
|
1789
|
-
`,
|
|
1789
|
+
`,E1=an.default.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
|
+
`,T1=an.default.div`
|
|
1798
1798
|
// reset some default dialog styles
|
|
1799
1799
|
padding: 0;
|
|
1800
1800
|
background: transparent;
|
|
@@ -1841,19 +1841,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1841
1841
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1842
1842
|
border-radius: var(--privy-border-radius-lg);
|
|
1843
1843
|
}
|
|
1844
|
-
`,
|
|
1844
|
+
`,Sh=an.default.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
|
-
`;var
|
|
1850
|
+
`;var Ho=require("react/jsx-runtime"),zi=6,P1=new Array(zi).fill("");function x1(e){return e.replace(/\s+/g,"")}function hc(e){return/^[0-9]{1}$/.test(e)}function _h(e){return e.length===zi&&e.every(hc)}function S1(e,t){return e.reduce((o,r)=>o+Number(t(r)),0)}var ai=({onChange:e,disabled:t,errorReasonOverride:o,success:r})=>{let[n,i]=(0,Gs.useState)(P1),[a,l]=(0,Gs.useState)(null),[s,c]=(0,Gs.useState)(null),m=async b=>{b.preventDefault();let E=x1(b.currentTarget.value);if(E==="")return;let S=S1(n,hc),T=E.split(""),P=!T.every(hc),O=T.length+S>zi;if(P){l("Passcode can only be numbers"),c(1);return}if(O){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let I=Number(b.currentTarget.name?.charAt(4)),L=[...E||[""]].slice(0,zi-I),D=[...n.slice(0,I),...L,...n.slice(I+L.length)];i(D);let M=L.length,G=Math.min(Math.max(I+M,0),zi-1);if(document.querySelector(`input[name=pin-${G}]`)?.focus(),_h(D))try{await e(D.join("")),document.querySelector(`input[name=pin-${G}]`)?.blur()}catch(ie){c(1),l(ie.message)}else try{await e(null)}catch(ie){c(1),l(ie.message)}},g=b=>{s===1&&(l(null),c(null));let E=[...n.slice(0,b),"",...n.slice(b+1)];i(E),b>0&&document.querySelector(`input[name=pin-${b-1}]`)?.focus(),_h(E)?e(E.join("")):e(null)},v=r?"success":!!(o||a)?"fail":"";return(0,Ho.jsx)(Ho.Fragment,{children:(0,Ho.jsxs)(_1,{children:[(0,Ho.jsx)("div",{children:n.map((b,E)=>(0,Ho.jsx)("input",{name:`pin-${E}`,type:"text",value:n[E],onChange:m,onKeyUp:S=>{S.key==="Backspace"&&g(E)},inputMode:"numeric",autoFocus:E===0,pattern:"[0-9]",className:v,autoComplete:Ah.isMobile?"one-time-code":"off",disabled:t},E))}),(0,Ho.jsx)("div",{children:(0,Ho.jsx)(A1,{fail:!!o||!!a,children:o||a})})]})})},_1=yc.default.div`
|
|
1851
1851
|
display: flex;
|
|
1852
1852
|
flex-direction: column;
|
|
1853
1853
|
width: 100%;
|
|
1854
1854
|
gap: 8px;
|
|
1855
1855
|
|
|
1856
|
-
${
|
|
1856
|
+
${ii}[data-height='medium'] & {
|
|
1857
1857
|
margin-top: 22px;
|
|
1858
1858
|
}
|
|
1859
1859
|
|
|
@@ -1918,7 +1918,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1918
1918
|
transform: translate(1px, 0px);
|
|
1919
1919
|
}
|
|
1920
1920
|
}
|
|
1921
|
-
`,
|
|
1921
|
+
`,A1=yc.default.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
|
-
`;var
|
|
1929
|
+
`;var kh=require("react");function sn(){let{promptMfa:e,init:t,submit:o,cancel:r}=(0,kh.useContext)(he);return{promptMfa:e,init:t,submit:o,cancel:r}}var Rh=require("react");function si(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:r,unenroll:n,enrollInMfa:i}=(0,Rh.useContext)(he);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:r,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>i(!0),closeMfaEnrollmentModal:()=>i(!1)}}var Ih=f(require("styled-components")),$i=require("react/jsx-runtime"),Wh=e=>(0,$i.jsxs)(k1,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[(0,$i.jsx)("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),(0,$i.jsx)("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"})]}),k1=Ih.default.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
|
-
`;var Wh=f(require("@heroicons/react/24/solid/ShieldCheckIcon"));var Nh=require("react/jsx-runtime");var Mh=({size:e,authUrl:t})=>(0,Nh.jsx)(Ps,{url:t,squareLogoElement:Wh.default,size:e,fgColor:"#1F1F1F"});var u=require("react/jsx-runtime"),Bh=()=>{let{user:e,enrollInMfa:t}=G(),[o,r]=(0,Ft.useState)(null),{unenrollWithSms:n,unenrollWithTotp:i}=ai(),{app:a,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=A(),{closePrivyModal:m}=I(),{promptMfa:g}=an(),[y,v]=(0,Ft.useState)(s?.mfaEnrollmentFlow?.seenIntro||!1),[b,E]=(0,Ft.useState)(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),S=()=>{m({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{r(null),E(null)},500)};c.current=S;let T=e?.mfaMethods.includes("sms"),P=!!e?.phone,L=e?.mfaMethods.includes("totp"),R=T||L;(0,Ft.useEffect)(()=>{R&&v(!0)},[R]);function N(){r(null),E(null)}function O(){v(!1)}async function W(D){await g(),E(D)}if(!l||!e||!a)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{onClose:S},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(Ih,{})}),(0,u.jsx)(Pr,{children:(0,u.jsx)(qt,{})}),(0,u.jsx)(J,{})]});async function H(){r(null);try{await n()}catch{r(null)}}async function K(){r(null);try{await i()}catch{r(null)}}if(o==="sms")return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:N,onClose:S},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(mt,{children:(0,u.jsx)(Vs.default,{})})}),(0,u.jsx)(Me,{children:"Remove SMS verification?"}),(0,u.jsxs)(Se,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),(0,u.jsx)(xr,{children:(0,u.jsx)(U,{warn:!0,onClick:H,children:"Remove SMS for MFA"})}),(0,u.jsx)(J,{})]});if(o==="totp")return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:N,onClose:S},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(mt,{children:(0,u.jsx)(wc.default,{})})}),(0,u.jsx)(Me,{children:"Remove Authenticator App verification?"}),(0,u.jsxs)(Se,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),(0,u.jsx)(xr,{children:(0,u.jsx)(U,{warn:!0,onClick:K,children:"Remove Authenticator App for MFA"})}),(0,u.jsx)(J,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!R)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{onClose:S},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(mt,{children:(0,u.jsx)(Gs.default,{})})}),(0,u.jsx)(Me,{children:"Add more security"}),(0,u.jsxs)(Se,{children:[a?.name," does not have any verification methods enabled."]}),(0,u.jsx)(xr,{children:(0,u.jsx)(U,{onClick:S,children:"Close"})}),(0,u.jsx)(J,{})]});let ne=!R&&!y;if(ne)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{onClose:S},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(mt,{children:(0,u.jsx)(Gs.default,{})})}),(0,u.jsx)(Me,{children:"Transaction Protection"}),(0,u.jsx)(Se,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,u.jsxs)(iu,{children:[(0,u.jsxs)(Dl,{children:[(0,u.jsx)(Ol,{children:(0,u.jsx)(Uh.default,{})}),"Enable 2-Step verification for your ",a?.name," wallet."]}),(0,u.jsxs)(Dl,{children:[(0,u.jsx)(Ol,{children:(0,u.jsx)(Fh.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,u.jsxs)(xr,{children:[(0,u.jsx)(U,{onClick:()=>v(!0),children:"Continue"}),(0,u.jsx)(po,{onClick:S,children:"Not now"})]}),(0,u.jsx)(J,{})]});switch(b){case"sms":return(0,u.jsx)(P1,{onComplete:S,onReset:N,onClose:S});case"totp":return(0,u.jsx)(x1,{onComplete:S,onClose:S,onReset:N});default:return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:ne?O:void 0,onClose:S},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(mt,{children:(0,u.jsx)(Gs.default,{})})}),(0,u.jsx)(Me,{children:"Choose a verification method"}),R?(0,u.jsx)(Se,{children:"To add or delete verification methods, verification is required."}):(0,u.jsx)(Se,{children:"How would you like to verify your identity? You can change this later."}),(0,u.jsxs)(as,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||L)&&(0,u.jsxs)(ss,{children:[(0,u.jsx)(We,{disabled:L,onClick:()=>W("totp"),children:(0,u.jsxs)(cs,{children:[(0,u.jsxs)(ls,{children:[(0,u.jsx)(Lh.default,{}),"Authenticator App"]}),L?(0,u.jsxs)(Ln,{children:[(0,u.jsx)(yc.default,{}),"Added"]}):(0,u.jsx)(Ln,{children:"Recommended"})]})}),L&&(0,u.jsx)(Ul,{id:"remove",onClick:()=>r("totp"),children:(0,u.jsx)(gc.default,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||T)&&(0,u.jsxs)(ss,{children:[(0,u.jsx)(We,{disabled:T||P,onClick:()=>W("sms"),children:(0,u.jsxs)(cs,{children:[(0,u.jsxs)(ls,{children:[(0,u.jsx)(Dh.default,{}),"SMS"]}),T&&(0,u.jsxs)(Ln,{children:[(0,u.jsx)(yc.default,{}),"Added"]}),P&&(0,u.jsx)(Ln,{children:"Disabled"})]})}),T&&(0,u.jsx)(Ul,{id:"remove",onClick:()=>r("sms"),children:(0,u.jsx)(gc.default,{})})]},"sms"),(0,u.jsx)(ss,{children:(0,u.jsx)(We,{disabled:!0,children:(0,u.jsxs)(cs,{children:[(0,u.jsxs)(ls,{children:[(0,u.jsx)(Oh.default,{}),"Passkey"]}),(0,u.jsx)(Ln,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),(0,u.jsx)(J,{})]})}},P1=({onComplete:e,onReset:t,onClose:o})=>{let[r,n]=(0,Ft.useState)(""),[i,a]=(0,Ft.useState)(!1),[l,s]=(0,Ft.useState)("enroll"),{initEnrollmentWithSms:c,submitEnrollmentWithSms:m}=ai(),{app:g,data:y,currentScreen:v,navigate:b,setModalData:E}=A();function S(){y?.mfaEnrollmentFlow?.onSuccess(),e()}async function T({qualifiedPhoneNumber:R}){try{await c({phoneNumber:R}),n(R),s("verify")}catch(N){E({mfaEnrollmentFlow:y?.mfaEnrollmentFlow?{...y?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:N,previousScreen:v||"MFA_ENROLLMENT_FLOW_SCREEN"}}),b("ERROR_SCREEN")}}async function P(R){try{if(!R)return;await m({phoneNumber:r,mfaCode:R}),a(!0)}catch(N){throw Jl(N)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Yr(N)?new Error("The code you entered is not valid"):Kr(N)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Ql(N)?new Error("Verification canceled"):new Error("Unknown error")}}function L(){l==="verify"?s("enroll"):t()}return l==="enroll"?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:t,onClose:o},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(mt,{children:(0,u.jsx)(Vs.default,{})})}),(0,u.jsx)(Me,{children:"Set up SMS verification"}),(0,u.jsx)(Se,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,u.jsxs)(Pr,{children:[(0,u.jsx)(ti,{onSubmit:T}),(0,u.jsxs)(au,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),(0,u.jsx)(J,{})]}):i?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{onClose:S},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(mt,{status:"success",children:(0,u.jsx)(vc.default,{})})}),(0,u.jsx)(Me,{children:"SMS verification added"}),(0,u.jsx)(Se,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,u.jsx)(xr,{children:(0,u.jsx)(U,{onClick:S,children:"Done"})}),(0,u.jsx)(J,{})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:L,onClose:o},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(mt,{children:(0,u.jsx)(Vs.default,{})})}),(0,u.jsx)(Me,{children:"Enter enrollment code"}),(0,u.jsxs)(Pr,{children:[(0,u.jsx)(ii,{onChange:P}),(0,u.jsxs)(Se,{children:["To continue, enter the 6-digit code sent to ",(0,u.jsx)("strong",{children:Xf(r)})]})]}),(0,u.jsx)(J,{})]})},x1=({onComplete:e,onClose:t,onReset:o})=>{let[r,n]=(0,Ft.useState)("enroll"),[i,a]=(0,Ft.useState)(null),[l,s]=(0,Ft.useState)(!1),{initEnrollmentWithTotp:c,submitEnrollmentWithTotp:m}=ai(),{data:g}=A();(0,Ft.useEffect)(()=>{a(null),c().then(S=>{a(S)}).catch(()=>{a(null),o()})},[]);function y(){g?.mfaEnrollmentFlow?.onSuccess(),e()}function v(){n("verify")}async function b(S){try{if(!S)return;await m({mfaCode:S}),s(!0)}catch(T){throw Jl(T)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Yr(T)?new Error("The code you entered is not valid"):Kr(T)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Ql(T)?new Error("Verification canceled"):new Error("Unknown error")}}function E(){r==="verify"?n("enroll"):o()}return r==="enroll"?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:o,onClose:t},"header"),(0,u.jsx)(Me,{children:"Scan QR code"}),(0,u.jsx)(Se,{children:"Open your authenticator app and scan the QR code to continue."}),(0,u.jsx)(ms,{children:i?.authUrl?(0,u.jsx)(Mh,{authUrl:i.authUrl,size:200}):(0,u.jsx)(qt,{})}),(0,u.jsxs)(xr,{children:[(0,u.jsx)(Kt,{children:i?.secret&&(0,u.jsx)(Jn,{itemName:"secret",text:i.secret})}),(0,u.jsx)(U,{onClick:v,children:"Continue"})]}),(0,u.jsx)(J,{})]}):l?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{onClose:y},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(mt,{status:"success",children:(0,u.jsx)(vc.default,{})})}),(0,u.jsx)(Me,{children:"Authenticator app verification added"}),(0,u.jsx)(Se,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,u.jsx)(xr,{children:(0,u.jsx)(U,{onClick:y,children:"Done"})}),(0,u.jsx)(J,{})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:E,onClose:t},"header"),(0,u.jsx)(rt,{children:(0,u.jsx)(mt,{children:(0,u.jsx)(wc.default,{})})}),(0,u.jsx)(Me,{children:"Enter enrollment code"}),(0,u.jsx)(Pr,{children:(0,u.jsx)(ii,{onChange:b})}),(0,u.jsxs)(Se,{children:["To continue, enter the 6-digit code generated from your ",(0,u.jsx)("strong",{children:"authenticator app"})]}),(0,u.jsx)(J,{})]})};var vy=f(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),wy=f(require("@heroicons/react/24/outline/PhoneIcon")),Cy=f(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),by=f(require("@heroicons/react/24/solid/PhoneIcon")),Ey=f(require("@heroicons/react/24/solid/ShieldCheckIcon")),mi=require("react");var yy=require("@ethersproject/providers"),ln=require("react"),gy=f(require("styled-components"));var Sc=f(require("styled-components"));var Cc=f(require("styled-components")),$i=require("react/jsx-runtime"),zs=({label:e,children:t,valueStyles:o})=>(0,$i.jsxs)(S1,{children:[(0,$i.jsx)("div",{children:e}),(0,$i.jsx)(_1,{style:{...o},children:t})]}),S1=Cc.default.div`
|
|
1940
|
+
`;var Mh=f(require("@heroicons/react/24/solid/ShieldCheckIcon"));var Lh=require("react/jsx-runtime");var Nh=({size:e,authUrl:t})=>(0,Lh.jsx)(xs,{url:t,squareLogoElement:Mh.default,size:e,fgColor:"#1F1F1F"});var u=require("react/jsx-runtime"),Hh=()=>{let{user:e,enrollInMfa:t}=V(),[o,r]=(0,Bt.useState)(null),{unenrollWithSms:n,unenrollWithTotp:i}=si(),{app:a,ready:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=A(),{closePrivyModal:m}=W(),{promptMfa:g}=sn(),[y,v]=(0,Bt.useState)(s?.mfaEnrollmentFlow?.seenIntro||!1),[b,E]=(0,Bt.useState)(s?.mfaEnrollmentFlow?.selectedMfaMethod||null),S=()=>{m({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{r(null),E(null)},500)};c.current=S;let T=e?.mfaMethods.includes("sms"),P=!!e?.phone,O=e?.mfaMethods.includes("totp"),I=T||O;(0,Bt.useEffect)(()=>{I&&v(!0)},[I]);function L(){r(null),E(null)}function D(){v(!1)}async function M(U){await g(),E(U)}if(!l||!e||!a)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{onClose:S},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(Wh,{})}),(0,u.jsx)(xr,{children:(0,u.jsx)(qt,{})}),(0,u.jsx)(Q,{})]});async function G(){r(null);try{await n()}catch{r(null)}}async function Y(){r(null);try{await i()}catch{r(null)}}if(o==="sms")return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:L,onClose:S},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(yt,{children:(0,u.jsx)(zs.default,{})})}),(0,u.jsx)(Me,{children:"Remove SMS verification?"}),(0,u.jsxs)(_e,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),(0,u.jsx)(Sr,{children:(0,u.jsx)(F,{warn:!0,onClick:G,children:"Remove SMS for MFA"})}),(0,u.jsx)(Q,{})]});if(o==="totp")return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:L,onClose:S},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(yt,{children:(0,u.jsx)(Cc.default,{})})}),(0,u.jsx)(Me,{children:"Remove Authenticator App verification?"}),(0,u.jsxs)(_e,{children:["MFA adds an extra layer of security to your ",a?.name," account. Make sure you have other methods to secure your account."]}),(0,u.jsx)(Sr,{children:(0,u.jsx)(F,{warn:!0,onClick:Y,children:"Remove Authenticator App for MFA"})}),(0,u.jsx)(Q,{})]});if(s.mfaEnrollmentFlow.mfaMethods.length===0&&!I)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{onClose:S},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(yt,{children:(0,u.jsx)(Vs.default,{})})}),(0,u.jsx)(Me,{children:"Add more security"}),(0,u.jsxs)(_e,{children:[a?.name," does not have any verification methods enabled."]}),(0,u.jsx)(Sr,{children:(0,u.jsx)(F,{onClick:S,children:"Close"})}),(0,u.jsx)(Q,{})]});let ie=!I&&!y;if(ie)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{onClose:S},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(yt,{children:(0,u.jsx)(Vs.default,{})})}),(0,u.jsx)(Me,{children:"Transaction Protection"}),(0,u.jsx)(_e,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,u.jsxs)(au,{children:[(0,u.jsxs)(Ul,{children:[(0,u.jsx)(Dl,{children:(0,u.jsx)(Fh.default,{})}),"Enable 2-Step verification for your ",a?.name," wallet."]}),(0,u.jsxs)(Ul,{children:[(0,u.jsx)(Dl,{children:(0,u.jsx)(Bh.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,u.jsxs)(Sr,{children:[(0,u.jsx)(F,{onClick:()=>v(!0),children:"Continue"}),(0,u.jsx)(uo,{onClick:S,children:"Not now"})]}),(0,u.jsx)(Q,{})]});switch(b){case"sms":return(0,u.jsx)(R1,{onComplete:S,onReset:L,onClose:S});case"totp":return(0,u.jsx)(I1,{onComplete:S,onClose:S,onReset:L});default:return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:ie?D:void 0,onClose:S},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(yt,{children:(0,u.jsx)(Vs.default,{})})}),(0,u.jsx)(Me,{children:"Choose a verification method"}),I?(0,u.jsx)(_e,{children:"To add or delete verification methods, verification is required."}):(0,u.jsx)(_e,{children:"How would you like to verify your identity? You can change this later."}),(0,u.jsxs)(ss,{children:[(s.mfaEnrollmentFlow.mfaMethods.includes("totp")||O)&&(0,u.jsxs)(ls,{children:[(0,u.jsx)(We,{disabled:O,onClick:()=>M("totp"),children:(0,u.jsxs)(ds,{children:[(0,u.jsxs)(cs,{children:[(0,u.jsx)(Oh.default,{}),"Authenticator App"]}),O?(0,u.jsxs)(On,{children:[(0,u.jsx)(gc.default,{}),"Added"]}):(0,u.jsx)(On,{children:"Recommended"})]})}),O&&(0,u.jsx)(Fl,{id:"remove",onClick:()=>r("totp"),children:(0,u.jsx)(vc.default,{})})]},"totp"),(s.mfaEnrollmentFlow.mfaMethods.includes("sms")||T)&&(0,u.jsxs)(ls,{children:[(0,u.jsx)(We,{disabled:T||P,onClick:()=>M("sms"),children:(0,u.jsxs)(ds,{children:[(0,u.jsxs)(cs,{children:[(0,u.jsx)(Uh.default,{}),"SMS"]}),T&&(0,u.jsxs)(On,{children:[(0,u.jsx)(gc.default,{}),"Added"]}),P&&(0,u.jsx)(On,{children:"Disabled"})]})}),T&&(0,u.jsx)(Fl,{id:"remove",onClick:()=>r("sms"),children:(0,u.jsx)(vc.default,{})})]},"sms"),(0,u.jsx)(ls,{children:(0,u.jsx)(We,{disabled:!0,children:(0,u.jsxs)(ds,{children:[(0,u.jsxs)(cs,{children:[(0,u.jsx)(Dh.default,{}),"Passkey"]}),(0,u.jsx)(On,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),(0,u.jsx)(Q,{})]})}},R1=({onComplete:e,onReset:t,onClose:o})=>{let[r,n]=(0,Bt.useState)(""),[i,a]=(0,Bt.useState)(!1),[l,s]=(0,Bt.useState)("enroll"),{initEnrollmentWithSms:c,submitEnrollmentWithSms:m}=si(),{app:g,data:y,currentScreen:v,navigate:b,setModalData:E}=A();function S(){y?.mfaEnrollmentFlow?.onSuccess(),e()}async function T({qualifiedPhoneNumber:I}){try{await c({phoneNumber:I}),n(I),s("verify")}catch(L){E({mfaEnrollmentFlow:y?.mfaEnrollmentFlow?{...y?.mfaEnrollmentFlow,selectedMfaMethod:"sms",seenIntro:!0}:void 0,errorModalData:{error:L,previousScreen:v||"MFA_ENROLLMENT_FLOW_SCREEN"}}),b("ERROR_SCREEN")}}async function P(I){try{if(!I)return;await m({phoneNumber:r,mfaCode:I}),a(!0)}catch(L){throw Ql(L)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Jr(L)?new Error("The code you entered is not valid"):Yr(L)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Zl(L)?new Error("Verification canceled"):new Error("Unknown error")}}function O(){l==="verify"?s("enroll"):t()}return l==="enroll"?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:t,onClose:o},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(yt,{children:(0,u.jsx)(zs.default,{})})}),(0,u.jsx)(Me,{children:"Set up SMS verification"}),(0,u.jsx)(_e,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,u.jsxs)(xr,{children:[(0,u.jsx)(oi,{onSubmit:T}),(0,u.jsxs)(su,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),(0,u.jsx)(Q,{})]}):i?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{onClose:S},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(yt,{status:"success",children:(0,u.jsx)(wc.default,{})})}),(0,u.jsx)(Me,{children:"SMS verification added"}),(0,u.jsx)(_e,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,u.jsx)(Sr,{children:(0,u.jsx)(F,{onClick:S,children:"Done"})}),(0,u.jsx)(Q,{})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:O,onClose:o},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(yt,{children:(0,u.jsx)(zs.default,{})})}),(0,u.jsx)(Me,{children:"Enter enrollment code"}),(0,u.jsxs)(xr,{children:[(0,u.jsx)(ai,{onChange:P}),(0,u.jsxs)(_e,{children:["To continue, enter the 6-digit code sent to ",(0,u.jsx)("strong",{children:eh(r)})]})]}),(0,u.jsx)(Q,{})]})},I1=({onComplete:e,onClose:t,onReset:o})=>{let[r,n]=(0,Bt.useState)("enroll"),[i,a]=(0,Bt.useState)(null),[l,s]=(0,Bt.useState)(!1),{initEnrollmentWithTotp:c,submitEnrollmentWithTotp:m}=si(),{data:g}=A();(0,Bt.useEffect)(()=>{a(null),c().then(S=>{a(S)}).catch(()=>{a(null),o()})},[]);function y(){g?.mfaEnrollmentFlow?.onSuccess(),e()}function v(){n("verify")}async function b(S){try{if(!S)return;await m({mfaCode:S}),s(!0)}catch(T){throw Ql(T)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Jr(T)?new Error("The code you entered is not valid"):Yr(T)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Zl(T)?new Error("Verification canceled"):new Error("Unknown error")}}function E(){r==="verify"?n("enroll"):o()}return r==="enroll"?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:o,onClose:t},"header"),(0,u.jsx)(Me,{children:"Scan QR code"}),(0,u.jsx)(_e,{children:"Open your authenticator app and scan the QR code to continue."}),(0,u.jsx)(fs,{children:i?.authUrl?(0,u.jsx)(Nh,{authUrl:i.authUrl,size:200}):(0,u.jsx)(qt,{})}),(0,u.jsxs)(Sr,{children:[(0,u.jsx)(Kt,{children:i?.secret&&(0,u.jsx)(Qn,{itemName:"secret",text:i.secret})}),(0,u.jsx)(F,{onClick:v,children:"Continue"})]}),(0,u.jsx)(Q,{})]}):l?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{onClose:y},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(yt,{status:"success",children:(0,u.jsx)(wc.default,{})})}),(0,u.jsx)(Me,{children:"Authenticator app verification added"}),(0,u.jsx)(_e,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,u.jsx)(Sr,{children:(0,u.jsx)(F,{onClick:y,children:"Done"})}),(0,u.jsx)(Q,{})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(_,{backFn:E,onClose:t},"header"),(0,u.jsx)(nt,{children:(0,u.jsx)(yt,{children:(0,u.jsx)(Cc.default,{})})}),(0,u.jsx)(Me,{children:"Enter enrollment code"}),(0,u.jsx)(xr,{children:(0,u.jsx)(ai,{onChange:b})}),(0,u.jsxs)(_e,{children:["To continue, enter the 6-digit code generated from your ",(0,u.jsx)("strong",{children:"authenticator app"})]}),(0,u.jsx)(Q,{})]})};var wy=f(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),Cy=f(require("@heroicons/react/24/outline/PhoneIcon")),by=f(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),Ey=f(require("@heroicons/react/24/solid/PhoneIcon")),Ty=f(require("@heroicons/react/24/solid/ShieldCheckIcon")),fi=require("react");var gy=require("@ethersproject/providers"),cn=require("react"),vy=f(require("styled-components"));var _c=f(require("styled-components"));var bc=f(require("styled-components")),qi=require("react/jsx-runtime"),$s=({label:e,children:t,valueStyles:o})=>(0,qi.jsxs)(W1,{children:[(0,qi.jsx)("div",{children:e}),(0,qi.jsx)(M1,{style:{...o},children:t})]}),W1=bc.default.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
|
+
`,M1=bc.default.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
|
-
`;var
|
|
1964
|
+
`;var Ki=f(require("styled-components"));var Ec=require("@ethersproject/bignumber"),Tc=require("@ethersproject/units");var ji=(e,t)=>{let o=(t*parseFloat((0,Tc.formatEther)(e))).toFixed(2);return o!=="0.00"?`$${o}`:"<$0.01"},Go=(e,t,o=6,r=!1)=>{let i=parseFloat((0,Tc.formatEther)(e)).toFixed(o).replace(/0+$/,"").replace(/\.$/,"");return r?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},Pc=e=>e.map(Oe).reduce((t,o)=>t.add(o),Ec.BigNumber.from(0)).toHexString(),Gh=(e,t)=>{let{chains:o}=W(),r=`https://etherscan.io/address/${t}`,n=`${jd(e,o)}/address/${t}`;if(!n)return r;try{new URL(n)}catch{return r}return n},Oe=e=>Ec.BigNumber.from(e);var Vo=require("react/jsx-runtime"),Vh=({weiQuantities:e,tokenPrice:t,tokenSymbol:o})=>{let r=Pc(e),n=t?ji(r,t):void 0,i=Go(r,o);return(0,Vo.jsx)(zh,{children:n||i})},xc=({weiQuantities:e,tokenPrice:t,tokenSymbol:o})=>{let r=Pc(e),n=t?ji(r,t):void 0,i=Go(r,o);return(0,Vo.jsx)(zh,{children:n?(0,Vo.jsxs)(Vo.Fragment,{children:[(0,Vo.jsx)(N1,{children:"USD"}),n==="<$0.01"?(0,Vo.jsxs)(O1,{children:[(0,Vo.jsx)(L1,{children:"<"}),"$0.01"]}):n]}):i})},zh=Ki.default.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
|
+
`,N1=Ki.default.span`
|
|
1971
1971
|
font-size: 12px;
|
|
1972
1972
|
line-height: 12px;
|
|
1973
1973
|
color: var(--privy-color-foreground-3);
|
|
1974
|
-
`,
|
|
1974
|
+
`,L1=Ki.default.span`
|
|
1975
1975
|
font-size: 10px;
|
|
1976
|
-
`,
|
|
1976
|
+
`,O1=Ki.default.span`
|
|
1977
1977
|
display: flex;
|
|
1978
1978
|
align-items: center;
|
|
1979
|
-
`;var
|
|
1979
|
+
`;var qs=f(require("styled-components"));var At=require("react/jsx-runtime"),$h=({gas:e,tokenPrice:t,tokenSymbol:o})=>(0,At.jsxs)(Vl,{style:{paddingBottom:"12px"},children:[(0,At.jsxs)(jh,{children:[(0,At.jsx)(Yh,{children:"Est. Fees"}),(0,At.jsx)("div",{children:(0,At.jsx)(xc,{weiQuantities:[e],tokenPrice:t,tokenSymbol:o})})]}),t&&(0,At.jsx)(Kh,{children:`${Go(e,o)}`})]}),qh=({transactionData:e,gas:t,tokenPrice:o,tokenSymbol:r})=>{let n=Oe(e.value||0).add(Oe(t)).toHexString();return(0,At.jsxs)(Vl,{children:[(0,At.jsxs)(jh,{children:[(0,At.jsx)(Yh,{children:"Total (including fees)"}),(0,At.jsx)("div",{children:(0,At.jsx)(xc,{weiQuantities:[e.value||0,t],tokenPrice:o,tokenSymbol:r})})]}),o&&(0,At.jsx)(Kh,{children:Go(n,r)})]})},jh=qs.default.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
|
+
`,Kh=qs.default.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
|
+
`,Yh=qs.default.div`
|
|
1995
1995
|
font-size: 14px;
|
|
1996
1996
|
line-height: 22.4px;
|
|
1997
1997
|
font-weight: 400;
|
|
1998
|
-
`;var
|
|
1998
|
+
`;var Jh=f(require("@heroicons/react/24/outline/ChevronDownIcon")),zo=require("react"),dr=f(require("styled-components"));var js=require("react"),li=(0,js.createContext)(void 0);var Yi=(0,js.createContext)(void 0);var Xe=require("react/jsx-runtime"),Qh=({defaultValue:e,children:t})=>{let[o,r]=(0,zo.useState)(e||null),n=i=>{r(o===i?null:i)};return(0,Xe.jsx)(li.Provider,{value:{activePanel:o,togglePanel:n},children:(0,Xe.jsx)(D1,{children:t})})},Zh=({value:e,children:t})=>{let{activePanel:o,togglePanel:r}=(0,zo.useContext)(li),n=o===e;return(0,Xe.jsx)(Yi.Provider,{value:{onToggle:()=>r(e),value:e},children:(0,Xe.jsx)(H1,{isActive:n,"data-open":n,children:t})})},Xh=({children:e})=>{let{activePanel:t}=(0,zo.useContext)(li),{onToggle:o,value:r}=(0,zo.useContext)(Yi),n=t===r;return(0,Xe.jsxs)(Xe.Fragment,{children:[(0,Xe.jsxs)(U1,{onClick:o,"data-open":n,children:[(0,Xe.jsx)(B1,{children:e}),(0,Xe.jsx)(V1,{isactive:n,children:(0,Xe.jsx)(Jh.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),(0,Xe.jsx)(F1,{})]})},ey=({children:e})=>{let{activePanel:t}=(0,zo.useContext)(li),{value:o}=(0,zo.useContext)(Yi);return(0,Xe.jsx)(G1,{"data-open":t===o,children:(0,Xe.jsx)(oy,{children:e})})},ty=({children:e})=>{let{activePanel:t}=(0,zo.useContext)(li),{value:o}=(0,zo.useContext)(Yi);return(0,Xe.jsx)(oy,{children:typeof e=="function"?e({isActive:t===o}):e})},D1=dr.default.div`
|
|
1999
1999
|
display: flex;
|
|
2000
2000
|
flex-direction: column;
|
|
2001
2001
|
width: 100%;
|
|
2002
2002
|
gap: 8px;
|
|
2003
|
-
`,
|
|
2003
|
+
`,U1=dr.default.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
|
+
`,F1=dr.default.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
|
+
`,B1=dr.default.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
|
+
`,H1=dr.default.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
|
+
`,G1=dr.default.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
|
+
`,oy=dr.default.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
|
+
`,V1=dr.default.div`
|
|
2055
2055
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
2056
|
-
`;var
|
|
2056
|
+
`;var ry=f(require("styled-components"));var ny=require("react/jsx-runtime"),Sc=({walletAddress:e,chainId:t=Qo})=>(0,ny.jsx)(z1,{href:Gh(t,e),target:"_blank",children:gr(e)}),z1=ry.default.a`
|
|
2057
2057
|
&:hover {
|
|
2058
2058
|
text-decoration: underline;
|
|
2059
2059
|
}
|
|
2060
|
-
`;var
|
|
2060
|
+
`;var Je=require("react/jsx-runtime"),ci=({from:e,to:t,txn:o,transactionInfo:r,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=o?.value||0;return(0,Je.jsx)(Qh,{children:(0,Je.jsxs)(Zh,{value:"details",children:[(0,Je.jsx)(Xh,{children:(0,Je.jsxs)($1,{children:[(0,Je.jsx)("div",{children:r?.title||r?.actionDescription||"Details"}),(0,Je.jsx)(q1,{children:(0,Je.jsx)(Vh,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),(0,Je.jsxs)(ey,{children:[(0,Je.jsx)($s,{label:"From",children:(0,Je.jsx)(Sc,{walletAddress:e,chainId:o.chainId||Qo})}),(0,Je.jsx)($s,{label:"To",children:(0,Je.jsx)(Sc,{walletAddress:t,chainId:o.chainId||Qo})}),r&&r.action&&(0,Je.jsx)($s,{label:"Action",children:r.action}),i&&(0,Je.jsx)($h,{transactionData:o,gas:i,tokenPrice:n,tokenSymbol:a})]}),(0,Je.jsx)(ty,{children:({isActive:s})=>(0,Je.jsx)(qh,{transactionData:o,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},$1=_c.default.div`
|
|
2061
2061
|
display: flex;
|
|
2062
2062
|
flex-direction: row;
|
|
2063
2063
|
justify-content: space-between;
|
|
2064
|
-
`,
|
|
2064
|
+
`,q1=_c.default.div`
|
|
2065
2065
|
flex-shrink: 0;
|
|
2066
2066
|
padding-left: 8px;
|
|
2067
|
-
`;var
|
|
2067
|
+
`;var di=f(require("styled-components")),Dr=require("react/jsx-runtime"),Ac=({description:e,contractInfo:t})=>(0,Dr.jsxs)(j1,{children:[t.imgUrl&&(0,Dr.jsx)(K1,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&(0,Dr.jsx)(Y1,{children:(0,Dr.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&(0,Dr.jsx)(J1,{children:t.name}),(0,Dr.jsx)(Q1,{children:e||t.actionText})]}),j1=di.default.div`
|
|
2068
2068
|
display: flex;
|
|
2069
2069
|
flex-direction: column;
|
|
2070
2070
|
align-items: center;
|
|
2071
2071
|
margin-bottom: 8px;
|
|
2072
|
-
`,
|
|
2072
|
+
`,K1=di.default.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
|
+
`,Y1=di.default.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
|
+
`,J1=di.default.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
|
+
`,Q1=di.default.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
|
-
`;var
|
|
2108
|
+
`;var iy=f(require("@heroicons/react/24/outline/WalletIcon")),Ks=f(require("styled-components"));var ln=require("react/jsx-runtime"),ay=({address:e,txn:t,balance:o,hasFunds:r})=>{let n=!!o,{nativeTokenSymbolForChainId:i}=W(),a=i(t.chainId)||"ETH";return(0,ln.jsxs)(Z1,{children:[(0,ln.jsxs)(X1,{children:[(0,ln.jsx)(iy.default,{strokeWidth:"2",width:"16px",height:"16px"}),(0,ln.jsx)("div",{children:gr(e)})]}),(0,ln.jsxs)(eC,{displayBalanceColor:n,hasFunds:r,children:[o?Go(o,a,6,!0):0," available"]})]})},Z1=Ks.default.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
|
+
`,X1=Ks.default.div`
|
|
2122
2122
|
display: flex;
|
|
2123
2123
|
flex-direction: row;
|
|
2124
2124
|
align-items: center;
|
|
2125
2125
|
gap: 8px;
|
|
2126
|
-
`,
|
|
2126
|
+
`,eC=Ks.default.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
|
-
`;var
|
|
2136
|
+
`;var Ji=f(require("styled-components"));var Zt=require("react/jsx-runtime"),ly=({description:e,txn:t,tokenSymbol:o,tokenPrice:r})=>{let n=t.value||0,i=r?ji(n,r):void 0,a=Go(n,o);return(0,Zt.jsxs)(tC,{children:[i?(0,Zt.jsxs)(Zt.Fragment,{children:[(0,Zt.jsx)(sy,{children:i}),(0,Zt.jsx)(oC,{children:a})]}):(0,Zt.jsx)(Zt.Fragment,{children:(0,Zt.jsx)(sy,{children:a})}),(0,Zt.jsx)(rC,{children:e})]})},tC=Ji.default.div`
|
|
2137
2137
|
display: flex;
|
|
2138
2138
|
flex-direction: column;
|
|
2139
2139
|
align-items: center;
|
|
2140
2140
|
margin-bottom: 20px;
|
|
2141
|
-
`,
|
|
2141
|
+
`,sy=Ji.default.h2`
|
|
2142
2142
|
&& {
|
|
2143
2143
|
font-size: 48px;
|
|
2144
2144
|
line-height: 48px;
|
|
2145
2145
|
margin: 8px auto;
|
|
2146
2146
|
}
|
|
2147
|
-
`,
|
|
2147
|
+
`,oC=Ji.default.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
|
+
`,rC=Ji.default.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
|
-
`;var
|
|
2161
|
+
`;var uy=require("@ethersproject/abstract-signer"),Xt=require("@ethersproject/bignumber"),my=require("@ethersproject/contracts"),iC=require("@ethersproject/providers"),fy=require("@ethersproject/transactions");var Rc=require("@ethersproject/units"),cy=require("ofetch");var dy=[Si.id,_i.id],kc=e=>({maxPriorityFee:(0,Rc.parseUnits)(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:(0,Rc.parseUnits)(e.maxFee.toFixed(9),"gwei").toHexString()}),nC=e=>({safeLow:kc(e.safeLow),standard:kc(e.standard),fast:kc(e.fast)}),py=async e=>{let t="";switch(e){case Si.id:t="https://gasstation.polygon.technology/v2";break;case _i.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return nC(await(0,cy.ofetch)(t))};function pr(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 aC(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=pr(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=pr(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=pr(e.gasPrice)),e.value!==void 0&&(t.value=pr(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=pr(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=pr(e.maxPriorityFeePerGas)),t}function sC(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=Oe(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Oe(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Oe(e.gasPrice)),e.value!==void 0&&(t.value=Oe(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Oe(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Oe(e.maxPriorityFeePerGas)),t}async function pi(e,t,o){t.chainId=Number(t.chainId),yy(t);let r=new uy.VoidSigner(e,o);if(t.gas&&(t.gasLimit=t.gas,delete t.gas),dy.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await py(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(lC(t.chainId)&&!t.maxFeePerGas)try{let{lastBaseFeePerGas:i}=await r.getFeeData();if(i){let a=i.mul(Xt.BigNumber.from(120)).div(Xt.BigNumber.from(100));t.maxFeePerGas=pr(a),t.maxPriorityFeePerGas=pr(Xt.BigNumber.from(0))}}catch(i){throw new Error(`Failed to set gas price for Arbitrum transaction: ${i}.`)}if(Ic(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=Xt.BigNumber.from(i).mul(Xt.BigNumber.from(126)).div(Xt.BigNumber.from(100)).add(Xt.BigNumber.from(t.maxPriorityFeePerGas));t.maxFeePerGas=pr(s)}}catch(i){throw new Error(`Failed to set gas price for OP stack transaction: ${i}.`)}cC(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 aC(n)}async function Ys(e,t,o,r,n){r=Object.assign({chainId:Qo},r),yy(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 hy(e,t,o,r){let n=await r.getBalance(e),i=t.value||0,l=!n.sub(Oe(i)).sub(o).isNegative();return{balance:n,hasSufficientFunds:l}}function Ic(e){return[Ia.id,Wa.id,Ma.id,La.id,Oa.id,Da.id,Ua.id,Ba.id,Fa.id].includes(e)}function lC(e){return[Aa.id,ka.id,Ra.id].includes(e)}function cC(e){return[56,97].includes(e)}async function Wc(e,t){if(!e.chainId||e.chainId&&!Ic(e.chainId))return Xt.BigNumber.from(0);let o=Xt.BigNumber.from(0);try{let r=new my.Contract(Ld,Od,t),n=sC(e),i=(0,fy.serialize)(n);o=await r.getL1Fee(i)}catch{}return o}async function Js(e,t){delete e.from;let o=Xt.BigNumber.from(0),r=Xt.BigNumber.from(0);if(e.gasLimit?o=Oe(e.gasLimit):o=await t.estimateGas(e),e.type==2)if(e.maxFeePerGas)r=Oe(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=Oe(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}else if(e.gasPrice)r=Oe(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}let n=o.mul(r);if(e.chainId&&Ic(e.chainId))try{let i=await Wc(e,t);n=n.add(i)}catch{}return n}function yy(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!dC(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 dC(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&pC(e);return t||o||r}function pC(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Qs(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}}var ui=require("react");var Zs=e=>{let{showFiatPrices:t,getUsdTokenPrice:o,chains:r}=W(),[n,i]=(0,ui.useState)(!0),[a,l]=(0,ui.useState)(void 0),[s,c]=(0,ui.useState)(void 0);return(0,ui.useEffect)(()=>{let m=e.chainId||Qo,g=r.find(v=>v.id===Number(m));if(!g)throw new J(`Unsupported chain: ${m}`);(async()=>{if(!t){i(!1);return}try{i(!0);let v=await o(g);v?c(v):l(new Error(`Unable to fetch token price on chain id ${g.id}`))}catch(v){l(v)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};var Xs=require("react"),Mc=(0,Xs.createContext)(null);function mi(){let e=(0,Xs.useContext)(Mc);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}var Nc=require("react/jsx-runtime"),Lc=({pendingTransaction:e})=>{let{getAccessToken:t}=V(),{wallets:o}=mi(),{walletProxy:r,rpcConfig:n,chains:i,nativeTokenSymbolForChainId:a}=W(),[l,s]=(0,cn.useState)(e),{tokenPrice:c}=Zs(l),[m,g]=(0,cn.useState)(null),y=a(e.chainId)||"ETH",v=(0,cn.useMemo)(()=>o.find(b=>b.walletClientType==="privy"),[o]);return(0,cn.useEffect)(()=>{async function b(){if(!await t()||!r||!v)return l;let S=new gy.StaticJsonRpcProvider(so(l.chainId,i,n)),T=await Js(l,S);return g(Oe(T.toBigInt()).toHexString()),pi(v.address,l,S)}b().then(E=>{s(E)})},[r]),v?(0,Nc.jsx)(uC,{children:(0,Nc.jsx)(ci,{from:v.address,to:l.to,txn:l,gas:m??void 0,tokenPrice:c,tokenSymbol:y})}):null},uC=vy.default.div`
|
|
2162
2162
|
width: 100%;
|
|
2163
2163
|
padding: 1rem 0;
|
|
2164
|
-
`;var
|
|
2164
|
+
`;var z=require("react/jsx-runtime"),Oc=({open:e,onClose:t})=>{let{user:o}=V(),[r,n]=(0,fi.useState)(null),{init:i,cancel:a}=sn();(0,fi.useEffect)(()=>{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(m){console.error(m)}}let s=()=>{n(null),a(),t()};return!e||!o?null:r?(0,z.jsx)(mC,{selectedMethod:r,onClose:s,onBack:o.mfaMethods.length>1?()=>n(null):void 0}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(_,{onClose:s},"header"),(0,z.jsx)(nt,{children:(0,z.jsx)(yt,{children:(0,z.jsx)(Ty.default,{})})}),(0,z.jsx)(Me,{children:"Verify your identity"}),(0,z.jsx)(_e,{children:"Choose a verification method"}),(0,z.jsxs)(ss,{children:[o.mfaMethods.includes("totp")&&(0,z.jsxs)(We,{onClick:()=>l("totp"),children:[(0,z.jsx)(wy.default,{}),"Authenticator App"]},"totp"),o.mfaMethods.includes("sms")&&(0,z.jsxs)(We,{onClick:()=>l("sms"),children:[(0,z.jsx)(Cy.default,{}),"SMS"]},"sms")]}),(0,z.jsx)(Q,{})]})},mC=({selectedMethod:e,onClose:t,onBack:o})=>{let{app:r}=A(),{pendingTransaction:n}=W(),[i,a]=(0,fi.useState)(!1),[l,s]=(0,fi.useState)(!1),{submit:c}=sn();async function m(g){try{if(!g)return;await c(e,g),s(!0),a(!1),t()}catch(y){throw vs(y)?(a(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Jr(y)?(a(!1),new Error("The code you entered is not valid")):Yr(y)?(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(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(_,{onClose:t},"header"),(0,z.jsx)(nt,{children:(0,z.jsx)(yt,{children:(0,z.jsx)(Ey.default,{})})}),(0,z.jsx)(Me,{children:"Enter verification code"}),(0,z.jsxs)(xr,{children:[(0,z.jsx)(ai,{success:l,disabled:i,onChange:m}),(0,z.jsxs)(_e,{children:["To continue, please enter the 6-digit code sent to your ",(0,z.jsx)("strong",{children:"mobile device"})]}),n&&(0,z.jsx)(Lc,{pendingTransaction:n})]}),o&&(0,z.jsx)(Bl,{theme:r?.appearance.palette.colorScheme,onClick:o,children:"Choose another method"}),(0,z.jsx)(uo,{onClick:t,children:"Not now"}),(0,z.jsx)(Q,{})]});case"totp":return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(_,{onClose:t},"header"),(0,z.jsx)(nt,{children:(0,z.jsx)(yt,{children:(0,z.jsx)(by.default,{})})}),(0,z.jsx)(Me,{children:"Enter verification code"}),(0,z.jsxs)(xr,{children:[(0,z.jsx)(ai,{success:l,disabled:i,onChange:m}),(0,z.jsxs)(_e,{children:["To continue, please enter the 6-digit code generated from your"," ",(0,z.jsx)("strong",{children:"authenticator app"})]}),n&&(0,z.jsx)(Lc,{pendingTransaction:n})]}),o&&(0,z.jsx)(Bl,{theme:r?.appearance.palette.colorScheme,onClick:o,children:"Choose another method"}),(0,z.jsx)(uo,{onClick:t,children:"Not now"}),(0,z.jsx)(Q,{})]});default:return null}};var hi=require("react"),Uc=f(require("styled-components"));function Dc(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Qe=require("react/jsx-runtime"),Py={google:{name:"Google",component:Ds},discord:{name:"Discord",component:Ls},github:{name:"Github",component:Os},linkedin:{name:"LinkedIn",component:Us},twitter:{name:"Twitter",component:Bs},tiktok:{name:"Tiktok",component:Fs},apple:{name:"Apple",component:Ns}},el=()=>{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"),io.del(vn),window.history.pushState({},"",e)},xy=()=>{let{ready:e,user:t,authenticated:o}=V(),{app:r,setModalData:n,navigate:i,resetNavigation:a}=A(),{getAuthMeta:l,initLoginWithOAuth:s,loginWithOAuth:c,updateWallets:m,setReadyToTrue:g,closePrivyModal:y}=W(),[v,b]=(0,hi.useState)(!1),[E,S]=(0,hi.useState)(void 0),T=l()?.provider||"google",P=Py[T].name,O=Py[T].component,I=r?.render.inDialog?mt:0;(0,hi.useEffect)(()=>{c(T).then(()=>{el(),b(!0)}).catch(M=>{let G={retryable:!1,message:"Authentication failed"};if(M?.privyErrorCode==="allowlist_rejected"){S(void 0),a(),i("ALLOWLIST_REJECTION_SCREEN"),el();return}else M?.privyErrorCode==="linked_to_another_user"?G.detail="This account has already been linked to another user.":M?.privyErrorCode==="invalid_credentials"?(G.retryable=!0,G.detail="Something went wrong. Try again."):M.privyErrorCode==="oauth_user_denied"?(G.detail=`Retry and check ${Dc(T)} to finish connecting your account.`,G.retryable=!0):M?.privyErrorCode==="too_many_requests"?G.detail="Too many requests. Please wait before trying again.":M?.privyErrorCode==="oauth_account_suspended"&&(G.detail=`Your ${P} account is suspended. Please try another login method.`);el(),S(G)}).finally(()=>{g()})},[P,T]),(0,hi.useEffect)(()=>{if(e&&o&&v&&t){if(r?.legal.requireUsersAcceptTerms&&!t.hasAcceptedTerms){let G=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout(G)}if(Gt(t,r?.embeddedWallets?.createOnLogin)){let G=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:Y=>console.error(Y),callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I);return()=>clearTimeout(G)}else{let G=setTimeout(y,I);return m(),()=>clearTimeout(G)}}},[e,o,v,t]);let L=v?`Successfully connected with ${P}`:E?E.message:`Verifying connection to ${P}`,D="";return v?D="You\u2019re good to go!":E?D=E.detail:D="Just a few moments more",(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(_,{}),(0,Qe.jsx)(Z,{}),(0,Qe.jsxs)(fC,{children:[(0,Qe.jsx)(hC,{children:(0,Qe.jsxs)("div",{children:[(0,Qe.jsx)(Pr,{success:v,fail:!!E}),(0,Qe.jsx)(O,{style:{width:"38px",height:"38px"}})]})}),(0,Qe.jsxs)(Yt,{children:[(0,Qe.jsx)("h3",{children:L}),(0,Qe.jsx)("p",{children:D})]}),E&&E?.retryable?(0,Qe.jsx)(os,{onClick:()=>{el(),s(T),S(void 0)},disabled:!v&&!E?.retryable,children:"Retry"}):null]}),(0,Qe.jsx)(te,{}),(0,Qe.jsx)(Q,{})]})},fC=Uc.default.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
|
+
`,hC=Uc.default.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
|
-
`;var
|
|
2195
|
+
`;var Qi=require("react"),Ay=f(require("styled-components"));var Sy=require("react-device-detect");var _y=(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(!yr()&&Sy.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};var vt=require("react/jsx-runtime"),ky=()=>{let{forkSession:e,ready:t,authenticated:o}=V(),[r,n]=(0,Qi.useState)(""),[i,a]=(0,Qi.useState)(!1);(0,Qi.useEffect)(()=>{t&&o&&e().then(n)},[t,o]);let l=_y(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."),(0,vt.jsxs)(vt.Fragment,{children:[(0,vt.jsx)(_,{},"header"),(0,vt.jsx)(Z,{}),(0,vt.jsx)(Mo,{title:s.title,description:s.description}),(0,vt.jsxs)(Wo,{children:[(0,vt.jsx)(yC,{children:(0,vt.jsx)(_o,{style:{width:"72px",height:"72px"}})}),(0,vt.jsx)(ts,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?(0,vt.jsx)("p",{children:s.footnote}):null]}),(0,vt.jsx)(te,{}),(0,vt.jsx)($,{protectedByPrivy:!0})]})},yC=(0,Ay.default)(Kt)`
|
|
2196
2196
|
margin: 16px auto;
|
|
2197
|
-
`;var
|
|
2197
|
+
`;var Ny=require("@ethersproject/bignumber"),Ly=require("@ethersproject/providers"),ze=require("react"),dn=f(require("styled-components"));function Ry(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}var tl=require("@ethersproject/bignumber"),Iy=f(require("styled-components"));var $o=require("react/jsx-runtime"),gC=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let o=tl.BigNumber.from(e.gasUsed),r=tl.BigNumber.from(e.effectiveGasPrice),n=o.mul(r);if(t){let i=tl.BigNumber.from(t);n=n.add(i)}return n.toString()}catch{return}else return},Wy=({txn:e,receipt:t,transactionInfo:o,onClose:r,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a})=>(0,$o.jsxs)($o.Fragment,{children:[(0,$o.jsx)(_,{onClose:r}),(0,$o.jsx)(ki,{title:"Transaction complete!",description:"You're all set."}),(0,$o.jsx)(ci,{tokenPrice:n,from:t.from,to:t.to,gas:gC(t,a),txn:e,transactionInfo:o,tokenSymbol:i}),(0,$o.jsx)(vC,{loading:!1,onClick:r,children:"All Done"}),(0,$o.jsx)(Q,{})]}),vC=(0,Iy.default)(F)`
|
|
2198
2198
|
&& {
|
|
2199
2199
|
margin-top: 24px;
|
|
2200
2200
|
}
|
|
2201
2201
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2202
|
-
`;var me=require("react/jsx-runtime");var
|
|
2202
|
+
`;var me=require("react/jsx-runtime");var wC=({txn:e,txnFamily:t,uiOptions:o,tokenSymbol:r,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(o.transactionInfo?.contractInfo)return(0,me.jsx)(Ac,{contractInfo:o.transactionInfo.contractInfo,description:o.description});if(o.senderInfo)return(0,me.jsx)(Ac,{contractInfo:o.senderInfo,description:o.description||o.senderInfo.actionText})}return(0,me.jsx)(me.Fragment,{children:(0,me.jsx)(ly,{description:o.description||o.transactionInfo?.description||"",txn:e,tokenSymbol:r,tokenPrice:n})})},Oy=()=>{let{authenticated:e,getAccessToken:t}=V(),{wallets:o}=mi(),{walletProxy:r,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s}=W(),{app:c,navigate:m,data:g,onUserCloseViaDialogOrKeybindRef:y,setModalData:v}=A(),{transactionRequest:b,onSuccess:E,onFailure:S,uiOptions:T,fundWalletConfig:P}=g.sendTransaction,[O,I]=(0,ze.useState)(null),[L,D]=(0,ze.useState)(null),[M,G]=(0,ze.useState)(""),[Y,ie]=(0,ze.useState)(),[U,q]=(0,ze.useState)(!1),k=()=>{G(""),ie(void 0)},Ee=(lt,Rt,Ht)=>{G(lt),ie(new ot(new So(Rt??lt,Ht??Tt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[pe,ee]=(0,ze.useState)(!1),[eo,Re]=(0,ze.useState)(!0),[wt,et]=(0,ze.useState)(null),[le,Ko]=(0,ze.useState)(b),{tokenPrice:to,isTokenPriceLoading:un}=Zs(le),Ct=s(b.chainId)||"ETH",[$e,To]=(0,ze.useState)(null),[mn,R]=(0,ze.useState)(null),[st,vi]=(0,ze.useState)(!0);(0,ze.useEffect)(()=>{e||(m("LANDING"),S(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let re=(0,ze.useMemo)(()=>o.find(lt=>lt.walletClientType==="privy"),[o]),oo=async()=>{if(!re)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:lt,externalTransactionId:Rt}=await i(re.address,{config:P?.config||{}});v({fiatOnRampPrompt:{signedUrl:lt},fiatOnRampStatus:{externalTransactionId:Rt}}),m("FIAT_ON_RAMP_PROMPT_SCREEN")},Fr=(0,ze.useMemo)(()=>new Ly.StaticJsonRpcProvider(so(le.chainId,l,a)),[le.chainId,a]);(0,ze.useEffect)(()=>{let lt=()=>{Re(!1),Ee("Wallet has insufficient funds for this transaction."),c?.fiatOnRamp.enabled&&q(!0)};async function Rt(){let Ht=le;if(!await t()||!r||!re)return;try{Ht=await pi(re.address,le,Fr),Ko(Ht)}catch(ro){Xu(ro)?lt():Ee("There was an error preparing your transaction. Please try again.",ro.reason)}let fr=Ny.BigNumber.from(0);try{fr=await Js(Ht,Fr),To(Oe(fr.toBigInt()).toHexString());let ro=await Wc(le,Fr);R(Oe(ro.toBigInt()).toHexString())}catch{To(null)}try{let{balance:ro,hasSufficientFunds:ea}=await hy(re.address,Ht,fr,Fr);et(ro.toHexString()),ea||lt()}catch(ro){console.warn(`Failed to fetch wallet balance with error: ${ro}`)}vi(!1)}Rt()},[r]);let Xi=Ry(le),wi=Xi==="SEND"?`Send ${Ct}`:"Review transaction",mr={modalTitle:T.header||T.modalTitle||wi,buttonText:T.buttonText||"Submit"},fn=()=>{pe||(L?E(L):S(Y||new ot(new So("The user rejected the request",Tt.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return y.current=fn,to===void 0&&un||st?(0,me.jsxs)(me.Fragment,{children:[T.transactionInfo?.contractInfo?.imgUrl&&(0,me.jsx)(_a,{src:T.transactionInfo?.contractInfo?.imgUrl}),(0,me.jsx)(_,{title:mr.modalTitle,onClose:fn}),(0,me.jsx)(My,{children:(0,me.jsx)(zn,{})})]}):O!==null?(0,me.jsx)(Wy,{txn:le,onClose:fn,receipt:O,transactionInfo:T.transactionInfo,tokenPrice:to,tokenSymbol:Ct,l1GasEstimate:mn}):(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(_,{title:mr.modalTitle,onClose:fn}),(0,me.jsxs)(My,{children:[(0,me.jsxs)(TC,{children:[(0,me.jsx)(wC,{txn:le,txnFamily:Xi,uiOptions:T,tokenSymbol:Ct,tokenPrice:to}),re?(0,me.jsx)(ci,{from:re.address,to:le.to,txn:le,transactionInfo:T.transactionInfo,gas:$e||void 0,tokenPrice:to,tokenSymbol:Ct}):null]}),(0,me.jsxs)(PC,{children:[(0,me.jsx)(CC,{children:M}),(0,me.jsx)(ay,{txn:le,address:re?.address??"",hasFunds:eo,balance:wt}),(0,me.jsxs)(bC,{children:[U&&(0,me.jsx)(F,{onClick:oo,children:"Add Funds"}),(0,me.jsx)(EC,{disabled:pe||!eo,loading:!r||pe,loadingText:pe?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{ee(!0);let lt=await t();if(lt&&!pe&&re)try{let Rt=await Ys(lt,re.address,r,le,Fr);D(Rt);let Ht=await Rt.wait();I(Qs(Ht)),k()}catch(Rt){let Ht="There was an error processing your transaction. Please contact support.";console.warn({transaction:le,error:Rt}),Ee(Ht,Rt.reason)}finally{ee(!1)}},children:mr.buttonText})]})]})]})]})},My=dn.default.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
|
+
`,CC=dn.default.div`
|
|
2209
2209
|
font-size: 13px;
|
|
2210
2210
|
color: var(--privy-color-error);
|
|
2211
2211
|
width: 100%;
|
|
2212
2212
|
margin-top: 16px;
|
|
2213
|
-
`,
|
|
2213
|
+
`,bC=dn.default.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
|
+
`,EC=(0,dn.default)(F)`
|
|
2220
2220
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2221
|
-
`,
|
|
2221
|
+
`,TC=dn.default.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
|
+
`,PC=dn.default.div`
|
|
2228
2228
|
display: flex;
|
|
2229
2229
|
flex-direction: column;
|
|
2230
2230
|
gap: 8px;
|
|
2231
|
-
`;var
|
|
2231
|
+
`;var Dy=require("@ethersproject/bytes"),Uy=require("@ethersproject/strings"),Ur=require("react"),bo=f(require("styled-components"));var de=require("react/jsx-runtime"),xC=e=>{if(!(0,Dy.isHexString)(e))return e;try{return(0,Uy.toUtf8String)(e)}catch{return e}},SC=e=>JSON.stringify(e,null,2),_C=({data:e})=>{let t=o=>typeof o=="object"&&o!==null?(0,de.jsx)(WC,{children:Object.entries(o).map(([r,n])=>(0,de.jsxs)("li",{children:[(0,de.jsxs)("strong",{children:[r,":"]})," ",t(n)]},r))}):(0,de.jsx)("span",{children:String(o)});return(0,de.jsx)("div",{children:t(e)})},AC=e=>{let{types:t,primaryType:o,...r}=e.typedData;return(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)(By,{children:(0,de.jsx)(_C,{data:r})}),(0,de.jsx)(Qn,{text:SC(e.typedData),itemName:"full payload to clipboard"})," "]})},Fy=()=>{let{authenticated:e}=V(),{initializeWalletProxy:t,closePrivyModal:o}=W(),{navigate:r,data:n,onUserCloseViaDialogOrKeybindRef:i}=A(),[a,l]=(0,Ur.useState)(!0),[s,c]=(0,Ur.useState)(""),[m,g]=(0,Ur.useState)(),[y,v]=(0,Ur.useState)(null),b=y!==null;(0,Ur.useEffect)(()=>{e||r("LANDING")},[e]),(0,Ur.useEffect)(()=>{t(Cn).then(M=>{l(!1),M||(c("An error has occurred, please try again."),g(new ot(new So(s,Tt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:E,data:S,confirmAndSign:T,onSuccess:P,onFailure:O,uiOptions:I}=n.signMessage,L={title:I.title||"Sign message",description:I.description||"Signing this message will not cost you any fees.",buttonText:I.buttonText||"Sign and continue"},D=M=>{M?P(M):O(m||new ot(new So("The user rejected the request.",Tt.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),v(null),c(""),g(void 0)};return i.current=()=>{D(y)},(0,de.jsxs)(de.Fragment,{children:[(0,de.jsx)(_,{onClose:()=>D(y)}),(0,de.jsx)(Z,{}),(0,de.jsxs)(kC,{children:[(0,de.jsx)(RC,{children:L.title}),(0,de.jsx)(IC,{children:L.description}),E==="personal_sign"&&(0,de.jsx)(By,{children:xC(S)}),E==="eth_signTypedData_v4"&&(0,de.jsx)(AC,{typedData:S}),(0,de.jsx)(MC,{fail:!0,children:s}),(0,de.jsx)(LC,{success:b,loading:a,disabled:b,onClick:async()=>{try{let M=await T();v(M),c(""),setTimeout(()=>{D(M)},mt)}catch{c("An error has occurred, please try again."),g(new ot(new So(s,Tt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:b?(0,de.jsxs)(NC,{children:[(0,de.jsx)(Ts,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",(0,de.jsx)("span",{children:"Success"})]}):L.buttonText})]}),(0,de.jsx)(te,{}),(0,de.jsx)($,{protectedByPrivy:!0})]})},kC=bo.default.div`
|
|
2232
2232
|
display: flex;
|
|
2233
2233
|
flex-direction: column;
|
|
2234
2234
|
align-items: center;
|
|
2235
2235
|
justify-content: center;
|
|
2236
|
-
`,
|
|
2236
|
+
`,RC=bo.default.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
|
+
`,IC=bo.default.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
|
+
`,By=bo.default.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
|
+
`,WC=bo.default.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
|
+
`,MC=bo.default.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
|
+
`,NC=bo.default.span`
|
|
2295
2295
|
display: flex;
|
|
2296
2296
|
align-items: center;
|
|
2297
2297
|
gap: 8px;
|
|
2298
|
-
`,
|
|
2298
|
+
`,LC=(0,bo.default)(F)`
|
|
2299
2299
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2300
2300
|
|
|
2301
|
-
${e=>e.success&&
|
|
2301
|
+
${e=>e.success&&bo.css`
|
|
2302
2302
|
&&&& {
|
|
2303
2303
|
background-color: var(--privy-color-success);
|
|
2304
2304
|
color: #ffffff;
|
|
2305
2305
|
}
|
|
2306
2306
|
`}
|
|
2307
|
-
`;var
|
|
2307
|
+
`;var ol=f(require("styled-components"));var OC=`
|
|
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
|
+
`,Hy=OC;var Gy=ol.createGlobalStyle`
|
|
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
|
+
`,Vy=ol.default.div`
|
|
2570
2570
|
// css normalize only the privy application to avoid conflicts
|
|
2571
2571
|
// with consuming application
|
|
2572
|
-
${
|
|
2572
|
+
${Hy}
|
|
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
|
-
`;var De=require("react/jsx-runtime"),IC={["LANDING"]:yh,["AWAITING_PASSWORDLESS_CODE"]:Eu,["AWAITING_CONNECTION"]:qu,["AWAITING_CONNECT_ONLY_CONNECTION"]:Yu,["AWAITING_FARCASTER_CONNECTION"]:Ef,["PHANTOM_INTERSTITIAL_SCREEN"]:Ay,["LOGIN_FAILED_SCREEN"]:Th,["AWAITING_OAUTH_SCREEN"]:Py,["ALLOWLIST_REJECTION_SCREEN"]:pu,["INSTALL_PHANTOM_SCREEN"]:zf,["LINK_EMAIL_SCREEN"]:vh,["LINK_PHONE_SCREEN"]:Ch,["LINK_WALLET_SCREEN"]:bh,["CONNECT_ONLY_LANDING_SCREEN"]:Vu,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Du,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Ym,["EMBEDDED_WALLET_CREATED_SCREEN"]:im,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:om,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:of,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:dm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Uy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Ly,["FIAT_ON_RAMP_PROMPT_SCREEN"]:If,["FIAT_ON_RAMP_STATUS_SCREEN"]:Of,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:ef,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Jm,["MFA_ENROLLMENT_FLOW_SCREEN"]:Bh,["CAPTCHA_SCREEN"]:Ru,["ERROR_SCREEN"]:af,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Ff,["AFFIRMATIVE_CONSENT_SCREEN"]:cu},WC=["LANDING","AWAITING_CONNECTION"],MC=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:o,isModalOpen:r}=G(),{headless:n}=I(),{ready:i,currentScreen:a}=A(),{status:l,execute:s,reset:c,enabled:m}=_e(),g=(0,dr.useRef)(null),y=Kp(g),v=r&&a&&WC.includes(a)&&!n&&l==="ready";if((0,dr.useEffect)(()=>{v&&s()},[v]),(0,dr.useEffect)(()=>{!r&&m&&c()},[r,m]),(!o||!i)&&a!=="AWAITING_OAUTH_SCREEN")return(0,De.jsxs)(ni,{children:[(0,De.jsx)(_,{}),(0,De.jsx)(Q,{}),(0,De.jsx)(xh,{children:(0,De.jsx)(qt,{})}),(0,De.jsx)(ee,{}),(0,De.jsx)(J,{})]});if(!a&&e)return(0,De.jsx)(ni,{style:{height:y},children:(0,De.jsx)("div",{ref:g,children:(0,De.jsx)(Lc,{open:e,onClose:t})})});if(!a)return null;let b=IC[a];return(0,De.jsx)(ni,{style:{height:y},children:(0,De.jsxs)("div",{ref:g,children:[(0,De.jsx)(er,{if:!!e,children:(0,De.jsx)(b,{})}),(0,De.jsx)(er,{if:!e,children:(0,De.jsx)(Lc,{open:e,onClose:t})})]})})},NC=()=>{let{closePrivyModal:e}=I(),{onUserCloseViaDialogOrKeybindRef:t}=A();return{gracefulClosePrivyModal:(0,dr.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},zy=({open:e})=>{let{app:t}=A(),{gracefulClosePrivyModal:o}=NC(),[r,n]=(0,dr.useState)(!1);Qa({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=(0,De.jsx)(Gy,{children:(0,De.jsx)(MC,{isMfaVerifying:r,onMfaVerificationComplete:()=>n(!1)})}),a=e||r,l=t?.render.inDialog?(0,De.jsx)(Ph,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>o(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return Vy.default.createPortal(l,s)}return l};var rl=require("react");var ol=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 dn(e,t,o,r,n,i=!1){let a=i,l=async m=>{if(a&&t&&t.length>0){m===(i?0:1)?n("configureMfa","onMfaRequired",t):r.current?.reject(new Ge("missing_or_invalid_mfa","MFA verification failed, retry."));let g=await new Promise((y,v)=>{o.current={resolve:y,reject:v};let b=1e3*60*5;setTimeout(()=>{let E=new Ge("mfa_timeout","Timed out waiting for MFA code");r.current?.reject(E),v(E)},b)});return await e(g)}return await e()},s=4,c=null;for(let m=0;m<s;m++)try{c=await l(m),r.current?.resolve(void 0);break}catch(g){if(g.type==="missing_or_invalid_mfa")a=!0;else throw r.current?.resolve(void 0),g}if(c===null){let m=new Ge("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw r.current?.reject(m),m}return c}var qy=require("react/jsx-runtime"),LC=function(e){return()=>`id-${e++}`}(0);function OC(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function $o(e){return e.error!==void 0}var bo=new ol,Uc=new Map,DC=(e,t)=>typeof t=="bigint"?t.toString():t,UC=(e,t)=>`${e}${JSON.stringify(t,DC)}`;function qo(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=UC(e,t);if(e==="privy:wallet:create"){let a=Uc.get(n);if(a)return a}let i=new Promise((a,l)=>{let s=LC();bo.enqueue(s,{resolve:a,reject:l}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{Uc.delete(n)});return Uc.set(n,i),i}function FC(e){switch(e.event){case"privy:iframe:ready":let t=bo.dequeue(e.event,e.id);return $o(e)?t.reject(new Ge(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=bo.dequeue(e.event,e.id);return $o(e)?o.reject(new Ge(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=bo.dequeue(e.event,e.id);return $o(e)?r.reject(new Ge(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=bo.dequeue(e.event,e.id);return $o(e)?n.reject(new Ge(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=bo.dequeue(e.event,e.id);return $o(e)?i.reject(new Ge(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=bo.dequeue(e.event,e.id);return $o(e)?a.reject(new Ge(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=bo.dequeue(e.event,e.id);return $o(e)?l.reject(new Ge(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=bo.dequeue(e.event,e.id);return $o(e)?s.reject(new Ge(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=bo.dequeue(e.event,e.id);return $o(e)?s.reject(new Ge(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=bo.dequeue(e.event,e.id);return $o(e)?s.reject(new Ge(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function $y(e){let t=(0,rl.useRef)(null),o=Qp();return(0,rl.useEffect)(()=>{let r=t.current;if(!r)return;function n(c){c&&c.origin===e.origin&&OC(c.data)&&FC(c.data)}let i={create(c){return qo("privy:wallet:create",c,r)},connect(c){return qo("privy:wallet:connect",c,r)},recover(c){return dn(m=>qo("privy:wallet:recover",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(c){return dn(m=>qo("privy:wallet:rpc",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(c){return dn(m=>qo("privy:wallet:set-recovery-password",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(c){return dn(m=>qo("privy:mfa:verify",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(c){return dn(m=>qo("privy:mfa:init-enrollment",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(c){return qo("privy:mfa:submit-enrollment",c,r)},unenrollMfa(c){return dn(m=>qo("privy:mfa:unenroll",{...c,...m},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 zd(()=>qo("privy:iframe:ready",{},r),{abortSignal:s.signal}).then(a,l),()=>{window.removeEventListener("message",n),s.abort()}},[t.current,e.mfaMethods]),(0,qy.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:ha(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Fc(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(r=>t.includes(r))}var nl=class{constructor(t,o){this.meta={action:t,phoneNumber:o}}async init(){if(!this.meta.action)throw new C("action required");if(!this.api)throw new C("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new C("phone number must be set when initialzing authentication.");try{let t=bd();await this.api.post(t,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw fe(t)}}async authenticate(){if(!this.meta.action)throw new C("action required");if(!this.api)throw new C("Mfa flow has no API instance");if(!this.meta.smsCode)throw new C("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new C("phone number must be set prior to calling authenticate.");try{let t=Ed(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return It(o)}catch(t){throw fe(t)}}};var At=require("react/jsx-runtime"),hi;function BC(e){return typeof e=="string"&&e.length===25}function $e(){if(!hi){let e=ce.get(Br);return Promise.resolve(e||null)}return hi.getAccessToken()}var Ky,Jd=(e,t)=>Ky(e,t),Yy,Qd=(e,t)=>Yy(e,t),Jy,Zd=(e,t)=>Jy(e,t),Qy,Xd=()=>Qy(),HC=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;ce.put(Ci,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},Zy=({config:e,...t})=>{if(!BC(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");hi||(hi=new Mn({appId:t.appId,apiUrl:t.apiUrl||la}));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."),(0,At.jsx)(Ep,{client:hi,clientConfig:o,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,At.jsx)(GC,{...t,config:o,client:hi})})},GC=e=>{let t=e.client,[o,r]=(0,j.useState)(!1),[n,i]=(0,j.useState)(!1),[a,l]=(0,j.useState)(!1),[s,c]=(0,j.useState)(null),[m,g]=(0,j.useState)(!1),[y,v]=(0,j.useState)([]),b=(0,j.useRef)(y),[E,S]=(0,j.useState)(!1),[T,P]=(0,j.useState)(null),[L,R]=(0,j.useState)(!1),[N,O]=(0,j.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:x}),[W,H]=(0,j.useState)(null),[K,ne]=(0,j.useState)(null),[D,$]=(0,j.useState)(null),k=Ba(),be=Tp(),[pe,X]=(0,j.useState)(!0),[eo,ke]=(0,j.useState)({}),[yt,Xe]=(0,j.useState)(null),[le,jo]=(0,j.useState)(null),[to,pn]=(0,j.useState)(!1),[gt,ze]=(0,j.useState)(!1),Eo=(0,j.useRef)(null),un=(0,j.useRef)(null),F=(0,j.useRef)(Yp);t.onStoreToken=d=>{d&&ie(F,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{ie(F,"accessToken","onAccessTokenRemoved")};let at=(0,j.useRef)(),gi=(0,j.useCallback)(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]),oe=d=>{P(d),setTimeout(()=>{r(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:d})},oo=d=>{k.embeddedWallets.createOnLogin!=="off"&&X(!0),oe(d)};(0,j.useEffect)(()=>{if(!D||!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s?.linkedAccounts.filter(p=>p.type==="wallet"&&p.walletClientType==="privy");if(d&&d.length>0){let p=d[0].address;t.connectors?.addEmbeddedWalletConnector(D,p,k.defaultChain)}},[D,s]),(0,j.useEffect)(()=>{D&&le?.(D)},[D]),(0,j.useEffect)(()=>{(async()=>{if(!k.customAuth?.enabled)return;X(!0);let{getCustomAccessToken:p,isLoading:h}=k.customAuth;if(!(!n||h))try{let w=await p();if(!w){await fn.logout();return}if(a)return;t.startAuthFlow(new yn(w));let{user:M,isNewUser:q}=await t.authenticate();M||await fn.logout(),c(M||null),S(q||!1),l(!0),ze(!0)}catch(w){console.warn(w),a&&await fn.logout()}})()},[k.customAuth?.enabled,k.customAuth?.getCustomAccessToken,k.customAuth?.isLoading,n,a]),(0,j.useEffect)(()=>{gt&&D&&s&&Gt(s,e.config?.embeddedWallets?.createOnLogin)&&(ze(!1),Xi(s,wn).catch(console.error))},[gt&&D&&s]),(0,j.useEffect)(()=>{async function d(){let p=Ur();HC();let h=(0,jy.createStore)();H(h),t.initializeConnectorManager(k.walletConnectCloudProjectId,k.rpcConfig,k.chains,k.defaultChain,h,k.appearance.walletList,k.shouldEnforceDefaultChainOnConnect),t.connectors?.initialize().then(()=>{mn()});let w=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!w),w&&ie(F,"login","onComplete",w,!1,!0,null),c(w)),p||Re.setReadyToTrue(),p&&w&&g(!0)}n||d()},[t,yt,n]);let Ur=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),h=d.get("privy_oauth_state"),w=d.get("privy_oauth_provider");return p&&h&&w?(t.startAuthFlow(new fr(w,p,h)),oo("AWAITING_OAUTH_SCREEN"),!0):!1},Zi=async(d,p,h,w)=>{let M=await t.connectors?.createWalletConnector(d,p)||null;vi(M,p,h,w)};async function vi(d,p,h,w){if(!d)return O({status:"disconnected",connectedWallet:null,connectError:new Y("Unable to connect to wallet."),connector:null,connectRetry:x}),w?.(null,h);d instanceof Ao&&p&&await d.resetConnection(p),O({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>vi(d,p,h,w)});try{let M=await d.connect({showPrompt:!0});if(k.shouldEnforceDefaultChainOnConnect&&!k.chains.find(q=>q.id===Number(M?.chainId))&&!(M?.connectorType==="wallet_connect_v2"&&M?.walletClientType==="metamask")){O(q=>({...q,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:x}));try{await M?.switchChain(k.defaultChain.id),M&&(M.chainId=Cn(zr(k.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${k.defaultChain.id}`)}}return O(q=>({...q,status:"connected",connectedWallet:M,connectError:null,connectRetry:x})),M&&!L&&ie(F,"connectWallet","onSuccess",M),w?.(M,h)}catch(M){return M instanceof et?(console.warn(M.cause?M.cause:M.message),L||ie(F,"connectWallet","onError",M.privyErrorCode||"generic_connect_wallet_error")):(console.warn(M),L||ie(F,"connectWallet","onError","unknown_connect_wallet_error")),O(q=>({...q,status:"disconnected",connectedWallet:null,connectError:M})),w?.(null,h)}}let pr=async(d,p)=>{if(d===null)return;let h=new Gr(d,p);t.startAuthFlow(h)},mn=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),h=d.get("privy_wallet_client");if(!p||!h)return;if(h==="phantom"&&!hr()&&oo("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");oe("AWAITING_CONNECTION");let w=new URL(window.location.href);w.searchParams.delete("privy_connector"),w.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",w),Zi(p,h,void 0,pr)};(0,j.useEffect)(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let st=()=>{if(!a)throw new C("User must be authenticated before linking a wallet.");g(!0),oe("LINK_WALLET_SCREEN")},kt=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},Bt=async d=>{if(!t.connectors)throw new C("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(O(h=>({...h,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:x})),k.captchaEnabled&&!a){let h={callback:w=>pr(d,w),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ke({captchaModalData:h}),oo("CAPTCHA_SCREEN")}else await pr(d),oo("AWAITING_CONNECTION")},il=async(d,p)=>{if(!k.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:h,externalTransactionId:w}=await kf(t,d,p?.config??{},k.appearance.palette,k.fiatOnRamp.useSandbox);return{signedUrl:h,externalTransactionId:w}}else throw new C("Unsupported fund provider. Currently supported option is `moonpay`.")},ur=()=>{v(d=>{let p=t.connectors?.wallets.map(h=>({...h,linked:kt(h),loginOrLink:async()=>{if(!await h.isConnected())throw new C("Wallet is not connected");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");Bt(h)},fund:async w=>{let{signedUrl:M,externalTransactionId:q}=await il(h.address,w);ke({fiatOnRampPrompt:{signedUrl:M},fiatOnRampStatus:{externalTransactionId:q}}),oe("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new C("User is not authenticated.");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let w=await t.unlinkWallet(h.address);c(w)}}))||[];return pn(gi(p)),va(d,p)?d:p})};(0,j.useEffect)(()=>{ur()},[s?.linkedAccounts,a,n]),(0,j.useEffect)(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");ur(),t.connectors.on("walletsUpdated",ur)}},[n]);let ro=()=>{oe(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,j.useEffect)(()=>{if(!y[0])return;let d=y[0],p=b.current.find(w=>w.address===d.address),h;if(d.walletClientType==="privy"?h=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===d.address&&w.walletClientType==="privy"):h=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===d.address&&w.walletClientType!=="privy"),!p&&h){let w=Object.assign({},s);w.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType},c(w)}b.current=y},[y]);let Xi=async(d,p)=>{if(xe(d))throw ie(F,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[w,M]=await Promise.all([Re.initializeWalletProxy(p),$e()]);if(!w&&e.config?.customAuth?.enabled)throw ie(F,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!w||!M||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((q,Te)=>{X(!0),ke({createWallet:{onSuccess:wt=>{ie(F,"createWallet","onSuccess",wt),q(wt)},onFailure:wt=>{ie(F,"createWallet","onError","unknown_embedded_wallet_error"),Te(wt)},callAuthOnSuccessOnClose:!1}}),oe("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await w.create({accessToken:M});let q=await Re.refreshUser(),Te=xe(q);if(!Te)throw ie(F,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return ie(F,"createWallet","onSuccess",Te),Te}},yg=d=>{if(!k.chains.map(p=>p.id).includes(d))throw new Y(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Gc=(d,p,h)=>new Promise(async(w,M)=>{if(!a||!s){M(new Error("User must be authenticated before signing with a Privy wallet"));return}let q=xe(s);if(!q){M(new Error("Must have a Privy wallet before signing"));return}X(!0);let Te=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,vt=d.chainId?Number(d.chainId):Te.chainId;yg(vt);let wt=Object.assign({},d,{chainId:vt}),Ko=async()=>{let Ht=await $e();if(!Ht||!D){M(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Re.recoverEmbeddedWallet()){M(new Error("Unable to connect to wallet"));return}let $c=new yi.StaticJsonRpcProvider(ao(wt.chainId,k.chains,k.rpcConfig)),vg=await di(q.address,wt,$c),wg=await Ks(Ht,q.address,D,vg,$c);w(wg)}catch(mr){M(mr)}};if(k.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Ko();else{let Ht={transactionRequest:wt,onSuccess:w,onFailure:M,uiOptions:p||{},fundWalletConfig:h},mr={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:M};ke({connectWallet:mr,sendTransaction:Ht}),oe("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Vc(){return new Promise(async(d,p)=>{let h=await $e();if(!h||!D)throw new Error("Must have valid access token to enroll in MFA");try{await D.verifyMfa({accessToken:h}),d()}catch(w){p(w)}})}let fn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:ro,linkWallet:st,linkEmail:()=>{if(!a)throw new C("User must be authenticated before linking an email address.");if(s?.email)throw new C("User already has an email linked to their account.");g(!0),oe("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(!a)throw new C("User must be authenticated before linking a phone number.");if(s?.phone)throw new C("User already has a phone number linked to their account.");g(!0),oe("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(!a)throw new C("User must be authenticated before linking a Google account.");if(s?.google)throw new C("User already has a Google account linked to their account.");await Re.initLoginWithOAuth("google")},linkTwitter:async()=>{if(!a)throw new C("User must be authenticated before linking a Twitter account.");if(s?.twitter)throw new C("User already has a Twitter account linked to their account.");await Re.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(!a)throw new C("User must be authenticated before linking a Discord account.");if(s?.discord)throw new C("User already has a Discord account linked to their account.");await Re.initLoginWithOAuth("discord")},linkGithub:async()=>{if(!a)throw new C("User must be authenticated before linking a GitHub account.");if(s?.github)throw new C("User already has a Github account linked to their account.");await Re.initLoginWithOAuth("github")},linkTiktok:async()=>{if(!a)throw new C("User must be authenticated before linking a TikTok account.");if(s?.tiktok)throw new C("User already has a Tiktok account linked to their account.");await Re.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(!a)throw new C("User must be authenticated before linking a LinkedIn account.");if(s?.linkedin)throw new C("User already has a LinkedIn account linked to their account.");await Re.initLoginWithOAuth("linkedin")},linkApple:async()=>{if(!a)throw new C("User must be authenticated before linking an Apple account.");await Re.initLoginWithOAuth("apple")},linkFarcaster:async()=>{if(!a)throw new C("User must be authenticated before linking a Farcaster account.");await Re.initLoginWithFarcaster(),g(!0),oe("AWAITING_FARCASTER_CONNECTION")},login:async()=>{if(n||(await new Promise(d=>{Xe(()=>d)}),Xe(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}R(!0),oo("LANDING")},logout:async()=>{await t.logout(),c(null),l(!1),P(null),ie(F,"logout","onSuccess"),g(!1),r(!1),ce.del(bi)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Pe;let d=y.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(w=>w.address===d?.address));return!d||!p?new Pe:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new yi.Web3Provider(new lo(new Pe));let d=y.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(w=>w.address===d?.address));return!d||!p?new yi.Web3Provider(new lo(new Pe)):new yi.Web3Provider(new lo(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new vr(new Pe);let d=y.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(w=>w.address===d?.address));return!d||!p?new vr(new Pe):new vr(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=y.find(w=>(0,Qi.getAddress)(w.address)===(0,Qi.getAddress)(d)),h=s?.linkedAccounts.find(w=>w.type==="wallet"&&(0,Qi.getAddress)(w.address)===(0,Qi.getAddress)(d));if(!p||!await p.isConnected())ne(d),st();else if(!p.linked)p.loginOrLink();else{let w=Object.assign({},s);w.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType},c(w)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw ie(F,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return Xi(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw ie(F,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=xe(s);if(!d||!D)throw ie(F,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw ie(F,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await Vc()}catch(p){throw ie(F,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,h)=>{X(!0);let w={onSuccess:q=>{ie(F,"setWalletPassword","onSuccess",q),p(q)},onFailure:q=>{ie(F,"setWalletPassword","onError","user_exited_set_password_flow"),h(q)},callAuthOnSuccessOnClose:!1},M={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:q=>{ie(F,"setWalletPassword","onError","unknown_connect_wallet_error"),h(q)}};ke({setWalletPassword:w,connectWallet:M}),oe("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(h,w)=>{if(!a||!s){w(new Error("User must be authenticated before signing with a Privy wallet"));return}let M=xe(s);if(!M){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}X(!0);let q=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Te=await $e();if(!D||!Te)throw new Error("Unable to connect to wallet");if(!await Re.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:M.address});let{response:wt}=await D.rpc({accessToken:Te,address:M.address,request:{method:"personal_sign",params:[d,M.address]}}),Ko=wt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:M.address}),Ko};if(k.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Te=await q();h(Te)}catch(Te){w(Te??new tt("Unable to sign message"))}}else{let wt={method:"personal_sign",data:d,confirmAndSign:q,onSuccess:Ht=>{h(Ht)},onFailure:Ht=>{w(Ht)},uiOptions:p||{}},Ko={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:w};ke({signMessage:wt,connectWallet:Ko}),oe("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(h,w)=>{if(!a||!s){w(new Error("User must be authenticated before signing with a Privy wallet"));return}let M=xe(s);if(!M){w(new Error("Must have a Privy wallet before signing"));return}X(!0);let q=ya(d),Te=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let vt=await $e();if(!D||!vt)throw new Error("Unable to connect to wallet");if(!await Re.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:M.address});let{response:Ko}=await D.rpc({accessToken:vt,address:M.address,request:{method:"eth_signTypedData_v4",params:[M.address,q]}}),Ht=Ko.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:M.address}),Ht};if(k.embeddedWallets.noPromptOnSignature||(k.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let vt=await Te();h(vt)}catch(vt){w(vt??new tt("Unable to sign message"))}}else{let Ko={method:"eth_signTypedData_v4",data:q,confirmAndSign:Te,onSuccess:mr=>{h(mr)},onFailure:mr=>{w(mr)},uiOptions:p||{}},Ht={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:w};ke({signMessage:Ko,connectWallet:Ht}),oe("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,h)=>{let M=await(await Gc(d,p,h)).wait();return Js(M)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let h=xe(s);if(!h){p(new Error("Must have a Privy wallet before exporting"));return}X(!0);let w={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},M=await $e();if(!M||!D){p(new Error("Must have valid access token to enroll in MFA"));return}if(!D){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await D.connect({accessToken:M,address:h.address}),await D.verifyMfa({accessToken:M})}catch(Te){if(jr(Te))await Re.recoverEmbeddedWallet();else throw Te}}catch(Te){p(Te);return}let q={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};ke({keyExport:q,connectWallet:w}),oe("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Vc,async init(d){let p;switch(d){case"sms":p=new nl("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":Eo.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((h,w)=>{un.current={resolve:h,reject:w}});break;default:throw Eo.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${d}`)}},cancel(){Eo.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(d){let p=await $e();if(!p||!D)throw new Error("Must have valid access token to enroll in MFA");await D.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,h)=>{if(!d){Re.closePrivyModal(),p();return}k.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."),ke({mfaEnrollmentFlow:{mfaMethods:k.mfa.methods,onSuccess:p,onFailure:h}}),oe("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await $e();if(!d||!D)throw new Error("Must have valid access token to enroll in MFA");let p=await D.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await $e();if(!p||!D)throw new Error("Must have valid access token to enroll in MFA");await D.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async submitEnrollmentWithTotp(d){let p=await $e();if(!p||!D)throw new Error("Must have valid access token to enroll in MFA");await D.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async unenroll(d){let p=await $e();if(!p||!D)throw new Error("Must have valid access token to remove MFA");await D.unenrollMfa({method:d,accessToken:p});let h=await t.getAuthenticatedUser();c(h)},loginWithCode(d){return Re.loginWithCode(d)},initLoginWithEmail(d){return Re.initLoginWithEmail(d)},initLoginWithSms(d){return Re.initLoginWithSms(d)},isModalOpen:o};Ky=fn.signMessage,Yy=fn.signTypedData,Jy=async(...d)=>{let p=await Gc(...d);return k.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let zc=!!e.config?.headless,Re=(()=>({headless:zc,isNewUserThisSession:E,isLinking:m,linkingHint:K,pendingTransaction:null,walletConnectionStatus:N,mipdStore:W,connectors:t.connectors?.walletConnectors??[],rpcConfig:k.rpcConfig,chains:k.chains,showFiatPrices:k.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>k.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(D)return D;let p=new Promise(M=>{jo(()=>q=>M(q))}),h=new Promise(M=>setTimeout(()=>M(null),d)),w=await Promise.race([p,h]);return jo(null),w},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(ie(F,"login","onComplete",s,E,!1,at.current??null),e.onSuccess?.(s,E)):L&&ie(F,"login","onError","exited_auth_flow"),ne(null),R(!1),g(!1),S(!1),r(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:oe,connectWallet:vi,initLoginWithWallet:async(d,p)=>{at.current="siwe",pr(d,p)},loginWithWallet:async()=>{if(!n)throw new hn;if(!(t.authFlow instanceof Gr))throw new C("Must initialize SIWE flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(h){throw ie(F,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||s||null),S(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new wi(d);t.startAuthFlow(p);try{at.current="farcaster",await p.initializeFarcasterConnect()}catch(h){throw ie(F,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},loginWithFarcaster:async()=>{if(!n)throw new hn;if(!(t.authFlow instanceof wi))throw new C("Must initialize Farcaster flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(h){throw ie(F,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||null),S(p||!1),l(!0)},initLoginWithOAuth:async(d,p)=>{if(Ud()){if(d==="google"&&Fc(window.navigator.userAgent)){oo("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{oo("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let h=new fr(d);p&&h.addCaptchaToken(p),t.startAuthFlow(h);let w=await t.authFlow.getAuthorizationUrl();w&&w.url&&window.location.assign(w.url)},loginWithOAuth:async d=>{if(!(t.authFlow instanceof fr))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let p=no.get(gn),h=t.authFlow.meta.stateCode;if(p!==h)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d,storedStateCode:p??"",returnedStateCode:h??""}),new C("Unexpected auth flow. This may be a phishing attempt.");let w,M;if(a)w=await t.link();else try{({user:w,isNewUser:M}=await t.authenticate()),at.current=d}catch(q){throw ie(F,"login","onError",q.privyErrorCode||"unknown_auth_error"),q}c(w),S(M||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let h=new Fr(d,p);t.startAuthFlow(h);try{at.current="email",await h.sendCodeEmail()}catch(w){throw ie(F,"login","onError",w.privyErrorCode||"unknown_auth_error"),w}},initLoginWithSms:async(d,p)=>{let h=new Vr(d,p);t.startAuthFlow(h);try{at.current="sms",await h.sendSmsCode()}catch(w){throw ie(F,"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 hn;if(t.authFlow instanceof Fr)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Vr)t.authFlow.meta.smsCode=d.trim();else throw new C("Must initialize a passwordless code flow first");let p,h;a?p=await t.link():{user:p,isNewUser:h}=await t.authenticate(),c(p||s||null),S(h||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:D,createAnalyticsEvent:(d,p,h)=>t.createAnalyticsEvent(d,p,h),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let h=s?.linkedAccounts.find(M=>M.type==="wallet"&&M.walletClientType==="privy"),w=await $e();if(!w||!D||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}X(!0);try{await D.connect({accessToken:w,address:h.address}),d(!0)}catch(M){jr(M)&&h.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:h.address}),(await D.recover({address:h.address,accessToken:w})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:h.address}),d(!0)):jr(M)?(ke({recoverWallet:{privyWallet:h,onFailure:p,onSuccess:()=>d(!0)}}),oe("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(M)}}),getFiatOnRampConfig:il,setReadyToTrue:()=>{i(!0),yt?.()},updateWallets:()=>ur()}))();Qy=Re.recoverEmbeddedWallet;let gg=(0,j.useMemo)(()=>({wallets:y,ready:to}),[y,to]);return(0,At.jsx)(Ie.Provider,{value:fn,children:(0,At.jsx)(Il.Provider,{value:F,children:(0,At.jsx)(Wc.Provider,{value:gg,children:(0,At.jsxs)($p,{...k,children:[e.children,(0,At.jsxs)(Rl.Provider,{value:Re,children:[!zc&&k.captchaEnabled&&n&&!a&&(0,At.jsx)(ja,{delayedExecution:!1}),(0,At.jsx)(Hy,{theme:{...k.appearance.palette||{}}}),(0,At.jsx)(Sp,{data:eo,setModalData:ke,setInitialScreen:P,initialScreen:T,authenticated:a,open:o,children:(0,At.jsx)(zy,{open:o})}),pe&&be?(0,At.jsx)($y,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:Eo,mfaSubmitPromise:un,onLoad:$,onLoadFailed:()=>null}):null]})]})})})})};var Xy=require("react");function eg(e){let{login:t}=(0,Xy.useContext)(Ie);return Et("login",e),{login:t}}var tg=require("react");function og(e){let{logout:t}=(0,tg.useContext)(Ie);return Et("logout",e),{logout:t}}var Bc=require("react");var rg=()=>{let e=_e(),{initLoginWithEmail:t,loginWithCode:o}=G(),r=(0,Bc.useCallback)(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return e.status==="disabled",t(i)},[t]),n=(0,Bc.useCallback)(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Zo(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};var Hc=require("react");var ng=()=>{let e=_e(),{initLoginWithSms:t,loginWithCode:o}=G(),r=(0,Hc.useCallback)(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return e.status==="disabled",t(i)},[t]),n=(0,Hc.useCallback)(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Zo(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};var ig=require("react");function ag(e){let{connectWallet:t}=(0,ig.useContext)(Ie);return Et("connectWallet",e),{connectWallet:t}}var sg=require("react");function lg(e){let{createWallet:t}=(0,sg.useContext)(Ie);return Et("createWallet",e),{createWallet:t}}var cg=require("react");function dg(e){let{setWalletPassword:t}=(0,cg.useContext)(Ie);return Et("setWalletPassword",e),{setWalletPassword:t}}var pg=require("react");var ug=()=>{let{isModalOpen:e}=(0,pg.useContext)(Ie);return{isOpen:e}};var mg=require("react");function fg(e){let{getAccessToken:t}=(0,mg.useContext)(Ie);return Et("accessToken",e),{getAccessToken:t}}function hg(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useLogin,useLoginWithEmail,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useSetWalletPassword,useToken,useWallets});
|
|
2631
|
+
`;var De=require("react/jsx-runtime"),DC={["LANDING"]:gh,["AWAITING_PASSWORDLESS_CODE"]:Tu,["AWAITING_CONNECTION"]:ju,["AWAITING_CONNECT_ONLY_CONNECTION"]:Ju,["AWAITING_FARCASTER_CONNECTION"]:Tf,["PHANTOM_INTERSTITIAL_SCREEN"]:ky,["LOGIN_FAILED_SCREEN"]:Ph,["AWAITING_OAUTH_SCREEN"]:xy,["ALLOWLIST_REJECTION_SCREEN"]:uu,["INSTALL_PHANTOM_SCREEN"]:$f,["LINK_EMAIL_SCREEN"]:wh,["LINK_PHONE_SCREEN"]:bh,["LINK_WALLET_SCREEN"]:Eh,["CONNECT_ONLY_LANDING_SCREEN"]:zu,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Uu,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Jm,["EMBEDDED_WALLET_CREATED_SCREEN"]:am,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:rm,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:rf,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:pm,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:Fy,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Oy,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Wf,["FIAT_ON_RAMP_STATUS_SCREEN"]:Df,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:tf,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Qm,["MFA_ENROLLMENT_FLOW_SCREEN"]:Hh,["CAPTCHA_SCREEN"]:Iu,["ERROR_SCREEN"]:sf,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Bf,["AFFIRMATIVE_CONSENT_SCREEN"]:du},UC=["LANDING","AWAITING_CONNECTION"],FC=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:o,isModalOpen:r}=V(),{headless:n}=W(),{ready:i,currentScreen:a}=A(),{status:l,execute:s,reset:c,enabled:m}=Ae(),g=(0,ur.useRef)(null),y=Yp(g),v=r&&a&&UC.includes(a)&&!n&&l==="ready";if((0,ur.useEffect)(()=>{v&&s()},[v]),(0,ur.useEffect)(()=>{!r&&m&&c()},[r,m]),(!o||!i)&&a!=="AWAITING_OAUTH_SCREEN")return(0,De.jsxs)(ii,{children:[(0,De.jsx)(_,{}),(0,De.jsx)(Z,{}),(0,De.jsx)(Sh,{children:(0,De.jsx)(qt,{})}),(0,De.jsx)(te,{}),(0,De.jsx)(Q,{})]});if(!a&&e)return(0,De.jsx)(ii,{style:{height:y},children:(0,De.jsx)("div",{ref:g,children:(0,De.jsx)(Oc,{open:e,onClose:t})})});if(!a)return null;let b=DC[a];return(0,De.jsx)(ii,{style:{height:y},children:(0,De.jsxs)("div",{ref:g,children:[(0,De.jsx)(or,{if:!!e,children:(0,De.jsx)(b,{})}),(0,De.jsx)(or,{if:!e,children:(0,De.jsx)(Oc,{open:e,onClose:t})})]})})},BC=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=A();return{gracefulClosePrivyModal:(0,ur.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},$y=({open:e})=>{let{app:t}=A(),{gracefulClosePrivyModal:o}=BC(),[r,n]=(0,ur.useState)(!1);Za({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=(0,De.jsx)(Vy,{children:(0,De.jsx)(FC,{isMfaVerifying:r,onMfaVerificationComplete:()=>n(!1)})}),a=e||r,l=t?.render.inDialog?(0,De.jsx)(xh,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>o(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return zy.default.createPortal(l,s)}return l};var nl=require("react");var rl=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 pn(e,t,o,r,n,i=!1){let a=i,l=async m=>{if(a&&t&&t.length>0){m===(i?0:1)?n("configureMfa","onMfaRequired",t):r.current?.reject(new Ve("missing_or_invalid_mfa","MFA verification failed, retry."));let g=await new Promise((y,v)=>{o.current={resolve:y,reject:v};let b=1e3*60*5;setTimeout(()=>{let E=new Ve("mfa_timeout","Timed out waiting for MFA code");r.current?.reject(E),v(E)},b)});return await e(g)}return await e()},s=4,c=null;for(let m=0;m<s;m++)try{c=await l(m),r.current?.resolve(void 0);break}catch(g){if(g.type==="missing_or_invalid_mfa")a=!0;else throw r.current?.resolve(void 0),g}if(c===null){let m=new Ve("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw r.current?.reject(m),m}return c}var jy=require("react/jsx-runtime"),HC=function(e){return()=>`id-${e++}`}(0);function GC(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function qo(e){return e.error!==void 0}var Eo=new rl,Fc=new Map,VC=(e,t)=>typeof t=="bigint"?t.toString():t,zC=(e,t)=>`${e}${JSON.stringify(t,VC)}`;function jo(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=zC(e,t);if(e==="privy:wallet:create"){let a=Fc.get(n);if(a)return a}let i=new Promise((a,l)=>{let s=HC();Eo.enqueue(s,{resolve:a,reject:l}),r.postMessage({id:s,event:e,data:t},"*")}).finally(()=>{Fc.delete(n)});return Fc.set(n,i),i}function $C(e){switch(e.event){case"privy:iframe:ready":let t=Eo.dequeue(e.event,e.id);return qo(e)?t.reject(new Ve(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Eo.dequeue(e.event,e.id);return qo(e)?o.reject(new Ve(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Eo.dequeue(e.event,e.id);return qo(e)?r.reject(new Ve(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Eo.dequeue(e.event,e.id);return qo(e)?n.reject(new Ve(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Eo.dequeue(e.event,e.id);return qo(e)?i.reject(new Ve(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=Eo.dequeue(e.event,e.id);return qo(e)?a.reject(new Ve(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=Eo.dequeue(e.event,e.id);return qo(e)?l.reject(new Ve(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=Eo.dequeue(e.event,e.id);return qo(e)?s.reject(new Ve(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=Eo.dequeue(e.event,e.id);return qo(e)?s.reject(new Ve(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=Eo.dequeue(e.event,e.id);return qo(e)?s.reject(new Ve(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function qy(e){let t=(0,nl.useRef)(null),o=Zp();return(0,nl.useEffect)(()=>{let r=t.current;if(!r)return;function n(c){c&&c.origin===e.origin&&GC(c.data)&&$C(c.data)}let i={create(c){return jo("privy:wallet:create",c,r)},connect(c){return jo("privy:wallet:connect",c,r)},recover(c){return pn(m=>jo("privy:wallet:recover",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(c){return pn(m=>jo("privy:wallet:rpc",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(c){return pn(m=>jo("privy:wallet:set-recovery-password",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(c){return pn(m=>jo("privy:mfa:verify",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(c){return pn(m=>jo("privy:mfa:init-enrollment",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(c){return jo("privy:mfa:submit-enrollment",c,r)},unenrollMfa(c){return pn(m=>jo("privy:mfa:unenroll",{...c,...m},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 $d(()=>jo("privy:iframe:ready",{},r),{abortSignal:s.signal}).then(a,l),()=>{window.removeEventListener("message",n),s.abort()}},[t.current,e.mfaMethods]),(0,jy.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:ya(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Bc(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(r=>t.includes(r))}var il=class{constructor(t,o){this.meta={action:t,phoneNumber:o}}async init(){if(!this.meta.action)throw new C("action required");if(!this.api)throw new C("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new C("phone number must be set when initialzing authentication.");try{let t=Ed();await this.api.post(t,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw fe(t)}}async authenticate(){if(!this.meta.action)throw new C("action required");if(!this.api)throw new C("Mfa flow has no API instance");if(!this.meta.smsCode)throw new C("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new C("phone number must be set prior to calling authenticate.");try{let t=Td(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return Wt(o)}catch(t){throw fe(t)}}};var kt=require("react/jsx-runtime"),yi;function qC(e){return typeof e=="string"&&e.length===25}function qe(){if(!yi){let e=ce.get(Hr);return Promise.resolve(e||null)}return yi.getAccessToken()}var Yy,Qd=(e,t)=>Yy(e,t),Jy,Zd=(e,t)=>Jy(e,t),Qy,Xd=(e,t)=>Qy(e,t),Zy,ep=()=>Zy(),jC=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;ce.put(bi,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},Xy=({config:e,...t})=>{if(!qC(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");yi||(yi=new Nn({appId:t.appId,apiUrl:t.apiUrl||ca}));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."),(0,kt.jsx)(Tp,{client:yi,clientConfig:o,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,kt.jsx)(KC,{...t,config:o,client:yi})})},KC=e=>{let t=e.client,[o,r]=(0,K.useState)(!1),[n,i]=(0,K.useState)(!1),[a,l]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null),[m,g]=(0,K.useState)(!1),[y,v]=(0,K.useState)([]),b=(0,K.useRef)(y),[E,S]=(0,K.useState)(!1),[T,P]=(0,K.useState)(null),[O,I]=(0,K.useState)(!1),[L,D]=(0,K.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:x}),[M,G]=(0,K.useState)(null),[Y,ie]=(0,K.useState)(null),[U,q]=(0,K.useState)(null),k=Ha(),Ee=Pp(),[pe,ee]=(0,K.useState)(!0),[eo,Re]=(0,K.useState)({}),[wt,et]=(0,K.useState)(null),[le,Ko]=(0,K.useState)(null),[to,un]=(0,K.useState)(!1),[Ct,$e]=(0,K.useState)(!1),To=(0,K.useRef)(null),mn=(0,K.useRef)(null),R=(0,K.useRef)(Jp);t.onStoreToken=d=>{d&&B(R,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{B(R,"accessToken","onAccessTokenRemoved")};let st=(0,K.useRef)(),vi=(0,K.useCallback)(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]),re=d=>{P(d),setTimeout(()=>{r(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:d})},oo=d=>{k.embeddedWallets.createOnLogin!=="off"&&ee(!0),re(d)};(0,K.useEffect)(()=>{if(!U||!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(U,p,k.defaultChain)}},[U,s]),(0,K.useEffect)(()=>{U&&le?.(U)},[U]),(0,K.useEffect)(()=>{(async()=>{if(!k.customAuth?.enabled)return;ee(!0);let{getCustomAccessToken:p,isLoading:h}=k.customAuth;if(!(!n||h))try{let w=await p();if(!w){await hn.logout();return}if(a)return;t.startAuthFlow(new gn(w));let{user:N,isNewUser:j}=await t.authenticate();N||await hn.logout(),c(N||null),S(j||!1),l(!0),$e(!0)}catch(w){console.warn(w),a&&await hn.logout()}})()},[k.customAuth?.enabled,k.customAuth?.getCustomAccessToken,k.customAuth?.isLoading,n,a]),(0,K.useEffect)(()=>{Ct&&U&&s&&Gt(s,e.config?.embeddedWallets?.createOnLogin)&&($e(!1),ea(s,Cn).catch(console.error))},[Ct&&U&&s]),(0,K.useEffect)(()=>{async function d(){let p=Fr();jC();let h=(0,Ky.createStore)();G(h),t.initializeConnectorManager(k.walletConnectCloudProjectId,k.rpcConfig,k.chains,k.defaultChain,h,k.appearance.walletList,k.shouldEnforceDefaultChainOnConnect),t.connectors?.initialize().then(()=>{fn()});let w=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(l(!!w),w&&B(R,"login","onComplete",w,!1,!0,null),c(w)),p||Ie.setReadyToTrue(),p&&w&&g(!0)}n||d()},[t,wt,n]);let Fr=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_oauth_code"),h=d.get("privy_oauth_state"),w=d.get("privy_oauth_provider");return p&&h&&w?(t.startAuthFlow(new hr(w,p,h)),oo("AWAITING_OAUTH_SCREEN"),!0):!1},Xi=async(d,p,h,w)=>{let N=await t.connectors?.createWalletConnector(d,p)||null;wi(N,p,h,w)};async function wi(d,p,h,w){if(!d)return D({status:"disconnected",connectedWallet:null,connectError:new J("Unable to connect to wallet."),connector:null,connectRetry:x}),w?.(null,h);d instanceof ko&&p&&await d.resetConnection(p),D({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>wi(d,p,h,w)});try{let N=await d.connect({showPrompt:!0});if(k.shouldEnforceDefaultChainOnConnect&&!k.chains.find(j=>j.id===Number(N?.chainId))&&!(N?.connectorType==="wallet_connect_v2"&&N?.walletClientType==="metamask")){D(j=>({...j,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:x}));try{await N?.switchChain(k.defaultChain.id),N&&(N.chainId=bn($r(k.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${k.defaultChain.id}`)}}return D(j=>({...j,status:"connected",connectedWallet:N,connectError:null,connectRetry:x})),N&&!O&&B(R,"connectWallet","onSuccess",N),w?.(N,h)}catch(N){return N instanceof tt?(console.warn(N.cause?N.cause:N.message),O||B(R,"connectWallet","onError",N.privyErrorCode||"generic_connect_wallet_error")):(console.warn(N),O||B(R,"connectWallet","onError","unknown_connect_wallet_error")),D(j=>({...j,status:"disconnected",connectedWallet:null,connectError:N})),w?.(null,h)}}let mr=async(d,p)=>{if(d===null)return;let h=new Vr(d,p);t.startAuthFlow(h)},fn=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),h=d.get("privy_wallet_client");if(!p||!h)return;if(h==="phantom"&&!yr()&&oo("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");re("AWAITING_CONNECTION");let w=new URL(window.location.href);w.searchParams.delete("privy_connector"),w.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",w),Xi(p,h,void 0,mr)};(0,K.useEffect)(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let lt=()=>{if(!a)throw new C("User must be authenticated before linking a wallet.");g(!0),re("LINK_WALLET_SCREEN")},Rt=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},Ht=async d=>{if(!t.connectors)throw new C("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(D(h=>({...h,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:x})),k.captchaEnabled&&!a){let h={callback:w=>mr(d,w),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};Re({captchaModalData:h}),oo("CAPTCHA_SCREEN")}else await mr(d),oo("AWAITING_CONNECTION")},al=async(d,p)=>{if(!k.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:h,externalTransactionId:w}=await Rf(t,d,p?.config??{},k.appearance.palette,k.fiatOnRamp.useSandbox);return{signedUrl:h,externalTransactionId:w}}else throw new C("Unsupported fund provider. Currently supported option is `moonpay`.")},fr=()=>{v(d=>{let p=t.connectors?.wallets.map(h=>({...h,linked:Rt(h),loginOrLink:async()=>{if(!await h.isConnected())throw new C("Wallet is not connected");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");Ht(h)},fund:async w=>{let{signedUrl:N,externalTransactionId:j}=await al(h.address,w);Re({fiatOnRampPrompt:{signedUrl:N},fiatOnRampStatus:{externalTransactionId:j}}),re("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new C("User is not authenticated.");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let w=await t.unlinkWallet(h.address);c(w)}}))||[];return un(vi(p)),wa(d,p)?d:p})};(0,K.useEffect)(()=>{fr()},[s?.linkedAccounts,a,n]),(0,K.useEffect)(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");fr(),t.connectors.on("walletsUpdated",fr)}},[n]);let ro=()=>{re(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,K.useEffect)(()=>{if(!y[0])return;let d=y[0],p=b.current.find(w=>w.address===d.address),h;if(d.walletClientType==="privy"?h=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===d.address&&w.walletClientType==="privy"):h=s?.linkedAccounts.find(w=>w.type==="wallet"&&w.address===d.address&&w.walletClientType!=="privy"),!p&&h){let w=Object.assign({},s);w.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType},c(w)}b.current=y},[y]);let ea=async(d,p)=>{if(Se(d))throw B(R,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[w,N]=await Promise.all([Ie.initializeWalletProxy(p),qe()]);if(!w&&e.config?.customAuth?.enabled)throw B(R,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!w||!N||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((j,Te)=>{ee(!0),Re({createWallet:{onSuccess:bt=>{B(R,"createWallet","onSuccess",bt),j(bt)},onFailure:bt=>{B(R,"createWallet","onError","unknown_embedded_wallet_error"),Te(bt)},callAuthOnSuccessOnClose:!1}}),re("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await w.create({accessToken:N});let j=await Ie.refreshUser(),Te=Se(j);if(!Te)throw B(R,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return B(R,"createWallet","onSuccess",Te),Te}},Tg=d=>{if(!k.chains.map(p=>p.id).includes(d))throw new J(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Vc=(d,p,h)=>new Promise(async(w,N)=>{if(!a||!s){B(R,"sendTransaction","onError","must_be_authenticated"),N(new Error("User must be authenticated before signing with a Privy wallet"));return}let j=Se(s);if(!j){B(R,"sendTransaction","onError","embedded_wallet_not_found"),N(new Error("Must have a Privy wallet before signing"));return}ee(!0);let Te=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,ct=d.chainId?Number(d.chainId):Te.chainId;Tg(ct);let bt=Object.assign({},d,{chainId:ct}),Yo=async()=>{let dt=await qe();if(!dt||!U){B(R,"sendTransaction","onError","embedded_wallet_not_found"),N(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Ie.recoverEmbeddedWallet()){B(R,"sendTransaction","onError","unknown_connect_wallet_error"),N(new Error("Unable to connect to wallet"));return}let Jo=new gi.StaticJsonRpcProvider(so(bt.chainId,k.chains,k.rpcConfig)),xg=await pi(j.address,bt,Jo),qc=await Ys(dt,j.address,U,xg,Jo);B(R,"sendTransaction","onSuccess",qc),w(qc)}catch(no){B(R,"sendTransaction","onError","transaction_failure"),N(no)}};if(k.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Yo();else{let dt={transactionRequest:bt,onSuccess:Jo=>{B(R,"sendTransaction","onSuccess",Jo),w(Jo)},onFailure:Jo=>{B(R,"sendTransaction","onError","transaction_failure"),N(Jo)},uiOptions:p||{},fundWalletConfig:h},no={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:Jo=>{B(R,"sendTransaction","onError","unknown_connect_wallet_error"),N(Jo)}};Re({connectWallet:no,sendTransaction:dt}),re("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function zc(){return new Promise(async(d,p)=>{let h=await qe();if(!h||!U)throw new Error("Must have valid access token to enroll in MFA");try{await U.verifyMfa({accessToken:h}),d()}catch(w){p(w)}})}let hn={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:ro,linkWallet:lt,linkEmail:()=>{if(!a)throw new C("User must be authenticated before linking an email address.");if(s?.email)throw new C("User already has an email linked to their account.");g(!0),re("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(!a)throw new C("User must be authenticated before linking a phone number.");if(s?.phone)throw new C("User already has a phone number linked to their account.");g(!0),re("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(!a)throw new C("User must be authenticated before linking a Google account.");if(s?.google)throw new C("User already has a Google account linked to their account.");await Ie.initLoginWithOAuth("google")},linkTwitter:async()=>{if(!a)throw new C("User must be authenticated before linking a Twitter account.");if(s?.twitter)throw new C("User already has a Twitter account linked to their account.");await Ie.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(!a)throw new C("User must be authenticated before linking a Discord account.");if(s?.discord)throw new C("User already has a Discord account linked to their account.");await Ie.initLoginWithOAuth("discord")},linkGithub:async()=>{if(!a)throw new C("User must be authenticated before linking a GitHub account.");if(s?.github)throw new C("User already has a Github account linked to their account.");await Ie.initLoginWithOAuth("github")},linkTiktok:async()=>{if(!a)throw new C("User must be authenticated before linking a TikTok account.");if(s?.tiktok)throw new C("User already has a Tiktok account linked to their account.");await Ie.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(!a)throw new C("User must be authenticated before linking a LinkedIn account.");if(s?.linkedin)throw new C("User already has a LinkedIn account linked to their account.");await Ie.initLoginWithOAuth("linkedin")},linkApple:async()=>{if(!a)throw new C("User must be authenticated before linking an Apple account.");await Ie.initLoginWithOAuth("apple")},linkFarcaster:async()=>{if(!a)throw new C("User must be authenticated before linking a Farcaster account.");await Ie.initLoginWithFarcaster(),g(!0),re("AWAITING_FARCASTER_CONNECTION")},login:async()=>{if(n||(await new Promise(d=>{et(()=>d)}),et(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}I(!0),oo("LANDING")},logout:async()=>{await t.logout(),c(null),l(!1),P(null),B(R,"logout","onSuccess"),g(!1),r(!1),ce.del(Ei)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new xe;let d=y.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(w=>w.address===d?.address));return!d||!p?new xe:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new gi.Web3Provider(new co(new xe));let d=y.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(w=>w.address===d?.address));return!d||!p?new gi.Web3Provider(new co(new xe)):new gi.Web3Provider(new co(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new wr(new xe);let d=y.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(w=>w.address===d?.address));return!d||!p?new wr(new xe):new wr(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=y.find(w=>(0,Zi.getAddress)(w.address)===(0,Zi.getAddress)(d)),h=s?.linkedAccounts.find(w=>w.type==="wallet"&&(0,Zi.getAddress)(w.address)===(0,Zi.getAddress)(d));if(!p||!await p.isConnected())ie(d),lt();else if(!p.linked)p.loginOrLink();else{let w=Object.assign({},s);w.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType},c(w)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw B(R,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return ea(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw B(R,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Se(s);if(!d||!U)throw B(R,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw B(R,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await zc()}catch(p){throw B(R,"setWalletPassword","onError","missing_mfa_credentials"),p}return new Promise((p,h)=>{ee(!0);let w={onSuccess:j=>{B(R,"setWalletPassword","onSuccess",j),p(j)},onFailure:j=>{B(R,"setWalletPassword","onError","user_exited_set_password_flow"),h(j)},callAuthOnSuccessOnClose:!1},N={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:j=>{B(R,"setWalletPassword","onError","unknown_connect_wallet_error"),h(j)}};Re({setWalletPassword:w,connectWallet:N}),re("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(h,w)=>{if(!a||!s){B(R,"signMessage","onError","must_be_authenticated"),w(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=Se(s);if(!N){B(R,"signMessage","onError","embedded_wallet_not_found"),w(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){B(R,"signMessage","onError","invalid_message"),w(new Error("Message must be a non-empty string"));return}ee(!0);let j=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Te=await qe();if(!U||!Te)throw new Error("Unable to connect to wallet");if(!await Ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:N.address});let{response:bt}=await U.rpc({accessToken:Te,address:N.address,request:{method:"personal_sign",params:[d,N.address]}}),Yo=bt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:N.address}),Yo};if(k.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Te=await j();B(R,"signMessage","onSuccess",Te),h(Te)}catch(Te){B(R,"signMessage","onError","unable_to_sign"),w(Te??new ot("Unable to sign message"))}}else{let bt={method:"personal_sign",data:d,confirmAndSign:j,onSuccess:dt=>{B(R,"signMessage","onSuccess",dt),h(dt)},onFailure:dt=>{B(R,"signMessage","onError","unable_to_sign"),w(dt)},uiOptions:p||{}},Yo={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:dt=>{B(R,"signMessage","onError","unknown_connect_wallet_error"),w(dt)}};Re({signMessage:bt,connectWallet:Yo}),re("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(h,w)=>{if(!a||!s){B(R,"signTypedData","onError","must_be_authenticated"),w(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=Se(s);if(!N){B(R,"signTypedData","onError","embedded_wallet_not_found"),w(new Error("Must have a Privy wallet before signing"));return}ee(!0);let j=ga(d),Te=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let ct=await qe();if(!U||!ct)throw new Error("Unable to connect to wallet");if(!await Ie.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_typed_data_started",{walletAddress:N.address});let{response:Yo}=await U.rpc({accessToken:ct,address:N.address,request:{method:"eth_signTypedData_v4",params:[N.address,j]}}),dt=Yo.data;return t.createAnalyticsEvent("embedded_wallet_sign_typed_data_completed",{walletAddress:N.address}),dt};if(k.embeddedWallets.noPromptOnSignature||(k.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ct=await Te();B(R,"signTypedData","onSuccess",ct),h(ct)}catch(ct){B(R,"signTypedData","onError","unable_to_sign"),w(ct??new ot("Unable to sign message"))}}else{let Yo={method:"eth_signTypedData_v4",data:j,confirmAndSign:Te,onSuccess:no=>{B(R,"signTypedData","onSuccess",no),h(no)},onFailure:no=>{B(R,"signTypedData","onError","unable_to_sign"),w(no)},uiOptions:p||{}},dt={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:no=>{B(R,"signMessage","onError","unknown_connect_wallet_error"),w(no)}};Re({signMessage:Yo,connectWallet:dt}),re("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,h)=>{let N=await(await Vc(d,p,h)).wait();return Qs(N)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}let h=Se(s);if(!h){p(new Error("Must have a Privy wallet before exporting"));return}ee(!0);let w={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p},N=await qe();if(!N||!U){p(new Error("Must have valid access token to enroll in MFA"));return}if(!U){p(new Error("Must have a Privy wallet before exporting"));return}try{try{await U.connect({accessToken:N,address:h.address}),await U.verifyMfa({accessToken:N})}catch(Te){if(Kr(Te))await Ie.recoverEmbeddedWallet();else throw Te}}catch(Te){p(Te);return}let j={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};Re({keyExport:j,connectWallet:w}),re("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:zc,async init(d){let p;switch(d){case"sms":p=new il("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":To.current?.resolve({mfaMethod:d,mfaCode:p}),await new Promise((h,w)=>{mn.current={resolve:h,reject:w}});break;default:throw To.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${d}`)}},cancel(){To.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(d){let p=await qe();if(!p||!U)throw new Error("Must have valid access token to enroll in MFA");await U.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,h)=>{if(!d){Ie.closePrivyModal(),p();return}k.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."),Re({mfaEnrollmentFlow:{mfaMethods:k.mfa.methods,onSuccess:p,onFailure:h}}),re("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await qe();if(!d||!U)throw new Error("Must have valid access token to enroll in MFA");let p=await U.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await qe();if(!p||!U)throw new Error("Must have valid access token to enroll in MFA");await U.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async submitEnrollmentWithTotp(d){let p=await qe();if(!p||!U)throw new Error("Must have valid access token to enroll in MFA");await U.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async unenroll(d){let p=await qe();if(!p||!U)throw new Error("Must have valid access token to remove MFA");await U.unenrollMfa({method:d,accessToken:p});let h=await t.getAuthenticatedUser();c(h)},loginWithCode(d){return Ie.loginWithCode(d)},initLoginWithEmail(d){return Ie.initLoginWithEmail(d)},initLoginWithSms(d){return Ie.initLoginWithSms(d)},isModalOpen:o};Yy=hn.signMessage,Jy=hn.signTypedData,Qy=async(...d)=>{let p=await Vc(...d);return k.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let $c=!!e.config?.headless,Ie=(()=>({headless:$c,isNewUserThisSession:E,isLinking:m,linkingHint:Y,pendingTransaction:null,walletConnectionStatus:L,mipdStore:M,connectors:t.connectors?.walletConnectors??[],rpcConfig:k.rpcConfig,chains:k.chains,showFiatPrices:k.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>k.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(U)return U;let p=new Promise(N=>{Ko(()=>j=>N(j))}),h=new Promise(N=>setTimeout(()=>N(null),d)),w=await Promise.race([p,h]);return Ko(null),w},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0})=>{let p=n&&a&&s;d.shouldCallAuthOnSuccess&&p?(B(R,"login","onComplete",s,E,!1,st.current??null),e.onSuccess?.(s,E)):O&&B(R,"login","onError","exited_auth_flow"),ie(null),I(!1),g(!1),S(!1),r(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},openPrivyModal:re,connectWallet:wi,initLoginWithWallet:async(d,p)=>{st.current="siwe",mr(d,p)},loginWithWallet:async()=>{if(!n)throw new yn;if(!(t.authFlow instanceof Vr))throw new C("Must initialize SIWE flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(h){throw B(R,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||s||null),S(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new Ci(d);t.startAuthFlow(p);try{st.current="farcaster",await p.initializeFarcasterConnect()}catch(h){throw B(R,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},loginWithFarcaster:async()=>{if(!n)throw new yn;if(!(t.authFlow instanceof Ci))throw new C("Must initialize Farcaster flow first.");let d,p;if(a)d=await t.link();else try{({user:d,isNewUser:p}=await t.authenticate())}catch(h){throw B(R,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||null),S(p||!1),l(!0)},initLoginWithOAuth:async(d,p)=>{if(Fd()){if(d==="google"&&Bc(window.navigator.userAgent)){oo("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{oo("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let h=new hr(d);p&&h.addCaptchaToken(p),t.startAuthFlow(h);let w=await t.authFlow.getAuthorizationUrl();w&&w.url&&window.location.assign(w.url)},loginWithOAuth:async d=>{if(!(t.authFlow instanceof hr))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let p=io.get(vn),h=t.authFlow.meta.stateCode;if(p!==h)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:d,storedStateCode:p??"",returnedStateCode:h??""}),new C("Unexpected auth flow. This may be a phishing attempt.");let w,N;if(a)w=await t.link();else try{({user:w,isNewUser:N}=await t.authenticate()),st.current=d}catch(j){throw B(R,"login","onError",j.privyErrorCode||"unknown_auth_error"),j}c(w),S(N||!1),l(!0)},initLoginWithEmail:async(d,p)=>{let h=new Br(d,p);t.startAuthFlow(h);try{st.current="email",await h.sendCodeEmail()}catch(w){throw B(R,"login","onError",w.privyErrorCode||"unknown_auth_error"),w}},initLoginWithSms:async(d,p)=>{let h=new zr(d,p);t.startAuthFlow(h);try{st.current="sms",await h.sendSmsCode()}catch(w){throw B(R,"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 yn;if(t.authFlow instanceof Br)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof zr)t.authFlow.meta.smsCode=d.trim();else throw new C("Must initialize a passwordless code flow first");let p,h;a?p=await t.link():{user:p,isNewUser:h}=await t.authenticate(),c(p||s||null),S(h||!1),l(!0)},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:U,createAnalyticsEvent:(d,p,h)=>t.createAnalyticsEvent(d,p,h),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let h=s?.linkedAccounts.find(N=>N.type==="wallet"&&N.walletClientType==="privy"),w=await qe();if(!w||!U||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ee(!0);try{await U.connect({accessToken:w,address:h.address}),d(!0)}catch(N){Kr(N)&&h.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:h.address}),(await U.recover({address:h.address,accessToken:w})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:h.address}),d(!0)):Kr(N)?(Re({recoverWallet:{privyWallet:h,onFailure:p,onSuccess:()=>d(!0)}}),re("EMBEDDED_WALLET_RECOVERY_SCREEN")):p(N)}}),getFiatOnRampConfig:al,setReadyToTrue:()=>{i(!0),wt?.()},updateWallets:()=>fr()}))();Zy=Ie.recoverEmbeddedWallet;let Pg=(0,K.useMemo)(()=>({wallets:y,ready:to}),[y,to]);return(0,kt.jsx)(he.Provider,{value:hn,children:(0,kt.jsx)(Wl.Provider,{value:R,children:(0,kt.jsx)(Mc.Provider,{value:Pg,children:(0,kt.jsxs)(qp,{...k,children:[e.children,(0,kt.jsxs)(Il.Provider,{value:Ie,children:[!$c&&k.captchaEnabled&&n&&!a&&(0,kt.jsx)(Ka,{delayedExecution:!1}),(0,kt.jsx)(Gy,{theme:{...k.appearance.palette||{}}}),(0,kt.jsx)(_p,{data:eo,setModalData:Re,setInitialScreen:P,initialScreen:T,authenticated:a,open:o,children:(0,kt.jsx)($y,{open:o})}),pe&&Ee?(0,kt.jsx)(qy,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:To,mfaSubmitPromise:mn,onLoad:q,onLoadFailed:()=>null}):null]})]})})})})};var eg=require("react");function tg(e){let{login:t}=(0,eg.useContext)(he);return Ue("login",e),{login:t}}var og=require("react");function rg(e){let{logout:t}=(0,og.useContext)(he);return Ue("logout",e),{logout:t}}var Hc=require("react");var ng=()=>{let e=Ae(),{initLoginWithEmail:t,loginWithCode:o}=V(),r=(0,Hc.useCallback)(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return e.status==="disabled",t(i)},[t]),n=(0,Hc.useCallback)(async({code:i})=>{if(e.enabled&&e.status==="error")throw new er(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};var Gc=require("react");var ig=()=>{let e=Ae(),{initLoginWithSms:t,loginWithCode:o}=V(),r=(0,Gc.useCallback)(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return e.status==="disabled",t(i)},[t]),n=(0,Gc.useCallback)(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new er(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};var ag=require("react");function sg(e){let{connectWallet:t}=(0,ag.useContext)(he);return Ue("connectWallet",e),{connectWallet:t}}var lg=require("react");function cg(e){let{createWallet:t}=(0,lg.useContext)(he);return Ue("createWallet",e),{createWallet:t}}var dg=require("react");function pg(e){let{sendTransaction:t}=(0,dg.useContext)(he);return Ue("sendTransaction",e),{sendTransaction:t}}var ug=require("react");function mg(e){let{setWalletPassword:t}=(0,ug.useContext)(he);return Ue("setWalletPassword",e),{setWalletPassword:t}}var fg=require("react");function hg(e){let{signMessage:t}=(0,fg.useContext)(he);return Ue("signMessage",e),{signMessage:t}}var yg=require("react");function gg(e){let{signTypedData:t}=(0,yg.useContext)(he);return Ue("signTypedData",e),{signTypedData:t}}var vg=require("react");var wg=()=>{let{isModalOpen:e}=(0,vg.useContext)(he);return{isOpen:e}};var Cg=require("react");function bg(e){let{getAccessToken:t}=(0,Cg.useContext)(he);return Ue("accessToken",e),{getAccessToken:t}}function Eg(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useLogin,useLoginWithEmail,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSignMessage,useSignTypedData,useToken,useWallets});
|